Index: openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml,v diff -u -r1.21 -r1.22 --- openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 29 May 2006 15:10:52 -0000 1.21 +++ openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 20 Jun 2006 19:20:37 -0000 1.22 @@ -3,6 +3,7 @@ Component Identifier Act Identifier + active Activity Structures Acts in play %count% Admin IMS LD @@ -173,6 +174,7 @@ Parent Manifest Identifier Parent Role Identifier Please, confirm the information you are uploading + Please submit a value Referenced activity structure %ref% does not exist Referenced activity structure (%activity_structure_ref_ref%) in role part %identifier% does not exist. Referenced activity structure %activity_structure_ref_ref% in role part %identifier% is actually an support activity. @@ -248,10 +250,12 @@ Max Persons Method Identifier Min Persons + User &nbsp;&nbsp;&nbsp;done New IMS-LD information found in the imsmanifest.xml file. Nothing to do. No IMS LD + None Not defined Number of IMD LDs Number to Select @@ -277,6 +281,7 @@ Role Type Run (IMS-LD) Name Runs (IMS-LD instances) + select user... Self send-mail service Sendmail Identifier @@ -287,6 +292,7 @@ Sort Order Staff Roles Status + stopped Structure Type Support Activities Then Identifier @@ -304,6 +310,7 @@ User Choice? Value Version + waiting When Condition True With Control XML Piece Index: openacs-4/packages/imsld/lib/imsld-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/imsld-chunk.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/imsld/lib/imsld-chunk.tcl 29 May 2006 15:10:52 -0000 1.9 +++ openacs-4/packages/imsld/lib/imsld-chunk.tcl 20 Jun 2006 19:20:38 -0000 1.10 @@ -17,6 +17,12 @@ orderby_desc {imsld_title desc} display_template {@imsld_runs.imsld_title@} } + status { + label "[_ imsld.Status]" + orderby_asc {status asc} + orderby_desc {status desc} + display_template {@imsld_runs.image_alt@} + } creation_date { label "[_ imsld.Creation_Date]" orderby_asc {creation_date asc} @@ -34,12 +40,29 @@ set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id] -template::multirow create imsld_runs run_id imsld_title creation_date +template::multirow create imsld_runs run_id imsld_title creation_date image_alt image_title image_path db_foreach active_runs { *SQL* } { - if { [llength [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id]] } { - template::multirow append imsld_runs $run_id $imsld_title $creation_date + if { [llength [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id]] } { + switch $status { + waiting { + set image_alt "[_ imsld.waiting]" + set image_title "[_ imsld.waiting]" + set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/waiting.png" + } + active { + set image_alt "[_ imsld.active]" + set image_title "[_ imsld.active]" + set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/active.png" + } + stopped { + set image_alt "[_ imsld.stopped]" + set image_title "[_ imsld.stopped]" + set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png" + } } + template::multirow append imsld_runs $run_id $imsld_title $creation_date $image_alt $image_title $image_path + } } Index: openacs-4/packages/imsld/lib/imsld-chunk.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/imsld-chunk.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/lib/imsld-chunk.xql 6 Jun 2006 13:24:46 -0000 1.2 +++ openacs-4/packages/imsld/lib/imsld-chunk.xql 20 Jun 2006 19:20:38 -0000 1.3 @@ -8,7 +8,8 @@ select run.run_id, coalesce(imsld.title, imsld.identifier) as imsld_title, - to_char(ao.creation_date,'MM/DD/YYYY HH24:MI') as creation_date + to_char(ao.creation_date,'MM/DD/YYYY HH24:MI') as creation_date, + run.status from cr_items cr1, cr_items cr2, cr_items cr3, cr_items cr4, acs_objects ao, imsld_runs run, imsld_cp_manifests icm, imsld_cp_organizations ico, imsld_imsldsi imsld where run.imsld_id = imsld.imsld_id Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql 16 May 2006 09:24:35 -0000 1.4 +++ openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql 20 Jun 2006 19:20:38 -0000 1.5 @@ -69,7 +69,7 @@ references cr_items --imsld_properties not null, restriction_type varchar(20) - check (restriction_type in ('length','minlength','maxlength','enumeration','maxinclusive','mininclusive','maxexclusive','minexclusive','totaldigits','fractiondigits')), + check (restriction_type in ('length','minlength','maxlength','enumeration','maxinclusive','mininclusive','maxexclusive','minexclusive','totaldigits','fractiondigits','whitespace','pattern')), value varchar(4000) ); Index: openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql 16 May 2006 09:24:35 -0000 1.2 +++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql 20 Jun 2006 19:20:38 -0000 1.3 @@ -86,7 +86,7 @@ identifier varchar(100) -- the same identifier that the corresponding propert (cache) not null, party_id integer - references parties, -- for the property of type loc, locpers, locrole orpst globpers + references parties, -- for the property of type loc, locpers, locrole or globpers run_id integer constraint imsld_pin_rn_fk references imsld_runs, Index: openacs-4/packages/imsld/tcl/imsld-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-install-procs.tcl,v diff -u -r1.25 -r1.26 --- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 29 May 2006 15:10:52 -0000 1.25 +++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 20 Jun 2006 19:20:38 -0000 1.26 @@ -345,7 +345,6 @@ # content::type::attribute::new -content_type imsld_property_instance -attribute_name property_id -datatype number -pretty_name "#imsld.Property_Identifier# " -column_spec "integer" # content::type::attribute::new -content_type imsld_property_instance -attribute_name party_id -datatype number -pretty_name "#imsld.Party_Identifier#" -column_spec "integer" # content::type::attribute::new -content_type imsld_property_instance -attribute_name value -datatype string -pretty_name "#imsld.Value#" -column_spec "varchar(4000)" - } ad_proc -public imsld::install::create_group_types { @@ -380,8 +379,6 @@ rel_types::new imsld_run_users_group_rel "ims_ld_run_group - acs_users" "ims_ld_run_group - acs_users" \ imsld_run_users_group 0 {} \ party 0 {} - - } ad_proc -public imsld::install::init_rels { @@ -848,7 +845,7 @@ set attribute_id [lindex $attribute_list 0] attribute::delete $attribute_id } - + ### Content Types ### IMS-LD Level B Index: openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 7 Jun 2006 10:48:17 -0000 1.3 +++ openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 20 Jun 2006 19:20:38 -0000 1.4 @@ -482,3 +482,4 @@ return [package_exec_plsql -var_list [list [list run_id $run_id]] imsld_run del] } + Index: openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl,v diff -u -r1.40 -r1.41 --- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 29 May 2006 15:10:52 -0000 1.40 +++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 20 Jun 2006 19:20:38 -0000 1.41 @@ -1747,8 +1747,8 @@ return $item_list } - } - + } + # create the conference service set conference_id [imsld::item_revision_new -attributes [list [list service_id $service_id] \ [list manager_id $manager_id] \ @@ -1823,14 +1823,14 @@ } } } - + # index service (not supported) set index_search [$service_node child all imsld:index-search] if { [llength $index_search] } { ns_log error "Index-search service not supported" return [list 0 "[_ imsld.lt_Index_search_service_]"] } - + # monitor service (level b) set monitor_service [$service_node child all imsld:monitor] if { [llength $monitor_service] } { @@ -1874,10 +1874,10 @@ set imsld_item [$monitor_service child all imsld:item] imsld::parse::validate_multiplicity -tree $imsld_item -multiplicity 1 -element_name "imslditem(monitor service)" -equal set item_list [imsld::parse::parse_and_create_item -manifest $manifest \ - -manifest_id $manifest_id \ - -item_node $imsld_item \ - -parent_id $parent_id \ - -tmp_dir $tmp_dir] + -manifest_id $manifest_id \ + -item_node $imsld_item \ + -parent_id $parent_id \ + -tmp_dir $tmp_dir] set imsld_item_id [lindex $item_list 0] if { !$imsld_item_id } { @@ -1886,7 +1886,7 @@ } # create the monitor service - set send_mail_id [imsld::item_revision_new -attributes [list [list service_id $service_id] \ + set monitor_service_id [imsld::item_revision_new -attributes [list [list service_id $service_id] \ [list role_id $role_id] \ [list self_p $self_p] \ [list imsld_item_id $imsld_item_id]] \ @@ -4260,3 +4260,4 @@ } return [list $manifest_id "$warnings"] } + Index: openacs-4/packages/imsld/tcl/imsld-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.tcl,v diff -u -r1.67 -r1.68 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 6 Jun 2006 13:24:46 -0000 1.67 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 20 Jun 2006 19:20:38 -0000 1.68 @@ -930,10 +930,12 @@ } } imsld_as_env_rel { + dom createDocument foo foo_doc + set foo_node [$foo_doc documentElement] if { [llength $environment_list] } { - set environment_list [concat [list $environment_list] [list [imsld::process_environment -environment_item_id $object_id_two]]] + set environment_list [concat [list $environment_list] [list [imsld::process_environment_as_ul -environment_item_id $object_id_two -run_id $run_id -dom_doc $foo_doc -dom_node $foo_node]]] } else { - set environment_list [imsld::process_environment -environment_item_id $object_id_two] + set environment_list [imsld::process_environment_as_ul -environment_item_id $object_id_two -run_id $run_id -dom_doc $foo_doc -dom_node $foo_node] } } } @@ -1286,7 +1288,7 @@ } send-mail { - # FIX ME: when roles are supported, fix it so the mail is sent to the propper role + # FIX ME: when roles are supported, fix this so the mail is sent to the propper role set resource_item_list [list] db_1row get_send_mail_info { *SQL* } @@ -1301,6 +1303,21 @@ $dom_node appendChild $send_mail_node_li } + monitor { + set resource_item_list [list] + db_1row monitor_service_info { *SQL* } + + set monitor_node_li [$dom_doc createElement li] + set a_node [$dom_doc createElement a] + + $a_node setAttribute href "[export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/monitor-frame" { monitor_id run_id }]" + set service_title [$dom_doc createTextNode "$monitor_service_title"] + $a_node setAttribute target "content" + $a_node appendChild $service_title + $monitor_node_li appendChild $a_node + $dom_node appendChild $monitor_node_li + } + default { ad_return_error "the service type $service_type is not implemented... yet" "Sorry, that service type ($service_type) hasn't been implemented yet. But be patience, we are working on it =)" ad_script_abort @@ -1605,7 +1622,6 @@ } else { db_1row get_ao_info { *SQL* } } - set file_url [acs_sc::invoke -contract FtsContentProvider -operation url -impl $object_type -call_args [list $acs_object_id]] set a_node [$dom_doc createElement a] $a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id}]" @@ -1622,6 +1638,32 @@ $dom_node appendChild $a_node } + } elseif { [string eq $resource_type "imsldcontent"] } { + foreach file_list [db_list_of_lists associated_files { *SQL* }] { + set imsld_file_id [lindex $file_list 0] + set file_name [lindex $file_list 1] + set item_id [lindex $file_list 2] + set parent_id [lindex $file_list 3] + # get the fs file path + set folder_path [db_exec_plsql get_folder_path { *SQL* }] + set fs_file_url [db_1row get_fs_file_url { *SQL* }] + set file_url "imsld-content-serve" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id resource_id $resource_id}]" + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[imsld::object_type_image_path -object_type file-storage]" + $img_node setAttribute border "0" + $img_node setAttribute alt "$file_name" + $a_node appendChild $img_node + if { $li_mode_p } { + set file_node [$dom_doc createElement li] + $file_node appendChild $a_node + $dom_node appendChild $file_node + } else { + $dom_node appendChild $a_node + } + } + } else { # is webcontent, let's get the associated files foreach file_list [db_list_of_lists associated_files { *SQL* }] { Index: openacs-4/packages/imsld/tcl/imsld-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.xql,v diff -u -r1.22 -r1.23 --- openacs-4/packages/imsld/tcl/imsld-procs.xql 29 May 2006 15:10:52 -0000 1.22 +++ openacs-4/packages/imsld/tcl/imsld-procs.xql 20 Jun 2006 19:20:38 -0000 1.23 @@ -914,6 +914,44 @@ + + + + + select ims.title as monitor_service_title, + ims.monitor_id, + ims.item_id as monitor_item_id, + ims.self_p, + ims.role_id, + cr.live_revision as imsld_item_id + from imsld_monitor_servicesi ims, cr_items cr + where ims.service_id = :service_item_id + and cr.item_id = ims.imsld_item_id + and content_revision__is_live(cr.live_revision) = 't' + + + + + + + + + select cpr.resource_id, + cpr.item_id as resource_item_id, + cpr.type as resource_type + from imsld_cp_resourcesi cpr, imsld_itemsi ii, + acs_rels ar, imsld_res_files_rels map + where ar.object_id_one = ii.item_id + and ar.object_id_two = cpr.item_id + and content_revision__is_live(cpr.resource_id) = 't' + and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id)) + and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id)) + or ii.imsld_item_id = :imsld_item_id) + and ar.rel_id = map.rel_id + and map.displayable_p = 't' + + + Index: openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 6 Jun 2006 13:24:46 -0000 1.5 +++ openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 20 Jun 2006 19:20:38 -0000 1.6 @@ -156,6 +156,32 @@ return $groups } +ad_proc -private imsld::roles::get_user_role_instance { + -role_id:required + -run_id:required + {-user_id ""} +} { + @return the role_instance_id for that role_id which the user belongs to. 0 if the user doesn't belong to any role instance +} { + if { [string eq $user_id ""] } { + set user_id [ad_conn user_id] + } + + set found_p 0 + foreach role_instance_id [imsld::roles::get_role_instances -role_id $role_id -run_id $run_id] { + if { [group::member_p -user_id $user_id -group_id $role_instance_id] } { + set found_p 1 + break + } + } + + if { !$found_p } { + return 0 + } + + return $role_instance_id +} + ad_proc -private imsld::roles::get_parent_role_instance { -group_id -root_parent:boolean Index: openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 20 Jun 2006 19:20:38 -0000 1.1 @@ -0,0 +1,20 @@ +# /packages/imsld/tcl/imsld-runtime-procs + +ad_library { + Procedures in the imsld::runtime namespace. + + @creation-date Jun 2006 + @author jopez@inv.it.uc3m.es + @cvs-id $Id: imsld-runtime-procs.tcl,v 1.1 2006/06/20 19:20:38 josee Exp $ +} + +namespace eval imsld {} +namespace eval imsld::runtime::property {} + +ad_proc -public imsld::runtime::property::instance_value_set { + -instance_id + -value +} { + db_dml update_instance_value { *SQL* } +} + Index: openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql 20 Jun 2006 19:20:38 -0000 1.1 @@ -0,0 +1,12 @@ + + + + + + update imsld_property_instances + set value = :value + where instance_id = :instance_id + + + + Index: openacs-4/packages/imsld/www/activity-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/activity-frame.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/imsld/www/activity-frame.adp 19 May 2006 17:26:02 -0000 1.7 +++ openacs-4/packages/imsld/www/activity-frame.adp 20 Jun 2006 19:20:38 -0000 1.8 @@ -24,15 +24,13 @@ - + @activities;noquote@ - - - + Index: openacs-4/packages/imsld/www/activity-frame.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/activity-frame.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/www/activity-frame.tcl 18 May 2006 11:13:01 -0000 1.6 +++ openacs-4/packages/imsld/www/activity-frame.tcl 20 Jun 2006 19:20:38 -0000 1.7 @@ -21,7 +21,7 @@ and isai.activity_id =:activity_id }] if {[llength $supported_roles]} { - set flag 1 + set roles_template_p 1 } Index: openacs-4/packages/imsld/www/environment-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/environment-frame.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/www/environment-frame.adp 6 Apr 2006 09:37:29 -0000 1.3 +++ openacs-4/packages/imsld/www/environment-frame.adp 20 Jun 2006 19:20:38 -0000 1.4 @@ -29,7 +29,7 @@ var as = document.getElementsByTagName("a"); for (var i = 0; i < as.length; i++) { var a = as[i]; - a.setAttribute('target', 'object'); + a.setAttribute('target', 'content'); } Index: openacs-4/packages/imsld/www/imsld-content-serve.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-content-serve.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/imsld-content-serve.tcl 20 Jun 2006 19:20:38 -0000 1.1 @@ -0,0 +1,516 @@ +ad_page_contract { +} { + run_id:integer,notnull + {owner_user_id:integer ""} + resource_item_id + {role_id ""} +} + +if { [string eq $owner_user_id ""] } { + set owner_user_id [ad_conn user_id] +} + +# get file info +db_1row get_info { + select f.revision_id, + f.item_id, + f.file_name + from imsld_cp_filesi f, acs_rels ar, imsld_res_files_rels map + where ar.object_id_one = :resource_item_id + and ar.object_id_two = f.item_id + and ar.rel_id = map.rel_id + and map.displayable_p = 't' +} + +set xml_string [cr_write_content -string -revision_id $revision_id] + +# context info +db_1row context_info { + select ic.item_id as component_item_id, + ii.imsld_id, + rug.group_id as run_group_id + from imsld_componentsi ic, imsld_imsldsi ii, imsld_runs ir, imsld_run_users_group_ext rug + where ic.imsld_id = ii.item_id + and content_revision__is_live(ii.imsld_id) = 't' + and ii.imsld_id = ir.imsld_id + and rug.run_id = ir.run_id + and ir.run_id = :run_id +} + +# Parser +# XML => DOM document +dom parse $xml_string dom_doc +# DOM document => DOM root +$dom_doc documentElement dom_root + +# procedure: +# currently we only deliver properties of one user at the same time in one given role +# 1. replace the view-property tags with the property title(optional) and value +# 2. replace the view-property-group tags with the properties titles(optional) and value of all the referenced properties +# 3. replace the set-property tags with input fields depending on the property type +# 4. replace the set-groperty-group tags with one input field per each referenced property in the group +# 5. if there was at least one set-property* tag, add a submit button + +# 1. view-property nodes +set view_property_nodes [$dom_root selectNodes {//*[local-name()='view-property']}] +foreach view_property_node $view_property_nodes { + # get requested info + set identifier [string tolower [$view_property_node getAttribute ref]] + set view [$view_property_node getAttribute view "value"] + set property_of [$view_property_node getAttribute property-of "self"] + + # get property info + db_1row property_info { + select type, + property_id + from imsld_properties + where component_id = :component_item_id + and identifier = :identifier + } + + # get the value, depending on the property type. + # the only different case is when viewing the proprty in the context of the role + set role_instance_id 0 + # get property info + db_1row property_info { + select type, + property_id + from imsld_properties + where component_id = :component_item_id + and identifier = :identifier + } + + if { ![string eq $property_of "self"] } { + # find the role instance which the user belongs to + set role_instance_id [imsld::roles::get_user_role_instance -run_id $run_id -role_id $role_id -user_id $owner_user_id] + if { !$role_instance_id } { + # runtime error... the user doesn't belong to any role instance + ns_log notice "User does not belong to any role instance" + continue + } + } + + db_1row get_property_value { + select ins.property_id, + prop.datatype, + coalesce(ins.value, prop.initial_value) as value, + prop.title + from imsld_propertiesi prop, + imsld_property_instances ins + where prop.property_id = ins.property_id + and ((prop.type = 'global') + or (prop.type = 'loc' and ins.run_id = :run_id) + or (prop.type = 'locpers' and ins.run_id = :run_id and ins.party_id = :owner_user_id) + or (prop.type = 'locrole' and ins.run_id = :run_id and ins.party_id = :role_instance_id) + or (prop.type = 'globpers' and ins.party_id = :owner_user_id)) + and prop.property_id = :property_id + } + + # prepare replacement + if { [string eq $view "value"] } { + # display only the value + set view_property_new_node [$dom_doc createTextNode "$value"] + } else { + # its a value-title reference, display both + set view_property_new_node [$dom_doc createTextNode "$title: $value"] + } + + # done... replace the node + set parent_node [$view_property_node parentNode] + $parent_node replaceChild $view_property_new_node $view_property_node +} + +# 2. view-property-group nodes +set view_property_group_nodes [$dom_root selectNodes {//*[local-name()='view-property-group']}] +set view_property_group_new_node [$dom_doc createElement p] +foreach view_property_group_node $view_property_group_nodes { + # get requested info + set identifier [string tolower [$view_property_group_node getAttribute ref]] + set view [$view_property_group_node getAttribute view "value"] + set property_of [$view_property_group_node getAttribute property-of "self"] + + # add group title (according to the spec) + set group_title [$dom_doc createTextNode "$identifier"] + $view_property_group_new_node appendChild $group_title + + # get group property info + db_1row group_property_info { + select property_group_id, + item_id as property_group_item_id + from imsld_property_groupsi + where component_id = :component_item_id + and identifier = :identifier + } + + # get the info in order to take the properties value, depending on the property type. + # the only different case is when viewing the proprty in the context of the role + set role_instance_id 0 + if { ![string eq $property_of "self"] } { + # find the role instance which the user belongs to + set role_instance_id [imsld::roles::get_user_role_instance -run_id $run_id -role_id $role_id -user_id $owner_user_id] + if { !$role_instance_id } { + # runtime error... the user doesn't belong to any role instance + ns_log notice "User does not belong to any role instance" + continue + } + } + + db_foreach properties_in_group { + select ins.property_id, + prop.datatype, + coalesce(ins.value, prop.initial_value) as value, + prop.title, + prop.identifier + from imsld_propertiesi prop, + imsld_property_instances ins, + acs_rels map + where prop.property_id = ins.property_id + and ((prop.type = 'global') + or (prop.type = 'loc' and ins.run_id = :run_id) + or (prop.type = 'locpers' and ins.run_id = :run_id and ins.party_id = :owner_user_id) + or (prop.type = 'locrole' and ins.run_id = :run_id and ins.party_id = :role_instance_id) + or (prop.type = 'globpers' and ins.party_id = :owner_user_id)) + and map.object_id_one = :property_group_item_id + and map.object_id_two = prop.item_id + and map.rel_type = 'imsld_gprop_prop_rel' + and prop.component_id = :component_item_id + } { + # prepare replacement + if { [string eq $view "value"] } { + # display only the value + set view_property_new_node [$dom_doc createTextNode "$value"] + } else { + # its a value-title reference, display both + set view_property_new_node [$dom_doc createTextNode "$title: $value"] + } + $view_property_group_new_node appendChild $view_property_new_node + } + + # done... replace the node + set parent_node [$view_property_group_node parentNode] + $parent_node replaceChild $view_property_group_new_node $view_property_group_node +} + +# 3. set-property nodes +set set_property_nodes [$dom_root selectNodes {//*[local-name()='set-property']}] +foreach set_property_node $set_property_nodes { + # get requested info + set identifier [string tolower [$set_property_node getAttribute ref]] + set view [$set_property_node getAttribute view "value"] + set property_of [$set_property_node getAttribute property-of "self"] + + # get property info + db_1row property_info { + select type, + property_id, + datatype, + item_id as property_item_id + from imsld_propertiesi + where component_id = :component_item_id + and identifier = :identifier + } + + # get the value, depending on the property type. + # the only different case is when viewing the proprty in the context of the role + set role_instance_id 0 + if { ![string eq $property_of "self"] } { + # find the role instance which the user belongs to + set role_instance_id [imsld::roles::get_user_role_instance -run_id $run_id -role_id $role_id -user_id $owner_user_id] + if { !$role_instance_id } { + # runtime error... the user doesn't belong to any role instance + ns_log notice "User does not belong to any role instance" + continue + } + } + + db_1row get_property_value { + select ins.property_id, + prop.datatype, + coalesce(ins.value, prop.initial_value) as value, + prop.title, + ins.instance_id + from imsld_propertiesi prop, + imsld_property_instances ins + where prop.property_id = ins.property_id + and ((prop.type = 'global') + or (prop.type = 'loc' and ins.run_id = :run_id) + or (prop.type = 'locpers' and ins.run_id = :run_id and ins.party_id = :owner_user_id) + or (prop.type = 'locrole' and ins.run_id = :run_id and ins.party_id = :role_instance_id) + or (prop.type = 'globpers' and ins.party_id = :owner_user_id)) + and prop.property_id = :property_id + } + + # get the restrictions and translate them to HTML + # currently, in HTML we can only deal with the restriction types: length, + # length, maxlength, enumeration and totaldigits. + # the rest are checked after submission + set restriction_nodes [list] + set input_text_node "" + set select_node "" + db_foreach restriction { + select restriction_type, + value as restriction_value + from imsld_restrictions + where property_id = :property_item_id + } { + switch $restriction_type { + length - + maxlength - + maxinclusive - + totaldigits { + if { [string eq "" $input_text_node] } { + set input_text_node [$dom_doc createElement "input"] + $input_text_node setAttribute type "text" + $input_text_node setAttribute name "instances_ids.$instance_id" + } + $input_text_node setAttribute maxlength $restriction_value + $input_text_node setAttribute value "$value" + } + enumeration { + if { [string eq "" $select_node] } { + set select_node [$dom_doc createElement "select"] + $select_node setAttribute name "instances_ids.$instance_id" + } + set option_node [$dom_doc createElement "option"] + $option_node setAttribute value "$restriction_value" + if { [string eq $value $restriction_value] } { + $option_node setAttribute selected "selected" + } + $option_node appendChild [$dom_doc createTextNode "$restriction_value"] + $select_node appendChild $option_node + } + maxexclusive { + if { [string eq "" $input_text_node] } { + set input_text_node [$dom_doc createElement "input"] + $input_text_node setAttribute type "text" + $input_text_node setAttribute name "instances_ids.$instance_id" + } + $input_text_node setAttribute maxlength [expr $restriction_value - 1] + $input_text_node setAttribute value "$value" + } + minlength { + } + mininclusive { + } + minexclusive { + } + pattern { + } + whitespace { + } + } + } if_no_rows { + # no restrictions + set input_text_node [$dom_doc createElement "input"] + $input_text_node setAttribute type "text" + $input_text_node setAttribute name "instances_ids.$instance_id" + $input_text_node setAttribute value "$value" + } + + # prepare replacement + set form_node [$dom_doc createElement "form"] + $form_node setAttribute name "set-properties" + $form_node setAttribute action "properties-value-set" + $form_node setAttribute method "get" + + if { [string eq $view "title-value"] } { + $form_node appendChild [$dom_doc createTextNode "$title"] + } + + if { ![string eq "" $select_node] } { + $form_node appendChild $select_node + } + + if { ![string eq "" $input_text_node] } { + $form_node appendChild $input_text_node + } + + # adding return url + set return_url_node [$dom_doc createElement "input"] + $return_url_node setAttribute name "return_url" + $return_url_node setAttribute type "hidden" + $return_url_node setAttribute value "[ad_conn url]?[ad_conn query]" + $form_node appendChild $return_url_node + + # adding the submit button + set submit_node [$dom_doc createElement "input"] + $submit_node setAttribute type "submit" + $submit_node setAttribute value "ok" + $form_node appendChild $submit_node + # done... add the form to the root + set parent_node [$set_property_node parentNode] + # first, replace property node with the form node + $parent_node replaceChild $form_node $set_property_node + # FIXME: tDOME apparently adds automathically the attribute xmlns when replacing a node... + $form_node removeAttribute xmlns +} + +# 4. set-property-group nodes +set set_property_group_nodes [$dom_root selectNodes {//*[local-name()='set-property-group']}] +foreach set_property_group_node $set_property_group_nodes { + # get requested info + set identifier [string tolower [$set_property_group_node getAttribute ref]] + set view [$set_property_group_node getAttribute view "value"] + set property_of [$set_property_group_node getAttribute property-of "self"] + + # prepare replacement + set form_node [$dom_doc createElement "form"] + $form_node setAttribute name "set-properties" + $form_node setAttribute action "properties-value-set" + $form_node setAttribute method "get" + + # add group title (according to the spec) + set group_title [$dom_doc createTextNode "$identifier"] + $form_node appendChild $group_title + $form_node appendChild [$dom_doc createElement "br"] + + # get property info + db_1row group_property_info { + select property_group_id, + item_id as property_group_item_id + from imsld_property_groupsi + where component_id = :component_item_id + and identifier = :identifier + } + + # get the value, depending on the property type. + # the only different case is when viewing the proprty in the context of the role + set role_instance_id 0 + if { ![string eq $property_of "self"] } { + # find the role instance which the user belongs to + set role_instance_id [imsld::roles::get_user_role_instance -run_id $run_id -role_id $role_id -user_id $owner_user_id] + if { !$role_instance_id } { + # runtime error... the user doesn't belong to any role instance + ns_log notice "User does not belong to any role instance" + continue + } + } + + foreach properties_in_group [db_list_of_lists properties_in_group { + select ins.property_id, + prop.item_id as property_item_id, + prop.datatype, + coalesce(ins.value, prop.initial_value) as value, + prop.title, + prop.identifier + from imsld_propertiesi prop, + imsld_property_instances ins, + acs_rels map + where prop.property_id = ins.property_id + and ((prop.type = 'global') + or (prop.type = 'loc' and ins.run_id = :run_id) + or (prop.type = 'locpers' and ins.run_id = :run_id and ins.party_id = :owner_user_id) + or (prop.type = 'locrole' and ins.run_id = :run_id and ins.party_id = :role_instance_id) + or (prop.type = 'globpers' and ins.party_id = :owner_user_id)) + and map.object_id_one = :property_group_item_id + and map.object_id_two = prop.item_id + and map.rel_type = 'imsld_gprop_prop_rel' + and prop.component_id = :component_item_id + }] { + set property_id [lindex $properties_in_group 0] + set property_item_id [lindex $properties_in_group 1] + set datatype [lindex $properties_in_group 2] + set value [lindex $properties_in_group 3] + set title [lindex $properties_in_group 4] + set identifier [lindex $properties_in_group 5] + # get the restrictions and translate them to HTML + # currently, in HTML we can only deal with the restriction types: length, + # length, maxlength, enumeration and totaldigits. + # the rest are checked after submission + set input_text_node "" + set select_node "" + db_foreach restriction { + select restriction_type, + value as restriction_value + from imsld_restrictions + where property_id = :property_item_id + } { + switch $restriction_type { + length - + maxlength - + maxinclusive - + totaldigits { + if { [string eq "" $input_text_node] } { + set input_text_node [$dom_doc createElement "input"] + $input_text_node setAttribute type "text" + $input_text_node setAttribute name "instances_ids.$instance_id" + } + $input_text_node setAttribute maxlength $restriction_value + $input_text_node setAttribute value "$value" + } + enumeration { + if { [string eq "" $select_node] } { + set select_node [$dom_doc createElement "select"] + $select_node setAttribute name "instances_ids.$instance_id" + } + set option_node [$dom_doc createElement "option"] + $option_node setAttribute value "$restriction_value" + if { [string eq $value $restriction_value] } { + $option_node setAttribute selected "selected" + } + $option_node appendChild [$dom_doc createTextNode "$restriction_value"] + $select_node appendChild $option_node + } + maxexclusive { + if { [string eq "" $input_text_node] } { + set input_text_node [$dom_doc createElement "input"] + $input_text_node setAttribute type "text" + $input_text_node setAttribute name "instances_ids.$instance_id" + } + $input_text_node setAttribute maxlength [expr $restriction_value - 1] + $input_text_node setAttribute value "$value" + } + minlength { + } + mininclusive { + } + minexclusive { + } + pattern { + } + whitespace { + } + } + } if_no_rows { + # no restrictions + set input_text_node [$dom_doc createElement "input"] + $input_text_node setAttribute type "text" + $input_text_node setAttribute name "instances_ids.$instance_id" + $input_text_node setAttribute value "$value" + } + + if { [string eq $view "title-value"] } { + $form_node appendChild [$dom_doc createTextNode "$identifier"] + } + + if { ![string eq "" $select_node] } { + $form_node appendChild $select_node + } + + if { ![string eq "" $input_text_node] } { + $form_node appendChild $input_text_node + } + $form_node appendChild [$dom_doc createElement "br"] + } + + set parent_node [$set_property_group_node parentNode] + + # adding return url + set return_url_node [$dom_doc createElement "input"] + $return_url_node setAttribute name "return_url" + $return_url_node setAttribute type "hidden" + $return_url_node setAttribute value "[ad_conn url]?[ad_conn query]" + $form_node appendChild $return_url_node + + # adding the submit button + set submit_node [$dom_doc createElement "input"] + $submit_node setAttribute type "submit" + $submit_node setAttribute value "ok" + $form_node appendChild $submit_node + # finally, replace property node with the form node + $parent_node replaceChild $form_node $set_property_group_node + # FIXME: tDOME apparently adds automathically the attribute xmlns when replacing a node... + $form_node removeAttribute xmlns +} + +ns_return 200 application/xml "[$dom_root asXML]" \ No newline at end of file Index: openacs-4/packages/imsld/www/imsld-finish-resource.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-finish-resource.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/imsld-finish-resource.tcl 16 May 2006 09:24:35 -0000 1.5 +++ openacs-4/packages/imsld/www/imsld-finish-resource.tcl 20 Jun 2006 19:20:38 -0000 1.6 @@ -5,6 +5,8 @@ file_url resource_item_id run_id + resource_id:optional + owner_user_id:optional } # fedback nor assessment has to be marked as finished @@ -20,5 +22,4 @@ }] } { imsld::finish_resource -resource_id $resource_id -run_id $run_id } - -ad_returnredirect $file_url +ad_returnredirect "[export_vars -base "$file_url" -url { file_url run_id resource_id resource_item_id owner_user_id }]" Index: openacs-4/packages/imsld/www/imsld-frameset.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/Attic/imsld-frameset.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/www/imsld-frameset.tcl 16 May 2006 09:24:35 -0000 1.2 +++ openacs-4/packages/imsld/www/imsld-frameset.tcl 20 Jun 2006 19:20:38 -0000 1.3 @@ -1,4 +1,4 @@ -# packages/lorsm/www/delivery/index.tcl +# packages/imsld/www/imsld-frameset.tcl ad_page_contract { Index: openacs-4/packages/imsld/www/monitor-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/monitor-frame.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/monitor-frame.adp 20 Jun 2006 19:20:38 -0000 1.1 @@ -0,0 +1,73 @@ + + + + + + + + + + +#imsld.Monitoring#: @monitoring_user_name@ + + +
+ + + + +
+
+ +
+ +
+ + + + + + + + + + + + Index: openacs-4/packages/imsld/www/monitor-frame.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/monitor-frame.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/monitor-frame.tcl 20 Jun 2006 19:20:38 -0000 1.1 @@ -0,0 +1,54 @@ +# packages/imsld/www/monitor-frame.tcl + +ad_page_contract { + + This is the frame user to display the monitor service + + @author jopez@inv.it.uc3m.es + @creation-date Abr 2006 + @cvs-id $Id: monitor-frame.tcl,v 1.1 2006/06/20 19:20:38 josee Exp $ +} -query { + run_id:integer,notnull + monitor_id:integer,notnull + {monitoring_user_id ""} + {role_id ""} +} + +set user_id [ad_conn user_id] + +db_1row monitor_service_info { *SQL* } + +template::multirow create users_in_role role_user_id user_name +set monitoring_user_name "[_ imsld.None]" + +if { [string eq $self_p "f"] } { + # display the list of users in order to chose one of them + set role_instances [imsld::roles::get_role_instances -role_id $role_id -run_id $run_id] + set users_in_instances [list] + foreach instance $role_instances { + set users_in_instances [concat $users_in_instances [group::get_members -group_id $instance]] + } + lsort -unique $users_in_instances + foreach role_user_id $users_in_instances { + set user_name [person::name -person_id $role_user_id] + template::multirow append users_in_role $role_user_id $user_name + } +} else { + set monitoring_user_id $user_id +} + +if { ![string eq $monitoring_user_id ""] } { + # a user has been selected, display the name + set monitoring_user_name [person::name -person_id $monitoring_user_id] + + # get the associated resource of the monitor service + db_1row monitor_associated_item { *SQL* } + + set monitor_service_url [export_vars -base "imsld-content-serve" -url { run_id resource_item_id role_id {owner_user_id $monitoring_user_id} }] +} else { + # no user has been selected... + set monitor_service_url "" +} + +set page_title {} +set context [list] Index: openacs-4/packages/imsld/www/monitor-frame.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/monitor-frame.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/monitor-frame.xql 20 Jun 2006 19:20:38 -0000 1.1 @@ -0,0 +1,36 @@ + + + + + + select ims.title as monitor_service_title, + ims.monitor_id, + ims.item_id as monitor_item_id, + ims.self_p, + cr2.live_revision as role_id, + cr.live_revision as imsld_item_id + from imsld_monitor_servicesi ims, cr_items cr, cr_items cr2 + where ims.monitor_id = :monitor_id + and cr.item_id = ims.imsld_item_id + and content_revision__is_live(cr.live_revision) = 't' + and ims.role_id = cr2.item_id + + + + + + + select cpr.resource_id, + cpr.item_id as resource_item_id, + cpr.type as resource_type + from imsld_cp_resourcesi cpr, imsld_itemsi ii, + acs_rels ar + where ar.object_id_one = ii.item_id + and ar.object_id_two = cpr.item_id + and content_revision__is_live(cpr.resource_id) = 't' + and ii.imsld_item_id = :imsld_item_id + + + + + Index: openacs-4/packages/imsld/www/properties-value-set.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/properties-value-set.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/properties-value-set.tcl 20 Jun 2006 19:20:38 -0000 1.1 @@ -0,0 +1,24 @@ +# packages/imsld/www/properties-value-set.tcl + +ad_page_contract { +} { + instances_ids:array,notnull + return_url +} -validate { + no_instance { + if { [array size instances_ids] == 0 } { + ad_complain "[_ imsld.lt_Please_submit_a_value]" + } + } +} + +foreach instance_id [array names instances_ids] { + if { [info exists instances_ids($instance_id)] } { + # avoiding hacks + set value $instances_ids($instance_id) + imsld::runtime::property::instance_value_set -instance_id $instance_id -value $value + } +} + +ad_returnredirect "$return_url" + Index: openacs-4/packages/imsld/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/index.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/imsld/www/admin/index.tcl 6 Jun 2006 13:24:46 -0000 1.9 +++ openacs-4/packages/imsld/www/admin/index.tcl 20 Jun 2006 19:20:39 -0000 1.10 @@ -110,6 +110,7 @@ label "[_ imsld.Status]" orderby_asc {status asc} orderby_desc {status desc} + display_template {@imsld_runs.image_alt@} } creation_date { label "[_ imsld.Creation_Date]" @@ -135,17 +136,31 @@ set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id] -db_multirow -extend { manage delete_template } imsld_runs get_runs { *SQL* } { +db_multirow -extend { manage delete_template image_path image_alt image_title } imsld_runs get_runs { *SQL* } { + + set delete_template "" - if { [string eq $status "deleted"] } { - set delete_template "[_ imsld.Deleted] [_ imsld.Make_it_live]" - set manage "" - } elseif {[string eq $status "active"]} { - set delete_template "" - set manage "" - } else { - set delete_template "" - set create_run " [_ imsld.create_new_run] " - set manage "[_ imsld.Manage_Members]" - } + switch $status { + deleted { + set delete_template "[_ imsld.Deleted] [_ imsld.Make_it_live]" + } + active { + set delete_template "" + set image_alt "[_ imsld.active]" + set image_title "[_ imsld.active]" + set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/active.png" + } + waiting { + set image_alt "[_ imsld.waiting]" + set image_title "[_ imsld.waiting]" + set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/waiting.png" + set create_run " [_ imsld.create_new_run] " + set manage "[_ imsld.Manage_Members]" + } + stopped { + set image_alt "[_ imsld.stopped]" + set image_title "[_ imsld.stopped]" + set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png" + } + } } Index: openacs-4/packages/imsld/www/resources/active.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/resources/active.png,v diff -u Binary files differ Index: openacs-4/packages/imsld/www/resources/waiting.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/resources/waiting.png,v diff -u Binary files differ