Index: openacs-4/packages/ajax-filestorage-ui/catalog/ajax-filestorage-ui.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/catalog/ajax-filestorage-ui.en_US.ISO-8859-1.xml,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ajax-filestorage-ui/catalog/ajax-filestorage-ui.en_US.ISO-8859-1.xml 3 Aug 2008 02:23:36 -0000 1.4 +++ openacs-4/packages/ajax-filestorage-ui/catalog/ajax-filestorage-ui.en_US.ISO-8859-1.xml 18 Mar 2009 23:53:04 -0000 1.5 @@ -1,5 +1,5 @@ - + Alert Browse @@ -28,7 +28,7 @@ File File List File to upload - This folder contains + This folder A folder name is required for upload to <b>URL</b> is not a valid url. Index: openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp,v diff -u -r1.11 -r1.12 --- openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp 27 Dec 2008 06:27:24 -0000 1.11 +++ openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp 18 Mar 2009 23:53:04 -0000 1.12 @@ -105,16 +105,13 @@ multiple_files_msg: "#ajax-filestorage-ui.ThisIsAZip#", download:"#file-storage.Download#", download_archive: "#ajax-filestorage-ui.DownloadArchive#", - request_notification:'@subscribe_link', - unsubscribe_notification:'@unsubscribe_link', + request_notification:"#notifications.Notification#", + unsubscribe_notification:"#notifications.Unsubscribe#", tools:"#ajax-filestorage-ui.Tools#", tag:"#ajax-filestorage-ui.Tag#", views:"#ajax-filestorage-ui.Views#" } - Ext.onReady(function() { - Ext.get("@layoutdiv;noquote@").setHeight(400,false); - Ext.get("@layoutdiv;noquote@").update(" "); - }); var fsInstance = new ajaxfs({@options;noquote@}); + \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl 27 Dec 2008 06:27:24 -0000 1.10 +++ openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl 18 Mar 2009 23:53:04 -0000 1.11 @@ -129,11 +129,4 @@ ad_return_complaint 1 "Package id is required." ad_script_abort -} - - -foreach {subscribe_url unsubscribe_url} [notification::display::get_urls -type "fs_fs_notif_type" -object_id $folder_id -pretty_name $instance_name] {break} - -set unsubscribe_link [_ notifications.lt_You_have_requested_no [list pretty_name $instance_name sub_url $unsubscribe_url]] - -set subscribe_link [_ notifications.lt_You_may_a_hrefsub_url [list pretty_name $instance_name sub_url $subscribe_url]] +} \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/www/resources/FullyTransparent_65x29.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/FullyTransparent_65x29.png,v diff -u Binary files differ 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.19 -r1.20 --- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js 27 Dec 2008 12:16:47 -0000 1.19 +++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js 18 Mar 2009 23:53:04 -0000 1.20 @@ -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){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")}b.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(a.id)}});return b},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:"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;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,r,u){var d=acs_lang_text.confirm_delete||"Are you sure you want to delete ";var h=acs_lang_text.foldercontains||"This folder ";var l=this.layout.findById("treepanel");if(b.id=="filepanel"){var s=b;if(s.getSelectionModel().getCount()<=1){s.getSelectionModel().selectRow(r)}}else{var s=this.layout.findById("filepanel")}var o=s.getSelectionModel().getSelections();var n=true;if(o.length>0){n=false;if(o.length==1){var v=o[0].get("title");if(o[0].get("type")==="folder"){var f=h+"contains "+o[0].get("size")+".
"}else{var f=""}var f=f+d+" "+v+" ?";if(o[0].get("type")==="symlink"){var t=o[0].get("symlink_id")}else{var t=o[0].get("id")}}else{var f=d+":

";var t=[];for(var j=0;j"+o[j].get("title")+" ";if(o[j].get("type")==="folder"){f=f+"("+o[j].get("size")+")"}f=f+"
";if(o[j].get("type")==="symlink"){t[j]=o[j].get("symlink_id")}else{t[j]=o[j].get("id")}}}var w={object_id:t}}else{n=true;var p=l.getSelectionModel().getSelectedNode();var t=p.attributes.id;var c=p.attributes.attributes.type;var a=p.attributes.attributes.symlink_id;var q=l.getRootNode();if(c=="symlink"){var w={object_id:a}}else{var w={object_id:t}}if(p.attributes.id==q.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(p.attributes.attributes.size)=="undefined"){var f=""}else{var f=h+" contains "+p.attributes.attributes.size+".
"}f=f+d+" "+p.attributes.text+"?"}}var g=function(i){var A=Ext.decode(i.responseText);if(A.success){if(n){var B=l.getSelectionModel().getSelectedNode();var y=B.parentNode;y.fireEvent("click",y);y.removeChild(B)}else{for(var e=0;e
"+resultObj.error+"")};var m=function(e){if(e==="yes"){this.fsCore.doAction("delete",g,k,null,w)}};Ext.MessageBox.confirm(acs_lang_text.confirm||"Confirm",f,m,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,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()<9||Ext.isLinux){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="Upload Files";var c=new Ext.Panel({id:"form_multi_addfile",autoScroll:true,frame:true,html:'
'+b+'
'});var a=['',{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()<9||Ext.isLinux){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){if(b.id=="treepanel"){var g=b.getSelectionModel().getSelectedNode();this.te.triggerEdit(g)}else{var n=b;var l=this.layout.findById("treepanel");var g=n.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 q=acs_lang_text.an_error_occurred||"An error occurred";var p=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",q+":

"+i.error+"

"+p)}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 o=function(i,p){if(i=="ok"){if(p!=""){if(p.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(q){var r=Ext.decode(q.responseText);Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"

"+r.error+"")};this.fsCore.doAction("rename",d,e,null,{newname:p,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:o});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})}})}}}];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){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")}b.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(a.id)}});return b},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:"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;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,r,u){var d=acs_lang_text.confirm_delete||"Are you sure you want to delete ";var h=acs_lang_text.foldercontains||"This folder ";var l=this.layout.findById("treepanel");if(b.id=="filepanel"){var s=b;if(s.getSelectionModel().getCount()<=1){s.getSelectionModel().selectRow(r)}}else{var s=this.layout.findById("filepanel")}var o=s.getSelectionModel().getSelections();var n=true;if(o.length>0){n=false;if(o.length==1){var v=o[0].get("title");if(o[0].get("type")==="folder"){var f=h+"contains "+o[0].get("size")+".
"}else{var f=""}var f=f+d+" "+v+" ?";if(o[0].get("type")==="symlink"){var t=o[0].get("symlink_id")}else{var t=o[0].get("id")}}else{var f=d+":

