(function(){var o=function(a,b){if(b.attr("type")=="folder"){b.find(">td>img.edit").remove();b.find("img.delete").click(function(){c.del(a,b)});b.find("a.folder").click(function(){c.open(a);return false})}else{b.find("a.file,img.edit").click(function(){c.edit(a,b);return false});b.find("img.delete").click(function(){c.del(a,b)})}},p=function(a,b){b.attr("type")=="folder"?c.open(a):c.edit(a,b)},q=function(a){a.dir&&(k.trigger("setNav",[a.dir.path,a.dir.alias]),j=a.dir.path)},j,l,m,n,k,c={table:null,
init:function(a){l=a+"&action=add";m=a+"&action=edit";n=a+"&action=delete";k=$("#navigator").navigator({dirUrl:a+"&action=dir"}).bind("cd",function(e,f){c.open(f)});var b=ct.getCookie(COOKIE_PRE+"auth"),g=$("#uploadify"),h=new ct.uploadBox({destroy:function(){g.uploadifyClearQueue()}});g.uploadify({uploader:"uploadify/uploadify.swf",script:encodeURIComponent(a+"&action=upload&auth="+b),method:"POST",fileDesc:"\u6ce8\u610f:\u60a8\u53ea\u80fd\u4e0a\u4f20zip\u3001html\u683c\u5f0f\u7684\u6587\u4ef6!",
fileExt:"*.zip;*.html",fileDataName:"upfile",queueID:"fileQueue",width:"80",height:"22",auto:true,multi:true,onSelect:function(){g.uploadifySettings("scriptData",{path:j});h.start()},onProgress:function(e,f,i,d){h.update(d.percentage,(d.percentage==100?"\u6b63\u5728\u5904\u7406:":"\u6b63\u5728\u4e0a\u4f20:")+i.name)},onComplete:function(e,f,i,d){try{d=eval("("+d+")")}catch(r){ct.tips("\u6587\u4ef6\u201c"+i.name+"\u201d\u4e0a\u4f20\u5931\u8d25","error");return false}if(d.state){e=0;for(f=d.data.length;e<
f;e++)c.table.addRow(d.data[e],true).trigger("check")}else ct.tips("\u6587\u4ef6\u201c"+i.name+"\u201d\u4e0a\u4f20\u5931\u8d25\uff0c"+d.error,"error");return false},onAllComplete:function(){h.complete("\u6240\u6709\u6587\u4ef6\u4e0a\u4f20\u5b8c\u6210")},onError:function(e,f,i,d){ct.tips(d.type,"error")}});g.parent().css("opacity","0");c.table=new ct.table("#item_list",{dblclickHandler:p,rowCallback:o,jsonLoaded:q,template:'<tr id="row_{path}" type="{type}" right_menu_id="right_menu_{type}">\t<td class="t_l nbr"><a class="{type}" href="javascript:;">{file}</a></td>\t<td class="t_l nbr" width="260">{name}</td>\t<td class="t_c">\t   <img class="manage edit" height="16" width="16" alt="\u7f16\u8f91" src="images/edit.gif"/>&nbsp;       <img class="manage delete" height="16" width="16" alt="\u5220\u9664" src="images/delete.gif"/>\t</td></tr>',
baseUrl:a+"&action=page"});c.table.load()},open:function(a){c.table.load("dir="+a)},edit:function(a){parent.superAssoc.open(m+"&path="+encodeURIComponent(a),"newtab")},add:function(){parent.superAssoc.open(l+"&path="+encodeURIComponent(j),"newtab")},del:function(a,b){var g="\u6b64\u64cd\u4f5c\u4e0d\u53ef\u6062\u590d\uff0c\u786e\u5b9a\u5220\u9664<strong>"+(b.attr("type")=="folder"?"\u76ee\u5f55":"\u6587\u4ef6")+'</strong> "<b style="color:red">'+a+'</b>"\u5417\uff1f',h="path="+a;ct.confirm(g,function(){$.post(n,
h,function(e){e.state?(ct.ok("\u5220\u9664\u5b8c\u6bd5"),c.table.deleteRow(a)):ct.error(e.error)},"json")})},alias:function(a){ct.form("\u4fee\u6539\u522b\u540d","?app=system&controller=template&action=alias&path="+a,250,100,function(b){if(b.state){c.table.load();ct.ok("\u64cd\u4f5c\u6210\u529f");return true}else ct.error(b.error)})}};window.App=c})();
