Index: openacs-4/packages/fs-portlet/fs-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/fs-portlet.info,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/fs-portlet/fs-portlet.info 18 May 2002 20:18:39 -0000 1.7 +++ openacs-4/packages/fs-portlet/fs-portlet.info 31 May 2002 06:34:27 -0000 1.8 @@ -21,9 +21,14 @@ + + + + + Index: openacs-4/packages/fs-portlet/sql/oracle/fs-contents-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/sql/oracle/fs-contents-portlet-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/fs-portlet/sql/oracle/fs-contents-portlet-create.sql 31 May 2002 06:34:27 -0000 1.1 @@ -0,0 +1,153 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- the fs contents portlet +-- +-- @author Arjun Sanyal(arjun@openforce.net) +-- @version $Id: fs-contents-portlet-create.sql,v 1.1 2002/05/31 06:34:27 arjun Exp $ +-- + +declare + ds_id portal_datasources.datasource_id%TYPE; + foo integer; +begin + + ds_id := portal_datasource.new( + name => 'fs_contents_portlet', + description => 'Displays one fs folder in a table' + ); + + portal_datasource.set_def_param( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'shadeable_p', + value => 't' + ); + + portal_datasource.set_def_param( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'hideable_p', + value => 't' + ); + + portal_datasource.set_def_param( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'user_editable_p', + value => 'f' + ); + + portal_datasource.set_def_param( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'shaded_p', + value => 'f' + ); + + portal_datasource.set_def_param( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'link_hideable_p', + value => 't' + ); + + portal_datasource.set_def_param( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 'f', + key => 'folder_id', + value => '' + ); + + -- create the implementation + foo := acs_sc_impl.new( + 'portal_datasource', + 'fs_contents_portlet', + 'fs_contents_portlet' + ); + + -- add all the hooks + foo := acs_sc_impl.new_alias( + 'portal_datasource', + 'fs_contents_portlet', + 'GetMyName', + 'fs_contents_portlet::get_my_name', + 'TCL' + ); + + foo := acs_sc_impl.new_alias( + 'portal_datasource', + 'fs_contents_portlet', + 'GetPrettyName', + 'fs_contents_portlet::get_pretty_name', + 'TCL' + ); + + foo := acs_sc_impl.new_alias( + 'portal_datasource', + 'fs_contents_portlet', + 'Link', + 'fs_contents_portlet::link', + 'TCL' + ); + + foo := acs_sc_impl.new_alias( + 'portal_datasource', + 'fs_contents_portlet', + 'AddSelfToPage', + 'fs_contents_portlet::add_self_to_page', + 'TCL' + ); + + foo := acs_sc_impl.new_alias( + 'portal_datasource', + 'fs_contents_portlet', + 'Show', + 'fs_contents_portlet::show', + 'TCL' + ); + + foo := acs_sc_impl.new_alias( + 'portal_datasource', + 'fs_contents_portlet', + 'Edit', + 'fs_contents_portlet::edit', + 'TCL' + ); + + foo := acs_sc_impl.new_alias( + 'portal_datasource', + 'fs_contents_portlet', + 'RemoveSelfFromPage', + 'fs_contents_portlet::remove_self_from_page', + 'TCL' + ); + + -- Add the binding + acs_sc_binding.new( + contract_name => 'portal_datasource', + impl_name => 'fs_contents_portlet' + ); + +end; +/ +show errors Index: openacs-4/packages/fs-portlet/tcl/fs-contents-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/tcl/fs-contents-portlet-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/fs-portlet/tcl/fs-contents-portlet-procs.tcl 31 May 2002 06:34:27 -0000 1.1 @@ -0,0 +1,114 @@ +# +# Copyright (C) 2001, 2002 OpenForce, Inc. +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_library { + + A portlet to show the _contents_ of a fs folder in a list. + Used for the "handouts", "assignments", etc. portlets + + @author Arjun Sanyal (arjun@openforce.net) + @version $Id: fs-contents-portlet-procs.tcl,v 1.1 2002/05/31 06:34:27 arjun Exp $ + +} + +namespace eval fs_contents_portlet { + + ad_proc -private my_package_key { + } { + return "fs-contents-portlet" + } + + ad_proc -private get_my_name { + } { + return fs_contents_portlet + } + + ad_proc -public get_pretty_name { + We want the pretty_name to be passed in from the applet. + } { + error + } + + ad_proc -public link { + } { + return "" + } + + ad_proc -public add_self_to_page { + {-portal_id:required} + {-pretty_name:required} + {-folder_id:required} + {-param_action:required} + {-page_name ""} + {-hide_p ""} + } { + Adds a fs PE to the given page. If there's already and fs pe, + it appends the values to the pe's params. + + @param portal_id The page to add self to + @param folder_id The folder to show + + @return element_id The new element's id + } { + db_transaction { + # Generate the element, don't use add_element_parameters here, + # since it dosen't do the right thing for multiple elements with + # the same datasource on a page. so we just use the more low level + # portal::add_element + set element_id [portal::add_element \ + -portal_id $portal_id \ + -pretty_name $pretty_name \ + -page_name $page_name \ + -portlet_name [get_my_name] + ] + + if {![empty_string_p $hide_p]} { + portal::configure_element -noconn 1 $element_id hide "" + } + } + + return $element_id + } + + ad_proc -public remove_self_from_page { + {-portal_id:required} + {-package_id:required} + {-folder_id:required} + } { + Removes a fs PE from the given page + } { + set extra_params [list package_id $package_id] + + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $folder_id \ + -key folder_id \ + -extra_params $extra_params + } + + ad_proc -public show { + cf + } { + Note: we use the fs_portlet's pk here + } { + portal::show_proc_helper \ + -package_key [fs_portlet::my_package_key] \ + -config_list $cf \ + -template_src fs-contents-portlet + } + +} Index: openacs-4/packages/fs-portlet/www/fs-contents-portlet-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/www/Attic/fs-contents-portlet-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/fs-portlet/www/fs-contents-portlet-oracle.xql 31 May 2002 06:34:27 -0000 1.1 @@ -0,0 +1,29 @@ + + + +oracle8.1.6 + + + + select file_storage.get_package_id(fs_objects.object_id) as package_id, + decode(fs_objects.type, 'url', (select site_node.url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = file_storage.get_package_id(fs_objects.parent_id)), + (select site_node.url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = file_storage.get_package_id(fs_objects.object_id))) as url, + fs_objects.object_id, + fs_objects.name, + fs_objects.live_revision, + fs_objects.type, + fs_objects.content_size + from fs_objects + where fs_objects.parent_id in ([join $list_of_folder_ids ", "]) + and 't' = acs_permission.permission_p(fs_objects.object_id, :user_id, 'read') + order by fs_objects.parent_id, + fs_objects.sort_key, + fs_objects.name + + + + Index: openacs-4/packages/fs-portlet/www/fs-contents-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/www/fs-contents-portlet.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/fs-portlet/www/fs-contents-portlet.adp 31 May 2002 06:34:27 -0000 1.1 @@ -0,0 +1,74 @@ +<% + + # + # Copyright (C) 2001, 2002 OpenForce, Inc. + # + # This file is part of dotLRN. + # + # dotLRN is free software; you can redistribute it and/or modify it under the + # terms of the GNU General Public License as published by the Free Software + # Foundation; either version 2 of the License, or (at your option) any later + # version. + # + # dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY + # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + # details. + # + +%> + + + + Folder is empty + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@folders.name@@folders.type@0 items@folders.content_size@ items@folders.content_size@ item@folders.name@@folders.type@ @folders.name@@folders.type@@folders.content_size@ bytes
+ +
+
+ +   + Index: openacs-4/packages/fs-portlet/www/fs-contents-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/www/fs-contents-portlet.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/fs-portlet/www/fs-contents-portlet.tcl 31 May 2002 06:34:27 -0000 1.1 @@ -0,0 +1,64 @@ +# +# Copyright (C) 2001, 2002 OpenForce, Inc. +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_page_contract { + The display logic for the fs contents portlet. + + These portlets show the contents of the given folder in a table + + re-using a lot of code from fs-portlet + + @author Arjun Sanyal (arjun@openforce.net) + @version $Id: fs-contents-portlet.tcl,v 1.1 2002/05/31 06:34:27 arjun Exp $ + +} -query { +} -properties { + user_id:onevalue + user_root_folder:onevalue + user_root_folder_present_p:onevalue + write_p:onevalue + admin_p:onevalue + delete_p:onevalue + url:onevalue + folders:multirow + n_folders:onevalue +} + +array set config $cf +set user_id [ad_conn user_id] +set list_of_folder_ids $config(folder_id) +set n_folders [llength $list_of_folder_ids] + +if {$n_folders != 1} { + # something went wrong, we can't have more than one folder here + ad_return -error +} + +set folder_id [lindex $list_of_folder_ids 0] +set url [portal::mapping::get_url -object_id $folder_id] +set recurse_p 1 +set contents_url "${url}folder-contents?[export_vars {folder_id recurse_p}]&" +set write_p [permission::permission_p -object_id $folder_id -privilege "write"] +set admin_p [permission::permission_p -object_id $folder_id -privilege "admin"] +set delete_p $admin_p + +if {!$delete_p} { + set delete_p [permission::permission_p -object_id $folder_id -privilege "delete"] +} + +db_multirow folders select_folder_contents {} + +ad_return_template Index: openacs-4/packages/fs-portlet/www/fs-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/www/fs-portlet.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/fs-portlet/www/fs-portlet.tcl 10 May 2002 00:49:13 -0000 1.10 +++ openacs-4/packages/fs-portlet/www/fs-portlet.tcl 31 May 2002 06:34:27 -0000 1.11 @@ -19,6 +19,7 @@ ad_page_contract { The display logic for the fs portlet + @author yon (yon@openforce.net) @author Arjun Sanyal (arjun@openforce.net) @cvs_id $Id$ } -query {