Index: openacs-4/contrib/packages/bcms/tcl/bcms-template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms/tcl/bcms-template-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/bcms/tcl/bcms-template-procs.tcl 27 Aug 2003 17:23:27 -0000 1.2 +++ openacs-4/contrib/packages/bcms/tcl/bcms-template-procs.tcl 13 Nov 2003 15:12:37 -0000 1.3 @@ -13,11 +13,18 @@ {-creation_ip} } { This proc creates a template and returns the item_id of the new template + + @param template_name name of the template + @param parent_id folder id of where to store the template + @param creation_user_id user_id creating this item + @param creation_user_ip ip address which this item is created + + @returns the item_id of the new template } { if {![info exists creation_user_id]} { set creation_user_id [ad_conn user_id] } if {![info exists creation_ip]} { set creation_ip [ad_conn peeraddr] } - set item_id [db_exec_plsql create_template "SQL"] + set item_id [db_exec_plsql create_template {}] return $item_id } @@ -30,11 +37,24 @@ {-creation_ip} } { adds a template revision + + @param template_id item id of the template you want to add a new revision to + @param title title of the template + @param description description of the template + @param content content of the template + @param creation_user_id user_id creating this item + @param creation_user_ip ip address which this item is created + + @returns the revision_id of the new template revision + } { if {![info exists creation_user_id]} { set creation_user_id [ad_conn user_id] } if {![info exists creation_ip]} { set creation_ip [ad_conn peeraddr] } - set revision_id [db_exec_plsql add_template "SQL"] + set revision_id [bcms::revision::add_revision -item_id $template_id -title $title \ + -mime_type "text/html" -description $description \ + -content $content -creation_user_id $creation_user_id \ + -creation_user_ip $creation_user_ip] return $revision_id } @@ -70,10 +90,10 @@ if {$return_list_p} { # return a list of lists since its not easy to pass multirow from proc to proc - return [db_list_of_ns_sets list_templates "SQL"] + return [db_list_of_ns_sets list_templates {}] } else { # make a multirow, it is likely that this proc is not being called from another proc - db_multirow $multirow_name list_templates "SQL" + db_multirow $multirow_name list_templates {} } } @@ -83,15 +103,19 @@ {-template_id:required} } { Delete a template + + @param template_id item id of the template that will be deleted } { - return [db_exec_plsql delete_template "SQL"] + return [db_exec_plsql delete_template {}] } # for possible contribution ad_proc -public bcms::template::get_cr_root_template_folder {} { gets the folder_id of the template root of cr + + @returns the folder id of the root CR template } { - set template_root [db_exec_plsql get_template_root "SQL"] + set template_root [db_exec_plsql get_template_root {}] return $template_root } @@ -102,13 +126,17 @@ } { applies a template to a content item with the context given or the current context of BCDS + + @param item_id item you want to apply a template + @param template_id the template you want to use for the item + @param context context of which the template is used } { if ![info exists context] { set context [parameter::get -parameter context] } - db_exec_plsql apply_template "SQL" + db_exec_plsql apply_template {} } @@ -118,23 +146,33 @@ {-context ""} } { unregister a template for a item_id + + @param item_id item you want to remove a template + @param template_id the template you want to unregister + @param context context of which the template } { - db_exec_plsql unregister_template "SQL" + db_exec_plsql unregister_template {} } ad_proc -public bcms::template::get_template { {-item_id:required} {-context} } { gets the template of the content item on the context specified + + @param item_id item you want to get a template + @param context the context of the template + + @returns an array that contains properties of the template, if no + template is found it returns a blank array. } { if ![info exists context] { - set context [parameter::get -parameter context] + set context [parameter::get -parameter context] } - if {[db_0or1row get_template "SQL" -column_array one_template]} { - return [array get one_template] + if {[db_0or1row get_template {} -column_array one_template]} { + return [array get one_template] } else { - return {} + return {} } }