Work on filemanager

This commit is contained in:
Laurent Destailleur
2017-11-10 15:29:12 +01:00
parent c2d7b88bdd
commit beacf4225f
8 changed files with 80 additions and 35 deletions

View File

@@ -268,7 +268,7 @@ if ($type == 'directory')
if ($module == 'medias') if ($module == 'medias')
{ {
$useinecm = 0; $useinecm = 2;
$modulepart='medias'; $modulepart='medias';
$perm=($user->rights->website->write || $user->rights->emailing->creer); $perm=($user->rights->website->write || $user->rights->emailing->creer);
$title='none'; $title='none';

View File

@@ -917,6 +917,7 @@ class FormFile
* @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 * 0: Add a previw link. Show also rename and crop file
* 1: Add link to edit ECM entry * 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 string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
* @param int $maxlength Maximum length of file name shown. * @param int $maxlength Maximum length of file name shown.
* @param string $title Title before list. Use 'none' to disable title. * @param string $title Title before list. Use 'none' to disable title.
@@ -1128,11 +1129,11 @@ class FormFile
// Delete or view link // Delete or view link
// ($param must start with &) // ($param must start with &)
print '<td class="valignmiddle right"><!-- action on files -->'; print '<td class="valignmiddle right"><!-- action on files -->';
if ($useinecm) if ($useinecm == 1)
{ {
print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view('default', 0, 'class="paddingrightonly"').'</a>'; print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view('default', 0, 'class="paddingrightonly"').'</a>';
} }
else if (! $useinecm || $useinecm == 2)
{ {
$newmodulepart=$modulepart; $newmodulepart=$modulepart;
if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service'; if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service';
@@ -1151,7 +1152,7 @@ class FormFile
if ($permtoeditline) if ($permtoeditline)
{ {
print '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=editfile&urlfile='.urlencode($filepath).$param).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>'; print '<a href="'.(($useinecm == 1)?'#':($url.'?action=editfile&urlfile='.urlencode($filepath).$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>';
} }
} }
if ($permonobject) if ($permonobject)

View File

@@ -58,7 +58,11 @@ if (empty($conf->dol_no_mouse_hover))
return $(this).prop(\'title\'); /* To force to get title as is */ 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 () { jQuery(".classfortooltiponclick").click(function () {
console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\')); console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
if ($(this).attr(\'dolid\')) if ($(this).attr(\'dolid\'))

View File

@@ -42,8 +42,10 @@ $langs->load("categories");
if (! $user->rights->ecm->setup) accessforbidden(); if (! $user->rights->ecm->setup) accessforbidden();
// Get parameters // Get parameters
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
$action=GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
// Security check // Security check
@@ -86,11 +88,20 @@ if (! empty($section))
// Action ajout d'un produit ou service // Action ajout d'un produit ou service
if ($action == 'add' && $user->rights->ecm->setup) if ($action == 'add' && $user->rights->ecm->setup)
{ {
if (! empty($_POST["cancel"])) if ($cancel)
{ {
header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); if (! empty($backtopage))
exit; {
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager');
exit;
}
} }
$ecmdir->ref = trim($_POST["ref"]); $ecmdir->ref = trim($_POST["ref"]);
$ecmdir->label = trim($_POST["label"]); $ecmdir->label = trim($_POST["label"]);
$ecmdir->description = trim($_POST["desc"]); $ecmdir->description = trim($_POST["desc"]);
@@ -150,10 +161,11 @@ if ($action == 'create')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
$title=$langs->trans("ECMNewSection"); $title=$langs->trans("ECMNewSection");
print load_fiche_titre($title); print load_fiche_titre($title);
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@@ -206,7 +218,7 @@ if (empty($action) || $action == 'delete_section')
if ($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'); print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection');
} }
// Construit fiche rubrique // Construit fiche rubrique

View File

@@ -43,25 +43,32 @@ if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->us
print '<div class="inline-block toolbarbutton centpercent">'; print '<div class="inline-block toolbarbutton centpercent">';
// Toolbar // Toolbar
if ($user->rights->ecm->setup) //if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) {
{ //if ($module == 'ecm') {
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">'; $permtoadd = 0;
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">'; if ($module == 'ecm') $permtoadd = $user->rights->ecm->setup;
print '</a>'; if ($module == 'medias') $permtoadd = ($user->rights->ecm->setup || $user->rights->website->setup);
}
else if ($permtoadd)
{ {
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">'; print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&module='.urlencode($module).'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$website.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">'; print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>'; print '</a>';
} }
if ($module == 'ecm') else
{ {
$tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:''))); print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">'; print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">'; print '</a>';
print '</a>'; }
} if ($module == 'ecm')
{
$tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:'')));
print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print '</a>';
}
//}
// Start "Add new file" area // Start "Add new file" area
$nameforformuserfile = 'formuserfileecm'; $nameforformuserfile = 'formuserfileecm';

