Index: openacs-4/packages/ae-portlet/ae-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ae-portlet/ae-portlet.info,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ae-portlet/ae-portlet.info 31 Jan 2006 01:41:53 -0000 1.2 +++ openacs-4/packages/ae-portlet/ae-portlet.info 4 Feb 2006 13:49:38 -0000 1.3 @@ -7,13 +7,13 @@ f t - + Anny Flores Anonymous course evaluations portlet 2006-01-31 0 - + Index: openacs-4/packages/ae-portlet/catalog/ae-portlet.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ae-portlet/catalog/ae-portlet.en_US.ISO-8859-1.xml,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ae-portlet/catalog/ae-portlet.en_US.ISO-8859-1.xml 1 Feb 2006 14:35:39 -0000 1.3 +++ openacs-4/packages/ae-portlet/catalog/ae-portlet.en_US.ISO-8859-1.xml 4 Feb 2006 13:49:38 -0000 1.4 @@ -2,9 +2,19 @@ Course Evaluation Admin + Anonymous? + Class + Edit Evaluation + Edit Your Response There should be only one instance of Anon Eval for admin purpose + Finish Evaluation + No evaluations presently available + #NOTE: This is an admin only section for unpublished evaluations Publish + Results + Take Evaluation Title Unpublish Results + View Your Response Index: openacs-4/packages/ae-portlet/www/ae-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ae-portlet/www/Attic/ae-portlet-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ae-portlet/www/ae-portlet-postgresql.xql 31 Jan 2006 01:41:53 -0000 1.2 +++ openacs-4/packages/ae-portlet/www/ae-portlet-postgresql.xql 4 Feb 2006 13:49:38 -0000 1.3 @@ -3,14 +3,15 @@ postgresql7.1 - + select cr.item_id as assessment_id, cr.title, cr.description, a.password, to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time, to_char(now(), 'YYYY-MM-DD HH24:MI:SS') as cur_time, cf.package_id, p.instance_name as community_name, - sc.node_id as comm_node_id, sa.node_id as as_node_id + sc.node_id as comm_node_id, sa.node_id as as_node_id, a.anonymous_p, + a.assessment_id as assessment_rev_id from as_assessments a, cr_revisions cr, cr_items ci, cr_folders cf, site_nodes sa, site_nodes sc, apm_packages p where a.assessment_id = cr.revision_id Index: openacs-4/packages/ae-portlet/www/ae-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ae-portlet/www/ae-portlet.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ae-portlet/www/ae-portlet.adp 9 Jun 2005 05:54:36 -0000 1.1 +++ openacs-4/packages/ae-portlet/www/ae-portlet.adp 4 Feb 2006 13:49:38 -0000 1.2 @@ -1,15 +1,13 @@ - - - - - - -

#assessment.answered_assessments#

- -
+ + + +

+
+ #ae-portlet.lt_NOTE_This_is_an_admin# +

