Index: openacs-4/packages/lors-central/lors-central.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/lors-central.info,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/lors-central.info 17 May 2005 16:07:47 -0000 1.1 +++ openacs-4/packages/lors-central/lors-central.info 31 May 2005 22:57:22 -0000 1.2 @@ -17,7 +17,7 @@ - + @@ -26,7 +26,8 @@ - + + 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/catalog/lors-central.en_US.ISO-8859-1.xml 17 May 2005 16:21:16 -0000 1.1 +++ openacs-4/packages/lors-central/catalog/lors-central.en_US.ISO-8859-1.xml 31 May 2005 22:57:22 -0000 1.2 @@ -1,32 +1,38 @@ - + Action Not Allowed Add Child Add an existent Learning Object Add File Add From Clipboard: + Add Material Add Object Add This Item Add this learning object to your clipboard Add to Clipboard Add to this course Add to this resource + Admin All Views All Views of this object And is in use in the following courses Associations: Associate Associate/Drop - Associate to dotLRN Class + Associate to dotLRN Class or Community Associate to this class Already Associated Author: + Back Choose the file to upload + Class Memberships Class Name Classes Using this Course Click For Preview Clip This Resource + Community Memberships + Community Name Course Name Course Versions Courses @@ -36,13 +42,19 @@ Description Disabled dotLRN classes + dotLRN Communities Drop Drop association to this class Edit Edit %name% + E-mail Enabled Everywhere Filename + Grant + Grant Permission to this users + Grant Permissions + Grant / Revoke Use the "Browse..." button to locate your file, then click "Open" Here Hide @@ -54,13 +66,18 @@ Live Live Classes? Learning Object Files + Lors Central Admin + Lors Central Package Make Make Live Everywhere Make this live Manifest ID + Manage + Memberships Add New File New Learning Object No + Not Allowed of of %name% One Course @@ -70,8 +87,14 @@ One Learning Object Please type a keyword Preview + priviliges to all members + Privilege on + Revoke + Revoke Permission to this users Search Search Courses + Search for users first names, last name or email: + Search users to grant/revoke privileges Set to Shared? Shared Items In The Repository @@ -92,6 +115,8 @@ Update Versions Upload a New File or.... Usage + users to grant privileges that match that search + User Name Version Ver. # Versions 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/catalog/lors-central.es_ES.ISO-8859-1.xml 17 May 2005 16:21:16 -0000 1.1 +++ openacs-4/packages/lors-central/catalog/lors-central.es_ES.ISO-8859-1.xml 31 May 2005 22:57:22 -0000 1.2 @@ -12,6 +12,7 @@ Agregar al sujetapapeles Agregar a este curso Agregar a este recurso + Administrar Todas las vistas Todas las vistas de este objeto Y esta siendo utilizado en los siguientes cursos @@ -23,26 +24,35 @@ Already Asociado Autor: Escoja el archivo que desea subir + Membresias con Clases Nombre de la Clase Clases que utilizan este curso Click para previsualizar Sujetar este Recurso + Membresias con Comunidades + Nombre de la comunidad Nombre del Curso Versiones del Curso Cursos - Crear el nuevo archivo + Crear el nuevo archivo o ... Actual Nombre del Departamento Descripcion Deshabilitado classes de dotLRN + comunidades de dotLRN/msg> Quitar Quitar la asociacion de esta clase Editar Editar %name% + Correo Electronico Habilitado En todos lados Nombre del archivo + Otorgar + Otorgar permisos a este usuario + Otorgar permisos + Otorgar / Quitar Utilizar el boton de "Browse..." para localizar el archivo, luego presionar"Open" Aqui Ocultar @@ -54,13 +64,16 @@ Actual Clases donde es el actual? Archivos del Objeto de Aprendizaje + Administracion de Lors Central Hacer Cambiar a actual en todas las clases Poner actual en esta clase ID del Manifesto + Membresias Agregar Nuevo Archivo Nuevo Objeto de Aprendisaje No + no otorgado de de %name% Un Curso @@ -70,8 +83,14 @@ Un Objeto de Aprendizaje Por favor ingrese una palabra Previsualizacion + privilegios a todos los miembros + Privilegios sobre + Quitar + Quitar privilegios a estos usuarios Buscar Buscar Cursos + Buscar por el nombre, apellido o correo electronico del usuario: + Buscar usarios a Otorgar/Quitar privilegios Establecer aCompartido? Objetos Compartidos en el repositorio> @@ -92,6 +111,8 @@ Actualizar Versiones Subir un Nuevo Archivo o.... Utilizacion + hay usarios a otorgar privilefios que coincidan con esa busqueda + Nombre del Usuario Version Ver. # Versiones 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/catalog/lors-central.es_GT.ISO-8859-1.xml 17 May 2005 16:21:16 -0000 1.1 +++ openacs-4/packages/lors-central/catalog/lors-central.es_GT.ISO-8859-1.xml 31 May 2005 22:57:22 -0000 1.2 @@ -12,6 +12,7 @@ Agregar al sujetapapeles Agregar a este curso Agregar a este recurso + Administrar Todas las vistas Todas las vistas de este objeto Y esta siendo utilizado en los siguientes cursos @@ -23,26 +24,35 @@ Already Asociado Autor: Escoja el archivo que desea subir + Membresias con Clases Nombre de la Clase Clases que utilizan este curso Click para previsualizar Sujetar este Recurso + Membresias con Comunidades + Nombre de la comunidad Nombre del Curso Versiones del Curso Cursos - Crear el nuevo archivo + Crear el nuevo archivo o ... Actual Nombre del Departamento Descripcion Deshabilitado classes de dotLRN + comunidades de dotLRN/msg> Quitar Quitar la asociacion de esta clase Editar Editar %name% + Correo Electronico Habilitado En todos lados Nombre del archivo + Otorgar + Otorgar permisos a este usuario + Otorgar permisos + Otorgar / Quitar Utilizar el boton de "Browse..." para localizar el archivo, luego presionar"Open" Aqui Ocultar @@ -54,13 +64,16 @@ Actual Clases donde es el actual? Archivos del Objeto de Aprendizaje + Administracion de Lors Central Hacer Cambiar a actual en todas las clases Poner actual en esta clase ID del Manifesto + Membresias Agregar Nuevo Archivo Nuevo Objeto de Aprendisaje No + no otorgado de de %name% Un Curso @@ -70,8 +83,14 @@ Un Objeto de Aprendizaje Por favor ingrese una palabra Previsualizacion + privilegios a todos los miembros + Privilegios sobre + Quitar + Quitar privilegios a estos usuarios Buscar Buscar Cursos + Buscar por el nombre, apellido o correo electronico del usuario: + Buscar usarios a Otorgar/Quitar privilegios Establecer aCompartido? Objetos Compartidos en el repositorio> @@ -92,6 +111,8 @@ Actualizar Versiones Subir un Nuevo Archivo o.... Utilizacion + hay usarios a otorgar privilefios que coincidan con esa busqueda + Nombre del Usuario Version Ver. # Versiones 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/tcl/lors-central-install-procs.tcl 17 May 2005 16:21:18 -0000 1.1 +++ openacs-4/packages/lors-central/tcl/lors-central-install-procs.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -95,3 +95,19 @@ # Calling apm callback proc for notifications lors_central::apm_callback::package_install } + +ad_proc -private lors_central::install::package_uninstall {} { + + Uninstall lors-central + +} { + set folder_id [lors_central::get_root_folder_id] + content::folder::delete -folder_id $folder_id -cascade_p "t" + set folder_id [lors_central::get_root_organizations_folder_id] + content::folder::delete -folder_id $folder_id -cascade_p "t" + set folder_id [lors_central::get_root_resources_folder_id] + content::folder::delete -folder_id $folder_id -cascade_p "t" + set folder_id [lors_central::get_root_manifest_folder_id] + content::folder::delete -folder_id $folder_id -cascade_p "t" + set folder_id [lors_central::get_root_items_folder_id] +} 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/tcl/lors-central-procs.tcl 17 May 2005 16:21:18 -0000 1.1 +++ openacs-4/packages/lors-central/tcl/lors-central-procs.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -8,6 +8,14 @@ namespace eval lors_central {} +ad_proc -private lors_central::owner { + -user_id:required + -object_id:required +} { + Returns 1 if user_id is the creator of the object_id, 0 otherwise +} { + return [db_string get_creation_user { } -default 0] +} ad_proc -private lors_central::get_ims_item_id_or_res_id { {-ims_item_id ""} @@ -23,14 +31,68 @@ } } -ad_proc -private lors_central::is_swa { +ad_proc -private lors_central::check_permissions { + {-object_id ""} + {-check_inst ""} } { - Check if the user (default to logged in user) has site_wide_admin privileges + Checks several privileges for user_id, default to logged user over the system. + + @object_id Send this if you want to check if user_id has permissions over this object_id. + @check_inst Set it to "t" if you want to check if the user_id that watch's this page is an dotlrn + instructor. } { - if { ![acs_user::site_wide_admin_p] } { - ad_returnredirect "not-allowed" + if { ![info exist user_id] } { + set user_id [ad_conn user_id] + } + set package_id [ad_conn package_id] + + # Get the number specified in the parameter, this parameter tell if + # only the swa can manage lors-central or any one else + set sec_level [parameter::get -parameter "ManageLorsCentralP"] + + if { $sec_level } { + if { ![acs_user::site_wide_admin_p] } { + ad_return_complaint 1 "[_ lors-central.we_are_sorry]" + ad_script_abort + } else { + return + } + } else { + if { ![empty_string_p $check_inst] } { + if { ![lors_central::check_inst -user_id $user_id] } { + ad_return_complaint 1 "[_ lors-central.we_are_sorry]" + ad_script_abort + } + } + if { ![empty_string_p $object_id] } { + permission::require_permission -party_id $user_id -object_id $object_id -privilege "admin" + } + } + return +} + +ad_proc -private lors_central::check_inst { + -user_id:required + {-community_id ""} +} { + Checks if user id has instructor or admin role in @community_id@ or any community_id, returns 1 if it does, + 0 otherwise +} { + if { [acs_user::site_wide_admin_p] } { + return 1 ad_script_abort } + if { ![empty_string_p $community_id] } { + set extra_query "and community_id = $community_id" + } else { + set extra_query "" + } + set count [db_string check_inst { } -default 0] + if { $count > 0 } { + return 1 + } else { + return 0 + } } ad_proc -private lors_central::set_sort_order { @@ -88,27 +150,33 @@ ad_proc -private lors_central::get_root_folder_id { } { - Returns the folder_id of the folder with the name "LORS Root Folder" + Returns the folder_id of the folder with the name "LORSM Root Folder" } { return [db_string get_folder_id_from_name { } ] } +ad_proc -private lors_central::get_root_organizations_folder_id { } { + Returns the folder_id of the folder with the name "LORSM Organizations 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" + Returns the folder_id of the folder with the name "LORSM 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" + Returns the folder_id of the folder with the name "LORSM 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" + Returns the folder_id of the folder with the name "LORSM Items Folder" } { return [db_string get_folder_id_from_name { } ] } @@ -267,14 +335,19 @@ ad_proc -private lors_central::relation_between { - -item_id:required + {-item_id ""} -community_id:required + {-man_id ""} } { Returns the 1 if there is an association between a dotlrn class or community - and the item_id, 0 otherwise. + and the item_id, 0 otherwise, you should provide either man_id or item_id @man_id@ The manifest id of the course + @item_id@ The item_id that has all manifests as revisions @community_id@ The class_id or community_id of dotlrn } { + if { ![empty_string_p $man_id] } { + set item_id [lors_central::get_item_id -revision_id $man_id] + } return [db_string get_relation { } -default 0] } 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/tcl/lors-central-procs.xql 17 May 2005 16:21:18 -0000 1.1 +++ openacs-4/packages/lors-central/tcl/lors-central-procs.xql 31 May 2005 22:57:22 -0000 1.2 @@ -1,7 +1,31 @@ + + + select + 1 + from + acs_objects + where + creation_user = :user_id and + object_id = :object_id + + + + + select + count(user_id) + from + dotlrn_member_rels_full + where + user_id = :user_id and + ( role = 'admin' or role = 'instructor' ) + $extra_query + + + select @@ -238,6 +262,18 @@ + + + select + folder_id + from + cr_folders + where + label = 'LORSM Organizations Folder' + + + + select 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/add-exist-item.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/add-exist-item.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -11,8 +11,8 @@ item_man_id:notnull } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set the_ims_item_id $ims_item_id set user_id [ad_conn user_id] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/add-lo.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/add-lo.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -13,8 +13,8 @@ set user_id [ad_conn user_id] -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set new_lo_link "man_id=$man_id&org_id=$org_id&parent=$parent_item" set page_title [_ lors-central.add_an_existent] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/change-lo-version.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/change-lo-version.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -12,8 +12,8 @@ live_hide_p:notnull } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions if { ![info exist name] } { set name [db_string get_name { select item_title from ims_cp_items where ims_item_id = :ims_item_id }] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/change-one-lo-version.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/change-one-lo-version.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -10,8 +10,8 @@ objects_value:multiple } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions # object_id: A list of communities ids # object_value: The version number to set the revision 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/change-one-version.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/change-one-version.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -14,8 +14,8 @@ } } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions # Validation of Range set i 0 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-add-2.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-add-2.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -26,8 +26,8 @@ } } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions # To support versions if { ![info exist man_id] } { 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-add-3.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-add-3.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -27,13 +27,13 @@ } } -# 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 +# Checking privilege over lors-central +lors_central::check_permissions + + # Display progress bar ad_progress_bar_begin \ -title "[_ lorsm.Uploading_course]" \ @@ -316,6 +316,7 @@ ns_write "[_ lorsm.lt_Granting_permissions__1 [list course_name $course_name]]
" # PERMISSIONS FOR MANIFEST and learning objects + permission::grant -party_id $user_id -object_id $man_id -privilege admin # set up in the same way as permissions for the file storage # objects. As we want to maintain consistency btw the 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-add.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-add.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -13,8 +13,8 @@ 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 +# Checking privilege over lors-central +lors_central::check_permissions if { ![info exists man_id] } { set man_id "" 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-admin.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-admin.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -8,7 +8,7 @@ } # Checking swa privilege over lors-central -lors_central::is_swa +lors_central::check_permissions set title "[_ lorsm.lt_Manage_Courses_in_Rep]" 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-associate.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-associate.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -10,9 +10,16 @@ { return_url "" } } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions +# Display progress bar +ad_progress_bar_begin \ + -title "[_ lors-central.associate_to]" \ + -message_1 "[_ lors-central.associate_to]" \ + -message_2 "[_ lorsm.lt_We_will_continue_auto]" + + set man_id [content::item::get_live_revision -item_id $item_id] foreach community_id $object_id { @@ -34,8 +41,8 @@ if { [empty_string_p $return_url] } { - ad_returnredirect "course-dotlrn-assoc?item_id=$item_id" + ad_progress_bar_end -url "course-dotlrn-assoc?item_id=$item_id" } else { - ad_returnredirect $return_url + ad_progress_bar_end -url $return_url } 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-association-drop.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-association-drop.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -9,10 +9,17 @@ { return_url "" } } -# Checking swa privilege over lors-central -lors_central::is_swa +# Display progress bar +ad_progress_bar_begin \ + -title "[_ lors-central.associate_to]" \ + -message_1 "[_ lors-central.associate_to]" \ + -message_2 "[_ lorsm.lt_We_will_continue_auto]" +# Checking privilege over lors-central +lors_central::check_permissions + + 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 @@ -25,8 +32,8 @@ } if { [empty_string_p $return_url] } { - ad_returnredirect "course-dotlrn-assoc?item_id=$item_id" + ad_progress_bar_end -url "course-dotlrn-assoc?item_id=$item_id" } else { - ad_returnredirect $return_url + ad_progress_bar_end -url $return_url } 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-dotlrn-assoc.adp 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-dotlrn-assoc.adp 31 May 2005 22:57:22 -0000 1.2 @@ -2,6 +2,23 @@ @title;noquote@ @context;noquote@ - -

