Index: openacs-4/packages/categories/tcl/category-relation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/category-relation-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/categories/tcl/category-relation-procs.tcl 31 Jan 2018 08:24:28 -0000 1.5 +++ openacs-4/packages/categories/tcl/category-relation-procs.tcl 30 Apr 2018 12:45:00 -0000 1.6 @@ -14,7 +14,7 @@ -category_id_two:required {-user_id ""} } { - Creates a new meta category by creating a relation between category_id_one + Creates a new meta category by creating a relation between category_id_one and category_id_two. This relation is also related to the user_id. @option user_id user that will be related to the meta category. @@ -24,22 +24,22 @@ @author Viaro Networks www.viaro.net } { if { $user_id eq "" } { - set user_id [ad_conn user_id] + set user_id [ad_conn user_id] } - + # First we check if the relation exist, if it does, we don't create a new one set meta_category_id [db_string get_meta_relation_id {} -default ""] - if { $meta_category_id eq "" } { - set meta_category_id [db_exec_plsql add_meta_relation {}] + if { $meta_category_id eq "" } { + set meta_category_id [db_exec_plsql add_meta_relation {}] } - + # Now we check if the user already has the meta category associated, # if it does, we don't create a new one set user_meta_category_id [db_string get_user_meta_relation_id {} -default ""] - if { $user_meta_category_id eq "" } { - return [db_exec_plsql add_user_meta_relation {}] + if { $user_meta_category_id eq "" } { + return [db_exec_plsql add_user_meta_relation {}] } else { - return $user_meta_category_id + return $user_meta_category_id } } @@ -49,9 +49,9 @@ } { Returns two select menus of the categories on each tree to be used in ad_form. The name of the elements are meta_category_one and meta_category_two. - - @option tree_id_one + + @option tree_id_one @option tree_id_two @author Miguel Marin (miguelmarin@viaro.net) @author Viaro Networks www.viaro.net @@ -60,16 +60,14 @@ set label_two [category_tree::get_name $tree_id_two] set element_one "\{meta_category_one:integer(select) \{label $label_one\} \{options \{ " set element_two "\{meta_category_two:integer(select) \{label $label_two\} \{options \{ " - + foreach category_one [category_tree::get_tree $tree_id_one] { - set value_one [lindex $category_one 0] - set label_one [lindex $category_one 1] - append element_one "\{$label_one $value_one\} " + lassign $category_one value_one label_one + append element_one "\{$label_one $value_one\} " } foreach category_two [category_tree::get_tree $tree_id_two] { - set value_two [lindex $category_two 0] - set label_two [lindex $category_two 1] - append element_two "\{$label_two $value_two\} " + lassign $category_two value_two label_two + append element_two "\{$label_two $value_two\} " } append element_one "\} \} \}" append element_two "\} \} \}"