Index: openacs-4/contrib/packages/bcms-ui-wizard/www/TODO.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms-ui-wizard/www/TODO.txt,v diff -u -N -r1.2 -r1.3 --- openacs-4/contrib/packages/bcms-ui-wizard/www/TODO.txt 27 Aug 2003 17:34:33 -0000 1.2 +++ openacs-4/contrib/packages/bcms-ui-wizard/www/TODO.txt 11 Nov 2003 16:42:45 -0000 1.3 @@ -51,3 +51,176 @@ - change bcms::revision::revision_list to bcms::revision::list_revisions - added several new procs - depracated bcms::folder::get_bcms_root_folder + + + +procs that are moved out of bcms + + +# 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" +} + + + +# TODO move this out, this is too specific +ad_proc -public bcms::item::list_pages { + {-parent_id:required} + {-revision latest} + {-multirow_name} + {-return_list:boolean false} +} { + returns a list of pages under the parent_id. it also gets the latest + or live pages with index name on the folder under parent_id. if revision + is not specified then we will just get the folder label + + returns item_id, name, publish_status, content_type, storage_type, title + + TODO: will need to merge this with list_items + I think we really need to rethink what this proc really want to do, + confusing proc, gets pages and folders, get live... latest etc. +} { + switch -exact $revision { + latest { + set addtnl_select ", bcms__get_title(i.item_id, 'latest') as title, content_folder__get_label(i.item_id) as folder_label" + } + live { + set addtnl_select ", bcms__get_title(i.item_id, 'live') as title, content_folder__get_label(i.item_id) as folder_label" + } + default { + ns_log debug "bcms: revision requested not valid" + return + } + } + + 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 get_pages "SQL"] + } else { + # make a multirow, it is likely that this proc is not being called from another proc + if ![info exists multirow_name] { set multirow_name bcms_list_pages } + db_multirow $multirow_name get_pages "SQL" + } + +} + + +# TODO move this out, this is too specific +ad_proc -public bcms::item::list_images { + {-parent_id:required} + {-live_items:boolean false} + {-level_diff 0} + {-multirow_name} + {-return_list:boolean false} +} { + list the images related to a content item which is the parent_id +} { + if {$return_list_p} { + # return a list of lists since its not easy to pass multirow from proc to proc + return [list_items -parent_id $parent_id -content_type image -level_diff $level_diff -return_list] + } else { + # make a multirow, it is likely that this proc is not being called from another proc + if ![info exists multirow_name] { set multirow_name bcms_list_images } + list_items -parent_id $parent_id -content_type image -level_diff $level_diff -multirow_name $multirow_name + } + +} + +# TODO move this out, this is too specific +ad_proc -public bcms::item::list_files { + {-parent_id:required} + {-live_items:boolean false} + {-level_diff 0} + {-multirow_name} + {-return_list:boolean false} +} { + list the files related to a content item which is the parent_id +} { + if {$return_list_p} { + # return a list of lists since its not easy to pass multirow from proc to proc + return [list_items -parent_id $parent_id -content_type bcms_file -level_diff $level_diff -return_list] + } else { + # make a multirow, it is likely that this proc is not being called from another proc + if ![info exists multirow_name] { set multirow_name bcms_list_files } + list_items -parent_id $parent_id -content_type bcms_file -level_diff $level_diff -multirow_name $multirow_name + } + +}