Index: openacs-4/packages/dotlrn/dotlrn.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/dotlrn.info,v diff -u -r1.99 -r1.100 --- openacs-4/packages/dotlrn/dotlrn.info 13 Jul 2002 19:43:39 -0000 1.99 +++ openacs-4/packages/dotlrn/dotlrn.info 23 Jul 2002 13:40:45 -0000 1.100 @@ -194,7 +194,6 @@ - @@ -217,9 +216,10 @@ + + - @@ -230,6 +230,8 @@ + + @@ -241,6 +243,7 @@ + @@ -279,6 +282,7 @@ + @@ -289,6 +293,7 @@ + @@ -298,12 +303,15 @@ + + + @@ -332,6 +340,7 @@ + @@ -340,12 +349,15 @@ + + + @@ -361,12 +373,14 @@ + + @@ -389,21 +403,26 @@ + + + + + @@ -439,39 +458,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/dotlrn/www/members-chunk-table-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/members-chunk-table-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/members-chunk-table-oracle.xql 15 Jul 2002 20:12:46 -0000 1.1 +++ openacs-4/packages/dotlrn/www/members-chunk-table-oracle.xql 23 Jul 2002 13:40:45 -0000 1.2 @@ -2,27 +2,26 @@ oracle8.1.6 + - select dotlrn_member_rels_approved.rel_id, - dotlrn_member_rels_approved.rel_type, - dotlrn_member_rels_approved.role, - dotlrn_member_rels_approved.user_id, - registered_users.first_names, - registered_users.last_name, - registered_users.email - from registered_users, - dotlrn_member_rels_approved - where dotlrn_member_rels_approved.community_id = :community_id - and dotlrn_member_rels_approved.user_id = registered_users.user_id - order by - decode(role,'instructor',1,'admin',2,'teaching_assistant',3,'course_assistant',4,'course_admin',5,'student',6,'member',7) - asc, last_name - -- note, last_name should be sorted by $order, but b/c this - -- query gets called by ad_table, ad_table would have to know - -- to uplevel order.. not going to happen. So no reversals on - -- last name for now, sorry. - + select dotlrn_member_rels_approved.rel_id, + dotlrn_member_rels_approved.rel_type, + dotlrn_member_rels_approved.role, + dotlrn_member_rels_approved.user_id, + registered_users.first_names, + registered_users.last_name, + registered_users.email + from registered_users, + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.community_id = :community_id + and dotlrn_member_rels_approved.user_id = registered_users.user_id + order by decode(role,'instructor',1,'admin',2,'teaching_assistant',3,'course_assistant',4,'course_admin',5,'student',6,'member',7) + last_name + -- note, last_name should be sorted by $order, but b/c this + -- query gets called by ad_table, ad_table would have to know + -- to uplevel order.. not going to happen. So no reversals on + -- last name for now, sorry. Index: openacs-4/packages/dotlrn/www/members-chunk-table-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/members-chunk-table-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/members-chunk-table-postgresql.xql 15 Jul 2002 20:12:46 -0000 1.1 +++ openacs-4/packages/dotlrn/www/members-chunk-table-postgresql.xql 23 Jul 2002 13:40:45 -0000 1.2 @@ -2,40 +2,41 @@ postgresql7.1 + - select dotlrn_member_rels_approved.rel_id, - dotlrn_member_rels_approved.rel_type, - dotlrn_member_rels_approved.role, - dotlrn_member_rels_approved.user_id, - registered_users.first_names, - registered_users.last_name, - registered_users.email - from registered_users, - dotlrn_member_rels_approved - where dotlrn_member_rels_approved.community_id = :community_id - and dotlrn_member_rels_approved.user_id = registered_users.user_id - order by ( - CASE - WHEN role = 'instructor' - THEN 1 - WHEN role = 'admin' - THEN 2 - WHEN role = 'teaching_assistant' - THEN 3 - WHEN role = 'course_assistant' - THEN 4 - WHEN role = 'student' - THEN 6 - WHEN role = 'member' - THEN 7 - END - ) asc, - last_name - -- note, last_name should be sorted by $order, but b/c this - -- query gets called by ad_table, ad_table would have to know - -- to uplevel order.. not going to happen. So no reversals on - -- last name for now, sorry. + select dotlrn_member_rels_approved.rel_id, + dotlrn_member_rels_approved.rel_type, + dotlrn_member_rels_approved.role, + dotlrn_member_rels_approved.user_id, + registered_users.first_names, + registered_users.last_name, + registered_users.email + from registered_users, + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.community_id = :community_id + and dotlrn_member_rels_approved.user_id = registered_users.user_id + order by ( + CASE + WHEN role = 'instructor' + THEN 1 + WHEN role = 'admin' + THEN 2 + WHEN role = 'teaching_assistant' + THEN 3 + WHEN role = 'course_assistant' + THEN 4 + WHEN role = 'student' + THEN 6 + WHEN role = 'member' + THEN 7 + END + ) asc, + last_name + -- note, last_name should be sorted by the variable order, but b/c this + -- query gets called by ad_table, ad_table would have to know to uplevel + -- order.. not going to happen. So no reversals on last name for now, + -- sorry. Index: openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql,v diff -u -r1.25 -r1.26 --- openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 22 Jul 2002 21:48:25 -0000 1.25 +++ openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 23 Jul 2002 13:31:37 -0000 1.26 @@ -33,14 +33,12 @@ - begin - select content_folder__rename( - :folder_id, - null, - :name, - null - ); - end; + select content_folder__rename( + :folder_id, + null, + :name, + null + ); Index: openacs-4/packages/static-portlet/sql/postgresql/static-core.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/sql/postgresql/static-core.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/sql/postgresql/static-core.sql 15 Jul 2002 20:43:42 -0000 1.1 +++ openacs-4/packages/static-portlet/sql/postgresql/static-core.sql 23 Jul 2002 13:40:45 -0000 1.2 @@ -20,10 +20,10 @@ -- arjun@openforce.net -- -- The core DM and API for static portal content --- +-- -- $Id$ --- -- +-- -- PostGreSQL port samir@symphinity.com 11 July 2002 -- @@ -37,18 +37,18 @@ begin perform acs_object_type__create_type ( - ''static_portal_content'', -- object_type - ''Static Content'', -- pretty_name - ''Static Content'', -- pretty_plural - ''acs_object'', -- supertype - ''static_portal_content'', -- table_name - ''content_id'', -- id_column - null, -- package_name - ''f'', -- abstract_p - null, -- type_extension_table - null -- name_method + ''static_portal_content'', -- object_type + ''Static Content'', -- pretty_name + ''Static Content'', -- pretty_plural + ''acs_object'', -- supertype + ''static_portal_content'', -- table_name + ''content_id'', -- id_column + null, -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method ); - return 0; + return 0; end;' language 'plpgsql'; select inline_0(); @@ -61,7 +61,7 @@ -- create table static_portal_content ( content_id integer - constraint static_p_c_fk + constraint static_p_c_fk references acs_objects(object_id) constraint static_p_c_pk primary key, @@ -77,61 +77,85 @@ -- -- API --- +-- -create function static_portal_content_item__new ( - integer, -- package_id in static_portal_content.package_id%TYPE default null, - varchar, -- pretty_name in static_portal_content.pretty_name%TYPE default null, - varchar, -- content in static_portal_content.content%TYPE default null, - varchar, -- object_type in acs_objects.object_type%TYPE default [static_portal_content], - timestamp, -- creation_date in acs_objects.creation_date%TYPE default sysdate, - integer, -- creation_user in acs_objects.creation_user%TYPE default null, - varchar, -- creation_ip in acs_objects.creation_ip%TYPE default null, - integer -- context_id in acs_objects.context_id%TYPE default null - ) -returns integer as ' - declare - p_package_id alias for $1, - p_pretty_name alias for $2, - p_content alias for $3, - p_object_type alias for $4, - p_creation_date alias for $5, - p_creation_user alias for $6, - p_creation_ip alias for $7, - p_context_id alias for $8, - v_content_id static_portal_content.content_id%TYPE; - begin - v_content_id := acs_object__new ( - p_object_type, - p_creation_date, - p_creation_user, - p_creation_ip, - p_context_id - ); - - if p_object_type is null then - p_object_type := ''static_portal_content''; - end if; +create function static_portal_content_item__new (integer, varchar, varchar) +returns integer as ' +declare + p_package_id alias for $1; + p_pretty_name alias for $2; + p_content alias for $3; +begin + return static_portal_content_item__new( + p_package_id, + p_pretty_name, + p_content, + null, + null, + null, + null, + null + ); +end; +' language 'plpgsql'; - insert into static_portal_content - (content_id, package_id, pretty_name, content) - values - (v_content_id, p_package_id, p_pretty_name, p_content); +create function static_portal_content_item__new ( + integer, -- package_id in static_portal_content.package_id%TYPE default null, + varchar, -- pretty_name in static_portal_content.pretty_name%TYPE default null, + varchar, -- content in static_portal_content.content%TYPE default null, + varchar, -- object_type in acs_objects.object_type%TYPE default [static_portal_content], + timestamp, -- creation_date in acs_objects.creation_date%TYPE default sysdate, + integer, -- creation_user in acs_objects.creation_user%TYPE default null, + varchar, -- creation_ip in acs_objects.creation_ip%TYPE default null, + integer -- context_id in acs_objects.context_id%TYPE default null +) +returns integer as ' +declare + p_package_id alias for $1; + p_pretty_name alias for $2; + p_content alias for $3; + p_object_type alias for $4; + p_creation_date alias for $5; + p_creation_user alias for $6; + p_creation_ip alias for $7; + p_context_id alias for $8; + v_content_id static_portal_content.content_id%TYPE; + v_object_type varchar; +begin + if p_object_type is null then + v_object_type := ''static_portal_content''; + else + v_object_type := p_object_type; + end if; - return v_content_id; -end;' language 'plpgsql'; + v_content_id := acs_object__new( + null, + v_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + insert + into static_portal_content + (content_id, package_id, pretty_name, content) + values + (v_content_id, p_package_id, p_pretty_name, p_content); + return v_content_id; +end;' language 'plpgsql'; + create function static_portal_content_item__delete ( - integer -- content_id in static_portal_content.content_id%TYPE - ) -returns integer as ' + integer -- content_id in static_portal_content.content_id%TYPE +) +returns integer as ' declare - p_content_id alias for $1; -begin + p_content_id alias for $1; +begin delete from static_portal_content where content_id = p_content_id; acs_object__delete(p_content_id); - return 0; + return 0; end;' language 'plpgsql'; @@ -164,7 +188,7 @@ perform acs_privilege__add_child(''write'',''static_portal_modify''); perform acs_privilege__add_child(''admin'',''static_portal_admin''); - return 0; + return 0; end;' language 'plpgsql'; select inline_1(); Index: openacs-4/packages/static-portlet/tcl/static-portal-content-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-portal-content-procs-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/tcl/static-portal-content-procs-oracle.xql 21 Jul 2002 20:06:07 -0000 1.1 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs-oracle.xql 23 Jul 2002 13:40:45 -0000 1.2 @@ -1,19 +1,19 @@ -oracle8.1.6 + oracle8.1.6 - - - declare - begin - :1 := static_portal_content_item.new( - package_id => :package_id, - content => :content, - pretty_name => :pretty_name - ); - end; - - + + + declare + begin + :1 := static_portal_content_item.new( + package_id => :package_id, + content => :content, + pretty_name => :pretty_name + ); + end; + + Index: openacs-4/packages/static-portlet/tcl/static-portal-content-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-portal-content-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/tcl/static-portal-content-procs-postgresql.xql 21 Jul 2002 20:06:07 -0000 1.1 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs-postgresql.xql 23 Jul 2002 13:40:45 -0000 1.2 @@ -1,18 +1,16 @@ -postgresql7.1 + postgresql7.1 - - - begin - select static_portal_content_item__new( - :package_id, - :content, - :pretty_name - ); - end; - - + + + select static_portal_content_item__new( + :package_id, + :content, + :pretty_name + ); + + Index: openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 21 Jul 2002 20:06:07 -0000 1.11 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 23 Jul 2002 13:40:45 -0000 1.12 @@ -19,16 +19,14 @@ The procs for manipulating static portal content. This is like having the "bboard" included in it's own "bboard-portlet" package. - Copyright Openforce, Inc. - Licensed under GNU GPL v2 + @author arjun@openforce.net + @version $Id$ - @author arjun@openforce.net - @cvs-id $Id$ } namespace eval static_portal_content { - ad_proc -public new { + ad_proc -public new { {-package_id:required} {-content:required} {-pretty_name:required} @@ -37,7 +35,7 @@ } { # Create the content item set content_id [db_exec_plsql new_content_item {}] - + # Ben's style only cause he was editing here and then changed things back return $content_id } @@ -48,15 +46,15 @@ {-content_id ""} {-template_id ""} } { - This is a bit different from other add_self_to_page procs. + This is a bit different from other add_self_to_page procs. } { if {![empty_string_p $template_id]} { # we got a template_id, so we know that (1) that we are # being called from add_applet_to_community. That means that - # we have a static portlet copied from our template, + # we have a static portlet copied from our template, # but the pointer to the _content_ of the portlet still - # _template's content_. Therefore we need to clone the + # _template's content_. Therefore we need to clone the # _template's content_ and update the pointer # (2) that there's only one static portlet on the page. @@ -72,22 +70,22 @@ -content [get_content -content_id $old_content_id] \ -pretty_name [get_pretty_name -content_id $old_content_id] ] - + # update the new static portlet's params, and return set new_element_id [portal::get_element_ids_by_ds \ $portal_id \ [static_portlet::get_my_name] ] portal::set_element_param $new_element_id "package_id" $package_id portal::set_element_param $new_element_id "content_id" $new_content_id - + # we use the return value to create the portlet on the non-member # page, which is linked to the same content as on the main comm page return $new_content_id } db_transaction { - # Generate the element, don't use add_element_parameters here, + # 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 @@ -99,8 +97,8 @@ -parameter "static_portal_content_force_region" \ -package_key "static-portlet"] ] - - portal::set_element_param $element_id package_id $package_id + + portal::set_element_param $element_id package_id $package_id portal::set_element_param $element_id content_id $content_id } } @@ -115,22 +113,22 @@ } { set ds_id [portal::get_datasource_id [static_portlet::get_my_name]] - set element_list [db_list get_element_list {}] + set element_list [db_list get_element_list {}] - foreach element_id $element_list { - set old_content_id [db_string select_element_id {}] + foreach element_id $element_list { + set old_content_id [db_string select_element_id {}] - # make a new static content item from this item - set new_content_id [new \ - -package_id $package_id \ - -content [get_content -content_id $old_content_id] \ - -pretty_name [get_pretty_name -content_id $old_content_id] - ] + # make a new static content item from this item + set new_content_id [new \ + -package_id $package_id \ + -content [get_content -content_id $old_content_id] \ + -pretty_name [get_pretty_name -content_id $old_content_id] + ] - # update the portal element's pointers - portal::set_element_param $element_id package_id $package_id - portal::set_element_param $element_id content_id $new_content_id - } + # update the portal element's pointers + portal::set_element_param $element_id package_id $package_id + portal::set_element_param $element_id content_id $new_content_id + } } ad_proc -public remove_from_portal { @@ -152,7 +150,7 @@ } } - ad_proc -public update { + ad_proc -public update { {-content_id:required} {-content:required} {-pretty_name:required} @@ -163,38 +161,38 @@ } - ad_proc -public delete { + ad_proc -public delete { {-content_id:required} } { deletes the item } { - + db_dml delete_content_item { delete from static_portal_content where content_id = :content_id } } - ad_proc -public get_pretty_name { + ad_proc -public get_pretty_name { {-content_id:required} } { Get the pretty_name of the item } { - return [db_string get_pretty_name.select {}] + return [db_string select {}] } - ad_proc -public get_content { + ad_proc -public get_content { {-content_id:required} } { Get the content of the item } { return [db_string get_content.select { select content - from static_portal_content + from static_portal_content where content_id = :content_id }] } - ad_proc -public get_package_id { + ad_proc -public get_package_id { {-content_id:required} } { Get the package_id of the item Index: openacs-4/packages/static-portlet/tcl/static-portal-content-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-portal-content-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/tcl/static-portal-content-procs.xql 21 Jul 2002 20:06:07 -0000 1.1 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs.xql 23 Jul 2002 13:40:45 -0000 1.2 @@ -2,48 +2,47 @@ - - + + select pem.element_id as element_id from portal_element_map pem, portal_pages pp - where pp.portal_id= :portal_id + where pp.portal_id= :portal_id and pp.page_id = pem.page_id and pem.datasource_id= :ds_id - - + + - - - select value - from portal_element_parameters - where element_id = :element_id - and key = 'content_id' - - + + + select value + from portal_element_parameters + where element_id = :element_id + and key = 'content_id' + + - - - update static_portal_content set - content = :content, pretty_name = :pretty_name + + + update static_portal_content set + content = :content, pretty_name = :pretty_name where content_id = :content_id - - + + - - + + select pretty_name - from static_portal_content + from static_portal_content where content_id = :content_id - - + + - - + + select package_id - from static_portal_content + from static_portal_content where content_id = :content_id - - + + -