mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Works on enhancement of "ok","warning" or "error" message with jQuery jnotify
This commit is contained in:
parent
87a5636bb7
commit
23d96f6ded
|
|
@ -359,6 +359,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
|||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
if (! empty($module->error)) dol_htmloutput_errors($module->error,'',$conf->global->MAIN_USE_JQUERY_JNOTIFY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
htdocs/includes/jquery/plugins/jnotify/jquery.jnotify.min.css
vendored
Normal file
1
htdocs/includes/jquery/plugins/jnotify/jquery.jnotify.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.jnotify-container{position:fixed;top:0;left:0;width:100%;z-index:100000;}.jnotify-container .jnotify-notification{position:relative;}.jnotify-container .jnotify-notification .jnotify-background{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#e3f0db;filter:alpha(opacity=90);-moz-opacity:.90;opacity:.90;z-index:1;}.jnotify-container .jnotify-notification a.jnotify-close,.jnotify-container .jnotify-notification a.jnotify-close:link,.jnotify-container .jnotify-notification a.jnotify-close:visited,.jnotify-container .jnotify-notification a.jnotify-close:focus,.jnotify-container .jnotify-notification a.jnotify-close:hover{position:absolute;top:2px;right:5px;padding:0 5px;font:bold 1.4em Arial,Helvetica,sans-serif;line-height:1em;color:#567b1b;text-decoration:none;z-index:3;cursor:pointer;}.jnotify-container .jnotify-notification .jnotify-message{position:relative;z-index:2;padding:20px;text-align:center;color:#567b1b;font:bold 1.4em Arial,Helvetica,sans-serif;line-height:1.2em;}.jnotify-container .jnotify-notification .jnotify-message *{font-size:1em;}.jnotify-container .jnotify-notification-error .jnotify-background{background-color:#d79eac;}.jnotify-container .jnotify-notification-error .jnotify-close,.jnotify-container .jnotify-notification-error .jnotify-message{color:#a72947!important;}.jnotify-container .jnotify-notification-warning .jnotify-background{background-color:#fff7d1;}.jnotify-container .jnotify-notification-warning .jnotify-close,.jnotify-container .jnotify-notification-warning .jnotify-message{color:#c2a928!important;}
|
||||
21
htdocs/includes/jquery/plugins/jnotify/jquery.jnotify.min.js
vendored
Normal file
21
htdocs/includes/jquery/plugins/jnotify/jquery.jnotify.min.js
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* jNotify jQuery Plug-in
|
||||
*
|
||||
* Copyright 2010 Giva, Inc. (http://www.givainc.com/labs/)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Date: 2010-09-30
|
||||
* Rev: 1.1.00
|
||||
*/
|
||||
(function(B){B.jnotify=function(K,M,L){return new C(K,M,L)};B.jnotify.version="1.1.00";var J,D=[],E=0,H=false,I=false,G,F,A={type:"",delay:2000,sticky:false,closeLabel:"×",showClose:true,fadeSpeed:1000,slideSpeed:250,classContainer:"jnotify-container",classNotification:"jnotify-notification",classBackground:"jnotify-background",classClose:"jnotify-close",classMessage:"jnotify-message",init:null,create:null,beforeRemove:null,remove:null,transition:null};B.jnotify.setup=function(K){A=B.extend({},A,K)};B.jnotify.play=function(M,N){if(H&&(M!==true)||(D.length==0)){return }H=true;var L=D.shift();F=L;var K=(arguments.length>=2)?parseInt(N,10):L.options.delay;G=setTimeout(function(){G=0;L.remove(function(){if(D.length==0){H=false}else{if(!I){B.jnotify.play(true)}}})},K)};B.jnotify.pause=function(){clearTimeout(G);if(G){D.unshift(F)}I=H=true};B.jnotify.resume=function(){I=false;B.jnotify.play(true,0)};function C(P,N){var M=this,K=typeof N;if(K=="number"){N=B.extend({},A,{delay:N})}else{if(K=="boolean"){N=B.extend({},A,{sticky:true})}else{if(K=="string"){N=B.extend({},A,{type:N,delay:((arguments.length>2)&&(typeof arguments[2]=="number"))?arguments[2]:A.delay,sticky:((arguments.length>2)&&(typeof arguments[2]=="boolean"))?arguments[2]:A.sticky})}else{N=B.extend({},A,N)}}}this.options=N;if(!J){J=B('<div class="'+A.classContainer+'" />').appendTo("body");if(B.isFunction(N.init)){N.init.apply(M,[J])}}function O(S){var R='<div class="'+N.classNotification+(N.type.length?(" "+N.classNotification+"-"+N.type):"")+'"><div class="'+N.classBackground+'"></div>'+(N.sticky&&N.showClose?('<a class="'+N.classClose+'">'+N.closeLabel+"</a>"):"")+'<div class="'+N.classMessage+'"><div>'+S+"</div></div></div>";E++;var Q=B(R);if(N.sticky){Q.find("a."+N.classClose).bind("click.jnotify",function(){M.remove()})}if(B.isFunction(N.create)){N.create.apply(M,[Q])}return Q.appendTo(J)}this.remove=function(U){var Q=L.find("."+N.classMessage),S=Q.parent();var R=E--;if(B.isFunction(N.beforeRemove)){N.beforeRemove.apply(M,[Q])}function T(){S.remove();if(B.isFunction(U)){U.apply(M,[Q])}if(B.isFunction(N.remove)){N.remove.apply(M,[Q])}}if(B.isFunction(N.transition)){N.transition.apply(M,[S,Q,R,T,N])}else{Q.fadeTo(N.fadeSpeed,0.01,function(){if(R<=1){T()}else{S.slideUp(N.slideSpeed,T)}});if(E<=0){S.fadeOut(N.fadeSpeed)}}};var L=O(P);if(!N.sticky){D.push(this);B.jnotify.play()}return this}})(jQuery);
|
||||
|
|
@ -132,6 +132,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
|
|||
else $where.=" AND type != 2";
|
||||
|
||||
$numFinal=get_next_value($db,$mask,'facture','facnumber',$where,$objsoc,$facture->date,$mode);
|
||||
if (! preg_match('/([0-9])+/',$numFinal)) $this->error = $numFinal;
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3414,31 +3414,44 @@ function monthArrayOrSelected($selected=0)
|
|||
* @return html Return html output
|
||||
* @see dol_print_error
|
||||
*/
|
||||
function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok')
|
||||
function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $ajax=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$ret = '';
|
||||
$out = '';
|
||||
|
||||
if (is_array($mesgarray) && sizeof($mesgarray))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<div class="'.$style.'">';
|
||||
if (! $ajax) $out.= '<div class="'.$style.'">';
|
||||
foreach($mesgarray as $message)
|
||||
{
|
||||
$ret++;
|
||||
print $langs->trans($message);
|
||||
if ($ret < sizeof($mesgarray)) print "<br>\n";
|
||||
$out.= $langs->trans($message);
|
||||
if ($ret < sizeof($mesgarray)) $out.= "<br>\n";
|
||||
}
|
||||
print '</div>';
|
||||
if (! $ajax) $out.= '</div>';
|
||||
}
|
||||
if ($mesgstring)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$ret++;
|
||||
print '<div class="'.$style.'">';
|
||||
print $langs->trans($mesgstring);
|
||||
print '</div>';
|
||||
if (! $ajax) $out.= '<div class="'.$style.'">';
|
||||
$out.= $langs->trans($mesgstring);
|
||||
if (! $ajax) $out.= '</div>';
|
||||
}
|
||||
if ($ajax)
|
||||
{
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery.jnotify("'.$out.'", "'.($style=="ok" ? 3000 : $style).'", '.($style=="ok" ? "false" : "true").');
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $out;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
|
@ -3451,9 +3464,9 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok')
|
|||
* @return html Return html output
|
||||
* @see dol_print_error
|
||||
*/
|
||||
function dol_htmloutput_errors($mesgstring='',$mesgarray='')
|
||||
function dol_htmloutput_errors($mesgstring='',$mesgarray='',$ajax=0)
|
||||
{
|
||||
return dol_htmloutput_mesg($mesgstring, $mesgarray, 'error');
|
||||
return dol_htmloutput_mesg($mesgstring, $mesgarray, 'error',$ajax);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -422,46 +422,33 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||
{
|
||||
if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth';
|
||||
|
||||
// Define posy, posm and reg
|
||||
if ($maskraz > 1)
|
||||
{
|
||||
if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode)
|
||||
&& ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask';
|
||||
if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; }
|
||||
elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; }
|
||||
if (dol_strlen($reg[$posy]) < 2) return 'ErrorCantUseRazWithYearOnOneDigit';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazIfNoYearInMask';
|
||||
if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; }
|
||||
}
|
||||
//print "x".$maskwithonlyymcode." ".$maskraz." ".$posy." ".$posm;
|
||||
|
||||
// Define reg
|
||||
if ($maskraz > 1 && ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)
|
||||
&& ! preg_match('/^(.*)\{(y)+\}\{(m)+\}/i',$maskwithonlyymcode,$reg)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask';
|
||||
if ($maskraz <= 1 && ! preg_match('/^(.*)\{(y)+\}/i',$maskwithonlyymcode,$reg)) return 'ErrorCantUseRazIfNoYearInMask';
|
||||
//print "x".$maskwithonlyymcode." ".$maskraz;
|
||||
|
||||
// Define $yearcomp and $monthcomp (that will be use in the select where to search max number)
|
||||
$monthcomp=$maskraz;
|
||||
$yearoffset=0;
|
||||
$yearcomp=0;
|
||||
if (date("m",$date) < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year
|
||||
if (dol_strlen($reg[$posy]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
|
||||
if (dol_strlen($reg[$posy]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
|
||||
if (dol_strlen($reg[$posy]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
|
||||
if (dol_strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
|
||||
if (dol_strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
|
||||
if (dol_strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
|
||||
|
||||
$sqlwhere='';
|
||||
$sqlwhere.='( (SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.$yearcomp;
|
||||
if ($monthcomp > 1) // Test useless if monthcomp = 1 (or 0 is same as 1)
|
||||
{
|
||||
if (dol_strlen($reg[$posy]) == 4) $yearcomp1=sprintf("%04d",date("Y",$date)+$yearoffset+1);
|
||||
if (dol_strlen($reg[$posy]) == 2) $yearcomp1=sprintf("%02d",date("y",$date)+$yearoffset+1);
|
||||
// FIXME If mask is {mm}{yy}, sqlwhere is wrong here
|
||||
$sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).') >= '.$monthcomp.')';
|
||||
$sqlwhere.=' OR SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.$yearcomp1.' )';
|
||||
$sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).') >= '.$monthcomp.')';
|
||||
$sqlwhere.=' OR SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.sprintf("%02d",($yearcomp+1)).' )';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sqlwhere.=') )';
|
||||
}
|
||||
}
|
||||
//print $sqlwhere;
|
||||
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset." yearcomp=".$yearcomp."<br>\n";
|
||||
|
||||
// Define $sqlstring
|
||||
|
|
|
|||
|
|
@ -858,6 +858,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||
if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
|
||||
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui-latest.custom.css" type="text/css" />'."\n";
|
||||
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/tooltip/jquery.tooltip.css" type="text/css" />'."\n";
|
||||
// jQuery jnotify
|
||||
if ($conf->global->MAIN_USE_JQUERY_JNOTIFY) print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.css" type="text/css" />'."\n";
|
||||
}
|
||||
|
||||
print '<!-- Includes for Dolibarr, modules or specific pages-->'."\n";
|
||||
|
|
@ -904,6 +906,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||
{
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/layout/jquery.layout-latest.min'.$ext.'"></script>'."\n";
|
||||
}
|
||||
// jQuery jnotify
|
||||
if ($conf->global->MAIN_USE_JQUERY_JNOTIFY) print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js"></script>'."\n";
|
||||
// CKEditor
|
||||
if (! empty($conf->global->FCKEDITOR_EDITORNAME) && $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor')
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user