Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/card.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/card.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/card.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/cards.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/cards.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/cards_list-chunk-table.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/cards_list-chunk-table.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/cards_list-chunk-table.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cards/www/cards_list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/cards_list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/cards_list.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,81 @@ + + + +
+ +
@community_name@
+ + +
 
+ + + + #cards.card_Setup_evaluation# + #cards.card_Manage_notes# + #cards.import_grades# + #cards.card_Grades_list# + #cards.card_Orla# +
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#cards.card_Student_records#
 #dotlrn.Last_Name#   + + #cards.tooltip_orderby_asc# + + #cards.tooltip_orderby_desc# + #dotlrn.First_Name#   + + #cards.tooltip_orderby_asc# + + #cards.tooltip_orderby_desc# + #dotlrn.Email#   + + #cards.tooltip_orderby_asc# + + #cards.tooltip_orderby_desc# +
@current_members.rownum@ + + @current_members.last_name@ + + @current_members.first_names@ + + + @current_members.email@ +

+<%= @current_members:rowcount@ %> #dotlrn.student_role_pretty_plural#
+#cards.generate_csv# + +
+ + + Index: openacs-4/packages/cards/www/cards_list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/cards_list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/cards_list.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,149 @@ +ad_page_contract { +} -query { + {order:optional last_name} + {order_dir:optional asc} + {mode:optional ""} +} -properties { +} + +set dotlrn_url [dotlrn::get_url] +set my_user_id [ad_conn user_id] +set referer [ns_conn url] + + +# Check if we are in a subcommunity. In this case, we use the big parent community cards +# but only show the user cards that are in subgroup + +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] + +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + + + +#set community_id [dotlrn_community::get_community_id] +#set community_selected $community_id +#set community_id [cards::get_big_parent_community -community_id $community_id] +#if {$community_selected ne $community_id} { +# append community_name [cards::get_community_pretty_name -community_id $community_id] \ +# " :: " [cards::get_community_pretty_name -community_id $community_selected] +#} else { +# set community_name [cards::get_community_pretty_name -community_id $community_id] +#} + + + +# Access control +set site_wide_admin_p [permission::permission_p \ + -object_id [acs_magic_object security_context_root] \ + -privilege admin \ +] + +if {!$site_wide_admin_p} { + set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +} else { + set admin_p 1 +} + +set site_admin [acs_user::site_wide_admin_p] + + + +#**************************************************** +#OPCIONES DE MANTENIMIENTO +#**************************************************** + +# Baja de alumnos no miembros de la comunidad ==> POR DECIDIR + + +# ------------------------------------------------------------------ +# ALTA de alumnos miembros de la comunidad sin ficha +# ------------------------------------------------------------------ +# 1. seleccionar usuarios sin card para la comunidad +set num_notes_created 0 +set l_students_no_card [cards::get_no_card_student_list -community_id $community_id] + +# 2. Seleccionar anotaciones de la comunidad +#db_multirow community_notes community_notes_sql { *SQL* } +set l_tasks [cards::get_community_tasks -community_id $community_id] + + +# 3. Crear las CARDS a los usuarios sin card +foreach usr $l_students_no_card { + # creamos la card + #db_dml insert_add_new_card { *SQL* } + cards::create_student_card -community_id $community_id -user_id $usr + + # Obtenemos su card_id en esa comunidad + #db_1row card_user_id { *SQL* } + set card_id [cards::get_card_id -community_id $community_id -user_id $usr] + + # Para cada anotacion de la comunidad + foreach task $l_tasks { + # 4. Crear las anotaciones a los alumnos + #db_dml insert_pending_notes { *SQL* } + cards::create_student_note -community_id $community_id -card_id $card_id -task_id $task + set num_notes_created [expr $num_notes_created + 1] + } +} + +# Numero de fichas creadas y anotaciones puestas al dia +set num_cards_created [llength $l_students_no_card] +#set num_notes_created [llength $l_tasks] +#**************************************************** + + +# Students Redirect to its student card +if {!$admin_p} { + ad_returnredirect "student_card?user_id=$my_user_id&nav_sel=ficha" + } + +# Mostrar el listado de alumnos con ficha + + +if {$community_selected ne $parent_community_id} { + db_multirow current_members select_sc_estudents_info { *SQL* } +} else { + db_multirow current_members select_students_info { *SQL* } +} +# faltar�a arreglarlo aunque de momento no hace falta xq si estamos en un subgrupo no se nos muestran las fichas por defecto + + +# CSV +if { $mode eq "csv" } { + + +set elements [list first_names [list label "#dotlrn.First_Name#"]] + + lappend elements last_name \ + [list label "#dotlrn.Last_Name#"] + + lappend elements email \ + [list label "#dotlrn.Email#"] + +template::list::create \ + -name csv_members \ + -multirow current_members \ + -key user_id_id \ + -elements $elements \ + -selected_format csv -formats { + csv { output csv } + } + template::list::write_output -name csv_members +} + Index: openacs-4/packages/cards/www/cards_list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/cards_list.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/cards_list.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,58 @@ + + + + postgresql7.1 + + + + select acs_users_all.user_id as user_id, + card_id, + last_name, + first_names, + email + from acs_users_all, + dotlrn_member_rels_approved + inner join card on (ref_user = user_id) + where dotlrn_member_rels_approved.community_id = :community_id and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') and + card.ref_community = community_id + order by $order $order_dir + + + + + + + + select + acs_users_all.user_id as user_id, + card_id, + last_name, + first_names, + email + from + acs_users_all, + dotlrn_member_rels_approved + inner join + card on (ref_user = user_id) + where + dotlrn_member_rels_approved.community_id = :community_id and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') and + card.ref_community = :community_id and + acs_users_all.user_id in ( + select acs_users_all.user_id + from acs_users_all, dotlrn_member_rels_approved + where + dotlrn_member_rels_approved.community_id = :community_selected and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') + ) + order by $order $order_dir + + + + + + Index: openacs-4/packages/cards/www/eval2cards.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/eval2cards.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/eval2cards.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,80 @@ + + + + + +
+ +
@community_name@
+ + +
 
+ + +

#cards.import_grades_from_eval#

+ + + + + + + + +

#cards.eval2card_info#

+ +
+

#cards.select_evaluation_task#
+ + +

#cards.select_card_task#
+ +
+ +

+

