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.13.2.3 -r1.13.2.3.4.1 --- openacs-4/packages/static-portlet/static-portlet.info 3 Apr 2004 04:04:08 -0000 1.13.2.3 +++ openacs-4/packages/static-portlet/static-portlet.info 22 Jun 2004 19:28:48 -0000 1.13.2.3.4.1 @@ -7,12 +7,12 @@ f f - + OpenACS 2004-03-10 OpenACS - + Index: openacs-4/packages/static-portlet/catalog/static-portlet.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/catalog/static-portlet.en_US.ISO-8859-1.xml,v diff -u -r1.12.6.1 -r1.12.6.2 --- openacs-4/packages/static-portlet/catalog/static-portlet.en_US.ISO-8859-1.xml 4 May 2004 13:42:36 -0000 1.12.6.1 +++ openacs-4/packages/static-portlet/catalog/static-portlet.en_US.ISO-8859-1.xml 22 Jun 2004 19:28:49 -0000 1.12.6.2 @@ -3,14 +3,21 @@ Custom Portlet Custom Portlet Administration + Binary file %filename% was uploaded, but we only support text files here. Content Control Panel + Create a new %element_pretty_name% + Edit Edit content element + File Delete %element_pretty_name% %pretty_name% Editing %element_pretty_name% %pretty_name% <strong>Note</strong>: You can use plain text or HTML in the Content area. Use this form to create a new %element_pretty_name%. The %element_pretty_name% will be created and automatically placed on the first page of %portal_name% portal. Goto the %control_panel_text% and select Customize Layout to move this %element_pretty_name%. Name New New %element_pretty_name% + Use this form to create a new %element_pretty_name%. The %element_pretty_name% +will be created and automatically placed on the first page of %portal_name% portal. Go to the administration page and select Customize Layout to move this %element_pretty_name%. + Or, You may upload a <strong>text</strong> file here, the contents of which will replace the current contents of the portlet. 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.7 -r1.7.6.1 --- openacs-4/packages/static-portlet/sql/oracle/static-core.sql 30 Sep 2003 13:11:41 -0000 1.7 +++ openacs-4/packages/static-portlet/sql/oracle/static-core.sql 22 Jun 2004 19:28:49 -0000 1.7.6.1 @@ -37,7 +37,7 @@ pretty_name varchar2(100) constraint static_p_c_pretty_name_nn not null, - content varchar2(4000) + body clob ); @@ -61,12 +61,15 @@ -- API -- +-- content is still a varchar, even though it is being used to put content +-- into body, a clob, because a varchar is what's being passed in from the +-- Tcl script. create or replace package static_portal_content_item as function new ( package_id in static_portal_content.package_id%TYPE default null, pretty_name in static_portal_content.pretty_name%TYPE default null, - content in static_portal_content.content%TYPE default null, + content in varchar 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, @@ -87,7 +90,7 @@ function new ( package_id in static_portal_content.package_id%TYPE default null, pretty_name in static_portal_content.pretty_name%TYPE default null, - content in static_portal_content.content%TYPE default null, + content in varchar 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, @@ -106,7 +109,7 @@ ); insert into static_portal_content - (content_id, package_id, pretty_name, content) + (content_id, package_id, pretty_name, body) values (v_content_id, new.package_id, new.pretty_name, new.content); Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/static-portlet/sql/oracle/upgrade/upgrade-2.0.3d1-2.0.3d2.sql'. Fisheye: No comparison available. Pass `N' to diff? 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.4 -r1.4.6.1 --- openacs-4/packages/static-portlet/sql/postgresql/static-core.sql 29 May 2003 18:05:59 -0000 1.4 +++ openacs-4/packages/static-portlet/sql/postgresql/static-core.sql 22 Jun 2004 19:28:49 -0000 1.4.6.1 @@ -70,7 +70,7 @@ pretty_name varchar(100) constraint static_p_c_pretty_name_nn not null, - content varchar(4000) + body text ); @@ -139,7 +139,7 @@ insert into static_portal_content - (content_id, package_id, pretty_name, content) + (content_id, package_id, pretty_name, body) values (v_content_id, p_package_id, p_pretty_name, p_content); 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.2 -r1.2.10.1 --- openacs-4/packages/static-portlet/tcl/static-portal-content-procs.xql 23 Jul 2002 13:40:45 -0000 1.2 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs.xql 22 Jun 2004 19:28:49 -0000 1.2.10.1 @@ -24,7 +24,7 @@ update static_portal_content set - content = :content, pretty_name = :pretty_name + body = :content, pretty_name = :pretty_name where content_id = :content_id @@ -45,4 +45,12 @@ + + + select body + from static_portal_content + where content_id = :content_id + + + Fisheye: Tag 1.7.6.1 refers to a dead (removed) revision in file `openacs-4/packages/static-portlet/www/element-new.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.13.6.1 refers to a dead (removed) revision in file `openacs-4/packages/static-portlet/www/element-new.tcl'. Fisheye: No comparison available. Pass `N' to diff? 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 -r1.7 -r1.7.6.1 --- openacs-4/packages/static-portlet/www/element.adp 10 Nov 2002 17:44:39 -0000 1.7 +++ openacs-4/packages/static-portlet/www/element.adp 22 Jun 2004 19:28:49 -0000 1.7.6.1 @@ -21,17 +21,39 @@ @title@ + +#static-portlet.Create_a_new# + + #static-portlet.lt_Editing_element_prett# +

