Merge small js into lib_header.js.php

Move filemanager.tpl.php
CSS enhancement
This commit is contained in:
Laurent Destailleur 2017-11-19 12:22:01 +01:00
parent 9f5b73f4e2
commit 47afe470eb
13 changed files with 132 additions and 90 deletions

View File

@ -1,41 +0,0 @@
// Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
// Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
//
// 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 <http://www.gnu.org/licenses/>.
// 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: "&times;" // 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
});
});

View File

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

View File

@ -1062,3 +1062,26 @@ function price2numjs(amount) {
}
<?php
if (empty($conf->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: "&times;" // 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
});
});
<?php } ?>

View File

@ -19,7 +19,7 @@
*/
?>
<!-- BEGIN PHP TEMPLATE ecm/tpl/filemanager.tpl.php -->
<!-- BEGIN PHP TEMPLATE core/tpl/filemanager.tpl.php -->
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<?php
@ -214,4 +214,4 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE
}
?>
<!-- END PHP TEMPLATE ecm/tpl/filemanager.tpl.php -->
<!-- END PHP TEMPLATE core/tpl/filemanager.tpl.php -->

View File

@ -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.'<br>';
$path=str_replace($this->forbiddencharsdir, '_', $categ['fullrelativename']);
//print $relativepath.' - '.$path.'<br>';
if ($path == $relativepath)
{
$pathfound=1;

View File

@ -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.= '<option value="-1">&nbsp;</option>';
foreach($cate_arbo as $key => $value)
{
if ($cate_arbo[$key]['id'] == $selected)
if ($selected && $cate_arbo[$key]['id'] == $selected)
{
$add = 'selected ';
}

View File

@ -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 '<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="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($website) print '<input type="hidden" name="website" value="'.$website.'">';
if ($pageid) print '<input type="hidden" name="pageid" value="'.$pageid.'">';
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
if ($website) print '<input type="hidden" name="website" value="'.dol_escape_htmltag($website).'">';
if ($pageid) print '<input type="hidden" name="pageid" value="'.dol_escape_htmltag($pageid).'">';
$title=$langs->trans("ECMNewSection");
print load_fiche_titre($title);
@ -188,7 +226,7 @@ if ($action == 'create')
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth100" maxlength="32" value="'.$ecmdir->label.'"></td></tr>'."\n";
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
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 '</td></tr>'."\n";
// Description
@ -207,7 +245,7 @@ if ($action == 'create')
print '<div class="center">';
print '<input type="submit" class="button" name="create" value="'.$langs->trans("Create").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';

View File

@ -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();

View File

@ -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.<br>* Manual directories can be used to save documents not linked to a particular element.
ECMSectionWasRemoved=Directory <b>%s</b> has been deleted.
ECMSectionWasCreated=Directory <b>%s</b> has been created.
ECMSearchByKeywords=Search by keywords
ECMSearchByEntity=Search by object
ECMSectionOfDocuments=Directories of documents

View File

@ -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 '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/jnotify.js'.($ext?'?'.$ext:'').'"></script>'."\n";
}
// Flot
if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && ! defined('DISABLE_JQUERY_FLOT'))

View File

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

View File

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

View File

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