Index: openacs-4/contrib/packages/bcms/tcl/bcms-folder-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms/tcl/bcms-folder-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/contrib/packages/bcms/tcl/bcms-folder-procs.tcl 30 Oct 2003 15:08:11 -0000 1.11 +++ openacs-4/contrib/packages/bcms/tcl/bcms-folder-procs.tcl 13 Nov 2003 14:24:38 -0000 1.12 @@ -17,7 +17,7 @@ @return the folder_id of cr_folder's Pages root } { - return [db_string get_cr_root_folder "SQL"] + return [db_string get_cr_root_folder {}] } @@ -107,7 +107,7 @@ it returns 0 } { # TODO: test of we are catching the error message - if [catch {db_exec_plsql delete_folder "SQL"} folder_id] { + if [catch {db_exec_plsql delete_folder {}} folder_id] { ns_log warning "bcms::folder::delete_folder unable to delete $folder_id" return 0 } else { @@ -142,11 +142,11 @@ if {[llength $update_list] > 0} { set update_string [join $update_list ","] - db_dml edit_folder "SQL" + db_dml edit_folder {} } if [info exists label] { - db_dml edit_folder_label "SQL" + db_dml edit_folder_label {} } ns_log notice "bcms::folder::set_folder updated $folder_id" } @@ -163,39 +163,15 @@ parent_id, name, label, description, has_child_folders, has_child_symlinks, package_id if no folder is found a blank array is returned } { - if {[db_0or1row get_1folder "SQL" -column_array one_folder]} { + if {[db_0or1row get_1folder {} -column_array one_folder]} { return [array get one_folder] } else { return {} } } -# TODO: to be removed not a general proc -ad_proc -public bcms::folder::get_image_folder { } { - returns the folder_id of the image folder of this bcms instance -} { - array set one_item [bcms::item::get_item_by_url -root_id [get_bcms_root_folder] -url images -resolve_index false] - return $one_item(item_id) -} -# TODO: to be removed not a general proc -ad_proc -public bcms::folder::get_file_folder { } { - returns the folder_id of the file folder of this bcms instance -} { - array set one_item [bcms::item::get_item_by_url -root_id [get_bcms_root_folder] -url files -resolve_index false] - return $one_item(item_id) -} - -# TODO: to be removed not a general proc -ad_proc -public bcms::folder::get_page_folder { } { - returns the folder_id of the page folder of this bcms instance -} { - array set one_item [bcms::item::get_item_by_url -root_id [get_bcms_root_folder] -url pages -resolve_index false] - return $one_item(item_id) -} - - ad_proc -public bcms::folder::list_folders { {-parent_id} {-multirow_name bcms_list_folders} @@ -220,10 +196,10 @@ if $return_list_p { # return a list of lists - return [db_list_of_ns_sets get_cr_folders "SQL"] + return [db_list_of_ns_sets get_cr_folders {}] } else { # make a multirow - db_multirow $multirow_name get_cr_folders "SQL" + db_multirow $multirow_name get_cr_folders {} } } @@ -266,10 +242,10 @@ if $return_list_p { # return a list of lists - return [db_list_of_ns_sets get_cr_folders "SQL"] + return [db_list_of_ns_sets get_cr_folders {}] } else { # make a multirow - db_multirow $multirow_name get_cr_folders "SQL" + db_multirow $multirow_name get_cr_folders {} } } @@ -290,7 +266,25 @@ } } +ad_proc -public bcms::folder::is_registered_content_type { + {-folder_id:required} + {-content_type:required} +} { + checks to see if a content type is registered on a folder + @param folder_id id of the folder to check + @param content_type content type to check if its registered on not + + @returns 1 if its registered if not 0 +} { + set result [db_exec_plsql check_content_type {}] + if {$result == "t"} { + return 1 + } else { + return 0 + } +} + ad_proc -public bcms::folder::get_id_by_package_id { {-package_id ""} {-parent_id ""} @@ -304,15 +298,8 @@ } if { [empty_string_p $parent_id] } { - return [db_string select_folder_id { select folder_id from cr_folders where package_id = :package_id } -default {}] + return [db_string select_folder_id {} -default {}] } else { - return [db_string select_folder_id_with_parent_id { - select f.folder_id - from cr_folders f, - cr_items i - where f.package_id = :package_id - and i.item_id = f.folder_id - and i.parent_id = :parent_id - } -default {}] + return [db_string select_folder_id_with_parent_id {} -default {}] } }