+ +
+#cards.no_tasks_to_import# + +
Index: openacs-4/packages/cards/www/eval2cards.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/eval2cards.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/eval2cards.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,118 @@ +# /cards/eval2cards + +ad_page_contract { + Paco Soler Lahuerta + fransola@uv.es +} -query { + {mode:optional ""} + {e_task:optional ""} + {c_task:optional ""} + +} + + +# Check if we are in a subcommunity. In this case, we use the big parent community cards +# but only show the user cards that are in subgroup + +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] + +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + + + +if {$reuse_parent_cards == 1} { + ad_returnredirect "cards_error?num_e=3" +} else { + + +# Obtenemos comunity_id +#set community_id [dotlrn_community::get_community_id] +#set community_name [cards::get_community_pretty_name -community_id $community_id] +# Obtenemos pakage_id del paquete evaluation para la comunidad +set ev_ctrl [db_0or1row get_evaluation_pid {* SQL *}] + + + + +# Si no hay paquete volvemos de donde ven�amos +if {$ev_ctrl == 0} { + ad_returnredirect "cards_error?num_e=1" +} else { + + if {$mode == "update"} { + + # Obtenemos el perfect score de la tarea de evaluation seleccionada + db_1row get_perfect_score {* SQL *} + # Obtenemos el max_grade de la tarea de card seleccionada + db_1row get_max_grade {* SQL *} + + + + # Seleccionar las notas de las tareas de cada alumno en evaluation + db_multirow task_notes get_task_notes {* SQL *} + set cont 0 + # actualizarla con las de evaluation + multirow foreach task_notes { + if {[empty_string_p $grade]} { + set grade 0.00 + } else { + + if {$perfect_score > 0} { + set grade [expr $grade * $max_grade / 100] + } + + # Si el party id es un grupo buscamos los usuarios + set is_group [db_0or1row get_is_group "select group_id from evaluation_task_groups where group_id = :party_id"] + + # Si no es un grupo + if {$is_group == 0} { + db_1row get_card_id {* SQL *} + db_dml update_c_task { *SQL* } + set cont [expr $cont + 1] + set mode "" + # Si es un grupo + } else { + db_multirow group_members get_group_members {* SQL *} + multirow foreach group_members { + db_1row get_card_id {* SQL *} + db_dml update_c_task { *SQL* } + set cont [expr $cont + 1] + set mode "" + } + } + } + } + # redirigir a la pagina de notas para que la penya compruebe lo que hay. + if {$cont > 0} { + ad_returnredirect "grade_task?task_id=$c_task&mode=update&mode2=eval" + } else { + ad_returnredirect "cards_error?num_e=2" + } + + + } + # obtenemos las tareas por asignaciones del evaluation de la comunidad + db_multirow taskXgrade get_taskXgrades {* SQL *} + + # obtenemos las tareas por bloques de las cards de la comunidad + db_multirow taskXbloc get_taskXbloc {* SQL *} + + } +} + Index: openacs-4/packages/cards/www/eval2cards.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/eval2cards.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/eval2cards.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,97 @@ + + + postgresql7.3 + + + + select object_id as package_id + from acs_objects o, apm_packages p + where o.object_id = p.package_id and p.package_key = 'evaluation' + and o.context_id = (select package_id from dotlrn_communities_all + where community_id = :community_id) + + + + + + select eg.grade_id, eg.item_id, eg.grade_plural_name, + eg.comments,eg.weight + 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 = :package_id + $orderby + + + + + + select eg.grade_name || ' : ' || task_name as egt_name, eg.grade_id, eg.item_id, eg.weight, + task_id, task_item_id + from evaluation_gradesx eg, acs_objects ao, evaluation_tasks et + where content_revision__is_live(eg.grade_id) = true and + content_revision__is_live(task_id) = true and + eg.item_id = ao.object_id and + ao.context_id = :package_id and + et.grade_item_id = eg.grade_item_id + + + + + + select p.percent_name || ' : ' || t.task_name as cbt_name, + t.task_id, p.percent_id + from card_percent p, card_task t + where t.ref_community = p.ref_community and + p.ref_community = :community_id and p.percent_id = t.ref_percent; + + + + + + select *, (select description from evaluation_student_evalsx where evaluation_id=ev.evaluation_id) as comments from evaluation_student_evals ev where task_item_id = :e_task + + + + + + update card_note set grade = :grade, note_comment = :comments + where ref_task = :c_task and + ref_card = :card_id and + ref_community = :community_id + + + + + + select perfect_score + from evaluation_tasks, cr_items + where task_item_id = item_id and + live_revision = task_id and + task_item_id = :e_task + + + + + + select max_grade from card_task where task_id = :c_task + + + + + + select p.person_id as party_id from persons p, acs_rels map where p.person_id = map.object_id_two and map.object_id_one = :party_id + + + + + + + select card_id from card where ref_community = :community_id and ref_user = :party_id + + + + + + + Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/eval_note.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/eval_note.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/eval_note.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/gest_eval.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/gest_eval.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/gest_eval.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/gest_notes.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/gest_notes.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/gest_notes.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cards/www/grade_task.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grade_task.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grade_task.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,71 @@ + + + + + +
+
@community_name@
+ +
 
+ +
+ + +

#cards.task_grade_edit# @task_name@
+#cards.card_task_max_grade#: @max_grade@

+
+ + + + @task_grades:rowcount@ #cards.card_Students#

+
+
+
+ +
+ + + +

#cards.task_grades_act# + #cards.from_eval#: @task_name@ +
#cards.card_task_max_grade#: @max_grade@

+ + @task_grades:rowcount@ #cards.card_Students#

+ +

+ +
+
+ + + + Index: openacs-4/packages/cards/www/grade_task.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grade_task.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grade_task.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,256 @@ +ad_page_contract { +} -query { + task_id:integer,notnull + + item_ids:array,integer,optional + item_to_edit_ids:array,integer,optional + + evaluation_ids:array,integer,optional + + grade:array,optional + note_comment:array,optional + is_active:array,optional + + {mode:optional "edit"} + {mode2:optional ""} +} -properties { +} -validate { + valid_grade { + set counter 0 + foreach note_id [array names grade] { + if { [info exists grade($note_id)] && ![empty_string_p $grade($note_id)] } { + incr counter + set grade($note_id) [template::util::leadingTrim $grade($note_id)] + if { ![ad_var_type_check_number_p $grade($note_id)] } { + set wrong_grade $grade($note_id) + ad_complain "[_ evaluation.lt_The_grade_must_be_a_v]" + } + } + } + } + valid_note_comment { + foreach note_id [array names note_comment] { + if { [info exists note_comment($note_id)] && ![info exists grade($note_id)] } { + set wrong_comments $note_comment($note_id) + ad_complain "[_ evaluation.lt_There_is_a_comment_fo]" + } + if { [info exists note_comment($note_id)] && ([string length $note_comment($note_id)] > 400) } { + set wrong_comments $note_comment($note_id) + ad_complain "[_ evaluation.lt_There_is_a_comment_la]" + } + } + } +} + +# Declaraci� de variables a emprar +set error 0 +set msg_error "" +set link_url "" +set is_edit 0 +set return_url "manage_tasks" + +# Comunitat a la que estem. Check if we are in a subcommunity. In this case, we use the big parent community. +# but we only show the user cards that are in subgroup +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + + +#set community_id [dotlrn_community::get_community_id] +#set community_selected $community_id +#set community_id [cards::get_big_parent_community -community_id $community_id] + +#if {$community_selected ne $community_id} { +# append community_name [cards::get_community_pretty_name -community_id $community_id] \ +# " :: " [cards::get_community_pretty_name -community_id $community_selected] +#} else { +# set community_name [cards::get_community_pretty_name -community_id $community_id] +#} + + + +# Usuari que som y url a la que estem +set my_user_id [ad_conn user_id] +set referer [ns_conn url] + +# Si no som administradors [admin_p = 0] --> error: permis denegat +set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +if {!$admin_p} { + ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] +} + +# Obtenemos datos de la tarea +db_1row get_task_info { *SQL* } + +if {$mode eq "edit"} { + + +if {$parent_community_id ne $community_selected} { + db_multirow task_grades get_sc_task_grades { *SQL* } +} else { + db_multirow task_grades get_task_grades { *SQL* } +} + + +set elements [list name [list label "#cards.card_Student#" \ + display_template {@task_grades.name@}]] + +lappend elements note_comment \ + [list label "#cards.card_Comment#" \ + display_template {}] + +lappend elements grade \ + [list label "#cards.card_Grade#" \ + display_template {}] + +if {$type == 2} { + lappend elements is_active \ + [list label "#cards.card_Active#" \ + display_template { + + + + + }] +} + +template::list::create \ + -name task_grades \ + -multirow task_grades \ + -key note_id \ + -elements $elements +} + + +set num_activas 0 + +if {$mode == "update"} { + if {$mode2 == ""} { + set num_activas 0 + set l_notes [db_list get_note_ids { *SQL* }] + foreach note_id $l_notes { + if {[info exists grade($note_id)] && ![empty_string_p $$grade($note_id)]} { + set new_grade $grade($note_id) + } else { + set new_grade 0.00 + } + if {[info exists grade($note_id)]} { + set new_comment [DoubleApos $note_comment($note_id)] + } else { + set new_comment "" + } + + if {[info exists is_active($note_id)]} { + set num_activas [expr $num_activas + 1] + if {$is_active($note_id)} { + set new_actv 1 + } else { + set new_actv 0 + } + } else { + if {$type == 2} { + set new_actv 0 + set num_activas [expr $num_activas + 1] + } else { + set new_actv 1 + } + } + db_dml update_note { *SQL* } + } + } else { + set return_url "eval2cards" + } + # Obtenemos datos de la tarea +if {$community_id ne $community_selected} { + db_multirow task_grades get_sc_task_grades { *SQL* } +} else { + db_multirow task_grades get_task_grades { *SQL* } +} + + set elements [list name [list label "#cards.card_Student#"]] + + lappend elements note_comment \ + [list label "#cards.card_Comment#" \ + display_template {
@task_grades.note_comment@
}] + +lappend elements grade \ + [list label "#cards.card_Grade#" \ + display_template {@task_grades.grade@}] + +if {$type == 2} { + lappend elements is_active \ + [list label "#cards.card_Active#" \ + display_template { + + + + + }] +} + + +template::list::create \ + -name task_grades \ + -multirow task_grades \ + -key note_id \ + -elements $elements +} + + +if { $mode eq "csvchanged" } { + +set mode "" +# Obtenemos datos de la tarea +if {$community_id ne $community_selected} { + db_multirow task_grades get_sc_task_grades { *SQL* } +} else { + db_multirow task_grades get_task_grades { *SQL* } +} + +set elements [list name [list label "#cards.card_Student#"]] + + lappend elements note_comment \ + [list label "#cards.card_Comment#" \ + display_template {
@task_grades.note_comment@
}] + + lappend elements grade \ + [list label "#cards.card_Grade#" \ + display_template {@task_grades.grade@}] + +if {$type == 2} { + lappend elements is_active \ + [list label "#cards.card_Active#" \ + display_template { + + + + + }] +} + + +template::list::create \ + -name task_grades \ + -multirow task_grades \ + -key note_id \ + -elements $elements \ + -selected_format csv -formats { + csv { output csv } + } + template::list::write_output -name task_grades +} Index: openacs-4/packages/cards/www/grade_task.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grade_task.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grade_task.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,75 @@ + + + + postgresql7.1 + + + + select t.*,p.type as type + from card_task t, card_percent p + where + task_id = :task_id and + t.ref_community = p.ref_community and + t.ref_percent = p.percent_id + + + + + + select last_name||', '||first_names as name, + note_id, ref_card, grade, note_comment, is_active + from card_note, acs_users_all, card + where ref_task = :task_id and + user_id = ref_user and ref_card=card_id + and user_id in ( + select a.user_id as user_id + from acs_users_all a, dotlrn_member_rels_approved r + where r.community_id = :community_id and + r.user_id = a.user_id and + (role='student' or role='member') + order by user_id asc + ) + order by last_name + + + + + + select last_name||', '||first_names as name, + note_id, ref_card, grade, note_comment, is_active + from card_note, acs_users_all, card + where ref_task = :task_id and + user_id = ref_user and ref_card=card_id + and user_id in ( + select a.user_id as user_id + from acs_users_all a, dotlrn_member_rels_approved r + where r.community_id = :community_selected and + r.user_id = a.user_id and + (role='student' or role='member') + order by user_id asc + ) + order by last_name + + + + + + + + select note_id + from card_note + where ref_task = :task_id + + + + + + update card_note set + grade = :new_grade, note_comment= :new_comment, is_active= :new_actv + where note_id = :note_id + + + + + + Index: openacs-4/packages/cards/www/grade_task_list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grade_task_list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grade_task_list.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,24 @@ + + + +
+ + +

