Index: openacs-4/packages/lors-central/catalog/lors-central.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/catalog/lors-central.en_US.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/catalog/lors-central.en_US.ISO-8859-1.xml 17 May 2005 16:21:16 -0000 1.1 @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<message_catalog package_key="lors-central" package_version="0.1a2" locale="en_US" charset="ISO-8859-1"> + + <msg key="action_not">Action Not Allowed</msg> + <msg key="add">Add Child</msg> + <msg key="add_an_existent">Add an existent Learning Object</msg> + <msg key="add_file">Add File</msg> + <msg key="add_from_clip">Add From Clipboard:</msg> + <msg key="add_object">Add Object</msg> + <msg key="add_this">Add This Item</msg> + <msg key="Add_this_learn">Add this learning object to your clipboard</msg> + <msg key="Add_to_clip">Add to Clipboard</msg> + <msg key="add_to_course">Add to this course</msg> + <msg key="add_to_resource">Add to this resource</msg> + <msg key="All_views">All Views</msg> + <msg key="All_views_of">All Views of this object</msg> + <msg key="and_is_in">And is in use in the following courses</msg> + <msg key="assoc">Associations:</msg> + <msg key="associate">Associate</msg> + <msg key="associate_drop">Associate/Drop</msg> + <msg key="associate_to">Associate to dotLRN Class</msg> + <msg key="associate_to_class">Associate to this class</msg> + <msg key="associated">Already Associated</msg> + <msg key="author">Author:</msg> + <msg key="choose_the_file">Choose the file to upload</msg> + <msg key="class_name">Class Name</msg> + <msg key="Classes_using">Classes Using this Course</msg> + <msg key="click_for_prev">Click For Preview</msg> + <msg key="clip_this_res">Clip This Resource</msg> + <msg key="course_name">Course Name</msg> + <msg key="course_versions">Course Versions</msg> + <msg key="courses">Courses</msg> + <msg key="create_your_new">Create a New File or....</msg> + <msg key="current">Current</msg> + <msg key="dep_name">Department Name</msg> + <msg key="description">Description</msg> + <msg key="disabled">Disabled</msg> + <msg key="dotlrn_classes">dotLRN classes</msg> + <msg key="drop">Drop</msg> + <msg key="drop_association">Drop association to this class</msg> + <msg key="Edit">Edit</msg> + <msg key="edit_object">Edit %name%</msg> + <msg key="enabled">Enabled</msg> + <msg key="everywhere">Everywhere</msg> + <msg key="filename">Filename</msg> + <msg key="help_text">Use the "Browse..." button to locate your file, then click "Open"</msg> + <msg key="here">Here</msg> + <msg key="hide">Hide</msg> + <msg key="item_files">Item Files</msg> + <msg key="item_name">Item Name:</msg> + <msg key="item_title">Item Title</msg> + <msg key="label_title">Check/uncheck all rows</msg> + <msg key="last_modified">Last Modifed</msg> + <msg key="live">Live</msg> + <msg key="live_classes">Live Classes?</msg> + <msg key="lo_files">Learning Object Files</msg> + <msg key="make">Make</msg> + <msg key="make_live">Make Live Everywhere</msg> + <msg key="make_this_live">Make this live</msg> + <msg key="man_id">Manifest ID</msg> + <msg key="new_file">Add New File</msg> + <msg key="new_object">New Learning Object</msg> + <msg key="no">No</msg> + <msg key="of">of</msg> + <msg key="of_title">of %name%</msg> + <msg key="one_course">One Course</msg> + <msg key="one_course_assoc">One Course Associations</msg> + <msg key="one_course_views">One Course Views</msg> + <msg key="one_file">One File</msg> + <msg key="One_learning">One Learning Object</msg> + <msg key="please_type">Please type a keyword</msg> + <msg key="preview">Preview</msg> + <msg key="search">Search</msg> + <msg key="search_courses">Search Courses</msg> + <msg key="set_to">Set to</msg> + <msg key="shared">Shared?</msg> + <msg key="shared_items">Shared Items In The Repository</msg> + <msg key="subject_name">Subject Name</msg> + <msg key="term_name">Term Name</msg> + <msg key="there_are_no">There are no items in this clipboard.</msg> + <msg key="This_course_is">This course is in use in the following dotLRN classes:</msg> + <msg key="this_file">This File</msg> + <msg key="this_file_has">This file has the following versions</msg> + <msg key="this_file_is">This file is already present on this resource. You can't add the same file to the same resource twice.</msg> + <msg key="this_is_a">This is a zip file containing multiple files.</msg> + <msg key="This_learning_obj">This Learning Object is in use in the following class instances:</msg> + <msg key="this_lo_uses">This files are in use in this learning object</msg> + <msg key="title">Check/uncheck this row, and select an action to perform below</msg> + <msg key="tracking">Tracking</msg> + <msg key="type">Type</msg> + <msg key="update_course_ver">Update Course Versions</msg> + <msg key="update_versions">Update Versions</msg> + <msg key="upload_a_new">Upload a New File or....</msg> + <msg key="Usage">Usage</msg> + <msg key="version">Version</msg> + <msg key="version_number">Ver. #</msg> + <msg key="versions">Versions</msg> + <msg key="view">View</msg> + <msg key="view_all">View All</msg> + <msg key="view_all_exist">View all existing clipboards</msg> + <msg key="views">Views</msg> + <msg key="views_in">Views in this class</msg> + <msg key="watch_assoc">Course associations to dotLRN class</msg> + <msg key="we_are_sorry">We are sorry, it appears you don't have permission to admin lors-central package.</msg> + <msg key="yes">Yes</msg> + <msg key="you_have_to"><b>You have to associate the course to a class before you can manage tracking</b></msg> + <msg key="zip_file">Zip File</msg> +</message_catalog> Index: openacs-4/packages/lors-central/catalog/lors-central.es_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/catalog/lors-central.es_ES.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/catalog/lors-central.es_ES.ISO-8859-1.xml 17 May 2005 16:21:16 -0000 1.1 @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<message_catalog package_key="lors-central" package_version="0.1a1" locale="es_GT" charset="ISO-8859-1"> + + <msg key="action_not">Accion no permitida</msg> + <msg key="add">Agregar Hijo</msg> + <msg key="add_an_existent">Agregar un objeto de aprendizaje existente</msg> + <msg key="add_file">Agregar Archivo</msg> + <msg key="add_from_clip">Agregar desde el Sujetapapeles:</msg> + <msg key="add_object">Agregar Objeto</msg> + <msg key="add_this">Agregar este Objeto</msg> + <msg key="Add_this_learn">Agregar este objeto de aprendizaje al sujetapapeles</msg> + <msg key="Add_to_clip">Agregar al sujetapapeles</msg> + <msg key="add_to_course">Agregar a este curso</msg> + <msg key="add_to_resource">Agregar a este recurso</msg> + <msg key="All_views">Todas las vistas</msg> + <msg key="All_views_of">Todas las vistas de este objeto</msg> + <msg key="and_is_in">Y esta siendo utilizado en los siguientes cursos</msg> + <msg key="assoc">Asociaciones:</msg> + <msg key="associate">Asociar</msg> + <msg key="associate_drop">Asociar/Quitar</msg> + <msg key="associate_to">Asociar a una clase de dotLRN</msg> + <msg key="associate_to_class">Asociar a esta clase</msg> + <msg key="associated">Already Asociado</msg> + <msg key="author">Autor:</msg> + <msg key="choose_the_file">Escoja el archivo que desea subir</msg> + <msg key="class_name">Nombre de la Clase</msg> + <msg key="Classes_using">Clases que utilizan este curso</msg> + <msg key="click_for_prev">Click para previsualizar</msg> + <msg key="clip_this_res">Sujetar este Recurso</msg> + <msg key="course_name">Nombre del Curso</msg> + <msg key="course_versions">Versiones del Curso</msg> + <msg key="courses">Cursos</msg> + <msg key="create_your_new">Crear el nuevo archivo</msg> + <msg key="current">Actual</msg> + <msg key="dep_name">Nombre del Departamento</msg> + <msg key="description">Descripcion</msg> + <msg key="disabled">Deshabilitado</msg> + <msg key="dotlrn_classes">classes de dotLRN</msg> + <msg key="drop">Quitar</msg> + <msg key="drop_association">Quitar la asociacion de esta clase</msg> + <msg key="Edit">Editar</msg> + <msg key="edit_object">Editar %name%</msg> + <msg key="enabled">Habilitado</msg> + <msg key="everywhere">En todos lados</msg> + <msg key="filename">Nombre del archivo</msg> + <msg key="help_text">Utilizar el boton de "Browse..." para localizar el archivo, luego presionar"Open"</msg> + <msg key="here">Aqui</msg> + <msg key="hide">Ocultar</msg> + <msg key="item_files">Archivos del Objeto</msg> + <msg key="item_name">Nombre del Item:</msg> + <msg key="item_title">Titulo del Item</msg> + <msg key="label_title">Marcar/Desmarcar todas las filas</msg> + <msg key="last_modified">Ultima Modificacion</msg> + <msg key="live">Actual</msg> + <msg key="live_classes">Clases donde es el actual?</msg> + <msg key="lo_files">Archivos del Objeto de Aprendizaje</msg> + <msg key="make">Hacer</msg> + <msg key="make_live">Cambiar a actual en todas las clases</msg> + <msg key="make_this_live">Poner actual en esta clase</msg> + <msg key="man_id">ID del Manifesto</msg> + <msg key="new_file">Agregar Nuevo Archivo</msg> + <msg key="new_object">Nuevo Objeto de Aprendisaje</msg> + <msg key="no">No</msg> + <msg key="of">de</msg> + <msg key="of_title">de %name%</msg> + <msg key="one_course">Un Curso</msg> + <msg key="one_course_assoc">Asociaciones de un Curso</msg> + <msg key="one_course_views">Visitas al Curso</msg> + <msg key="one_file">Un Archivo</msg> + <msg key="One_learning">Un Objeto de Aprendizaje</msg> + <msg key="please_type">Por favor ingrese una palabra</msg> + <msg key="preview">Previsualizacion</msg> + <msg key="search">Buscar</msg> + <msg key="search_courses">Buscar Cursos</msg> + <msg key="set_to">Establecer a</msg + <msg key="shared">Compartido?</msg> + <msg key="shared_items">Objetos Compartidos en el repositorio</msg>> + <msg key="subject_name">Nombre de la Materia</msg> + <msg key="term_name">Nombre del Periodo</msg> + <msg key="there_are_no">No existen artivulos en este Sujetapapeles.</msg> + <msg key="This_course_is">Este curso es utilizado en las siguientes clases de dotLRN:</msg> + <msg key="this_file">Este Archivo</msg> + <msg key="this_file_has">Este archivo posee las siguientes versionies</msg> + <msg key="this_file_is">Este archivo ya existe en este recurso. No es permitido agregar el mismo archivo al mismo recurso mas de una vez.</msg> + <msg key="this_is_a">Este es un archivo zip conteniendo multiples archivos.</msg> + <msg key="This_learning_obj">Este objeto de aprendizaje es utilizado en los siguientes cursos:</msg> + <msg key="this_lo_uses">Estos archivos son utilizados en este Objeto de Aprendizaje</msg> + <msg key="title">Marcar/Desmarcar esta fila, seleccionar una accion a realizar</msg> + <msg key="tracking">Seguimiento</msg> + <msg key="type">Tipo</msg> + <msg key="update_course_ver">Actualizar versiones del curso en las clases</msg> + <msg key="update_versions">Actualizar Versiones</msg> + <msg key="upload_a_new">Subir un Nuevo Archivo o....</msg> + <msg key="Usage">Utilizacion</msg> + <msg key="version">Version</msg> + <msg key="version_number">Ver. #</msg> + <msg key="versions">Versiones</msg> + <msg key="view">Observar</msg> + <msg key="view_all">Obsercar Todas</msg> + <msg key="view_all_exist">Observar todos los sujetapapeles existentesx</msg> + <msg key="views">Vistas</msg> + <msg key="views_in">Vistas en esta clase</msg> + <msg key="watch_assoc">Asociaciones de un curso a una clase de dotLRN</msg> + <msg key="we_are_sorry">Lo sentimos, parece que no posee los permisos necesarios para administar el paquete de lors-central.</msg> + <msg key="yes">Si</msg> + <msg key="you_have_to"><b>Se debe asociar este curso a una clase antes de poder manejar el Seguimiento del mismo</b></msg> + <msg key="zip_file">Archivo Zip</msg> +</message_catalog> Index: openacs-4/packages/lors-central/catalog/lors-central.es_GT.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/catalog/lors-central.es_GT.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/catalog/lors-central.es_GT.ISO-8859-1.xml 17 May 2005 16:21:16 -0000 1.1 @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<message_catalog package_key="lors-central" package_version="0.1a1" locale="es_GT" charset="ISO-8859-1"> + + <msg key="action_not">Accion no permitida</msg> + <msg key="add">Agregar Hijo</msg> + <msg key="add_an_existent">Agregar un objeto de aprendizaje existente</msg> + <msg key="add_file">Agregar Archivo</msg> + <msg key="add_from_clip">Agregar desde el Sujetapapeles:</msg> + <msg key="add_object">Agregar Objeto</msg> + <msg key="add_this">Agregar este Objeto</msg> + <msg key="Add_this_learn">Agregar este objeto de aprendizaje al sujetapapeles</msg> + <msg key="Add_to_clip">Agregar al sujetapapeles</msg> + <msg key="add_to_course">Agregar a este curso</msg> + <msg key="add_to_resource">Agregar a este recurso</msg> + <msg key="All_views">Todas las vistas</msg> + <msg key="All_views_of">Todas las vistas de este objeto</msg> + <msg key="and_is_in">Y esta siendo utilizado en los siguientes cursos</msg> + <msg key="assoc">Asociaciones:</msg> + <msg key="associate">Asociar</msg> + <msg key="associate_drop">Asociar/Quitar</msg> + <msg key="associate_to">Asociar a una clase de dotLRN</msg> + <msg key="associate_to_class">Asociar a esta clase</msg> + <msg key="associated">Already Asociado</msg> + <msg key="author">Autor:</msg> + <msg key="choose_the_file">Escoja el archivo que desea subir</msg> + <msg key="class_name">Nombre de la Clase</msg> + <msg key="Classes_using">Clases que utilizan este curso</msg> + <msg key="click_for_prev">Click para previsualizar</msg> + <msg key="clip_this_res">Sujetar este Recurso</msg> + <msg key="course_name">Nombre del Curso</msg> + <msg key="course_versions">Versiones del Curso</msg> + <msg key="courses">Cursos</msg> + <msg key="create_your_new">Crear el nuevo archivo</msg> + <msg key="current">Actual</msg> + <msg key="dep_name">Nombre del Departamento</msg> + <msg key="description">Descripcion</msg> + <msg key="disabled">Deshabilitado</msg> + <msg key="dotlrn_classes">classes de dotLRN</msg> + <msg key="drop">Quitar</msg> + <msg key="drop_association">Quitar la asociacion de esta clase</msg> + <msg key="Edit">Editar</msg> + <msg key="edit_object">Editar %name%</msg> + <msg key="enabled">Habilitado</msg> + <msg key="everywhere">En todos lados</msg> + <msg key="filename">Nombre del archivo</msg> + <msg key="help_text">Utilizar el boton de "Browse..." para localizar el archivo, luego presionar"Open"</msg> + <msg key="here">Aqui</msg> + <msg key="hide">Ocultar</msg> + <msg key="item_files">Archivos del Objeto</msg> + <msg key="item_name">Nombre del Item:</msg> + <msg key="item_title">Titulo del Item</msg> + <msg key="label_title">Marcar/Desmarcar todas las filas</msg> + <msg key="last_modified">Ultima Modificacion</msg> + <msg key="live">Actual</msg> + <msg key="live_classes">Clases donde es el actual?</msg> + <msg key="lo_files">Archivos del Objeto de Aprendizaje</msg> + <msg key="make">Hacer</msg> + <msg key="make_live">Cambiar a actual en todas las clases</msg> + <msg key="make_this_live">Poner actual en esta clase</msg> + <msg key="man_id">ID del Manifesto</msg> + <msg key="new_file">Agregar Nuevo Archivo</msg> + <msg key="new_object">Nuevo Objeto de Aprendisaje</msg> + <msg key="no">No</msg> + <msg key="of">de</msg> + <msg key="of_title">de %name%</msg> + <msg key="one_course">Un Curso</msg> + <msg key="one_course_assoc">Asociaciones de un Curso</msg> + <msg key="one_course_views">Visitas al Curso</msg> + <msg key="one_file">Un Archivo</msg> + <msg key="One_learning">Un Objeto de Aprendizaje</msg> + <msg key="please_type">Por favor ingrese una palabra</msg> + <msg key="preview">Previsualizacion</msg> + <msg key="search">Buscar</msg> + <msg key="search_courses">Buscar Cursos</msg> + <msg key="set_to">Establecer a</msg + <msg key="shared">Compartido?</msg> + <msg key="shared_items">Objetos Compartidos en el repositorio</msg>> + <msg key="subject_name">Nombre de la Materia</msg> + <msg key="term_name">Nombre del Periodo</msg> + <msg key="there_are_no">No existen artivulos en este Sujetapapeles.</msg> + <msg key="This_course_is">Este curso es utilizado en las siguientes clases de dotLRN:</msg> + <msg key="this_file">Este Archivo</msg> + <msg key="this_file_has">Este archivo posee las siguientes versionies</msg> + <msg key="this_file_is">Este archivo ya existe en este recurso. No es permitido agregar el mismo archivo al mismo recurso mas de una vez.</msg> + <msg key="this_is_a">Este es un archivo zip conteniendo multiples archivos.</msg> + <msg key="This_learning_obj">Este objeto de aprendizaje es utilizado en los siguientes cursos:</msg> + <msg key="this_lo_uses">Estos archivos son utilizados en este Objeto de Aprendizaje</msg> + <msg key="title">Marcar/Desmarcar esta fila, seleccionar una accion a realizar</msg> + <msg key="tracking">Seguimiento</msg> + <msg key="type">Tipo</msg> + <msg key="update_course_ver">Actualizar versiones del curso en las clases</msg> + <msg key="update_versions">Actualizar Versiones</msg> + <msg key="upload_a_new">Subir un Nuevo Archivo o....</msg> + <msg key="Usage">Utilizacion</msg> + <msg key="version">Version</msg> + <msg key="version_number">Ver. #</msg> + <msg key="versions">Versiones</msg> + <msg key="view">Observar</msg> + <msg key="view_all">Obsercar Todas</msg> + <msg key="view_all_exist">Observar todos los sujetapapeles existentesx</msg> + <msg key="views">Vistas</msg> + <msg key="views_in">Vistas en esta clase</msg> + <msg key="watch_assoc">Asociaciones de un curso a una clase de dotLRN</msg> + <msg key="we_are_sorry">Lo sentimos, parece que no posee los permisos necesarios para administar el paquete de lors-central.</msg> + <msg key="yes">Si</msg> + <msg key="you_have_to"><b>Se debe asociar este curso a una clase antes de poder manejar el Seguimiento del mismo</b></msg> + <msg key="zip_file">Archivo Zip</msg> +</message_catalog> Index: openacs-4/packages/lors-central/lib/clipboard.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/clipboard.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/clipboard.adp 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,62 @@ +<if @clipboards:rowcount@ eq 1 and @this_item_clipped:rowcount@ eq 0 > + <multiple name="clipboards"> + <if @displayed_object_id@ not nil> + <a href="@url@clipboards/attach?object_id=@displayed_object_id@&clipboard_id=@clipboards.clipboard_id@">Clip this item + </a> + </if> + </multiple> +</if> +<else> + <if @displayed_object_id@ not nil> + This item is in the clipboard + </if> +</else> + +<if @clipboards:rowcount@ gt 1> + <p>Clip this item to</p> + <form style="display: inline;" action="@url@clipboards/attach"> + <input type="hidden" name="object_id" value="@displayed_object_id@"></input> + <select name="clipboard_id"> + <multiple name="clipboards"> + <option value="@clipboards.clipboard_id@" @clipboards.selected@>@clipboards.title@</option> + </multiple> + </select> + <input type="submit" value="Go"></input> + </form> +</if> + +<if @items:rowcount@ gt 0> + <p>Items in this clipboard:</p> + <if @type@ eq "file"> + <listtemplate name="file_items"></listtemplate> + </if> + <else> + <ul> + <multiple name="items"> + <li style="padding: 4px;"> + <a href="/o/@items.object_id@">@items.item_title@</a> + <if @items.pretty_mime_type@ eq ""> + [@items.object_type@], clipped @items.clipped@ + </if> + <else> + [@items.object_type@ "<i>@items.pretty_mime_type@</i>"], clipped @items.clipped@ + </else> + <if @action_url@ not nil> + <a href="@action_url;noquote@&clipboard_object_id=@items.object_id@" class="button">@action_label@</a> + </if> + <a href="/clipboard/remove?clipboard_id=@clipboard_id@&object_id=@items.object_id@" class="button">remove</a></li> + </multiple> + </ul> + </else> +</if> +<else> + <p>#lors-central.there_are_no#</p> +</else> + + +<if @clipboards:rowcount@ gt 0> + <p><a href="@url@clipboard/" class="button" title="#lors-central.view_all_exist#">#lors-central.view_all#</a></p> +</if> + +</div> + Index: openacs-4/packages/lors-central/lib/clipboard.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/clipboard.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/clipboard.tcl 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,88 @@ +# lors-central specific clipboard +if {![info exists displayed_object_id]} { + set displayed_object_id "" +} + +# The type var indicates if the items we want to show are files +# or resources +if { ![empty_string_p $type] } { + if { [string equal $type "file"] } { + set extra_query "and t.pretty_name = 'Basic Item'" + template::list::create \ + -name file_items \ + -multirow items \ + -key object_id \ + -bulk_actions { + "\#lors-central.add_to_resource\#" new-clipboard-files "\#lors-central.add_to_resource\#" + } \ + -bulk_action_method post \ + -bulk_action_export_vars { + man_id + ims_item_id + name + } \ + -row_pretty_plural "\#lors-central.clip_files\#" \ + -elements { + object_id { + label "\#lors-central.item_files\#:" + display_template { + <a href="/o/@items.object_id@">@items.item_title@</a> + } + } + object_name { + label "\#lors-central.filename\#:" + display_template { + @items.object_name@ + } + } + object_type { + label "\#lors-central.type\#:" + display_template { + @items.object_type@ + } + } + mime_type { + label "\#lors-central.mime_type\#:" + display_template { + <i>@items.pretty_mime_type@</i> + } + } + clipped { + label "\#lors-central.clipped\#:" + display_template { + @items.clipped@ + } + } + } + + } else { + set extra_query "and t.pretty_name = 'IMS Resource Object'" + } +} else { + set extra_query "" +} + +set user_id [ad_conn user_id] +set lors_central_package_id [ad_conn package_id] + +# find if there is a lors-central clipboard +set clipboard_id [db_string get_cb_id { } -default ""] +if { [empty_string_p $clipboard_id] } { + # Create the clipboard_id + set clipboard_id [clipboard::new -owner_id $user_id -title "Lors Central" \ + -package_id $lors_central_package_id -creation_user_id $user_id] + +} +clipboard::clipboards $user_id clipboards +clipboard::clipped $displayed_object_id $user_id this_item_clipped + + +# TODO: Yuck! should fix this query. maybe stick it in an object_type view which restricts to clipable things. +db_multirow -extend {clipped object_name} items get_items { } { + set clipped [util::age_pretty -timestamp_ansi $clipped_ansi -sysdate_ansi [clock_to_ansi [clock seconds]]] + set object_name [db_string get_object_name { } -default ""] +} + +set url "/" + +ad_return_template \ No newline at end of file Index: openacs-4/packages/lors-central/lib/clipboard.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/clipboard.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/clipboard.xql 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,64 @@ +<?xml version="1.0"?> + +<queryset> + +<fullquery name="get_cb_id"> + <querytext> + select object_id + from acs_objects + where package_id= :lors_central_package_id + and object_type='clipboard' + </querytext> +</fullquery> + +<fullquery name="get_items"> + <querytext> + SELECT + o.object_id, + t.pretty_name as object_type, + coalesce(o.title,'object '||o.object_id) as item_title, + to_char(m.clipped_on,'YYYY-MM-DD HH24:MI:SS') as clipped_ansi, + coalesce((select + label + from + cr_revisions, + cr_items, + cr_mime_types + where + live_revision=revision_id + and cr_revisions.revision_id = o.object_id + and cr_revisions.mime_type = cr_mime_types.mime_type),'') as pretty_mime_type + FROM + clipboard_object_map m, + acs_objects o, + acs_object_types t + WHERE + clipboard_id = :clipboard_id + $extra_query + and o.object_id = m.object_id + and t.object_type = ( case when o.object_type = 'content_item' then ( + select + case when i.content_type = 'content_extlink' then + 'content_extlink' + else r.object_type + end + from + acs_objects r, + cr_items i + where + r.object_id = coalesce( i.live_revision, i.latest_revision, i.item_id) + and i.item_id = o.object_id) else o.object_type + end ) + </querytext> +</fullquery> + +<fullquery name="get_object_name"> + <querytext> + select distinct filename + from ims_cp_files + where file_id = :object_id + </querytext> +</fullquery> + + +</queryset> Index: openacs-4/packages/lors-central/lib/content-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/content-edit-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/content-edit-postgresql.xql 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,48 @@ +<?xml version="1.0"?> + +<queryset> + + <rdbms> + <type>postgresql</type> + <version>7.2</version> + </rdbms> + + <fullquery name="lob_content"> + <querytext> + + update cr_revisions + set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] + where revision_id = :revision_id + + </querytext> + </fullquery> + + <fullquery name="lob_size"> + <querytext> + + update cr_revisions + set content_length = lob_length(lob) + where revision_id = :revision_id + + </querytext> + </fullquery> + + <fullquery name="new_version"> + <querytext> + + select file_storage__new_version(:title,:description,:mime_type,:file_id,:creation_user,:creation_ip); + + </querytext> + </fullquery> + + <fullquery name="update_revision_data"> + <querytext> + + update cr_revisions + set content = '$tmp_filename', + content_length = $tmp_size + where revision_id = :revision_id + + </querytext> + </fullquery> +</queryset> Index: openacs-4/packages/lors-central/lib/content-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/content-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/content-edit.adp 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,4 @@ +<if @edit_p@ eq 1> + <formtemplate id="file_form"></formtemplate> +</if> +<if @content_body@ defined>@content_body@</if> \ No newline at end of file Index: openacs-4/packages/lors-central/lib/content-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/content-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/content-edit.tcl 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,113 @@ +ad_page_contract { + Edit ims_cp_file content and create a new revision + @param file_id + @param res_id ? + @param man_id ? +} { +} + +set user_id [ad_conn user_id] + +foreach required_param {file_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} + +foreach optional_param {return_url submission_p} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +if {[empty_string_p $return_url]} { + set return_url [export_vars -base "one-learning-object" {man_id ims_item_id}] +} + +set file_item_id [lors_central::get_item_id -revision_id $file_id] +if {![lors_central::item_editable_p -item_id $file_item_id]} { + set edit_p 0 +} else { + set edit_p 1 +} + +array set fs_object_info [lors_central::get_object_info -file_id $file_id] + +if {[empty_string_p $submission_p]} { + if {[string equal $fs_object_info(mime_type) "text/html"]} { + set htmlarea_p 1 + } else { + set htmlarea_p 0 + } +} + +ad_form \ + -name file_form \ + -export {res_id man_id file_id return_url} \ + -form { + {title:text(inform) {label "Title"}} + {version_notes:text(inform) {label "Current Version Notes"}} + {description:text(text),optional {label "Version Notes"}} + {content:richtext(richtext),optional {label "Content"} {html {rows 20 cols 60}} {htmlarea_p 1}} + {submission_p:text(hidden) {value 1}} + } \ + -on_request { + set title $fs_object_info(name) + set version_notes $fs_object_info(version_notes) + # Extract only the HTML body + regexp -nocase {<\s*?body[^>]*?>(.*)</\s*?body\s*?>} $fs_object_info(content) match fs_object_info(content) + set content [list [string trim $fs_object_info(content)] $fs_object_info(mime_type)] + set return_url $return_url + } -on_submit { + set content_body [template::util::richtext::get_property contents $content] + # Rebuild HTML if necessary + if { [regexp -nocase {^(.*<\s*?body[^>]*?>).*(</\s*?body\s*?>.*)$} $fs_object_info(content) match header footer] } { + set content_body "${header}${content_body}${footer}" + } + + foreach {link id} [regexp -inline -all {<a href="\.\./o/(\d+?)">.*?</a>} $content_body] { + # ns_log notice "DAVEB link '${link}' id '${id}" + # find out if its an image + + if {[db_0or1row mime "select mime_type as this_mime_type, title as this_title from cr_revisions, cr_items where cr_items.item_id=:id and revision_id=live_revision"]} { + # ns_log notice "DAVEB mime_type '${this_mime_type}'" + if {[string match "image/*" $this_mime_type]} { + + regsub -all $link $content_body "<img src=\"images/${this_title}\" />" content_body + } else { + # FIXME for now just throw away non image links until we can do something intelligent with them! + regsub -all $link $content_body {} content_body + } + } + + } + + set mime_type [template::util::richtext::get_property format $content] + set file_item_id [lors_central::get_item_id -revision_id $file_id] + # this is 99% the same as new-file, it _is_ a new file except its not uploaded + set new_res_id [lors_central::add_resource_revision \ + -res_id $res_id \ + -name $title \ + -user_id [ad_conn user_id] \ + -man_id $man_id] + set new_file_id [lors_central::add_file_revision \ + -file_content $content_body \ + -mime_type $mime_type \ + -name $title \ + -title $title \ + -res_id $new_res_id \ + -man_id $man_id \ + -item_id $file_item_id] + + set exclude [db_list get_exclude "select revision_id from cr_revisions where item_id=:file_item_id"] + + lors_central::resource_carry_forward_files -old_res_id $res_id -new_res_id $new_res_id -exclude $exclude + lors_central::res_update_items \ + -old_res_id $res_id \ + -new_res_id $new_res_id \ + -user_id [ad_conn user_id] + + } -after_submit { + + ad_returnredirect $return_url + } Index: openacs-4/packages/lors-central/lib/item-files.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/item-files.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/item-files.adp 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,2 @@ +<h3>#lors-central.this_lo_uses#</h3> +<listtemplate name="files"></listtemplate> \ No newline at end of file Index: openacs-4/packages/lors-central/lib/item-files.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/item-files.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/item-files.tcl 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,66 @@ +ad_page_contract { + List files used in this object + @param res_id + @param ims_item_id +} + +if {![exists_and_not_null res_id]} { + set res_id [lors_central::get_item_res_id -ims_item_id $ims_item_id] +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set clipboard_id [db_string get_cb_id { } -default ""] +if { [empty_string_p $clipboard_id] } { + # Create the clipboard_id + set clipboard_id [clipboard::new -owner_id $user_id -title "Lors Central" \ + -package_id $package_id -creation_user_id $user_id] + +} +db_multirow -extend {edit edit_url clip clip_url count one_file_url main_file} files get_files2 { } { + set edit "Edit" + set edit_url [export_vars -base one-object-edit {res_id}] + set clip "Clip" + set clip_url [export_vars -base "/clipboard/attach" {{object_id $file_id} clipboard_id}] + set file_item_id [db_string get_file_item_id { } -default 0] + set count [db_string get_revision_count { } -default 0] + set one_file_url [export_vars -base one-file {file_id res_id}] + if {$main_file_p} { + set main_file "Main File" + } else { + set main_file "" + } +} + +# To action buttons one for adding a new file to this resource +# and the second one to clip all the resource ( all files ) +set actions_list [list \ + [_ lors-central.add_file] [export_vars -base "new-file" {res_id}] \ + [_ lors-central.add_file] \ + [_ lors-central.clip_this_res] \ + [export_vars -base "/clipboard/attach" {{object_id $res_id} clipboard_id}] \ + [_ lors-central.clip_this_res]] + +template::list::create \ + -name files \ + -multirow files \ + -actions $actions_list \ + -elements { + title { + label "Title" + display_template { + <a href=@files.one_file_url@ title="[_ lors-central.Edit] [_ lors-central.this_file]"><img border=0 src=/resources/Edit16.gif></a> + + <a href="@files.one_file_url@" title="[_ lors-central.view] [_ lors-central.this_file] [_ lors-central.description]">@files.title@</a> + } + } + rev_count { + label "[_ lors-central.versions]" + display_template { + <center>@files.count@</center> + } + } + mime_type_pretty {label "Type"} + main_file {label ""} + clip {label "" link_url_col {clip_url}} + } \ No newline at end of file Index: openacs-4/packages/lors-central/lib/item-files.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lib/item-files.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/lib/item-files.xql 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,95 @@ +<?xml version="1.0"?> + +<queryset> + + <fullquery name="get_cb_id"> + <querytext> + select object_id + from acs_objects + where package_id = :package_id and object_type='clipboard' + </querytext> + </fullquery> + + <fullquery name="get_files"> + <querytext> + select + 'Edit' as edit, + r.res_id, + r.file_id, + r.item_id, + r.revision_id, + r.filename, + r.pathtofile, + r.title, + r.mime_type, + r.label as mime_type_pretty + from + ims_cp_items_to_resources itr left join + ( select + f.res_id, + f.file_id, + ci.item_id, + cr.revision_id, + f.filename, + f.pathtofile, + cr.title, + cr.mime_type, + cm.label + from + ims_cp_files f, + cr_items ci, + cr_revisions cr, + cr_mime_types cm + where + ci.item_id = ( select item_id from cr_revisions where revision_id = f.file_id) + and cr.revision_id = ci.live_revision + and cr.mime_type = cm.mime_type ) r + on r.res_id = itr.res_id + where itr.ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_files2"> + <querytext> + select + i.file_id, + i.res_id, + i.pathtofile, + i.filename, + i.hasmetadata, + cr.title, + crm.label as mime_type_pretty, + case when i.pathtofile = + (select href from ims_cp_resources where res_id=:res_id) + then 1 else 0 end as main_file_p + from + ims_cp_files i, + cr_mime_types crm, + cr_revisions cr + where i.res_id = :res_id + and crm.mime_type = ( select mime_type + from cr_revisions + where revision_id = i.file_id) + and cr.revision_id = i.file_id + + </querytext> + </fullquery> + + <fullquery name="get_file_item_id"> + <querytext> + select item_id + from cr_revisions + where revision_id = :file_id + </querytext> + </fullquery> + + <fullquery name="get_revision_count"> + <querytext> + select count(revision_id) + from cr_revisions + where item_id = :file_item_id + </querytext> + </fullquery> + + +</queryset> Index: openacs-4/packages/lors-central/sql/postgresql/lors-central-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/sql/postgresql/lors-central-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/sql/postgresql/lors-central-create.sql 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,22 @@ +ALTER TABLE ims_cp_manifest_class DROP CONSTRAINT ims_cp_manifest_class_pkey; +ALTER TABLE ims_cp_items ADD sort_order integer; +ALTER TABLE ims_cp_files DROP CONSTRAINT ims_cp_files_file_if_fk; +ALTER TABLE ims_cp_files ADD CONSTRAINT ims_cp_files_file_if_fk FOREIGN KEY (file_id) REFERENCES cr_revisions(revision_id) ON DELETE CASCADE; + +create table ims_cp_items_map ( + man_id int + constraint ims_cp_items_map_man_id_fk references ims_cp_manifests (man_id), + org_id int + constraint ims_cp_items_map_org_id_fk references ims_cp_organizations (org_id), + community_id int + constraint ims_cp_items_map_com_id_fk references dotlrn_communities_all(community_id), + hide_p boolean default 'f', + ims_item_id int + constraint ims_cp_items_map_ims_item_id_fk references ims_cp_items (ims_item_id), + constraint ims_cp_items_map_pk primary key (ims_item_id,community_id,man_id) + +); + + + +\i lors-central-imscp-package-create.sql \ No newline at end of file Index: openacs-4/packages/lors-central/sql/postgresql/lors-central-imscp-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/sql/postgresql/lors-central-imscp-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/sql/postgresql/lors-central-imscp-package-create.sql 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,59 @@ +-- + +-- And + +-- SCORM 1.2 Specs + +create or replace function ims_manifest_admin__new ( + varchar, -- course_name + varchar, -- identifier + varchar, -- version + varchar, -- orgs_default + boolean, -- hasmetadata + integer, -- parent_man_id + boolean, -- isscorm + integer, -- folder_id + timestamp with time zone, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + integer, -- package_id + integer, -- new revision_id for the item in the CR + boolean, -- is shared + integer -- course_presentation_format +) +returns integer as ' +declare + p_course_name alias for $1; + p_identifier alias for $2; + p_version alias for $3; + p_orgs_default alias for $4; + p_hasmetadata alias for $5; + p_parent_man_id alias for $6; + p_isscorm alias for $7; + p_folder_id alias for $8; + p_creation_date alias for $9; + p_creation_user alias for $10; + p_creation_ip alias for $11; + p_package_id alias for $12; + p_revision_id alias for $13; + p_isshared alias for $14; + p_course_presentation_format alias for $15; +begin + + -- we make an update here because the content::item::new already inserts a row in the ims_cp_manifests + update ims_cp_manifests + set course_name=p_course_name, identifier=p_identifier, version=p_version, + orgs_default=p_orgs_default, hasmetadata=p_hasmetadata, parent_man_id=p_parent_man_id, + isscorm=p_isscorm, folder_id=p_folder_id, isshared = p_isshared, + course_presentation_format=p_course_presentation_format + where man_id = p_revision_id; + + insert into ims_cp_manifest_class + (man_id, lorsm_instance_id, isenabled, istrackable) + values + (p_revision_id, p_package_id, ''t'', ''f''); + + return p_revision_id; +end; +' language 'plpgsql'; + Index: openacs-4/packages/lors-central/sql/postgresql/upgrade/lors-central-0.1a1-0.1a2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/sql/postgresql/upgrade/lors-central-0.1a1-0.1a2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/sql/postgresql/upgrade/lors-central-0.1a1-0.1a2.sql 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,9 @@ +ALTER TABLE ims_cp_files DROP CONSTRAINT ims_cp_files_file_if_fk; + +UPDATE ims_cp_files +SET file_id = ( + select live_revision + from cr_items + where item_id = file_id ); + +ALTER TABLE ims_cp_files ADD CONSTRAINT ims_cp_files_file_if_fk FOREIGN KEY (file_id) REFERENCES cr_revisions(revision_id) ON DELETE CASCADE; \ No newline at end of file Index: openacs-4/packages/lors-central/sql/postgresql/upgrade/lors-central-03042005.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/sql/postgresql/upgrade/lors-central-03042005.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/sql/postgresql/upgrade/lors-central-03042005.sql 17 May 2005 16:21:17 -0000 1.1 @@ -0,0 +1,3 @@ +ALTER TABLE ims_cp_items_map ADD hide_p boolean; +ALTER TABLE ims_cp_items_map ALTER hide_p SET default 'f'; + Index: openacs-4/packages/lors-central/tcl/apm-callbacks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/apm-callbacks-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/apm-callbacks-procs.tcl 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,90 @@ +ad_library { + + Procedures to do a new impl and aliases in the acs-sc. + @autor Miguel Marin (miguelmarin@viaro.net) +} + +namespace eval lors_central::apm_callback {} + +ad_proc -private lors_central::apm_callback::package_install { +} { + Does the integration whith the notifications package. +} { + db_transaction { + + # Create the impl and aliases + set impl_id [create_lors_central_impl] + + # Create the notification type + set type_id [create_lors_central_type $impl_id] + + # Enable the delivery intervals and delivery methods + enable_intervals_and_methods $type_id + } +} + + +ad_proc -public lors_central::apm_callback::create_lors_central_impl {} { + Register the service contract implementation and return the impl_id + @return impl_id of the created implementation +} { + return [acs_sc::impl::new_from_spec -spec { + name one_lo_notif_type + contract_name NotificationType + owner "lors-central" + aliases { + GetURL lors_central::notification::get_url + ProcessReply lors_central::notification::process_reply + } + }] +} + +ad_proc -public lors_central::apm_callback::create_lors_central_type {impl_id} { + Create the notification type + @return the type_id of the created type +} { + return [notification::type::new \ + -sc_impl_id $impl_id \ + -short_name one_lo_notif \ + -pretty_name "One Learning Object Notification" \ + -description "Notification of a new Learning Object of one specific course"] +} + + +ad_proc -public lors_central::apm_callback::enable_intervals_and_methods {type_id} { + Enable the intervals and delivery methods of a specific type +} { + # Enable the various intervals and delivery method + notification::type::interval_enable \ + -type_id $type_id \ + -interval_id [notification::interval::get_id_from_name -name instant] + + notification::type::interval_enable \ + -type_id $type_id \ + -interval_id [notification::interval::get_id_from_name -name hourly] + + notification::type::interval_enable \ + -type_id $type_id \ + -interval_id [notification::interval::get_id_from_name -name daily] + + # Enable the delivery methods + notification::type::delivery_method_enable \ + -type_id $type_id \ + -delivery_method_id [notification::delivery::get_id -short_name email] +} + +ad_proc -public lors_central::apm_callback::after_upgrade { + -from_version_name:required + -to_version_name:required +} { + Makes the upgrade of lors-central package +} { + apm_upgrade_logic \ + -from_version_name $from_version_name \ + -to_version_name $to_version_name \ + -spec { + 0.1a2 0.1a3 { + lors_central::apm_callback::package_install + } + } +} \ No newline at end of file Index: openacs-4/packages/lors-central/tcl/lors-central-cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/lors-central-cr-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/lors-central-cr-procs.tcl 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,62 @@ +ad_library { + + @author Miguel Marin (miguelmarin@viaro.net) +} + +namespace eval lors_central::cr {} + +ad_proc -public lors_central::cr::add_files { + {-parent_id:required} + {-files:required} + {-indb_p:required} +} { + Adds a bunch of files to a folder in the CR + Returns a list with full_path_to_file, mime-type, parent_id, + file_id, version_id, cr_file, file size. + + @param parent_id Folder's parent_id where the files will be put + @param files All files for the parent_id folder come in one list + @param indb_p Whether this file-storage instance (we are about to use) stores files in the file system or in the db + +} { + + # Get the user + set user_id [ad_conn user_id] + + # Get the ip + set creation_ip [ad_conn peeraddr] + + set retlist [list] + foreach fle $files { + + regexp {[^//\\]+$} $fle filename + set title $filename + set mime_type [cr_filename_to_mime_type -create $fle] + + # insert file into the CR + db_transaction { + set description "uploaded using LORs" + + # add file + set file_id [content::item::new -name $title -parent_id $parent_id -creation_user $user_id \ + -creation_ip $creation_ip] + + + # add revision + set version_id [content::revision::new -title $title -description $description -mime_type $mime_type \ + -creation_user $user_id -creation_ip $creation_ip -item_id $file_id -is_live "t"] + + # move the actual file into the CR + set cr_file [cr_create_content_file $file_id $version_id $fle] + # get the size + set file_size [cr_file_size $cr_file] + + # update the file path in the CR and the size on cr_revisions + db_dml update_revi "update cr_revisions set content = '$cr_file', content_length = $file_size where revision_id = :version_id" + + } + + lappend retlist [list $fle $mime_type $parent_id $file_id $version_id $cr_file $file_size] + } + return $retlist +} Index: openacs-4/packages/lors-central/tcl/lors-central-export-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/lors-central-export-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/lors-central-export-procs-postgresql.xql 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,22 @@ +<?xml version="1.0"?> + +<queryset> + <rdbms><type>postgresql</type><version>7.1</version></rdbms> + + <fullquery name="lors_central::export::publish_versioned_object_to_file_system.select_object_content"> + <querytext> + select lob + from cr_revisions + where revision_id = $live_revision + </querytext> + </fullquery> + + <fullquery name="lors_central::export::publish_versioned_object_to_file_system.select_file_name"> + <querytext> + select content + from cr_revisions + where revision_id = :live_revision + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/tcl/lors-central-export-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/lors-central-export-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/lors-central-export-procs.tcl 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,260 @@ +ad_library { + + Tcl API for lors-central content export + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} + +namespace eval lors_central::export {} + +ad_proc -private lors_central::export::get_items_xml { + -org_id:required +} { + +} { + set items_count [db_string get_items_count { }] + set items_list [list] + set control_list [list] + db_foreach get_parent_items { } { + lappend items_list "$ims_item_id 1" + lappend control_list $ims_item_id + } + set i 0 + while { $i < $items_count } { + set i 0 + set aux_list $items_list + foreach item $aux_list { + incr i + set parent_item [lindex $item 0] + set parent_level [lindex $item 1] + db_foreach get_items { } { + if { [string equal [lsearch $control_list $ims_item_id] "-1"] } { + set items_list [linsert $items_list $i "$ims_item_id [expr $parent_level + 1]"] + lappend control_list $ims_item_id + incr i + } + } + } + } + return "$items_list" +} + + +ad_proc -private lors_central::export::publish_object_to_file_system { + -object_id:required + {-path ""} + {-user_id ""} + {-file_name ""} +} { + if {[empty_string_p $path]} { + set path [ns_tmpnam] + } + db_1row select_object_info { + select fs_objects.* + from fs_objects + where fs_objects.object_id = :object_id + } + + # We get rid of spaces since they are annoying + regsub -all { } $name {_} name + + if {[string equal folder $type]} { + set result [lors_central::export::publish_folder_to_file_system -folder_id $object_id -path $path -folder_name $name -user_id $user_id] + } elseif {[string equal url $type]} { + set result [lors_central::export::publish_url_to_file_system -object_id $object_id -path $path -file_name $file_name] + } else { + set result [lors_central::export::publish_versioned_object_to_file_system -object_id $object_id -path $path -file_name $file_name] + } + + return $result +} + +ad_proc -public lors_central::export::publish_folder_to_file_system { + {-folder_id:required} + {-path ""} + {-folder_name ""} + {-user_id ""} +} { + publish the contents of a file storage folder to the file system +} { + if {[empty_string_p $path]} { + set path [ns_tmpnam] + } + + if {[empty_string_p $folder_name]} { + set folder_name [get_object_name -object_id $folder_id] + } + set folder_name [remove_special_file_system_characters -string $folder_name] + + set dir [file join ${path} ${folder_name}] + file mkdir $dir + + foreach object [get_folder_contents -folder_id $folder_id -user_id $user_id] { + lors_central::export::publish_object_to_file_system \ + -object_id [ns_set get $object object_id] \ + -path $dir \ + -file_name [remove_special_file_system_characters -string [ns_set get $object name]] \ + -user_id $user_id + } + + return $dir +} + +ad_proc -public lors_central::export::publish_url_to_file_system { + {-object_id:required} + {-path ""} + {-file_name ""} +} { + publish a url object to the file system as a Windows shortcut + (which at least KDE also knows how to handle) +} { + if {[empty_string_p $path]} { + set path [ns_tmpnam] + file mkdir $path + } + + db_1row select_object_metadata {} + + if {[empty_string_p $file_name]} { + set file_name $label + } + set file_name "${file_name}.url" + set file_name [remove_special_file_system_characters -string $file_name] + + set fp [open [file join ${path} ${file_name}] w] + puts $fp {[InternetShortcut]} + puts $fp URL=$url + close $fp + + return [file join ${path} ${file_name}] +} + +ad_proc -public lors_central::export::publish_versioned_object_to_file_system { + {-object_id:required} + {-path ""} + {-file_name ""} +} { + publish an object to the file system +} { + if {[empty_string_p $path]} { + set path [ns_tmpnam] + file mkdir $path + } + + db_1row select_object_metadata {} + + if {[empty_string_p $file_name]} { + if {![info exists upload_file_name]} { + set file_name "unnamedfile" + } else { + set file_name $file_upload_name + } + } + set file_name [remove_special_file_system_characters -string $file_name] + + switch $storage_type { + lob { + + # FIXME: db_blob_get_file is failing when i use bind variables + + # DRB: you're out of luck - the driver doesn't support them and while it should + # be fixed it will be a long time before we'll want to require an updated + # driver. I'm substituting the Tcl variable value directly in the query due to + # this. It's safe because we've pulled the value ourselves from the database, + # don't need to worry about SQL smuggling etc. + + db_blob_get_file select_object_content {} -file [file join ${path} ${file_name}] + } + text { + set content [db_string select_object_content {}] + + set fp [open [file join ${path} ${file_name}] w] + puts $fp $content + close $fp + } + file { + set cr_path [cr_fs_path $storage_area_key] + set cr_file_name [db_string select_file_name {}] + + file copy -- "${cr_path}${cr_file_name}" [file join ${path} ${file_name}] + } + } + + return [file join ${path} ${file_name}] +} + +ad_proc -public lors_central::export::remove_special_file_system_characters { + {-string:required} +} { + remove unsafe file system characters. useful if you want to use $string + as the name of an object to write to disk. +} { + regsub -all {[<>:\"|/@\#%&+\\]} $string {_} string + return [string trim $string] +} + +ad_proc -public lors_central::export::get_folder_contents { + {-folder_id ""} + {-user_id ""} + {-n_past_days "99999"} +} { + Retrieve the contents of the specified folder in the form of a list + of ns_sets, one for each row returned. The keys for each row are as + follows: + + object_id, name, live_revision, type, + last_modified, new_p, content_size, file_upload_name + write_p, delete_p, admin_p, + + @param folder_id The folder for which to retrieve contents + @param user_id The viewer of the contents (to make sure they have + permission) + @param n_past_days Mark files that are newer than the past N days as new +} { + if {[empty_string_p $folder_id]} { + set folder_id [get_root_folder -package_id [ad_conn package_id]] + } + + if {[empty_string_p $user_id]} { + set user_id [acs_magic_object the_public] + } + + set list_of_ns_sets [db_list_of_ns_sets select_folder_contents {}] + + foreach set $list_of_ns_sets { + # in plain Tcl: + # set last_modified_ansi [lc_time_system_to_conn $last_modified_ansi] + ns_set put $set last_modified_ansi [lc_time_system_to_conn [ns_set get $set last_modifed_ansi]] + + # in plain Tcl: + # set last_modified [lc_time_fmt $last_modified_ansi "%x %X"] + ns_set put $set last_modified [lc_time_fmt [ns_set get $set last_modified_ansi] "%x %X"] + + # set content_size_pretty [lc_numeric $content_size] + ns_set put $set content_size_pretty [lc_numeric [ns_set get $set content_size]] + } + + return $list_of_ns_sets +} + +ad_proc -public lors_central::export::get_folder_contents_count { + {-folder_id ""} + {-user_id ""} +} { + Retrieve the count of contents of the specified folder. + + @param folder_id The folder for which to retrieve contents + @param user_id The viewer of the contents (to make sure they have + permission) +} { + if {[empty_string_p $folder_id]} { + set folder_id [get_root_folder -package_id [ad_conn package_id]] + } + + if {[empty_string_p $user_id]} { + set user_id [acs_magic_object the_public] + } + + return [db_string select_folder_contents_count {}] +} Index: openacs-4/packages/lors-central/tcl/lors-central-export-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/lors-central-export-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/lors-central-export-procs.xql 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,112 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="lors_central::export::get_items_xml.get_items_count"> + <querytext> + select + count(ims_item_id) + from + ims_cp_items + where + org_id = :org_id + and ims_item_id = ( + select + live_revision + from + cr_items + where + item_id = ( + select + item_id + from + cr_revisions + where + revision_id = ims_item_id + ) + ) + </querytext> +</fullquery> + +<fullquery name="lors_central::export::get_items_xml.get_parent_items"> + <querytext> + select + ims_item_id + from + ims_cp_items + where + parent_item = :org_id + and org_id = :org_id + order by sort_order + </querytext> +</fullquery> + +<fullquery name="lors_central::export::get_items_xml.get_items"> + <querytext> + select + ims_item_id, sort_order + from + ims_cp_items + where + parent_item = :parent_item + and org_id = :org_id + and ims_item_id = ( + select + live_revision + from + cr_items + where + item_id = ( + select + item_id + from + cr_revisions + where + revision_id = ims_item_id + ) + ) + order by sort_order + </querytext> +</fullquery> + + <fullquery name="lors_central::export::get_folder_contents_count.select_folder_contents_count"> + <querytext> + select count(*) + from fs_objects + where parent_id = :folder_id + </querytext> + </fullquery> + + <fullquery name="lors_central::export::get_folder_contents.select_folder_contents"> + <querytext> + + select cr_items.item_id as object_id, + cr_items.name + from cr_items + where cr_items.parent_id = :folder_id + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = cr_items.item_id + and m.party_id = :user_id + and m.privilege = 'read') + + </querytext> + </fullquery> + + <fullquery name="lors_central::export::publish_versioned_object_to_file_system.select_object_metadata"> + <querytext> + select fs_objects.*, + cr_items.storage_type, + cr_items.storage_area_key, + cr_revisions.title + from fs_objects, + cr_items, + cr_revisions + where fs_objects.object_id = :object_id + and fs_objects.object_id = cr_items.item_id + and fs_objects.live_revision = cr_revisions.revision_id + </querytext> + </fullquery> + + + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/tcl/lors-central-imscp-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/lors-central-imscp-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/lors-central-imscp-procs.tcl 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,523 @@ +ad_library { + IMS Content Packaging functions + +} + +namespace eval lors_central::imscp {} + +# IMS CP database transaction functions +ad_proc -public lors_central::imscp::manifest_add { + {-man_id ""} + {-identifier ""} + {-course_name ""} + {-version ""} + {-orgs_default {}} + {-hasmetadata ""} + {-parent_man_id ""} + {-isscorm ""} + {-folder_id ""} + {-package_id ""} + {-community_id ""} + {-user_id ""} + {-creation_ip ""} + {-version_id ""} + {-course_presentation_format "-1"} + -man_folder_id:required +} { + Inserts a new manifest according to the imsmanifest.xml file. + + @option man_id manifest id to be inserted. + @option course_name the actual name of the course (or resource). + @option identifier intrinsic manifest identifier. + @option version version. + @option orgs_default default organizations value. + @option hasmetadata whether the manifest has metadata (boolean). + @option parent_man_id parent manifest id (for manifest with submanifests). + @option isscorm wheather the manifest is SCORM compliant + @option folder_id the CR folder ID we created to put the manifest on. + @option package_id package_id for the instance of LORSm + @option community_id Community ID + @option user_id user that adds the category. [ad_conn user_id] used by default. + @option creation_ip ip-address of the user that adds the category. [ad_conn peeraddr] used by default. + @author Ernie Ghiglione (ErnieG@mm.st) +} { + # set utf-8 system encoding + encoding system utf-8 + + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + if {[empty_string_p $creation_ip]} { + set creation_ip [ad_conn peeraddr] + } + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + if {[empty_string_p $parent_man_id]} { + set parent_man_id 0 + } + if {[empty_string_p $isscorm]} { + set isscorm 0 + } + + if {[empty_string_p $community_id]} { + set community_id "" + } + + + ######################################################################################### + # Since now we dont use acs-objects for the manifest, then a new cr_item and revision + # needs to be done to store the manifest. The cr_item and cr_revision are created here + # in orther to use the CR API. + + # Get LORSM Manifest Folder folder_id + set parent_id $man_folder_id + set content_type "ims_manifest_object" + set name "$course_name" + if {[empty_string_p $version_id]} { + set item_id [content::item::new -name $name -item_id $man_id -content_type $content_type -parent_id $parent_id \ + -creation_date [dt_sysdate] -creation_user $user_id -creation_ip $creation_ip -context_id $package_id] + + # We give the user_id admin privilege over the item_id so only he/she can make changes to + # this course, unless it grants other user privileges + permission::grant -party_id $user_id -object_id $item_id -privilege admin + + # The new course has for default its isshared value false + set isshared f + + } else { + set item_id $version_id + set isshared [db_string get_isshared "select im.isshared from ims_cp_manifests im where im.man_id = ( + select live_revision from cr_items where item_id = :version_id + ) "] + } + + set revision_id [content::revision::new -title $name -content_type $content_type -creation_user $user_id \ + -creation_ip $creation_ip -item_id $item_id -is_live "t"] + + # Now the new revision_id will be sent to the sql function with the + # additional information as before + + db_transaction { + set manifest_id [db_exec_plsql new_manifest { + select ims_manifest_admin__new ( + :course_name, + :identifier, + :version, + :orgs_default, + :hasmetadata, + :parent_man_id, + :isscorm, + :parent_id, + current_timestamp, + :user_id, + :creation_ip, + :package_id, + :revision_id, + :isshared, + :course_presentation_format + ); + + }] + } + return $manifest_id +} + + +ad_proc -public lors_central::imscp::addItems { + -itm_folder_id:required + {-org_id:required} + {itemlist} + {parent ""} + {tmp_dir ""} +} { + Bulk addition of items. + Returns a list with the item_id and the identifierref of each item. + + @option org_id Organization Id that the item belongs to. + @option itemlist list of items to be uploaded + @option parent parent item node (items can have subitems). + @author Ernie Ghiglione (ErnieG@mm.st) + +} { + # set utf-8 system encoding + encoding system utf-8 + + set retlist "" + + foreach item $itemlist { + set p_org_id $org_id + set p_parent_item $parent + set p_identifier [lindex $item 1] + set p_identifierref [lindex $item 2] + set p_isvisible [lindex $item 3] + set p_parameters [lindex $item 4] + set p_title [lindex $item 5] + set p_hasmetadata [lindex $item 6] + set p_prerequisites [lindex $item 7] + set p_prerequisites_type [lindex $p_prerequisites 0] + set p_prerequisites_string [lindex $p_prerequisites 1] + set p_maxtimeallowed [lindex $item 8] + set p_timelimitaction [lindex $item 9] + set p_datafromlms [lindex $item 10] + set p_masteryscore [lindex $item 11] + set p_dotlrn_permission [lindex $item 12] + + if {$p_hasmetadata != 0} { + set md_node $p_hasmetadata + set p_hasmetadata 1 + } + + set item_id [lors_central::imscp::item_add \ + -org_id $p_org_id \ + -parent_item $p_parent_item \ + -identifier $p_identifier \ + -identifierref $p_identifierref \ + -isvisible $p_isvisible \ + -title $p_title \ + -hasmetadata $p_hasmetadata \ + -prerequisites_t $p_prerequisites_type \ + -prerequisites_s $p_prerequisites_string \ + -maxtimeallowed $p_maxtimeallowed \ + -timelimitaction $p_timelimitaction \ + -datafromlms $p_datafromlms \ + -masteryscore $p_masteryscore \ + -dotlrn_permission $p_dotlrn_permission \ + -itm_folder_id $itm_folder_id] + + if {$p_hasmetadata == 1} { + set aa [lors::imsmd::addMetadata \ + -acs_object $item_id \ + -node $md_node \ + -dir $tmp_dir] + } + + lappend retlist [list $item_id $p_identifierref] + + if { [llength $item] > 13} { + set subitem [lors_central::imscp::addItems -itm_folder_id $itm_folder_id \ + -org_id $p_org_id [lindex $item 13] $item_id $tmp_dir] + set retlist [concat $retlist $subitem] + } + } + return $retlist +} + +ad_proc -public lors_central::imscp::item_add { + {-item_id ""} + -org_id:required + {-identifier ""} + {-identifierref ""} + {-isvisible ""} + {-parameters ""} + {-title ""} + {-parent_item ""} + {-hasmetadata ""} + {-prerequisites_t ""} + {-prerequisites_s ""} + {-type ""} + {-maxtimeallowed ""} + {-timelimitaction ""} + {-datafromlms ""} + {-masteryscore ""} + {-dotlrn_permission ""} + {-package_id ""} + {-user_id ""} + {-creation_ip ""} + -itm_folder_id:required + +} { + Inserts a new item according to the info retrieved from the imsmanifest.xml file. + + @option item_id item id to be inserted. + @option org_id organization_id the item belogs to. + @option identifier intrinsic item identifier. + @option identifierref items indentifier reference (use to map with resources) + @option isvisible is the item visible?. + @option parameters items parameters + @option title items title. + @option parent_item for recursive items. Items can have subitems. + @option hasmetadata whether the item has metadata (boolean). + @option prerequisites_t items prerequisites type (SCORM extension). + @option prerequisites_s items prerequisites string (SCORM extension). + @option type items type (SCORM extension). + @option maxtimeallowed items maximum time allowed (SCORM extension). + @option timelimitaction items time limit action (SCORM extension). + @option datafromlms items data from LMS (SCORM extension). + @option masteryscore items mastery score (SCORM extension). + @option dotlrn_permission dotlrn extension to incoporate permissions. + @option package_id Package id. + @option user_id user that adds the category. [ad_conn user_id] used by default. + @option creation_ip ip-address of the user that adds the category. [ad_conn peeraddr] used by default. + @author Ernie Ghiglione (ErnieG@mm.st) +} { + # set utf-8 system encoding + encoding system utf-8 + + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + if {[empty_string_p $creation_ip]} { + set creation_ip [ad_conn peeraddr] + } + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + if {[empty_string_p $isvisible]} { + set isvisible 1 + } + if {$parent_item == 0} { + set parent_item $org_id + } + if {[empty_string_p $title]} { + set title "No Title" + } + + #--------------------------------------------------------------------------------------# + # Since now we dont use acs-objects for the item, then a new cr_item and revision + # needs to be done to store it. The cr_item and cr_revision are created here + # in orther to use the CR API. The item name probably has to change + + # Get LORSM Item Folder folder_id + set parent_id $itm_folder_id + set content_type "ims_item_object" + set sysdate [dt_sysdate] + set name "$identifier" + set cr_item_id [content::item::new -name $name -item_id $item_id -content_type $content_type -parent_id $parent_id \ + -creation_date [dt_sysdate] -creation_user $user_id -creation_ip $creation_ip \ + -context_id $package_id -description $title] + + + set revision_id [content::revision::new -title $name -content_type $content_type -creation_user $user_id \ + -creation_ip $creation_ip -item_id $cr_item_id -is_live "t"] + + db_transaction { + set item_id [db_exec_plsql new_item { + select ims_item__new ( + :item_id, + :org_id, + :identifier, + :identifierref, + :isvisible, + :parameters, + :title, + :parent_item, + :hasmetadata, + :prerequisites_t, + :prerequisites_s, + :type, + :maxtimeallowed, + :timelimitaction, + :datafromlms, + :masteryscore, + current_timestamp, + :user_id, + :creation_ip, + :package_id, + :revision_id + ); + + } + ] + + } + + if {![empty_string_p $dotlrn_permission]} { + + permission::toggle_inherit -object_id $item_id + + + set community_id [dotlrn_community::get_community_id] + + # Set read permissions for community/class dotlrn_admin_rel + + # set party_id_admin [db_string party_id {select segment_id from rel_segments \ + where group_id = :community_id \ + and rel_type = 'dotlrn_admin_rel'}] + + # permission::grant -party_id $party_id_admin -object_id $item_id -privilege read + + + # Set read permissions for *all* other professors within .LRN + # (so they can see the content) + + set party_id_professor [db_string party_id {select segment_id from rel_segments \ + where rel_type = 'dotlrn_professor_profile_rel'}] + + permission::grant -party_id $party_id_professor -object_id $item_id -privilege read + + # Set read permissions for *all* other admins within .LRN + # (so they can see the content) + + set party_id_admins [db_string party_id {select segment_id from rel_segments \ + where rel_type = 'dotlrn_admin_profile_rel'}] + + permission::grant -party_id $party_id_admins -object_id $item_id -privilege read + + ns_log Notice "ims_item_id ($item_id) read permissions granted for community admins" + + + } + + return $item_id +} + +ad_proc -public lors_central::imscp::resource_add { + {-res_id ""} + -man_id:required + {-identifier ""} + {-type ""} + {-href ""} + {-scorm_type ""} + {-hasmetadata ""} + {-package_id ""} + {-user_id ""} + {-creation_ip ""} + {-num ""} + -res_folder_id:required + +} { + Inserts a new resource according to the imsmanifest.xml file. + + @option res_id resource id to be inserted. + @option man_id manifest the resource belogs to (required). + @option identifier intrinsic item identifier. + @option type item type. + @option href location or references to item location. + @option scorm_type SCORM item type (SCORM extension). + @option hasmetadata whether the item has metadata (boolean). + @option package_id Package id. + @option user_id user that adds the category. [ad_conn user_id] used by default. + @option creation_ip ip-address of the user that adds the category. [ad_conn peeraddr] used by default. + @author Ernie Ghiglione (ErnieG@mm.st) +} { + # set utf-8 system encoding + encoding system utf-8 + + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + if {[empty_string_p $creation_ip]} { + set creation_ip [ad_conn peeraddr] + } + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + + #--------------------------------------------------------------------------------------# + # Since now we dont use acs-objects for the resource, then a new cr_item and revision + # needs to be done to store it. The cr_item and cr_revision are created here + # in orther to use the CR API. The item name probably has to change + + # Get LORSM Resource Folder folder_id + set parent_id $res_folder_id + set content_type "ims_resource_object" + set name "$identifier" + set item_id [content::item::new -name $name -content_type $content_type -parent_id $parent_id \ + -creation_date [dt_sysdate] -creation_user $user_id -creation_ip $creation_ip -context_id $package_id] + + + set revision_id [content::revision::new -title $name -content_type $content_type -creation_user $user_id \ + -creation_ip $creation_ip -item_id $item_id -is_live "t"] + + db_transaction { + set resource_id [db_exec_plsql new_resource { + select ims_resource__new ( + :res_id, + :man_id, + :identifier, + :type, + :href, + :scorm_type, + :hasmetadata, + current_timestamp, + :user_id, + :creation_ip, + :package_id, + :revision_id + ); + + } + ] + + } + return $resource_id +} + +ad_proc -public lors_central::imscp::organization_add { + {-org_id ""} + -man_id:required + {-identifier ""} + {-structure ""} + {-title ""} + {-hasmetadata ""} + {-package_id ""} + {-user_id ""} + {-creation_ip ""} + -org_folder_id:required + +} { + Inserts a new organizations according to the imsmanifest.xml file. + + @option org_id organization id to be inserted. + @option man_id manifest_id the organization belogs to. + @option identifier intrinsic organization identifier. + @option structure organization structure. + @option title organization title. + @option hasmetadata whether the organization has metadata (boolean). + @option package_id Package id. + @option user_id user that adds the category. [ad_conn user_id] used by default. + @option creation_ip ip-address of the user that adds the category. [ad_conn peeraddr] used by default. + @author Ernie Ghiglione (ErnieG@mm.st) +} { + # set utf-8 system encoding + encoding system utf-8 + + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + if {[empty_string_p $creation_ip]} { + set creation_ip [ad_conn peeraddr] + } + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + + #--------------------------------------------------------------------------------------# + # Since now we dont use acs-objects for the organizations, then a new cr_item and revision + # needs to be done to store it. The cr_item and cr_revision are created here + # in orther to use the CR API. The item name probably has to change + + # Get LORSM Organizations Folder folder_id + set parent_id $org_folder_id + set content_type "ims_organization_object" + set name "$identifier" + set item_id [content::item::new -name $name -item_id $org_id -content_type $content_type -parent_id $parent_id \ + -creation_date [dt_sysdate] -creation_user $user_id -creation_ip $creation_ip -context_id $package_id] + + + set revision_id [content::revision::new -title $name -content_type $content_type -creation_user $user_id \ + -creation_ip $creation_ip -item_id $item_id -is_live "t"] + + db_transaction { + set organization_id [db_exec_plsql new_organization { + select ims_organization__new ( + :org_id, + :man_id, + :identifier, + :structure, + :title, + :hasmetadata, + current_timestamp, + :user_id, + :creation_ip, + :package_id, + :revision_id + ); + + } + ] + + } + return $organization_id +} \ No newline at end of file Index: openacs-4/packages/lors-central/tcl/lors-central-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/lors-central-install-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/lors-central-install-procs.tcl 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,97 @@ +# packages/lors-central/tcl/lors-central-install-procs.tcl + +ad_library { + + LORS CENTRAL Installation procedures + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} + +# +# +# This package is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# It is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + + +namespace eval lors_central::install {} + +ad_proc -private lors_central::install::package_install {} { + + Install creates the lors-central folders + +} { + # Create the root folder to store the LO's + set folder_id [content::folder::new -name "LORSM Root Folder" -label "LORSM Root Folder"] + content::folder::register_content_type -folder_id $folder_id -content_type "content_revision" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_folder" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_symlink" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_extlink" \ + -include_subtypes "t" + + # Create the root folder to store the LO's Manifests + set folder_id [content::folder::new -name "LORSM Manifest Folder" -label "LORSM Manifest Folder"] + content::folder::register_content_type -folder_id $folder_id -content_type "ims_manifest_object" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_revision" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_folder" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_symlink" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_extlink" \ + -include_subtypes "t" + + # Create the root folder to store the LO's Organizations + set folder_id [content::folder::new -name "LORSM Organizations Folder" -label "LORSM Organizations Folder"] + content::folder::register_content_type -folder_id $folder_id -content_type "ims_organization_object" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_revision" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_folder" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_symlink" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_extlink" \ + -include_subtypes "t" + + # Create the root folder to store the LO's Items + set folder_id [content::folder::new -name "LORSM Items Folder" -label "LORSM Items Folder"] + content::folder::register_content_type -folder_id $folder_id -content_type "ims_item_object" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_revision" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_folder" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_symlink" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_extlink" \ + -include_subtypes "t" + + # Create the root folder to store the LO's Resources + set folder_id [content::folder::new -name "LORSM Resources Folder" -label "LORSM Resources Folder"] + content::folder::register_content_type -folder_id $folder_id -content_type "ims_resource_object" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_revision" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_folder" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_symlink" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $folder_id -content_type "content_extlink" \ + -include_subtypes "t" + + # Calling apm callback proc for notifications + lors_central::apm_callback::package_install +} Index: openacs-4/packages/lors-central/tcl/lors-central-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/lors-central-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/lors-central-procs.tcl 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,874 @@ +ad_library { + + Tcl API for lors-central store and manipulation + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} + +namespace eval lors_central {} + + +ad_proc -private lors_central::get_ims_item_id_or_res_id { + {-ims_item_id ""} + {-res_id "" } +} { + Returns ims_item_id if you provide res_id, or returns res_id if you provide ims_item_id + You must provide either res_id or ims_item_id +} { + if { ![empty_string_p $ims_item_id] } { + return [db_string get_res_id { }] + } else { + return [db_string get_ims_item_id { }] + } +} + +ad_proc -private lors_central::is_swa { +} { + Check if the user (default to logged in user) has site_wide_admin privileges +} { + if { ![acs_user::site_wide_admin_p] } { + ad_returnredirect "not-allowed" + ad_script_abort + } +} + +ad_proc -private lors_central::set_sort_order { + {-sort_order ""} + -ims_item_id:required +} { + Updates the ims_cp_items sort_order field with @sort_order@, if not present then + takes the sort_order assigned to one ims_cp_item to this ims_cp_item + -sort_order The sort_order number to put to the ims_cp_item field + -ims_item_id The ims_item_id +} { + if { [empty_string_p $sort_order] } { + set sort_order [db_string get_sort_order { }] + } + db_dml set_sort_order { } +} + + +ad_proc -private lors_central::change_one_lo_version { + -ver_num:required + -man_id:required + -community_id:required + -ims_item_id:required +} { + Changes one LO version (ver_num) to display on one dotlrn class (community_id) for one course (man_id) +} { + set item_id [lors_central::get_item_id -revision_id $ims_item_id] + if { ![string equal $ver_num 0] } { + set new_ims_item_id [lors_central::get_rev_id_from_version_num -ver_num $ver_num -item_id $item_id] + db_dml update_item_map { + update ims_cp_items_map + set ims_item_id = :new_ims_item_id, hide_p = 'f' + where man_id = :man_id and community_id = :community_id + and ims_item_id in ( select revision_id from cr_revisions where item_id = :item_id ) + } + } else { + db_dml hide_learning_object { + update ims_cp_items_map + set hide_p = 't' + where man_id = :man_id and community_id = :community_id + and ims_item_id = :ims_item_id + } + } +} + +ad_proc -private lors_central::folder_id_from_man_parent { + -parent_id:required + -man_id:required +} { + Returns the folder_id of the folder with man_id = @man_id@ and parent_id = @parent_id@ +} { + set folder_name [lors_central::get_course_name -man_id $man_id] + return [db_string get_folder_id { } -default ""] +} + + +ad_proc -private lors_central::get_root_folder_id { } { + Returns the folder_id of the folder with the name "LORS Root Folder" +} { + return [db_string get_folder_id_from_name { } ] +} + + +ad_proc -private lors_central::get_root_resources_folder_id { } { + Returns the folder_id of the folder with the name "LORS Resources Folder" +} { + return [db_string get_folder_id_from_name { } ] +} + +ad_proc -private lors_central::get_root_manifest_folder_id { } { + Returns the folder_id of the folder with the name "LORS Manifest Folder" +} { + return [db_string get_folder_id_from_name { } ] +} + + +ad_proc -private lors_central::get_root_items_folder_id { } { + Returns the folder_id of the folder with the name "LORS Items Folder" +} { + return [db_string get_folder_id_from_name { } ] +} + + +ad_proc -private lors_central::get_folder_name { + -folder_id:required +} { + Returns the folder name with folder_id = @folder_id@ +} { + return [db_string get_folder_name_from_id { } ] +} + + +ad_proc -private lors_central::get_parent_id { + -item_id:required +} { + Returns the parent_id id of @item_id@ +} { + return [db_string get_parent_id { } ] +} + + +ad_proc -private lors_central::get_item_title { + -item_id:required +} { + Returns the item title of @item_id@ +} { + return [db_string get_title { } ] +} + + +ad_proc -private lors_central::get_revision_count { + {-item_id "" } + {-revision_id "" } +} { + Returns the revision count of @item_id@, you must suplly either item_id or revision_id +} { + if { [empty_string_p $item_id] } { + if { [empty_string_p $revision_id] } { + ad_return_complaint 1 "<b>You must supply either item_id or revision_id</b>" + ad_script_abort + } else { + set item_id [lors_central::get_item_id -revision_id $revision_id] + } + } + return [db_string get_count { } ] +} + + +ad_proc -private lors_central::check_item_name { + -parent_id:required + -name:required +} { + Returns a new name for @name@ and @parent_id@ if necessary +} { + set item_name [db_string check_name { } -default ""] + if { ![empty_string_p $item_name] } { + set count [db_string count_items { } -default 0] + set name "(${count})$name" + } + return $name +} + +ad_proc -private lors_central::get_item_res_id { + -ims_item_id:required +} { + returns the resource id associtaed with this item +} { + return [db_string get_res_id {} -default ""] +} +ad_proc -private lors_central::get_content_revision_id { + -ims_item_id:required +} { + Returns the revision_id that holds the content of one ims_item_id +} { + # Get the resource id + set res_id [lors_central::get_item_res_id -ims_item_id $ims_item_id] + set href [lors_central::get_res_href -res_id $res_id] + # Get the file_id + return [db_string get_file_id { } -default 0] +} + +ad_proc -private lors_central::get_item_url { + -ims_item_id:required + -man_id:required +} { + Returns the URL associated to one ims_item_id and man_id +} { + # We get the folder of one course where the files are stored + set root_folder [lors_central::get_root_folder_id] + set name [lors_central::get_course_name -man_id $man_id] + set folder [db_string get_folder { }] + + # We get the resource href to get the subfolder inside folder + set href [lors_central::get_href -ims_item_id $ims_item_id] + set path_list [split $href "/"] + set char [string range $href 0 0] + if { [string equal $char "/"] } { + set subfolder_name [lindex $path_list 1] + set url_name [lindex $path_list 2] + } else { + set subfolder_name [lindex $path_list 0] + set url_name [lindex $path_list 1] + } + + set sub_folder_id [db_string get_subfolder_id { } -default ""] + if { ![empty_string_p $sub_folder_id] } { + # The subfolder is in this course get the file + set file_id [db_string get_file_id { }] + } else { + # The url is on another folder of another course so we will get it using the + # res_id associated to this ims_item_id and repeating the above process + set man_id [db_string get_other_man_id { }] + set name [lors_central::get_course_name -man_id $man_id] + set folder [db_string get_folder { }] + set sub_folder_id [db_string get_subfolder_id { } -default ""] + set file_id [db_string get_file_id { }] + } + return $file_id +} + + +ad_proc -private lors_central::get_href { + -ims_item_id:required +} { + Returns the href of the res_id associated to ims_item_id +} { + # Get the resource id + set res_id [lors_central::get_item_res_id -ims_item_id $ims_item_id] + return [lors_central::get_res_href -res_id $res_id] +} + +ad_proc -private lors_central::get_res_href { + -res_id:required +} { + Returns the href of the resource +} { + return [db_string get_res_href {} -default ""] +} +ad_proc -private lors_central::get_res_file_id { + -res_id:required +} { + Get file_id that is associated to this resource with the same href +} { + return [db_string get_file_id {} -default ""] +} + +ad_proc -private lors_central::get_item_name { + -ims_item_id:required +} { + Returns the item_name of the ims_item_id +} { + return [db_string get_name { }] +} + + +ad_proc -private lors_central::relation_between { + -item_id:required + -community_id:required +} { + Returns the 1 if there is an association between a dotlrn class or community + and the item_id, 0 otherwise. + @man_id@ The manifest id of the course + @community_id@ The class_id or community_id of dotlrn +} { + return [db_string get_relation { } -default 0] +} + + +ad_proc -private lors_central::add_relation { + -item_id:required + -community_id:required + -class_key:required +} { + Add a new row to the ims_cp_manifest_class to associate one community_id (class or community) + with a man_id + @item_id@ Item id that has man_id as revisions + @community_id@ The community_id of the dotlrn class or community + @class_key@ The name of the dotlrn class or community +} { + set lorsm_instance_id [lors_central::get_package_instance_id -community_id $community_id] + set man_id [content::item::get_live_revision -item_id $item_id] + set exist_association [db_string exist_assoc { } -default "0" ] + if { [string equal $exist_association "0"] } { + set exist_man_id [db_string exist_man_id { } -default "0"] + if { [string equal $exist_man_id "0"] } { + # Insert in the ims_cp_manifest_class + db_dml insert_info { } + } else { + # Update the ims_cp_manifest_class + db_dml update_info { } + } + } else { + # Insert in the ims_cp_manifest_class + if { ![db_string get_rel { } -default 0] } { + db_dml insert_info { } + } + } +} + + +ad_proc -private lors_central::drop_relation { + -item_id:required + -community_id:required +} { + Delete a row from the ims_cp_manifest_classes to drop one association of one community_id (class or community) + with a man_id + @item_id@ Item id + @community_id@ The community_id of the dotlrn class or community +} { + db_dml delete_relation { } +} + + +ad_proc -private lors_central::get_item_id { + -revision_id:required +} { + Returns the item_id of one @revision_id@ + @revision_id@ Revision ID +} { + return [db_string get_item_id { } -default 0] +} + + +ad_proc -private lors_central::count_versions { + {-man_id ""} + {-item_id ""} +} { + Returns the number of versions that @man_id@ has, You must supply either a man_id or an item_id + @man_id@ Manifest ID +} { + if { [empty_string_p $item_id]} { + set item_id [lors_central::get_item_id -revision_id $man_id] + } + return [db_string count_versions { } -default 0] +} + + +ad_proc -private lors_central::get_version_num { + -revision_id:required +} { + Get a list of all revisions associated to one @revision_id@ in asc order, and returns the position of the @revision_id@ + in that list plus 1 + + @revision_id@ Revision ID + returns position in list + 1 +} { + set item_id [lors_central::get_item_id -revision_id $revision_id] + set versions [list] + set versions [db_list_of_lists get_all_versions { }] + return [expr [lsearch -exact $versions $revision_id] + 1] +} + + +ad_proc -private lors_central::get_rev_id_from_version_num { + -ver_num:required + -item_id:required +} { + Returns revision_id for given version number @ver_num@ + + @ver_nun@ Version Number + returns revision_id +} { + set versions [list] + set versions [db_list_of_lists get_all_versions { }] + return [lindex $versions [expr $ver_num - 1]] +} + + +ad_proc -private lors_central::change_version { + -item_id:required + -ver_num:required + -community_id:required +} { + +} { + set man_id [lors_central::get_rev_id_from_version_num -ver_num $ver_num -item_id $item_id] + db_dml delete_items_map { + delete from ims_cp_items_map + where man_id = :man_id + } + db_dml update_version { } + set org_list [db_list_of_lists get_organizations { }] + foreach org_id $org_list { + set items_list [db_list_of_lists get_ims_items { }] + foreach ims_item_id $items_list { + db_dml insert_items { } + } + } +} + + +ad_proc -private lors_central::get_man_id { + -community_id:required + -item_id:required +} { + Returns the manifest id for one community_id and one item_id +} { + return [db_string get_man_id { }] +} + + +ad_proc -private lors_central::get_package_instance_id { + -community_id:required +} { + Gets the package_id of the lorsm instance related to the evaluation portlet for this community +} { + set pkg_id [db_string get_package_id { } -default 0] + if { [string equal $pkg_id "0"] } { + ad_return_complaint 1 "<b>You need to have lorsm-portlet in your class before associate this course</b>" + ad_script_abort + } else { + return $pkg_id + } +} + + +ad_proc -private lors_central::get_course_name { + -man_id:required +} { + Gets the Course Name of man_id +} { + return [db_string get_course_name { } -default ""] +} + + +ad_proc -private lors_central::get_username { + -user_id:required +} { + Return the User Name of @user_id@ +} { + return [db_string get_user_name_from_id {} -default ""] +} + + +ad_proc -private lors_central::get_class_name { + -community_id:required +} { + Return the dotLRN class name of @community_id@ +} { + return [db_string get_name { }] +} + + +ad_proc -private lors_central::get_live_classes { + -man_id:required +} { + Return the Number of classes that are using this man_id +} { + return [db_string get_num_classes { } -default 0] +} + + +ad_proc -private lors_central::check_privilege { + -item_id:required + -user_id:required +} { + Return 1 if the user_id has admin privilege over item_id, 0 otherwise + @item_id@ The item_id to check admin privilege + @user_id@ The user_id that holds the admin privilege +} { + if { ![acs_user::site_wide_admin_p -user_id $user_id ]} { + set permission_p [db_string check_permission { } -default 0] + } else { + set permission_p 1 + } + return $permission_p +} + + +ad_proc -private lors_central::change_version_all_courses { + -man_id:required + -item_id:required +} { + Update the ims_cp_manifest_class so all classes associated to this man_id use the same course + @man_id@ The manifest id to associate to all classes + @item_id@ The item_id of the man_id + +} { + db_foreach get_all_communities { + select + icmc.community_id as com_id, + icmc.lorsm_instance_id as lors_ins_id, + icmc.class_key as cl_key, + icmc.isenabled as ie, + icmc.istrackable as it + from + ims_cp_manifest_class icmc + where + icmc.man_id in ( select revision_id + from cr_revisions + where item_id = :item_id ) + } { + # We update the rows with the new revision_id ( man_id ) so every class that use this course + # will have the same course version. + db_dml update_course { + update ims_cp_manifest_class + set + man_id = :man_id, + lorsm_instance_id = :lors_ins_id, + class_key = :cl_key, + isenabled = :ie, + istrackable = :it + where + community_id = :com_id and + man_id in ( select revision_id + from cr_revisions + where item_id = :item_id + ) + } + } +} + + +ad_proc -public lors_central::get_object_info { + -file_id:required + -revision_id +} { + returns an array containing the object info +} { + + set user_id [ad_conn user_id] + set root_folder_id [lors_central::get_root_folder_id] + if {![exists_and_not_null revision_id]} { + set revision_id $file_id + } + + set file_item_id [lors_central::get_item_id -revision_id $file_id] + db_1row file_info {} -column_array file_object_info + + set content [db_exec_plsql get_content {}] + + if {[string equal $file_object_info(storage_type) file]} { + set filename [cr_fs_path $file_object_info(storage_area_key)] + append filename $content + set fd [open $filename] + set content [read $fd] + close $fd + } + + set file_object_info(content) $content + return [array get file_object_info] +} + +ad_proc -public lors_central::item_editable_info { + -item_id:required +} { + Returns an array containing elements editable_p, mime_type, file_extension + if an item is editable through the browser, editable_p is set to 1 + @error +} { + # ideally, this would get values from parameters + # hardcoding it for now + set editable_mime_types [list "text/html" "text/plain"] + + # this should work even if no revision is live + # changing to use _best_ revision + item::get_mime_info [item::get_best_revision $item_id] + + if {[lsearch -exact $editable_mime_types [string tolower $mime_info(mime_type)]] != -1} { + set mime_info(editable_p) 1 + } else { + set mime_info(editable_p) 0 + } + return [array get mime_info] +} + + +ad_proc -public lors_central::item_editable_p { + -item_id:required +} { + returns 1 if item is editable via browser + +} { + array set item_editable_info [lors_central::item_editable_info -item_id $item_id] + + return $item_editable_info(editable_p) +} + +ad_proc -public lors_central::add_file { + -res_id + {-file_content ""} + -mime_type + {-tmp_filename ""} + -filename + -title + -man_id + {-user_id ""} +} { + @param file_content + @param tmp_filename +} { + if {![exists_and_not_null user_id] && [ad_conn -connected_p] } { + set user_id [ad_conn user_id] + } + db_transaction { + # We get the resource_id to get the href of the item that is the default + # since this is the default file the ims_item has + + set res_href [lors_central::get_res_href -res_id $res_id] + + # We are going to create a new cr_revision (file) for the new file + # We get the revision_id that holds the content on the CR, this is the + # live_revision of one file_id + + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + + set file_upload [lors_central::check_item_name -parent_id $res_folder_id -name $filename] + set title [lors_central::check_item_name -parent_id $res_folder_id -name $title] + + # add a new resource revision + + set new_res_id [lors_central::add_resource_revision \ + -res_id $res_id \ + -name $title \ + -user_id $user_id \ + -man_id $man_id] + + set new_file_item_id [content::item::new -name $title -creation_user $user_id -parent_id $res_folder_id] + + + # FIXME allow lors admins to set live immediatly + set new_file_revision_id [ lors_central::add_file_revision \ + -res_id $new_res_id \ + -name $file_upload \ + -file_content $file_content \ + -tmp_filename $tmp_filename \ + -title $title \ + -mime_type $mime_type \ + -item_id $new_file_item_id \ + -user_id $user_id] + + lors_central::resource_carry_forward_files -old_res_id $res_id -new_res_id $new_res_id + lors_central::res_update_items \ + -old_res_id $res_id \ + -new_res_id $new_res_id \ + -user_id [ad_conn user_id] + + } + return $new_res_id +} + +ad_proc -public lors_central::add_resource_revision { + -res_id + -name + -user_id + -man_id +} { + add a revision to an ims_cp_resource +} { + set new_res_item_id [lors_central::get_item_id -revision_id $res_id] + + set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $name \ + -creation_user $user_id -is_live "t"] + + # Now we have to update the new row in the ims_cp_resources using this new resource (new_res_id) + # we need a new href + + set href [lors_central::get_res_href -res_id $res_id] + set split_href [split $href "/"] + # We remove the last part + set split_href [lrange $split_href 0 [expr [llength $split_href] - 2 ]] + set new_href "" + foreach element $split_href { + append new_href "$element/" + } + append new_href "$name" + + db_dml update_new_res { + update + ims_cp_resources + set + man_id = :man_id, + identifier = :name, + type = 'webcontent', + href = :href, + hasmetadata = 'f' + where + res_id = :new_res_rev_id + } + return $new_res_rev_id +} + +ad_proc -public lors_central::resource_carry_forward_files { + -old_res_id + -new_res_id + -exclude +} { + carry forward file mapping from old res to new resource +} { + set exclude_clause "" + if {[exists_and_not_null exclude]} { + set exclude_clause " and file_id not in ([template::util::tcl_to_sql_list $exclude]) " + } + db_dml carry_forward_files " + insert into ims_cp_files ( + select + file_id, + :new_res_id, + pathtofile, + filename, + hasmetadata + from + ims_cp_files + where + res_id = :old_res_id $exclude_clause) + " +} + +ad_proc -public lors_central::add_file_revision { + -res_id + -name + -file_content + -tmp_filename + -title + -mime_type + -item_id + -man_id + {-user_id ""} +} { + +} { + + set new_file_id [content::revision::new -item_id $item_id -title $title -creation_user $user_id \ + -mime_type $mime_type -is_live "f"] + + # Now we store the content in the CR + if {[exists_and_not_null tmp_filename]} { + set cr_file [cr_create_content_file $item_id $new_file_id $tmp_filename] + } else { + set cr_file [cr_create_content_file_from_string $item_id $new_file_id $file_content] + } + # get the size + set file_size [cr_file_size $cr_file] + + # update the file path in the CR and the size on cr_revisions + db_dml update_revision { + update + cr_revisions + set + content = :cr_file, + content_length = :file_size + where + revision_id = :new_file_id + } + set new_href [file join [file dirname [lors_central::get_res_href -res_id $res_id]] $title] + # Now that we have the new item store in the CR, we have to make + # some insert in some tables to adjust to the new cr_item. + # First we have to reflect the new file in the resources table, so we have to make + # a new XXXXcr_item andXXXX revision for the resource and insert it on the ims_cp_resources table + # We need to create a new row in the ims_cp_files to associate the new resource to the new file + db_dml insert_new_file { + insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) + values (:new_file_id, :res_id, :new_href, :title, 'f') + } + return $new_file_id +} + + +ad_proc -public lors_central::res_update_items { + -old_res_id + -new_res_id + {-user_id ""} +} { + When a resource gets a new revision update associated items +} { + db_transaction { + # we need to create new versions of each ims_cp_item that is mapped to this resource + foreach ims_item_id [db_list get_ims_items "select ims_item_id from ims_cp_items_to_resources where res_id=:old_res_id"] { + # Now are going to create a new version of the item (ims_cp_item) + set item_id [lors_central::get_item_id -revision_id $ims_item_id] + set item_title [lors_central::get_item_title -item_id $item_id] + set item_count [expr [lors_central::get_revision_count -item_id $item_id] + 1 ] + append item_title "_$item_count" + set new_ims_rev_id [content::revision::new -item_id $item_id -title $item_title -creation_user $user_id \ + -is_live "t"] + # We need to fill the extra information + set item_name [lors_central::get_item_name -ims_item_id $ims_item_id] + set org_id [db_string get_org_id "select org_id from ims_cp_items where ims_item_id = :ims_item_id"] + set item_title [db_string get_item_title_id "select item_title from ims_cp_items where ims_item_id = :ims_item_id"] + set parent_item [db_string get_parent_item { }] + db_dml update_ims_cp_items { + update ims_cp_items + set + org_id = :org_id, + identifier = :item_name, + identifierref = :item_title, + item_title = :item_title, + parent_item = :parent_item + where ims_item_id = :new_ims_rev_id + + } + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_id) + } + # We are going to set the sort_order field + lors_central::set_sort_order -ims_item_id $new_ims_rev_id + } + } + +} + +ad_proc -private lors_central::do_notification { + -object_id:required +} { + Send a notification to all users subscribed to @object_id@ + @object_id@ The object_id that holds the notification +} { + notification::new \ + -type_id [notification::type::get_type_id -short_name "one_lo_notif" ] \ + -object_id $object_id \ + -notif_subject "Changes made to this resource" \ + -notif_text "Some changes have been made to one resource" \ +} + +ad_proc -public lors_central::get_folder_id { + -name:required +} { + return [db_string get_root_folder { }] +} + +ad_proc -public lors_central::get_items_indent { + -org_id:required +} { + Returns a list of the form \{ims_item_id indent\} from one org_id +} { + + # We need all the count of all items (just live revisions) + set items_count [db_string get_items_count { }] + + # Get the root items + set count 0 + db_foreach get_root_items { } { + lappend items_list [list $ims_item_id 1] + set items_array($ims_item_id) 1 + incr count + } + + + while { $count < $items_count } { + foreach item $items_list { + set item_id [lindex $item 0] + set indent [expr [lindex $item 1] + 1] + db_foreach get_items { } { + if { ![info exist items_array($ims_item_id)] } { + lappend items_list [list $ims_item_id $indent] + set items_array($ims_item_id) $indent + incr count + } + } + } + } + return $items_list +} + +ad_proc -public lors_central::get_root_folder_id { } { } { + return [db_string get_root_folder { }] +} Index: openacs-4/packages/lors-central/tcl/lors-central-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/lors-central-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/lors-central-procs.xql 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,820 @@ +<?xml version="1.0"?> +<queryset> + + +<fullquery name="lors_central::get_ims_item_id_or_res_id.get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_ims_item_id_or_res_id.get_ims_item_id"> + <querytext> + select + ims_item_id + from + ims_cp_items_to_resources + where + res_id = :res_id + </querytext> +</fullquery> + + +<fullquery name="lors_central::get_item_url.get_folder"> + <querytext> + select + item_id + from + cr_items + where + name = :name and + parent_id = :root_folder + </querytext> +</fullquery> + +<fullquery name="lors_central::get_item_url.get_subfolder_id"> + <querytext> + select + item_id + from + cr_items + where + parent_id = :folder and + name = :subfolder_name + </querytext> +</fullquery> + +<fullquery name="lors_central::get_item_url.get_file_id"> + <querytext> + select + item_id + from + cr_items + where + name = :url_name and + parent_id = :sub_folder_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_item_url.get_other_man_id"> + <querytext> + select + r.man_id + from + ims_cp_resources r, ims_cp_items_to_resources ir + where + ir.res_id = r.res_id and + ir.ims_item_id = :ims_item_id + </querytext> +</fullquery> +<fullquery name="lors_central::get_item_url."> + <querytext> + + </querytext> +</fullquery> +<fullquery name="lors_central::get_item_url."> + <querytext> + + </querytext> +</fullquery> +<fullquery name="lors_central::get_item_url."> + <querytext> + + </querytext> +</fullquery> + +<fullquery name="lors_central::set_sort_order.set_sort_order"> + <querytext> + update + ims_cp_items + set + sort_order = :sort_order + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::set_sort_order.get_sort_order"> + <querytext> + select + distinct sort_order + from + ims_cp_items + where + ims_item_id in ( + select revision_id + from cr_revisions + where item_id = ( + select item_id + from cr_revisions + where revision_id = :ims_item_id + ) + ) + and sort_order is not null + </querytext> +</fullquery> + +<fullquery name="lors_central::change_version.get_organizations"> + <querytext> + select + org_id + from + ims_cp_organizations + where + man_id = :man_id + </querytext> +</fullquery> + +<fullquery name="lors_central::change_version.get_ims_items"> + <querytext> + select + ims_item_id + from + ims_cp_items + where + org_id = :org_id + and ims_item_id in ( select live_revision + from cr_items + ) + </querytext> +</fullquery> + +<fullquery name="lors_central::change_version.insert_items"> + <querytext> + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:ims_item_id) + </querytext> +</fullquery> + +<fullquery name="lors_central::change_one_lo_version.update_ims_cp_items_map"> + <querytext> + update + ims_cp_items_map + set + ims_item_id = :new_ims_item_id + where + man_id = :man_id and + community_id = :community_id and + ims_item_id in ( + select revision_id + from cr_revisions + where item_id = :item_id ) + </querytext> +</fullquery> + + +<fullquery name="lors_central::folder_id_from_man_parent.get_folder_id"> + <querytext> + select + item_id + from + cr_items + where + parent_id = :parent_id and + name = :folder_name + </querytext> +</fullquery> + +<fullquery name="lors_central::get_item_title.get_title"> + <querytext> + select + name + from + cr_items + where + item_id = :item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::check_item_name.check_name"> + <querytext> + select + name + from + cr_items + where + parent_id = :parent_id and + name = :name + </querytext> +</fullquery> + +<fullquery name="lors_central::check_item_name.count_items"> + <querytext> + select + count(item_id) + from + cr_items + where + parent_id = :parent_id + </querytext> +</fullquery> + + +<fullquery name="lors_central::get_revision_count.get_count"> + <querytext> + select count(revision_id) + from + cr_revisions + where + item_id = :item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_root_folder_id.get_folder_id_from_name"> + <querytext> + select + folder_id + from + cr_folders + where + label = 'LORSM Root Folder' + </querytext> +</fullquery> + +<fullquery name="lors_central::get_root_resources_folder_id.get_folder_id_from_name"> + <querytext> + select + folder_id + from + cr_folders + where + label = 'LORSM Resources Folder' + </querytext> +</fullquery> + +<fullquery name="lors_central::get_root_manifest_folder_id.get_folder_id_from_name"> + <querytext> + select + folder_id + from + cr_folders + where + label = 'LORSM Manifest Folder' + </querytext> +</fullquery> + +<fullquery name="lors_central::get_root_items_folder_id.get_folder_id_from_name"> + <querytext> + select + folder_id + from + cr_folders + where + label = 'LORSM Items Folder' + </querytext> +</fullquery> + +<fullquery name="lors_central::get_parent_id.get_parent_id"> + <querytext> + select + parent_id + from + cr_items + where + item_id = :item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_class_name.get_name"> + <querytext> + select + pretty_name + from + dotlrn_class_instances_full + where + community_id = :community_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_item_res_id.get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_href.get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_res_href.get_res_href"> + <querytext> + select + href + from + ims_cp_resources + where + res_id = :res_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_res_file_id.get_file_id"> + <querytext> + select + file_id + from + ims_cp_files f, + ims_cp_resources r + where + r.res_id=:res_id + and + f.res_id=r.res_id + and + f.pathtofile=r.href + </querytext> +</fullquery> + +<fullquery name="lors_central::get_item_name.get_name"> + <querytext> + select + name + from + cr_items + where + item_id = ( + select item_id + from cr_revisions + where revision_id = :ims_item_id + ) + </querytext> +</fullquery> + +<fullquery name="lors_central::get_content_revision_id.get_file_id"> + <querytext> + select + file_id + from + ims_cp_files + where + res_id = :res_id and + pathtofile = :href + </querytext> +</fullquery> + +<fullquery name="lors_central::get_item_url.get_folder"> + <querytext> + select + item_id + from + cr_items + where + name = :name and + parent_id = :root_folder + </querytext> +</fullquery> + + +<fullquery name="lors_central::get_course_name.get_course_name"> + <querytext> + select + course_name + from + ims_cp_manifests + where + man_id =:man_id + </querytext> +</fullquery> + + +<fullquery name="lors_central::get_folder_name.get_folder_name_from_id"> + <querytext> + select + label + from + cr_folders + where + folder_id = :folder_id + </querytext> +</fullquery> + +<fullquery name="lors_central::relation_between.get_relation"> + <querytext> + select + 1 + from + ims_cp_manifest_class + where + community_id = :community_id + and + man_id in ( select revision_id from cr_revisions where item_id = :item_id ) + </querytext> +</fullquery> + +<fullquery name="lors_central::add_relation.exist_assoc"> + <querytext> + select + count(community_id) + from + ims_cp_manifest_class + where + man_id = :man_id + </querytext> +</fullquery> + +<fullquery name="lors_central::add_relation.exist_man_id"> + <querytext> + select + 1 + from + ims_cp_manifest_class + where + man_id = :man_id + </querytext> +</fullquery> + +<fullquery name="lors_central::drop_relation.delete_relation"> + <querytext> + delete from + ims_cp_manifest_class + where + community_id = :community_id and + man_id in + ( + select revision_id + from cr_revisions + where item_id = :item_id + ) + </querytext> +</fullquery> + +<fullquery name="lors_central::add_relation.get_rel"> + <querytext> + select + 1 + from + ims_cp_manifest_class + where + community_id = :community_id and + man_id =:man_id + </querytext> +</fullquery> + +<fullquery name="lors_central::add_relation.update_info"> + <querytext> + update + ims_cp_manifest_class + set + lorsm_instance_id = :lorsm_instance_id, + community_id = :community_id, + class_key = :class_key + where + man_id = :man_id + </querytext> +</fullquery> + +<fullquery name="lors_central::add_relation.insert_info"> + <querytext> + insert into ims_cp_manifest_class + (man_id, lorsm_instance_id, community_id, class_key, isenabled, istrackable) + values + (:man_id, :lorsm_instance_id, :community_id, :class_key, 't', 'f') + </querytext> +</fullquery> + +<fullquery name="lors_central::get_item_id.get_item_id"> + <querytext> + select + item_id + from + cr_revisions + where + revision_id = :revision_id + </querytext> +</fullquery> + +<fullquery name="lors_central::count_versions.count_versions"> + <querytext> + select + count(revision_id) + from + cr_revisions + where + item_id = :item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_version_num.get_all_versions"> + <querytext> + select + revision_id + from + cr_revisions + where + item_id = :item_id + order by revision_id asc + </querytext> +</fullquery> + +<fullquery name="lors_central::get_man_id.get_man_id"> + <querytext> + select + distinct man_id + from + ims_cp_manifest_class + where + community_id = :community_id and + man_id in + ( + select revision_id + from cr_revisions + where item_id = :item_id + ) + </querytext> +</fullquery> + +<fullquery name="lors_central::get_rev_id_from_version_num.get_all_versions"> + <querytext> + select + revision_id + from + cr_revisions + where + item_id = :item_id + order by revision_id asc + </querytext> +</fullquery> + + +<fullquery name="lors_central::change_version.update_version"> + <querytext> + update + ims_cp_manifest_class + set + man_id = :man_id + where + community_id = :community_id and + man_id in ( select revision_id + from cr_revisions + where item_id = :item_id + ) + </querytext> +</fullquery> + +<fullquery name="lors_central::get_package_instance_id.get_package_id"> + <querytext> + select + dca.package_id + from + dotlrn_community_applets dca,apm_packages ap + where + community_id=:community_id and + ap.package_id=dca.package_id and + ap.package_key='lorsm' + </querytext> +</fullquery> + +<fullquery name="lors_central::get_username.get_user_name_from_id"> + <querytext> + select + first_names || ' ' || last_name + from + cc_users + where + user_id = :user_id + </querytext> +</fullquery> + + +<fullquery name="lors_central::get_live_classes.get_num_classes"> + <querytext> + select + count(man_id) + from + ims_cp_manifest_class + where + man_id = :man_id + and + community_id is not null + </querytext> +</fullquery> + +<fullquery name="lors_central::check_privilege.check_permission"> + <querytext> + select + 1 + from + acs_permissions + where + object_id = :item_id and + grantee_id = :user_id and + privilege = 'admin' + </querytext> +</fullquery> + +<fullquery name="lors_central::change_versions_all_courses.get_all_communities"> + <querytext> + select + icmc.community_id as com_id, + icmc.lorsm_instance_id as lors_ins_id, + icmc.class_key as cl_key, + icmc.isenabled as ie, + icmc.istrackable as it + from + ims_cp_manifest_class icmc + where + icmc.man_id in ( select revision_id + from cr_revisions + where item_id = :item_id ) + </querytext> +</fullquery> + +<fullquery name="lors_central::change_versions_all_courses.update_course"> + <querytext> + update ims_cp_manifest_class + set + man_id = :man_id, + lorsm_instance_id = :lors_ins_id, + class_key = :cl_key, + isenabled = :ie, + istrackable = :it + where + community_id = :com_id and + man_id in + ( + select revision_id + from cr_revisions + where item_id = :item_id + ) + + </querytext> +</fullquery> + +<fullquery name="lors_central::get_object_info.file_info"> + <querytext> + select person__name(o.creation_user) as owner, + i.name as title, + r.title as name, + r.description as version_notes, + acs_permission__permission_p(:file_id,:user_id,'write') as write_p, + acs_permission__permission_p(:file_id,:user_id,'delete') as delete_p, + acs_permission__permission_p(:file_id,:user_id,'admin') as admin_p, + content_item__get_path(o.object_id, :root_folder_id) as file_url, + i.live_revision, + i.storage_type, + i.storage_area_key, + r.mime_type + from acs_objects o, cr_revisions r, cr_items i + where o.object_id = :file_item_id + and i.item_id = o.object_id + and r.revision_id = :revision_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_object_info.get_content"> + <querytext> + select content_revision__get_content(:revision_id) + </querytext> +</fullquery> + +<fullquery name="lors_central::add_file.get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::add_file.check_file"> + <querytext> + select + 1 + from + ims_cp_files + where + file_id = :clipboard_object_id + and res_id = :ims_res_id + </querytext> +</fullquery> + +<fullquery name="lors_central::add_file.get_filename"> + <querytext> + select + distinct filename + from + ims_cp_files + where + file_id = :new_file_id + </querytext> +</fullquery> + +<fullquery name="lors_central::add_file.get_pathtofile"> + <querytext> + select + distinct pathtofile + from + ims_cp_files + where + file_id = :new_file_id + </querytext> +</fullquery> + + +<fullquery name="lors_central::add_file.get_old_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::res_update_items.get_parent_item"> + <querytext> + select + parent_item + from + ims_cp_items + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_root_folder_id.get_root_folder"> + <querytext> + select + folder_id + from + cr_folders + where + label = 'LORSM Root Folder' + </querytext> +</fullquery> + +<fullquery name="lors_central::get_items_indent.get_items"> + <querytext> + select + ims_item_id + from + ims_cp_items + where + parent_item = :item_id and + org_id = :org_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_items_indent.get_root_items"> + <querytext> + select + ims_item_id + from + ims_cp_items + where + parent_item = :org_id and + org_id = :org_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_items_indent.get_items_count"> + <querytext> + select + count(ims_item_id) + from + ims_cp_items + where + ims_item_id in ( + select + live_revision + from + cr_items + where + content_type = 'ims_item_object' + ) and + org_id = :org_id + </querytext> +</fullquery> + +<fullquery name="lors_central::get_folder_id.get_root_folder"> + <querytext> + select + folder_id + from + cr_folders + where + label = :name + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/tcl/test/lors-central-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/tcl/test/lors-central-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/tcl/test/lors-central-procs.tcl 17 May 2005 16:21:18 -0000 1.1 @@ -0,0 +1,744 @@ +ad_library { + Tcl API for lors-central testing +} + +aa_register_case null_parent_items_reference { + Checks if null parent_item exist in ims_cp_items table, since all ims_item_id must have one + parent_item. +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set null_parent_items [db_string get_null_parents { + select + count(ims_item_id) + from + ims_cp_items + where + parent_item is null + } -default 0] + if { $null_parent_items > 0 } { + set success_p 0 + } else { + set success_p 1 + } + aa_equals "There are not null parent_items" $success_p 1 + } +} + +aa_register_case lors_central_add_relation_check { + Check if adds a new row (only one) to the ims_cp_manifest_class associating man_id and community_id + ** Requirements: + 1. Two dotlrn classes + 2. One lors course +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set test_com_id [db_string get_community { + select max(community_id) + from dotlrn_communities_all + }] + set test_com_id_2 [db_string get_community { + select min(community_id) + from dotlrn_communities_all + }] + set test_man_id [db_string get_man_id { + select max(man_id) + from ims_cp_manifests + }] + set test_item_id [db_string get_item_id { + select item_id + from cr_revisions + where revision_id = :test_man_id + }] + + set test_class_key [db_string get_class_key { + select community_type + from dotlrn_communities_all + where community_id = :test_com_id + }] + # Testing where there is no association + lors_central::add_relation -item_id $test_item_id -community_id $test_com_id -class_key $test_class_key + set row_count [db_string get_row_count { + select count(man_id) + from ims_cp_manifest_class + where community_id = :test_com_id and man_id = :test_man_id + }] + if { [string equal $row_count "1"] } { + set success_p 1 + } else { + set success_p 0 + } + aa_true "Creates only one row" [string equal "1" "$success_p"] + + # Testing where there is already one association + lors_central::add_relation -item_id $test_item_id -community_id $test_com_id_2 -class_key $test_class_key + set row_count [db_string get_row_count { + select count(man_id) + from ims_cp_manifest_class + where man_id = :test_man_id + }] + if { [string equal $row_count "2"] } { + set success_p 1 + } else { + set success_p 0 + } + aa_equals "Associate more than one communities to the same man_id" $success_p 1 + } +} + + +aa_register_case lors_central_get_version_num { + Check if giving one number for one item_id returns a revision_id with the same item_id + ** Requirements: + 1. One LO with two or more versions +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set test_revision_id [db_string get_revision_id { + select min(ims_item_id),org_id from ims_cp_items group by sort_order,org_id having count(ims_item_id) > 1; + }] + set test_item_id [db_string get_item_id { + select item_id from cr_revisions where revision_id = :test_revision_id + }] + set test_count [db_string get_count { + select count(revision_id) from cr_revisions where item_id = :test_item_id + }] + set test_revision_id_2 [db_string get_revision_id_2 { + select max(revision_id) from cr_revisions where item_id = :test_item_id + }] + set version_number_1 [lors_central::get_version_num -revision_id $test_revision_id] + aa_equals "Min revision_id return version number equal to 1" $version_number_1 "1" + + set version_number_2 [lors_central::get_version_num -revision_id $test_revision_id_2] + aa_equals "Max revision_id return version number equal to revisions count" $version_number_2 $test_count + } +} + + +aa_register_case lors_central_change_one_lo_version_check { + Check if changes one LO version (ver_num) on ims_cp_items_map for one community_id and one man_id + ** Requirements: + 1. One dotlrn class + 2. One lors course associated to the class + 3. One LO with two versions inside the course associated to the class + +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set test_item_id [db_string get_item_id { + select min(ims_item_id), org_id from ims_cp_items group by sort_order, org_id having count(ims_item_id) > 1; + }] + set test_item_id_2 [db_string get_item_id { + select max(ims_item_id), org_id from ims_cp_items group by sort_order, org_id having count(ims_item_id) > 1; + }] + set test_org_id [db_string get_org_id { + select org_id + from ims_cp_items + where ims_item_id = :test_item_id + }] + set test_man_id [db_string get_man_id { + select man_id + from ims_cp_organizations + where org_id = :test_org_id + }] + set test_com_id [db_string get_com_id { + select min(community_id) + from ims_cp_items_map + where org_id = :test_org_id and + man_id = :test_man_id + }] + + set test_com_id_2 [db_string get_com_id { + select max(community_id) + from ims_cp_items_map + where org_id = :test_org_id and + man_id = :test_man_id + }] + + set ver_num_1 [lors_central::get_version_num -revision_id $test_item_id] + set ver_num_2 [lors_central::get_version_num -revision_id $test_item_id_2] + lors_central::change_one_lo_version -ver_num $ver_num_1 -man_id $test_man_id \ + -community_id $test_com_id -ims_item_id $test_item_id + + set check_item [db_string get_item { + select ims_item_id + from ims_cp_items_map + where community_id = :test_com_id and + org_id = :test_org_id and + man_id = :test_man_id and + ims_item_id in ( select revision_id from cr_revisions where item_id = + ( select item_id from cr_revisions where revision_id = :test_item_id )) + }] + aa_equals "Change to first version_number ($test_item_id)" $check_item $test_item_id + lors_central::change_one_lo_version -ver_num $ver_num_2 -man_id $test_man_id \ + -community_id $test_com_id -ims_item_id $test_item_id + set check_item [db_string get_item { + select ims_item_id + from ims_cp_items_map + where community_id = :test_com_id and + org_id = :test_org_id and + man_id = :test_man_id and + ims_item_id in ( select revision_id from cr_revisions where item_id = + ( select item_id from cr_revisions where revision_id = :test_item_id )) + }] + aa_equals "Change to last version_number ($test_item_id_2)" $check_item $test_item_id_2 + + lors_central::change_one_lo_version -ver_num $ver_num_2 -man_id $test_man_id \ + -community_id $test_com_id_2 -ims_item_id $test_item_id + set check_item [db_string get_item { + select ims_item_id + from ims_cp_items_map + where community_id = :test_com_id_2 and + org_id = :test_org_id and + man_id = :test_man_id and + ims_item_id in ( select revision_id from cr_revisions where item_id = + ( select item_id from cr_revisions where revision_id = :test_item_id )) + }] + aa_equals "Change to last version_number ($test_item_id_2) on different community" $check_item $test_item_id_2 + + lors_central::change_one_lo_version -ver_num "0" -man_id $test_man_id \ + -community_id $test_com_id_2 -ims_item_id $test_item_id_2 + + set check_item [db_string get_hide_p { + select hide_p + from ims_cp_items_map + where community_id = :test_com_id_2 and + ims_item_id = :test_item_id_2 + }] + aa_equals "Hide on one community" $check_item "t" + } +} + +aa_register_case lors_central_change_version_check { + Check if changes one course version (ver_num of man_id) on ims_cp_manifest_class and also maps each item in + ims_cp_items_map to the new version + ** Requirements: + 1. One dotlrn class + 2. One lors course associated to one or more classes with 2 or more versions + +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set man_id [db_string get_man_id { + select min(man_id) + from ims_cp_manifest_class + }] + set item_id [lors_central::get_item_id -revision_id $man_id] + set man_id1 [db_string get_man_id_2 { + select min(revision_id) + from cr_revisions + where item_id = :item_id + }] + set man_id2 [db_string get_man_id_2 { + select max(revision_id) + from cr_revisions + where item_id = :item_id + }] + set ver_num1 [lors_central::get_version_num -revision_id $man_id1] + set ver_num2 [lors_central::get_version_num -revision_id $man_id2] + set com_id [db_string get_com_id { + select min(community_id) + from ims_cp_manifest_class + where man_id = :man_id + }] + lors_central::change_version -item_id $item_id -ver_num $ver_num1 -community_id $com_id + + set success_p [db_string check_ims_cp_manifest_class { + select count(man_id) + from ims_cp_manifest_class + where man_id = :man_id1 and community_id = :com_id + } -default 0] + aa_equals "Version $ver_num1 associated to community $com_id" $success_p 1 + + lors_central::change_version -item_id $item_id -ver_num $ver_num2 -community_id $com_id + set success_p [db_string check_ims_cp_manifest_class { + select count(man_id) + from ims_cp_manifest_class + where man_id = :man_id2 and community_id = :com_id + } -default 0] + aa_equals "Version $ver_num2 associated to community $com_id" $success_p 1 + + } +} + +aa_register_case lors_central_change_version_all_courses_check { + Checks if all communties associated to any version of one course get the same man_id on ims_cp_manifest_class + ** Requirements: + 1. Two dotlrn classes + 2. One course with two versions associated to the classes + + +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set man_id "" + db_foreach get_man_ids { + select man_id as test_man_id + from ims_cp_manifest_class + } { + if { [lors_central::get_revision_count -revision_id $test_man_id] > 1 } { + set man_id $test_man_id + } + } + if { [empty_string_p $man_id] } { + ad_return_complaint 1 "There are no course with two versions associated to dotlrn classes to make this test" + ad_script_abort + } + set item_id [lors_central::get_item_id -revision_id $man_id] + set man_id1 [db_string get_man_id { + select min(revision_id) from cr_revisions where item_id = :item_id + }] + set man_id2 [db_string get_man_id2 { + select max(revision_id) from cr_revisions where item_id = :item_id + }] + set classes_count [db_string get_count { + select count(man_id) from ims_cp_manifest_class + where man_id in (select revision_id from cr_revisions where item_id = :item_id) + }] + + lors_central::change_version_all_courses -man_id $man_id1 -item_id $item_id + set classes_count1 [db_string get_count { + select count(man_id) from ims_cp_manifest_class + where man_id in (select revision_id from cr_revisions where item_id = :item_id) + }] + + aa_equals "All classes watching the same versions $man_id1" $classes_count1 $classes_count + + lors_central::change_version_all_courses -man_id $man_id2 -item_id $item_id + set classes_count2 [db_string get_count { + select count(man_id) from ims_cp_manifest_class + where man_id in (select revision_id from cr_revisions where item_id = :item_id) + }] + + aa_equals "All classes watching the same versions $man_id2" $classes_count2 $classes_count + + } +} + + +aa_register_case lors_central_count_versions_check { + Checks if returns the right number of revisions for one revision_id or item_id + ** Requirements: + 1. One or more cr_items (with 1 or more revisions) +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set rev_list [db_list_of_lists get_revisions { + select min(revision_id) + from cr_revisions group by item_id + having count(revision_id) > 1 }] + set revision_id [lindex $rev_list 0] + set item_id [lors_central::get_item_id -revision_id $revision_id] + set rev_count [db_string get_count { + select count(revision_id) + from cr_revisions + where item_id = :item_id + }] + set proc_count [lors_central::get_revision_count -revision_id $revision_id] + aa_equals "Calling proc with revision_id $rev_count = $proc_count" $rev_count $proc_count + set proc_count [lors_central::get_revision_count -item_id $item_id] + aa_equals "Calling proc with item_id $rev_count = $proc_count" $rev_count $proc_count + } +} + +aa_register_case lors_central_drop_relation_check { + Checks if deletes the ralation between one man_id and one community_id on ims_cp_manifest_class + ** Requirements: + 1. One or more classes associated to one course +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set com_id [db_string get_com_id { + select min(community_id) + from ims_cp_manifest_class + }] + set man_id [db_string get_man_id { + select min(man_id) + from ims_cp_manifest_class + where community_id = :com_id + }] + set item_id [lors_central::get_item_id -revision_id $man_id] + lors_central::drop_relation -item_id $item_id -community_id $com_id + set test [db_string check_relation { + select count(man_id) + from ims_cp_manifest_class + where community_id = :com_id + and man_id in ( select revision_id from cr_revisions where item_id = :item_id ) + }] + aa_equals "Deleting everything from ims_cp_manifest_class" $test "0" + } +} + +aa_register_case lors_central_get_class_name_check { + Checks if the dotlrn class name is the same + ** Requirements: + 1. One dotlrn class +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set com_id [db_string get_community { + select min(community_id) + from dotlrn_communities_all + }] + set name [db_string get_name { + select pretty_name + from dotlrn_class_instances_full + where community_id = :com_id + }] + set proc_name [lors_central::get_class_name -community_id $com_id] + aa_equals "Returns the same name $name = $proc_name" $name $proc_name + } +} + +aa_register_case lors_central_get_folder_name_check { + Checks if the folder name is correct + ** Requirements: + 1. One LO course +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set folder_id [db_string get_folder_id { + select max(folder_id) + from cr_folders + }] + set name [db_string get_name { + select label + from cr_folders + where folder_id = :folder_id + }] + set proc_name [lors_central::get_folder_name -folder_id $folder_id] + aa_equals "Returns the same name $name = $proc_name" $name $proc_name + } +} + + +aa_register_case lors_central_get_item_id_check { + Checks if the item_id is the correct + ** Requirements: + 1. One cr_revision +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set rev_id [db_string get_rev_id { + select max(revision_id) + from cr_revisions + }] + set item_id [db_string get_name { + select item_id + from cr_revisions + where revision_id = :rev_id + }] + set proc_item_id [lors_central::get_item_id -revision_id $rev_id] + aa_equals "Returns the same item_id $item_id = $proc_item_id" $item_id $proc_item_id + } +} + +aa_register_case lors_central_get_item_id_check { + Checks if the item_id is the correct + ** Requirements: + 1. One cr_revision +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set rev_id [db_string get_rev_id { + select max(revision_id) + from cr_revisions + }] + set item_id [db_string get_name { + select item_id + from cr_revisions + where revision_id = :rev_id + }] + set proc_item_id [lors_central::get_item_id -revision_id $rev_id] + aa_equals "Returns the same item_id $item_id = $proc_item_id" $item_id $proc_item_id + } +} + + +aa_register_case lors_central_get_parent_id_check { + Checks if the parent_id is the correct + ** Requirements: + 1. One cr_revision +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set item_id [db_string get_item_id { + select max(item_id) + from cr_items + where parent_id is not null + }] + set parent_id [db_string get_parent_id { + select parent_id + from cr_items + where item_id = :item_id + }] + set proc_parent_id [lors_central::get_parent_id -item_id $item_id] + aa_equals "Returns the same item_id $parent_id = $proc_parent_id" $parent_id $proc_parent_id + } +} + +aa_register_case lors_central_relation_between_check { + Checks if the relation_between proc is correct + ** Requirements: + 1. One cr_revision +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set man_id [db_string get_man_id { + select max(man_id) + from ims_cp_manifest_class + }] + set com_id [db_string get_com_id { + select min(community_id) + from ims_cp_manifest_class + where man_id = :man_id + }] + set item_id [lors_central::get_item_id -revision_id $man_id] + set rel_p [db_string get_rel { + select 1 from ims_cp_manifest_class + where community_id = :com_id and man_id in + ( select revision_id from cr_revisions where item_id = :item_id ) + }] + set proc_rel_p [lors_central::relation_between -item_id $item_id -community_id $com_id] + aa_equals "Relation between proc" $rel_p $proc_rel_p + } +} + +aa_register_case lors_central_set_sort_order_check { + Checks if the item_id sort_order is the correct + ** Requirements: + 1. One LO +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set ims_item_id [db_string get_ims_item_id { + select max(ims_item_id) + from ims_cp_items + }] + lors_central::set_sort_order -ims_item_id $ims_item_id -sort_order 2 + set proc_sort [db_string get_sort { + select sort_order + from ims_cp_items + where ims_item_id = :ims_item_id} -default 0] + aa_equals "Sort order proc set the right sort" $proc_sort "2" + + set proc_sort [lors_central::set_sort_order -ims_item_id $ims_item_id] + set sort_p [db_string get_sort { + select 1 + from ims_cp_items + where sort_order is not null + and ims_item_id = :ims_item_id } -default 0] + aa_true "Sort order proc set the right sort (when not sendind the sort_order number)" $sort_p + } +} + +aa_register_case lors_central_check_item_name_check { + Checks if returns a new name for a given item_name + ** Requirements: + 1. One Course +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set rev_id [db_string get_rev_id { + select max(ims_item_id) + from ims_cp_items + }] + set item_id [lors_central::get_item_id -revision_id $rev_id] + set parent_id [lors_central::get_parent_id -item_id $item_id] + set name [db_string get_nanme { + select name + from cr_items + where item_id = :item_id + }] + set proc_name [lors_central::check_item_name -parent_id $parent_id -name $name] + if { [string equal $name $proc_name] } { + set success_p 0 + } else { + set success_p 1 + } + aa_true "Name exist, gives a new name" $success_p + set name ${name}h + set proc_name [lors_central::check_item_name -parent_id $parent_id -name $name] + if { [string equal $name $proc_name] } { + set success_p 1 + } else { + set success_p 0 + } + aa_true "Name doesn't exist, gives the same name" $success_p + } +} + +aa_register_case lors_central_check_privilege { + Checks lors_central::check_privilige proc + ** Requirements: + 1. One Course +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set item_id [db_string get_item_id { + select max(object_id) + from acs_permissions + where privilege = 'admin' + }] + set user_id [db_string get_user_id { + select min(grantee_id) + from acs_permissions + where privilege = 'admin' + and object_id = :item_id + }] + set proc_result [lors_central::check_privilege -user_id $user_id -item_id $item_id] + aa_true "Check privilege proc when user has privilege" $proc_result + set proc_result [lors_central::check_privilege -user_id 0 -item_id $item_id] + aa_true "Check privilege proc when user has no privilege" [string equal $proc_result 0] + } +} + +aa_register_case lors_central_item_editable_info { + Check if sending an editable item returns the correct information + ** Requirements: + 1. One editable LO and one that isn't +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set rev_id [db_string get_item_id { + select max(revision_id) + from cr_revisions + where mime_type = 'text/html' and + revision_id in (select live_revision from cr_items) + }] + set item_id [lors_central::get_item_id -revision_id $rev_id] + set proc_result [lors_central::item_editable_info -item_id $item_id] + aa_true "Sending one editable item" [lindex $proc_result 3] + set rev_id [db_string get_item_id { + select max(revision_id) + from cr_revisions + where mime_type = 'image/gif' and + revision_id in (select live_revision from cr_items) + }] + set item_id [lors_central::get_item_id -revision_id $rev_id] + set proc_result [lors_central::item_editable_info -item_id $item_id] + aa_true "Sending one non editable item" [string equal [lindex $proc_result 3] 0] + } +} + + +aa_register_case lors_central_item_editable_p { + Check if sending an editable item returns the correct information + ** Requirements: + 1. One editable LO and one that isn't +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set rev_id [db_string get_item_id { + select max(revision_id) + from cr_revisions + where mime_type = 'text/html' and + revision_id in (select live_revision from cr_items) + }] + set item_id [lors_central::get_item_id -revision_id $rev_id] + set proc_result [lors_central::item_editable_p -item_id $item_id] + aa_true "Sending one editable item" $proc_result + set rev_id [db_string get_item_id { + select max(revision_id) + from cr_revisions + where mime_type = 'image/gif' and + revision_id in (select live_revision from cr_items) + }] + set item_id [lors_central::get_item_id -revision_id $rev_id] + set proc_result [lors_central::item_editable_p -item_id $item_id] + aa_true "Sending one non editable item" [string equal $proc_result 0] + } +} + +aa_register_case lors_central_package_install { + Check if the package creates the right folders and types + ** Requires + 1. lors-central package alreay installed +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set success_p [db_string check_folder { + select 1 + from cr_folders + where label = 'LORSM Root Folder'} -default 0] + aa_true "Folders created" $success_p + set success_p [db_string check_folder { + select 1 + from cr_folders + where label = 'LORSM Manifest Folder'} -default 0] + aa_true "Folders created" $success_p + set success_p [db_string check_folder { + select 1 + from cr_folders + where label = 'LORSM Organizations Folder'} -default 0] + aa_true "Folders created" $success_p + set success_p [db_string check_folder { + select 1 + from cr_folders + where label = 'LORSM Items Folder'} -default 0] + aa_true "Folders created" $success_p + set success_p [db_string check_folder { + select 1 + from cr_folders + where label = 'LORSM Resources Folder'} -default 0] + aa_true "Folders created" $success_p + } +} + +aa_register_case lors_central_imscp_manifest_add { + Checks if a new manifest_id is created + ** Requires + 1. Once course +} { + aa_run_with_teardown \ + -rollback \ + -test_code { + set man_id [db_string get_man_id {select max(man_id) from ims_cp_manifests}] + db_1row get_info { select * from ims_cp_manifests where man_id = :man_id } + set man_folder_id [db_string get_folder_id { + select folder_id + from cr_folders + where label = 'LORSM Manifest Folder'} -default 0] + + + set new_man_id [lors_central::imscp::manifest_add \ + -identifier $identifier\ + -course_name "test_check" \ + -version "" \ + -orgs_default $orgs_default\ + -hasmetadata $hasmetadata\ + -parent_man_id $parent_man_id\ + -isscorm $isscorm\ + -folder_id $folder_id\ + -package_id "" \ + -community_id "" \ + -user_id "" \ + -creation_ip "" \ + -version_id "" \ + -man_folder_id $man_folder_id] + + set success_p [db_string get_check { select 1 from ims_cp_manifests where man_id = :new_man_id } -default 0] + + aa_true "New man_id created" $success_p + } +} Index: openacs-4/packages/lors-central/www/add-exist-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/add-exist-item.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/add-exist-item.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,137 @@ +ad_page_contract { + Add one existent LO to a course + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + org_id:notnull + man_id:notnull + parent_item:notnull + ims_item_id:notnull + {sort_order ""} + item_man_id:notnull +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set the_ims_item_id $ims_item_id +set user_id [ad_conn user_id] + +db_transaction { + # Here we makee reference to the same res_id + set res_id [db_string get_res_id { }] + set identifierref [db_string get_identifierref { }] + + if { [empty_string_p $sort_order] } { + set max_sort_order [db_string get_max_sort_order { } ] + set sort_order [expr $max_sort_order + 1] + } else { + incr sort_order + } + + # First we are going to create a new cr_item (file) for the new resource + # We need the folder_id of the course to store the new item + set course_name [lors_central::get_course_name -man_id $man_id] + set root_folder [lors_central::get_root_folder_id] + set items_root_folder [lors_central::get_root_items_folder_id] + set folder_id [db_string get_folder_id { }] + set item_folder_id [db_string get_item_folder_id { }] + set item_name [db_string get_item_name { }] + set item_org_name $item_name + + # We are going to create a new item. First we are going to check + # if the name already exists to generate a new one + set item_name [lors_central::check_item_name -parent_id $folder_id -name $item_name] + set item_name [lors_central::check_item_name -parent_id $item_folder_id -name $item_name] + + ############################### + # We need to know where the new resource should be + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + + set new_res_item_id [content::item::new -name $item_name -creation_user $user_id \ + -parent_id $res_folder_id -content_type "ims_resource_object"] + + set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $item_name \ + -creation_user $user_id -is_live "t"] + + + # Now we have to update the new row in the ims_cp_resources using this new resource (new_res_id) + # we need a new href + set href [db_string get_res_href { select href from ims_cp_resources where res_id = :res_id }] + set identifier [db_string get_res_identifier { select identifier from ims_cp_resources where res_id = :res_id }] + + db_dml update_new_res { + update + ims_cp_resources + set + man_id = :man_id, + identifier = :identifier, + type = 'webcontent', + href = :href, + hasmetadata = 'f' + where + res_id = :new_res_rev_id + } + + # We need to make a copy of the rows on ims_cp_files + db_dml insert_files " + insert into ims_cp_files (select file_id,$new_res_rev_id,pathtofile,filename,hasmetadata from ims_cp_files where res_id = :res_id)" + + + + ############################################ + + # Now are going to create a new item (ims_cp_item) + # We need the folder_id of the course to store the new item + set root_ims_folder [lors_central::get_root_items_folder_id] + set items_folder_id [db_string get_items_folder_id { }] + + set new_ims_item_id [content::item::new -name $item_name -creation_user $user_id -parent_id $items_folder_id \ + -content_type "ims_item_object"] + set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $item_name -creation_user $user_id \ + -is_live "t"] + + # We need to insert in the ims_cp_items at the proper sort_order so we are going + # to rearrenge the items sort_order and then fill the information for the item + db_foreach get_items_to_reorder { } { + set new_sort [expr $order + 1] + db_dml reorder_items { } + } + + + db_dml update_ims_cp_items { + update ims_cp_items set + org_id = :org_id, + identifier = :item_name, + identifierref = :identifierref, + item_title = :item_org_name, + sort_order = :sort_order, + parent_item = :parent_item + where ims_item_id = :new_ims_rev_id + } + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_rev_id) + } + + # We also need to map this item to (ims_cp_items_map) + # We need to do it for every community that is associated to this course (man_id) + set com_list [db_list_of_lists get_community_id { + select distinct community_id from ims_cp_items_map + where man_id = :man_id + }] + foreach community_id $com_list { + db_dml insert_item { + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:new_ims_rev_id) + } + } +} + +ad_returnredirect "one-course?man_id=$man_id" \ No newline at end of file Index: openacs-4/packages/lors-central/www/add-exist-item.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/add-exist-item.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/add-exist-item.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,109 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="get_max_sort_order"> + <querytext> + select + max (sort_order) + from + ims_cp_items + where + org_id = :org_id + </querytext> +</fullquery> + +<fullquery name="get_items_to_reorder"> + <querytext> + select + sort_order as order, ims_item_id as reorder_item_id + from + ims_cp_items + where + org_id = :org_id + and sort_order >= :sort_order + </querytext> +</fullquery> + +<fullquery name="reorder_items"> + <querytext> + update + ims_cp_items + set + sort_order = :new_sort + where + ims_item_id = :reorder_item_id + </querytext> +</fullquery> + +<fullquery name="get_item_name"> + <querytext> + select + item_title + from + ims_cp_items + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="get_folder_id"> + <querytext> + select + item_id + from + cr_items + where + name = :course_name and + parent_id = :root_folder + </querytext> +</fullquery> + +<fullquery name="get_item_folder_id"> + <querytext> + select + item_id + from + cr_items + where + name = :course_name and + parent_id = :items_root_folder + </querytext> +</fullquery> + +<fullquery name="get_items_folder_id"> + <querytext> + select + item_id + from + cr_items + where + name = :course_name and + parent_id = :root_ims_folder + </querytext> +</fullquery> + +<fullquery name="get_res_id"> + <querytext> + select + r.res_id + from + ims_cp_items_to_resources i, ims_cp_resources r + where + i.ims_item_id = :the_ims_item_id + and r.man_id = :item_man_id + and r.res_id = i.res_id + </querytext> +</fullquery> + +<fullquery name="get_identifierref"> + <querytext> + select + identifier + from + ims_cp_resources + where + res_id = :res_id + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/add-lo.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/add-lo.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/add-lo.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,6 @@ +<master> +<property name="title">@page_title;noquote@</property> +<property name="context">@context;noquote@</property> + +<h3>#lors-central.add_from_clip#</h3> +<include src="/packages/lors-central/lib/clipboard" action_url="@clipboard_add_url@" action_label="#lors-central.add_to_course#" type="resource"> \ No newline at end of file Index: openacs-4/packages/lors-central/www/add-lo.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/add-lo.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/add-lo.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,114 @@ +ad_page_contract { + Display all shared items for adding + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:notnull + org_id:notnull + {sort_order ""} + parent_item:notnull + {ims_item_id ""} + clipboard_object_id:optional +} + +set user_id [ad_conn user_id] + +# Checking swa privilege over lors-central +lors_central::is_swa + +set new_lo_link "man_id=$man_id&org_id=$org_id&parent=$parent_item" +set page_title [_ lors-central.add_an_existent] +set context "[list [list "one-course?man_id=$man_id" [_ lors-central.one_course]] [list "new-learning-object?$new_lo_link" [_ lors-central.new_object]] $page_title]" + + +if {[exists_and_not_null clipboard_object_id]} { + db_transaction { + if { [empty_string_p $sort_order] } { + set max_sort_order [db_string get_max_sort_order { } ] + set sort_order [expr $max_sort_order + 1] + } else { + incr sort_order + } + set course_name [lors_central::get_course_name -man_id $man_id] + set root_folder [lors_central::get_root_folder_id] + set folder_id [db_string get_folder_id { }] + set clipboard_object_item_id [lors_central::get_item_id -revision_id $clipboard_object_id] + set item [content::item::get -item_id $clipboard_object_item_id -array_name original_item] + if { !$item } { + ad_return_complaint 1 "No Item associated to this object" + ad_script_abort + } + + # We get the identifier from the clipped resource + set identifierref [db_string get_res_identifier { } -default ""] + set href [db_string get_res_href { } -default ""] + + # We get the item_title and identifier that the clipped object has associated + set item_title [db_string get_item_title { } -default "Untitled"] + set identifier [db_string get_item_title { } -default "Untitled"] + + # No item, create a new one + # We need to know where the new resource should be + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + + # We check the name + set item_title [lors_central::check_item_name -parent_id $res_folder_id -name $item_title] + + set new_res_rev_id $clipboard_object_id + + # Now are going to create a new item (ims_cp_item) + # We need the folder_id of the course to store the new item + set root_ims_folder [lors_central::get_root_items_folder_id] + set items_folder_id [db_string get_items_folder_id { }] + + # We check the name and create a new item + set item_title [lors_central::check_item_name -parent_id $items_folder_id -name $item_title] + set new_ims_item_id [content::item::new -name $item_title -creation_user $user_id -parent_id $items_folder_id \ + -content_type "ims_item_object"] + set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $item_title \ + -creation_user $user_id -is_live "t"] + + # We need to insert in the ims_cp_items at the proper sort_order so we are going + # to rearrenge the items sort_order and then fill the information for the item + db_foreach get_items_to_reorder { } { + set new_sort [expr $order + 1] + db_dml reorder_items { } + } + db_dml update_ims_cp_items { + update ims_cp_items set + org_id = :org_id, + identifier = :identifier, + identifierref = :identifierref, + parent_item = :parent_item, + item_title = :item_title, + sort_order = :sort_order + where ims_item_id = :new_ims_rev_id + } + + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_rev_id) + } + + } + set com_list [db_list_of_lists get_community_id { + select distinct community_id from ims_cp_items_map + where man_id = :man_id + }] + foreach community_id $com_list { + db_dml insert_item { + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:new_ims_rev_id) + } + } + + ad_returnredirect [export_vars -base "one-learning-object" {man_id {ims_item_id $new_ims_rev_id}}] +} + +set clipboard_add_url [export_vars -base "add-lo" {man_id ims_item_id org_id sort_order parent_item}] + Index: openacs-4/packages/lors-central/www/add-lo.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/add-lo.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/add-lo.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,133 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="get_max_sort_order"> + <querytext> + select + max (sort_order) + from + ims_cp_items + where + org_id = :org_id + </querytext> +</fullquery> + +<fullquery name="get_folder_id"> + <querytext> + select + item_id + from + cr_items + where + name = :course_name and + parent_id = :root_folder + </querytext> +</fullquery> + +<fullquery name="get_res_identifier"> + <querytext> + select + identifier + from + ims_cp_resources + where + res_id = :clipboard_object_id + </querytext> +</fullquery> + +<fullquery name="get_res_href"> + <querytext> + select + href + from + ims_cp_resources + where + res_id = :clipboard_object_id + </querytext> +</fullquery> + +<fullquery name="get_item_title"> + <querytext> + select + item_title + from + ims_cp_items + where + ims_item_id = ( select + min (ims_item_id) + from + ims_cp_items_to_resources + where + res_id = :clipboard_object_id ) + </querytext> +</fullquery> + +<fullquery name="get_item_identifier"> + <querytext> + select + identifier + from + ims_cp_items + where + ims_item_id = ( select + ims_item_id + from + ims_cp_items_to_resources + where + res_id = :clipboard_object_id ) + </querytext> +</fullquery> + +<fullquery name="get_items_folder_id"> + <querytext> + select + item_id + from + cr_items + where + name = :course_name and + parent_id = :root_ims_folder + </querytext> +</fullquery> + +<fullquery name="copy_files"> + <querytext> + insert into ims_cp_files ( + select + file_id, + :new_res_rev_id, + pathtofile, + filename, + hasmetadata + from + ims_cp_files + where + res_id = :clipboard_object_id + ) + </querytext> +</fullquery> + +<fullquery name="get_items_to_reorder"> + <querytext> + select + sort_order as order, ims_item_id as reorder_item_id + from + ims_cp_items + where + org_id = :org_id + and sort_order >= :sort_order + </querytext> +</fullquery> + +<fullquery name="reorder_items"> + <querytext> + update + ims_cp_items + set + sort_order = :new_sort + where + ims_item_id = :reorder_item_id + </querytext> +</fullquery> + +</queryset> Index: openacs-4/packages/lors-central/www/change-lo-version.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/change-lo-version.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/change-lo-version.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,38 @@ +ad_page_contract { + Change the live revision to revision_id + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation_date 28-03-2005 +} { + ims_item_id:integer,notnull + item_id:integer,notnull + name:optional + man_id:notnull + live_hide_p:notnull +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +if { ![info exist name] } { + set name [db_string get_name { select item_title from ims_cp_items where ims_item_id = :ims_item_id }] +} + +if { [string equal $live_hide_p "live"] } { + db_dml make_live_item { + update ims_cp_items_map + set ims_item_id = :ims_item_id, hide_p = 'f' + where man_id = :man_id and + ims_item_id in ( select revision_id from cr_revisions where item_id = :item_id) + } +} else { + db_dml hide_item { + update ims_cp_items_map + set hide_p = 't' + where man_id = :man_id and + ims_item_id in ( select revision_id from cr_revisions where item_id = :item_id) + } +} + +ad_returnredirect "one-learning-object?ims_item_id=$ims_item_id&man_id=$man_id&name=$name" \ No newline at end of file Index: openacs-4/packages/lors-central/www/change-one-lo-version.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/change-one-lo-version.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/change-one-lo-version.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,29 @@ +ad_page_contract { + Changes the version of the LO that one user will see on each class + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:integer,notnull + name:notnull + ims_item_id:integer,notnull + objects_id:multiple + objects_value:multiple +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +# object_id: A list of communities ids +# object_value: The version number to set the revision + +set i 0 +foreach object_id $objects_id { + set object_value [lindex $objects_value $i] + lors_central::change_one_lo_version -ver_num $object_value -community_id $object_id \ + -man_id $man_id -ims_item_id $ims_item_id + incr i +} + + +ad_returnredirect "one-learning-object?ims_item_id=$ims_item_id&man_id=$man_id&name=$name" + Index: openacs-4/packages/lors-central/www/change-one-version.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/change-one-version.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/change-one-version.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,39 @@ +ad_page_contract { + Changes versions of courses according to the number set on "Set to" + +} { + item_id:integer,notnull + objects_count:multiple + objects_id:multiple + objects_value:multiple +} -validate { + equal_length_lists -requires {objects_id:notnull objects_value:notnull } { + if { ![string equal [llength $objects_id] [llength $objects_value]]} { + ad_complain "You must supply all values for <b>Set to</b>" + } + } +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +# Validation of Range +set i 0 + +foreach object $objects_value { + if { $object < 1 || [lindex $objects_count $i] < $object } { + ad_return_complaint 1 "You must enter the right version number for <b>Set to</b>" + ad_script_abort + } + incr i +} + + +set i 0 +foreach object_id $objects_id { + set object_value [lindex $objects_value $i] + lors_central::change_version -ver_num $object_value -community_id $object_id -item_id $item_id + incr i +} + +ad_returnredirect "one-course-associations?item_id=$item_id" \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-add-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-add-2.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-add-2.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,42 @@ +<master> +<property name="context">@context;noquote@</property> + +<p> + +<h2>#lorsm.lt_Preliminary_informati#</h2> +<p> + + +<listtemplate name="d_info"></listtemplate> +<p> +<if @isSCORM@ eq 1> + <font color="green">#lorsm.lt_The_uploaded_file_is_# <b>#lorsm.lt_SCORM_complaint_packa#</b></font> + <p> +</if> +<p> + +<if @isSCORM@ eq 1> +<h3>#lorsm.SCORM_Package_Info#</h3> +<listtemplate name="d_SCORM_package_info"></listtemplate> +<p> +</if> + + +<if @isSCORM@ eq 0> +<h3>#lorsm.IMS_Package_Info#</h3> + <if @isBB@ eq 1> + <font color="green" size=\"-1\"> #lorsm.lt_The_uploaded_file_is_# <b>#lorsm.lt_Blackboard_6_complain#</b>.</font> + <p> + </if> + +<listtemplate name="d_IMS_package_info"></listtemplate> +<p> +</if> +<small><b>#lorsm.Note#</b>#lorsm._the_package_has# <b>#lorsm.not_yet#</b> #lorsm.lt_being_added_to_the_Le# + + +<formtemplate id=course_upload></formtemplate> + + + + Index: openacs-4/packages/lors-central/www/course-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-add-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-add-2.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,378 @@ +ad_page_contract { + Upload an IMS Content Package + + Scope: + + 1.- Uploads file + 2.- Unzip file + 3.- Finds imsmanifest.xml + 4.- Displays basic imsmanifest.xml information + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 19 March 2003 + @cvs-id $Id: course-add-2.tcl,v 1.1 2005/05/17 16:21:19 miguelm Exp $ +} { + upload_file:trim,optional + upload_file.tmpfile:optional,tmpfile + course_id:integer,notnull + indb_p:integer,notnull + man_id:optional + +} -validate { + non_empty -requires {upload_file.tmpfile:notnull} { + if {![empty_string_p $upload_file] && (![file exists ${upload_file.tmpfile}] || [file size ${upload_file.tmpfile}] < 4)} { + ad_complain "[_ lorsm.lt_The_upload_failed_or_]" + } + } +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +# To support versions +if { ![info exist man_id] } { + set man_id "" +} + +# Permissions +set user_id [ad_conn user_id] +# dotlrn::require_user_admin_community -user_id $user_id -community_id [dotlrn_community::get_community_id] + +# unzips the file +if { ![empty_string_p $upload_file] && + [ catch {set tmp_dir [lors::imscp::expand_file $upload_file ${upload_file.tmpfile} lors-imscp-$course_id] } errMsg] } { + ad_return_complaint 1 "[_ lorsm.lt_The_uploaded_file_doe]" + ad_script_abort +} + +# if it is not blank... +if {![empty_string_p $upload_file]} { + ns_log Debug "LORS Package: made directory $tmp_dir to extract from ${upload_file.tmpfile} ($upload_file)\n" + set allfiles [lors::imscp::dir_walk $tmp_dir] + +} else { + set allfiles [lors::imscp::dir_walk $directory] + +} + +# Get LORSM Root folder_id +set folder_id [lors_central::get_root_folder_id] + + +# search for manifest file +set file imsmanifest.xml + +set manifest [lors::imscp::findmanifest $tmp_dir $file] + +# see if the file actually is where it suppose to be. Othewise abort +if {$manifest == 0} { + lors::imscp::deltmpdir $tmp_dir + ad_return_complaint 1 "[_ lorsm.lt_There_is_no_file_with_1]" +} + + +# Is this a Blackboard6 package? +set isBB [lors::imscp::bb6::isBlackboard6 -tmp_dir $tmp_dir] + +if {$isBB == 1} { + # we generate metadata for the file + ns_log Notice "Generating MD record from Blackboard6 package $tmp_dir --" + lors::imscp::bb6::create_MD -tmp_dir $tmp_dir -file $file + ns_log Notice "Done!" + +} + +## adds folder to the CR +set parent_id $folder_id +set fs_dir $tmp_dir + +# checks for write permission on the parent folder +ad_require_permission $parent_id write + +# get their IP +set creation_ip [ad_conn peeraddr] + +# checks whether the directory given actually exists +if {[file exists $fs_dir]} { + set all_files [list] + # now that exists, let's create it on the CR + + ## Create lists and multirows + multirow create element_nodes element attributes + + template::list::create \ + -name d_info \ + -multirow d_info \ + -no_data "[_ lorsm.No_Information]" \ + -elements { + col1 { + label "" + html {valign top style "background-color: #e0e0e0; font-weight: bold;"} + } + col2 { + label "" + html {valign top style "background-color: #f0f0f0; font-weight: bold;"} + } + } + + multirow create d_info col1 col2 + + + template::list::create \ + -name d_IMS_package_info \ + -multirow d_IMS_package_info \ + -no_data "[_ lorsm.lt_No_IMS_Package_struct]" \ + -elements { + organizations { + label "[_ lorsm.Organizations]" + html {valign top align center} + } + items { + label "[_ lorsm.Items]" + html {valign top align center} + } + resources { + label "[_ lorsm.Resources]" + html {valign top align center} + } + files { + label "[_ lorsm.Files]" + html {valign top align center} + } + } + + multirow create d_IMS_package_info organizations items resources files + + template::list::create \ + -name d_SCORM_package_info \ + -multirow d_SCORM_package_info \ + -no_data "[_ lorsm.No_Items]" \ + -elements { + scos { + label "[_ lorsm.SCOs]" + html {valign top} + } + assets { + label "[_ lorsm.Assets]" + html {valign top} + } + sharableresources { + label "[_ lorsm.Sharable_Resources]" + html {valign top} + } + files { + label "[_ lorsm.files]" + html {valign top} + } + } + + multirow create d_SCORM_package_info scos assets sharableresources files + + ## Opens imsmanifest.xml + + # open manifest file with tDOM + set doc [dom parse [read [open $manifest]]] + # gets the manifest tree + set manifest [$doc documentElement] + + # gets metadata node + set metadata [$manifest child all metadata] + + # DETECT SCORM OR IMS CP + set isSCORM [lors::imscp::isSCORM -node $manifest] + + ## Gets manifest title + + if { ![empty_string_p $metadata] } { + + # gets metadataschema + set MetadataSchema [lindex [lindex [lors::imsmd::getMDSchema $metadata] 0] 0] + set MetadataSchemaVersion [lindex [lors::imsmd::getMDSchema $metadata] 1] + set lom [lindex [lors::imsmd::getLOM $metadata $tmp_dir] 0] + set prefix [lindex [lors::imsmd::getLOM $metadata $tmp_dir] 1] + + if { $lom != 0 } { + # Get title + set manifest_title_lang [lindex [lindex [lors::imsmd::mdGeneral -element title -node $lom -prefix $prefix] 0] 0] + set manifest_title [lindex [lindex [lors::imsmd::mdGeneral -element title -node $lom -prefix $prefix] 0] 1] + # set context + set context "[_ lorsm.lt_Importing_manifest_ti]" + + ## Gets manifest description + + set manifest_descrip_lang [lindex [lindex [lors::imsmd::mdGeneral -element description -node $lom -prefix $prefix] 0] 0] + set manifest_descrip [lindex [lindex [lors::imsmd::mdGeneral -element description -node $lom -prefix $prefix] 0] 1] + + # adds course information for display + multirow append d_info "Manifest Title: " "\[$manifest_title_lang\] $manifest_title " + multirow append d_info "Metadata Type: " [concat $MetadataSchema $MetadataSchemaVersion] + if {![empty_string_p $manifest_descrip]} { + multirow append d_info "Description: " "\[$manifest_descrip_lang\] $manifest_descrip" + } + # Gets Rights info + set copyright [lors::imsmd::mdRights -element copyrightandotherrestrictions -node $lom -prefix $prefix] + if { $copyright != 0 } { + set copyright_s [lindex [lindex [lindex $copyright 0] 0] 1] + set copyright_v [lindex [lindex [lindex $copyright 0] 1] 1] + set cr_descrip [lors::imsmd::mdRights -element description -node $lom -prefix $prefix] + set cr_descrip_s [lindex [lindex $cr_descrip 0] 1] + + multirow append d_info "Copyrighted?: " "\[$copyright_s\] $copyright_v" + multirow append d_info "Copyrighted Description: " "$cr_descrip_s" + + } else { + multirow append d_info "Copyrighted?: " "Information not available" + } + } else { + # Didn't find LOM although it did find the Metadata schema and + # version + regexp {([^/\\]+)$} $tmp_dir match manifest_title + set context "[_ lorsm.lt_Importing_No_Metadata]" + } + } else { + # manifest title doesn't exist, so we create one for it. + regexp {([^/\\]+)$} $tmp_dir match manifest_title + set context "[_ lorsm.lt_Importing_No_Metadata]" + } + + + # Gets the organizations + + set organizations [$manifest child all organizations] + + if { ![empty_string_p $organizations] } { + + set num_organizations [$organizations child all organization] + + multirow append d_info "Number of Organizations: " [llength $num_organizations] + + set items 0 + + foreach organization $num_organizations { + + set items [expr $items + [lors::imscp::countItems $organization]] + + } + multirow append d_info "Number of Items: " $items + } + + # gets the resources + set resources [$manifest child all resources] + + # Complain if there's no resources + if {[empty_string_p $resources]} { + ad_return_complaint 1 "[_ lorsm.lt_The_package_you_are_t_1]" + ad_script_abort + } + + set resourcex [$resources child all resource] + + if { $isSCORM == 1 } { + # The imsmanifest.xml file contains a SCORM course + + # extract all the resources and files + set scos 0 + set assets 0 + set sharableresources 0 + set files 0 + + if { ![empty_string_p $resources] } { + + foreach resourcex [$resources child all resource] { + + # gets the type of resource + set resource_scormtype [string tolower [lors::imsmd::getAtt $resourcex adlcp:scormtype]] + + switch $resource_scormtype { + sco { + incr scos + } + asset { + incr assets + } + sharableresource { + incr sharableresources + } + } + + set files [expr $files + [llength [lors::imsmd::getResource -node $resourcex -att files]]] + + } + } + + multirow append d_SCORM_package_info $scos $assets $sharableresources $files + + + + # end isSCORM if + } else { + # The imsmanifest.xml file corresponds to a IMS CP (but not SCORM) + + set files 0 + if { ![empty_string_p $resourcex] } { + + foreach resource $resourcex { + set files [expr $files + [llength [lors::imsmd::getResource -node $resource -att files]]] + } + } + multirow append d_IMS_package_info [llength $num_organizations] $items [llength $resourcex] $files + + } + + +} else { + # Error MSG here + ad_return_complaint 1 "[_ lorsm.lt_There_has_been_a_prob]" + ad_script_abort + +} + +template::form create course_upload -action course-add-3 \ + -display_buttons { {"[_ lorsm.Upload_Course]" upload_course} } \ + -html {enctype multipart/form-data} \ + -mode edit \ + -cancel_url "[_ lorsm.index]" + + +template::element create course_upload course_name \ + -label "[_ lorsm.Course_Name]" -datatype text -widget text -help_text "[_ lorsm.lt_This_is_the_name_the_]" \ + -maxlength 200 + +template::element create course_upload course_id \ + -label "[_ lorsm.course_id]" -datatype integer -widget hidden + +template::element create course_upload indb_p \ + -label "[_ lorsm.indb_p]" -datatype integer -widget hidden + +template::element create course_upload tmp_dir \ + -label "[_ lorsm.tmp_dir]" -datatype text -widget hidden -optional + +template::element create course_upload folder_id \ + -label "[_ lorsm.folder_id]" -datatype integer -widget hidden -optional + +template::element create course_upload isSCORM \ + -label "[_ lorsm.isSCORM]" -datatype integer -widget hidden -optional + + +if { ![empty_string_p $man_id] } { + set version_id [db_string get_version_id "select item_id from cr_revisions where revision_id = :man_id"] + template::element create course_upload version_id -datatype integer -widget hidden -optional + template::element set_properties course_upload version_id -value $version_id +} + +template::element set_properties course_upload course_id -value $course_id + +template::element set_properties course_upload indb_p -value $indb_p + +template::element set_properties course_upload tmp_dir -value $tmp_dir + +template::element set_properties course_upload folder_id -value $folder_id + +template::element set_properties course_upload isSCORM -value $isSCORM + +template::element set_properties course_upload course_name -value $manifest_title + + + + + Index: openacs-4/packages/lors-central/www/course-add-3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-add-3.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-add-3.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,57 @@ +<master> +<property name="context">@context;noquote@</property> + +<p> + +<h2>#lorsm.lt_Preliminary_informati#</h2> +<p> + +<blockquote> +<listtemplate name="d_info"></listtemplate> +<p> +<if @isSCORM@ eq 1> + <font color="green">#lorsm.lt_The_uploaded_file_is_# <b>#lorsm.lt_SCORM_complaint_packa#</b></font> + <p> +</if> +<small><b>#lorsm.Note#</b>#lorsm._the_package_has# <b>#lorsm.not_yet#</b> #lorsm.lt_being_added_to_the_Le# +<p> + +<h2>#lorsm.Organizations#</h2> +<listtemplate name="d_orgs"></listtemplate> +<p> + +<blockquote> +<h3>#lorsm.Items#</h3> +<listtemplate name="d_items"></listtemplate> +</blockquote> +<p> + + +<if @isSCORM@ eq 1> +<h3>#lorsm.SCOs#</h3> +<listtemplate name="d_scos"></listtemplate> +<p> + +<h3>#lorsm.Assets#</h3> +<listtemplate name="d_assets"></listtemplate> +<p> +</if> + + +<if @isSCORM@ eq 0> +<h3>#lorsm.Resources#</h3> +<listtemplate name="d_resources"></listtemplate> +<p> +</if> +</blockquote> + +<listtemplate name="d_all_files"></listtemplate> + +<blockquote> +@l_files@ +</blockquote> + +<p> +@all_files@ + + Index: openacs-4/packages/lors-central/www/course-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-add-3.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-add-3.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,692 @@ +ad_page_contract { + Upload an IMS Content Package 3 + + Scope: + + Add files to the CR + Process imsmanifest.xml + Determines this is a Blackboard course and if it is process it accordingly. + Inserts all ims_items, resources and all IMS CP entities into the DB. + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 19 March 2003 + @cvs-id $Id: course-add-3.tcl,v 1.1 2005/05/17 16:21:19 miguelm Exp $ +} { + folder_id:integer,notnull + tmp_dir:optional,notnull + course_id:integer,notnull + course_name:notnull + indb_p:integer,notnull + {version_id:integer ""} + +} -validate { + non_empty -requires {upload_file.tmpfile:notnull} { + if {![empty_string_p $upload_file] && (![file exists ${upload_file.tmpfile}] || [file size ${upload_file.tmpfile}] < 4)} { + ad_complain "[_ lorsm.lt_The_upload_failed_or_]" + } + } +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +#check permission +set user_id [ad_conn user_id] +# ad_require_permission $folder_id admin + +# Display progress bar +ad_progress_bar_begin \ + -title "[_ lorsm.Uploading_course]" \ + -message_1 "[_ lorsm.lt_Uploading_and_process]" \ + -message_2 "[_ lorsm.lt_We_will_continue_auto]" + + +ns_write "<h2>[_ lorsm.lt_Initiating_Updating_l]</h2><blockquote>" + +# Is this a Blackboard6 package? +set isBB [lors::imscp::bb6::isBlackboard6 -tmp_dir $tmp_dir] + +if {$isBB == 1} { + ns_write "<p><font color=\"red\"><b>[_ lorsm.lt_Blackboard6_Content_P]</b></font>.<br> [_ lorsm.lt_Modifying_package_to_]" + ns_write "<blockquote><br> [_ lorsm.lt_Cleaning_up_unused_ap]" + lors::imscp::bb6::clean_items -tmp_dir $tmp_dir -file "imsmanifest.xml" + ns_write "<font color=\"green\"><b>[_ lorsm.Done]</b></font>" + ns_write "<br> [_ lorsm.lt_Renaming_content_type]" + lors::imscp::bb6::extract_html -tmp_dir $tmp_dir -file "imsmanifest.xml" + ns_write "<font color=\"green\"><b>[_ lorsm.Done]</b></font></blockquote>" + +} + + +ns_write "<h3> [_ lorsm.lt_Starting_File_Process] </h3>" + +db_transaction { + + ## adds folder to the CR + set parent_id $folder_id + set fs_dir $tmp_dir + + # checks for write permission on the parent folder + ad_require_permission $parent_id write + + # get their IP + set creation_ip [ad_conn peeraddr] + + # checks whether the directory given actually exists + if {[file exists $fs_dir]} { + set all_files [list] + # now that exists, let's create it on the CR + + # gets rid of the path and leaves the name of the directory + # if course_name is changed, then use that name. Otherwise it will use the default folder name given + if {![empty_string_p $course_name]} { + regexp {([^/\\]+)$} $course_name match cr_dir + } else { + regexp {([^/\\]+)$} $fs_dir match cr_dir + } + + #set new_parent_id [lors::cr::add_folder -parent_id $parent_id -folder_name $cr_dir] + + ############################################################################ + # Add all the folders that will store all the webcontent (files) in th CR + + # Add new folder to store the webcontent (Same as it was with file-storage) + set new_parent_id [content::folder::new -name $cr_dir -label $cr_dir -parent_id $parent_id] + content::folder::register_content_type -folder_id $new_parent_id -content_type "content_revision" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $new_parent_id -content_type "content_folder" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $new_parent_id -content_type "content_symlink" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $new_parent_id -content_type "content_extlink" \ + -include_subtypes "t" + + # Add new folders to store the manifest, organizations, items, resources items (replacing acs_objects) + # Manifest + set man_parent_id [lors_central::get_folder_id -name "LORSM Manifest Folder"] + set man_folder_id [content::folder::new -name $cr_dir -label $cr_dir -parent_id $man_parent_id] + content::folder::register_content_type -folder_id $man_folder_id -content_type "ims_manifest_object" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $man_folder_id -content_type "content_revision" \ + -include_subtypes "t" + + # Organizations + set org_parent_id [lors_central::get_folder_id -name "LORSM Organizations Folder"] + set org_folder_id [content::folder::new -name $cr_dir -label $cr_dir -parent_id $org_parent_id] + content::folder::register_content_type -folder_id $org_folder_id -content_type "ims_organization_object" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $org_folder_id -content_type "content_revision" \ + -include_subtypes "t" + + set itm_parent_id [lors_central::get_folder_id -name "LORSM Items Folder"] + set itm_folder_id [content::folder::new -name $cr_dir -label $cr_dir -parent_id $itm_parent_id] + content::folder::register_content_type -folder_id $itm_folder_id -content_type "ims_item_object" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $itm_folder_id -content_type "content_revision" \ + -include_subtypes "t" + + set res_parent_id [lors_central::get_folder_id -name "LORSM Resources Folder"] + set res_folder_id [content::folder::new -name $cr_dir -label $cr_dir -parent_id $res_parent_id] + content::folder::register_content_type -folder_id $res_folder_id -content_type "ims_resource_object" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $res_folder_id -content_type "content_revision" \ + -include_subtypes "t" + + ############################ + # Store the files in the CR + + set filesx [lors_central::cr::add_files -parent_id $new_parent_id -indb_p $indb_p \ + -files [lors::cr::has_files -fs_dir $fs_dir]] + + + set all_files [concat $all_files $filesx] + + # get all the directories and files under those dirs + + set dirs [lors::cr::has_dirs -fs_dir $fs_dir] + + set base_parent_id $new_parent_id + + # dirx = directory loop + set dirx [list "$base_parent_id [list $dirs]"] + + # for each directory found.. + while {[llength $dirx] != 0} { + set collector [list] + foreach dir $dirx { + # if the dirx loop is 0... + set base_parent_id [lindex $dir 0] + + foreach subdir [lindex $dir 1] { + + # remove all path + regexp {([^/\\]+)$} $subdir match cr_dir + + # add the folder to the CR + ns_write "[_ lorsm.Processing_folder]<img src=\"/resources/file-storage/folder.gif\">: <b>$cr_dir</b> <br>" + + ################################ + # Add new sub-folder to the CR + + set new_cr_folder_id [content::folder::new -name $cr_dir -parent_id $base_parent_id -label $cr_dir] + content::folder::register_content_type -folder_id $new_cr_folder_id -content_type "content_revision"\ + -include_subtypes "t" + content::folder::register_content_type -folder_id $new_cr_folder_id -content_type "content_folder" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $new_cr_folder_id -content_type "content_symlink" \ + -include_subtypes "t" + content::folder::register_content_type -folder_id $new_cr_folder_id -content_type "content_extlink" \ + -include_subtypes "t" + + + lappend collector "$new_cr_folder_id [list [lors::cr::has_dirs -fs_dir $subdir]]" + + # add files (if any) + set files [lors::cr::has_files -fs_dir $subdir] + + #For display purposes + ns_write "[_ lorsm.Processing_files]<blockquote>" + foreach file $files { + set tempval [regsub $tmp_dir $file {}] + ns_write "<img src=\"/resources/file-storage/file.gif\"> $tempval<font color=\"green\">[_ acs-kernel.common_OK]</font><br>" + } + ns_write "</blockquote>" + # + + if ![empty_string_p $files] { + + ####################### + # Add files to the CR + + set filesx [lors_central::cr::add_files -parent_id $new_cr_folder_id -files $files -indb_p $indb_p] + set all_files [concat $all_files $filesx] + } + + } + } + if {[llength $collector] == 0} { + # then just add the name of the directories + set dirx $collector + } else { + # otherwise, then just add the new directories to the queue + set dirx + set dirx $collector + } + } + + ## Finish adding files to the CR. + ## Now we start processing the imsmanifest.xml file + + ns_write "<p>[_ lorsm.Now_processing]<code>imsmanifest.xml</code> [_ lorsm.file]" + ## Opens imsmanifest.xml + + # open manifest file with tDOM + set doc [dom parse [read [open $tmp_dir/imsmanifest.xml]]] + # gets the manifest tree + set manifest [$doc documentElement] + + # Gets manifest characteristics + set man_identifier [lors::imsmd::getAtt $manifest identifier] + set man_version [lors::imsmd::getAtt $manifest version] + + # DETECT SCORM OR IMS CP + # NOTE: it requires that the manifest contains a metadata record (which is not always the case) :-( + ## + + # gets metadata node + set metadata [$manifest child all metadata] + + if { ![empty_string_p $metadata] } { + # gets metadataschema + set MetadataSchema [lindex [lindex [lors::imsmd::getMDSchema $metadata] 0] 0] + set MetadataSchemaVersion [lindex [lors::imsmd::getMDSchema $metadata] 1] + if {![empty_string_p $MetadataSchema]} { + set isSCORM [regexp -nocase scorm $MetadataSchema] + } + if {$isSCORM == 1} { + set man_isscorm 1 + } else { + set man_isscorm 0 + } + } else { + set man_isscorm 0 + } + + if { ![empty_string_p $metadata] } { + set man_hasmetadata 1 + } else { + set man_hasmetadata 0 + } + + + ## Gets manifest title + + if { ![empty_string_p $metadata] } { + set lom [lindex [lors::imsmd::getLOM $metadata $tmp_dir] 0] + set prefix [lindex [lors::imsmd::getLOM $metadata $tmp_dir] 1] + if { $lom != 0 } { + # Get title + set manifest_title_lang [lindex [lindex [lors::imsmd::mdGeneral -element title -node $lom -prefix $prefix] 0] 0] + set manifest_title [lindex [lindex [lors::imsmd::mdGeneral -element title -node $lom -prefix $prefix] 0] 1] + # set context + set context "[_ lorsm.lt_Importing_manifest_ti]" + + ## Gets manifest description + + set manifest_descrip_lang [lindex [lindex [lors::imsmd::mdGeneral -element description -node $lom -prefix $prefix] 0] 0] + set manifest_descrip [lindex [lindex [lors::imsmd::mdGeneral -element description -node $lom -prefix $prefix] 0] 1] + + # adds course information for display + + # Gets Rights info + set copyright [lors::imsmd::mdRights -element copyrightandotherrestrictions -node $lom -prefix $prefix] + if { ![empty_string_p $copyright] } { + set copyright_s [lindex [lindex [lindex $copyright 0] 0] 1] + set copyright_v [lindex [lindex [lindex $copyright 0] 1] 1] + set cr_descrip [lors::imsmd::mdRights -element description -node $lom -prefix $prefix] + set cr_descrip_s [lindex [lindex $cr_descrip 0] 1] + + } + + } else { + set context "[_ lorsm.lt_Importing_No_Metadata]" + } + + } + + + + # Gets the organizations + + set organizations [$manifest child all organizations] + set man_orgs_default [lors::imsmd::getAtt $organizations default] + + set man_id [lors_central::imscp::manifest_add \ + -course_name $course_name \ + -identifier $man_identifier \ + -version $man_version \ + -orgs_default $man_orgs_default \ + -hasmetadata $man_hasmetadata \ + -isscorm $man_isscorm \ + -folder_id $new_parent_id \ + -community_id "" \ + -man_folder_id $man_folder_id \ + -version_id $version_id ] + + ns_write "[_ lorsm.lt_Granting_permissions__1 [list course_name $course_name]]<br>" + + # PERMISSIONS FOR MANIFEST and learning objects + + # set up in the same way as permissions for the file storage + # objects. As we want to maintain consistency btw the + # learnining objects and their content + + # Disable folder permissions inheritance + permission::toggle_inherit -object_id $man_id + + # Set read permissions for community/class dotlrn_member_rel + + # set community_id [dotlrn_community::get_community_id] + + # set party_id_member [db_string party_id {select segment_id from rel_segments \ + where group_id = :community_id \ + and rel_type = 'dotlrn_member_rel'}] + + # permission::grant -party_id $party_id_member -object_id $man_id -privilege read + + # Set read permissions for community/class dotlrn_admin_rel + + # set party_id_admin [db_string party_id {select segment_id from rel_segments \ + where group_id = :community_id \ + and rel_type = 'dotlrn_admin_rel'}] + + # permission::grant -party_id $party_id_admin -object_id $man_id -privilege read + + # Set read permissions for *all* other professors within .LRN + # (so they can see the content) + + set party_id_professor [db_string party_id {select segment_id from rel_segments \ + where rel_type = 'dotlrn_professor_profile_rel'}] + + permission::grant -party_id $party_id_professor -object_id $man_id -privilege read + + # Set read permissions for *all* other admins within .LRN + # (so they can see the content) + + set party_id_admins [db_string party_id {select segment_id from rel_segments \ + where rel_type = 'dotlrn_admin_profile_rel'}] + + permission::grant -party_id $party_id_admins -object_id $man_id -privilege read + + + # Done with Manifest and learning object Permissions + + + ns_write "[_ lorsm.lt_Adding_course_name_Ma [list course_name $course_name]]<br>" + + if {$man_hasmetadata == 1} { + # adds manifest metadata + set aa [lors::imsmd::addMetadata \ + -acs_object $man_id \ + -node $metadata \ + -dir $tmp_dir] + + ns_write "[_ lorsm.lt_Adding_Manifest_Metad]<br>" + + } + + + if { ![empty_string_p $organizations] } { + + # for multiple organizations + set add [list] + foreach organization [$organizations child all organization] { + + set org_identifier [lors::imsmd::getResource -node $organization -att identifier] + + set org_identifier [lors::imsmd::getResource -node $organization -att identifier] + set org_structure [lors::imsmd::getResource -node $organization -att structure] + if {![empty_string_p [$organization child all title]]} { + set org_title [lors::imsmd::getElement [$organization child all title]] + } else { + set org_title "" + } + set org_hasmetadata [lors::imsmd::hasMetadata $organization] + + set org_id [lors_central::imscp::organization_add \ + -man_id $man_id \ + -identifier $org_identifier \ + -structure $org_structure \ + -title $org_title \ + -hasmetadata $org_hasmetadata \ + -org_folder_id $org_folder_id] + + ns_write "[_ lorsm.lt_Adding_Organization_o [list org_title $org_title]]<br>" + + + if {$org_hasmetadata == 1} { + # adds manifest metadata + set aa [lors::imsmd::addMetadata \ + -acs_object $org_id \ + -node [lors::imsmd::getMDNode $organization] \ + -dir $tmp_dir] + } + + set list_items [lors::imscp::getItems $organization] + + # ns_write "[_ lorsm.lt_here_is_list_items_li [list list_items $list_items]]" + + + set add [concat $add [lors_central::imscp::addItems -itm_folder_id $itm_folder_id \ + -org_id $org_id $list_items 0 $tmp_dir]] + + set tempval [llength $add] + ns_write "[_ lorsm.lt_Adding_tempval_items_]<br>" + + } + + + } + + set l_files [list] + + set resources [$manifest child all resources] + + set resourcex [$resources child all resource] + + if { ![empty_string_p $resourcex] } { + + set res_list [list] + foreach resource $resourcex { + set res_identifier [lors::imsmd::getResource -node $resource -att identifier] + set res_type [lors::imsmd::getResource -node $resource -att type] + set res_href [lors::imsmd::getResource -node $resource -att href] + set res_dependencies [lors::imsmd::getResource -node $resource -att dependencies] + set res_hasmetadata [lors::imsmd::hasMetadata $resource] + set res_files [lors::imsmd::getResource -node $resource -att files] + set res_scormtype [lors::imsmd::getAtt $resource adlcp:scormtype] + +### Addition provided by e-lane people to integrate on deployment with +# assessment package. + +# In the future we need to come up with a nicier way to do this as +# this is rather a dirty hack for now. + +# if {$res_type == "imsqti_xmlv1p0" || $res_type == "imsqti_xmlv1p1" || $res_type =="imsqti_item_xmlv2p0"} { +# set res_href [lors::assessment::ims_qti_register_assessment \ +# -tmp_dir $tmp_dir/$res_href \ +# -community_id $community_id] +# } + +## End integration showcase + + set resource_id [lors_central::imscp::resource_add \ + -man_id $man_id \ + -identifier $res_identifier \ + -type $res_type \ + -href $res_href \ + -scorm_type $res_scormtype \ + -hasmetadata $res_hasmetadata \ + -res_folder_id $res_folder_id ] + + ns_write "[_ lorsm.lt_Adding_resource_res_i_2 [list res_identifier $res_identifier]]<br>" + + lappend res_list [concat "$resource_id $res_identifier"] + + + + + if {$res_hasmetadata == 1} { + set res_md_add [lors::imsmd::addMetadata \ + -acs_object $resource_id \ + -node [lors::imsmd::getMDNode $resource] \ + -dir $tmp_dir] + + ns_write "[_ lorsm.lt_Adding_resource_res_i_3 [list res_identifier $res_identifier]]<br>" + + } + + + foreach dependency $res_dependencies { + + set dep_id [lors::imscp::dependency_add \ + -res_id $resource_id \ + -identifierref $dependency] + + ns_write "[_ lorsm.lt_Adding_resource_depen]<br>" + + } + + + foreach file $res_files { + lappend l_files [list [lindex $file 0] $resource_id [lindex $file 1]] + + # ns_write "$resource_id $res_identifier \n" + # ns_write "\t$file \n" + } + } + } + + # gets the resources + set resources [$manifest child all resources] + + } else { + # Error MSG here + #ns_write "[_ lorsm.no_page]" + } + + + # Here's where we link items and resources. Take into + # account that a resources can have 1 to many items + + + # So first, let's create a list of only item_identifierrefs + # [lindex $add 1]. Therefore we can do a lsearch -exact instead of + # a -regexp + + foreach ref $add { + lappend i_identref [lindex $ref 1] + } + + foreach resource $res_list { + + set find_item_id [lsearch -all -exact $i_identref [lindex $resource 1]] + + if {$find_item_id != -1} { + + foreach item_to_res $find_item_id { + + set item_to_resource [lors::imscp::item_to_resource_add \ + -item_id [lindex [lindex $add $item_to_res] 0] \ + -res_id [lindex $resource 0] + ] + } + + } + + } + + ns_write "[_ lorsm.lt_Now_we_are_almost_don]<br>" + + + foreach file $l_files { + + set filename [lindex $file 0] + + set found_file [lsearch -all -regexp $all_files $filename] + if {[llength $found_file] > 1} { + # we are suppose to get only one element back, so we have + # to refine the search a bit more. + set found_file [lsearch -all -regexp $all_files $tmp_dir/$filename] + + # ad_return_complaint 1 "$found_file <br> $tmp_dir $filename <br> $all_files " + # ad_script_abort + } + + if {![empty_string_p $found_file]} { + set file_id [lindex [lindex $all_files $found_file] 3] + set file_rev_id [content::item::get_live_revision -item_id $file_id] + set res_id [lindex $file 1] + set file_hasmetadata [lindex $file 2] + + regexp {([^/\\]+)$} $filename match filex + + if {$file_hasmetadata != 0} { + set hasmetadata 1 + } else { + set hasmetadata 0 + } + + + set fileadd [lors::imscp::file_add \ + -file_id $file_rev_id \ + -res_id $res_id \ + -pathtofile $filename \ + -filename $filex \ + -hasmetadata $hasmetadata] + + ns_write "[_ lorsm.Adding_file_filex [list filex $filex]]<br>" + + + if {$file_hasmetadata != 0} { + set add_file_metadata [lors::imsmd::addMetadata \ + -acs_object $file_id \ + -node $file_hasmetadata \ + -dir $tmp_dir] + + ns_write "[_ lorsm.lt_Adding_file_filex_met_1 [list filex $filex]]<br>" + } + } + + } + + + # Delete temporary directory + ns_write "[_ lorsm.lt_Deleting_temporary_fo]<br>" + ns_log Debug "Delete temporary folder $tmp_dir" + lors::imscp::deltmpdir $tmp_dir + + ns_write "[_ lorsm.Done]<p></blockquote><hr>" + +} + +# Get all organizations associated to this man_id +set org_list [db_list_of_lists get_organizations { + select org_id + from ims_cp_organizations + where man_id = :man_id +}] + + +# We make this outside the db_transaction because we need man_id present in ims_cp_manifests +if { ![empty_string_p $version_id] } { + set item_id [lors_central::get_item_id -revision_id $man_id] + + # We are making a new version of a course. We need to make inserts in ims_cp_manifest_class + # so the changes will be reflected in all classes that use this course + # We get all classes that use this course + + db_foreach get_all_communities { } { + # We update the rows with the new revision_id ( man_id ) so every class that use this course + # will have the same course version + db_dml update_course { } + db_dml delete_temporary_row { } + } + + # We need to update the ims_cp_items_map table to have same man_id for all clases + # First we are going to get all the communities id that are associated to this man_id + + set com_list [db_list_of_lists get_communities { + select distinct community_id from ims_cp_manifest_class + where man_id in ( select revision_id from cr_revisions where item_id = :item_id ) + }] + + # Now we are going to delete all from ims_cp_items related to this man_id + db_dml delete_from_items_map { + delete from ims_cp_items_map + where man_id in ( select revision_id from cr_revisions where item_id = :item_id ) + } + + + # Now we are going to insert the same course for all dotlrn classes + foreach com_id $com_list { + if { ![empty_string_p [lindex $com_id 0]] } { + foreach org_id $org_list { + set items_list [db_list_of_lists get_items { + select ims_item_id + from ims_cp_items + where org_id = :org_id + and ims_item_id in ( select live_revision + from cr_items + ) + }] + foreach ims_item_id $items_list { + db_dml insert_items { + insert into ims_cp_items_map + (man_id, org_id, community_id, ims_item_id) + values + (:man_id, :org_id, :com_id, :ims_item_id) + } + } + } + } + } +} + +# We also need to set the sort_order field in the ims_cp_items table, so we are going to do it here +foreach org_id $org_list { + set items_list [db_list_of_lists get_items { + select ims_item_id + from ims_cp_items + where org_id = :org_id + order by ims_item_id asc + }] + set i 1 + foreach ims_item_id $items_list { + lors_central::set_sort_order -sort_order $i -ims_item_id $ims_item_id + incr i + } +} + +# jump to the front page +ad_progress_bar_end -url [apm_package_url_from_id [ad_conn package_id]] Index: openacs-4/packages/lors-central/www/course-add-3.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-add-3.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-add-3.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_all_communities"> + <querytext> + select + icmc.community_id as com_id, + icmc.lorsm_instance_id as lors_ins_id, + icmc.class_key as cl_key, + icmc.isenabled as ie, + icmc.istrackable as it + from + ims_cp_manifest_class icmc + where + icmc.man_id in ( select revision_id + from cr_revisions + where item_id = :version_id ) + </querytext> + </fullquery> + + <fullquery name="update_course"> + <querytext> + update ims_cp_manifest_class + set + man_id = :man_id, + lorsm_instance_id = :lors_ins_id, + class_key = :cl_key, + isenabled = :ie, + istrackable = :it + where + community_id = :com_id + </querytext> + </fullquery> + + <fullquery name="delete_temporary_row"> + <querytext> + delete from ims_cp_manifest_class + where + community_id is null and + class_key is null and + man_id = :man_id + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-add.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,20 @@ +<master> +<property name="title">#lorsm.lt_Upload_an_IMSSCORM_Co#</property> +<property name="context">@context;noquote@</property> + +<table width="100%"> + <tr> + <td valign="top"> + <h2>#lorsm.Add_your_own_course#</h2> + </td> + <tr> + <td> + <blockquote> + <p>#lorsm.lt_We_have_detected_the_# <a href="folder-description?folder_id=@folder_id@">@folder_name;noquote@</a> + #lorsm.lt_and_we_will_import_yo#</p> + <formtemplate id=course_upload></formtemplate> + </blockquote> + </td> + </tr> +</table> + Index: openacs-4/packages/lors-central/www/course-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-add.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,91 @@ +ad_page_contract { + Upload and imports an IMS Content Package file + Initial form data + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 19 March 2003 + @cvs-id $Id: course-add.tcl,v 1.1 2005/05/17 16:21:19 miguelm Exp $ + +} { + man_id:optional +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] + +# Checking swa privilege over lors-central +lors_central::is_swa + +if { ![info exists man_id] } { + set man_id "" +} + +# Permissions +# dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + + +# Gets file-storage root folder_id +# eventually, we should provide an option so it can be imported in +# different subfolders +# set fs_package_id [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id $community_id] \ + -package_key "file-storage"\ + ] + +#set fs_package_id [apm_package_id_from_key "file-storage"] -- if used +# with OpenACS + +# Gets root folder and root folder name +#set folder_id [fs::get_root_folder -package_id $fs_package_id] +#set folder_name [fs::get_object_name -object_id $folder_id] + +set folder_id [lors_central::get_root_folder_id] +set folder_name [lors_central::get_folder_name -folder_id $folder_id] + +# Gets whether the file-storage instance is a indb_p or file system +# (StoreFilesInDatabaseP) one not that we use it now -since we are +# currently putting everything on the file system, but eventually we +# will have the option to put it on the db. + +#set indb_p [parameter::get -parameter "StoreFilesInDatabaseP" -package_id $fs_package_id] +set indb_p 1 + +# Gets URL for file-storage package +# set fs_url [apm_package_url_from_id $fs_package_id] + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] +# check for admin permission on folder +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] + +# set course id +set course_id 1 + +# set context +set context [list "[_ lorsm.lt_Upload_IMS_Content_Pa]"] + +template::form create course_upload -action course-add-2 -html {enctype multipart/form-data} + +template::element create course_upload course_id -label "[_ lorsm.course_id]" -datatype integer -widget hidden + +template::element create course_upload indb_p -label "[_ lorsm.indb_p]" -datatype integer -widget hidden + +#template::element create course_upload fs_package_id -label "[_ lorsm.fs_package_id]" -datatype integer -widget hidden + +# template::element create course_upload folder_id -label "[_ lorsm.folder_id]" -datatype integer -widget hidden + +template::element create course_upload upload_file -label "[_ lorsm.lt_Choose_the_course_zip]" -help_text "[_ lorsm.lt_Use_the_Browse_button]" -datatype text -widget file + +# To support course versions +template::element create course_upload man_id -datatype integer -widget hidden + +template::element set_properties course_upload course_id -value $course_id +# template::element set_properties course_upload folder_id -value $folder_id +template::element set_properties course_upload indb_p -value $indb_p +# template::element set_properties course_upload fs_package_id -value $fs_package_id +template::element set_properties course_upload man_id -value $man_id + + +ad_return_template + + Index: openacs-4/packages/lors-central/www/course-admin.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-admin.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-admin.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,16 @@ +<master> + <property name="title">@title@</property> + <property name="context">@context@</property> + +<table width="100%"> + <tr> + <td valign="top"> + <h2>#lorsm.lt_Courses_in_your_Repos#</h2> + </td> + <tr> + <td> + <listtemplate name="d_courses"></listtemplate> + </td> + </tr> +</table> + Index: openacs-4/packages/lors-central/www/course-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-admin.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-admin.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,147 @@ +# packages/lors-central/www/index.tcl + +ad_page_contract { + Learning Object Repository Management Index page + +} { + man_id:integer,notnull +} + +# Checking swa privilege over lors-central +lors_central::is_swa + + +set title "[_ lorsm.lt_Manage_Courses_in_Rep]" +set context [list "[_ lorsm.Manage_Courses]"] + + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +# set community_id [dotlrn_community::get_community_id] + + +# set admin_p [dotlrn::user_can_admin_community_p \ + -user_id [ad_conn user_id] \ + -community_id $community_id ] + +# set admin_p [dotlrn::user_can_admin_community_p \ + -user_id $user_id \ + -community_id $community_id ] + +# Permissions +# dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set actions [list] + +lappend actions "[_ lorsm.Add_Course]" [export_vars -base "course-add"] "[_ lorsm.lt_Add_a_IMSSCORM_Compli]" +lappend actions "[_ lorsm.lt_Search_Learning_Objec]" [export_vars -base "/search"] "[_ lorsm.lt_Search_for_Learninng_]" +lappend actions "[_ lorsm.Available_Courses]" [export_vars -base "shared/"] "[_ lorsm.lt_View_Available_Course]" + + +template::list::create \ + -name d_courses \ + -multirow d_courses \ + -html {width 50%} \ + -actions $actions \ + -key man_id \ + -no_data "[_ lorsm.No_Courses]" \ + -elements { + course_name { + label "[_ lorsm.Available_Courses]" + display_col course_name + link_url_eval {delivery/?[export_vars man_id]} + link_html {title "[_ lorsm.Access_Course]"} + + } + class_name { + label "[_ lors-central.class_name]" + } + hasmetadata { + label "[_ lorsm.Metadata_1]" + link_url_eval {md/?[export_vars ims_md_id]} + link_html {title "[_ lorsm.See_metadata]" } + html { align center } + } + isscorm { + label "[_ lorsm.SCORM]" + html { align center } + } + isenabled { + label "[_ lorsm.Status_1]" + html { align center } + } + istrackable { + label "[_ lorsm.Tracking]" + link_url_eval {tracking/?[export_vars {man_id lorsm_instance_id community_id}]} + link_html {title "[_ lorsm.lt_Track_Students_Progre]" class button} + html { align center } + } + creation_user { + label "[_ lorsm.Owner]" + display_eval {[person::name -person_id $creation_user]} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + creation_date { + label "[_ lorsm.Creation_Date]" + display_eval {[lc_time_fmt $creation_date "%x %X"]} + } + export { + label "[_ lorsm.Export]" + display_eval {\[zip\]} + link_url_eval {[export_vars -base export folder_id]} + link_html {title "[_ lorsm.lt_Export_as_IMS_Content]"} + html { align center } + } + admin { + label "[_ lorsm.Admin_Course]" + display_eval {Admin} + link_url_eval {[export_vars -base course-structure {man_id lorsm_instance_id}]} + link_html {title "[_ lorsm.Admin_Course]" class button} + html { align center } + } + } + + +db_multirow -extend { ims_md_id class_name } d_courses select_d_courses { + select + cp.man_id, + cp.course_name, + cp.identifier, + cp.version, + cpmc.lorsm_instance_id, + cpmc.community_id, + case + when hasmetadata = 't' then 'Yes' + else 'No' + end as hasmetadata, + case + when isscorm = 't' then 'Yes' + else 'No' + end as isscorm, + cp.fs_package_id, + cp.folder_id, + acs.creation_user, + acs.creation_date, + acs.context_id, + case + when cpmc.isenabled = 't' then 'Enabled' + else 'Disabled' + end as isenabled, + case + when cpmc.istrackable = 't' then 'Yes' + else 'No' + end as istrackable + from + ims_cp_manifests cp, acs_objects acs, ims_cp_manifest_class cpmc + where + cp.man_id = acs.object_id + and + cp.man_id = :man_id + and + cp.man_id = cpmc.man_id + order by acs.creation_date desc +} { + set ims_md_id $man_id + set class_name [lors_central::get_class_name -community_id $community_id] +} + Index: openacs-4/packages/lors-central/www/course-associate.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-associate.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-associate.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,41 @@ +ad_page_contract { + Associates a item_id with dotlrn's class_instance_id or community + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + item_id:notnull + type:notnull + object_id:multiple + { return_url "" } +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set man_id [content::item::get_live_revision -item_id $item_id] + +foreach community_id $object_id { + # Here we associate the course with every community_id that was checked + lors_central::add_relation -item_id $item_id -community_id $community_id -class_key $type + + # Now we have to make insert in the ims_cp_items_map in orther to tell which version + # of which course will be shown to an especific dotlrn class. + set org_list [db_list_of_lists get_organizations { }] + foreach org_id $org_list { + # We need to insert every single ims_item_id to ims_cp_items_map (only the live_revision) + set items_list [db_list_of_lists get_ims_items { }] + foreach ims_item_id $items_list { + db_dml insert_items { } + } + } + } + + + +if { [empty_string_p $return_url] } { + ad_returnredirect "course-dotlrn-assoc?item_id=$item_id" +} else { + ad_returnredirect $return_url +} + Index: openacs-4/packages/lors-central/www/course-associate.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-associate.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-associate.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,46 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="get_organizations"> + <querytext> + select + org_id + from + ims_cp_organizations + where + man_id = :man_id + </querytext> +</fullquery> + +<fullquery name="get_ims_items"> + <querytext> + select + ims_item_id + from + ims_cp_items + where + org_id = :org_id + and + ims_item_id = ( + select live_revision + from cr_items + where item_id = ( + select item_id + from cr_revisions + where revision_id = ims_item_id + ) + ) + </querytext> +</fullquery> + + +<fullquery name="insert_items"> + <querytext> + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:ims_item_id) + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-association-drop.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-association-drop.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-association-drop.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,32 @@ +ad_page_contract { + Drop associations of item_id's with dotlrn's classes or communities + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + item_id:notnull + object_id:multiple + { return_url "" } +} + +# Checking swa privilege over lors-central +lors_central::is_swa + + +set man_list [db_list_of_lists get_man_ids { }] +foreach community_id $object_id { + lors_central::drop_relation -item_id $item_id -community_id $community_id + foreach man_id $man_list { + set org_list [db_list_of_lists get_organizations { }] + foreach org_id $org_list { + db_dml delete_items { } + } + } +} + +if { [empty_string_p $return_url] } { + ad_returnredirect "course-dotlrn-assoc?item_id=$item_id" +} else { + ad_returnredirect $return_url +} + Index: openacs-4/packages/lors-central/www/course-association-drop.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-association-drop.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-association-drop.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="get_man_ids"> + <querytext> + select + revision_id + from + cr_revisions + where + item_id = :item_id + </querytext> +</fullquery> + + +<fullquery name="get_organizations"> + <querytext> + select + org_id + from + ims_cp_organizations + where + man_id = :man_id + </querytext> +</fullquery> + +<fullquery name="delete_items"> + <querytext> + delete from ims_cp_items_map + where + man_id = :man_id and + org_id = :org_id and + community_id = :community_id + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-dotlrn-assoc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-dotlrn-assoc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-dotlrn-assoc.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,7 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<listtemplate name="dotlrn_classes"></listtemplate> +<br><br> +<listtemplate name="drop_dotlrn_classes"></listtemplate> Index: openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,157 @@ +ad_page_contract { + @author Miguel Marin (migeulmarin@viaro.net) + @author Viaro Networks www.viaro.net + + This page associate this course to one class or community of dotlrn +} { + man_id:integer,optional + item_id:integer,optional +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set title [_ lors-central.associate_to] + +# Get the item_id that the manifest_id has associated +if { ![info exist item_id] } { + set item_id [lors_central::get_item_id -revision_id $man_id] + set context [list [list "one-course-associations?man_id=$man_id" [_ lors-central.one_course_assoc]] \ + [_ lors-central.associate_to]] +} else { + set context [list [list "one-course-associations?item_id=$item_id" [_ lors-central.one_course_assoc]] \ + [_ lors-central.associate_to]] +} + +set user_id [ad_conn user_id] + + +##################################### TO ASSOCIATE ########################################################## + +db_multirow -extend { rel type } classes_list get_dotlrn_classes { } { + set rel [lors_central::relation_between -item_id $item_id -community_id $com_id] + set type dotlrn_class_instance +} + +template::list::create \ + -name dotlrn_classes \ + -multirow classes_list \ + -key community_id \ + -has_checkboxes\ + -bulk_actions { + "\#lors-central.associate\#" "course-associate" "\#lors-central.associate_to_class\#" \ + } \ + -bulk_action_method post \ + -bulk_action_export_vars { + item_id + type + }\ + -row_pretty_plural "[_ lors-central.dotlrn_classes]" \ + -elements { + check_box { + class "list-narrow" + label "<input type=\"checkbox\" name=\"_dummy\" onclick=\"acs_ListCheckAll('dotlrn_classes', this.checked)\" \ + title=\"\#lors-central.label_title\#\">" + display_template { + <input type="checkbox" name="object_id" value="@classes_list.com_id@" \ + id="dotlrn_classes,@classes_list.com_id@" \ + title="\#lors-central.title\#"> + } + } + class { + label "[_ lors-central.class_name]" + display_template { + <a href="@classes_list.url@">@classes_list.pretty_name@</a> + } + } + dep_name { + label "[_ lors-central.dep_name]" + display_template { + @classes_list.department_name@ + } + } + term_name { + label "[_ lors-central.term_name]" + display_template { + @classes_list.term_name@ + } + } + subject { + label "[_ lors-central.subject_name]" + display_template { + @classes_list.class_name@ + } + } + associate { + display_template { + <if @classes_list.rel@ not eq 0> + #lors-central.associated# + </if> + } + } + } + + +############################## TO DROP ASSOCIATION ###################################### + +db_multirow -extend { rel } drop_classes_list get_dotlrn_classes_drop { } { + set rel [lors_central::relation_between -item_id $item_id -community_id $com_id] +} + +template::list::create \ + -name drop_dotlrn_classes \ + -multirow drop_classes_list \ + -key community_id \ + -has_checkboxes\ + -bulk_actions { + "\#lors-central.drop\#" "course-association-drop" "\#lors-central.drop_association\#" \ + } \ + -bulk_action_method post \ + -bulk_action_export_vars { + item_id + }\ + -row_pretty_plural "[_ lors-central.dotlrn_classes]" \ + -elements { + check_box { + class "list-narrow" + label "<input type=\"checkbox\" name=\"_dummy\" onclick=\"acs_ListCheckAll('drop_dotlrn_classes', this.checked)\" \ + title=\"\#lors-central.label_title\#\">" + display_template { + <input type="checkbox" name="object_id" value="@drop_classes_list.com_id@" \ + id="drop_dotlrn_classes,@drop_classes_list.com_id@" \ + title="\#lors-central.title\#"> + } + } + class { + label "[_ lors-central.class_name]" + display_template { + <a href="@drop_classes_list.url@">@drop_classes_list.pretty_name@</a> + } + } + dep_name { + label "[_ lors-central.dep_name]" + display_template { + @drop_classes_list.department_name@ + } + } + term_name { + label "[_ lors-central.term_name]" + display_template { + @drop_classes_list.term_name@ + } + } + subject { + label "[_ lors-central.subject_name]" + display_template { + @drop_classes_list.class_name@ + } + } + associate { + display_template { + <if @drop_classes_list.rel@ not eq 0> + #lors-central.associated# + </if> + } + } + } + Index: openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,68 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_dotlrn_classes"> + <querytext> + select + dc.class_instance_id as com_id, + dc.department_name, + dc.term_name, + dc.class_name, + dc.pretty_name, + dc.url + from + dotlrn_class_instances_full dc + where + dc.class_instance_id not in + ( + select + icmc.community_id + from + ims_cp_manifest_class icmc + where + icmc.community_id is not null and + man_id in + ( + select revision_id + from cr_revisions + where item_id = :item_id + ) + ) + order by department_name, term_name, class_name, pretty_name + </querytext> + </fullquery> + + <fullquery name="get_dotlrn_classes_drop"> + <querytext> + select + dc.class_instance_id as com_id, + dc.department_name, + dc.term_name, + dc.class_name, + dc.pretty_name, + dc.url + from + dotlrn_class_instances_full dc + where + dc.class_instance_id in + ( + select + icmc.community_id + from + ims_cp_manifest_class icmc + where + icmc.man_id in + ( + select revision_id + from cr_revisions + where item_id = :item_id + ) + ) + order by department_name, + term_name, + class_name, + pretty_name + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-live-in.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-live-in.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-live-in.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,5 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<listtemplate name="dotlrn_classes"></listtemplate> \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-live-in.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-live-in.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-live-in.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,67 @@ +ad_page_contract { + Display a list of dotlrn classes where the course is in use + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:integer,optional +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set title "[_ lors-central.Classes_using]" +set context [list [list "one-course-associations?man_id=$man_id" [_ lors-central.one_course_assoc]] \ + [_ lors-central.Classes_using]] + +# Get the item_id of man_id +set item_id [lors_central::get_item_id -revision_id $man_id] + +db_multirow -extend { ver_num ver_count manifest_id options } cl_list get_dotlrn_classes { } { + set manifest_id [lors_central::get_man_id -community_id $com_id -item_id $item_id] + set ver_count [lors_central::count_versions -man_id $manifest_id] + set ver_num [lors_central::get_version_num -revision_id $manifest_id] + # Create the options for the select menu + set options "" + for { set i 1 } { $i < [expr $ver_count + 1] } { incr i } { + if { [string equal $i $ver_num] } { + append options "<option value=$i selected>$i</options>" + } else { + append options "<option value=$i>$i</options>" + } + } +} + + +template::list::create \ + -name dotlrn_classes \ + -multirow cl_list \ + -key com_id \ + -has_checkboxes \ + -row_pretty_plural "[_ lors-central.dotlrn_classes]" \ + -elements { + class { + label "[_ lors-central.class_name]" + display_template { + @cl_list.pretty_name@ + } + } + subject { + label "[_ lors-central.subject_name]" + display_template { + @cl_list.class_name@ + } + } + term_name { + label "[_ lors-central.term_name]" + display_template { + @cl_list.term_name@ + } + } + current { + label "[_ lors-central.current]" + display_template { + @cl_list.ver_num@ [_ lors-central.of] @cl_list.ver_count@ + } + } + } + Index: openacs-4/packages/lors-central/www/course-live-in.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-live-in.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-live-in.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_dotlrn_classes"> + <querytext> + select + dc.class_instance_id as com_id, + dc.department_name, + dc.term_name, + dc.class_name, + dc.pretty_name + from + dotlrn_class_instances_full dc + where + dc.class_instance_id in + ( + select + icmc.community_id + from + ims_cp_manifest_class icmc + where + icmc.man_id = :man_id + ) + order by + dc.department_name, dc.term_name, dc.class_name, dc.pretty_name + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-version-change.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-version-change.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-version-change.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,69 @@ +ad_page_contract { + author Miguel Marin (miguelmarin@viaro.net) + author Viaro Networks www.viaro.net +} { + man_id:notnull +} + +set user_id [ad_conn user_id] + +# Checking swa privilege over lors-central +lors_central::is_swa + +set item_id [lors_central::get_item_id -revision_id $man_id] + +# Check for admin permissions over the course +set permission_p [lors_central::check_privilege -item_id $item_id -user_id $user_id] + +if { !$permission_p } { + ad_return_complaint 1 "You don't have permission to change versions on this course" + ad_script_abort +} + +# Update the man_id field on all classes that use this man_id +lors_central::change_version_all_courses -man_id $man_id -item_id $item_id + +# We need to update the ims_cp_items_map table to have same man_id for all clases +# First we are going to get all the communities id that are associated to this man_id + +set com_list [db_list_of_lists get_communities { + select distinct community_id from ims_cp_manifest_class + where man_id in ( select revision_id from cr_revisions where item_id = :item_id ) +}] + +# Now we ae going to delete all from ims_cp_items related to this man_id +db_dml delete_from_items_map { + delete from ims_cp_items_map + where man_id in ( select revision_id from cr_revisions where item_id = :item_id ) +} + + +# Now we are going to insert the same course for all dotlrn classes +set org_list [db_list_of_lists get_organizations { + select org_id + from ims_cp_organizations + where man_id = :man_id +}] +foreach community_id $com_list { + foreach org_id $org_list { + set items_list [db_list_of_lists get_items { + select ims_item_id + from ims_cp_items + where org_id = :org_id + and ims_item_id in ( select live_revision + from cr_items + ) + }] + foreach ims_item_id $items_list { + db_dml insert_items { + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:ims_item_id) + } + } + } + +} + +ad_returnredirect "one-course-associations?man_id=$man_id" \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-versions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-versions.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-versions.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,11 @@ +<master> +<property name="title">#lorsm.lt_one_course_versions#</property> +<property name="context">@context;noquote@</property> + +<listtemplate name=course_versions></listtemplate> +<br> +<if @permission_p@> + <if @index_p@ eq 0> + <a class="button" href="course-add?man_id=@man_id@">New Course Version</a> + </if> +</if> \ No newline at end of file Index: openacs-4/packages/lors-central/www/course-versions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-versions.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-versions.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,87 @@ +ad_page_contract { + author Miguel Marin (miguelmarin@viaro.net) + author Viaro Networks www.viaro.net +} { + man_id:integer,optional + item_id:integer,optional + {index_p 0} +} + +set user_id [ad_conn user_id] + +# Checking swa privilege over lors-central +lors_central::is_swa + + +if { ![info exist item_id ] } { + set item_id [lors_central::get_item_id -revision_id $man_id] + set context [list [list "one-course?man_id=$man_id" \ + [_ lors-central.one_course]] [_ lorsm.lt_one_course_versions]] +} else { + if { $index_p } { + set context [list [_ lorsm.lt_one_course_versions]] + } else { + set context [list [list "one-course?item_id=$item_id" [_ lors-central.one_course]] \ + [_ lorsm.lt_one_course_versions]] + } +} + +################################################ +# Check for admin permissions over the course + +if { ![acs_user::site_wide_admin_p -user_id $user_id ]} { + set permission_p [db_string check_permission "select 1 from acs_permissions where object_id = :item_id + and grantee_id = :user_id and privilege = 'admin'" -default 0] +} else { + set permission_p 1 +} + +set last_version [db_string get_live_revision "select live_revision from cr_items where item_id = :item_id"] + +db_multirow -extend { ver_num } course_versions get_versions { } { + set ver_num [lors_central::get_version_num -revision_id $man_id] +} + +template::list::create \ + -name course_versions \ + -multirow course_versions \ + -key course_name \ + -bulk_action_method post \ + -has_checkboxes \ + -bulk_action_export_vars { + } \ + -row_pretty_plural "[_ lors-central.course_versions]" \ + -elements { + version_number { + label "[_ lors-central.version_number]" + display_template { + <center><b>@course_versions.ver_num@</b></center> + } + } + course_name { + label "[_ lors-central.course_name]" + display_template { + <a href="one-course?man_id=@course_versions.man_id@">@course_versions.course_name@</a> + } + } + man_id { + label "[_ lors-central.man_id]" + display_template { + @course_versions.man_id@ + } + } + latest_version { + display_template { + <if $last_version eq @course_versions.man_id@> + <img border=0 src="images/live.gif"> + </if> + <else> + <a href="course-version-change?man_id=@course_versions.man_id@"></a> + <!-- img border=0 src="images/golive.gif" --> + </else> + } + } + } + + + Index: openacs-4/packages/lors-central/www/course-versions.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-versions.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/course-versions.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_versions"> + <querytext> + select + r.title as course_name, + r.revision_id as man_id + from + cr_revisions r + where + :item_id = r.item_id + order by + revision_id asc + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/edit-content.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/edit-content.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/edit-content.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,51 @@ +# packages/lorsm/www/edit-content.tcl + +ad_page_contract { + + Online content editor for LORSm + + Uses htmlarea to edit html/txt file-storage + content + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2004-07-06 + @arch-tag: 6f57a7d1-7032-44e4-b333-6a7fb74ae30b + @cvs-id $Id: edit-content.tcl,v 1.1 2005/05/17 16:21:19 miguelm Exp $ +} { + folder_id:integer + fs_package_id:integer + identifierref + return_url +} -properties { +} -validate { +} -errors { +} + +set user_id [ad_conn user_id] + +# Checking swa privilege over lors-central +lors_central::is_swa + +set folder [db_string select_folder_key {select key from fs_folders where folder_id = :folder_id}] +set fs_root_folder [db_string sql {select file_storage__get_root_folder(:fs_package_id)}] +set identifierref [lorsm::fix_url -url $identifierref] +set pather $folder/$identifierref + +# in some case, the resource is defined with a / that conflicts with +# our existing / creating a double //. Therefore we use a regsub to +# get rid of it +regsub -all {//} $pather {/} pather + + +set file_id [db_string sql {select content_item__get_id(:pather, :fs_root_folder, 'f')}] + +# check for permissions +# By default, only the creator has admin access to content + +permission::require_write_permission -object_id $file_id -creation_user $user_id + +#ns_write "[_ lorsm.lt_folder_foldern_pather]" +#ad_script_abort + +ad_returnredirect [export_vars -base [apm_package_url_from_id $fs_package_id]file-content-edit {file_id return_url}] + Index: openacs-4/packages/lors-central/www/file-content-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/file-content-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/file-content-edit.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,6 @@ +<master> +<if @webdav_url@ not nil> + <p>This file can be accessed via WebDAV at @webdav_url@</p> +</if> + +<include src="../lib/content-edit" file_id="@file_id@" return_url="@return_url;noquote@" man_id="@man_id@" res_id="@res_id@"> Index: openacs-4/packages/lors-central/www/file-content-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/file-content-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/file-content-edit.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,51 @@ +# packages/file-storage/www/file-content-edit.tcl + +ad_page_contract { + + Edit contents of a file + + @author Deds Castillo (deds@i-manila.com.ph) + @creation-date 2004-07-03 + @arch-tag: 05a2f0b7-6780-4385-bb62-37d959c315cd + @cvs-id $Id: file-content-edit.tcl,v 1.1 2005/05/17 16:21:19 miguelm Exp $ +} { + file_id:notnull + res_id:notnull + man_id:notnull + {return_url ""} +} -properties { + title:onevalue + context:onevalue +} -validate { +} -errors { +} + + +# We set here the nsv_variables to send to index.vuh to display de images +# inside the area, we only need the ims_item_id + +set ims_item_id [lors_central::get_ims_item_id_or_res_id -res_id $res_id] +if {[nsv_exists delivery_vars [ad_conn session_id]]} { + nsv_unset delivery_vars [ad_conn session_id] +} +nsv_set delivery_vars [ad_conn session_id] [list] +nsv_lappend delivery_vars [ad_conn session_id] $ims_item_id + + +# Checking swa privilege over lors-central +lors_central::is_swa + +# check they have read permission on this file + +ad_require_permission $file_id read + +#set templating datasources + +set user_id [ad_conn user_id] +set title "Edit File Contents" + + +set file_item_id [lors_central::get_item_id -revision_id $file_id] +set webdav_url [fs::webdav_url -item_id $file_item_id] + + Index: openacs-4/packages/lors-central/www/folder-description.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/folder-description.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/folder-description.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,7 @@ +<master> +<if @parent_root_p@> + @back_button;noquote@ +</if> +<br> +<br> +<listtemplate name="folder_elements"></listtemplate> \ No newline at end of file Index: openacs-4/packages/lors-central/www/folder-description.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/folder-description.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/folder-description.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,101 @@ +ad_page_contract { + User Interafe to show all files that one course has + @author Miguel Marin (migulmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + folder_id:integer,optional +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +if { ![info exists folder_id] } { + # Get lorsm root folder_id + set folder_id [lors_central::get_root_folder_id] +} else { + # Get parent folder_id and label + db_1row get_parent_id_label {select name, parent_id from cr_items where content_type = 'content_folder' + and item_id = :folder_id + } + set back_button "<a class=button href=\"?folder_id=$parent_id\">Back to $name</a>" + if { [string equal $parent_id "-100"] } { + set parent_root_p 0 + } else { + set parent_root_p 1 + } +} + + +template::list::create \ + -name folder_elements \ + -multirow get_elements \ + -bulk_action_method post \ + -bulk_action_export_vars { } \ + -row_pretty_plural "elements to show" \ + -elements { + name { + label "Name" + display_template { + <if @get_elements.is_folder@> + <a href="?folder_id=@get_elements.item_id@"><img border=0 src="images/folder.gif"></a> + @get_elements.name@ + </if> + <else> + <a href="download?file_id=@get_elements.item_id@"><img border=0 src="images/file.gif"></a> + @get_elements.name@ + </else> + + } + } + size { + label "Size" + display_template { + <if @get_elements.is_folder@> + @get_elements.size@ items + </if> + <else> + @get_elements.length@ + </else> + } + } + type { + label "Type" + display_template { + <if @get_elements.is_folder@> + Folder + </if> + <else> + @get_elements.mime_type@ + </else> + } + } + last_modified { + label "Last Modified" + display_template { + @get_elements.last_modified@ + } + } + } + +db_multirow -extend { is_folder size mime_type last_modified length } get_elements get_folder_elements { + select * from cr_items where parent_id = :folder_id +} { + set is_folder [db_string is_folder { select 1 from cr_folders where folder_id = :item_id } -default "0"] + set size [db_string get_size { select count(item_id) from cr_items where parent_id = :item_id } -default "0"] + db_0or1row get_extra_information { select content_length as length, mime_type, publish_date as last_modified + from cr_revisions where revision_id = :live_revision } + + set last_modified_ansi [lc_time_system_to_conn $last_modified] + + set last_modified [lc_time_fmt $last_modified_ansi "%x %X"] + + if { ![string equal $is_folder 1]} { + if {$length < 1024} { + set length "[lc_numeric $length ] bytes" + } else { + set length "[lc_numeric [expr $length / 1024 ]] Kb" + } + + } + +} Index: openacs-4/packages/lors-central/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/index.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,24 @@ +<master> + <property name="title">@title@</property> + <property name="context">@context@</property> + +<h2>#lorsm.lt_Courses_in_your_Repos#</h2> + +<table width="100%"> + <tr> + <td valign="top"> + <form action="search" method="GET"> + #lors-central.search_courses# + <input name="q" onfocus="if(this.value=='Please type a keyword')this.value='';" onblur="if(this.value=='')this.value='#lors-central.please_type#';" value="#lors-central.please_type#" /> + <input type="submit" value="#lors-central.search#" /> + </form> + </td> + <tr> + <td> + <listtemplate name="get_courses"></listtemplate> + </td> + </tr> +</table> + + + Index: openacs-4/packages/lors-central/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/index.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,104 @@ +# packages/lors-central/www/index.tcl + +ad_page_contract { + Lors Central Index page ( display al courses ) + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + keyword:optional +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set title "[_ lorsm.lt_Manage_Courses_in_Rep]" +set context [list "[_ lorsm.Manage_Courses]"] + + +# To search courses +if { [info exist keyword] } { + if { [string equal $keyword [_ lors-central.please_type]] } { + set extra_query "" + } else { + set items "(0" + set keyword "%$keyword%" + db_foreach get_items_like { } { + append items ",$item_id" + } + append items ")" + set extra_query "and cr.item_id in $items" + } +} else { + set extra_query "" +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] + +set admin_p [dotlrn::user_can_admin_community_p \ + -user_id [ad_conn user_id] \ + -community_id $community_id ] + +set admin_p [dotlrn::user_can_admin_community_p \ + -user_id $user_id \ + -community_id $community_id ] + +# Permissions +# dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set actions [list] + +lappend actions "[_ lorsm.Add_Course]" [export_vars -base "course-add"] "[_ lorsm.lt_Add_a_IMSSCORM_Compli]" +lappend actions "[_ lorsm.lt_Search_Learning_Objec]" [export_vars -base "search"] "[_ lorsm.lt_Search_for_Learninng_]" + + +template::list::create \ + -name get_courses \ + -multirow get_courses \ + -html {width 50%} \ + -actions $actions \ + -key item_id \ + -no_data "[_ lorsm.No_Courses]" \ + -elements { + course_name { + label "[_ lorsm.Available_Courses]" + display_col course_name + link_url_eval {[export_vars -base one-course { item_id } ]} + } + versions { + label "[_ lors-central.versions]" + display_template { + <center> + <a href="course-versions?item_id=@get_courses.item_id@&index_p=1">@get_courses.versions@</a> + </center> + } + } + creation_user { + label "[_ lorsm.Owner]" + display_eval {[person::name -person_id $creation_user]} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + creation_date { + label "[_ lorsm.Creation_Date]" + display_eval {[lc_time_fmt $creation_date "%x %X"]} + } + + } + +# Get the root folder where the manifests will be stored uploading from lors-central +set manifest_root [lors_central::get_root_manifest_folder_id] + +# Get all folders inside manifest_root, to check that man_id is in one of this folders +set folders "(" +db_foreach get_subfolders { } { + append folders "${item_id}," +} +append folders "0)" + +db_multirow -extend { course_name versions } get_courses select_courses { } { + set course_name [db_string get_item_name "select name from cr_items where item_id = :item_id"] + set versions [lors_central::count_versions -item_id $item_id] +} + + Index: openacs-4/packages/lors-central/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/index.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/index.vuh 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,102 @@ +ad_page_contract { + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation date 06-05-2005 + + Get the right file to display in preview pages, expect ims_item_id + from nsv variables +} { + +} + +# We get the url of the image or link +set the_url [ad_conn path_info] + +# We get the ims_item_id of nsv variable +set ims_item_id [lindex [nsv_get delivery_vars [ad_conn session_id]] 0] + +# We need the man_id of the ims_item_id to get the folder that holds the content +set res_id [lors_central::get_ims_item_id_or_res_id -ims_item_id $ims_item_id] +set man_id [db_string get_man_id { select man_id from ims_cp_resources where res_id = :res_id }] +set root_folder [lors_central::get_root_folder_id] +set name [lors_central::get_course_name -man_id $man_id] + +set folder [db_string get_folder { + select + item_id + from + cr_items + where + name = :name and + parent_id = :root_folder + + }] + +# Now that we have the folder we get the href of that the ims_item_id has associated to move to the right folder +set href [lors_central::get_href -ims_item_id $ims_item_id] + +set path_list [split $href "/"] + set char [string range $href 0 0] + if { [string equal $char "/"] } { + set subfolder_name [lindex $path_list 1] + set url_name [lindex $path_list 2] + } else { + set subfolder_name [lindex $path_list 0] + set url_name [lindex $path_list 1] + } + +# Get the folder_id from the href and figure it out if we have to move another +# folder down +if { ![empty_string_p $subfolder_name] } { + set folder_id [db_string get_folder_id { + select + item_id + from + cr_items + where + name = :subfolder_name and + parent_id = :folder + }] +} else { + set folder_id $folder +} + +# Now that we have the folder we check out the url to see if we have to go +# down again + +set split_url [split $the_url "/"] + +set list_length [llength $split_url] +set file_name [lindex $split_url [expr $list_length - 1]] +set folder_list [lrange $split_url 0 [expr $list_length - 2]] + +# Moving down folder by folder to get the last folder_id +foreach folder_name $folder_list { + set folder_id [db_string get_folder_id { + select + item_id + from + cr_items + where + name = :folder_name and + parent_id = :folder_id + }] +} + +# Get the item_id of the file to show +set item_id [db_string get_item_id { + select + item_id + from + cr_items + where + parent_id = :folder_id and + name = :file_name + }] + +# Get the live revision +set revision_id [item::get_live_revision $item_id] + +# Show the content +cr_write_content -revision_id $revision_id + Index: openacs-4/packages/lors-central/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/index.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/index.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,46 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="get_subfolders"> + <querytext> + select + item_id + from + cr_items + where + parent_id = :manifest_root + </querytext> +</fullquery> + +<fullquery name="select_courses"> + <querytext> + select distinct + cr.item_id, + acs.creation_user, + acs.creation_date + from + cr_revisions cr, acs_objects acs, cr_items ci + where + acs.object_id = cr.item_id and + ci.item_id = cr.item_id and + ci.parent_id in $folders and + cr.revision_id in + ( + select man_id from ims_cp_manifests + ) + $extra_query + </querytext> +</fullquery> + +<fullquery name="get_items_like"> + <querytext> + select + item_id + from + cr_items + where + lower(name) like lower(:keyword) + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/new-clipboard-files.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-clipboard-files.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/new-clipboard-files.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,117 @@ +ad_page_contract { + Add all checked files to the specific resource + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:notnull + ims_item_id:notnull + {name ""} + object_id:multiple + sort_order:optional +} + +set user_id [ad_conn user_id] + +foreach object $object_id { + #The same file can not be added to the same res_id twice so we are going to check that + set ims_res_id [db_string get_res_id { } ] + if { [db_string check_file { } -default 0] } { + ad_return_complaint 1 "<b>[_ lors-central.this_file_is]</b>" + ad_script_abort + } +} + +db_transaction { + # We get the resource_id to get the href of the item that is the default + # since this is the default file the ims_item has + db_0or1row get_resource_info { } + + # We need the info about the ims_item_id + db_0or1row get_item_info { } + + set cr_revision [lors_central::get_content_revision_id -ims_item_id $ims_item_id] + set cr_item_id [lors_central::get_item_id -revision_id $cr_revision] + if { [string equal $cr_item_id 0] } { + # It's probably an URL so we are going to treat it as one + set cr_item_id [lors_central::get_item_url -ims_item_id $ims_item_id -man_id $man_id] + } + # We get the folder_id to know where to store the new cr_item + set folder_id [lors_central::get_parent_id -item_id $cr_item_id] + + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + + set title [lors_central::check_item_name -parent_id $res_folder_id -name $identifierref] + set new_res_item_id [content::item::new -name $title -creation_user $user_id \ + -parent_id $res_folder_id -content_type "ims_resource_object"] + + set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $title \ + -creation_user $user_id -is_live "t"] + + + db_dml update_new_res { + update + ims_cp_resources + set + man_id = :man_id, + identifier = :identifierref, + type = 'webcontent', + href = :res_href, + hasmetadata = 'f' + where + res_id = :new_res_rev_id + } + + + # We need to create a new row in the ims_cp_files for each file that was sen here from clipboard + foreach object $object_id { + db_0or1row get_file_info { } + db_dml insert_new_file { + insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) + values (:object, :new_res_rev_id, :pathtofile, :filename, 'f') + } + } + + set item_id [lors_central::get_item_id -revision_id $ims_item_id] + set new_ims_rev_id [content::revision::new -item_id $item_id -title $item_title \ + -creation_user $user_id -is_live "t"] + + db_dml update_ims_cp_items { + update ims_cp_items + set + org_id = :org_id, + identifier = :identifier, + identifierref = :identifierref, + item_title = :item_title, + parent_item = :parent_item, + sort_order = :sort_order + where ims_item_id = :new_ims_rev_id + + } + + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_rev_id) + } + + set old_res_id [db_string get_old_res_id { } -default ""] + db_dml carry_forward_files { + insert into ims_cp_files ( + select + file_id, + :new_res_rev_id, + pathtofile, + filename, + hasmetadata + from + ims_cp_files + where + res_id = :old_res_id) + } +} + +ad_returnredirect [export_vars -base "one-learning-object" {man_id {ims_item_id $new_ims_rev_id}}] + + Index: openacs-4/packages/lors-central/www/new-clipboard-files.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-clipboard-files.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/new-clipboard-files.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,99 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="check_file"> + <querytext> + select + 1 + from + ims_cp_files + where + file_id = :object + and res_id = :ims_res_id + </querytext> + </fullquery> + + <fullquery name="get_resource_info"> + <querytext> + select + href as res_href, + identifier as identiferref + from + ims_cp_resources + where + res_id = :ims_res_id + </querytext> + </fullquery> + + <fullquery name="get_file_info"> + <querytext> + select + distinct pathtofile, filename + from + ims_cp_files + where + file_id = :object + </querytext> + </fullquery> + + <fullquery name="get_item_info"> + <querytext> + select + identifier, + item_title, + parent_item, + org_id, + sort_order, + identifierref + from + ims_cp_items + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_filename"> + <querytext> + select + distinct filename + from + ims_cp_files + where + file_id = :new_file_id + </querytext> + </fullquery> + + <fullquery name="get_old_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_parent_item"> + <querytext> + select + parent_item + from + ims_cp_items + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + +</queryset> Index: openacs-4/packages/lors-central/www/new-file.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-file.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/new-file.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,10 @@ +<master> +<property name="title">@page_title;noquote@</property> +<property name="context">@context;noquote@</property> + +<h1>#lors-central.upload_a_new#</h1> +<formtemplate id=file_upload></formtemplate> + +<h1>#lors-central.create_your_new#</h1> +<formtemplate id=file_write></formtemplate> + Index: openacs-4/packages/lors-central/www/new-file.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-file.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/new-file.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,107 @@ +ad_page_contract { + Adds a new file to one resource + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + res_id:integer,notnull + {man_id ""} + {name ""} + file_upload:trim,optional + file_upload.tmpfile:optional,tmpfile + {mime_type ""} +} + + +set user_id [ad_conn user_id] +# Checking swa privilege over lors-central +lors_central::is_swa + +set page_title "[_ lors-central.new_file]" +set context "[list [list [export_vars -base one-resource {res_id}] \ + [_ lors-central.One_learning]] \ + [_ lors-central.new_file]]" + +set man_id [db_string get_man_id "select man_id from ims_cp_resources where res_id=:res_id"] +ad_form -name file_upload -html {enctype multipart/form-data} \ + -export {res_id man_id} \ + -form { + {file_title:text(text) + {label "[_ lors-central.item_title]"} + } + {file_upload:text(file) + {label "[_ lors-central.choose_the_file]"} + {help_text "[_ lors-central.help_text]"} + } +} -on_submit { + + set res_href [lors_central::get_res_href -res_id $res_id] + + set tmp_filename [ns_queryget file_upload.tmpfile] + set mime_type [cr_filename_to_mime_type -create $file_upload] + set tmp_size [file size $tmp_filename] + + set new_res_rev_id [lors_central::add_file \ + -filename $file_upload \ + -title $file_title \ + -tmp_filename $tmp_filename \ + -res_id $res_id \ + -mime_type $mime_type \ + -man_id $man_id ] + +} -after_submit { + +ad_returnredirect [export_vars -base "one-resource" {{res_id $new_res_rev_id}}] + ad_script_abort +} + +ad_form -name file_write -form { + {file_title:text(text) + {label "[_ lors-central.item_title]"} + } + {content:richtext(richtext),optional + {label "Content"} + {html {rows 20 cols 60}} + } + {man_id:text(hidden) + {value $man_id} + } + {res_id:text(hidden) + {value $res_id} + } +} -on_submit { + set content_body [template::util::richtext::get_property contents $content] + # Rebuild HTML if necessary + if { [regexp -nocase {^(.*<\s*?body[^>]*?>).*(</\s*?body\s*?>.*)$} $content match header footer] } { + set content_body "${header}${content_body}${footer}" + } + + foreach {link id} [regexp -inline -all {<a href="\.\./o/(\d+?)">.*?</a>} $content_body] { + # ns_log notice "DAVEB link '${link}' id '${id}" + # find out if its an image + if {[db_0or1row mime "select mime_type as this_mime_type, title as this_title + from cr_revisions, cr_items + where cr_items.item_id=:id and revision_id=live_revision"] } { + # ns_log notice "DAVEB mime_type '${this_mime_type}'" + if {[string match "image/*" $this_mime_type]} { + regsub -all $link $content_body "<img src=\"images/${this_title}\" />" content_body + } else { + # FIXME for now just throw away non image links until we can do something intelligent with them! + regsub -all $link $content_body {} content_body + } + } + } + set mime_type [template::util::richtext::get_property format $content] + set new_res_rev_id [lors_central::add_file \ + -filename $file_title \ + -title $file_title \ + -file_content $content_body \ + -res_id $res_id \ + -mime_type $mime_type \ + -man_id $man_id ] + + +} -after_submit { + ad_returnredirect [export_vars -base "one-resource" {{res_id $new_res_rev_id}}] + ad_script_abort +} + Index: openacs-4/packages/lors-central/www/new-file.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-file.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/new-file.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,94 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="check_file"> + <querytext> + select + 1 + from + ims_cp_files + where + file_id = :clipboard_object_id + and res_id = :ims_res_id + </querytext> + </fullquery> + + <fullquery name="get_href"> + <querytext> + select + href as res_href + from + ims_cp_resources + where + res_id = :ims_res_id + </querytext> + </fullquery> + + <fullquery name="get_parent_item"> + <querytext> + select + parent_item + from + ims_cp_items + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_filename"> + <querytext> + select + distinct filename + from + ims_cp_files + where + file_id = :new_file_id + </querytext> + </fullquery> + + <fullquery name="get_pathtofile"> + <querytext> + select + distinct pathtofile + from + ims_cp_files + where + file_id = :new_file_id + </querytext> + </fullquery> + + + <fullquery name="get_old_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_parent_item"> + <querytext> + select + parent_item + from + ims_cp_items + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + +</queryset> Index: openacs-4/packages/lors-central/www/new-learning-object.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-learning-object.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/new-learning-object.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,13 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<table border=0> +<tr> +<td><h3>#lors-central.upload_a_new#</h3></td> +<td><h3>#lors-central.add_an_existent#</h3></td> +<td><a href=@add_link@ title="#lors-central.add_an_existent#">#lors-central.here#</a></td> +</tr> +</table> + +<formtemplate id=upload_file></formtemplate> Index: openacs-4/packages/lors-central/www/new-learning-object.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-learning-object.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/new-learning-object.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,363 @@ +ad_page_contract { + Creates a one new learning object (ims_item_id) + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation_date 2005-03-28 +} { + man_id:integer,notnull + org_id:notnull + parent:integer,optional + file_upload:trim,optional + file_upload.tmpfile:optional,tmpfile + clipboard_object_id:integer,optional + ims_item_id:integer,optional + {sort_order ""} +} + +set user_id [ad_conn user_id] +# Checking swa privilege over lors-central +lors_central::is_swa + + +set title "[_ lors-central.new_object]" +set context "[list [list "one-course?man_id=$man_id" \ + [_ lors-central.one_course]] [_ lors-central.new_object]]" + +if {![exists_and_not_null parent]} { + set parent $org_id +} + +set add_link "add-lo?man_id=$man_id&org_id=$org_id&parent_item=$parent&sort_order=$sort_order" + +ad_form -name upload_file -html {enctype multipart/form-data} -form { + {item_title:text(text) + {label "[_ lors-central.item_title]"} + } + {file_upload:text(file) + {label "[_ lors-central.choose_the_file]"} + {help_text "[_ lors-central.help_text]"} + } + {zip_p:text(checkbox),optional + {label "[_ lors-central.zip_file]"} + {options {{"" 1}}} + {help_text "[_ lors-central.this_is_a]"} + } + {man_id:text(hidden) + {value $man_id} + } + {org_id:text(hidden) + {value $org_id} + } + {sort_order:text(hidden) + {value $sort_order} + } + {parent:text(hidden) + {value $parent} + } +} -on_submit { + if { ![empty_string_p $zip_p] } { + # It's a zip file so we need to make some things + # unzips the file + if { ![empty_string_p $file_upload] && + [ catch {set tmp_dir [lors::imscp::expand_file $file_upload ${file_upload.tmpfile} expand_$file_upload] } \ + errMsg] } { + ad_return_complaint 1 "[_ lorsm.lt_The_uploaded_file_doe]" + ad_script_abort + } + # Now that we have the zip expanded we will process the files + set allfiles [lors::imscp::dir_walk $tmp_dir] + + db_transaction { + if { [empty_string_p $sort_order] } { + set max_sort_order [db_string get_max_sort_order { } ] + set sort_order [expr $max_sort_order + 1] + } else { + incr sort_order + } + + # First we need to create a new resource + # We need to know where the new resource should be + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + + # We are going to make the first file that is in the tmp folder the default one + set first_file [lindex $allfiles 0] + set first_file_split [split $first_file "/"] + set first_filename [lindex $first_file_split [expr [llength $first_file_split] - 1]] + + # We are going to check if the file_name already exists + set first_filename [lors_central::check_item_name -parent_id $res_folder_id -name $first_filename] + set new_res_item_id [content::item::new -name $first_filename -creation_user $user_id \ + -parent_id $res_folder_id -content_type "ims_resource_object"] + + set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $first_filename \ + -creation_user $user_id -is_live "t"] + + # Now we have to update the new row in the ims_cp_resources using this new resource (new_res_id) + # we need a new href + set new_href "$first_filename" + + db_dml update_new_res { + update + ims_cp_resources + set + man_id = :man_id, + identifier = :first_filename, + type = 'webcontent', + href = :new_href, + hasmetadata = 'f' + where + res_id = :new_res_rev_id + } + + + # First we are going to create a new cr_item (file) for the new resource + # We need the folder_id of the course to store the new item + set course_name [lors_central::get_course_name -man_id $man_id] + set root_folder [lors_central::get_root_folder_id] + set folder_id [db_string get_folder_id { }] + + # Now we are going to store all files in the Content Repository and insert the rows on ims_cp_files + # Here we are going to create a new cr_item and revision for the files that exist on + # the zip + foreach tmp_filename $allfiles { + set split_file [split $tmp_filename "/"] + set filename [lindex $split_file [expr [llength $split_file] - 1]] + set mime_type [cr_filename_to_mime_type -create $filename] + set tmp_size [file size $tmp_filename] + + # We are going to create a new item. First we are going to check + # if the name already exists to generate a new one + set filename [lors_central::check_item_name -parent_id $folder_id -name $filename] + set new_file_item_id [content::item::new -name $filename -creation_user $user_id \ + -parent_id $folder_id] + set new_file_id [content::revision::new -item_id $new_file_item_id -title $filename \ + -creation_user $user_id -mime_type $mime_type -is_live "t"] + + # Now we store the content in the CR + set cr_file [cr_create_content_file $new_file_item_id $new_file_id $tmp_filename] + + # get the size + set file_size [cr_file_size $cr_file] + + # update the file path in the CR and the size on cr_revisions + db_dml update_revision { + update + cr_revisions + set + content = :cr_file, + content_length = :file_size + where + revision_id = :new_file_id + } + + # Now that we have the new item store in the CR, we have to make + # some insert to some tables to adjust to the new cr_item. + # First we have to reflect the new file in the resources table. + # We need to create a new row in the ims_cp_files to associate the new resource to the new file + + db_dml insert_new_file { + insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) + values (:new_file_id, :new_res_rev_id, :filename, :filename, 'f') + } + } + + # Now are going to create a new item (ims_cp_item) + # We need the folder_id of the course to store the new item + set root_ims_folder [lors_central::get_root_items_folder_id] + set items_folder_id [db_string get_items_folder_id { }] + + # set new_ims_item_id [content::item::new -name $first_filename -creation_user $user_id \ + -parent_id $items_folder_id -content_type "ims_item_object"] + # set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $first_filename \ + -creation_user $user_id -is_live "t"] + set new_ims_item_id [content::item::new -name $item_title -creation_user $user_id \ + -parent_id $items_folder_id -content_type "ims_item_object"] + set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $item_title \ + -creation_user $user_id -is_live "t"] + + # We need to insert in the ims_cp_items at the proper sort_order so we are going + # to rearrenge the items sort_order and then fill the information for the item + db_foreach get_items_to_reorder { } { + set new_sort [expr $order + 1] + db_dml reorder_items { } + } + + db_dml update_ims_cp_items { + update ims_cp_items set + org_id = :org_id, + identifier = :first_filename, + identifierref = :first_filename, + item_title = :item_title, + sort_order = :sort_order, + parent_item = :parent + where ims_item_id = :new_ims_rev_id + } + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_rev_id) + } + + # We also need to map this item to (ims_cp_items_map) + # We need to do it for every community that is associated to this course (man_id) + set com_list [db_list_of_lists get_community_id { + select distinct community_id from ims_cp_items_map + where man_id = :man_id + }] + foreach community_id $com_list { + db_dml insert_item { + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:new_ims_rev_id) + } + } + } + + # We delete the temporary directory created when unzipping the file + exec rm -fr $tmp_dir + } else { + db_transaction { + if { [empty_string_p $sort_order] } { + set max_sort_order [db_string get_max_sort_order { } ] + set sort_order [expr $max_sort_order + 1] + } else { + incr sort_order + } + set tmp_filename [ns_queryget file_upload.tmpfile] + set mime_type [cr_filename_to_mime_type -create $file_upload] + set tmp_size [file size $tmp_filename] + + # First we are going to create a new cr_item (file) for the new resource + # We need the folder_id of the course to store the new item + set course_name [lors_central::get_course_name -man_id $man_id] + set root_folder [lors_central::get_root_folder_id] + set folder_id [db_string get_folder_id { }] + + + # We are going to create a new item. First we are going to check + # if the name already exists to generate a new one + set file_upload [lors_central::check_item_name -parent_id $folder_id -name $file_upload] + set new_file_item_id [content::item::new -name $file_upload -creation_user $user_id \ + -parent_id $folder_id] + set new_file_id [content::revision::new -item_id $new_file_item_id -title $file_upload -creation_user $user_id \ + -mime_type $mime_type -is_live "t"] + + # Now we store the content in the CR + set cr_file [cr_create_content_file $new_file_item_id $new_file_id $tmp_filename] + + # get the size + set file_size [cr_file_size $cr_file] + + # update the file path in the CR and the size on cr_revisions + db_dml update_revision { + update + cr_revisions + set + content = :cr_file, + content_length = :file_size + where + revision_id = :new_file_id + } + + # Now that we have the new item store in the CR, we have to make + # some insert to some tables to adjust to the new cr_item. + # First we have to reflect the new file in the resources table, so we have to make + # a new cr_item and revision for the resource and insert it on the ims_cp_resources table + + # We need to know where the new resource should be + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + + set new_res_item_id [content::item::new -name $file_upload -creation_user $user_id \ + -parent_id $res_folder_id -content_type "ims_resource_object"] + + set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $file_upload \ + -creation_user $user_id -is_live "t"] + + + # Now we have to update the new row in the ims_cp_resources using this new resource (new_res_id) + # we need a new href + set new_href "$file_upload" + + db_dml update_new_res { + update + ims_cp_resources + set + man_id = :man_id, + identifier = :file_upload, + type = 'webcontent', + href = :new_href, + hasmetadata = 'f' + where + res_id = :new_res_rev_id + } + # We need to create a new row in the ims_cp_files to associate the new resource to the new file + db_dml insert_new_file { + insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) + values (:new_file_id, :new_res_rev_id, :new_href, :file_upload, 'f') + } + + # Now are going to create a new item (ims_cp_item) + # We need the folder_id of the course to store the new item + set root_ims_folder [lors_central::get_root_items_folder_id] + set items_folder_id [db_string get_items_folder_id { }] + + #set new_ims_item_id [content::item::new -name $file_upload -creation_user $user_id -parent_id $items_folder_id \ + -content_type "ims_item_object"] + #set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $file_upload \ + -creation_user $user_id -is_live "t"] + set new_ims_item_id [content::item::new -name $item_title -creation_user $user_id -parent_id $items_folder_id \ + -content_type "ims_item_object"] + set new_ims_rev_id [content::revision::new -item_id $new_ims_item_id -title $item_title \ + -creation_user $user_id -is_live "t"] + + # We need to insert in the ims_cp_items at the proper sort_order so we are going + # to rearrenge the items sort_order and then fill the information for the item + db_foreach get_items_to_reorder { } { + set new_sort [expr $order + 1] + db_dml reorder_items { } + } + + db_dml update_ims_cp_items { + update ims_cp_items set + org_id = :org_id, + identifier = :file_upload, + identifierref = :file_upload, + item_title = :item_title, + sort_order = :sort_order, + parent_item = :parent + where ims_item_id = :new_ims_rev_id + } + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_rev_id) + } + + # We also need to map this item to (ims_cp_items_map) + # We need to do it for every community that is associated to this course (man_id) + set com_list [db_list_of_lists get_community_id { + select distinct community_id from ims_cp_items_map + where man_id = :man_id + }] + foreach community_id $com_list { + db_dml insert_item { + insert into ims_cp_items_map + (man_id,org_id,community_id,ims_item_id) + values + (:man_id,:org_id,:community_id,:new_ims_rev_id) + } + } + } + } +} -after_submit { + ad_returnredirect "one-learning-object?man_id=$man_id&ims_item_id=$new_ims_rev_id" +} + Index: openacs-4/packages/lors-central/www/new-learning-object.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/new-learning-object.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/new-learning-object.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="get_max_sort_order"> + <querytext> + select + max (sort_order) + from + ims_cp_items + where + org_id = :org_id + </querytext> +</fullquery> + +<fullquery name="get_items_to_reorder"> + <querytext> + select + sort_order as order, ims_item_id as reorder_item_id + from + ims_cp_items + where + org_id = :org_id + and sort_order >= :sort_order + </querytext> +</fullquery> + +<fullquery name="reorder_items"> + <querytext> + update + ims_cp_items + set + sort_order = :new_sort + where + ims_item_id = :reorder_item_id + </querytext> +</fullquery> + +<fullquery name="get_folder_id"> + <querytext> + select + item_id + from + cr_items + where + name = :course_name and + parent_id = :root_folder + </querytext> +</fullquery> + +<fullquery name="get_items_folder_id"> + <querytext> + select + item_id + from + cr_items + where + name = :course_name and + parent_id = :root_ims_folder + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/not-allowed.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/not-allowed.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/not-allowed.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,5 @@ +<master> +<property name="title">#lors-central.action_not#</property> +<property name="context">@context;noquote@</property> + +#lors-central.we_are_sorry# \ No newline at end of file Index: openacs-4/packages/lors-central/www/not-allowed.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/not-allowed.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/not-allowed.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + + Action not allowed. + + @author Lars Pind (lars@pinds.com) + @creation-date 2002-10-14 + @cvs-id $Id: not-allowed.tcl,v 1.1 2005/05/17 16:21:19 miguelm Exp $ +} + +set context [list "[_ lorsm.Not_Allowed]"] Index: openacs-4/packages/lors-central/www/one-course-associations.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-associations.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-associations.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,19 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<br> +<h3>#lors-central.course_versions#:</h3> +<listtemplate name="course_versions"></listtemplate> + +<h3>#lors-central.This_course_is#</h3> + +<listtemplate name="dotlrn_classes"></listtemplate> + +<br> +<if @man_id@ not nil> + <a class=button href="course-dotlrn-assoc?man_id=@man_id;noquote@">#lors-central.associate_drop#</a> +</if> +<else> + <a class=button href="course-dotlrn-assoc?item_id=@item_id;noquote@">#lors-central.associate_drop#</a> +</else> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-course-associations.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-associations.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-associations.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,204 @@ +ad_page_contract { + Displays all the information about one course (man_id) + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation-date 2005-03-17 +} { + man_id:integer,optional + item_id:integer,optional + {orderby "class,asc"} +} + + + + +# Get the item_id that the manifest_id has associated +if { ![info exist item_id] } { + set item_id [lors_central::get_item_id -revision_id $man_id] +} + +set title "[_ lors-central.one_course_assoc]" +set context "[list [list "one-course?item_id=$item_id" [_ lors-central.one_course]] [_ lors-central.one_course_assoc]]" + +############################### Versions Template ################################################# + +set last_version [db_string get_live_revision "select live_revision from cr_items where item_id = :item_id"] +db_multirow -extend { assoc_count ver_num date author live_classes } course_versions get_versions { } { + set ver_num [lors_central::get_version_num -revision_id $man_id] + set date [lindex $last_modified 0] + append date " [lindex [split [lindex $last_modified 1] "."] 0]" + set author [lors_central::get_username -user_id $user_id] + set live_classes [lors_central::get_live_classes -man_id $man_id] + set assoc_count [db_string get_assoc_count { } -default 0] +} + +template::list::create \ + -name course_versions \ + -multirow course_versions \ + -key course_name \ + -bulk_action_method post \ + -has_checkboxes \ + -bulk_action_export_vars { + } \ + -row_pretty_plural "[_ lors-central.course_versions]" \ + -elements { + version_number { + label "[_ lors-central.version_number]" + display_template { + <if $last_version eq @course_versions.man_id@> + <center><b>@course_versions.ver_num@</b></center> + </if> + <else> + <center>@course_versions.ver_num@</center> + </else> + } + } + course_name { + label "[_ lors-central.course_name]" + display_template { + <if $last_version eq @course_versions.man_id@> + <b>@course_versions.course_name@</b> + </if> + <else> + @course_versions.course_name@ + </else> + } + } + author { + label "[_ lors-central.author]" + display_template { + <a href="/shared/community-member?user_id=@course_versions.user_id@">@course_versions.author@</a> + } + } + last_modified { + label "[_ lors-central.last_modified]" + display_template { + @course_versions.date@ + } + } + live_classes { + label "[_ lors-central.live_classes]" + display_template { + <if @course_versions.live_classes@ gt 0> + <center> + <a href="course-live-in?man_id=@course_versions.man_id@">@course_versions.live_classes@</a> + </center> + </if> + <else> + <center>@course_versions.live_classes@</center> + </else> + } + } + make_live { + display_template { + <if @course_versions.assoc_count@ gt 0> + <a href="course-version-change?man_id=@course_versions.man_id@">[_ lors-central.make_live]</a> + </if> + } + } + } + +################################### Associations Template ################################################# + +template::list::create \ + -name dotlrn_classes \ + -multirow cl_list \ + -key com_id \ + -has_checkboxes \ + -bulk_actions { #lors-central.update_versions# "change-one-version" #lors-central.update_course_ver# }\ + -bulk_action_method post \ + -bulk_action_export_vars { + item_id + } \ + -row_pretty_plural "[_ lors-central.dotlrn_classes]" \ + -elements { + class { + label "[_ lors-central.class_name]" + display_template { + @cl_list.pretty_name@ + <a href="one-course-views?man_id=@cl_list.manifest_id@&community_id=@cl_list.com_id@"> + [_ lors-central.views] + </a> + } + } + subject { + label "[_ lors-central.subject_name]" + display_template { + @cl_list.class_name@ + } + } + term_name { + label "[_ lors-central.term_name]" + display_template { + @cl_list.term_name@ + } + } + current { + label "[_ lors-central.current]" + display_template { + @cl_list.ver_num@ [_ lors-central.of] @cl_list.ver_count@ + } + } + set_to { + label "[_ lors-central.set_to]" + display_template { + <input type=hidden name="objects_id" value=@cl_list.com_id@> + <input type=hidden name="objects_count" value=@cl_list.ver_count@> + <select name="objects_value"> + @cl_list.options;noquote@ + </select> + } + } + tracking { + label "[_ lors-central.tracking]" + display_template { + <center> + <a href="tracker?man_id=@cl_list.manifest_id@&community_id=@cl_list.com_id@"> + <if @cl_list.tracking@> + [_ lors-central.enabled] + </if> + <else> + [_ lors-central.disabled] + </else> + </a> + </center> + } + } + } -filters { + man_id {} + } -orderby { + class { + orderby_asc {pretty_name asc} + orderby_desc {pretty_name desc} + } + subject { + orderby_asc {class_name asc} + orderby_desc {class_name desc} + } + term_name { + orderby_asc {term_name asc} + orderby_desc {term_name desc} + } + + } + +set orderby_clause [template::list::orderby_clause -orderby -name "dotlrn_classes"] + +db_multirow -extend { ver_num ver_count manifest_id options tracking } cl_list get_dotlrn_classes { } { + set manifest_id [lors_central::get_man_id -community_id $com_id -item_id $item_id] + set ver_count [lors_central::count_versions -man_id $manifest_id] + set ver_num [lors_central::get_version_num -revision_id $manifest_id] + set tracking [db_string get_tracking { }] + # Create the options for the select menu + set options "" + for { set i 1 } { $i < [expr $ver_count + 1] } { incr i } { + if { [string equal $i $ver_num] } { + append options "<option value=$i selected>$i</options>" + } else { + append options "<option value=$i>$i</options>" + } + } +} + + Index: openacs-4/packages/lors-central/www/one-course-associations.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-associations.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-associations.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,94 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_dotlrn_classes"> + <querytext> + select + dc.class_instance_id as com_id, + dc.department_name, + dc.term_name, + dc.class_name, + dc.pretty_name + from + dotlrn_class_instances_full dc + where + dc.class_instance_id in + ( + select + icmc.community_id + from + ims_cp_manifest_class icmc + where + icmc.man_id in + ( + select + revision_id + from + cr_revisions + where + item_id = :item_id + ) + ) + $orderby_clause + </querytext> + </fullquery> + + + <fullquery name="get_versions"> + <querytext> + select + r.title as course_name, + r.revision_id as man_id, + r.publish_date as last_modified, + ao.creation_user as user_id + from + cr_revisions r, acs_objects ao + where + :item_id = r.item_id and + r.revision_id = ao.object_id + order by + revision_id asc + </querytext> + </fullquery> + + <fullquery name="get_tracking"> + <querytext> + select + istrackable + from + ims_cp_manifest_class + where + community_id = :com_id + and man_id = :manifest_id + </querytext> + </fullquery> + + + <fullquery name="get_assoc_count"> + <querytext> + select + count(dc.class_instance_id) + from + dotlrn_class_instances_full dc + where + dc.class_instance_id in + ( + select + icmc.community_id + from + ims_cp_manifest_class icmc + where + icmc.man_id in + ( + select + revision_id + from + cr_revisions + where + item_id = :item_id + ) + ) + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-course-item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-item.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-item.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,32 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> +<property name="displayed_object_id">@displayed_object_id@</property> + +<h1>@name@</h1> +<a class=button href="tracking/?man_id=@man_id@&item_id=@ims_item_id@" title="#lors-central.All_views_of#"> +#lors-central.All_views# +</a> +<a class="button" href="md/pbs-md/?ims_md_id=@displayed_object_id@">Edit Metadata</a> + +<h3>Versions of this learning object:</h3> +<listtemplate name="item_versions"></listtemplate> + +<h3>#lors-central.This_learning_obj#</h3> + +<listtemplate name="courses"></listtemplate> + +<!-- include src="/packages/lors-central/lib/item-files/" ims_item_id="@displayed_object_id@" man_id="@man_id@" org_id="@org_id@" --> + +<!-- h3>Clipboard</h3 --> +<!-- include src="/packages/lors-central/lib/clipboard" --> +</div> +<hr><h1>Preview</h1> + +<if @prev_type@ eq "image"> + <img src="download?file_id=@file_prev_id@"> +</if> +<else> + <include src="download/preview" file_id=@file_prev_id@> +</else> + Index: openacs-4/packages/lors-central/www/one-course-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-item.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-item.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,232 @@ +ad_page_contract { + Displays all the information about one learning object (ims_item_id) + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation-date 2005-03-17 +} { + man_id:integer + ims_item_id:integer + {name ""} + {orderby "class,asc"} +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set displayed_object_id $ims_item_id + +# Get the item_id that the ims_item_id has associated +set item_id [lors_central::get_item_id -revision_id $ims_item_id] +set man_item_id [lors_central::get_item_id -revision_id $man_id] +set course_name [lors_central::get_course_name -man_id $man_id] +set org_id [db_string get_org_id { } -default ""] + + +# Get the live revision for preview + +set last_version [db_string get_live_revision { }] +set file_revision [lors_central::get_content_revision_id -ims_item_id $ims_item_id] +if { [empty_string_p $name] } { + set name [db_string get_name { }] +} + +if { [string equal $file_revision 0] } { + # The items is probably an URL so we are going to get it + set file_prev_id [lors_central::get_item_url -ims_item_id $ims_item_id -man_id $man_id] + set prev_type "" +} else { + set file_prev_id [lors_central::get_item_id -revision_id $file_revision] + set prev_type [db_string get_prev_mime_type { } -default ""] + set prev_type [lindex [split $prev_type "/"] 0] +} + + +#################################### Versions Template ################################################# +set num 0 +db_multirow -extend { ver_num date author mime_type num file_id} item_versions get_versions { } { + set ver_num [lors_central::get_version_num -revision_id $ims_item_id] + set date [lindex $last_modified 0] + append date " [lindex [split [lindex $last_modified 1] "."] 0]" + set author [lors_central::get_username -user_id $user_id] + set file_id [lors_central::get_res_file_id -res_id $res_id] + if { ![string equal $file_id ""] } { + set mime_type [db_string get_mime_type { } -default ""] + if { [string equal $ims_item_id $last_version] } { + set live_file_id $file_id + } + } else { + set mime_type "URL" + set live_file_id 0 + } + set num [expr $num + 1] + if {$displayed_object_id == $ims_item_id} { + set displayed_object_title $item_name + } +} + +template::list::create \ + -name item_versions \ + -multirow item_versions \ + -key ims_item_id \ + -bulk_action_method post \ + -has_checkboxes \ + -bulk_action_export_vars { + } \ + -row_pretty_plural "[_ lors-central.item_versions]" \ + -elements { + version_number { + label "[_ lors-central.version_number]" + display_template { + <if $displayed_object_id eq @item_versions.ims_item_id@> + <center><b>» @item_versions.ver_num@</b></center> + </if> + <else> + <center>@item_versions.ver_num@</center> + </else> + } + } + course_name { + label "[_ lors-central.item_name]" + display_template { + <a href="one-resource?res_id=@item_versions.res_id@"> + <if $displayed_object_id eq @item_versions.ims_item_id@> + <b>@item_versions.item_name@</b> + </if> + <else> + @item_versions.item_name@ + </else> + </a> + } + } + author { + label "[_ lors-central.author]" + display_template { + <a href="/shared/community-member?user_id=@item_versions.user_id@">@item_versions.author@</a> + } + } + last_modified { + label "[_ lors-central.last_modified]" + display_template { + @item_versions.date@ + } + } + mime_type { + label "[_ lors-central.type]:" + display_template { + @item_versions.mime_type@ + } + } + make_live { + display_template { + [_ lors-central.make] + <a href="change-lo-version?ims_item_id=@item_versions.ims_item_id@&man_id=$man_id&item_id=$item_id&name=$name&live_hide_p=live">[_ lors-central.live]<a> + / + <a href="change-lo-version?ims_item_id=@item_versions.ims_item_id@&man_id=$man_id&item_id=$item_id&name=$name&live_hide_p=hide">[_ lors-central.hide]</a> + [_ lors-central.everywhere] + } + } + } + +################################### Associations Template ################################################# + +template::list::create \ + -name courses \ + -multirow cl_list \ + -key com_id \ + -has_checkboxes \ + -bulk_actions { #lors-central.update_versions# "change-one-lo-version" #lors-central.update_course_ver# } \ + -bulk_action_method post \ + -bulk_action_export_vars { man_id name ims_item_id } \ + -row_pretty_plural "[_ lors-central.dotlrn_classes]" \ + -elements { + class { + label "[_ lors-central.class_name]" + display_template { + @cl_list.pretty_name@ + } + } + subject { + label "[_ lors-central.subject_name]" + display_template { + @cl_list.class_name@ + } + } + term_name { + label "[_ lors-central.term_name]" + display_template { + @cl_list.term_name@ + } + } + current { + label "[_ lors-central.current]" + display_template { + <if @cl_list.hide_p@> + 0 + </if> + <else> + @cl_list.ver_num@ + </else> + [_ lors-central.of] @cl_list.ver_count@ + } + } + set_to { + label "[_ lors-central.set_to]" + display_template { + <input type=hidden name="objects_id" value=@cl_list.com_id@> + <input type=hidden name="objects_count" value=@cl_list.ver_count@> + <select name="objects_value"> + @cl_list.options;noquote@ + </select> + } + } + views { + label "[_ lors-central.views_in]" + display_template { + <center> + <a href="tracking/?man_id=@cl_list.manifest_id@&community_id=@cl_list.com_id@&item_id=$ims_item_id"> + [_ lors-central.views] + </a> + </center> + } + } + } -filters { + man_id {} + } -orderby { + class { + orderby_asc {pretty_name asc} + orderby_desc {pretty_name desc} + } + subject { + orderby_asc {class_name asc} + orderby_desc {class_name desc} + } + term_name { + orderby_asc {term_name asc} + orderby_desc {term_name desc} + } + } + +set orderby_clause [template::list::orderby_clause -orderby -name "courses"] + +db_multirow -extend { ver_num ver_count manifest_id options hide_p } cl_list get_dotlrn_classes { } { + set manifest_id [lors_central::get_man_id -community_id $com_id -item_id $man_item_id] + set ims_item [db_string get_ims_item_id { }] + set hide_p [db_string get_hide_p { }] + set ver_num [lors_central::get_version_num -revision_id $ims_item] + set ver_count [lors_central::get_revision_count -revision_id $ims_item_id] + # Create the options for the select menu + set options "" + for { set i 0 } { $i < [expr $ver_count + 1] } { incr i } { + if { [string equal $i $ver_num] } { + append options "<option value=$i selected>$i</options>" + } else { + append options "<option value=$i>$i</options>" + } + } +} + +set title "${course_name}: ${item_title}" +set context [list [list "one-course?man_id=$man_id" [_ lors-central.one_course]] "[_ lors-central.One_learning]"] + +ad_return_template Index: openacs-4/packages/lors-central/www/one-course-item.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-item.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-item.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,197 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_dotlrn_classes"> + <querytext> + select + dc.class_instance_id as com_id, + dc.department_name, + dc.term_name, + dc.class_name, + dc.pretty_name + from + dotlrn_class_instances_full dc + where + dc.class_instance_id in + ( + select community_id from ims_cp_items_map where man_id = :man_id + ) + and + dc.class_instance_id in + ( + select + icmc.community_id + from + ims_cp_manifest_class icmc + where + icmc.man_id in + ( + select + revision_id + from + cr_revisions + where + item_id = :man_item_id + ) + ) + $orderby_clause + </querytext> + </fullquery> + + + <fullquery name="get_versions"> + <querytext> + select + r.item_title, + r.title as item_name, + r.revision_id as ims_item_id, + r.publish_date as last_modified, + ao.creation_user as user_id, + ir.res_id + from + ims_cp_itemsx r, acs_objects ao, + ims_cp_items_to_resources ir + + where + r.item_id = :item_id + and r.revision_id = ao.object_id + and ir.ims_item_id = r.revision_id + order by + revision_id asc + </querytext> + </fullquery> + + <fullquery name="get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_file_id"> + <querytext> + select + file_id + from + ims_cp_files + where + res_id = :res_id and + pathtofile = :href + </querytext> + </fullquery> + + <fullquery name="get_res_file_id"> + <querytext> + select + f.file_id + frome + ims_cp_files f, ims_cp_resources r + where + r.res_id = :res_id and + f.res_id = r.res_id + f.pathtofile = r.href + </querytext> + </fullquery> + + <fullquery name="get_mime_type"> + <querytext> + select + mime_type + from + cr_revisions + where + revision_id = :file_id + </querytext> + </fullquery> + + <fullquery name="get_hide_p"> + <querytext> + select + hide_p + from + ims_cp_items_map + where + ims_item_id = :ims_item + and community_id = :com_id + </querytext> + </fullquery> + + <fullquery name="get_org_id"> + <querytext> + select + org_id + from + ims_cp_items + where + ims_item_id=:ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_live_revision"> + <querytext> + select + live_revision + from + cr_items + where + item_id= :item_id + </querytext> + </fullquery> + + <fullquery name="get_name"> + <querytext> + select + item_title + from + ims_cp_items + where + ims_item_id= :last_version + </querytext> + </fullquery> + + <fullquery name="get_isshared"> + <querytext> + select + isshared + from + ims_cp_items + where + ims_item_id= :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_prev_mime_type"> + <querytext> + select + mime_type + from + cr_revisions + where + revision_id = (select live_revision from cr_items where item_id = :file_prev_id) + </querytext> + </fullquery> + + <fullquery name="get_ims_item_id"> + <querytext> + select + ims_item_id + from + ims_cp_items_map + where + man_id =:man_id and + community_id = :com_id and + ims_item_id in ( select revision_id + from cr_revisions + where item_id = ( select item_id + from cr_revisions + where revision_id = :ims_item_id + ) + ) + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-course-views.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-views.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-views.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,8 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<br> +<h3>#lors-central.course_versions#:</h3> +<listtemplate name="course_versions"></listtemplate> + Index: openacs-4/packages/lors-central/www/one-course-views.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-views.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-views.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,94 @@ +ad_page_contract { + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:integer,optional + community_id:integer,notnull +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +# Get the item_id that the manifest_id has associated +if { ![info exist item_id] } { + set item_id [lors_central::get_item_id -revision_id $man_id] +} + +set title "[_ lors-central.one_course_views]" +set context "[list [list "one-course-associations?man_id=$man_id" [_ lors-central.one_course_assoc]] [_ lors-central.one_course_views]]" + +############################### Versions Template ################################################# + +set last_version [db_string get_live_revision "select live_revision from cr_items where item_id = :item_id"] +db_multirow -extend { ver_num date author live_classes } course_versions get_versions { } { + set ver_num [lors_central::get_version_num -revision_id $man_id] + set date [lindex $last_modified 0] + append date " [lindex [split [lindex $last_modified 1] "."] 0]" + set author [lors_central::get_username -user_id $user_id] + set live_classes [lors_central::get_live_classes -man_id $man_id] +} + +template::list::create \ + -name course_versions \ + -multirow course_versions \ + -key course_name \ + -bulk_action_method post \ + -has_checkboxes \ + -bulk_action_export_vars { + } \ + -row_pretty_plural "[_ lors-central.course_versions]" \ + -elements { + version_number { + label "[_ lors-central.version_number]" + display_template { + <if $last_version eq @course_versions.man_id@> + <center><b>@course_versions.ver_num@</b></center> + </if> + <else> + <center>@course_versions.ver_num@</center> + </else> + } + } + course_name { + label "[_ lors-central.course_name]" + display_template { + <if $last_version eq @course_versions.man_id@> + <b>@course_versions.course_name@</b> + </if> + <else> + @course_versions.course_name@ + </else> + } + } + author { + label "[_ lors-central.author]" + display_template { + <a href="/shared/community-member?user_id=@course_versions.user_id@">@course_versions.author@</a> + } + } + last_modified { + label "[_ lors-central.last_modified]" + display_template { + @course_versions.date@ + } + } + live_classes { + label "[_ lors-central.live_classes]" + display_template { + <center> + @course_versions.live_classes@ + </center> + } + } + views { + label "[_ lors-central.views_in]" + display_template { + <center> + <a href="tracking/?man_id=@course_versions.man_id@&commmunity_id=$community_id"> + [_ lors-central.views] + </a> + </center> + } + } + } + Index: openacs-4/packages/lors-central/www/one-course-views.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course-views.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course-views.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_versions"> + <querytext> + select + r.title as course_name, + r.revision_id as man_id, + r.publish_date as last_modified, + ao.creation_user as user_id + from + cr_revisions r, acs_objects ao + where + :item_id = r.item_id and + r.revision_id = ao.object_id + order by + revision_id asc + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-course.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,136 @@ +<master> + <property name="title">@title@</property> + <property name="context">"#lors-central.one_course#"</property> + +<blockquote> +<table class="list" cellpadding="3" cellspacing="1" width="100%"> + <tr class="list-header"> + <th class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" colspan="2"> + #lorsm.Course_Information# + </th> + </tr> + <tr class="list-odd"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Course_Name# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0; font-weight: bold;"> + @course_name;noquote@ + </td> + </tr> + <tr class="list-even"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Version# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0"> + <if @version@ eq "0"> + @version_msg;noquote@ + </if> + <else> + @version;noquote@ Course Versions <a href="course-versions?man_id=@man_id@">Manage</a> + </else> + </td> + </tr> + <tr class="list-odd"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Metadata# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0"> + <if @man_metadata@ eq "Yes"> + <a href="md/pbs-md/?ims_md_id=@man_id@">#lorsm.Yes#</a> + </if> + <else> + <a href="md/pbs-md/?ims_md_id=@man_id@">#lorsm.No#</a> + </else> + </td> + </tr> + <tr class="list-even"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Identifier# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0" width="80%"> + @identifier@ + </td> + </tr> + <tr class="list-odd"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Is_SCORM# + </td> + <td + <if @isscorm@ eq "Yes"> + #lorsm.lt_classlist_stylefont-w# + </if> + <else> + class="list" + </else> + valign="top" align="left">@isscorm;noquote@ + </td> + </tr> + <tr class="list-even"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Storage_Folder# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0" width="80%"> + <a href="folder-description?folder_id=@folder@">@instance@</a> + </td> + </tr> + <tr class="list-odd"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Created_By# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0" width="80%"> + @created_by@ + </td> + </tr> + <tr class="list-even"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Date# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0" width="80%"> + @creation_date;noquote@ + </td> + </tr> + <tr class="list-odd"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Submanifests# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0" width="80%"> + @submanifests@ + </td> + </tr> + <tr class="list-even"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lors-central.assoc# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0" width="80%"> + <b>@assoc_num@</b> <a href="one-course-associations?man_id=@man_id@">#lors-central.watch_assoc#</a> + </td> + </tr> + <tr class="list-odd"> + <td class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" width="20%"> + #lorsm.Export# + </td> + <td class="list" valign="top" style="background-color: #f0f0f0" width="80%"> + <a href="export/create-zip?man_id=@man_id@&folder_id=@folder@" title="#lorsm.lt_Export_as_IMS_Content#">[ Zip ]</a> + </td> + </tr> + <tr class="list-header"> + <th class="list" valign="top" style="background-color: #e0e0e0; font-weight: bold;" colspan="2"> + #lorsm.Organizations# + </th> + </tr> + <tr class="list-odd"> + <td valign="top" style="background-color: #f0f0f0; font-weight: bold;" colspan="2"> + + </td> + </tr> + <tr class="list-odd"> + <td valign="top" style="background-color: #f0f0f0; font-weight: bold;" colspan="2"> + @orgs_list;noquote@ + </td> + </tr> +</table> +</blockquote> + +<hr> + + Index: openacs-4/packages/lors-central/www/one-course.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,211 @@ +ad_page_contract { + Displays all the information related to one course +} { + item_id:integer,optional + man_id:integer,optional +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +if { ![info exist item_id] && ![info exist man_id] } { + ad_return_complaint 1 "You must pass either item_id or man_id" +} else { + if { ![info exist man_id] } { + set man_id [content::item::get_live_revision -item_id $item_id] + } + if { ![info exist item_id] } { + set item_id [lors_central::get_item_id -revision_id $man_id] + } +} + + +set package_id "" +set title "[_ lors-central.one_course]" +set assoc_num [db_string get_associations_num { } -default 0] + +if {[db_0or1row manifest { }]} { + + # Sets the variable for display. + set display 1 + + # Course Name + if {[empty_string_p $course_name]} { + set course_name "[_ lorsm.No_course_Name]" + } + + # Version + set version [lors_central::count_versions -item_id $item_id] + + if {[string equal $version "0"]} { + set version_msg "[_ lorsm.No_version_Available]" + } + + # Instance + set instance [lors_central::get_course_name -man_id $man_id] + + # Folder + set root_folder [lors_central::get_root_folder_id] + + set folder [db_string get_folder_id { }] + + # Created By + set created_by [person::name -person_id $creation_user] + + # Creation Date + set creation_date [lc_time_fmt $creation_date "%x %X"] + + # Check for submanifests + if {[db_0or1row submans " + select + count(*) as submanifests + from + ims_cp_manifests + where + man_id = :man_id + and + parent_man_id = :man_id"]} { + } else { + set submanifests 0 + } + + +} else { + + set display 0 + +} + + +append orgs_list "<table class=\"list\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\">" +append orgs_list "<tr class=\"list-header\"> + <th class=\"list\" valign=\"top\" style=\"background-color: #e0e0e0; font-weight: bold;\"> + [_ lorsm.Organization] + </th> + <th class=\"list\" valign=\"top\" style=\"background-color: #e0e0e0; font-weight: bold;\"> + [_ lorsm.Metadata_1] + </th> + <th class=\"list\" valign=\"top\" style=\"background-color: #e0e0e0; font-weight: bold;\"> + [_ lorsm.Items]</th> + </tr>" + + + +db_foreach organizations { } { + + set total_items [db_string items_count {select count(*) from ims_cp_items where org_id=:org_id} -default 0] + # We get the indent of the items in this org_id + set indent_list [lors_central::get_items_indent -org_id $org_id] + template::util::list_of_lists_to_array $indent_list indent_array + + append orgs_list "<tr class=\"list-even\"> + <td valign=\"top\" width=\"15%\"> + $org_title + </td> + <td valign=\"top\" align=\"center\" width=\"5%\"> + $hasmetadata</td> + <td>" + + set missing_text "[_ lorsm.Nothing_here]" + set return_url [export_vars -base [ns_conn url] man_id] + set table_extra_html { width="100%" } + + set table_extra_vars {return_url man_id total_items indent_array} + set table_def { + { + reorder "" "no_sort" "<td width=5%> + [if {![empty_string_p $identifierref]} { + set min_item [db_string get_min_item { + select min(sort_order) from ims_cp_items + where parent_item = (select parent_item + from ims_cp_items + where ims_item_id = :item_id)}] + set max_item [db_string get_max_item { + select max(sort_order) from ims_cp_items + where parent_item = (select parent_item + from ims_cp_items + where ims_item_id = :item_id)}] + set childs_count [db_string get_max_item { + select count(sort_order) from ims_cp_items + where parent_item = (select parent_item + from ims_cp_items + where ims_item_id = :item_id) and + ims_item_id in ( select live_revision from cr_items)}] + + if { $childs_count > 1 } { + if { [string equal $max_item $sort_order] } { + set href \" + <div align=center> + <a href=\'reorder-items?item_id=$item_id&org_id=$org_id&sort_order=$sort_order&dir=up\'> + <img border=0 src=images/up.gif> + </a></div>\" + } else { + if { [string equal $min_item $sort_order] } { + set href \" + <div align=center> + <a href=\'reorder-items?item_id=$item_id&org_id=$org_id&sort_order=$sort_order&dir=down\'> + <img border=0 src=images/down.gif> + </a></div>\" + } else { + set href \" + <div align=center> + <a href=\'reorder-items?item_id=$item_id&org_id=$org_id&sort_order=$sort_order&dir=up\'> + <img border=0 src=images/up.gif> + </a> + <a href=\'reorder-items?item_id=$item_id&org_id=$org_id&sort_order=$sort_order&dir=down\'> + <img border=0 src=images/down.gif> + </a></div>\" + } + } + } + }] + </td>" + } + { title "\#lorsm.Item_Name\#" \ + "no_sort" \ + "<td> [ set indent \"\" + for { set i 0 } { $i < [expr $indent_array($item_id)-1]} { incr i } { + append indent \" \" + } + if {![empty_string_p $identifierref]} { + set href \"$indent<a href=\'one-learning-object?ims_item_id=$item_id&man_id=$man_id&name=$item_title\'>$item_title</a>\" + } else { + set href \"$item_title\" + } + ]" + } + { add_object "\#lors-central.add_object\#" "no_sort" " + <td><div align=center> + [if {[string equal $parent_item $org_id]} { + set href \" + <a href=\'new-learning-object?man_id=$man_id&org_id=$org_id&sort_order=$sort_order&parent=$item_id\'> + [_ lors-central.add]</a> + </td></div></td></center>\" + }]" + } + { metadata "\#lorsm.Metadata_1\#" + "no_sort" + "<td align=\"center\">[if {$hasmetadata == \"f\"} { + set hasmetadata \"<a href=md/pbs-md/?ims_md_id=$item_id>No\"} else {set hasmetadata \"<a href=md/pbs-md/?ims_md_id=$item_id>Yes\" + }]</a></td>" + } + { type "\#lorsm.Type\#" "no_sort" "<td align=\"center\">$type</td>" } + } + + set table_item [ad_table -Tmissing_text $missing_text -Textra_vars $table_extra_vars -Theader_row_extra "style=\"background-color: #e0e0e0; font-weight: bold;\" class=\"list-header\"" -Ttable_extra_html $table_extra_html ad_table_contents_query { } $table_def] + + append orgs_list "$table_item" + append orgs_list "</td></tr> + <tr> + <td> + <a href=\"new-learning-object?org_id=$org_id&man_id=$man_id&parent=$org_id\" class=button> + [_ lors-central.add_object] + </a> + </td> + </tr>" +} if_no_rows { + append orgs_list "<tr class=\"list-odd\"><td></td></tr>" +} + +append orgs_list "</table>" + Index: openacs-4/packages/lors-central/www/one-course.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-course.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-course.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,170 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="manifest"> + <querytext> + select + cp.man_id, + cp.course_name, + cp.identifier, + text 'Yes' as hello, + case + when hasmetadata = 't' then 'Yes' + else 'No' + end as man_metadata, + case + when isscorm = 't' then 'Yes' + else 'No' + end as isscorm, + cp.folder_id, + cp.isshared, + acs.creation_user, + acs.creation_date, + acs.context_id +-- cpmc.isenabled, +-- cpmc.lorsm_instance_id, +-- cpmc.istrackable + from + ims_cp_manifests cp, acs_objects acs + where + cp.man_id = acs.object_id + and cp.man_id = :man_id +-- and cp.man_id = cpmc.man_id +-- and cpmc.lorsm_instance_id = :package_id + and cp.parent_man_id = 0 + </querytext> +</fullquery> + +<fullquery name="get_folder_id"> + <querytext> + select + item_id + from + cr_items + where + name = :instance and + parent_id = :root_folder + </querytext> +</fullquery> + +<fullquery name="organizations"> + <querytext> + select + org.org_id, + org.org_title as org_title, + org.hasmetadata, + tree_level(o.tree_sortkey) as indent + from + ims_cp_organizations org, acs_objects o + where + org.org_id = o.object_id + and + man_id = :man_id + order by + org_id + </querytext> +</fullquery> + +<fullquery name="items_count"> + <querytext> + select count(ims_item_id) as total_items + from ims_cp_items + where org_id = :org_id and + ims_item_id in ( select live_revision from cr_items where content_type = 'ims_item_object') + </querytext> +</fullquery> + +<fullquery name="ad_table_contents_query"> + <querytext> + SELECT + o.object_id, + repeat(' ', (tree_level(cr.tree_sortkey) - :indent)* 3) as indent, + i.ims_item_id as item_id, + i.sort_order as sort_order, + i.item_title as item_title, + i.hasmetadata, + i.parent_item, + i.org_id, + i.sort_order, + case + when i.isshared = 'f' then ( + 'false' + ) + else 'true' + end as isshared, + case + when i.identifierref <> '' then ( + SELECT + res.href + FROM + ims_cp_items_to_resources i2r, + ims_cp_resources res + WHERE + i2r.res_id = res.res_id + AND + i2r.ims_item_id = i.ims_item_id + ) + else '' + end as identifierref, + case + when i.identifierref <> '' then ( + SELECT + res.type + FROM + ims_cp_items_to_resources i2r, + ims_cp_resources res + WHERE + i2r.res_id = res.res_id + AND + i2r.ims_item_id = i.ims_item_id + ) + else '' + end as type, + m.fs_package_id, + m.folder_id, + m.course_name + FROM + acs_objects o, ims_cp_items i, ims_cp_manifests m, cr_items cr + WHERE + o.object_type = 'ims_item_object' + AND + i.org_id = :org_id + AND + o.object_id = i.ims_item_id + AND + i.ims_item_id = ( + select + live_revision + from + cr_items + where + item_id = ( + select + item_id + from + cr_revisions + where + revision_id = i.ims_item_id + ) + ) + AND + m.man_id = :man_id + AND + cr.item_id = (select item_id from cr_revisions where revision_id = i.ims_item_id) + ORDER BY + i.sort_order, cr.tree_sortkey, o.object_id + </querytext> +</fullquery> + +<fullquery name="get_associations_num"> + <querytext> + select + count(community_id) + from + ims_cp_manifest_class + where + man_id = :man_id + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-file-live.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-file-live.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-file-live.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,25 @@ +ad_page_contract { + Change the live version to the recieved file_id + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:notnull + ims_item_id:notnull + file_id:notnull + org_id:notnull + {name "" } +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set file_item_id [lors_central::get_item_id -revision_id $file_id] + +db_dml update_live_revision { + update cr_items + set live_revision = :file_id + where item_id = :file_item_id +} + +ad_returnredirect "one-file?man_id=$man_id&ims_item_id=$ims_item_id&file_id=$file_id&name=$name&org_id=$org_id" \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-file.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-file.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-file.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,21 @@ +<master> +<property name="title">@page_title;noquote@</property> +<property name="context">@context;noquote@</property> +<property name="displayed_object_id">@file_id@</property> +<p> +<a class="button" href="@edit_url@">Edit Content</a> +</p> +<h3>#lors-central.this_file_has#:</h3> +<listtemplate name="file_list"></listtemplate> +<br> + +<h3>#lors-central.and_is_in#:</h3> +<listtemplate name="course_list"></listtemplate> +</div> +<hr><h1>#lors-central.preview#</h1> +<if @prev_type@ eq "image"> + <img src="download?version_id=@file_id@"> +</if> +<else> + <include src="download/preview" version_id=@file_id@> +</else> Index: openacs-4/packages/lors-central/www/one-file.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-file.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-file.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,99 @@ +ad_page_contract { + Displays all information about one file and all it's revisions + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + man_id:notnull + ims_item_id:notnull + {org_id "" } +} { + file_id:notnull + {res_id ""} + {name "" } + {prev_file_id ""} +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +#if { [empty_string_p $name] } { +# set name [db_string get_name { } -default "..."] +#} +#if { [empty_string_p $org_id] } { +# set name [db_string get_name { } -default "..."] +#} + + +set page_title "[_ lors-central.one_file] [_ lors-central.of_title]" + +set context [list [list [export_vars -base one-resource {res_id}] "One Resource" ] [_ lors-central.one_file]] +# Get the file item_id and live_revision +set file_item_id [lors_central::get_item_id -revision_id $file_id] + +# Get the type of the file for preview +set type [db_string get_prev_mime_type { }] +set prev_type [lindex [split $type "/"] 0] + +template::list::create \ + -name file_list \ + -multirow files \ + -key file_id \ + -has_checkboxes \ + -bulk_actions { } \ + -bulk_action_method post \ + -bulk_action_export_vars { } \ + -row_pretty_plural "[_ lors-central.item_files]" \ + -elements { + filename { + label "[_ lors-central.filename]" + display_template { + <if @files.fileid@ eq $file_id> + <b>» @files.filename@</b> + </if> + <else> + @files.filename@ + </else> + } + } + preview { + display_template { + <if @files.fileid@ eq $file_id> + + </if> + <else> + <a href="@files.prev_url@" title="[_ lors-central.click_for_prev]">[_ lors-central.preview]</a> + </else> + } + } + } + +db_multirow -extend { mime_type prev_url } files get_file_info { } { + set mime_type [db_string get_mime_type { }] + set prev_url [export_vars -base one-file {{file_id $fileid} res_id man_id}] +} + + +template::list::create \ + -name course_list \ + -multirow courses \ + -key course_id \ + -has_checkboxes \ + -bulk_actions { } \ + -bulk_action_method post \ + -bulk_action_export_vars { } \ + -row_pretty_plural "[_ lors-central.courses]" \ + -elements { + coursename { + label "[_ lors-central.course_name]" + display_template { + @courses.course_name@ + } + } + } + +db_multirow courses get_course_info { } { + +} + +set return_url [ad_return_url] +set edit_url [export_vars -base "file-content-edit" {file_id return_url res_id man_id}] +ad_return_template Index: openacs-4/packages/lors-central/www/one-file.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-file.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-file.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_name"> + <querytext> + select + item_title + from + ims_cp_items + where + ims_item_id= :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_org_id"> + <querytext> + select + org_id + from + ims_cp_items + where + ims_item_id= :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_file_info"> + <querytext> + select distinct file_id as fileid, filename + from ims_cp_files + where file_id in ( select revision_id + from cr_revisions + where item_id = :file_item_id ) + </querytext> + </fullquery> + + + <fullquery name="get_prev_mime_type"> + <querytext> + select + mime_type + from + cr_revisions + where + revision_id = :file_id + </querytext> + </fullquery> + + <fullquery name="get_mime_type"> + <querytext> + select + mime_type + from + cr_revisions + where + revision_id = :fileid + </querytext> + </fullquery> + + <fullquery name="get_course_info"> + <querytext> + select + distinct + m.man_id, + m.course_name + from + ims_cp_files f, + ims_cp_resources r, + ims_cp_manifests m + where + f.file_id = :file_id + and f.res_id=r.res_id + and r.man_id=m.man_id + </querytext> + </fullquery> + + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-learning-object.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-learning-object.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-learning-object.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,31 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> +<property name="displayed_object_id">@displayed_object_id@</property> + +<h1>@name@</h1> +<a class=button href="tracking/?man_id=@man_id@&item_id=@ims_item_id@" title="#lors-central.All_views_of#">#lors-central.All_views#</a> +<a class="button" href="md/pbs-md/?ims_md_id=@displayed_object_id@">Edit Metadata</a> +<a class="button" href="one-resource?res_id=@res_id@">All Resources</a> +<h3>Versions of this learning object:</h3> +<listtemplate name="item_versions"></listtemplate> + +<h3>#lors-central.This_learning_obj#</h3> + +<listtemplate name="courses"></listtemplate> + +<include src="/packages/lors-central/lib/item-files/" ims_item_id="@displayed_object_id@"> + +<!-- h3>Clipboard</h3 --> +<!-- include src="/packages/lors-central/lib/clipboard" --> +</div> + +<hr><h1>Preview of "Live Version"</h1> + +<if @prev_type@ eq "image"> + <img src="download?version_id=@file_revision@"> +</if> +<else> + <include src="download/preview" file_id=@file_revision@> +</else> + Index: openacs-4/packages/lors-central/www/one-learning-object.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-learning-object.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-learning-object.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,250 @@ +ad_page_contract { + Displays all the information about one learning object (ims_item_id) + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation-date 2005-03-17 +} { + man_id:integer + ims_item_id:integer + {name ""} + {orderby "class,asc"} +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set displayed_object_id $ims_item_id + +# Get the item_id that the ims_item_id has associated +set item_id [lors_central::get_item_id -revision_id $ims_item_id] +set man_item_id [lors_central::get_item_id -revision_id $man_id] +set course_name [lors_central::get_course_name -man_id $man_id] +set org_id [db_string get_org_id { } -default ""] + +set res_id [lors_central::get_ims_item_id_or_res_id -ims_item_id $ims_item_id] + +# Here we set the ns_variables to make the relative links and images +# display right on preview, we need to set the ims_item_id + +if {[nsv_exists delivery_vars [ad_conn session_id]]} { + nsv_unset delivery_vars [ad_conn session_id] +} +nsv_set delivery_vars [ad_conn session_id] [list] +nsv_lappend delivery_vars [ad_conn session_id] $ims_item_id + + +# Get the live revision for preview + +set last_version [db_string get_live_revision { }] + +set file_revision [lors_central::get_content_revision_id -ims_item_id $ims_item_id] + +if { [empty_string_p $name] } { + set name [db_string get_name { }] +} + +if { [string equal $file_revision 0] } { + # The items is probably an URL so we are going to get it + set item_file_revision [lors_central::get_item_url -ims_item_id $ims_item_id -man_id $man_id] + set file_revision [item::get_live_revision $item_file_revision] + set prev_type "" +} else { + set file_prev_id [lors_central::get_item_id -revision_id $file_revision] + set prev_type [db_string get_prev_mime_type { } -default ""] + set prev_type [lindex [split $prev_type "/"] 0] +} + + +#################################### Versions Template ################################################# +set num 0 +db_multirow -extend { ver_num date author mime_type num file_id } item_versions get_versions { } { + set ver_num [lors_central::get_version_num -revision_id $ims_item_id] + set date [lindex $last_modified 0] + append date " [lindex [split [lindex $last_modified 1] "."] 0]" + set author [lors_central::get_username -user_id $user_id] + set file_id [lors_central::get_res_file_id -res_id $res_id] + if { ![string equal $file_id ""] } { + set mime_type [db_string get_mime_type { } -default ""] + if { [string equal $ims_item_id $last_version] } { + set live_file_id $file_id + } + } else { + set mime_type "URL" + set live_file_id 0 + } + set num [expr $num + 1] + if {$displayed_object_id == $ims_item_id} { + set displayed_object_title $item_name + } +} + +template::list::create \ + -name item_versions \ + -multirow item_versions \ + -key ims_item_id \ + -bulk_action_method post \ + -has_checkboxes \ + -bulk_action_export_vars { + } \ + -row_pretty_plural "[_ lors-central.item_versions]" \ + -elements { + version_number { + label "[_ lors-central.version_number]" + display_template { + <if $displayed_object_id eq @item_versions.ims_item_id@> + <center><b>» @item_versions.ver_num@</b></center> + </if> + <else> + <center>@item_versions.ver_num@</center> + </else> + } + } + course_name { + label "[_ lors-central.item_name]" + display_template { + <a href="one-learning-object?ims_item_id=@item_versions.ims_item_id@&man_id=@item_versions.man_id@"> + <if $displayed_object_id eq @item_versions.ims_item_id@> + <b>@item_versions.item_name@</b> + </if> + <else> + @item_versions.item_name@ + </else> + </a> + } + } + author { + label "[_ lors-central.author]" + display_template { + <a href="/shared/community-member?user_id=@item_versions.user_id@">@item_versions.author@</a> + } + } + last_modified { + label "[_ lors-central.last_modified]" + display_template { + @item_versions.date@ + } + } + mime_type { + label "[_ lors-central.type]:" + display_template { + @item_versions.mime_type@ + } + } + make_live { + display_template { + [_ lors-central.make] + <a href="change-lo-version?ims_item_id=@item_versions.ims_item_id@&man_id=$man_id&item_id=$item_id&name=$name&live_hide_p=live">[_ lors-central.live]<a> + / + <a href="change-lo-version?ims_item_id=@item_versions.ims_item_id@&man_id=$man_id&item_id=$item_id&name=$name&live_hide_p=hide">[_ lors-central.hide]</a> + [_ lors-central.everywhere] + } + } + } + +################################### Associations Template ################################################# + +template::list::create \ + -name courses \ + -multirow cl_list \ + -key com_id \ + -has_checkboxes \ + -bulk_actions { #lors-central.update_versions# "change-one-lo-version" #lors-central.update_course_ver# } \ + -bulk_action_method post \ + -bulk_action_export_vars { man_id name ims_item_id } \ + -row_pretty_plural "[_ lors-central.dotlrn_classes]" \ + -elements { + class { + label "[_ lors-central.class_name]" + display_template { + @cl_list.pretty_name@ + } + } + subject { + label "[_ lors-central.subject_name]" + display_template { + @cl_list.class_name@ + } + } + term_name { + label "[_ lors-central.term_name]" + display_template { + @cl_list.term_name@ + } + } + current { + label "[_ lors-central.current]" + display_template { + <if @cl_list.hide_p@> + 0 + </if> + <else> + @cl_list.ver_num@ + </else> + [_ lors-central.of] @cl_list.ver_count@ + } + } + set_to { + label "[_ lors-central.set_to]" + display_template { + <input type=hidden name="objects_id" value=@cl_list.com_id@> + <input type=hidden name="objects_count" value=@cl_list.ver_count@> + <select name="objects_value"> + @cl_list.options;noquote@ + </select> + } + } + views { + label "[_ lors-central.views_in]" + display_template { + <center> + <a href="tracking/?man_id=@cl_list.manifest_id@&community_id=@cl_list.com_id@&item_id=$ims_item_id"> + [_ lors-central.views] + </a> + </center> + } + } + } -filters { + man_id {} + } -orderby { + class { + orderby_asc {pretty_name asc} + orderby_desc {pretty_name desc} + } + subject { + orderby_asc {class_name asc} + orderby_desc {class_name desc} + } + term_name { + orderby_asc {term_name asc} + orderby_desc {term_name desc} + } + } + +set orderby_clause [template::list::orderby_clause -orderby -name "courses"] + +db_multirow -extend { ver_num ver_count manifest_id options hide_p } cl_list get_dotlrn_classes { } { + set manifest_id [lors_central::get_man_id -community_id $com_id -item_id $man_item_id] + set ims_item [db_string get_ims_item_id { }] + set hide_p [db_string get_hide_p { }] + if {$hide_p} { + set ver_num 0 + } else { + set ver_num [lors_central::get_version_num -revision_id $ims_item] + } + set ver_count [lors_central::get_revision_count -revision_id $ims_item_id] + # Create the options for the select menu + set options "" + for { set i 0 } { $i < [expr $ver_count + 1] } { incr i } { + if { [string equal $i $ver_num] } { + append options "<option value=$i selected>$i</options>" + } else { + append options "<option value=$i>$i</options>" + } + } +} + +set title "${course_name}: ${item_title}" +set context [list [list "one-course?man_id=$man_id" [_ lors-central.one_course]] "[_ lors-central.One_learning]"] + +ad_return_template Index: openacs-4/packages/lors-central/www/one-learning-object.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-learning-object.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-learning-object.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,200 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_dotlrn_classes"> + <querytext> + select + dc.class_instance_id as com_id, + dc.department_name, + dc.term_name, + dc.class_name, + dc.pretty_name + from + dotlrn_class_instances_full dc + where + dc.class_instance_id in + ( + select community_id from ims_cp_items_map where man_id = :man_id + ) + and + dc.class_instance_id in + ( + select + icmc.community_id + from + ims_cp_manifest_class icmc + where + icmc.man_id in + ( + select + revision_id + from + cr_revisions + where + item_id = :man_item_id + ) + ) + $orderby_clause + </querytext> + </fullquery> + + + <fullquery name="get_versions"> + <querytext> + select + r.item_title, + r.title as item_name, + r.revision_id as ims_item_id, + r.publish_date as last_modified, + ao.creation_user as user_id, + ir.res_id, + io.man_id + from + ims_cp_itemsx r, acs_objects ao, + ims_cp_items_to_resources ir, + ims_cp_organizations io + + where + r.org_id=io.org_id + and r.item_id = :item_id + and r.revision_id = ao.object_id + and ir.ims_item_id = r.revision_id + order by + revision_id asc + </querytext> + </fullquery> + + <fullquery name="get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_file_id"> + <querytext> + select + file_id + from + ims_cp_files + where + res_id = :res_id and + pathtofile = :href + </querytext> + </fullquery> + + <fullquery name="get_res_file_id"> + <querytext> + select + f.file_id + frome + ims_cp_files f, ims_cp_resources r + where + r.res_id = :res_id and + f.res_id = r.res_id + f.pathtofile = r.href + </querytext> + </fullquery> + + <fullquery name="get_mime_type"> + <querytext> + select + mime_type + from + cr_revisions + where + revision_id = :file_id + </querytext> + </fullquery> + + <fullquery name="get_hide_p"> + <querytext> + select + hide_p + from + ims_cp_items_map + where + ims_item_id = :ims_item + and community_id = :com_id + </querytext> + </fullquery> + + <fullquery name="get_org_id"> + <querytext> + select + org_id + from + ims_cp_items + where + ims_item_id=:ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_live_revision"> + <querytext> + select + live_revision + from + cr_items + where + item_id= :item_id + </querytext> + </fullquery> + + <fullquery name="get_name"> + <querytext> + select + item_title + from + ims_cp_items + where + ims_item_id= :last_version + </querytext> + </fullquery> + + <fullquery name="get_isshared"> + <querytext> + select + isshared + from + ims_cp_items + where + ims_item_id= :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_prev_mime_type"> + <querytext> + select + mime_type + from + cr_revisions + where + revision_id = (select live_revision from cr_items where item_id = :file_prev_id) + </querytext> + </fullquery> + + <fullquery name="get_ims_item_id"> + <querytext> + select + ims_item_id + from + ims_cp_items_map + where + man_id =:man_id and + community_id = :com_id and + ims_item_id in ( select revision_id + from cr_revisions + where item_id = ( select item_id + from cr_revisions + where revision_id = :ims_item_id + ) + ) + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-lo-files.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-lo-files.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-lo-files.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,9 @@ +<master> +<property name="title">@page_title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="/packages/lors-central/lib/item-files/" ims_item_id="@ims_item_id@" man_id="@man_id@" org_id="@org_id@"> + +<h3>Clipboard</h3> +<include src="/packages/lors-central/lib/clipboard" type=""> + Index: openacs-4/packages/lors-central/www/one-lo-files.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-lo-files.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-lo-files.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,26 @@ +ad_page_contract { + Displays al files associated to this version of one LO + @author Miguel Marin (miguelmmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:notnull + ims_item_id:notnull + {org_id ""} + {name ""} +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +if { [empty_string_p $name] } { + set name [db_string get_name { } -default "..."] +} +if { [empty_string_p $org_id] } { + set name [db_string get_name { } -default "..."] +} + + +set page_title "[_ lors-central.lo_files]" +set context "[list [list "one-learning-object?ims_item_id=$ims_item_id&man_id=$man_id&name=$name" \ + [_ lors-central.One_learning]] [_ lors-central.lo_files]]" + Index: openacs-4/packages/lors-central/www/one-lo-files.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-lo-files.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-lo-files.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_name"> + <querytext> + select + item_title + from + ims_cp_items + where + ims_item_id= :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_org_id"> + <querytext> + select + org_id + from + ims_cp_items + where + ims_item_id= :ims_item_id + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-object-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-object-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-object-edit.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,9 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<formtemplate id=upload_file></formtemplate> +<if @edit_p@ eq t> +<include src=file-content-edit> +<include src="/packages/lors-central/lib/clipboard"> +</if> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-object-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-object-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-object-edit.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,188 @@ +ad_page_contract { + Edits one learning object (ims_item_id) + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation_date 2005-03-22 +} { + man_id:integer,notnull + ims_item_id:integer,notnull + {name ""} + file_upload:trim,optional + file_upload.tmpfile:optional,tmpfile + file_id:integer + {mime_type ""} + {edit_p ""} +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set parent_item [db_string get_parent_item "select parent_item from ims_cp_items where ims_item_id = :ims_item_id"] + +set user_id [ad_conn user_id] +set title "[_ lors-central.edit_object]" +set context "[list [list "one-learning-object?ims_item_id=$ims_item_id&man_id=$man_id&name=$name" \ + [_ lors-central.One_learning]] [_ lors-central.edit_object]]" + +if { ![string equal $file_id 0] } { + set version_id $file_id + set mime_type [db_string get_mime_type { } -default t] + if { [string eq $mime_type "text/html"] || [string eq $mime_type "text/plain"] } { + set edit_p "t" + } else { + set edit_p "f" + } + +} else { + set mime_type "URL" + set edit_p "f" +} + +ad_form -name upload_file -html {enctype multipart/form-data} -form { + {file_upload:text(file) + {label "[_ lors-central.choose_the_file]"} + {help_text "[_ lors-central.help_text]"} + } + {man_id:text(hidden) + {value $man_id} + } + {ims_item_id:text(hidden) + {value $ims_item_id} + } + {name:text(hidden) + {value $name} + } + {file_id:text(hidden) + {value $file_id} + } + {parent_item:text(hidden) + {value $parent_item} + } +} -on_submit { + db_transaction { + # We get the pathtofile from the editing file and the resources + # table since this is the default file the ims_item has + set res_id [db_string get_res_id { }] + set file_href [db_string get_pathtofile { } ] + set file_name [db_string get_filename { } ] + set res_href [db_string get_href { } ] + + set tmp_filename [ns_queryget file_upload.tmpfile] + set mime_type [cr_filename_to_mime_type -create $file_upload] + set tmp_size [file size $tmp_filename] + + # We are going to create a new cr_revision (file) for the new file + # We get the revision_id that holds the content on the CR, this is the + # live_revision of one file_id + + set cr_revision [lors_central::get_content_revision_id -ims_item_id $ims_item_id] + set cr_item_id [lors_central::get_item_id -revision_id $cr_revision] + if { [string equal $cr_item_id 0] } { + # It's probably an URL so we are going to treat it as one + set cr_item_id [lors_central::get_item_url -ims_item_id $ims_item_id -man_id $man_id] + } + # We get the folder_id to know where to store the new cr_item + set folder_id [lors_central::get_parent_id -item_id $cr_item_id] + + # We are going to create a new item for the ims_item_id + # First we are going to check if the name already exists to generate a new one + + set res_root_folder_id [lors_central::get_root_resources_folder_id] + set res_folder_id [lors_central::folder_id_from_man_parent -man_id $man_id -parent_id $res_root_folder_id] + set file_upload [lors_central::check_item_name -parent_id $folder_id -name $file_upload] + set file_upload [lors_central::check_item_name -parent_id $res_folder_id -name $file_upload] + + #set new_file_item_id [content::item::new -name $file_upload -creation_user $user_id -parent_id $folder_id] + set file_item_id [lors_central::get_item_id -revision_id $file_id] + set new_file_id [content::revision::new -item_id $file_item_id -title $file_name -creation_user $user_id \ + -mime_type $mime_type -is_live "t"] + + # Now we store the content in the CR + set cr_file [cr_create_content_file $file_item_id $new_file_id $tmp_filename] + + # get the size + set file_size [cr_file_size $cr_file] + + # update the file path in the CR and the size on cr_revisions + db_dml update_revision { + update + cr_revisions + set + content = :cr_file, + content_length = :file_size + where + revision_id = :new_file_id + } + # Now that we have the new item store in the CR, we have to make + # some insert in some tables to adjust to the new cr_item. + # First we have to reflect the new file in the resources table, so we have to make + # a new cr_item and revision for the resource and insert it on the ims_cp_resources table + + + set new_res_item_id [content::item::new -name $file_upload -creation_user $user_id \ + -parent_id $res_folder_id -content_type "ims_resource_object"] + + set new_res_rev_id [content::revision::new -item_id $new_res_item_id -title $file_upload \ + -creation_user $user_id -is_live "t"] + + db_dml update_new_res { + update + ims_cp_resources + set + man_id = :man_id, + identifier = :file_upload, + type = 'webcontent', + href = :res_href, + hasmetadata = 'f' + where + res_id = :new_res_rev_id + } + # We need to create a new row in the ims_cp_files to associate the new resource to the new file + db_dml insert_new_file { + insert into ims_cp_files (file_id, res_id, pathtofile, filename, hasmetadata) + values (:new_file_id, :new_res_rev_id, :file_href, :file_name, 'f') + } + # Now are going to create a new version of the item (ims_cp_item) + set item_id [lors_central::get_item_id -revision_id $ims_item_id] + set item_title [lors_central::get_item_title -item_id $item_id] + set item_count [expr [lors_central::get_revision_count -item_id $item_id] + 1 ] + append item_title "_$item_count" + set new_ims_rev_id [content::revision::new -item_id $item_id -title $item_title -creation_user $user_id \ + -is_live "t"] + + # We need to fill the extra information + set item_name [lors_central::get_item_name -ims_item_id $ims_item_id] + set org_id [db_string get_org_id "select org_id from ims_cp_items where ims_item_id = :ims_item_id"] + set item_title [db_string get_item_title_id "select item_title from ims_cp_items where ims_item_id = :ims_item_id"] + db_dml update_ims_cp_items { + update ims_cp_items + set + org_id = :org_id, + identifier = :item_name, + identifierref = :file_upload, + item_title = :item_title, + parent_item = :parent_item + where ims_item_id = :new_ims_rev_id + + } + # Now this new revision_id is the one that holds the content of the new resource + # We have to make a row in ims_cp_items_to_resources table + db_dml insert_new_item_to_res { + insert into ims_cp_items_to_resources (ims_item_id, res_id ) + values (:new_ims_rev_id, :new_res_rev_id) + } + # get old res_id + set old_res_id [db_string get_old_res_id "select f.res_id from ims_cp_files f, ims_cp_items_to_resources r where f.file_id=:file_id and f.res_id=r.res_id and r.ims_item_id=:ims_item_id" -default ""] + ns_log notice "\nDAVEB: edit resource ims_item_id='${ims_item_id}' file_id='${file_id}' old_res_id='${old_res_id}'\n" + if {![string equal "" $old_res_id]} { + db_dml carry_forward_files " + insert into ims_cp_files (select file_id, $new_res_rev_id,pathtofile,filename,hasmetadata from ims_cp_files where res_id=:old_res_id and file_id <> :file_id)" + } + # We are going to set the sort_order field + lors_central::set_sort_order -ims_item_id $new_ims_rev_id + } + +} -after_submit { + ad_returnredirect "one-learning-object?ims_item_id=$ims_item_id&man_id=$man_id&name=$name" +} \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-object-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-object-edit.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-object-edit.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<queryset> + + <fullquery name="get_mime_type"> + <querytext> + select + mime_type + from + cr_revisions + where + revision_id = :version_id + </querytext> + </fullquery> + + <fullquery name="get_res_id"> + <querytext> + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id = :ims_item_id + </querytext> + </fullquery> + + <fullquery name="get_pathtofile"> + <querytext> + select + pathtofile as file_href + from + ims_cp_files + where + file_id = :file_id + and res_id = :res_id + </querytext> + </fullquery> + + <fullquery name="get_filename"> + <querytext> + select + filename as file_name + from + ims_cp_files + where + file_id = :file_id + and res_id = :res_id + </querytext> + </fullquery> + + <fullquery name="get_href"> + <querytext> + select + href as res_href + from + ims_cp_resources + where + res_id = :res_id + </querytext> + </fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-resource.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-resource.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-resource.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,11 @@ +<master> +<property name="title">@page_title;noquote@</property> +<property name="context">@context;noquote@</property> +<property name="displayed_object_id">@res_id@</property> +<property name="header_stuff"><style>.list-selected {font-weight:bold;font-size:120%}</style></property> +<p><a class="button" href="md/pbs-md/?ims_md_id=@displayed_object_id@">Edit Metadata</a></p> +<h3>Versions of this learning object</h3> +<listtemplate name="revisions"></listtemplate> +<include src="/packages/lors-central/lib/item-files/" res_id="@res_id@"> +<h3>Courses that use this learning object</h3> +<listtemplate name="courses"></listtemplate> \ No newline at end of file Index: openacs-4/packages/lors-central/www/one-resource.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-resource.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-resource.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,54 @@ +ad_page_contract { + Show one ims_cp_resource object + (learning object) +} { + res_id:integer,notnull +} + +set user_id [ad_conn user_id] + +# TODO should we allow those with READ permission to look? +permission::require_permission \ + -object_id $res_id \ + -party_id $user_id \ + -privilege "admin" + +set ims_item_id [lors_central::get_ims_item_id_or_res_id -res_id $res_id] +set man_id [db_string get_man_id { }] + +set displayed_object_id $res_id +set page_title "All Resouces" +set context [list [list "one-learning-object?man_id=$man_id&ims_item_id=$ims_item_id" \ + [_ lors-central.One_learning]] "All Resources"] + +set res_item_id [lors_central::get_item_id -revision_id $res_id] + +db_multirow -extend {type} revisions get_res { } { + set last_modified [lc_time_fmt $last_modified "%x %X"] + + if {[string equal "" $file_id]} { + set type "URL" + } +} + +template::list::create \ + -name revisions \ + -multirow revisions \ + -elements { + title {label "Revision Title" display_template {<span <if @revisions.selected@ eq 1>class="list-selected">» </if><else>></else>@revisions.title@</span>} link_url_eval {[export_vars -base one-resource {res_id}]}} + last_modified {label "Modified On" display_template {<span <if @revisions.selected@ eq 1>class="list-selected"</if>>@revisions.last_modified@</span>}} + type {label "Type"} + } + +# Find lors-central courses that use this resource + +db_multirow courses courses { } + +template::list::create \ + -name courses \ + -multirow courses \ + -elements { + course_name {label "Course Name" link_url_eval {[export_vars -base one-learning-object {ims_item_id man_id org_id}]}} + } + +ad_return_template Index: openacs-4/packages/lors-central/www/one-resource.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/one-resource.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/one-resource.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,73 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="courses"> + <querytext> + select + io.org_id, + ii.ims_item_id, + im.man_id, + im.course_name + from + ims_cp_manifests im, + ims_cp_items ii , + ims_cp_items_to_resources ir, + ims_cp_organizations io, + cr_revisions cr, + cr_items ci + where + im.man_id = io.man_id and + ii.org_id = io.org_id and + ii.ims_item_id = ir.ims_item_id and + ir.res_id = cr.revision_id and + cr.item_id = ( + select + item_id + from + cr_revisions + where + revision_id = :res_id + ) and + ci.live_revision = ii.ims_item_id + </querytext> +</fullquery> + + +<fullquery name="get_man_id"> + <querytext> + select + man_id + from + ims_cp_resources + where + res_id = :res_id + </querytext> +</fullquery> + + +<fullquery name="get_res"> + <querytext> + select + r.*, + f.file_id, + case + when r.revision_id =:res_id then 1 + else 0 + end as selected + from + ims_cp_resourcesx r left join ims_cp_files f on f.res_id = r.res_id and + f.pathtofile = r.href + where + item_id = ( + select + item_id + from + cr_revisions + where + revision_id = :res_id + ) + order by ( case when revision_id = :res_id then 1 else 0 end), creation_date desc + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/reorder-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/reorder-items.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/reorder-items.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,145 @@ +ad_page_contract { + Reorders all the items according to sort_order +} { + item_id:integer,notnull + dir:notnull + org_id:notnull + sort_order:notnull +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set ims_item_id $item_id +set item_sort [db_string get_item_sort { }] +set man_id [db_string get_man_id { }] +set parent_item [db_string get_parent_item { }] +set global_list [db_list_of_lists get_global_group { }] +set max_sort_order [db_string get_max_sort { }] + +if { [string equal $dir "up"] } { + set up_items [list [list $ims_item_id $item_sort]] + + # First we need to get all the items that are going up + # (all the revisions and all the childrens if any) + # We get all items with the same parent_item as ims_item_id has + set same_parent [db_list_of_lists get_items_parent { }] + + # We get all the items for the parent_item + + # To get all the childrens we will get the sort_order of the next + # ims_item_id of with the same parent and get all the ims_item_id's + # between the ims_item_id to reorder and the next ims_item_id + set i 0 + foreach item $same_parent { + if { [string equal [lindex $item 0] $ims_item_id] } { + set next_sort_pos [expr $i + 1] + set back_sort_pos [expr $i - 1] + } + incr i + } + set next_sort [lindex [lindex $same_parent $next_sort_pos] 1] + if { [empty_string_p $next_sort] } { + + # This item is the last one so we need to get the sort order of the next parent + set next_item [lindex $global_list [expr [lsearch $global_list $parent_item] + 1]] + if { [empty_string_p $next_item] } { + # This is the last one of the course + set next_sort [expr $max_sort_order + 1] + } else { + set next_sort [db_string get_next_sort { }] + } + } + set up_childs [db_list_of_lists get_up_childs { }] + foreach item $up_childs { + lappend up_items $item + } + set tot_items_up [llength $up_items] + + # Finish with up, now we are going to so the same for the items that + # are going down + + set back_sort [lindex [lindex $same_parent $back_sort_pos] 1] + set down_items [list [lindex $same_parent $back_sort_pos]] + set down_childs [db_list_of_lists get_down_childs { }] + foreach item $down_childs { + lappend down_items $item + } + set tot_items_down [llength $down_items] + + # Now that we now how many items will go up and how many will go down + # we make the updates on the tables + + foreach item $up_items { + set ims_item_id [lindex $item 0] + set sort [expr [lindex $item 1] - $tot_items_down] + lors_central::set_sort_order -ims_item_id $ims_item_id -sort_order $sort + } + foreach item $down_items { + set ims_item_id [lindex $item 0] + set sort [expr [lindex $item 1] + $tot_items_up] + lors_central::set_sort_order -ims_item_id $ims_item_id -sort_order $sort + } +} else { + # We are going to do the same as above but with some variants + set down_items [list [list $ims_item_id $item_sort]] + + # We get all items with the same parent_item as ims_item_id has + set same_parent [db_list_of_lists get_items_parent { }] + + # To get all the childrens we will get the sort_order of the next + # ims_item_id of with the same parent and get all the ims_item_id's + # between the ims_item_id to reorder and the next ims_item_id + set i 0 + foreach item $same_parent { + if { [string equal [lindex $item 0] $ims_item_id] } { + set next_sort_pos [expr $i + 1] + set back_sort_pos [expr $i + 2] + } + incr i + } + set next_sort [lindex [lindex $same_parent $next_sort_pos] 1] + set down_childs [db_list_of_lists get_down_childs_2 { }] + foreach item $down_childs { + lappend down_items $item + } + set tot_items_down [llength $down_items] + + + # Finish with down, now we are going to so the same for the items that + # are going up + + set back_sort [lindex [lindex $same_parent $back_sort_pos] 1] + if { [empty_string_p $back_sort] } { + # This is the last one of same parent + set next_item [lindex $global_list [expr [lsearch $global_list $parent_item] + 1]] + if { [empty_string_p $next_item] } { + # This is the last one of the course + set back_sort [expr $max_sort_order + 1] + } else { + set back_sort [db_string get_next_sort { }] + } + } + set up_items [list [lindex $same_parent $next_sort_pos]] + set up_childs [db_list_of_lists get_up_childs_2 { }] + foreach item $up_childs { + lappend up_items $item + } + set tot_items_up [llength $up_items] + + # Now that we now how many items will go up and how many will go down + # we make the updates on the tables + + foreach item $up_items { + set ims_item_id [lindex $item 0] + set sort [expr [lindex $item 1] - $tot_items_down] + lors_central::set_sort_order -ims_item_id $ims_item_id -sort_order $sort + } + foreach item $down_items { + set ims_item_id [lindex $item 0] + set sort [expr [lindex $item 1] + $tot_items_up] + lors_central::set_sort_order -ims_item_id $ims_item_id -sort_order $sort + } +} + +ad_returnredirect "one-course?man_id=$man_id" \ No newline at end of file Index: openacs-4/packages/lors-central/www/reorder-items.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/reorder-items.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/reorder-items.xql 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,145 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="get_man_id"> + <querytext> + select + man_id + from + ims_cp_organizations + where + org_id = :org_id + </querytext> +</fullquery> + +<fullquery name="get_item_sort"> + <querytext> + select + sort_order + from + ims_cp_items + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + + +<fullquery name="get_items_parent"> + <querytext> + select + ims_item_id, sort_order + from + ims_cp_items + where + parent_item = :parent_item + order by sort_order asc + </querytext> +</fullquery> + +<fullquery name="get_parent_item"> + <querytext> + select + parent_item + from + ims_cp_items + where + ims_item_id = :ims_item_id + </querytext> +</fullquery> + +<fullquery name="get_global_group"> + <querytext> + select + ims_item_id + from + ims_cp_items + where + parent_item = ( select + parent_item + from + ims_cp_items + where + ims_item_id = :parent_item ) + order by sort_order asc + </querytext> +</fullquery> + +<fullquery name="get_up_childs"> + <querytext> + select + ims_item_id, sort_order + from + ims_cp_items + where + sort_order > :item_sort and sort_order < :next_sort + and org_id = :org_id + order by sort_order + </querytext> +</fullquery> + +<fullquery name="get_next_sort"> + <querytext> + select + sort_order + from + ims_cp_items + where + ims_item_id = :next_item + and org_id = :org_id + order by sort_order + </querytext> +</fullquery> + +<fullquery name="get_max_sort"> + <querytext> + select + max(sort_order) + from + ims_cp_items + where + org_id = :org_id + </querytext> +</fullquery> + + +<fullquery name="get_down_childs"> + <querytext> + select + ims_item_id, sort_order + from + ims_cp_items + where + sort_order < :item_sort and sort_order > :back_sort + and org_id = :org_id + order by sort_order + </querytext> +</fullquery> + +<fullquery name="get_down_childs_2"> + <querytext> + select + ims_item_id, sort_order + from + ims_cp_items + where + sort_order > :item_sort and sort_order < :next_sort + and org_id = :org_id + order by sort_order + </querytext> +</fullquery> + +<fullquery name="get_up_childs_2"> + <querytext> + select + ims_item_id, sort_order + from + ims_cp_items + where + sort_order > :next_sort and sort_order < :back_sort + and org_id = :org_id + order by sort_order + </querytext> +</fullquery> + +</queryset> + Index: openacs-4/packages/lors-central/www/search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/search.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/search.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,10 @@ +<master> + <property name="title">@page_title@</property> + <property name="header_stuff">@header_stuff@</property> + <property name="context">@context@</property> + <property name="focus">@focus@</property> + +<formtemplate id="search" style="inline"></formtemplate> + +<br /> + <include src="/packages/search/lib/search-results" q="@q@" extra_q="@extra_q@"> Index: openacs-4/packages/lors-central/www/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/search.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/search.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,102 @@ +# + +ad_page_contract { + + Search Learning Objects + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-03-26 + @arch-tag: 79e55eed-608a-449e-b684-5c5d4018fe4f + @cvs-id $Id: search.tcl,v 1.1 2005/05/17 16:21:19 miguelm Exp $ +} { + {q ""} + {extra_q ""} + {offset 0} + {num 0} +} -properties { +} -validate { +} -errors { +} + +set page_title "Search Learning Objects" +set context [list $page_title] +set header_stuff "" +set focus "" + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +permission::require_permission \ + -object_id $package_id \ + -party_id $user_id \ + -privilege "read" + +set grade_range_options [db_list_of_lists glo "select distinct context_v as label, context_v from ims_md_educational_context"] +set grade_range_options [linsert $grade_range_options 0 {"--" ""}] +set subject_area_options [db_list_of_lists so "select distinct entry_s as label, entry_s from ims_md_general_cata where catalog = 'PBS-SubjectArea'"] +set subject_area_options [linsert $subject_area_options 0 {"--" ""}] +ad_form -name search -method GET -form { + {q:text(text) + {label "Enter Search Terms"} + {html {id search-textbox}}} + {search:text(submit) {label "Search"}} + {grade_range:text(select),optional + {label "Grade Range"} + {options $grade_range_options}} + {subject_area:text(select),optional + {label "Subject Area"} + {options $subject_area_options}} + + +} -on_submit { + +append extra_q " object_type:ims_resource_object" +if {[exists_and_not_null grade_range]} { + append extra_q " grade_range:${grade_range} " +} +if {[exists_and_not_null subject_area]} { + append extra_q " subject_area:${subject_area} " +} +} + +# if {[info exists q] && ![string equal "" $q]} { +# set search 1 +# } else { +# set search 0 +# } + +# set filters {search {values {0 1} where_clause_eval { +# if {$search} { +# array set result [acs_sc_call FtsEngineDriver search [list [string tolower $q] 0 10 $user_id "" ""] "tsearch2-driver"] +# if {![info exists result(ids)]} { +# # search is not working, ignore search terms +# set where " 1=1 " +# } elseif {[llength $result(ids)] >0} { +# set result_ids $result(ids) +# set where " object_id in ([template::util::tcl_to_sql_list $result_ids])" +# } else { +# subst {1=0} +# } +# } else { +# subst {1=0} +# } +# } } } + +# # search results (with checkboxes for clipboard) +# template::list::create \ +# -name results \ +# -multirow results \ +# -elements { +# title { label "title" link_url_col url } +# } \ +# -filters ${filters} + +# # TODO use search to generate multirow, otherwise we have issues with +# # ordering if we try to put the ids into a IN clause + +# db_multirow -extend {url} results get_results "select object_id, coalesce ('Untitled',title) as title from acs_objects where [template::list::filter_where_clauses -name results]" { +# set url "/o/${object_id}" +# } + +ad_return_template + Index: openacs-4/packages/lors-central/www/shared.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/shared.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/shared.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,29 @@ +ad_page_contract { + Changes one ims_items isshared field + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:notnull + ims_item_id:notnull + {name ""} + shared:notnull + org_id:notnull +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +if { $shared } { + set isshared f +} else { + set isshared t +} + +db_dml update_isshared { + update ims_cp_items + set isshared = :isshared + where ims_item_id = :ims_item_id + and org_id = :org_id +} + +ad_returnredirect "one-learning-object?man_id=$man_id&name=$name&ims_item_id=$ims_item_id" \ No newline at end of file Index: openacs-4/packages/lors-central/www/tracker.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/tracker.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/tracker.adp 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,7 @@ +<master> + <property name="title">@title@</property> + <property name="context">@context@</property> + + <formtemplate id="tracker"></formtemplate> + + Index: openacs-4/packages/lors-central/www/tracker.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/tracker.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/tracker.tcl 17 May 2005 16:21:19 -0000 1.1 @@ -0,0 +1,80 @@ +# packages/lorsm/www/tracker.tcl + +ad_page_contract { + + set a course for a class to be trackable + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2004-05-25 + @arch-tag 07ceb832-2053-4579-bec2-76708522707a + @cvs-id $Id: tracker.tcl,v 1.1 2005/05/17 16:21:19 miguelm Exp $ +} { + man_id:integer,notnull + community_id:integer,notnull +} -properties { +} -validate { +} -errors { +} + +# Checking swa privilege over lors-central +lors_central::is_swa + +set lorsm_instance_id [db_string get_lorsm_instance_id { + select lorsm_instance_id from ims_cp_manifest_class where man_id = :man_id and community_id = :community_id +} -default 0] + +set package_id $lorsm_instance_id + +if { [string equal $package_id "0"] } { + ad_return_complaint 1 "[_ lors-central.you_have_to]" + ad_script_abort +} + +set title "[_ lorsm.lt_Set_Course_Track_Opti]" +set context [list [list "one-course-associations?man_id=$man_id" \ + "[_ lors-central.one_course_assoc]"] "[_ lorsm.Set_Course_Options]"] + +ad_form -name tracker \ + -export {package_id} \ + -form { + {man_id:key} + {project:text(inform) + {label "[_ lorsm.Course_Name]"} + {value {[lorsm::get_course_name -manifest_id $man_id]}} + } + {istrackable:text(inform) + {label "[_ lorsm.Current_Status]"} + } + {lorsm_instance_id:text(hidden) + {value $lorsm_instance_id} + } + {community_id:text(hidden) + {value $community_id} + } + {enable:text(radio) + {label Status?} + {options {{"[_ lorsm.Trackable_1]" t} {"[_ lorsm.No_Thanks]" f}}} + } + } -select_query { + select + case when istrackable = 't' then 'Yes' + else 'No' + end as istrackable + from ims_cp_manifest_class + where man_id = :man_id and + lorsm_instance_id = :package_id + } -edit_data { + db_dml do_update " + update ims_cp_manifest_class + set istrackable = :enable + where man_id = :man_id and + lorsm_instance_id = :package_id" + } -after_submit { + ad_returnredirect "one-course-associations?man_id=$man_id" + ad_script_abort + } + + + + + Index: openacs-4/packages/lors-central/www/download/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/download/index.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/download/index.vuh 17 May 2005 16:21:20 -0000 1.1 @@ -0,0 +1,27 @@ + ad_page_contract { + + Virtual URL handler for file downloads + + @author Kevin Scaldeferri (kevin@arsdigita.com) + @author Don Baccus (simplified it by using cr utility) + @creation-date 18 December 2000 + @cvs-id $Id: index.vuh,v 1.1 2005/05/17 16:21:20 miguelm Exp $ +} { + file_id:integer,optional + version_id:integer,optional +} + +if {![exists_and_not_null version_id]} { + set version_id [item::get_live_revision $file_id] +} + +set user_id [ad_conn user_id] + + +#ad_require_permission $version_id "read" + +cr_write_content -revision_id $version_id + + + + Index: openacs-4/packages/lors-central/www/download/preview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/download/preview.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/download/preview.adp 17 May 2005 16:21:20 -0000 1.1 @@ -0,0 +1 @@ +@preview;noquote@ \ No newline at end of file Index: openacs-4/packages/lors-central/www/download/preview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/download/preview.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/download/preview.tcl 17 May 2005 16:21:20 -0000 1.1 @@ -0,0 +1,21 @@ +ad_page_contract { + + URL handler for file preview + +} { + file_id:integer,optional + version_id:integer,optional +} + +# DAVEB file_id is version_id now +set version_id $file_id +#if {![exists_and_not_null version_id]} { +# set version_id [item::get_live_revision $file_id] +#} + +set preview [cr_write_content -string -revision_id $version_id] + + + + + Index: openacs-4/packages/lors-central/www/export/create-zip.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/export/create-zip.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/export/create-zip.tcl 17 May 2005 16:21:20 -0000 1.1 @@ -0,0 +1,254 @@ +ad_page_contract { + Export one course in IMS type + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} { + man_id:notnull + folder_id:notnull +} + +set content_folder_id $folder_id +set user_id [ad_conn user_id] +set course_man_id $man_id +# - - - - - - - - - - - - - - - - - - - +# We open a new file to write to it +# - - - - - - - - - - - - - - - - - - - + +set fid [open "/tmp/gimsmanifest.xml" w] + +set line "<manifest xmlns:bb=\"http://www.blackboard.com/content-packaging/\" xmlns:dotLRN=\"http://dotlrn.org/content-packaging\" identifier=\"" + +# We get the manifest information +db_1row get_man_info { } +append line "$identifier\">" +puts $fid $line + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Now we are going to check if it has a metadata to insert that on the xml also +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +if { $hasmetadata } { + puts $fid "<metadata>" + puts $fid "<!-- Generated by LORS-CENTRAL -->" + db_1row get_metadata_info { } + puts $fid " <schema>$schema</schema>" + puts $fid " <schemaversion>$schemaversion</schemaversion>" + puts $fid " <lom>" + puts $fid " <general>" + puts $fid " <title>" + puts $fid " <langstring xml:lang=\"$title_l\">$title_s</langstring>" + puts $fid " </title>" + puts $fid " <description>" + puts $fid " <langstring xml:lang=\"$descrip_l\">$descrip_s</langstring>" + puts $fid " </description>" + puts $fid " </general>" + puts $fid " </lom>" + puts $fid "</metadata>" +} + +# - - - - - - - - - - - - - - - - - - - - - +# We are goint to get all organizations +# - - - - - - - - - - - - - - - - - - - - - + +puts $fid "<organizations default=\"$orgs_default\">" +db_foreach get_organizations { } { + puts $fid " <organization identifier=\"$identifier\">" + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # We need to get all items and arrange them at the proper order to get + # parent son relation reflected on test.xml + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + set i 0 + set all_items [lors_central::export::get_items_xml -org_id $org_id] + foreach item $all_items { + set ims_item_id [lindex $item 0] + set level [lindex $item 1] + set indent "" + for {set j 0 } { $j <= $level } {incr j} { + append indent " " + } + db_1row get_item_info { } + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # We add the res_id to the identifierref to avoid names conflicts since resources added + # from other courses could have the same name. + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + puts $fid "$indent<item identifier=\"$identifier\" identifierref=\"$identifierref$item_res_id\">" + puts $fid "$indent<title>$item_title</title>" + set next_level [lindex [lindex $all_items [expr $i + 1]] 1] + if { [empty_string_p $next_level] } { + set next_level 1 + } + if { [string equal $next_level $level] } { + puts $fid "$indent</item>" + } + if { $next_level < $level } { + puts $fid "$indent</item>" + for { set j 0 } { $j < [expr $level - $next_level] } { incr j } { + puts $fid "$indent</item>" + } + } + incr i + } + puts $fid "</organization>" + +} +puts $fid "</organizations>" + + +# - - - - - - - - - - - - - - - - - - +# Here we get all the resources +# - - - - - - - - - - - - - - - - - - +set orgs_list "(" +db_foreach get_organizations { } { + append orgs_list "$org_id," + puts $fid "<resources>" + db_foreach get_resources { } { + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # We add the res_id to the identifier to avoid names conflicts since resources added + # from other courses could have the same name. + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + set line "<resource identifier=\"$identifier$res_id\" xml:base=\"$identifier\" type=\"$type\"" + if { ![empty_string_p $href]} { + append line " href=\"$href\">" + puts $fid $line + db_foreach get_files { } { + puts $fid "<file href=\"$pathtofile\"></file>" + } + } else { + append line ">" + puts $fid $line + } + puts $fid "</resource>" + } + puts $fid "</resources>" +} +append orgs_list "0)" + +# - - - - - - - - - - - - +# Now we close the file +# - - - - - - - - - - - - + +puts $fid "</manifest>" +close $fid + + +# - - - - - - - - - - - +# Creating zip file +# - - - - - - - - - - - + + +# publish the object to the file system +set in_path [ns_tmpnam] +exec mkdir $in_path + +set file [lors_central::export::publish_object_to_file_system -object_id $content_folder_id -path $in_path -user_id $user_id] +set file_name [file tail $file] + +set download_name "${file_name}.zip" + +# - - - - - - - - - - - - - - - - - - - - - - - - +# We get rid of spaces since they are annoying +# - - - - - - - - - - - - - - - - - - - - - - - - +regsub -all { } $download_name {_} download_name + +# - - - - - - - - - - - - - - - - - - - - +# Create a temp dir to put the archive in +# - - - - - - - - - - - - - - - - - - - - +set out_path [ns_tmpnam] +file mkdir $out_path +set out_file [file join ${out_path} ${download_name}] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# We need to copy all files related to all resources that are not present on this folder +# This are the one that are on a different course +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +set extra_resources [db_list_of_lists get_other_resources { }] + +foreach res $extra_resources { + set path [db_string get_href { } ] + set split_path [split $path "/"] + if { [llength $split_path] <= 1 } { + # - - - - - - - - - - - - - - - + # It just a file, copy the file + # - - - - - - - - - - - - - - - + set file_id [db_string get_file { } -default ""] + if { ![empty_string_p $file_id] } { + set filename [db_string get_filename { } -default ""] + } + set object_id [lors_central::get_item_id -revision_id $file_id] + lors_central::export::publish_versioned_object_to_file_system -object_id $object_id \ + -path "$file" -file_name $filename + } else { + # - - - - - - - - - - - - - - - - - - - - - - + # Is a folder, we need to create the folder + # - - - - - - - - - - - - - - - - - - - - - - + if { ![empty_string_p [lindex $split_path 0]] } { + set folder_path [lindex $split_path 0] + set file_path [lindex $split_path 1] + } else { + set folder_path [lindex $split_path 1] + set file_path [lindex $split_path 2] + } + with_catch errmsg { + exec bash -c "cd '$file'; mkdir $folder_path;" + } { + # We don't need to create this folder since already exists + } + db_foreach get_resource_files { } { + # - - - - - - - - + # Copy all files + # - - - - - - - - + set object_id [lors_central::get_item_id -revision_id $file_id] + lors_central::export::publish_versioned_object_to_file_system -object_id $object_id \ + -path "$file/$folder_path" -file_name $filename + } if_no_rows { + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # This is a file that it's not present on ims_cp_files table ( URL ) + # We need to get it from the folder directly, using res_id to get + # man id to get the folder where the file is present + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + set root_folder [lors_central::get_root_folder_id] + set man_id [db_string get_man_id { }] + set name [lors_central::get_course_name -man_id $man_id] + set content_folder [db_string get_content_folder { select item_id from cr_items where parent_id = :root_folder and name = :name }] + set folder_id [db_string get_folder_id { select item_id from cr_items where parent_id = :content_folder and name = :folder_path }] + set url_file_id [db_string get_url_file_id { select item_id from cr_items where parent_id = :folder_id and name = :file_path} ] + lors_central::export::publish_versioned_object_to_file_system -object_id $url_file_id \ + -path "$file/$folder_path" -file_name $file_path + } + } +} + + +set cmd "zip -r '$out_file' *" +set copy "cp /tmp/gimsmanifest.xml ./imsmanifest.xml" + +# - - - - - - - - - - +# create the archive +# - - - - - - - - - - +with_catch errmsg { + exec bash -c "cd '$file'; $copy; $cmd; cd -" +} { + # some day we'll do something useful here + error $errmsg +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# redirect the archive to index.vuh to be returned to the connection. +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ad_returnredirect ".$out_file" + + + +# - - - - - - - - - - - - - - - - - - - +# Removing temporary files and folders +# - - - - - - - - - - - - - - - - - - - + +exec rm -fr $in_path +exec rm -fr $out_path +exec rm -fr "tmp/gimsmanifest.xml" + + Index: openacs-4/packages/lors-central/www/export/create-zip.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/export/create-zip.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/export/create-zip.xql 17 May 2005 16:21:20 -0000 1.1 @@ -0,0 +1,187 @@ +<?xml version="1.0"?> +<queryset> + +<fullquery name="get_other_resources"> + <querytext> + select + distinct res_id + from + ims_cp_items_to_resources + where + res_id in ( + select + res_id + from + ims_cp_items_to_resources + where + ims_item_id in ( + select + ims_item_id + from + ims_cp_items + where + org_id in $orgs_list + ) + ) + and res_id not in ( + select + res_id + from + ims_cp_resources + where + man_id = :course_man_id + ) + </querytext> +</fullquery> + + +<fullquery name="get_metadata_info"> + <querytext> + select + md.schema, + md.schemaversion, + mdgt.title_l, + mdgt.title_s, + mdgd.descrip_l, + mdgd.descrip_s + from + ims_md md, + ims_md_general_title mdgt, + ims_md_general_desc mdgd + where + md.ims_md_id = mdgd.ims_md_id and + mdgd.ims_md_id = mdgt.ims_md_id and + md.ims_md_id = :man_id + </querytext> +</fullquery> + + +<fullquery name="get_man_info"> + <querytext> + select + * + from + ims_cp_manifests + where + man_id = :man_id + </querytext> +</fullquery> + +<fullquery name="get_organizations"> + <querytext> + select + * + from + ims_cp_organizations + where + man_id = :man_id + order by org_id + </querytext> +</fullquery> + +<fullquery name="get_resources"> + <querytext> + select + r.* + from + ims_cp_resources r, + ims_cp_items_to_resources ir + where + r.res_id = ir.res_id + and ir.ims_item_id in ( + select + ims_item_id + from + ims_cp_items + where + org_id = :org_id + ) + order by res_id + </querytext> +</fullquery> + +<fullquery name="get_resource_files"> + <querytext> + select + file_id, + filename + from + ims_cp_files + where + res_id = :res + </querytext> +</fullquery> + +<fullquery name="get_files"> + <querytext> + select + * + from + ims_cp_files + where + res_id = :res_id + order by file_id + </querytext> +</fullquery> + +<fullquery name="get_item_info"> + <querytext> + select + i.identifier, + i.identifierref, + i.item_title, + ir.res_id as item_res_id + from + ims_cp_items i, ims_cp_items_to_resources ir + where + i.ims_item_id = ir.ims_item_id and + i.ims_item_id = :ims_item_id + + </querytext> +</fullquery> + +<fullquery name="get_href"> + <querytext> + select + href + from + ims_cp_resources + where + res_id = :res + </querytext> +</fullquery> + +<fullquery name="get_file"> + <querytext> + select + file_id + from + ims_cp_files + where + res_id = :res + </querytext> +</fullquery> + +<fullquery name="get_filename"> + <querytext> + select + filename + from + ims_cp_files + where + file_id = :file_id + </querytext> +</fullquery> + +<fullquery name="get_man_id"> + <querytext> + select + man_id + from + ims_cp_resources + where + res_id = :res + </querytext> +</fullquery> + +</queryset> \ No newline at end of file Index: openacs-4/packages/lors-central/www/export/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/export/index.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/export/index.vuh 17 May 2005 16:21:20 -0000 1.1 @@ -0,0 +1,15 @@ +# packages/lors-central/www/export/index.vuh + +ad_page_contract { + Just to get the propper file name to return to the user + from the server + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net +} + + +set download_name [ad_conn path_info] + +ns_returnfile 200 application/octet-stream "/$download_name" + Index: openacs-4/packages/lors-central/www/images/down.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/images/down.gif,v diff -u Binary files differ Index: openacs-4/packages/lors-central/www/images/file.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/images/file.gif,v diff -u Binary files differ Index: openacs-4/packages/lors-central/www/images/folder.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/images/folder.gif,v diff -u Binary files differ Index: openacs-4/packages/lors-central/www/images/live.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/images/live.gif,v diff -u Binary files differ Index: openacs-4/packages/lors-central/www/images/up.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/images/up.gif,v diff -u Binary files differ Index: openacs-4/packages/lors-central/www/lib/md-record-pbs.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lib/md-record-pbs.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lib/md-record-pbs.adp 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1 @@ +<listtemplate name="d_pres"></listtemplate> \ No newline at end of file Index: openacs-4/packages/lors-central/www/lib/md-record-pbs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lib/md-record-pbs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lib/md-record-pbs.tcl 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1,48 @@ + +template::list::create \ + -name d_pres \ + -multirow d_pres \ + -no_data "-" \ + -html {width 80%} \ + -elements { + object_type { + label "[_ lorsm.Object_Type]" + } + schema_and_version { + label "[_ lorsm.lt_MD_Schema_and_Version]" + html { align center } + } + admin { + label "[_ lorsm.Edit_Schema_Details]" + display_eval {Modify Schema} + link_url_eval {[export_vars -base "addmd" ims_md_id]} + link_html {title "[_ lorsm.Admin_Course]" class button} + html { align center } + } + + } + +db_multirow d_pres select_ge_titles { + select + object_type + from + acs_objects + where + object_id = :ims_md_id +} + +db_multirow -extend { schema_and_version } d_pres select_schema_details { + + select + ims_md_id, + schema, + schemaversion + from + ims_md + where + ims_md_id = :ims_md_id + +} { + set schema_and_version [concat $schema " " $schemaversion] +} + Index: openacs-4/packages/lors-central/www/lib/md-record.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lib/md-record.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lib/md-record.adp 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1 @@ +<listtemplate name="d_pres"></listtemplate> \ No newline at end of file Index: openacs-4/packages/lors-central/www/lib/md-record.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lib/md-record.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lib/md-record.tcl 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1,61 @@ +set actions [list] + +lappend actions "[_ lorsm._General]" [export_vars -base generalmd {ims_md_id}] "[_ lorsm.lt_View_General_Metadata]" +lappend actions "[_ lorsm.Lifecycle_MD]" [export_vars -base lifecyclemd {ims_md_id}] "[_ lorsm.lt_View_Lifecycle_Metada]" +lappend actions "[_ lorsm.Meta_MD]" [export_vars -base metamd {ims_md_id}] "[_ lorsm.View_Meta_Metadata]" +lappend actions "[_ lorsm.Technical_MD]" [export_vars -base technicalmd {ims_md_id}] "[_ lorsm.lt_View_Technical_Metada]" +lappend actions "[_ lorsm.Educational_MD]" [export_vars -base educationalmd {ims_md_id}] "[_ lorsm.lt_View_Educational_Meta]" +lappend actions "[_ lorsm.Rights_MD]" [export_vars -base rightsmd {ims_md_id}] "[_ lorsm.View_Rights_Metadata]" +lappend actions "[_ lorsm.Relation_MD]" [export_vars -base relationmd {ims_md_id}] "[_ lorsm.lt_View_Relation_Metadat]" +lappend actions "[_ lorsm.Annotation_MD]" [export_vars -base annotationmd {ims_md_id}] "[_ lorsm.lt_View_Annotation_Metad]" +lappend actions "[_ lorsm.Classification_MD]" [export_vars -base classificationmd {ims_md_id}] "[_ lorsm.lt_View_Classification_M_1]" + + +# Presentation +template::list::create \ + -name d_pres \ + -multirow d_pres \ + -no_data "-" \ + -actions $actions \ + -elements { + object_type { + label "[_ lorsm.Object_Type]" + } + schema_and_version { + label "[_ lorsm.lt_MD_Schema_and_Version]" + html { align center } + } + admin { + label "[_ lorsm.Edit_Schema_Details]" + display_eval {Modify Schema} + link_url_eval {[export_vars -base "addmd" ims_md_id]} + link_html {title "[_ lorsm.Admin_Course]" class button} + html { align center } + } + + } + +db_multirow d_pres select_ge_titles { + select + object_type + from + acs_objects + where + object_id = :ims_md_id +} + +db_multirow -extend { schema_and_version } d_pres select_schema_details { + + select + ims_md_id, + schema, + schemaversion + from + ims_md + where + ims_md_id = :ims_md_id + +} { + set schema_and_version [concat $schema " " $schemaversion] +} + Index: openacs-4/packages/lors-central/www/lib/repository-shared-courses.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lib/repository-shared-courses.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lib/repository-shared-courses.adp 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1,3 @@ + <listtemplate name="d_courses"></listtemplate> + + Index: openacs-4/packages/lors-central/www/lib/repository-shared-courses.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lib/repository-shared-courses.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lib/repository-shared-courses.tcl 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1,99 @@ +# packages/lorsm/www/lib/repository-shared-courses.tcl + +ad_page_contract { + + List all the shared courses in the repository + View shared courses + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2004-07-09 + @arch-tag: 9dd389d3-195f-49ed-b610-ee893cde06d6 + @cvs-id $Id: repository-shared-courses.tcl,v 1.1 2005/05/17 16:21:21 miguelm Exp $ +} { + +} -properties { +} -validate { +} -errors { +} + + +set title "[_ lorsm.Shared_Courses]" +set context [list "[_ lorsm.Shared_Courses]"] + +set package_id [ad_conn package_id] +set community_id [dotlrn_community::get_community_id] + +set admin_p [dotlrn::user_can_admin_community_p \ + -user_id [ad_conn user_id] \ + -community_id $community_id ] + +set com_url [dotlrn_community::get_community_url $community_id] + +template::list::create \ + -name d_courses \ + -multirow d_courses \ + -html {width 50%} \ + -key man_id \ + -no_data "[_ lorsm.No_Courses]" \ + -elements { + course_name { + label "[_ lorsm.Available_Courses]" + display_col course_name + link_url_eval {[export_vars -base $community_url/lorsm/shared/course-info {man_id fs_package_id folder_id}]} + link_html {title "[_ lorsm.Access_Course]"} + + } + hasmetadata { + label "[_ lorsm.Metadata_1]" + link_url_eval {[export_vars -base $community_url/lorsm/md {ims_md_id}]} + link_html {title "[_ lorsm.See_metadata]" } + html { align center } + } + creation_user { + label "[_ lorsm.Owner]" + display_eval {[person::name -person_id $creation_user]} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + creation_date { + label "[_ lorsm.Creation_Date]" + display_eval {[lc_time_fmt $creation_date "%x %X"]} + } + admin { + label "[_ lorsm.Course_Info]" + display_eval {Info/View} + link_url_eval {[export_vars -base $community_url/lorsm/shared/course-info man_id]} + link_html {title "[_ lorsm.Info]" class button} + html { align center } + } + } + + +db_multirow -extend { ims_md_id community_url } d_courses select_d_courses { + select + cp.man_id, + cp.course_name, + cp.identifier, + cp.version, + case + when hasmetadata = 't' then 'Yes' + else 'No' + end as hasmetadata, + cp.fs_package_id, + cp.folder_id, + acs.creation_user, + acs.creation_date, + acs.context_id + from + ims_cp_manifests cp, acs_objects acs + where + cp.man_id = acs.object_id + and + cp.isshared = 't' + and cp.man_id in ( select cr.live_revision from cr_items cr + where content_type = 'ims_manifest_object' ) + order by acs.creation_date desc +} { + set ims_md_id $man_id + set community_url $com_url +} + Index: openacs-4/packages/lors-central/www/md/addmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/addmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/addmd.adp 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1,31 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<h3>MD Schema</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th>Metadata Schema</th> + </tr> + <tr class="form-section"> + <td><listtemplate name= "md_schema_info"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add Metadata Schema</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr> + <td>Object: <b><i>@object_type@</i></b><br> + <small>Add details for the metadata schema and version.</small> + </td> + </tr> + <tr> + <formtemplate id="add_md" style="standard-lars"></formtemplate> + </tr> + </table> +</blockquote> Index: openacs-4/packages/lors-central/www/md/addmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/addmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/addmd.tcl 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1,135 @@ +# packages/lorsm/www/md/addmd.tcl + +ad_page_contract { + + Add metadata schema + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2004-11-13 + @arch-tag: 28b76527-a05f-42cf-b562-37c7b85e799f + @cvs-id $Id: addmd.tcl,v 1.1 2005/05/17 16:21:21 miguelm Exp $ +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# Get object information +set object_type [acs_object_type $ims_md_id] + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.lt_Edit_Metadata_Schema_]"] +set title "[_ lorsm.lt_AddEdit_MD_Schema_and]" + + +# Form +ad_form -name add_md \ + -cancel_url ".." \ + -mode edit \ + -form { + + {schema:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Metadata_schema_ie_IM]"} + {label "[_ lorsm.Schema]"} + } + + {schemaversion:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Version_of_the_Schema]"} + {label "[_ lorsm.Schema_Version]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + db_transaction { + + if {![lors::imsmd::mdExist -ims_md_id $ims_md_id]} { + + db_dml do_insert " + insert into ims_md(ims_md_id, schema, schemaversion) + values (:ims_md_id, :schema, :schemaversion)" + + } else { + + db_dml do_update { + update ims_md set schema = :schema, schemaversion = :schemaversion + where ims_md_id = :ims_md_id + } + + } + + # If the object_type is on any of the IMS CP object types, + # then we update also the ims cp tables accordingly. + + switch $object_type { + + "ims_manifest" { + + db_dml upd_manifest " + update ims_cp_manifests set hasmetadata = 't' + where man_id = :ims_md_id" + } + "ims_item" { + + db_dml upd_item " + update ims_cp_items set hasmetadata = 't' + where item_id = :ims_md_id" + } + "ims_organization" { + + db_dml upd_organization " + update ims_cp_organizations set hasmetadata = 't' + where org_id = :ims_md_id" + } + "ims_resource" { + + db_dml upd_resource " + update ims_cp_resources set hasmetadata = 't' + where res_id = :ims_md_id" + } + "content_item" { + + db_dml upd_file " + update ims_cp_files set hasmetadata = 't' + where file_id = :ims_md_id" + } + + } + } + +} -after_submit { + ad_returnredirect [export_vars -base "." ims_md_id] + ad_script_abort +} + +# MD Schema Info +template::list::create \ + -name md_schema_info \ + -multirow md_schema_info \ + -no_data "[_ lorsm.No_Schema_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + schema { + label "[_ lorsm.Schema_1]" + html { align center } + } + schemaversion { + label "[_ lorsm.Version_1]" + html { align center } + } + } + + db_multirow md_schema_info select_md_schema { + select + schema, + schemaversion + from + ims_md + where + ims_md_id = :ims_md_id + } + Index: openacs-4/packages/lors-central/www/md/annotationmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd.adp 17 May 2005 16:21:21 -0000 1.1 @@ -0,0 +1,16 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">Annotation Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Annotations: </td> + <td><listtemplate name= "d_an_annot"></listtemplate></td> + </tr> + </table> Index: openacs-4/packages/lors-central/www/md/annotationmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,45 @@ +ad_page_contract { + Displays/Adds IMS Metadata Annotation + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: annotationmd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.Annotation_MD]"] +set title "[_ lorsm.Annotation_MD]" + +# Annotation +template::list::create \ + -name d_an_annot \ + -multirow d_an_annot \ + -no_data "[_ lorsm.lt_No_Annotation_Availab]" \ + -actions [list "[_ lorsm.Add_Annotation]" [export_vars -base annotationmd/annotation_add {ims_md_id}] "[_ lorsm.lt_Add_another_Annotatio_1]"] \ + -html { align right style "width: 100%;" } \ + -elements { + entity { + label "[_ lorsm.Entry_1]" + } + export { + display_eval {\[View\]} + link_url_eval { [export_vars -base "annotationmd/annotation" {ims_md_an_id ims_md_id}] } + link_html {title "[_ lorsm.lt_View_associated_Annot]"} + html { align center } + } + } + +db_multirow d_an_annot select_an_annot { +select + entity, + ims_md_an_id, + ims_md_id +from + ims_md_annotation +where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/classificationmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,16 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">Classification Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Classifications: </td> + <td><listtemplate name= "d_cl_class"></listtemplate></td> + </tr> + </table> Index: openacs-4/packages/lors-central/www/md/classificationmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,49 @@ +ad_page_contract { + Displays/Adds IMS Metadata Classification + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classificationmd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.Classification_MD]"] +set title "[_ lorsm.Classification_MD]" + +# Classification +template::list::create \ + -name d_cl_class \ + -multirow d_cl_class \ + -no_data "[_ lorsm.lt_No_Classification_Ava]" \ + -actions [list "[_ lorsm.Add_Classification]" [export_vars -base classificationmd/classification_add {ims_md_id}] "[_ lorsm.lt_Add_another_Classific_2]"] \ + -html { align right style "width: 100%;" } \ + -elements { + purpose_s { + label "" + } + purpose_v { + label "" + } + export { + display_eval {\[View\]} + link_url_eval { [export_vars -base "classificationmd/classification" {ims_md_cl_id ims_md_id}] } + link_html {title "[_ lorsm.lt_View_associated_Class]"} + html { align center } + } + } + +db_multirow d_cl_class select_cl_class { +select + purpose_s, + purpose_v, + ims_md_cl_id, + ims_md_id +from + ims_md_classification +where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,69 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">#lorsm.Educational_Metadata#</th> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Interactivity_Type# </td> + <td><listtemplate name= "d_ed_intt"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.lt_Learning_Resource_Typ# </td> + <td><listtemplate name= "d_ed_lrt"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Interactivity_Level# </td> + <td><listtemplate name= "d_ed_intl"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Semantic_Density# </td> + <td><listtemplate name= "d_ed_semd"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.lt_Intended_End_User_Rol# </td> + <td><listtemplate name= "d_ed_ieur"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Context# </td> + <td><listtemplate name= "d_ed_cont"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Typical_Age_Range# </td> + <td><listtemplate name= "d_ed_tar"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Difficulty# </td> + <td><listtemplate name= "d_ed_dif"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.lt_Typical_Learning_Time# </td> + <td><listtemplate name= "d_ed_tlt"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Description# </td> + <td><listtemplate name= "d_ed_desc"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Language# </td> + <td><listtemplate name= "d_ed_lang"></listtemplate></td> + </tr> + + </table> + Index: openacs-4/packages/lors-central/www/md/educationalmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,260 @@ +ad_page_contract { + Displays/Adds IMS Metadata Educational + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 30 January 2004 + @cvs-id $Id: educationalmd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.Educational_MD]"] +set title "[_ lorsm.Educational_MD]" + +# Educational Interactivity Type +template::list::create \ + -name d_ed_intt \ + -multirow d_ed_intt \ + -no_data "[_ lorsm.lt_No_Interactivity_Type]" \ + -actions [list "[_ lorsm.lt_Add_Interactivity_Typ]" [export_vars -base educationalmd/educational_intt {ims_md_id}] "[_ lorsm.lt_Add_another_Interacti]"] \ + -html { align right style "width: 100%;" } \ + -elements { + intt { + label "" + } + } + +db_multirow d_ed_intt select_ed_intt { + select + '[' || int_type_s || '] ' || int_type_v as intt + from + ims_md_educational + where + ims_md_id = :ims_md_id +} + +# Educational Learning Resource Type +template::list::create \ + -name d_ed_lrt \ + -multirow d_ed_lrt \ + -no_data "[_ lorsm.lt_No_Learning_Resource_]" \ + -actions [list "[_ lorsm.lt_Add_Learning_Resource]" [export_vars -base educationalmd/educational_lrt {ims_md_id}] "[_ lorsm.lt_Add_another_Learning_]"] \ + -html { align right style "width: 100%;" } \ + -elements { + lrt { + label "" + } + } + +db_multirow d_ed_lrt select_ed_lrt { + select + '[' || lrt_s || '] ' || lrt_v as lrt + from + ims_md_educational_lrt + where + ims_md_id = :ims_md_id +} + +# Educational Interactivity Level +template::list::create \ + -name d_ed_intl \ + -multirow d_ed_intl \ + -no_data "[_ lorsm.lt_No_Interactivity_Leve]" \ + -actions [list "[_ lorsm.lt_Add_Interactivity_Lev]" [export_vars -base educationalmd/educational_intl {ims_md_id}] "[_ lorsm.lt_Add_another_Interacti_1]"] \ + -html { align right style "width: 100%;" } \ + -elements { + intl { + label "" + } + } + +db_multirow d_ed_intl select_ed_intl { + select + '[' || int_level_s || '] ' || int_level_v as intl + from + ims_md_educational + where + ims_md_id = :ims_md_id +} + +# Educational Semantic Density +template::list::create \ + -name d_ed_semd \ + -multirow d_ed_semd \ + -no_data "[_ lorsm.lt_No_Semantic_Density_A]" \ + -actions [list "[_ lorsm.Add_Semantic_Density]" [export_vars -base educationalmd/educational_semd {ims_md_id}] "[_ lorsm.lt_Add_another_Semantic_]"] \ + -html { align right style "width: 100%;" } \ + -elements { + semd { + label "" + } + } + +db_multirow d_ed_semd select_ed_semd { + select + '[' || sem_density_s || '] ' || sem_density_v as semd + from + ims_md_educational + where + ims_md_id = :ims_md_id +} + +# Educational Intended End User Role +template::list::create \ + -name d_ed_ieur \ + -multirow d_ed_ieur \ + -no_data "[_ lorsm.lt_No_Intended_End_User_]" \ + -actions [list "[_ lorsm.lt_Add_Intended_End_User]" [export_vars -base educationalmd/educational_ieur {ims_md_id}] "[_ lorsm.lt_Add_another_Intended_]"] \ + -html { align right style "width: 100%;" } \ + -elements { + ieur { + label "" + } + } + +db_multirow d_ed_ieur select_ed_ieur { + select + '[' || ieur_s || '] ' || ieur_v as ieur + from + ims_md_educational_ieur + where + ims_md_id = :ims_md_id +} + +# Educational Context +template::list::create \ + -name d_ed_cont \ + -multirow d_ed_cont \ + -no_data "[_ lorsm.No_Context_Available]" \ + -actions [list "[_ lorsm.Add_Context]" [export_vars -base educationalmd/educational_cont {ims_md_id}] "[_ lorsm.Add_another_Context]"] \ + -html { align right style "width: 100%;" } \ + -elements { + context { + label "" + } + } + +db_multirow d_ed_cont select_ed_cont { + select + '[' || context_s || '] ' || context_v as context + from + ims_md_educational_context + where + ims_md_id = :ims_md_id +} + +# Educational Typical Age Range +template::list::create \ + -name d_ed_tar \ + -multirow d_ed_tar \ + -no_data "[_ lorsm.lt_No_Typical_Age_Range_]" \ + -actions [list "[_ lorsm.lt_Add_Typical_Age_Range]" [export_vars -base educationalmd/educational_tar {ims_md_id}] "[_ lorsm.lt_Add_another_Typical_A]"] \ + -html { align right style "width: 100%;" } \ + -elements { + tar { + label "" + } + } + +db_multirow d_ed_tar select_ed_tar { + select + '[' || tar_l || '] ' || tar_s as tar + from + ims_md_educational_tar + where + ims_md_id = :ims_md_id +} + +# Educational Difficulty +template::list::create \ + -name d_ed_dif \ + -multirow d_ed_dif \ + -no_data "[_ lorsm.lt_No_Difficulty_Availab]" \ + -actions [list "[_ lorsm.Add_Difficulty_Type]" [export_vars -base educationalmd/educational_dif {ims_md_id}] "[_ lorsm.lt_Add_another_Difficult]"] \ + -html { align right style "width: 100%;" } \ + -elements { + diff { + label "" + } + } + +db_multirow d_ed_dif select_ed_dif { + select + '[' || difficulty_s || '] ' || difficulty_v as diff + from + ims_md_educational + where + ims_md_id = :ims_md_id +} + +# Educational Typical Learning Time +template::list::create \ + -name d_ed_tlt \ + -multirow d_ed_tlt \ + -no_data "[_ lorsm.lt_No_Typical_Learning_T]" \ + -actions [list "[_ lorsm.lt_Add_Typical_Learning_]" [export_vars -base educationalmd/educational_tlt {ims_md_id}] "[_ lorsm.lt_Add_another_Typical_L]"] \ + -html { align right style "width: 100%;" } \ + -elements { + tlt { + label "" + } + tlt_ls { + label "" + } + } + +db_multirow d_ed_tlt select_ed_tlt { + select + type_lrn_time as tlt, + '[' || type_lrn_time_l || '] ' || type_lrn_time_s as tlt_ls + from + ims_md_educational + where + ims_md_id = :ims_md_id +} + +# Educational Description +template::list::create \ + -name d_ed_desc \ + -multirow d_ed_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -actions [list "[_ lorsm.Add_Description]" [export_vars -base educationalmd/educational_desc {ims_md_id}] "[_ lorsm.lt_Add_another_Descripti]"] \ + -html { align right style "width: 100%;" } \ + -elements { + desc { + label "" + } + } + +db_multirow d_ed_desc select_ed_desc { + select + '[' || descrip_l || '] ' || descrip_s as desc + from + ims_md_educational_descrip + where + ims_md_id = :ims_md_id +} + +# Educational Language +template::list::create \ + -name d_ed_lang \ + -multirow d_ed_lang \ + -no_data "[_ lorsm.lt_No_Language_Available]" \ + -actions [list "[_ lorsm.Add_Language]" [export_vars -base educationalmd/educational_lang {ims_md_id}] "[_ lorsm.Add_another_Language]"] \ + -html { align right style "width: 100%;" } \ + -elements { + language { + label "" + } + } + +db_multirow d_ed_lang select_ed_lang { + select + language + from + ims_md_educational_lang + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/generalmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,53 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">#lorsm.General_Metadata#</th> + </tr> + <tr class="form-section"> + <td class="form-section">#lorsm.Titles# </td> + <td><listtemplate name= "d_gen_titles"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Catalog-Entries# </td> + <td><listtemplate name= "d_gen_cata"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Languages# </td> + <td><listtemplate name= "d_gen_lang"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Descriptions# </td> + <td><listtemplate name= "d_gen_desc"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Keywords# </td> + <td><listtemplate name= "d_gen_key"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Coverage# </td> + <td><listtemplate name= "d_gen_cover"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Structure# </td> + <td><listtemplate name= "d_gen_struc"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Aggregation_Level# </td> + <td><listtemplate name= "d_gen_aggl"></listtemplate></td> + </tr> + + </table> + Index: openacs-4/packages/lors-central/www/md/generalmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,227 @@ +# packages/lorsm/www/md/generalmd.tcl + +ad_page_contract { + Displays/Adds IMS Metadata General + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 19 January 2004 + @cvs-id $Id: generalmd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.General_MD]"] +set title "[_ lorsm.General_MD]" + +# General Title +template::list::create \ + -name d_gen_titles \ + -multirow d_gen_titles \ + -no_data "[_ lorsm.No_Titles_Available]" \ + -actions [list "[_ lorsm.Add_Title]" [export_vars -base generalmd/general_title {ims_md_id}] "[_ lorsm.Add_another_title]"] \ + -html { align right style "width: 100%;" } \ + -elements { + title_l { + label "" + } + title_s { + label "" + } + } + +db_multirow d_gen_titles select_ge_titles { + select title_l, + title_s + from + ims_md_general_title + where + ims_md_id = :ims_md_id +} { + set item_url [export_vars -base "item" { ims_md_id }] +} + +# General Description +template::list::create \ + -name d_gen_desc \ + -multirow d_gen_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -actions [list "[_ lorsm.Add_Description]" [export_vars -base generalmd/general_desc {ims_md_id}] "[_ lorsm.lt_Add_another_Descripti]"] \ + -html { align right style "width: 100%;" } \ + -elements { + descrip_l { + label "" + } + descrip_s { + label "" + } + } + +db_multirow d_gen_desc select_ge_desc { + select descrip_l, + descrip_s + from + ims_md_general_desc + where + ims_md_id = :ims_md_id +} + +# General Catalog-entry +template::list::create \ + -name d_gen_cata \ + -multirow d_gen_cata \ + -no_data "[_ lorsm.lt_No_Catalog_Entry_Avai]" \ + -actions [list "[_ lorsm.Add_Catalog-Entry]" [export_vars -base generalmd/general_cata {ims_md_id}] "[_ lorsm.lt_Add_another_Catalog-E]"] \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "" + } + entry_l { + label "" + } + entry_s { + label "" + } + } + +db_multirow d_gen_cata select_ge_cata { + select + catalog, + entry_l, + entry_s + from + ims_md_general_cata + where + ims_md_id = :ims_md_id +} + + + +# General Language +template::list::create \ + -name d_gen_lang \ + -multirow d_gen_lang \ + -no_data "[_ lorsm.lt_No_Language_Available]" \ + -actions [list "[_ lorsm.Add_Language]" [export_vars -base generalmd/general_lang {ims_md_id}] "[_ lorsm.Add_another_Language]"] \ + -html { align right style "width: 100%;" } \ + -elements { + language { + label "" + } + } + +db_multirow d_gen_lang select_ge_lang { + select + language + from + ims_md_general_lang + where + ims_md_id = :ims_md_id +} + +# General Keywords +template::list::create \ + -name d_gen_key \ + -multirow d_gen_key \ + -no_data "[_ lorsm.lt_No_Keywords_Available]" \ + -actions [list "[_ lorsm.Add_Keywords]" [export_vars -base generalmd/general_key {ims_md_id}] "[_ lorsm.Add_another_Keywords]"] \ + -html { align right style "width: 100%;" } \ + -elements { + keyword_l { + label "" + } + keyword_s { + label "" + } + } + +db_multirow d_gen_key select_ge_key { + select + keyword_l, + keyword_s + from + ims_md_general_key + where + ims_md_id = :ims_md_id +} + +# General Coverage +template::list::create \ + -name d_gen_cover \ + -multirow d_gen_cover \ + -no_data "[_ lorsm.lt_No_Coverage_Available]" \ + -actions [list "[_ lorsm.Add_Coverage]" [export_vars -base generalmd/general_cover {ims_md_id}] "[_ lorsm.Add_another_Coverage]"] \ + -html { align right style "width: 100%;" } \ + -elements { + cover_l { + label "" + } + cover_s { + label "" + } + } + +db_multirow d_gen_cover select_ge_cover { + select + cover_l, + cover_s + from + ims_md_general_cover + where + ims_md_id = :ims_md_id +} + +# General Structure +template::list::create \ + -name d_gen_struc \ + -multirow d_gen_struc \ + -no_data "[_ lorsm.lt_No_Structure_Availabl]" \ + -actions [list "[_ lorsm.Add_Structure]" [export_vars -base generalmd/general_struc {ims_md_id}] "[_ lorsm.lt_Add_another_Structure]"] \ + -html { align right style "width: 100%;" } \ + -elements { + structure_s { + label "" + } + structure_v { + label "" + } + } + +db_multirow d_gen_struc select_ge_struc { + select + structure_s, + structure_v + from + ims_md_general + where + ims_md_id = :ims_md_id +} + + +# General Aggregation level +template::list::create \ + -name d_gen_aggl \ + -multirow d_gen_aggl \ + -no_data "[_ lorsm.lt_No_Aggregation_Level_]" \ + -actions [list "[_ lorsm.lt_Add_Aggregation_Level]" [export_vars -base generalmd/general_aggl {ims_md_id}] "[_ lorsm.lt_Add_another_Aggregati]"] \ + -html { align right style "width: 100%;" } \ + -elements { + agg_level_s { + label "" + } + agg_level_v { + label "" + } + } + +db_multirow d_gen_aggl select_ge_aggl { + select + agg_level_s, + agg_level_v + from + ims_md_general + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/index.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,27 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<if @hasmetadata@ > +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + +<p> +<if @write_p@ eq 1> + #lorsm.You_can# <a href="@link@">#lorsm.lt_upload_a_XML_LOM_meta#</a> #lorsm.lt_to_addchange_the_meta# +</if> +<br> +<if @read_p@ eq 1> + #lorsm.lt_Heres_a_link_to_the_a# +</if> +</if> + +<else> +<p> +#lorsm.lt_No_metadata_record_ex# +<if @write_p@ eq 1> +<ul><li><a href=addmd?ims_md_id=@ims_md_id;noquote@>#lorsm.Add_metadata#</a></li></ul> +</if> +</else> + Index: openacs-4/packages/lors-central/www/md/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/index.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,21 @@ +ad_page_contract { + Displays/Adds IMS Metadata + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 19 January 2004 + @cvs-id $Id: index.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context +set context [list "[_ lorsm.IMS_Metadata_Editor]"] +set title [list "[_ lorsm.IMS_Metadata_Editor]"] +set link [export_vars -base "md_upload" ims_md_id] + +set hasmetadata [lors::imsmd::mdExist -ims_md_id $ims_md_id] +set object_type [acs_object_type $ims_md_id] + +set write_p [permission::permission_p -party_id [ad_conn user_id] -object_id $ims_md_id -privilege write] +set read_p [permission::permission_p -party_id [ad_conn user_id] -object_id $ims_md_id -privilege read] Index: openacs-4/packages/lors-central/www/md/lifecyclemd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/lifecyclemd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/lifecyclemd.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">#lorsm.Lifecycle_Metadata#</th> + </tr> + <tr class="form-section"> + <td class="form-section">#lorsm.Version# </td> + <td><listtemplate name= "d_lf_ver"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Status# </td> + <td><listtemplate name= "d_lf_stat"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Contribution# </td> + <td><listtemplate name= "d_lf_cont"></listtemplate></td> + </tr> + + + </table> + Index: openacs-4/packages/lors-central/www/md/lifecyclemd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/lifecyclemd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/lifecyclemd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,103 @@ +ad_page_contract { + Displays/Adds IMS Metadata Lifecycle + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 30 January 2004 + @cvs-id $Id: lifecyclemd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "IMS Metadata Editor"] "Lifecycle MD"] + +set title "Lifecycle MD" + +# Lifecycle version +template::list::create \ + -name d_lf_ver \ + -multirow d_lf_ver \ + -no_data "[_ lorsm.No_Version_Available]" \ + -actions [list "[_ lorsm.Add_Version]" [export_vars -base lifecyclemd/lifecycle_version {ims_md_id}] "[_ lorsm.Add_Version]"] \ + -html { align right style "width: 100%;" } \ + -elements { + version_l { + label "" + } + version_s { + label "" + } + } + +db_multirow d_lf_ver select_lf_ver { + select version_l, + version_s + from + ims_md_life_cycle + where + ims_md_id = :ims_md_id +} + +# Lifecycle status +template::list::create \ + -name d_lf_stat \ + -multirow d_lf_stat \ + -no_data "[_ lorsm.No_Status_Available]" \ + -actions [list "[_ lorsm.Add_Status]" [export_vars -base lifecyclemd/lifecycle_stat {ims_md_id}] "[_ lorsm.Add_Status]"] \ + -html { align right style "width: 100%;" } \ + -elements { + status_s { + label "" + } + status_v { + label "" + } + } + +db_multirow d_lf_stat select_lf_stat { + select status_s, + status_v + from + ims_md_life_cycle + where + ims_md_id = :ims_md_id +} + + +# Lifecycle Contrib +template::list::create \ + -name d_lf_cont \ + -multirow d_lf_cont \ + -no_data "[_ lorsm.lt_No_Contributors_Avail]" \ + -actions [list "[_ lorsm.Add_Contributors]" [export_vars -base lifecyclemd/lifecycle_cont {ims_md_id}] "[_ lorsm.lt_Add_another_Contribut]"] \ + -html { align right style "width: 100%;" } \ + -elements { + role { + label "[_ lorsm.Role]" + } + entity { + label "[_ lorsm.Entity_1]" + } + cont_date { + label "[_ lorsm.Contribution_Date]" + } + cont_date_ls { + label "[_ lorsm.Description_1]" + } + } + +db_multirow d_lf_cont select_lf_cont { +select + lfc.role_v || ' ' || '[' || lfc.role_s || ']' as role, + lfce.entity, + lfc.cont_date, + '[' || lfc.cont_date_l || ']' || ' ' || lfc.cont_date_s as cont_date_ls +from + ims_md_life_cycle_contrib lfc, + ims_md_life_cycle_contrib_entity lfce +where + lfc.ims_md_lf_cont_id = lfce.ims_md_lf_cont_id +and + lfc.ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/metamd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,34 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">#lorsm.Meta_Metadata#</th> + </tr> + <tr class="form-section"> + <td class="form-section">#lorsm.Catalog-Entries# </td> + <td><listtemplate name= "d_md_cata"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Contribution# </td> + <td><listtemplate name= "d_md_cont"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Scheme# </td> + <td><listtemplate name= "d_md_scheme"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Language# </td> + <td><listtemplate name= "d_md_lang"></listtemplate></td> + </tr> + + </table> + + Index: openacs-4/packages/lors-central/www/md/metamd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,122 @@ +ad_page_contract { + Displays/Adds IMS Metadata Metametadata + + @author Ernie Ghiglione (ErnieG@ee.usyd.edu.au) + @creation-date 30 January 2004 + @cvs-id $Id: metamd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.Meta_Metadata]"] +set title "[_ lorsm.Meta_MD]" + +# Metametadata Catalogentry +template::list::create \ + -name d_md_cata \ + -multirow d_md_cata \ + -no_data "[_ lorsm.lt_No_Catalog_Entry_Avai]" \ + -actions [list "[_ lorsm.Add_Catalog-Entry]" [export_vars -base metamd/meta_cata {ims_md_id}] "[_ lorsm.lt_Add_another_Catalog-E]"] \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "[_ lorsm.Catalog_1]" + } + entry_ls { + label "[_ lorsm.Language_Entry]" + } + } + +db_multirow d_md_cata select_md_cata { + select + catalog, + '[' || entry_l || ']' || ' ' || entry_s as entry_ls + from + ims_md_metadata_cata + where + ims_md_id = :ims_md_id +} + + +# Metametadata Contrib +template::list::create \ + -name d_md_cont \ + -multirow d_md_cont \ + -no_data "[_ lorsm.lt_No_Contributors_Avail]" \ + -actions [list "[_ lorsm.Add_Contributors]" [export_vars -base metamd/meta_cont {ims_md_id}] "[_ lorsm.lt_Add_another_Contribut]"] \ + -html { align right style "width: 100%;" } \ + -elements { + role { + label "[_ lorsm.Role]" + } + entity { + label "[_ lorsm.Entity_1]" + } + cont_date { + label "[_ lorsm.Contribution_Date]" + } + cont_date_ls { + label "[_ lorsm.Description_1]" + } + } + +db_multirow d_md_cont select_md_cont { +select + mdc.role_v || ' ' || '[' || mdc.role_s || ']' as role, + mdce.entity, + mdc.cont_date, + '[' || mdc.cont_date_l || ']' || ' ' || mdc.cont_date_s as cont_date_ls +from + ims_md_metadata_contrib mdc, + ims_md_metadata_contrib_entity mdce +where + mdc.ims_md_md_cont_id = mdce.ims_md_md_cont_id +and + mdc.ims_md_id = :ims_md_id +} + +# Metametadata metadatascheme +template::list::create \ + -name d_md_scheme \ + -multirow d_md_scheme \ + -no_data "[_ lorsm.No_Scheme_Available]" \ + -actions [list "[_ lorsm.Add_Scheme]" [export_vars -base metamd/meta_scheme {ims_md_id}] "[_ lorsm.Add_another_Scheme]"] \ + -html { align right style "width: 100%;" } \ + -elements { + scheme { + label "" + } + } + +db_multirow d_md_scheme select_md_scheme { + select + scheme + from + ims_md_metadata_scheme + where + ims_md_id = :ims_md_id +} + +# Metametadata language +template::list::create \ + -name d_md_lang \ + -multirow d_md_lang \ + -no_data "[_ lorsm.lt_No_Language_Available]" \ + -actions [list "[_ lorsm.Add_Language]" [export_vars -base metamd/meta_lang {ims_md_id}] "[_ lorsm.lt_Add_another_Languages]"] \ + -html { align right style "width: 100%;" } \ + -elements { + language { + label "" + } + } + +db_multirow d_md_lang select_md_lang { + select + language + from + ims_md_metadata + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/relationmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,17 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">#lorsm.Relation_Metadata#</th> + </tr> + <tr class="form-section"> + <td class="form-section">#lorsm.Relations# </td> + <td><listtemplate name= "d_re_relat"></listtemplate></td> + </tr> + </table> + Index: openacs-4/packages/lors-central/www/md/relationmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,53 @@ +ad_page_contract { + Displays/Adds IMS Metadata Relation + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: relationmd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.Relation_MD]"] +set title "Relation MD" + +# Relation +template::list::create \ + -name d_re_relat \ + -multirow d_re_relat \ + -no_data "[_ lorsm.lt_No_Relation_Available]" \ + -actions [list "[_ lorsm.Add_Relation]" [export_vars -base relationmd/relation_add {ims_md_id}] "[_ lorsm.lt_Add_another_Relation__1]"] \ + -html { align right style "width: 100%;" } \ + -elements { + kind_s { + label "" + } + kind_v { + label "" + } + export { + display_eval {\[View \\ Edit\]} + link_url_eval { [export_vars -base "relationmd/relation" {ims_md_re_re_id ims_md_re_id ims_md_id}] } + link_html {title "[_ lorsm.lt_View_associated_Relat]"} + html { align center } + } + } + +db_multirow d_re_relat select_re_relat { +select + re.kind_s, + re.kind_v, + re.ims_md_id, + re.ims_md_re_id, + rere.ims_md_re_re_id +from + ims_md_relation re, + ims_md_relation_resource rere +where + re.ims_md_id = :ims_md_id +and + rere.ims_md_re_id = re.ims_md_re_id +} Index: openacs-4/packages/lors-central/www/md/rightsmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/rightsmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/rightsmd.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,28 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">#lorsm.Rights_Metadata#</th> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Cost# </td> + <td><listtemplate name= "d_ri_cost"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.lt_Copyright_or_other_Re# </td> + <td><listtemplate name= "d_ri_caor"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Description# </td> + <td><listtemplate name= "d_ri_desc"></listtemplate></td> + </tr> + + </table> Index: openacs-4/packages/lors-central/www/md/rightsmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/rightsmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/rightsmd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,80 @@ +ad_page_contract { + Displays/Adds IMS Metadata Rights + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 30 January 2004 + @cvs-id $Id: rightsmd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "IMS Metadata Editor"] "Rights MD"] +set title "[_ lorsm.Rights_MD]" + +# Rights Cost +template::list::create \ + -name d_ri_cost \ + -multirow d_ri_cost \ + -no_data "[_ lorsm.No_Cost_Available]" \ + -actions [list "[_ lorsm.Add_Cost]" [export_vars -base rightsmd/rights_cost {ims_md_id}] "[_ lorsm.Add_another_Cost]"] \ + -html { align right style "width: 100%;" } \ + -elements { + cost { + label "" + } + } + +db_multirow d_ri_cost select_ri_cost { + select + '[' || cost_s || '] ' || cost_v as cost + from + ims_md_rights + where + ims_md_id = :ims_md_id +} + +# Rights Copyright or other Restrictions +template::list::create \ + -name d_ri_caor \ + -multirow d_ri_caor \ + -no_data "[_ lorsm.lt_No_Copyright_or_other]" \ + -actions [list "[_ lorsm.lt_Add_Copyright_or_othe]" [export_vars -base rightsmd/rights_caor {ims_md_id}] "[_ lorsm.lt_Add_another_Copyright]"] \ + -html { align right style "width: 100%;" } \ + -elements { + caor { + label "" + } + } + +db_multirow d_ri_caor select_ri_caor { + select + '[' || caor_s || '] ' || caor_v as caor + from + ims_md_rights + where + ims_md_id = :ims_md_id +} + +# Rights Description +template::list::create \ + -name d_ri_desc \ + -multirow d_ri_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -actions [list "[_ lorsm.Add_Description]" [export_vars -base rightsmd/rights_desc {ims_md_id}] "[_ lorsm.lt_Add_another_Descripti]"] \ + -html { align right style "width: 100%;" } \ + -elements { + desc { + label "" + } + } + +db_multirow d_ri_desc select_ri_desc { + select + '[' || descrip_l || '] ' || descrip_s as desc + from + ims_md_rights + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/technicalmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,49 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../lib/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">#lorsm.Technical_Metadata#</th> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Formats# </td> + <td><listtemplate name= "d_te_form"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Size# </td> + <td><listtemplate name= "d_te_size"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Locations# </td> + <td><listtemplate name= "d_te_loca"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Requirements# </td> + <td><listtemplate name= "d_te_req"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Installation_Remarks# </td> + <td><listtemplate name= "d_te_inst"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.lt_Other_Platform_Requir# </td> + <td><listtemplate name= "d_te_otr"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">#lorsm.Duration#</td> + <td><listtemplate name= "d_te_dur"></listtemplate></td> + </tr> + + </table> + Index: openacs-4/packages/lors-central/www/md/technicalmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,192 @@ +ad_page_contract { + Displays/Adds IMS Metadata Metametadata + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 30 January 2004 + @cvs-id $Id: technicalmd.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.Technical_MD]"] +set title "[_ lorsm.Technical_MD]" + +# Technical Format +template::list::create \ + -name d_te_form \ + -multirow d_te_form \ + -no_data "[_ lorsm.No_Format_Available]" \ + -actions [list "[_ lorsm.Add_Format]" [export_vars -base technicalmd/technical_form {ims_md_id}] "[_ lorsm.Add_another_Format]"] \ + -html { align right style "width: 100%;" } \ + -elements { + format { + label "" + } + } + +db_multirow d_te_form select_te_form { + select + format + from + ims_md_technical_format + where + ims_md_id = :ims_md_id +} + +# Technical Size +template::list::create \ + -name d_te_size \ + -multirow d_te_size \ + -no_data "[_ lorsm.No_Size_Available]" \ + -actions [list "[_ lorsm.Add_Size]" [export_vars -base technicalmd/technical_size {ims_md_id}] "[_ lorsm.Add_another_Size]"] \ + -html { align right style "width: 100%;" } \ + -elements { + t_size_bytes { + label "" + } + } + +db_multirow d_te_size select_te_size { + select + t_size || ' bytes' as t_size_bytes + from + ims_md_technical + where + ims_md_id = :ims_md_id +} + +# Technical Location +template::list::create \ + -name d_te_loca \ + -multirow d_te_loca \ + -no_data "No Location Available" \ + -actions [list "Add Location" [export_vars -base technicalmd/technical_loca {ims_md_id}] "Add another Location"] \ + -html { align right style "width: 100%;" } \ + -elements { + type { + label "" + } + location { + label "" + } + } + +db_multirow d_te_loca select_te_loca { + select + type, + location + from + ims_md_technical_location + where + ims_md_id = :ims_md_id +} + +# Technical Requirements +template::list::create \ + -name d_te_req \ + -multirow d_te_req \ + -no_data "[_ lorsm.lt_No_Requirements_Avail]" \ + -actions [list "[_ lorsm.Add_Requirements]" [export_vars -base technicalmd/technical_req {ims_md_id}] "[_ lorsm.lt_Add_another_Requireme]"] \ + -html { align right style "width: 100%;" } \ + -elements { + type { + label "[_ lorsm.Type]" + } + name { + label "[_ lorsm.Name]" + } + min_version { + label "[_ lorsm.Min_Version]" + } + max_version { + label "[_ lorsm.Max_Version]" + } + } + +db_multirow d_te_req select_te_req { + select + '[' || type_s || ']' || ' ' || type_v as type, + '[' || name_s || ']' || ' ' || name_v as name, + min_version, + max_version + from + ims_md_technical_requirement + where + ims_md_id = :ims_md_id +} + +# Technical Installation Remarks +template::list::create \ + -name d_te_inst \ + -multirow d_te_inst \ + -no_data "[_ lorsm.lt_No_Installation_Remar]" \ + -actions [list "[_ lorsm.lt_Add_Installation_Rema]" [export_vars -base technicalmd/technical_inst {ims_md_id}] "[_ lorsm.lt_Add_another_Installat]"] \ + -html { align right style "width: 100%;" } \ + -elements { + instl_rmrks { + label "" + } + } + +db_multirow d_te_inst select_te_inst { + select + '[' || instl_rmrks_l || ']' || ' ' || instl_rmrks_s as instl_rmrks + from + ims_md_technical + where + ims_md_id = :ims_md_id +} + +# Technical Other Platform Requirements +template::list::create \ + -name d_te_otr \ + -multirow d_te_otr \ + -no_data "[_ lorsm.lt_No_Other_Platform_Req]" \ + -actions [list "[_ lorsm.lt_Add_Other_Platform_Re]" [export_vars -base technicalmd/technical_otr {ims_md_id}] "[_ lorsm.lt_Add_another_Other_Pla]"] \ + -html { align right style "width: 100%;" } \ + -elements { + otr_plt { + label "" + } + } + +db_multirow d_te_otr select_te_otr { + select + '[' || otr_plt_l || ']' || ' ' || otr_plt_s as otr_plt + from + ims_md_technical + where + ims_md_id = :ims_md_id +} + +# Technical Duration +template::list::create \ + -name d_te_dur \ + -multirow d_te_dur \ + -no_data "[_ lorsm.lt_No_Duration_Available]" \ + -actions [list "[_ lorsm.Add_Duration]" [export_vars -base technicalmd/technical_dur {ims_md_id}] "[_ lorsm.Add_another_Duration]"] \ + -html { align right style "width: 100%;" } \ + -elements { + duration_sec { + label "" + } + duration_l { + label "" + } + duration_s { + label "" + } + } + +db_multirow d_te_dur select_te_dur { + select + duration_l, + duration_s, + duration || 's' as duration_sec + from + ims_md_technical + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,28 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">Annotation Metadata</th> + </tr> + + <tr class="form-section"> + <td class="form-section">Entity: </td> + <td><listtemplate name= "d_an_ent"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">Date: </td> + <td><listtemplate name= "d_an_date"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section">Descriptions: </td> + <td><listtemplate name= "d_an_desc"></listtemplate></td> + </tr> + + </table> Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,84 @@ +ad_page_contract { + Displays/Adds IMS Metadata Annotation + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: annotation.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_an_id:integer + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../annotationmd" ims_md_id] "[_ lorsm.Annotation_MD]"] "[_ lorsm.Annotation_Entry]"] +set title "[_ lorsm.Annotation_MD]" + +# Annotation Entity +template::list::create \ + -name d_an_ent \ + -multirow d_an_ent \ + -no_data "[_ lorsm.No_Entity_Available]" \ + -actions [list "[_ lorsm.Add_Entity]" [export_vars -base annotation_ent {ims_md_an_id ims_md_id}] "[_ lorsm.Add_another_Entity]"] \ + -html { align right style "width: 100%;" } \ + -elements { + entity { + label "" + } + } + +db_multirow d_an_ent select_an_ent { + select entity + from + ims_md_annotation + where + ims_md_an_id = :ims_md_an_id +} + +# Annotation Date +template::list::create \ + -name d_an_date \ + -multirow d_an_date \ + -no_data "[_ lorsm.No_Date_Available]" \ + -actions [list "[_ lorsm.Add_Date]" [export_vars -base annotation_date {ims_md_an_id ims_md_id}] "[_ lorsm.Add_another_Date]"] \ + -html { align right style "width: 100%;" } \ + -elements { + date { + label "[_ lorsm.Date_1]" + } + datels { + label "[_ lorsm.Description_1]" + } + } + +db_multirow d_an_date select_an_date { + select date, + '[' || date_l || '] ' || date_s as datels + from + ims_md_annotation + where + ims_md_an_id = :ims_md_an_id +} + +# Annotation Description +template::list::create \ + -name d_an_desc \ + -multirow d_an_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -actions [list "[_ lorsm.Add_Description]" [export_vars -base annotation_desc {ims_md_an_id ims_md_id}] "[_ lorsm.lt_Add_another_Descripti]"] \ + -html { align right style "width: 100%;" } \ + -elements { + desc { + label "" + } + } + +db_multirow d_an_desc select_an_desc { + select + '[' || descrip_l || '] ' || descrip_s as desc + from + ims_md_annotation_descrip + where + ims_md_an_id = :ims_md_an_id +} Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation_add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation_add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation_add.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,22 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<h3>Annotation Metadata Entry</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Annotation Metadata</th> + </tr> + <tr> + <td>Add another Annotation Metadata Entry?</td> + </tr> + <tr> + <formtemplate id="annotationmd_add" style="standard-lars"></formtemplate> + </tr> + </table> +</blockquote> Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation_add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation_add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation_add.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,43 @@ +# packages/lorsm/www/md/annotationmd/annotation_add.tcl + +ad_page_contract { + + Add/Edit Annotation MD Entry + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: annotation_add.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../annotationmd" ims_md_id] "[_ lorsm.Annotation_MD]"] "[_ lorsm.Annotation_Entry]"] +set title "[_ lorsm.lt_Add_Annotation_MD_Ent]" + +# Form +ad_form -name annotationmd_add \ + -cancel_url ../annotationmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_an_id:key(ims_md_annotation_seq) + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -new_data { + db_dml do_insert " + insert into ims_md_annotation (ims_md_an_id, ims_md_id) + values (:ims_md_an_id, :ims_md_id)" + +} -after_submit { + ad_returnredirect [export_vars -base "../annotationmd" {ims_md_id}] + ad_script_abort +} + Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation_date.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation_date.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation_date.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Annotation Metadata Date</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Annotation Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Date: </td> + <td><listtemplate name= "d_an_date"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Annotation Metadata Date</h3> +<blockquote> + <formtemplate id="annotationmd_date" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation_date.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation_date.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation_date.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,95 @@ +# packages/lorsm/www/md/annotationmd/annotation_date.tcl + +ad_page_contract { + + Add/Edit Annotation MD Date + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: annotation_date.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_an_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../annotationmd" ims_md_id] "[_ lorsm.Annotation_MD]"] [list [export_vars -base "annotation" {ims_md_id ims_md_an_id}] "[_ lorsm.Annotation_Entry]"] "[_ lorsm.AddEdit_Date]"] +set title "[_ lorsm.lt_Edit_Annotation_MD_Da]" + + +# Form + +ad_form -name annotationmd_date \ + -cancel_url annotation?ims_md_id=$ims_md_id&ims_md_an_id=$ims_md_an_id \ + -mode edit \ + -form { + + ims_md_an_id:key(ims_md_annotation_seq) + + {date:text,nospell + {section "[_ lorsm.lt_AddEdit_Annotation_MD_2]"} + {html {size 10}} + {help_text "[_ lorsm.Date_of_contribution]"} + {label "[_ lorsm.Date]"} + } + + {date_l:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi_3]"} + {label "[_ lorsm.Language]"} + } + + {date_s:text(textarea),nospell,optional + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_Date_and_Time_descrip]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_annotation where ims_md_an_id = :ims_md_an_id + +} -edit_data { + db_dml do_update " + update ims_md_annotation + set date = :date, + date_l = :date_l, + date_s = :date_s + where ims_md_an_id = :ims_md_an_id " + +} -after_submit { + ad_returnredirect [export_vars -base "annotation" {ims_md_an_id ims_md_id}] + ad_script_abort +} + +# Annotation Date +template::list::create \ + -name d_an_date \ + -multirow d_an_date \ + -no_data "[_ lorsm.No_Date_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + date { + label "[_ lorsm.Date_1]" + } + datels { + label "[_ lorsm.Description_1]" + } + } + +db_multirow d_an_date select_an_date { + select date, + '[' || date_l || '] ' || date_s as datels, + ims_md_an_id, + ims_md_id + from + ims_md_annotation + where + ims_md_an_id = :ims_md_an_id +} Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation_desc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation_desc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation_desc.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Annotation Metadata Description</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Annotation Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Description: </td> + <td><listtemplate name= "d_an_desc"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Annotation Metadata Description</h3> +<blockquote> + <formtemplate id="annotationmd_desc" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation_desc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation_desc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation_desc.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,109 @@ +# packages/lorsm/www/md/annotationmd/annotation_desc.tcl + +ad_page_contract { + + Add/Edit Annotation MD Description + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: annotation_desc.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_an_id:integer + ims_md_an_de_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_an_de_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../annotationmd" ims_md_id] "[_ lorsm.Annotation_MD]"] [list [export_vars -base "annotation" {ims_md_id ims_md_an_id}] "[_ lorsm.Annotation_Entry]"] "[_ lorsm.Edit_Description]"] + set title "Edit Annotation MD Description" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../annotationmd" ims_md_id] "[_ lorsm.Annotation_MD]"] [list [export_vars -base "annotation" {ims_md_id ims_md_an_id}] "[_ lorsm.Annotation_Entry]"] "[_ lorsm.Add_Description]"] + set title "[_ lorsm.lt_Add_Annotation_MD_Des]" +} + +# Form + +ad_form -name annotationmd_desc \ + -cancel_url annotation?ims_md_id=$ims_md_id&ims_md_an_id=$ims_md_an_id \ + -mode edit \ + -form { + + ims_md_an_de_id:key(ims_md_annotation_descrip_seq) + + {descrip_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Annotation_MD]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {descrip_s:text(textarea),nospell + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_Content_of_the_annota]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {ims_md_an_id:text(hidden) {value $ims_md_an_id} + } + +} -select_query {select * from ims_md_annotation_descrip where ims_md_an_de_id = :ims_md_an_de_id and ims_md_an_id = :ims_md_an_id + +} -edit_data { + db_dml do_update " + update ims_md_annotation_descrip + set descrip_l = :descrip_l, + descrip_s = :descrip_s + where ims_md_an_de_id = :ims_md_an_de_id" + +} -new_data { + db_dml do_insert " + insert into ims_md_annotation_descrip (ims_md_an_de_id, ims_md_an_id, descrip_l, descrip_s) + values + (:ims_md_an_de_id, :ims_md_an_id, :descrip_l, :descrip_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "annotation" {ims_md_an_id ims_md_id}] + ad_script_abort +} + +# Annotation Description +template::list::create \ + -name d_an_desc \ + -multirow d_an_desc \ + -no_data "No Description Available" \ + -html { align right style "width: 100%;" } \ + -elements { + desc { + label "" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "annotation_desc" {ims_md_an_de_id ims_md_an_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_an_desc select_an_desc { + select + '[' || ande.descrip_l || '] ' || ande.descrip_s as desc, + ande.ims_md_an_de_id, + an.ims_md_an_id, + an.ims_md_id + from + ims_md_annotation_descrip ande, + ims_md_annotation an + where + ande.ims_md_an_id = an.ims_md_an_id + and + ande.ims_md_an_id = :ims_md_an_id +} Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation_ent.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation_ent.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation_ent.adp 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Annotation Metadata Entity</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Annotation Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Entity: </td> + <td><listtemplate name= "d_an_ent"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Annotation Metadata Entity</h3> +<blockquote> + <formtemplate id="annotationmd_ent" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/annotationmd/annotation_ent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/annotationmd/annotation_ent.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/annotationmd/annotation_ent.tcl 17 May 2005 16:21:22 -0000 1.1 @@ -0,0 +1,78 @@ +# packages/lorsm/www/md/annotationmd/annotation_ent.tcl + +ad_page_contract { + + Add/Edit Annotation MD Entity + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: annotation_ent.tcl,v 1.1 2005/05/17 16:21:22 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_an_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../annotationmd" ims_md_id] "[_ lorsm.Annotation_MD]"] [list [export_vars -base "annotation" {ims_md_id ims_md_an_id}] "[_ lorsm.Annotation_Entry]"] "[_ lorsm.AddEdit_Entity]"] +set title "[_ lorsm.lt_Edit_Annotation_MD_En]" + + +# Form + +ad_form -name annotationmd_ent \ + -cancel_url annotation?ims_md_id=$ims_md_id&ims_md_an_id=$ims_md_an_id \ + -mode edit \ + -form { + + ims_md_an_id:key(ims_md_annotation_seq) + + {entity:text(textarea),nospell + {section "[_ lorsm.lt_AddEdit_Annotation_MD_1]"} + {html {rows 5 cols 50}} + {help_text "[_ lorsm.Annotator]"} + {label "[_ lorsm.Entity]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_annotation where ims_md_an_id = :ims_md_an_id + +} -edit_data { + db_dml do_update " + update ims_md_annotation + set entity = :entity + where ims_md_an_id = :ims_md_an_id " + +} -after_submit { + ad_returnredirect [export_vars -base "annotation" {ims_md_an_id ims_md_id}] + ad_script_abort +} + +# Annotation Entity +template::list::create \ + -name d_an_ent \ + -multirow d_an_ent \ + -no_data "[_ lorsm.No_Entity_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + entity { + label "" + } + } + +db_multirow d_an_ent select_an_ent { + select + entity, + ims_md_an_id, + ims_md_id + from + ims_md_annotation + where + ims_md_an_id = :ims_md_an_id +} Index: openacs-4/packages/lors-central/www/md/classificationmd/classification.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,28 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">Classification Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Purpose: </td> + <td><listtemplate name= "d_cl_pur"></listtemplate></td> + </tr> + <tr class="form-section"> + <td class="form-section">Taxonomic Paths: </td> + <td><listtemplate name= "d_cl_tpath"></listtemplate></td> + </tr> + <tr class="form-section"> + <td class="form-section">Descriptions: </td> + <td><listtemplate name= "d_cl_desc"></listtemplate></td> + </tr> + <tr class="form-section"> + <td class="form-section">Keywords: </td> + <td><listtemplate name= "d_cl_key"></listtemplate></td> + </tr> + </table> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,118 @@ +ad_page_contract { + Displays/Adds IMS Metadata Classification + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classification.tcl,v 1.1 2005/05/17 16:21:23 miguelm Exp $ + +} { + ims_md_cl_id:integer + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] "[_ lorsm.Classification_Entry]"] +set title "[_ lorsm.Classification_MD]" + +# Classification Purpose +template::list::create \ + -name d_cl_pur \ + -multirow d_cl_pur \ + -no_data "[_ lorsm.No_Purpose_Available]" \ + -actions [list "[_ lorsm.Add_Purpose]" [export_vars -base classification_pur {ims_md_cl_id ims_md_id}] "[_ lorsm.Add_another_Purpose]"] \ + -html { align right style "width: 100%;" } \ + -elements { + purpose_s { + label "" + } + purpose_v { + label "" + } + } + +db_multirow d_cl_pur select_cl_pur { + select purpose_s, + purpose_v + from + ims_md_classification + where + ims_md_cl_id = :ims_md_cl_id +} + +# Classification Taxonomic Path +template::list::create \ + -name d_cl_tpath \ + -multirow d_cl_tpath \ + -no_data "[_ lorsm.lt_No_Taxonomic_Paths_Av]" \ + -actions [list "[_ lorsm.Add_Taxonomic_Path]" [export_vars -base classification_addpath {ims_md_cl_id ims_md_id}] "[_ lorsm.lt_Add_another_Taxonomic]"] \ + -html { align right style "width: 100%;" } \ + -elements { + source { + label "" + } + export { + display_eval {\[[_ lorsm.View]\]} + link_url_eval { [export_vars -base "classification_tpath" {ims_md_cl_ta_id ims_md_cl_id ims_md_id}] } + link_html {title "[_ lorsm.lt_View_associated_Taxon]"} + html { align right } + } + } + +db_multirow d_cl_tpath select_cl_tpath { + select + '[' || ctp.source_l || '] ' || ctp.source_v as source, + ctp.ims_md_cl_ta_id, + ctp.ims_md_cl_id, + cl.ims_md_id + from + ims_md_classification_taxpath ctp, + ims_md_classification cl + where + ctp.ims_md_cl_id = :ims_md_cl_id + and cl.ims_md_cl_id = :ims_md_cl_id +} + +# Classification Description +template::list::create \ + -name d_cl_desc \ + -multirow d_cl_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -actions [list "[_ lorsm.Add_Description]" [export_vars -base classification_desc {ims_md_cl_id ims_md_id}] "[_ lorsm.lt_Add_another_Descripti]"] \ + -html { align right style "width: 100%;" } \ + -elements { + desc { + label "" + } + } + +db_multirow d_cl_desc select_cl_desc { + select + '[' || descrip_l || '] ' || descrip_s as desc + from + ims_md_classification_descrip + where + ims_md_cl_id = :ims_md_cl_id +} + +# Classification Keywords +template::list::create \ + -name d_cl_key \ + -multirow d_cl_key \ + -no_data "[_ lorsm.lt_No_Keywords_Available]" \ + -actions [list "[_ lorsm.Add_Keyword]" [export_vars -base classification_key {ims_md_cl_id ims_md_id}] "[_ lorsm.Add_another_Keyword]"] \ + -html { align right style "width: 100%;" } \ + -elements { + keyword { + label "" + } + } + +db_multirow d_cl_key select_cl_key { + select + '[' || keyword_l || '] ' || keyword_s as keyword + from + ims_md_classification_keyword + where + ims_md_cl_id = :ims_md_cl_id +} Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_add.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,22 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<h3>Classification Metadata Entry</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Classification Metadata</th> + </tr> + <tr> + <td>Add another Classification Metadata Entry?</td> + </tr> + <tr> + <formtemplate id="classificationmd_add" style="standard-lars"></formtemplate> + </tr> + </table> +</blockquote> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_add.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,41 @@ +# packages/lorsm/www/md/classificationmd/classification_add.tcl + +ad_page_contract { + + Add Classification MD Entry + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @creation-date 16 October 2004 + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list "[_ lorsm.lt_IMS_Metadata_Editor_-]"] +set title "[_ lorsm.lt_Add_Classification_MD]" + +# Form +ad_form -name classificationmd_add \ + -cancel_url ../classificationmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_cl_id:key(ims_md_classification_seq) + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -new_data { + db_dml do_insert " + insert into ims_md_classification (ims_md_cl_id, ims_md_id) + values (:ims_md_cl_id, :ims_md_id)" + +} -after_submit { + ad_returnredirect [export_vars -base "../classificationmd" {ims_md_id}] + ad_script_abort +} + Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_addpath.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_addpath.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_addpath.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,22 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<h3>Classification Metadata</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Classification Metadata</th> + </tr> + <tr> + <td>Add another Classification Metadata Taxonomic Path Entry?</td> + </tr> + <tr> + <formtemplate id="classificationmd_addpath" style="standard-lars"></formtemplate> + </tr> + </table> +</blockquote> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_addpath.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_addpath.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_addpath.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,47 @@ +# packages/lorsm/www/md/classificationmd/classification_addpath.tcl + +ad_page_contract { + + Add Classification MD Taxonomic Path Entry + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classification_addpath.tcl,v 1.1 2005/05/17 16:21:23 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_cl_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id}] "[_ lorsm.Classification_Entry]"] "[_ lorsm.lt_Add_Taxonomic_Path_En]"] +set title "[_ lorsm.lt_Add_Classification_MD_1]" + +# Form +ad_form -name classificationmd_addpath \ + -cancel_url classification?ims_md_id=$ims_md_id&ims_md_cl_id=$ims_md_cl_id \ + -mode edit \ + -form { + + ims_md_cl_ta_id:key(ims_md_classification_taxpath_seq) + + {ims_md_cl_id:text(hidden) {value $ims_md_cl_id} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -new_data { + db_dml do_insert " + insert into ims_md_classification_taxpath (ims_md_cl_ta_id, ims_md_cl_id) + values (:ims_md_cl_ta_id, :ims_md_cl_id)" + +} -after_submit { + ad_returnredirect [export_vars -base "classification" {ims_md_cl_id ims_md_id}] + ad_script_abort +} + Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_desc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_desc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_desc.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Classification Metadata Description</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Classification Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Descriptions: </td> + <td><listtemplate name= "d_cl_desc"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Classification Metadata Description</h3> +<blockquote> + <formtemplate id="classificationmd_desc" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_desc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_desc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_desc.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,109 @@ +# packages/lorsm/www/md/classificationmd/classification_desc.tcl + +ad_page_contract { + + Add/Edit Classification MD Description + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classification_desc.tcl,v 1.1 2005/05/17 16:21:23 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_cl_id:integer + ims_md_cl_de_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_cl_de_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id}] "[_ lorsm.Classification_Entry]"] "[_ lorsm.Edit_Description]"] + set title "[_ lorsm.lt_Edit_Classification_M_4]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id}] "[_ lorsm.Classification_Entry]"] "[_ lorsm.Add_Description]"] + set title "[_ lorsm.lt_Add_Classification_MD_2]" +} + +# Form + +ad_form -name classificationmd_desc \ + -cancel_url classification?ims_md_id=$ims_md_id&ims_md_cl_id=$ims_md_cl_id \ + -mode edit \ + -form { + + ims_md_cl_de_id:key(ims_md_classification_desc_seq) + + {descrip_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Classificatio_5]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {descrip_s:text(textarea),nospell + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_Description_of_the_le]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {ims_md_cl_id:text(hidden) {value $ims_md_cl_id} + } + +} -select_query {select * from ims_md_classification_descrip where ims_md_cl_de_id = :ims_md_cl_de_id and ims_md_cl_id = :ims_md_cl_id + +} -edit_data { + db_dml do_update " + update ims_md_classification_descrip + set descrip_l = :descrip_l, + descrip_s = :descrip_s + where ims_md_cl_de_id = :ims_md_cl_de_id" + +} -new_data { + db_dml do_insert " + insert into ims_md_classification_descrip (ims_md_cl_de_id, ims_md_cl_id, descrip_l, descrip_s) + values + (:ims_md_cl_de_id, :ims_md_cl_id, :descrip_l, :descrip_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "classification" {ims_md_cl_id ims_md_id}] + ad_script_abort +} + +# Classification Description +template::list::create \ + -name d_cl_desc \ + -multirow d_cl_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -html { align right style "width: 100%;" } \ + -elements { + desc { + label "" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "classification_desc" {ims_md_cl_de_id ims_md_cl_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_cl_desc select_cl_desc { + select + '[' || clde.descrip_l || '] ' || clde.descrip_s as desc, + clde.ims_md_cl_de_id, + cl.ims_md_cl_id, + cl.ims_md_id + from + ims_md_classification_descrip clde, + ims_md_classification cl + where + clde.ims_md_cl_id = cl.ims_md_cl_id + and + clde.ims_md_cl_id = :ims_md_cl_id +} Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_key.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_key.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_key.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Classification Metadata Keyword</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Classification Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Keywords: </td> + <td><listtemplate name= "d_cl_key"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Classification Metadata Keyword</h3> +<blockquote> + <formtemplate id="classificationmd_key" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_key.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_key.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_key.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,109 @@ +# packages/lorsm/www/md/classificationmd/classification_key.tcl + +ad_page_contract { + + Add/Edit Classification MD Keyword + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classification_key.tcl,v 1.1 2005/05/17 16:21:23 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_cl_id:integer + ims_md_cl_ke_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_cl_ke_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id}] "[_ lorsm.Classification_Entry]"] "[_ lorsm.Edit_Keyword_1]"] + set title "[_ lorsm.lt_Edit_Classification_M]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id}] "[_ lorsm.Classification_Entry]"] "[_ lorsm.Add_Keyword]"] + set title "[_ lorsm.lt_Add_Classification_MD_3]" +} + +# Form + +ad_form -name classificationmd_key \ + -cancel_url classification?ims_md_id=$ims_md_id&ims_md_cl_id=$ims_md_cl_id \ + -mode edit \ + -form { + + ims_md_cl_ke_id:key(ims_md_classification_keyword_seq) + + {keyword_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Classificatio_6]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {keyword_s:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Keyword_description_o]"} + {label "[_ lorsm.Keyword]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {ims_md_cl_id:text(hidden) {value $ims_md_cl_id} + } + +} -select_query {select * from ims_md_classification_keyword where ims_md_cl_ke_id = :ims_md_cl_ke_id and ims_md_cl_id = :ims_md_cl_id + +} -edit_data { + db_dml do_update " + update ims_md_classification_keyword + set keyword_l = :keyword_l, + keyword_s = :keyword_s + where ims_md_cl_ke_id = :ims_md_cl_ke_id" + +} -new_data { + db_dml do_insert " + insert into ims_md_classification_keyword (ims_md_cl_ke_id, ims_md_cl_id, keyword_l, keyword_s) + values + (:ims_md_cl_ke_id, :ims_md_cl_id, :keyword_l, :keyword_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "classification" {ims_md_cl_id ims_md_id}] + ad_script_abort +} + +# Classification Keyword +template::list::create \ + -name d_cl_key \ + -multirow d_cl_key \ + -no_data "[_ lorsm.No_Keyword_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + keyword { + label "" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "classification_key" {ims_md_cl_ke_id ims_md_cl_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_cl_key select_cl_key { + select + '[' || kw.keyword_l || '] ' || kw.keyword_s as keyword, + kw.ims_md_cl_ke_id, + cl.ims_md_cl_id, + cl.ims_md_id + from + ims_md_classification_keyword kw, + ims_md_classification cl + where + kw.ims_md_cl_id = cl.ims_md_cl_id + and + kw.ims_md_cl_id = :ims_md_cl_id +} Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_pur.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_pur.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_pur.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Classification Metadata Purpose</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Classification Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Purpose: </td> + <td><listtemplate name= "d_cl_pur"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Classification Metadata Purpose</h3> +<blockquote> + <formtemplate id="classificationmd_pur" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_pur.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_pur.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_pur.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,89 @@ +# packages/lorsm/www/md/classificationmd/classification_pur.tcl + +ad_page_contract { + + Add/Edit Classification MD Purpose + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classification_pur.tcl,v 1.1 2005/05/17 16:21:23 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_cl_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title + +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id}] "[_ lorsm.Classification_Entry]"] "[_ lorsm.AddEdit_Purpose]"] +set title "[_ lorsm.lt_Edit_Classification_M_1]" + + +# Form + +ad_form -name classificationmd_pur \ + -cancel_url classification?ims_md_id=$ims_md_id&ims_md_cl_id=$ims_md_cl_id \ + -mode edit \ + -form { + + ims_md_cl_id:key(ims_md_classification_seq) + + {purpose_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Classificatio_7]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {purpose_v:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Characteristics_of_th]"} + {label "[_ lorsm.Purpose]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_classification where ims_md_cl_id = :ims_md_cl_id + +} -edit_data { + db_dml do_update " + update ims_md_classification + set purpose_s = :purpose_s, + purpose_v = :purpose_v + where ims_md_cl_id = :ims_md_cl_id " + +} -after_submit { + ad_returnredirect [export_vars -base "classification" {ims_md_cl_id ims_md_id}] + ad_script_abort +} + +# Classification Purpose +template::list::create \ + -name d_cl_pur \ + -multirow d_cl_pur \ + -no_data "[_ lorsm.No_Purpose_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + purpose_s { + label "" + } + purpose_v { + label "" + } + } + +db_multirow d_cl_pur select_cl_pur { + select purpose_s, + purpose_v, + ims_md_cl_id, + ims_md_id + from + ims_md_classification + where + ims_md_cl_id = :ims_md_cl_id +} Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_taxon.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_taxon.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_taxon.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Classification Metadata Taxonomic Path Taxonomy</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Classification Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Keywords: </td> + <td><listtemplate name= "d_cl_taxon"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Classification Metadata Taxonomic Path Taxonomy</h3> +<blockquote> + <formtemplate id="classificationmd_taxon" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_taxon.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_taxon.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_taxon.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,124 @@ +# packages/lorsm/www/md/classificationmd/classification_taxon.tcl + +ad_page_contract { + + Add/Edit Classification MD Taxonomic Path Taxonomy + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classification_taxon.tcl,v 1.1 2005/05/17 16:21:23 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_cl_id:integer + ims_md_cl_ta_id:integer + ims_md_cl_ta_ta_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_cl_ta_ta_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id ims_md_cl_ta_id}] "[_ lorsm.Classification_Entry]"] [list [export_vars -base "classification_tpath" {ims_md_id ims_md_cl_id ims_md_cl_ta_id}] "[_ lorsm.Taxonomic_Paths_2]"] "[_ lorsm.Edit_Taxonomy]"] + set title "[_ lorsm.lt_Edit_Classification_M_2]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id ims_md_cl_ta_id}] "[_ lorsm.lt_Classification_Entry_]"] "[_ lorsm.Add_Taxonomy]"] + set title "[_ lorsm.lt_Add_Classification_MD_4]" +} + +# Form + +ad_form -name classificationmd_taxon \ + -cancel_url classification_tpath?ims_md_id=$ims_md_id&ims_md_cl_id=$ims_md_cl_id&ims_md_cl_ta_id=$ims_md_cl_ta_id \ + -mode edit \ + -form { + + ims_md_cl_ta_ta_id:key(ims_md_classification_taxpath_taxon_seq) + + {identifier:text,nospell + {section "[_ lorsm.lt_AddEdit_Classificatio_8]"} + {html {size 50}} + {help_text "[_ lorsm.lt_Taxons_identifier_in_]"} + {label "[_ lorsm.Identifier]"} + } + + {entry_l:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {entry_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Number_in_the_Catalog]"} + {label "[_ lorsm.Entry]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {ims_md_cl_id:text(hidden) {value $ims_md_cl_id} + } + + {ims_md_cl_ta_id:text(hidden) {value $ims_md_cl_ta_id} + } + +} -select_query {select * from ims_md_classification_taxpath_taxon where ims_md_cl_ta_ta_id = :ims_md_cl_ta_ta_id and ims_md_cl_ta_id = :ims_md_cl_ta_id + +} -edit_data { + db_dml do_update " + update ims_md_classification_taxpath_taxon + set identifier = :identifier, + entry_l = :entry_l, + entry_s = :entry_s + where ims_md_cl_ta_ta_id = :ims_md_cl_ta_ta_id" + +} -new_data { + db_dml do_insert " + insert into ims_md_classification_taxpath_taxon (ims_md_cl_ta_ta_id, ims_md_cl_ta_id, identifier, entry_l, entry_s) + values + (:ims_md_cl_ta_ta_id, :ims_md_cl_ta_id, :identifier, :entry_l, :entry_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "classification_tpath" {ims_md_cl_ta_id ims_md_cl_id ims_md_id}] + ad_script_abort +} + +# Classification Taxonomic Path Taxonomy +template::list::create \ + -name d_cl_taxon \ + -multirow d_cl_taxon \ + -no_data "[_ lorsm.lt_No_Taxonomies_Availab]" \ + -html { align right style "width: 100%;" } \ + -elements { + identifier { + label "[_ lorsm.ID]" + } + entry { + label "[_ lorsm.Entry_1]" + } + export { + display_eval {\[[_ lorsm.Edit_1]\]} + link_url_eval { [export_vars -base "classification_taxon" {ims_md_cl_ta_ta_id ims_md_cl_ta_id ims_md_cl_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_cl_taxon select_cl_taxon { + select ctt.identifier, + '[' || ctt.entry_l || '] ' || ctt.entry_s as entry, + ctt.ims_md_cl_ta_id, + ctt.ims_md_cl_ta_ta_id, + cl.ims_md_cl_id, + cl.ims_md_id + from + ims_md_classification_taxpath_taxon ctt, + ims_md_classification cl + where + ctt.ims_md_cl_ta_id = :ims_md_cl_ta_id + and + cl.ims_md_cl_id = :ims_md_cl_id +} Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_tpath.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_tpath.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_tpath.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,20 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">Classification Metadata Taxonomic Path</th> + </tr> + <tr class="form-section"> + <td class="form-section">Source: </td> + <td><listtemplate name= "d_cl_source"></listtemplate></td> + </tr> + <tr class="form-section"> + <td class="form-section">Taxonomies: </td> + <td><listtemplate name= "d_cl_taxon"></listtemplate></td> + </tr> + </table> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_tpath.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_tpath.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_tpath.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,65 @@ +ad_page_contract { + Displays IMS Metadata Classification Taxonomic Path Entry + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classification_tpath.tcl,v 1.1 2005/05/17 16:21:23 miguelm Exp $ + +} { + ims_md_cl_id:integer + ims_md_cl_ta_id:integer + ims_md_id:integer +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id ims_md_cl_ta_id}] "[_ lorsm.Classification_Entry]"] "[_ lorsm.Taxonomic_Paths_1]"] +set title "[_ lorsm.lt_Classification_MD_Tax]" + +# Classification Taxonomic Path Source +template::list::create \ + -name d_cl_source \ + -multirow d_cl_source \ + -no_data "[_ lorsm.No_Source_Available]" \ + -actions [list "[_ lorsm.Add_Source]" [export_vars -base classification_tsource {ims_md_cl_ta_id ims_md_cl_id ims_md_id}] "[_ lorsm.Add_another_Source]"] \ + -html { align right style "width: 100%;" } \ + -elements { + source { + label "" + } + } + +db_multirow d_cl_source select_cl_source { + select + '[' || source_l || '] ' || source_v as source + from + ims_md_classification_taxpath + where + ims_md_cl_ta_id = :ims_md_cl_ta_id + and ims_md_cl_id = :ims_md_cl_id +} + +# Classification Taxonomic Path Taxonomy +template::list::create \ + -name d_cl_taxon \ + -multirow d_cl_taxon \ + -no_data "[_ lorsm.lt_No_Taxonomies_Availab]" \ + -actions [list "[_ lorsm.Add_Taxonomy]" [export_vars -base classification_taxon {ims_md_cl_ta_id ims_md_cl_id ims_md_id}] "[_ lorsm.Add_another_Taxonomy]"] \ + -html { align right style "width: 100%;" } \ + -elements { + identifier { + label "[_ lorsm.ID]" + } + entry { + label "[_ lorsm.Entry_1]" + } + } + +db_multirow d_cl_taxon select_cl_taxon { + select identifier, + '[' || entry_l || '] ' || entry_s as entry + from + ims_md_classification_taxpath_taxon + where + ims_md_cl_ta_id = :ims_md_cl_ta_id +} Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_tsource.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_tsource.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_tsource.adp 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Classification Metadata Taxonomic Path Source</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Classification Metadata Taxonomic Path</th> + </tr> + <tr class="form-section"> + <td class="form-section">Source: </td> + <td><listtemplate name= "d_cl_tsource"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Classification Metadata Taxonomic Path Source</h3> +<blockquote> + <formtemplate id="classificationmd_tsource" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/classificationmd/classification_tsource.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/classificationmd/classification_tsource.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/classificationmd/classification_tsource.tcl 17 May 2005 16:21:23 -0000 1.1 @@ -0,0 +1,100 @@ +# packages/lorsm/www/md/classificationmd/classification_tsource.tcl + +ad_page_contract { + + Add/Edit Classification MD Taxonomic Path Source + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: classification_tsource.tcl,v 1.1 2005/05/17 16:21:23 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_cl_id:integer + ims_md_cl_ta_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title + +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../classificationmd" ims_md_id] "[_ lorsm.Classification_MD]"] [list [export_vars -base "classification" {ims_md_id ims_md_cl_id ims_md_cl_ta_id}] "[_ lorsm.Classification_Entry]"] [list [export_vars -base "classification_tpath" {ims_md_id ims_md_cl_id ims_md_cl_ta_id}] "[_ lorsm.Taxonomic_Paths_1]"] "[_ lorsm.AddEdit_Source]"] + +set title "[_ lorsm.lt_Edit_Classification_M_3]" + + +# Form + +ad_form -name classificationmd_tsource \ + -cancel_url classification_tpath?ims_md_id=$ims_md_id&ims_md_cl_id=$ims_md_cl_id&ims_md_cl_ta_id=$ims_md_cl_ta_id \ + -mode edit \ + -form { + + ims_md_cl_ta_id:key(ims_md_classification_taxpath_seq) + + {source_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Classificatio_9]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {source_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {ims_md_cl_id:text(hidden) {value $ims_md_cl_id} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_classification_taxpath where ims_md_cl_ta_id = :ims_md_cl_ta_id and ims_md_cl_id = :ims_md_cl_id + +} -edit_data { + db_dml do_update " + update ims_md_classification_taxpath + set source_l = :source_l, + source_v = :source_v + where ims_md_cl_ta_id = :ims_md_cl_ta_id" + +} -after_submit { + ad_returnredirect [export_vars -base "classification_tpath" {ims_md_cl_ta_id ims_md_cl_id ims_md_id}] + ad_script_abort +} + +# Classification Taxonomic Path Source +template::list::create \ + -name d_cl_tsource \ + -multirow d_cl_tsource \ + -no_data "[_ lorsm.lt_No_Taxonomic_Path_Sou]" \ + -html { align right style "width: 100%;" } \ + -elements { + source { + label "" + } + export { + display_eval {\[[_ lorsm.Edit_1]\]} + link_url_eval { [export_vars -base "classification_tsource" {ims_md_cl_ta_id ims_md_cl_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_cl_tsource select_cl_tsource { + select + '[' || ctp.source_l || '] ' || ctp.source_v as source, + ctp.ims_md_cl_ta_id, + ctp.ims_md_cl_id, + cl.ims_md_id + from + ims_md_classification_taxpath ctp, + ims_md_classification cl + where + ctp.ims_md_cl_ta_id = :ims_md_cl_ta_id + and cl.ims_md_cl_id = :ims_md_cl_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_cont.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_cont.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_cont.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Context</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Context: </td> + <td><listtemplate name= "d_ed_cont"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Context</h3> +<blockquote> + <formtemplate id="educationalmd_cont" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_cont.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_cont.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_cont.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,98 @@ +# packages/lorsm/www/md/educationalmd/educational_cont.tcl + +ad_page_contract { + + Add/Edit Educational MD Context + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_cont.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ed_co_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ed_co_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" im\s_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.Edit_Context]"] + set title "[_ lorsm.lt_Edit_Educational_MD_C]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" im\s_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.Add_Context]"] + set title "[_ lorsm.lt_Add_Educational_MD_Co]" +} + +# Form + +ad_form -name educationalmd_cont \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ed_co_id:key(ims_md_educational_context_seq) + + {context_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_11]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {context_v:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Learning_environment_]"} + {label "[_ lorsm.Context]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_educational_context where ims_md_ed_co_id = :ims_md_ed_co_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_educational_context + set context_s = :context_s, + context_v = :context_v + where ims_md_ed_co_id = :ims_md_ed_co_id " +} -new_data { + db_dml do_insert " + insert into ims_md_educational_context (ims_md_ed_co_id, ims_md_id, context_s, context_v) + values (:ims_md_ed_co_id, :ims_md_id, :context_s, :context_v)" +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Context +template::list::create \ + -name d_ed_cont \ + -multirow d_ed_cont \ + -no_data "[_ lorsm.No_Context_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + context { + label "[_ lorsm.Context_1]" + } + export { + display_eval {\[[_ lorsm.Edit_1]\]} + link_url_eval { [export_vars -base "educational_cont" {ims_md_ed_co_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_ed_cont select_ed_cont { + select + '[' || context_s || '] ' || context_v as context, + ims_md_ed_co_id, + ims_md_id + from + ims_md_educational_context + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_desc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_desc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_desc.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Description</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Description: </td> + <td><listtemplate name= "d_ed_desc"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Description</h3> +<blockquote> + <formtemplate id="educationalmd_desc" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_desc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_desc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_desc.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,98 @@ +# packages/lorsm/www/md/educationalmd/educational_desc.tcl + +ad_page_contract { + + Add/Edit Educational MD Description + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_desc.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ed_de_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ed_de_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.Edit_Description]"] + set title "[_ lorsm.lt_Edit_Educational_MD_D]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.Add_Description]"] + set title "[_ lorsm.lt_Add_Educational_MD_De]" +} + +# Form + +ad_form -name educationalmd_desc \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ed_de_id:key(ims_md_educational_descrip_seq) + + {descrip_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_12]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {descrip_s:text(textarea),nospell + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_How_the_learning_obje]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_educational_descrip where ims_md_ed_de_id = :ims_md_ed_de_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_educational_descrip + set descrip_l = :descrip_l, + descrip_s = :descrip_s + where ims_md_ed_de_id = :ims_md_ed_de_id " +} -new_data { + db_dml do_insert " + insert into ims_md_educational_descrip (ims_md_ed_de_id, ims_md_id, descrip_l, descrip_s) + values (:ims_md_ed_de_id, :ims_md_id, :descrip_l, :descrip_s)" +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Description +template::list::create \ + -name d_ed_desc \ + -multirow d_ed_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -html { align right style "width: 100%;" } \ + -elements { + desc { + label "[_ lorsm.Description_1]" + } + export { + display_eval {\[[_ lorsm.Edit_1]\]} + link_url_eval { [export_vars -base "educational_desc" {ims_md_ed_de_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_ed_desc select_ed_desc { + select + '[' || descrip_l || '] ' || descrip_s as desc, + ims_md_ed_de_id, + ims_md_id + from + ims_md_educational_descrip + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_dif.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_dif.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_dif.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Difficulty</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Difficulty: </td> + <td><listtemplate name= "d_ed_dif"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Difficulty</h3> +<blockquote> + <formtemplate id="educationalmd_dif" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_dif.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_dif.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_dif.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,88 @@ +# packages/lorsm/www/md/educationalmd/educational_dif.tcl + +ad_page_contract { + + Add/Edit Educational MD Difficulty + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_dif.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.AddEdit_Difficulty]"] +set title "[_ lorsm.lt_AddEdit_Educational_M_13]" + +# Form + +ad_form -name educationalmd_dif \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {difficulty_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_13]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {difficulty_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Level_of_difficulty_i]"} + {label "[_ lorsm.Difficulty]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the educational difficulty details already exist... + + if {[db_0or1row select_size {select ims_md_id from ims_md_educational where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_educational + set difficulty_s = :difficulty_s, difficulty_v = :difficulty_v + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_educational (ims_md_id, difficulty_s, difficulty_v) + values + (:ims_md_id, :difficulty_s, :difficulty_v) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Difficulty +template::list::create \ + -name d_ed_dif \ + -multirow d_ed_dif \ + -no_data "[_ lorsm.lt_No_Difficulty_Type_Av]" \ + -html { align right style "width: 100%;" } \ + -elements { + diff { + label "[_ lorsm.Difficulty_1]" + } + } + +db_multirow d_ed_dif select_ed_dif { + select + '[' || difficulty_s || '] ' || difficulty_v as diff, + ims_md_id + from + ims_md_educational + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_ieur.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_ieur.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_ieur.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Intended End User Role</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Intended End User Role: </td> + <td><listtemplate name= "d_ed_ieur"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Intended End User Role</h3> +<blockquote> + <formtemplate id="educationalmd_ieur" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_ieur.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_ieur.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_ieur.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,98 @@ +# packages/lorsm/www/md/educationalmd/educational_ieur.tcl + +ad_page_contract { + + Add/Edit Educational MD Intended End User Role + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_ieur.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ed_ie_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ed_ie_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_Edit_Intended_End_Use]"] + set title "[_ lorsm.lt_Edit_Educational_MD_I]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_Add_Intended_End_User]"] + set title "[_ lorsm.lt_Add_Educational_MD_In]" +} + +# Form + +ad_form -name educationalmd_ieur \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ed_ie_id:key(ims_md_educational_ieur_seq) + + {ieur_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_14]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {ieur_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Normal_user_of_the_le]"} + {label "[_ lorsm.lt_Intended_End_User_Rol]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_educational_ieur where ims_md_ed_ie_id = :ims_md_ed_ie_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_educational_ieur + set ieur_s = :ieur_s, + ieur_v = :ieur_v + where ims_md_ed_ie_id = :ims_md_ed_ie_id" +} -new_data { + db_dml do_insert " + insert into ims_md_educational_ieur (ims_md_ed_ie_id, ims_md_id, ieur_s, ieur_v) + values (:ims_md_ed_ie_id, :ims_md_id, :ieur_s, :ieur_v)" +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Intended End User Role +template::list::create \ + -name d_ed_ieur \ + -multirow d_ed_ieur \ + -no_data "[_ lorsm.lt_No_Intended_End_User_]" \ + -html { align right style "width: 100%;" } \ + -elements { + ieur { + label "[_ lorsm.lt_Intended_End_User_Rol_1]" + } + export { + display_eval {\[[_ lorsm.Edit_1]\]} + link_url_eval { [export_vars -base "educational_ieur" {ims_md_ed_ie_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_ed_ieur select_ed_ieur { + select + '[' || ieur_s || '] ' || ieur_v as ieur, + ims_md_ed_ie_id, + ims_md_id + from + ims_md_educational_ieur + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_intl.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_intl.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_intl.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Interactivity Level</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Interactivity Level: </td> + <td><listtemplate name= "d_ed_intl"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Interactivity Level</h3> +<blockquote> + <formtemplate id="educationalmd_intl" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_intl.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_intl.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_intl.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,88 @@ +# packages/lorsm/www/md/educationalmd/educational_intl.tcl + +ad_page_contract { + + Add/Edit Educational MD Interactivity Level + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_intl.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" \im\\\s_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_AddEdit_Interactivity]"] + +set title "[_ lorsm.lt_Edit_Educational_MD_I_1]" + +# Form + +ad_form -name educationalmd_intl \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {int_level_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_15]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {int_level_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Level_of_interactivit]"} + {label "[_ lorsm.Interactivity_Level]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the ED Interactivity Level already exist... + + if {[db_0or1row select_size {select ims_md_id from ims_md_educational where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_educational + set int_level_s = :int_level_s, int_level_v = :int_level_v + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_educational (ims_md_id, int_level_s, int_level_v) + values + (:ims_md_id, :int_level_s, :int_level_v) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Interactivity Level +template::list::create \ + -name d_ed_intl \ + -multirow d_ed_intl \ + -no_data "[_ lorsm.lt_No_Interactivity_Leve]" \ + -html { align right style "width: 100%;" } \ + -elements { + intl { + label "[_ lorsm.Interactivity_Level_1]" + } + } + +db_multirow d_ed_intl select_ed_intl { + select + '[' || int_level_s || '] ' || int_level_v as intl, + ims_md_id + from + ims_md_educational + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_intt.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_intt.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_intt.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Interactivity Type</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Interactivity Type: </td> + <td><listtemplate name= "d_ed_intt"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Interactivity Type</h3> +<blockquote> + <formtemplate id="educationalmd_intt" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_intt.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_intt.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_intt.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,87 @@ +# packages/lorsm/www/md/educationalmd/educational_intt.tcl + +ad_page_contract { + + Add/Edit Educational MD Interactivity Type + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_intt.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_AddEdit_Interactivity]"] +set title "[_ lorsm.lt_AddEdit_Educational_M_16]" + +# Form + +ad_form -name educationalmd_intt \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {int_type_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_16]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {int_type_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Type_of_interactivity]"} + {label "[_ lorsm.Interactivity_Type]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the ED interactivity type details already exist... + + if {[db_0or1row select_type {select ims_md_id from ims_md_educational where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_educational + set int_type_s = :int_type_s, int_type_v = :int_type_v + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_educational (ims_md_id, int_type_s, int_type_v) + values + (:ims_md_id, :int_type_s, :int_type_v) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Interactivity Type +template::list::create \ + -name d_ed_intt \ + -multirow d_ed_intt \ + -no_data "[_ lorsm.lt_No_Interactivity_Type]" \ + -html { align right style "width: 100%;" } \ + -elements { + intt { + label "[_ lorsm.Interactivity_Type_1]" + } + } + +db_multirow d_ed_intt select_ed_intt { + select + '[' || int_type_s || '] ' || int_type_v as intt, + ims_md_id + from + ims_md_educational + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_lang.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_lang.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_lang.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Language</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Language: </td> + <td><listtemplate name= "d_ed_lang"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Language</h3> +<blockquote> + <formtemplate id="educationalmd_lang" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_lang.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_lang.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_lang.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,91 @@ +# packages/lorsm/www/md/educationalmd/educational_lang.tcl + +ad_page_contract { + + Add/Edit Educational MD Language + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_lang.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ed_la_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ed_la_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.Edit_Language]"] + set title "[_ lorsm.lt_Edit_Educational_MD_L]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.Add_Language]"] + set title "[_ lorsm.lt_Add_Educational_MD_La]" +} + +# Form + +ad_form -name educationalmd_lang \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ed_la_id:key(ims_md_educational_lang_seq) + + {language:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_17]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_educational_lang where ims_md_ed_la_id = :ims_md_ed_la_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_educational_lang + set language = :language + where ims_md_ed_la_id = :ims_md_ed_la_id " +} -new_data { + db_dml do_insert " + insert into ims_md_educational_lang (ims_md_ed_la_id, ims_md_id, language) + values (:ims_md_ed_la_id, :ims_md_id, :language)" +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Language +template::list::create \ + -name d_ed_lang \ + -multirow d_ed_lang \ + -no_data "[_ lorsm.lt_No_Language_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + language { + label "[_ lorsm.Language_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "educational_lang" {ims_md_ed_la_id ims_md_id}] } +q link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_ed_lang select_ed_lang { + select + language, + ims_md_ed_la_id, + ims_md_id + from + ims_md_educational_lang + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_lrt.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_lrt.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_lrt.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Learning Resource Type</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Learning Resource Type: </td> + <td><listtemplate name= "d_ed_lrt"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Learning Resource Type</h3> +<blockquote> + <formtemplate id="educationalmd_lrt" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_lrt.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_lrt.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_lrt.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,96 @@ +# packages/lorsm/www/md/educationalmd/educational_lrt.tcl + +ad_page_contract { + + Add/Edit Educational MD Learning Resource Type + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @creation-date 16 October 2004 + +} { + ims_md_id:integer + ims_md_ed_lr_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ed_lr_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" \i\m\\\s_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_Edit_Learning_Resourc]"] + set title "[_ lorsm.lt_Edit_Educational_MD_L_1]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor] "] [list [export_vars -base "../educationalmd" \i\m\\\s_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_Add_Learning_Resource]"] + set title "[_ lorsm.lt_Add_Educational_MD_Le]" +} + +# Form + +ad_form -name educationalmd_lrt \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ed_lr_id:key(ims_md_educational_lrt_seq) + + {lrt_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_18]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {lrt_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Type_of_interactivity]"} + {label "[_ lorsm.lt_Learning_Resource_Typ]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_educational_lrt where ims_md_ed_lr_id = :ims_md_ed_lr_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_educational_lrt + set lrt_s = :lrt_s, + lrt_v = :lrt_v + where ims_md_ed_lr_id = :ims_md_ed_lr_id " +} -new_data { + db_dml do_insert " + insert into ims_md_educational_lrt (ims_md_ed_lr_id, ims_md_id, lrt_s, lrt_v) + values (:ims_md_ed_lr_id, :ims_md_id, :lrt_s, :lrt_v)" +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Learning Resource Type +template::list::create \ + -name d_ed_lrt \ + -multirow d_ed_lrt \ + -no_data "[_ lorsm.lt_No_Learning_Resource_]" \ + -html { align right style "width: 100%;" } \ + -elements { + lrt { + label "" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "educational_lrt" {ims_md_ed_lr_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_ed_lrt select_ed_lrt { + select + '[' || lrt_s || '] ' || lrt_v as lrt, + ims_md_ed_lr_id, + ims_md_id + from + ims_md_educational_lrt + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_semd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_semd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_semd.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Semantic Density</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Semantic Density:</td> + <td><listtemplate name= "d_ed_semd"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Semantic Density</h3> +<blockquote> + <formtemplate id="educationalmd_semd" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_semd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_semd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_semd.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,89 @@ +# packages/lorsm/www/md/educationalmd/educational_semd.tcl + +ad_page_contract { + + Add/Edit Educational MD Semantic Density + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_semd.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title + +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_AddEdit_Semantic_Dens]"] +set title "[_ lorsm.lt_Edit_Educational_MD_S]" + +# Form + +ad_form -name educationalmd_semd \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {sem_density_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_19]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {sem_density_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Learning_objects_usef]"} + {label "[_ lorsm.Semantic_Density]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the ED Semantic Density already exist... + + if {[db_0or1row select_size {select ims_md_id from ims_md_educational where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_educational + set sem_density_s = :sem_density_s, + sem_density_v = :sem_density_v + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_educational (ims_md_id, sem_density_s, sem_density_v) + values + (:ims_md_id, :sem_density_s, :sem_density_v) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Semantic Density +template::list::create \ + -name d_ed_semd \ + -multirow d_ed_semd \ + -no_data "[_ lorsm.lt_No_Semantic_Density_A]" \ + -html { align right style "width: 100%;" } \ + -elements { + semd { + label "[_ lorsm.Semantic_Density_1]" + } + } + +db_multirow d_ed_semd select_ed_semd { + select + '[' || sem_density_s || '] ' || sem_density_v as semd, + ims_md_id + from + ims_md_educational + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_tar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_tar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_tar.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Typical Age Range</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Typical Age Range: </td> + <td><listtemplate name= "d_ed_tar"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Typical Age Range</h3> +<blockquote> + <formtemplate id="educationalmd_tar" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_tar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_tar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_tar.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,98 @@ +# packages/lorsm/www/md/educationalmd/educational_tar.tcl + +ad_page_contract { + + Add/Edit Educational MD Typical Age Range + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_tar.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ed_ta_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ed_ta_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_Edit_Typical_Age_Rang]"] + set title "[_ lorsm.lt_Edit_Educational_MD_T]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.Add_Typical_Age_Rang]"] + set title "[_ lorsm.lt_Add_Educational_MD_Ty]" +} + +# Form + +ad_form -name educationalmd_tar \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ed_ta_id:key(ims_md_educational_tar_seq) + + {tar_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Educational_M_20]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {tar_s:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Age_of_the_typical_in]"} + {label "[_ lorsm.Typical_Age_Range]" } + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_educational_tar where ims_md_ed_ta_id = :ims_md_ed_ta_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_educational_tar + set tar_l = :tar_l, + tar_s = :tar_s + where ims_md_ed_ta_id = :ims_md_ed_ta_id " +} -new_data { + db_dml do_insert " + insert into ims_md_educational_tar (ims_md_ed_ta_id, ims_md_id, tar_l, tar_s) + values (:ims_md_ed_ta_id, :ims_md_id, :tar_l, :tar_s)" +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Typical Age Range +template::list::create \ + -name d_ed_tar \ + -multirow d_ed_tar \ + -no_data "[_ lorsm.lt_No_Typical_Age_Range_]" \ + -html { align right style "width: 100%;" } \ + -elements { + tar { + label "[_ lorsm.Typical_Age_Range_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "educational_tar" {ims_md_ed_ta_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_ed_tar select_ed_tar { + select + '[' || tar_l || '] ' || tar_s as tar, + ims_md_ed_ta_id, + ims_md_id + from + ims_md_educational_tar + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_tlt.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_tlt.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_tlt.adp 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Educational Metadata Typical Learning Time</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Educational Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Typical Learning Time: </td> + <td><listtemplate name= "d_ed_tlt"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Educational Metadata Typical Learning Time</h3> +<blockquote> + <formtemplate id="educationalmd_tlt" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/educationalmd/educational_tlt.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/educationalmd/educational_tlt.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/educationalmd/educational_tlt.tcl 17 May 2005 16:21:24 -0000 1.1 @@ -0,0 +1,99 @@ +# packages/lorsm/www/md/educationalmd/educational_tlt.tcl + +ad_page_contract { + + Add/Edit Educational MD Typical Learning Time + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: educational_tlt.tcl,v 1.1 2005/05/17 16:21:24 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../educationalmd" ims_md_id] "[_ lorsm.Educational_MD]"] "[_ lorsm.lt_AddEdit_Typical_Learn]"] +set title "[_ lorsm.lt_Edit_Educational_MD_T_1]" + +# Form + +ad_form -name educationalmd_tlt \ + -cancel_url ../educationalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {type_lrn_time_l:text,nospell,optional + {section "[_ lorsm.lt_AddEdit_Educational_M_21]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {type_lrn_time_s:text(textarea),nospell,optional + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_Brief_Description_Req]"} + {label "[_ lorsm.Description]"} + } + + {type_lrn_time:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Amount_of_time_it_tak]"} + {label "[_ lorsm.lt_Typical_Learning_Time]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the educational typical learning time details already exist... + + if {[db_0or1row select_size {select ims_md_id from ims_md_educational where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_educational + set type_lrn_time_s = :type_lrn_time_s, + type_lrn_time_l = :type_lrn_time_l, + type_lrn_time = :type_lrn_time + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_educational (ims_md_id, type_lrn_time_s, type_lrn_time_l, type_lrn_time) + values + (:ims_md_id, :type_lrn_time_s, :type_lrn_time_l, :type_lrn_time) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../educationalmd" {ims_md_id}] + ad_script_abort +} + +# Educational Typical Learning Time +template::list::create \ + -name d_ed_tlt \ + -multirow d_ed_tlt \ + -no_data "[_ lorsm.lt_No_Typical_Learning_T]" \ + -html { align right style "width: 100%;" } \ + -elements { + tlt { + label "[_ lorsm.lt_Typical_Learning_Time_1]" + } + tlt_ls { + label "[_ lorsm.Language_1]" + } + } + +db_multirow d_ed_tlt select_ed_tlt { + select + type_lrn_time as tlt, + '[' || type_lrn_time_l || '] ' || type_lrn_time_s as tlt_ls, + ims_md_id + from + ims_md_educational + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/form-md-record/md-record.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/form-md-record/md-record.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/form-md-record/md-record.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1 @@ +<listtemplate name="d_pres"></listtemplate> \ No newline at end of file Index: openacs-4/packages/lors-central/www/md/form-md-record/md-record.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/form-md-record/md-record.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/form-md-record/md-record.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,33 @@ +set actions [list] + +lappend actions "[_ lorsm.General_MD]" [export_vars -base ../generalmd {ims_md_id}] "[_ lorsm.lt_View_General_Metadata]" +lappend actions "[_ lorsm.Lifecycle_MD]" [export_vars -base ../lifecyclemd {ims_md_id}] "[_ lorsm.lt_View_Lifecycle_Metada]" +lappend actions "[_ lorsm.Meta_MD]" [export_vars -base ../metamd {ims_md_id}] "[_ lorsm.View_Meta_Metadata]" +lappend actions "[_ lorsm.Technical_MD]" [export_vars -base ../technicalmd {ims_md_id}] "[_ lorsm.lt_View_Technical_Metada]" +lappend actions "[_ lorsm.Educational_MD]" [export_vars -base ../educationalmd {ims_md_id}] "[_ lorsm.lt_View_Educational_Meta]" +lappend actions "[_ lorsm.Rights_MD]" [export_vars -base ../rightsmd {ims_md_id}] "[_ lorsm.View_Rights_Metadata]" +lappend actions "[_ lorsm.Relation_MD]" [export_vars -base ../relationmd {ims_md_id}] "[_ lorsm.lt_View_Relation_Metadat]" +lappend actions "[_ lorsm.Annotation_MD]" [export_vars -base ../annotationmd {ims_md_id}] "[_ lorsm.lt_View_Annotation_Metad]" +lappend actions "[_ lorsm.Classification_MD]" [export_vars -base ../classificationmd {ims_md_id}] "[_ lorsm.lt_View_Classification_M_1]" + + +# Presentation +template::list::create \ + -name d_pres \ + -multirow d_pres \ + -no_data "-" \ + -actions $actions \ + -elements { + object_type { + label "[_ lorsm.Object_Type]" + } + } + +db_multirow d_pres select_ge_titles { + select + object_type + from + acs_objects + where + object_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/generalmd/general_aggl.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_aggl.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_aggl.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>General Metadata Aggregation Level</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Aggregation Level: </td> + <td><listtemplate name= "d_gen_aggl"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Aggregation Level</h3> +<blockquote> + <formtemplate id="generalmd_aggl" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/generalmd/general_aggl.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_aggl.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_aggl.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,101 @@ +# packages/lorsm/www/md/generalmd/general_aggl.tcl + +ad_page_contract { + + Add/Edit General MD Aggregation Level + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: general_aggl.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\\\\\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.lt_Edit_Aggregation_Leve]"] +set title "[_ lorsm.lt_Edit_General_MD_Aggre]" + +# Form + +ad_form -name generalmd_aggl \ + -cancel_url ../generalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + + + {agg_level_v:text,nospell + {section "[_ lorsm.lt_AddEdit_General_MD_Ag]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Functional_size_of_th]"} + {label "[_ lorsm.Aggregation_Level]"} + } + + {agg_level_s:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the aggregation level already exist.. + + if {[db_0or1row select_aggregation_level {select ims_md_id from ims_md_general where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_general + set agg_level_v = :agg_level_v, agg_level_s = :agg_level_s + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_general (ims_md_id, agg_level_v, agg_level_s) + values + (:ims_md_id, :agg_level_v, :agg_level_s)" + + } + +} -after_submit { + ad_returnredirect [export_vars -base "../generalmd" {ims_md_id}] + ad_script_abort +} + +# General Aggregation Level +template::list::create \ + -name d_gen_aggl \ + -multirow d_gen_aggl \ + -no_data "[_ lorsm.lt_No_Aggregation_Level__1]" \ + -html { align right style "width: 100%;" } \ + -elements { + agg_level_s { + label "[_ lorsm.Source_1]" + } + agg_level_v { + label "[_ lorsm.Value]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "general_aggl" {ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record] "} + html { align center } + } + } + +db_multirow d_gen_aggl select_ge_aggl { + select agg_level_s, + agg_level_v, + ims_md_id + from + ims_md_general + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/generalmd/general_cata.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_cata.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_cata.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of General Metadata Catalog-Entries</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Catalog-Entries: </td> + <td><listtemplate name= "d_gen_cata"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Catalog-Entry</h3> +<blockquote> + <formtemplate id="generalmd_cata" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/generalmd/general_cata.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_cata.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_cata.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,113 @@ +# packages/lorsm/www/md/generalmd/general_cata.tcl + +ad_page_contract { + + Add/Edit General MD Catalog-Entry + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: general_cata.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_cata_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_cata_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Edit_Catalog-Entry]"] + set title "[_ lorsm.lt_Edit_General_MD_Catal]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Add_Catalog-Entry]"] + set title "[_ lorsm.lt_Add_General_MD_Catalo]" +} + +# Form + +ad_form -name generalmd_cata \ + -cancel_url ../generalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_cata_id:key(ims_md_general_cata_seq) + + {catalog:text,nospell + {section "[_ lorsm.lt_AddEdit_General_MD_Ca]"} + {html {size 50}} + {help_text "[_ lorsm.Name_of_the_catalog]"} + {label "[_ lorsm.Catalog]"} + } + + {entry_l:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {entry_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Number_in_the_Catalog]"} + {label "[_ lorsm.Entry]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_cata where ims_md_ge_cata_id = :ims_md_ge_cata_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_cata + set catalog = :catalog, entry_l = :entry_l, entry_s = :entry_s + where ims_md_ge_cata_id = :ims_md_ge_cata_id" +} -new_data { + db_dml do_insert " + insert into ims_md_general_cata (ims_md_ge_cata_id, ims_md_id, catalog, entry_l, entry_s) + values + (:ims_md_ge_cata_id, :ims_md_id, :catalog, :entry_l, :entry_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "../generalmd" {ims_md_id}] + ad_script_abort +} + +# General Catalog-entry +template::list::create \ + -name d_gen_cata \ + -multirow d_gen_cata \ + -no_data "[_ lorsm.lt_No_Catalog_Entry_Avai]" \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "[_ lorsm.Catalog_1]" + } + entry_l { + label "[_ lorsm.Language_1]" + } + entry_s { + label "[_ lorsm.Entry_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "general_cata" {ims_md_ge_cata_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_gen_cata select_ge_cata { + select catalog, + entry_l, + entry_s, + ims_md_ge_cata_id, + ims_md_id + from + ims_md_general_cata + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/generalmd/general_cover.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_cover.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_cover.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of General Metadata Coverages</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Coverage: </td> + <td><listtemplate name= "d_gen_cover"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Coverage</h3> +<blockquote> + <formtemplate id="generalmd_cover" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/generalmd/general_cover.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_cover.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_cover.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,102 @@ +# packages/lorsm/www/md/generalmd/general_cover.tcl + +ad_page_contract { + + Add/Edit General MD Coverage + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: general_cover.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_cove_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_cove_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\\\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Edit_Coverage]"] + set title "[_ lorsm.lt_Edit_General_MD_Cover]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\\\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Add_Coverage]"] + set title "[_ lorsm.lt_Add_General_MD_Covera]" +} + +# Form + +ad_form -name generalmd_cover \ + -cancel_url ../generalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_cove_id:key(ims_md_general_cover_seq) + + {cover_l:text,nospell,optional + {section "[_ lorsm.lt_AddEdit_General_MD_Co]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {cover_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Temporalspatial_chara]"} + {label "[_ lorsm.Coverage]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_cover where ims_md_ge_cove_id = :ims_md_ge_cove_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_cover + set cover_l = :cover_l, cover_s = :cover_s + where ims_md_ge_cove_id = :ims_md_ge_cove_id " +} -new_data { + db_dml do_insert " + insert into ims_md_general_cover (ims_md_ge_cove_id, ims_md_id, cover_l, cover_s) + values + (:ims_md_ge_cove_id, :ims_md_id, :cover_l, :cover_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "../generalmd" {ims_md_id}] + ad_script_abort +} + +# General Coverage +template::list::create \ + -name d_gen_cover \ + -multirow d_gen_cover \ + -no_data "[_ lorsm.lt_No_Coverage_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + cover_l { + label "[_ lorsm.Language_1]" + } + cover_s { + label "[_ lorsm.Coverage_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "general_cover" {ims_md_ge_cove_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_gen_cover select_ge_cover { + select cover_l, + cover_s, + ims_md_ge_cove_id, + ims_md_id + from + ims_md_general_cover + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/generalmd/general_desc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_desc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_desc.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of General Metadata Descriptions</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Descriptions: </td> + <td><listtemplate name= "d_gen_desc"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Description</h3> +<blockquote> + <formtemplate id="generalmd_desc" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/generalmd/general_desc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_desc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_desc.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,102 @@ +# packages/lorsm/www/md/generalmd/general_desc.tcl + +ad_page_contract { + + Add/Edit General MD Description + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: general_desc.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_desc_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_desc_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" ims_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Edit_Description]"] + set title "[_ lorsm.lt_Edit_General_MD_Descr]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" ims_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Add_Description]"] + set title "[_ lorsm.lt_Add_General_MD_Descri]" +} + +# Form + +ad_form -name generalmd_desc \ + -cancel_url ../generalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_desc_id:key(ims_md_general_desc_seq) + + {descrip_l:text,nospell,optional + {section "[_ lorsm.lt_AddEdit_General_MD_De]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {descrip_s:text(textarea),nospell + {html {rows 5 cols 50}} + {help_text "[_ lorsm.lt_Describes_learning_ob]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_desc where ims_md_ge_desc_id = :ims_md_ge_desc_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_desc + set descrip_l = :descrip_l, descrip_s = :descrip_s + where ims_md_ge_desc_id = :ims_md_ge_desc_id " +} -new_data { + db_dml do_insert " + insert into ims_md_general_desc (ims_md_ge_desc_id, ims_md_id, descrip_l, descrip_s) + values + (:ims_md_ge_desc_id, :ims_md_id, :descrip_l, :descrip_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "../generalmd" {ims_md_id}] + ad_script_abort +} + +# General Language +template::list::create \ + -name d_gen_desc \ + -multirow d_gen_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -html { align right style "width: 100%;" } \ + -elements { + descrip_l { + label "[_ lorsm.Language_1]" + } + descrip_s { + label "[_ lorsm.Description_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "general_desc" {ims_md_ge_desc_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record] "} + html { align center } + } + } + +db_multirow d_gen_desc select_ge_desc { + select descrip_l, + descrip_s, + ims_md_ge_desc_id, + ims_md_id + from + ims_md_general_desc + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/generalmd/general_key.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_key.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_key.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of General Metadata Keywords</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Keywords: </td> + <td><listtemplate name= "d_gen_key"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Keyword</h3> +<blockquote> + <formtemplate id="generalmd_key" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/generalmd/general_key.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_key.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_key.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,103 @@ +# packages/lorsm/www/md/generalmd/general_key.tcl + +ad_page_contract { + + Add/Edit General MD Keyword + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: general_key.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_key_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_key_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\\\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Edit_Keyword_1]"] + set title "[_ lorsm.lt_Edit_General_MD_Keywo]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]" ] [list [export_vars -base "../generalmd" im\\\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Add_Keyword]"] + set title "[_ lorsm.lt_Add_General_MD_Keywor]" +} + +# Form + +ad_form -name generalmd_key \ + -cancel_url ../generalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_key_id:key(ims_md_general_key_seq) + + {keyword_l:text,nospell,optional + {section "[_ lorsm.lt_AddEdit_General_MD_Ke]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {keyword_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Keyword_description_o]"} + {label "[_ lorsm.Keyword]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_key where ims_md_ge_key_id = :ims_md_ge_key_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_key + set keyword_l = :keyword_l, keyword_s = :keyword_s + where ims_md_ge_key_id = :ims_md_ge_key_id " +} -new_data { + db_dml do_insert " + insert into ims_md_general_key (ims_md_ge_key_id, ims_md_id, keyword_l, keyword_s) + values + (:ims_md_ge_key_id, :ims_md_id, :keyword_l, :keyword_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "../generalmd" {ims_md_id}] + ad_script_abort +} + +# General Keyword +template::list::create \ + -name d_gen_key \ + -multirow d_gen_key \ + -no_data "[_ lorsm.lt_No_Keywords_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + keyword_l { + label "" + } + keyword_s { + label "" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "general_key" {ims_md_ge_key_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_gen_key select_ge_key { + select keyword_l, + keyword_s, + ims_md_ge_key_id, + ims_md_id + from + ims_md_general_key + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/generalmd/general_lang.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_lang.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_lang.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of General Metadata Languages</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Languages: </td> + <td><listtemplate name= "d_gen_lang"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Language</h3> +<blockquote> + <formtemplate id="generalmd_lang" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/generalmd/general_lang.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_lang.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_lang.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,92 @@ +# packages/lorsm/www/md/generalmd/general_lang.tcl + +ad_page_contract { + + Add/Edit General MD Language + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: general_lang.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_lang_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_lang_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Edit_Language]"] + set title "[_ lorsm.lt_Edit_General_MD_Langu]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Add_Language]"] + set title "[_ lorsm.lt_Add_General_MD_Langua]" +} + +# Form + +ad_form -name generalmd_lang \ + -cancel_url ../generalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_lang_id:key(ims_md_general_lang_seq) + + {language:text,nospell + {section "[_ lorsm.lt_AddEdit_General_MD_La]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_lang where ims_md_ge_lang_id = :ims_md_ge_lang_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_lang + set language = :language + where ims_md_ge_lang_id = :ims_md_ge_lang_id " +} -new_data { + db_dml do_insert " + insert into ims_md_general_lang (ims_md_ge_lang_id, ims_md_id, language) + values + (:ims_md_ge_lang_id, :ims_md_id, :language)" + +} -after_submit { + ad_returnredirect [export_vars -base "../generalmd" {ims_md_id}] + ad_script_abort +} + +# General Language +template::list::create \ + -name d_gen_lang \ + -multirow d_gen_lang \ + -no_data "[_ lorsm.lt_No_Language_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + language { + label "[_ lorsm.Language_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "general_lang" {ims_md_ge_lang_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_gen_lang select_ge_lang { + select language, + ims_md_ge_lang_id, + ims_md_id + from + ims_md_general_lang + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/generalmd/general_struc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_struc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_struc.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>General Metadata Structure</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Structure: </td> + <td><listtemplate name= "d_gen_struc"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Structure</h3> +<blockquote> + <formtemplate id="generalmd_struc" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/generalmd/general_struc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_struc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_struc.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,95 @@ +# packages/lorsm/www/md/generalmd/general_struc.tcl + +ad_page_contract { + + Add/Edit General MD Structure + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: general_struc.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title + +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" im\\\\s_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Edit_Structure]"] +set title "[_ lorsm.lt_Edit_General_MD_Struc]" + +# Form + +ad_form -name generalmd_struc \ + -cancel_url [export_vars -base "../generalmd" ims_md_id] \ + -mode edit \ + -form { + + {structure_v:text + {section "[_ lorsm.lt_AddEdit_General_MD_St]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Organizational_struct]"} + {label "[_ lorsm.Structure]"} + } + + {structure_s:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the structure details already exist... + + if {[db_0or1row select_structure {select ims_md_id from ims_md_general where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_general + set structure_v = :structure_v, structure_s = :structure_s + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_general (ims_md_id, structure_v, structure_s) + values + (:ims_md_id, :structure_v, :structure_s)" + + } + +} -after_submit { + ad_returnredirect [export_vars -base "../generalmd" {ims_md_id}] + ad_script_abort +} + +# General Structure +template::list::create \ + -name d_gen_struc \ + -multirow d_gen_struc \ + -no_data "[_ lorsm.lt_No_Structure_Availabl]" \ + -html { align right style "width: 100%;" } \ + -elements { + structure_s { + label "[_ lorsm.Source_1]" + html {align center} + } + structure_v { + label "[_ lorsm.Value]" + html {align center} + } + } + +db_multirow d_gen_struc select_ge_struc { + select structure_s, + structure_v, + ims_md_id + from + ims_md_general + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/generalmd/general_title.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_title.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_title.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of General Metadata Titles</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Titles: </td> + <td><listtemplate name= "d_gen_titles"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Title</h3> +<blockquote> + <formtemplate id="generalmd_title" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/generalmd/general_title.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/generalmd/general_title.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/generalmd/general_title.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,105 @@ +# packages/lorsm/www/md/generalmd/general_title.tcl + +ad_page_contract { + + Add/Edit General MD Title + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2004-05-03 + @arch-tag 1956d02e-511a-470c-81d0-c2857242651c + @cvs-id $Id: general_title.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ +} { + ims_md_id:integer + ims_md_ge_ti_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_ti_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" ims_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Edit_Titles]"] + set title "[_ lorsm.lt_Edit_General_MD_Title]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../generalmd" ims_md_id] "[_ lorsm.General_MD]"] "[_ lorsm.Add_Titles]"] +# set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] "[_ lorsm.General_MD]"] + set title "[_ lorsm.Add_General_MD_Title]" +} + +# Form + +ad_form -name generalmd_title \ + -cancel_url [export_vars -base "../generalmd" ims_md_id] \ + -mode edit \ + -form { + + ims_md_ge_ti_id:key(ims_md_general_title_seq) + + {title_l:text,nospell,optional + {section "[_ lorsm.lt_AddEdit_General_MD_Ti]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {title_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Learning_objects_name]"} + {label "[_ lorsm.Title]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_title where ims_md_ge_ti_id = :ims_md_ge_ti_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_title + set title_l = :title_l, title_s = :title_s + where ims_md_ge_ti_id = :ims_md_ge_ti_id " +} -new_data { + db_dml do_insert " + insert into ims_md_general_title (ims_md_ge_ti_id, ims_md_id, title_l, title_s) + values + (:ims_md_ge_ti_id, :ims_md_id, :title_l, :title_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "../generalmd" {ims_md_id}] + ad_script_abort +} + +# General Title +template::list::create \ + -name d_gen_titles \ + -multirow d_gen_titles \ + -no_data "[_ lorsm.No_Titles_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + title_l { + label "[_ lorsm.Language_1]" + } + title_s { + label "[_ lorsm.Titles_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "general_title" {ims_md_ge_ti_id ims_md_id}] } + link_html {title "Edit Record "} + html { align center } + } + } + +db_multirow d_gen_titles select_ge_titles { + select title_l, + title_s, + ims_md_ge_ti_id, + ims_md_id + from + ims_md_general_title + where + ims_md_id = :ims_md_id +} { + set item_url [export_vars -base "item" { ims_md_id }] +} + Index: openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_cont.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_cont.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_cont.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Lifecyle Metadata Contribution</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Lifecycle Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Contribution: </td> + <td><listtemplate name= "d_lf_cont"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Lifecycle Metadata Contributor</h3> +<blockquote> + <formtemplate id="lifecyclemd_cont" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_cont.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_cont.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_cont.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,165 @@ +# packages/lorsm/www/md/lifecyclemd/lifecycle_cont.tcl + +ad_page_contract { + + Add/Edit Lifecycle MD Contributor + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: lifecycle_cont.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_lf_cont_id:integer,optional + ims_md_lf_cont_enti_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_lf_cont_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../lifecyclemd" im\\\\\\\s_md_id] " [_ lorsm.Life_Cycle_MD]"] "[_ lorsm.Edit_Contributor]"] + set title "[_ lorsm.lt_Edit_Lifecycle_MD_Con]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../lifecyclemd" im\\\\\\\s_md_id] "[_ lorsm.Life_Cycle_MD]"] "[_ lorsm.Add_Contributor]"] + set title "[_ lorsm.lt_Add_Lifecycle_MD_Cont]" +} + +# Form + +ad_form -name lifecyclemd_cont \ + -cancel_url ../lifecyclemd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_lf_cont_id:key(ims_md_life_cycle_contrib_seq) + + {role_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Lifecycle_MD_]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {role_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.Type_of_contribution]"} + {label "[_ lorsm.Role_1]"} + } + {entity:text(textarea),nospell + {html {rows 5 cols 50}} + {help_text "[_ lorsm.lt_Entity_or_entities_in]"} + {label "[_ lorsm.Entity]"} + } + + {cont_date:text,nospell + {html {size 10}} + {help_text "[_ lorsm.Date_of_contribution]"} + {label "[_ lorsm.Date]"} + } + + {cont_date_l:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi_3]"} + {label "[_ lorsm.Language]"} + } + + {cont_date_s:text(textarea),nospell,optional + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_Describes_contributio]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query { + select * from + ims_md_life_cycle_contrib lfc, + ims_md_life_cycle_contrib_entity lfce + where + lfc.ims_md_lf_cont_id = :ims_md_lf_cont_id + and + lfc.ims_md_id = :ims_md_id + and + lfce.ims_md_lf_cont_id = :ims_md_lf_cont_id + +} -edit_data { + db_transaction { + db_dml update_lfc " + update ims_md_life_cycle_contrib + set role_v = :role_v, + role_s = :role_s, + cont_date = :cont_date, + cont_date_l = :cont_date_l, + cont_date_s = :cont_date_s + where ims_md_lf_cont_id = :ims_md_lf_cont_id" + + db_dml update_lfce " + update ims_md_life_cycle_contrib_entity + set entity = :entity + where ims_md_lf_cont_id = :ims_md_lf_cont_id" + } + +} -new_data { + db_transaction { + db_dml insert_lfc " + insert into ims_md_life_cycle_contrib (ims_md_lf_cont_id, ims_md_id, role_s, role_v, cont_date, cont_date_l, cont_date_s) + values (:ims_md_lf_cont_id, :ims_md_id, :role_s, :role_v, :cont_date, :cont_date_l, :cont_date_s)" + + db_dml insert_lfce " + insert into ims_md_life_cycle_contrib_entity (ims_md_lf_cont_enti_id, ims_md_lf_cont_id, entity) + values (nextval('ims_md_life_cycle_contrib_entity_seq'), :ims_md_lf_cont_id, :entity)" + } + +} -after_submit { + ad_returnredirect [export_vars -base "../lifecyclemd" {ims_md_id}] + ad_script_abort +} + +# Lifecycle Contrib +template::list::create \ + -name d_lf_cont \ + -multirow d_lf_cont \ + -no_data "[_ lorsm.lt_No_Contributors_Avail]" \ + -html { align right style "width: 100%;" } \ + -elements { + role { + label "[_ lorsm.Role]" + } + entity { + label "[_ lorsm.Entity_1]" + } + cont_date { + label "[_ lorsm.Contribution_Date]" + } + cont_date_ls { + label "[_ lorsm.Description_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "lifecycle_cont" {ims_md_lf_cont_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record] "} + html { align center } + } + } + +db_multirow d_lf_cont select_lf_cont { + select + lfc.role_v || ' ' || '[' || lfc.role_s || ']' as role, + lfce.entity, + lfc.cont_date, + '[' || lfc.cont_date_l || ']' || ' ' || lfc.cont_date_s as cont_date_ls, + lfc.ims_md_lf_cont_id, + lfc.ims_md_id + from + ims_md_life_cycle_contrib lfc, + ims_md_life_cycle_contrib_entity lfce + where + lfc.ims_md_lf_cont_id = lfce.ims_md_lf_cont_id + and + lfc.ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_stat.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_stat.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_stat.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Lifecyle Metadata Status</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Lifecycle Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Status: </td> + <td><listtemplate name= "d_lf_stat"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Lifecycle Metadata Status</h3> +<blockquote> + <formtemplate id="lifecyclemd_stat" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_stat.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_stat.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_stat.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,93 @@ +# packages/lorsm/www/md/lifecyclemd/lifecycle_stat.tcl + +ad_page_contract { + + Add/Edit Lifecycle MD Status + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: lifecycle_stat.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../lifecyclemd" im\\\\\\\s_md_id] "[_ lorsm.Life_Cycle_MD]"] "[_ lorsm.Edit_Status]"] +set title "[_ lorsm.lt_Edit_Lifecycle_MD_Sta]" + +# Form + +ad_form -name lifecyclemd_stat \ + -cancel_url ../lifecyclemd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {status_v:text,nospell + {section "[_ lorsm.lt_AddEdit_Lifecycle_MD__1]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Learning_objects_edit]"} + {label "[_ lorsm.Status]"} + } + + {status_s:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # Checks whether LC status exist... + + if {[db_0or1row select_lc_version {select ims_md_id from ims_md_life_cycle where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_life_cycle + set status_s = :status_s, status_v = :status_v + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_life_cycle (ims_md_id, status_s, status_v) + values + (:ims_md_id, :status_s, :status_v)" + + } + +} -after_submit { + ad_returnredirect [export_vars -base "../lifecyclemd" {ims_md_id}] + ad_script_abort +} + +# Lifecycle Status +template::list::create \ + -name d_lf_stat \ + -multirow d_lf_stat \ + -no_data "[_ lorsm.No_Status_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + status_s { + label "[_ lorsm.Source_1]" + } + status_v { + label "[_ lorsm.Value]" + } + } + +db_multirow d_lf_stat select_lf_stat { + select status_s, + status_v, + ims_md_id + from + ims_md_life_cycle + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_version.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_version.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_version.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Lifecyle Metadata Version</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Lifecycle Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Version: </td> + <td><listtemplate name= "d_lf_ver"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Lifecycle Metadata Version</h3> +<blockquote> + <formtemplate id="lifecyclemd_ver" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_version.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_version.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/lifecyclemd/lifecycle_version.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,96 @@ +# packages/lorsm/www/md/lifecyclemd/lifecycle_version.tcl + +ad_page_contract { + + Add/Edit Lifecycle MD Version + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: lifecycle_version.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../lifecyclemd" im\\\\\\s_md_id] "[_ lorsm.Life_Cycle_MD]"] "[_ lorsm.Edit_Version]"] +set title "[_ lorsm.lt_Edit_Lifecycle_MD_Ver]" + +# Form + +ad_form -name lifecyclemd_ver \ + -cancel_url ../lifecyclemd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + + {version_l:text,nospell,optional + {section "[_ lorsm.lt_AddEdit_Lifecycle_MD__1]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {version_s:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Edition_of_the_learni]"} + {label "[_ lorsm.Version]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + + # check if the LC version already exists... + + if {[db_0or1row select_lc_version {select ims_md_id from ims_md_life_cycle where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_life_cycle + set version_l = :version_l, version_s = :version_s + where ims_md_id = :ims_md_id " + + + } else { + + db_dml do_insert " + insert into ims_md_life_cycle (ims_md_id, version_l, version_s) + values + (:ims_md_id, :version_l, :version_s)" + + } + +} -after_submit { + ad_returnredirect [export_vars -base "../lifecyclemd" {ims_md_id}] + ad_script_abort +} + +# Lifecycle Version +template::list::create \ + -name d_lf_ver \ + -multirow d_lf_ver \ + -no_data "[_ lorsm.lt_No_Structure_Availabl]" \ + -html { align right style "width: 100%;" } \ + -elements { + version_l { + label "[_ lorsm.Language_1]" + } + version_s { + label "[_ lorsm.Version_1]" + } + } + +db_multirow d_lf_ver select_lf_ver { + select version_l, + version_s, + ims_md_id + from + ims_md_life_cycle + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/metamd/meta_cata.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd/meta_cata.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd/meta_cata.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of Meta Metadata Catalog-Entries</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Meta Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Catalog-Entries: </td> + <td><listtemplate name= "d_md_cata"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Meta Metadata Catalog-Entry</h3> +<blockquote> + <formtemplate id="metamd_cata" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/metamd/meta_cata.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd/meta_cata.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd/meta_cata.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,109 @@ +# packages/lorsm/www/md/metamd/meta_cata.tcl + +ad_page_contract { + + Add/Edit Meta MD Catalog-Entry + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: meta_cata.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_md_cata_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_md_cata_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "IMS Metadata Editor"] [list [export_vars -base "../metamd" im\s_md_id] "Meta Metadata"] "Edit Catalog-Entry"] + set title "Edit Meta MD Catalog-Entry" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "IMS Metadata Editor"] [list [export_vars -base "../metamd" im\s_md_id] "Meta Metadata"] "Add Catalog-Entry"] + set title "Add Meta MD Catalog-Entry" +} + +# Form + +ad_form -name metamd_cata \ + -cancel_url ../metamd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_md_cata_id:key(ims_md_metadata_cata_seq) + + {catalog:text,nospell + {section "Add/Edit Meta MD Catalog-Entry"} + {html {size 50}} + {help_text "Name of the catalog"} + {label "Catalog:"} + } + + {entry_l:text,nospell,optional + {html {size 10}} + {help_text "i.e.: 'en_AU' for Australian English"} + {label "Language:"} + } + + {entry_s:text,nospell + {html {size 50}} + {help_text "Number in the Catalog i.e.: '1.3.1'"} + {label "Entry:"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_metadata_cata where ims_md_md_cata_id = :ims_md_md_cata_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_metadata_cata + set catalog = :catalog, entry_l = :entry_l, entry_s = :entry_s + where ims_md_md_cata_id = :ims_md_md_cata_id" +} -new_data { + db_dml do_insert " + insert into ims_md_metadata_cata (ims_md_md_cata_id, ims_md_id, catalog, entry_l, entry_s) + values + (:ims_md_md_cata_id, :ims_md_id, :catalog, :entry_l, :entry_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "../metamd" {ims_md_id}] + ad_script_abort +} + +# Metametadata Catalog-entry +template::list::create \ + -name d_md_cata \ + -multirow d_md_cata \ + -no_data "No Catalog Entry Available" \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "Catalog" + } + entry_ls { + label "Language Entry" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "meta_cata" {ims_md_md_cata_id ims_md_id}] } + link_html {title "Edit Record "} + html { align center } + } + } + +db_multirow d_md_cata select_md_cata { + select catalog, + '[' || entry_l || ']' || ' ' || entry_s as entry_ls, + ims_md_md_cata_id, + ims_md_id + from + ims_md_metadata_cata + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/metamd/meta_cont.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd/meta_cont.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd/meta_cont.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Meta Metadata Contribution</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Meta Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Contribution: </td> + <td><listtemplate name= "d_md_cont"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Meta Metadata Contributor</h3> +<blockquote> + <formtemplate id="metamd_cont" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/metamd/meta_cont.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd/meta_cont.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd/meta_cont.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,166 @@ +# packages/lorsm/www/md/metamd/meta_cont.tcl + +ad_page_contract { + + Add/Edit Meta MD Contributor + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: meta_cont.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_md_cont_id:integer,optional + ims_md_md_cont_enti_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_md_cont_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../metamd" im\s_\md_id] "[_ lorsm.Meta_Metadata]"] "[_ lorsm.Add_Contributor]"] + set title "[_ lorsm.lt_Edit_Meta_MD_Contribu]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../metamd" im\s_\md_id] "[_ lorsm.Meta_Metadata]"] "[_ lorsm.Add_Contributor]"] + set title "[_ lorsm.lt_Add_Meta_MD_Contribut]" +} + +# Form + +ad_form -name metamd_cont \ + -cancel_url ../metamd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_md_cont_id:key(ims_md_metadata_contrib_seq) + + {role_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Meta_MD_Contr]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {role_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.Type_of_contribution]"} + {label "[_ lorsm.Role_1]"} + } + + {entity:text(textarea),nospell + {html {rows 5 cols 50}} + {help_text "[_ lorsm.lt_Entity_or_entities_in]"} + {label "[_ lorsm.Entity]"} + } + + {cont_date:text,nospell + {html {size 10}} + {help_text "[_ lorsm.Date_of_contribution]"} + {label "[_ lorsm.Date]"} + } + + {cont_date_l:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi_3]"} + {label "[_ lorsm.Language]"} + } + + {cont_date_s:text(textarea),nospell,optional + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_Describes_contributio]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query { + select * from + ims_md_metadata_contrib mdc, + ims_md_metadata_contrib_entity mdce + where + mdc.ims_md_md_cont_id = :ims_md_md_cont_id + and + mdc.ims_md_id = :ims_md_id + and + mdce.ims_md_md_cont_id = :ims_md_md_cont_id + +} -edit_data { + db_transaction { + db_dml update_mdc " + update ims_md_metadata_contrib + set role_v = :role_v, + role_s = :role_s, + cont_date = :cont_date, + cont_date_l = :cont_date_l, + cont_date_s = :cont_date_s + where ims_md_md_cont_id = :ims_md_md_cont_id" + + db_dml update_mdce " + update ims_md_metadata_contrib_entity + set entity = :entity + where ims_md_md_cont_id = :ims_md_md_cont_id" + } + +} -new_data { + db_transaction { + db_dml insert_mdc " + insert into ims_md_metadata_contrib (ims_md_md_cont_id, ims_md_id, role_s, role_v, cont_date, cont_date_l, cont_date_s) + values (:ims_md_md_cont_id, :ims_md_id, :role_s, :role_v, :cont_date, :cont_date_l, :cont_date_s)" + + db_dml insert_mdce " + insert into ims_md_metadata_contrib_entity (ims_md_md_cont_enti_id, ims_md_md_cont_id, entity) + values (nextval('ims_md_metadata_contrib_entity_seq'), :ims_md_md_cont_id, :entity)" + } + +} -after_submit { + ad_returnredirect [export_vars -base "../metamd" {ims_md_id}] + ad_script_abort +} + +# Metametadata Contrib +template::list::create \ + -name d_md_cont \ + -multirow d_md_cont \ + -no_data "[_ lorsm.lt_No_Contributors_Avail]" \ + -html { align right style "width: 100%;" } \ + -elements { + role { + label "[_ lorsm.Role]" + } + entity { + label "[_ lorsm.Entity_1]" + } + cont_date { + label "[_ lorsm.Contribution_Date]" + } + cont_date_ls { + label "[_ lorsm.Description_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "meta_cont" {ims_md_md_cont_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record] "} + html { align center } + } + } + +db_multirow d_md_cont select_md_cont { + select + mdc.role_v || ' ' || '[' || mdc.role_s || ']' as role, + mdce.entity, + mdc.cont_date, + '[' || mdc.cont_date_l || ']' || ' ' || mdc.cont_date_s as cont_date_ls, + mdc.ims_md_md_cont_id, + mdc.ims_md_id + from + ims_md_metadata_contrib mdc, + ims_md_metadata_contrib_entity mdce + where + mdc.ims_md_md_cont_id = mdce.ims_md_md_cont_id + and + mdc.ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/metamd/meta_lang.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd/meta_lang.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd/meta_lang.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Meta Metadata Language</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Meta Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Language: </td> + <td><listtemplate name= "d_md_lang"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Meta Metadata Language</h3> +<blockquote> + <formtemplate id="metamd_lang" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/metamd/meta_lang.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd/meta_lang.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd/meta_lang.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,81 @@ +# packages/lorsm/www/md/metamd/meta_lang.tcl + +ad_page_contract { + + Add/Edit Meta MD Language + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: meta_lang.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../metamd" im\s_\\\md_id] "[_ lorsm.Meta_Metadata]"] "[_ lorsm.Edit_Language]"] +set title "[_ lorsm.lt_Edit_Meta_MD_Language]" + +# Form + +ad_form -name metamd_lang \ + -cancel_url ../metamd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {language:text,nospell + {section "[_ lorsm.lt_AddEdit_Meta_MD_Langu]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the mdmd language details already exist... + + if {[db_0or1row select_lang {select ims_md_id from ims_md_metadata where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_metadata + set language = :language + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_metadata (ims_md_id, language) + values + (:ims_md_id, :language)" + + } + +} -after_submit { + ad_returnredirect [export_vars -base "../metamd" {ims_md_id}] + ad_script_abort +} + +# Metametadata Language +template::list::create \ + -name d_md_lang \ + -multirow d_md_lang \ + -no_data "[_ lorsm.lt_No_Language_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + language { + label "[_ lorsm.Language_1]" + } + } + +db_multirow d_md_lang select_md_lang { + select language, + ims_md_id + from + ims_md_metadata + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/metamd/meta_scheme.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd/meta_scheme.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd/meta_scheme.adp 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Meta Metadata Scheme</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Meta Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Scheme: </td> + <td><listtemplate name= "d_md_scheme"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Meta Metadata Scheme</h3> +<blockquote> + <formtemplate id="metamd_scheme" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/metamd/meta_scheme.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/metamd/meta_scheme.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/metamd/meta_scheme.tcl 17 May 2005 16:21:25 -0000 1.1 @@ -0,0 +1,93 @@ +# packages/lorsm/www/md/metamd/meta_scheme.tcl + +ad_page_contract { + + Add/Edit Meta MD Language + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: meta_scheme.tcl,v 1.1 2005/05/17 16:21:25 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_md_sch_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_md_sch_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../metamd" im\s_\\md_id] "[_ lorsm.Meta_Metadata]"] "[_ lorsm.Edit_Scheme]"] + set title "[_ lorsm.Edit_Meta_MD_Scheme]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../metamd" im\s_\\md_id] "[_ lorsm.Meta_Metadata]"] "[_ lorsm.Add_Scheme]"] + set title "[_ lorsm.Add_Meta_MD_Scheme]" +} + +# Form + +ad_form -name metamd_scheme \ + -cancel_url ../metamd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_md_sch_id:key(ims_md_metadata_scheme_seq) + + {scheme:text,nospell + {section "[_ lorsm.lt_AddEdit_Meta_MD_Schem]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Structure_of_meta-dat]"} + {label "[_ lorsm.Scheme]"} + } + {ims_md_id:text(hidden) {value $ims_md_id} + } + + +} -select_query {select * from ims_md_metadata_scheme where ims_md_md_sch_id = :ims_md_md_sch_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_metadata_scheme + set scheme = :scheme + where ims_md_md_sch_id = :ims_md_md_sch_id " + +} -new_data { + db_dml do_insert " + insert into ims_md_metadata_scheme (ims_md_md_sch_id, ims_md_id, scheme) + values + (:ims_md_md_sch_id, :ims_md_id, :scheme)" + + +} -after_submit { + ad_returnredirect [export_vars -base "../metamd" {ims_md_id}] + ad_script_abort +} + +# Metametadata metadatascheme +template::list::create \ + -name d_md_scheme \ + -multirow d_md_scheme \ + -no_data "[_ lorsm.No_Scheme_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + scheme { + label "[_ lorsm.Scheme_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "meta_scheme" {ims_md_id ims_md_md_sch_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_md_scheme select_md_scheme { + select scheme, + ims_md_id, ims_md_md_sch_id, scheme + from + ims_md_metadata_scheme + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/pbs-md/addmd.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/addmd.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/addmd.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,31 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<h3>MD Schema</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th>Metadata Schema</th> + </tr> + <tr class="form-section"> + <td><listtemplate name= "md_schema_info"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add Metadata Schema</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr> + <td>Object: <b><i>@object_type@</i></b><br> + <small>Add details for the metadata schema and version.</small> + </td> + </tr> + <tr> + <formtemplate id="add_md" style="standard-lars"></formtemplate> + </tr> + </table> +</blockquote> Index: openacs-4/packages/lors-central/www/md/pbs-md/addmd.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/addmd.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/addmd.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,135 @@ +# packages/lorsm/www/md/addmd.tcl + +ad_page_contract { + + Add metadata schema + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2004-11-13 + @arch-tag: 28b76527-a05f-42cf-b562-37c7b85e799f + @cvs-id $Id: addmd.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# Get object information +set object_type [acs_object_type $ims_md_id] + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] "PBS Metadata"] +set title "MD Schema" + + +# Form +ad_form -name add_md \ + -cancel_url [export_vars -base "." {ims_md_id}] \ + -mode edit \ + -form { + + {schema:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Metadata_schema_ie_IM]"} + {label "[_ lorsm.Schema]"} + } + + {schemaversion:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Version_of_the_Schema]"} + {label "[_ lorsm.Schema_Version]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + db_transaction { + + if {![lors::imsmd::mdExist -ims_md_id $ims_md_id]} { + + db_dml do_insert " + insert into ims_md(ims_md_id, schema, schemaversion) + values (:ims_md_id, :schema, :schemaversion)" + + } else { + + db_dml do_update { + update ims_md set schema = :schema, schemaversion = :schemaversion + where ims_md_id = :ims_md_id + } + + } + + # If the object_type is on any of the IMS CP object types, + # then we update also the ims cp tables accordingly. + + switch $object_type { + + "ims_manifest_object" { + + db_dml upd_manifest " + update ims_cp_manifests set hasmetadata = 't' + where man_id = :ims_md_id" + } + "ims_item_object" { + + db_dml upd_item " + update ims_cp_items set hasmetadata = 't' + where ims_item_id = :ims_md_id" + } + "ims_organization_object" { + + db_dml upd_organization " + update ims_cp_organizations set hasmetadata = 't' + where org_id = :ims_md_id" + } + "ims_resource_object" { + + db_dml upd_resource " + update ims_cp_resources set hasmetadata = 't' + where res_id = :ims_md_id" + } + "content_item" { + + db_dml upd_file " + update ims_cp_files set hasmetadata = 't' + where file_id = :ims_md_id" + } + + } + } + +} -after_submit { + ad_returnredirect [export_vars -base "." ims_md_id] + ad_script_abort +} + +# MD Schema Info +template::list::create \ + -name md_schema_info \ + -multirow md_schema_info \ + -no_data "[_ lorsm.No_Schema_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + schema { + label "[_ lorsm.Schema_1]" + html { align center } + } + schemaversion { + label "[_ lorsm.Version_1]" + html { align center } + } + } + + db_multirow md_schema_info select_md_schema { + select + schema, + schemaversion + from + ims_md + where + ims_md_id = :ims_md_id + } + Index: openacs-4/packages/lors-central/www/md/pbs-md/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/index.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,27 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<if @hasmetadata@ > +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@"/> + + +<p> +<if @write_p@ eq 1> + #lorsm.You_can# <a href="@link@">#lorsm.lt_upload_a_XML_LOM_meta#</a> #lorsm.lt_to_addchange_the_meta# +</if> +<br> +<if @read_p@ eq 1> + #lorsm.lt_Heres_a_link_to_the_a# +</if> +</if> + +<else> +<p> +#lorsm.lt_No_metadata_record_ex# +<if @write_p@ eq 1> +<ul><li><a href=addmd?ims_md_id=@ims_md_id;noquote@>#lorsm.Add_metadata#</a></li></ul> +</if> +</else> + Index: openacs-4/packages/lors-central/www/md/pbs-md/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/index.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,25 @@ +ad_page_contract { + Displays/Adds IMS Metadata + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 19 January 2004 + @cvs-id $Id: index.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer +} + +# set context +set context [list "PBS Metadata Editor"] +set title "PBS Metadata Editor" +set link [export_vars -base "md_upload" ims_md_id] + +set hasmetadata [lors::imsmd::mdExist -ims_md_id $ims_md_id] +set object_type [acs_object_type $ims_md_id] + +set write_p [permission::permission_p -party_id [ad_conn user_id] -object_id $ims_md_id -privilege write] +set read_p [permission::permission_p -party_id [ad_conn user_id] -object_id $ims_md_id -privilege read] + +if {$hasmetadata} { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] +} \ No newline at end of file Index: openacs-4/packages/lors-central/www/md/pbs-md/pbs-md.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbs-md.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbs-md.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,56 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0" width="80%"> + <tr class="form-section"> + <th colspan="2">PBS Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section" width="20%">Program Title/Episode Title:</td> + <td><listtemplate name= "d_gen_titles"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section" width="20%">PBS Curriculum Topics:</td> + <td><listtemplate name= "d_gen_cata_pbs_ct"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section" width="20%">PBS Subject Areas:</td> + <td><listtemplate name= "d_gen_cata_pbs_sa"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section" width="20%">#lorsm.Descriptions# </td> + <td><listtemplate name= "d_gen_desc"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section" width="20%">#lorsm.Keywords# </td> + <td><listtemplate name= "d_gen_key"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section" width="20%">URL:</td> + <td><listtemplate name= "d_te_loca"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section" width="20%">Grade Range:</td> + <td><listtemplate name= "d_ed_cont"></listtemplate></td> + </tr> + + <tr class="form-section"> + <td class="form-section" width="20%">Resource Type</td> + <td><listtemplate name= "d_ed_lrt"></listtemplate></td> + </tr> + + </table> + + + + Index: openacs-4/packages/lors-central/www/md/pbs-md/pbs-md.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbs-md.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbs-md.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,236 @@ +# packages/lors-central/www/md/pbs-md/pbs-md.tcl + +ad_page_contract { + + Add/Edit PBS MD Schema + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2005-04-03 + @arch-tag: 4eb5b155-a31b-461e-a671-9265963e3257 + @cvs-id $Id: pbs-md.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + + +# set context & title +set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] "PBS Metadata"] +set title "PBS Metadata Editor" + +# General Title +template::list::create \ + -name d_gen_titles \ + -multirow d_gen_titles \ + -no_data "No Title Available" \ + -actions [list " Add Program Title " [export_vars -base pbsmd_title {ims_md_id}] "Add Program Title"] \ + -html { align right style "width: 100%;" } \ + -elements { + title_l { + label "" + } + title_s { + label "" + } + } + +db_multirow d_gen_titles select_ge_titles { + select title_l, + title_s + from + ims_md_general_title + where + ims_md_id = :ims_md_id +} { + set item_url [export_vars -base "item" { ims_md_id }] +} + +# General Description +template::list::create \ + -name d_gen_desc \ + -multirow d_gen_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -actions [list "[_ lorsm.Add_Description]" [export_vars -base pbsmd_desc {ims_md_id}] "[_ lorsm.lt_Add_another_Descripti]"] \ + -html { align right style "width: 100%;" } \ + -elements { + descrip_l { + label "" + } + descrip_s { + label "" + } + } + +db_multirow d_gen_desc select_ge_desc { + select descrip_l, + descrip_s + from + ims_md_general_desc + where + ims_md_id = :ims_md_id +} + +# General Catalog-entry (PBS SubjectArea) +template::list::create \ + -name d_gen_cata_pbs_sa \ + -multirow d_gen_cata_pbs_sa \ + -no_data " No PBS Subject Area Available " \ + -actions [list "Add PBS-Subject Area" [export_vars -base pbsmd_subarea {ims_md_id}] "Add PBS-Subject Area"] \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "" + } + entry_l { + label "" + } + entry_s { + label "" + } + } + +db_multirow d_gen_cata_pbs_sa select_ge_cata { + select + catalog, + entry_l, + entry_s + from + ims_md_general_cata + where + catalog = 'PBS-SubjectArea' + and + ims_md_id = :ims_md_id +} + +# General Catalog-entry (PBS-CurriculumTopic) +template::list::create \ + -name d_gen_cata_pbs_ct \ + -multirow d_gen_cata_pbs_ct \ + -no_data "[_ lorsm.lt_No_Catalog_Entry_Avai]" \ + -actions [list "Add PBS-Curriculum Topic" [export_vars -base pbsmd_currtop {ims_md_id}] " Add another PBS-Curriculum Topic "] \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "" + } + entry_l { + label "" + } + entry_s { + label "" + } + } + +db_multirow d_gen_cata_pbs_ct select_ge_cata { + select + catalog, + entry_l, + entry_s + from + ims_md_general_cata + where + catalog = 'PBS-CurriculumTopic' + and + ims_md_id = :ims_md_id +} + + + +# General Keywords +template::list::create \ + -name d_gen_key \ + -multirow d_gen_key \ + -no_data "[_ lorsm.lt_No_Keywords_Available]" \ + -actions [list "[_ lorsm.Add_Keywords]" [export_vars -base pbsmd_key {ims_md_id}] "[_ lorsm.Add_another_Keywords]"] \ + -html { align right style "width: 100%;" } \ + -elements { + keyword_l { + label "" + } + keyword_s { + label "" + } + } + +db_multirow d_gen_key select_ge_key { + select + keyword_l, + keyword_s + from + ims_md_general_key + where + ims_md_id = :ims_md_id +} + + +# Technical Location (PBS: URL) +template::list::create \ + -name d_te_loca \ + -multirow d_te_loca \ + -no_data "No URL Available" \ + -actions [list "Add URL" [export_vars -base pbsmd_url {ims_md_id}] "Add another URL"] \ + -html { align right style "width: 100%;" } \ + -elements { + type { + label "" + } + location { + label "" + } + } + +db_multirow d_te_loca select_te_loca { + select + type, + location + from + ims_md_technical_location + where + ims_md_id = :ims_md_id +} + +# Educational Context (PBS: Grade Range) +template::list::create \ + -name d_ed_cont \ + -multirow d_ed_cont \ + -no_data "No Grade Range Available" \ + -actions [list "Add Grade Range" [export_vars -base pbsmd_grade {ims_md_id}] "Add another Grade Range"] \ + -html { align right style "width: 100%;" } \ + -elements { + context { + label "" + } + } + +db_multirow d_ed_cont select_ed_cont { + select + '[' || context_s || '] ' || context_v as context + from + ims_md_educational_context + where + ims_md_id = :ims_md_id +} + +# Educational Learning Resource Type (PBS: Resource Type) +template::list::create \ + -name d_ed_lrt \ + -multirow d_ed_lrt \ + -no_data "No Resource Type Available" \ + -actions [list "Add Resource Type" [export_vars -base pbsmd_restype {ims_md_id}] "Add another Resource Type"] \ + -html { align right style "width: 100%;" } \ + -elements { + lrt { + label "" + } + } + +db_multirow d_ed_lrt select_ed_lrt { + select + '[' || lrt_s || '] ' || lrt_v as lrt + from + ims_md_educational_lrt + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_currtop.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_currtop.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_currtop.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of PBS Curriculm Topics</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Curriculum Topics</th> + </tr> + <tr class="form-section"> + <td class="form-section">Topics: </td> + <td><listtemplate name= "d_gen_cata"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Curriculum Topics</h3> +<blockquote> + <formtemplate id="generalmd_cata" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_currtop.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_currtop.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_currtop.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,117 @@ +# packages/lorsm/www/md/pbs-md/pbsmd_currtop.tcl + +ad_page_contract { + + Add/Edit PBS Curriculum Topic + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: pbsmd_currtop.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_cata_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_cata_id]} { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base pbs-md ims_md_id] "PBS Metadata"] "PBS Curriculum Topic "] + set title "Edit PBS Curriculum Topic" +} else { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base pbs-md ims_md_id] "PBS Metadata"] "PBS Curriculum Topic"] + set title "Add PBS Curriculum Topic" +} + +# Form + +ad_form -name generalmd_cata \ + -cancel_url pbs-md?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_cata_id:key(ims_md_general_cata_seq) + + {catalogx:text,nospell,optional + {section "Add/Edit PBS Curriculum Topics"} + {html {size 50 value {PBS-CurriculumTopics} disabled {}}} + {label "Catalog Schema:"} + } + + {entry_l:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {entry_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Number_in_the_Catalog]"} + {label "[_ lorsm.Entry]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {catalog:text(hidden) {value {PBS-CurriculumTopic}} + } + +} -select_query {select * from ims_md_general_cata where catalog = 'PBS-CurriculumTopic' and ims_md_ge_cata_id = :ims_md_ge_cata_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_cata + set catalog = :catalog, entry_l = :entry_l, entry_s = :entry_s + where ims_md_ge_cata_id = :ims_md_ge_cata_id" +} -new_data { + db_dml do_insert " + insert into ims_md_general_cata (ims_md_ge_cata_id, ims_md_id, catalog, entry_l, entry_s) + values + (:ims_md_ge_cata_id, :ims_md_id, :catalog, :entry_l, :entry_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] + ad_script_abort +} + +# General Catalog-entry +template::list::create \ + -name d_gen_cata \ + -multirow d_gen_cata \ + -no_data "No PBS Curriculum Topics Available" \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "[_ lorsm.Catalog_1]" + } + entry_l { + label "[_ lorsm.Language_1]" + } + entry_s { + label "[_ lorsm.Entry_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "pbsmd_currtop" {ims_md_ge_cata_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_gen_cata select_ge_cata { + select catalog, + entry_l, + entry_s, + ims_md_ge_cata_id, + ims_md_id + from + ims_md_general_cata + where + catalog = 'PBS-CurriculumTopic' + and + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_desc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_desc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_desc.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of PBS Descriptions</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Descriptions</th> + </tr> + <tr class="form-section"> + <td class="form-section">Descriptions: </td> + <td><listtemplate name= "d_gen_desc"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Description</h3> +<blockquote> + <formtemplate id="generalmd_desc" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_desc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_desc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_desc.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,101 @@ +# packages/lorsm/www/md/pbs-md/pbsmd_desc.tcl + +ad_page_contract { + + Add/Edit PBS Schema Description + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: pbsmd_desc.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_desc_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_desc_id]} { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Edit Description"] + set title "Edit Description" +} else { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Add Description"] + set title "Add Description" +} + +# Form + +ad_form -name generalmd_desc \ + -cancel_url pbs-md?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_desc_id:key(ims_md_general_desc_seq) + + {descrip_l:text,nospell,optional + {section "Add/Edit Description"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {descrip_s:text(textarea),nospell + {html {rows 5 cols 50}} + {help_text "[_ lorsm.lt_Describes_learning_ob]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_desc where ims_md_ge_desc_id = :ims_md_ge_desc_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_desc + set descrip_l = :descrip_l, descrip_s = :descrip_s + where ims_md_ge_desc_id = :ims_md_ge_desc_id " +} -new_data { + db_dml do_insert " + insert into ims_md_general_desc (ims_md_ge_desc_id, ims_md_id, descrip_l, descrip_s) + values + (:ims_md_ge_desc_id, :ims_md_id, :descrip_l, :descrip_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] + ad_script_abort +} + +# General Language +template::list::create \ + -name d_gen_desc \ + -multirow d_gen_desc \ + -no_data "No Description Available" \ + -html { align right style "width: 100%;" } \ + -elements { + descrip_l { + label "[_ lorsm.Language_1]" + } + descrip_s { + label "[_ lorsm.Description_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "pbsmd_desc" {ims_md_ge_desc_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record] "} + html { align center } + } + } + +db_multirow d_gen_desc select_ge_desc { + select descrip_l, + descrip_s, + ims_md_ge_desc_id, + ims_md_id + from + ims_md_general_desc + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_grade.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_grade.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_grade.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,30 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Grade Ranges</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Grade Ranges</th> + </tr> + <tr class="form-section"> + <td class="form-section">Grade Range: </td> + <td><listtemplate name= "d_ed_cont"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Grade Range</h3> +<blockquote> + <formtemplate id="educationalmd_cont" style="standard-lars"></formtemplate> +</blockquote> + Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_grade.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_grade.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_grade.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,98 @@ +# packages/lors-central/www/md/pbs-md/pbsmd_grade.tcl + +ad_page_contract { + + Add/Edit PBS Grade Range MD + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2005-04-03 + @arch-tag: 6d6ac4ab-a0d4-4610-9175-335981940c33 + @cvs-id $Id: pbsmd_grade.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ +} { + ims_md_id:integer + ims_md_ed_co_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ed_co_id]} { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "pbs-md" im\s_md_id] "PBS Metadata"] "Edit Grade Range"] + set title "Edit Grade Range" +} else { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Add Grade Range"] + set title "Add Grade Range" +} + +# Form + +ad_form -name educationalmd_cont \ + -cancel_url pbs-md?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ed_co_id:key(ims_md_educational_context_seq) + + {context_s:text,nospell + {section "Add/Edit Grade Range"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {context_v:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Learning_environment_]"} + {label "[_ lorsm.Context]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_educational_context where ims_md_ed_co_id = :ims_md_ed_co_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_educational_context + set context_s = :context_s, + context_v = :context_v + where ims_md_ed_co_id = :ims_md_ed_co_id " +} -new_data { + db_dml do_insert " + insert into ims_md_educational_context (ims_md_ed_co_id, ims_md_id, context_s, context_v) + values (:ims_md_ed_co_id, :ims_md_id, :context_s, :context_v)" +} -after_submit { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] + ad_script_abort +} + +# Educational Context +template::list::create \ + -name d_ed_cont \ + -multirow d_ed_cont \ + -no_data "[_ lorsm.No_Context_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + context { + label "[_ lorsm.Context_1]" + } + export { + display_eval {\[[_ lorsm.Edit_1]\]} + link_url_eval { [export_vars -base "pbsmd_grade" {ims_md_ed_co_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_ed_cont select_ed_cont { + select + '[' || context_s || '] ' || context_v as context, + ims_md_ed_co_id, + ims_md_id + from + ims_md_educational_context + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_key.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_key.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_key.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of PBS Keywords</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">PBS Keywords</th> + </tr> + <tr class="form-section"> + <td class="form-section">Keywords: </td> + <td><listtemplate name= "d_gen_key"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Keyword</h3> +<blockquote> + <formtemplate id="generalmd_key" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_key.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_key.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_key.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,102 @@ +# packages/lorsm/www/md/pbs-md/pbsmd_key.tcl + +ad_page_contract { + + Add/Edit + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: pbsmd_key.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_key_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_key_id]} { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Edit Keywords"] + set title "Edit Keywords" +} else { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor" ] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Add Keywords"] + set title "Add Keywords" +} + +# Form + +ad_form -name generalmd_key \ + -cancel_url pbs-md?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_key_id:key(ims_md_general_key_seq) + + {keyword_l:text,nospell,optional + {section "Add/Edit Keywords"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {keyword_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Keyword_description_o]"} + {label "[_ lorsm.Keyword]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_key where ims_md_ge_key_id = :ims_md_ge_key_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_key + set keyword_l = :keyword_l, keyword_s = :keyword_s + where ims_md_ge_key_id = :ims_md_ge_key_id " +} -new_data { + db_dml do_insert " + insert into ims_md_general_key (ims_md_ge_key_id, ims_md_id, keyword_l, keyword_s) + values + (:ims_md_ge_key_id, :ims_md_id, :keyword_l, :keyword_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] + ad_script_abort +} + +# General Keyword +template::list::create \ + -name d_gen_key \ + -multirow d_gen_key \ + -no_data "No Keywords Available" \ + -html { align right style "width: 100%;" } \ + -elements { + keyword_l { + label "" + } + keyword_s { + label "" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "pbsmd_key" {ims_md_ge_key_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_gen_key select_ge_key { + select keyword_l, + keyword_s, + ims_md_ge_key_id, + ims_md_id + from + ims_md_general_key + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_restype.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_restype.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_restype.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,30 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Learning Resource Type</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Resource Types</th> + </tr> + <tr class="form-section"> + <td class="form-section">Learning Resource Type: </td> + <td><listtemplate name= "d_ed_lrt"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Resource Type</h3> +<blockquote> + <formtemplate id="educationalmd_lrt" style="standard-lars"></formtemplate> +</blockquote> + Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_restype.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_restype.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_restype.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,97 @@ +# packages/lors-central/www/md/pbs-md/pbsmd_restype.tcl + +ad_page_contract { + + Add/Edit PBS Resource Type MD + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2005-04-03 + @arch-tag: b18e4129-8f95-4a73-b6ec-50f67c96ee3c + @cvs-id $Id: pbsmd_restype.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ +} { + ims_md_id:integer + ims_md_ed_lr_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ed_lr_id]} { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Add PBS Resource Type"] + set title "Edit PBS Resource Type" +} else { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor "] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Add PBS Resource Type"] + set title "Add PBS Resource Type" +} + +# Form + +ad_form -name educationalmd_lrt \ + -cancel_url pbs-md?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ed_lr_id:key(ims_md_educational_lrt_seq) + + {lrt_s:text,nospell + {section "Add/Edit PBS Resource Type"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {lrt_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Type_of_interactivity]"} + {label "[_ lorsm.lt_Learning_Resource_Typ]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_educational_lrt where ims_md_ed_lr_id = :ims_md_ed_lr_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_educational_lrt + set lrt_s = :lrt_s, + lrt_v = :lrt_v + where ims_md_ed_lr_id = :ims_md_ed_lr_id " +} -new_data { + db_dml do_insert " + insert into ims_md_educational_lrt (ims_md_ed_lr_id, ims_md_id, lrt_s, lrt_v) + values (:ims_md_ed_lr_id, :ims_md_id, :lrt_s, :lrt_v)" +} -after_submit { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] + ad_script_abort +} + +# Educational Learning Resource Type +template::list::create \ + -name d_ed_lrt \ + -multirow d_ed_lrt \ + -no_data "[_ lorsm.lt_No_Learning_Resource_]" \ + -html { align right style "width: 100%;" } \ + -elements { + lrt { + label "" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "pbsmd_restype" {ims_md_ed_lr_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_ed_lrt select_ed_lrt { + select + '[' || lrt_s || '] ' || lrt_v as lrt, + ims_md_ed_lr_id, + ims_md_id + from + ims_md_educational_lrt + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_subarea.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_subarea.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_subarea.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,30 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of PBS Curriculm Topics</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Subject Areas</th> + </tr> + <tr class="form-section"> + <td class="form-section">Topics: </td> + <td><listtemplate name= "d_gen_cata"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Subject Areas</h3> +<blockquote> + <formtemplate id="generalmd_cata" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_subarea.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_subarea.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_subarea.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,111 @@ +# packages/lorsm/www/md/pbs-md/pbsmd_subarea.tcl + +ad_page_contract { + + Add/Edit PBS Subject Area + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: pbsmd_subarea.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_ge_cata_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_cata_id]} { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base pbs-md ims_md_id] "PBS Metadata"] "PBS Subject Area "] + set title "Edit PBS Subject Area" +} else { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base pbs-md ims_md_id] "PBS Metadata"] "PBS Subject Area"] + set title "Add PBS Subject Area" +} + +# Form + +ad_form -name generalmd_cata \ + -cancel_url pbs-md?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_ge_cata_id:key(ims_md_general_cata_seq) + + {entry_l:text,nospell,optional + {section "Add/Edit PBS Subject Areas"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {entry_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Number_in_the_Catalog]"} + {label "[_ lorsm.Entry]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {catalog:text(hidden) {value {PBS-SubjectArea}} + } + +} -select_query {select * from ims_md_general_cata where catalog = 'PBS-SubjectArea' and ims_md_ge_cata_id = :ims_md_ge_cata_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_cata + set catalog = :catalog, entry_l = :entry_l, entry_s = :entry_s + where ims_md_ge_cata_id = :ims_md_ge_cata_id" +} -new_data { + db_dml do_insert " + insert into ims_md_general_cata (ims_md_ge_cata_id, ims_md_id, catalog, entry_l, entry_s) + values + (:ims_md_ge_cata_id, :ims_md_id, :catalog, :entry_l, :entry_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] + ad_script_abort +} + +# General Catalog-entry +template::list::create \ + -name d_gen_cata \ + -multirow d_gen_cata \ + -no_data "No PBS Subject Areas Available" \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "[_ lorsm.Catalog_1]" + } + entry_l { + label "[_ lorsm.Language_1]" + } + entry_s { + label "[_ lorsm.Entry_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "pbsmd_subarea" {ims_md_ge_cata_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_gen_cata select_ge_cata { + select catalog, + entry_l, + entry_s, + ims_md_ge_cata_id, + ims_md_id + from + ims_md_general_cata + where + catalog = 'PBS-SubjectArea' + and + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_title.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_title.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_title.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of General Metadata Titles</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">General Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Titles: </td> + <td><listtemplate name= "d_gen_titles"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit General Metadata Title</h3> +<blockquote> + <formtemplate id="generalmd_title" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_title.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_title.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_title.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,104 @@ +# packages/lorsm/www/md/generalmd/general_title.tcl + +ad_page_contract { + + Add/Edit General MD Title + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2004-05-03 + @arch-tag 1956d02e-511a-470c-81d0-c2857242651c + @cvs-id $Id: pbsmd_title.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ +} { + ims_md_id:integer + ims_md_ge_ti_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_ge_ti_id]} { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Edit Titles"] + set title "Add PBS Title" +} else { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "pbs-md" ims_md_id] "PBS Metadata"] "Add Titles"] + set title "Add PBS Title" +} + +# Form + +ad_form -name generalmd_title \ + -cancel_url [export_vars -base "pbs-md" ims_md_id] \ + -mode edit \ + -form { + + ims_md_ge_ti_id:key(ims_md_general_title_seq) + + {title_l:text,nospell,optional + {section "[_ lorsm.lt_AddEdit_General_MD_Ti]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {title_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Learning_objects_name]"} + {label "[_ lorsm.Title]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_general_title where ims_md_ge_ti_id = :ims_md_ge_ti_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_general_title + set title_l = :title_l, title_s = :title_s + where ims_md_ge_ti_id = :ims_md_ge_ti_id " +} -new_data { + db_dml do_insert " + insert into ims_md_general_title (ims_md_ge_ti_id, ims_md_id, title_l, title_s) + values + (:ims_md_ge_ti_id, :ims_md_id, :title_l, :title_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] + ad_script_abort +} + +# General Title +template::list::create \ + -name d_gen_titles \ + -multirow d_gen_titles \ + -no_data "[_ lorsm.No_Titles_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + title_l { + label "[_ lorsm.Language_1]" + } + title_s { + label "[_ lorsm.Titles_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "pbsmd_title" {ims_md_ge_ti_id ims_md_id}] } + link_html {title "Edit Record "} + html { align center } + } + } + +db_multirow d_gen_titles select_ge_titles { + select title_l, + title_s, + ims_md_ge_ti_id, + ims_md_id + from + ims_md_general_title + where + ims_md_id = :ims_md_id +} { + set item_url [export_vars -base "item" { ims_md_id }] +} + Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_url.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_url.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_url.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../../lib/md-record-pbs" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of URLs</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">URL</th> + </tr> + <tr class="form-section"> + <td class="form-section">URLs: </td> + <td><listtemplate name= "d_te_loca"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit URLs</h3> +<blockquote> + <formtemplate id="technicalmd_loca" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_url.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_url.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/pbs-md/pbsmd_url.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,104 @@ +# packages/lorsm/www/md/pbs-md/pbsmd_url.tcl + +ad_page_contract { + + Add/Edit PBS URL + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: pbsmd_url.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_te_lo_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_te_lo_id]} { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "../technicalmd" ims_md_id] "PBS Metadata"] "Edit URL"] + set title "Edit URL" +} else { + set context [list [list [export_vars -base "." ims_md_id] "PBS Metadata Editor"] [list [export_vars -base "../technicalmd" ims_md_id] "PBS Metadata"] "Add URL"] + set title "Add URL" +} + +# Form + +ad_form -name technicalmd_loca \ + -cancel_url pbs-md?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_te_lo_id:key(ims_md_technical_location_seq) + + {type:text,nospell,optional + {section "Add/Edit URL"} + {html {size 10}} + {help_text "[_ lorsm.lt_Reference_to_location]"} + {label "[_ lorsm.Type_1]"} + } + + {location:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Location_of_the_resou]"} + {label "[_ lorsm.Location_1]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + +} -select_query {select * from ims_md_technical_location where ims_md_te_lo_id = :ims_md_te_lo_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_technical_location + set type = :type, + location = :location + where ims_md_te_lo_id = :ims_md_te_lo_id " + +} -new_data { + db_dml do_insert " + insert into ims_md_technical_location (ims_md_te_lo_id, ims_md_id, type, location) + values + (:ims_md_te_lo_id, :ims_md_id, :type, :location)" + +} -after_submit { + ad_returnredirect [export_vars -base "pbs-md" {ims_md_id}] + ad_script_abort +} + +# Technical Location +template::list::create \ + -name d_te_loca \ + -multirow d_te_loca \ + -no_data "No URL Available" \ + -html { align right style "width: 100%;" } \ + -elements { + type { + label "[_ lorsm.Type]" + } + location { + label "[_ lorsm.Location]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "pbsmd_url" {ims_md_te_lo_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_te_loca select_te_loca { + select type, + location, + ims_md_te_lo_id, + ims_md_id + from + ims_md_technical_location + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/relationmd/relation.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,31 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@"/> + + <table cellspacing="2" cellpadding="2" border="0"> + <tr class="form-section"> + <th colspan="2">Relation Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Kind: </td> + <td><listtemplate name= "d_re_kind"></listtemplate></td> + </tr> + <tr class="form-section"> + <th colspan="2">Relation Metadata Resource</th> + </tr> + <tr class="form-section"> + <td class="form-section">Identifier: </td> + <td><listtemplate name= "d_re_ident"></listtemplate></td> + </tr> + <tr class="form-section"> + <td class="form-section">Description: </td> + <td><listtemplate name= "d_re_desc"></listtemplate></td> + </tr> + <tr class="form-section"> + <td class="form-section">Catalog-Entries: </td> + <td><listtemplate name= "d_re_cata"></listtemplate></td> + </tr> + </table> Index: openacs-4/packages/lors-central/www/md/relationmd/relation.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,118 @@ +ad_page_contract { + Displays/Adds IMS Metadata Relation + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: relation.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_re_id:integer + ims_md_id:integer + ims_md_re_re_id:integer +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../relationmd" ims_md_id] "[_ lorsm.Relation_MD]"] "[_ lorsm.Relation_Entry]"] +set title "[_ lorsm.Relation_MD]" + +# Relation Kind +template::list::create \ + -name d_re_kind \ + -multirow d_re_kind \ + -no_data "[_ lorsm.No_Kind_Available]" \ + -actions [list "[_ lorsm.Add_Kind]" [export_vars -base relation_kind {ims_md_re_re_id ims_md_re_id ims_md_id}] "[_ lorsm.Add_another_Kind]"] \ + -html { align right style "width: 100%;" } \ + -elements { + kind_s { + label "" + } + kind_v { + label "" + } + } + +db_multirow d_re_kind select_re_kind { + select kind_s, + kind_v + from + ims_md_relation + where + ims_md_re_id = :ims_md_re_id + and ims_md_id = :ims_md_id +} + +# Relation Resource Identifier +template::list::create \ + -name d_re_ident \ + -multirow d_re_ident \ + -actions [list "[_ lorsm.Add_Identifier]" [export_vars -base relation_ident {ims_md_re_re_id ims_md_re_id ims_md_id}] "[_ lorsm.lt_Add_another_Identifie]"] \ + -no_data "[_ lorsm.lt_No_Resource_Identifie]" \ + -html { align right style "width: 100%;" } \ + -elements { + identifier { + label "" + } + } + +db_multirow d_re_ident select_re_ident { + select identifier + from + ims_md_relation_resource + where + ims_md_re_id = :ims_md_re_id + and ims_md_re_re_id = :ims_md_re_re_id +} + +# Relation Resource Catalog-Entry +template::list::create \ + -name d_re_cata \ + -multirow d_re_cata \ + -no_data "[_ lorsm.lt_No_Catalog-Entries_Av]" \ + -actions [list "[_ lorsm.Add_Catalog-Entry]" [export_vars -base relation_cata {ims_md_re_re_id ims_md_re_id ims_md_id}] "[_ lorsm.lt_Add_another_Catalog-E]"] \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "" + } + entry_l { + label "" + } + entry_s { + label "" + } + } + +db_multirow d_re_cata select_re_cata { + select catalog, + entry_l, + entry_s + from + ims_md_relation_resource_catalog + where + ims_md_re_re_id = :ims_md_re_re_id +} + +# Relation Resource Description +template::list::create \ + -name d_re_desc \ + -multirow d_re_desc \ + -no_data "[_ lorsm.lt_No_Resource_Descripti]" \ + -actions [list "[_ lorsm.Add_Description]" [export_vars -base relation_desc {ims_md_re_re_id ims_md_re_id ims_md_id}] "[_ lorsm.lt_Add_another_Descripti]"] \ + -html { align right style "width: 100%;" } \ + -elements { + descrip { + label "" + } + } + +db_multirow d_re_desc select_re_desc { + select '[' || descrip_l || ']' || ' ' || descrip_s as descrip + from + ims_md_relation_resource + where + ims_md_re_id = :ims_md_re_id + and ims_md_re_re_id = :ims_md_re_re_id +} + + Index: openacs-4/packages/lors-central/www/md/relationmd/relation_add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_add.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,22 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<h3>Relation Metadata Entry</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Relation Metadata</th> + </tr> + <tr> + <td>Add another Relation Metadata Entry?</td> + </tr> + <tr> + <formtemplate id="relationmd_add" style="standard-lars"></formtemplate> + </tr> + </table> +</blockquote> Index: openacs-4/packages/lors-central/www/md/relationmd/relation_add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_add.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,48 @@ +# packages/lorsm/www/md/relationmd/relation_add.tcl + +ad_page_contract { + + Add/Edit Relation MD Entry + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: relation_add.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../relationmd" ims_md_id] "[_ lorsm.Relation_MD]"] "[_ lorsm.Add_Relation_Entry]"] +set title "[_ lorsm.lt_Add_Relation_MD_Entry]" + +# Form +ad_form -name relationmd_add \ + -cancel_url ../relationmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_re_id:key(ims_md_relation_seq) + + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -new_data { + db_transaction { + db_dml do_insert_relation " + insert into ims_md_relation (ims_md_re_id, ims_md_id) + values (:ims_md_re_id, :ims_md_id)" + + db_dml do_insert_resource " + insert into ims_md_relation_resource (ims_md_re_re_id, ims_md_re_id) + values (nextval('ims_md_relation_resource_seq'), :ims_md_re_id)" + } + +} -after_submit { + ad_returnredirect [export_vars -base "../relationmd" {ims_md_id}] + ad_script_abort +} + Index: openacs-4/packages/lors-central/www/md/relationmd/relation_cata.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_cata.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_cata.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Relation Metadata Resource Catalog-Entry</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Relation Metadata Resource</th> + </tr> + <tr class="form-section"> + <td class="form-section">Catalog-Entries: </td> + <td><listtemplate name= "d_re_cata"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Relation Metadata Resource Catalog-Entry</h3> +<blockquote> + <formtemplate id="relationmd_cata" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/relationmd/relation_cata.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_cata.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_cata.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,129 @@ +# packages/lorsm/www/md/relationmd/relation_cata.tcl + +ad_page_contract { + + Add/Edit Relation MD Resource Catalog-Entry + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: relation_cata.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_re_id:integer + ims_md_re_re_id:integer + ims_md_re_re_ca_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_re_re_ca_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../relationmd" ims_md_id] "[_ lorsm.Relation_MD]"] [list [export_vars -base "relation" {ims_md_id ims_md_re_id ims_md_re_re_id}] "[_ lorsm.Relation_Entry]"] "[_ lorsm.Edit_Catalog-Entry]"] + set title "[_ lorsm.lt_Edit_Relation_MD_Reso]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../relationmd" ims_md_id] "[_ lorsm.Relation_MD]"] [list [export_vars -base "relation" {ims_md_id ims_md_re_id ims_md_re_re_id}] "[_ lorsm.Relation_Entry]"] "[_ lorsm.Add_Catalog-Entry]"] + set title "[_ lorsm.lt_Add_Relation_MD_Resou]" +} + +# Form + +ad_form -name relationmd_cata \ + -cancel_url relation?ims_md_id=$ims_md_id&ims_md_re_id=$ims_md_re_id&ims_md_re_re_id=$ims_md_re_re_id \ + -mode edit \ + -form { + + ims_md_re_re_ca_id:key(ims_md_relation_resource_catalog_seq) + + {catalog:text,nospell + {section "[_ lorsm.lt_AddEdit_Relation_MD_R]"} + {html {size 50}} + {help_text "[_ lorsm.Name_of_the_catalog]"} + {label "[_ lorsm.Catalog]"} + } + + {entry_l:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {entry_s:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Number_in_the_Catalog]"} + {label "[_ lorsm.Entry]"} + } + + {ims_md_re_re_id:text(hidden) {value $ims_md_re_re_id} + } + + {ims_md_re_id:text(hidden) {value $ims_md_re_id} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query {select * from ims_md_relation_resource_catalog where ims_md_re_re_ca_id = :ims_md_re_re_ca_id and ims_md_re_re_id = :ims_md_re_re_id + +} -edit_data { + db_dml do_update " + update ims_md_relation_resource_catalog + set catalog = :catalog, + entry_l = :entry_l, + entry_s = :entry_s + where ims_md_re_re_ca_id = :ims_md_re_re_ca_id" + +} -new_data { + db_dml do_insert " + insert into ims_md_relation_resource_catalog (ims_md_re_re_ca_id, ims_md_re_re_id, catalog, entry_l, entry_s) + values + (:ims_md_re_re_ca_id, :ims_md_re_re_id, :catalog, :entry_l, :entry_s)" + +} -after_submit { + ad_returnredirect [export_vars -base "relation" {ims_md_re_id ims_md_re_re_id ims_md_id}] + ad_script_abort +} + +# Relation Catalog-Entry +template::list::create \ + -name d_re_cata \ + -multirow d_re_cata \ + -no_data "[_ lorsm.lt_No_Catalog-Entries_Av]" \ + -html { align right style "width: 100%;" } \ + -elements { + catalog { + label "" + } + entry_l { + label "" + } + entry_s { + label "" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "relation_cata" {ims_md_re_re_ca_id ims_md_re_re_id ims_md_re_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_re_cata select_re_cata { + select + reca.catalog, + reca.entry_l, + reca.entry_s, + reca.ims_md_re_re_ca_id, + reca.ims_md_re_re_id, + re.ims_md_id, + re.ims_md_re_id + from + ims_md_relation_resource_catalog reca, + ims_md_relation re + where + reca.ims_md_re_re_id = :ims_md_re_re_id + and + re.ims_md_re_id = :ims_md_re_id +} Index: openacs-4/packages/lors-central/www/md/relationmd/relation_desc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_desc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_desc.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Relation Metadata Resource Description</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Relation Metadata Resource</th> + </tr> + <tr class="form-section"> + <td class="form-section">Description: </td> + <td><listtemplate name= "d_re_desc"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Relation Metadata Resource Description</h3> +<blockquote> + <formtemplate id="relationmd_desc" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/relationmd/relation_desc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_desc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_desc.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,90 @@ +# packages/lorsm/www/md/annotationmd/relation_desc.tcl + +ad_page_contract { + + Add/Edit Relation MD Resource Description + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: relation_desc.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_re_id:integer + ims_md_re_re_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../relationmd" ims_md_id] "[_ lorsm.Relation_MD]"] [list [export_vars -base "relation" {ims_md_id ims_md_re_id ims_md_re_re_id}] "[_ lorsm.Relation_Entry]"] "[_ lorsm.AddEdit_Description]"] +set title "[_ lorsm.lt_Edit_Relation_MD_Reso_1]" + +# Form + +ad_form -name relationmd_desc \ + -cancel_url relation?ims_md_id=$ims_md_id&ims_md_re_id=$ims_md_re_id&ims_md_re_re_id=$ims_md_re_re_id \ + -mode edit \ + -form { + + ims_md_re_re_id:key(ims_md_relation_resource_seq) + + {descrip_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Relation_MD_R_1]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {descrip_s:text(textarea),nospell + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_Description_of_the_ot]"} + {label "[_ lorsm.Description]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {ims_md_re_id:text(hidden) {value $ims_md_re_id} + } + +} -select_query {select * from ims_md_relation_resource where ims_md_re_re_id = :ims_md_re_re_id and ims_md_re_id = :ims_md_re_id + +} -edit_data { + db_dml do_update " + update ims_md_relation_resource + set descrip_l = :descrip_l, + descrip_s = :descrip_s + where ims_md_re_re_id = :ims_md_re_re_id " + +} -after_submit { + ad_returnredirect [export_vars -base "relation" {ims_md_re_re_id ims_md_re_id ims_md_id}] + ad_script_abort +} + +# Relation Description +template::list::create \ + -name d_re_desc \ + -multirow d_re_desc \ + -no_data "[_ lorsm.lt_No_Resource_Descripti]" \ + -html { align right style "width: 100%;" } \ + -elements { + descrip { + label "[_ lorsm.Description_1]" + } + } + +db_multirow d_re_desc select_re_desc { + select '[' || rere.descrip_l || ']' || ' ' || rere.descrip_s as descrip, + rere.ims_md_re_re_id, + re.ims_md_re_id, + re.ims_md_id + from + ims_md_relation_resource rere, + ims_md_relation re + where + rere.ims_md_re_id = :ims_md_re_id + and re.ims_md_re_id = :ims_md_re_id +} Index: openacs-4/packages/lors-central/www/md/relationmd/relation_ident.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_ident.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_ident.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Relation Metadata Resource Identifier</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Relation Metadata Resource</th> + </tr> + <tr class="form-section"> + <td class="form-section">Identifier: </td> + <td><listtemplate name= "d_re_ident"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Relation Metadata Resource Identifier</h3> +<blockquote> + <formtemplate id="relationmd_ident" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/relationmd/relation_ident.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_ident.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_ident.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,84 @@ +# packages/lorsm/www/md/relationmd/relation_ident.tcl + +ad_page_contract { + + Add/Edit Relation MD Resource Identifier + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: relation_ident.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_re_id:integer + ims_md_re_re_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../relationmd" ims_md_id] "[_ lorsm.Relation_MD]"] [list [export_vars -base "relation" {ims_md_id ims_md_re_id ims_md_re_re_id}] "[_ lorsm.Relation_Entry]"] "[_ lorsm.lt_AddEdit_Resource_Iden]"] +set title "[_ lorsm.lt_Edit_Relation_MD_Reso_2]" + + +# Form + +ad_form -name relationmd_ident \ + -cancel_url relation?ims_md_id=$ims_md_id&ims_md_re_id=$ims_md_re_id&ims_md_re_re_id=$ims_md_re_re_id \ + -mode edit \ + -form { + + ims_md_re_re_id:key(ims_md_relation_resource_seq) + + {identifier:text,nospell + {section "[_ lorsm.lt_AddEdit_Relation_MD_R_2]"} + {html {size 50}} + {help_text "[_ lorsm.lt_Unique_identifier_of_]"} + {label "[_ lorsm.Identifier]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {ims_md_re_id:text(hidden) {value $ims_md_re_id} + } + +} -select_query {select * from ims_md_relation_resource where ims_md_re_re_id = :ims_md_re_re_id and ims_md_re_id = :ims_md_re_id + +} -edit_data { + db_dml do_update " + update ims_md_relation_resource + set identifier = :identifier + where ims_md_re_re_id = :ims_md_re_re_id " + +} -after_submit { + ad_returnredirect [export_vars -base "relation" {ims_md_re_re_id ims_md_re_id ims_md_id}] + ad_script_abort +} + +# Relation Identifier +template::list::create \ + -name d_re_ident \ + -multirow d_re_ident \ + -no_data "[_ lorsm.lt_No_Resource_Identifie]" \ + -html { align right style "width: 100%;" } \ + -elements { + identifier { + label "[_ lorsm.Identifier_1]" + } + } + +db_multirow d_re_ident select_re_ident { + select rere.identifier, + rere.ims_md_re_re_id, + re.ims_md_re_id, + re.ims_md_id + from + ims_md_relation_resource rere, + ims_md_relation re + where + rere.ims_md_re_id = :ims_md_re_id + and re.ims_md_re_id = :ims_md_re_id +} Index: openacs-4/packages/lors-central/www/md/relationmd/relation_kind.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_kind.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_kind.adp 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Relation Metadata Kind</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Relation Metadata Kind</th> + </tr> + <tr class="form-section"> + <td class="form-section">Kind: </td> + <td><listtemplate name= "d_re_kind"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Relation Metadata Kind</h3> +<blockquote> + <formtemplate id="relationmd_kind" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/relationmd/relation_kind.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/relationmd/relation_kind.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/relationmd/relation_kind.tcl 17 May 2005 16:21:26 -0000 1.1 @@ -0,0 +1,95 @@ +# packages/lorsm/www/md/relationmd/relation_kind.tcl + +ad_page_contract { + + Add/Edit Relation MD Kind + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: relation_kind.tcl,v 1.1 2005/05/17 16:21:26 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_re_id:integer + ims_md_re_re_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title + +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../relationmd" ims_md_id] "[_ lorsm.Relation_MD]"] [list [export_vars -base "relation" {ims_md_id ims_md_re_id ims_md_re_re_id}] "[_ lorsm.Relation_Entry]"] "[_ lorsm.AddEdit_Kind]"] +set title "[_ lorsm.lt_AddEdit_Relation_MD_K]" + +# Form + +ad_form -name relationmd_kind \ + -cancel_url relation?ims_md_id=$ims_md_id&ims_md_re_id=$ims_md_re_id&ims_md_re_re_id=$ims_md_re_re_id \ + -mode edit \ + -form { + + ims_md_re_id:key(ims_md_relation_seq) + + {kind_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Relation_MD_K]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {kind_v:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Nature_of_the_relatio]"} + {label "[_ lorsm.Kind]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + {ims_md_re_re_id:text(hidden) {value $ims_md_re_re_id} + } + +} -select_query {select * from ims_md_relation where ims_md_re_id = :ims_md_re_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_relation + set kind_s = :kind_s, + kind_v = :kind_v + where ims_md_re_id = :ims_md_re_id" + +} -after_submit { + ad_returnredirect [export_vars -base "relation" {ims_md_re_re_id ims_md_re_id ims_md_id}] + ad_script_abort +} + +# Relation Kind +template::list::create \ + -name d_re_kind \ + -multirow d_re_kind \ + -no_data "[_ lorsm.No_Kind_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + kind_s { + label "[_ lorsm.Source_1]" + } + kind_v { + label "[_ lorsm.Value]" + } + } + +db_multirow d_re_kind select_re_kind { + select re.kind_s, + re.kind_v, + re.ims_md_re_id, + re.ims_md_id, + rere.ims_md_re_re_id + from + ims_md_relation re, + ims_md_relation_resource rere + where + re.ims_md_re_id = :ims_md_re_id + and rere.ims_md_re_id = :ims_md_re_id +} Index: openacs-4/packages/lors-central/www/md/rightsmd/rights_caor.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/rightsmd/rights_caor.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/rightsmd/rights_caor.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Rights Metadata Copyright or other Restrictions</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Rights Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Copyright or other Restrictions: </td> + <td><listtemplate name= "d_ri_caor"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Rights Metadata Copyright or other Restrictions</h3> +<blockquote> + <formtemplate id="rightsmd_caor" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/rightsmd/rights_caor.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/rightsmd/rights_caor.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/rightsmd/rights_caor.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,88 @@ +# packages/lorsm/www/md/rightsmd/rights_caor.tcl + +ad_page_contract { + + Add/Edit Rights MD Copyright or other Restrictions + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: rights_caor.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../rightsmd" ims_md_id] "[_ lorsm.Rights_MD]"] " <#_Add/Edit Copyrights or other Restrictions #>"] +set title "[_ lorsm.lt_Edit_Rights_MD_Copyri]" + + +# Form + +ad_form -name rightsmd_caor \ + -cancel_url ../rightsmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {caor_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Rights_MD_Cop]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {caor_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Whether_copyright_or_]"} + {label "[_ lorsm.lt_Copyright_or_other_Re]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the Rights Copyright details already exist... + + if {[db_0or1row select_type {select ims_md_id from ims_md_rights where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_rights + set caor_s = :caor_s, caor_v = :caor_v + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_rights (ims_md_id, caor_s, caor_v) + values + (:ims_md_id, :caor_s, :caor_v) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../rightsmd" {ims_md_id}] + ad_script_abort +} + +# Rights Copyright or other Restrictions +template::list::create \ + -name d_ri_caor \ + -multirow d_ri_caor \ + -no_data "[_ lorsm.lt_No_Copyright_or_other]" \ + -html { align right style "width: 100%;" } \ + -elements { + caor { + label "[_ lorsm.Copyright_Info]" + } + } + +db_multirow d_ri_caor select_ri_caor { + select + '[' || caor_s || '] ' || caor_v as caor, + ims_md_id + from + ims_md_rights + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/rightsmd/rights_cost.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/rightsmd/rights_cost.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/rightsmd/rights_cost.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Rights Metadata Cost</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Rights Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Cost: </td> + <td><listtemplate name= "d_ri_cost"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Rights Metadata Cost</h3> +<blockquote> + <formtemplate id="rightsmd_cost" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/rightsmd/rights_cost.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/rightsmd/rights_cost.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/rightsmd/rights_cost.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,88 @@ +# packages/lorsm/www/md/rightsmd/rights_cost.tcl + +ad_page_contract { + + Add/Edit Rights MD Cost + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: rights_cost.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../rightsmd" ims_md_id] "[_ lorsm.Rights_MD]"] "[_ lorsm.AddEdit_Cost]"] +set title "[_ lorsm.lt_AddEdit_Rights_MD_Cos]" + + +# Form + +ad_form -name rightsmd_cost \ + -cancel_url ../rightsmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {cost_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Rights_MD_Cos]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {cost_v:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Whether_use_of_the_re]"} + {label "[_ lorsm.Cost]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the Rights Cost details already exist... + + if {[db_0or1row select_type {select ims_md_id from ims_md_rights where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_rights + set cost_s = :cost_s, cost_v = :cost_v + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_rights (ims_md_id, cost_s, cost_v) + values + (:ims_md_id, :cost_s, :cost_v) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../rightsmd" {ims_md_id}] + ad_script_abort +} + +# Rights Cost +template::list::create \ + -name d_ri_cost \ + -multirow d_ri_cost \ + -no_data "[_ lorsm.No_Cost_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + cost { + label "[_ lorsm.Cost_1]" + } + } + +db_multirow d_ri_cost select_ri_cost { + select + '[' || cost_s || '] ' || cost_v as cost, + ims_md_id + from + ims_md_rights + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/rightsmd/rights_desc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/rightsmd/rights_desc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/rightsmd/rights_desc.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Rights Metadata Description</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Rights Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Description: </td> + <td><listtemplate name= "d_ri_desc"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Rights Metadata Description</h3> +<blockquote> + <formtemplate id="rightsmd_desc" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/rightsmd/rights_desc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/rightsmd/rights_desc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/rightsmd/rights_desc.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,88 @@ +# packages/lorsm/www/md/rightsmd/rights_desc.tcl + +ad_page_contract { + + Add/Edit Rights MD Description + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: rights_desc.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../rightsmd" ims_md_id] "[_ lorsm.Rights_MD]"] "[_ lorsm.AddEdit_Description]"] +set title "[_ lorsm.lt_Edit_Rights_MD_Descri]" + + +# Form + +ad_form -name rightsmd_desc \ + -cancel_url ../rightsmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {descrip_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Rights_MD_Des]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {descrip_s:text(textarea),nospell + {html {rows 2 cols 50}} + {help_text "[_ lorsm.lt_Conditions_of_use_for]"} + {label "[_ lorsm.Description]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the Rights Description details already exist... + + if {[db_0or1row select_type {select ims_md_id from ims_md_rights where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_rights + set descrip_l = :descrip_l, descrip_s = :descrip_s + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_rights (ims_md_id, descrip_l, descrip_s) + values + (:ims_md_id, :descrip_l, :descrip_s) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../rightsmd" {ims_md_id}] + ad_script_abort +} + +# Rights Description +template::list::create \ + -name d_ri_desc \ + -multirow d_ri_desc \ + -no_data "[_ lorsm.lt_No_Description_Availa]" \ + -html { align right style "width: 100%;" } \ + -elements { + desc { + label "[_ lorsm.Description_1]" + } + } + +db_multirow d_ri_desc select_ri_desc { + select + '[' || descrip_l || '] ' || descrip_s as desc, + ims_md_id + from + ims_md_rights + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_dur.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_dur.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_dur.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,28 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Technical Metadata Duration</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Technical Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Duration: </td> + <td><listtemplate name= "d_te_dur"></listtemplate></td> + </tr> + </table> +</blockquote> +<p> + +<h3>Add/Edit Technical Metadata Duration</h3> +<blockquote> + <formtemplate id="technicalmd_dur" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_dur.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_dur.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_dur.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,104 @@ +# packages/lorsm/www/md/technicalmd/technical_dur.tcl + +ad_page_contract { + + Add/Edit Technical MD Duration + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: technical_dur.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" \\\i\\m\\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.AddEdit_Duration]"] +set title "[_ lorsm.lt_Edit_Technical_MD_Dur]" + +# Form + +ad_form -name technicalmd_dur \ + -cancel_url ../technicalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {duration:text,nospell + {section "[_ lorsm.lt_AddEdit_Technical_MD_]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Time_the_continuous_l]"} + {label "[_ lorsm.Duration] "} + } + + {duration_l:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {duration_s:text,nospell,optional + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the tech duration details already exist... + + if {[db_0or1row select_duration {select ims_md_id from ims_md_technical where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_technical + set duration_s = :duration_s, + duration_l = :duration_l, + duration = :duration + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_technical (ims_md_id, duration_l, duration_s) + values + (:ims_md_id, :duration_l, :duration_s)" + } + +} -after_submit { + ad_returnredirect [export_vars -base "../technicalmd" {ims_md_id}] + ad_script_abort +} + +# Technical Duration +template::list::create \ + -name d_te_dur \ + -multirow d_te_dur \ + -no_data "[_ lorsm.lt_No_Duration_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + duration_sec { + label "[_ lorsm.Duration_Seconds]" + } + duration_l { + label "[_ lorsm.Language_1]" + } + duration_s { + label "[_ lorsm.Source_1]" + } + + } + +db_multirow d_te_dur select_te_dur { + select + duration_l, + duration_s, + duration || 's' as duration_sec, + ims_md_id + from + ims_md_technical + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_form.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_form.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Technical Metadata Format</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Technical Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Formats: </td> + <td><listtemplate name= "d_te_form"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Technical Metadata Format</h3> +<blockquote> + <formtemplate id="technicalmd_form" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_form.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,92 @@ +# packages/lorsm/www/md/technicalmd/technical_form.tcl + +ad_page_contract { + + Add/Edit Technical MD Format + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: technical_form.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_te_fo_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_te_fo_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "I[_ lorsm.MS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" im\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.Edit_Format]"] + set title "[_ lorsm.lt_Edit_Technical_MD_For]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" im\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.Add_Format]"] + set title "[_ lorsm.lt_Add_Technical_MD_Form]" +} + +# Form + +ad_form -name technicalmd_form \ + -cancel_url ../technicalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_te_fo_id:key(ims_md_technical_format_seq) + + {format:text,nospell + {section "[_ lorsm.lt_AddEdit_Technical_MD__1]"} + {html {size 30}} + {help_text "[_ lorsm.lt_Technical_data_type_o]"} + {label "[_ lorsm.Format]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -select_query {select * from ims_md_technical_format where ims_md_te_fo_id = :ims_md_te_fo_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_technical_format + set format = :format + where ims_md_te_fo_id = :ims_md_te_fo_id " + +} -new_data { + db_dml do_insert " + insert into ims_md_technical_format (ims_md_te_fo_id, ims_md_id, format) + values + (:ims_md_te_fo_id, :ims_md_id, :format)" + +} -after_submit { + ad_returnredirect [export_vars -base "../technicalmd" {ims_md_id}] + ad_script_abort +} + +# Technical Format +template::list::create \ + -name d_te_form \ + -multirow d_te_form \ + -no_data "[_ lorsm.No_Format_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + format { + label "[_ lorsm.Format_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "technical_form" {ims_md_te_fo_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_te_form select_te_form { + select format, + ims_md_te_fo_id, + ims_md_id + from + ims_md_technical_format + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_inst.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_inst.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_inst.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Technical Metadata Installation Remarks</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Technical Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Installation Remarks: </td> + <td><listtemplate name= "d_te_inst"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Technical Metadata Installation Remarks</h3> +<blockquote> + <formtemplate id="technicalmd_inst" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_inst.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_inst.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_inst.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,88 @@ +# packages/lorsm/www/md/technicalmd/technical_inst.tcl + +ad_page_contract { + + Add/Edit Technical MD Installation Remarks + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: technical_inst.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" \\\im\\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.lt_Edit_Installation_Rem]"] +set title "[_ lorsm.lt_AddEdit_Technical_MD__2]" + +# Form + +ad_form -name technicalmd_inst \ + -cancel_url ../technicalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {instl_rmrks_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Technical_MD__2]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {instl_rmrks_s:text(textarea),nospell + {html {rows 5 cols 60}} + {help_text "[_ lorsm.lt_Information_on_how_to]"} + {label "[_ lorsm.Installation_Remarks]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the tech size details already exist... + + if {[db_0or1row select_size {select ims_md_id from ims_md_technical where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_technical + set instl_rmrks_l = :instl_rmrks_l, + instl_rmrks_s = :instl_rmrks_s + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_technical (ims_md_id, instl_rmrks_l, instl_rmrks_s) + values + (:ims_md_id, :instl_rmrks_l, :instl_rmrks_s) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../technicalmd" {ims_md_id}] + ad_script_abort +} + +# Technical Installation Remarks +template::list::create \ + -name d_te_inst \ + -multirow d_te_inst \ + -no_data "[_ lorsm.lt_No_Installation_Remar]" \ + -html { align right style "width: 100%;" } \ + -elements { + instl_rmrks { + label "[_ lorsm.Installation_Remarks_1]" + } + } + +db_multirow d_te_inst select_te_inst { + select + '[' || instl_rmrks_l || ']' || ' ' || instl_rmrks_s as instl_rmrks, + ims_md_id + from + ims_md_technical + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_loca.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_loca.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_loca.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of Technical Metadata Locations</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Technical Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Locations: </td> + <td><listtemplate name= "d_te_loca"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Technical Metadata Format</h3> +<blockquote> + <formtemplate id="technicalmd_loca" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_loca.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_loca.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_loca.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,105 @@ +# packages/lorsm/www/md/technicalmd/technical_loca.tcl + +ad_page_contract { + + Add/Edit Technical MD Location + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: technical_loca.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_te_lo_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_te_lo_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" \im\\s_md_id] "[_ lorsm.Technical_MD]"] " [_ lorsm.Edit_Location]"] + set title "[_ lorsm.lt_Edit_Technical_MD_Loc]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" \im\\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.Add_Location]"] + set title "[_ lorsm.lt_Add_Technical_MD_Loca]" +} + +# Form + +ad_form -name technicalmd_loca \ + -cancel_url ../technicalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_te_lo_id:key(ims_md_technical_location_seq) + + {type:text,nospell,optional + {section "[_ lorsm.lt_AddEdit_Technical_MD__3]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Reference_to_location]"} + {label "[_ lorsm.Type_1]"} + } + + {location:text,nospell + {html {size 50}} + {help_text "[_ lorsm.lt_Location_of_the_resou]"} + {label "[_ lorsm.Location_1]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + + +} -select_query {select * from ims_md_technical_location where ims_md_te_lo_id = :ims_md_te_lo_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_technical_location + set type = :type, + location = :location + where ims_md_te_lo_id = :ims_md_te_lo_id " + +} -new_data { + db_dml do_insert " + insert into ims_md_technical_location (ims_md_te_lo_id, ims_md_id, type, location) + values + (:ims_md_te_lo_id, :ims_md_id, :type, :location)" + +} -after_submit { + ad_returnredirect [export_vars -base "../technicalmd" {ims_md_id}] + ad_script_abort +} + +# Technical Location +template::list::create \ + -name d_te_loca \ + -multirow d_te_loca \ + -no_data "[_ lorsm.lt_No_Location_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + type { + label "[_ lorsm.Type]" + } + location { + label "[_ lorsm.Location]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "technical_loca" {ims_md_te_lo_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_te_loca select_te_loca { + select type, + location, + ims_md_te_lo_id, + ims_md_id + from + ims_md_technical_location + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_otr.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_otr.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_otr.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Technical Metadata Other Platform Requirements</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Technical Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Other Platform Requirements: </td> + <td><listtemplate name= "d_te_otr"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Technical Metadata Other Platform Requirements</h3> +<blockquote> + <formtemplate id="technicalmd_otr" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_otr.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_otr.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_otr.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,88 @@ +# packages/lorsm/www/md/technicalmd/technical_otr.tcl + +ad_page_contract { + + Add/Edit Technical MD Other Platform Requirements + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: technical_otr.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" \\\i\m\\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.lt_AddEdit_Other_Platfor]"] +set title "[_ lorsm.lt_AddEdit_Technical_MD__4]" + +# Form + +ad_form -name technicalmd_otr \ + -cancel_url ../technicalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {otr_plt_l:text,nospell + {section "[_ lorsm.lt_AddEdit_Technical_MD__4]"} + {html {size 10}} + {help_text "[_ lorsm.lt_ie_en_AU_for_Australi]"} + {label "[_ lorsm.Language]"} + } + + {otr_plt_s:text(textarea),nospell + {html {rows 5 cols 60}} + {help_text "[_ lorsm.lt_Information_on_other_]"} + {label "[_ lorsm.lt_Other_Platform_Requir]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the tech other platform req details already exist... + + if {[db_0or1row select_size {select ims_md_id from ims_md_technical where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_technical + set otr_plt_l = :otr_plt_l, + otr_plt_s = :otr_plt_s + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_technical (ims_md_id, otr_plt_l, otr_plt_s) + values + (:ims_md_id, :otr_plt_l, :otr_plt_s)" + } + +} -after_submit { + ad_returnredirect [export_vars -base "../technicalmd" {ims_md_id}] + ad_script_abort +} + +# Technical Installation Remarks +template::list::create \ + -name d_te_otr \ + -multirow d_te_otr \ + -no_data "[_ lorsm.lt_No_Other_Platform_Req]" \ + -html { align right style "width: 100%;" } \ + -elements { + otr_plt { + label "[_ lorsm.Other_Platform_Req]" + } + } + +db_multirow d_te_otr select_te_otr { + select + '[' || otr_plt_l || ']' || ' ' || otr_plt_s as otr_plt, + ims_md_id + from + ims_md_technical + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_req.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_req.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_req.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>List of Technical Metadata Requirements</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Technical Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Requirements: </td> + <td><listtemplate name= "d_te_req"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Technical Metadata Requirement</h3> +<blockquote> + <formtemplate id="technicalmd_req" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_req.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_req.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_req.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,139 @@ +# packages/lorsm/www/md/technicalmd/technical_req.tcl + +ad_page_contract { + + Add/Edit Technical MD Requirement + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: technical_req.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer + ims_md_te_rq_id:integer,optional +} -properties { +} -validate { +} -errors { +} + +# set context & title +if { ![ad_form_new_p -key ims_md_te_rq_id]} { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" \\im\\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.Edit_Requirement]"] + set title "[_ lorsm.lt_Edit_Technical_MD_Req]" +} else { + set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" \\im\\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.Add_Requirement]"] + set title "[_ lorsm.lt_Add_Technical_MD_Requ]" +} + +# Form + +ad_form -name technicalmd_req \ + -cancel_url ../technicalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + ims_md_te_rq_id:key(ims_md_technical_requirement_seq) + + {type_s:text,nospell + {section "[_ lorsm.lt_AddEdit_Technical_MD__5]"} + {html {size 10}} + {help_text "[_ lorsm.lt_Source_of_vocabulary_]"} + {label "[_ lorsm.Source]"} + } + + {type_v:text,nospell + {html {size 20}} + {help_text "[_ lorsm.Type_of_requirement]"} + {label "[_ lorsm.Type_1]"} + } + + {name_v:text,nospell + {html {size 20}} + {help_text "[_ lorsm.lt_Name_of_required_item]"} + {label "[_ lorsm.Name_1]"} + } + + {min_version:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Lowest_version_of_the]"} + {label "[_ lorsm.Minimum_Version]"} + } + + {max_version:text,nospell + {html {size 10}} + {help_text "[_ lorsm.lt_Highest_version_of_th]"} + {label "[_ lorsm.Maximum_Version]"} + } + + {ims_md_id:text(hidden) {value $ims_md_id} + } + +} -select_query { + select * from + ims_md_technical_requirement + where + ims_md_te_rq_id = :ims_md_te_rq_id and ims_md_id = :ims_md_id + +} -edit_data { + db_dml do_update " + update ims_md_technical_requirement + set type_v = :type_v, + type_s = :type_s, + name_v = :name_v, + name_s = :type_s, + min_version = :min_version, + max_version = :max_version + where ims_md_te_rq_id = :ims_md_te_rq_id" + +} -new_data { + db_dml do_insert " + insert into ims_md_technical_requirement (ims_md_te_rq_id, ims_md_id, type_s, type_v, name_s, name_v, min_version, max_version) + values (:ims_md_te_rq_id, :ims_md_id, :type_s, :type_v, :type_s, :name_v, :min_version, :max_version)" + +} -after_submit { + ad_returnredirect [export_vars -base "../technicalmd" {ims_md_id}] + ad_script_abort +} + +# Technical Requirements +template::list::create \ + -name d_te_req \ + -multirow d_te_req \ + -no_data "No Requirements Available" \ + -html { align right style "width: 100%;" } \ + -elements { + type { + label "[_ lorsm.Type]" + } + name { + label "[_ lorsm.Name]" + } + min_version { + label "[_ lorsm.Min_Version]" + } + max_version { + label "[_ lorsm.Max_Version]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "technical_req" {ims_md_te_rq_id ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record] "} + html { align center } + } + } + +db_multirow d_te_req select_te_req { + select + '[' || type_s || ']' || ' ' || type_v as type, + '[' || name_s || ']' || ' ' || name_v as name, + min_version, + max_version, + ims_md_te_rq_id, + ims_md_id + from + ims_md_technical_requirement + where + ims_md_id = :ims_md_id +} + Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_size.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_size.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_size.adp 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,29 @@ +<master> +<property name="title">@title;noquote@</property> +<property name="context">@context;noquote@</property> + +<include src="../form-md-record/md-record" + ims_md_id="@ims_md_id;noquote@" +/> + +<hr> + +<h3>Technical Metadata Size</h3> +<blockquote> + <table cellspacing="2" cellpadding="2" border="0" width="50%"> + <tr class="form-section"> + <th colspan="2">Technical Metadata</th> + </tr> + <tr class="form-section"> + <td class="form-section">Size: </td> + <td><listtemplate name= "d_te_size"></listtemplate></td> + </tr> + + </table> +</blockquote> +<p> + +<h3>Add/Edit Technical Metadata Size</h3> +<blockquote> + <formtemplate id="technicalmd_size" style="standard-lars"></formtemplate> +</blockquote> Index: openacs-4/packages/lors-central/www/md/technicalmd/technical_size.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/md/technicalmd/technical_size.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/md/technicalmd/technical_size.tcl 17 May 2005 16:21:27 -0000 1.1 @@ -0,0 +1,86 @@ +# packages/lorsm/www/md/technicalmd/technical_size.tcl + +ad_page_contract { + + Add/Edit Technical MD Size + + @author Gerard Low (glow5809@mail.usyd.edu.au) + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 16 October 2004 + @cvs-id $Id: technical_size.tcl,v 1.1 2005/05/17 16:21:27 miguelm Exp $ + +} { + ims_md_id:integer +} -properties { +} -validate { +} -errors { +} + +# set context & title +set context [list [list [export_vars -base ".." ims_md_id] "[_ lorsm.IMS_Metadata_Editor]"] [list [export_vars -base "../technicalmd" \im\s_md_id] "[_ lorsm.Technical_MD]"] "[_ lorsm.Edit_Size]"] +set title "[_ lorsm.lt_AddEdit_Technical_MD__6]" + +# Form + +ad_form -name technicalmd_size \ + -cancel_url ../technicalmd?ims_md_id=$ims_md_id \ + -mode edit \ + -form { + + {t_size:text,nospell + {section "[_ lorsm.lt_AddEdit_Technical_MD__6]"} + {html {size 30}} + {help_text "[_ lorsm.lt_Size_of_the_resource_]"} + {label "[_ lorsm.Size]"} + } + {ims_md_id:text(hidden) {value $ims_md_id}} + +} -on_submit { + # check if the tech size details already exist... + + if {[db_0or1row select_size {select ims_md_id from ims_md_technical where ims_md_id = :ims_md_id}]} { + + db_dml do_update " + update ims_md_technical + set t_size = :t_size + where ims_md_id = :ims_md_id " + + } else { + + db_dml do_insert " + insert into ims_md_technical (ims_md_id, t_size) + values + (:ims_md_id, :t_size) " + } + +} -after_submit { + ad_returnredirect [export_vars -base "../technicalmd" {ims_md_id}] + ad_script_abort +} + +# Technical Size +template::list::create \ + -name d_te_size \ + -multirow d_te_size \ + -no_data "[_ lorsm.No_Size_Available]" \ + -html { align right style "width: 100%;" } \ + -elements { + t_size_bytes { + label "[_ lorsm.Size_1]" + } + export { + display_eval {\[Edit\]} + link_url_eval { [export_vars -base "technical_size" {ims_md_id}] } + link_html {title "[_ lorsm.Edit_Record]"} + html { align center } + } + } + +db_multirow d_te_size select_te_size { + select t_size || ' bytes' as t_size_bytes, + ims_md_id + from + ims_md_technical + where + ims_md_id = :ims_md_id +} Index: openacs-4/packages/lors-central/www/tracking/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/tracking/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/tracking/index.adp 17 May 2005 16:21:28 -0000 1.1 @@ -0,0 +1,9 @@ +<master> + <property name="title">@title@</property> + <property name="context">@context@</property> + +<blockquote> + <listtemplate name="student_track"></listtemplate><br /><br /> + <listtemplate name="object_views"></listtemplate> +</blockquote> + Index: openacs-4/packages/lors-central/www/tracking/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/tracking/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/tracking/index.tcl 17 May 2005 16:21:28 -0000 1.1 @@ -0,0 +1,226 @@ +# packages/lorsm/www/tracking/index.tcl + +ad_page_contract { + + Student Tracking Index Page + + @author Ernie Ghiglione (ErnieG@mm.st) + @creation-date 2004-05-25 + @arch-tag a5b230ee-0fa7-4e48-be1b-eeae323291e7 + @cvs-id $Id: index.tcl,v 1.1 2005/05/17 16:21:28 miguelm Exp $ +} { + man_id:integer,notnull + { lorsm_instance_id "" } + { community_id "" } + {item_id 0} + group:optional +} -properties { +} -validate { +} -errors { +} + +# set package_id [ad_conn package_id] +# set community_id [dotlrn_community::get_community_id] + +if { ![empty_string_p $lorsm_instance_id] } { + set package_id $lorsm_instance_id +} +if { ![empty_string_p $community_id] } { + set community_id $community_id +} + +# set admin_p [dotlrn::user_can_admin_community_p \ + -user_id [ad_conn user_id] \ + -community_id $community_id ] + +# Permissions +# dotlrn::require_user_admin_community -user_id [ad_conn user_id] -community_id $community_id + +set title [list "[_ lorsm.Student_Tracking]"] +set context [list "[_ lorsm.Tracking_1]"] + +if {![exists_and_not_null group]} { + set group 1 +} + +if {$group == 1} { + + template::list::create \ + -name student_track \ + -multirow student_track \ + -actions [list "[_ lorsm.Summarize]" [export_vars -base ".?group=0" {man_id item_id lorsm_instance_id community_id}] "[_ lorsm.lt_Summarize_all_student]"] \ + -key man_id \ + -html {width 50%} \ + -no_data "[_ lorsm.No_Students]" \ + -elements { + student_name { + label "[_ lorsm.Student_Name]" + display_eval {[person::name -person_id $student_name]} + link_url_eval {[acs_community_member_url -user_id $student_name]} + link_html {title "[_ lorsm.Students_profile]"} + } + start_time { + label "[_ lorsm.Start_Course]" + display_eval {[lc_time_fmt $start_time "%x %T"]} + html { align center } + } + end_time { + label "[_ lorsm.Exit_Course]" + display_eval {[lc_time_fmt $end_time "%x %T"]} + html { align center } + } + time_spend { + label "[_ lorsm.Time_Spent]" + display_eval {[lorsm::dates_calc -start_date [string range $start_time 0 18] -end_date [string range $end_time 0 18]]} + html { align center } + } + } + + db_multirow -extend { ims_md_id } student_track select_students { + select + user_id as student_name, + start_time, + end_time + from + lorsm_student_track + where + community_id = :community_id + and + course_id = :man_id + and + end_time NOTNULL + order by + start_time desc + } { + set ims_md_id $man_id + } + + template::list::create \ + -name object_views \ + -multirow object_views \ + -elements { + title { + label "[_ lorsm.Title_1]" + } + viewer_name { + label "[_ lorsm.Viewed_By]" + } + views { + label "[_ lorsm.Total_Views]" + } + last_viewed { + label "[_ lorsm.Last_Viewed_On]" + display_eval {[lc_time_fmt $last_viewed "%x %X"]} + } + } + + if {$item_id} { + set extra_where " and v.object_id in ( select revision_id from cr_revisions where item_id = ( + select item_id from cr_revisions where revision_id = :item_id))" + } else { + set extra_where "" + } + + db_multirow -extend {viewer_name} object_views objects_views " + select v.*, + i.item_title as title + from views v, + ims_cp_items i, + ims_cp_organizations o + where + i.ims_item_id = v.object_id + and + i.org_id = o.org_id + and + o.man_id = :man_id + $extra_where + " { + set viewer_name [acs_user::get_element -user_id $viewer_id -element name] + } + +} else { + # group display + + template::list::create \ + -name student_track \ + -multirow student_track \ + -key man_id \ + -actions [list "[_ lorsm.Expand]" [export_vars -base ".?group=1" {man_id item_id lorsm_instance_id community_id}] "Expand all students"] \ + -html {width 50%} \ + -no_data "[_ lorsm.No_Students]" \ + -elements { + student_name { + label "Student Name" + display_eval {[person::name -person_id $student_name]} + link_url_eval {[acs_community_member_url -user_id $student_name]} + link_html {title "Student's profile"} + } + counter { + label "[_ lorsm.Times_Viewed]" + html { align center } + } + time_spent { + label "[_ lorsm.Time_Spent]" + html { align center } + } + } + + db_multirow -extend { ims_md_id } student_track select_students { + select + user_id as student_name, + count(*) as counter, + sum(end_time - start_time) as time_spent + from + lorsm_student_track + where + community_id = :community_id + and + course_id = :man_id + and + end_time NOTNULL + group by user_id + + } { + set ims_md_id $man_id + } + + template::list::create \ + -name object_views \ + -multirow object_views \ + -elements { + title { + label "[_ lorsm.Title_1]" + } + views { + label "[_ lorsm.Total_Views]" + } + unique_views { + label "[_ lorsm.Unique_Views]" + } + last_viewed { + label "[_ lorsm.Last_Viewed_On]" + } + } + + if {$item_id} { + set extra_where " and v.object_id = :item_id" + } else { + set extra_where "" + } + + db_multirow object_views objects_views " + select v.*, + i.item_title as title + from view_aggregates v, + ims_cp_items i, + ims_cp_organizations o + where + i.ims_item_id = v.object_id + and + i.org_id = o.org_id + and + o.man_id = :man_id + $extra_where + " + +}