/* Copyright (c) 2011 Synology Inc. All rights reserved. */

MODULE_RECENT_COMMENT=function(c,a){MODULE_RECENT_COMMENT.superclass.constructor.call(this,c,a);var b=SYNOBLOG_COLUMN_CENTRAL.instance();b.on("comment_update",this.updateModuleContent,this);b.on("article_update",this.updateModuleContent,this)};Ext.extend(MODULE_RECENT_COMMENT,SYNOBLOG_MODULE,{updateModuleContent:function(){var a=Ext.get(this.div_id+"_content");if(a!=null){var b=a.getUpdateManager();b.update("modules/recent_comment.php","action=get_module_content")}},customizeConfigDialog:function(){this.configDialog.addButton(blog_str_common_save,this.save,this);this.configDialog.addButton(blog_str_common_close,this.hide,this);var b=this.configDialog.getLayout();b.beginUpdate();var a='<div style="margin:20px;width:340px;" id="recent_comment_form"></div>';var c=b.add("center",new Ext.ContentPanel(Ext.id(),{autoCreate:true,title:blog_str_recent_comment_title,background:true}));c.setContent(a);b.endUpdate();this.configDialog.getLayout().getRegion("center").showPanel(0);this.configDialog.on("show",function(d){this.form.load({url:"modules/recent_comment.php",params:"action=get_comment_num"})},this);this.getForm()},getConfigDialogData:function(a){if(a.type=="submit"){this.configDialog.hide()}},getForm:function(){var a=new Ext.data.SimpleStore({fields:["num"],data:[[1],[2],[3],[5],[7],[10],[15],[20]]});this.form.column({labelWidth:200,width:320},new Ext.form.ComboBox({fieldLabel:blog_str_recent_comment_num,name:"num",store:a,displayField:"num",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,width:100,editable:false}));this.form.render("recent_comment_form")},save:function(){this.form.submit({url:"modules/recent_comment.php",waitMsg:blog_str_man_blog_header_pic_plz_wait,params:{action:"save_comment_num"}})}});SYNOBLOG.instance().registerModule("recent_comment",{hasConfigDialog:1,width:400,height:200},MODULE_RECENT_COMMENT);
