tree-map.tcl

Lets user select a category to map a subtree.

Location:
/packages/categories/www/cadmin/tree-map.tcl
Author:
Timo Hentschel <timo@timohentschel.de>
CVS ID:
$Id: tree-map.tcl,v 1.12.2.1 2019/12/20 21:18:10 gustafn Exp $

Related Files

[ hide source ] | [ make this the default ]

File Contents

ad_page_contract {

    Lets user select a category to map a subtree.

    @author Timo Hentschel (timo@timohentschel.de)
    @cvs-id $Id: tree-map.tcl,v 1.12.2.1 2019/12/20 21:18:10 gustafn Exp $
} {
    tree_id:naturalnum,notnull
    {locale:word ""}
    object_id:naturalnum,notnull
    ctx_id:naturalnum,optional
} -properties {
    page_title:onevalue
    context_bar:onevalue
    locale:onevalue
    tree:multirow
}

set user_id [auth::require_login]
permission::require_permission -object_id $object_id -privilege admin

array set tree_data [category_tree::get_data $tree_id $locale]
set tree_name $tree_data(tree_name)
if {$tree_data(site_wide_p) == "f"} {
    permission::require_permission -object_id $tree_id -privilege category_tree_read
}

set page_title [_ categories.Tree_map_title]
set context_bar [list \
   [category::get_object_context $object_id] \
   [list [export_vars -no_empty -base object-map {locale object_id ctx_id}] [_ categories.cadmin]] \
   "#categories.Map_subtree#"]

template::multirow create tree category_id category_name level left_indent map_url

foreach category [category_tree::get_tree -all $tree_id $locale] {
    lassign $category category_id category_name deprecated_p level

    template::multirow append tree $category_id $category_name $level \
    [string repeat "&nbsp;" [expr {($level-1)*5}]] \
    [export_vars -no_empty -base tree-map-2 { category_id tree_id locale object_id ctx_id}]
}

template::list::create \
    -name tree \
    -no_data "#categories.None#" \
    -elements {
    category_name {
        label "#acs-subsite.Name#"
        display_template {
        @tree.left_indent;noquote@ @tree.category_name@
        }
    }
    map {
        label "#categories.Action#"
        display_template {
        <a href="@tree.map_url@">#categories.Map_this_subtree#</a>
        }
    }
    }

ad_return_template

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: