Fix pb in recursive dol_dir_list return.
This commit is contained in:
parent
caaeac35b6
commit
330f3af74d
@ -51,10 +51,11 @@ function dol_basename($pathfile)
|
||||
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
|
||||
* @param int $nohook Disable all hooks
|
||||
* @param string $relativename For recursive purpose only. Must be "" at first call.
|
||||
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
|
||||
* @see dol_dir_list_indatabase
|
||||
*/
|
||||
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0)
|
||||
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
|
||||
{
|
||||
global $db, $hookmanager;
|
||||
global $object;
|
||||
@ -144,6 +145,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename?$relativename.'/':'').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
@ -155,7 +157,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
// if we're in a directory and we want recursive behavior, call this function again
|
||||
if ($recursive)
|
||||
{
|
||||
$file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook));
|
||||
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename?$relativename.'/':'').$file));
|
||||
}
|
||||
}
|
||||
else if (! $isdir && (($types == "files") || ($types == "all")))
|
||||
@ -172,6 +174,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename?$relativename.'/':'').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
|
||||
@ -12,7 +12,7 @@ ModuleInitialized=Module initialized
|
||||
FilesForObjectInitialized=Files for new object '%s' initialized
|
||||
FilesForObjectUpdated=Files for object '%s' updated (.sql files and .class.php file)
|
||||
ModuleBuilderDescdescription=Enter here all general information that describe your module
|
||||
ModuleBuilderDescspecifications=You can enter here a long text to describe the specifications of your module that is not already structured into other tabs. So you have within easy reach all the rules to develop. Also this text content will be included into the generated documentation (see last tab).
|
||||
ModuleBuilderDescspecifications=You can enter here a long text to describe the specifications of your module that is not already structured into other tabs. So you have within easy reach all the rules to develop. Also this text content will be included into the generated documentation (see last tab). You can use Markdown format, but it is recommanded to use Asciidoc format (Comparison between .md and .asciidoc: http://asciidoctor.org/docs/user-manual/#compared-to-markdown)
|
||||
ModuleBuilderDescobjects=Define here the objects you want to manage with your module. A sql file, a page to list them, to create/edit/view a card and an API will be generated.
|
||||
ModuleBuilderDescmenus=This tab is dedicated to define menu entries provided by your module.
|
||||
ModuleBuilderDescpermissions=This tab is dedicated to define the new permissions you want to provide with your module.
|
||||
@ -52,4 +52,5 @@ ReadmeFile=Readme file
|
||||
ChangeLog=ChangeLog file
|
||||
SqlFile=Sql file
|
||||
SqlFileKey=Sql file for keys
|
||||
AnObjectAlreadyExistWithThisNameAndDiffCase=An object already exists with this name and a different case
|
||||
AnObjectAlreadyExistWithThisNameAndDiffCase=An object already exists with this name and a different case
|
||||
UseAsciiDocFormat=You can use Markdown format, but it is recommanded to use Asciidoc format (Comparison between .md and .asciidoc: http://asciidoctor.org/docs/user-manual/#compared-to-markdown)
|
||||
@ -924,20 +924,26 @@ elseif (! empty($module))
|
||||
|
||||
if ($tab == 'specifications')
|
||||
{
|
||||
$pathtofile = $modulelowercase.'/SPECIFICATIONS.md';
|
||||
|
||||
if ($action != 'editfile' || empty($file))
|
||||
{
|
||||
print '<span class="fa fa-file"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '<br>';
|
||||
$specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$');
|
||||
|
||||
// Use MD or asciidoc
|
||||
//print 'http://asciidoctor.org/docs/user-manual/#compared-to-markdown';
|
||||
foreach ($specs as $spec)
|
||||
{
|
||||
$pathtofile = $modulelowercase.'/doc/'.$spec['relativename'];
|
||||
|
||||
print '<span class="fa fa-file"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$fullpathoffile=dol_buildpath($file, 0);
|
||||
// Use MD or asciidoc
|
||||
|
||||
//print $langs->trans("UseAsciiDocFormat").'<br>';
|
||||
|
||||
$fullpathoffile=dol_buildpath($file, 0);
|
||||
|
||||
$content = file_get_contents($fullpathoffile);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user