@community_name@
@task_name@ + [#cards.card_task_max_grade#: @max_grade@]

+ +
+ +

@task_grades:rowcount@ #cards.card_Students# +

+ + +

+ +
+ + + + Index: openacs-4/packages/cards/www/grade_task_list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grade_task_list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grade_task_list.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,137 @@ +ad_page_contract { +} -query { + task_id:integer,notnull + + {mode:optional "list"} +} -properties { +} + +# Declaraci� de variables a emprar +set error 0 +set msg_error "" +set link_url "" +set is_edit 0 + +# Comunitat a la que estem. Check if we are in a subcommunity. In this case, we use the big parent community. +# but we only show the user cards that are in subgroup +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + + + +# Usuari que som y url a la que estem +set my_user_id [ad_conn user_id] +set referer [ns_conn url] + +# Si no som administradors [admin_p = 0] --> error: permis denegat +set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +if {!$admin_p} { + ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] +} + +# Obtenemos datos de la tarea +db_1row get_task_info { *SQL* } + +# Obtenemos datos del bloque. En concreto el % para ctrl caso especia % = 0 +db_1row get_block_percent { *SQL* } + +# Obtenemos datos de la tarea +if {$community_selected ne $community_selected} { + db_multirow task_grades get_sc_task_grades { *SQL* } +} else { + db_multirow task_grades get_task_grades { *SQL* } +} + +if { $mode eq "list" } { +set mode "" +set elements [list name [list label "#cards.card_Student#"]] +#lappend elements note_comment \ + [list label "#cards.card_Comment#" \ + display_template {
@task_grades.note_comment@
}] + +if {$percent == 0} { + lappend elements note_comment \ + [list label "#cards.card_Comment#" \ + display_template {@task_grades.note_comment@}] + lappend elements grade \ + [list label "   #cards.card_Grade#" \ + display_template {   @task_grades.grade@}] +} else { + lappend elements grade \ + [list label "   #cards.card_Grade#" \ + display_template {   @task_grades.grade@}] +} + +if {$type == 2} { + lappend elements is_active \ + [list label "#cards.card_Active#" \ + display_template { + + + + + }] +} + +template::list::create \ + -name task_grades \ + -multirow task_grades \ + -key note_id \ + -elements $elements +} + +# CSV +if { $mode eq "csv" } { + +set mode "" + +set elements [list name [list label "#cards.card_Student#"]] + + lappend elements note_comment \ + [list label "#cards.card_Comment#" \ + display_template {
@task_grades.note_comment@
}] + + lappend elements grade \ + [list label "#cards.card_Grade#" \ + display_template {@task_grades.grade@}] + +if {$type == 2} { + lappend elements is_active \ + [list label "#cards.card_Active#" \ + display_template { + + + + + }] +} + + +template::list::create \ + -name task_grades \ + -multirow task_grades \ + -key note_id \ + -elements $elements \ + -selected_format csv -formats { + csv { output csv } + } + template::list::write_output -name task_grades +} + + Index: openacs-4/packages/cards/www/grade_task_list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grade_task_list.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grade_task_list.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,84 @@ + + + + postgresql7.1 + + + + select t.*,p.type as type + from card_task t, card_percent p + where + task_id = :task_id and + t.ref_community = p.ref_community and + t.ref_percent = p.percent_id + + + + + + select last_name||', '||first_names as name, + note_id, ref_card, grade, note_comment, is_active + from card_note, acs_users_all, card + where ref_task = :task_id and + user_id = ref_user and ref_card=card_id + and user_id in ( + select a.user_id as user_id + from acs_users_all a, dotlrn_member_rels_approved r + where r.community_id = :community_id and + r.user_id = a.user_id and + (role='student' or role='member') + order by user_id asc + ) + order by last_name + + + + + + select last_name||', '||first_names as name, + note_id, ref_card, grade, note_comment, is_active + from card_note, acs_users_all, card + where ref_task = :task_id and + user_id = ref_user and ref_card=card_id + and user_id in ( + select a.user_id as user_id + from acs_users_all a, dotlrn_member_rels_approved r + where r.community_id = :community_selected and + r.user_id = a.user_id and + (role='student' or role='member') + order by user_id asc + ) + order by last_name + + + + + + + select note_id + from card_note + where ref_task = :task_id + + + + + + update card_note set + grade = :new_grade, note_comment= :new_comment, is_active= :new_actv + where note_id = :note_id + + + + + + select percent + from card_percent, card_task + where percent_id = ref_percent and + task_id = :task_id + + + + + + + Index: openacs-4/packages/cards/www/grades.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,180 @@ + + +
 
