Index: openacs-4/packages/acs-content-repository/tcl/filter-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/filter-procs-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-content-repository/tcl/filter-procs-oracle.xql 14 Sep 2001 04:53:02 -0000 1.3 +++ openacs-4/packages/acs-content-repository/tcl/filter-procs-oracle.xql 21 Sep 2001 05:01:38 -0000 1.4 @@ -32,6 +32,30 @@ + + + + begin + content_revision.to_temporary_clob(:revision_id); + end; + + + + + + + + select + content + from + cr_content_text + where + revision_id = :revision_id + + + + + @@ -62,6 +86,7 @@ select + (select live_revision from cr_items where item_id = content_item.get_template(:item_id, :context)) as template_id, content_template.get_path( content_item.get_template(:item_id, :context),:template_root) as template_url from Index: openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql 14 Sep 2001 04:53:02 -0000 1.4 +++ openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql 21 Sep 2001 05:01:38 -0000 1.5 @@ -33,6 +33,28 @@ + + + + select 1 + + + + + + + + select + content + from + cr_revisions + where + revision_id = :revision_id + + + + + @@ -63,6 +85,7 @@ select + (select live_revision from cr_items where item_id = content_item__get_template(:item_id, :context)) as template_id, content_template__get_path( content_item__get_template(:item_id, :context),:template_root) as template_url from Index: openacs-4/packages/acs-content-repository/tcl/filter-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/filter-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-content-repository/tcl/filter-procs.tcl 14 Sep 2001 04:53:02 -0000 1.6 +++ openacs-4/packages/acs-content-repository/tcl/filter-procs.tcl 21 Sep 2001 05:01:38 -0000 1.7 @@ -189,7 +189,31 @@ } } +ad_proc -public get_content_value { revision_id } { + db_transaction { + db_exec_plsql gcv_get_revision_id { + begin + content_revision.to_temporary_clob(:revision_id); + end; + } + + # Query for values from a previous revision + + template::query gcv_get_previous_content content onevalue " + select + content + from + cr_content_text + where + revision_id = :revision_id" + + } + + return $content +} + + ad_proc -public init { urlvar rootvar {content_root ""} {template_root ""} {context "public"} {rev_id ""}} { upvar $urlvar url $rootvar root_path @@ -261,24 +285,37 @@ :template_root) as template_url from dual" - set query "select + template::query get_template_url info onerow "select + (select live_revision + from cr_items + where item_id = content_item.get_template(:item_id, :context)) as template_id, content_template.get_path( content_item.get_template(:item_id, :context), :template_root) as template_url from dual" - template::query get_template_url template_url onevalue $query - - if { [string equal $template_url {}] } { + if { [string equal $info(template_url) {}] } { ns_log Notice "No template found to render content item $item_id in context '$context'" return 0 } - set url $template_url + set url $info(template_url) set root_path [get_template_root] + # Added so that published templates are regenerated if they are missing. + # This is useful for default templates. + # (OpenACS - DanW, dcwickstrom@earthlink.net) + + set file ${root_path}/${url}.adp + if ![file exists $file] { + + file mkdir [file dirname $file] + set text [content::get_content_value $info(template_id)] + template::util::write_file $file $text + } + return 1 } Index: openacs-4/packages/cms/tcl/form-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs-oracle.xql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/cms/tcl/form-procs-oracle.xql 2 Sep 2001 12:26:05 -0000 1.12 +++ openacs-4/packages/cms/tcl/form-procs-oracle.xql 21 Sep 2001 05:01:38 -0000 1.13 @@ -257,16 +257,6 @@ - - - - begin - content_revision.to_temporary_clob(:revision_id); - end; - - - - Index: openacs-4/packages/cms/tcl/form-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs-postgresql.xql,v diff -u -r1.15 -r1.16 --- openacs-4/packages/cms/tcl/form-procs-postgresql.xql 19 Sep 2001 00:54:22 -0000 1.15 +++ openacs-4/packages/cms/tcl/form-procs-postgresql.xql 21 Sep 2001 05:01:38 -0000 1.16 @@ -304,27 +304,7 @@ - - - select 1 - - - - - - - - select - content - from - cr_revisions - where - revision_id = :revision_id - - - - Index: openacs-4/packages/cms/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/cms/tcl/form-procs.tcl 2 Sep 2001 12:26:05 -0000 1.16 +++ openacs-4/packages/cms/tcl/form-procs.tcl 21 Sep 2001 05:01:38 -0000 1.17 @@ -1813,31 +1813,7 @@ return [db_string nextval "select acs_object_id_seq.nextval from dual"] } -ad_proc -public content::get_content_value { revision_id } { - db_transaction { - db_exec_plsql gcv_get_revision_id { - begin - content_revision.to_temporary_clob(:revision_id); - end; - } - - # Query for values from a previous revision - - template::query gcv_get_previous_content content onevalue " - select - content - from - cr_content_text - where - revision_id = :revision_id" - - } - - return $content -} - - ad_proc -private content::get_attributes { content_type args } { @private get_attributes Index: openacs-4/packages/cms/tcl/form-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/cms/tcl/form-procs.xql 17 Aug 2001 23:33:53 -0000 1.7 +++ openacs-4/packages/cms/tcl/form-procs.xql 21 Sep 2001 05:01:38 -0000 1.8 @@ -201,19 +201,7 @@ - - - select - content - from - cr_content_text - where - revision_id = :revision_id - - - -