diff --git a/htdocs/core/js/jnotify.js b/htdocs/core/js/jnotify.js deleted file mode 100644 index 088e106177d..00000000000 --- a/htdocs/core/js/jnotify.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2011 Regis Houssin -// Copyright (C) 2009 Laurent Destailleur -// -// 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 . -// or see http://www.gnu.org/ -// - -// -// \file htdocs/core/js/jnotify.js -// \brief File that include javascript functions for jnotify default options -// - -$(document).ready(function() { - $.jnotify.setup({ - delay: 3000 // the default time to show each notification (in milliseconds) - , sticky: false // determines if the message should be considered "sticky" (user must manually close notification) - , closeLabel: "×" // the HTML to use for the "Close" link - , showClose: true // determines if the "Close" link should be shown if notification is also sticky - , fadeSpeed: 1000 // the speed to fade messages out (in milliseconds) - , slideSpeed: 250 // the speed used to slide messages out (in milliseconds) - , classContainer: "jnotify-container" - , classNotification: "jnotify-notification" - , classBackground: "jnotify-background" - , classClose: "jnotify-close" - , classMessage: "jnotify-message" - , init: null // callback that occurs when the main jnotify container is created - , create: null // callback that occurs when when the note is created (occurs just before appearing in DOM) - , beforeRemove: null // callback that occurs when before the notification starts to fade away - }); -}); \ No newline at end of file diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 84004f0f8ab..68d183e1573 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -44,6 +44,7 @@ else header('Cache-Control: no-cache'); //var_dump($conf); + // Wrapper to show tooltips (html or onclick popup) if (empty($conf->dol_no_mouse_hover)) { diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index ba1fa253c1e..9442190a1c2 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1062,3 +1062,26 @@ function price2numjs(amount) { } +global->MAIN_DISABLE_JQUERY_JNOTIFY) && ! defined('DISABLE_JQUERY_JNOTIFY')) { +?> +// Defined properties for JNotify +$(document).ready(function() { + $.jnotify.setup({ + delay: 3000 // the default time to show each notification (in milliseconds) + , sticky: false // determines if the message should be considered "sticky" (user must manually close notification) + , closeLabel: "×" // the HTML to use for the "Close" link + , showClose: true // determines if the "Close" link should be shown if notification is also sticky + , fadeSpeed: 1000 // the speed to fade messages out (in milliseconds) + , slideSpeed: 250 // the speed used to slide messages out (in milliseconds) + , classContainer: "jnotify-container" + , classNotification: "jnotify-notification" + , classBackground: "jnotify-background" + , classClose: "jnotify-close" + , classMessage: "jnotify-message" + , init: null // callback that occurs when the main jnotify container is created + , create: null // callback that occurs when when the note is created (occurs just before appearing in DOM) + , beforeRemove: null // callback that occurs when before the notification starts to fade away + }); +}); + diff --git a/htdocs/ecm/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php similarity index 98% rename from htdocs/ecm/tpl/filemanager.tpl.php rename to htdocs/core/tpl/filemanager.tpl.php index be46704d0f6..162c69c6e1f 100644 --- a/htdocs/ecm/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -19,7 +19,7 @@ */ ?> - + use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE } ?> - + diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index bbb80f52cba..1dab8884f74 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -39,19 +39,20 @@ class EcmDirectory // extends CommonObject var $cachenbofdoc=-1; // By default cache initialized with value 'not calculated' var $date_c; var $date_m; - public $fk_user_m; - public $fk_user_c; - public $ref; + public $fk_user_m; + public $fk_user_c; + public $ref; var $cats=array(); var $motherof=array(); - var $forbiddenchars = array('<','>',':','/','\\','?','*','|','"'); + var $forbiddenchars = array('<','>',':','/','\\','?','*','|','"'); + var $forbiddencharsdir = array('<','>',':','?','*','|','"'); - public $full_arbo_loaded; + public $full_arbo_loaded; - public $error; - public $errors; + public $error; + public $errors; /** @@ -104,8 +105,8 @@ class EcmDirectory // extends CommonObject $pathfound=0; foreach ($cate_arbo as $key => $categ) { - $path=str_replace($this->forbiddenchars,'_',$categ['fulllabel']); - //print $path.'
'; + $path=str_replace($this->forbiddencharsdir, '_', $categ['fullrelativename']); + //print $relativepath.' - '.$path.'
'; if ($path == $relativepath) { $pathfound=1; diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php index 9b3384a71dc..c4a77c541c5 100644 --- a/htdocs/ecm/class/htmlecm.form.class.php +++ b/htdocs/ecm/class/htmlecm.form.class.php @@ -52,7 +52,7 @@ class FormEcm * @param string $module Module ('ecm', 'medias', ...) * @return string String with HTML select */ - function select_all_sections($selected=0, $select_name='', $module='ecm') + function selectAllSections($selected=0, $select_name='', $module='ecm') { global $conf, $langs; $langs->load("ecm"); @@ -80,7 +80,7 @@ class FormEcm $output.= ''; foreach($cate_arbo as $key => $value) { - if ($cate_arbo[$key]['id'] == $selected) + if ($selected && $cate_arbo[$key]['id'] == $selected) { $add = 'selected '; } diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 145da2aa7bd..1d92d54d0ea 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -29,15 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/htmlecm.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; // Load traductions files -$langs->load("ecm"); -$langs->load("companies"); -$langs->load("other"); -$langs->load("users"); -$langs->load("orders"); -$langs->load("propal"); -$langs->load("bills"); -$langs->load("contracts"); -$langs->load("categories"); +$langs->loadLangs(array("ecm","companies","other","users","orders","propal","bills","contracts","categories")); if (! $user->rights->ecm->setup) accessforbidden(); @@ -46,7 +38,7 @@ $socid = GETPOST('socid','int'); $action = GETPOST('action','alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); -$confirm=GETPOST('confirm','alpha'); +$confirm = GETPOST('confirm','alpha'); $module = GETPOST('module', 'alpha'); $website = GETPOST('website', 'alpha'); @@ -66,7 +58,7 @@ if ($module == 'ecm') { $upload_dir = $conf->ecm->dir_output.'/'.$urlsection; } -if ($module == 'medias') +else // For example $module == 'medias' { $upload_dir = $conf->medias->multidir_output[$conf->entity]; } @@ -114,34 +106,79 @@ if ($action == 'add' && $user->rights->ecm->setup) } } - $ecmdir->ref = trim($_POST["ref"]); - $ecmdir->label = trim($_POST["label"]); - $ecmdir->description = trim($_POST["desc"]); - $ecmdir->fk_parent = $_POST["catParent"]; + $ref = trim(GETPOST("ref", 'alpha')); + $label = trim(GETPOST("label", 'alpha')); + $desc = trim(GETPOST("desc", 'alpha')); + $catParent = GETPOST("catParent", 'alpha'); // Can be an int (with ECM) or a string (with generic filemanager) - $ok=true; + $error=0; - if (! $ecmdir->label) + if (empty($label)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action = 'create'; - $ok=false; + $error++; } - if ($ok) + if (! $error) { - $id = $ecmdir->create($user); - - if ($id > 0) + if ($module == 'ecm') { - header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); + $ecmdir->ref = $ref; + $ecmdir->label = $label; + $ecmdir->description = $desc; + $ecmdir->fk_parent = (int) $catParent; + + $id = $ecmdir->create($user); + if ($id <= 0) + { + $error++; + $langs->load("errors"); + setEventMessages($ecmdir->error, $ecmdir->errors, 'errors'); + $action = 'create'; + } + } + else // For example $module == 'medias' + { + $dirfornewdir = ''; + if ($module == 'medias') + { + $dirfornewdir = $conf->medias->multidir_output[$conf->entity]; + } + if (empty($dirfornewdir)) + { + $error++; + dol_print_error('', 'Bad value for module. Not supported.'); + } + + if (! $error) + { + $fullpathofdir = $dirfornewdir.'/'.($catParent? $catParent.'/' : '').$label; + $result = dol_mkdir($fullpathofdir, DOL_DATA_ROOT); + if ($result < 0) + { + setEventMessages($langs->trans('ErrorFailToCreateDir', $label), null, 'errors'); + $error++; + } + else + { + setEventMessages($langs->trans("ECMSectionWasCreated", $label), null, 'mesgs'); + } + } + } + } + + if (! $error) + { + if (! empty($backtopage)) + { + header("Location: ".$backtopage); exit; } else { - $langs->load("errors"); - setEventMessages($langs->trans($ecmdir->error), $ecmdir->errors, 'errors'); - $action = 'create'; + header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); + exit; } } } @@ -160,7 +197,7 @@ else if ($action == 'confirm_deletesection' && $confirm == 'yes') * View */ -llxHeader(); +llxHeader('', $langs->trans("ECMNewSection")); $form=new Form($db); $formecm=new FormEcm($db); @@ -170,12 +207,13 @@ if ($action == 'create') //*********************** // Create //*********************** - print '
'; + print ''; print ''; print ''; - print ''; - if ($website) print ''; - if ($pageid) print ''; + print ''; + print ''; + if ($website) print ''; + if ($pageid) print ''; $title=$langs->trans("ECMNewSection"); print load_fiche_titre($title); @@ -188,7 +226,7 @@ if ($action == 'create') print ''.$langs->trans("Label").''."\n"; print ''.$langs->trans("AddIn").''; - print $formecm->select_all_sections(! empty($_GET["catParent"]) ? $_GET["catParent"] : $ecmdir->fk_parent, 'catParent', $module); + print $formecm->selectAllSections(! empty($_GET["catParent"]) ? $_GET["catParent"] : $ecmdir->fk_parent, 'catParent', $module); print ''."\n"; // Description @@ -207,7 +245,7 @@ if ($action == 'create') print '
'; print ''; - print '     '; + print '     '; print ''; print '
'; print '
'; diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index f955e27f1bc..5895cc9b793 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -338,7 +338,7 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM // Add filemanager component $module='ecm'; -include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/filemanager.tpl.php'; // End of page dol_fiche_end(); diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index 85874930d25..b69b0ff475e 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -18,6 +18,7 @@ ECMArea=EDM area ECMAreaDesc=The EDM (Electronic Document 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. ECMSectionWasRemoved=Directory %s has been deleted. +ECMSectionWasCreated=Directory %s has been created. ECMSearchByKeywords=Search by keywords ECMSearchByEntity=Search by object ECMSectionOfDocuments=Directories of documents diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e3acac375d0..5cfcf79b374 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1214,7 +1214,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && ! defined('DISABLE_JQUERY_JNOTIFY')) { print ''."\n"; - print ''."\n"; } // Flot if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && ! defined('DISABLE_JQUERY_FLOT')) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 5ecedb3cb80..66d5365bc8e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3187,6 +3187,15 @@ div.titre { #divsubscribe { max-width: 900px; } #tablesubscribe { width: 100%; } +div#card-element { + border: 1px solid #ccc; +} +div#card-errors { + color: #fa755a; + text-align: center; + padding-top: 3px; +} + /* * Effect Postit diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 4352f7368dc..1558f9f280c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3268,10 +3268,21 @@ div.titre { #divsubscribe { max-width: 900px; } #tablesubscribe { width: 100%; } +div#card-element { + border: 1px solid #ccc; +} +div#card-errors { + color: #fa755a; + text-align: center; + padding-top: 3px; +} + + /* * Effect Postit */ + .effectpostit { position: relative; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 2858afa811a..0250e2d28f8 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1884,7 +1884,7 @@ if ($action == 'editfile' || $action == 'file_manager') $module = 'medias'; if (empty($url)) $url=DOL_URL_ROOT.'/website/index.php'; // Must be an url without param - include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/filemanager.tpl.php'; print ''; }