Index: openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js,v diff -u -r1.21 -r1.22 --- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js 27 Apr 2009 01:46:36 -0000 1.21 +++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js 25 May 2009 12:36:14 -0000 1.22 @@ -1 +1 @@ -Ext.namespace("fsCore");Ext.namespace("ajaxfs");Ext.BLANK_IMAGE_URL="/resources/ajaxhelper/ext2/resources/images/default/s.gif";fsCore=function(b,a){this.package_id=b;this.xmlhttpurl=a};fsCore.prototype={createTreeLoader:function(){var a=new Ext.tree.TreeLoader({dataUrl:this.xmlhttpurl+"load-treenodes",baseParams:{package_id:this.package_id}});return a},createFilePanelProxy:function(){var a=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-foldercontents"});return a},formSubmit:function(e,g,b,d,f,h,c,i){switch(e){case"createurl":var a=this.xmlhttpurl+"add-url";break}if(a){g.submit({url:a,waitMsg:b,params:d,scope:i,success:h,failure:c})}},doAction:function(g,a,e,b,h,f){var d=null;switch(g){case"checknotif":d=this.xmlhttpurl+"notif_p";break;case"addfolder":d=this.xmlhttpurl+"add-blankfolder";break;case"delete":d=this.xmlhttpurl+"delete-fsitem";break;case"delete-revision":d=this.xmlhttpurl+"delete-fileversion";break;case"move":d=this.xmlhttpurl+"move-fsitem";break;case"rename":d=this.xmlhttpurl+"rename-fsitem";break;case"tag":d=this.xmlhttpurl+"add-tag";break;case"sharefolder":d=this.xmlhttpurl+"share-folder";break}if(d){var c={url:d,success:a,failure:e,params:h};if(b){c.callback=b}if(a){c.success=a}if(e){c.failure=e}if(f){c.scope=f}Ext.Ajax.request(c)}}};ajaxfs=function(a){this.config=null;this.xmlhttpurl="/ajaxfs/xmlhttp/";this.create_url_p=true;this.share_folders_p=true;this.layout=null;this.te=null;this.currentfolder=null;this.currenttag=null;this.msgbox=Ext.MessageBox;this.upldWindow=null;this.tagWindow=null;this.createurlWindow=null;this.sharefolderWindow=null;this.revisionsWindow=null;this.contextmenu=null;this.swfu=null;this.target_folder_id=null;this.communityCombo=null;this.initObj=function(){if(typeof(Ext.DomHelper)!="undefined"){if(a){this.config=a;if(this.config.xmlhttpurl){this.xmlhttpurl=this.config.xmlhttpurl}if(this.config.create_url==0){this.create_url_p=false}if(this.config.share_folders==0){this.share_folders_p=false}if(this.config.views_p==0){this.views_p=false}else{this.views_p=true}if(!this.config.ispublic){Ext.Ajax.on("requestcomplete",this.isSessionExpired,this)}this.fsCore=new fsCore(this.config.package_id,this.xmlhttpurl);Ext.QuickTips.init();this.initLayout()}}};Ext.onReady(this.initObj,this,true)};ajaxfs.prototype={isSessionExpired:function(c,a,b){if(readCookie("ad_user_login")==null){Ext.get(document.body).mask(acs_lang_text.sessionexpired||"Your session has expired. You need to login again.
You will be redirected to a login page shortly");var d="";if(this.currentfolder!=null){var d="?folder_id="+this.currentfolder}window.location="/register/?return_url="+this.config.package_url+d}},asyncExpand:function(b){var a=this.layout.findById("treepanel");var e=a.getNodeById(this.config.initOpenFolder);if(!e){var b=b+1;var c=this.config.pathToFolder[b];var d=a.getNodeById(c);d.on("expand",this.asyncExpand.createDelegate(this,[b]),this,{single:true});d.expand(true)}else{e.select();e.fireEvent("click",e)}},selectInitFolder:function(){var b=this.layout.findById("treepanel");if(this.config.initOpenFolder){var d=b.getNodeById(this.config.initOpenFolder);if(d){d.expand();d.fireEvent("click",d)}else{var a=1;var c=b.getNodeById(this.config.pathToFolder[a]);c.on("expand",this.asyncExpand.createDelegate(this,[a]),this,{single:true});c.expand(true)}}else{b.fireEvent("click",b.getRootNode())}},initLayout:function(){var a=[this.createLeft(),this.createRight()];if(this.config!=null&&this.config.layoutdiv){Ext.get(this.config.layoutdiv).setHeight(400,false);Ext.get(this.config.layoutdiv).update(" ");this.layout=new Ext.Panel({id:"fs-ui",layout:"border",applyTo:this.config.layoutdiv,tbar:this.createToolbar(),items:a})}else{this.layout=new Ext.Viewport({id:"fs-ui",layout:"border",tbar:this.createToolbar(),items:a})}},createToolsMenu:function(){var a=function(){var j=this.layout.findById("filepanel");var f=this.layout.findById("treepanel");if(j.getSelectionModel().getCount()==0){for(var e=0;e");a.push({tooltip:"This may take a few minutes if you have a lot of files",text:acs_lang_text.download_archive||"Download Archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",scope:this,handler:function(){this.downloadArchive(rootnode.id)}});return a},resetToolbar:function(a){if(a.attributes.attributes.write_p=="t"){Ext.getCmp("btnNewFolder").show();Ext.getCmp("btnUploadFile").show();Ext.getCmp("btnDelete").show();Ext.getCmp("btnToolsMenu").show();if(this.create_url_p){Ext.getCmp("btnCreateUrl").show()}}else{Ext.getCmp("btnNewFolder").hide();Ext.getCmp("btnUploadFile").hide();Ext.getCmp("btnDelete").hide();Ext.getCmp("btnToolsMenu").hide();if(this.create_url_p){Ext.getCmp("btnCreateUrl").hide()}}},createLeft:function(){var a=new Ext.Panel({id:"leftpanel",region:"west",collapsible:true,collapseMode:"mini",titlebar:false,layout:"accordion",split:true,width:300,items:[this.createTreePanel(),this.createTagPanel()]});return a},createTreePanel:function(){var c=new Ext.tree.AsyncTreeNode({text:this.config.treerootnode.text,draggable:false,id:this.config.treerootnode.id,singeClickExpand:true,expanded:true,attributes:this.config.treerootnode.attributes});var b=this.fsCore.createTreeLoader();var a=new Ext.tree.TreePanel({id:"treepanel",title:acs_lang_text.folders||"Folders",autoScroll:true,animate:true,enableDrag:false,enableDrop:true,loadMask:true,loader:b,root:c,ddAppendOnly:true,containerScroll:true,dropConfig:{dropAllowed:true,ddGroup:"fileDD",onNodeOver:function(i,g,h,f){if(i.node.id==i.node.ownerTree.getSelectionModel().getSelectedNode().id){return false}if(g.dragData.selections){for(var d=0;d"+o)}};var f=function(e){var q=Ext.decode(e.responseText);var r="";if(q.error){r=q.error}Ext.Msg.alert(acs_lang_text.error||"Error",m+"
"+r+"
"+o)};this.fsCore.doAction("move",k,f,null,{folder_target_id:h,file_ids:g});return true}.createDelegate(this)}});this.enableTreeFolderRename(a);c.on("expand",this.selectInitFolder,this,{single:true});a.on("click",this.loadFoldercontents,this);return a},enableTreeFolderRename:function(a){this.te=new Ext.tree.TreeEditor(a,{allowBlank:false,blankText:acs_lang_text.folder_name_required||"A folder name is required",ignoreNoChange:true});this.te.on("beforestartedit",function(c,b,d){if(c.editNode.attributes.attributes.write_p=="t"){return true}else{Ext.Msg.alert(acs_lang_text.permission_denied||"Permission Denied",acs_lang_text.permission_denied||"Sorry, you do not have permission to rename this folder");return false}},this,true);this.te.on("beforecomplete",function(e,f,d){var c=e.editNode.parentNode;if(c){var b=c.childNodes;for(x=0;x
"+j.error+"

"+c);e.editNode.setText(d)}};var b=function(){Ext.Msg.alert(acs_lang_text.error||"Error",f+"
"+c);e.editNode.setText(d)};this.fsCore.doAction("rename",h,b,null,{newname:g,object_id:e.editNode.id,type:"folder"})},this,true)},createTagPanel:function(){var a=new Ext.Panel({id:"tagcloudpanel",title:"Tags",frame:false,loadMask:true,autoScroll:true,autoLoad:{url:this.xmlhttpurl+"get-tagcloud",params:{package_id:this.config.package_id}}});var b=function(){var c=this;var d=c.currenttag;a.body.on("click",function(f,e){if(e.tagName=="A"){if(d!=null){Ext.get(d).setStyle("font-weight","normal")}Ext.get(e).setStyle("font-weight","bold");d=e.id;this.loadTaggedFiles(e.id)}},this)};a.on("render",b,this);return a},loadTaggedFiles:function(a){this.layout.findById("treepanel").getSelectionModel().clearSelections();var b=a.substring(3,a.length);this.layout.findById("filepanel").store.baseParams.tag_id=b;this.layout.findById("filepanel").store.load();this.layout.findById("filepanel").store.baseParams.tag_id=""},createRight:function(){var g=function(i,j,h){j.attr="ext:qtip='"+h.get("qtip")+"'";return i};var e=[{header:"",width:30,sortable:true,dataIndex:"icon"},{header:acs_lang_text.filename||"Filename",id:"filename",sortable:true,dataIndex:"title",renderer:g},{header:acs_lang_text.size||"Size",sortable:true,dataIndex:"size"},{header:acs_lang_text.lastmodified||"Last Modified",sortable:true,dataIndex:"lastmodified"}];var a=new Ext.data.JsonReader({totalProperty:"total",root:"foldercontents",id:"id"},[{name:"id",type:"int"},{name:"qtip"},{name:"icon"},{name:"title"},{name:"filename"},{name:"type"},{name:"tags"},{name:"url"},{name:"linkurl"},{name:"write_p"},{name:"symlink_id"},{name:"size"},{name:"lastmodified"}]);var d=this.fsCore.createFilePanelProxy();var b=new Ext.grid.ColumnModel(e);var c=new Ext.data.Store({proxy:d,reader:a,remoteSort:true});var f=new Ext.grid.GridPanel({store:c,cm:b,id:"filepanel",ddGroup:"fileDD",region:"center",split:true,autoScroll:true,autoExpandColumn:"filename",enableDragDrop:true,width:250,loadMask:true,frame:false,viewConfig:{forceFit:false,enableRowBody:true,showPreview:true,deferEmptyText:true,emptyText:"This folder is empty",getRowClass:function(h,l,k,j){var i=Ext.util.Format;if(h.data.tags!=""){k.body="
Tags: "+i.ellipsis(i.stripTags(h.data.tags),200)+"
"}else{k.body="
"}return"x-grid3-row-expanded"}}});f.on("rowdblclick",this.openItem,this,true);f.on("rowcontextmenu",this.showRowContext,this,true);return f},showRowContext:function(a,d,h){h.stopEvent();var j=this.layout.findById("treepanel");var m=this.config.treerootnode;var f=a.store;var g=f.getAt(d);var k=g.get("type");var b=g.get("id");var c;switch(k){case"folder":c="Open";break;case"url":c="Open";break;default:c="Download";break}this.contextmenu=new Ext.menu.Menu({id:"rightclickmenu",items:[new Ext.menu.Item({text:c,icon:"/resources/ajaxhelper/icons/page_white.png",scope:this,handler:function(){this.openItem(a,d,h)}}),new Ext.menu.Item({text:"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png",scope:this,handler:function(){this.tagFsitem(a,d,h)}}),new Ext.menu.Item({text:"Views",icon:"/resources/ajaxhelper/icons/camera.png",scope:this,handler:function(){this.redirectViews(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",scope:this,handler:function(){this.delItem(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png",scope:this,handler:function(){this.renameItem(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png",scope:this,handler:function(){this.copyLink(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png",scope:this,handler:function(){this.redirectPerms(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png",scope:this,handler:function(){this.showRevisions(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",scope:this,handler:function(){this.downloadArchive(b)}}),new Ext.menu.Item({text:acs_lang_text.sharefolder||"Share Folder",icon:"/resources/ajaxhelper/icons/group_link.png",scope:this,handler:function(){this.showShareOptions(a,d,h)}})]});if(a.getSelectionModel().getCount()>1){this.contextmenu.items.items[0].hide();this.contextmenu.items.items[1].hide();this.contextmenu.items.items[2].hide();this.contextmenu.items.items[3].show();this.contextmenu.items.items[4].hide();this.contextmenu.items.items[5].hide();this.contextmenu.items.items[6].hide();this.contextmenu.items.items[7].hide();this.contextmenu.items.items[8].hide();this.contextmenu.items.items[9].hide()}else{this.contextmenu.items.items[0].show();this.contextmenu.items.items[2].show();this.contextmenu.items.items[3].show();this.contextmenu.items.items[4].show();this.contextmenu.items.items[5].show();this.contextmenu.items.items[6].show();switch(k){case"folder":this.contextmenu.items.items[1].hide();this.contextmenu.items.items[7].hide();this.contextmenu.items.items[8].show();if(j.getNodeById(b).attributes.attributes.type=="symlink"){this.contextmenu.items.items[9].hide()}else{this.contextmenu.items.items[9].show()}break;case"url":this.contextmenu.items.items[1].show();this.contextmenu.items.items[7].hide();this.contextmenu.items.items[8].hide();this.contextmenu.items.items[9].hide();break;case"symlink":this.contextmenu.items.items[4].hide();this.contextmenu.items.items[9].hide();break;default:this.contextmenu.items.items[1].show();this.contextmenu.items.items[7].show();this.contextmenu.items.items[8].hide();this.contextmenu.items.items[9].hide()}}if(!this.share_folders_p){this.contextmenu.items.items[9].hide()}if(!this.views_p){this.contextmenu.items.items[2].hide()}if(m.attributes.write_p=="f"){this.contextmenu.items.items[1].hide();this.contextmenu.items.items[3].hide();this.contextmenu.items.items[6].hide();this.contextmenu.items.items[7].hide();this.contextmenu.items.items[9].hide()}var l=h.getXY();this.contextmenu.rowid=d;this.contextmenu.showAt([l[0],l[1]])},loadFoldercontents:function(a,b){this.currentfolder=a.id;var c=this.layout.findById("filepanel");c.store.baseParams.folder_id=a.id;c.store.baseParams.package_id=this.config.package_id;this.resetToolbar(a);c.store.on("load",function(e,d){a.attributes.attributes.size=d.length+" items"},{single:true});if(a.loading){a.on("expand",function(){this.store.load()},c,{single:true})}else{c.store.load()}},openItem:function(f,d,h){var a=this.layout.findById("treepanel");var c=f.store;var b=c.getAt(d);if(b.get("type")=="folder"||b.get("type")=="symlink"){var g=a.getNodeById(b.get("id"));if(!g.parentNode.isExpanded()){g.parentNode.expand()}g.fireEvent("click",g);g.expand()}else{window.open(b.get("url"));window.focus()}},delItem:function(b,s,v){var d=acs_lang_text.confirm_delete||"Are you sure you want to delete ";var j=acs_lang_text.foldercontains||"This folder ";var g=acs_lang_text.delete_error||"Sorry,there was an error trying to delete this item.";var m=this.layout.findById("treepanel");if(b.id=="filepanel"){var t=b;if(t.getSelectionModel().getCount()<=1){t.getSelectionModel().selectRow(s)}}else{var t=this.layout.findById("filepanel")}var p=t.getSelectionModel().getSelections();var o=true;if(p.length>0){o=false;if(p.length==1){var w=p[0].get("title");if(p[0].get("type")==="folder"){var f=j+"contains "+p[0].get("size")+".
"}else{var f=""}var f=f+d+" "+w+" ?";if(p[0].get("type")==="symlink"){var u=p[0].get("symlink_id")}else{var u=p[0].get("id")}}else{var f=d+":

";var u=[];for(var k=0;k"+p[k].get("title")+" ";if(p[k].get("type")==="folder"){f=f+"("+p[k].get("size")+")"}f=f+"
";if(p[k].get("type")==="symlink"){u[k]=p[k].get("symlink_id")}else{u[k]=p[k].get("id")}}}var y={object_id:u}}else{o=true;var q=m.getSelectionModel().getSelectedNode();var u=q.attributes.id;var c=q.attributes.attributes.type;var a=q.attributes.attributes.symlink_id;var r=m.getRootNode();if(c=="symlink"){var y={object_id:a}}else{var y={object_id:u}}if(q.attributes.id==r.attributes.id){Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.cant_del_root||"The root folder can not be deleted.");return}else{if(typeof(q.attributes.attributes.size)=="undefined"){var f=""}else{var f=j+" contains "+q.attributes.attributes.size+".
"}f=f+d+" "+q.attributes.text+"?"}}var h=function(i){var B=Ext.decode(i.responseText);if(B.success){if(o){var C=m.getSelectionModel().getSelectedNode();var z=C.parentNode;z.fireEvent("click",z);z.removeChild(C)}else{for(var e=0;e
"+e.error+"")};var n=function(e){if(e==="yes"){this.fsCore.doAction("delete",h,l,null,y)}};Ext.MessageBox.confirm(acs_lang_text.confirm||"Confirm",f,n,this)},addFolder:function(){var e=this.te;var a=this.layout.findById("treepanel");var c=a.getSelectionModel().getSelectedNode();c.expand();var f=acs_lang_text.new_folder_error||"Sorry, there was an error trying to create your new folder.";var d=function(g){var h=Ext.decode(g.responseText);if(h.success){var i=c.appendChild(new Ext.tree.TreeNode({text:h.pretty_folder_name,id:h.id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:"t",size:"0 items",type:"folder",symlink_id:""}}));a.getSelectionModel().select(i);i.loaded=true;i.fireEvent("click",i);setTimeout(function(){e.editNode=i;e.startEdit(i.ui.textNode)},10)}else{Ext.Msg.alert(acs_lang_text.error||"Error",f+"

"+h.error+"")}};var b=function(g){var h=Ext.decode(g.responseText);Ext.Msg.alert(acs_lang_text.error||"Error",f+"

"+h.error+"")};this.fsCore.doAction("addfolder",d,b,null,{folder_id:c.attributes.id})},createSwfObj:function(){var i=this.layout.findById("treepanel");var d=this.currentfolder;if(this.swfu==null){var a=this;var h=String(this.config.package_id);var p=String(this.config.user_id);var k=String(this.currentfolder);var c=String(this.config.max_file_size);var e="fsuploadprogress";var o=function(w){var v=acs_lang_text.for_upload_to||"for upload to";var s=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)";try{var y=a.currentfolder;var r=i.getNodeById(y).text;var t=new FileProgress(w,e);t.SetStatus(v+" "+r+"
Title: (optional)
"+s);t.ToggleCancel(true,this);this.addFileParam(w.id,"folder_id",y)}catch(u){Ext.Msg.alert(acs_lang_text.error||"Error",u)}};var m=function(){};var n=function(t,v,u){try{if(v===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("You have attempted to queue too many files.\n"+(u===0?"You have reached the upload limit.":"You may select "+(u>1?"up to "+u+" files.":"one file.")));return}var r=new FileProgress(t,e);r.setError();r.toggleCancel(false);switch(v){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:r.setStatus("File is too big.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: File too big, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:r.setStatus("Cannot upload Zero Byte files.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Zero byte file, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:r.setStatus("Invalid File Type.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Invalid File Type, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:Ext.Msg.alert(acs_lang_text.error||"Error","You have selected too many files. "+(u>1?"You may only add "+u+" more files":"You cannot add any more files."));break;default:if(t!==null){r.setStatus("Unhandled Error")}Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: "+v+", File name: "+t.name+", File size: "+t.size+", Message: "+u);break}}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var l=function(){};var b=function(w){var v=acs_lang_text.for_upload_to||"for upload to";var s=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)";try{var y=a.currentfolder;var r=i.getNodeById(y).text;var t=new FileProgress(w,e);t.SetStatus(v+" "+r+"b>
Title: (optional)
"+s);t.ToggleCancel(true,this);this.addFileParam(w.id,"folder_id",y)}catch(u){Ext.Msg.alert(acs_lang_text.error||"Error",u)}};var g=function(w,v,u){try{var t=Math.ceil((v/u)*100);var r=new FileProgress(w,e);r.SetProgress(t);r.SetStatus(acs_lang_text.uploading||"Uploading...")}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var f=function(){var r=i.getNodeById(a.currentfolder);r.fireEvent("click",r)};var q=function(t,v,u){try{var r=new FileProgress(t,e);r.setError();r.ToggleCancel(false);switch(v){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:r.setStatus("Upload Error: "+u);Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: HTTP Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:r.setStatus("Configuration Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: No backend file, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:r.setStatus("Upload Failed.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Upload Failed, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:r.setStatus("Server (IO) Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: IO Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:r.setStatus("Security Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Security Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:r.setStatus("Upload limit exceeded.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Upload Limit Exceeded, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:r.setStatus("File not found.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: The file was not found, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:r.setStatus("Failed Validation. Upload skipped.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: File Validation Failed, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:r.setStatus("Cancelled");r.setCancelled();break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:r.setStatus("Stopped");break;default:r.setStatus("Unhandled Error: "+error_code);Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: "+v+", File name: "+t.name+", File size: "+t.size+", Message: "+u);break}}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var j=function(u,s){try{var r=new FileProgress(u,e);r.SetComplete();r.SetStatus(acs_lang_text.complete||"Complete.");r.ToggleCancel(false)}catch(t){Ext.Msg.alert(acs_lang_text.error||"Error",t)}};this.swfu=new SWFUpload({debug:false,post_params:{user_id:p,package_id:h},file_types:"*.*",button_placeholder_id:"btnSwfUpload",button_image_url:"/resources/ajax-filestorage-ui/resources/FullyTransparent_65x29.png",button_text:"BROWSE",button_width:61,button_height:16,button_text_left_padding:3,button_text_top_padding:0,file_dialog_start_handler:m,file_queued_handler:o,file_queue_error_handler:n,file_dialog_complete_handler:l,upload_start_handler:b,upload_progress_handler:g,upload_error_handler:q,upload_success_handler:j,queue_complete_handler:f,upload_url:this.xmlhttpurl+"add-file-flash",flash_url:"/resources/ajax-filestorage-ui/swfupload/swfupload.swf"})}},addFile:function(){var f=null;if(this.upldWindow==null){if(!this.config.multi_file_upload||checkFlashVersion()<10){f="single";var i=acs_lang_text.file_to_upload||"File to upload";var h=acs_lang_text.file_title||"Title";var g=acs_lang_text.file_description||"Description";var e=acs_lang_text.multiple_files||"Multiple Files";var d=acs_lang_text.multiple_files_msg||"This is a ZIPfile containing multiple files.";var k=true;var j=acs_lang_text.uploadfile||"Upload a File";var c=new Ext.Panel({id:"form_addfile",align:"left",frame:true,html:'

'+i+'


'+h+'


'+g+' :

'+e+' :

'+d+"

"});var a=[{text:acs_lang_text.upload||"Upload",scope:this,handler:this.uploadOneFile,icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:acs_lang_text.close||"Close",scope:this,handler:function(){this.upldWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]}else{f="multiple";var b=acs_lang_text.upload_intro||"Click Upload to select a file to upload to the selected folder on the tree.";var k=false;var j=acs_lang_text.uploadfile||"Upload Files";var c=new Ext.Panel({id:"form_multi_addfile",autoScroll:true,frame:true,html:'
'+b+'
'});var a=[{text:''},{text:acs_lang_text.upload||"Upload",scope:this,handler:function(){this.swfu.startUpload()},icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:"Hide",scope:this,handler:function(){this.upldWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]}this.upldWindow=new Ext.Window({id:"upload-win",layout:"fit",width:400,height:300,title:j,closeAction:"hide",modal:k,plain:true,resizable:false,items:c,buttons:a});if(f=="multiple"){this.upldWindow.on("show",function(){this.createSwfObj()},this,{single:true})}}else{if(!this.config.multi_file_upload||checkFlashVersion()<10){document.getElementById("newfileform").reset();document.getElementById("newfileform").folder_id.value=this.currentfolder}}this.upldWindow.show("btnUploadFile")},uploadOneFile:function(){if(Ext.get("upload_file").getValue()!=""&&Ext.get("filetitle").getValue()!=""){var a=this.layout.findById("treepanel");var d={success:function(){},upload:function(){a.getSelectionModel().getSelectedNode().loaded=false;a.getSelectionModel().getSelectedNode().fireEvent("click",a.getSelectionModel().getSelectedNode());this.upldWindow.body.unmask();this.upldWindow.hide()},failure:function(){Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.")},scope:this};var c=acs_lang_text.loading||"One moment. This may take a while depending on how large your upload is.";this.upldWindow.body.mask("
"+c);YAHOO.util.Connect.setForm("newfileform",true,true);var b=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-file",d)}else{Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.file_required||"Title and File to upload are required.")}},addUrl:function(){if(this.createurlWindow==null){this.createurlWindow=new Ext.Window({id:"createurl-win",layout:"fit",width:400,height:180,title:"Create URL",closeAction:"hide",modal:true,plain:true,resizable:false,items:new Ext.FormPanel({id:"form_create_url",align:"left",autoScroll:true,closable:true,layout:"form",defaults:{width:230},frame:true,buttonAlign:"left",items:[{xtype:"textfield",fieldLabel:"Title",allowBlank:false,name:"fstitle",tabIndex:1},{xtype:"textfield",fieldLabel:"URL",allowBlank:false,name:"fsurl",tabIndex:2,validator:isURL,value:"http://"},{xtype:"textfield",fieldLabel:"Description",name:"fsdescription",tabIndex:3}]}),buttons:[{text:"Submit",scope:this,handler:function(){var b=this.createurlWindow.findById("form_create_url").getForm();if(b.isValid()){var c=function(e,f){if(f.result){var d=this.layout.findById("treepanel");d.getSelectionModel().getSelectedNode().fireEvent("click",d.getSelectionModel().getSelectedNode());this.createurlWindow.hide()}else{Ext.MessageBox.alert("Error","Sorry an error occured.
"+f.result.error)}};var a=function(d,e){if(e.result){Ext.MessageBox.alert("Error",e.result.error)}};this.fsCore.formSubmit("createurl",b,"One moment ....",{package_id:this.config.package_id,folder_id:this.currentfolder},true,c,a,this)}},icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon"},{text:"Close",scope:this,handler:function(){this.createurlWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]})}this.createurlWindow.show()},renameItem:function(b,h,j){var n=acs_lang_text.permission_denied_error||"Sorry, you do not have permission to rename this folder.";if(b.id=="treepanel"){var g=b.getSelectionModel().getSelectedNode();this.te.triggerEdit(g)}else{var o=b;var l=this.layout.findById("treepanel");var g=o.store.getAt(h);var k=g.get("url");var a=g.get("type");var c=g.get("id");var m=g.get("filename");var d=function(e){var r=acs_lang_text.an_error_occurred||"An error occurred";var q=acs_lang_text.reverted||"Your changes have been reverted";var i=Ext.decode(e.responseText);if(!i.success){Ext.Msg.alert(acs_lang_text.error||"Error",r+":

"+i.error+"

"+q)}else{if(a=="folder"){l.getNodeById(c).setText(i.newname)}if(a!="folder"&&m===" "){m=g.get("title");g.set("filename",m)}g.set("title",i.newname);g.commit()}};var p=function(i,q){if(i=="ok"){if(q!=""){if(q.length>100){Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.limitto100||"Please limit your name to 100 characters or less.");return false}else{var e=function(r){var s=Ext.decode(r.responseText);Ext.Msg.alert(acs_lang_text.error||"Error",n+"

"+s.error+"")};this.fsCore.doAction("rename",d,e,null,{newname:q,object_id:c,type:a,url:k})}}else{Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.enter_new_name||"Please enter a new name.");return false}}};Ext.Msg.show({title:acs_lang_text.rename||"Rename",prompt:true,msg:acs_lang_text.enter_new_name||"Please enter a new name for ... ",value:g.get("title"),buttons:Ext.Msg.OKCANCEL,scope:this,fn:p});var f=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");f[0].select()}},tagFsitem:function(a,h,m){var r=a;var c=r.store.getAt(h);var p=c.get("id");var g=c.get("tags");var l=this.config.package_id;var o=this.layout.findById("tagcloudpanel");var n=this.xmlhttpurl;var f=this.tagWindow;var q=function(){c.data.tags=Ext.get("fstags").getValue();c.commit();o.load({url:n+"get-tagcloud",params:{package_id:l}});f.hide()};var b=function(e){Ext.Msg.alert(acs_lang_text.error||"Error","Sorry, we encountered an error.")};var k=function(){this.fsCore.doAction("tag",q,b,null,{object_id:c.id,package_id:l,tags:Ext.get("fstags").getValue()})};if(f==null){var d=new Ext.Panel({id:"form_addtag",autoScroll:true,frame:true,html:"

Enter or edit one or more tags. Use commas (,) to separate the tags:

"});var j=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",scope:this,handler:k},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",scope:this,handler:function(){this.tagWindow.hide()}}];this.tagWindow=new Ext.Window({id:"tag-win",layout:"fit",width:450,height:200,title:"Tags",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:d,buttons:j})}this.tagWindow.show("undefined",function(){Ext.get("fstags").dom.value=g;this.initTagAutoComplete()},this)},initTagAutoComplete:function(){var a=new YAHOO.util.LocalDataSource(oAutoCompArr);if(document.getElementById("fstags")){var b=new YAHOO.widget.AutoComplete("fstags","oAutoCompContainer1",a);b.animHoriz=false;b.animVert=false;b.queryDelay=0;b.maxResultsDisplayed=10;b.useIFrame=true;b.delimChar=",";b.allowBrowserAutocomplete=false;b.typeAhead=true;b.useShadow=true;b.prehighlightClassName="yui-ac-prehighlight";b.formatResult=function(c,e){var d=c[0];return d}}},downloadArchive:function(a){if(a){top.location.href=this.config.package_url+"download-archive/?object_id="+a}},showShareOptions:function(a,h,l){var s=a;var f=s.store.getAt(h);var r=f.get("id");var g=f.get("title");var m=this.layout.findById("treepanel");var k=this.config.package_id;var q=this.xmlhttpurl;var p=this.sharefolderWindow;var j=function(){var e=m.getSelectionModel().getSelectedNode();e.loaded=false;e.collapse();e.fireEvent("click",e);e.expand();p.hide()};var c=function(e){Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later.")};var b=function(){var e=this.communityCombo.getValue();this.fsCore.doAction("sharefolder",j,c,null,{target_folder_id:e,folder_id:r})};if(p==null){var o=new Ext.data.JsonStore({url:q+"list-communities",root:"communities",fields:["target_folder_id","instance_name"]});this.communityCombo=new Ext.form.ComboBox({id:"communities_list",store:o,displayField:"instance_name",typeAhead:true,fieldLabel:"Community",triggerAction:"all",emptyText:"Select a community",hiddenName:"target_folder_id",valueField:"target_folder_id",forceSelection:true,handleHeight:80,selectOnFocus:true});var d=new Ext.form.FormPanel({id:"sharefolderform",title:"Select the community where you wish to share the "+g+" folder with.",frame:true,items:this.communityCombo});var n=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",scope:this,handler:b},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",scope:this,handler:function(){p.hide()}}];p=new Ext.Window({id:"share-win",layout:"fit",width:380,height:200,title:"Share Folder",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:d,buttons:n});this.sharefolderWindow=p}else{this.sharefolderWindow.findById("sharefolderform").setTitle("Select the community where you wish to share the "+g+" folder with.");this.communityCombo.reset()}p.show()},redirectViews:function(a,b,f){if(a.id=="filepanel"){var g=a;var c=g.store.getAt(b);var d=c.get("id")}else{var d=b}window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+d+"/info");window.focus()},redirectPerms:function(a,b,f){if(a.id=="filepanel"){var h=a;var c=h.store.getAt(b);var d=c.get("id")}else{var d=b}var g=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+d+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder);g.focus()},redirectNotifs:function(b,d,h){if(b.id=="filepanel"){var j=b;var f=j.store.getAt(d);var g=f.get("id");var c=f.get("title")}else{var a=b;var f=a.getSelectionModel().getSelectedNode();var g=f.attributes.id;var c=f.text}window.location.href=this.xmlhttpurl+"notif-toggle?pretty_name="+c+"&object_id="+g+"&return_url="+this.config.package_url+"?folder_id="+this.currentfolder},redirectProperties:function(b,a,f){var h=b;var c=h.store.getAt(a);var d=c.get("id");var g=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+d);g.focus()},showRevisions:function(a,d,j){var n=a;var b=n.store.getAt(d);n.getSelectionModel().selectRow(d);var l=b.get("id");var c=b.get("filename");var m=this.revisionsWindow;if(m==null){m=new Ext.Window({id:"rev-win",layout:"fit",width:550,height:300,closeAction:"hide",modal:true,plain:true,items:new Ext.TabPanel({id:"rev-tabs",items:[this.createRevGrid(),this.newRevForm()]})});this.revisionsWindow=m}m.setTitle(c+" - "+acs_lang_text.properties||"Properties");var h=m.findById("revisionspanel");var g=m.findById("rev-tabs");var k=m.findById("rev-form");var f=this.config.package_id;h.store.on("load",function(){this.getSelectionModel().selectFirstRow()},h);h.on("activate",function(){this.store.baseParams.file_id=l;this.store.baseParams.package_id=f;this.store.load()},h);m.on("beforehide",function(){this.activate(1)},g);m.on("show",function(){this.activate(0)},g);m.show()},createRevGrid:function(){var f=[{header:"",width:30,sortable:false,dataIndex:"icon"},{header:"Title",width:180,sortable:false,dataIndex:"title"},{header:"Author",sortable:false,dataIndex:"author"},{header:"Size",sortable:false,dataIndex:"size"},{header:"Last Modified",sortable:false,dataIndex:"lastmodified"}];var a=new Ext.data.JsonReader({totalProperty:"total",root:"revisions",id:"revision_id"},[{name:"revision_id",type:"int"},{name:"icon"},{name:"title"},{name:"author"},{name:"type"},{name:"size"},{name:"url"},{name:"lastmodified"}]);var d=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-filerevisions"});var b=new Ext.grid.ColumnModel(f);var c=new Ext.data.Store({proxy:d,reader:a});var e=[{text:"Download",tooltip:"Download this revision",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",scope:this,handler:function(){var i=this.revisionsWindow.findById("revisionspanel");var h=i.getSelectionModel().getSelected();window.open(h.get("url"));window.focus()}},{text:"Delete",tooltip:"Delete this revision",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",scope:this,handler:function(){var i=this.revisionsWindow.findById("revisionspanel");var l=i.getSelectionModel();var h=l.getSelected();var j=h.get("revision_id");var k=h.get("title");if(i.store.getCount()==1){Ext.Msg.alert("Warning","Sorry, you can not delete the only revision for this file. You can delete the file instead")}else{Ext.Msg.confirm("Delete","Are you sure you want to delete this version of "+k+" ? This action can not be reversed.",function(n){if(n=="yes"){var o=function(p){l.selectPrevious();i.store.remove(h)};var m=function(){Ext.Msg.alert("Delete Error","Sorry an error occurred. Please try again later.")};this.fsCore.doAction("delete-revision",o,m,null,{version_id:j})}},this)}}}];var g=new Ext.grid.GridPanel({store:c,cm:b,sm:new Ext.grid.RowSelectionModel({singleSelect:true}),id:"revisionspanel",title:"Revisions",loadMask:true,tbar:e});return g},newRevForm:function(){var b="Please choose a file to upload";var a=new Ext.Panel({id:"rev-form",align:"left",frame:true,title:"New Revision",html:'

'+b+'

',buttons:[{text:"Upload New Revision",handler:function(e){if(Ext.get("rev_upload_file").dom.value==""){Ext.Msg.alert("Warning","Please choose a file to upload")}else{var d=this.layout.findById("filepanel");var f=d.getSelectionModel().getSelected();Ext.get("rev_file_id").dom.value=f.get("id");Ext.get("rev_file_title").dom.value=f.get("title");var g={success:function(){},upload:function(){this.revisionsWindow.findById("rev-tabs").activate(0);Ext.get("newrevfileform").dom.reset();this.revisionsWindow.findById("rev-form").body.unmask();e.enable()},failure:function(){Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.");this.revisionsWindow.findById("rev-form").body.unmask();e.enable()},scope:this};this.revisionsWindow.findById("rev-form").body.mask("

Uploading new revision. Please wait
");e.disable();YAHOO.util.Connect.setForm("newrevfileform",true,true);var c=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-filerevision",g)}}.createDelegate(this),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"}]});return a},copyLink:function(b,j,k){if(b.id=="treepanel"){if(window.location.port!=""){var d=":"+window.location.port}else{var d=""}var c=window.location.protocol+"//"+window.location.hostname+d+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+j}else{var l=b;var g=l.store.getAt(j);var a=g.get("type");if(a==="folder"){var c=window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+g.get("id")}else{if(a==="url"){var c=g.get("url")}else{var c=window.location.protocol+"//"+window.location.hostname+g.get("url")}}}if(Ext.isIE){window.clipboardData.setData("text",c)}else{var h=Ext.Msg.show({title:acs_lang_text.linkaddress||"Copy Link Address",prompt:true,msg:acs_lang_text.copyhighlighted||"Copy the highlighted text to your clipboard.",value:c,buttons:Ext.Msg.OK});var f=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");f[0].select()}}}; \ No newline at end of file +Ext.namespace("fsCore");Ext.namespace("ajaxfs");Ext.BLANK_IMAGE_URL="/resources/ajaxhelper/ext2/resources/images/default/s.gif";fsCore=function(b,a){this.package_id=b;this.xmlhttpurl=a};fsCore.prototype={createTreeLoader:function(){var a=new Ext.tree.TreeLoader({dataUrl:this.xmlhttpurl+"load-treenodes",baseParams:{package_id:this.package_id}});return a},createFilePanelProxy:function(){var a=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-foldercontents"});return a},formSubmit:function(e,g,b,d,f,h,c,i){switch(e){case"createurl":var a=this.xmlhttpurl+"add-url";break}if(a){g.submit({url:a,waitMsg:b,params:d,scope:i,success:h,failure:c})}},doAction:function(g,a,e,b,h,f){var d=null;switch(g){case"checknotif":d=this.xmlhttpurl+"notif_p";break;case"addfolder":d=this.xmlhttpurl+"add-blankfolder";break;case"delete":d=this.xmlhttpurl+"delete-fsitem";break;case"delete-revision":d=this.xmlhttpurl+"delete-fileversion";break;case"move":d=this.xmlhttpurl+"move-fsitem";break;case"rename":d=this.xmlhttpurl+"rename-fsitem";break;case"tag":d=this.xmlhttpurl+"add-tag";break;case"sharefolder":d=this.xmlhttpurl+"share-folder";break}if(d){var c={url:d,success:a,failure:e,params:h};if(b){c.callback=b}if(a){c.success=a}if(e){c.failure=e}if(f){c.scope=f}Ext.Ajax.request(c)}}};ajaxfs=function(a){this.config=null;this.xmlhttpurl="/ajaxfs/xmlhttp/";this.create_url_p=true;this.share_folders_p=true;this.layout=null;this.te=null;this.currentfolder=null;this.currenttag=null;this.msgbox=Ext.MessageBox;this.upldWindow=null;this.tagWindow=null;this.createurlWindow=null;this.sharefolderWindow=null;this.revisionsWindow=null;this.contextmenu=null;this.swfu=null;this.target_folder_id=null;this.communityCombo=null;this.initObj=function(){if(typeof(Ext.DomHelper)!="undefined"){if(a){this.config=a;if(this.config.xmlhttpurl){this.xmlhttpurl=this.config.xmlhttpurl}if(this.config.create_url==0){this.create_url_p=false}if(this.config.share_folders==0){this.share_folders_p=false}if(this.config.views_p==0){this.views_p=false}else{this.views_p=true}if(!this.config.ispublic){Ext.Ajax.on("requestcomplete",this.isSessionExpired,this)}this.fsCore=new fsCore(this.config.package_id,this.xmlhttpurl);Ext.QuickTips.init();this.initLayout()}}};Ext.onReady(this.initObj,this,true)};ajaxfs.prototype={isSessionExpired:function(c,a,b){if(readCookie("ad_user_login")==null){Ext.get(document.body).mask(acs_lang_text.sessionexpired||"Your session has expired. You need to login again.
You will be redirected to a login page shortly");var d="";if(this.currentfolder!=null){var d="?folder_id="+this.currentfolder}window.location="/register/?return_url="+this.config.package_url+d}},asyncExpand:function(b){var a=this.layout.findById("treepanel");var e=a.getNodeById(this.config.initOpenFolder);if(!e){var b=b+1;var c=this.config.pathToFolder[b];var d=a.getNodeById(c);d.on("expand",this.asyncExpand.createDelegate(this,[b]),this,{single:true});d.expand(true)}else{e.select();e.fireEvent("click",e)}},selectInitFolder:function(){var b=this.layout.findById("treepanel");if(this.config.initOpenFolder){var d=b.getNodeById(this.config.initOpenFolder);if(d){d.expand();d.fireEvent("click",d)}else{var a=1;var c=b.getNodeById(this.config.pathToFolder[a]);c.on("expand",this.asyncExpand.createDelegate(this,[a]),this,{single:true});c.expand(true)}}else{b.fireEvent("click",b.getRootNode())}},initLayout:function(){var a=[this.createLeft(),this.createRight()];if(this.config!=null&&this.config.layoutdiv){Ext.get(this.config.layoutdiv).setHeight(400,false);Ext.get(this.config.layoutdiv).update(" ");this.layout=new Ext.Panel({id:"fs-ui",layout:"border",applyTo:this.config.layoutdiv,tbar:this.createToolbar(),items:a})}else{this.layout=new Ext.Viewport({id:"fs-ui",layout:"border",tbar:this.createToolbar(),items:a})}},createToolsMenu:function(){var a=function(){var j=this.layout.findById("filepanel");var f=this.layout.findById("treepanel");if(j.getSelectionModel().getCount()==0){for(var e=0;e");a.push({tooltip:"This may take a few minutes if you have a lot of files",text:acs_lang_text.download_archive||"Download Archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",scope:this,handler:function(){this.downloadArchive(rootnode.id)}});return a},resetToolbar:function(a){if(a.attributes.attributes.write_p=="t"){Ext.getCmp("btnNewFolder").show();Ext.getCmp("btnUploadFile").show();if(this.create_url_p){Ext.getCmp("btnCreateUrl").show()}Ext.getCmp("mnRename").show()}else{Ext.getCmp("btnNewFolder").hide();Ext.getCmp("btnUploadFile").hide();Ext.getCmp("btnCreateUrl").hide();Ext.getCmp("mnRename").hide()}if(a.attributes.attributes.delete_p=="t"){Ext.getCmp("btnDelete").show()}else{Ext.getCmp("btnDelete").hide()}if(a.attributes.attributes.admin_p=="t"){Ext.getCmp("mnPerms").show();Ext.getCmp("mnProp").show()}else{Ext.getCmp("mnPerms").hide();Ext.getCmp("mnProp").hide()}},createLeft:function(){var a=new Ext.Panel({id:"leftpanel",region:"west",collapsible:true,collapseMode:"mini",titlebar:false,layout:"accordion",split:true,width:300,items:[this.createTreePanel(),this.createTagPanel()]});return a},createTreePanel:function(){var c=new Ext.tree.AsyncTreeNode({text:this.config.treerootnode.text,draggable:false,id:this.config.treerootnode.id,singeClickExpand:true,expanded:true,attributes:this.config.treerootnode.attributes});var b=this.fsCore.createTreeLoader();var a=new Ext.tree.TreePanel({id:"treepanel",title:acs_lang_text.folders||"Folders",autoScroll:true,animate:true,enableDrag:false,enableDrop:true,loadMask:true,loader:b,root:c,ddAppendOnly:true,containerScroll:true,dropConfig:{dropAllowed:true,ddGroup:"fileDD",onNodeOver:function(i,g,h,f){if(i.node.id==i.node.ownerTree.getSelectionModel().getSelectedNode().id){return false}if(g.dragData.selections){for(var d=0;d"+o)}};var f=function(e){var q=Ext.decode(e.responseText);var r="";if(q.error){r=q.error}Ext.Msg.alert(acs_lang_text.error||"Error",m+"
"+r+"
"+o)};this.fsCore.doAction("move",k,f,null,{folder_target_id:h,file_ids:g});return true}.createDelegate(this)}});this.enableTreeFolderRename(a);c.on("expand",this.selectInitFolder,this,{single:true});a.on("click",this.loadFoldercontents,this);return a},enableTreeFolderRename:function(a){this.te=new Ext.tree.TreeEditor(a,{allowBlank:false,blankText:acs_lang_text.folder_name_required||"A folder name is required",ignoreNoChange:true});this.te.on("beforestartedit",function(c,b,d){if(c.editNode.attributes.attributes.write_p=="t"){return true}else{Ext.Msg.alert(acs_lang_text.permission_denied||"Permission Denied",acs_lang_text.permission_denied||"Sorry, you do not have permission to rename this folder");return false}},this,true);this.te.on("beforecomplete",function(e,f,d){var c=e.editNode.parentNode;if(c){var b=c.childNodes;for(x=0;x
"+j.error+"

"+c);e.editNode.setText(d)}};var b=function(){Ext.Msg.alert(acs_lang_text.error||"Error",f+"
"+c);e.editNode.setText(d)};this.fsCore.doAction("rename",h,b,null,{newname:g,object_id:e.editNode.id,type:"folder"})},this,true)},createTagPanel:function(){var a=new Ext.Panel({id:"tagcloudpanel",title:"Tags",frame:false,loadMask:true,autoScroll:true,autoLoad:{url:this.xmlhttpurl+"get-tagcloud",params:{package_id:this.config.package_id}}});var b=function(){var c=this;var d=c.currenttag;a.body.on("click",function(f,e){if(e.tagName=="A"){if(d!=null){Ext.get(d).setStyle("font-weight","normal")}Ext.get(e).setStyle("font-weight","bold");d=e.id;this.loadTaggedFiles(e.id)}},this);alert(el.tagName)};a.on("render",b,this);return a},loadTaggedFiles:function(a){this.layout.findById("treepanel").getSelectionModel().clearSelections();var b=a.substring(3,a.length);this.layout.findById("filepanel").store.baseParams.tag_id=b;this.layout.findById("filepanel").store.load();this.layout.findById("filepanel").store.baseParams.tag_id=""},createRight:function(){var g=function(i,j,h){j.attr="ext:qtip='"+h.get("qtip")+"'";return i};var e=[{header:"",width:30,sortable:true,dataIndex:"icon"},{header:acs_lang_text.filename||"Filename",id:"filename",sortable:true,dataIndex:"title",renderer:g},{header:acs_lang_text.size||"Size",sortable:true,dataIndex:"size"},{header:acs_lang_text.lastmodified||"Last Modified",sortable:true,dataIndex:"lastmodified"}];var a=new Ext.data.JsonReader({totalProperty:"total",root:"foldercontents",id:"id"},[{name:"id",type:"int"},{name:"qtip"},{name:"icon"},{name:"title"},{name:"filename"},{name:"type"},{name:"tags"},{name:"url"},{name:"linkurl"},{name:"write_p"},{name:"symlink_id"},{name:"size"},{name:"lastmodified"},{name:"write_p"},{name:"admin_p"}]);var d=this.fsCore.createFilePanelProxy();var b=new Ext.grid.ColumnModel(e);var c=new Ext.data.Store({proxy:d,reader:a,remoteSort:true});var f=new Ext.grid.GridPanel({store:c,cm:b,id:"filepanel",ddGroup:"fileDD",region:"center",split:true,autoScroll:true,autoExpandColumn:"filename",enableDragDrop:true,width:250,loadMask:true,frame:false,viewConfig:{forceFit:false,enableRowBody:true,showPreview:true,deferEmptyText:true,emptyText:"This folder is empty",getRowClass:function(h,l,k,j){var i=Ext.util.Format;if(h.data.tags!=""){k.body="
Tags: "+i.ellipsis(i.stripTags(h.data.tags),200)+"
"}else{k.body="
"}return"x-grid3-row-expanded"}}});f.on("rowdblclick",this.openItem,this,true);f.on("rowcontextmenu",this.showRowContext,this,true);return f},showRowContext:function(a,d,h){h.stopEvent();var j=this.layout.findById("treepanel");var m=this.config.treerootnode;var f=a.store;var g=f.getAt(d);var k=g.get("type");var b=g.get("id");var c;switch(k){case"folder":c="Open";break;case"url":c="Open";break;default:c="Download";break}this.contextmenu=new Ext.menu.Menu({id:"rightclickmenu",items:[new Ext.menu.Item({id:"ctxMnOpen",text:c,icon:"/resources/ajaxhelper/icons/page_white.png",scope:this,handler:function(){this.openItem(a,d,h)}}),new Ext.menu.Item({id:"ctxMnTag",text:"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png",scope:this,handler:function(){this.tagFsitem(a,d,h)}}),new Ext.menu.Item({id:"ctxMnView",text:"Views",icon:"/resources/ajaxhelper/icons/camera.png",scope:this,handler:function(){this.redirectViews(a,d,h)}}),new Ext.menu.Item({id:"ctxMnDelete",text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",scope:this,handler:function(){this.delItem(a,d,h)}}),new Ext.menu.Item({id:"ctxMnRename",text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png",scope:this,handler:function(){this.renameItem(a,d,h)}}),new Ext.menu.Item({id:"ctxMnCopyLink",text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png",scope:this,handler:function(){this.copyLink(a,d,h)}}),new Ext.menu.Item({id:"ctxMnPerms",text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png",scope:this,handler:function(){this.redirectPerms(a,d,h)}}),new Ext.menu.Item({id:"ctxMnProp",text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png",scope:this,handler:function(){this.showRevisions(a,d,h)}}),new Ext.menu.Item({id:"ctxMnArch",text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",scope:this,handler:function(){this.downloadArchive(b)}}),new Ext.menu.Item({id:"ctxMnShare",text:acs_lang_text.sharefolder||"Share Folder",icon:"/resources/ajaxhelper/icons/group_link.png",scope:this,handler:function(){this.showShareOptions(a,d,h)}})]});if(a.getSelectionModel().getCount()>1){Ext.getCmp("ctxMnOpen").hide();Ext.getCmp("ctxMnTag").hide();Ext.getCmp("ctxMnView").hide();Ext.getCmp("ctxMnDelete").hide();Ext.getCmp("ctxMnRename").hide();Ext.getCmp("ctxMnCopyLink").hide();Ext.getCmp("ctxMnPerms").hide();Ext.getCmp("ctxMnProp").hide();Ext.getCmp("ctxMnArch").hide();Ext.getCmp("ctxMnShare").hide()}else{Ext.getCmp("ctxMnOpen").show();Ext.getCmp("ctxMnView").show();Ext.getCmp("ctxMnDelete").show();Ext.getCmp("ctxMnRename").show();Ext.getCmp("ctxMnCopyLink").show();Ext.getCmp("ctxMnPerms").show();switch(k){case"folder":Ext.getCmp("ctxMnTag").hide();Ext.getCmp("ctxMnProp").hide();Ext.getCmp("ctxMnArch").show();if(j.getNodeById(b).attributes.attributes.type=="symlink"){Ext.getCmp("ctxMnShare").hide()}else{Ext.getCmp("ctxMnShare").show()}break;case"url":Ext.getCmp("ctxMnTag").show();Ext.getCmp("ctxMnProp").hide();Ext.getCmp("ctxMnArch").hide();Ext.getCmp("ctxMnShare").hide();break;case"symlink":Ext.getCmp("ctxMnRename").hide();Ext.getCmp("ctxMnShare").hide();break;default:Ext.getCmp("ctxMnTag").show();Ext.getCmp("ctxMnProp").show();Ext.getCmp("ctxMnArch").hide();Ext.getCmp("ctxMnShare").hide()}}if(!this.share_folders_p){Ext.getCmp("ctxMnShare").hide()}if(!this.views_p){Ext.getCmp("ctxMnView").hide()}if(g.get("write_p")!=true){Ext.getCmp("ctxMnTag").hide();Ext.getCmp("ctxMnShare").hide();Ext.getCmp("ctxMnRename").hide()}if(g.get("delete_p")!=true){Ext.getCmp("ctxMnDelete").hide()}if(g.get("admin_p")!=true){Ext.getCmp("ctxMnPerms").hide();Ext.getCmp("ctxMnProp").hide()}var l=h.getXY();this.contextmenu.rowid=d;this.contextmenu.showAt([l[0],l[1]])},loadFoldercontents:function(a,b){this.currentfolder=a.id;var c=this.layout.findById("filepanel");c.store.baseParams.folder_id=a.id;c.store.baseParams.package_id=this.config.package_id;this.resetToolbar(a);c.store.on("load",function(e,d){a.attributes.attributes.size=d.length+" items"},{single:true});if(a.loading){a.on("expand",function(){this.store.load()},c,{single:true})}else{c.store.load()}},openItem:function(f,d,h){var a=this.layout.findById("treepanel");var c=f.store;var b=c.getAt(d);if(b.get("type")=="folder"||b.get("type")=="symlink"){var g=a.getNodeById(b.get("id"));if(!g.parentNode.isExpanded()){g.parentNode.expand()}g.fireEvent("click",g);g.expand()}else{window.open(b.get("url"));window.focus()}},delItem:function(b,s,v){var d=acs_lang_text.confirm_delete||"Are you sure you want to delete ";var j=acs_lang_text.foldercontains||"This folder ";var g=acs_lang_text.delete_error||"Sorry,there was an error trying to delete this item.";var m=this.layout.findById("treepanel");if(b.id=="filepanel"){var t=b;if(t.getSelectionModel().getCount()<=1){t.getSelectionModel().selectRow(s)}}else{var t=this.layout.findById("filepanel")}var p=t.getSelectionModel().getSelections();var o=true;if(p.length>0){o=false;if(p.length==1){var w=p[0].get("title");if(p[0].get("type")==="folder"){var f=j+"contains "+p[0].get("size")+".
"}else{var f=""}var f=f+d+" "+w+" ?";if(p[0].get("type")==="symlink"){var u=p[0].get("symlink_id")}else{var u=p[0].get("id")}}else{var f=d+":

";var u=[];for(var k=0;k"+p[k].get("title")+" ";if(p[k].get("type")==="folder"){f=f+"("+p[k].get("size")+")"}f=f+"
";if(p[k].get("type")==="symlink"){u[k]=p[k].get("symlink_id")}else{u[k]=p[k].get("id")}}}var y={object_id:u}}else{o=true;var q=m.getSelectionModel().getSelectedNode();var u=q.attributes.id;var c=q.attributes.attributes.type;var a=q.attributes.attributes.symlink_id;var r=m.getRootNode();if(c=="symlink"){var y={object_id:a}}else{var y={object_id:u}}if(q.attributes.id==r.attributes.id){Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.cant_del_root||"The root folder can not be deleted.");return}else{if(typeof(q.attributes.attributes.size)=="undefined"){var f=""}else{var f=j+" contains "+q.attributes.attributes.size+".
"}f=f+d+" "+q.attributes.text+"?"}}var h=function(i){var B=Ext.decode(i.responseText);if(B.success){if(o){var C=m.getSelectionModel().getSelectedNode();var z=C.parentNode;z.fireEvent("click",z);z.removeChild(C)}else{for(var e=0;e
"+e.error+"")};var n=function(e){if(e==="yes"){this.fsCore.doAction("delete",h,l,null,y)}};Ext.MessageBox.confirm(acs_lang_text.confirm||"Confirm",f,n,this)},addFolder:function(){var e=this.te;var a=this.layout.findById("treepanel");var c=a.getSelectionModel().getSelectedNode();c.expand();var f=acs_lang_text.new_folder_error||"Sorry, there was an error trying to create your new folder.";var d=function(g){var h=Ext.decode(g.responseText);if(h.success){var i=c.appendChild(new Ext.tree.TreeNode({text:h.pretty_folder_name,id:h.id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:"t",size:"0 items",type:"folder",symlink_id:""}}));a.getSelectionModel().select(i);i.loaded=true;i.fireEvent("click",i);setTimeout(function(){e.editNode=i;e.startEdit(i.ui.textNode)},10)}else{Ext.Msg.alert(acs_lang_text.error||"Error",f+"

"+h.error+"")}};var b=function(g){var h=Ext.decode(g.responseText);Ext.Msg.alert(acs_lang_text.error||"Error",f+"

"+h.error+"")};this.fsCore.doAction("addfolder",d,b,null,{folder_id:c.attributes.id})},createSwfObj:function(){var i=this.layout.findById("treepanel");var d=this.currentfolder;if(this.swfu==null){var a=this;var h=String(this.config.package_id);var p=String(this.config.user_id);var k=String(this.currentfolder);var c=String(this.config.max_file_size);var e="fsuploadprogress";var o=function(w){var v=acs_lang_text.for_upload_to||"for upload to";var s=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)";try{var y=a.currentfolder;var r=i.getNodeById(y).text;var t=new FileProgress(w,e);t.SetStatus(v+" "+r+"
Title: (optional)
"+s);t.ToggleCancel(true,this);this.addFileParam(w.id,"folder_id",y)}catch(u){Ext.Msg.alert(acs_lang_text.error||"Error",u)}};var m=function(){};var n=function(t,v,u){try{if(v===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("You have attempted to queue too many files.\n"+(u===0?"You have reached the upload limit.":"You may select "+(u>1?"up to "+u+" files.":"one file.")));return}var r=new FileProgress(t,e);r.setError();r.toggleCancel(false);switch(v){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:r.setStatus("File is too big.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: File too big, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:r.setStatus("Cannot upload Zero Byte files.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Zero byte file, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:r.setStatus("Invalid File Type.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Invalid File Type, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:Ext.Msg.alert(acs_lang_text.error||"Error","You have selected too many files. "+(u>1?"You may only add "+u+" more files":"You cannot add any more files."));break;default:if(t!==null){r.setStatus("Unhandled Error")}Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: "+v+", File name: "+t.name+", File size: "+t.size+", Message: "+u);break}}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var l=function(){};var b=function(w){var v=acs_lang_text.for_upload_to||"for upload to";var s=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)";try{var y=a.currentfolder;var r=i.getNodeById(y).text;var t=new FileProgress(w,e);t.SetStatus(v+" "+r+"b>
Title: (optional)
"+s);t.ToggleCancel(true,this);this.addFileParam(w.id,"folder_id",y)}catch(u){Ext.Msg.alert(acs_lang_text.error||"Error",u)}};var g=function(w,v,u){try{var t=Math.ceil((v/u)*100);var r=new FileProgress(w,e);r.SetProgress(t);r.SetStatus(acs_lang_text.uploading||"Uploading...")}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var f=function(){var r=i.getNodeById(a.currentfolder);r.fireEvent("click",r)};var q=function(t,v,u){try{var r=new FileProgress(t,e);r.setError();r.ToggleCancel(false);switch(v){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:r.setStatus("Upload Error: "+u);Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: HTTP Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:r.setStatus("Configuration Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: No backend file, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:r.setStatus("Upload Failed.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Upload Failed, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:r.setStatus("Server (IO) Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: IO Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:r.setStatus("Security Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Security Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:r.setStatus("Upload limit exceeded.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Upload Limit Exceeded, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:r.setStatus("File not found.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: The file was not found, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:r.setStatus("Failed Validation. Upload skipped.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: File Validation Failed, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:r.setStatus("Cancelled");r.setCancelled();break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:r.setStatus("Stopped");break;default:r.setStatus("Unhandled Error: "+error_code);Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: "+v+", File name: "+t.name+", File size: "+t.size+", Message: "+u);break}}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var j=function(u,s){try{var r=new FileProgress(u,e);r.SetComplete();r.SetStatus(acs_lang_text.complete||"Complete.");r.ToggleCancel(false)}catch(t){Ext.Msg.alert(acs_lang_text.error||"Error",t)}};this.swfu=new SWFUpload({debug:false,post_params:{user_id:p,package_id:h},file_types:"*.*",button_placeholder_id:"btnSwfUpload",button_image_url:"/resources/ajax-filestorage-ui/resources/FullyTransparent_65x29.png",button_text:"BROWSE",button_width:61,button_height:16,button_text_left_padding:3,button_text_top_padding:0,file_dialog_start_handler:m,file_queued_handler:o,file_queue_error_handler:n,file_dialog_complete_handler:l,upload_start_handler:b,upload_progress_handler:g,upload_error_handler:q,upload_success_handler:j,queue_complete_handler:f,upload_url:this.xmlhttpurl+"add-file-flash",flash_url:"/resources/ajax-filestorage-ui/swfupload/swfupload.swf"})}},addFile:function(){var f=null;if(this.upldWindow==null){if(!this.config.multi_file_upload||checkFlashVersion()<10){f="single";var i=acs_lang_text.file_to_upload||"File to upload";var h=acs_lang_text.file_title||"Title";var g=acs_lang_text.file_description||"Description";var e=acs_lang_text.multiple_files||"Multiple Files";var d=acs_lang_text.multiple_files_msg||"This is a ZIPfile containing multiple files.";var k=true;var j=acs_lang_text.uploadfile||"Upload a File";var c=new Ext.Panel({id:"form_addfile",align:"left",frame:true,html:'

'+i+'


'+h+'


'+g+' :

'+e+' :

'+d+"

"});var a=[{text:acs_lang_text.upload||"Upload",scope:this,handler:this.uploadOneFile,icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:acs_lang_text.close||"Close",scope:this,handler:function(){this.upldWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]}else{f="multiple";var b=acs_lang_text.upload_intro||"Click Upload to select a file to upload to the selected folder on the tree.";var k=false;var j=acs_lang_text.uploadfile||"Upload Files";var c=new Ext.Panel({id:"form_multi_addfile",autoScroll:true,frame:true,html:'
'+b+'
'});var a=[{text:''},{text:acs_lang_text.upload||"Upload",scope:this,handler:function(){this.swfu.startUpload()},icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:"Hide",scope:this,handler:function(){this.upldWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]}this.upldWindow=new Ext.Window({id:"upload-win",layout:"fit",width:400,height:300,title:j,closeAction:"hide",modal:k,plain:true,resizable:false,items:c,buttons:a});if(f=="multiple"){this.upldWindow.on("show",function(){this.createSwfObj()},this,{single:true})}}else{if(!this.config.multi_file_upload||checkFlashVersion()<10){document.getElementById("newfileform").reset();document.getElementById("newfileform").folder_id.value=this.currentfolder}}this.upldWindow.show("btnUploadFile")},uploadOneFile:function(){if(Ext.get("upload_file").getValue()!=""&&Ext.get("filetitle").getValue()!=""){var a=this.layout.findById("treepanel");var d={success:function(){},upload:function(){a.getSelectionModel().getSelectedNode().loaded=false;a.getSelectionModel().getSelectedNode().fireEvent("click",a.getSelectionModel().getSelectedNode());this.upldWindow.body.unmask();this.upldWindow.hide()},failure:function(){Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.")},scope:this};var c=acs_lang_text.loading||"One moment. This may take a while depending on how large your upload is.";this.upldWindow.body.mask("
"+c);YAHOO.util.Connect.setForm("newfileform",true,true);var b=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-file",d)}else{Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.file_required||"Title and File to upload are required.")}},addUrl:function(){if(this.createurlWindow==null){this.createurlWindow=new Ext.Window({id:"createurl-win",layout:"fit",width:400,height:180,title:"Create URL",closeAction:"hide",modal:true,plain:true,resizable:false,items:new Ext.FormPanel({id:"form_create_url",align:"left",autoScroll:true,closable:true,layout:"form",defaults:{width:230},frame:true,buttonAlign:"left",items:[{xtype:"textfield",fieldLabel:"Title",allowBlank:false,name:"fstitle",tabIndex:1},{xtype:"textfield",fieldLabel:"URL",allowBlank:false,name:"fsurl",tabIndex:2,validator:isURL,value:"http://"},{xtype:"textfield",fieldLabel:"Description",name:"fsdescription",tabIndex:3}]}),buttons:[{text:"Submit",scope:this,handler:function(){var b=this.createurlWindow.findById("form_create_url").getForm();if(b.isValid()){var c=function(e,f){if(f.result){var d=this.layout.findById("treepanel");d.getSelectionModel().getSelectedNode().fireEvent("click",d.getSelectionModel().getSelectedNode());this.createurlWindow.hide()}else{Ext.MessageBox.alert("Error","Sorry an error occured.
"+f.result.error)}};var a=function(d,e){if(e.result){Ext.MessageBox.alert("Error",e.result.error)}};this.fsCore.formSubmit("createurl",b,"One moment ....",{package_id:this.config.package_id,folder_id:this.currentfolder},true,c,a,this)}},icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon"},{text:"Close",scope:this,handler:function(){this.createurlWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]})}this.createurlWindow.show()},renameItem:function(b,h,j){var n=acs_lang_text.permission_denied_error||"Sorry, you do not have permission to rename this folder.";if(b.id=="treepanel"){var g=b.getSelectionModel().getSelectedNode();this.te.triggerEdit(g)}else{var o=b;var l=this.layout.findById("treepanel");var g=o.store.getAt(h);var k=g.get("url");var a=g.get("type");var c=g.get("id");var m=g.get("filename");var d=function(e){var r=acs_lang_text.an_error_occurred||"An error occurred";var q=acs_lang_text.reverted||"Your changes have been reverted";var i=Ext.decode(e.responseText);if(!i.success){Ext.Msg.alert(acs_lang_text.error||"Error",r+":

"+i.error+"

"+q)}else{if(a=="folder"){l.getNodeById(c).setText(i.newname)}if(a!="folder"&&m===" "){m=g.get("title");g.set("filename",m)}g.set("title",i.newname);g.commit()}};var p=function(i,q){if(i=="ok"){if(q!=""){if(q.length>100){Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.limitto100||"Please limit your name to 100 characters or less.");return false}else{var e=function(r){var s=Ext.decode(r.responseText);Ext.Msg.alert(acs_lang_text.error||"Error",n+"

"+s.error+"")};this.fsCore.doAction("rename",d,e,null,{newname:q,object_id:c,type:a,url:k})}}else{Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.enter_new_name||"Please enter a new name.");return false}}};Ext.Msg.show({title:acs_lang_text.rename||"Rename",prompt:true,msg:acs_lang_text.enter_new_name||"Please enter a new name for ... ",value:g.get("title"),buttons:Ext.Msg.OKCANCEL,scope:this,fn:p});var f=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");f[0].select()}},tagFsitem:function(a,h,m){var r=a;var c=r.store.getAt(h);var p=c.get("id");var g=c.get("tags");var l=this.config.package_id;var o=this.layout.findById("tagcloudpanel");var n=this.xmlhttpurl;var f=this.tagWindow;var q=function(){c.data.tags=Ext.get("fstags").getValue();c.commit();o.load({url:n+"get-tagcloud",params:{package_id:l}});f.hide()};var b=function(e){Ext.Msg.alert(acs_lang_text.error||"Error","Sorry, we encountered an error.")};var k=function(){this.fsCore.doAction("tag",q,b,null,{object_id:c.id,package_id:l,tags:Ext.get("fstags").getValue()})};if(f==null){var d=new Ext.Panel({id:"form_addtag",autoScroll:true,frame:true,html:"

Enter or edit one or more tags. Use commas (,) to separate the tags:

"});var j=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",scope:this,handler:k},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",scope:this,handler:function(){this.tagWindow.hide()}}];this.tagWindow=new Ext.Window({id:"tag-win",layout:"fit",width:450,height:200,title:"Tags",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:d,buttons:j})}this.tagWindow.show("undefined",function(){Ext.get("fstags").dom.value=g;this.initTagAutoComplete()},this)},initTagAutoComplete:function(){var a=new YAHOO.util.LocalDataSource(oAutoCompArr);if(document.getElementById("fstags")){var b=new YAHOO.widget.AutoComplete("fstags","oAutoCompContainer1",a);b.animHoriz=false;b.animVert=false;b.queryDelay=0;b.maxResultsDisplayed=10;b.useIFrame=true;b.delimChar=",";b.allowBrowserAutocomplete=false;b.typeAhead=true;b.useShadow=true;b.prehighlightClassName="yui-ac-prehighlight";b.formatResult=function(c,e){var d=c[0];return d}}},downloadArchive:function(a){if(a){top.location.href=this.config.package_url+"download-archive/?object_id="+a}},showShareOptions:function(a,h,l){var s=a;var f=s.store.getAt(h);var r=f.get("id");var g=f.get("title");var m=this.layout.findById("treepanel");var k=this.config.package_id;var q=this.xmlhttpurl;var p=this.sharefolderWindow;var j=function(){var e=m.getSelectionModel().getSelectedNode();e.loaded=false;e.collapse();e.fireEvent("click",e);e.expand();p.hide()};var c=function(e){Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later.")};var b=function(){var e=this.communityCombo.getValue();this.fsCore.doAction("sharefolder",j,c,null,{target_folder_id:e,folder_id:r})};if(p==null){var o=new Ext.data.JsonStore({url:q+"list-communities",root:"communities",fields:["target_folder_id","instance_name"]});this.communityCombo=new Ext.form.ComboBox({id:"communities_list",store:o,displayField:"instance_name",typeAhead:true,fieldLabel:"Community",triggerAction:"all",emptyText:"Select a community",hiddenName:"target_folder_id",valueField:"target_folder_id",forceSelection:true,handleHeight:80,selectOnFocus:true});var d=new Ext.form.FormPanel({id:"sharefolderform",title:"Select the community where you wish to share the "+g+" folder with.",frame:true,items:this.communityCombo});var n=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",scope:this,handler:b},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",scope:this,handler:function(){p.hide()}}];p=new Ext.Window({id:"share-win",layout:"fit",width:380,height:200,title:"Share Folder",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:d,buttons:n});this.sharefolderWindow=p}else{this.sharefolderWindow.findById("sharefolderform").setTitle("Select the community where you wish to share the "+g+" folder with.");this.communityCombo.reset()}p.show()},redirectViews:function(a,b,f){if(a.id=="filepanel"){var g=a;var c=g.store.getAt(b);var d=c.get("id")}else{var d=b}window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+d+"/info");window.focus()},redirectPerms:function(a,b,f){if(a.id=="filepanel"){var h=a;var c=h.store.getAt(b);var d=c.get("id")}else{var d=b}var g=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+d+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder);g.focus()},redirectNotifs:function(b,d,h){if(b.id=="filepanel"){var j=b;var f=j.store.getAt(d);var g=f.get("id");var c=f.get("title")}else{var a=b;var f=a.getSelectionModel().getSelectedNode();var g=f.attributes.id;var c=f.text}window.location.href=this.xmlhttpurl+"notif-toggle?pretty_name="+c+"&object_id="+g+"&return_url="+this.config.package_url+"?folder_id="+this.currentfolder},redirectProperties:function(b,a,f){var h=b;var c=h.store.getAt(a);var d=c.get("id");var g=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+d);g.focus()},showRevisions:function(a,d,j){var n=a;var b=n.store.getAt(d);n.getSelectionModel().selectRow(d);var l=b.get("id");var c=b.get("filename");var m=this.revisionsWindow;if(m==null){m=new Ext.Window({id:"rev-win",layout:"fit",width:550,height:300,closeAction:"hide",modal:true,plain:true,items:new Ext.TabPanel({id:"rev-tabs",items:[this.createRevGrid(),this.newRevForm()]})});this.revisionsWindow=m}m.setTitle(c+" - "+acs_lang_text.properties||"Properties");var h=m.findById("revisionspanel");var g=m.findById("rev-tabs");var k=m.findById("rev-form");var f=this.config.package_id;h.store.on("load",function(){this.getSelectionModel().selectFirstRow()},h);h.on("activate",function(){this.store.baseParams.file_id=l;this.store.baseParams.package_id=f;this.store.load()},h);m.on("beforehide",function(){this.activate(1)},g);m.on("show",function(){this.activate(0)},g);m.show()},createRevGrid:function(){var f=[{header:"",width:30,sortable:false,dataIndex:"icon"},{header:"Title",width:180,sortable:false,dataIndex:"title"},{header:"Author",sortable:false,dataIndex:"author"},{header:"Size",sortable:false,dataIndex:"size"},{header:"Last Modified",sortable:false,dataIndex:"lastmodified"}];var a=new Ext.data.JsonReader({totalProperty:"total",root:"revisions",id:"revision_id"},[{name:"revision_id",type:"int"},{name:"icon"},{name:"title"},{name:"author"},{name:"type"},{name:"size"},{name:"url"},{name:"lastmodified"}]);var d=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-filerevisions"});var b=new Ext.grid.ColumnModel(f);var c=new Ext.data.Store({proxy:d,reader:a});var e=[{text:"Download",tooltip:"Download this revision",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",scope:this,handler:function(){var i=this.revisionsWindow.findById("revisionspanel");var h=i.getSelectionModel().getSelected();window.open(h.get("url"));window.focus()}},{text:"Delete",tooltip:"Delete this revision",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",scope:this,handler:function(){var i=this.revisionsWindow.findById("revisionspanel");var l=i.getSelectionModel();var h=l.getSelected();var j=h.get("revision_id");var k=h.get("title");if(i.store.getCount()==1){Ext.Msg.alert("Warning","Sorry, you can not delete the only revision for this file. You can delete the file instead")}else{Ext.Msg.confirm("Delete","Are you sure you want to delete this version of "+k+" ? This action can not be reversed.",function(n){if(n=="yes"){var o=function(p){l.selectPrevious();i.store.remove(h)};var m=function(){Ext.Msg.alert("Delete Error","Sorry an error occurred. Please try again later.")};this.fsCore.doAction("delete-revision",o,m,null,{version_id:j})}},this)}}}];var g=new Ext.grid.GridPanel({store:c,cm:b,sm:new Ext.grid.RowSelectionModel({singleSelect:true}),id:"revisionspanel",title:"Revisions",loadMask:true,tbar:e});return g},newRevForm:function(){var b="Please choose a file to upload";var a=new Ext.Panel({id:"rev-form",align:"left",frame:true,title:"New Revision",html:'

'+b+'

',buttons:[{text:"Upload New Revision",handler:function(e){if(Ext.get("rev_upload_file").dom.value==""){Ext.Msg.alert("Warning","Please choose a file to upload")}else{var d=this.layout.findById("filepanel");var f=d.getSelectionModel().getSelected();Ext.get("rev_file_id").dom.value=f.get("id");Ext.get("rev_file_title").dom.value=f.get("title");var g={success:function(){},upload:function(){this.revisionsWindow.findById("rev-tabs").activate(0);Ext.get("newrevfileform").dom.reset();this.revisionsWindow.findById("rev-form").body.unmask();e.enable()},failure:function(){Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.");this.revisionsWindow.findById("rev-form").body.unmask();e.enable()},scope:this};this.revisionsWindow.findById("rev-form").body.mask("

Uploading new revision. Please wait
");e.disable();YAHOO.util.Connect.setForm("newrevfileform",true,true);var c=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-filerevision",g)}}.createDelegate(this),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"}]});return a},copyLink:function(b,j,k){if(b.id=="treepanel"){if(window.location.port!=""){var d=":"+window.location.port}else{var d=""}var c=window.location.protocol+"//"+window.location.hostname+d+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+j}else{var l=b;var g=l.store.getAt(j);var a=g.get("type");if(a==="folder"){var c=window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+g.get("id")}else{if(a==="url"){var c=g.get("url")}else{var c=window.location.protocol+"//"+window.location.hostname+g.get("url")}}}if(Ext.isIE){window.clipboardData.setData("text",c)}else{var h=Ext.Msg.show({title:acs_lang_text.linkaddress||"Copy Link Address",prompt:true,msg:acs_lang_text.copyhighlighted||"Copy the highlighted text to your clipboard.",value:c,buttons:Ext.Msg.OK});var f=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");f[0].select()}}}; \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js,v diff -u -r1.26 -r1.27 --- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 11 May 2009 03:22:28 -0000 1.26 +++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 25 May 2009 12:36:14 -0000 1.27 @@ -893,13 +893,13 @@ {name:'write_p'}, {name:'symlink_id'}, {name:'size'}, - {name:'lastmodified'}] ); + {name:'lastmodified'}, + {name:'write_p'}, + {name:'admin_p'}] ); var proxy = this.fsCore.createFilePanelProxy(); var colModel = new Ext.grid.ColumnModel(cols); - {name:'delete_p'}, - {name:'admin_p'}, var dataModel = new Ext.data.Store({proxy: proxy, reader: reader, remoteSort: true}); @@ -973,6 +973,7 @@ id: 'rightclickmenu', items: [ new Ext.menu.Item({ + id: 'ctxMnOpen', text: openitem_txt, icon: '/resources/ajaxhelper/icons/page_white.png', scope:this, @@ -981,7 +982,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnOpen', + id: 'ctxMnTag', text: 'Tag', icon: '/resources/ajaxhelper/icons/tag_blue.png', scope:this, @@ -990,7 +991,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnTag', + id: 'ctxMnView', text: 'Views', icon: '/resources/ajaxhelper/icons/camera.png', scope:this, @@ -999,7 +1000,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnView', + id: 'ctxMnDelete', text: acs_lang_text.deletefs || 'Delete', icon: '/resources/ajaxhelper/icons/delete.png', scope:this, @@ -1008,7 +1009,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnDelete', + id: 'ctxMnRename', text: acs_lang_text.rename || 'Rename', icon: '/resources/ajaxhelper/icons/page_edit.png', scope:this, @@ -1017,7 +1018,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnRename', + id: 'ctxMnCopyLink', text: acs_lang_text.linkaddress || 'Copy Link Address', icon: '/resources/ajaxhelper/icons/page_copy.png', scope:this, @@ -1026,7 +1027,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnCopyLink', + id: 'ctxMnPerms', text: acs_lang_text.permissions || 'Permissions', icon: '/resources/ajaxhelper/icons/group_key.png', scope:this, @@ -1035,7 +1036,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnPerms', + id: 'ctxMnProp', text: acs_lang_text.properties || 'Properties', icon: '/resources/ajaxhelper/icons/page_edit.png', scope:this, @@ -1044,7 +1045,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnProp', + id: 'ctxMnArch', text: acs_lang_text.download_archive || 'Download archive', icon: '/resources/ajaxhelper/icons/arrow_down.png', scope:this, @@ -1053,7 +1054,7 @@ } }), new Ext.menu.Item({ - id: 'ctxMnArch', + id: 'ctxMnShare', text: acs_lang_text.sharefolder || 'Share Folder', icon: '/resources/ajaxhelper/icons/group_link.png', scope:this, @@ -1062,7 +1063,6 @@ } }) ] }); - id: 'ctxMnShare', // disable open/download, rename, copy link, permissions and revisions if more than one node item from the view is selected if (grid.getSelectionModel().getCount() > 1) {