Index: openacs-4/packages/acs-kernel/acs-kernel.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/acs-kernel.info,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-kernel/acs-kernel.info 30 May 2002 18:08:05 -0000 1.12 +++ openacs-4/packages/acs-kernel/acs-kernel.info 21 Jun 2002 21:05:23 -0000 1.13 @@ -57,6 +57,8 @@ + + @@ -77,6 +79,7 @@ + @@ -118,6 +121,8 @@ + + Index: openacs-4/packages/acs-kernel/sql/oracle/acs-kernel-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-kernel-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-kernel/sql/oracle/acs-kernel-create.sql 30 May 2002 18:08:05 -0000 1.6 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-kernel-create.sql 21 Jun 2002 21:05:23 -0000 1.7 @@ -28,6 +28,7 @@ @@ security-create @@ journal-create @@ site-nodes-create +@@ site-node-object-map-create @@ apm-create @@ acs-create Index: openacs-4/packages/acs-kernel/sql/oracle/acs-kernel-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-kernel-drop.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-kernel/sql/oracle/acs-kernel-drop.sql 30 May 2002 18:08:05 -0000 1.3 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-kernel-drop.sql 21 Jun 2002 21:05:23 -0000 1.4 @@ -16,7 +16,8 @@ @@ rel-constraints-drop @@ rel-segments-drop @@ groups-drop -@@ site-nodes-drop.sql +@@ site-node-object-map-drop +@@ site-nodes-drop @@ community-core-drop @@ acs-relationships-drop @@ acs-object-util-remove Index: openacs-4/packages/acs-kernel/sql/oracle/site-node-object-map-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/site-node-object-map-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/oracle/site-node-object-map-create.sql 21 Jun 2002 21:05:23 -0000 1.1 @@ -0,0 +1,65 @@ +-- +-- a mechanism for associating location (url) with a certain chunk of data. +-- +-- @author Ben Adida (ben@openforce) +-- @version $Id: site-node-object-map-create.sql,v 1.1 2002/06/21 21:05:23 yon Exp $ +-- + +create table site_node_object_mappings ( + object_id constraint snom_object_id_fk + references acs_objects (object_id) + on delete cascade + constraint site_node_object_mappings_pk + primary key, + node_id constraint snom_node_id_fk + references site_nodes (node_id) + on delete cascade + constraint snom_node_id_nn + not null +); + +create or replace package site_node_object_map +as + + procedure new ( + object_id in site_node_object_mappings.object_id%TYPE, + node_id in site_node_object_mappings.node_id%TYPE + ); + + procedure del ( + object_id in site_node_object_mappings.object_id%TYPE + ); + +end site_node_object_map; +/ +show errors + +create or replace package body site_node_object_map +as + + procedure new ( + object_id in site_node_object_mappings.object_id%TYPE, + node_id in site_node_object_mappings.node_id%TYPE + ) is + begin + del(new.object_id); + + insert + into site_node_object_mappings + (object_id, node_id) + values + (new.object_id, new.node_id); + end new; + + procedure del ( + object_id in site_node_object_mappings.object_id%TYPE + ) is + begin + delete + from site_node_object_mappings + where object_id = del.object_id; + end del; + +end site_node_object_map; +/ +show errors Index: openacs-4/packages/acs-kernel/sql/oracle/site-node-object-map-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/site-node-object-map-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/oracle/site-node-object-map-drop.sql 21 Jun 2002 21:05:23 -0000 1.1 @@ -0,0 +1,10 @@ +-- +-- a mechanism for associating location (url) with a certain chunk of data. +-- +-- @author Ben Adida (ben@openforce) +-- @version $Id: site-node-object-map-drop.sql,v 1.1 2002/06/21 21:05:23 yon Exp $ +-- + +drop package body site_node_object_map; +drop package site_node_object_map; +drop table site_node_object_mappings; Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-kernel-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-kernel-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-kernel/sql/postgresql/acs-kernel-create.sql 27 Feb 2002 02:48:00 -0000 1.6 +++ openacs-4/packages/acs-kernel/sql/postgresql/acs-kernel-create.sql 21 Jun 2002 21:05:23 -0000 1.7 @@ -29,6 +29,7 @@ \i security-create.sql \i journal-create.sql \i site-nodes-create.sql +\i site-node-object-map-create.sql \i apm-create.sql \i acs-create.sql Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-kernel-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-kernel-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-kernel/sql/postgresql/acs-kernel-drop.sql 30 Jul 2001 03:42:35 -0000 1.2 +++ openacs-4/packages/acs-kernel/sql/postgresql/acs-kernel-drop.sql 21 Jun 2002 21:05:23 -0000 1.3 @@ -16,6 +16,7 @@ \i rel-constraints-drop.sql \i rel-segments-drop.sql \i groups-drop.sql +\i site-node-object-map-drop.sql \i site-nodes-drop.sql \i community-core-drop.sql \i acs-relationships-drop.sql Index: openacs-4/packages/acs-kernel/sql/postgresql/site-node-object-map-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/site-node-object-map-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/site-node-object-map-create.sql 21 Jun 2002 21:05:23 -0000 1.1 @@ -0,0 +1,52 @@ +-- +-- a mechanism for associating location (url) with a certain chunk of data. +-- +-- @author Ben Adida (ben@openforce) +-- @version $Id: site-node-object-map-create.sql,v 1.1 2002/06/21 21:05:23 yon Exp $ +-- + +create table site_node_object_mappings ( + object_id integer + constraint snom_object_id_fk + references acs_objects (object_id) + constraint snom_object_id_nn + not null + constraint site_node_object_mappings_pk + primary key, + node_id integer + constraint snom_node_id_fk + references site_nodes (node_id) + constraint snom_node_id_nn + not null +); + +select define_function_args('site_node_object_map__new', 'object_id,node_id'); + +create function site_node_object_map__new (integer,integer) +returns integer as ' +declare + p_object_id alias for $1; + p_node_id alias for $2; +begin + perform site_node_object_map__del(p_object_id); + + insert + into site_node_object_mappings + (object_id, node_id) + values + (p_object_id, p_node_id); +end; +' language 'plpgsql'; + +select define_function_args('site_node_object_map__del', 'object_id'); + +create function site_node_object_map__del (integer) +returns integer as ' +declare + p_object_id alias for $1; +begin + delete + from site_node_object_mappings + where object_id = p__object_id; +end; +' language 'plpgsql'; Index: openacs-4/packages/acs-kernel/sql/postgresql/site-node-object-map-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/site-node-object-map-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/site-node-object-map-drop.sql 21 Jun 2002 21:05:23 -0000 1.1 @@ -0,0 +1,10 @@ +-- +-- a mechanism for associating location (url) with a certain chunk of data. +-- +-- @author Ben Adida (ben@openforce) +-- @version $Id: site-node-object-map-drop.sql,v 1.1 2002/06/21 21:05:23 yon Exp $ +-- + +drop function site_node_object_map__del (integer); +drop function site_node_object_map__new (integer,integer); +drop table site_node_object_mappings; Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -r1.20 -r1.21 --- openacs-4/packages/acs-tcl/acs-tcl.info 30 May 2002 15:47:25 -0000 1.20 +++ openacs-4/packages/acs-tcl/acs-tcl.info 21 Jun 2002 21:05:23 -0000 1.21 @@ -108,6 +108,10 @@ + + + + Index: openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/site-node-object-map-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs-oracle.xql 21 Jun 2002 21:05:23 -0000 1.1 @@ -0,0 +1,24 @@ + + + + oracle8.1.6 + + + + declare + begin + site_node_object_map.new(object_id => :object_id, node_id => :node_id); + end; + + + + + + declare + begin + site_node_object_map.del(object_id => :object_id); + end; + + + + Index: openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/site-node-object-map-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs-postgresql.xql 21 Jun 2002 21:05:23 -0000 1.1 @@ -0,0 +1,18 @@ + + + + postgresql7.1 + + + + select site_node_object_map__new(:object_id, :node_id) + + + + + + select site_node_object_map__del(:object_id) + + + + Index: openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs.tcl 21 Jun 2002 21:05:23 -0000 1.1 @@ -0,0 +1,44 @@ +# tcl/portal-node-mapping-procs.tcl + +ad_library { + Portal Node Mappings + + @author Ben Adida (ben@openforce.net) + @creation-date April 2002 + @version $Id: site-node-object-map-procs.tcl,v 1.1 2002/06/21 21:05:23 yon Exp $ +} + +namespace eval site_node_object_map { + + ad_proc -public new { + {-object_id:required} + {-node_id:required} + } { + db_exec_plsql set_node_mapping {} + } + + ad_proc -public del { + {-object_id:required} + } { + db_exec_plsql unset_node_mapping {} + } + + ad_proc -public get_node_id { + {-object_id:required} + } { + return [db_string select_node_mapping {} -default ""] + } + + ad_proc -public get_url { + {-object_id:required} + } { + set node_id [get_node_id -object_id $object_id] + + if {[empty_string_p $node_id]} { + return $node_id + } + + return [site_node::get_url -node_id $node_id] + } + +} Index: openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/site-node-object-map-procs.xql 21 Jun 2002 21:05:23 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + select node_id + from site_node_object_mappings + where object_id = :object_id + + + + Index: openacs-4/packages/calendar-portlet/tcl/calendar-portlet-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/tcl/calendar-portlet-display-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/calendar-portlet/tcl/calendar-portlet-display-procs.tcl 17 Apr 2002 14:43:41 -0000 1.1 +++ openacs-4/packages/calendar-portlet/tcl/calendar-portlet-display-procs.tcl 21 Jun 2002 21:06:19 -0000 1.2 @@ -34,7 +34,7 @@ ad_proc -public get_url_stub { calendar_id } { - return [portal::mapping::get_url -object_id $calendar_id] + return [site_node_object_map::get_url -object_id $calendar_id] } } Index: openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl,v diff -u -r1.58 -r1.59 --- openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl 3 Jun 2002 06:30:49 -0000 1.58 +++ openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl 21 Jun 2002 21:06:19 -0000 1.59 @@ -140,7 +140,7 @@ # We associate content using portal mapping (ben) # This SHOULD NOT work, but it does cause we're # reinstantiating calendar - portal::mapping::new \ + site_node_object_map::new \ -node_id \ [site_nodes::get_node_id_from_child_name \ -parent_node_id $node_id \ @@ -255,7 +255,7 @@ -name [package_key] ] - portal::mapping::new -node_id $node_id -object_id $calendar_id + site_node_object_map::new -node_id $node_id -object_id $calendar_id } set args [ns_set create] Index: openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl,v diff -u -r1.67 -r1.68 --- openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl 31 May 2002 06:37:46 -0000 1.67 +++ openacs-4/packages/dotlrn-fs/tcl/dotlrn-fs-procs.tcl 21 Jun 2002 21:06:19 -0000 1.68 @@ -71,7 +71,7 @@ -description "User Folders" \ ] - portal::mapping::new \ + site_node_object_map::new \ -object_id $folder_id \ -node_id [site_nodes::get_node_id_from_package_id -package_id $package_id] @@ -116,7 +116,7 @@ ] set node_id [site_nodes::get_node_id_from_package_id -package_id $package_id] - portal::mapping::new -object_id $folder_id -node_id $node_id + site_node_object_map::new -object_id $folder_id -node_id $node_id set party_id [acs_magic_object registered_users] permission::revoke -party_id $party_id -object_id $folder_id -privilege read @@ -158,7 +158,7 @@ -parent_id $folder_id ] - portal::mapping::new -object_id $a_folder_id -node_id $node_id + site_node_object_map::new -object_id $a_folder_id -node_id $node_id if {[string equal $root_community_type dotlrn_class_instance]} { # a class instance, has some "folder contents" pe's that need filling @@ -186,7 +186,7 @@ -parent_id $folder_id \ ] - portal::mapping::new -object_id $public_folder_id -node_id $node_id + site_node_object_map::new -object_id $public_folder_id -node_id $node_id # The public folder is available to all dotLRN Full Access Users set dotlrn_public [dotlrn::get_users_rel_segment_id] @@ -264,7 +264,7 @@ -creation_user $user_id \ ] - portal::mapping::new -object_id $user_root_folder_id -node_id $node_id + site_node_object_map::new -object_id $user_root_folder_id -node_id $node_id # set the permissions for this folder; only the user has access to it permission::set_not_inherit -object_id $user_root_folder_id @@ -290,7 +290,7 @@ -creation_user $user_id \ ] - portal::mapping::new -object_id $user_shared_folder_id -node_id $node_id + site_node_object_map::new -object_id $user_shared_folder_id -node_id $node_id # set the permissions for this folder permission::grant \ @@ -470,7 +470,7 @@ ] set node_id [site_nodes::get_node_id_from_package_id -package_id $package_id] - portal::mapping::new -object_id $folder_id -node_id $node_id + site_node_object_map::new -object_id $folder_id -node_id $node_id set party_id [acs_magic_object registered_users] permission::revoke -party_id $party_id -object_id $folder_id -privilege read @@ -504,7 +504,7 @@ -parent_id $folder_id \ ] - portal::mapping::new -object_id $public_folder_id -node_id $node_id + site_node_object_map::new -object_id $public_folder_id -node_id $node_id # The public folder is available to all dotLRN Full Access Users set dotlrn_public [dotlrn::get_users_rel_segment_id] @@ -616,7 +616,7 @@ # set up the node mapping, if available if {![empty_string_p $node_id]} { - portal::mapping::new -object_id $new_folder_id -node_id $node_id + site_node_object_map::new -object_id $new_folder_id -node_id $node_id } # we gotta copy the contents of the folder now Index: openacs-4/packages/dotlrn-fs/www/all-objects.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-fs/www/all-objects.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn-fs/www/all-objects.tcl 22 May 2002 08:50:54 -0000 1.6 +++ openacs-4/packages/dotlrn-fs/www/all-objects.tcl 21 Jun 2002 21:06:19 -0000 1.7 @@ -60,8 +60,8 @@ set table_def [list] -lappend table_def [list name Name {fs_objects.name $order} "\$name"] -lappend table_def [list folder_name Folder {} "\$folder_name"] +lappend table_def [list name Name {fs_objects.name $order} "\$name"] +lappend table_def [list folder_name Folder {} "\$folder_name"] lappend table_def {type Type {fs_objects.type $order} {c}} lappend table_def {content_size Size {fs_objects.content_size $order} {[ad_decode $type folder "$content_size item[ad_decode $content_size 1 {} s]" url {} "$content_size byte[ad_decode $content_size 1 {} s]"]}} lappend table_def {last_modified {Last Modified} {fs_objects.last_modified $order} {[util_AnsiDatetoPrettyDate $last_modified]}} Index: openacs-4/packages/dotlrn-fs/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-fs/www/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-fs/www/index.tcl 18 May 2002 20:18:23 -0000 1.1 +++ openacs-4/packages/dotlrn-fs/www/index.tcl 21 Jun 2002 21:06:19 -0000 1.2 @@ -79,7 +79,7 @@ where rownum < 11 and content_size > 0 } { - set url [portal::mapping::get_url -object_id $folder_id] + set url [site_node_object_map::get_url -object_id $folder_id] } ad_return_template 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 -r1.2 -r1.3 --- openacs-4/packages/fs-portlet/www/fs-contents-portlet.tcl 4 Jun 2002 16:34:12 -0000 1.2 +++ openacs-4/packages/fs-portlet/www/fs-contents-portlet.tcl 21 Jun 2002 21:06:19 -0000 1.3 @@ -48,7 +48,7 @@ } set folder_id [lindex $list_of_folder_ids 0] -set url [portal::mapping::get_url -object_id $folder_id] +set url [site_node_object_map::get_url -object_id $folder_id] set recurse_p 1 set contents_url "${url}folder-contents?[export_vars {folder_id recurse_p}]&" 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 -r1.12 -r1.13 --- openacs-4/packages/fs-portlet/www/fs-portlet.tcl 4 Jun 2002 16:34:12 -0000 1.12 +++ openacs-4/packages/fs-portlet/www/fs-portlet.tcl 21 Jun 2002 21:06:19 -0000 1.13 @@ -52,7 +52,7 @@ set folder_id [lindex $list_of_folder_ids 0] } -set url [portal::mapping::get_url -object_id $folder_id] +set url [site_node_object_map::get_url -object_id $folder_id] set contents_url [lindex $config(contents_url) 0] if {[empty_string_p $contents_url]} { Index: openacs-4/packages/new-portal/new-portal.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/new-portal.info,v diff -u -r1.15 -r1.16 --- openacs-4/packages/new-portal/new-portal.info 31 May 2002 06:36:47 -0000 1.15 +++ openacs-4/packages/new-portal/new-portal.info 21 Jun 2002 21:06:19 -0000 1.16 @@ -34,7 +34,6 @@ - @@ -46,11 +45,6 @@ - - - - - Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/new-portal/sql/oracle/portal-node-mapping-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/new-portal/sql/postgresql/portal-node-mapping-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/new-portal/tcl/portal-node-mapping-procs-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/new-portal/tcl/portal-node-mapping-procs-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/new-portal/tcl/portal-node-mapping-procs.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/new-portal/tcl/portal-node-mapping-procs.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v diff -u -r1.149 -r1.150 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 11 Jun 2002 04:25:51 -0000 1.149 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 21 Jun 2002 21:06:19 -0000 1.150 @@ -16,7 +16,7 @@ # tcl/portal-procs.tcl ad_library { - Portal. + Portal. @author Arjun Sanyal (arjun@openforce.net) @creation-date Sept 2001 @@ -38,7 +38,7 @@ } else { set diff [expr "$time - $old_time"] } - + set old_time $time ns_log Notice "DEBUG-TIME: $time ($diff) - $str" @@ -55,7 +55,7 @@ if {[empty_string_p $datasource_name]} { set datasource_name [get_datasource_name $ds_id] } - + return [acs_sc_call portal_datasource $op $list_args $datasource_name] } @@ -93,9 +93,9 @@ # The mangement is not responsible for the results of multi-mounting - ad_proc -private package_key {} { + ad_proc -private package_key {} { Returns the package_key - } { + } { return "new-portal" } @@ -106,18 +106,18 @@ } # Work around for template::util::url_to_file - ad_proc -private www_path {} { + ad_proc -private www_path {} { Returns the path of the www dir of the portal package. We need this for stupid template tricks. - } { + } { return "/packages/[package_key]/www" } ad_proc -private mount_point_no_cache {} { - Returns the mount point of the portal package. - Sometimes we need to know this for like ing + Returns the mount point of the portal package. + Sometimes we need to know this for like ing templates from tcl - } { + } { return [site_nodes::get_info -return param \ -param url \ -package_key [package_key]] @@ -129,25 +129,25 @@ return [util_memoize portal::mount_point_no_cache] } - ad_proc -public automount_point {} { + ad_proc -public automount_point {} { packages such as dotlrn can automount the portal here - } { return "portal" } + } { return "portal" } # # Main portal procs # ad_proc -public create { - {-name "Untitled"} - {-template_id ""} + {-name "Untitled"} + {-template_id ""} {-layout_name ""} {-theme_name ""} {-default_page_name ""} - {-context_id ""} + {-context_id ""} {-csv_list ""} - user_id + user_id } { - Create a new portal for the passed in user id. + Create a new portal for the passed in user id. @return The newly created portal's id @param user_id @@ -184,7 +184,7 @@ # get the default theme name from param, if no theme given if {[empty_string_p $theme_name]} { set theme_name [ad_parameter -package_id [get_package_id] default_theme_name] - } + } set theme_id [get_theme_id_from_name -theme_name $theme_name] @@ -209,7 +209,7 @@ } ad_proc -public delete { - portal_id + portal_id } { Destroy the portal @param portal_id @@ -221,26 +221,26 @@ return [db_exec_plsql delete_portal {}] } - ad_proc -public get_name { + ad_proc -public get_name { portal_id } { Get the name of this portal } { return [util_memoize "portal::get_name_not_cached -portal_id $portal_id"] } - ad_proc -private get_name_not_cached { + ad_proc -private get_name_not_cached { {-portal_id:required} } { Memoizing helper } { return [db_string get_name_select {} -default ""] } - ad_proc -public render { + ad_proc -public render { {-page_id ""} {-page_num ""} - {-hide_links_p "f"} + {-hide_links_p "f"} {-render_style "individual"} portal_id } { @@ -260,7 +260,7 @@ set sort_key 0 } elseif {![empty_string_p $page_num]} { set sort_key $page_num - } + } # get the portal and layout db_1row portal_select {} -column_array portal @@ -285,32 +285,32 @@ set element_src "[www_path]/render_styles/${render_style}/render-element" set template " @portal.name@ - " } # Necessary hack to work around the acs-templating system set __adp_stub "[get_server_root][www_path]/." - set {master_template} \"master\" + set {master_template} \"master\" # Compile and evaluate the template set code [template::adp_compile -string $template] return [template::adp_eval code] } - ad_proc -private layout_elements { - element_list - {var_stub "element_ids"} + ad_proc -private layout_elements { + element_list + {var_stub "element_ids"} } { Split a list up into a bunch of variables for inserting into a - layout template. This seems pretty kludgy (probably because it is), + layout template. This seems pretty kludgy (probably because it is), but a template::multirow isn't really well suited to data of this shape. It'll setup a set of variables, $var_stub_1 - $var_stub_8 and $var_stub_i1- $var_stub_i8, each contining the portal_ids that @@ -319,7 +319,7 @@ @param element_id_list An [array get]'d array, keys are regions, \ values are lists of element_ids. @param var_stub A name upon which to graft the bits that will be \ - passed to the template. + passed to the template. } { array set elements $element_list @@ -337,7 +337,7 @@ # Portal configuration procs # - ad_proc -private update_name { + ad_proc -private update_name { portal_id new_name } { Update the name of this portal @@ -353,13 +353,13 @@ } - ad_proc -public configure { + ad_proc -public configure { {-referer ""} {-template_p f} portal_id return_url } { - Return a portal or portal template configuration page. + Return a portal or portal template configuration page. All form targets point to file_stub-2. FIXME REFACTOR ME @@ -380,13 +380,13 @@ } # - # Set up some whole page stuff + # Set up some whole page stuff # set master_template [ad_parameter master_template] set action_string [generate_action_string] if { $template_p == "f" } { set element_src "[portal::www_path]/place-element" - } else { + } else { set element_src "[portal::www_path]/template-place-element" } @@ -399,21 +399,21 @@ # # Begin creating the template - # - set template " + # + set template "

