From 395a3499a695917634e85cb3f4ed9a1a48f3b47e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 10 Mar 2008 13:10:30 -0500 Subject: [PATCH] Two jquery changes: update to tabs plugin, with related modifications to templates; Addition of jquery hotkeys plugin for selecting tabs from global search form. Signed-off-by: Joshua Ferraro --- .../prog/en/css/staff-global.css | 44 +- .../includes/acquisitions-history-search.inc | 2 +- .../prog/en/includes/cat-search.inc | 2 +- .../prog/en/includes/checkin-search.inc | 2 +- .../prog/en/includes/doc-head-close.inc | 8 +- .../intranet-tmpl/prog/en/js/staff-global.js | 20 +- .../en/lib/jquery/plugins/jquery.hotkeys.js | 127 +++++ .../prog/en/lib/jquery/plugins/ui.tabs.css | 80 +++ .../prog/en/lib/jquery/plugins/ui.tabs.js | 517 ++++++++++++++++++ .../prog/en/modules/circ/circulation.tmpl | 2 +- .../prog/en/modules/members/boraccount.tmpl | 4 +- .../prog/en/modules/members/mancredit.tmpl | 4 +- .../prog/en/modules/members/maninvoice.tmpl | 4 +- .../prog/en/modules/members/moremember.tmpl | 2 +- .../prog/en/modules/members/pay.tmpl | 4 +- .../prog/en/modules/reports/dictionary.tmpl | 16 +- .../en/modules/suggestion/acceptorreject.tmpl | 8 +- 17 files changed, 780 insertions(+), 66 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.hotkeys.js create mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.css create mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index 035647f08d..ebf380e431 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -583,21 +583,21 @@ fieldset.rows .inputnote { margin : .5em 0 0 10em; } -.tabs-nav li { +.ui-tabs-nav li { list-style : none; } -.tabs-nav a, .tabs-nav a span, .tabs-nav span.a { +.ui-tabs-nav a, .ui-tabs-nav a span, .ui-tabs-nav span.a { background : none; display : block; padding: .2em .5em .25em .5em; } -.tabs-nav a, .tabs-nav span.a { +.ui-tabs-nav a, .ui-tabs-nav span.a { z-index : auto; } -.tabs-nav .tabs-selected a, .tabs-nav .tabs-selected span.a { +.ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav .ui-tabs-selected span.a { background-color : #FFFFCC; border-top: 1px solid #FFFFCC; border-right: 1px solid #FF9900; @@ -606,26 +606,27 @@ fieldset.rows .inputnote { font-weight : bold; text-align : center; text-decoration : none; - top : -1px; + margin-top : -1px; + z-index: 100; } -.tabs-nav .tabs-selected a, .tabs-nav a:hover, .tabs-nav a:focus, .tabs-nav a:active, .tabs-nav span.a { +.ui-tabs-nav .tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active, .ui-tabs-nav span.a { background-position : inherit; outline: 0; /* prevent dotted border in Firefox */ } -.tabs-nav a, .tabs-nav .tabs-disabled a:hover, .tabs-nav .tabs-disabled a:focus, .tabs-nav .tabs-disabled a:active, .tabs-nav span.a { +.ui-tabs-nav a, .ui-tabs-nav .ui-tabs-disabled a:hover, .ui-tabs-nav .ui-tabs-disabled a:focus, .ui-tabs-nav .ui-tabs-disabled a:active, .ui-tabs-nav span.a { background-position: inherit; } -.tabs-nav .tabs-selected a:hover { +.ui-tabs-nav .ui-tabs-selected a:hover { color : #0000CC; } -.tabs-nav li.tabs-selected { +.ui-tabs-nav li.ui-tabs-selected { background-color : #FFFFCC; } -.tabs-nav .tabs-selected a, .tabs-nav a:hover, .tabs-nav a:focus, .tabs-nav a:active, .tabs-nav span.a { +.ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active, .ui-tabs-nav span.a { background : none; outline: 0; /* prevent dotted border in Firefox */ } @@ -639,19 +640,20 @@ fieldset.rows .inputnote { padding: inherit; background: none; } + .toptabs { margin-top : 1em; } -.toptabs .tabs-nav a, .toptabs .tabs-nav span.a { +/*.toptabs .ui-tabs-nav a, .toptabs .ui-tabs-nav span.a { top: 0; - } + }*/ -.toptabs .tabs-nav li { +.toptabs .ui-tabs-nav li { margin-right : .5em; } -.toptabs .tabs-nav li a, .toptabs .tabs-nav li span.a { +.toptabs .ui-tabs-nav li a, .toptabs .ui-tabs-nav li span.a { background-color : #F3F3F3; border-top : 1px solid #E8E8E8; border-left : 1px solid #E8E8E8; @@ -661,21 +663,19 @@ fieldset.rows .inputnote { text-decoration : none; } -.toptabs .tabs-nav li.tabs-selected { +.toptabs .ui-tabs-nav li.ui-tabs-selected { background-color : #FFF; + margin-top : 1px; } -.toptabs .tabs-nav li.tabs-selected a, .toptabs .tabs-nav li.tabs-selected span.a { +.toptabs .ui-tabs-nav li.ui-tabs-selected a, .toptabs .ui-tabs-nav li.ui-tabs-selected span.a { background-color : #FFF; - border-top : 1px solid #E8E8E8; - border-left : 1px solid #E8E8E8; - border-right : 1px solid #E8E8E8; border-bottom : 1px solid #FFF; - margin-bottom : -5px; - text-align : center; + margin-bottom : -1px; + z-index : 2; } -.toptabs.numbered .tabs-nav li { +.toptabs.numbered .ui-tabs-nav li { min-width : 3em; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-history-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-history-search.inc index 04deeeb172..f87be61ecc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-history-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-history-search.inc @@ -18,7 +18,7 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc index 7b2ee1259a..28e994d98b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc @@ -91,7 +91,7 @@ YAHOO.util.Event.onContentReady("header_search", function() { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkin-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkin-search.inc index 683167dec2..5df18508c7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkin-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkin-search.inc @@ -89,7 +89,7 @@ YAHOO.util.Event.onContentReady("header_search", function() { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc index 834711cfcb..10ee83af61 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc @@ -1,16 +1,12 @@ /includes/favicon.ico" type="image/x-icon" /> -/lib/jquery/plugins/jquery.tabs.css" /> +/lib/jquery/plugins/ui.tabs.css" /> /css/print.css" /> " /> /css/staff-global.css" /> - - /lib/jquery/plugins/jquery.tabs-ie.css" type="text/css" media="projection, screen"> - /" /> /css/modules/" /> @@ -22,7 +18,7 @@ - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js index 0a9ffce0ee..ddbc3ce17a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js @@ -4,21 +4,15 @@ function _(s) { return s } // dummy function for gettext $(document).ready(function() { $(".focus").focus(); - $('#header_search').tabs({ - onShow: function() { - $('#header_search').find('div.residentsearch').not('.tabs-hide').find('input').eq(0).focus(); - } - }); - $(".close").click(function(){ - window.close(); - }); - if($("#header_search #checkin_search")){ $.hotkeys.add('Alt+r',function (){$("#header_search").triggerTab(2); }); } - if($("#header_search #circ_search")){ $.hotkeys.add('Alt+u',function (){ $("#header_search").triggerTab("#circ_search"); }); } - if($("#header_search #catalog_search")){ $.hotkeys.add('Alt+q',function (){ $("#header_search").triggerTab(3); }); } + $('#header_search > ul').tabs().bind('show.ui-tabs', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); }); + $(".close").click(function(){ window.close(); }); + if($("#header_search #checkin_search")){ + $.hotkeys.add('Alt+r',function (){ $("#header_search > ul").tabs("select","#checkin_search"); }); } + if($("#header_search #circ_search")){ $.hotkeys.add('Alt+u',function (){ $("#header_search > ul").tabs("select","#circ_search"); }); } + if($("#header_search #catalog_search")){ $.hotkeys.add('Alt+q',function (){ $("#header_search > ul").tabs("select","#catalog_search"); }); } }); - - YAHOO.util.Event.onContentReady("header", function () { + YAHOO.util.Event.onContentReady("header", function () { var oMoremenu = new YAHOO.widget.Menu("moremenu", { zindex: 2 }); function positionoMoremenu() { diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.hotkeys.js b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.hotkeys.js new file mode 100644 index 0000000000..7d159e611a --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.hotkeys.js @@ -0,0 +1,127 @@ +/****************************************************************************************************************************** + + * @ Original idea by by Binny V A, Original version: 2.00.A + * @ http://www.openjs.com/scripts/events/keyboard_shortcuts/ + * @ Original License : BSD + + * @ jQuery Plugin by Tzury Bar Yochay + mail: tzury.by@gmail.com + blog: evalinux.wordpress.com + face: facebook.com/profile.php?id=513676303 + + (c) Copyrights 2007 + + * @ jQuery Plugin version Beta (0.0.2) + * @ License: jQuery-License. + +TODO: + add queue support (as in gmail) e.g. 'x' then 'y', etc. + add mouse + mouse wheel events. + +USAGE: + $.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');}); + $.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});> + $.hotkeys.remove('Ctrl+c'); + $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'}); + +******************************************************************************************************************************/ +(function (jQuery){ + this.version = '(beta)(0.0.3)'; + this.all = {}; + this.special_keys = { + 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock', + 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup', + 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3', + 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12'}; + + this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", + "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", + ".":">", "/":"?", "\\":"|" }; + + this.add = function(combi, options, callback) { + if (jQuery.isFunction(options)){ + callback = options; + options = {}; + } + var opt = {}, + defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0], checkParent: true}, + that = this; + opt = jQuery.extend( opt , defaults, options || {} ); + combi = combi.toLowerCase(); + + // inspect if keystroke matches + var inspector = function(event) { + event = jQuery.event.fix(event); // jQuery event normalization. + var element = event.target; + // @ TextNode -> nodeType == 3 + element = (element.nodeType==3) ? element.parentNode : element; + + if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields + var target = jQuery(element); + if( target.is("input") || target.is("textarea")){ + return; + } + } + var code = event.which, + type = event.type, + character = String.fromCharCode(code).toLowerCase(), + special = that.special_keys[code], + shift = event.shiftKey, + ctrl = event.ctrlKey, + alt= event.altKey, + propagate = true, // default behaivour + mapPoint = null; + + // in opera + safari, the event.target is unpredictable. + // for example: 'keydown' might be associated with HtmlBodyElement + // or the element where you last clicked with your mouse. + if (jQuery.browser.opera || jQuery.browser.safari || opt.checkParent){ + while (!that.all[element] && element.parentNode){ + element = element.parentNode; + } + } + + var cbMap = that.all[element].events[type].callbackMap; + if(!shift && !ctrl && !alt) { // No Modifiers + mapPoint = cbMap[special] || cbMap[character] + } + // deals with combinaitons (alt|ctrl|shift+anything) + else{ + var modif = ''; + if(alt) modif +='alt+'; + if(ctrl) modif+= 'ctrl+'; + if(shift) modif += 'shift+'; + // modifiers + special keys or modifiers + characters or modifiers + shift characters + mapPoint = cbMap[modif+special] || cbMap[modif+character] || cbMap[modif+that.shift_nums[character]] + } + if (mapPoint){ + mapPoint.cb(event); + if(!mapPoint.propagate) { + event.stopPropagation(); + event.preventDefault(); + return false; + } + } + }; + // first hook for this element + if (!this.all[opt.target]){ + this.all[opt.target] = {events:{}}; + } + if (!this.all[opt.target].events[opt.type]){ + this.all[opt.target].events[opt.type] = {callbackMap: {}} + jQuery.event.add(opt.target, opt.type, inspector); + } + this.all[opt.target].events[opt.type].callbackMap[combi] = {cb: callback, propagate:opt.propagate}; + return jQuery; + }; + this.remove = function(exp, opt) { + opt = opt || {}; + target = opt.target || jQuery('html')[0]; + type = opt.type || 'keydown'; + exp = exp.toLowerCase(); + delete this.all[target].events[type].callbackMap[exp] + return jQuery; + }; + jQuery.hotkeys = this; + return jQuery; +})(jQuery); \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.css b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.css new file mode 100644 index 0000000000..34bd5fbf71 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.css @@ -0,0 +1,80 @@ +/* Caution! Ensure accessibility in print and other media types... */ +@media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */ + .ui-tabs-hide { + display: none; + } +} + +/* Hide useless elements in print layouts... */ +@media print { + .ui-tabs-nav { + display: none; + } +} + +/* Skin */ +.ui-tabs-nav, .ui-tabs-panel { +} +.ui-tabs-nav { + list-style: none; +} +.ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */ + display: block; + clear: both; + content: " "; +} +.ui-tabs-nav li { + float: left; + list-style-type : none; +} +.ui-tabs-nav a, .ui-tabs-nav a span { + float: left; /* fixes dir=ltr problem and other quirks IE */ + } +.ui-tabs-nav a { + margin: 0; /* position: relative makes opacity fail for disabled tab in IE */ + white-space: nowrap; /* @ IE 6 */ + outline: 0; /* @ Firefox, prevent dotted border after click */ +} +.ui-tabs-nav a:link, .ui-tabs-nav a:visited { +} +.ui-tabs-nav .ui-tabs-selected a { + } +.ui-tabs-nav a span { + padding-top: 1px; + padding-right: 0; + height: 20px; + line-height: 20px; +} +.ui-tabs-nav .ui-tabs-selected a span { + padding-top: 0; + height: 20px; + line-height: 20px; +} +.ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited, +.ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */ + cursor: text; +} +.ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active, +.ui-tabs-nav .ui-tabs-unselect a:hover, .ui-tabs-nav .ui-tabs-unselect a:focus, .ui-tabs-nav .ui-tabs-unselect a:active { /* @ Opera, we need to be explicit again here now... */ + cursor: pointer; +} +.ui-tabs-disabled { + opacity: .4; + filter: alpha(opacity=40); +} +.ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { + color: #000; +} +.ui-tabs-panel { + border: 1px solid #E8E8E8; + padding : 1em; + background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */ +} + +/* Additional IE specific bug fixes... */ +* html .ui-tabs-nav { /* auto clear @ IE 6 & IE 7 Quirks Mode */ + display: inline-block; +} +*:first-child+html .ui-tabs-nav { /* auto clear @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */ + display: inline-block; +} \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.js b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.js new file mode 100644 index 0000000000..672bfb25f1 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.js @@ -0,0 +1,517 @@ +/* + * Tabs 3 - New Wave Tabs + * + * Copyright (c) 2007 Klaus Hartl (stilbuero.de) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Tabs + */ + +(function($) { + + // if the UI scope is not availalable, add it + $.ui = $.ui || {}; + + // tabs API methods + $.fn.tabs = function() { + var method = typeof arguments[0] == 'string' && arguments[0]; + var args = method && Array.prototype.slice.call(arguments, 1) || arguments; + + return this.each(function() { + if (method) { + var tabs = $.data(this, 'ui-tabs'); + tabs[method].apply(tabs, args); + } else + new $.ui.tabs(this, args[0] || {}); + }); + }; + + // tabs class + $.ui.tabs = function(el, options) { + var self = this; + + this.element = el; + + this.options = $.extend({ + + // basic setup + selected: 0, + unselect: options.selected === null, + event: 'click', + disabled: [], + cookie: null, // pass options object as expected by cookie plugin: { expires: 7, path: '/', domain: 'jquery.com', secure: true } + // TODO bookmarkable: $.ajaxHistory ? true : false, + + // Ajax + spinner: 'Loading…', + cache: false, + idPrefix: 'ui-tabs-', + ajaxOptions: {}, + + // animations + fx: null, /* e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } */ + + // templates + tabTemplate: '
  • #{label}
  • ', + panelTemplate: '
    ', + + // CSS classes + navClass: 'ui-tabs-nav', + selectedClass: 'ui-tabs-selected', + unselectClass: 'ui-tabs-unselect', + disabledClass: 'ui-tabs-disabled', + panelClass: 'ui-tabs-panel', + hideClass: 'ui-tabs-hide', + loadingClass: 'ui-tabs-loading' + + }, options); + + this.options.event += '.ui-tabs'; // namespace event + this.options.cookie = $.cookie && $.cookie.constructor == Function && this.options.cookie; + + $(el).bind('setData.ui-tabs', function(event, key, value) { + self.options[key] = value; + this.tabify(); + }).bind('getData.ui-tabs', function(event, key) { + return self.options[key]; + }); + + // save instance for later + $.data(el, 'ui-tabs', this); + + // create tabs + this.tabify(true); + }; + + // instance methods + $.extend($.ui.tabs.prototype, { + tabId: function(a) { + return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') + || this.options.idPrefix + $.data(a); + }, + ui: function(tab, panel) { + return { + instance: this, + options: this.options, + tab: tab, + panel: panel + }; + }, + tabify: function(init) { + + this.$lis = $('li:has(a[href])', this.element); + this.$tabs = this.$lis.map(function() { return $('a', this)[0]; }); + this.$panels = $([]); + + var self = this, o = this.options; + + this.$tabs.each(function(i, a) { + // inline tab + if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash + self.$panels = self.$panels.add(a.hash); + // remote tab + else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#" + $.data(a, 'href.ui-tabs', a.href); // required for restore on destroy + $.data(a, 'load.ui-tabs', a.href); // mutable + var id = self.tabId(a); + a.href = '#' + id; + var $panel = $('#' + id); + if (!$panel.length) { + $panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass) + .insertAfter( self.$panels[i - 1] || self.element ); + $panel.data('destroy.ui-tabs', true); + } + self.$panels = self.$panels.add( $panel ); + } + // invalid tab href + else + o.disabled.push(i + 1); + }); + + if (init) { + + // attach necessary classes for styling if not present + $(this.element).hasClass(o.navClass) || $(this.element).addClass(o.navClass); + this.$panels.each(function() { + var $this = $(this); + $this.hasClass(o.panelClass) || $this.addClass(o.panelClass); + }); + + // disabled tabs + for (var i = 0, index; index = o.disabled[i]; i++) + this.disable(index); + + // Try to retrieve selected tab: + // 1. from fragment identifier in url if present + // 2. from cookie + // 3. from selected class attribute on
  • + // 4. otherwise use given "selected" option + // 5. check if tab is disabled + this.$tabs.each(function(i, a) { + if (location.hash) { + if (a.hash == location.hash) { + o.selected = i; + // prevent page scroll to fragment + //if (($.browser.msie || $.browser.opera) && !o.remote) { + if ($.browser.msie || $.browser.opera) { + var $toShow = $(location.hash), toShowId = $toShow.attr('id'); + $toShow.attr('id', ''); + setTimeout(function() { + $toShow.attr('id', toShowId); // restore id + }, 500); + } + scrollTo(0, 0); + return false; // break + } + } else if (o.cookie) { + var index = parseInt($.cookie('ui-tabs' + $.data(self.element)),10); + if (index && self.$tabs[index]) { + o.selected = index; + return false; // break + } + } else if ( self.$lis.eq(i).hasClass(o.selectedClass) ) { + o.selected = i; + return false; // break + } + }); + var n = this.$lis.length; + while (this.$lis.eq(o.selected).hasClass(o.disabledClass) && n) { + o.selected = ++o.selected < this.$lis.length ? o.selected : 0; + n--; + } + if (!n) // all tabs disabled, set option unselect to true + o.unselect = true; + + // highlight selected tab + this.$panels.addClass(o.hideClass); + this.$lis.removeClass(o.selectedClass); + if (!o.unselect) { + this.$panels.eq(o.selected).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before + this.$lis.eq(o.selected).addClass(o.selectedClass); + } + + // load if remote tab + var href = !o.unselect && $.data(this.$tabs[o.selected], 'load.ui-tabs'); + if (href) + this.load(o.selected, href); + + // disable click if event is configured to something else + if (!(/^click/).test(o.event)) + this.$tabs.bind('click', function(e) { e.preventDefault(); }); + + } + + var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal'; + if (o.fx && o.fx.constructor == Array) + hideFx = o.fx[0] || baseFx, showFx = o.fx[1] || baseFx; + else + hideFx = showFx = o.fx || baseFx; + + // reset some styles to maintain print style sheets etc. + var resetCSS = { display: '', overflow: '', height: '' }; + if (!$.browser.msie) // not in IE to prevent ClearType font issue + resetCSS.opacity = ''; + + // Hide a tab, animation prevents browser scrolling to fragment, + // $show is optional. + function hideTab(clicked, $hide, $show) { + $hide.animate(hideFx, hideFx.duration || baseDuration, function() { // + $hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc. + if ($.browser.msie && hideFx.opacity) + $hide[0].style.filter = ''; + if ($show) + showTab(clicked, $show, $hide); + }); + } + + // Show a tab, animation prevents browser scrolling to fragment, + // $hide is optional. + function showTab(clicked, $show, $hide) { + if (showFx === baseFx) + $show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels + $show.animate(showFx, showFx.duration || baseDuration, function() { + $show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc. + if ($.browser.msie && showFx.opacity) + $show[0].style.filter = ''; + + // callback + $(self.element).triggerHandler("show.ui-tabs", [self.ui(clicked, $show[0])]); + + }); + } + + // switch a tab + function switchTab(clicked, $li, $hide, $show) { + /*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click + $.ajaxHistory.update(clicked.hash); + }*/ + $li.addClass(o.selectedClass) + .siblings().removeClass(o.selectedClass); + hideTab(clicked, $hide, $show); + } + + // attach tab event handler, unbind to avoid duplicates from former tabifying... + this.$tabs.unbind(o.event).bind(o.event, function() { + + //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click + var $li = $(this).parents('li:eq(0)'), + $hide = self.$panels.filter(':visible'), + $show = $(this.hash); + + // If tab is already selected and not unselectable or tab disabled or click callback returns false stop here. + // Check if click handler returns false last so that it is not executed for a disabled tab! + if (($li.hasClass(o.selectedClass) && !o.unselect) || $li.hasClass(o.disabledClass) + || $(self.element).triggerHandler("select.ui-tabs", [self.ui(this, $show[0])]) === false) { + this.blur(); + return false; + } + + self.options.selected = self.$tabs.index(this); + + // if tab may be closed + if (o.unselect) { + if ($li.hasClass(o.selectedClass)) { + self.options.selected = null; + $li.removeClass(o.selectedClass); + self.$panels.stop(); + hideTab(this, $hide); + this.blur(); + return false; + } else if (!$hide.length) { + self.$panels.stop(); + var a = this; + self.load(self.$tabs.index(this), function() { + $li.addClass(o.selectedClass).addClass(o.unselectClass); + showTab(a, $show); + }); + this.blur(); + return false; + } + } + + if (o.cookie) + $.cookie('ui-tabs' + $.data(self.element), self.options.selected, o.cookie); + + // stop possibly running animations + self.$panels.stop(); + + // show new tab + if ($show.length) { + + // prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled + /*if ($.browser.msie && o.bookmarkable) { + var showId = this.hash.replace('#', ''); + $show.attr('id', ''); + setTimeout(function() { + $show.attr('id', showId); // restore id + }, 0); + }*/ + + var a = this; + self.load(self.$tabs.index(this), function() { + switchTab(a, $li, $hide, $show); + }); + + // Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash + /*var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0; + var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0; + setTimeout(function() { + scrollTo(scrollX, scrollY); + }, 0);*/ + + } else + throw 'jQuery UI Tabs: Mismatching fragment identifier.'; + + // Prevent IE from keeping other link focussed when using the back button + // and remove dotted border from clicked link. This is controlled in modern + // browsers via CSS, also blur removes focus from address bar in Firefox + // which can become a usability and annoying problem with tabsRotate. + if ($.browser.msie) + this.blur(); + + //return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE + return false; + + }); + + }, + add: function(url, label, index) { + if (url && label) { + index = index || this.$tabs.length; // append by default + + var o = this.options; + var $li = $(o.tabTemplate.replace(/#\{href\}/, url).replace(/#\{label\}/, label)); + $li.data('destroy.ui-tabs', true); + + var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] ); + + // try to find an existing element before creating a new one + var $panel = $('#' + id); + if (!$panel.length) { + $panel = $(o.panelTemplate).attr('id', id) + .addClass(o.panelClass).addClass(o.hideClass); + $panel.data('destroy.ui-tabs', true); + } + if (index >= this.$lis.length) { + $li.appendTo(this.element); + $panel.appendTo(this.element.parentNode); + } else { + $li.insertBefore(this.$lis[index]); + $panel.insertBefore(this.$panels[index]); + } + + this.tabify(); + + if (this.$tabs.length == 1) { + $li.addClass(o.selectedClass); + $panel.removeClass(o.hideClass); + var href = $.data(this.$tabs[0], 'load.ui-tabs'); + if (href) + this.load(index, href); + } + + // callback + $(this.element).triggerHandler("add.ui-tabs", + [this.ui(this.$tabs[index], this.$panels[index])] + ); + + } else + throw 'jQuery UI Tabs: Not enough arguments to add tab.'; + }, + remove: function(index) { + if (index && index.constructor == Number) { + var o = this.options, $li = this.$lis.eq(index).remove(), + $panel = this.$panels.eq(index).remove(); + + // If selected tab was removed focus tab to the right or + // tab to the left if last tab was removed. + if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1) + this.click(index + (index < this.$tabs.length ? 1 : -1)); + this.tabify(); + + // callback + $(this.element).triggerHandler("remove.ui-tabs", + [this.ui($li.find('a')[0], $panel[0])] + ); + + } + }, + enable: function(index) { + var self = this, o = this.options, $li = this.$lis.eq(index); + $li.removeClass(o.disabledClass); + if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2... + $li.css('display', 'inline-block'); + setTimeout(function() { + $li.css('display', 'block'); + }, 0); + } + + o.disabled = $.map(this.$lis.filter('.' + o.disabledClass), + function(n, i) { return self.$lis.index(n); } ); + + // callback + $(this.element).triggerHandler("enable.ui-tabs", + [this.ui(this.$tabs[index], this.$panels[index])] + ); + + }, + disable: function(index) { + var self = this, o = this.options; + this.$lis.eq(index).addClass(o.disabledClass); + + o.disabled = $.map(this.$lis.filter('.' + o.disabledClass), + function(n, i) { return self.$lis.index(n); } ); + + // callback + $(this.element).triggerHandler("disable.ui-tabs", + [this.ui(this.$tabs[index], this.$panels[index])] + ); + + }, + select: function(index) { + if (typeof index == 'string') + index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] ); + this.$tabs.eq(index).trigger(this.options.event); + }, + load: function(index, callback) { // callback is for internal usage only + var self = this, o = this.options, + $a = this.$tabs.eq(index), a = $a[0]; + + var url = $a.data('load.ui-tabs'); + + // no remote - just finish with callback + if (!url) { + typeof callback == 'function' && callback(); + return; + } + + // load remote from here on + if (o.spinner) { + var $span = $('span', a), label = $span.html(); + $span.html('' + o.spinner + ''); + } + var finish = function() { + self.$tabs.filter('.' + o.loadingClass).each(function() { + $(this).removeClass(o.loadingClass); + if (o.spinner) + $('span', this).html(label); + }); + self.xhr = null; + }; + var ajaxOptions = $.extend({}, o.ajaxOptions, { + url: url, + success: function(r, s) { + $(a.hash).html(r); + finish(); + // This callback is required because the switch has to take + // place after loading has completed. + typeof callback == 'function' && callback(); + + if (o.cache) + $.removeData(a, 'load.ui-tabs'); // if loaded once do not load them again + + // callback + $(self.element).triggerHandler("load.ui-tabs", + [self.ui(self.$tabs[index], self.$panels[index])] + ); + + o.ajaxOptions.success && o.ajaxOptions.success(r, s); + } + }); + if (this.xhr) { + // terminate pending requests from other tabs and restore tab label + this.xhr.abort(); + finish(); + } + $a.addClass(o.loadingClass); + setTimeout(function() { // timeout is again required in IE, "wait" for id being restored + self.xhr = $.ajax(ajaxOptions); + }, 0); + + }, + url: function(index, url) { + this.$tabs.eq(index).data('load.ui-tabs', url); + }, + destroy: function() { + var o = this.options; + $(this.element).unbind('.ui-tabs') + .removeClass(o.navClass).removeData('ui-tabs'); + this.$tabs.each(function() { + var href = $.data(this, 'href.ui-tabs'); + if (href) + this.href = href; + $(this).unbind('.ui-tabs') + .removeData('href.ui-tabs').removeData('load.ui-tabs'); + }); + this.$lis.add(this.$panels).each(function() { + if ($.data(this, 'destroy.ui-tabs')) + $(this).remove(); + else + $(this).removeClass([o.selectedClass, o.unselectClass, + o.disabledClass, o.panelClass, o.hideClass].join(' ')); + }); + } + }); + +})(jQuery); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl index 8b562bf3db..e5c3681a9e 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl @@ -8,7 +8,7 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl index f7740947ab..10e067cab1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl @@ -25,8 +25,8 @@
    -
      -
    • ">Account
    • +
        +
      • ">Account
      • " >Pay fines
      • " >Create manual invoice
      • " >Create manual credit
      • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tmpl index 278c81a653..acbb9c8c21 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tmpl @@ -24,11 +24,11 @@
        -
          +
          diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tmpl index a3cbe5f2b3..265d9a611f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tmpl @@ -24,10 +24,10 @@
          -
            +
            diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl index c601bd8252..3a9aaf1d75 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl @@ -5,7 +5,7 @@