From beacf4225ff0c414a8848fd658eb9933d11a9d12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Nov 2017 15:29:12 +0100 Subject: [PATCH] Work on filemanager --- htdocs/core/ajax/ajaxdirpreview.php | 2 +- htdocs/core/class/html.formfile.class.php | 7 ++-- htdocs/core/js/lib_foot.js.php | 6 ++- htdocs/ecm/docdir.php | 26 +++++++++---- htdocs/ecm/tpl/filemanager.tpl.php | 45 +++++++++++++---------- htdocs/main.inc.php | 4 +- htdocs/theme/eldy/style.css.php | 2 +- htdocs/website/index.php | 23 +++++++++++- 8 files changed, 80 insertions(+), 35 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 9107b604e80..90e5bc1521f 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -268,7 +268,7 @@ if ($type == 'directory') if ($module == 'medias') { - $useinecm = 0; + $useinecm = 2; $modulepart='medias'; $perm=($user->rights->website->write || $user->rights->emailing->creer); $title='none'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2a514f65f1f..bc162abd170 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -917,6 +917,7 @@ class FormFile * @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 + * 2: Add rename and crop file * @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. Use 'none' to disable title. @@ -1128,11 +1129,11 @@ class FormFile // Delete or view link // ($param must start with &) print ''; - if ($useinecm) + if ($useinecm == 1) { print ''.img_view('default', 0, 'class="paddingrightonly"').''; } - else + if (! $useinecm || $useinecm == 2) { $newmodulepart=$modulepart; if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service'; @@ -1151,7 +1152,7 @@ class FormFile if ($permtoeditline) { - print ''.img_edit('default',0,'class="paddingrightonly"').''; + print ''.img_edit('default',0,'class="paddingrightonly"').''; } } if ($permonobject) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index c133e0014f1..d3b3db60ef8 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -58,7 +58,11 @@ if (empty($conf->dol_no_mouse_hover)) return $(this).prop(\'title\'); /* To force to get title as is */ } }); - jQuery(".classfortooltiponclicktext").dialog({ closeOnEscape: true, classes: { "ui-dialog": "highlight" }, maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).', autoOpen: false }).css("z-index: 5000"); + jQuery(".classfortooltiponclicktext").dialog( + { closeOnEscape: true, classes: { "ui-dialog": "highlight" }, + maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).', + modal: true, + autoOpen: false }).css("z-index: 5000"); jQuery(".classfortooltiponclick").click(function () { console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\')); if ($(this).attr(\'dolid\')) diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index b3b9fa528e0..2fa84f8b96d 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -42,8 +42,10 @@ $langs->load("categories"); if (! $user->rights->ecm->setup) accessforbidden(); // Get parameters -$socid = GETPOST('socid','int'); -$action=GETPOST('action','alpha'); +$socid = GETPOST('socid','int'); +$action = GETPOST('action','alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); $confirm=GETPOST('confirm','alpha'); // Security check @@ -86,11 +88,20 @@ if (! empty($section)) // Action ajout d'un produit ou service if ($action == 'add' && $user->rights->ecm->setup) { - if (! empty($_POST["cancel"])) + if ($cancel) { - header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); - exit; + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); + exit; + } } + $ecmdir->ref = trim($_POST["ref"]); $ecmdir->label = trim($_POST["label"]); $ecmdir->description = trim($_POST["desc"]); @@ -150,10 +161,11 @@ if ($action == 'create') print '
'; print ''; print ''; + print ''; $title=$langs->trans("ECMNewSection"); print load_fiche_titre($title); - + dol_fiche_head(); print ''; @@ -206,7 +218,7 @@ if (empty($action) || $action == 'delete_section') if ($action == 'delete_section') { print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); - + } // Construit fiche rubrique diff --git a/htdocs/ecm/tpl/filemanager.tpl.php b/htdocs/ecm/tpl/filemanager.tpl.php index c5216deb170..d201e73798e 100644 --- a/htdocs/ecm/tpl/filemanager.tpl.php +++ b/htdocs/ecm/tpl/filemanager.tpl.php @@ -43,25 +43,32 @@ if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->us print '
'; // Toolbar -if ($user->rights->ecm->setup) -{ - print ''; - print ''; - print ''; -} -else -{ - print ''; - print ''; - print ''; -} -if ($module == 'ecm') -{ - $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); - print ''; - print ''; - print ''; -} +//if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) { +//if ($module == 'ecm') { + $permtoadd = 0; + if ($module == 'ecm') $permtoadd = $user->rights->ecm->setup; + if ($module == 'medias') $permtoadd = ($user->rights->ecm->setup || $user->rights->website->setup); + + if ($permtoadd) + { + print ''; + print ''; + print ''; + } + else + { + print ''; + print ''; + print ''; + } + if ($module == 'ecm') + { + $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); + print ''; + print ''; + print ''; + } +//} // Start "Add new file" area $nameforformuserfile = 'formuserfileecm'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9389d960171..1d049e670c9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1858,7 +1858,7 @@ if (! function_exists("llxFooter")) global $delayedhtmlcontent; $ext='version='.urlencode(DOL_VERSION); - + // Global html output events ($mesgs, $errors, $warnings) dol_htmloutput_events($disabledoutputofmessages); @@ -1918,7 +1918,7 @@ if (! function_exists("llxFooter")) if (! empty($conf->use_javascript_ajax)) { print "\n".''."\n"; - print ''."\n"; + print ''."\n"; } // Wrapper to add log when clicking on download or preview diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 03825de4406..fb9b9724114 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4844,7 +4844,7 @@ div.tabsElem a.tab { @media only screen and (max-width: 1024px) { div#ecm-layout-west { - width: 100%; + width: calc(100% - 4px); clear: both; } div#ecm-layout-center { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b3f1116d50c..d030bdb4647 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1161,6 +1161,8 @@ if ($action == 'edit') $style=''; if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource') $style=' margin-bottom: 5px;'; +if (! GETPOST('hide_websitemenu')) +{ //var_dump($objectpage);exit; print '
'; @@ -1221,6 +1223,23 @@ if (count($object->records) > 0) print '   '; print ''; + /*print ''.dol_escape_htmltag($langs->trans("MediaFiles")).''; + print ''; + */ } print '
'; @@ -1465,8 +1484,10 @@ else $action=''; } - print '
'; // end current websitebar +} + + $head = array();