+ + + + + + + + +#cards.card_No_notes# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#cards.card_Grades_list##cards.card_Average_grade#: + <%= [format "%2.2f" @nota_final@] %> + @nota_final@ +
 @block.percent_name@ (@block.percent@%) +  [>= @block.rvalor@] +  #cards.avg#: + <%= [format "%2.2f" @block.block_grade@] %> + + (<%= [format "%2.2f" @block.block_gradep@] %>)
#cards.card_Note##cards.card_Date##cards.card_Comment##cards.card_Grade##cards.card_Active##cards.card_Action#
@grades.task_name@ + [@grades.task_percent@%]<%=[string range [format "%s" @grades.date_mod@] 0 15]%> @grades.note_comment@@grades.grade@ / @grades.max_grade@  + + + + + +
+ + + + + +
@grades.task_name@ + [@grades.task_percent@%]  + <%= [string range [format "%s" @grades.date_mod@] 0 15] %> @grades.task_comment@@grades.grade@ / @grades.max_grade@  + + +  
@grades.task_name@ + [@grades.task_percent@%]  + <%= [string range [format "%s" @grades.date_mod@] 0 15] %>
+ +
+ + # M�ximo 400 car�cteres. Quedan: +
+
+   + + + + + + + + + + + + + + + + + + + + +
#cards.card_Without_academic_validity# +
+
Index: openacs-4/packages/cards/www/grades.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,131 @@ +ad_page_contract { +} -query { + user_id:integer,notnull + {mode:optional ""} + {nav_sel:optional ""} + {note_id:optional ""} +} -properties { + block:multirow + grades:multirow +} + +# Esto es una xorrada. pero si no lo pongo no va. +#set uid $user_id +#set m $mode +set nid $note_id +#set nsel $nav_sel + + +template::multirow create block percent_id percent_name type percent rvalor block_grade block_gradep +template::multirow create grades note_id ref_card task_name task_percent date date_mod note_comment grade gradep max_grade is_active ref_percent type + + +# Declaraci� de variables +set widthheight_param "width=72 height=90" +set export_vars [export_url_vars user_id] +acs_user::get -user_id $user_id -array user_info +set existe_photo 1 +set subsite_url [subsite::get_element -element url] +set is_edit 0 + +# Comunitat a la que estem. Check if we are in a subcommunity. In this case, we use the big parent community. +# but we only show the user cards that are in subgroup +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + +# Usuari que som y url a la que estem +set card_id [cards::get_card_id -community_id $community_id -user_id $user_id] +set my_user_id [ad_conn user_id] +set referer [ns_conn url] + +# Si no som administradors [admin_p = 0] --> error: permis denegat +set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +if {!$admin_p} { + ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] +} + +set datetime [clock_to_ansi [clock seconds]] + +#db_multirow comments select_comment { *SQL* } + + +#if {$mode ne "comment_edit"} { +# set comment_id "" +# set mode "" +#} +#template::multirow append usercomm $names $quota $max_quota $files $max_files + +set contador 0 +set block_gradep 0 +set nota_final 0 +set grade_state 1 + + +db_multirow blocks select_blocks { *sql* } +multirow foreach blocks { + set contador [expr $contador + 1] + set block_grade 0.00 + set task_num 0 + set gradep 0.00 + db_multirow block_task select_block_tasks { *sql* } + multirow foreach block_task { + set task_ctrl [db_0or1row task_note { *sql* }] + if {$task_ctrl eq 1} { + if {$is_active eq "t"} { + set gradep [expr $grade * 10 / $max_grade] + if {$task_percent > 0 & $type eq 3} { + set gradep [expr $gradep * $task_percent / 100] + } + set block_grade [expr $block_grade + $gradep] + set task_num [expr $task_num + 1] + } + template::multirow append grades $note_id $ref_card $task_name $task_percent $date $date_mod \ + $note_comment $grade $gradep $max_grade $is_active $ref_percent $type + } + } + if {$type ne 3 && $task_num > 0} { + set block_grade [expr $block_grade / $task_num] + } + if {$block_grade < $rvalor} { #Si no superamos la restricci�n + set grade_avg 1 + set grade_state 0 + } else { + set grade_avg 0 + } + set block_gradep [expr $block_grade * $percent / 100] + set nota_final [expr $nota_final + $block_gradep] + template::multirow append block $percent_id $percent_name $type $percent $rvalor $block_grade $block_gradep $grade_avg +} + +if {($grade_state == 0) && $nota_final >= 5} { + set nota_final "4*" + } else { + if {$nota_final <= 0} { + set nota_final "NP" + } +} + +if {$mode ne "note_edit"} { + set mode "" + set note_id "" +} else { + set note_id $nid +} + + Index: openacs-4/packages/cards/www/grades.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,43 @@ + + + postgresql7.1 + + + + select * from card_comment + where ref_card = :card_id and + ref_community = :community_id + + + + + + select * from card + where ref_user= :user_id and ref_community= :community_id + + + + + + select * from card_percent where ref_community= :community_id order by percent desc + + + + + + + select * from card_task where ref_percent= :percent_id and ref_community = :community_id order by task_name + + + + + + select * from card_note + where ref_card= :card_id and ref_task= :task_id + + + + + + + Index: openacs-4/packages/cards/www/grades_list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades_list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades_list.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,37 @@ + + + + + + + + +
+ +
@community_name@
+ +
 
+
#cards.card_Grades_list#
+ + +

@student:rowcount@ #cards.card_Students#      +#cards.card_Passed#: @passed@      +#cards.card_Not_passed#: @not_passed@     +#cards.card_Not_done#: @not_presented@ +

+ +

+ +      + +

+#cards.card_Without_academic_validity# +
+ + + +
+

