Index: openacs-4/packages/assessment/www/asm-admin/admin-request.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/admin-request.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/admin-request.adp 4 Feb 2005 21:14:22 -0000 1.1 @@ -0,0 +1,52 @@ + +#assessment.Request# #assessment.Administration# +@context;noquote@ + + + + + + + +
+ + + + +
+ + +
+ + + Index: openacs-4/packages/assessment/www/asm-admin/admin-request.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/admin-request.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/admin-request.tcl 4 Feb 2005 21:14:22 -0000 1.1 @@ -0,0 +1,183 @@ +ad_page_contract { + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) + @creation_date 2005-01-17 + +} { + {assessment:optional} + {interval:optional} + {date:optional} + {state:optional} + +} -properties { + context +} +set party_id [ad_conn user_id] +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +set permission "" + + + +# shows not approved requests as default + + +# set options +set approved_options [as::assessment::check::state_options] +set assessment_list [as::assessment::check::get_assessments] +set intervals [as::assessment::check::intervals] + +set context [list "[_ assessment.Request] [_ assessment.Administration]"] + +# set default values + +set d_state "f" +set d_assessment [lindex [lindex $assessment_list 0] 1] +set d_interval [lindex [lindex $intervals 0] 1] +set d_date "" +set date_query "" +set interval_query "" +set assessment_query "" +set state_query "" + +if {[exists_and_not_null assessment] && $assessment!="all"} { + permission::require_permission -object_id $assessment -privilege admin + if {[permission::permission_p -object_id $package_id -party_id $party_id -privilege admin] == 0} { + set permission "and c.assessment_id in (select object_id from acs_permissions where grantee_id=:party_id and privilege='admin')"} + + as::assessment::data -assessment_id $assessment + set d_assessment $assessment + set new_assessment_revision $assessment_data(assessment_rev_id) + + set assessment_query "and c.section_id_from in (select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm where ci.item_id = cr.item_id and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id = :new_assessment_revision)" +} + +if {[exists_and_not_null state]} { + set d_state $state + +} + +if {[exists_and_not_null interval] && $interval!="all"} { + set d_interval $interval + set interval_query "and to_date(al.date_requested,'YYYY-MM-DD') >= to_date('$interval','YYYY-MM-DD')" + set date_query "" +} + +if {[exists_and_not_null date]} { + set d_date $date + set date_query "and to_date(al.date_requested,'YYYY-MM-DD') = to_date('$date','YYYY-MM-DD')" + set interval_query "" +} + +if { $d_state == "ae"} { + set state_query "and al.failed_p= 'f' and al.approved_p='t'" +} elseif {$d_state =="f"} { + set state_query "and al.approved_p='f'" +} elseif {$d_state == "t"} { + set state_query "and al.failed_p='t' and al.approved_p='t'" +} +# ad_return_complaint 1 "$approved_options" +# ad_script_abort +ad_form -name assessments -form { + {assessment:text(select) + {label "[_ assessment.Assessment]"} + {options $assessment_list} + {html { onChange "get_assessment()"}} + {value $d_assessment} + } + + {state:text(select) + {label ""} + {options "$approved_options"} + {html { onChange "get_state()"}} + {value $d_state} + } + +} -has_submit 1 + + +ad_form -name interval -form { + {date:text(select) + {label "[_ assessment.date_request]"} + {options $intervals} + {value $d_interval} + {html { onChange "get_interval()"}} + } +} -has_submit 1 + + +ad_form -name specific_date -form { + {assessment:text(hidden) + {value $d_assessment} + } + + {state:text(hidden) + {value $d_state} + } + + {specific_date:text(text) + {label "" } + {html {id sel2}} + {after_html {YYYY-MM-DD}} + {value $d_date} + } + + {submit:text(submit) + {label "[_ assessment.specific_date]"} + } +} -on_submit { + ad_returnredirect "admin-request?state=$state&assessment=$assessment&date=$specific_date" +} + + +set query "select c.section_id_from,al.failed_p,al.inter_item_check_id,c.name,al.action_log_id,c.assessment_id,a.name as action_name,a.action_id,(select p.first_names || ' ' || p.last_name as name from persons p where p.person_id = (select subject_id from as_sessions where session_id=al.session_id))as user_name,al.session_id,c.description,al.date_requested from as_actions a, as_actions_log al, as_inter_item_checks c where al.inter_item_check_id=c.inter_item_check_id $assessment_query and c.action_p='t' $state_query and a.action_id=al.action_id $interval_query $date_query $permission and (select latest_revision from cr_items where item_id=c.assessment_id) in (select assessment_id from as_assessments)" + +db_multirow actions_log actions_log $query + +template::list::create \ + -name actions_log \ + -multirow actions_log \ + -key action_log_id\ + -bulk_actions { + "\#assessment.approve\#" "approve-check" "\#assessment.approve_actions\#" + "\#assessment.bulk_mail_send\#" "bulk-mail" "\#assessment.bulk_mail\#" + }\ + -bulk_action_method post \ + -bulk_action_export_vars { + d_assessment + d_state + d_interval + d_date + }\ + -row_pretty_plural "[_ assessment.action_log]"\ + -elements { + inter_item_check_id { + label "[_ assessment.trigger]" + display_col name + + } + action_id { + label "[_ assessment.action]" + display_col action_name + } + description { + label "[_ assessment.Description]" + } + + user_name { + label "[_ assessment.User_ID]" + } + date_requested { + label "[_ assessment.data_type_date]" + } + failed_p { + label "[_ assessment.performed]" + } + notified_users { + label "[_ assessment.notified_users]" + display_template {[_ assessment.notified_users]} + } + + + + } + Index: openacs-4/packages/assessment/www/asm-admin/approve-check.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/approve-check.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/approve-check.tcl 4 Feb 2005 21:14:22 -0000 1.1 @@ -0,0 +1,24 @@ +ad_page_contract { + This page deletes checks + @author Anny Flores (annyflores@viaro.net) Viaro Networks + @date 2005-01-17 +} { + action_log_id:multiple + d_assessment + d_state + d_interval + d_date + + } + +set count [llength $action_log_id] + +for { set i 0} { $i< $count } {incr i} { + set log_id [lindex $action_log_id $i] + set inter_item_check_id [db_string get_check_id {select inter_item_check_id from as_actions_log where action_log_id=:log_id}] + set session_id [db_string get_session_id {select session_id from as_actions_log where action_log_id=:log_id}] + + + as::assessment::check::manual_action_exec -inter_item_check_id $inter_item_check_id -session_id $session_id -action_log_id $log_id +} +ad_returnredirect "admin-request?assessment=$d_assessment&state=$d_state&interval=$d_interval&date=$d_date" \ No newline at end of file Index: openacs-4/packages/assessment/www/asm-admin/bulk-mail.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/bulk-mail.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/bulk-mail.adp 4 Feb 2005 21:14:22 -0000 1.1 @@ -0,0 +1,7 @@ + + +@spam_name@ +@context_bar@ + + + Index: openacs-4/packages/assessment/www/asm-admin/bulk-mail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/bulk-mail.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/bulk-mail.tcl 4 Feb 2005 21:14:22 -0000 1.1 @@ -0,0 +1,105 @@ +ad_page_contract { + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) +} { + action_log_id:multiple + d_assessment + d_date + d_interval + d_state +} + +if {[llength $action_log_id] == 1} { +set action_log_id [split [lindex $action_log_id 0] " "] +} + +set users_list "(" + +for {set i 0} {$i < [llength $action_log_id]} {incr i} { + set action_id [lindex $action_log_id $i] + set subject_id [db_string subject {select subject_id from as_sessions where session_id=(select session_id from as_actions_log where action_log_id=:action_id)}] + append users_list "$subject_id," +} + +set users_list [string range $users_list 0 [expr [string length $users_list] -2]] +append users_list ")" + +set query "select email from cc_users where object_id in $users_list" + +set spam_name [bulk_mail::parameter -parameter PrettyName -default [_ dotlrn.Spam_]] + +set sender_id [ad_conn user_id] +set context_bar "" +set portal_id "" + +set users [db_list_of_lists get_users $query] + + +form create spam_message + +element create spam_message subject \ + -label [_ dotlrn.Subject] \ + -datatype text \ + -widget text \ + -html {size 60} + +element create spam_message message \ + -label [_ dotlrn.Message] \ + -datatype text \ + -widget textarea \ + -html {rows 10 cols 80 wrap soft} + + +element create spam_message format \ + -label "Format" \ + -datatype text \ + -widget select \ + -options {{"Preformatted Text" "pre"} {"Plain Text" "plain"} {HTML "html"}} + +element create spam_message d_date\ + -widget hidden\ + -datatype date\ + -value $d_date +element create spam_message d_assessment \ + -widget hidden\ + -datatype text\ + -value $d_assessment +element create spam_message d_interval\ + -widget hidden\ + -datatype text\ + -value $d_interval +element create spam_message d_state \ + -widget hidden\ + -datatype text\ + -value $d_state +element create spam_message action_log_id \ + -widget hidden\ + -datatype text\ + -value $action_log_id + +element create spam_message send_date \ + -label [_ dotlrn.Send_Date] \ + -datatype date \ + -widget date \ + -format {MONTH DD YYYY HH12 MI AM} \ + -value [template::util::date::now_min_interval] + +if {[form is_valid spam_message]} { + form get_values spam_message \ + subject message send_date format d_date d_state d_assessment action_log_id d_interval + ns_log notice "antes del bulk-mail" + set id [bulk_mail::new \ + -from_addr annyflores@viaro.net\ + -send_date $send_date\ + -date_format "YYYY MM DD HH24 MI SS" \ + -subject "$subject" \ + -message $message \ + -query $query] + ns_log notice "despues del bulk-mail $id" + ad_returnredirect "admin-request?assessment=$d_assessment&state=$d_state&interval=$d_interval&date=$d_date" +} + + + + + +