Index: openacs-4/packages/categories/tcl/categories-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/categories-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/categories/tcl/categories-procs.tcl 10 Feb 2004 00:50:53 -0000 1.13 +++ openacs-4/packages/categories/tcl/categories-procs.tcl 11 Feb 2004 09:03:46 -0000 1.14 @@ -263,7 +263,7 @@ } if { ![catch { set name $cat_lang([ad_parameter DefaultLocale acs-lang "en_US"]) }] } { # default locale found - return$name + return $name } # tried default locale, but nothing found return {} @@ -317,6 +317,24 @@ return $indent_string } +ad_proc -private category::context_bar { tree_id locale object_id } { + Creates the standard context bar + + @param tree_id + @param locale + @param object_id + @author Timo Hentschel (timo@timohentschel.de) +} { + if {![empty_string_p $object_id]} { + set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}] "Category Management"]] + } else { + set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] + } + lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}] [category_tree::get_name $tree_id $locale]] + + return $context_bar +} + ad_proc category::pageurl { object_id } { Returns the page that displays a category. To be used by the AcsObject.PageUrl service contract. Index: openacs-4/packages/categories/www/cadmin/category-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-delete.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/categories/www/cadmin/category-delete.tcl 9 Feb 2004 19:52:32 -0000 1.7 +++ openacs-4/packages/categories/www/cadmin/category-delete.tcl 11 Feb 2004 09:02:43 -0000 1.8 @@ -33,19 +33,12 @@ multirow sort categories -dictionary category_name -array set tree [category_tree::get_data $tree_id $locale] -set tree_name $tree(tree_name) - set delete_url [export_vars -no_empty -base category-delete-2 { tree_id category_id:multiple locale object_id }] set cancel_url [export_vars -no_empty -base tree-view { tree_id locale object_id }] set page_title "Delete categories" -if {[info exists object_id]} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}] "Category Management"]] -} else { - set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] -} -lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}] $tree_name] "Delete categories" +set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]] +lappend context_bar "Delete categories" template::list::create \ -name categories \ Index: openacs-4/packages/categories/www/cadmin/category-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-form.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/categories/www/cadmin/category-form.tcl 11 Feb 2004 00:38:29 -0000 1.5 +++ openacs-4/packages/categories/www/cadmin/category-form.tcl 11 Feb 2004 09:02:43 -0000 1.6 @@ -24,16 +24,9 @@ set page_title "Add category" } -array set tree [category_tree::get_data $tree_id $locale] -set tree_name $tree(tree_name) +set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]] +lappend context_bar $page_title -if {[info exists object_id]} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}]" "Category Management"]] -} else { - set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] -} -lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}]" $tree_name] $page_title - set languages [lang::system::get_locale_options] ad_form -name category_form -action category-form -export { tree_id parent_id locale object_id } -form { Index: openacs-4/packages/categories/www/cadmin/category-link-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-link-add-2.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/categories/www/cadmin/category-link-add-2.tcl 10 Feb 2004 00:50:53 -0000 1.3 +++ openacs-4/packages/categories/www/cadmin/category-link-add-2.tcl 11 Feb 2004 09:02:43 -0000 1.4 @@ -19,21 +19,16 @@ set user_id [ad_maybe_redirect_for_registration] -array set tree [category_tree::get_data $tree_id $locale] permission::require_permission -object_id $tree_id -privilege category_tree_write permission::require_permission -object_id $link_tree_id -privilege category_tree_write -set tree_name $tree(tree_name) set category_name [category::get_name $category_id $locale] +set tree_name [category_tree::get_name $tree_id $locale] set link_tree_name [category_tree::get_name $link_tree_id $locale] -set page_title "Add link from \"$link_tree_name\" to category \"$tree(tree_name) :: $category_name\"" +set page_title "Add link from \"$link_tree_name\" to category \"$tree_name :: $category_name\"" -if {[info exists object_id]} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}] "Category Management"]] -} else { - set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] -} -lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}] $tree_name] \ +set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]] +lappend context_bar \ [list [export_vars -no_empty -base category-links-view {category_id tree_id locale object_id}] "Links to $category_name"] \ [list [export_vars -no_empty -base category-link-add {category_id tree_id locale object_id}] "Select link target"] \ "Add link" Index: openacs-4/packages/categories/www/cadmin/category-link-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-link-add.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/categories/www/cadmin/category-link-add.tcl 8 Feb 2004 17:30:45 -0000 1.1 +++ openacs-4/packages/categories/www/cadmin/category-link-add.tcl 11 Feb 2004 09:02:43 -0000 1.2 @@ -17,20 +17,16 @@ } set user_id [ad_maybe_redirect_for_registration] - -array set tree [category_tree::get_data $tree_id $locale] permission::require_permission -object_id $tree_id -privilege category_tree_write -set tree_name $tree(tree_name) +set tree_name [category_tree::get_name $tree_id $locale] set category_name [category::get_name $category_id $locale] -set page_title "Select target to add a link to category \"$tree(tree_name) :: $category_name\"" +set page_title "Select target to add a link to category \"$tree_name :: $category_name\"" -if {[info exists object_id]} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}] "Category Management"]] -} else { - set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] -} -lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}] $tree_name] [list [export_vars -no_empty -base category-links-view {category_id tree_id locale object_id}] "Links to $category_name"] "Select link target" +set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]] +lappend context_bar \ + [list [export_vars -no_empty -base category-links-view {category_id tree_id locale object_id}] "Links to $category_name"] \ + "Select link target" template::multirow create trees tree_name tree_id link_add_url Index: openacs-4/packages/categories/www/cadmin/category-link-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-link-delete.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/categories/www/cadmin/category-link-delete.tcl 9 Feb 2004 19:51:44 -0000 1.2 +++ openacs-4/packages/categories/www/cadmin/category-link-delete.tcl 11 Feb 2004 09:02:43 -0000 1.3 @@ -21,19 +21,16 @@ set user_id [ad_maybe_redirect_for_registration] permission::require_permission -object_id $tree_id -privilege category_tree_write -array set tree [category_tree::get_data $tree_id $locale] -set tree_name $tree(tree_name) +set tree_name [category_tree::get_name $tree_id $locale] set category_name [category::get_name $category_id $locale] set allowed_link_ids [list] -set page_title "Delete links with category \"$tree(tree_name) :: $category_name\"" +set page_title "Delete links with category \"$tree_name :: $category_name\"" -if {[info exists object_id]} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}] "Category Management"]] -} else { - set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] -} -lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}] $tree_name] [list [export_vars -no_empty -base category-links-view {category_id tree_id locale object_id}] "Links to $category_name"] "Delete Links" +set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]] +lappend context_bar \ + [list [export_vars -no_empty -base category-links-view {category_id tree_id locale object_id}] "Links to $category_name"] \ + "Delete Links" multirow create category_links linked_category_id linked_tree_id direction Index: openacs-4/packages/categories/www/cadmin/category-links-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-links-view.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/categories/www/cadmin/category-links-view.tcl 9 Feb 2004 14:08:44 -0000 1.2 +++ openacs-4/packages/categories/www/cadmin/category-links-view.tcl 11 Feb 2004 09:02:43 -0000 1.3 @@ -17,20 +17,14 @@ } set user_id [ad_maybe_redirect_for_registration] - -array set tree [category_tree::get_data $tree_id $locale] permission::require_permission -object_id $tree_id -privilege category_tree_write -set tree_name $tree(tree_name) +set tree_name [category_tree::get_name $tree_id $locale] set category_name [category::get_name $category_id $locale] -set page_title "Categories linked with category \"$tree(tree_name) :: $category_name\"" +set page_title "Categories linked with category \"$tree_name :: $category_name\"" -if {[info exists object_id]} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}] "Category Management"]] -} else { - set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] -} -lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}] $tree_name] "Links to $category_name" +set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]] +lappend context_bar "Links to $category_name" #---------------------------------------------------------------------- Index: openacs-4/packages/categories/www/cadmin/category-set-parent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/Attic/category-set-parent.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/categories/www/cadmin/category-set-parent.tcl 10 Feb 2004 00:50:53 -0000 1.7 +++ openacs-4/packages/categories/www/cadmin/category-set-parent.tcl 11 Feb 2004 09:02:43 -0000 1.8 @@ -13,26 +13,17 @@ page_title:onevalue context_bar:onevalue locale:onevalue - tree_name:onevalue tree:multirow } set user_id [ad_maybe_redirect_for_registration] permission::require_permission -object_id $tree_id -privilege category_tree_write -array set one_tree [category_tree::get_data $tree_id $locale] -set tree_name $one_tree(tree_name) +set page_title "Choose a parent category" +set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]] +lappend context_bar "Choose parent" -set page_title "Choose a parent node" -if {[info exists object_id]} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}] "Category Management"]] -} else { - set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] -} -lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}] $tree_name] "Choose parent" - - set subtree_categories_list [db_list subtree ""] template::multirow create tree category_name category_id deprecated_p level left_indent parent_url Index: openacs-4/packages/categories/www/cadmin/category-usage.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-usage.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/categories/www/cadmin/category-usage.tcl 9 Feb 2004 19:51:44 -0000 1.4 +++ openacs-4/packages/categories/www/cadmin/category-usage.tcl 11 Feb 2004 09:02:43 -0000 1.5 @@ -31,17 +31,13 @@ permission::require_permission -object_id $tree_id -privilege category_tree_read } -set tree_name $tree(tree_name) +set tree_name [category_tree::get_name $tree_id $locale] set category_name [category::get_name $category_id $locale] set page_title "Objects using category \"$category_name\" of tree \"$tree_name\"" set url_vars [export_vars -no_empty {category_id tree_id locale object_id}] -if {[info exists object_id]} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base one-object {locale object_id}] "Category Management"]] -} else { - set context_bar [list [list ".?[export_vars -no_empty {locale}]" "Category Management"]] -} -lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id}] $tree_name] "\"$category_name\" Usage" +set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]] +lappend context_bar "\"$category_name\" Usage" set table_def { {object_name "Object Name" {upper(n.object_name) $order} {