+ Index: openacs-4/packages/cards/www/grades_list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades_list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades_list.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,179 @@ +ad_page_contract { +} -query { + {nav_sel:optional ""} + {order:optional last_name} + {order_dir:optional asc} + {mode:optional ""} +} -properties { + block:multirow + grades:multirow +} + +#template::multirow create block percent_id percent_name type percent rvalor block_grade block_gradep +template::multirow create grades num user_id note_id nom + +#set l_alum_grades [list] +set error 0 +# Declaraci� de variables +set widthheight_param "width=72 height=90" +set export_vars [export_url_vars user_id] +# acs_user::get -user_id $user_id -array user_info +set existe_photo 1 +set subsite_url [subsite::get_element -element url] +set is_edit 0 + +# Grade Stats +set passed 0 +set not_passed 0 +set not_presented 0 + + +# Comunitat a la que estem. Check if we are in a subcommunity. In this case, we use the big parent community. +# but we only show the user cards that are in subgroup +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} +# Usuari que som y url a la que estem +#set card_id [cards::get_card_id -community_id $community_id -user_id $user_id] +set my_user_id [ad_conn user_id] +set referer [ns_conn url] + +# Si no som administradors [admin_p = 0] --> error: permis denegat +set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +if {!$admin_p} { + ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] +} + +set datetime [clock_to_ansi [clock seconds]] + + +# Obtenemos la lista de bloques de la comunidad y ampliamos el multirow +db_multirow block_list select_blocks { *SQL* } +multirow foreach block_list { + # eval "template::multirow extend grades " $percent_name ==> CAMBIO + eval "template::multirow extend grades " $percent_id + # " " $ percent_name "_p" +} +template::multirow extend grades final_grade + + +if {$community_id ne $community_selected} { + db_multirow student select_sc_estudents_info { *SQL* } +} else { + db_multirow student select_students_info { *SQL* } +} + +db_multirow block_grades select_block_grades { *SQL* } +set num_alumne 1 +multirow foreach student { + set grade_final 0 + set grade_block 0 + set grade_block_p 0 + set grade_state 1 + set nom "" + # A�adimos al multirow User_Id - Card_Id - Nombre del Alumno + template::multirow append grades $num_alumne $user_id $card_id [append nom $last_name ", " $first_names] + set num_alumne [expr $num_alumne + 1] + set num [template::multirow size grades] + multirow foreach block_grades { + + set grade_block "" + set grade_block_p "" + set grade_block_value "" + if {$ref_card == $card_id} { + set grade_block [expr $nota_bloque * 1.00 / $nt] + #append grade_block $nota_bloque " - " $nt " - " $xcent + set grade_block_p [expr $grade_block * $xcent /100.00] + #set grade_block_p $grade_block + if {$grade_block < $rvalor} { + set grade_state 0 + } + set grade_final [expr $grade_final + $grade_block_p] + # A�adimos al multirow la informaci�n del bloque + # set column $percent_name ==> MOD: vamos a utilizar ref_percent + set column $ref_percent + append grade_block_value [format "%2.2f" $grade_block] " (" [format "%2.2f" $grade_block_p] ")" + template::multirow set grades $num $column $grade_block_value + #append column "_p" + #template::multirow set grades $ num $ column $ grade_block_p + } + } + set grade_final [format "%2.2f" $grade_final] + if {($grade_state == 0) && $grade_final >= 5} { + set grade_final "4*" + set not_passed [expr $not_passed + 1] + } else { + if {$grade_final <= 0} { + set grade_final "NP" + set not_presented [expr $not_presented + 1] + } else { + if {$grade_final >= 5} { + set passed [expr $passed + 1] + } else { + set not_passed [expr $not_passed + 1] + } + } + } + + # A�adimos al multirow la nota final + template::multirow set grades $num final_grade $grade_final +} + +# LIST TEMPLATE +# Preparaci�n +set elements [list num [list label " "]] +lappend elements nom [list label "#dotlrn.First_Name#"] + +multirow foreach block_list { + # lappend elements $percent_name \ ==> CAMBIO + lappend elements $percent_id \ + [list label $percent_name ] +# lappend elements $ {percent_name}_p \ + [list label $ {percent_name}_p ] +} + +lappend elements final_grade [list label "#cards.card_Final_grade#"] + + +if {$mode eq "list"} { + template::list::create \ + -name list_grades \ + -multirow grades \ + -key card_id \ + -class "list_to_print" \ + -elements $elements +} else { + if {$mode eq "csv"} { + template::list::create \ + -name list_grades \ + -multirow grades \ + -key card_id \ + -elements $elements\ + -selected_format csv -formats { + csv { output csv } + } + template::list::write_output -name list_grades + + } else { + template::list::create \ + -name list_grades \ + -multirow grades \ + -key card_id \ + -elements $elements + } +} Index: openacs-4/packages/cards/www/grades_list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades_list.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades_list.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,112 @@ + + + + postgresql7.1 + + + + select acs_users_all.user_id as user_id, + card_id, + last_name, + first_names, + email + from acs_users_all, + dotlrn_member_rels_approved + inner join card on (ref_user = user_id) + where dotlrn_member_rels_approved.community_id = :community_id and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') and + card.ref_community = community_id + order by $order $order_dir + + + + + + select + acs_users_all.user_id as user_id, + card_id, + last_name, + first_names, + email + from + acs_users_all, + dotlrn_member_rels_approved + inner join + card on (ref_user = user_id) + where + dotlrn_member_rels_approved.community_id = :community_id and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') and + card.ref_community = :community_id and + acs_users_all.user_id in ( + select acs_users_all.user_id + from acs_users_all, dotlrn_member_rels_approved + where + dotlrn_member_rels_approved.community_id = :community_selected and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') + ) + order by $order $order_dir + + + + + + + select * from card + where ref_user= :user_id and ref_community= :community_id + + + + + + select * from card_percent where ref_community= :community_id + and percent > 0 order by percent desc + + + + + + + select * from card_task where ref_percent= :percent_id and ref_community = :community_id order by task_name + + + + + + select * from card_note + where ref_card= :card_id and ref_task= :task_id + + + + + + + select ref_card,ref_percent, CASE WHEN type=3 THEN '1' ELSE count(task_id) END as nt, CASE WHEN type = 3 THEN sum(grade*task_percent/(max_grade*10.00)) ELSE sum(grade*10.00/(max_grade)) END as nota_bloque, percent as xcent, rvalor, percent_name from card_note inner join (card_task inner join card_percent on (ref_percent = percent_id)) on (ref_task = task_id) where is_active = 't' group by ref_percent,ref_card, type, percent, rvalor, percent_name order by ref_card + + + + + + select ref_card, + ref_percent, + CASE WHEN type=3 THEN '1' ELSE count(task_id) END as nt, + CASE WHEN type = 3 THEN sum(grade*task_percent/(max_grade*10.00)) ELSE sum(grade*10.00/(max_grade)) END as nota_bloque, + percent as xcent, + rvalor, + percent_name + from card_note cn, card_task ct, card_percent cp + where ct.ref_percent = cp.percent_id and + ct.ref_community = cp.ref_community and + ct.ref_community = cn.ref_community and + cn.ref_community = :community_id and + cn.ref_task = ct.task_id and + is_active = 't' group by ref_percent,ref_card, type, percent, rvalor, percent_name order by ref_card + + + + + + + Index: openacs-4/packages/cards/www/grades_student.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades_student.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades_student.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,64 @@ + + + +
 
+ + + + + + + + +#cards.card_No_notes# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#cards.card_Grades_list##cards.card_Average_grade#: + <%= [format "%2.2f" @nota_final@] %> + @nota_final@ +
 @block.percent_name@ (@block.percent@%) +  [>= @block.rvalor@] +  #cards.avg#: + <%= [format "%2.2f" @block.block_grade@] %> + (<%= [format "%2.2f" @block.block_gradep@] %>)
#cards.card_Note##cards.card_Date##cards.card_Comment##cards.card_Grade##cards.card_Active#
@grades.task_name@ + [@grades.task_percent@%]<%= [string range [format "%s" @grades.date_mod@] 0 15] %> @grades.note_comment@ + @grades.grade@ / @grades.max_grade@  + + + + + +
#cards.grade_alert# - #cards.card_Without_academic_validity# +
+
Index: openacs-4/packages/cards/www/grades_student.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades_student.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades_student.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,83 @@ +ad_page_contract { +} -query { + user_id:integer,notnull + {nav_sel:optional ""} +} -properties { + block:multirow + grades:multirow +} + +template::multirow create block percent_id percent_name type percent rvalor block_grade block_gradep +template::multirow create grades note_id ref_card task_name task_percent date date_mod note_comment grade gradep max_grade is_active ref_percent type + + +# Declaraci� de variables +set widthheight_param "width=72 height=90" +set export_vars [export_url_vars user_id] +acs_user::get -user_id $user_id -array user_info +set existe_photo 1 +set subsite_url [subsite::get_element -element url] +set is_edit 0 + +# Comunitat a la que estem. Check if we are in a subcommunity. In this case, we use the big parent community. +# but we only show the user cards that are in subgroup +set community_id [dotlrn_community::get_community_id] +set community_selected $community_id +set community_id [cards::get_big_parent_community -community_id $community_id] + +# Usuari que som y url a la que estem +set card_id [cards::get_card_id -community_id $community_id -user_id $user_id] +set my_user_id [ad_conn user_id] +set referer [ns_conn url] + +set datetime [clock_to_ansi [clock seconds]] + +set contador 0 +set block_gradep 0 +set nota_final 0 +set grade_state 1 + + +db_multirow blocks select_blocks { *sql* } +multirow foreach blocks { + set contador [expr $contador + 1] + set block_grade 0.00 + set task_num 0 + set gradep 0.00 + db_multirow block_task select_block_tasks { *sql* } + multirow foreach block_task { + set task_ctrl [db_0or1row task_note { *sql* }] + if {$task_ctrl eq 1} { + if {$is_active eq "t"} { + set gradep [expr $grade * 10 / $max_grade] + if {$task_percent > 0 & $type eq 3} { + set gradep [expr $gradep * $task_percent / 100] + } + set block_grade [expr $block_grade + $gradep] + set task_num [expr $task_num + 1] + } + template::multirow append grades $note_id $ref_card $task_name $task_percent $date $date_mod \ + $note_comment $grade $gradep $max_grade $is_active $ref_percent $type + } + } + if {$type ne 3 && $task_num > 0} { + set block_grade [expr $block_grade / $task_num] + } + if {$block_grade < $rvalor} { #Si no superamos la restricci�n + set grade_avg 1 + set grade_state 0 + } else { + set grade_avg 0 + } + set block_gradep [expr $block_grade * $percent / 100] + set nota_final [expr $nota_final + $block_gradep] + template::multirow append block $percent_id $percent_name $type $percent $rvalor $block_grade $block_gradep $grade_avg +} + +if {($grade_state == 0) && $nota_final >= 5} { + set nota_final "4*" +} else { + if {$nota_final <= 0} { + set nota_final "NP" + } +} Index: openacs-4/packages/cards/www/grades_student.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/grades_student.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/grades_student.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,45 @@ + + + postgresql7.1 + + + + + + select * from card_comment + where ref_card = :card_id and + ref_community = :community_id + + + + + + select * from card + where ref_user= :user_id and ref_community= :community_id + + + + + + select * from card_percent where ref_community= :community_id order by percent desc + + + + + + + select * from card_task where ref_percent= :percent_id and ref_community = :community_id order by task_name + + + + + + select * from card_note + where ref_card= :card_id and ref_task= :task_id + + + + + + + Index: openacs-4/packages/cards/www/list-photos.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/list-photos.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/list-photos.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,45 @@ + + + + + + + +
+
#cards.card_Orla#: @community_name@
+ + +
 