- +

#lors-central.dotlrn_classes#

+ + +
+
+ +
+ +
+
+

#lors-central.dotlrn_communities#

+ +
+ +
+ + +
+ +
\ No newline at end of file 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -8,8 +8,8 @@ item_id:integer,optional } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set title [_ lors-central.associate_to] @@ -155,3 +155,98 @@ } } + +##################################### COMMUNITIES ########################################################### +##################################### TO ASSOCIATE ########################################################## + +db_multirow -extend { rel type } coms_list get_dotlrn_coms { } { + set rel [lors_central::relation_between -item_id $item_id -community_id $com_id] + set type dotlrn_club +} + +template::list::create \ + -name coms_list \ + -multirow coms_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_communities]" \ + -elements { + check_box { + class "list-narrow" + label "" + display_template { + + } + } + class { + label "[_ lors-central.community_name]" + display_template { + @coms_list.pretty_name@ + } + } + associate { + display_template { + + #lors-central.associated# + + } + } + } + + +############################## TO DROP ASSOCIATION ###################################### + +db_multirow -extend { rel type } coms_list_drop get_dotlrn_coms_drop { } { + set rel [lors_central::relation_between -item_id $item_id -community_id $com_id] +} + +template::list::create \ + -name coms_list_drop \ + -multirow coms_list_drop \ + -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 + type + }\ + -row_pretty_plural "[_ lors-central.dotlrn_classes]" \ + -elements { + check_box { + class "list-narrow" + label "" + display_template { + + } + } + class { + label "[_ lors-central.community_name]" + display_template { + @coms_list_drop.pretty_name@ + } + } + associate { + display_template { + + #lors-central.associated# + + } + } + } 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-dotlrn-assoc.xql 31 May 2005 22:57:22 -0000 1.2 @@ -11,7 +11,7 @@ dc.pretty_name, dc.url from - dotlrn_class_instances_full dc + dotlrn_class_instances_full dc, dotlrn_instructor_rels_full drf where dc.class_instance_id not in ( @@ -27,7 +27,10 @@ from cr_revisions where item_id = :item_id ) - ) + ) and + drf.community_id = dc.class_instance_id and + drf.user_id = :user_id and + drf.role = 'instructor' order by department_name, term_name, class_name, pretty_name
@@ -42,7 +45,7 @@ dc.pretty_name, dc.url from - dotlrn_class_instances_full dc + dotlrn_class_instances_full dc, dotlrn_instructor_rels_full drf where dc.class_instance_id in ( @@ -57,12 +60,76 @@ from cr_revisions where item_id = :item_id ) - ) + ) and + drf.community_id = dc.class_instance_id and + drf.user_id = :user_id and + drf.role = 'instructor' order by department_name, term_name, class_name, pretty_name + + + select + dc.community_id as com_id, + dc.pretty_name, + dc.url + from + dotlrn_communities_full dc, dotlrn_member_rels_full dm + where + dc.community_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 + ) + ) and + dm.community_id = dc.community_id and + dm.user_id = :user_id and + dm.role = 'admin' + order by pretty_name + + + + + + select + dc.community_id as com_id, + dc.pretty_name, + dc.url + from + dotlrn_communities_full dc, dotlrn_member_rels_full dm + where + dc.community_id in + ( + select + icmc.community_id + from + ims_cp_manifest_class icmc + where + man_id in + ( + select revision_id + from cr_revisions + where item_id = :item_id + ) + ) and + dm.community_id = dc.community_id and + dm.user_id = :user_id and + dm.role = 'admin' + order by pretty_name + + +
\ 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-live-in.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-live-in.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -6,8 +6,8 @@ man_id:integer,optional } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set title "[_ lors-central.Classes_using]" set context [list [list "one-course-associations?man_id=$man_id" [_ lors-central.one_course_assoc]] \ 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-version-change.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-version-change.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -7,8 +7,8 @@ set user_id [ad_conn user_id] -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set item_id [lors_central::get_item_id -revision_id $man_id] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/course-versions.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/course-versions.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -9,8 +9,8 @@ set user_id [ad_conn user_id] -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions if { ![info exist item_id ] } { 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/edit-content.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/edit-content.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -23,8 +23,8 @@ set user_id [ad_conn user_id] -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions 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)}] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/file-content-edit.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/file-content-edit.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -32,8 +32,8 @@ nsv_lappend delivery_vars [ad_conn session_id] $ims_item_id -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions # check they have read permission on this 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/folder-description.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/folder-description.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -6,8 +6,8 @@ folder_id:integer,optional } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions if { ![info exists folder_id] } { # Get lorsm root folder_id 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/index.adp 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/index.adp 31 May 2005 22:57:22 -0000 1.2 @@ -2,6 +2,7 @@ @title@ @context@ +
admin

