Index: openacs-4/packages/dynamic-types/dynamic-types.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/dynamic-types.info,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dynamic-types/dynamic-types.info 14 Feb 2005 14:33:27 -0000 1.1 +++ openacs-4/packages/dynamic-types/dynamic-types.info 26 May 2005 10:27:57 -0000 1.2 @@ -5,19 +5,19 @@ Dynamic Object Type Dynamic Object Types f - t + f - + Rob Denison Lee Denison Dynamic Object Type management API Xarg Allows creation, manipulation and ui generation of dynamically generated object types. - - - + + + Index: openacs-4/packages/dynamic-types/catalog/dynamic-types.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/catalog/dynamic-types.en_US.ISO-8859-1.xml,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dynamic-types/catalog/dynamic-types.en_US.ISO-8859-1.xml 14 Feb 2005 14:33:27 -0000 1.1 +++ openacs-4/packages/dynamic-types/catalog/dynamic-types.en_US.ISO-8859-1.xml 26 May 2005 10:27:57 -0000 1.2 @@ -7,7 +7,25 @@ + Add + Add a Dynamic Attribute + Add a Form + Attribute + Add Attribute + Default Value + Edit Attribute + Attribute Name + This name must be lower case, contain only letters and underscores, and contain no spaces. If not specified one will be generated for you. + Attributes Content + Datatype + Dynamic Types Management + Dynamic Types + Form Name + Forms + Object Type + Pretty Name + Pretty Plural you must supply either -multirow or -indexed_array unable to retrieve widget parameter %name% for attribute %attribute_id% - returning "" as parameter value Index: openacs-4/packages/dynamic-types/sql/postgresql/dtype-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/sql/postgresql/dtype-package-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dynamic-types/sql/postgresql/dtype-package-create.sql 28 Feb 2005 08:33:03 -0000 1.3 +++ openacs-4/packages/dynamic-types/sql/postgresql/dtype-package-create.sql 26 May 2005 10:27:58 -0000 1.4 @@ -3,6 +3,23 @@ -- Based on cms code by Michael Pih (pihman@arsdigita.com) and -- Karl Goldstein (karlg@arsdigita.com) +----------------------------- +-- timo: +-- i am quite emberassed to do this, but the OCT wouldn't want it +-- any other way, so here they have it. they'll gonna change it +-- anyway, if this makes it into the core... +----------------------------- + +create table dtype_attributes ( + attribute_id integer + constraint dtype_attributes_pk + primary key + constraint dtype_attributes_fk + references acs_attributes +); + + + select define_function_args('dynamic_type__create_type','object_type,supertype;acs_object,pretty_name,pretty_plural,table_name,id_column;XXX,name_method'); create or replace function dynamic_type__create_type (varchar,varchar,varchar,varchar,varchar,varchar,varchar) @@ -47,6 +64,10 @@ p_name_method ); + update acs_object_types + set dynamic_p = true + where object_type = p_object_type; + PERFORM dynamic_type__refresh_view(p_object_type); return 0; @@ -206,13 +227,15 @@ null, null, p_default_value, + 0, 1, - 1, p_sort_order, ''type_specific'', ''f'' ); + insert into dtype_attributes values (v_attr_id); + PERFORM dynamic_type__refresh_view(p_object_type); return v_attr_id; @@ -534,6 +557,10 @@ and ancestor_type = ''content_revision''; end if; + if v_content_revision_p then + PERFORM content_type__refresh_view(p_object_type); + else + for join_rec in select ot2.table_name, ot2.id_column, tree_level(ot2.tree_sortkey) as level from acs_object_types ot1, acs_object_types ot2 where ot2.object_type <> ''acs_object'' @@ -595,6 +622,8 @@ PERFORM dynamic_type__refresh_trigger(p_object_type); + end if; + return 0; end;' language 'plpgsql'; -- show errors Index: openacs-4/packages/dynamic-types/sql/postgresql/metadata-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/sql/postgresql/metadata-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dynamic-types/sql/postgresql/metadata-create.sql 15 Feb 2005 13:55:34 -0000 1.2 +++ openacs-4/packages/dynamic-types/sql/postgresql/metadata-create.sql 26 May 2005 10:27:58 -0000 1.3 @@ -15,7 +15,7 @@ insert into dtype_db_datatypes (datatype, db_type) values (''integer'', ''integer''); insert into dtype_db_datatypes (datatype, db_type) - values (''money'', ''text''); + values (''money'', ''varchar(30)''); insert into dtype_db_datatypes (datatype, db_type) values (''date'', ''timestamp''); insert into dtype_db_datatypes (datatype, db_type) @@ -25,11 +25,13 @@ insert into dtype_db_datatypes (datatype, db_type) values (''enumeration'', ''text''); insert into dtype_db_datatypes (datatype, db_type) - values (''url'', ''text''); + values (''url'', ''varchar(1000)''); insert into dtype_db_datatypes (datatype, db_type) - values (''email'', ''text''); + values (''email'', ''varchar(100)''); insert into dtype_db_datatypes (datatype, db_type) values (''text'', ''text''); + insert into dtype_db_datatypes (datatype, db_type) + values (''string'', ''varchar(1000)''); raise notice ''Inserting standard widget metadata...''; @@ -209,6 +211,21 @@ insert into dtype_default_widgets (template_id, datatype) values (v_template_id, ''text''); + -- Text (single line) (default ''string'' widget) + v_template_id := dtype_wdgt_tmpl__new ( + null, + null, + ''string'', + ''String'', + ''text'', + ''string'', + null, + null + ); + + insert into dtype_default_widgets (template_id, datatype) + values (v_template_id, ''string''); + -- Email Address v_template_id := dtype_wdgt_tmpl__new ( null, Index: openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.tcl 24 Feb 2005 14:21:50 -0000 1.2 +++ openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.tcl 26 May 2005 10:27:58 -0000 1.3 @@ -26,14 +26,16 @@ } { Populates array with the data for the object specified. } { - upvar $array local + set attributes_list [dtype::get_attributes_list -name $object_type -start_with acs_object -storage_types type_specific] - set attributes_list [dtype::get_attributes -name $object_type -list t attributes] - + upvar $array local set columns [list] foreach attribute_info $attributes_list { foreach {name pretty_name attribute_id datatype table_name column_name default_value min_n_values max_n_values static_p} $attribute_info break + if {$column_name == "package_id"} { + continue + } switch $datatype { date - timestamp - @@ -67,6 +69,7 @@ set name_method [db_null] } + ns_log Debug "DYNAMIC TYPES: Creating Object $name with Pretty Name $pretty_name" db_exec_plsql create_type {} } @@ -207,6 +210,7 @@ {-object_type:required} {-pretty_name:required} {-pretty_plural:required} + {-default_value ""} } { Sets the details of an attribute. } { @@ -372,11 +376,11 @@ # get default widgets foreach type $types { - if {[info exists type_dforms($type)]} { - set type_dform $type_dforms($type) - } else { - set type_dform "implicit" - } + if {[info exists type_dforms($type)]} { + set type_dform $type_dforms($type) + } else { + set type_dform "implicit" + } dtype::form::metadata::widgets -object_type $type \ -dform $type_dform \ Index: openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.xql 24 Feb 2005 14:21:50 -0000 1.2 +++ openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.xql 26 May 2005 10:27:58 -0000 1.3 @@ -46,7 +46,9 @@ update acs_attributes - set pretty_name=:pretty_name,pretty_plural=:pretty_plural + set pretty_name = :pretty_name, + pretty_plural = :pretty_plural, + default_value = :default_value where acs_attributes.attribute_name = :name and acs_attributes.object_type = :object_type Index: openacs-4/packages/dynamic-types/tcl/form-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/tcl/form-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dynamic-types/tcl/form-procs-postgresql.xql 14 Feb 2005 14:33:28 -0000 1.1 +++ openacs-4/packages/dynamic-types/tcl/form-procs-postgresql.xql 26 May 2005 10:27:58 -0000 1.2 @@ -95,7 +95,7 @@ :item_locale, now(), :item_creation_user, - null, + :item_context_id, :item_creation_ip, 'content_item', :item_content_type, @@ -104,7 +104,8 @@ 'text/plain', null, null, - :cr_storage) + :cr_storage, + :item_package_id) Index: openacs-4/packages/dynamic-types/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/tcl/form-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dynamic-types/tcl/form-procs.tcl 26 Feb 2005 19:09:21 -0000 1.5 +++ openacs-4/packages/dynamic-types/tcl/form-procs.tcl 26 May 2005 10:27:58 -0000 1.6 @@ -41,6 +41,8 @@ {-overrides {}} {-cr_widget textarea} {-cr_widget_options {}} + {-exclude {}} + {-exclude_static:boolean} } { Adds the elements of the specified object types dynamic form and all of its supertypes dynamic forms to the specified template form. @@ -70,22 +72,23 @@ template::form create $form } + if {![empty_string_p $object_id]} { + set object_id [db_string check_object_existence {} -default ""] + } + set types [dtype::form::types_list \ -object_id $object_id \ -object_type $object_type] set object_type [lindex $types 0] - + set action edit - array set type_dforms $dforms array set override $overrides - if {![string equal $object_id ""] && - [info exists override(object_id)]} { + if {![empty_string_p $object_id] && [info exists override(object_id)]} { error "Cannot override object_id for an existing object" - } elseif {[string equal $object_id ""]} { + } elseif {[empty_string_p $object_id]} { set action new - if {![info exists override(object_id)]} { set override(object_id) [db_nextval acs_object_id_seq] } @@ -117,20 +120,26 @@ -form $form \ -overrides [array get override] \ -cr_widget $cr_widget \ - -cr_widget_options $cr_widget_options + -cr_widget_options $cr_widget_options \ + -exclude_static_p $exclude_static_p \ + -exclude $exclude } } ad_proc -public dtype::form::process { {-prefix ""} {-object_type ""} + {-object_id ""} {-dform implicit} {-dforms {acs_object default content_revision default}} {-form:required} {-defaults {}} + {-default_fields {}} {-cr_widget textarea} {-cr_storage file} {-cr_mime_filters {text/html dtype::mime_filters::text_html}} + {-exclude {}} + {-exclude_static:boolean} } { Process a dynamic type form submission created by a function such as dtype::form::add_elements. @@ -143,6 +152,7 @@ @param prefix the prefix for each attribute name used @param defaults default values to use for attributes (this should be used to supply values for context_id and the like) + @param default_fields default columns with values to be used for db insert @param cr_widget the input method for the content @param cr_storage the content repository storage method @@ -153,7 +163,9 @@ # Pull the object_id out of the form - technically a acs_object dform # could be created that doesn't include object_id as a field in which # case this would just break. - set object_id [template::element::get_value $form ${prefix}object_id] + if {[empty_string_p $object_id]} { + set object_id [template::element::get_value $form ${prefix}object_id] + } # Pull the action out of the form set action [template::element::get_value $form ${prefix}dform_action] @@ -177,22 +189,36 @@ ####################################################### # Setup default values for object creation # - if {$new_p} { - set default(object_type) $object_type - - if {![info exists default(creation_user)]} { - set default(creation_user) [ad_conn user_id] - } - - if {![info exists default(creation_ip)]} { - set default(creation_ip) [ad_conn peeraddr] - } + set default(object_type) $object_type + if {![info exists default(creation_user)]} { + set default(creation_user) [ad_conn user_id] } + if {![info exists default(creation_ip)]} { + set default(creation_ip) [ad_conn peeraddr] + } + if {![info exists default(context_id)]} { + set default(context_id) [db_null] + } + if {![info exists default(package_id)]} { + set default(package_id) [ad_conn package_id] + } + if {![info exists default(parent_id)]} { + set default(parent_id) [db_null] + } + if {![info exists default(nls_language)]} { + set default(nls_language) [db_null] + } + if {![info exists default(publish_date)]} { + set default(publish_date) [db_null] + } ####################################################### # Content Repository specific preparations # if {$content_type_p} { + if {![info exists default(mime_type)]} { + set default(mime_type) "text/plain" + } if {$new_p} { # We are creating an initial revision of a content item (ie. a new # instance of a subtype of content_revision). We need to first @@ -204,6 +230,8 @@ locale [db_null] \ parent_id [db_null] \ content_type $object_type \ + context_id [db_null] \ + package_id [ad_conn package_id] \ creation_user [ad_conn user_id] \ creation_ip [ad_conn peeraddr] \ storage_type $cr_storage] @@ -249,10 +277,6 @@ set default(mime_type) [ns_guesstype $default(filename)] } - - # Populate content revision fields with default values - set default(nls_language) [db_null] - set default(publish_date) [db_null] } ####################################################### @@ -261,6 +285,25 @@ set columns [list] set values [list] + # set default fields with provided values + foreach var_spec $default_fields { + set var_name [lindex $var_spec 0] + if {[llength $var_spec] > 1} { + set var_value [uplevel subst \{[lindex $var_spec 1]\}] + } else { + upvar 1 $var_name upvar_variable + if {[info exists upvar_variable]} { + set crvd_$var_name $upvar_variable + set var_value ":crvd_$var_name" + } else { + set var_value "null" + } + } + lappend columns $var_name + lappend values $var_value + } + + # LEED context_id and similar fields should be passed in using the # -defaults { context_id 1234 } argument @@ -274,161 +317,162 @@ set type_dform $dform } - # Add attributes to $columns and associated bind variables to $values - # for each type - if {[info exists type_dforms($type)]} { - set type_dform $type_dforms($type) - } else { - set type_dform $dform - } # get the attribute metadata for the object type dtype::get_attributes -name $type \ -start_with $type \ attributes dtype::form::metadata::widgets -object_type $type \ -dform $type_dform \ + -exclude_static_p $exclude_static_p \ -indexed_array widgets set size [template::multirow size attributes] for {set i 1} {$i <= $size} {incr i} { template::multirow get attributes $i + # exclude specified widgets + if {[lsearch -exact $exclude $attributes(name)] > -1} { + continue + } + set crv_$attributes(name) "" - ns_log debug "PROCESSING: $attributes(name)" + ns_log notice "PROCESSING: $attributes(name)" if {[info exists widgets($attributes(attribute_id))]} { - ns_log debug "PROCESSING: found $attributes(name) in form" + ns_log notice "PROCESSING: found $attributes(name) in form" # first check for the attribute in the submitted form array set this_widget_info $widgets($attributes(attribute_id)) switch $this_widget_info(widget) { file {} - checkbox - - multiselect { - set crv_$attributes(name) [template::element::get_values \ - $form \ - ${prefix}$attributes(name)] + checkbox - multiselect { + set crv_$attributes(name) [template::element::get_values $form ${prefix}$attributes(name)] } default { - set crv_$attributes(name) [template::element::get_value \ - $form \ - ${prefix}$attributes(name)] + set crv_$attributes(name) [template::element::get_value $form ${prefix}$attributes(name)] } } } elseif {[info exists default($attributes(name))]} { ns_log debug "PROCESSING: using supplied default for $attributes(name)" - - if {![string equal [set crv_$attributes(name)] ""]} { - + if {[empty_string_p [set crv_$attributes(name)]]} { # second check if the caller supplied a default value set crv_$attributes(name) $default($attributes(name)) + } - } elseif {$new_p && - ![string equal $attributes(default_value) ""]} { - ns_log debug "PROCESSING: using attribute default for $attributes(name)" + } elseif {$new_p && ![empty_string_p $attributes(default_value)]} { + ns_log debug "PROCESSING: using attribute default for $attributes(name)" - # if we are inserting a new object then use the attributes - # default value - set crv_$attributes(name) $attributes(default_value) + # if we are inserting a new object then use the attributes + # default value + set crv_$attributes(name) $attributes(default_value) - } elseif {!$new_p} { - ns_log debug "PROCESSING: using existing value for $attributes(name) (ie. adding it to missing columns)" + } elseif {!$new_p} { + ns_log debug "PROCESSING: using existing value for $attributes(name) (ie. adding it to missing columns)" - # append the column to missing columns so that the value - # is copied from the previous revision when we are dealing - # with content types - lappend missing_columns $attributes(column_name) + # append the column to missing columns so that the value + # is copied from the previous revision when we are dealing + # with content types + if {[lsearch -exact {creation_date last_modified modifying_ip} $attributes(name)] == -1} { + lappend missing_columns $attributes(column_name) + } + } - } - if {![string equal [set crv_$attributes(name)] ""]} { - lappend columns $attributes(column_name) + if {![empty_string_p [set crv_$attributes(name)]] && [lsearch -exact $columns $attributes(name)] == -1} { + lappend columns $attributes(column_name) - # cast the value to the appropriate datatype - switch $attributes(datatype) { - date - - time_of_day - - timestamp { - lappend values [template::util::date::get_property \ - sql_date \ - [lindex [set crv_$attributes(name)] 0]] - } - default { - lappend values ":crv_$attributes(name)" - } - } - } + # cast the value to the appropriate datatype + switch $attributes(datatype) { + date - time_of_day - timestamp { + lappend values [template::util::date::get_property sql_date [lindex [set crv_$attributes(name)] 0]] + } + default { + lappend values ":crv_$attributes(name)" + } + } } } + } - ####################################################### - # Perform the insert or update as appropriate - # - if {$content_type_p} { - db_transaction { - if {$new_p} { - db_dml insert_statement " + ####################################################### + # Perform the insert or update as appropriate + # + + # title, description, object_title + if {$content_type_p} { + set pos [lsearch -exact $columns package_id] + set columns [lreplace $columns $pos $pos object_package_id] + set columns [concat "item_id" "revision_id" $columns] + set values [concat ":item_id" ":object_id" $values] + + db_transaction { + if {$new_p} { + db_dml insert_statement " insert into ${type_info(table_name)}i - ([join [concat "item_id" "revision_id" $columns] ", "]) + ([join $columns ", "]) values - ([join [concat ":item_id" ":object_id" $values] ", "])" - } else { - set latest_revision [content::item::get_latest_revision -item_id $item_id] + ([join $values ", "])" + } else { + set latest_revision [content::item::get_latest_revision -item_id $item_id] + set object_id [db_nextval acs_object_id_seq] - db_dml insert_statement " + db_dml insert_statement " insert into ${type_info(table_name)}i - ([join [concat "item_id" "revision_id" $columns $missing_columns] ", "]) + ([join [concat $columns $missing_columns] ", "]) select - [join [concat ":item_id" ":object_id" $values $missing_columns] ", "] + [join [concat $values $missing_columns] ", "] from ${type_info(table_name)}i where revision_id = $latest_revision" - } + } - set revision_ids [db_list get_revision_ids {}] - set revision_id [lindex $revision_ids 0] - set prev_revision_id [lindex $revision_ids 1] + content::item::set_live_revision -revision_id $object_id - if {[string equal $cr_widget none] || - ([string equal $cr_widget file] && - [string equal $tmp_file ""])} { + set revision_ids [db_list get_revision_ids {}] + set revision_id [lindex $revision_ids 0] + set prev_revision_id [lindex $revision_ids 1] - # either a content widget wasn't included in the form or - # no new file was uploaded, so we want to preserve the previous - # revisions content - if {![string equal $prev_revision_id ""]} { - db_dml update_content {} - } - } else { - dtype::upload_content -item_id $item_id \ - -revision_id $revision_id \ - -file $tmp_file \ - -storage_type $cr_storage + if {[string equal $cr_widget none] || + ([string equal $cr_widget file] && + [string equal $tmp_file ""])} { - ns_unlink $tmp_file - } - } - } else { - if {$new_p} { - db_dml insert_statement " + # either a content widget wasn't included in the form or + # no new file was uploaded, so we want to preserve the previous + # revisions content + if {![string equal $prev_revision_id ""]} { + db_dml update_content {} + } + } else { + dtype::upload_content -item_id $item_id \ + -revision_id $revision_id \ + -file $tmp_file \ + -storage_type $cr_storage + + ns_unlink $tmp_file + } + } + } else { + if {$new_p} { + db_dml insert_statement " insert into ${type_info(table_name)}i ([join $columns ", "]) values ([join $values ", "])" - } else { - set updates [list] + } else { + set updates [list] - set all_columns [concat $columns $missing_columns] - set all_values [concat $values $missing_columns] + set all_columns [concat $columns $missing_columns] + set all_values [concat $values $missing_columns] - set length [llength $all_columns] - for {set i 0} {$i < $length} {incr i} { - lappend updates "[lindex $all_columns $i] = [lindex $all_values $i]" - } + set length [llength $all_columns] + for {set i 0} {$i < $length} {incr i} { + lappend updates "[lindex $all_columns $i] = [lindex $all_values $i]" + } - db_dml update_statement " + db_dml update_statement " update ${type_info(table_name)}i set [join $updates ", "] where $type_info(id_column) = :object_id" - } - } + } } + + return $object_id } ad_proc -private dtype::form::add_type_elements { @@ -441,6 +485,8 @@ {-overrides {}} {-cr_widget textarea} {-cr_widget_options {}} + {-exclude_static_p 0} + {-exclude {}} } { Adds the elements of the specified or implicit object form to the specified template form. @@ -456,12 +502,14 @@ array set override $overrides set new_p [string equal $object(object_id) ""] + ns_log notice "\#\#\# new_p: $new_p" ############################################################ # Get the widget metadata # dtype::form::metadata::widgets -object_type $object_type \ -dform $dform \ + -exclude_static_p $exclude_static_p \ -multirow widgets dtype::form::metadata::params -object_type $object_type \ @@ -479,6 +527,11 @@ set html_options [list] set widget_options [list] + # exclude specified widgets + if {[lsearch -exact $exclude $widgets(attribute_name)] > -1} { + continue + } + # set the default values for overridable options set overridables(label) $widgets(pretty_name) @@ -751,6 +804,7 @@ {-dform:required} {-multirow {}} {-indexed_array {}} + {-exclude_static_p 0} } { Returns the widget metadata for the specified object_type and dform as either a multirow or an indexed array. @@ -797,7 +851,9 @@ set metadata [dtype::form::metadata::widgets_list \ -object_type $object_type \ + -exclude_static_p $exclude_static_p \ -dform $dform] + foreach widget $metadata { if {$multirow_p} { eval "template::multirow append \$multirow $widget" @@ -815,6 +871,7 @@ {-no_cache:boolean} {-object_type:required} {-dform:required} + {-exclude_static_p 0} } { Returns a list of lists with the widget metadata for the specified object_type and dform. @@ -824,9 +881,13 @@ @param no_cache does not attempt to use the cache to retrieve the info } { if {$no_cache_p} { - return [db_list_of_lists select_dform_metadata {}] + if {$exclude_static_p} { + return [db_list_of_lists select_dform_metadata_dynamic {}] + } else { + return [db_list_of_lists select_dform_metadata {}] + } } else { - return [util_memoize "dtype::form::metadata::widgets_list -no_cache -object_type \"$object_type\" -dform \"$dform\""] + return [util_memoize "dtype::form::metadata::widgets_list -no_cache -object_type \"$object_type\" -dform \"$dform\" -exclude_static_p $exclude_static_p"] } } Index: openacs-4/packages/dynamic-types/tcl/form-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/tcl/form-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dynamic-types/tcl/form-procs.xql 14 Feb 2005 14:33:28 -0000 1.1 +++ openacs-4/packages/dynamic-types/tcl/form-procs.xql 26 May 2005 10:27:58 -0000 1.2 @@ -1,40 +1,49 @@ + + + select object_id + from acs_objects + where object_id = :object_id + + + update cr_revisions set content = (select content from cr_revisions where revision_id = :prev_revision_id) - + - select attribute_id, - object_type, - table_name, - attribute_name, - pretty_name, - pretty_plural, - sort_order, - datatype, - default_value, - min_n_values, - max_n_values, - storage, - static_p, - column_name, - form_id, - form_name, - element_id, - widget, - is_required + select attribute_id, object_type, table_name, attribute_name, + pretty_name, pretty_plural, sort_order, datatype, + default_value, min_n_values, max_n_values, storage, + static_p, column_name, form_id, form_name, element_id, + widget, is_required from dtype_form_elements_all where object_type = :object_type and form_name = :dform order by sort_order + + + select e.attribute_id, object_type, table_name, attribute_name, + pretty_name, pretty_plural, sort_order, datatype, + default_value, min_n_values, max_n_values, storage, + static_p, column_name, form_id, form_name, element_id, + widget, is_required + from dtype_form_elements_all e, dtype_attributes a + where object_type = :object_type + and form_name = :dform + and e.attribute_id = a.attribute_id + order by sort_order + + + select ea.element_id, @@ -118,6 +127,16 @@ + + + + select table_name, id_column + from acs_object_types + where object_type = :object_type + + + +