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.1 -r1.2 --- openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 18 Feb 2002 05:23:12 -0000 1.1 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 18 Feb 2002 20:23:00 -0000 1.2 @@ -21,18 +21,36 @@ } { Calls the pl/sql to create the new content item } { - return [db_exec_plsql new_content_item { - declare - begin - :1 := static_portal_content_item.new( - instance_id => :instance_id, - content => :content, - pretty_name => :pretty_name - ); - end; - }] + # Create the content item + set content_id [db_exec_plsql new_content_item " + declare + begin + :1 := static_portal_content_item.new( + instance_id => :instance_id, + content => :content, + pretty_name => :pretty_name + ); + end; + "] + + # Ben's style only cause he was editing here and then changed things back + return $content_id } + ad_proc -public add_to_portal { + {-content_id:required} + {-portal_id:required} + } { + db_transaction { + # Generate the element + set element_id [portal::add_element -pretty_name [get_pretty_name -content_id $content_id] \ + $portal_id [static_portlet::my_name]] + + # Set the parameter + portal::set_element_param $element_id content_id $content_id + } + } + ad_proc -public update { {-content_id:required} {-content:required} Index: openacs-4/packages/static-portlet/www/element-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/Attic/element-new.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/www/element-new.tcl 18 Feb 2002 05:23:12 -0000 1.1 +++ openacs-4/packages/static-portlet/www/element-new.tcl 18 Feb 2002 20:23:00 -0000 1.2 @@ -6,12 +6,13 @@ @version $Id$ } -query { {referer "../one-community-admin"} - {instance_id ""} + portal_id:integer,notnull } -properties { title:onevalue } set title "New static element" +set instance_id [ad_conn package_id] form create new_static_element @@ -27,24 +28,28 @@ -widget textarea \ -html {rows 5 cols 60 wrap soft} -element create new_static_element instance_id \ - -label "instance_id" \ +element create new_static_element portal_id \ + -label "portal_id" \ -datatype integer \ -widget hidden \ - -value $instance_id + -value $portal_id if {[form is_valid new_static_element]} { form get_values new_static_element \ - pretty_name content instance_id + pretty_name content portal_id # insert the new content item # ad_return_complaint 1 "$pretty_name, $content, $instance_id, $referer" - set item_id [static_portal_content::new \ - -instance_id $instance_id \ - -content $content \ - -pretty_name $pretty_name] + db_transaction { + set item_id [static_portal_content::new \ + -instance_id $instance_id \ + -content $content \ + -pretty_name $pretty_name] + static_portal_content::add_to_portal -content_id $item_id -portal_id $portal_id + } + # redirect and abort ad_returnredirect $referer ad_script_abort Index: openacs-4/packages/static-portlet/www/static-admin-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-admin-portlet.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/static-portlet/www/static-admin-portlet.adp 18 Feb 2002 05:23:12 -0000 1.2 +++ openacs-4/packages/static-portlet/www/static-admin-portlet.adp 18 Feb 2002 20:23:00 -0000 1.3 @@ -10,4 +10,4 @@

-New static element +New static element Index: openacs-4/packages/static-portlet/www/static-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-admin-portlet.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/static-portlet/www/static-admin-portlet.tcl 18 Feb 2002 05:23:12 -0000 1.2 +++ openacs-4/packages/static-portlet/www/static-admin-portlet.tcl 18 Feb 2002 20:23:00 -0000 1.3 @@ -12,19 +12,10 @@ set instance_id $config(instance_id) -# aks - i forget if this is a list, so just keep this stuff here -# -#if {[llength $list_of_instance_ids] > 1} { -# # We have a problem! -# return -code error "There should be only one instance of bboard for admin purposes" -#} -# -#set instance_id [lindex $list_of_instance_ids 0] -# - db_multirow content select_content " select content_id, pretty_name from static_portal_content where instance_id = :instance_id" +set template_portal_id [dotlrn_community::get_portal_template_id [dotlrn_community::get_community_id]] # set url [dotlrn_community::get_url_from_package_id -package_id $instance_id] Index: openacs-4/packages/static-portlet/www/static-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-portlet.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/static-portlet/www/static-portlet.adp 18 Feb 2002 05:54:18 -0000 1.3 +++ openacs-4/packages/static-portlet/www/static-portlet.adp 18 Feb 2002 20:23:00 -0000 1.4 @@ -1,18 +1,11 @@ - - - @content_multi.pretty_name@ + + @pretty_name@
- @content_multi.content@ - - -


- - - - + @content@ + -
Index: openacs-4/packages/static-portlet/www/static-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-portlet.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/static-portlet/www/static-portlet.tcl 18 Feb 2002 05:23:12 -0000 1.2 +++ openacs-4/packages/static-portlet/www/static-portlet.tcl 18 Feb 2002 20:23:00 -0000 1.3 @@ -8,10 +8,13 @@ array set config $cf -set instance_id $config(instance_id) +# one piece of content only per portlet +set content_id $config(content_id) -db_multirow content_multi select_content { +if {[catch {set success_p [db_0or1row select_content { select content, pretty_name from static_portal_content - where instance_id = :instance_id -} + where content_id = :content_id +}]} errmsg]} { + set success_p 0 +}