diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index ddcf8eb62d8..9107b604e80 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -86,7 +86,12 @@ else // For no ajax call $relativepath=$ecmdir->getRelativePath(); $upload_dir = $rootdirfordoc.'/'.$relativepath; } -if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; + +if (empty($url)) +{ + if (GETPOSTISSET('website')) $url=DOL_URL_ROOT.'/website/index.php'; + else $url=DOL_URL_ROOT.'/ecm/index.php'; +} // Load traductions files $langs->loadLangs(array("ecm","companies","other")); @@ -153,6 +158,8 @@ print ''."\n"; //print ''."\n"; $param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''); +if (! empty($website)) $param.='&website='.$website; +if (! empty($pageid)) $param.='&pageid='.$pageid; // Dir scan @@ -222,6 +229,12 @@ if ($type == 'directory') $relativepath=GETPOST('file','alpha'); if ($relativepath && $relativepath!= '/') $relativepath.='/'; $upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath; + if (GETPOSTISSET('website')) + { + $param.='&file_manager=1'; + if (!preg_match('/website=/',$param)) $param.='&website='.urlencode(GETPOST('website','alpha')); + if (!preg_match('/pageid=/',$param)) $param.='&pageid='.urlencode(GETPOST('pageid','int')); + } } else { @@ -255,28 +268,35 @@ if ($type == 'directory') if ($module == 'medias') { + $useinecm = 0; $modulepart='medias'; - $perm=($user->rights->websites->creer || $user->rights->emailing->creer); + $perm=($user->rights->website->write || $user->rights->emailing->creer); + $title='none'; } else { + $useinecm = 1; $modulepart='ecm'; $perm=$user->rights->ecm->upload; + $title=''; // Use default } - $formfile->list_of_documents($filearray,'',$modulepart,$param,1,$relativepath,$perm,1,$textifempty,$maxlengthname,'',$url); + // When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param + // When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath + //var_dump("title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url); + $formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm); } } -if ($section) -{ +//if ($section) +//{ $useajax=1; if (! empty($conf->dol_use_jmobile)) $useajax=0; if (empty($conf->use_javascript_ajax)) $useajax=0; if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0; - $param.=($param?'?':'').(preg_replace('/^&/','',$param)); + //$param.=($param?'?':'').(preg_replace('/^&/','',$param)); if ($useajax || $action == 'delete') { @@ -295,14 +315,14 @@ if ($section) if ($useajax) { - // Enable jquery handlers on new generated HTML objects + // Enable jquery handlers button to delete files print ''."\n"; } -} +//} // Close db if mode is not noajax if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f105ef78263..2a514f65f1f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -914,10 +914,12 @@ class FormFile * @param int $forcedownload Force to open dialog box "Save As" when clicking on file. * @param string $relativepath Relative path of docs (autodefined if not provided), relative to module dir, not to MAIN_DATA_ROOT. * @param int $permonobject Permission on object (so permission to delete or crop document) - * @param int $useinecm Change output for use in ecm module + * @param int $useinecm Change output for use in ecm module: + * 0: Add a previw link. Show also rename and crop file + * 1: Add link to edit ECM entry * @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined) * @param int $maxlength Maximum length of file name shown. - * @param string $title Title before list + * @param string $title Title before list. Use 'none' to disable title. * @param string $url Full url to use for click links ('' = autodetect) * @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir * @param int $permtoeditline Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more) @@ -977,7 +979,9 @@ class FormFile } else { - $param = (isset($object->id)?'&id='.$object->id:'').$param; + if (! preg_match('/&id=/', $param) && isset($object->id)) $param.='&id='.$object->id; + $relativepathwihtoutslashend=preg_replace('/\/$/', '', $relativepath); + if ($relativepathwihtoutslashend) $param.= '&file='.urlencode($relativepathwihtoutslashend); if ($permtoeditline < 0) // Old behaviour for backward compatibility. New feature should call method with value 0 or 1 { @@ -995,7 +999,7 @@ class FormFile } // Show list of existing files - if (empty($useinecm)) print load_fiche_titre($title?$title:$langs->trans("AttachedFiles")); + if (empty($useinecm) && $title != 'none') print load_fiche_titre($title?$title:$langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; print ''."\n"; @@ -1023,6 +1027,7 @@ class FormFile } print '
| '.$langs->trans("Ref").' | '; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -259,7 +258,7 @@ $i=0; while ($tmpecmdir && $result > 0) { $tmpecmdir->ref=$tmpecmdir->label; - $s=$tmpecmdir->getNomUrl(1).$s; + $s=$tmpecmdir->getNomUrl(1).$s; if ($tmpecmdir->fk_parent) { $s=' -> '.$s; @@ -272,28 +271,18 @@ while ($tmpecmdir && $result > 0) $i++; } -print img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '; -print $s; -print ' -> '; -if ($action == 'edit') print ''; -else print $urlfile; -print ' | ||||||||||||||||||||||
| '.$langs->trans("Description").' | '; -if ($action == 'edit') -{ - print ''; -} -else print dol_nl2br($ecmdir->description); -print ' | ||||||||||||||||||||||
| '.$langs->trans("ECMCreationUser").' | '; -$userecm=new User($db); -$userecm->fetch($ecmdir->fk_user_c); -print $userecm->getNomUrl(1); -print ' | ||||||||||||||||||||||
| '.$langs->trans("ECMCreationDate").' | ';
+$s = img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '.$s.' -> ';
+if ($action == 'edit') $s .= '';
+else $s .= $urlfile;
+
+$object->ref=''; // Force to hide ref
+dol_banner_tab($object, '', $morehtml, 0, '', '', $s);
+
+print ' ';
+
+print '';
+print ' ';
print ajax_autoselect('downloadinternallink');
print ajax_autoselect('downloadlink');
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 56f9b692e94..8841778ce26 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -337,165 +337,6 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM
$module='ecm';
include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php';
-
-/*
-// Start container of all panels
-?>
-
-
-';
-// End top panel, toolbar
-
-?>
-
-
-formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1);
-}
-// End confirm
-
-
-if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
-{
- print '
-
-
-
-use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
- include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php';
-}
-*/
-
// End of page
dol_fiche_end();
diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
index 4be1bf1979a..3e77c0acd92 100644
--- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
+++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
@@ -33,8 +33,8 @@ $(document).ready(function() {
$('#filetree').fileTree({
root: '',
- // Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code.
- script: '',
+ // Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code to this following URL.
+ script: '',
folderEvent: 'click', // 'dblclick'
multiFolder: false },
// Called if we click on a file (not a dir)
@@ -46,7 +46,7 @@ $(document).ready(function() {
function(elem) {
id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx)
jQuery("#_section_dir").val(elem.attr('rel'));
- jQuery("#_section_id").val(id);
+ jQuery("#_section_id").val(id);
jQuery('#').show();
}
);
@@ -73,7 +73,7 @@ function loadandshowpreview(filedirname,section)
$('#ecmfileview').empty();
- var url = '?action=preview&module=§ion='+section+'&file='+urlencode(filedirname);
+ var url = '?action=preview&module=§ion='+section+'&file='+urlencode(filedirname);
$.get(url, function(data) {
//alert('Load of url '+url+' was performed : '+data);
pos=data.indexOf("TYPE=directory",0);
diff --git a/htdocs/ecm/tpl/filemanager.tpl.php b/htdocs/ecm/tpl/filemanager.tpl.php
index e80e9fd3e83..c5216deb170 100644
--- a/htdocs/ecm/tpl/filemanager.tpl.php
+++ b/htdocs/ecm/tpl/filemanager.tpl.php
@@ -57,8 +57,8 @@ else
}
if ($module == 'ecm')
{
- $url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'§ion='.$section:'')));
- print '';
+ $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'§ion='.$section:'')));
+ print '';
print '
-
-
-
-
-
- ';
print '';
}
@@ -150,7 +150,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
print '';
$mode='noajax';
- $url=DOL_URL_ROOT.'/ecm/index.php';
+ if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php';
print ' ';
@@ -173,7 +173,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
$mode='noajax';
-$url=DOL_URL_ROOT.'/ecm/index.php';
+if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 79eca309e59..b3f1116d50c 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -52,7 +52,6 @@ $pageid=GETPOST('pageid', 'int');
$pageref=GETPOST('pageref', 'aZ09');
$action=GETPOST('action','alpha');
-
if (GETPOST('delete')) { $action='delete'; }
if (GETPOST('preview')) $action='preview';
if (GETPOST('createsite')) { $action='createsite'; }
@@ -67,6 +66,18 @@ if (GETPOST('editcontent')) { $action='editcontent'; }
if (GETPOST('createfromclone')) { $action='createfromclone'; }
if (GETPOST('createpagefromclone')) { $action='createpagefromclone'; }
+// Load variable for pagination
+$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
+$sortfield = GETPOST("sortfield",'alpha');
+$sortorder = GETPOST("sortorder",'alpha');
+$page = GETPOST("page",'int');
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+$offset = $limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+//if (! $sortfield) $sortfield='name';
+//if (! $sortorder) $sortorder='ASC';
+
if (empty($action)) $action='preview';
$object=new Website($db);
@@ -111,7 +122,6 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
-
/*
* Actions
*/
@@ -1792,6 +1802,7 @@ if ($action == 'file_manager')
//print ''.$langs->trans("FeatureNotYetAvailable").'';
$module = 'medias';
+ if (empty($url)) $url=DOL_URL_ROOT.'/website/index.php';
include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php';
}
| ||||||||||||||||||||||