$return_text

" # # Theme selection chunk - # + # set theme_chunk "

- Change Theme: + Change Theme:
" set current_theme_id [portal::get_theme_id -portal_id $portal_id] @@ -432,13 +432,13 @@ } append theme_chunk "
\n" } - + append theme_chunk "
" append template "$theme_chunk" # # Per-page template chunks - # + # set list_of_page_ids [list_pages_tcl_list -portal_id $portal_id] foreach page_id $list_of_page_ids { @@ -451,7 +451,7 @@ # # Page rename chunk - # + # set page_name_chunk "
@@ -462,33 +462,33 @@
Page: -
" + " append template "$page_name_chunk" if {[portal::non_hidden_elements_p -page_id $page_id] || $first_page_p} { # # Page with non-hidden elements OR the first page of the portal # - + db_1row portal_and_page_info_select {} -column_array portal - - # fake some elements for the in the template + + # fake some elements for the in the template foreach region [get_layout_region_list -layout_id $portal(layout_id)] { lappend fake_element_ids($region) $portal_id } - + set element_list [array get fake_element_ids] append template " " @@ -498,14 +498,14 @@ } if {![portal::non_hidden_elements_p -page_id $page_id]} { - - # + + # # Non first page with all hidden elements - # + # # # Remove page chunk - don't allow removal of the first page - # + # if {!$first_page_p} { append template " @@ -523,9 +523,9 @@ " } - # + # # Layout change chunk - only shown when there are no visible elements on the page - # + # set layout_chunk "" foreach layout [get_layout_info] { @@ -540,11 +540,11 @@ } else { append layout_chunk ">$one_layout_chunk" } - + append layout_chunk "
\n" } - + append template " " - } + } - + # close the page's table append template "
-
@@ -562,14 +562,14 @@
" } - + # # New page chunk # @@ -582,22 +582,22 @@ - Add a new page: + Add a new page: " - + # - # Revert page chunk + # Revert page chunk # if {![empty_string_p [get_portal_template_id $portal_id]]} { append template "
- Revert to the default arrangement: + Revert to the default arrangement:
" } @@ -606,25 +606,25 @@ # Templating system hacks # set __adp_stub "[get_server_root][www_path]/." - set {master_template} \"master\" + set {master_template} \"master\" set code [template::adp_compile -string $template] set output [template::adp_eval code] return $output } - ad_proc -public configure_dispatch { + ad_proc -public configure_dispatch { {-template_p "f"} {-portal_id:required} {-form:required} } { - Dispatches the configuration operation. + Dispatches the configuration operation. We get the target region number from the op. @param portal_id the portal to edit @param formdata an ns_set with all the formdata - } { + } { set edit_p \ [permission::permission_p \ @@ -640,14 +640,14 @@ set op [ns_set get $form op] switch $op { - "Revert" { + "Revert" { db_transaction { set template_id [get_portal_template_id $portal_id] # revert theme set theme_id [get_theme_id -portal_id $template_id] db_dml revert_theme_update {} - + # revert pages # first equalize number of pages in the target set template_page_count [page_count -portal_id $template_id] @@ -664,27 +664,27 @@ -portal_id $portal_id } } elseif {$difference < 0} { - # more pages in target, delete them from the end, - # putting any elements on them on the first page, + # more pages in target, delete them from the end, + # putting any elements on them on the first page, # we put them in the right place later for {set x 0} {$x < [expr abs($difference)]} {incr x} { set max_page_id [db_string revert_max_page_id_select {}] set page_id [db_string revert_min_page_id_select {}] set region 1 - + db_foreach revert_move_elements_for_del {} { db_dml move_to_page_update {} } - + page_delete -page_id $max_page_id } } - + # now that they have the same number of pages, get to it foreach source_page_id \ [list_pages_tcl_list -portal_id $template_id] { - + db_1row revert_get_source_page_info {} set target_page_id [db_string revert_get_target_page_id {}] @@ -702,10 +702,10 @@ } } } - "Rename" { + "Rename" { portal::update_name $portal_id [ns_set get $form new_name] } - "swap" { + "swap" { portal::swap_element $portal_id \ [ns_set get $form element_id] \ [ns_set get $form region] \ @@ -724,9 +724,9 @@ db_transaction { # The new element's sk will be the last in the region - db_dml show_here_update_sk {} + db_dml show_here_update_sk {} db_dml show_here_update_state {} - } + } } "Move to page" { portal::move_element_to_page \ @@ -737,7 +737,7 @@ set element_id_list [list] # iterate through the set, destructive! - while { [expr [ns_set find $form "element_id"] + 1 ] } { + while { [expr [ns_set find $form "element_id"] + 1 ] } { lappend element_id_list [ns_set get $form "element_id"] ns_set delkey $form "element_id" } @@ -746,7 +746,7 @@ db_transaction { foreach element_id $element_id_list { db_dml hide_update {} - + # after hiding an element, add # it to the _first_ page # of the portal. @@ -755,10 +755,10 @@ -element_id $element_id } } - } + } } "Change Theme" { - set theme_id [ns_set get $form theme_id] + set theme_id [ns_set get $form theme_id] db_dml update_theme {} } @@ -776,7 +776,7 @@ "Change Page Layout" { set_layout_id \ -page_id [ns_set get $form page_id] \ - -layout_id [ns_set get $form layout_id] + -layout_id [ns_set get $form layout_id] } "Rename Page" { set pretty_name [ns_set get $form pretty_name] @@ -823,41 +823,41 @@ # # portal template procs - util and configuration # - ad_proc -private get_portal_template_id { + ad_proc -private get_portal_template_id { portal_id } { Returns this portal's template_id or the null string if it doesn't have a portal template } { - if { [db_0or1row select {}] } { + if { [db_0or1row select {}] } { return $template_id - } else { + } else { return "" } } ad_proc -public template_configure { - portal_id + portal_id return_url } { - Just a wrapper for the configure proc. + Just a wrapper for the configure proc. @param portal_id - @return A portal configuration page + @return A portal configuration page } { - portal::configure -template_p "t" $portal_id $return_url + portal::configure -template_p "t" $portal_id $return_url } - ad_proc -public template_configure_dispatch { + ad_proc -public template_configure_dispatch { portal_id form } { Just a wrapper for the configure_dispatch proc @param portal_id @param formdata an ns_set with all the formdata - } { - configure_dispatch -template_p "t" $portal_id $form + } { + configure_dispatch -template_p "t" $portal_id $form } @@ -872,20 +872,20 @@ } { Gets the id of the page with the given portal_id and sort_key if no sort_key is given returns the first page of the portal - which is always there. + which is always there. @return the id of the page - @param portal_id + @param portal_id @param sort_key - optional, defaults to page 0 } { if {![empty_string_p $page_name]} { - set page_id [db_string get_page_id_from_name {} -default ""] + set page_id [db_string get_page_id_from_name {} -default ""] if {[empty_string_p $page_id]} { # there is no page by that name in the portal, return page 0 - return [get_page_id -portal_id $portal_id] + return [get_page_id -portal_id $portal_id] } else { return $page_id - } + } } else { return [db_string get_page_id_select {}] } @@ -909,8 +909,8 @@ } { 1 when there's only one page - @param portal_id - @param page_id + @param portal_id + @param page_id } { return [db_string page_count_select {}] } @@ -945,10 +945,10 @@ {-pretty_name:required} {-portal_id:required} } { - Appends a new blank page for the given portal_id. + Appends a new blank page for the given portal_id. @return the id of the page - @param portal_id + @param portal_id } { # get the layout_id if {![empty_string_p $layout_name]} { @@ -966,13 +966,13 @@ Returns a tcl list of the page_ids for the given portal_id @return tcl list of the pages - @param portal_id + @param portal_id } { set foo [list] db_foreach list_pages_tcl_list_select {} { lappend foo $page_id - } + } return $foo } @@ -989,17 +989,17 @@ Wraps portal::dimensional to create a dotlrn navbar @return the id of the page - @param portal_id + @param portal_id @param link the relative link to set for hrefs @param current_page_link f means that there is no link for the current page } { set ad_dim_struct [list] db_foreach list_page_nums_select {} { lappend ad_dim_struct [list $page_num $pretty_name [list]] - } + } - set ad_dim_struct "{ page_num \"Page:\" 0 [list $ad_dim_struct] }" + set ad_dim_struct "{ page_num \"Page:\" 0 [list $ad_dim_struct] }" return [dimensional -no_header \ -no_bars \ @@ -1017,7 +1017,7 @@ # Element Procs # - ad_proc -public add_element { + ad_proc -public add_element { {-portal_id:required} {-portlet_name:required} {-force_region ""} @@ -1062,10 +1062,10 @@ if { $min_num > $count } { set min_num $count set min_region $region - } + } } - if { $min_region == 0 } { + if { $min_region == 0 } { set min_region 1 } } else { @@ -1082,7 +1082,7 @@ if {$min_region == 0} { # the region asked for was not in the list ns_log error "portal::add_element region $force_region not in layout $layout_id" - ad_return_complaint 1 "portal::add_element region $force_region not in layout $layout_id" + ad_return_complaint 1 "portal::add_element region $force_region not in layout $layout_id" } } @@ -1126,7 +1126,7 @@ } } - ad_proc -private add_element_to_region { + ad_proc -private add_element_to_region { {-layout_id:required} {-page_name ""} {-pretty_name ""} @@ -1137,23 +1137,23 @@ Add an element to a portal in a region, given a datasource name @return the id of the new element - @param portal_id + @param portal_id @param ds_name } { - # XXX AKS: The whole issue of datasource/portlet naming must + # XXX AKS: The whole issue of datasource/portlet naming must # be cleaned up! FIXME if {[empty_string_p $pretty_name]} { set pretty_name $ds_name } set page_id [get_page_id -portal_id $portal_id -page_name $page_name] - set ds_id [get_datasource_id $ds_name] + set ds_id [get_datasource_id $ds_name] # First, check if this portal 1) has a portal template and - # 2) that that template has an element of this DS in it. If - # so, copy stuff. If not, just insert normally. + # 2) that that template has an element of this DS in it. If + # so, copy stuff. If not, just insert normally. if {[db_0or1row get_template_info_select {}] == 1} { set new_element_id [db_nextval acs_object_id_seq] @@ -1187,8 +1187,8 @@ } { Moves a PE in the up or down by swapping its sk with its neighbor's - @param portal_id - @param element_id + @param portal_id + @param element_id @param region @param dir either up or down } { @@ -1210,13 +1210,13 @@ return } } else { - ad_return_complaint 1 \ + ad_return_complaint 1 \ "portal::swap_element: Bad direction: $dir" } db_transaction { # because of the uniqueness constraint on sort_keys we - # need to set a dummy key, then do the swap. + # need to set a dummy key, then do the swap. set dummy_sort_key [db_nextval portal_element_map_sk_seq] # Set the element to be moved to the dummy key @@ -1240,7 +1240,7 @@ } { Moves a PE to a neighboring region - @param portal_id + @param portal_id @param element_id @param region the PEs current region @param direction up or down @@ -1260,7 +1260,7 @@ # get this element's page_id db_1row get_my_page_id {} - db_dml update {} + db_dml update {} } ad_proc -private get_element_region { @@ -1289,52 +1289,52 @@ set region $curr_reg } - db_dml update {} + db_dml update {} } - ad_proc -private hideable_p { + ad_proc -private hideable_p { {-element_id:required} } { Check if an element is hideable - } { + } { return [util_memoize "portal::hideable_p_not_cached -element_id $element_id"] } - ad_proc -private hideable_p_not_cached { + ad_proc -private hideable_p_not_cached { {-element_id:required} } { Check if an element is hideable } { return [db_string select_hideable_p {}] } - ad_proc -private hidden_elements_list { + ad_proc -private hidden_elements_list { {-portal_id:required} } { Returns a list of "hidden" element avaliable to a portal. Use a 1 second cache here to fake a per-connection cache. - } { + } { return [util_memoize "portal::hidden_elements_list_not_cached -portal_id $portal_id" 1] } - ad_proc -private hidden_elements_list_not_cached { + ad_proc -private hidden_elements_list_not_cached { {-portal_id:required} } { Memoizing helper } { return [db_list_of_lists select_hidden_elements {}] } - ad_proc -private non_hidden_elements_p { + ad_proc -private non_hidden_elements_p { {-page_id:required} } { Returns 1 when this page has at least 1 non-hidden element on it. - } { + } { return [db_string non_hidden_elements_p_select {} -default 0] } - ad_proc -private set_element_param { + ad_proc -private set_element_param { element_id key value @@ -1344,7 +1344,7 @@ @param element_id @param key @param value - } { + } { #ns_log notice "aks80 set_element_param $element_id / $key / $value / [db_list_of_lists foo { # select * from portal_element_parameters where element_id = :element_id}] " @@ -1354,11 +1354,11 @@ return 1 } - ad_proc -private toggle_element_param { + ad_proc -private toggle_element_param { {-element_id:required} {-key:required} } { - toggles a boolean (t or f) element_param + toggles a boolean (t or f) element_param @param element_id @param key @@ -1429,18 +1429,18 @@ } } - ad_proc -private evaluate_element { + ad_proc -private evaluate_element { {-portal_id:required} {-edit_p:required} element_id - theme_id + theme_id } { - Combine the datasource, template, etc. Return a chunk of HTML. + Combine the datasource, template, etc. Return a chunk of HTML. @return A string containing the fully-rendered content for $element_id. } { # get the element data and theme - db_1row element_select {} -column_array element + db_1row element_select {} -column_array element # get the element's params db_foreach params_select {} { @@ -1477,46 +1477,46 @@ errmsg \ ] \ } { - - ns_log error "*** portal::render_element show callback Error! ***\n\n $errmsg\n\n" + + ns_log error "*** portal::render_element show callback Error! ***\n\n $errmsg\n\n" # ad_return_complaint 1 "*** portal::render_element show callback Error! ***

$errmsg\n\n" - - set element(content) " You have found a bug in our code.

Please notify the webmaster and include the following text. Thank You.

*** portal::render_element show callback Error! ***\n\n $errmsg
\n\n" - + + set element(content) " You have found a bug in our code.

Please notify the webmaster and include the following text. Thank You.

*** portal::render_element show callback Error! ***\n\n $errmsg
\n\n" + } - + # trim the element's content set element(content) [string trim $element(content)] # We use the actual pretty name from the DB (ben) # FIXME: this is not as good as it should be if {$element(ds_name) == $element(pretty_name)} { - + set element(name) \ [datasource_call \ -datasource_name $element(ds_name) \ $element(datasource_id) \ "GetPrettyName" \ [list]] } else { - set element(name) $element(pretty_name) + set element(name) $element(pretty_name) } # The idea for the link proc in the datasource API is that # it is the target for the href for the title of the portlet, # but since we are using "hide_links_p" all the time, the # value this returns is ignored set element(link) \ - [datasource_call \ + [datasource_call \ -datasource_name $element(ds_name) \ $element(datasource_id) \ "Link" \ [list]] - + # done with callbacks, now set config params - set element(shadeable_p) $config(shadeable_p) - set element(shaded_p) $config(shaded_p) - set element(hideable_p) $config(hideable_p) + set element(shadeable_p) $config(shadeable_p) + set element(shaded_p) $config(shaded_p) + set element(hideable_p) $config(hideable_p) set element(user_editable_p) $config(user_editable_p) set element(link_hideable_p) $config(link_hideable_p) @@ -1537,7 +1537,7 @@ } { # get the element data and theme - db_1row element_select {} -column_array element + db_1row element_select {} -column_array element # get the element's params db_foreach params_select {} { @@ -1553,27 +1553,27 @@ # do the callback for the ::show proc # evaulate the datasource. - if { [catch { set element(content) \ + if { [catch {set element(content) \ [datasource_call \ $element(datasource_id) "Show" [list [array get config] ]] } \ errmsg ] } { - ns_log error "*** portal::render_element show callback Error! ***\n\n $errmsg\n\n" + ns_log error "*** portal::render_element show callback Error! ***\n\n $errmsg\n\n" ad_return -error ad_return_complaint 1 "*** portal::render_element show callback Error! ***

$errmsg\n\n" } set element(name) \ [datasource_call \ - $element(datasource_id) "GetPrettyName" [list]] + $element(datasource_id) "GetPrettyName" [list]] # no "Link" for raw elements set element(link) {} # done with callbacks, now set config params - set element(shadeable_p) $config(shadeable_p) - set element(shaded_p) $config(shaded_p) - set element(hideable_p) $config(hideable_p) + set element(shadeable_p) $config(shadeable_p) + set element(shaded_p) $config(shaded_p) + set element(hideable_p) $config(hideable_p) set element(user_editable_p) $config(user_editable_p) set element(link_hideable_p) $config(link_hideable_p) @@ -1589,11 +1589,11 @@ } - ad_proc -public configure_element { + ad_proc -public configure_element { {-noconn ""} - element_id - op - return_url + element_id + op + return_url } { Dispatch on the element_id and op requested @@ -1613,13 +1613,13 @@ } switch $op { - "edit" { + "edit" { # Get the edit html by callback # Notice that the "edit" proc takes only the element_id set html_string [datasource_call $datasource_id "Edit" \ - [list $element_id]] + [list $element_id]] - if { $html_string == "" } { + if { $html_string == "" } { ns_log Error "portal::configure_element op = edit, but portlet's edit proc returned null string" @@ -1631,27 +1631,27 @@ set action_string [generate_action_string] # the sources /www/place-element.tcl - set template " + set template " Return to your portal

Edit this element's parameters:

- @html_string@ + @html_string@

" set __adp_stub "[get_server_root][www_path]/." - set {master_template} \"master\" + set {master_template} \"master\" set code [template::adp_compile -string $template] set output [template::adp_eval code] return $output } - "shade" { + "shade" { set shaded_p [get_element_param $element_id "shaded_p"] if { $shaded_p == "f" } { @@ -1680,7 +1680,7 @@ @param ds_id @return ds_name - } { + } { if {[db_0or1row select {}]} { return $name } else { @@ -1696,7 +1696,7 @@ @param ds_name @return ds_id - } { + } { if {[db_0or1row select {}]} { return $datasource_id } else { @@ -1708,14 +1708,14 @@ } ad_proc -private make_datasource_available {portal_id ds_id} { - Make the datasource available to the given portal. + Make the datasource available to the given portal. @param portal_id @param ds_id } { if {![datasource_available_p -portal_id $portal_id -datasource_id $ds_id]} { set new_p_ds_id [db_nextval acs_object_id_seq] - db_dml insert {} + db_dml insert {} } } @@ -1732,12 +1732,12 @@ } ad_proc -private make_datasource_unavailable {portal_id ds_id} { - Make the datasource unavailable to the given portal. + Make the datasource unavailable to the given portal. @param portal_id @param ds_id } { - # ad_require_permission $portal_id portal_admin_portal + # ad_require_permission $portal_id portal_admin_portal db_dml delete {} } @@ -1762,8 +1762,8 @@ ad_proc -private generate_action_string { } { - Portal configuration pages need this to set up - the target for the generated links. It's just the + Portal configuration pages need this to set up + the target for the generated links. It's just the current location with "-2" appended to the name of the page. } { @@ -1781,21 +1781,21 @@ {-portal_id:required} {-pretty_name:required} } { - Get the element IDs with the given pn on the portal, returns + Get the element IDs with the given pn on the portal, returns the empty string if none is found } { return [db_string select {} -default ""] } - ad_proc -private get_layout_region_count { + ad_proc -private get_layout_region_count { {-layout_id:required} } { Get the number of regions (aka columns) this layout supports - } { + } { return [util_memoize "portal::get_layout_region_count_not_cached -layout_id $layout_id"] } - ad_proc -private get_layout_region_count_not_cached { + ad_proc -private get_layout_region_count_not_cached { {-layout_id:required} } { return [db_string select {}] @@ -1819,7 +1819,7 @@ ad_proc -private get_layout_info { } { - Returns a list of all the layouts in the system asns_sets with + Returns a list of all the layouts in the system asns_sets with keys being: name, description, and number of regions. } { return [db_list_of_ns_sets select_layout_info {}] @@ -1834,7 +1834,7 @@ db_dml update_layout_id {} } - ad_proc -private get_layout_id { + ad_proc -private get_layout_id { {-page_num ""} {-page_id ""} {-layout_name "Simple 2-Column"} @@ -1858,23 +1858,23 @@ } return $layout_id - } + } ad_proc -private exists_p { portal_id } { Check if a portal by that id exists. @return 1 on success, 0 on failure @param a portal_id } { - if { [db_0or1row select {} ]} { + if { [db_0or1row select {} ]} { return 1 - } else { - return 0 + } else { + return 0 } } - ad_proc -public add_element_parameters { + ad_proc -public add_element_parameters { {-portal_id:required} {-portlet_name:required} {-value:required} @@ -1888,10 +1888,10 @@ A helper proc for portlet "add_self_to_page" procs. Adds the given portlet as an portal element to the given page. If the portlet is already in the given portal page, - it appends the value to the element's parameters with the + it appends the value to the element's parameters with the given key. Returns the element_id used. - IMPROVE ME: refactor + IMPROVE ME: refactor @return element_id The new element's id @param portal_id The page to add the portlet to @@ -1930,7 +1930,7 @@ set_element_param $element_id \ [lindex $extra_params $x] \ [lindex $extra_params [expr $x + 1]] - } + } } } } else { @@ -1943,8 +1943,8 @@ set_element_param $element_id $key $value } else { error "portal::add_element_parameters error: bad param action! $param_action 1" - } - + } + if {![empty_string_p $extra_params]} { check_key_value_list $extra_params @@ -1955,19 +1955,19 @@ -key [lindex $extra_params $x] \ -value [lindex $extra_params [expr $x + 1]] } elseif {[string equal $param_action "overwrite"]} { - set_element_param $element_id [lindex $extra_params $x] [lindex $extra_params [expr $x + 1]] + set_element_param $element_id [lindex $extra_params $x] [lindex $extra_params [expr $x + 1]] } else { error "portal::add_element_parameters error: bad param action! $param_action 2" - } + } } } } } return $element_id } - ad_proc -public remove_element_parameters { - {-portal_id:required} + ad_proc -public remove_element_parameters { + {-portal_id:required} {-portlet_name:required} {-value:required} {-key "package_id"} @@ -1976,13 +1976,13 @@ A helper proc for portlet "remove_self_from_page" procs. The inverse of the above proc. - Removes the given parameters from all the the portlets - of this type on the given page. If by removing this param, + Removes the given parameters from all the the portlets + of this type on the given page. If by removing this param, there are no more params (say instace_id's) of this type, that means that the portlet has become empty and can be @param portal_id The portal page to act on - @param portlet_name The name of the portlet to (maybe) remove + @param portlet_name The name of the portlet to (maybe) remove @param key the key for the value (defaults to package_id) @param value the value of the key @param extra_params a list of extra key/value pairs to remove @@ -2008,11 +2008,11 @@ -key [lindex $extra_params $x] \ -value [lindex $extra_params [expr $x + 1]] } - } + } } } - # step 2: Check if we should really remove the element + # step 2: Check if we should really remove the element db_transaction { foreach element_id $element_ids { if {[llength [get_element_param_list \ @@ -2024,18 +2024,18 @@ } } - ad_proc -private check_key_value_list { + ad_proc -private check_key_value_list { list_to_check } { rat-simple consistency check for the above 2 procs - } { + } { if {[expr [llength $list_to_check] % 2] != 0} { ns_log error "portal::check_key_value_list bad var list_to_check!" - ad_return_complaint 1 "portal::check_key_value_list bad var list_to_check!" - } + ad_return_complaint 1 "portal::check_key_value_list bad var list_to_check!" + } } - ad_proc -public show_proc_helper { + ad_proc -public show_proc_helper { {-template_src ""} {-package_key:required} {-config_list:required} @@ -2060,28 +2060,28 @@ uplevel 1 { set template "" set __adp_stub "[get_server_root]/packages/$__pk/www/." - set code [template::adp_compile -string $template] + set code [template::adp_compile -string $template] set output [template::adp_eval code] return $output } } - ad_proc -public get_theme_id { + ad_proc -public get_theme_id { {-portal_id:required} } { self explanatory } { return [db_string get_theme_id_select {}] } - ad_proc -public get_theme_id_from_name { + ad_proc -public get_theme_id_from_name { {-theme_name:required} } { self explanatory } { - if { [db_0or1row get_theme_id_from_name_select {} ]} { + if { [db_0or1row get_theme_id_from_name_select {} ]} { return $theme_id - } else { + } else { ns_log error "portal::get_theme_id_from_name_select bad theme_id!" ad_return_complaint 1 "portal::get_theme_id_from_name_select bad theme_id!" } @@ -2090,7 +2090,7 @@ ad_proc -private get_theme_info { } { - Returns a list of all the themes in the system as ns_sets with + Returns a list of all the themes in the system as ns_sets with keys being: theme_id, name, description } { return [util_memoize "portal::get_theme_info_not_cached"] @@ -2113,9 +2113,9 @@ {-table_html_args "border=0 cellspacing=0 cellpadding=3 width=100%"} {-pre_html ""} {-post_html ""} - option_list - {url {}} - {options_set ""} + option_list + {url {}} + {options_set ""} {optionstype url} } { An enhanced ad_dimensional. see that proc for usage details @@ -2132,17 +2132,17 @@ set url [ad_conn url] } - set html "\n\n \n" + set html "\n
\n \n" if {!$no_header_p} { - foreach option $option_list { + foreach option $option_list { append html " \n" } } append html " \n \n" - foreach option $option_list { + foreach option $option_list { append html " \n" }
[lindex $option 1]
" if {!$no_bars_p} { @@ -2158,7 +2158,7 @@ } set first_p 1 - foreach option_value [lindex $option 3] { + foreach option_value [lindex $option 3] { set thisoption_name [lindex $option_value 0] set thisoption_value [lindex $option_value 1] set thisoption_link_p 1 @@ -2172,9 +2172,9 @@ if {!$no_bars_p} { append html " | " } else { - append html "   " + append html "   " } - } + } if {([string equal $option_val $thisoption_name] == 1 && !$link_all) || !$thisoption_link_p} { append html "${pre_html}${thisoption_value}${post_html}" @@ -2185,7 +2185,7 @@ if {!$no_bars_p} { append html "\]" - } + } append html "$extra_td_html