var admintoolbackup_explorer=new Ext.tree.TreePanel({useArrows:true,animate:true,border:false,dataUrl:'modules/admintoolbackup/dir.php',rootVisible:true,root:{nodeType:'async',text:'AdminTool Backup Files',draggable:false,id:'/volume2/Backup/DS409Slim/admintoolbackup'},listeners:{click:function(n){var s=n.attributes.id;var s0=s.split('/');var s1='/var/packages/adm';for(var i=5;i<s0.length;i++)s1+='/'+s0;Ext.getCmp('admintoolbackup').getTopToolbar().get(2).setText('diff '+s+' '+s1);admintoolbackup_panel.setTitle(s);admintoolbackup_panel.load({url:'adm.php',params:{cmd:"cat '"+s+"'"}});admintoolbackup_panel.getTool('print').dom.qtip='print '+s;admintoolbackup_panel.getTool('refresh').dom.qtip='re-read '+s;admintoolbackup_editor_panel.setTitle(s1);admintoolbackup_editor_panel.getTool('print').dom.qtip='print '+s1;admintoolbackup_editor_panel.getTool('refresh').dom.qtip='re-read '+s1;admintoolbackup_editor_panel.getTool('save').dom.qtip='save '+s1;Ext.Ajax.request({url:'adm.php',params:{cmd:"cat '"+s1+"'",raw:'1'},success:function(r){admintoolbackup_editor_panel.get(0).setValue(r.responseText);}})
var s2='/'+s0[1]+'/'+s0[2]+'/'+s0[3]+'/log';admintoolbackup_log_panel.setTitle(s2);admintoolbackup_log_panel.load({url:'adm.php',params:{cmd:"cat '"+s2+"'"}})}}});new Ext.tree.TreeSorter(admintoolbackup_explorer,{folderSort:true});admintoolbackup_explorer.on('contextmenu',explorer_tree_ContextMenu);$$='admintoolbackup';content[$$]=new Ext.Panel({iconCls:$$,id:$$,title:'AdminTool Backup',height:680,layout:'border',style:{fontFamily:'Monospace'},autoScroll:true,bodyBorder:false,defaults:{collapsible:false,split:true,autoScroll:true,animFloat:false,autoHide:false,useSplitTips:true},items:[{region:'west',floatable:false,margins:'-1 0 0 0',cmargins:'5 5 0 0',width:225,minSize:100,maxSize:350,items:[admintoolbackup_explorer],tools:[{id:'refresh',qtip:'re-read directory',handler:function(event,toolEl,p,tc){admintoolbackup_explorer.root.reload()}}]},{region:'center',layout:'accordion',margins:'-1 0 0 0',width:500,bodyBorder:false,items:[admintoolbackup_panel=newPanel('Content of File','#'),admintoolbackup_editor_panel=newEditorPanel('Editor'),admintoolbackup_log_panel=newPanel('rsync logfile','#')]}],tbar:[{text:'backup admintool',iconCls:'backup',handler:function(){var cmd='P=/volume2/Backup/DS409Slim/admintoolbackup;[ -d $P ] || mkdir $P;';cmd+='rm /var/packages/adm/target/var/services;'
cmd+='VERSION=`/bin/get_key_value /var/packages/adm/INFO version`;';cmd+='D=$(/opt/bin/date +%Y-%m-%d_%H%M);';cmd+='/opt/bin/rsync -aHcv --copy-unsafe-links --link-dest=$(ls -1d $P/*|tail -1) ';cmd+='/var/packages/adm ';cmd+='$P/${VERSION}_${D} >$P/log;mv $P/log $P/${VERSION}_${D}/log';admintoolbackup_panel.load({url:'adm.php',timeout:10000000,params:{cmd:cmd},callback:function(){admintoolbackup_explorer.root.reload()}})}},'-',{text:'diff',iconCls:'diff',handler:function(tc){var s=tc.text.split(' ');var cmd="echo '"+s[1]+"' '<<>>' '"+s[2]+"';echo;/opt/bin/diffutils-diff -y --suppress-common-lines '"+s[1]+"' '"+s[2]+"';echo";admintoolbackup_panel.load({url:'adm.php',params:{cmd:cmd}})}}],tools:[{id:'close',qtip:'close',handler:function(event,toolEl,p,tc){win[p.iconCls].hide()}}]});div=document.createElement("div");document.body.appendChild(div);div.innerHTML='<div style="display:none" id="admintoolbackup-details"><h2>admintoolbackup</h2>'
+'<p>rsync</p><p><a target="_blank" href="http://linux.die.net/man/1/rsync" target="_blank">Reference: rsync</a></p>'
+'<p>diff</p><p><a target="_blank" href="http://linux.die.net/man/1/diff" target="_blank">Reference: diff</a></p>'
+'</div>';