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.11 -r1.12
--- openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl 18 Mar 2009 23:53:04 -0000 1.11
+++ openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl 11 May 2009 03:22:28 -0000 1.12
@@ -82,13 +82,12 @@
regsub -all {"} $instance_name {\"} instance_name
regsub -all {"} $roottext {\"} roottext
- set write_p [permission::permission_p -no_cache \
- -party_id [ad_conn user_id] \
- -object_id ${rootfolder_id} \
- -privilege "write"]
- if { $write_p } { set rootwrite_p "t" } else { set rootwrite_p "f" }
+ if {[permission::permission_p -no_cache -party_id [ad_conn user_id] -object_id ${rootfolder_id} -privilege "write"]} { set rootwrite_p "t" } else { set rootwrite_p "f" }
+# if {[permission::permission_p -no_cache -party_id [ad_conn user_id] -object_id ${rootfolder_id} -privilege "delete"]} { set rootdelete_p "t" } else { set rootdelete_p "f" }
+set rootdelete_p "f"; # Community root folder doesn't been delete
+ if {[permission::permission_p -no_cache -party_id [ad_conn user_id] -object_id ${rootfolder_id} -privilege "admin"]} { set rootadmin_p "t" } else { set rootadmin_p "f" }
- lappend options "treerootnode:{text:\"$roottext\", id:\"$rootfolder_id\",\"attributes\":{\"write_p\":\"$rootwrite_p\"}}"
+ lappend options "treerootnode:{text:\"$roottext\", id:\"$rootfolder_id\",\"attributes\":{\"write_p\":\"$rootwrite_p\",\"delete_p\":\"$rootdelete_p\",\"admin_p\":\"$rootadmin_p\"}}"
lappend options "package_id:$package_id"
lappend options "package_url:\"[apm_package_url_from_id $package_id]\""
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.25 -r1.26
--- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 27 Apr 2009 01:46:37 -0000 1.25
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js 11 May 2009 03:22:28 -0000 1.26
@@ -575,22 +575,34 @@
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();
}
+ //btnToolsMenu elements
+ Ext.getCmp('mnRename').show();
} else {
Ext.getCmp('btnNewFolder').hide();
Ext.getCmp('btnUploadFile').hide();
+ Ext.getCmp('btnCreateUrl').hide();
+ //btnToolsMenu elements
+ Ext.getCmp('mnRename').hide();
+ }
+
+ if(node.attributes.attributes["delete_p"] == 't') {
+ Ext.getCmp('btnDelete').show();
+ } else {
Ext.getCmp('btnDelete').hide();
- Ext.getCmp('btnToolsMenu').hide();
- if(this.create_url_p) {
- Ext.getCmp('btnCreateUrl').hide();
- }
}
- },
+ if(node.attributes.attributes["admin_p"] == 't') {
+ Ext.getCmp('mnPerms').show();
+ Ext.getCmp('mnProp').show();
+ } else {
+ Ext.getCmp('mnPerms').hide();
+ Ext.getCmp('mnProp').hide();
+ }
+ },
+
// creates the left panel as an accordion, top panel has the folders, bottom panel has the tags
createLeft : function() {
@@ -832,6 +844,7 @@
this.loadTaggedFiles(el.id);
}
},this);
+ alert(el.tagName);
}
@@ -885,6 +898,8 @@
var proxy = this.fsCore.createFilePanelProxy();
var colModel = new Ext.grid.ColumnModel(cols);
+ {name:'delete_p'},
+ {name:'admin_p'},
var dataModel = new Ext.data.Store({proxy: proxy, reader: reader, remoteSort: true});
@@ -966,6 +981,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnOpen',
text: 'Tag',
icon: '/resources/ajaxhelper/icons/tag_blue.png',
scope:this,
@@ -974,6 +990,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnTag',
text: 'Views',
icon: '/resources/ajaxhelper/icons/camera.png',
scope:this,
@@ -982,6 +999,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnView',
text: acs_lang_text.deletefs || 'Delete',
icon: '/resources/ajaxhelper/icons/delete.png',
scope:this,
@@ -990,6 +1008,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnDelete',
text: acs_lang_text.rename || 'Rename',
icon: '/resources/ajaxhelper/icons/page_edit.png',
scope:this,
@@ -998,6 +1017,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnRename',
text: acs_lang_text.linkaddress || 'Copy Link Address',
icon: '/resources/ajaxhelper/icons/page_copy.png',
scope:this,
@@ -1006,6 +1026,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnCopyLink',
text: acs_lang_text.permissions || 'Permissions',
icon: '/resources/ajaxhelper/icons/group_key.png',
scope:this,
@@ -1014,6 +1035,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnPerms',
text: acs_lang_text.properties || 'Properties',
icon: '/resources/ajaxhelper/icons/page_edit.png',
scope:this,
@@ -1022,6 +1044,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnProp',
text: acs_lang_text.download_archive || 'Download archive',
icon: '/resources/ajaxhelper/icons/arrow_down.png',
scope:this,
@@ -1030,6 +1053,7 @@
}
}),
new Ext.menu.Item({
+ id: 'ctxMnArch',
text: acs_lang_text.sharefolder || 'Share Folder',
icon: '/resources/ajaxhelper/icons/group_link.png',
scope:this,
@@ -1038,76 +1062,81 @@
}
}) ]
});
+ id: 'ctxMnShare',
// disable open/download, rename, copy link, permissions and revisions if more than one node item from the view is selected
if (grid.getSelectionModel().getCount() > 1) {
- this.contextmenu.items.items[0].hide();
- this.contextmenu.items.items[1].hide();
- this.contextmenu.items.items[2].hide();
- this.contextmenu.items.items[3].show();
- this.contextmenu.items.items[4].hide();
- this.contextmenu.items.items[5].hide();
- this.contextmenu.items.items[6].hide();
- this.contextmenu.items.items[7].hide();
- this.contextmenu.items.items[8].hide();
- this.contextmenu.items.items[9].hide();
+ Ext.getCmp('ctxMnOpen').hide();
+ Ext.getCmp('ctxMnTag').hide();
+ Ext.getCmp('ctxMnView').hide();
+ Ext.getCmp('ctxMnDelete').hide();
+ Ext.getCmp('ctxMnRename').hide();
+ Ext.getCmp('ctxMnCopyLink').hide();
+ Ext.getCmp('ctxMnPerms').hide();
+ Ext.getCmp('ctxMnProp').hide();
+ Ext.getCmp('ctxMnArch').hide();
+ Ext.getCmp('ctxMnShare').hide();
} else {
- 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();
-
+ Ext.getCmp('ctxMnOpen').show();
+ Ext.getCmp('ctxMnView').show();
+ Ext.getCmp('ctxMnDelete').show();
+ Ext.getCmp('ctxMnRename').show();
+ Ext.getCmp('ctxMnCopyLink').show();
+ Ext.getCmp('ctxMnPerms').show();
switch (object_type) {
case "folder" :
- this.contextmenu.items.items[1].hide();
- this.contextmenu.items.items[7].hide();
- this.contextmenu.items.items[8].show();
+ Ext.getCmp('ctxMnTag').hide();
+ Ext.getCmp('ctxMnProp').hide();
+ Ext.getCmp('ctxMnArch').show();
if (treepanel.getNodeById(recordid).attributes.attributes.type == "symlink") {
- this.contextmenu.items.items[9].hide();
+ Ext.getCmp('ctxMnShare').hide();
} else {
- this.contextmenu.items.items[9].show();
+ Ext.getCmp('ctxMnShare').show();
}
break;
case "url" :
- this.contextmenu.items.items[1].show();
- this.contextmenu.items.items[7].hide();
- this.contextmenu.items.items[8].hide();
- this.contextmenu.items.items[9].hide();
+ Ext.getCmp('ctxMnTag').show();
+ Ext.getCmp('ctxMnProp').hide();
+ Ext.getCmp('ctxMnArch').hide();
+ Ext.getCmp('ctxMnShare').hide();
break;
case "symlink":
- this.contextmenu.items.items[4].hide();
- this.contextmenu.items.items[9].hide();
+ Ext.getCmp('ctxMnRename').hide();
+ Ext.getCmp('ctxMnShare').hide();
break;
default:
- this.contextmenu.items.items[1].show();
- this.contextmenu.items.items[7].show();
- this.contextmenu.items.items[8].hide();
- this.contextmenu.items.items[9].hide();
+ Ext.getCmp('ctxMnTag').show();
+ Ext.getCmp('ctxMnProp').show();
+ Ext.getCmp('ctxMnArch').hide();
+ Ext.getCmp('ctxMnShare').hide();
}
-
-
}
// always disable if shared folders are not supported
if(!this.share_folders_p) {
- this.contextmenu.items.items[9].hide();
+ Ext.getCmp('ctxMnShare').hide();
}
// always disable if views package is not supported
if(!this.views_p) {
- this.contextmenu.items.items[2].hide();
+ Ext.getCmp('ctxMnView').hide();
}
- if(rootnode.attributes["write_p"] == 'f') {
- this.contextmenu.items.items[1].hide();
- this.contextmenu.items.items[3].hide();
- this.contextmenu.items.items[6].hide();
- this.contextmenu.items.items[7].hide();
- this.contextmenu.items.items[9].hide();
+ if(record.get("write_p") != true) {
+ Ext.getCmp('ctxMnTag').hide();
+ Ext.getCmp('ctxMnShare').hide();
+ Ext.getCmp('ctxMnRename').hide();
}
+ if(record.get("delete_p") != true) {
+ Ext.getCmp('ctxMnDelete').hide();
+ }
+
+ if(record.get("admin_p") != true) {
+ Ext.getCmp('ctxMnPerms').hide();
+ Ext.getCmp('ctxMnProp').hide();
+ }
+
var coords = e.getXY();
this.contextmenu.rowid = i;
this.contextmenu.showAt([coords[0], coords[1]]);
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.3 -r1.4
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.adp 2 Jan 2008 07:12:12 -0000 1.3
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.adp 11 May 2009 03:22:28 -0000 1.4
@@ -1,4 +1,4 @@
{ "total": @counter@, "foldercontents":[
-{"id":"@contents.object_id@","qtip":"@contents.qtip;noquote@","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
+{"id":"@contents.object_id@","qtip":"@contents.qtip;noquote@","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@,"delete_p":@contents.delete_p@,"admin_p":@contents.admin_p@,"linkurl":"@contents.linkurl;noquote@","symlink_id":"@contents.symlink_id@"}
+]}
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.8 -r1.9
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl 26 Aug 2008 20:36:42 -0000 1.8
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl 11 May 2009 03:22:28 -0000 1.9
@@ -95,9 +95,8 @@
set 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 delete_p admin_p tags symlink_id qtip} contents $query_name {} {
-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 qtip} contents $query_name $query {
-
# cleanup :
# remove double quotes, replace with single quotes
regsub -all {"} $title {\"} title
@@ -232,8 +231,11 @@
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" }
+ if { [permission::permission_p -party_id $viewing_user_id -object_id $object_id -privilege "write"] } { set write_p "true" } else { set write_p "false" }
+ if { [permission::permission_p -party_id $viewing_user_id -object_id $object_id -privilege "delete"] } { set delete_p "true" } else { set delete_p "false" }
+ if { [permission::permission_p -party_id $viewing_user_id -object_id $object_id -privilege "admin"] } { set admin_p "true" } else { set admin_p "false" }
+
incr counter
}
Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-oracle.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-oracle.xql 11 Mar 2009 09:44:34 -0000 1.2
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-oracle.xql 11 May 2009 03:22:28 -0000 1.3
@@ -17,10 +17,9 @@
fs_objects.parent_id,
fs_objects.content_size,
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
+ (select acs_permission.permission_p(fs_objects.object_id, :viewing_user_id, 'write') from dual) as write_p,
+ (select acs_permission.permission_p(fs_objects.object_id, :viewing_user_id, 'delete') from dual) as delete_p,
+ (select acs_permission.permission_p(fs_objects.object_id, :viewing_user_id, 'admin') from dual) as admin_p
from fs_objects
where fs_objects.type in ('folder','symlink')
and fs_objects.parent_id = :node
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.4 -r1.5
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-postgresql.xql 14 Jan 2008 02:15:40 -0000 1.4
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes-postgresql.xql 11 May 2009 03:22:28 -0000 1.5
@@ -17,11 +17,9 @@
fs_objects.parent_id,
fs_objects.content_size,
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
+ (select acs_permission__permission_p(fs_objects.object_id, :viewing_user_id, 'write') from dual) as write_p,
+ (select acs_permission__permission_p(fs_objects.object_id, :viewing_user_id, 'delete') from dual) as delete_p,
+ (select acs_permission__permission_p(fs_objects.object_id, :viewing_user_id, 'admin') from dual) as admin_p
from fs_objects
where fs_objects.type in ('folder','symlink')
and fs_objects.parent_id = :node
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.5 -r1.6
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.adp 20 Apr 2008 11:58:12 -0000 1.5
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/load-treenodes.adp 11 May 2009 03:22:28 -0000 1.6
@@ -1 +1 @@
-[{"text":"@treenodes.name;noquote@","qtip":"@treenodes.qtip;noquote@","id":"@treenodes.id;noquote@","iconCls":"@treenodes.cls;noquote@","singleClickExpand":true,"leaf":@treenodes.leaf;noquote@,"expanded":@treenodes.expanded;noquote@@treenodes.children;noquote@,"attributes":{"size":"@treenodes.content_size_pretty@","write_p":"@treenodes.write_p@","type":"@treenodes.type;noquote@","symlink_id":"@treenodes.symlink_id@"}}]
\ No newline at end of file
+[{"text":"@treenodes.name;noquote@","qtip":"@treenodes.qtip;noquote@","id":"@treenodes.id;noquote@","iconCls":"@treenodes.cls;noquote@","singleClickExpand":true,"leaf":@treenodes.leaf;noquote@,"expanded":@treenodes.expanded;noquote@@treenodes.children;noquote@,"attributes":{"size":"@treenodes.content_size_pretty@","write_p":"@treenodes.write_p@","delete_p":"@treenodes.delete_p@","admin_p":"@treenodes.admin_p@","type":"@treenodes.type;noquote@","symlink_id":"@treenodes.symlink_id@"}}]