Index: openacs-4/contrib/packages/bcms/tcl/bcms-category-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms/tcl/bcms-category-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/bcms/tcl/bcms-category-procs.tcl 30 Oct 2003 15:08:11 -0000 1.6 +++ openacs-4/contrib/packages/bcms/tcl/bcms-category-procs.tcl 13 Nov 2003 14:24:38 -0000 1.7 @@ -29,7 +29,7 @@ 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] } - return [db_exec_plsql create_category "SQL"] + return [db_exec_plsql create_category {}] } @@ -48,11 +48,11 @@ } { if {[info exists heading]} { - db_dml set_heading "SQL" + db_dml set_heading {} } if {[info exists description]} { - db_dml set_description "SQL" + db_dml set_description {} } } @@ -84,7 +84,7 @@ } { - if {[db_0or1row get_category "SQL" -column_array category]} { + if {[db_0or1row get_category {} -column_array category]} { return [array get category] } else { return {} @@ -120,10 +120,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 get_categories "SQL"] + return [db_list_of_ns_sets get_categories {}] } else { # make a multirow, it is likely that this proc is not being called from another proc - db_multirow $multirow_name get_categories "SQL" + db_multirow $multirow_name get_categories {} } } @@ -148,10 +148,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 get_categories "SQL"] + return [db_list_of_ns_sets get_categories {}] } else { # make a multirow, it is likely that this proc is not being called from another proc - db_multirow $multirow_name get_categories "SQL" + db_multirow $multirow_name get_categories {} } } @@ -189,9 +189,9 @@ } if {$return_list_p} { - return [db_list_of_ns_sets get_category_path "SQL"] + return [db_list_of_ns_sets get_category_path {}] } else { - db_multirow $multirow_name get_category_path "SQL" + db_multirow $multirow_name get_category_path {} } } @@ -207,7 +207,7 @@ category_id, parent_id, heading, description, has_children } { - if {[db_0or1row get_root "SQL" -column_array category]} { + if {[db_0or1row get_root {} -column_array category]} { return [array get category] } else { return {} 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 {}] } }