';
// Left area
print '';
if (eregi('search',$action))
{
//print_fiche_titre($langs->trans("ECMManualOrg"));
print '";
//print $langs->trans("ECMManualOrgDesc");
//print_fiche_titre($langs->trans("ECMAutoOrg"));
print '";
//print $langs->trans("ECMAutoOrgDesc");
}
if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $action == 'delete')
{
$userstatic = new User($db);
$ecmdirstatic = new ECMDirectory($db);
// Confirmation de la suppression d'une ligne categorie
if ($_GET['action'] == 'delete_section')
{
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection');
print ' ';
}
// Construit liste des répertoires
print '';
print '';
print '| '.$langs->trans("ECMSections").' | ';
print '';
print ''.$langs->trans("Refresh").' '.img_picto($langs->trans("Refresh"),'refresh').'';
print ' | ';
print ' ';
if (sizeof($sectionauto))
{
// Automatic sections title line
print '';
print '';
print '';
print '| ';
print img_picto_common('','treemenu/base.gif');
print ' | '.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionAuto").')';
print ' | ';
print ' ';
print ' | ';
print ' | ';
print ' | ';
print ' | ';
print '';
$htmltooltip=$langs->trans("ECMAreaDesc2");
print $form->textwithhelp('',$htmltooltip,1,0);
print ' | ';
//print ''.$langs->trans("ECMNbOfDocsSmall").' '.img_picto($langs->trans("Refresh"),'refresh').' | ';
print ' ';
$sectionauto=dol_sort_array($sectionauto,'label','ASC',true,false);
$nbofentries=0;
$oldvallevel=0;
foreach ($sectionauto as $key => $val)
{
if ($val['test'])
{
$var=false;
print '';
// Section
print '| ';
print '';
print " | \n";
// Nb of doc
print ' | ';
// Edit link
print ' | ';
// Add link
print ' | ';
// Info
print '';
$htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].' ';
$htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMAutoOrg").' ';
$htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$langs->trans("ECMTypeAuto").' ';
$htmltooltip.=''.$langs->trans("Description").': '.$val['desc'];
print $form->textwithhelp('',$htmltooltip,1,0);
print ' | ';
print " \n";
$oldvallevel=$val['level'];
$nbofentries++;
}
}
}
// Manual sections title line
print '';
print '';
print '| ';
print img_picto_common('','treemenu/base.gif');
print ' | '.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionManual").')';
print ' | ';
print '
| ';
print '';
print ' | ';
print ' | ';
//print ''.img_edit_add().' | ';
print ' | ';
print '';
$htmltooltip=$langs->trans("ECMAreaDesc2");
print $form->textwithhelp('',$htmltooltip,1,0);
print ' | ';
print ' ';
// Load full tree
$fulltree=$ecmdirstatic->get_full_arbo();
// Define fullpathselected ( _x_y_z )
$fullpathselected='';
foreach($fulltree as $key => $val)
{
//print $val['id']."-".$section." ";
if ($val['id'] == $section)
{
$fullpathselected=$val['fullpath'];
break;
}
}
//print "fullpathselected=".$fullpathselected." ";
// Update expandedsectionarray in session
$expandedsectionarray=split(',',$_SESSION['expandedsectionarray']);
if ($section && $_GET['sectionexpand'] == 'true')
{
// We add all sections that are parent of opened section
$pathtosection=split('_',$fullpathselected);
foreach($pathtosection as $idcursor)
{
if ($idcursor && ! in_array($idcursor,$expandedsectionarray)) // Not already in array
{
$expandedsectionarray[]=$idcursor;
}
}
$_SESSION['expandedsectionarray']=join(',',$expandedsectionarray);
}
if ($section && $_GET['sectionexpand'] == 'false')
{
// We removed all expanded sections that are child of the closed section
$oldexpandedsectionarray=$expandedsectionarray;
$expandedsectionarray=array();
foreach($oldexpandedsectionarray as $sectioncursor)
{
// is_in_subtree(fulltree,sectionparent,sectionchild)
if ($sectioncursor && ! is_in_subtree($fulltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor;
}
$_SESSION['expandedsectionarray']=join(',',$expandedsectionarray);
}
//print $_SESSION['expandedsectionarray'].' ';
$nbofentries=0;
$oldvallevel=0;
$var=true;
foreach($fulltree as $key => $val)
{
$var=false;
$ecmdirstatic->id=$val['id'];
$ecmdirstatic->ref=$val['label'];
// Refresh cache
if (eregi('refresh',$_GET['action']))
{
$result=$ecmdirstatic->fetch($val['id']);
$ecmdirstatic->ref=$ecmdirstatic->label;
$result=$ecmdirstatic->refreshcachenboffile();
$val['cachenbofdoc']=$result;
}
//$fullpathparent=eregi_replace('_[^_]+$','',$val['fullpath']);
// Define showline
$showline=0;
// If directory is son of expanded directory, we show line
if (in_array($val['id_mere'],$expandedsectionarray)) $showline=4;
// If directory is brother of selected directory, we show line
elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) $showline=3;
// If directory is parent of selected directory or is selected directory, we show line
elseif (eregi($val['fullpath'].'_',$fullpathselected.'_')) $showline=2;
// If we are level one we show line
elseif ($val['level'] < 2) $showline=1;
if ($showline)
{
if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded';
else $option='indexnotexpanded';
//print $option;
print '';
// Show tree graph pictos
print '';
print '| ';
print tree_showpad($fulltree,$key);
print ' | ';
// Show picto
print '';
//print $val['fullpath']."(".$showline.")";
if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop2.gif','',1);
else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop2.gif','',1);
$oldref=$ecmdirstatic->ref;
$ecmdirstatic->ref=$ref;
print $ecmdirstatic->getNomUrl(0,$option);
$ecmdirstatic->ref=$oldref;
if (! in_array($val['id'],$expandedsectionarray)) print img_picto('','/theme/common/treemenu/folder.gif','',1);
else print img_picto('','/theme/common/treemenu/folder-expanded.gif','',1);
print ' | ';
// Show link
print '';
if ($section == $val['id']) print ' ';
print $ecmdirstatic->getNomUrl(0,'index');
if ($section == $val['id']) print '';
print ' | ';
print ' | ';
print ' ';
print " | \n";
// Nb of docs
print ''.$val['cachenbofdoc'].' | ';
// Edit link
print ''.img_edit().' | ';
// Add link
//print ''.img_edit_add().' | ';
print ' | ';
// Info
print '';
$userstatic->id=$val['fk_user_c'];
$userstatic->nom=$val['login_c'];
$htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].' ';
$htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMManualOrg").' ';
$htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1).' ';
$htmltooltip.=''.$langs->trans("ECMCreationDate").': '.dolibarr_print_date($val['date_c'],"dayhour").' ';
$htmltooltip.=''.$langs->trans("Description").': '.$val['description'];
print $form->textwithhelp('',$htmltooltip,1,0);
print " | ";
print " \n";
}
$oldvallevel=$val['level'];
$nbofentries++;
}
// If nothing to show
if ($nbofentries == 0)
{
print '| '.$langs->trans("ECMNoDirecotyYet").' | ';
}
print " ";
// Fin de zone Ajax
}
print ' | ';
print ' | ';
// Right area
$relativepath=$ecmdir->getRelativePath();
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
$formfile=new FormFile($db);
$param='§ion='.$section;
$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->create,1);
// print '';
print ' |
';
// Actions buttons
print '