Index: openacs-4/packages/categories/www/categories-browse-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/Attic/categories-browse-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/categories/www/categories-browse-oracle.xql 27 Apr 2003 11:36:50 -0000 1.1 +++ openacs-4/packages/categories/www/categories-browse-oracle.xql 7 May 2003 13:35:06 -0000 1.2 @@ -3,26 +3,6 @@ oracle8.1.6 - - - select t.tree_id - from category_trees t, category_temp tmp - where (t.site_wide_p = 't' - or acs_permission.permission_p(t.tree_id, :user_id, 'category_tree_read') = 't') - and t.tree_id = tmp.category_id - - - - - - select n.object_id - from acs_named_objects n, ($subtree_sql) s - where n.object_id = s.object_id - and acs_permission.permission_p(n.object_id, :user_id, 'read') = 't' - $letter_sql - - - select r.* @@ -35,8 +15,13 @@ and o.object_id = n.object_id and p.package_id = n.package_id and t.package_key = p.package_key - and acs_permission.permission_p(n.object_id, :user_id, 'read') = 't' + and exists (select 1 + from acs_object_party_privilege_map oppm + where oppm.object_id = n.object_id + and oppm.party_id = :user_id + and oppm.privilege = 'read') $letter_sql + $package_sql $order_by_clause) r where r.row_number between :first_row and :last_row Index: openacs-4/packages/categories/www/categories-browse-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/Attic/categories-browse-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/categories/www/categories-browse-postgresql.xql 27 Apr 2003 11:36:50 -0000 1.1 +++ openacs-4/packages/categories/www/categories-browse-postgresql.xql 7 May 2003 13:35:06 -0000 1.2 @@ -3,26 +3,6 @@ postgresql7.1 - - - select t.tree_id - from category_trees t, category_temp tmp - where (t.site_wide_p = 't' - or acs_permission__permission_p(t.tree_id, :user_id, 'category_tree_read') = 't') - and t.tree_id = tmp.category_id - - - - - - select n.object_id - from acs_named_objects n, ($subtree_sql) s - where n.object_id = s.object_id - and acs_permission__permission_p(n.object_id, :user_id, 'read') = 't' - $letter_sql - - - select r.* @@ -35,8 +15,13 @@ and o.object_id = n.object_id and p.package_id = n.package_id and t.package_key = p.package_key - and acs_permission__permission_p(n.object_id, :user_id, 'read') = 't' + and exists (select 1 + from acs_object_party_privilege_map oppm + where oppm.object_id = n.object_id + and oppm.party_id = :user_id + and oppm.privilege = 'read') $letter_sql + $package_sql $order_by_clause) r where r.row_number between :first_row and :last_row Index: openacs-4/packages/categories/www/categories-browse.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/categories-browse.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/categories/www/categories-browse.adp 23 Apr 2003 12:29:27 -0000 1.1 +++ openacs-4/packages/categories/www/categories-browse.adp 7 May 2003 13:35:06 -0000 1.2 @@ -4,16 +4,17 @@
@form_vars;noquote@ + Combine by + [ checked>AND + | checked>OR ] +
@trees.tree_name@: - - AND -
Index: openacs-4/packages/categories/www/categories-browse.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/categories-browse.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/categories/www/categories-browse.tcl 27 Apr 2003 11:36:50 -0000 1.2 +++ openacs-4/packages/categories/www/categories-browse.tcl 7 May 2003 13:35:06 -0000 1.3 @@ -13,6 +13,8 @@ {orderby:optional object_name} {subtree_p:optional f} {letter:optional all} + {join:optional or} + package_id:optional } -properties { page_title:onevalue context_bar:onevalue @@ -34,8 +36,8 @@ set page_title "Browse categories" set context_bar [list "Browse categories"] -set url_vars [export_url_vars tree_ids:multiple category_ids:multiple subtree_p letter] -set form_vars [export_form_vars tree_ids:multiple orderby subtree_p letter] +set url_vars [export_url_vars tree_ids:multiple category_ids:multiple subtree_p letter join package_id] +set form_vars [export_form_vars tree_ids:multiple orderby subtree_p letter package_id] db_transaction { # use temporary table to use only bind vars in queries @@ -98,13 +100,31 @@ } } +if {[info exists package_id]} { + set package_sql [db_map package_objects] +} else { + set package_sql "" +} + set category_ids_length [llength $category_ids] -if {$subtree_p == "t"} { - # generate sql for exact categorizations plus subcategories - set subtree_sql [db_map include_subtree] +if {$join == "and"} { + # combining categories with and + if {$subtree_p == "t"} { + # generate sql for exact categorizations plus subcategories + set subtree_sql [db_map include_subtree_and] + } else { + # generate sql for exact categorization + set subtree_sql [db_map exact_categorization_and] + } } else { - # generate sql for exact categorization - set subtree_sql [db_map exact_categorization] + # combining categories with or + if {$subtree_p == "t"} { + # generate sql for exact categorizations plus subcategories + set subtree_sql [db_map include_subtree_or] + } else { + # generate sql for exact categorization + set subtree_sql [db_map exact_categorization_or] + } } set p_name "browse_categories" Index: openacs-4/packages/categories/www/categories-browse.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/categories-browse.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/categories/www/categories-browse.xql 27 Apr 2003 11:36:50 -0000 1.1 +++ openacs-4/packages/categories/www/categories-browse.xql 7 May 2003 13:35:06 -0000 1.2 @@ -9,6 +9,20 @@
+ + + select t.tree_id + from category_trees t, category_temp tmp + where (t.site_wide_p = 't' + or exists (select 1 + from acs_object_party_privilege_map oppm + where oppm.object_id = t.tree_id + and oppm.party_id = :user_id + and oppm.privilege = 'category_tree_read')) + and t.tree_id = tmp.category_id + + + and (upper(n.object_name) < 'A' or upper(n.object_name) > 'Z') @@ -21,22 +35,28 @@ - + + and n.package_id = :package_id + + + + + select v.object_id from (select distinct m.object_id, c.category_id - from category_object_map m, categories c, category_temp t + from category_object_map m, categories c, + categories c_sub, category_temp t where c.category_id = t.category_id - and m.category_id in (select c_sub.category_id - from categories c_sub - where c_sub.tree_id = c.tree_id - and c_sub.left_ind >= c.left_ind - and c_sub.left_ind < c.right_ind)) v + and m.category_id = c_sub.category_id + and c_sub.tree_id = c.tree_id + and c_sub.left_ind >= c.left_ind + and c_sub.left_ind < c.right_ind) v group by v.object_id having count(*) = :category_ids_length - + select m.object_id from category_object_map m, category_temp t @@ -45,11 +65,47 @@ + + + select distinct m.object_id + from category_object_map m, categories c, + categories c_sub, category_temp t + where c.category_id = t.category_id + and m.category_id = c_sub.category_id + and c_sub.tree_id = c.tree_id + and c_sub.left_ind >= c.left_ind + and c_sub.left_ind < c.right_ind + + + + + + select distinct m.object_id + from category_object_map m, category_temp t + where m.category_id = t.category_id + + + insert into category_temp values (:category_id) + + + select n.object_id + from acs_named_objects n, ($subtree_sql) s + where n.object_id = s.object_id + and exists (select 1 + from acs_object_party_privilege_map oppm + where oppm.object_id = n.object_id + and oppm.party_id = :user_id + and oppm.privilege = 'read') + $letter_sql + $package_sql + + +