Index: openacs-4/packages/contacts/lib/contacts.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/contacts/lib/contacts.adp 8 Sep 2005 18:04:47 -0000 1.3
+++ openacs-4/packages/contacts/lib/contacts.adp 9 Sep 2005 22:19:22 -0000 1.4
@@ -1,7 +1,9 @@
+
- You can extend this search by:
-
+ #contacts.You_can_extend#
+
+
Index: openacs-4/packages/contacts/lib/contacts.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.tcl,v
diff -u -r1.23 -r1.24
--- openacs-4/packages/contacts/lib/contacts.tcl 8 Sep 2005 18:04:47 -0000 1.23
+++ openacs-4/packages/contacts/lib/contacts.tcl 9 Sep 2005 22:19:22 -0000 1.24
@@ -8,6 +8,7 @@
set _format "normal"
set _page_size "25"
set _tasks_interval "7"
+set admin_p 0
foreach required_param $required_param_list {
set $required_param [ns_queryget $default_param]
@@ -35,10 +36,10 @@
set group_where_clause ""
# Also we can extend this search.
# Is to allow extend the list by any extend_options defined in contact_extend_options
- set available_options [contact::extend::get_options -ignore_extends $extend_values]
+ set available_options [contact::extend::get_options -ignore_extends $extend_values -search_id $search_id]
ad_form -name extend -form {
{extend_option:text(select),optional
- {label "Available Options" }
+ {label "[_ contacts.Available_Options]" }
{options {{" - - - - - - -" ""} $available_options}}
}
{search_id:text(hidden)
@@ -113,6 +114,7 @@
template::multirow append bulk_acts "[_ contacts.Remove_From_Group]" "${base_url}group-parties-remove" "[_ contacts.lt_Remove_from_this_Grou]"
template::multirow append bulk_acts "[_ contacts.Mail_Merge]" "${base_url}message" "[_ contacts.lt_E-mail_or_Mail_the_se]"
if { [permission::permission_p -object_id $package_id -privilege "admin"] } {
+ set admin_p 1
template::multirow append bulk_acts "[_ contacts.Bulk_Update]" "${base_url}bulk-update" "[_ contacts.lt_Bulk_update_the_seclected_C]"
}
callback contacts::bulk_actions -multirow "bulk_acts"
@@ -163,6 +165,12 @@
checkbox {} \
contact {}]
+if { [exists_and_not_null search_id] } {
+ # We get all the default values for that are mapped to this search_id
+ set default_values [db_list_of_lists get_default_extends { }]
+ set extend_values [concat $default_values $extend_values]
+}
+
# For each extend value we add the element to the list and to the query
set extend_query ""
foreach value $extend_values {
@@ -174,7 +182,10 @@
lappend row_list $name [list]
append extend_query "( $sub_query ) as $name,"
}
-
+set actions [list]
+if { $admin_p && [exists_and_not_null search_id] } {
+ set actions [list "[_ contacts.Set_default_extend]" "admin/ext-search-options?search_id=$search_id" "[_ contacts.Set_default_extend]" ]
+}
template::list::create \
-html {width 100%} \
-name "contacts" \
@@ -186,7 +197,7 @@
-page_size $page_size \
-page_flush_p t \
-page_query_name contacts_pagination \
- -actions "" \
+ -actions $actions \
-bulk_actions $bulk_actions \
-bulk_action_method post \
-bulk_action_export_vars { search_id return_url } \
Index: openacs-4/packages/contacts/lib/contacts.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.xql,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/contacts/lib/contacts.xql 8 Sep 2005 18:04:47 -0000 1.10
+++ openacs-4/packages/contacts/lib/contacts.xql 9 Sep 2005 22:19:22 -0000 1.11
@@ -36,4 +36,15 @@
+
+
+ select
+ extend_id
+ from
+ contact_search_extend_map
+ where
+ search_id = :search_id
+
+
+
Index: openacs-4/packages/contacts/tcl/contact-extend-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-extend-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/contacts/tcl/contact-extend-procs.tcl 8 Sep 2005 18:05:19 -0000 1.1
+++ openacs-4/packages/contacts/tcl/contact-extend-procs.tcl 9 Sep 2005 22:18:49 -0000 1.2
@@ -54,17 +54,20 @@
ad_proc -public contact::extend::get_options {
{-ignore_extends ""}
+ -search_id:required
} {
Returns a list of the form { pretty_name extend_id } of all available extend options in
- contact_extend_options
+ contact_extend_options, if search_id is passed then ignore the extends in
+ contact_search_extend_map
@param ignore_extends A list of extend_id's to ignore on the result
} {
- set extra_query ""
+ set extra_query "where extend_id not in (select extend_id from contact_search_extend_map where search_id = $search_id)"
if { ![empty_string_p $ignore_extends] } {
set ignore_extends [join $ignore_extends ","]
- append extra_query "where extend_id not in ($ignore_extends)"
+ append extra_query "and extend_id not in ($ignore_extends)"
}
+
return [db_list_of_lists get_options " "]
}
Index: openacs-4/packages/contacts/www/admin/ext-search-options.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/ext-search-options.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/contacts/www/admin/ext-search-options.adp 8 Sep 2005 18:15:49 -0000 1.1
+++ openacs-4/packages/contacts/www/admin/ext-search-options.adp 9 Sep 2005 22:18:03 -0000 1.2
@@ -2,10 +2,27 @@
@page_title;noquote@
@context;noquote@
-
+
+
+
- #contacts.Stored_extended#:
+
+ #contacts.Stored_extended#:
-
\ No newline at end of file
+
+
+
+ #contacts.Stored_extended_default#:
+
+
+
+
+ #contacts.Remove_default_options#:
+
+
+
+
+
+#contacts.Go_to_search_results#
\ No newline at end of file
Index: openacs-4/packages/contacts/www/admin/ext-search-options.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/ext-search-options.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/contacts/www/admin/ext-search-options.tcl 8 Sep 2005 18:15:49 -0000 1.1
+++ openacs-4/packages/contacts/www/admin/ext-search-options.tcl 9 Sep 2005 22:18:03 -0000 1.2
@@ -9,6 +9,7 @@
{edit_p "f"}
{delete_p "f"}
{orderby "var_name,asc"}
+ {search_id ""}
}
set page_title [_ contacts.Extended_search_opt]
@@ -89,9 +90,35 @@
set edit_url "ext-search-options?extend_id=@ext_options.extend_id@&edit_p=t"
set delete_url "ext-search-options?extend_id=@ext_options.extend_id@&delete_p=t"
+set row_list [list]
+set bulk_actions [list]
+set extra_query ""
+if { ![exists_and_not_null search_id] } {
+ lappend row_list \
+ action_buttons [list]
+} else {
+ set extra_query "where extend_id not in (select extend_id from contact_search_extend_map where search_id = $search_id)"
+ lappend bulk_actions "[_ contacts.Set_default]" set-default "[_ contacts.Stored_extended_default]"
+ lappend row_list \
+ checkbox [list]
+}
+
+lappend row_list \
+ var_name [list] \
+ pretty_name [list] \
+ subquery [list] \
+ description [list]
+
template::list::create \
-name ext_options \
+ -key extend_id \
+ -actions "" \
+ -html {width 100%} \
-multirow ext_options \
+ -bulk_actions $bulk_actions \
+ -bulk_action_method post \
+ -bulk_action_export_vars { search_id } \
+ -selected_format "normal" \
-elements {
action_buttons {
display_template {
@@ -116,6 +143,8 @@
label "[_ contacts.Description]"
html { width 25% }
}
+ } -filters {
+ search_id {}
} -orderby {
var_name {
label "[_ contacts.Var_name]"
@@ -127,6 +156,57 @@
orderby_asc "pretty_name asc"
orderby_desc "pretty_name desc"
}
+ } -formats {
+ normal {
+ label "[_ contacts.Table]"
+ layout table
+ row {
+ $row_list
+ }
+ }
}
db_multirow ext_options ext_options " "
+
+
+########################### Remove Default List ####################################
+
+set def_extra_query ""
+if { [exists_and_not_null search_id] } {
+ set def_extra_query "where extend_id in (select extend_id from contact_search_extend_map where search_id = $search_id)"
+}
+set def_bulk_actions [list "[_ contacts.Remove_default]" remove-default "[_ contacts.Remove_default_options]"]
+
+template::list::create \
+ -name def_ext_options \
+ -key extend_id \
+ -actions "" \
+ -html {width 100%} \
+ -multirow def_ext_options \
+ -bulk_actions $def_bulk_actions \
+ -bulk_action_method post \
+ -bulk_action_export_vars { search_id } \
+ -selected_format "normal" \
+ -elements {
+ var_name {
+ label "[_ contacts.Var_name]"
+ html { width 10% }
+ }
+ pretty_name {
+ label "[_ contacts.Pretty_name]"
+ html { width 10% }
+ }
+ subquery {
+ label "[_ contacts.Subquery]"
+ html { width 45% }
+ }
+ description {
+ label "[_ contacts.Description]"
+ html { width 25% }
+ }
+ } -filters {
+ search_id {}
+ }
+
+db_multirow def_ext_options def_ext_options " "
+
Index: openacs-4/packages/contacts/www/admin/ext-search-options.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/ext-search-options.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/contacts/www/admin/ext-search-options.xql 8 Sep 2005 18:15:49 -0000 1.1
+++ openacs-4/packages/contacts/www/admin/ext-search-options.xql 9 Sep 2005 22:18:03 -0000 1.2
@@ -7,8 +7,19 @@
*
from
contact_extend_options
+ $extra_query
[template::list::orderby_clause -orderby -name "ext_options"]
+
+
+ select
+ *
+ from
+ contact_extend_options
+ $def_extra_query
+
+
+
\ No newline at end of file
Index: openacs-4/packages/contacts/www/admin/remove-default.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/remove-default.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/www/admin/remove-default.tcl 9 Sep 2005 22:18:28 -0000 1.1
@@ -0,0 +1,18 @@
+#packages/contacts/www/admin/remove-default.tcl
+ad_page_contract {
+ Remove the default extended options map to one search_id
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Network www.viaro.net
+ @creation-date 2005-09-08
+} {
+ extend_id:multiple,notnull
+ search_id:integer,notnull
+}
+
+foreach value $extend_id {
+ db_dml unmap_extend_id {
+ delete from contact_search_extend_map where search_id = :search_id and extend_id = :value
+ }
+}
+
+ad_returnredirect [get_referrer]
\ No newline at end of file
Index: openacs-4/packages/contacts/www/admin/set-default.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/set-default.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/www/admin/set-default.tcl 9 Sep 2005 22:18:28 -0000 1.1
@@ -0,0 +1,19 @@
+#packages/contacts/www/admin/remove-default.tcl
+ad_page_contract {
+ Set the default extended options to one search_id
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Network www.viaro.net
+ @creation-date 2005-09-08
+} {
+ extend_id:multiple,notnull
+ search_id:integer,notnull
+}
+
+foreach value $extend_id {
+ db_dml map_extend_id {
+ insert into contact_search_extend_map (search_id,extend_id)
+ values (:search_id, :value)
+ }
+}
+
+ad_returnredirect [get_referrer]
\ No newline at end of file