+ + +
+ + + +
+ @photos.student;noquote@ +
+
 
+
+ +
+ @photos.student;noquote@ +
+
+
+
 
+
+ + +#cards.print_version# + + + + + Index: openacs-4/packages/cards/www/list-photos.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/list-photos.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/list-photos.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,70 @@ +ad_page_contract { +} -query { + {mode:optional ""} + {order:optional last_name} + {order_dir:optional asc} +} -properties { + photos:multirow +} + +set dotlrn_url [dotlrn::get_url] +set my_user_id [ad_conn user_id] +set referer [ns_conn url] +set widthheight_param "width=72 height=90" +template::multirow create photos student +set error 0 +set msg_error "" + +# Comunitat a la que estem. Check if we are in a subcommunity. In this case, we use the big parent community. +# but we only show the user cards that are in subgroup +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + +# Access control +set site_wide_admin_p [permission::permission_p \ + -object_id [acs_magic_object security_context_root] \ + -privilege admin \ +] + +if {!$site_wide_admin_p} { + set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +} else { + set admin_p 1 +} + +# Students Redirect to its student card +if {!$admin_p} { + ad_returnredirect "student_card?user_id=$my_user_id&nav_sel=ficha" + } + +# Mostrar el listado de alumnos con ficha +#db_multirow current_members select_students_info { *SQL* } + + + +if {$parent_community_id ne $community_selected} { + db_multirow current_members select_sc_estudents_info { *SQL* } +} else { + db_multirow current_members select_students_info { *SQL* } +} + +multirow foreach current_members { + set photo_student [cards::get_photo_orla -user_id $user_id -param $widthheight_param] + template::multirow append photos $photo_student +} Index: openacs-4/packages/cards/www/list-photos.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/list-photos.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/list-photos.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,58 @@ + + + + postgresql7.1 + + + + select acs_users_all.user_id as user_id, + card_id, + last_name, + first_names, + email + from acs_users_all, + dotlrn_member_rels_approved + inner join card on (ref_user = user_id) + where dotlrn_member_rels_approved.community_id = :community_id and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') and + card.ref_community = community_id + order by $order $order_dir + + + + + + + + select + acs_users_all.user_id as user_id, + card_id, + last_name, + first_names, + email + from + acs_users_all, + dotlrn_member_rels_approved + inner join + card on (ref_user = user_id) + where + dotlrn_member_rels_approved.community_id = :community_id and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') and + card.ref_community = :community_id and + acs_users_all.user_id in ( + select acs_users_all.user_id + from acs_users_all, dotlrn_member_rels_approved + where + dotlrn_member_rels_approved.community_id = :community_selected and + dotlrn_member_rels_approved.user_id = acs_users_all.user_id and + (role='student' or role='member') + ) + order by $order $order_dir + + + + + + Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/list_notes.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/list_notes.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/list_notes.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cards/www/manage_blocks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/manage_blocks.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/manage_blocks.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,232 @@ + + + + + +
+
@community_name@
+ +
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + +
#cards.card_Evaluation_blocks_list#
N�#cards.card_Data_type# + + #cards.tooltip_orderby_asc# + + #cards.tooltip_orderby_desc# + #cards.card_Block_name# + + #cards.tooltip_orderby_asc# + + #cards.tooltip_orderby_desc# + % + + #cards.tooltip_orderby_asc# + + #cards.tooltip_orderby_desc# + R[>=]#cards.card_Accept##cards.card_Cancel##cards.card_Edit##cards.card_Delete#
@block.rownum@
+ + + + + + + + + + + + + + +
@block.rownum@ + B�sicasSeleccionables + Ponderadas@block.percent_name@@block.percent@@block.rvalor@
+ + + + + + +
+ + + + + + +
* + + + +
+ + + +
+

#cards.card_Total_assigned#:@total@ / 100

+
+

#cards.card_Total_assigned#: @total@ / 100

+
+
 
+ +
    +
  • #cards.card_Allow_students_access#:  + + + #cards.yes# | #cards.no# + + #cards.yes# | #cards.no# + + + +
  • #cards.card_reuse_parent_cards#:  + + + #cards.yes# | #cards.no# + + #cards.yes# | #cards.no# + + + +
+ +

