// Copyright (c) 2008 Synology Inc. All rights reserved.
Ext.namespace("SYNOBLOG_UTILS");Ext.Ajax.on("requestcomplete",function(_1,_2,_3){if(SYNOBLOG_UTILS.checkServerError(_2)){_1.purgeListeners();}});SYNOBLOG_UTILS.SetTextMaxLen=function(_4,_5,_6){var _7=_4.findField(_5);if(_7){_7.getEl().dom.setAttribute("maxLength",_6);}};SYNOBLOG_UTILS.checkServerError=function(_8){if(_8&&_8.getResponseHeader){var _9=_8.getResponseHeader["x-request-error"];if(_9){_9=Ext.util.Format.trim(_9);var _a=blog_str_common_system_error;if(_9=="error_timeout"){_a=blog_str_common_session_timeout;}alert(_a);var _b=window.location.href;if(_b.indexOf("/blog")>=0){window.location="/blog/index.php";}else{window.location="/photo/index.php";}return true;}}return false;};SYNOBLOG_UTILS.arrayFindIndex=function(_c,_d){var i,_f=-1;for(i in _c){if(_c[i]==_d){_f=i;break;}}return _f;};Ext.form.SRadio=function(cfg){if(cfg.indent&&cfg.indent>0){var _11=13*cfg.indent;var _12=String.format("display: inline;width:{0}px;",_11);cfg.labelStyle=_12;cfg.labelSeparator="";}Ext.form.SRadio.superclass.constructor.apply(this,arguments);};Ext.extend(Ext.form.SRadio,Ext.form.Radio,{setValue:function(v){var _14=this.el.up("form").query("input[name="+this.el.dom.name+"]");if(typeof v=="string"){for(var j=0;j<_14.length;j++){var _16=Ext.getCmp(_14[j].id);if(_14[j].value==v){_14[j].checked=true;}else{_14[j].checked=false;}_16.checked=_14[j].checked;_16.fireEvent("check",_16,_16.checked);}}else{if(typeof v=="boolean"){if(v===true){this.setValue(this.el.dom.value);}}}},onClick:function(){if(this.el.dom.checked!=this.checked){this.setValue(this.el.dom.value);}}});Ext.namespace("SYNOBLOG_COLUMN_CENTRAL");SYNOBLOG_COLUMN_CENTRAL=function(){this.addEvents({article_update:true,comment_update:true,autosave_update:true});};Ext.extend(SYNOBLOG_COLUMN_CENTRAL,Ext.util.Observable);SYNOBLOG_COLUMN_CENTRAL.instance=function(){return SYNOBLOG_COLUMN_CENTRAL._inst;};SYNOBLOG_COLUMN_CENTRAL._inst=new SYNOBLOG_COLUMN_CENTRAL();SYNOBLOG_COLUMN_CENTRAL.deleteArticle=function(_1){Ext.MessageBox.confirm(blog_str_article_delete,blog_str_article_delete_info+" "+blog_str_article_delete_confirm,showResult);function showResult(_2){if(_2=="yes"){var _3={action:"delete_article",article_id:_1};Ext.Ajax.request({url:"include/article.php",params:_3,method:"POST",scope:this,success:function(_4,_5){if(_4.responseText!="0"){onNavigate("page_1");}else{alert(blog_str_common_system_error);}var _6=SYNOBLOG_COLUMN_CENTRAL.instance();_6.fireEvent("article_update");}});}}};SYNOBLOG_COLUMN_CENTRAL.deleteComment=function(_7,_8){Ext.MessageBox.confirm(blog_str_comment_delete,blog_str_comment_delete_confirm,showResult);function showResult(_9){if(_9=="yes"){var _a={action:"delete_comment",comment_id:_7};Ext.Ajax.request({url:"include/comment.php",params:_a,method:"POST",scope:this,success:function(_b,_c){if(_b.responseText=="0"){alert(blog_str_common_system_error);}else{SYNOBLOG_COLUMN_CENTRAL.showWholeArticle(_8);}var _d=SYNOBLOG_COLUMN_CENTRAL.instance();_d.fireEvent("comment_update");}});}}};SYNOBLOG_COLUMN_CENTRAL.deleteAllAutosave=function(){Ext.MessageBox.confirm(blog_str_article_delete_all_autosave,blog_str_article_delete_all_autosave_confirm,showResult);function showResult(_e){if(_e=="yes"){var _f={action:"delete_allautosave"};Ext.Ajax.request({url:"include/article.php",params:_f,method:"POST",scope:this,success:function(res,_11){if(res.responseText!="0"){onNavigate("page_1");}else{alert(blog_str_common_system_error);}var _12=SYNOBLOG_COLUMN_CENTRAL.instance();_12.fireEvent("autosave_update");}});}}};SYNOBLOG_COLUMN_CENTRAL.showWholeArticle=function(_13,_14){var el=Ext.get("column_central");var mgr=el.getUpdateManager();mgr.update("include/article.php",{id:_13,input_key:_14});window.scrollTo(0,0);};SYNOBLOG_COLUMN_CENTRAL.showAbstract=function(_17){var el=Ext.get("column_central");var mgr=el.getUpdateManager();mgr.update("include/article.php",{action:"show_abstract",page:_17});window.scrollTo(0,0);};SYNOBLOG_COLUMN_CENTRAL.showDraftList=function(){var el=Ext.get("column_central");var mgr=el.getUpdateManager();mgr.update("include/article.php",{list_type:"draft"});window.scrollTo(0,0);};SYNOBLOG_COLUMN_CENTRAL.showAutosaveList=function(){var el=Ext.get("column_central");var mgr=el.getUpdateManager();mgr.update("include/article.php",{list_type:"autosave"});window.scrollTo(0,0);};SYNOBLOG_COLUMN_CENTRAL.showDateList=function(_1e){var el=Ext.get("column_central");var mgr=el.getUpdateManager();mgr.update("include/article.php",{list_type:"date",value:_1e});window.scrollTo(0,0);};SYNOBLOG_COLUMN_CENTRAL.showLabelList=function(_21){var el=Ext.get("column_central");var mgr=el.getUpdateManager();mgr.update("include/article.php",{list_type:"label",value:_21});window.scrollTo(0,0);};SYNOBLOG_COLUMN_CENTRAL.showSearchResult=function(_24){if(_24==null||_24==""){return;}var el=Ext.get("column_central");var mgr=el.getUpdateManager();mgr.update("modules/search.php",{action:"search",key:_24});window.scrollTo(0,0);};SYNOBLOG_COLUMN_CENTRAL.setStickyArticle=function(_27){var _28={action:"setStickyArticle",module_name:"main",config_key:"sticky_article",config_value:_27};Ext.Ajax.request({url:"include/article.php",params:_28,method:"POST",scope:this,success:function(res,_2a){if(res.responseText!="0"){onNavigate("page_1");}else{alert(blog_str_common_system_error);}}});};SYNOBLOG_LOGINDIALOG=function(_1){config={modal:true,autoTabs:true,autoCreate:true,width:370,height:250,shadow:true,minWidth:370,minHeight:250,proxyDrag:true,closable:true,collapsible:false,center:{autoScroll:false,tabPosition:"top",closeOnTab:true,titlebar:false,alwaysShowTabs:true}};SYNOBLOG_LOGINDIALOG.superclass.constructor.call(this,_1,config);this.addButton(blog_str_common_submit,this.onClickSubmit,this);this.addButton(blog_str_common_close,this.hide,this);this.init();this.getLayout().getRegion("center").showPanel(0);this.addKeyListener(27,this.hide,this);this.addKeyListener([10,13],this.onClickSubmit,this);};Ext.extend(SYNOBLOG_LOGINDIALOG,Ext.LayoutDialog,{form:null,messageContainer:Ext.id(),text_field_username:null,photo_url:null,isRedirectToBlog:false,init:function(){var _2=Ext.id();var _3=String.format("<div style=\"margin:20px; font-size:12px;\" id=\"{0}\">{1}</div><div style=\"margin:20px;\" id=\"{2}\"></div>",this.messageContainer,blog_str_login_desc,_2);var _4=this.getLayout();_4.beginUpdate();var cp=_4.add("center",new Ext.ContentPanel(Ext.id(),{autoCreate:true,title:blog_str_home_login,background:true}));_4.endUpdate();cp.setContent(_3);this.form=new Ext.form.Form({labelWidth:100,labelAlign:"right",buttonAlign:"right",trackResetOnLoad:true});this.text_field_username=new Ext.form.TextField({fieldLabel:blog_str_login_account,name:"username",allowBlank:false,width:170,validateOnBlur:true,validationEvent:"blur"});this.form.column({width:300},this.text_field_username,new Ext.form.TextField({fieldLabel:blog_str_login_passwd,name:"passwd",inputType:"password",width:170,validateOnBlur:true,validationEvent:"blur"}));this.form.render(_2);SYNOBLOG_UTILS.SetTextMaxLen(this.form,"username",15);SYNOBLOG_UTILS.SetTextMaxLen(this.form,"passwd",128);this.on("show",function(_6){_6.text_field_username.focus();});var el;this.form.on("actioncomplete",function(_8,_9){if(_9.result.success=="login_error"){el=Ext.get(this.messageContainer);el.dom.innerHTML="<font color='#FF0000'>"+blog_str_login_error+"</font><br>"+blog_str_login_desc;}else{if(_9.result.success=="disable_account"){el=Ext.get(this.messageContainer);el.dom.innerHTML="<font color='#FF0000'>"+blog_str_login_error_account_disable+"</font><br>"+blog_str_login_desc;}else{this.hide();var _a="/blog/index.php";if(_9.result.photo_url!=null){_a="/photo/index1.php?"+_9.result.photo_url;}else{if(!this.isRedirectToBlog){_a="/photo/index.php";}}window.location=_a;}}},this);},reset:function(){this.form.reset();var el=Ext.get(this.messageContainer);el.dom.innerHTML=blog_str_login_desc;},onClickSubmit:function(){if(this.form.isValid()){this.form.submit({url:"/blog/login.php",waitTitle:" ",waitMsg:blog_str_man_blog_header_pic_plz_wait,params:"action=login&"+this.photo_url});}},show_dialog:function(_c,_d){this.photo_url=_c;this.isRedirectToBlog=_d;this.show();}});SYNOBLOG_COMMENT_DIALOG=function(_1){config={modal:true,autoTabs:true,autoCreate:true,width:510,height:450,shadow:true,minWidth:510,minHeight:450,proxyDrag:true,closable:true,collapsible:false,center:{autoScroll:false,tabPosition:"top",closeOnTab:true,titlebar:false,alwaysShowTabs:true}};SYNOBLOG_COMMENT_DIALOG.superclass.constructor.call(this,_1,config);this.addButton(blog_str_common_submit,this.onClickSubmit,this);this.addButton(blog_str_common_close,this.hide,this);this.init();this.getLayout().getRegion("center").showPanel(0);this.addKeyListener(27,this.hide,this);this.addKeyListener([10,13],this.onClickSubmit,this);};Ext.extend(SYNOBLOG_COMMENT_DIALOG,Ext.LayoutDialog,{form:null,article_id:0,text_field_name:null,init:function(){var _2=Ext.id();var _3=String.format("<div style=\"margin:20px;\" id=\"{0}\"></div>",_2);var _4=this.getLayout();_4.beginUpdate();var cp=_4.add("center",new Ext.ContentPanel(Ext.id(),{autoCreate:true,title:blog_str_comment_give_comment,background:true}));_4.endUpdate();cp.setContent(_3);this.form=new Ext.form.Form({labelWidth:125,labelAlign:"left",buttonAlign:"right",trackResetOnLoad:true});this.text_field_name=new Ext.form.TextField({fieldLabel:blog_str_comment_name,name:"name",allowBlank:false,width:280,maxLength:16,validateOnBlur:true,validationEvent:"blur"});this.form.fieldset({legend:blog_str_comment,width:470});this.form.column({labelWidth:125,width:430},this.text_field_name,new Ext.form.TextField({fieldLabel:blog_str_comment_mail,name:"mail",width:280,maxLength:128,vtype:"email",validateOnBlur:true,validationEvent:"blur"}),new Ext.form.TextArea({fieldLabel:blog_str_comment,name:"comment",allowBlank:false,width:280,height:110,maxLength:512,validateOnBlur:true,validationEvent:"blur"}),new Ext.form.TextField({fieldLabel:blog_str_comment_magic_num,name:"magic_number",allowBlank:false,width:280,maxLength:64,validateOnBlur:true,validationEvent:"blur"}));var _6="<table><tr><td width='125'></td><td>";_6=_6+"<img id='pic_4' src='images/magic_num_0.gif' border='0'>";_6=_6+"<img id='pic_3' src='images/magic_num_0.gif' border='0'>";_6=_6+"<img id='pic_2' src='images/magic_num_0.gif' border='0'>";_6=_6+"<img id='pic_1' src='images/magic_num_0.gif' border='0'>";_6=_6+"</td></tr></table>";this.form.column({labelWidth:125,width:430,hideLabels:true},new Ext.form.MiscField({name:"magic_num_pic",id:"magic_num_pic",value:_6}));this.form.end();this.form.render(_2);SYNOBLOG_UTILS.SetTextMaxLen(this.form,"name",16);SYNOBLOG_UTILS.SetTextMaxLen(this.form,"mail",128);SYNOBLOG_UTILS.SetTextMaxLen(this.form,"comment",512);SYNOBLOG_UTILS.SetTextMaxLen(this.form,"magic_number",4);this.on("show",function(_7){_7.text_field_name.focus();_7.printMagicnumPics();});this.form.on("actioncomplete",function(_8,_9){if(_9.result.success=="wrong_key"){Ext.MessageBox.alert("",blog_str_comment_magic_num_failed);this.printMagicnumPics();this.form.findField("magic_number").setValue("");}else{this.hide();SYNOBLOG_COLUMN_CENTRAL.showWholeArticle(this.article_id);var _a=SYNOBLOG_COLUMN_CENTRAL.instance();_a.fireEvent("comment_update");}},this);},printMagicnumPics:function(){Ext.Ajax.request({url:"include/magic_number.php",params:"action=gen_rand",method:"POST",scope:this,success:function(_b,_c){var el=Ext.get("pic_4");el.dom.src="include/magic_number.php?n=4&r="+Math.random();el=Ext.get("pic_3");el.dom.src="include/magic_number.php?n=3&r="+Math.random();el=Ext.get("pic_2");el.dom.src="include/magic_number.php?n=2&r="+Math.random();el=Ext.get("pic_1");el.dom.src="include/magic_number.php?n=1&r="+Math.random();}});},reset:function(id){this.form.reset();this.article_id=id;},onClickSubmit:function(){var _f=1;if(!(this.form.isValid())){_f=0;}if(_f){var _10="action=add_comment&article_id="+this.article_id;this.form.submit({url:"include/comment.php",waitTitle:" ",waitMsg:blog_str_man_blog_header_pic_plz_wait,params:_10});}}});SYNOBLOG_MODULE=function(_1,_2){this.div_id=_1;this.hasConfigDialog=_2.hasConfigDialog;this.confDlg_width=_2.width;this.confDlg_height=_2.height;this.form=new Ext.form.Form({labelWidth:120,labelAlign:"left",buttonAlign:"right",trackResetOnLoad:true});this.form.on("actioncomplete",function(_3,_4){if(_4.result.success!=true){if(_4.result.msg!=null){Ext.MessageBox.alert("",_4.result.msg);}}this.getConfigDialogData(_4);},this);};SYNOBLOG_MODULE.prototype={div_id:"",hasConfigDialog:0,configDialog:null,form:null,init_module:function(){},updateModuleContent:function(){},showConfigDialog:function(){if(this.hasConfigDialog){if(this.configDialog==null){this.initConfigDialog();}this.configDialog.show();}else{Ext.MessageBox.alert("",blog_str_common_noconfig);}},initConfigDialog:function(){this.configDialog=new Ext.LayoutDialog(this.div_id+"_config_dlg",{modal:true,autoTabs:true,autoCreate:true,shadow:true,proxyDrag:true,closable:true,collapsible:false,width:this.confDlg_width,height:this.confDlg_height,minwidth:this.confDlg_width,minheight:this.confDlg_height,center:{autoScroll:true,tabPosition:"top",closeOnTab:true,titlebar:false,alwaysShowTabs:true}});this.configDialog.addKeyListener(27,this.configDialog.hide,this.configDialog);this.customizeConfigDialog();},customizeConfigDialog:function(){},hide:function(){if(this.configDialog){this.configDialog.hide();}},getConfigDialogData:function(_5){}};YAHOO.util.History.register("param",myModuleInitialState,myModuleStateChangeHandler);YAHOO.util.History.onLoadEvent.subscribe(function(){initHistoryManager();});function myModuleStateChangeHandler(_1){if(_1=="draft"){SYNOBLOG_COLUMN_CENTRAL.showDraftList();}else{if(_1=="autosave"){SYNOBLOG_COLUMN_CENTRAL.showAutosaveList();}else{if(_1.indexOf("page_")==0){SYNOBLOG_COLUMN_CENTRAL.showAbstract(_1.replace("page_",""),"");}else{if(_1.indexOf("id_")==0){SYNOBLOG_COLUMN_CENTRAL.showWholeArticle(_1.replace("id_",""),"");}else{if(_1.indexOf("label_")==0){SYNOBLOG_COLUMN_CENTRAL.showLabelList(_1.replace("label_",""));}else{if(_1.indexOf("date_")==0){SYNOBLOG_COLUMN_CENTRAL.showDateList(_1.replace("date_",""));}else{if(_1.indexOf("search_")==0){SYNOBLOG_COLUMN_CENTRAL.showSearchResult(_1.replace("search_",""));}}}}}}}}function initHistoryManager(){var _2=YAHOO.util.History.getQueryStringParameter("id");if(_2==null||_2==""){_2=YAHOO.util.History.getQueryStringParameter("list_type");}if(_2==null||_2==""){var _3=YAHOO.util.History.getCurrentState("param");if(_3!=null&&_3!=""&&_3!="page_1"){myModuleStateChangeHandler(YAHOO.util.History.getCurrentState("param"));}}}function onNavigate(_4){YAHOO.util.History.navigate("param",_4);}function onShowCommentForm(id){var _6=SYNOBLOG.instance();_6.comment_dialog=Ext.DialogManager.get("comment-dlg");if(!_6.comment_dialog){_6.comment_dialog=new SYNOBLOG_COMMENT_DIALOG("comment-dlg");}_6.comment_dialog.reset(id);_6.comment_dialog.show();}function onShowArticleForm(id){if(!g_is_synoblog_admin){return;}var _8=SYNOBLOG.instance();_8.article_dialog=Ext.DialogManager.get("article-dlg");if(!_8.article_dialog){_8.article_dialog=new SYNOBLOG_ARTICLE_DIALOG("article-dlg");}_8.article_dialog.reset(id);_8.article_dialog.show();}function onLogin(){var _9=SYNOBLOG.instance();_9.login_dialog=Ext.DialogManager.get("login-dlg");if(!_9.login_dialog){_9.login_dialog=new SYNOBLOG_LOGINDIALOG("login-dlg");}_9.login_dialog.reset();_9.login_dialog.show_dialog("",1);}Ext.onReady(function(){if(g_is_synoblog_admin){tinyMCE_setFont();}YAHOO.util.History.afterInitialize();Ext.QuickTips.init();var _a=SYNOBLOG.instance();var x;var _c=_a.getAllModules();for(x in _c){_a.getModule(x).init_module();}});SYNOBLOG=function(){};SYNOBLOG.prototype={modules:{},login_dialog:null,comment_dialog:null,article_dialog:null,registerModule:function(_1,_2,_3){var _4=_3?(new _3(_1,_2)):null;if(_4){_4.manager=this;}this.modules[_1]=_4;},getModule:function(_5){if(this.modules[_5]){return this.modules[_5];}else{return null;}},getAllModules:function(){return this.modules;}};SYNOBLOG.instance=function(){return SYNOBLOG._inst;};SYNOBLOG._inst=new SYNOBLOG();SynoDatePicker=function(_1){SynoDatePicker.superclass.constructor.call(this,_1);this.value=_1&&_1.value?_1.value.clearTime():new Date().clearTime();this.addEvents({select:true});if(this.handler){this.on("select",this.handler,this.scope||this);}if(!this.disabledDatesRE&&this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1){re+="|";}}this.disabledDatesRE=new RegExp(re+")");}};Ext.extend(SynoDatePicker,Ext.Component,{todayText:"Today",okText:"&#160;OK&#160;",cancelText:"Cancel",todayTip:"{0} (Spacebar)",minDate:null,maxDate:null,minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDays:null,disabledDaysText:"",disabledDatesRE:null,disabledDatesText:"",constrainToViewport:true,monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:"Next Month (Control+Right)",prevText:"Previous Month (Control+Left)",monthYearText:"Choose a month (Control+Up/Down to move years)",startDay:0,setValue:function(_5){var _6=this.value;this.value=_5.clearTime(true);if(this.el){this.update(this.value);}},getValue:function(){return this.value;},focus:function(){if(this.el){this.update(this.activeDate);}},onRender:function(_7,_8){var m=["<table cellspacing=\"0\">","<tr><td class=\"x-date-left\"><a href=\"#\" title=\"",this.prevText,"\">&#160;</a></td><td class=\"x-date-middle\" align=\"center\"></td><td class=\"x-date-right\"><a href=\"#\" title=\"",this.nextText,"\">&#160;</a></td></tr>","<tr><td colspan=\"3\"><div class=\"synoblog_date_piker\"><table class=\"x-date-inner\" cellspacing=\"0\"><thead><tr>"];var dn=this.dayNames;for(var i=0;i<7;i++){var d=this.startDay+i;if(d>6){d=d-7;}m.push("<th><span>",dn[d].substr(0,1),"</span></th>");}m[m.length]="</tr></thead><tbody><tr>";for(i=0;i<42;i++){if(i%7==0&&i!=0){m[m.length]="</tr><tr>";}m[m.length]="<td><a href=\"#\" hidefocus=\"on\" class=\"x-date-date\" tabIndex=\"1\"><em><span></span></em></a></td>";}m[m.length]="</tr></tbody></table></td></tr></table></div><div class=\"x-date-mp\"></div>";var el=document.createElement("div");el.className="x-date-picker";el.innerHTML=m.join("");_7.dom.insertBefore(el,_8);this.el=Ext.get(el);this.eventEl=Ext.get(el.firstChild);var _e=new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});var _f=new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"),{handler:this.showNextMonth,scope:this,preventDefault:true,stopDefault:true});this.monthPicker=this.el.down("div.x-date-mp");this.monthPicker.enableDisplayMode("block");this.eventEl.on("click",this.handleDateClick,this,{delegate:"a.x-date-date"});this.eventEl.addKeyListener(Ext.EventObject.SPACE,this.selectToday,this);this.el.unselectable();this.cells=this.el.select("table.x-date-inner tbody td");this.textNodes=this.el.query("table.x-date-inner tbody span");this.mbtn=new Ext.Button(this.el.child("td.x-date-middle",true),{text:"&#160;",tooltip:this.monthYearText});this.mbtn.on("click",this.showMonthPicker,this);this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");if(Ext.isIE){this.el.repaint();}this.update(this.value);},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var buf=["<table border=\"0\" cellspacing=\"0\">"];for(var i=0;i<6;i++){buf.push("<tr><td class=\"x-date-mp-month\"><a href=\"#\">",i+1,"</a></td>","<td class=\"x-date-mp-month x-date-mp-sep\"><a href=\"#\">",i+7,"</a></td>",i==0?"<td class=\"x-date-mp-ybtn\" align=\"center\"><a class=\"x-date-mp-prev\"></a></td><td class=\"x-date-mp-ybtn\" align=\"center\"><a class=\"x-date-mp-next\"></a></td></tr>":"<td class=\"x-date-mp-year\"><a href=\"#\"></a></td><td class=\"x-date-mp-year\"><a href=\"#\"></a></td></tr>");}buf.push("<tr class=\"x-date-mp-btns\"><td colspan=\"4\"><button type=\"button\" class=\"x-date-mp-ok\">",this.okText,"</button><button type=\"button\" class=\"x-date-mp-cancel\">",this.cancelText,"</button></td></tr>","</table>");this.monthPicker.update(buf.join(""));this.monthPicker.on("click",this.onMonthClick,this);this.monthPicker.on("dblclick",this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select("td.x-date-mp-month");this.mpYears=this.monthPicker.select("td.x-date-mp-year");this.mpMonths.each(function(m,a,i){i+=1;if((i%2)==0){m.dom.xmonth=5+Math.round(i*0.5);}else{m.dom.xmonth=Math.round((i-1)*0.5);}});}},showMonthPicker:function(){this.createMonthPicker();var _15=this.el.getSize();this.monthPicker.setSize(_15);this.monthPicker.child("table").setSize(_15);this.mpSelMonth=(this.activeDate||this.value).getMonth();this.updateMPMonth(this.mpSelMonth);this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.slideIn("t",{duration:0.2});},updateMPYear:function(y){this.mpyear=y;var ys=this.mpYears.elements;for(var i=1;i<=10;i++){var td=ys[i-1],y2;if((i%2)==0){y2=y+Math.round(i*0.5);td.firstChild.innerHTML=y2;td.xyear=y2;}else{y2=y-(5-Math.round(i*0.5));td.firstChild.innerHTML=y2;td.xyear=y2;}this.mpYears.item(i-1)[y2==this.mpSelYear?"addClass":"removeClass"]("x-date-mp-sel");}},updateMPMonth:function(sm){this.mpMonths.each(function(m,a,i){m[m.dom.xmonth==sm?"addClass":"removeClass"]("x-date-mp-sel");});},selectMPMonth:function(m){},onMonthClick:function(e,t){e.stopEvent();var el=new Ext.Element(t),pn;if(el.is("button.x-date-mp-cancel")){this.hideMonthPicker();}else{if(el.is("button.x-date-mp-ok")){this.update(new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}else{if((pn=el.up("td.x-date-mp-month",2))){this.mpMonths.removeClass("x-date-mp-sel");pn.addClass("x-date-mp-sel");this.mpSelMonth=pn.dom.xmonth;}else{if((pn=el.up("td.x-date-mp-year",2))){this.mpYears.removeClass("x-date-mp-sel");pn.addClass("x-date-mp-sel");this.mpSelYear=pn.dom.xyear;}else{if(el.is("a.x-date-mp-prev")){this.updateMPYear(this.mpyear-10);}else{if(el.is("a.x-date-mp-next")){this.updateMPYear(this.mpyear+10);}}}}}}},onMonthDblClick:function(e,t){e.stopEvent();var el=new Ext.Element(t),pn;if((pn=el.up("td.x-date-mp-month",2))){this.update(new Date(this.mpSelYear,pn.dom.xmonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}else{if((pn=el.up("td.x-date-mp-year",2))){this.update(new Date(pn.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}}},hideMonthPicker:function(_28){if(this.monthPicker){if(_28===true){this.monthPicker.hide();}else{this.monthPicker.slideOut("t",{duration:0.2});}}},showPrevMonth:function(e){this.update(this.activeDate.add("mo",-1));},showNextMonth:function(e){this.update(this.activeDate.add("mo",1));},showPrevYear:function(){this.update(this.activeDate.add("y",-1));},showNextYear:function(){this.update(this.activeDate.add("y",1));},handleMouseWheel:function(e){var _2c=e.getWheelDelta();if(_2c>0){this.showPrevMonth();e.stopEvent();}else{if(_2c<0){this.showNextMonth();e.stopEvent();}}},handleDateClick:function(e,t){e.stopEvent();if(t.dateValue&&!Ext.fly(t.parentNode).hasClass("x-date-disabled")){this.setValue(new Date(t.dateValue));this.fireEvent("select",this,this.value);}if(SYNOBLOG_UTILS.arrayFindIndex(this.daysWithBlogArticle,this.getValue().getTime())>-1){var _2f=(Ext.isIE?0:1900)+this.getValue().getYear();var mm=this.getValue().getMonth()+1;mm=(mm<10)?"0"+mm:mm;var dd=this.getValue().getDate();dd=(dd<10)?"0"+dd:dd;onNavigate("date_"+_2f+"-"+mm+"-"+dd);}},selectToday:function(){this.setValue(new Date().clearTime());this.fireEvent("select",this,this.value);},update:function(_32){var vd=this.activeDate;this.activeDate=_32;if(vd&&this.el){var t=_32.getTime();if(vd.getMonth()==_32.getMonth()&&vd.getFullYear()==_32.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(c){if(c.dom.firstChild.dateValue==t){setTimeout(function(){try{c.dom.firstChild.focus();}catch(e){}},50);return false;}});this.updateDaysWithBlogArticle(_32);return;}}var _36=_32.getDaysInMonth();var _37=_32.getFirstDateOfMonth();var _38=_37.getDay()-this.startDay;if(_38<=this.startDay){_38+=7;}var pm=_32.add("mo",-1);var _3a=pm.getDaysInMonth()-_38;var _3b=this.cells.elements;var _3c=this.textNodes;_36+=_38;var day=86400000;var d=(new Date(pm.getFullYear(),pm.getMonth(),_3a)).clearTime();var _3f=new Date().clearTime().getTime();var sel=_32.clearTime().getTime();var min=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var max=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var _43=this.disabledDatesRE;var _44=this.disabledDatesText;var _45=this.disabledDays?this.disabledDays.join(""):false;var _46=this.disabledDaysText;var _47=this.format;var _48=function(cal,_4a){_4a.title="";var t=d.getTime();_4a.firstChild.dateValue=t;if(t==_3f){_4a.title=cal.todayText;}if(t==sel){setTimeout(function(){try{_4a.firstChild.focus();}catch(e){}},50);}if(t<min){_4a.className=" x-date-disabled";_4a.title=cal.minText;return;}if(t>max){_4a.className=" x-date-disabled";_4a.title=cal.maxText;return;}if(_45){if(_45.indexOf(d.getDay())!=-1){_4a.title=_46;_4a.className=" x-date-disabled";}}if(_43&&_47){var _4c=d.dateFormat(_47);if(_43.test(_4c)){_4a.title=_44.replace("%0",_4c);_4a.className=" x-date-disabled";}}if(SYNOBLOG_UTILS.arrayFindIndex(this.daysWithBlogArticle,t)>-1){alert("Get");}};var i=0;for(;i<_38;i++){_3c[i].innerHTML=(++_3a);d.setDate(d.getDate()+1);_3b[i].className="x-date-prevday";_48(this,_3b[i]);}for(;i<_36;i++){intDay=i-_38+1;_3c[i].innerHTML=(intDay);d.setDate(d.getDate()+1);_3b[i].className="x-date-active";_48(this,_3b[i]);}var _4e=0;for(;i<42;i++){_3c[i].innerHTML=(++_4e);d.setDate(d.getDate()+1);_3b[i].className="x-date-nextday";_48(this,_3b[i]);}this.mbtn.setText(this.monthNames[_32.getMonth()].substr(0,3)+" "+_32.getFullYear());if(!this.internalRender){var _4f=this.el.dom.firstChild;var w=_4f.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));Ext.fly(_4f).setWidth(w);this.internalRender=true;if(Ext.isOpera&&!this.secondPass){_4f.rows[0].cells[1].style.width=(w-(_4f.rows[0].cells[0].offsetWidth+_4f.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[_32]);}}this.getDaysWithBlogArticle(_32);},getDaysWithBlogArticle:function(d){var _52=(Ext.isIE?0:1900)+((d.getMonth()==0)?d.getYear()-1:d.getYear());var mm=(d.getMonth()==0)?12:d.getMonth();mm=(mm<10)?"0"+mm:mm;firstDay=_52+"-"+mm+"-24";_52=(Ext.isIE?0:1900)+((d.getMonth()==11)?d.getYear()+1:d.getYear());mm=(d.getMonth()==11)?1:d.getMonth()+2;mm=(mm<10)?"0"+mm:mm;lastDay=_52+"-"+mm+"-08";Ext.Ajax.request({url:"include/article.php",params:{action:"getDaysWithBlogArticle",firstDay:firstDay,lastDay:lastDay},method:"POST",scope:this,success:function(res,_55){this.daysWithBlogArticle=new Array();var _56=Ext.util.JSON.decode(res.responseText);if(_56==null){return;}for(var i=0;i<_56.length;i++){if(_56[i].m.charAt(0)=="0"){_56[i].m=_56[i].m.charAt(1);}if(_56[i].d.charAt(0)=="0"){_56[i].d=_56[i].d.charAt(1);}var _58=new Date();_58.setFullYear(_56[i].y,parseInt(_56[i].m,0)-1,parseInt(_56[i].d,0));_58.setHours(0);_58.setMinutes(0);_58.setSeconds(0);_58.setMilliseconds(0);if(SYNOBLOG_UTILS.arrayFindIndex(this.daysWithBlogArticle,_58.getTime())==-1){this.daysWithBlogArticle.push(_58.getTime());}}this.updateDaysWithBlogArticle(d);}});},updateDaysWithBlogArticle:function(_59){var _5a=_59.getDaysInMonth();var _5b=_59.getFirstDateOfMonth();var _5c=_5b.getDay()-this.startDay;if(_5c<=this.startDay){_5c+=7;}var pm=_59.add("mo",-1);var _5e=pm.getDaysInMonth()-_5c;var _5f=this.cells.elements;var d=(new Date(pm.getFullYear(),pm.getMonth(),_5e)).clearTime();var i=0;for(;i<42;i++){d.setDate(d.getDate()+1);if(SYNOBLOG_UTILS.arrayFindIndex(this.daysWithBlogArticle,d.getTime())>-1){_5f[i].className+=" x-date-selected";}}}});