Index: openacs-4/packages/categories/www/cadmin/category-parent-change-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-parent-change-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/categories/www/cadmin/category-parent-change-2.tcl 11 Feb 2004 10:01:11 -0000 1.1
@@ -0,0 +1,19 @@
+ad_page_contract {
+
+ Changes the parent category of a category.
+
+ @author Timo Hentschel (timo@timohentschel.de)
+ @cvs-id $Id:
+} {
+ tree_id:integer
+ category_id:integer
+ {parent_id:integer,optional [db_null]}
+ {locale ""}
+ object_id:integer,optional
+}
+
+permission::require_permission -object_id $tree_id -privilege category_tree_write
+
+category::change_parent -tree_id $tree_id -category_id $category_id -parent_id $parent_id
+
+ad_returnredirect [export_vars -no_empty -base tree-view {tree_id locale object_id}]
Index: openacs-4/packages/categories/www/cadmin/category-parent-change-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-parent-change-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/categories/www/cadmin/category-parent-change-oracle.xql 11 Feb 2004 10:01:11 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+ oracle8.1.6
+
+
+
+
+ select /*+INDEX(child categories_left_ix)*/
+ child.category_id
+ from categories parent, categories child
+ where parent.category_id = :category_id
+ and child.left_ind >= parent.left_ind
+ and child.left_ind <= parent.right_ind
+ and child.tree_id = parent.tree_id
+ order by child.left_ind
+
+
+
+
+
+
Index: openacs-4/packages/categories/www/cadmin/category-parent-change-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-parent-change-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/categories/www/cadmin/category-parent-change-postgresql.xql 11 Feb 2004 10:01:11 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+ postgresql7.1
+
+
+
+
+ select child.category_id
+ from categories parent, categories child
+ where parent.category_id = :category_id
+ and child.left_ind >= parent.left_ind
+ and child.left_ind <= parent.right_ind
+ and child.tree_id = parent.tree_id
+ order by child.left_ind
+
+
+
+
+
+
Index: openacs-4/packages/categories/www/cadmin/category-parent-change.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-parent-change.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/categories/www/cadmin/category-parent-change.adp 11 Feb 2004 10:01:11 -0000 1.1
@@ -0,0 +1,6 @@
+
+@page_title;noquote@
+@context_bar;noquote@
+@locale;noquote@
+
+
Index: openacs-4/packages/categories/www/cadmin/category-parent-change.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-parent-change.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/categories/www/cadmin/category-parent-change.tcl 11 Feb 2004 10:01:11 -0000 1.1
@@ -0,0 +1,64 @@
+ad_page_contract {
+
+ Changes the parent category of a category.
+
+ @author Timo Hentschel (timo@timohentschel.de)
+ @cvs-id $Id:
+} {
+ tree_id:integer
+ category_id:integer
+ {locale ""}
+ object_id:integer,optional
+} -properties {
+ page_title:onevalue
+ context_bar:onevalue
+ locale:onevalue
+ tree:multirow
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+permission::require_permission -object_id $tree_id -privilege category_tree_write
+
+set category_name [category::get_name $category_id $locale]
+set page_title "Change parent category of \"$category_name\""
+set context_bar [category::context_bar $tree_id $locale [value_if_exists object_id]]
+lappend context_bar "Change parent"
+
+
+set subtree_categories_list [db_list get_subtree ""]
+
+template::multirow create tree category_name category_id deprecated_p level left_indent parent_url
+template::multirow append tree "Root Level" 0 f 0 "" \
+ [export_vars -no_empty -base category-parent-change-2 {tree_id category_id locale object_id}]
+
+foreach category [category_tree::get_tree -all $tree_id $locale] {
+ util_unlist $category category_id category_name deprecated_p level
+
+ if { [lsearch $subtree_categories_list $category_id]==-1 } {
+ set parent_url [export_vars -no_empty -base category-parent-change-2 { {parent_id $category_id} tree_id category_id locale object_id }]
+ } else {
+ set parent_url ""
+ }
+ template::multirow append tree $category_name $category_id $deprecated_p $level [string repeat " " [expr ($level-1)*5]] $parent_url
+}
+
+
+template::list::create \
+ -name tree \
+ -no_data "None" \
+ -elements {
+ category_name {
+ label "Name"
+ display_template {
+ @tree.left_indent;noquote@ @tree.category_name@
+ }
+ }
+ set_parent {
+ label "Action"
+ display_template {
+ Set parent
+ }
+ }
+ }
+
+ad_return_template
Index: openacs-4/packages/categories/www/cadmin/tree-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/tree-view.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/categories/www/cadmin/tree-view.tcl 10 Feb 2004 00:50:53 -0000 1.6
+++ openacs-4/packages/categories/www/cadmin/tree-view.tcl 11 Feb 2004 10:01:11 -0000 1.7
@@ -56,14 +56,14 @@
# List builder
#----------------------------------------------------------------------
-multirow extend one_tree usage_url add_url edit_url delete_url set_parent_url phase_in_url phase_out_url links_view_url
+multirow extend one_tree usage_url add_url edit_url delete_url parent_url phase_in_url phase_out_url links_view_url
multirow foreach one_tree {
set usage_url [export_vars -no_empty -base category-usage { category_id tree_id locale object_id }]
if { $can_write_p } {
set add_url [export_vars -no_empty -base category-form { { parent_id $category_id } tree_id locale object_id }]
set edit_url [export_vars -no_empty -base category-form { category_id tree_id locale object_id }]
set delete_url [export_vars -no_empty -base category-delete { category_id tree_id locale object_id }]
- set set_parent_url [export_vars -no_empty -base category-set-parent { category_id tree_id locale object_id }]
+ set parent_url [export_vars -no_empty -base category-parent-change { category_id tree_id locale object_id }]
set links_view_url [export_vars -no_empty -base category-links-view { category_id tree_id locale object_id }]
if { [template::util::is_true $deprecated_p] } {
set phase_in_url [export_vars -no_empty -base category-phase-out { category_id { phase_out_p 0 } tree_id locale object_id }]
@@ -111,7 +111,7 @@
lappend elements actions {
label "Actions"
display_template {
- Change parent
+ Change parent
View links
}
}