+ + + Index: openacs-4/packages/cards/www/manage_blocks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/manage_blocks.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/manage_blocks.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,200 @@ +ad_page_contract { +} -query { + {mode:optional ""} + {block_id:integer,optional ""} + {block_type:integer,optional ""} + {block_type_old:integer,optional ""} + {block_name:optional ""} + {block_percent:integer,optional 0} + {block_rvalor:float,optional 0} + {order:optional percent} + {order_dir:optional desc} + {alum_view:integer,optional 0} + {reuse_cards:integer,optional 0} +} -properties { +} + +# Declaraci� de variables a emprar +set error 0 +set msg_error "" +set link_url "" +set block_sel_edit "" +set is_edit 0 +set total 0 +set total_p 0 + + + +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] +set allow_view_grades [cards::get_community_parameter -community_id $community_selected -param "AllowGradeView"] + +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + + + + + +# Usuari que som y url a la que estem +set my_user_id [ad_conn user_id] +set referer [ns_conn url] + +# Si no som administradors [admin_p = 0] --> error: permis denegat +set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +if {!$admin_p} { + ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] +} + + + + + +########## MODE ALLOW STUDENTS VIEW ########## +if {$mode == "allow"} { + cards::update_cards_parameter -community_id $community_selected -param "AllowGradeView" -value $alum_view + set allow_view_grades [cards::get_community_parameter -community_id $community_selected -param "AllowGradeView"] +} + +########## MODE REUSE PARENTs CARDS ########## +if {$mode == "reuse"} { + cards::update_cards_parameter -community_id $community_selected -param "ReuseParentCards" -value $reuse_cards + ad_returnredirect "./cards_list" + +} + +########## MODE CANCELAR --> No fa res, redireccio a la pagina anterior ########## +if {$mode eq "cancel"} { + set mode "" + #ad_returnredirect "./manage_blocks?order=$order&order_dir=$order_dir" +} +#set msg_error "HEMOS INSERTADO" +#set link_url "./manage_blocks?mode=" + +########## MODO INSERTAR ########## +if {$mode eq "insert"} { + # Comprobaci�n nombre bloque ya existe + set found_block [db_0or1row found_block_i { *SQL* }] + if {($found_block eq 0) && ($block_name ne "") && ($block_name ne " ")} { + if {($block_percent >= 0) && ($block_percent <= 100)} { + if {($block_rvalor >= 0) && ($block_rvalor <= 10)} { + db_dml insert_blocks { *SQL* } + set mode "" + set block_name "" + set block_type 1 + set block_percent 0 + set block_rvalor 0 + #ad_returnredirect "./manage_blocks?order=$order&order_dir=$order_dir" + } else { + set error 1 + set msg_error "Valor restricci�n no v�lido" + append cambia "document.fi.block_rvalor.value='" $block_rvalor "'" + set senyala "document.fi.block_rvalor.style.backgroundColor=" + } + } else { + set error 1 + set msg_error "Porcentaje no v�lido" + append cambia "document.fi.block_percent.value='" $block_percent "'" + set senyala "document.fi.block_percent.style.backgroundColor=" + } + } else { + set error 1 + set msg_error "Nombre de bloque ya existe o es nulo" + append cambia "document.fi.block_name.value='" $block_name "'" + set senyala "document.fi.block_name.style.backgroundColor=" + } + +} + +########## MODO ACTUALIZAR ########## +if {$mode eq "update"} { + set found_block [db_0or1row found_block_u { *SQL* }] + if {($block_name ne "") && ($found_block eq 0) } { + if {($block_percent >= 0) && ($block_percent <= 100)} { + if {($block_rvalor >= 0) && ($block_rvalor <= 10)} { + if {($block_type_old < $block_type) && ($block_type_old ==3 || $block_type ==3)} { + set new_percent 0 + db_dml update_task_percent { *SQL* } + } else { + if {($block_type_old > $block_type) && ($block_type_old ==3 || $block_type ==3)} { + set new_percent -1 + db_dml update_task_percent { *SQL* } + } + } + db_dml update_block { *SQL* } + set mode "" + set block_name "" + set block_type 1 + set block_percent 0 + set block_rvalor 0 + #ad_returnredirect "./manage_blocks?order=$order&order_dir=$order_dir" + } else { + set mode edit + set error 1 + set msg_error "Valor de restricci�n no v�lido." + append cambia "document.fe.block_rvalor.value='" $block_rvalor "'" + set senyala "document.fe.block_rvalor.style.backgroundColor=" + } + } else { + set mode edit + set error 1 + set msg_error "Porcentaje no v�lido." + append cambia "document.fe.block_percent.value='" $block_percent "'" + set senyala "document.fe.block_percent.style.backgroundColor=" + } + } else { + set mode edit + set error 1 + set msg_error "Nombre de bloque ya existente o no v�lido." + append cambia "document.fe.block_name.value='" $block_name "'" + set senyala "document.fe.block_name.style.backgroundColor=" + } +} + +########## MODO BORRAR --> Borrado en cascada ########## +if {$mode eq "delete"} { + set l_del_notes [db_list select_notes { *SQL* }] + foreach del_i $l_del_notes { + # Borramos anotaciones de los alumnos de ese tipo base + db_dml delete_note { *SQL* } + } + # Borramos las anotaciones de la comunidad de ese tipo base + db_dml delete_block_tasks { *SQL* } + # Borramos el bloque b�sico + db_dml delete_block { *SQL* } + set mode "" +} + +########## MODO EDITAR --> Modificar bloques ya creados ########## +if {$mode eq "edit"} { + set block_sel_edit $block_id + set is_edit 1 + #db_1row t_sel { *SQL* } + #set sel_edit_type $type +} + + +# Obtenim la llista de blocs de la comunitat +db_multirow block select_blocks { *SQL* } +db_1row total_percent { *SQL* } +if {$total_p > 0} { + set total $total_p +} else { + set total 0 +} + + Index: openacs-4/packages/cards/www/manage_blocks.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/manage_blocks.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/manage_blocks.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,102 @@ + + + + postgresql7.1 + + + + insert into card_percent + (ref_community, type, percent_name, percent, rvalor) + values + (:community_id, :block_type, :block_name, :block_percent, :block_rvalor) + + + + + + select * from card_percent where ref_community = :community_id + order by $order $order_dir + + + + + + + select * from card_percent where percent_id = :block_id + + + + + + + update card_percent + set percent_name= :block_name, percent= :block_percent, + type= :block_type, rvalor= :block_rvalor + where percent_id= :block_id + + + + + + + select task_id from card_task + where ref_percent = :block_id + + + + + + + delete from card_note where ref_task= :del_i + + + + + + + delete from card_task where ref_percent= :block_id + + + + + + delete from card_percent where percent_id= :block_id + + + + + + + select percent_id from card_percent + where ref_community = :community_id and percent_name = :block_name + + + + + + select percent_id from card_percent + where ref_community = :community_id and + percent_name = :block_name + and percent_id <> :block_id + + + + + + + select sum (percent) as total_p from card_percent + where ref_community = :community_id + + + + + + + + update card_task + set task_percent= :new_percent + where ref_percent= :block_id + + + + Index: openacs-4/packages/cards/www/manage_tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/manage_tasks.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/manage_tasks.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,228 @@ + + + + + +
+
@community_name@
+ +
 
+ + +

 #cards.card_tasks_list#


+#cards.blocks_first# +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
#cards.card_tasks_list#
N�#cards.card_task_block# + + #cards.tooltip_orderby_asc# + + #cards.tooltip_orderby_desc# + #cards.card_task_name# + + #cards.tooltip_orderby_asc# + + #cards.tooltip_orderby_desc# + %#cards.card_task_max_grade##cards.card_Accept##cards.card_Cancel##cards.card_Edit##cards.card_Delete#
@task.rownum@
+ + + + + + + + + + + + + + + +
@task.rownum@@task.percent_name@ + + #cards.tooltip_list_to_print#  + + #cards.tooltip_csv#    + @task.task_name@ + auto + @task.task_percent@@task.max_grade@
+ + + + + + +
+ + + + + + +
* + + + + + + + + +
+ + + + +
+ +
+

