Index: openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql 22 Jan 2004 02:50:11 -0000 1.4 +++ openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql 27 Jan 2004 03:33:46 -0000 1.5 @@ -373,12 +373,6 @@ on delete cascade constraint p_elements_application_id_nn not null, - bound_object_id integer - constraint p_elements_b_o_id_fk - references acs_objects (object_id) - on delete cascade - constraint p_elements_b_o_id_nn - not null, constraint p_elements_page_id_name_un unique (page_id, name) ); @@ -403,10 +397,6 @@ with. '; -comment on column portal_elements.bound_object_id is ' - The object_id of the object bound to this element, often the same as the application_id. -'; - create table portal_element_parameters ( parameter_id integer constraint portal_element_parameters_pk Index: openacs-4/contrib/packages/portal/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/apm-callback-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/tcl/apm-callback-procs.tcl 16 Jan 2004 01:43:40 -0000 1.3 +++ openacs-4/contrib/packages/portal/tcl/apm-callback-procs.tcl 27 Jan 2004 03:33:46 -0000 1.4 @@ -8,73 +8,16 @@ name portal_datasource description "Portal datasource interface." operations { - GetMyName { + ConfigureParams { description { - Return the name of the datasource (not to be confused with the - pretty_name) + Configure datasource-specific parameters to reasonable values. } input { - } - output { - name:string - } - } - GetPrettyName { - description { - Return the pretty name (or, for internationalized portlets, the - appropriate message key) for the datasource. - } - input { - } - output { - pretty_name:string - } - } - AddSelfToPage { - description { - Tell the datasource to add itself to a portal page. - - DRB: This is a carryover from .LRN's new-portal package. That early - version of the portal package never called this operation, which is a - good thing because none of the .LRN portlets's add_self_to_page procs - matched the service contract spec!!! But we need to define the actual - procs for .LRN (whose package applets call them directly, circumventing - the service contract mechanism entirely) so I'm leaving this in the spec - for now. However the portal package should actually do this task anyway - so the plan is to retain this operation for .LRN but to never use it in - the new version of the portal package. - } - input { - page_id:integer - instance_id:integer - args:string - } - output { element_id:integer } - } - Show { - description { - Render the portal element, returning a chunk of HTML. - } - input { - cf:string - } output { - output:string } } - RemoveSelfFromPage { - description { - Tell the PE to remove itself from a page. - } - input { - page_id:integer - instance_id:integer - } - output { - } - } } } } Index: openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql 22 Jan 2004 02:50:12 -0000 1.3 +++ openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql 27 Jan 2004 03:33:46 -0000 1.4 @@ -6,13 +6,12 @@ insert into portal_elements - (element_id, datasource_id, name, application_id, bound_object_id, + (element_id, datasource_id, name, application_id, page_id, region, sort_key, shadeable_p, hideable_p) select :element_id, :datasource_id, :name, :application_id, - :bound_object_id, :page_id, :region, nvl((select max(portal_elements.sort_key) + 1 Index: openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql 22 Jan 2004 02:50:12 -0000 1.3 +++ openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql 27 Jan 2004 03:33:46 -0000 1.4 @@ -6,13 +6,12 @@ insert into portal_elements - (element_id, datasource_id, name, application_id, bound_object_id, + (element_id, datasource_id, name, application_id, page_id, region, sort_key, shadeable_p, hideable_p) select :element_id, :datasource_id, :name, :application_id, - :bound_object_id, :page_id, :region, coalesce((select max(portal_elements.sort_key) + 1 Index: openacs-4/contrib/packages/portal/tcl/element-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/contrib/packages/portal/tcl/element-procs.tcl 24 Jan 2004 01:22:47 -0000 1.7 +++ openacs-4/contrib/packages/portal/tcl/element-procs.tcl 27 Jan 2004 03:33:46 -0000 1.8 @@ -34,10 +34,22 @@ {-region ""} {-datasource_name:required} {-application_id:required} - {-bound_object_id ""} {-name ""} + {-configure_params:boolean} } { Create a new portal element of type datasource_name on the given portal. + + @param portal_id The portal instance to add this element to. + @param page_name The name of the page to place it on (defaults to the first page.) + @param pretty_name The pretty name or message resource for this element. + @param region The page region to placer the element on. + @param datasource_name The portal datasource name + @param application_id The package_id of the application this portlet interfaces to. + @param name The name of the element + @param configure_params If set true, call the datasource's ConfigureParams operation + + @return The element_id of the new portlet + } { set page_id [portal::page::get_id -portal_id $portal_id -page_name $page_name] @@ -52,22 +64,23 @@ set name $datasource_name } - if {[string match "" $bound_object_id]} { - set bound_object_id $application_id - } - set element_id [db_nextval portal_seq] - if {[db_0or1row select_template_element_id {}]} { - db_transaction { + db_transaction { + if {[db_0or1row select_template_element_id {}]} { db_dml insert_element_with_template {} db_dml insert_element_parameters_with_template {} - } - } else { - db_transaction { + } else { db_dml insert_element {} db_dml insert_element_parameters {} } + + if { $configure_params_p } { + portal::datasource::call \ + -name $datasource_name \ + -op ConfigureParams \ + -list_args [list $element_id] + } } return $element_id @@ -418,7 +431,6 @@ shadeable_p $element(shadeable_p) \ hideable_p $element(hideable_p) \ application_id $element(application_id) \ - bound_object_id $element(bound_object_id) \ ] set config [concat $config [portal::element::parameter::get_all -element_id $element_id]] @@ -471,7 +483,7 @@ } # DRB: this goes away entirely ... need to do the parameter stuff though, through a -# sevice contract call to set the bound_object_id and portlet-specific parameters. +# sevice contract call to set the portlet-specific parameters. ad_proc -public add_parameters { {-portal_id:required} {-portlet_name:required} @@ -508,9 +520,6 @@ # Tell portal to add this element to the page - # DRB: short-term hack for the application id ... doesn't handle bound_object_id - # either. - set element_id [new \ -page_id $page_id \ -region $force_region \