Enhancements in ecm module
This commit is contained in:
parent
985af1d060
commit
25d6387eae
@ -18,11 +18,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdoc/ecm/docdir.php
|
||||
\ingroup ecm
|
||||
\brief Main page for ECM section area
|
||||
\version $Id$
|
||||
\author Laurent Destailleur
|
||||
* \file htdoc/ecm/docdir.php
|
||||
* \ingroup ecm
|
||||
* \brief Main page for ECM section area
|
||||
* \version $Id$
|
||||
* \author Laurent Destailleur
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -103,7 +103,7 @@ if ($_POST["action"] == 'add' && $user->rights->ecm->setup)
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
Header("Location: ".DOL_URL_ROOT.'/ecm/index.php');
|
||||
Header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -154,7 +154,7 @@ if ($_GET["action"] == 'create')
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.$ecmdir->label.'"></td></tr>'."\n";
|
||||
|
||||
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>';
|
||||
print $formecm->select_all_sections($ecmdir->fk_parent,'catParent');
|
||||
print $formecm->select_all_sections(! empty($_GET["catParent"])?$_GET["catParent"]:$ecmdir->fk_parent,'catParent');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Description
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/treeview.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/ecm/ecmdirectory.class.php");
|
||||
|
||||
// Load traductions files
|
||||
@ -122,14 +123,14 @@ $userstatic = new User($db);
|
||||
// Ajout rubriques automatiques
|
||||
$rowspan=0;
|
||||
$sectionauto=array();
|
||||
if ($conf->produit->enabled) { $rowspan++; $sectionauto[]=array('module'=>'product', 'test'=>$conf->produit->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
|
||||
if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); }
|
||||
if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
|
||||
if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
|
||||
if ($conf->commande->enabled) { $rowspan++; $sectionauto[]=array('module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
|
||||
if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('module'=>'supplier_order', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
|
||||
if ($conf->facture->enabled) { $rowspan++; $sectionauto[]=array('module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
|
||||
if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('module'=>'supplier_invoice', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
|
||||
if ($conf->produit->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>$conf->produit->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
|
||||
if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); }
|
||||
if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
|
||||
if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
|
||||
if ($conf->commande->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
|
||||
if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'supplier_order', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
|
||||
if ($conf->facture->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
|
||||
if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'supplier_invoice', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
|
||||
|
||||
|
||||
//***********************
|
||||
@ -145,7 +146,7 @@ print "<br>\n";
|
||||
$colspan=3;
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr '.$bc[0].'>';
|
||||
print '<td>'.img_picto('','object_list').' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("ECMFileManager").'</td>';
|
||||
print '<td>'.img_picto('','object_list').' <a href="'.$_SERVER["PHP_SELF"].'?action=file_manager">'.$langs->trans("ECMFileManager").'</td>';
|
||||
print '<td align="right">'.img_picto('','search').' <a href="'.$_SERVER["PHP_SELF"].'?action=search_form">'.$langs->trans("Search").'</td>';
|
||||
print '</tr></table>';
|
||||
|
||||
@ -202,7 +203,7 @@ if (eregi('search',$action))
|
||||
}
|
||||
|
||||
|
||||
if (empty($action) || $action == 'refresh')
|
||||
if (empty($action) || $action == 'file_manager' || eregi('refresh',$action))
|
||||
{
|
||||
// Confirmation de la suppression d'une ligne categorie
|
||||
if ($_GET['action'] == 'delete_section')
|
||||
@ -215,54 +216,52 @@ if (empty($action) || $action == 'refresh')
|
||||
|
||||
|
||||
// Construit liste des répertoires
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="5" align="left">'.$langs->trans("ECMSectionOfDocuments").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (sizeof($sectionauto))
|
||||
{
|
||||
// Automatic sections
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">'.$langs->trans("ECMSectionOfDocuments").'</td>';
|
||||
print '<td class="liste_titre" align="left">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("ECMNbOfDocsSmall").' <a href="'.$_SERVER["PHP_SELF"].'?action=refresh">'.img_picto($langs->trans("Refresh"),'refresh').'</a></td>';
|
||||
print '<td class="liste_titre" width="16px" align="center">';
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create">'.img_picto($langs->trans("ECMNewSection"),'edit_add').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
// Automatic sections title line
|
||||
print '<tr '.$bc[true].'><td>';
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
|
||||
print '<td align="left" width="24px">';
|
||||
print img_picto_common('','treemenu/base.gif');
|
||||
print '</td><td align="left">'.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionAuto").')';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" width="16px"> </td>';
|
||||
print '</tr></table>';
|
||||
print '<td align="right" colspan="3"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
//print '<td align="right">'.$langs->trans("ECMNbOfDocsSmall").' <a href="'.$_SERVER["PHP_SELF"].'?action=refreshauto">'.img_picto($langs->trans("Refresh"),'refresh').'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
$sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false);
|
||||
|
||||
$var=true;
|
||||
$nbofentries=0;
|
||||
$oldvallevel=0;
|
||||
foreach ($sectionauto as $key => $val)
|
||||
{
|
||||
if ($val['test'])
|
||||
{
|
||||
$var=! $var;
|
||||
$var=false;
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Section
|
||||
print '<td align="left">';
|
||||
print img_picto('','object_dir').' ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/ecm/docother.php">';
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding"><td>';
|
||||
print tree_showpad($sectionauto,$key);
|
||||
print '</td><td valign="top">';
|
||||
print img_picto('','object_dir');
|
||||
print '</td><td>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/ecm/docother.php">';
|
||||
print $val['label'];
|
||||
print '</a>';
|
||||
print '</a></td></tr></table>';
|
||||
print "</td>\n";
|
||||
|
||||
// Type
|
||||
print '<td align="left">'.$langs->trans('ECMTypeAuto').'</td>';
|
||||
print '<td align="right">?</td>';
|
||||
|
||||
// Edit link
|
||||
print '<td align="right"> </td>';
|
||||
|
||||
// Info
|
||||
print '<td align="right">';
|
||||
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
|
||||
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMAutoOrg").'<br>';
|
||||
@ -270,24 +269,48 @@ if (empty($action) || $action == 'refresh')
|
||||
$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['desc'];
|
||||
print $form->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
// Edit link
|
||||
print '<td align="right"> </td>';
|
||||
|
||||
// Add link
|
||||
print '<td align="right"> </td>';
|
||||
|
||||
// Nb of doc
|
||||
print '<td align="right">?</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$oldvallevel=$val['level'];
|
||||
$nbofentries++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Manual sections title line
|
||||
print '<tr '.$bc[true].'><td>';
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
|
||||
print '<td align="left" width="24px">';
|
||||
print img_picto_common('','treemenu/base.gif');
|
||||
print '</td><td align="left">'.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionManual").')';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '<td align="right" colspan="2"> </td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create">'.img_edit_add().'</a></td>';
|
||||
print '<td align="right">'.$langs->trans("ECMNbOfDocsSmall").' <a href="'.$_SERVER["PHP_SELF"].'?action=refreshmanual">'.img_picto($langs->trans("Refresh"),'refresh').'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Manual sections
|
||||
$ecmdirstatic = new ECMDirectory($db);
|
||||
$rub=$ecmdirstatic->get_full_arbo();
|
||||
|
||||
$userstatic = new User($db);
|
||||
|
||||
$nbofentries=0;
|
||||
$oldvallevel=0;
|
||||
$var=true;
|
||||
foreach($rub as $key => $val)
|
||||
{
|
||||
$var=!$var;
|
||||
$var=false;
|
||||
|
||||
$ecmdirstatic->id=$val['id'];
|
||||
$ecmdirstatic->ref=$val['label'];
|
||||
@ -307,20 +330,16 @@ if (empty($action) || $action == 'refresh')
|
||||
|
||||
// Section
|
||||
print '<td align="left">';
|
||||
print str_repeat(' ',$val['level']-1);
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding"><td>';
|
||||
print tree_showpad($rub,$key);
|
||||
print '</td><td valign="top">';
|
||||
print $ecmdirstatic->getNomUrl(1);
|
||||
print '</td><td>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$val['id'].'">';
|
||||
print '</a></td></tr></table>';
|
||||
print "</td>\n";
|
||||
|
||||
// Description
|
||||
print '<td align="left">'.$langs->trans("ECMTypeManual").'</td>';
|
||||
|
||||
// Nb of docs
|
||||
//print '<td align="right">'.$obj->cachenbofdoc.'</td>';
|
||||
print '<td align="right">'.$val['cachenbofdoc'].'</td>';
|
||||
|
||||
// Edit link
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$val['id'].'">'.img_edit().'</a></td>';
|
||||
|
||||
// Info
|
||||
print '<td align="right">';
|
||||
$userstatic->id=$val['fk_user_c'];
|
||||
$userstatic->nom=$val['login_c'];
|
||||
@ -332,8 +351,19 @@ if (empty($action) || $action == 'refresh')
|
||||
print $form->textwithhelp('',$htmltooltip,1,0);
|
||||
print "</td>";
|
||||
|
||||
// Edit link
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$val['id'].'">'.img_edit().'</a></td>';
|
||||
|
||||
// Add link
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
|
||||
|
||||
// Nb of docs
|
||||
//print '<td align="right">'.$obj->cachenbofdoc.'</td>';
|
||||
print '<td align="right">'.$val['cachenbofdoc'].'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$oldvallevel=$val['level'];
|
||||
$nbofentries++;
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ class modECM extends DolibarrModules
|
||||
'type'=>'left',
|
||||
'titre'=>'ECMFileManager',
|
||||
'mainmenu'=>'ecm',
|
||||
'url'=>'/ecm/index.php',
|
||||
'url'=>'/ecm/index.php?action=file_manager',
|
||||
'langs'=>'ecm',
|
||||
'position'=>100,
|
||||
'perms'=>'$user->rights->ecm->read',
|
||||
|
||||
@ -811,7 +811,7 @@ function img_object($alt, $object)
|
||||
\brief Affiche picto (fonction g<EFBFBD>n<EFBFBD>rique)
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param picto Nom de l'image a afficher (Si pas d'extension, on met '.png')
|
||||
\param options Attribut suppl<EFBFBD>mentaire a la balise img
|
||||
\param options Attribut supplementaire a la balise img
|
||||
\param pictoisfullpath If 1, image path is a full path
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
@ -823,6 +823,22 @@ function img_picto($alt, $picto, $options='', $pictoisfullpath=0)
|
||||
return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/'.$picto.'" border="0" alt="'.$alt.'" title="'.$alt.'"'.($options?' '.$options:'').'>';
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Affiche picto (fonction g<EFBFBD>n<EFBFBD>rique)
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param picto Nom de l'image a afficher (Si pas d'extension, on met '.png')
|
||||
\param options Attribut supplementaire a la balise img
|
||||
\param pictoisfullpath If 1, image path is a full path
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
function img_picto_common($alt, $picto, $options='', $pictoisfullpath=0)
|
||||
{
|
||||
global $conf;
|
||||
if (! eregi('(\.png|\.gif)$',$picto)) $picto.='.png';
|
||||
if ($pictoisfullpath) return '<img src="'.$picto.'" border="0" alt="'.$alt.'" title="'.$alt.'"'.($options?' '.$options:'').'>';
|
||||
return '<img src="'.DOL_URL_ROOT.'/theme/common/'.$picto.'" border="0" alt="'.$alt.'" title="'.$alt.'"'.($options?' '.$options:'').'>';
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Affiche logo action
|
||||
\param alt Texte sur le alt de l'image
|
||||
|
||||
@ -24,6 +24,40 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Show picto of a tree view
|
||||
*
|
||||
* @param unknown_type $tab Array of entries in correct order
|
||||
* @param unknown_type $key Key of value
|
||||
*/
|
||||
function tree_showpad(&$tab,$key)
|
||||
{
|
||||
$pos=1;
|
||||
while ($pos <= $tab[$key]['level'] && $tab[$key]['level'] > 0)
|
||||
{
|
||||
// Process picto for column $pos
|
||||
// \TODO If at least one of this level
|
||||
$atleastonofthislevelafter=1;
|
||||
if ($atleastonofthislevelafter)
|
||||
{
|
||||
if ($tab[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif');
|
||||
else print img_picto_common('','treemenu/line.gif');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($tab[$key]['level'] == $pos) print img_picto_common('','treemenu/branchbottom.gif');
|
||||
else print img_picto_common('','treemenu/linebottom.gif');
|
||||
}
|
||||
$pos++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------- Used by enu editor -----------------
|
||||
|
||||
/**
|
||||
* \brief Ad javascript tree functions
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user