seamless 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/seamless +36 -0
- data/lib/seamless.rb +70 -0
- data/lib/seamless/active_record_extension.rb +11 -0
- data/lib/seamless/dispatcher.rb +45 -0
- data/lib/seamless/message_broker.rb +12 -0
- data/lib/seamless/message_broker_controller.rb +11 -0
- data/lib/seamless/messagebroker/inmemory_message_broker.rb +45 -0
- data/lib/seamless/migration.rb +8 -0
- data/lib/seamless/model.rb +94 -0
- data/lib/seamless/service.rb +186 -0
- data/seamless/seamless_generator.rb +181 -0
- data/seamless/templates/README +24 -0
- data/seamless/templates/admin.html +166 -0
- data/seamless/templates/application.rb +7 -0
- data/seamless/templates/css/global.css +333 -0
- data/seamless/templates/css/seamless-admin.css +281 -0
- data/seamless/templates/css/seamless.css +632 -0
- data/seamless/templates/environment.rb +65 -0
- data/seamless/templates/generate +25 -0
- data/seamless/templates/images/arch.png +0 -0
- data/seamless/templates/images/arrow_undo.png +0 -0
- data/seamless/templates/images/cell_phone.png +0 -0
- data/seamless/templates/images/confirm.png +0 -0
- data/seamless/templates/images/deny.png +0 -0
- data/seamless/templates/images/dialog_close.gif +0 -0
- data/seamless/templates/images/dialog_close_hover.gif +0 -0
- data/seamless/templates/images/email.png +0 -0
- data/seamless/templates/images/exclamation.png +0 -0
- data/seamless/templates/images/indicator.gif +0 -0
- data/seamless/templates/images/indicator2.gif +0 -0
- data/seamless/templates/images/seamless.gif +0 -0
- data/seamless/templates/images/shadow.gif +0 -0
- data/seamless/templates/images/shadowAlpha.png +0 -0
- data/seamless/templates/images/small_star.png +0 -0
- data/seamless/templates/images/table_add.png +0 -0
- data/seamless/templates/images/table_delete.png +0 -0
- data/seamless/templates/images/table_edit.png +0 -0
- data/seamless/templates/images/table_go.png +0 -0
- data/seamless/templates/images/table_refresh.png +0 -0
- data/seamless/templates/images/tag.png +0 -0
- data/seamless/templates/images/warning.png +0 -0
- data/seamless/templates/images/wizard.gif +0 -0
- data/seamless/templates/images/work_phone.png +0 -0
- data/seamless/templates/index.html +171 -0
- data/seamless/templates/js/seamless-admin.js +255 -0
- data/seamless/templates/js/seamless.js +2755 -0
- data/seamless/templates/message_broker.rb +6 -0
- data/seamless/templates/message_broker_helper.rb +2 -0
- data/seamless/templates/robots.txt +2 -0
- data/seamless/templates/routes.rb +18 -0
- data/seamless/templates/seamless.xml +5 -0
- data/seamless/templates/server +4 -0
- data/seamless/templates/test_service.rb +13 -0
- data/service/USAGE +21 -0
- data/service/service_generator.rb +59 -0
- data/service/templates/service.rb +14 -0
- metadata +122 -0
@@ -0,0 +1,2755 @@
|
|
1
|
+
/**
|
2
|
+
* Hakano Version: 1.0.RC4.127, Built: 20070519 0041
|
3
|
+
*
|
4
|
+
* Seam(less) Web Application Framework
|
5
|
+
* Copyright (c) 2006-2007 Hakano, Inc. All Rights Reserved.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
*
|
10
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
* See the License for the specific language governing permissions and
|
16
|
+
* limitations under the License.
|
17
|
+
*
|
18
|
+
* --------------------------------------------------------------------------------
|
19
|
+
*
|
20
|
+
* NOTICE: Some code included in this file is owned by a one or more
|
21
|
+
* third-parties. Please see the appropriate notice above each section
|
22
|
+
* for more information about authorship, restrictions, licensing and
|
23
|
+
* relevant copyright information.
|
24
|
+
*/
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
var Prototype={Version:'1.5.0_rc1',ScriptFragment:'(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',emptyFunction:function(){},K:function(x){return x}}
|
30
|
+
var Class={create:function(){return function(){this.initialize.apply(this,arguments);}}}
|
31
|
+
var Abstract=new Object();Object.extend=function(destination,source){for(var property in source){destination[property]=source[property];}
|
32
|
+
return destination;}
|
33
|
+
Object.extend(Object,{inspect:function(object){try{if(object==undefined)return'undefined';if(object==null)return'null';return object.inspect?object.inspect():object.toString();}catch(e){if(e instanceof RangeError)return'...';throw e;}},keys:function(object){var keys=[];for(var property in object)
|
34
|
+
keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)
|
35
|
+
values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);}});Function.prototype.bind=function(){var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}}
|
36
|
+
Function.prototype.bindAsEventListener=function(object){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[(event||window.event)].concat(args).concat($A(arguments)));}}
|
37
|
+
Object.extend(Number.prototype,{toColorPart:function(){var digits=this.toString(16);if(this<16)return'0'+digits;return digits;},succ:function(){return this+1;},times:function(iterator){$R(0,this,true).each(iterator);return this;}});var Try={these:function(){var returnValue;for(var i=0;i<arguments.length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
|
38
|
+
return returnValue;}}
|
39
|
+
var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback(this);}finally{this.currentlyExecuting=false;}}}}
|
40
|
+
Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=(replacement(match)||'').toString();source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
|
41
|
+
return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=count===undefined?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return this;},truncate:function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:this;},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var div=document.createElement('div');var text=document.createTextNode(this);div.appendChild(text);return div.innerHTML;},unescapeHTML:function(){var div=document.createElement('div');div.innerHTML=this.stripTags();return div.childNodes[0]?div.childNodes[0].nodeValue:'';},toQueryParams:function(){var pairs=this.match(/^\??(.*)$/)[1].split('&');return pairs.inject({},function(params,pairString){var pair=pairString.split('=');var value=pair[1]?decodeURIComponent(pair[1]):undefined;params[decodeURIComponent(pair[0])]=value;return params;});},toArray:function(){return this.split('');},camelize:function(){var oStringList=this.split('-');if(oStringList.length==1)return oStringList[0];var camelizedString=this.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}
|
42
|
+
return camelizedString;},inspect:function(useDoubleQuotes){var escapedString=this.replace(/\\/g,'\\\\');if(useDoubleQuotes)
|
43
|
+
return'"'+escapedString.replace(/"/g,'\\"')+'"';else
|
44
|
+
return"'"+escapedString.replace(/'/g,'\\\'')+"'";}});String.prototype.gsub.prepareReplacement=function(replacement){if(typeof replacement=='function')return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};}
|
45
|
+
String.prototype.parseQuery=String.prototype.toQueryParams;var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){return this.template.gsub(this.pattern,function(match){var before=match[1];if(before=='\\')return match[2];return before+(object[match[3]]||'').toString();});}}
|
46
|
+
var $break=new Object();var $continue=new Object();var Enumerable={each:function(iterator){var index=0;try{this._each(function(value){try{iterator(value,index++);}catch(e){if(e!=$continue)throw e;}});}catch(e){if(e!=$break)throw e;}
|
47
|
+
return this;},all:function(iterator){var result=true;this.each(function(value,index){result=result&&!!(iterator||Prototype.K)(value,index);if(!result)throw $break;});return result;},any:function(iterator){var result=false;this.each(function(value,index){if(result=!!(iterator||Prototype.K)(value,index))
|
48
|
+
throw $break;});return result;},collect:function(iterator){var results=[];this.each(function(value,index){results.push(iterator(value,index));});return results;},detect:function(iterator){var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw $break;}});return result;},findAll:function(iterator){var results=[];this.each(function(value,index){if(iterator(value,index))
|
49
|
+
results.push(value);});return results;},grep:function(pattern,iterator){var results=[];this.each(function(value,index){var stringValue=value.toString();if(stringValue.match(pattern))
|
50
|
+
results.push((iterator||Prototype.K)(value,index));})
|
51
|
+
return results;},include:function(object){var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inject:function(memo,iterator){this.each(function(value,index){memo=iterator(memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.collect(function(value){return value[method].apply(value,args);});},max:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(result==undefined||value>=result)
|
52
|
+
result=value;});return result;},min:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(result==undefined||value<result)
|
53
|
+
result=value;});return result;},partition:function(iterator){var trues=[],falses=[];this.each(function(value,index){((iterator||Prototype.K)(value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value,index){results.push(value[property]);});return results;},reject:function(iterator){var results=[];this.each(function(value,index){if(!iterator(value,index))
|
54
|
+
results.push(value);});return results;},sortBy:function(iterator){return this.collect(function(value,index){return{value:value,criteria:iterator(value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.collect(Prototype.K);},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(typeof args.last()=='function')
|
55
|
+
iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});},inspect:function(){return'#<Enumerable:'+this.toArray().inspect()+'>';}}
|
56
|
+
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(iterable){if(!iterable)return[];if(iterable.toArray){return iterable.toArray();}else{var results=[];for(var i=0;i<iterable.length;i++)
|
57
|
+
results.push(iterable[i]);return results;}}
|
58
|
+
Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)
|
59
|
+
Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0;i<this.length;i++)
|
60
|
+
iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=undefined||value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(value&&value.constructor==Array?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},indexOf:function(object){for(var i=0;i<this.length;i++)
|
61
|
+
if(this[i]==object)return i;return-1;},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},reduce:function(){return this.length>1?this:this[0];},uniq:function(){return this.inject([],function(array,value){return array.include(value)?array:array.concat([value]);});},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';}});var Hash={_each:function(iterator){for(var key in this){var value=this[key];if(typeof value=='function')continue;var pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},merge:function(hash){return $H(hash).inject($H(this),function(mergedHash,pair){mergedHash[pair.key]=pair.value;return mergedHash;});},toQueryString:function(){return this.map(function(pair){return pair.map(encodeURIComponent).join('=');}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';}}
|
62
|
+
function $H(object){var hash=Object.extend({},object||{});Object.extend(hash,Enumerable);Object.extend(hash,Hash);return hash;}
|
63
|
+
ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)
|
64
|
+
return false;if(this.exclusive)
|
65
|
+
return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);}
|
66
|
+
var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false;},activeRequestCount:0}
|
67
|
+
Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responderToAdd){if(!this.include(responderToAdd))
|
68
|
+
this.responders.push(responderToAdd);},unregister:function(responderToRemove){this.responders=this.responders.without(responderToRemove);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(responder[callback]&&typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++;},onComplete:function(){Ajax.activeRequestCount--;}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',parameters:''}
|
69
|
+
Object.extend(this.options,options||{});},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300);},responseIsFailure:function(){return!this.responseIsSuccess();}}
|
70
|
+
Ajax.Request=Class.create();Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{initialize:function(url,options){this.transport=Ajax.getTransport();this.setOptions(options);this.request(url);},request:function(url){var parameters=this.options.parameters||'';if(parameters.length>0)parameters+='&_=';if(this.options.method!='get'&&this.options.method!='post'){parameters+=(parameters.length>0?'&':'')+'_method='+this.options.method;this.options.method='post';}
|
71
|
+
try{this.url=url;if(this.options.method=='get'&¶meters.length>0)
|
72
|
+
this.url+=(this.url.match(/\?/)?'&':'?')+parameters;Ajax.Responders.dispatch('onCreate',this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous)
|
73
|
+
setTimeout(function(){this.respondToReadyState(1)}.bind(this),10);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();var body=this.options.postBody?this.options.postBody:parameters;this.transport.send(this.options.method=='post'?body:null);if(!this.options.asynchronous&&this.transport.overrideMimeType)
|
74
|
+
this.onStateChange();}catch(e){this.dispatchException(e);}},setRequestHeaders:function(){var requestHeaders=['X-Requested-With','XMLHttpRequest','X-Prototype-Version',Prototype.Version,'Accept','text/javascript, text/html, application/xml, text/xml, */*'];if(this.options.method=='post'){requestHeaders.push('Content-type',this.options.contentType);if(this.transport.overrideMimeType)
|
75
|
+
requestHeaders.push('Connection','close');}
|
76
|
+
if(this.options.requestHeaders)
|
77
|
+
requestHeaders.push.apply(requestHeaders,this.options.requestHeaders);for(var i=0;i<requestHeaders.length;i+=2)
|
78
|
+
this.transport.setRequestHeader(requestHeaders[i],requestHeaders[i+1]);},onStateChange:function(){var readyState=this.transport.readyState;if(readyState!=1)
|
79
|
+
this.respondToReadyState(this.transport.readyState);},header:function(name){try{return this.transport.getResponseHeader(name);}catch(e){}},evalJSON:function(){try{return eval('('+this.header('X-JSON')+')');}catch(e){}},evalResponse:function(){try{return eval(this.transport.responseText);}catch(e){this.dispatchException(e);}},respondToReadyState:function(readyState){var event=Ajax.Request.Events[readyState];var transport=this.transport,json=this.evalJSON();if(event=='Complete'){try{(this.options['on'+this.transport.status]||this.options['on'+(this.responseIsSuccess()?'Success':'Failure')]||Prototype.emptyFunction)(transport,json);}catch(e){this.dispatchException(e);}
|
80
|
+
if((this.header('Content-type')||'').match(/^text\/javascript/i))
|
81
|
+
this.evalResponse();}
|
82
|
+
try{(this.options['on'+event]||Prototype.emptyFunction)(transport,json);Ajax.Responders.dispatch('on'+event,this,transport,json);}catch(e){this.dispatchException(e);}
|
83
|
+
if(event=='Complete')
|
84
|
+
this.transport.onreadystatechange=Prototype.emptyFunction;},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(container,url,options){this.containers={success:container.success?$(container.success):$(container),failure:container.failure?$(container.failure):(container.success?null:$(container))}
|
85
|
+
this.transport=Ajax.getTransport();this.setOptions(options);var onComplete=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(transport,object){this.updateContent();onComplete(transport,object);}).bind(this);this.request(url);},updateContent:function(){var receiver=this.responseIsSuccess()?this.containers.success:this.containers.failure;var response=this.transport.responseText;if(!this.options.evalScripts)
|
86
|
+
response=response.stripScripts();if(receiver){if(this.options.insertion){new this.options.insertion(receiver,response);}else{Element.update(receiver,response);}}
|
87
|
+
if(this.responseIsSuccess()){if(this.onComplete)
|
88
|
+
setTimeout(this.onComplete.bind(this),10);}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(container,url,options){this.setOptions(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(request){if(this.options.decay){this.decay=(request.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=request.responseText;}
|
89
|
+
this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $()
|
90
|
+
{var args=arguments;if(args.length==1)
|
91
|
+
{var element=args[0];if(element==window)
|
92
|
+
{return window;}
|
93
|
+
else if(element==document.body)
|
94
|
+
{return document.body;}
|
95
|
+
if(typeof element=='string')
|
96
|
+
{return Element.extend(document.getElementById(element));}
|
97
|
+
return element;}
|
98
|
+
var results=[],element;for(var i=0,len=args.length;i<len;i++){element=arguments[i];if(typeof element=='string')
|
99
|
+
element=document.getElementById(element);results.push(Element.extend(element));}
|
100
|
+
return results.reduce();}
|
101
|
+
document.getElementsByClassName=function(className,parentElement){var children=($(parentElement)||document.body).getElementsByTagName('*');return $A(children).inject([],function(elements,child){if(child.className.match(new RegExp("(^|\\s)"+className+"(\\s|$)")))
|
102
|
+
elements.push(Element.extend(child));return elements;});}
|
103
|
+
if(!window.Element)
|
104
|
+
var Element=new Object();Element.extend=function(element){if(!element)return;if(_nativeExtensions||element.nodeType==3)return element;if(!element._extended&&element.tagName&&element!=window){var methods=Object.clone(Element.Methods),cache=Element.extend.cache;if(element.tagName=='FORM')
|
105
|
+
Object.extend(methods,Form.Methods);if(['INPUT','TEXTAREA','SELECT'].include(element.tagName))
|
106
|
+
Object.extend(methods,Form.Element.Methods);for(var property in methods){var value=methods[property];if(typeof value=='function')
|
107
|
+
element[property]=cache.findOrStore(value);}}
|
108
|
+
element._extended=true;return element;}
|
109
|
+
Element.extend.cache={findOrStore:function(value){return this[value]=this[value]||function(){return value.apply(null,[this].concat($A(arguments)));}}}
|
110
|
+
Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){$(element).style.display='none';return element;},show:function(element){$(element).style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:function(element,html){$(element).innerHTML=html.stripScripts();setTimeout(function(){html.evalScripts()},10);return element;},replace:function(element,html){element=$(element);if(element.outerHTML){element.outerHTML=html.stripScripts();}else{var range=element.ownerDocument.createRange();range.selectNodeContents(element);element.parentNode.replaceChild(range.createContextualFragment(html.stripScripts()),element);}
|
111
|
+
setTimeout(function(){html.evalScripts()},10);return element;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])
|
112
|
+
if(element.nodeType==1)
|
113
|
+
elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){element=$(element);return $A(element.getElementsByTagName('*'));},previousSiblings:function(element){return $(element).recursivelyCollect('previousSibling');},nextSiblings:function(element){return $(element).recursivelyCollect('nextSibling');},siblings:function(element){element=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){element=$(element);if(typeof selector=='string')
|
114
|
+
selector=new Selector(selector);return selector.match(element);},up:function(element,expression,index){return Selector.findElement($(element).ancestors(),expression,index);},down:function(element,expression,index){return Selector.findElement($(element).descendants(),expression,index);},previous:function(element,expression,index){return Selector.findElement($(element).previousSiblings(),expression,index);},next:function(element,expression,index){return Selector.findElement($(element).nextSiblings(),expression,index);},getElementsBySelector:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},getElementsByClassName:function(element,className){element=$(element);return document.getElementsByClassName(className,element);},getHeight:function(element){element=$(element);return element.offsetHeight;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).include(className);},addClassName:function(element,className){if(!(element=$(element)))return;Element.classNames(element).add(className);return element;},removeClassName:function(element,className){if(!(element=$(element)))return;Element.classNames(element).remove(className);return element;},observe:function(){Event.observe.apply(Event,arguments);return $A(arguments).first();},stopObserving:function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first();},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
|
115
|
+
element.removeChild(node);node=nextNode;}
|
116
|
+
return element;},empty:function(element){return $(element).innerHTML.match(/^\s*$/);},childOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);while(element=element.parentNode)
|
117
|
+
if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var x=element.x?element.x:element.offsetLeft,y=element.y?element.y:element.offsetTop;window.scrollTo(x,y);return element;},getStyle:function(element,style){element=$(element);var value=element.style[style.camelize()];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(style):null;}else if(element.currentStyle){value=element.currentStyle[style.camelize()];}}
|
118
|
+
if(window.opera&&['left','top','right','bottom'].include(style))
|
119
|
+
if(Element.getStyle(element,'position')=='static')value='auto';return value=='auto'?null:value;},setStyle:function(element,style){element=$(element);for(var name in style)
|
120
|
+
element.style[name.camelize()]=style[name];return element;},getDimensions:function(element){element=$(element);if(Element.getStyle(element,'display')!='none')
|
121
|
+
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;els.visibility='hidden';els.position='absolute';els.display='';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display='none';els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(window.opera){element.style.top=0;element.style.left=0;}}
|
122
|
+
return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}
|
123
|
+
return element;},makeClipping:function(element){element=$(element);if(element._overflow)return;element._overflow=element.style.overflow||'auto';if((Element.getStyle(element,'overflow')||'visible')!='hidden')
|
124
|
+
element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return;element.style.overflow=element._overflow=='auto'?'':element._overflow;delete element._overflow;return element;}}
|
125
|
+
if(document.all){Element.Methods.update=function(element,html){element=$(element);html=typeof html=='undefined'?'':html.toString();var tagName=element.tagName.toUpperCase();if(['THEAD','TBODY','TR','TD'].indexOf(tagName)>-1){var div=document.createElement('div');switch(tagName){case'THEAD':case'TBODY':div.innerHTML='<table><tbody>'+html.stripScripts()+'</tbody></table>';depth=2;break;case'TR':div.innerHTML='<table><tbody><tr>'+html.stripScripts()+'</tr></tbody></table>';depth=3;break;case'TD':div.innerHTML='<table><tbody><tr><td>'+html.stripScripts()+'</td></tr></tbody></table>';depth=4;}
|
126
|
+
$A(element.childNodes).each(function(node){element.removeChild(node)});depth.times(function(){div=div.firstChild});$A(div.childNodes).each(function(node){element.appendChild(node)});}else{element.innerHTML=html.stripScripts();}
|
127
|
+
setTimeout(function(){html.evalScripts()},10);return element;}}
|
128
|
+
Object.extend(Element,Element.Methods);var _nativeExtensions=false;if(!window.HTMLElement&&/Konqueror|Safari|KHTML/.test(navigator.userAgent)){['','Form','Input','TextArea','Select'].each(function(tag){var klass=window['HTML'+tag+'Element']={};klass.prototype=document.createElement(tag?tag.toLowerCase():'div').__proto__;});}
|
129
|
+
Element.addMethods=function(methods){Object.extend(Element.Methods,methods||{});function copy(methods,destination){var cache=Element.extend.cache;for(var property in methods){var value=methods[property];destination[property]=cache.findOrStore(value);}}
|
130
|
+
if(typeof HTMLElement!='undefined'){copy(Element.Methods,HTMLElement.prototype);copy(Form.Methods,HTMLFormElement.prototype);[HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement].each(function(klass){copy(Form.Element.Methods,klass.prototype);});_nativeExtensions=true;}}
|
131
|
+
var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(adjacency){this.adjacency=adjacency;}
|
132
|
+
Abstract.Insertion.prototype={initialize:function(element,content){this.element=$(element);this.content=content.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content);}catch(e){var tagName=this.element.tagName.toLowerCase();if(tagName=='tbody'||tagName=='tr'){this.insertContent(this.contentFromAnonymousTable());}else{throw e;}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange)this.initializeRange();this.insertContent([this.range.createContextualFragment(this.content)]);}
|
133
|
+
setTimeout(function(){content.evalScripts()},10);},contentFromAnonymousTable:function(){var div=document.createElement('div');div.innerHTML='<table><tbody>'+this.content+'</tbody></table>';return $A(div.childNodes[0].childNodes[0].childNodes);}}
|
134
|
+
var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion('beforeBegin'),{initializeRange:function(){this.range.setStartBefore(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element);}).bind(this));}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion('afterBegin'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true);},insertContent:function(fragments){fragments.reverse(false).each((function(fragment){this.element.insertBefore(fragment,this.element.firstChild);}).bind(this));}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion('beforeEnd'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.appendChild(fragment);}).bind(this));}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion('afterEnd'),{initializeRange:function(){this.range.setStartAfter(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element.nextSibling);}).bind(this));}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set(this.toArray().concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set(this.select(function(className){return className!=classNameToRemove;}).join(' '));},toString:function(){return this.toArray().join(' ');}}
|
135
|
+
Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(expression){this.params={classNames:[]};this.expression=expression.toString().strip();this.parseExpression();this.compileMatcher();},parseExpression:function(){function abort(message){throw'Parse error in selector: '+message;}
|
136
|
+
if(this.expression=='')abort('empty expression');var params=this.params,expr=this.expression,match,modifier,clause,rest;while(match=expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){params.attributes=params.attributes||[];params.attributes.push({name:match[2],operator:match[3],value:match[4]||match[5]||''});expr=match[1];}
|
137
|
+
if(expr=='*')return this.params.wildcard=true;while(match=expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)){modifier=match[1],clause=match[2],rest=match[3];switch(modifier){case'#':params.id=clause;break;case'.':params.classNames.push(clause);break;case'':case undefined:params.tagName=clause.toUpperCase();break;default:abort(expr.inspect());}
|
138
|
+
expr=rest;}
|
139
|
+
if(expr.length>0)abort(expr.inspect());},buildMatchExpression:function(){var params=this.params,conditions=[],clause;if(params.wildcard)
|
140
|
+
conditions.push('true');if(clause=params.id)
|
141
|
+
conditions.push('element.id == '+clause.inspect());if(clause=params.tagName)
|
142
|
+
conditions.push('element.tagName.toUpperCase() == '+clause.inspect());if((clause=params.classNames).length>0)
|
143
|
+
for(var i=0;i<clause.length;i++)
|
144
|
+
conditions.push('Element.hasClassName(element, '+clause[i].inspect()+')');if(clause=params.attributes){clause.each(function(attribute){var value='element.getAttribute('+attribute.name.inspect()+')';var splitValueBy=function(delimiter){return value+' && '+value+'.split('+delimiter.inspect()+')';}
|
145
|
+
switch(attribute.operator){case'=':conditions.push(value+' == '+attribute.value.inspect());break;case'~=':conditions.push(splitValueBy(' ')+'.include('+attribute.value.inspect()+')');break;case'|=':conditions.push(splitValueBy('-')+'.first().toUpperCase() == '+attribute.value.toUpperCase().inspect());break;case'!=':conditions.push(value+' != '+attribute.value.inspect());break;case'':case undefined:conditions.push(value+' != null');break;default:throw'Unknown operator '+attribute.operator+' in selector';}});}
|
146
|
+
return conditions.join(' && ');},compileMatcher:function(){this.match=new Function('element','if (!element.tagName) return false; \
|
147
|
+
return '+this.buildMatchExpression());},findElements:function(scope){var element;if(element=$(this.params.id))
|
148
|
+
if(this.match(element))
|
149
|
+
if(!scope||Element.childOf(element,scope))
|
150
|
+
return[element];scope=(scope||document).getElementsByTagName(this.params.tagName||'*');var results=[];for(var i=0;i<scope.length;i++)
|
151
|
+
if(this.match(element=scope[i]))
|
152
|
+
results.push(Element.extend(element));return results;},toString:function(){return this.expression;}}
|
153
|
+
Object.extend(Selector,{matchElements:function(elements,expression){var selector=new Selector(expression);return elements.select(selector.match.bind(selector)).collect(Element.extend);},findElement:function(elements,expression,index){if(typeof expression=='number')index=expression,expression=false;return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){return expressions.map(function(expression){return expression.strip().split(/\s+/).inject([null],function(results,expr){var selector=new Selector(expr);return results.inject([],function(elements,result){return elements.concat(selector.findElements(result||element));});});}).flatten();}});function $$(){return Selector.findChildElements(document,$A(arguments));}
|
154
|
+
var Form={reset:function(form){$(form).reset();return form;}};Form.Methods={serialize:function(form){var elements=Form.getElements($(form));var queryComponents=new Array();for(var i=0;i<elements.length;i++){var queryComponent=Form.Element.serialize(elements[i]);if(queryComponent)
|
155
|
+
queryComponents.push(queryComponent);}
|
156
|
+
return queryComponents.join('&');},getElements:function(form){form=$(form);var elements=new Array();for(var tagName in Form.Element.Serializers){var tagElements=form.getElementsByTagName(tagName);for(var j=0;j<tagElements.length;j++)
|
157
|
+
elements.push(tagElements[j]);}
|
158
|
+
return elements;},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)
|
159
|
+
return inputs;var matchingInputs=new Array();for(var i=0;i<inputs.length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
|
160
|
+
continue;matchingInputs.push(input);}
|
161
|
+
return matchingInputs;},disable:function(form){form=$(form);var elements=Form.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.blur();element.disabled='true';}
|
162
|
+
return form;},enable:function(form){form=$(form);var elements=Form.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.disabled='';}
|
163
|
+
return form;},findFirstElement:function(form){return Form.getElements(form).find(function(element){return element.type!='hidden'&&!element.disabled&&['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);Field.activate(Form.findFirstElement(form));return form;}}
|
164
|
+
Object.extend(Form,Form.Methods);Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}}
|
165
|
+
Form.Element.Methods={serialize:function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter){var key=encodeURIComponent(parameter[0]);if(key.length==0)return;if(parameter[1].constructor!=Array)
|
166
|
+
parameter[1]=[parameter[1]];return parameter[1].map(function(value){return key+'='+encodeURIComponent(value);}).join('&');}},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter)
|
167
|
+
return parameter[1];},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);element.focus();if(element.select)
|
168
|
+
element.select();return element;},disable:function(element){element=$(element);element.disabled='';return element;},enable:function(element){element=$(element);element.blur();element.disabled='true';return element;}}
|
169
|
+
Object.extend(Form.Element,Form.Element.Methods);var Field=Form.Element;Form.Element.Serializers={input:function(element){switch(element.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element);default:return Form.Element.Serializers.textarea(element);}
|
170
|
+
return false;},inputSelector:function(element){if(element.checked)
|
171
|
+
return[element.name,element.value];},textarea:function(element){return[element.name,element.value];},select:function(element){return Form.Element.Serializers[element.type=='select-one'?'selectOne':'selectMany'](element);},selectOne:function(element){var value='',opt,index=element.selectedIndex;if(index>=0){opt=element.options[index];value=opt.value||opt.text;}
|
172
|
+
return[element.name,value];},selectMany:function(element){var value=[];for(var i=0;i<element.length;i++){var opt=element.options[i];if(opt.selected)
|
173
|
+
value.push(opt.value||opt.text);}
|
174
|
+
return[element.name,value];}}
|
175
|
+
var $F=Form.Element.getValue;Abstract.TimedObserver=function(){}
|
176
|
+
Abstract.TimedObserver.prototype={initialize:function(element,frequency,callback){this.frequency=frequency;this.element=$(element);this.callback=callback;this.lastValue=this.getValue();this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}}}
|
177
|
+
Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=function(){}
|
178
|
+
Abstract.EventObserver.prototype={initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
|
179
|
+
this.registerFormCallbacks();else
|
180
|
+
this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){var elements=Form.getElements(this.element);for(var i=0;i<elements.length;i++)
|
181
|
+
this.registerCallback(elements[i]);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;default:Event.observe(element,'change',this.onElementEvent.bind(this));break;}}}}
|
182
|
+
Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element);}});if(!window.Event){var Event=new Object();}
|
183
|
+
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},pointerX:function(event){return event.pageX||(event.clientX+
|
184
|
+
(document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(event){return event.pageY||(event.clientY+
|
185
|
+
(document.documentElement.scrollTop||document.body.scrollTop));},stop:function(event){if(event)
|
186
|
+
{if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;}}},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))
|
187
|
+
element=element.parentNode;return element;},observers:false,_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer);}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null;}
|
188
|
+
Event.observers=false;},observe:function(element,name,observer,useCapture){element=$(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))
|
189
|
+
name='keydown';Event._observeAndCache(element,name,observer,useCapture);},stopObserving:function(element,name,observer,useCapture){element=typeof element=='string'?$(element):element;useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))
|
190
|
+
name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element.detachEvent){try{element.detachEvent('on'+name,observer);}catch(e){}}}});if(navigator.appVersion.match(/\bMSIE\b/))
|
191
|
+
Event.observe(window,'unload',Event.unloadCache,false);var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},realOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return[valueL,valueT];},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return[valueL,valueT];},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName=='BODY')break;var p=Element.getStyle(element,'position');if(p=='relative'||p=='absolute')break;}}while(element);return[valueL,valueT];},offsetParent:function(element){if(element.offsetParent)return element.offsetParent;if(element==document.body)return element;while((element=element.parentNode)&&element!=document.body)
|
192
|
+
if(Element.getStyle(element,'position')!='static')
|
193
|
+
return element;return document.body;},within:function(element,x,y){if(this.includeScrollOffsets)
|
194
|
+
return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=this.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=this.realOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=this.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
|
195
|
+
return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
|
196
|
+
return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},page:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
|
197
|
+
if(Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!window.opera||element.tagName=='BODY'){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return[valueL,valueT];},clone:function(source,target){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{})
|
198
|
+
source=$(source);var p=Position.page(source);target=$(target);var delta=[0,0];var parent=null;if(Element.getStyle(target,'position')=='absolute'){parent=Position.offsetParent(target);delta=Position.page(parent);}
|
199
|
+
if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
|
200
|
+
if(options.setLeft)target.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)target.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)target.style.width=source.offsetWidth+'px';if(options.setHeight)target.style.height=source.offsetHeight+'px';},absolutize:function(element){element=$(element);if(element.style.position=='absolute')return;Position.prepare();var offsets=Position.positionedOffset(element);var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';;element.style.left=left+'px';;element.style.width=width+'px';;element.style.height=height+'px';;},relativize:function(element){element=$(element);if(element.style.position=='relative')return;Position.prepare();element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;}}
|
201
|
+
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
|
202
|
+
if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return[valueL,valueT];}}
|
203
|
+
Element.addMethods();var Scriptaculous={Version:'1.5.1',require:function(libraryName){document.write('<script type="text/javascript" src="'+libraryName+'"></script>');},load:function(){if((typeof Prototype=='undefined')||parseFloat(Prototype.Version.split(".")[0]+"."+
|
204
|
+
Prototype.Version.split(".")[1])<1.4)
|
205
|
+
throw("script.aculo.us requires the Prototype JavaScript framework >= 1.4.0");$A(document.getElementsByTagName("script")).findAll(function(s){return(s.src&&s.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(s){var path=s.src.replace(/scriptaculous\.js(\?.*)?$/,'');var includes=s.src.match(/\?.*load=([a-z,]*)/);(includes?includes[1]:'builder,effects,controls').split(',').each(function(include){Scriptaculous.require(path+include+'.js')});});}}
|
206
|
+
Scriptaculous.load();var Builder={NODEMAP:{AREA:'map',CAPTION:'table',COL:'table',COLGROUP:'table',LEGEND:'fieldset',OPTGROUP:'select',OPTION:'select',PARAM:'object',TBODY:'table',TD:'table',TFOOT:'table',TH:'table',THEAD:'table',TR:'table'},node:function(elementName){elementName=elementName.toUpperCase();var parentTag=this.NODEMAP[elementName]||'div';var parentElement=document.createElement(parentTag);try{parentElement.innerHTML="<"+elementName+"></"+elementName+">";}catch(e){}
|
207
|
+
var element=parentElement.firstChild||null;if(element&&(element.tagName!=elementName))
|
208
|
+
element=element.getElementsByTagName(elementName)[0];if(!element)element=document.createElement(elementName);if(!element)return;if(arguments[1])
|
209
|
+
if(this._isStringOrNumber(arguments[1])||(arguments[1]instanceof Array)){this._children(element,arguments[1]);}else{var attrs=this._attributes(arguments[1]);if(attrs.length){try{parentElement.innerHTML="<"+elementName+" "+
|
210
|
+
attrs+"></"+elementName+">";}catch(e){}
|
211
|
+
element=parentElement.firstChild||null;if(!element){element=document.createElement(elementName);for(attr in arguments[1])
|
212
|
+
element[attr=='class'?'className':attr]=arguments[1][attr];}
|
213
|
+
if(element.tagName!=elementName)
|
214
|
+
element=parentElement.getElementsByTagName(elementName)[0];}}
|
215
|
+
if(arguments[2])
|
216
|
+
this._children(element,arguments[2]);return element;},_text:function(text){return document.createTextNode(text);},_attributes:function(attributes){var attrs=[];for(attribute in attributes)
|
217
|
+
attrs.push((attribute=='className'?'class':attribute)+'="'+attributes[attribute].toString().escapeHTML()+'"');return attrs.join(" ");},_children:function(element,children){if(typeof children=='object'){children.flatten().each(function(e){if(typeof e=='object')
|
218
|
+
element.appendChild(e)
|
219
|
+
else
|
220
|
+
if(Builder._isStringOrNumber(e))
|
221
|
+
element.appendChild(Builder._text(e));});}else
|
222
|
+
if(Builder._isStringOrNumber(children))
|
223
|
+
element.appendChild(Builder._text(children));},_isStringOrNumber:function(param){return(typeof param=='string'||typeof param=='number');}}
|
224
|
+
String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
|
225
|
+
return(color.length==7?color:(arguments[0]||this));}
|
226
|
+
Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');}
|
227
|
+
Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodes(node):''));}).flatten().join('');}
|
228
|
+
Element.setStyle=function(element,style){element=$(element);for(k in style)element.style[k.camelize()]=style[k];}
|
229
|
+
Element.setContentZoom=function(element,percent){Element.setStyle(element,{fontSize:(percent/100)+'em'});if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);}
|
230
|
+
Element.getOpacity=function(element){var opacity;if(opacity=Element.getStyle(element,'opacity'))
|
231
|
+
return parseFloat(opacity);if(opacity=(Element.getStyle(element,'filter')||'').match(/alpha\(opacity=(.*)\)/))
|
232
|
+
if(opacity[1])return parseFloat(opacity[1])/100;return 1.0;}
|
233
|
+
Element.setOpacity=function(element,value){element=$(element);if(value==1){Element.setStyle(element,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null});if(/MSIE/.test(navigator.userAgent))
|
234
|
+
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});}else{if(value<0.00001)value=0;Element.setStyle(element,{opacity:value});if(/MSIE/.test(navigator.userAgent))
|
235
|
+
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')+'alpha(opacity='+value*100+')'});}}
|
236
|
+
Element.getInlineOpacity=function(element){return $(element).style.opacity||'';}
|
237
|
+
Element.childrenWithClassName=function(element,className){return $A($(element).getElementsByTagName('*')).select(function(c){return Element.hasClassName(c,className)});}
|
238
|
+
Array.prototype.call=function(){var args=arguments;this.each(function(f){f.apply(this,args)});}
|
239
|
+
var Effect={tagifyText:function(element){var tagifyStyle='position:relative';if(/MSIE/.test(navigator.userAgent))tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(Builder.node('span',{style:tagifyStyle},character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||(typeof element=='function'))&&(element.length))
|
240
|
+
elements=element;else
|
241
|
+
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global')}},arguments[2]||{});Effect[Element.visible(element)?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};var Effect2=Effect;Effect.Transitions={}
|
242
|
+
Effect.Transitions.linear=function(pos){return pos;}
|
243
|
+
Effect.Transitions.sinoidal=function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5;}
|
244
|
+
Effect.Transitions.reverse=function(pos){return 1-pos;}
|
245
|
+
Effect.Transitions.flicker=function(pos){return((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;}
|
246
|
+
Effect.Transitions.wobble=function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;}
|
247
|
+
Effect.Transitions.pulse=function(pos){return(Math.floor(pos*10)%2==0?(pos*10-Math.floor(pos*10)):1-(pos*10-Math.floor(pos*10)));}
|
248
|
+
Effect.Transitions.none=function(pos){return 0;}
|
249
|
+
Effect.Transitions.full=function(pos){return 1;}
|
250
|
+
Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=(typeof effect.options.queue=='string')?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
|
251
|
+
effect.startOn+=timestamp;effect.finishOn+=timestamp;this.effects.push(effect);if(!this.interval)
|
252
|
+
this.interval=setInterval(this.loop.bind(this),40);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();this.effects.invoke('loop',timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(typeof queueName!='string')return queueName;if(!this.instances[queueName])
|
253
|
+
this.instances[queueName]=new Effect.ScopedQueue();return this.instances[queueName];}}
|
254
|
+
Effect.Queue=Effect.Queues.get('global');Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1.0,fps:25.0,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'}
|
255
|
+
Effect.Base=function(){};Effect.Base.prototype={position:null,start:function(options){this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.event('beforeStart');if(!this.options.sync)
|
256
|
+
Effect.Queues.get(typeof this.options.queue=='string'?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
|
257
|
+
var pos=(timePos-this.startOn)/(this.finishOn-this.startOn);var frame=Math.round(pos*this.options.fps*this.options.duration);if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},render:function(pos){if(this.state=='idle'){this.state='running';this.event('beforeSetup');if(this.setup)this.setup();this.event('afterSetup');}
|
258
|
+
if(this.state=='running'){if(this.options.transition)pos=this.options.transition(pos);pos*=(this.options.to-this.options.from);pos+=this.options.from;this.position=pos;this.event('beforeUpdate');if(this.update)this.update(pos);this.event('afterUpdate');}},cancel:function(){if(!this.options.sync)
|
259
|
+
Effect.Queues.get(typeof this.options.queue=='string'?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){return'#<Effect:'+$H(this).inspect()+',options:'+$H(this.options).inspect()+'>';}}
|
260
|
+
Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout))
|
261
|
+
Element.setStyle(this.element,{zoom:1});var options=Object.extend({from:Element.getOpacity(this.element)||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){Element.setOpacity(this.element,position);}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){Element.makePositioned(this.element);this.originalLeft=parseFloat(Element.getStyle(this.element,'left')||'0');this.originalTop=parseFloat(Element.getStyle(this.element,'top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){Element.setStyle(this.element,{left:this.options.x*position+this.originalLeft+'px',top:this.options.y*position+this.originalTop+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(element,percent){this.element=$(element)
|
262
|
+
var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=Element.getStyle(this.element,'position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=Element.getStyle(this.element,'font-size')||'100%';['em','px','%'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
|
263
|
+
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
|
264
|
+
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
|
265
|
+
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
|
266
|
+
Element.setStyle(this.element,{fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)Element.setStyle(this.element,this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width+'px';if(this.options.scaleY)d.height=height+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
|
267
|
+
Element.setStyle(this.element,d);}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(Element.getStyle(this.element,'display')=='none'){this.cancel();return;}
|
268
|
+
this.oldStyle={backgroundImage:Element.getStyle(this.element,'background-image')};Element.setStyle(this.element,{backgroundImage:'none'});if(!this.options.endcolor)
|
269
|
+
this.options.endcolor=Element.getStyle(this.element,'background-color').parseColor('#ffffff');if(!this.options.restorecolor)
|
270
|
+
this.options.restorecolor=Element.getStyle(this.element,'background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){Element.setStyle(this.element,{backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart());}.bind(this))});},finish:function(){Element.setStyle(this.element,Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);this.start(arguments[1]||{});},setup:function(){Position.prepare();var offsets=Position.cumulativeOffset(this.element);if(this.options.offset)offsets[1]+=this.options.offset;var max=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-
|
271
|
+
(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(offsets[1]>max?max:offsets[1])-this.scrollStart;},update:function(position){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(position*this.delta));}});Effect.Fade=function(element){var oldOpacity=Element.getInlineOpacity(element);var options=Object.extend({from:Element.getOpacity(element)||1.0,to:0.0,afterFinishInternal:function(effect){with(Element){if(effect.options.to!=0)return;hide(effect.element);setStyle(effect.element,{opacity:oldOpacity});}}},arguments[1]||{});return new Effect.Opacity(element,options);}
|
272
|
+
Effect.Appear=function(element){var options=Object.extend({from:(Element.getStyle(element,'display')=='none'?0.0:Element.getOpacity(element)||0.0),to:1.0,beforeSetup:function(effect){with(Element){setOpacity(effect.element,effect.options.from);show(effect.element);}}},arguments[1]||{});return new Effect.Opacity(element,options);}
|
273
|
+
Effect.Puff=function(element){element=$(element);var oldStyle={opacity:Element.getInlineOpacity(element),position:Element.getStyle(element,'position')};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){with(Element){setStyle(effect.effects[0].element,{position:'absolute'});}},afterFinishInternal:function(effect){with(Element){hide(effect.effects[0].element);setStyle(effect.effects[0].element,oldStyle);}}},arguments[1]||{}));}
|
274
|
+
Effect.BlindUp=function(element){element=$(element);Element.makeClipping(element);return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){with(Element){[hide,undoClipping].call(effect.element);}}},arguments[1]||{}));}
|
275
|
+
Effect.BlindDown=function(element){element=$(element);var oldHeight=Element.getStyle(element,'height');var elementDimensions=Element.getDimensions(element);return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){with(Element){makeClipping(effect.element);setStyle(effect.element,{height:'0px'});show(effect.element);}},afterFinishInternal:function(effect){with(Element){undoClipping(effect.element);setStyle(effect.element,{height:oldHeight});}}},arguments[1]||{}));}
|
276
|
+
Effect.SwitchOff=function(element){element=$(element);var oldOpacity=Element.getInlineOpacity(element);return new Effect.Appear(element,{duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){with(Element){[makePositioned,makeClipping].call(effect.element);}},afterFinishInternal:function(effect){with(Element){[hide,undoClipping,undoPositioned].call(effect.element);setStyle(effect.element,{opacity:oldOpacity});}}})}});}
|
277
|
+
Effect.DropOut=function(element){element=$(element);var oldStyle={top:Element.getStyle(element,'top'),left:Element.getStyle(element,'left'),opacity:Element.getInlineOpacity(element)};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){with(Element){makePositioned(effect.effects[0].element);}},afterFinishInternal:function(effect){with(Element){[hide,undoPositioned].call(effect.effects[0].element);setStyle(effect.effects[0].element,oldStyle);}}},arguments[1]||{}));}
|
278
|
+
Effect.Shake=function(element){element=$(element);var oldStyle={top:Element.getStyle(element,'top'),left:Element.getStyle(element,'left')};return new Effect.Move(element,{x:20,y:0,duration:0.05,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(effect){with(Element){undoPositioned(effect.element);setStyle(effect.element,oldStyle);}}})}})}})}})}})}});}
|
279
|
+
Effect.SlideDown=function(element){element=$(element);Element.cleanWhitespace(element);var oldInnerBottom=Element.getStyle(element.firstChild,'bottom');var elementDimensions=Element.getDimensions(element);return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){with(Element){makePositioned(effect.element);makePositioned(effect.element.firstChild);if(window.opera)setStyle(effect.element,{top:''});makeClipping(effect.element);setStyle(effect.element,{height:'0px'});show(element);}},afterUpdateInternal:function(effect){with(Element){setStyle(effect.element.firstChild,{bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});}},afterFinishInternal:function(effect){with(Element){undoClipping(effect.element);undoPositioned(effect.element.firstChild);undoPositioned(effect.element);setStyle(effect.element.firstChild,{bottom:oldInnerBottom});}}},arguments[1]||{}));}
|
280
|
+
Effect.SlideUp=function(element){element=$(element);Element.cleanWhitespace(element);var oldInnerBottom=Element.getStyle(element.firstChild,'bottom');return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(effect){with(Element){makePositioned(effect.element);makePositioned(effect.element.firstChild);if(window.opera)setStyle(effect.element,{top:''});makeClipping(effect.element);show(element);}},afterUpdateInternal:function(effect){with(Element){setStyle(effect.element.firstChild,{bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});}},afterFinishInternal:function(effect){with(Element){[hide,undoClipping].call(effect.element);undoPositioned(effect.element.firstChild);undoPositioned(effect.element);setStyle(effect.element.firstChild,{bottom:oldInnerBottom});}}},arguments[1]||{}));}
|
281
|
+
Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){with(Element){makeClipping(effect.element);}},afterFinishInternal:function(effect){with(Element){hide(effect.element);undoClipping(effect.element);}}});}
|
282
|
+
Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:Element.getInlineOpacity(element)};var dims=Element.getDimensions(element);var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
|
283
|
+
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){with(Element){hide(effect.element);makeClipping(effect.element);makePositioned(effect.element);}},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){with(Element){setStyle(effect.effects[0].element,{height:'0px'});show(effect.effects[0].element);}},afterFinishInternal:function(effect){with(Element){[undoClipping,undoPositioned].call(effect.effects[0].element);setStyle(effect.effects[0].element,oldStyle);}}},options))}});}
|
284
|
+
Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransistion:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:Element.getInlineOpacity(element)};var dims=Element.getDimensions(element);var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
|
285
|
+
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){with(Element){[makePositioned,makeClipping].call(effect.effects[0].element)}},afterFinishInternal:function(effect){with(Element){[hide,undoClipping,undoPositioned].call(effect.effects[0].element);setStyle(effect.effects[0].element,oldStyle);}}},options));}
|
286
|
+
Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=Element.getInlineOpacity(element);var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:3.0,from:0,afterFinishInternal:function(effect){Element.setStyle(effect.element,{opacity:oldOpacity});}},options),{transition:reverser}));}
|
287
|
+
Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};Element.makeClipping(element);return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){with(Element){[hide,undoClipping].call(effect.element);setStyle(effect.element,oldStyle);}}});}},arguments[1]||{}));}
|
288
|
+
var Autocompleter={}
|
289
|
+
Autocompleter.Base=function(){};Autocompleter.Base.prototype={baseInitialize:function(element,update,options){this.element=$(element);this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;if(this.setOptions)
|
290
|
+
this.setOptions(options);else
|
291
|
+
this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
|
292
|
+
Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')
|
293
|
+
this.options.tokens=new Array(this.options.tokens);this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(navigator.appVersion.indexOf('MSIE')>0)&&(navigator.userAgent.indexOf('Opera')<0)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');}
|
294
|
+
if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){Position.clone(this.update,this.iefix);this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator);},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator);},onKeyPress:function(event){if(this.active)
|
295
|
+
switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);return;}
|
296
|
+
else
|
297
|
+
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN)
|
298
|
+
return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
|
299
|
+
{this.index=element.autocompleteIndex;this.render();}
|
300
|
+
Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
|
301
|
+
this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0)this.index--
|
302
|
+
else this.index=this.entryCount-1;},markNext:function(){if(this.index<this.entryCount-1)this.index++
|
303
|
+
else this.index=0;},getEntry:function(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
|
304
|
+
var value='';if(this.options.select){var nodes=document.getElementsByClassName(this.options.select,selectedElement)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
|
305
|
+
value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var lastTokenPos=this.findLastToken();if(lastTokenPos!=-1){var newValue=this.element.value.substr(0,lastTokenPos+1);var whitespace=this.element.value.substr(lastTokenPos+1).match(/^\s+/);if(whitespace)
|
306
|
+
newValue+=whitespace[0];this.element.value=newValue+value;}else{this.element.value=value;}
|
307
|
+
this.element.focus();if(this.options.afterUpdateElement)
|
308
|
+
this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.firstChild);if(this.update.firstChild&&this.update.firstChild.childNodes){this.entryCount=this.update.firstChild.childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;}
|
309
|
+
this.stopIndicator();this.index=0;this.render();}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.startIndicator();this.getUpdatedChoices();}else{this.active=false;this.hide();}},getToken:function(){var tokenPos=this.findLastToken();if(tokenPos!=-1)
|
310
|
+
var ret=this.element.value.substr(tokenPos+1).replace(/^\s+/,'').replace(/\s+$/,'');else
|
311
|
+
var ret=this.element.value;return/\n/.test(ret)?'':ret;},findLastToken:function(){var lastTokenPos=-1;for(var i=0;i<this.options.tokens.length;i++){var thisTokenPos=this.element.value.lastIndexOf(this.options.tokens[i]);if(thisTokenPos>lastTokenPos)
|
312
|
+
lastTokenPos=thisTokenPos;}
|
313
|
+
return lastTokenPos;}}
|
314
|
+
Ajax.Autocompleter=Class.create();Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){entry=encodeURIComponent(this.options.paramName)+'='+
|
315
|
+
encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
|
316
|
+
this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create();Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
|
317
|
+
elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
|
318
|
+
elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
|
319
|
+
foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
|
320
|
+
if(partial.length)
|
321
|
+
ret=ret.concat(partial.slice(0,instance.options.choices-ret.length))
|
322
|
+
return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);}
|
323
|
+
Ajax.InPlaceEditor=Class.create();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";Ajax.InPlaceEditor.prototype={initialize:function(element,url,options){this.url=url;this.element=$(element);this.options=Object.extend({okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightcolor});},onFailure:function(transport){alert("Error communicating with the server: "+transport.responseText.stripTags());},callback:function(form){return Form.serialize(form);},handleLineBreaks:true,loadingText:'Loading...',savingClassName:'inplaceeditor-saving',loadingClassName:'inplaceeditor-loading',formClassName:'inplaceeditor-form',highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{}},options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=null;}}
|
324
|
+
if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl);}
|
325
|
+
this.originalBackground=Element.getStyle(this.element,'background-color');if(!this.originalBackground){this.originalBackground="transparent";}
|
326
|
+
this.element.title=this.options.clickToEditText;this.onclickListener=this.enterEditMode.bindAsEventListener(this);this.mouseoverListener=this.enterHover.bindAsEventListener(this);this.mouseoutListener=this.leaveHover.bindAsEventListener(this);Event.observe(this.element,'click',this.onclickListener);Event.observe(this.element,'mouseover',this.mouseoverListener);Event.observe(this.element,'mouseout',this.mouseoutListener);if(this.options.externalControl){Event.observe(this.options.externalControl,'click',this.onclickListener);Event.observe(this.options.externalControl,'mouseover',this.mouseoverListener);Event.observe(this.options.externalControl,'mouseout',this.mouseoutListener);}},enterEditMode:function(evt){if(this.saving)return;if(this.editing)return;this.editing=true;this.onEnterEditMode();if(this.options.externalControl){Element.hide(this.options.externalControl);}
|
327
|
+
Element.hide(this.element);this.createForm();this.element.parentNode.insertBefore(this.form,this.element);Field.scrollFreeActivate(this.editField);if(evt){Event.stop(evt);}
|
328
|
+
return false;},createForm:function(){this.form=document.createElement("form");this.form.id=this.options.formId;Element.addClassName(this.form,this.options.formClassName)
|
329
|
+
this.form.onsubmit=this.onSubmit.bind(this);this.createEditField();if(this.options.textarea){var br=document.createElement("br");this.form.appendChild(br);}
|
330
|
+
if(this.options.okButton){okButton=document.createElement("input");okButton.type="submit";okButton.value=this.options.okText;this.form.appendChild(okButton);}
|
331
|
+
if(this.options.cancelLink){cancelLink=document.createElement("a");cancelLink.href="#";cancelLink.appendChild(document.createTextNode(this.options.cancelText));cancelLink.onclick=this.onclickCancel.bind(this);this.form.appendChild(cancelLink);}},hasHTMLLineBreaks:function(string){if(!this.options.handleLineBreaks)return false;return string.match(/<br/i)||string.match(/<p>/i);},convertHTMLLineBreaks:function(string){return string.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"");},createEditField:function(){var text;if(this.options.loadTextURL){text=this.options.loadingText;}else{text=this.getText();}
|
332
|
+
var obj=this;if(this.options.rows==1&&!this.hasHTMLLineBreaks(text)){this.options.textarea=false;var textField=document.createElement("input");textField.obj=this;textField.type="text";textField.name="value";textField.value=text;textField.style.backgroundColor=this.options.highlightcolor;var size=this.options.size||this.options.cols||0;if(size!=0)textField.size=size;if(this.options.submitOnBlur)
|
333
|
+
textField.onblur=this.onSubmit.bind(this);this.editField=textField;}else{this.options.textarea=true;var textArea=document.createElement("textarea");textArea.obj=this;textArea.name="value";textArea.value=this.convertHTMLLineBreaks(text);textArea.rows=this.options.rows;textArea.cols=this.options.cols||40;if(this.options.submitOnBlur)
|
334
|
+
textArea.onblur=this.onSubmit.bind(this);this.editField=textArea;}
|
335
|
+
if(this.options.loadTextURL){this.loadExternalText();}
|
336
|
+
this.form.appendChild(this.editField);},getText:function(){return this.element.innerHTML;},loadExternalText:function(){Element.addClassName(this.form,this.options.loadingClassName);this.editField.disabled=true;new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions));},onLoadedExternalText:function(transport){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=transport.responseText.stripTags();},onclickCancel:function(){this.onComplete();this.leaveEditMode();return false;},onFailure:function(transport){this.options.onFailure(transport);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null;}
|
337
|
+
return false;},onSubmit:function(){var form=this.form;var value=this.editField.value;this.onLoading();new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(form,value),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions));if(arguments.length>1){Event.stop(arguments[0]);}
|
338
|
+
return false;},onLoading:function(){this.saving=true;this.removeForm();this.leaveHover();this.showSaving();},showSaving:function(){this.oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;Element.addClassName(this.element,this.options.savingClassName);this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);},removeForm:function(){if(this.form){if(this.form.parentNode)Element.remove(this.form);this.form=null;}},enterHover:function(){if(this.saving)return;this.element.style.backgroundColor=this.options.highlightcolor;if(this.effect){this.effect.cancel();}
|
339
|
+
Element.addClassName(this.element,this.options.hoverClassName)},leaveHover:function(){if(this.options.backgroundColor){this.element.style.backgroundColor=this.oldBackground;}
|
340
|
+
Element.removeClassName(this.element,this.options.hoverClassName)
|
341
|
+
if(this.saving)return;this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground});},leaveEditMode:function(){Element.removeClassName(this.element,this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);if(this.options.externalControl){Element.show(this.options.externalControl);}
|
342
|
+
this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode();},onComplete:function(transport){this.leaveEditMode();this.options.onComplete.bind(this)(transport,this.element);},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;}
|
343
|
+
this.leaveEditMode();Event.stopObserving(this.element,'click',this.onclickListener);Event.stopObserving(this.element,'mouseover',this.mouseoverListener);Event.stopObserving(this.element,'mouseout',this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,'click',this.onclickListener);Event.stopObserving(this.options.externalControl,'mouseover',this.mouseoverListener);Event.stopObserving(this.options.externalControl,'mouseout',this.mouseoutListener);}}};Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}};var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{},Version:'1.4.1'}};dp.sh.Strings={AboutDialog:'<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/SyntaxHighlighter</a></p>©2004-2005 Alex Gorbatchev. All right reserved.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'};dp.SyntaxHighlighter=dp.sh;dp.sh.Toolbar.Commands={ExpandSource:{label:'+ expand source',check:function(highlighter){return highlighter.collapse;},func:function(sender,highlighter)
|
344
|
+
{sender.parentNode.removeChild(sender);highlighter.div.className=highlighter.div.className.replace('collapsed','');}},ViewSource:{label:'view plain',func:function(sender,highlighter)
|
345
|
+
{var code=highlighter.originalCode.replace(/</g,'<');var wnd=window.open('','_blank','width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1');wnd.document.write('<textarea style="width:99%;height:99%">'+code+'</textarea>');wnd.document.close();}},CopyToClipboard:{label:'copy to clipboard',check:function(){return window.clipboardData!=null;},func:function(sender,highlighter)
|
346
|
+
{window.clipboardData.setData('text',highlighter.originalCode);alert('The code is in your clipboard now');}},PrintSource:{label:'print',func:function(sender,highlighter)
|
347
|
+
{var iframe=document.createElement('IFRAME');var doc=null;iframe.style.cssText='position:absolute;width:0px;height:0px;left:-500px;top:-500px;';document.body.appendChild(iframe);doc=iframe.contentWindow.document;dp.sh.Utils.CopyStyles(doc,window.document);doc.write('<div class="'+highlighter.div.className.replace('collapsed','')+' printing">'+highlighter.div.innerHTML+'</div>');doc.close();iframe.contentWindow.focus();iframe.contentWindow.print();alert('Printing...');document.body.removeChild(iframe);}},About:{label:'?',func:function(highlighter)
|
348
|
+
{var wnd=window.open('','_blank','dialog,width=300,height=150,scrollbars=0');var doc=wnd.document;dp.sh.Utils.CopyStyles(doc,window.document);doc.write(dp.sh.Strings.AboutDialog.replace('{V}',dp.sh.Version));doc.close();wnd.focus();}}};dp.sh.Toolbar.Create=function(highlighter)
|
349
|
+
{var div=document.createElement('DIV');div.className='tools';for(var name in dp.sh.Toolbar.Commands)
|
350
|
+
{var cmd=dp.sh.Toolbar.Commands[name];if(cmd.check!=null&&!cmd.check(highlighter))
|
351
|
+
continue;div.innerHTML+='<a href="#" onclick="dp.sh.Toolbar.Command(\''+name+'\',this);return false;">'+cmd.label+'</a>';}
|
352
|
+
return div;}
|
353
|
+
dp.sh.Toolbar.Command=function(name,sender)
|
354
|
+
{var n=sender;while(n!=null&&n.className.indexOf('dp-highlighter')==-1)
|
355
|
+
n=n.parentNode;if(n!=null)
|
356
|
+
dp.sh.Toolbar.Commands[name].func(sender,n.highlighter);}
|
357
|
+
dp.sh.Utils.CopyStyles=function(destDoc,sourceDoc)
|
358
|
+
{var links=sourceDoc.getElementsByTagName('link');for(var i=0;i<links.length;i++)
|
359
|
+
if(links[i].rel.toLowerCase()=='stylesheet')
|
360
|
+
destDoc.write('<link type="text/css" rel="stylesheet" href="'+links[i].href+'"></link>');}
|
361
|
+
dp.sh.RegexLib={MultiLineCComments:new RegExp('/\\*[\\s\\S]*?\\*/','gm'),SingleLineCComments:new RegExp('//.*$','gm'),SingleLinePerlComments:new RegExp('#.*$','gm'),DoubleQuotedString:new RegExp('"(?:\\.|(\\\\\\")|[^\\""])*"','g'),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''])*'",'g')};dp.sh.Match=function(value,index,css)
|
362
|
+
{this.value=value;this.index=index;this.length=value.length;this.css=css;}
|
363
|
+
dp.sh.Highlighter=function()
|
364
|
+
{this.noGutter=false;this.addControls=true;this.collapse=false;this.tabsToSpaces=true;this.wrapColumn=80;this.showColumns=true;}
|
365
|
+
dp.sh.Highlighter.SortCallback=function(m1,m2)
|
366
|
+
{if(m1.index<m2.index)
|
367
|
+
return-1;else if(m1.index>m2.index)
|
368
|
+
return 1;else
|
369
|
+
{if(m1.length<m2.length)
|
370
|
+
return-1;else if(m1.length>m2.length)
|
371
|
+
return 1;}
|
372
|
+
return 0;}
|
373
|
+
dp.sh.Highlighter.prototype.CreateElement=function(name)
|
374
|
+
{var result=document.createElement(name);result.highlighter=this;return result;}
|
375
|
+
dp.sh.Highlighter.prototype.GetMatches=function(regex,css)
|
376
|
+
{var index=0;var match=null;while((match=regex.exec(this.code))!=null)
|
377
|
+
this.matches[this.matches.length]=new dp.sh.Match(match[0],match.index,css);}
|
378
|
+
dp.sh.Highlighter.prototype.AddBit=function(str,css)
|
379
|
+
{if(str==null||str.length==0)
|
380
|
+
return;var span=this.CreateElement('SPAN');str=str.replace(/&/g,'&');str=str.replace(/ /g,' ');str=str.replace(/</g,'<');str=str.replace(/\n/gm,' <br>');if(css!=null)
|
381
|
+
{var regex=new RegExp('<br>','gi');if(regex.test(str))
|
382
|
+
{var lines=str.split(' <br>');str='';for(var i=0;i<lines.length;i++)
|
383
|
+
{span=this.CreateElement('SPAN');span.className=css;span.innerHTML=lines[i];this.div.appendChild(span);if(i+1<lines.length)
|
384
|
+
this.div.appendChild(this.CreateElement('BR'));}}
|
385
|
+
else
|
386
|
+
{span.className=css;span.innerHTML=str;this.div.appendChild(span);}}
|
387
|
+
else
|
388
|
+
{span.innerHTML=str;this.div.appendChild(span);}}
|
389
|
+
dp.sh.Highlighter.prototype.IsInside=function(match)
|
390
|
+
{if(match==null||match.length==0)
|
391
|
+
return false;for(var i=0;i<this.matches.length;i++)
|
392
|
+
{var c=this.matches[i];if(c==null)
|
393
|
+
continue;if((match.index>c.index)&&(match.index<c.index+c.length))
|
394
|
+
return true;}
|
395
|
+
return false;}
|
396
|
+
dp.sh.Highlighter.prototype.ProcessRegexList=function()
|
397
|
+
{for(var i=0;i<this.regexList.length;i++)
|
398
|
+
this.GetMatches(this.regexList[i].regex,this.regexList[i].css);}
|
399
|
+
dp.sh.Highlighter.prototype.ProcessSmartTabs=function(code)
|
400
|
+
{var lines=code.split('\n');var result='';var tabSize=4;var tab='\t';function InsertSpaces(line,pos,count)
|
401
|
+
{var left=line.substr(0,pos);var right=line.substr(pos+1,line.length);var spaces='';for(var i=0;i<count;i++)
|
402
|
+
spaces+=' ';return left+spaces+right;}
|
403
|
+
function ProcessLine(line,tabSize)
|
404
|
+
{if(line.indexOf(tab)==-1)
|
405
|
+
return line;var pos=0;while((pos=line.indexOf(tab))!=-1)
|
406
|
+
{var spaces=tabSize-pos%tabSize;line=InsertSpaces(line,pos,spaces);}
|
407
|
+
return line;}
|
408
|
+
for(var i=0;i<lines.length;i++)
|
409
|
+
result+=ProcessLine(lines[i],tabSize)+'\n';return result;}
|
410
|
+
dp.sh.Highlighter.prototype.SwitchToList=function()
|
411
|
+
{var html=this.div.innerHTML.replace(/<(br)\/?>/gi,'\n');var lines=html.split('\n');if(this.addControls==true)
|
412
|
+
this.bar.appendChild(dp.sh.Toolbar.Create(this));if(this.showColumns)
|
413
|
+
{var div=this.CreateElement('div');var columns=this.CreateElement('div');var showEvery=10;var i=1;while(i<=150)
|
414
|
+
{if(i%showEvery==0)
|
415
|
+
{div.innerHTML+=i;i+=(i+'').length;}
|
416
|
+
else
|
417
|
+
{div.innerHTML+='·';i++;}}
|
418
|
+
columns.className='columns';columns.appendChild(div);this.bar.appendChild(columns);}
|
419
|
+
for(var i=0,lineIndex=this.firstLine;i<lines.length-1;i++,lineIndex++)
|
420
|
+
{var li=this.CreateElement('LI');var span=this.CreateElement('SPAN');li.className=(i%2==0)?'alt':'';span.innerHTML=lines[i]+' ';li.appendChild(span);this.ol.appendChild(li);}
|
421
|
+
this.div.innerHTML='';}
|
422
|
+
dp.sh.Highlighter.prototype.Highlight=function(code)
|
423
|
+
{function Trim(str)
|
424
|
+
{return str.replace(/^\s*(.*?)[\s\n]*$/g,'$1');}
|
425
|
+
function Chop(str)
|
426
|
+
{return str.replace(/\n*$/,'').replace(/^\n*/,'');}
|
427
|
+
function Unindent(str)
|
428
|
+
{var lines=str.split('\n');var indents=new Array();var regex=new RegExp('^\\s*','g');var min=1000;for(var i=0;i<lines.length&&min>0;i++)
|
429
|
+
{if(Trim(lines[i]).length==0)
|
430
|
+
continue;var matches=regex.exec(lines[i]);if(matches!=null&&matches.length>0)
|
431
|
+
min=Math.min(matches[0].length,min);}
|
432
|
+
if(min>0)
|
433
|
+
for(var i=0;i<lines.length;i++)
|
434
|
+
lines[i]=lines[i].substr(min);return lines.join('\n');}
|
435
|
+
function Copy(string,pos1,pos2)
|
436
|
+
{return string.substr(pos1,pos2-pos1);}
|
437
|
+
var pos=0;this.originalCode=code;this.code=Chop(Unindent(code));this.div=this.CreateElement('DIV');this.bar=this.CreateElement('DIV');this.ol=this.CreateElement('OL');this.matches=new Array();this.div.className='dp-highlighter';this.div.highlighter=this;this.bar.className='bar';this.ol.start=this.firstLine;if(this.CssClass!=null)
|
438
|
+
this.ol.className=this.CssClass;if(this.collapse)
|
439
|
+
this.div.className+=' collapsed';if(this.noGutter)
|
440
|
+
this.div.className+=' nogutter';if(this.tabsToSpaces==true)
|
441
|
+
this.code=this.ProcessSmartTabs(this.code);this.ProcessRegexList();if(this.matches.length==0)
|
442
|
+
{this.AddBit(this.code,null);this.SwitchToList();this.div.appendChild(this.ol);return;}
|
443
|
+
this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);for(var i=0;i<this.matches.length;i++)
|
444
|
+
if(this.IsInside(this.matches[i]))
|
445
|
+
this.matches[i]=null;for(var i=0;i<this.matches.length;i++)
|
446
|
+
{var match=this.matches[i];if(match==null||match.length==0)
|
447
|
+
continue;this.AddBit(Copy(this.code,pos,match.index),null);this.AddBit(match.value,match.css);pos=match.index+match.length;}
|
448
|
+
this.AddBit(this.code.substr(pos),null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol);}
|
449
|
+
dp.sh.Highlighter.prototype.GetKeywords=function(str)
|
450
|
+
{return'\\b'+str.replace(/ /g,'\\b|\\b')+'\\b';}
|
451
|
+
dp.sh.HighlightAll=function(name,showGutter,showControls,collapseAll,firstLine,showColumns)
|
452
|
+
{function FindValue()
|
453
|
+
{var a=arguments;for(var i=0;i<a.length;i++)
|
454
|
+
{if(a[i]==null)
|
455
|
+
continue;if(typeof(a[i])=='string'&&a[i]!='')
|
456
|
+
return a[i]+'';if(typeof(a[i])=='object'&&a[i].value!='')
|
457
|
+
return a[i].value+'';}
|
458
|
+
return null;}
|
459
|
+
function IsOptionSet(value,list)
|
460
|
+
{for(var i=0;i<list.length;i++)
|
461
|
+
if(list[i]==value)
|
462
|
+
return true;return false;}
|
463
|
+
function GetOptionValue(name,list,defaultValue)
|
464
|
+
{var regex=new RegExp('^'+name+'\\[(\\w+)\\]$','gi');var matches=null;for(var i=0;i<list.length;i++)
|
465
|
+
if((matches=regex.exec(list[i]))!=null)
|
466
|
+
return matches[1];return defaultValue;}
|
467
|
+
var elements=document.getElementsByName(name);var highlighter=null;var registered=new Object();var propertyName='value';if(elements==null)
|
468
|
+
return;for(var brush in dp.sh.Brushes)
|
469
|
+
{var aliases=dp.sh.Brushes[brush].Aliases;if(aliases==null)
|
470
|
+
continue;for(var i=0;i<aliases.length;i++)
|
471
|
+
registered[aliases[i]]=brush;}
|
472
|
+
for(var i=0;i<elements.length;i++)
|
473
|
+
{var element=elements[i];var options=FindValue(element.attributes['class'],element.className,element.attributes['language'],element.language);var language='';if(options==null)
|
474
|
+
continue;options=options.split(':');language=options[0].toLowerCase();if(registered[language]==null)
|
475
|
+
continue;highlighter=new dp.sh.Brushes[registered[language]]();element.style.display='none';highlighter.noGutter=(showGutter==null)?IsOptionSet('nogutter',options):!showGutter;highlighter.addControls=(showControls==null)?!IsOptionSet('nocontrols',options):showControls;highlighter.collapse=(collapseAll==null)?IsOptionSet('collapse',options):collapseAll;highlighter.showColumns=(showColumns==null)?IsOptionSet('showcolumns',options):showColumns;highlighter.firstLine=(firstLine==null)?parseInt(GetOptionValue('firstline',options,1)):firstLine;highlighter.Highlight(element[propertyName]);element.parentNode.insertBefore(highlighter.div,element);}}
|
476
|
+
dp.sh.Brushes.CSharp=function()
|
477
|
+
{var keywords='abstract as base bool break byte case catch char checked class const '+'continue decimal default delegate do double else enum event explicit '+'extern false finally fixed float for foreach get goto if implicit in int '+'interface internal is lock long namespace new null object operator out '+'override params private protected public readonly ref return sbyte sealed set '+'short sizeof stackalloc static string struct switch this throw true try '+'typeof uint ulong unchecked unsafe ushort using virtual void while';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('^\\s*#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-c';}
|
478
|
+
dp.sh.Brushes.CSharp.prototype=new dp.sh.Highlighter();dp.sh.Brushes.CSharp.Aliases=['c#','c-sharp','csharp'];dp.sh.Brushes.Cpp=function()
|
479
|
+
{var datatypes='ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR '+'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH '+'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP '+'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY '+'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT '+'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE '+'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF '+'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR '+'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR '+'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT '+'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 '+'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR '+'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 '+'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT '+'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG '+'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM '+'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t '+'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS '+'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t '+'__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t '+'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler '+'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function '+'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf '+'va_list wchar_t wctrans_t wctype_t wint_t signed';var keywords='break case catch class const __finally __exception __try '+'const_cast continue private public protected __declspec '+'default delete deprecated dllexport dllimport do dynamic_cast '+'else enum explicit extern if for friend goto inline '+'mutable naked namespace new noinline noreturn nothrow '+'register reinterpret_cast return selectany '+'sizeof static static_cast struct switch template this '+'thread throw true false try typedef typeid typename union '+'using uuid virtual void volatile whcar_t while';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('^ *#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(datatypes),'gm'),css:'datatypes'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-cpp';}
|
480
|
+
dp.sh.Brushes.Cpp.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Cpp.Aliases=['cpp','c','c++'];dp.sh.Brushes.CSS=function()
|
481
|
+
{var keywords='ascent azimuth background-attachment background-color background-image background-position '+'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top '+'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color '+'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width '+'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color '+'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display '+'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font '+'height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top '+'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans '+'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page '+'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position '+'quotes richness right size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress '+'table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em '+'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';var values='above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';var fonts='[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif';this.regexList=[{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('\\#[a-zA-Z0-9]{3,6}','g'),css:'colors'},{regex:new RegExp('(\\d+)(px|pt|\:)','g'),css:'string'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'},{regex:new RegExp(this.GetKeywords(values),'g'),css:'string'},{regex:new RegExp(this.GetKeywords(fonts),'g'),css:'string'}];this.CssClass='dp-css';}
|
482
|
+
dp.sh.Brushes.CSS.prototype=new dp.sh.Highlighter();dp.sh.Brushes.CSS.Aliases=['css'];dp.sh.Brushes.JScript=function()
|
483
|
+
{var keywords='abstract boolean break byte case catch char class const continue debugger '+'default delete do double else enum export extends false final finally float '+'for function goto if implements import in instanceof int interface long native '+'new null package private protected public return short static super switch '+'synchronized this throw throws transient true try typeof var void volatile while with';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('^\\s*#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-c';}
|
484
|
+
dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter();dp.sh.Brushes.JScript.Aliases=['js','jscript','javascript'];dp.sh.Brushes.Java=function()
|
485
|
+
{var keywords='abstract assert boolean break byte case catch char class const '+'continue default do double else enum extends '+'false final finally float for goto if implements import '+'instanceof int interface long native new null '+'package private protected public return '+'short static strictfp super switch synchronized this throw throws true '+'transient try void volatile while';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b','gi'),css:'number'},{regex:new RegExp('(?!\\@interface\\b)\\@[\\$\\w]+\\b','g'),css:'annotation'},{regex:new RegExp('\\@interface\\b','g'),css:'keyword'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-j';}
|
486
|
+
dp.sh.Brushes.Java.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Java.Aliases=['java'];dp.sh.Brushes.Php=function()
|
487
|
+
{var funcs='abs acos acosh addcslashes addslashes '+'array_change_key_case array_chunk array_combine array_count_values array_diff '+'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+'array_push array_rand array_reduce array_reverse array_search array_shift '+'array_slice array_splice array_sum array_udiff array_udiff_assoc '+'array_udiff_uassoc array_uintersect array_uintersect_assoc '+'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+'parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir '+'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+'strtoupper strtr strval substr substr_compare';var keywords='and or xor __FILE__ __LINE__ array as break case '+'cfunction class const continue declare default die do else '+'elseif empty enddeclare endfor endforeach endif endswitch endwhile '+'extends for foreach function include include_once global if '+'new old_function return static switch use require require_once '+'var while __FUNCTION__ __CLASS__ '+'__METHOD__ abstract interface public implements extends private protected throw';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('\\$\\w+','g'),css:'vars'},{regex:new RegExp(this.GetKeywords(funcs),'gmi'),css:'func'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-c';}
|
488
|
+
dp.sh.Brushes.Php.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Php.Aliases=['php'];dp.sh.Brushes.Python=function()
|
489
|
+
{var keywords='and assert break class continue def del elif else except exec '+'finally for from global if import in is lambda not or object pass print '+'raise return try yield while';var builtins='self __builtin__ __dict__ __future__ __methods__ __members__ __author__ __email__ __version__'+'__class__ __bases__ __import__ __main__ __name__ __doc__ __self__ __debug__ __slots__ '+'abs append apply basestring bool buffer callable chr classmethod clear close cmp coerce compile complex '+'conjugate copy count delattr dict dir divmod enumerate Ellipsis eval execfile extend False file fileno filter float flush '+'get getattr globals has_key hasarttr hash hex id index input insert int intern isatty isinstance isubclass '+'items iter keys len list locals long map max min mode oct open ord pop pow property range '+'raw_input read readline readlines reduce reload remove repr reverse round seek setattr slice sum '+'staticmethod str super tell True truncate tuple type unichr unicode update values write writelines xrange zip';var magicmethods='__abs__ __add__ __and__ __call__ __cmp__ __coerce__ __complex__ __concat__ __contains__ __del__ __delattr__ __delitem__ '+'__delslice__ __div__ __divmod__ __float__ __getattr__ __getitem__ __getslice__ __hash__ __hex__ __eq__ __le__ __lt__ __gt__ __ge__ '+'__iadd__ __isub__ __imod__ __idiv__ __ipow__ __iand__ __ior__ __ixor__ __ilshift__ __irshift__ '+'__invert__ __init__ __int__ __inv__ __iter__ __len__ __long__ __lshift__ __mod__ __mul__ __new__ __neg__ __nonzero__ __oct__ __or__ '+'__pos__ __pow__ __radd__ __rand__ __rcmp__ __rdiv__ __rdivmod__ __repeat__ __repr__ __rlshift__ __rmod__ __rmul__ '+'__ror__ __rpow__ __rrshift__ __rshift__ __rsub__ __rxor__ __setattr__ __setitem__ __setslice__ __str__ __sub__ __xor__';var exceptions='Exception StandardError ArithmeticError LookupError EnvironmentError AssertionError AttributeError EOFError '+'FutureWarning IndentationError OverflowWarning PendingDeprecationWarning ReferenceError RuntimeWarning '+'SyntaxWarning TabError UnicodeDecodeError UnicodeEncodeError UnicodeTranslateError UserWarning Warning '+'IOError ImportError IndexError KeyError KeyboardInterrupt MemoryError NameError NotImplementedError OSError '+'RuntimeError StopIteration SyntaxError SystemError SystemExit TypeError UnboundLocalError UnicodeError ValueError '+'FloatingPointError OverflowError WindowsError ZeroDivisionError';var types='NoneType TypeType IntType LongType FloatType ComplexType StringType UnicodeType BufferType TupleType ListType '+'DictType FunctionType LambdaType CodeType ClassType UnboundMethodType InstanceType MethodType BuiltinFunctionType BuiltinMethodType '+'ModuleType FileType XRangeType TracebackType FrameType SliceType EllipsisType';var commonlibs='anydbm array asynchat asyncore AST base64 binascii binhex bisect bsddb buildtools bz2 '+'BaseHTTPServer Bastion calendar cgi cmath cmd codecs codeop commands compiler copy copy_reg '+'cPickle crypt cStringIO csv curses Carbon CGIHTTPServer ConfigParser Cookie datetime dbhash '+'dbm difflib dircache distutils doctest DocXMLRPCServer email encodings errno exceptions fcntl '+'filecmp fileinput ftplib gc gdbm getopt getpass glob gopherlib gzip heapq htmlentitydefs '+'htmllib httplib HTMLParser imageop imaplib imgfile imghdr imp inspect itertools jpeg keyword '+'linecache locale logging mailbox mailcap marshal math md5 mhlib mimetools mimetypes mimify mmap '+'mpz multifile mutex MimeWriter netrc new nis nntplib nsremote operator optparse os parser pickle pipes '+'popen2 poplib posix posixfile pprint preferences profile pstats pwd pydoc pythonprefs quietconsole '+'quopri Queue random re readline resource rexec rfc822 rgbimg sched select sets sgmllib sha shelve shutil '+'signal site smtplib socket stat statcache string struct symbol sys syslog SimpleHTTPServer '+'SimpleXMLRPCServer SocketServer StringIO tabnanny tarfile telnetlib tempfile termios textwrap '+'thread threading time timeit token tokenize traceback tty types Tkinter unicodedata unittest '+'urllib urllib2 urlparse user UserDict UserList UserString warnings weakref webbrowser whichdb '+'xml xmllib xmlrpclib xreadlines zipfile zlib';this.regexList=[{regex:new RegExp('#.*$','gm'),css:'comment'},{regex:new RegExp('"""(.|\n)*?"""','gm'),css:'string'},{regex:new RegExp("'''(.|\n)*?'''",'gm'),css:'string'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'},{regex:new RegExp(this.GetKeywords(builtins),'gm'),css:'builtins'},{regex:new RegExp(this.GetKeywords(magicmethods),'gm'),css:'magicmethods'},{regex:new RegExp(this.GetKeywords(exceptions),'gm'),css:'exceptions'},{regex:new RegExp(this.GetKeywords(types),'gm'),css:'types'},{regex:new RegExp(this.GetKeywords(commonlibs),'gm'),css:'commonlibs'}];this.CssClass='dp-py';}
|
490
|
+
dp.sh.Brushes.Python.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Python.Aliases=['py','python'];dp.sh.Brushes.Ruby=function()
|
491
|
+
{var keywords='alias and BEGIN begin break case class def define_method defined do each else elsif '+'END end ensure false for if in module new next nil not or raise redo rescue retry return '+'self super then throw true undef unless until when while yield';var builtins='Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload '+'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol '+'ThreadGroup Thread Time TrueClass'
|
492
|
+
this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp(':[a-z][A-Za-z0-9_]*','g'),css:'symbol'},{regex:new RegExp('[\\$|@|@@]\\w+','g'),css:'variable'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'},{regex:new RegExp(this.GetKeywords(builtins),'gm'),css:'builtin'}];this.CssClass='dp-rb';}
|
493
|
+
dp.sh.Brushes.Ruby.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Ruby.Aliases=['ruby','rails'];dp.sh.Brushes.Sql=function()
|
494
|
+
{var funcs='abs avg case cast coalesce convert count current_timestamp '+'current_user day isnull left lower month nullif replace right '+'session_user space substring sum system_user upper user year';var keywords='absolute action add after alter as asc at authorization begin bigint '+'binary bit by cascade char character check checkpoint close collate '+'column commit committed connect connection constraint contains continue '+'create cube current current_date current_time cursor database date '+'deallocate dec decimal declare default delete desc distinct double drop '+'dynamic else end end-exec escape except exec execute false fetch first '+'float for force foreign forward free from full function global goto grant '+'group grouping having hour ignore index inner insensitive insert instead '+'int integer intersect into is isolation key last level load local max min '+'minute modify move name national nchar next no numeric of off on only '+'open option order out output partial password precision prepare primary '+'prior privileges procedure public read real references relative repeatable '+'restrict return returns revoke rollback rollup rows rule schema scroll '+'second section select sequence serializable set size smallint static '+'statistics table temp temporary then time timestamp to top transaction '+'translation trigger true truncate uncommitted union unique update values '+'varchar varying view when where with work';var operators='all and any between cross in join like not null or outer some';this.regexList=[{regex:new RegExp('--(.*)$','gm'),css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp(this.GetKeywords(funcs),'gmi'),css:'func'},{regex:new RegExp(this.GetKeywords(operators),'gmi'),css:'op'},{regex:new RegExp(this.GetKeywords(keywords),'gmi'),css:'keyword'}];this.CssClass='dp-sql';}
|
495
|
+
dp.sh.Brushes.Sql.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Sql.Aliases=['sql'];dp.sh.Brushes.Xml=function()
|
496
|
+
{this.CssClass='dp-xml';}
|
497
|
+
dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Xml.Aliases=['xml','xhtml','xslt','html','xhtml'];dp.sh.Brushes.Xml.prototype.ProcessRegexList=function()
|
498
|
+
{function push(array,value)
|
499
|
+
{array[array.length]=value;}
|
500
|
+
var index=0;var match=null;var regex=null;this.GetMatches(new RegExp('<\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\]>','gm'),'cdata');this.GetMatches(new RegExp('<!--\\s*.*\\s*?-->','gm'),'comments');regex=new RegExp('([:\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*','gm');while((match=regex.exec(this.code))!=null)
|
501
|
+
{push(this.matches,new dp.sh.Match(match[1],match.index,'attribute'));if(match[2]!=undefined)
|
502
|
+
{push(this.matches,new dp.sh.Match(match[2],match.index+match[0].indexOf(match[2]),'attribute-value'));}}
|
503
|
+
this.GetMatches(new RegExp('</*\\?*(?!\\!)|/*\\?*>','gm'),'tag');regex=new RegExp('</*\\?*\\s*([:\\w-\.]+)','gm');while((match=regex.exec(this.code))!=null)
|
504
|
+
{push(this.matches,new dp.sh.Match(match[1],match.index+match[0].indexOf(match[1]),'tag-name'));}}
|
505
|
+
if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0;i<arguments.length;i++){this[this.length]=arguments[i]}return this.length}}if(!Array.prototype.shift){Array.prototype.shift=function(){if(this.length>0){var firstItem=this[0];for(var i=0;i<this.length-1;i++){this[i]=this[i+1]}this.length=this.length-1;return firstItem}}}if(!Array.prototype.splice){Array.prototype.splice=function(startIndex,deleteCount){var itemsAfterDeleted=this.slice(startIndex+deleteCount);var itemsDeleted=this.slice(startIndex,startIndex+deleteCount);this.length=startIndex;var argumentsArray=[];for(var i=0;i<arguments.length;i++){argumentsArray[i]=arguments[i]}var itemsToAppend=(argumentsArray.length>2)?itemsAfterDeleted=argumentsArray.slice(2).concat(itemsAfterDeleted):itemsAfterDeleted;for(i=0;i<itemsToAppend.length;i++){this.push(itemsToAppend[i])}return itemsDeleted}}var log4javascript;var SimpleDateFormat;(function(){function isUndefined(obj){return typeof obj=="undefined"}(function(){var regex=/('[^']*')|(G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|Z+)|([a-zA-Z]+)|([^a-zA-Z']+)/;var monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];var dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var TEXT2=0,TEXT3=1,NUMBER=2,YEAR=3,MONTH=4,TIMEZONE=5;var types={G:TEXT2,y:YEAR,Y:YEAR,M:MONTH,w:NUMBER,W:NUMBER,D:NUMBER,d:NUMBER,F:NUMBER,E:TEXT3,a:TEXT2,H:NUMBER,k:NUMBER,K:NUMBER,h:NUMBER,m:NUMBER,s:NUMBER,S:NUMBER,Z:TIMEZONE};var ONE_DAY=24*60*60*1000;var ONE_WEEK=7*ONE_DAY;var DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK=1;Date.prototype.getDifference=function(date){return this.getTime()-date.getTime()};Date.prototype.isBefore=function(d){return this.getTime()<d.getTime()};Date.prototype.getWeekInYear=function(minimalDaysInFirstWeek){if(isUndefined(this.minimalDaysInFirstWeek)){minimalDaysInFirstWeek=DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK}var previousSunday=new Date(this.getTime()-this.getDay()*ONE_DAY);previousSunday=new Date(previousSunday.getFullYear(),previousSunday.getMonth(),previousSunday.getDate());var startOfYear=new Date(this.getFullYear(),0,1);var numberOfSundays=previousSunday.isBefore(startOfYear)?0:1+Math.floor((previousSunday.getTime()-startOfYear.getTime())/ONE_WEEK);var numberOfDaysInFirstWeek=7-startOfYear.getDay();var weekInYear=numberOfSundays;if(numberOfDaysInFirstWeek>=minimalDaysInFirstWeek){weekInYear++}return weekInYear};Date.prototype.getWeekInMonth=function(minimalDaysInFirstWeek){if(isUndefined(this.minimalDaysInFirstWeek)){minimalDaysInFirstWeek=DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK}var previousSunday=new Date(this.getTime()-this.getDay()*ONE_DAY);previousSunday=new Date(previousSunday.getFullYear(),previousSunday.getMonth(),previousSunday.getDate());var startOfMonth=new Date(this.getFullYear(),this.getMonth(),1);var numberOfSundays=previousSunday.isBefore(startOfMonth)?0:1+Math.floor((previousSunday.getTime()-startOfMonth.getTime())/ONE_WEEK);var numberOfDaysInFirstWeek=7-startOfMonth.getDay();var weekInMonth=numberOfSundays;if(numberOfDaysInFirstWeek>=minimalDaysInFirstWeek){weekInMonth++}return weekInMonth};Date.prototype.getDayInYear=function(){var startOfYear=new Date(this.getFullYear(),0,1);return 1+Math.floor((this.getTime()-startOfYear.getTime())/ONE_DAY)};SimpleDateFormat=function(formatString){this.formatString=formatString};SimpleDateFormat.prototype.setMinimalDaysInFirstWeek=function(days){this.minimalDaysInFirstWeek=days};SimpleDateFormat.prototype.getMinimalDaysInFirstWeek=function(days){return isUndefined(this.minimalDaysInFirstWeek)?DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK:this.minimalDaysInFirstWeek};SimpleDateFormat.prototype.format=function(date){var formattedString="";var result;var padWithZeroes=function(str,len){while(str.length<len){str="0"+str}return str};var formatText=function(data,numberOfLetters,minLength){return(numberOfLetters>=4)?data:data.substr(0,Math.max(minLength,numberOfLetters))};var formatNumber=function(data,numberOfLetters){var dataString=""+data;return padWithZeroes(dataString,numberOfLetters)};var searchString=this.formatString;while((result=regex.exec(searchString))){var matchedString=result[0];var quotedString=result[1];var patternLetters=result[2];var otherLetters=result[3];var otherCharacters=result[4];if(quotedString){if(quotedString=="''"){formattedString+="'"}else{formattedString+=quotedString.substring(1,quotedString.length-1)}}else if(otherLetters){}else if(otherCharacters){formattedString+=otherCharacters}else if(patternLetters){var patternLetter=patternLetters.charAt(0);var numberOfLetters=patternLetters.length;var rawData="";switch(patternLetter){case"G":rawData="AD";break;case"y":rawData=date.getFullYear();break;case"M":rawData=date.getMonth();break;case"w":rawData=date.getWeekInYear(this.getMinimalDaysInFirstWeek());break;case"W":rawData=date.getWeekInMonth(this.getMinimalDaysInFirstWeek());break;case"D":rawData=date.getDayInYear();break;case"d":rawData=date.getDate();break;case"F":rawData=1+Math.floor((date.getDate()-1)/7);break;case"E":rawData=dayNames[date.getDay()];break;case"a":rawData=(date.getHours()>=12)?"PM":"AM";break;case"H":rawData=date.getHours();break;case"k":rawData=1+date.getHours();break;case"K":rawData=date.getHours()%12;break;case"h":rawData=1+(date.getHours()%12);break;case"m":rawData=date.getMinutes();break;case"s":rawData=date.getSeconds();break;case"S":rawData=date.getMilliseconds();break;case"Z":rawData=date.getTimezoneOffset();break}switch(types[patternLetter]){case TEXT2:formattedString+=formatText(rawData,numberOfLetters,2);break;case TEXT3:formattedString+=formatText(rawData,numberOfLetters,3);break;case NUMBER:formattedString+=formatNumber(rawData,numberOfLetters);break;case YEAR:if(numberOfLetters<=2){var dataString=""+rawData;formattedString+=dataString.substr(2,2)}else{formattedString+=formatNumber(rawData,numberOfLetters)}break;case MONTH:if(numberOfLetters>=3){formattedString+=formatText(monthNames[rawData],numberOfLetters,numberOfLetters)}else{formattedString+=formatNumber(rawData+1,numberOfLetters)}break;case TIMEZONE:var isPositive=(rawData>0);var prefix=isPositive?"-":"+";var absData=Math.abs(rawData);var hours=""+Math.floor(absData/60);hours=padWithZeroes(hours,2);var minutes=""+(absData%60);minutes=padWithZeroes(minutes,2);formattedString+=prefix+hours+minutes;break}}searchString=searchString.substr(result.index+result[0].length)}return formattedString}})();var applicationStartDate=new Date();var uniqueId="log4javascript_"+applicationStartDate.getTime()+"_"+Math.floor(Math.random()*100000000);var emptyFunction=function(){};var newLine="\r\n";log4javascript={};log4javascript.version="1.3.1";function getExceptionStringRep(ex){if(ex){var exStr="Exception: ";if(ex.message){exStr+=ex.message}else if(ex.description){exStr+=ex.description}if(ex.lineNumber){exStr+=" on line number "+ex.lineNumber}if(ex.fileName){exStr+=" in file "+ex.fileName}if(showStackTraces&&ex.stack){exStr+=newLine+"Stack trace:"+newLine+ex.stack}return exStr}return null}function formatObjectExpansion(obj,depth,indentation){var i,output,childDepth,childIndentation,childLines;if((obj instanceof Array)&&depth>0){if(!indentation){indentation=""}output="["+newLine;childDepth=depth-1;childIndentation=indentation+" ";childLines=[];for(i=0;i<obj.length;i++){childLines.push(childIndentation+formatObjectExpansion(obj[i],childDepth,childIndentation))}output+=childLines.join(","+newLine)+newLine+indentation+"]";return output}else if(typeof obj=="object"&&depth>0){if(!indentation){indentation=""}output=""+"{"+newLine;childDepth=depth-1;childIndentation=indentation+" ";childLines=[];for(i in obj){childLines.push(childIndentation+i+": "+formatObjectExpansion(obj[i],childDepth,childIndentation))}output+=childLines.join(","+newLine)+newLine+indentation+"}";return output}else if(typeof obj=="string"){return obj}else{return obj.toString()}}function escapeNewLines(str){return str.replace(/\r\n|\r|\n/g,"\\r\\n")}function urlEncode(str){return escape(str).replace(/\+/g,"%2B").replace(/"/g,"%22").replace(/'/g,"%27").replace(/\//g,"%2F")}function bool(obj){return Boolean(obj)}function array_remove(arr,val){var index=-1;for(var i=0;i<arr.length;i++){if(arr[i]===val){index=i;break}}if(index>=0){arr.splice(index,1);return true}else{return false}}function extractBooleanFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue}else{return bool(param)}}function extractStringFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue}else{return String(param)}}function extractIntFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue}else{try{var value=parseInt(param,10);return isNaN(value)?defaultValue:value}catch(ex){logLog.warn("Invalid int param "+param,ex);return defaultValue}}}function extractFunctionFromParam(param,defaultValue){if(typeof param=="function"){return param}else{return defaultValue}}var logLog={quietMode:false,setQuietMode:function(quietMode){this.quietMode=bool(quietMode)},numberOfErrors:0,alertAllErrors:false,setAlertAllErrors:function(alertAllErrors){this.alertAllErrors=alertAllErrors},debug:function(message,exception){},warn:function(message,exception){},error:function(message,exception){if(++this.numberOfErrors==1||this.alertAllErrors){if(!this.quietMode){var alertMessage="log4javascript error: "+message;if(exception){alertMessage+=newLine+newLine+"Original error: "+getExceptionStringRep(exception)}alert(alertMessage)}}}};log4javascript.logLog=logLog;var errorListeners=[];log4javascript.addErrorListener=function(listener){if(typeof listener=="function"){errorListeners.push(listener)}else{handleError("addErrorListener: listener supplied was not a function")}};log4javascript.removeErrorListener=function(listener){array_remove(errorListeners,listener)};function handleError(message,exception){logLog.error(message,exception);for(var i=0;i<errorListeners.length;i++){errorListeners[i](message,exception)}}var enabled=(typeof log4javascript_disabled!="undefined")&&log4javascript_disabled?false:true;log4javascript.setEnabled=function(enable){enabled=bool(enable)};log4javascript.isEnabled=function(){return enabled};log4javascript.evalInScope=function(expr){return eval(expr)};var showStackTraces=false;log4javascript.setShowStackTraces=function(show){showStackTraces=bool(show)};function Logger(name){this.name=name;var appenders=[];var loggerLevel=Level.DEBUG;this.addAppender=function(appender){if(appender instanceof log4javascript.Appender){appenders.push(appender)}else{handleError("Logger.addAppender: appender supplied is not a subclass of Appender")}};this.removeAppender=function(appender){array_remove(appenders,appender)};this.removeAllAppenders=function(appender){appenders.length=0};this.log=function(level,message,exception){if(level.isGreaterOrEqual(loggerLevel)){var loggingEvent=new LoggingEvent(this,new Date(),level,message,exception);for(var i=0;i<appenders.length;i++){appenders[i].doAppend(loggingEvent)}}};this.setLevel=function(level){loggerLevel=level};this.getLevel=function(){return loggerLevel}}Logger.prototype={trace:function(message,exception){this.log(Level.TRACE,message,exception)},debug:function(message,exception){this.log(Level.DEBUG,message,exception)},info:function(message,exception){this.log(Level.INFO,message,exception)},warn:function(message,exception){this.log(Level.WARN,message,exception)},error:function(message,exception){this.log(Level.ERROR,message,exception)},fatal:function(message,exception){this.log(Level.FATAL,message,exception)}};Logger.prototype.trace.isEntryPoint=true;Logger.prototype.debug.isEntryPoint=true;Logger.prototype.info.isEntryPoint=true;Logger.prototype.warn.isEntryPoint=true;Logger.prototype.error.isEntryPoint=true;Logger.prototype.fatal.isEntryPoint=true;var loggers={};log4javascript.getLogger=function(loggerName){if(!(typeof loggerName=="string")){loggerName="[anonymous]"}if(!loggers[loggerName]){loggers[loggerName]=new Logger(loggerName)}return loggers[loggerName]};var defaultLogger=null;log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=log4javascript.getLogger("[default]");var a=new log4javascript.PopUpAppender();defaultLogger.addAppender(a)}return defaultLogger};var nullLogger=null;log4javascript.getNullLogger=function(){if(!nullLogger){nullLogger=log4javascript.getLogger("[null]")}return nullLogger};var Level=function(level,name){this.level=level;this.name=name};Level.prototype={toString:function(){return this.name},equals:function(level){return this.level==level.level},isGreaterOrEqual:function(level){return this.level>=level.level}};Level.ALL=new Level(Number.MIN_VALUE,"ALL");Level.TRACE=new Level(10000,"TRACE");Level.DEBUG=new Level(20000,"DEBUG");Level.INFO=new Level(30000,"INFO");Level.WARN=new Level(40000,"WARN");Level.ERROR=new Level(50000,"ERROR");Level.FATAL=new Level(60000,"FATAL");Level.OFF=new Level(Number.MAX_VALUE,"OFF");log4javascript.Level=Level;var LoggingEvent=function(logger,timeStamp,level,message,exception){this.logger=logger;this.timeStamp=timeStamp;this.timeStampInSeconds=Math.floor(timeStamp.getTime()/1000);this.level=level;this.message=message;this.exception=exception};LoggingEvent.prototype.getThrowableStrRep=function(){return this.exception?getExceptionStringRep(this.exception):""};log4javascript.LoggingEvent=LoggingEvent;var Layout=function(){};Layout.prototype={defaults:{loggerKey:"logger",timeStampKey:"timestamp",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url"},loggerKey:"logger",timeStampKey:"timestamp",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url",batchHeader:"",batchFooter:"",batchSeparator:"",format:function(loggingEvent){handleError("Layout.format: layout supplied has no format() method")},ignoresThrowable:function(){handleError("Layout.ignoresThrowable: layout supplied has no ignoresThrowable() method")},getContentType:function(){return"text/plain"},allowBatching:function(){return true},getDataValues:function(loggingEvent){var dataValues=[[this.loggerKey,loggingEvent.logger.name],[this.timeStampKey,loggingEvent.timeStampInSeconds],[this.levelKey,loggingEvent.level.name],[this.urlKey,window.location.href],[this.messageKey,loggingEvent.message]];if(loggingEvent.exception){dataValues.push([this.exceptionKey,getExceptionStringRep(loggingEvent.exception)])}if(this.hasCustomFields()){for(var i=0;i<this.customFields.length;i++){dataValues.push([this.customFields[i].name,this.customFields[i].value])}}return dataValues},setKeys:function(loggerKey,timeStampKey,levelKey,messageKey,exceptionKey,urlKey){this.loggerKey=extractStringFromParam(loggerKey,this.defaults.loggerKey);this.timeStampKey=extractStringFromParam(timeStampKey,this.defaults.timeStampKey);this.levelKey=extractStringFromParam(levelKey,this.defaults.levelKey);this.messageKey=extractStringFromParam(messageKey,this.defaults.messageKey);this.exceptionKey=extractStringFromParam(exceptionKey,this.defaults.exceptionKey);this.urlKey=extractStringFromParam(urlKey,this.defaults.urlKey)},setCustomField:function(name,value){var fieldUpdated=false;for(var i=0;i<this.customFields.length;i++){if(this.customFields[i].name===name){this.customFields[i].value=value;fieldUpdated=true}}if(!fieldUpdated){this.customFields.push({"name":name,"value":value})}},hasCustomFields:function(){return(this.customFields.length>0)}};log4javascript.Layout=Layout;var SimpleLayout=function(){this.customFields=[]};SimpleLayout.prototype=new Layout();SimpleLayout.prototype.format=function(loggingEvent){return loggingEvent.level.name+" - "+loggingEvent.message};SimpleLayout.prototype.ignoresThrowable=function(loggingEvent){return true};log4javascript.SimpleLayout=SimpleLayout;var NullLayout=function(){this.customFields=[]};NullLayout.prototype=new Layout();NullLayout.prototype.format=function(loggingEvent){return loggingEvent.message};NullLayout.prototype.ignoresThrowable=function(loggingEvent){return true};log4javascript.NullLayout=NullLayout;var XmlLayout=function(){this.customFields=[]};XmlLayout.prototype=new Layout();XmlLayout.prototype.getContentType=function(){return"text/xml"};XmlLayout.prototype.escapeCdata=function(str){return str.replace(/\]\]>/,"]]>]]><![CDATA[")};XmlLayout.prototype.format=function(loggingEvent){var str="<log4javascript:event logger=\""+loggingEvent.logger.name+"\" timestamp=\""+loggingEvent.timeStampInSeconds+"\" level=\""+loggingEvent.level.name+"\">"+newLine+"<log4javascript:message><![CDATA["+this.escapeCdata(loggingEvent.message.toString())+"]]></log4javascript:message>"+newLine;if(this.hasCustomFields()){for(var i=0;i<this.customFields.length;i++){str+="<log4javascript:customfield name=\""+this.customFields[i].name+"\"><![CDATA["+this.customFields[i].value.toString()+"]]></log4javascript:customfield>"+newLine}}if(loggingEvent.exception){str+="<log4javascript:exception><![CDATA["+getExceptionStringRep(loggingEvent.exception)+"]]></log4javascript:exception>"+newLine}str+="</log4javascript:event>"+newLine+newLine;return str};XmlLayout.prototype.ignoresThrowable=function(loggingEvent){return false};log4javascript.XmlLayout=XmlLayout;var JsonLayout=function(readable,loggerKey,timeStampKey,levelKey,messageKey,exceptionKey,urlKey){this.readable=bool(readable);this.batchHeader=this.readable?"["+newLine:"[";this.batchFooter=this.readable?"]"+newLine:"]";this.batchSeparator=this.readable?","+newLine:",";this.setKeys(loggerKey,timeStampKey,levelKey,messageKey,exceptionKey,urlKey);this.propertySeparator=this.readable?", ":",";this.colon=this.readable?": ":":";this.customFields=[]};JsonLayout.prototype=new Layout();JsonLayout.prototype.setReadable=function(readable){this.readable=bool(readable)};JsonLayout.prototype.isReadable=function(){return this.readable};JsonLayout.prototype.format=function(loggingEvent){var dataValues=this.getDataValues(loggingEvent);var str="{";if(this.readable){str+=newLine}for(var i=0;i<dataValues.length;i++){if(this.readable){str+="\t"}var valType=typeof dataValues[i][1];var val=(valType!="number"&&valType!="boolean")?"\""+escapeNewLines(dataValues[i][1].toString().replace(/\"/g,"\\\""))+"\"":dataValues[i][1];str+="\""+dataValues[i][0]+"\""+this.colon+val;if(i<dataValues.length-1){str+=this.propertySeparator}if(this.readable){str+=newLine}}str+="}";if(this.readable){str+=newLine}return str};JsonLayout.prototype.ignoresThrowable=function(loggingEvent){return false};log4javascript.JsonLayout=JsonLayout;var HttpPostDataLayout=function(loggerKey,timeStampKey,levelKey,messageKey,exceptionKey,urlKey){this.setKeys(loggerKey,timeStampKey,levelKey,messageKey,exceptionKey,urlKey);this.customFields=[]};HttpPostDataLayout.prototype=new Layout();HttpPostDataLayout.prototype.allowBatching=function(){return false};HttpPostDataLayout.prototype.format=function(loggingEvent){var dataValues=this.getDataValues(loggingEvent);var queryBits=[];for(var i=0;i<dataValues.length;i++){queryBits.push(urlEncode(dataValues[i][0])+"="+urlEncode(dataValues[i][1]))}return queryBits.join("&")};HttpPostDataLayout.prototype.ignoresThrowable=function(loggingEvent){return false};log4javascript.HttpPostDataLayout=HttpPostDataLayout;var PatternLayout=function(pattern){if(pattern){this.pattern=pattern}else{this.pattern=PatternLayout.DEFAULT_CONVERSION_PATTERN}this.customFields=[]};PatternLayout.TTCC_CONVERSION_PATTERN="%r %p %c - %m%n";PatternLayout.DEFAULT_CONVERSION_PATTERN="%m%n";PatternLayout.ISO8601_DATEFORMAT="yyyy-MM-dd HH:mm:ss,SSS";PatternLayout.DATETIME_DATEFORMAT="dd MMM yyyy HH:mm:ss,SSS";PatternLayout.ABSOLUTETIME_DATEFORMAT="HH:mm:ss,SSS";PatternLayout.prototype=new Layout();PatternLayout.prototype.format=function(loggingEvent){var regex=/%(-?[0-9]+)?(\.?[0-9]+)?([cdfmMnpr%])(\{([^\}]+)\})?|([^%]+)/;var formattedString="";var result;var searchString=this.pattern;while((result=regex.exec(searchString))){var matchedString=result[0];var padding=result[1];var truncation=result[2];var conversionCharacter=result[3];var specifier=result[5];var text=result[6];if(text){formattedString+=""+text}else{var replacement="";switch(conversionCharacter){case"c":var loggerName=loggingEvent.logger.name;if(specifier){var precision=parseInt(specifier,10);var loggerNameBits=loggingEvent.logger.name.split(".");if(precision>=loggerNameBits.length){replacement=loggerName}else{replacement=loggerNameBits.slice(loggerNameBits.length-precision).join(".")}}else{replacement=loggerName}break;case"d":var dateFormat=PatternLayout.ISO8601_DATEFORMAT;if(specifier){dateFormat=specifier;if(dateFormat=="ISO8601"){dateFormat=PatternLayout.ISO8601_DATEFORMAT}else if(dateFormat=="ABSOLUTE"){dateFormat=PatternLayout.ABSOLUTETIME_DATEFORMAT}else if(dateFormat=="DATE"){dateFormat=PatternLayout.DATETIME_DATEFORMAT}}replacement=(new SimpleDateFormat(dateFormat)).format(loggingEvent.timeStamp);break;case"f":if(this.hasCustomFields()){var fieldIndex=0;if(specifier){fieldIndex=parseInt(specifier,10);if(isNaN(fieldIndex)){handleError("PatternLayout.format: invalid specifier '"+specifier+"' for conversion character 'f' - should be a number")}else if(fieldIndex===0){handleError("PatternLayout.format: invalid specifier '"+specifier+"' for conversion character 'f' - must be greater than zero")}else if(fieldIndex>this.customFields.length){handleError("PatternLayout.format: invalid specifier '"+specifier+"' for conversion character 'f' - there aren't that many custom fields")}else{fieldIndex=fieldIndex-1}}replacement=this.customFields[fieldIndex].value}break;case"m":if(specifier){var depth=parseInt(specifier,10);if(isNaN(depth)){handleError("PatternLayout.format: invalid specifier '"+specifier+"' for conversion character 'm' - should be a number");replacement=loggingEvent.message}else{replacement=formatObjectExpansion(loggingEvent.message,depth)}}else{replacement=loggingEvent.message}break;case"n":replacement=newLine;break;case"p":replacement=loggingEvent.level.name;break;case"r":replacement=""+loggingEvent.timeStamp.getDifference(applicationStartDate);break;case"%":replacement="%";break;default:replacement=matchedString;break}var len;if(truncation){len=parseInt(truncation.substr(1),10);var strLen=replacement.length;if(len<strLen){replacement=replacement.substring(strLen-len,strLen)}}if(padding){if(padding.charAt(0)=="-"){len=parseInt(padding.substr(1),10);while(replacement.length<len){replacement+=" "}}else{len=parseInt(padding,10);while(replacement.length<len){replacement=" "+replacement}}}formattedString+=replacement}searchString=searchString.substr(result.index+result[0].length)}return formattedString};PatternLayout.prototype.ignoresThrowable=function(loggingEvent){return true};log4javascript.PatternLayout=PatternLayout;var Appender=function(){};Appender.prototype={layout:new PatternLayout(),threshold:Level.ALL,doAppend:function(loggingEvent){if(enabled&&loggingEvent.level.level>=this.threshold.level){this.append(loggingEvent)}},append:function(loggingEvent){},setLayout:function(layout){if(layout instanceof Layout){this.layout=layout}else{handleError("Appender.setLayout: layout supplied to "+this.toString()+" is not a subclass of Layout")}},getLayout:function(){return this.layout},setThreshold:function(threshold){if(threshold instanceof Level){this.threshold=threshold}else{handleError("Appender.setThreshold: threshold supplied to "+this.toString()+" is not a subclass of Level")}},getThreshold:function(){return this.threshold},toString:function(){return"[Base Appender]"}};log4javascript.Appender=Appender;var AlertAppender=function(layout){if(layout){this.setLayout(layout)}};AlertAppender.prototype=new Appender();AlertAppender.prototype.layout=new SimpleLayout();AlertAppender.prototype.append=function(loggingEvent){var formattedMessage=this.getLayout().format(loggingEvent);if(this.getLayout().ignoresThrowable()){formattedMessage+=loggingEvent.getThrowableStrRep()}alert(formattedMessage)};AlertAppender.prototype.toString=function(){return"[AlertAppender]"};log4javascript.AlertAppender=AlertAppender;var AjaxAppender=function(url,layout,timed,waitForResponse,batchSize,timerInterval,requestSuccessCallback,failCallback){var appender=this;var isSupported=true;if(!url){handleError("AjaxAppender: URL must be specified in constructor");isSupported=false}timed=extractBooleanFromParam(timed,this.defaults.timed);waitForResponse=extractBooleanFromParam(waitForResponse,this.defaults.waitForResponse);batchSize=extractIntFromParam(batchSize,this.defaults.batchSize);timerInterval=extractIntFromParam(timerInterval,this.defaults.timerInterval);requestSuccessCallback=extractFunctionFromParam(requestSuccessCallback,this.defaults.requestSuccessCallback);failCallback=extractFunctionFromParam(failCallback,this.defaults.failCallback);var sessionId=null;var queuedLoggingEvents=[];var queuedRequests=[];var sending=false;var initialized=false;function checkCanConfigure(configOptionName){if(initialized){handleError("AjaxAppender: configuration option '"+configOptionName+"' may not be set after the appender has been initialized");return false}return true}this.getSessionId=function(){return sessionId};this.setSessionId=function(sessionIdParam){sessionId=extractStringFromParam(sessionIdParam,null);this.layout.setCustomField("sessionid",sessionId)};this.setLayout=function(layout){if(checkCanConfigure("layout")){this.layout=layout;if(sessionId!==null){this.setSessionId(sessionId)}}};if(layout){this.setLayout(layout)}this.isTimed=function(){return timed};this.setTimed=function(timedParam){if(checkCanConfigure("timed")){timed=bool(timedParam)}};this.getTimerInterval=function(){return timerInterval};this.setTimerInterval=function(timerIntervalParam){if(checkCanConfigure("timerInterval")){timerInterval=extractIntFromParam(timerIntervalParam,timerInterval)}};this.isWaitForResponse=function(){return waitForResponse};this.setWaitForResponse=function(waitForResponseParam){if(checkCanConfigure("waitForResponse")){waitForResponse=bool(waitForResponseParam)}};this.getBatchSize=function(){return batchSize};this.setBatchSize=function(batchSizeParam){if(checkCanConfigure("batchSize")){batchSize=extractIntFromParam(batchSizeParam,batchSize)}};this.setRequestSuccessCallback=function(requestSuccessCallbackParam){requestSuccessCallback=extractFunctionFromParam(requestSuccessCallbackParam,requestSuccessCallback)};this.setFailCallback=function(failCallbackParam){failCallback=extractFunctionFromParam(failCallbackParam,failCallback)};function sendAll(){if(isSupported&&enabled){sending=true;var currentRequestBatch;if(waitForResponse){if(queuedRequests.length>0){currentRequestBatch=queuedRequests.shift();sendRequest(preparePostData(currentRequestBatch),sendAll)}else{sending=false;if(timed){scheduleSending()}}}else{while((currentRequestBatch=queuedRequests.shift())){sendRequest(preparePostData(currentRequestBatch))}sending=false;if(timed){scheduleSending()}}}}this.sendAll=sendAll;function preparePostData(batchedLoggingEvents){var formattedMessages=[];var currentLoggingEvent;var postData="";while((currentLoggingEvent=batchedLoggingEvents.shift())){var currentFormattedMessage=appender.getLayout().format(currentLoggingEvent);if(appender.getLayout().ignoresThrowable()){currentFormattedMessage+=loggingEvent.getThrowableStrRep()}formattedMessages.push(currentFormattedMessage)}if(batchedLoggingEvents.length==1){postData=formattedMessages.join("")}else{postData=appender.getLayout().batchHeader+formattedMessages.join(appender.getLayout().batchSeparator)+appender.getLayout().batchFooter}return postData}function scheduleSending(){setTimeout(sendAll,timerInterval)}function getXmlHttp(){var xmlHttp=null;if(typeof XMLHttpRequest=="object"||typeof XMLHttpRequest=="function"){xmlHttp=new XMLHttpRequest()}else{try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e2){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e3){var msg="AjaxAppender: could not create XMLHttpRequest object. AjaxAppender disabled";handleError(msg);isSupported=false;if(failCallback){failCallback(msg)}}}}return xmlHttp}function sendRequest(postData,successCallback){try{var xmlHttp=getXmlHttp();if(isSupported){if(xmlHttp.overrideMimeType){xmlHttp.overrideMimeType(appender.getLayout().getContentType())}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){var success=(isUndefined(xmlHttp.status)||xmlHttp.status===0||(xmlHttp.status>=200&&xmlHttp.status<300));if(success){if(requestSuccessCallback){requestSuccessCallback(xmlHttp)}if(successCallback){successCallback(xmlHttp)}}else{var msg="AjaxAppender.append: XMLHttpRequest request to URL "+url+" returned status code "+xmlHttp.status;handleError(msg);if(failCallback){failCallback(msg)}}xmlHttp.onreadystatechange=emptyFunction;xmlHttp=null}};xmlHttp.open("POST",url,true);try{xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(headerEx){var msg="AjaxAppender.append: your browser's XMLHttpRequest implementation"+" does not support setRequestHeader, therefore cannot post data. AjaxAppender disabled";handleError(msg);isSupported=false;if(failCallback){failCallback(msg)}return}xmlHttp.send(postData)}}catch(ex){var msg="AjaxAppender.append: error sending log message to "+url;handleError(msg,ex);if(failCallback){failCallback(msg+". Details: "+getExceptionStringRep(ex))}}}this.append=function(loggingEvent){if(isSupported){if(!initialized){init()}queuedLoggingEvents.push(loggingEvent);var actualBatchSize=this.getLayout().allowBatching()?batchSize:1;if(queuedLoggingEvents.length>=actualBatchSize){var currentLoggingEvent;var postData="";var batchedLoggingEvents=[];while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent)}queuedRequests.push(batchedLoggingEvents);if(!timed){if(!waitForResponse||(waitForResponse&&!sending)){sendAll()}}}}};function init(){initialized=true;if(timed){scheduleSending()}}};AjaxAppender.prototype=new Appender();AjaxAppender.prototype.defaults={waitForResponse:false,timed:false,timerInterval:1000,batchSize:1,requestSuccessCallback:null,failCallback:null};AjaxAppender.prototype.layout=new HttpPostDataLayout();AjaxAppender.prototype.toString=function(){return"[AjaxAppender]"};log4javascript.AjaxAppender=AjaxAppender;(function(){var getConsoleHtmlLines=function(){return['<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">','<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">','<head>','<title>log4javascript</title>','<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />','<script type="text/javascript">','//<![CDATA[','var loggingEnabled=true;function toggleLoggingEnabled(){setLoggingEnabled($("enableLogging").checked)}function setLoggingEnabled(enable){loggingEnabled=enable}var newestAtTop=false;function setNewestAtTop(isNewestAtTop){var oldNewestAtTop=newestAtTop;newestAtTop=Boolean(isNewestAtTop);if(oldNewestAtTop!=newestAtTop){var lc=getLogContainer();var numberOfEntries=lc.childNodes.length;var node=null;var logContainerChildNodes=[];while((node=lc.firstChild)){lc.removeChild(node);logContainerChildNodes.push(node)}while((node=logContainerChildNodes.pop())){lc.appendChild(node)}if(currentSearch){var currentMatch=currentSearch.matches[currentMatchIndex];var matchIndex=0;var matches=[];var actOnLogEntry=function(logEntry){var logEntryMatches=logEntry.getSearchMatches();for(var i=0;i<logEntryMatches.length;i++){matches[matchIndex]=logEntryMatches[i];if(currentMatch&&logEntryMatches[i].equals(currentMatch)){currentMatchIndex=matchIndex}matchIndex++}};var i;if(newestAtTop){for(i=logEntries.length-1;i>=0;i--){actOnLogEntry(logEntries[i])}}else{for(i=0;i<logEntries.length;i++){actOnLogEntry(logEntries[i])}}currentSearch.matches=matches;if(currentMatch){currentMatch.setCurrent()}}else if(scrollToLatest){doScrollToLatest()}}$("newestAtTop").checked=isNewestAtTop}function toggleNewestAtTop(){var isNewestAtTop=$("newestAtTop").checked;setNewestAtTop(isNewestAtTop)}var scrollToLatest=true;function setScrollToLatest(isScrollToLatest){scrollToLatest=isScrollToLatest;if(scrollToLatest){doScrollToLatest()}$("scrollToLatest").checked=isScrollToLatest}function toggleScrollToLatest(){var isScrollToLatest=$("scrollToLatest").checked;setScrollToLatest(isScrollToLatest)}function doScrollToLatest(){var l=getLogContainer();if(typeof l.scrollTop!="undefined"){if(newestAtTop){l.scrollTop=0}else{var latestLogEntry=l.lastChild;if(latestLogEntry){l.scrollTop=l.scrollHeight}}}}var maxMessages=null;function setMaxMessages(max){maxMessages=max;pruneLogEntries()}var logQueuedEventsTimer=null;var logEntries=[];var isCssWrapSupported;var renderDelay=100;function log(logLevel,formattedMessage){if(loggingEnabled){var logEntry=new LogEntry(logLevel,formattedMessage);logEntries.push(logEntry);if(loaded){if(logQueuedEventsTimer!==null){clearTimeout(logQueuedEventsTimer)}setTimeout(renderQueuedLogEntries,renderDelay)}}}function renderQueuedLogEntries(){logQueuedEventsTimer=null;var pruned=pruneLogEntries();var initiallyHasMatches=currentSearch?currentSearch.hasMatches():false;for(var i=0;i<logEntries.length;i++){if(!logEntries[i].isRendered){logEntries[i].render();logEntries[i].appendToLog();if(currentSearch){currentSearch.applyTo(logEntries[i])}}}if(currentSearch){if(pruned){if(currentSearch.hasMatches()){if(currentMatchIndex===null){setCurrentMatchIndex(0)}displayMatches()}else{displayNoMatches()}}else if(!initiallyHasMatches&¤tSearch.hasMatches()){setCurrentMatchIndex(0);displayMatches()}}if(scrollToLatest){doScrollToLatest()}}function pruneLogEntries(){if((maxMessages!==null)&&(logEntries.length>maxMessages)){var numberToDelete=logEntries.length-maxMessages;for(var i=0;i<numberToDelete;i++){logEntries[i].remove()}logEntries=array_removeFromStart(logEntries,numberToDelete);if(currentSearch){currentSearch.removePrunedMatches()}return true}return false}function LogEntry(level,formattedMessage){this.level=level;this.formattedMessage=formattedMessage;this.isRendered=false}LogEntry.prototype={render:function(){this.mainDiv=document.createElement("div");this.mainDiv.className="logentry "+this.level.name;if(isCssWrapSupported){this.mainDiv.appendChild(document.createTextNode(this.formattedMessage))}else{this.formattedMessage=this.formattedMessage.replace(/\\r\\n/g,"\\r");this.unwrappedPre=this.mainDiv.appendChild(document.createElement("pre"));this.unwrappedPre.appendChild(document.createTextNode(this.formattedMessage));this.unwrappedPre.className="unwrapped";this.wrappedSpan=this.mainDiv.appendChild(document.createElement("span"));this.wrappedSpan.appendChild(document.createTextNode(this.formattedMessage));this.wrappedSpan.className="wrapped"}this.content=this.formattedMessage;this.isRendered=true},appendToLog:function(){var lc=getLogContainer();if(newestAtTop&&lc.hasChildNodes()){lc.insertBefore(this.mainDiv,lc.firstChild)}else{getLogContainer().appendChild(this.mainDiv)}},setContent:function(content){if(content!=this.content){if(getLogContainer().currentStyle){if(content===this.formattedMessage){this.unwrappedPre.innerHTML="";this.unwrappedPre.appendChild(document.createTextNode(this.formattedMessage));this.wrappedSpan.innerHTML="";this.wrappedSpan.appendChild(document.createTextNode(this.formattedMessage))}else{content=content.replace(/\\r\\n/g,"\\r");this.unwrappedPre.innerHTML=content;this.wrappedSpan.innerHTML=content}}else{if(content===this.formattedMessage){this.mainDiv.innerHTML="";this.mainDiv.appendChild(document.createTextNode(this.formattedMessage))}else{this.mainDiv.innerHTML=content}}this.content=content}},getSearchMatches:function(){var matches=[];if(isCssWrapSupported){var els=getElementsByClass(this.mainDiv,"searchterm","span");for(var i=0;i<els.length;i++){matches[i]=new Match(this.level,els[i])}}else{var unwrappedEls=getElementsByClass(this.unwrappedPre,"searchterm","span");var wrappedEls=getElementsByClass(this.wrappedSpan,"searchterm","span");for(i=0;i<unwrappedEls.length;i++){matches[i]=new Match(this.level,null,unwrappedEls[i],wrappedEls[i])}}return matches},remove:function(){if(this.isRendered){this.mainDiv.parentNode.removeChild(this.mainDiv);this.mainDiv=null}}};function mainPageReloaded(){var separator=document.createElement("div");separator.className="separator";separator.innerHTML=" ";getLogContainer().appendChild(separator)}window.onload=function(){isCssWrapSupported=(typeof getLogContainer().currentStyle=="undefined");setLogContainerHeight();toggleLoggingEnabled();toggleSearchEnabled();toggleSearchFilter();toggleSearchHighlight();applyFilters();toggleWrap();toggleNewestAtTop();toggleScrollToLatest();renderQueuedLogEntries();loaded=true;setTimeout(setLogContainerHeight,20);if(window!=top){$("closeButton").style.display="none"}};var loaded=false;var logLevels=["TRACE","DEBUG","INFO","WARN","ERROR","FATAL"];function getCheckBox(logLevel){return $("switch_"+logLevel)}function getLogContainer(){return $("log")}function applyFilters(){for(var i=0;i<logLevels.length;i++){if(getCheckBox(logLevels[i]).checked){addClass(getLogContainer(),logLevels[i])}else{removeClass(getLogContainer(),logLevels[i])}}updateSearchFromFilters()}function toggleAllLevels(){var turnOn=$("switch_ALL").checked;for(var i=0;i<logLevels.length;i++){getCheckBox(logLevels[i]).checked=turnOn;if(turnOn){addClass(getLogContainer(),logLevels[i])}else{removeClass(getLogContainer(),logLevels[i])}}}function checkAllLevels(){for(var i=0;i<logLevels.length;i++){if(!getCheckBox(logLevels[i]).checked){getCheckBox("ALL").checked=false;return}}getCheckBox("ALL").checked=true}function clearLog(){getLogContainer().innerHTML="";logEntries=[];doSearch()}function toggleWrap(){var enable=$("wrap").checked;if(enable){addClass(getLogContainer(),"wrap")}else{removeClass(getLogContainer(),"wrap")}refreshCurrentMatch()}var searchTimer=null;function scheduleSearch(){try{clearTimeout(searchTimer)}catch(ex){}searchTimer=setTimeout(doSearch,500)}function Search(searchTerm,isRegex,searchRegex,isCaseSensitive){this.searchTerm=searchTerm;this.isRegex=isRegex;this.searchRegex=searchRegex;this.isCaseSensitive=isCaseSensitive;this.matches=[]}Search.prototype={hasMatches:function(){return this.matches.length>0},hasVisibleMatches:function(){if(this.hasMatches()){for(var i=0;i<=this.matches.length;i++){if(this.matches[i].isVisible()){return true}}}return false},match:function(logEntry){var entryText=logEntry.formattedMessage;var matchesSearch=false;if(this.isRegex){matchesSearch=this.searchRegex.test(entryText)}else if(this.isCaseSensitive){matchesSearch=(entryText.indexOf(this.searchTerm)>-1)}else{matchesSearch=(entryText.toLowerCase().indexOf(this.searchTerm.toLowerCase())>-1)}return matchesSearch},getNextVisibleMatchIndex:function(){for(var i=currentMatchIndex+1;i<this.matches.length;i++){if(this.matches[i].isVisible()){return i}}for(var i=0;i<=currentMatchIndex;i++){if(this.matches[i].isVisible()){return i}}return-1},getPreviousVisibleMatchIndex:function(){for(var i=currentMatchIndex-1;i>=0;i--){if(this.matches[i].isVisible()){return i}}for(var i=this.matches.length-1;i>=currentMatchIndex;i--){if(this.matches[i].isVisible()){return i}}return-1},applyTo:function(logEntry){var doesMatch=this.match(logEntry);if(doesMatch){replaceClass(logEntry.mainDiv,"searchmatch","searchnonmatch");var logEntryContent;if(this.isRegex){var flags=this.isCaseSensitive?"g":"gi";var capturingRegex=new RegExp("("+this.searchRegex.source+")",flags);logEntryContent=logEntry.formattedMessage.replace(capturingRegex,"<span class=\\\"searchterm\\\">$1</span>")}else{logEntryContent="";var searchTermReplacementStartTag="<span class=\\\"searchterm\\\">";var searchTermReplacementEndTag="</span>";var searchTermReplacementLength=searchTermReplacementStartTag.length+this.searchTerm.length+searchTermReplacementEndTag.length;var searchTermLength=this.searchTerm.length;var startIndex=0;var searchIndex;var searchTermLowerCase=this.searchTerm.toLowerCase();var logTextLowerCase=logEntry.formattedMessage.toLowerCase();while((searchIndex=logTextLowerCase.indexOf(searchTermLowerCase,startIndex))>-1){var searchTermReplacement=searchTermReplacementStartTag+logEntry.formattedMessage.substr(searchIndex,this.searchTerm.length)+searchTermReplacementEndTag;logEntryContent+=logEntry.formattedMessage.substring(startIndex,searchIndex)+searchTermReplacement;startIndex=searchIndex+searchTermLength}logEntryContent+=logEntry.formattedMessage.substr(startIndex)}logEntry.setContent(logEntryContent);var logEntryMatches=logEntry.getSearchMatches();this.matches=this.matches.concat(logEntryMatches)}else{replaceClass(logEntry.mainDiv,"searchnonmatch","searchmatch");logEntry.setContent(logEntry.formattedMessage)}return doesMatch},removePrunedMatches:function(){var matchesToRemoveCount=0;var currentMatchRemoved=false;for(var i=0;i<this.matches.length;i++){if(this.matches[i].isOrphan()){this.matches[i].remove();if(i===currentMatchIndex){currentMatchRemoved=true}matchesToRemoveCount++}}if(matchesToRemoveCount>0){array_removeFromStart(this.matches,matchesToRemoveCount);var newMatchIndex=currentMatchRemoved?0:currentMatchIndex-matchesToRemoveCount;if(this.hasMatches()){setCurrentMatchIndex(newMatchIndex)}else{currentMatchIndex=null}}}};function getPageOffsetTop(el){var currentEl=el;var y=0;while(currentEl){y+=currentEl.offsetTop;currentEl=currentEl.offsetParent}return y}function scrollIntoView(el){getLogContainer().scrollLeft=el.offsetLeft;getLogContainer().scrollTop=getPageOffsetTop(el)-getToolBarsHeight()}function Match(logEntryLevel,spanInMainDiv,spanInUnwrappedPre,spanInWrappedSpan){this.logEntryLevel=logEntryLevel;this.spanInMainDiv=spanInMainDiv;if(!isCssWrapSupported){this.spanInUnwrappedPre=spanInUnwrappedPre;this.spanInWrappedSpan=spanInWrappedSpan}this.mainSpan=isCssWrapSupported?spanInMainDiv:spanInUnwrappedPre}Match.prototype={equals:function(match){return this.mainSpan===match.mainSpan},setCurrent:function(){if(isCssWrapSupported){addClass(this.spanInMainDiv,"currentmatch");scrollIntoView(this.spanInMainDiv)}else{addClass(this.spanInUnwrappedPre,"currentmatch");addClass(this.spanInWrappedSpan,"currentmatch");var elementToScroll=$("wrap").checked?this.spanInWrappedSpan:this.spanInUnwrappedPre;scrollIntoView(elementToScroll)}},setNotCurrent:function(){if(isCssWrapSupported){removeClass(this.spanInMainDiv,"currentmatch")}else{removeClass(this.spanInUnwrappedPre,"currentmatch");removeClass(this.spanInWrappedSpan,"currentmatch")}},isOrphan:function(){return isOrphan(this.mainSpan)},isVisible:function(){return getCheckBox(this.logEntryLevel).checked},remove:function(){if(isCssWrapSupported){this.spanInMainDiv=null}else{this.spanInUnwrappedPre=null;this.spanInWrappedSpan=null}}};var currentSearch=null;var currentMatchIndex=null;function doSearch(){var searchBox=$("searchBox");var searchTerm=searchBox.value;var isRegex=$("searchRegex").checked;var isCaseSensitive=$("searchCaseSensitive").checked;var i;if(searchTerm===""){$("searchReset").disabled=true;$("searchNav").style.display="none";removeClass(document.body,"searching");removeClass(searchBox,"hasmatches");removeClass(searchBox,"nomatches");for(i=0;i<logEntries.length;i++){removeClass(logEntries[i].mainDiv,"searchmatch");removeClass(logEntries[i].mainDiv,"searchnonmatch");logEntries[i].setContent(logEntries[i].formattedMessage)}currentSearch=null;setLogContainerHeight()}else{$("searchReset").disabled=false;$("searchNav").style.display="block";var searchRegex;var regexValid;if(isRegex){try{searchRegex=isCaseSensitive?new RegExp(searchTerm,"g"):new RegExp(searchTerm,"gi");regexValid=true;replaceClass(searchBox,"validregex","invalidregex");searchBox.title="Valid regex"}catch(ex){regexValid=false;replaceClass(searchBox,"invalidregex","validregex");searchBox.title="Invalid regex: "+(ex.message?ex.message:(ex.description?ex.description:"unknown error"));return}}else{searchBox.title="";removeClass(searchBox,"validregex");removeClass(searchBox,"invalidregex")}addClass(document.body,"searching");currentSearch=new Search(searchTerm,isRegex,searchRegex,isCaseSensitive);for(i=0;i<logEntries.length;i++){currentSearch.applyTo(logEntries[i])}setLogContainerHeight();if(currentSearch.hasMatches()){setCurrentMatchIndex(0);displayMatches()}else{displayNoMatches()}}}function updateSearchFromFilters(){if(currentSearch&¤tSearch.hasMatches()){var currentMatch=currentSearch.matches[currentMatchIndex];if(currentMatch.isVisible()){displayMatches();setCurrentMatchIndex(currentMatchIndex)}else{currentMatch.setNotCurrent();var nextVisibleMatchIndex=currentSearch.getNextVisibleMatchIndex();if(nextVisibleMatchIndex>-1){setCurrentMatchIndex(nextVisibleMatchIndex);displayMatches()}else{displayNoMatches()}}}}function refreshCurrentMatch(){if(currentSearch&¤tSearch.hasMatches()){setCurrentMatchIndex(currentMatchIndex)}}function displayMatches(){replaceClass($("searchBox"),"hasmatches","nomatches");$("searchBox").title=""+currentSearch.matches.length+" matches found";$("searchNav").style.display="block";setLogContainerHeight()}function displayNoMatches(){replaceClass($("searchBox"),"nomatches","hasmatches");$("searchBox").title="No matches found";$("searchNav").style.display="none";setLogContainerHeight()}function toggleSearchEnabled(enable){enable=(typeof enable=="undefined")?!$("searchDisable").checked:enable;$("searchBox").disabled=!enable;$("searchReset").disabled=!enable;$("searchRegex").disabled=!enable;$("searchNext").disabled=!enable;$("searchPrevious").disabled=!enable;$("searchCaseSensitive").disabled=!enable;$("searchNav").style.display=(enable&&($("searchBox").value!==""))?"block":"none";if(enable){removeClass($("search"),"greyedout");addClass(document.body,"searching");if($("searchHighlight").checked){addClass(getLogContainer(),"searchhighlight")}else{removeClass(getLogContainer(),"searchhighlight")}if($("searchFilter").checked){addClass(getLogContainer(),"searchfilter")}else{removeClass(getLogContainer(),"searchfilter")}$("searchDisable").checked=!enable}else{addClass($("search"),"greyedout");removeClass(document.body,"searching");removeClass(getLogContainer(),"searchhighlight");removeClass(getLogContainer(),"searchfilter")}setLogContainerHeight()}function toggleSearchFilter(){var enable=$("searchFilter").checked;if(enable){addClass(getLogContainer(),"searchfilter")}else{removeClass(getLogContainer(),"searchfilter")}refreshCurrentMatch()}function toggleSearchHighlight(){var enable=$("searchHighlight").checked;if(enable){addClass(getLogContainer(),"searchhighlight")}else{removeClass(getLogContainer(),"searchhighlight")}}function clearSearch(){$("searchBox").value="";doSearch()}function searchNext(){try{if(currentSearch!==null&¤tMatchIndex!==null){currentSearch.matches[currentMatchIndex].setNotCurrent();var nextMatchIndex=currentSearch.getNextVisibleMatchIndex();if(nextMatchIndex>currentMatchIndex||confirm("Reached the end of the page. Start from the top?")){setCurrentMatchIndex(nextMatchIndex)}}}catch(err){alert("currentMatchIndex is "+currentMatchIndex)}}function searchPrevious(){if(currentSearch!==null&¤tMatchIndex!==null){currentSearch.matches[currentMatchIndex].setNotCurrent();var previousMatchIndex=currentSearch.getPreviousVisibleMatchIndex();if(previousMatchIndex<currentMatchIndex||confirm("Reached the start of the page. Continue from the bottom?")){setCurrentMatchIndex(previousMatchIndex)}}}function setCurrentMatchIndex(index){currentMatchIndex=index;currentSearch.matches[currentMatchIndex].setCurrent()}function addClass(el,cssClass){if(!hasClass(el,cssClass)){if(el.className){el.className+=" "+cssClass}else{el.className=cssClass}}}function hasClass(el,cssClass){if(el.className){var classNames=el.className.split(" ");return array_contains(classNames,cssClass)}return false}function removeClass(el,cssClass){if(hasClass(el,cssClass)){var existingClasses=el.className.split(" ");var newClasses=[];for(var i=0;i<existingClasses.length;i++){if(existingClasses[i]!=cssClass){newClasses[newClasses.length]=existingClasses[i]}}el.className=newClasses.join(" ")}}function replaceClass(el,newCssClass,oldCssClass){removeClass(el,oldCssClass);addClass(el,newCssClass)}function getElementsByClass(el,cssClass,tagName){var elements=el.getElementsByTagName(tagName);var matches=[];for(var i=0;i<elements.length;i++){if(hasClass(elements[i],cssClass)){matches.push(elements[i])}}return matches}function $(id){return document.getElementById(id)}function isOrphan(node){var currentNode=node;while(currentNode){if(currentNode==document.body){return false}currentNode=currentNode.parentNode}return true}function getWindowWidth(){if(window.innerWidth){return window.innerWidth}else if(document.documentElement&&document.documentElement.clientWidth){return document.documentElement.clientWidth}else if(document.body){return document.body.clientWidth}return 0}function getWindowHeight(){if(window.innerHeight){return window.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight}else if(document.body){return document.body.clientHeight}return 0}function getToolBarsHeight(){return $("switches").offsetHeight}function setLogContainerHeight(){var windowHeight=getWindowHeight();$("body").style.height=getWindowHeight()+"px";getLogContainer().style.height=""+(windowHeight-getToolBarsHeight())+"px"}window.onresize=setLogContainerHeight;if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0;i<arguments.length;i++){this[this.length]=arguments[i]}return this.length}}if(!Array.prototype.pop){Array.prototype.pop=function(){if(this.length>0){var val=this[this.length-1];this.length=this.length-1;return val}}}if(!Array.prototype.shift){Array.prototype.shift=function(){if(this.length>0){var firstItem=this[0];for(var i=0;i<this.length-1;i++){this[i]=this[i+1]}this.length=this.length-1;return firstItem}}}function array_removeFromStart(array,numberToRemove){if(Array.prototype.splice){array.splice(0,numberToRemove)}else{for(var i=numberToRemove;i<array.length;i++){array[i-numberToRemove]=array[i]}array.length=array.length-numberToRemove}return array}function array_contains(arr,val){for(var i=0;i<arr.length;i++){if(arr[i]==val){return true}}return false}','//]]>','</script>','<style type="text/css">','body{background-color:white;color:black;padding:0px;margin:0px;font-family:tahoma,verdana,arial,helvetica,sans-serif;overflow:hidden}div#switchesContainer input{margin-bottom:0px}div#switches div.toolbar{border-top:solid #ffffff 1px;border-bottom:solid #aca899 1px;background-color:#f1efe7;padding:3px 5px;font-size:68.75%}div#switches div.toolbar,div#search input{font-family:tahoma,verdana,arial,helvetica,sans-serif}div#switches input.button{padding:0px 5px;font-size:100%}div#switches input#clearButton{margin-left:20px}div#levels label{font-weight:bold}div#levels label,div#options label{margin-right:5px}div#levels label#wrapLabel{font-weight:normal}div#search{padding:5px 0px}div#search label{margin-right:10px}div#search label.searchboxlabel{margin-right:0px}div#search input{font-size:100%}div#search input.validregex{color:green}div#search input.invalidregex{color:red}div#search input.nomatches{color:white;background-color:#ff6666}div#search input.nomatches{color:white;background-color:#ff6666}*.greyedout{color:gray}*.greyedout *.alwaysenabled{color:black}div#log{font-family:Courier New,Courier;font-size:75%;width:100%;overflow:auto}*.logentry{overflow:visible;display:none;white-space:pre}*.logentry pre.unwrapped{display:inline}*.logentry span.wrapped{display:none}body.searching *.logentry span.currentmatch{color:white !important;background-color:green !important}body.searching div.searchhighlight *.logentry span.searchterm{color:black;background-color:yellow}div.wrap *.logentry{white-space:normal !important;border-width:0px 0px 1px 0px;border-color:#dddddd;border-style:dotted}div.wrap *.logentry pre.unwrapped{display:none}div.wrap *.logentry span.wrapped{display:inline}div.searchfilter *.searchnonmatch{display:none !important}div#log *.TRACE,label#label_TRACE{color:#666666}div#log *.DEBUG,label#label_DEBUG{color:green}div#log *.INFO,label#label_INFO{color:#000099}div#log *.WARN,label#label_WARN{color:#999900}div#log *.ERROR,label#label_ERROR{color:red}div#log *.FATAL,label#label_FATAL{color:#660066}div.TRACE#log *.TRACE,div.DEBUG#log *.DEBUG,div.INFO#log *.INFO,div.WARN#log *.WARN,div.ERROR#log *.ERROR,div.FATAL#log *.FATAL{display:block}div#log div.separator{background-color:#cccccc;margin:5px 0px;line-height:1px}','</style>','</head>','<body id="body">','<div id="switchesContainer">','<div id="switches">','<div id="levels" class="toolbar">','Filters:','<input type="checkbox" id="switch_TRACE" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide trace messages" /><label for="switch_TRACE" id="label_TRACE">trace</label>','<input type="checkbox" id="switch_DEBUG" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide debug messages" /><label for="switch_DEBUG" id="label_DEBUG">debug</label>','<input type="checkbox" id="switch_INFO" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide info messages" /><label for="switch_INFO" id="label_INFO">info</label>','<input type="checkbox" id="switch_WARN" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide warn messages" /><label for="switch_WARN" id="label_WARN">warn</label>','<input type="checkbox" id="switch_ERROR" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide error messages" /><label for="switch_ERROR" id="label_ERROR">error</label>','<input type="checkbox" id="switch_FATAL" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide fatal messages" /><label for="switch_FATAL" id="label_FATAL">fatal</label>','<input type="checkbox" id="switch_ALL" onclick="toggleAllLevels(); applyFilters()" checked="checked" title="Show/hide all messages" /><label for="switch_ALL" id="label_ALL">all</label>','</div>','<div id="search" class="toolbar">','<label for="searchBox" class="searchboxlabel">Search:</label> <input type="text" id="searchBox" onclick="toggleSearchEnabled(true)" onkeyup="scheduleSearch()" size="20" />','<input type="button" id="searchReset" disabled="disabled" value="Reset" onclick="clearSearch()" class="button" title="Reset the search" />','<input type="checkbox" id="searchRegex" onclick="doSearch()" title="If checked, search is treated as a regular expression" /><label for="searchRegex">Regex</label>','<input type="checkbox" id="searchCaseSensitive" onclick="doSearch()" title="If checked, search is case sensitive" /><label for="searchCaseSensitive">Match case</label>','<input type="checkbox" id="searchDisable" onclick="toggleSearchEnabled()" title="Enable/disable search" /><label for="searchDisable" class="alwaysenabled">Disable</label>','<div id="searchNav">','<input type="button" id="searchNext" disabled="disabled" value="Next" onclick="searchNext()" class="button" title="Go to the next matching log entry" />','<input type="button" id="searchPrevious" disabled="disabled" value="Previous" onclick="searchPrevious()" class="button" title="Go to the previous matching log entry" />','<input type="checkbox" id="searchFilter" onclick="toggleSearchFilter()" title="If checked, non-matching log entries are filtered out" /><label for="searchFilter">Filter</label>','<input type="checkbox" id="searchHighlight" onclick="toggleSearchHighlight()" title="Highlight matched search terms" /><label for="searchHighlight" class="alwaysenabled">Highlight all</label>','</div>','</div>','<div id="options" class="toolbar">','Options:','<input type="checkbox" id="enableLogging" onclick="toggleLoggingEnabled()" checked="checked" title="Enable/disable logging" /><label for="enableLogging" id="wrapLabel">Log</label>','<input type="checkbox" id="wrap" onclick="toggleWrap()" title="Enable / disable word wrap" /><label for="wrap" id="wrapLabel">Wrap</label>','<input type="checkbox" id="newestAtTop" onclick="toggleNewestAtTop()" title="If checked, causes newest messages to appear at the top" /><label for="newestAtTop" id="newestAtTopLabel">Newest at the top</label>','<input type="checkbox" id="scrollToLatest" onclick="toggleScrollToLatest()" checked="checked" title="If checked, window automatically scrolls to a new message when it is added" /><label for="scrollToLatest" id="scrollToLatestLabel">Scroll to latest</label>','<input type="button" id="clearButton" value="Clear" onclick="clearLog()" class="button" title="Clear all log messages" />','<input type="button" id="closeButton" value="Close" onclick="window.close()" class="button" title="Close the window" />','</div>','</div>','</div>','<div id="log" class="TRACE DEBUG INFO WARN ERROR FATAL"></div>','</body>','</html>']};function ConsoleAppender(){}var consoleAppenderIdCounter=1;ConsoleAppender.prototype=new Appender();ConsoleAppender.prototype.create=function(inPage,containerElement,layout,lazyInit,focusConsoleWindow,useOldPopUp,complainAboutPopUpBlocking,newestMessageAtTop,scrollToLatestMessage,initiallyMinimized,width,height,reopenWhenClosed,maxMessages){var appender=this;if(layout){this.setLayout(layout)}else{this.setLayout(this.defaults.layout)}var initialized=false;var consoleWindowLoaded=false;var queuedLoggingEvents=[];var isSupported=true;var consoleAppenderId=consoleAppenderIdCounter++;lazyInit=extractBooleanFromParam(lazyInit,true);newestMessageAtTop=extractBooleanFromParam(newestMessageAtTop,this.defaults.newestMessageAtTop);scrollToLatestMessage=extractBooleanFromParam(scrollToLatestMessage,this.defaults.scrollToLatestMessage);width=width?width:this.defaults.width;height=height?height:this.defaults.height;maxMessages=maxMessages?maxMessages:this.defaults.maxMessages;var init,safeToAppend,getConsoleWindow;var appenderName=inPage?"InPageAppender":"PopUpAppender";var checkCanConfigure=function(configOptionName){if(initialized){handleError(appenderName+": configuration option '"+configOptionName+"' may not be set after the appender has been initialized");return false}return true};this.isNewestMessageAtTop=function(){return newestMessageAtTop};this.setNewestMessageAtTop=function(newestMessageAtTopParam){newestMessageAtTop=bool(newestMessageAtTopParam);if(consoleWindowLoaded&&isSupported){getConsoleWindow().setNewestAtTop(newestMessageAtTop)}};this.isScrollToLatestMessage=function(){return scrollToLatestMessage};this.setScrollToLatestMessage=function(scrollToLatestMessageParam){scrollToLatestMessage=bool(scrollToLatestMessageParam);if(consoleWindowLoaded&&isSupported){getConsoleWindow().setScrollToLatest(scrollToLatestMessage)}};this.getWidth=function(){return width};this.setWidth=function(widthParam){if(checkCanConfigure("width")){width=extractStringFromParam(widthParam,width)}};this.getHeight=function(){return height};this.setHeight=function(heightParam){if(checkCanConfigure("height")){height=extractStringFromParam(heightParam,height)}};this.getMaxMessages=function(){return maxMessages};this.setMaxMessages=function(maxMessagesParam){maxMessages=extractIntFromParam(maxMessagesParam,maxMessages);if(consoleWindowLoaded&&isSupported){getConsoleWindow().setMaxMessages(maxMessages)}};this.append=function(loggingEvent){if(isSupported){queuedLoggingEvents.push(loggingEvent);var isSafeToAppend=safeToAppend();if(!initialized||(consoleClosed&&reopenWhenClosed)){init()}if(safeToAppend()){appendQueuedLoggingEvents()}}};var appendQueuedLoggingEvents=function(loggingEvent){while(queuedLoggingEvents.length>0){var currentLoggingEvent=queuedLoggingEvents.shift();var formattedMessage=appender.getLayout().format(currentLoggingEvent);if(appender.getLayout().ignoresThrowable()){formattedMessage+=currentLoggingEvent.getThrowableStrRep()}getConsoleWindow().log(currentLoggingEvent.level,formattedMessage)}if(focusConsoleWindow){getConsoleWindow().focus()}};var writeHtml=function(doc){var lines=getConsoleHtmlLines();doc.open();for(var i=0;i<lines.length;i++){doc.writeln(lines[i])}doc.close()};var consoleClosed=false;var pollConsoleWindow=function(windowTest,successCallback,errorMessage){function pollConsoleWindowLoaded(){try{if(consoleClosed){clearInterval(poll)}if(windowTest(getConsoleWindow())){clearInterval(poll);successCallback()}}catch(ex){clearInterval(poll);isSupported=false;handleError(errorMessage,ex)}}var poll=setInterval(pollConsoleWindowLoaded,100)};if(inPage){if(!containerElement||!containerElement.appendChild){isSupported=false;handleError("InPageAppender.init: a container DOM element must be supplied for the console window");return}initiallyMinimized=extractBooleanFromParam(initiallyMinimized,appender.defaults.initiallyMinimized);this.isInitiallyMinimized=function(){return initiallyMinimized};this.setInitiallyMinimized=function(initiallyMinimizedParam){if(checkCanConfigure("initiallyMinimized")){initiallyMinimized=bool(initiallyMinimizedParam)}};var minimized=false;var iframeContainerDiv;var iframeId=uniqueId+"_InPageAppender_"+consoleAppenderId;this.hide=function(){iframeContainerDiv.style.display="none";minimized=true};this.show=function(){iframeContainerDiv.style.display="block";minimized=false};this.isVisible=function(){return!minimized};this.close=function(){if(!consoleClosed){iframeContainerDiv.parentNode.removeChild(iframeContainerDiv);consoleClosed=true}};init=function(){var initErrorMessage="InPageAppender.init: unable to create console iframe";function finalInit(){try{getConsoleWindow().setNewestAtTop(newestMessageAtTop);getConsoleWindow().setScrollToLatest(scrollToLatestMessage);getConsoleWindow().setMaxMessages(maxMessages);consoleWindowLoaded=true;appendQueuedLoggingEvents();if(initiallyMinimized){appender.hide()}}catch(ex){isSupported=false;handleError(initErrorMessage,ex)}}function writeToDocument(){try{var windowTest=function(win){return bool(win.loaded)};writeHtml(getConsoleWindow().document);if(windowTest(getConsoleWindow())){finalInit()}else{pollConsoleWindow(windowTest,finalInit,initErrorMessage)}}catch(ex){isSupported=false;handleError(initErrorMessage,ex)}}minimized=initiallyMinimized;iframeContainerDiv=containerElement.appendChild(document.createElement("div"));iframeContainerDiv.style.width=width;iframeContainerDiv.style.height=height;iframeContainerDiv.style.border="solid gray 1px";var iframeHtml="<iframe id='"+iframeId+"' name='"+iframeId+"' width='100%' height='100%' frameborder='0'"+"scrolling='no'></iframe>";iframeContainerDiv.innerHTML=iframeHtml;consoleClosed=false;var iframeDocumentExistsTest=function(win){return bool(win)&&bool(win.document)};if(iframeDocumentExistsTest(getConsoleWindow())){writeToDocument()}else{pollConsoleWindow(iframeDocumentExistsTest,writeToDocument,initErrorMessage)}initialized=true};getConsoleWindow=function(){var iframe=window.frames[iframeId];if(iframe){return iframe}};safeToAppend=function(){if(isSupported&&!consoleClosed){if(!consoleWindowLoaded&&getConsoleWindow()&&getConsoleWindow().loaded){consoleWindowLoaded=true}return consoleWindowLoaded}return false}}else{useOldPopUp=extractBooleanFromParam(useOldPopUp,appender.defaults.useOldPopUp);complainAboutPopUpBlocking=extractBooleanFromParam(complainAboutPopUpBlocking,appender.defaults.complainAboutPopUpBlocking);reopenWhenClosed=extractBooleanFromParam(reopenWhenClosed,this.defaults.reopenWhenClosed);this.isUseOldPopUp=function(){return useOldPopUp};this.setUseOldPopUp=function(useOldPopUpParam){if(checkCanConfigure("useOldPopUp")){useOldPopUp=bool(useOldPopUpParam)}};this.isComplainAboutPopUpBlocking=function(){return complainAboutPopUpBlocking};this.setComplainAboutPopUpBlocking=function(complainAboutPopUpBlockingParam){if(checkCanConfigure("complainAboutPopUpBlocking")){complainAboutPopUpBlocking=bool(complainAboutPopUpBlockingParam)}};this.isFocusPopUp=function(){return focusConsoleWindow};this.setFocusPopUp=function(focusPopUpParam){focusConsoleWindow=bool(focusPopUpParam)};this.isReopenWhenClosed=function(){return reopenWhenClosed};this.setReopenWhenClosed=function(reopenWhenClosedParam){reopenWhenClosed=bool(reopenWhenClosedParam)};this.close=function(){try{popUp.close()}catch(e){}consoleClosed=true};var popUp;init=function(){var windowProperties="width="+width+",height="+height+",status,resizable";var windowName="PopUp_"+location.host.replace(/[^a-z0-9]/gi,"_")+"_"+consoleAppenderId;if(!useOldPopUp){windowName=windowName+"_"+uniqueId}function finalInit(){consoleWindowLoaded=true;getConsoleWindow().setNewestAtTop(newestMessageAtTop);getConsoleWindow().setScrollToLatest(scrollToLatestMessage);getConsoleWindow().setMaxMessages(maxMessages);appendQueuedLoggingEvents()}try{popUp=window.open("",windowName,windowProperties);consoleClosed=false;if(popUp){if(useOldPopUp&&popUp.loaded){popUp.mainPageReloaded();finalInit()}else{writeHtml(popUp.document);var popUpLoadedTest=function(win){return bool(win)&&win.loaded};if(popUp.loaded){finalInit()}else{pollConsoleWindow(popUpLoadedTest,finalInit,"PopUpAppender.init: unable to create console window")}}}else{isSupported=false;logLog.warn("PopUpAppender.init: pop-ups blocked, please unblock to use PopUpAppender");if(complainAboutPopUpBlocking){handleError("log4javascript: pop-up windows appear to be blocked. Please unblock them to use pop-up logging.")}}}catch(ex){handleError("PopUpAppender.init: error creating pop-up",ex)}initialized=true};getConsoleWindow=function(){return popUp};safeToAppend=function(){if(isSupported&&!isUndefined(popUp)&&!consoleClosed){if(popUp.closed||(consoleWindowLoaded&&isUndefined(popUp.closed))){consoleClosed=true;logLog.debug("PopUpAppender: pop-up closed");return false}if(!consoleWindowLoaded&&popUp.loaded){consoleWindowLoaded=true}}return isSupported&&consoleWindowLoaded&&!consoleClosed}}if(enabled&&!lazyInit){init()}this.getConsoleWindow=getConsoleWindow};var PopUpAppender=function(lazyInit,layout,focusPopUp,useOldPopUp,complainAboutPopUpBlocking,newestMessageAtTop,scrollToLatestMessage,reopenWhenClosed,width,height,maxMessages){var focusConsoleWindow=extractBooleanFromParam(focusPopUp,this.defaults.focusPopUp);this.create(false,null,layout,lazyInit,focusConsoleWindow,useOldPopUp,complainAboutPopUpBlocking,newestMessageAtTop,scrollToLatestMessage,null,width,height,reopenWhenClosed,maxMessages)};PopUpAppender.prototype=new ConsoleAppender();PopUpAppender.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),focusPopUp:false,lazyInit:true,useOldPopUp:true,complainAboutPopUpBlocking:true,newestMessageAtTop:false,scrollToLatestMessage:true,width:"600",height:"400",reopenWhenClosed:false,maxMessages:null};PopUpAppender.prototype.toString=function(){return"[PopUpAppender]"};log4javascript.PopUpAppender=PopUpAppender;var InPageAppender=function(containerElement,lazyInit,layout,initiallyMinimized,newestMessageAtTop,scrollToLatestMessage,width,height,maxMessages){this.create(true,containerElement,layout,lazyInit,false,null,null,newestMessageAtTop,scrollToLatestMessage,initiallyMinimized,width,height,null,maxMessages)};InPageAppender.prototype=new ConsoleAppender();InPageAppender.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:false,lazyInit:true,newestMessageAtTop:false,scrollToLatestMessage:true,width:"100%",height:"250px",maxMessages:null};InPageAppender.prototype.toString=function(){return"[InPageAppender]"};log4javascript.InPageAppender=InPageAppender;log4javascript.InlineAppender=InPageAppender})();var BrowserConsoleAppender=function(layout){if(layout){this.setLayout(layout)}};BrowserConsoleAppender.prototype=new log4javascript.Appender();BrowserConsoleAppender.prototype.layout=new NullLayout();BrowserConsoleAppender.prototype.threshold=Level.DEBUG;BrowserConsoleAppender.prototype.append=function(loggingEvent){var appender=this;var getFormattedMessage=function(){var layout=appender.getLayout();var formattedMessage=layout.format(loggingEvent);if(layout.ignoresThrowable()&&loggingEvent.exception){formattedMessage+=loggingEvent.getThrowableStrRep()}return formattedMessage};if((typeof opera!="undefined")&&opera.postError){opera.postError(getFormattedMessage())}else if(window.console&&window.console.log){var formattedMesage=getFormattedMessage();if(window.console.debug&&Level.DEBUG.isGreaterOrEqual(loggingEvent.level)){window.console.debug(formattedMesage)}else if(window.console.info&&Level.INFO.equals(loggingEvent.level)){window.console.info(formattedMesage)}else if(window.console.warn&&Level.WARN.equals(loggingEvent.level)){window.console.warn(formattedMesage)}else if(window.console.error&&loggingEvent.level.isGreaterOrEqual(Level.ERROR)){window.console.error(formattedMesage)}else{window.console.log(formattedMesage)}}};BrowserConsoleAppender.prototype.toString=function(){return"[BrowserConsoleAppender]"};log4javascript.BrowserConsoleAppender=BrowserConsoleAppender})();var DOCUMENT_ROOT=null;(function()
|
506
|
+
{var idx=window.document.location.href.lastIndexOf('/');if(idx==window.document.location.href.length-1)
|
507
|
+
{DOCUMENT_ROOT=window.document.location.href;}
|
508
|
+
else
|
509
|
+
{DOCUMENT_ROOT=window.document.location.href.substr(0,idx);if(DOCUMENT_ROOT.substring(DOCUMENT_ROOT.length-1)!='/')
|
510
|
+
{DOCUMENT_ROOT=DOCUMENT_ROOT+'/';}}})();var HAKANO={Version:'1.0.RC4.127',VersionDate:'20070519 0041',DocumentPath:DOCUMENT_ROOT,ScriptPath:undefined,StylePath:undefined,ImagePath:undefined,ContentPath:undefined,load:function()
|
511
|
+
{if((typeof Prototype=='undefined')||parseFloat(Prototype.Version.split(".")[0]+"."+
|
512
|
+
Prototype.Version.split(".")[1])<1.5)
|
513
|
+
{throw("application requires the Prototype JavaScript framework >= 1.5");}
|
514
|
+
HAKANO.setDocumentRoot(DOCUMENT_ROOT);},setDocumentRoot:function(rootPath)
|
515
|
+
{if(rootPath==null)
|
516
|
+
{rootPath=DOCUMENT_ROOT;}
|
517
|
+
if(!rootPath.match(/.\/$/))
|
518
|
+
{rootPath=rootPath+'/';}
|
519
|
+
HAKANO.DocumentPath=rootPath;HAKANO.ScriptPath=HAKANO.DocumentPath+'js/';HAKANO.ImagePath=HAKANO.DocumentPath+'images/';HAKANO.StylePath=HAKANO.DocumentPath+'css/';HAKANO.ContentPath=HAKANO.DocumentPath+'content/';}};hakano=function()
|
520
|
+
{return{util:{},namespace:function(sNameSpace)
|
521
|
+
{if(!sNameSpace||!sNameSpace.length)
|
522
|
+
{return null;}
|
523
|
+
var levels=sNameSpace.split(".");var currentNS=hakano;for(var i=(levels[0]=="hakano"||levels[0]=='seamless')?1:0;i<levels.length;++i)
|
524
|
+
{currentNS[levels[i]]=currentNS[levels[i]]||{};currentNS=currentNS[levels[i]];}
|
525
|
+
return currentNS;}};}();HAKANO.load();window.siteLoadedObservers=[];window.siteUnloadedObservers=[];var SEAMLESS=HAKANO;seamless=hakano;HAKANO.TEMPLATE_VARS={rootPath:HAKANO.DocumentPath,scriptPath:HAKANO.ScriptPath,imagePath:HAKANO.ImagePath,cssPath:HAKANO.DocumentPath+'css',contentPath:HAKANO.DocumentPath+'content',portletPath:HAKANO.DocumentPath+'portlets',modulePath:HAKANO.DocumentPath+'modules',soundPath:HAKANO.DocumentPath+'sounds'};HAKANO.isStrictMode=(document.compatMode=='CSS1Compat');var ua=navigator.userAgent.toLowerCase();HAKANO.isOpera=(ua.indexOf('opera')>-1);HAKANO.isSafari=(ua.indexOf('webkit')>-1);HAKANO.isIE=(window.ActiveXObject);HAKANO.isIE7=(ua.indexOf('msie 7')>-1);HAKANO.isGecko=!HAKANO.isSafari&&(ua.indexOf('gecko')>-1);if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1)
|
526
|
+
{HAKANO.isWindows=true;}
|
527
|
+
else if(ua.indexOf("macintosh")!=-1)
|
528
|
+
{HAKANO.isMac=true;}
|
529
|
+
if(HAKANO.isIE&&!HAKANO.isIE7)
|
530
|
+
{try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}
|
531
|
+
Object.extend(Array.prototype,{copy:function()
|
532
|
+
{var copy=[];for(var c=0;c<this.length;c++)
|
533
|
+
{copy[c]=this[c];}
|
534
|
+
return copy;},exists:function(entry)
|
535
|
+
{for(var c=0;c<this.length;c++)
|
536
|
+
{if(this[c]==entry)
|
537
|
+
{return true;}}
|
538
|
+
return false;},contains:function(entry)
|
539
|
+
{return this.exists(entry);},removeAt:function(idx)
|
540
|
+
{this.splice(idx,1);},remove:function(entry)
|
541
|
+
{for(var c=0;c<this.length;c++)
|
542
|
+
{if(this[c]==entry)
|
543
|
+
{this.splice(c,1);return true;}}
|
544
|
+
return false;},swap:function(a,b)
|
545
|
+
{var src=null;var target=null;for(var c=0;c<this.length;c++)
|
546
|
+
{if(this[c]==a)
|
547
|
+
{src=c;}
|
548
|
+
if(this[c]==b)
|
549
|
+
{target=c;}
|
550
|
+
if(src!=null&&target!=null)
|
551
|
+
{break;}}
|
552
|
+
if(src!=null&&target!=null)
|
553
|
+
{this[src]=b;this[target]=a;return true;}
|
554
|
+
return false;}});hakano.util.Cookie=Class.create();hakano.util.Cookie={toString:function()
|
555
|
+
{return"[hakano.util.Cookie]";},getCookieVal:function(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)
|
556
|
+
{endstr=document.cookie.length;}
|
557
|
+
return unescape(document.cookie.substring(offset,endstr));},GetCookie:function(name){var arg=escape(name)+"=";var alen=arg.length;var clen=document.cookie.length;$D(this,"GetCookie: value=",document.cookie);var i=0;while(i<clen){var j=i+alen;var value=document.cookie.substring(i,j);if(value==arg)
|
558
|
+
{var cookieval=this.getCookieVal(j);if(cookieval!=null&&cookieval!='')
|
559
|
+
{$D(this,"GetCookie",name+"="+cookieval);return cookieval;}
|
560
|
+
else
|
561
|
+
{$D(this,"GetCookie",name+"=null");return null;}}
|
562
|
+
i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}
|
563
|
+
$D(this,"GetCookie",name+"=null");return null;},SetCookie:function(name,value){var argv=this.SetCookie.arguments;var argc=this.SetCookie.arguments.length;var expires=(argc>2)?argv[2]:null;var path=(argc>3)?argv[3]:null;var domain=(argc>4)?argv[4]:null;var secure=(argc>5)?argv[5]:false;var cookie=escape(name)+"="+escape(value)+
|
564
|
+
((expires==null)?"":("; expires="+expires.toGMTString()))+
|
565
|
+
((path==null)?"":("; path="+path))+
|
566
|
+
((domain==null)?"":("; domain="+domain))+
|
567
|
+
((secure)?"; secure":"");$D(this,"SetCookie",cookie);document.cookie=cookie;},DeleteCookie:function()
|
568
|
+
{var date=new Date();date.setTime(date.getTime()+(-1*24*60*60*1000));var expires="; expires="+date.toGMTString();var args=$A(arguments);var self=this;args.each(function(name)
|
569
|
+
{var cval=self.GetCookie(name);$D(self,"DeleteCookie",name);document.cookie=name+"="+expires+"; path=/";document.cookie=name+"="+expires+";";});},HasCookie:function(name)
|
570
|
+
{return this.GetCookie(name)!=null;}};hakano.util.DateTime=Class.create();hakano.util.DateTime={ONE_SECOND:1000,ONE_MINUTE:60000,ONE_HOUR:3600000,ONE_DAY:86400000,ONE_WEEK:604800000,ONE_MONTH:18748800000,ONE_YEAR:31536000000,getDurationNoFormat:function(begin,end)
|
571
|
+
{end=end||new Date();var amount=end.getTime()-begin.getTime();var hours=0
|
572
|
+
var minutes=0;var seconds=0;if(amount>this.ONE_HOUR)
|
573
|
+
{hours=Math.round(amount/this.ONE_HOUR);amount=amount-(this.ONE_HOUR*hours);}
|
574
|
+
if(amount==this.ONE_HOUR)
|
575
|
+
{hours=1;amount=amount-this.ONE_HOUR;}
|
576
|
+
if(amount>this.ONE_MINUTE)
|
577
|
+
{minutes=Math.round(amount/this.ONE_MINUTE);amount=amount-(this.ONE_MINUTE*minutes);}
|
578
|
+
if(amount==this.ONE_MINUTE)
|
579
|
+
{minutes=1;amount=amount-this.ONE_MINUTE;}
|
580
|
+
if(amount>this.ONE_SECOND)
|
581
|
+
{seconds=Math.round(amount/this.ONE_SECOND);amount=amount-(this.ONE_SECOND*seconds);}
|
582
|
+
if(amount==this.ONE_SECOND)
|
583
|
+
{seconds=1;}
|
584
|
+
if(seconds<10)
|
585
|
+
{seconds="0"+seconds;}
|
586
|
+
var value="";if(hours>0)
|
587
|
+
{return hours+":"+minutes+":"+seconds;}
|
588
|
+
if(minutes>0)
|
589
|
+
{return minutes+":"+seconds;}
|
590
|
+
if(seconds>0)
|
591
|
+
{return"0:"+seconds;}
|
592
|
+
else return":00";},getDuration:function(begin,end)
|
593
|
+
{end=end||new Date();var amount=end.getTime()-begin.getTime();return this.toDuration(amount);},toDuration:function(amount)
|
594
|
+
{amount=amount||0;if(amount<0)
|
595
|
+
{return'0';}
|
596
|
+
else if(amount<this.ONE_SECOND)
|
597
|
+
{var calc=Math.round(amount/this.ONE_SECOND);return calc+' ms';}
|
598
|
+
else if(amount==this.ONE_SECOND)
|
599
|
+
{return'1 second';}
|
600
|
+
else if(amount<this.ONE_MINUTE)
|
601
|
+
{var calc=Math.round(amount/this.ONE_SECOND);return calc+' second'+(calc>1?'s':'');}
|
602
|
+
if(amount==this.ONE_MINUTE)
|
603
|
+
{return'1 minute';}
|
604
|
+
else if(amount==this.ONE_HOUR)
|
605
|
+
{return'1 hour';}
|
606
|
+
else if(amount<this.ONE_HOUR)
|
607
|
+
{var calc=Math.round(amount/this.ONE_MINUTE);return calc+' minute'+(calc>1?'s':'');}
|
608
|
+
else if(amount>this.ONE_HOUR&&amount<this.ONE_DAY)
|
609
|
+
{var calc=Math.round(amount/this.ONE_HOUR);return calc+' hour'+(calc>1?'s':'');}
|
610
|
+
else if(amount==this.ONE_DAY)
|
611
|
+
{return'1 day';}
|
612
|
+
else if(amount>this.ONE_DAY&&amount<this.ONE_YEAR)
|
613
|
+
{if(amount>this.ONE_MONTH)
|
614
|
+
{var calc=Math.round(amount/this.ONE_MONTH);return calc+' month'+(calc>1?'s':'');}
|
615
|
+
else if(amount>this.ONE_WEEK)
|
616
|
+
{var calc=Math.round(amount/this.ONE_WEEK);return calc+' week'+(calc>1?'s':'');}
|
617
|
+
else
|
618
|
+
{var calc=Math.round(amount/this.ONE_DAY);return calc+' day'+(calc>1?'s':'');}}
|
619
|
+
else if(amount==this.ONE_YEAR)
|
620
|
+
{return'1 year';}
|
621
|
+
else
|
622
|
+
{var calc=Math.round(amount/this.ONE_DAY);return calc+' years';}},friendlyDiff:function(date,end,shortstr)
|
623
|
+
{if(!date)return null;end=end||new Date();var amount=end.getTime()-date.getTime();if(amount<=this.ONE_MINUTE)
|
624
|
+
{if(shortstr)
|
625
|
+
{return'a few secs ago';}
|
626
|
+
return'a few seconds ago';}
|
627
|
+
else if(amount<this.ONE_HOUR)
|
628
|
+
{var calc=Math.round(amount/this.ONE_MINUTE);if(calc<10)
|
629
|
+
{if(shortstr)
|
630
|
+
{return'a few mins ago';}
|
631
|
+
return'a few minutes ago';}
|
632
|
+
if(shortstr)
|
633
|
+
{return calc+' min'+(calc>1?'s':'')+' ago';}
|
634
|
+
return calc+' minute'+(calc>1?'s':'')+' ago';}
|
635
|
+
else if(amount==this.ONE_HOUR)
|
636
|
+
{return'an hour ago';}
|
637
|
+
else if(amount<this.ONE_DAY)
|
638
|
+
{var calc=Math.round(amount/this.ONE_HOUR);return calc+' hour'+(calc>1?'s':'')+' ago';}
|
639
|
+
else if(amount==this.ONE_DAY)
|
640
|
+
{return'yesterday';}
|
641
|
+
else if(amount>this.ONE_DAY&&amount<this.ONE_YEAR)
|
642
|
+
{if(amount>this.ONE_MONTH)
|
643
|
+
{var calc=Math.round(amount/this.ONE_MONTH);return calc+' month'+(calc>1?'s':'')+' ago';}
|
644
|
+
else if(amount>this.ONE_WEEK)
|
645
|
+
{var calc=Math.round(amount/this.ONE_WEEK);return calc+' week'+(calc>1?'s':'')+' ago';}
|
646
|
+
else
|
647
|
+
{var calc=Math.round(amount/this.ONE_DAY);if(calc==1)
|
648
|
+
{return'yesterday';}
|
649
|
+
return calc+' day'+(calc>1?'s':'')+' ago';}}
|
650
|
+
else if(amount>this.ONE_YEAR)
|
651
|
+
{if(shortstr)
|
652
|
+
{return'>1 year ago';}
|
653
|
+
return'more than a year ago';}
|
654
|
+
return amount;},getMonthIntValue:function(s)
|
655
|
+
{switch(s)
|
656
|
+
{case"Jan":return 0;case"Feb":return 1;case"Mar":return 2;case"Apr":return 3;case"May":return 4;case"Jun":return 5;case"Jul":return 6;case"Aug":return 7;case"Sep":return 8;case"Oct":return 9;case"Nov":return 10;case"Dec":return 11;}},intval:function(s)
|
657
|
+
{if(s)
|
658
|
+
{if(s.charAt(0)=='0')
|
659
|
+
{s=s.substring(1);}
|
660
|
+
return parseInt(s);}
|
661
|
+
return 0;},getFriendlyDate:function(date,qualifiers)
|
662
|
+
{var q=Object.extend({today:'',yesterday:'',past:'',lowercase:false},qualifiers||"");date=date||new Date();var localDate=typeof(date)=="string"?hakano.util.DateTime.parseRFC2822Date(date):date;if(hakano.util.DateTime.isToday(localDate))
|
663
|
+
{return q['today']+hakano.util.DateTime.get12HourTime(localDate);}
|
664
|
+
else if(hakano.util.DateTime.isYesterday(localDate))
|
665
|
+
{return q['yesterday']+(q['lowercase']?"yesterday":"Yesterday");}
|
666
|
+
return q['past']+localDate.getDay()+" "+hakano.util.DateTime.getShortMonthName(localDate);},isToday:function(date)
|
667
|
+
{var now=new Date();return(now.getFullYear()==date.getFullYear()&&now.getMonth()==date.getMonth()&&now.getDay()==date.getDay());},isYesterday:function(date)
|
668
|
+
{var now=new Date();return(now.getFullYear()==date.getFullYear()&&now.getMonth()==date.getMonth()&&now.getDay()-1==date.getDay());},getShortMonthName:function(date)
|
669
|
+
{var month=date.getMonth();switch(month)
|
670
|
+
{case 0:return"Jan";case 1:return"Feb";case 2:return"Mar";case 3:return"Apr";case 4:return"May";case 5:return"Jun";case 6:return"Jul";case 7:return"Aug";case 8:return"Sep";case 9:return"Oct";case 10:return"Nov";case 11:return"Dec";}},get12HourTime:function(d,seconds,milli)
|
671
|
+
{var date=d;if(date==null)
|
672
|
+
{date=new Date();}
|
673
|
+
var hour=date.getHours();var str=(hour==0)?12:hour;var ampm="AM";if(hour>=12)
|
674
|
+
{str=(hour==12)?12:(hour-12);ampm="PM";}
|
675
|
+
var m=date.getMinutes();var s=date.getSeconds();str+=":"+(m<10?"0":"")+m;if(seconds)
|
676
|
+
{str+=":"+(s<10?"0":"")+s;}
|
677
|
+
if(milli)
|
678
|
+
{var ms=date.getMilliseconds();str+="."+(ms<10?"0":"")+ms;}
|
679
|
+
str+=" "+ampm;return str;},getShortDateTime:function(d)
|
680
|
+
{if(d&&typeof(d)=='string')
|
681
|
+
{d=this.parseJavaDate(d);}
|
682
|
+
var date=d||new Date();return this.getShortMonthName(date)+" "+date.getDate()+" "+this.get12HourTime(date);},parseInt:function(x)
|
683
|
+
{if(x)
|
684
|
+
{if(x.charAt(0)=='0')
|
685
|
+
{return this.parseInt(x.substring(1));}
|
686
|
+
return parseInt(x);}
|
687
|
+
return 0;},parseJavaDate:function(d)
|
688
|
+
{if(!d||d=='')return null;var year=parseInt(d.substring(0,4));var month=this.parseInt(d.substring(5,7))-1;var day=this.parseInt(d.substring(8,10));var hour=this.parseInt(d.substring(11,13));var minute=this.parseInt(d.substring(14,16));var second=this.parseInt(d.substring(17,19));var milli=this.parseInt(d.substring(20));var date=new Date();date.setFullYear(year);date.setMonth(month);date.setDate(day);date.setHours(hour);date.setMinutes(minute);date.setSeconds(second);date.setMilliseconds(milli);return date;},parseRFC2822Date:function(d)
|
689
|
+
{var tokens=d.split(" ");var day=this.intval(tokens[1]);var month=tokens[2];var year=tokens[3];var timetokens=tokens[4].split(":");var hour=this.intval(timetokens[0]);var min=this.intval(timetokens[1]);var sec=this.intval(timetokens[2]);var hourOffset=this.intval(tokens[5].substring(0,3));var minOffset=this.intval(tokens[5].substring(3));var gmtHour=0;if(hourOffset<0)
|
690
|
+
{gmtHour=hour-(hourOffset);}
|
691
|
+
else
|
692
|
+
{gmtHour=hour+(hourOffset);}
|
693
|
+
if(gmtHour>23)
|
694
|
+
{gmtHour=gmtHour-24;day+=1;}
|
695
|
+
else if(gmtHour<0)
|
696
|
+
{gmtHour=24-gmtHour;day-=1;}
|
697
|
+
var gmtDate=new Date();gmtDate.setUTCDate(day);gmtDate.setUTCMonth(this.getMonthIntValue(month));gmtDate.setUTCFullYear(year);gmtDate.setUTCHours(gmtHour,min,sec);return gmtDate;}};var HAKANO_DEBUG=window.location.href.indexOf('debug=1')>0;log4javascript.setEnabled(HAKANO_DEBUG);var _log=log4javascript.getLogger("main");var _logAppender=null;if(HAKANO_DEBUG)
|
698
|
+
{_logAppender=new log4javascript.PopUpAppender();}
|
699
|
+
if(_logAppender!=null)
|
700
|
+
{var _popUpLayout=new log4javascript.PatternLayout("%d{HH:mm:ss} %-5p - %m%n");_logAppender.setLayout(_popUpLayout);_log.addAppender(_logAppender);_logAppender.setThreshold(HAKANO_DEBUG?log4javascript.Level.DEBUG:log4javascript.Level.WARN);}
|
701
|
+
var Logger=Class.create();Logger.info=function(msg)
|
702
|
+
{if(_logAppender)_log.info(msg);};Logger.warn=function(msg)
|
703
|
+
{if(_logAppender)_log.warn(msg);};Logger.debug=function(msg)
|
704
|
+
{if(_logAppender)_log.debug(msg);};Logger.error=function(msg)
|
705
|
+
{if(_logAppender)_log.error(msg);};Logger.trace=function(msg)
|
706
|
+
{if(_logAppender)_log.trace(msg);}
|
707
|
+
Logger.fatal=function(msg)
|
708
|
+
{if(_logAppender)_log.fatal(msg);}
|
709
|
+
function $D()
|
710
|
+
{if(HAKANO_DEBUG)
|
711
|
+
{var args=$A(arguments);var msg=(args.length>1)?args.join(" "):args[0];Logger.debug(msg);}}
|
712
|
+
hakano.util.Dom={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12,clearDOM:function(n)
|
713
|
+
{if(n&&n.childNodes)
|
714
|
+
{var c=n.childNodes.length;while(c>0)
|
715
|
+
{var child=n.childNodes[0];this.purge(child,true);n.removeChild(child);c=n.childNodes.length;}}},getTagValue:function(element)
|
716
|
+
{var value="";this.each(element.childNodes,this.CDATA_SECTION_NODE,function(e)
|
717
|
+
{value+=e.nodeValue;});return value;},getTagContent:function(element,tagname,def)
|
718
|
+
{try
|
719
|
+
{return element.getElementsByTagName(tagname)[0].firstChild.nodeValue;}
|
720
|
+
catch(e)
|
721
|
+
{return def;}},getNodeValueByTag:function(row,name)
|
722
|
+
{var nodes=row.childNodes;var len=nodes.length;for(var c=0;c<len;c++)
|
723
|
+
{if(nodes[c].nodeName==name)
|
724
|
+
{return this.getText(nodes[c]);}}
|
725
|
+
return null;},eachAttribute:function(node,iterator,excludes,specified)
|
726
|
+
{specified=specified==null?true:specified;excludes=excludes||[];if(node.attributes)
|
727
|
+
{var map=node.attributes;for(var c=0,len=map.length;c<len;c++)
|
728
|
+
{var item=map[c];if(item&&item.value!=null&&specified==item.specified)
|
729
|
+
{var type=typeof(item);if(type=='function'||type=='native'||item.name.match(/_moz\-/))continue;if(excludes.length>0)
|
730
|
+
{var cont=false;for(var i=0,l=excludes.length;i<l;i++)
|
731
|
+
{if(excludes[i]==item.name)
|
732
|
+
{cont=true;break;}}
|
733
|
+
if(cont)continue;}
|
734
|
+
var attr=item.value;iterator(item.name,item.value,item.specified,c,map.length);}}
|
735
|
+
return c>0;}
|
736
|
+
return false;},getTagAttribute:function(element,tagname,key,def)
|
737
|
+
{try
|
738
|
+
{var attribute=element.getElementsByTagName(tagname)[0].getAttribute(key);if(null!=attribute)
|
739
|
+
{return attribute;}}
|
740
|
+
catch(e)
|
741
|
+
{}
|
742
|
+
return def;},each:function(nodelist,nodeType,func)
|
743
|
+
{if(typeof(nodelist)=="array")
|
744
|
+
{nodelist.each(function(n)
|
745
|
+
{if(n.nodeType==nodeType)
|
746
|
+
{func(n);}});}
|
747
|
+
else if(typeof(nodelist)=="object"||typeof(nodelist)=="function"&&navigator.userAgent.match(/WebKit/i))
|
748
|
+
{for(var p=0,len=nodelist.length;p<len;p++)
|
749
|
+
{var obj=nodelist[p];if(typeof obj.nodeType!="undefined"&&obj.nodeType==nodeType)
|
750
|
+
{try
|
751
|
+
{func(obj);}
|
752
|
+
catch(e)
|
753
|
+
{if(e==$break)
|
754
|
+
{break;}
|
755
|
+
else if(e!=$continue)
|
756
|
+
{throw e;}}}}}
|
757
|
+
else
|
758
|
+
{throw("unsupported dom nodelist type: "+typeof(nodelist));}},purge:function(d,dontRecurse)
|
759
|
+
{if(d['finalize']&&typeof(d['finalize'])=="function")
|
760
|
+
{d['finalize']();}
|
761
|
+
var a=d.attributes,i,l,n;if(a)
|
762
|
+
{l=a.length;for(i=0;i<l;i+=1)
|
763
|
+
{n=a[i].name;if('function'==typeof d[n]&&n.substring(0,2)=='on')
|
764
|
+
{d[n]=null;}}}
|
765
|
+
if(dontRecurse)return;a=d.childNodes;if(a)
|
766
|
+
{l=a.length;for(i=0;i<l;i+=1)
|
767
|
+
{this.purge(d.childNodes[i]);}}},getText:function(n,skipHTMLStyles)
|
768
|
+
{var text="";var children=n.childNodes;var len=children.length;for(var c=0;c<len;c++)
|
769
|
+
{var child=children[c];if(child.nodeType==this.COMMENT_NODE)
|
770
|
+
{text+="<!-- "+child.nodeValue+" -->";continue;}
|
771
|
+
if(child.nodeType==this.ELEMENT_NODE)
|
772
|
+
{text+=this.toXML(child,true,null,null,skipHTMLStyles);}
|
773
|
+
else
|
774
|
+
{if(child.nodeType==this.TEXT_NODE)
|
775
|
+
{text+=child.nodeValue||'';}
|
776
|
+
else if(child.nodeValue==null)
|
777
|
+
{text+=this.toXML(child,true,null,null,skipHTMLStyles);}
|
778
|
+
else
|
779
|
+
{text+=child.nodeValue||'';}}}
|
780
|
+
return text;},hasAttribute:function(e,n,cs)
|
781
|
+
{if(!e.hasAttribute)
|
782
|
+
{if(e.attributes)
|
783
|
+
{for(var c=0,len=e.attributes.length;c<len;c++)
|
784
|
+
{var item=e.attributes[c];if(item&&item.specified)
|
785
|
+
{if(cs&&item.name==n||!cs&&item.name.toLowerCase()==n.toLowerCase())
|
786
|
+
{return true;}}}}
|
787
|
+
return false;}
|
788
|
+
else
|
789
|
+
{return e.hasAttribute(n);}},getAttribute:function(e,n,cs)
|
790
|
+
{if(cs)
|
791
|
+
{return e.getAttribute(n);}
|
792
|
+
else
|
793
|
+
{for(var c=0,len=e.attributes.length;c<len;c++)
|
794
|
+
{var item=e.attributes[c];if(item&&item.specified)
|
795
|
+
{if(item.name.toLowerCase()==n.toLowerCase())
|
796
|
+
{return item.value;}}}
|
797
|
+
return null;}},toXML:function(e,embed,nodeName,id,skipHTMLStyles)
|
798
|
+
{nodeName=(nodeName||e.nodeName.toLowerCase());var xml="<"+nodeName;if(id)
|
799
|
+
{xml+=" id='"+id+"' ";}
|
800
|
+
if(e.attributes)
|
801
|
+
{var map=e.attributes;var x=0;for(var c=0,len=map.length;c<len;c++)
|
802
|
+
{var item=map[c];if(item&&item.value!=null&&item.specified)
|
803
|
+
{var type=typeof(item);if(item.value&&item.value.startsWith('function()'))
|
804
|
+
{continue;}
|
805
|
+
if(type=='function'||type=='native'||item.name.match(/_moz\-/))continue;if(id!=null&&item.name=='id')
|
806
|
+
{continue;}
|
807
|
+
if(HAKANO.isIE&&!skipHTMLStyles&&item.name=='style')
|
808
|
+
{var str='';for(var p in e.style)
|
809
|
+
{var v=e.style[p];if(v&&v!='')
|
810
|
+
{str+=p+':'+v+';';}}
|
811
|
+
xml+=" style=\""+str+"\"";x++;continue;}
|
812
|
+
var attr=String.escapeXML(item.value);xml+=" "+item.name+"=\""+attr+"\"";x++;}}}
|
813
|
+
xml+=">";if(embed&&e.childNodes&&e.childNodes.length>0)
|
814
|
+
{xml+=this.getText(e,skipHTMLStyles);}
|
815
|
+
xml+="</"+nodeName+">";return xml;},getAndRemoveAttribute:function(node,name)
|
816
|
+
{var value=node.getAttribute(name);if(value)
|
817
|
+
{node.removeAttribute(name);}
|
818
|
+
return value;},getAttributesString:function(element,excludes)
|
819
|
+
{var html='';this.eachAttribute(element,function(name,value)
|
820
|
+
{if(!excludes||!excludes.exists(name))
|
821
|
+
{html+=name+'="'+(value||'')+'" ';}},true);return html;}};try
|
822
|
+
{if(typeof(DOMNodeList)=="object")DOMNodeList.prototype.length=DOMNodeList.prototype.getLength;if(typeof(DOMNode)=="object")
|
823
|
+
{DOMNode.prototype.childNodes=DOMNode.prototype.getChildNodes;DOMNode.prototype.parentNode=DOMNode.prototype.getParentNode;DOMNode.prototype.nodeType=DOMNode.prototype.getNodeType;DOMNode.prototype.nodeName=DOMNode.prototype.getNodeName;DOMNode.prototype.nodeValue=DOMNode.prototype.getNodeValue;}}
|
824
|
+
catch(e)
|
825
|
+
{}
|
826
|
+
var $E=function(type,options)
|
827
|
+
{var elem=document.createElement(type);if(options)
|
828
|
+
{if(options['parent'])
|
829
|
+
{options['parent'].appendChild(elem);}
|
830
|
+
if(options['className'])
|
831
|
+
{elem.className=options['className'];}
|
832
|
+
if(options['html'])
|
833
|
+
{elem.innerHTML=options['html'];}
|
834
|
+
if(options['children'])
|
835
|
+
{options['children'].each(function(child)
|
836
|
+
{elem.appendChild(child);});}}
|
837
|
+
return elem;};Effect.Scale2=Class.create();Object.extend(Object.extend(Effect.Scale2.prototype,Effect.Scale.prototype),{initialize:function(div,scale,args,dim)
|
838
|
+
{Effect.Scale.prototype.initialize.apply(this,[div,scale,args]);this._dims=dim;},setup:function()
|
839
|
+
{Effect.Scale.prototype.setup.call(this);this.dims=[this._dims.height,this._dims.width];},setDimensions:function(height,width)
|
840
|
+
{if(this.options.beforeSetDimensions)this.options.beforeSetDimensions(height,width);if(this.options.setDimensions)this.options.setDimensions(height,width);else Effect.Scale.prototype.setDimensions.apply(this,[height,width]);if(this.options.afterSetDimensions)this.options.afterSetDimensions(height,width);}});Effect.SlideRight=function(element)
|
841
|
+
{element=$(element);Element.setStyle(element,{'overflow':'hidden'});var overflow=Element.getStyle(element,'overflow');var dim=Element.getDimensions(element);new Effect.Scale2(element,100,Object.extend(arguments[1]||{},{scaleContent:false,scaleY:false,scaleX:true,scaleMode:'contents',scaleFrom:0,afterSetup:function()
|
842
|
+
{Element.setStyle(element,{'width':'0','display':''});},afterFinish:function()
|
843
|
+
{if(overflow)Element.setStyle(element,{'overflow':overflow});}}),dim);}
|
844
|
+
Effect.SlideLeft=function(element)
|
845
|
+
{element=$(element);var dim=Element.getDimensions(element);new Effect.Scale2(element,0,Object.extend(arguments[1]||{},{scaleContent:false,scaleY:false,scaleX:true,scaleMode:'contents',scaleFrom:100,afterFinish:function()
|
846
|
+
{Element.setStyle(element,{'width':dim.width,'display':'none'});}}),dim);}
|
847
|
+
Element.getDocumentSize=function()
|
848
|
+
{var xScroll,yScroll;var pageHeight,pageWidth;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
|
849
|
+
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
|
850
|
+
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
|
851
|
+
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
|
852
|
+
return[pageWidth,pageHeight,windowWidth,windowHeight];};Element.getPageScroll=function()
|
853
|
+
{var yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;}else if(document.body){yScroll=document.body.scrollTop;}
|
854
|
+
return yScroll;}
|
855
|
+
Element.getCenteredTopPosition=function(relative,name)
|
856
|
+
{var dim=Element.getDimensions(relative);var pos=Element.getDimensions(name).width;return(dim.height-pos)/2;};Element.center=function(relative,name,top)
|
857
|
+
{var element=$(name);var dim=Element.getDimensions(relative);var width=dim.width;var height=dim.height;var pos=Element.getDimensions(name).width;var left=(width-pos)/2;element.style.position="absolute";element.style.left=left+"px";element.style.right=left+width+"px";if(top)
|
858
|
+
{element.style.top=top+"px";}
|
859
|
+
else
|
860
|
+
{var hw=element.offsetHeight||parseInt(element.style.height)||200;element.style.top=(height-hw)/2+"px";}};Element.findParentForm=function(element)
|
861
|
+
{var found=null;Element.ancestors(element).each(function(n)
|
862
|
+
{if(n.nodeName=='FORM')
|
863
|
+
{found=n;throw $break;}});return found;};Element.showing=function(element,ancestors)
|
864
|
+
{if(!Element.visible(element))return false;ancestors=ancestors||element.ancestors();var visible=true;ancestors.each(function(ancestor)
|
865
|
+
{if(!Element.visible(ancestor))
|
866
|
+
{visible=false;throw $break;}});return visible;};Element.findNonShowingAncestor=function(element,ancestors)
|
867
|
+
{if(!Element.visible(element))return element;ancestors=ancestors||element.ancestors();var found=null;ancestors.each(function(ancestor)
|
868
|
+
{if(!Element.visible(ancestor))
|
869
|
+
{found=ancestor;throw $break;}});return found;};Element.setHeight=function(element,h)
|
870
|
+
{element=$(element);element.style.height=h+"px";};Element.setWidth=function(element,w)
|
871
|
+
{element=$(element);element.style.width=w+"px";};Element.setTop=function(element,t)
|
872
|
+
{element=$(element);element.style.top=t+"px";};Element.isVisible=function(el)
|
873
|
+
{return el.style.visibility!='hidden'&&el.style.display!='none';};Object.extend(Event,{observe:function(element,name,observer,useCapture)
|
874
|
+
{var e=element;element=typeof element=='string'?$(element):element;if(!element)
|
875
|
+
{throw"Event.observe called with null element named: "+e+" for event: "+name;}
|
876
|
+
if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))
|
877
|
+
name='keydown';if(name=='load'&&element.screen)
|
878
|
+
this._observeLoad(element,name,observer,useCapture);else
|
879
|
+
this._observeAndCache(element,name,observer,useCapture);},_observeLoad:function(element,name,observer,useCapture)
|
880
|
+
{if(!this._readyCallbacks)
|
881
|
+
{var loader=this._onloadWindow.bind(this);if(document.addEventListener)
|
882
|
+
document.addEventListener("DOMContentLoaded",loader,false);if(navigator.appVersion.match(/Konqueror|Safari|KHTML/i))
|
883
|
+
Event._timer=setInterval(function()
|
884
|
+
{if(/loaded|complete/.test(document.readyState))loader();},10);Event._readyCallbacks=[];this._observeAndCache(element,name,loader,useCapture);}
|
885
|
+
Event._readyCallbacks.push(observer);},_onloadWindow:function()
|
886
|
+
{if(arguments.callee.done)return;arguments.callee.done=true;if(this._timer)clearInterval(this._timer);this._readyCallbacks.each(function(f)
|
887
|
+
{f()});this._readyCallbacks=null;},getEvent:function(e)
|
888
|
+
{return(e)?e:window.event;},isEventObject:function(e)
|
889
|
+
{e=this.getEvent(e);if(e)
|
890
|
+
{if(typeof(e.cancelBubble)!='undefined'&&typeof(e.qualifier)!='undefined')
|
891
|
+
{return true;}
|
892
|
+
if(typeof(e.stopPropagation)!='undefined'&&typeof(e.preventDefault)!='undefined')
|
893
|
+
{return true;}}
|
894
|
+
return false;},getKeyCode:function(event)
|
895
|
+
{var pK;if(event)
|
896
|
+
{if(typeof(event.keyCode)!="undefined")
|
897
|
+
{pK=event.keyCode;}
|
898
|
+
else if(typeof(event.which)!="undefined")
|
899
|
+
{pK=event.which;}}
|
900
|
+
else
|
901
|
+
{pK=window.event.keyCode;}
|
902
|
+
return pK;},isKey:function(event,code)
|
903
|
+
{return Event.getKeyCode(event)==code;},isEscapeKey:function(event)
|
904
|
+
{return Event.isKey(event,Event.KEY_ESC)||Event.isKey(event,event.DOM_VK_ESCAPE);},isEnterKey:function(event)
|
905
|
+
{return Event.isKey(event,Event.KEY_RETURN)||Event.isKey(event,event.DOM_VK_ENTER);},isSpaceBarKey:function(event)
|
906
|
+
{return Event.isKey(event,Event.KEY_SPACEBAR)||Event.isKey(event,event.DOM_VK_SPACE);},isPageUpKey:function(event)
|
907
|
+
{return Event.isKey(event,Event.KEY_PAGEUP)||Event.isKey(event,event.DOM_VK_PAGE_UP);},isPageDownKey:function(event)
|
908
|
+
{return Event.isKey(event,Event.KEY_PAGEDOWN)||Event.isKey(event,event.DOM_VK_PAGE_DOWN);},isHomeKey:function(event)
|
909
|
+
{return Event.isKey(event,Event.KEY_HOME)||Event.isKey(event,event.DOM_VK_HOME);},isEndKey:function(event)
|
910
|
+
{return Event.isKey(event,Event.KEY_END)||Event.isKey(event,event.DOM_VK_END);},isDeleteKey:function(event)
|
911
|
+
{return Event.isKey(event,Event.KEY_DELETE)||Event.isKey(event,event.DOM_VK_DELETE);},isLeftKey:function(event)
|
912
|
+
{return Event.isKey(event,Event.KEY_LEFT)||Event.isKey(event,event.DOM_VK_LEFT);},isRightKey:function(event)
|
913
|
+
{return Event.isKey(event,Event.KEY_RIGHT)||Event.isKey(event,event.DOM_VK_RIGHT);},KEY_SPACEBAR:0,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_END:35,KEY_HOME:36,KEY_DELETE:46});hakano.util.EventBroadcaster=Class.create();Object.extend(hakano.util.EventBroadcaster.prototype,{listeners:[],addListener:function(listener)
|
914
|
+
{this.listeners.push(listener);},removeListener:function(listener)
|
915
|
+
{if(!this.listeners)
|
916
|
+
{return false;}
|
917
|
+
return this.listeners.remove(listener);},dispose:function()
|
918
|
+
{if(this.listeners)
|
919
|
+
{this.listeners.clear();}},fireEvent:function()
|
920
|
+
{if(!this.listeners||this.listeners.length==0)
|
921
|
+
{$D(this+' not firing event: registered no listeners');return;}
|
922
|
+
var args=$A(arguments);if(undefined==args||0==args.length)
|
923
|
+
{throw"fire event not correct for "+this+", requires at least a event name parameter";}
|
924
|
+
var name=args.shift();var ch=name.charAt(0).toUpperCase();var method="on"+ch+name.substring(1);$D(this+' firing event: '+method+', listeners: '+this.listeners.length);this.listeners.each(function(listener)
|
925
|
+
{var f=listener[method];if(f)
|
926
|
+
{f.apply(listener,args);}
|
927
|
+
else if(typeof(listener)=='function')
|
928
|
+
{listener.apply(listener,args);}});}});hakano.util.IdleManager=Class.create();hakano.util.IdleManager={IDLE_TIME:60000,timestamp:null,activeListeners:[],idleListeners:[],idle:false,install:function()
|
929
|
+
{this.event=this.onActivity.bind(this);this.timestamp=new Date().getTime();Event.observe(window,'keypress',this.event,false);Event.observe(window,'mousemove',this.event,false);var self=this;Event.observe(window,'unload',function()
|
930
|
+
{Event.stopObserving(window,'keypress',self.event,false);Event.stopObserving(window,'mousemove',self.event,false);self.event=null;},false);this.startTimer();},startTimer:function()
|
931
|
+
{this.stopTimer();this.timer=setInterval(this.onTimer.bind(this),500);},stopTimer:function()
|
932
|
+
{if(this.timer)
|
933
|
+
{clearInterval(this.timer);this.timer=0;}},onTimer:function()
|
934
|
+
{if(this.isIdle())
|
935
|
+
{this.stopTimer();this.idle=true;if(this.idleListeners.length>0)
|
936
|
+
{this.idleListeners.each(function(l)
|
937
|
+
{l.call(l);});}}},registerIdleListener:function(l)
|
938
|
+
{this.idleListeners.push(l);},unregisterIdleListener:function(l)
|
939
|
+
{this.idleListeners.remove(l);},registerActiveListener:function(l)
|
940
|
+
{this.activeListeners.push(l);},unregisterActiveListener:function(l)
|
941
|
+
{this.activeListeners.remove(l);},isIdle:function()
|
942
|
+
{return this.getIdleTimeInMS()>=this.IDLE_TIME;},getIdleTimeInMS:function()
|
943
|
+
{return(new Date().getTime()-this.timestamp);},onActivity:function()
|
944
|
+
{this.timestamp=new Date().getTime();if(this.idle)
|
945
|
+
{this.idle=false;if(this.activeListeners.length>0)
|
946
|
+
{this.activeListeners.each(function(l)
|
947
|
+
{l.call(l);});}
|
948
|
+
this.startTimer();}
|
949
|
+
return true;}};window.siteLoadedObservers.push(hakano.util.IdleManager.install.bind(hakano.util.IdleManager));var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);HAKANO.isIE=version>5.0;HAKANO.isIE6=version>=6.0&&version<7;HAKANO.isIE7=version>=7.0&&version<8;if(HAKANO.isIE6)
|
950
|
+
{document.getElementsByTagNameNS=function(xmlns,tag)
|
951
|
+
{var ar=$A(document.getElementsByTagName('*'));if(xmlns=="http://www.w3.org/1999/xhtml")
|
952
|
+
{xmlns="";}
|
953
|
+
var found=[];for(var c=0,len=ar.length;c<len;c++)
|
954
|
+
{var elem=ar[c];if(elem.tagUrn==xmlns&&(tag=='*'||elem.nodeName==tag))
|
955
|
+
{found.push(elem);}}
|
956
|
+
return found;};}
|
957
|
+
(function(){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={array:function(x,arr){if(!x)return'null';if(arr.contains(x))
|
958
|
+
{return null;}
|
959
|
+
arr.push(x);var a=['['],b,f,i,l=x.length,v;for(var i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(typeof(f)!='function')continue;v=f(v,arr);v=(v==null)?'null':v;if(Event.isEventObject(v))continue;var t=typeof(v);switch(t)
|
960
|
+
{case'string':case'number':case'boolean':{if(b){a[a.length]=',';}
|
961
|
+
a[a.length]=v;b=true;break;}}}
|
962
|
+
a[a.length]=']';return a.join('');},'boolean':function(x){return x||false;},'null':function(x){return"null";},number:function(x){return isFinite(x)?x:'null';},object:function(x,arr){if(x){if(x instanceof Array){return s.array(x,arr);}
|
963
|
+
if(Event.isEventObject(x))return'null';if(arr.contains(x))
|
964
|
+
{return'null';}
|
965
|
+
arr.push(x);var a=['{'],b,f,i,v;for(var i in x){if(i=='_toString')continue;v=x[i];f=s[typeof v];if(f)
|
966
|
+
{if(typeof(f)!='function')continue;v=f(v,arr);v=(v==null)?'null':v;if(Event.isEventObject(v))continue;var t=typeof(v);switch(t)
|
967
|
+
{case'string':case'number':case'boolean':{if(b){a[a.length]=',';}
|
968
|
+
a.push(s.string(i),':',v);b=true;break;}}}}
|
969
|
+
a[a.length]='}';return a.join('');}
|
970
|
+
return'null';},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}
|
971
|
+
c=b.charCodeAt();return'\\u00'+
|
972
|
+
Math.floor(c/16).toString(16)+
|
973
|
+
(c%16).toString(16);});}
|
974
|
+
return'"'+x+'"';}};Object.prototype.toJSONString=function()
|
975
|
+
{if(Event.isEventObject(this))return'null';return s.object(this,[]);};Array.prototype.toJSONString=function()
|
976
|
+
{return s.array(this,[]);};Boolean.prototype.toJSONString=function()
|
977
|
+
{return this;};Number.prototype.toJSONString=function()
|
978
|
+
{return isFinite(this)?this:'null';};})();String.prototype.parseJSON=function(){try{return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(this.replace(/"(\\.|[^"\\])*"/g,'')))&&eval('('+this+')');}catch(e){return false;}};hakano.util.KeyManager=Class.create();hakano.util.KeyManager=Object.extend(hakano.util.KeyManager,hakano.util.EventBroadcaster.prototype);Object.extend(hakano.util.KeyManager,{monitors:[],KEY_ENTER:1,KEY_ESCAPE:2,KEY_SPACEBAR:3,disabled:false,toString:function()
|
979
|
+
{return'[hakano.util.KeyManager]';},disable:function()
|
980
|
+
{this.disabled=true;},enable:function()
|
981
|
+
{this.disabled=false;},install:function()
|
982
|
+
{this.keyPressFunc=this.onkeypress.bindAsEventListener(this);document.body.onkeypress=this.keyPressFunc;window.siteUnloadedObservers.push(this.dispose.bind(this));},dispose:function()
|
983
|
+
{document.body.onkeypress=null;this.keyPressFunc=null;var self=this;this.monitors.each(function(m)
|
984
|
+
{self.removeHandler(m[0],m[1]);});this.monitors=null;hakano.util.EventBroadcaster.prototype.dispose.call(this);},removeHandler:function(key,element)
|
985
|
+
{if(element)
|
986
|
+
{var focusHandler=element['_focusHandler_'+key];var blurHandler=element['_blurHandler_'+key];if(focusHandler)
|
987
|
+
{Event.stopObserving(element,'focus',focusHandler,false);try
|
988
|
+
{delete element['_focusHandler_'+key];}
|
989
|
+
catch(E)
|
990
|
+
{}}
|
991
|
+
if(blurHandler)
|
992
|
+
{Event.stopObserving(element,'blur',blurHandler,false);try
|
993
|
+
{delete element['_blurHandler_'+key];}
|
994
|
+
catch(E)
|
995
|
+
{}}}
|
996
|
+
if(this.monitors.length>0)
|
997
|
+
{var found=null;for(var c=0,len=this.monitors.length;c<len;c++)
|
998
|
+
{var a=this.monitors[c];if(a[0]==key&&a[1]==element)
|
999
|
+
{found=a;break;}}
|
1000
|
+
if(found)
|
1001
|
+
{this.monitors.remove(found);}}},installHandler:function(key,element,handler)
|
1002
|
+
{var self=this;this.removeHandler(key,element);var array=[key,element,handler];if(element)
|
1003
|
+
{var focusHandler=function(e)
|
1004
|
+
{e=Event.getEvent(e);element.focused=true;self.monitors.remove(array);self.monitors.push(array);return true;};var blurHandler=function(e)
|
1005
|
+
{e=Event.getEvent(e);element.focused=false;self.monitors.remove(array);return true;};element['_focusHandler_'+key]=focusHandler;element['_blurHandler_'+key]=blurHandler;Event.observe(element,'focus',focusHandler,false);Event.observe(element,'blur',blurHandler,false);}
|
1006
|
+
else
|
1007
|
+
{this.monitors.push(array);}},onkeypress:function(e)
|
1008
|
+
{if(this.monitors.length>0&&!this.disabled)
|
1009
|
+
{var stop=false;for(var c=0,len=this.monitors.length;c<len;c++)
|
1010
|
+
{var m=this.monitors[c];if((Event.isEnterKey(e)&&m[0]==hakano.util.KeyManager.KEY_ENTER)||(Event.isEscapeKey(e)&&m[0]==hakano.util.KeyManager.KEY_ESCAPE)||(Event.isSpaceBarKey(e)&&m[0]==hakano.util.KeyManager.KEY_SPACEBAR))
|
1011
|
+
{var target=Event.element(e);if(m[1]==null||target==m[1])
|
1012
|
+
{m[2](e);stop=true;break;}}}
|
1013
|
+
if(stop)
|
1014
|
+
{Event.stop(e);return false;}}
|
1015
|
+
return true;}});window.siteLoadedObservers.push(hakano.util.KeyManager.install.bind(hakano.util.KeyManager));hakano.util.MD5=Class.create();hakano.util.MD5={hexcase:0,b64pad:"",chrsz:8,hex_md5:function(s){return this.binl2hex(this.core_md5(this.str2binl(s),s.length*this.chrsz));},b64_md5:function(s){return this.binl2b64(this.core_md5(this.str2binl(s),s.length*this.chrsz));},str_md5:function(s){return this.binl2str(this.core_md5(this.str2binl(s),s.length*this.chrsz));},hex_hmac_md5:function(key,data){return this.binl2hex(this.core_hmac_md5(key,data));},b64_hmac_md5:function(key,data){return this.binl2b64(this.core_hmac_md5(key,data));},str_hmac_md5:function(key,data){return this.binl2str(this.core_hmac_md5(key,data));},md5_vm_test:function()
|
1016
|
+
{return this.hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72";},core_md5:function(x,len)
|
1017
|
+
{x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16)
|
1018
|
+
{var olda=a;var oldb=b;var oldc=c;var oldd=d;a=this.md5_ff(a,b,c,d,x[i+0],7,-680876936);d=this.md5_ff(d,a,b,c,x[i+1],12,-389564586);c=this.md5_ff(c,d,a,b,x[i+2],17,606105819);b=this.md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=this.md5_ff(a,b,c,d,x[i+4],7,-176418897);d=this.md5_ff(d,a,b,c,x[i+5],12,1200080426);c=this.md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=this.md5_ff(b,c,d,a,x[i+7],22,-45705983);a=this.md5_ff(a,b,c,d,x[i+8],7,1770035416);d=this.md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=this.md5_ff(c,d,a,b,x[i+10],17,-42063);b=this.md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=this.md5_ff(a,b,c,d,x[i+12],7,1804603682);d=this.md5_ff(d,a,b,c,x[i+13],12,-40341101);c=this.md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=this.md5_ff(b,c,d,a,x[i+15],22,1236535329);a=this.md5_gg(a,b,c,d,x[i+1],5,-165796510);d=this.md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=this.md5_gg(c,d,a,b,x[i+11],14,643717713);b=this.md5_gg(b,c,d,a,x[i+0],20,-373897302);a=this.md5_gg(a,b,c,d,x[i+5],5,-701558691);d=this.md5_gg(d,a,b,c,x[i+10],9,38016083);c=this.md5_gg(c,d,a,b,x[i+15],14,-660478335);b=this.md5_gg(b,c,d,a,x[i+4],20,-405537848);a=this.md5_gg(a,b,c,d,x[i+9],5,568446438);d=this.md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=this.md5_gg(c,d,a,b,x[i+3],14,-187363961);b=this.md5_gg(b,c,d,a,x[i+8],20,1163531501);a=this.md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=this.md5_gg(d,a,b,c,x[i+2],9,-51403784);c=this.md5_gg(c,d,a,b,x[i+7],14,1735328473);b=this.md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=this.md5_hh(a,b,c,d,x[i+5],4,-378558);d=this.md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=this.md5_hh(c,d,a,b,x[i+11],16,1839030562);b=this.md5_hh(b,c,d,a,x[i+14],23,-35309556);a=this.md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=this.md5_hh(d,a,b,c,x[i+4],11,1272893353);c=this.md5_hh(c,d,a,b,x[i+7],16,-155497632);b=this.md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=this.md5_hh(a,b,c,d,x[i+13],4,681279174);d=this.md5_hh(d,a,b,c,x[i+0],11,-358537222);c=this.md5_hh(c,d,a,b,x[i+3],16,-722521979);b=this.md5_hh(b,c,d,a,x[i+6],23,76029189);a=this.md5_hh(a,b,c,d,x[i+9],4,-640364487);d=this.md5_hh(d,a,b,c,x[i+12],11,-421815835);c=this.md5_hh(c,d,a,b,x[i+15],16,530742520);b=this.md5_hh(b,c,d,a,x[i+2],23,-995338651);a=this.md5_ii(a,b,c,d,x[i+0],6,-198630844);d=this.md5_ii(d,a,b,c,x[i+7],10,1126891415);c=this.md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=this.md5_ii(b,c,d,a,x[i+5],21,-57434055);a=this.md5_ii(a,b,c,d,x[i+12],6,1700485571);d=this.md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=this.md5_ii(c,d,a,b,x[i+10],15,-1051523);b=this.md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=this.md5_ii(a,b,c,d,x[i+8],6,1873313359);d=this.md5_ii(d,a,b,c,x[i+15],10,-30611744);c=this.md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=this.md5_ii(b,c,d,a,x[i+13],21,1309151649);a=this.md5_ii(a,b,c,d,x[i+4],6,-145523070);d=this.md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=this.md5_ii(c,d,a,b,x[i+2],15,718787259);b=this.md5_ii(b,c,d,a,x[i+9],21,-343485551);a=this.safe_add(a,olda);b=this.safe_add(b,oldb);c=this.safe_add(c,oldc);d=this.safe_add(d,oldd);}
|
1019
|
+
return Array(a,b,c,d);},md5_cmn:function(q,a,b,x,s,t)
|
1020
|
+
{return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a,q),this.safe_add(x,t)),s),b);},md5_ff:function(a,b,c,d,x,s,t)
|
1021
|
+
{return this.md5_cmn((b&c)|((~b)&d),a,b,x,s,t);},md5_gg:function(a,b,c,d,x,s,t)
|
1022
|
+
{return this.md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);},md5_hh:function(a,b,c,d,x,s,t)
|
1023
|
+
{return this.md5_cmn(b^c^d,a,b,x,s,t);},md5_ii:function(a,b,c,d,x,s,t)
|
1024
|
+
{return this.md5_cmn(c^(b|(~d)),a,b,x,s,t);},core_hmac_md5:function(key,data)
|
1025
|
+
{var bkey=this.str2binl(key);if(bkey.length>16)
|
1026
|
+
{bkey=this.core_md5(bkey,key.length*this.chrsz);}
|
1027
|
+
var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++)
|
1028
|
+
{ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
|
1029
|
+
var hash=this.core_md5(ipad.concat(this.str2binl(data)),512+data.length*this.chrsz);return this.core_md5(opad.concat(hash),512+128);},safe_add:function(x,y)
|
1030
|
+
{var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);},bit_rol:function(num,cnt)
|
1031
|
+
{return(num<<cnt)|(num>>>(32-cnt));},str2binl:function(str)
|
1032
|
+
{var bin=Array();var mask=(1<<this.chrsz)-1;for(var i=0;i<str.length*this.chrsz;i+=this.chrsz)
|
1033
|
+
bin[i>>5]|=(str.charCodeAt(i/this.chrsz)&mask)<<(i%32);return bin;},binl2str:function(bin)
|
1034
|
+
{var str="";var mask=(1<<this.chrsz)-1;for(var i=0;i<bin.length*32;i+=this.chrsz)
|
1035
|
+
str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);return str;},binl2hex:function(binarray)
|
1036
|
+
{var hex_tab=this.hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++)
|
1037
|
+
{str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
|
1038
|
+
hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
|
1039
|
+
return str;},binl2b64:function(binarray)
|
1040
|
+
{var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3)
|
1041
|
+
{var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++)
|
1042
|
+
{if(i*8+j*6>binarray.length*32)
|
1043
|
+
{str+=this.b64pad;}
|
1044
|
+
else
|
1045
|
+
{str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}}
|
1046
|
+
return str;}};function NumberFormat(num,inputDecimal)
|
1047
|
+
{this.VERSION='Number Format v1.5.4';this.COMMA=',';this.PERIOD='.';this.DASH='-';this.LEFT_PAREN='(';this.RIGHT_PAREN=')';this.LEFT_OUTSIDE=0;this.LEFT_INSIDE=1;this.RIGHT_INSIDE=2;this.RIGHT_OUTSIDE=3;this.LEFT_DASH=0;this.RIGHT_DASH=1;this.PARENTHESIS=2;this.NO_ROUNDING=-1
|
1048
|
+
this.num;this.numOriginal;this.hasSeparators=false;this.separatorValue;this.inputDecimalValue;this.decimalValue;this.negativeFormat;this.negativeRed;this.hasCurrency;this.currencyPosition;this.currencyValue;this.places;this.roundToPlaces;this.truncate;this.setNumber=setNumberNF;this.toUnformatted=toUnformattedNF;this.setInputDecimal=setInputDecimalNF;this.setSeparators=setSeparatorsNF;this.setCommas=setCommasNF;this.setNegativeFormat=setNegativeFormatNF;this.setNegativeRed=setNegativeRedNF;this.setCurrency=setCurrencyNF;this.setCurrencyPrefix=setCurrencyPrefixNF;this.setCurrencyValue=setCurrencyValueNF;this.setCurrencyPosition=setCurrencyPositionNF;this.setPlaces=setPlacesNF;this.toFormatted=toFormattedNF;this.toPercentage=toPercentageNF;this.getOriginal=getOriginalNF;this.moveDecimalRight=moveDecimalRightNF;this.moveDecimalLeft=moveDecimalLeftNF;this.getRounded=getRoundedNF;this.preserveZeros=preserveZerosNF;this.justNumber=justNumberNF;this.expandExponential=expandExponentialNF;this.getZeros=getZerosNF;this.moveDecimalAsString=moveDecimalAsStringNF;this.moveDecimal=moveDecimalNF;this.addSeparators=addSeparatorsNF;if(inputDecimal==null){this.setNumber(num,this.PERIOD);}else{this.setNumber(num,inputDecimal);}
|
1049
|
+
this.setCommas(true);this.setNegativeFormat(this.LEFT_DASH);this.setNegativeRed(false);this.setCurrency(false);this.setCurrencyPrefix('$');this.setPlaces(2);}
|
1050
|
+
function setInputDecimalNF(val)
|
1051
|
+
{this.inputDecimalValue=val;}
|
1052
|
+
function setNumberNF(num,inputDecimal)
|
1053
|
+
{if(inputDecimal!=null){this.setInputDecimal(inputDecimal);}
|
1054
|
+
this.numOriginal=num;this.num=this.justNumber(num);}
|
1055
|
+
function toUnformattedNF()
|
1056
|
+
{return(this.num);}
|
1057
|
+
function getOriginalNF()
|
1058
|
+
{return(this.numOriginal);}
|
1059
|
+
function setNegativeFormatNF(format)
|
1060
|
+
{this.negativeFormat=format;}
|
1061
|
+
function setNegativeRedNF(isRed)
|
1062
|
+
{this.negativeRed=isRed;}
|
1063
|
+
function setSeparatorsNF(isC,separator,decimal)
|
1064
|
+
{this.hasSeparators=isC;if(separator==null)separator=this.COMMA;if(decimal==null)decimal=this.PERIOD;if(separator==decimal){this.decimalValue=(decimal==this.PERIOD)?this.COMMA:this.PERIOD;}else{this.decimalValue=decimal;}
|
1065
|
+
this.separatorValue=separator;}
|
1066
|
+
function setCommasNF(isC)
|
1067
|
+
{this.setSeparators(isC,this.COMMA,this.PERIOD);}
|
1068
|
+
function setCurrencyNF(isC)
|
1069
|
+
{this.hasCurrency=isC;}
|
1070
|
+
function setCurrencyValueNF(val)
|
1071
|
+
{this.currencyValue=val;}
|
1072
|
+
function setCurrencyPrefixNF(cp)
|
1073
|
+
{this.setCurrencyValue(cp);this.setCurrencyPosition(this.LEFT_OUTSIDE);}
|
1074
|
+
function setCurrencyPositionNF(cp)
|
1075
|
+
{this.currencyPosition=cp}
|
1076
|
+
function setPlacesNF(p,tr)
|
1077
|
+
{this.roundToPlaces=!(p==this.NO_ROUNDING);this.truncate=(tr!=null&&tr);this.places=(p<0)?0:p;}
|
1078
|
+
function addSeparatorsNF(nStr,inD,outD,sep)
|
1079
|
+
{nStr+='';var dpos=nStr.indexOf(inD);var nStrEnd='';if(dpos!=-1){nStrEnd=outD+nStr.substring(dpos+1,nStr.length);nStr=nStr.substring(0,dpos);}
|
1080
|
+
var rgx=/(\d+)(\d{3})/;while(rgx.test(nStr)){nStr=nStr.replace(rgx,'$1'+sep+'$2');}
|
1081
|
+
return nStr+nStrEnd;}
|
1082
|
+
function toFormattedNF()
|
1083
|
+
{var pos;var nNum=this.num;var nStr;var splitString=new Array(2);if(this.roundToPlaces){nNum=this.getRounded(nNum);nStr=this.preserveZeros(Math.abs(nNum));}else{nStr=this.expandExponential(Math.abs(nNum));}
|
1084
|
+
if(this.hasSeparators){nStr=this.addSeparators(nStr,this.PERIOD,this.decimalValue,this.separatorValue);}else{nStr=nStr.replace(new RegExp('\\'+this.PERIOD),this.decimalValue);}
|
1085
|
+
var c0='';var n0='';var c1='';var n1='';var n2='';var c2='';var n3='';var c3='';var negSignL=(this.negativeFormat==this.PARENTHESIS)?this.LEFT_PAREN:this.DASH;var negSignR=(this.negativeFormat==this.PARENTHESIS)?this.RIGHT_PAREN:this.DASH;if(this.currencyPosition==this.LEFT_OUTSIDE){if(nNum<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS)n1=negSignL;if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS)n2=negSignR;}
|
1086
|
+
if(this.hasCurrency)c0=this.currencyValue;}else if(this.currencyPosition==this.LEFT_INSIDE){if(nNum<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS)n0=negSignL;if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS)n3=negSignR;}
|
1087
|
+
if(this.hasCurrency)c1=this.currencyValue;}
|
1088
|
+
else if(this.currencyPosition==this.RIGHT_INSIDE){if(nNum<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS)n0=negSignL;if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS)n3=negSignR;}
|
1089
|
+
if(this.hasCurrency)c2=this.currencyValue;}
|
1090
|
+
else if(this.currencyPosition==this.RIGHT_OUTSIDE){if(nNum<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS)n1=negSignL;if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS)n2=negSignR;}
|
1091
|
+
if(this.hasCurrency)c3=this.currencyValue;}
|
1092
|
+
nStr=c0+n0+c1+n1+nStr+n2+c2+n3+c3;if(this.negativeRed&&nNum<0){nStr='<font color="red">'+nStr+'</font>';}
|
1093
|
+
return(nStr);}
|
1094
|
+
function toPercentageNF()
|
1095
|
+
{var nNum=this.num*100;nNum=this.getRounded(nNum);return nNum+'%';}
|
1096
|
+
function getZerosNF(places)
|
1097
|
+
{var extraZ='';var i=0;for(;i<places;i++){extraZ+='0';}
|
1098
|
+
return extraZ;}
|
1099
|
+
function expandExponentialNF(origVal)
|
1100
|
+
{if(isNaN(origVal))return origVal;var newVal=parseFloat(origVal)+'';var eLoc=newVal.toLowerCase().indexOf('e');if(eLoc!=-1){var plusLoc=newVal.toLowerCase().indexOf('+');var negLoc=newVal.toLowerCase().indexOf('-',eLoc);var justNumber=newVal.substring(0,eLoc);if(negLoc!=-1){var places=newVal.substring(negLoc+1,newVal.length);justNumber=this.moveDecimalAsString(justNumber,true,parseInt(places));}else{if(plusLoc==-1)plusLoc=eLoc;var places=newVal.substring(plusLoc+1,newVal.length);justNumber=this.moveDecimalAsString(justNumber,false,parseInt(places));}
|
1101
|
+
newVal=justNumber;}
|
1102
|
+
return newVal;}
|
1103
|
+
function moveDecimalRightNF(val,places)
|
1104
|
+
{var newVal='';if(places==null){newVal=this.moveDecimal(val,false);}else{newVal=this.moveDecimal(val,false,places);}
|
1105
|
+
return newVal;}
|
1106
|
+
function moveDecimalLeftNF(val,places)
|
1107
|
+
{var newVal='';if(places==null){newVal=this.moveDecimal(val,true);}else{newVal=this.moveDecimal(val,true,places);}
|
1108
|
+
return newVal;}
|
1109
|
+
function moveDecimalAsStringNF(val,left,places)
|
1110
|
+
{var spaces=(arguments.length<3)?this.places:places;if(spaces<=0)return val;var newVal=val+'';var extraZ=this.getZeros(spaces);var re1=new RegExp('([0-9.]+)');if(left){newVal=newVal.replace(re1,extraZ+'$1');var re2=new RegExp('(-?)([0-9]*)([0-9]{'+spaces+'})(\\.?)');newVal=newVal.replace(re2,'$1$2.$3');}else{var reArray=re1.exec(newVal);if(reArray!=null){newVal=newVal.substring(0,reArray.index)+reArray[1]+extraZ+newVal.substring(reArray.index+reArray[0].length);}
|
1111
|
+
var re2=new RegExp('(-?)([0-9]*)(\\.?)([0-9]{'+spaces+'})');newVal=newVal.replace(re2,'$1$2$4.');}
|
1112
|
+
newVal=newVal.replace(/\.$/,'');return newVal;}
|
1113
|
+
function moveDecimalNF(val,left,places)
|
1114
|
+
{var newVal='';if(places==null){newVal=this.moveDecimalAsString(val,left);}else{newVal=this.moveDecimalAsString(val,left,places);}
|
1115
|
+
return parseFloat(newVal);}
|
1116
|
+
function getRoundedNF(val)
|
1117
|
+
{val=this.moveDecimalRight(val);if(this.truncate){val=val>=0?Math.floor(val):Math.ceil(val);}else{val=Math.round(val);}
|
1118
|
+
val=this.moveDecimalLeft(val);return val;}
|
1119
|
+
function preserveZerosNF(val)
|
1120
|
+
{var i=0;val=this.expandExponential(val);if(this.places<=0)return val;var decimalPos=val.indexOf('.');if(decimalPos==-1){val+='.';for(;i<this.places;i++){val+='0';}}else{var actualDecimals=(val.length-1)-decimalPos;var difference=this.places-actualDecimals;for(;i<difference;i++){val+='0';}}
|
1121
|
+
return val;}
|
1122
|
+
function justNumberNF(val)
|
1123
|
+
{var newVal=val+'';var isPercentage=false;if(newVal.indexOf('%')!=-1){newVal=newVal.replace(/\%/g,'');isPercentage=true;}
|
1124
|
+
var re=new RegExp('[^\\'+this.inputDecimalValue+'\\d\\-\\+\\(\\)eE]','g');newVal=newVal.replace(re,'');var tempRe=new RegExp('['+this.inputDecimalValue+']','g');var treArray=tempRe.exec(newVal);if(treArray!=null){var tempRight=newVal.substring(treArray.index+treArray[0].length);newVal=newVal.substring(0,treArray.index)+this.PERIOD+tempRight.replace(tempRe,'');}
|
1125
|
+
if(newVal.charAt(newVal.length-1)==this.DASH){newVal=newVal.substring(0,newVal.length-1);newVal='-'+newVal;}
|
1126
|
+
else if(newVal.charAt(0)==this.LEFT_PAREN&&newVal.charAt(newVal.length-1)==this.RIGHT_PAREN){newVal=newVal.substring(1,newVal.length-1);newVal='-'+newVal;}
|
1127
|
+
newVal=parseFloat(newVal);if(!isFinite(newVal)){newVal=0;}
|
1128
|
+
if(isPercentage){newVal=this.moveDecimalLeft(newVal,2);}
|
1129
|
+
return newVal;}
|
1130
|
+
Object.setNestedProperty=function(obj,prop,value)
|
1131
|
+
{var props=prop.split('.');var cur=obj;var prev=null;var last=null;props.each(function(p)
|
1132
|
+
{last=p;if(cur[p])
|
1133
|
+
{prev=cur;cur=cur[p];}
|
1134
|
+
else
|
1135
|
+
{prev=cur;cur=cur[p]={};}});prev[last]=value;return obj;};Object.getNestedProperty=function(obj,prop)
|
1136
|
+
{if(obj!=null&&prop!=null)
|
1137
|
+
{var props=prop.split('.');if(props.length!=-1)
|
1138
|
+
{var cur=obj;props.each(function(p)
|
1139
|
+
{if(null!=cur[p])
|
1140
|
+
{cur=cur[p];}
|
1141
|
+
else
|
1142
|
+
{cur=null;throw $break;}});return cur;}
|
1143
|
+
else
|
1144
|
+
{return obj[prop];}}
|
1145
|
+
return null;};var exclusionMethods=['decorate','before','beforeAll','after','afterAll','setupDecoratorFor','initialize'];var exclusionPattern=/(before_|original_|after_)/;Object.decorate=function(object)
|
1146
|
+
{if(object._decorated)return object;object._decorated=true;object.setupDecoratorFor=function(method)
|
1147
|
+
{if(!('original_'+method in object))
|
1148
|
+
{var self=this;object['original_'+method]=object[method];object['before_'+method]=[];object['after_'+method]=[];object[method]=function()
|
1149
|
+
{var args=$A(arguments);self['before_'+method].each(function(f)
|
1150
|
+
{f.apply(self,[method,args]);});var rv=self['original_'+method].apply(self,args);self['after_'+method].each(function(f)
|
1151
|
+
{f.apply(self,[method,args,rv]);});return rv;};}};object.before=function(method,f)
|
1152
|
+
{object.setupDecoratorFor(method);object['before_'+method].unshift(f);return object;};object.beforeAll=function(f)
|
1153
|
+
{for(var p in object)
|
1154
|
+
{if(typeof(object[p])!='function'||exclusionMethods.contains(p)||exclusionPattern.test(p))continue;object.setupDecoratorFor(p);object['before_'+p].unshift(f);}
|
1155
|
+
return object;};object.after=function(method,f)
|
1156
|
+
{object.setupDecoratorFor(method);object['after_'+method].push(f);return object;};object.afterAll=function(f)
|
1157
|
+
{for(var p in object)
|
1158
|
+
{if(typeof(object[p])!='function'||exclusionMethods.contains(p)||exclusionPattern.test(p))continue;object.setupDecoratorFor(p);object['after_'+p].unshift(f);}
|
1159
|
+
return object;};return object;};Object.extend(Object.prototype,{decorate:function()
|
1160
|
+
{return Object.decorate(this);}});Object.copy=function(target,source)
|
1161
|
+
{if(source)
|
1162
|
+
{for(var p in source)
|
1163
|
+
{var obj=source[p];var type=typeof(obj);switch(type)
|
1164
|
+
{case'string':case'number':case'boolean':case'object':case'array':{target[p]=obj;break;}}}}
|
1165
|
+
return target;};Object.evalWithinScope=function(code,scope)
|
1166
|
+
{if(code=='{}')return{};var func=eval('var f = function(){return eval("('+code+')")}; f;');return func.call(scope);};Object.getExceptionDetail=function(e)
|
1167
|
+
{if(!e)return'No Exception Object';if(HAKANO.isIE)
|
1168
|
+
{return'message: '+e.message+', location: '+e.location||0;}
|
1169
|
+
else
|
1170
|
+
{return'message: '+e.message+', location: '+e.lineNumber||0;}};hakano.util.Scroller=Class.create();Object.extend(hakano.util.Scroller,{STEPS:35,smoothScrollTo:function(element)
|
1171
|
+
{if(!Element.visible(element))
|
1172
|
+
{Element.show(element);}
|
1173
|
+
var destx=element.offsetLeft;var desty=element.offsetTop;var thisNode=element;while(thisNode.offsetParent&&(thisNode.offsetParent!=document.body))
|
1174
|
+
{thisNode=thisNode.offsetParent;destx+=thisNode.offsetLeft;desty+=thisNode.offsetTop;}
|
1175
|
+
if(this.timer)
|
1176
|
+
{clearInterval(this.timer);this.timer=null;}
|
1177
|
+
var cypos=this.getCurrentYPos();var step=parseInt((desty-cypos)/this.STEPS);this.timer=setInterval('hakano.util.Scroller.scrollWindow('+step+','+desty+')',10);},getCurrentYPos:function()
|
1178
|
+
{if(document.body&&document.body.scrollTop)
|
1179
|
+
return document.body.scrollTop;if(document.documentElement&&document.documentElement.scrollTop)
|
1180
|
+
return document.documentElement.scrollTop;if(window.pageYOffset)
|
1181
|
+
return window.pageYOffset;return 0;},scrollWindow:function(scramount,dest)
|
1182
|
+
{var wascypos=this.getCurrentYPos();var isAbove=(wascypos<dest);window.scrollTo(0,wascypos+scramount);var iscypos=this.getCurrentYPos();var isAboveNow=(iscypos<dest);if((isAbove!=isAboveNow)||(wascypos==iscypos))
|
1183
|
+
{clearInterval(this.timer);this.timer=null;}}});hakano.util.SHA=Class.create();hakano.util.SHA={toSHA256Hex:function(value)
|
1184
|
+
{return this.hex_sha256(value);},chrsz:8,hexcase:1,safe_add:function(x,y)
|
1185
|
+
{var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);},S:function(X,n){return(X>>>n)|(X<<(32-n));},R:function(X,n){return(X>>>n);},Ch:function(x,y,z){return((x&y)^((~x)&z));},Maj:function(x,y,z){return((x&y)^(x&z)^(y&z));},Sigma0256:function(x){return(this.S(x,2)^this.S(x,13)^this.S(x,22));},Sigma1256:function(x){return(this.S(x,6)^this.S(x,11)^this.S(x,25));},Gamma0256:function(x){return(this.S(x,7)^this.S(x,18)^this.R(x,3));},Gamma1256:function(x){return(this.S(x,17)^this.S(x,19)^this.R(x,10));},Sigma0512:function(x){return(this.S(x,28)^this.S(x,34)^this.S(x,39));},Sigma1512:function(x){return(this.S(x,14)^this.S(x,18)^this.S(x,41));},Gamma0512:function(x){return(this.S(x,1)^this.S(x,8)^this.R(x,7));},Gamma1512:function(x){return(this.S(x,19)^this.S(x,61)^this.R(x,6));},core_sha256:function(m,l)
|
1186
|
+
{var K=new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2);var HASH=new Array(0x6A09E667,0xBB67AE85,0x3C6EF372,0xA54FF53A,0x510E527F,0x9B05688C,0x1F83D9AB,0x5BE0CD19);var W=new Array(64);var a,b,c,d,e,f,g,h;var T1,T2;m[l>>5]|=0x80<<(24-l%32);m[((l+64>>9)<<4)+15]=l;for(var i=0;i<m.length;i+=16){a=HASH[0];b=HASH[1];c=HASH[2];d=HASH[3];e=HASH[4];f=HASH[5];g=HASH[6];h=HASH[7];for(var j=0;j<64;j++){if(j<16)W[j]=m[j+i];else W[j]=this.safe_add(this.safe_add(this.safe_add(this.Gamma1256(W[j-2]),W[j-7]),this.Gamma0256(W[j-15])),W[j-16]);T1=this.safe_add(this.safe_add(this.safe_add(this.safe_add(h,this.Sigma1256(e)),this.Ch(e,f,g)),K[j]),W[j]);T2=this.safe_add(this.Sigma0256(a),this.Maj(a,b,c));h=g;g=f;f=e;e=this.safe_add(d,T1);d=c;c=b;b=a;a=this.safe_add(T1,T2);}
|
1187
|
+
HASH[0]=this.safe_add(a,HASH[0]);HASH[1]=this.safe_add(b,HASH[1]);HASH[2]=this.safe_add(c,HASH[2]);HASH[3]=this.safe_add(d,HASH[3]);HASH[4]=this.safe_add(e,HASH[4]);HASH[5]=this.safe_add(f,HASH[5]);HASH[6]=this.safe_add(g,HASH[6]);HASH[7]=this.safe_add(h,HASH[7]);}
|
1188
|
+
return HASH;},str2binb:function(str)
|
1189
|
+
{var bin=Array();var mask=(1<<this.chrsz)-1;for(var i=0;i<str.length*this.chrsz;i+=this.chrsz)
|
1190
|
+
bin[i>>5]|=(str.charCodeAt(i/this.chrsz)&mask)<<(24-i%32);return bin;},binb2str:function(bin)
|
1191
|
+
{var str="";var mask=(1<<this.chrsz)-1;for(var i=0;i<bin.length*32;i+=this.chrsz)
|
1192
|
+
str+=String.fromCharCode((bin[i>>5]>>>(24-i%32))&mask);return str;},binb2hex:function(binarray)
|
1193
|
+
{var hex_tab=this.hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++)
|
1194
|
+
{str+=hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8+4))&0xF)+
|
1195
|
+
hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8))&0xF);}
|
1196
|
+
return str;},binb2b64:function(binarray)
|
1197
|
+
{var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3)
|
1198
|
+
{var triplet=(((binarray[i>>2]>>8*(3-i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*(3-(i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*(3-(i+2)%4))&0xFF);for(var j=0;j<4;j++)
|
1199
|
+
{if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}
|
1200
|
+
return str;},hex_sha256:function(s){return this.binb2hex(this.core_sha256(this.str2binb(s),s.length*this.chrsz));},b64_sha256:function(s){return this.binb2b64(this.core_sha256(this.str2binb(s),s.length*this.chrsz));},str_sha256:function(s){return this.binb2str(this.core_sha256(this.str2binb(s),s.length*this.chrsz));}};Object.extend(String.prototype,{limit:function(size)
|
1201
|
+
{if(this.length>size)
|
1202
|
+
{return this.substring(0,size)+"...";}
|
1203
|
+
return this;},trim:function()
|
1204
|
+
{return this.replace(/^\s+/g,'').replace(/\s+$/g,'');},startsWith:function(value)
|
1205
|
+
{if(value.length<=this.length)
|
1206
|
+
{return this.substring(0,value.length)==value;}
|
1207
|
+
return false;},toFunction:function(dontPreProcess)
|
1208
|
+
{var str=this.trim();if(str.length==0)
|
1209
|
+
{return Prototype.emptyFunction;}
|
1210
|
+
if(!dontPreProcess)
|
1211
|
+
{if(str.match(/^function\(/))
|
1212
|
+
{str='return '+String.unescapeXML(this)+'()';}
|
1213
|
+
else if(!str.match(/return/))
|
1214
|
+
{str='return '+String.unescapeXML(this);}
|
1215
|
+
else if(str.match(/^return function/))
|
1216
|
+
{str=String.unescapeXML(this)+' ();';}}
|
1217
|
+
var code='var f = function(){'+str+'}; f;';var func=eval(code);if(typeof(func)=='function')
|
1218
|
+
{return func;}
|
1219
|
+
throw Error('code was not a function: '+this);}});String.escapeXML=function(value)
|
1220
|
+
{var str="";for(var c=0;c<value.length;c++)
|
1221
|
+
{var ch=value.charAt(c);if(ch=='"')
|
1222
|
+
{str+=""";}
|
1223
|
+
else if(ch=='&')
|
1224
|
+
{str+="&";}
|
1225
|
+
else if(ch=='>')
|
1226
|
+
{str+=">";}
|
1227
|
+
else if(ch=='<')
|
1228
|
+
{str+="<";}
|
1229
|
+
else if(ch=='\'')
|
1230
|
+
{str+="'";}
|
1231
|
+
else
|
1232
|
+
{str+=ch;}}
|
1233
|
+
return str;};String.unescapeXML=function(value)
|
1234
|
+
{if(!value)return null;var v=value.replace(/</g,"<");v=v.replace(/>/g,">");v=v.replace(/'/g,"'");v=v.replace(/&/g,"&");v=v.replace(/"/g,"\"");return v;};HAKANO.unescapeXML=String.unescapeXML;HAKANO.escapeXML=String.escapeXML;var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";String.prototype.encode64=function()
|
1235
|
+
{var input=this;var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
|
1236
|
+
output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+
|
1237
|
+
keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i<input.length);return output;};String.prototype.decode64=function(){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;var input=this;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
|
1238
|
+
if(enc4!=64){output=output+String.fromCharCode(chr3);}}while(i<input.length);return output;};hakano.util.URI=Class.create();Object.extend(hakano.util.URI,{splitQueryParams:function(uri)
|
1239
|
+
{if(!uri)return{};var pairs=uri.split('&');return pairs.inject({},function(params,pairString)
|
1240
|
+
{var pair=pairString.split('=');params[decodeURIComponent(pair[0])]=pair[1]?decodeURIComponent(pair[1]):undefined;return params;});},toQueryString:function(array)
|
1241
|
+
{var q="";array.each(function(entry)
|
1242
|
+
{if(""!=q)
|
1243
|
+
{q+="&";}
|
1244
|
+
q+=encodeURIComponent(entry[0])+"="+encodeURIComponent(entry[1]);});return q;},toQueryParams:function(uri)
|
1245
|
+
{if(uri)
|
1246
|
+
{var i=uri.indexOf('?');if(i!=-1)
|
1247
|
+
{return this.splitQueryParams(uri.substring(i+1));}}
|
1248
|
+
return{};},getRootPath:function(uri)
|
1249
|
+
{var abs=uri.indexOf(':/');if(abs==-1)
|
1250
|
+
{throw"must be an absolute uri: "+uri;}
|
1251
|
+
var qs=uri.indexOf('?');if(qs!=-1)
|
1252
|
+
{uri=uri.substring(0,qs);}
|
1253
|
+
else
|
1254
|
+
{hash=uri.indexOf('#');if(hash!=-1)
|
1255
|
+
{uri=uri.substring(0,hash);}}
|
1256
|
+
var i=uri.lastIndexOf('/');if(i==-1)
|
1257
|
+
{return uri+'/';}
|
1258
|
+
if(i==uri.length-1)
|
1259
|
+
{return uri;}
|
1260
|
+
var proto=uri.substring(abs,3);var len=3;if(proto!='://')
|
1261
|
+
{len=2;}
|
1262
|
+
if(i>abs+len)
|
1263
|
+
{uri=uri.substring(0,i);if(uri.substring(uri.length-1)=='/')
|
1264
|
+
{return uri;}}
|
1265
|
+
return uri+'/';},parse:function(target,base)
|
1266
|
+
{var basePath=base?base:HAKANO.DocumentPath;var rootPath=this.getRootPath(basePath);if(target=='/'||target=='')return rootPath;if(target.substring(0,1)=='/'||(target.length>2&&target.substr(0,3)=="../")||(target.length>1&&target.substr(0,2)=="./"))
|
1267
|
+
{if(target.substring(0,1)=='/')
|
1268
|
+
{return rootPath+target.substring(1);}
|
1269
|
+
return rootPath+target;}
|
1270
|
+
else if(target.indexOf(":/")!=-1)
|
1271
|
+
{return target;}
|
1272
|
+
else
|
1273
|
+
{return rootPath+target;}},regexp:/(ftp|http|https|file):(\/){1,2}(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/,isValid:function(str)
|
1274
|
+
{return str==null||str==''?false:str.match(this.regexp);},chopDirectories:function(path,count)
|
1275
|
+
{var paths=path.split('/');var str='';for(var c=0;c<paths.length-count;c++)
|
1276
|
+
{str+=paths[c]+'/';}
|
1277
|
+
return str;}});hakano.util.UUID={dateSeed:new Date().getTime(),generateNewId:function()
|
1278
|
+
{var a=Math.round(9999999999*Math.random());var b=Math.round(9999999999*Math.random());var c=Math.round(this.dateSeed*Math.random());return a+"-"+b+"-"+c;}};hakano.util.MessageBroker=Class.create();Object.extend(hakano.util.MessageBroker,hakano.util.EventBroadcaster.prototype);Object.extend(hakano.util.MessageBroker,{DEBUG:true,init:false,serverPath:HAKANO.DocumentPath+"service/messagebroker",interceptors:[],messageQueue:[],timer:null,time:null,currentRequestId:1,serverDown:false,poll:true,fetching:false,localDirectListeners:{},remoteDirectListeners:{},localPatternListeners:[],remotePatternListeners:[],devmode:(window.location.href.indexOf('devmode=1')>0),toString:function()
|
1279
|
+
{return'[MessageBroker]';},addInterceptor:function(interceptor)
|
1280
|
+
{$D(this.toString()+' Adding interceptor: '+interceptor);this.interceptors.push(interceptor);},removeInterceptor:function(interceptor)
|
1281
|
+
{$D(this.toString()+'Removing interceptor: '+interceptor);this.interceptors.remove(interceptor);},addListenerByType:function(t,callback)
|
1282
|
+
{t=t.trim();var idx=t.indexOf(':');var direction=(idx!=-1)?(t.substring(0,idx)):'both';var type=(idx!=-1)?t.substring(idx+1):t;var regex=type.charAt(0)=='~';if(direction=='local'||direction=='both')
|
1283
|
+
{var array=null;if(regex)
|
1284
|
+
{this.localPatternListeners.push([callback,new RegExp(type.substring(1))]);var removePatternListenerArrays=callback['_removePatternListenerArrays'];if(!removePatternListenerArrays)
|
1285
|
+
{removePatternListenerArrays=[];callback['_removePatternListenerArrays']=removePatternListenerArrays;}
|
1286
|
+
removePatternListenerArrays.push(this.localPatternListeners);}
|
1287
|
+
else
|
1288
|
+
{array=this.localDirectListeners[type];if(!array)
|
1289
|
+
{array=[];this.localDirectListeners[type]=array;}
|
1290
|
+
var removeListenerArrays=callback['_removeListenerArrays'];if(!removeListenerArrays)
|
1291
|
+
{removeListenerArrays=[];callback['_removeListenerArrays']=removeListenerArrays;}
|
1292
|
+
removeListenerArrays.push(array);array.push(callback);}}
|
1293
|
+
if(direction=='remote'||direction=='both')
|
1294
|
+
{var array=null;if(regex)
|
1295
|
+
{this.remotePatternListeners.push([callback,new RegExp(type.substring(1))]);var removePatternListenerArrays=callback['_removePatternListenerArrays'];if(!removePatternListenerArrays)
|
1296
|
+
{removePatternListenerArrays=[];callback['_removePatternListenerArrays']=removePatternListenerArrays;}
|
1297
|
+
removePatternListenerArrays.push(this.remotePatternListeners);}
|
1298
|
+
else
|
1299
|
+
{array=this.remoteDirectListeners[type];if(!array)
|
1300
|
+
{array=[];this.remoteDirectListeners[type]=array;}
|
1301
|
+
var removeListenerArrays=callback['_removeListenerArrays'];if(!removeListenerArrays)
|
1302
|
+
{removeListenerArrays=[];callback['_removeListenerArrays']=removeListenerArrays;}
|
1303
|
+
removeListenerArrays.push(array);array.push(callback);}}},addListener:function(callback)
|
1304
|
+
{var startTime=new Date().getTime();var accept=callback['accept'];if(!accept)
|
1305
|
+
{alert('add listener problem, callback incorrect and has no accept function\n'+callback);return;}
|
1306
|
+
var types=accept.call(callback);if(types.length==1)
|
1307
|
+
{this.addListenerByType(types[0],callback);}
|
1308
|
+
else
|
1309
|
+
{for(var c=0,len=types.length;c<len;c++)
|
1310
|
+
{this.addListenerByType(types[c],callback);}}
|
1311
|
+
if(this.DEBUG)$D(this.toString()+' Added listener: '+callback+' ('+(new Date().getTime()-startTime)+' ms)');},removeListener:function(callback)
|
1312
|
+
{var startTime=new Date().getTime();var removeListenerArrays=callback['_removeListenerArrays'];if(removeListenerArrays&&removeListenerArrays.length>0)
|
1313
|
+
{for(var c=0,len=removeListenerArrays.length;c<len;c++)
|
1314
|
+
{removeListenerArrays[c].remove(callback);}
|
1315
|
+
delete callback['_removeListenerArrays'];}
|
1316
|
+
var removePatternListenerArrays=callback['_removePatternListenerArrays'];if(removePatternListenerArrays&&removePatternListenerArrays.length>0)
|
1317
|
+
{for(var c=0,len=removePatternListenerArrays.length;c<len;c++)
|
1318
|
+
{var array=removePatternListenerArrays[c];if(array&&array.length>0)
|
1319
|
+
{var found=null;for(var x=0,xlen=array.length;x<xlen;x++)
|
1320
|
+
{var e=array[x];if(e[0]==callback)
|
1321
|
+
{found=e;break;}}
|
1322
|
+
if(found)array.remove(found);}}}
|
1323
|
+
if(this.DEBUG)$D(this.toString()+' Removed listener: '+callback+' ('+(new Date().getTime()-startTime)+' ms)');},queue:function(msg,callback)
|
1324
|
+
{var type=msg['type'];if(!type)
|
1325
|
+
{throw"type must be specified on the message";}
|
1326
|
+
if(this.interceptors.length>0)
|
1327
|
+
{var send=true;for(var c=0,len=this.interceptors.length;c<len;c++)
|
1328
|
+
{var interceptor=this.interceptors[c];var func=interceptor['interceptQueue'];if(func)
|
1329
|
+
{var result=func.apply(interceptor,[msg,callback]);if(this.DEBUG)$D(self.toString()+' Invoked interceptor: '+interceptor+', returned: '+result+' for message: '+type);if(result!=null&&!result)
|
1330
|
+
{send=false;break;}}}
|
1331
|
+
if(!send)
|
1332
|
+
{$D(this+' interceptor squashed event: '+msg['type']);return;}}
|
1333
|
+
var a=type.indexOf(':');var dest=a!=-1?type.substring(0,a):'local';var name=a!=-1?type.substring(a+1):type;msg['type']=name;var data=(msg['data'])?msg['data']:{};var json=null;switch(typeof(data))
|
1334
|
+
{case'object':case'array':json=data.toJSONString();break;default:json=data.toString();break;}
|
1335
|
+
data.toString=function()
|
1336
|
+
{return json;};$D(this+' message queued: '+name+', data: '+json);switch(dest)
|
1337
|
+
{case'remote':{if(this.messageQueue)
|
1338
|
+
{if(!this.devmode)
|
1339
|
+
{this.messageQueue.push([msg,callback]);this.startTimer(msg['immediate']||false);}}
|
1340
|
+
else
|
1341
|
+
{Logger.error(this+' message:'+name+" ignored since we don't have a messageQueue!");}
|
1342
|
+
var arraydirect=this.remoteDirectListeners[name];var arraypattern=this.remotePatternListeners;if(arraydirect)
|
1343
|
+
{for(var c=0,len=arraydirect.length;c<len;c++)
|
1344
|
+
{this.sendToListener(arraydirect[c],name,data,'JSON',dest);}}
|
1345
|
+
if(arraypattern)
|
1346
|
+
{for(var c=0,len=arraypattern.length;c<len;c++)
|
1347
|
+
{var entry=arraypattern[c];var listener=entry[0];var pattern=entry[1];if(pattern.test(name))
|
1348
|
+
{this.sendToListener(listener,name,data,'JSON',dest);}}}
|
1349
|
+
break;}
|
1350
|
+
case'local':{var arraydirect=this.localDirectListeners[name];var arraypattern=this.localPatternListeners;if(arraydirect)
|
1351
|
+
{for(var c=0,len=arraydirect.length;c<len;c++)
|
1352
|
+
{this.sendToListener(arraydirect[c],name,data,'JSON',dest);}}
|
1353
|
+
if(arraypattern)
|
1354
|
+
{for(var c=0,len=arraypattern.length;c<len;c++)
|
1355
|
+
{var entry=arraypattern[c];var listener=entry[0];var pattern=entry[1];if(pattern.test(name))
|
1356
|
+
{this.sendToListener(listener,name,data,'JSON',dest);}}}
|
1357
|
+
break;}}},processIncoming:function(xml)
|
1358
|
+
{if(xml)
|
1359
|
+
{var children=xml.documentElement.childNodes;if(children&&children.length>0)
|
1360
|
+
{for(var c=0;c<children.length;c++)
|
1361
|
+
{var child=children.item(c);if(child.nodeType==hakano.util.Dom.ELEMENT_NODE)
|
1362
|
+
{var requestid=child.getAttribute("requestid");try
|
1363
|
+
{this.dispatch(requestid,child);}
|
1364
|
+
catch(e)
|
1365
|
+
{Logger.error(this+' - Error in dispatch of message. '+Object.getExceptionDetail(e));}}}}}},dispatch:function(requestid,msg)
|
1366
|
+
{var type=msg.getAttribute("type");var datatype=msg.getAttribute("datatype");var data=msg;if(datatype=='JSON')
|
1367
|
+
{var text;try
|
1368
|
+
{text=hakano.util.Dom.getText(msg);data=text.parseJSON();data.toString=function()
|
1369
|
+
{if(!this._toString)
|
1370
|
+
{this._toString=this.toJSONString();}
|
1371
|
+
return this._toString;};$D(this.toString()+' received remote message, type:'+type+',data:'+data);}
|
1372
|
+
catch(e)
|
1373
|
+
{Logger.error('Error received evaluating: '+text+' for '+msg+', type:'+type+", "+Object.getExceptionDetail(e));return;}}
|
1374
|
+
if(this.interceptors.length>0)
|
1375
|
+
{var send=true;for(var c=0,len=this.interceptors.length;c<len;c++)
|
1376
|
+
{var interceptor=this.interceptors[c];var func=interceptor['interceptDispatch'];if(func)
|
1377
|
+
{var result=func.apply(interceptor,[requestid,type,data,datatype]);if(result!=null&&!result)
|
1378
|
+
{send=false;break;}}}
|
1379
|
+
if(!send)
|
1380
|
+
{return;}}
|
1381
|
+
var array=this.remoteDirectListeners[type];if(array&&array.length>0)
|
1382
|
+
{for(var c=0,len=array.length;c<len;c++)
|
1383
|
+
{this.sendToListener(array[c],type,data,datatype,'remote');}}
|
1384
|
+
if(this.remotePatternListeners.length>0)
|
1385
|
+
{for(var c=0,len=this.remotePatternListeners.length;c<len;c++)
|
1386
|
+
{var entry=this.remotePatternListeners[c];var listener=entry[0];var pattern=entry[1];if(pattern.test(type))
|
1387
|
+
{this.sendToListener(listener,type,data,datatype,'remote');}}}},sendToListener:function(listener,type,msg,datatype,from)
|
1388
|
+
{if(this.interceptors.length>0)
|
1389
|
+
{var send=true;for(var c=0,len=this.interceptors.length;c<len;c++)
|
1390
|
+
{var interceptor=this.interceptors[c];var func=interceptor['interceptSendToListener'];if(func)
|
1391
|
+
{var result=func.apply(interceptor,[listener,type,msg,datatype,from]);if(result!=null&&!result)
|
1392
|
+
{send=false;break;}}}
|
1393
|
+
if(!send)
|
1394
|
+
{return;}}
|
1395
|
+
$D(this.toString()+' forwarding '+type+' to '+listener+', direction:'+from+', datatype:'+datatype+', data: '+msg);try
|
1396
|
+
{listener['onMessage'].apply(listener,[type,msg,datatype,from]);}
|
1397
|
+
catch(e)
|
1398
|
+
{Logger.error("Unhandled Exception dispatching:"+type+", "+msg+", to listener:"+listener+", "+Object.getExceptionDetail(e));}
|
1399
|
+
return true;},XML_REGEXP:/^<(.*)>$/,deliver:function(initialrequest)
|
1400
|
+
{var self=this;var xml=null;if(this.messageQueue==null)
|
1401
|
+
{Logger.error(this.toString()+', deliver called but no message queue');return;}
|
1402
|
+
if(this.messageQueue.length>0)
|
1403
|
+
{xml="<?xml version='1.0'?>\n";var idleMs=hakano.util.IdleManager.getIdleTimeInMS();xml+="<request version='1.0' idle='"+idleMs+"'>\n";var timestamp=new Date().getTime();for(var c=0,len=this.messageQueue.length;c<len;c++)
|
1404
|
+
{var msg=this.messageQueue[c];var requestid=this.currentRequestId++;var data=msg[0]['data']||"<data/>";var datatype=this.XML_REGEXP.exec(data)?'XML':'JSON';if(datatype=='JSON')
|
1405
|
+
{data='<![CDATA['+data.toJSONString()+']]>';}
|
1406
|
+
xml+="<message requestid='"+requestid+"' type='"+msg[0]['type']+"' datatype='"+datatype+"'>";xml+=data;xml+="</message>";}
|
1407
|
+
this.messageQueue.clear();xml+="</request>";}
|
1408
|
+
var _method=(xml==null)?'get':'post';var p=(initialrequest&&xml==null)?"?maxwait=1&initial=1":"?maxwait="+((!initialrequest&&xml)?this.maxWaitPollTime:this.maxWaitPollTimeWhenSending);Logger.trace(this.toString()+' Sending (poll='+(this.poll)+'): '+(xml||'<empty>'));this.fetching=true;new Ajax.Request(this.serverPath+p,{asynchronous:true,method:_method,postBody:xml||"",contentType:'text/xml',onComplete:function()
|
1409
|
+
{self.fetching=false;},onSuccess:function(result)
|
1410
|
+
{self.fetching=false;self.startTimer(false);if(result&&result.status)
|
1411
|
+
{if(result.status==401)
|
1412
|
+
{self.onMessageBrokerInvalidLogin();return;}
|
1413
|
+
if(result.status!=204)
|
1414
|
+
{var contentType=result.getResponseHeader('Content-type');if(!contentType||contentType.indexOf('text/xml')==-1)
|
1415
|
+
{self.onMessageBrokerInvalidContentType();return;}}
|
1416
|
+
if(self.serverDown)
|
1417
|
+
{self.serverDown=false;var downtime=new Date().getTime()-self.serverDownStarted;Logger.info('['+hakano.util.DateTime.get12HourTime(new Date(),true,true)+'] '+self.toString()+' Server is UP at '+self.serverPath);self.fireEvent("serverUp",downtime);self.queue({type:'local:hakano.messagebroker.server.up',data:{path:this.serverPath,downtime:downtime}});}
|
1418
|
+
var redirected=result.getResponseHeader("X-Hakano-Redirect");if(result.status==302||redirected)
|
1419
|
+
{self.fireEvent("logout");return;}
|
1420
|
+
if(result.status==200)
|
1421
|
+
{var skip=false;var cl=result.getResponseHeader("Content-Length");if(cl&&cl=="0")
|
1422
|
+
{skip=true;Logger.info(self.toString()+' Receiving no messages on response');}
|
1423
|
+
if(!skip)
|
1424
|
+
{Logger.info('['+hakano.util.DateTime.get12HourTime(new Date(),true,true)+'] '+self.toString()+' Receiving: '+result.responseText);self.processIncoming(result.responseXML);}}}
|
1425
|
+
if(result&&result.status&&result.status!=200&&result.status!=503&&result.status!=204)
|
1426
|
+
{Logger.error(self.toString()+' Response Failure: '+result.status+' '+result.statusText);}},onFailure:function(transport,json)
|
1427
|
+
{self.fetching=false;if(transport.status>=500||transport.status==404)
|
1428
|
+
{self.serverDown=true;self.serverDownStarted=new Date().getTime();Logger.warn(self.toString()+' Server is DOWN at '+self.serverPath);self.fireEvent("serverDown");self.queue({type:'local:hakano.messagebroker.server.down',data:{path:self.serverPath}});}
|
1429
|
+
else
|
1430
|
+
{Logger.error(self.toString()+' Failure: '+transport.status+' '+transport.statusText);}
|
1431
|
+
self.startTimer(false);},onException:function(resp,ex)
|
1432
|
+
{var msg=new String(ex);var log=true;var restartTimer=true;self.fetching=false;if(msg.indexOf("NS_ERROR_NOT_AVAILABLE")!=-1&&msg.indexOf("nsIXMLHttpRequest.status")!=-1)
|
1433
|
+
{log=false;}
|
1434
|
+
if(msg.indexOf("NS_ERROR_FILE_NOT_FOUND")!=-1)
|
1435
|
+
{restartTimer=false;}
|
1436
|
+
if(log)
|
1437
|
+
{Logger.error(self.toString()+' Exception: '+msg);}
|
1438
|
+
if(restartTimer)
|
1439
|
+
{self.startTimer(false);}}});},destroy:function()
|
1440
|
+
{this.cancelTimer();if(this.messageQueue)this.messageQueue.clear();this.messageQueue=null;this.time=null;if(this.localDirectListeners)
|
1441
|
+
{for(var p in this.localDirectListeners)
|
1442
|
+
{var a=this.localDirectListeners[p];if(typeof(a)=='array')
|
1443
|
+
{a.clear();}}
|
1444
|
+
this.localDirectListeners=null;}
|
1445
|
+
if(this.remoteDirectListeners)
|
1446
|
+
{for(var p in this.remoteDirectListeners)
|
1447
|
+
{var a=this.remoteDirectListeners[p];if(typeof(a)=='array')
|
1448
|
+
{a.clear();}}
|
1449
|
+
this.remoteDirectListeners=null;}
|
1450
|
+
if(this.localPatternListeners)this.localPatternListeners.clear();this.localPatternListeners=null;if(this.remotePatternListeners)this.remotePatternListeners.clear();this.remotePatternListeners=null;},cancelTimer:function()
|
1451
|
+
{if(this.timer)
|
1452
|
+
{clearTimeout(this.timer);this.timer=0;}},onMessageBrokerInvalidContentType:function()
|
1453
|
+
{$D(this+', received an invalid content type, probably need to re-login, redirecting to landing page');if(window.location.href!=HAKANO.DocumentPath)
|
1454
|
+
{window.location.href=HAKANO.DocumentPath;}},onMessageBrokerInvalidLogin:function()
|
1455
|
+
{$D(this+', received an invalid credentials, probably need to re-login, redirecting to landing page');if(window.location.href!=HAKANO.DocumentPath)
|
1456
|
+
{window.location.href=HAKANO.DocumentPath;}},startTimer:function(force)
|
1457
|
+
{if(!this.init)
|
1458
|
+
{Logger.error(this.toString()+' - startTimer called but not running');return;}
|
1459
|
+
this.cancelTimer();if(this.messageQueue)
|
1460
|
+
{if(!this.poll)
|
1461
|
+
{if(this.messageQueue.length>0&&!this.fetching)
|
1462
|
+
{this.emptyQueueHits=0;this.deliver(true);return;}
|
1463
|
+
return;}
|
1464
|
+
if(force&&!this.fetching)
|
1465
|
+
{this.emptyQueueHits=0;this.deliver(force);return;}
|
1466
|
+
var now=new Date().getTime();if(this.time)
|
1467
|
+
{if(this.messageQueue.length>0&&now-this.time>=150&&!this.fetching)
|
1468
|
+
{this.emptyQueueHits=0;this.deliver(false);return;}}
|
1469
|
+
this.time=now;var self=this;var qtime=this.downServerPoll;if(!this.serverDown)
|
1470
|
+
{if(this.messageQueue.length>1)
|
1471
|
+
{qtime=this.moreThanOneEntryQueuePoll;this.emptyQueueHits=0;}
|
1472
|
+
else
|
1473
|
+
{if(this.messageQueue.length>0)
|
1474
|
+
{qtime=this.oneEntryQueuePoll;this.emptyQueueHits=0;}
|
1475
|
+
else
|
1476
|
+
{qtime=Math.min(this.emptyQueuePollMax,this.emptyQueuePoll+(this.emptyQueueHits*this.emptyQueueDecay));this.emptyQueueHits++;}}}
|
1477
|
+
this.timer=setTimeout(function()
|
1478
|
+
{if(!self.fetching)
|
1479
|
+
{self.deliver(false);}},qtime);}
|
1480
|
+
else
|
1481
|
+
{Logger.error(toString()+' startTimer called and we have no message queue');}},maxWaitPollTime:200,maxWaitPollTimeWhenSending:100,moreThanOneEntryQueuePoll:50,oneEntryQueuePoll:200,emptyQueuePoll:2000,emptyQueuePollMax:30000,emptyQueueDecay:500,emptyQueueHits:0,downServerPoll:10000});hakano.util.MessageBrokerInterceptor=Class.create();Object.extend(hakano.util.MessageBrokerInterceptor.prototype,{initialize:function()
|
1482
|
+
{},toString:function()
|
1483
|
+
{return'[hakano.util.MessageBrokerInterceptor]';},interceptQueue:function(msg,callback)
|
1484
|
+
{return true;},interceptDispatch:function(requestid,type,data,datatype)
|
1485
|
+
{return true;},interceptSendToListener:function(listener,type,msg,datatype)
|
1486
|
+
{return true;}});hakano.util.MessageBroker.poll=false;var seamlessXMLPath=HAKANO.DocumentPath+'seamless.xml';var md5=hakano.util.MD5.hex_md5(seamlessXMLPath);var mbp=hakano.util.Cookie.GetCookie('mbPath_'+md5);if(mbp)
|
1487
|
+
{var json=eval('('+mbp.decode64()+')');hakano.util.MessageBroker.serverPath=json.src;hakano.util.MessageBroker.poll=(json.poll=='true');hakano.util.MessageBroker.init=true;hakano.util.MessageBroker.startTimer();}
|
1488
|
+
else
|
1489
|
+
{new Ajax.Request(seamlessXMLPath,{asynchronous:true,method:'get',onSuccess:function(resp)
|
1490
|
+
{var re=/<messagebroker poll="(true|false)">(.*?)<\/messagebroker>/;var match=re.exec(resp.responseText);var poll=match[1];var mbPath=match[2];var template=new Template(mbPath,/(^|.|\r|\n)(@\{(.*?)\})/);var newsrc=template.evaluate(HAKANO.TEMPLATE_VARS);hakano.util.MessageBroker.serverPath=newsrc;hakano.util.MessageBroker.poll=(poll=='true');hakano.util.MessageBroker.init=true;hakano.util.MessageBroker.startTimer();var cookie={src:newsrc,poll:hakano.util.MessageBroker.poll}.toJSONString().encode64();var date=new Date();date.setTime(date.getTime()+(7*24*60*60*1000));hakano.util.Cookie.SetCookie('mbPath_'+md5,cookie,date);}});}
|
1491
|
+
window.siteUnloadedObservers.push(hakano.util.MessageBroker.destroy.bind(hakano.util.MessageBroker));var SelectorLiteAddon=Class.create();SelectorLiteAddon.prototype={initialize:function(stack){this.r=[];this.s=[];this.i=0;for(var i=stack.length-1;i>=0;i--){var s=["*","",[]];var t=stack[i];var cursor=t.length-1;do{var d=t.lastIndexOf("#");var p=t.lastIndexOf(".");cursor=Math.max(d,p);if(cursor==-1){s[0]=t.toUpperCase();}else if(d==-1||p==cursor){s[2].push(t.substring(p+1));}else if(!s[1]){s[1]=t.substring(d+1);}
|
1492
|
+
t=t.substring(0,cursor);}while(cursor>0);this.s[i]=s;}},get:function(root){this.explore(root||document,this.i==(this.s.length-1));return this.r;},explore:function(elt,leaf){var s=this.s[this.i];var r=[];if(s[1]){var e=$(s[1]);if(e&&(s[0]=="*"||e.tagName==s[0])&&e.childOf(elt)){r=[e];}}else{r=$A(elt.getElementsByTagName(s[0]));}
|
1493
|
+
if(s[2].length==1){r=r.findAll(function(o){if(o.className.indexOf(" ")==-1){return o.className==s[2][0];}else{return o.className.split(/\s+/).include(s[2][0]);}});}else if(s[2].length>0){r=r.findAll(function(o){if(o.className.indexOf(" ")==-1){return false;}else{var q=o.className.split(/\s+/);return s[2].all(function(c){return q.include(c);});}});}
|
1494
|
+
if(leaf){this.r=this.r.concat(r);}else{++this.i;r.each(function(o){this.explore(o,this.i==(this.s.length-1));}.bind(this));}}}
|
1495
|
+
var $$old=$$;var $$=function(a,b){if(b||a.indexOf("[")>=0)return $$old.apply(this,arguments);return new SelectorLiteAddon(a.split(/\s+/)).get();}
|
1496
|
+
var $S=$$;var Decorator=Class.create();Decorator={toString:function()
|
1497
|
+
{return'[Decorator]';},defaultDecorator:function(element,valid)
|
1498
|
+
{},decoratorId:0,checkInvalid:function(element,valid,decId,msg,showValid)
|
1499
|
+
{try
|
1500
|
+
{if(decId)
|
1501
|
+
{var div=$(decId);if(div)
|
1502
|
+
{if(showValid)
|
1503
|
+
{if(valid)
|
1504
|
+
{div.innerHTML='<img src="'+HAKANO.ImagePath+'confirm.png"/> <span class="success_color">'+msg+"</span>";}}
|
1505
|
+
else
|
1506
|
+
{if(!valid)
|
1507
|
+
{div.innerHTML='<img src="'+HAKANO.ImagePath+'exclamation.png"/> '+msg;}
|
1508
|
+
Element.setStyle(decId,{visibility:(valid?'hidden':'visible')});}}}
|
1509
|
+
else
|
1510
|
+
{var id='decorate_'+element.id;var div=$(id);if(!div)
|
1511
|
+
{new Insertion.After(element.id,'<span id="'+id+'" style="font-size:11px" class="error_color"></span>');div=$(id);}
|
1512
|
+
if(showValid)
|
1513
|
+
{div.innerHTML='<img src="'+HAKANO.ImagePath+'confirm.png"/> <span class="success_color">'+msg+"</span>";}
|
1514
|
+
else
|
1515
|
+
{if(!valid)
|
1516
|
+
{div.innerHTML='<img src="'+HAKANO.ImagePath+'exclamation.png"/> '+msg;}
|
1517
|
+
Element.setStyle(id,{visibility:(valid?'hidden':'visible')});}}}
|
1518
|
+
catch(e)
|
1519
|
+
{alert(e);}},termsAccepted:function(element,valid,decId)
|
1520
|
+
{this.checkInvalid(element,valid,decId,'must accept terms and conditions');},required:function(element,valid,decId)
|
1521
|
+
{this.checkInvalid(element,valid,decId,'required');},email:function(element,valid,decId)
|
1522
|
+
{this.checkInvalid(element,valid,decId,'enter a valid email address');},fullname:function(element,valid,decId)
|
1523
|
+
{this.checkInvalid(element,valid,decId,'enter first and last name');},noSpaces:function(element,valid,decId)
|
1524
|
+
{this.checkInvalid(element,valid,decId,'no spaces');},password:function(element,valid,decId)
|
1525
|
+
{this.checkInvalid(element,valid,decId,'password must be at least 6 characters');},url:function(element,valid,decId)
|
1526
|
+
{this.checkInvalid(element,valid,decId,'enter a valid URL');},length:function(element,valid,decId)
|
1527
|
+
{if(!valid)
|
1528
|
+
{var min=element.getAttribute('validatorMinLength')||'0';var max=element.getAttribute('validatorMaxLength')||'999999';this.checkInvalid(element,valid,decId,'value must be between '+min+'-'+max+' characters');}
|
1529
|
+
else
|
1530
|
+
{this.checkInvalid(element,valid,decId,element.value.length+' characters',true);}}};var Editablefield=Class.create();Object.extend(Editablefield.prototype,{initialize:function()
|
1531
|
+
{this.value="";},toString:function()
|
1532
|
+
{return'[Editablefield]';},isValid:function()
|
1533
|
+
{if(this.getViewState()=="view")
|
1534
|
+
{return true;}
|
1535
|
+
var valid=false;if(this.getType()=="select")
|
1536
|
+
{var e=$(this.getEditElementId());if(Validator[this.getValidator()].call(Validator,(e.options[e.selectedIndex].value||"")))
|
1537
|
+
{valid=true;}}
|
1538
|
+
else
|
1539
|
+
{if(Validator[this.getValidator()].call(Validator,($(this.getEditElementId()).value||"")))
|
1540
|
+
{valid=true;}}
|
1541
|
+
Decorator[this.getDecorator()].call(Decorator,$(this.getEditElementId()),valid);return valid;},setViewState:function(viewState,cancel)
|
1542
|
+
{if(this.viewState=="input"&&viewState=="view")
|
1543
|
+
{if(!cancel)
|
1544
|
+
{if(this.getType()=="select")
|
1545
|
+
{var e=$(this.getEditElementId());this.value=e.options[e.selectedIndex].text;}
|
1546
|
+
else
|
1547
|
+
{this.value=$(this.getEditElementId()).value;}}}
|
1548
|
+
else if(this.viewState=="view"&&viewState=="input")
|
1549
|
+
{this.value=$(this.getViewElementId()).innerHTML;this.setOriginalValue(this.value);}
|
1550
|
+
this.viewState=viewState;this.updateView(viewState);},updateView:function(viewState)
|
1551
|
+
{if(viewState=="input")
|
1552
|
+
{$(this.getEditParentElementId()).innerHTML=this.getInputHTML();$(this.getEditParentElementId()).style.display="block";$(this.getViewElementId()).style.display="none";if(this.getType()=="text"||this.getType()=="textarea")
|
1553
|
+
{$(this.getEditElementId()).select();$(this.getEditElementId()).focus();}}
|
1554
|
+
else
|
1555
|
+
{$(this.getViewElementId()).innerHTML=this.value;$(this.getEditParentElementId()).style.display="none";$(this.getViewElementId()).style.display="block";}},getViewState:function()
|
1556
|
+
{return(this.viewState)?this.viewState:"view";},setViewClass:function(viewclass)
|
1557
|
+
{this.viewclass=viewclass;},getViewClass:function()
|
1558
|
+
{return this.viewclass;},setOriginalValue:function(originalValue)
|
1559
|
+
{this.originalValue=originalValue;},getOriginalValue:function()
|
1560
|
+
{return this.originalValue;},getInputHTML:function()
|
1561
|
+
{if(this.getType()=="textarea")
|
1562
|
+
{return'<textarea class="'+this.getInputClass()+'" autocomplete="off" rows="'+this.getRows()+'" cols="'+this.getCols()+'" id="'+this.getEditElementId()+'">'+this.value+'</textarea>';}
|
1563
|
+
else if(this.getType()=="select")
|
1564
|
+
{return"<select class='"+this.getInputClass()+"' id='"+this.getEditElementId()+"'>"+
|
1565
|
+
Populator[this.getPopulator()].call(Populator)+"</select>";}
|
1566
|
+
else
|
1567
|
+
{var length=(this.getLength())?this.getLength():"20";return'<input class="'+this.getInputClass()+'" autocomplete="off" size="'+length+'" type="text" value="'+this.value+'" id="'+this.getEditElementId()+'"/>';}},setInputClass:function(cl)
|
1568
|
+
{this.inputClass=cl;},getInputClass:function()
|
1569
|
+
{return this.inputClass;},setRows:function(rows)
|
1570
|
+
{this.rows=rows;},getRows:function()
|
1571
|
+
{return(this.rows)?this.rows:20;},setCols:function(cols)
|
1572
|
+
{this.cols=cols;},getCols:function()
|
1573
|
+
{return(this.cols)?this.cols:3},setType:function(type)
|
1574
|
+
{this.type=type;},getType:function()
|
1575
|
+
{return this.type;},setValidator:function(validator)
|
1576
|
+
{this.validator=validator;},getValidator:function()
|
1577
|
+
{return this.validator;},setDecorator:function(decorator)
|
1578
|
+
{this.decorator=decorator;},getDecorator:function()
|
1579
|
+
{return this.decorator;},setName:function(name)
|
1580
|
+
{this.name=name;},getName:function()
|
1581
|
+
{return this.name;},setLength:function(length)
|
1582
|
+
{this.length=length;},getLength:function()
|
1583
|
+
{return this.length;},setViewElementId:function(id)
|
1584
|
+
{this.viewElementId=id;},getViewElementId:function()
|
1585
|
+
{return this.viewElementId;},setEditElementId:function(id)
|
1586
|
+
{this.editElementId=id;},getEditElementId:function()
|
1587
|
+
{return this.editElementId;},setEditParentElementId:function(id)
|
1588
|
+
{this.editParentElementId=id;},getEditParentElementId:function()
|
1589
|
+
{return this.editParentElementId;},setValue:function(value)
|
1590
|
+
{this.value=value;},getCurrentInputValue:function()
|
1591
|
+
{if(this.getViewState()=="input")
|
1592
|
+
{if(this.getType()=="select")
|
1593
|
+
{var e=$(this.getEditElementId());this.value=e.options[e.selectedIndex].value;}
|
1594
|
+
else
|
1595
|
+
{this.value=$(this.getEditElementId()).value;}}
|
1596
|
+
return(this.value)?this.value:"";},setPopulator:function(populator)
|
1597
|
+
{this.populator=populator;},getPopulator:function()
|
1598
|
+
{return this.populator;},setOnBindMessageProperty:function(onBindMessageProperty)
|
1599
|
+
{this.onBindMessageProperty=onBindMessageProperty;},getOnBindMesssageProperty:function()
|
1600
|
+
{return this.onBindMessageProperty;}});var Field=Class.create();Object.extend(Field.prototype,{initialize:function(id,name,element)
|
1601
|
+
{this.id=id;this.name=name;this.element=element;},getName:function()
|
1602
|
+
{return this.name;},getElementId:function()
|
1603
|
+
{return this.id;},getElement:function()
|
1604
|
+
{if(!this.element)
|
1605
|
+
{this.element=$(this.id);}
|
1606
|
+
return this.element;},getParentId:function()
|
1607
|
+
{return this.getElement().parentNode.id;},setViewState:function()
|
1608
|
+
{},toString:function()
|
1609
|
+
{if(!this._toString)
|
1610
|
+
{this._toString='[Field@'+this.id+']';}
|
1611
|
+
return this._toString;}});var Fieldset=Class.create();Object.extend(Fieldset.prototype,{DEBUG:false,initialize:function(editable)
|
1612
|
+
{this.currentInputField=null;this.candidateInputField=null;this.editable=editable||false;this.initialized=false;this.FIELDS=[];if(this.editable)
|
1613
|
+
{this.setupListeners();}},toString:function()
|
1614
|
+
{return'[Fieldset@'+this.name+']';},setName:function(name)
|
1615
|
+
{this.name=name;},getName:function()
|
1616
|
+
{return this.name;},setParentNode:function(node)
|
1617
|
+
{this.parentNode=node;},getParentNode:function()
|
1618
|
+
{return this.parentNode;},setOnBindMessageUpdateRequest:function(onBindMessageUpdateRequest)
|
1619
|
+
{this.onBindMessageUpdateRequest=onBindMessageUpdateRequest;},getOnBindMessageUpdateRequest:function()
|
1620
|
+
{return this.onBindMessageUpdateRequest;},setOnBindMessageUpdateResponse:function(onBindMessageUpdateResponse)
|
1621
|
+
{this.onBindMessageUpdateResponse=onBindMessageUpdateResponse;},getOnBindMessageUpdateResponse:function()
|
1622
|
+
{return this.onBindMessageUpdateResponse;},addField:function(field)
|
1623
|
+
{if(!this.FIELDS.exists(field))
|
1624
|
+
{if(this.DEBUG)$D(this+' adding field:'+field+' to fieldset:'+this.name+', existing: '+this.FIELDS);this.FIELDS.push(field);if(field.setViewState)
|
1625
|
+
{field.setViewState("view");}}},removeField:function(field)
|
1626
|
+
{this.FIELDS.remove(field);if(this.DEBUG)$D(this+' remove field:'+field+' from fieldset:'+this.name+', existing: '+this.FIELDS);return this.FIELDS.length;},getFields:function()
|
1627
|
+
{if(this.DEBUG)$D(this+', getFields returning: '+this.FIELDS);return this.FIELDS;},setupListeners:function()
|
1628
|
+
{var self=this;this.tryEditComplete=function(e,cancel)
|
1629
|
+
{var target=Event.element(e);if(target.id)
|
1630
|
+
{for(var i=0;i<self.FIELDS.length;i++)
|
1631
|
+
{var f=self.FIELDS[i];if(cancel&&f==self.currentInputField&&f.getViewState()=='input')
|
1632
|
+
{self.currentInputField=null;f.setViewState("view",true);return true;}
|
1633
|
+
if(f.getViewElementId()==target.id)
|
1634
|
+
{if(self.currentInputField==null)
|
1635
|
+
{self.currentInputField=f;f.setViewState("input");return true;}
|
1636
|
+
if(!(self.currentInputField.isValid()))
|
1637
|
+
{return true;}
|
1638
|
+
if(f.getName()!=self.currentInputField.getName())
|
1639
|
+
{self.candidateInputField=f;}
|
1640
|
+
self.saveValue();return true;}}}
|
1641
|
+
if(self.currentInputField!=null)
|
1642
|
+
{if(self.currentInputField.isValid())
|
1643
|
+
{self.saveValue();}}
|
1644
|
+
return true;};this.stopEditingFunction=function(e)
|
1645
|
+
{e=Event.getEvent(e);var target=Event.element(e);if(target.id)
|
1646
|
+
{if(self.currentInputField!=null)
|
1647
|
+
{if(target.id==self.currentInputField.getEditElementId())
|
1648
|
+
{return true;}}
|
1649
|
+
self.tryEditComplete(e);}
|
1650
|
+
return true;};this.editingKeyFunction=function(e)
|
1651
|
+
{e=Event.getEvent(e);if(Event.isEscapeKey(e))
|
1652
|
+
{Event.stop(e);self.tryEditComplete(e,true);return false;}
|
1653
|
+
return true;};this.enterKeyFunction=function(e)
|
1654
|
+
{e=Event.getEvent(e);if(Event.isEnterKey(e))
|
1655
|
+
{return self.tryEditComplete(e);}
|
1656
|
+
return true;};Event.observe(document,'click',this.stopEditingFunction.bindAsEventListener(this),false);Event.observe(document,'keyup',this.editingKeyFunction.bindAsEventListener(this),false);Event.observe(document,'keypress',this.enterKeyFunction.bindAsEventListener(this),false);},destroy:function()
|
1657
|
+
{Event.stopObserving(document,'click',this.stopEditingFunction.bindAsEventListener(this),false);Event.stopObserving(document,'keyup',this.editingKeyFunction.bindAsEventListener(this),false);Event.stopObserving(document,'keypress',this.enterKeyFunction.bindAsEventListener(this),false);hakano.util.MessageBroker.removeListener(this.bindAsEventListener(this));},toggleFields:function()
|
1658
|
+
{this.currentInputField.setViewState("view");if(this.candidateInputField!=null)
|
1659
|
+
{this.candidateInputField.setViewState("input");this.currentInputField=this.candidateInputField;}
|
1660
|
+
else
|
1661
|
+
{this.currentInputField=null;}
|
1662
|
+
this.candidateInputField=null;},saveValue:function()
|
1663
|
+
{if(!this.initialized)
|
1664
|
+
{hakano.util.MessageBroker.addListener(this);this.initialized=true;}
|
1665
|
+
if(this.currentInputField==null)
|
1666
|
+
{return;}
|
1667
|
+
if(this.currentInputField.getCurrentInputValue()==this.currentInputField.getOriginalValue())
|
1668
|
+
{this.toggleFields();return;}
|
1669
|
+
this.loadingMsgId="saving_"+this.currentInputField.getEditElementId();var loadingId=$(this.loadingMsgId);if(loadingId)
|
1670
|
+
{loadingId.parentNode.removeChild(loadingId);}
|
1671
|
+
new Insertion.After($(this.currentInputField.getEditElementId()),"<span id='"+this.loadingMsgId+"' style='color:#999999;font-size:12px;'> saving "+this.currentInputField.getName()+"...</span>");var data={};data[this.currentInputField.getOnBindMesssageProperty()]=this.currentInputField.getCurrentInputValue();var obj={type:this.getOnBindMessageUpdateRequest(),data:data};hakano.util.MessageBroker.queue(obj);},accept:function(type)
|
1672
|
+
{return[this.getOnBindMessageUpdateResponse()];},onMessage:function(type,msg)
|
1673
|
+
{if(type==this.getOnBindMessageUpdateResponse())
|
1674
|
+
{var id=$(this.loadingMsgId);if(msg['success'])
|
1675
|
+
{this.toggleFields();}
|
1676
|
+
else
|
1677
|
+
{id.innerHTML="";var errorId="decorate_"+this.currentInputField.getEditElementId();var div=$(errorId);if(div)
|
1678
|
+
{Element.setStyle(div,{visibility:'visible'});div.innerHTML=" *"+msg['message'];}
|
1679
|
+
else
|
1680
|
+
{new Insertion.After(this.currentInputField.getEditElementId(),"<span id='"+errorId+"' style='font-size:11px;color:#ff0000'> * "+msg['message']+"</span>");}}}}});var ModalDialog=Class.create();ModalDialog.install=function()
|
1681
|
+
{this.installed=true;var div=document.createElement('div');div.innerHTML='<div id="overlay" style="display:none"></div><div id="modaldialog_shadow" style="display:none"></div><div id="modaldialog" style="display:none"><div id="modaldialog_container"><div id="modaldialog_imagebar"><img src="'+HAKANO.ImagePath+'/dialog_close.gif" id="modaldialog_close_btn"/></div><div id="modaldialog_content"></div><div id="modaldialog_buttonbar"></div></div></div>';document.body.insertBefore(div,document.body.firstChild);this.onresizeFunc=this.onresize.bindAsEventListener(this);Event.observe(window,'resize',this.onresizeFunc,false);window.siteUnloadedObservers.push(ModalDialog.destroy.bind(this));};ModalDialog.destroy=function()
|
1682
|
+
{if(this.onresizeFunc)
|
1683
|
+
{Event.stopObserving(window,'resize',this.onresizeFunc,false);this.onresizeFunc=null;}};ModalDialog.onresize=function()
|
1684
|
+
{var arrayPageSize=Element.getDocumentSize();Element.setHeight('overlay',arrayPageSize[3]);var arrayPageScroll=Element.getPageScroll();if(this.options.top)
|
1685
|
+
{Element.setTop('modaldialog',this.options.top);}
|
1686
|
+
else
|
1687
|
+
{var lightboxTop=arrayPageScroll+(arrayPageSize[3]/5);Element.setTop('modaldialog',lightboxTop);}
|
1688
|
+
var w=$('modaldialog').offsetWidth;Element.setStyle('modaldialog',{left:arrayPageSize[0]/2-w/2+'px'});Position.clone('modaldialog','modaldialog_shadow')
|
1689
|
+
var shadow=$('modaldialog_shadow')
|
1690
|
+
shadow.style.width=parseInt(shadow.style.width||0)+6+'px';shadow.style.height=parseInt(shadow.style.height||0)+6+'px';if(!this.options.hideButtons)
|
1691
|
+
{$("modaldialog_buttonbar").style.top=$('modaldialog').offsetHeight-45+'px';}};ModalDialog.hide=function()
|
1692
|
+
{if(this.showing)
|
1693
|
+
{hakano.util.KeyManager.removeHandler(hakano.util.KeyManager.KEY_ENTER,null);hakano.util.KeyManager.removeHandler(hakano.util.KeyManager.KEY_ESCAPE,null);this.showing=false;Effect.Fade('overlay');['modaldialog','modaldialog_shadow'].each(Element.hide);if(this.prevHeight)
|
1694
|
+
{$('modaldialog').style.height=this.prevHeight+'px';this.prevHeight=null;}
|
1695
|
+
if(this.prevWidth)
|
1696
|
+
{$('modaldialog').style.width=this.prevWidth+'px';this.prevWidth=null;}
|
1697
|
+
if(this.prevTop)
|
1698
|
+
{$('modaldialog').style.top=this.prevTop+'px';this.prevTop=null;}}};ModalDialog.getAcceptButton=function()
|
1699
|
+
{return $("modaldialog_button1");};ModalDialog.getCancelButton=function()
|
1700
|
+
{return $("modaldialog_button2");};ModalDialog.show=function(html,options)
|
1701
|
+
{options=Object.extend({acceptText:'Accept',cancelText:'Cancel',onAccept:Prototype.emptyFunction,onCancel:Prototype.emptyFunction,onRender:Prototype.emptyFunction,autohide:true,autodisable:false,hideButtons:false},options||{});if(!this.installed)
|
1702
|
+
{this.install();}
|
1703
|
+
this.showing=true;this.options=options;var modaldialog=$("modaldialog");if(options.width)
|
1704
|
+
{this.prevWidth=parseInt(modaldialog.style.width);modaldialog.style.width=options.width+'px';}
|
1705
|
+
if(options.height)
|
1706
|
+
{this.prevHeight=parseInt(modaldialog.style.height);modaldialog.style.height=options.height+'px';}
|
1707
|
+
var arrayPageSize=Element.getDocumentSize();if(options.top)
|
1708
|
+
{this.prevTop=parseInt(modaldialog.style.top);Element.setTop('modaldialog',options.top);}
|
1709
|
+
else
|
1710
|
+
{var arrayPageScroll=Element.getPageScroll();var dialogboxTop=arrayPageScroll+(arrayPageSize[3]/5);Element.setTop('modaldialog',dialogboxTop);}
|
1711
|
+
Element.setHeight('overlay',arrayPageSize[3]);if(!Element.visible('overlay'))
|
1712
|
+
{Effect.Appear('overlay',{duration:0.2,from:0.0,to:0.8});}
|
1713
|
+
if(!options.hideButtons)
|
1714
|
+
{$("modaldialog_buttonbar").innerHTML='<form autocomplete="false"><table align="center" width="100%"><tr><td align="right"><input type="button" class="modaldialog_button" id="modaldialog_button1" value="'+options.acceptText+'"/></td><td style="width:8px;"></td><td align="left"><input type="button" class="modaldialog_button" id="modaldialog_button2" value="'+options.cancelText+'"/></td></tr></table></form>';}
|
1715
|
+
Element[options.hideButtons?'hide':'show']('modaldialog_buttonbar');$("modaldialog_content").innerHTML=html;modaldialog.style.backgroundColor=options.backgroundColor||'#fff';Element.show('modaldialog');var w=modaldialog.offsetWidth;Element.setStyle('modaldialog',{left:arrayPageSize[0]/2-w/2+'px'});if(!options.hideButtons)
|
1716
|
+
{$("modaldialog_buttonbar").style.top=modaldialog.offsetHeight-45+'px';}
|
1717
|
+
Position.clone('modaldialog','modaldialog_shadow')
|
1718
|
+
var shadow=$('modaldialog_shadow')
|
1719
|
+
shadow.style.width=parseInt(shadow.style.width)+6+'px';shadow.style.height=parseInt(shadow.style.height)+6+'px';var button=$("modaldialog_close_btn");button.onmouseover=function(e)
|
1720
|
+
{this.src=HAKANO.ImagePath+'dialog_close_hover.gif';Event.stop(Event.getEvent(e));return false;};button.onmouseout=function(e)
|
1721
|
+
{this.src=HAKANO.ImagePath+'dialog_close.gif';Event.stop(Event.getEvent(e));return false;};button.onclick=function(e)
|
1722
|
+
{ModalDialog.hide();options.onCancel();Event.stop(Event.getEvent(e));return false;};this.enterHandler=function(e)
|
1723
|
+
{if(!$('modaldialog_button1').disabled)
|
1724
|
+
{if(options.autodisable)
|
1725
|
+
{ModalDialog.getAcceptButton().disabled=true;}
|
1726
|
+
if(options.autohide)
|
1727
|
+
{ModalDialog.hide();}
|
1728
|
+
options.onAccept();}
|
1729
|
+
Event.stop(Event.getEvent(e));return false;};this.cancelHandler=function(e)
|
1730
|
+
{ModalDialog.hide();options.onCancel();Event.stop(Event.getEvent(e));return false;};if(!options.hideButtons)
|
1731
|
+
{$("modaldialog_button1").onclick=this.enterHandler;$("modaldialog_button2").onclick=this.cancelHandler;}
|
1732
|
+
hakano.util.KeyManager.installHandler(hakano.util.KeyManager.KEY_ENTER,null,this.enterHandler);hakano.util.KeyManager.installHandler(hakano.util.KeyManager.KEY_ESCAPE,null,this.cancelHandler);Element.show('modaldialog_shadow');options.onRender($('modaldialog_content'));};var Populator=Class.create();Populator={toString:function()
|
1733
|
+
{return'[Populator]';},getGenders:function()
|
1734
|
+
{var str="<option value='' selected>select gender</option>";str+=this.makeOption('male');str+=this.makeOption('female');return str;},MONTHS:['January','February','March','April','May','June','July','August','September','October','November','December'],getMonths:function()
|
1735
|
+
{var str="<option value='' selected>select birth month</option>";var self=this;this.MONTHS.each(function(m)
|
1736
|
+
{str+=self.makeOption(m);});return str;},getDays:function()
|
1737
|
+
{var str="<option value='' selected>select day</option>";for(var c=1;c<32;c++)
|
1738
|
+
{str+=makeOption(c);}
|
1739
|
+
return str;},makeOption:function(value,display)
|
1740
|
+
{return"<option value='"+value+"'>"+(display||value)+"</option>";},getYears:function()
|
1741
|
+
{var str="<option value='' selected>select year</option>";var d=new Date();var y=d.getYear();var end=y-100;for(var i=y;y>end;y--)
|
1742
|
+
{str+=this.makeOption(i,i);}
|
1743
|
+
return str;}};var Renderer=Class.create();Renderer={toString:function()
|
1744
|
+
{return'[Renderer]';},register:function(name,renderer)
|
1745
|
+
{this[name]=renderer;},unregister:function(name)
|
1746
|
+
{if(this[name])
|
1747
|
+
{delete[name];}}};var DefaultRenderer=Class.create();Object.extend(DefaultRenderer.prototype,{initialize:function()
|
1748
|
+
{},render:function(td,table,model,row,column,selected)
|
1749
|
+
{td.innerHTML=model.getCellAt(table,row,column);}});Renderer.register('default',new DefaultRenderer());var FriendlyDateRenderer=Class.create();Object.extend(FriendlyDateRenderer.prototype,{initialize:function()
|
1750
|
+
{},render:function(td,table,model,row,column,selected)
|
1751
|
+
{var rowobj=model.getRow(row);var name=table.getColumnAt(column);var value=Object.getNestedProperty(rowobj,name);var date=hakano.util.DateTime.parseJavaDate(value);td.innerHTML=hakano.util.DateTime.getFriendlyDate(date);}});Renderer.register('friendlyDate',new FriendlyDateRenderer());var DurationRenderer=Class.create();Object.extend(DurationRenderer.prototype,{initialize:function()
|
1752
|
+
{},render:function(td,table,model,row,column,selected)
|
1753
|
+
{var begin=table.getColumnAttribute(column,'beginProperty');var end=table.getColumnAttribute(column,'endProperty');var rowobj=model.getRow(row);var beginDate=hakano.util.DateTime.parseJavaDate(Object.getNestedProperty(rowobj,begin));var endDate=hakano.util.DateTime.parseJavaDate(Object.getNestedProperty(rowobj,end));td.innerHTML=hakano.util.DateTime.getDuration(beginDate,endDate);}});Renderer.register('duration',new DurationRenderer());var FriendlyDateDiffRenderer=Class.create();Object.extend(FriendlyDateDiffRenderer.prototype,{initialize:function()
|
1754
|
+
{},render:function(td,table,model,row,column,selected)
|
1755
|
+
{var rowobj=model.getRow(row);var name=table.getColumnAt(column);var value=Object.getNestedProperty(rowobj,name);var date=hakano.util.DateTime.parseJavaDate(value);td.innerHTML=(date!=null)?hakano.util.DateTime.friendlyDiff(date):' ';}});Renderer.register('friendlyDateDiff',new FriendlyDateDiffRenderer());var ShortDateTimeRenderer=Class.create();Object.extend(ShortDateTimeRenderer.prototype,{initialize:function()
|
1756
|
+
{},render:function(td,table,model,row,column,selected)
|
1757
|
+
{var rowobj=model.getRow(row);var name=table.getColumnAt(column);var value=Object.getNestedProperty(rowobj,name);var date=hakano.util.DateTime.parseJavaDate(value);td.innerHTML=hakano.util.DateTime.getShortDateTime(date);}});Renderer.register('shortDateTime',new ShortDateTimeRenderer());var DateTimeRenderer=Class.create();Object.extend(DateTimeRenderer.prototype,{initialize:function()
|
1758
|
+
{},render:function(td,table,model,row,column,selected)
|
1759
|
+
{var rowobj=model.getRow(row);var name=table.getColumnAt(column);var value=Object.getNestedProperty(rowobj,name);var date=hakano.util.DateTime.parseJavaDate(value);td.innerHTML=(date!=null)?hakano.util.DateTime.get12HourTime(date):' '}});Renderer.register('dateTime',new DateTimeRenderer());var ImageRenderer=Class.create();Object.extend(ImageRenderer.prototype,{initialize:function()
|
1760
|
+
{},render:function(td,table,model,row,column,selected)
|
1761
|
+
{var value=model.getCellAt(table,row,column);var width=table.getColumnAttribute(column,'imageWidth');var height=table.getColumnAttribute(column,'imageHeight');if(width&&height)
|
1762
|
+
{td.innerHTML='<img src="'+value+'" width="'+width+'" height="'+height+'"/>';}
|
1763
|
+
else
|
1764
|
+
{td.innerHTML='<img src="'+value+'"/>';}}});Renderer.register('image',new ImageRenderer());var TemplateRenderer=Class.create();Object.extend(TemplateRenderer.prototype,{initialize:function()
|
1765
|
+
{},render:function(td,table,model,row,column,selected)
|
1766
|
+
{var id=table.getColumnAttribute(column,'templateId');var template=hakano.util.Dom.getText($(id));var rowobj=model.getRow(row);var html=template.gsub(Template.Pattern,function(match)
|
1767
|
+
{var before=match[1];if(before=='\\')return match[2];return before+(Object.getNestedProperty(rowobj,match[3])||'').toString();});td.innerHTML=html;Seamless.wire(td);}});Renderer.register('template',new TemplateRenderer());var LinkRenderer=Class.create();Object.extend(LinkRenderer.prototype,{initialize:function()
|
1768
|
+
{},REGEX:/"/g,render:function(td,table,model,row,column,selected)
|
1769
|
+
{var value=model.getCellAt(table,row,column);var rowobj=model.getRow(row);var image=table.getColumnAttribute(column,'linkImage');var anchor=document.createElement('a');anchor.innerHTML=(image)?table.getColumnAttribute(column,'linkText')+" <img src='"+image+"'/>"||value:table.getColumnAttribute(column,'linkText')||value;var hrefProperty=table.getColumnAttribute(column,'linkProperty');if(hrefProperty)
|
1770
|
+
{var href=Object.getNestedProperty(rowobj,hrefProperty)||'#';anchor.setAttribute('href',href);}
|
1771
|
+
var linkClass=table.getColumnAttribute(column,'linkClass');if(linkClass)
|
1772
|
+
{anchor.className=linkClass;}
|
1773
|
+
var msg=table.getColumnAttribute(column,'linkClickMessage');if(msg)
|
1774
|
+
{anchor.onclick=function(e)
|
1775
|
+
{var argStr=anchor.getAttribute('onClickMessageArgs');if(argStr)
|
1776
|
+
{var scope={model:model,row:row,column:column,value:value,rowdata:rowobj};var args=Object.evalWithinScope(argStr,scope);hakano.util.MessageBroker.queue({type:msg,data:args});Event.stop(e);return false;}
|
1777
|
+
return true;};}
|
1778
|
+
var args=table.getColumnAttribute(column,'linkClickMessageArgs');if(args)
|
1779
|
+
{anchor.setAttribute('onClickMessageArgs',args);}
|
1780
|
+
var argsProp=table.getColumnAttribute(column,'linkClickMessageArgsProperty');if(argsProp)
|
1781
|
+
{args={};argsProp.split(',').each(function(p)
|
1782
|
+
{args[p]=Object.getNestedProperty(rowobj,p);});anchor.setAttribute('onClickMessageArgs',args.toJSONString().replace(this.REGEX,"'"));}
|
1783
|
+
td.appendChild(anchor);}});Renderer.register('link',new LinkRenderer());var LengthLimitRenderer=Class.create();Object.extend(LengthLimitRenderer.prototype,{initialize:function()
|
1784
|
+
{},render:function(td,table,model,row,column,selected)
|
1785
|
+
{var value=model.getCellAt(table,row,column);var length=parseInt(table.getColumnAttribute(column,'length')||'80');td.innerHTML=value.limit(length);}});Renderer.register('lengthLimitRenderer',new LengthLimitRenderer());var Seamless=Class.create();var headlist=document.getElementsByTagName('head');var head=(headlist&&headlist.length>0)?headlist[0]:null;Object.extend(Seamless,hakano.util.EventBroadcaster.prototype);Object.extend(Seamless,{DEBUG:false,uniqueIdIndex:0,FIELDSETS:{},trashcan:[],prefetchURLS:[],toString:function()
|
1786
|
+
{return'[Seamless]';},queuePrefetch:function(url)
|
1787
|
+
{},prefetch:function()
|
1788
|
+
{if(this.prefetchURLS.length>0)
|
1789
|
+
{var url=this.prefetchURLS.shift();var self=this;Logger.info('prefetched '+url);new Ajax.Request(url,{asynchronous:false,method:'get',onComplete:function()
|
1790
|
+
{self.prefetch();}});}},getFieldSet:function(fieldsetName)
|
1791
|
+
{if(fieldsetName==null)alert('fieldset name cannot be null!');return this.FIELDSETS[fieldsetName];},loadFieldSet:function(element,fieldsetName,editable)
|
1792
|
+
{var fs=this.getFieldSet(fieldsetName);if(fs==null||fs==undefined)
|
1793
|
+
{fs=new Fieldset(editable);fs.setName(fieldsetName);fs.setOnBindMessageUpdateRequest(element.getAttribute("onBindMessageUpdateRequest"));fs.setOnBindMessageUpdateResponse(element.getAttribute("onBindMessageUpdateResponse"));this.FIELDSETS[fieldsetName]=fs;}
|
1794
|
+
return fs;},createUniqueId:function(element)
|
1795
|
+
{var type=element.tagName;return'seamless_'+type+'_'+this.uniqueIdIndex++;},zap:function(element)
|
1796
|
+
{var p=element.parentNode;p.removeChild(element);},FunctionTrue:function()
|
1797
|
+
{return true;},FunctionFalse:function()
|
1798
|
+
{return false;},createMessageCondition:function(cond)
|
1799
|
+
{if(typeof(cond)=='boolean'&&cond||cond=='true')
|
1800
|
+
{return this.FunctionTrue;}
|
1801
|
+
try
|
1802
|
+
{return cond.toFunction();}
|
1803
|
+
catch(e)
|
1804
|
+
{return this.FunctionFalse;}},createMessageExpression:function(expr)
|
1805
|
+
{if(typeof(expr)=='boolean'&&expr||expr=='true')
|
1806
|
+
{return this.FunctionTrue;}
|
1807
|
+
try
|
1808
|
+
{return expr.toFunction();}
|
1809
|
+
catch(e)
|
1810
|
+
{return this.FunctionFalse;}},createMessageObject:function(type,data,datatype,direction,controller,value)
|
1811
|
+
{var obj=Object.copy({},controller);return Object.extend(obj,{type:type,data:data,datatype:datatype,direction:direction,value:value});},WIDGET_BUILDERS:{},registerWidgetBuilder:function(name,builder)
|
1812
|
+
{if(typeof(builder['build'])!='function')
|
1813
|
+
{Logger.error('builder for '+name+' must have a "build" method');throw"builder must have a build method";}
|
1814
|
+
this.WIDGET_BUILDERS[name]=builder;},unregisterWidgetBuilder:function(name)
|
1815
|
+
{if(this.WIDGET_BUILDERS[name])
|
1816
|
+
{delete this.WIDGET_BUILDERS[name];}},getWidgetBuilder:function(name)
|
1817
|
+
{return this.WIDGET_BUILDERS[name];},injectWidget:function(element,controller)
|
1818
|
+
{var name=this.getTagNameWithNS(element).toLowerCase();var array=name.split(':');var widget=array.length==2?array[1]:null;if(!widget||widget=='jimmy')
|
1819
|
+
{widget=element.getAttribute('widget');}
|
1820
|
+
if(widget)
|
1821
|
+
{var builder=this.WIDGET_BUILDERS[widget];if(builder)
|
1822
|
+
{if(!element.id)
|
1823
|
+
{element.id=this.createUniqueId(element);}
|
1824
|
+
try
|
1825
|
+
{return builder.build(element,controller);}
|
1826
|
+
catch(e)
|
1827
|
+
{if(Logger.error)
|
1828
|
+
{Logger.error(this+' - error building widget:'+widget+', Exception: '+Object.getExceptionDetail(e));}}}}
|
1829
|
+
return false;},TEMPLATE_PATTERN:/(^|.|\r|\n)(@\{(.*?)\})/,evaluateTemplateURI:function(src,path)
|
1830
|
+
{var template=new Template(src,this.TEMPLATE_PATTERN);var newsrc=template.evaluate(HAKANO.TEMPLATE_VARS);return hakano.util.URI.parse(newsrc,path||HAKANO.DocumentPath);},inject:function(element,path,controller)
|
1831
|
+
{if(this.injectWidget(element,controller))
|
1832
|
+
{$D(this.toString(),'found seamless widget, id: ['+element.id+'], tag: ('+element.nodeName+')');return false;}
|
1833
|
+
return false;},load:function(element,controller,uri)
|
1834
|
+
{var self=this;try
|
1835
|
+
{this.loadURL(element,controller,uri,{onFailure:function(resp)
|
1836
|
+
{Logger.error(Seamless.toString()+' Seamless load failure for:'+uri+', Error: '+resp.status);},onException:function(e,r)
|
1837
|
+
{Logger.error(Seamless.toString()+' Seamless load failure for:'+uri+', Error: '+r);},onSuccess:function(resp)
|
1838
|
+
{$D(Seamless.toString()+' Seamless loaded: '+element.id+'('+element.nodeName+'), URI: '+uri+', status:'+(resp?resp.status:304));var handler=self.createOnLoadHandler(element.id,element,controller,uri);handler(false);},replace:true});}
|
1839
|
+
catch(e)
|
1840
|
+
{Logger.error(Seamless.toString()+' error calling Seamless.loadURL: '+e);}},implode:function(iframe)
|
1841
|
+
{var parent=iframe.parentNode
|
1842
|
+
iframe.style.border='none'
|
1843
|
+
iframe.style.margin='0'
|
1844
|
+
iframe.style.padding='0'
|
1845
|
+
iframe.style.width=parent.offsetWidth+'px'
|
1846
|
+
iframe.style.height=parent.offsetHeight+'px'},loadURL:function(element,parentController,uri,options)
|
1847
|
+
{$D(Seamless.toString()+' loading seamless: '+uri+' at element: '+element.id+', ('+element.nodeName+')');if(!String.unescapeXML)String.unescapeXML=HAKANO.unescapeXML;if(!String.escapeXML)String.escapeXML=HAKANO.escapeXML;if(!element.id)
|
1848
|
+
{element.id=this.createUniqueId(element);}
|
1849
|
+
var uriid=hakano.util.MD5.hex_md5(uri);var replace=options?options['replace']:true;var id=element.id;var parentContainerId='_jc_'+this.createUniqueId(element);var srcId='_seamless_'+uriid;var parentContainer=null;var currentController=element['seamlessController'];if(currentController!=parentController)
|
1850
|
+
{element['seamlessController']=parentController;}
|
1851
|
+
if(replace)
|
1852
|
+
{var html='<div id="'+parentContainerId+'"></div>';new Insertion.Before(element,html);element.parentNode.removeChild(element);parentContainer=$(parentContainerId);parentContainer.id=id;parentContainer.innerHTML='';parentContainerId=id;}
|
1853
|
+
else
|
1854
|
+
{element.innerHTML='<div id="'+parentContainerId+'"></div>';parentContainer=$(parentContainerId);}
|
1855
|
+
var self=this;new Ajax.Request(uri,{asynchronous:true,method:'get',onSuccess:function(resp)
|
1856
|
+
{var docElement=resp.responseXML.documentElement;var view=docElement.getElementsByTagName('view')[0];var styles=docElement.getElementsByTagName('style');var styleHTML=null;if(styles&&styles.length>0)
|
1857
|
+
{styleHTML='';for(var s=0;s<styles.length;s++)
|
1858
|
+
{var style=styles[s];styleHTML+=hakano.util.Dom.getText(style)+'\n';}}
|
1859
|
+
var controllers=docElement.getElementsByTagName('controller');var controller=null;if(controllers.length==1)
|
1860
|
+
{controller=controllers[0];}
|
1861
|
+
var data=controller?hakano.util.Dom.getText(controller):null;if(data&&data.trim().length==0)
|
1862
|
+
{data=null;}
|
1863
|
+
var script=data?data:"__dummyfoo: function(){}";var instance=null;id=self.createUniqueId(docElement);var obj=null;try
|
1864
|
+
{obj="var class_"+id+" = Class.create();\n\nObject.extend(class_"+id+".prototype, { toString: function() { return '[Seamless:"+uri+"]'; },\n initialize: function(){},\n "+String.unescapeXML(script)+"\n});\n new class_"+id+"()";instance=eval(obj);instance['addMessageListener']=function(listener)
|
1865
|
+
{this['_seamlessML'].push(listener);hakano.util.MessageBroker.addListener(listener);};instance['removeMessageListener']=function(listener)
|
1866
|
+
{this['_seamlessML'].remove(listener);hakano.util.MessageBroker.removeListener(listener);};instance['_seamlessML']=[];instance['_children']=[];instance['_addChild']=function(child)
|
1867
|
+
{this._children.push(child);};instance['parent']=parentController;if(parentController)
|
1868
|
+
{if(!parentController['_addChild'])
|
1869
|
+
{var children=parentController['_children'];if(!children)
|
1870
|
+
{children=[];parentController['_children']=children;}
|
1871
|
+
children.push(instance);}
|
1872
|
+
else
|
1873
|
+
{parentController['_addChild'](instance);}
|
1874
|
+
if(!parentController['_destroy'])
|
1875
|
+
{parentController['_destroy']=function()
|
1876
|
+
{Seamless.removeAllListeners(this);};}}
|
1877
|
+
instance['_destroy']=function()
|
1878
|
+
{if(this._children&&this._children.length>0)
|
1879
|
+
{for(var c=0,len=this._children.length;c<len;c++)
|
1880
|
+
{this._children[c]._destroy();}
|
1881
|
+
this._children=null;}
|
1882
|
+
Seamless.removeAllListeners(this);if(head&&styles&&styles.length>0)
|
1883
|
+
{var style=$('style_'+srcId);if(style)
|
1884
|
+
{style.parentNode.removeChild(style);}}};}
|
1885
|
+
catch(e)
|
1886
|
+
{alert(e);document.body.innerHTML='<div style="z-index:1500;border:2px dashed red;padding:6px;background-color:#ddd;color:#000;"><div>Ouch. Seamless is not happy! Something really bad happened evaluating the Seamless code at: <b>'+uri+'</b>.</div><div><pre style="background-color:#ffffcc;border:1px solid black;border-left:4px solid black;border-right:4px solid black;padding:5px;">'+obj+'</pre></div><div><font color=red>'+e+'</font></div></div>';return false;}
|
1887
|
+
var id=self.createUniqueId(view);var html='<div>';if(styleHTML)
|
1888
|
+
{if(HAKANO.isIE)
|
1889
|
+
{var style=(typeof document.createElementNS!="undefined")?document.createElementNS("http://www.w3.org/1999/xhtml","style"):document.createElement("style");style.setAttribute("type","text/css");style.setAttribute("media","screen");style.setAttribute("id","style_"+srcId);head.appendChild(style);var lastStyle=document.styleSheets[document.styleSheets.length-1];var re=new RegExp("(.*)\{(.*)\}");styleHTML=styleHTML.replace(/[\n\r]/g,' ');var c=0;var idx=styleHTML.indexOf('}');while(idx!=-1)
|
1890
|
+
{var rule=styleHTML.substring(c,idx)+'}';var result=re.exec(rule.trim());var selector=result[1].trim();var rules=result[2];rules.split(';').each(function(rule)
|
1891
|
+
{lastStyle.addRule(selector,rule);});c=idx+1;idx=styleHTML.indexOf('}',c);}}
|
1892
|
+
else
|
1893
|
+
{html+='<style type="text/css" id="style_'+srcId+'">';html+=styleHTML;html+="</style>\n";}}
|
1894
|
+
html+=hakano.util.Dom.toXML(view,true,'div',id,true);html+='</div>';parentContainer.innerHTML=html;instance['uri']=uri;instance['args']=hakano.util.URI.toQueryParams(uri);element['seamlessController']=instance;try
|
1895
|
+
{self.transform(parentContainer.firstChild,parentContainer.firstChild,instance,id,uri,true,true);}
|
1896
|
+
catch(e)
|
1897
|
+
{alert(e.name+','+e.message+','+e.location);}
|
1898
|
+
if(options&&options['onSuccess'])
|
1899
|
+
{options['onSuccess'](uri,parentContainer.firstChild);}
|
1900
|
+
Logger.info(self+' Load finished: '+uri);},onException:function(request,exception)
|
1901
|
+
{var description='';for(var property in exception){description+=property+'='+exception[property]+'\n';}
|
1902
|
+
if(description.indexOf("Access is denied")!=-1&&HAKANO.isIE)
|
1903
|
+
alert("IE's security settings prevent access to local files via Ajax Requests. Please test using a web server.");}});},fireSeamlessEvent:function(controller,name,arguments)
|
1904
|
+
{if(controller[name])
|
1905
|
+
{controller[name].apply(controller,arguments);}},addTrash:function(element,controller,func)
|
1906
|
+
{if(element.id)
|
1907
|
+
{var trash=controller['_seamlessTrash'];if(!trash)
|
1908
|
+
{trash=[];controller['_seamlessTrash']=trash;}
|
1909
|
+
trash.push(func);}
|
1910
|
+
else
|
1911
|
+
{Logger.error(this+" couldn't add trash for element: "+element+", it has no ID ... function:"+func);}},destroyChildren:function(element)
|
1912
|
+
{},destroy:function(controller)
|
1913
|
+
{var trash=controller['_seamlessTrash'];if(trash)
|
1914
|
+
{var count=0;for(var c=0,len=trash.length;c<len;c++)
|
1915
|
+
{var item=trash[c];if(item)
|
1916
|
+
{count++;item(false);}}
|
1917
|
+
delete controller['_seamlessTrash'];$D(this+' trashcan emptied '+count+' items');return count;}
|
1918
|
+
return 0;},destroyAll:function()
|
1919
|
+
{},transform:function(target,view,controller,uniqueId,uri,replace,ignoreAdd)
|
1920
|
+
{this.fireSeamlessEvent(controller,'onLoad',[view,target]);if(!ignoreAdd)
|
1921
|
+
{if(replace)
|
1922
|
+
{var parent=target.parentNode;var html='<div id="seamless_container_'+uniqueId+'" style="margin:0;padding:0">'+view.innerHTML+'</div>';new Insertion.Before(target,html);parent.removeChild(target);}
|
1923
|
+
else
|
1924
|
+
{target.innerHTML='<div id="seamless_container_'+uniqueId+'" style="margin:0;padding:0">'+view.innerHTML+'</div>';}
|
1925
|
+
view=$("seamless_container_"+uniqueId);}
|
1926
|
+
var id=view.id||uniqueId;target['_seamlessOnLoader']=this.createOnLoadHandler(id,view,controller,uri);this.fireSeamlessEvent(controller,'onPreWire',[view]);this.wire(view,controller,false,true,ignoreAdd);this.fireSeamlessEvent(controller,'onPostWire',[view]);this.fireSeamlessEvent(controller,'onRendered',[view]);this.addTrash(view,controller,function()
|
1927
|
+
{var destroyAction=controller['onDestroy'];if(destroyAction)
|
1928
|
+
{destroyAction.call(controller);}});target['_seamlessOnLoader'](false);},createOnLoadHandler:function(id,view,controller,uri)
|
1929
|
+
{var onLoadMessage=view.getAttribute('onLoadMessage');var onLoadMessageArgs=view.getAttribute('onLoadMessageArgs');var onLoadMessageCond=view.getAttribute('onLoadMessageCond')||true;var self=this;return function(cached)
|
1930
|
+
{try
|
1931
|
+
{if(onLoadMessage)
|
1932
|
+
{var args=onLoadMessageArgs?Object.evalWithinScope(onLoadMessageArgs,controller):{};if(!args['id'])
|
1933
|
+
{args['id']=id;}
|
1934
|
+
if(!args['uri'])
|
1935
|
+
{args['uri']=uri;}
|
1936
|
+
if(!args['args'])
|
1937
|
+
{args['args']=hakano.util.URI.toQueryParams(uri);}
|
1938
|
+
args['cached']=cached;if(onLoadMessageCond||self.evaluateBindMessageConditionAttr(onLoadMessageCond,onLoadMessage,args,'JSON','local',controller))
|
1939
|
+
{hakano.util.MessageBroker.queue({type:onLoadMessage,data:args,immediate:true});}}}
|
1940
|
+
catch(e)
|
1941
|
+
{alert(e);}};},addSeamlessListener:function(element,controller,event)
|
1942
|
+
{if(!element.id)
|
1943
|
+
{element.id=this.createUniqueId(element);}
|
1944
|
+
var eventName='on'+event.toLowerCase();var handler=element.getAttribute(eventName);if(handler)
|
1945
|
+
{element[eventName]=null;var name='seamless_'+eventName+'_dispatcher_'+element.id;if(!controller[name])
|
1946
|
+
{controller[name]=function(e)
|
1947
|
+
{e=Event.getEvent(e);var f=controller[handler];var ok=true;if(f)
|
1948
|
+
{ok=f.call(controller,e);}
|
1949
|
+
else
|
1950
|
+
{ok=eval(f);}
|
1951
|
+
if(!ok)
|
1952
|
+
{Event.stop(e);}
|
1953
|
+
return ok;};Event.observe(element,event,controller[name],false);this.addTrash(element,controller,function()
|
1954
|
+
{Event.stopObserving(element,event,controller[name],false);if(controller[name])
|
1955
|
+
{delete controller[name];}});}}
|
1956
|
+
else
|
1957
|
+
{this.createEventHandler(element,event,controller);}},serializeFieldValue:function(value)
|
1958
|
+
{if(value)
|
1959
|
+
{if(typeof(value)=='string')
|
1960
|
+
{if(value.charAt(0)=='['&&value.charAt(value.length-1)==']')
|
1961
|
+
{return value.substring(1,value.length-1).split(',');}
|
1962
|
+
else if(value.charAt(0)=='{'&&value.charAt(value.length-1)=='}')
|
1963
|
+
{return eval('('+value+')');}}
|
1964
|
+
return String.escapeXML(value);}
|
1965
|
+
return null;},getFieldValue:function(element,direction)
|
1966
|
+
{var value=null;switch(element.nodeName)
|
1967
|
+
{case'TEXTAREA':{value=element.value;break;}
|
1968
|
+
case'SELECT':{var multiple=element.getAttribute('multiple');if(multiple==null||!multiple)
|
1969
|
+
{if(element.selectedIndex!=-1)
|
1970
|
+
{value=element.options[element.selectedIndex].value||element.options[element.selectedIndex].text;}}
|
1971
|
+
else
|
1972
|
+
{var len=element.options.length;var selected=[];for(var c=0;c<len;c++)
|
1973
|
+
{if(element.options[c].selected)
|
1974
|
+
{var text=element.options[c].value||element.options[c].text.trim();if(text.length!=0)
|
1975
|
+
{selected.push(text);}}}
|
1976
|
+
if(selected.length>0)
|
1977
|
+
{var arrayType=element.getAttribute('fieldValueArray')||'true';if(arrayType=='true')
|
1978
|
+
{value='['+selected.join(',')+']';}
|
1979
|
+
else
|
1980
|
+
{value=selected.join(',');}}}
|
1981
|
+
if(value)
|
1982
|
+
{if(value.trim().length==0)
|
1983
|
+
{value=null;}
|
1984
|
+
else if(direction=='remote')
|
1985
|
+
{return this.serializeFieldValue(value);}}
|
1986
|
+
break;}
|
1987
|
+
default:{var type=element.getAttribute('type');if(!type)
|
1988
|
+
{return element.value||'';}
|
1989
|
+
value=Form.Element.Serializers.input(element);value=(value!=null)?value[1]:'';switch(type)
|
1990
|
+
{case'checkbox':case'radio':{return(value=='on'||value=='checked');}
|
1991
|
+
case'hidden':{return element.value;}}
|
1992
|
+
if(direction=='remote'&&element['_seedDataTransformer'])
|
1993
|
+
{value=element['_seedDataTransformer'](value);}
|
1994
|
+
if(direction=='remote')
|
1995
|
+
{return this.serializeFieldValue(value);}
|
1996
|
+
break;}}
|
1997
|
+
if(direction=='remote')
|
1998
|
+
{return String.escapeXML(value);}
|
1999
|
+
return value;},addFieldSet:function(element,controller)
|
2000
|
+
{var fieldsetName=element.getAttribute("fieldset");if(fieldsetName!=null)
|
2001
|
+
{var fs=this.loadFieldSet(element,fieldsetName,false);var id=element.id;if(!id)
|
2002
|
+
{id=element.id=this.createUniqueId(element);}
|
2003
|
+
var field=new Field(id,id,element);fs.addField(field);if(this.DEBUG)$D(this+' adding field:'+field+' to fieldset:'+fieldsetName+', fsobj='+fs);var self=this;this.addTrash(element,controller,function()
|
2004
|
+
{if(fs.removeField(field)==0)
|
2005
|
+
{fs.destroy();delete self.FIELDSETS[fieldsetName];}});}},BIND_GETTERS:[[/INPUT|TEXTAREA/i,function(element)
|
2006
|
+
{var prop=element.getAttribute('onBindChangeMessageProperty')||element.name||element.id;var msg={data:{}};var value=Form.Element.Serializers.input(element)[1];Object.setNestedProperty(msg.data,prop,value);return msg;}],[/SELECT/i,function(element)
|
2007
|
+
{var prop=element.getAttribute('onBindChangeMessageProperty')||element.name||element.id;var msg={data:{}};var value=[];for(var i=0;i<element.length;i++)
|
2008
|
+
{var opt=element.options[i];if(opt.selected)
|
2009
|
+
{value.push(opt.value||opt.text);}}
|
2010
|
+
Object.setNestedProperty(msg.data,prop,value);return msg;}]],BIND_SETTERS:[[['DIV','SPAN','P','LI','A','H1','H2','H3','H4','H5'],function(element,attribute,type,msg,datatype,direction,controller)
|
2011
|
+
{var prop=element.getAttribute(attribute+'Property')||element.name||element.id;var obj=Object.getNestedProperty(msg,prop);var append=element.getAttribute(attribute+'Append')=='true';obj=obj!=null?obj:(typeof(msg)=='string')?msg:(append?'':element.innerHTML);if(append)
|
2012
|
+
{element.innerHTML+=this.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,direction,controller);}
|
2013
|
+
else
|
2014
|
+
{element.innerHTML=this.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,direction,controller);}
|
2015
|
+
Seamless.triggerValidationIfRequired(element);}],[['IMG','IFRAME'],function(element,attribute,type,msg,datatype,direction,controller)
|
2016
|
+
{var prop=element.getAttribute(attribute+'Property')||element.name||element.id;var obj=Object.getNestedProperty(msg,prop);obj=obj!=null?obj:(typeof(msg)=='string')?msg:null;var newsrc=this.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,direction,controller);if(newsrc)
|
2017
|
+
{element.src=newsrc;}}],[[/^SEAMLESS(.*)/,'JIMMY','JIMMY:JIMMY'],function(element,attribute,type,msg,datatype,direction,controller)
|
2018
|
+
{var name=this.getTagNameWithNS(element).toLowerCase();var widget_arr=name.split(':');var widget=(widget_arr.length==2?widget_arr[1]:null);if(!widget||widget=='JIMMY')
|
2019
|
+
{widget=element.getAttribute('widget');}
|
2020
|
+
if(widget)
|
2021
|
+
{try
|
2022
|
+
{var builder=Seamless.getWidgetBuilder(widget);if(builder&&builder['onBind'])
|
2023
|
+
{builder.onBind.apply(builder,[element,attribute,type,msg,datatype,direction,controller]);return;}}
|
2024
|
+
catch(e)
|
2025
|
+
{Logger.error('[Seamless]'+Object.getExceptionDetail(e));}}}],[['INPUT'],function(element,attribute,type,msg,datatype,direction,controller)
|
2026
|
+
{var prop=element.getAttribute(attribute+'Property')||element.name||element.id;type=element.getAttribute('type');switch(type)
|
2027
|
+
{case'checkbox':case'radio':var obj=Object.getNestedProperty(msg,prop);obj=obj!=null?(typeof(obj)=='boolean'?obj:obj=='true'):false;element.checked=this.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,direction,controller);break;case'hidden':case'text':case'button':case'file':case'submit':case'password':var obj=Object.getNestedProperty(msg,prop);obj=obj?obj:(typeof(msg)=='string')?msg:element.value;element.value=this.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,direction,controller);break;}
|
2028
|
+
Seamless.triggerValidationIfRequired(element,true);}],[['TEXTAREA'],function(element,attribute,type,msg,datatype,direction,controller)
|
2029
|
+
{var prop=element.getAttribute(attribute+'Property')||element.name||element.id;var obj=Object.getNestedProperty(msg,prop);var append=element.getAttribute(attribute+'Append')=='true';obj=obj!=null?obj:(typeof(msg)=='string')?msg:(append?'':element.value);if(append)
|
2030
|
+
{element.value+=String.unescapeXML(this.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,direction,controller));}
|
2031
|
+
else
|
2032
|
+
{element.value=String.unescapeXML(this.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,direction,controller));}
|
2033
|
+
Seamless.triggerValidationIfRequired(element);}],[['OPTION'],function(element,attribute,type,msg,datatype,direction,controller)
|
2034
|
+
{var prop=element.getAttribute(attribute+'Property')||element.id;var textProperty=element.getAttribute(attribute+'OptionTextProperty')||'text';var valueProperty=element.getAttribute(attribute+'OptionValueProperty')||'value';var obj=Object.getNestedProperty(msg,prop);if(obj!=null)
|
2035
|
+
{var value=obj[valueProperty]||obj;if(value)
|
2036
|
+
{var text=obj[textProperty]||value;element.value=this.evaluateBindMessageExpression(element,attribute,value,type,msg,datatype,direction,controller);element.text=this.evaluateBindMessageExpression(element,attribute,text,type,msg,datatype,direction,controller);}}
|
2037
|
+
Seamless.triggerValidationIfRequired(element);}],[['SELECT'],function(element,attribute,type,msg,datatype,direction,controller)
|
2038
|
+
{var prop=element.getAttribute(attribute+'Property')||element.name||element.id;if(prop)
|
2039
|
+
{var obj=Object.getNestedProperty(msg,prop);if(obj)
|
2040
|
+
{if('true'!=(element.getAttribute(attribute+'Append')||'false'))
|
2041
|
+
{element.options.length=0;}
|
2042
|
+
var textProperty=element.getAttribute(attribute+'OptionTextProperty')||'text';var valueProperty=element.getAttribute(attribute+'OptionValueProperty')||'value';var array=$A(obj);if(array)
|
2043
|
+
{array.each(function(a)
|
2044
|
+
{var value=a[valueProperty]||a;if(value)
|
2045
|
+
{var text=a[textProperty]||value;element.options[element.options.length]=new Option(text,value);}});}}}
|
2046
|
+
Seamless.triggerValidationIfRequired(element);}],[['UL','OL'],function(element,attribute,type,msg,datatype,direction,controller)
|
2047
|
+
{var prop=element.getAttribute(attribute+'Property')||element.name||element.id;var obj=prop?Object.getNestedProperty(msg,prop):null;if(obj)
|
2048
|
+
{var subprop=element.getAttribute(attribute+'RowProperty');var decorator=element.getAttribute(attribute+'RowDecorator');var decoratorArgs=decorator?element.getAttribute(attribute+'RowDecoratorArgs'||'{}'):'{}';var array=$A(obj);var html='';var self=this;var decoratorFunc=decorator?eval(decorator):null;array.each(function(row)
|
2049
|
+
{var value=subprop?row[subprop]:row;if(decorator)
|
2050
|
+
{var scope=Object.copy(scope,controller);var args=Object.evalWithinScope(decoratorArgs,scope);html+=decoratorFunc.apply(self,[element,row,args])||'<li></li>';}
|
2051
|
+
else
|
2052
|
+
{html+='<li>'+value+'</li>';}});element.innerHTML=html;}
|
2053
|
+
Seamless.triggerValidationIfRequired(element);}]],evaluateBindMessageConditionAttr:function(cond,type,data,datatype,direction,controller)
|
2054
|
+
{if(cond)
|
2055
|
+
{var code=this.createMessageCondition(cond);var obj=this.createMessageObject(type,data,datatype,direction,controller);try
|
2056
|
+
{return code.call(obj);}
|
2057
|
+
catch(e)
|
2058
|
+
{Logger.warn(this.toString()+' caught exception:'+e+' evaluating message condition:'+cond+' for '+data+', message:'+type);return false;}}
|
2059
|
+
return true;},evaluateBindMessageCondition:function(element,attribute,type,data,datatype,direction,controller)
|
2060
|
+
{var cond=element.getAttribute(attribute+'Cond');return this.evaluateBindMessageConditionAttr(cond,type,data,datatype,direction,controller);},evaluateBindMessageExpression:function(element,attribute,value,type,data,datatype,direction,controller)
|
2061
|
+
{var expr=element.getAttribute(attribute+'Expr');if(expr)
|
2062
|
+
{var code=this.createMessageExpression(expr);var obj=this.createMessageObject(type,data,datatype,direction,controller,value);try
|
2063
|
+
{var result=code.call(obj);return direction=='local'?result:String.escapeXML(result);}
|
2064
|
+
catch(e)
|
2065
|
+
{Logger.warn(this.toString()+' caught exception:'+e+' evaluating message expression:'+expr+' for '+data+', message:'+type+', used: '+obj.toJSONString()+' as scope');return'';}}
|
2066
|
+
return value;},getBindChangeHandler:function(element)
|
2067
|
+
{var onBindChange=element.getAttribute("onBindChangeMessage");if(onBindChange)
|
2068
|
+
{var tag=element.tagName;var getter=null;this.BIND_GETTERS.each(function(a)
|
2069
|
+
{if(tag.match(a[0]))
|
2070
|
+
{getter=a[1];throw $break;}});if(getter)
|
2071
|
+
{var self=this;return function()
|
2072
|
+
{var msg=getter.call(self,element);if(msg)
|
2073
|
+
{msg['type']=onBindChange;hakano.util.MessageBroker.queue(msg);}};}}
|
2074
|
+
return null;},addMessageBrokerListener:function(controller,listener)
|
2075
|
+
{var ml=controller['_seamlessML'];if(!ml)
|
2076
|
+
{ml=[];controller['_seamlessML']=ml;}
|
2077
|
+
ml.push(listener);hakano.util.MessageBroker.addListener(listener);},removeAllListeners:function(controller)
|
2078
|
+
{var count=0;var ml=controller['_seamlessML'];if(ml)
|
2079
|
+
{for(var c=0,len=ml.length;c<len;c++)
|
2080
|
+
{hakano.util.MessageBroker.removeListener(ml[c]);count++;}
|
2081
|
+
delete controller['_seamlessML'];}
|
2082
|
+
this.destroy(controller);return count;},createBindActionListener:function(element,controller,attribute,action,thetype)
|
2083
|
+
{if(!controller)
|
2084
|
+
{Logger.error(this+', no controller specified for '+element.id);return;}
|
2085
|
+
var self=this;var listener={toString:function()
|
2086
|
+
{if(!this._toString)
|
2087
|
+
{this._toString='[Seamless@'+thetype+'@'+element.id+']';}
|
2088
|
+
return this._toString;},accept:function(type)
|
2089
|
+
{return[thetype];},onMessage:function(type,data,datatype,direction)
|
2090
|
+
{try
|
2091
|
+
{var cond=self.evaluateBindMessageCondition(element,attribute,type,data,datatype,direction,controller);if(cond)
|
2092
|
+
{var delay=element.getAttribute(attribute+'Delay');if(delay!=null)
|
2093
|
+
{setTimeout(function()
|
2094
|
+
{action.apply(self,[element,attribute,type,data,datatype,direction,controller]);},parseInt(delay));}
|
2095
|
+
else
|
2096
|
+
{action.apply(self,[element,attribute,type,data,datatype,direction,controller]);}}}
|
2097
|
+
catch(e)
|
2098
|
+
{Logger.error('Error evaluating bind condition for: '+type+', data: '+data+', action: '+action+', error: '+Object.getExceptionDetail(e));}}};this.addMessageBrokerListener(controller,listener);this.addTrash(element,controller,function(destroyall)
|
2099
|
+
{hakano.util.MessageBroker.removeListener(listener);});},setupBindAction:function(element,controller,attribute,action,child)
|
2100
|
+
{if(!controller)
|
2101
|
+
{throw"controller required for setupBindAction";}
|
2102
|
+
var eventType=element.getAttribute(attribute);if(eventType)
|
2103
|
+
{var array=eventType.split(',');if(array.length==1)
|
2104
|
+
{this.createBindActionListener(element,controller,attribute,action,array[0].trim());}
|
2105
|
+
else
|
2106
|
+
{for(var c=0,len=array.length;c<len;c++)
|
2107
|
+
{this.createBindActionListener(element,controller,attribute,action,array[c].trim());}}
|
2108
|
+
if(!child)
|
2109
|
+
{for(var c=1;c<99;c++)
|
2110
|
+
{var name=attribute+c;if(!this.setupBindAction(element,controller,name,action,true))
|
2111
|
+
{break;}}}
|
2112
|
+
return true;}
|
2113
|
+
return false;},triggerValidationIfRequired:function(element,force)
|
2114
|
+
{if(!force)
|
2115
|
+
{switch(element.tagName)
|
2116
|
+
{case'INPUT':case'TEXTAREA':case'SELECT':case'OPTION':{var form=element.form||Element.findParentForm(element);if(form)
|
2117
|
+
{if(!element.form)element.form=form;if(form.disabled!=''||form.disabled||form.disabled=='true')
|
2118
|
+
{return false;}}
|
2119
|
+
break;}}}
|
2120
|
+
var composite=element['_seamlessCompositeValidator'];if(composite)
|
2121
|
+
{composite(true);return true;}
|
2122
|
+
return false;},addBindMessageHandler:function(element,controller)
|
2123
|
+
{if(!controller)
|
2124
|
+
{throw"controller required for addBindMessageHandler";}
|
2125
|
+
var self=this;if(element.tagName=='SELECT')
|
2126
|
+
{this.setupBindAction(element,controller,'onBindMessageSelectAll',function(element,attribute,type,data,datatype,direction)
|
2127
|
+
{for(var c=0,len=element.options.length;c<len;c++)
|
2128
|
+
{var option=element.options[c];option.selected=true;}});this.setupBindAction(element,controller,'onBindMessageSelectNone',function(element,attribute,type,data,datatype,direction)
|
2129
|
+
{for(var c=0,len=element.options.length;c<len;c++)
|
2130
|
+
{var option=element.options[c];option.selected=false;}});}
|
2131
|
+
this.setupBindAction(element,controller,'onBindMessageStyle',function(element,attribute,type,data,datatype,direction)
|
2132
|
+
{var options=element.getAttribute(attribute+'Options');if(options)
|
2133
|
+
{var obj=eval('('+options+')');Element.setStyle(element,obj);}});this.setupBindAction(element,controller,'onBindMessageAddClassName',function(element,attribute,type,data,datatype,direction)
|
2134
|
+
{var options=element.getAttribute(attribute+'Options');if(options)
|
2135
|
+
{var names=options.split(',');names.each(function(name)
|
2136
|
+
{Element.addClassName(element,name);});}});this.setupBindAction(element,controller,'onBindMessageRemoveClassName',function(element,attribute,type,data,datatype,direction)
|
2137
|
+
{var options=element.getAttribute(attribute+'Options');if(options)
|
2138
|
+
{var names=options.split(',');names.each(function(name)
|
2139
|
+
{Element.removeClassName(element,name);});}});this.setupBindAction(element,controller,'onBindMessageShow',function()
|
2140
|
+
{Element.show(element);});this.setupBindAction(element,controller,'onBindMessageToggle',function()
|
2141
|
+
{Element.toggle(element);});this.setupBindAction(element,controller,'onBindMessageScroll',function()
|
2142
|
+
{hakano.util.Scroller.smoothScrollTo(element);});this.setupBindAction(element,controller,'onBindMessageHide',function()
|
2143
|
+
{Element.hide(element);});this.setupBindAction(element,controller,'onBindMessageClear',function()
|
2144
|
+
{var validateParent=false;if(element.tagName.match(/^(H[1-4]|SPAN|DIV|UL|OL|LI|TABLE|P)$/i))
|
2145
|
+
{element.innerHTML='';}
|
2146
|
+
else if(element.tagName.match(/^(INPUT|TEXTAREA)$/i))
|
2147
|
+
{element.value='';}
|
2148
|
+
else if(element.tagName=='SELECT')
|
2149
|
+
{element.options.length=0;}
|
2150
|
+
else if(element.tagName=='OPTION')
|
2151
|
+
{var select=element.parentNode;for(var c=0;c<select.options.length;c++)
|
2152
|
+
{if(select.options[c]==element)
|
2153
|
+
{select.options[c]=null;break;}}
|
2154
|
+
validateParent=true;}
|
2155
|
+
else if(element.tagName=='IMG')
|
2156
|
+
{element.src='';}
|
2157
|
+
if(!self.triggerValidationIfRequired(element))
|
2158
|
+
{if(validateParent)
|
2159
|
+
{self.triggerValidationIfRequired(element.parentNode);}}});if(element.tagName.match(/^(INPUT|TEXTAREA|SELECT)$/i))
|
2160
|
+
{this.setupBindAction(element,controller,'onBindMessageActivate',function()
|
2161
|
+
{if(element.focus)element.focus();if(element.select)element.select();});this.setupBindAction(element,controller,'onBindMessageSelect',function()
|
2162
|
+
{if(element.select)element.select();self.triggerValidationIfRequired(element);});this.setupBindAction(element,controller,'onBindMessageReset',function()
|
2163
|
+
{if(element.reset)element.reset();self.triggerValidationIfRequired(element,true);});}
|
2164
|
+
if(element.tagName=='OPTION')
|
2165
|
+
{this.setupBindAction(element,controller,'onBindMessageSelect',function()
|
2166
|
+
{element.selected=true;if(!self.triggerValidationIfRequired(element))
|
2167
|
+
{self.triggerValidationIfRequired(element.parentNode);}});}
|
2168
|
+
this.setupBindAction(element,controller,'onBindMessageReset',function()
|
2169
|
+
{if(element.tagName=='FORM')
|
2170
|
+
{Form.reset(element);Form.Methods.getElements(element).each(function(field)
|
2171
|
+
{field.selected=false;if(!self.triggerValidationIfRequired(field))
|
2172
|
+
{self.triggerValidationIfRequired(field.parentNode);}});}
|
2173
|
+
else
|
2174
|
+
{element.selected=false;if(!self.triggerValidationIfRequired(element))
|
2175
|
+
{self.triggerValidationIfRequired(element.parentNode);}}});this.setupBindAction(element,controller,'onBindMessageRevalidate',function()
|
2176
|
+
{var ok=self.triggerValidationIfRequired(element,true);$D(Seamless+' triggered revalidation for '+element.id+', returned: '+ok);});this.setupBindAction(element,controller,'onBindMessageFocus',function()
|
2177
|
+
{if(element.focus)element.focus();});this.setupBindAction(element,controller,'onBindMessageBlur',function()
|
2178
|
+
{if(element.blur)element.blur();});this.setupBindAction(element,controller,'onBindMessageEnable',function()
|
2179
|
+
{element.disabled='';if(element.tagName=='FORM')
|
2180
|
+
{Form.Methods.enable(element);Form.getElements(element).each(function(field)
|
2181
|
+
{field['_dirty']=null;self.triggerValidationIfRequired(field);});}});this.setupBindAction(element,controller,'onBindMessageDisable',function()
|
2182
|
+
{element.disabled='true';if(element.tagName=='FORM')
|
2183
|
+
{Form.Methods.disable(element);}});this.setupBindAction(element,controller,'onBindMessageVisible',function()
|
2184
|
+
{element.style.visibility='visible';});this.setupBindAction(element,controller,'onBindMessageHidden',function()
|
2185
|
+
{element.style.visibility='hidden';});this.setupBindAction(element,controller,'onBindMessageEffect',function(element,attribute,type,data,datatype,direction)
|
2186
|
+
{var effect=element.getAttribute(attribute+'Type');if(effect)
|
2187
|
+
{if(Effect[effect])
|
2188
|
+
{var effectOptions=eval('('+(element.getAttribute(attribute+'Options')||'{}')+')');new Effect[effect](element,effectOptions);}}});if(element.getAttribute('onBindMessage'))
|
2189
|
+
{var setter=null;var tag=this.getTagNameWithNS(element).toUpperCase();for(var c=0,len=this.BIND_SETTERS.length;c<len;c++)
|
2190
|
+
{var array=this.BIND_SETTERS[c];var types=array[0];var match=false;if(types.length==1)
|
2191
|
+
{if(typeof(types[0])=='string')
|
2192
|
+
{match=types[0]==tag;}
|
2193
|
+
else
|
2194
|
+
{match=types[0].exec(tag);}}
|
2195
|
+
else
|
2196
|
+
{for(var x=0,xl=types.length;x<xl;x++)
|
2197
|
+
{if(typeof(types[x])=='string')
|
2198
|
+
{match=types[x]==tag;}
|
2199
|
+
else
|
2200
|
+
{match=types[x].exec(tag);}
|
2201
|
+
if(match)break;}}
|
2202
|
+
if(match)
|
2203
|
+
{setter=array[1];break;}
|
2204
|
+
else
|
2205
|
+
{$D(this+" couldn't find a bind setter match for "+tag+" for "+element.id);}}
|
2206
|
+
if(setter)
|
2207
|
+
{this.setupBindAction(element,controller,'onBindMessage',setter);}}},getActionValidator:function(element,controller)
|
2208
|
+
{var validatorFunc=element.getAttribute('actionValidator');var validator=null;var validatorThis=null;if(validatorFunc)
|
2209
|
+
{if(typeof controller[validatorFunc]=='function')
|
2210
|
+
{validator=controller[validatorFunc];validatorThis=controller;}
|
2211
|
+
if(!validator&&Validator[validatorFunc])
|
2212
|
+
{validatorThis=Validator;validator=Validator[validatorFunc];}
|
2213
|
+
if(!validator)
|
2214
|
+
{validatorThis=window;var func=eval(validatorFunc);if(typeof(func)=='function')
|
2215
|
+
{validator=func;}}}
|
2216
|
+
if(validator)
|
2217
|
+
{try
|
2218
|
+
{return validator.bind(validatorThis);}
|
2219
|
+
catch(e)
|
2220
|
+
{alert('Error for: '+validator+'\n'+e+'\n'+e.stack);}}
|
2221
|
+
return null;},getValidator:function(element,controller,name)
|
2222
|
+
{var validatorFunc=element.getAttribute('validator');var validator=null;var validatorThis=null;if(validatorFunc)
|
2223
|
+
{if(typeof controller[validatorFunc]=='function')
|
2224
|
+
{validator=controller[validatorFunc];validatorThis=controller;}
|
2225
|
+
if(!validator&&Validator[validatorFunc])
|
2226
|
+
{validatorThis=Validator;validator=Validator[validatorFunc];}
|
2227
|
+
if(!validator)
|
2228
|
+
{validatorThis=window;var func=eval(validatorFunc);if(typeof(func)=='function')
|
2229
|
+
{validator=func;}}}
|
2230
|
+
if(!validator)
|
2231
|
+
{validator=Validator['required'];validatorThis=Validator;}
|
2232
|
+
if(validator)
|
2233
|
+
{try
|
2234
|
+
{return validator.bind(validatorThis);}
|
2235
|
+
catch(e)
|
2236
|
+
{alert('Error getting validator:'+validator+'\n'+e+'\n'+e.stack);}}
|
2237
|
+
return Prototype.emptyFunction;},getRenderer:function(type)
|
2238
|
+
{type=type||'defaultRenderer';if(Renderer[type])
|
2239
|
+
{return Renderer[type];}
|
2240
|
+
else if(window[type])
|
2241
|
+
{return window[type];}
|
2242
|
+
else
|
2243
|
+
{Logger.error(this+" Couldn't find renderer type: "+type);return Renderer['defaultRenderer'];}},getDecorator:function(element,controller)
|
2244
|
+
{var decorator=element.getAttribute('decorator');var decoratorThis=null;var dec=null;if(decorator)
|
2245
|
+
{if(controller&&typeof controller[decorator]=='function')
|
2246
|
+
{dec=controller[decorator];decoratorThis=controller;}
|
2247
|
+
if(!decoratorThis&&Decorator[decorator])
|
2248
|
+
{dec=Decorator[decorator];decoratorThis=Decorator;}
|
2249
|
+
if(!decoratorThis)
|
2250
|
+
{decoratorThis=window;var func=eval(decorator);if(typeof(func)=='function')
|
2251
|
+
{dec=func;}}}
|
2252
|
+
if(!decoratorThis)
|
2253
|
+
{dec=Decorator["defaultDecorator"];decoratorThis=Decorator;}
|
2254
|
+
try
|
2255
|
+
{return dec.bind(decoratorThis);}
|
2256
|
+
catch(e)
|
2257
|
+
{alert('Error getting decorator:'+dec+'\n'+e+'\n'+e.stack);}
|
2258
|
+
return null;},addHashFieldInfo:function(element)
|
2259
|
+
{var onBindSecureHash=element.getAttribute('onBindSecureHash');if(onBindSecureHash)
|
2260
|
+
{var onBindSecureHashSeparator=element.getAttribute('onBindSecureHashSeparator')||':';var onBindSecureHashFormation=element.getAttribute('onBindSecureHashFormation')||'additive';element['_seedDataTransformer']=function(value)
|
2261
|
+
{var fields=onBindSecureHash.split(',');value=element.value||'';if(onBindSecureHashFormation=='additive')
|
2262
|
+
{value=hakano.util.SHA.toSHA256Hex(value);}
|
2263
|
+
for(var c=0,len=fields.length;c<len;c++)
|
2264
|
+
{var field=$(fields[c]);if(field)
|
2265
|
+
{var fv=field.value||'';if(onBindSecureHashFormation=='additive')
|
2266
|
+
{value=hakano.util.SHA.toSHA256Hex(value+onBindSecureHashSeparator+fv);}
|
2267
|
+
else
|
2268
|
+
{value+=onBindSecureHashSeparator+fv;}}}
|
2269
|
+
if(onBindSecureHashFormation!='additive')
|
2270
|
+
{value=hakano.util.SHA.toSHA256Hex(value);}
|
2271
|
+
$D(Seamless+' - fields='+fields+', before='+element.value+', after='+value);return value;};return true;}
|
2272
|
+
return false;},addSeedLoginInfo:function(element)
|
2273
|
+
{var onBindGenerateLoginSeedRequestMessage=element.getAttribute('onBindGenerateLoginSeedRequestMessage');var onBindGenerateLoginSeedMessage=element.getAttribute('onBindGenerateLoginSeedMessage');var onBindGenerateLoginSeedProperty=element.getAttribute('onBindGenerateLoginSeedProperty')||'seed';var onBindGenerateLoginChallengeProperty=element.getAttribute('onBindGenerateLoginChallengeProperty')||'challenge';var onBindGenerateLoginSessionIDCookie=element.getAttribute('onBindGenerateLoginSessionIDCookie')||'JSESSIONID';var onBindSecureHashSeparator=element.getAttribute('onBindSecureHashSeparator')||':';if(onBindGenerateLoginSeedRequestMessage&&onBindGenerateLoginSeedMessage)
|
2274
|
+
{if(!window['_seedDataListener'])
|
2275
|
+
{window['_seedDataListener']={toString:function()
|
2276
|
+
{return'[Seamless@seedDataListener]';},accept:function(type)
|
2277
|
+
{return[onBindGenerateLoginSeedMessage];},onMessage:function(type,data)
|
2278
|
+
{if(data)
|
2279
|
+
{var seed=data[onBindGenerateLoginSeedProperty];var challenge=data[onBindGenerateLoginChallengeProperty];if(seed&&challenge)
|
2280
|
+
{window['_seed']=seed;window['_seed_sent']=false;window['_challenge']=challenge;window['_seedts']=new Date().getTime();window['_sessionid']=hakano.util.Cookie.GetCookie(onBindGenerateLoginSessionIDCookie);}
|
2281
|
+
else
|
2282
|
+
{Logger.warn("[Seamless] received seed response but data didn't match expected properties. seed expected:"+onBindGenerateLoginSeedProperty+", challenge expected:"+onBindGenerateLoginChallengeProperty);}}}};hakano.util.MessageBroker.addListener(window['_seedDataListener']);this.addTrash(element,window,function(destroyall)
|
2283
|
+
{hakano.util.MessageBroker.removeListener(window['_seedDataListener']);window['_seedDataListener']=null;window['_seed']=null;window['_seed_received']=null;window['_challenge']=null;window['_sessionid']=null;window['_seedts']=null;});}
|
2284
|
+
var composite=null;if(this.addHashFieldInfo(element))
|
2285
|
+
{composite=element['_seedDataTransformer'];if(composite)
|
2286
|
+
{if(!HAKANO.isIE)
|
2287
|
+
{delete element['_seedDataTransformer'];}
|
2288
|
+
else
|
2289
|
+
{element['_seedDataTransformer']=null;}}}
|
2290
|
+
var self=this;var msg=onBindGenerateLoginSeedMessage.split(':');var dir=msg.length==2?msg[0]:'remote';var event=msg.length==2?msg[1]:msg;element['_seedDataTransformer']=function(value)
|
2291
|
+
{var fieldvalue=(composite)?composite(value):value;var seed=window['_seed'];var challenge=window['_challenge'];var sessionid=window['_sessionid'];if(seed&&challenge&&sessionid)
|
2292
|
+
{$D(Seamless+' sessionid='+sessionid+', fieldvalue='+fieldvalue);var first=hakano.util.SHA.toSHA256Hex(fieldvalue+onBindSecureHashSeparator+sessionid);var second=hakano.util.SHA.toSHA256Hex(first+onBindSecureHashSeparator+challenge);var third=hakano.util.SHA.toSHA256Hex(second+onBindSecureHashSeparator+seed);$D(Seamless+' first='+first);$D(Seamless+' second='+second);$D(Seamless+' third='+third);return third;}
|
2293
|
+
else
|
2294
|
+
{Logger.warn('[Seamless] transformer for field: '+element.id+" couldn't transform, missing properties. challenge was: "+challenge+", seed was: "+seed+", sessionid: "+sessionid);}
|
2295
|
+
return null;};element['_seedDataFocus']=function()
|
2296
|
+
{self.addSeedLoginInfo(element);return true;};Event.observe(element,'focus',element['_seedDataFocus'],false);this.addTrash(element,window,function()
|
2297
|
+
{Event.stopObserving(element,'focus',element['_seedDataFocus'],false);if(!HAKANO.isIE)
|
2298
|
+
{delete element['_seedDataTransformer'];}
|
2299
|
+
else
|
2300
|
+
{element['_seedDataTransformer']=null;}});if(!window['_seed_sent'])
|
2301
|
+
{var ts=window['_seedts'];if(ts)
|
2302
|
+
{var now=new Date().getTime();if(now-ts<60000)
|
2303
|
+
{return false;}}
|
2304
|
+
window['_seed_sent']=true;hakano.util.MessageBroker.queue({type:onBindGenerateLoginSeedRequestMessage,data:{},immediate:true});}
|
2305
|
+
return true;}
|
2306
|
+
return false;},getFieldSetValues:function(fieldsetName,data,direction)
|
2307
|
+
{if(fieldsetName)
|
2308
|
+
{var fs=this.getFieldSet(fieldsetName);if(fs)
|
2309
|
+
{var fields=fs.getFields();if(fields&&fields.length>0)
|
2310
|
+
{for(var c=0,len=fields.length;c<len;c++)
|
2311
|
+
{var field=fields[c].getElement();if(field&&field.tagName)
|
2312
|
+
{if(field.tagName.toLowerCase()=='input')
|
2313
|
+
{var type=field.getAttribute('type');if(type=='button'||type=='submit')
|
2314
|
+
{continue;}}
|
2315
|
+
if(this.DEBUG)$D(this.toString()+' adding field: '+field.id+' for fieldset:'+fieldsetName);var add=true;if(direction=='local')
|
2316
|
+
{var exclude=field.getAttribute('fieldsetLocalExclude');add=(exclude?exclude!='true':true);}
|
2317
|
+
else if(direction=='remote')
|
2318
|
+
{var exclude=field.getAttribute('fieldsetRemoteExclude');add=(exclude?exclude!='true':true);}
|
2319
|
+
if(add)
|
2320
|
+
{var value=this.getFieldValue(field,direction);var name=field.name||field.id;data[name]=value;}}}}}}
|
2321
|
+
return data;},createEventHandler:function(element,event,controller)
|
2322
|
+
{var eventName='on'+event.charAt(0).toUpperCase()+event.substring(1)+'Message';var attr=element.getAttribute(eventName);if(attr)
|
2323
|
+
{var name='seamless_'+attr+'_dispatcher_'+element.id;if(!element[name])
|
2324
|
+
{var self=this;var activators=element.getAttribute('activators');var fieldsetName=(element.getAttribute('type')=='button'||activators)?element.getAttribute('fieldset'):null;var tokens=attr.split(':');var direction=tokens.length==2?tokens[0]:'local';var argsobj=element.getAttribute(eventName+'Args');element[name]=function(e)
|
2325
|
+
{e=Event.getEvent(e);$D(self+', name='+name+', element='+element.id+', fieldsetname='+fieldsetName);try
|
2326
|
+
{var data={};if(argsobj)
|
2327
|
+
{var scope=Object.copy({},controller);data=Object.evalWithinScope(String.unescapeXML(argsobj),scope);}
|
2328
|
+
if(data.id==null&&element.id)
|
2329
|
+
{data.id=element.id;}
|
2330
|
+
self.getFieldSetValues(fieldsetName,data,direction);var msg={type:attr,data:data,immediate:true};if(direction=='local')
|
2331
|
+
{e.toJSONString=function()
|
2332
|
+
{return'null';};data['event']=e;}
|
2333
|
+
hakano.util.MessageBroker.queue(msg);}
|
2334
|
+
catch(ex)
|
2335
|
+
{if(Logger&&Logger.error)
|
2336
|
+
{Logger.error(self.toString()+', Exception firing '+event+' for '+element+'. Error: '+Object.getExceptionDetail(ex));}}
|
2337
|
+
return true;};Event.observe(element,event,element[name],false);this.addTrash(element,controller,function()
|
2338
|
+
{Event.stopObserving(element,event,element[name],false);delete element[name];});}}},createActivatorsFor:function(element,controller,activatorValidator,activators,activatorValidatorDecId,bindChangeHandler,trash)
|
2339
|
+
{if(activators)
|
2340
|
+
{var self=this;if(this.DEBUG)$D(this+', activators => '+activators+' for '+element.id);var validators=[];var compositeValidator=function(force)
|
2341
|
+
{var valid=true;for(var c=0,len=validators.length;c<len;c++)
|
2342
|
+
{var v=validators[c];var elem=v[0];if(elem)
|
2343
|
+
{var dirty=elem['_dirty'];var ok=(dirty!=null)?dirty:false;if(dirty==null||force)
|
2344
|
+
{var validator=v[1];var decorator=v[2];var decoratorId=v[3];var value=self.getFieldValue(elem,'local')||'';if(self.DEBUG)$D(self.toString(),' invoking validator for '+elem.id+' with: ['+value+'], dirty:'+dirty+',force:'+force);ok=validator(value,elem);if(self.DEBUG)$D(self.toString(),' validator for '+elem.id+' returned: ['+ok+']');decorator(elem,ok,decoratorId);if(ok&&bindChangeHandler)
|
2345
|
+
{bindChangeHandler();}
|
2346
|
+
elem['_dirty']=ok;}
|
2347
|
+
valid=valid&&ok;}}
|
2348
|
+
if(valid&&activatorValidator)
|
2349
|
+
{var aok=activatorValidator(element,activators,activatorValidatorDecId);if(self.DEBUG)$D(self.toString(),' '+element.id+' action validator returned: '+aok+'');valid=(aok==null||aok==true)?true:false;}
|
2350
|
+
if(element.tagName=='A')
|
2351
|
+
{Element[valid?'show':'hide'](element);}
|
2352
|
+
else
|
2353
|
+
{element.disabled=(valid)?'':'true';}
|
2354
|
+
if(self.DEBUG)$D(self.toString(),' '+element.id+' is valid: '+valid+'');return valid;};element['_seamlessCompositeValidator']=compositeValidator;var aarray=activators.split(',');for(var c=0,len=aarray.length;c<len;c++)
|
2355
|
+
{var elem=$(aarray[c]);if(!elem)
|
2356
|
+
{Logger.warn(self+' Invalid element id:'+aarray[c]+' for activator at element: '+element.id);continue;}
|
2357
|
+
if(elem['_seamlessValidatorE']==1&&elem['_seamlessDestructors'])
|
2358
|
+
{var d=elem['_seamlessDestructors'];for(var x=0,l=d.length;x<l;x++)
|
2359
|
+
{d[x]();}
|
2360
|
+
elem['_seamlessDestructors']=null;}
|
2361
|
+
var validator=self.getValidator(elem,controller);var decorator=self.getDecorator(elem,controller);var decoratorId=elem.getAttribute('decoratorId');validators.push([elem,validator,decorator,decoratorId]);elem['_seamlessDecorator']=decorator;elem['_seamlessCompositeValidator']=compositeValidator;var validatorFunction=function()
|
2362
|
+
{this['_dirty']=null;compositeValidator();return true;};elem['_seamlessValidator']=validatorFunction.bindAsEventListener(elem);var type=elem.getAttribute('type');if('text'==type||'password'==type||elem.nodeName=='TEXTAREA')
|
2363
|
+
{Event.observe(elem,'keyup',elem['_seamlessValidator'],false);Event.observe(elem,'change',elem['_seamlessValidator'],false);if(trash)
|
2364
|
+
{trash.push(function()
|
2365
|
+
{Event.stopObserving(elem,'keyup',elem['_seamlessValidator'],false);Event.stopObserving(elem,'change',elem['_seamlessValidator'],false);elem['_seamlessValidator']=null;});}
|
2366
|
+
else
|
2367
|
+
{self.addTrash(elem,controller,function()
|
2368
|
+
{Event.stopObserving(elem,'keyup',elem['_seamlessValidator'],false);Event.stopObserving(elem,'change',elem['_seamlessValidator'],false);elem['_seamlessValidator']=null;});}}
|
2369
|
+
else
|
2370
|
+
{Event.observe(elem,'change',elem['_seamlessValidator'],false);if(trash)
|
2371
|
+
{trash.push(function()
|
2372
|
+
{Event.stopObserving(elem,'change',elem['_seamlessValidator'],false);elem['_seamlessValidator']=null;});}
|
2373
|
+
else
|
2374
|
+
{self.addTrash(elem,controller,function()
|
2375
|
+
{Event.stopObserving(elem,'change',elem['_seamlessValidator'],false);elem['_seamlessValidator']=null;});}}}
|
2376
|
+
var initialValid=compositeValidator();$D(this+' initially valid='+initialValid+' for '+element.id);if(element.tagName=='A')
|
2377
|
+
{Element[initialValid?'show':'hide'](element);}
|
2378
|
+
else
|
2379
|
+
{element.disabled=(initialValid)?'':'true';}
|
2380
|
+
return true;}
|
2381
|
+
return false;},createActivators:function(element,controller,bindChangeHandler,trash)
|
2382
|
+
{var activators=element.getAttribute('activators');var actionValidatorDecoratorId=element.getAttribute('actionValidatorDecoratorId');var activatorValidator=this.getActionValidator(element,controller);this.createActivatorsFor(element,controller,activatorValidator,activators,actionValidatorDecoratorId,bindChangeHandler,trash);},addEventsMessageHandler:function(element,controller)
|
2383
|
+
{for(var c=0,len=this.messageEvents.length;c<len;c++)
|
2384
|
+
{this.createEventHandler(element,this.messageEvents[c],controller);}},syntaxHighlightBrushes:null,addSyntaxHighlighter:function(element)
|
2385
|
+
{var attribute=element.getAttribute('highlight');if(attribute)
|
2386
|
+
{if(!Seamless.syntaxHighlightBrushes)
|
2387
|
+
{Seamless.syntaxHighlightBrushes={};for(var brush in dp.sh.Brushes)
|
2388
|
+
{var aliases=dp.sh.Brushes[brush].Aliases;if(aliases==null)
|
2389
|
+
{continue;}
|
2390
|
+
for(var i=0;i<aliases.length;i++)
|
2391
|
+
{Seamless.syntaxHighlightBrushes[aliases[i]]=brush;}}}
|
2392
|
+
function IsOptionSet(value,list,def)
|
2393
|
+
{for(var i=0;i<list.length;i++)
|
2394
|
+
if(list[i]==value)
|
2395
|
+
return true;return def;}
|
2396
|
+
function GetOptionValue(name,list,defaultValue)
|
2397
|
+
{var regex=new RegExp('^'+name+'\\[(\\w+)\\]$','gi');var matches=null;for(var i=0;i<list.length;i++)
|
2398
|
+
if((matches=regex.exec(list[i]))!=null)
|
2399
|
+
return matches[1];return defaultValue;}
|
2400
|
+
var options=attribute.split(':');var language=options[0].toLowerCase();if(Seamless.syntaxHighlightBrushes[language]==null)
|
2401
|
+
{return;}
|
2402
|
+
var highlighter=new dp.sh.Brushes[Seamless.syntaxHighlightBrushes[language]]();element.style.display='none';highlighter.noGutter=IsOptionSet('nogutter',options,true);highlighter.addControls=!IsOptionSet('nocontrols',options,true);highlighter.collapse=IsOptionSet('collapse',options,false);highlighter.showColumns=IsOptionSet('showcolumns',options,false);highlighter.firstLine=parseInt(GetOptionValue('firstline',options,1));highlighter.Highlight(element['value']);element.parentNode.insertBefore(highlighter.div,element);}},messageEvents:['focus','blur','mousedown','mouseup','mousemove','reset','mouseover','mouseout','change'],mouseEvents:['click','dblclick','mouseover','mouseout'],inputEvents:['click','focus','blur','keyup','keydown','keypress'],seamlessNSRegex:/^seamless[:]+/,activate:function(element,controller)
|
2403
|
+
{if(!controller)
|
2404
|
+
{throw"controller required for activate";}
|
2405
|
+
element['_seamlessfied']=1;if(!element.id)
|
2406
|
+
{element.id=this.createUniqueId(element);}
|
2407
|
+
var name=this.getTagNameWithNS(element).toLowerCase();var self=this;if(name.match(this.seamlessNSRegex))
|
2408
|
+
{name='seamless';}
|
2409
|
+
switch(name)
|
2410
|
+
{case'jimmy':case'jimmy:jimmy':case'seamless':{element.originaldisplay=element.style.display;element.style.display='none';this.inject(element,null,controller);break;}
|
2411
|
+
case'table':{this.addBindMessageHandler(element,controller);break;}
|
2412
|
+
case'form':{element.setAttribute('autocomplete','off');this.addBindMessageHandler(element,controller);this.addEventsMessageHandler(element,controller);break;}
|
2413
|
+
case'div':case'span':case'h1':case'h2':case'h3':case'h4':case'h5':case'img':case'a':case'p':case'ul':case'ol':case'li':case'select':case'option':case'iframe':case'pre':case'tr':case'td':case'th':case'tbody':case'thead':case'tfoot':{for(var c=0,len=this.mouseEvents.length;c<len;c++)
|
2414
|
+
{this.addSeamlessListener(element,controller,this.mouseEvents[c]);}}
|
2415
|
+
case'input':case'textarea':{this.addFieldSet(element,controller);this.addBindMessageHandler(element,controller);this.addEventsMessageHandler(element,controller);for(var c=0,len=this.inputEvents.length;c<len;c++)
|
2416
|
+
{this.addSeamlessListener(element,controller,this.inputEvents[c]);}
|
2417
|
+
switch(name)
|
2418
|
+
{case'textarea':{var copyFrom=element.getAttribute('copyFrom');if(copyFrom)
|
2419
|
+
{copyFrom=$(copyFrom);if(copyFrom)
|
2420
|
+
{element.innerHTML=String.escapeXML(copyFrom.innerHTML);}}
|
2421
|
+
this.addSyntaxHighlighter(element);element.onfocus=function(e)
|
2422
|
+
{hakano.util.KeyManager.disable();return true;};element.onblur=function(e)
|
2423
|
+
{hakano.util.KeyManager.enable();return true;};break;}
|
2424
|
+
case'img':case'script':case'iframe':{var srcexpr=element.getAttribute('srcexpr');if(srcexpr)
|
2425
|
+
{var condAttr=element.getAttribute('cond');var cond=(condAttr)?this.createMessageCondition(condAttr):this.FunctionTrue;if(cond())
|
2426
|
+
{try
|
2427
|
+
{var expr=srcexpr.toFunction();if(expr)
|
2428
|
+
{var value=expr.call(controller,element);$D(this+' invoked srcexpr='+srcexpr+' on element='+element.id+', returned='+value);if(value!=null)
|
2429
|
+
{element.src=value;}}}
|
2430
|
+
catch(e)
|
2431
|
+
{Logger.error('Error evaluating '+element.id+' srcexpr='+srcexpr+', '+Object.getExceptionDetail(e));}}}
|
2432
|
+
break;}}
|
2433
|
+
var type=element.getAttribute('type');if(type)
|
2434
|
+
{switch(type)
|
2435
|
+
{case'button':case'radio':case'file':this.addSeamlessListener(element,controller,'click');break;case'password':{if(this.addSeedLoginInfo(element))
|
2436
|
+
{element['_seedDataFocusListener']=function()
|
2437
|
+
{self.addSeedLoginInfo(element);};Event.observe(element,'focus',element['_seedDataFocusListener'],false);this.addTrash(element,controller,function()
|
2438
|
+
{Event.stopObserving(element,'focus',element['_seedDataFocusListener'],false);delete element['_seedDataFocusListener'];});}
|
2439
|
+
else
|
2440
|
+
{this.addHashFieldInfo(element);}
|
2441
|
+
break;}}}
|
2442
|
+
var bindChangeHandler=null;switch(name)
|
2443
|
+
{case'input':case'select':case'textarea':{bindChangeHandler=this.getBindChangeHandler(element);break;}}
|
2444
|
+
if(this.createActivators(element,controller,bindChangeHandler))
|
2445
|
+
{}
|
2446
|
+
else if(!(element['_seamlessValidator'])&&(name=='input'||name=='select'||name=='textarea'))
|
2447
|
+
{var validator=this.getValidator(element,controller);var decorator=this.getDecorator(element,controller);var decoratorId=element.getAttribute('decoratorId');element['_seamlessValidatorE']=1;var value=self.getFieldValue(element,'local')||'';var valid=validator(value,element);decorator(element,valid,decoratorId);element['_seamlessDestructors']=[];var prop='onchange';if('text'==type||'password'==type||name=='select'||name=='textarea')
|
2448
|
+
{prop='onkeyup';}
|
2449
|
+
if(name!='textarea')
|
2450
|
+
{hakano.util.KeyManager.installHandler(hakano.util.KeyManager.KEY_ENTER,element,function()
|
2451
|
+
{element.enterTriggered=false;if(element.timer!=null)
|
2452
|
+
{element.timerCancelled=true;clearTimeout(element.timer);element.timer=null;}
|
2453
|
+
var value=self.getFieldValue(element,'local')||'';if(self.DEBUG)$D(self.toString(),' invoking validator for '+element.id+' with: ['+value+']');var ok=validator(value,element);if(self.DEBUG)$D(self.toString(),' validator for '+element.id+' returned: ['+ok+']');decorator(element,ok,decoratorId);if(ok&&bindChangeHandler)
|
2454
|
+
{element.enterTriggered=true;element._value=element.value;bindChangeHandler();setTimeout(function()
|
2455
|
+
{element.enterTriggered=false;},200);}});var destructor=function()
|
2456
|
+
{hakano.util.KeyManager.removeHandler(hakano.util.KeyManager.KEY_ENTER,element);};this.addTrash(element,controller,destructor);element['_seamlessDestructors'].push(destructor);}
|
2457
|
+
var timeout=parseInt(element['onBindChangeMessageTimeout']||'2000');var blurlistener=function()
|
2458
|
+
{if(element.timer!=null)
|
2459
|
+
{element.timerCancelled=true;clearTimeout(element.timer);element.timer=null;}
|
2460
|
+
if(element.value!=element._value)
|
2461
|
+
{var value=self.getFieldValue(element,'local')||'';var ok=validator(value,element);decorator(element,ok,decoratorId);if(!element.enterTriggered&&ok&&bindChangeHandler)
|
2462
|
+
{element._value=element.value;bindChangeHandler();}}
|
2463
|
+
return true;};Event.observe(element,'blur',blurlistener,false);var destructor=function()
|
2464
|
+
{Event.stopObserving(element,'blur',blurlistener,false);};this.addTrash(element,controller,destructor);element['_seamlessDestructors'].push(destructor);var addChange='onkeyup'==prop;while(true)
|
2465
|
+
{element[prop]=function(e)
|
2466
|
+
{e=Event.getEvent(e);if(element.timer!=null)
|
2467
|
+
{element.timerCancelled=true;clearTimeout(element.timer);element.timer=null;}
|
2468
|
+
var current=element._value;element._value=self.getFieldValue(element,'local')||'';if(element._value!=current)
|
2469
|
+
{var ok=validator(element._value,element);decorator(element,ok,decoratorId);if(!element.enterTriggered&&ok&&bindChangeHandler)
|
2470
|
+
{element.timer=setTimeout(function()
|
2471
|
+
{if(!element.timerCancelled&&!element.enterTriggered)
|
2472
|
+
{bindChangeHandler();}
|
2473
|
+
element.timer=null;element.enterTriggered=false;},timeout);element.timerCancelled=false;}}
|
2474
|
+
return true;};if(prop=='onchange')break;prop='onchange';}
|
2475
|
+
destructor=function()
|
2476
|
+
{if(element[prop])
|
2477
|
+
{element[prop]=null;}};this.addTrash(element,controller,destructor);element['_seamlessDestructors'].push(destructor);}
|
2478
|
+
break;}}},getTagNameWithNS:function(elem)
|
2479
|
+
{if(HAKANO.isIE)
|
2480
|
+
{if(elem.scopeName=='seamless')
|
2481
|
+
{return elem.scopeName+':'+elem.nodeName;}}
|
2482
|
+
return elem.nodeName;},wire:function(view,controller,ignoreSelf,force,replaceid)
|
2483
|
+
{if(!controller)
|
2484
|
+
{controller=window;}
|
2485
|
+
$D(this+' wire begin for: '+view.id+' ('+view+')');var ts=new Date().getTime();if(!force&&view['_seamlessfied'])
|
2486
|
+
{Logger.warn(this+' (wire) element:'+view.id+' has already been seamlessed: '+view);return;}
|
2487
|
+
if(!ignoreSelf)
|
2488
|
+
{this.activate(view,controller);}
|
2489
|
+
var nodelist=$A(view.getElementsByTagName("*"));var elemType=hakano.util.Dom.ELEMENT_NODE;var count=0;for(var c=0,len=nodelist.length;c<len;c++)
|
2490
|
+
{var child=nodelist[c];if(child.nodeType==elemType)
|
2491
|
+
{this.activate(child,controller);count++;}}
|
2492
|
+
this.fireEvent('load',view,controller);var data={};if(view==document.body)
|
2493
|
+
{data={'id':'document.body'};}
|
2494
|
+
else
|
2495
|
+
{data={'id':view.id};}
|
2496
|
+
hakano.util.MessageBroker.queue({type:'local:seamless.load',data:data});$D(this+' wire end for: '+view.id+' ('+view+'), '+(new Date().getTime()-ts)+' ms, '+count+' elements wired');}});window.siteLoadedObservers.push(function()
|
2497
|
+
{HAKANO.TEMPLATE_VARS={rootPath:HAKANO.DocumentPath,scriptPath:HAKANO.ScriptPath,imagePath:HAKANO.ImagePath,cssPath:HAKANO.DocumentPath+'css',contentPath:HAKANO.DocumentPath+'content',portletPath:HAKANO.DocumentPath+'portlets',modulePath:HAKANO.DocumentPath+'modules',soundPath:HAKANO.DocumentPath+'sounds'};});var SeamlessSearch=Class.create();Object.extend(SeamlessSearch.prototype,Ajax.Autocompleter.prototype);Object.extend(SeamlessSearch.prototype,{baseInitialize:function(element,update,options)
|
2498
|
+
{this.element=$(element);this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;if(this.setOptions)
|
2499
|
+
this.setOptions(options);else
|
2500
|
+
this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update)
|
2501
|
+
{if(!update.style.position||update.style.position=='absolute')
|
2502
|
+
{update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
|
2503
|
+
Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update)
|
2504
|
+
{new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')
|
2505
|
+
this.options.tokens=new Array(this.options.tokens);this.observer=null;this.element.setAttribute('autocomplete','off');Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this));hakano.util.MessageBroker.addListener(this);},destroy:function()
|
2506
|
+
{hakano.util.MessageBroker.removeListener(this);},accept:function(type)
|
2507
|
+
{return[this.options.onBindMessageResponse];},onMessage:function(type,msg)
|
2508
|
+
{if(type==this.options.onBindMessageResponse)
|
2509
|
+
{if(this.update)
|
2510
|
+
{this.update.innerHTML="";}}},sendRequest:function()
|
2511
|
+
{var data={};data[this.options.onBindMessageSearchKey]=this.element.value;var obj={type:this.options.onBindMessageRequest,data:data,immediate:true};hakano.util.MessageBroker.queue(obj);},getUpdatedChoices:function()
|
2512
|
+
{this.sendRequest();},startIndicator:function()
|
2513
|
+
{if(this.update)
|
2514
|
+
{this.update.style.display="block";this.update.innerHTML="searching for '"+this.element.value+"'...";}},hide:function()
|
2515
|
+
{},selectEntry:function()
|
2516
|
+
{}});var Validator=Class.create();var ALPHANUM_REGEX=/[0-9a-zA-Z]+/;Validator={toString:function()
|
2517
|
+
{return'[Validator]';},uniqueId:0,actionValidatorDecorator:function(element,valid,decId,msg)
|
2518
|
+
{try
|
2519
|
+
{if(decId)
|
2520
|
+
{var div=$(decId);if(div)
|
2521
|
+
{if(!valid)
|
2522
|
+
{div.innerHTML='<img src="'+HAKANO.ImagePath+'exclamation.png"> '+msg;}
|
2523
|
+
Element.setStyle(decId,{visibility:(valid?'hidden':'visible')});}}
|
2524
|
+
else
|
2525
|
+
{var id='decorate_'+element.id;var div=$(id);if(!div)
|
2526
|
+
{new Insertion.After(element.id,'<span id="'+id+'" style="font-size:11px" class="error_color"></span>');div=$(id);}
|
2527
|
+
if(!valid)
|
2528
|
+
{div.innerHTML='<img src="'+HAKANO.ImagePath+'deny.png"/> '+msg;}
|
2529
|
+
Element.setStyle(id,{visibility:(valid?'hidden':'visible')});}}
|
2530
|
+
catch(e)
|
2531
|
+
{alert(e+'\n'+e.stack);}},passwordsMatch:function(element,ids,decId)
|
2532
|
+
{var valid=false;if(ids)
|
2533
|
+
{var passwordValue=null;var retypeValue=null;var foundCount=0;var self=this;ids.split(',').each(function(n)
|
2534
|
+
{if(n=="user_password")
|
2535
|
+
{passwordValue=$(n).value;foundCount++;}
|
2536
|
+
if(n=="user_retype_password")
|
2537
|
+
{retypeValue=$(n).value;foundCount++;}
|
2538
|
+
if(foundCount==2)throw $break;});valid=(passwordValue==retypeValue);}
|
2539
|
+
this.actionValidatorDecorator(element,valid,decId,"passwords must match");return valid;},required:function(value)
|
2540
|
+
{if(typeof(value)=='boolean')
|
2541
|
+
{return value;}
|
2542
|
+
if(null==value)
|
2543
|
+
{return false;}
|
2544
|
+
return value.trim().length>0;},EMAIL_REGEXP:/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/,email:function(value)
|
2545
|
+
{return this.EMAIL_REGEXP.test(value);},fullname:function(value)
|
2546
|
+
{return((value.trim().split(" ")).length<1);},noSpaces:function(value)
|
2547
|
+
{if(!this.required(value))
|
2548
|
+
{return false;}
|
2549
|
+
return value.trim().indexOf(' ')==-1;},password:function(value)
|
2550
|
+
{return(value.length>=6);},number:function(value)
|
2551
|
+
{try
|
2552
|
+
{parseInt(value);return true;}
|
2553
|
+
catch(e)
|
2554
|
+
{return false;}},wholenumber:function(value)
|
2555
|
+
{try
|
2556
|
+
{return parseInt(value)>=0;}
|
2557
|
+
catch(e)
|
2558
|
+
{return false;}},url:function(value)
|
2559
|
+
{return hakano.util.URI.isValid(value);},checked:function(value)
|
2560
|
+
{return value||value=='on';},length:function(value,element)
|
2561
|
+
{if(value)
|
2562
|
+
{try
|
2563
|
+
{var min=parseInt(element.getAttribute('validatorMinLength')||'1');var max=parseInt(element.getAttribute('validatorMaxLength')||'999999');var v=value.length;return v>=min&&v<=max;}
|
2564
|
+
catch(e)
|
2565
|
+
{}}
|
2566
|
+
return false;},alphanumeric:function(value,element)
|
2567
|
+
{return ALPHANUM_REGEX.test(value);}};var SeamlessWidget=Class.create();Object.extend(SeamlessWidget.prototype,{initialize:function()
|
2568
|
+
{},toString:function()
|
2569
|
+
{return'[SeamlessWidget]';},build:function(element)
|
2570
|
+
{return false;},onBind:function(element,attribute,type,msg,datatype,direction)
|
2571
|
+
{}});var SeamlessWidget_Content=new SeamlessWidget();SeamlessWidget_Content.build=function(element,controller)
|
2572
|
+
{var src=element.getAttribute('src');var _id=element.id+'_content';var props='';var onLoad=element.getAttribute('onLoadMessage');if(onLoad)
|
2573
|
+
{props='onLoadMessage="'+onLoad+'"';}
|
2574
|
+
element.innerHTML='<div id="'+_id+'" '+props+'></div>';var targetElement=$(_id);var cond=element.getAttribute('cond');var ok=src;if(ok&&cond&&cond!='true')
|
2575
|
+
{var scope=Object.copy({},controller);ok=Object.evalWithinScope(cond,scope);}
|
2576
|
+
element.style.display='';$D(this.toString(),'Seamless '+element.id+'('+element.nodeName+') cond:'+cond+', ok: '+ok);if(ok)
|
2577
|
+
{$D(this.toString(),'fixing seamless src at '+element.id+'('+element.nodeName+'), src:'+src);var uri=Seamless.evaluateTemplateURI(src);$D(this.toString(),'calling loadURL: '+element.id+'('+element.nodeName+'), URI: '+uri);Seamless.load(targetElement,controller,uri);}
|
2578
|
+
Seamless.setupBindAction(element,controller,'onBindMessage',function(element,attribute,type,msg,datatype,direction,controller)
|
2579
|
+
{var prop=element.getAttribute(attribute+'Property')||element.name||element.id;var obj=Object.getNestedProperty(msg,prop);obj=obj!=null?obj:(typeof(msg)=='string')?msg:null;var newsrc=Seamless.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,direction,controller);if(newsrc)
|
2580
|
+
{element.innerHTML='<div id="'+_id+'" '+props+'></div>';targetElement=$(_id);Seamless.load(targetElement,controller,newsrc);}});};Seamless.registerWidgetBuilder('content',SeamlessWidget_Content);var SeamlessWidget_DataModel=new SeamlessWidget();SeamlessWidget_DataModel.build=function(element,controller)
|
2581
|
+
{var message=element.getAttribute('message');if(!message)
|
2582
|
+
{Logger.error("error loading data model widget, missing required 'message' attribute");return false;}
|
2583
|
+
var args=String.unescapeXML(element.getAttribute('args'));var initialCond=element.getAttribute('cond');var onBindMessage=element.getAttribute('onBindMessage');if(onBindMessage)
|
2584
|
+
{Seamless.setupBindAction(element,controller,'onBindMessage',function(element,attribute,type,data,datatype,direction,controller)
|
2585
|
+
{if(args)
|
2586
|
+
{var scope=Object.copy({},data);scope=Object.copy(scope,controller);data=Object.evalWithinScope(args,scope);}
|
2587
|
+
var msg={type:message,data:data};hakano.util.MessageBroker.queue(msg);});}
|
2588
|
+
if(initialCond)
|
2589
|
+
{var cond=Object.evalWithinScope(initialCond,controller);if(!cond)
|
2590
|
+
{return;}}
|
2591
|
+
var data={};if(args)
|
2592
|
+
{data=Object.evalWithinScope(args,controller);}
|
2593
|
+
else
|
2594
|
+
{var text=hakano.util.Dom.getText(element)||'';var t=text.trim();if(t.match(/^\{.*\}$/))
|
2595
|
+
{data=eval('('+t+')');}}
|
2596
|
+
var msg={type:message,data:data};hakano.util.MessageBroker.queue(msg);return true;};Seamless.registerWidgetBuilder('datamodel',SeamlessWidget_DataModel);var SeamlessWidget_DynamicSearch=new SeamlessWidget();SeamlessWidget_DynamicSearch.build=function(element,controller)
|
2597
|
+
{var form=document.createElement('form');var html='<input type="text" id="_'+element.id+'" ';html+=hakano.util.Dom.getAttributesString(element,['autocomplete','id','widget','progressid','onbindmessagerequest','onbindmessageresponse','searchkey','onbindmessageclear','onbindmessageclearcond','value']);html+='/>';form.innerHTML=html;var progressId=element.getAttribute("progressId");var request=element.getAttribute("onBindMessageRequest");var response=element.getAttribute("onBindMessageResponse");var key=element.getAttribute("searchKey");element.parentNode.replaceChild(form,element);var id=element.id;var i=$('_'+id);i.id=id;var search=new SeamlessSearch(id,progressId,null,{onBindMessageRequest:request,onBindMessageResponse:response,onBindMessageSearchKey:key});i.style.display='';Seamless.wire(form,controller,true,true);Seamless.addTrash(element,controller,function()
|
2598
|
+
{search.destroy();});Seamless.setupBindAction(element,controller,'onBindMessageClear',function(element,attribute,type,data,datatype,direction,controller)
|
2599
|
+
{i.value='';Field.activate(i);});return true;};Seamless.registerWidgetBuilder('dynamic-search',SeamlessWidget_DynamicSearch);var SeamlessWidget_EditInPlace=new SeamlessWidget();SeamlessWidget_EditInPlace.build=function(element,controller)
|
2600
|
+
{var fieldsetName=element.getAttribute("fieldset");if(fieldsetName!=null)
|
2601
|
+
{var fs=Seamless.loadFieldSet(element,fieldsetName,true);var field=new Editablefield();var id=Seamless.createUniqueId(element);field.setViewElementId(fieldsetName+"_view_"+id);field.setEditParentElementId(fieldsetName+"_edit_parent_"+id);field.setEditElementId(fieldsetName+"_edit_"+id);element.style.display="block";var seamless=element.cloneNode(false);seamless.id=field.getViewElementId();seamless.style.padding=(element.getAttribute("viewPadding")||"");seamless.className=(element.getAttribute("viewclass")||"");var divid=element.id;var newdiv='<div id="'+divid+'"></div>';element.id=element.id+"_parent_old";Seamless.addBindMessageHandler(seamless,controller);var editHTML=document.createElement("div");editHTML.id=field.getEditParentElementId();new Insertion.After(element,newdiv);newdiv=$(divid);newdiv.appendChild(seamless);newdiv.appendChild(editHTML);$(field.getEditParentElementId()).style.display="none";field.setValidator(element.getAttribute("validator"));field.setDecorator(element.getAttribute("decorator"));field.setType(element.getAttribute("type"));field.setName(element.getAttribute("name"));field.setPopulator(element.getAttribute("populator"));field.setViewClass(element.getAttribute("viewclass"));field.setLength(element.getAttribute("length"));field.setOnBindMessageProperty(element.getAttribute("onBindMessageProperty"));field.setRows(element.getAttribute("rows"));field.setCols(element.getAttribute("cols"));field.setInputClass(element.getAttribute("inputClass"));fs.addField(field);var widget=$(seamless.id);widget.widget=field;return true;}
|
2602
|
+
return false;};SeamlessWidget_EditInPlace.onBind=function(element,attribute,type,msg,datatype,direction,controller)
|
2603
|
+
{var prop=element.getAttribute("onBindMessageProperty");var obj=Object.getNestedProperty(msg,prop);element.innerHTML=Seamless.evaluateBindMessageExpression(element,attribute,obj,type,msg,datatype,controller);};Seamless.registerWidgetBuilder('editinplace',SeamlessWidget_EditInPlace);var SeamlessWidget_iterator=new SeamlessWidget();var PROPS=['left','right','width','top','bottom','display','visibility','border','color','border-top','border-left','border-bottom','overflow','height','background','background-color','border-right'];SeamlessWidget_iterator.build=function(element,controller)
|
2604
|
+
{try
|
2605
|
+
{var id=element.id;var display=element.originaldisplay;element.id=element.id+"_parent";var template=HAKANO.isIE?element.innerHTML:hakano.util.Dom.getText(element);var container=null;var wire=element.getAttribute('wire')=='true';var rowEvenClassName=element.getAttribute('rowEvenClassName');var rowOddClassName=element.getAttribute('rowOddClassName');function copyStyles(sourceElement,targetElement)
|
2606
|
+
{PROPS.each(function(name){targetElement.style[name]=sourceElement.style[name]});}
|
2607
|
+
Seamless.setupBindAction(element,controller,'onBindMessage',function(element,attribute,type,data,datatype,direction)
|
2608
|
+
{var html=''
|
2609
|
+
var propertyName=element.getAttribute(attribute+'Property');var array=Object.getNestedProperty(data,propertyName);for(var c=0;c<array.length;c++)
|
2610
|
+
{html+=template.gsub(Template.Pattern,function(match)
|
2611
|
+
{var before=match[1];if(before=='\\')return match[2];var value=Object.getNestedProperty(array[c],match[3]);return before+(value==null?'':value.toString());});}
|
2612
|
+
html=html.gsub(/html:/i,function(match)
|
2613
|
+
{return match[1]+match[3];});container.innerHTML=html;var c=0;for(var i=0;i<container.childNodes.length;i++)
|
2614
|
+
{if(container.childNodes[i].nodeType==hakano.util.Dom.ELEMENT_NODE)
|
2615
|
+
{container.childNodes[i].style.display='';if((c%2)==0)
|
2616
|
+
{if(rowEvenClassName)Element.addClassName(container.childNodes[i],rowEvenClassName);}
|
2617
|
+
else
|
2618
|
+
{if(rowOddClassName)Element.addClassName(container.childNodes[i],rowOddClassName);}
|
2619
|
+
c++;}}
|
2620
|
+
if(wire)
|
2621
|
+
{Seamless.wire(container,controller,false,true);}});var div=document.createElement('div');new Insertion.After(element,'<div id="'+id+'"></div>');container=$(id);copyStyles(element,container);container.style.display=display;}
|
2622
|
+
catch(e)
|
2623
|
+
{alert('exception:'+e+" -- "+Object.getExceptionDetail(e));}};Seamless.registerWidgetBuilder('iterator',SeamlessWidget_iterator);var IS_FIREFOX=navigator.userAgent.match(/Firefox/i);var SeamlessWidget_ModalDialog=new SeamlessWidget();SeamlessWidget_ModalDialog.build=function(element,controller)
|
2624
|
+
{element.style.display='none';var viewId=element.getAttribute('viewId');var acceptText=element.getAttribute('acceptText');var cancelText=element.getAttribute('cancelText');var onCancelMessage=element.getAttribute('onCancelMessage');var onCancelMessageArgs=element.getAttribute('onCancelMessageArgs')||'{}';var onAcceptMessage=element.getAttribute('onAcceptMessage');var onAcceptMessageArgs=element.getAttribute('onAcceptMessageArgs')||'{}';var width=element.getAttribute('width');var height=element.getAttribute('height');var top=element.getAttribute('top');var viewURL=element.getAttribute('viewURL');var autohide='true'==(element.getAttribute('onAcceptAutoHide')||'true');var autodisable='true'==(element.getAttribute('onAcceptDisable')||'false');var fieldsetName=element.getAttribute('fieldset');var tokens=onAcceptMessage?onAcceptMessage.split(':'):null;var direction=tokens&&tokens.length==2?tokens[0]:'local';var actionValidatorDecoratorId=element.getAttribute('actionValidatorDecoratorId');var activators=element.getAttribute('activators');var activatorValidator=Seamless.getActionValidator(element,controller);var options=null;var focusElement=element.getAttribute('focus');var hideButtons=element.getAttribute('hideButtons')||'false';var backgroundColor=element.getAttribute('backgroundColor')||'#fff';if(viewURL)
|
2625
|
+
{var uri=Seamless.evaluateTemplateURI(viewURL);var prefetch=element.getAttribute('prefetch')||'true';if(prefetch=='true')
|
2626
|
+
{Seamless.queuePrefetch(uri);}}
|
2627
|
+
Seamless.setupBindAction(element,controller,'onHideMessage',function(element,attribute,type,data,datatype,direction,controller)
|
2628
|
+
{ModalDialog.hide();if(options)
|
2629
|
+
{options['trash'].each(function(f)
|
2630
|
+
{f();});options=null;}});Seamless.setupBindAction(element,controller,'onBindMessage',function(element,attribute,type,data,datatype,dir,controller)
|
2631
|
+
{var html=viewURL?'<img src="'+HAKANO.ImagePath+'/indicator.gif"/> Loading...':$(viewId).innerHTML;options={trash:[],autohide:autohide,autodisable:autodisable};if(acceptText)
|
2632
|
+
{options['acceptText']=acceptText;}
|
2633
|
+
if(cancelText)
|
2634
|
+
{options['cancelText']=cancelText;}
|
2635
|
+
if(width)
|
2636
|
+
{options['width']=parseInt(width);}
|
2637
|
+
if(height)
|
2638
|
+
{options['height']=parseInt(height);}
|
2639
|
+
if(top)
|
2640
|
+
{options['top']=parseInt(top);}
|
2641
|
+
options['hideButtons']=hideButtons;options['backgroundColor']=backgroundColor;if(onAcceptMessage)
|
2642
|
+
{options['onAccept']=function()
|
2643
|
+
{var scope=Object.copy({},controller);var args=Object.evalWithinScope(onAcceptMessageArgs,scope);args=Seamless.getFieldSetValues(fieldsetName,args,direction);hakano.util.MessageBroker.queue({type:onAcceptMessage,data:args});};}
|
2644
|
+
else
|
2645
|
+
{options['onAccept']=function()
|
2646
|
+
{options['trash'].each(function(f)
|
2647
|
+
{f();});};}
|
2648
|
+
if(onCancelMessage)
|
2649
|
+
{options['onCancel']=function()
|
2650
|
+
{var scope=Object.copy({},controller);var args=Object.evalWithinScope(onCancelMessageArgs,scope);hakano.util.MessageBroker.queue({type:onCancelMessage,data:args});options['trash'].each(function(f)
|
2651
|
+
{f();});};}
|
2652
|
+
else
|
2653
|
+
{options['onCancel']=function()
|
2654
|
+
{options['trash'].each(function(f)
|
2655
|
+
{f();});};}
|
2656
|
+
if(viewURL)
|
2657
|
+
{options['onRender']=function(canvas)
|
2658
|
+
{var button=ModalDialog.getAcceptButton();Seamless.loadURL(canvas,controller,uri,{onSuccess:function(resp,elem)
|
2659
|
+
{if(IS_FIREFOX)
|
2660
|
+
{while(elem)
|
2661
|
+
{if(elem.nodeType==hakano.util.Dom.ELEMENT_NODE)
|
2662
|
+
{elem.parentNode.style.overflow='auto';break;}
|
2663
|
+
elem=elem.parentNode;}}
|
2664
|
+
if(focusElement)
|
2665
|
+
{var focus=$(focusElement);if(focus)
|
2666
|
+
{focus.focus();}}
|
2667
|
+
var bindChangeHandler=Seamless.getBindChangeHandler(button);Seamless.createActivatorsFor(button,controller,activatorValidator,activators,actionValidatorDecoratorId,bindChangeHandler,options['trash']);}});};}
|
2668
|
+
else
|
2669
|
+
{options['onRender']=function(canvas)
|
2670
|
+
{if(IS_FIREFOX)
|
2671
|
+
{for(var c=0;c<canvas.childNodes.length;c++)
|
2672
|
+
{var elem=canvas[c];if(elem.nodeType==hakano.util.Dom.ELEMENT_NODE)
|
2673
|
+
{elem.style.overflow='auto';break;}}}
|
2674
|
+
if(focusElement)
|
2675
|
+
{var focus=$(focusElement);if(focus)
|
2676
|
+
{focus.focus();}}
|
2677
|
+
var button=ModalDialog.getAcceptButton();var bindChangeHandler=Seamless.getBindChangeHandler(button);Seamless.createActivatorsFor(button,controller,activatorValidator,activators,actionValidatorDecoratorId,bindChangeHandler,options['trash']);};}
|
2678
|
+
ModalDialog.show(html,options);});};Seamless.registerWidgetBuilder('modaldialog',SeamlessWidget_ModalDialog);var SeamlessWidget_ProgressBar=new SeamlessWidget();SeamlessWidget_ProgressBar.build=function(element,controller)
|
2679
|
+
{var total=100;var marginSize=parseInt(hakano.util.Dom.getAndRemoveAttribute(element,'spacerWidth')||'1');var marginTotal=marginSize*total;var onColor=hakano.util.Dom.getAndRemoveAttribute(element,'onColor')||'#00f';var offColor=hakano.util.Dom.getAndRemoveAttribute(element,'offColor')||'#eee';var id='_'+element.id;var html='<div id="'+id+'" ';html+=hakano.util.Dom.getAttributesString(element,['id','widget']);html+='></div>';new Insertion.After(element,html);Seamless.zap(element);var _w=$(id);_w.id=element.id;_w.style.position='relative';_w.style.margin='0';_w.style.padding='0';_w.style.display='';var p=Element.findNonShowingAncestor(_w);if(p)
|
2680
|
+
{p.style.display='';}
|
2681
|
+
var barWidth=Math.max(_w.offsetWidth,parseInt(_w.style.width));if(isNaN(barWidth))
|
2682
|
+
{p=_w.parentNode;barWidth=p.offsetWidth;while(isNaN(barWidth))
|
2683
|
+
{barWidth=p.offsetWidth;p=p.parentNode;if(!p||!isNaN(barWidth))break;}}
|
2684
|
+
var sizeEach=Math.round((barWidth-marginTotal)/total);_w.style.width=(sizeEach+marginSize)*total+'px';if(p)
|
2685
|
+
{p.style.display='none';}
|
2686
|
+
var statusId=element.getAttribute('statusId');var startPercent=statusId?parseInt(element.getAttribute('statusStart')||'30'):null;var startTS=0;var statusDiv=statusId?$(statusId):null;var statusMsg=statusDiv?statusDiv.innerHTML:null;var prop=element.getAttribute('onBindMessageProperty');var resetOnComplete=element.getAttribute('resetOnComplete')||'true';var lastTS=0;var complete=false;var currentAmt=0;Seamless.setupBindAction(_w,controller,'onBindMessageClear',function()
|
2687
|
+
{element.innerHTML='';var statusTS=0;currentAmt=0;if(statusDiv)
|
2688
|
+
{statusDiv.innerHTML=statusMsg||'';}});Seamless.setupBindAction(_w,controller,'onBindMessage',function(element,attribute,type,data,datatype,direction,controller)
|
2689
|
+
{var percent=Object.getNestedProperty(data,prop)||data;if(percent)
|
2690
|
+
{if(typeof(percent)=='string')
|
2691
|
+
{if(percent=='1')
|
2692
|
+
{percent=1.0;}
|
2693
|
+
else
|
2694
|
+
{percent=parseFloat(percent);}}
|
2695
|
+
if(percent<=1.0)
|
2696
|
+
{percent=percent*100;}
|
2697
|
+
$D('received progress bar update of '+percent);var prevTS=lastTS;lastTS=new Date().getTime();if(statusDiv&&((percent==0&&complete)||(startTS==0&&percent<100)||(percent<100&&prevTS>0&&lastTS-prevTS>30000)))
|
2698
|
+
{startTS=lastTS;complete=false;}
|
2699
|
+
if(statusDiv&&percent>=startPercent&&percent<100&&startTS>0)
|
2700
|
+
{var taken=new Date().getTime()-startTS;var remainingPercent=Math.min(100,Math.max(0,100-percent));var avgTime=taken/percent;var guesstimate=avgTime*remainingPercent;if(guesstimate>0)
|
2701
|
+
{if(currentAmt!=0&¤tAmt<guesstimate)
|
2702
|
+
{guesstimate=currentAmt-1000;}
|
2703
|
+
var time=Math.round(guesstimate/1000);if(time>0)
|
2704
|
+
{statusDiv.innerHTML='Estimated '+time+' seconds to complete, '+Math.round(remainingPercent)+'% remaining, '+Math.round(taken/1000)+' seconds taken so far...';}
|
2705
|
+
else if(remainingPercent>=100)
|
2706
|
+
{statusDiv.innerHTML=element.getAttribute('completeMessage')||'Completed!';}
|
2707
|
+
currentAmt=guesstimate;}}
|
2708
|
+
var html='';var amt=Math.min(100,Math.round(percent));var offset=0;for(var c=0;c<total;c++)
|
2709
|
+
{var span='<span style="border:none;margin:0;padding:0;position:absolute;top:0;bottom:0;background-color:';var on=(c<=amt);span+=(on?onColor:offColor)+';width:'+Math.round(sizeEach)+'px;left:'+Math.round(offset)+'px;';span+='"> </span>';html+=span;offset+=sizeEach+marginSize;}
|
2710
|
+
if(percent>=100)
|
2711
|
+
{startTS=0;currentAmt=0;complete=true;statusDiv.innerHTML=element.getAttribute('completeMessage')||'Completed!';var complete=element.getAttribute('onBindChangeMessage');if(complete)
|
2712
|
+
{hakano.util.MessageBroker.queue({'type':complete,'data':{'id':element.id}});}
|
2713
|
+
if(resetOnComplete=='true')
|
2714
|
+
{setTimeout(function()
|
2715
|
+
{element.innerHTML='';if(statusDiv)
|
2716
|
+
{statusDiv.innerHTML=statusMsg;}},2000);}}
|
2717
|
+
element.innerHTML=html;Element.show(element);}});_w.removeAttribute('onBindMessage');_w.removeAttribute('onBindMessageProperty');_w.removeAttribute('onBindMessageClear');Seamless.addBindMessageHandler(_w,controller);return true;};Seamless.registerWidgetBuilder('progressbar',SeamlessWidget_ProgressBar);var SeamlessWidget_Rebroadcaster=new SeamlessWidget();SeamlessWidget_Rebroadcaster.build=function(element,controller)
|
2718
|
+
{var message=element.getAttribute('message');if(message)
|
2719
|
+
{var args=element.getAttribute('args');Seamless.setupBindAction(element,controller,'onBindMessage',function(element,attribute,type,data,datatype,direction,controller)
|
2720
|
+
{var obj={};if(args)
|
2721
|
+
{obj=Seamless.createMessageObject(type,data,datatype,direction,controller);obj=Object.evalWithinScope(String.unescapeXML(args),obj);}
|
2722
|
+
hakano.util.MessageBroker.queue({type:message,data:obj});});return true;}
|
2723
|
+
return false;};Seamless.registerWidgetBuilder('rebroadcaster',SeamlessWidget_Rebroadcaster);var SeamlessWidget_Script=new SeamlessWidget();SeamlessWidget_Script.getAttribute=function(element,name)
|
2724
|
+
{var value=element.getAttribute(name);return(value=='')?null:String.unescapeXML(value);};SeamlessWidget_Script.build=function(element,controller)
|
2725
|
+
{element.style.display='none';element.style.position='absolute';element.style.top='-100px';element.style.left='-250px';try
|
2726
|
+
{var id=element.id;var msg=SeamlessWidget_Script.getAttribute(element,'message')||SeamlessWidget_Script.getAttribute(element,'onBindMessage');var cond=SeamlessWidget_Script.getAttribute(element,'cond')||SeamlessWidget_Script.getAttribute(element,'onBindMessageCond')||'true';var delay=SeamlessWidget_Script.getAttribute(element,'onBindMessageDelay')||'0';delay=parseInt(delay);var script=hakano.util.Dom.getText(element);var widget=element;$D(this+' - created script widget at: '+id+' for message: '+msg);var code=script.toFunction(true);var cond_func=Seamless.createMessageCondition(cond);if(msg)
|
2727
|
+
{msg.split(',').each(function(m)
|
2728
|
+
{var listener={toString:function()
|
2729
|
+
{if(!this._toString)
|
2730
|
+
{this._toString='[Seamless@Script@'+id+']';}
|
2731
|
+
return this._toString;},accept:function(type)
|
2732
|
+
{return[m];},invoke:function(type,data,datatype,direction)
|
2733
|
+
{var obj=Seamless.createMessageObject(type,data,datatype,direction);var outcome=cond_func.call(obj);if(outcome)
|
2734
|
+
{code.call(obj);}},onMessage:function(type,data,datatype,direction)
|
2735
|
+
{if(delay>0)
|
2736
|
+
{var self=this;setTimeout(function()
|
2737
|
+
{self.invoke.apply(self,[type,data,datatype,direction]);},delay);}
|
2738
|
+
else
|
2739
|
+
{this.invoke(type,data,datatype,direction);}}};Seamless.addMessageBrokerListener(controller,listener);Seamless.addTrash(widget,controller,function(destroyall)
|
2740
|
+
{hakano.util.MessageBroker.removeListener(listener);});});}
|
2741
|
+
else
|
2742
|
+
{if(cond_func.call(window))
|
2743
|
+
{code.call(window);}}}
|
2744
|
+
catch(e)
|
2745
|
+
{Logger.error(this+' error: '+e);}
|
2746
|
+
return true;};Seamless.registerWidgetBuilder('script',SeamlessWidget_Script);function _HAKANO_initializePage()
|
2747
|
+
{$D('[HAKANO] starting Seamless load');document.body.style.visibility='hidden';document.body.style.cursor='wait';var startTS=new Date().getTime();window.siteLoadedObservers.each(function(f)
|
2748
|
+
{try
|
2749
|
+
{f();}
|
2750
|
+
catch(e)
|
2751
|
+
{alert('Exception running: '+f+'\n\nException:'+Object.getExceptionDetail(e));}});window.siteLoadedObservers=null;Seamless.wire(document.body,window,true,true);var delay=new Date().getTime()-startTS;Logger.info('[HAKANO] Seamless Web Toolkit loaded in '+delay+' ms, site is ready. Cheers!');document.body.style.cursor='';document.body.style.visibility='visible';}
|
2752
|
+
function _HAKANO_uninitializePage()
|
2753
|
+
{$D('[HAKANO] site is being unloaded, calling Seamless.destroy');var array=window.siteUnloadedObservers;var doc=document.body;doc.style.display='none';var startTS=new Date().getTime();Seamless.destroyAll();var endTS=new Date().getTime();$D('[HAKANO] Seamless is dead ('+(endTS-startTS)+' ms), calling window.siteUnloadedObservers');array.each(function(f)
|
2754
|
+
{f();});array=null;var delay=new Date().getTime()-startTS;$D('[HAKANO] site finished, bye! ('+(new Date().getTime()-endTS)+' ms unloaded, '+delay+' ms total)');}
|
2755
|
+
Event.observe(window,'load',_HAKANO_initializePage,false);Event.observe(window,'unload',_HAKANO_uninitializePage,false);
|