Index: openacs-4/packages/cms/tcl/content-method-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/content-method-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cms/tcl/content-method-procs-oracle.xql 17 Aug 2001 04:31:38 -0000 1.1 @@ -0,0 +1,38 @@ + + + + oracle8.1.6 + + + + + select + content_method + from + cm_content_methods m + where + content_method = content_method.get_method (:content_type ) + $text_entry_filter + + + + + + + + + select + label, map.content_method + from + cm_content_type_method_map map, cm_content_methods m + where + map.content_method = m.content_method + and + map.content_method = content_method.get_method( :content_type ) + $text_entry_filter + + + + + + Index: openacs-4/packages/cms/tcl/content-method-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/content-method-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cms/tcl/content-method-procs-postgresql.xql 17 Aug 2001 04:31:38 -0000 1.1 @@ -0,0 +1,38 @@ + + + + postgresql7.1 + + + + + select + content_method + from + cm_content_methods m + where + content_method = content_method__get_method (:content_type ) + $text_entry_filter + + + + + + + + + select + label, map.content_method + from + cm_content_type_method_map map, cm_content_methods m + where + map.content_method = m.content_method + and + map.content_method = content_method__get_method( :content_type ) + $text_entry_filter + + + + + + Index: openacs-4/packages/cms/tcl/content-method-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/content-method-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/tcl/content-method-procs.tcl 12 Jul 2001 06:37:26 -0000 1.2 +++ openacs-4/packages/cms/tcl/content-method-procs.tcl 17 Aug 2001 04:31:38 -0000 1.3 @@ -53,7 +53,7 @@ } else { # otherwise look up all content method mappings - template::query methods onelist " + template::query get_methods_1 methods onelist " select map.content_method from @@ -69,7 +69,7 @@ # if there are no mappings, return all methods if { [template::util::is_nil methods] } { - template::query methods onelist " + template::query get_methods_2 methods onelist " select content_method from @@ -100,7 +100,7 @@ set text_entry_filter [text_entry_filter_sql $content_type] - template::query default_method onerow " + template::query get_content_default_method default_method onerow " select label, map.content_method from @@ -118,7 +118,7 @@ set methods [list [list $label $content_method]] } else { # otherwise look up all content methods mappings - template::query methods multilist " + template::query get_methods_1 methods multilist " select label, map.content_method from @@ -134,7 +134,7 @@ # if there are no mappings, return all methods if { [template::util::is_nil methods] } { - template::query methods multilist " + template::query get_methods_2 methods multilist " select label, content_method from Index: openacs-4/packages/cms/tcl/content-method-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/content-method-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/tcl/content-method-procs.xql 14 Aug 2001 18:11:30 -0000 1.2 +++ openacs-4/packages/cms/tcl/content-method-procs.xql 17 Aug 2001 04:31:38 -0000 1.3 @@ -8,4 +8,32 @@ and content_type = :content_type + + + select + map.content_method + from + cm_content_type_method_map map, cm_content_methods m + where + map.content_method = m.content_method + and + map.content_type = :content_type + $text_entry_filter + + + + + + + + select + content_method + from + cm_content_methods m + where 1 = 1 + $text_entry_filter + + + + Index: openacs-4/packages/cms/tcl/form-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs-oracle.xql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/cms/tcl/form-procs-oracle.xql 14 Aug 2001 18:11:30 -0000 1.8 +++ openacs-4/packages/cms/tcl/form-procs-oracle.xql 17 Aug 2001 04:31:38 -0000 1.9 @@ -155,26 +155,8 @@ - + - $param => :$param - - - - - - $param => $defArray($param) - - - - - - relation_tag => :relation_tag - - - - - begin :item_id := content_item.new( [join $params ","] ); end; Index: openacs-4/packages/cms/tcl/form-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs-postgresql.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/cms/tcl/form-procs-postgresql.xql 17 Aug 2001 02:53:47 -0000 1.10 +++ openacs-4/packages/cms/tcl/form-procs-postgresql.xql 17 Aug 2001 04:31:38 -0000 1.11 @@ -160,29 +160,27 @@ - - - :$param - + + - - - - - $defArray($param) - - - - - -null - - - - - - select content_item__new( [join $params ","] ) as item_id - + select content_item__new(:name, + :parent_id, + :item_id, + :locale, + now(), + [User::getID], + null, + '[ns_conn peeraddr]', + 'content_item', + :content_type, + null, + null, + 'text/plain', + null, + null, + :storage_type) + + Index: openacs-4/packages/cms/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/cms/tcl/form-procs.tcl 14 Aug 2001 18:11:30 -0000 1.9 +++ openacs-4/packages/cms/tcl/form-procs.tcl 17 Aug 2001 04:31:38 -0000 1.10 @@ -609,61 +609,40 @@ ad_proc content::new_item { form_name { tmpfile "" } } { - # RBM: Set defaults for PostgreSQL - # I'm assumming 'name' will always have something - - set paramList [list name parent_id item_id locale creation_date creation_user \ - context_id creation_ip item_subtype content_type title \ - description mime_type nls_language data] + array set defaults [list item_id "" locale "" parent_id "" content_type "content_revision"] - set defaultList [list {} null null null "now()" "[User::getID]" \ - null "[ns_conn peeraddr]" content_item content_revision null \ - null "text/plain" null null] + foreach param { item_id name locale parent_id content_type } { - for {set i 0} {$i < [llength $paramList]} {incr i} { - set defArray([lindex $paramList $i]) [lindex $defaultList $i] - } - - foreach param $paramList { - if { [template::element exists $form_name $param] } { set $param [template::element get_value $form_name $param] - if { ! [string equal [set $param] {}] } { - # include the parameter if it is not null - lappend params [db_map cont_new_item_non_null_params] - } else { - lappend params [db_map cont_new_item_def_params] + # include the parameter if it is not null + lappend params "$param => :$param" } + } else { + set $param $defaults($param) } } - # RBM: FIX ME! In all PG content_item__new functions, relation_tag - # is set to NULL. Is that ok? - + + lappend params "creation_user => [User::getID]" + lappend params "creation_ip => '[ns_conn peeraddr]'" + lappend params "storage_type => :storage_type" + # Use the correct relation tag, if specified if { [template::element exists $form_name relation_tag] } { set relation_tag [template::element get_value $form_name relation_tag] - set rel_tag [string trim [db_map cont_new_item_rel_tag]] - - if{ $rel_tag != "null" } { - # The content_item__new PG functions don't take relation_tag as - # argument. So I made it so the PG .xql returns null, and the element - # is not included in the list. But the Oracle one is, if it exists. - - lappend params $rel_tag - } + lappend params "relation_tag => :relation_tag" } - set sql - db_transaction { - db_exec_plsql create_new_content_item " - begin - :item_id := content_item.new( [join $params ","] ); - end;" -bind item_id - + + set item_id [db_exec_plsql get_item_id " + begin + :1 := content_item.new( [join $params ","] ); + end;"] + add_revision $form_name $tmpfile } @@ -1369,7 +1348,7 @@ # # @option label {Child relation tag} The label for the element -proc content::add_child_relation_element { form_name args } { +ad_proc content::add_child_relation_element { form_name args } { # Process parameters @@ -1698,7 +1677,7 @@ ad_proc content::get_object_id {} { - return [db_nextval select acs_object_id_seq] + return [db_string nextval "select acs_object_id_seq.nextval from dual"] } ad_proc content::get_content_value { revision_id } { @@ -1745,11 +1724,32 @@ ### HACK ! What the hell is "ldap dn" ? if { [llength $args] == 1 } { - template::query ga_get_attributes attributes onelist "" + set type onelist } else { - template::query attributes multilist "" + set type multilist } + template::query ga_get_attributes attributes $type " + select + [join $args ","] + from + acs_attributes, + ( + select + object_type ancestor, level as type_order + from + acs_object_types + connect by + prior supertype = object_type + start with + object_type = :content_type + ) types + where + object_type = ancestor + and + attribute_name <> 'ldap dn' + order by type_order desc, sort_order" + return $attributes }