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 @@
+
+
+
+
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 {+@bottom_line;noquote@ +
+ 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 @@ + + +