function getPara(a,b){if(!b)b=location.search;var c=RegExp("[&|?]{1}"+a+"=([\\w]+)").exec(b);if(c==null)return null;return c[1]}
var section={save:function(a){var b="?app=section&controller=section&action=save",c=getPara("classid");if(c)b+="&classid="+c;c="\u6dfb\u52a0\u533a\u5757";if(typeof a=="object"||!a)a=null;if(typeof a=="string"||typeof a=="number"){b+="&sectionid="+a;c="\u7f16\u8f91\u533a\u5757\u5c5e\u6027"}ct.form(c,b,610,460,function(d){if(d.state){if(a)getPara("controller")=="section"?tableApp.updateRow(a,d.data):tableApp.load();else tableApp.load();ct.tips("\u4fee\u6539\u6210\u529f");return true}else{ct.error(d.error,
"error");return false}},function(){return true},function(){return true},function(d){var e=tinyMCE.editors.htmlEd||false;d.find("#hidecode").val(d.find("input[name=type]:checked").val()=="html"?e&&e.getContent():d.find("#codeEd").val())}).bind("dialogbeforeclose",function(){tinyMCE.editors.htmlEd&&tinyMCE.editors.htmlEd.remove()})},del:function(a){if(typeof a=="object"||!a){a=tableApp.checkedIds().join(",");var b=1}if(!a)return ct.tips("\u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u533a\u5757");ct.confirm("\u786e\u5b9a\u5220\u9664\u9009\u4e2d\u7684\u533a\u5757\uff1f",
function(){$.getJSON("?app=section&controller=section&action=delete&id="+a,function(c){if(c.state){if(b)a=null;tableApp.load()}else ct.error("\u5220\u9664\u5931\u8d25\uff01")})})},view:function(a){ct.ajax("\u533a\u5757\u9884\u89c8","?app=section&controller=data&action=view&sectionid="+a,500,300)},copy:function(a){var b=$("#tr_"+a).find("td.name").text();data='\u6309ctrl+c\u590d\u5236\u4ee5\u4e0b\u8c03\u7528\u4ee3\u7801\u5230\u6a21\u677f\u76f8\u5e94\u4f4d\u7f6e<br/>\t\t\u9759\u6001\u8c03\u7528\uff1a<input size="45" class="clip_input" type="text" value="&lt;!--#include virtual=&quot;{ROOT}section/'+
a+".html&quot;--&gt;&lt;!--"+b+'--&gt;"/><br/>\t\t\u52a8\u6001\u8c03\u7528\uff1a<input size="45" class="clip_input" type="text" value="&lt;?php include ROOT_PATH.&quot;section/'+a+".html&quot;;?&gt;&lt;!--"+b+'--&gt;"/><br/>';ct.ok(data,null,5);$(".clip_input").click(function(){this.select()});setTimeout(function(){$(".clip_input:first").click()},0)},publish:function(a){if(this.id=="publish")a="all";else{if(typeof a=="object"||!a)a=tableApp.checkedIds().join(",");if(!a)return ct.tips("\u8bf7\u9009\u62e9\u8981\u53d1\u5e03\u7684\u533a\u5757")}$.getJSON("?app=section&controller=section&action=publish&sectionid="+
a,function(b){if(b.state){ct.tips("\u53d1\u5e03\u6210\u529f");$("#published").text("\u6700\u540e\u53d1\u5e03\uff1a"+b.date);tableApp.load()}else ct.error(b.error?b.error:"\u66f4\u65b0\u5931\u8d25")})},cat:function(){id=tableApp.checkedIds().join(",");if(!id)return ct.tips("\u8bf7\u9009\u62e9\u8981\u79fb\u52a8\u7684\u533a\u5757");var a=$("#classid").val();$.getJSON("?app=section&controller=section&action=cat&classid="+a+"&sectionid="+id,function(b){if(b.state){ct.tips("\u79fb\u52a8\u6210\u529f");tableApp.load();
top.superAssoc.refresh()}else ct.alert(b.error)});$("#classid").val("")},commend:function(){var a=$("#sectionids").val();ct.ajax("\u63a8\u8350\u4f4d","?app=section&controller=section&action=commend&selected="+a,500,300,function(){},function(){var b="",c="";$("#commendDiv li.selected").each(function(d,e){b+=$(e).attr("sectionid")+",";c+=$(e).text()+","});if(b){b=b.substr(0,b.length-1);c=c.substr(0,c.length-1)}$("#sectionids").val(b);$("#commend_text").text(c);action=="edit"&&$("#upsection").toggle($("#commend_text").html()!=
""?true:false);return true},function(){return true})},up:function(a){section.upDown(a,"up")},down:function(a){section.upDown(a,"down")},upDown:function(a,b){if(b=="up"){var c=$("#tr_"+a).prev("tr");if(c.length<1)return;$("#tr_"+a).after(c)}else{c=$("#tr_"+a).next("tr");if(c.length<1)return;$("#tr_"+a).before(c)}c=c.attr("id").replace("tr_","");$.get("?app=section&controller=section&action=upDown&id="+a+"&targetid="+c,function(d){d!=1&&ct.error("\u4fdd\u5b58\u987a\u5e8f\u5931\u8d25")})},data:function(a){ct.assoc.open("?app=section&controller=data&action=index&sectionid="+
a,"newtab")},priv:function(a){ct.ajax("\u8bbe\u7f6e\u533a\u5757\u6743\u9650","?app=section&controller=section_priv&action=index&sectionid="+a,350,300,function(b){b.find("form").ajaxForm("sectionpriv.add_submit")})},top:function(a){section.topBottom(a,"top")},bottom:function(a){section.topBottom(a,"bottom")},topBottom:function(a,b){if(typeof a=="object"||!a)a=tableApp.checkedIds().join(",");if(!a)return ct.tips("\u8bf7\u9009\u62e9\u8981\u79fb\u52a8\u7684\u533a\u5757");$.getJSON("?app=section&controller=section&action=topBottom&type="+
b+"&sectionid="+a,function(c){if(c.state){ct.tips("\u79fb\u52a8\u6210\u529f");tableApp.load()}else ct.error(c.error?c.error:"\u79fb\u52a8\u5931\u8d25")})}};
