2
0
forked from Wavyzz/dolibarr

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')
{
$useinecm = 0;
$useinecm = 2;
$modulepart='medias';
$perm=($user->rights->website->write || $user->rights->emailing->creer);
$title='none';

View File

@@ -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 '<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>';
}
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 '<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)

View File

@@ -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\'))

View File

@@ -43,7 +43,9 @@ if (! $user->rights->ecm->setup) accessforbidden();
// Get parameters
$socid = GETPOST('socid','int');
$action=GETPOST('action','alpha');
$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)
{
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,6 +161,7 @@ if ($action == 'create')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
$title=$langs->trans("ECMNewSection");
print load_fiche_titre($title);

View File

@@ -43,25 +43,32 @@ if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->us
print '<div class="inline-block toolbarbutton centpercent">';
// Toolbar
if ($user->rights->ecm->setup)
{
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
//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 '<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 '</a>';
}
else
{
}
else
{
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
if ($module == 'ecm')
{
}
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
$nameforformuserfile = 'formuserfileecm';

View File

@@ -1918,7 +1918,7 @@ if (! function_exists("llxFooter"))
if (! empty($conf->use_javascript_ajax))
{
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

View File

@@ -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 {

View File

@@ -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 '<div class="centpercent websitebar">';
@@ -1221,6 +1223,23 @@ if (count($object->records) > 0)
print ' &nbsp; ';
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>';
@@ -1465,8 +1484,10 @@ else
$action='';
}
print '</div>'; // end current websitebar
}
$head = array();