Index: openacs-4/packages/ecommerce/www/admin/customer-service/spam-log.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/spam-log.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/customer-service/spam-log.adp 25 Aug 2008 00:44:12 -0000 1.1 @@ -0,0 +1,12 @@ +<master> + <property name="doc(title)">@title;noquote@</property> + <property name="context">@context;noquote@</property> +<h2>@title@</h2> + +@form_alter_date_html;noquote@ + +<table border> +<tr><th>Date</th><th>To</th><th>Text</th></tr> +@rows_to_return;noquote@ +</table> + Index: openacs-4/packages/ecommerce/www/admin/customer-service/spam-log.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/spam-log.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ecommerce/www/admin/customer-service/spam-log.tcl 9 Mar 2004 00:59:47 -0000 1.4 +++ openacs-4/packages/ecommerce/www/admin/customer-service/spam-log.tcl 25 Aug 2008 00:44:11 -0000 1.5 @@ -1,5 +1,4 @@ # spam-log.tcl - ad_page_contract { @param use_date_range_p:optional @@ -14,54 +13,30 @@ ad_require_permission [ad_conn package_id] admin -proc spam_to_summary { mailing_list_category_id mailing_list_subcategory_id mailing_list_subsubcategory_id user_class_id product_id full_last_visit_start_date full_last_visit_end_date } { +set title "Spam Log" +set context [list [list index "Customer Service"] $title] + +set form_alter_date_html "<form method=post action=\"[ad_conn url]\"> +[ec_report_date_range_widget $start_date(date) $end_date(date)] +[export_form_vars use_date_range_p]<input type=submit value=\"Alter date range\"></form>" + +set start $start_date(date) +set end $end_date(date) + +set rows_to_return "" +db_foreach get_spam_people "select spam_text, mailing_list_category_id, mailing_list_subcategory_id, mailing_list_subsubcategory_id, user_class_id, product_id, to_char(last_visit_start_date,'YYYY-MM-DD HH24:MI:SS') as full_last_visit_start_date, to_char(last_visit_end_date,'YYYY-MM-DD HH24:MI:SS') as full_last_visit_end_date, to_char(spam_date,'YYYY-MM-DD HH24:MI:SS') as full_spam_date from ec_spam_log where (spam_date >= to_date('$start 00:00:00','YYYY-MM-DD HH24:MI:SS') and spam_date <= to_date('$end 23:59:59','YYYY-MM-DD HH24:MI:SS')) order by spam_date desc" { + set members_description "All users" if { ![empty_string_p $mailing_list_category_id] } { - return "Members of the [ec_full_categorization_display $mailing_list_category_id $mailing_list_subcategory_id $mailing_list_subsubcategory_id] mailing list." + set members_description "Members of the [ec_full_categorization_display $mailing_list_category_id $mailing_list_subcategory_id $mailing_list_subsubcategory_id] mailing list." } if { ![empty_string_p $user_class_id] } { - return "Members of the [db_string get_user_class_name "select user_class_name from ec_user_classes where user_class_id=:user_class_id"] user class." + set members_description "Members of the [db_string get_user_class_name "select user_class_name from ec_user_classes where user_class_id=:user_class_id"] user class." } if { ![empty_string_p $product_id] } { - return "Customers who purchased [db_string get_product_name "select product_name from ec_products where product_id=:product_id"] (product ID $product_id)." + set members_description "Customers who purchased [db_string get_product_name "select product_name from ec_products where product_id=:product_id"] (product ID $product_id)." } if { ![empty_string_p $full_last_visit_start_date] } { - return "Users whose last visit to the site was between [ec_formatted_full_date $full_last_visit_start_date] and [ec_formatted_full_date $full_last_visit_end_date]." + set members_description "Users whose last visit to the site was between [ec_formatted_full_date $full_last_visit_start_date] and [ec_formatted_full_date $full_last_visit_end_date]." } - return "All users" + append rows_to_return "<tr><td>[ec_formatted_full_date $full_spam_date]</td><td>${members_description}</td><td>[ec_display_as_html $spam_text]</td>" } - -append doc_body "[ad_admin_header "Spam Log"] -<h2>Spam Log</h2> -[ad_context_bar [list "../index" "Ecommerce([ec_system_name])"] [list "index" "Customer Service Administration"] [list "spam" "Spam Users"] "Spam Log"] - -<hr> -" - -append doc_body "<form method=post action=\"[ad_conn url]\"> -[ec_report_date_range_widget $start_date(date) $end_date(date)] - -[export_form_vars use_date_range_p] -<input type=submit value=\"Alter date range\"> -</form> - -<table border> -<tr><th>Date</th><th>To</th><th>Text</th></tr> -" - -set start $start_date(date) -set end $end_date(date) - -set rows_to_return "" -db_foreach get_spam_people "select spam_text, mailing_list_category_id, mailing_list_subcategory_id, mailing_list_subsubcategory_id, user_class_id, product_id, to_char(last_visit_start_date,'YYYY-MM-DD HH24:MI:SS') as full_last_visit_start_date, to_char(last_visit_end_date,'YYYY-MM-DD HH24:MI:SS') as full_last_visit_end_date, to_char(spam_date,'YYYY-MM-DD HH24:MI:SS') as full_spam_date from ec_spam_log where (spam_date >= to_date('$start 00:00:00','YYYY-MM-DD HH24:MI:SS') and spam_date <= to_date('$end 23:59:59','YYYY-MM-DD HH24:MI:SS')) order by spam_date desc" { - - append rows_to_return "<tr><td>[ec_formatted_full_date $full_spam_date]</td><td>[spam_to_summary $mailing_list_category_id $mailing_list_subcategory_id $mailing_list_subsubcategory_id $user_class_id $product_id $full_last_visit_start_date $full_last_visit_end_date]</td><td>[ec_display_as_html $spam_text]</td>" -} - -append doc_body "$rows_to_return -</table> - -[ad_admin_footer] -" - - -doc_return 200 text/html $doc_body \ No newline at end of file Index: openacs-4/packages/ecommerce/www/admin/customer-service/spam.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/spam.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/customer-service/spam.adp 25 Aug 2008 00:34:18 -0000 1.1 @@ -0,0 +1,28 @@ +<master> + <property name="doc(title)">@title;noquote@</property> + <property name="context">@context;noquote@</property> +<h2>@title@</h2> + +<form method=post action=spam-log> +<p><input type="submit" value="View spam log"> +@report_date_range_widget_html;noquote@ +</p> +</form> + +<ol> + <li><b>Spam all users in a mailing list:</b> @ml_body@</li> + <li><b>Spam all members of a user class:</b> @uc_body@</li> + <li><b>Spam all users who bought this product:</b> + <form method=post action=spam-2>Product SKU: <input type=text name=product_sku size=5><br> + <input type=checkbox name=show_users_p value="t" checked>Show me the users who will be spammed.</br> + <center><input type=submit value="Continue"></center></form></li> + <li><b>Spam all users who viewed this product:</b> + <form method=post action=spam-2>Product SKU: <input type=text name=viewed_product_sku size=5><br> + <input type=checkbox name=show_users_p value="t" checked>Show me the users who will be spammed.<br> + <center><input type=submit value="Continue"></center></form></li> + <li><b>Spam all users who viewed this category:</b> @c_body@</li> + <li><b>Spam all users whose last visit was:</b> + <form method=post action=spam-2>@report_date_range_widget_html;noquote@<br> + <input type=checkbox name=show_users_p value="t" checked>Show me the users who will be spammed.<br> + <center><input type=submit value="Continue"></center></form></li> +</ol> Index: openacs-4/packages/ecommerce/www/admin/customer-service/spam.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/spam.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/ecommerce/www/admin/customer-service/spam.tcl 9 Mar 2004 00:59:47 -0000 1.5 +++ openacs-4/packages/ecommerce/www/admin/customer-service/spam.tcl 25 Aug 2008 00:34:18 -0000 1.6 @@ -1,5 +1,4 @@ # spam.tcl - ad_page_contract { @author @creation-date @@ -13,116 +12,32 @@ set return_url "[ad_conn url]" set customer_service_rep [ad_get_user_id] - if {$customer_service_rep == 0} { ad_returnredirect "/register.tcl?[export_url_vars return_url]" ad_script_abort } -# this proc uses uplevel and assumes the existence of -# it sets the variables start_date and end_date +# this proc uses uplevel and assumes the existence of start_date and end_date +# or sets them if they do not exist ec_report_get_start_date_and_end_date -append doc_body "[ad_admin_header "Spam Users"] -<h2>Spam Users</h2> +set title "Spam Users" +set context [list [list index "Customer Service"] $title] -[ad_context_bar [list "../index.tcl" "Ecommerce([ec_system_name])"] [list "index.tcl" "Customer Service Administration"] "Spam Users"] +set report_date_range_widget_html [ec_report_date_range_widget $start_date(date) $end_date(date)] -<hr> -<form method=post action=spam-log> -<p> -<input type=\"submit\" value=\"View spam log\"> -[ec_report_date_range_widget $start_date(date) $end_date(date)] -</p> -</form> -" - set mailing_list_widget [ec_mailing_list_widget] set user_class_widget [ec_user_class_widget] set only_category_widget [ec_only_category_widget] foreach {v name widget} [list ml_body {Mailing lists} $mailing_list_widget uc_body {User classes} $user_class_widget c_body {Category} $only_category_widget] { if {[string equal [string trim $widget] "<b>none</b>"]} { - set $v " - <p>$name: $widget - No one to spam - <p> - " + set $v "$name: $widget - No one to spam.\n" } else { - set $v " -<form method=post action=spam-2> -$name: $widget<br> -<input type=checkbox name=show_users_p value=\"t\" checked>Show me the users who will be spammed.<br> -<p> -<center> -<input type=submit value=\"Continue\"> -</center> -</form> -" + set $v "<form method=post action=spam-2> +<p>$name: $widget <br><input type=checkbox name=show_users_p value=\"t\" checked>Show me the users who will be spammed.</p> + <center><input type=submit value=\"Continue\"></center></form>\n" } } -append doc_body "<ol> - -<b><li>Spam all users in a mailing list:</b> - -$ml_body - -<b><li>Spam all members of a user class:</b> - -$uc_body - -<p> - -<b><li>Spam all users who bought this product:</b> - -<form method=post action=spam-2> -Product SKU: <input type=text name=product_sku size=5><br> -<input type=checkbox name=show_users_p value=\"t\" checked>Show me the users who will be spammed.<br> -<p> -<center> -<input type=submit value=\"Continue\"> -</center> -</form> - -<p> - -<b><li>Spam all users who viewed this product:</b> - -<form method=post action=spam-2> -Product SKU: <input type=text name=viewed_product_sku size=5><br> -<input type=checkbox name=show_users_p value=\"t\" checked>Show me the users who will be spammed.<br> -<p> -<center> -<input type=submit value=\"Continue\"> -</center> -</form> - -<p> - -<b><li>Spam all users who viewed this category:</b> - -$c_body - -<p> - -<b><li>Spam all users whose last visit was:</b> - -<form method=post action=spam-2> -" - -append doc_body " -[ec_report_date_range_widget $start_date(date) $end_date(date)]<br> -<input type=checkbox name=show_users_p value=\"t\" checked>Show me the users who will be spammed.<br> -<p> -<center> -<input type=submit value=\"Continue\"> -</center> -</form> - -</ol> - -[ad_admin_footer] -" - -doc_return 200 text/html $doc_body - +set report_date_range_widget_html [ec_report_date_range_widget $start_date(date) $end_date(date)]