View File

@@ -1858,7 +1858,7 @@ if (! function_exists("llxFooter"))
global $delayedhtmlcontent; global $delayedhtmlcontent;
$ext='version='.urlencode(DOL_VERSION); $ext='version='.urlencode(DOL_VERSION);
// Global html output events ($mesgs, $errors, $warnings) // Global html output events ($mesgs, $errors, $warnings)
dol_htmloutput_events($disabledoutputofmessages); dol_htmloutput_events($disabledoutputofmessages);
@@ -1918,7 +1918,7 @@ if (! function_exists("llxFooter"))
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n"; print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
print '<script type="text/javascript" src="/dolibarr/htdocs/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext?'&amp;'.$ext:'').'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext?'&amp;'.$ext:'').'"></script>'."\n";
} }
// Wrapper to add log when clicking on download or preview // Wrapper to add log when clicking on download or preview

View File

@@ -4844,7 +4844,7 @@ div.tabsElem a.tab {
@media only screen and (max-width: 1024px) @media only screen and (max-width: 1024px)
{ {
div#ecm-layout-west { div#ecm-layout-west {
width: 100%; width: calc(100% - 4px);
clear: both; clear: both;
} }
div#ecm-layout-center { div#ecm-layout-center {

View File

@@ -1161,6 +1161,8 @@ if ($action == 'edit')
$style=''; $style='';
if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource') $style=' margin-bottom: 5px;'; if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource') $style=' margin-bottom: 5px;';
if (! GETPOST('hide_websitemenu'))
{
//var_dump($objectpage);exit; //var_dump($objectpage);exit;
print '<div class="centpercent websitebar">'; print '<div class="centpercent websitebar">';
@@ -1221,6 +1223,23 @@ if (count($object->records) > 0)
print ' &nbsp; '; print ' &nbsp; ';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">'; print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
/*print '<a class="button button_file_manager"'.$disabled.'>'.dol_escape_htmltag($langs->trans("MediaFiles")).'</a>';
print '<script language="javascript">
jQuery(document).ready(function () {
jQuery(".button_file_manager").click(function () {
var $dialog = $(\'<div></div>\').html(\'<iframe style="border: 0px;" src="'.DOL_URL_ROOT.'/website/index.php?hide_websitemenu=1&dol_hide_topmenu=1&dol_hide_leftmenu=1&file_manager=1&website='.$website.'&pageid='.$pageid.'" width="100%" height="100%"></iframe>\')
.dialog({
autoOpen: false,
modal: true,
height: 500,
width: \'80%\',
title: "'.dol_escape_js($langs->trans("FileManager")).'"
});
$dialog.dialog(\'open\');
});
});
</script>';
*/
} }
print '</div>'; print '</div>';
@@ -1465,8 +1484,10 @@ else
$action=''; $action='';
} }
print '</div>'; // end current websitebar print '</div>'; // end current websitebar
}
$head = array(); $head = array();