Index: openacs-4/packages/static-portlet/static-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/static-portlet.info,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/static-portlet.info 15 Feb 2002 21:32:01 -0000 1.1 +++ openacs-4/packages/static-portlet/static-portlet.info 18 Feb 2002 05:23:12 -0000 1.2 @@ -1,7 +1,7 @@ - + static portlet static portlets f @@ -19,7 +19,23 @@ - + + + + + + + + + + + + + + + + + Index: openacs-4/packages/static-portlet/sql/oracle/static-core.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/sql/oracle/static-core.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/sql/oracle/static-core.sql 15 Feb 2002 21:10:44 -0000 1.1 +++ openacs-4/packages/static-portlet/sql/oracle/static-core.sql 18 Feb 2002 05:23:12 -0000 1.2 @@ -21,6 +21,9 @@ constraint static_p_c_instance_id_fk references apm_packages (package_id) on delete cascade, + pretty_name varchar2(100) + constraint static_p_c_pretty_name_nn + not null, content varchar2(4000) ); @@ -45,11 +48,11 @@ -- API -- -create or replace package static_portal_content +create or replace package static_portal_content_item as function new ( - content_id in static_portal_content.content_id%TYPE default null, instance_id in static_portal_content.instance_id%TYPE default null, + pretty_name in static_portal_content.pretty_name%TYPE default null, content in static_portal_content.content%TYPE default null, object_type in acs_objects.object_type%TYPE default 'static_portal_content', creation_date in acs_objects.creation_date%TYPE default sysdate, @@ -62,50 +65,52 @@ content_id in static_portal_content.content_id%TYPE ); -end static_portal_content; +end static_portal_content_item; / show errors -create or replace package body static_portal_content +create or replace package body static_portal_content_item as function new ( - f_instance_id in static_portal_content.instance_id%TYPE default null, - f_content in static_portal_content.content%TYPE default null, - f_object_type in acs_objects.object_type%TYPE default 'static_portal_content', - f_creation_date in acs_objects.creation_date%TYPE default sysdate, - f_creation_user in acs_objects.creation_user%TYPE default null, - f_creation_ip in acs_objects.creation_ip%TYPE default null, - f_context_id in acs_objects.context_id%TYPE default null - ) return acs_objects.object_id%TYPE; + instance_id in static_portal_content.instance_id%TYPE default null, + pretty_name in static_portal_content.pretty_name%TYPE default null, + content in static_portal_content.content%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'static_portal_content', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return acs_objects.object_id%TYPE is v_content_id static_portal_content.content_id%TYPE; begin v_content_id := acs_object.new ( - f_object_type => object_type, - f_creation_date => creation_date, - f_creation_user => creation_user, - f_creation_ip => creation_ip, - f_context_id => context_id + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id ); insert into static_portal_content - (content_id, instance_id, content) + (content_id, instance_id, pretty_name, content) values - (v_content_id, f_instance_id, f_content); + (v_content_id, new.instance_id, new.pretty_name, new.content); return v_content_id; end new; procedure delete ( - p_content_id in static_portal_content.content_id%TYPE + content_id in static_portal_content.content_id%TYPE ) is begin - delete from static_portal_content where content_id = p_content_id; - acs_object.delete(p_content_id); + delete from static_portal_content where content_id = content_id; + + acs_object.delete(content_id); end delete; -end static_portal_content; +end static_portal_content_item; / show errors Index: openacs-4/packages/static-portlet/tcl/static-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-admin-portlet-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/tcl/static-admin-portlet-procs.tcl 15 Feb 2002 21:10:44 -0000 1.1 +++ openacs-4/packages/static-portlet/tcl/static-admin-portlet-procs.tcl 18 Feb 2002 05:23:12 -0000 1.2 @@ -20,7 +20,7 @@ ad_proc -public get_pretty_name { } { - return "Static Data Administration FIXME better name?" + return "Static Element Administration" } ad_proc -private my_package_key { 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 18 Feb 2002 05:23:12 -0000 1.1 @@ -0,0 +1,98 @@ +# /packages/static-portlet/tcl/static-portal-content-procs.tcl +ad_library { + +The procs for manipulating static portal content. Akin to the "bboard" +package being included in it's own "bboard-portlet" package + +Copyright Openforce, Inc. +Licensed under GNU GPL v2 + +@author arjun@openforce.net +@cvs-id $Id: static-portal-content-procs.tcl,v 1.1 2002/02/18 05:23:12 arjun Exp $ + +} + +namespace eval static_portal_content { + + ad_proc -public new { + {-instance_id:required} + {-content:required} + {-pretty_name:required} + } { + 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; + }] + } + + ad_proc -public update { + {-content_id:required} + {-content:required} + {-pretty_name:required} + } { + updates the content item + } { + return [db_dml update_content_item { + update static_portal_content set + content = :content, pretty_name = :pretty_name + where content_id = :content_id + }] + } + + + 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 { + {-content_id:required} + } { + Get the pretty_name of the item + } { + return [db_string get_pretty_name.select { + select pretty_name + from static_portal_content + where content_id = :content_id + }] + } + + 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 + where content_id = :content_id + }] + } + + ad_proc -public get_instance_id { + {-content_id:required} + } { + Get the instance_id of the item + } { + return [db_string get_instance_id.select { + select instance_id + from static_portal_content + where content_id = :content_id + }] + } + +} Index: openacs-4/packages/static-portlet/tcl/static-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-portlet-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/static-portlet/tcl/static-portlet-procs.tcl 15 Feb 2002 21:10:44 -0000 1.1 +++ openacs-4/packages/static-portlet/tcl/static-portlet-procs.tcl 18 Feb 2002 05:23:12 -0000 1.2 @@ -20,7 +20,7 @@ ad_proc -public get_pretty_name { } { - return "FIXME maybe NULL?" + return "" } ad_proc -private my_package_key { @@ -58,6 +58,7 @@ } { Display the PE } { + portal::show_proc_helper \ -package_key [my_package_key] \ -config_list $cf \ Index: openacs-4/packages/static-portlet/www/element-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/element-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/static-portlet/www/element-delete.tcl 18 Feb 2002 05:23:12 -0000 1.1 @@ -0,0 +1,19 @@ +ad_page_contract { + delete a static element + + @author arjun (arjun@openforce) + @cvs_id $Id: element-delete.tcl,v 1.1 2002/02/18 05:23:12 arjun Exp $ +} -query { + {content_id ""} + {referer "../one-community-admin"} +} -properties { + title:onevalue +} + + +# do the deed +static_portal_content::delete -content_id $content_id + +# redirect and abort +ad_returnredirect $referer +ad_script_abort Index: openacs-4/packages/static-portlet/www/element-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/Attic/element-new.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/static-portlet/www/element-new.adp 18 Feb 2002 05:23:12 -0000 1.1 @@ -0,0 +1,6 @@ + +@title@ + +Create a new static element: + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/static-portlet/www/element-new.tcl 18 Feb 2002 05:23:12 -0000 1.1 @@ -0,0 +1,51 @@ +ad_page_contract { + create a new static content item + + @author arjun@openforce.net + @creation-date 2001-12-03 + @version $Id: element-new.tcl,v 1.1 2002/02/18 05:23:12 arjun Exp $ +} -query { + {referer "../one-community-admin"} + {instance_id ""} +} -properties { + title:onevalue +} + +set title "New static element" + +form create new_static_element + +element create new_static_element pretty_name \ + -label "Name" \ + -datatype text \ + -widget text \ + -html {size 60} + +element create new_static_element content \ + -label "Content" \ + -datatype text \ + -widget textarea \ + -html {rows 5 cols 60 wrap soft} + +element create new_static_element instance_id \ + -label "instance_id" \ + -datatype integer \ + -widget hidden \ + -value $instance_id + +if {[form is_valid new_static_element]} { + form get_values new_static_element \ + pretty_name content instance_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] + + # redirect and abort + ad_returnredirect $referer + ad_script_abort +} Index: openacs-4/packages/static-portlet/www/element.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/element.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/static-portlet/www/element.adp 18 Feb 2002 05:23:12 -0000 1.1 @@ -0,0 +1,6 @@ + +@title@ + +Edit this element: + + Index: openacs-4/packages/static-portlet/www/element.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/element.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/static-portlet/www/element.tcl 18 Feb 2002 05:23:12 -0000 1.1 @@ -0,0 +1,56 @@ +ad_page_contract { + edit a static element + + @author arjun (arjun@openforce) + @cvs_id $Id: element.tcl,v 1.1 2002/02/18 05:23:12 arjun Exp $ +} -query { + {content_id ""} + {referer "../one-community-admin"} +} -properties { + title:onevalue +} + +set title "Edit content element" + +db_1row get_content_element { + select content, pretty_name + from static_portal_content + where content_id = :content_id +} + +form create static_element + +element create static_element pretty_name \ + -label "Name" \ + -datatype text \ + -widget text \ + -html {size 60} \ + -value $pretty_name + +element create static_element content \ + -label "Content" \ + -datatype text \ + -widget textarea \ + -html {rows 5 cols 60 wrap soft} \ + -value $content + +element create static_element content_id \ + -label "content_id" \ + -datatype integer \ + -widget hidden \ + -value $content_id + +if {[form is_valid static_element]} { + form get_values static_element \ + pretty_name content content_id + + + static_portal_content::update \ + -content_id $content_id \ + -pretty_name $pretty_name \ + -content $content + + # 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.1 -r1.2 --- openacs-4/packages/static-portlet/www/static-admin-portlet.adp 15 Feb 2002 21:10:44 -0000 1.1 +++ openacs-4/packages/static-portlet/www/static-admin-portlet.adp 18 Feb 2002 05:23:12 -0000 1.2 @@ -4,9 +4,10 @@

-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.1 -r1.2 --- openacs-4/packages/static-portlet/www/static-admin-portlet.tcl 15 Feb 2002 21:10:44 -0000 1.1 +++ openacs-4/packages/static-portlet/www/static-admin-portlet.tcl 18 Feb 2002 05:23:12 -0000 1.2 @@ -23,8 +23,8 @@ # db_multirow content select_content " -select content_id, short_name -from dotlrn_static_content +select content_id, pretty_name +from static_portal_content where instance_id = :instance_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.1 -r1.2 --- openacs-4/packages/static-portlet/www/static-portlet.adp 15 Feb 2002 21:10:44 -0000 1.1 +++ openacs-4/packages/static-portlet/www/static-portlet.adp 18 Feb 2002 05:23:12 -0000 1.2 @@ -1 +1,13 @@ -aks FIXME here's the content: @content@ + + + @content_multi.pretty_name@ +
+ @content_multi.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.1 -r1.2 --- openacs-4/packages/static-portlet/www/static-portlet.tcl 15 Feb 2002 21:10:44 -0000 1.1 +++ openacs-4/packages/static-portlet/www/static-portlet.tcl 18 Feb 2002 05:23:12 -0000 1.2 @@ -8,12 +8,10 @@ array set config $cf -# aks FIXME testing +set instance_id $config(instance_id) -set query " -select content -from dotlrn_static_content -where instance_id = :instance_id)" - -# aks - maybe a list, i forget -set list_of_instance_ids $config(instance_id) +db_multirow content_multi select_content { + select content, pretty_name + from static_portal_content + where instance_id = :instance_id +}