diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 7b29159b227..a987f16a8c7 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -104,8 +104,10 @@ if (!isset($mode) || $mode != 'noajax') { // For ajax call $upload_dir = $rootdirfordoc.'/'.$relativepath; } -if (empty($url)) { - if (GETPOSTISSET('website')) { +if (empty($url)) { // autoset $url but it is better to have it defined before into filemanager.tpl.php (not possible when in auto tree) + if (!empty($module) && $module == 'medias' && !GETPOST('website')) { + $url = DOL_URL_ROOT.'/ecm/index_medias.php'; + } elseif (GETPOSTISSET('website')) { $url = DOL_URL_ROOT.'/website/index.php'; } else { $url = DOL_URL_ROOT.'/ecm/index.php'; @@ -315,7 +317,7 @@ if ($type == 'directory') { $upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath; if (GETPOSTISSET('website') || GETPOSTISSET('file_manager')) { $param .= '&file_manager=1'; - if (!preg_match('/website=/', $param)) { + if (!preg_match('/website=/', $param) && GETPOST('website', 'alpha')) { $param .= '&website='.urlencode(GETPOST('website', 'alpha')); } if (!preg_match('/pageid=/', $param)) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c6b6c3b4c20..bc06d1517dc 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1138,7 +1138,7 @@ class FormFile if ($disablecrop == -1) { $disablecrop = 1; - // Values here must be supported by the photo_resize.php page. + // Values here must be supported by the photos_resize.php page. if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'facture', 'facture_fournisseur', 'holiday', 'medias', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'tax-vat', 'ticket', 'user'))) { $disablecrop = 0; } @@ -1448,10 +1448,15 @@ class FormFile // Link to resize $moreparaminurl = ''; if (!empty($object->id) && $object->id > 0) { - $moreparaminurl = '&id='.$object->id; + $moreparaminurl .= '&id='.$object->id; } elseif (GETPOST('website', 'alpha')) { - $moreparaminurl = '&website='.GETPOST('website', 'alpha'); + $moreparaminurl .= '&website='.GETPOST('website', 'alpha'); } + // Set the backtourl + if ($modulepart == 'medias' && !GETPOST('website')) { + $moreparaminurl .= '&backtourl='.urlencode(DOL_URL_ROOT.'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.'§ion_dir='.$relativepath); + } + //var_dump($moreparaminurl); print ''.img_picto($langs->trans("ResizeOrCrop"), 'resize', 'class="paddingrightonly"').''; } } @@ -1461,6 +1466,7 @@ class FormFile print ''.img_edit('default', 0, 'class="paddingrightonly"').''; } } + // Output link to delete file if ($permonobject) { $useajax = 1; if (!empty($conf->dol_use_jmobile)) { @@ -1494,8 +1500,8 @@ class FormFile } else { print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if (empty($disablemove) && count($filearray) > 1) { print ''; diff --git a/htdocs/core/lib/ecm.lib.php b/htdocs/core/lib/ecm.lib.php index f61ec0e060c..e7840505e8f 100644 --- a/htdocs/core/lib/ecm.lib.php +++ b/htdocs/core/lib/ecm.lib.php @@ -33,12 +33,21 @@ function ecm_prepare_dasboard_head($object) { global $langs, $conf, $user, $form; - global $helptext1, $helptext2; $h = 0; $head = array(); + + $showmediasection = 0; + if (isModEnabled('mailing') || isModEnabled('website')) { + $showmediasection = 1; + } + $helptext = $langs->trans("ECMAreaDesc").'
'; - $helptext .= $langs->trans("ECMAreaDesc2"); + $helptext .= $langs->trans("ECMAreaDesc2a").'
'; + $helptext .= $langs->trans("ECMAreaDesc2b"); + if ($showmediasection) { + $helptext .= '
'.$langs->trans("ECMAreaDesc3"); + } $head[$h][0] = DOL_URL_ROOT.'/ecm/index.php'; $head[$h][1] = $langs->trans("ECMSectionsManual").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3); @@ -52,6 +61,13 @@ function ecm_prepare_dasboard_head($object) $h++; } + if ($showmediasection && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + $head[$h][0] = DOL_URL_ROOT.'/ecm/index_medias.php?file_manager=1'; + $head[$h][1] = $langs->trans("ECMSectionsMedias").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3); + $head[$h][2] = 'index_medias'; + $h++; + } + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 6797f12593f..efbb3ba9c19 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -34,7 +34,7 @@ $langs->loadLangs(array("products", "other")); $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); -$modulepart = GETPOST('modulepart', 'alpha') ?GETPOST('modulepart', 'alpha') : 'produit|service'; +$modulepart = GETPOST('modulepart', 'alpha') ? GETPOST('modulepart', 'alpha') : 'produit|service'; $original_file = GETPOST("file"); $backtourl = GETPOST('backtourl'); $cancel = GETPOST('cancel', 'alpha'); @@ -285,45 +285,45 @@ if (empty($backtourl)) { $regs = array(); if (in_array($modulepart, array('product', 'produit', 'service', 'produit|service'))) { - $backtourl = DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/product/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('expensereport'))) { - $backtourl = DOL_URL_ROOT."/expensereport/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/expensereport/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('holiday'))) { - $backtourl = DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/holiday/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('member'))) { - $backtourl = DOL_URL_ROOT."/adherents/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/adherents/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('project'))) { - $backtourl = DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/projet/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('propal'))) { - $backtourl = DOL_URL_ROOT."/comm/propal/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/comm/propal/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('societe'))) { - $backtourl = DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/societe/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('tax'))) { - $backtourl = DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/compta/sociales/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('ticket'))) { - $backtourl = DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/ticket/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('user'))) { - $backtourl = DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/user/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('facture'))) { - $backtourl = DOL_URL_ROOT."/compta/facture/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/compta/facture/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('facture_fourn', 'facture_fournisseur'))) { - $backtourl = DOL_URL_ROOT."/fourn/facture/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/fourn/facture/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('bank')) && preg_match('/\/statement\/([^\/]+)\//', $file, $regs)) { $num = $regs[1]; - $backtourl = DOL_URL_ROOT."/compta/bank/account_statement_document.php?id=".$id.'&num='.urlencode($num).'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/compta/bank/account_statement_document.php?id=".((int) $id).'&num='.urlencode($num).'&file='.urlencode($file); } elseif (in_array($modulepart, array('bank'))) { - $backtourl = DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/compta/bank/document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('mrp'))) { - $backtourl = DOL_URL_ROOT."/mrp/mo_document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/mrp/mo_document.php?id=".((int) $id).'&file='.urlencode($file); } elseif (in_array($modulepart, array('medias'))) { $section_dir = dirname($file); if (!preg_match('/\/$/', $section_dir)) { $section_dir .= '/'; } - $backtourl = DOL_URL_ROOT."/website/index.php?action=file_manager&website=".$website.'§ion_dir='.urlencode($section_dir); + $backtourl = DOL_URL_ROOT.'/website/index.php?action=file_manager'.($website ? '&website='.urlencode($website) : '').'§ion_dir='.urlencode($section_dir); } else { // Generic case that should work for everybody else - $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($file); + $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".((int) $id).'&file='.urlencode($file); } } @@ -501,8 +501,9 @@ print '
'."\n"; */ print ''."\n"; -print '
'; +print ''; print ''; +print ''; print '
'; print ''.$langs->trans("Resize").''; @@ -521,6 +522,7 @@ print ' '; print ''; print '
'."\n"; print '
'; + print '
'."\n"; @@ -561,8 +563,9 @@ if (!empty($conf->use_javascript_ajax)) { print ''; print '
'; - print '
'; + print ''; print ''; + print ''; print '
'.$langs->trans("NewSizeAfterCropping").': diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 83bb06a8abb..29506584e61 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -264,7 +264,8 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg $showonrightsize = ''; // Manual section - $htmltooltip = $langs->trans("ECMAreaDesc2"); + $htmltooltip = $langs->trans("ECMAreaDesc2a"); + $htmltooltip .= '
'.$langs->trans("ECMAreaDesc2b"); if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { // Show the link to "Root" @@ -288,7 +289,8 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg } print ''; - } else { // Show filtree when ajax is disabled (rare) + } else { + // Show filtree when ajax is disabled (rare) print ''; $_POST['modulepart'] = $module; @@ -325,10 +327,15 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg trans("ECMAreaDesc2"); + $htmltooltip .= '
'.$langs->trans("ECMAreaDesc2b"); $sectionauto = dol_sort_array($sectionauto, 'label', 'ASC', true, false); diff --git a/htdocs/ecm/index_medias.php b/htdocs/ecm/index_medias.php new file mode 100644 index 00000000000..f5ad347bccf --- /dev/null +++ b/htdocs/ecm/index_medias.php @@ -0,0 +1,312 @@ + + * Copyright (C) 2008-2010 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * You can call this page with param module=medias to get a filemanager for medias. + */ + +/** + * \file htdocs/ecm/index_medias.php + * \ingroup ecm + * \brief Main page for ECM section of public media directories area + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array('ecm', 'companies', 'other', 'users', 'orders', 'propal', 'bills', 'contracts')); + +// Get parameters +$action = GETPOST('action', 'aZ09'); + +$socid = GETPOST('socid', 'int'); +$file_manager = GETPOST('file_manager', 'alpha'); +$section = GETPOST('section', 'int') ? GETPOST('section', 'int') : GETPOST('section_id', 'int'); +if (!$section) { + $section = 0; +} +$section_dir = GETPOST('section_dir', 'alpha'); +$overwritefile = GETPOST('overwritefile', 'int'); + +if (empty($action) && $file_manager) { + $action = 'file_manager'; +} + +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : 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 (!$sortorder) { + $sortorder = "ASC"; +} +if (!$sortfield) { + $sortfield = "name"; +} + + +$ecmdir = new EcmDirectory($db); +if ($section > 0) { + $result = $ecmdir->fetch($section); + if (!($result > 0)) { + dol_print_error($db, $ecmdir->error); + exit; + } +} + +$form = new Form($db); +$ecmdirstatic = new EcmDirectory($db); +$userstatic = new User($db); + +$error = 0; + +// Security check +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'ecm', 0); + +$permtouploadfile = ($user->hasRight('ecm', 'setup') || $user->hasRight('mailing', 'creer') || $user->hasRight('website', 'write')); +$diroutput = $conf->medias->multidir_output[$conf->entity]; + +$relativepath = $section_dir; +$upload_dir = preg_replace('/\/$/', '', $diroutput).'/'.preg_replace('/^\//', '', $relativepath); + +$websitekey = ''; + +$permissiontoadd = $permtouploadfile; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles + + +/* + * Actions + */ + +$savbacktopage = $backtopage; +$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.urlencode($websitekey).'&pageid='.urlencode($pageid).(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php +if ($sortfield) { + $backtopage .= '&sortfield='.urlencode($sortfield); +} +if ($sortorder) { + $backtopage .= '&sortorder='.urlencode($sortorder); +} +include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit', 'confirm_deletefile', 'renamefile' action when submitting new file. + +$backtopage = $savbacktopage; + +if ($action == 'renamefile') { // Must be after include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; If action were renamefile, we set it to 'file_manager' + $action = 'file_manager'; +} + + +// Add directory +if ($action == 'add' && $permtouploadfile) { + $ecmdir->ref = 'NOTUSEDYET'; + $ecmdir->label = GETPOST("label"); + $ecmdir->description = GETPOST("desc"); + + $id = $ecmdir->create($user); + if ($id > 0) { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors'); + $action = "create"; + } + + clearstatcache(); +} + +// Remove directory +if ($action == 'confirm_deletesection' && GETPOST('confirm', 'alpha') == 'yes') { + $result = $ecmdir->delete($user); + setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs'); + + clearstatcache(); +} + +// Refresh directory view +// This refresh list of dirs, not list of files (for preformance reason). List of files is refresh only if dir was not synchronized. +// To refresh content of dir with cache, just open the dir in edit mode. +if ($action == 'refreshmanual') { + $ecmdirtmp = new EcmDirectory($db); + + // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate + clearstatcache(); + + $diroutputslash = str_replace('\\', '/', $conf->ecm->dir_output); + $diroutputslash .= '/'; + + // Scan directory tree on disk + $disktree = dol_dir_list($conf->ecm->dir_output, 'directories', 1, '', '^temp$', '', '', 0); + + // Scan directory tree in database + $sqltree = $ecmdirstatic->get_full_arbo(0); + + $adirwascreated = 0; + + // Now we compare both trees to complete missing trees into database + //var_dump($disktree); + //var_dump($sqltree); + foreach ($disktree as $dirdesc) { // Loop on tree onto disk + $dirisindatabase = 0; + foreach ($sqltree as $dirsqldesc) { + if ($conf->ecm->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname']) { + $dirisindatabase = 1; + break; + } + } + + if (!$dirisindatabase) { + $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it"; + dol_syslog($txt); + //print $txt."
\n"; + + // We must first find the fk_parent of directory to create $dirdesc['fullname'] + $fk_parent = -1; + $relativepathmissing = str_replace($diroutputslash, '', $dirdesc['fullname']); + $relativepathtosearchparent = $relativepathmissing; + //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent); + if (preg_match('/\//', $relativepathtosearchparent)) { + //while (preg_match('/\//',$relativepathtosearchparent)) + $relativepathtosearchparent = preg_replace('/\/[^\/]*$/', '', $relativepathtosearchparent); + $txt = "Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?"; + dol_syslog($txt); + //print $txt." -> "; + $parentdirisindatabase = 0; + foreach ($sqltree as $dirsqldesc) { + if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent) { + $parentdirisindatabase = $dirsqldesc['id']; + break; + } + } + if ($parentdirisindatabase > 0) { + dol_syslog("Yes with id ".$parentdirisindatabase); + //print "Yes with id ".$parentdirisindatabase."
\n"; + $fk_parent = $parentdirisindatabase; + //break; // We found parent, we can stop the while loop + } else { + dol_syslog("No"); + //print "No
\n"; + } + } else { + dol_syslog("Parent is root"); + $fk_parent = 0; // Parent is root + } + + if ($fk_parent >= 0) { + $ecmdirtmp->ref = 'NOTUSEDYET'; + $ecmdirtmp->label = dol_basename($dirdesc['fullname']); + $ecmdirtmp->description = ''; + $ecmdirtmp->fk_parent = $fk_parent; + + $txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent; + dol_syslog($txt); + //print $ecmdirtmp->cachenbofdoc."
\n";exit; + $id = $ecmdirtmp->create($user); + if ($id > 0) { + $newdirsql = array('id'=>$id, + 'id_mere'=>$ecmdirtmp->fk_parent, + 'label'=>$ecmdirtmp->label, + 'description'=>$ecmdirtmp->description, + 'fullrelativename'=>$relativepathmissing); + $sqltree[] = $newdirsql; // We complete fulltree for following loops + //var_dump($sqltree); + $adirwascreated = 1; + } else { + dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR); + } + } else { + $txt = "Parent of ".$dirdesc['fullname']." not found"; + dol_syslog($txt); + //print $txt."
\n"; + } + } + } + + // Loop now on each sql tree to check if dir exists + foreach ($sqltree as $dirdesc) { // Loop on each sqltree to check dir is on disk + $dirtotest = $conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; + if (!dol_is_dir($dirtotest)) { + $ecmdirtmp->id = $dirdesc['id']; + $ecmdirtmp->delete($user, 'databaseonly'); + //exit; + } + } + + $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" + dol_syslog("sql = ".$sql); + $db->query($sql); + + // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean + // it to be sure that fulltree array is not used without reloading it. + if ($adirwascreated) { + $sqltree = null; + } +} + + + +/* + * View + */ + +// Define height of file area (depends on $_SESSION["dol_screenheight"]) +//print $_SESSION["dol_screenheight"]; +$maxheightwin = (isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466) ? ($_SESSION["dol_screenheight"] - 136) : 660; // Also into index_auto.php file + +$moreheadcss = ''; +$moreheadjs = ''; + +//$morejs=array(); +$morejs = array('includes/jquery/plugins/blockUI/jquery.blockUI.js', 'core/js/blockUI.js'); // Used by ecm/tpl/enabledfiletreeajax.tpl.pgp +if (empty($conf->global->MAIN_ECM_DISABLE_JS)) { + $morejs[] = "includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"; +} + +$moreheadjs .= ''."\n"; + +llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $morejs, '', 0, 0); + +$head = ecm_prepare_dasboard_head(''); +print dol_get_fiche_head($head, 'index_medias', '', -1, ''); + + +// Add filemanager component +$module = 'medias'; +if (empty($url)) { + $url = DOL_URL_ROOT.'/ecm/index_medias.php'; // Must be an url without param +} +include DOL_DOCUMENT_ROOT.'/core/tpl/filemanager.tpl.php'; + +// End of page +print dol_get_fiche_end(); + +llxFooter(); + +$db->close(); diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index c1457a1f4b4..4c45ec06403 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -172,9 +172,6 @@ if (isModEnabled('recruitment')) { //*********************** print load_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("Search")); -//print $langs->trans("ECMAreaDesc")."
"; -//print $langs->trans("ECMAreaDesc2")."
"; -//print "
\n"; print $langs->trans("FeatureNotYetAvailable").'.

'; // Tool bar diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index 494a6c55164..5ced4ec5617 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -5,6 +5,7 @@ ECMSectionManual=Manual directory ECMSectionAuto=Automatic directory ECMSectionsManual=Manual tree ECMSectionsAuto=Automatic tree +ECMSectionsMedias=Medias tree ECMSections=Directories ECMRoot=ECM Root ECMNewSection=New directory @@ -16,7 +17,9 @@ ECMNbOfFilesInSubDir=Number of files in sub-directories ECMCreationUser=Creator ECMArea=DMS/ECM area ECMAreaDesc=The DMS/ECM (Document Management System / Electronic Content Management) area allows you to save, share and search quickly all kind of documents in Dolibarr. -ECMAreaDesc2=* Automatic directories are filled automatically when adding documents from card of an element.
* Manual directories can be used to save documents not linked to a particular element. +ECMAreaDesc2a=* Manual directories can be used to save documents not linked to a particular element. +ECMAreaDesc2b=* Automatic directories are filled automatically when adding documents from the page of an element. +ECMAreaDesc3=* Medias directories are files into the subdirectory /medias of documents directory, readable by everybody with no need to be logged and no need to have the file shared explicitely. It is used to store image files from emailing or website module. ECMSectionWasRemoved=Directory %s has been deleted. ECMSectionWasCreated=Directory %s has been created. ECMSearchByKeywords=Search by keywords diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 6d07e9f5c5f..a87fce31734 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -253,7 +253,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current -$permtouploadfile = $user->rights->website->write; +$permtouploadfile = $user->hasRight('website', 'write'); $diroutput = $conf->medias->multidir_output[$conf->entity]; $relativepath = $section_dir; @@ -410,7 +410,7 @@ if ($sortfield) { if ($sortorder) { $backtopage .= '&sortorder='.urlencode($sortorder); } -include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit' action when submitting new file. +include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit', 'confirm_deletefile', 'renamefile' action when submitting new file. $backtopage = $savbacktopage; //var_dump($backtopage);