Enter or edit one or more tags. Use commas (,) to separate the tags:
"});var j=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",scope:this,handler:k},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",scope:this,handler:function(){this.tagWindow.hide()}}];this.tagWindow=new Ext.Window({id:"tag-win",layout:"fit",width:450,height:200,title:"Tags",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:d,buttons:j})}this.tagWindow.show("undefined",function(){Ext.get("fstags").dom.value=g;this.initTagAutoComplete()},this)},initTagAutoComplete:function(){var a=new YAHOO.util.LocalDataSource(oAutoCompArr);if(document.getElementById("fstags")){var b=new YAHOO.widget.AutoComplete("fstags","oAutoCompContainer1",a);b.animHoriz=false;b.animVert=false;b.queryDelay=0;b.maxResultsDisplayed=10;b.useIFrame=true;b.delimChar=",";b.allowBrowserAutocomplete=false;b.typeAhead=true;b.useShadow=true;b.prehighlightClassName="yui-ac-prehighlight";b.formatResult=function(c,e){var d=c[0];return d}}},downloadArchive:function(a){if(a){top.location.href=this.config.package_url+"download-archive/?object_id="+a}},showShareOptions:function(a,h,l){var s=a;var f=s.store.getAt(h);var r=f.get("id");var g=f.get("title");var m=this.layout.findById("treepanel");var k=this.config.package_id;var q=this.xmlhttpurl;var p=this.sharefolderWindow;var j=function(){var e=m.getSelectionModel().getSelectedNode();e.loaded=false;e.collapse();e.fireEvent("click",e);e.expand();p.hide()};var c=function(e){Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later.")};var b=function(){var e=this.communityCombo.getValue();this.fsCore.doAction("sharefolder",j,c,null,{target_folder_id:e,folder_id:r})};if(p==null){var o=new Ext.data.JsonStore({url:q+"list-communities",root:"communities",fields:["target_folder_id","instance_name"]});this.communityCombo=new Ext.form.ComboBox({id:"communities_list",store:o,displayField:"instance_name",typeAhead:true,fieldLabel:"Community",triggerAction:"all",emptyText:"Select a community",hiddenName:"target_folder_id",valueField:"target_folder_id",forceSelection:true,handleHeight:80,selectOnFocus:true});var d=new Ext.form.FormPanel({id:"sharefolderform",title:"Select the community where you wish to share the
"+g+" folder with.",frame:true,items:this.communityCombo});var n=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",scope:this,handler:b},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",scope:this,handler:function(){p.hide()}}];p=new Ext.Window({id:"share-win",layout:"fit",width:380,height:200,title:"Share Folder",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:d,buttons:n});this.sharefolderWindow=p}else{this.sharefolderWindow.findById("sharefolderform").setTitle("Select the community where you wish to share the
"+g+" folder with.");this.communityCombo.reset()}p.show()},redirectViews:function(a,b,f){if(a.id=="filepanel"){var g=a;var c=g.store.getAt(b);var d=c.get("id")}else{var d=b}window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+d+"/info");window.focus()},redirectPerms:function(a,b,f){if(a.id=="filepanel"){var h=a;var c=h.store.getAt(b);var d=c.get("id")}else{var d=b}var g=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+d+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder);g.focus()},redirectNotifs:function(b,d,h){if(b.id=="filepanel"){var j=b;var f=j.store.getAt(d);var g=f.get("id");var c=f.get("title")}else{var a=b;var f=a.getSelectionModel().getSelectedNode();var g=f.attributes.id;var c=f.text}window.location.href=this.xmlhttpurl+"notif-toggle?pretty_name="+c+"&object_id="+g+"&return_url="+this.config.package_url+"?folder_id="+this.currentfolder},redirectProperties:function(b,a,f){var h=b;var c=h.store.getAt(a);var d=c.get("id");var g=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+d);g.focus()},showRevisions:function(a,d,j){var n=a;var b=n.store.getAt(d);n.getSelectionModel().selectRow(d);var l=b.get("id");var c=b.get("filename");var m=this.revisionsWindow;if(m==null){m=new Ext.Window({id:"rev-win",layout:"fit",width:550,height:300,closeAction:"hide",modal:true,plain:true,items:new Ext.TabPanel({id:"rev-tabs",items:[this.createRevGrid(),this.newRevForm()]})});this.revisionsWindow=m}m.setTitle(c+" - "+acs_lang_text.properties||"Properties");var h=m.findById("revisionspanel");var g=m.findById("rev-tabs");var k=m.findById("rev-form");var f=this.config.package_id;h.store.on("load",function(){this.getSelectionModel().selectFirstRow()},h);h.on("activate",function(){this.store.baseParams.file_id=l;this.store.baseParams.package_id=f;this.store.load()},h);m.on("beforehide",function(){this.activate(1)},g);m.on("show",function(){this.activate(0)},g);m.show()},createRevGrid:function(){var f=[{header:"",width:30,sortable:false,dataIndex:"icon"},{header:"Title",width:180,sortable:false,dataIndex:"title"},{header:"Author",sortable:false,dataIndex:"author"},{header:"Size",sortable:false,dataIndex:"size"},{header:"Last Modified",sortable:false,dataIndex:"lastmodified"}];var a=new Ext.data.JsonReader({totalProperty:"total",root:"revisions",id:"revision_id"},[{name:"revision_id",type:"int"},{name:"icon"},{name:"title"},{name:"author"},{name:"type"},{name:"size"},{name:"url"},{name:"lastmodified"}]);var d=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-filerevisions"});var b=new Ext.grid.ColumnModel(f);var c=new Ext.data.Store({proxy:d,reader:a});var e=[{text:"Download",tooltip:"Download this revision",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",scope:this,handler:function(){var i=this.revisionsWindow.findById("revisionspanel");var h=i.getSelectionModel().getSelected();window.open(h.get("url"));window.focus()}},{text:"Delete",tooltip:"Delete this revision",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",scope:this,handler:function(){var i=this.revisionsWindow.findById("revisionspanel");var l=i.getSelectionModel();var h=l.getSelected();var j=h.get("revision_id");var k=h.get("title");if(i.store.getCount()==1){Ext.Msg.alert("Warning","Sorry, you can not delete the only revision for this file. You can delete the file instead")}else{Ext.Msg.confirm("Delete","Are you sure you want to delete this version of "+k+" ? This action can not be reversed.",function(n){if(n=="yes"){var o=function(p){l.selectPrevious();i.store.remove(h)};var m=function(){Ext.Msg.alert("Delete Error","Sorry an error occurred. Please try again later.")};this.fsCore.doAction("delete-revision",o,m,null,{version_id:j})}},this)}}}];var g=new Ext.grid.GridPanel({store:c,cm:b,sm:new Ext.grid.RowSelectionModel({singleSelect:true}),id:"revisionspanel",title:"Revisions",loadMask:true,tbar:e});return g},newRevForm:function(){var b="Please choose a file to upload";var a=new Ext.Panel({id:"rev-form",align:"left",frame:true,title:"New Revision",html:'
',buttons:[{text:"Upload New Revision",handler:function(e){if(Ext.get("rev_upload_file").dom.value==""){Ext.Msg.alert("Warning","Please choose a file to upload")}else{var d=this.layout.findById("filepanel");var f=d.getSelectionModel().getSelected();Ext.get("rev_file_id").dom.value=f.get("id");Ext.get("rev_file_title").dom.value=f.get("title");var g={success:function(){},upload:function(){this.revisionsWindow.findById("rev-tabs").activate(0);Ext.get("newrevfileform").dom.reset();this.revisionsWindow.findById("rev-form").body.unmask();e.enable()},failure:function(){Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.");this.revisionsWindow.findById("rev-form").body.unmask();e.enable()},scope:this};this.revisionsWindow.findById("rev-form").body.mask("
Uploading new revision. Please wait");e.disable();YAHOO.util.Connect.setForm("newrevfileform",true,true);var c=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-filerevision",g)}}.createDelegate(this),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"}]});return a},copyLink:function(b,j,k){if(b.id=="treepanel"){if(window.location.port!=""){var d=":"+window.location.port}else{var d=""}var c=window.location.protocol+"//"+window.location.hostname+d+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+j}else{var l=b;var g=l.store.getAt(j);var a=g.get("type");if(a==="folder"){var c=window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+g.get("id")}else{if(a==="url"){var c=g.get("url")}else{var c=window.location.protocol+"//"+window.location.hostname+g.get("url")}}}if(Ext.isIE){window.clipboardData.setData("text",c)}else{var h=Ext.Msg.show({title:acs_lang_text.linkaddress||"Copy Link Address",prompt:true,msg:acs_lang_text.copyhighlighted||"Copy the highlighted text to your clipboard.",value:c,buttons:Ext.Msg.OK});var f=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");f[0].select()}}};
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js,v
diff -u -N -r1.24 -r1.25
--- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 18 Apr 2009 13:49:27 -0000 1.24
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 27 Apr 2009 01:46:37 -0000 1.25
@@ -542,6 +542,7 @@
})
var tbutton = {
+ id:'btnToolsMenu',
text:'Tools',
iconCls:'toolsmenu',
menu: menu
@@ -553,25 +554,43 @@
// create the toolbar for this instance of ajaxfs
createToolbar : function() {
- var rootnode = this.config.treerootnode;
- var toolbar = [];
- if(rootnode.attributes["write_p"] == 't') {
- var toolbar = [
- ' ',
- {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', scope:this,handler: this.addFolder},
- {id:'btnUploadFile', 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', scope:this, handler: this.addFile}
- ];
- if(this.create_url_p) {
- toolbar.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', scope:this, handler: this.addUrl});
- }
- toolbar.push({text: acs_lang_text.deletefs || 'Delete', tooltip: acs_lang_text.deletefs || 'Delete', icon: '/resources/ajaxhelper/icons/delete.png', cls : 'x-btn-text-icon', scope:this, handler: this.delItem });
- toolbar.push(this.createToolsMenu());
- toolbar.push('->');
+ var toolbar = [
+ ' ',
+ {id:'btnNewFolder',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', scope:this,handler: this.addFolder},
+ {id:'btnUploadFile', 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', scope:this, handler: this.addFile}
+ ];
+ if(this.create_url_p) {
+ toolbar.push({id:'btnCreateUrl',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', scope:this, handler: this.addUrl});
}
+ toolbar.push({id:'btnDelete',text: acs_lang_text.deletefs || 'Delete', tooltip: acs_lang_text.deletefs || 'Delete', icon: '/resources/ajaxhelper/icons/delete.png', cls : 'x-btn-text-icon', scope:this, handler: this.delItem });
+ toolbar.push(this.createToolsMenu());
+ toolbar.push('->');
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', scope:this, handler: function() { this.downloadArchive(rootnode.id) } });
return toolbar;
},
+ // check permissions of the given tree node and enable/disable toolbars as needed
+
+ resetToolbar : function(node) {
+ if(node.attributes.attributes["write_p"] == 't') {
+ Ext.getCmp('btnNewFolder').show();
+ Ext.getCmp('btnUploadFile').show();
+ Ext.getCmp('btnDelete').show();
+ Ext.getCmp('btnToolsMenu').show();
+ if(this.create_url_p) {
+ Ext.getCmp('btnCreateUrl').show();
+ }
+ } else {
+ Ext.getCmp('btnNewFolder').hide();
+ Ext.getCmp('btnUploadFile').hide();
+ Ext.getCmp('btnDelete').hide();
+ Ext.getCmp('btnToolsMenu').hide();
+ if(this.create_url_p) {
+ Ext.getCmp('btnCreateUrl').hide();
+ }
+ }
+ },
+
// creates the left panel as an accordion, top panel has the folders, bottom panel has the tags
createLeft : function() {
@@ -1112,6 +1131,8 @@
gridpanel.store.baseParams['package_id'] = this.config.package_id;
// gridpanel.store.baseParams['tag_id'] = '';
+ this.resetToolbar(node);
+
gridpanel.store.on('load',function(store,records) {
node.attributes.attributes.size = records.length+" items";
},{single:true})