+ -   +   - Index: openacs-4/packages/ae-portlet/www/ae-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ae-portlet/www/ae-portlet.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ae-portlet/www/ae-portlet.tcl 9 Jun 2005 05:54:36 -0000 1.1 +++ openacs-4/packages/ae-portlet/www/ae-portlet.tcl 4 Feb 2006 13:49:38 -0000 1.2 @@ -14,99 +14,108 @@ set shaded_p $config(shaded_p) set list_of_package_ids $config(package_id) -set package_id [lindex $list_of_package_ids 0] set user_id [ad_conn user_id] -set package_admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege "admin"] set dotlrn_admin_p [dotlrn::admin_p -user_id $user_id] -set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0] +set community_id [dotlrn_community::get_community_id] -set elements [list] -if {!$one_instance_p} { - set elements [list community_name \ - [list \ - label "[_ dotlrn.Community]" \ - display_template {@assessments.community_name@ }]] +set groupby community_name + +if { $community_id eq "" } { + set groupby_list { + label "[_ ae-portlet.Class]" + type multivar + values { { "[_ ae-portlet.Class]" { {groupby community_name} } } } + } +} else { + set groupby_list [list] } -lappend elements title \ - [list \ - label "[_ assessment.open_assessments]" \ - display_template {@assessments.title@}] - - -# create a list with all open assessments template::list::create \ -name assessments \ -multirow assessments \ - -key assessment_id \ - -elements $elements \ - -main_class narrow - -# get the information of all open assessments -template::multirow create assessments assessment_id title description assessment_url community_url community_name -set old_comm_node_id 0 -db_foreach open_asssessments {} { - if {([empty_string_p $start_time] || $start_time <= $cur_time) && ([empty_string_p $end_time] || $end_time >= $cur_time)} { - if {$comm_node_id == $old_comm_node_id} { - set community_name "" + -page_flush_p 1 \ + -html { width 100% } \ + -pass_properties { package_admin_p } \ + -elements { + title { + label "" + link_url_col assessment_url } - set community_url [site_node::get_url -node_id $comm_node_id] - set assessment_url [site_node::get_url -node_id $as_node_id] - set old_comm_node_id $comm_node_id - - if {[empty_string_p $password]} { - append assessment_url [export_vars -base "assessment" {assessment_id}] - } else { - append assessment_url [export_vars -base "assessment-password" {assessment_id}] + actions { + label "" + display_template { + + + #ae-portlet.Finish_Evaluation# + + + #ae-portlet.Edit_Your_Response# | #ae-portlet.View_Your_Response# + + + + #ae-portlet.Take_Evaluation# + +
#ae-portlet.Anonymous# #assessment.yes#/#assessment.no##assessment.yes#/#assessment.no# + #assessment.no##assessment.yes# + + | #ae-portlet.Unpublish# | #ae-portlet.Edit_Evaluation# | #ae-portlet.Results# + + } } + } \ + -groupby $groupby_list - template::multirow append assessments $assessment_id $title $description $assessment_url $community_url $community_name - } -} +set status_clause "and not ci.live_revision is null" +db_multirow -extend { edit_response_url view_url edit_url assessment_url status_url anonymous_url edit_url results_url } assessments answered_assessments {} { + set base_url [site_node::get_url_from_object_id -object_id $package_id] + set package_admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege "admin"] -set elements [list] -if {!$one_instance_p} { - set elements [list community_name \ - [list \ - label "[_ dotlrn.Community]" \ - display_template {@sessions.community_name@ }]] + set assessment_url [export_vars -base ${base_url}assessment { assessment_id }] + set edit_response_url [export_vars -base ${base_url}assessment { assessment_id session_id }] + set view_url [export_vars -base ${base_url}session { assessment_id session_id }] + set status_url [export_vars -base ${base_url}asm-admin/toggle-status { assessment_id {return_url [ad_return_url]} }] + set anonymous_url [export_vars -base ${base_url}asm-admin/toggle-anonymous { {assessment_id $assessment_rev_id} {return_url [ad_return_url]} }] + + set edit_url [export_vars -base ${base_url}asm-admin/assessment-form { assessment_id }] + set results_url [export_vars -base ${base_url}sessions { assessment_id }] } -lappend elements title \ - [list \ - label "[_ assessment.Assessments]"] \ +if { $community_id ne "" } { + set package_id [dotlrn_community::get_package_id $community_id] + set package_admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege "admin"] + if { $package_admin_p } { + set base_url [site_node::get_url_from_object_id -object_id $package_id] -lappend elements edit\ - [list \ - display_template {

} - ] + template::list::create \ + -name unpublished_assessments \ + -multirow unpublished_assessments \ + -page_flush_p 1 \ + -html { width 100% } \ + -pass_properties { package_admin_p } \ + -actions [list "#assessment.New_Assessment#" ${base_url}asm-admin/assessment-form "#assessment.New_Assessment#"] \ + -elements { + title { + label "" + link_url_col assessment_url + } + actions { + label "" + display_template { + #ae-portlet.Anonymous# #assessment.yes#/#assessment.no##assessment.yes#/#assessment.no# | #ae-portlet.Publish# | #ae-portlet.Edit_Evaluation# | #ae-portlet.Results# + } + } + } -lappend elements view \ - [list \ - display_template {
} - ] + set status_clause "and ci.live_revision is null" + db_multirow -extend { edit_url assessment_url status_url anonymous_url edit_url results_url } unpublished_assessments answered_assessments {} { + set assessment_url [export_vars -base ${base_url}assessment { assessment_id }] + set status_url [export_vars -base ${base_url}asm-admin/toggle-status { assessment_id {return_url [ad_return_url]} }] + set anonymous_url [export_vars -base ${base_url}asm-admin/toggle-anonymous { {assessment_id $assessment_rev_id} {return_url [ad_return_url]} }] -# create a list with all answered assessments and their sessions -template::list::create \ - -name sessions \ - -multirow sessions \ - -key assessment_id \ - -elements $elements \ - -main_class narrow - -# get the information of all assessments store in the database -set old_comm_node_id 0 -db_multirow -extend { session_id session_url community_url } sessions answered_assessments {} { - if {$comm_node_id == $old_comm_node_id} { - set community_name "" + set edit_url [export_vars -base ${base_url}asm-admin/assessment-form { assessment_id }] + set results_url [export_vars -base ${base_url}sessions { assessment_id }] + } } - as::assessment::data -assessment_id $assessment_id - set assessment_rev_id $assessment_data(assessment_rev_id) - set session_id [db_string last_session {select max(session_id) as session_id from as_sessions where assessment_id = :assessment_rev_id and subject_id = :user_id}] - - set community_url [site_node::get_url -node_id $comm_node_id] - set session_url "[site_node::get_url -node_id $as_node_id][export_vars -base sessions {assessment_id}]" - set old_comm_node_id $comm_node_id -} +} \ No newline at end of file Index: openacs-4/packages/ae-portlet/www/ae-portlet.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ae-portlet/www/Attic/ae-portlet.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ae-portlet/www/ae-portlet.xql 9 Jun 2005 05:54:36 -0000 1.1 +++ openacs-4/packages/ae-portlet/www/ae-portlet.xql 4 Feb 2006 13:49:38 -0000 1.2 @@ -5,8 +5,12 @@ select cr.item_id as assessment_id, cr.title, cr.description, cf.package_id, p.instance_name as community_name, - sc.node_id as comm_node_id, sa.node_id as as_node_id - from as_assessments a, cr_revisions cr, cr_items ci, cr_folders cf, + sc.node_id as comm_node_id, sa.node_id as as_node_id, + s.session_id, s.completed_datetime, a.anonymous_p, + a.assessment_id as assessment_rev_id + from as_assessments a left join as_sessions s on (a.assessment_id = s.assessment_id + and s.subject_id = :user_id), + cr_revisions cr, cr_items ci, cr_folders cf, site_nodes sa, site_nodes sc, apm_packages p where a.assessment_id = cr.revision_id and cr.revision_id = ci.latest_revision @@ -15,15 +19,9 @@ and sa.object_id = cf.package_id and sc.node_id = sa.parent_id and p.package_id = sc.object_id - and exists (select 1 - from as_sessions s - where s.assessment_id = a.assessment_id - and s.subject_id = :user_id - and s.completed_datetime is not null) + $status_clause order by lower(p.instance_name), lower(cr.title)
- - - +