";var t=[];for(var j=0;j"+o[j].get("title")+" ";if(o[j].get("type")==="folder"){f=f+"("+o[j].get("size")+")"}f=f+"
";if(o[j].get("type")==="symlink"){t[j]=o[j].get("symlink_id")}else{t[j]=o[j].get("id")}}}var w={object_id:t}}else{n=true;var p=l.getSelectionModel().getSelectedNode();var t=p.attributes.id;var c=p.attributes.attributes.type;var a=p.attributes.attributes.symlink_id;var q=l.getRootNode();if(c=="symlink"){var w={object_id:a}}else{var w={object_id:t}}if(p.attributes.id==q.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(p.attributes.attributes.size)=="undefined"){var f=""}else{var f=h+" contains "+p.attributes.attributes.size+".
"}f=f+d+" "+p.attributes.text+"?"}}var g=function(i){var A=Ext.decode(i.responseText);if(A.success){if(n){var B=l.getSelectionModel().getSelectedNode();var y=B.parentNode;y.fireEvent("click",y);y.removeChild(B)}else{for(var e=0;e
"+resultObj.error+"")};var m=function(e){if(e==="yes"){this.fsCore.doAction("delete",g,k,null,w)}};Ext.MessageBox.confirm(acs_lang_text.confirm||"Confirm",f,m,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,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()<9||Ext.isLinux){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="Upload Files";var c=new Ext.Panel({id:"form_multi_addfile",autoScroll:true,frame:true,html:'
'+b+'
'});var a=['',{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()<9||Ext.isLinux){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){if(b.id=="treepanel"){var g=b.getSelectionModel().getSelectedNode();this.te.triggerEdit(g)}else{var n=b;var l=this.layout.findById("treepanel");var g=n.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 q=acs_lang_text.an_error_occurred||"An error occurred";var p=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",q+":

"+i.error+"

"+p)}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 o=function(i,p){if(i=="ok"){if(p!=""){if(p.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(q){var r=Ext.decode(q.responseText);Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"

"+r.error+"")};this.fsCore.doAction("rename",d,e,null,{newname:p,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:o});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.22 -r1.23 --- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 27 Dec 2008 12:16:47 -0000 1.22 +++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 18 Mar 2009 23:53:04 -0000 1.23 @@ -303,8 +303,11 @@ var layoutitems = [this.createLeft(),this.createRight()] - if (this.config != null && this.config.layoutdiv) { + 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', @@ -407,7 +410,7 @@ this.fsCore.doAction('checknotif',success, failure, null,{ object_id:treepanel.getSelectionModel().getSelectedNode().attributes["id"] }); Ext.getCmp('mnNotif').enable(); - + if(this.share_folders_p) { Ext.getCmp('mnShare').enable() } break; case "symlink": Ext.getCmp('mnOpen').setText(acs_lang_text.open || 'Open'); @@ -1522,7 +1525,7 @@ if(this.upldWindow == null) { - if (!this.config.multi_file_upload || checkFlashVersion() < 9 || Ext.isLinux) { + if (!this.config.multi_file_upload || checkFlashVersion() < 9 || Ext.isLinux || Ext.isMac) { /*** Single File Upload *******/ mode = 'single'; @@ -2227,7 +2230,7 @@ } this.fsCore.doAction('delete-revision',success, failure, null,{version_id:version_id}); } - }) + },this) } } }