Index: openacs-4/packages/cards/cards.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/cards.info,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/cards.info	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!-- Generated by the OpenACS Package Manager -->
+
+<package key="cards" url="http://openacs.org/repository/apm/packages/cards" type="apm_application">
+    <package-name>Cards</package-name>
+    <pretty-plural>Cards</pretty-plural>
+    <initial-install-p>f</initial-install-p>
+    <singleton-p>f</singleton-p>
+    <auto-mount>cards</auto-mount>
+
+    <version name="0.1d" url="http://openacs.org/repository/download/apm/cards-0.1d.apm">
+        <owner url="mailto:fransola@uv.es">Francisco Soler</owner>
+
+        <!-- No dependency information -->
+
+        <callbacks>
+        </callbacks>
+        <parameters>
+        <!-- No version parameters -->
+        </parameters>
+
+    </version>
+</package>
+
Index: openacs-4/packages/cards/catalog/cards.ca_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/catalog/cards.ca_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/catalog/cards.ca_ES.ISO-8859-1.xml	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="cards" package_version="0.1d" locale="ca_ES" charset="ISO-8859-1">
+
+  <msg key="pretty_name">Fitxes</msg>
+  <msg key="card_Accept">Accepta </msg>
+  <msg key="card_Student">Alumne </msg>
+  <msg key="card_Students">Alumnes </msg>
+  <msg key="card_Note">Anotaci� </msg>
+  <msg key="card_Notes">Anotacions </msg>
+  <msg key="card_Passed">Aprovat </msg>
+  <msg key="card_Block">Bloc </msg>
+  <msg key="card_Delete">Elimina </msg>
+  <msg key="card_Cancel">Cancel�la </msg>
+  <msg key="card_Comment">Comentari </msg>
+  <msg key="card_Student_comments">Comentaris de l'estudiant al professor </msg>
+  <msg key="card_Lecturer_comments">Comentaris del professor a l'estudiant </msg>
+  <msg key="card_Setup_evaluation">Configura avaluaci� </msg>
+  <msg key="card_E-mail">Correu electr�nic </msg>
+  <msg key="card_Personal_info">Dades personals </msg>
+  <msg key="card_Address">Adre�a </msg>
+  <msg key="card_Edit">Edita </msg>
+  <msg key="card_Date">Data </msg>
+  <msg key="card_Student_records">Fitxes d'estudiants </msg>
+  <msg key="card_Manage_notes">Gestiona anotacions </msg>
+  <msg key="card_Note_list">Llista d'anotacions </msg>
+  <msg key="card_Evaluation_blocks_list">Llista blocs d'avaluaci� </msg>
+  <msg key="card_Grades_list">Llista de notes </msg>
+  <msg key="card_Not_done">No presentats </msg>
+  <msg key="card_Note_name">Nom anotaci� </msg>
+  <msg key="card_Block_name">Nom de bloc </msg>
+  <msg key="card_Grade">Nota </msg>
+  <msg key="card_Final_grade">Nota final </msg>
+  <msg key="card_Average_grade">Nota mitjana </msg>
+  <msg key="card_Grades">Notes </msg>
+  <msg key="card_Setup_options">Opcions de configuraci� </msg>
+  <msg key="card_Web_Page">P�gina web </msg>
+  <msg key="card_Allow_students_access">Permet acc�s als alumnes </msg>
+  <msg key="card_Without_academic_validity">Sense validesa acad�mica </msg>
+  <msg key="card_Not_passed">Suspensos </msg>
+  <msg key="card_Phone">Tel�fon </msg>
+  <msg key="card_Data_type">Tipus de dades </msg>
+  <msg key="card_Total_assigned">Total assignat </msg>
+  <msg key="card_Back">Torna </msg>
+  <msg key="card_Orla">Orla </msg>
+  <msg key="card_Invalid_value1">Valor incorrecte a </msg>
+  <msg key="card_Invalid_value2">. Sols valors sensers entre 0 i </msg>
+  <msg key="card_Invalid_data">Dades no v�lides. Revisa els camps marcats. </msg>
+  <msg key="card_Subjet">ASSIGNATURA</msg>
+  <msg key="card_Text">Text</msg>  
+  <msg key="card_Basic">B�sica</msg>
+  <msg key="card_Select">Selecionable</msg>
+  <msg key="card_Add_note_asig">Afegir anotaci�</msg> 
+  <msg key="card_Active">Activa</msg>
+  <msg key="card_No_notes">Anotacions no disponinles</msg>
+  <msg key="card_del_bloc1">L\'eliminaci� del bloc </msg>
+  <msg key="card_del_bloc2">implica el esborrat de totes les seues anotaciones i la p�rdua de les notes dels alumnes. �Est� segur?</msg>
+  <msg key="card_del_note1">L\'eliminaci� de l\'anotaci� </msg>
+  <msg key="card_del_note2">implica la p�rdua d\'eixa nota dels alumnes. �Est� segur?</msg>  
+  
+  
+</message_catalog>
+
+
Index: openacs-4/packages/cards/catalog/cards.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/catalog/cards.en_US.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/catalog/cards.en_US.ISO-8859-1.xml	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="cards" package_version="0.1d" locale="en_US" charset="ISO-8859-1">
+
+  <msg key="pretty_name">Cards</msg>
+  <msg key="card_Accept">Accept </msg>
+  <msg key="card_Student">Student </msg>
+  <msg key="card_Students">Students </msg>
+  <msg key="card_Note">Note  </msg>
+  <msg key="card_Notes">Notes </msg>
+  <msg key="card_Passed">Passed </msg>
+  <msg key="card_Block">Block </msg>
+  <msg key="card_Delete">Delete </msg>
+  <msg key="card_Cancel">Cancel </msg>
+  <msg key="card_Comment">Comment </msg>
+  <msg key="card_Student_comments">Student's comments to lecturer </msg>
+  <msg key="card_Lecturer_comments">Lecturer's comments to student </msg>
+  <msg key="card_Setup_evaluation">Setup evaluation </msg>
+  <msg key="card_E-mail">E-mail </msg>
+  <msg key="card_Personal_info">Personal info </msg>
+  <msg key="card_Address">Address </msg>
+  <msg key="card_Edit">Edit </msg>
+  <msg key="card_Date">Date </msg>
+  <msg key="card_Student_records">Student's records </msg>
+  <msg key="card_Manage_notes">Manage notes </msg>
+  <msg key="card_Note_list">Note list </msg>
+  <msg key="card_Evaluation_blocks_list">Evaluation blocks list </msg>
+  <msg key="card_Grades_list">Grades list </msg>
+  <msg key="card_Not_done">Not done </msg>
+  <msg key="card_Note_name">Note name  </msg>
+  <msg key="card_Block_name">Block name  </msg>
+  <msg key="card_Grade">Grade </msg>
+  <msg key="card_Final_grade">Final grade </msg>
+  <msg key="card_Average_grade">Average grade </msg>
+  <msg key="card_Grades">Grades </msg>
+  <msg key="card_Setup_options">Setup options </msg>
+  <msg key="card_Web_Page">Web Page </msg>
+  <msg key="card_Allow_students_access">Allow students' access </msg>
+  <msg key="card_Without_academic_validity">Without academic validity </msg>
+  <msg key="card_Not_passed">Not passed </msg>
+  <msg key="card_Phone">Phone </msg>
+  <msg key="card_Data_type">Data type </msg>
+  <msg key="card_Total_assigned">Total assigned </msg>
+  <msg key="card_Back">Back </msg>
+  <msg key="card_Orla">Orla </msg>
+  <msg key="card_Invalid_value1">Incorrect value on </msg>
+  <msg key="card_Invalid_value2">. Values between 0 and </msg>
+  <msg key="card_Invalid_data">Invalid Data. Review marked fields</msg>
+  <msg key="card_Subjet">SUBJECT</msg>
+  <msg key="card_Text">Text</msg>  
+  <msg key="card_Basic">Basic</msg>
+  <msg key="card_Select">selectionable</msg>  
+  <msg key="card_Add_note_asig">Add note</msg> 
+  <msg key="card_Active">Active</msg>
+  <msg key="card_Action">Action</msg>
+  <msg key="card_No_notes">Notes not availble</msg>
+  <msg key="card_del_bloc1">Deleting the bloc </msg>
+  <msg key="card_del_bloc2">involves to delete all its notes and the loss of its students\' grades. Are you sure?</msg>
+  <msg key="card_del_note1">Deleting the note </msg>
+  <msg key="card_del_note2">involves the loss of these student\' grades. �Are you sure?</msg>  
+</message_catalog>
Index: openacs-4/packages/cards/catalog/cards.es_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/catalog/cards.es_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/catalog/cards.es_ES.ISO-8859-1.xml	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="cards" package_version="0.1d" locale="es_ES" charset="ISO-8859-1">
+
+  <msg key="pretty_name">Fichas</msg>
+  <msg key="card_Accept">Aceptar </msg>
+  <msg key="card_Student">Alumno </msg>
+  <msg key="card_Students">Alumnos </msg>
+  <msg key="card_Note">Anotaci�n </msg>
+  <msg key="card_Notes">Anotaciones </msg>
+  <msg key="card_Passed">Aprobados </msg>
+  <msg key="card_Block">Bloque </msg>
+  <msg key="card_Delete">Borrar </msg>
+  <msg key="card_Cancel">Cancelar </msg>
+  <msg key="card_Comment">Comentario </msg>
+  <msg key="card_Student_comments">Comentarios del estudiante al profesor </msg>
+  <msg key="card_Lecturer_comments">Comentarios del profesor al estudiante </msg>
+  <msg key="card_Setup_evaluation">Configurar Evaluaci�n </msg>
+  <msg key="card_E-mail">Correo electr�nico </msg>
+  <msg key="card_Personal_info">Datos Personales </msg>
+  <msg key="card_Address">Direcci�n </msg>
+  <msg key="card_Edit">Editar </msg>
+  <msg key="card_Date">Fecha </msg>
+  <msg key="card_Student_records">Fichas de estudiantes </msg>
+  <msg key="card_Manage_notes">Gestionar Anotaciones </msg>
+  <msg key="card_Note_list">Listado anotaciones </msg>
+  <msg key="card_Evaluation_blocks_list">Listado de Bloques </msg>
+  <msg key="card_Grades_list">Listado Notas </msg>
+  <msg key="card_Not_done">No presentados </msg>
+  <msg key="card_Note_name">Nombre </msg>
+  <msg key="card_Block_name">Nombre Bloques </msg>
+  <msg key="card_Grade">Nota </msg>
+  <msg key="card_Final_grade">Nota Final </msg>
+  <msg key="card_Average_grade">Nota Media </msg>
+  <msg key="card_Grades">Notas </msg>
+  <msg key="card_Setup_options">Opciones de configuraci�n </msg>
+  <msg key="card_Web_Page">P�gina web </msg>
+  <msg key="card_Allow_students_access">Permitir acceso alumnos </msg>
+  <msg key="card_Without_academic_validity">Sin validez acad�mica </msg>
+  <msg key="card_Not_passed">Suspensos </msg>
+  <msg key="card_Phone">Tel�fono </msg>
+  <msg key="card_Data_type">Tipo de datos </msg>
+  <msg key="card_Total_assigned">Total asignado </msg>
+  <msg key="card_Back">Volver </msg>
+  <msg key="card_Orla">Orla </msg>
+  <msg key="card_Invalid_value1">Valor incorrecto en </msg>
+  <msg key="card_Invalid_value2">. Solo valores enteros entre 0 y </msg>
+  <msg key="card_Invalid_data">Datos no v�lidos. Revisa los campos marcados. </msg>
+  <msg key="card_Subjet">ASIGNATURA</msg>
+  <msg key="card_Text">Texto</msg>  
+  <msg key="card_Basic">B�sica</msg>
+  <msg key="card_Select">Selecionable</msg>  
+  <msg key="card_Add_note_asig">A�adir anotaci�n</msg>
+  <msg key="card_Active">Activa</msg>
+  <msg key="card_Action">Acci�n</msg>
+  <msg key="card_No_notes">Anotaciones no disponibles</msg>
+  <msg key="card_del_bloc1">El borrado del bloque </msg>
+  <msg key="card_del_bloc2">implica el borrado de todas sus anotaciones y la p�rdida de esas notas de los alumnos. �Est� seguro?</msg>
+  <msg key="card_del_note1">El borrado de la anotaci�n </msg>
+  <msg key="card_del_note2">implica la perdida de esa nota de los alumnos. �Est� seguro?</msg>  
+  
+   
+</message_catalog>
Index: openacs-4/packages/cards/sql/postgresql/cards-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/sql/postgresql/cards-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/sql/postgresql/cards-create.sql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,82 @@
+-- TABLE UV_CARD -------------------------------------------------------------
+create sequence uv_card_sequence start 1;
+create table uv_card (
+    id_card           integer primary key default nextval ('uv_card_sequence'),
+    ref_community_id  integer not null,
+    ref_user_id       integer not null,
+    comm_student      varchar (1000),
+    comm_teacher      varchar (1000),
+    address           varchar (300),
+    phone1            varchar (30),
+    phone2            varchar (30)
+);
+create unique index uv_card_idx on uv_card (ref_community_id, ref_user_id);
+
+
+-- TABLE UV_CARD_BASE_NOTE -------------------------------------------------------------
+create table uv_card_base_note (
+        community_id    integer primary key,
+        base_note       integer not null default 100,
+        alum_view   integer default 0
+); 
+
+-- TABLE UV_CARD_BASETYPE_NOTE -------------------------------------------------------------
+create table uv_card_basetype_note (
+        id_basetype     integer primary key,          
+        name_basetype   varchar (30),
+        info_basetype   varchar (300),
+        is_numeric      boolean default true
+);
+
+-- TABLE UV_CARD_XCENT_NOTE -------------------------------------------------------------
+create sequence uv_card_xcent_note_sequence start 1;
+create table uv_card_xcent_note (
+        id_xcent                integer primary key default nextval('uv_card_xcent_note_sequence'),  
+        ref_community_id        integer not null,
+        ref_basetype    integer not null,
+        name_xcent              varchar (50),
+        xcent               double precision default 0,
+        allow_act               boolean default false,
+        rvalor          double precision default 0.0,
+        np              boolean default false,
+        constraint              ref_basetype_fk foreign key (ref_basetype) references uv_card_basetype_note (id_basetype)
+);
+create index uv_card_xcent_comm_idx on uv_card_xcent_note (ref_community_id);
+
+-- TABLE UV_CARD_SUBTYPE_NOTE -------------------------------------------------------------
+create sequence uv_card_subtype_note_sequence start 1;  
+create table uv_card_subtype_note (
+        id_subtype              integer primary key default nextval('uv_card_subtype_note_sequence'),
+        ref_community_id        integer not null,
+        ref_xcent               integer not null,
+        sub_xcent       double precision default 0.00,
+        name_subtype    varchar (50),
+        constraint              ref_xcent_fk foreign key (ref_xcent) references uv_card_xcent_note (id_xcent)
+);
+create index uv_card_subtype_comm_idx on uv_card_subtype_note (ref_community_id);
+create index uv_card_subtype_xcent_idx on uv_card_subtype_note (ref_xcent);    
+
+-- TABLE UV_CARD_NOTES -------------------------------------------------------------
+create sequence uv_card_notes_sequence start 1;
+create table uv_card_notes (
+        id_card_notes   integer primary key default nextval('uv_card_notes_sequence'),
+        ref_id_card     integer not null,
+        note_datetime   timestamptz default current_timestamp not null,
+        ref_subtype     integer not null,
+        value_n         numeric(4,2) default 0.00,
+        value_s         varchar (300),
+        is_public       boolean default false,
+        is_active       boolean default true,
+        r_community_id  integer not null,
+        constraint      ref_subtype_fk foreign key (ref_subtype) references uv_card_subtype_note(id_subtype),
+        constraint      ref_id_cards_fk foreign key (ref_id_card) references uv_card(id_card)
+);
+create index uv_card_notes_comm_idx on uv_card_notes (r_community_id);
+create index uv_card_notes_subtype_idx on uv_card_notes (ref_subtype);
+
+
+-- INICIALIZACI�N DE DATOS -------------------------------------------------------------
+insert into uv_card_basetype_note (id_basetype, name_basetype, info_basetype, is_numeric) values (1,'B�sico', 'Anotaciones sencillas: pr�cticas, tareas, trabajos, actividades, ...','t');
+insert into uv_card_basetype_note (id_basetype, name_basetype, info_basetype, is_numeric) values (2,'Seleccionable', 'Anotaciones que permiten selecci�n: ex�menes','t');
+insert into uv_card_basetype_note (id_basetype, name_basetype, info_basetype, is_numeric) values (3,'Texto', 'Anotaciones sin asignaci�n de nota: comentarios','f');
+
Index: openacs-4/packages/cards/sql/postgresql/cards-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/sql/postgresql/cards-drop.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/sql/postgresql/cards-drop.sql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,23 @@
+
+drop sequence uv_card_notes_sequence;
+drop index uv_card_notes_comm_idx;
+drop index uv_card_notes_subtype_idx;
+drop table uv_card_notes;
+
+drop sequence uv_card_subtype_note_sequence;
+drop index uv_card_subtype_comm_idx;
+drop index uv_card_subtype_xcent_idx;
+drop table uv_card_subtype_note;
+
+drop sequence uv_card_xcent_note_sequence;
+drop index uv_card_xcent_comm_idx;
+drop table uv_card_xcent_note;
+
+drop table uv_card_basetype_note;
+
+drop table uv_card_base_note;
+
+drop sequence uv_card_sequence;
+drop index uv_card_idx;
+drop table uv_card;
+
Index: openacs-4/packages/cards/www/card.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/card.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/card.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,234 @@
+<!-- <master>  --><!-- #dotlrn.gestion_evaluacion_name# -->
+<link rel="stylesheet" href="cards.css" type="text/css">
+
+<!-- TABLA CONTENEDORA -->
+<table width="100%" border="0">
+<!-- Si alum_view = TRUE ==> Mostramos menu opciones -->
+<TR>
+<TD style="font-weight:bold">
+<div class="volver">&nbsp;&nbsp;#cards.card_Subjet#: 
+&nbsp;&nbsp;<%= [dotlrn_community::get_community_description -community_id $community_id] %>&nbsp;&nbsp;</div></TD>
+<TD ALIGN="RIGHT">
+<div class="volver">
+<A HREF="cards" class="t" style="color:#ffffff;font-weight:bold">&nbsp;&nbsp;#cards.card_Back#&nbsp;&nbsp;</A></div></TD>
+</TR>
+<TR><TD colspan="2">&nbsp;</TD>
+</TR>
+
+<TR><TD>
+        <if @alum_view@> 
+        <!--  ****************  NAVBAR - Selecci�n datos a mostrar  *************** -->
+        <TABLE border="0">
+        <TR>
+        <if @nav_sel@ eq "ficha"><TD class="list-button-bar">
+        <a name="dp" class="button1">#cards.card_Personal_info#</a></TD>
+        </if><else><TD class="list-button-bar">
+        <a href="card?card_id=@id_card@&user_id=@user_id@&nav_sel=ficha"
+        class="button">#cards.card_Personal_info#</a></TD></else>
+        <if @nav_sel@ eq ""><TD class="list-button-bar">
+        <A name="notas" class="button1">#cards.card_Grades#</a></TD>
+        </if><else><TD class="list-button-bar">
+        <a href="card?card_id=@id_card@&user_id=@user_id@" class="button">
+        #cards.card_Grades#</a></TD></else>
+        <multiple name="blocs_eval">
+        <if @blocs_eval.xcent@ gt 0>
+                <if @nav_sel@ eq @blocs_eval.id_xcent@>
+                <TD class="list-button-bar"><A name="blck" class="button1">
+                @blocs_eval.name_xcent@</a></TD>
+                </if><else>
+                <TD  class="list-button-bar">
+                <a href="card?card_id=@id_card@&user_id=@user_id@&nav_sel=@blocs_eval.id_xcent@"
+                 class="button">@blocs_eval.name_xcent@</a></TD>
+                </else>
+        </if>           
+        </multiple>
+        </TR>
+        </TABLE>
+        </if><else>
+        <H3>#cards.card_Personal_info#</H3>
+        </else>
+<!-- FIN NAVBAR -->
+</TD>
+<TD>&nbsp;
+        <if @alum_view@> 
+        <TABLE border="0">
+        <TR>
+        <TD     align="right" style="border: 3px solid orange"><B>&nbsp;&nbsp;#cards.card_Average_grade#:&nbsp; 
+        <if @nota_media@ eq NP>
+                <span style="color:#000000">NP&nbsp;&nbsp;</span>
+        </if>
+        <else>
+                <if @nota_media@ ge 5>
+                        <span style="color:green">      <%= [string range [format "%s" @nota_media@] 0 3] %>&nbsp;&nbsp;
+                </if>
+                <else>
+                        <span style="color:red">
+                                <if @nota_media@ eq -1>
+                                        4*&nbsp;&nbsp;
+                                </if>
+                                <else>
+                                        <%= [string range [format "%s" @nota_media@] 0 3] %>&nbsp;&nbsp;
+                                </else>
+                        </span>
+                </else>
+        </else>
+                
+        </TD></TR>
+        </TABLE></if>
+</TD>
+</TR>
+
+
+<table width="100%" cellpadding="5" cellspacing="0" border="0">
+<TR><TD colspan="2">
+<table width="100%" class="list" cellpadding="5" cellspacing="0" BORDER="0">
+<!--  ****************  MOSTRAR - DATOS PERSONALES  *************** -->
+<if @nav_sel@ eq "ficha">
+
+  <TR class="list-even">
+    <TD width="10%" rowspan="2" class="list_c">
+      <if @existe_photo@ eq 1>
+        <CENTER><IMG @widthheight_param@ SRC="@subsite_url@shared/portrait-bits.tcl?@export_vars@" alt="@user_info.name@"></CENTER>
+      </if>
+      <else>
+        <CENTER><IMG @widthheight_param@ SRC="icons/nophoto.gif" alt="@user_info.name@"></CENTER>
+      </else>
+    </TD>
+    <TD colspan="2" class="list">
+      <B>@user_info.name@</B><BR>
+      <FONT COLOR=#0000FF>#dotlrn.Email#</FONT> @user_info.email@   <FONT COLOR=#0000FF>#acs-subsite.Home_page#:</FONT> @user_info.url@ <BR>
+      </TD>
+        <TR class="list-even">
+        <if @is_edit@ eq 1> <!--SI ESTAMOS EN EDICION -->
+        <FORM METHOD="post" name="fe">
+        <TD class="list_c">     
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="card_id" value="@card_id@">
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                <FONT COLOR=#0000FF>#dotlrn.address#: &nbsp;</FONT>
+                        <INPUT type="text" size=60 name="address" value="@address@"><BR>
+                <FONT COLOR=#0000FF>#dotlrn.phone1#:</FONT>
+                        <INPUT type="text" size=60 name="phone1" value="@phone1@"><BR>
+                <FONT COLOR=#0000FF>#dotlrn.phone2#:</FONT>
+                <INPUT type="text" size=60 name="phone2" value="@phone2@"><BR>  
+        </TD>
+        <TD width="4%" class="list" align="center">
+                <INPUT type="hidden" name="mode_update" value="">               
+                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ok.gif" ALT="#cards.card_Accept#" title="#cards.card_Accept#" onclick="document.fe.mode_update.value='mode_update1'">
+                <INPUT type="hidden" name="mode_cancel" value="">               
+                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ko.gif" ALT="#cards.card_Cancel#" title="#cards.card_Cancel#" onclick="document.fe.mode_cancel.value='mode_cancel'"></TD>
+        </FORM> 
+        </if>
+        <else>
+        <FORM METHOD="post" name="fm1">
+        <TD class="list_c">
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="card_id" value="@id_card@">
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                <FONT COLOR=#0000FF>#dotlrn.address#:</FONT></U> @address@<BR>
+                <FONT COLOR=#0000FF>#dotlrn.phone1#:</FONT> @phone1@<BR>
+                <FONT COLOR=#0000FF>#dotlrn.phone2#:</FONT> @phone2@<BR></TD>
+        <TD width="4%" class="list_c" align="center">
+                <INPUT type="hidden" name="mode" value="edit1">
+                <INPUT type="image" name="submit" value="submit" border="0" alt="#cards.card_Edit# #cards.card_Personal_info#" title="#cards.card_Edit# #cards.card_Personal_info#" src="icons/edit.gif" style="margin:0;padding:0"></TD>
+        </FORM>
+        </else> 
+  </TR>
+  <TR class="list-even">
+    <if @is_edit@ eq 2> <!--SI ESTAMOS EN EDICION 2 -->
+        <FORM METHOD="post" name="fe2">
+    <TD colspan="2" class="list_c" >
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="card_id" value="@card_id@">
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                <B>#dotlrn.observations_from_student_to_teacher#:</B><BR>
+                <TEXTAREA INPUT type="text" rows="5" cols="80"  name="comm_student" value="@comm_student@"></TEXTAREA>
+    </TD>
+        <TD width="10%" class="list_c"  align="center"> 
+                <INPUT type="hidden" name="mode_update" value="">               
+                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ok.gif" ALT="#cards.card_Accept#" title="#cards.card.Accept#" onclick="document.fe2.mode_update.value='mode_update2'">
+                <INPUT type="hidden" name="mode_cancel" value="">               
+                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ko.gif" ALT="#cards.card_Cancel#" title="#cards.card.Cancel#"  onclick="document.fe2.mode_cancel.value='mode_cancel'">
+        </TD>
+        </FORM> 
+        </if>
+        <else> <!--SI  NNO ESTAMOS-->
+        <FORM METHOD="post" name="fm1">
+        <TD colspan="2" class="list_c">
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="card_id" value="@id_card@">
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                <B>#dotlrn.observations_from_student_to_teacher#:</B><BR>
+      @comm_student@
+        </TD>
+        <TD width="10%" class="list_c" align="center">
+                <INPUT type="hidden" name="mode" value="edit2">
+                <INPUT type="image" name="submit" value="submit" border="0" ALT="#cards.card_Edit# #cards.card_Comment#" title="#cards.card_Edit# #cards.card_Comment#" src="icons/edit.gif" style="margin:0;padding:0"></TD>
+        </FORM> 
+        </else>
+        </TD>
+  </TR>  
+  <TR class="list-even">
+    <TD colspan="3" class="list">
+
+      <B>#dotlrn.observations_from_teacher_to_student#:</B><BR>
+      @comm_teacher@
+    </TD>
+  </TR>
+</TABLE>
+<BR>
+
+</if>
+<else>
+<!--  ****************  MOSTRAR - NOTAS ALUMNO *************** -->
+<multiple name="blocs_eval">
+<if @blocs_eval.xcent@ gt 0>
+        <if @nav_sel@ eq @blocs_eval.id_xcent@ or @nav_sel@ eq "">
+        <tr class="list-header">
+                <th colspan="3" class="list_h"><B>@blocs_eval.name_xcent@</B> (@blocs_eval.xcent@%)</th>
+                <th colspan="2" align="right" class="list_h">   
+                        <multiple name="blocs_eval1">
+                        <if @blocs_eval1.ref_xcent@ eq @blocs_eval.id_xcent@>
+                                <B>Media: <%= [string range [format "%s" @blocs_eval1.mitja@] 0 3] %></B>
+                        </if>
+                        </multiple></th>
+        </tr>
+        
+        <tr class="list-odd_c" height="6" style="font-size:9px">
+        <td width="1%" class="list_c">  &nbsp;</td>
+        <td width="27%" class="list_c">#cards.card_Note#</td>
+        <td width="56%" class="list_c">#cards.card_Comment#</td>
+        <td width="6%" class="list_c">#cards.card_Grade#</td>
+        <td width="6%" class="list_c">#cards.card_Active#</td>                  
+        </tr>
+        
+        <multiple name="notes">
+        <if @notes.ref_xcent@ eq @blocs_eval.id_xcent@>
+                <tr class="list-even" onmouseover="javascript:style.backgroundColor='#99ccff'"
+                onmouseout="javascript:style.backgroundColor='#FFFFFF'">        
+                        <td width="1%" class="list_c">&nbsp;</td>
+                        <td width="27%" class="list_c">@notes.name_subtype@</td>
+                        <td width="56%" class="list_c">&nbsp;@notes.value_s@</td>
+                        <td width="6%" class="list_c">@notes.value_n@</td>
+                        <td width="6%" class="list_c">
+                        <if @notes.is_active@>
+                                <INPUT type="checkbox" size="1" name="noteact" checked disabled>
+                        </if><else>
+                                <INPUT type="checkbox" size="1" name="noteact" disabled>
+                        </else>                         
+                        </td>                   
+                </tr>
+        </if>
+        </multiple>
+        </if>   
+</if>
+</multiple>
+</else>
+<TR>
+<TD colspan="5" align="right">#cards.card_Without_academic_validity#</TD>
+</TR>
+</TABLE>
+</td></TR>
+</TABLE><BR><BR>
+<if @error@><SCRIPT>alert("@msg_error@")</SCRIPT>
+</if>
Index: openacs-4/packages/cards/www/card.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/card.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/card.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,139 @@
+ad_page_contract {
+} -query {
+  user_id:integer
+  {card_id:integer,optional ""}
+  {mode:optional ""}  
+  {mode_update:optional ""}
+  {mode_cancel:optional ""}
+  {nav_sel:optional ""}  
+  {address:optional ""}
+  {phone1:optional ""}  
+  {phone2:optional ""}
+  {comm_student:optional ""}
+} -properties {
+}
+
+# prevent this page from being called when not in a community
+if {[empty_string_p [dotlrn_community::get_community_id]]} {
+    ad_returnredirect "[dotlrn::get_url]"
+}
+
+set community_id [dotlrn_community::get_community_id]
+set admin_p [dotlrn::user_can_admin_community_p -user_id [ad_get_user_id] -community_id $community_id]
+set return_url "[ns_conn url]?[ns_conn query]"
+set subsite_url [subsite::get_element -element url]
+acs_user::get -user_id $user_id -array user_info
+set widthheight_param "width=64 height=64"
+set export_vars [export_url_vars user_id]
+set error 0
+set msg_error 0
+set is_edit 0
+
+#CHECK PERMISSIONS
+if {!$admin_p} {
+  if {$user_id != [ad_get_user_id]} {
+    ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"]
+  }
+}
+
+
+# modo EDIT --> Control de la edici�n de campos
+if {$mode eq "edit1"} {
+        set is_edit 1
+} else {
+        if { $mode eq "edit2" } {
+                set is_edit 2
+        }
+}
+
+# Modo CANCELAR --> No hace nada, redirecci�n
+if {$mode_cancel ne ""} {
+        set mode_update ""
+                ad_returnredirect "card?user_id=$user_id&nav_sel=ficha"
+}
+        
+# Modo UPDATE_1
+if {$mode_update eq "mode_update1"} {
+  db_dml update_personal_info { *SQL* }
+  set mode_update ""
+  ad_returnredirect "card?user_id=$user_id&nav_sel=ficha"
+}
+
+# Modo UPDATE_2
+if {$mode_update eq "mode_update2"} {
+  db_dml update_student_comment { *SQL* }
+  set mode_update ""
+  ad_returnredirect "card?user_id=$user_id&nav_sel=ficha"      
+}
+
+set existe_photo 1;
+if ![db_0or1row get_item_id { *SQL* } ] {
+  set existe_photo 0;
+}
+
+# Comprobamos que el alumno tiene CARD
+# En caso contrario la creamos
+set found_card [db_0or1row select_found_card { *SQL* }]
+if {!$found_card} {
+  db_dml insert_add_student_card { *SQL* }
+  db_0or1row select_found_card { *SQL* }
+}
+
+set is_teacher [dotlrn::user_can_admin_community_p -user_id [ad_get_user_id] -community_id $community_id]
+
+
+# Obtenemos los parametros de configuraci�n de la evaluacion de la asignatura
+db_1row view_notes { *SQL* }
+
+set bn $base_note
+
+db_multirow blocs_eval blocs_eval_sql { *SQL* }
+db_multirow blocs_eval1 blocs_eval1_sql { *SQL* }
+db_multirow notes notes_sql { *SQL* }
+# NUEVA CONSULTA
+db_multirow notes11 notes_eval_sql { *SQL* }
+        
+        
+# CALCULO NOTA FINAL
+set nota_m 0
+set final_note 0
+set np_count 0
+set restrict  0 
+#Obtenemos el numero de bloques con NP activo y lo guardamos en np_num
+db_1row npn_sql { *SQL* }
+set np_num $npn
+        
+# Recorremos todas las notas del usuario actual
+set restrict "NO"
+        set nota_media 0
+        set aux_m 0
+        set aux_r 0
+        set np_count 0
+        set r_txt "(*)" 
+       
+        # Recorremos todas las notas del usuario actual
+        multirow foreach notes11 {      
+                if {$ref_id_card eq $id_card} {
+                        set nota_media [expr $nota_media + $mitja_p]
+                        set rval [expr $rvalor * $xcent * 1.00  / 100]                                          
+                        # Control de restricci�n. Si se la salta activamos restrict
+                        if {($mitja_p < $rval) && ($mitja_p ne 0)} {
+                                set restrict "SI"
+                        }
+                        # Control de NP. Si esta activo y media es cero incrementamos 1 el contador de np's
+                        if {($np eq "t") && ($mitja_p eq 0)} {
+                                set np_count [expr $np_count + 1]
+                        }       
+                }
+        }
+        
+        # Control de NP, Restriccion y estadisticas
+        if {($np_count eq $np_num) && ($np_num ne 0)} {
+                lappend l_notas "NP"
+        } else {
+                if {$restrict eq "SI" && $nota_media > 5} {
+                        lappend l_notas -1
+                } else {
+                        lappend l_notas $nota_media
+                }       
+        }       
\ No newline at end of file
Index: openacs-4/packages/cards/www/card.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/card.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/card.xql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+	
+	<fullquery name="update_personal_info">
+        <querytext>
+			update uv_card
+			set address= :address, phone1= :phone1, phone2= :phone2
+			where id_card= :card_id
+	    </querytext>
+    </fullquery>
+	
+	
+	
+	<fullquery name="update_student_comment">
+        <querytext>
+			update uv_card
+			set comm_student= :comm_student
+			where id_card= :card_id
+	    </querytext>
+    </fullquery>
+	
+
+
+	<fullquery name="get_item_id">
+        <querytext>
+			select i.width, i.height, cr.title, cr.description, cr.publish_date
+			from acs_rels a, cr_items c, cr_revisions cr, images i
+			where a.object_id_two = c.item_id
+				and c.live_revision = cr.revision_id
+				and cr.revision_id = i.image_id
+				and a.object_id_one = :user_id
+				and a.rel_type = 'user_portrait_rel'		
+	    </querytext>
+    </fullquery>
+	
+	
+	<fullquery name="select_found_card">
+        <querytext>
+			select * from uv_card 
+			where ref_user_id= :user_id 
+			and ref_community_id= :community_id
+	    </querytext>
+    </fullquery>
+	
+	
+	<fullquery name="insert_add_student_card">
+        <querytext>
+			insert into uv_card (ref_community_id, ref_user_id)
+				values (:community_id, :user_id)
+		</querytext>
+    </fullquery>
+	
+	
+	<fullquery name="view_notes">
+        <querytext>
+			select * from uv_card_base_note 
+			where community_id = :community_id
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="blocs_eval_sql">
+        <querytext>
+			select * from uv_card_xcent_note 
+			where ref_community_id = :community_id 
+			order by xcent desc
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="blocs_eval1_sql">
+        <querytext>
+			select ref_xcent, name_xcent, xcent, avg(value_n) as mitja 
+			from uv_card_notes inner join 
+				(uv_card_subtype_note inner join 
+					uv_card_xcent_note on (ref_xcent = id_xcent))
+				on (ref_subtype = id_subtype) 
+			where ref_id_card = :card_id and is_active = 'true' 
+			group by ref_xcent,name_xcent,xcent order by ref_xcent asc
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="notes_sql">
+        <querytext>
+			select * from uv_card_notes inner join 
+				(uv_card_subtype_note inner join 
+					uv_card_xcent_note on (ref_xcent = id_xcent))
+				on (ref_subtype = id_subtype) 
+			where ref_id_card = :card_id 
+			order by id_subtype desc				
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="notes_eval_sql">
+        <querytext>
+			select 	ref_id_card, ref_xcent, name_xcent, xcent,
+					avg(value_n)*xcent*1.00/100.00 as mitja_p,
+					rvalor, np 
+			from uv_card_notes n, uv_card_subtype_note sn, uv_card_xcent_note xn 
+			where sn.ref_xcent = xn.id_xcent 
+				and sn.ref_community_id = :community_id 
+				and xn.ref_community_id = :community_id 
+				and ref_id_card = :card_id 
+				and n.ref_subtype = sn.id_subtype 
+				and is_active = 'true' 
+				and xcent<>0 
+				group by  ref_xcent,name_xcent,xcent,ref_id_card,rvalor,np 
+				order by ref_id_card asc, xcent desc, ref_xcent asc
+	    </querytext>
+    </fullquery>	
+
+	<fullquery name="npn_sql">
+        <querytext>
+			select count(np) as npn 
+			from uv_card_xcent_note 
+			where ref_community_id= :community_id and np<>'f'
+	    </querytext>
+    </fullquery>		
+        
+</queryset>
\ No newline at end of file
Index: openacs-4/packages/cards/www/cards.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/cards.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/cards.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,6 @@
+
+<master>
+
+<include src="cards_list-chunk-table" referer="cards1">
+
+<BR>
Index: openacs-4/packages/cards/www/cards.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/cards.css,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/cards.css	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,42 @@
+/*  CSS CARDS PACKAGE  - UVEG - fransola@uv.es  */
+a.t:hover {background:#ffcc00;padding-top:5px;padding-bottom:2px;}
+a.button1 {font: 85% arial; border: solid 1px black; background-color: #99ccff; text-align: center; padding: 2px; padding-left: 8px; padding-right: 8px; color: black; text-decoration: none; white-space: nowrap;}
+
+a{color:#0048AF}
+a:visited{color:#0048AF}
+a.link1 {background:#FFFFE0;color:#383C93;font-weight:bold}
+a.link1:visited{background:#FFFFE0;color:#383C93;font-weight:bold}
+a.link1:hover {background:#FAC328;color:#383C93;font-weight:bold}
+img {border:0px}
+
+
+form {font-size:11px;color:#003366}
+input {font-size:11px;color:#003366}
+select {font-size:11px;color:#003366}
+textarea {font-size:11px;color:#003366}
+
+.list_c {padding:4px;border-right:1px solid #A0BDEB;padding-left:5px}
+.list_h { background:#6186b0;border-bottom: 3px solid #A0BDEB;color:white;text-align:left}
+
+th.list_c { border-bottom: 3px solid #A0BDEB;}
+
+tr.list_c_sel { border-right:1px solid #A0BDEB;border-bottom: 1px solid #A0BDEB;background:#e0e0e0;}
+tr.list-odd_c {padding:4px;border-right:1px solid #A0BDEB;background-color: #EAF2FF;}
+tr.list-even_c {padding:4px;border-right:1px solid #A0BDEB;background-color: white;}
+
+td.list_c { border-bottom: 1px solid #A0BDEB;}
+td.list_c_sel { border-right:1px solid #A0BDEB;border-bottom: 1px solid #A0BDEB;background:#e0e0e0;}
+td.list_sel {padding:4px;border-right:1px solid #A0BDEB;padding-left:5px;background:#e0e0e0;}
+td.list-button-bar {padding-top: 3px;  font-size: 115%;}
+td.orla {width:85px;height:85px;border: 1px solid #6186B0;font-size:9px;}
+td.orla:hover {width:85px;height:85px;border: 1px solid #FAC328;font-size:9px;}
+
+div.volver {background:#6186b0;color:#ffffff;padding-top:5px;padding-bottom:2px;display:inline}
+
+
+
+
+
+
+
+
Index: openacs-4/packages/cards/www/cards.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/cards.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/cards.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,17 @@
+
+ad_page_contract {
+} -query {
+}
+
+# prevent this page from being called when not in a community
+# (i.e. the main dotlrn instance
+if {[empty_string_p [dotlrn_community::get_community_id]]} {
+    ad_returnredirect "[dotlrn::get_url]"
+}
+
+set context [list [list "one-community-admin" [_ dotlrn.Admin]] [_ dotlrn.Manage_Members]]
+set community_id [dotlrn_community::get_community_id]
+set portal_id [dotlrn_community::get_portal_id -community_id $community_id]
+set admin_p [dotlrn::user_can_admin_community_p -user_id [ad_get_user_id] -community_id $community_id]
+set spam_p [dotlrn::user_can_spam_community_p -user_id [ad_get_user_id] -community_id $community_id]
+set return_url "[ns_conn url]?[ns_conn query]"
Index: openacs-4/packages/cards/www/cards_list-chunk-table.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/cards_list-chunk-table.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/cards_list-chunk-table.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,62 @@
+<!-- NOMBRE ASIGNATURA + BOTON VOLVER-->
+<link rel="stylesheet" href="cards.css" type="text/css">
+
+<TABLE width="100%">
+<TR>
+<TD style="font-weight:bold">
+<div class="volver">
+&nbsp;&nbsp;<%= [dotlrn_community::get_community_description -community_id $community_id] %>&nbsp;&nbsp;</div></TD>
+<TD ALIGN="RIGHT">
+<div class="volver">
+<A HREF="../one-community" class="t" style="color:#ffffff;font-weight:bold">&nbsp;&nbsp;#cards.card_Back#&nbsp;&nbsp;</A></div></TD>
+</TR>
+</TABLE>
+<BR>
+
+<!-- ENLACES GESTION EVALUACION -->
+<TABLE cellspacing="1" cellpadding="3" class="list">
+        <TR class="list-button-bar">
+        <TD class="list-button-bar" colspan="4">
+                <A HREF="gest_eval" class="button">&nbsp;#cards.card_Setup_evaluation#&nbsp;</A>
+                <A HREF="gest_notes" class="button">&nbsp;#cards.card_Manage_notes#&nbsp;</A>
+                <A HREF="list_notes" class="button">&nbsp;#cards.card_Grades_list#&nbsp;</A>
+				  <A HREF="orla" class="button">&nbsp;#cards.card_Orla#&nbsp;</A>
+<!--            <A name="EvalxA" class="button">&nbsp;Evaluar Por Anotaci�n&nbsp;</A>-->
+        </TR>
+        </TABLE> 
+
+<table with="75%" class="list" cellpadding="5" cellspacing="0">
+    <tr class="list-header">
+      <th class="list">&nbsp;</th>
+      <th class="list" align="left">#dotlrn.Last_Name#, #dotlrn.First_Name#</th>     
+    </tr>
+<multiple name="current_members">
+  <if @current_members.rownum@ odd>
+    <tr class="list-odd" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#EAF2FF'">
+  </if>
+  <else>
+    <tr class="list-even" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#FFFFFF'">
+  </else>
+  
+  <if @current_members:rowcount@ eq @current_members.rownum@>
+  <td width="1%" class="list" style=" border-bottom: 3px solid #A0BDEB;"></if><else>
+  <td width="1%" class="list"></else>
+    <A HREF="notes?user_id=@current_members.user_id@"><IMG SRC="icons/card.gif" BORDER=0></A>
+  </td>
+  
+  <if @current_members:rowcount@ eq @current_members.rownum@>
+  <td class="list" style=" border-bottom: 3px solid #A0BDEB;"></if><else>
+  <td class="list"></else>
+    <% set fullname [format "%s, %s" @current_members.last_name@ @current_members.first_names@] %>
+    <%= [format "<A HREF=\"notes?user_id=%s\">%s, %s</A>" @current_members.user_id@ @current_members.last_name@ @current_members.first_names@] %>    
+  </td>
+  </tr>
+</multiple>
+</table>
+<I> <%= @current_members:rowcount@ %> #dotlrn.student_role_pretty_plural# </I>
+
+<!--
+<BR><SPAN STYLE="color:#ddebf5">num_alum_del@ </SPAN>
+<BR><SPAN STYLE="color:#ddebf5">Alumnos sin card user_no_card:rowcount@ </SPAN>
+<BR><SPAN STYLE="color:#ddebf5">Anotaciones de la com:  community_notes:rowcount@ </SPAN>
+-->
\ No newline at end of file
Index: openacs-4/packages/cards/www/cards_list-chunk-table.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/cards_list-chunk-table.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/cards_list-chunk-table.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,188 @@
+ad_page_contract {
+}  -query {
+    {parent_user_role:multiple,array,optional}
+    {order "last_name"}
+    {order_direction "asc"}
+} -properties {
+    users:multirow
+    n_parent_users:onevalue
+}
+
+set dotlrn_url [dotlrn::get_url]
+# use my_user_id here so we don't confuse with user_id from the query
+set my_user_id [ad_conn user_id]
+
+set show_drop_button_p [parameter::get_from_package_key \
+                              -package_key dotlrn-portlet \
+                              -parameter AllowMembersDropGroups]
+
+set community_id [dotlrn_community::get_community_id]
+set referer [ns_conn url]
+dotlrn::require_user_read_private_data -user_id $my_user_id -object_id $community_id
+
+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
+}
+
+if {!$admin_p} {
+	ad_returnredirect "card?user_id=$my_user_id&nav_sel=ficha"
+	}
+
+if {![exists_and_not_null referer]} {
+    if {[string equal $admin_p t] == 1} {
+        set referer "one-community-admin"
+    } else {
+        set referer "one-community"
+    }
+}
+
+# Used in I18N message lookups in adp
+set parent_community_name [dotlrn_community::get_parent_name -community_id $community_id]
+set community_name [dotlrn_community::get_community_name $community_id]
+
+if {[string compare $order_direction "asc"]==0} {
+    set order_html "<img src=\"/resources/dotlrn/down.gif\" height=15 width=15>"
+    set opposite_order_direction "desc"
+} else {
+    set order_html "<img src=\"/resources/dotlrn/up.gif\" height=15 width=15>"
+    set opposite_order_direction "asc"
+}
+
+# Variables that will be used if the column
+# is not selected.
+
+set first_names_order_html ""
+set last_name_order_html ""
+set email_order_html ""
+
+set first_names_order_direction $order_direction
+set last_name_order_direction $order_direction
+set email_order_direction $order_direction
+
+# Special case for the selected column.
+switch $order {
+    "first_names" {
+        set first_names_order_html $order_html
+        set first_names_order_direction $opposite_order_direction
+    }
+    "last_name"  {
+        set last_name_order_html $order_html
+        set last_name_order_direction $opposite_order_direction
+    }
+    "email"  {
+        set email_order_html $order_html
+        set email_order_direction $opposite_order_direction
+    }
+}
+
+set bio_attribute_id [db_string bio_attribute_id { *SQL* }]
+
+# vars to carry over (from previous script)
+# Do a special clause for role!
+
+# The note in the members-chunk-table.xql indicated that
+# it would be very hard to make sorting work with ad_table
+# and sorting by columns functionality was incomplete.  After 
+# struggling with ad_table for a while, I went to the
+# OpenACS IRC and asked some questions.  The response
+# basically was that ad_table needs a refactoring.
+# Therefore, I (teadams@alum.mit.edu) decided to 
+# simplify and use db_multirow and code my own column
+# sorting.  
+
+#****************************************************
+#OPCIONES DE MANTENIMIENTO
+#****************************************************
+# Crear opciones comunidad
+#Creamos entrada en UV_CARD_BASE_NOTE si no existe para la comunidad
+#set found_base [db_0or1row get_base "select * from uv_card_base_note where community_id = :community_id"]
+set found_base 1
+set found_base [db_0or1row get_base {}]
+
+if {$found_base eq 0} {
+  db_dml insert_base_note {}
+}
+
+# BAJA ALUMNOS: Borrar anotaciones y fichas que ya no sirven
+# 1. Contamos el n� de alumnos / miembros a borrar
+db_0or1row alum_del { *SQL* }
+if {$num_alum_del > 0} {
+	# 2. Borramos alumnos 
+	db_dml delete_card_notes { *sQL*}
+	# 3. Borrar fichas 		
+	db_dml delete_cards { *SQL* }		
+}
+
+########################################################
+# PONER AL DIA NUEVOS USUARIOS
+# 1. seleccionar usuarios sin card para la comunidad
+db_multirow user_no_card user_no_card_sql { *SQL* } 
+
+# 2. Seleccionar anotaciones de la comunidad
+db_multirow community_notes community_notes_sql { *SQL* }
+
+# 3. Crear las CARDS a los usuarios sin card
+multirow foreach user_no_card {
+	# creamos la card
+    db_dml insert_add_new_card { *SQL* }
+	# Obtenemos su card_id en esa comunidad
+    db_1row card_user_id { *SQL* }
+	# Para cada anotacion de la comunidad
+    multirow foreach community_notes {
+		# 4. Crear las anotaciones a los alumnos
+		db_dml insert_pending_notes { *SQL* }
+	}
+}
+
+set order_by "$order $order_direction"
+
+db_multirow -extend { community_member_url } current_members select_current_members {} {
+    set community_member_url [acs_community_member_url -user_id $user_id]
+}
+
+db_multirow pending_users select_pending_users { *SQL* } {
+    set role [dotlrn_community::get_role_pretty_name -community_id $community_id -rel_type $rel_type]
+}
+
+if {!$admin_p} {
+	ad_returnredirect "card?user_id=$my_user_id&nav_sel=ficha"
+	}
+
+# If we are in a subcomm. get the list of the users of the parent
+# comm that are not in the subcomm yet, and output them with radios
+# for roles, etc.
+set subcomm_p [dotlrn_community::subcommunity_p -community_id $community_id]
+
+if {$subcomm_p} {
+
+    form create parent_users_form
+
+    set parent_user_list [dotlrn_community::list_possible_subcomm_users -subcomm_id $community_id]
+    set n_parent_users [llength $parent_user_list]
+
+    foreach user $parent_user_list {
+        element create parent_users_form "selected_user.[ns_set get $user user_id]" \
+            -datatype text \
+            -widget radio \
+            -options {{{} none} {{} dotlrn_member_rel} {{} dotlrn_admin_rel}} \
+            -value none
+    }
+
+    if {[form is_valid parent_users_form]} {
+        foreach user $parent_user_list {
+            set rel [element get_value parent_users_form "selected_user.[ns_set get $user user_id]"]
+            if {![string match $rel none]} {
+                dotlrn_community::add_user -rel_type $rel $community_id [ns_set get $user user_id]
+            }
+        }
+        ad_returnredirect [ns_conn url]
+    }
+}
+ad_return_template
Index: openacs-4/packages/cards/www/cards_list-chunk-table.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/cards_list-chunk-table.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/cards_list-chunk-table.xql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,168 @@
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+
+    <fullquery name="select_current_members">
+        <querytext>
+            select dotlrn_member_rels_approved.rel_id,
+                   dotlrn_member_rels_approved.rel_type,
+                   dotlrn_member_rels_approved.role,
+                   dotlrn_member_rels_approved.user_id,
+                   acs_users_all.first_names,
+                   acs_users_all.last_name,
+                   acs_users_all.email,
+                   (select count(*) from acs_rels where rel_type = 'user_portrait_rel' and object_id_one = dotlrn_member_rels_approved.user_id) as portrait_p,
+                   (select count(*) from acs_attribute_values where object_id = dotlrn_member_rels_approved.user_id and attribute_id = :bio_attribute_id and attr_value != '') as bio_p
+            from acs_users_all,
+                 dotlrn_member_rels_approved
+            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')
+            order by acs_users_all.last_name asc
+        </querytext>
+    </fullquery>
+	
+	
+	<fullquery name="get_base">
+        <querytext>
+			select * from uv_card_base_note 
+			where community_id = :community_id
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="insert_base_note">
+        <querytext>
+			insert into uv_card_base_note
+			(community_id, base_note)
+			values
+			(:community_id, 100)
+	    </querytext>
+    </fullquery>
+		
+	
+	<fullquery name="alum_del">
+		<querytext>
+			select count(id_card) as num_alum_del 
+			from uv_card 
+			where ref_community_id = :community_id and 
+			ref_user_id not in 	
+				(select user_id 
+					from dotlrn_member_rels_approved m 
+					where (m.community_id = :community_id 
+					and m.role = 'student') OR 
+					(m.community_id = :community_id 
+					and m.role = 'member')
+				)
+	    </querytext>
+    </fullquery>
+	
+	
+	<fullquery name="delete_card_notes">
+        <querytext>
+		delete from uv_card_notes 
+		where id_card_notes in 
+			(select id_card_notes from uv_card_notes 
+			 where ref_id_card in 
+				(select id_card from uv_card 
+				where ref_community_id = :community_id and ref_user_id not in 
+					(select user_id from dotlrn_member_rels_approved m 
+					where (m.community_id = :community_id and m.role = 'student') OR
+						  (m.community_id = :community_id and m.role = 'member')
+					)
+				)
+			)
+	    </querytext>
+    </fullquery>
+
+	<fullquery name="delete_cards">
+        <querytext>
+		delete from uv_card 
+		where id_card in 
+		(select id_card from uv_card 
+		 where ref_community_id = :community_id and ref_user_id not in 
+			(select user_id from dotlrn_member_rels_approved m 
+			 where (m.community_id = :community_id and m.role = 'student') OR 
+			       (m.community_id = :community_id and m.role = 'member')
+			)
+		)
+		
+	    </querytext>
+    </fullquery>
+		
+	<fullquery name="user_no_card_sql">
+        <querytext>
+		select a.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') and
+			  a.user_id not in 
+				(select ref_user_id from uv_card where ref_community_id = :community_id)
+		</querytext>
+    </fullquery>
+	
+
+	
+	<fullquery name="community_notes_sql">
+        <querytext>
+			select id_subtype from uv_card_subtype_note s 
+				inner join uv_card_xcent_note on (id_xcent = ref_xcent) 
+			where s.ref_community_id = :community_id and ref_basetype <> 3		
+	    </querytext>
+    </fullquery>	
+	
+	
+	
+	<fullquery name="insert_add_new_card">
+        <querytext>
+			insert into uv_card (ref_community_id, ref_user_id)
+			values (:community_id, :user_id)
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="card_user_id">
+        <querytext>
+			select id_card from uv_card 
+			where ref_community_id = :community_id and ref_user_id = :user_id
+	    </querytext>
+    </fullquery>	
+	
+	
+	
+	<fullquery name="insert_pending_notes">
+        <querytext>
+			insert into uv_card_notes (ref_id_card,ref_subtype,value_n,r_community_id)
+			values (:id_card, :id_subtype, 0.00, :community_id)
+	    </querytext>
+    </fullquery>
+	
+	
+	
+	<fullquery name="select_pending_users">
+        <querytext>
+		    select dotlrn_users.*,
+				dotlrn_member_rels_full.rel_type,
+				dotlrn_member_rels_full.role
+			from dotlrn_users,
+				 dotlrn_member_rels_full
+			where dotlrn_users.user_id = dotlrn_member_rels_full.user_id
+				and dotlrn_member_rels_full.community_id = :community_id
+				and dotlrn_member_rels_full.member_state = 'needs approval'
+	    </querytext>
+    </fullquery>
+	
+	
+	
+	<fullquery name="bio_attribute_id">
+        <querytext>
+			select attribute_id
+			from acs_attributes
+			where object_type = 'person'
+				and attribute_name = 'bio'
+	    </querytext>
+    </fullquery>
+	
+	
+    
+
+</queryset>
Index: openacs-4/packages/cards/www/eval_note.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/eval_note.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/eval_note.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,130 @@
+<master>
+<SCRIPT LANGUAGE="JavaScript">
+<!-- Original:  Paco Soler -->
+<!-- Begin
+
+function validaForm (f) {
+
+	error = 0
+	if (isNaN(f.note_value.value) || parseInt(f.note_value.value) > 10 || parseInt(f.note_value.value) < 0) {	
+			f.note_value.style.backgroundColor="#ffcc00";
+			error = 2
+	} else {f.note_value.style.backgroundColor="#ffffff";}
+	
+	if (error > 0) { alert ("#cards.card_Invalid_data#");return false}
+	else return true
+	
+}	
+
+//  End -->
+</script>
+
+<link rel="stylesheet" href="cards.css" type="text/css">
+<TABLE width="100%">
+<TR>
+<TD style="font-weight:bold">
+<div class="volver">
+&nbsp;&nbsp;<%= [dotlrn_community::get_community_description -community_id $community_id] %>&nbsp;&nbsp;</div></TD>
+<TD ALIGN="RIGHT">
+<div class="volver">
+<A HREF="gest_notes" class="t" style="color:#ffffff;font-weight:bold">&nbsp;&nbsp;#cards.card_Back#&nbsp;&nbsp;</A></div></TD>
+</TR>
+</TABLE>
+<table width="70%" cellpadding="5" cellspacing="0" border="0">
+<TR> 
+	<TD COLSPAN="2"><h4 style="color:#6186b0">#cards.card_Grade#: @sel_note@</h4>
+	<table width="100%" class="list" cellpadding="5" cellspacing="0">
+    <tr class="list-header">
+		<th class="list_c" class="">&nbsp;</th>
+		<th class="list_c" width="30%"><B>#dotlrn.student_role_pretty_plural#</B></th>
+		<th class="list_c" width="40%"><B>#cards.card_Comment#</B></th>
+		<th class="list_c" width="10%"><B>#cards.card_Grade#</B></th>
+		<if @act_note@>
+		<th class="list_c" width="10%"><B>#cards.card_Active#</B></th>		
+		</if>
+		<th class="list_c" width="10%"><B>#cards.card_Edit#</B></th>
+    </tr>	
+	<multiple name="llista">
+		<if @is_edit@ ne @llista.id_card_notes@> <!--SI NO editamos la que toca-->		
+		<if @llista.rownum@ odd>
+		<tr class="list-odd_c" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#EAF2FF'">
+		</if><else>
+		<tr class="list-even_c" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#FFFFFF'">
+		</else>		
+		<td class="list_c" width="1%">@llista.rownum@</td>
+		<td class="list_c" width="30%"><%= [set fullname [format "%s, %s" @llista.last_name@ @llista.first_names@]] %></td>		
+		<td class="list_c" width="40%">@llista.value_s@</td>
+		<td class="list_c" width="10%" align="right">@llista.value_n@</td>
+		<if @act_note@>
+		<td class="list_c" width="10%" align="right">
+		<if @llista.is_active@>
+			<INPUT type="checkbox" size="1" name="note_active" checked disabled>
+		</if><else>
+			<INPUT type="checkbox" size="1" name="note_active" disabled>
+		</else></td>		
+		</if>		
+		<!-- MODE EDIT LINK **************************************************-->
+			<if @is_edit@ eq 0>
+			<FORM METHOD="post" name="fm">
+			<td class="list_c" width="10%" align="center">
+				<INPUT type="hidden" name="mode" value="edit">
+				<INPUT type="hidden" name="note_sel" value="@note_sel@">
+				<INPUT type="hidden" name="note_id" value="@llista.id_card_notes@">
+				<INPUT type="image" name="submit" value="submit" border="0" alt="#cards.card_Edit# #cards.card_Grade#" title="#cards.card_Edit# #cards.card_Grade#"
+				src="icons/edit.gif">		
+			</td>
+			</form>						
+			</if>
+			<else><td class="list_c" width="10%">&nbsp;</td></else>
+			
+		</if><else>
+		<tr class="list_c_sel">
+		<td class="list_c" width="1%">@llista.rownum@</td>
+		<td class="list_c" width="30%"><%= [set fullname [format "%s, %s" @llista.last_name@ @llista.first_names@]] %>
+				
+		</td>		
+		<!-- MODE UPDATE **************************************************-->
+		<a name="goto_edit"></a>
+		<FORM METHOD="post" name="fe" onsubmit="return validaForm(this)">
+		<INPUT type="hidden" name="note_sel" value="@note_sel@">
+		<INPUT type="hidden" name="note_id" value="@llista.id_card_notes@">
+			
+		<td class="list_c_sel" width="40%">
+			<INPUT type="text" size="55" name="note_desc" value="@llista.value_s@"></td>
+		<td class="list_c_sel" width="10%">
+			<INPUT type="text" size="5" name="note_value" value="@llista.value_n@"></td>
+
+		<if @act_note@>			
+		<td class="list_c_sel" width="10%">
+			<if @llista.is_active@>
+				<INPUT type="checkbox" size="1" name="note_active" value="1" checked="true">
+			</if>
+			<else>
+				<INPUT type="checkbox" size="1" name="note_active" value="1">
+			</else>
+		</td>			
+		</if>
+		<else>
+			<INPUT type="hidden" size="1" name="note_active" value="1">
+		</else>
+		
+		
+		<td width="10%" class="list_c_sel"  align="center">
+		<INPUT type="hidden" name="mode_update" value="">
+		<INPUT type="image" name="submit" value="submit" size="10" src="icons/ok.gif" ALT="#cards.card_Accept#" title="#cards.card_Accept#" onclick="document.fe.mode_update.value='mode_update'">&nbsp;&nbsp;
+		<INPUT type="hidden" name="mode_cancel" value="">
+	<INPUT type="image" name="submit" value="submit" size="10" src="icons/ko.gif" ALT="#cards.card_Cancel#" 
+	title="#cards.card_Cancel#" onclick="document.fe.mode_cancel.value='mode_cancel'">
+
+		</td> 		
+		</FORM>
+	</else>
+	</multiple>
+	</table>
+	</TD>
+</TR>
+</TABLE><BR><BR>
+<if @error@><SCRIPT>alert("@msg_error@")</SCRIPT></if>
+		<script>
+				document.forms['fe'].note_value.focus();
+		</script>
\ No newline at end of file
Index: openacs-4/packages/cards/www/eval_note.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/eval_note.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/eval_note.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,67 @@
+ad_page_contract {
+}  -query { 
+  {note_sel:optional ""}
+  {note_id:optional ""}
+  {note_value:float,optional ""}
+  {note_desc:optional ""}
+  {note_active:optional ""}
+  {mode:optional ""}  
+  {mode_insert:optional ""}
+  {mode_update:optional ""}
+  {mode_cancel:optional ""}
+  {mode_base:optional ""} 
+} -properties {
+}
+set tcl_precision 5
+set error 0
+set sel_edit_note 0
+set is_edit 0
+set msg_error ""
+# a�� no s� el que fa
+set dotlrn_url [dotlrn::get_url]
+# Comunitat a la que estem y usuari que som  # Si som administradors a la comunitat
+set community_id [dotlrn_community::get_community_id]
+set my_user_id [ad_conn user_id]
+set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id]
+# A�� no s� per a que �s.
+set referer [ns_conn url]
+# L'hora del sistema
+set datetime [clock_to_ansi [clock seconds]]
+# Comprovar permisos: Si l'usuari no administrador conectat no es el de la fitxa no li deixem vore-la.
+#if {!$admin_p} { set link_type 1} else { set link_type 0}# Si no som administradors res de res.
+if {!$admin_p} {
+			ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] 	
+}
+
+# Buscar els alumnes de la comunitat (Apellidos, Nombre, User_id, Id_card) y la anotacio
+db_multirow llista alum_sql { *SQL* }
+
+if {$mode eq "edit"} {
+	set is_edit $note_id
+} else {
+	set is_edit 0
+}
+
+# Comprobacion de modos
+if {$mode_cancel ne ""} {
+	set mode_update ""
+	ad_returnredirect "./eval_note?note_sel=$note_sel"
+	}
+
+if {$mode_update ne ""} {
+		db_dml update_card_note { *SQL* }		
+		set mode_update ""
+		ad_returnredirect "./eval_note?note_sel=$note_sel"
+
+}
+	
+# Obtenemos si la anotacion permite activacion
+db_1row act_note { *SQL* }
+
+set act_note $allow_act	
+	
+# Nombre de anotaci�n seleccionado
+db_1row sel_note { *SQL* }
+
+set sel_note $name_subtype
+
Index: openacs-4/packages/cards/www/eval_note.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/eval_note.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/eval_note.xql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+
+	
+	
+	<fullquery name="alum_sql">
+        <querytext>
+			select 	acs_users_all.user_id, id_card, last_name, first_names,
+					id_card_notes, value_s, value_n, is_active 
+			from acs_users_all, dotlrn_member_rels_approved 
+				inner join uv_card
+					inner join uv_card_notes on id_card = ref_id_card 
+				on (ref_user_id = 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 uv_card.ref_community_id = :community_id 
+					and ref_subtype = :note_sel 
+			order by last_name, first_names asc
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="update_card_note">
+        <querytext>
+			update uv_card_notes
+				set value_n= :note_value, value_s= :note_desc, is_active= :note_active
+				where id_card_notes = :note_id
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="act_note">
+        <querytext>
+			select allow_act from uv_card_xcent_note xn 
+				inner join uv_card_subtype_note sn on (id_xcent = ref_xcent) 
+			where sn.ref_community_id = :community_id and id_subtype = :note_sel
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="sel_note">
+        <querytext>
+			select name_subtype from uv_card_subtype_note 
+			where id_subtype = :note_sel
+	    </querytext>
+    </fullquery>
+</queryset>
Index: openacs-4/packages/cards/www/gest_eval.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/gest_eval.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/gest_eval.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,256 @@
+<!-- <master>  --><!-- #dotlrn.gestion_evaluacion_name# -->
+<SCRIPT LANGUAGE="JavaScript">
+<!-- Original:  Paco Soler -->
+<!-- Begin
+
+function validaNum (campo, valor, max, min , txt) {
+
+if (isNaN(valor) || valor == " " || valor == "" || parseInt(valor) < min || parseInt(valor) > max) {
+	alert("#cards.card_Invalid_value1#" + txt + "#cards.card_Invalid_value2#" + max + ".");
+	campo.select();
+	campo.style.backgroundColor="#ffcc00"
+}
+	else{campo.style.backgroundColor="#ffffff"
+	} 
+}
+
+function validaForm (f) {
+	if (f.mode_cancel.value == "mode_cancel") {
+		f.asig_alias.value = "";
+		f.asig_percent.value = 0;
+		f.asig_rvalor.value = 0;
+		return true;
+	} else {
+	error = 0
+	if (f.asig_alias.value == "" || f.asig_alias.value == " ") {
+		f.asig_alias.style.backgroundColor="#ffcc00";
+		error = 1
+	} else {f.asig_alias.style.backgroundColor="#ffffff";}
+	if (isNaN(f.asig_percent.value) || parseInt(f.asig_percent.value) > 100 || parseInt(f.asig_percent.value) < 0) {		
+			f.asig_percent.style.backgroundColor="#ffcc00";
+			error = 2
+	} else {f.asig_percent.style.backgroundColor="#ffffff";}
+	if (isNaN(f.asig_rvalor.value) || parseInt(f.asig_rvalor.value) > 10 || parseInt(f.asig_rvalor.value) < 0){			
+			f.asig_rvalor.style.backgroundColor="#ffcc00"
+			error = 3			
+	} else {f.asig_rvalor.style.backgroundColor="#ffffff";}
+
+	if (error > 0) { alert ("#cards.card_Invalid_data#");return false}
+	else return true
+	}
+}	
+
+//  End -->
+</script>
+<!--		a lert ("Nombre de bloque no v�lido. Int�ntalo de nuevo.");
+		a lert ("Porcentaje no v�lido. Int�ntalo de nuevo.");
+		a lert ("Restricci�n no v�lida. Int�ntalo de nuevo.");-->
+
+<link rel="stylesheet" href="cards.css" type="text/css">
+<TABLE width="100%">
+<TR>
+<TD style="font-weight:bold">
+<div class="volver">&nbsp;&nbsp;#cards.card_Subjet#: <%= [dotlrn_community::get_community_description -community_id $community_id] %>&nbsp;&nbsp; <!--  - community_id --></div></TD>
+<TD ALIGN="RIGHT">
+<div class="volver">
+<A HREF="cards" class="t" style="color:#ffffff;font-weight:bold">&nbsp;&nbsp;#cards.card_Back#&nbsp;&nbsp;</A></div></TD></TR>
+</TABLE>
+<DIV style="width:100%">
+<!-- AQUI VA LA GESTI�N DE BLOQUES -->
+<table width="100%" cellpadding="5" cellspacing="0" border="0">
+<TR>
+	<TD COLSPAN="3"><h4 style="color:#6186b0">&nbsp;#cards.card_Evaluation_blocks_list#</h4>
+	<table  class="list" width="100%" cellpadding="3" cellspacing="1" border="0">
+    <tr class="list-header">
+		<th class="list_c" width="4%" align="center" ><B>N�</B></th>
+		<th class="list_c" width="15%" align="left"><B>#cards.card_Data_type#</B></th>
+		<th class="list_c" width="45%" align="left"><B>#cards.card_Block_name#</B></th>
+		<th class="list_c" width="8%" align="center"><B>%</B></th>
+		<th class="list_c" width="8%" align="center"><B>NP</B></th>	
+		<th class="list_c" width="8%" align="center"><B>R[>=]</B></th>	
+		<if @is_edit@ ne 1>
+		<th class="list_c" width="6%" align="center"><B>#cards.card_Edit#</B></th>
+		<th class="list" width="6%" align="center" style="padding:4px"><B>#cards.card_Delete#</B></th>	
+		</if><else>
+		<th class="list_c" width="6%" align="center"><B>#cards.card_Accept#</B></th>
+		<th class="list" width="6%" align="center" style="padding:4px"><B>#cards.card_Cancel#</B></th>	
+		</else>
+		<!-- <td>#dotlrn.id_type_note_name#</td>  <td>#dotlrn.name_note_name#</td>  <td>#dotlrn.percent_name#</td>	-->
+    </tr>
+	<if @found_asig@> <!--  SI HAY ASIGNACIONES  -->
+	<multiple name="asig">
+	<if @asig.rownum@ eq @sel_edit_asig@> <!-- SI LA ASIGNACION ACTUAL ES LA EDITADA -->
+		<tr class="list_c_sel">
+		<td class="list_c" width="4%" align="center">@asig.rownum@</td>  	
+		<FORM METHOD="post" name="fe" onSubmit = "return validaForm(this)">
+		<INPUT type="hidden" name="asig_id" value="@asig.id_xcent@">
+		<INPUT type="hidden" name="asig_num" value="@asig.rownum@">		
+		<td width="15%" class="list_c_sel">
+			
+			<SELECT name="asig_type"  onchange="if (this.options[this.selectedIndex].value==3) {fe.asig_percent.disabled = true;fe.asig_rvalor.disabled = true}	else {fe.asig_percent.disabled = false;fe.asig_rvalor.disabled = false}">
+			<if @asig.ref_basetype@ ne 3>
+			<multiple name="types">
+			<if @types.id_basetype@ ne 3>
+			<if @asig.ref_basetype@ eq @types.id_basetype@>
+				<OPTION SELECTED value="@types.id_basetype@">@types.name_basetype@</OPTION>
+			</if> <else>
+				<OPTION value="@types.id_basetype@">@types.name_basetype@</OPTION>
+			</else>
+			</if>
+			</multiple>
+			</if>
+			<else>
+				<OPTION SELECTED value="3">#cards.card_Text#</OPTION>
+			</else>
+			</SELECT>		
+			
+		</td>
+		<td width="45%" class="list_c_sel" ><INPUT type="text" size="50" name="asig_alias" value="@asig.name_xcent@"></td>
+		<if @sel_edit_type@ lt 3> <!--  SI TIPO BASE DISTINTO TEXTO  --->
+		<!--  ********* %  **********-->
+		  <td width="8%" align="center" class="list_c_sel">
+			<INPUT type="text" size="5" name="asig_percent" value="@asig.xcent@">
+			<!--onblur="validaNum(document.fe.asig_percent,document.fe.asig_percent.value, 100, 0 , 'porcentaje')"> --></TD>
+		<!--  ********* NP  **********-->			
+		  <td width="8%" align="center" class="list_c_sel">
+		  <if @asig.np@>
+			<INPUT type="checkbox" size="1" name="asig_np"  value="1" checked>
+			</if><else>
+			<INPUT type="checkbox" size="1" name="asig_np"  value="1"></else></TD>			
+		<!--  *********  <=  **********-->						
+		  <td width="8%" align="center" class="list_c_sel">
+			<INPUT type="text" size="5" name="asig_rvalor" value="@asig.rvalor@">
+<!--	onblur="validaNum(document.fe.asig_rvalor, document.fe.asig_rvalor.value, 10, 0 , 'restricci�n')">--></TD>
+		</if><else>  <!--  SI TIPO BASE TEXTO  --->
+		<!--  ********* %  **********-->
+		  <td width="8%" align="center" class="list_c_sel">
+			<INPUT type="text" size="5" name="asig_percent" value="@asig.xcent@" disabled="false"></TD>
+		<!--  ********* NP  **********-->			
+		  <td width="8%" align="center" class="list_c_sel">
+		  <if @asig.np@>
+			<INPUT type="checkbox" size="1" name="asig_np"  value="1" checked disabled="false">
+			</if><else>
+			<INPUT type="checkbox" size="1" name="asig_np"  value="1" disabled="false"></else></TD>
+		<!--  *********  <=  **********-->			
+		  <td width="8%" align="center" class="list_c_sel">
+			<INPUT type="text" size="5" name="asig_rvalor" value="@asig.rvalor@" disabled="false"></TD>
+		</else>			
+		<td width="6%" class="list_c" align="center"> 				
+		<INPUT type="hidden" name="mode_update" value="">		
+		<INPUT type="hidden" name="mode" value="">		
+		<INPUT type="image" name="submit" value="submit" size="10" src="icons/ok.gif" ALT="#cards.card_Accept#" title="#cards.card_Accept#" onclick="document.fe.mode_update.value='mode_update';">
+			
+		</td>  
+		<td width="6%" class="list" align="center">
+		<INPUT type="hidden" name="mode_cancel" value="">		
+		<INPUT type="image" name="submit" value="submit" size="10" title="#cards.card_Cancel#" src="icons/ko.gif" ALT="#cards.card_Cancel#"  onclick="document.fe.mode_cancel.value='mode_cancel';document.fe.mode.value=''">
+		</td> 		
+		</FORM>
+		</if> <else> <!-- SI LA ASIGNACION ACTUAL NO ES LA EDITADA -->
+	<if @asig.rownum@ odd>	
+		<tr class="list-odd_c" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#EAF2FF'">
+		</if><else>
+		<tr class="list-even_c" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#FFFFFF'">
+		</else>				
+	<td class="list_c" width="4%" align="center">@asig.rownum@</td>  				
+	<td width="15%" class="list_c"><% set name_type_note [format "%s" @asig.name_basetype@] %> <%= $name_type_note %></td>
+	<td width="45%" class="list_c"><% set alias_type_note [format "%s" @asig.name_xcent@] %> <%= $alias_type_note %></td>
+	<td width="8%" align="center" class="list_c" ><% set percent_type_note [format "%s" @asig.xcent@] %><%= $percent_type_note %></td>
+	<td width="8%" align="center" class="list_c" >
+	<if @asig.np@>
+		<INPUT type="checkbox" size="1" name="asig_np"  value="1" checked disabled="true">
+		</if><else>
+		<INPUT type="checkbox" size="1" name="asig_np"  value="1" disabled="true"></else></td>
+	
+	<td width="8%" align="center" class="list_c" >@asig.rvalor@</td>
+	<!-- MODE EDIT LINK **************************************************-->	
+	<FORM METHOD="post" name="fm" class="p">
+	<td width="6%"  height="auto" class="list_c" align="center"> <if @is_edit@ ne 1>
+		<INPUT type="hidden" name="asig_id" value="@asig.id_xcent@">
+		<INPUT type="hidden" name="asig_num" value="@asig.rownum@">
+		<INPUT type="hidden" name="mode" value="edit">
+		<INPUT type="image" name="submit" value="submit" border="0" alt="#cards.card_Edit#" title="#cards.card_Edit# #cards.card_Block#" src="icons/edit.gif" style="margin:0;padding:0" onsubmit="">		
+	</if></td></form>
+	<!-- MODE DELETE LINK ****************************************************-->
+	<FORM METHOD="post" name="fd" style="height:5px;vertical-align:middle">
+	<td width="6%" class="list" align="center"><if @is_edit@ ne 1>
+	<INPUT type="hidden" name="asig_id" value="@asig.id_xcent@">
+	<INPUT type="hidden" name="asig_num" value="@asig.rownum@">
+	<INPUT type="hidden" name="mode" value="delete">
+	<INPUT type="image" name="submit" value="submit" border="0" title="#cards.card_Delete# #cards.card_Block#" alt="#cards.card_Delete# #cards.card_Block#" src="icons/papelera.gif" onclick="return confirm('#cards.card_del_bloc1# @asig.name_xcent@ #cards.card_del_bloc2#')" style="margin:0;padding:0">		
+	</if></td></form>		
+	</else>
+	</tr>
+	</multiple>
+	</if>
+	<!-- Aqui va una fila para INSERTAR tipos a no ser que estemos en edici�n-->
+	<if @is_edit@ ne 1>
+	<FORM METHOD="post" name="fi" onSubmit = "return validaForm(this)">
+	<!-- <INPUT type="hidden" name="asig_id" value="update">  No estoy seguro de que haga falta -->
+	<tr style="background:#e0e0e0;">
+		<td width="4%" align="center" class="list_c"><B>*</B> <!--@ num_asig @    -->	</td>
+		<td width="15%" class="list_c">
+		<SELECT name="asig_type"  onchange="if (this.options[this.selectedIndex].value==3) {fi.asig_percent.disabled = true;fi.asig_rvalor.disabled = true}	else {fi.asig_percent.disabled = false;fi.asig_rvalor.disabled = false}">
+			<multiple name="types">
+			<OPTION value="@types.id_basetype@">@types.name_basetype@</OPTION>
+			</multiple></SELECT></td>
+		<td width="45%" class="list_c">
+			<INPUT type="text" size="55" name="asig_alias"></td>
+		<td width="8%" align="center" class="list_c">
+		<!-- valida_num(this.asig_percent,this.asig_percent.value,0,100)--->
+			<INPUT type="text" size="5" name="asig_percent" value="0">
+			<!--onblur="validaNum(document.fi.asig_percent, document.fi.asig_percent.value, 100, 0 , 'porcentaje')">--></td>
+		<td width="8%" align="center" class="list_c">
+			<INPUT type="checkbox" size="1" name="asig_np"  value="1"></td>		
+		
+		<td width="8%" align="center" class="list_c"><INPUT type="text" size="5" name="asig_rvalor" value="0">
+		<!--onblur="validaNum(document.fi.asig_rvalor, document.fi.asig_rvalor.value, 10, 0 , 'restricci�n')">--></td>	
+		<!--<INPUT type="submit" name="mode_add" value="A�adir">-->
+		<td width="6%" colspan="2" class="list_c"> <CENTER>
+		<INPUT type="hidden" name="mode_insert" value="mode_insert">
+	<input type="image" name="submit" value="submit" border="0" title="#dotlrn.New# #cards.card_Block#"  ALT="#dotlrn.New# #cards.card_Block#" src="icons/plus.gif" style="margin:0;padding:0" onclick="">		
+	</CENTER></td>  
+	</tr></form>
+	</if>
+	</table></TD>
+</TR>
+<TR><TD COLSPAN="3" ALIGN="RIGHT"><if @total@ gt @base@>
+<h4 style="color:#6186b0"><U>#cards.card_Total_assigned#</U>:<SPAN style="color:red">@total@</span> / @base@</h4>
+</if>
+<else>	
+<h4 style="color:#6186b0"><U>#cards.card_Total_assigned#</U>: @total@ / @base@</h4>
+</else></TD>
+</TR>
+<TR>
+	<TD COLSPAN="3">
+	<TABLE width="60%" class="list" cellpadding="5" cellspacing="1" border="0">
+	<TR  class="list-header">
+		<th class="list_c" COLSPAN="4" style="text-align:left"><B>#cards.card_Setup_options#</B></th>
+	</TR><FORM METHOD="post" name="fb">
+
+	<TR class="list-even_c">
+		<TD width="1%" class="list_c">&nbsp;</TD>
+		<TD width="25%" class="list_c">#cards.card_Allow_students_access#
+		<TD width="57%" class="list_c">
+			<if @alum_view@>
+			<INPUT type="checkbox" size="1" name="alum_view"  value="1" checked>
+			</if><else>
+			<INPUT type="checkbox" size="1" name="alum_view"  value="1">
+			</else></TD>
+		<TD  width="2%"  class="list_c" rowspan="1" valign="middle"><INPUT type="hidden" name="mode_base" value="mode_base">
+	<input type="image" name="submit" value="submit" src="icons/ok.gif" ALT="#cards.card_Allow_students_access#" TITLE="#cards.card_Allow_students_access#"></TD>
+	</TR>	
+	</TABLE>
+	</FORM>
+	</TD>
+</TR>
+</TABLE>
+</DIV>
+
+
+<BR><BR>
+<if @error@>
+<SCRIPT>
+alert("@msg_error@")
+</SCRIPT>
+</if>
\ No newline at end of file
Index: openacs-4/packages/cards/www/gest_eval.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/gest_eval.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/gest_eval.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,190 @@
+ad_page_contract {
+}  -query {  
+  {mode:optional ""}
+  {asig_id:integer,optional ""}
+  {asig_num:integer,optional ""}
+  {asig_type:integer,optional ""}
+  {asig_alias:optional ""}  
+  {asig_percent:integer,optional ""}  
+  {asig_sel:integer,optional ""}  
+  {asig_rvalor:float,optional 0}    
+  {asig_np:integer,optional 0}    
+  {note_base:integer,optional ""}
+  {np_type:integer,optional 0}
+  {alum_view:integer,optional 0}
+  {mode_insert:optional ""}
+  {mode_update:optional ""}
+  {mode_cancel:optional ""}
+  {mode_base:optional ""}  
+} -properties {
+}
+
+# Declaraci� de variables a emprar
+set error 0
+set msg_error ""
+set sel_edit_asig 0
+set sel_edit_type 0
+set is_edit 0
+set asig_act 'f'
+set l_bloques [list]
+set cc 0
+set num_asig 1
+# a�� no s� el que fa
+set dotlrn_url [dotlrn::get_url]
+
+# Comunitat a la que estem y usuari que som
+set community_id [dotlrn_community::get_community_id]
+set my_user_id [ad_conn user_id]
+# Si som administradors a la comunitat
+set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id]
+
+# A�� no s� per a que �s.
+set referer [ns_conn url]
+
+# Comprovar permisos: Si l'usuari no administrador conectat no es el de la fitxa no li deixem vore-la.
+if {!$admin_p} {
+                        ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"]         
+}
+
+# MODE BASE --> Aqu� van opciones de configuraci�n de la comunidad:
+# Alum View --> Permiso a los alumnos para poder ver sus notas
+# BASE NOTE --> Descartado: ASIGNACI�N EN % y NOTAS EN BASE 10
+# NP --> Pasado a tabla XCENT, por defecto a false
+if {$mode_base ne ""} {
+                db_dml update_base_note { *SQL* }               
+                set mode_base ""
+}
+
+# Comprobacion de modos
+#Creamos entrada en UV_CARD_BASE_NOTE si no existe para la comunidad
+set found_base [db_0or1row get_base "select * from uv_card_base_note where community_id = :community_id"]
+if {!$found_base} {
+        db_dml insert_base_note { *SQL* }
+        set base 100
+        set np_type 0
+        set alum_view 0
+} else {
+        set base $base_note
+        set np_type 0
+        set alum_view $alum_view
+}
+
+##########     MODO  CANCELAR --> No hace nada, redirecci�n     ##########
+if {$mode_cancel ne ""} {
+        set mode_update ""
+        ad_returnredirect "./gest_eval"
+        }
+
+##########     MODO  INSERTAR                                                  ##########
+if {$mode_insert ne ""} {
+        # Comprobaci�n nombre bloque ya existe
+        set repe [db_0or1row nom_bloc { *SQL* }]
+        # Comprobaci�n nombre bloque no nulo
+        if {($asig_percent > 100 ) || ($asig_percent < 0) || ($asig_percent eq "") } {  
+                set error 1
+                set msg_error "Porcentaje no valido."
+                set asig_percent 0
+        }
+        if {($asig_alias ne "") && ($repe ne 1)} {              
+                # Comprobaci�n tipo b�sico
+                if {$asig_type eq 2} {
+                        set asig_act 1
+                } else {
+                        if {$asig_type eq 3} {
+                                set asig_act 0
+                                set asig_percent 0
+                        } else {
+                                set asig_act 0
+                        }
+                }
+                if {$asig_rvalor ne ""} {
+                        db_dml insert_xcent { *SQL* }
+                
+                        if {$asig_type eq 3} {
+                        db_0or1row num_xcent { *SQL* }
+                        
+                        db_dml insert_subtype { *SQL* }               
+                        }               
+                set mode_insert ""
+                ad_returnredirect "./gest_eval"
+                } else {
+                        set error 1
+                        set msg_error "Valor restricci�n no v�lido"
+                }               
+        }       else {
+                        set error 1
+                        set msg_error "Nombre de bloque ya existe o es nulo"
+                }
+        } 
+##########     MODO  ACTUALIZAR                                            ##########
+if {$mode_update ne ""} {
+        if {$asig_alias ne ""} {                
+                if {$asig_type eq 2} {
+                        set asig_act 1
+                } else {
+                        if {$asig_type eq 3} {
+                                set asig_act 0
+                                set asig_percent 0
+                        } else {
+                                set asig_act 0
+                        }
+                }               
+                if {$asig_rvalor ne ""} {
+                db_dml update_xcent { *SQL* }               
+                set mode_update ""
+                ad_returnredirect "./gest_eval"
+                } else {
+                        set error 1
+                        set msg_error "Valor restricci�n no v�lido"             
+                }
+        }       else {
+                        set error 1
+                        set msg_error "Debes introducir un nombre de alias"
+                }
+        } 
+        
+##########     MODO  BORRAR --> Borrado en cascada            ########## [OK]
+if {$mode eq "delete"} {
+        set l_del_notes [db_list del_notes { *SQL* }]    
+        foreach del_i $l_del_notes {
+        # Borramos anotaciones de los alumnos de ese tipo base
+                db_dml delete_card_note { *SQL* }               
+        }
+        # Borramos las anotaciones de la comunidad de ese tipo base
+                db_dml delete_subtype  { *SQL* }               
+        # Borramos el bloque b�sico
+                db_dml delete_xcent  { *SQL* }               
+        }               
+        
+# SELECCI� DELS TIPUS BASE Y BLOCS DE LA COMUNITAT --> Caldr�  reduir el *
+db_multirow types types_sql { *SQL* } 
+db_multirow blocs blocs_sql { *SQL* } 
+db_multirow asig asig_sql { *SQL* } 
+
+        
+# Fem comprovacions per vore si n'hi han assignacions a la communitat i les seleccionem si cal
+# found_asig ens controla si n'hi han files o no, next_asig es la seg�ent
+set list_asig [db_list asig_list { *SQL* }]
+
+# set num_asig [llength $list_asig]
+
+if {$num_asig ne 0} {
+    set found_asig 1
+} else {
+        set found_asig 0
+}
+
+
+
+if {$mode eq "edit"} {
+                set sel_edit_asig $asig_num
+                set is_edit 1
+                db_1row t_sel { *SQL* }
+                set sel_edit_type $ref_basetype
+        } 
+
+# Obtenemos el porcentaje asignado 
+db_0or1row total_xc "select sum(uv_card_xcent_note.xcent) as total from uv_card_xcent_note where uv_card_xcent_note.ref_community_id = :community_id"
+if {$total eq ""} {
+        set total 0
+}
Index: openacs-4/packages/cards/www/gest_eval.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/gest_eval.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/gest_eval.xql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,147 @@
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+	
+	<fullquery name="update_base_note">
+        <querytext>
+			update uv_card_base_note
+			set base_note= 100,  alum_view= :alum_view
+			where community_id= :community_id
+	    </querytext>
+    </fullquery>
+	
+                
+                        	
+	
+	<fullquery name="insert_base_note">
+        <querytext>
+		    insert into uv_card_base_note
+				(community_id, base_note)
+            values
+                (:community_id, 100)
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="nom_bloc">
+        <querytext>
+			select name_xcent 
+			from uv_card_xcent_note 
+			where ref_community_id = :community_id and name_xcent = :asig_alias
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="insert_xcent">
+        <querytext>
+			insert into uv_card_xcent_note
+				(ref_community_id, ref_basetype, name_xcent, xcent, allow_act, rvalor,np)
+            values
+                (:community_id, :asig_type, :asig_alias, :asig_percent, :asig_act, :asig_rvalor, :asig_np)      
+	    </querytext>
+    </fullquery>
+
+	<fullquery name="num_xcent">
+        <querytext>
+			select id_xcent from uv_card_xcent_note 
+			where ref_community_id = :community_id 
+			and name_xcent = :asig_alias 
+			and ref_basetype = :asig_type
+	    </querytext>
+    </fullquery>
+	                
+	<fullquery name="insert_subtype">
+        <querytext>
+			insert into uv_card_subtype_note
+				(ref_community_id, name_subtype, ref_xcent)
+            values
+                (:community_id, :asig_alias, :id_xcent) 
+	    </querytext>
+    </fullquery>	
+	
+	
+		<fullquery name="update_xcent">
+        <querytext>
+			update uv_card_xcent_note
+            set ref_basetype= :asig_type, xcent= :asig_percent,
+				name_xcent= :asig_alias, allow_act= :asig_act,
+				rvalor= :asig_rvalor, np= :asig_np
+            where id_xcent= :asig_id
+	    </querytext>
+    </fullquery>	
+	
+	
+	<fullquery name="del_notes">
+        <querytext>
+			select id_subtype from uv_card_subtype_note
+			where ref_xcent = :asig_id
+	    </querytext>
+    </fullquery>	
+	
+
+
+	<fullquery name="delete_card_note">
+        <querytext>
+			delete from uv_card_notes where ref_subtype= :del_i
+	    </querytext>
+    </fullquery>	
+
+	<fullquery name="delete_subtype">
+        <querytext>
+			delete from uv_card_subtype_note where ref_xcent= :asig_id 
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="delete_xcent">
+        <querytext>
+			delete from uv_card_xcent_note where id_xcent= :asig_id
+	    </querytext>
+    </fullquery>		
+	
+	
+ 
+ 
+	
+	<fullquery name="types_sql">
+        <querytext>
+			select * from uv_card_basetype_note order by id_basetype
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="blocs_sql">
+        <querytext>
+			select * from uv_card_xcent_note where ref_community_id = :community_id order by id_xcent
+	    </querytext>
+    </fullquery>		
+	
+	<fullquery name="asig_sql">
+        <querytext>
+			select * from uv_card_xcent_note 
+				inner join uv_card_basetype_note on 
+					(uv_card_basetype_note.id_basetype = uv_card_xcent_note.ref_basetype) 
+			where uv_card_xcent_note.ref_community_id = :community_id 
+			order by uv_card_xcent_note.xcent desc
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="asig_list">
+        <querytext>
+			select id_xcent from uv_card_xcent_note 
+			where ref_community_id = :community_id
+	    </querytext>
+    </fullquery>	
+
+	<fullquery name="t_sel">
+        <querytext>
+		 select * from uv_card_xcent_note where id_xcent = :asig_id
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="total_xc">
+        <querytext>
+			select sum(uv_card_xcent_note.xcent) as total
+			from uv_card_xcent_note 
+			where uv_card_xcent_note.ref_community_id = :community_id
+	    </querytext>
+    </fullquery>		
+</queryset>
+
Index: openacs-4/packages/cards/www/gest_notes.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/gest_notes.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/gest_notes.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,147 @@
+<!-- <master>  -->
+<!-- #dotlrn.gestion_evaluacion_name# -->
+<link rel="stylesheet" href="cards.css" type="text/css">
+
+<TABLE width="60%">
+<TR>
+<TD style="font-weight:bold">
+<div class="volver">
+&nbsp;&nbsp;#cards.card_Subjet#: <%= [dotlrn_community::get_community_description -community_id $community_id] %>&nbsp;&nbsp;</div></TD>
+<TD ALIGN="RIGHT">
+<div class="volver">
+<A HREF="cards" class="t" style="color:#ffffff;font-weight:bold" >&nbsp;&nbsp;#cards.card_Back#&nbsp;&nbsp;</A></div></TD>
+</TR>
+</TABLE>
+
+<!--  ****************  NAVBAR - Selecci�n datos a mostrar  *************** -->
+<TABLE cellspacing="1" cellpadding="3" class="list">
+<TR><h4 style="color:#6186b0">&nbsp;#cards.card_Note_list#</h4>	
+	<if @nav_sel@ eq "">
+	<TD class="list-button-bar"><a name="notes" class="button1">#cards.card_Notes#</a></TD>
+	</if><else><TD  class="list-button-bar">
+	<a href="gest_notes" class="button">#cards.card_Notes#</a></TD></else>
+	
+	<multiple name="blocs_eval">
+	<if @blocs_eval.xcent@ gt 0>
+		<if @nav_sel@ eq @blocs_eval.id_xcent@>
+			<TD class="list-button-bar"><a name="@blocs_eval.name_xcent@" class="button1">@blocs_eval.name_xcent@</a></TD>
+		</if><else>
+			<TD  class="list-button-bar">
+			<a href="gest_notes?nav_sel=@blocs_eval.id_xcent@" class="button">@blocs_eval.name_xcent@</a></TD>
+		</else>
+	</if>		
+	</multiple>
+	</TR>
+</TABLE>
+
+<table width="60%" cellpadding="5" cellspacing="0" border="0">
+<TR> 
+	<TD COLSPAN="2">
+	<table  class="list" width="100%" cellpadding="3" cellspacing="1" border="0">
+    <tr class="list-header">
+		<th class="list_c" ><B>&nbsp;</B></td>
+		<th class="list_c" ><B>#cards.card_Block#</B></td>
+		<th class="list_c" COLSPAN="2"><B>#cards.card_Note_name#<B></td>
+		<th class="list_c" >&nbsp;</td>
+		<th class="list" >&nbsp;</td>
+		<!-- <td>#dotlrn.id_type_note_name#</td>  <td>#dotlrn.name_note_name#</td>  <td>#dotlrn.percent_name#</td>	-->
+    </tr>
+	<if @found_asig@>	
+	<multiple name="asig">
+	<if @nav_sel@ eq @asig.id_xcent@ or @nav_sel@ eq "">
+	<if @asig.rownum@ eq @sel_edit_asig@>		
+	<tr class="list_c_sel">
+		<td width="5%"  class="list_c" style="text-align:center">&nbsp;</td>  
+		<FORM METHOD="post" name="fe">
+		<INPUT type="hidden" name="asig_id" value="@asig.id_subtype@">
+		<INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+		<td width="23%" class="list_c_sel">
+			<SELECT name="asig_type"  onchange="if (this.options[this.selectedIndex].value>5) {fe.asig_percent.disabled = true;}	else {fe.asig_percent.disabled = false;}">
+			<multiple name="types">
+			<if @asig.ref_xcent@ eq @types.id_xcent@>
+				<OPTION SELECTED value="@types.id_xcent@">@types.name_xcent@</OPTION>
+			</if> <else>
+				<OPTION value="@types.id_xcent@">@types.name_xcent@</OPTION>
+			</else>
+			</multiple></SELECT>				
+		</td>
+		<td  colspan="2" width="52%" class="list_c_sel" >
+		<INPUT type="text" size="45" name="asig_alias" value="@asig.name_subtype@"></td>
+		<td width="2%" class="list_c" >
+		<INPUT type="hidden" name="mode_update" value="">
+		<INPUT type="image" name="submit" value="submit" size="10" src="icons/ok.gif" ALT="#cards.card_Accept#" title="#cards.card_Accept#" onclick="document.fe.mode_update.value='mode_update'">
+		</td>  
+		<td width="2%" class="list">		
+	<INPUT type="hidden" name="mode_cancel" value="">
+	<INPUT type="image" name="submit" value="submit" size="10" src="icons/ko.gif" ALT="#cards.card_Cancel#"
+	TITLE="#cards.card_Cancel#"  onclick="document.fe.mode_cancel.value='mode_cancel'">
+		</td> 		
+		</FORM>
+		</if> <else>
+		<if @asig.rownum@ odd>
+		<tr class="list-odd_c" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#EAF2FF'">
+		</if><else>
+		<tr class="list-even_c" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#FFFFFF'">
+		</else>	
+		<!-- asig.rownum -->
+	<td width="5%"  class="list_c" style="text-align:center">&nbsp;</td>  			
+	<td width="23%" class="list_c"><% set name_type_note [format "%s" @asig.name_xcent@] %> <%= $name_type_note %></td>
+	<td COLSPAN="2"  class="list_c" width="52%">
+	<A HREF="eval_note?note_sel=@asig.id_subtype@">
+	<% set alias_type_note [format "%s" @asig.name_subtype@] %> <%= $alias_type_note %>
+	</A>
+	</td>
+	<FORM METHOD="post" name="fm">
+	<td width="2%" class="list_c"> <if @is_edit@ ne 1>
+	<!-- MODE EDIT ****************************************************-->
+		<INPUT type="hidden" name="asig_id" value="@asig.id_subtype@">
+		<INPUT type="hidden" name="asig_num" value="@asig.rownum@">
+		<INPUT type="hidden" name="nav_sel" value="@nav_sel@">		
+		<INPUT type="hidden" name="mode" value="edit">
+		<if @asig.ref_basetype@ ne 3>
+		<INPUT type="image" name="submit" value="submit" size="10" src="icons/edit.gif" ALT="#cards.card_Edit# #cards.card_Note#" TITLE="#cards.card_Edit# #cards.card_Note#">	
+		</if>
+		</if></td>  </form><FORM METHOD="post" name="fd">
+	<td width="2%" class="list" ><if @is_edit@ ne 1>
+	<!-- MODE DELETE ****************************************************-->
+	<INPUT type="hidden" name="asig_id" value="@asig.id_subtype@">
+	<INPUT type="hidden" name="nav_sel" value="@nav_sel@">	
+	<INPUT type="hidden" name="mode" value="delete">
+	<if @asig.ref_basetype@ ne 3>
+	<INPUT type="image" name="submit" value="submit" size="10" src="icons/papelera.gif" ALT="#cards.card_Delete# #cards.card_Note#" title="#cards.card_Delete# #cards.card_Note#" onclick="return confirm('#cards.card_del_note1# @asig.name_subtype@ #cards.card_del_note2#')">
+	</if>
+	</if></td></form>	
+	</else>
+	</tr>	
+	</if>
+	</multiple>
+	</if>
+	<!-- Aqui va una fila para insertar tipos a no ser que estemos en edici�n-->
+	<if @is_edit@ ne 1>
+	<FORM METHOD="post" name="fi">
+	<!-- <INPUT type="hidden" name="asig_id" value="update">  No estoy seguro de que haga falta -->
+	<tr style="background:#e0e0e0;">
+		<td width="5%" class="list_c" style="text-align:center"><B>*</B> <!--@ num_asig @    -->	</td>
+		<td width="23%" class="list_c" >
+		<if @nav_sel@ eq ""> 
+		<SELECT name="asig_type">
+			<multiple name="types">
+			<OPTION value="@types.id_xcent@">@types.name_xcent@</OPTION>
+			</multiple></SELECT></td>
+		</if><else>
+			<INPUT type="text" size="25" name="asig_type_name" value="@tipo@" disabled>
+			<INPUT type="hidden" size="25" name="asig_type" value="@nav_sel@">
+			
+			</td>
+		</else>								
+		<td colspan="2" width="55%" class="list_c"><INPUT type="text" size="45" name="asig_alias"></td>
+		<td width="4%" colspan="2" class="list_c"> <CENTER>
+		<INPUT type="hidden" name="mode_insert" value="mode_insert">		
+		<INPUT type="hidden" name="nav_sel" value="@nav_sel@">		
+		<INPUT type="image" name="submit" value="submit" size="10" src="icons/plus.gif" ALT="#cards.card_Add_note_asig#" TITLE="#cards.card_Add_note_asig#"></CENTER></td>  
+	</tr>
+	</form>
+	</if></table></TD>
+</TR>
+</TABLE><BR><BR>
+<if @error@><SCRIPT>alert("@msg_error@")</SCRIPT></if>
\ No newline at end of file
Index: openacs-4/packages/cards/www/gest_notes.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/gest_notes.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/gest_notes.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,156 @@
+ad_page_contract {
+}  -query {  
+  {mode:optional ""}
+  {asig_id:integer,optional ""}
+  {asig_num:integer,optional ""}
+  {asig_type:integer,optional ""}
+  {asig_alias:optional ""}  
+  {asig_percent:integer,optional ""}  
+  {asig_sel:integer,optional ""}
+  {nav_sel:optional ""}  
+  {mode_insert:optional ""}
+  {mode_update:optional ""}
+  {mode_cancel:optional ""}
+  {mode_base:optional ""}  
+} -properties {
+}
+set tipo 0
+set error 0
+set msg_error ""
+set sel_edit_asig 0
+set sel_edit_type 0
+set is_edit 0
+# a�� no s� el que fa
+set dotlrn_url [dotlrn::get_url]
+
+# Declaraci� de variables a emprar
+# Comunitat a la que estem y usuari que som
+set community_id [dotlrn_community::get_community_id]
+set my_user_id [ad_conn user_id]
+# Si som administradors a la comunitat
+set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id]
+
+# A�� no s� per a que �s.
+set referer [ns_conn url]
+
+# Comprovar permisos: Si l'usuari no administrador conectat no es el de la fitxa no li deixem vore-la.
+#if {!$admin_p} { set link_type 1} else { set link_type 0}
+# Si no som administradors res de res.
+if {!$admin_p} {
+			ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] 	
+}
+
+db_0or1row tipo { *SQL* }
+
+
+# Comprobacion de modos
+if {$mode_cancel ne ""} {
+	set mode_update ""
+	ad_returnredirect "./gest_notes"
+	}
+
+if {$mode_insert ne ""} {
+	# Comprobamos nombre no repetido
+	set alias_repe [db_0or1row alias_sql { *SQL* }]
+	
+	
+	
+	if {$asig_alias ne "" && $alias_repe ne 1} {
+
+# Obtenemos lista de los alumnos de esa comunidad
+	set l_alum [db_list list_alum { *SQL* } ]
+	set l_alum_size [llength $l_alum]		
+	# Creaci�n de las CARDS que no existan
+	for {set i 0} { $i < $l_alum_size} {incr i 1} { 
+		set alum_id [lindex $l_alum $i]
+		set found_card [db_0or1row select_found_card { *SQL* }]
+		if {!$found_card} {
+			db_dml insert_new_card { *SQL* }  
+			
+		# A�� TENIM QUE AFEGIR LES ANOTACIONS si n'hi han a la communitat
+		#select * from uv_card_subtype_note where ref_community_id = 1157056;
+		}
+		
+	}
+		
+	# Creaci�n subtipo
+	db_dml insert_subtype { *SQL* }
+		
+	# Obtencion "id subtipo"
+	set tipo_act [lindex [db_list get_subtype_id { *SQL* } ] 0]
+	
+	# Creaci�n anotaciones de ese tipo para todos los alumnos
+	for {set j 0} { $j < [llength $l_alum]} {incr j 1} { 
+		set alum_id [lindex $l_alum $j]
+		set card_id [db_list alum_idcard { *SQL*}]	
+		db_dml insert_note { *SQL* }  		
+	}		
+		set mode_insert ""
+		ad_returnredirect "./gest_notes?nav_sel=$nav_sel"
+
+	}	else {
+			set error 1
+			set msg_error "Nombre de anotaci�n no valido o ya existe"
+	}
+}
+
+if {$mode_update ne ""} {
+
+	# Comprobamos nombre no repetido
+	set alias_repe [db_0or1row alias_sql { *SQL* }]
+	
+	#alias_sql "select name_subtype from uv_card_subtype_note where name_subtype = :asig_alias and id_subtype <> :asig_id and ref_community_id = :community_id and ref_xcent = :asig_type"
+
+	if {$asig_alias ne "" && $alias_repe ne 1} {
+
+		db_dml update_subtype { *SQL* }		
+		set mode_update ""
+		ad_returnredirect "./gest_notes?nav_sel=$nav_sel"
+
+	}	else {
+			set error 1
+			set msg_error "Nombre de anotaci�n no valido o ya existe"
+	}
+		
+	}	
+	
+if {$mode eq "delete"} {
+		# Borramos la anotaci�n de todos los alumnos 
+		db_dml delete_note { *SQL* }		
+		# Borramos la anotaci�n de la comunidad
+		db_dml delete_subtype { *SQL* }
+	}		
+	
+# Fem comprovacions per vore si n'hi han assignacions a la communitat i les seleccionem si cal
+# found_asig ens controla si n'hi han files o no, next_asig es la seg�ent
+set list_asig [db_list asig_list { *SQL* }]
+
+set num_asig [llength $list_asig]
+if {$num_asig ne 0} {
+    set found_asig 1
+	db_multirow asig asig_sql { *SQL* }
+# and id_basetype <> 3 
+	set next_asig [expr $num_asig + 1]
+} else {
+	set found_asig 0
+	set next_asig "*"
+}
+
+set is_xcent [lindex [db_list num_xcent { *SQL* }] 0]
+if {$is_xcent eq 0}  {
+	set error 1
+	set msg_error "Para crear anotaciones debes crear antes los bloques b�sicos"
+	ad_returnredirect "./cards"
+	
+}
+# Seleccionem la llista de tipus base
+db_multirow types types_sql { *SQL* }
+
+
+# Obtenci� dels blocs d'avaluaci� de la comunitat
+db_multirow blocs_eval blocs_eval_sql { *SQL* }
+
+if {$mode eq "edit"} {
+		set sel_edit_asig $asig_num
+		set is_edit 1
+	} 
Index: openacs-4/packages/cards/www/gest_notes.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/gest_notes.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/gest_notes.xql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,140 @@
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+	
+ 
+	
+	<fullquery name="tipo">
+        <querytext>
+		select name_xcent as tipo from uv_card_xcent_note where id_xcent = :nav_sel
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="alias_sql">
+        <querytext>
+		select name_subtype from uv_card_subtype_note 
+		where name_subtype = :asig_alias 
+			and ref_community_id = :community_id 
+			and ref_xcent = :asig_type
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="list_alum">
+        <querytext>
+			select acs_users_all.user_id 
+			from acs_users_all, dotlrn_member_rels_approved 
+			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')
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="select_found_card">
+        <querytext>
+		 select * from uv_card 
+		 where ref_user_id= :alum_id and ref_community_id= :community_id
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="insert_new_card">
+        <querytext>
+			insert into uv_card	(ref_community_id, ref_user_id)
+			values (:community_id, :alum_id)
+	    </querytext>
+    </fullquery>
+	
+
+	
+	<fullquery name="insert_subtype">
+        <querytext>
+			insert into uv_card_subtype_note
+			(ref_community_id, ref_xcent, name_subtype)
+			values
+			(:community_id, :asig_type, :asig_alias)
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="get_subtype_id">
+        <querytext>
+		 select max(id_subtype) from uv_card_subtype_note 
+		 where name_subtype = :asig_alias and ref_community_id = :community_id
+	    </querytext>
+    </fullquery>	
+		
+	<fullquery name="alum_idcard">
+        <querytext>
+			select id_card from uv_card 
+			where ref_user_id = :alum_id and ref_community_id = :community_id
+	    </querytext>
+    </fullquery>	
+	
+	
+	<fullquery name="insert_note">
+        <querytext>
+			insert into uv_card_notes (ref_id_card,ref_subtype,value_n,r_community_id)
+			values (:card_id, :tipo_act, 0.00, :community_id)
+	    </querytext>
+    </fullquery>	
+	
+	
+	<fullquery name="update_subtype">
+        <querytext>
+			update uv_card_subtype_note
+			set ref_xcent= :asig_type, name_subtype= :asig_alias
+			where id_subtype= :asig_id
+	    </querytext>
+    </fullquery>	
+	
+			
+	<fullquery name="delete_note">
+        <querytext>
+			delete from uv_card_notes where ref_subtype= :asig_id
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="delete_subtype">
+        <querytext>
+			delete from uv_card_subtype_note where id_subtype= :asig_id		
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="asig_list">
+        <querytext>
+			select id_xcent from uv_card_xcent_note where ref_community_id = :community_id
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="asig_sql">
+        <querytext>
+			select * from uv_card_subtype_note 
+				inner join (uv_card_xcent_note 
+					inner join uv_card_basetype_note on ref_basetype = id_basetype) 
+				on ref_xcent = id_xcent 
+			where uv_card_subtype_note.ref_community_id = :community_id 
+			order by xcent desc, name_subtype asc
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="num_xcent">
+        <querytext>
+			select count (*) from uv_card_xcent_note where ref_community_id = :community_id
+	    </querytext>
+    </fullquery>	
+
+
+	<fullquery name="types_sql">
+        <querytext>
+			select * from uv_card_xcent_note 
+			where ref_community_id = :community_id and ref_basetype <> 3 order by id_xcent
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="blocs_eval_sql">
+        <querytext>
+			select * from uv_card_xcent_note 
+			where ref_community_id = :community_id order by xcent desc
+	    </querytext>
+    </fullquery>	
+
+</queryset>
Index: openacs-4/packages/cards/www/list_notes.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/list_notes.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/list_notes.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,88 @@
+<master>
+<link rel="stylesheet" href="cards.css" type="text/css">
+<TABLE width="100%">
+<TR>
+<TD style="font-weight:bold">
+<div class="volver">
+&nbsp;&nbsp;<%= [dotlrn_community::get_community_description -community_id $community_id] %>&nbsp;&nbsp;</div></TD>
+<TD ALIGN="RIGHT">
+<div class="volver">
+<A HREF="cards" class="t" style="color:#ffffff;font-weight:bold">&nbsp;&nbsp;#cards.card_Back#&nbsp;&nbsp;</A></div></TD>
+</TR>
+<!--<TR>
+<TD><%= [string range [format "%f2" [expr 5 + 1]] 0 3] %>
+</TD>
+<TD><%= [format "%f2" 5.3333333] %>
+</TD>
+</TR>-->
+</TABLE>
+<table width="100%" cellpadding="5" cellspacing="0" border="0">
+<TR> 
+	<TD COLSPAN="2"><h4 style="color:#6186b0">#cards.card_Grades_list#</h4>
+	<table width="100%" class="list" cellpadding="5" cellspacing="0">
+    <tr class="list-header">
+		<th class="list_c" class="">&nbsp;</td>
+		<th class="list_c" width="20%"><B>#dotlrn.student_role_pretty_name#</B></td>
+		<multiple name="bloques">
+		<if @bloques.xcent@ gt 0>
+		<th class="list_c" width="10%" align="center"><B>@bloques.name_xcent@ (@bloques.xcent@%)
+			<if @bloques.rvalor@ gt 0><BR><span style="color:red">[>=@bloques.rvalor@]</SPAN></if></B></td>
+		</if>
+		</multiple>
+		<th class="list_c" ><B>#cards.card_Final_grade#</B></td>
+		<!-- <td>#dotlrn.id_type_note_name#</td>  <td>#dotlrn.name_note_name#</td>  <td>#dotlrn.percent_name#</td>	-->
+    </tr>	
+	<multiple name="alum">
+	<if @alum.rownum@ odd><tr class="list-odd"></if><else><tr class="list-even"></else> 
+		<td class="list_c" width="1%">	@alum.rownum@</td>
+		<td class="list_c" width="20%"><%= [set fullname [format "%s, %s" @alum.last_name@ @alum.first_names@]] %></td>  
+		<multiple name="bloques">
+			<if @bloques.xcent@ gt 0>
+			<td class="list_c" width="10%">
+			<multiple name="notes">
+			<if @notes.ref_id_card@ eq @alum.id_card@>
+				<If @notes.ref_xcent@ eq @bloques.id_xcent@>
+				<TABLE width="100%">
+				<TR>
+				<TD width="50%" align="left"><B><%= [string range [format "%f2" [expr @notes.mitja_p@*100.00/@notes.xcent@]] 0 3] %></B></TD>
+				<TD width="50%" align="right">(<%= [string range [format "%f2" @notes.mitja_p@] 0 3] %>)</TD>
+				</TABLE>
+				</TD>
+				</if>
+			</if>
+			</multiple>
+			</if>
+		</multiple>		
+		<td width="5%" class="list_c" >
+			<list name="l_notas">
+				<if @l_notas:rownum@ eq @alum.rownum@>
+					<if @l_notas:item@ eq NP><span style="color:#000000">NP</span></td>
+					</span></td>
+					</if>
+					<else>
+						<if @l_notas:item@ ge 5><span style="color:green">
+							<%= [string range [format "%f2" @l_notas:item@] 0 3] %>
+						</if>
+						<else>
+						<span style="color:red">
+							<if @l_notas:item@ eq -1>
+							(*)
+							</if>
+							<else>
+							<%= [string range [format "%f2" @l_notas:item@] 0 3] %>
+							</else>
+						</span></td>
+						</else>
+					</else>
+				</if>
+		</list>
+	</tr>
+	</multiple>
+	</table>
+	</TD>
+</TR>
+<TR>
+<TD colspan="3"> <u>#cards.card_Passed#</u>: <B>@aprobados@</B>&nbsp;&nbsp;&nbsp;&nbsp;<u>#cards.card_Not_passed#</u>: <B>@suspensos@</B>&nbsp;&nbsp;&nbsp;&nbsp;<u>#cards.card_Not_done#</u>: <B>@nnp@</B></TD>
+</TR>
+</TABLE><BR><BR>
+<if @error@><SCRIPT>alert("@msg_error@")</SCRIPT></if>
\ No newline at end of file
Index: openacs-4/packages/cards/www/list_notes.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/list_notes.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/list_notes.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,113 @@
+ad_page_contract {
+}  -query {  
+  {mode:optional ""}  
+  {mode_insert:optional ""}
+  {mode_update:optional ""}
+  {mode_cancel:optional ""}
+  {mode_base:optional ""}  
+} -properties {
+}
+#ns_log Notice "0000"
+set tcl_precision 5
+set error 0
+set sel_edit_note 0
+set is_edit 0
+set msg_error ""
+# a�� no s� el que fa
+set dotlrn_url [dotlrn::get_url]
+# Comunitat a la que estem y usuari que som  # Si som administradors a la comunitat
+set community_id [dotlrn_community::get_community_id]
+set my_user_id [ad_conn user_id]
+set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id]
+# A�� no s� per a que �s.
+set referer [ns_conn url]
+# L'hora del sistema
+set datetime [clock_to_ansi [clock seconds]]
+# Comprovar permisos: Si l'usuari no administrador conectat no es el de la fitxa no li deixem vore-la.
+#if {!$admin_p} { set link_type 1} else { set link_type 0}# Si no som administradors res de res.
+if {!$admin_p} {
+                        ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"]         
+}
+# Nota base de la asignatura
+#db_1row nbase "select base_note from uv_card_base_note where community_id = :community_id"
+#set bn $base_note
+set bn 100
+
+# PARA BORRAR SI FUNCIONA EL XQL
+# Buscar els alumnes de la comunitat (Apellidos, Nombre, User_id, Id_card)
+#db_multirow alum alum_sql "select acs_users_all.user_id, id_card, last_name, first_names from acs_users_all, dotlrn_member_rels_approved inner join uv_card on (ref_user_id = 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 uv_card.ref_community_id = community_id order by last_name, first_names asc"
+#Buscar els blocs d'avaluaci� de la comunitat
+#db_multirow bloques blocs_eval_sql "select id_xcent, xcent, name_xcent, rvalor from uv_card_xcent_note where ref_community_id = :community_id order by xcent desc, name_xcent asc"
+
+# NUEVA CONSULTA
+#db_multirow notes notes_eval_sql "select ref_id_card, ref_xcent, name_xcent, xcent, avg(value_n)*xcent*1.00/100.00 as mitja_p, rvalor, np from uv_card_notes n, uv_card_subtype_note sn, uv_card_xcent_note xn where sn.ref_xcent = xn.id_xcent and sn.ref_community_id = :community_id and xn.ref_community_id = :community_id and n.ref_subtype = sn.id_subtype and is_active = 'true' and xcent<>0 group by  ref_xcent,name_xcent,xcent,ref_id_card, rvalor,np order by ref_id_card asc, xcent desc, ref_xcent asc;"
+
+# Buscar els alumnes de la comunitat (Apellidos, Nombre, User_id, Id_card)
+db_multirow alum alum_sql {}
+#Buscar els blocs d'avaluaci� de la comunitat
+db_multirow bloques blocs_eval_sql {}
+# NUEVA CONSULTA
+db_multirow notes notes_eval_sql {}
+
+
+#CALCULO NOTAS Y ESTADISTICAS
+set aprobados 0
+set suspensos 0
+set nnp 0
+set restrict  0 
+
+#Obtenemos el numero de bloques con NP activo y lo guardamos en np_num
+#db_1row npn_sql "select count(np) as npn from uv_card_xcent_note where ref_community_id= :community_id and np<>'f'"
+db_1row npn_sql {}
+
+set np_num $npn
+# Listado de notas finales calculadas
+set l_notas [list]
+
+#ns_log Notice "11111"
+
+multirow foreach alum {
+        set restrict "NO"
+        set nota_media 0
+        set aux_m 0
+        set aux_r 0
+        set np_count 0
+        set r_txt "(*)" 
+                
+        # Recorremos todas las notas del usuario actual
+        multirow foreach notes {        
+                if {$ref_id_card eq $id_card} {
+                        set nota_media [expr $nota_media + $mitja_p]
+                        set rval [expr $rvalor * $xcent * 1.00  / 100]                                          
+                        # Control de restricci�n. Si se la salta activamos restrict
+                        if {($mitja_p < $rval) && ($mitja_p ne 0)} {
+                                set restrict "SI"
+                        }
+                        # Control de NP. Si esta activo y media es cero incrementamos 1 el contador de np's
+                        if {($np eq "t") && ($mitja_p eq 0)} {
+                                set np_count [expr $np_count + 1]
+                        }       
+                }
+        }
+        
+        # Control de NP, Restriccion y estadisticas
+        if {($np_count eq $np_num) && ($np_num ne 0)} {
+                lappend l_notas "NP"
+                set nnp [expr $nnp + 1]
+        } else {
+                if {$restrict eq "SI" && $nota_media > 5} {
+                        lappend l_notas -1
+                        set suspensos [expr $suspensos + 1]
+                } else {
+                        lappend l_notas $nota_media
+                        if {$nota_media >= 5} {
+                                set aprobados [expr $aprobados + 1]
+                        } else {
+                                set suspensos [expr $suspensos + 1]
+                        }
+
+                }       
+        }
+}
+#ns_log Notice "2222"
+
Index: openacs-4/packages/cards/www/list_notes.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/list_notes.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/list_notes.xql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+    
+	
+	<fullquery name="alum_sql">
+        <querytext>
+		select 	acs_users_all.user_id,
+				id_card, last_name,
+				first_names 
+		from 	acs_users_all,
+				dotlrn_member_rels_approved inner join uv_card on (ref_user_id = 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 uv_card.ref_community_id = community_id 
+		order	by last_name, first_names asc
+        </querytext>
+    </fullquery>
+
+	
+	<fullquery name="blocs_eval_sql">
+		<querytext>
+			select id_xcent, xcent, name_xcent, rvalor 
+			from uv_card_xcent_note 
+			where ref_community_id = :community_id 
+			order by xcent desc, name_xcent asc
+        </querytext>
+    </fullquery>
+	
+	
+	<fullquery name="notes_eval_sql">
+        <querytext>
+			select 	ref_id_card, ref_xcent, name_xcent, xcent,
+					avg(value_n)*xcent*1.00/100.00 as mitja_p,
+					rvalor, np 
+			from 	uv_card_notes n, uv_card_subtype_note sn, uv_card_xcent_note xn 
+			where 	sn.ref_xcent = xn.id_xcent and 
+					sn.ref_community_id = :community_id and 
+					xn.ref_community_id = :community_id and 
+					n.ref_subtype = sn.id_subtype and 
+					is_active = 'true' and xcent<>0 
+			group by  ref_xcent,name_xcent,xcent,ref_id_card, rvalor,np 
+			order by ref_id_card asc, xcent desc, ref_xcent asc;
+        </querytext>
+    </fullquery>
+	
+	
+	<fullquery name="npn_sql">
+        <querytext>
+			select count(np) as npn from uv_card_xcent_note where ref_community_id= :community_id and np<>'f'
+        </querytext>
+    </fullquery>
+	
+	
+
+	
+</queryset>
+
+
+
Index: openacs-4/packages/cards/www/notes.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/notes.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/notes.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,393 @@
+<!-- <master>  --><!-- #dotlrn.gestion_evaluacion_name# -->
+
+<!---->
+<link rel="stylesheet" href="cards.css" type="text/css">
+<TABLE width="100%" border="0">
+<TR>
+<TD style="font-weight:bold">
+<div class="volver">&nbsp;&nbsp;#cards.card_Subjet#:  
+&nbsp;&nbsp;<%= [dotlrn_community::get_community_description -community_id $community_id] %>&nbsp;&nbsp;</div></TD>
+<TD ALIGN="RIGHT">
+<div class="volver">
+<A HREF="cards" class="t" style="color:#ffffff;font-weight:bold">&nbsp;&nbsp;#cards.card_Back#&nbsp;&nbsp;</A></div></TD>
+</TR>
+<TR><TD colspan="2">&nbsp;</TD>
+</TR>
+<TR>
+        <TD width="85%"><SPAN style="color:#6186b0;font-weight:bold"><U>#dotlrn.student_role_pretty_name#</U>: @last_name@, @first_names@</SPAN></TD>
+        <TD     width="15%" align="center" style="border: 3px solid orange"><B>&nbsp;&nbsp;#cards.card_Average_grade#:&nbsp; 
+        <if @nota_media@ eq NP>
+                <span style="color:#000000">NP&nbsp;&nbsp;</span>
+        </if>
+        <else>
+                <if @final_note@ ge 5>
+                        <span style="color:green">      <%= [string range [format "%s" @nota_media@] 0 3] %>&nbsp;&nbsp;
+                </if>
+                <else>
+                        <span style="color:red">
+                                <if @final_note@ eq -1>
+                                        4*&nbsp;&nbsp;
+                                </if>
+                                <else>
+                                        <%= [string range [format "%s" @nota_media@] 0 3] %>&nbsp;&nbsp;
+                                </else>
+                        </span>
+                </else>
+        </else>
+        </TD>
+</TR>
+</TABLE>
+<!--  ****************  NAVBAR - Selecci�n datos a mostrar  *************** -->
+
+
+<TABLE cellspacing="1" cellpadding="3" class="list">
+<TR>
+<!-- Datos personales ***********************************************************************-->
+        <if @nav_sel@ eq "ficha"><TD class="list-button-bar"><a name="datos" class="button1">#cards.card_Personal_info#</TD>
+        </if><else><TD  class="list-button-bar">
+        <a href="notes?card_id=@card_id@&user_id=@user_id@&nav_sel=ficha" class="button">#cards.card_Personal_info#</a></TD></else>
+
+<!-- Bloques de texto ***********************************************************************-->        
+        <multiple name="blocs_text">
+                <if @nav_sel@ eq @blocs_text.id_xcent@>
+                        <TD class="list-button-bar"><a name="@blocs_text.name_xcent@" class="button1">@blocs_text.name_xcent@</a></TD>
+                </if><else>
+                        <TD  class="list-button-bar">
+                        <a href="notes?card_id=@card_id@&user_id=@user_id@&nav_sel=@blocs_text.id_xcent@&text_sel=1" class="button">@blocs_text.name_xcent@</a></TD>
+                </else>
+        </multiple>             
+        
+<!-- Notas Completas ***********************************************************************-->         
+        <if @nbs@ ne 0>
+        <if @nav_sel@ eq ""><TD class="list-button-bar"><a name="notes" class="button1">#cards.card_Grades#</TD>
+        </if><else><TD  class="list-button-bar">
+        <a href="notes?card_id=@card_id@&user_id=@user_id@" class="button">#cards.card_Grades#</a></TD></else>
+</if>
+<!-- Bloques de notas ***********************************************************************-->        
+        
+                <multiple name="blocs_eval">
+                <if @nav_sel@ eq @blocs_eval.id_xcent@>
+                        <TD class="list-button-bar"><a name="@blocs_eval.name_xcent@" class="button1">@blocs_eval.name_xcent@</a></TD>
+                </if><else>
+                        <TD  class="list-button-bar">
+                        <a href="notes?card_id=@card_id@&user_id=@user_id@&nav_sel=@blocs_eval.id_xcent@" class="button">@blocs_eval.name_xcent@</a></TD>
+                </else>
+        </multiple>
+        </TR>
+</TABLE>
+
+<table width="100%" cellpadding="5" cellspacing="0" border="0">
+<TR><TD colspan="2">
+<table width="100%" class="list" cellpadding="5" cellspacing="0">
+<!--  ****************  MOSTRAR - DATOS PERSONALES  *************** -->
+<if @nav_sel@ eq "ficha">
+  <TR class="list-even">
+    <TD width="10%" rowspan="2" class="list_c">
+      <if @existe_photo@ eq 1>
+        <CENTER><IMG @widthheight_param@ SRC="@subsite_url@shared/portrait-bits.tcl?@export_vars@" alt="@user_info.name@"></CENTER>
+      </if>
+      <else>
+        <CENTER><IMG @widthheight_param@ SRC="icons/nophoto.gif" alt="@user_info.name@"></CENTER>
+      </else>
+    </TD>
+    <TD colspan="2" class="list">
+      <B>@user_info.name@</B><BR>
+      <FONT COLOR=#0000FF>#dotlrn.Email#</FONT> @user_info.email@   <FONT COLOR=#0000FF>#acs-subsite.Home_page#:</FONT> @user_info.url@ <BR>
+      </TD>
+        <TR class="list-even">
+                <TD class="list">
+                <FONT COLOR=#0000FF>#dotlrn.address#:</FONT></U> @address@<BR>
+                <FONT COLOR=#0000FF>#dotlrn.phone1#:</FONT> @phone1@<BR>
+                <FONT COLOR=#0000FF>#dotlrn.phone2#:</FONT> @phone2@<BR>
+                </TD>
+                <TD class="list">
+                </TD>
+        
+  </TR>
+  <TR class="list-even">
+    <TD colspan="3" class="list"><B>#dotlrn.observations_from_student_to_teacher#:</B><BR>@comm_student@
+    </TD>
+  </TR>
+  <TR class="list-even">
+  <if @is_edit@ eq 2> <!--SI ESTAMOS EN EDICION 2 -->
+        <FORM METHOD="post" name="fe2">
+    <TD colspan="2" class="list_c">
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="card_id" value="@card_id@">
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                <B>#dotlrn.observations_from_teacher_to_student#:</B><BR>
+                <TEXTAREA INPUT type="text" rows="5" cols="60" name="comm_teacher">@comm_teacher@
+                </TEXTAREA>
+    </TD>
+        <TD width="10%" class="list_c" align="center">
+                <INPUT type="hidden" name="mode_update" value="">               
+                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ok.gif" ALT="#cards.card_Accept#" title="#cards.card_Accept#" onclick="document.fe2.mode_update.value='mode_update2'">
+                <INPUT type="hidden" name="mode_cancel" value="">               
+                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ko.gif" ALT="#cards.card_Cancel#" title="#cards.card_Cancel#"  onclick="document.fe2.mode_cancel.value='mode_cancel'">
+        </TD>
+        </FORM> 
+        </if>
+        <else> <!--SI  NO ESTAMOS en edicion -->
+        <FORM METHOD="post" name="fm1">
+        <TD colspan="2" class="list_c">
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="card_id" value="@id_card@">
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                <B>#dotlrn.observations_from_teacher_to_student#:</B><BR>@comm_teacher@
+        </TD>
+        <TD width="10%" class="list" align="center">
+                <INPUT type="hidden" name="mode" value="edit2">
+                <INPUT type="image" name="submit" value="submit" border="0" alt="#cards.card_Edit#" title="#cards.card_Edit#" src="icons/edit.gif" style="margin:0;padding:0"></TD>
+        </FORM> 
+        </else>
+        </TD>
+  </TR>   
+</TABLE>
+<BR>
+
+</if>
+<else>
+<!--  ****************  MOSTRAR -TUTORIAS  *************** -->
+<if @text_sel@ eq 1>
+
+<tr class="list-header">
+                <th colspan="5" class="list_h"><B>&nbsp;&nbsp;&nbsp;@bloc_sel@</B>
+</tr>
+
+
+        <tr class="list-odd_c" height="6" style="font-size:9px">
+        <th width="1%" class="list_c">  &nbsp;</th>     
+        <th width="10%" class="list_c">#cards.card_Date#</th>
+        <th width="AUTO" class="list_c">#cards.card_Comment#</th>       
+        <th width="7%" class="list_c" colspan="2">#cards.card_Action#</th>      
+        </tr>
+<multiple name="notes_text">
+        <if @is_edit@ ne 3> <!--SI NO editamos -->
+        <tr class="list-even" onmouseover="javascript:style.backgroundColor='#99ccff'" 
+                onmouseout="javascript:style.backgroundColor='#FFFFFF'">
+                <td width="1%" class="list_c">&nbsp;</td>
+                <td width="10%" class="list_c" style="font-size:9px">&nbsp;<%= [string range [format "%s" @notes_text.note_datetime@] 0 15] %></td>                     
+                <td  width="AUTO" class="list_c">&nbsp;@notes_text.value_s@</td>
+        <!-- MODE EDIT LINK ****** -->                          
+                <FORM METHOD="post" name="fmt">
+                <td width="4%" align="center" class="list">                                     
+                <INPUT type="hidden" name="card_id" value="@notes_text.ref_id_card@">
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="note_id" value="@notes_text.id_card_notes@">
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                <INPUT type="hidden" name="text_sel" value="@text_sel@">
+                <INPUT type="hidden" name="mode" value="edit3">
+                <INPUT type="image" name="submit" value="submit" border="0" alt="#cards.card_Edit# #cards.card_Comment#" title="#cards.card_Edit# #cards.card_Comment#" src="icons/edit.gif">   
+                </td>
+                </form>         
+                
+                <FORM METHOD="post" name="fmt">
+                <td width="3%" class="list_c" align="left">
+                <INPUT type="hidden" name="card_id" value="@notes_text.ref_id_card@">
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="note_id" value="@notes_text.id_card_notes@">
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                <INPUT type="hidden" name="text_sel" value="@text_sel@">
+                <INPUT type="hidden" name="mode" value="delete">
+                <INPUT type="image" name="submit" value="submit" border="0" alt="#cards.card_Delete# #cards.card_Comment#" title="#cards.card_Delete# #cards.card_Comment#" src="icons/papelera.gif">   
+                
+                </td>                   
+                </form>         
+        </if><else> <!-- SI EDITAMOS -->
+                <if @notes_text.id_card_notes@ ne @note_id@> <!--NO ES LA EDITADA -->
+                        <tr class="list-even">
+                        <td width="1%" class="list_c">&nbsp;</td>
+                        <td width="10%" class="list_c" style="font-size:9px">
+                        &nbsp;<%= [string range [format "%s" @notes_text.note_datetime@] 0 15] %></td>
+                        <td width="75%" class="list_c">&nbsp;@notes_text.value_s@</td>
+                        <td width="7%" align="right" class="list_c" colspan="2">&nbsp;</td>                             
+        
+                </if>
+                <else> <!-- ES LA EDITADA -->
+                        <tr class="list_c_sel">
+                        <td width="1%" class="list_c">&nbsp;</td>
+                        <td width="10%" class="list_c" style="font-size:9px">
+                        &nbsp;<%= [string range [format "%s" @notes_text.note_datetime@] 0 15] %></td>                                  
+                        <!-- FORMULARIO -->
+                        <FORM METHOD="post" name="fet">
+                        <INPUT type="hidden" name="card_id" value="@card_id@">
+                        <INPUT type="hidden" name="user_id" value="@user_id@">
+                        <INPUT type="hidden" name="note_id" value="@note_id@">
+                        <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                        <INPUT type="hidden" name="text_sel" value="@text_sel@">
+                        <td width="AUTO" class="list_c_sel">
+                        <INPUT type="text"  size="70" name="note_desc" value="@notes_text.value_s@"></td>
+                        <td width="7%" align="center" class="list_c" colspan="2">                       
+                                <INPUT type="hidden" name="mode_update" value="">               
+                                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ok.gif" 
+                                ALT="#cards.card_Accept#" title="#cards.card_Accept#" onclick="document.fet.mode_update.value='mode_update3'">
+                                <INPUT type="hidden" name="mode_cancel" value="">               
+                                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ko.gif" 
+                                ALT="#cards.card_Cancel#" title="#cards.card_Cancel#" onclick="document.fet.mode_cancel.value='mode_cancel'">
+                        </td>           
+                        </FORM>
+                        <!-- FIN FORMULARIO -->                 
+                </else> 
+        </else></TR>
+</multiple>
+        <if @is_edit@ ne 3>
+        <FORM METHOD="post" name="fit">
+                <INPUT type="hidden" name="card_id" value="@card_id@">
+                <INPUT type="hidden" name="user_id" value="@user_id@">
+                <INPUT type="hidden" name="note_id" value="@note_id@">
+                <INPUT type="hidden" name="text_sel" value="@text_sel@">
+        <!-- <INPUT type="hidden" name="asig_id" value="update">  No estoy seguro de que haga falta -->
+        <tr style="background:#e0e0e0;">
+                <td width="1%" class="list_c">&nbsp;</td>
+                <td width="10%" class="list_c" style="font-size:9px">
+                &nbsp;<%= [string range [format "%s" @datetime@] 0 15] %></td>
+                <td  width="AUTO" class="list_c">
+                <INPUT type="text" size="70" name="note_desc" value=""></td>
+                <td width="7%" align="right" class="list_c" colspan="2">
+                <CENTER>
+                <INPUT type="hidden" name="mode_insert" value="mode_insert">            
+                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">          
+                <INPUT type="image" name="submit" value="submit" size="10" src="icons/plus.gif"
+                ALT="#dotlrn.New# #cards.card_Comment#" title="#dotlrn.New# #cards.card_Comment#"></CENTER>             
+                </td>           
+        </tr>
+        </form>
+        </if>
+</if>
+<else>
+<!--  ****************  MOSTRAR - NOTAS ALUMNO *************** -->
+<if @blocs_eval:rowcount@ eq 0>
+#cards.card_No_notes#
+</if>
+<else>
+<multiple name="blocs_eval">
+        <if @nav_sel@ eq @blocs_eval.id_xcent@ or @nav_sel@ eq "">
+        <tr class="list-header">
+                <th colspan="4" class="list_h"><B>@blocs_eval.name_xcent@</B> (@blocs_eval.xcent@%)</th>
+                <th colspan="3" align="right" class="list_h">
+                        <multiple name="blocs_eval1">
+                        <if @blocs_eval1.ref_xcent@ eq @blocs_eval.id_xcent@>
+                                <B>#cards.card_Average_grade#: <%= [string range [format "%s" @blocs_eval1.mitja@] 0 3] %></B>
+                        </if>
+                        </multiple></th>
+        </tr>
+        
+        <tr class="list-odd_c" height="6" style="font-size:9px">
+        <th width="1%" class="list_c">  &nbsp;</th>
+        <th width="23%" class="list_c">#cards.card_Note#</th>
+        <th width="10%" class="list_c">#cards.card_Date#</th>
+        <th width="50%" class="list_c">#cards.card_Comment#</th>
+        <th width="6%" class="list_c">#cards.card_Grade#</th>
+        <th width="3%" class="list_c">#cards.card_Active#</th>                  
+        <th width="7%" class="list_c" colspan="2">#cards.card_Action#</th>      
+        </tr>
+        
+        <multiple name="notes">
+        <if @notes.ref_xcent@ eq @blocs_eval.id_xcent@>
+                        <if @is_edit@ ne 1> <!--SI NO editamos -->
+                <tr class="list-even" onmouseover="javascript:style.backgroundColor='#99ccff'" onmouseout="javascript:style.backgroundColor='#FFFFFF'">
+                        <td width="1%" class="list_c">&nbsp;</td>
+                        <td width="23%" class="list_c">@notes.name_subtype@</td>                        
+                        <td width="10%" class="list_c" style="font-size:9px">&nbsp;<%= [string range [format "%s" @notes.note_datetime@] 0 15] %></td>                  
+                        <td width="50%" class="list_c">&nbsp;@notes.value_s@</td>
+                        <td width="6%" class="list_c" align="right">@notes.value_n@</td>
+                        <td width="3%" class="list_c">
+                        <if @notes.is_active@>
+                        <INPUT type="checkbox" size="1" name="noteact" checked disabled>
+                        </if><else>
+                        <INPUT type="checkbox" size="1" name="noteact" disabled>
+                        </else>                         
+                        </td>                   
+                        
+                        <!-- MODE EDIT LINK **************************************************-->                               
+                        <FORM METHOD="post" name="fm">
+                        <td width="7%" align="center" class="list">                     
+                                <INPUT type="hidden" name="card_id" value="@notes.ref_id_card@">
+                                <INPUT type="hidden" name="user_id" value="@user_id@">
+                                <INPUT type="hidden" name="note_id" value="@notes.id_card_notes@">
+                                <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                                <INPUT type="hidden" name="mode" value="edit">
+                                <INPUT type="image" name="submit" value="submit" border="0" alt="#cards.card_Edit# #cards.card_Grade#" title="#cards.card_Edit# #cards.card_Grade#" src="icons/edit.gif">               
+                        </td>
+                        </form>                 
+                        </if>
+                        <else> <!--SI editamos -->
+                                <if @notes.id_card_notes@ ne @note_id@> <!--NO ES LA EDITADA -->
+                                <tr class="list-even">
+                                <td width="1%" class="list_c">&nbsp;</td>
+                                <td width="23%" class="list_c">@notes.name_subtype@</td>
+                                <td width="10%" class="list_c" style="font-size:9px">&nbsp;<%= [string range [format "%s" @notes.note_datetime@] 0 15] %></td>
+                                <td width="50%" class="list_c">&nbsp;@notes.value_s@</td>
+                                <td width="6%" class="list_c" align="right">@notes.value_n@</td>
+                                <td width="3%" class="list_c">
+                        <if @notes.is_active@>
+                        <INPUT type="checkbox" size="1" name="noteact" checked disabled>
+                        </if><else>
+                        <INPUT type="checkbox" size="1" name="noteact" disabled>
+                        </else>                                 
+                                        </td>                   
+                                        <td width="7%" align="right" class="list_c">&nbsp;</td>                         
+                                </if>
+                                <else> <!-- ES LA EDITADA -->
+                                <tr class="list_c_sel">
+                        <td width="1%" class="list_c">&nbsp;</td>
+                        <td width="23%" class="list_c">@notes.name_subtype@</td>                                                        
+                        <td width="10%" class="list_c" style="font-size:9px">&nbsp;<%= [string range [format "%s" @notes.note_datetime@] 0 15] %></td>                                                  
+                        <!-- FORMULARIO -->
+                        <FORM METHOD="post" name="fe">
+                        <INPUT type="hidden" name="card_id" value="@card_id@">
+                        <INPUT type="hidden" name="user_id" value="@user_id@">
+                        <INPUT type="hidden" name="note_id" value="@note_id@">
+                        <INPUT type="hidden" name="nav_sel" value="@nav_sel@">
+                        <td width="50%" class="list_c_sel">
+                        <INPUT type="text" size="75" name="note_desc" value="@notes.value_s@"></td>
+                        <td width="6%" class="list_c_sel">
+                        <INPUT type="text" size="4" name="note_value" value="@notes.value_n@"></td>
+                        <td width="3%" class="list_c_sel">
+                        <if @notes.is_active@>
+                                <if @notes.allow_act@>
+                                <INPUT type="checkbox" size="1" name="note_act" value="1" checked="true">
+                                </if>
+                                <else>
+                                <INPUT type="checkbox" size="1" name="note_act" value="1" checked="true" disabled>
+                                <INPUT type="hidden" size="1" name="note_act_yes" value="1">
+                                </else>
+                        </if>
+                        <else>
+                                <if @notes.allow_act@>
+                                <INPUT type="checkbox" size="1" name="note_act" value="1">
+                                </if>
+                                <else>
+                                <INPUT type="checkbox" size="1" name="note_act" value="1" disabled>
+                                </else>
+                        
+                        </else>
+                        </td>
+                        <td width="7%" align="center" class="list_c">                   
+                                <INPUT type="hidden" name="mode_update" value="">               
+                                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ok.gif" 
+                                ALT="#cards.card_Accept#" title="#cards.card_Accept#" onclick="document.fe.mode_update.value='mode_update'">
+                                <INPUT type="hidden" name="mode_cancel" value="">               
+                                <INPUT type="image" name="submit" value="submit" size="10" src="icons/ko.gif" 
+                                ALT="#cards.card_Cancel#" title="#cards.card_Cancel#" onclick="document.fe.mode_cancel.value='mode_cancel'">
+                        </td>           
+                        </FORM>
+                        <!-- FIN FORMULARIO -->                 
+                                </else>
+                        </else>
+                </tr>
+        </if>
+        </multiple>
+        </if>   
+</multiple>
+</else>
+</else>
+</else>
+<TR>
+<TD colspan="7" align="right">#cards.card_Without_academic_validity#</TD>
+</TR>
+</TABLE>
+</td></TR>
+</TABLE><BR><BR>
+<if @error@><SCRIPT>alert("@msg_error@")</SCRIPT>
+</if>
Index: openacs-4/packages/cards/www/notes.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/notes.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/notes.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,254 @@
+ad_page_contract {
+}  -query {  	
+	user_id:integer,notnull
+  {mode:optional ""}  
+  {card_id:integer,optional ""}
+  {note_id:integer,optional ""}
+  {note_value:float,optional ""}
+  {note_desc:optional ""}
+  {note_type:integer,optional ""}
+  {note_sel:integer,optional ""}
+  {note_act:integer,optional ""}
+  {note_act_yes:integer,optional ""}
+  {mode_insert:optional ""}
+  {mode_update:optional ""}
+  {mode_cancel:optional ""}
+  {mode_base:optional ""}
+  {nav_sel:optional ""}
+  {text_sel:optional ""}
+  {comm_teacher:optional ""}
+} -properties {
+}
+
+# previndre que la p�gina siga cridada fora d'una comunitat
+if {[empty_string_p [dotlrn_community::get_community_id]]} {
+    ad_returnredirect "[dotlrn::get_url]"
+}
+
+set bloc_sel ""
+set is_edit 0
+set tcl_precision 5
+set error 0
+set sel_edit_note 0
+set is_edit 0
+set msg_error ""
+# a�� no s� el que fa
+set dotlrn_url [dotlrn::get_url]
+
+# Declaraci� de variables a emprar
+# Comunitat a la que estem y usuari que som
+set community_id [dotlrn_community::get_community_id]
+set my_user_id [ad_conn user_id]
+# Si som administradors a la comunitat
+set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id]
+
+# COSES QUE VENEN DE CARD.TCL
+set return_url "[ns_conn url]?[ns_conn query]"
+set subsite_url [subsite::get_element -element url]
+acs_user::get -user_id $user_id -array user_info
+set widthheight_param "width=64 height=64"
+set export_vars [export_url_vars user_id]
+
+# A�� no s� per a que �s.
+set referer [ns_conn url]
+
+# L'hora del sistema
+set datetime [clock_to_ansi [clock seconds]]
+
+
+# modo EDIT --> Control de la edici�n de campos
+if { $mode eq "edit2" } {
+		set is_edit 2
+	}
+
+if { $mode eq "edit3" } {
+		set is_edit 3
+	}	
+
+if { $mode eq "delete"} {
+	db_dml delete_note { *SQL* } 
+	set mode ""
+	ad_returnredirect "./notes?card_id=$card_id&user_id=$user_id&nav_sel=$nav_sel&text_sel=$text_sel"
+	}	
+	
+	
+if {$mode_cancel ne ""} {
+	set mode_update ""
+	ad_returnredirect "./notes?card_id=$card_id&user_id=$user_id&nav_sel=$nav_sel&text_sel=$text_sel"
+	}
+
+# Modo UPDATE_2
+if {$mode_update eq "mode_update2"} {
+	 db_dml update_comm_teacher { *SQL* } 
+	set mode_update ""	
+	ad_returnredirect "./notes?card_id=$card_id&user_id=$user_id&nav_sel=$nav_sel"	
+}
+
+# Modo UPDATE_3
+#note_datetime = :datetime,
+if {$mode_update eq "mode_update3"} {
+	 db_dml update_text_note { *SQL* } 
+	set mode_update ""	
+	ad_returnredirect "./notes?card_id=$card_id&user_id=$user_id&nav_sel=$nav_sel&text_sel=1"	
+}
+
+
+# Modo INSERT TEXT
+if {$mode_insert eq "mode_insert"} {
+db_0or1row get_st { *SQL* }
+
+	 db_dml insert_text_note { *SQL* }
+	set mode_insert ""	
+	ad_returnredirect "./notes?card_id=$card_id&user_id=$user_id&nav_sel=$nav_sel&text_sel=1"	
+}
+
+
+#  DATOS PERSONALES
+
+set existe_photo 1;
+if ![db_0or1row get_item_id { *SQL* }] {
+  set existe_photo 0;
+}
+
+
+set found_card [db_0or1row select_found_card { *SQL* }]
+
+if {!$found_card} {
+  db_dml insert_new_card { *SQL* }
+  db_0or1row select_found_card { *SQL* }
+# A�adir ANOTACIONES QUE NO TENGA
+# select * from uv_card_subtype_note where ref_community_id = 1157056;
+}
+
+if {$card_id eq ""} {
+	set card_id $id_card
+}
+
+set is_teacher [dotlrn::user_can_admin_community_p -user_id [ad_get_user_id] -community_id $community_id]
+	
+# FIN DATOS PERSONALES
+
+
+# Obtenemos los parametros de configuraci�n de la evaluacion de la asignatura
+#db_1row view_notes "select * from uv_card_base_note where community_id = :community_id"
+#set bn $base_note
+set bn 100
+
+# Comprovar permisos: Si l'usuari no administrador conectat no es el de la fitxa no li deixem vore-la.
+#if {!$admin_p} { set link_type 1} else { set link_type 0}
+# Si no som administradors res de res.
+if {!$admin_p} {
+			ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] 	
+}
+
+# Comprobacion de modos
+
+#Creamos entrada en UV_CARD_BASE_TYPE si no existe para la comunidad
+# set found_base [db_0or1row get_base "select * from uv_card_base_note where community_id = :community_id"]
+
+if {$mode_update ne ""} {
+	if {$note_act eq 1} {
+		set note_actv 1	
+	} else {
+		if {$note_act_yes eq 1} {
+			set note_actv 1
+		} else {
+			set note_actv 0	
+		}
+	}
+		set note_value [expr $note_value * 1.00]
+		db_dml update_card_note { *SQL* }		
+		set mode_update ""
+		ad_returnredirect "./notes?card_id=$card_id&user_id=$user_id&nav_sel=$nav_sel"
+	}	
+	
+if {$mode eq "delete"} {
+		db_dml delete_note { *SQL* }		
+	}		
+set sel_edit_note 0
+
+if {$mode eq "edit"} {
+	set sel_edit_note $note_sel
+	set is_edit 1
+	} 
+	
+# Obtenci� de les dades del alumne (noms i cognoms)
+db_1row alum_data { *SQL* } 
+
+# Obtenci� dels blocs d'avaluaci� de la comunitat sense els de text
+db_multirow blocs_eval select_blocs_eval_sql { *SQL* }
+
+
+# Obtenci� dels blocs d'avaluaci� de la comunitat (TOTS)
+set l_b [db_list get_bloc { *SQL* } ]
+
+# N� de blocs de la comunitat
+set nbs [llength $l_b]
+
+# Si no tenim blocs, mostrarem les dades personals
+if {$nbs eq 0 } {
+	set nav_sel "ficha"
+}
+
+# Seleccionem els blocs de text
+db_multirow blocs_text select_blocs_text_sql { *SQL* }
+
+# Mostrem les anotacions del bloc de text seleccionat
+if {$text_sel eq 1} {
+db_multirow notes_text text_notes_sql { *SQL* }
+db_0or1row bloc_sel { *SQL* }
+}
+# Obtenci� dels blocs d'avaluaci� de la comunitat amb la mitja
+db_multirow blocs_eval1 blocs_eval1_sql { *SQL* }
+
+db_multirow notes notes_sql { *SQL* }
+
+# NUEVA CONSULTA
+db_multirow notes1 notes_eval_sql { *SQL* }
+
+# CALCULO NOTA FINAL
+set nota_m 0
+set final_note 0
+set np_count 0
+set restrict  0 
+#Obtenemos el numero de bloques con NP activo y lo guardamos en np_num
+db_1row npn_sql { *SQL* }
+set np_num $npn
+
+# Recorremos todas las notas del usuario actual
+set restrict "NO"
+	set nota_media 0
+	set aux_m 0
+	set aux_r 0
+	set np_count 0
+	set r_txt "(*)" 
+		
+	# Recorremos todas las notas del usuario actual
+	multirow foreach notes1 {	
+		if {$ref_id_card eq $id_card} {
+			set nota_media [expr $nota_media + $mitja_p]
+			set rval [expr $rvalor * $xcent * 1.00  / 100]						
+			# Control de restricci�n. Si se la salta activamos restrict
+			if {($mitja_p < $rval) && ($mitja_p ne 0)} {
+				set restrict "SI"
+			}
+			# Control de NP. Si esta activo y media es cero incrementamos 1 el contador de np's
+			if {($np eq "t") && ($mitja_p eq 0)} {
+				set np_count [expr $np_count + 1]
+			} 	
+		}
+	}
+	
+	# Control de NP, Restriccion y estadisticas
+	if {($np_count eq $np_num) && ($np_num ne 0)} {
+		lappend l_notas "NP"
+	} else {
+		if {$restrict eq "SI" && $nota_media > 5} {
+			lappend l_notas -1
+		} else {
+			lappend l_notas $nota_media
+		}	
+	}
+
+
+
Index: openacs-4/packages/cards/www/notes.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/notes.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/notes.xql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,188 @@
+
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+	
+	
+	<fullquery name="delete_note">
+        <querytext>
+			delete from uv_card_notes 
+			where id_card_notes= :note_id
+	    </querytext>
+    </fullquery>
+	
+	
+	<fullquery name="update_comm_teacher">
+        <querytext>
+			update uv_card
+			set comm_teacher= :comm_teacher
+			where id_card= :card_id
+		
+	    </querytext>
+    </fullquery>
+	
+	<fullquery name="update_text_note">
+        <querytext>
+			update uv_card_notes
+			set value_s = :note_desc
+			where id_card_notes = :note_id		
+	    </querytext>
+    </fullquery>
+	
+	
+	<fullquery name="get_st">
+        <querytext>
+		select id_subtype from uv_card_subtype_note where ref_xcent = :nav_sel
+	    </querytext>
+    </fullquery>
+
+	
+	<fullquery name="insert_text_note">
+        <querytext>
+			insert into uv_card_notes
+			(ref_id_card, ref_subtype, value_s, r_community_id) 
+			values (:card_id, :id_subtype, :note_desc, :community_id)
+		</querytext>
+    </fullquery>
+	
+	
+	<fullquery name="get_item_id">
+        <querytext>
+			select i.width, i.height, cr.title, cr.description, cr.publish_date
+			from acs_rels a, cr_items c, cr_revisions cr, images i
+			where a.object_id_two = c.item_id
+			and c.live_revision = cr.revision_id
+			and cr.revision_id = i.image_id
+			and a.object_id_one = :user_id
+			and a.rel_type = 'user_portrait_rel'
+	    </querytext>
+    </fullquery>	
+ 
+	
+	<fullquery name="select_found_card">
+        <querytext>
+			select * from uv_card 
+			where ref_user_id= :user_id and ref_community_id= :community_id
+	    </querytext>
+    </fullquery>	
+	
+	
+	
+	<fullquery name="insert_new_card">
+        <querytext>
+			insert into uv_card
+				(ref_community_id, ref_user_id)
+			values
+				(:community_id,:user_id)
+	    </querytext>
+    </fullquery>	
+	
+			
+			 
+	<fullquery name="update_card_note">
+        <querytext>
+			update uv_card_notes
+			set value_s= :note_desc, value_n= :note_value, is_active= :note_actv
+			where id_card_notes= :note_id
+	    </querytext>
+    </fullquery>	
+	
+
+	<fullquery name="alum_data">
+        <querytext>
+			select last_name, first_names 
+			from acs_users_all 
+			where user_id = :user_id
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="select_blocs_eval_sql">
+		<querytext>
+			select * from uv_card_xcent_note 
+			where ref_community_id = :community_id and ref_basetype <> 3 
+			order by xcent desc
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="get_bloc">
+        <querytext>
+			select id_xcent 
+			from uv_card_xcent_note 
+			where ref_community_id = :community_id
+	    </querytext>
+    </fullquery>	
+	
+
+	<fullquery name="select_blocs_text_sql">
+		<querytext>
+			select * from uv_card_xcent_note 
+			where ref_community_id = :community_id and ref_basetype = 3 
+			order by name_xcent
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="text_notes_sql">
+        <querytext>
+			select * from uv_card_notes 
+			where ref_id_card = :card_id and ref_subtype in 
+				(select id_subtype from uv_card_subtype_note 
+					where ref_xcent = :nav_sel)
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="bloc_sel">
+        <querytext>
+			select name_xcent as bloc_sel 
+			from uv_card_xcent_note 
+			where id_xcent = :nav_sel
+	    </querytext>
+    </fullquery>	
+	
+		<fullquery name="blocs_eval1_sql">
+        <querytext>
+			select ref_xcent, name_xcent, xcent, avg(value_n) as mitja 
+			from uv_card_notes inner join 
+				(uv_card_subtype_note inner join
+					uv_card_xcent_note on (ref_xcent = id_xcent)) 
+				on (ref_subtype = id_subtype) 
+			where ref_id_card = :card_id and is_active = 'true' 
+			group by ref_xcent,name_xcent,xcent order by ref_xcent asc
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="notes_sql">
+        <querytext>
+			select * from uv_card_notes inner join 
+				(uv_card_subtype_note inner join 
+					uv_card_xcent_note on (ref_xcent = id_xcent)) 
+				on (ref_subtype = id_subtype) 
+			where ref_id_card = :card_id 
+			order by id_subtype
+	    </querytext>
+    </fullquery>	
+	
+	<fullquery name="notes_eval_sql">
+        <querytext>
+			select ref_id_card, ref_xcent, name_xcent, xcent,
+					avg(value_n)*xcent*1.00/100.00 as mitja_p,
+					rvalor, np 
+			from uv_card_notes n, uv_card_subtype_note sn, uv_card_xcent_note xn 
+			where sn.ref_xcent = xn.id_xcent and sn.ref_community_id = :community_id 
+				and xn.ref_community_id = :community_id and ref_id_card = :card_id 
+				and n.ref_subtype = sn.id_subtype and is_active = 'true' and xcent<>0 
+				group by  ref_xcent,name_xcent,xcent,ref_id_card, rvalor,np 
+				order by ref_id_card asc, xcent desc, ref_xcent asc
+	    </querytext>
+    </fullquery>	
+	
+		<fullquery name="npn_sql">
+        <querytext>
+			select count(np) as npn 
+			from uv_card_xcent_note 
+			where ref_community_id= :community_id and np<>'f'
+	    </querytext>
+    </fullquery>	
+	
+</queryset>
+
Index: openacs-4/packages/cards/www/orla.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/orla.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/orla.adp	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,86 @@
+<!-- <master>  --><!-- #dotlrn.gestion_evaluacion_name# -->
+
+<!---->
+<link rel="stylesheet" href="cards.css" type="text/css">
+<TABLE width="100%" border="0">
+<TR>
+<TD style="font-weight:bold">
+<div class="volver">&nbsp;&nbsp;#cards.card_Subjet#: 
+&nbsp;&nbsp;<%= [dotlrn_community::get_community_description -community_id $community_id] %>&nbsp;&nbsp;
+</div></TD>
+<TD ALIGN="RIGHT">
+<div class="volver">
+<A HREF="cards" class="t" style="color:#ffffff;font-weight:bold">&nbsp;&nbsp;#cards.card_Back#&nbsp;&nbsp;</A></div></TD>
+</TR>
+<TR>
+<TD>
+</TD>
+<TABLE width="600" style="table-layout:fixed">
+
+<multiple name="alum">
+<!--
+<%= [set idx [expr @alum.rownum@ % 8]] 
+        set idx @idx@
+%>
+--> 
+<!--user_id as user_id
+id_card
+last_name
+first_names-->
+
+
+<if @idx@ eq 1>
+<tr>
+<td class="orla">
+<TABLE width="75" style="table-layout:fixed">
+<TR><TD>
+<CENTER><a href="notes?user_id=@alum.user_id@" class="link1" title="@alum.last_name@, @alum.first_names@"><IMG @widthheight_param@ SRC="/shared/portrait-bits.tcl?user_id=@alum.user_id@"> <!--alt="alum.last_name, alum.first_names">--></a>
+</CENTER>
+</TD></TR>
+<TR><TD><CENTER>@alum.last_name@, @alum.first_names@</CENTER>
+</TD></TR>
+</TABLE>
+
+</td>
+</if>
+<else>
+
+        <if @idx@ eq 0>
+        <td class="orla">
+<TABLE width="75" style="table-layout:fixed">
+<TR><TD>
+<CENTER><a href="notes?user_id=@alum.user_id@" class="link1" title="@alum.last_name@, @alum.first_names@"><IMG @widthheight_param@ SRC="/shared/portrait-bits.tcl?user_id=@alum.user_id@"> <!--alt="alum.last_name, alum.first_names">--></a>
+</CENTER>
+</TD></TR>
+<TR><TD><CENTER>@alum.last_name@, @alum.first_names@</CENTER>
+</TD></TR>
+</TABLE>
+
+        </td></tr>
+        </if>
+        <else>
+        <td class="orla">
+<TABLE width="75" style="table-layout:fixed">
+<TR><TD>
+<CENTER><a href="notes?user_id=@alum.user_id@" class="link1" title="@alum.last_name@, @alum.first_names@"><IMG @widthheight_param@ SRC="/shared/portrait-bits.tcl?user_id=@alum.user_id@"> <!--alt="alum.last_name, alum.first_names">--></a>
+</CENTER>
+</TD></TR>
+<TR><TD><CENTER>@alum.last_name@, @alum.first_names@</CENTER>
+</TD></TR>
+</TABLE>
+        
+        </td>
+        </else>
+</else>
+
+</multiple>
+</TABLE>
+</TR>
+</table>
+@alum:rowcount@ #dotlrn.student_role_pretty_plural#
+
+
+
+
+<if @error@><SCRIPT>alert("@msg_error@")</SCRIPT>
+</if>
Index: openacs-4/packages/cards/www/orla.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/orla.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/orla.tcl	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,57 @@
+ad_page_contract {
+}  -query {
+    {parent_user_role:multiple,array,optional}
+    {order "last_name"}
+    {order_direction "asc"}
+	
+} -properties {
+    users:multirow
+    n_parent_users:onevalue
+}
+
+# previndre que la p�gina siga cridada fora d'una comunitat
+if {[empty_string_p [dotlrn_community::get_community_id]]} {
+    ad_returnredirect "[dotlrn::get_url]"
+}
+
+set bloc_sel ""
+set is_edit 0
+set tcl_precision 5
+set error 0
+set sel_edit_note 0
+set is_edit 0
+set msg_error ""
+# a�� no s� el que fa
+set dotlrn_url [dotlrn::get_url]
+
+# Declaraci� de variables a emprar
+# Comunitat a la que estem y usuari que som
+set community_id [dotlrn_community::get_community_id]
+set my_user_id [ad_conn user_id]
+# Si som administradors a la comunitat
+set admin_p [dotlrn::user_can_admin_community_p -user_id $my_user_id -community_id $community_id]
+
+# COSES QUE VENEN DE CARD.TCL
+set return_url "[ns_conn url]?[ns_conn query]"
+set widthheight_param "width=64 height=64"
+set subsite_url [subsite::get_element -element url]
+
+
+# A�� no s� per a que �s.
+set referer [ns_conn url]
+
+# L'hora del sistema
+set datetime [clock_to_ansi [clock seconds]]
+
+#Obtenemos lista de alumnos 
+#db_multirow alum alum_sql "select acs_users_all.user_id as user_id, id_card, last_name, first_names from acs_users_all, dotlrn_member_rels_approved inner join uv_card on (ref_user_id = 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 uv_card.ref_community_id = community_id order by last_name, first_names asc"
+db_multirow alum alum_sql {} 
+
+# Comprovar permisos: Si l'usuari no administrador conectat no es el de la fitxa no li deixem vore-la.
+#if {!$admin_p} { set link_type 1} else { set link_type 0}
+# Si no som administradors res de res.
+if {!$admin_p} {
+			ad_return_error [lang::util::localize "#acs-subsite.Error#"] [lang::util::localize "#dotlrn.deniedpermission#"] 	
+}
+
+	
Index: openacs-4/packages/cards/www/orla.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/Attic/orla.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards/www/orla.xql	10 Jun 2005 08:26:55 -0000	1.1
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+    <fullquery name="alum_sql">
+        <querytext>
+			select acs_users_all.user_id as user_id,
+					id_card,
+					last_name,
+					first_names 
+			from 	acs_users_all,
+					dotlrn_member_rels_approved 
+						inner join uv_card on (ref_user_id = 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 
+					uv_card.ref_community_id = community_id 
+			order by last_name, first_names asc
+        </querytext>
+    </fullquery>
+</queryset>
Index: openacs-4/packages/cards/www/icons/card.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/icons/card.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/cards/www/icons/edit.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/icons/edit.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/cards/www/icons/ko.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/icons/ko.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/cards/www/icons/ok.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/icons/ok.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/cards/www/icons/papelera.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/icons/papelera.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/cards/www/icons/plus.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards/www/icons/plus.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/dotlrn-cards/dotlrn-cards.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-cards/dotlrn-cards.info,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-cards/dotlrn-cards.info	10 Jun 2005 08:34:20 -0000	1.1
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!-- Generated by the OpenACS Package Manager -->
+
+<package key="dotlrn-cards" url="http://openacs.org/repository/apm/packages/dotlrn-cards" type="apm_service">
+    <package-name>dotLRN Cards Applet</package-name>
+    <pretty-plural>dotLRN Cards Applets</pretty-plural>
+    <initial-install-p>f</initial-install-p>
+    <singleton-p>t</singleton-p>
+
+    <version name="0.1d" url="http://openacs.org/repository/download/apm/dotlrn-cards-0.1d.apm">
+        <owner url="http://openacs.org">OpenACS</owner>
+        <release-date>2005-05-10</release-date>
+        <vendor url="http://openacs.org">OpenACS</vendor>
+
+        <provides url="dotlrn-cards" version="0.1d"/>
+        <requires url="dotlrn" version="1.0"/>
+        <requires url="cards-portlet" version="0.1d"/>
+        <requires url="cards" version="0.1d"/>
+        
+    </version>
+</package>
Index: openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.ca_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.ca_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.ca_ES.ISO-8859-1.xml	10 Jun 2005 08:34:20 -0000	1.1
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="dotlrn-cards" package_version="0.1d" locale="ca_ES" charset="ISO-8859-1">
+
+  <msg key="pretty_name">Fitxes</msg>
+</message_catalog>
Index: openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.en_US.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.en_US.ISO-8859-1.xml	10 Jun 2005 08:34:20 -0000	1.1
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="dotlrn-cards" package_version="0.1d" locale="en_US" charset="ISO-8859-1">
+
+  <msg key="pretty_name">Cards</msg>
+</message_catalog>
Index: openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.es_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.es_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-cards/catalog/dotlrn-cards.es_ES.ISO-8859-1.xml	10 Jun 2005 08:34:20 -0000	1.1
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="dotlrn-cards" package_version="0.1d" locale="es_ES" charset="ISO-8859-1">
+
+  <msg key="pretty_name">Fichas</msg>
+</message_catalog>
Index: openacs-4/packages/dotlrn-cards/sql/postgresql/dotlrn-cards-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-cards/sql/postgresql/dotlrn-cards-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-cards/sql/postgresql/dotlrn-cards-create.sql	10 Jun 2005 08:34:20 -0000	1.1
@@ -0,0 +1,152 @@
+--
+-- Copyright (C) 2004 University of Valencia
+--
+--  This file is part of dotLRN.
+--
+--  dotLRN is free software; you can redistribute it and/or modify it under the
+--  terms of the GNU General Public License as published by the Free Software
+--  Foundation; either version 2 of the License, or (at your option) any later
+--  version.
+--
+--  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+--  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+--  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+--  details.
+--
+--
+--   Procedures to support the dotlrn cards
+--
+--   @author fransola (fransola@uv.es)
+--   @creation-date 2004-10-10
+--   @version $Id: dotlrn-cards-create.sql,v 0.1 2004/10/10
+
+-- create the implementation
+select acs_sc_impl__new (
+                'dotlrn_applet',
+                'dotlrn_cards',
+                'dotlrn_cards'
+);
+
+-- add all the hooks
+
+-- GetPrettyName
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'GetPrettyName',
+               'dotlrn_cards::get_pretty_name',
+               'TCL'
+);
+
+-- AddApplet
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'AddApplet',
+               'dotlrn_cards::add_applet',
+               'TCL'
+);
+
+-- RemoveApplet
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'RemoveApplet',
+               'dotlrn_cards::remove_applet',
+               'TCL'
+);
+
+-- AddAppletToCommunity
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'AddAppletToCommunity',
+               'dotlrn_cards::add_applet_to_community',
+               'TCL'
+);
+
+-- RemoveAppletFromCommunity
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'RemoveAppletFromCommunity',
+               'dotlrn_cards::remove_applet_from_community',
+               'TCL'
+);
+
+-- AddUser
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'AddUser',
+               'dotlrn_cards::add_user',
+               'TCL'
+);
+
+-- RemoveUser
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'RemoveUser',
+               'dotlrn_cards::remove_user',
+               'TCL'
+);
+
+-- AddUserToCommunity
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'AddUserToCommunity',
+               'dotlrn_cards::add_user_to_community',
+               'TCL'
+);
+
+-- RemoveUserFromCommunity
+select acs_sc_impl_alias__new (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'RemoveUserFromCommunity',
+               'dotlrn_cards::remove_user_from_community',
+               'TCL'
+);
+
+-- AddPortlet
+select acs_sc_impl_alias__new (
+        'dotlrn_applet',
+        'dotlrn_cards',
+        'AddPortlet',
+        'dotlrn_cards::add_portlet',
+        'TCL'
+    );
+
+-- RemovePortlet
+select acs_sc_impl_alias__new (
+        'dotlrn_applet',
+        'dotlrn_cards',
+        'RemovePortlet',
+        'dotlrn_cards::remove_portlet',
+        'TCL'
+);
+
+-- Clone
+select acs_sc_impl_alias__new (
+        'dotlrn_applet',
+        'dotlrn_cards',
+        'Clone',
+        'dotlrn_cards::clone',
+        'TCL'
+);
+
+select acs_sc_impl_alias__new (
+        'dotlrn_applet',
+        'dotlrn_cards',
+        'ChangeEventHandler',
+        'dotlrn_cards::change_event_handler',
+        'TCL'
+);
+
+-- Add the binding
+select acs_sc_binding__new (
+            'dotlrn_applet',
+            'dotlrn_cards'
+);
Index: openacs-4/packages/dotlrn-cards/sql/postgresql/dotlrn-cards-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-cards/sql/postgresql/dotlrn-cards-drop.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-cards/sql/postgresql/dotlrn-cards-drop.sql	10 Jun 2005 08:34:20 -0000	1.1
@@ -0,0 +1,120 @@
+--
+-- Copyright (C) 2004 University of Valencia
+--
+--  This file is part of dotLRN.
+--
+--  dotLRN is free software; you can redistribute it and/or modify it under the
+--  terms of the GNU General Public License as published by the Free Software
+--  Foundation; either version 2 of the License, or (at your option) any later
+--  version.
+--
+--  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+--  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+--  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+--  details.
+--
+--
+--   Procedures to support the dotlrn cards
+--
+--   @author fransola (fransola@uv.es)
+--   @creation-date 2004-10-10
+--   @version $Id: dotlrn-cards-drop.sql,v 0.1 2004/10/10
+
+select acs_sc_impl__delete(
+           'dotlrn_applet',             -- impl_contract_name
+           'dotlrn_cards'                -- impl_name
+);
+
+
+-- add all the hooks
+
+-- GetPrettyName
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'GetPrettyName'
+);
+
+-- AddApplet
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'AddApplet'
+);
+
+-- RemoveApplet
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'RemoveApplet'
+);
+
+-- AddAppletToCommunity
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'AddAppletToCommunity'
+);
+
+-- RemoveAppletFromCommunity
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'RemoveAppletFromCommunity'
+);
+
+-- AddUser
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'AddUser'
+);
+
+-- RemoveUser
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'RemoveUser'
+);
+
+-- AddUserToCommunity
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'AddUserToCommunity'
+);
+
+-- RemoveUserFromCommunity
+select acs_sc_impl_alias__delete (
+               'dotlrn_applet',
+               'dotlrn_cards',
+               'RemoveUserFromCommunity'
+);
+
+-- AddPortlet
+select acs_sc_impl_alias__delete (
+        'dotlrn_applet',
+        'dotlrn_cards',
+        'AddPortlet'
+    );
+
+-- RemovePortlet
+select acs_sc_impl_alias__delete (
+        'dotlrn_applet',
+        'dotlrn_cards',
+        'RemovePortlet'
+);
+
+-- Clone
+select acs_sc_impl_alias__delete (
+        'dotlrn_applet',
+        'dotlrn_cards',
+        'Clone'
+);
+
+
+-- Add the binding
+select acs_sc_binding__delete (
+            'dotlrn_applet',
+            'dotlrn_cards'
+);
Index: openacs-4/packages/dotlrn-cards/tcl/dotlrn-cards-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-cards/tcl/dotlrn-cards-procs-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-cards/tcl/dotlrn-cards-procs-postgresql.xql	10 Jun 2005 08:34:20 -0000	1.1
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<queryset>
+<rdbms><type>postgresql</type><version>7.1</version></rdbms>
+
+<fullquery name="dotlrn_cards::clone.call_cards_clone">
+  <querytext>
+    select cards__clone ( 
+        :old_package_id,
+        :new_package_id
+      );
+  </querytext>
+</fullquery>
+
+
+</queryset>
Index: openacs-4/packages/dotlrn-cards/tcl/dotlrn-cards-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-cards/tcl/dotlrn-cards-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-cards/tcl/dotlrn-cards-procs.tcl	10 Jun 2005 08:34:20 -0000	1.1
@@ -0,0 +1,255 @@
+#
+#  Copyright (C) 2004 University of Valencia
+#
+#  This file is part of dotLRN.
+#
+#  dotLRN is free software; you can redistribute it and/or modify it under the
+#  terms of the GNU General Public License as published by the Free Software
+#  Foundation; either version 2 of the License, or (at your option) any later
+#  version.
+#
+#  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+#  details.
+#
+
+ad_library {    
+
+    Procs to set up the dotLRN cards applet
+
+    @author fransola (fransola@uv.es)
+    @creation-date 2004-10-10
+    @version $Id: dotlrn-cards-procs.tcl,v 0.1 2004/10/10
+
+}
+
+namespace eval dotlrn_cards {
+    
+    ad_proc -public applet_key {
+    } {
+        What's my applet key?
+    } {
+        return dotlrn_cards
+    }
+
+    ad_proc -public package_key {
+    } {
+        What package do I deal with?
+    } {
+        return cards
+    }
+
+    ad_proc -public my_package_key {
+    } {
+        What package do I deal with?
+    } {
+        return "dotlrn-cards"
+    }
+
+    ad_proc -public get_pretty_name {
+    } {
+        returns the pretty name
+    } {
+        return "[_ dotlrn-cards.pretty_name]"
+    }
+
+    ad_proc -public add_applet {
+    } {
+        One time init - must be repeatable!
+    } {
+        dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key]
+    }
+
+    ad_proc -public remove_applet {
+    } {
+        One time destroy. 
+    } {
+        dotlrn_applet::remove_applet_from_dotlrn -applet_key [applet_key]
+    }
+
+    ad_proc -public add_applet_to_community {
+        community_id
+    } {
+        Add the cards applet to a specifc dotlrn community
+    } {
+        set portal_id [dotlrn_community::get_portal_id -community_id $community_id]
+
+        # create the cards package instance (all in one, I've mounted it)
+        set package_id [dotlrn::instantiate_and_mount $community_id [package_key]]
+
+        # set up the admin portal
+        set admin_portal_id [dotlrn_community::get_admin_portal_id \
+                                 -community_id $community_id
+        ]
+
+        cards_admin_portlet::add_self_to_page \
+            -portal_id $admin_portal_id \
+            -package_id $package_id
+        
+        set args [ns_set create]
+        ns_set put $args package_id $package_id
+        add_portlet_helper $portal_id $args
+
+        return $package_id
+    }
+
+    ad_proc -public remove_applet_from_community {
+        community_id
+    } {
+        remove the applet from the community
+    } {
+        ad_return_complaint 1 "[applet_key] remove_applet_from_community not implimented!"
+    }
+
+    ad_proc -public add_user {
+        user_id
+    } {
+        one time user-specifuc init
+    } {
+        # noop
+    }
+
+    ad_proc -public remove_user {
+        user_id
+    } {
+    } {
+        # noop
+    }
+
+    ad_proc -public add_user_to_community {
+        community_id
+        user_id
+    } {
+        Add a user to a specifc dotlrn community
+    } {
+        set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]]
+        set portal_id [dotlrn::get_portal_id -user_id $user_id]
+
+        # use "append" here since we want to aggregate
+        set args [ns_set create]
+        ns_set put $args package_id $package_id
+        ns_set put $args param_action append
+        
+        #For do not appears on user personal page
+        #add_portlet_helper $portal_id $args        
+    }
+
+    ad_proc -public remove_user_from_community {
+        community_id
+        user_id
+    } {
+        Remove a user from a community
+    } {
+        set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]]
+        set portal_id [dotlrn::get_portal_id -user_id $user_id]
+
+        set args [ns_set create]
+        ns_set put $args package_id $package_id
+
+        remove_portlet $portal_id $args
+    }
+        
+    ad_proc -public add_portletOLD {
+        portal_id
+    } {
+        A helper proc to add the underlying portlet to the given portal. 
+        
+        @param portal_id
+    } {
+        # simple, no type specific stuff, just set some dummy values
+
+        set args [ns_set create]
+        ns_set put $args package_id 0
+        ns_set put $args param_action overwrite
+        add_portlet_helper $portal_id $args
+    }
+
+    ad_proc -public add_portlet {
+        portal_id
+    } {
+        A helper proc to add the underlying portlet to the given portal. 
+        
+        @param portal_id
+    } {
+        set args [ns_set create]
+        ns_set put $args package_id 0
+        set type [dotlrn::get_type_from_portal_id -portal_id $portal_id]
+
+        #select type from dotlrn_portal_types_map;
+        #         type          
+        #-----------------------
+        # user
+        # dotlrn_community
+        # dotlrn_class_instance
+        # dotlrn_club
+        #(4 rows)
+        
+        ns_log Notice [format "Class 1 TYPE=%s" $type]
+
+        if {[string equal $type "dotlrn_class_instance"] == 1} {
+            add_portlet_helper $portal_id $args
+        }  else {
+            # not to any of the other types
+            return
+        }     
+
+    }
+
+    ad_proc -public add_portlet_helper {
+        portal_id
+        args
+    } {
+        A helper proc to add the underlying portlet to the given portal.
+
+        @param portal_id
+        @param args an ns_set
+    } {
+        cards_portlet::add_self_to_page \
+            -portal_id $portal_id \
+            -package_id [ns_set get $args package_id] \
+            -param_action [ns_set get $args param_action]
+    }
+
+    ad_proc -public remove_portlet {
+        portal_id
+        args
+    } {
+        A helper proc to remove the underlying portlet from the given portal. 
+        
+        @param portal_id
+        @param args A list of key-value pairs (possibly user_id, community_id, and more)
+    } { 
+        cards_portlet::remove_self_from_page \
+            -portal_id $portal_id \
+            -package_id [ns_set get $args package_id]
+    }
+
+    ad_proc -public clone {
+        old_community_id
+        new_community_id
+    } {
+        Clone this applet's content from the old community to the new one
+    } {
+        ns_log notice "Cloning: [applet_key]"
+        set new_package_id [add_applet_to_community $new_community_id]
+        set old_package_id [dotlrn_community::get_applet_package_id \
+            -community_id $old_community_id \
+            -applet_key [applet_key]
+        ]
+
+        db_exec_plsql call_cards_clone {}
+        return $new_package_id
+    }
+
+    ad_proc -public change_event_handler {
+        community_id
+        event
+        old_value
+        new_value
+    } { 
+        listens for the following events: 
+    } { 
+    }   
+
+}