#lorsm.lt_Courses_in_your_Repos#

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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/index.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/index.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -8,9 +8,12 @@ keyword:optional } -# Checking swa privilege over lors-central -lors_central::is_swa +set user_id [ad_conn user_id] + +# Checking privilege over lors-central +lors_central::check_permissions + set title "[_ lorsm.lt_Manage_Courses_in_Rep]" set context [list "[_ lorsm.Manage_Courses]"] @@ -32,6 +35,11 @@ set extra_query "" } +# If user is not site wide we just show the courses where he/she has admin privilege over +if { ![acs_user::site_wide_admin_p] } { + append extra_query " and p.object_id = acs.object_id and p.privilege = 'admin' and p.grantee_id = :user_id" +} + set package_id [ad_conn package_id] set user_id [ad_conn user_id] set community_id [dotlrn_community::get_community_id] @@ -49,10 +57,11 @@ 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_]" +if { [lors_central::check_inst -user_id $user_id] } { + 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 \ 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/index.xql 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/index.xql 31 May 2005 22:57:22 -0000 1.2 @@ -19,7 +19,7 @@ acs.creation_user, acs.creation_date from - cr_revisions cr, acs_objects acs, cr_items ci + cr_revisions cr, acs_objects acs, cr_items ci, acs_permissions p where acs.object_id = cr.item_id and ci.item_id = cr.item_id and 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/new-clipboard-files.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/new-clipboard-files.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -12,6 +12,8 @@ set user_id [ad_conn user_id] +lors_central::check_permissions + 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 { } ] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/new-file.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/new-file.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -13,8 +13,8 @@ set user_id [ad_conn user_id] -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set page_title "[_ lors-central.new_file]" set context "[list [list [export_vars -base one-resource {res_id}] \ 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/new-learning-object.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/new-learning-object.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -16,8 +16,8 @@ } set user_id [ad_conn user_id] -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set title "[_ lors-central.new_object]" 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/one-course-associations.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/one-course-associations.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -11,8 +11,9 @@ } +set user_id [ad_conn user_id] +lors_central::check_permissions - # 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] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/one-course-item.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/one-course-item.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -11,8 +11,8 @@ {orderby "class,asc"} } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set displayed_object_id $ims_item_id 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/one-course-views.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/one-course-views.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -6,8 +6,8 @@ community_id:integer,notnull } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions # Get the item_id that the manifest_id has associated if { ![info exist item_id] } { 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/one-course.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/one-course.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -5,9 +5,6 @@ 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 { @@ -19,7 +16,11 @@ } } +set user_id [ad_conn user_id] +# Checking privilege over lors-central +lors_central::check_permissions -object_id $item_id + set package_id "" set title "[_ lors-central.one_course]" set assoc_num [db_string get_associations_num { } -default 0] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/one-file-live.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/one-file-live.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -11,8 +11,8 @@ {name "" } } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set file_item_id [lors_central::get_item_id -revision_id $file_id] 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 -N -r1.2 -r1.3 --- openacs-4/packages/lors-central/www/one-file.tcl 17 May 2005 22:58:36 -0000 1.2 +++ openacs-4/packages/lors-central/www/one-file.tcl 31 May 2005 22:57:22 -0000 1.3 @@ -13,8 +13,8 @@ ims_item_id:notnull } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions #if { [empty_string_p $name] } { # set name [db_string get_name { } -default "..."] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/one-learning-object.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/one-learning-object.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -11,8 +11,8 @@ {orderby "class,asc"} } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set displayed_object_id $ims_item_id 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/one-lo-files.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/one-lo-files.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -9,8 +9,8 @@ {name ""} } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions if { [empty_string_p $name] } { set name [db_string get_name { } -default "..."] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/one-object-edit.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/one-object-edit.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -15,8 +15,8 @@ {edit_p ""} } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set parent_item [db_string get_parent_item "select parent_item from ims_cp_items where ims_item_id = :ims_item_id"] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/reorder-items.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/reorder-items.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -7,8 +7,8 @@ sort_order:notnull } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions set ims_item_id $item_id set item_sort [db_string get_item_sort { }] 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/shared.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/shared.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -10,8 +10,8 @@ org_id:notnull } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions if { $shared } { set isshared f 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 -N -r1.1 -r1.2 --- openacs-4/packages/lors-central/www/tracker.tcl 17 May 2005 16:21:19 -0000 1.1 +++ openacs-4/packages/lors-central/www/tracker.tcl 31 May 2005 22:57:22 -0000 1.2 @@ -16,8 +16,8 @@ } -errors { } -# Checking swa privilege over lors-central -lors_central::is_swa +# Checking privilege over lors-central +lors_central::check_permissions 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