From: Jan Schneider Date: Fri, 23 Jan 2009 22:08:39 +0000 (+0100) Subject: MFB: Empty view cache when changing calendar selection X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f5233f2f24a2551c847670def15d15b8655ad15b;p=horde.git MFB: Empty view cache when changing calendar selection (stpierre@nebrwesleyan.edu, Bug #7879). --- diff --git a/kronolith/docs/CHANGES b/kronolith/docs/CHANGES index c20a2423e..8aaacf0a2 100644 --- a/kronolith/docs/CHANGES +++ b/kronolith/docs/CHANGES @@ -15,6 +15,8 @@ v3.0-cvs v2.3.1-cvs ---------- +[jan] Empty view cache when changing calendar selection + (stpierre@nebrwesleyan.edu, Bug #7879). [mjr] Fix category CSS being included on embedded widgets. [jan] Allow to manually change attendee responses (paul@carnie.com.au, Request #7443). diff --git a/kronolith/js/autocomplete.js b/kronolith/js/autocomplete.js index 9e3ea50e7..60f410313 100644 --- a/kronolith/js/autocomplete.js +++ b/kronolith/js/autocomplete.js @@ -1 +1 @@ -var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(b,c,a){this.element=$(b);this.update=$(c).hide();this.active=this.changed=this.hasFocus=false;this.entryCount=this.index=0;this.observer=null;this.oldval=$F(this.element);this.options=Object.extend({paramName:this.element.name,tokens:[],frequency:0.4,minChars:1,onHide:this._onHide.bind(this),onShow:this._onShow.bind(this)},(this._setOptions?this._setOptions(a):(a||{})));if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")}this.element.writeAttribute("autocomplete","off").observe("blur",this._onBlur.bindAsEventListener(this)).observe(Prototype.Browser.Gecko?"keypress":"keydown",this._onKeyPress.bindAsEventListener(this))},_onShow:function(a,e){var d,b=e.getStyle("position");if(!b||b=="absolute"){d=(Prototype.Browser.IE)?a.cumulativeScrollOffset():[0];e.setStyle({position:"absolute"}).clonePosition(a,{setHeight:false,offsetTop:a.offsetHeight,offsetLeft:d[0]})}new Effect.Appear(e,{duration:0.15})},_onHide:function(a,b){new Effect.Fade(b,{duration:0.15})},show:function(){if(!this.update.visible()){this.options.onShow(this.element,this.update)}if(Prototype.Browser.IE&&!this.iefix&&this.update.getStyle("position")=="absolute"){this.iefix=new Element("IFRAME",{src:"javascript:false;",frameborder:0,scrolling:"no"}).setStyle({position:"absolute",filter:"progid:DXImageTransform.Microsoft.Alpha(opactiy=0)",zIndex:1}).hide();this.update.setStyle({zIndex:2}).insert({after:this.iefix})}if(this.iefix){this._fixIEOverlapping.bind(this).delay(0.05)}},_fixIEOverlapping:function(){this.iefix.clonePosition(this.update).show()},hide:function(){this.stopIndicator();if(this.update.visible()){this.options.onHide(this.element,this.update);if(this.iefix){this.iefix.hide()}}},startIndicator:function(){if(this.options.indicator){$(this.options.indicator).show()}},stopIndicator:function(){if(this.options.indicator){$(this.options.indicator).hide()}},_onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();a.stop();return;case Event.KEY_ESC:this.hide();this.active=false;a.stop();return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:case Event.KEY_DOWN:if(a.keyCode==Event.KEY_UP){this.markPrevious()}else{this.markNext()}this.render();a.stop();return}}else{switch(a.keyCode){case 0:if(!Prototype.Browser.WebKit){break}case Event.KEY_TAB:case Event.KEY_RETURN:return}}this.changed=this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=this.onObserverEvent.bind(this).delay(this.options.frequency)},_onHover:function(c){var b=c.findElement("LI"),a=b.readAttribute("acIndex");if(this.index!=a){this.index=a;this.render()}c.stop()},_onClick:function(a){this.index=a.findElement("LI").readAttribute("acIndex");this.selectEntry()},_onBlur:function(a){this.hide.bind(this).delay(0.25);this.active=this.hasFocus=false},render:function(){var a=0;if(this.entryCount){this.update.down().childElements().each(function(b){[b].invoke(this.index==a++?"addClassName":"removeClassName","selected")},this);if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index){--this.index}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index#{1}")))});this.update.update(c);this.entryCount=e.size();c.childElements().each(this.addObservers.bind(this));this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry()}else{this.render()}}},addObservers:function(a){$(a).observe("mouseover",this._onHover.bindAsEventListener(this)).observe("click",this._onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldval=$F(this.element)},getToken:function(){var a=this.getTokenBounds();return $F(this.element).substring(a[0],a[1]).strip()},getTokenBounds:function(){var j,e,f,c,d,g,m=this.options.tokens,k=$F(this.element),h=k.length,b=-1,a=Math.min(h,this.oldval.length);if(k.strip().empty()){return[-1,0]}j=a;for(e=0;eb){b=g}g=k.indexOf(m[f],j+d);if(g!=-1&&g=d.partialChars&&d.partialSearch&&(d.fullSearch||/\s/.test(e.substr(f-1,1)))))){++a;return true}return false},this)}}); \ No newline at end of file +var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(B,C,A){this.element=$(B);this.update=$(C).hide();this.active=this.changed=this.hasFocus=false;this.entryCount=this.index=0;this.observer=null;this.oldval=$F(this.element);this.options=Object.extend({paramName:this.element.name,tokens:[],frequency:0.4,minChars:1,onHide:this._onHide.bind(this),onShow:this._onShow.bind(this)},(this._setOptions?this._setOptions(A):(A||{})));if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")}this.element.writeAttribute("autocomplete","off").observe("blur",this._onBlur.bindAsEventListener(this)).observe(Prototype.Browser.Gecko?"keypress":"keydown",this._onKeyPress.bindAsEventListener(this))},_onShow:function(A,D){var C,B=D.getStyle("position");if(!B||B=="absolute"){C=(Prototype.Browser.IE)?A.cumulativeScrollOffset():[0];D.setStyle({position:"absolute"}).clonePosition(A,{setHeight:false,offsetTop:A.offsetHeight,offsetLeft:C[0]})}new Effect.Appear(D,{duration:0.15})},_onHide:function(A,B){new Effect.Fade(B,{duration:0.15})},show:function(){if(!this.update.visible()){this.options.onShow(this.element,this.update)}if(Prototype.Browser.IE&&!this.iefix&&this.update.getStyle("position")=="absolute"){this.iefix=new Element("IFRAME",{src:"javascript:false;",frameborder:0,scrolling:"no"}).setStyle({position:"absolute",filter:"progid:DXImageTransform.Microsoft.Alpha(opactiy=0)",zIndex:1}).hide();this.update.setStyle({zIndex:2}).insert({after:this.iefix})}if(this.iefix){this._fixIEOverlapping.bind(this).delay(0.05)}},_fixIEOverlapping:function(){this.iefix.clonePosition(this.update).show()},hide:function(){this.stopIndicator();if(this.update.visible()){this.options.onHide(this.element,this.update);if(this.iefix){this.iefix.hide()}}},startIndicator:function(){if(this.options.indicator){$(this.options.indicator).show()}},stopIndicator:function(){if(this.options.indicator){$(this.options.indicator).hide()}},_onKeyPress:function(A){if(this.active){switch(A.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();A.stop();return;case Event.KEY_ESC:this.hide();this.active=false;A.stop();return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:case Event.KEY_DOWN:if(A.keyCode==Event.KEY_UP){this.markPrevious()}else{this.markNext()}this.render();A.stop();return}}else{switch(A.keyCode){case 0:if(!Prototype.Browser.WebKit){break}case Event.KEY_TAB:case Event.KEY_RETURN:return}}this.changed=this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=this.onObserverEvent.bind(this).delay(this.options.frequency)},_onHover:function(C){var B=C.findElement("LI"),A=B.readAttribute("acIndex");if(this.index!=A){this.index=A;this.render()}C.stop()},_onClick:function(A){this.index=A.findElement("LI").readAttribute("acIndex");this.selectEntry()},_onBlur:function(A){this.hide.bind(this).delay(0.25);this.active=this.hasFocus=false},render:function(){var A=0;if(this.entryCount){this.update.down().childElements().each(function(B){[B].invoke(this.index==A++?"addClassName":"removeClassName","selected")},this);if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index){--this.index}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index#{1}")))});this.update.update(C);this.entryCount=E.size();C.childElements().each(this.addObservers.bind(this));this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry()}else{this.render()}}},addObservers:function(A){$(A).observe("mouseover",this._onHover.bindAsEventListener(this)).observe("click",this._onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldval=$F(this.element)},getToken:function(){var A=this.getTokenBounds();return $F(this.element).substring(A[0],A[1]).strip()},getTokenBounds:function(){var I,E,F,C,D,G,K=this.options.tokens,J=$F(this.element),H=J.length,B=-1,A=Math.min(H,this.oldval.length);if(J.strip().empty()){return[-1,0]}I=A;for(E=0;EB){B=G}G=J.indexOf(K[F],I+D);if(G!=-1&&G=D.partialChars&&D.partialSearch&&(D.fullSearch||/\s/.test(E.substr(F-1,1)))))){++A;return true}return false},this)}}); \ No newline at end of file diff --git a/kronolith/js/calendar-panel.js b/kronolith/js/calendar-panel.js index 419aa9a0a..ca39d21d4 100644 --- a/kronolith/js/calendar-panel.js +++ b/kronolith/js/calendar-panel.js @@ -1 +1 @@ -function sbarToggle(){var A=$(document.body),B;if(A.hasClassName("rightPanel")){B=0;A.removeClassName("rightPanel")}else{B=1;A.addClassName("rightPanel")}new Ajax.Request(KronolithVar.pref_api_url,{parameters:{app:"kronolith",pref:"show_panel",value:B}})}document.observe("dom:loaded",function(){$$("#pageControlsInner .checkbox").invoke("observe","click",function(){ShowView(kronolithView,{date:kronolithDate.getFullYear()+(kronolithDate.getMonth()+1).toPaddedString(2)+kronolithDate.getDate().toPaddedString(2),toggle_calendar:this.value},false)});$$("#pageControlsInner .calendar-info").invoke("observe","click",function(){RedBox.loading();var A=this.up().select(".checkbox").first().value;new Ajax.Request(KronolithVar.calendar_info_url,{parameters:{c:A},method:"get",onSuccess:function(B){RedBox.showHtml('
'+B.responseText+'
')},onFailure:function(B){RedBox.close()}})})}); \ No newline at end of file +function sbarToggle(){var A=$(document.body),B;if(A.hasClassName("rightPanel")){B=0;A.removeClassName("rightPanel")}else{B=1;A.addClassName("rightPanel")}new Ajax.Request(KronolithVar.pref_api_url,{parameters:{app:"kronolith",pref:"show_panel",value:B}})}document.observe("dom:loaded",function(){$$("#pageControlsInner .checkbox").invoke("observe","click",function(){Views.invalidate();ShowView(kronolithView,{date:kronolithDate.getFullYear()+(kronolithDate.getMonth()+1).toPaddedString(2)+kronolithDate.getDate().toPaddedString(2),toggle_calendar:this.value},false)});$$("#pageControlsInner .calendar-info").invoke("observe","click",function(){RedBox.loading();var A=this.up().select(".checkbox").first().value;new Ajax.Request(KronolithVar.calendar_info_url,{parameters:{c:A},method:"get",onSuccess:function(B){RedBox.showHtml('
'+B.responseText+'
')},onFailure:function(B){RedBox.close()}})})}); \ No newline at end of file diff --git a/kronolith/js/src/calendar-panel.js b/kronolith/js/src/calendar-panel.js index d5d8338cd..408bd87c8 100644 --- a/kronolith/js/src/calendar-panel.js +++ b/kronolith/js/src/calendar-panel.js @@ -15,6 +15,7 @@ function sbarToggle() document.observe('dom:loaded', function() { $$('#pageControlsInner .checkbox').invoke('observe', 'click', function() { + Views.invalidate(); ShowView(kronolithView, { date: kronolithDate.getFullYear() + (kronolithDate.getMonth() + 1).toPaddedString(2) + kronolithDate.getDate().toPaddedString(2), toggle_calendar: this.value }, false); }); diff --git a/kronolith/js/src/views.js b/kronolith/js/src/views.js index b67bf4333..9ed1b4308 100644 --- a/kronolith/js/src/views.js +++ b/kronolith/js/src/views.js @@ -16,6 +16,12 @@ var Views = { if (this.hash.size() > 10) { this.hash.unset(this.keys.pop()); } + }, + + invalidate: function() + { + this.hash = $H(); + this.keys = []; } }; diff --git a/kronolith/js/views.js b/kronolith/js/views.js index 007c468b6..59f5c8ede 100644 --- a/kronolith/js/views.js +++ b/kronolith/js/views.js @@ -1 +1 @@ -var eventTabs=null;var Views={hash:$H(),keys:[],get:function(A){return this.hash.get(A)},push:function(A,B){this.hash.set(A,B);this.keys.push(A);if(this.hash.size()>10){this.hash.unset(this.keys.pop())}}};function ShowView(A,D,B){if(Object.isUndefined(Ajax.Updater)){return true}if(Object.isUndefined(B)){B=true}var E=$H({view:A});if(typeof D=="object"){E.update(D)}else{E.set("date",D)}var C=KronolithVar.view_url+(KronolithVar.view_url.include("?")?"&":"?")+E.toQueryString();if(Views.get(C)){$("page").update(Views.get(C));_ShowView()}else{$("page").appendChild(new Element("DIV",{id:"pageLoading"}).update(KronolithText.loading));$("pageLoading").clonePosition("page");new Effect.Opacity("pageLoading",{from:0,to:0.5});if(B){new Ajax.Updater("page",C,{onComplete:function(){Views.push(C,$("page").innerHTML);_ShowView()}})}else{new Ajax.Updater("page",C,{onComplete:_ShowView})}}return false}function _ShowView(){if(Object.isFunction(stripeAllElements)){stripeAllElements()}if(typeof ToolTips=="object"){ToolTips.out();ToolTips.attachBehavior()}var B=$("view_title");if(B&&B.firstChild&&B.firstChild.nodeValue){var D=KronolithVar.page_title+B.firstChild.nodeValue;try{document.title=D;if(parent.frames.horde_main){parent.document.title=D}}catch(C){}}var A=$("view_vars");if(A){kronolithView=A.readAttribute("view");kronolithDate=new Date(A.readAttribute("date"));kronolithPrintLink=A.readAttribute("print")}}function ShowTab(A){if(eventTabs==null){eventTabs=$("page").select(".tabset ul li")}eventTabs.each(function(C){var B=$(C.id.substring(3));if(!B){return}if(C.id=="tab"+A){C.addClassName("activeTab");B.show()}else{C.removeClassName("activeTab");B.hide()}});return false}; \ No newline at end of file +var eventTabs=null;var Views={hash:$H(),keys:[],get:function(A){return this.hash.get(A)},push:function(A,B){this.hash.set(A,B);this.keys.push(A);if(this.hash.size()>10){this.hash.unset(this.keys.pop())}},invalidate:function(){this.hash=$H();this.keys=[]}};function ShowView(A,D,B){if(Object.isUndefined(Ajax.Updater)){return true}if(Object.isUndefined(B)){B=true}var E=$H({view:A});if(typeof D=="object"){E.update(D)}else{E.set("date",D)}var C=KronolithVar.view_url+(KronolithVar.view_url.include("?")?"&":"?")+E.toQueryString();if(Views.get(C)){$("page").update(Views.get(C));_ShowView()}else{$("page").appendChild(new Element("DIV",{id:"pageLoading"}).update(KronolithText.loading));$("pageLoading").clonePosition("page");new Effect.Opacity("pageLoading",{from:0,to:0.5});if(B){new Ajax.Updater("page",C,{onComplete:function(){Views.push(C,$("page").innerHTML);_ShowView()}})}else{new Ajax.Updater("page",C,{onComplete:_ShowView})}}return false}function _ShowView(){if(Object.isFunction(stripeAllElements)){stripeAllElements()}if(typeof ToolTips=="object"){ToolTips.out();ToolTips.attachBehavior()}var B=$("view_title");if(B&&B.firstChild&&B.firstChild.nodeValue){var D=KronolithVar.page_title+B.firstChild.nodeValue;try{document.title=D;if(parent.frames.horde_main){parent.document.title=D}}catch(C){}}var A=$("view_vars");if(A){kronolithView=A.readAttribute("view");kronolithDate=new Date(A.readAttribute("date"));kronolithPrintLink=A.readAttribute("print")}}function ShowTab(A){if(eventTabs==null){eventTabs=$("page").select(".tabset ul li")}eventTabs.each(function(C){var B=$(C.id.substring(3));if(!B){return}if(C.id=="tab"+A){C.addClassName("activeTab");B.show()}else{C.removeClassName("activeTab");B.hide()}});return false}; \ No newline at end of file