+ + + Index: openacs-4/packages/cards/www/manage_tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/manage_tasks.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/manage_tasks.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,164 @@ +ad_page_contract { +} -query { + {mode:optional ""} + {task_id:integer,optional ""} + {task_block:integer,optional ""} + {task_name:optional ""} + {task_percent:float,optional 0} + {task_max_grade:float,optional 10.00} + {nav_sel:optional ""} + {order:optional task_name} + {order_dir:optional asc} +} -properties { +} + +# Declaraci� de variables a emprar +set error 0 +set msg_error "" +set link_url "" +set task_sel_edit "" +set is_edit 0 + +# Comunitat a la que estem. Check if we are in a subcommunity. In this case, we use the big parent community. +# but we only show the user cards that are in subgroup +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + +# Usuari que som y url a la que estem +set my_user_id [ad_conn user_id] +set referer [ns_conn url] + +# Si no som administradors [admin_p = 0] --> error: permis denegat +set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +if {!$admin_p} { + ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] +} + + +########## MODE CANCELAR --> No fa res, redireccio a la pagina anterior ########## +if {$mode eq "cancel"} { + set mode "" + #ad_returnredirect "./manage_tasks?order=$order&order_dir=$order_dir" +} + +########## MODO INSERTAR ########## +if {$mode eq "insert"} { + # Comprobaci�n nombre bloque ya existe + set found_task [db_0or1row found_task_i { *SQL* }] + if {($found_task eq 0) && ($task_name ne "") && ($task_name ne " ")} { + if {($task_percent >= 0) && ($task_percent <= 100)} { + if {($task_max_grade >= 0)} { + # Obtener task_type + set task_type [cards::get_task_type -task_block $task_block] + if {$task_type eq 3} { + # Comprobar porcentajes totales + set xcent 0 + } else { + set task_percent -1 + } + db_dml insert_task { *SQL* } + set l_task [cards::get_community_tasks -community_id $community_id] + set id_task [lindex $l_task [expr [llength $l_task] - 1]] + set l_cards [cards::get_all_community_cards -community_id $community_id] + foreach cid $l_cards { + cards::create_student_note -community_id $community_id -card_id $cid -task_id $id_task + } + set mode "" + set task_max_grade 10 + #ad_returnredirect "./manage_tasks?order=$order&order_dir=$order_dir" + } else { + set error 1 + set msg_error "Nota m�xima no v�lida." + append cambia "document.fi.task_max_grade.value='" $task_max_grade "'" + set senyala "document.fi.task_max_grade.style.backgroundColor=" + } + } else { + set error 1 + set msg_error "Porcentaje no v�lido" + append cambia "document.fi.task_percent.value='" $task_percent "'" + set senyala "document.fi.task_percent.style.backgroundColor=" + } + } else { + set error 1 + set msg_error "Nombre de bloque ya existe o es nulo" + append cambia "document.fi.task_name.value='" $task_name "'" + set senyala "document.fi.task_name.style.backgroundColor=" + } + +} + +########## MODO ACTUALIZAR ########## +if {$mode eq "update"} { + # Comprobaci�n nombre bloque ya existe + set found_task [db_0or1row found_task_u { *SQL* }] + if {($found_task eq 0) && ($task_name ne "") && ($task_name ne " ")} { + if {($task_percent >= 0) && ($task_percent <= 100)} { + if {($task_max_grade >= 0)} { + db_dml update_task { *SQL* } + set mode "" + set task_max_grade 10 + #ad_returnredirect "./manage_tasks?order=$order&order_dir=$order_dir" + } else { + set error 1 + set msg_error "Nota m�xima no v�lida." + append cambia "document.fe.task_max_grade.value='" $task_max_grade "'" + set senyala "document.fe.task_max_grade.style.backgroundColor=" + } + } else { + set error 1 + set msg_error "Porcentaje no v�lido" + append cambia "document.fe.task_percent.value='" $task_percent "'" + set senyala "document.fe.task_percent.style.backgroundColor=" + } + } else { + set error 1 + set msg_error "Nombre de bloque ya existe o es nulo" + append cambia "document.fe.task_name.value='" $task_name "'" + set senyala "document.fe.task_name.style.backgroundColor=" + } +} + +########## MODO BORRAR --> Borrado en cascada ########## +if {$mode eq "delete"} { + # Borramos las anotaciones de los alumnos para esa tarea + db_dml delete_notes { *SQL* } + # Borramos la tarea + db_dml delete_task { *SQL* } + set mode "" +} + +########## MODO EDITAR --> Modificar bloques ya creados ########## +if {$mode eq "edit"} { + set task_sel_edit $task_id + set is_edit 1 +} else { + db_multirow block2 select_blocks { *SQL* } + multirow foreach block2 { + set task_name_sel "" + set task_percent_sel $percent_id + set task_type_sel $type + break + } +} + + +# Obtenim la llista de blocs de la comunitat +db_multirow task select_tasks { *SQL* } +db_multirow block select_blocks { *SQL* } + Index: openacs-4/packages/cards/www/manage_tasks.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/manage_tasks.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/manage_tasks.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,95 @@ + + + + postgresql7.1 + + + + + select task_id from card_task + where ref_community = :community_id and + task_name = :task_name and + ref_percent = :task_block + + + + + + + select task_id from card_task + where ref_community = :community_id and + task_name = :task_name and + ref_percent = :task_block + and task_id <> :task_id + + + + + + + select t.*,p.percent_id, p.type, p.percent_name + from card_task t + inner join card_percent p on (percent_id = ref_percent) + where t.ref_community = :community_id + order by $order $order_dir + + + + + + select * + from card_percent p + where p.ref_community = :community_id + order by type asc + + + + + + select * from card_task + where ref_community = :community_id and + ref_percent = :nav_sel + order by $order $order_dir + + + + + + + insert into card_task + (ref_community, ref_percent, task_name, task_percent, max_grade) + values + (:community_id, :task_block, :task_name, :task_percent, :task_max_grade) + + + + + + update card_task set + ref_percent = :task_block, task_name = :task_name, + task_percent= :task_percent, max_grade= :task_max_grade + where ref_community = :community_id and + task_id = :task_id + + + + + + delete from card_task where task_id = :task_id + + + + + + delete from card_note where ref_task= :task_id + + + + + + select type as sel_type from card_percent where percent_id = :act_ref_percent + + + + + Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/notes.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/notes.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/notes.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/orla.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/orla.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/cards/www/orla.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cards/www/personal_info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/personal_info.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/personal_info.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
 #cards.card_Personal_info#
#dotlrn.student_role_pretty_name#: @last_name@, @first_names@@photo_student;noquote@
#cards.Email#: @user_info.email@
#cards.Home_page#: @user_info.url@ 
#cards.address#: @address@ 
#cards.phones#: @phone1@ 
+ +
+ + + + + + + + + + + + + + + +
+
+ + + + + + + +
 #cards.comunication#
#cards.student_comment#:
@comm_student@ 
#cards.teacher_comment#:
+ #cards.teacher_comment# #cards.card_Edit# +
@comm_teacher@
+ + +
+ +
+ #cards.max_char1# 1000 #cards.max_char2# + + + + + + + +    + +
+ +
Index: openacs-4/packages/cards/www/personal_info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/personal_info.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/personal_info.tcl 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,53 @@ +ad_page_contract { +} -query { + user_id:integer,notnull + {mode:optional ""} + {mail_subject:optional ""} + {mail_body:optional ""} +} -properties { +} + +# Declaraci� de variables +set widthheight_param "width=72 height=90" +set export_vars [export_url_vars user_id] +acs_user::get -user_id $user_id -array user_info +set existe_photo 1 +set subsite_url [subsite::get_element -element url] + +# Comunitat a la que estem. Check if we are in a subcommunity. In this case, we use the big parent community. +# but we only show the user cards that are in subgroup +# Community and big parent community +set community_selected [dotlrn_community::get_community_id] +set community_name [cards::get_community_pretty_name -community_id $community_selected] +set parent_community_id [cards::get_big_parent_community -community_id $community_selected] +set reuse_parent_cards [cards::get_community_parameter -community_id $community_selected -param "ReuseParentCards"] +if {$community_selected == $parent_community_id} { + set subgroup 0 + set community_id $community_selected +} else { + set subgroup 1 + set community_id $community_selected + # If we reuse the cards we have to do the next actions, otherwise notihing to do + if {$reuse_parent_cards eq 1} { + set community_id $parent_community_id + set community_name [cards::get_community_pretty_name -community_id $community_id] + append community_name " :: " [cards::get_community_pretty_name -community_id $community_selected] + } +} + +# Usuari que som y url a la que estem +set card_id [cards::get_card_id -community_id $community_id -user_id $user_id] +set my_user_id [ad_conn user_id] +set referer [ns_conn url] +set photo_student [cards::get_student_photo -user_id $user_id -param $widthheight_param -return_url $referer -admin "1"] + + +# Si no som administradors [admin_p = 0] --> error: permis denegat +set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id] +if {!$admin_p} { + ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] +} + + +db_0or1row select_found_card { *SQL* } +db_1row student_name { *SQL* } Index: openacs-4/packages/cards/www/personal_info.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/personal_info.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/personal_info.xql 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,20 @@ + + + postgresql7.1 + + + + select last_name, first_names + from acs_users_all + where user_id = :user_id + + + + + + select * from card + where ref_user= :user_id and ref_community= :community_id + + + + Index: openacs-4/packages/cards/www/student_card.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/student_card.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cards/www/student_card.adp 22 Jun 2006 13:00:54 -0000 1.1 @@ -0,0 +1,62 @@ + +@community_name@ + + + + +
+
#cards.card_Student#: @user_name@  
+
#cards.card_Subjet#: @community_name@  
+ +
 
+ + + + +