mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
Better navigation in file manager in ECM module.
This commit is contained in:
@@ -378,6 +378,8 @@ class EcmDirectory // extends CommonObject
|
|||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$this->id.'">';
|
||||||
if ($option == 'index') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'">';
|
if ($option == 'index') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'">';
|
||||||
|
if ($option == 'indexexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=false">';
|
||||||
|
if ($option == 'indexnotexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
|
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdoc/ecm/index.php
|
* \file htdoc/ecm/index.php
|
||||||
\ingroup ecm
|
* \ingroup ecm
|
||||||
\brief Main page for ECM section area
|
* \brief Main page for ECM section area
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
\author Laurent Destailleur
|
* \author Laurent Destailleur
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@@ -396,6 +396,7 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Load full tree
|
||||||
$fulltree=$ecmdirstatic->get_full_arbo();
|
$fulltree=$ecmdirstatic->get_full_arbo();
|
||||||
|
|
||||||
// Define fullpathselected ( _x_y_z )
|
// Define fullpathselected ( _x_y_z )
|
||||||
@@ -411,6 +412,35 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $
|
|||||||
}
|
}
|
||||||
//print "fullpathselected=".$fullpathselected."<br>";
|
//print "fullpathselected=".$fullpathselected."<br>";
|
||||||
|
|
||||||
|
// 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'].'<br>';
|
||||||
|
|
||||||
$nbofentries=0;
|
$nbofentries=0;
|
||||||
$oldvallevel=0;
|
$oldvallevel=0;
|
||||||
$var=true;
|
$var=true;
|
||||||
@@ -431,22 +461,26 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $
|
|||||||
$val['cachenbofdoc']=$result;
|
$val['cachenbofdoc']=$result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show line if level 1 or level selected
|
//$fullpathparent=eregi_replace('_[^_]+$','',$val['fullpath']);
|
||||||
|
|
||||||
|
// Define showline
|
||||||
$showline=0;
|
$showline=0;
|
||||||
$fullpathparent=eregi_replace('_[^_]+$','',$val['fullpath']);
|
|
||||||
// If directory is son of selected directory, we show line
|
// If directory is son of expanded directory, we show line
|
||||||
if ($val['id_mere'] == $section) $showline=5;
|
if (in_array($val['id_mere'],$expandedsectionarray)) $showline=4;
|
||||||
// If directory is brother of selected directory, we show line
|
// If directory is brother of selected directory, we show line
|
||||||
elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) $showline=4;
|
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
|
// If directory is parent of selected directory or is selected directory, we show line
|
||||||
elseif (eregi($val['fullpath'].'_',$fullpathselected.'_')) $showline=3;
|
elseif (eregi($val['fullpath'].'_',$fullpathselected.'_')) $showline=2;
|
||||||
// If parent directory is in a same path than selected directory
|
|
||||||
elseif (eregi($fullpathparent.'_',$fullpathselected.'_')) $showline=2;
|
|
||||||
// If we are level one we show line
|
// If we are level one we show line
|
||||||
elseif ($val['level'] < 2) $showline=1;
|
elseif ($val['level'] < 2) $showline=1;
|
||||||
|
|
||||||
if ($showline)
|
if ($showline)
|
||||||
{
|
{
|
||||||
|
if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded';
|
||||||
|
else $option='indexnotexpanded';
|
||||||
|
//print $option;
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
|
|
||||||
// Show tree graph pictos
|
// Show tree graph pictos
|
||||||
@@ -456,12 +490,15 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
// Show picto
|
// Show picto
|
||||||
print '<td valign="top">';
|
print '<td valign="top">';
|
||||||
//print $fullpathparent.'-'.$val['fullpath']."(".$showline.")";
|
//print $val['fullpath']."(".$showline.")";
|
||||||
if ($showline == 5) print img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop2.gif','',1).img_picto('','/theme/common/treemenu/folder.gif','',1);
|
if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop2.gif','',1);
|
||||||
elseif ($showline == 4) print img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop2.gif','',1).img_picto('','/theme/common/treemenu/folder.gif','',1);
|
else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop2.gif','',1);
|
||||||
elseif ($showline == 3) print img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop2.gif','',1).img_picto('','/theme/common/treemenu/folder-expanded.gif','',1);
|
$oldref=$ecmdirstatic->ref;
|
||||||
elseif ($showline == 2) print img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop2.gif','',1).img_picto('','/theme/common/treemenu/folder.gif','',1);
|
$ecmdirstatic->ref=$ref;
|
||||||
elseif ($showline == 1) print img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop2.gif','',1).img_picto('','/theme/common/treemenu/folder.gif','',1);
|
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 '</td>';
|
print '</td>';
|
||||||
// Show link
|
// Show link
|
||||||
print '<td valign="middle">';
|
print '<td valign="middle">';
|
||||||
|
|||||||
@@ -19,13 +19,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/lib/functions2.lib.php
|
* \file htdocs/lib/functions2.lib.php
|
||||||
\brief Ensemble de fonctions de base de dolibarr sous forme d'include.
|
* \brief Ensemble de fonctions de base de dolibarr sous forme d'include.
|
||||||
Used for counters.
|
* This file contains rare functions.
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return next value for a mask
|
* Return next value for a mask
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -25,6 +25,54 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if a child id is in descendance of parentid
|
||||||
|
*
|
||||||
|
* @param $fulltree Full tree. Tree must be an array of records that looks like:
|
||||||
|
* id = id record
|
||||||
|
* id_mere = id record mother
|
||||||
|
* id_children = array of direct child id
|
||||||
|
* label = record label
|
||||||
|
* fullpath = Full path of id
|
||||||
|
* level = Level of record
|
||||||
|
* @param $parentid Parent id
|
||||||
|
* @param $childid Child id
|
||||||
|
* @return int 1=Yes, 0=No
|
||||||
|
*/
|
||||||
|
function is_in_subtree($fulltree,$parentid,$childid)
|
||||||
|
{
|
||||||
|
if ($parentid == $childid) return 1;
|
||||||
|
|
||||||
|
// Get fullpath of parent
|
||||||
|
$fullpathparent='';
|
||||||
|
foreach($fulltree as $key => $val)
|
||||||
|
{
|
||||||
|
//print $val['id']."-".$section."<br>";
|
||||||
|
if ($val['id'] == $parentid)
|
||||||
|
{
|
||||||
|
$fullpathparent=$val['fullpath'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//print '> parent='.$parentid.' - child='.$childid.' - '.$fullpathparent.'<br>';
|
||||||
|
|
||||||
|
foreach($fulltree as $record)
|
||||||
|
{
|
||||||
|
if ($record['id'] == $childid)
|
||||||
|
{
|
||||||
|
//print $record['fullpath'].'_'.' - '.$fullpathparent.'_';
|
||||||
|
if (eregi($fullpathparent.'_',$record['fullpath'].'_'))
|
||||||
|
{
|
||||||
|
//print 'DEL='.$childid;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show picto of a tree view
|
* Show picto of a tree view
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user