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.3 -r1.4 --- openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl 26 Nov 2007 12:52:43 -0000 1.3 +++ openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl 13 Dec 2007 05:33:42 -0000 1.4 @@ -17,6 +17,7 @@ set debug [parameter::get -package_id [ajaxfs::get_package_id] -parameter "debug" -default 1] set create_url_p [parameter::get -package_id $package_id -parameter "EnableCreateUrl" -default 1] +set share_folders_p [parameter::get -package_id $package_id -parameter "EnableFolderShare" -default 0] set multi_file_upload_p [parameter::get -package_id $package_id -parameter "EnableMultiUpload" -default 1] set max_file_size [parameter::get -package_id $package_id -parameter "MaximumFileSize" -default 2000000] set user_id [ad_conn user_id] @@ -82,6 +83,7 @@ lappend options "max_file_size:\"$max_file_size\"" lappend options "create_url:$create_url_p" + lappend options "share_folders:$share_folders_p" lappend options "multi_file_upload:$multi_file_upload_p" lappend options "user_id:\"$user_id\"" 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.3 -r1.4 --- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js 26 Nov 2007 12:52:43 -0000 1.3 +++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js 13 Dec 2007 05:33:42 -0000 1.4 @@ -3,6 +3,7 @@ ajaxfs=function(_1){ this.xmlhttpurl="/ajaxfs/xmlhttp/"; this.create_url_p=true; +this.share_folders_p=true; this.config=null; this.layout=null; this.te=null; @@ -13,8 +14,11 @@ this.upldWindow=null; this.tagWindow=null; this.createurlWindow=null; +this.sharefolderWindow=null; this.contextmenu=null; this.swfu=null; +this.target_folder_id=null; +this.communityCombo=null; this.initObj=function(){ if(typeof (Ext.DomHelper)!="undefined"){ if(_1){ @@ -25,6 +29,9 @@ if(this.config.create_url&&this.config.create_url==0){ this.create_url_p=false; } +if(this.config.share_folders&&this.config.share_folders==0){ +this.share_folders_p=false; +} if(!this.config.ispublic){ Ext.Ajax.on("requestcomplete",this.isSessionExpired,this); } @@ -80,176 +87,256 @@ }else{ this.layout=new Ext.Viewport({id:"fs-ui",layout:"border",tbar:this.createToolbar(),items:_f}); } +},createToolsMenu:function(){ +var _10=new Ext.menu.Menu({id:"toolsmenu",items:[new Ext.menu.Item({id:"mnOpen",text:"Open",icon:"/resources/ajaxhelper/icons/page_white.png"}),new Ext.menu.Item({id:"mnTag",text:"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png"}),new Ext.menu.Item({id:"mnView",text:"Views",icon:"/resources/ajaxhelper/icons/camera.png"}),new Ext.menu.Item({id:"mnRename",text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png"}),new Ext.menu.Item({id:"mnCopyLink",text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png"}),new Ext.menu.Item({id:"mnPerms",text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png"}),new Ext.menu.Item({id:"mnProp",text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png"}),new Ext.menu.Item({id:"mnArch",text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png"}),new Ext.menu.Item({id:"mnShare",text:acs_lang_text.sharefolder||"Share Folder",icon:"/resources/ajaxhelper/icons/group_link.png"})]}); +_10.on("beforeshow",function(){ +var _11=this.layout.findById("filepanel"); +if(_11.getSelectionModel().getCount()==1){ +var _12=_11.getSelectionModel().getSelections(); +for(var x=0;x<_10.items.items.length;x++){ +_10.items.items[x].enable(); +} +switch(_12[0].get("type")){ +case "folder": +_10.items.items[0].setText("Open"); +_10.items.items[1].disable(); +_10.items.items[6].disable(); +break; +case "symlink": +_10.items.items[0].setText("Open"); +_10.items.items[1].disable(); +_10.items.items[3].disable(); +_10.items.items[6].disable(); +break; +default: +_10.items.items[0].setText("Download"); +_10.items.items[7].disable(); +_10.items.items[8].disable(); +break; +} +if(!this.share_folders_p){ +_10.items.items[8].disable(); +} +}else{ +for(var x=0;x<_10.items.items.length;x++){ +_10.items.items[x].disable(); +} +} +},this); +_10.on("itemclick",function(_14,e){ +var _16=this.layout.findById("filepanel"); +var _17=_16.getSelectionModel().getSelected(); +var _18=_17.get("id"); +for(var x=0;x<_16.store.data.items.length;x++){ +if(_16.store.data.items[x].id==_18){ +var i=x; +break; +} +} +switch(_14.getId()){ +case "mnOpen": +this.openItem(_16,i); +break; +case "mnTag": +this.tagFsitem(_16,i); +break; +case "mnView": +this.redirectViews(_16,i); +break; +case "mnRename": +this.renameItem(_16,i); +break; +case "mnCopyLink": +this.copyLink(_16,i); +break; +case "mnPerms": +this.redirectPerms(_16,i); +break; +case "mnProp": +this.redirectProperties(_16,i); +break; +case "mnArch": +this.downloadArchive(_18); +break; +case "mnShare": +this.showShareOptions(_16,i); +break; +} +},this); +var _1b={text:"Tools",iconCls:"toolsmenu",menu:_10}; +return _1b; },createToolbar:function(){ -var _10=this.config.treerootnode; -var _11=[]; -if(_10.attributes["write_p"]=="t"){ -var _11=[" ",{text:acs_lang_text.newfolder||"New Folder",tooltip:acs_lang_text.newfolder||"New Folder",icon:"/resources/ajaxhelper/icons/folder_add.png",cls:"x-btn-text-icon",handler:this.addFolder.createDelegate(this)},{text:acs_lang_text.uploadfile||"Upload Files",tooltip:acs_lang_text.uploadfile||"Upload Files",icon:"/resources/ajaxhelper/icons/page_add.png",cls:"x-btn-text-icon",handler:this.addFile.createDelegate(this)}]; +var _1c=this.config.treerootnode; +var _1d=[]; +if(_1c.attributes["write_p"]=="t"){ +var _1d=[" ",{text:acs_lang_text.newfolder||"New Folder",tooltip:acs_lang_text.newfolder||"New Folder",icon:"/resources/ajaxhelper/icons/folder_add.png",cls:"x-btn-text-icon",handler:this.addFolder.createDelegate(this)},{text:acs_lang_text.uploadfile||"Upload Files",tooltip:acs_lang_text.uploadfile||"Upload Files",icon:"/resources/ajaxhelper/icons/page_add.png",cls:"x-btn-text-icon",handler:this.addFile.createDelegate(this)}]; if(this.create_url_p){ -_11.push({text:acs_lang_text.createurl||"Create Url",tooltip:acs_lang_text.createurl||"Create Url",icon:"/resources/ajaxhelper/icons/page_link.png",cls:"x-btn-text-icon",handler:this.addUrl.createDelegate(this)}); +_1d.push({text:acs_lang_text.createurl||"Create Url",tooltip:acs_lang_text.createurl||"Create Url",icon:"/resources/ajaxhelper/icons/page_link.png",cls:"x-btn-text-icon",handler:this.addUrl.createDelegate(this)}); } -_11.push({text:acs_lang_text.deletefs||"Delete",tooltip:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",handler:this.delItem.createDelegate(this)}); -_11.push("->"); +_1d.push({text:acs_lang_text.deletefs||"Delete",tooltip:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",handler:this.delItem.createDelegate(this)}); +_1d.push(this.createToolsMenu()); +_1d.push("->"); } -_11.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",handler:this.downloadArchive.createDelegate(this,[_10.id],false)}); -return _11; +_1d.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",handler:this.downloadArchive.createDelegate(this,[_1c.id],false)}); +return _1d; },createLeft:function(){ -var _12=new Ext.Panel({id:"leftpanel",region:"west",collapsible:true,titlebar:true,title:" ",layout:"accordion",split:true,width:300,items:[this.createTreePanel(),this.createTagPanel()]}); -return _12; +var _1e=new Ext.Panel({id:"leftpanel",region:"west",collapsible:true,titlebar:true,title:" ",layout:"accordion",split:true,width:300,items:[this.createTreePanel(),this.createTagPanel()]}); +return _1e; },createTreePanel:function(){ -var _13=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 _14=new Ext.tree.TreeLoader({dataUrl:this.xmlhttpurl+"load-treenodes",baseParams:{package_id:this.config.package_id}}); -var _15=new Ext.tree.TreePanel({id:"treepanel",title:"Folders",autoScroll:true,animate:true,enableDrag:false,enableDrop:true,loadMask:true,loader:_14,root:_13,ddAppendOnly:true,containerScroll:true,dropConfig:{dropAllowed:true,ddGroup:"fileDD",onNodeOver:function(_16,_17,e,_19){ -if(_16.node.id==_16.node.ownerTree.getSelectionModel().getSelectedNode().id){ +var _1f=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 _20=new Ext.tree.TreeLoader({dataUrl:this.xmlhttpurl+"load-treenodes",baseParams:{package_id:this.config.package_id}}); +var _21=new Ext.tree.TreePanel({id:"treepanel",title:"Folders",autoScroll:true,animate:true,enableDrag:false,enableDrop:true,loadMask:true,loader:_20,root:_1f,ddAppendOnly:true,containerScroll:true,dropConfig:{dropAllowed:true,ddGroup:"fileDD",onNodeOver:function(_22,_23,e,_25){ +if(_22.node.id==_22.node.ownerTree.getSelectionModel().getSelectedNode().id){ return false; } -if(_17.dragData.selections){ -for(var x=0;x<_17.dragData.selections.length;x++){ -if(_16.node.id==_17.dragData.selections[x].data.id){ +if(_23.dragData.selections){ +for(var x=0;x<_23.dragData.selections.length;x++){ +if(_22.node.id==_23.dragData.selections[x].data.id){ return false; } } } return true; -},onNodeDrop:function(_1b,_1c,e,_1e){ -var _1f=this.layout.findById("filepanel"); -var _20=_1b.node.id; -var _21=[]; -for(var x=0;x<_1e.selections.length;x++){ -_21[x]=_1e.selections[x].data.id; +},onNodeDrop:function(_27,_28,e,_2a){ +var _2b=this.layout.findById("filepanel"); +var _2c=_27.node.id; +var _2d=[]; +for(var x=0;x<_2a.selections.length;x++){ +_2d[x]=_2a.selections[x].data.id; } -var _23=acs_lang_text.an_error_occurred||"An error occurred"; -var _24=acs_lang_text.reverted||"Your changes have been reverted"; -var _25=function(_26){ -var _27=Ext.decode(_26.responseText); -if(_27.success){ -var dm=_1f.store; -var _29=_1f.getSelectionModel().getSelections(); -var _2a=false; -for(var x=0;x<_29.length;x++){ -dm.remove(_29[x]); -if(_29[x].data.type=="folder"){ -_2a=true; -if(_1b.node.ownerTree.getNodeById(_29[x].data.id)){ -var _2c=_1b.node.ownerTree.getNodeById(_29[x].data.id).parentNode; -_2c.loaded=false; -_2c.removeChild(_1b.node.ownerTree.getNodeById(_29[x].data.id)); +var _2f=acs_lang_text.an_error_occurred||"An error occurred"; +var _30=acs_lang_text.reverted||"Your changes have been reverted"; +var _31=function(_32){ +var _33=Ext.decode(_32.responseText); +if(_33.success){ +var dm=_2b.store; +var _35=_2b.getSelectionModel().getSelections(); +var _36=false; +for(var x=0;x<_35.length;x++){ +dm.remove(_35[x]); +if(_35[x].data.type=="folder"){ +_36=true; +if(_27.node.ownerTree.getNodeById(_35[x].data.id)){ +var _38=_27.node.ownerTree.getNodeById(_35[x].data.id).parentNode; +_38.loaded=false; +_38.removeChild(_27.node.ownerTree.getNodeById(_35[x].data.id)); } } } -if(_2a){ -var _2d=_1b.node.ownerTree.getRootNode(); -if(_2d.id==_1b.node.id){ -_2d.fireEvent("click",_2d); +if(_36){ +var _39=_27.node.ownerTree.getRootNode(); +if(_39.id==_27.node.id){ +_39.fireEvent("click",_39); } -_1b.node.loaded=false; -_1b.node.expand(); +_27.node.loaded=false; +_27.node.expand(); } }else{ -Ext.Msg.alert(acs_lang_text.error||"Error",_23+"
"+_24); +Ext.Msg.alert(acs_lang_text.error||"Error",_2f+"
"+_30); } }; -Ext.Ajax.request({url:this.xmlhttpurl+"move-fsitem",success:_25,failure:function(){ -Ext.Msg.alert(acs_lang_text.error||"Error",_23+"
"+_24); -},params:{folder_target_id:_20,file_ids:_21}}); +Ext.Ajax.request({url:this.xmlhttpurl+"move-fsitem",success:_31,failure:function(){ +Ext.Msg.alert(acs_lang_text.error||"Error",_2f+"
"+_30); +},params:{folder_target_id:_2c,file_ids:_2d}}); return true; }.createDelegate(this)}}); -this.enableTreeFolderRename(_15); -_13.on("expand",this.selectInitFolder,this,{single:true}); -_15.on("click",this.loadFoldercontents,this); -return _15; -},enableTreeFolderRename:function(_2e){ -this.te=new Ext.tree.TreeEditor(_2e,{allowBlank:false,blankText:acs_lang_text.folder_name_required||"A folder name is required",editDelay:20,ignoreNoChange:true}); -this.te.on("beforestartedit",function(_2f,el,_31){ -if(_2f.editNode.attributes.attributes.write_p=="t"){ +this.enableTreeFolderRename(_21); +_1f.on("expand",this.selectInitFolder,this,{single:true}); +_21.on("click",this.loadFoldercontents,this); +return _21; +},enableTreeFolderRename:function(_3a){ +this.te=new Ext.tree.TreeEditor(_3a,{allowBlank:false,blankText:acs_lang_text.folder_name_required||"A folder name is required",editDelay:20,ignoreNoChange:true}); +this.te.on("beforestartedit",function(_3b,el,_3d){ +if(_3b.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(_32,_33,_34){ -var _35=_32.editNode.parentNode; -if(_35){ -var _36=_35.childNodes; -for(x=0;x<_36.length;x++){ -if(_36[x].text==_33&&_36[x].id!=_32.editNode.id){ +this.te.on("beforecomplete",function(_3e,_3f,_40){ +var _41=_3e.editNode.parentNode; +if(_41){ +var _42=_41.childNodes; +for(x=0;x<_42.length;x++){ +if(_42[x].text==_3f&&_42[x].id!=_3e.editNode.id){ Ext.Msg.alert(acs_lang_text.duplicate_name||"Duplicate Name",acs_lang_text.duplicate_name_error||"Please enter a different name. The name you entered is already being used."); return false; } } } return true; },this,true); -this.te.on("complete",function(_37,_38,_39){ -var _3a=acs_lang_text.an_error_occurred||"An error occurred"; -var _3b=acs_lang_text.reverted||"Your changes have been reverted"; -Ext.Ajax.request({url:this.xmlhttpurl+"rename-fsitem",success:function(_3c){ -var _3d=Ext.decode(_3c.responseText); -if(!_3d.success){ -Ext.Msg.alert(acs_lang_text.error||"Error",_3a+":

"+_3d.error+"

"+_3b); -_37.editNode.setText(_39); +this.te.on("complete",function(_43,_44,_45){ +var _46=acs_lang_text.an_error_occurred||"An error occurred"; +var _47=acs_lang_text.reverted||"Your changes have been reverted"; +Ext.Ajax.request({url:this.xmlhttpurl+"rename-fsitem",success:function(_48){ +var _49=Ext.decode(_48.responseText); +if(!_49.success){ +Ext.Msg.alert(acs_lang_text.error||"Error",_46+":

"+_49.error+"

"+_47); +_43.editNode.setText(_45); } },failure:function(){ -Ext.Msg.alert(acs_lang_text.error||"Error",_3a+"
"+_3b); -_37.editNode.setText(_39); -},params:{newname:_38,object_id:_37.editNode.id,type:"folder"}}); +Ext.Msg.alert(acs_lang_text.error||"Error",_46+"
"+_47); +_43.editNode.setText(_45); +},params:{newname:_44,object_id:_43.editNode.id,type:"folder"}}); },this,true); },createTagPanel:function(){ -var _3e=new Ext.Panel({id:"tagcloudpanel",title:"Tags",frame:false,loadMask:true,autoLoad:{url:this.xmlhttpurl+"get-tagcloud",params:{package_id:this.config.package_id}}}); -var _3f=function(){ -var _40=this; -var _41=_40.currenttag; -_3e.body.on("click",function(obj,el){ +var _4a=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 _4b=function(){ +var _4c=this; +var _4d=_4c.currenttag; +_4a.body.on("click",function(obj,el){ if(el.tagName=="A"){ -if(_41!=null){ -Ext.get(_41).setStyle("font-weight","normal"); +if(_4d!=null){ +Ext.get(_4d).setStyle("font-weight","normal"); } Ext.get(el).setStyle("font-weight","bold"); -_41=el.id; +_4d=el.id; this.loadTaggedFiles(el.id); } },this); }; -_3e.on("render",_3f,this); -return _3e; -},loadTaggedFiles:function(_44){ +_4a.on("render",_4b,this); +return _4a; +},loadTaggedFiles:function(_50){ this.layout.findById("treepanel").getSelectionModel().clearSelections(); -var id=_44.substring(3,_44.length); +var id=_50.substring(3,_50.length); this.layout.findById("filepanel").store.baseParams["tag_id"]=id; this.layout.findById("filepanel").store.load(); this.layout.findById("filepanel").store.baseParams["tag_id"]=""; },createRight:function(){ -var _46=[{header:"",width:30,sortable:true,dataIndex:"icon"},{header:acs_lang_text.filename||"Filename",id:"filename",sortable:true,dataIndex:"title"},{header:acs_lang_text.size||"Size",sortable:true,dataIndex:"size"},{header:acs_lang_text.lastmodified||"Last Modified",sortable:true,dataIndex:"lastmodified"}]; -var _47=new Ext.data.JsonReader({totalProperty:"total",root:"foldercontents",id:"id"},[{name:"id",type:"int"},{name:"icon"},{name:"title"},{name:"filename"},{name:"type"},{name:"tags"},{name:"url"},{name:"write_p"},{name:"size"},{name:"lastmodified"}]); -var _48=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-foldercontents"}); -var _49=new Ext.grid.ColumnModel(_46); -var _4a=new Ext.data.Store({proxy:_48,reader:_47,remoteSort:true}); -var _4b=new Ext.grid.GridPanel({store:_4a,cm:_49,id:"filepanel",ddGroup:"fileDD",region:"center",split:true,autoScroll:true,autoExpandColumn:"filename",collapsible:true,enableDragDrop:true,width:250,loadMask:true,frame:false,viewConfig:{forceFit:false,enableRowBody:true,showPreview:true,getRowClass:function(_4c,_4d,p,ds){ +var _52=[{header:"",width:30,sortable:true,dataIndex:"icon"},{header:acs_lang_text.filename||"Filename",id:"filename",sortable:true,dataIndex:"title"},{header:acs_lang_text.size||"Size",sortable:true,dataIndex:"size"},{header:acs_lang_text.lastmodified||"Last Modified",sortable:true,dataIndex:"lastmodified"}]; +var _53=new Ext.data.JsonReader({totalProperty:"total",root:"foldercontents",id:"id"},[{name:"id",type:"int"},{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 _54=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-foldercontents"}); +var _55=new Ext.grid.ColumnModel(_52); +var _56=new Ext.data.Store({proxy:_54,reader:_53,remoteSort:true}); +var _57=new Ext.grid.GridPanel({store:_56,cm:_55,id:"filepanel",ddGroup:"fileDD",region:"center",split:true,autoScroll:true,autoExpandColumn:"filename",collapsible:true,enableDragDrop:true,width:250,loadMask:true,frame:false,viewConfig:{forceFit:false,enableRowBody:true,showPreview:true,getRowClass:function(_58,_59,p,ds){ var xf=Ext.util.Format; -if(_4c.data.tags!=""){ -p.body="
Tags: "+xf.ellipsis(xf.stripTags(_4c.data.tags),200)+"
"; +if(_58.data.tags!=""){ +p.body="
Tags: "+xf.ellipsis(xf.stripTags(_58.data.tags),200)+"
"; }else{ -p.body="
"; +p.body="
"; } return "x-grid3-row-expanded"; }}}); -_4b.on("rowdblclick",this.openItem,this,true); -_4b.on("rowcontextmenu",this.showRowContext,this,true); -return _4b; -},showRowContext:function(_51,i,e){ +_57.on("rowdblclick",this.openItem,this,true); +_57.on("rowcontextmenu",this.showRowContext,this,true); +return _57; +},showRowContext:function(_5d,i,e){ e.stopEvent(); -var dm=_51.store; -var _55=dm.getAt(i); -var _56=_55.get("type"); -var _57=_55.get("id"); -if(_56=="folder"){ -var _58="Open"; +var _60=this.layout.findById("treepanel"); +var dm=_5d.store; +var _62=dm.getAt(i); +var _63=_62.get("type"); +var _64=_62.get("id"); +if(_63=="folder"){ +var _65="Open"; }else{ -var _58="Download"; +var _65="Download"; } -this.contextmenu=new Ext.menu.Menu({id:"rightclickmenu",items:[new Ext.menu.Item({text:_58,icon:"/resources/ajaxhelper/icons/page_white.png",handler:this.openItem.createDelegate(this,[_51,i,e],false)}),new Ext.menu.Item({text:"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png",handler:this.tagFsitem.createDelegate(this,[_51,i,e],false)}),new Ext.menu.Item({text:"Views",icon:"/resources/ajaxhelper/icons/camera.png",handler:this.redirectViews.createDelegate(this,[_51,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",handler:this.delItem.createDelegate(this,[_51,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png",handler:this.renameItem.createDelegate(this,[_51,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png",handler:this.copyLink.createDelegate(this,[_51,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png",handler:this.redirectPerms.createDelegate(this,[_51,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png",handler:this.redirectProperties.createDelegate(this,[_51,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",handler:this.downloadArchive.createDelegate(this,[_57],false)})]}); -if(_51.getSelectionModel().getCount()>1){ +this.contextmenu=new Ext.menu.Menu({id:"rightclickmenu",items:[new Ext.menu.Item({text:_65,icon:"/resources/ajaxhelper/icons/page_white.png",handler:this.openItem.createDelegate(this,[_5d,i,e],false)}),new Ext.menu.Item({text:"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png",handler:this.tagFsitem.createDelegate(this,[_5d,i,e],false)}),new Ext.menu.Item({text:"Views",icon:"/resources/ajaxhelper/icons/camera.png",handler:this.redirectViews.createDelegate(this,[_5d,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",handler:this.delItem.createDelegate(this,[_5d,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png",handler:this.renameItem.createDelegate(this,[_5d,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png",handler:this.copyLink.createDelegate(this,[_5d,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png",handler:this.redirectPerms.createDelegate(this,[_5d,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png",handler:this.redirectProperties.createDelegate(this,[_5d,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",handler:this.downloadArchive.createDelegate(this,[_64],false)}),new Ext.menu.Item({text:acs_lang_text.sharefolder||"Share Folder",icon:"/resources/ajaxhelper/icons/group_link.png",handler:this.showShareOptions.createDelegate(this,[_5d,i,e],false)})]}); +if(_5d.getSelectionModel().getCount()>1){ this.contextmenu.items.items[0].hide(); this.contextmenu.items.items[1].hide(); this.contextmenu.items.items[2].hide(); @@ -259,119 +346,150 @@ 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(); -if(_56=="folder"){ +if(_63=="folder"){ this.contextmenu.items.items[1].hide(); this.contextmenu.items.items[7].hide(); this.contextmenu.items.items[8].show(); +if(_60.getNodeById(_64).attributes.attributes.type=="symlink"){ +this.contextmenu.items.items[9].hide(); }else{ +this.contextmenu.items.items[9].show(); +} +}else{ +if(_63=="symlink"){ +this.contextmenu.items.items[4].hide(); +this.contextmenu.items.items[9].hide(); +}else{ this.contextmenu.items.items[1].show(); this.contextmenu.items.items[7].show(); this.contextmenu.items.items[8].hide(); +this.contextmenu.items.items[9].hide(); } } -var _59=e.getXY(); +} +if(!this.share_folders_p){ +this.contextmenu.items.items[9].hide(); +} +var _66=e.getXY(); this.contextmenu.rowid=i; -this.contextmenu.showAt([_59[0],_59[1]]); -},loadFoldercontents:function(_5a,e){ -this.currentfolder=_5a.id; -var _5c=this.layout.findById("filepanel"); -_5c.store.baseParams["folder_id"]=_5a.id; -if(_5a.loading){ -_5a.on("expand",function(){ +this.contextmenu.showAt([_66[0],_66[1]]); +},loadFoldercontents:function(_67,e){ +this.currentfolder=_67.id; +var _69=this.layout.findById("filepanel"); +_69.store.baseParams["folder_id"]=_67.id; +_69.store.baseParams["package_id"]=this.config.package_id; +if(_67.loading){ +_67.on("expand",function(){ this.store.load(); -},_5c,{single:true}); +},_69,{single:true}); }else{ -_5c.store.load(); +_69.store.load(); } -},openItem:function(_5d,i,e){ -var _60=this.layout.findById("treepanel"); -var dm=_5d.store; -var _62=dm.getAt(i); -if(_62.get("type")=="folder"){ -var _63=_60.getNodeById(_62.get("id")); -if(!_63.parentNode.isExpanded()){ -_63.parentNode.expand(); +},openItem:function(_6a,i,e){ +var _6d=this.layout.findById("treepanel"); +var dm=_6a.store; +var _6f=dm.getAt(i); +if(_6f.get("type")=="folder"||_6f.get("type")=="symlink"){ +var _70=_6d.getNodeById(_6f.get("id")); +if(!_70.parentNode.isExpanded()){ +_70.parentNode.expand(); } -_63.fireEvent("click",_63); -_63.expand(); +_70.fireEvent("click",_70); +_70.expand(); }else{ -window.open(_62.get("url")); +window.open(_6f.get("url")); window.focus(); } -},delItem:function(_64,i,e){ -var _67=acs_lang_text.confirm_delete||"Are you sure you want to delete "; -var _68=acs_lang_text.foldercontains||"This folder contains"; -var _69=this.layout.findById("treepanel"); -if(_64.id=="filepanel"){ -var _6a=_64; -if(_6a.getSelectionModel().getCount()<=1){ -_6a.getSelectionModel().selectRow(i); +},delItem:function(_71,i,e){ +var _74=acs_lang_text.confirm_delete||"Are you sure you want to delete "; +var _75=acs_lang_text.foldercontains||"This folder contains"; +var _76=this.layout.findById("treepanel"); +if(_71.id=="filepanel"){ +var _77=_71; +if(_77.getSelectionModel().getCount()<=1){ +_77.getSelectionModel().selectRow(i); } }else{ -var _6a=this.layout.findById("filepanel"); +var _77=this.layout.findById("filepanel"); } -var _6b=_6a.getSelectionModel().getSelections(); -var _6c=true; -if(_6b.length>0){ -_6c=false; -if(_6b.length==1){ -var _6d=_6b[0].get("title"); -if(_6b[0].get("type")==="folder"){ -var msg=_68+" "+_6b[0].get("size")+".
"; +var _78=_77.getSelectionModel().getSelections(); +var _79=true; +if(_78.length>0){ +_79=false; +if(_78.length==1){ +var _7a=_78[0].get("title"); +if(_78[0].get("type")==="folder"){ +var msg=_75+" "+_78[0].get("size")+".
"; }else{ var msg=""; } -var msg=msg+_67+" "+_6d+" ?"; -var _6f=_6b[0].get("id"); +var msg=msg+_74+" "+_7a+" ?"; +if(_78[0].get("type")==="symlink"){ +var _7c=_78[0].get("symlink_id"); }else{ -var msg=_67+":

"; -var _6f=[]; -for(var x=0;x<_6b.length;x++){ -msg=msg+""+_6b[x].get("title")+" "; -if(_6b[x].get("type")==="folder"){ -msg=msg+"("+_6b[x].get("size")+")"; +var _7c=_78[0].get("id"); } +}else{ +var msg=_74+":

"; +var _7c=[]; +for(var x=0;x<_78.length;x++){ +msg=msg+""+_78[x].get("title")+" "; +if(_78[x].get("type")==="folder"){ +msg=msg+"("+_78[x].get("size")+")"; +} msg=msg+"
"; -_6f[x]=_6b[x].get("id"); +if(_78[x].get("type")==="symlink"){ +_7c[x]=_78[x].get("symlink_id"); +}else{ +_7c[x]=_78[x].get("id"); } } +} }else{ -_6c=true; -var _71=_69.getSelectionModel().getSelectedNode(); -var _6f=_71.attributes["id"]; -var _72=_69.getRootNode(); -if(_71.attributes["id"]==_72.attributes["id"]){ +_79=true; +var _7e=_76.getSelectionModel().getSelectedNode(); +var _7c=_7e.attributes["id"]; +var _7f=_7e.attributes.attributes["type"]; +var _80=_7e.attributes.attributes["symlink_id"]; +var _81=_76.getRootNode(); +if(_7f=="symlink"){ +var _82={object_id:_80}; +}else{ +var _82={object_id:_7c}; +} +if(_7e.attributes["id"]==_81.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{ -var msg=_67+" "+_71.attributes["text"]+"?"; +var msg=_74+" "+_7e.attributes["text"]+"?"; } } -var _73=function(_74){ -if(_74==="yes"){ -Ext.Ajax.request({url:this.xmlhttpurl+"delete-fsitem",success:function(_75){ -var _76=Ext.decode(_75.responseText); -if(_76.success){ -if(_6c){ -var _77=_69.getSelectionModel().getSelectedNode(); -var _78=_77.parentNode; -_78.fireEvent("click",_78); -_78.removeChild(_77); +var _83=function(_84){ +if(_84==="yes"){ +Ext.Ajax.request({url:this.xmlhttpurl+"delete-fsitem",success:function(_85){ +var _86=Ext.decode(_85.responseText); +if(_86.success){ +if(_79){ +var _87=_76.getSelectionModel().getSelectedNode(); +var _88=_87.parentNode; +_88.fireEvent("click",_88); +_88.removeChild(_87); }else{ -for(var x=0;x<_6b.length;x++){ -_6a.store.remove(_6b[x]); -var _7a=_6b[x].get("id"); -var _77=_69.getNodeById(_7a); -if(_77){ -_77.parentNode.fireEvent("click",_77.parentNode); -_77.parentNode.removeChild(_77); +for(var x=0;x<_78.length;x++){ +_77.store.remove(_78[x]); +var _8a=_78[x].get("id"); +var _87=_76.getNodeById(_8a); +if(_87){ +_87.parentNode.fireEvent("click",_87.parentNode); +_87.parentNode.removeChild(_87); } } } @@ -380,385 +498,423 @@ } },failure:function(){ Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"

"+resultObj.error+""); -},params:{object_id:_6f}}); +},params:_82}); } }; -Ext.MessageBox.confirm(acs_lang_text.confirm||"Confirm",msg,_73,this); +Ext.MessageBox.confirm(acs_lang_text.confirm||"Confirm",msg,_83,this); },addFolder:function(){ var te=this.te; -var _7c=this.layout.findById("treepanel"); -var _7d=_7c.getSelectionModel().getSelectedNode(); -_7d.expand(); -var _7e=acs_lang_text.new_folder_error||"Sorry, there was an error trying to create your new folder."; -Ext.Ajax.request({url:this.xmlhttpurl+"add-blankfolder",success:function(_7f){ -var _80=Ext.decode(_7f.responseText); -if(_80.success){ -var _81=_7d.appendChild(new Ext.tree.TreeNode({text:_80.pretty_folder_name,id:_80.id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:"t"}})); -_7c.getSelectionModel().select(_81); -_81.loaded=true; -_81.fireEvent("click",_81); +var _8c=this.layout.findById("treepanel"); +var _8d=_8c.getSelectionModel().getSelectedNode(); +_8d.expand(); +var _8e=acs_lang_text.new_folder_error||"Sorry, there was an error trying to create your new folder."; +Ext.Ajax.request({url:this.xmlhttpurl+"add-blankfolder",success:function(_8f){ +var _90=Ext.decode(_8f.responseText); +if(_90.success){ +var _91=_8d.appendChild(new Ext.tree.TreeNode({text:_90.pretty_folder_name,id:_90.id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:"t"}})); +_8c.getSelectionModel().select(_91); +_91.loaded=true; +_91.fireEvent("click",_91); setTimeout(function(){ -te.editNode=_81; -te.startEdit(_81.ui.textNode); +te.editNode=_91; +te.startEdit(_91.ui.textNode); },10); }else{ -Ext.Msg.alert(acs_lang_text.error||"Error",_7e+"

"+_80.error+""); +Ext.Msg.alert(acs_lang_text.error||"Error",_8e+"

"+_90.error+""); } -},failure:function(_82){ -var _83=Ext.decode(_82.responseText); -Ext.Msg.alert(acs_lang_text.error||"Error",_7e+"

"+_83.error+""); -},params:{folder_id:_7d.attributes["id"]}}); +},failure:function(_92){ +var _93=Ext.decode(_92.responseText); +Ext.Msg.alert(acs_lang_text.error||"Error",_8e+"

"+_93.error+""); +},params:{folder_id:_8d.attributes["id"]}}); },createSwfObj:function(){ -var _84=this; -var _85=_84.layout.findById("treepanel"); -var _86=_84.currentfolder; +var _94=this; +var _95=_94.layout.findById("treepanel"); +var _96=_94.currentfolder; if(this.swfu==null){ -var _87=String(this.config.package_id); -var _88=String(this.config.user_id); -var _89=String(this.currentfolder); -var _8a=String(this.config.max_file_size); -var _8b=function(_8c,_8d){ +var _97=String(this.config.package_id); +var _98=String(this.config.user_id); +var _99=String(this.currentfolder); +var _9a=String(this.config.max_file_size); +var _9b=function(_9c,_9d){ try{ -var _8e=Math.ceil((_8d/_8c.size)*100); -var _8f=new FileProgress(_8c,this.getSetting("progress_target")); -_8f.SetProgress(_8e); -_8f.SetStatus(acs_lang_text.uploading||"Uploading..."); +var _9e=Math.ceil((_9d/_9c.size)*100); +var _9f=new FileProgress(_9c,this.getSetting("progress_target")); +_9f.SetProgress(_9e); +_9f.SetStatus(acs_lang_text.uploading||"Uploading..."); } catch(ex){ this.debugMessage(ex); } }; -var _90=function(_91){ +var _a0=function(_a1){ try{ -var _92=new FileProgress(_91,this.getSetting("progress_target")); -_92.SetCancelled(); -_92.SetStatus(acs_lang_text.uploadcancel||"Cancelled (This item will be removed shortly)"); -_92.ToggleCancel(false); +var _a2=new FileProgress(_a1,this.getSetting("progress_target")); +_a2.SetCancelled(); +_a2.SetStatus(acs_lang_text.uploadcancel||"Cancelled (This item will be removed shortly)"); +_a2.ToggleCancel(false); } catch(ex){ this.debugMessage(ex); } }; -var _93=function(_94){ +var _a3=function(_a4){ try{ -var _95=new FileProgress(_94,this.getSetting("progress_target")); -_95.SetComplete(); -_95.SetStatus(acs_lang_text.complete||"Complete."); -_95.ToggleCancel(false); +var _a5=new FileProgress(_a4,this.getSetting("progress_target")); +_a5.SetComplete(); +_a5.SetStatus(acs_lang_text.complete||"Complete."); +_a5.ToggleCancel(false); } catch(ex){ this.debugMessage(ex); } }; -var _96=function(_97){ -var _98=_85.getNodeById(_84.currentfolder); -_98.fireEvent("click",_98); +var _a6=function(_a7){ +var _a8=_95.getNodeById(_94.currentfolder); +_a8.fireEvent("click",_a8); }; -var _99=function(_9a,_9b,_9c){ +var _a9=function(_aa,_ab,_ac){ try{ -if(_9a==SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED){ -Ext.Msg.alert(acs_lang_text.alert||"Alert","You have attempted to queue too many files.\n"+(_9c==0?"You have reached the upload limit.":"You may select "+(_9c>1?"up to "+_9c+" files.":"one file."))); +if(_aa==SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED){ +Ext.Msg.alert(acs_lang_text.alert||"Alert","You have attempted to queue too many files.\n"+(_ac==0?"You have reached the upload limit.":"You may select "+(_ac>1?"up to "+_ac+" files.":"one file."))); return; } -var _9d=new FileProgress(_9b,this.getSetting("progress_target")); -_9d.SetError(); -_9d.ToggleCancel(false); -switch(_9a){ +var _ad=new FileProgress(_ab,this.getSetting("progress_target")); +_ad.SetError(); +_ad.ToggleCancel(false); +switch(_aa){ case SWFUpload.ERROR_CODE_HTTP_ERROR: -_9d.SetStatus("Upload Error"); -this.debugMessage("Error Code: HTTP Error, File name: "+file.name+", Message: "+_9c); +_ad.SetStatus("Upload Error"); +this.debugMessage("Error Code: HTTP Error, File name: "+file.name+", Message: "+_ac); break; case SWFUpload.ERROR_CODE_MISSING_UPLOAD_TARGET: -_9d.SetStatus("Configuration Error"); -this.debugMessage("Error Code: No backend file, File name: "+file.name+", Message: "+_9c); +_ad.SetStatus("Configuration Error"); +this.debugMessage("Error Code: No backend file, File name: "+file.name+", Message: "+_ac); break; case SWFUpload.ERROR_CODE_UPLOAD_FAILED: -_9d.SetStatus("Upload Failed."); -this.debugMessage("Error Code: Upload Failed, File name: "+file.name+", File size: "+file.size+", Message: "+_9c); +_ad.SetStatus("Upload Failed."); +this.debugMessage("Error Code: Upload Failed, File name: "+file.name+", File size: "+file.size+", Message: "+_ac); break; case SWFUpload.ERROR_CODE_IO_ERROR: -_9d.SetStatus("Server (IO) Error"); -this.debugMessage("Error Code: IO Error, File name: "+file.name+", Message: "+_9c); +_ad.SetStatus("Server (IO) Error"); +this.debugMessage("Error Code: IO Error, File name: "+file.name+", Message: "+_ac); break; case SWFUpload.ERROR_CODE_SECURITY_ERROR: -_9d.SetStatus("Security Error"); -this.debugMessage("Error Code: Security Error, File name: "+file.name+", Message: "+_9c); +_ad.SetStatus("Security Error"); +this.debugMessage("Error Code: Security Error, File name: "+file.name+", Message: "+_ac); break; case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT: -_9d.SetStatus("File is too big."); -this.debugMessage("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+_9c); +_ad.SetStatus("File is too big."); +this.debugMessage("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+_ac); break; case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE: -_9d.SetStatus("Cannot upload Zero Byte files."); -this.debugMessage("Error Code: Zero byte file, File name: "+file.name+", File size: "+file.size+", Message: "+_9c); +_ad.SetStatus("Cannot upload Zero Byte files."); +this.debugMessage("Error Code: Zero byte file, File name: "+file.name+", File size: "+file.size+", Message: "+_ac); break; case SWFUpload.ERROR_CODE_UPLOAD_LIMIT_EXCEEDED: -_9d.SetStatus("Upload limit exceeded."); -this.debugMessage("Error Code: Upload Limit Exceeded, File name: "+file.name+", File size: "+file.size+", Message: "+_9c); +_ad.SetStatus("Upload limit exceeded."); +this.debugMessage("Error Code: Upload Limit Exceeded, File name: "+file.name+", File size: "+file.size+", Message: "+_ac); break; default: -_9d.SetStatus("Unhandled Error"); -this.debugMessage("Error Code: "+_9a+", File name: "+file.name+", File size: "+file.size+", Message: "+_9c); +_ad.SetStatus("Unhandled Error"); +this.debugMessage("Error Code: "+_aa+", File name: "+file.name+", File size: "+file.size+", Message: "+_ac); break; } } catch(ex){ this.debugMessage(ex); } }; -var _9e=function(_9f){ -var _a0=acs_lang_text.for_upload_to||"for upload to"; -var _a1=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)"; +var _ae=function(_af){ +var _b0=acs_lang_text.for_upload_to||"for upload to"; +var _b1=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)"; try{ -var _a2=_84.currentfolder; -var _a3=_85.getNodeById(_a2).text; -var _a4=new FileProgress(_9f,this.getSetting("progress_target")); -_a4.SetStatus(_a0+" "+_a3+"
Title: (optional)
"+_a1); -_a4.ToggleCancel(true,this); -this.addFileParam(_9f.id,"folder_id",_a2); +var _b2=_94.currentfolder; +var _b3=_95.getNodeById(_b2).text; +var _b4=new FileProgress(_af,this.getSetting("progress_target")); +_b4.SetStatus(_b0+" "+_b3+"
Title: (optional)
"+_b1); +_b4.ToggleCancel(true,this); +this.addFileParam(_af.id,"folder_id",_b2); } catch(ex){ this.debugMessage(ex); } }; -this.swfu=new SWFUpload({debug:false,upload_target_url:this.xmlhttpurl+"add-file-flash",upload_params:{user_id:_88,package_id:_87},file_types:"*.*",file_size_limit:_8a,file_queue_limit:0,file_upload_limit:10,begin_upload_on_queue:false,file_queued_handler:_9e,file_progress_handler:_8b,file_cancelled_handler:_90,file_complete_handler:_93,queue_complete_handler:_96,error_handler:_99,flash_url:"/resources/ajax-filestorage-ui/swfupload/swfupload.swf"}); +this.swfu=new SWFUpload({debug:false,upload_target_url:this.xmlhttpurl+"add-file-flash",upload_params:{user_id:_98,package_id:_97},file_types:"*.*",file_size_limit:_9a,file_queue_limit:0,file_upload_limit:10,begin_upload_on_queue:false,file_queued_handler:_ae,file_progress_handler:_9b,file_cancelled_handler:_a0,file_complete_handler:_a3,queue_complete_handler:_a6,error_handler:_a9,flash_url:"/resources/ajax-filestorage-ui/swfupload/swfupload.swf"}); } },addFile:function(){ if(this.upldWindow==null){ if(!this.config.multi_file_upload||checkFlashVersion()<9||Ext.isLinux){ -var _a5=acs_lang_text.file_to_upload||"File to upload"; -var _a6=acs_lang_text.file_title||"Title"; -var _a7=acs_lang_text.file_description||"Description"; -var _a8=acs_lang_text.multiple_files||"Multiple Files"; -var _a9=acs_lang_text.multiple_files_msg||"This is a ZIPfile containing multiple files."; -var _aa=true; -var _ab="Upload a File"; -var _ac=new Ext.Panel({id:"form_addfile",align:"left",frame:true,html:"

"+_a5+"


"+_a6+"


"+_a7+" :

"+_a8+" :

"+_a9+"

"}); -var _ad=[{text:"Upload",handler:this.uploadOneFile.createDelegate(this),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:"Close",handler:function(){ +var _b5=acs_lang_text.file_to_upload||"File to upload"; +var _b6=acs_lang_text.file_title||"Title"; +var _b7=acs_lang_text.file_description||"Description"; +var _b8=acs_lang_text.multiple_files||"Multiple Files"; +var _b9=acs_lang_text.multiple_files_msg||"This is a ZIPfile containing multiple files."; +var _ba=true; +var _bb="Upload a File"; +var _bc=new Ext.Panel({id:"form_addfile",align:"left",frame:true,html:"

"+_b5+"


"+_b6+"


"+_b7+" :

"+_b8+" :

"+_b9+"

"}); +var _bd=[{text:"Upload",handler:this.uploadOneFile.createDelegate(this),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:"Close",handler:function(){ this.upldWindow.hide(); }.createDelegate(this),icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]; }else{ this.createSwfObj(); -var _ae=acs_lang_text.upload_intro||"Click Browse to select a file to upload to the selected folder on the tree."; -var _aa=false; -var _ab="Upload Files"; -var _ac=new Ext.Panel({id:"form_multi_addfile",autoScroll:true,frame:true,html:"
"+_ae+"
"}); -_ac.on("render",function(){ +var _be=acs_lang_text.upload_intro||"Click Browse to select a file to upload to the selected folder on the tree."; +var _ba=false; +var _bb="Upload Files"; +var _bc=new Ext.Panel({id:"form_multi_addfile",autoScroll:true,frame:true,html:"
"+_be+"
"}); +_bc.on("render",function(){ this.swfu.addSetting("progress_target","fsuploadprogress"); },this); -var _ad=[{text:"Browse",handler:this.swfu.browse.createDelegate(this.swfu),icon:"/resources/ajaxhelper/icons/page_add.png",cls:"x-btn-text-icon"},{text:"Upload",handler:this.swfu.startUpload.createDelegate(this.swfu,[null,this],false),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:"Hide",handler:function(){ +var _bd=[{text:"Browse",handler:this.swfu.browse.createDelegate(this.swfu),icon:"/resources/ajaxhelper/icons/page_add.png",cls:"x-btn-text-icon"},{text:"Upload",handler:this.swfu.startUpload.createDelegate(this.swfu,[null,this],false),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:"Hide",handler:function(){ this.upldWindow.hide(); }.createDelegate(this),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:_ab,closeAction:"hide",modal:_aa,plain:true,resizable:false,items:_ac,buttons:_ad}); +this.upldWindow=new Ext.Window({id:"upload-win",layout:"fit",width:400,height:300,title:_bb,closeAction:"hide",modal:_ba,plain:true,resizable:false,items:_bc,buttons:_bd}); } this.upldWindow.show(); },uploadOneFile:function(){ if(Ext.get("upload_file").getValue()!=""&&Ext.get("filetitle").getValue()!=""){ -var _af=this.layout.findById("treepanel"); -var _b0={success:function(){ +var _bf=this.layout.findById("treepanel"); +var _c0={success:function(){ },upload:function(){ -_af.getSelectionModel().getSelectedNode().loaded=false; -_af.getSelectionModel().getSelectedNode().fireEvent("click",_af.getSelectionModel().getSelectedNode()); +_bf.getSelectionModel().getSelectedNode().loaded=false; +_bf.getSelectionModel().getSelectedNode().fireEvent("click",_bf.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 _b1=acs_lang_text.loading||"One moment. This may take a while depending on how large your upload is."; -this.upldWindow.body.mask("
"+_b1); +var _c1=acs_lang_text.loading||"One moment. This may take a while depending on how large your upload is."; +this.upldWindow.body.mask("
"+_c1); YAHOO.util.Connect.setForm("newfileform",true,true); -var _b2=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-file",_b0); +var _c2=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-file",_c0); }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},{xtype:"textfield",fieldLabel:"Description",name:"fsdescription",tabIndex:3}]}),buttons:[{text:"Submit",handler:function(){ -this.createurlWindow.findById("form_create_url").getForm().submit({url:this.xmlhttpurl+"add-url",waitMsg:"One moment ....",params:{package_id:this.config.package_id,folder_id:this.currentfolder},reset:true,scope:this,success:function(_b3,_b4){ -if(_b4.result){ +this.createurlWindow.findById("form_create_url").getForm().submit({url:this.xmlhttpurl+"add-url",waitMsg:"One moment ....",params:{package_id:this.config.package_id,folder_id:this.currentfolder},reset:true,scope:this,success:function(_c3,_c4){ +if(_c4.result){ this.createurlWindow.hide(); }else{ -Ext.MessageBox.alert("Error","Sorry an error occured.
"+_b4.result.error); +Ext.MessageBox.alert("Error","Sorry an error occured.
"+_c4.result.error); } -},failure:function(_b5,_b6){ -if(_b6.result){ -Ext.MessageBox.alert("Error",_b6.result.error); +},failure:function(_c5,_c6){ +if(_c6.result){ +Ext.MessageBox.alert("Error",_c6.result.error); } }}); }.createDelegate(this),icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon"},{text:"Close",handler:function(){ this.createurlWindow.hide(); }.createDelegate(this),icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]}); } this.createurlWindow.show(); -},renameItem:function(_b7,i,e){ -var _ba=_b7; -var _bb=this.layout.findById("treepanel"); -var _bc=_ba.store.getAt(i); -var _bd=_bc.get("url"); -var _be=_bc.get("type"); -var _bf=_bc.get("id"); -var _c0=_bc.get("filename"); -var _c1=function(_c2){ -var _c3=acs_lang_text.an_error_occurred||"An error occurred"; -var _c4=acs_lang_text.reverted||"Your changes have been reverted"; -var _c5=Ext.decode(_c2.responseText); -if(!_c5.success){ -Ext.Msg.alert(acs_lang_text.error||"Error",_c3+":

"+_c5.error+"

"+_c4); +},renameItem:function(_c7,i,e){ +var _ca=_c7; +var _cb=this.layout.findById("treepanel"); +var _cc=_ca.store.getAt(i); +var _cd=_cc.get("url"); +var _ce=_cc.get("type"); +var _cf=_cc.get("id"); +var _d0=_cc.get("filename"); +var _d1=function(_d2){ +var _d3=acs_lang_text.an_error_occurred||"An error occurred"; +var _d4=acs_lang_text.reverted||"Your changes have been reverted"; +var _d5=Ext.decode(_d2.responseText); +if(!_d5.success){ +Ext.Msg.alert(acs_lang_text.error||"Error",_d3+":

"+_d5.error+"

"+_d4); }else{ -if(_be=="folder"){ -_bb.getNodeById(_bf).setText(_c5.newname); +if(_ce=="folder"){ +_cb.getNodeById(_cf).setText(_d5.newname); } -if(_be!="folder"&&_c0===" "){ -_c0=_bc.get("title"); -_bc.set("filename",_c0); +if(_ce!="folder"&&_d0===" "){ +_d0=_cc.get("title"); +_cc.set("filename",_d0); } -_bc.set("title",_c5.newname); -_bc.commit(); +_cc.set("title",_d5.newname); +_cc.commit(); } }; -var _c6=function(btn,_c8){ +var _d6=function(btn,_d8){ if(btn=="ok"){ -if(_c8!=""){ -if(_c8.length>100){ +if(_d8!=""){ +if(_d8.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{ -Ext.Ajax.request({url:this.xmlhttpurl+"edit-name",success:_c1,failure:function(_c9){ -var _ca=Ext.decode(_c9.responseText); -Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"

"+_ca.error+""); -},params:{newname:_c8,object_id:_bf,type:_be,url:_bd}}); +Ext.Ajax.request({url:this.xmlhttpurl+"edit-name",success:_d1,failure:function(_d9){ +var _da=Ext.decode(_d9.responseText); +Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"

"+_da.error+""); +},params:{newname:_d8,object_id:_cf,type:_ce,url:_cd}}); } }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:_bc.get("title"),buttons:Ext.Msg.OKCANCEL,fn:_c6.createDelegate(this)}); -var _cb=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input"); -_cb[0].select(); -},tagFsitem:function(_cc,i,e){ -var _cf=_cc; -var _d0=_cf.store.getAt(i); -var _d1=_d0.get("id"); -var _d2=_d0.get("tags"); -var _d3=this.config.package_id; -var _d4=this.layout.findById("tagcloudpanel"); -var _d5=this.xmlhttpurl; -var _d6=this.tagWindow; -var _d7=function(){ +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:_cc.get("title"),buttons:Ext.Msg.OKCANCEL,fn:_d6.createDelegate(this)}); +var _db=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input"); +_db[0].select(); +},tagFsitem:function(_dc,i,e){ +var _df=_dc; +var _e0=_df.store.getAt(i); +var _e1=_e0.get("id"); +var _e2=_e0.get("tags"); +var _e3=this.config.package_id; +var _e4=this.layout.findById("tagcloudpanel"); +var _e5=this.xmlhttpurl; +var _e6=this.tagWindow; +var _e7=function(){ Ext.Ajax.request({url:this.xmlhttpurl+"add-tag",success:function(){ -_d0.data.tags=Ext.get("fstags").getValue(); -_d0.commit(); -_d4.load({url:_d5+"get-tagcloud",params:{package_id:_d3}}); -_d6.hide(); -},failure:function(_d8){ +_e0.data.tags=Ext.get("fstags").getValue(); +_e0.commit(); +_e4.load({url:_e5+"get-tagcloud",params:{package_id:_e3}}); +_e6.hide(); +},failure:function(_e8){ Ext.Msg.alert(acs_lang_text.error||"Error","Sorry, we encountered an error."); -},params:{object_id:_d0.id,package_id:_d3,tags:Ext.get("fstags").getValue()}}); +},params:{object_id:_e0.id,package_id:_e3,tags:Ext.get("fstags").getValue()}}); }; -if(_d6==null){ -var _d9=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 _da=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",handler:_d7.createDelegate(this)},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",handler:function(){ -_d6.hide(); +if(_e6==null){ +var _e9=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 _ea=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",handler:_e7.createDelegate(this)},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",handler:function(){ +_e6.hide(); }.createDelegate(this)}]; -_d6=new Ext.Window({id:"tag-win",layout:"fit",width:450,height:300,title:"Tags",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:_d9,buttons:_da}); -}else{ +_e6=new Ext.Window({id:"tag-win",layout:"fit",width:450,height:300,title:"Tags",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:_e9,buttons:_ea}); } -_d6.show(); +_e6.show(); this.initTagAutoComplete(); },initTagAutoComplete:function(){ -var _db=new YAHOO.widget.DS_JSArray(oAutoCompArr); +var _eb=new YAHOO.widget.DS_JSArray(oAutoCompArr); if(document.getElementById("fstags")){ -var _dc=new YAHOO.widget.AutoComplete("fstags","oAutoCompContainer1",_db); -_dc.animHoriz=false; -_dc.animVert=false; -_dc.queryDelay=0; -_dc.maxResultsDisplayed=10; -_dc.useIFrame=true; -_dc.delimChar=","; -_dc.allowBrowserAutocomplete=false; -_dc.typeAhead=true; -_dc.formatResult=function(_dd,_de){ -var _df=_dd[0]; -return _df; +var _ec=new YAHOO.widget.AutoComplete("fstags","oAutoCompContainer1",_eb); +_ec.animHoriz=false; +_ec.animVert=false; +_ec.queryDelay=0; +_ec.maxResultsDisplayed=10; +_ec.useIFrame=true; +_ec.delimChar=","; +_ec.allowBrowserAutocomplete=false; +_ec.typeAhead=true; +_ec.formatResult=function(_ed,_ee){ +var _ef=_ed[0]; +return _ef; }; } -},downloadArchive:function(_e0){ -if(_e0){ -top.location.href="download-archive/?object_id="+_e0; +},downloadArchive:function(_f0){ +if(_f0){ +top.location.href="download-archive/?object_id="+_f0; } -},redirectViews:function(_e1,i,e){ -var _e4=_e1; -var _e5=_e4.store.getAt(i); -var _e6=_e5.get("id"); -window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+_e6+"/info"); +},showShareOptions:function(_f1,i,e){ +var _f4=_f1; +var _f5=_f4.store.getAt(i); +var _f6=_f5.get("id"); +var _f7=_f5.get("title"); +var _f8=this.layout.findById("treepanel"); +var _f9=this.config.package_id; +var _fa=this.xmlhttpurl; +var _fb=this.sharefolderWindow; +var _fc=function(){ +var _fd=_f8.getSelectionModel().getSelectedNode(); +_fd.loaded=false; +_fd.collapse(); +_fd.fireEvent("click",_fd); +_fd.expand(); +_fb.hide(); +}; +var _fe=function(){ +var _ff=this.communityCombo.getValue(); +Ext.Ajax.request({url:this.xmlhttpurl+"share-folder",success:_fc,failure:function(_100){ +Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later."); +},params:{target_folder_id:_ff,folder_id:_f6}}); +}; +if(_fb==null){ +var _101=new Ext.Panel({id:"form_addtag",autoScroll:true,frame:true,html:"
Select the community where you wish to share the "+_f7+" folder with.

"}); +var _102=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",handler:_fe.createDelegate(this)},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",handler:function(){ +_fb.hide(); +}.createDelegate(this)}]; +_fb=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:_101,buttons:_102}); +_fb.on("show",function(){ +if(this.communityCombo==null){ +var _103=new Ext.data.JsonStore({url:_fa+"list-communities",root:"communities",fields:["target_folder_id","instance_name"]}); +this.communityCombo=new Ext.form.ComboBox({store:_103,displayField:"instance_name",typeAhead:true,triggerAction:"all",emptyText:"Select a community",hiddenName:"target_folder_id",valueField:"target_folder_id",forceSelection:true,handleHeight:80,selectOnFocus:true,applyTo:"communities_list"}); +} +},this); +}else{ +this.communityCombo.reset(); +} +_fb.show(); +},redirectViews:function(grid,i,e){ +var _107=grid; +var node=_107.store.getAt(i); +var _109=node.get("id"); +window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+_109+"/info"); window.focus(); -},redirectPerms:function(_e7,i,e){ -var _ea=_e7; -var _eb=_ea.store.getAt(i); -var _ec=_eb.get("id"); -var _ed=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+_ec+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder); -_ed.focus(); -},redirectProperties:function(_ee,i,e){ -var _f1=_ee; -var _f2=_f1.store.getAt(i); -var _f3=_f2.get("id"); -var _f4=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+_f3); -_f4.focus(); -},copyLink:function(_f5,i,e){ -var _f8=_f5; -var _f9=_f8.store.getAt(i); -var _fa=_f9.get("type"); -if(_fa==="folder"){ -var _fb=window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+_f9.get("id"); +},redirectPerms:function(grid,i,e){ +var _10d=grid; +var node=_10d.store.getAt(i); +var _10f=node.get("id"); +var _110=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+_10f+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder); +_110.focus(); +},redirectProperties:function(grid,i,e){ +var _114=grid; +var node=_114.store.getAt(i); +var _116=node.get("id"); +var _117=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+_116); +_117.focus(); +},copyLink:function(grid,i,e){ +var _11b=grid; +var node=_11b.store.getAt(i); +var _11d=node.get("type"); +if(_11d==="folder"){ +var _11e=window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+node.get("id"); }else{ -if(_fa==="url"){ -var _fb=_f9.get("url"); +if(_11d==="url"){ +var _11e=node.get("url"); }else{ -var _fb=window.location.protocol+"//"+window.location.hostname+_f9.get("url"); +var _11e=window.location.protocol+"//"+window.location.hostname+node.get("linkurl"); } } if(Ext.isIE){ -window.clipboardData.setData("text",_fb); +window.clipboardData.setData("text",_11e); }else{ -var _fc=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:_fb,buttons:Ext.Msg.OK}); -var _fd=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input"); -_fd[0].select(); +var _11f=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:_11e,buttons:Ext.Msg.OK}); +var _120=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input"); +_120[0].select(); } }}; -function readCookie(_fe){ +function readCookie(name){ var ca=document.cookie.split(";"); -var _100=_fe+"="; +var _123=name+"="; for(var i=0;i0){ -var key=_10a[i].substring(0,pos); -var val=_10a[i].substring(pos+1); +var key=_12d[i].substring(0,pos); +var val=_12d[i].substring(pos+1); if(key==q){ return val; } @@ -768,7 +924,7 @@ } function checkFlashVersion(){ var x; -var _110; +var _133; if(navigator.plugins&&navigator.mimeTypes.length){ x=navigator.plugins["Shockwave Flash"]; if(x&&x.description){ @@ -787,57 +943,57 @@ pluginVersion=(typeof (x)=="string")?parseInt(x.match(/\d+/)[0]):0; return pluginVersion; } -function isURL(_111){ -if(_111.indexOf(" ")!=-1){ +function isURL(_134){ +if(_134.indexOf(" ")!=-1){ return false; }else{ -if(_111.indexOf("http://")==-1){ +if(_134.indexOf("http://")==-1){ return false; }else{ -if(_111=="http://"){ +if(_134=="http://"){ return false; }else{ -if(_111.indexOf("http://")>0){ +if(_134.indexOf("http://")>0){ return false; } } } } -_111=_111.substring(7,_111.length); -if(_111.indexOf(".")==-1){ +_134=_134.substring(7,_134.length); +if(_134.indexOf(".")==-1){ return false; }else{ -if(_111.indexOf(".")==0){ +if(_134.indexOf(".")==0){ return false; }else{ -if(_111.charAt(_111.length-1)=="."){ +if(_134.charAt(_134.length-1)=="."){ return false; } } } -if(_111.indexOf("/")!=-1){ -_111=_111.substring(0,_111.indexOf("/")); -if(_111.charAt(_111.length-1)=="."){ +if(_134.indexOf("/")!=-1){ +_134=_134.substring(0,_134.indexOf("/")); +if(_134.charAt(_134.length-1)=="."){ return false; } } -if(_111.indexOf(":")!=-1){ -if(_111.indexOf(":")==(_111.length-1)){ +if(_134.indexOf(":")!=-1){ +if(_134.indexOf(":")==(_134.length-1)){ return false; }else{ -if(_111.charAt(_111.indexOf(":")+1)=="."){ +if(_134.charAt(_134.indexOf(":")+1)=="."){ return false; } } -_111=_111.substring(0,_111.indexOf(":")); -if(_111.charAt(_111.length-1)=="."){ +_134=_134.substring(0,_134.indexOf(":")); +if(_134.charAt(_134.length-1)=="."){ return false; } } return true; } -function FileProgress(_112,_113){ -this.file_progress_id=_112.id; +function FileProgress(_135,_136){ +this.file_progress_id=_135.id; this.opacity=100; this.height=0; this.fileProgressWrapper=document.getElementById(this.file_progress_id); @@ -847,81 +1003,81 @@ this.fileProgressWrapper.id=this.file_progress_id; this.fileProgressElement=document.createElement("div"); this.fileProgressElement.className="progressContainer"; -var _114=document.createElement("a"); -_114.className="progressCancel"; -_114.href="#"; -_114.style.visibility="hidden"; -_114.appendChild(document.createTextNode(" ")); -var _115=document.createElement("div"); -_115.className="progressName"; -_115.appendChild(document.createTextNode(_112.name)); -var _116=document.createElement("div"); -_116.className="progressBarInProgress"; -var _117=document.createElement("div"); -_117.className="progressBarStatus"; -_117.innerHTML=" "; -this.fileProgressElement.appendChild(_114); -this.fileProgressElement.appendChild(_115); -this.fileProgressElement.appendChild(_117); -this.fileProgressElement.appendChild(_116); +var _137=document.createElement("a"); +_137.className="progressCancel"; +_137.href="#"; +_137.style.visibility="hidden"; +_137.appendChild(document.createTextNode(" ")); +var _138=document.createElement("div"); +_138.className="progressName"; +_138.appendChild(document.createTextNode(_135.name)); +var _139=document.createElement("div"); +_139.className="progressBarInProgress"; +var _13a=document.createElement("div"); +_13a.className="progressBarStatus"; +_13a.innerHTML=" "; +this.fileProgressElement.appendChild(_137); +this.fileProgressElement.appendChild(_138); +this.fileProgressElement.appendChild(_13a); +this.fileProgressElement.appendChild(_139); this.fileProgressWrapper.appendChild(this.fileProgressElement); -document.getElementById(_113).appendChild(this.fileProgressWrapper); +document.getElementById(_136).appendChild(this.fileProgressWrapper); }else{ this.fileProgressElement=this.fileProgressWrapper.firstChild; } this.height=this.fileProgressWrapper.offsetHeight; } -FileProgress.prototype.SetProgress=function(_118){ +FileProgress.prototype.SetProgress=function(_13b){ this.fileProgressElement.className="progressContainer green"; this.fileProgressElement.childNodes[3].className="progressBarInProgress"; -this.fileProgressElement.childNodes[3].style.width=_118+"%"; +this.fileProgressElement.childNodes[3].style.width=_13b+"%"; }; FileProgress.prototype.SetComplete=function(){ this.fileProgressElement.className="progressContainer blue"; this.fileProgressElement.childNodes[3].className="progressBarComplete"; this.fileProgressElement.childNodes[3].style.width=""; -var _119=this; +var _13c=this; setTimeout(function(){ -_119.Disappear(); +_13c.Disappear(); },10000); }; FileProgress.prototype.SetError=function(){ this.fileProgressElement.className="progressContainer red"; this.fileProgressElement.childNodes[3].className="progressBarError"; this.fileProgressElement.childNodes[3].style.width=""; -var _11a=this; +var _13d=this; setTimeout(function(){ -_11a.Disappear(); +_13d.Disappear(); },5000); }; FileProgress.prototype.SetCancelled=function(){ this.fileProgressElement.className="progressContainer"; this.fileProgressElement.childNodes[3].className="progressBarError"; this.fileProgressElement.childNodes[3].style.width=""; -var _11b=this; +var _13e=this; setTimeout(function(){ -_11b.Disappear(); +_13e.Disappear(); },2000); }; -FileProgress.prototype.SetStatus=function(_11c){ -this.fileProgressElement.childNodes[2].innerHTML=_11c; +FileProgress.prototype.SetStatus=function(_13f){ +this.fileProgressElement.childNodes[2].innerHTML=_13f; }; -FileProgress.prototype.ToggleCancel=function(show,_11e){ +FileProgress.prototype.ToggleCancel=function(show,_141){ this.fileProgressElement.childNodes[0].style.visibility=show?"visible":"hidden"; -if(_11e){ -var _11f=this.file_progress_id; +if(_141){ +var _142=this.file_progress_id; this.fileProgressElement.childNodes[0].onclick=function(){ -_11e.cancelUpload(_11f); +_141.cancelUpload(_142); return false; }; } }; FileProgress.prototype.Disappear=function(){ -var _120=15; -var _121=4; +var _143=15; +var _144=4; var rate=30; if(this.opacity>0){ -this.opacity-=_120; +this.opacity-=_143; if(this.opacity<0){ this.opacity=0; } @@ -937,16 +1093,16 @@ } } if(this.height>0){ -this.height-=_121; +this.height-=_144; if(this.height<0){ this.height=0; } this.fileProgressWrapper.style.height=this.height+"px"; } if(this.height>0||this.opacity>0){ -var _123=this; +var _146=this; setTimeout(function(){ -_123.Disappear(); +_146.Disappear(); },rate); }else{ this.fileProgressWrapper.style.display="none"; Index: openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.css,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.css 26 Nov 2007 12:52:43 -0000 1.4 +++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.css 13 Dec 2007 05:33:42 -0000 1.5 @@ -1,6 +1,15 @@ .x-tree-node img.folder, .x-tree-node-collapsed img.folder { background-image:url(/resources/ajaxhelper/ext/resources/images/default/tree/folder.gif); } +.x-tree-node-expanded img.folder { + background: url(/resources/ajaxhelper/ext/resources/images/default/tree/folder-open.gif) +} +.x-tree-node img.sharedfolder, x-tree-node-collapsed img.sharedfolder { + background: url(/resources/ajaxhelper/icons/folder_go.png) +} +.x-tree-node img.symlink, x-tree-node-collapsed img.symlink { + background: url(/resources/ajaxhelper/icons/folder_link.png) +} div.flash { width: 80%; margin: 10px 0px 10px 0px; @@ -64,4 +73,8 @@ .yui-skin-sam .yui-ac-input { position:absolute; width:80%; -} \ No newline at end of file +} + +.x-combo-list-inner { text-align: left } +.x-menu-list-item { text-align: left; font-weight:normal } +.toolsmenu {background-image:url(/resources/ajaxhelper/icons/wrench_orange.png) !important;} \ 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.6 -r1.7 --- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 26 Nov 2007 12:52:43 -0000 1.6 +++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 13 Dec 2007 05:33:42 -0000 1.7 @@ -16,7 +16,7 @@ // ** configObj ** // ajaxFs expects a config object that may have the following properites - // - configObj.package_ids : the package_id or a comma separated list of package_ids of the current ajaxFs Instance + // - configObj.package_id : the package_id of the current ajaxFs Instance // - configObj.initOpenFolder : if this value is not null, it should contain the folder id to open when object is instantiated // - configObj.layoutdiv : the div container where we put the layout, if none is provided then document.body is used // - configObj.xmlhttpurl : just in case ajaxfs is mounted elsewhere other than /ajaxfs @@ -30,6 +30,9 @@ // do we or do we not allow creating url's in fs, defaults to true this.create_url_p = true; + // do we support folder sharing + this.share_folders_p = true; + // holds an object with configruation settings for this instance // of ajaxfs, this variable is set only if configObj exists and is passed this.config = null; @@ -61,14 +64,23 @@ // create ur dialog this.createurlWindow = null; + // share folder window + this.sharefolderWindow = null; + // reference to contextmenu this.contextmenu = null; // reference to an instance of the swfuploader // used for ajaxfs this.swfu = null; + // variable to store target folder when it is being shared + this.target_folder_id = null; + // variable to store combo + this.communityCombo = null; + + //********* initialize ********* this.initObj = function() { @@ -84,6 +96,7 @@ this.config = configObj; if(this.config.xmlhttpurl) { this.xmlhttpurl = this.config.xmlhttpurl } if(this.config.create_url && this.config.create_url == 0) { this.create_url_p = false } + if(this.config.share_folders && this.config.share_folders == 0) { this.share_folders_p = false } // generic listener to check if // the connection has returned a login form @@ -198,6 +211,143 @@ }, + // create a tools menu that has the same items as the context menu + createToolsMenu : function() { + + var menu = new Ext.menu.Menu({ + id: 'toolsmenu', + items: [ + new Ext.menu.Item({ + id:'mnOpen', + text: 'Open', + icon: '/resources/ajaxhelper/icons/page_white.png' + }), + new Ext.menu.Item({ + id:'mnTag', + text: 'Tag', + icon: '/resources/ajaxhelper/icons/tag_blue.png' + }), + new Ext.menu.Item({ + id:'mnView', + text: 'Views', + icon: '/resources/ajaxhelper/icons/camera.png' + }), + new Ext.menu.Item({ + id:'mnRename', + text: acs_lang_text.rename || 'Rename', + icon: '/resources/ajaxhelper/icons/page_edit.png' + }), + new Ext.menu.Item({ + id:'mnCopyLink', + text: acs_lang_text.linkaddress || 'Copy Link Address', + icon: '/resources/ajaxhelper/icons/page_copy.png' + }), + new Ext.menu.Item({ + id:'mnPerms', + text: acs_lang_text.permissions || 'Permissions', + icon: '/resources/ajaxhelper/icons/group_key.png' + }), + new Ext.menu.Item({ + id:'mnProp', + text: acs_lang_text.properties || 'Properties', + icon: '/resources/ajaxhelper/icons/page_edit.png' + }), + new Ext.menu.Item({ + id:'mnArch', + text: acs_lang_text.download_archive || 'Download archive', + icon: '/resources/ajaxhelper/icons/arrow_down.png' + }), + new Ext.menu.Item({ + id:'mnShare', + text: acs_lang_text.sharefolder || 'Share Folder', + icon: '/resources/ajaxhelper/icons/group_link.png' + }) ] + }); + + menu.on("beforeshow",function() { + + var gridpanel = this.layout.findById('filepanel'); + + if (gridpanel.getSelectionModel().getCount() == 1) { + var selectedRow = gridpanel.getSelectionModel().getSelections(); + for(var x=0; x'); } toolbar.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', handler: this.downloadArchive.createDelegate(this,[rootnode.id],false)}); return toolbar; }, - // creates the left panel as an accordon, top panel has the folders, bottom panel has the tags + // creates the left panel as an accordion, top panel has the folders, bottom panel has the tags createLeft : function() { var panel = new Ext.Panel ({ @@ -444,6 +595,7 @@ title:'Tags', frame:false, loadMask:true, + autoScroll:true, autoLoad:{url:this.xmlhttpurl+'get-tagcloud',params:{package_id:this.config.package_id}} }); @@ -468,7 +620,7 @@ return panel; }, - // loads the objects associted with a tag + // loads the objects associated with a tag loadTaggedFiles : function (tagid) { this.layout.findById("treepanel").getSelectionModel().clearSelections(); @@ -498,7 +650,9 @@ {name:'type'}, {name:'tags'}, {name:'url'}, + {name:'linkurl'}, {name:'write_p'}, + {name:'symlink_id'}, {name:'size'}, {name:'lastmodified'}] ); @@ -556,6 +710,7 @@ e.stopEvent(); + var treepanel = this.layout.findById('treepanel'); var dm = grid.store; var record = dm.getAt(i); var object_type = record.get("type"); @@ -615,6 +770,11 @@ text: acs_lang_text.download_archive || 'Download archive', icon: '/resources/ajaxhelper/icons/arrow_down.png', handler: this.downloadArchive.createDelegate(this,[recordid],false) + }), + new Ext.menu.Item({ + text: acs_lang_text.sharefolder || 'Share Folder', + icon: '/resources/ajaxhelper/icons/group_link.png', + handler: this.showShareOptions.createDelegate(this,[grid, i, e],false) }) ] }); @@ -629,6 +789,7 @@ 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(); @@ -640,13 +801,29 @@ this.contextmenu.items.items[1].hide(); this.contextmenu.items.items[7].hide(); this.contextmenu.items.items[8].show(); + if (treepanel.getNodeById(recordid).attributes.attributes.type == "symlink") { + this.contextmenu.items.items[9].hide(); + } else { + this.contextmenu.items.items[9].show(); + } } else { - this.contextmenu.items.items[1].show(); - this.contextmenu.items.items[7].show(); - this.contextmenu.items.items[8].hide(); + if (object_type == "symlink") { + this.contextmenu.items.items[4].hide(); + this.contextmenu.items.items[9].hide(); + } else { + this.contextmenu.items.items[1].show(); + this.contextmenu.items.items[7].show(); + this.contextmenu.items.items[8].hide(); + this.contextmenu.items.items[9].hide(); + } } } + // always disable if shared folders are not supported + if(!this.share_folders_p) { + this.contextmenu.items.items[9].hide(); + } + var coords = e.getXY(); this.contextmenu.rowid = i; this.contextmenu.showAt([coords[0], coords[1]]); @@ -667,6 +844,7 @@ // fetch the folder contents gridpanel.store.baseParams['folder_id'] = node.id; + gridpanel.store.baseParams['package_id'] = this.config.package_id; // gridpanel.store.baseParams['tag_id'] = ''; // if the tree node is still loading, wait for it to expand before loading the grid @@ -686,7 +864,7 @@ var treepanel = this.layout.findById('treepanel'); var dm = grid.store; var record = dm.getAt(i); - if(record.get("type") == "folder") { + if(record.get("type") == "folder"|| record.get("type") == "symlink") { var node = treepanel.getNodeById(record.get("id")); if(!node.parentNode.isExpanded()) { node.parentNode.expand() } node.fireEvent("click",node); @@ -732,7 +910,11 @@ var msg = ""; } var msg = msg + err_msg_txt+" "+filetodel+" ?"; - var object_id = selectedRows[0].get("id"); + if(selectedRows[0].get("type") === "symlink") { + var object_id = selectedRows[0].get("symlink_id"); + } else { + var object_id = selectedRows[0].get("id"); + } } else { var msg = err_msg_txt + ":

"; var object_id = []; @@ -742,7 +924,11 @@ msg=msg+"("+selectedRows[x].get("size")+")"; } msg=msg+"
"; - object_id[x] = selectedRows[x].get("id"); + if(selectedRows[x].get("type") === "symlink") { + object_id[x] = selectedRows[x].get("symlink_id"); + } else { + object_id[x] = selectedRows[x].get("id"); + } } } @@ -754,7 +940,14 @@ // we can't delete the root node var selectednode = treepanel.getSelectionModel().getSelectedNode(); var object_id = selectednode.attributes["id"]; + var type = selectednode.attributes.attributes["type"]; + var symlink_id = selectednode.attributes.attributes["symlink_id"]; var rootnode = treepanel.getRootNode(); + if(type == "symlink" ) { + var params = {object_id : symlink_id } + } else { + var params = {object_id : object_id } + } if(selectednode.attributes["id"] == rootnode.attributes["id"]) { Ext.Msg.alert(acs_lang_text.alert || "Alert",acs_lang_text.cant_del_root || "The root folder can not be deleted."); return; @@ -795,7 +988,7 @@ } }, failure: function() { Ext.Msg.alert(acs_lang_text.error || "Error",error_msg_txt + "

"+resultObj.error+""); - }, params: { object_id: object_id } + }, params: params }); } } @@ -1321,8 +1514,6 @@ buttons: tagBtns }); - } else { - } tagWindow.show(); @@ -1355,6 +1546,115 @@ } }, + showShareOptions : function(grid,i,e) { + + var filepanel = grid; + var node = filepanel.store.getAt(i); + var object_id = node.get("id"); + var foldertitle = node.get("title"); + var treepanel = this.layout.findById('treepanel'); + var package_id = this.config.package_id; + var xmlhttpurl = this.xmlhttpurl; + var shareWindow = this.sharefolderWindow; + + var sharesuccess = function() { + var selectednode = treepanel.getSelectionModel().getSelectedNode(); + selectednode.loaded = false; + selectednode.collapse(); + selectednode.fireEvent("click",selectednode); + selectednode.expand(); + shareWindow.hide(); + } + + var sharefolder = function() { + var target_folder_id = this.communityCombo.getValue(); + + Ext.Ajax.request({ + url:this.xmlhttpurl+"share-folder", + success: sharesuccess, + failure: function(response) { + Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later."); + }, params: {target_folder_id:target_folder_id,folder_id:object_id} + }); + + } + + if(shareWindow == null) { + + var shareFormBody = new Ext.Panel({ + id:'form_addtag', + autoScroll:true, + frame:true, + html: "
Select the community where you wish to share the "+foldertitle+" folder with.

" + }); + + var shareBtns = [{ + text: 'Ok', + icon:"/resources/ajaxhelper/icons/disk.png", + cls:"x-btn-text-icon", + handler:sharefolder.createDelegate(this) + },{ + text: 'Cancel', + icon:"/resources/ajaxhelper/icons/cross.png", + cls:"x-btn-text-icon", + handler: function(){ + shareWindow.hide(); + }.createDelegate(this) + }]; + + shareWindow = 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: shareFormBody, + buttons: shareBtns + }); + + shareWindow.on("show",function() { + + if(this.communityCombo == null) { + + var communities = new Ext.data.JsonStore({ + url: xmlhttpurl+'list-communities', + root: 'communities', + fields: ['target_folder_id', 'instance_name'] + }); + + this.communityCombo = new Ext.form.ComboBox({ + store: communities, + displayField:'instance_name', + typeAhead: true, + triggerAction: 'all', + emptyText:'Select a community', + hiddenName:'target_folder_id', + valueField:'target_folder_id', + forceSelection:true, + handleHeight: 80, + selectOnFocus:true, + applyTo:'communities_list' + }); + + } + + },this); + + } else { + + this.communityCombo.reset(); + + } + + shareWindow.show(); + + }, + // redirect to object views for a file redirectViews : function(grid,i,e) { var filepanel = grid; @@ -1397,7 +1697,7 @@ } else if (nodetype === "url") { var copytext = node.get("url"); } else { - var copytext = window.location.protocol+"//"+window.location.hostname+node.get("url"); + var copytext = window.location.protocol+"//"+window.location.hostname+node.get("linkurl"); } if(Ext.isIE) { window.clipboardData.setData("text",copytext); Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/delete-fsitem.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/delete-fsitem.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/delete-fsitem.tcl 26 Nov 2007 12:52:45 -0000 1.1 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/delete-fsitem.tcl 13 Dec 2007 05:33:42 -0000 1.2 @@ -28,10 +28,21 @@ if { [permission::permission_p -party_id $viewing_user_id -object_id $fs_object_id -privilege "delete"] } { if { [fs::folder_p -object_id $fs_object_id] } { fs::delete_folder -folder_id $fs_object_id -parent_id [fs::get_parent -item_id $fs_object_id] + # db_exec_plsql folder_delete "select file_storage__delete_folder(:fs_object_id,'t');" # ns_log notice "HAM : delete folder *******" } else { - fs::delete_file -item_id $fs_object_id + # fs::delete_file -item_id $fs_object_id # ns_log notice "HAM : delete file *******" + # if { [content::symlink::is_symlink -item_id $fs_object_id] == "t" } { + fs::delete_file -item_id $fs_object_id + # db_exec_plsql file_delete "select file_storage__delete_file(:fs_object_id);" + # } else { + # HAM : we want admins to be able to request undeleting a file + # to prevent name clashes, we need to prepend the name with "deleted_" + # before we unpublish the item + # db_dml "update_name" "update cr_items set name='deleted_$fs_object_id', deleted_p='t' where item_id = :fs_object_id" + # item::unpublish -item_id $fs_object_id + #} } } else { set errmsg "You do not have permission to delete this file." Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.adp 26 Nov 2007 12:52:45 -0000 1.1 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.adp 13 Dec 2007 05:33:42 -0000 1.2 @@ -1,5 +1,4 @@ { "total": @counter@, "foldercontents":[ -{"id":"@contents.object_id@","icon":"@contents.icon;noquote@","type":"@contents.type;noquote@",tags:"@contents.tags;noquote@","title":"@contents.title;noquote@","filename":"@contents.filename;noquote@","url":"@contents.download_url;noquote@","size":"@contents.content_size_pretty@","lastmodified":"@contents.last_modified_pretty@","write_p":@contents.write_p@} - +{"id":"@contents.object_id@","icon":"@contents.icon;noquote@","type":"@contents.type;noquote@","tags":"@contents.tags;noquote@","title":"@contents.title;noquote@","filename":"@contents.filename;noquote@","url":"@contents.download_url;noquote@","size":"@contents.content_size_pretty@","lastmodified":"@contents.last_modified_pretty@","write_p":@contents.write_p@,"linkurl":"@contents.linkurl;noquote@","symlink_id":"@contents.symlink_id@"} ]} \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl 26 Nov 2007 12:52:45 -0000 1.1 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl 13 Dec 2007 05:33:42 -0000 1.2 @@ -10,6 +10,7 @@ folder_id:optional tag_id:integer,optional {sort "fs_objects.title"} + {package_id:optional} {dir "DESC"} } @@ -23,6 +24,7 @@ # so that we can get a path to prefix to the files set root_package_id [ajaxfs::get_root_folder -folder_id $folder_id] +if {[info exists package_id]} { set root_package_id $package_id } set root_folder_id [fs::get_root_folder -package_id $root_package_id] set folder_name [lang::util::localize [fs::get_object_name -object_id $folder_id]] @@ -86,8 +88,10 @@ } -db_multirow -extend { filename icon last_modified_pretty content_size_pretty download_url object_counter file_list_start file_list_end write_p tags} contents $query_name $query { +db_multirow -extend { filename icon last_modified_pretty content_size_pretty download_url linkurl object_counter file_list_start file_list_end write_p tags symlink_id} contents $query_name $query { + set symlink_id "" + # title of the file if { ![exists_and_not_null title] } { set title $name } @@ -117,8 +121,40 @@ switch -- $type { folder { - set icon "" + set shared_with [db_list get_share_from "select p.instance_name + from cr_folders f, + cr_symlinks s, + cr_items i, + acs_objects o, + apm_packages p, + site_nodes s1, + site_nodes s2 + where o.package_id = s2.object_id + and s1.node_id = s2.parent_id + and s1.object_id = p.package_id + and s.symlink_id = o.object_id + and s.symlink_id = i.item_id + and s.target_id = :object_id + and f.folder_id=i.parent_id"] + if { [llength $shared_with] > 0} { + set shareditems [join ${shared_with} "
  • "] + set qtip "
    ${title} is shared with
    " + set icon "" + } else { + set qtip "${title}" + set icon "" + } } + symlink { + set target_id [db_string get_target_folder "select target_id from cr_symlinks where symlink_id=:object_id"] + set symlink_id $object_id + set object_id $target_id + set target_package_id [ajaxfs::get_root_folder -folder_id $target_id] + set instance_name [db_string get_subsite_name "select instance_name from apm_packages where package_id=(select context_id from acs_objects where object_id = ${target_package_id})"] + set qtip "
    ${title} shared from ${instance_name}
    " + set icon "" + set content_size_pretty "" + } url { set icon "" set download_url $url @@ -153,22 +189,26 @@ } } + # cleanup : + # remove double quotes, replace with single quotes + regsub -all "\"" $title "" title + # filename and download url - set filename " " + if { $type != "folder" && $type != "symlink"} { - if { $type != "folder"} { - if { ![exists_and_not_null download_url] } { set download_url "${fs_url}download/${name}?[export_vars {{file_id $object_id}}]" + set linkurl "${fs_url}download/?[export_vars {{file_id $object_id}}]" } set filename $name - + if { $title == $name } { set filename " "} } else { set download_url "javascript:void(0)" - + set linkurl "javascript:void(0)" + set filename " " } # get the tags for this fs item Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-tagcloud.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-tagcloud.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-tagcloud.tcl 26 Nov 2007 12:52:45 -0000 1.1 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-tagcloud.tcl 13 Dec 2007 05:33:42 -0000 1.2 @@ -28,16 +28,7 @@ set user_id [ad_conn user_id] } -# set subsite_p [myweb::subsite_p -ancestor_subsite_id $ancestor_subsite_id] -# set application_group_id [application_group::group_id_from_package_id -package_id $ancestor_subsite_id] -# set limit_clause { -# and m.object_id in (select p.object_id -# from acs_permissions_all p, fs_objects e -# where p.object_id = e.object_id -# and p.grantee_id = :application_group_id -# and p.privilege = 'read') -#} -# set limit_clause "and m.object_id in (select object_id from acs_objects where package_id = $package_id)" +set limit_clause "and m.object_id in (select object_id from acs_objects where package_id = $package_id)" db_multirow -extend { url } connections connections [subst { select c.category_id, t.name, count(*) as count, o.creation_user @@ -47,6 +38,7 @@ and t.locale = :locale and c.category_id = m.category_id and c.category_id = o.object_id +$limit_clause group by t.name, o.creation_date, o.creation_user, c.category_id order by t.name}] { set url "javascript:void(0)" Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/list-communities.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/list-communities.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/list-communities.adp 13 Dec 2007 05:33:42 -0000 1.1 @@ -0,0 +1,5 @@ +{"communities":[ + +{"target_folder_id":"@results.target_folder_id@","instance_name":"@results.instance_name;noquote@"} + +]} \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/list-communities.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/list-communities.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/list-communities.tcl 13 Dec 2007 05:33:42 -0000 1.1 @@ -0,0 +1,34 @@ +ad_page_contract { + + Create a list of communities that the user will choose from to share a folder + + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2007-11-30 + +} { + {query ""} +} + +set user_id [ad_conn user_id] + +set query_name dbqd.file-storage.www.folder-share.target_folders + +db_multirow -extend { instance_name } communities $query_name "" { + set instance_name [site_node::closest_ancestor_package -node_id $node_id -package_key acs-subsite -element instance_name] +} + +template::multirow sort communities instance_name + +template::multirow create results target_folder_id instance_name + +if { [exists_and_not_null query] } { + template::multirow foreach communities { + if { [string match "*[string toupper ${query}]*" [string toupper $instance_name]] } { + template::multirow append results $target_folder_id $instance_name + } + } +} else { + template::multirow foreach communities { + template::multirow append results $target_folder_id $instance_name + } +} \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-postgresql.xql 26 Nov 2007 12:52:45 -0000 1.1 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-postgresql.xql 13 Dec 2007 05:33:42 -0000 1.2 @@ -15,13 +15,14 @@ fs_objects.name, fs_objects.title, fs_objects.parent_id, + fs_objects.type, case when fs_objects.type = 'url' then ( select acs_permission__permission_p(fs_objects.object_id, :viewing_user_id, 'write') from dual) else 't' end as write_p from fs_objects - where fs_objects.type='folder' + where fs_objects.type in ('folder','symlink') and fs_objects.parent_id = :node and exists (select 1 from acs_object_party_privilege_map m Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.adp 26 Nov 2007 12:52:45 -0000 1.1 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.adp 13 Dec 2007 05:33:42 -0000 1.2 @@ -1 +1 @@ -[{"text":"@treenodes.name@","id":"@treenodes.id;noquote@","iconCls":"folder","singleClickExpand":true,"attributes":{"write_p":"@treenodes.write_p@"}}] \ No newline at end of file +[{"text":"@treenodes.name@","qtip":"@treenodes.qtip;noquote@","id":"@treenodes.id;noquote@","iconCls":"@treenodes.cls;noquote@","singleClickExpand":true,"attributes":{"write_p":"@treenodes.write_p@","type":"@treenodes.type;noquote@","symlink_id":"@treenodes.symlink_id@"}}] \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.tcl 26 Nov 2007 12:52:45 -0000 1.1 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.tcl 13 Dec 2007 05:33:42 -0000 1.2 @@ -23,22 +23,49 @@ set node [fs::get_root_folder -package_id $package_id] } -db_multirow -extend { text id href cls leaf } "treenodes" "treenodes" { } { +db_multirow -extend { text id href cls qtip symlink_id } "treenodes" "treenodes" { } { - set child_count [db_string "count_children" "select count(*) from fs_objects where parent_id = :object_id and type='folder'"] - if { [exists_and_not_null title] } { set text $title } else { set text $name } + set symlink_id "" set id "$object_id" set cls "folder" - set leaf "true" - if { $child_count > 0 } { - set leaf "false" + if { $type == "symlink" } { + set cls "symlink" + set target_id [db_string get_target_folder "select target_id from cr_symlinks where symlink_id=:object_id"] + set symlink_id $id + set id $target_id + set target_package_id [ajaxfs::get_root_folder -folder_id $target_id] + set instance_name [db_string get_subsite_name "select instance_name from apm_packages where package_id=(select context_id from acs_objects where object_id = ${target_package_id})"] + set qtip "${text} shared from ${instance_name}" + } else { + set shared_with [db_list get_share_from "select p.instance_name + from cr_folders f, + cr_symlinks s, + cr_items i, + acs_objects o, + apm_packages p, + site_nodes s1, + site_nodes s2 + where o.package_id = s2.object_id + and s1.node_id = s2.parent_id + and s1.object_id = p.package_id + and s.symlink_id = o.object_id + and s.symlink_id = i.item_id + and s.target_id = :object_id + and f.folder_id=i.parent_id"] + if { [llength $shared_with] > 0} { + set cls "sharedfolder" + set qtip "
    ${text} is shared with
    " + } else { + set cls "folder" + set qtip $text + } } } \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/share-folder.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/share-folder.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/share-folder.adp 13 Dec 2007 05:33:42 -0000 1.1 @@ -0,0 +1 @@ +@result;noquote@ \ No newline at end of file Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/share-folder.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/share-folder.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/share-folder.tcl 13 Dec 2007 05:33:42 -0000 1.1 @@ -0,0 +1,32 @@ +ad_page_contract { + Share a folder with another file storage instance, + create a symlink in the target +} { + target_folder_id + folder_id +} + +set result 1 +set user_id [ad_conn user_id] + +# create a symlink for each target community +set symlink_id [content::symlink::new \ + -target_id $folder_id \ + -parent_id $target_folder_id \ + -label [content::folder::get_label -folder_id $folder_id]] + +# give permission to the owners of the root folder +# get subsite application group for the target file-storage +# and grant admin over the original folder +set target_package_id [lindex \ + [fs::get_folder_package_and_root $target_folder_id] 0] +set target_subsite_package_id [site_node::closest_ancestor_package -node_id [site_node::get_node_id_from_object_id -object_id $target_package_id]] +set target_application_group [application_group::group_id_from_package_id -package_id $target_subsite_package_id] +set target_admins [group::get_rel_segment -group_id $target_application_group -type "admin_rel"] +set target_members [group::get_rel_segment -group_id $target_application_group -type "membership_rel"] +foreach {type privilege} {admins admin members read members create members delete members write} { + permission::grant \ + -object_id $folder_id \ + -party_id [set target_$type] \ + -privilege $privilege +}