From 21305717129fbd37350200bec9ed87cde39da07c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Sep 2012 22:05:13 +0200 Subject: [PATCH] New: try jquery blockUI plugin --- htdocs/core/js/blockUI.js | 121 ++++++++++++++++++++++++++++++ htdocs/core/lib/functions.lib.php | 17 +++-- htdocs/main.inc.php | 3 +- htdocs/theme/eldy/style.css.php | 24 ++++-- 4 files changed, 151 insertions(+), 14 deletions(-) create mode 100644 htdocs/core/js/blockUI.js diff --git a/htdocs/core/js/blockUI.js b/htdocs/core/js/blockUI.js new file mode 100644 index 00000000000..e35f30deeda --- /dev/null +++ b/htdocs/core/js/blockUI.js @@ -0,0 +1,121 @@ +// Copyright (C) 2012 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 2 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/blockUI.js +// \brief File that include javascript functions for blockUI default options +// + +// Examples +$(document).ready(function() { + // override these in your code to change the default behavior and style + $.blockUI.defaults = { + // message displayed when blocking (use null for no message) + message: '

Please wait...

', + + // styles for the message when blocking; if you wish to disable + // these and use an external stylesheet then do this in your code: + // $.blockUI.defaults.css = {}; + css: { + padding: 0, + margin: 0, + width: '30%', + top: '40%', + left: '35%', + textAlign: 'center', + color: '#000', + border: '3px solid #aaa', + backgroundColor:'#fff', + cursor: 'wait' + }, + + // styles for the overlay + overlayCSS: { + backgroundColor: '#000', + opacity: 0.6 + }, + + // styles applied when using $.growlUI + growlCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.6, + cursor: null, + color: '#fff', + backgroundColor: '#000', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px' + }, + + // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w + // (hat tip to Jorge H. N. de Vasconcelos) + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', + + // force usage of iframe in non-IE browsers (handy for blocking applets) + forceIframe: false, + + // z-index for the blocking overlay + baseZ: 1000, + + // set these to true to have the message automatically centered + centerX: true, // <-- only effects element blocking (page block controlled via css above) + centerY: true, + + // allow body element to be stetched in ie6; this makes blocking look better + // on "short" pages. disable if you wish to prevent changes to the body height + allowBodyStretch: true, + + // enable if you want key and mouse events to be disabled for content that is blocked + bindEvents: true, + + // be default blockUI will supress tab navigation from leaving blocking content + // (if bindEvents is true) + constrainTabKey: true, + + // fadeIn time in millis; set to 0 to disable fadeIn on block + fadeIn: 200, + + // fadeOut time in millis; set to 0 to disable fadeOut on unblock + fadeOut: 400, + + // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock + timeout: 0, + + // disable if you don't want to show the overlay + showOverlay: true, + + // if true, focus will be placed in the first available input field when + // page blocking + focusInput: true, + + // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) + applyPlatformOpacityRules: true, + + // callback method invoked when unblocking has completed; the callback is + // passed the element that has been unblocked (which is the window object for page + // blocks) and the options that were passed to the unblock call: + // onUnblock(element, options) + onUnblock: null, + + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 + quirksmodeOffsetHack: 4 + }; +}); \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6fe1b46ebb7..9c361e6ce82 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3589,14 +3589,19 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb if ($out) { - if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) + if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) { $return = ''; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b87956712ae..7f875292d12 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -966,7 +966,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs // jQuery blockUI if (! empty($conf->global->MAIN_USE_JQUERY_BLOCKUI)) { - print ''."\n"; + print ''."\n"; + //print ''."\n"; } // Flot if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT)) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 55e8fba102c..7e63421388f 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1761,13 +1761,6 @@ div.error { background: #EFCFCF; } -div.jnotify-background { - opacity : 0.95 !important; - -moz-box-shadow: 4px 4px 4px #888 !important; - -webkit-box-shadow: 4px 4px 4px #888 !important; - box-shadow: 4px 4px 4px #888 !important; -} - /* Info admin */ div.info { color: #807050; @@ -2509,6 +2502,23 @@ div.ecmjqft { padding-right: 10px !important; } +/* use or not ? */ +div.jnotify-background { + opacity : 0.95 !important; + -moz-box-shadow: 4px 4px 4px #888 !important; + -webkit-box-shadow: 4px 4px 4px #888 !important; + box-shadow: 4px 4px 4px #888 !important; +} + +/* ============================================================================== */ +/* blockUI */ +/* ============================================================================== */ + +div.growlUI { background: url(check48.png) no-repeat 10px 10px } +div.growlUI h1, div.growlUI h2 { + color: white; padding: 5px 5px 5px 75px; text-align: left +} + /* ============================================================================== */ /* Maps */ /* ============================================================================== */