Index: openacs-4/packages/evaluation-portlet/evaluation-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/evaluation-portlet.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/evaluation-portlet.info 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,27 @@ + + + + + Evaluation Portlet + Evaluations Portlets + f + t + evaluation-portlet + + + Jose Pablo Escobedo Del Cid + 2004-05-19 + + + + + + + + + + + + + + Index: openacs-4/packages/evaluation-portlet/lib/evaluations-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/evaluations-chunk-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/evaluations-chunk-postgresql.xql 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,56 @@ + + + + postgresql7.4 + + + + + select et.task_name, et.weight as task_weight, + et.task_id + from evaluation_tasksi et + where grade_id = :grade_id + and content_revision__is_live(et.task_id) = true + $evaluations_orderby + + + + + + + + select et.task_name, + ese.grade, + ese.description as comments, + ese.show_student_p, + (et.weight*eg.weight)/100 as task_weight, + (ese.grade*et.weight*eg.weight)/10000 as task_grade, + et.number_of_members, + et.task_id, + ea.data as answer_data, + ea.title as answer_title, + ea.answer_id + from evaluation_grades eg, + evaluation_tasks et2 left outer join evaluation_student_evalsi ese on (ese.task_id = et2.task_id and content_revision__is_live(ese.evaluation_id) = true + and ese.party_id = evaluation__party_id(:user_id,et2.task_id)), + evaluation_tasks et left outer join evaluation_answersi ea on (ea.task_id = et.task_id and content_revision__is_live(ea.answer_id) = true + and ea.party_id = evaluation__party_id(:user_id,et.task_id)) + where eg.grade_id = :grade_id + and eg.grade_id = et.grade_id + and et.task_id = et2.task_id + and content_revision__is_live(et.task_id) = true + and content_revision__is_live(eg.grade_id) = true + $evaluations_orderby + + + + + + + + select evaluation__party_id(:user_id,:task_id) + + + + + Index: openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.adp 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,4 @@ + +
+@bottom_line;noquote@ +
Index: openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.tcl 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,136 @@ +ad_page_contract { + + evaluations chunk to be displayed in the index page + +} + +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] + +set base_url [ad_conn package_url] + +db_1row get_grade_info { *SQL* } + +set elements [list task_name \ + [list label "Name" \ + link_url_col task_url \ + orderby_asc {task_name asc} \ + orderby_desc {task_name desc}] \ + ] +if { $admin_p } { + #admin + lappend elements task_weight \ + [list label "Weight" \ + display_template {
@grade_tasks_admin.task_weight@%
} \ + orderby_asc {task_weight asc} \ + orderby_desc {task_weight desc}] + set multirow_name grade_tasks_admin + set actions [list "Edit grades distribution of $grade_plural_name" [export_vars -base "${base_url}evaluation/admin/grades/distribution-edit" { grade_id }]] +} else { + #student + lappend elements grade \ + [list label "Grade over 100" \ + display_template {
@grade_tasks.grade@
} \ + orderby_asc {grade asc} \ + orderby_desc {grade desc}] + lappend elements comments \ + [list label "Comments" \ + link_url_col comments_url \ + link_html { title "View evaluation comments" }] + lappend elements task_weight \ + [list label "Net Value" \ + display_template {
@grade_tasks.task_weight@
} \ + orderby_asc {task_weight asc} \ + orderby_desc {task_weight desc}] + lappend elements answer \ + [list label "" \ + link_url_col answer_url \ + link_html { title "View my answer" }] + set multirow_name grade_tasks + set actions "" +} + +set total_grade 0.00 +set max_grade 0.00 +set category_weight 0 + +template::list::create \ + -name grade_tasks \ + -multirow $multirow_name \ + -actions $actions \ + -key task_id \ + -pass_properties { return_url mode base_url } \ + -filters { grade_id } \ + -elements $elements \ + -orderby_name evaluations_orderby \ + -orderby { default_value task_name } + +set evaluations_orderby [template::list::orderby_clause -orderby -name grade_tasks] + +if { [string equal $evaluations_orderby ""] } { + set evaluations_orderby " order by task_name asc" +} + +if { $admin_p } { + #admin + db_multirow -extend { task_url } grade_tasks_admin get_tasks_admin { *SQL* } { + set task_url [export_vars -base "${base_url}evaluation/admin/evaluations/student-list" { task_id grade_id }] + set category_weight [expr $category_weight + $task_weight] + } +} else { + + db_multirow -extend { comments comments_url answer answer_url } grade_tasks get_grade_tasks { *SQL* } { + + if { ![empty_string_p $comments] } { + set comments "View comments" + set comments_url evaluation_view + } + + set over_weight "" + if { ![empty_string_p $show_student_p] && $show_student_p } { + + if { ![empty_string_p $grade] } { + set grade [format %.2f $grade] + set over_weight "[format %.2f $task_grade]/" + set total_grade [expr $total_grade + $task_grade] + } else { + set grade "Not evaluated" + } + + set max_grade [expr $task_weight + $max_grade] + + } else { + set grade "Not available" + } + set task_weight "${over_weight}[format %.2f $task_weight]" + + # working with answer stuff (if it has a file/url attached) + if { [empty_string_p $answer_data] } { + set answer_url "" + set answer "" + } elseif { [regexp "http://" $answer_data] } { + set answer_url "[export_vars -base "$answer_data" { }]" + set answer "View my answer" + } else { + # we assume it's a file + set answer_url "[export_vars -base "${base_url}evaluation/view/$answer_title" { }]" + set answer "View my answer" + } + + if { $number_of_members > 1 && [string eq [db_string get_group_id { *SQL* }] 0] } { + set answer "" + set answer_url "" + set grade "No group for task" + } + + } +} + +if { $admin_p } { + set bottom_line "Weight used in ${grade_plural_name}: ${category_weight}% (over 100% of $grade_plural_name)
+ $grade_plural_name represents ${grade_weight}% of the 100% of the class
" +} else { + set bottom_line "Total points in this category: ${total_grade}/${max_grade}
+ This grade category represents the ${grade_weight}% of the 100% of the class
" +} Index: openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.xql 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + + select grade_plural_name, weight as grade_weight from evaluation_grades where grade_id = :grade_id + + + + + Index: openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,66 @@ + + + + postgresql7.4 + + + + + select et.task_name, et.number_of_members, et.task_id, + to_char(et.due_date,'Month DD YYYY') as pretty_due_date, et.online_p, et.late_submit_p, et.item_id, + et.requires_grade_p, et.description, et.grade_id, + cr.content_length, + et.data as task_data, + et.title as task_title, + et.task_id as revision_id, + ets.solution_id as solution_id + from cr_revisions cr, + evaluation_tasksi et left outer join evaluation_tasks_solsi ets on (ets.task_id = et.task_id and content_revision__is_live(ets.solution_id) = true) + where cr.revision_id = et.revision_id + and grade_id = :grade_id + and content_revision__is_live(et.task_id) = true + $assignments_orderby + + + + + + + + select et.task_name, et.number_of_members, et.task_id, + to_char(et.due_date,'Month DD YYYY') as pretty_due_date, et.online_p, et.late_submit_p, et.item_id, + et.due_date, + et.requires_grade_p, et.description, et.grade_id, + et.title as task_title, + et.data as task_data, + et.task_id as revision_id, + cr.content_length, + ea.answer_id as answer_id + from cr_revisions cr, + evaluation_tasksi et left outer join evaluation_answersi ea on (ea.task_id = et.task_id and content_revision__is_live(ea.answer_id) = true + and ea.party_id = evaluation__party_id(:user_id,et.task_id)) + where cr.revision_id = et.revision_id + and grade_id = :grade_id + and content_revision__is_live(et.task_id) = true + $assignments_orderby + + + + + + + + select evaluation__party_id(:user_id,:task_id) + + + + + + + + select grade_name, grade_plural_name from evaluation_grades where grade_id = :grade_id + + + + + Index: openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/Attic/tasks-chunk-postgresql.xql~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql~ 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,66 @@ + + + + postgresql7.4 + + + + + select et.task_name, et.number_of_members, et.task_id, + to_char(et.due_date,'Month DD YYYY') as pretty_due_date, et.online_p, et.late_submit_p, et.item_id, + et.requires_grade_p, et.description, et.grade_id, + cr.content_length, + et.data as task_data, + et.title as task_title, + et.task_id as revision_id, + ets.solution_id as solution_id + from cr_revisions cr, + evaluation_tasksi et left outer join evaluation_tasks_solsi ets on (ets.task_id = et.task_id and content_revision__is_live(ets.solution_id) = true) + where cr.revision_id = et.revision_id + and grade_id = :grade_id + and content_revision__is_live(et.task_id) = true + $assignments_orderby + + + + + + + + select et.task_name, et.number_of_members, et.task_id, + to_char(et.due_date,'Month DD YYYY') as pretty_due_date, et.online_p, et.late_submit_p, et.item_id, + et.due_date, + et.requires_grade_p, et.description, et.grade_id, + et.title as task_title, + et.data as task_data, + et.task_id as revision_id, + cr.content_length, + ea.answer_id as answer_id + from cr_revisions cr, + evaluation_tasksi et left outer join evaluation_answersi ea on (ea.task_id = et.task_id and content_revision__is_live(ea.answer_id) = true + and ea.party_id = evaluation__party_id(:user_id,et.task_id)) + where cr.revision_id = et.revision_id + and grade_id = :grade_id + and content_revision__is_live(et.task_id) = true + $assignments_orderby + + + + + + + + select evaluation__party_id(:user_id,:task_id) + + + + + + + + select grade_plural_name from evaluation_grades where grade_id = :grade_id + + + + + Index: openacs-4/packages/evaluation-portlet/lib/tasks-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/tasks-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/tasks-chunk.adp 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,3 @@ + +
+ Index: openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl 31 May 2004 23:43:09 -0000 1.1 @@ -0,0 +1,177 @@ +ad_page_contract { + + task chunk to be displayed in the index page + +} + +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] + +db_1row grade_names { *SQL* } +set base_url [ad_conn package_url] + +set mode display +set return_url "[ad_conn url]?[export_vars { grade_id }]" + +set elements [list task_name \ + [list label "Name" \ + link_url_col task_url \ + orderby_asc {task_name asc} \ + orderby_desc {task_name desc}] \ + pretty_due_date \ + [list label "Due date" \ + orderby_asc {pretty_due_date asc} \ + orderby_desc {pretty_due_date desc}] \ + ] + +if { $admin_p } { + #admin + lappend elements solution \ + [list label "" \ + link_url_col solution_url \ + link_html { title "Add/edit solution" }] + lappend elements audit_info \ + [list label "" \ + link_url_col audit_info_url \ + link_html { title "Audit info" }] + lappend elements groups_admin \ + [list label "" \ + link_url_col groups_admin_url \ + link_html { title "Groups administration" }] + lappend elements view \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}evaluation/admin/tasks/task-add-edit" { grade_id task_id return_url mode }]} \ + link_html { title "View task" }] + lappend elements edit \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}evaluation/admin/tasks/task-add-edit" { return_url item_id grade_id task_id }]} \ + link_html { title "Edit task" }] + lappend elements delete \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}evaluation/admin/tasks/task-delete" { grade_id task_id return_url }]} \ + link_html { title "Delete task" }] + + set multirow_name tasks_admin + set actions [list "Add $grade_name" [export_vars -base "${base_url}evaluation/admin/tasks/task-add-edit" { return_url grade_id }] ] +} else { + #student + lappend elements answer \ + [list label "" \ + link_url_col answer_url \ + link_html { title "Add/edit answer" }] + lappend elements view \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}evaluation/task-view" { grade_id task_id return_url }]} \ + link_html { title "View task" }] + set multirow_name tasks + set actions "" +} + +template::list::create \ + -name tasks \ + -multirow $multirow_name \ + -actions $actions \ + -key task_id \ + -pass_properties { return_url mode base_url } \ + -filters { grade_id {} } \ + -orderby_name assignments_orderby \ + -elements $elements \ + -orderby { default_value task_name } + +set assignments_orderby [template::list::orderby_clause -orderby -name tasks] + +if {[string equal $assignments_orderby ""]} { + set assignments_orderby " order by task_name asc" +} + +if { $admin_p } { + + db_multirow -extend { solution_url solution solution_mode task_url audit_info audit_info_url groups_admin groups_admin_url } tasks_admin get_tasks_admin { *SQL* } { + # working with task stuff (if it has a file/url attached) + if { [empty_string_p $task_data] } { + set task_url "[export_vars -base "${base_url}evaluation/task-view" { grade_id task_id return_url }]" + set task_name "$task_name (No data)" + } elseif { [regexp "http://" $task_data] } { + set task_url "[export_vars -base "$task_data" { }]" + set task_name "$task_name (URL)" + } else { + # we assume it's a file + set task_url "[export_vars -base "${base_url}evaluation/view/$task_title" { revision_id }]" + set task_name "$task_name ([format %.0f [expr ($content_length/1024)]] Kb)" + } + + if { ![empty_string_p $solution_id] } { + set solution_mode display + set solution_url "[export_vars -base "${base_url}evaluation/admin/tasks/solution-add-edit" { grade_id task_id solution_id return_url solution_mode }]" + set solution "View/Edit Solution" + } else { + set solution_mode edit + set solution_url "[export_vars -base "${base_url}evaluation/admin/tasks/solution-add-edit" { grade_id task_id return_url solution_mode }]" + set solution "Upload Solution" + } + + set audit_info_url "[export_vars -base "${base_url}evaluation/admin/evaluations/audit-info" { grade_id task_id }]" + set audit_info "Audit Info." + + if { ![string eq $number_of_members 1] } { + set groups_admin_url "[export_vars -base "${base_url}evaluation/admin/groups/one-task" { grade_id task_id }]" + set groups_admin "Groups Admin." + } + + } +} else { + db_multirow -extend { task_url solution_url solution solution_mode answer answer_url } tasks get_tasks { *SQL* } { + set answer_mode display + + # working with task stuff (if it has a file/url attached) + if { [empty_string_p $task_data] } { + set task_url "[export_vars -base "${base_url}evaluation/task-view" { grade_id task_id return_url }]" + set task_name "$task_name (No data)" + } elseif { [regexp "http://" $task_data] } { + set task_url "[export_vars -base "$task_data" { }]" + set task_name "$task_name (URL)" + } else { + # we assume it's a file + set task_url "[export_vars -base "${base_url}evaluation/view/$task_title" { revision_id }]" + set task_name "$task_name ([format %.0f [expr ($content_length/1024)]] Kb)" + } + + if { [string eq $online_p "t"] } { + if { ([template::util::date::compare $due_date [template::util::date::now]] > 0) } { + if { [empty_string_p $answer_id] } { + set answer "submit answer" + set answer_mode edit + set answer_url "[export_vars -base "${base_url}evaluation/answer-add-edit" { grade_id task_id return_url answer_mode }]" + } else { + set answer "submit answer again" + set answer_mode display + set answer_url "[export_vars -base "${base_url}evaluation/answer-add-edit" { grade_id task_id answer_id return_url answer_mode }]" + } + } elseif { [string eq $turn_in_late_p "t"] } { + if { [empty_string_p $answer_id] } { + set answer "submit answer " + set answer_mode edit + set answer_url "[export_vars -base "${base_url}evaluation/answer-add-edit" { grade_id task_id return_url answer_mode }]" + } else { + set answer "submit answer again" + set answer_mode display + set answer_url "[export_vars -base "${base_url}evaluation/admin/tasks/solution-add-edit" { grade_id task_id answer_id return_url solution_mode }]" + } + } + if { $number_of_members > 1 && [string eq [db_string get_group_id { *SQL* }] 0] } { + set answer "" + set answer_url "" + } + } + + } +} Index: openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/Attic/tasks-chunk.tcl~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl~ 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,177 @@ +ad_page_contract { + + task chunk to be displayed in the index page + +} + +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] + +set grade_plural_name [db_string grade_plural_name { *SQL* }] +set base_url [ad_conn package_url] + +set mode display +set return_url "[ad_conn url]?[export_vars { grade_id }]" + +set elements [list task_name \ + [list label "Name" \ + link_url_col task_url \ + orderby_asc {task_name asc} \ + orderby_desc {task_name desc}] \ + pretty_due_date \ + [list label "Due date" \ + orderby_asc {pretty_due_date asc} \ + orderby_desc {pretty_due_date desc}] \ + ] + +if { $admin_p } { + #admin + lappend elements solution \ + [list label "" \ + link_url_col solution_url \ + link_html { title "Add/edit solution" }] + lappend elements audit_info \ + [list label "" \ + link_url_col audit_info_url \ + link_html { title "Audit info" }] + lappend elements groups_admin \ + [list label "" \ + link_url_col groups_admin_url \ + link_html { title "Groups administration" }] + lappend elements view \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}evaluation/admin/tasks/task-add-edit" { grade_id task_id return_url mode }]} \ + link_html { title "View task" }] + lappend elements edit \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}evaluation/admin/tasks/task-add-edit" { return_url item_id grade_id task_id }]} \ + link_html { title "Edit task" }] + lappend elements delete \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}evaluation/admin/tasks/task-delete" { grade_id task_id return_url }]} \ + link_html { title "Delete task" }] + + set multirow_name tasks_admin + set actions [list "Add $grade_plural_name" [export_vars -base "${base_url}evaluation/admin/tasks/task-add-edit" { return_url grade_id }] ] +} else { + #student + lappend elements answer \ + [list label "" \ + link_url_col answer_url \ + link_html { title "Add/edit answer" }] + lappend elements view \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}evaluation/task-view" { grade_id task_id return_url }]} \ + link_html { title "View task" }] + set multirow_name tasks + set actions "" +} + +template::list::create \ + -name tasks \ + -multirow $multirow_name \ + -actions $actions \ + -key task_id \ + -pass_properties { return_url mode base_url } \ + -filters { grade_id {} } \ + -orderby_name assignments_orderby \ + -elements $elements \ + -orderby { default_value task_name } + +set assignments_orderby [template::list::orderby_clause -orderby -name tasks] + +if {[string equal $assignments_orderby ""]} { + set assignments_orderby " order by task_name asc" +} + +if { $admin_p } { + + db_multirow -extend { solution_url solution solution_mode task_url audit_info audit_info_url groups_admin groups_admin_url } tasks_admin get_tasks_admin { *SQL* } { + # working with task stuff (if it has a file/url attached) + if { [empty_string_p $task_data] } { + set task_url "[export_vars -base "${base_url}evaluation/task-view" { grade_id task_id return_url }]" + set task_name "$task_name (No data)" + } elseif { [regexp "http://" $task_data] } { + set task_url "[export_vars -base "$task_data" { }]" + set task_name "$task_name (URL)" + } else { + # we assume it's a file + set task_url "[export_vars -base "${base_url}evaluation/view/$task_title" { revision_id }]" + set task_name "$task_name ([format %.0f [expr ($content_length/1024)]] Kb)" + } + + if { ![empty_string_p $solution_id] } { + set solution_mode display + set solution_url "[export_vars -base "${base_url}evaluation/admin/tasks/solution-add-edit" { grade_id task_id solution_id return_url solution_mode }]" + set solution "View/Edit Solution" + } else { + set solution_mode edit + set solution_url "[export_vars -base "${base_url}evaluation/admin/tasks/solution-add-edit" { grade_id task_id return_url solution_mode }]" + set solution "Upload Solution" + } + + set audit_info_url "[export_vars -base "${base_url}evaluation/admin/evaluations/audit-info" { grade_id task_id }]" + set audit_info "Audit Info." + + if { ![string eq $number_of_members 1] } { + set groups_admin_url "[export_vars -base "${base_url}evaluation/admin/groups/one-task" { grade_id task_id }]" + set groups_admin "Groups Admin." + } + + } +} else { + db_multirow -extend { task_url solution_url solution solution_mode answer answer_url } tasks get_tasks { *SQL* } { + set answer_mode display + + # working with task stuff (if it has a file/url attached) + if { [empty_string_p $task_data] } { + set task_url "[export_vars -base "${base_url}evaluation/task-view" { grade_id task_id return_url }]" + set task_name "$task_name (No data)" + } elseif { [regexp "http://" $task_data] } { + set task_url "[export_vars -base "$task_data" { }]" + set task_name "$task_name (URL)" + } else { + # we assume it's a file + set task_url "[export_vars -base "${base_url}evaluation/view/$task_title" { revision_id }]" + set task_name "$task_name ([format %.0f [expr ($content_length/1024)]] Kb)" + } + + if { [string eq $online_p "t"] } { + if { ([template::util::date::compare $due_date [template::util::date::now]] > 0) } { + if { [empty_string_p $answer_id] } { + set answer "submit answer" + set answer_mode edit + set answer_url "[export_vars -base "${base_url}evaluation/answer-add-edit" { grade_id task_id return_url answer_mode }]" + } else { + set answer "submit answer again" + set answer_mode display + set answer_url "[export_vars -base "${base_url}evaluation/answer-add-edit" { grade_id task_id answer_id return_url answer_mode }]" + } + } elseif { [string eq $turn_in_late_p "t"] } { + if { [empty_string_p $answer_id] } { + set answer "submit answer " + set answer_mode edit + set answer_url "[export_vars -base "${base_url}evaluation/answer-add-edit" { grade_id task_id return_url answer_mode }]" + } else { + set answer "submit answer again" + set answer_mode display + set answer_url "[export_vars -base "${base_url}evaluation/admin/tasks/solution-add-edit" { grade_id task_id answer_id return_url solution_mode }]" + } + } + if { $number_of_members > 1 && [string eq [db_string get_group_id { *SQL* }] 0] } { + set answer "" + set answer_url "" + } + } + + } +} Index: openacs-4/packages/evaluation-portlet/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/tcl/apm-callback-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/tcl/apm-callback-procs.tcl 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,318 @@ +ad_library { + Procedures for initializing service contracts etc. for the + evaluation portlet package. Should only be executed + once upon installation. + + @creation-date May 2004 + @author jopez@galileo.edu + @cvs-id $Id: apm-callback-procs.tcl,v 1.1 2004/05/31 23:43:10 josee Exp $ +} + +namespace eval evaluation_portlet {} +namespace eval evaluation_assignments_portlet {} +namespace eval evaluation_evaluations_portlet {} +namespace eval evaluation_admin_portlet {} + +ad_proc -private evaluation_portlet::after_install {} { + Create the datasources needed by the evaluation portlets. +} { + evaluation_assignments_portlet::after_install + evaluation_evaluations_portlet::after_install + evaluation_admin_portlet::after_install +} + +ad_proc -private evaluation_assignments_portlet::after_install {} { + Create the datasources needed by the evaluation assignments portlet. +} { + + db_transaction { + set ds_id [portal::datasource::new \ + -name "evaluation_assignments_portlet" \ + -description "Evaluation Assignments Portlet"] + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shadeable_p \ + -value t + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key hideable_p \ + -value t + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key user_editable_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shaded_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key link_hideable_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p f \ + -key package_id \ + -value "" + + register_portal_datasource_impl + + } +} + + + +ad_proc -private evaluation_assignments_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the evaluation assignments portlet. +} { + set spec { + name "evaluation_assignments_portlet" + contract_name "portal_datasource" + owner "evaluation-portlet" + aliases { + GetMyName evaluation_assignments_portlet::get_my_name + GetPrettyName evaluation_assignments_portlet::get_pretty_name + Link evaluation_assignments_portlet::link + AddSelfToPage evaluation_assignments_portlet::add_self_to_page + Show evaluation_assignments_portlet::show + Edit evaluation_assignments_portlet::edit + RemoveSelfFromPage evaluation_assignments_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + + +ad_proc -private evaluation_evaluations_portlet::after_install {} { + Create the datasources needed by the evaluation evaluations portlet. +} { + + db_transaction { + set ds_id [portal::datasource::new \ + -name "evaluation_evaluations_portlet" \ + -description "Evaluation Evaluations Portlet"] + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shadeable_p \ + -value t + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key hideable_p \ + -value t + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key user_editable_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shaded_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key link_hideable_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p f \ + -key package_id \ + -value "" + + register_portal_datasource_impl + + } +} + + + +ad_proc -private evaluation_evaluations_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the evaluation evaluations portlet. +} { + set spec { + name "evaluation_evaluations_portlet" + contract_name "portal_datasource" + owner "evaluation-portlet" + aliases { + GetMyName evaluation_evaluations_portlet::get_my_name + GetPrettyName evaluation_evaluations_portlet::get_pretty_name + Link evaluation_evaluations_portlet::link + AddSelfToPage evaluation_evaluations_portlet::add_self_to_page + Show evaluation_evaluations_portlet::show + Edit evaluation_evaluations_portlet::edit + RemoveSelfFromPage evaluation_evaluations_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + + +ad_proc -private evaluation_admin_portlet::after_install {} { + Create the datasources needed by the evaluation portlet. +} { + + ns_log Notice "SE meteeeeeeeeeeeeeee\n" + db_transaction { + set ds_id [portal::datasource::new \ + -name "evaluation_admin_portlet" \ + -description "Evaluation Admin Portlet"] + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shadeable_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key hideable_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key user_editable_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shaded_p \ + -value f + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key link_hideable_p \ + -value t + + portal::datasource::set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p f \ + -key package_id \ + -value "" + + register_portal_datasource_impl + } +} + + + +ad_proc -private evaluation_admin_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the evaluation admin portlet. +} { + set spec { + name "evaluation_admin_portlet" + contract_name "portal_datasource" + owner "evaluation-portlet" + aliases { + GetMyName evaluation_admin_portlet::get_my_name + GetPrettyName evaluation_admin_portlet::get_pretty_name + Link evaluation_admin_portlet::link + AddSelfToPage evaluation_admin_portlet::add_self_to_page + Show evaluation_admin_portlet::show + Edit evaluation_admin_portlet::edit + RemoveSelfFromPage evaluation_admin_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + + +ad_proc -private evaluation_portlet::before_uninstall {} { + Evaluation Portlet package uninstall proc +} { + + db_transaction { + evaluation_assignments_portlet::uninstall + evaluation_evaluations_portlet::uninstall + evaluation_admin_portlet::uninstall + } +} + + +ad_proc -private evaluation_assignments_portlet::uninstall {} { + Evaluation Portlet package uninstall proc +} { + unregister_implementations +} + +ad_proc -private evaluation_evaluations_portlet::uninstall {} { + Evaluation Portlet package uninstall proc +} { + unregister_implementations +} + +ad_proc -private evaluation_admin_portlet::uninstall {} { + Evaluation Portlet package uninstall proc +} { + unregister_implementations +} + + + +ad_proc -private evaluation_assignments_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "evaluation_assignments_portlet" +} + +ad_proc -private evaluation_evaluations_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "evaluation_evaluations_portlet" +} + +ad_proc -private evaluation_admin_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "evaluation_admin_portlet" +} Index: openacs-4/packages/evaluation-portlet/tcl/evaluation-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/tcl/evaluation-portlet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/tcl/evaluation-portlet-procs.tcl 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,327 @@ +ad_library { + + Procedures to support the evaluation portlets + + @creation-date May 2004 + @author jopez@galileo.edu + @cvs_id $Id: evaluation-portlet-procs.tcl,v 1.1 2004/05/31 23:43:10 josee Exp $ + +} + +namespace eval evaluation_assignments_portlet {} +namespace eval evaluation_evaluations_portlet {} +namespace eval evaluation_admin_portlet {} + + +# +# evaluation assignments namespace +# + +ad_proc -private evaluation_assignments_portlet::get_my_name { +} { + return "evaluation_assignments_portlet" +} + + + +ad_proc -private evaluation_assignments_portlet::my_package_key { +} { + return "evaluation-portlet" +} + + + +ad_proc -public evaluation_assignments_portlet::get_pretty_name { +} { + return "Assignments" +} + + + +ad_proc -public evaluation_assignments_portlet::link { +} { + return "" +} + + + +ad_proc -public evaluation_assignments_portlet::add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-param_action:required} +} { + Adds a evaluation PE to the given portal. + + @param portal_id The page to add self to + @param package_id The community with the folder + + @return element_id The new element's id +} { + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $package_id \ + -force_region [parameter::get_from_package_key \ + -parameter "evaluation_assignments_portlet_force_region" \ + -package_key [my_package_key]] \ + -pretty_name [get_pretty_name] \ + -param_action $param_action + ] +} + + + +ad_proc -public evaluation_assignments_portlet::remove_self_from_page { + {-portal_id:required} + {-package_id:required} +} { + Removes a evaluation PE from the given page or the package_id of the + evaluation package from the portlet if there are others remaining + + @param portal_id The page to remove self from + @param package_id +} { + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $package_id +} + + + +ad_proc -public evaluation_assignments_portlet::show { + cf +} { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "evaluation-assignments-portlet" +} + + +# +# evaluation evaluations namespace +# + +ad_proc -private evaluation_evaluations_portlet::get_my_name { +} { + return "evaluation_evaluations_portlet" +} + + + +ad_proc -private evaluation_evaluations_portlet::my_package_key { +} { + return "evaluation-portlet" +} + + + +ad_proc -public evaluation_evaluations_portlet::get_pretty_name { +} { + return "Evaluations" +} + + + +ad_proc -public evaluation_evaluations_portlet::link { +} { + return "" +} + + + +ad_proc -public evaluation_evaluations_portlet::add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-param_action:required} +} { + Adds a evaluation PE to the given portal. + + @param portal_id The page to add self to + @param package_id The community with the folder + + @return element_id The new element's id +} { + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $package_id \ + -force_region [parameter::get_from_package_key \ + -parameter "evaluation_evaluations_portlet_force_region" \ + -package_key [my_package_key]] \ + -pretty_name [get_pretty_name] \ + -param_action $param_action + ] +} + + + +ad_proc -public evaluation_evaluations_portlet::remove_self_from_page { + {-portal_id:required} + {-package_id:required} +} { + Removes a evaluation PE from the given page or the package_id of the + evaluation package from the portlet if there are others remaining + + @param portal_id The page to remove self from + @param package_id +} { + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $package_id +} + + + +ad_proc -public evaluation_evaluations_portlet::show { + cf +} { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "evaluation-evaluations-portlet" +} + +ad_proc -private evaluation_admin_portlet::get_my_name {} { + return "evaluation_admin_portlet" +} + + +ad_proc -public evaluation_admin_portlet::get_pretty_name {} { + return "Evaluation Administration" +} + + + +ad_proc -private evaluation_admin_portlet::my_package_key {} { + return "evaluation-portlet" +} + + + +ad_proc -public evaluation_admin_portlet::link {} { + return "" +} + + + +ad_proc -public evaluation_admin_portlet::add_self_to_page { + {-portal_id:required} + {-page_name ""} + {-package_id:required} +} { + Adds a evaluation admin PE to the given portal + + @param portal_id The page to add self to + @param package_id The package_id of the evaluation package + + @return element_id The new element's id +} { + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -key package_id \ + -value $package_id + ] +} + + + +ad_proc -public evaluation_admin_portlet::remove_self_from_page { + {-portal_id:required} +} { + Removes a evaluation admin PE from the given page +} { + portal::remove_element \ + -portal_id $portal_id \ + -portlet_name [get_my_name] +} + + + +ad_proc -public evaluation_admin_portlet::show { + cf +} { +} { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "evaluation-admin-portlet" + +} + + + +# +# evaluation assignments namespace +# + +ad_proc -private evaluation_admin_portlet::get_my_name {} { + return "evaluation_admin_portlet" +} + + +ad_proc -public evaluation_admin_portlet::get_pretty_name {} { + return "Evaluation Administration" +} + + + +ad_proc -private evaluation_admin_portlet::my_package_key {} { + return "evaluation-portlet" +} + + + +ad_proc -public evaluation_admin_portlet::link {} { + return "" +} + + + +ad_proc -public evaluation_admin_portlet::add_self_to_page { + {-portal_id:required} + {-page_name ""} + {-package_id:required} +} { + Adds a evaluation admin PE to the given portal + + @param portal_id The page to add self to + @param package_id The package_id of the evaluation package + + @return element_id The new element's id +} { + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -key package_id \ + -value $package_id + ] +} + + + +ad_proc -public evaluation_admin_portlet::remove_self_from_page { + {-portal_id:required} +} { + Removes a evaluation admin PE from the given page +} { + portal::remove_element \ + -portal_id $portal_id \ + -portlet_name [get_my_name] +} + + + +ad_proc -public evaluation_admin_portlet::show { + cf +} { +} { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "evaluation-admin-portlet" + +} Index: openacs-4/packages/evaluation-portlet/www/evaluation-admin-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/www/evaluation-admin-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/www/evaluation-admin-portlet.adp 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,3 @@ + Index: openacs-4/packages/evaluation-portlet/www/evaluation-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/www/evaluation-admin-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/www/evaluation-admin-portlet.tcl 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,26 @@ +# /evaluation-portlet/www/evaluation-admin-portlet.tcl + +ad_page_contract { + The display logic for the evaluation admin portlet + + @author jopez@galileo.edu + @creation-date May 2004 + @cvs_id $Id: evaluation-admin-portlet.tcl,v 1.1 2004/05/31 23:43:10 josee Exp $ +} -properties { + +} + +array set config $cf +set user_id [ad_conn user_id] +set list_of_package_ids $config(package_id) + +if {[llength $list_of_package_ids] > 1} { + # We have a problem! + return -code error "There should be only one instance of weblogger for admin purposes" +} + +set package_id [lindex $list_of_package_ids 0] + +set url [lindex [site_node::get_url_from_object_id -object_id $package_id] 0] + +ad_return_template Index: openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet-postgresql.xql 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,20 @@ + + + +postgresql7.1 + + + + + select eg.grade_plural_name, + eg.grade_id + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id in ([join $list_of_package_ids ,]) + order by grade_plural_name desc + + + + + Index: openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet.adp 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,19 @@ + + + + + +   + + Index: openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/www/evaluation-assignments-portlet.tcl 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,41 @@ +# /evaluation-portlet/www/evaluation-portlet.tcl + +ad_page_contract { + The display logic for the evaluation portlet + + @author jopez@galileo.edu + @creation-date May 2004 + @cvs_id $Id: evaluation-assignments-portlet.tcl,v 1.1 2004/05/31 23:43:10 josee Exp $ +} { + item_id:integer,notnull,optional,multiple + {assignments_orderby ""} +} -properties { +} + +set user_id [ad_conn user_id] + +array set config $cf +set shaded_p $config(shaded_p) + +set list_of_package_ids $config(package_id) +set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0] + +set admin_p 0 +array set package_admin_p [list] +foreach package_id $config(package_id) { + set package_admin_p($package_id) [permission::permission_p -object_id $package_id -privilege admin] + if { $package_admin_p($package_id) } { + set admin_p 1 + } +} + +db_multirow grades get_grades { *SQL* } { +} + +set notification_chunk [notification::display::request_widget \ + -type one_assignment_notif \ + -object_id $package_id \ + -pretty_name "Assignments" \ + -url [ad_conn url] \ + ] + Index: openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet-postgresql.xql 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,20 @@ + + + +postgresql7.1 + + + + + select eg.grade_plural_name, + eg.grade_id + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id in ([join $list_of_package_ids ,]) + order by grade_plural_name desc + + + + + Index: openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet.adp 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,26 @@ + + + + + +   + + Index: openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation-portlet/www/evaluation-evaluations-portlet.tcl 31 May 2004 23:43:10 -0000 1.1 @@ -0,0 +1,47 @@ +# /evaluation-portlet/www/evaluation-portlet.tcl + +ad_page_contract { + The display logic for the evaluation portlet + + @author jopez@galileo.edu + @creation-date May 2004 + @cvs_id $Id: evaluation-evaluations-portlet.tcl,v 1.1 2004/05/31 23:43:10 josee Exp $ +} { + item_id:integer,notnull,optional,multiple + {evaluations_orderby ""} +} -properties { + +} + +set user_id [ad_conn user_id] + +array set config $cf +set shaded_p $config(shaded_p) + +set list_of_package_ids $config(package_id) +set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0] + +set admin_p 0 +array set package_admin_p [list] +foreach package_id $config(package_id) { + set package_admin_p($package_id) [permission::permission_p -object_id $package_id -privilege admin] + if { $package_admin_p($package_id) } { + set admin_p 1 + } +} + +db_multirow grades get_grades { *SQL* } { +} + +if { [string eq $one_instance_p 1] && [string eq $admin_p 0] } { + set total_class_grade [format %.2f [db_string get_total_grade "select evaluation__class_total_grade(:user_id,[lindex $list_of_package_ids 0])"]] +} + + +set notification_chunk [notification::display::request_widget \ + -type one_evaluation_notif \ + -object_id $package_id \ + -pretty_name "Evaluations" \ + -url [ad_conn url] \ + ] +