Index: openacs-4/contrib/packages/bcms/tcl/bcms-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms/tcl/bcms-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/contrib/packages/bcms/tcl/bcms-procs.tcl 29 Oct 2003 15:03:46 -0000 1.7 +++ openacs-4/contrib/packages/bcms/tcl/bcms-procs.tcl 11 Nov 2003 15:46:26 -0000 1.8 @@ -4,7 +4,7 @@ @author Jun Yamog @creation-date 10 Aug 2002 - @cvs-id bcms-procs.tcl,v 1.2 2002/10/10 07:34:49 nsadmin Exp + @cvs-id $Id$ } namespace eval bcms {} @@ -13,127 +13,22 @@ ad_proc -public bcms::get_table_name { -object_type:required } { - returns the table name of a particular object_type + @param object_type the object_type of an object, normally the content_type since we are dealing with cms + + @returns the table name of a particular object_type } { - return [db_string get_table_name "SQL"] + return [db_string get_table_name {}] } # for possible contribution ad_proc -public bcms::get_next_objectid { } { - returns the next acs objectID sequence from the database + @returns the next acs objectID sequence from the database } { - return [db_string get_next_objectid "SQL"] + return [db_string get_next_objectid {}] } -# for possible contribution -ad_proc -public bcms::wizard_step { - {-back:boolean false} - {-set_param_list} -} { - creates the url for the wizard - - -set_param_list is a list of parameters that you would like to set in the - wizard. It must be in a form of "varname value" pairs -} { - # build the parameter list - if [info exists set_param_list] { - for {set i 0} {$i < [llength $set_param_list]} {set i [expr $i + 2]} { - template::wizard set_param [lindex $set_param_list $i] \ - [lindex $set_param_list [expr $i + 1]] - } - } - - if {$back_p} {set step_no -1} else {set step_no 1} - return [template::wizard::get_forward_url [expr [template::wizard current_step] + $step_no]] -} - - -# TODO: move this out of bcms? Since this is a UI specific requirement -ad_proc -public bcms::init_bcms { - -root_folder:required - -root_folder_label:required - {-description ""} -} { - Makes a new bcms instance. creates the root folder and default subfolders - then registers the content types, creates also an index page on the pages folder -} { - set cr_folder_root [bcms::folder::get_cr_root_folder] - - db_transaction { - - # create the root folder - set root_folder_id [bcms::folder::create_folder -name $root_folder \ - -folder_label $root_folder_label -parent_id $cr_folder_root \ - -description $description] - - # register the content types to the folders - # we register the content type to the root folder to be flexible - # even though we have created the default folders - register_content_type -folder_id $root_folder_id -content_type bcms_page - register_content_type -folder_id $root_folder_id -content_type bcms_file - - # bind this package instance to that cr_folder - # we are going to populate the root bcms package_id column only - set package_id [ad_conn package_id] - db_dml update_package_id "SQL" - - # create the default subfolders - set pages_folder_id [bcms::folder::create_folder -name "pages" \ - -folder_label "Pages" -parent_id $root_folder_id \ - -description "This folder holds web pages"] - set images_folder_id [bcms::folder::create_folder -name "images" \ - -folder_label "Images" -parent_id $root_folder_id \ - -description "This folder holds images"] - set files_folder_id [bcms::folder::create_folder -name "files" -folder_label "Files" \ - -parent_id $root_folder_id \ - -description "This folder holds files"] - - # create the index page for the folder - set item_id [bcms::item::create_item -item_name index -parent_id $pages_folder_id \ - -content_type bcms_page -storage_type text] - - # create an initial revision that is blank - set revision_id [bcms::revision::revision_create_in_text -item_id $item_id \ - -title $root_folder_label -content "" -description $description \ - -mime_type "text/html" ] - - # create the template folder - set template_folder_id [bcms::folder::create_folder -name $root_folder \ - -folder_label $root_folder_label -parent_id [bcds::get_cr_template_root] \ - -description $description] - parameter::set_value -parameter template_folder_id -value $template_folder_id - - } - ns_log notice "bcms::init created root folder id $root_folder_id" -} - - -ad_proc -public bcms::register_content_type { - -folder_id:required - -content_type:required -} { - register a content type to a folder -} { - db_exec_plsql register_content_type "SQL" -} - -ad_proc -public bcms::is_registered_content_type { - -folder_id:required - -content_type:required -} { - checks to see if a content type is registered on a folder -} { - set result [db_exec_plsql check_content_type "SQL"] - if {$result == "t"} { - return 1 - } else { - return 0 - } -} - - ad_proc -public bcms::create_page { {-page_name:required} {-folder_id:required}