responseText);EJS.prototype.update.call(_template,element,object)},EJS.ajax_request(params)):element.innerHTML=this.render(options)},out:function(){return this.template.out},set_options:function(e){this.type=e.type||EJS.type,this.cache=e.cache!=null?e.cache:EJS.cache,this.text=e.text||null,this.name=e.name||null,this.ext=e.ext||EJS.ext,this.extMatch=new RegExp(this.ext.replace(/\./,"."))}},EJS.endExt=function(e,t){return e?(t.lastIndex=0,e+(t.test(e)?"":this.ext)):null},EJS.Scanner=function(e,t,n){extend(this,{left_delimiter:t+"%",right_delimiter:"%"+n,double_left:t+"%%",double_right:"%%"+n,left_equal:t+"%=",left_comment:t+"%#"}),this.SplitRegexp=t=="["?/(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/:new RegExp("("+this.double_left+")|(%%"+this.double_right+")|("+this.left_equal+")|("+this.left_comment+")|("+this.left_delimiter+")|("+this.right_delimiter+"\n)|("+this.right_delimiter+")|(\n)"),this.source=e,this.stag=null,this.lines=0},EJS.Scanner.to_text=function(e){return e==null||e===undefined?"":e instanceof Date?e.toDateString():e.toString?e.toString():""},EJS.Scanner.prototype={scan:function(e){scanline=this.scanline,regex=this.SplitRegexp;if(!this.source==""){var t=rsplit(this.source,/\n/);for(var n=0;n<t.length;n++){var r=t[n];this.scanline(r,regex,e)}}},scanline:function(e,t,n){this.lines++;var r=rsplit(e,t);for(var i=0;i<r.length;i++){var s=r[i];if(s!=null)try{n(s,this)}catch(o){throw{type:"EJS.Scanner",line:this.lines}}}}},EJS.Buffer=function(e,t){this.line=new Array,this.script="",this.pre_cmd=e,this.post_cmd=t;for(var n=0;n<this.pre_cmd.length;n++)this.push(e[n])},EJS.Buffer.prototype={push:function(e){this.line.push(e)},cr:function(){this.script=this.script+this.line.join("; "),this.line=new Array,this.script=this.script+"\n"},close:function(){if(this.line.length>0){for(var e=0;e<this.post_cmd.length;e++)this.push(pre_cmd[e]);this.script=this.script+this.line.join("; "),line=null}}},EJS.Compiler=function(e,t){this.pre_cmd=["var ___ViewO = [];"],this.post_cmd=new Array,this.source=" ",e!=null&&(typeof e=="string"?(e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n"),this.source=e):e.innerHTML&&(this.source=e.innerHTML),typeof this.source!="string"&&(this.source="")),t=t||"<";var n=">";switch(t){case"[":n="]";break;case"<":break;default:throw t+" is not a supported deliminator"}this.scanner=new EJS.Scanner(this.source,t,n),this.out=""},EJS.Compiler.prototype={compile:function(options,name){options=options||{},this.out="";var put_cmd="___ViewO.push(",insert_cmd=put_cmd,buff=new EJS.Buffer(this.pre_cmd,this.post_cmd),content="",clean=function(e){return e=e.replace(/\\/g,"\\\\"),e=e.replace(/\n/g,"\\n"),e=e.replace(/"/g,'\\"'),e};this.scanner.scan(function(e,t){if(t.stag==null)switch(e){case"\n":content+="\n",buff.push(put_cmd+'"'+clean(content)+'");'),buff.cr(),content="";break;case t.left_delimiter:case t.left_equal:case t.left_comment:t.stag=e,content.length>0&&buff.push(put_cmd+'"'+clean(content)+'")'),content="";break;case t.double_left:content+=t.left_delimiter;break;default:content+=e}else switch(e){case t.right_delimiter:switch(t.stag){case t.left_delimiter:content[content.length-1]=="\n"?(content=chop(content),buff.push(content),buff.cr()):buff.push(content);break;case t.left_equal:buff.push(insert_cmd+"(EJS.Scanner.to_text("+content+")))")}t.stag=null,content="";break;case t.double_right:content+=t.right_delimiter;break;default:content+=e}}),content.length>0&&buff.push(put_cmd+'"'+clean(content)+'")'),buff.close(),this.out=buff.script+";";var to_be_evaled="/*"+name+"*/this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {"+this.out+" return ___ViewO.join('');}}}catch(e){e.lineNumber=null;throw e;}};";try{eval(to_be_evaled)}catch(e){if(typeof JSLINT=="undefined")throw e;JSLINT(this.out);for(var i=0;i<JSLINT.errors.length;i++){var error=JSLINT.errors[i];if(error.reason!="Unnecessary semicolon."){error.line++;var e=new Error;throw e.lineNumber=error.line,e.message=error.reason,options.view&&(e.fileName=options.view),e}}}}},EJS.config=function(e){EJS.cache=e.cache!=null?e.cache:EJS.cache,EJS.type=e.type!=null?e.type:EJS.type,EJS.ext=e.ext!=null?e.ext:EJS.ext;var t=EJS.templates_directory||{};EJS.templates_directory=t,EJS.get=function(e,n){return n==0?null:t[e]?t[e]:null},EJS.update=function(e,n){if(e==null)return;t[e]=n},EJS.INVALID_PATH=-1},EJS.config({cache:!0,type:"<",ext:".ejs"}),EJS.Helpers=function(e,t){this._data=e,this._extras=t,extend(this,t)},EJS.Helpers.prototype={view:function(e,t,n){return n||(n=this._extras),t||(t=this._data),(new EJS(e)).render(t,n)},to_text:function(e,t){return e==null||e===undefined?t||"":e instanceof Date?e.toDateString():e.toString?e.toString().replace(/\n/g,"<br />").replace(/''/g,"'"):""}},EJS.newRequest=function(){var e=[function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new XMLHttpRequest},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];for(var t=0;t<e.length;t++)try{var n=e[t]();if(n!=null)return n}catch(r){continue}},EJS.request=function(e){var t=new EJS.newRequest;t.open("GET",e,!1);try{t.send(null)}catch(n){return null}return t.status==404||t.status==2||t.status==0&&t.responseText==""?null:t.responseText},EJS.ajax_request=function(e){e.method=e.method?e.method:"GET";var t=new EJS.newRequest;t.onreadystatechange=function(){t.readyState==4&&(t.status==200?e.onComplete(t):e.onComplete(t))},t.open(e.method,e.url),t.send(null)}})(),EJS.Helpers.prototype.date_tag=function(e,t,n){t instanceof Date||(t=new Date);var r=["January","February","March","April","May","June","July","August","September","October","November","December"],i=[],s=[],o=[],u=t.getFullYear(),a=t.getMonth(),f=t.getDate();for(var l=u-15;l<u+15;l++)i.push({value:l,text:l});for(var c=0;c<12;c++)s.push({value:c,text:r[c]});for(var h=0;h<31;h++)o.push({value:h+1,text:h+1});var p=this.select_tag(e+"[year]",u,i,{id:e+"[year]"}),d=this.select_tag(e+"[month]",a,s,{id:e+"[month]"}),v=this.select_tag(e+"[day]",f,o,{id:e+"[day]"});return p+d+v},EJS.Helpers.prototype.form_tag=function(e,t){return t=t||{},t.action=e,t.multipart==1&&(t.method="post",t.enctype="multipart/form-data"),this.

Prev | Next
Pg.: 1 2 3 4 5 6 7 8 ... 11


Back to home | File page

Subscribe | Register | Login | N