Index: openacs-4/packages/pages/catalog/pages.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/catalog/pages.en_US.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/catalog/pages.en_US.ISO-8859-1.xml 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,6 @@ + + + + Edit Page + Pages + Index: openacs-4/packages/pages/catalog/pages.es_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/catalog/pages.es_ES.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/catalog/pages.es_ES.ISO-8859-1.xml 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,6 @@ + + + + Editar P�gina + P�ginas + Index: openacs-4/packages/pages/catalog/pages.es_GT.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/catalog/pages.es_GT.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/catalog/pages.es_GT.ISO-8859-1.xml 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,5 @@ + + + + P�ginas + Index: openacs-4/packages/pages/tcl/pages-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/tcl/pages-callback-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/tcl/pages-callback-procs.tcl 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,149 @@ +ad_library { + Pages - Callbacks + + @creation-date Aug 2008 + @author Alvaro Rodriguez +} +::xo::db::require package xowiki + +namespace eval ::pages { + + ad_proc -private ::pages::after-mount { + {-package_id:required} + {-node_id:required} + } { + set community_id [dotlrn_community::get_community_id \ + -package_id [site_node::get_object_id \ + -node_id [site_node::get_parent_id -node_id $node_id]]] + set member_party_id [dotlrn_community::get_rel_segment_id \ + -community_id $community_id \ + -rel_type "dotlrn_member_rel"] + set admin_party_id [dotlrn_community::get_rel_segment_id \ + -community_id $community_id \ + -rel_type "dotlrn_admin_rel"] + permission::set_not_inherit -object_id $package_id + permission::grant -party_id $member_party_id \ + -object_id $package_id -privilege read + permission::grant -party_id $admin_party_id \ + -object_id $package_id -privilege read + permission::grant -party_id $admin_party_id \ + -object_id $package_id -privilege write + } + +} + +ad_proc -public -callback search::url -impl ::xowiki::Page {} { + + @author alvaro@viaro.net + @creation_date Jul-08 + + returns a url for a xowiki page to the search package + +} { + + set item_id [content::revision::item_id -revision_id $object_id] + set package_id [acs_object::package_id -object_id $object_id] + set page_name [pages::get_page_name -item_id $item_id] + set package_url [apm_package_url_from_id $package_id] + + return "${package_url}$page_name" +} + +ad_proc -public -callback search::url -impl ::xowiki::PlainPage {} { + + @author alvaro@viaro.net + @creation_date Jul-08 + + returns a url for a xowiki plain page to the search package + +} { + + set item_id [content::revision::item_id -revision_id $object_id] + set package_id [acs_object::package_id -object_id $object_id] + set page_name [pages::get_page_name -item_id $item_id] + set package_url [apm_package_url_from_id $package_id] + + return "${package_url}$page_name" +} + +ad_proc -public -callback planner::edit_url -impl ::xowiki::Page {} { + + @author alvaro@viaro.net + @creation_date Jul-08 + + returns a url for a xowiki page to the dotlrn blocks + +} { + + set item_id [content::revision::item_id -revision_id $object_id] + set package_id [acs_object::package_id -object_id $object_id] + set page_name [pages::get_page_name -item_id $item_id] + set package_url [apm_package_url_from_id $package_id] + + return "${package_url}$page_name?m=edit" +} + +ad_proc -public -callback planner::edit_url -impl ::xowiki::PlainPage {} { + + @author alvaro@viaro.net + @creation_date Jul-08 + + returns a url for a xowiki plain page to the dotlrn blocks + +} { + + set item_id [content::revision::item_id -revision_id $object_id] + set package_id [acs_object::package_id -object_id $object_id] + set page_name [pages::get_page_name -item_id $item_id] + set package_url [apm_package_url_from_id $package_id] + + return "${package_url}$page_name?m=edit" +} + +ad_proc -public -callback planner::delete_url -impl ::xowiki::Page {} { + + @author alvaro@viaro.net + @creation_date Jul-08 + + returns a url for a xowiki page to the dotlrn blocks + +} { + + set item_id [content::revision::item_id -revision_id $object_id] + set package_id [acs_object::package_id -object_id $object_id] + set page_name [pages::get_page_name -item_id $item_id] + set package_url [apm_package_url_from_id $package_id] + + return "${package_url}$page_name?m=delete" +} + +ad_proc -public -callback planner::delete_url -impl ::xowiki::PlainPage {} { + + @author alvaro@viaro.net + @creation_date Jul-08 + + returns a url for a xowiki plain page to the dotlrn blocks + +} { + + set item_id [content::revision::item_id -revision_id $object_id] + set package_id [acs_object::package_id -object_id $object_id] + set page_name [pages::get_page_name -item_id $item_id] + set package_url [apm_package_url_from_id $package_id] + + return "${package_url}$page_name?m=delete" +} + +ad_proc -public -callback planner::insert_object -impl xowiki {} { + + @author alvaro@viaro.net + @creation_date Jul-2008 + + Insert the recently created object into the blocks view objects table + +} { + if { ![empty_string_p $block_id] } { + set object_index [planner::get_next_object_index -block_id $block_id] + planner::insert_object_to_block -block_id $block_id -object_index $object_index -object_id $object_id + } +} Index: openacs-4/packages/pages/tcl/pages-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/tcl/pages-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/tcl/pages-procs.tcl 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,170 @@ +ad_library { + Pages - classess and procs + + @creation-date Aug 2008 + @author Alvaro Rodriguez + +} +::xo::db::require package xowiki + +namespace eval ::blocks { + + ::xo::PackageMgr create ::blocks::Package \ + -package_key "pages" -pretty_name "Pages" \ + -superclass ::xowiki::Package + + Package instproc initialize {} { + ::xowiki::WikiForm instmixin add BlockWikiForm + ::xowiki::PlainWikiForm instmixin add BlockPlainWikiForm + ::xowiki::Page instmixin add BlockPage + next + } + + Package instproc destroy {} { + ::xowiki::WikiForm instmixin delete ::blocks::BlockWikiForm + ::xowiki::PlainWikiForm instmixin delete ::blocks::BlockPlainWikiForm + ::xowiki::Page instmixin delete ::blocks::BlockPage + next + } + + # + # BlockPageForm + # + + Class create BlockWikiForm -superclass ::xowiki::WikiForm \ + -parameter { + {field_list {item_id name page_order title creator text description nls_language block_id}} + {f.name + {name:text(hidden),optional} + } + {f.block_id + {block_id:text(hidden)} + } + {f.page_order + {page_order:text(hidden),optional} + } + {validate { + {name {\[::xowiki::validate_name\]} {Another item with this name exists \ + already in this folder}}} + } + } + + BlockWikiForm instproc new_data {} { + my instvar data + set item_id [next] + set block_id [$data set block_id] + callback -catch -impl "planner" planner::insert_object -block_id $block_id -object_id $item_id + } + + BlockWikiForm instproc edit_data {} { + my data_from_form -new 0 + set item_id [next] + callback -catch -impl "planner" planner::flush_blocks_cache -community_id [dotlrn_community::get_community_id] + return $item_id + } + + BlockWikiForm instproc new_request {} { + my instvar data + set block_id [[$data package_id] get_parameter block_id 0] + my var block_id [list $block_id] + next + } + + BlockWikiForm instproc edit_request {item_id} { + my instvar page_instance_form_atts data + next + #add something to the block_id parameter to avoid the required field in the submit + my var block_id [list 0] + } + + # + # BlockPlainPageForm + # + + Class create BlockPlainWikiForm -superclass BlockWikiForm \ + -parameter { + {f.text "= textarea,cols=80,rows=10"} + } + + Class create BlockPage -superclass ::xowiki::Page + + BlockPage instproc delete {} { + next + callback -catch -impl "planner" planner::flush_blocks_cache -community_id [dotlrn_community::get_community_id] + } + +# BlockPage instproc render {} { +# set content [next -update_references] +# regsub -nocase "" $content "" content +# return $content +# } + + Package instproc return_page {-adp:required -variables -form} { + foreach _var $variables { + upvar $_var [set _var] + } + if {[exists_and_not_null item_id]} { + set content_type [content::item::get_content_type -item_id $item_id] + if {[exists_and_not_null content] && [string equal $content_type "::xowiki::PlainPage"]} { + set content [ad_text_to_html -- $content] + } + } + if {[exists_and_not_null form]} { + upvar form [set form] + } else { + set form "" + } + if { [string equal $adp "/packages/xowiki/www/edit"] } { + set adp "/packages/pages/www/edit" + } + + return [next -adp $adp -variables $variables -form $form] + } + + # + # Blocks Policy + # + + Class create Policy -superclass ::xo::Policy + + Policy policy1 -contains { + + Class Package -array set require_permission { + reindex swa + delete {{package_id admin}} + edit-new { + {{has_class ::xowiki::Object} id swa} + {{has_class ::xowiki::File} id swa} + {{has_class ::xowiki::Form} id swa} + {{has_class ::xowiki::PodcastItem} id swa} + {{has_class ::xowiki::PageTemplate} id swa} + {id write} + } + } + + Class Page -array set require_permission { + view none + revisions swa + diff swa + edit {{package_id write}} + save-form-data swa + make-live-revision swa + delete-revision swa + delete {{package_id write}} + create-new {{package_id write}} + } -set default_permission {{package_id write}} + + } + +} + +namespace eval pages {} + + ad_proc -public pages::get_page_name { + {-item_id:required} + } { + Get page name by id + } { + set page_name [db_string get_page_name { *SQL* } -default ""] + return $page_name + } Index: openacs-4/packages/pages/tcl/pages-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/tcl/pages-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/tcl/pages-procs.xql 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + select name + from cr_items + where item_id = :item_id + + + + Index: openacs-4/packages/pages/www/blocks-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/www/blocks-view.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/www/blocks-view.adp 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,14 @@ + + @title;noquote@ + @context;noquote@ + @header_stuff;noquote@ + + @item_id;noquote@ + +
+ +@content;noquote@ +
Index: openacs-4/packages/pages/www/edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/www/edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/www/edit.adp 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,23 @@ + + {#pages.edit_page#} + {#pages.edit_page#} + note.title + + + + + + Index: openacs-4/packages/pages/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/www/index.vuh,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/www/index.vuh 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,24 @@ +# -*- tcl -*- +::blocks::Package initialize -ad_doc { + + This is the resolver for this package. It turns a request into + an object and executes the object with the computed method + + @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) + @creation-date July, 2006 + @cvs-id $Id: index.vuh,v 1.1 2009/07/10 17:04:41 alvaror Exp $ + +} -parameter { + {-m view} + {-folder_id:integer 0} +} + +::$package_id log "--starting... [ns_conn url] [ns_conn query]" +# form vars = [ns_set array [ns_getform]]" +#::$package_id exists_form_parameter creator +#::$package_id log "-- [::xo::cc serialize]" + +::$package_id reply_to_user [::$package_id invoke -method $m] + +::$package_id log "--i ::$package_id DONE" +ad_script_abort Index: openacs-4/packages/pages/www/admin/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/www/admin/index.vuh,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/www/admin/index.vuh 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,4 @@ +::blocks::Package initialize +set l [expr {[lsearch -exact [ns_conn urlv] admin] + 1 }] +set path [join [lrange [ns_conn urlv] $l end] /] +rp_internal_redirect /packages/xowiki/www/admin/$path Index: openacs-4/packages/pages/www/prototypes/index.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/www/prototypes/index.page,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/www/prototypes/index.page 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,7 @@ +::xowiki::Page new -title "Index Page" -text { +{{object_index -decoration none}} +} + + + + Index: openacs-4/packages/pages/www/prototypes/object_index.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/pages/www/prototypes/object_index.page,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/pages/www/prototypes/object_index.page 10 Jul 2009 17:04:41 -0000 1.1 @@ -0,0 +1,11 @@ +::xowiki::Object new -title "Object index" -text { +proc content {} { + set community_id [dotlrn_community::get_community_id] + set community_url [dotlrn_community::get_community_url $community_id] + if { ![empty_string_p $community_url] } { + ad_returnredirect "${community_url}" + } else { + ad_returnredirect "../" + } +} +} Index: openacs-4/packages/planner/catalog/planner.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/catalog/planner.en_US.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/catalog/planner.en_US.ISO-8859-1.xml 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,68 @@ + + + + Add a new activity + Add an activity + Add New Label + Add a new resource + CHOOSE + Choose Activity + Edit Course Mode + Course Settings + Delete + Edit + Edit Block Summary + Edit Existing Label + Edit Mode: + Format + Go To ... + Hide from students + Welcome to the time/themes spaces planner of the course. <br /> +Use the course settings located at the right side of the upper bar to choose the time/themes format for the course.<br /> +Start adding resources by turning on the Edit Mode. + Label + Label can't be empty + Link to file, web site or folder + Move + Move down + Move left + Move %move_name% to this location + Move right + Move up + The activity has been added to the <a href=%community_url%>planner</a> + Not available + Note: In the tutorials we refer as "block" to a section in the planner. + Number of Weeks/Topics + OFF + ON + Planner Configuration + Navigating inside the planner + Planner Organization + Select Activity + Select Type of Activity + Show to students + Start Date + Summary + Summary must be lower than 4000 characters + Text page + There are no activities of this type + Topic + Topics Format + Mini-Tutorials + Blocks View + <img border="0" height="9" width="12" title="Help text" alt="[i]" src="/shared/images/info.gif"/> The blocks are a planning by weeks or topics. +<br>The Blocks View will change the link to the class home from the portlet view to the block view. + Watch Tutorial + HTML page + Week + Weekly Format + The year must be lower than 2035 + Cancel + Confirm + OFF + ok + ON + Planner View + The planner view will overwrite the course home + SELECT MULTIPLE RESOURCES + Index: openacs-4/packages/planner/catalog/planner.es_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/catalog/planner.es_ES.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/catalog/planner.es_ES.ISO-8859-1.xml 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,60 @@ + + + + Añadir una actividad nueva + Añadir una actividad + Agregar Nueva Etiqueta + Añadir un recurso nuevo + SELECCIONAR + Elija la Actividad + Editar Curso + Configuración del Curso + Borrar + Editar + Editar Resumen del Bloque + Editar Etiqueta Existente + Modo de Edición: + Formato + Ir a ... + Ocultar para los estudiantes + Bienvenido al planificador de espacios temporales/temáticos del curso. +<br />Use la opción de configuración del curso situada en la barra superior a la derecha para seleccionar el formato temporal/temático del curso. +<br />A continuación comience a añadir recursos usando la opción Activar. + Etiqueta + La etiqueta no puede estar vacía + Enlace a un archivo, enlace o carpeta + Mover + Mover hacia abajo + Mover a la izquierda + Mover %move_name% a esta posición + Mover a la derecha + Mover hacia arriba + La actividad se ha añadido al <a href=%community_url%>planificador</a> + No disponible + Nota: Dentro de los tutoriales se denomina "bloque" a una sección del planificador. + Numero de Semanas/Temas + Desactivar + Activar + Configuración del Planificador + Navegando dentro del Planificador + Organización del Planificador + Seleccionar Actividad + Seleccione el Tipo de Actividad + Mostrar a los estudiantes + Fecha de Inicio + Resumen + El resúmen debe ser menor que 4000 caracteres + Página de texto + No hay actividades de este tipo + Tema + Formato de Temas + Mini-Tutoriales + Vista por Bloques + <img border="0" height="9" width="12" title="Help text" alt="[i]" src="/shared/images/info.gif"/> Los bloques son una planificación por semanas o unidades didácticas. +<br>La Vista por Bloques cambiará el enlace del Curso de la vista por portlets a la vista por bloques. + Ver Tutorial + Página HTML + Semana + Formato de Semanas + El año debe ser menor que 2035 + Index: openacs-4/packages/planner/lib/navigation.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/navigation.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/navigation.adp 10 Jul 2009 17:03:37 -0000 1.1 @@ -0,0 +1,41 @@ + + +
+
+ + + + + + + +
+
+
+
\ No newline at end of file Index: openacs-4/packages/planner/lib/navigation.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/navigation.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/navigation.tcl 10 Jul 2009 17:03:37 -0000 1.1 @@ -0,0 +1,45 @@ +# Get basic information +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 $user_id \ + -community_id $community_id +] + +if {[dotlrn_community::member_p $community_id $user_id] || $admin_p} { + set member_p 1 +} else { + set member_p 0 +} +set block_view_p [planner::enabled_p -community_id $community_id] +set mode [planner::get_mode -community_id $community_id] +if {[string equal $mode "topics"]} { + set mode_msg [_ planner.blocks_topic] +} else { + set mode_msg [_ planner.blocks_week] +} +set edit_p [ad_get_cookie blocks_edit_mode 0] +set last_block_id 0 +set prev_object_id 0 +set next_object_id 0 +set inside_block_object_p 0 +set get_next_object_p 0 +set block_count 0 +if { $block_view_p == "t" && $community_id ne "" && $member_p == 1 } { + set blocks_info [planner::get_blocks_navigation_info -community_id $community_id] + if { $planner_object_id > 0 } { + foreach object $blocks_info { + array set tmp_array $object + if { $inside_block_object_p } { + set next_object_id $tmp_array(object_id) + break + } + if { $planner_object_id == $tmp_array(object_id) } { + set inside_block_object_p 1 + } else { + set prev_object_id $tmp_array(object_id) + } + } + } + template::util::list_to_multirow get_blocks $blocks_info +} Index: openacs-4/packages/planner/planner-patch/README =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/README,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/README 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,18 @@ +Run the script.sh to make the planner work with the new features, +this script will patch some packages. + +Details of the patch: + +forums, evaluation, assessment, file-storage: +- Provide an extend and insert callback inside the add/edit page +of each package to link the resources to the planner + +dotlrn-portlet: +Add a link to turn the planner on from the dotlrn admin portlet + +dotlrn: +Change the index to make the course home the planner when the planner is on + +theme-zen: +- add a script to display the select with all the activities in the planner + Index: openacs-4/packages/planner/planner-patch/assessment-diff.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/assessment-diff.patch,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/assessment-diff.patch 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,64 @@ +diff -crNB dotlrn-2.4.1/packages/assessment/www/asm-admin/assessment-form.tcl assessment/www/asm-admin/assessment-form.tcl +*** dotlrn-2.4.1/packages/assessment/www/asm-admin/assessment-form.tcl 2009-07-05 21:03:12.000000000 -0400 +--- assessment/www/asm-admin/assessment-form.tcl 2009-07-05 21:11:49.000000000 -0400 +*************** +*** 9,14 **** +--- 9,15 ---- + {permission_p 0} + {type ""} + {after "0"} ++ {block_id 0} + } -properties { + context:onevalue + page_title:onevalue +*************** +*** 254,259 **** +--- 255,264 ---- + } + } + ++ ## Planner View -> Extend Form ++ callback -catch -impl "dotlrn" planner::extend_form -block_id $block_id -form_name "assessment_form" -block_object_type $block_object_type ++ ### ++ + ad_form -extend -name assessment_form -new_request { + set new "" + set title "" +*************** +*** 399,404 **** +--- 404,412 ---- + } + } + } -after_submit { ++ ## Planner View ++ callback -catch -impl "dotlrn" planner::insert_object -block_id $block_id -object_id $assessment_id -resource_type $block_object_type ++ ### + if {$permission_p} { + permission::grant -party_id "-1" -object_id $assessment_id -privilege read + } +diff -crNB dotlrn-2.4.1/packages/assessment/www/asm-admin/one-a.adp assessment/www/asm-admin/one-a.adp +*** dotlrn-2.4.1/packages/assessment/www/asm-admin/one-a.adp 2009-07-05 21:03:12.000000000 -0400 +--- assessment/www/asm-admin/one-a.adp 2009-07-05 21:04:35.000000000 -0400 +*************** +*** 1,6 **** +--- 1,7 ---- + + @p_title;noquote@ + @context;noquote@ ++ @assessment_id;noquote@ + + + +diff -crNB dotlrn-2.4.1/packages/assessment/www/instructions.adp assessment/www/instructions.adp +*** dotlrn-2.4.1/packages/assessment/www/instructions.adp 2009-07-05 21:03:12.000000000 -0400 +--- assessment/www/instructions.adp 2009-07-05 21:03:53.000000000 -0400 +*************** +*** 1,6 **** +--- 1,7 ---- + + @page_title@ + @context@ ++ @assessment_id;noquote@ + @assessment_data.entry_page;noquote@ +

+ @assessment_data.instructions;noquote@ Index: openacs-4/packages/planner/planner-patch/dotlrn-diff.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/dotlrn-diff.patch,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/dotlrn-diff.patch 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,49 @@ +diff -crNB blocks-new/packages/dotlrn/www/admin/planner-enable.tcl blocks-clean/packages/dotlrn/www/admin/planner-enable.tcl +*** blocks-new/packages/dotlrn/www/admin/planner-enable.tcl 1969-12-31 19:00:00.000000000 -0500 +--- blocks-clean/packages/dotlrn/www/admin/planner-enable.tcl 2009-07-05 22:16:44.000000000 -0400 +*************** +*** 0 **** +--- 1,20 ---- ++ ad_page_contract { ++ Enable/Disable Block View in a community ++ ++ @author Alvaro Rodriguez (alvaro@viaro.net) ++ @creation-date Jul-2008 ++ } { ++ {enable_p "f"} ++ {return_url ""} ++ } ++ ++ set user_id [ad_conn user_id] ++ set community_id [dotlrn_community::get_community_id] ++ # Permissions ++ dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id ++ ++ planner::enable -community_id $community_id -enable_p $enable_p ++ ++ if {![empty_string_p $return_url]} { ++ ad_returnredirect $return_url ++ } +\ No newline at end of file +diff -crNB blocks-new/packages/dotlrn/www/index.tcl blocks-clean/packages/dotlrn/www/index.tcl +*** blocks-new/packages/dotlrn/www/index.tcl 2009-07-05 21:03:16.000000000 -0400 +--- blocks-clean/packages/dotlrn/www/index.tcl 2009-07-08 12:58:22.000000000 -0400 +*************** +*** 25,30 **** +--- 25,40 ---- + {page_num 0} + } + ++ ## Planner redirect ++ if { $page_num == 0 } { ++ if {[apm_package_installed_p "planner"]} { ++ set planner_view [planner::enabled_p -community_id [dotlrn_community::get_community_id]] ++ if {[string equal $planner_view "t"]} { ++ ad_returnredirect "planner/" ++ } ++ } ++ } ++ + # Used to keep track of navigation links + ad_set_client_property dotlrn page_num $page_num + Index: openacs-4/packages/planner/planner-patch/dotlrn-portlet-diff.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/dotlrn-portlet-diff.patch,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/dotlrn-portlet-diff.patch 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,45 @@ +diff -crNB dotlrn-2.4.1/packages/dotlrn-portlet/www/dotlrn-admin-portlet.adp dotlrn-portlet/www/dotlrn-admin-portlet.adp +*** dotlrn-2.4.1/packages/dotlrn-portlet/www/dotlrn-admin-portlet.adp 2009-07-05 21:03:00.000000000 -0400 +--- dotlrn-portlet/www/dotlrn-admin-portlet.adp 2009-07-07 14:06:14.000000000 -0400 +*************** +*** 22,27 **** +--- 22,37 ---- + Group properties section + +

    ++ ++
  • #planner.planner_view# - ++ ++ #planner.ON# / #planner.OFF# ++ ++ #planner.ON# / #planner.OFF# ++ ++ #planner.planner_warning# ++
  • ++
    +
  • #dotlrn-portlet.edit_gr_props# - #dotlrn-portlet.change_name_etc# +
      + +diff -crNB dotlrn-2.4.1/packages/dotlrn-portlet/www/dotlrn-admin-portlet.tcl dotlrn-portlet/www/dotlrn-admin-portlet.tcl +*** dotlrn-2.4.1/packages/dotlrn-portlet/www/dotlrn-admin-portlet.tcl 2009-07-05 21:03:00.000000000 -0400 +--- dotlrn-portlet/www/dotlrn-admin-portlet.tcl 2009-07-07 14:06:41.000000000 -0400 +*************** +*** 99,101 **** +--- 99,115 ---- + + set limited_user_add_url [export_vars -base user-add {{type student} {can_browse_p 0} {read_private_data_p t}}] + set club_limited_user_add_url [export_vars -base user-add {{type student} {can_browse_p 0} {read_private_data_p f}}] ++ ## Planner View ++ set planner_p [apm_package_installed_p "planner"] ++ if { $planner_p } { ++ set planner_view_p [planner::enabled_p -community_id $community_id] ++ set return_url [ad_conn url] ++ if {[empty_string_p $planner_view_p] || [string equal $planner_view_p "f"]} { ++ set planner_view_url [export_vars -base "admin/planner-enable" { {enable_p "t"} \ ++ return_url}] ++ } else { ++ set planner_view_url [export_vars -base "admin/planner-enable" { {enable_p "f"} \ ++ return_url}] ++ } ++ } ++ ### Index: openacs-4/packages/planner/planner-patch/evaluation-diff.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/evaluation-diff.patch,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/evaluation-diff.patch 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,173 @@ +diff -crNB dotlrn-2.4.1/packages/evaluation/tcl/evaluation-callback-procs.tcl evaluation/tcl/evaluation-callback-procs.tcl +*** dotlrn-2.4.1/packages/evaluation/tcl/evaluation-callback-procs.tcl Sun Jul 5 21:02:58 2009 +--- evaluation/tcl/evaluation-callback-procs.tcl Mon Jul 6 17:40:54 2009 +*************** +*** 71,74 **** + + + } +! } +\ No newline at end of file +--- 71,114 ---- + + + } +! } +! +! ad_proc -public -callback search::url -impl evaluation_tasks {} { +! returns a url for an evaluation to the search package +! } { +! set evaluation_id $object_id +! set package_id [acs_object::package_id -object_id $evaluation_id] +! set grade_id [lindex [db_list get_grade_id { *SQL* }] 0] +! set package_url [apm_package_url_from_id $package_id] +! set community_url [site_node::get_url -node_id \ +! [site_node::get_parent_id -node_id \ +! [site_node::get_node_id_from_object_id \ +! -object_id $package_id]]] +! +! return "${package_url}task-view?task_id=$evaluation_id&grade_id=$grade_id&return_url=${community_url}" +! } +! +! ad_proc -public -callback planner::edit_url -impl evaluation_tasks {} { +! returns a url for the edit action of an evaluation to the dotlrn planner +! } { +! set item_id [content::revision::item_id -revision_id $object_id] +! set evaluation_id $object_id +! set package_id [acs_object::package_id -object_id $evaluation_id] +! set grade_id [lindex [db_list get_grade_id { *SQL* }] 0] +! set package_url [apm_package_url_from_id $package_id] +! +! return "${package_url}admin/tasks/task-add-edit?task_id=$evaluation_id&item_id=$item_id&grade_id=$grade_id" +! } +! +! ad_proc -public -callback planner::delete_url -impl evaluation_tasks {} { +! returns a url for the delete action of an evaluation to the dotlrn planner +! } { +! set item_id [content::revision::item_id -revision_id $object_id] +! set evaluation_id $object_id +! set package_id [acs_object::package_id -object_id $evaluation_id] +! set grade_id [lindex [db_list get_grade_id { *SQL* }] 0] +! set package_url [apm_package_url_from_id $package_id] +! set msg "[_ evaluation.lt_Yes_I_really_want_to__3]" +! +! return "${package_url}admin/tasks/task-delete-2?task_id=$evaluation_id&grade_id=$grade_id&operation=$msg&return_url=" +! } +diff -crNB dotlrn-2.4.1/packages/evaluation/tcl/evaluation-callback-procs.xql evaluation/tcl/evaluation-callback-procs.xql +*** dotlrn-2.4.1/packages/evaluation/tcl/evaluation-callback-procs.xql Sun Jul 5 21:02:58 2009 +--- evaluation/tcl/evaluation-callback-procs.xql Sun Jul 5 21:11:02 2009 +*************** +*** 33,37 **** +--- 33,73 ---- + where party_id = :from_user_id + + ++ ++ ++ ++ select grade_id ++ from evaluation_grades ++ where grade_item_id = ( ++ select grade_item_id ++ from evaluation_tasks ++ where task_id = :evaluation_id ++ ) ++ ++ ++ ++ ++ ++ select grade_id ++ from evaluation_grades ++ where grade_item_id = ( ++ select grade_item_id ++ from evaluation_tasks ++ where task_id = :evaluation_id ++ ) ++ ++ ++ ++ ++ ++ select grade_id ++ from evaluation_grades ++ where grade_item_id = ( ++ select grade_item_id ++ from evaluation_tasks ++ where task_id = :evaluation_id ++ ) ++ ++ + + +diff -crNB dotlrn-2.4.1/packages/evaluation/www/admin/tasks/task-add-edit.tcl evaluation/www/admin/tasks/task-add-edit.tcl +*** dotlrn-2.4.1/packages/evaluation/www/admin/tasks/task-add-edit.tcl Sun Jul 5 21:02:58 2009 +--- evaluation/www/admin/tasks/task-add-edit.tcl Sun Jul 5 21:38:31 2009 +*************** +*** 20,25 **** +--- 20,26 ---- + {enable 1} + {return_p ""} + {simple_p ""} ++ {block_id 0} + + } + +*************** +*** 314,319 **** +--- 315,324 ---- + } + } + ++ ## Planner View -> Extend Form ++ callback -catch -impl "dotlrn" planner::extend_form -block_id $block_id -form_name "task" ++ ### ++ + ad_form -extend -name task -form { + + } -edit_request { +*************** +*** 461,466 **** +--- 466,474 ---- + set content_length 0 + db_dml lob_size { *SQL* } + ++ ## Planner View ++ callback -catch -impl "dotlrn" planner::insert_object -block_id $block_id -object_id $task_id ++ ### + + if { ![empty_string_p $upload_file] } { + set tmp_file [template::util::file::get_property tmp_filename $upload_file] +*************** +*** 545,550 **** +--- 553,559 ---- + } + if { ![empty_string_p $add_to_more_classes_p] } { + ad_returnredirect [export_vars -base "task-add-to-communities" { redirect_to_groups_p {task_id $revision_id} return_url }] ++ ad_script_abort + } elseif { $redirect_to_groups_p } { + ad_returnredirect [export_vars -base "../groups/one-task" { {task_id $revision_id} }] + ad_script_abort +*************** +*** 555,560 **** +--- 564,570 ---- + ad_script_abort + } else { + ad_returnredirect $return_url ++ ad_script_abort + } + + } +diff -crNB dotlrn-2.4.1/packages/evaluation/www/task-view.adp evaluation/www/task-view.adp +*** dotlrn-2.4.1/packages/evaluation/www/task-view.adp Sun Jul 5 21:02:58 2009 +--- evaluation/www/task-view.adp Sun Jul 5 21:12:26 2009 +*************** +*** 1,6 **** +--- 1,7 ---- + + @page_title;noquote@ + @context;noquote@ ++ @task_item_id;noquote@ + + + Index: openacs-4/packages/planner/planner-patch/file-storage-diff.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/file-storage-diff.patch,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/file-storage-diff.patch 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,350 @@ +diff -crNB blocks-new/packages/file-storage/tcl/file-storage-callback-procs.tcl blocks-clean/packages/file-storage/tcl/file-storage-callback-procs.tcl +*** blocks-new/packages/file-storage/tcl/file-storage-callback-procs.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/tcl/file-storage-callback-procs.tcl 2009-07-05 21:25:19.000000000 -0400 +*************** +*** 243,245 **** +--- 243,367 ---- + + + } ++ ++ ad_proc -public -callback search::url -impl content_extlink {} { ++ returns a url from an object in the file storage to the search package ++ } { ++ set item_id $object_id ++ set ext_url [db_string get_url { *SQL* } -default ""] ++ ++ return "$ext_url" ++ } ++ ++ ad_proc -public -callback search::url -impl content_folder {} { ++ returns a url from a folder in the file storage to the search package ++ } { ++ set folder_id $object_id ++ set folder_data [fs::get_folder_package_and_root $folder_id] ++ set package_id [lindex $folder_data 0] ++ set package_url [apm_package_url_from_id $package_id] ++ ++ return "${package_url}?folder_id=$folder_id" ++ } ++ ++ ad_proc -public -callback planner::edit_url -impl content_folder {} { ++ returns a url to the edit action of a folder in the file storage to the search package ++ } { ++ set folder_id $object_id ++ set folder_data [fs::get_folder_package_and_root $folder_id] ++ set package_id [lindex $folder_data 0] ++ set package_url [apm_package_url_from_id $package_id] ++ ++ return "${package_url}folder-edit?folder_id=$folder_id" ++ } ++ ++ ad_proc -public -callback planner::edit_url -impl file_storage_object {} { ++ returns a url to the edit action of an object in the file storage to the search package ++ } { ++ set item_id [content::revision::item_id -revision_id $object_id] ++ set package_id [acs_object::package_id -object_id $item_id] ++ set package_url [apm_package_url_from_id $package_id] ++ ++ return "${package_url}file?file_id=$item_id" ++ } ++ ++ ad_proc -public -callback planner::edit_url -impl content_extlink {} { ++ returns a url to the edit action of an object in the file storage to the search package ++ } { ++ set item_id $object_id ++ set package_id [acs_object::package_id -object_id $item_id] ++ set package_url [apm_package_url_from_id $package_id] ++ ++ return "${package_url}simple-edit?object_id=$item_id" ++ } ++ ++ ad_proc -public -callback planner::delete_url -impl content_folder {} { ++ returns a url to the delete action of a folder in the file storage to the search package ++ } { ++ set folder_id $object_id ++ set folder_data [fs::get_folder_package_and_root $folder_id] ++ set package_id [lindex $folder_data 0] ++ set package_url [apm_package_url_from_id $package_id] ++ ++ return "${package_url}folder-delete?folder_id=${folder_id}&form:id=folder-delete" ++ } ++ ++ ad_proc -public -callback planner::delete_url -impl file_storage_object {} { ++ returns a url to the delete action of an object in the file storage to the search package ++ } { ++ set item_id [content::revision::item_id -revision_id $object_id] ++ set package_id [acs_object::package_id -object_id $item_id] ++ set package_url [apm_package_url_from_id $package_id] ++ ++ return "${package_url}delete?object_id=${item_id}&form:id=delete_confirm" ++ } ++ ++ ad_proc -public -callback planner::delete_url -impl content_extlink {} { ++ returns a url to the delete action of an object in the file storage to the search package ++ } { ++ set item_id $object_id ++ set folder_id [db_string get_folder_id { *SQL* } -default 0] ++ set package_id [acs_object::package_id -object_id $item_id] ++ set package_url [apm_package_url_from_id $package_id] ++ ++ return "${package_url}simple-delete?object_id=${item_id}&folder_id=$folder_id" ++ } ++ ++ ad_proc -public -callback planner::insert_object -impl file-storage {} { ++ ++ @author alvaro@viaro.net ++ @creation_date Jul-2008 ++ ++ Insert the recently created object into the blocks view objects table ++ ++ } { ++ set block_id [ad_get_cookie fs_block_id "0"] ++ if { $block_id != 0 && [ad_get_cookie fs_community_id ""] == $community_id } { ++ set object_index [planner::get_next_object_index -block_id $block_id] ++ planner::insert_object_to_block -block_id $block_id -object_id $object_id -object_index $object_index ++ ad_set_cookie fs_block_id 0 ++ set community_id [planner::get_community_id_from_block_id -block_id $block_id] ++ set community_url [dotlrn_community::get_community_url $community_id] ++ planner::show_alert_message -object_id $object_id -community_url $community_url ++ } else { ++ set community_id [dotlrn_community::get_community_id] ++ } ++ planner::flush_blocks_cache -community_id $community_id ++ } ++ ++ ad_proc -public -callback planner::extend_form -impl file-storage {} { ++ ++ @author alvaro@viaro.net ++ @creation_date Jul-2008 ++ ++ Extend the form of the file-storage to add items to blocks view table ++ ++ } { ++ upvar elements elements ++ set block_id [ad_get_cookie fs_block_id "0"] ++ set community_url [dotlrn_community::get_community_url $community_id] ++ set display_t "\#planner.blocks_choose\#" ++ if { $block_id != 0 && [ad_get_cookie fs_community_id 0] == $community_id} { ++ lappend elements choose_link [list label "" display_template $display_t] ++ } ++ } +diff -crNB blocks-new/packages/file-storage/www/delete.tcl blocks-clean/packages/file-storage/www/delete.tcl +*** blocks-new/packages/file-storage/www/delete.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/delete.tcl 2009-07-05 21:29:52.000000000 -0400 +*************** +*** 82,87 **** +--- 82,90 ---- + } + } + } ++ ## Planner View -> Flush Cache ++ callback -catch -impl "planner" planner::flush_blocks_cache -community_id [dotlrn_community::get_community_id] ++ ### + ad_returnredirect $return_url + ad_script_abort + } +diff -crNB blocks-new/packages/file-storage/www/file-add.tcl blocks-clean/packages/file-storage/www/file-add.tcl +*** blocks-new/packages/file-storage/www/file-add.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/file-add.tcl 2009-07-05 21:29:03.000000000 -0400 +*************** +*** 249,254 **** +--- 249,257 ---- + set file_id [db_nextval "acs_object_id_seq"] + } + } ++ ## Planner View ++ callback -catch -impl "file-storage" planner::insert_object -block_id 0 -object_id $this_file_id -community_id [dotlrn_community::get_community_id] ++ ### + file delete $upload_file.tmpfile + } -edit_data { + set this_title $title +diff -crNB blocks-new/packages/file-storage/www/file.adp blocks-clean/packages/file-storage/www/file.adp +*** blocks-new/packages/file-storage/www/file.adp 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/file.adp 2009-07-05 21:28:37.000000000 -0400 +*************** +*** 3,8 **** +--- 3,9 ---- + @title;noquote@ + @context;noquote@ + @file_id;noquote@ ++ @file_id;noquote@ + +

      @title;noquote@ - #file-storage.properties#

      + +diff -crNB blocks-new/packages/file-storage/www/file-edit.adp blocks-clean/packages/file-storage/www/file-edit.adp +*** blocks-new/packages/file-storage/www/file-edit.adp 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/file-edit.adp 2009-07-05 21:30:41.000000000 -0400 +*************** +*** 2,7 **** +--- 2,8 ---- + @page_title;noquote@ + @page_title;noquote@ + @context;noquote@ ++ @file_id;noquote@ + + + +diff -crNB blocks-new/packages/file-storage/www/file-edit.tcl blocks-clean/packages/file-storage/www/file-edit.tcl +*** blocks-new/packages/file-storage/www/file-edit.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/file-edit.tcl 2009-07-05 21:30:14.000000000 -0400 +*************** +*** 68,73 **** +--- 68,76 ---- + -container_object_id $package_id \ + -element_name category_id] + } ++ ## Planner View -> Flush Cache ++ callback -catch -impl "planner" planner::flush_blocks_cache -community_id [dotlrn_community::get_community_id] ++ ### + } -after_submit { + ad_returnredirect "file?file_id=$file_id" + } +diff -crNB blocks-new/packages/file-storage/www/folder-chunk.tcl blocks-clean/packages/file-storage/www/folder-chunk.tcl +*** blocks-new/packages/file-storage/www/folder-chunk.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/folder-chunk.tcl 2009-07-05 21:31:28.000000000 -0400 +*************** +*** 148,153 **** +--- 148,157 ---- + link_html { title "[_ file-storage.Download]" }] \ + ] + ++ ## Planner View -> Extend Form ++ if {[exists_and_not_null return_url]} { ++ callback -catch -impl "file-storage" planner::extend_form -block_id 0 -referrer $return_url -community_id [dotlrn_community::get_community_id] ++ } + + if { $categories_p } { + lappend elements categories [list label [_ file-storage.Categories] display_col "categories;noquote"] +*************** +*** 167,172 **** +--- 171,181 ---- + + if {$allow_bulk_actions} { + set bulk_actions [list "[_ file-storage.Move]" "${fs_url}move" "[_ file-storage.lt_Move_Checked_Items_to]" "[_ file-storage.Copy]" "${fs_url}copy" "[_ file-storage.lt_Copy_Checked_Items_to]" "[_ file-storage.Delete]" "${fs_url}delete" "[_ file-storage.Delete_Checked_Items]" "[_ file-storage.Download_ZIP]" "${fs_url}download-zip" "[_ file-storage.Download_ZIP_Checked_Items]"] ++ ## Planner View -> Add the SELECT bulk action when coming from dotlrn blocks ++ if { [ad_get_cookie fs_block_id 0] != 0 && [ad_get_cookie fs_community_id 0] != 0 } { ++ lappend bulk_actions "[_ planner.select_multiple]" "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]planner/object-add" "[_ file-storage.select_multiple]" ++ } ++ ### + callback fs::folder_chunk::add_bulk_actions \ + -bulk_variable "bulk_actions" \ + -folder_id $folder_id \ +diff -crNB blocks-new/packages/file-storage/www/folder-create.tcl blocks-clean/packages/file-storage/www/folder-create.tcl +*** blocks-new/packages/file-storage/www/folder-create.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/folder-create.tcl 2009-07-05 21:32:29.000000000 -0400 +*************** +*** 113,118 **** +--- 113,121 ---- + -element_name category_id] + } + ++ ## Planner View ++ callback -catch -impl "file-storage" planner::insert_object -block_id 0 -object_id $folder_id -community_id [dotlrn_community::get_community_id] ++ ### + ad_returnredirect "?folder_id=$folder_id" + ad_script_abort + } -edit_data { +diff -crNB blocks-new/packages/file-storage/www/folder-edit.tcl blocks-clean/packages/file-storage/www/folder-edit.tcl +*** blocks-new/packages/file-storage/www/folder-edit.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/folder-edit.tcl 2009-07-05 21:33:28.000000000 -0400 +*************** +*** 54,59 **** +--- 54,62 ---- + } + + callback fs::folder_edit -package_id [ad_conn package_id] -folder_id $folder_id ++ ## Planner View -> Flush Cache ++ callback -catch -impl "planner" planner::flush_blocks_cache -community_id [dotlrn_community::get_community_id] ++ ### + + } -after_submit { + ad_returnredirect "?folder_id=$folder_id" +diff -crNB blocks-new/packages/file-storage/www/index.tcl blocks-clean/packages/file-storage/www/index.tcl +*** blocks-new/packages/file-storage/www/index.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/index.tcl 2009-07-08 14:43:30.000000000 -0400 +*************** +*** 28,33 **** +--- 28,41 ---- + context:onevalue + } + ++ ## Planner View ++ set urls [split $return_url "/"] ++ if { ![regexp "planner\??.*" [lindex $urls [expr [llength $urls] - 2]]] } { ++ ad_set_cookie fs_block_id 0 ++ ad_set_cookie fs_community_id 0 ++ } ++ ### ++ + # Don't allow delete if root folder + set root_folder_p 0 + set root_folder_id [fs_get_root_folder] +diff -crNB blocks-new/packages/file-storage/www/simple-add.tcl blocks-clean/packages/file-storage/www/simple-add.tcl +*** blocks-new/packages/file-storage/www/simple-add.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/simple-add.tcl 2009-07-05 21:38:00.000000000 -0400 +*************** +*** 99,106 **** + + fs::do_notifications -folder_id $folder_id -filename $url -item_id $item_id -action "new_url" + + } -after_submit { + + ad_returnredirect "?folder_id=$folder_id" +! + } +--- 99,109 ---- + + fs::do_notifications -folder_id $folder_id -filename $url -item_id $item_id -action "new_url" + ++ ## Planner View ++ callback -catch -impl "file-storage" planner::insert_object -block_id 0 -object_id $item_id -community_id [dotlrn_community::get_community_id] ++ ### + } -after_submit { + + ad_returnredirect "?folder_id=$folder_id" +! ad_script_abort + } +diff -crNB blocks-new/packages/file-storage/www/simple.adp blocks-clean/packages/file-storage/www/simple.adp +*** blocks-new/packages/file-storage/www/simple.adp 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/simple.adp 2009-07-05 21:36:47.000000000 -0400 +*************** +*** 3,8 **** +--- 3,9 ---- + @title;noquote@ + @context;noquote@ + @object_id;noquote@ ++ @object_id;noquote@ + +

      @url@

      +

      @description@

      +diff -crNB blocks-new/packages/file-storage/www/simple-delete.tcl blocks-clean/packages/file-storage/www/simple-delete.tcl +*** blocks-new/packages/file-storage/www/simple-delete.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/simple-delete.tcl 2009-07-05 21:42:11.000000000 -0400 +*************** +*** 22,27 **** +--- 22,30 ---- + + } + ++ ## Planner View -> Flush Cache ++ callback -catch -impl "planner" planner::flush_blocks_cache -community_id [dotlrn_community::get_community_id] ++ ### + + ad_returnredirect "./?folder_id=$folder_id" + +diff -crNB blocks-new/packages/file-storage/www/simple-edit.tcl blocks-clean/packages/file-storage/www/simple-edit.tcl +*** blocks-new/packages/file-storage/www/simple-edit.tcl 2009-07-05 21:02:54.000000000 -0400 +--- blocks-clean/packages/file-storage/www/simple-edit.tcl 2009-07-05 21:34:13.000000000 -0400 +*************** +*** 38,43 **** +--- 38,46 ---- + -container_object_id $package_id \ + -element_name category_id] + } ++ ## Planner View -> Flush Cache ++ callback -catch -impl "planner" planner::flush_blocks_cache -community_id [dotlrn_community::get_community_id] ++ ### + ad_returnredirect "?[export_vars folder_id]" + } + Index: openacs-4/packages/planner/planner-patch/forums-diff.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/forums-diff.patch,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/forums-diff.patch 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,113 @@ +diff -crNB dotlrn-2.4.1/packages/forums/lib/forums/new.tcl forums/lib/forums/new.tcl +*** dotlrn-2.4.1/packages/forums/lib/forums/new.tcl 2009-07-05 21:02:52.000000000 -0400 +--- forums/lib/forums/new.tcl 2009-07-05 21:18:38.000000000 -0400 +*************** +*** 46,51 **** +--- 46,55 ---- + forum::new_questions_deny -forum_id $forum_id + } + ++ ## Planner View ++ callback -catch -impl "dotlrn" planner::insert_object -block_id $block_id -object_id $forum_id ++ ### ++ + ad_returnredirect $return_url + ad_script_abort + } +*************** +*** 56,61 **** +--- 60,69 ---- + element set_properties forum forum_id -value $forum_id + element set_value forum new_threads_p 1 + element set_value forum name $name ++ ++ ## Planner View -> Extend Form ++ callback -catch -impl "dotlrn" planner::extend_form -block_id $block_id -form_name "forum" ++ ### + } + + if {[exists_and_not_null alt_template]} { +diff -crNB dotlrn-2.4.1/packages/forums/tcl/forums-callback-procs.tcl forums/tcl/forums-callback-procs.tcl +*** dotlrn-2.4.1/packages/forums/tcl/forums-callback-procs.tcl 2009-07-05 21:02:52.000000000 -0400 +--- forums/tcl/forums-callback-procs.tcl 2009-07-05 21:16:58.000000000 -0400 +*************** +*** 101,106 **** +--- 101,138 ---- + } + } + ++ ad_proc -public -callback planner::edit_url -impl forums_forum {} { ++ ++ @author alvaro@viaro.net ++ @creation_date Jul-08 ++ ++ returns a url for the edit action of a forum to the dotlrn blocks ++ ++ } { ++ set forum_id $object_id ++ set package_id [acs_object::package_id -object_id $forum_id] ++ set package_url [apm_package_url_from_id $package_id] ++ ++ return "${package_url}admin/forum-edit?forum_id=$forum_id" ++ } ++ ++ ad_proc -public -callback planner::delete_url -impl forums_forum {} { ++ ++ @author alvaro@viaro.net ++ @creation_date Jul-08 ++ ++ returns a url for the edit action of a forum to the dotlrn blocks ++ ++ } { ++ set forum_id $object_id ++ set package_id [acs_object::package_id -object_id $forum_id] ++ set package_url [apm_package_url_from_id $package_id] ++ ## Delete forums is not allowed in recent versions of forums ++ # return "${package_url}admin/forum-delete?forum_id=$forum_id" ++ ### ++ return "." ++ } ++ + ad_proc -public -callback search::datasource -impl forums_message {} { + + @author dave@thedesignexperience.org +diff -crNB dotlrn-2.4.1/packages/forums/www/admin/forum-new.adp forums/www/admin/forum-new.adp +*** dotlrn-2.4.1/packages/forums/www/admin/forum-new.adp 2009-07-05 21:02:52.000000000 -0400 +--- forums/www/admin/forum-new.adp 2009-07-05 21:20:43.000000000 -0400 +*************** +*** 3,6 **** + @context;noquote@ + forum.name + +! +--- 3,6 ---- + @context;noquote@ + forum.name + +! +diff -crNB dotlrn-2.4.1/packages/forums/www/admin/forum-new.tcl forums/www/admin/forum-new.tcl +*** dotlrn-2.4.1/packages/forums/www/admin/forum-new.tcl 2009-07-05 21:02:52.000000000 -0400 +--- forums/www/admin/forum-new.tcl 2009-07-05 21:20:34.000000000 -0400 +*************** +*** 8,13 **** +--- 8,14 ---- + + } -query { + {name ""} ++ {block_id ""} + } + + set context [list [_ forums.Create_New_Forum]] +diff -crNB dotlrn-2.4.1/packages/forums/www/forum-view.adp forums/www/forum-view.adp +*** dotlrn-2.4.1/packages/forums/www/forum-view.adp 2009-07-05 21:02:52.000000000 -0400 +--- forums/www/forum-view.adp 2009-07-05 21:21:05.000000000 -0400 +*************** +*** 2,7 **** +--- 2,8 ---- + @page_title;noquote@ + @context;noquote@ + @forum_id;noquote@ ++ @forum_id;noquote@ + +

      @page_title;noquote@

      + Index: openacs-4/packages/planner/planner-patch/script.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/script.sh,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/script.sh 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,10 @@ +#!/bin/bash + +cd ../../ +patch -p0 -i planner/planner-patch/evaluation-diff.patch +patch -p0 -i planner/planner-patch/assessment-diff.patch +patch -p0 -i planner/planner-patch/forums-diff.patch +patch -p0 -i planner/planner-patch/file-storage-diff.patch +patch -p0 -i planner/planner-patch/dotlrn-diff.patch +patch -p0 -i planner/planner-patch/dotlrn-portlet-diff.patch +patch -p0 -i planner/planner-patch/theme-zen-diff.patch Index: openacs-4/packages/planner/planner-patch/theme-zen-diff.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/planner-patch/theme-zen-diff.patch,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/planner-patch/theme-zen-diff.patch 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,30 @@ +diff -crNB dotlrn-2.4.1/packages/theme-zen/lib/lrn-master.adp theme-zen/lib/lrn-master.adp +*** dotlrn-2.4.1/packages/theme-zen/lib/lrn-master.adp 2009-07-05 21:03:00.000000000 -0400 +--- theme-zen/lib/lrn-master.adp 2009-07-07 14:00:38.000000000 -0400 +*************** +*** 84,89 **** +--- 84,92 ---- + + + +diff -crNB dotlrn-2.4.1/packages/theme-zen/lib/lrn-master.tcl theme-zen/lib/lrn-master.tcl +*** dotlrn-2.4.1/packages/theme-zen/lib/lrn-master.tcl 2009-07-05 21:03:00.000000000 -0400 +--- theme-zen/lib/lrn-master.tcl 2009-07-07 14:00:56.000000000 -0400 +*************** +*** 277,279 **** +--- 277,285 ---- + template::head::add_css -href "/resources/dotlrn/dotlrn-toolbar.css" + template::add_header -src "/packages/dotlrn/lib/toolbar" + } ++ ## Planner: if there is no planner_object_id set the variable ++ set planner_p [apm_package_installed_p "planner"] ++ if {![exists_and_not_null planner_object_id]} { ++ set planner_object_id 0 ++ } ++ ### Index: openacs-4/packages/planner/sql/oracle/planner-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/sql/oracle/planner-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/sql/oracle/planner-create.sql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,49 @@ +create table blocks_course_mode +( + community_id number(38) not null, + course_mode varchar2(40) not null, + number_of_blocks number(38), + start_date date, + enabled_p char(1) not null, + constraint bcm_pk primary key (community_id), + constraint bcm_community_id_fk foreign key (community_id) references dotlrn_communities_all(community_id) on delete cascade +); + +create table blocks_blocks +( + community_id number(38) not null, + block_id number(38) not null, + block_name varchar2(400), + summary varchar2(4000), + block_index number(38) not null, + display_p char(1) not null, + constraint bb_pk primary key (block_id), + constraint bb_community_id_fk foreign key (community_id) references blocks_course_mode(community_id) on delete cascade +); + +create table blocks_objects +( + block_object_id number(38) not null, + block_id number(38) not null, + resource_type varchar2(40) not null, + object_id number(38), + label varchar2(400), + object_index number(38) not null, + indent number(38), + display_p char(1) not null, + constraint bo_pk primary key (block_object_id), + constraint bo_object_id_fk foreign key (object_id) references acs_objects(object_id) on delete cascade, + constraint bo_block_id_fk foreign key (block_id) references blocks_blocks(block_id) on delete cascade +); + +CREATE SEQUENCE blocks_seq + MINVALUE 1 + START WITH 1 + INCREMENT BY 1 + CACHE 20; + +CREATE SEQUENCE blocks_objects_seq + MINVALUE 1 + START WITH 1 + INCREMENT BY 1 + CACHE 20; Index: openacs-4/packages/planner/sql/postgresql/planner-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/sql/postgresql/planner-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/sql/postgresql/planner-create.sql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,42 @@ +create table blocks_course_mode +( + community_id integer not null PRIMARY KEY references dotlrn_communities_all(community_id) on delete cascade, + course_mode varchar(40) not null, + number_of_blocks integer, + start_date date, + enabled_p char(1) not null +); + +create table blocks_blocks +( + community_id integer not null references blocks_course_mode(community_id) on delete cascade, + block_id integer not null PRIMARY KEY, + block_name varchar(400), + summary varchar(4000), + block_index integer not null, + display_p char(1) not null +); + +create table blocks_objects +( + block_object_id integer not null PRIMARY KEY, + block_id integer not null references blocks_blocks(block_id) on delete cascade, + resource_type varchar(40) not null, + object_id integer references acs_objects(object_id) on delete cascade, + label varchar(400), + object_index integer not null, + indent integer, + display_p char(1) not null +); + +CREATE SEQUENCE blocks_seq + MINVALUE 1 + START WITH 1 + INCREMENT BY 1 + CACHE 20; + +CREATE SEQUENCE blocks_objects_seq + MINVALUE 1 + START WITH 1 + INCREMENT BY 1 + CACHE 20; Index: openacs-4/packages/planner/tcl/planner-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/tcl/planner-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/tcl/planner-procs-oracle.xql 10 Jul 2009 17:03:37 -0000 1.1 @@ -0,0 +1,14 @@ + + + + oracle8.1.6 + + + + select to_char(start_date, 'YYYY-MM-DD') + from blocks_course_mode + where community_id = :community_id + + + + Index: openacs-4/packages/planner/tcl/planner-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/tcl/planner-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/tcl/planner-procs-postgresql.xql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + select to_char(start_date, 'YYYY-MM-DD') + from blocks_course_mode + where community_id = :community_id + + + + Index: openacs-4/packages/planner/tcl/planner-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/tcl/planner-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/tcl/planner-procs.tcl 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,1022 @@ +ad_library { + + Procs for Planner View in dotLRN + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-08 + +} + +namespace eval planner {} + +ad_proc -public planner::flush_blocks_cache { + {-community_id:required} + {-navigation_p 1} +} { + Flush the blocks cache + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param community_id Delete the cache of the specified community + @param navigation_p Delete the cache for the navigation select +} { + if { $navigation_p } { + util_memoize_flush "planner::get_blocks_navigation_info_not_cached -community_id $community_id" + } + util_memoize_flush "planner::get_blocks_admin_info_not_cached -community_id $community_id" + util_memoize_flush "planner::get_blocks_info_not_cached -community_id $community_id" +} + +ad_proc -public planner::get_objects_names { + {-community_id:required} +} { + Returns an array with all the names from the objects in the blocks + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param community_id The community id to get the blocks information +} { + db_foreach get_object_types { *SQL* } { + switch $object_type { + "evaluation_tasks" { + set object_type_query_name "get_tasks_name" + } + "file_storage_object" - + "as_assessments" - + "::xowiki::PlainPage" - + "::xowiki::Page" { + set object_type_query_name "get_items_name" + } + "content_extlink" { + set object_type_query_name "get_links_name" + } + "chat_room" { + set object_type_query_name "get_chat_rooms_name" + } + default { + set object_type_query_name "get_objects_name" + } + } + if {![string equal $object_type "category"]} { + db_foreach $object_type_query_name { *SQL* } { + set names($object_id) $name + } + } else { + db_foreach $object_type_query_name { *SQL* } { + set parent_id [category::get_parent -category_id $object_id] + for {set i 0} { $parent_id != 0 && $i < 2 } { incr i } { + set category_id $parent_id + set name "[content_portlet::get_category_name -category_id $parent_id]:$name" + set parent_id [category::get_parent -category_id $category_id] + } + set names($object_id) $name + } + } + } + return [array get names] +} + +ad_proc -public planner::get_object_types_names { + {-community_id:required} +} { + Returns an array with all the pretty names from the object types in the blocks + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Feb-2009 + + @param community_id The community id to get the blocks information +} { + db_foreach get_object_types { *SQL* } { + set object_types_names($object_type) [planner::get_object_type_pretty_name -object_type $object_type] + } + return [array get object_types_names] +} + +ad_proc -public planner::get_content_categories { + {-content_package_id:required} +} { + Returns all the categories from the given learning-content instance + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param content_package_id The package id of the learning-content instance to get the categories +} { + # get all content categories for the select + # get the categories of the tree in the default locale, not the current one + set locale "en_US" + template::multirow -local create content_categories category_id category_name + set trees [category_tree::get_mapped_trees $content_package_id] + foreach tree $trees { + set tree_id [lindex $tree 0] + set units [db_list get_categories { *SQL* }] + set tree_list [list] + foreach unit_id $units { + set category_list [list] + if { [category::count_children -category_id $unit_id] } { + set categories [category::get_children -category_id $unit_id] + foreach category_id $categories { + set subcategory_list [list] + if { [category::count_children -category_id $category_id] } { + set subcategories [category::get_children -category_id $category_id] + foreach subcategory_id $subcategories { + if { [llength [category::get_objects -category_id $subcategory_id]] > 0 } { + set subcategory_name [content_portlet::get_category_name -category_id $subcategory_id] + set subcategory_name "     $subcategory_name" + lappend subcategory_list $subcategory_id $subcategory_name + } + } + } + if { [llength [category::get_objects -category_id $category_id] ] || [llength $subcategory_list] > 0 } { + set category_name [content_portlet::get_category_name -category_id $category_id] + set category_name "   $category_name" + lappend category_list $category_id $category_name + } + foreach sub $subcategory_list { lappend category_list $sub } + } + } + if { [llength [category::get_objects -category_id $category_id] ] || [llength $category_list] > 0 } { + set unit_name [content_portlet::get_category_name -category_id $unit_id] + lappend tree_list $unit_id $unit_name + } + foreach cat $category_list { lappend tree_list $cat } + } + for {set i 0 } { $i < [llength $tree_list] } { set i [expr $i + 2] } { + template::multirow -local append content_categories [lindex $tree_list $i] [lindex $tree_list [expr $i + 1]] + } + } + return [template::util::multirow_to_list content_categories] +} + +ad_proc -public planner::get_blocks_navigation_info { + {-community_id:required} +} { + Returns a list with two objects, the first one is an array with + the information about every object in the blocks of a given community + and the second one is an array with the information needed to display + the navigation (cached) + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param community_id The community id to get the objects in the blocks +} { + return [util_memoize [list planner::get_blocks_navigation_info_not_cached -community_id $community_id]] +} + +ad_proc -public planner::get_blocks_navigation_info_not_cached { + {-community_id:required} +} { + Returns a list with two objects, the first one is an array with + the information about every object in the blocks of a given community + and the second one is an array with the information needed to display + the navigation (not cached) + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param community_id The community id to get the objects in the blocks +} { + set get_next_object_p 0 + set last_block_id 0 + set inside_block_object_p 0 + set next_object_id 0 + set prev_object_id 0 + set objects_names [planner::get_objects_names -community_id $community_id] + array set names $objects_names + db_multirow -local -extend { object_name changed_p selected_code last_p } get_blocks get_blocks_info {} { + if { $get_next_object_p } { + set next_object_id $object_id + set get_next_object_p 0 + } + set previous_block $last_block_id + if { $last_block_id == $block_id } { + set changed_p 0 + incr block_count + if { $count == $block_count } { + set last_p 1 + } + } else { + # If there's 1 or 0 objects in block, the block ends here + if { $count == 0 || $count == 1 } { + set last_p 1 + } + set block_count 1 + set changed_p 1 + } + set last_block_id $block_id + # If we are in a page that has a blocks_object_id set the navigation select for this object + if { [exists_and_not_null blocks_object_id] && $blocks_object_id == $object_id } { + set object_name "#planner.blocks_go_to#" + } else { + set selected_code "" + set object_name $names($object_id) + set object_name [string_truncate -len 50 $object_name] + } + set last_object_id $object_id + } + return [template::util::multirow_to_list get_blocks] +} + +ad_proc -public planner::get_blocks_admin_info { + {-community_id:required} +} { + Returns a list with 5 objects, the first one is an array with the + information about every object in the blocks of a given community and the + rest are information needed to display the blocks (cached) + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param community_id The community id to get the objects in the blocks for admins +} { + return [util_memoize [list planner::get_blocks_admin_info_not_cached -community_id $community_id]] +} + +ad_proc -public planner::get_blocks_admin_info_not_cached { + {-community_id:required} +} { + Returns a list with 5 objects, the first one is an array with the + information about every object in the blocks of a given community and the + rest are information needed to display the blocks (not cached) + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param community_id The community id to get the objects in the blocks for admins +} { + set current_time [clock seconds] + set start_time [planner::get_start_date -community_id $community_id] + if { $start_time != 0 } { + set start_time [clock scan $start_time] + } else { + set start_time $current_time + } + set display_mode [planner::get_mode -community_id $community_id] + # Possible modes are -weeks- or -topics- + if { [string equal $display_mode "weeks"] } { + set dates 1 + } else { + set dates 0 + } + #TODO: Add move_id as a proc param if the option to move blocks w/o ajax is enabled + set move_id 0 + set blocks_list [list] + set blocks_index_list [list] + set objects_list [list] + set multirow_extend [list changed_p object_name previous_block \ + block_label current_block_p block_class object_image \ + image_specs last_p link_target] + set open_external_object_types [list "content_extlink" "file_storage_object"] + set last_block_id 0 + set first_block_objects 0 + set last_class "" + set objects_names [planner::get_objects_names -community_id $community_id] + set object_types_names [planner::get_object_types_names -community_id $community_id] + array set names $objects_names + array set object_types $object_types_names + # This multirow gets block_id and object_id, changed_p = 1 when we are + # entering on a new block to draw the block frame in the adp + db_multirow -local -extend $multirow_extend get_blocks get_blocks_admin_info { *SQL* } { + if { $block_index == 0 } { set first_block_objects $count } + if { ![empty_string_p $indent] } { + set indent [expr {$indent * 20}] + } else { + set indent 0 + } + if { $last_block_id == $block_id } { + set changed_p 0 + incr block_count + if { $count == $block_count } { + set last_p 1 + } + set block_class $last_class + } else { + # If there's 1 or 0 objects in block, the block ends here + if { $count == 0 || $count == 1 } { + set last_p 1 + } + # This is the first object of a new block, get the block information + lappend blocks_list "$block_id" + lappend blocks_index_list "$block_index" + set changed_p 1 + set block_count 1 + # Blocks Names are for all blocks except the first one index = 0 + if { $dates == 1 && $block_index > 0 } { + set start_clock $start_time + set start_time [clock scan "6 days" -base $start_time] + set end_clock $start_time + set block_label [planner::get_block_dates -start_clock $start_clock] + set start_time [clock scan "1 day" -base $start_time] + set block_class "" + if { $block_index > 0 && $block_display == "t" } { + if { $start_clock < $current_time && [clock scan "1 day" -base $end_clock] > $current_time && $dates == 1 } { + set current_block_p 1 + set block_class "current-block" + } else { + set current_block_p 0 + } + } else { + if { $block_index != 0 } { + set block_class "hidden-block" + } + } + } + if { ![empty_string_p $summary] } { + set summary [lindex $summary 0] + } + set last_class $block_class + } + set last_block_id $block_id + if {![empty_string_p $object_id]} { + lappend objects_list "$block_object_id" + if {$object_id != 0} { + if {[lsearch -exact $open_external_object_types $object_type] != -1} { + set link_target "_blank" + } else { + set link_target "" + } + set image_specs "width=16 height=16" + set object_image [planner::get_object_icon -object_type $object_type] + set object_type_name $object_types($object_type) + set object_name $names($object_id) + set object_name [string_truncate -len 100 $object_name] + } else { + set object_name [lindex $label 0] + } + } else { + set object_name "" + } + if { $block_object_id == $move_id } { + set container_id $block_id + set move_name $object_name + set object_name "" + } + append block_class " blocks-move" + } + return [list [template::util::multirow_to_list get_blocks] $blocks_list $blocks_index_list $objects_list $first_block_objects] +} + +ad_proc -public planner::get_blocks_info { + {-community_id:required} +} { + Returns an array with the information about every + object in the blocks of a given community (cached) + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param community_id The community id to get the objects in the blocks for admins +} { + return [util_memoize [list planner::get_blocks_info_not_cached -community_id $community_id]] +} + +ad_proc -public planner::get_blocks_info_not_cached { + {-community_id:required} +} { + Returns an array with the information about every + object in the blocks of a given community (not cached) + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jan-2009 + + @param community_id The community id to get the objects in the blocks for admins +} { + set current_time [clock seconds] + set start_time [planner::get_start_date -community_id $community_id] + if { $start_time != 0 } { + set start_time [clock scan $start_time] + } else { + set start_time $current_time + } + set display_mode [planner::get_mode -community_id $community_id] + # Possible modes are -weeks- or -topics- + if { [string equal $display_mode "weeks"] } { + set dates 1 + } else { + set dates 0 + } + set last_block_id 0 + set multirow_extend [list changed_p object_name \ + block_label current_block_p block_class object_image \ + image_specs last_p link_target] + set open_external_object_types [list "content_extlink" "file_storage_object"] + set objects_names [planner::get_objects_names -community_id $community_id] + array set names $objects_names + # This multirow gets block_id and object_id, changed_p = 1 when we are + # entering on a new block to draw the block frame in the adp + db_multirow -local -extend $multirow_extend get_blocks get_blocks_info { *SQL* } { + if { $block_index == 0 } { set first_block_objects $count } + if { ![empty_string_p $indent] } { + set indent [expr {$indent * 20}] + } else { + set indent 0 + } + if { $last_block_id == $block_id } { + set changed_p 0 + incr block_count + if { $count == $block_count } { + set last_p 1 + } + } else { + # If there's 1 or 0 objects in block, the block ends here + if { $count == 0 || $count == 1 } { + set last_p 1 + } + set changed_p 1 + set block_count 1 + # This is the first object of a new block, get the block information + # Blocks Names are for all blocks except the first one index = 0 + if { $dates == 1 && $block_index > 0 } { + set start_clock $start_time + set start_time [clock scan "6 days" -base $start_time] + set end_clock $start_time + set block_label [planner::get_block_dates -start_clock $start_clock] + set start_time [clock scan "1 day" -base $start_time] + set block_class "" + if { $block_index > 0 && $block_display == "t" } { + if { $start_clock < $current_time && [clock scan "1 day" -base $end_clock] > $current_time && $dates == 1 } { + set current_block_p 1 + set block_class "current-block" + } else { + set current_block_p 0 + } + } else { + if { $block_index != 0 } { + set block_class "hidden-block" + } + } + } + if { ![empty_string_p $summary] } { + set summary [lindex $summary 0] + } + } + set last_block_id $block_id + if {![empty_string_p $object_id]} { + lappend objects_list "$block_object_id" + if {$object_id != 0} { + if {[lsearch -exact $open_external_object_types $object_type] != -1} { + set link_target "_blank" + } else { + set link_target "" + } + set image_specs "width=16 height=16" + set object_image [planner::get_object_icon -object_type $object_type] + set object_name $names($object_id) + set object_name [string_truncate -len 100 $object_name] + } else { + set object_name [lindex $label 0] + } + } else { + set object_name "" + } + } + return [template::util::multirow_to_list get_blocks] +} + +ad_proc -public planner::get_next_object_index { + {-block_id:required} +} { + Gets the next object index to add a new object + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + + @param block_id The block to get the objects and check the indexes + +} { + set object_index [db_string get_max_index {} -default 0] + if { [empty_string_p $object_index] } { set object_index 0 } + incr object_index + return $object_index +} + +ad_proc -public planner::insert_object_to_block { + {-block_id:required} + {-object_id:required} + {-resource_type "object"} + {-object_index:required} + {-label_text ""} + {-indent 0} +} { + Gets the next object index to add a new object + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + + @param block_id The block to get the objects and check the indexes + +} { + set block_object_id [db_nextval blocks_objects_seq] + db_dml insert_object_to_block {} +} + +ad_proc -public planner::get_block_index { + {-block_id:required} +} { + Gets the index of a block inside a community + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set block_index [db_string get_block_index {} -default 0] + return $block_index +} + +ad_proc -public planner::get_object_index { + {-block_object_id:required} +} { + Gets the index of an object inside a block + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set object_index [db_string get_object_index {} -default 0] + return $object_index +} + +ad_proc -public planner::get_object_id { + {-block_object_id:required} +} { + Gets the object_id of an object inside a block + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set object_id [db_string get_object_id {} -default 0] + return $object_id +} + +ad_proc -public planner::get_label { + {-block_object_id:required} +} { + Gets the label of an object inside a block + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set label_text [db_string get_label {} -default ""] + return $label_text +} + +ad_proc -public planner::update_block_index { + {-block_id:required} + {-block_index:required} +} { + Update the index of a block inside a community + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + db_dml update_block_index { *SQL* } +} + +ad_proc -public planner::get_start_date { + {-community_id:required} +} { + Gets the start date of a community in Block View + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set start_date [db_string get_start_date {} -default 0] + return $start_date +} + +ad_proc -public planner::count_block_objects { + {-block_id:required} +} { + Gets the number of objects inside a block + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + + @param block_id The block to get the number of objects + +} { + set count [db_string count_block_objects {} -default 0] + return $count +} + +ad_proc -public planner::get_block_id { + {-block_object_id:required} +} { + Gets the id of the block containing the object + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set block_id [db_string get_block_id {} -default 0] + return $block_id +} + +ad_proc -public planner::get_community_id_from_block_id { + {-block_id:required} +} { + Get the community id based on the block_id +} { + set community_id [db_string get_community_id { *SQL* } -default 0] + return $community_id +} + +ad_proc -public planner::get_mode { + {-community_id:required} +} { + Gets the mode of a community in Block View + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set mode [db_string get_mode {} -default "weeks"] + return $mode +} + +ad_proc -public planner::get_object_name { + {-object_id:required} + {-object_type:required} +} { + Gets the name of an object depending on the object_type + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + switch $object_type { + "evaluation_tasks" { + set revision_id [content::item::get_best_revision -item_id $object_id] + set object_name [db_string get_task_name {} -default ""] + } + "file_storage_object" - + "as_assessments" - + "::xowiki::PlainPage" - + "::xowiki::Page" { + set object_name [db_string get_item_name {} -default ""] + } + "chat_room" { + set object_name [db_string get_chat_room_name {} -default ""] + } + "category" { + set object_name [content_portlet::get_category_name -category_id $object_id] + set parent_id [category::get_parent -category_id $object_id] + for {set i 0} { $parent_id != 0 && $i < 2 } { incr i } { + set object_id $parent_id + set object_name "[content_portlet::get_category_name -category_id $parent_id]:$object_name" + set parent_id [category::get_parent -category_id $object_id] + } + } + default { + set object_name [db_string get_object_name {} -default ""] + } + } + return $object_name +} + +ad_proc -public planner::get_object_type_pretty_name { + {-object_type:required} +} { + Gets the pretty name for an object type, some object_types have + a special pretty name defined here and the rest use the standard + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Oct-2008 + +} { + switch $object_type { + "forums_forum" { + set object_type_name [_ forums.Forum] + } + "forums_message" { + set object_type_name [_ forums.forums_message] + } + "evaluation_tasks" { + set object_type_name [_ dotlrn-evaluation.Evaluation_] + } + "file_storage_object" { + set object_type_name [_ file-storage.file] + } + "content_extlink" { + set object_type_name [_ file-storage.link] + } + "content_folder" { + set object_type_name [_ file-storage.Folder] + } + "as_assessments" { + set object_type_name [_ assessment.Assessment] + } + "::xowiki::PlainPage" { + set object_type_name [_ planner.blocks_text_page] + } + "::xowiki::Page" { + set object_type_name [_ planner.blocks_web_page] + } + "chat_room" { + set object_type_name [_ chat.chat_rooms] + } + default { + set object_type_name [subsite::util::object_type_pretty_name $object_type] + } + } + return $object_type_name +} + +ad_proc -public planner::get_object_icon { + {-object_type:required} +} { + Gets the icon of an object depending on the object_type + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + switch $object_type { + "evaluation_tasks" { + set object_image "/resources/theme-tupi/images/added/evaluation_evaluations_portlet.png" + } + "as_assessments" { + set object_image "/resources/theme-tupi/images/added/assessment_portlet.png" + } + "forums_forum" { + set object_image "/resources/theme-tupi/images/added/forums_portlet.png" + } + "::xowiki::PlainPage" { + set object_image "/resources/dotlrn/text_pages.png" + } + "::xowiki::Page" { + set object_image "/resources/dotlrn/web_pages.png" + } + "file_storage_object" { + set object_image "/resources/file-storage/file.gif" + } + "content_extlink" { + set object_image "/resources/acs-subsite/url-button.gif" + } + "content_folder" { + set object_image "/resources/file-storage/folder.gif" + } + "category" - + "apm_package" { + set object_image "/resources/theme-tupi/images/added/content_portlet.png" + } + "chat_room" { + set object_image "/resources/theme-tupi/images/added/chat_portlet.png" + } + default { + set object_image "" + } + } + return $object_image +} + +ad_proc -public planner::show_alert_message { + {-object_id:required} + {-community_url "/dotlrn"} +} { + Set a cookie with the message to be shown in the master + after an activity has been added to blocks from another's + package view. + This is to let the user know that the activity has been + added and that can continue editing the activity + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set community_url "${community_url}planner/" + set object_type [acs_object_type $object_id] + if {[string equal $object_type "content_item"]} { + set object_type [content::item::get_content_type -item_id $object_id] + } + set object_name [planner::get_object_name -object_id $object_id -object_type $object_type] + set object_type [planner::get_object_type_pretty_name -object_type $object_type] + set user_message "[_ planner.blocks_new_object_alert_message]" + util_user_message -html -message $user_message +} + +ad_proc -public planner::enabled_p { + {-community_id:required} +} { + Check if the Block View is enabled for a community + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + if { [catch { set enabled_p [db_string check_enabled_p {} -default ""] } errmsg ] } { + set enabled_p "f" + } + return $enabled_p +} + +ad_proc -public planner::enable { + {-community_id:required} + {-enable_p "f"} +} { + Mount the dependencies to enable the Block View for a community + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set community_url [dotlrn_community::get_community_url $community_id] + #instantiate pages package + set activity "pages" + if {![site_node::exists_p -url "${community_url}${activity}" ]} { + dotlrn::instantiate_and_mount -mount_point "pages" $community_id pages + } + #check if assessment is mounted, if not mount it + set activity "assessment" + if {![site_node::exists_p -url "${community_url}${activity}" ]} { + dotlrn_community::add_applet_to_community $community_id dotlrn_assessment + } + #check if evaluation is mounted, if not mount it + set activity "evaluation" + if {![site_node::exists_p -url "${community_url}${activity}"]} { + dotlrn_community::add_applet_to_community $community_id dotlrn_evaluation + } + if {[apm_package_installed_p "chat"]} { + #check if chat is mounted, if not mount it + set activity "chat" + if {![site_node::exists_p -url "${community_url}${activity}"]} { + dotlrn_community::add_applet_to_community $community_id dotlrn_chat + } + } + if {[apm_package_installed_p "learning-content"]} { + #check if content is mounted, if not mount it + set activity "learning-content" + if {![site_node::exists_p -url "${community_url}${activity}"]} { + dotlrn_community::add_applet_to_community $community_id dotlrn_learning_content + } + } + # Mount the planner package + dotlrn::instantiate_and_mount $community_id planner + #Insert the community to blocks view and create the first empty block by default + if { [string equal [planner::enabled_p -community_id $community_id] ""] } { + set current_index 0 + set course_mode "weeks" + set block_id [db_nextval blocks_seq] + db_dml insert_block_mode { *SQL* } + db_dml create_first_block { *SQL* } + } + db_dml block_view_enable { *SQL* } +} + +ad_proc -public planner::get_admin_links_query { + {-community_id:required} +} { + Check if the Block View is enabled for a community + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set links_list "'members', 'calendar/cal-item-new', 'subcommunity-new', 'spam-recipients?referer=one-community-admin'" + set links_query "select distinct ta.item_id, ta.name, ta.image, ta.url, ta.all_classes_p + from tupi_admin_links ta, community_admin_links ca + where ((ta.item_id = ca.item_id + and ca.community_id = :community_id) or ta.all_classes_p = 't') and url in ( $links_list )" + return $links_query +} + +ad_proc -public planner::get_block_dates { + {-start_clock:required} +} { + Returns the dates of a block when using weeks mode + The format is "day month - day month" + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 + +} { + set start_date [clock format $start_clock -format "%Y-%m-%d"] + set start_date [lc_time_fmt $start_date "%d %B"] + set start_clock [clock scan "6 day" -base $start_clock] + set end_date [clock format $start_clock -format "%Y-%m-%d"] + set end_date [lc_time_fmt $end_date "%d %B"] + set dates "$start_date - $end_date" + return $dates +} + +ad_proc -callback planner::extend_form { + -block_id:required + {-block_object_type ""} + {-form_name} + {-referrer ""} + {-community_id ""} +} { + This callback is invoked when serving the form to create a + new object from the packages involved in the blocks view + for dotlrn when using blocks view mode. + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 +} - + +ad_proc -callback planner::insert_object { + -block_id:required + -object_id:required + {-community_id ""} + {-resource_type "object"} + {-label_text ""} +} { + This callback is invoked when submiting the form to create a + new object from the packages involved in the blocks view + for dotlrn when using blocks view mode. + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jul-2008 +} - + +ad_proc -callback planner::new_url { + -object_id:required +} { + This callback is invoked when a URL needs to be generated for the + edit action of an object. +} - + +ad_proc -callback planner::edit_url { + -object_id:required +} { + This callback is invoked when a URL needs to be generated for the + edit action of an object. +} - + +ad_proc -callback planner::delete_url { + -object_id:required +} { + This callback is invoked when a URL needs to be generated for the + delete action of an object. +} - + +ad_proc -callback planner::flush_blocks_cache { + -community_id:required + {-navigation_p 1} +} { + This callback is invoked when add/edit/delete an object + from the blocks to flush the cache + + @author Alvaro Rodriguez ( alvaro@viaro.net ) + @creation-date Jan-2009 +} - + +ad_proc -public -callback planner::extend_form -impl planner {} { + + @author alvaro@viaro.net + @creation_date Jul-2008 + + Extend the form of the insert/edit page to add the objects to the + blocks view table, this callbacks works for most packages in blocks mode + (evaluation, assessment, forums, chat) + +} { + if { $block_id != 0 } { + ad_form -extend -name $form_name -form { {block_id:text(hidden) {value $block_id}} + {block_object_type:text(hidden) {value $block_object_type}} + } + } +} + +ad_proc -public -callback planner::insert_object -impl planner {} { + + @author alvaro@viaro.net + @creation_date Jul-2008 + + Insert the recently created object into the blocks view objects table + this callbacks works for most packages in blocks mode (evaluation, + assessment, forums, chat) + +} { + if { $block_id != 0 } { + if {[empty_string_p $resource_type]} { + set resource_type "object" + } + set object_index [planner::get_next_object_index -block_id $block_id] + planner::insert_object_to_block -block_id $block_id -object_id $object_id -object_index $object_index -resource_type $resource_type -label_text $label_text + set community_id [planner::get_community_id_from_block_id -block_id $block_id] + set community_url [dotlrn_community::get_community_url $community_id] + planner::show_alert_message -object_id $object_id -community_url $community_url + } else { + set community_id [dotlrn_community::get_community_id] + } + planner::flush_blocks_cache -community_id $community_id +} + +ad_proc -public -callback planner::flush_blocks_cache -impl planner {} { + + @author alvaro@viaro.net + @creation_date Jan-2009 + + Flush the cache of the blocks content when doing an action in the blocks + +} { + planner::flush_blocks_cache -community_id $community_id -navigation_p $navigation_p +} Index: openacs-4/packages/planner/tcl/planner-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/tcl/planner-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/tcl/planner-procs.xql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,343 @@ + + + + + + + select distinct (case object_type when 'content_item' + then (select content_type + from cr_items + where item_id = ba.object_id) + else ba.object_type end) as object_type + from ( select distinct bo.object_id, + (select object_type + from acs_objects + where object_id = bo.object_id) as object_type + from blocks_objects bo, (select block_id from blocks_blocks where community_id = :community_id) bb + where bb.block_id = bo.block_id ) ba + + + + + + select o.*, ao.title as name + from (select distinct object_id + from blocks_objects bo, (select block_id from blocks_blocks where community_id = :community_id) bb + where bb.block_id = bo.block_id) o, + acs_objects ao + where o.object_id = ao.object_id + and ao.object_type = :object_type + + + + + + select o.*, cr.title as name + from (select distinct object_id + from blocks_objects bo, (select block_id from blocks_blocks where community_id = :community_id) bb + where bb.block_id = bo.block_id) o, + cr_revisions cr + where item_id = o.object_id + and (select content_type + from cr_items + where item_id = o.object_id) = :object_type + and revision_id = (select coalesce(live_revision, latest_revision) + from cr_items where item_id = o.object_id) + + + + + + select o.*, ev.task_name as name + from (select distinct object_id + from blocks_objects bo, (select block_id from blocks_blocks where community_id = :community_id) bb + where bb.block_id = bo.block_id) o, + evaluation_tasksi ev + where task_item_id = o.object_id + and (select content_type + from cr_items + where item_id = o.object_id) = :object_type + and revision_id = (select coalesce(live_revision, latest_revision) + from cr_items where item_id = o.object_id) + + + + + + select o.*, cr.pretty_name as name + from (select distinct object_id + from blocks_objects bo, (select block_id from blocks_blocks where community_id = :community_id) bb + where bb.block_id = bo.block_id) o, + chat_rooms cr + where o.object_id = cr.room_id + and (select object_type + from acs_objects + where object_id = o.object_id) = :object_type + + + + + + select o.*, cre.label as name + from (select distinct object_id + from blocks_objects bo, (select block_id from blocks_blocks where community_id = :community_id) bb + where bb.block_id = bo.block_id) o, + cr_extlinks cre + where o.object_id = cre.extlink_id + + + + + + select distinct (case object_type when 'content_item' + then (select content_type + from cr_items + where item_id = ba.object_id) + else ba.object_type end) as object_type + from ( select distinct bo.object_id, + (select object_type + from acs_objects + where object_id = bo.object_id) as object_type + from blocks_objects bo, (select block_id from blocks_blocks where community_id = :community_id) bb + where bb.block_id = bo.block_id ) ba + + + + + + select c.category_id as category_id from categories c, category_translations ct + where parent_id is null + and tree_id = :tree_id + and c.category_id = ct.category_id + and locale = :locale + order by name + + + + + + select ba.*, + (case object_type when 'content_item' + then (select content_type from cr_items where item_id = object_id) + else object_type end) as object_type + from ( + select bo.object_id, bo.display_p as object_display, bb.block_id, bb.block_index, + (select count(*) from blocks_objects where block_id = bb.block_id) as count, + bb.block_name, bb.display_p as block_display, + (select object_type from acs_objects where object_id = bo.object_id) as object_type + from blocks_blocks bb, blocks_objects bo + where bb.community_id = :community_id + and bb.block_index <= ( select number_of_blocks from blocks_course_mode where community_id = :community_id ) + and bb.block_id = bo.block_id + and bo.object_id != 0 + order by bb.block_index, bo.object_index) ba + + + + + + select ba.*, + (case object_type when 'content_item' + then (select content_type from cr_items where item_id = object_id) + else object_type end) as object_type + from ( + select bb.*, bo.object_index, bo.object_id, bo.display_p as object_display, bo.indent, bo.label, bo.resource_type, bo.block_object_id, + (select object_type from acs_objects where object_id = bo.object_id) as object_type + from ( + select bb.block_id, bb.block_index, bb.summary, + bb.block_name, bb.display_p as block_display, + (select count(*) from blocks_objects where block_id = bb.block_id) as count + from blocks_blocks bb + where bb.community_id = :community_id + and bb.block_index <= ( + select number_of_blocks from blocks_course_mode where community_id = :community_id ) + order by block_index + ) bb + left join blocks_objects bo + on bb.block_id = bo.block_id + order by bb.block_index, bo.object_index) ba + + + + + + select ba.*, + (case object_type when 'content_item' + then (select content_type from cr_items where item_id = object_id) + else object_type end) as object_type + from ( + select bb.*, bo.object_index, bo.object_id, bo.display_p as object_display, bo.indent, bo.label, bo.resource_type, bo.block_object_id, + (select object_type from acs_objects where object_id = bo.object_id) as object_type + from ( + select bb.block_id, bb.block_index, bb.summary, + (select count(*) from blocks_objects where block_id = bb.block_id) as count, + bb.block_name, bb.display_p as block_display + from blocks_blocks bb + where bb.community_id = :community_id + and bb.block_index <= ( + select number_of_blocks from blocks_course_mode where community_id = :community_id ) + order by block_index + ) bb + left join blocks_objects bo + on bb.block_id = bo.block_id + order by bb.block_index, bo.object_index) ba + + + + + + select max(object_index) + from blocks_objects + where block_id = :block_id + + + + + + insert into + blocks_objects ( block_object_id, block_id, resource_type, object_id, label, object_index, indent, display_p ) + values ( :block_object_id, :block_id, :resource_type, :object_id, :label_text, :object_index, :indent, 't' ) + + + + + + select block_index + from blocks_blocks + where block_id = :block_id + + + + + + select object_index + from blocks_objects + where block_object_id = :block_object_id + + + + + + select object_id + from blocks_objects + where block_object_id = :block_object_id + + + + + + select label + from blocks_objects + where block_object_id = :block_object_id + + + + + + update blocks_blocks + set block_index = :block_index + where block_id = :block_id + + + + + + select enabled_p + from blocks_course_mode + where community_id = :community_id + + + + + + select count(*) + from blocks_objects + where block_id = :block_id + + + + + + select block_id + from blocks_objects + where block_object_id = :block_object_id + + + + + + insert into + blocks_course_mode ( community_id, course_mode, number_of_blocks, enabled_p ) + values ( :community_id, 'weeks', 0, :enable_p) + + + + + + insert into + blocks_blocks ( community_id, block_id, block_index, display_p ) + values ( :community_id, :block_id, :current_index, 't' ) + + + + + + update blocks_course_mode + set enabled_p = :enable_p + where community_id = :community_id + + + + + + select task_name + from evaluation_tasksi + where task_item_id = :object_id + and revision_id = :revision_id + + + + + + select title + from cr_revisions + where revision_id = ( + select coalesce(live_revision,latest_revision) + from cr_items + where item_id = :object_id) + + + + + + select title + from acs_objects + where object_id = :object_id + + + + + + select pretty_name + from chat_rooms + where room_id = :object_id + + + + + + select course_mode + from blocks_course_mode + where community_id = :community_id + + + + + + select community_id + from blocks_blocks + where block_id = :block_id + + + + Index: openacs-4/packages/planner/www/block-update-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/block-update-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/block-update-oracle.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,23 @@ + + + + oracle8.1.6 + + + + select * + from ( + select block_id, block_index, display_p as block_display, + lag(block_id)over(order by block_index) prev_block_id, + lag(block_id)over(order by block_index desc) next_block_id + from blocks_blocks + where community_id = :community_id + and block_index <= ( + select number_of_blocks from blocks_course_mode where community_id = :community_id ) + order by block_index) + where block_index >= :first_block_index + and block_index <= :second_block_index + + + + Index: openacs-4/packages/planner/www/block-update-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/block-update-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/block-update-postgresql.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,20 @@ + + + + + + + select * + from ( + select block_id, block_index, display_p as block_display + from blocks_blocks + where community_id = :community_id + and block_index <= ( + select number_of_blocks from blocks_course_mode where community_id = :community_id ) + order by block_index) bb + where block_index >= :first_block_index + and block_index <= :second_block_index + + + + Index: openacs-4/packages/planner/www/block-update.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/block-update.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/block-update.adp 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,17 @@ + + + +
      +
      + +
      +
      + +
      +
      + + + +
      ----- +
      + Index: openacs-4/packages/planner/www/block-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/block-update.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/block-update.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,22 @@ +ad_page_contract { + Update the object when moved to another block + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_index1 0} + {block_index2 0} +} + +set community_id [dotlrn_community::get_community_id] +set community_url [dotlrn_community::get_community_url $community_id] + +if { $block_index1 > $block_index2 } { + set first_block_index $block_index2 + set second_block_index $block_index1 +} else { + set first_block_index $block_index1 + set second_block_index $block_index2 +} + +db_multirow get_blocks get_block_info { *SQL* } {} \ No newline at end of file Index: openacs-4/packages/planner/www/blocks_help.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/blocks_help.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/blocks_help.adp 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,30 @@ + +
      +#planner.blocks_info_message# +

      +

      #planner.blocks_tutorials#

      +

      +[i] +#planner.blocks_note# +

      + + Index: openacs-4/packages/planner/www/course-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/course-edit-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/course-edit-oracle.xql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,24 @@ + + + + oracle8.1.6 + + + + update blocks_course_mode + set course_mode = :course_mode, number_of_blocks = :number_of_blocks, + start_date = (select to_date(:start_date, 'YYYY MM DD HH24 MI SS') from dual) + where community_id = :community_id + + + + + + select course_mode, number_of_blocks, + to_char(start_date,'YYYY MM DD') start_date + from blocks_course_mode + where community_id = :community_id + + + + Index: openacs-4/packages/planner/www/course-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/course-edit-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/course-edit-postgresql.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,23 @@ + + + + + + + update blocks_course_mode + set course_mode = :course_mode, number_of_blocks = :number_of_blocks, + start_date = (select to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') from dual) + where community_id = :community_id + + + + + + select course_mode, number_of_blocks, + to_char(start_date,'YYYY MM DD') as start_date + from blocks_course_mode + where community_id = :community_id + + + + Index: openacs-4/packages/planner/www/course-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/course-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/course-edit.adp 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,8 @@ + + @title;noquote@ + @context;noquote@ + + + + + Index: openacs-4/packages/planner/www/course-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/course-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/course-edit.tcl 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,88 @@ +ad_page_contract { + Edit course view mode + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {return_url ""} + {course_format ""} + {__refreshing_p 0} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set title "[_ planner.blocks_course_edit_mode]" +set context [list $title] + +set number_select [list] +for { set i 0 } { $i <= 52 } { incr i } { + lappend number_select [list $i $i] +} +set start_date [clock format [clock seconds] -format "%Y %m %d"] +db_0or1row blocks_course_mode_select { *SQL* } +if {[empty_string_p $course_format]} { + set course_format $course_mode +} + +ad_form -name blocks_course_mode \ + -form { + {course_format:text(select),optional + {label "[_ planner.blocks_format]"} + {options {{ "[_ planner.blocks_weekly_format]" weeks } + { "[_ planner.blocks_topics_format]" topics }}} + {html {onChange "document.blocks_course_mode.__refreshing_p.value='1';submit()"}} + {value $course_format} + } + {number_of_blocks:text(select),optional + {label "[_ planner.blocks_number_of_weeks]"} + {options {$number_select}} + {value $number_of_blocks} + } + } + +if {[string eq $course_format "weeks"]} { + ad_form -extend -name blocks_course_mode \ + -form { + {start_date:date(date),to_sql(linear_date) + {label "[_ planner.blocks_start_date]"} + {format "YYYY MM DD"} + {value $start_date} + {after_html { } } + } + } +} else { + ad_form -extend -name blocks_course_mode \ + -form { + {start_date:date(date),to_sql(linear_date),optional + {label "[_ planner.blocks_start_date]"} + {format "YYYY MM DD"} + {value $start_date} + {after_html {} } + } + } +} + +ad_form -extend -name blocks_course_mode \ + -validate { + {start_date + {[lindex $start_date 0] <= 2035} + { [_ planner.blocks_year_error] } + } + } -on_submit { + set current_blocks [db_string get_number_of_blocks {} -default 0] + set course_mode $course_format + db_dml update_block_mode { *SQL* } + if { ![empty_string_p $current_blocks] && $number_of_blocks > $current_blocks } { + # If number of blocks is greater than current blocks, create the rest + for { set i [expr $current_blocks + 1] } { $i <= $number_of_blocks } { incr i } { + set current_index $i + set block_id [db_nextval blocks_seq] + db_dml create_block { *SQL* } + } + } + } -after_submit { + ad_returnredirect $return_url + } Index: openacs-4/packages/planner/www/course-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/course-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/course-edit.xql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,30 @@ + + + + + + + insert into + blocks_blocks ( community_id, block_id, block_index, display_p ) + values ( :community_id, :block_id, :current_index, 't' ) + + + + + + select max(block_index) + from blocks_blocks + where community_id = :community_id + + + + + + update blocks_blocks + set summary = '' + where community_id = :community_id + and block_index = 0 + + + + Index: openacs-4/packages/planner/www/edit-mode.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/edit-mode.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/edit-mode.adp 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1 @@ +no data \ No newline at end of file Index: openacs-4/packages/planner/www/edit-mode.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/edit-mode.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/edit-mode.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,12 @@ +ad_page_contract { + Set cookie for blocks edit mode + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {cookie_value 0} + {return_url ""} +} + +ad_set_cookie blocks_edit_mode $cookie_value +ad_returnredirect "$return_url" \ No newline at end of file Index: openacs-4/packages/planner/www/enable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/enable.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/enable.tcl 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,20 @@ +ad_page_contract { + Enable/Disable Block View in a community + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {enable_p "f"} + {return_url ""} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +planner::enable -community_id $community_id -enable_p $enable_p + +if {![empty_string_p $return_url]} { + ad_returnredirect $return_url +} \ No newline at end of file Index: openacs-4/packages/planner/www/file-mode.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/file-mode.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/file-mode.adp 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1 @@ +no data \ No newline at end of file Index: openacs-4/packages/planner/www/file-mode.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/file-mode.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/file-mode.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,19 @@ +ad_page_contract { + Set cookie for blocks file-storage choose mode + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_id 0} + {community_id 0} + {return_url ""} +} + +ad_set_cookie fs_block_id $block_id +ad_set_cookie fs_community_id $community_id +set package_id [dotlrn_community::get_package_id_from_package_key \ + -package_key "file-storage" -community_id $community_id] +# Uncomment this when file-storage uses the interface web 2.0 +#set fs_web2 [parameter::get -package_id $package_id -parameter "UseAjaxFs" -default "-1"] +#ad_set_cookie fs_web2 $fs_web2 +ad_returnredirect $return_url \ No newline at end of file Index: openacs-4/packages/planner/www/get-activities.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/get-activities.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/get-activities.adp 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      #planner.blocks_there_are_no_activities#
      @forums.name@
      #planner.blocks_there_are_no_activities#
      @assessments.as_title@
      #planner.blocks_there_are_no_activities#
      @evaluations.grade_plural_name@
      @evaluations.task_name@
      #planner.blocks_there_are_no_activities#
      @text_pages.name@
      #planner.blocks_there_are_no_activities#
      @web_pages.name@
      #planner.blocks_there_are_no_activities#
      @chat_rooms.name@
      Index: openacs-4/packages/planner/www/get-activities.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/get-activities.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/get-activities.tcl 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,70 @@ +ad_page_contract { + Get the existing applications for content activities + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Apr 2008 + } { + {activity ""} + {parent_id 0} +} + +set result "" +set prev_forum_id 0 +set prev_grade_item_id 0 +set cont 0 +set community_package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +set community_url [dotlrn_community::get_community_url $community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +switch $activity { + "forums" { + set activity_type "forums" + set package_id [dotlrn_community::get_package_id_from_package_key -package_key $activity_type -community_id $community_id] + db_multirow forums get_forums { *SQL* } {} + } + "as_assessments" { + set activity_type "assessment" + set package_id [dotlrn_community::get_package_id_from_package_key -package_key $activity_type -community_id $community_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + db_multirow -extend { as_title } assessments get_as_item { *SQL* } { + set as_title [db_string get_as_title {} -default ""] + } + } + "evaluation_tasks" { + set activity_type "evaluation" + set package_id [dotlrn_community::get_package_id_from_package_key -package_key $activity_type -community_id $community_id] + db_multirow -extend { changed_p count } evaluations get_grades_with_info { *SQL* } { + if { $prev_grade_item_id == 0 } { + set changed_p 1 + } elseif { $prev_grade_item_id != $grade_item_id } { + set changed_p 1 + } else { + set changed_p 0 + } + set prev_grade_item_id $grade_item_id + set count $cont + incr cont + } + } + "web_pages" { + array set node [site_node::get_from_url -url "${community_url}pages/"] + set package_id $node(package_id) + set folder_id [content::folder::get_folder_from_package -package_id $package_id] + db_multirow web_pages get_web_pages { *SQL* } {} + } + "text_pages" { + array set node [site_node::get_from_url -url "${community_url}pages/"] + set package_id $node(package_id) + set folder_id [content::folder::get_folder_from_package -package_id $package_id] + db_multirow text_pages get_text_pages { *SQL* } {} + } + "chat_rooms" { + set activity_type "chat" + set package_id [dotlrn_community::get_package_id_from_package_key -package_key $activity_type -community_id $community_id] + db_multirow chat_rooms get_chat_rooms { *SQL* } {} + } +} + Index: openacs-4/packages/planner/www/get-activities.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/get-activities.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/get-activities.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,86 @@ + + + + + select title + from cr_revisions + where revision_id = :as_revision_id + + + + + + select item_id, latest_revision as as_revision_id + from cr_items + where parent_id = :folder_id + and content_type = :activity + and latest_revision is not null + + + + + + select ci.item_id, cr.title as name + from cr_revisions cr, + (select item_id, latest_revision + from cr_items + where parent_id = :folder_id + and content_type = '::xowiki::Page' + and name not like ('%:index')) ci + where ci.latest_revision = cr.revision_id + + + + + + select ci.item_id, cr.title as name + from cr_revisions cr, + (select item_id, latest_revision + from cr_items + where parent_id = :folder_id + and content_type = '::xowiki::PlainPage') ci + where ci.latest_revision = cr.revision_id + + + + + + select forum_id, name + from forums_forums ff + where package_id = :package_id + and enabled_p = 't' + + + + + + select et.task_name, et.task_id, et.task_item_id, eg.grade_plural_name, eg.grade_id, eg.grade_item_id + from cr_revisions cr, + evaluation_tasksi et, + cr_items cri, + cr_mime_types crmt, + (select eg.grade_plural_name, + eg.grade_id, eg.grade_item_id + from evaluation_grades eg, acs_objects ao, cr_items cri + where cri.live_revision = eg.grade_id + and eg.grade_item_id = ao.object_id + and ao.context_id = :package_id + order by grade_plural_name desc) eg + where cr.revision_id = et.revision_id + and et.grade_item_id = eg.grade_item_id + and cri.live_revision = et.task_id + and et.mime_type = crmt.mime_type + order by eg.grade_plural_name desc + + + + + + select object_id as room_id, + (select pretty_name from chat_rooms where room_id = ao.object_id) name + from acs_objects ao + where context_id = :package_id + + + + Index: openacs-4/packages/planner/www/indent-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/indent-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/indent-oracle.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,18 @@ + + + + oracle8.1.6 + + + + select * + from (select indent + from blocks_objects + where block_id = :block_id + and object_index < (select object_index from blocks_objects where block_object_id = :block_object_id) + order by object_index desc) + where rownum <= 1 + + + + Index: openacs-4/packages/planner/www/indent-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/indent-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/indent-postgresql.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,16 @@ + + + + + + + select indent + from blocks_objects + where block_id = :block_id + and object_index < (select object_index from blocks_objects where block_object_id = :block_object_id) + order by object_index desc + limit 1 + + + + Index: openacs-4/packages/planner/www/indent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/indent.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/indent.tcl 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,31 @@ +ad_page_contract { + Indent an object inside a block in the community + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_object_id 0} + {indent 0} + {return_url ""} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set block_id [planner::get_block_id -block_object_id $block_object_id] +if { $indent != 0 && $block_object_id != 0 } { + set spaces [db_string get_object_indent { *SQL* } -default 0] + set spaces [expr $spaces + $indent] + set parent_spaces [db_string get_parent_indent {} -default 0] + if { [expr $parent_spaces + 5] >= $spaces || $indent < 0} { + if { $spaces >= 0 } { + db_transaction { + db_dml update_object_indent { *SQL* } + } + } + } +} + +ad_returnredirect "$return_url#block_$block_id" \ No newline at end of file Index: openacs-4/packages/planner/www/indent.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/indent.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/indent.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,21 @@ + + + + + + + select indent + from blocks_objects + where block_object_id = :block_object_id + + + + + + update blocks_objects + set indent = :spaces + where block_object_id = :block_object_id + + + + Index: openacs-4/packages/planner/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/index-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/index-oracle.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,64 @@ + + + + oracle8.1.6 + + + + select ba.*, + (case object_type when 'content_item' + then (select content_type from cr_items where item_id = object_id) + else object_type end) object_type + from ( + select bb.*, bo.object_index, bo.object_id, bo.display_p as object_display, bo.indent, bo.label, bo.resource_type, bo.block_object_id, + (select object_type from acs_objects where object_id = bo.object_id) object_type + from ( + select bb.block_id, bb.block_index, bb.summary, + bb.block_name, bb.display_p as block_display, + (select count(*) from blocks_objects where block_id = bb.block_id) count + from blocks_blocks bb + where bb.community_id = :community_id + and bb.block_index <= ( + select number_of_blocks from blocks_course_mode where community_id = :community_id ) + order by block_index + ) bb + left join blocks_objects bo + on bb.block_id = bo.block_id + order by bb.block_index, bo.object_index) ba + + + + + + select ba.*, + (case object_type when 'content_item' + then (select content_type from cr_items where item_id = object_id) + else object_type end) object_type + from ( + select bb.*, bo.object_index, bo.object_id, bo.display_p as object_display, bo.indent, bo.label, bo.resource_type, bo.block_object_id, + (select object_type from acs_objects where object_id = bo.object_id) object_type + from ( + select bb.block_id, bb.block_index, bb.summary, + (select count(*) from blocks_objects where block_id = bb.block_id) count, + bb.block_name, bb.display_p as block_display + from blocks_blocks bb + where bb.community_id = :community_id + and bb.block_index <= ( + select number_of_blocks from blocks_course_mode where community_id = :community_id ) + order by block_index + ) bb + left join blocks_objects bo + on bb.block_id = bo.block_id + order by bb.block_index, bo.object_index) ba + + + + + + select to_char(start_date, 'YYYY-MM-DD') + from blocks_course_mode + where community_id = :community_id + + + + Index: openacs-4/packages/planner/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/index-postgresql.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,79 @@ + + + + + + + select ba.*, + (case when object_type='content_item' + then (select content_type from cr_items where item_id = object_id) + else object_type end) as object_type + from ( + select bb.*, bo.object_index, bo.object_id, bo.display_p as object_display, bo.indent, bo.label, bo.resource_type, bo.block_object_id, + (select object_type from acs_objects where object_id = bo.object_id) as object_type + from ( + select bb.block_id, bb.block_index, bb.summary, + bb.block_name, bb.display_p as block_display, + (select count(*) from blocks_objects where block_id = bb.block_id) as count + from blocks_blocks bb + where bb.community_id = :community_id + and bb.block_index <= ( + select number_of_blocks from blocks_course_mode where community_id = :community_id ) + order by block_index + ) bb + left join blocks_objects bo + on bb.block_id = bo.block_id + order by bb.block_index, bo.object_index) ba + + + + + + select ba.*, + (case when object_type='content_item' + then (select content_type from cr_items where item_id = object_id) + else object_type end) as object_type + from ( + select bb.*, bo.object_index, bo.object_id, bo.display_p as object_display, bo.indent, bo.label, bo.resource_type, bo.block_object_id, + (select object_type from acs_objects where object_id = bo.object_id) as object_type + from ( + select bb.block_id, bb.block_index, bb.summary, + (select count(*) from blocks_objects where block_id = bb.block_id) as count, + bb.block_name, bb.display_p as block_display + from blocks_blocks bb + where bb.community_id = :community_id + and bb.block_index <= ( + select number_of_blocks from blocks_course_mode where community_id = :community_id ) + order by block_index + ) bb + left join blocks_objects bo + on bb.block_id = bo.block_id + order by bb.block_index, bo.object_index) ba + + + + + + select to_char(start_date, 'YYYY-MM-DD') + from blocks_course_mode + where community_id = :community_id + + + + + + select distinct (case when object_type='content_item' + then (select content_type + from cr_items + where item_id = ba.object_id) + else ba.object_type end) as object_type + from ( select distinct bo.object_id, + (select object_type + from acs_objects + where object_id = bo.object_id) as object_type + from blocks_objects bo + $blocks_clause ) ba + + + + Index: openacs-4/packages/planner/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/index.adp 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,211 @@ + + @title;noquote@ + 1 + @edit_mode@ + + + + +
      + +
      + #planner.blocks_course_settings# +   #planner.blocks_edit_mode# + #planner.blocks_ON# / #planner.blocks_OFF# #planner.blocks_ON# / #planner.blocks_OFF# +
      +
      + + +
      #planner.blocks_info_message#
      +
      +
      +
        + + +
      • +
        +
        +
        +

        + + @get_blocks.block_index@ + @get_blocks.block_label;noquote@ + (#planner.blocks_not_available#) + +

        +
        +
        + +
        +
        +
        + + + + + + + +
        + + + + + + @get_blocks.summary;noquote@ + + + +

        + +
        + + + + + + + +
        +
        + +
        +
        + +
        +
        + + + +
        +
        +
        + + #planner.blocks_add_existing_activity#... +
        + + +
        +
        +
        +
        +
        +
      • + +
        + + + +
      +
      + + + + + + + + + + + + + \ No newline at end of file Index: openacs-4/packages/planner/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/index.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,105 @@ +ad_page_contract { + Displays a community in blocks view + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {move_id "-1"} + {edit_p "-1"} +} +# Get basic information +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +set community_url [dotlrn_community::get_community_url $community_id] +set admin_p [dotlrn::user_can_admin_community_p \ + -user_id $user_id \ + -community_id $community_id +] + +if {[planner::enabled_p -community_id $community_id] != "t"} { +# ad_returnredirect "./" +} + +set title [dotlrn_community::get_community_name $community_id] + +if { $admin_p } { + if { $edit_p != "-1" } { + ad_set_cookie blocks_edit_mode $edit_p + } else { + set edit_p [ad_get_cookie blocks_edit_mode 0] + } + set edit_mode 1 +} else { + set edit_mode 0 + set edit_p 0 +} + +set return_url [ad_conn url] +set package_id [dotlrn_community::get_package_id $community_id] +if { $admin_p } { + #check if chat is mounted, if not mount it + if {[site_node::exists_p -url "${community_url}chat"]} { + set chat_p 1 + } else { + set chat_p 0 + } + if {[site_node::exists_p -url "${community_url}learning-content"]} { + set learning_content_p 1 + } else { + set learning_content_p 0 + } + ah::requires -sources "scriptaculous" + set ev_package_id [dotlrn_community::get_package_id_from_package_key -package_key evaluation -community_id $community_id] + db_multirow get_grades get_grades_info { *SQL* } { } + set fs_package_id [dotlrn_community::get_package_id_from_package_key -package_key file-storage -community_id $community_id] + set fs_url [export_vars -base [apm_package_url_from_id $fs_package_id] {return_url}] + set forums_package_id [dotlrn_community::get_package_id_from_package_key -package_key forums -community_id $community_id] + set forums_url [apm_package_url_from_id $forums_package_id] + if { $learning_content_p } { + set content_package_url [lindex [site_node::get_children -package_key "xowiki" -filters {name "content"} -node_id [site_node::get_node_id_from_object_id -object_id $package_id]] 0] + array set site_node [site_node::get_from_url -url $content_package_url] + set content_package_id $site_node(package_id) + } +# set xowiki_package_url [lindex [site_node::get_children -package_key "xowiki" -filters {name "pages"} -node_id [site_node::get_node_id_from_object_id -object_id $package_id]] 0] + set xowiki_package_url "${community_url}pages/" + set fs_folder_id [fs::get_root_folder -package_id $fs_package_id] + set fs_file_return_url [export_vars -base "${fs_url}file-add" {{folder_id $fs_folder_id} {block_id ""}}] + set fs_file_url [export_vars -base "${fs_url}file-upload-confirm" {{cancel_url $return_url} {folder_id $fs_folder_id} {return_url $fs_file_return_url}}] + set fs_link_url [export_vars -base "${fs_url}simple-add" {{folder_id $fs_folder_id}}] + set fs_folder_url [export_vars -base "${fs_url}folder-create" {{parent_id $fs_folder_id}}] + set chat_package_id [dotlrn_community::get_package_id_from_package_key -package_key chat -community_id $community_id] + set chat_url [apm_package_url_from_id $chat_package_id] +} +set display_mode [planner::get_mode -community_id $community_id] +# Possible modes are -weeks- or -topics- +if { [string equal $display_mode "weeks"] } { + set dates 1 +} else { + set dates 0 +} +set last_block_id 0 +set cont 0 +set container_id 0 +set block_count 0 + +if { $admin_p } { + set blocks_info [planner::get_blocks_admin_info_not_cached -community_id $community_id] + template::util::list_to_multirow get_blocks [lindex $blocks_info 0] + set blocks_list [lindex $blocks_info 1] + set blocks_index_list [lindex $blocks_info 2] + set objects_list [lindex $blocks_info 3] + set first_block_objects [lindex $blocks_info 4] + + # blocks list, blocks indexes list and objects list for Drag 'n' Drop + set all_blocks [join $blocks_list ","] + set all_blocks_index [join $blocks_index_list ","] + set all_objects [join $objects_list ","] + + if { $learning_content_p } { + set all_categories [planner::get_content_categories -content_package_id $content_package_id] + template::util::list_to_multirow content_categories $all_categories + } +} else { + set blocks_info [planner::get_blocks_info_not_cached -community_id $community_id] + template::util::list_to_multirow get_blocks $blocks_info +} \ No newline at end of file Index: openacs-4/packages/planner/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/index.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/index.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,108 @@ + + + + + + + select eg.grade_plural_name as grade_name, eg.grade_id + from evaluation_grades eg, acs_objects ao, cr_items cri + where cri.live_revision = eg.grade_id + and eg.grade_item_id = ao.object_id + and ao.context_id = :ev_package_id + order by grade_plural_name desc + + + + + + select c.category_id as category_id from categories c, category_translations ct + where parent_id is null + and tree_id = :tree_id + and c.category_id = ct.category_id + and locale = :locale + order by name + + + + + + select o.*, ao.title as name + from (select distinct object_id + from blocks_objects + where $blocks_clause) o, + acs_objects ao + where o.object_id = ao.object_id + and ao.object_type = :object_type + + + + + + select o.*, cr.title as name + from (select distinct object_id + from blocks_objects + where $blocks_clause) o, + cr_revisions cr + where item_id = o.object_id + and (select content_type + from cr_items + where item_id = o.object_id) = :object_type + and revision_id = (select coalesce(live_revision, latest_revision) + from cr_items where item_id = o.object_id) + + + + + + select o.*, ev.task_name as name + from (select distinct object_id + from blocks_objects + where $blocks_clause) o, + evaluation_tasksi ev + where task_item_id = o.object_id + and (select content_type + from cr_items + where item_id = o.object_id) = :object_type + and revision_id = (select coalesce(live_revision, latest_revision) + from cr_items where item_id = o.object_id) + + + + + + select o.*, cr.pretty_name as name + from (select distinct object_id + from blocks_objects + where $blocks_clause) o, + chat_rooms cr + where o.object_id = cr.room_id + and (select object_type + from acs_objects + where object_id = o.object_id) = :object_type + + + + + + select o.*, cre.label as name + from (select distinct object_id + from blocks_objects + where $blocks_clause) o, + cr_extlinks cre + where o.object_id = cre.extlink_id + + + + + + select block_id + from blocks_blocks + where community_id = :community_id + and block_index <= ( + select number_of_blocks + from blocks_course_mode + where community_id = :community_id ) + + + + Index: openacs-4/packages/planner/www/label.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/label.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/label.adp 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,8 @@ + + @title;noquote@ + @context;noquote@ + + + + + Index: openacs-4/packages/planner/www/label.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/label.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/label.tcl 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,45 @@ +ad_page_contract { + Add/Edit a label object to a block in the community + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_id 0} + {block_object_id 0} + {return_url "#block_$block_id"} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +if { $block_object_id == 0 } { + set title "[_ planner.blocks_add_label]" + set context [list "$title"] +} else { + set title "[_ planner.blocks_edit_label]" + set context [list "$title"] +} + +set label_object [planner::get_label -block_object_id $block_object_id] + +ad_form -name blocks_label \ + -export { block_id block_object_id } \ + -form { + {label_object:richtext(richtext),optional {label "[_ planner.blocks_label]"} {options {editor xinha width 500px height 250px}} {value "$label_object"} + {html {id "label_object" rows 10 cols 60}}} + } -on_submit { + if { $block_object_id != 0 } { + db_dml update_block_object { *SQL* } + } else { + set object_index [planner::get_next_object_index -block_id $block_id] + planner::insert_object_to_block -block_id $block_id -object_id 0 -object_index $object_index -label_text $label_object -resource_type "label" + } + ad_returnredirect "$return_url" + } -validate { + {label_object + { ![empty_string_p $label_object] } + "[_ planner.blocks_label_empty]" + } + } \ No newline at end of file Index: openacs-4/packages/planner/www/label.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/label.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/label.xql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + update blocks_objects + set label = :label_object + where block_object_id = :block_object_id + + + + Index: openacs-4/packages/planner/www/move-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/move-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/move-oracle.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,32 @@ + + + + oracle8.1.6 + + + + select block_id + from ( + select block_id, block_index + from blocks_blocks + where community_id = :community_id + order by block_index) b + where block_index > :block_index + and rownum <=1 + + + + + + select block_id + from ( + select block_id, block_index + from blocks_blocks + where community_id = :community_id + order by block_index desc) b + where block_index < :block_index + and rownum <=1 + + + + Index: openacs-4/packages/planner/www/move-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/move-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/move-postgresql.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,31 @@ + + + + + + + select block_id + from ( + select block_id, block_index + from blocks_blocks + where community_id = :community_id + order by block_index) b + where block_index > :block_index + limit 1 + + + + + + select block_id + from ( + select block_id, block_index + from blocks_blocks + where community_id = :community_id + order by block_index desc) b + where block_index < :block_index + limit 1 + + + + Index: openacs-4/packages/planner/www/move.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/move.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/move.adp 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1 @@ +no data \ No newline at end of file Index: openacs-4/packages/planner/www/move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/move.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/move.tcl 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,62 @@ +ad_page_contract { + Move a block in the community, the tmp_block_id is the block_id + of the next block in the list but when we are moving the block + to the last position we set last_p 1 and the tmp_block_id is the + block_id of the previous block in the list + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_id 0} + {tmp_block_id 0} + {last_p 0} + {return_url ""} + {swap_p 1} + {move_to ""} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set block_index [planner::get_block_index -block_id $block_id] +if {![empty_string_p $move_to]} { + if {[string equal $move_to "up"]} { + set tmp_block_id [db_string get_prev_block_id { *SQL* } -default 0] + } elseif {[string equal $move_to "down"]} { + set tmp_block_id [db_string get_next_block_id { *SQL* } -default 0] + } +} + +if { $tmp_block_id != 0 && $block_id != 0 } { + set tmp_block_index [planner::get_block_index -block_id $tmp_block_id] + if {$swap_p} { + # Move a block to an adjacent position + db_transaction { + planner::update_block_index -block_id $block_id -block_index $tmp_block_index + planner::update_block_index -block_id $tmp_block_id -block_index $block_index + } + } else { + # Move a block to another position + db_transaction { + if { $last_p == 0 } { + if { $tmp_block_index > $block_index } { + db_dml move_block_down { *SQL* } + set tmp_block_index [expr $tmp_block_index - 1] + } elseif { $tmp_block_index < $block_index } { + db_dml move_block_up { *SQL* } + } + } else { + if { $tmp_block_index != 0 } { + db_dml move_block_last { *SQL* } + } + } + planner::update_block_index -block_id $block_id -block_index $tmp_block_index + } + } +} + +if {![empty_string_p $return_url]} { + ad_returnredirect $return_url +} \ No newline at end of file Index: openacs-4/packages/planner/www/move.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/move.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/move.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,35 @@ + + + + + + + update blocks_blocks + set block_index = block_index - 1 + where community_id = :community_id + and block_index > :block_index + and block_index < :tmp_block_index + + + + + + update blocks_blocks + set block_index = block_index + 1 + where community_id = :community_id + and block_index >= :tmp_block_index + and block_index < :block_index + + + + + + update blocks_blocks + set block_index = block_index - 1 + where community_id = :community_id + and block_index > :block_index + and block_index <= :tmp_block_index + + + + Index: openacs-4/packages/planner/www/object-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/object-add.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/object-add.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,29 @@ +ad_page_contract { + Add an object to a block in the community + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_id 0} + {object_id:multiple,integer} + {return_url ""} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +if { $block_id == 0 } { + set block_id [ad_get_cookie fs_block_id "$block_id"] +} + +foreach object $object_id { + set object_index [planner::get_next_object_index -block_id $block_id] + planner::insert_object_to_block -block_id $block_id -object_id $object -object_index $object_index +} +ad_set_cookie fs_block_id 0 +ad_set_cookie fs_web2 0 +ad_set_cookie fs_community_id 0 + +ad_returnredirect "$return_url#block_$block_id" \ No newline at end of file Index: openacs-4/packages/planner/www/object-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/object-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/object-delete.tcl 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,43 @@ +ad_page_contract { + Redirect to the delete action of an object + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_object_id 0} + {return_url ""} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +set community_url [dotlrn_community::get_community_url $community_id] +# Permissions +dotlrn::require_user_admin_community \ + -user_id $user_id -community_id $community_id + +set block_id [planner::get_block_id -block_object_id $block_object_id] +set object_id [planner::get_object_id -block_object_id $block_object_id] +set object_type [acs_object_type $object_id] +set revision_id $object_id + +if {[string eq $object_type content_item]} { + set object_type [content::item::get_content_type -item_id $object_id] + if {![string eq $object_type content_extlink]} { + set revision_id [content::item::get_best_revision -item_id $object_id] + } +} + +db_dml delete_block_object { *SQL* } + +## This next code is for delete the object from the DB +## Now the object is removed from the block but not from the DB +#if { [db_string check_object {} -default 0] == 0 } { +# set page_url [lindex [callback -catch \ +# -impl $object_type planner::delete_url -object_id $revision_id] 0] +# if {![empty_string_p $page_url]} { +# ad_returnredirect [export_vars \ +# -base $page_url {{return_url $community_url}}] +# } +#} + +ad_returnredirect "$return_url\#block_$block_id" \ No newline at end of file Index: openacs-4/packages/planner/www/object-delete.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/object-delete.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/object-delete.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,20 @@ + + + + + + + delete from blocks_objects + where block_object_id = :block_object_id + + + + + + select count(*) + from blocks_objects + where object_id = :object_id + + + + Index: openacs-4/packages/planner/www/object-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/object-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/object-edit.tcl 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,46 @@ +ad_page_contract { + Redirect to the edit action of an object + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_object_id 0} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +set community_url [dotlrn_community::get_community_url $community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set object_id [planner::get_object_id -block_object_id $block_object_id] +set object_label [planner::get_label -block_object_id $block_object_id] +if { $object_id == 0 } { + # It's a label object + if {![empty_string_p $object_label]} { + ad_returnredirect "label?block_object_id=$block_object_id" + } else { + ad_returnredirect "" + } +} + +set object_type [acs_object_type $object_id] + +if {[string eq $object_type content_item]} { + set object_type [content::item::get_content_type -item_id $object_id] + if {![string eq $object_type content_extlink]} { + set object_id [content::item::get_best_revision -item_id $object_id] + } +} + +if {[string eq $object_type apm_package]} { + ad_returnredirect "[apm_package_url_from_id $object_id]admin/content-admin" +} + +set page_url [lindex [callback -catch -impl $object_type planner::edit_url -object_id $object_id] 0] + +if {![empty_string_p $page_url]} { + ad_returnredirect [export_vars -base $page_url {{return_url $community_url}}] +} else { + ad_returnredirect "" +} Index: openacs-4/packages/planner/www/object-update.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/object-update.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/object-update.adp 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,30 @@ + + + + + + @object_name;noquote@ + + + @object_name;noquote@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: openacs-4/packages/planner/www/object-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/object-update.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/object-update.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,31 @@ +ad_page_contract { + Update the object when moved to another block + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_object_id 0} + {block_id 0} +} + +set object_info_p [db_0or1row get_object_info { *SQL* }] +if {$object_info_p} { + set block_display [db_string get_block_display {} -default "t"] + + if { ![empty_string_p $indent] } { + set indent [expr {$indent * 20}] + } else { + set indent 0 + } + if {$object_id != 0} { + set object_type [acs_object_type $object_id] + if { [string equal $object_type "content_item"] } { + set object_type [content::item::content_type -item_id $object_id] + } + set image_specs "width=16 height=16" + set object_image [planner::get_object_icon -object_type $object_type] + set object_name [planner::get_object_name -object_id $object_id -object_type $object_type] + } else { + set object_name [lindex $label 0] + } +} \ No newline at end of file Index: openacs-4/packages/planner/www/object-update.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/object-update.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/object-update.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,21 @@ + + + + + + + select object_id, display_p as object_display, indent, label + from blocks_objects + where block_object_id = :block_object_id + + + + + + select display_p + from blocks_blocks + where block_id = :block_id + + + + Index: openacs-4/packages/planner/www/objects-move.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/objects-move.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/objects-move.adp 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1 @@ +no data \ No newline at end of file Index: openacs-4/packages/planner/www/objects-move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/objects-move.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/objects-move.tcl 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,56 @@ +ad_page_contract { + Move an object inside a block in the community + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {to_block_id 0} + {block_object_id 0} + {tmp_block_object_id 0} + {tmp_object_index 0} + {return_url ""} + {to_block 0} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +#get the next available index for the block +# If object is moved to the last position, to_block = 1 +# If that block has no objects => to prevent possible errors between info in DOM and DB on simultaneous editing +# If tmp_block_index is not the correct one in the DB => to prevent possible errors between info in DOM and DB on simultaneous editing +if { $to_block == 1 || [planner::count_block_objects -block_id $to_block_id] == 0 || [planner::get_block_id -block_object_id $tmp_block_object_id] != $to_block_id } { + set to_block 1 + set tmp_object_index [planner::get_next_object_index -block_id $to_block_id] +} else { + set tmp_object_index [planner::get_object_index -block_object_id $tmp_block_object_id] +} +# param: to_block => if the destination is the last position of a block = 1 otherwise = 0 +if { $to_block_id != 0 && $block_object_id != 0 } { + if { [db_0or1row get_object_info { *SQL* }] } { + db_transaction { + if { $block_id == $to_block_id } { + # Move the object inside the same block + if { $tmp_object_index > $object_index } { + db_dml move_object_down { *SQL* } + set tmp_object_index [expr $tmp_object_index - 1] + } elseif { $tmp_object_index < $object_index } { + db_dml move_object_up { *SQL* } + } + } else { + # Move the object to another block + if { $to_block == 0 } { + db_dml update_objects_in_target_block { *SQL* } + } + db_dml update_objects_in_source_block { *SQL* } + } + db_dml update_object_info { *SQL* } + } + } +} + +if {![empty_string_p $return_url]} { + ad_returnredirect $return_url +} \ No newline at end of file Index: openacs-4/packages/planner/www/objects-move.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/objects-move.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/objects-move.xql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,59 @@ + + + + + + + update blocks_objects + set object_index = object_index - 1 + where block_id = :to_block_id + and object_index > :object_index + and object_index < :tmp_object_index + + + + + + update blocks_objects + set object_index = object_index + 1 + where block_id = :to_block_id + and object_index >= :tmp_object_index + and object_index < :object_index + + + + + + update blocks_objects + set object_index = object_index + 1 + where block_id = :to_block_id + and object_index >= :tmp_object_index + + + + + + update blocks_objects + set object_index = object_index - 1 + where block_id = :block_id + and object_index > :object_index + + + + + + update blocks_objects + set object_index = :tmp_object_index, block_id = :to_block_id + where block_object_id = :block_object_id + + + + + + select object_index, block_id + from blocks_objects + where block_object_id = :block_object_id + + + + Index: openacs-4/packages/planner/www/objects-show-hide.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/objects-show-hide.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/objects-show-hide.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,25 @@ +ad_page_contract { + Show/Hide a block in the community + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_object_id 0} + {display_p "t"} + {return_url ""} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set block_id [planner::get_block_id -block_object_id $block_object_id] + +if { $block_object_id != 0 } { + db_transaction { + db_dml object_show_hide { *SQL* } + } +} + +ad_returnredirect "$return_url\#block_$block_id" \ No newline at end of file Index: openacs-4/packages/planner/www/objects-show-hide.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/objects-show-hide.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/objects-show-hide.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + update blocks_objects + set display_p = :display_p + where block_object_id = :block_object_id + + + + Index: openacs-4/packages/planner/www/order-update.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/order-update.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/order-update.adp 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1 @@ +@block_ids@;@block_names@;@block_indexes@;@current_id@ \ No newline at end of file Index: openacs-4/packages/planner/www/order-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/order-update.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/order-update.tcl 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,52 @@ +ad_page_contract { + Return blocks order in the community + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_index1 0} + {block_index2 0} + {dates_p 0} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +if { $block_index1 > $block_index2 } { + set first_block_index $block_index2 + set second_block_index $block_index1 +} else { + set first_block_index $block_index1 + set second_block_index $block_index2 +} +set block_id_list [db_list get_ids { *SQL* }] +set block_ids [join $block_id_list ","] +set block_index_list [db_list get_indexes { *SQL* }] +set block_indexes [join $block_index_list ","] +set current_id 0 + +if { $dates_p == 1 } { + set current_time [clock seconds] + set start_time [planner::get_start_date -community_id $community_id] + if { $start_time != 0 } { + set start_time [clock scan $start_time] + } else { + set start_time $current_time + } + set block_date_list [list] + foreach index $block_index_list bid $block_id_list { + set offset [expr 7 * [expr $index - 1]] + set start_clock [clock scan "$offset days" -base $start_time] + set end_clock [clock scan "6 day" -base $start_clock] + set dates [planner::get_block_dates -start_clock $start_clock] + if { $current_time > $start_clock && $current_time < [clock scan "1 day" -base $end_clock] } { + set current_id $bid + } + lappend block_date_list $dates + } + set block_names [join $block_date_list ","] +} else { + set block_names $block_indexes +} \ No newline at end of file Index: openacs-4/packages/planner/www/order-update.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/order-update.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/order-update.xql 10 Jul 2009 17:03:38 -0000 1.1 @@ -0,0 +1,27 @@ + + + + + + + select block_id + from blocks_blocks + where block_index >= :first_block_index + and block_index <= :second_block_index + and community_id = :community_id + order by block_index + + + + + + select block_index + from blocks_blocks + where block_index >= :first_block_index + and block_index <= :second_block_index + and community_id = :community_id + order by block_index + + + + Index: openacs-4/packages/planner/www/select-activity.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/select-activity.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/select-activity.adp 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,101 @@ + + @page_title;noquote@ + @context;noquote@ + + + +
      + + + + + + +
      +
      +
      + 1. #planner.blocks_select_type_of_activity# +
      + +
      +
      #planner.Cancel#
      +
      + + + +
      +
      Index: openacs-4/packages/planner/www/select-activity.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/select-activity.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/select-activity.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,42 @@ +# +ad_page_contract { + Interface for creating a new activity for content + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Apr 2008 + } { + block_id + {return_url "./"} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set page_title [_ planner.blocks_select_activity] +set context [list "$page_title"] + +set package_id [ad_conn package_id] +set parent_id [site_node::get_node_id_from_object_id -object_id $package_id] + +#check if chat is mounted, if not mount it +set community_url [dotlrn_community::get_community_url $community_id] +if {[site_node::exists_p -url "${community_url}chat"]} { + set chat_p 1 +} else { + set chat_p 0 +} + +ad_form -name activities \ + -has_submit { 1 } \ + -export { block_id return_url } \ + -form { + {activity_id:text(text),optional {label ""} {html {id "activity_id" value 0 style "display: none;"}}} + {ok_submit:text(submit) {label "[_ planner.ok]"}} + } -on_submit { + set object_index [planner::get_next_object_index -block_id $block_id] + planner::insert_object_to_block -block_id $block_id -object_id $activity_id -object_index $object_index + ad_returnredirect "$return_url#block_$block_id" + } + +ah::requires -sources "scriptaculous" \ No newline at end of file Index: openacs-4/packages/planner/www/show-hide.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/show-hide.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/show-hide.tcl 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,25 @@ +ad_page_contract { + Show/Hide a block in the community + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_id 0} + {display_p "t"} + {return_url "#block_$block_id"} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id +set block_index [planner::get_block_index -block_id $block_id] +if { $block_id != 0 && $block_index != 0 } { + + db_transaction { + db_dml blocks_show_hide { *SQL* } + } + +} + +ad_returnredirect $return_url \ No newline at end of file Index: openacs-4/packages/planner/www/show-hide.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/show-hide.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/show-hide.xql 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + update blocks_blocks + set display_p = :display_p + where block_id = :block_id + + + + Index: openacs-4/packages/planner/www/summary.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/summary.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/summary.adp 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,8 @@ + + @title;noquote@ + @context;noquote@ + + + + + Index: openacs-4/packages/planner/www/summary.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/summary.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/summary.tcl 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,33 @@ +ad_page_contract { + Edit Blocks Summary + + @author Alvaro Rodriguez (alvaro@viaro.net) + @creation-date Jul-2008 +} { + {block_id 0} + {return_url ""} +} + +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +# Permissions +dotlrn::require_user_admin_community -user_id $user_id -community_id $community_id + +set title "[_ planner.blocks_edit_block_summary]" +set context [list "$title"] +set summary [db_string get_block_summary {} -default ""] + +ad_form -name blocks_summary \ + -export { block_id } \ + -form { + {summary:richtext(richtext),optional {label "[_ planner.blocks_summary]"} {options {editor xinha}} {value "$summary"} + {html {id "summary" rows 20 cols 80}}} + } -validate { + {summary + {[string bytelength $summary] <= 4000} + { [_ planner.blocks_summary_must_be] } + } + } -on_submit { + db_dml update_block_summary { *SQL* } + ad_returnredirect "$return_url#block_$block_id" + } Index: openacs-4/packages/planner/www/summary.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/summary.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/summary.xql 10 Jul 2009 17:03:39 -0000 1.1 @@ -0,0 +1,21 @@ + + + + + + + select summary + from blocks_blocks + where block_id = :block_id + + + + + + update blocks_blocks + set summary = :summary + where block_id = :block_id + + + + Index: openacs-4/packages/planner/www/resources/accept.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/accept.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/apply.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/apply.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/dot.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/dot.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/down.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/down.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/eye.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/eye.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/eye_gray.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/eye_gray.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/indicator.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/indicator.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/left.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/left.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/move.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/move.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/move_arrow.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/move_arrow.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/right.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/right.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/select-activity-ie6.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/select-activity-ie6.css,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/select-activity-ie6.css 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,15 @@ +/* select-activity IE6 */ + +.bportlet_head { + height: 67px; +} +.bportlet_head_confirm { + height: 47px; +} +.bportlet_head_text { + text-align: center; + font-weight: bold; + margin-top: 10px; +} + +/* !- select-activity IE6 */ \ No newline at end of file Index: openacs-4/packages/planner/www/resources/select-activity.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/select-activity.css,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/select-activity.css 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,75 @@ +/* select-activity */ +.activities th { + text-align: left; + padding-left: 5px; + height: 30px; +} +.activities td { + height: 30px; + text-align: left; +} +.icon-spot { + width: 15%; + text-align: center; +} +.activities-icon { + width: 35px; +} + +#activities-select-table { + margin-top: 10px; + width: 90%; + min-width: 750px; +} +#activities-div { + width: 100%; + border-collapse: collapse; +} +#activities-div a { + cursor: pointer; +} +#show_activities a { + cursor: pointer; +} +.arrow-td { + width: 60px; + padding-top: 60px; +} +#activities-left { + width: 30%; +} +#activities-center { + width: 45%; +} +#activities-right { + width: 25%; +} +.margin-form .form-item-wrapper .form-label { + display:inline; + float:none; + width:0; +} +.margin-form .form-item-wrapper .form-widget, .margin-form .form-button, .margin-form div.form-help-text { + display:block; + margin-left:0; +} +.portlet-wrapper{ + border: 1px solid; +} +.portlet_head{ + border-bottom: 1px solid; +} +.margin-form fieldset { + border: 0; + margin: 0; +} + +.bportlet_head .bportlet_head_confirm { + height: 52px; +} +.bportlet_head_text { + text-align: center; + font-weight: bold; + margin-top: 20px; +} +/* !- select-activity */ \ No newline at end of file Index: openacs-4/packages/planner/www/resources/select-activity.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/select-activity.js,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/select-activity.js 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,70 @@ + +var load_img = document.createElement('img'); +// Used to save the current selection of activity id before submit +var temp = 0; +// Used to save the current selection of activity type before submit +var temp2 = ''; +load_img.id = 'indicator'; +load_img.src = '/resources/planner/indicator.gif'; + +//Called when click on activity type +function show_activities(url,tag) { + if ( temp == 0 ){ + //This is the case when editing a page or coming back from step 2, temp is empty so temp = activity_id + temp = document.getElementById('activity_id').value; + } + // container = selected option ; loading = space where we show the loading image ; ok = space where we show the ok image + var container = document.getElementById(tag); + var loading = document.getElementById(tag+'_loading'); + var ok = document.getElementById(tag+'_ok'); + if( temp2 != '') { + // If we choose an activity type, clear the last selection + document.getElementById(temp2).style.background = ''; + document.getElementById(temp2+'_ok').style.background = ''; + } + temp2 = tag; + // Get the information about the selected activity type + new Ajax.Request(url,{method: 'get', onLoading: function() { + container.style.background = '#D8E0E6'; + ok.style.background = '#D8E0E6 url(/resources/planner/apply.gif) no-repeat scroll center'; + loading.appendChild(load_img); }, + onComplete: function(){ + loading.removeChild(load_img); }, + onSuccess: function(r) { + // Display the result + document.getElementById('show_activities').innerHTML = r.responseText; + Effect.Appear('select_activity'); + //If we had selected an activity_id from the choosen activity type, show it selected, if not remove the submit + if (temp > 0){ + try{ + document.getElementById('activity_'+temp).style.background = '#D8E0E6 url(/resources/planner/apply.gif) no-repeat scroll right'; + Effect.Appear('ok_submit'); + } catch (e) { + Effect.Fade('ok_submit', {duration: 0.3}); + } + } } + }); +} + +//Called when click on activity id +function select_activity(activity_id, new_p) { + //If there was a selected activity remove the visual selection, inside a try for the case when activity selected is not in the choosed activity type + try { + document.getElementById('activity_'+temp).style.background = ''; + } catch(err) { } + if ( new_p == 1 ) { + //If there was a selection and the new selection is a new activity, clear the activity id + document.getElementById('activity_id').value = 0; + } else { + document.getElementById('activity_id').value = activity_id; + } + Effect.Pulsate('activity_'+activity_id,{ pulses: 1, duration: 0.3}); + //Save the current selection id + temp = activity_id; + var tag = document.getElementById('activity_'+temp); + //Apply the visual selection + tag.style.background = '#D8E0E6 url(/resources/planner/apply.gif) no-repeat scroll right'; + var tag2 = document.getElementById('show_activities'); + Effect.Appear('ok_submit'); +} + Index: openacs-4/packages/planner/www/resources/up.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/up.gif,v diff -u -N Binary files differ Index: openacs-4/packages/planner/www/resources/view-ie.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/view-ie.css,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/view-ie.css 10 Jul 2009 17:03:40 -0000 1.1 @@ -0,0 +1,25 @@ + +.bcontslide { + margin-top: -8px; + background-color:#F2F2F2; +} +.bfoot_L { + margin-top: -2px; +} +.bfoot_R { + margin-top: -2px; +} +.bfoot { + +} +.portlet_head_top { + margin-bottom: 3px; + margin-top: -5px; + border: 0; + background-color: #FFFFFF; +} +.bportlet-wrapper { + background-color: #FFFFFF; + margin: 0 3% 0 -1.5%; +} + Index: openacs-4/packages/planner/www/resources/view-ie6.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/view-ie6.css,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/view-ie6.css 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,19 @@ + +.portlet_head_top { + margin-bottom: -20px; + background-color: none; +} +#blocklist .portlet_head_top { + border: 0; +} +.bcontslide { + margin-top: -8px; + background-color:#F2F2F2; +} +.bfoot .bfoot_L, .bfoot .bfoot_R { + margin-top: 0; +} +.bportlet-wrapper { + background-color: #FFFFFF; + margin: 0 3% 0 -1.5%; +} Index: openacs-4/packages/planner/www/resources/view.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/view.css,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/view.css 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,107 @@ +#edit-mode a { color: #CCC; } +#edit-mode a:link { color: #CCC; } +#edit-mode a:hover { color: #FFF; } +.object-hidden { color: gray; } +.object-hidden a:link { color: gray; } +.object-hidden a:hover { color: gray; } +.object-hidden a:visited { color: gray; } +.block-border { text-align: center; width: 20px; } +.current-block { background-color: #4D99E6; } +.hidden-block { background-color: #DDDDDD; } + +#blocks { + margin: 0 2.5%; +} + +#blocklist { + padding-left: 0; + margin-top: 0; +} + +#blocklist0 { + padding-left: 0; + margin-bottom: 0; +} + +.text-right { + text-align: right; +} +.text-left { + text-align: left; +} +.text-center { + text-align: center; +} +.simple-list { + list-style-image:none; + list-style-position:outside; + list-style-type:none; +} + +.portlet ul { + list-style-image:none; + list-style-position:outside; + list-style-type:none; +} + +.minh15 { + min-height: 15px; +} +.minh25 { + min-height: 25px; +} +.table { + width: 100%; +} +.blocks-move { + cursor: move; +} +a { + cursor: pointer; +} +.selected_a { + color: #E82C0C; +} + +/* PORTLETS -----------------------------------------------------------*/ +/* contains: all general portlet styles like title, frame, font etc. */ +/* Note: additional styles for specific packages (ie. calendar, survey) +are located in the css for that package (eg. Selva_calendar.css) */ + +.portlet { + padding: 0; +} +/*EDIT*/ + +.title { + height:52px; + background-image:url(/resources/theme-tupi/images/added/U.gif); + background-position:top; + background-repeat:repeat-x; + background-color:#f2f2f2; +} + +.collapse { + border:0px; + text-decoration:none; + float:left; + margin-left:5px; + text-align:right; + width:30%; + +} + +.noheight { + height:1px; + width: 80%; + border: 1px solid red; +} + +.resalte { + font-weight:bold; + color:#515151; +} + +/*END EDIT*/ + +/* END OF PORTLETS*/ Index: openacs-4/packages/planner/www/resources/view.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/view.js,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/view.js 10 Jul 2009 17:03:41 -0000 1.1 @@ -0,0 +1,550 @@ +var Dom = YAHOO.util.Dom; +var Event = YAHOO.util.Event; +var DDM = YAHOO.util.DragDropMgr; +// Information about the start drag point: parentNode, position, index in parentNode +var blocks_index_map = new Array(); +var startParentEl, startPos, startIndex, startLast; +var load_img = document.createElement('img'); +load_img.id = 'indicator'; +load_img.src = '/resources/planner/indicator.gif'; + +function getElementsByClassName(classname, node) { + if(!node) node = document.getElementsByTagName("body")[0]; + var a = []; + var re = new RegExp('\\b' + classname + '\\b'); + var els = node.getElementsByTagName("*"); + for(var i=0,j=els.length; i 1) { + for (i=0;i 1) { + for (i=0;i 0) { + parent.insertBefore(src,dest); + return 1; + } else { + return 0; + } + } else { + parent.appendChild(src); + } +} + +YAHOO.example.DDApp = { + init: function() { + var blocks = blocks_list.split(','); + var blocks_index = blocks_index_list.split(','); + var objects = objects_list.split(','); + for ( var i = 0; i < blocks.length ; i++ ){ + blocks_index_map[blocks[i]] = blocks_index[i]; + } + for ( var i = 0; i < blocks.length ; i++ ){ + new YAHOO.util.DDTarget("blocklist_"+blocks[i],"objects_list"); + } + new YAHOO.util.DDTarget("blocklist","blocks_list"); + for ( var i = 1; i < blocks.length ; i++ ){ + var bl_tmp = new YAHOO.example.DDBlockList("blockli_"+blocks[i],"blocks_list", {cont: 'blocks'}); + bl_tmp.setHandleElId("move_block_"+blocks[i]); + bl_tmp.setHandleElId("move_block2_"+blocks[i]); + } + for ( var i = 0; i < objects.length ; i++ ){ + var bo_tmp = new YAHOO.example.DDList("blockobject_" + objects[i],"objects_list", {cont: 'blocks'} ); + bo_tmp.setHandleElId("move_object_"+objects[i]); + } + } + +}; + +YAHOO.example.DDList = function(id, sGroup, config) { + + this.cont = config.cont; + YAHOO.example.DDList.superclass.constructor.call(this, id, sGroup, config); + + this.logger = this.logger || YAHOO; + var el = this.getDragEl(); + Dom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent + + this.goingUp = false; + this.lastY = 0; +}; + +YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy, { + cont: null, + init: function() { + //Call the parent's init method + YAHOO.example.DDList.superclass.init.apply(this, arguments); + this.initConstraints(); + + Event.on(window, 'resize', function() { + this.initConstraints(); + }, this, true); + }, + initConstraints: function() { + //Get the top, right, bottom and left positions + var region = Dom.getRegion(this.cont); + + //Get the element we are working on + var el = this.getEl(); + + //Get the xy position of it + var xy = Dom.getXY(el); + + //Get the width and height + var width = parseInt(Dom.getStyle(el, 'width'), 10); + var height = parseInt(Dom.getStyle(el, 'height'), 10); + + //Set left to x minus left + var left = xy[0] - region.left; + + //Set right to right minus x minus width + var right = region.right - xy[0] - width; + + //Set top to y minus top + var top = xy[1] - region.top; + + //Set bottom to bottom minus y minus height + var bottom = region.bottom - xy[1] - height; + + //Set the constraints based on the above calculations + this.setXConstraint(left, right); + this.setYConstraint(top, bottom); + }, + + startDrag: function(x, y) { + this.logger.log(this.id + " startDrag"); + // make the proxy look like the source element + var dragEl = this.getDragEl(); + var clickEl = this.getEl(); + startParentEl = clickEl.parentNode; + Dom.setStyle(clickEl, "visibility", "hidden"); + startIndex = findNodePosition(startParentEl,clickEl.id,"block-li"); + startPos = Dom.getXY(clickEl); + startLast = isLastNode(startParentEl,clickEl.id,"block-li"); + + dragEl.innerHTML = clickEl.innerHTML; + + Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color")); + Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor")); + Dom.setStyle(dragEl, "border", "2px solid gray"); + }, + + endDrag: function(e) { + + var srcEl = this.getEl(); + var proxy = this.getDragEl(); + if (DDM.interactionInfo.validDrop) { var destPos = Dom.getXY(srcEl); } else { var destPos = startPos; } + // Show the proxy element and animate it to the src element's location + Dom.setStyle(proxy, "visibility", ""); + var a = new YAHOO.util.Motion( + proxy, { + points: { + to: destPos + } + }, + 0.2, + YAHOO.util.Easing.easeOut + ); + var proxyid = proxy.id; + var thisid = this.id; + + // Hide the proxy and show the source element when finished with the animation + a.onComplete.subscribe(function() { + Dom.setStyle(proxyid, "visibility", "hidden"); + Dom.setStyle(thisid, "visibility", ""); + }); + a.animate(); + if (DDM.interactionInfo.validDrop) { + var to_block_id = getId(srcEl.parentNode.id); + var start_block_id = getId(startParentEl.id); + var block_object_id = getId(srcEl.id); + var tmp_block_object_id = findNodePosition(srcEl.parentNode,srcEl.id,"block-li"); + var to_block = isLastNode(srcEl.parentNode,srcEl.id,"block-li"); + if ( tmp_block_object_id == 0 ) { var tmp_object_index = 1; } else { var tmp_object_index = 0; } + var url = community_url+'planner/objects-move?to_block_id='+to_block_id+'&tmp_object_index='+tmp_object_index+'&block_object_id='+block_object_id+'&to_block='+to_block+'&tmp_block_object_id='+tmp_block_object_id; + new Ajax.Request(url, {method: 'get', onLoading: function(){ srcEl.appendChild(load_img); }, + onSuccess: function (r) { + if(srcEl.getAttribute('rel') == "t" && srcEl.parentNode.getAttribute('rel') == "t"){ + srcEl.setAttribute("class","block-li"); + srcEl.setAttribute("className","block-li"); + new Ajax.Request(community_url+'planner/object-update?block_object_id='+block_object_id+'&block_id='+to_block_id,{method: 'get', + onSuccess: function(r){ srcEl.innerHTML = r.responseText }}); + } + if(srcEl.getAttribute('rel') == "t" && srcEl.parentNode.getAttribute('rel') == "f"){ + srcEl.setAttribute("class","object-hidden block-li"); + srcEl.setAttribute("className","object-hidden block-li"); + new Ajax.Request(community_url+'planner/object-update?block_object_id='+block_object_id+'&block_id='+to_block_id,{method: 'get', + onSuccess: function(r){ srcEl.innerHTML = r.responseText }}); + } + }, + onComplete: function(){ srcEl.removeChild(load_img); } }); + } else { + insertNodeByPos(startParentEl,srcEl,startIndex,startLast,"block-li"); + } + }, + + onDragDrop: function(e, id) { + + // If there is one drop interaction, the li was dropped either on the list, + // or it was dropped on the current location of the source element. + if (DDM.interactionInfo.drop.length === 1) { + + // The position of the cursor at the time of the drop (YAHOO.util.Point) + var pt = DDM.interactionInfo.point; + + // The region occupied by the source element at the time of the drop + var region = DDM.interactionInfo.sourceRegion; + + // Check to see if we are over the source element's location. We will + // append to the bottom of the list once we are sure it was a drop in + // the negative space (the area of the list without any list items) + if (!region.intersect(pt)) { + var destEl = Dom.get(id); + var destDD = DDM.getDDById(id); + destEl.appendChild(this.getEl()); + destDD.isEmpty = false; + DDM.refreshCache(); + } + + } + }, + + onDrag: function(e) { + + // Keep track of the direction of the drag for use during onDragOver + var y = Event.getPageY(e); + + if (y < this.lastY) { + this.goingUp = true; + } else if (y > this.lastY) { + this.goingUp = false; + } + + this.lastY = y; + }, + + onDragOver: function(e, id) { + + var srcEl = this.getEl(); + var destEl = Dom.get(id); + + // We are only concerned with list items, we ignore the dragover + // notifications for the list. + if (destEl.nodeName.toLowerCase() == "li") { + var orig_p = srcEl.parentNode; + var p = destEl.parentNode; + if (this.goingUp) { + nextEl = destEl; + p.insertBefore(srcEl, destEl); // insert above + } else { + nextEl = destEl.nextSibling; + p.insertBefore(srcEl, destEl.nextSibling); // insert below + } + + DDM.refreshCache(); + } + var dragEl = this.getDragEl(); + Dom.setStyle(dragEl, "border", "2px solid red"); + + }, + + onDragOut: function(e, id) { + + var dragEl = this.getDragEl(); + Dom.setStyle(dragEl, "border", "2px solid gray"); + + } +}); + +YAHOO.example.DDBlockList = function(id, sGroup, config) { + + this.cont = config.cont; + YAHOO.example.DDBlockList.superclass.constructor.call(this, id, sGroup, config); + + this.logger = this.logger || YAHOO; + var el = this.getDragEl(); + Dom.setStyle(el, "opacity", 0.1); // The proxy is slightly transparent + + this.goingUp = false; + this.lastY = 0; + +}; + +YAHOO.extend(YAHOO.example.DDBlockList, YAHOO.util.DDProxy, { + cont: null, + init: function() { + //Call the parent's init method + YAHOO.example.DDBlockList.superclass.init.apply(this, arguments); + this.initConstraints(); + + Event.on(window, 'resize', function() { + this.initConstraints(); + }, this, true); + }, + initConstraints: function() { + //Get the top, right, bottom and left positions + var region = Dom.getRegion(this.cont); + + //Get the element we are working on + var el = this.getEl(); + + //Get the xy position of it + var xy = Dom.getXY(el); + + //Get the width and height + var width = parseInt(Dom.getStyle(el, 'width'), 10); + var height = parseInt(Dom.getStyle(el, 'height'), 10); + + //Set left to x minus left + var left = xy[0] - region.left; + + //Set right to right minus x minus width + var right = region.right - xy[0] - width; + + //Set top to y minus top + var top = xy[1] - region.top; + + //Set bottom to bottom minus y minus height + var bottom = region.bottom - xy[1] - height; + + //Set the constraints based on the above calculations + this.setXConstraint(left, right); + this.setYConstraint(top, bottom); + }, + + startDrag: function(x, y) { + this.logger.log(this.id + " startDrag"); + + // make the proxy look like the source element + var dragEl = this.getDragEl(); + var clickEl = this.getEl(); + startParentEl = clickEl.parentNode; + startIndex = findNodePosition(startParentEl,clickEl.id,"blocklist-li"); + startPos = Dom.getXY(clickEl); + startLast = isLastNode(startParentEl,clickEl.id,"blocklist-li"); + + dragEl.innerHTML = ""; + + Dom.setStyle(document.getElementById('div_'+getId(clickEl.id)),"visibility","hidden"); + + Dom.setStyle(document.getElementById('block_'+getId(clickEl.id)), "border", "2px dotted blue"); + Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color")); + Dom.setStyle(dragEl, "border", "2px solid gray"); + }, + + endDrag: function(e) { + + var srcEl = this.getEl(); + var proxy = this.getDragEl(); + if (DDM.interactionInfo.validDrop) { var destPos = Dom.getXY(srcEl); } else { var destPos = startPos; } + // Show the proxy element and animate it to the src element's location + Dom.setStyle(proxy, "visibility", ""); + var a = new YAHOO.util.Motion( + proxy, { + points: { + to: destPos + } + }, + 0.2, + YAHOO.util.Easing.easeOut + ); + var proxyid = proxy.id; + var thisid = this.id; + + // Hide the proxy and show the source element when finished with the animation + a.onComplete.subscribe(function() { + Dom.setStyle(proxyid, "visibility", "hidden"); + Dom.setStyle(thisid, "border", "0"); + Dom.setStyle(document.getElementById('block_'+getId(srcEl.id)), "border", "0"); + Dom.setStyle(document.getElementById('div_'+getId(srcEl.id)),"visibility",""); + }); + a.animate(); + if (DDM.interactionInfo.validDrop) { + var block_id = getId(srcEl.id); + var tmp_block_id = findNodePosition(srcEl.parentNode,srcEl.id,"blocklist-li"); + var isLast = isLastNode(srcEl.parentNode,srcEl.id,"blocklist-li"); + var url = community_url+'planner/move?block_id='+block_id+'&tmp_block_id='+tmp_block_id+'&last_p='+isLast+'&swap_p=0'; + var update_url = community_url+'planner/order-update?block_index1='+blocks_index_map[block_id]+'&block_index2='+blocks_index_map[tmp_block_id]+'&dates_p='+dates; + var update_blocks_options = community_url+'planner/block-update?block_index1='+blocks_index_map[block_id]+'&block_index2='+blocks_index_map[tmp_block_id]; +// var update_tmp_block_options = community_url+'block-update?block_id='+tmp_block_id; + new Ajax.Request(url, { + method: 'get', + onLoading: function(){ srcEl.appendChild(load_img); }, + onComplete: function(){ srcEl.removeChild(load_img); }, + onSuccess: function(r){ + new Ajax.Request(update_url,{ + method: 'get', + onSuccess: function(r){ + var blocks_index_id = r.responseText.split(';'); + var blocks_ids = blocks_index_id[0].split(','); + if(blocks_index_id[3] > 0) { + var current_week = getElementsByClassName("current-block",document); + var classes = current_week[0].className.split(' '); + for(j=0;j this.lastY) { + this.goingUp = false; + } + + this.lastY = y; + }, + + onDragOver: function(e, id) { + + var srcEl = this.getEl(); + var destEl = Dom.get(id); + + if (destEl.nodeName.toLowerCase() == "li") { + var orig_p = srcEl.parentNode; + var p = destEl.parentNode; + if (this.goingUp) { + nextEl = destEl; + p.insertBefore(srcEl, destEl); // insert above + } else { + nextEl = destEl.nextSibling; + p.insertBefore(srcEl, destEl.nextSibling); // insert below + } + + DDM.refreshCache(); + } + + var dragEl = this.getDragEl(); + Dom.setStyle(dragEl, "border", "2px solid red"); + }, + + onDragOut: function(e, id) { + + var dragEl = this.getDragEl(); + Dom.setStyle(dragEl, "border", "2px solid gray"); + + } +}); +if (edit_mode == '1') { +Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true); +}