Index: openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl 13 Aug 2001 20:07:29 -0000 1.3 +++ openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl 19 Aug 2001 16:32:14 -0000 1.4 @@ -270,6 +270,28 @@ return 1 } +ad_proc -public value_add {attribute_id enum_value sort_order} { + adds the specified enumeration value to the attribute. + + @author Ben Adida (ben@openforce.net) + @creation-date 08/2001 + + @param attribute_id The attribute to which we are adding + @param enum_value The value which we are adding to the enum +} { + # Just insert it if we can + db_dml insert_enum_value { + insert into acs_enum_values v + (attribute_id, sort_order, enum_value, pretty_name) + select :attribute_id, :sort_order, :enum_value, :enum_value + from dual + where not exists (select 1 + from acs_enum_values v2 + where v2.pretty_name = :enum_value + and v2.attribute_id = :attribute_id) + } +} + ad_proc -public value_delete { attribute_id enum_value } { deletes the specified enumeration value from the attribute. The net effect is that this attribute will have one fewer options for Index: openacs-4/packages/acs-subsite/tcl/rel-types-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-types-procs-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/tcl/rel-types-procs-postgresql.xql 15 May 2001 16:59:00 -0000 1.2 +++ openacs-4/packages/acs-subsite/tcl/rel-types-procs-postgresql.xql 19 Aug 2001 16:32:14 -0000 1.3 @@ -32,5 +32,33 @@ + + + select acs_rel_type__drop_type(:rel_type) + + + + + +select acs_rel_type__create_type ( + :rel_type, + :pretty_name, + :pretty_plural, + :supertype, + :table_name, + 'rel_id', + :package_name, + :object_type_one, + :role_one, + :min_n_rels_one, + :max_n_rels_one, + :object_type_two, + :role_two, + :min_n_rels_two, + :max_n_rels_two +); + + + Index: openacs-4/packages/acs-subsite/tcl/rel-types-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-types-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/tcl/rel-types-procs.tcl 11 Aug 2001 21:31:03 -0000 1.2 +++ openacs-4/packages/acs-subsite/tcl/rel-types-procs.tcl 19 Aug 2001 16:32:14 -0000 1.3 @@ -147,7 +147,7 @@ set plsql [list] # Create the actual acs object type - lappend plsql_drop [list "drop_type" "begin acs_rel_type.drop_type(:rel_type); end;"] + lappend plsql_drop [list "drop_type" "begin acs_rel_type.drop_type(:rel_type); end;" db_exec_plsql] lappend plsql [list "create_type" { begin acs_rel_type.create_type ( @@ -168,13 +168,13 @@ max_n_rels_two => :max_n_rels_two ); end; - }] + } db_exec_plsql] # Mark the type as dynamic - lappend plsql [list update_type "update acs_object_types set dynamic_p='t' where object_type = :rel_type"] + lappend plsql [list update_type "update acs_object_types set dynamic_p='t' where object_type = :rel_type" "db_dml"] foreach pair $plsql { - db_exec_plsql [lindex $pair 0] [lindex $pair 1] + eval [lindex $pair 2] [lindex $pair 0] [lindex $pair 1] } # The following create table statement commits the @@ -204,5 +204,17 @@ } + ad_proc -public add_permissible { + group_type + rel_type + } { + Add a permissible relationship for a given group type + } { + if {[catch { + db_dml insert_rel_type {} + } errmsg]} { + } + } + } Index: openacs-4/packages/acs-subsite/tcl/rel-types-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-types-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/tcl/rel-types-procs.xql 6 May 2001 21:40:21 -0000 1.1 +++ openacs-4/packages/acs-subsite/tcl/rel-types-procs.xql 19 Aug 2001 16:32:14 -0000 1.2 @@ -12,5 +12,19 @@ + + +update acs_object_types set dynamic_p='t' where object_type = :rel_type + + + + + +insert into group_type_rels +(group_rel_type_id, group_type, rel_type) +values +(acs_object_id_seq.nextval, :group_type, :rel_type) + + Index: openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/attributes/Attic/enum-add-2-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2-postgresql.xql 15 May 2001 16:59:00 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2-postgresql.xql 19 Aug 2001 16:32:14 -0000 1.2 @@ -6,7 +6,7 @@ - insert into acs_enum_values v + insert into acs_enum_values (attribute_id, sort_order, enum_value, pretty_name) select :attribute_id, :sort_order, :pretty_name, :pretty_name Index: openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2.xql 15 May 2001 16:59:00 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2.xql 19 Aug 2001 16:32:14 -0000 1.2 @@ -26,10 +26,10 @@ - update acs_enum_values v - set v.pretty_name = :pretty_name - where v.attribute_id = :attribute_id - and v.sort_order = :sort_order + update acs_enum_values + set pretty_name = :pretty_name + where attribute_id = :attribute_id + and sort_order = :sort_order Index: openacs-4/packages/acs-subsite/www/admin/group-types/rel-type-add-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/rel-type-add-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/group-types/rel-type-add-postgresql.xql 15 May 2001 16:59:00 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/group-types/rel-type-add-postgresql.xql 19 Aug 2001 16:32:14 -0000 1.2 @@ -5,19 +5,17 @@ - FIX ME CONNECT BY - - select replace(lpad(' ', (t.type_level - 1) * 4), ' ', ' ') as indent, + select lpad(' ', (t.type_level - 1) * 4) as indent, t.pretty_name, t.rel_type - from (select t.pretty_name, t.object_type as rel_type, level as type_level + from (select t.pretty_name, t.object_type as rel_type, tree_level(tree_sortkey) as type_level from acs_object_types t where t.object_type not in (select g.rel_type from group_type_rels g where g.group_type = :group_type) - connect by prior t.object_type = t.supertype - start with t.object_type in ('membership_rel', 'composition_rel')) t, - acs_rel_types rel_type - where t.rel_type = rel_type.rel_type + and (t.tree_sortkey like (select tree_sortkey || '%' from acs_object_types where object_type = 'membership_rel') + or t.tree_sortkey like (select tree_sortkey || '%' from acs_object_types where object_type = 'composition_rel'))) t, acs_rel_types rel_type + + where t.rel_type = rel_type.rel_type and (rel_type.object_type_one = :group_type or acs_object_type__is_subtype_p(rel_type.object_type_one, :group_type) = 't') Index: openacs-4/packages/acs-subsite/www/admin/rel-types/new-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-types/new-2-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/rel-types/new-2-oracle.xql 15 May 2001 16:59:01 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/rel-types/new-2-oracle.xql 19 Aug 2001 16:32:14 -0000 1.2 @@ -3,7 +3,7 @@ oracle8.1.6 - + select replace(lpad(' ', (level - 1) * 4), ' ', ' ') || t.pretty_name, Index: openacs-4/packages/acs-subsite/www/admin/rel-types/new-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-types/new-2-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/admin/rel-types/new-2-postgresql.xql 11 Aug 2001 21:31:03 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/admin/rel-types/new-2-postgresql.xql 19 Aug 2001 16:32:15 -0000 1.3 @@ -3,26 +3,13 @@ postgresql7.1 - + - select lpad(' ', (level - 1) * 4) || t.pretty_name, + select lpad(' ', (tree_level(tree_sortkey) - 1) * 4) || t.pretty_name, t.object_type as rel_type from acs_object_types t where tree_sortkey like (select tree_sortkey || '%' from acs_object_types - where object_type= :max_object_type_one) - - - - - - - - - select lpad(' ', (level - 1) * 4) || t.pretty_name, - t.object_type as rel_type - from acs_object_types t - where tree_sortkey like (select tree_sortkey || '%' from acs_object_types where object_type = :max_object_type_one) Index: openacs-4/packages/acs-subsite/www/admin/rel-types/new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-types/new-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/rel-types/new-2.tcl 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/rel-types/new-2.tcl 19 Aug 2001 16:32:15 -0000 1.2 @@ -74,7 +74,7 @@ and r.rel_type = t.object_type } -set object_types_one_list [db_list_of_lists select_object_types { +set object_types_one_list [db_list_of_lists select_object_types_2 { select replace(lpad(' ', (level - 1) * 4), ' ', ' ') || t.pretty_name, t.object_type as rel_type from acs_object_types t Index: openacs-4/packages/acs-subsite/www/admin/rel-types/new-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-types/new-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/admin/rel-types/new-postgresql.xql 11 Aug 2001 21:31:03 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/admin/rel-types/new-postgresql.xql 19 Aug 2001 16:32:15 -0000 1.3 @@ -6,7 +6,7 @@ - select lpad(' ', (level - 1) * 4) || t.pretty_name as name, + select lpad(' ', (tree_level(tree_sortkey) - 1) * 4) || t.pretty_name as name, t.object_type from acs_object_types t where (t.tree_sortkey like (select tree_sortkey || '%' from acs_object_types Index: openacs-4/packages/acs-subsite/www/admin/rel-types/roles/new-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/rel-types/roles/Attic/new-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/rel-types/roles/new-postgresql.xql 15 May 2001 16:59:01 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/rel-types/roles/new-postgresql.xql 19 Aug 2001 16:32:15 -0000 1.2 @@ -5,10 +5,7 @@ - FIX ME PLSQL - - begin acs_rel_type__create_role(role => :role, pretty_name => :pretty_name, pretty_plural => :pretty_plural); end; - + select acs_rel_type__create_role(:role, :pretty_name, :pretty_plural) Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs-oracle.xql 24 Apr 2001 06:02:27 -0000 1.1 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs-oracle.xql 19 Aug 2001 16:32:15 -0000 1.2 @@ -3,6 +3,22 @@ oracle8.1.6 + + + begin + :1 := site_node.new ( + node_id => :new_node_id, + parent_id => :parent_id, + name => :name, + directory_p => :directory_p, + pattern_p => :pattern_p, + creation_user => :user_id, + creation_ip => :ip_address + ); + end; + + + Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql 26 Apr 2001 05:38:54 -0000 1.5 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql 19 Aug 2001 16:32:15 -0000 1.6 @@ -3,6 +3,21 @@ postgresql7.1 + + +select site_node__new ( + :new_node_id, + :parent_id, + :name, + NULL, + :directory_p, + :pattern_p, + :user_id, + :ip_address + ) + + + Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 19 Aug 2001 16:32:15 -0000 1.2 @@ -7,6 +7,29 @@ } +ad_proc -public site_node_create { + {-new_node_id ""} + {-directory_p "t"} + {-pattern_p "t"} + parent_node_id + name +} { + Create a new site node. + Returns the node_id +} { + # Generate an ID if we need one + if {[empty_string_p $new_node_id]} { + set new_node_id [db_nextval acs_object_id_seq] + } + + set user_id [ad_verify_and_get_user_id] + set ip_address [ad_conn peeraddr] + + set node_id [db_exec_plsql node_new {}] + + return $node_id +} + ad_proc -public site_nodes_sync {args} { Brings the in memory copy of the url hierarchy in sync with the database version.