Index: openacs-4/contrib/packages/classified-ads/www/admin/field-addedit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/field-addedit.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/contrib/packages/classified-ads/www/admin/field-addedit.tcl 29 Jul 2003 02:03:09 -0000 1.2 +++ openacs-4/contrib/packages/classified-ads/www/admin/field-addedit.tcl 29 Jul 2003 09:10:42 -0000 1.3 @@ -14,7 +14,7 @@ {default_value:nohtml ""} {widget:nohtml text} {label:nohtml ""} - {keyword_id:integer ""} + {keyword_id:integer 0} {html_options:nohtml ""} {select_options:nohtml ""} {validate:nohtml ""} @@ -30,6 +30,9 @@ set content_type "ca_ad" set package_id [ad_conn package_id] +set indent_pattern "-" +set indent_factor 2 +set main_category_id [classified-ads::main_keyword_exists_p] template::form create new_field @@ -44,7 +47,7 @@ set title "Edit Field" set context [list [list "fields" "Fields"] "Edit Field"] set cant_edit_html "onfocus \"blur();\" style \"background: #d3d3d3\"" - set column_spec "unknown" + set column_spec [db_string get_column_spec {}] ## Widget values db_0or1row widget_vars { } @@ -75,6 +78,20 @@ -html "size 30" \ -value $pretty_plural +# +# RBM: FIXME: We should allow adding of site-wide fields here. In order to +# realize that we need to give the main root category as argument to the user. +# Figure out how. +# + +template::element create new_field keyword_id \ + -widget select \ + -datatype integer \ + -label "Category" \ + -help_text "The category to which this new field will belong to. A category of name \"classified-ads-package-xxx\" means the main category for this package instance, and the field will be available to all its subcategories." \ + -options [db_list_of_lists categories { }] \ + -value $keyword_id + template::element create new_field datatype \ -widget select \ -datatype text \ @@ -211,7 +228,7 @@ if {![empty_string_p $extra_help_text]} { append extra_options " -help_text \"" - append extra_options $help_text + append extra_options $extra_help_text append extra_options "\"" } @@ -225,6 +242,7 @@ db_1row attribute_new { } db_1row widget_new { } } + util_memoize_flush "classified-ads::categories::get_custom_fields -keyword_id $keyword_id" } ad_returnredirect "fields" }