+ [#static-portlet.lt_Delete_element_pretty#]

#static-portlet.lt_strongNotestrong_You_# + + +#static-portlet.Use_this_form# + +

+ +#static-portlet.lt_strongNotestrong_You_#

+ +

+ +

+#static-portlet.You_may_upload# +

+ + + 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 -r1.10.2.1 -r1.10.2.1.4.1 --- openacs-4/packages/static-portlet/www/element.tcl 11 Feb 2004 16:06:51 -0000 1.10.2.1 +++ openacs-4/packages/static-portlet/www/element.tcl 22 Jun 2004 19:28:49 -0000 1.10.2.1.4.1 @@ -20,81 +20,126 @@ @author arjun (arjun@openforce) @cvs_id $Id$ } -query { - {content_id ""} + content_id:optional referer:notnull portal_id:integer,notnull + {package_id:integer ""} } -properties { title:onevalue } -set title "[_ static-portlet.Edit_content_element]" set element_pretty_name [parameter::get -localize -parameter static_admin_portlet_element_pretty_name] - -db_1row get_content_element { - select content, pretty_name - from static_portal_content - where content_id = :content_id +if { ![exists_and_not_null content_id] || [ad_form_new_p -key content_id] } { + set title "[_ static-portlet.New] $element_pretty_name" + set new_p 1 +} else { + set title "[_ static-portlet.Edit] $element_pretty_name" + set new_p 0 } -set class_instances_pretty_name [_ dotlrn.class_instances_pretty_name] -set org_pretty_name $pretty_name -set pretty_name [lang::util::localize $org_pretty_name] +set community_id $package_id +set portal_name [portal::get_name $portal_id] -form create static_element +ad_form -name static_element -form { + content_id:key + {pretty_name:text(text) {label "[_ static-portlet.Name]"} {html {size 60}}} + {content:text(textarea) {label "[_ static-portlet.Content]"} {html {rows 15 cols 80 wrap soft}}} + {portal_id:text(hidden) {value $portal_id}} + {package_id:text(hidden) {value $package_id}} + {referer:text(hidden) {value $referer}} +} -new_data { + db_transaction { + set item_id [static_portal_content::new \ + -package_id $package_id \ + -content $content \ + -pretty_name $pretty_name + ] -element create static_element pretty_name \ - -label "[_ static-portlet.Name]" \ - -datatype text \ - -widget text \ - -html {size 60} \ - -value $pretty_name + static_portal_content::add_to_portal \ + -portal_id $portal_id \ + -package_id $package_id \ + -content_id $item_id + } -element create static_element content \ - -label "[_ static-portlet.Content]" \ - -datatype text \ - -widget textarea \ - -html {rows 15 cols 80 wrap soft} \ - -value $content + # redirect and abort + ad_returnredirect $referer + ad_script_abort +} -edit_request { + db_1row get_content_element "" + ad_set_form_values pretty_name +} -edit_data { + db_transaction { + static_portal_content::update \ + -portal_id $portal_id \ + -content_id $content_id \ + -pretty_name $pretty_name \ + -content $content + } -element create static_element content_id \ - -label "content_id" \ - -datatype integer \ - -widget hidden \ - -value $content_id + # redirect and abort + ad_returnredirect $referer + ad_script_abort +} -element create static_element portal_id \ - -label "portal_id" \ - -datatype integer \ - -widget hidden \ - -value $portal_id -element create static_element referer \ - -label "referer" \ - -datatype text \ - -widget hidden \ - -value $referer +ad_form -name static_file -html {enctype multipart/form-data} -form { + content_id:key + {pretty_name:text(text) {label "[_ static-portlet.Name]"} {html {size 60}}} + {upload_file:file {label "[_ static-portlet.File]"}} + {portal_id:text(hidden) {value $portal_id}} + {package_id:text(hidden) {value $package_id}} + {referer:text(hidden) {value $referer}} +} -new_data { + set filename [template::util::file::get_property filename $upload_file] + set tmp_filename [template::util::file::get_property tmp_filename $upload_file] + set mime_type [template::util::file::get_property mime_type $upload_file] + if { [string equal -length 4 "text" $mime_type] || [string length $mime_type] == 0 } { + # it's a text file, we can do something with this + set fd [open $tmp_filename "r"] + set content [read $fd] + close $fd + } else { + # they probably wanted to attach this file, but we can't do that. + set content [_ static-portlet.Binary_file_uploaded] + } -if {[form is_valid static_element]} { - form get_values static_element \ - pretty_name content content_id portal_id referer + db_transaction { + set item_id [static_portal_content::new \ + -package_id $package_id \ + -content $content \ + -pretty_name $pretty_name + ] + static_portal_content::add_to_portal \ + -portal_id $portal_id \ + -package_id $package_id \ + -content_id $item_id + } - # They didn't change the pretty-name, so use the original version - # The reason is that we show the pretty-name in localized form, - # but behind the scenes it contains a message key. We don't want to loose that message key - # unless we have to - if { [string equal $pretty_name [lang::util::localize $org_pretty_name]] } { - set pretty_name $org_pretty_name + # redirect and abort + ad_returnredirect $referer + ad_script_abort +} -edit_request { + db_1row get_content_element "" + ad_set_form_values pretty_name +} -edit_data { + set filename [template::util::file::get_property filename $upload_file] + set tmp_filename [template::util::file::get_property tmp_filename $upload_file] + set mime_type [template::util::file::get_property mime_type $upload_file] + if { [string equal -length 4 "text" $mime_type] || [string length $mime_type] == 0 } { + # it's a text file, we can do something with this + set fd [open $tmp_filename "r"] + set content [read $fd] + close $fd + } else { + # they probably wanted to attach this file, but we can't do that. + set content [_ static-portlet.Binary_file_uploaded] } - db_transaction { static_portal_content::update \ - -portal_id $portal_id \ + -portal_id $portal_id \ -content_id $content_id \ -pretty_name $pretty_name \ -content $content - - # Must update portal element title - # db_dml update_element_pretty_name "update portal_element_map set pretty_name= :pretty_name where element_id= :element_id" } # redirect and abort Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/static-portlet/www/element.xql'. Fisheye: No comparison available. Pass `N' to diff? 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.14 -r1.14.6.1 --- openacs-4/packages/static-portlet/www/static-admin-portlet.adp 29 May 2003 18:05:59 -0000 1.14 +++ openacs-4/packages/static-portlet/www/static-admin-portlet.adp 22 Jun 2004 19:28:49 -0000 1.14.6.1 @@ -30,7 +30,7 @@

  • - #static-portlet.new_static_admin_portlet# + #static-portlet.new_static_admin_portlet#
  • 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.6.6.1 -r1.6.6.1.4.1 --- openacs-4/packages/static-portlet/www/static-portlet.tcl 11 Feb 2004 16:06:51 -0000 1.6.6.1 +++ openacs-4/packages/static-portlet/www/static-portlet.tcl 22 Jun 2004 19:28:49 -0000 1.6.6.1.4.1 @@ -30,7 +30,7 @@ set success_p 0 set success_p [db_0or1row select_content { - select content, pretty_name + select body as content, pretty_name from static_portal_content where content_id = :content_id }]