Index: openacs-4/packages/assessment/assessment.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v diff -u -N -r1.38 -r1.39 --- openacs-4/packages/assessment/assessment.info 10 Jun 2005 16:45:02 -0000 1.38 +++ openacs-4/packages/assessment/assessment.info 12 Jun 2006 02:49:49 -0000 1.39 @@ -7,17 +7,17 @@ f f - + Eduardo Perez Ureta Assessment package that will replace the survey, quizz, complex survey, poll and other data collection packages that OpenACS currently supports. - 2005-03-03 + 2005-08-01 E-LANE Create assessments and evaluate. 0 - + @@ -33,7 +33,9 @@ - + + + Index: openacs-4/packages/assessment/catalog/assessment.ca_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.ca_ES.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/catalog/assessment.ca_ES.ISO-8859-1.xml 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,584 @@ + + + + Dalt + Grand�ria absoluta + Nombre de car�cters que l'usuari pot introduir en la caixa de text per a respondre. + Acci� + Accions d'administraci� + Descripci� + Accions + registre de l'acci� + Nom de l'acci� + Par�metres de l'acci� + Selecciona acci� + Tcl_code + L'acci� que es dur� a terme. + Acci� que s'ha de fer + Afegeix pregunta nova + Afegeix pregunta nova: Quadre de verificaci� + Afegeix una q�esti� nova: Mostra de c�rrega d'arxiu + Afegeix pregunta nova: Bot� d'opci� + Afegeix pregunta nova: Resposta curta + Afegeix pregunta nova: Selectbox + Afegeix pregunta nova: �rea de text + Afegeix pregunta nova: Caixa de text + Afegeix q�esti� nova: C�rrega d'arxiu + Afegeix pregunta nova: Opci� m�ltiple + Afegeix pregunta nova: Opcions m�ltiples + Afegeix un conjunt d'opcions ja existent + Afegeix pregunta nova: Pregunta oberta + Afegeix pregunta nova: Resposta curta + Afegeix preguntes a la secci� + Afegeix una pregunta nova + Afegeix acci� nova + Afegeix una secci� nova + Afegeix nova visualitzaci� de la secci� + Afegeix par�metre + Per a afegir una pregunta, afegiu una secci� primer. + A�adir secci�n del trigger + Afegeix seccions al q�estionari + Afegeix al q�estionari &quot;%assessment_data.title%&quot; + Afegeix a la secci� &quot;%section_title%&quot; + Afegeix disparador + Administraci� + Administraci� d'accions + Administraci� del cat�leg de preguntes + Administraci� de categories + Administraci� de peticions + Administra disparadors + Administraci� + Despr�s d'aquest q�estionari: + + Tot + Tot + permet m�ltiple + Permet negatiu + S'hauria de permetre un percentatge negatiu (com a resultat total). + Permet selecci� aleat�ria + permet %assessment_data.number_tries% + Alfab�ticament + I + An�nim + Respostes an�nimes + Permet que responguen an�nims + Alineaci� de les respostes + Alineaci� de la resposta en relaci� a la pregunta. + Opcions de resposta + Valor de la resposta + Valor d'aquesta resposta + Q�estionaris contestats + M�dul q�estionari + Aprovar + Aprova accions + Aprovat + Aprovat amb errors + Descripci� de l'acci� (p.ex., qu� fa?) + El nom a qu� es refereix quan s'anomena l'acci� + Codi tcl que s'executa en invocar l'acci�. (p.ex., pot ser una crida a una funci� o qualsevol tipus de validaci� de codi tcl) + Permetre selecci� aleat�ria? + Es pot donar una resposta an�nima? <br> L'autor del q�estionari no veur� qui ha respost. + Declaraci� de consentiment d'un usuari per a continuar amb el q�estionari. + Descripci� d'un q�estionari + Temps despr�s del qual ning� pot enviar una resposta. + P�gina que es visualitzar� abans del q�estionari actual + P�gina que es visualitzar� despr�s que acabe el q�estionari. + En quines condicions s'hauria de mostrar a l'alumne el feedback associat <br> a cada pregunta. + Instruccions sobre com usar aquesta qualificaci� + M�scara de xarxa que defineix quines adreces IP poden participar en aquest q�estionari + Quants minuts han de transc�rrer entre dos intents. + �s aquest un q�estionari aut�nom o proporciona un q�estionari integrat? S'ha de millorar, ignoreu-lo per ara + Com es far� la navegaci� entre seccions dins d'un q�estionari? + Quantes vegades pot un alumne repetir el test? Des de 0 a infinit. + Prop�sit de la variable (ordre desc.) + Nom de la variable que usareu en el codi tcl (p.ex., student_id) sense "$" + Nom�s poseu la pregunta que proporcione la informaci� desitjada + Seleccioneu el tipus de variable que espereu usar. �s una pregunta que heu de posar a la vostra pregunta seg�ent. + Introdu�u una contrasenya per al q�estionari + Per a poder fer aquest q�estionari heu d'introduir una contrasenya. + URL a qu� es direcciona despr�s que l'alumne ha acabat el q�estionari. + Si s�, el sistema cercar� les respostes pr�vies a les preguntes i omplir� la resposta amb l'�ltima resposta que es va donar. + �s https:// el m�tode requerit per a accedir a aquest q�estionari? + Si s�, l'alumne veur� el nom de la pregunta &lt;br&gt;a m�s de la pregunta mateixa quan fa�a el test. + Hora d'inici del q�estionari + Una vegada comen�at, quants minuts t� l'alumne per a acabar el q�estionari? De 0 a indefinit. + T�tol del q�estionari que es mostrar� + Q�estionari + Administraci� del q�estionari + Q�estionari importat correctament + Us permet donar un identificador �nic al q�estionari, que pot ser un codi. + El q�estionari no �s p�blic. + Q�estionaris + Acc�s restringit, IP err�nia. + T�tol + Nom�s es permeten %number_tries% intents. + Heu d'esperar %pretty_wait_time% abans de tornar-ho a intentar. + Contrasenya incorrecta. + Q�estionaris + Al final d'aquest q�estionari + Intent + Autor + Permet el bot� de tornar + Es pot polsar el bot� de retroc�s per a veure les respostes pr�vies d'aquesta secci� + Avall + Al costat-a l'esquerra + Al costat-a la dreta + Davall + Orientaci� del quadre + Branca + Branques + Correu massiu + Per usuari + Cancel�la i torna al q�estionari + Combina categories per + Per a seleccionar o deseleccionar categories m�ltiples, empreu la tecla de control del teclat. + Categoritzaci� + Exacte + Inclou subcategories + Opci� + Penja arxiu + Penja un arxiu amb el contingut de la resposta + Suprimeix arxiu + Tria arxiu + Text de Feedback donat amb aquesta opci� (a m�s del feedback donat amb la pregunta) + Posici� fixa per a aquesta opci�? + Descripci� de l'opci� + Orientaci� de l'opci� + L'orientaci� que tindran les respostes + T�tol + T�tol + Conjunt d'opcions existent + Trieu l'acci� que s'ha de fer + Quin tipus de q�estionari voleu crear? + Comparador + Heu d'establir un comparador per a aquest tipus de comparaci� + Tipus de comparaci� + Es demanaran diferents camps m�s avant depenent d'aquest valor. + Condici� + Confirmaci� + P�gina de consentiment + Continua amb Copia + Continua amb Insereix + Continua amb Extreu + Copia + Copia: + (Copia) + Copia q�estionari + Copia pregunta + Copia secci� + Copia aquest q�estionari + Tria l'opci� de resposta + �s aquesta la resposta correcta? + Creat per + Hora d'acabament + Exportaci� de CSV + Format d'exportaci� de CSV + Seleccioneu el camp que s'utilitzar� per a identificar cada pregunta en el vostre arxiu csv. + Identificador de la pregunta + Text de la pregunta + Fitxer CSV + Hora d'inici + Actualment: + Tipus de dada + Boole� + Arxiu + Data + Float + El tipus de dada de la pregunta. Una vegada seleccionada no es pot canviar. + Sencer + Text + Hora + Text curt + Data sol�licitada des de... + Introdu�u un valor per defecte per a aquesta resposta. + Path per defecte + Per defecte: Seleccionat + Aquesta resposta est� seleccionada per defecte? + Valor per defecte + Definici� + Suprimeix + Suprimeix les preguntes seleccionades + Suprimeix par�metre + Suprimeix aquest q�estionari + Descripci� + Descripci� del disparador (p.ex.: quina acci� far�?) + deshabilitat + Tipus de visualitzaci� + Tipus de visualitzaci� de la pregunta + No es visualitzen les respostes anteriors + Edita + Edita q�estionari + Edita pregunta + Edita pregunta: Mostra quadre de verificaci� + Edita pregunta: Mostra de bot� d'acci� + Edita pregunta: Mostra de resposta curta + Edits pregunta: Mostra de quadre de selecci� + Edita pregunta: Mostra d'�rea de text + Edita pregunta: Mostra de caixa de text + Edita pregunta + Edita pregunta: Opci� m�ltiple + Edita pregunta: Opcions m�ltiples + Edita pregunta: Pregunta oberta + Edita pregunta: Resposta curta + Edita par�metre + Edita secci� + Edita tipus de visualitzaci� + Editable + Opcions de correu electr�nic: + Hora de finalitzaci� + Introdueix missatge + P�gina d'entrada + Heu d'introduir un codi tcl per executar + Han de ser parells de \"valor clau\" + P�gina d'eixida + Exporta + Accions extremes: + Feedback + Feedback presentat a l'usuari. + Feedback per la resposta correcta + Feedback donat a l'alumne si ha contestat correctament la pregunta. + Feedback per a resposta err�nia + Feedback donat a l'alumne si ha contestat err�niament + Codi QTI del Camp + S'empra una etiqueta breu quan s'exporta una pregunta en QTI (per exemple, el nom d'una columna o una fila en un full de c�lcul) + Nom del camp CSV + S'empra una etiqueta curta en exportar respostes a preguntes en arxiu CSV + L'arxiu �s massa gran. La grand�ria dels arxius es limita a %pretty_max_size% bytes. + L'arxiu est� buit. Potser heu intentat pujar un arxiu buit, un arxiu inexistent o s'ha produ�t un error durant la transfer�ncia. + Filtre + Afegeix filtre nou + Hi ha molts tipus de filtres que podeu afegir: <p></p><ul><li><b>Filtres de tipus de dada</b>: Proven les dades introdu�des per l'usuari per comprovar si s�n de tipus alfanum�ric, car�cters de l'alfabet nom�s, num�ric, sencer o boole�. </li><li><b>Filtres de l�mits</b>: Proven valors introdu�ts per l'usuari (de tipus num�ric incloent-hi nombres enters, boole� o text) contra valors de refer�ncia utilitzant un comparador. </li></ul> <p> Haur�eu de cercar els filtres ja creats i reutilitzar-los en lloc de crear filtres duplicats, per� podeu fer-ho amb tota llibertat. + Atributs contingents + Edita filtre + Si editeu aquest filtre existent, en creareu una versi� nova. L'original encara es podr� emprar en un altre lloc. + Expressi� TCL del filtre + Descripci� del filtre + Eixides del filtre + Vista pr�via del filtre + Atributs necessaris + Atributs del filtre + Useu una frase compacta i descriptiva per ajudar a trobar aquest filtre i reutilitzar-lo. + Missatges de l'usuari + Filtres + Administra filtres + Filtres disponibles + Filtres actualment mapats a aquest objecte + No hi ha filtres que complisquen aquests criteris. + Hora de finalitzaci� + Acabat + Ordre fix + �s requerit + De: + Va a la secci� + Nom de la pregunta ocult + Canvia hist�ria + Horitzontal + Opcions HTML + Opcions addicionals d'HTML per a visualitzaci� + Immediatament + Importa un fitxero QTI ZIP + Resultados de la importaci�n + Incrementant + Si Incrementant val true s'obtindran (nombre de respostes correctes/nombre total de respostes)*100% punts. Si incrementar val false s'obtindr� 100% si se seleccionen totes les respostes correctes, o 0% en qualsevol altre cas. + Instruccions + M�scara IP + Penja arxiu + Penja un arxiu + Preguntes %section.cur_first_item% - %section.cur_last_item% de %section.num_items% + + REDUNDANT, la descripci� hauria de ser suficient + Suprimeix arxiu + Descripci� addicional que es buscar� per al cat�leg de preguntes + quadres de verificaci� + Arxiu de pregunta + Arxiu + Botons d'opci� + Resposta curta + Quadre de selecci� + �rea de text + Caixa de text + Nom de la pregunta, identificador que es buscar� en el cat�leg + Cal contestar obligat�riament aquesta pregunta (quan es mostre)? + Un etiqueta secund�ria, necess�ria per a diversos tipus de preguntes + Segons en qu� es permet completar aquesta pregunta + Pregunta + La pregunta mateixa + Tipus de pregunta + Pregunta de base de dades + Fitxer + C�rrega de fitxer + Tipus de pregunta feta. + Opci� m�ltiple + Pregunta oberta + Resposta curta + Preguntes + Cerca paraules clau + Paraules clau que s'usaran per a cercar una secci�. + Orientaci� de l'etiqueta + Posici� de l'etiqueta d'opci� en relaci� amb la casella de selecci�. + �ltim mes + �ltima setmana + La secci� a qu� us portar� la condici�. + Esquerra + - Us permet usar aquest q�estionari com una plantilla per a crear un q�estionari nou. + Primera lletra + Tot + Primera lletra per a limitar la recerca. + Un altre + Nom d'intents permesos: %assessment_data.number_tries% + Tothom pot fer aquest q�estionari + Tothom que ja haja completat aquest q�estionari + Tothom que encara no ha completat aquest q�estionari + Fes-ho an�nim + Fes-ho editable + Oculta el nom de la pregunta + Fes-ho conegut + Fes-ho no editable + Oculta respostes anteriors + Mostra respostes anteriors + �s necess�ria una connexi� segura + Mostra el nom de la pregunta + Permet una connexi� no segura + Manual + temps m�x. perm�s + Nom per a aquest joc d'opcions (per reutilitzar-lo) + Missatge + Tema del missatge + Missatge que es mostrar� a l'usuari en executar-se l'acci� (p.ex.: Us heu afegit a "La meua comunitat") + Minuts necessaris per tornar-ho a intentar + Mode + Hora de la modificaci� + Modificat per + Abaixar + Apujar + Permet respostes m�ltiples + Permetre respostes m�ltiples? + Nom + Nom de la c�pia nova del q�estionari + El nom del disparador. + Aquest nom ja s'ha usat. + Q�estionari nou + Crea un q�estionari nou. + Par�metre nou + Seg�ent + No + -- Cap -- + Es permet un reintent immediat + Cap + no contestat + No aprovat + Encara no s'ha avaluat + Notificaci� + Usuaris notificats + Notifica-ho a l'usuari + Nombre total d'opcions mostrades + Si aquest nombre �s menor que el d'opcions afegides, les opcions es triaran aleat�riament. + Nombre d'opcions per a un element amb opcions m�ltiples + Introdu�u el nombre d'opcions per a aquest element si �s un element d'opcions m�ltiples. + Nombre d'opcions correctes visualitzades + Nombre de respostes que s'han de visualitzar + Nombre d'elements mostrats + Nombre d'elements mostrats + Nombre d'intents permesos + Num�ric + , el %creation_date% + Un q�estionari: %assessment_data.title% + Es necessita almenys una opci� correcta + Nom�s respostes correctes + Nom�s respostes incorrectes + Q�estionaris oberts + Paraules clau + + Paraules clau emprades per a la qualificaci� autom�tica + Resposta de refer�ncia + Text per a la resposta de refer�ncia + Escriviu un t�tol per a aquesta q�esti�, de manera que es puga tornar a usar m�s endavant. + O + Ordre d'introducci� + Tipus d'ordre + Ordenaci� d'opcions + Administra un altre q�estionari + Altres sessions + fora de + Descripci� + Consulta + Tipus + Nom de variable + Par�metres + Contrasenya + Introdu�u la contrasenya del q�estionari + Puntuaci� (percentatge) + Percentatge de punts de la pregunta que d�na aquesta opci�. Pot ser major que 100 i menor que -100. + Fet + Permisos + punts + Punts per resposta + Quants punts val la resposta a aquesta pregunta? + Punts per pregunta + Quants punts val aquesta pregunta en una secci�? �s una mesura per a una relativa dificultat. + Punts per secci� + Quants punts val aquesta secci� en un q�estionari? �s una mesura per a una relativa dificultat. + Revisi� de correu + Vista pr�via + Consulta + Pregunta + Pregunta no contestada + Preguntes + Aleatori + Aleatori + S'ha emprat en el proc�s de registre + Q�estionari de la p�gina principal de registre de client: "%assessment_data.title%" + Cal ser alumnes registrats + pel que fa a aquest examen + el comando regexp ha de retornar 1 amb este patr�: + + Deu ingressar una expressi� regular per a ser utilitzada en la compraci� de l'entrada de l'usuari. + + + + + + + + Deu ser una expressi� regular v�lida per al comando regexp + Model Regexp amb qu� comparar + Relacionat + Suprimeix + Suprimeix el q�estionari + Suprimeix l'opci� + Suprimeix la pregunta + Suprimeix la secci� + - Suprimeix totes les preguntes i respostes + Sol�licitud + Notificaci� de sol�licitud per a + El q�estionari sol�licitat no existeix + Necessari + Usuaris que han contestat + Opcions de resposta + Resposta tramesa + Resultats del q�estionari per usuari + (en %results.create_date% by <a href=&quot;%results.user_url%&quot;>%results.first_names% %results.last_name%</a>) + Edita el resultat del q�estionari + Canvia l'explicaci� + Torna + Torna a la URL + Respostes anteriors mostrades + Tornar a usar respostes + Revisar el q�estionari + Dreta + Branching segons una regla + Escriviu un t�tol per a aquest joc de caracter�stiques de resposta curta de manera que es puga tornar a emprar m�s endavant. + Puntuaci� + Cerca + Cerca preguntes + Cerca i afegeix preguntes a la secci� "%section_title%" + Cerca resultats + Cerca seccions + Cerca i afegeix seccions al q�estionari "%assessment_data.title%" + Descripci� d'aquest tipus de mostra de la secci� + T�tol del tipus de mostra de la secci�. S'emprar� per triar el tipus de mostra en crear seccions noves. + Quantes preguntes es mostraran en una p�gina en una secci� d'aquest tipus? Deixeu-ho buit per a totes les preguntes d'una p�gina, empreu "1" per a una pregunta per p�gina. + SECCI� + Secci� ramificada + + es una secci� ramificada? + + Secci� %section.cur_section% out of %section.num_sections% + No hi ha pistes -> no ajuda + + Descripci� d'aquesta secci� + Mostra el tipus que s'usar� en aquesta secci�. + S'ha donat retroacci� a l'usuari en acabar la secci�. + Instruccions per emplenar aquesta secci�. + Nom artificial per a la secci�, emprat p.ex. per cercar. + Navegaci� per la secci� + -- Nou -- + Nombre de preguntes per p�gina + Ordre de les preguntes + En quin ordre es mostraran les preguntes en aquesta secci�? + Previsualitza la secci� + Es necessita visualitzar aquesta secci�?<br> Nom�s ser� �til si no visualitzeu totes les seccions. + Selecciona secci� + Plantilla de secci� + Plantilla per a la secci� feta amb ordres ADP. + Segons en qu� es permet acabar aquesta secci�. + Temps que queda per a la secci�: %section.pretty_remaining_time% + T�tol de la secci�, s'usar� en Visualitzaci� i T�tol HTML + Secci� a botar + Seccions + �s necessari un acc�s segur + �s necessari un acc�s segur + Seccions seleccionades + Envia correu massiu + Envia correu + Envia correu a + Sessi� + Temps que queda per a la sessi�: %assessment_data.pretty_remaining_time% + Sessions + Q�estionari de registre nou + Mostra q�estionaris + Mostra retroacci� + Nom de la pregunta visualitzat + Mostra el nom de la pregunta + Mostra preguntes + Mostra sessions + Data espec�fica + Hora d'inici + Iniciat + Resposta de l'alumne + Tema + Nom del tema + Tramet + Tramesa separada per a cada pregunta + L'alumne ha de trametre la resposta de cada pregunta per separat? + Subtext + Resum + Secci�n 1 + Comunitat de dest� + La condici� per a botar o executar l'acci� + No hi ha usuaris per notificar + Aquesta pregunta la corregir� el professor + Segons permesos per respondre + Minuts permesos per respondre + %assessment_data.time_for_response% minuts temps m�xim per respondre + Temps emprat + Es permet tornar-ho a intentar despr�s de %assessment_data.wait_between_tries% minuts + T�tol + Avui + Amunt + Puntuaci� total + Disparador + Suprimeix el disparador + Disparadors + Disparador + Intenta-ho de nou + Fa dos dies + Tipus + Enquesta + Q�estionari avan�at + Q�estionari avan�at + Tipus de disparador + Enquesta + No esteu satisfet amb el resultat de la recerca? + Temps il�limitat per respondre + Nombre il�limitat d'intents permesos + Es perm�s l'acc�s no segur + Cancel�la la subscripci� + Cancel�la la subscripci� de l'usuari a aquesta regla" + Carrega arxius + Resposta de l'usuari + Usuari + Els usuaris poden editar les seues respostes + Els usuaris no poden editar les seues respostes + Nom + Vertical + Totes les respostes + Mostra altres sessions + Mostra respostes + Mostra resultats + Mostra resultats + Quan aquesta acci� s'execute (p.e. al final d'aquesta secci�) + Quan s'executar� aquesta? + S� + Ahir + Index: openacs-4/packages/assessment/catalog/assessment.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.de_DE.ISO-8859-1.xml,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/catalog/assessment.de_DE.ISO-8859-1.xml 1 Apr 2005 10:51:33 -0000 1.4 +++ openacs-4/packages/assessment/catalog/assessment.de_DE.ISO-8859-1.xml 12 Jun 2006 02:49:49 -0000 1.5 @@ -1,5 +1,5 @@ - + �ber Absolute Gr��e @@ -59,6 +59,8 @@ Dies erlaubt es Ihnen, Ihrem Assessment einen speziellen einzigartigen Indentifikator zuzuweisen z.B. einen Code. Titel Nach User + Zeitliche Verf�gbarkeit �ndern (alle) + Zeitliche Verf�gbarkeit �ndern Einwilligungs Seite/ Genehmigung Kopieren Erstellt von @@ -73,7 +75,7 @@ Ende Assessment Export HTML Optionen - Zus�tzliche HTML Optionen welche innerhalb des FORM Tags verwendet werden k�nnen. Diese sind als Name/Wert Paare anzugeben welche durch Leerzeichen getrennt sind, zb.:<br /> + Zus�tzliche HTML Optionen welche innerhalb des FORM Tags verwendet werden k�nnen. Diese sind als Name/Wert Paare anzugeben welche durch Leerzeichen getrennt sind, zb.:<br /> <i>cols 50 rows 10</i> Importieren QTI ZIP Datei Anleitung Index: openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml,v diff -u -N -r1.72 -r1.73 --- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 20 Jul 2005 15:59:15 -0000 1.72 +++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 12 Jun 2006 02:49:49 -0000 1.73 @@ -1,5 +1,5 @@ - + Above Absolute Size @@ -17,11 +17,14 @@ Action to Perform Add new question Add new question: Checkbox Display + Item Display + Add new question: File Upload Display Add new question: Radiobutton Display Add new question: Short Answer Display Add new question: Selectbox Display Add new question: Textarea Display Add new question: Textbox Display + Add new question: File Upload Add new question: Multiple Choice Add new question: Multiple Choices Add existing choice set @@ -34,6 +37,7 @@ Add new section display Add parameter To add a question, add a section first. + Add section trigger Add sections to assessment Add to assessment "%assessment_data.title%" Add to section "%section_title%" @@ -123,22 +127,21 @@ Below Beside-Left Beside-Right - You need to provide a valid character expression for this field - Boolean Reference Value Bottom - User input must be a number (real or integer) bounded by a comparator reference value Box Orientation + Box orientation Branch Branches Bulk Mail By user Cancel and Return to Assessment - The requested Item does not exist Combine categories by To deselect or select multiple categories use the Control-Key on your keyboard. Categorization Exact Include Subcategories + Change Availability (alle) + Change time based availability Choice Upload File Upload a file with the content of the anwser @@ -153,6 +156,7 @@ Title Existing Choice Set Choose the action to perform + What kind of assessment you want to create? Comparator You must set a Comparator for this Comparison Type Comparison Type @@ -174,13 +178,15 @@ Is this the correct answer? Created by End Time + Select an end date. This field is optional. CSV Export CSV Export Format - Select one of the above, the selected field is goint to identify the question in your csv file. + Select one of the above, the selected field is going to identify the question in your csv file. Question Field Name Question Text CSV file Start Time + Select a start date. This field is optional. Currently: Data Type Boolean @@ -231,14 +237,11 @@ End Time Enter Message Entry Page - equal to You must enter a tcl code to execute Need to be pairs of \"key value\". - Error Message Exit Page Export Extreme Actions: - False Feedback Feedback given to the user. Feedback right @@ -275,14 +278,14 @@ Fixed Order Position This is required From: + Question title Goes to section - greater than - greater than or equal to + Post check? Question name hidden Change History Horizontal HTML Options - Additional HTML Options for display + Additional HTML Options for display (i.e. cols,rows,disabled) Immediately Import QTI ZIP File Import Results @@ -291,7 +294,6 @@ Increasing (false) will either give 100%, if all correct answers are given, or 0% else. Instructions IP Mask - Item Upload File Upload a file Questions %section.cur_first_item% - %section.cur_last_item% out of %section.num_items% @@ -300,6 +302,7 @@ Additional searchable description for the question catalog Checkboxes Question File + File Radiobuttons Short Answer Selectbox @@ -314,6 +317,7 @@ Question Type Database Question File + File Upload Question type used. Multiple Choice Open Question @@ -327,17 +331,18 @@ Last Week The section where the condition will lead you. Left - less than - less than or equal to - Lets you use this assessment as a template to create a new assessment. First Letter All First letter to limit the search to. Other Number of tries allowed: %assessment_data.number_tries% + <b>Note:</b> This assessment is set to be anonymous and<br />your name will not be included in the results. Everyone eligible to take this assessment Everyone who has already completed this assessment Everyone who has not yet completed this assessment + Prepend an empty item to the list + This field is used to validate the answer entered. This must have a multiple of 2 lines. The first line is a TCL expression to be used to check the answer and the second line is the error message. The string %%answer%% will be replaced by the answer entered. Make anonymous Make editable Hide item name @@ -349,8 +354,6 @@ Show item name Allow unsecure connection Manually - User input must match a boolean value - User input must match a specific text max. time allowed: A name for this set of choices (for reusability) Message @@ -364,30 +367,28 @@ Move Up Allow Multiple Answers Allo Multiple Answers? - User input must consist of letters only - User input must be an alphanumeric type - User input must be a boolean type - User input must be an integer type - User input must be a numeric type Name Assessment name of the new copy The name of the trigger. Name is already used. New Assessment Create New Assessment New Parameter + New Partial Assessment + New Quick Assessment + New Review Assessment + New Survey Next No + -- None -- Immediate retry allowed None not answered Not Approved - not equal to not yet reviewed Notification Notified Users Notify User - User input should be null Total Number of displayed Choices If this number is smaller than the number of added choices, choices will be picked randomly. Number of choices for multiple-choice item @@ -396,9 +397,7 @@ Number of correct answers that have to be displayed Number of Items displayed Number of Items displayed - Numeric Reference Value Number of Tries allowed - You must provide a valid number for this field Numerical , on %creation_date% One Assessment: %assessment_data.title% @@ -415,6 +414,7 @@ Order of Entry Order Type Ordering of choices + Manage another assessment Other Sessions Out of Description @@ -436,6 +436,7 @@ Points for Section How many points is this section worth in an assessment. This is a measurement for relative difficulty. Post Check + Prepend Empty Item Preview Query Question @@ -477,7 +478,6 @@ Right Rule-based Branching A title for this short answer feature set so it can be reused in the future. - Save Score Search Search for questions @@ -541,9 +541,9 @@ Does the respondee have to submit the answer for each question seperately. Subtext Summary + Section 1 Target Community - You need to provide a valid character expression for this field - Text Reference Value + Choose the target community The condition to branch or execute the action There are no users to notify This question will be corrected by the teacher @@ -560,10 +560,14 @@ Delete Trigger Triggers Trigger - True Try again Two days ago + Type + Survey + Expert Assessment + Expert Assessment Type of the trigger + Survey Unhappy with your search result? Unlimited time for response Unlimited number of tries allowed @@ -575,14 +579,14 @@ User Users may edit their responses Users may not edit their responses + Validation Block Name Vertical All responses View Other Sessions View Responses: View Results View results - Warning Message When this action will be executed (ie. At the end of this section) When this will be executed? Yes Index: openacs-4/packages/assessment/catalog/assessment.es_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.es_ES.ISO-8859-1.xml,v diff -u -N -r1.21 -r1.22 --- openacs-4/packages/assessment/catalog/assessment.es_ES.ISO-8859-1.xml 20 Jul 2005 16:00:01 -0000 1.21 +++ openacs-4/packages/assessment/catalog/assessment.es_ES.ISO-8859-1.xml 12 Jun 2006 02:49:49 -0000 1.22 @@ -1,5 +1,5 @@ - + Arriba Tama�o Absoluto @@ -17,23 +17,27 @@ Acci�n a realizar A�adir nueva pregunta A�adir nueva pregunta: Checkbox + Visualizaci�n + Visualizaci�n A�adir nueva pregunta: Radiobutton A�adir nueva pregunta: Short Answer A�adir nueva pregunta: Selectbox A�adir nueva pregunta: Textarea A�adir nueva pregunta: Textbox + A�adir nueva pregunta: archivo a subir A�adir nueva pregunta: respuesta m�ltiple A�adir nueva pregunta: respuesta m�ltiple Agrega un conjunto de opciones A�adir nueva pregunta: pregunta abierta - A�adir nueva pregunta: Short Answer + A�adir nueva pregunta: texto corto A�adir preguntas a la secci�n A�adir nueva pregunta A�adir nueva acci�n A�adir nueva secci�n A�adir nueva visualizaci�n de la secci�n A�adir par�metro Para agregar una pregunta, agregue una secci�n primero. + A�adir un disparador para la secci�n A�adir secciones al cuestionario A�adir al cuestionario A�adir a la secci�n @@ -124,6 +128,7 @@ Abajo La entrada del usuario debe ser un n�mero (real o entero) limitado por un valor de referencia Orientaci�n del cuadro + Orientaci�n del cuadro Rama Ramas Correo a todos @@ -135,6 +140,8 @@ Categorizaci�n Exacto Incluir Subcategor�as + Cambiar Disponibilidad + Cambiar fechas de disponibilidad Respuesta Subir Archivo Subir un archivo con el contenido de la respuesta @@ -149,6 +156,7 @@ T�tulo Conjunto de Opciones existente Elegir la acci�n a hacer + �Qu� tipo de cuestionario desea crear? Comparador Ud. debe ingresar un Comparador para este Tipo de Comparador Tipo de Comparaci�n @@ -170,19 +178,21 @@ �es esta respuesta la correcta? Creado por Tiempo para terminar + Indique una fecha final. Este dato es opcional. Exportar CSV Exportar a formato CSV Seleccione el dato que se utilizar� para identificar cada pregunta Identificador de la pregunta Texto de la pregunta Fichero CSV Tiempo de Inicio + Indique una fecha de inicio. Este dato es opcional. Actualmente: Tipo de Dato Booleano Fichero Fecha - Float + N�mero decimal El tipo de dato de la pregunta. Una vez que se selecciona no se puede cambiar. Entero Texto @@ -271,9 +281,11 @@ Orden fijo Es requerido De: + T�tulo de la pregunta Ir a secci�n mayor que mayor o igual que + �Chequeo posterior? Nombre de la pregunta oculto Cambiar Historia Horizontal @@ -283,8 +295,8 @@ Importar un fichero QTI ZIP Resultados de la importaci�n Incrementar - Si incrementar vale true se obtendr�n (n�mero de respuestas correctas/n�mero total de respuestas)*100% puntos. -Si incrementar vale false se obtendr� 100% si se seleccionan todas las respuestas correctas, o 0% en otro caso. + Si ha elegido "S�" en "incrementar", se obtendr�n (n�mero de respuestas correctas/n�mero total de respuestas)*100% puntos. +Si ha elegido "no", se obtendr� el 100% en caso de que todas las respuestas esten correctas, 0% en otro caso. Instrucciones M�scara IP Objeto @@ -294,11 +306,12 @@ REDUNDANTE, la descripci�n deber�a ser suficiente Borrar Archivo Descripci�n adicional a buscar para el cat�logo de preguntas - Checkboxes + Casillas de selecci�n Archivo de pregunta - Radiobuttons + Archivo + Botones radio Short Answer - Caja de selecci�n + Lista desplegable �rea de texto Caja de texto Nombre de la pregunta, identificador a buscar en el cat�logo @@ -310,10 +323,11 @@ Tipo de Pregunta Pregunta de base de datos Fichero + Subir fichero El tipo de pregunta usada. Elecci�n m�ltiple Pregunta Abierta - Short Answer + Texto corto Preguntas Buscar palabras clave Palabras clave que se usar�n para buscar una secci�n. @@ -331,9 +345,12 @@ Primera letra para limitar la b�squeda. Otro N�mero de intentos permitidos + <b>Nota:</b> Se trata de un cuestionario an�nimo por lo que su nombre no aparecer� en los resultados. Alguien que hace este cuestionario Alguien que ya haya completado este cuestionario Alguien que todav�a no ha completado este cuestionario + A�adir un elemento vac�o al principio de la lista + Este bloque ser� utilizado para validar la respuesta introducida. Debe contener un n�mero par de l�neas donde la primera l�nea es una expresi�n TCL que ser� utilizada para la validaci�n y la segunda el texto de error mostrado. La cadena %%answer%% ser� reemplazada por la respuesta introducida. Hacer an�nimo Hacer editable Ocultar nombre de la pregunta @@ -373,8 +390,13 @@ Nuevo Cuestionario experto Crear un nuevo Cuestionario experto Nuevo par�metro + Nuevo Cuestionario Parcial + Nuevo Cuestionario R�pido + Nuevo Cuestionario de Examen + Nueva Encuesta Siguiente No + -- Ninguno -- Permitir reintentar el cuestionario de forma inmediata Ninguno no contestada @@ -414,6 +436,7 @@ Orden de entrada Tipo de orden Orden de las respuestas + Administrar otro cuestionario Otras Sesiones M�xima puntuaci�n Descripci�n @@ -438,6 +461,7 @@ Los puntos que vale esta secci�n en un cuestionario. Es una medida de la dificultad relativa de la secci�n. Chequeo Posterior + A�adir un elemento vac�o Visualizaci�n previa Consulta Pregunta @@ -525,6 +549,7 @@ Sesi�n Tiempo restante de la sesi�n: %assessment_data.pretty_remaining_time% Sesiones + Nuevo Cuestionario de Suscripci�n Ver Cuestionarios Mostrar Feedback Visualizar el nombre de la pregunta @@ -543,6 +568,7 @@ Si el alumno tiene que enviar la respuesta a cada pregunta por separado. Subtexto Resumen + Secci�n 1 Comunidad Destino Usted necesita proporcionar una expresi�n v�lida de caracteres para este campo Valor del Texto de Referencia @@ -565,7 +591,12 @@ Verdadero Intentar de nuevo Hace dos d�as + Tipo + Encuesta + Cuestionario Avanzado + Cuestionario Avanzado Tipo de condici�n + Encuesta �no est�s satisfecho con el resultado de tu b�squeda? Tiempo para responder ilimitado N�mero de intentos permitidos ilimitado @@ -577,6 +608,7 @@ Usuario Los usuarios pueden editar sus respuestas Los usuarios no pueden editar sus respuestas + Bloque de Validaci�n Nombre Vertical Todas las respuestas @@ -587,6 +619,6 @@ Mensaje de Alerta Cuando esta acci�n se ejecutar� (por ejemplo, al final de esta secci�n) �cuando se ejecutar�? - Si + S� Ayer Index: openacs-4/packages/assessment/catalog/assessment.es_GT.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.es_GT.ISO-8859-1.xml,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/catalog/assessment.es_GT.ISO-8859-1.xml 20 Jul 2005 16:00:01 -0000 1.7 +++ openacs-4/packages/assessment/catalog/assessment.es_GT.ISO-8859-1.xml 12 Jun 2006 02:49:49 -0000 1.8 @@ -1,5 +1,5 @@ - + Arriba Tama�o Absoluto Index: openacs-4/packages/assessment/lib/comments-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/Attic/comments-chunk-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/comments-chunk-oracle.xql 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,26 @@ + + + + oracle8.1.6 + + + + select g.comment_id, + r.content, + r.title, + r.mime_type, + acs_object.name(o.creation_user) as author, + to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_ansi + from general_comments g, + cr_revisions r, + cr_items ci, + acs_objects o + where g.object_id = :object_id + and r.revision_id = ci.live_revision + and ci.item_id = g.comment_id + and o.object_id = g.comment_id + order by o.creation_date + + + + Index: openacs-4/packages/assessment/lib/comments-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/Attic/comments-chunk-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/comments-chunk-postgresql.xql 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,26 @@ + + + + postgresql7.1 + + + + select g.comment_id, + r.content, + r.title, + r.mime_type, + acs_object__name(o.creation_user) as author, + to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_ansi + from general_comments g, + cr_revisions r, + cr_items ci, + acs_objects o + where g.object_id = :object_id + and r.revision_id = ci.live_revision + and ci.item_id = g.comment_id + and o.object_id = g.comment_id + order by o.creation_date + + + + Index: openacs-4/packages/assessment/lib/comments-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/comments-chunk.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/comments-chunk.adp 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,18 @@ + +

Comments

+ + +

+@comments.title@ Edit +

+@comments.html_content;noquote@ +

+- @comments.author@ (on @comments.creation_date_ansi@) + + + +No comments. + +

+Add comment + \ No newline at end of file Index: openacs-4/packages/assessment/lib/comments-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/comments-chunk.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/comments-chunk.tcl 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,37 @@ +# packages/assessment/lib/comments-chunk.tcl +# +# shows comments for an object +# +# @author Deds Castillo (deds@i-manila.com.ph) +# @creation-date 2005-08-16 +# @arch-tag: 989f6620-380f-49b9-a6e0-00c0effd7bb8 +# @cvs-id $Id: comments-chunk.tcl,v 1.2 2006/06/12 02:49:49 daveb Exp $ + +foreach required_param {object_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +set return_url [ad_return_url] + +# If the user has package admin perms, give him general_comments_create perms +if { [permission::permission_p -object_id [ad_conn package_id] -privilege "admin"] && ![permission::permission_p -object_id $object_id -privilege "general_comments_create"] } { + permission::grant -object_id $object_id -privilege "general_comments_create" -party_id [ad_conn user_id] +} + +set general_comments_url [apm_package_url_from_key "general-comments"] +if {[set has_permission_p [permission::permission_p -object_id $object_id -privilege "general_comments_create"]]} { + set comment_add_url [export_vars -base "${general_comments_url}comment-add" {object_id return_url}] + +db_multirow -extend { html_content edit_url } comments comments {} { + set html_content [ad_html_text_convert -from $mime_type -- $content] + set edit_url [export_vars -base "${general_comments_url}comment-edit" {comment_id return_url}] +} + +} \ No newline at end of file Index: openacs-4/packages/assessment/lib/item-show-display-f.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-f.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-display-f.adp 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,3 @@ +

+ +
Index: openacs-4/packages/assessment/lib/item-show-display-f.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-f.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-display-f.tcl 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,10 @@ +# Display shortanswer type data. +# author Timo Hentschel (timo@timohentschel.de) + +db_1row display_type_data {} + +ad_form -name item_show_display_f -mode display -action item-edit-display-f -export { assessment_id section_id as_item_id } -form { + {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {value $html_display_options} {help_text "[_ assessment.Html_Options_help]"}} + {abs_size:text {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {value $abs_size} {help_text "[_ assessment.Absolute_Size_help]"}} + {box_orientation:text {label "[_ assessment.Box_Orientation]"} {value "[_ assessment.$box_orientation]"} {help_text "[_ assessment.Box_Orientation_help]"}} +} Index: openacs-4/packages/assessment/lib/item-show-display-f.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-f.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-display-f.xql 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,16 @@ + + + + + + + select d.html_display_options, d.abs_size, d.box_orientation + from as_item_display_f d, as_item_rels r + where d.as_item_display_id = r.target_rev_id + and r.item_rev_id = :as_item_id + and r.rel_type = 'as_item_display_rel' + + + + + Index: openacs-4/packages/assessment/lib/item-show-display-fu.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-fu.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-display-fu.adp 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,3 @@ +
+ +
Index: openacs-4/packages/assessment/lib/item-show-display-fu.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-fu.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-display-fu.tcl 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,10 @@ +# Display shortanswer type data. +# author Timo Hentschel (timo@timohentschel.de) + +db_1row display_type_data {} + +ad_form -name item_show_display_sb -mode display -action item-edit-display-sb -export { assessment_id section_id as_item_id } -form { + {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {value $html_display_options} {help_text "[_ assessment.Html_Options_help]"}} + {abs_size:text {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {value $abs_size} {help_text "[_ assessment.Absolute_Size_help]"}} + {box_orientation:text {label "[_ assessment.Box_Orientation]"} {value "[_ assessment.$box_orientation]"} {help_text "[_ assessment.Box_Orientation_help]"}} +} Index: openacs-4/packages/assessment/lib/item-show-display-fu.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-fu.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-display-fu.xql 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,16 @@ + + + + + + + select d.html_display_options, d.abs_size, d.box_orientation + from as_item_display_sa d, as_item_rels r + where d.as_item_display_id = r.target_rev_id + and r.item_rev_id = :as_item_id + and r.rel_type = 'as_item_display_rel' + + + + + Index: openacs-4/packages/assessment/lib/item-show-display-sb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-sb.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/lib/item-show-display-sb.tcl 29 Mar 2005 10:53:34 -0000 1.2 +++ openacs-4/packages/assessment/lib/item-show-display-sb.tcl 12 Jun 2006 02:49:49 -0000 1.3 @@ -8,4 +8,5 @@ {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {value $html_display_options} {help_text "[_ assessment.Html_Options_help]"}} {multiple_p:text(select) {label "[_ assessment.Multiple]"} {options $boolean_options} {value $multiple_p} {help_text "[_ assessment.Multiple_help]"}} {order_type:text {label "[_ assessment.Order_Type]"} {value "[_ assessment.$sort_order_type]"} {help_text "[_ assessment.Order_Type_help]"}} + {prepend_empty_p:text(select) {label "[_ assessment.Prepend_Empty_Item]"} {options $boolean_options} {value $prepend_empty_p} {help_text "[_ assessment.lt_Prepend_an_empty_item]"}} } Index: openacs-4/packages/assessment/lib/item-show-display-sb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-sb.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/lib/item-show-display-sb.xql 8 Dec 2004 15:30:32 -0000 1.1 +++ openacs-4/packages/assessment/lib/item-show-display-sb.xql 12 Jun 2006 02:49:49 -0000 1.2 @@ -5,7 +5,7 @@ select d.html_display_options, d.multiple_p, d.choice_label_orientation, - d.sort_order_type, d.item_answer_alignment + d.sort_order_type, d.item_answer_alignment, d.prepend_empty_p from as_item_display_sb d, as_item_rels r where d.as_item_display_id = r.target_rev_id and r.item_rev_id = :as_item_id Index: openacs-4/packages/assessment/lib/item-show-fu.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-fu.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-fu.adp 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,3 @@ +
+ +
Index: openacs-4/packages/assessment/lib/item-show-fu.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-fu.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-fu.tcl 12 Jun 2006 02:49:49 -0000 1.2 @@ -0,0 +1,9 @@ +# Display short answer type data. +# author Timo Hentschel (timo@timohentschel.de) + +db_1row item_type_data {} +set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] + +ad_form -name item_show_fu -mode display -action item-edit-fu -export { assessment_id section_id as_item_id } -form { + {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {value $title} {help_text "[_ assessment.oq_Title_help]"}} +} Index: openacs-4/packages/assessment/lib/item-show-fu.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-fu.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/item-show-fu.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,17 @@ + + + + + + + select c.title + from as_item_type_fu t, cr_revisions c, as_item_rels r + where t.as_item_type_id = r.target_rev_id + and r.item_rev_id = :as_item_id + and r.rel_type = 'as_item_type_rel' + and c.revision_id = t.as_item_type_id + + + + + Index: openacs-4/packages/assessment/lib/item-show-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-mc.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/lib/item-show-mc.tcl 6 May 2005 15:46:12 -0000 1.7 +++ openacs-4/packages/assessment/lib/item-show-mc.tcl 12 Jun 2006 02:49:50 -0000 1.8 @@ -3,7 +3,7 @@ db_1row item_type_data {} set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] -set actions [list [list "[_ acs-kernel.common_Edit]" edit] [list "[_ assessment.add_item_type_mc_existing]" existing] [list "Add More Choices" more]] +set actions [list [list "[_ acs-kernel.common_Edit]" edit] [list "[_ assessment.add_item_type_mc_existing]" existing]] ad_form -name item_show_mc -mode display -action item-edit-mc -export { assessment_id section_id as_item_id } -actions $actions -form { @@ -29,7 +29,7 @@ if {$count > 1} { append options "
\\\"[_" } - append options " \\\"[_" + append options " \\\"[_" if {$correct_answer_p == "t"} { append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $count\"\} \{value \" $title$options\"\}\}\n" @@ -49,6 +49,3 @@ } append ad_form_code "\}" eval ad_form -extend -name item_show_mc $ad_form_code -# pass along number of choices -set num_choices $total -eval ad_form -extend -name item_show_mc -export {num_choices} Index: openacs-4/packages/assessment/lib/section-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.adp,v diff -u -N -r1.17 -r1.18 --- openacs-4/packages/assessment/lib/section-items.adp 18 Apr 2005 10:20:40 -0000 1.17 +++ openacs-4/packages/assessment/lib/section-items.adp 12 Jun 2006 02:49:50 -0000 1.18 @@ -1,5 +1,4 @@

#assessment.Items#

- @@ -19,7 +18,7 @@ - + @@ -28,30 +27,21 @@ - + + + @@ -61,7 +51,20 @@ Index: openacs-4/packages/assessment/lib/section-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/assessment/lib/section-items.tcl 9 Jun 2005 19:19:47 -0000 1.10 +++ openacs-4/packages/assessment/lib/section-items.tcl 12 Jun 2006 02:49:50 -0000 1.11 @@ -1,3 +1,4 @@ +as::assessment::data -assessment_id $assessment_id ad_form -name admin_section -form { {section_id:text(hidden) {value $section_id}} } @@ -30,8 +31,8 @@ ns_log notice "[llength $checks]" foreach check_sql $checks { set cond_list [split $check_sql "="] - set item_id [lindex [split [lindex $cond_list 2] " "] 0] - if {$item_id == $as_item_id} { + set item_id [lindex [split [lindex $cond_list 2] ")"] 0] + if {$item_id == $as_item_id_i} { incr checks_related } Index: openacs-4/packages/assessment/lib/section-items.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.xql,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/assessment/lib/section-items.xql 18 Apr 2005 10:20:40 -0000 1.9 +++ openacs-4/packages/assessment/lib/section-items.xql 12 Jun 2006 02:49:50 -0000 1.10 @@ -4,14 +4,15 @@ - select i.as_item_id, i.subtext, cr.title, cr.description, i.field_name, + select i.as_item_id, i.subtext, cr.title, cr.description, i.field_name,asr.item_id as as_item_id_i, ism.required_p, ism.section_id, ism.sort_order, ism.max_time_to_complete, ism.points - from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism + from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism, cr_revisions asr where ci.item_id = cr.item_id and cr.revision_id = i.as_item_id and i.as_item_id = ism.as_item_id and ism.section_id = :section_id + and asr.revision_id = i.as_item_id order by ism.sort_order Index: openacs-4/packages/assessment/lib/session-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-items.adp,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/lib/session-items.adp 8 Dec 2005 11:20:45 -0000 1.8 +++ openacs-4/packages/assessment/lib/session-items.adp 12 Jun 2006 02:49:50 -0000 1.9 @@ -26,7 +26,7 @@ @@ -103,8 +109,11 @@ - + + + + +
@items.rownum@. @items.field_name@ *
@items.rownum@. @items.field_name@ *
#assessment.Edit# + + -#assessment.Copy# +#assessment.Add_New# -#assessment.Add_New# - -#assessment.Search_Item# - +#assessment.Search_Item# -#assessment.add_trigger# (@items.checks_related@) +#assessment.add_trigger# (@items.checks_related@) - - #assessment.Move_Down# - - - #assessment.Move_Up# - -#assessment.remove_item# - (#assessment.max_time# @items.max_time_to_complete@) (@items.points@ #assessment.points#) -
- @items.title;noquote@
@items.description;noquote@
+ @items.title;noquote@ + + #assessment.Edit# + #assessment.Copy# + + #assessment.Move_Down# + + + #assessment.Move_Up# + +#assessment.remove_item# + +

@items.description;noquote@
+ @@ -87,6 +90,7 @@ @items.subtext@ +
(#assessment.max_time# @items.max_time_to_complete@) - @items.result_points@ / @items.points@ #assessment.points# + @items.result_points@ / @items.points@ #assessment.points# : @items.feedback;noquote@ @@ -80,6 +80,12 @@ #assessment.Edit# + +
#assessment.not_yet_reviewed#
+
#assessment.not_answered#
+
+ #assessment.Edit# +
@items.html;noquote@ + @items.html;noquote@ + + + Index: openacs-4/packages/assessment/lib/session-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-items.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/assessment/lib/session-items.tcl 20 May 2006 16:38:05 -0000 1.9 +++ openacs-4/packages/assessment/lib/session-items.tcl 12 Jun 2006 02:49:50 -0000 1.10 @@ -11,10 +11,15 @@ set default_value [as::item_data::get -subject_id $subject_id -as_item_id $as_item_id -session_id $session_id] set presentation_type [as::item_form::add_item_to_form -name session_results_$section_id -section_id $section_id -item_id $as_item_id -session_id $session_id -default_value $default_value -show_feedback $show_feedback] + if {$presentation_type == "fitb"} { regsub -all -line -nocase -- { +
QuestionResponse
@items.title@: @items.value@
+ Index: openacs-4/packages/assessment/lib/session-show.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-show.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/session-show.tcl 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,51 @@ +db_multirow -extend { value } items session_items { + + select i.as_item_id, i.subtext, cr.title, cr.description, ci.name, + ism.required_p, ism.section_id, ism.sort_order, i.feedback_right, + i.feedback_wrong, ism.max_time_to_complete, ism.points, o.creation_user + from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism, + as_session_items si, acs_objects o + where ci.item_id = cr.item_id + and cr.revision_id = i.as_item_id + and i.as_item_id = ism.as_item_id + and ism.section_id = si.section_id + and ism.as_item_id = si.as_item_id + and si.session_id = :session_id + and si.session_id = o.object_id + order by si.sort_order +} { + + # TODO - you can grab these values at the same time you grab the sections - el\ +imination a query each time + # OR, you can grab these all at once and set variables + + + set default_value [as::item_data::get -subject_id $creation_user -as_item_id $as_item_id -session_id $session_id] + array set values $default_value + + #TODO - see if we need this + array set item_info [as::item::item_data -as_item_id $as_item_id] + set presentation_type $item_info(display_type) + set item_type $item_info(item_type) + + if {[array size values] == 0} { + set value "" + } else { + if {$item_type == "mc"} { + + set choice_id $values(choice_answer) + set value [db_string get_choice_value { + select title from cr_revisions, as_item_choices + where cr_revisions.revision_id = as_item_choices.choice_id + and choice_id = :choice_id + } + ] + } else { + + set value "$values(text_answer) $values(integer_answer) $values(numeric_answer) $values(content_answer) $values(boolean_answer) $values(clob_answer) $values(timestamp_answer)" + } + } +} + + + Index: openacs-4/packages/assessment/sql/oracle/assessment-actions-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-actions-package-create.sql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/sql/oracle/assessment-actions-package-create.sql 13 Mar 2005 22:08:44 -0000 1.5 +++ openacs-4/packages/assessment/sql/oracle/assessment-actions-package-create.sql 12 Jun 2006 02:49:50 -0000 1.6 @@ -127,9 +127,11 @@ db_transaction { array set user_new_info [auth::create_user -username $user_name -email $email -first_names $first_names -last_name $last_name -password $password] } + set admin_user_id [as::actions::get_admin_user_id] set administration_name [db_string admin_name "select first_names || '' '' || last_name from persons where person_id = :admin_user_id"] + set system_name [ad_system_name] set system_url [ad_parameter -package_id [ad_acs_kernel_id] SystemURL ""]. set admin_email [db_string unused "select email from parties where party_id = :admin_user_id"] @@ -179,9 +181,26 @@ name => 'Add to Community', description => 'Add user to a community', tcl_code => 'set user_id [ad_conn user_id] +if { [exists_and_not_null subject_id] } { + set user_id $subject_id +} dotlrn_privacy::set_user_guest_p -user_id $user_id -value "t" dotlrn::user_add -can_browse -user_id $user_id -dotlrn_community::add_user_to_community -community_id $community_id -user_id $user_id', +dotlrn_community::add_user_to_community -community_id $community_id -user_id $user_id +set community_name [db_string get_community_name { select pretty_name from dotlrn_communities where community_id = :community_id}] + +set subject "Your $community_name membership has been approved" +set message "Your $community_name membership has been approved. Please return to [ad_url] to log into [ad_system_name]." + +set email_from [ad_parameter -package_id [ad_acs_kernel_id] SystemOwner] + +db_1row select_user_info { select email, first_names, last_name from registered_users where user_id = :user_id} + +if [catch {ns_sendmail $email $email_from $subject $message} errmsg] { + ad_return_error \ + "Error sending mail" \ + "There was an error sending email to $email." +}', context_id => context_id, creation_user => creation_user ); Index: openacs-4/packages/assessment/sql/oracle/assessment-checks-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-checks-package-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/sql/oracle/assessment-checks-package-create.sql 28 Jan 2005 20:37:19 -0000 1.1 +++ openacs-4/packages/assessment/sql/oracle/assessment-checks-package-create.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -21,7 +21,7 @@ creation_date in acs_objects.creation_date%TYPE ) return as_inter_item_checks.inter_item_check_id%TYPE; - procedure delete ( + procedure del ( inter_item_check_id in as_inter_item_checks.inter_item_check_id%TYPE ); end as_inter_item_check; @@ -67,21 +67,21 @@ end new; - -- body for procedure delete - procedure delete ( + -- body for procedure del + procedure del ( inter_item_check_id in as_inter_item_checks.inter_item_check_id%TYPE ) is begin delete from as_actions_log where - inter_item_check_id = as_inter_item_check.delete.inter_item_check_id; + inter_item_check_id = as_inter_item_check.del.inter_item_check_id; - delete from as_param_map where inter_item_check_id= as_inter_item_check.delete.inter_item_check_id; + delete from as_param_map where inter_item_check_id= as_inter_item_check.del.inter_item_check_id; - delete from as_action_map where inter_item_check_id = as_inter_item_check.delete.inter_item_check_id; + delete from as_action_map where inter_item_check_id = as_inter_item_check.del.inter_item_check_id; - delete from as_inter_item_checks where inter_item_check_id = as_inter_item_check.delete.inter_item_check_id; - acs_object.del (as_inter_item_check.delete.inter_item_check_id); - end delete; + delete from as_inter_item_checks where inter_item_check_id = as_inter_item_check.del.inter_item_check_id; + acs_object.del (as_inter_item_check.del.inter_item_check_id); + end del; end as_inter_item_check; / Index: openacs-4/packages/assessment/sql/oracle/assessment-item-type-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-item-type-create.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/sql/oracle/assessment-item-type-create.sql 21 Feb 2005 14:32:55 -0000 1.4 +++ openacs-4/packages/assessment/sql/oracle/assessment-item-type-create.sql 12 Jun 2006 02:49:50 -0000 1.5 @@ -99,7 +99,9 @@ -- order in which the choices will appear (numerical, alphabetic, randomized or by order of entry) sort_order_type varchar(20), -- the orientation between the "question part" of the Item (the title/subtext) and the "answer part" (beside-left, beside-right, bellow, above) - item_answer_alignment varchar(20) + item_answer_alignment varchar(20), + -- prepend an empty item to the list, useful for validation of a required sb but you don't want any option as selected by default + prepend_empty_p char(1) default 'f' ); -- Textbox Display Type Index: openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql 9 Apr 2005 22:39:27 -0000 1.6 +++ openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql 12 Jun 2006 02:49:50 -0000 1.7 @@ -91,12 +91,12 @@ constraint as_assessments_random_p_ck check (random_p in ('t','f')), -- the customizable entry page that will be displayed before the first response. - entry_page varchar(50), + entry_page varchar(4000), -- customizable exit / thank you page that will be displayed once the assessment has been responded. - exit_page varchar(50), + exit_page varchar(4000), consent_page clob, -- URL the respondee will be redirected to after finishing the assessment - return_url varchar(50), + return_url varchar(4000), -- at what time shall the assessment become available to the users start_time date, -- at what time the assessment becomes unavailable @@ -122,7 +122,8 @@ -- differenciate between an assessment and a survey survey_p char(1) default 'f' constraint as_assessments_survey_p_ck - check (survey_p in ('t', 'f')) + check (survey_p in ('t', 'f')), + type integer ); -- Style Options Index: openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.10d10-0.10d11.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.10d10-0.10d11.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.10d10-0.10d11.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,5 @@ +alter table as_assessments add ( + random_p char(1) default 't' + constraint as_assessments_random_p_ck + check (random_p in ('t','f')) +); Index: openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.11-0.12.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.11-0.12.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.11-0.12.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,26 @@ +alter table as_item_data add column file_id integer constraint as_item_data_file_id_fk references cr_revisions(revision_id); +insert into as_item_types_map (item_type, display_type) values ('fu', 'f'); + +-- File Upload Item +create table as_item_type_fu ( + as_item_type_id integer + constraint as_item_type_fu_as_item_type_id_pk + primary key + constraint as_item_type_fu_as_item_type_id_fk + references cr_revisions(revision_id) +); + +-- File Upload Display Type +create table as_item_display_f ( + as_item_display_id integer + constraint as_item_display_f_as_item_display_id_pk + primary key + constraint as_item_display_f_as_item_display_id_fk + references cr_revisions(revision_id), + -- field to specify other stuff like textarea dimensions + html_display_options varchar(50), + -- an abstraction of the real size value in "small","medium","large" + abs_size varchar(10), + -- the orientation between the "question part" of the Item (the title/subtext) and the "answer part" (beside-left, beside-right, bellow, above) + item_answer_alignment varchar(20) +); Index: openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.12-0.13.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.12-0.13.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.12-0.13.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1 @@ +alter table as_assessments add column type integer; \ No newline at end of file Index: openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.17-0.18.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.17-0.18.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.17-0.18.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,7 @@ +-- upgrade the column size +drop view as_assessmentsx; +drop view as_assessmentsi; +alter table as_assessments alter column entry_page type varchar(4000); +alter table as_assessments alter column exit_page type varchar(4000); +alter table as_assessments alter column return_url type varchar(4000); +select content_type__refresh_view('as_assessments'); \ No newline at end of file Index: openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.19-0.20.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.19-0.20.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.19-0.20.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,17 @@ +update acs_objects set context_id=(select parent_id + from cr_items + where item_id=object_id) + where object_id in + (select item_id + from cr_items + where content_type='as_assessments'); + +update acs_objects set context_id=package_id +where object_id in (select cf.folder_id + from cr_folders cf, + cr_items ci, + apm_packages p + where ci.parent_id=-100 + and ci.item_id=cf.folder_id + and p.package_key='assessment' + and p.package_id=cf.package_id); Index: openacs-4/packages/assessment/sql/postgresql/assessment-actions-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-actions-create.sql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/sql/postgresql/assessment-actions-create.sql 9 Jun 2005 19:19:47 -0000 1.8 +++ openacs-4/packages/assessment/sql/postgresql/assessment-actions-create.sql 12 Jun 2006 02:49:50 -0000 1.9 @@ -221,9 +221,27 @@ ''Add to Community'', ''Add user to a community'', ''set user_id [ad_conn user_id] +if { [exists_and_not_null subject_id] } { + set user_id $subject_id +} dotlrn_privacy::set_user_guest_p -user_id $user_id -value "t" dotlrn::user_add -can_browse -user_id $user_id -dotlrn_community::add_user_to_community -community_id $community_id -user_id $user_id'', +dotlrn_community::add_user_to_community -community_id $community_id -user_id $user_id + +set community_name [db_string get_community_name { select pretty_name from dotlrn_communities where community_id = :community_id}] + +set subject "Your $community_name membership has been approved" +set message "Your $community_name membership has been approved. Please return to [ad_url] to log into [ad_system_name]." + +set email_from [ad_parameter -package_id [ad_acs_kernel_id] SystemOwner] + +db_1row select_user_info { select email, first_names, last_name from registered_users where user_id = :user_id} + +if [catch {ns_sendmail $email $email_from $subject $message} errmsg] { + ad_return_error \ + "Error sending mail" \ + "There was an error sending email to $email." +}'', new__package_id, new__creation_user, new__package_id Index: openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql 21 Feb 2005 14:32:55 -0000 1.9 +++ openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql 12 Jun 2006 02:49:50 -0000 1.10 @@ -116,7 +116,10 @@ references cr_revisions, -- This field stores the signed entered data signed_data varchar(500), - points integer + points integer, + file_id integer + constraint as_item_data_file_id_fk + references cr_revisions(revision_id) -- to do: figure out how attachment answers should be supported; the Attachment package is still in need of considerable help. Can we rely on it here? ); Index: openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql,v diff -u -N -r1.16 -r1.17 --- openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql 15 Apr 2005 17:26:45 -0000 1.16 +++ openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql 12 Jun 2006 02:49:50 -0000 1.17 @@ -31,7 +31,9 @@ -- wrong feedback feedback_wrong text, -- number of points for item; might be used for defining difficulty levels - points integer + points integer, + -- ad_form validation block + validate_block text ); -- contains additional information for all multiple choices (radiobutton, checkbox) @@ -124,3 +126,4 @@ -- order in which the messages appear sort_order integer ); + Index: openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql 21 Feb 2005 14:32:55 -0000 1.9 +++ openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql 12 Jun 2006 02:49:50 -0000 1.10 @@ -99,7 +99,10 @@ -- order in which the choices will appear (numerical, alphabetic, randomized or by order of entry) sort_order_type varchar(20), -- the orientation between the "question part" of the Item (the title/subtext) and the "answer part" (beside-left, beside-right, bellow, above) - item_answer_alignment varchar(20) + item_answer_alignment varchar(20), + + -- prepend an empty item to the list, useful for validation of a required sb but you don't want any option as selected by default + prepend_empty_p char(1) default 'f' ); -- Textbox Display Type @@ -165,3 +168,28 @@ -- the orientation between the "question part" of the Item (the title/subtext) and the "answer part" (beside-left, beside-right, bellow, above) item_answer_alignment varchar(20) ); + + +-- File Upload Item +create table as_item_type_fu ( + as_item_type_id integer + constraint as_item_type_fu_as_item_type_id_pk + primary key + constraint as_item_type_fu_as_item_type_id_fk + references cr_revisions(revision_id) +); + +-- File Upload Display Type +create table as_item_display_f ( + as_item_display_id integer + constraint as_item_display_f_as_item_display_id_pk + primary key + constraint as_item_display_f_as_item_display_id_fk + references cr_revisions(revision_id), + -- field to specify other stuff like textarea dimensions + html_display_options varchar(50), + -- an abstraction of the real size value in "small","medium","large" + abs_size varchar(10), + -- the orientation between the "question part" of the Item (the title/subtext) and the "answer part" (beside-left, beside-right, bellow, above) + item_answer_alignment varchar(20) +); Index: openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql,v diff -u -N -r1.17 -r1.18 --- openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 9 Apr 2005 22:39:27 -0000 1.17 +++ openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 12 Jun 2006 02:49:50 -0000 1.18 @@ -91,12 +91,12 @@ constraint as_assessments_random_p_ck check (random_p in ('t','f')), -- the customizable entry page that will be displayed before the first response. - entry_page varchar(50), + entry_page varchar(200), -- customizable exit / thank you page that will be displayed once the assessment has been responded. - exit_page varchar(50), + exit_page varchar(200), consent_page text, -- URL the respondee will be redirected to after finishing the assessment - return_url varchar(50), + return_url varchar(200), -- at what time shall the assessment become available to the users start_time timestamptz, -- at what time the assessment becomes unavailable @@ -122,7 +122,8 @@ -- differenciate between an assessment and a survey survey_p char(1) default 'f' constraint as_assessments_survey_p_ck - check (survey_p in ('t', 'f')) + check (survey_p in ('t', 'f')), + type integer ); -- Style Options Index: openacs-4/packages/assessment/sql/postgresql/assessment-types-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-types-create.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/sql/postgresql/assessment-types-create.sql 23 Jan 2005 18:10:48 -0000 1.3 +++ openacs-4/packages/assessment/sql/postgresql/assessment-types-create.sql 12 Jun 2006 02:49:50 -0000 1.4 @@ -25,6 +25,8 @@ values ('mc', 'cb'); insert into as_item_types_map (item_type, display_type) values ('mc', 'sb'); +insert into as_item_types_map (item_type, display_type) +values ('fu', 'f'); -- insert into as_item_types_map (item_type, display_type) -- values ('ca', 'tb'); -- insert into as_item_types_map (item_type, display_type) Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.11-0.12.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.11-0.12.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.11-0.12.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,26 @@ +alter table as_item_data add column file_id integer constraint as_item_data_file_id_fk references cr_revisions(revision_id); +insert into as_item_types_map (item_type, display_type) values ('fu', 'f'); + +-- File Upload Item +create table as_item_type_fu ( + as_item_type_id integer + constraint as_item_type_fu_as_item_type_id_pk + primary key + constraint as_item_type_fu_as_item_type_id_fk + references cr_revisions(revision_id) +); + +-- File Upload Display Type +create table as_item_display_f ( + as_item_display_id integer + constraint as_item_display_f_as_item_display_id_pk + primary key + constraint as_item_display_f_as_item_display_id_fk + references cr_revisions(revision_id), + -- field to specify other stuff like textarea dimensions + html_display_options varchar(50), + -- an abstraction of the real size value in "small","medium","large" + abs_size varchar(10), + -- the orientation between the "question part" of the Item (the title/subtext) and the "answer part" (beside-left, beside-right, bellow, above) + item_answer_alignment varchar(20) +); Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.12-0.13.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.12-0.13.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.12-0.13.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1 @@ +alter table as_assessments add column type integer; \ No newline at end of file Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.15-0.16.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.15-0.16.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.15-0.16.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,12 @@ +-- +-- packages/assessment/sql/postgresql/upgrade/upgrade-0.15-0.16.sql +-- +-- @author Roel Canicula (roel@solutiongrove.com) +-- @creation-date 2005-10-30 +-- @arch-tag: 4fdc81f0-2150-489c-9fd9-c23595b59559 +-- @cvs-id $Id: upgrade-0.15-0.16.sql,v 1.2 2006/06/12 02:49:50 daveb Exp $ +-- + +alter table as_item_display_sb add prepend_empty_p char(1); +alter table as_item_display_sb alter prepend_empty_p set default 'f'; +update as_item_display_sb set prepend_empty_p = 'f'; \ No newline at end of file Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.16-0.17.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.16-0.17.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.16-0.17.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,10 @@ +-- +-- packages/assessment/sql/postgresql/upgrade/upgrade-0.16-0.17.sql +-- +-- @author Roel Canicula (roel@solutiongrove.com) +-- @creation-date 2006-01-25 +-- @arch-tag: 63dc39c9-c94d-454b-ac93-b81135ebb6ae +-- @cvs-id $Id: upgrade-0.16-0.17.sql,v 1.2 2006/06/12 02:49:50 daveb Exp $ +-- + +alter table as_items add validate_block text; Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.17-0.18.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.17-0.18.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.17-0.18.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,20 @@ +-- upgrade the column size +drop view as_assessmentsx; +drop view as_assessmentsi; + +alter table as_assessments rename entry_page to entry_page_old; +alter table as_assessments add entry_page varchar(4000); +update as_assessments set entry_page = entry_page_old; +alter table as_assessments drop entry_page_old; + +alter table as_assessments rename exit_page to exit_page_old; +alter table as_assessments add exit_page varchar(4000); +update as_assessments set exit_page = exit_page_old; +alter table as_assessments drop exit_page_old; + +alter table as_assessments rename return_url to return_url_old; +alter table as_assessments add return_url varchar(4000); +update as_assessments set return_url = return_url_old; +alter table as_assessments drop return_url_old; + +select content_type__refresh_view('as_assessments'); \ No newline at end of file Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.19-0.20.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.19-0.20.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.19-0.20.sql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,17 @@ +update acs_objects set context_id=(select parent_id + from cr_items + where item_id=object_id) + where object_id in + (select item_id + from cr_items + where content_type='as_assessments'); + +update acs_objects set context_id=package_id +where object_id in (select cf.folder_id + from cr_folders cf, + cr_items ci, + apm_packages p + where ci.parent_id=-100 + and ci.item_id=cf.folder_id + and p.package_key='assessment' + and p.package_id=cf.package_id); Index: openacs-4/packages/assessment/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/apm-callback-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/apm-callback-procs.tcl 9 Jan 2006 12:23:39 -0000 1.4 +++ openacs-4/packages/assessment/tcl/apm-callback-procs.tcl 12 Jun 2006 02:49:50 -0000 1.5 @@ -21,7 +21,7 @@ # Enable the delivery intervals and delivery methods for a specific INTER_ITEM_CHECK enable_intervals_and_methods $type_id - + # Service contract implementations - fts as::sc::register_implementations } Index: openacs-4/packages/assessment/tcl/as-apm-param-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-apm-param-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-apm-param-procs.tcl 30 Mar 2005 17:38:38 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-apm-param-procs.tcl 12 Jun 2006 02:49:50 -0000 1.3 @@ -11,12 +11,12 @@ {-node_id ""} } { } { - set exist_assessment [parameter::get -parameter AsmForRegisterId] + set exist_assessment [parameter::get -parameter RegistrationId] if { $exist_assessment != 0} { set par_package_id [db_string package_id {select package_id from cr_folders where folder_id=(select context_id from acs_objects where object_id=:exist_assessment)} -default 0] if { $package_id == $par_package_id } { - parameter::set_value -package_id [ad_conn package_id] -parameter AsmForRegisterId -value 0 + parameter::set_value -package_id [ad_conn package_id] -parameter RegistrationId -value 0 } } } Index: openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql 15 Apr 2005 17:26:45 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql 12 Jun 2006 02:49:50 -0000 1.9 @@ -6,16 +6,17 @@ select a.assessment_id as assessment_rev_id, cr.item_id as assessment_id, cr.title, ci.name, - cr.description, o.creation_user, o.creation_date, a.instructions, a.run_mode, + cr.description, nvl(o.creation_user, o2.creation_user) creation_user, o.creation_date, a.instructions, a.run_mode, a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, a.password, a.show_item_name_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, a.start_time, a.end_time, a.number_tries, a.wait_between_tries, a.random_p, - a.time_for_response, a.show_feedback, a.section_navigation, a.creator_id, a.survey_p - from as_assessments a, cr_revisions cr, cr_items ci, acs_objects o + a.time_for_response, a.show_feedback, a.section_navigation, a.creator_id, a.survey_p, a.type, cr.title as html_title + from as_assessments a, cr_revisions cr, cr_items ci, acs_objects o, acs_objects o2 where ci.item_id = :assessment_id and cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and o.object_id = ci.item_id + and o2.object_id = cr.revision_id @@ -58,4 +59,43 @@ + + + + select nvl(sum(m.points), 0) as section_max_points, nvl(sum(d.points), 0) as section_points + from as_assessment_section_map m, as_section_data d + where m.assessment_id = :assessment_id + and m.section_id = d.section_id + and d.session_id = :session_id + + + + + + + update as_assessments set + instructions=empty_clob(),consent_page=empty_clob() + where assessment_id=:as_assessment_id + returning instructions, consent_page into :1, :2 + + + + + + update as_assessments set + instructions=empty_clob(),consent_page=empty_clob() + where assessment_id=:new_rev_id + returning instructions, consent_page into :1, :2 + + + + + + update as_assessments set + instructions=empty_clob(),consent_page=empty_clob() + where assessment_id=:new_rev_id + returning instructions, consent_page into :1, :2 + + + Index: openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql 15 Apr 2005 17:26:45 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql 12 Jun 2006 02:49:50 -0000 1.9 @@ -6,16 +6,17 @@ select a.assessment_id as assessment_rev_id, cr.item_id as assessment_id, cr.title, ci.name, - cr.description, o.creation_user, o.creation_date, a.instructions, a.run_mode, + cr.description, coalesce(o.creation_user, o2.creation_user) as creation_user, o.creation_date, a.instructions, a.run_mode, a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, a.password, a.show_item_name_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, a.start_time, a.end_time, a.number_tries, a.wait_between_tries, a.random_p, - a.time_for_response, a.show_feedback, a.section_navigation, a.creator_id, a.survey_p - from as_assessments a, cr_revisions cr, cr_items ci, acs_objects o + a.time_for_response, a.show_feedback, a.section_navigation, a.creator_id, a.survey_p, a.type, cr.title as html_title + from as_assessments a, cr_revisions cr, cr_items ci, acs_objects o, acs_objects o2 where ci.item_id = :assessment_id and cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and o.object_id = ci.item_id + and o2.object_id = cr.revision_id @@ -58,4 +59,40 @@ + + + + select coalesce(sum(m.points), 0) as section_max_points, coalesce(sum(d.points), 0) as section_points + from as_assessment_section_map m, as_section_data d + where m.assessment_id = :assessment_id + and m.section_id = d.section_id + and d.session_id = :session_id + + + + + + + update as_assessments set + instructions=:instructions, consent_page=:consent_page + where assessment_id=:as_assessment_id + + + + + + update as_assessments set + instructions=:instructions, consent_page=:consent_page + where assessment_id=:new_rev_id + + + + + + update as_assessments set + instructions=:instructions, consent_page=:consent_page + where assessment_id=:new_rev_id + + + Index: openacs-4/packages/assessment/tcl/as-assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.tcl,v diff -u -N -r1.28 -r1.29 --- openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 23 Jan 2006 16:32:52 -0000 1.28 +++ openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 12 Jun 2006 02:49:50 -0000 1.29 @@ -32,15 +32,19 @@ {-show_feedback ""} {-section_navigation ""} {-survey_p ""} + {-package_id ""} + {-type ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-07-26 New assessment to the database } { - set package_id [ad_conn package_id] + if { ![exists_and_not_null package_id] } { set package_id [ad_conn package_id] } set folder_id [as::assessment::folder_id -package_id $package_id] + if { [empty_string_p $creator_id] } { set creator_id [ad_conn user_id]} + # Insert as_assessment in the CR (and as_assessments table) getting the revision_id (as_assessment_id) db_transaction { set assessment_item_id [db_nextval acs_object_id_seq] @@ -52,15 +56,16 @@ -parent_id $folder_id \ -creation_user $creator_id \ -content_type {as_assessments} \ - -name $name] + -name $name \ + -package_id $package_id \ + -context_id $folder_id] set as_assessment_id [content::revision::new \ -item_id $assessment_item_id \ -content_type {as_assessments} \ -title $title \ -description $description \ -attributes [list [list creator_id $creator_id] \ - [list instructions $instructions] \ [list run_mode $run_mode] \ [list anonymous_p $anonymous_p] \ [list secure_access_p $secure_access_p] \ @@ -69,7 +74,6 @@ [list random_p $random_p] \ [list entry_page $entry_page] \ [list exit_page $exit_page] \ - [list consent_page $consent_page] \ [list return_url $return_url] \ [list start_time $start_time] \ [list end_time $end_time] \ @@ -80,9 +84,13 @@ [list password $password] \ [list show_feedback $show_feedback] \ [list section_navigation $section_navigation] \ - [list survey_p $survey_p]] ] + [list survey_p $survey_p] \ + [list package_id $package_id] \ + [list type $type]]] + } - + db_dml update_clobs {} -clobs [list $instructions $consent_page] + return $as_assessment_id } @@ -111,6 +119,7 @@ {-password ""} {-show_feedback ""} {-section_navigation ""} + {-type ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-10-26 @@ -127,7 +136,6 @@ -title $title \ -description $description \ -attributes [list [list creator_id $creator_id] \ - [list instructions $instructions] \ [list run_mode $run_mode] \ [list anonymous_p $anonymous_p] \ [list secure_access_p $secure_access_p] \ @@ -136,7 +144,6 @@ [list random_p $random_p] \ [list entry_page $entry_page] \ [list exit_page $exit_page] \ - [list consent_page $consent_page] \ [list return_url $return_url] \ [list start_time $start_time] \ [list end_time $end_time] \ @@ -146,8 +153,9 @@ [list ip_mask $ip_mask] \ [list password $password] \ [list show_feedback $show_feedback] \ - [list section_navigation $section_navigation] ] ] - + [list section_navigation $section_navigation] \ + [list type $type]] ] + db_dml update_clobs {} -clobs [list $instructions $consent_page] copy_sections -assessment_id $assessment_rev_id -new_assessment_id $new_rev_id } @@ -178,8 +186,9 @@ # own way return } - + set assessment_data(creator_name) [person::name -person_id $assessment_data(creation_user)] + set assessment_data(title) [as::assessment::title -title $assessment_data(title)] } ad_proc -public as::assessment::new_revision { @@ -200,7 +209,6 @@ -title $a(title) \ -description $a(description) \ -attributes [list [list creator_id $a(creator_id)] \ - [list instructions $a(instructions)] \ [list run_mode $a(run_mode)] \ [list anonymous_p $a(anonymous_p)] \ [list secure_access_p $a(secure_access_p)] \ @@ -209,7 +217,6 @@ [list random_p $a(random_p)] \ [list entry_page $a(entry_page)] \ [list exit_page $a(exit_page)] \ - [list consent_page $a(consent_page)] \ [list return_url $a(return_url)] \ [list start_time $a(start_time)] \ [list end_time $a(end_time)] \ @@ -219,8 +226,13 @@ [list ip_mask $a(ip_mask)] \ [list password $a(password)] \ [list show_feedback $a(show_feedback)] \ - [list section_navigation $a(section_navigation)] ] ] + [list section_navigation $a(section_navigation)] \ + [list type $a(type)]]] + set instructions $a(instructions) + set consent_page $a(consent_page) + db_dml update_clobs {} -clobs [list $a(instructions) $a(consent_page)] + copy_sections -assessment_id $a(assessment_rev_id) -new_assessment_id $new_rev_id copy_categories -from_id $a(assessment_rev_id) -to_id $new_rev_id } @@ -232,6 +244,7 @@ {-assessment_id:required} {-name ""} {-folder_id ""} + {-new_title ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-01-23 @@ -245,7 +258,11 @@ data -assessment_id $assessment_id array set a [array get assessment_data] - append a(title) "[_ assessment.copy_appendix]" + if {[empty_string_p $new_title]} { + append a(title) "[_ assessment.copy_appendix]" + } else { + set a(title) $new_title + } db_transaction { set new_assessment_id [db_nextval acs_object_id_seq] @@ -279,7 +296,8 @@ [list ip_mask $a(ip_mask)] \ [list password $a(password)] \ [list show_feedback $a(show_feedback)] \ - [list section_navigation $a(section_navigation)] ] ] + [list section_navigation $a(section_navigation)] \ + [list type $a(type)]] ] copy_sections -assessment_id $a(assessment_rev_id) -new_assessment_id $new_rev_id copy_categories -from_id $a(assessment_rev_id) -to_id $new_rev_id @@ -554,6 +572,18 @@ } } - if { [empty_string_p $creator_id] } { set creator_id [ad_conn user_id]} +ad_proc -private as::assessment::title { + -title +} { + @annyflores@viaro.net + Remove html tags from assessment title +} { + + regsub -all {\<[a-zA-Z]*\>} $title "" title + regsub -all {} $title "" title + regsub -all {} $title "" title + + return $title +} Index: openacs-4/packages/assessment/tcl/as-assessment-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.xql,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/assessment/tcl/as-assessment-procs.xql 23 Jan 2005 18:10:48 -0000 1.9 +++ openacs-4/packages/assessment/tcl/as-assessment-procs.xql 12 Jun 2006 02:49:50 -0000 1.10 @@ -76,18 +76,6 @@ - - - - select sum(m.points) as section_max_points, sum(d.points) as section_points - from as_assessment_section_map m, as_section_data d - where m.assessment_id = :assessment_id - and m.section_id = d.section_id - and d.session_id = :session_id - - - - Index: openacs-4/packages/assessment/tcl/as-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-callback-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-callback-procs.tcl 25 May 2006 13:14:24 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-callback-procs.tcl 12 Jun 2006 02:49:50 -0000 1.6 @@ -9,102 +9,72 @@ this is the lors qti importer } { if {$res_type == "imsqti_xmlv1p0" || $res_type == "imsqti_xmlv1p1" || $res_type =="imsqti_item_xmlv2p0"} { - return [as::qti::register \ - -tmp_dir $tmp_dir/$res_href \ - -community_id $community_id] + return [as::qti::register \ + -tmp_dir $tmp_dir/$res_href \ + -community_id $community_id] } } - ad_proc -public -callback imsld::import -impl qti {} { this is the imsld qti importer } { - if {$res_type == "imsqti_xmlv1p0" || $res_type == "imsqti_xmlv1p1" || $res_type =="imsqti_item_xmlv2p0"} { - return [as::qti::register_xml_object_id \ - -xml_file $tmp_dir/$res_href \ - -community_id $community_id] - } + if {$res_type == "imsqti_xmlv1p0" || $res_type == "imsqti_xmlv1p1" || $res_type =="imsqti_item_xmlv2p0"} { + return [as::qti::register_xml_object_id \ + -xml_file $tmp_dir/$res_href \ + -community_id $community_id] + } } -ad_proc -callback application-track::getApplicationName -impl assessments {} { - callback implementation - } { - return "assessments" - } + + +ad_proc -callback merge::MergeShowUserInfo -impl as { + -user_id:required +} { + Shows assessments items +} { + set msg "Assessment items of user $user_id" + set result [list $msg] + + lappend result [list "Staff of sessions: [db_list sel_sessions { *SQL* }] "] + lappend result [list "Subject of sessions: [db_list sel_sessions2 {*SQL*}] "] + + lappend result [list "Subject of section data id: [db_list sel_sections { *SQL* }] "] + lappend result [list "Staff of section data id: [db_list sel_sections2 { *SQL* }] "] + + lappend result [list "Subject of item data id : [db_list sel_items { *SQL* }] "] + lappend result [list "Staff of item_data_id: [db_list sel_items2 { *SQL* }] "] - ad_proc -callback application-track::getGeneralInfo -impl assessments {} { - callback implementation - } { - db_1row my_query { - select count(1) as result - FROM as_assessments a,dotlrn_communities_all com, acs_objects ac, acs_objects ac2,acs_objects ac3,cr_revisions cr, cr_items ci, cr_folders cf - WHERE com.community_id = :comm_id - and a.assessment_id = ac.object_id - and ac.context_id = ac2.object_id - and ac2.package_id = ac3.object_id - and ac3.context_id = com.package_id - and cr.revision_id = ci.latest_revision - and ci.parent_id = cf.folder_id - and a.assessment_id = cr.revision_id - } + return $result +} + +ad_proc -callback merge::MergePackageUser -impl as { + -from_user_id:required + -to_user_id:required +} { + Merge the as's of two users. + The from_user_id is the user that will be + deleted and all the entries of this user + will be mapped to the to_user_id. + +} { + set msg "Merging assesment" + set result [list $msg] + ns_log Notice $msg + db_transaction { + db_dml upd_from_sessions { *SQL* } + db_dml upd_from_sessions2 { *SQL* } + db_dml upd_from_sections { *SQL* } + db_dml upd_from_sections2 { *SQL* } + db_dml upd_from_items { *SQL* } + db_dml upd_from_items2 { *SQL* } - return "$result" } - - ad_proc -callback application-track::getSpecificInfo -impl assessments {} { - callback implementation - } { - - upvar $query_name my_query - upvar $elements_name my_elements + lappend result "assessment merge is done" + return $result +} - set my_query { - SELECT ac.title as name,assessment_id as id,a.start_time as initial_date, - a.end_time as finish_date, - a.number_tries as number_tries - FROM as_assessments a,dotlrn_communities_all com, acs_objects ac, acs_objects ac2,acs_objects ac3,cr_revisions cr, cr_items ci, cr_folders cf - WHERE com.community_id = :class_instance_id - and a.assessment_id = ac.object_id - and ac.context_id = ac2.object_id - and ac2.package_id = ac3.object_id - and ac3.context_id = com.package_id - and cr.revision_id = ci.latest_revision - and ci.parent_id = cf.folder_id - and a.assessment_id = cr.revision_id - - } - - set my_elements { - - name { - label "name" - display_col name - html {align center} - - } - - id { - label "id" - display_col id - html {align center} - } - creation_date { - label "creation_date" - display_col initial_date - html {align center} - } - finish_date { - label "finish_date" - display_col finish_date - html {align center} - } - number_tries { - label "number_tries" - display_col number_tries - html {align center} - } - - - } - return "OK" - } \ No newline at end of file + +ad_proc -public -callback imsld::finish_object { + -object_id +} { +} Index: openacs-4/packages/assessment/tcl/as-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-callback-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-callback-procs.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,100 @@ + + + + + + select session_id + from as_sessions + where staff_id = :user_id + + + + + + select session_id + from as_sessions + where subject_id = :user_id + + + + + + select section_data_id + from as_section_data + where subject_id = :user_id + + + + + + select section_data_id + from as_section_data + where staff_id = :user_id + + + + + + select item_data_id + from as_item_data + where subject_id = :user_id + + + + + + select item_data_id + from as_item_data + where staff_id = :user_id + + + + + + update as_sessions + set staff_id = :to_user_id + where staff_id = :from_user_id + + + + + + update as_sessions + set subject_id = :to_user_id + where subject_id = :from_user_id + + + + + + update as_section_data + set subject_id = :to_user_id + where subject_id = :from_user_id + + + + + + update as_section_data + set staff_id = :to_user_id + where staff_id = :from_user_id + + + + + + update as_item_data + set subject_id = :to_user_id + where subject_id = :from_user_id + + + + + + update as_item_data + set staff_id = :to_user_id + where staff_id = :from_user_id + + + + \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql 3 Mar 2005 22:46:41 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql 12 Jun 2006 02:49:50 -0000 1.8 @@ -21,7 +21,7 @@ begin - as_inter_item_check.delete(:check_id); + as_inter_item_check.del(:check_id); end; @@ -55,11 +55,11 @@ begin - as_inter_item_check.delete(:check_id); + as_inter_item_check.del(:check_id); end; - \ No newline at end of file + Index: openacs-4/packages/assessment/tcl/as-checks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs.tcl,v diff -u -N -r1.25 -r1.26 --- openacs-4/packages/assessment/tcl/as-checks-procs.tcl 10 Jun 2005 16:11:45 -0000 1.25 +++ openacs-4/packages/assessment/tcl/as-checks-procs.tcl 12 Jun 2006 02:49:50 -0000 1.26 @@ -20,7 +20,7 @@ set package_id [ad_conn package_id] set user_id [ad_conn user_id] set permission "" - if {[permission::permission_p -object_id $package_id -party_id $user_id -privilege admin] == 0} { + if {![acs_user::site_wide_admin_p -user_id $user_id]} { set permission "and ci.item_id in (select object_id from acs_permissions where grantee_id=:user_id and privilege='admin')"} set assessment_list [list [list "[_ assessment.all]" "all"]] set assessments [db_list_of_lists assessment {}] @@ -142,8 +142,10 @@ } { } { - set check_sql "select (case when idc.choice_id=$condition then \'1\' else \'0\' end) as perform_p from as_item_data id, as_item_data_choices idc where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id" + set as_item_id [db_string get_item_id {select item_id from cr_revisions where revision_id=:item_id}] + set check_sql "select (case when idc.choice_id in (select revision_id from cr_revisions where item_id=$condition) then \'1\' else \'0\' end) as perform_p from as_item_data id, as_item_data_choices idc where id.as_item_id in (select revision_id from cr_revisions where item_id=$as_item_id) and id.item_data_id=idc.item_data_id and id.session_id=:session_id" + return $check_sql } @@ -260,7 +262,6 @@ set failed_p "t" set failed [catch $tcl_code errorMsg] - if { $failed > 0 } { set failed_p "f" } @@ -288,6 +289,7 @@ } { } { + db_0or1row subject_id {select subject_id from as_sessions where session_id=:session_id} db_foreach get_check_params { } { set parameter_name [db_1row select_name {}] @@ -342,8 +344,9 @@ foreach notify_user $admin { lappend to $notify_user } - - notification::new -type_id [notification::type::get_type_id -short_name inter_item_check_notif] -object_id $inter_item_check_id -notif_subject "$action_name has been executed" -notif_text "The action $action_name has been executed. This message has been showed to the user: $user_message" -subset $to -force -action_id $inter_item_check_id + if { [parameter::get -package_id [ad_conn package_id] -parameter NotifyAdminOfActions -default 1] } { + notification::new -type_id [notification::type::get_type_id -short_name inter_item_check_notif] -object_id $inter_item_check_id -notif_subject "$action_name has been executed" -notif_text "The action $action_name has been executed. This message has been showed to the user: $user_message" -subset $to -force -action_id $inter_item_check_id + } } @@ -450,6 +453,51 @@ } +ad_proc -public as::assessment::check::eval_or_checks { + {-session_id} + {-section_id} +} { + +} { + + set section_checks [db_list_of_lists section_checks { }] + + foreach check $section_checks { + set check_sql [lindex $check 1] + set perform [db_string check_sql $check_sql -default 0] + if {[lindex $check 2] == "t"} { + if {$perform == 1} { + as::assessment::check::action_exec -inter_item_check_id [lindex $check 0] -session_id $session_id + } + } + } +} + + +ad_proc -public as::assessment::check::eval_sa_checks { + {-session_id} + {-assessment_id} +} { + +} { + + set assessment_rev_id [db_string get_assessment_id {}] + + set checks [db_list_of_lists section_checks {}] + foreach check_id $checks { + + set info [db_0or1row check_info {}] + set perform [db_string check_sql $check_sql -default 0] + if {$action_p == "t"} { + if {$perform == 1} { + as::assessment::check::action_exec -inter_item_check_id $inter_item_check_id -session_id $session_id + } + } + } + +} + + ad_proc -public as::assessment::check::confirm_display { {-check_id} {-index} @@ -545,7 +593,7 @@ set checks [db_list_of_lists related_checks {}] foreach check $checks { set cond_list [split [lindex $check 1] "="] - set item_id [lindex [split [lindex $cond_list 2] " "] 0] + set item_id [lindex [split [lindex $cond_list 2] ")"] 0] if {$item_id == $as_item_id} { set check_id [lindex $check 0] db_exec_plsql delete_check {} @@ -568,8 +616,8 @@ set cond_list [split [lindex $check 1] "="] - set item_id [lindex [split [lindex $cond_list 2] " "] 0] - set condition [lindex [split [lindex $cond_list 1] " "] 0] + set item_id [lindex [split [lindex $cond_list 2] ")"] 0] + set condition [lindex [split [lindex $cond_list 1] ")"] 0] if {$item_id == $as_item_id} { set inter_item_check_id [lindex $check 0] @@ -610,4 +658,6 @@ foreach session_id $sessions { as::assessment::check::eval_single_check -session_id $session_id -assessment_id $assessment_id -inter_item_check_id $inter_item_check_id } -} \ No newline at end of file +} + + Index: openacs-4/packages/assessment/tcl/as-checks-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs.xql,v diff -u -N -r1.20 -r1.21 --- openacs-4/packages/assessment/tcl/as-checks-procs.xql 10 Jun 2005 16:11:45 -0000 1.20 +++ openacs-4/packages/assessment/tcl/as-checks-procs.xql 12 Jun 2006 02:49:50 -0000 1.21 @@ -157,7 +157,9 @@ - select * from as_param_map where inter_item_check_id = :inter_item_check_id + select ci.latest_revision as item_id,parameter_id, value, inter_item_check_id + from as_param_map pm,cr_items ci where inter_item_check_id = :inter_item_check_id and + ci.item_id=pm.item_id @@ -173,6 +175,7 @@ from as_item_data where session_id = :session_id and as_item_id = :item_id + and item_data_id in (select latest_revision from cr_items) @@ -200,7 +203,8 @@ - select * from as_param_map where inter_item_check_id = :inter_item_check_id + select ci.latest_revision as item_id,parameter_id, value, inter_item_check_id + from as_param_map pm, cr_items ci where inter_item_check_id = :inter_item_check_id @@ -272,6 +276,28 @@ select * from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='m' and c.assessment_id=:assessment_id order by am.order_by + + + select c.inter_item_check_id,c.check_sql,action_p from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='or' and section_id_from=:section_id order by am.order_by + + + + + select c.inter_item_check_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='sa' and c.assessment_id=:assessment_id order by am.order_by + + + + + select max(revision_id) from cr_revisions where item_id=:assessment_id + + + + + select * from as_inter_item_checks c,as_action_map am where + c.inter_item_check_id=am.inter_item_check_id and am.action_perform='sa' + and c.assessment_id=:assessment_id and c.inter_item_check_id=:check_id order by am.order_by + + select * from as_inter_item_checks where inter_item_check_id=:check_id @@ -349,5 +375,4 @@ - Index: openacs-4/packages/assessment/tcl/as-file-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-file-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-file-procs.tcl 25 Jan 2005 12:46:57 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-file-procs.tcl 12 Jun 2006 02:49:50 -0000 1.8 @@ -26,7 +26,7 @@ set filename [file tail [template::util::file::get_property filename $file_pathname]] set file_mimetype [cr_filename_to_mime_type -create $filename] set content_length [file size $file_pathname] - set content_rev_id [cr_import_content -title $file_name $folder_id $file_pathname $content_length $file_mimetype [exec uuidgen]] + set content_rev_id [cr_import_content -title $file_name $folder_id $file_pathname $content_length $file_mimetype [as::item::generate_unique_name]] return $content_rev_id } Index: openacs-4/packages/assessment/tcl/as-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-install-procs.tcl,v diff -u -N -r1.33 -r1.34 --- openacs-4/packages/assessment/tcl/as-install-procs.tcl 14 Jun 2005 16:07:15 -0000 1.33 +++ openacs-4/packages/assessment/tcl/as-install-procs.tcl 12 Jun 2006 02:49:50 -0000 1.34 @@ -24,7 +24,6 @@ if {[empty_string_p $value]} { apm_parameter_register "AsmForRegisterId" "Assessment used on the registration process." "acs-subsite" "0" "number" "user-login" } - content::type::new -content_type {as_item_choices} -supertype {content_revision} -pretty_name {Assessment Item Choice} -pretty_plural {Assessment Item Choices} -table_name {as_item_choices} -id_column {choice_id} content::type::new -content_type {as_item_sa_answers} -supertype {content_revision} -pretty_name {Assessment Item Answer} -pretty_plural {Assessment Item Answer} -table_name {as_item_sa_answers} -id_column {choice_id} @@ -66,6 +65,7 @@ content::type::attribute::new -content_type {as_item_display_sb} -attribute_name {multiple_p} -datatype {string} -pretty_name {Allow Multiple} -column_spec {char(1)} content::type::attribute::new -content_type {as_item_display_sb} -attribute_name {sort_order_type} -datatype {string} -pretty_name {Sort Order Type} -column_spec {varchar(20)} content::type::attribute::new -content_type {as_item_display_sb} -attribute_name {item_answer_alignment} -datatype {string} -pretty_name {Item Answer Alignment} -column_spec {varchar(20)} +content::type::attribute::new -content_type {as_item_display_sb} -attribute_name {prepend_empty_p} -datatype {string} -pretty_name {Prepend Empty Item} -column_spec {char(1)} # Textbox display type content::type::attribute::new -content_type {as_item_display_tb} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)} @@ -132,6 +132,7 @@ content::type::attribute::new -content_type {as_items} -attribute_name {feedback_wrong} -datatype {text} -pretty_name {Item Right Feedback} -column_spec {text} content::type::attribute::new -content_type {as_items} -attribute_name {feedback_right} -datatype {text} -pretty_name {Item Wrong Feedback} -column_spec {text} content::type::attribute::new -content_type {as_items} -attribute_name {points} -datatype {number} -pretty_name {Points awarded for this item} -column_spec {integer} +content::type::attribute::new -content_type {as_items} -attribute_name {validate_block} -datatype {text} -pretty_name {Validation Block} -column_spec {text} # Sections content::type::attribute::new -content_type {as_sections} -attribute_name {display_type_id} -datatype {number} -pretty_name {Section Display Type} -column_spec {integer} @@ -172,7 +173,9 @@ content::type::attribute::new -content_type {as_assessments} -attribute_name {show_feedback} -datatype {string} -pretty_name {Assessment Show comments to the user} -column_spec {varchar(50)} content::type::attribute::new -content_type {as_assessments} -attribute_name {section_navigation} -datatype {string} -pretty_name {Assessment Navigation of sections} -column_spec {varchar(50)} content::type::attribute::new -content_type {as_assessments} -attribute_name {survey_p} -datatype {string} -pretty_name {Survey} -column_spec {char(1)} +content::type::attribute::new -content_type {as_assessments} -attribute_name {type} -datatype {number} -pretty_name {Type} -column_spec {integer} + # Sessions content::type::attribute::new -content_type {as_sessions} -attribute_name {assessment_id} -datatype {number} -pretty_name {Assessment ID} -column_spec {integer} content::type::attribute::new -content_type {as_sessions} -attribute_name {subject_id} -datatype {number} -pretty_name {Subject ID} -column_spec {integer} @@ -215,6 +218,17 @@ # Session results content::type::attribute::new -content_type {as_session_results} -attribute_name {target_id} -datatype {number} -pretty_name {Target Answer} -column_spec {integer} content::type::attribute::new -content_type {as_session_results} -attribute_name {points} -datatype {number} -pretty_name {Points} -column_spec {integer} + +#File Upload Ansers +content::type::new -content_type {as_item_type_fu} -supertype {content_revision} -pretty_name {Assessment Item Type File Upload} -pretty_plural {Assessment Item Type File Upload} -table_name {as_item_type_fu} -id_column {as_item_type_id} + +content::type::new -content_type {as_item_display_f} -supertype {content_revision} -pretty_name {Assessment Item Display File} -pretty_plural {Assessment Item Display File} -table_name {as_item_display_f} -id_column {as_item_display_id} + +# File Upload display type +content::type::attribute::new -content_type {as_item_display_f} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)} +content::type::attribute::new -content_type {as_item_display_f} -attribute_name {abs_size} -datatype {string} -pretty_name {Abstraction Real Size} -column_spec {varchar(20)} +content::type::attribute::new -content_type {as_item_display_f} -attribute_name {box_orientation} -datatype {string} -pretty_name {Box Orientation} -column_spec {varchar(20)} + } ad_proc -public as::install::package_instantiate { @@ -224,7 +238,7 @@ } { # create a content folder - set folder_id [content::folder::new -name "assessment_$package_id" -package_id $package_id ] + set folder_id [content::folder::new -name "assessment_$package_id" -package_id $package_id -context_id $package_id] # register the allowed content types for a folder content::folder::register_content_type -folder_id $folder_id -content_type {image} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {content_revision} -include_subtypes t @@ -241,6 +255,9 @@ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_display_ta} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {as_items} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {as_section_display_types} -include_subtypes t + + content::folder::register_content_type -folder_id $folder_id -content_type {as_item_type_fu} -include_subtypes t + content::folder::register_content_type -folder_id $folder_id -content_type {as_item_display_f} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {as_sections} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {as_assessments} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {as_sessions} -include_subtypes t @@ -364,8 +381,60 @@ 0.10d11 0.10d12 { content::type::attribute::new -content_type {as_items} -attribute_name {field_name} -datatype {string} -pretty_name {Item Field Name} -column_spec {varchar(500)} } + + 0.11 0.12 { + #File Upload new type + content::type::new -content_type {as_item_type_fu} -supertype {content_revision} -pretty_name {Assessment Item Type File Upload} -pretty_plural {Assessment Item Type File Upload} -table_name {as_item_type_fu} -id_column {as_item_type_id} + content::type::new -content_type {as_item_display_f} -supertype {content_revision} -pretty_name {Assessment Item Display File} -pretty_plural {Assessment Item Display File} -table_name {as_item_display_f} -id_column {as_item_display_id} + # File Upload display type + content::type::attribute::new -content_type {as_item_display_f} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)} + content::type::attribute::new -content_type {as_item_display_f} -attribute_name {abs_size} -datatype {string} -pretty_name {Abstraction Real Size} -column_spec {varchar(20)} + content::type::attribute::new -content_type {as_item_display_f} -attribute_name {box_orientation} -datatype {string} -pretty_name {Box Orientation} -column_spec {varchar(20)} + + db_foreach packages { select package_id from apm_packages where package_key = 'assessment'} { + set folder_id [as::assessment::folder_id -package_id $package_id] + + # File Upload registration + content::folder::register_content_type -folder_id $folder_id -content_type {as_item_type_fu} -include_subtypes t + content::folder::register_content_type -folder_id $folder_id -content_type {as_item_display_f} -include_subtypes t + } + + } + 0.12 0.13 { + content::type::attribute::new -content_type {as_assessments} -attribute_name {type} -datatype {number} -pretty_name {Type} -column_spec {integer} + + } + 0.13 0.14 { + # update as_param_map table to set the item_id as a cr_item and not a cr_revision id + + db_foreach as_parameter { select cr.item_id, pm.parameter_id from as_param_map pm, cr_revisions cr where cr.revision_id = pm.item_id} { + db_dml update_parameters { update as_param_map set item_id=:item_id where parameter_id=:parameter_id} + } + + } + 0.14 0.15 { + # update as_inter_item_check_id table to set the check_sql condition using the item_id of a choice instead of using the revision_id + + db_foreach check { select inter_item_check_id, check_sql from as_inter_item_checks } { + set cond_list [split $check_sql "="] + set item_id [lindex [split [lindex $cond_list 2] " "] 0] + set choice_id [lindex [split [lindex $cond_list 1] " "] 0] + set condition [db_string get_item_id {select item_id from cr_revisions where revision_id=:choice_id} -default -1] + set check_sql_updated [as::assessment::check::get_sql -item_id $item_id -condition $condition] + if { $condition != -1 } { + db_dml update_check_sql { update as_inter_item_checks set check_sql = :check_sql_updated where inter_item_check_id=:inter_item_check_id} + } + } + + } + 0.15 0.16 { + content::type::attribute::new -content_type {as_item_display_sb} -attribute_name {prepend_empty_p} -datatype {string} -pretty_name {Prepend Empty Item} -column_spec {char(1)} + } + 0.16 0.17 { + content::type::attribute::new -content_type {as_items} -attribute_name {validate_block} -datatype {text} -pretty_name {Validation Block} -column_spec {text} + } - } + } } Index: openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl 23 Feb 2005 14:47:38 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl 12 Jun 2006 02:49:50 -0000 1.6 @@ -26,7 +26,7 @@ # Insert as_item_answer in the CR (and as_item_sa_answers table) getting the revision_id (as_item_answer_id) db_transaction { - set item_answer_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name [exec uuidgen]] + set item_answer_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name [as::item::generate_unique_name]] set as_item_answer_id [content::revision::new \ -item_id $item_answer_id \ -content_type {as_item_sa_answers} \ Index: openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl 19 Jan 2005 16:49:14 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl 12 Jun 2006 02:49:50 -0000 1.8 @@ -31,7 +31,7 @@ # Insert as_item_choice in the CR (and as_item_choices table) getting the revision_id (as_item_choice_id) db_transaction { - set item_choice_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name [exec uuidgen]] + set item_choice_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name [as::item::generate_unique_name]] set as_item_choice_id [content::revision::new \ -item_id $item_choice_id \ -content_type {as_item_choices} \ @@ -84,7 +84,8 @@ [list percent_score $percent_score] \ [list fixed_position $fixed_position] ] ] } - + + return $as_item_choice_id } Index: openacs-4/packages/assessment/tcl/as-item-data-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-data-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-data-procs-oracle.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,19 @@ + + + + + + oracle + 8.1.7 + + + + + update as_item_data + set clob_answer=empty_clob() + where item_data_id=:as_item_data_id + returning clob_answer into :1 + + + + Index: openacs-4/packages/assessment/tcl/as-item-data-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-data-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-data-procs-postgresql.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,18 @@ + + + + + + postgresql + 7.4 + + + + + update as_item_data + set clob_answer=:clob_answer + where item_data_id=:as_item_data_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-data-procs.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/assessment/tcl/as-item-data-procs.tcl 21 Feb 2005 14:32:56 -0000 1.9 +++ openacs-4/packages/assessment/tcl/as-item-data-procs.tcl 12 Jun 2006 02:49:50 -0000 1.10 @@ -35,43 +35,52 @@ set new_p 1 # Insert as_item_data in the CR (and as_item_data table) getting the revision_id (item_data_id) - db_transaction { - if {[db_0or1row old_item_id {}]} { - if {$allow_overwrite_p == "f"} { - return + set transaction_successful_p 0 + + while { ! $transaction_successful_p } { + db_transaction { + if {[db_0or1row old_item_id {}]} { + if {$allow_overwrite_p == "f"} { + return + } + set new_p 0 + } else { + set item_data_id [content::item::new -parent_id $folder_id -content_type {as_item_data} -name $name] } - set new_p 0 - } else { - set item_data_id [content::item::new -parent_id $folder_id -content_type {as_item_data} -name $name] - } - set as_item_data_id [content::revision::new \ - -item_id $item_data_id \ - -content_type {as_item_data} \ - -title $name \ - -attributes [list [list session_id $session_id] \ - [list subject_id $subject_id] \ - [list staff_id $staff_id] \ - [list as_item_id $as_item_id] \ - [list section_id $section_id] \ - [list boolean_answer $boolean_answer] \ - [list clob_answer $clob_answer] \ - [list numeric_answer $numeric_answer] \ - [list integer_answer $integer_answer] \ - [list text_answer $text_answer] \ - [list timestamp_answer $timestamp_answer] \ - [list content_answer $content_answer] \ - [list signed_data $signed_data] \ - [list points $points ] ] ] + set as_item_data_id [content::revision::new \ + -item_id $item_data_id \ + -content_type {as_item_data} \ + -title $name \ + -attributes [list [list session_id $session_id] \ + [list subject_id $subject_id] \ + [list staff_id $staff_id] \ + [list as_item_id $as_item_id] \ + [list section_id $section_id] \ + [list boolean_answer $boolean_answer] \ + [list numeric_answer $numeric_answer] \ + [list integer_answer $integer_answer] \ + [list text_answer $text_answer] \ + [list timestamp_answer $timestamp_answer] \ + [list content_answer $content_answer] \ + [list signed_data $signed_data] \ + [list points $points ] ] ] - foreach choice_id $choice_answer { - db_dml save_choice_answer {} - } + db_dml update_clobs "" -clobs [list $clob_answer] - if {$new_p} { - db_dml insert_session_map {} - } else { - db_dml update_session_map {} + foreach choice_id $choice_answer { + db_dml save_choice_answer {} + } + + if {$new_p} { + db_dml insert_session_map {} + } else { + db_dml update_session_map {} + } + + set transaction_successful_p 1 + } on_error { + ns_log notice "as::item_data::new: Transaction Error: $errmsg" } } Index: openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 13 Apr 2005 18:51:54 -0000 1.12 +++ openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 12 Jun 2006 02:49:50 -0000 1.13 @@ -24,7 +24,7 @@ # Insert as_item_display_cb in the CR (and as_item_display_cb table) getting the revision_id (as_item_display_id) db_transaction { - set item_item_display_cb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_cb} -name [exec uuidgen]] + set item_item_display_cb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_cb} -name [as::item::generate_unique_name]] set as_item_display_cb_id [content::revision::new \ -item_id $item_item_display_cb_id \ -content_type {as_item_display_cb} \ @@ -132,7 +132,7 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list values $default_value] [list options $data] [list html $type(html_display_options)]] + set param_list [list [list label \$title] [list help_text \$subtext] [list values \$default_value] [list options \$data] [list html \$type(html_display_options)]] set element_params [concat [list "$element\:text(checkbox)$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] Index: openacs-4/packages/assessment/tcl/as-item-display-fu-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-fu-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-display-fu-procs.tcl 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,141 @@ +ad_library { + Item display short answer Type procs + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) + @creation-date 2005-06-24 +} + +namespace eval as::item_display_f {} + +ad_proc -public as::item_display_f::new { + {-html_display_options ""} + {-abs_size ""} + {-box_orientation ""} +} { + New Item Display File Upload Type to the database +} { + set package_id [ad_conn package_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + + # Insert as_item_display_f in the CR (and as_item_display_f table) getting the revision_id (as_item_display_id) + db_transaction { + set item_item_display_f_id [content::item::new -parent_id $folder_id -content_type {as_item_display_f} -name [as::item::generate_unique_name]] + set as_item_display_f_id [content::revision::new \ + -item_id $item_item_display_f_id \ + -content_type {as_item_display_f} \ + -attributes [list [list html_display_options $html_display_options] \ + [list abs_size $abs_size] \ + [list box_orientation $box_orientation] ] ] + } + + return $as_item_display_f_id +} + +ad_proc -public as::item_display_f::edit { + -as_item_display_id:required + {-html_display_options ""} + {-abs_size ""} + {-box_orientation ""} +} { + + Edit Item Display File Upload Type to the database +} { + # Update as_item_display_f in the CR (and as_item_display_f table) getting the revision_id (as_item_display_id) + db_transaction { + set display_item_id [db_string display_item_id {}] + set new_item_display_id [content::revision::new \ + -item_id $display_item_id \ + -content_type {as_item_display_f} \ + -attributes [list [list html_display_options $html_display_options] \ + [list abs_size $abs_size] \ + [list box_orientation $box_orientation] ] ] + } + + return $new_item_display_id +} + +ad_proc -public as::item_display_f::copy { + -type_id:required +} { + + Copy an Item Display File Upload Type +} { + set package_id [ad_conn package_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + + # Insert as_item_display_f in the CR (and as_item_display_f table) getting the revision_id (as_item_display_id) + db_transaction { + db_1row display_item_data {} + + set new_item_display_id [new -html_display_options $html_display_options \ + -abs_size $abs_size \ + -box_orientation $box_orientation] + } + + return $new_item_display_id +} + +ad_proc -public as::item_display_f::render { + -form:required + -element:required + -type_id:required + {-datatype "file"} + {-title ""} + {-subtext ""} + {-required_p ""} + {-random_p ""} + {-default_value ""} + {-data ""} +} { + Render an Item Display File Upload Type +} { + array set type [util_memoize [list as::item_display_f::data -type_id $type_id]] + if {[empty_string_p $required_p]} { + set required_p f + } + if {[empty_string_p $datatype]} { + set datatype file + } + + set optional "" + if {$required_p != "t"} { + set optional ",optional" + } + set param_list [list [list label \$title] [list help_text \$subtext] [list value \$default_value] [list html \$type(html_display_options)]] + if {![empty_string_p $type(abs_size)]} { + lappend param_list [list maxlength $type(abs_size)] + } + set element_params [concat [list "$element\:file$optional"] $param_list] + + ad_form -extend -name $form -form [list $element_params] +} + +ad_proc -public as::item_display_f::data { + -type_id:required +} { + + Get the cached Display Data of File Upload Type +} { + return [util_memoize [list as::item_display_f::data_not_cached -type_id $type_id]] +} + +ad_proc -private as::item_display_f::data_not_cached { + -type_id:required +} { + + Get the Display Data of File Upload Type +} { + db_1row display_item_data {} -column_array type + return [array get type] +} + +ad_proc -public as::item_display_f::view { + -item_id:required + -session_id:required + -section_id:required +} { + set file_id [db_string file_id {} -default "-1"] + if { $file_id == -1 } { + return + } + return "view?revision_id=$file_id" +} \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-item-display-fu-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-fu-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-display-fu-procs.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,46 @@ + + + + + + + select item_id + from cr_revisions + where revision_id = :as_item_display_id + + + + + + + + select i.html_display_options, i.abs_size, i.box_orientation + from cr_revisions cr, as_item_display_f i + where cr.revision_id = :type_id + and i.as_item_display_id = cr.revision_id + + + + + + + + select html_display_options, abs_size, box_orientation + from as_item_display_f + where as_item_display_id = :type_id + + + + + + + select file_id + from as_item_data + where as_item_id=:item_id + and session_id=:session_id + and section_id=:section_id + + + + + Index: openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 13 Apr 2005 18:51:54 -0000 1.12 +++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 12 Jun 2006 02:49:50 -0000 1.13 @@ -24,7 +24,7 @@ # Insert as_item_display_rb in the CR (and as_item_display_rb table) getting the revision_id (as_item_display_id) db_transaction { - set item_item_display_rb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_rb} -name [exec uuidgen]] + set item_item_display_rb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_rb} -name [as::item::generate_unique_name]] set as_item_display_rb_id [content::revision::new \ -item_id $item_item_display_rb_id \ -content_type {as_item_display_rb} \ @@ -132,7 +132,7 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list options $data] [list html $type(html_display_options)]] + set param_list [list [list label \$title] [list help_text \$subtext] [list value \$default_value] [list options \$data] [list html \$type(html_display_options)]] set element_params [concat [list "$element\:text(radio)$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] Index: openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 13 Apr 2005 18:51:54 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 12 Jun 2006 02:49:50 -0000 1.9 @@ -21,7 +21,7 @@ # Insert as_item_display_sa in the CR (and as_item_display_sa table) getting the revision_id (as_item_display_id) db_transaction { - set item_item_display_sa_id [content::item::new -parent_id $folder_id -content_type {as_item_display_sa} -name [exec uuidgen]] + set item_item_display_sa_id [content::item::new -parent_id $folder_id -content_type {as_item_display_sa} -name [as::item::generate_unique_name]] set as_item_display_sa_id [content::revision::new \ -item_id $item_item_display_sa_id \ -content_type {as_item_display_sa} \ @@ -110,7 +110,7 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $type(html_display_options)]] + set param_list [list [list label \$title] [list help_text \$subtext] [list value \$default_value] [list html \$type(html_display_options)]] if {![empty_string_p $type(abs_size)]} { lappend param_list [list maxlength $type(abs_size)] } Index: openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 13 Apr 2005 18:51:54 -0000 1.10 +++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 12 Jun 2006 02:49:50 -0000 1.11 @@ -12,6 +12,7 @@ {-choice_label_orientation ""} {-sort_order_type ""} {-item_answer_alignment ""} + {-prepend_empty_p "f"} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-08 @@ -23,15 +24,16 @@ # Insert as_item_display_sb in the CR (and as_item_display_sb table) getting the revision_id (as_item_display_id) db_transaction { - set item_item_display_sb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_sb} -name [exec uuidgen]] + set item_item_display_sb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_sb} -name [as::item::generate_unique_name]] set as_item_display_sb_id [content::revision::new \ -item_id $item_item_display_sb_id \ -content_type {as_item_display_sb} \ -attributes [list [list html_display_options $html_display_options] \ [list mulitple_p $multiple_p] \ [list choice_label_orientation $choice_label_orientation] \ [list sort_order_type $sort_order_type] \ - [list item_answer_alignment $item_answer_alignment] ] ] + [list item_answer_alignment $item_answer_alignment] \ + [list prepend_empty_p $prepend_empty_p] ] ] } return $as_item_display_sb_id @@ -44,6 +46,7 @@ {-choice_label_orientation ""} {-sort_order_type ""} {-item_answer_alignment ""} + {-prepend_empty_p "f"} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-08 @@ -60,7 +63,8 @@ [list multiple_p $multiple_p] \ [list choice_label_orientation $choice_label_orientation] \ [list sort_order_type $sort_order_type] \ - [list item_answer_alignment $item_answer_alignment] ] ] + [list item_answer_alignment $item_answer_alignment] \ + [list prepend_empty_p $prepend_empty_p] ] ] } return $new_item_display_id @@ -133,11 +137,15 @@ } } + if { $type(prepend_empty_p) == "t" } { + set data [linsert $data 0 [list "" ""]] + } + set optional "" if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list values $default_value] [list options $data] [list html $type(html_display_options)]] + set param_list [list [list label \$title] [list help_text \$subtext] [list values \$default_value] [list options \$data] [list html \$type(html_display_options)]] set element_params [concat [list "$element\:text($widget)$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] Index: openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 13 Apr 2005 18:51:54 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 12 Jun 2006 02:49:50 -0000 1.5 @@ -15,7 +15,7 @@ select i.html_display_options, i.multiple_p, i.choice_label_orientation, - i.sort_order_type, i.item_answer_alignment + i.sort_order_type, i.item_answer_alignment, i.prepend_empty_p from cr_revisions cr, as_item_display_sb i where cr.revision_id = :type_id and i.as_item_display_id = cr.revision_id @@ -27,7 +27,7 @@ select html_display_options, multiple_p, choice_label_orientation, - sort_order_type, item_answer_alignment + sort_order_type, item_answer_alignment, prepend_empty_p from as_item_display_sb where as_item_display_id = :type_id Index: openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 13 Apr 2005 18:51:54 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 12 Jun 2006 02:49:50 -0000 1.9 @@ -22,7 +22,7 @@ # Insert as_item_display_ta in the CR (and as_item_display_ta table) getting the revision_id (as_item_display_id) db_transaction { - set item_item_display_ta_id [content::item::new -parent_id $folder_id -content_type {as_item_display_ta} -name [exec uuidgen]] + set item_item_display_ta_id [content::item::new -parent_id $folder_id -content_type {as_item_display_ta} -name [as::item::generate_unique_name]] set as_item_display_ta_id [content::revision::new \ -item_id $item_item_display_ta_id \ -content_type {as_item_display_ta} \ @@ -118,7 +118,7 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $type(html_display_options)]] + set param_list [list [list label \$title] [list help_text \$subtext] [list value \$default_value] [list html \$type(html_display_options)]] if {![empty_string_p $type(abs_size)]} { lappend param_list [list maxlength $type(abs_size)] } Index: openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 13 Apr 2005 18:51:54 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 12 Jun 2006 02:49:50 -0000 1.9 @@ -10,18 +10,21 @@ {-html_display_options ""} {-abs_size ""} {-item_answer_alignment ""} + {-package_id ""} } { @author Natalia Perez (nperper@it.uc3m.es) @creation-date 2004-09-29 New Item Display TextBox Type to the database } { - set package_id [ad_conn package_id] + if { ![exists_and_not_null package_id] } { + set package_id [ad_conn package_id] + } set folder_id [as::assessment::folder_id -package_id $package_id] # Insert as_item_display_tb in the CR (and as_item_display_tb table) getting the revision_id (as_item_display_id) db_transaction { - set item_item_display_tb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_tb} -name [exec uuidgen]] + set item_item_display_tb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_tb} -name [as::item::generate_unique_name]] set as_item_display_tb_id [content::revision::new \ -item_id $item_item_display_tb_id \ -content_type {as_item_display_tb} \ @@ -73,7 +76,7 @@ db_transaction { db_1row display_item_data {} - set new_item_display_it [new -html_display_options $html_display_options \ + set new_item_display_id [new -html_display_options $html_display_options \ -abs_size $abs_size \ -item_answer_alignment $item_answer_alignment] } @@ -113,12 +116,11 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $type(html_display_options)]] + set param_list [list [list label \$title] [list help_text \$subtext] [list value \$default_value] [list html \$type(html_display_options)]] if {![empty_string_p $type(abs_size)]} { lappend param_list [list maxlength $type(abs_size)] } set element_params [concat [list "$element\:$datatype\(text)$optional"] $param_list] - ad_form -extend -name $form -form [list $element_params] } Index: openacs-4/packages/assessment/tcl/as-item-form-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-form-procs.xql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-item-form-procs.xql 13 Apr 2005 18:51:54 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-item-form-procs.xql 12 Jun 2006 02:49:50 -0000 1.9 @@ -1,4 +1,3 @@ - Index: openacs-4/packages/assessment/tcl/as-item-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-procs-oracle.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,48 @@ + + + + + + + + + + oracle + 8.1.7 + + + + + update as_items + set feedback_right=empty_clob(), + feedback_wrong=empty_clob(), + validate_block=empty_clob() + where as_item_id=:as_item_id + returning feedback_right, feedback_wrong, validate_block into :1, :2, :3 + + + + + + update as_items + set feedback_right=empty_clob(), + feedback_wrong=empty_clob(), + validate_block=empty_clob() + where as_item_id=:new_item_id + returning feedback_right, feedback_wrong, validate_block into :1, :2, :3 + + + + + + update as_items + set feedback_right=empty_clob(), + feedback_wrong=empty_clob(), + validate_block=empty_clob() + where as_item_id=:new_item_id + returning feedback_right, feedback_wrong, validate_block into :1, :2, :3 + + + + Index: openacs-4/packages/assessment/tcl/as-item-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-procs-postgresql.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,45 @@ + + + + + + + + + + postgresql + 7.4 + + + + + update as_items + set feedback_right=:feedback_right, + feedback_wrong=:feedback_wrong, + validate_block=:validate_block + where as_item_id=:as_item_id + + + + + + update as_items + set feedback_right=:feedback_right, + feedback_wrong=:feedback_wrong, + validate_block=:validate_block + where as_item_id=:new_item_id + + + + + + update as_items + set feedback_right=:feedback_right, + feedback_wrong=:feedback_wrong, + validate_block=:validate_block + where as_item_id=:new_item_id + + + + Index: openacs-4/packages/assessment/tcl/as-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.tcl,v diff -u -N -r1.14 -r1.15 --- openacs-4/packages/assessment/tcl/as-item-procs.tcl 25 Apr 2005 13:00:25 -0000 1.14 +++ openacs-4/packages/assessment/tcl/as-item-procs.tcl 12 Jun 2006 02:49:50 -0000 1.15 @@ -19,13 +19,17 @@ {-feedback_right ""} {-feedback_wrong ""} {-points ""} + {-package_id ""} + {-validate_block ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-07-26 New item to the database } { - set package_id [ad_conn package_id] + if { ![exists_and_not_null package_id] } { + set package_id [ad_conn package_id] + } set folder_id [as::assessment::folder_id -package_id $package_id] # Insert as_item in the CR (and as_items table) getting the revision_id (as_item_id) @@ -37,7 +41,8 @@ if {[empty_string_p $field_name]} { set field_name $name } - set item_item_id [content::item::new -item_id $item_item_id -parent_id $folder_id -content_type {as_items} -name $name] + set item_item_id [content::item::new -item_id $item_item_id -parent_id $folder_id -content_type {as_items} -name $name -creation_user [ad_conn user_id] -creation_ip [ad_conn peeraddr]] + set as_item_id [content::revision::new -item_id $item_item_id \ -content_type {as_items} \ -title $title \ @@ -48,11 +53,9 @@ [list required_p $required_p] \ [list data_type $data_type] \ [list max_time_to_complete $max_time_to_complete] \ - [list feedback_right $feedback_right] \ - [list feedback_wrong $feedback_wrong] \ - [list points $points] ] ] + [list points $points] ] ] } - + db_dml update_clobs "" -clobs [list $feedback_right $feedback_wrong $validate_block] return $as_item_id } @@ -69,6 +72,7 @@ {-feedback_right ""} {-feedback_wrong ""} {-points ""} + {-validate_block ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 @@ -89,13 +93,11 @@ [list required_p $required_p] \ [list data_type $data_type] \ [list max_time_to_complete $max_time_to_complete] \ - [list feedback_right $feedback_right] \ - [list feedback_wrong $feedback_wrong] \ - [list points $points] ] ] + [list points $points] ] ] copy_types -as_item_id $as_item_id -new_item_id $new_item_id } - + db_dml update_clobs "" -clobs [list $feedback_right $feedback_wrong $validate_block] return $new_item_id } @@ -121,13 +123,12 @@ [list required_p $required_p] \ [list data_type $data_type] \ [list max_time_to_complete $max_time_to_complete] \ - [list feedback_right $feedback_right] \ - [list feedback_wrong $feedback_wrong] \ [list points $points] ] ] copy_types -as_item_id $as_item_id -new_item_id $new_item_id as::assessment::copy_categories -from_id $as_item_id -to_id $new_item_id } + db_dml update_clobs "" -clobs [list $feedback_right $feedback_wrong $validate_block] return $new_item_id } @@ -153,14 +154,17 @@ -title:required {-description ""} {-field_name ""} + {-package_id ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 Copies an item in the database } { # Update as_item in the CR (and as_items table) getting the revision_id (as_item_id) - set package_id [ad_conn package_id] + if { ![exists_and_not_null package_id] } { + set package_id [ad_conn package_id] + } set folder_id [as::assessment::folder_id -package_id $package_id] db_transaction { @@ -186,7 +190,8 @@ [list max_time_to_complete $max_time_to_complete] \ [list feedback_right $feedback_right] \ [list feedback_wrong $feedback_wrong] \ - [list points $points] ] ] + [list points $points] \ + [list validate_block $validate_block] ] ] as::assessment::copy_categories -from_id $as_item_id -to_id $new_item_id @@ -234,8 +239,31 @@ } { db_1row item_properties {} -column_array item - set item(item_type) [string range $item(item_type) end-1 end] - set item(display_type) [string range $item(display_type) end-1 end] + set item(item_type) [lindex [split $item(item_type) "_"] end] + set item(display_type) [lindex [split $item(display_type) "_"] end] return [array get item] } + +ad_proc -private as::item::generate_unique_name { + args +} { + Generate a unique string to be used as item name + + @author Roel Canicula (roelmc@info.com.ph) + @creation-date 2005-05-06 + + @param args + + @return + + @error +} { + if { [llength $args] } { + return [join $args "-"] + } elseif { ! [catch {set uuid [exec uuidgen]}] } { + return $uuid + } else { + return "[clock seconds]-[expr round([ns_rand]*100000)]" + } +} Index: openacs-4/packages/assessment/tcl/as-item-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-item-procs.xql 15 Apr 2005 17:26:46 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-item-procs.xql 12 Jun 2006 02:49:50 -0000 1.7 @@ -16,7 +16,7 @@ select cr.item_id as item_item_id, cr.title, cr.description, i.subtext, i.field_code, i.field_name, i.required_p, i.data_type, i.max_time_to_complete, - i.feedback_right, i.feedback_wrong, i.points + i.feedback_right, i.feedback_wrong, i.points, i.validate_block from cr_revisions cr, as_items i where cr.revision_id = :as_item_id and i.as_item_id = cr.revision_id @@ -42,7 +42,7 @@ select i.subtext, i.field_code, i.required_p, i.data_type, i.max_time_to_complete, i.feedback_right, - i.feedback_wrong, i.points + i.feedback_wrong, i.points, i.validate_block from cr_revisions cr, as_items i where cr.revision_id = :as_item_id and i.as_item_id = cr.revision_id Index: openacs-4/packages/assessment/tcl/as-item-type-fu-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-fu-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-type-fu-procs.tcl 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,136 @@ +ad_library { + file upload item procs + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) + @creation-date 2005-06-24 +} + +namespace eval as::item_type_fu {} + +ad_proc -public as::item_type_fu::new { + {-title ""} +} { + + New File Upload Answers item to the data database +} { + set package_id [ad_conn package_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + + # Insert as_item_type_fu in the CR (and as_item_type_fu table) getting the revision_id (as_item_type_id) + db_transaction { + set item_item_type_fu_id [content::item::new -parent_id $folder_id -content_type {as_item_type_fu} -name [as::item::generate_unique_name]] + set as_item_type_fu_id [content::revision::new -item_id $item_item_type_fu_id -content_type {as_item_type_fu} -title $title ] + + } + return $as_item_type_fu_id +} + +ad_proc -public as::item_type_fu::edit { + -as_item_type_id:required + {-title ""} +} { + + Edit File Upload Answers item to the data database +} { + # Update as_item_type_fu in the CR (and as_item_type_fu table) getting the revision_id (as_item_type_id) + db_transaction { + set type_item_id [db_string type_item_id {}] + set new_item_type_id [content::revision::new \ + -item_id $type_item_id \ + -content_type {as_item_type_fu} \ + -title $title] + } + + return $new_item_type_id +} + +ad_proc -public as::item_type_fu::copy { + -type_id:required +} { + + Copy a File Upload Type +} { + set package_id [ad_conn package_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + + # Insert as_item_type_fu in the CR (and as_item_type_fu table) getting the revision_id (as_item_type_id) + db_transaction { + db_1row item_type_data {} + + set new_item_type_id [new -title $title ] + } + + return $new_item_type_id +} + +ad_proc -public as::item_type_fu::render { + -type_id:required + -section_id:required + -as_item_id:required + {-default_value ""} + {-session_id ""} + {-show_feedback ""} +} { + + Render a File Upload Type +} { + if {![empty_string_p $default_value]} { + array set values $default_value + set default $values(text_answer) + } else { + set default "" + } + + return [list $default ""] +} + +ad_proc -public as::item_type_fu::process { + -type_id:required + -session_id:required + -as_item_id:required + -section_id:required + -subject_id:required + {-staff_id ""} + {-response "" } + {-max_points 0} + {-allow_overwrite_p t} +} { + Process a Response to a File Upload Type +} { + + set package_id [ad_conn package_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + + # Insert the file in the CR + db_transaction { + set file_item_id [content::item::new -parent_id $folder_id -name "[lindex $response 0]$session_id"] + set file_revision_id [content::revision::new -item_id $file_item_id -title [lindex $response 0]] + set content_file [cr_create_content_file $file_item_id $file_revision_id [lindex $response 1]] + set mime_type [cr_filename_to_mime_type -create [lindex $response 0]] + set tmp_size [file size [lindex $response 1]] + + db_dml update_revision {} + + set as_item_data_id [as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -text_answer [lindex $response 0] -points "" -allow_overwrite_p $allow_overwrite_p] + } + db_dml update_item_data { } + +} + +ad_proc -public as::item_type_fu::results { + -as_item_item_id:required + -section_item_id:required + -data_type:required + -sessions:required +} { + Return the results of a given item in a given list of sessions as an array +} { + db_foreach get_results {} { + set results($session_id) $text_answer + } + + if {[array exists results]} { + return [array get results] + } else { + return + } +} Index: openacs-4/packages/assessment/tcl/as-item-type-fu-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-fu-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-type-fu-procs.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,59 @@ + + + + + + + select item_id + from cr_revisions + where revision_id = :as_item_type_id + + + + + + + + select cr.title, i.increasing_p, i.allow_negative_p + from cr_revisions cr, as_item_type_fu i + where cr.revision_id = :type_id + and i.as_item_type_id = cr.revision_id + + + + + + + + select d.session_id, d.text_answer + from as_item_data d, as_session_item_map m, cr_revisions ri, cr_revisions rs + where d.session_id in ([join $sessions ,]) + and d.as_item_id = ri.revision_id + and ri.item_id = :as_item_item_id + and d.section_id = rs.revision_id + and rs.item_id = :section_item_id + and m.session_id = d.session_id + and m.item_data_id = d.item_data_id + + + + + + + + update cr_revisions + set content=:content_file, mime_type =:mime_type,content_length=:tmp_size + where revision_id = :file_revision_id + + + + + + update as_item_data + set file_id = :file_revision_id + where item_data_id=:as_item_data_id + + + + + Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl,v diff -u -N -r1.18 -r1.19 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 17 Feb 2006 12:13:55 -0000 1.18 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 12 Jun 2006 02:49:50 -0000 1.19 @@ -25,7 +25,7 @@ # Insert as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) db_transaction { - set item_item_type_mc_id [content::item::new -parent_id $folder_id -content_type {as_item_type_mc} -name [exec uuidgen]] + set item_item_type_mc_id [content::item::new -parent_id $folder_id -content_type {as_item_type_mc} -name [as::item::generate_unique_name]] set as_item_type_mc_id [content::revision::new \ -item_id $item_item_type_mc_id \ -content_type {as_item_type_mc} \ Index: openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl,v diff -u -N -r1.16 -r1.17 --- openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 9 Apr 2005 22:39:27 -0000 1.16 +++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 12 Jun 2006 02:49:50 -0000 1.17 @@ -23,7 +23,7 @@ # Insert as_item_type_oq in the CR (and as_item_type_oq table) getting the revision_id (as_item_type_id) db_transaction { - set item_item_type_oq_id [content::item::new -parent_id $folder_id -content_type {as_item_type_oq} -name [exec uuidgen]] + set item_item_type_oq_id [content::item::new -parent_id $folder_id -content_type {as_item_type_oq} -name [as::item::generate_unique_name]] set as_item_type_oq_id [content::revision::new \ -item_id $item_item_type_oq_id \ -content_type {as_item_type_oq} \ Index: openacs-4/packages/assessment/tcl/as-item-type-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-type-procs.tcl 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,55 @@ +# + +ad_library { + + Procedures to work with item_types + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-15 + @arch-tag: 6ab279ee-2c8a-472b-b0ba-35ad96529051 + @cvs-id $Id: as-item-type-procs.tcl,v 1.2 2006/06/12 02:49:50 daveb Exp $ +} + +namespace eval as_item_type:: {} + +ad_proc -public as_item_type::get_item_types { +} { + + Gets item types in a list of lists suitable for a form-builder + options parameter + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-15 + + @return List of lists of label/value for valid item types + + @error +} { + foreach item_type [db_list item_types {}] { + lappend item_types [list "[_ assessment.item_type_$item_type]" $item_type] + } + return $item_types +} + +ad_proc -public as_item_type::get_display_types { + item_type +} { + Get valid display types for item_type + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-15 + + @param item_type Assessment Item Type + + @return List of lists for label/value for display types valid for item_type + + @error +} { + + set display_types [list] + foreach display_type [db_list display_types {}] { + lappend display_types [list "[_ assessment.item_display_$display_type]" $display_type] + } + return $display_types +} + Index: openacs-4/packages/assessment/tcl/as-item-type-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-type-procs.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + select distinct item_type + from as_item_types_map + + + + + + + + + select display_type + from as_item_types_map + where item_type = :item_type + + + + + \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 26 Jan 2005 11:06:45 -0000 1.13 +++ openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 12 Jun 2006 02:49:50 -0000 1.14 @@ -9,19 +9,22 @@ ad_proc -public as::item_type_sa::new { {-title ""} {-increasing_p ""} - {-allow_negative_p ""} + {-allow_negative_p ""} + {-package_id ""} } { @author Natalia Perez (nperper@it.uc3m.es) @creation-date 2004-09-29 New Short Answer Answers item to the data database } { - set package_id [ad_conn package_id] + if { ![exists_and_not_null package_id] } { + set package_id [ad_conn package_id] + } set folder_id [as::assessment::folder_id -package_id $package_id] # Insert as_item_type_sa in the CR (and as_item_type_sa table) getting the revision_id (as_item_type_id) db_transaction { - set item_item_type_sa_id [content::item::new -parent_id $folder_id -content_type {as_item_type_sa} -name [exec uuidgen]] + set item_item_type_sa_id [content::item::new -parent_id $folder_id -content_type {as_item_type_sa} -name [as::item::generate_unique_name]] set as_item_type_sa_id [content::revision::new \ -item_id $item_item_type_sa_id \ -content_type {as_item_type_sa} \ Index: openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.tcl 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,152 @@ +# + +ad_library { + + Procedures for sitewide category item type + + @author Dave Bauer (dave@solutiongrove.com) + @creation-date 2005-05-15 + @arch-tag: ba556f8e-d5bf-4455-bb19-06be198014d8 + @cvs-id $Id: as-item-type-swcat-procs.tcl,v 1.2 2006/06/12 02:49:50 daveb Exp $ +} + +namespace eval as::item_type_swcat {} + + +ad_proc -public as::item_type_swcat::new { + {-title ""} + {-tree_id:required} +} { + @author Dave Bauer (dave@solutiongrove.com) + @creation-date 2005-05-15 + + New SW Category item to the database +} { + set package_id [ad_conn package_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + + # Insert as_item_type_swcat in the CR (and as_item_type_swcat table) getting the revision_id (as_item_type_id) + db_transaction { + set item_item_type_swcat_id [content::item::new -parent_id $folder_id -content_type {as_item_type_swcat} -name [as::item::generate_unique_name]] + set as_item_type_swcat_id [content::revision::new \ + -item_id $item_item_type_swcat_id \ + -content_type {as_item_type_swcat} \ + -title $title \ + -attributes [list [list tree_id $tree_id]]] + } + + return $as_item_type_swcat_id +} + +ad_proc -public as::item_type_swcat::edit { + -as_item_type_id:required + -tree_id:required +} { + @author Dave Bauer (dave@solutiongrove.com) + @creation-date 2005-05-15 + + Edit SW Category Answers item to the database +} { + # Update as_item_type_swcat in the CR (and as_item_type_swcat table) getting the revision_id (as_item_type_id) + db_transaction { + set type_item_id [db_string type_item_id {}] + set new_item_type_id [content::revision::new \ + -item_id $type_item_id \ + -content_type {as_item_type_swcat} \ + -title $title \ + -attributes [list [list tree_id $tree_id] ] + } + + return $new_item_type_id +} + +ad_proc -public as::item_type_swcat::copy { + -type_id:required +} { + @author Dave Bauer (dave@solutiongrove.com) + @creation-date 2005-05-15 + + Copy a Short Answer Type +} { + set package_id [ad_conn package_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + + # Insert as_item_type_swcat in the CR (and as_item_type_swcat table) getting the revision_id (as_item_type_id) + db_transaction { + db_1row item_type_data {} + + set new_item_type_id [new -tree_id $tree_id] + } + + return $new_item_type_id +} + +ad_proc -public as::item_type_swcat::render { + -type_id:required + -section_id:required + -as_item_id:required + {-default_value ""} + {-session_id ""} + {-show_feedback ""} +} { + @author Dave Bauer (dave@solutiongrove.com) + @creation-date 2005-05-15 + + Render a SW Category Type +} { + if {![empty_string_p $default_value]} { + array set values $default_value + set default $values(text_answer) + } else { + set default "" + } + set display_choices [list] + set tree_id [db_string get_tree_id "" -default ""] + set categories [category_tree::get_tree -all $tree_id] + foreach cat $categories { + foreach {category_id category_name deprecated_p level} $cat {break} + lappend display_choices [list $category_name $category_id] + } + return [list $default $display_choices] +} + +ad_proc -public as::item_type_swcat::process { + -type_id:required + -session_id:required + -as_item_id:required + -section_id:required + -subject_id:required + {-staff_id ""} + {-response ""} + {-max_points 0} + {-allow_overwrite_p t} +} { + @author Dave Bauer (dave@solutiongrove.com) + @creation-date 2005-05-15 + + Process a Response to a SW Category Answer +} { + as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -text_answer [lindex $response 0] -points "" -allow_overwrite_p $allow_overwrite_p +} + +ad_proc -public as::item_type_swcat::results { + -as_item_item_id:required + -section_item_id:required + -data_type:required + -sessions:required +} { + @author Dave Bauer (dave@solutiongrove.com) + @creation-date 2005-05-15 + + Return the results of a given item in a given list of sessions as an array +} { + db_foreach get_results {} { + set results($session_id) $text_answer + } + + if {[array exists results]} { + return [array get results] + } else { + return + } +} Index: openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-item-type-swcat-procs.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + select item_id + from cr_revisions + where revision_id = :as_item_type_id + + + + + + + + select cr.title, i.tree_id + from cr_revisions cr, as_item_type_swcat i + where cr.revision_id = :type_id + and i.as_item_type_id = cr.revision_id + + + + + + + + select d.session_id, d.text_answer + from as_item_data d, as_session_item_map m, cr_revisions ri, cr_revisions rs + where d.session_id in ([join $sessions ,]) + and d.as_item_id = ri.revision_id + and ri.item_id = :as_item_item_id + and d.section_id = rs.revision_id + and rs.item_id = :section_item_id + and m.session_id = d.session_id + and m.item_data_id = d.item_data_id + + + + + + + + select i.tree_id + from as_item_type_swcat i + where i.as_item_type_id = :type_id + + + + + + \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-qti-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-qti-procs.tcl,v diff -u -N -r1.41 -r1.42 --- openacs-4/packages/assessment/tcl/as-qti-procs.tcl 5 Apr 2006 16:20:42 -0000 1.41 +++ openacs-4/packages/assessment/tcl/as-qti-procs.tcl 12 Jun 2006 02:49:50 -0000 1.42 @@ -1,8 +1,8 @@ ad_library { - assessment -- QTI parser library routines - @author eperez@it.uc3m.es - @creation-date 2004-04-16 - @cvs-id $Id$ + assessment -- QTI parser library routines + @author eperez@it.uc3m.es + @creation-date 2004-04-16 + @cvs-id $Id$ } namespace eval as::qti {} @@ -14,7 +14,7 @@ Relation with assessment } { - + if {[regexp -nocase -- {\.zip$} $tmp_dir]} { # Generate a random directory name set tmpdirectory [ns_tmpnam] @@ -74,337 +74,347 @@ # Restore the package_id ad_conn -set package_id $current_package_id - + return $assessment_id } ad_proc -private as::qti::mattext_gethtml { mattextNode } { Get the HTML of a mattext } { - set texttype [$mattextNode getAttribute {texttype} {text/plain}] - if { $texttype == "text/html" } { - return [$mattextNode text] - } else { - return [ad_html_text_convert -from text/plain -to text/html -- [$mattextNode text]] - } + set texttype [$mattextNode getAttribute {texttype} {text/plain}] + if { $texttype == "text/html" } { + return [$mattextNode text] + } else { + return [ad_html_text_convert -from text/plain -to text/html -- [$mattextNode text]] + } } ad_proc -public as::qti::parse_qti_xml { xmlfile } { Parse a XML QTI file } { - set as_assessments__assessment_id {} + set as_assessments__assessment_id {} - # Parser - # XML => DOM document - dom parse [::tDOM::xmlReadFile $xmlfile] document - # DOM document => DOM root - $document documentElement root - # XPath v1.0 - # get all elements of a XML instance file - set questestinteropNodes [$root selectNodes {/questestinterop}] - foreach questestinterop $questestinteropNodes { - # Looks for assessments - set assessmentNodes [$questestinterop selectNodes {assessment}] - if { [llength $assessmentNodes] > 0 } { - # There are assessments - foreach assessment $assessmentNodes { - set as_assessments__title [$assessment getAttribute {title} {Assessment}] - #get assessment's children: section, (qticomment, duration, qtimetadata, objectives, assessmentcontrol, - #rubric, presentation_material, outcomes_processing, assessproc_extension, assessfeedback, - #selection_ordering, reference, sectionref) - set nodesList [$assessment childNodes] - set as_assessments__definition "" - set as_assessments__instructions "" - set as_assessments__duration "" - #for each assessment's child - foreach node $nodesList { - set nodeName [$node nodeName] - #as_assessmentsx.description = or - if {$nodeName == "qticomment"} { - set definitionNodes [$assessment selectNodes {qticomment}] - if {[llength $definitionNodes] != 0} { - set definition [lindex $definitionNodes 0] - set as_assessments__definition [as::qti::mattext_gethtml $definition] - } - } elseif {$nodeName == "objectives"} { - set definitionNodes [$assessment selectNodes {objectives/material/mattext}] - if {[llength $definitionNodes] != 0} { - set definition [lindex $definitionNodes 0] - set as_assessments__definition [as::qti::mattext_gethtml $definition] - } - #as_assessments.instructions = - } elseif {$nodeName == "rubric"} { - set instructionNodes [$assessment selectNodes {rubric/material/mattext}] - if {[llength $instructionNodes] != 0} { - set instruction [lindex $instructionNodes 0] - set as_assessments__instructions [as::qti::mattext_gethtml $instruction] - } - #as_assessments.time_for_response = - } elseif {$nodeName == "duration"} { - set durationNodes [$assessment selectNodes {duration/text()}] - if {[llength $durationNodes] != 0} { - set duration [lindex $durationNodes 0] - set as_assessments__duration [$duration nodeValue] - } - } + # Parser + # XML => DOM document + dom parse [::tDOM::xmlReadFile $xmlfile] document + # DOM document => DOM root + $document documentElement root + # XPath v1.0 + # get all elements of a XML instance file + set questestinteropNodes [$root selectNodes {/questestinterop}] + foreach questestinterop $questestinteropNodes { + # Looks for assessments + set assessmentNodes [$questestinterop selectNodes {assessment}] + if { [llength $assessmentNodes] > 0 } { + # There are assessments + foreach assessment $assessmentNodes { + set as_assessments__title [$assessment getAttribute {title} {Assessment}] + #get assessment's children: section, (qticomment, duration, qtimetadata, objectives, assessmentcontrol, + #rubric, presentation_material, outcomes_processing, assessproc_extension, assessfeedback, + #selection_ordering, reference, sectionref) + set nodesList [$assessment childNodes] + set as_assessments__definition "" + set as_assessments__instructions "" + set as_assessments__duration "" + #for each assessment's child + foreach node $nodesList { + set nodeName [$node nodeName] + #as_assessmentsx.description = or + if {$nodeName == "qticomment"} { + set definitionNodes [$assessment selectNodes {qticomment}] + if {[llength $definitionNodes] != 0} { + set definition [lindex $definitionNodes 0] + set as_assessments__definition [as::qti::mattext_gethtml $definition] + } + } elseif {$nodeName == "objectives"} { + set definitionNodes [$assessment selectNodes {objectives/material/mattext}] + if {[llength $definitionNodes] != 0} { + set definition [lindex $definitionNodes 0] + set as_assessments__definition [as::qti::mattext_gethtml $definition] + } + #as_assessments.instructions = + } elseif {$nodeName == "rubric"} { + set instructionNodes [$assessment selectNodes {rubric/material/mattext}] + if {[llength $instructionNodes] != 0} { + set instruction [lindex $instructionNodes 0] + set as_assessments__instructions [as::qti::mattext_gethtml $instruction] + } + #as_assessments.time_for_response = + } elseif {$nodeName == "duration"} { + set durationNodes [$assessment selectNodes {duration/text()}] + if {[llength $durationNodes] != 0} { + set duration [lindex $durationNodes 0] + set as_assessments__duration [as::qti::duration [$duration nodeValue]] + } + } + } + set qtimetadataNodes [$assessment selectNodes {qtimetadata}] + set as_assessments__run_mode "" + set as_assessments__anonymous_p f + set as_assessments__secure_access_p f + set as_assessments__reuse_responses_p f + set as_assessments__show_item_name_p f + set as_assessments__consent_page "" + set as_assessments__return_url "" + set as_assessments__start_time "" + set as_assessments__end_time "" + set as_assessments__number_tries "" + set as_assessments__wait_between_tries "" + set as_assessments__ip_mask "" + set as_assessments__show_feedback "none" + set as_assessments__section_navigation "default path" + + set itemfeedbacknodes [$root selectNodes {/questestinterop/assessment/section/item/itemfeedback}] + if { [llength $itemfeedbacknodes] >0} { + set as_assessments__show_feedback "all" + } + set resprocessNodes [$root selectNodes {/questestinterop/assessment/section/item/resprocessing}] + set as_assessments__survey_p {f} + if { [llength $resprocessNodes] == 0 } { + set as_assessments__survey_p {t} + #if it's a survey don't show feedback + set as_assessments__show_feedback "none" + } + + if {[llength $qtimetadataNodes] > 0} { + #nodes qtimetadatafield + set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] + foreach qtimetadatafieldnode $qtimetadatafieldNodes { + set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] + set label [$label nodeValue] + set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] + if { $value ne ""} { set value [$value nodeValue] } + + switch -exact -- $label { + run_mode { + set as_assessments__run_mode $value + } + anonymous_p { + set as_assessments__anonymous_p $value + } + secure_access_p { + set as_assessments__secure_access_p $value + } + reuse_responses_p { + set as_assessments__reuse_responses_p $value + } + show_item_name_p { + set as_assessments__show_item_name_p $value + } + consent_page { + set as_assessments__consent_page $value + } + start_time { + set as_assessments__start_time $value + } + end_time { + set as_assessments__end_time $value + } + number_tries { + set as_assessments__number_tries $value + } + wait_between_tries { + set as_assessments__wait_between_tries $value + } + ip_mask { + set as_assessments__ip_mask $value + } + show_feedback { + set as_assessments__show_feedback $value + } + section_navigation { + set as_assessments__section_navigation $value + } + } + + } + } + + # Insert assessment in the CR (and as_assessments table) getting the revision_id (assessment_id) + set as_assessments__assessment_id [as::assessment::new \ + -title $as_assessments__title \ + -description $as_assessments__definition \ + -instructions $as_assessments__instructions \ + -run_mode $as_assessments__run_mode \ + -anonymous_p $as_assessments__anonymous_p \ + -secure_access_p $as_assessments__secure_access_p \ + -reuse_responses_p $as_assessments__reuse_responses_p \ + -show_item_name_p $as_assessments__show_item_name_p \ + -consent_page $as_assessments__consent_page \ + -return_url $as_assessments__return_url \ + -start_time $as_assessments__start_time \ + -end_time $as_assessments__end_time \ + -number_tries $as_assessments__number_tries \ + -wait_between_tries $as_assessments__wait_between_tries \ + -time_for_response $as_assessments__duration \ + -ip_mask $as_assessments__ip_mask \ + -show_feedback $as_assessments__show_feedback \ + -section_navigation $as_assessments__section_navigation \ + -survey_p $as_assessments__survey_p ] + + # Section + set sectionNodes [$assessment selectNodes {section}] + set as_asmt_sect_map__sort_order 0 + foreach section $sectionNodes { + set as_sections__title [$section getAttribute {title} {Section}] + set as_sections__ident [$section getAttribute {ident} {Section}] + #get section's children (qticomment, duration, qtimetadata, objectives, sectioncontrol, + #sectionprecondition, sectionpostcondition, rubric, presentation_material, outcomes_processing, + #sectionproc_extension, sectionfeedback, selection_ordering, reference, itemref, item, sectionref, + #section) + set nodesList [$section childNodes] + set as_sections__definition "" + set as_sections__instructions "" + set as_sections__duration "" + set as_sections__sectionfeedback "" + #for each section's child + foreach node $nodesList { + set nodeName [$node nodeName] + #as_sectionsx.description = or + if {$nodeName == "qticomment"} { + set definitionNodes [$section selectNodes {qticomment}] + if {[llength $definitionNodes] != 0} { + set definition [lindex $definitionNodes 0] + set as_sections__definition [as::qti::mattext_gethtml $definition] + } + } elseif {$nodeName == "objectives"} { + set definitionNodes [$section selectNodes {objectives/material/mattext}] + if {[llength $definitionNodes] != 0} { + set definition [lindex $definitionNodes 0] + set as_sections__definition [as::qti::mattext_gethtml $definition] + } + #as_sections.max_time_to_complete = + } elseif {$nodeName == "duration"} { + set section_durationNodes [$section selectNodes {duration/text()}] + if {[llength $section_durationNodes] != 0} { + set section_duration [lindex $section_durationNodes 0] + set as_sections__duration [as::qti::duration [$section_duration nodeValue]] + } + #as_sections.instructions = + } elseif {$nodeName == "rubric"} { + set section_instructionNodes [$section selectNodes {rubric/material/mattext}] + if {[llength $section_instructionNodes] != 0} { + set section_instruction [lindex $section_instructionNodes 0] + set as_sections__instructions [as::qti::mattext_gethtml $section_instruction] + } + #as_sections.feedback_text = + } elseif {$nodeName == "sectionfeedback"} { + set sectionfeedbackNodes [$section selectNodes {sectionfeedback/material/mattext}] + if {[llength $sectionfeedbackNodes] != 0} { + set sectionfeedback [lindex $sectionfeedbackNodes 0] + set as_sections__sectionfeedback [as::qti::mattext_gethtml $sectionfeedback] + } + } + } + + set qtimetadataNodes [$section selectNodes {qtimetadata}] + set as_sections__num_items "" + set as_sections__points "" + set asdt__display_type none + set asdt__s_num_items "" + set asdt__adp_chunk "" + set asdt__branched_p f + set asdt__back_button_p t + set asdt__submit_answer_p f + set asdt__sort_order_type order_of_entry + + if {[llength $qtimetadataNodes] > 0} { + #nodes qtimetadatafield + set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] + foreach qtimetadatafieldnode $qtimetadatafieldNodes { + set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] + set label [$label nodeValue] + set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] + if { $value ne ""} { set value [$value nodeValue] } + + switch -exact -- $label { + num_items { + set as_sections__num_items $value } - set qtimetadataNodes [$assessment selectNodes {qtimetadata}] - set as_assessments__run_mode "" - set as_assessments__anonymous_p f - set as_assessments__secure_access_p f - set as_assessments__reuse_responses_p f - set as_assessments__show_item_name_p f - set as_assessments__consent_page "" - set as_assessments__return_url "" - set as_assessments__start_time "" - set as_assessments__end_time "" - set as_assessments__number_tries "" - set as_assessments__wait_between_tries "" - set as_assessments__ip_mask "" - set as_assessments__show_feedback "none" - set as_assessments__section_navigation "default path" - - set itemfeedbacknodes [$root selectNodes {/questestinterop/assessment/section/item/itemfeedback}] - if { [llength $itemfeedbacknodes] >0} { - set as_assessments__show_feedback "all" + points { + set as_sections__points $value } - set resprocessNodes [$root selectNodes {/questestinterop/assessment/section/item/resprocessing}] - set as_assessments__survey_p {f} - if { [llength $resprocessNodes] == 0 } { - set as_assessments__survey_p {t} - #if it's a survey don't show feedback - set as_assessments__show_feedback "none" - } - - if {[llength $qtimetadataNodes] > 0} { - #nodes qtimetadatafield - set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] - foreach qtimetadatafieldnode $qtimetadatafieldNodes { - set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] - set label [$label nodeValue] - set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] - set value [$value nodeValue] - - switch -exact -- $label { - run_mode { - set as_assessments__run_mode $value - } - anonymous_p { - set as_assessments__anonymous_p $value - } - secure_access_p { - set as_assessments__secure_access_p $value - } - reuse_responses_p { - set as_assessments__reuse_responses_p $value - } - show_item_name_p { - set as_assessments__show_item_name_p $value - } - consent_page { - set as_assessments__consent_page $value - } - start_time { - set as_assessments__start_time $value - } - end_time { - set as_assessments__end_time $value - } - number_tries { - set as_assessments__number_tries $value - } - wait_between_tries { - set as_assessments__wait_between_tries $value - } - ip_mask { - set as_assessments__ip_mask $value - } - show_feedback { - set as_assessments__show_feedback $value - } - section_navigation { - set as_assessments__section_navigation $value - } - } - - } - } - - # Insert assessment in the CR (and as_assessments table) getting the revision_id (assessment_id) - set as_assessments__assessment_id [as::assessment::new \ - -title $as_assessments__title \ - -description $as_assessments__definition \ - -instructions $as_assessments__instructions \ - -run_mode $as_assessments__run_mode \ - -anonymous_p $as_assessments__anonymous_p \ - -secure_access_p $as_assessments__secure_access_p \ - -reuse_responses_p $as_assessments__reuse_responses_p \ - -show_item_name_p $as_assessments__show_item_name_p \ - -consent_page $as_assessments__consent_page \ - -return_url $as_assessments__return_url \ - -start_time $as_assessments__start_time \ - -end_time $as_assessments__end_time \ - -number_tries $as_assessments__number_tries \ - -wait_between_tries $as_assessments__wait_between_tries \ - -time_for_response $as_assessments__duration \ - -ip_mask $as_assessments__ip_mask \ - -show_feedback $as_assessments__show_feedback \ - -section_navigation $as_assessments__section_navigation \ - -survey_p $as_assessments__survey_p ] - - # Section - set sectionNodes [$assessment selectNodes {section}] - set as_assessment_section_map__sort_order 0 - foreach section $sectionNodes { - set as_sections__title [$section getAttribute {title} {Section}] - #get section's children (qticomment, duration, qtimetadata, objectives, sectioncontrol, - #sectionprecondition, sectionpostcondition, rubric, presentation_material, outcomes_processing, - #sectionproc_extension, sectionfeedback, selection_ordering, reference, itemref, item, sectionref, - #section) - set nodesList [$section childNodes] - set as_sections__definition "" - set as_sections__instructions "" - set as_sections__duration "" - set as_sections__sectionfeedback "" - #for each section's child - foreach node $nodesList { - set nodeName [$node nodeName] - #as_sectionsx.description = or - if {$nodeName == "qticomment"} { - set definitionNodes [$section selectNodes {qticomment}] - if {[llength $definitionNodes] != 0} { - set definition [lindex $definitionNodes 0] - set as_sections__definition [as::qti::mattext_gethtml $definition] - } - } elseif {$nodeName == "objectives"} { - set definitionNodes [$section selectNodes {objectives/material/mattext}] - if {[llength $definitionNodes] != 0} { - set definition [lindex $definitionNodes 0] - set as_sections__definition [as::qti::mattext_gethtml $definition] - } - #as_sections.max_time_to_complete = - } elseif {$nodeName == "duration"} { - set section_durationNodes [$section selectNodes {duration/text()}] - if {[llength $section_durationNodes] != 0} { - set section_duration [lindex $section_durationNodes 0] - set as_sections__duration [$section_duration nodeValue] - } - #as_sections.instructions = - } elseif {$nodeName == "rubric"} { - set section_instructionNodes [$section selectNodes {rubric/material/mattext}] - if {[llength $section_instructionNodes] != 0} { - set section_instruction [lindex $section_instructionNodes 0] - set as_sections__instructions [as::qti::mattext_gethtml $section_instruction] - } - #as_sections.feedback_text = - } elseif {$nodeName == "sectionfeedback"} { - set sectionfeedbackNodes [$section selectNodes {sectionfeedback/material/mattext}] - if {[llength $sectionfeedbackNodes] != 0} { - set sectionfeedback [lindex $sectionfeedbackNodes 0] - set as_sections__sectionfeedback [as::qti::mattext_gethtml $sectionfeedback] - } - } - } - - set qtimetadataNodes [$section selectNodes {qtimetadata}] - set as_sections__num_items "" - set as_sections__points "" - set asdt__display_type none - set asdt__s_num_items "" - set asdt__adp_chunk "" - set asdt__branched_p f - set asdt__back_button_p t - set asdt__submit_answer_p f - set asdt__sort_order_type order_of_entry - - if {[llength $qtimetadataNodes] > 0} { - #nodes qtimetadatafield - set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] - foreach qtimetadatafieldnode $qtimetadatafieldNodes { - set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] - set label [$label nodeValue] - set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] - set value [$value nodeValue] - - switch -exact -- $label { - num_items { - set as_sections__num_items $value - } - points { - set as_sections__points $value - } - display_type { - set asdt__display_type $value - } - s_num_items { - set asdt__s_num_items $value - } - adp_chunk { - set asdt__adp_chunk $value - } - branched_p { - set asdt__branched_p $value - } - back_button_p { - set asdt__back_button_p $value - } - submit_answer_p { - set asdt__submit_answer_p $value - } - sort_order_type { - set asdt__sort_order_type $value - } - } - } - } - - #section display type - set display_type_id [as::section_display::new \ - -title $asdt__display_type \ - -num_items $asdt__s_num_items \ - -adp_chunk $asdt__adp_chunk \ - -branched_p $asdt__branched_p \ - -back_button_p $asdt__back_button_p \ - -submit_answer_p $asdt__submit_answer_p \ - -sort_order_type $asdt__sort_order_type] - # Insert section in the CR (and in the as_sections table) getting the revision_id (section_id) - set section_id [as::section::new \ - -title $as_sections__title \ - -description $as_sections__definition \ - -instructions $as_sections__instructions \ - -feedback_text $as_sections__sectionfeedback \ - -max_time_to_complete $as_sections__duration \ - -num_items $as_sections__num_items \ - -points $as_sections__points \ - -display_type_id $display_type_id] - - # Relation between as_sections and as_assessments - db_dml as_assessment_section_map_insert {} - incr as_assessment_section_map__sort_order - set as_item_section_map__sort_order 0 - # Process the items - set as_items [as::qti::parse_item $section [file dirname $xmlfile]] - # Relation between as_items and as_sections - foreach as_item_list $as_items { - array set as_item $as_item_list - set as_item_id $as_item(as_item_id) - set as_item__duration $as_item(duration) - set as_item__points $as_item(points) - db_dml as_item_section_map_insert {} - incr as_item_section_map__sort_order - } - - #get points from a section - db_0or1row get_section_points {} - #update as_assessment_section_map with section points - db_dml update_as_assessment_section_map {} + display_type { + set asdt__display_type $value } - } - } else { - # Just items (no assessments) - as::qti::parse_item $questestinterop [file dirname $xmlfile]] + s_num_items { + set asdt__s_num_items $value + } + adp_chunk { + set asdt__adp_chunk $value + } + branched_p { + set asdt__branched_p $value + } + back_button_p { + set asdt__back_button_p $value + } + submit_answer_p { + set asdt__submit_answer_p $value + } + sort_order_type { + set asdt__sort_order_type $value + } + } + } + } + + #section display type + set display_type_id [as::section_display::new \ + -title $asdt__display_type \ + -num_items $asdt__s_num_items \ + -adp_chunk $asdt__adp_chunk \ + -branched_p $asdt__branched_p \ + -back_button_p $asdt__back_button_p \ + -submit_answer_p $asdt__submit_answer_p \ + -sort_order_type $asdt__sort_order_type] + # Insert section in the CR (and in the as_sections table) getting the revision_id (section_id) + set section_id [as::section::new \ + -name $as_sections__ident \ + -title $as_sections__title \ + -description $as_sections__definition \ + -instructions $as_sections__instructions \ + -feedback_text $as_sections__sectionfeedback \ + -max_time_to_complete $as_sections__duration \ + -num_items $as_sections__num_items \ + -points $as_sections__points \ + -display_type_id $display_type_id] + + # Relation between as_sections and as_assessments +ns_log debug " +DB -------------------------------------------------------------------------------- +DB DAVE debugging procedure as::qti::parse_qti_xml +DB -------------------------------------------------------------------------------- + +DB --------------------------------------------------------------------------------" + db_dml as_assessment_section_map_insert {} + incr as_asmt_sect_map__sort_order + set as_item_sect_map__sort_order 0 + # Process the items + set as_items [as::qti::parse_item $section [file dirname $xmlfile]] + # Relation between as_items and as_sections + foreach as_item_list $as_items { + array set as_item $as_item_list + set as_item_id $as_item(as_item_id) + set as_item__duration $as_item(duration) + set as_item__points [expr int($as_item(points))] + set as_item__required_p $as_item(required_p) + db_dml as_item_section_map_insert {} + incr as_item_sect_map__sort_order + } + + #get points from a section + db_0or1row get_section_points {} + #update as_assessment_section_map with section points + db_dml update_as_assessment_section_map {} } - } - return $as_assessments__assessment_id + } + } else { + # Just items (no assessments) + as::qti::parse_item $questestinterop [file dirname $xmlfile]] + } } +return $as_assessments__assessment_id +} ad_proc -private as::qti::parse_item {qtiNode basepath} { Parse items from a XML QTI file } { + set as_items__ident "" set as_items__description "" set as_items__subtext "" set as_items__field_code "" @@ -438,16 +448,16 @@ set durationNodes [$item selectNodes {duration/text()}] if {[llength $durationNodes] != 0} { set duration [lindex $durationNodes 0] - set as_items__duration [$duration nodeValue] + set as_items__duration [as::qti::duration [$duration nodeValue]] } - #as_items.description = + #as_items.description = } elseif {$nodeName == "qticomment"} { set qticommentNodes [$item selectNodes {qticomment/text()}] if {[llength $qticommentNodes] != 0} { set qticomment [lindex $qticommentNodes 0] set as_items__description [$qticomment nodeValue] } - #as_items.subtext = + #as_items.subtext = } elseif {$nodeName == "rubric"} { set instructionNodes [$item selectNodes {rubric/material/mattext}] if {[llength $instructionNodes] != 0} { @@ -457,72 +467,79 @@ } } - set qtimetadataNodes [$item selectNodes {qtimetadata}] - if {[llength $qtimetadataNodes] > 0} { - #nodes qtimetadatafield - set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] - foreach qtimetadatafieldnode $qtimetadatafieldNodes { - set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] - set label [$label nodeValue] - set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] - set value [$value nodeValue] - - switch -exact -- $label { - field_code { - set as_items__field_code $value - } - required_p { - set as_items__required_p $value - } - data_type { - set as_items__data_type $value - } - increasing_p { - set aitmc__increasing_p $value - } - allow_negative_p { - set aitmc__allow_negative_p $value - } - num_correct_answers { - set aitmc__num_correct_answers $value - } - num_answers { - set aitmc__num_answers $value - } - default_value { - set aitoq__default_value $value - } - feedback_text { - set aitoq__feedback_text $value - } - html_display_options { - set aidrb__html_options $value - } - choice_orientation { - set aidrb__choice_orientation $value - } - choice_label_orientation { - set aidrb__label_orientation $value - } - sort_order_type { - set aidrb__order_type $value - } - item_answer_alignment { - set aidrb__answer_alignment $value - } - abs_size { - set aidta__abs_size $value - } - tb_abs_size { - set aidtb__abs_size $value - } - } - } - } - + set itemmetadataNodes [$item selectNodes {itemmetadata}] + + if { [llength $itemmetadataNodes] > 0 } { + + set qtimetadataNodes [$itemmetadataNodes selectNodes {qtimetadata}] + if {[llength $qtimetadataNodes] > 0} { + #nodes qtimetadatafield + set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] + foreach qtimetadatafieldnode $qtimetadatafieldNodes { + set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] + set label [$label nodeValue] + set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] + if { $value ne "" } { set value [$value nodeValue] } + + switch -exact -- $label { + field_code { + set as_items__field_code $value + } + required_p { + set as_items__required_p $value + } + data_type { + set as_items__data_type $value + } + increasing_p { + set aitmc__increasing_p $value + } + allow_negative_p { + set aitmc__allow_negative_p $value + } + num_correct_answers { + set aitmc__num_correct_answers $value + } + num_answers { + set aitmc__num_answers $value + } + default_value { + set aitoq__default_value $value + } + feedback_text { + set aitoq__feedback_text $value + } + html_display_options { + set aidrb__html_options $value + } + choice_orientation { + set aidrb__choice_orientation $value + } + choice_label_orientation { + set aidrb__label_orientation $value + } + sort_order_type { + set aidrb__order_type $value + } + item_answer_alignment { + set aidrb__answer_alignment $value + } + abs_size { + set aidta__abs_size $value + } + tb_abs_size { + set aidtb__abs_size $value + } + } + } + } + } + # Order of the item_choices set sort_order 0 set as_items__title [$item getAttribute {title} {Item}] + set as_items__ident [$item getAttribute {ident} {Item}] + array set as_item_choices__correct_answer_p {} array set as_item_choices__score {} array set as_item_choices__feedback_text {} @@ -549,45 +566,45 @@ foreach choice $scoreNodes { set choice_id "" set choice_id [string trim [$choice nodeValue]] - - if {[info exists choice_id]} { - set score 0 - # get score - set scoreNodes [$respcondition selectNodes {setvar/text()}] - foreach scorenode $scoreNodes { - set score [string trim [$scorenode nodeValue]] - if {$score>0} { - set as_item_choices__correct_answer_p($choice_id) {t} + + if {[info exists choice_id]} { + set score 0 + # get score + set scoreNodes [$respcondition selectNodes {setvar/text()}] + foreach scorenode $scoreNodes { + set score [expr int([string trim [$scorenode nodeValue]])] + if {$score>0} { + set as_item_choices__correct_answer_p($choice_id) {t} + } } + set as_item_choices__score($choice_id) $score + incr as_items__points $score } - set as_item_choices__score($choice_id) $score - incr as_items__points $score } - } set scoreNodes [$respcondition selectNodes {conditionvar/and/varequal/text()}] foreach choice $scoreNodes { set choice_id "" set choice_id [string trim [$choice nodeValue]] - - if {[info exists choice_id]} { - set score 0 - # get score - set scoreNodes [$respcondition selectNodes {setvar/text()}] - foreach scorenode $scoreNodes { - set score [string trim [$scorenode nodeValue]] - if {$score>0} { - set as_item_choices__correct_answer_p($choice_id) {t} + + if {[info exists choice_id]} { + set score 0 + # get score + set scoreNodes [$respcondition selectNodes {setvar/text()}] + foreach scorenode $scoreNodes { + set score [expr int([string trim [$scorenode nodeValue]])] + if {$score>0} { + set as_item_choices__correct_answer_p($choice_id) {t} + } } + set scoreNodes1 [$respcondition selectNodes {conditionvar/and/varequal}] + if {[llength $scoreNodes1]>0} { + set score1 [expr ($score*1.0/[llength $scoreNodes1])] + } + set as_item_choices__score($choice_id) $score1 + set as_items__points $score } - set scoreNodes1 [$respcondition selectNodes {conditionvar/and/varequal}] - if {[llength $scoreNodes1]>0} { - set score1 [expr ($score*1.0/[llength $scoreNodes1])] - } - set as_item_choices__score($choice_id) $score1 - set as_items__points $score } - } set resp_cond_varNodes [$respcondition selectNodes {conditionvar/varequal/text()}] if {[llength $resp_cond_varNodes]==1} { } else { @@ -612,9 +629,9 @@ set as_items__feedback_right [$as_items__feedback_right nodeValue] } } - } - } - } + } + } + } } } @@ -628,7 +645,7 @@ set material [lindex $materialNodes 0] # Initialize in case it doesn't exist set as_items__title {} - if {[$material nodeName] == {material}} { + if {$material ne "" && [$material nodeName] == {material}} { set mattextNodes [$material selectNodes {mattext}] set mattext [lindex $mattextNodes 0] set as_items__title [as::qti::mattext_gethtml $mattext] @@ -651,9 +668,9 @@ set html "rows $rows cols $cols" # insert as_item_display_ta in the CR (and in the as_item_display_ta table) getting the revision_id (item_display_id) set as_item_display_id [as::item_display_ta::new \ - -html_display_options $html \ - -abs_size $aidta__abs_size \ - -item_answer_alignment $aidrb__answer_alignment] + -html_display_options $html \ + -abs_size $aidta__abs_size \ + -item_answer_alignment $aidrb__answer_alignment] foreach node $presentationChildNodes { # get the title of item if {[$node nodeName] == {material}} { @@ -666,14 +683,14 @@ } # insert as_item_type_oq (shortanswer) set as_item_type_id [as::item_type_oq::new \ - -default_value $aitoq__default_value \ - -feedback_text $aitoq__feedback_text] + -default_value $aitoq__default_value \ + -feedback_text $aitoq__feedback_text] # if render_fib element has not the attribute rows then it's a fill in blank item } else { # textbox set as_item_display_id [as::item_display_tb::new \ - -abs_size $aidtb__abs_size \ - -item_answer_alignment $aidrb__answer_alignment] + -abs_size $aidtb__abs_size \ + -item_answer_alignment $aidrb__answer_alignment] # multiple choice set as_item_type_id [as::item_type_mc::new] @@ -704,79 +721,87 @@ } # Insert as_item set as_item_id [as::item::new \ - -title $as_items__title \ - -description $as_items__description \ - -subtext $as_items__subtext \ - -field_code $as_items__field_code \ - -required_p $as_items__required_p \ - -data_type $as_items__data_type \ - -feedback_right $as_items__feedback_right \ - -feedback_wrong $as_items__feedback_wrong \ - -max_time_to_complete $as_items__duration \ - -points $as_items__points] + -title $as_items__title \ + -description $as_items__description \ + -subtext $as_items__subtext \ + -field_code $as_items__field_code \ + -field_name $as_items__ident \ + -required_p $as_items__required_p \ + -data_type $as_items__data_type \ + -feedback_right $as_items__feedback_right \ + -feedback_wrong $as_items__feedback_wrong \ + -max_time_to_complete $as_items__duration \ + -points $as_items__points] # set the relation between as_items and as_item_type tables as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_type_id -type as_item_type_rel # set the relation between as_items and as_item_display tables as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel set as_item(as_item_id) $as_item_id set as_item(points) $as_items__points set as_item(duration) $as_items__duration + set as_item(required_p) $as_items__required_p lappend as_items [array get as_item] } else { set response_lidNodes [$presentation selectNodes {.//response_lid}] # The first node of the list. It may not be a good idea if it doesn't exist set response_lid [lindex $response_lidNodes 0] - set as_items__rcardinality [$response_lid getAttribute {rcardinality} {Single}] - + if { $response_lid ne "" } { + set as_items__rcardinality [$response_lid getAttribute {rcardinality} {Single}] + } else { + set as_items__rcardinality "" + } + # multiple choice either text (remember it can be internationalized or changed), images, sounds, videos # this is the default set as_item_display_id {} if {$as_items__rcardinality == {Multiple}} { # multiple response (checkbox) either text (remember it can be internationalized or changed), images, sounds, videos # insert as_item_display_cb set as_item_display_id [as::item_display_cb::new \ - -html_display_options $aidrb__html_options \ - -choice_orientation $aidrb__choice_orientation \ - -choice_label_orientation $aidrb__label_orientation \ - -sort_order_type $aidrb__order_type \ - -item_answer_alignment $aidrb__answer_alignment] + -html_display_options $aidrb__html_options \ + -choice_orientation $aidrb__choice_orientation \ + -choice_label_orientation $aidrb__label_orientation \ + -sort_order_type $aidrb__order_type \ + -item_answer_alignment $aidrb__answer_alignment] } else { # multiple choice (radiobutton) # insert as_item_display_rb set as_item_display_id [as::item_display_rb::new \ - -html_display_options $aidrb__html_options \ - -choice_orientation $aidrb__choice_orientation \ - -choice_label_orientation $aidrb__label_orientation \ - -sort_order_type $aidrb__order_type \ - -item_answer_alignment $aidrb__answer_alignment] + -html_display_options $aidrb__html_options \ + -choice_orientation $aidrb__choice_orientation \ + -choice_label_orientation $aidrb__label_orientation \ + -sort_order_type $aidrb__order_type \ + -item_answer_alignment $aidrb__answer_alignment] } # insert as_item_type_mc set as_item_type_id [as::item_type_mc::new \ - -increasing_p $aitmc__increasing_p \ - -allow_negative_p $aitmc__allow_negative_p \ - -num_correct_answers $aitmc__num_correct_answers \ - -num_answers $aitmc__num_answers] - + -increasing_p $aitmc__increasing_p \ + -allow_negative_p $aitmc__allow_negative_p \ + -num_correct_answers $aitmc__num_correct_answers \ + -num_answers $aitmc__num_answers] + # Insert as_item set as_item_id [as::item::new \ - -title $as_items__title \ - -description $as_items__description \ - -subtext $as_items__subtext \ - -field_code $as_items__field_code \ - -required_p $as_items__required_p \ - -data_type $as_items__data_type \ - -feedback_right $as_items__feedback_right \ - -feedback_wrong $as_items__feedback_wrong \ - -max_time_to_complete $as_items__duration \ - -points $as_items__points] + -title $as_items__title \ + -description $as_items__description \ + -subtext $as_items__subtext \ + -field_code $as_items__field_code \ + -field_name $as_items__ident \ + -required_p $as_items__required_p \ + -data_type $as_items__data_type \ + -feedback_right $as_items__feedback_right \ + -feedback_wrong $as_items__feedback_wrong \ + -max_time_to_complete $as_items__duration \ + -points $as_items__points] # set the relation between as_items and as_item_type tables as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_type_id -type as_item_type_rel # set the relation between as_items and as_item_display tables as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel set as_item(as_item_id) $as_item_id set as_item(points) $as_items__points set as_item(duration) $as_items__duration + set as_item(required_p) $as_items__required_p lappend as_items [array get as_item] # (each choice) set response_labelNodes [$presentation selectNodes {.//response_label}] @@ -812,50 +837,76 @@ set resprocessingNodes [$item selectNodes {resprocessing}] foreach resprocessing $resprocessingNodes { - # - set respconditionNodes [$resprocessing selectNodes {respcondition}] - foreach respcondition $respconditionNodes { - set displayfeedbackNode "" - set resp_cond_varNodes [$respcondition selectNodes {conditionvar/varequal/text()}] - if {[llength $resp_cond_varNodes]==1} { - set displayfeedbackNode [$respcondition selectNodes {displayfeedback}] - set choice_identifier [$resp_cond_varNodes nodeValue] - if {[llength $displayfeedbackNode]>0} { - set displayfeedback__ident [$displayfeedbackNode getAttribute {linkrefid}] - set choice_identifier [$resp_cond_varNodes nodeValue] - if {$as_item_choices__ident == $choice_identifier} { - set choices__feedback_text [$item selectNodes "//itemfeedback\[@ident='$displayfeedback__ident'\]/flow_mat/material/mattext/text()"] - if {[llength $choices__feedback_text]>0} { - set as_item_choices__feedback_text($as_item_choices__ident) [$choices__feedback_text nodeValue] - } - } - } - } + # + set respconditionNodes [$resprocessing selectNodes {respcondition}] + foreach respcondition $respconditionNodes { + set displayfeedbackNode "" + set resp_cond_varNodes [$respcondition selectNodes {conditionvar/varequal/text()}] + if {[llength $resp_cond_varNodes]==1} { + set displayfeedbackNode [$respcondition selectNodes {displayfeedback}] + set choice_identifier [$resp_cond_varNodes nodeValue] + if {[llength $displayfeedbackNode]>0} { + set displayfeedback__ident [$displayfeedbackNode getAttribute {linkrefid}] + set choice_identifier [$resp_cond_varNodes nodeValue] + if {$as_item_choices__ident == $choice_identifier} { + set choices__feedback_text [$item selectNodes "//itemfeedback\[@ident='$displayfeedback__ident'\]/flow_mat/material/mattext/text()"] + if {[llength $choices__feedback_text]>0} { + set as_item_choices__feedback_text($as_item_choices__ident) [$choices__feedback_text nodeValue] + } + } + } + } + } } - } # insert as_item_choice as::item_choice::new \ - -mc_id $as_item_type_id \ - -title $as_item_choices__choice_text \ - -sort_order $sort_order \ - -selected_p $selected_p \ - -feedback_text $as_item_choices__feedback_text($as_item_choices__ident) \ - -correct_answer_p $as_item_choices__correct_answer_p($as_item_choices__ident) \ - -percent_score $as_item_choices__score($as_item_choices__ident) \ - -content_value $as_item_choices__content_value + -mc_id $as_item_type_id \ + -title $as_item_choices__choice_text \ + -sort_order $sort_order \ + -selected_p $selected_p \ + -feedback_text $as_item_choices__feedback_text($as_item_choices__ident) \ + -correct_answer_p $as_item_choices__correct_answer_p($as_item_choices__ident) \ + -percent_score $as_item_choices__score($as_item_choices__ident) \ + -content_value $as_item_choices__content_value # order of the item_choices incr sort_order } } #import an image as title of item set matmediaNodes [$presentation selectNodes {material/matimage[@uri]}] - if {[llength $matmediaNodes]>0} { - set mediabasepath [file join $basepath [$matmediaNodes getAttribute {uri}]] - # insert as_file in the CR (and in the as_file table) getting the content value - set as_item_choices__content_value [as::file::new -file_pathname $mediabasepath] - as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_choices__content_value -type as_item_content_rel - } + if {[llength $matmediaNodes]>0} { + set mediabasepath [file join $basepath [$matmediaNodes getAttribute {uri}]] + # insert as_file in the CR (and in the as_file table) getting the content value + set as_item_choices__content_value [as::file::new -file_pathname $mediabasepath] + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_choices__content_value -type as_item_content_rel + } } } return $as_items } + +ad_proc -public as::qti::duration { + duration +} { + Convert duration + + @author Roel Canicula (roel@solutiongrove.com) + @creation-date 2006-05-04 + + @param duration + + @return + + @error +} { + if { [regexp {^\d+$} $duration] } { + return $duration + } elseif { [regexp {^p|P$} $duration] } { + return "" + } elseif { [regexp {^p|P} $duration] } { + # check for format P0Y0M0DT0H1M0S + regexp {t|T(\d+)h|H(\d+)m|M(\d+)s|S} $duration match h m s + # ignore year, month and days for now + return [expr $h*3600+$m*60+$s] + } +} Index: openacs-4/packages/assessment/tcl/as-qti-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-qti-procs.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-qti-procs.xql 22 Feb 2005 15:20:00 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-qti-procs.xql 12 Jun 2006 02:49:50 -0000 1.6 @@ -4,14 +4,14 @@ INSERT INTO as_assessment_section_map (assessment_id, section_id, max_time_to_complete, sort_order, points) - VALUES (:as_assessments__assessment_id, :section_id, :as_sections__duration, :as_assessment_section_map__sort_order, :as_sections__points) + VALUES (:as_assessments__assessment_id, :section_id, :as_sections__duration, :as_asmt_sect_map__sort_order, :as_sections__points) - INSERT INTO as_item_section_map (as_item_id, section_id, sort_order, points, max_time_to_complete) - VALUES (:as_item_id, :section_id, :as_item_section_map__sort_order, :as_item__points, :as_item__duration) + INSERT INTO as_item_section_map (as_item_id, section_id, sort_order, points, max_time_to_complete, required_p) + VALUES (:as_item_id, :section_id, :as_item_sect_map__sort_order, :as_item__points, :as_item__duration, :as_item__required_p) @@ -31,4 +31,17 @@ + + + + update as_item_section_map + set as_item_id = :new_item_id, + points = :points, + required_p = :required_p + where section_id = :new_section_id + and as_item_id = :as_item_id + + + + Index: openacs-4/packages/assessment/tcl/as-section-display-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-display-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-section-display-procs-oracle.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,33 @@ + + + + + + + + + + oracle + 8.1.7 + + + + + update as_section_display_types + set adp_chunk=empty_clob() + where display_type_id=:display_id + returning adp_chunk into :1 + + + + + + update as_section_display_types + set adp_chunk=empty_clob() + where display_type_id=:display_id + returning adp_chunk into :1 + + + + \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-section-display-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-display-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-section-display-procs-postgresql.xql 12 Jun 2006 02:49:50 -0000 1.2 @@ -0,0 +1,33 @@ + + + + + + + + + + + postgresql + 7.4 + + + + + update as_section_display_types + set adp_chunk=:adp_chunk + where display_type_id=:display_id + + + + + + update as_section_display_types + set adp_chunk=:adp_chunk + where display_type_id=:display_id + + + + + \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-section-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-display-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-section-display-procs.tcl 19 Jan 2005 16:49:14 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-section-display-procs.tcl 12 Jun 2006 02:49:50 -0000 1.3 @@ -26,21 +26,20 @@ # Insert as_section_display_type in the CR (and as_section_display_types table) getting the revision_id (display_type_id) db_transaction { - set display_item_id [content::item::new -parent_id $folder_id -content_type {as_section_display_types} -name [exec uuidgen]] + set display_item_id [content::item::new -parent_id $folder_id -content_type {as_section_display_types} -name [as::item::generate_unique_name]] set display_id [content::revision::new \ -item_id $display_item_id \ -content_type {as_section_display_types} \ -title $title \ -description $description \ -attributes [list [list num_items $num_items] \ - [list adp_chunk $adp_chunk] \ [list branched_p $branched_p] \ [list back_button_p $back_button_p] \ [list submit_answer_p $submit_answer_p] \ [list sort_order_type $sort_order_type] ] ] } - + db_dml update_clobs "" -clobs [list $adp_chunk] return $display_id } @@ -70,12 +69,11 @@ -title $title \ -description $description \ -attributes [list [list num_items $num_items] \ - [list adp_chunk $adp_chunk] \ [list branched_p $branched_p] \ [list back_button_p $back_button_p] \ [list submit_answer_p $submit_answer_p] \ [list sort_order_type $sort_order_type] ] ] } - + db_dml update_clobs "" -clobs [list $adp_chunk] return $display_id } Index: openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql 11 Mar 2005 18:54:12 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql 12 Jun 2006 02:49:50 -0000 1.7 @@ -36,7 +36,7 @@ select i.as_item_id, ci.name, cr.title, cr.description, i.subtext, m.required_p, m.max_time_to_complete, r2.revision_id as content_rev_id, r2.title as content_filename, ci2.content_type, m.fixed_position, - ir.target_rev_id as as_item_type_id + ir.target_rev_id as as_item_type_id, i.validate_block from as_item_section_map m, as_items i, cr_revisions cr, cr_items ci, as_item_rels ar, cr_revisions r2, cr_items ci2, as_item_rels ir where ar.item_rev_id (+) = i.as_item_id @@ -98,5 +98,31 @@ - + + + + update as_sections set instructions=empty_clob() + where section_id=:as_section_id + returning instructions into :1 + + + + + + update as_sections set instructions=empty_clob(), + feedback_text=empty_clob() + where section_id=:new_section_id + returning instructions,feedback_text into :1, :2 + + + + + + update as_sections set instructions=empty_clob(), + feedback_text=empty_clob() + where section_id=:new_section_id + returning instructions,feedback_text into :1, :2 + + + Index: openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql 11 Mar 2005 18:54:12 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql 12 Jun 2006 02:49:50 -0000 1.7 @@ -8,7 +8,7 @@ select s.as_item_id, ci.name, r.title, r.description, i.subtext, m.required_p, m.max_time_to_complete, r2.revision_id as content_rev_id, r2.title as content_filename, ci2.content_type, - ir.target_rev_id as as_item_type_id + ir.target_rev_id as as_item_type_id, i.validate_block from cr_items ci, as_items i, as_item_section_map m, cr_revisions r, as_item_rels ir, as_session_items s left outer join as_item_rels ar on (ar.item_rev_id = s.as_item_id and ar.rel_type = 'as_item_content_rel') @@ -34,7 +34,7 @@ select i.as_item_id, ci.name, cr.title, cr.description, i.subtext, m.required_p, m.max_time_to_complete, r2.revision_id as content_rev_id, r2.title as content_filename, ci2.content_type, m.fixed_position, - ir.target_rev_id as as_item_type_id + ir.target_rev_id as as_item_type_id, i.validate_block from as_item_section_map m, cr_revisions cr, cr_items ci, as_item_rels ir, as_items i left outer join as_item_rels ar on (ar.item_rev_id = i.as_item_id and ar.rel_type = 'as_item_content_rel') @@ -95,5 +95,28 @@ - + + + + update as_sections set instructions=:instructions + where section_id=:as_section_id + + + + + + update as_sections + set instructions=:instructions, feedback_text=:feedback_text + where section_id=:new_section_id + + + + + + update as_sections + set instructions=:instructions, feedback_text=:feedback_text + where section_id=:new_section_id + + + Index: openacs-4/packages/assessment/tcl/as-section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.tcl,v diff -u -N -r1.25 -r1.26 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 25 May 2005 16:59:55 -0000 1.25 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 12 Jun 2006 02:49:50 -0000 1.26 @@ -16,20 +16,25 @@ {-num_items ""} {-display_type_id ""} {-points ""} - + {-package_id ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-07-26 New section to the database } { - set package_id [ad_conn package_id] + if {$package_id eq "" \ + && [ad_conn -connected_p]} { + set package_id [ad_conn package_id] + } set folder_id [as::assessment::folder_id -package_id $package_id] # Insert as_section in the CR (and as_sections table) getting the revision_id (as_section_id) db_transaction { set section_item_id [db_nextval acs_object_id_seq] - if {[empty_string_p $name]} { + if { ![empty_string_p $name] && [db_0or1row item_exists {}] } { + set name "$section_item_id: $name" + } elseif {[empty_string_p $name]} { set name "SEC_$section_item_id" } set section_item_id [content::item::new -item_id $section_item_id -parent_id $folder_id -content_type {as_sections} -name $name] @@ -39,14 +44,13 @@ -content_type {as_sections} \ -title $title \ -description $description \ - -attributes [list [list instructions $instructions] \ - [list feedback_text $feedback_text] \ - [list max_time_to_complete $max_time_to_complete] \ + -attributes [list [list max_time_to_complete $max_time_to_complete] \ [list num_items $num_items] \ [list display_type_id $display_type_id] \ [list points $points] ] ] } + db_dml update_clobs {} -clobs [list $instructions $feedback_text] return $as_section_id } @@ -76,13 +80,13 @@ -content_type {as_sections} \ -title $title \ -description $description \ - -attributes [list [list instructions $instructions] \ - [list feedback_text $feedback_text] \ + -attributes [list \ [list max_time_to_complete $max_time_to_complete] \ [list num_items $num_items] \ [list display_type_id $display_type_id] \ [list points $points] ] ] + db_dml update_clobs {} -clobs [list $instructions $feedback_text] copy_items -section_id $section_id -new_section_id $new_section_id as::assessment::check::copy_checks -section_id $section_id -new_section_id $new_section_id -assessment_id $assessment_id } @@ -107,8 +111,7 @@ -content_type {as_sections} \ -title $title \ -description $description \ - -attributes [list [list instructions $instructions] \ - [list feedback_text $feedback_text] \ + -attributes [list \ [list max_time_to_complete $max_time_to_complete] \ [list num_items $num_items] \ [list display_type_id $display_type_id] \ @@ -119,6 +122,7 @@ as::assessment::check::copy_checks -section_id $section_id -new_section_id $new_section_id -assessment_id $assessment_id } + db_dml update_clobs {} -clobs [list $instructions $feedback_text] return $new_section_id } @@ -202,7 +206,7 @@ {-session_id:required} {-sort_order_type ""} {-num_items ""} - {-random_p ""} + {-random_p "t"} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-14 @@ -220,7 +224,7 @@ set open_positions "" set max_pos 0 db_foreach section_items {} { - set section_items($as_item_id) [list $name $title $description $subtext $required_p $max_time_to_complete $content_rev_id $content_filename $content_type $as_item_type_id] + set section_items($as_item_id) [list $name $title $description $subtext $required_p $max_time_to_complete $content_rev_id $content_filename $content_type $as_item_type_id $validate_block] if {![empty_string_p $fixed_position] && $fixed_position != "0"} { set fixed_positions($fixed_position) $as_item_id if {$max_pos < $fixed_position} { @@ -239,6 +243,7 @@ } # sort item positions that are not fixed + switch -exact $sort_order_type { alphabetical { set open_positions [lsort -dictionary -index 1 $open_positions] Index: openacs-4/packages/assessment/tcl/as-section-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.xql,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/assessment/tcl/as-section-procs.xql 13 Apr 2005 10:48:29 -0000 1.12 +++ openacs-4/packages/assessment/tcl/as-section-procs.xql 12 Jun 2006 02:49:50 -0000 1.13 @@ -113,5 +113,15 @@ + + + select item_id + from cr_items + where parent_id = :folder_id + and name = :name + + + + Index: openacs-4/packages/assessment/tcl/as-session-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-session-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-session-procs.tcl 22 Nov 2004 11:59:23 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-session-procs.tcl 12 Jun 2006 02:49:50 -0000 1.4 @@ -31,21 +31,31 @@ # db_0or1row as_session_last {SELECT session_id AS as_session_id FROM as_sessionsx WHERE subject_id = :subject_id AND assessment_id = :assessment_id} # if { ! [info exists as_session_id] } { # Insert as_session in the CR (and as_sessions table) getting the revision_id (session_id) - set session_id [content::item::new -parent_id $folder_id -content_type {as_sessions} -name "$subject_id-$assessment_id-[exec uuidgen]" -title "$subject_id-$assessment_id-[exec uuidgen]" ] - set as_session_id [content::revision::new \ - -item_id $session_id \ - -content_type {as_sessions} \ - -title "$subject_id-$assessment_id-[exec uuidgen]" \ - -attributes [list [list assessment_id $assessment_id] \ - [list subject_id $subject_id] \ - [list staff_id $staff_id] \ - [list target_datetime $target_datetime] \ - [list creation_datetime $creation_datetime] \ - [list first_mod_datetime $first_mod_datetime] \ - [list last_mod_datetime $last_mod_datetime] \ - [list completed_datetime $completed_datetime] \ - [list percent_score $percent_score] \ - [list consent_timestamp $consent_timestamp] ] ] + + set transaction_successful_p 0 + + while { ! $transaction_successful_p } { + db_transaction { + set session_id [content::item::new -parent_id $folder_id -content_type {as_sessions} -name "$subject_id-$assessment_id-[as::item::generate_unique_name]" -title "$subject_id-$assessment_id-[as::item::generate_unique_name]" ] + set as_session_id [content::revision::new \ + -item_id $session_id \ + -content_type {as_sessions} \ + -title "$subject_id-$assessment_id-[as::item::generate_unique_name]" \ + -attributes [list [list assessment_id $assessment_id] \ + [list subject_id $subject_id] \ + [list staff_id $staff_id] \ + [list target_datetime $target_datetime] \ + [list creation_datetime $creation_datetime] \ + [list first_mod_datetime $first_mod_datetime] \ + [list last_mod_datetime $last_mod_datetime] \ + [list completed_datetime $completed_datetime] \ + [list percent_score $percent_score] \ + [list consent_timestamp $consent_timestamp] ] ] + set transaction_successful_p 1 + } on_error { + ns_log notice "as::session::new: Transaction Error: $errmsg" + } + } # } return $as_session_id } Index: openacs-4/packages/assessment/tcl/as-session-results-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-session-results-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-session-results-procs.tcl 21 Feb 2005 14:32:56 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-session-results-procs.tcl 12 Jun 2006 02:49:50 -0000 1.2 @@ -21,17 +21,24 @@ set folder_id [as::assessment::folder_id -package_id $package_id] # Insert as_session_results in the CR (and as_session_results table) getting the revision_id - db_transaction { - if {![db_0or1row result_exists {}]} { - set result_item_id [content::item::new -parent_id $folder_id -content_type {as_session_results} -name [exec uuidgen]] + set transaction_successful_p 0 + + while { ! $transaction_successful_p } { + db_transaction { + if {![db_0or1row result_exists {}]} { + set result_item_id [content::item::new -parent_id $folder_id -content_type {as_session_results} -name [as::item::generate_unique_name]] } - set result_id [content::revision::new \ - -item_id $result_item_id \ - -content_type {as_session_results} \ - -title $title \ - -description $description \ - -attributes [list [list target_id $target_id] \ - [list points $points] ] ] + set result_id [content::revision::new \ + -item_id $result_item_id \ + -content_type {as_session_results} \ + -title $title \ + -description $description \ + -attributes [list [list target_id $target_id] \ + [list points $points] ] ] + set transaction_successful_p 1 + } on_error { + ns_log notice "as::session_results::new: Transaction Error: $errmsg" + } } return $result_id Index: openacs-4/packages/assessment/tcl/callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/callback-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/callback-procs.tcl 14 Jun 2005 15:38:45 -0000 1.2 +++ openacs-4/packages/assessment/tcl/callback-procs.tcl 12 Jun 2006 02:49:50 -0000 1.3 @@ -7,8 +7,7 @@ Return the properly formed link (URL) that the user will click to go into the registration process. } { - set assessment_id [parameter::get -parameter AsmForRegisterId] - + set assessment_id [parameter::get -parameter RegistrationId -default 0] if { $assessment_id != 0 } { set package_id [db_string package_id {}] @@ -17,3 +16,80 @@ } } + +#Callbacks for application-track + +ad_proc -callback application-track::getApplicationName -impl assessments {} { + callback implementation + } { + return "assessments" + } + +ad_proc -callback application-track::getGeneralInfo -impl assessments {} { + callback implementation + } { + db_1row my_query { + select count(1) as result + FROM as_assessments a,dotlrn_communities_all com, acs_objects ac, acs_objects ac2,acs_objects ac3 + WHERE com.community_id = 2560 + and a.assessment_id = ac.object_id + and ac.context_id = ac2.object_id + and ac2.package_id = ac3.object_id + and ac3.context_id = com.package_id + } + + return "$result" + } + +ad_proc -callback application-track::getSpecificInfo -impl assessments {} { + callback implementation + } { + + upvar $query_name my_query + upvar $elements_name my_elements + + set my_query { + SELECT a.assessment_id as id,a.instructions as instructions,a.start_time as initial_date, + a.end_time as finish_date, + a.number_tries + FROM as_assessments a,dotlrn_communities_all com, acs_objects ac, acs_objects ac2,acs_objects ac3 + WHERE com.community_id = :class_instance_id + and a.assessment_id = ac.object_id + and ac.context_id = ac2.object_id + and ac2.package_id = ac3.object_id + and ac3.context_id = com.package_id + } + + set my_elements { + + id { + label "id" + display_col id + html {align center} + } + instructions { + label "instructions" + display_col instructions + html {align center} + } + creation_date { + label "creation_date" + display_col initial_date + html {align center} + } + finish_date { + label "finish_date" + display_col finish_time + html {align center} + } + number_tries { + label "number_tries" + display_col number_tries + html {align center} + } + + } + + return "OK" + } + \ No newline at end of file Index: openacs-4/packages/assessment/www/assessment-consent.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-consent.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/assessment-consent.adp 6 May 2005 15:57:13 -0000 1.3 +++ openacs-4/packages/assessment/www/assessment-consent.adp 12 Jun 2006 02:49:51 -0000 1.4 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
@assessment_data.consent_page;noquote@ Index: openacs-4/packages/assessment/www/assessment-consent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-consent.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/assessment-consent.tcl 9 May 2005 21:58:24 -0000 1.5 +++ openacs-4/packages/assessment/www/assessment-consent.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -8,14 +8,13 @@ session_id:integer,notnull assessment_id:integer,notnull {password:optional ""} - {next_asm:optional} } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } set page_title "[_ assessment.Confirm_Consent]" -set context [list $page_title] +set context_bar [ad_context_bar $page_title] # Get the assessment data as::assessment::data -assessment_id $assessment_id Index: openacs-4/packages/assessment/www/assessment-password.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-password.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/assessment-password.adp 6 May 2005 16:11:13 -0000 1.2 +++ openacs-4/packages/assessment/www/assessment-password.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/assessment-password.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-password.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/assessment-password.tcl 6 May 2005 16:11:13 -0000 1.2 +++ openacs-4/packages/assessment/www/assessment-password.tcl 12 Jun 2006 02:49:51 -0000 1.3 @@ -7,13 +7,13 @@ } -query { assessment_id:integer,notnull } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } set user_id [ad_conn user_id] set page_title "[_ assessment.Password_Enter]" -set context [list $page_title] +set context_bar [ad_context_bar $page_title] # Get the assessment data as::assessment::data -assessment_id $assessment_id Index: openacs-4/packages/assessment/www/assessment-section-submit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-section-submit.adp,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/assessment/www/assessment-section-submit.adp 8 Dec 2005 11:20:44 -0000 1.10 +++ openacs-4/packages/assessment/www/assessment-section-submit.adp 12 Jun 2006 02:49:51 -0000 1.11 @@ -1,103 +1,83 @@ -@page_title;noquote@ +@assessment_data.html_title;noquote@ @context;noquote@ + - - - - - - - - -
@assessment_data.title@
@assessment_data.instructions;noquote@
-#assessment.section_counter# -
#assessment.item_counter# -
#assessment.session_time_remaining#
-
#assessment.section_time_remaining#
-

- - - - -
@section.title@
@section.description@
@section.instructions;noquote@
+ - +

@assessment_data.html_title;noquote@

+

@assessment_data.instructions;noquote@

+
#assessment.session_time_remaining#
+
#assessment.section_time_remaining#
- +
+ @section.title@ +

@section.description;noquote@

+

@section.instructions;noquote@

- -
- - -
@items.name@: *@items.title;noquote@ * -

@items.content;noquote@ - -
-
- - - - - - -
- + + + +

@items.name@: *

+
+ @items.title;noquote@ * +

@items.content;noquote@

+ -
- - - - - - - - - - - - - - - - - -
@formgroup.label;noquote@
@items.description;noquote@ - @formgroup.widget;noquote@ @formgroup.label;noquote@
-
- - -
- @formgroup.widget;noquote@ @formgroup.label;noquote@ - -
- - - -
@formgroup.widget;noquote@
- - - - @items.html;noquote@ - - - - +
- -
- [i] - @items.subtext@ -
-
+ + + + + @formgroup.label;noquote@ + + + + -
-
+ +
+ + + @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+
+ + + @formgroup.widget;noquote@ @formgroup.label;noquote@ + +
+
+ + + @formgroup.widget;noquote@ + + +
+
+ + + @items.html;noquote@ + + + + + +
+ [i] + @items.subtext@ +
+
+
+ + + -
-

-
- + + + + \ No newline at end of file Index: openacs-4/packages/assessment/www/assessment-single-submit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-single-submit.adp,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/www/assessment-single-submit.adp 30 May 2005 10:53:27 -0000 1.7 +++ openacs-4/packages/assessment/www/assessment-single-submit.adp 12 Jun 2006 02:49:51 -0000 1.8 @@ -1,13 +1,13 @@ -@page_title;noquote@ +@assessment_data.html_title;noquote@ @context;noquote@ - + Index: openacs-4/packages/assessment/www/assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment.tcl,v diff -u -N -r1.50 -r1.51 --- openacs-4/packages/assessment/www/assessment.tcl 7 Feb 2006 10:44:57 -0000 1.50 +++ openacs-4/packages/assessment/www/assessment.tcl 12 Jun 2006 02:49:51 -0000 1.51 @@ -15,6 +15,7 @@ {return_url:optional} response_to_item:array,optional,multiple,html {next_asm:optional} + {response:multiple,optional} } -properties { context:onevalue page_title:onevalue @@ -27,6 +28,7 @@ set item_to "" set url "" + if { [info exists return_url] } { set url $return_url @@ -243,6 +245,8 @@ as::assessment::calculate -session_id $session_id -assessment_id $assessment_rev_id db_dml session_finished {} as::assessment::check::eval_aa_checks -session_id $session_id -assessment_id $assessment_id + # section based aa checks + as::assessment::check::eval_sa_checks -session_id $session_id -assessment_id $assessment_id as::assessment::check::eval_m_checks -session_id $session_id -assessment_id $assessment_id if {[empty_string_p $assessment_data(return_url)]} { ad_returnredirect [export_vars -base finish {session_id assessment_id return_url next_asm}] @@ -259,20 +263,27 @@ {session_id:text(hidden) {value $session_id}} } -multirow create items as_item_id name title description subtext required_p max_time_to_complete presentation_type html submitted_p content as_item_type_id choice_orientation next_title next_pr_type +multirow create items as_item_id name title description subtext required_p max_time_to_complete presentation_type html submitted_p content as_item_type_id choice_orientation next_title validate_block next_pr_type set unsubmitted_list [list] set validate_list [list] set required_count 0 foreach one_item $item_list { - util_unlist $one_item as_item_id name title description subtext required_p max_time_to_complete content_rev_id content_filename content_type as_item_type_id + util_unlist $one_item as_item_id name title description subtext required_p max_time_to_complete content_rev_id content_filename content_type as_item_type_id validate_block if {$required_p == "t"} { # make sure that mandatory items are answered lappend validate_list "response_to_item.$as_item_id {\[exists_and_not_null response_to_item($as_item_id)\]} \"\[_ assessment.form_element_required\]\"" incr required_count } + + foreach {check_expr check_message} [split $validate_block \n] { + regsub -all {%answer%} $check_expr \$response_to_item($as_item_id) check_expr + regsub -all {%answer%} [lang::util::localize $check_message] \$response_to_item($as_item_id) check_message + lappend validate_list "response_to_item.$as_item_id { $check_expr } { $check_message }" + } + set default_value "" set submitted_p f @@ -317,6 +328,7 @@ # save answer set response_item_id \$item_id + db_1row process_item_type {} set item_type \[string range \$item_type end-1 end\] if {!\[info exists response_to_item(\$response_item_id)\]} { @@ -330,7 +342,14 @@ } set points \[ad_decode \$points \"\" 0 \$points\] - as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response_to_item(\$response_item_id) -max_points \$points -allow_overwrite_p \$display(back_button_p) + + set response \$response_to_item(\$response_item_id) + + if { \$item_type == \"fu\" } { + set response \[list \$response_to_item(\$response_item_id) \$response_to_item(\${response_item_id}.tmpfile) \$response_to_item(\${response_item_id}.content-type)\] + } + + as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response -max_points \$points -allow_overwrite_p \$display(back_button_p) } }" set after_submit "{ @@ -373,6 +392,10 @@ } } +ad_form -extend -name show_item_form -on_request { + as::assessment::check::eval_or_checks -session_id $session_id -section_id $section_id +} + if {$display(submit_answer_p) != "t"} { # process multiple submit set template "assessment-section-submit" @@ -398,7 +421,13 @@ } set points \[ad_decode \$points \"\" 0 \$points\] - as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response_to_item(\$response_item_id) -max_points \$points -allow_overwrite_p \$display(back_button_p) + set response \$response_to_item(\$response_item_id) + + if { \$item_type == \"fu\" } { + set response \[list \$response_to_item(\$response_item_id) \$response_to_item(\${response_item_id}.tmpfile) \$response_to_item(\${response_item_id}.content-type)\] + } + + as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response -max_points \$points -allow_overwrite_p \$display(back_button_p) } if {\$section_order != \$new_section_order} { @@ -434,6 +463,8 @@ as::assessment::calculate -session_id \$session_id -assessment_id \$assessment_rev_id db_dml session_finished {} as::assessment::check::eval_aa_checks -session_id $session_id -assessment_id $assessment_id + # section based aa checks + as::assessment::check::eval_sa_checks -session_id $session_id -assessment_id $assessment_id as::assessment::check::eval_m_checks -session_id $session_id -assessment_id $assessment_id if {\[empty_string_p \$assessment_data(return_url)\]} { ad_returnredirect \[export_vars -base finish {session_id assessment_id return_url next_asm}\] @@ -458,7 +489,14 @@ set item_type [string range $item_type end-1 end] set points [ad_decode $points "" 0 $points] - as::item_type_$item_type\::process -type_id $item_type_id -session_id $session_id -as_item_id $response_item_id -section_id $section_id -subject_id $user_id -response "" -max_points $points -allow_overwrite_p $display(back_button_p) + set response \$response_to_item(\$response_item_id)\ + + if { \$item_type == \"fu\" } { + set response \[list \$response_to_item(\$response_item_id) \$response_to_item(\${response_item_id}.tmpfile) \$response_to_item(\${response_item_id}.content-type)\] + } + + as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response -max_points \$points -allow_overwrite_p \$display(back_button_p) + } if {$section_order != $new_section_order} { @@ -480,6 +518,8 @@ as::assessment::calculate -session_id $session_id -assessment_id $assessment_rev_id db_dml session_finished {} as::assessment::check::eval_aa_checks -session_id $session_id -assessment_id $assessment_id + # section based aa checks + as::assessment::check::eval_sa_checks -session_id $session_id -assessment_id $assessment_id as::assessment::check::eval_m_checks -session_id $session_id -assessment_id $assessment_id if {[empty_string_p $assessment_data(return_url)]} { ad_returnredirect [export_vars -base finish {session_id assessment_id return_url next_asm}] Index: openacs-4/packages/assessment/www/assessment.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment.xql,v diff -u -N -r1.16 -r1.17 --- openacs-4/packages/assessment/www/assessment.xql 7 Feb 2006 10:44:57 -0000 1.16 +++ openacs-4/packages/assessment/www/assessment.xql 12 Jun 2006 02:49:51 -0000 1.17 @@ -19,7 +19,7 @@ from as_sessions where completed_datetime is null and assessment_id = :assessment_rev_id - and subject_id = :user_id + and subject_id = :user_id and subject_id <> 0 Index: openacs-4/packages/assessment/www/finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/finish.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/finish.tcl 9 May 2005 21:58:24 -0000 1.6 +++ openacs-4/packages/assessment/www/finish.tcl 12 Jun 2006 02:49:51 -0000 1.7 @@ -15,22 +15,35 @@ } set user_id [ad_conn user_id] -if { $user_id != 0} { - db_dml update_session {update as_sessions set subject_id=:user_id where session_id=:session_id} + +if { ![string eq $user_id 0]} { + db_dml update_session {update as_sessions set subject_id=:user_id where session_id=:session_id} + db_dml update_session {update as_item_data set subject_id=:user_id where session_id=:session_id} } -if {[info exists return_url]} { - if { $return_url != ""} { - ad_returnredirect "$return_url" - } -} + set page_title "[_ assessment.Response_Submitted]" set context [list $page_title] +callback imsld::finish_object -object_id $assessment_id + + if { [exists_and_not_null next_asm ] } { ad_returnredirect "assessment?assessment_id=$next_asm" +} + +set value [parameter::get -parameter "RegistrationId" -package_id [subsite::main_site_id]] + +if {[info exists return_url]} { + if { $return_url != ""} { + ad_returnredirect "$return_url" + } else { + if { [string eq $value $assessment_id] } { + ad_returnredirect "/pvt/home" + } + } } ad_return_template Index: openacs-4/packages/assessment/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/index.tcl,v diff -u -N -r1.14 -r1.15 --- openacs-4/packages/assessment/www/index.tcl 29 Apr 2005 18:38:50 -0000 1.14 +++ openacs-4/packages/assessment/www/index.tcl 12 Jun 2006 02:49:51 -0000 1.15 @@ -24,7 +24,7 @@ -elements { title { label "[_ assessment.open_assessments]" - display_template {@assessments.title@} + display_template {@assessments.title;noquote@} } } -main_class { narrow @@ -33,6 +33,7 @@ # get the information of all open assessments template::multirow create assessments assessment_id title description assessment_url db_foreach open_asssessments {} { + set title [as::assessment::title -title $title] if {([empty_string_p $start_time] || $start_time <= $cur_time) && ([empty_string_p $end_time] || $end_time >= $cur_time)} { if {[empty_string_p $password]} { set assessment_url [export_vars -base "assessment" {assessment_id}] @@ -51,7 +52,7 @@ -elements { title { label "[_ assessment.Assessments]" - display_template {@sessions.title@} + display_template {@sessions.title;noquote@} } session { label {[_ assessment.Sessions]} Index: openacs-4/packages/assessment/www/session.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.adp,v diff -u -N -r1.27 -r1.28 --- openacs-4/packages/assessment/www/session.adp 6 May 2005 16:07:13 -0000 1.27 +++ openacs-4/packages/assessment/www/session.adp 12 Jun 2006 02:49:51 -0000 1.28 @@ -1,13 +1,13 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
@assessment_data.title@
@assessment_data.instructions;noquote@
-#assessment.section_counter# -
#assessment.item_counter# +
#assessment.session_time_remaining#

#assessment.section_time_remaining#
- - - + + + @@ -28,7 +28,7 @@
#assessment.Assessment#: @assessment_data.title@
#assessment.User_ID#: @first_names@ @last_name@#assessment.anonymous_name##assessment.Attempt#: @session_attempt@ / @assessment_data.number_tries@#assessment.Percent_Score#: @assessment_score@
#assessment.User_ID#: @first_names@ @last_name@
#assessment.lt_bNoteb_This_assessmen#
#assessment.anonymous_name#
#assessment.Attempt#: @session_attempt@ / @assessment_data.number_tries@ #assessment.Percent_Score#: @assessment_score@
#assessment.Started#: @session_start@ #assessment.Finished#: @session_finish@
@@ -48,4 +48,7 @@
#assessment.section# @sections.title@ (#assessment.max_time# @sections.max_time_to_complete@) - (@sections.points@ / @sections.max_points@ #assessment.points#) + (@sections.points@ / @sections.max_points@ #assessment.points#)
@sections.description@

#assessment.Total_score#: @session_score@ / @assessment_score@ = @percent_score@% + + +
Index: openacs-4/packages/assessment/www/session.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.tcl,v diff -u -N -r1.34 -r1.35 --- openacs-4/packages/assessment/www/session.tcl 6 May 2005 16:07:13 -0000 1.34 +++ openacs-4/packages/assessment/www/session.tcl 12 Jun 2006 02:49:51 -0000 1.35 @@ -8,7 +8,7 @@ } { session_id:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -29,7 +29,7 @@ } set page_title "[_ assessment.View_Results]" -set context [list [list [export_vars -base sessions {assessment_id}] "[_ assessment.Show_Sessions]"] $page_title] +set context_bar [ad_context_bar [list [export_vars -base sessions {assessment_id}] "[_ assessment.Show_Sessions]"] $page_title] set format "[lc_get formbuilder_date_format], [lc_get formbuilder_time_format]" set session_user_url [acs_community_member_url -user_id $subject_id] @@ -67,4 +67,8 @@ incr assessment_score $max_points } +set showpoints [parameter::get -parameter "ShowPoints" -default 1 ] + +set comments_installed_p [apm_package_enabled_p "general-comments"] + ad_return_template Index: openacs-4/packages/assessment/www/sessions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/sessions.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/sessions.adp 6 May 2005 16:07:13 -0000 1.4 +++ openacs-4/packages/assessment/www/sessions.adp 12 Jun 2006 02:49:51 -0000 1.5 @@ -1,5 +1,5 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@ Index: openacs-4/packages/assessment/www/sessions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/sessions.tcl,v diff -u -N -r1.17 -r1.18 --- openacs-4/packages/assessment/www/sessions.tcl 6 May 2005 16:07:13 -0000 1.17 +++ openacs-4/packages/assessment/www/sessions.tcl 12 Jun 2006 02:49:51 -0000 1.18 @@ -10,12 +10,12 @@ assessment_id:notnull {subject_id:integer,optional ""} } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } set page_title "[_ assessment.Show_Sessions]" -set context [list $page_title] +set context_bar [ad_context_bar $page_title] set format "[lc_get formbuilder_date_format], [lc_get formbuilder_time_format]" set user_id [ad_conn user_id] permission::require_permission -object_id $assessment_id -privilege read @@ -62,7 +62,7 @@ } assessment_name { label {Assessment} - display_template {@sessions.assessment_name@@sessions.assessment_name@} + display_template {@sessions.assessment_name;noquote@@sessions.assessment_name;noquote@} } completed_datetime { label {[_ assessment.Finish_Time]} @@ -87,7 +87,7 @@ } assessment_name { label {Assessment} - display_template {@sessions.assessment_name@@sessions.assessment_name@} + display_template {@sessions.assessment_name;noquote@@sessions.assessment_name;noquote@} } completed_datetime { label {[_ assessment.Finish_Time]} Index: openacs-4/packages/assessment/www/admin/asm-action-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-delete.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/admin/asm-action-delete.adp 6 May 2005 17:05:16 -0000 1.4 +++ openacs-4/packages/assessment/www/admin/asm-action-delete.adp 12 Jun 2006 02:49:51 -0000 1.5 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context;noquote@ +Action Delete +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/admin/asm-action-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-delete.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/admin/asm-action-delete.tcl 6 May 2005 17:05:16 -0000 1.4 +++ openacs-4/packages/assessment/www/admin/asm-action-delete.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -5,13 +5,10 @@ @cvs-id $Id: } { action_id:integer -} -properties { - page_title:onevalue - context:onevalue } set page_title [_ assessment.delete] -set context [list [list index [_ assessment.admin]] [list [export_vars -base asm-action-new {action_id} ] [_ assessment.action_admin] ] $page_title] +set context_bar [ad_context_bar [list [export_vars -base asm-action-new {action_id} ] [_ assessment.action_admin] ] $page_title] db_1row select_action_info {select name,description,tcl_code from as_actions where action_id = :action_id} Index: openacs-4/packages/assessment/www/admin/asm-action-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-new.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/admin/asm-action-new.adp 6 May 2005 17:05:16 -0000 1.4 +++ openacs-4/packages/assessment/www/admin/asm-action-new.adp 12 Jun 2006 02:49:51 -0000 1.5 @@ -1,6 +1,6 @@ @page_title@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/admin/asm-action-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-new.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/www/admin/asm-action-new.tcl 6 May 2005 17:14:17 -0000 1.7 +++ openacs-4/packages/assessment/www/admin/asm-action-new.tcl 12 Jun 2006 02:49:51 -0000 1.8 @@ -5,9 +5,6 @@ @cvs-id $Id: } { action_id:optional -} -properties { - title:onevalue - context:onevalue } set package_id [ad_conn package_id] @@ -24,7 +21,7 @@ } set page_title "[_ assessment.add_new_action]" -set context [list [list [export_vars -base asm-action-admin ] [_ assessment.action_admin]] $page_title] +set context_bar [ad_context_bar [list [export_vars -base asm-action-admin ] [_ assessment.action_admin]] $page_title] ad_form -name action_admin -form { action_id:key Index: openacs-4/packages/assessment/www/admin/asm-action-param-admin.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-param-admin.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/admin/asm-action-param-admin.adp 6 May 2005 17:05:16 -0000 1.5 +++ openacs-4/packages/assessment/www/admin/asm-action-param-admin.adp 12 Jun 2006 02:49:51 -0000 1.6 @@ -1,5 +1,5 @@ -@page_title;noquote@ +@page_title@ @context;noquote@
Index: openacs-4/packages/assessment/www/admin/asm-action-param-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-param-admin.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/admin/asm-action-param-admin.tcl 9 Jun 2005 19:19:47 -0000 1.6 +++ openacs-4/packages/assessment/www/admin/asm-action-param-admin.tcl 12 Jun 2006 02:49:51 -0000 1.7 @@ -6,9 +6,6 @@ } { action_id parameter_id:optional -} -properties { - page_title:onevalue - context:onevalue } if { ![ad_form_new_p -key parameter_id] } { Index: openacs-4/packages/assessment/www/admin/asm-action-param-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-param-delete.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/admin/asm-action-param-delete.adp 6 May 2005 17:05:16 -0000 1.4 +++ openacs-4/packages/assessment/www/admin/asm-action-param-delete.adp 12 Jun 2006 02:49:51 -0000 1.5 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context;noquote@ +Param Delete +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/admin/asm-action-param-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-param-delete.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/admin/asm-action-param-delete.tcl 6 May 2005 17:17:11 -0000 1.5 +++ openacs-4/packages/assessment/www/admin/asm-action-param-delete.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -6,13 +6,10 @@ } { parameter_id:integer action_id:integer -} -properties { - page_title:onevalue - context:onevalue } set page_title [_ assessment.delete_parameter] -set context [list [list [export_vars -base asm-action-new {action_id} ] [_ assessment.action_admin] ] $page_title] +set context_bar [ad_context_bar [list [export_vars -base asm-action-new {action_id} ] [_ assessment.action_admin] ] $page_title] db_1row select_param_info {select type,varname,description,query from as_action_params where parameter_id = :parameter_id} Index: openacs-4/packages/assessment/www/admin/set-reg-assessment.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/set-reg-assessment.adp,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/set-reg-assessment.adp 9 Jun 2005 20:44:08 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/set-reg-assessment.adp 12 Jun 2006 02:49:51 -0000 1.2 @@ -5,7 +5,7 @@ #acs-subsite.no_assessment# -#acs-subsite.create_asm# +#acs-subsite.create_asm#

Index: openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl 9 Jun 2005 20:44:08 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -13,7 +13,7 @@ set asm_instance [ad_conn package_id] if {![exists_and_not_null assessment_id]} { - set value [parameter::get -parameter AsmForRegisterId -package_id $subsite_id] + set value [parameter::get -parameter RegistrationId -package_id $subsite_id] set assessment_id $value } @@ -46,7 +46,8 @@ ad_returnredirect "${url}asm-admin/one-a?assessment_id=$assessment_id®_p=1&asm_instance=$asm_instance" } } else { - parameter::set_value -package_id [subsite::main_site_id] -parameter AsmForRegisterId -value $assessment_id + parameter::set_value -package_id [subsite::main_site_id] -parameter RegistrationId -value $assessment_id + parameter::set_value -package_id [subsite::main_site_id] -parameter RegistrationImplName -value "asm_url" ad_returnredirect "" } } Index: openacs-4/packages/assessment/www/asm-admin/action-params.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/action-params.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/action-params.tcl 9 Jun 2005 19:19:47 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/action-params.tcl 12 Jun 2006 02:49:51 -0000 1.7 @@ -69,16 +69,15 @@ db_foreach get_params {} { set choices [list] if { $type == "n" } { - if { $action_perform == "aa" || $action_perform == "m"} { + if { $action_perform == "aa" || $action_perform == "m" || $action_perform == "or" || $action_perform == "sa"} { set choices [db_list_of_lists choices {}] } else { set choices [db_list_of_lists prev_choices {}] } } else { set choices [db_list_of_lists choices_param $query] - } - - set parameter [list [list param_$parameter_id:text(select),optional [list label $varname] [list options $choices] [list help_text $description]]] + } + set parameter [list [list param_$parameter_id:text(select),optional [list label $varname] [list html [list style "width:200px"]] [list options $choices] [list help_text $description]]] ad_form -extend -name get_params -form $parameter } Index: openacs-4/packages/assessment/www/asm-admin/action-params.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/action-params.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/action-params.xql 18 Feb 2005 16:18:49 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/action-params.xql 12 Jun 2006 02:49:51 -0000 1.5 @@ -30,23 +30,15 @@ - select cri.title, sm.as_item_id + select cri.title, cri.item_id as as_item_id from as_item_section_map sm, cr_revisions cri - where sm.as_item_id = cri.revision_id and sm.section_id in ( - select s.section_id - from as_sections s, cr_revisions cr, cr_items ci, - as_assessment_section_map asm,as_item_section_map sm - where ci.item_id = cr.item_id - and cr.revision_id = s.section_id - and s.section_id = asm.section_id - and asm.assessment_id = :new_assessment_revision) - + where sm.as_item_id = cri.revision_id and sm.section_id = :section_id - select cri.title, sm.as_item_id + select cri.title, cri.item_id as as_item_id from as_item_section_map sm, cr_revisions cri where sm.as_item_id = cri.revision_id and sm.section_id in ( select s.section_id Index: openacs-4/packages/assessment/www/asm-admin/action-select.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/action-select.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/action-select.tcl 10 Jun 2005 16:11:46 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/action-select.tcl 12 Jun 2006 02:49:51 -0000 1.7 @@ -12,6 +12,7 @@ edit_check:optional by_item_p:optional item_id:optional + {section_check_p 0} } -properties { context:onevalue title:onevalue @@ -34,7 +35,11 @@ set context [list [list index [_ assessment.admin]] [list "one-a?assessment_id=$assessment_id" $title] [_ assessment.action_select]] set title "[_ assessment.action_select]" -set options [list [list "[_ assessment.immediately]" "i"] [list "[_ assessment.at_the_end]" "aa"] [list "[_ assessment.manually]" "m"]] +if {$section_check_p} { + set options [list [list "On Request" "or"] [list "[_ assessment.at_the_end]" "sa"]] +} else { + set options [list [list "[_ assessment.immediately]" "i"] [list "[_ assessment.at_the_end]" "aa"] [list "[_ assessment.manually]" "m"]] +} set actions_list [db_list_of_lists get_actions {} ] set return_url "" Index: openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl 7 Apr 2005 23:01:29 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl 12 Jun 2006 02:49:51 -0000 1.7 @@ -39,8 +39,10 @@ set condition_sql [db_string get_item_id {}] #parse condition_sql to get item_id set cond_list [split $condition_sql "="] - set item_id [lindex [split [lindex $cond_list 2] " "] 0] - + set item_id [lindex [split [lindex $cond_list 2] ")"] 0] + set item_id [content::item::get_latest_revision -item_id $item_id] + + } else { set item_id $as_item_id } @@ -49,6 +51,7 @@ set section_id_from $section_id } + set as_item_id $item_id set as_item_type_id [db_string item_type_id {}] @@ -127,11 +130,11 @@ } -edit_request { db_1row get_check_properties {} - set condition_sql [db_string get_item_id {}] + set condition_sql $check_sql #parse condition_sql to get choice_id set cond_list [split $condition_sql "="] - #set condition [string range [lindex $cond_list 1] 0 3] - set condition [lindex [split [lindex $cond_list 1] " "] 0] + set condition [lindex [split [lindex $cond_list 1] ")"] 0] + #ad_return_complaint 1 "${condition} $choices" } -edit_data { set check_sql [as::assessment::check::get_sql -condition $condition -item_id $item_id] Index: openacs-4/packages/assessment/www/asm-admin/add-edit-check.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-check.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/add-edit-check.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/add-edit-check.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -33,7 +33,7 @@ - select r.title,c.choice_id + select r.title, r.item_id from as_item_choices c, cr_revisions r where r.revision_id = c.choice_id and c.mc_id = :as_item_type_id Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-oracle.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,38 @@ + + + + + + + + + + + oracle8.1.6 + + + + + declare begin + :1 := as_inter_item_check.new ( + inter_item_check_id => :inter_item_check_id, + name => :name, + action_p => :action_p, + section_id_from => :section_id_from, + section_id_to => null, + check_sql => :check_sql, + description => :description, + postcheck_p => :postcheck_p, + item_id => null, + assessment_id => :assessment_id, + creation_user => :user_id, + context_id => null, + object_type => 'as_inter_item_check', + creation_date => :date + ); + end; + + + + + Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-postgresql.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,27 @@ + + + + + + + + + + + + select as_inter_item_check__new (:inter_item_check_id, + :action_p, + :section_id_from, + null, + :check_sql, + :name, + :description, + :postcheck_p, + null, + :user_id, + null, + :assessment_id) + + + + Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.adp 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,5 @@ + + @title@ Triggers + @context;noquote@ + + Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,94 @@ +# oacs-5-2/packages/assessment/www/asm-admin/add-edit-section-check.tcl + +ad_page_contract { + + adds or edits checks bound to sections + + @author Deds Castillo (deds@i-manila.com.ph) + @creation-date 2005-07-26 + @arch-tag: 29e2145c-7bcc-4a3d-b2e7-b43a2e305f7c + @cvs-id $Id: add-edit-section-check.tcl,v 1.2 2006/06/12 02:49:51 daveb Exp $ +} { + assessment_id:integer + section_id:integer,optional + inter_item_check_id:optional + edit_check:optional + by_item_p:optional +} -properties { +} -validate { +} -errors { +} + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create + +permission::require_permission -object_id $assessment_id -privilege admin +set item_id "" +set return_url "" +as::assessment::data -assessment_id $assessment_id +set assessment_rev_id $assessment_data(assessment_rev_id) +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +set title $assessment_data(title) +set context [list [list index [_ assessment.admin]] [list "one-a?assessment_id=$assessment_id" $title] "$title Triggers"] + +set section_id_from $section_id + +set as_item_id $item_id + +if {[exists_and_not_null edit_check]} { + set return_url "&check_id=$inter_item_check_id&edit_check=t" +} +if {[exists_and_not_null by_item_p]} { + if {$by_item_p==1} { + append return_url "&item_id=$item_id&by_item_p=$by_item_p" + } else { + append return_url "&by_item_p=$by_item_p" + } +} + +ad_form \ + -name new_check \ + -export { assessment_id section_id return_url } \ + -form { + inter_item_check_id:key + {section_id_from:integer(hidden) + {value $section_id_from} + } + {name:text(text) + {label "[_ assessment.Name]"} + {help_text "[_ assessment.name_of_trigger]"} + } + {postcheck_p:boolean(radio) + {label "[_ assessment.post_check]"} + {options { {"[_ assessment.yes]" t} {"[_ assessment.no]" f}}} + {help_text "[_ assessment.help_postcheck_p]"} + } + {description:text(textarea) + {label "[_ assessment.action_description]"} + {html {cols 40} {rows 20}} + {help_text "[_ assessment.description_trigger]"} + } + {action_p:text(hidden) + {value "t"} + } + } \ + -new_data { + set user_id [ad_conn user_id] + set check_sql "select 1 as perform_p from dual" + db_transaction { + set date [db_string get_date {select sysdate from dual}] + db_exec_plsql new_check {} + } + } -edit_request { + db_1row get_check_properties {} + } -edit_data { + set check_sql "select 1 as perform_p from dual" + db_dml update_check {} + } -after_submit { + set url [as::assessment::check::add_check_return_url $action_p] + ad_returnredirect "${url}?assessment_id=$assessment_id&inter_item_check_id=$inter_item_check_id§ion_id=$section_id_from§ion_check_p=1$return_url" +} Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + select * + from as_inter_item_checks + where inter_item_check_id = :inter_item_check_id + + + + + + update as_inter_item_checks + set name = :name, + section_id_from = :section_id_from, + action_p = :action_p, + postcheck_p = :postcheck_p, + check_sql = :check_sql + where inter_item_check_id = :inter_item_check_id + + + + Index: openacs-4/packages/assessment/www/asm-admin/admin-request.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/admin-request.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/admin-request.tcl 4 Feb 2005 21:14:22 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/admin-request.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -39,17 +39,25 @@ set assessment_query "" set state_query "" +if {![acs_user::site_wide_admin_p -user_id [ad_conn user_id]]} { + set permission "and c.assessment_id in (select object_id from acs_permissions where grantee_id=:party_id and privilege='admin')" +} if {[exists_and_not_null assessment] && $assessment!="all"} { permission::require_permission -object_id $assessment -privilege admin - if {[permission::permission_p -object_id $package_id -party_id $party_id -privilege admin] == 0} { - set permission "and c.assessment_id in (select object_id from acs_permissions where grantee_id=:party_id and privilege='admin')"} as::assessment::data -assessment_id $assessment set d_assessment $assessment set new_assessment_revision $assessment_data(assessment_rev_id) set assessment_query "and c.section_id_from in (select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm where ci.item_id = cr.item_id and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id = :new_assessment_revision)" -} +} else { + + set assessment_query "and assessment_id in (select ci.item_id as assessment_i + from cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a + where cr.revision_id = ci.latest_revision + and a.assessment_id = cr.revision_id + and ci.parent_id = cf.folder_id and cf.package_id = :package_id)" +} if {[exists_and_not_null state]} { set d_state $state @@ -181,3 +189,4 @@ } + Index: openacs-4/packages/assessment/www/asm-admin/assessment-copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-copy.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/assessment-copy.tcl 2 May 2005 10:11:22 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/assessment-copy.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -36,6 +36,7 @@ {assessment_id:key} {assessment_title:text(inform) {label "[_ assessment.copy_1]"}} {name:text,optional {label "[_ assessment.Name]"} {help_text "[_ assessment.Name_help]"}} + {new_title:text,optional {label "[_ assessment.Title]"} {help_text "[_ assessment.as_Title_help]"}} {node_id:text(select) {label "[_ assessment.Target_Community]"} {options $node_options} {help_text "[_ assessment.Target_Community_help]"}} {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} } -edit_request { @@ -45,7 +46,7 @@ } -on_submit { if {$confirmation} { set folder_id [as::assessment::folder_id -package_id [site_node::get_object_id -node_id $node_id]] - set assessment_id [as::assessment::copy -assessment_id $assessment_id -name $name -folder_id $folder_id] + set assessment_id [as::assessment::copy -assessment_id $assessment_id -name $name -folder_id $folder_id -new_title $new_title] } permission::grant -party_id $user_id -object_id $assessment_id -privilege admin } -after_submit { Index: openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl 8 Apr 2005 00:45:36 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl 12 Jun 2006 02:49:51 -0000 1.4 @@ -31,7 +31,7 @@ ad_form -name assessment_delete_confirm -action assessment-delete -form { {assessment_id:key} {assessment_title:text(inform) {label "[_ assessment.remove_1]"}} - {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} + {confirmation:text(radio) {label " "} {options $confirm_options} {value t}} } -select_query_name {assessment_title} \ -on_submit { if {$confirmation} { Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 8 Apr 2005 00:45:56 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,7 +1,6 @@ @page_title;noquote@ @context;noquote@ -
Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 29 Apr 2005 21:16:31 -0000 1.9 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 12 Jun 2006 02:49:51 -0000 1.10 @@ -7,26 +7,34 @@ assessment_id:integer,optional {__new_p 0} {permission_p 0} + {edit_p:optional "0"} + {type ""} + {after "0"} } -properties { context:onevalue page_title:onevalue } - + if {![info exists assessment_id] || $__new_p} { set page_title [_ assessment.New_Assessment2] set s_assessment_id 0 + } else { set page_title [_ assessment.Edit_Assessment] permission::require_permission -object_id $assessment_id -privilege admin set s_assessment_id 0 db_0or1row rev_id_from_item_id {} + if {[empty_string_p $type]} { + # Get the assessment data + as::assessment::data -assessment_id $assessment_id + set type $assessment_data(type) + } } set package_id [ad_conn package_id] permission::require_permission -object_id $package_id -privilege create set context [list [list index [_ assessment.admin]] $page_title] set package_id [ad_conn package_id] -set sql_format "YYYY-MM-DD HH24:MI:SS" set form_format "[lc_get formbuilder_date_format] [lc_get formbuilder_time_format]" set user_id [ad_conn user_id] @@ -39,59 +47,174 @@ ## {exit_page:text,optional,nospell {label "[_ assessment.Exit_Page]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Exit_Page_help]"}} -ad_form -name assessment_form -export permission_p -action assessment-form -form { +ad_form -name assessment_form -export {permission_p after} -action assessment-form -form { {assessment_id:key} } -if {[info exists assessment_id]} { +if {[info exists assessment_id] && $edit_p } {# ad_form -extend -name assessment_form -form { {name:text(inform) {label "#assessment.Name#"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.assessment_Name_help]"}} } } else { - ad_form -extend -name assessment_form -form { - {name:text,optional,nospell {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.assessment_Name_help]"}} + if {$type > 1 } { + ad_form -extend -name assessment_form -form { + {name:text,optional,nospell {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.assessment_Name_help]"}} + } + } else { + ad_form -extend -name assessment_form -form { + {name:text(hidden) {value ""}} + } } } ad_form -extend -name assessment_form -form { {title:text,nospell {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.as_Title_help]"}} - {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Description_help]"}} } +ad_form -extend -name assessment_form -form { {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Description_help]"}} +} + if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id $s_assessment_id -form_name assessment_form } -ad_form -extend -name assessment_form -form { - {instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Instructions_help]"}} - {run_mode:text,optional,nospell {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}} {help_text "[_ assessment.as_Mode_help]"}} +ad_form -extend -name assessment_form -form {{instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Instructions_help]"}}} + +if { $type == 2 } { + ad_form -extend -name assessment_form -form { + {run_mode:text,optional,nospell {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}} {help_text "[_ assessment.as_Mode_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { {run_mode:text(hidden) {value {}}} } } -if { !$permission_p } { + +if { (!$permission_p) } { ad_form -extend -name assessment_form -form { {anonymous_p:text(select) {label "[_ assessment.Anonymous_Responses]"} {options $boolean_options} {help_text "[_ assessment.as_Anonymous_help]"} {value f}} } } else { ad_form -extend -name assessment_form -form { {anonymous_p:text(hidden) {value t}} } - } -ad_form -extend -name assessment_form -form {{secure_access_p:text(select) {label "[_ assessment.Secure_Access_1]"} {options $boolean_options} {help_text "[_ assessment.as_Secure_Access_help]"}} - {reuse_responses_p:text(select) {label "[_ assessment.Reuse_Responses_1]"} {options $boolean_options} {help_text "[_ assessment.as_Reuse_Responses_help]"}} - {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}} - {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}} - {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}} - {return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Return_Url_help]"}} - {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_Start_Time_help]"}} - {end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.End_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_End_Time_help]"}} - {number_tries:integer,optional,nospell {label "[_ assessment.Number_of_Tries]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Number_Tries_help]"}} - {wait_between_tries:integer,optional,nospell {label "[_ assessment.Minutes_for_Retry]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Minutes_Retry_help]"}} - {time_for_response:integer,optional,nospell {label "[_ assessment.time_for_response]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_help]"}} - {ip_mask:text,optional,nospell {label "[_ assessment.ip_mask]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_ip_mask_help]"}} - {password:text,optional,nospell {label "[_ assessment.password]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_password_help]"}} - {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options} {help_text "[_ assessment.as_Feedback_help]"}} - {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options} {help_text "[_ assessment.as_Navigation_help]"}} -} -new_request { + +if { $type == 2 && [empty_string_p $edit_p]} { + ad_form -extend -name assessment_form -form { + {secure_access_p:text(select) {label "[_ assessment.Secure_Access_1]"} {options $boolean_options} {help_text "[_ assessment.as_Secure_Access_help]"}} + {reuse_responses_p:text(select) {label "[_ assessment.Reuse_Responses_1]"} {options $boolean_options} {help_text "[_ assessment.as_Reuse_Responses_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { + {secure_access_p:text(hidden) {value "f"}} + {reuse_responses_p:text(hidden) {value "f"}} + } +} + + +if { ($type == 2 || $type == 5) } { + ad_form -extend -name assessment_form -form { + {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { {show_item_name_p:text(hidden) {value "f"}} } +} + +if { ($type == 2 || $type == 5) } { + ad_form -extend -name assessment_form -form { + {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { {random_p:text(hidden) {value "t"}} } +} + +if { ($type == 2 || $type == 3 || $type == 4) } { + ad_form -extend -name assessment_form -form { + {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { {consent_page:text(hidden) {value ""}} } +} + +if { $type != 5 } { + ad_form -extend -name assessment_form -form { + {return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50}} {help_text "[_ assessment.as_Return_Url_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { {return_url:text(hidden) {value {}}} } +} + + +if { $type == 2 } { + ad_form -extend -name assessment_form -form { + {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_Start_Time_help]"}} + {end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.End_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_End_Time_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { + {start_time:date(hidden) {value ""}} + {end_time:date(hidden) {value ""}} + } +} + +if { $type == 2 } { + ad_form -extend -name assessment_form -form { + {number_tries:integer,optional,nospell {label "[_ assessment.Number_of_Tries]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Number_Tries_help]"}} + {wait_between_tries:integer,optional,nospell {label "[_ assessment.Minutes_for_Retry]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Minutes_Retry_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { + {number_tries:text(hidden) {value ""}} + {wait_between_tries:text(hidden) {value ""}} + } +} + +if { $type == 2 } { + ad_form -extend -name assessment_form -form { + {time_for_response:integer,optional,nospell {label "[_ assessment.time_for_response]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { + {time_for_response:text(hidden) {value ""}} + } +} + +if { $type == 2 } { + ad_form -extend -name assessment_form -form { + {ip_mask:text,optional,nospell {label "[_ assessment.ip_mask]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_ip_mask_help]"}} + {password:text,optional,nospell {label "[_ assessment.password]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_password_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { + {ip_mask:text(hidden) {value ""}} + {password:text(hidden) {value ""}} + } +} + +if { $type == 2 } { + ad_form -extend -name assessment_form -form { + {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options} {help_text "[_ assessment.as_Feedback_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { + {show_feedback:text(hidden) {value ""}} + } +} + +if { $type == 2 } { + ad_form -extend -name assessment_form -form { + {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options} {help_text "[_ assessment.as_Navigation_help]"}} + } +} else { + ad_form -extend -name assessment_form -form { + {section_navigation:text(hidden) {value ""}} + } +} + +ad_form -extend -name assessment_form -form { + {type:text(hidden) {value $type}} +} + +ad_form -extend -name assessment_form -new_request { set name "" set title "" set description "" @@ -116,15 +239,15 @@ set section_navigation "default path" } -edit_request { db_1row assessment_data {} - + if {![empty_string_p $start_time]} { set start_time [util::date::acquire ansi $start_time] } if {![empty_string_p $end_time]} { set end_time [util::date::acquire ansi $end_time] } } -validate { - {name {[as::assessment::unique_name -name $name -new_p $__new_p]} "[_ assessment.name_used]"} + {name {[as::assessment::unique_name -name $name -new_p $__new_p]} "[_ assessment.name_used] $assessment_id"} } -on_submit { if {$start_time == "NULL"} { set start_time "" @@ -164,7 +287,8 @@ -ip_mask $ip_mask \ -password $password \ -show_feedback $show_feedback \ - -section_navigation $section_navigation] + -section_navigation $section_navigation \ + -type $type] set assessment_id [db_string assessment_id_from_revision {}] @@ -182,6 +306,22 @@ if {![empty_string_p $end_time]} { db_dml update_end_time {} } + if { $type == 1} { + db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + + set new_section_id [as::section::new -title [_ assessment.survey_section] ] + + db_dml move_down_sections {} + set sort_order [expr $after + 1] + db_dml add_section_to_assessment {} + + if {[exists_and_not_null category_ids]} { + category::map_object -object_id $new_section_id $category_ids + } + } + } + } } -edit_data { db_transaction { @@ -208,7 +348,8 @@ -ip_mask $ip_mask \ -password $password \ -show_feedback $show_feedback \ - -section_navigation $section_navigation] + -section_navigation $section_navigation \ + -type $type] if {[exists_and_not_null category_ids]} { category::map_object -object_id $assessment_rev_id $category_ids Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.xql 13 Apr 2005 18:51:19 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.xql 12 Jun 2006 02:49:51 -0000 1.5 @@ -8,7 +8,7 @@ a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.show_item_name_p, random_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, a.number_tries, a.wait_between_tries, a.time_for_response, a.show_feedback, a.section_navigation, - to_char(a.start_time, :sql_format) as start_time, to_char(a.end_time, :sql_format) as end_time + to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time from as_assessments a, cr_revisions cr, cr_items ci where ci.item_id = :assessment_id and cr.revision_id = ci.latest_revision @@ -57,4 +57,25 @@
+ + + + update as_assessment_section_map + set sort_order = sort_order+1 + where assessment_id = :new_assessment_rev_id + and sort_order > :after + + + + + + + + insert into as_assessment_section_map (assessment_id, section_id,sort_order) + values (:new_assessment_rev_id, :new_section_id,:sort_order) + + + + + Index: openacs-4/packages/assessment/www/asm-admin/assessment-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-new.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/assessment-new.adp 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,4 @@ + +@page_title;noquote@ +@context;noquote@ + \ No newline at end of file Index: openacs-4/packages/assessment/www/asm-admin/assessment-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-new.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/assessment-new.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,47 @@ +ad_page_contract { + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) +} { + assessment_id:integer,optional + {type ""} + {permission_p ""} + {page_title ""} +} -properties { + context:onevalue + page_title:onevalue +} + +if {[info exists assessment_id]} { + + # Get the assessment data + as::assessment::data -assessment_id $assessment_id + set type $assessment_data(type) + set page_title [_ assessment.Edit_Assessment] + set type $assessment_data(type) + append page_title ": $assessment_data(title)" + +} else { + set page_title [_ assessment.New_Assessment2] +} +set context [list [list index [_ assessment.admin]] $page_title] + +set types_list [list [list "[_ assessment.type_s]" 1] [list "[_ assessment.type_ea]" 2 ]] + +ad_form -name assessment_type -export {assessment_id permission_p} -form { + {type:text(radio) + {label "[_ assessment.choose_type]"} + {options $types_list} + {value $type} + } +} -on_submit { + if { [exists_and_not_null assessment_id]} { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + db_dml update_asm { update as_assessments set type=:type where assessment_id=:new_assessment_rev_id} + ad_returnredirect [export_vars -base one-a {assessment_id}] + } else { + if { ![empty_string_p $permission_p]} { + ad_returnredirect [export_vars -base assessment-form {type assessment_id permission_p}] + } else { + ad_returnredirect [export_vars -base assessment-form {type assessment_id}] + } + } +} \ No newline at end of file Index: openacs-4/packages/assessment/www/asm-admin/catalog-browse.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/catalog-browse.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/catalog-browse.xql 21 Apr 2005 09:16:56 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/catalog-browse.xql 12 Jun 2006 02:49:51 -0000 1.3 @@ -105,7 +105,7 @@ where m.section_id = :section_id) and exists (select 1 from as_item_rels ir where item_rev_id = cr.revision_id and ir.rel_type = 'as_item_display_rel') - and ao.object_id = ci.item_id + and ao.object_id = cr.revision_id and p.person_id = ao.creation_user and ir.item_rev_id = cr.revision_id and ir.target_rev_id = o.object_id @@ -131,7 +131,7 @@ and i.as_item_id not in (select m.as_item_id from as_item_section_map m where m.section_id = :section_id) - and ao.object_id = ci.item_id + and ao.object_id = cr.revision_id and p.person_id = ao.creation_user and ir.item_rev_id = cr.revision_id and ir.target_rev_id = o.object_id Index: openacs-4/packages/assessment/www/asm-admin/checks-admin.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-admin.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/checks-admin.adp 7 Apr 2005 21:45:23 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/checks-admin.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -2,6 +2,14 @@ @title@ #assessment.Administration# @context;noquote@
+On Request (section check) +
+ +
+#assessment.after_this_asm# (section check) +
+ +
#assessment.after_this_asm#
Index: openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl 11 Apr 2005 19:08:59 -0000 1.8 +++ openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl 12 Jun 2006 02:49:51 -0000 1.9 @@ -26,15 +26,16 @@ set show_p 0 set by_item_p 1 set item_p "&item_id=$item_id" - set item_id_check $item_id + set item_id_check $item_id + set as_item_id_i [db_string get_item_id { select item_id from cr_revisions where revision_id = :item_id}] set check_list "and c.inter_item_check_id in (" set checks [db_list_of_lists get_all_checks { }] set count 0 foreach check $checks { set cond_list [split [lindex $check 1] "="] - set as_item_id [lindex [split [lindex $cond_list 2] " "] 0] - if { $item_id == $as_item_id} { + set as_item_id [lindex [split [lindex $cond_list 2] ")"] 0] + if { $as_item_id_i == $as_item_id} { incr count append check_list "[lindex $check 0]," } @@ -47,6 +48,8 @@ append check_list ")" } +db_multirow or_checks get_or_checks {} +db_multirow sa_checks get_sa_checks {} db_multirow aa_checks get_aa_checks {} db_multirow i_checks get_i_checks {} db_multirow branches get_branches {} @@ -64,6 +67,94 @@ template::list::create \ + -name or_checks \ + -multirow or_checks \ + -key inter_item_check_id \ + -bulk_actions { + "\#assessment.Delete\#" "confirm-delete" "\#assessment.delete_checked\#" + }\ + -bulk_action_method post \ + -bulk_action_export_vars { + assessment_id + section_id + {type_check t} + item_id_check + by_item_p + }\ + -row_pretty_plural "[_ assessment.Assessment] [_ assessment.triggers]" \ + -elements { + name { + label "[_ assessment.Name]" + display_template { + @or_checks.name@ + } + } + action_name { + label "[_ assessment.action_to_perform]" + } + counter { + display_template { + + + #assessment.Move_Down# + + + #assessment.Move_Up# + + + #assessment.notify_user# + + } + + } + } + + +template::list::create \ + -name sa_checks \ + -multirow sa_checks \ + -key inter_item_check_id \ + -bulk_actions { + "\#assessment.Delete\#" "confirm-delete" "\#assessment.delete_checked\#" + }\ + -bulk_action_method post \ + -bulk_action_export_vars { + assessment_id + section_id + {type_check t} + item_id_check + by_item_p + }\ + -row_pretty_plural "[_ assessment.Assessment] [_ assessment.triggers]" \ + -elements { + name { + label "[_ assessment.Name]" + display_template { + @sa_checks.name@ + } + } + action_name { + label "[_ assessment.action_to_perform]" + } + counter { + display_template { + + + #assessment.Move_Down# + + + #assessment.Move_Up# + + + #assessment.notify_user# + + } + + } + } + + +template::list::create \ -name aa_checks \ -multirow aa_checks \ -key inter_item_check_id \ @@ -83,7 +174,7 @@ name { label "[_ assessment.Name]" display_template { - @aa_checks.name@ + @aa_checks.name@ } } action_name { @@ -129,7 +220,7 @@ name { label "[_ assessment.Name]" display_template { - @i_checks.name@ + @i_checks.name@ } } action_name { @@ -174,7 +265,7 @@ name { label "[_ assessment.Name]" display_template { - @m_checks.name@ + @m_checks.name@ } } action_name { @@ -209,7 +300,7 @@ name { label "[_ assessment.Name]" display_template { - @branches.name@ + @branches.name@ } } section_id_to { Index: openacs-4/packages/assessment/www/asm-admin/checks-admin.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-admin.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/checks-admin.xql 2 Feb 2005 16:54:12 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/checks-admin.xql 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,18 @@ + + + select c.check_sql,am.action_perform,c.inter_item_check_id,c.name,a.name as action_name, am.order_by,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'or' and c.action_p = 't'and c.assessment_id=:assessment_id $check_list order by order_by + + + + + + select c.check_sql,am.action_perform,c.inter_item_check_id,c.name,a.name as action_name, am.order_by,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'sa' and c.action_p = 't'and c.assessment_id=:assessment_id $check_list order by order_by + + + select c.check_sql,am.action_perform,c.inter_item_check_id,c.name,a.name as action_name, am.order_by,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'aa' and c.action_p = 't'and c.assessment_id=:assessment_id $check_list order by order_by Index: openacs-4/packages/assessment/www/asm-admin/checks-delete-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-delete-oracle.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/checks-delete-oracle.xql 27 Feb 2005 17:07:18 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/checks-delete-oracle.xql 12 Jun 2006 02:49:51 -0000 1.4 @@ -6,7 +6,7 @@ begin - as_inter_item_check.delete($check_id); + as_inter_item_check.del($check_id); end; Index: openacs-4/packages/assessment/www/asm-admin/confirm-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/confirm-delete.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/confirm-delete.tcl 6 May 2005 16:46:54 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/confirm-delete.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -8,9 +8,6 @@ assessment_id by_item_p:integer item_id_check:optional -} -properties { - title:onevalue - context:onevalue } set inter_item_check_id [split $inter_item_check_id " "] @@ -20,7 +17,7 @@ as::assessment::data -assessment_id $assessment_id set title "$assessment_data(title)" -set context [list [list index [_ assessment.admin]] [list "one-a?assessment_id=$assessment_id" $title] [list "checks-admin?assessment_id=$assessment_id§ion_id=$section_id" "$title [_ assessment.Administration]"] "[_ assessment.trigger_delete]"] +set context [list [list "one-a?assessment_id=$assessment_id" $title] [list "checks-admin?assessment_id=$assessment_id§ion_id=$section_id" "$title [_ assessment.Administration]"] "[_ assessment.trigger_delete]"] set title "[_ assessment.trigger_delete]" Index: openacs-4/packages/assessment/www/asm-admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.adp,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/index.adp 18 Aug 2005 17:33:42 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/index.adp 12 Jun 2006 02:49:51 -0000 1.7 @@ -1,11 +1,10 @@ -@title;noquote@ @context;noquote@ #assessment.admin_categories# -| #assessment.admin_actions# | #assessment.admin_requests# | #assessment.permissions# +| #assessment.admin_actions# | #assessment.admin_requests# | #assessment.permissions# #assessment.admin_requests# Index: openacs-4/packages/assessment/www/asm-admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/assessment/www/asm-admin/index.tcl 17 Feb 2006 12:13:55 -0000 1.9 +++ openacs-4/packages/assessment/www/asm-admin/index.tcl 12 Jun 2006 02:49:51 -0000 1.10 @@ -20,27 +20,36 @@ set folder_id [as::assessment::folder_id -package_id $package_id] set categories_url [db_string get_category_url {}] set user_id [ad_conn user_id] +set sw_admin [acs_user::site_wide_admin_p -user_id $user_id] set package_admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege "admin"] -if { $package_admin_p == 0} { - set m_name "get_all_assessments_admin" -} else { - set m_name "get_all_assessments" -} - #form to upload a QTI ZIP file ad_form -name form_upload_file -action {unzip-file} -html {enctype multipart/form-data} -form { {zipfile:file {label "[_ assessment.Import_QTI_ZIP_File]"}} } -set actions [list "[_ assessment.New_Assessment]" assessment-form "[_ assessment.New_Assessment2]"] +set actions [list] +set advanced_options_p [parameter::get -parameter ShowAdvancedOptions -default 1] +if { $advanced_options_p } { + lappend actions "[_ assessment.New_Survey]" {assessment-form?type=1} "[_ assessment.New_Survey]" \ + "[_ assessment.New_Review_Assessment]" {assessment-form?type=3} "[_ assessment.New_Review_Assessment]" \ + "[_ assessment.New_Partial_Assessment]" {assessment-form?type=4} "[_ assessment.New_Partial_Assessment]" \ + "[_ assessment.New_Quick_Assessment]" {assessment-form?type=5} "[_ assessment.New_Quick_Assessment]" +} +lappend actions "[_ assessment.New_Assessment]" {assessment-form?type=2} "[_ assessment.New_Assessment2]" + +if { $sw_admin && $advanced_options_p } { + lappend actions [_ assessment.set_reg_asm] "../admin/set-reg-assessment" [_ assessment.set_reg_asm] +} + if {[ad_permission_p [acs_magic_object "security_context_root"] "admin"]} { # lappend actions "[_ assessment.Admin_catalog]" "catalog/" "[_ assessment.Admin_catalog]" } #get all assessments order by title -db_multirow -extend { export permissions admin_request} assessments $m_name {} { +db_multirow -extend { export permissions admin_request} assessments get_all_assessments {} { + set title [as::assessment::title -title $title] set export "[_ assessment.Export]" set permissions "[_ assessment.permissions]" set admin_request "[_ assessment.Request] [_ assessment.Administration]" @@ -60,7 +69,7 @@ -elements { title { label "[_ assessment.Title]" - link_url_eval "[export_vars -base one-a { assessment_id }]" + display_template {@assessments.title;noquote@} } export { label "[_ assessment.Export]" Index: openacs-4/packages/assessment/www/asm-admin/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/index.xql 18 Aug 2005 17:33:42 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/index.xql 12 Jun 2006 02:49:51 -0000 1.4 @@ -3,31 +3,19 @@ - select ci.item_id as assessment_id, cr.title from cr_items ci, cr_revisions cr where cr.revision_id = ci.latest_revision and ci.content_type = 'as_assessments' and ci.parent_id = :folder_id + and exists (select 1 from acs_object_party_privilege_map ppm + where ppm.object_id = ci.item_id + and ppm.privilege = 'admin' + and ppm.party_id = :user_id) order by cr.title - - - - select ci.item_id as assessment_id, cr.title - from cr_items ci, cr_revisions cr - where cr.revision_id = ci.latest_revision - and ci.content_type = 'as_assessments' - and ci.parent_id = :folder_id - and ci.item_id in (select object_id from acs_permissions where - grantee_id=:user_id and privilege='admin') - order by cr.title - - - - Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl 7 Apr 2005 22:35:43 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -8,6 +8,7 @@ section_id:integer as_item_id:integer after:integer + {type ""} } -properties { context:onevalue page_title:onevalue @@ -27,8 +28,68 @@ set page_title [_ assessment.add_item_display_cb] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set type $assessment_data(type) +if {$type == 1} { + set html_options "" + set choice_orientation "vertical" + set label_orientation "top" + set order_type "order_of_entry" + set answer_alignment "besideright" + db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + db_dml update_section_in_assessment {} + set old_item_id $as_item_id + + if {![db_0or1row item_display {}] || $object_type != "as_item_display_cb"} { + set as_item_display_id [as::item_display_cb::new \ + -html_display_options $html_options \ + -choice_orientation $choice_orientation \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + + if {![info exists object_type]} { + # first item display mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel + } else { + # old item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + db_dml update_item_display {} + } + } else { + # old cb item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_display_id [as::item_display_cb::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_options \ + -choice_orientation $choice_orientation \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + + db_dml update_item_display {} + } + + set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] + if {$old_item_id == 0} { + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } else { + db_1row item_data {} + db_dml update_item {} + } + } + ad_returnredirect [export_vars -base one-a {assessment_id}]\#$as_item_id + ad_script_abort + +} + + set choice_or_types [list] foreach choice_or_type [list horizontal vertical] { lappend choice_or_types [list "[_ assessment.$choice_or_type]" $choice_or_type] @@ -114,7 +175,7 @@ } } -after_submit { # now go to assessment-page - ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id ad_script_abort } Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-f.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-f.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-f.adp 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-f.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-f.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-f.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,97 @@ +ad_page_contract { + Form to add an item with shortanswer display. + + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) + +} { + assessment_id:integer + section_id:integer + as_item_id:integer + after:integer +} -properties { + context:onevalue + page_title:onevalue +} + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +permission::require_permission -object_id $assessment_id -privilege admin + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +set page_title [_ assessment.add_item_display_f] +set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + +set orientation_types [list] +foreach orientation_type [list horizontal vertical] { + lappend orientation_types [list "[_ assessment.$orientation_type]" $orientation_type] +} + + +ad_form -name item_add_display_f -action item-add-display-f -export { assessment_id section_id after } -form { + {as_item_id:key} + {html_options:text,optional,nospell {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}} + {abs_size:text,nospell {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.Absolute_Size_help]"} } + {box_orientation:text(select) {label "[_ assessment.Box_Orientation]"} {options $orientation_types} {help_text "[_ assessment.Box_Orientation_help]"}} +} -edit_request { + set html_options "" + set abs_size "1000" + set box_orientation "vertical" +} -validate { + {html_options {[as::assessment::check_html_options -options $html_options]} "[_ assessment.error_html_options]"} +} -edit_data { + db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + db_dml update_section_in_assessment {} + set old_item_id $as_item_id + + if {![db_0or1row item_display {}] || $object_type != "as_item_display_f"} { + set as_item_display_id [as::item_display_f::new \ + -html_display_options $html_options \ + -abs_size $abs_size \ + -box_orientation $box_orientation] + + if {![info exists object_type]} { + # first item display mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel + } else { + # old item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + } + } else { + # old f item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_display_id [as::item_display_f::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_options \ + -abs_size $abs_size \ + -box_orientation $box_orientation] + } + + set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] + if {$old_item_id == 0} { + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } else { + db_dml update_item_display {} + db_1row item_data {} + db_dml update_item {} + } + } +} -after_submit { + # now go to assessment-page + ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-f.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-f.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-f.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,88 @@ + + + + + + + select r.target_rev_id as as_item_display_id, o.object_type + from as_item_rels r, acs_objects o + where r.item_rev_id = :as_item_id + and r.rel_type = 'as_item_display_rel' + and o.object_id = r.target_rev_id + + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set sort_order = sort_order+1 + where section_id = :new_section_id + and sort_order > :after + + + + + + + + insert into as_item_section_map + (as_item_id, section_id, required_p, sort_order, max_time_to_complete, + fixed_position, points) + (select :as_item_id as as_item_id, :new_section_id as section_id, + required_p, :after as sort_order, max_time_to_complete, + 0 as fixed_position, points + from as_items + where as_item_id = :as_item_id) + + + + + + + + update as_item_rels + set target_rev_id = :as_item_display_id + where item_rev_id = :as_item_id + and rel_type = 'as_item_display_rel' + + + + + + + + select required_p, max_time_to_complete, points + from as_items + where as_item_id = :as_item_id + + + + + + + + update as_item_section_map + set as_item_id = :as_item_id, + required_p = :required_p, + max_time_to_complete = :max_time_to_complete, + points = :points + where as_item_id = :old_item_id + and section_id = :new_section_id + + + + + Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl 7 Apr 2005 22:36:19 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -8,6 +8,7 @@ section_id:integer as_item_id:integer after:integer + {type ""} } -properties { context:onevalue page_title:onevalue @@ -20,15 +21,72 @@ # Get the assessment data as::assessment::data -assessment_id $assessment_id + if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort } set page_title [_ assessment.add_item_display_rb] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set type $assessment_data(type) +if { $type == 1} { + set html_options "" + set choice_orientation "vertical" + set label_orientation "top" + set order_type "order_of_entry" + set answer_alignment "besideright" + db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + db_dml update_section_in_assessment {} + set old_item_id $as_item_id + + if {![db_0or1row item_display {}] || $object_type != "as_item_display_rb"} { + set as_item_display_id [as::item_display_rb::new \ + -html_display_options $html_options \ + -choice_orientation $choice_orientation \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + + if {![info exists object_type]} { + # first item display mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel + } else { + # old item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + } + } else { + # old rb item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_display_id [as::item_display_rb::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_options \ + -choice_orientation $choice_orientation \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + } + + set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] + if {$old_item_id == 0} { + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } else { + db_dml update_item_display {} + db_1row item_data {} + db_dml update_item {} + } + } + ad_returnredirect [export_vars -base one-a {assessment_id}]\#$as_item_id + ad_script_abort +} + set choice_or_types [list] foreach choice_or_type [list horizontal vertical] { lappend choice_or_types [list "[_ assessment.$choice_or_type]" $choice_or_type] @@ -112,7 +170,7 @@ } } -after_submit { # now go to assessment-page - ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id ad_script_abort } Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-sa.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-sa.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-sa.tcl 7 Apr 2005 22:38:57 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-sa.tcl 12 Jun 2006 02:49:51 -0000 1.4 @@ -90,7 +90,7 @@ } } -after_submit { # now go to assessment-page - ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_returnredirect [export_vars -base one-a {assessment_id }]&\#$as_item_id ad_script_abort } Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl 7 Apr 2005 22:40:43 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -8,6 +8,7 @@ section_id:integer as_item_id:integer after:integer + {type ""} } -properties { context:onevalue page_title:onevalue @@ -28,8 +29,66 @@ set page_title [_ assessment.add_item_display_sb] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set type $assessment_data(type) set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +if { $type == 1} { + set html_options "" + set multiple_p f + set label_orientation "top" + set order_type "order_of_entry" + set answer_alignment "besideright" + + db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + db_dml update_section_in_assessment {} + set old_item_id $as_item_id + + if {![db_0or1row item_display {}] || $object_type != "as_item_display_sb"} { + set as_item_display_id [as::item_display_sb::new \ + -html_display_options $html_options \ + -multiple_p $multiple_p \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + + if {![info exists object_type]} { + # first item display mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel + } else { + # old item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + } + } else { + # old sb item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_display_id [as::item_display_sb::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_options \ + -multiple_p $multiple_p \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + } + + set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] + if {$old_item_id == 0} { + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } else { + db_dml update_item_display {} + db_1row item_data {} + db_dml update_item {} + } + } + ad_returnredirect [export_vars -base one-a {assessment_id}]\#$as_item_id + ad_script_abort + +} + set label_or_types [list] foreach label_or_type [list top left right bottom] { lappend label_or_types [list "[_ assessment.$label_or_type]" $label_or_type] @@ -51,13 +110,15 @@ {multiple_p:text(select) {label "[_ assessment.Multiple]"} {options $boolean_options} {help_text "[_ assessment.Multiple_help]"}} {label_orientation:text(hidden)} {order_type:text(select) {label "[_ assessment.Order_Type]"} {options $order_types} {help_text "[_ assessment.Order_Type_help]"}} + {prepend_empty_p:text(select) {label "[_ assessment.Prepend_Empty_Item]"} {options $boolean_options} {help_text "[_ assessment.lt_Prepend_an_empty_item]"}} {answer_alignment:text(hidden)} } -edit_request { set html_options "" set multiple_p f set label_orientation "top" set order_type "order_of_entry" set answer_alignment "besideright" + set prepend_empty_p f } -validate { {html_options {[as::assessment::check_html_options -options $html_options]} "[_ assessment.error_html_options]"} } -edit_data { @@ -74,7 +135,8 @@ -multiple_p $multiple_p \ -choice_label_orientation $label_orientation \ -sort_order_type $order_type \ - -item_answer_alignment $answer_alignment] + -item_answer_alignment $answer_alignment \ + -prepend_empty_p $prepend_empty_p] if {![info exists object_type]} { # first item display mapped @@ -92,7 +154,8 @@ -multiple_p $multiple_p \ -choice_label_orientation $label_orientation \ -sort_order_type $order_type \ - -item_answer_alignment $answer_alignment] + -item_answer_alignment $answer_alignment \ + -prepend_empty_p $prepend_empty_p] } set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] @@ -108,7 +171,7 @@ } } -after_submit { # now go to assessment-page - ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id ad_script_abort } Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-ta.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-ta.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-ta.tcl 7 Apr 2005 22:41:26 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-ta.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -92,7 +92,7 @@ } } -after_submit { # now go to assessment-page - ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id ad_script_abort } Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-tb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-tb.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-tb.tcl 7 Apr 2005 22:41:58 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-tb.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -42,7 +42,7 @@ {answer_alignment:text(hidden)} } -edit_request { set html_options "" - set abs_size 20 + set abs_size 200 set answer_alignment "besideright" } -validate { {html_options {[as::assessment::check_html_options -options $html_options]} "[_ assessment.error_html_options]"} @@ -90,7 +90,7 @@ } } -after_submit { # now go to assessment-page - ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id ad_script_abort } Index: openacs-4/packages/assessment/www/asm-admin/item-add-fu.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-fu.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-fu.adp 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/asm-admin/item-add-fu.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-fu.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-fu.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,76 @@ +ad_page_contract { + Form to add a short answer item. + + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) + @creation date 2005-06-23 +} { + assessment_id:integer + section_id:integer + as_item_id:integer + after:integer +} -properties { + context:onevalue + page_title:onevalue +} + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +permission::require_permission -object_id $assessment_id -privilege admin + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +set page_title [_ assessment.add_item_type_fu] +set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + +set display_types [list] +foreach display_type [db_list display_types {}] { + lappend display_types [list "[_ assessment.item_display_$display_type]" $display_type] +} + + +ad_form -name item_add_fu -action item-add-fu -export { assessment_id section_id after } -form { + {as_item_id:key} + {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.fu_Title_help]"}} + {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} +} -edit_request { + set title [db_string get_title {} -default ""] + set display_type "f" +} -edit_data { + db_transaction { + if {![db_0or1row item_type {}] || $object_type != "as_item_type_fu"} { + set as_item_type_id [as::item_type_fu::new -title $title ] + + if {![info exists object_type]} { + # first item type mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_type_id -type as_item_type_rel + } else { + # old item type existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + db_dml update_item_type {} + } + } else { + # old fu item type existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_type_id [as::item_type_fu::edit \ + -as_item_type_id $as_item_type_id \ + -title $title \ + -increasing_p $increasing_p \ + -allow_negative_p $allow_negative_p] + + db_dml update_item_type {} + } + } +} -after_submit { + # now go to display-type specific form (i.e. textbox) + ad_returnredirect [export_vars -base "item-add-display-$display_type" {assessment_id section_id as_item_id after}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/item-add-fu.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-fu.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-fu.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,47 @@ + + + + + + + select display_type + from as_item_types_map + where item_type = 'fu' + + + + + + + + select r.target_rev_id as as_item_type_id, o.object_type + from as_item_rels r, acs_objects o + where r.item_rev_id = :as_item_id + and r.rel_type = 'as_item_type_rel' + and o.object_id = r.target_rev_id + + + + + + + + update as_item_rels + set target_rev_id = :as_item_type_id + where item_rev_id = :as_item_id + and rel_type = 'as_item_type_rel' + + + + + + + + select r.title + from cr_revisions r + where r.revision_id = :as_item_id + + + + + Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl 7 Apr 2005 22:42:48 -0000 1.8 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl 12 Jun 2006 02:49:51 -0000 1.9 @@ -15,6 +15,7 @@ answer_val:array,optional percent:array,optional selected:array,optional + {type ""} } -properties { context:onevalue page_title:onevalue @@ -33,9 +34,12 @@ } set package_id [ad_conn package_id] +set type $assessment_data(type) set page_title [_ assessment.add_item_type_mc_choices] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + set selected_options [list [list "[_ assessment.yes]" t]] ad_form -name item_add_mc_choices -action item-add-mc-choices -export { assessment_id section_id after mc_id display_type } -html {enctype multipart/form-data} -form { @@ -45,11 +49,54 @@ # add form entries for each choice set ad_form_code "-form \{\n" set count_correct 0 + +if { $type == 1} { + set max_file_size 10000000 + # [ad_parameter MaxAttachmentSize] + set pretty_max_size [util_commify_number $max_file_size] + set folder_id [as::assessment::folder_id -package_id $package_id] + + db_transaction { + set count 0 + foreach choice_id [array names feedback] { + set feedback_text $feedback($choice_id) + set selected_p [ad_decode [info exists selected($choice_id)] 0 f t] + set percent_score $percent($choice_id) + set fixed_position $fixed_pos($choice_id) + set answer_value $answer_val($choice_id) + + eval set content "\$content_$choice_id" + if {![empty_string_p $content]} { + set filename [lindex $content 0] + set tmp_filename [lindex $content 1] + set file_mimetype [lindex $content 2] + set n_bytes [file size $tmp_filename] + + if { $n_bytes > $max_file_size && $max_file_size > 0 } { + ad_return_complaint 1 "[_ assessment.file_too_large]" + return + } + if { $n_bytes == 0 } { + ad_return_complaint 1 "[_ assessment.file_zero_size]" + return + } + set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]] + } else { + set content_rev_id "" + } + + db_dml update_choice_data {} + } + } + ad_returnredirect [export_vars -base "item-add-display-$display_type" {assessment_id section_id as_item_id after}] + ad_script_abort +} + db_foreach get_choices {} { if {$correct_answer_p == "t"} { - append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \"\"\}\}\n" + append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] \$title\"\} \{value \"\"\}\}\n" } else { - append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \"\"\}\}\n" + append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] \$title\"\} \{value \"\"\}\}\n" } append ad_form_code "\{selected.$choice_id:text(checkbox),optional \{label \"[_ assessment.Default_Selected]\"\} \{options \$selected_options\} \{help_text \"[_ assessment.Default_Selected_help]\"\}\}\n" append ad_form_code "\{fixed_pos.$choice_id:text,optional,nospell \{label \"[_ assessment.Fixed_Position]\"\} \{html \{size 5 maxlength 5\}\} \{help_text \"[_ assessment.choice_Fixed_Position_help]\"\}\}\n" @@ -109,7 +156,7 @@ ad_return_complaint 1 "[_ assessment.file_zero_size]" return } - set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [exec uuidgen]] + set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]] } else { set content_rev_id "" } Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.adp 6 May 2005 00:36:19 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.adp 12 Jun 2006 02:49:51 -0000 1.4 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.tcl 6 May 2005 00:36:13 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.tcl 12 Jun 2006 02:49:51 -0000 1.4 @@ -9,7 +9,7 @@ as_item_id:integer after:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -26,7 +26,7 @@ } set page_title [_ assessment.add_item_type_mc_existing] -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] set folder_id [as::assessment::folder_id -package_id $package_id] set choice_sets [db_list_of_lists existing_choice_sets {}] Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 7 Apr 2005 22:43:23 -0000 1.8 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 12 Jun 2006 02:49:51 -0000 1.9 @@ -33,6 +33,7 @@ set folder_id [as::assessment::folder_id -package_id $package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set correct_options [list [list "[_ assessment.yes]" t]] set add_existing_link [export_vars -base "item-add-mc-existing" {assessment_id section_id as_item_id after}] @@ -45,13 +46,29 @@ ad_form -name item_add_mc -action item-add-mc -export { assessment_id section_id after num_choices } -form { {as_item_id:key} {title:text {label "[_ assessment.choice_set_title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.mc_Title_help]"}} +} + +if { $type > 1} { +ad_form -extend -name item_add_mc -form { {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} {num_correct_answers:text,optional,nospell {label "[_ assessment.num_Correct_Answer]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Correct_help]"}} +} +} else { +ad_form -extend -name item_add_mc -form { + {increasing_p:text(hidden) {value ""}} + {negative_p:text(hidden) {value ""}} + {num_correct_answers:text(hidden) {value ""}} +} +} + + +ad_form -extend -name item_add_mc -form { {num_answers:text,optional,nospell {label "[_ assessment.num_Answers]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Answers_help]"}} {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} } + # add form entries for each choice set validate_list [list] set count_correct [array exists correct] @@ -62,6 +79,8 @@ } else { append ad_form_code "\{choice.$i:text,optional,nospell \{label \"[_ assessment.Choice] $i\"\} \{html \{size 80 maxlength 1000\}\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" } + + if { $type > 1} { if {[info exists correct($i)]} { append ad_form_code "\{correct.$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $i\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } else { @@ -70,6 +89,7 @@ if {[exists_and_not_null num_correct_answers] && $num_correct_answers > 0} { lappend validate_list "correct.$i {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\"" } + } } append ad_form_code "\}" if {[exists_and_not_null mc_id]} { @@ -79,7 +99,7 @@ set edit_request "{ - set title \"\" + set title \[db_string get_title {} -default \"\"\] set increasing_p f set negative_p f set num_correct_answers \"\" @@ -150,6 +170,7 @@ set after_submit "{ # now go to form to enter choice-specific data ad_returnredirect \[export_vars -base \"item-add-mc-choices\" {assessment_id section_id as_item_id after mc_id display_type}\] + ad_script_abort }" Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql 29 Mar 2005 10:53:35 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql 12 Jun 2006 02:49:51 -0000 1.4 @@ -34,4 +34,14 @@ + + + + select r.title + from cr_revisions r + where r.revision_id = :as_item_id + + + + Index: openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl 7 Apr 2005 22:43:53 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -27,6 +27,7 @@ set page_title [_ assessment.add_item_type_oq] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set type $assessment_data(type) set display_types [list] foreach display_type [db_list display_types {}] { @@ -37,13 +38,27 @@ ad_form -name item_add_oq -action item-add-oq -export { assessment_id section_id after } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} +} + +if { $type > 1} { + ad_form -extend -name item_add_oq -form { {default_value:text(textarea),optional,nospell {label "[_ assessment.Default_Value]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Deafult_Value_help]"}} {feedback:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_help]"}} {reference_answer:text(textarea),optional {label "[_ assessment.oq_Reference_Answer]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Reference_Answer_help]"}} {keywords:text(textarea),optional {label "[_ assessment.oq_Keywords]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Keywords_help]"}} + } +} else { + ad_form -extend -name item_add_oq -form { + {default_value:text(hidden) {value ""}} + {feedback:text(hidden) {value ""}} + {reference_answer:text(hidden) {value ""}} + {keywords:text(hidden) {value ""}} + } +} +ad_form -extend -name item_add_oq -form { {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} } -edit_request { - set title "" + set title [db_string get_title {} -default ""] set default_value "" set feedback "" set reference_answer "" Index: openacs-4/packages/assessment/www/asm-admin/item-add-oq.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-oq.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/item-add-oq.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/item-add-oq.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -34,4 +34,14 @@ + + + + select r.title + from cr_revisions r + where r.revision_id = :as_item_id + + + + Index: openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl 7 Apr 2005 22:44:33 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -29,6 +29,7 @@ set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set display_types [list] foreach display_type [db_list display_types {}] { @@ -39,11 +40,22 @@ ad_form -name item_add_sa -action item-add-sa -export { assessment_id section_id after } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.sa_Title_help]"}} - {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} - {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} +} +if { $type > 1} { + ad_form -extend -name item_add_sa -form { + {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} + {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} + } +} else { + ad_form -extend -name item_add_sa -form { + {increasing_p:text(hidden) {value f}} + {negative_p:text(hidden) {value f}} + } +} +ad_form -extend -name item_add_sa -form { {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} } -edit_request { - set title "" + set title [db_string get_title {} -default ""] set increasing_p f set negative_p f set display_type "tb" Index: openacs-4/packages/assessment/www/asm-admin/item-add-sa.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-sa.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/item-add-sa.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/item-add-sa.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -34,4 +34,14 @@ + + + + select r.title + from cr_revisions r + where r.revision_id = :as_item_id + + + + Index: openacs-4/packages/assessment/www/asm-admin/item-add-swcat.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-swcat.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-swcat.adp 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,7 @@ + + @page_title@ + @header_stuff@ + @context@ + @focus@ + + \ No newline at end of file Index: openacs-4/packages/assessment/www/asm-admin/item-add-swcat.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-swcat.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-swcat.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,83 @@ +# + +ad_page_contract { + + Add sitewide category item + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-15 + @arch-tag: 1aaf171d-3d71-4e10-86e8-66731a80a1a5 + @cvs-id $Id: item-add-swcat.tcl,v 1.2 2006/06/12 02:49:51 daveb Exp $ +} { + assessment_id:integer + section_id:integer + as_item_id:integer + after:integer +} -properties { + context:onevalue + page_title:onevalue +} + + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +permission::require_permission -object_id $assessment_id -privilege admin + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +set page_title [_ assessment.add_item_type_sa] +set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set header_stuff "" +set focus "" + +set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set display_types [as_item_type::get_display_types "swcat"] +set locale [ad_conn locale] +set category_trees [db_list_of_lists get_trees ""] + +ad_form -name item-add-swcat -export { assessment_id section_id after } -form { + {as_item_id:key} + {tree_id:text(select) {label "[_ assessment.Category_Tree]"} {options $category_trees} {help_text "[_ assessment.Category_Tree_help]"}} + {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} +} -edit_request + set tree_id "" + set display_type "sb" +} -edit_data { + db_transaction { + if {![db_0or1row item_type {}] || $object_type != "as_item_type_swcat"} { + set as_item_type_id [as::item_type_sa::new \ + -tree_id $tree_id] + + if {![info exists object_type]} { + # first item type mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_type_id -type as_item_type_rel + } else { + # old item type existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + db_dml update_item_type {} + } + } else { + # old sa item type existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_type_id [as::item_type_swcat::edit \ + -as_item_type_id $as_item_type_id \ + -tree_id $tree_id] + + db_dml update_item_type {} + } + } +} -after_submit { + # now go to display-type specific form (i.e. textbox) + ad_returnredirect [export_vars -base "item-add-display-$display_type" {assessment_id section_id as_item_id after}] + ad_script_abort +} + +ad_return_template + + Index: openacs-4/packages/assessment/www/asm-admin/item-add-swcat.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-swcat.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-add-swcat.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,44 @@ + + + + + + + + + + + + select ctt.name, ctt.tree_id + from category_tree_translations ctt, category_trees ct + where ctt.tree_id=ct.tree_id + and ctt.locale=:locale + + + + + + + + select r.target_rev_id as as_item_type_id, o.object_type + from as_item_rels r, acs_objects o + where r.item_rev_id = :as_item_id + and r.rel_type = 'as_item_type_rel' + and o.object_id = r.target_rev_id + + + + + + + + update as_item_rels + set target_rev_id = :as_item_type_id + where item_rev_id = :as_item_id + and rel_type = 'as_item_type_rel' + + + + + \ No newline at end of file Index: openacs-4/packages/assessment/www/asm-admin/item-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/www/asm-admin/item-add.tcl 15 Apr 2005 17:26:46 -0000 1.7 +++ openacs-4/packages/assessment/www/asm-admin/item-add.tcl 12 Jun 2006 02:49:51 -0000 1.8 @@ -29,6 +29,7 @@ set package_id [ad_conn package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set data_types [list] foreach data_type [list varchar text integer float date timestamp boolean content_type] { @@ -41,29 +42,60 @@ } -ad_form -name item_add -action item-add -export { assessment_id section_id after } -html {enctype multipart/form-data} -form { +ad_form -name item_add -action item-add -export { assessment_id section_id after type} -html {enctype multipart/form-data} -form { {as_item_id:key} {title:text(textarea) {label "[_ assessment.item_Title]"} {html {rows 3 cols 80 maxlength 1000}} {help_text "[_ assessment.item_Title_help]"}} - {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}} } +if { $type > 1} { + ad_form -extend -name item_add -form {{description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}} + } +} if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id 0 -form_name item_add } +if { $type > 1} { ad_form -extend -name item_add -form { {content:file,optional {label "[_ assessment.item_Content]"} {help_text "[_ assessment.item_Content_help]"}} {subtext:text,optional {label "[_ assessment.Subtext]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.item_Subtext_help]"}} {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}} {field_code:text,optional,nospell {label "[_ assessment.Field_Code]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Code_help]"}} - {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}} +} +} +ad_form -extend -name item_add -form { {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}} +} +if { $type > 1} { +ad_form -extend -name item_add -form { {feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}} {feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_wrong_help]"}} {max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.item_time_help]"}} {points:integer,optional,nospell {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} - {data_type:text(select) {label "[_ assessment.Data_Type]"} {options $data_types} {help_text "[_ assessment.Data_Type_help]"}} +} +} else { +ad_form -extend -name item_add -form { + {description:text(hidden) {value ""}} + {content:text(hidden) {value ""}} + {subtext:text(hidden) {value ""}} + {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}} + {field_code:text(hidden) {value ""}} + {feedback_right:text(hidden) {value ""}} + {feedback_wrong:text(hidden) {value ""}} + {max_time_to_complete:text(hidden) {value ""}} + {points:text(hidden) {value ""}} + {data_type:text(hidden) {value ""}} + +} +} + +if { $type > 1} { +ad_form -extend -name item_add -form { + {data_type:text(select) {label "[_ assessment.Data_Type]"} {options $data_types} {help_text "[_ assessment.Data_Type_help]"}}} +} +ad_form -extend -name item_add -form { {item_type:text(select) {label "[_ assessment.Item_Type]"} {options $item_types} {help_text "[_ assessment.Item_Type_help]"}} {num_choices:integer,optional,nospell {label "[_ assessment.Num_Choices]"} {html {size 5 maxlength 3}} {help_text "[_ assessment.Num_Choices_help]"}} + {validate_block:text(textarea),optional {label "[_ assessment.Validation_Block]"} {help_text "[_ assessment.lt_This_field_is_used_to]"} {html {cols 70 rows 6}}} } -new_request { set name "" set title "" @@ -79,12 +111,25 @@ set data_type "varchar" set item_type "sa" set num_choices 10 + if { $type == 1} { + set num_choices 3 + } } -on_submit { set category_ids [category::ad_form::get_categories -container_object_id $package_id] if {[empty_string_p $points]} { set points 0 } } -new_data { + if {[string eq $item_type "sa"]} { + set data_type "varchar" + } elseif {[string eq $item_type "oq"]} { + set data_type "text" + } elseif {[string eq $item_type "mc"]} { + set data_type "varchar" + } elseif {[string eq $item_type "fu"]} { + set data_type "file" + } + db_transaction { if {![db_0or1row item_exists {}]} { set as_item_id [as::item::new \ @@ -99,7 +144,8 @@ -feedback_right $feedback_right \ -feedback_wrong $feedback_wrong \ -max_time_to_complete $max_time_to_complete \ - -points $points] + -points $points \ + -validate_block $validate_block] } else { set as_item_id [as::item::edit \ -as_item_id $as_item_id \ @@ -113,7 +159,8 @@ -feedback_right $feedback_right \ -feedback_wrong $feedback_wrong \ -max_time_to_complete $max_time_to_complete \ - -points $points] + -points $points \ + -validate_block $validate_block] db_dml delete_files {} } @@ -141,7 +188,7 @@ } set folder_id [as::assessment::folder_id -package_id $package_id] - set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [exec uuidgen]] + set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]] as::item_rels::new -item_rev_id $as_item_id -target_rev_id $content_rev_id -type as_item_content_rel } } Index: openacs-4/packages/assessment/www/asm-admin/item-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-delete.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-delete.adp 4 May 2005 19:47:21 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-delete.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-delete.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/item-delete.tcl 4 May 2005 19:47:16 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-delete.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -8,7 +8,7 @@ section_id:integer as_item_id:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -25,15 +25,15 @@ } set page_title "[_ assessment.remove_item]" -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] set confirm_options [list [list "[_ assessment.continue_with_remove]" t] [list "[_ assessment.cancel_and_return]" f]] ad_form -name item_delete_confirm -action item-delete -export { assessment_id section_id } -form { {as_item_id:key} {item_title:text(inform) {label "[_ assessment.remove_1]"}} {from:text(inform) {label "[_ assessment.from]"} {value $assessment_data(title)}} - {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} + {confirmation:text(radio) {label " "} {options $confirm_options} {value t}} } -select_query_name {item_title} -on_submit { if {$confirmation} { db_transaction { Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.adp 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,89 @@ +ad_page_contract { + Form to edit an item with shortanswer display. + + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) + @cvs-id $Id: +} { + assessment_id:integer + section_id:integer + as_item_id:integer +} -properties { + context_bar:onevalue + page_title:onevalue +} + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +permission::require_permission -object_id $assessment_id -privilege admin + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +set page_title [_ assessment.edit_item_display_f] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] + +set orientation_types [list] +foreach orientation_type [list horizontal vertical] { + lappend orientation_types [list "[_ assessment.$orientation_type]" $orientation_type] +} + + +ad_form -name item_edit_display_f -action item-edit-display-f -export { assessment_id section_id } -form { + {as_item_id:key} + {html_display_options:text,optional,nospell {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}} + {abs_size:text,nospell {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.Absolute_Size_help]"}} + {box_orientation:text(select) {label "[_ assessment.Box_Orientation]"} {options $orientation_types} {help_text "[_ assessment.Box_Orientation_help]"}} + {as_item_display_id:text(hidden)} +} -edit_request { + db_1row last_used_display_type {} + if {![empty_string_p $as_item_display_id]} { + db_1row display_type_data {} + } else { + # default data if display newly mapped + set html_display_options "" + set abs_size 5 + set box_orientation "vertical" + set as_item_display_id 0 + } +} -validate { + {html_display_options {[as::assessment::check_html_options -options $html_display_options]} "[_ assessment.error_html_options]"} +} -edit_data { + db_transaction { + set new_item_id [as::item::new_revision -as_item_id $as_item_id] + + if {$as_item_display_id} { + # edit existing display type + set new_item_display_id [as::item_display_f::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_display_options \ + -abs_size $abs_size \ + -box_orientation $box_orientation] + } else { + # create new display type + set new_item_display_id [as::item_display_f::new \ + -html_display_options $html_display_options \ + -abs_size $abs_size \ + -box_orientation $box_orientation] + } + + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + set as_item_id [as::item::latest -as_item_id $as_item_id -section_id $new_section_id] + db_dml update_section_in_assessment {} + db_dml update_item_in_section {} + db_dml update_display_of_item {} + } + set as_item_id $new_item_id + set section_id $new_section_id +} -after_submit { + ad_returnredirect [export_vars -base "item-edit" {assessment_id section_id as_item_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,62 @@ + + + + + + + select max(d.as_item_display_id) as as_item_display_id + from cr_revisions r, as_item_rels ir, cr_revisions r2, as_item_display_f d + where r.revision_id = :as_item_id + and r2.item_id = r.item_id + and ir.item_rev_id = r2.revision_id + and ir.rel_type = 'as_item_display_rel' + and d.as_item_display_id = ir.target_rev_id + + + + + + + + select d.html_display_options, d.abs_size, d.box_orientation + from cr_revisions r, as_item_display_f d + where r.revision_id = d.as_item_display_id + and d.as_item_display_id = :as_item_display_id + + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set as_item_id = :new_item_id + where section_id = :new_section_id + and as_item_id = :as_item_id + + + + + + + + update as_item_rels + set target_rev_id = :new_item_display_id + where item_rev_id = :new_item_id + and rel_type = 'as_item_display_rel' + + + + + Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.adp 6 May 2005 00:27:30 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.tcl 6 May 2005 00:27:17 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.tcl 12 Jun 2006 02:49:51 -0000 1.4 @@ -8,7 +8,7 @@ section_id:integer as_item_id:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -25,7 +25,7 @@ } set page_title [_ assessment.edit_item_display_sa] -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] set orientation_types [list] foreach orientation_type [list horizontal vertical] { Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl 7 Apr 2005 22:45:54 -0000 1.7 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl 12 Jun 2006 02:49:51 -0000 1.8 @@ -52,6 +52,7 @@ {choice_label_orientation:text(hidden)} {sort_order_type:text(select) {label "[_ assessment.Order_Type]"} {options $order_types} {help_text "[_ assessment.Order_Type_help]"}} {item_answer_alignment:text(hidden)} + {prepend_empty_p:text(select) {label "[_ assessment.Prepend_Empty_Item]"} {options $boolean_options} {help_text "[_ assessment.lt_Prepend_an_empty_item]"}} {as_item_display_id:text(hidden)} } -edit_request { db_1row last_used_display_type {} @@ -65,6 +66,7 @@ set sort_order_type "order_of_entry" set item_answer_alignment "besideright" set as_item_display_id 0 + set prepend_empty_p f } } -validate { {html_display_options {[as::assessment::check_html_options -options $html_display_options]} "[_ assessment.error_html_options]"} @@ -80,15 +82,17 @@ -multiple_p $multiple_p \ -choice_label_orientation $choice_label_orientation \ -sort_order_type $sort_order_type \ - -item_answer_alignment $item_answer_alignment] + -item_answer_alignment $item_answer_alignment \ + -prepend_empty_p $prepend_empty_p] } else { # create new display type set new_item_display_id [as::item_display_sb::new \ -html_display_options $html_display_options \ -multiple_p $multiple_p \ -choice_label_orientation $choice_label_orientation \ -sort_order_type $sort_order_type \ - -item_answer_alignment $item_answer_alignment] + -item_answer_alignment $item_answer_alignment \ + -prepend_empty_p $prepend_empty_p] } set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -19,7 +19,7 @@ select d.html_display_options, d.multiple_p, d.choice_label_orientation, - d.sort_order_type, d.item_answer_alignment + d.sort_order_type, d.item_answer_alignment, d.prepend_empty_p from cr_revisions r, as_item_display_sb d where r.revision_id = d.as_item_display_id and d.as_item_display_id = :as_item_display_id Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.adp 5 May 2005 18:55:30 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.tcl 5 May 2005 18:55:52 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -8,7 +8,7 @@ section_id:integer as_item_id:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -25,7 +25,7 @@ } set page_title [_ assessment.edit_item_display_ta] -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] set alignment_types [list] foreach alignment_type [list besideleft besideright below above] { Index: openacs-4/packages/assessment/www/asm-admin/item-edit-fu.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-fu.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-fu.adp 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-fu.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-fu.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-fu.tcl 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,61 @@ +ad_page_contract { + Form to edit a short answer item. + + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) + +} { + assessment_id:integer + section_id:integer + as_item_id:integer +} -properties { + context:onevalue + page_title:onevalue +} + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +permission::require_permission -object_id $assessment_id -privilege admin + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +set page_title [_ assessment.edit_item_type_fu] +set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] + +set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] + + +ad_form -name item_edit_fu -action item-edit-fu -export { assessment_id section_id } -form { + {as_item_id:key} + {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} +} -edit_request { + db_1row item_type_data {} +} -edit_data { + db_transaction { + set new_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_type_id [db_string item_type_id {}] + set new_item_type_id [as::item_type_fu::edit \ + -as_item_type_id $as_item_type_id \ + -title $title] + + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + set as_item_id [as::item::latest -as_item_id $as_item_id -section_id $new_section_id] + db_dml update_section_in_assessment {} + db_dml update_item_in_section {} + db_dml update_item_type {} + } + set as_item_id $new_item_id + set section_id $new_section_id +} -after_submit { + ad_returnredirect [export_vars -base "item-edit" {assessment_id section_id as_item_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/item-edit-fu.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-fu.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-fu.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -0,0 +1,61 @@ + + + + + + + select r.title + from cr_revisions r, as_item_rels ir, as_item_type_fu i + where r.revision_id = i.as_item_type_id + and i.as_item_type_id = ir.target_rev_id + and ir.item_rev_id = :as_item_id + and ir.rel_type = 'as_item_type_rel' + + + + + + + + select target_rev_id + from as_item_rels + where item_rev_id = :new_item_id + and rel_type = 'as_item_type_rel' + + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set as_item_id = :new_item_id + where section_id = :new_section_id + and as_item_id = :as_item_id + + + + + + + + update as_item_rels + set target_rev_id = :new_item_type_id + where item_rev_id = :new_item_id + and rel_type = 'as_item_type_rel' + + + + + Index: openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl 15 Apr 2005 17:26:46 -0000 1.7 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl 12 Jun 2006 02:49:51 -0000 1.8 @@ -29,6 +29,7 @@ set package_id [ad_conn package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set item_type [string range [db_string get_item_type {}] end-1 end] set display_types [list] @@ -40,8 +41,11 @@ ad_form -name item_edit_general -action item-edit-general -export { assessment_id section_id } -html {enctype multipart/form-data} -form { {as_item_id:key} {title:text(textarea) {label "[_ assessment.Title]"} {html {rows 3 cols 80}} {help_text "[_ assessment.item_Title_help]"}} - {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}} } +if { $type > 1} { + ad_form -extend -name item_edit_general -form { + {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}} + } if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id $as_item_id -form_name item_edit_general @@ -52,20 +56,43 @@ {delete_content:text(checkbox),optional {label "[_ assessment.item_Delete_Content]"} {options {{{$content_name} t}} }} } } - +} +if { $type > 1} { ad_form -extend -name item_edit_general -form { {content:file,optional {label "[_ assessment.item_Content]"} {help_text "[_ assessment.item_Content_help]"}} {subtext:text,optional {label "[_ assessment.Subtext]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.item_Subtext_help]"}} {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}} {field_code:text,optional,nospell {label "[_ assessment.Field_Code]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Code_help]"}} +} +} +ad_form -extend -name item_edit_general -form { {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}} +} +if { $type > 1} { +ad_form -extend -name item_edit_general -form { {feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}} {feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_wrong_help]"}} {max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.item_time_help]"}} {points:integer,optional,nospell {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} +} +} else { +ad_form -extend -name item_edit_general -form { + {description:text(hidden) {value ""}} + {content:text(hidden) {value ""}} + {subtext:text(hidden) {value ""}} + {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}} + {field_code:text(hidden) {value ""}} + {feedback_right:text(hidden) {value ""}} + {max_time_to_complete:text(hidden) {value ""}} + {feedback_wrong:text(hidden) {value ""}} + {points:text(hidden) ""} +} +} +ad_form -extend -name item_edit_general -form { {data_type_disp:text(inform) {label "[_ assessment.Data_Type]"} {help_text "[_ assessment.Data_Type_help]"}} {data_type:text(hidden)} {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} + {validate_block:text(textarea),optional {label "[_ assessment.Validation_Block]"} {help_text "[_ assessment.lt_This_field_is_used_to]"} {html {cols 70 rows 6}}} } -edit_request { db_1row general_item_data {} if {[empty_string_p $data_type]} { @@ -93,7 +120,8 @@ -feedback_right $feedback_right \ -feedback_wrong $feedback_wrong \ -max_time_to_complete $max_time_to_complete \ - -points $points] + -points $points \ + -validate_block $validate_block] if {[exists_and_not_null category_ids]} { category::map_object -object_id $new_item_id $category_ids @@ -116,10 +144,13 @@ ad_return_complaint 1 "[_ assessment.file_zero_size]" return } - set folder_id [as::assessment::folder_id -package_id $package_id] - set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [exec uuidgen]] - db_dml update_item_content {} + set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]] + # delete content association if it exists then insert a new one + # otherwise we can't add a file on edit that did not exist + # when the question was originally created + db_dml delete_item_content {} + db_dml insert_item_content {} } elseif {[info exists delete_content]} { db_dml delete_item_content {} } Index: openacs-4/packages/assessment/www/asm-admin/item-edit-general.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-general.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-general.xql 15 Apr 2005 17:26:46 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-general.xql 12 Jun 2006 02:49:51 -0000 1.3 @@ -40,7 +40,7 @@ select r.title, r.description, i.subtext, i.field_name, i.field_code, i.required_p, - i.feedback_right, i.feedback_wrong, i.max_time_to_complete, i.data_type, i.points + i.feedback_right, i.feedback_wrong, i.max_time_to_complete, i.data_type, i.points, i.validate_block from cr_revisions r, as_items i where r.revision_id = i.as_item_id and i.as_item_id = :as_item_id @@ -60,6 +60,15 @@ + + + insert into as_item_rels + (target_rev_id, item_rev_id, rel_type) + values + (:content_rev_id, :new_item_id, 'as_item_content_rel') + + + Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-delete.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-delete.tcl 6 May 2005 15:45:34 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-delete.tcl 12 Jun 2006 02:49:51 -0000 1.4 @@ -13,7 +13,6 @@ section_id:integer,notnull as_item_id:integer,notnull choice_id:integer,notnull - mc_id:integer,notnull } set package_id [ad_conn package_id] @@ -24,6 +23,9 @@ set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] set new_item_id [as::item::new_revision -as_item_id $as_item_id] + # HAM : querried the mc_id for the given choice id + set mc_id [db_string "get_mc_id" "select mc_id from as_item_choices where choice_id=:choice_id"] + # *********** set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id -with_choices_p f] db_dml update_section_in_assessment {} db_dml update_item_in_section {} Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-swap.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-swap.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-swap.tcl 2 Feb 2005 21:31:15 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-swap.tcl 12 Jun 2006 02:49:51 -0000 1.3 @@ -32,6 +32,7 @@ set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] set new_item_id [as::item::new_revision -as_item_id $as_item_id] + as::assessment::check::copy_item_checks -assessment_id $assessment_id -section_id $new_section_id -as_item_id $as_item_id -new_item_id $new_item_id set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id] db_dml update_section_in_assessment {} db_dml update_item_in_section {} Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.adp 6 May 2005 00:30:14 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl 6 May 2005 00:30:08 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl 12 Jun 2006 02:49:51 -0000 1.7 @@ -15,7 +15,7 @@ percent:array,optional selected:array,optional } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -33,7 +33,7 @@ set package_id [ad_conn package_id] set page_title [_ assessment.edit_item_type_mc_choices] -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] set selected_options [list [list "[_ assessment.yes]" t]] @@ -124,7 +124,7 @@ ad_return_complaint 1 "[_ assessment.file_zero_size]" return } - set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [exec uuidgen]] + set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]] db_dml update_choice_content {} } elseif {[info exists delete_content($choice_id)]} { db_dml delete_choice_content {} Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.adp 6 May 2005 00:39:30 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.tcl 6 May 2005 00:39:14 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.tcl 12 Jun 2006 02:49:51 -0000 1.3 @@ -8,7 +8,7 @@ section_id:integer as_item_id:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -25,7 +25,7 @@ } set page_title [_ assessment.add_item_type_mc_existing] -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] set folder_id [as::assessment::folder_id -package_id $package_id] set choice_sets [db_list_of_lists existing_choice_sets {}] Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 5 May 2005 19:25:08 -0000 1.8 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 12 Jun 2006 02:49:51 -0000 1.9 @@ -10,7 +10,6 @@ choice:optional,array correct:optional,array {num_choices:integer,optional 5} - {old_choices:optional} } -properties { context:onevalue page_title:onevalue @@ -38,13 +37,28 @@ set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] set correct_options [list [list "[_ assessment.yes]" t]] +set type $assessment_data(type) + ad_form -name item_edit_mc -action item-edit-mc -export { assessment_id section_id num_choices } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.mc_Title_help]"}} +} + +if {$type > 1} { + ad_form -extend -name item_edit_mc -form { {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} {num_correct_answers:text,optional,nospell {label "[_ assessment.num_Correct_Answer]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Correct_help]"}} + } +} else { + ad_form -extend -name item_edit_mc -form { + {increasing_p:text(hidden) {value ""}} + {negative_p:text(hidden) {value ""}} + {num_correct_answers:text(hidden) {value ""}} + } +} +ad_form -extend -name item_edit_mc -form { {num_answers:text,optional,nospell {label "[_ assessment.num_Answers]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Answers_help]"}} } @@ -55,7 +69,6 @@ set count 0 set validate_list [list] set count_correct [array exists correct] -set old_choices [list] foreach one_choice $choices { util_unlist $one_choice choice_title choice_id choice_correct_p incr count @@ -67,40 +80,41 @@ } append ad_form_code "\{choice.$choice_id:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice($choice_id)\"\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" + if { $type > 1} { if {[info exists correct($choice_id)]} { append ad_form_code "\{correct.$choice_id:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } else { append ad_form_code "\{correct.$choice_id:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } - lappend validate_list "correct.$choice_id {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\"" - lappend old_choices $choice_id + # lappend validate_list "correct.$choice_id {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\"" + } } -append ad_form_code "\{old_choices:text(hidden) \{value $old_choices\}\}\n" -if {[template::form get_action item_show_mc] == "more"} { - # add new empty form entries for new choices - for {set i 1} {$i <= $num_choices} {incr i} { - incr count - if {[info exists choice($i)]} { - append ad_form_code "\{choice.$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice($i)\"\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" - } else { - append ad_form_code "\{choice.$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" - } - if {[info exists correct($i)]} { - append ad_form_code "\{correct.$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" - } else { - append ad_form_code "\{correct.$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" - } +# add new empty form entries for new choices +for {set i 1} {$i <= $num_choices} {incr i} { + incr count + if {[info exists choice(_$i)]} { + append ad_form_code "\{choice._$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice(_$i)\"\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" + } else { + append ad_form_code "\{choice._$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" } + if { $type > 1} { + if {[info exists correct(_$i)]} { + append ad_form_code "\{correct._$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" + } else { + append ad_form_code "\{correct._$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" + } + } } append ad_form_code "\}" eval ad_form -extend -name item_edit_mc $ad_form_code + set edit_request "{ db_1row item_type_data {} }" -set on_submit "{ +set on_submit "{ if {\[template::form get_action item_add_mc\] == \"more\"} { # add 5 more choice entries and redirect to this form incr num_choices 5 @@ -110,7 +124,6 @@ }" set edit_data "{ - db_transaction { set new_item_id \[as::item::new_revision -as_item_id \$as_item_id\] set as_item_type_id \[db_string item_type_id {}\] @@ -132,21 +145,24 @@ db_dml update_item_in_section {} db_dml update_item_type {} - set count 0 - set new_count \[llength \$old_choices\] - foreach i \[array names choice\] { - if {\[lsearch \$old_choices \$i\] != -1 } { - # old_choices preserves the prior order - set count \[expr \[lsearch \$old_choices \$i\] + 1\] - # edit existing choices + # edit existing choices + set count 0 + foreach i \[lsort \[array names choice\]\] { + if {\[string range \$i 0 0\] != \"_\" && !\[empty_string_p \$choice(\$i)\]} { + incr count set new_choice_id \[as::item_choice::new_revision -choice_id \$i -mc_id \$new_item_type_id\] set title \$choice(\$i) set correct_answer_p \[ad_decode \[info exists correct(\$i)\] 0 f t\] db_dml update_title {} db_dml update_correct_and_sort_order {} - } elseif { !\[empty_string_p \$choice(\$i)\] } { - # add new choices - incr new_count + } + } + + # add new choices + foreach i \[lsort \[array names choice\]\] { + + if {\[string range \$i 0 0\] == \"_\" && !\[empty_string_p \$choice(\$i)\]} { + incr count set new_choice_id \[as::item_choice::new -mc_id \$new_item_type_id \\ -title \$choice(\$i) \\ -numeric_value \"\" \\ @@ -155,7 +171,7 @@ -feedback_text \"\" \\ -selected_p \"\" \\ -correct_answer_p \[ad_decode \[info exists correct(\$i)\] 0 f t\] \\ - -sort_order \$new_count \\ + -sort_order \$count \\ -percent_score \"\"\] } } @@ -171,7 +187,6 @@ ad_script_abort }" -#eval ad_form -extend -name item_edit_mc -validate "{$validate_list}" -edit_request $edit_request -on_submit $on_submit -edit_data $edit_data -after_submit $after_submit -eval ad_form -extend -name item_edit_mc -validate "{$validate_list}" -edit_request $edit_request -edit_data $edit_data -after_submit $after_submit +eval ad_form -extend -name item_edit_mc -validate "{$validate_list}" -edit_request $edit_request -on_submit $on_submit -edit_data $edit_data -after_submit $after_submit ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/item-edit-oq.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-oq.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-oq.adp 6 May 2005 00:32:51 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-oq.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl 6 May 2005 00:32:45 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -8,7 +8,7 @@ section_id:integer as_item_id:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -25,17 +25,35 @@ } set page_title [_ assessment.edit_item_type_oq] -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] +set type $assessment_data(type) + + ad_form -name item_edit_oq -action item-edit-oq -export { assessment_id section_id } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} +} + +if { $type > 1} { + ad_form -extend -name item_edit_oq -form { {default_value:text(textarea),optional,nospell {label "[_ assessment.Default_Value]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Deafult_Value_help]"}} {feedback_text:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_help]"}} {reference_answer:text(textarea),optional {label "[_ assessment.oq_Reference_Answer]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Reference_Answer_help]"}} {keywords:text(textarea),optional {label "[_ assessment.oq_Keywords]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Keywords_help]"}} -} -edit_request { + } +} else { + ad_form -extend -name item_edit_oq -form { + {default_value:text(hidden) {value ""}} + {feedback_text:text(hidden) {value ""}} + {reference_answer:text(hidden) {value ""}} + {keywords:text(hidden) {value ""}} + } + +} + +ad_form -extend -name item_edit_oq -edit_request { db_1row item_type_data {} set keywords [join $keywords "\n"] } -on_submit { Index: openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl 7 Apr 2005 22:49:52 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -28,14 +28,27 @@ set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) ad_form -name item_edit_sa -action item-edit-sa -export { assessment_id section_id } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} - {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} - {allow_negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} -} -edit_request { +} +if { $type > 1} { + ad_form -extend -name item_edit_sa -form { + {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} + {allow_negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} + } +} else { + ad_form -extend -name item_edit_sa -form { + {increasing_p:text(hidden) {value ""}} + {allow_negative_p:text(hidden) {value ""}} + + } +} + +ad_form -extend -name item_edit_sa -edit_request { db_1row item_type_data {} } -edit_data { db_transaction { Index: openacs-4/packages/assessment/www/asm-admin/item-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/item-edit.tcl 15 Apr 2005 17:26:46 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/item-edit.tcl 12 Jun 2006 02:49:51 -0000 1.7 @@ -33,6 +33,9 @@ set item_type [string range [db_string item_type {}] end-1 end] set display_type [string range [db_string display_type {}] end-1 end] +if {[string eq $display_type "_f"]} { + set display_type f +} ad_form -name item_edit -mode display -action item-edit-general -export { assessment_id section_id as_item_id } -form { {title:text(textarea) {label "[_ assessment.Title]"} {html {rows 3 cols 80}} {value $title} {help_text "[_ assessment.item_Title_help]"}} Index: openacs-4/packages/assessment/www/asm-admin/item-swap-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-swap-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/item-swap-postgresql.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/item-swap-postgresql.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -2,6 +2,8 @@ postgresql7.1 + + update as_item_section_map Index: openacs-4/packages/assessment/www/asm-admin/item-swap.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-swap.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-swap.tcl 2 Feb 2005 21:31:15 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-swap.tcl 12 Jun 2006 02:49:51 -0000 1.3 @@ -19,7 +19,7 @@ set package_id [ad_conn package_id] permission::require_permission -object_id $package_id -privilege create permission::require_permission -object_id $assessment_id -privilege admin - +db_1row get_item_id {} if { $direction=="up" } { set next_sort_order [expr { $sort_order - 1 }] } else { @@ -36,4 +36,4 @@ ad_script_abort } -ad_returnredirect [export_vars -base one-a {assessment_id}] +ad_returnredirect [export_vars -base one-a {assessment_id}]\#$as_item_id Index: openacs-4/packages/assessment/www/asm-admin/item-swap.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-swap.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/item-swap.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/item-swap.xql 12 Jun 2006 02:49:51 -0000 1.2 @@ -12,4 +12,10 @@ + + + select as_item_id from as_item_section_map where sort_order=:sort_order and section_id=:section_id + + + Index: openacs-4/packages/assessment/www/asm-admin/one-a.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/one-a.adp,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/assessment/www/asm-admin/one-a.adp 9 Jun 2005 19:19:48 -0000 1.12 +++ openacs-4/packages/assessment/www/asm-admin/one-a.adp 12 Jun 2006 02:49:51 -0000 1.13 @@ -1,21 +1,30 @@ -@p_title@ +@p_title;noquote@ @context;noquote@ -#assessment.Created_by# @assessment_data.creator_name@#assessment.on_creation_date# - #assessment.history# + + + +
#assessment.Created_by# @assessment_data.creator_name@#assessment.on_creation_date# - #assessment.history##assessment.other_asm#
-

- + + #assessment.Edit# + +

#assessment.None#@assessment_data.instructions;noquote@ + #assessment.Edit# +

#assessment.None##assessment.type_s# #assessment.type_ea# #assessment.Edit# +

#assessment.Assessment_Title#:

#assessment.Description#:

#assessment.Instructions#:

#assessment.Assessment_Title#:

#assessment.Description#:

#assessment.Instructions#:

#assessment.Type#:

- #assessment.Edit# - @assessment_data.title@
@is_reg_asm_p@
+ @assessment_data.title;noquote@ + #assessment.Edit# +
@is_reg_asm_p@
+

#assessment.None#@assessment_data.description;noquote@ -

#assessment.None#@assessment_data.instructions;noquote@

#assessment.View_Responses# @@ -91,7 +100,7 @@

- + #assessment.add_section_first# @@ -101,30 +110,23 @@ - + +
@sections.rownum@. @sections.name@
@sections.rownum@. @sections.name@
-#assessment.Edit# -#assessment.add_new_section# +#assessment.add_new_section# -#assessment.Search_Section# +#assessment.Search_Section# -#assessment.edit_section_display# +#assessment.edit_section_display# -#assessment.section_preview# +#assessment.section_preview# -#assessment.admin_triggers# +#assessment.admin_triggers# - +#assessment.add_section_trigger# - - #assessment.Move_Down# - - - #assessment.Move_Up# - -#assessment.remove_section# (#assessment.max_time# @sections.max_time_to_complete@) (@sections.points@ #assessment.points#) @@ -138,8 +140,19 @@
- @sections.title@ + @sections.title@ + +#assessment.Edit# + + #assessment.Move_Down# + + + #assessment.Move_Up# + +#assessment.remove_section# +
+
Index: openacs-4/packages/assessment/www/asm-admin/one-a.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/one-a.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/assessment/www/asm-admin/one-a.tcl 9 Jun 2005 19:19:48 -0000 1.10 +++ openacs-4/packages/assessment/www/asm-admin/one-a.tcl 12 Jun 2006 02:49:51 -0000 1.11 @@ -23,14 +23,15 @@ set admin_p [acs_user::site_wide_admin_p] # Get the assessment data as::assessment::data -assessment_id $assessment_id -set context [list [list index [_ assessment.admin]] $assessment_data(title)] +set title [as::assessment::title -title $assessment_data(title)] +set context [list [list index [_ assessment.admin]] $title] set assessment_rev_id $assessment_data(assessment_rev_id) set subsite_id [subsite::main_site_id] set url [apm_package_url_from_id $subsite_id] set anonymous_p [db_string has_privilege {} -default "f"] set read_p [permission::permission_p -object_id $assessment_id -privilege read -party_id -1] -set value [parameter::get -parameter AsmForRegisterId -package_id $subsite_id] +set value [parameter::get -parameter RegistrationId -package_id $subsite_id] if { [exists_and_not_null asm_instance]} { set reg_url "[apm_package_url_from_id $asm_instance]admin" @@ -68,7 +69,7 @@ set notification_chunk [notification::display::request_widget \ -type assessment_response_notif \ -object_id $assessment_id \ - -pretty_name $assessment_data(title) \ + -pretty_name $title \ -url [export_vars -base one-a {assessment_id reg_p}] ] db_multirow sections assessment_sections {} { @@ -78,4 +79,17 @@ set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete] } +list::create \ + -name sections \ + -pass_properties assessment_id \ + -multirow sections \ + -key section_id \ + -no_data "[_ assessment.None]" \ + -elements { + title { + label "[_ assessment.Sections]" + display_template {@sections.title;noquote@} + } + } + ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/results-export.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-export.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/www/asm-admin/results-export.tcl 17 Feb 2006 12:13:55 -0000 1.8 +++ openacs-4/packages/assessment/www/asm-admin/results-export.tcl 12 Jun 2006 02:49:51 -0000 1.9 @@ -31,7 +31,7 @@ ad_form -name assessment_export -action results-export -form { {assessment_id:key} - {column_format:text(radio) {label "[_ assessment.csv_export_format]"} {options $export_options} {help_text "[_ assessment.csv_export_format_help]"}} + {column_format:text(radio) {label "[_ assessment.csv_export_format]"} {value "name" } {options $export_options} {help_text "[_ assessment.csv_export_format_help]"}} {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.csv_Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.csv_Start_Time_help]"}} {end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.csv_End_Time]"} {format $form_format} {help} {help_text "[_ assessment.csv_End_Time_help]"}} } -edit_request { Index: openacs-4/packages/assessment/www/asm-admin/results-export.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-export.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/results-export.xql 17 Feb 2006 12:13:55 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/results-export.xql 12 Jun 2006 02:49:51 -0000 1.7 @@ -33,16 +33,26 @@ +-- select s.session_id, s.percent_score, s.subject_id, +-- to_char(s.completed_datetime, 'YYYY-MM-DD HH24:MI:SS') as submission_date +-- from as_sessions s, +-- (select max(s2.session_id) as session_id, s2.subject_id +-- from as_sessions s2, cr_revisions r +-- where r.item_id = :assessment_id +-- and s2.assessment_id = r.revision_id +-- and s2.completed_datetime is not null +-- group by s2.subject_id) sub +-- where s.session_id = sub.session_id +-- $start_date_sql +-- $end_date_sql +-- order by s.session_id + select s.session_id, s.percent_score, s.subject_id, to_char(s.completed_datetime, 'YYYY-MM-DD HH24:MI:SS') as submission_date - from as_sessions s, - (select max(s2.session_id) as session_id, s2.subject_id - from as_sessions s2, cr_revisions r - where r.item_id = :assessment_id - and s2.assessment_id = r.revision_id - and s2.completed_datetime is not null - group by s2.subject_id) sub - where s.session_id = sub.session_id + from as_sessions s, cr_revisions r + where r.item_id = :assessment_id + and s.assessment_id = r.revision_id + and s.completed_datetime is not null $start_date_sql $end_date_sql order by s.session_id Index: openacs-4/packages/assessment/www/asm-admin/results-session.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-session.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/results-session.adp 15 Apr 2005 17:26:46 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/results-session.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -28,7 +28,7 @@ @@ -48,4 +48,9 @@
#assessment.section# @sections.title@ (#assessment.max_time# @sections.max_time_to_complete@) - (@sections.points@ / @sections.max_points@ #assessment.points#) + (@sections.points@ / @sections.max_points@ #assessment.points#)
@sections.description@


#assessment.Total_score#: @session_score@ / @assessment_score@ = @percent_score@% + + + +
+ Index: openacs-4/packages/assessment/www/asm-admin/results-session.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-session.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/results-session.tcl 15 Apr 2005 17:26:46 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/results-session.tcl 12 Jun 2006 02:49:51 -0000 1.3 @@ -70,4 +70,8 @@ incr assessment_score $max_points } +set showpoints [parameter::get -parameter "ShowPoints" -default 1 ] + +set comments_installed_p [apm_package_enabled_p "general-comments"] + ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/section-copy.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-copy.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/section-copy.adp 6 May 2005 00:42:29 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/section-copy.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/section-copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-copy.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/section-copy.tcl 6 May 2005 00:42:39 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/section-copy.tcl 12 Jun 2006 02:49:51 -0000 1.4 @@ -8,7 +8,7 @@ section_id:integer after:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -25,7 +25,7 @@ } set page_title "[_ assessment.copy_section]" -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] set confirm_options [list [list "[_ assessment.continue_with_copy]" t] [list "[_ assessment.cancel_and_return]" f]] Index: openacs-4/packages/assessment/www/asm-admin/section-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-delete.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/section-delete.adp 6 May 2005 00:41:55 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/section-delete.adp 12 Jun 2006 02:49:51 -0000 1.3 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/section-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-delete.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/section-delete.tcl 17 Feb 2006 12:13:55 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/section-delete.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -7,7 +7,7 @@ assessment_id:integer section_id:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -24,15 +24,15 @@ } set page_title "[_ assessment.remove_section]" -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] set confirm_options [list [list "[_ assessment.continue_with_remove]" t] [list "[_ assessment.cancel_and_return]" f]] ad_form -name section_delete_confirm -action section-delete -export { assessment_id } -form { {section_id:key} {section_title:text(inform) {label "[_ assessment.remove_1]"}} {from:text(inform) {label "[_ assessment.from]"} {value $assessment_data(title)}} - {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} + {confirmation:text(radio) {label " "} {options $confirm_options} {value t}} } -select_query_name {section_title} \ -on_submit { if {$confirmation} { Index: openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl 7 Apr 2005 22:54:56 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -34,6 +34,7 @@ set package_id [ad_conn package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set order_types [list] foreach one_order_type [list alphabetical randomized order_of_entry] { @@ -46,12 +47,26 @@ {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.sect_disp_Title_help]"}} {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.sect_disp_Description_help]"}} {num_items:integer,optional,nospell {label "[_ assessment.section_num_Items]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.sect_num_items_help]"}} +} + +if { $type > 1} { + ad_form -extend -name section_display_form -form { {adp_chunk:text(textarea),optional,nospell {label "[_ assessment.Section_Template]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_template_help]"}} {branched_p:text(select) {label "[_ assessment.section_Branched]"} {options $boolean_options} {help_text "[_ assessment.section_branched_help]"}} {back_button_p:text(select) {label "[_ assessment.Back_Button]"} {options $boolean_options} {help_text "[_ assessment.back_button_help]"}} {submit_answer_p:text(select) {label "[_ assessment.Submit_Answer]"} {options $boolean_options} {help_text "[_ assessment.submit_answer_help]"}} {sort_order_type:text(select) {label "[_ assessment.Section_Order]"} {options $order_types} {help_text "[_ assessment.section_order_help]"}} -} -new_request { + } +} else { + ad_form -extend -name section_display_form -form { + {adp_chunk:text(hidden) {value ""}} + {branched_p:text(hidden) {value ""}} + {back_button_p:text(hidden) {value ""}} + {submit_answer_p:text(hidden) {value ""}} + {sort_order_type:text(hidden) {value ""}} + } +} +ad_form -extend -name section_display_form -new_request { set title "" set description "" set num_items "" Index: openacs-4/packages/assessment/www/asm-admin/section-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-form.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/section-form.tcl 7 Apr 2005 22:54:44 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/section-form.tcl 12 Jun 2006 02:49:51 -0000 1.6 @@ -17,9 +17,11 @@ permission::require_permission -object_id $package_id -privilege create permission::require_permission -object_id $assessment_id -privilege admin + # Get the assessment data as::assessment::data -assessment_id $assessment_id + if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort @@ -36,9 +38,9 @@ set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] set display_types [db_list_of_lists section_display_types {}] -set display_types [concat [list [list "[_ assessment.section_new_display]" ""]] $display_types] +set display_types [concat [list [list "[_ assessment.no_display]" ""] [list "[_ assessment.section_new_display]" "-1"]] $display_types] +set type $assessment_data(type) - ad_form -name section_form -action section-form -export { assessment_id after } -form { {section_id:key} } @@ -55,20 +57,48 @@ ad_form -extend -name section_form -form { {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Title_help]"}} - {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Description_help]"}} } +if {$type > 1} { + ad_form -extend -name section_form -form { + {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Description_help]"}} + } +} if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id $_section_id -form_name section_form } + ad_form -extend -name section_form -form { {instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Instructions_help]"}} - {feedback_text:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Feedback_help]"}} - {max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.section_time_help]"}} +} +if {$type > 1} { + ad_form -extend -name section_form -form { + {feedback_text:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Feedback_help]"}} + {max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.section_time_help]"}} + } +} + +ad_form -extend -name section_form -form { {num_items:integer,optional,nospell {label "[_ assessment.num_items]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_items_help]"}} - {points:integer,optional,nospell {label "[_ assessment.points_section]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_section_help]"}} +} +if {$type > 1} { + ad_form -extend -name section_form -form { + {points:integer,optional,nospell {label "[_ assessment.points_section]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_section_help]"}} + } +} else { + ad_form -extend -name section_form -form { + {description:text(hidden) {value ""}} + {feedback_text:text(hidden) {value ""}} + {max_time_to_complete:text(hidden) {value ""}} + {points:text(hidden) {value ""}} + } +} + +ad_form -extend -name section_form -form { {display_type_id:text(select),optional {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.section_Display_Type_help]"}} + {no_display:text(hidden) {value f} + } } -new_request { set name "" set title "" @@ -79,6 +109,7 @@ set num_items "" set points "" set display_type_id "" + set no_display "f" } -edit_request { db_1row section_data {} } -validate { @@ -89,6 +120,14 @@ set points 0 } } -new_data { + if { [empty_string_p $display_type_id]} { + set no_display "t" + } + if { $display_type_id == -1} { + set display_type_id "" + } + + db_transaction { set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] @@ -112,7 +151,16 @@ } } } -edit_data { + db_transaction { + if { [empty_string_p $display_type_id]} { + set no_display "t" + } + + if { $display_type_id == -1} { + set display_type_id "" + } + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] @@ -135,11 +183,14 @@ } } } -after_submit { - if {[empty_string_p $display_type_id]} { - set section_id $new_section_id - ad_returnredirect [export_vars -base section-display-form {assessment_id section_id}] + if { $no_display } { + ad_returnredirect [export_vars -base one-a {assessment_id}] ad_script_abort - } else { + } elseif {[empty_string_p $display_type_id]} { + set section_id $new_section_id + ad_returnredirect [export_vars -base section-display-form {assessment_id section_id}] + ad_script_abort + } else { ad_returnredirect [export_vars -base one-a {assessment_id}] ad_script_abort } Index: openacs-4/packages/assessment/www/asm-admin/section-preview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-preview.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/section-preview.adp 7 Apr 2005 21:43:22 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/section-preview.adp 12 Jun 2006 02:49:51 -0000 1.4 @@ -1,6 +1,6 @@ @page_title;noquote@ -@context;noquote@ +@context_bar;noquote@ Index: openacs-4/packages/assessment/www/asm-admin/section-preview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-preview.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/section-preview.tcl 7 Apr 2005 22:55:30 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/section-preview.tcl 12 Jun 2006 02:49:51 -0000 1.5 @@ -8,7 +8,7 @@ assessment_id:integer section_id:integer } -properties { - context:onevalue + context_bar:onevalue page_title:onevalue } @@ -26,7 +26,7 @@ set assessment_rev_id $assessment_data(assessment_rev_id) set page_title "[_ assessment.section_preview]" -set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] db_1row section_data {} -column_array section # get all items of section in correct order Index: openacs-4/packages/assessment/www/asm-admin/sqlnet.log =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/Attic/sqlnet.log,v diff -u -N --- openacs-4/packages/assessment/www/asm-admin/sqlnet.log 17 Feb 2006 12:13:55 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,39 +0,0 @@ - - -*********************************************************************** -Fatal NI connect error 12541, connecting to: - (DESCRIPTION=(CONNECT_DATA=(SID=*)(SERVICE_NAME=athena2.uni-heidelberg.de)(CID=(PROGRAM=)(HOST=athena2)(USER=root)))(ADDRESS=(PROTOCOL=TCP)(HOST=athena2)(PORT=1521))) - - VERSION INFORMATION: - TNS for Linux: Version 9.2.0.4.0 - Production - TCP/IP NT Protocol Adapter for Linux: Version 9.2.0.4.0 - Production - Time: 30-AUG-2005 18:32:13 - Tracing not turned on. - Tns error struct: - nr err code: 0 - ns main err code: 12541 - TNS-12541: TNS:no listener - ns secondary err code: 12560 - nt main err code: 511 - TNS-00511: No listener - nt secondary err code: 111 - nt OS err code: 0 - - -*********************************************************************** -Fatal NI connect error 12514, connecting to: - (DESCRIPTION=(CONNECT_DATA=(SID=*)(SERVICE_NAME=athena.uni-heidelberg.de)(CID=(PROGRAM=)(HOST=athena2)(USER=root)))(ADDRESS=(PROTOCOL=TCP)(HOST=athena)(PORT=1521))) - - VERSION INFORMATION: - TNS for Linux: Version 9.2.0.4.0 - Production - TCP/IP NT Protocol Adapter for Linux: Version 9.2.0.4.0 - Production - Time: 30-AUG-2005 18:32:50 - Tracing not turned on. - Tns error struct: - nr err code: 0 - ns main err code: 12564 - TNS-12564: TNS:connection refused - ns secondary err code: 0 - nt main err code: 0 - nt secondary err code: 0 - nt OS err code: 0 Index: openacs-4/packages/assessment/www/asm-admin/export/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/export/index-oracle.xql 12 Apr 2005 15:59:59 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/export/index-oracle.xql 12 Jun 2006 02:49:52 -0000 1.3 @@ -7,7 +7,7 @@ SELECT aic.object_id as choice_id, aic.title as choice_title, aic.item_id as choice_item_id, aic.name as choice_name, aic.description as choice_description, aic.choice_id, aic.mc_id, aic.data_type as choice_data_type, aic.numeric_value as choice_numeric_value, aic.text_value as choice_text_value, aic.boolean_value as choice_boolean_value, aic.content_value as choice_content_value, aic.feedback_text as choice_feedback_text, aic.selected_p as choice_selected_p, aic.correct_answer_p as choice_correct_answer_p, aic.sort_order as choice_sort_order, aic.percent_score as choice_percent_score, r2.revision_id as content_rev_id, r2.title as content_filename, r2.mime_type, r2.content as cr_file_name, i.content_type, i.storage_area_key FROM cr_revisions r, cr_revisions r2, as_item_choicesx aic, cr_items i WHERE r2.revision_id(+) = aic.content_value - and i.item_id(+) = r2.item_id + and i.item_id = r2.item_id and aic.mc_id= :mc_id and r.revision_id = aic.choice_id ORDER BY aic.sort_order @@ -17,7 +17,7 @@ SELECT count(aic.correct_answer_p) as num_answers_correct - FROM cr_revisions r, cr_revisions r2, cr_items i, as_item_choicesx aic + FROM cr_revisions r, cr_revisions r2, cr_items, as_item_choicesx aic WHERE r2.revision_id(+) = aic.content_value and i.item_id(+) = r2.item_id and aic.mc_id= :mc_id Index: openacs-4/packages/assessment/www/asm-admin/export/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index.vuh,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/assessment/www/asm-admin/export/index.vuh 24 Nov 2005 15:32:49 -0000 1.8 +++ openacs-4/packages/assessment/www/asm-admin/export/index.vuh 12 Jun 2006 02:49:52 -0000 1.9 @@ -9,20 +9,20 @@ } if {[exists_and_not_null assessment_id]} { - # Get the assessment data - as::assessment::data -assessment_id $assessment_id - set download_name $assessment_data(title) - - # We get rid of spaces since they are annoying - regsub -all { } $download_name {_} download_name + # Get the assessment data + as::assessment::data -assessment_id $assessment_id + set download_name $assessment_data(title) + + # We get rid of spaces since they are annoying + regsub -all { } $download_name {_} download_name - set tmp_dir $download_name - set ext "zip" + set tmp_dir $download_name + set ext "zip" - append download_name ".${ext}" + append download_name ".${ext}" - ad_returnredirect "${assessment_id}/${download_name}" - ad_script_abort + ad_returnredirect "${assessment_id}/${download_name}" + ad_script_abort } # convenient way to get the values out of a list @@ -154,14 +154,14 @@ #sort_order_type as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label sort_order_type -value $s_sort_order_type } - + # as::export::new_element -value $section_description -father $section -label objectives -root $doc -material_p t # as::export::new_element -value $section_instructions -father $section -label rubric -root $doc -material_p t # as::export::new_element -value $section_feedback_text -father $section -label sectionfeedback -root $doc -material_p t -attribute_label ident -attribute_value $section_id - + # set selection_ordering [$doc createElement selection_ordering] $section appendChild $selection_ordering @@ -199,12 +199,15 @@ db_0or1row as_item_display_tbx "SELECT as_item_display_id AS tb__display_id FROM as_item_display_tb WHERE as_item_display_id=:item_display_id" #textarea (short answer) db_0or1row as_item_display_tax "SELECT as_item_display_id AS ta__display_id FROM as_item_display_ta WHERE as_item_display_id=:item_display_id" - + # set item [$doc createElement item] + if { $field_name ne "" } { + set item_name $field_name + } $item setAttribute ident $item_name $section appendChild $item - + # as::export::new_element -value $item_description -father $item -label qticomment -root $doc # @@ -268,7 +271,7 @@ #item_answer_alignment as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label item_answer_alignment -value $item_answer_alignment } - + # open question item db_0or1row as_item_oq { } if {[info exists id__as_item_type_oq]} { @@ -301,7 +304,7 @@ #content_type: imagen set content_type "" - + db_0or1row get_content_type_items {} if {$content_type == "image"} { # @@ -316,8 +319,8 @@ file copy -force -- "${cr_path}${cr_file_name}" [file join ${in_path} $content_filename] } } - + #find out the item type (multiple choice or multiple response) if {[info exists cb__display_id] || [info exists rb__display_id]} { if {[info exists cb__display_id]} { @@ -372,7 +375,7 @@ } } else { #short answer - if {[info exists ta__display_id]} { + if {[info exists ta__display_id] } { # set response_str [$doc createElement response_str] $response_str setAttribute ident $item_name @@ -382,8 +385,8 @@ #get rows and cols for painting a textarea (in abs_size is stored as "rows value cols value", we need to add the symbol =) db_0or1row html_rows_cols "SELECT html_display_options FROM as_item_display_ta WHERE as_item_display_id=:item_display_id" if {![empty_string_p $html_display_options]} { - set rows "[lindex $html_display_options 1]" - set columns "[lindex $html_display_options 3]" + set rows "[lindex $html_display_options 3]" + set columns "[lindex $html_display_options 1]" } else { set rows 5 set columns 25 @@ -404,12 +407,16 @@ } else { #fill in the blank #whether it's a fill-in-blank I have to split by + ns_log notice "DEBUG::1 $item_title" regsub -all -line -nocase -- "" $html ":" html1 + ns_log notice "DEBUG::3 $html1" set item_title1 [split $html1 :] set longitud [llength $item_title1] - - for {set i 0} {$i<[llength $item_title1]-1} {incr i 2} { + + for {set i 0} {$i<=[llength $item_title1]-1} {incr i 2} { + ns_log notice "DEBUG::4 $i" set item_title [lindex $item_title1 $i] # set material [$doc createElement material] @@ -439,9 +446,9 @@ $render_fib appendChild $response_label } } - } - - if { $assessment_data(survey_p) != "t" && ![info exists ta__display_id] } { + } + + if { $assessment_data(survey_p) != "t" && ![info exists ta__display_id] } { # set resprocessing [$doc createElement resprocessing] $item appendChild $resprocessing @@ -461,65 +468,65 @@ #fill-in-blank if {[info exists tb__display_id]} { - set i 0 - db_foreach query_all_choices {} { - # - set or [$doc createElement or] - $conditionvar appendChild $or - set list_choice_title $choice_title - for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} { - # - set varequal [$doc createElement varequal] - $varequal setAttribute respident $item_name$i - $or appendChild $varequal - set text [$doc createCDATASection [lindex $list_choice_title $j]] - $varequal appendChild $text - } - incr i 2 - } - } else { - - - # - set and [$doc createElement and] - $conditionvar appendChild $and - - set exist_false 0 - db_foreach query_all_choices2 {} { - if {$correct_answer_p == "t" } { - # - set varequal [$doc createElement varequal] - $varequal setAttribute respident $item_name - $and appendChild $varequal - set text [$doc createCDATASection $name] - $varequal appendChild $text - } else { - set exist_false 1 + set i 0 + db_foreach query_all_choices {} { + # + set or [$doc createElement or] + $conditionvar appendChild $or + set list_choice_title $choice_title + for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} { + # + set varequal [$doc createElement varequal] + $varequal setAttribute respident $item_name$i + $or appendChild $varequal + set text [$doc createCDATASection [lindex $list_choice_title $j]] + $varequal appendChild $text + } + incr i 2 } - } - if { $exist_false == 1 } { - # - set not [$doc createElement not] - $and appendChild $not - # - set or [$doc createElement or] - $not appendChild $or + } else { + + + # + set and [$doc createElement and] + $conditionvar appendChild $and + + set exist_false 0 db_foreach query_all_choices2 {} { - if {$correct_answer_p == "f" } { - # - set varequal [$doc createElement varequal] - $varequal setAttribute respident $item_name - $or appendChild $varequal - set text [$doc createCDATASection $name] - $varequal appendChild $text + if {$correct_answer_p == "t" } { + # + set varequal [$doc createElement varequal] + $varequal setAttribute respident $item_name + $and appendChild $varequal + set text [$doc createCDATASection $name] + $varequal appendChild $text + } else { + set exist_false 1 } } - } + if { $exist_false == 1 } { + # + set not [$doc createElement not] + $and appendChild $not + # + set or [$doc createElement or] + $not appendChild $or + db_foreach query_all_choices2 {} { + if {$correct_answer_p == "f" } { + # + set varequal [$doc createElement varequal] + $varequal setAttribute respident $item_name + $or appendChild $varequal + set text [$doc createCDATASection $name] + $varequal appendChild $text + } + } + } } set num_answers_correct "" db_0or1row num_answers_correct {} - + if {$item_points == 1 && $num_answers_correct>1} { # set setvar [$doc createElement setvar] @@ -546,202 +553,202 @@ #fill-in-blank if {[info exists tb__display_id]} { - set i 0 - # - set not [$doc createElement not] - $conditionvar appendChild $not - # - set and [$doc createElement and] - $not appendChild $and - db_foreach query_all_choices {} { - # - set or [$doc createElement or] - $and appendChild $or - set list_choice_title $choice_title - for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} { - # - set varequal [$doc createElement varequal] - $varequal setAttribute respident $item_name$i - $or appendChild $varequal - set text [$doc createCDATASection [lindex $list_choice_title $j]] - $varequal appendChild $text - } - incr i 2 - } - - } else { - - # - set or [$doc createElement or] - $conditionvar appendChild $or - - set exist_true 0 - db_foreach query_all_choices2 {} { - if {$correct_answer_p == "f" } { - # - set varequal [$doc createElement varequal] - $varequal setAttribute respident $item_name - $or appendChild $varequal - set text [$doc createCDATASection $name] - $varequal appendChild $text - } else { - set exist_true 1 - } - } - if { $exist_true == 1 } { + set i 0 # set not [$doc createElement not] - $or appendChild $not + $conditionvar appendChild $not # set and [$doc createElement and] $not appendChild $and - db_foreach query_all_choices2 {} { - if {$correct_answer_p == "t" } { - # - set varequal [$doc createElement varequal] - $varequal setAttribute respident $item_name - $and appendChild $varequal - set text [$doc createCDATASection $name] - $varequal appendChild $text - } - } - } - } - - # - set displayfeedback [$doc createElement displayfeedback] - set linkrefid { } - append linkrefid $item_name displayWrong - $displayfeedback setAttribute linkrefid $linkrefid - $respcondition appendChild $displayfeedback - - - if {$item_points>1 || $num_answers_correct==1} { - db_foreach query_all_choices {} { - set i 0 - # [info exists tb__display_id] because for fib item choice_correct_answer_p is null - if { $choice_correct_answer_p == "t" || [info exists tb__display_id] } { - set list_choice_title $choice_title - set length_list_choice_title [llength $list_choice_title] - - if {![info exists tb__display_id]} { - set length_list_choice_title 1 - } - - for {set j 0} {$j < $length_list_choice_title} {incr j 1} { - # - set respcondition [$doc createElement respcondition] - $respcondition setAttribute title "adjustscore" - $resprocessing appendChild $respcondition - # - set conditionvar [$doc createElement conditionvar] - $respcondition appendChild $conditionvar - # - set varequal [$doc createElement varequal] - if {[info exists tb__display_id]} { - $varequal setAttribute respident $item_name$i - } else { - $varequal setAttribute respident $item_name + db_foreach query_all_choices {} { + # + set or [$doc createElement or] + $and appendChild $or + set list_choice_title $choice_title + for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} { + # + set varequal [$doc createElement varequal] + $varequal setAttribute respident $item_name$i + $or appendChild $varequal + set text [$doc createCDATASection [lindex $list_choice_title $j]] + $varequal appendChild $text } - $conditionvar appendChild $varequal - if {[info exists tb__display_id]} { - set text [$doc createCDATASection [lindex $list_choice_title $j]] + incr i 2 + } + + } else { + + # + set or [$doc createElement or] + $conditionvar appendChild $or + + set exist_true 0 + db_foreach query_all_choices2 {} { + if {$correct_answer_p == "f" } { + # + set varequal [$doc createElement varequal] + $varequal setAttribute respident $item_name + $or appendChild $varequal + set text [$doc createCDATASection $name] + $varequal appendChild $text } else { - set text [$doc createCDATASection $choice_name] + set exist_true 1 } - $varequal appendChild $text - # - set setvar [$doc createElement setvar] - $setvar setAttribute varname "SCORE" - $setvar setAttribute action "Add" - $respcondition appendChild $setvar - # in fib items choice_percent_score column is null - if {[empty_string_p $choice_percent_score]} { - set choice_percent_score 1 - } else { - set choice_percent_score [expr round (($num_answers_correct * $choice_percent_score * 1.0) / 100)] - } - set text [$doc createCDATASection $choice_percent_score] - $setvar appendChild $text - #feedback choice - if {![empty_string_p $choice_feedback_text]} { - set displayfeedback [$doc createElement displayfeedback] + } + if { $exist_true == 1 } { + # + set not [$doc createElement not] + $or appendChild $not + # + set and [$doc createElement and] + $not appendChild $and + db_foreach query_all_choices2 {} { + if {$correct_answer_p == "t" } { + # + set varequal [$doc createElement varequal] + $varequal setAttribute respident $item_name + $and appendChild $varequal + set text [$doc createCDATASection $name] + $varequal appendChild $text + } + } + } + } + + # + set displayfeedback [$doc createElement displayfeedback] + set linkrefid { } + append linkrefid $item_name displayWrong + $displayfeedback setAttribute linkrefid $linkrefid + $respcondition appendChild $displayfeedback + + + if {$item_points>1 || $num_answers_correct==1} { + db_foreach query_all_choices {} { + set i 0 + # [info exists tb__display_id] because for fib item choice_correct_answer_p is null + if { $choice_correct_answer_p == "t" || [info exists tb__display_id] } { + set list_choice_title $choice_title + set length_list_choice_title [llength $list_choice_title] + + if {![info exists tb__display_id]} { + set length_list_choice_title 1 + } + + for {set j 0} {$j < $length_list_choice_title} {incr j 1} { + # + set respcondition [$doc createElement respcondition] + $respcondition setAttribute title "adjustscore" + $resprocessing appendChild $respcondition + # + set conditionvar [$doc createElement conditionvar] + $respcondition appendChild $conditionvar + # + set varequal [$doc createElement varequal] + if {[info exists tb__display_id]} { + $varequal setAttribute respident $item_name$i + } else { + $varequal setAttribute respident $item_name + } + $conditionvar appendChild $varequal + if {[info exists tb__display_id]} { + set text [$doc createCDATASection [lindex $list_choice_title $j]] + } else { + set text [$doc createCDATASection $choice_name] + } + $varequal appendChild $text + # + set setvar [$doc createElement setvar] + $setvar setAttribute varname "SCORE" + $setvar setAttribute action "Add" + $respcondition appendChild $setvar + # in fib items choice_percent_score column is null + if {[empty_string_p $choice_percent_score]} { + set choice_percent_score 1 + } else { + set choice_percent_score [expr round (($num_answers_correct * $choice_percent_score * 1.0) / 100)] + } + set text [$doc createCDATASection $choice_percent_score] + $setvar appendChild $text + #feedback choice + if {![empty_string_p $choice_feedback_text]} { + set displayfeedback [$doc createElement displayfeedback] + set linkrefid { } + append linkrefid $choice_name feedbackChoice + $displayfeedback setAttribute linkrefid $linkrefid + $respcondition appendChild $displayfeedback + } + } + } + incr i 2 + + #for feedback choice + if { $choice_correct_answer_p == "f" && ![empty_string_p $choice_feedback_text] } { + # + set respcondition [$doc createElement respcondition] + $resprocessing appendChild $respcondition + # + set conditionvar [$doc createElement conditionvar] + $respcondition appendChild $conditionvar + # + set varequal [$doc createElement varequal] + $varequal setAttribute respident $item_name + $conditionvar appendChild $varequal + set text [$doc createCDATASection $choice_name] + $varequal appendChild $text + #feedback choice + set displayfeedback [$doc createElement displayfeedback] set linkrefid { } append linkrefid $choice_name feedbackChoice $displayfeedback setAttribute linkrefid $linkrefid - $respcondition appendChild $displayfeedback - } - } + $respcondition appendChild $displayfeedback + } + } } - incr i 2 - #for feedback choice - if { $choice_correct_answer_p == "f" && ![empty_string_p $choice_feedback_text] } { - # - set respcondition [$doc createElement respcondition] - $resprocessing appendChild $respcondition - # - set conditionvar [$doc createElement conditionvar] - $respcondition appendChild $conditionvar - # - set varequal [$doc createElement varequal] - $varequal setAttribute respident $item_name - $conditionvar appendChild $varequal - set text [$doc createCDATASection $choice_name] - $varequal appendChild $text - #feedback choice - set displayfeedback [$doc createElement displayfeedback] - set linkrefid { } - append linkrefid $choice_name feedbackChoice - $displayfeedback setAttribute linkrefid $linkrefid - $respcondition appendChild $displayfeedback - } - } - } + #feedback_wrong + if {![empty_string_p $item_feedback_wrong] } { + # + set itemfeedback [$doc createElement itemfeedback] + set ident { } + append ident $item_name displayWrong + $itemfeedback setAttribute ident $ident + $item appendChild $itemfeedback + # + as::export::new_element -value $item_feedback_wrong -father $itemfeedback -label flow_mat -root $doc -material_p t + } + + #feedback_right + if {![empty_string_p $item_feedback_right]} { + # + set itemfeedback [$doc createElement itemfeedback] + set ident { } + append ident $item_name displayRight + $itemfeedback setAttribute ident $ident + $item appendChild $itemfeedback + # + as::export::new_element -value $item_feedback_right -father $itemfeedback -label flow_mat -root $doc -material_p t + } + + #feedback_choice + db_foreach query_all_choices {} { + if {![empty_string_p $choice_feedback_text]} { + # + set itemfeedback [$doc createElement itemfeedback] + set ident { } + append ident $choice_name feedbackChoice + $itemfeedback setAttribute ident $ident + $item appendChild $itemfeedback + # + as::export::new_element -value $choice_feedback_text -father $itemfeedback -label flow_mat -root $doc -material_p t + } + } + } - #feedback_wrong - if {![empty_string_p $item_feedback_wrong] } { - # - set itemfeedback [$doc createElement itemfeedback] - set ident { } - append ident $item_name displayWrong - $itemfeedback setAttribute ident $ident - $item appendChild $itemfeedback - # - as::export::new_element -value $item_feedback_wrong -father $itemfeedback -label flow_mat -root $doc -material_p t - } - - #feedback_right - if {![empty_string_p $item_feedback_right]} { - # - set itemfeedback [$doc createElement itemfeedback] - set ident { } - append ident $item_name displayRight - $itemfeedback setAttribute ident $ident - $item appendChild $itemfeedback - # - as::export::new_element -value $item_feedback_right -father $itemfeedback -label flow_mat -root $doc -material_p t - } - - #feedback_choice - db_foreach query_all_choices {} { - if {![empty_string_p $choice_feedback_text]} { - # - set itemfeedback [$doc createElement itemfeedback] - set ident { } - append ident $choice_name feedbackChoice - $itemfeedback setAttribute ident $ident - $item appendChild $itemfeedback - # - as::export::new_element -value $choice_feedback_text -father $itemfeedback -label flow_mat -root $doc -material_p t - } - } - } - } - } - +} + #puts [$root asXML] set outfd "" @@ -757,15 +764,15 @@ set tmp_file "[ad_generate_random_string].zip" set out_file [file join ${out_path} ${tmp_file}] - + # get the archive command # TODO SECURITY DONT USE GLOBBING set cmd "zip -r -9 -X '$out_file' *" # create the archive with_catch errmsg { -# TODO SECURITY DONT USE THE SHELL - exec bash -c "cd '$in_path'; $cmd; cd -" + # TODO SECURITY DONT USE THE SHELL + exec bash -c "cd '$in_path'; $cmd; cd -" } { # some day we'll do something useful here error $errmsg Index: openacs-4/packages/assessment/www/asm-admin/export/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/export/index.xql 24 Mar 2005 14:31:13 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/export/index.xql 12 Jun 2006 02:49:52 -0000 1.7 @@ -14,7 +14,7 @@ - SELECT i.as_item_id, i.title as item_title, i.name as item_name, i.description as item_description, i.subtext as item_subtext, i.field_code as item_field_code, i.required_p as item_required_p, i.data_type as item_data_type, i.max_time_to_complete as item_max_time_to_complete, i.feedback_right as item_feedback_right, i.feedback_wrong as item_feedback_wrong, i.points as item_points + SELECT i.as_item_id, i.title as item_title, i.name as item_name, i.description as item_description, i.subtext as item_subtext, i.field_code as item_field_code, i.required_p as item_required_p, i.data_type as item_data_type, i.max_time_to_complete as item_max_time_to_complete, i.feedback_right as item_feedback_right, i.feedback_wrong as item_feedback_wrong, i.points as item_points, i.field_name FROM as_itemsx i, as_item_section_map ism WHERE i.as_item_id = ism.as_item_id AND ism.section_id = :section_id ORDER BY ism.sort_order
@assessment_data.title@