Index: openacs-4/contrib/packages/bcms-ui-base/resources/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms-ui-base/resources/search.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/bcms-ui-base/resources/search.tcl 4 Oct 2003 08:44:51 -0000 1.2 +++ openacs-4/contrib/packages/bcms-ui-base/resources/search.tcl 5 Oct 2003 12:28:03 -0000 1.3 @@ -1,21 +1,17 @@ -ad_page_contract { - display search results +# display search results - supply the following vars: - name_search:optional - title_search:optional - content_search:optional - content_type_search:optional - {display_search_results:optional 0} - {bulk_actions:optional ""} - {bulk_action_export_vars:optional ""} - {orderby:optional} - {page:optional} +# supply the following vars: +# name_search:optional +# title_search:optional +# content_search:optional +# content_type_search:optional +# {display_search_results:optional 0} +# {bulk_actions:optional ""} +# {bulk_action_export_vars:optional ""} +# {orderby:optional} +# {page:optional} -} { -} - if {[info exists name_search] && [empty_string_p $name_search]} { unset name_search } @@ -28,6 +24,15 @@ if {[info exists content_type_search] && [empty_string_p $content_type_search]} { unset content_type_search } +if {![info exists display_search_results]} { + set display_search_results 0 +} +if {![info exists bulk_actions]} { + set bulk_actions "" +} +if {![info exists bulk_action_export_vars]} { + set bulk_action_export_vars "" +} if {$display_search_results} { @@ -52,14 +57,18 @@ # on the local tcl name space and also add them to the filters set bulk_action_export_vars_filter "" foreach export_var $bulk_action_export_vars { - upvar 1 $export_var $export_var + if {![info exists $export_var]} { + # lets just make sure that it does not exist on the local namespace + upvar 1 $export_var $export_var + } append bulk_action_export_vars_filter " $export_var { add_url_eval {[export_vars $export_var]} } " } set filters " + $bulk_action_export_vars_filter display_search_results {} title_search { where_clause {title ilike '%' || :title_search || '%'} @@ -71,7 +80,6 @@ content_type_search { where_clause {content_type = :content_type_search} } - $bulk_action_export_vars_filter " template::list::create \ @@ -138,10 +146,15 @@ template::element::create simpleform name_search -widget text -label "Name" -datatype string -optional template::element::create simpleform title_search -widget text -label "Title" -datatype string -optional template::element::create simpleform content_search -widget text -label "Published Content" -datatype string -optional + if {[exists_and_not_null content_type_search]} { + template::element::create simpleform content_type_search -widget hidden -value $content_type_search + } template::element::create simpleform display_search_results -widget hidden -value 1 foreach export_var $bulk_action_export_vars { upvar 1 $export_var export_var_local - template::element::create simpleform $export_var -widget hidden -value $export_var_local -datatype string + if {![template::element::exists simpleform $export_var]} { + template::element::create simpleform $export_var -widget hidden -value $export_var_local -datatype string + } } # we need to put this dummy one even we dont use it