From ca41d37c3711a1337e879f055b6e7f79713fafd2 Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Sat, 26 Oct 2013 21:18:17 +0200 Subject: [PATCH 1/7] reindent --- plugins/vacation_sieve/vacation_sieve.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/vacation_sieve/vacation_sieve.php b/plugins/vacation_sieve/vacation_sieve.php index 43f4af7..8d9969e 100644 --- a/plugins/vacation_sieve/vacation_sieve.php +++ b/plugins/vacation_sieve/vacation_sieve.php @@ -186,12 +186,12 @@ public function vacation_sieve_save() $this->app->output->set_pagetitle($this->gettext('vacation')); rcmail_overwrite_action('plugin.vacation_sieve'); $this->app->output->send('plugin'); - $this->api->output->command('display_message', $this->gettext('filtersaved'), 'confirmation'); + $this->api->output->command('display_message', $this->gettext('filtersaved'), 'confirmation'); } catch ( Exception $exc) { $this->log_error('Fail to save: '.$exc->getMessage()); - $this->api->output->command('display_message', $this->gettext('filtersaveerror'), 'error'); + $this->api->output->command('display_message', $this->gettext('filtersaveerror'), 'error'); } } From f9964086c0b8715f8c220e18bcc9f4fc7d6f8e7f Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Sat, 26 Oct 2013 21:23:33 +0200 Subject: [PATCH 2/7] fix error in commit 0f5886b66e21efa9f3c126b71ed5cd2cf9f8e137 --- plugins/vacation_sieve/model.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/vacation_sieve/model.php b/plugins/vacation_sieve/model.php index 3a0e9ac..3bc3d4f 100644 --- a/plugins/vacation_sieve/model.php +++ b/plugins/vacation_sieve/model.php @@ -23,7 +23,6 @@ class model public $vacation_end = 0; public $vacation_endtime = 12; public $append_subject = true; - public $append_subject = true; public $vacation_subject = 'Out of office'; // overwrite in config.inc.php public $vacation_message = 'I am in Holidays...'; // overwrite in config.inc.php public $every = 1; From 9030bb84920800e8e5fcea50bd3cd680b3fc6d54 Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Sat, 26 Oct 2013 22:45:14 +0200 Subject: [PATCH 3/7] use .vacation class to not mess with the other ui elements --- plugins/vacation_sieve/styles.css | 6 +++--- plugins/vacation_sieve/vacation_sieve.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/vacation_sieve/styles.css b/plugins/vacation_sieve/styles.css index 033d077..2457b7f 100644 --- a/plugins/vacation_sieve/styles.css +++ b/plugins/vacation_sieve/styles.css @@ -1,13 +1,13 @@ /* Section headers for the orms */ -td.section-first +.vacation td.section-first { font-size:larger; font-weight:bold; padding-bottom:4pt; } -td.section +.vacation td.section { font-size:larger; font-weight:bold; @@ -15,7 +15,7 @@ td.section padding-bottom:4pt; } -td.top +.vacation td.top { vertical-align:top; } diff --git a/plugins/vacation_sieve/vacation_sieve.php b/plugins/vacation_sieve/vacation_sieve.php index 8d9969e..7090165 100644 --- a/plugins/vacation_sieve/vacation_sieve.php +++ b/plugins/vacation_sieve/vacation_sieve.php @@ -285,7 +285,7 @@ public function vacation_sieve_form() { try { - $table = new html_table(array('cols' => 2, 'class' => 'propform')); + $table = new html_table(array('cols' => 2, 'class' => 'propform vacation')); $format = $this->app->config->get('date_format'); From 3410325bbdd43ba7db98baddda0667092b489875 Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Sat, 26 Oct 2013 22:44:56 +0200 Subject: [PATCH 4/7] switch to minWidth:auto --- plugins/vacation_sieve/vacation_sieve.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/vacation_sieve/vacation_sieve.js b/plugins/vacation_sieve/vacation_sieve.js index 546fae7..3617c33 100644 --- a/plugins/vacation_sieve/vacation_sieve.js +++ b/plugins/vacation_sieve/vacation_sieve.js @@ -28,7 +28,7 @@ if (window.rcmail) // Adjust the eight of the identities list $(function () { - $('select#addressed_to').multiselect({header:false, selectedList: 2, height:"auto"}); + $('select#addressed_to').multiselect({header:false, selectedList: 2, height:"auto", minWidth:"auto"}); // Make sure we have one address selected. On select 'null' select the default. $("select#addressed_to").change(function(){ if ( $(this).val() == null ) { From 381abfd5092ca95647d7ec4c8708aeab7c910e45 Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Sat, 26 Oct 2013 22:43:15 +0200 Subject: [PATCH 5/7] update to most recent official github release include https://github.com/ehynds/jquery-ui-multiselect-widget/pull/480 --- .../jquery.multiselect.js | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.js b/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.js index a879506..e0ca3f1 100644 --- a/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.js +++ b/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.js @@ -40,7 +40,8 @@ hide: null, autoOpen: false, multiple: true, - position: {} + position: {}, + appendTo: "body" }, _create: function() { @@ -55,7 +56,7 @@ // jQuery UI 1.9+, and otherwise fallback to a custom string. this._namespaceID = this.eventNamespace || ('multiselect' + multiselectID); - var button = (this.button = $('')) + var button = (this.button = $('')) .addClass('ui-multiselect ui-widget ui-state-default ui-corner-all') .addClass(o.classes) .attr({ 'title':el.attr('title'), 'aria-haspopup':true, 'tabIndex':el.attr('tabIndex') }) @@ -68,7 +69,7 @@ menu = (this.menu = $('
')) .addClass('ui-multiselect-menu ui-widget ui-widget-content ui-corner-all') .addClass(o.classes) - .appendTo(document.body), + .appendTo($(o.appendTo)), header = (this.header = $('
')) .addClass('ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix') @@ -135,8 +136,8 @@ el.find('option').each(function(i) { var $this = $(this); var parent = this.parentNode; - var title = this.innerHTML; - var description = this.title; + var description = this.innerHTML; + var title = this.title; var value = this.value; var inputID = 'ui-multiselect-' + (this.id || id + '-option-' + i); var isDisabled = this.disabled; @@ -169,7 +170,7 @@ html += '
  • '; // create the label - html += '
  • '; + html += ' />' + description + ''; }); // insert into the DOM @@ -222,7 +223,7 @@ if($.isFunction(o.selectedText)) { value = o.selectedText.call(this, numChecked, $inputs.length, $checked.get()); } else if(/\d/.test(o.selectedList) && o.selectedList > 0 && numChecked <= o.selectedList) { - value = $checked.map(function() { return $(this).next().html(); }).get().join(', '); + value = $checked.map(function() { return $(this).next().text(); }).get().join(', '); } else { value = o.selectedText.replace('#', numChecked).replace('#', $inputs.length); } @@ -399,8 +400,15 @@ }); // close each widget when clicking on any other element/anywhere else on the page - $doc.bind('mousedown.' + this._namespaceID, function(e) { - if(self._isOpen && !$.contains(self.menu[0], e.target) && !$.contains(self.button[0], e.target) && e.target !== self.button[0]) { + $doc.bind('mousedown.' + this._namespaceID, function(event) { + var target = event.target; + + if(self._isOpen + && target !== self.button[0] + && target !== self.menu[0] + && !$.contains(self.menu[0], target) + && !$.contains(self.button[0], target) + ) { self.close(); } }); @@ -439,7 +447,7 @@ var moveToLast = which === 38 || which === 37; // select the first li that isn't an optgroup label / disabled - $next = $start.parent()[moveToLast ? 'prevAll' : 'nextAll']('li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)')[ moveToLast ? 'last' : 'first'](); + var $next = $start.parent()[moveToLast ? 'prevAll' : 'nextAll']('li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)').first(); // if at the first/last element if(!$next.length) { @@ -571,10 +579,10 @@ // show the menu, maybe with a speed/effect combo $.fn.show.apply(menu, args); - // select the first option + // select the first not disabled option // triggering both mouseover and mouseover because 1.4.2+ has a bug where triggering mouseover // will actually trigger mouseenter. the mouseenter trigger is there for when it's eventually fixed - this.labels.eq(0).trigger('mouseover').trigger('mouseenter').find('input').trigger('focus'); + this.labels.filter(':not(.ui-state-disabled)').eq(0).trigger('mouseover').trigger('mouseenter').find('input').trigger('focus'); button.addClass('ui-state-active'); this._isOpen = true; @@ -661,7 +669,7 @@ // use the position utility if it exists and options are specifified if($.ui.position && !$.isEmptyObject(o.position)) { - o.position.of = o.position.of || button; + o.position.of = o.position.of || this.button; this.menu .show() From abc9511f008144e3c598ccb5525deb4f2b7dfc96 Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Sat, 26 Oct 2013 22:44:37 +0200 Subject: [PATCH 6/7] account for ui icon width --- .../js/jquery-ui-multiselect-widget/jquery.multiselect.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.js b/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.js index e0ca3f1..50087e4 100644 --- a/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.js +++ b/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.js @@ -424,7 +424,8 @@ // set button width _setButtonWidth: function() { - var width = this.element.outerWidth(); + // account for the ui-icon + var width = this.element.outerWidth() + this.button.children('span').outerWidth() + 2; var o = this.options; if(/\d/.test(o.minWidth) && width < o.minWidth) { From b329a3a7e365a1981b0d00514192b9f9a4d5bfc7 Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Sat, 26 Oct 2013 22:57:49 +0200 Subject: [PATCH 7/7] minify using http://javascript-minifier.com/ --- .../js/jquery-ui-multiselect-widget/jquery.multiselect.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.min.js b/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.min.js index e924350..44c5c0d 100644 --- a/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.min.js +++ b/plugins/vacation_sieve/js/jquery-ui-multiselect-widget/jquery.multiselect.min.js @@ -1,5 +1,5 @@ /* - * jQuery MultiSelect UI Widget 1.13 + * jQuery MultiSelect UI Widget 1.14pre * Copyright (c) 2012 Eric Hynds * * http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ @@ -17,4 +17,4 @@ * http://www.gnu.org/licenses/gpl.html * */ -(function(d){var k=0;d.widget("ech.multiselect",{options:{header:!0,height:175,minWidth:225,classes:"",checkAllText:"Check all",uncheckAllText:"Uncheck all",noneSelectedText:"Select options",selectedText:"# selected",selectedList:0,show:null,hide:null,autoOpen:!1,multiple:!0,position:{}},_create:function(){var a=this.element.hide(),b=this.options;this.speed=d.fx.speeds._default;this._isOpen=!1;a=(this.button=d('')).addClass("ui-multiselect ui-widget ui-state-default ui-corner-all").addClass(b.classes).attr({title:a.attr("title"),"aria-haspopup":!0,tabIndex:a.attr("tabIndex")}).insertAfter(a);(this.buttonlabel=d("")).html(b.noneSelectedText).appendTo(a);var a=(this.menu=d("
    ")).addClass("ui-multiselect-menu ui-widget ui-widget-content ui-corner-all").addClass(b.classes).appendTo(document.body),c=(this.header=d("
    ")).addClass("ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix").appendTo(a);(this.headerLinkContainer=d("
      ")).addClass("ui-helper-reset").html(function(){return!0===b.header?'
    • '+b.checkAllText+'
    • '+b.uncheckAllText+"
    • ":"string"===typeof b.header?"
    • "+b.header+"
    • ":""}).append('
    • ').appendTo(c);(this.checkboxContainer=d("
        ")).addClass("ui-multiselect-checkboxes ui-helper-reset").appendTo(a);this._bindEvents();this.refresh(!0);b.multiple||a.addClass("ui-multiselect-single")},_init:function(){!1===this.options.header&&this.header.hide();this.options.multiple||this.headerLinkContainer.find(".ui-multiselect-all, .ui-multiselect-none").hide();this.options.autoOpen&&this.open();this.element.is(":disabled")&&this.disable()},refresh:function(a){var b=this.element,c=this.options,f=this.menu,h=this.checkboxContainer,g=[],e="",i=b.attr("id")||k++;b.find("option").each(function(b){d(this);var a=this.parentNode,f=this.innerHTML,h=this.title,k=this.value,b="ui-multiselect-"+(this.id||i+"-option-"+b),l=this.disabled,n=this.selected,m=["ui-corner-all"],o=(l?"ui-multiselect-disabled ":" ")+this.className,j;"OPTGROUP"===a.tagName&&(j=a.getAttribute("label"),-1===d.inArray(j,g)&&(e+='
      • '+j+"
      • ",g.push(j)));l&&m.push("ui-state-disabled");n&&!c.multiple&&m.push("ui-state-active");e+='
      • ';e+='
      • "});h.html(e);this.labels=f.find("label");this.inputs=this.labels.children("input");this._setButtonWidth();this._setMenuWidth();this.button[0].defaultValue=this.update();a||this._trigger("refresh")},update:function(){var a=this.options,b=this.inputs,c=b.filter(":checked"),f=c.length,a=0===f?a.noneSelectedText:d.isFunction(a.selectedText)?a.selectedText.call(this,f,b.length,c.get()):/\d/.test(a.selectedList)&&0')).addClass("ui-multiselect ui-widget ui-state-default ui-corner-all").addClass(s.classes).attr({title:i.attr("title"),"aria-haspopup":!0,tabIndex:i.attr("tabIndex")}).insertAfter(i),a=((this.buttonlabel=e("")).html(s.noneSelectedText).appendTo(n),(this.menu=e("
        ")).addClass("ui-multiselect-menu ui-widget ui-widget-content ui-corner-all").addClass(s.classes).appendTo(e(s.appendTo))),o=(this.header=e("
        ")).addClass("ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix").appendTo(a);(this.headerLinkContainer=e("
          ")).addClass("ui-helper-reset").html(function(){return s.header===!0?'
        • '+s.checkAllText+'
        • '+s.uncheckAllText+"
        • ":"string"==typeof s.header?"
        • "+s.header+"
        • ":""}).append('
        • ').appendTo(o),(this.checkboxContainer=e("
            ")).addClass("ui-multiselect-checkboxes ui-helper-reset").appendTo(a),this._bindEvents(),this.refresh(!0),s.multiple||a.addClass("ui-multiselect-single"),t++},_init:function(){this.options.header===!1&&this.header.hide(),this.options.multiple||this.headerLinkContainer.find(".ui-multiselect-all, .ui-multiselect-none").hide(),this.options.autoOpen&&this.open(),this.element.is(":disabled")&&this.disable()},refresh:function(i){var s=this.element,n=this.options,a=this.menu,o=this.checkboxContainer,r=[],l="",c=s.attr("id")||t++;s.find("option").each(function(t){e(this);var i,s=this.parentNode,a=this.innerHTML,o=this.title,u=this.value,d="ui-multiselect-"+(this.id||c+"-option-"+t),h=this.disabled,p=this.selected,f=["ui-corner-all"],m=(h?"ui-multiselect-disabled ":" ")+this.className;"OPTGROUP"===s.tagName&&(i=s.getAttribute("label"),-1===e.inArray(i,r)&&(l+='
          • '+i+"
          • ",r.push(i))),h&&f.push("ui-state-disabled"),p&&!n.multiple&&f.push("ui-state-active"),l+='
          • ',l+='
          • "}),o.html(l),this.labels=a.find("label"),this.inputs=this.labels.children("input"),this._setButtonWidth(),this._setMenuWidth(),this.button[0].defaultValue=this.update(),i||this._trigger("refresh")},update:function(){var t,i=this.options,s=this.inputs,n=s.filter(":checked"),a=n.length;return t=0===a?i.noneSelectedText:e.isFunction(i.selectedText)?i.selectedText.call(this,a,s.length,n.get()):/\d/.test(i.selectedList)&&i.selectedList>0&&a<=i.selectedList?n.map(function(){return e(this).next().text()}).get().join(", "):i.selectedText.replace("#",a).replace("#",s.length),this._setButtonValue(t),t},_setButtonValue:function(e){this.buttonlabel.text(e)},_bindEvents:function(){function t(){return s[s._isOpen?"close":"open"](),!1}var s=this,n=this.button;n.find("span").bind("click.multiselect",t),n.bind({click:t,keypress:function(e){switch(e.which){case 27:case 38:case 37:s.close();break;case 39:case 40:s.open()}},mouseenter:function(){n.hasClass("ui-state-disabled")||e(this).addClass("ui-state-hover")},mouseleave:function(){e(this).removeClass("ui-state-hover")},focus:function(){n.hasClass("ui-state-disabled")||e(this).addClass("ui-state-focus")},blur:function(){e(this).removeClass("ui-state-focus")}}),this.header.delegate("a","click.multiselect",function(t){e(this).hasClass("ui-multiselect-close")?s.close():s[e(this).hasClass("ui-multiselect-all")?"checkAll":"uncheckAll"](),t.preventDefault()}),this.menu.delegate("li.ui-multiselect-optgroup-label a","click.multiselect",function(t){t.preventDefault();var i=e(this),n=i.parent().nextUntil("li.ui-multiselect-optgroup-label").find("input:visible:not(:disabled)"),a=n.get(),o=i.parent().text();s._trigger("beforeoptgrouptoggle",t,{inputs:a,label:o})!==!1&&(s._toggleChecked(n.filter(":checked").length!==n.length,n),s._trigger("optgrouptoggle",t,{inputs:a,label:o,checked:a[0].checked}))}).delegate("label","mouseenter.multiselect",function(){e(this).hasClass("ui-state-disabled")||(s.labels.removeClass("ui-state-hover"),e(this).addClass("ui-state-hover").find("input").focus())}).delegate("label","keydown.multiselect",function(t){switch(t.preventDefault(),t.which){case 9:case 27:s.close();break;case 38:case 40:case 37:case 39:s._traverse(t.which,this);break;case 13:e(this).find("input")[0].click()}}).delegate('input[type="checkbox"], input[type="radio"]',"click.multiselect",function(t){var i=e(this),n=this.value,a=this.checked,o=s.element.find("option");return this.disabled||s._trigger("click",t,{value:n,text:this.title,checked:a})===!1?(t.preventDefault(),void 0):(i.focus(),i.attr("aria-selected",a),o.each(function(){this.value===n?this.selected=a:s.options.multiple||(this.selected=!1)}),s.options.multiple||(s.labels.removeClass("ui-state-active"),i.closest("label").toggleClass("ui-state-active",a),s.close()),s.element.trigger("change"),setTimeout(e.proxy(s.update,s),10),void 0)}),i.bind("mousedown."+this._namespaceID,function(t){var i=t.target;!s._isOpen||i===s.button[0]||i===s.menu[0]||e.contains(s.menu[0],i)||e.contains(s.button[0],i)||s.close()}),e(this.element[0].form).bind("reset.multiselect",function(){setTimeout(e.proxy(s.refresh,s),10)})},_setButtonWidth:function(){var e=this.element.outerWidth()+this.button.children("span").outerWidth()+2,t=this.options;/\d/.test(t.minWidth)&&e-1&&n._toggleState("selected",t).call(this)}),s.length&&this.element.trigger("change")},_toggleDisabled:function(t){this.button.attr({disabled:t,"aria-disabled":t})[t?"addClass":"removeClass"]("ui-state-disabled");var i=this.menu.find("input"),s="ech-multiselect-disabled";i=t?i.filter(":enabled").data(s,!0):i.filter(function(){return e.data(this,s)===!0}).removeData(s),i.attr({disabled:t,"arial-disabled":t}).parent()[t?"addClass":"removeClass"]("ui-state-disabled"),this.element.attr({disabled:t,"aria-disabled":t})},open:function(){var t=this,i=this.button,s=this.menu,n=this.speed,a=this.options,o=[];if(this._trigger("beforeopen")!==!1&&!i.hasClass("ui-state-disabled")&&!this._isOpen){var r=s.find("ul").last(),l=a.show;e.isArray(a.show)&&(l=a.show[0],n=a.show[1]||t.speed),l&&(o=[l,n]),r.scrollTop(0).height(a.height),this.position(),e.fn.show.apply(s,o),this.labels.filter(":not(.ui-state-disabled)").eq(0).trigger("mouseover").trigger("mouseenter").find("input").trigger("focus"),i.addClass("ui-state-active"),this._isOpen=!0,this._trigger("open")}},close:function(){if(this._trigger("beforeclose")!==!1){var t=this.options,i=t.hide,s=this.speed,n=[];e.isArray(t.hide)&&(i=t.hide[0],s=t.hide[1]||this.speed),i&&(n=[i,s]),e.fn.hide.apply(this.menu,n),this.button.removeClass("ui-state-active").trigger("blur").trigger("mouseleave"),this._isOpen=!1,this._trigger("close")}},enable:function(){this._toggleDisabled(!1)},disable:function(){this._toggleDisabled(!0)},checkAll:function(){this._toggleChecked(!0),this._trigger("checkAll")},uncheckAll:function(){this._toggleChecked(!1),this._trigger("uncheckAll")},getChecked:function(){return this.menu.find("input").filter(":checked")},destroy:function(){return e.Widget.prototype.destroy.call(this),i.unbind(this._namespaceID),this.button.remove(),this.menu.remove(),this.element.show(),this},isOpen:function(){return this._isOpen},widget:function(){return this.menu},getButton:function(){return this.button},position:function(){var t=this.options;if(e.ui.position&&!e.isEmptyObject(t.position))t.position.of=t.position.of||this.button,this.menu.show().position(t.position).hide();else{var i=this.button.offset();this.menu.css({top:i.top+this.button.outerHeight(),left:i.left})}},_setOption:function(t,i){var s=this.menu;switch(t){case"header":s.find("div.ui-multiselect-header")[i?"show":"hide"]();break;case"checkAllText":s.find("a.ui-multiselect-all span").eq(-1).text(i);break;case"uncheckAllText":s.find("a.ui-multiselect-none span").eq(-1).text(i);break;case"height":s.find("ul").last().height(parseInt(i,10));break;case"minWidth":this.options[t]=parseInt(i,10),this._setButtonWidth(),this._setMenuWidth();break;case"selectedText":case"selectedList":case"noneSelectedText":this.options[t]=i,this.update();break;case"classes":s.add(this.button).removeClass(this.options.classes).addClass(i);break;case"multiple":s.toggleClass("ui-multiselect-single",!i),this.options.multiple=i,this.element[0].multiple=i,this.refresh();break;case"position":this.position()}e.Widget.prototype._setOption.apply(this,arguments)}})}(jQuery);