Index: openacs-4/packages/ajax-filestorage-ui/ajax-filestorage-ui.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/ajax-filestorage-ui.info,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/ajax-filestorage-ui/ajax-filestorage-ui.info 8 Sep 2007 14:32:50 -0000 1.3
+++ openacs-4/packages/ajax-filestorage-ui/ajax-filestorage-ui.info 14 Nov 2007 04:19:52 -0000 1.4
@@ -8,21 +8,25 @@
f
ajaxfs2
-
+
Hamilton Chua
2006-06-01
Solutiongrove
0
-
-
+
+
+
+
+
+
Index: openacs-4/packages/ajax-filestorage-ui/catalog/ajax-filestorage-ui.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/catalog/ajax-filestorage-ui.en_US.ISO-8859-1.xml,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/catalog/ajax-filestorage-ui.en_US.ISO-8859-1.xml 8 Sep 2007 14:32:50 -0000 1.1
+++ openacs-4/packages/ajax-filestorage-ui/catalog/ajax-filestorage-ui.en_US.ISO-8859-1.xml 14 Nov 2007 04:19:53 -0000 1.2
@@ -16,6 +16,7 @@
Create URL failed, please try again later.
Sorry, there was an error trying to delete this item.
Description
+ Download Archive
Duplicate Name
Please enter a different name. The name you entered is already being used.
Error
Index: openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp 8 Sep 2007 14:32:51 -0000 1.1
+++ openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp 14 Nov 2007 04:19:53 -0000 1.2
@@ -7,9 +7,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
+
+
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl 8 Sep 2007 14:32:51 -0000 1.1
+++ openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl 14 Nov 2007 04:19:53 -0000 1.2
@@ -11,7 +11,15 @@
# - gray
# - vista
+if { [exists_and_not_null theme] } {
+ set theme "gray"
+}
+
+set compressjs [parameter::get -package_id [ajaxfs::get_package_id] -parameter "compressjs" -default 0]
+set debug [parameter::get -package_id [ajaxfs::get_package_id] -parameter "debug" -default 1]
+
set user_id [ad_conn user_id]
+set create_url_p [parameter::get -package_id $package_id -parameter "EnableCreateUrl" -default 1]
if { [exists_and_not_null root_folder_id] } {
if { ![db_0or1row "get_folder_name" "select name as instance_name from fs_folders where folder_id = :root_folder_id"] } {
Index: openacs-4/packages/ajax-filestorage-ui/lib/tagslist.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/lib/tagslist.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/lib/tagslist.adp 14 Nov 2007 04:19:53 -0000 1.1
@@ -0,0 +1,3 @@
+
+ @connections.name@ (@connections.count@)
+
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/lib/tagslist.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/lib/tagslist.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/lib/tagslist.tcl 14 Nov 2007 04:19:53 -0000 1.1
@@ -0,0 +1,12 @@
+# expects connections multirow
+#
+# Creates a customizable lists of connections
+# add code here to customize the multirow
+
+set connections_url ""
+
+template::multirow extend connections callout fontsize
+
+template::multirow foreach connections {
+ set fontsize [expr 12+$count]
+}
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/tcl/apm-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/tcl/apm-callback-procs.tcl 14 Nov 2007 04:19:53 -0000 1.1
@@ -0,0 +1,56 @@
+# packages/ajax-filestorage-ui/tcl/apm-callback-procs.tcl
+
+ad_library {
+
+ APM Callbacks
+
+ @author Hamilton Chua (ham@solutiongrove.com)
+
+}
+
+namespace eval ajaxfs::apm {}
+
+ad_proc -private ajaxfs::apm::after_mount {
+ -package_id
+ -node_id
+} {
+ After install callback.
+ Creates a new category tree for tagging.
+
+ @author Hamilton Chua (ham@solutiongrove.com)
+
+} {
+
+ set tree_id [category_tree::add -name "Tags"]
+ parameter::set_value -package_id $package_id -parameter "CategoryTreeId" -value $tree_id
+
+}
+
+ad_proc -private ajaxfs::apm::after_upgrade {
+ -from_version_name
+ -to_version_name
+} {
+
+ Upgrade scripts
+
+ @author Roel Canicula (roelmc@pldtdsl.net)
+
+} {
+
+ apm_upgrade_logic \
+ -from_version_name $from_version_name \
+ -to_version_name $to_version_name \
+ -spec {
+ 0.8d 0.81d {
+
+ array set node [site_node::get -url /ajaxfs2]
+ set package_id $node(package_id)
+ set tree_id [category_tree::add -name "Tags"]
+ parameter::set_value -package_id $package_id -parameter "CategoryTreeId" -value $tree_id
+
+ }
+
+
+ }
+
+}
Index: openacs-4/packages/ajax-filestorage-ui/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/Attic/index.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/ajax-filestorage-ui/www/index.adp 8 Sep 2007 14:32:51 -0000 1.4
+++ openacs-4/packages/ajax-filestorage-ui/www/index.adp 14 Nov 2007 04:19:53 -0000 1.5
@@ -5,27 +5,31 @@
@page_title@
+
+
+
-
-
-
+
+
-
-
+2
+
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/Attic/index.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/ajax-filestorage-ui/www/index.tcl 8 Sep 2007 14:32:54 -0000 1.3
+++ openacs-4/packages/ajax-filestorage-ui/www/index.tcl 14 Nov 2007 04:19:53 -0000 1.4
@@ -9,9 +9,14 @@
{folder_id:integer,optional }
}
+if { [exists_and_not_null theme] } {
+ set theme "gray"
+}
+
set user_id [ad_conn user_id]
set page_title "Ajax File Storage UI"
set options ""
+set create_url_p [parameter::get -package_id $package_id -parameter "EnableCreateUrl" -default 1]
if { [exists_and_not_null root_folder_id] } {
if { ![db_0or1row "get_folder_name" "select name as instance_name from fs_folders where folder_id = :root_folder_id"] } {
@@ -32,7 +37,7 @@
append options ",pathToFolder: new Array([ajaxfs::generate_path -folder_id $folder_id])"
}
if { [exists_and_not_null public] } {
- append options ",public:$public"
+ append options ",ispublic:$public"
}
if { [exists_and_not_null layoutdiv] } {
append options ",layoutdiv:\"$layoutdiv\""
Index: openacs-4/packages/ajax-filestorage-ui/www/doc/index.html
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/doc/index.html,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/www/doc/index.html 8 Sep 2007 14:32:55 -0000 1.1
+++ openacs-4/packages/ajax-filestorage-ui/www/doc/index.html 14 Nov 2007 04:19:53 -0000 1.2
@@ -12,9 +12,17 @@
Ajax File Storage User Interface
Hamilton G. Chua (ham@solutiongrove.com)
- September 2007
- v0.8d
+ October 2007
+ v0.81d
What's New :
+v0.81d
+
+ context menu adds links to file properties and permissions
+ support for tagging files
+ tagcloud panel
+ download archive button on toolbar to download the entire file storage contents
+ download archive menu item in folder context menu to download an archive of a folder
+
v0.8d
can be used on all file storage instances by following setup instructions below
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.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js 8 Sep 2007 14:32:55 -0000 1.1
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js 14 Nov 2007 04:19:54 -0000 1.2
@@ -230,7 +230,7 @@
var _2b=_28.currentfolder;
var _2c=_28.treepanel.getNodeById(_2b).text;
var _2d=new FileProgress(_27,this.getSetting("progress_target"));
-_2d.SetStatus(_29+""+_2c+" "+_2a);
+_2d.SetStatus(_29+""+_2c+" Title: (optional) "+_2a);
_2d.ToggleCancel(true,this);
this.addFileParam(_27.id,"folder_id",_2b);
_28.upldDialog.buttons[0].enable();
@@ -345,11 +345,13 @@
this.config=null;
this.layout=null;
this.treepanel=null;
+this.tagcloudpanel=null;
this.te=null;
this.rootfolder=null;
this.filegrid=null;
this.toolbar=null;
this.currentfolder=null;
+this.currenttag=null;
this.asyncCon=new Ext.data.Connection();
this.msgbox=Ext.MessageBox;
this.upldDialog=null;
@@ -426,16 +428,23 @@
}else{
if(_51!="folder"&&_53===" "){
_53=_4f.get("title");
+_4f.set("filename",_53);
}
if(_51=="folder"){
this.treepanel.getNodeById(_52).setText(_56);
}
+nodetags=_4f.get("tags");
+if(nodetags!=""){
+var _5d="";
+}else{
+var _5d="
";
+}
_4f.set("title",_56);
-_4f.set("title_and_name",""+_56+" "+_53+" ");
+_4f.set("title_and_name",""+_56+" "+_53+" "+_5d);
_4f.commit();
}
}else{
-Ext.Msg.alert(acs_lang_text.error||"Error",err_msg_text+":"+_5a.responseText+" "+_5c);
+Ext.Msg.alert(acs_lang_text.error||"Error",_5b+":"+_5a.responseText+" "+_5c);
}
};
this.asyncCon.request({url:this.xmlhttpurl+"editname",params:"newname="+_56+"&object_id="+_52+"&type="+_51+"&url="+_50,method:"POST",callback:_57,scope:this});
@@ -447,50 +456,104 @@
}
};
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:_4f.get("title"),buttons:Ext.Msg.OKCANCEL,fn:_54.createDelegate(this)});
-var _5d=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input","x-msg-box");
-_5d[0].select();
+var _5e=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input","x-msg-box");
+_5e[0].select();
};
this.permsRedirect=function(){
-var _5e=this.filegrid.getSelectionModel().getSelected();
-var _5f=_5e.get("id");
-var _60=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+_5f+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder);
-_60.focus();
+var _5f=this.filegrid.getSelectionModel().getSelected();
+var _60=_5f.get("id");
+var _61=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+_60+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder);
+_61.focus();
};
this.propertiesRedirect=function(){
-var _61=this.filegrid.getSelectionModel().getSelected();
-var _62=_61.get("id");
-var _63=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+_62);
-_63.focus();
+var _62=this.filegrid.getSelectionModel().getSelected();
+var _63=_62.get("id");
+var _64=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+_63);
+_64.focus();
};
-this.showContext=function(_64,i,e){
+this.viewsRedirect=function(){
+var _65=this.filegrid.getSelectionModel().getSelected();
+var _66=_65.get("id");
+window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+_66+"/info");
+window.focus();
+};
+this.promptTag=function(){
+var _67=this;
+var _68=_67.filegrid.getSelectionModel().getSelected();
+var _69=_68.get("id");
+Ext.Msg.prompt("Tag","Enter or edit one or more tags. Seperate tags with commas (,):",function(btn,_6b){
+if(btn=="ok"){
+var _6c=function(_6d,_6e,_6f){
+if(_6e){
+_68.set("tags",_6b);
+Ext.get("tagscontainer_"+_69).update("Tag:"+_6b+" ");
+this.tagcloudpanel.load("/ajaxfs2/xmlhttp/tagcloud?package_id="+this.config.package_id);
+}
+};
+_67.asyncCon.request({url:_67.xmlhttpurl+"addtag",params:"object_id="+_69+"&tags="+_6b+"&package_id="+_67.config.package_id,method:"POST",callback:_6c,scope:_67});
+}
+});
+if(document.getElementById("tagslist_"+_69)){
+var _70=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input","x-msg-box");
+_70[0].value=document.getElementById("tagslist_"+_69).innerHTML;
+_70[0].select();
+}
+};
+this.downloadArchive=function(){
+var _71=this.filegrid.getSelectionModel().getSelected();
+var _72=_71.get("id");
+top.location.href="download-archive/?object_id="+_72;
+};
+this.showContext=function(_73,i,e){
e.stopEvent();
+var dm=_73.getDataSource();
+var _77=dm.getAt(i);
+var _78=_77.get("type");
+var _79=_77.get("id");
+if(_78=="folder"){
+var _7a="Open";
+}else{
+var _7a="Download";
+}
if(this.contextmenu==null){
-this.contextmenu=new Ext.menu.Menu({id:"rightclickmenu",items:[new Ext.menu.Item({text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajax-filestorage-ui/icons/delete.png",handler:this.confirmDel.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.rename||"Rename",icon:"/resources/ajax-filestorage-ui/icons/page_edit.png",handler:this.fileRename.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajax-filestorage-ui/icons/page_copy.png",handler:this.linkCopy.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajax-filestorage-ui/icons/group_key.png",handler:this.permsRedirect.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.properties||"Properties",icon:"/resources/ajax-filestorage-ui/icons/page_edit.png",handler:this.propertiesRedirect.createDelegate(this)})]});
+this.contextmenu=new Ext.menu.Menu({id:"rightclickmenu",items:[new Ext.menu.Item({text:_7a,icon:"/resources/ajax-filestorage-ui/icons/page_white.png",handler:this.itemDblClick.createDelegate(this,[_73,i,e],false)}),new Ext.menu.Item({text:"Tag",icon:"/resources/ajax-filestorage-ui/icons/tag_blue.png",handler:this.promptTag.createDelegate(this)}),new Ext.menu.Item({text:"Views",icon:"/resources/ajax-filestorage-ui/icons/camera.png",handler:this.viewsRedirect.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajax-filestorage-ui/icons/delete.png",handler:this.confirmDel.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.rename||"Rename",icon:"/resources/ajax-filestorage-ui/icons/page_edit.png",handler:this.fileRename.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajax-filestorage-ui/icons/page_copy.png",handler:this.linkCopy.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajax-filestorage-ui/icons/group_key.png",handler:this.permsRedirect.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.properties||"Properties",icon:"/resources/ajax-filestorage-ui/icons/page_edit.png",handler:this.propertiesRedirect.createDelegate(this)}),new Ext.menu.Item({text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajax-filestorage-ui/icons/arrow_down.png",handler:this.downloadArchive.createDelegate(this)})]});
+}else{
+this.contextmenu.items.items[0].setText(_7a);
}
-if(_64.getSelectionModel().getCount()>1){
-this.contextmenu.items.items[1].disable();
-this.contextmenu.items.items[2].disable();
-this.contextmenu.items.items[3].disable();
-this.contextmenu.items.items[4].disable();
+if(_73.getSelectionModel().getCount()>1){
+this.contextmenu.items.items[0].hide();
+this.contextmenu.items.items[1].hide();
+this.contextmenu.items.items[2].hide();
+this.contextmenu.items.items[3].show();
+this.contextmenu.items.items[4].hide();
+this.contextmenu.items.items[5].hide();
+this.contextmenu.items.items[6].hide();
+this.contextmenu.items.items[7].hide();
+this.contextmenu.items.items[8].hide();
}else{
-this.contextmenu.items.items[1].enable();
-this.contextmenu.items.items[2].enable();
-this.contextmenu.items.items[3].enable();
-var _67=this.filegrid.getSelectionModel().getSelected();
-var _68=_67.get("type");
-if(_68=="folder"||_68=="url"){
-this.contextmenu.items.items[4].disable();
+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(_78=="folder"){
+this.contextmenu.items.items[1].hide();
+this.contextmenu.items.items[7].hide();
+this.contextmenu.items.items[8].show();
}else{
-this.contextmenu.items.items[4].enable();
+this.contextmenu.items.items[1].show();
+this.contextmenu.items.items[7].show();
+this.contextmenu.items.items[8].hide();
}
}
-var _69=e.getXY();
+var _7b=e.getXY();
this.contextmenu.rowid=i;
-this.contextmenu.showAt([_69[0],_69[1]]);
+this.contextmenu.showAt([_7b[0],_7b[1]]);
};
this.uploadFile=function(e){
if(document.getElementById("upload_file").value!=""&&document.getElementById("filetitle").value!=""){
-var _6b={success:function(){
+var _7d={success:function(){
},upload:function(){
this.treepanel.getSelectionModel().getSelectedNode().loaded=false;
this.treepanel.getSelectionModel().getSelectedNode().fireEvent("click",this.treepanel.getSelectionModel().getSelectedNode());
@@ -499,18 +562,18 @@
},failure:function(){
Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.");
},scope:this};
-var _6c=acs_lang_text.loading||"One moment. This may take a while depending on how large your upload is.";
-this.upldDialog.getEl().mask(" "+_6c);
+var _7e=acs_lang_text.loading||"One moment. This may take a while depending on how large your upload is.";
+this.upldDialog.getEl().mask(" "+_7e);
YAHOO.util.Connect.setForm("newfileform",true,true);
-var _6d=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"file-add",_6b);
+var _7f=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"file-add",_7d);
}else{
Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.file_required||"Title and File to upload are required.");
}
};
this.createUrl=function(e){
if(document.getElementById("fsurl").value!=""&&document.getElementById("fstitle").value!=""){
if(isURL(document.getElementById("fsurl").value)){
-var _6f={success:function(){
+var _81={success:function(){
this.treepanel.getSelectionModel().getSelectedNode().loaded=false;
this.treepanel.getSelectionModel().getSelectedNode().fireEvent("click",this.treepanel.getSelectionModel().getSelectedNode());
this.createurlDialog.getEl().unmask();
@@ -521,7 +584,7 @@
},scope:this};
this.createurlDialog.getEl().mask(" One moment.");
YAHOO.util.Connect.setForm("simple-add");
-var _70=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"url-add",_6f);
+var _82=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"url-add",_81);
}else{
Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.invalid_url||"URL is not a valid url.");
}
@@ -545,25 +608,25 @@
this.showUplddialog=function(){
this.upldDialog.setTitle(acs_lang_text.uploadfile||"Upload Files");
if(checkFlashVersion()<8){
-var _71=acs_lang_text.file_to_upload||"File to upload";
-var _72=acs_lang_text.file_title||"Title";
-var _73=acs_lang_text.file_description||"Description";
-var _74=acs_lang_text.multiple_files||"Multiple Files";
-var _75=acs_lang_text.multiple_files_msg||"This is a ZIPfile containing multiple files.";
-this.upldDialog.body.update(" ");
+var _83=acs_lang_text.file_to_upload||"File to upload";
+var _84=acs_lang_text.file_title||"Title";
+var _85=acs_lang_text.file_description||"Description";
+var _86=acs_lang_text.multiple_files||"Multiple Files";
+var _87=acs_lang_text.multiple_files_msg||"This is a ZIPfile containing multiple files.";
+this.upldDialog.body.update(""+_83+"
"+_84+"
"+_85+" :
"+_86+" : "+_87+"
");
if(!this.upldDialog.buttons){
this.upldDialog.addButton({text:acs_lang_text.upload||"Upload",icon:"/resources/ajax-filestorage-ui/icons/page_add.png",cls:"x-btn-text-icon"},this.uploadFile,this);
this.upldDialog.addButton({text:acs_lang_text.cancel||"Cancel",icon:"/resources/ajax-filestorage-ui/icons/cancel.png",cls:"x-btn-text-icon"},this.upldDialog.hide,this.upldDialog);
}
}else{
if(this.swfu==null){
-var _76=acs_lang_text.upload_intro||"Click Browse to select a file to upload to the selected folder.";
-this.upldDialog.body.update(""+_76+"
");
-var _77=String(this.config.package_id);
-var _78=String(this.config.user_id);
-var _79=String(this.currentfolder);
-var _7a=String(this.config.max_file_size)||5000000;
-this.swfu=new SWFUpload({debug:false,upload_target_url:"/ajaxfs2/xmlhttp/file-add-flash",upload_params:{user_id:_78,package_id:_77},file_types:"*.*",file_size_limit:_7a,file_queue_limit:3,begin_upload_on_queue:false,file_progress_handler:uploadProgress,file_cancelled_handler:uploadCancel,file_complete_handler:uploadComplete,queue_complete_handler:uploadQueueComplete,error_handler:uploadError,flash_url:"/resources/ajax-filestorage-ui/swfupload/swfupload.swf"});
+var _88=acs_lang_text.upload_intro||"Click Browse to select a file to upload to the selected folder.";
+this.upldDialog.body.update(""+_88+"
");
+var _89=String(this.config.package_id);
+var _8a=String(this.config.user_id);
+var _8b=String(this.currentfolder);
+var _8c=String(this.config.max_file_size)||5000000;
+this.swfu=new SWFUpload({debug:false,upload_target_url:"/ajaxfs2/xmlhttp/file-add-flash",upload_params:{user_id:_8a,package_id:_89},file_types:"*.*",file_size_limit:_8c,file_queue_limit:3,begin_upload_on_queue:false,file_progress_handler:uploadProgress,file_cancelled_handler:uploadCancel,file_complete_handler:uploadComplete,queue_complete_handler:uploadQueueComplete,error_handler:uploadError,flash_url:"/resources/ajax-filestorage-ui/swfupload/swfupload.swf"});
this.swfu.fileQueued=uploadStart.createDelegate(this.swfu,[this],true);
this.swfu.fileProgress=uploadProgress.createDelegate(this.swfu,[this],true);
this.swfu.fileComplete=uploadComplete.createDelegate(this.swfu,[this],true);
@@ -582,279 +645,299 @@
this.upldDialog.show();
};
this.confirmDel=function(){
-var _7b=acs_lang_text.confirm_delete||"Are you sure you want to delete";
-var _7c=acs_lang_text.foldercontains||"This folder contains";
-var _7d=this.filegrid.getSelectionModel().getSelections();
-if(_7d.length>0){
-if(_7d.length==1){
-var _7e=_7d[0].get("title");
-if(_7d[0].get("type")==="folder"){
-var msg=_7c+" "+_7d[0].get("size")+" . ";
+var _8d=acs_lang_text.confirm_delete||"Are you sure you want to delete";
+var _8e=acs_lang_text.foldercontains||"This folder contains";
+var _8f=this.filegrid.getSelectionModel().getSelections();
+if(_8f.length>0){
+if(_8f.length==1){
+var _90=_8f[0].get("title");
+if(_8f[0].get("type")==="folder"){
+var msg=_8e+" "+_8f[0].get("size")+" . ";
}else{
var msg="";
}
-var msg=msg+_7b+" "+_7e+" ?";
+var msg=msg+_8d+" "+_90+" ?";
}else{
-var msg=_7b+": ";
-for(var x=0;x<_7d.length;x++){
-msg=msg+""+_7d[x].get("title")+" ";
-if(_7d[x].get("type")==="folder"){
-msg=msg+"("+_7d[x].get("size")+")";
+var msg=_8d+": ";
+for(var x=0;x<_8f.length;x++){
+msg=msg+""+_8f[x].get("title")+" ";
+if(_8f[x].get("type")==="folder"){
+msg=msg+"("+_8f[x].get("size")+")";
}
msg=msg+" ";
}
}
this.msgbox.confirm(acs_lang_text.confirm||"Confirm",msg,this.delFsitems,this);
}else{
-var _81=this.treepanel.getSelectionModel().getSelectedNode();
-var _82=this.treepanel.getRootNode();
-if(_81.attributes["id"]==_82.attributes["id"]){
+var _93=this.treepanel.getSelectionModel().getSelectedNode();
+var _94=this.treepanel.getRootNode();
+if(_93.attributes["id"]==_94.attributes["id"]){
Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.cant_del_root||"The root folder can not be deleted.");
}else{
-this.msgbox.confirm(acs_lang_text.confirm||"Confirm",_7b+" "+_81.attributes["text"]+" ?",this.delFolder,this);
+this.msgbox.confirm(acs_lang_text.confirm||"Confirm",_8d+" "+_93.attributes["text"]+" ?",this.delFolder,this);
}
}
};
-this.delFsitems=function(_83){
-var _84=this.filegrid.getSelectionModel().getSelections();
-var _85=[];
-for(var x=0;x<_84.length;x++){
-_85[x]=_84[x].get("id");
+this.delFsitems=function(_95){
+var _96=this.filegrid.getSelectionModel().getSelections();
+var _97=[];
+for(var x=0;x<_96.length;x++){
+_97[x]=_96[x].get("id");
}
-var _87=function(_88,_89,_8a){
-var _8b=acs_lang_text.delete_error||"Sorry, there was an error trying to delete this item.";
-if(_89&&_8a.responseText==1){
-for(var x=0;x<_84.length;x++){
-this.filegrid.getDataSource().remove(_84[x]);
-var _8d=_84[x].get("id");
-var _8e=this.treepanel.getNodeById(_8d);
-if(_8e){
-_8e.parentNode.fireEvent("click",_8e.parentNode);
-_8e.parentNode.removeChild(_8e);
+var _99=function(_9a,_9b,_9c){
+var _9d=acs_lang_text.delete_error||"Sorry, there was an error trying to delete this item.";
+if(_9b&&_9c.responseText==1){
+for(var x=0;x<_96.length;x++){
+this.filegrid.getDataSource().remove(_96[x]);
+var _9f=_96[x].get("id");
+var _a0=this.treepanel.getNodeById(_9f);
+if(_a0){
+_a0.parentNode.fireEvent("click",_a0.parentNode);
+_a0.parentNode.removeChild(_a0);
}
}
this.filegrid.getSelectionModel().clearSelections();
}else{
-Ext.Msg.alert(acs_lang_text.error||"Error",_8b+""+_8a.responseText+" ");
+Ext.Msg.alert(acs_lang_text.error||"Error",_9d+""+_9c.responseText+" ");
}
this.filegrid.container.unmask();
};
-var _8f="object_id="+_85;
+var _a1="object_id="+_97;
var url=this.xmlhttpurl+"delete";
-if(_83==="yes"){
+if(_95==="yes"){
this.filegrid.container.mask("Deleting");
-this.asyncCon.request({url:url,params:_8f,method:"POST",callback:_87,scope:this});
+this.asyncCon.request({url:url,params:_a1,method:"POST",callback:_99,scope:this});
}
};
-this.delFolder=function(_91){
-var _92=this.treepanel.getSelectionModel().getSelectedNode();
-var _93=_92.parentNode;
-var id=_92.attributes["id"];
-var _95=function(_96,_97,_98){
-var _99=acs_lang_text.delete_error||"Sorry, there was an error trying to delete this item.";
-if(_97){
-if(_98.responseText!="1"){
-Ext.Msg.alert(acs_lang_text.error||"Error",_99+""+_98.responseText+" ");
+this.delFolder=function(_a3){
+var _a4=this.treepanel.getSelectionModel().getSelectedNode();
+var _a5=_a4.parentNode;
+var id=_a4.attributes["id"];
+var _a7=function(_a8,_a9,_aa){
+var _ab=acs_lang_text.delete_error||"Sorry, there was an error trying to delete this item.";
+if(_a9){
+if(_aa.responseText!="1"){
+Ext.Msg.alert(acs_lang_text.error||"Error",_ab+""+_aa.responseText+" ");
}else{
-_93.fireEvent("click",_93);
-_93.removeChild(_92);
+_a5.fireEvent("click",_a5);
+_a5.removeChild(_a4);
}
}else{
-Ext.Msg.alert(acs_lang_text.error||"Error",_99+""+_98.responseText+" ");
+Ext.Msg.alert(acs_lang_text.error||"Error",_ab+""+_aa.responseText+" ");
}
};
-if(_91==="yes"){
-this.asyncCon.request({url:this.xmlhttpurl+"delete",params:"object_id="+id,method:"POST",callback:_95,scope:this});
+if(_a3==="yes"){
+this.asyncCon.request({url:this.xmlhttpurl+"delete",params:"object_id="+id,method:"POST",callback:_a7,scope:this});
}
};
this.newFolder=function(){
var te=this.te;
-var _9b=this.treepanel;
-var _9c=_9b.getSelectionModel().getSelectedNode();
-_9c.expand();
-var _9d=function(_9e,_9f,_a0){
-var _a1=acs_lang_text.new_folder_error||"Sorry, there was an error trying to create your new folder.";
-if(_9f){
-if(!isNaN(parseInt(_a0.responseText))){
-if(parseInt(_a0.responseText)!=0){
-var _a2=_9c.appendChild(new Ext.tree.TreeNode({text:acs_lang_text.new_folder_label||"New Folder",id:_a0.responseText,iconCls:"folder",singleClickExpand:true,attributes:{write_p:"t"}}));
-_9b.getSelectionModel().select(_a2);
-_a2.loaded=true;
-_a2.fireEvent("click",_a2);
+var _ad=this.treepanel;
+var _ae=_ad.getSelectionModel().getSelectedNode();
+_ae.expand();
+var _af=function(_b0,_b1,_b2){
+var _b3=acs_lang_text.new_folder_error||"Sorry, there was an error trying to create your new folder.";
+if(_b1){
+if(_b2.responseText){
+var _b4=eval(_b2.responseText);
+if(parseInt(_b4[0].id)!=0){
+var _b5=_ae.appendChild(new Ext.tree.TreeNode({text:_b4[0].pretty_folder_name,id:_b4[0].id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:"t"}}));
+_ad.getSelectionModel().select(_b5);
+_b5.loaded=true;
+_b5.fireEvent("click",_b5);
setTimeout(function(){
-te.editNode=_a2;
-te.startEdit(_a2.ui.textNode);
+te.editNode=_b5;
+te.startEdit(_b5.ui.textNode);
},10);
}else{
-Ext.Msg.alert(acs_lang_text.error||"Error",_a1+""+_a0.responseText+" ");
+Ext.Msg.alert(acs_lang_text.error||"Error",_b3+""+_b2.responseText+" ");
}
}
}else{
-Ext.Msg.alert(acs_lang_text.error||"Error",_a1+""+_a0.responseText+" ");
+Ext.Msg.alert(acs_lang_text.error||"Error",_b3+""+_b2.responseText+" ");
}
};
-this.asyncCon.request({url:this.xmlhttpurl+"newblankfolder",params:"folder_id="+_9c.attributes["id"],method:"POST",callback:_9d,scope:this});
+this.asyncCon.request({url:this.xmlhttpurl+"newblankfolder",params:"folder_id="+_ae.attributes["id"],method:"POST",callback:_af,scope:this});
};
-this.itemDblClick=function(_a3,i,e){
-var dm=_a3.getDataSource();
-var _a7=dm.getAt(i);
-if(_a7.get("type")=="folder"){
-var _a8=this.treepanel.getNodeById(_a7.get("id"));
-if(!_a8.parentNode.isExpanded()){
-_a8.parentNode.expand();
+this.itemDblClick=function(_b6,i,e){
+var dm=_b6.getDataSource();
+var _ba=dm.getAt(i);
+if(_ba.get("type")=="folder"){
+var _bb=this.treepanel.getNodeById(_ba.get("id"));
+if(!_bb.parentNode.isExpanded()){
+_bb.parentNode.expand();
}
-_a8.fireEvent("click",_a8);
-_a8.expand();
+_bb.fireEvent("click",_bb);
+_bb.expand();
}else{
-window.open(_a7.get("url"));
+window.open(_ba.get("url"));
window.focus();
}
};
-this.loadFoldercontents=function(_a9,e){
-if(this.currentfolder!=null){
-this.treepanel.getNodeById(this.currentfolder).getUI().removeClass("x-tree-grayselected");
-}
-this.currentfolder=_a9.id;
-if(this.filegrid==null){
-var _ab=[{header:"",width:50,sortable:true,dataIndex:"icon"},{header:acs_lang_text.filename||"Filename",id:"filename",width:200,sortable:true,dataIndex:"title_and_name"},{header:acs_lang_text.size||"Size",sortable:true,dataIndex:"size"},{header:acs_lang_text.lastmodified||"Last Modified",sortable:true,dataIndex:"lastmodified"}];
-var _ac=new Ext.grid.ColumnModel(_ab);
-_ac.defaultSortable=true;
-var _ad=new Ext.data.JsonReader({totalProperty:"total",root:"foldercontents",id:"id"},[{name:"id",type:"int"},{name:"icon"},{name:"title"},{name:"filename"},{name:"type"},{name:"url"},{name:"write_p"},{name:"title_and_name"},{name:"size"},{name:"lastmodified"}]);
-var _ae=new Ext.data.HttpProxy({url:this.xmlhttpurl+"foldercontents"});
-var _af=new Ext.data.Store({proxy:_ae,reader:_ad,remoteSort:true});
-this.filegrid=new Ext.grid.Grid("files",{ds:_af,cm:_ac,autoHeight:false,autoWidth:true,autoSizeColumns:false,trackMouseOver:true,autoExpandColumn:"filename",enableColumnMove:false,enableColLock:false,enableColumnHide:false,loadMask:true,monitorWindowResize:true,enableDragDrop:true,ddGroup:"fileDD"});
+this.createFileGrid=function(){
+var _bc=[{header:"",width:50,sortable:true,dataIndex:"icon"},{header:acs_lang_text.filename||"Filename",id:"filename",width:200,sortable:true,dataIndex:"title_and_name"},{header:acs_lang_text.size||"Size",sortable:true,dataIndex:"size"},{header:acs_lang_text.lastmodified||"Last Modified",sortable:true,dataIndex:"lastmodified"}];
+var _bd=new Ext.grid.ColumnModel(_bc);
+_bd.defaultSortable=true;
+var _be=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:"title_and_name"},{name:"size"},{name:"lastmodified"}]);
+var _bf=new Ext.data.HttpProxy({url:this.xmlhttpurl+"foldercontents"});
+var _c0=new Ext.data.Store({proxy:_bf,reader:_be,remoteSort:true});
+this.filegrid=new Ext.grid.Grid("files",{ds:_c0,cm:_bd,autoHeight:false,autoWidth:true,autoSizeColumns:false,trackMouseOver:true,autoExpandColumn:"filename",enableColumnMove:false,enableColLock:false,enableColumnHide:false,loadMask:true,monitorWindowResize:true,enableDragDrop:true,ddGroup:"fileDD"});
this.filegrid.on("rowclick",function(){
this.treepanel.getSelectionModel().getSelectedNode().getUI().removeClass("x-tree-selected");
this.treepanel.getSelectionModel().getSelectedNode().getUI().addClass("x-tree-grayselected");
},this,true);
this.filegrid.on("rowdblclick",this.itemDblClick,this,true);
this.filegrid.on("rowcontextmenu",this.showContext,this,true);
-var _b0=this.filegrid;
-var _b1=this;
-var _b2=new Ext.dd.DropTarget(_b0.container,{ddGroup:"fileDD",copy:false,notifyDrop:function(dd,e,_b5){
-var ds=_b0.getDataSource();
-var sm=_b0.getSelectionModel();
-var _b8=sm.getSelections();
+var _c1=this.filegrid;
+var _c2=this;
+var _c3=new Ext.dd.DropTarget(_c1.container,{ddGroup:"fileDD",copy:false,notifyDrop:function(dd,e,_c6){
+var ds=_c1.getDataSource();
+var sm=_c1.getSelectionModel();
+var _c9=sm.getSelections();
if(dd.getDragData(e)){
-var _b9=dd.getDragData(e).rowIndex;
-if(typeof (_b9)!="undefined"){
+var _ca=dd.getDragData(e).rowIndex;
+if(typeof (_ca)!="undefined"){
if(!this.copy){
-for(i=0;i<_b8.length;i++){
-ds.remove(ds.getById(_b8[i].id));
+for(i=0;i<_c9.length;i++){
+ds.remove(ds.getById(_c9[i].id));
}
}
-ds.insert(_b9,_b5.selections);
+ds.insert(_ca,_c6.selections);
sm.clearSelections();
}
}
}});
this.filegrid.render();
this.createGridPanel(this.filegrid,"center",{title:acs_lang_text.file_list||"File List",closable:false});
+};
+this.loadTagObjects=function(_cb){
+if(this.filegrid==null){
+this.createFileGrid();
}
-this.filegrid.getDataSource().baseParams["folder_id"]=_a9.id;
-if(_a9.loading){
-_a9.on("expand",function(){
+this.treepanel.getSelectionModel().clearSelections();
+var id=_cb.substring(3,_cb.length);
+this.filegrid.getDataSource().baseParams["tag_id"]=id;
this.filegrid.getDataSource().load();
+};
+this.loadFoldercontents=function(_cd,e){
+if(this.currentfolder!=null){
+this.treepanel.getNodeById(this.currentfolder).getUI().removeClass("x-tree-grayselected");
+}
+if(this.currenttag!=null){
+Ext.get(this.currenttag).setStyle("font-weight","normal");
+}
+this.currentfolder=_cd.id;
+if(this.filegrid==null){
+this.createFileGrid();
+}
+this.filegrid.getDataSource().baseParams["folder_id"]=_cd.id;
+this.filegrid.getDataSource().baseParams["tag_id"]="";
+if(_cd.loading){
+_cd.on("expand",function(){
+this.filegrid.getDataSource().load();
}.createDelegate(this),true,{single:true});
}else{
this.filegrid.getDataSource().load();
}
};
this.renderTree=function(){
-var _ba=function(_bb,_bc,_bd){
-if(_bc){
-rootfolderobj=eval("("+_bd.responseText+")");
+var _cf=function(_d0,_d1,_d2){
+if(_d1){
+rootfolderobj=eval("("+_d2.responseText+")");
this.rootfolder=new Ext.tree.AsyncTreeNode({text:rootfolderobj.text,draggable:false,id:rootfolderobj.id,singeClickExpand:true,attributes:rootfolderobj.attributes});
if(rootfolderobj.attributes["write_p"]=="t"){
this.toolbar=new Ext.Toolbar("headerpanel");
this.toolbar.addButton({text:acs_lang_text.newfolder||"New Folder",icon:"/resources/ajax-filestorage-ui/icons/folder_add.png",cls:"x-btn-text-icon",handler:this.newFolder.createDelegate(this),scope:this});
this.toolbar.addButton({text:acs_lang_text.uploadfile||"Upload Files",icon:"/resources/ajax-filestorage-ui/icons/add.png",cls:"x-btn-text-icon",handler:this.showUplddialog.createDelegate(this),scope:this});
+if(create_url_p){
this.toolbar.addButton({text:acs_lang_text.createurl||"Create Url",icon:"/resources/ajax-filestorage-ui/icons/page_link.png",cls:"x-btn-text-icon",handler:this.showCreateUrldialog.createDelegate(this),scope:this});
+}
this.toolbar.addButton({text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajax-filestorage-ui/icons/delete.png",cls:"x-btn-text-icon",handler:this.confirmDel.createDelegate(this),scope:this});
-}else{
-this.layout.getRegion("north").hide();
}
+this.toolbar.addButton({text:acs_lang_text.download_archive||"Download Archive",icon:"/resources/ajax-filestorage-ui/icons/arrow_down.png",cls:"x-btn-text-icon",handler:function(){
+top.location.href="download-archive/index?object_id="+rootfolderobj.id;
+}.createDelegate(this),scrope:this});
this.treepanel.setRootNode(this.rootfolder);
this.treepanel.render();
-var _be=function(x){
-var _c0=this.treepanel.getNodeById(this.config.initOpenFolder);
-if(!_c0){
+var _d3=function(x){
+var _d5=this.treepanel.getNodeById(this.config.initOpenFolder);
+if(!_d5){
var x=x+1;
-var _c1=this.config.pathToFolder[x];
-var _c2=this.treepanel.getNodeById(_c1);
-_c2.on("expand",_be.createDelegate(this,[x]),this,{single:true});
-_c2.expand(true);
+var _d6=this.config.pathToFolder[x];
+var _d7=this.treepanel.getNodeById(_d6);
+_d7.on("expand",_d3.createDelegate(this,[x]),this,{single:true});
+_d7.expand(true);
}else{
-_c0.select();
-_c0.fireEvent("click",_c0);
+_d5.select();
+_d5.fireEvent("click",_d5);
}
};
-var _c3=function(){
+var _d8=function(){
if(this.config.initOpenFolder){
-var _c4=this.treepanel.getNodeById(this.config.initOpenFolder);
-if(_c4){
-_c4.expand();
-_c4.fireEvent("click",_c4);
+var _d9=this.treepanel.getNodeById(this.config.initOpenFolder);
+if(_d9){
+_d9.expand();
+_d9.fireEvent("click",_d9);
}else{
var x=1;
-var _c6=this.treepanel.getNodeById(this.config.pathToFolder[x]);
-_c6.on("expand",_be.createDelegate(this,[x]),this,{single:true});
-_c6.expand(true);
+var _db=this.treepanel.getNodeById(this.config.pathToFolder[x]);
+_db.on("expand",_d3.createDelegate(this,[x]),this,{single:true});
+_db.expand(true);
}
}else{
this.treepanel.fireEvent("click",this.rootfolder);
}
};
-this.rootfolder.on("expand",_c3,this,{single:true});
+this.rootfolder.on("expand",_d8,this,{single:true});
this.rootfolder.expand();
}else{
Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.tree_render_error||"Sorry, we encountered an error rendering the tree panel");
}
};
-var _c7="package_id="+this.config.package_id;
+var _dc="package_id="+this.config.package_id;
if(this.config.rootfolder){
-_c7=_c7+"&root_folder_id="+this.config.rootfolder;
+_dc=_dc+"&root_folder_id="+this.config.rootfolder;
}
-this.asyncCon.request({url:this.xmlhttpurl+"getrootfolder",params:_c7,method:"POST",callback:_ba,scope:this});
+this.asyncCon.request({url:this.xmlhttpurl+"getrootfolder",params:_dc,method:"POST",callback:_cf,scope:this});
};
this.loadTreepanel=function(){
-var _c8=Ext.get("folderpanel").createChild({tag:"div",id:"folders"});
+var _dd=Ext.get("folderpanel").createChild({tag:"div",id:"folders"});
this.treepanel=new Ext.tree.TreePanel("folders",{animate:true,loader:new Ext.tree.TreeLoader({dataUrl:this.xmlhttpurl+"loadnodes",baseParams:{package_id:this.config.package_id}}),enableDD:true,ddGroup:"fileDD",ddAppendOnly:true,containerScroll:true,rootVisible:true});
this.te=new Ext.tree.TreeEditor(this.treepanel,{allowBlank:false,blankText:acs_lang_text.folder_name_required||"A folder name is required",selectOnFocus:true});
-this.te.on("beforestartedit",function(_c9,el,_cb){
-if(_c9.editNode.attributes.attributes.write_p=="t"){
+this.te.on("beforestartedit",function(_de,el,_e0){
+if(_de.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(_cc,_cd,_ce){
-var _cf=_cc.editNode.parentNode;
-var _d0=_cf.childNodes;
-for(x=0;x<_d0.length;x++){
-if(_d0[x].text==_cd&&_d0[x].id!=_cc.editNode.id){
+this.te.on("beforecomplete",function(_e1,_e2,_e3){
+var _e4=_e1.editNode.parentNode;
+var _e5=_e4.childNodes;
+for(x=0;x<_e5.length;x++){
+if(_e5[x].text==_e2&&_e5[x].id!=_e1.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(_d1,_d2,_d3){
-var _d4=function(_d5,_d6,_d7){
-var _d8=acs_lang_text.an_error_occurred||"An error occurred";
-var _d9=acs_lang_text.reverted||"Your changes have been reverted";
-if(_d6){
-if(_d7.responseText!=1){
-Ext.Msg.alert(acs_lang_text.error||"Error",_d8+": "+_d7.responseText+" "+_d9);
-_d1.editNode.setText(_d3);
+this.te.on("complete",function(_e6,_e7,_e8){
+var _e9=function(_ea,_eb,_ec){
+var _ed=acs_lang_text.an_error_occurred||"An error occurred";
+var _ee=acs_lang_text.reverted||"Your changes have been reverted";
+if(_eb){
+if(_ec.responseText!=1){
+Ext.Msg.alert(acs_lang_text.error||"Error",_ed+": "+_ec.responseText+" "+_ee);
+_e6.editNode.setText(_e8);
}
}else{
-Ext.Msg.alert(acs_lang_text.error||"Error",_d8+":"+_d7.responseText+" "+_d9);
-_d1.editNode.setText(_d3);
+Ext.Msg.alert(acs_lang_text.error||"Error",_ed+":"+_ec.responseText+" "+_ee);
+_e6.editNode.setText(_e8);
}
};
-this.asyncCon.request({url:this.xmlhttpurl+"editname",params:"newname="+_d2+"&object_id="+_d1.editNode.id+"&type=folder",method:"POST",callback:_d4,scope:this});
+this.asyncCon.request({url:this.xmlhttpurl+"editname",params:"newname="+_e7+"&object_id="+_e6.editNode.id+"&type=folder",method:"POST",callback:_e9,scope:this});
},this,true);
this.treepanel.on("click",this.loadFoldercontents,this,true);
this.treepanel.on("nodedragover",function(e){
@@ -869,86 +952,101 @@
}
}
},this,true);
-this.treepanel.on("beforenodedrop",function(_dc){
-var t=_dc.target;
-if(_dc.data.node){
-var n=_dc.dropNode;
+this.treepanel.on("beforenodedrop",function(_f1){
+var t=_f1.target;
+if(_f1.data.node){
+var n=_f1.dropNode;
var p=n.parentNode;
-var _e0=_dc.data.node.id;
-var _e1=_dc.target.id;
-var _e2=function(_e3,_e4,_e5){
-var _e6=false;
-var _e7=acs_lang_text.an_error_occurred||"An error occurred";
-var _e8=acs_lang_text.reverted||"Your changes have been reverted";
-if(_e4){
-if(_e5.responseText!=1){
-Ext.Msg.alert(acs_lang_text.error||"Error",_e7+": "+_e5.responseText+" "+_e8);
-_e6=true;
+var _f5=_f1.data.node.id;
+var _f6=_f1.target.id;
+var _f7=function(_f8,_f9,_fa){
+var _fb=false;
+var _fc=acs_lang_text.an_error_occurred||"An error occurred";
+var _fd=acs_lang_text.reverted||"Your changes have been reverted";
+if(_f9){
+if(_fa.responseText!=1){
+Ext.Msg.alert(acs_lang_text.error||"Error",_fc+": "+_fa.responseText+" "+_fd);
+_fb=true;
}
}else{
Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.error_and_reverted||"An error occurred. Your changes have been reverted");
-_e6=true;
+_fb=true;
}
-if(_e6){
-_e3.target.removeChild(_e3.thenode);
-_e3.parent.appendChild(_e3.thenode);
-_e3.parent.loaded=false;
-_e3.parent.expand();
+if(_fb){
+_f8.target.removeChild(_f8.thenode);
+_f8.parent.appendChild(_f8.thenode);
+_f8.parent.loaded=false;
+_f8.parent.expand();
}else{
-_e3.target.loaded=false;
-_e3.target.fireEvent("click",_e3.target);
-_e3.target.expand();
+_f8.target.loaded=false;
+_f8.target.fireEvent("click",_f8.target);
+_f8.target.expand();
}
};
-var _e9="file_ids="+_e0+"&folder_target_id="+_e1;
+var _fe="file_ids="+_f5+"&folder_target_id="+_f6;
var url=this.xmlhttpurl+"move";
-this.asyncCon.request({url:url,params:_e9,method:"POST",callback:_e2,scope:this,target:t,parent:p,thenode:n});
+this.asyncCon.request({url:url,params:_fe,method:"POST",callback:_f7,scope:this,target:t,parent:p,thenode:n});
}else{
-var _eb=_dc.target.id;
-var _ec=[];
-for(var x=0;x<_dc.data.selections.length;x++){
-_ec[x]=_dc.data.selections[x].data.id;
-if(_dc.data.selections[x].data.type=="folder"){
-if(this.treepanel.getNodeById(_dc.data.selections[x].data.id)){
-var _ee=this.treepanel.getNodeById(_dc.data.selections[x].data.id).parentNode;
-_ee.loaded=false;
-_ee.removeChild(this.treepanel.getNodeById(_dc.data.selections[x].data.id));
+var _100=_f1.target.id;
+var _101=[];
+for(var x=0;x<_f1.data.selections.length;x++){
+_101[x]=_f1.data.selections[x].data.id;
+if(_f1.data.selections[x].data.type=="folder"){
+if(this.treepanel.getNodeById(_f1.data.selections[x].data.id)){
+var _103=this.treepanel.getNodeById(_f1.data.selections[x].data.id).parentNode;
+_103.loaded=false;
+_103.removeChild(this.treepanel.getNodeById(_f1.data.selections[x].data.id));
}
}
}
-var _e2=function(_ef,_f0,_f1){
-if(_f0&&_f1.responseText==1){
+var _f7=function(_104,_105,_106){
+if(_105&&_106.responseText==1){
var dm=this.filegrid.getDataSource();
-var _f3=this.filegrid.getSelectionModel().getSelections();
-for(var x=0;x<_f3.length;x++){
-dm.remove(_f3[x]);
+var _108=this.filegrid.getSelectionModel().getSelections();
+for(var x=0;x<_108.length;x++){
+dm.remove(_108[x]);
}
-_ef.target.loaded=false;
+_104.target.loaded=false;
}else{
Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.error_move||"Sorry, an error occurred moving this item. A file with the same name may already exist in the target folder.");
}
};
-var _e9="folder_target_id="+_eb+"&file_ids="+_ec;
+var _fe="folder_target_id="+_100+"&file_ids="+_101;
var url=this.xmlhttpurl+"move";
-var _f5=new Ext.data.Connection();
-_f5.request({url:url,params:_e9,method:"POST",callback:_e2,scope:this,target:t});
+var _10a=new Ext.data.Connection();
+_10a.request({url:url,params:_fe,method:"POST",callback:_f7,scope:this,target:t});
}
},this,true);
this.renderTree();
};
this.initLayout=function(){
-var _f6=document.body;
+var _10b=document.body;
if(this.config!=null&&this.config.layoutdiv){
-_f6=this.config.layoutdiv;
+_10b=this.config.layoutdiv;
}
-this.layout=new Ext.BorderLayout(_f6,{north:{split:false,titlebar:false,autoScroll:false,initialSize:25},west:{autoScroll:true,split:true,initialSize:350,titlebar:true,collapsible:true,minSize:200,maxSize:500},center:{autoScroll:true}});
+this.layout=new Ext.BorderLayout(_10b,{north:{split:false,titlebar:false,autoScroll:false,initialSize:25},west:{autoScroll:true,split:true,initialSize:350,titlebar:true,collapsible:true,minSize:200,maxSize:500},center:{autoScroll:true}});
+this.innerlayout=new Ext.BorderLayout("leftpanel",{center:{split:true,titlebar:false,autoScroll:true},south:{split:true,titlebar:true,title:"Tags",autoScroll:true,initialSize:130}});
this.layout.beginUpdate();
this.layout.add("north",new Ext.ContentPanel("headerpanel",{autoCreate:true}));
-this.layout.add("west",new Ext.ContentPanel("folderpanel",{autoCreate:true,autoScroll:true,fitToFrame:true,fitContainer:true}));
+this.layout.add("west",new Ext.NestedLayoutPanel(this.innerlayout));
+this.innerlayout.add("center",new Ext.ContentPanel("folderpanel",{autoCreate:true,autoScroll:true,fitToFrame:true,fitContainer:true}));
+this.tagcloudpanel=new Ext.ContentPanel("tagpanel",{autoCreate:true,autoScroll:true,fitToFrame:true,fitContainer:true});
+this.innerlayout.add("south",this.tagcloudpanel);
+this.tagcloudpanel.load("/ajaxfs2/xmlhttp/tagcloud?package_id="+this.config.package_id);
+this.tagcloudpanel.getEl().on("click",function(obj,el){
+if(el.tagName=="A"){
+if(this.currenttag!=null){
+Ext.get(this.currenttag).setStyle("font-weight","normal");
+}
+Ext.get(el).setStyle("font-weight","bold");
+this.currenttag=el.id;
+this.loadTagObjects(el.id);
+}
+},this);
this.layout.endUpdate();
-var _f7={autoCreate:true,autoScroll:true,modal:false,autoTabs:true,width:300,height:300,shadow:false,shim:false,minWidth:300,minHeight:300,proxyDrag:true,fixedcenter:true};
-this.upldDialog=new Ext.BasicDialog("uploadDlg",_f7);
-this.createurlDialog=new Ext.BasicDialog("urlDlg",_f7);
+var _10e={autoCreate:true,autoScroll:true,modal:false,autoTabs:true,width:300,height:300,shadow:false,shim:false,minWidth:300,minHeight:300,proxyDrag:true,fixedcenter:true};
+this.upldDialog=new Ext.BasicDialog("uploadDlg",_10e);
+this.createurlDialog=new Ext.BasicDialog("urlDlg",_10e);
Ext.get(document.body).createChild({tag:"div",id:"files"});
};
this.initObj=function(){
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.4 -r1.5
--- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 22 Sep 2007 03:32:38 -0000 1.4
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 14 Nov 2007 04:19:54 -0000 1.5
@@ -247,7 +247,7 @@
var folderid = ajaxfsobj.currentfolder;
var foldername = ajaxfsobj.treepanel.getNodeById(folderid).text;
var progress = new FileProgress(fileObj, this.getSetting("progress_target"));
- progress.SetStatus( upload_txt + ""+foldername+" "+ zip_txt);
+ progress.SetStatus( upload_txt + ""+foldername+" Title: (optional) "+ zip_txt);
progress.ToggleCancel(true, this);
this.addFileParam(fileObj.id, "folder_id", folderid);
ajaxfsobj.upldDialog.buttons[0].enable();
@@ -383,6 +383,9 @@
// holds a reference to the tree panel
this.treepanel = null;
+ // hold reference to tagcloud panel
+ this.tagcloudpanel = null;
+
// holds a reference to the tree editor
this.te = null;
@@ -398,6 +401,9 @@
// holds the id of the currently selected node in the tree
this.currentfolder = null;
+ // currently selected tag
+ this.currenttag = null;
+
// reusable aync data connection
this.asyncCon = new Ext.data.Connection();
@@ -520,14 +526,23 @@
if (response.responseText != 1) {
Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt + ": "+response.responseText+" "+err_msg_txt2);
} else {
- if(nodetype!="folder"&&nodesubtitle===" ") { nodesubtitle = node.get("title") }
+ if(nodetype!="folder"&&nodesubtitle===" ") {
+ nodesubtitle = node.get("title");
+ node.set("filename",nodesubtitle);
+ }
if(nodetype=="folder") { this.treepanel.getNodeById(nodeid).setText(text) }
+ nodetags = node.get("tags");
+ if(nodetags != "") {
+ var taghtml = "";
+ } else {
+ var taghtml = "
";;
+ }
node.set("title",text);
- node.set("title_and_name",""+text+" "+nodesubtitle+" ")
+ node.set("title_and_name",""+text+" "+nodesubtitle+" "+taghtml)
node.commit();
}
} else {
- Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_text+":"+response.responseText+" "+err_msg_txt2);
+ Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt+":"+response.responseText+" "+err_msg_txt2);
}
}
@@ -574,58 +589,149 @@
newwindow.focus();
}
+ // redirect to object views for a file
+ this.viewsRedirect = function() {
+ var node = this.filegrid.getSelectionModel().getSelected();
+ var object_id = node.get("id");
+ window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+object_id+"/info");
+ window.focus();
+ }
+
+
+ // prompt to enter a tag for the selected fs element
+ this.promptTag = function() {
+
+ var ajaxfsobj = this;
+ var node = ajaxfsobj.filegrid.getSelectionModel().getSelected();
+ var object_id = node.get("id");
+
+
+ Ext.Msg.prompt('Tag', 'Enter or edit one or more tags. Seperate tags with commas (,):', function(btn, text) {
+ if (btn == 'ok') {
+ // process text value ...
+ var callback = function(option,success,response) {
+ if(success) {
+ node.set('tags',text);
+ Ext.get("tagscontainer_"+object_id).update("Tag:"+text+" ");
+ this.tagcloudpanel.load("/ajaxfs2/xmlhttp/tagcloud?package_id="+this.config.package_id);
+ }
+ }
+ ajaxfsobj.asyncCon.request({url:ajaxfsobj.xmlhttpurl+"addtag",
+ params: "object_id="+object_id+"&tags="+text+"&package_id="+ajaxfsobj.config.package_id,
+ method:"POST",
+ callback: callback,
+ scope: ajaxfsobj
+ });
+ }
+ });
+
+ if (document.getElementById("tagslist_"+object_id)) {
+ var prompt_text_el = YAHOO.util.Dom.getElementsByClassName('ext-mb-input', 'input','x-msg-box');
+ prompt_text_el[0].value=document.getElementById("tagslist_"+object_id).innerHTML;
+ prompt_text_el[0].select();
+ }
+
+ }
+
+ // download archive function
+ this.downloadArchive = function() {
+ var node = this.filegrid.getSelectionModel().getSelected();
+ var object_id = node.get("id");
+ top.location.href="download-archive/?object_id="+object_id;
+ }
+
// generate a context bar
this.showContext = function(grid,i,e) {
e.stopEvent();
- if(this.contextmenu == null) {
- // create the menus
- this.contextmenu = new Ext.menu.Menu({
- id: 'rightclickmenu',
- items: [
- new Ext.menu.Item({
- text: acs_lang_text.deletefs || 'Delete',
- icon: '/resources/ajax-filestorage-ui/icons/delete.png',
- handler: this.confirmDel.createDelegate(this)
- }),
- new Ext.menu.Item({
- text: acs_lang_text.rename || 'Rename',
- icon: '/resources/ajax-filestorage-ui/icons/page_edit.png',
- handler: this.fileRename.createDelegate(this)
- }),
- new Ext.menu.Item({
- text: acs_lang_text.linkaddress || 'Copy Link Address',
- icon: '/resources/ajax-filestorage-ui/icons/page_copy.png',
- handler: this.linkCopy.createDelegate(this)
- }),
- new Ext.menu.Item({
- text: acs_lang_text.permissions || 'Permissions',
- icon: '/resources/ajax-filestorage-ui/icons/group_key.png',
- handler: this.permsRedirect.createDelegate(this)
- }),
- new Ext.menu.Item({
- text: acs_lang_text.properties || 'Properties',
- icon: '/resources/ajax-filestorage-ui/icons/page_edit.png',
- handler: this.propertiesRedirect.createDelegate(this)
- }) ]
- });
+ var dm = grid.getDataSource();
+ var record = dm.getAt(i);
+ var object_type = record.get("type");
+ var recordid = record.get("id");
+
+ if( object_type == "folder") {
+ var openitem_txt = "Open";
+ } else {
+ var openitem_txt = "Download";
}
- // disable rename, copy link, permissions and revisions if more than one node item from the view is selected
+
+ // create the menus
+ this.contextmenu = new Ext.menu.Menu({
+ id: 'rightclickmenu',
+ items: [
+ new Ext.menu.Item({
+ text: openitem_txt,
+ icon: "/resources/ajax-filestorage-ui/icons/page_white.png",
+ handler: this.itemDblClick.createDelegate(this,[grid, i, e],false)
+ }),
+ new Ext.menu.Item({
+ text: 'Tag',
+ icon: '/resources/ajax-filestorage-ui/icons/tag_blue.png',
+ handler: this.promptTag.createDelegate(this)
+ }),
+ new Ext.menu.Item({
+ text: 'Views',
+ icon: '/resources/ajax-filestorage-ui/icons/camera.png',
+ handler: this.viewsRedirect.createDelegate(this)
+ }),
+ new Ext.menu.Item({
+ text: acs_lang_text.deletefs || 'Delete',
+ icon: '/resources/ajax-filestorage-ui/icons/delete.png',
+ handler: this.confirmDel.createDelegate(this)
+ }),
+ new Ext.menu.Item({
+ text: acs_lang_text.rename || 'Rename',
+ icon: '/resources/ajax-filestorage-ui/icons/page_edit.png',
+ handler: this.fileRename.createDelegate(this)
+ }),
+ new Ext.menu.Item({
+ text: acs_lang_text.linkaddress || 'Copy Link Address',
+ icon: '/resources/ajax-filestorage-ui/icons/page_copy.png',
+ handler: this.linkCopy.createDelegate(this)
+ }),
+ new Ext.menu.Item({
+ text: acs_lang_text.permissions || 'Permissions',
+ icon: '/resources/ajax-filestorage-ui/icons/group_key.png',
+ handler: this.permsRedirect.createDelegate(this)
+ }),
+ new Ext.menu.Item({
+ text: acs_lang_text.properties || 'Properties',
+ icon: '/resources/ajax-filestorage-ui/icons/page_edit.png',
+ handler: this.propertiesRedirect.createDelegate(this)
+ }),
+ new Ext.menu.Item({
+ text: acs_lang_text.download_archive || 'Download archive',
+ icon: '/resources/ajax-filestorage-ui/icons/arrow_down.png',
+ handler: this.downloadArchive.createDelegate(this)
+ }) ]
+ });
+
+ // disable open/download, rename, copy link, permissions and revisions if more than one node item from the view is selected
if (grid.getSelectionModel().getCount() > 1) {
- this.contextmenu.items.items[1].disable();
- this.contextmenu.items.items[2].disable();
- this.contextmenu.items.items[3].disable();
- this.contextmenu.items.items[4].disable();
+ this.contextmenu.items.items[0].hide();
+ this.contextmenu.items.items[1].hide();
+ this.contextmenu.items.items[2].hide();
+ this.contextmenu.items.items[3].show();
+ this.contextmenu.items.items[4].hide();
+ this.contextmenu.items.items[5].hide();
+ this.contextmenu.items.items[6].hide();
+ this.contextmenu.items.items[7].hide();
+ this.contextmenu.items.items[8].hide();
} else {
- this.contextmenu.items.items[1].enable();
- this.contextmenu.items.items[2].enable();
- this.contextmenu.items.items[3].enable();
- var node = this.filegrid.getSelectionModel().getSelected();
- var object_type = node.get("type");
- if (object_type == "folder" || object_type == "url") {
- this.contextmenu.items.items[4].disable();
+ 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 (object_type == "folder") {
+ this.contextmenu.items.items[1].hide();
+ this.contextmenu.items.items[7].hide();
+ this.contextmenu.items.items[8].show();
} else {
- this.contextmenu.items.items[4].enable();
+ this.contextmenu.items.items[1].show();
+ this.contextmenu.items.items[7].show();
+ this.contextmenu.items.items[8].hide();
}
}
@@ -953,135 +1059,159 @@
}
}
- // loads the content of the given folder
- this.loadFoldercontents = function(node,e) {
- // remove the gray class from last selected tree
- if (this.currentfolder != null) {
- this.treepanel.getNodeById(this.currentfolder).getUI().removeClass("x-tree-grayselected");
- }
+ // creates the file grid, if it's not yet created
+ this.createFileGrid = function() {
+ var cols = [{header: "", width: 50,sortable: true, dataIndex: 'icon'},
+ {header: acs_lang_text.filename || "Filename", id:'filename', width: 200, sortable: true, dataIndex: 'title_and_name'},
+ {header: acs_lang_text.size || "Size", sortable: true, dataIndex: 'size'},
+ {header: acs_lang_text.lastmodified || "Last Modified", sortable: true, dataIndex: 'lastmodified'}];
- // currently selected folder
- this.currentfolder = node.id;
+ var colModel = new Ext.grid.ColumnModel(cols);
+ colModel.defaultSortable=true;
- // fetch the folder contents
- if(this.filegrid == null) {
+ var reader = 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:'title_and_name'},
+ {name:'size'},
+ {name:'lastmodified'}] );
- var cols = [{header: "", width: 50,sortable: true, dataIndex: 'icon'},
- {header: acs_lang_text.filename || "Filename", id:'filename', width: 200, sortable: true, dataIndex: 'title_and_name'},
- {header: acs_lang_text.size || "Size", sortable: true, dataIndex: 'size'},
- {header: acs_lang_text.lastmodified || "Last Modified", sortable: true, dataIndex: 'lastmodified'}];
- var colModel = new Ext.grid.ColumnModel(cols);
- colModel.defaultSortable=true;
+ var proxy = new Ext.data.HttpProxy( {
+ url : this.xmlhttpurl+ 'foldercontents'
+ } );
- var reader = new Ext.data.JsonReader({totalProperty: 'total', root: 'foldercontents', id: 'id'}, [
- {name:'id', type: 'int'},
- {name:'icon'},
- {name:'title'},
- {name:'filename'},
- {name:'type'},
- {name:'url'},
- {name:'write_p'},
- {name:'title_and_name'},
- {name:'size'},
- {name:'lastmodified'}] );
+ var dataModel = new Ext.data.Store({proxy: proxy, reader: reader, remoteSort: true});
+ this.filegrid = new Ext.grid.Grid('files',{
+ ds: dataModel,
+ cm: colModel,
+ autoHeight: false,
+ autoWidth: true,
+ autoSizeColumns: false,
+ trackMouseOver: true,
+ autoExpandColumn: 'filename',
+ enableColumnMove: false,
+ enableColLock: false,
+ enableColumnHide: false,
+ loadMask: true,
+ monitorWindowResize: true,
+ enableDragDrop: true,
+ ddGroup:'fileDD'
+ });
- var proxy = new Ext.data.HttpProxy( {
- url : this.xmlhttpurl+ 'foldercontents'
- } );
-
- var dataModel = new Ext.data.Store({proxy: proxy, reader: reader, remoteSort: true});
+ // grid listeners
- this.filegrid = new Ext.grid.Grid('files',{
- ds: dataModel,
- cm: colModel,
- autoHeight: false,
- autoWidth: true,
- autoSizeColumns: false,
- trackMouseOver: true,
- autoExpandColumn: 'filename',
- enableColumnMove: false,
- enableColLock: false,
- enableColumnHide: false,
- loadMask: true,
- monitorWindowResize: true,
- enableDragDrop: true,
- ddGroup:'fileDD'
- });
+ // Row Click
+ // when a grid row is clicked, change the highlight on the currently selected folder
+ // this is similar to windows explorer behavior
+ this.filegrid.on("rowclick",function() {
+ this.treepanel.getSelectionModel().getSelectedNode().getUI().removeClass("x-tree-selected");
+ this.treepanel.getSelectionModel().getSelectedNode().getUI().addClass("x-tree-grayselected");
+ }, this,true);
- // grid listeners
+ // Row Double Click
+ this.filegrid.on("rowdblclick",this.itemDblClick,this,true);
- // Row Click
- // when a grid row is clicked, change the highlight on the currently selected folder
- // this is similar to windows explorer behavior
- this.filegrid.on("rowclick",function() {
- this.treepanel.getSelectionModel().getSelectedNode().getUI().removeClass("x-tree-selected");
- this.treepanel.getSelectionModel().getSelectedNode().getUI().addClass("x-tree-grayselected");
- }, this,true);
+ // Row Right Click
+ this.filegrid.on("rowcontextmenu",this.showContext,this,true);
- // Row Double Click
- this.filegrid.on("rowdblclick",this.itemDblClick,this,true);
-
- // Row Right Click
- this.filegrid.on("rowcontextmenu",this.showContext,this,true);
-
- // Sort Rows via Drag & Drop
- var thegrid = this.filegrid;
- var ajaxfsobj = this;
- var ddrow = new Ext.dd.DropTarget(thegrid.container, {
- ddGroup : 'fileDD',
- copy:false,
- notifyDrop : function(dd, e, data){
- var ds=thegrid.getDataSource();
- var sm=thegrid.getSelectionModel();
- var rows=sm.getSelections();
- if(dd.getDragData(e)) {
- var cindex=dd.getDragData(e).rowIndex;
- if(typeof(cindex) != "undefined") {
- if (!this.copy){
- for(i = 0; i < rows.length; i++) {
- ds.remove(ds.getById(rows[i].id));
- }
+ // Sort Rows via Drag & Drop
+ var thegrid = this.filegrid;
+ var ajaxfsobj = this;
+ var ddrow = new Ext.dd.DropTarget(thegrid.container, {
+ ddGroup : 'fileDD',
+ copy:false,
+ notifyDrop : function(dd, e, data){
+ var ds=thegrid.getDataSource();
+ var sm=thegrid.getSelectionModel();
+ var rows=sm.getSelections();
+ if(dd.getDragData(e)) {
+ var cindex=dd.getDragData(e).rowIndex;
+ if(typeof(cindex) != "undefined") {
+ if (!this.copy){
+ for(i = 0; i < rows.length; i++) {
+ ds.remove(ds.getById(rows[i].id));
}
- ds.insert(cindex,data.selections);
- sm.clearSelections();
}
-
- // ** CSM SPECIFIC **
- // send an xmlhttp request to update the order_n of fs_objects
- /*
- var params = "";
- var dm = thegrid.getDataSource();
- for(var i = 0;i} $tag "" tag
+ set tag [string tolower [string trim $tag]]
+
+ if { [catch {set creation_ip [ad_conn peeraddr] } ] } {
+ set creation_ip "0.0.0.0"
+ }
+
+ set category_id [category::add -tree_id $tree_id -name $tag -parent_id "" -user_id $user_id -creation_ip "0.0.0.0"]
+ category::map_object -object_id $object_id $category_id
+
+ } else {
+
+ # map object_id to category
+ category::map_object -object_id $object_id $category_id
+
+ }
+ }
+}
+
+# TODO : detect if we're using search, then reindex the item
+# reindex for search
+# search::queue -object_id $object_id -event "UPDATE"
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/foldercontents.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/Attic/foldercontents.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/foldercontents.adp 8 Sep 2007 14:32:56 -0000 1.1
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/foldercontents.adp 14 Nov 2007 04:19:54 -0000 1.2
@@ -1,5 +1,5 @@
{ "total": @counter@, "foldercontents":[
-{"id":"@contents.object_id@","icon":"@contents.icon;noquote@","type":"@contents.type;noquote@",title_and_name:"@contents.title;noquote@ @contents.filename;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_and_name:"@contents.title;noquote@ @contents.filename;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@}
]}
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/foldercontents.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/Attic/foldercontents.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/foldercontents.tcl 8 Sep 2007 14:32:56 -0000 1.1
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/foldercontents.tcl 14 Nov 2007 04:19:54 -0000 1.2
@@ -7,7 +7,8 @@
@creation-date 2007-06-03
} {
- folder_id:integer,notnull
+ folder_id:integer,optional
+ tag_id:integer,optional
{sort "fs_objects.title"}
{dir "DESC"}
}
@@ -40,14 +41,53 @@
# sorting **********
set orderby ""
if { [exists_and_not_null sort] } {
- if {$sort == "title_and_name"} { set sort "fs_objects.title" }
+ if {$sort == "title_and_name"} { set sort "lower(fs_objects.title)" }
if {$sort == "size"} { set sort "fs_objects.content_size" }
if {$sort == "lastmodified"} { set sort "fs_objects.last_modified" }
set orderby "order by $sort $dir"
}
-db_multirow -extend { filename icon last_modified_pretty content_size_pretty download_url object_counter file_list_start file_list_end write_p} contents dbqd.file-storage.www.folder-chunk.select_folder_contents { } {
+if { [exists_and_not_null tag_id] } {
+ set query_name "select_folder_contents"
+ set query "select fs_objects.object_id,
+ fs_objects.mime_type,
+ fs_objects.name,
+ fs_objects.live_revision,
+ fs_objects.type,
+ fs_objects.pretty_type,
+ to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi,
+ fs_objects.content_size,
+ fs_objects.url,
+ fs_objects.sort_key,
+ fs_objects.sort_key as sort_key_desc,
+ fs_objects.file_upload_name,
+ fs_objects.title,
+ case
+ when '$folder_path' is null
+ then fs_objects.file_upload_name
+ else '$folder_path' || '/' || fs_objects.file_upload_name
+ end as file_url,
+ case
+ when fs_objects.last_modified >= (now() - cast('$n_past_days days' as interval))
+ then 1
+ else 0
+ end as new_p
+ from fs_objects
+ where fs_objects.object_id in (select object_id from category_object_map where category_id=$tag_id)
+ and exists (select 1
+ from acs_object_party_privilege_map m
+ where m.object_id = fs_objects.object_id
+ and m.party_id = $viewing_user_id
+ and m.privilege = 'read')
+ $orderby"
+} else {
+ set query_name dbqd.file-storage.www.folder-chunk.select_folder_contents
+ set query ""
+}
+
+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 {
+
if { ![exists_and_not_null title] } { set title $name }
# content size
@@ -106,6 +146,14 @@
set filename " "
}
+ # get the tags for this fs item
+ set tag_list [db_list "get_categories" "select name from category_translations where locale='en_US' and category_id in (select category_id from category_object_map where object_id=:object_id)"]
+ if { [llength $tag_list] >0 } {
+ set tags [join $tag_list ","]
+ } else {
+ set tags ""
+ }
+
if { [permission::permission_p -party_id $viewing_user_id -object_id $object_id -privilege "write"] == "t" } { set write_p "true" } else { set write_p "false" }
incr counter
Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/tagcloud.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/Attic/tagcloud.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/tagcloud.adp 14 Nov 2007 04:19:54 -0000 1.1
@@ -0,0 +1,8 @@
+
+
+
+
+
+No tags found.
+
+
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/tagcloud.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/Attic/tagcloud.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/tagcloud.tcl 14 Nov 2007 04:19:54 -0000 1.1
@@ -0,0 +1,53 @@
+ad_page_contract {
+
+ Generate a tagcloud
+
+ @author Hamilton Chua (ham@solutiongrove.com)
+ @creation-date 2007-07-15
+
+} {
+ package_id:integer
+}
+
+# create a tagcloud from a given category_tree
+set locale "en_US"
+
+# use the same tree_id as the bookmarks
+# set tree_id [connections::category_tree_id]
+set tree_id [parameter::get -parameter "CategoryTreeId"]
+
+set node_id [site_node::get_node_id_from_object_id -object_id $package_id]
+
+# determine if we are in an extranet or a dotfolio
+set ancestor_subsite_id [site_node::closest_ancestor_package \
+ -node_id $node_id \
+ -package_key acs-subsite \
+ -include_self]
+
+if { ![exists_and_not_null user_id] } {
+ 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)"
+
+db_multirow -extend { url } connections connections [subst {
+select c.category_id, t.name, count(*) as count, o.creation_user
+from categories c, category_translations t, category_object_map m, acs_objects o
+where c.category_id = t.category_id
+and c.tree_id = :tree_id
+and t.locale = :locale
+and c.category_id = m.category_id
+and c.category_id = o.object_id
+group by t.name, o.creation_date, o.creation_user, c.category_id
+order by t.name}] {
+ set url "javascript:void(0)"
+}