Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-handle-token.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-handle-token.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-handle-token.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,42 @@ + ad_page_contract { + @author lfuente@it.uc3m.es + @creation-date mar 2009 +} { + gservice_id + run_id + plugin_URI + user_id + token +} + +#set user_id [ad_conn user_id] + +#the token received is a single use one. Let's upgrade it +package require TclCurl +#the url where tokens are upgraded to session tokens +set url "https://www.google.com/accounts/AuthSubSessionToken" +set curlHandle [curl::init] + +#if we have a token, we can upgrade it +if { ![string eq $token ""] } { + + #set the headers an configure the handlers with them + set httpHeaders "" + lappend httpHeaders "Content-Type: application/x-www-form-urlencoded" + lappend httpHeaders "Authorization: AuthSub token=\"$token\"" + lappend httpHeaders "Connection: keep-alive" + + $curlHandle configure -url $url + $curlHandle configure -httpheader $httpHeaders + $curlHandle configure -headervar http_code -bodyvar html_code + + $curlHandle perform +} +ns_log Notice "$html_code" +set token [string trim [lindex [split $html_code "="] 1]] +ns_log Notice "$token" + +#token upgraded, let's store it +imsld::gsi::map_user -user_id $user_id -run_id $run_id -external_credentials $token -plugin_URI $plugin_URI + +ad_returnredirect [export_vars -base "imsld-gsi-service-configure" {gservice_id run_id}] Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-mapuser.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-mapuser.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-mapuser.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,23 @@ +#imsld-gsi-mapuser.tcl +ad_page_contract { + @author lfuente@it.uc3m.es + @creation-date dic 2008 +} { + return_url + user_id + run_id + plugin_URI + external_user:optional + external_credentials:optional +} + +#imsld::gsi::map_user +if {[info exists external_user] && [info exists external_credentials]} { + imsld::gsi::map_user -user_id $user_id -run_id $run_id -external_user $external_user -external_credentials $external_credentials -plugin_URI $plugin_URI +} elseif {[info exists external_user] && ![info exists external_credentials]} { + imsld::gsi::map_user -user_id $user_id -run_id $run_id -external_user $external_user -plugin_URI $plugin_URI +} elseif {![info exists external_user] && [info exists external_credentials]} { + imsld::gsi::map_user -user_id $user_id -run_id $run_id -external_credentials $external_credentials -plugin_URI $plugin_URI +} + +ad_returnredirect $return_url Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.adp 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,43 @@ +<master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + +<switch @state@> + <case value="unchecked"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <a href="@check_button@" title="check this service">Check this service</a> + <a href="@back_button@" title="Back to service alternatives">Back to all alternatives</a> + </case> + + <case value="checked"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-response" plugin_URI=@plugin_URI@ run_id=@run_id@ gservice_id=@gservice_id@> + <a href="@refresh_button@" title="Update values">Update values</a> + <a href="@choose_button@" title="Choose this service">Choose this service</a> + <a href="@back_button@" title="Back to service alternatives">Back to all alternatives</a> + </case> + + <case value="chosen"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-response" plugin_URI=@plugin_URI@ run_id=@run_id@ gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-user-mapping" plugin_URI=@plugin_URI@ run_id=@run_id@ gservice_id=@gservice_id@> + <a href="@map_button@" title="Finish user mapping">Finish user mapping</a> + </case> + + <case value="mapped"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-response" plugin_URI=@plugin_URI@ run_id=@run_id@ gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-user-mapping" plugin_URI=@plugin_URI@ run_id=@run_id@ gservice_id=@gservice_id@ mapped_p="t"> + <a href="@configure_button@" title="Finish service configuration">Finish service configuration</a> + </case> + + <case value="configured"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-response" plugin_URI=@plugin_URI@ run_id=@run_id@ gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-user-mapping" plugin_URI=@plugin_URI@ run_id=@run_id@ gservice_id=@gservice_id@ mapped_p="t"> + <include src="imsld-gsi-show-service-configurated" plugin_URI=@plugin_URI@ run_id=@run_id@ gservice_id=@gservice_id@ still_waiting_p=@still_waiting_p@> + </case> + + +</switch> + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.adp.old =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.adp.old,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.adp.old 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,74 @@ +<master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + +<switch @state@> + <case value="void"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <a href="@check_button@" title="check this service">Check this service</a> + </case> + + <case value="checked"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-response" gservice_id=@gservice_id@ run_id=@run_id@ plugin_URI=@plugin_URI@> + <a href="@refresh_button@"></a> + <a href="@choose_button@"></a> + </case> + + <case value="chosen"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-response" gservice_id=@gservice_id@ run_id=@run_id@ plugin_URI=@plugin_URI@> + <include src="imsld-gsi-show-service-user-mapping" gservice_id=@gservice_id@ run_id=@run_id@ plugin_URI=@plugin_URI@> + <a href="@do_map_button@"></a> + </case> + + <case value="mapped"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-response" gservice_id=@gservice_id@ run_id=@run_id@ plugin_URI=@plugin_URI@> + <include src="imsld-gsi-show-service-user-mapping" gservice_id=@gservice_id@ run_id=@run_id@ plugin_URI=@plugin_URI@ mapped_p="t"> + <a href="@configure_button@"></a> + </case> + + <case value="configured"> + <include src="imsld-gsi-show-service-requirements" gservice_id=@gservice_id@> + <include src="imsld-gsi-show-service-response" gservice_id=@gservice_id@ run_id=@run_id@ plugin_URI=@plugin_URI@> + <include src="imsld-gsi-show-service-user-mapping" gservice_id=@gservice_id@ run_id=@run_id@ plugin_URI=@plugin_URI@ mapped_p="t"> + <include src="imsld-gsi-show-service-configuration-results" gservice_id=@gservice_id@ run_id=@run_id@ plugin_URI=@plugin_URI@> + </case> +</switch> + +<div class="check-service"> +<h2>Check service functionality</h2> +<!-- There is a list (ul-li) in the left with the requested capabilities, and a list in the rigth with the answer. CSS does the layout --> + +<div class="service-request"> +<h3>Functions</h3> +<ul> +<multiple name="requested_functions"> + <li>@requested_functions.item@</li> +</multiple> + +</ul> +<h3>Permissions</h3> +<ul> +<multiple name="requested_permissions"> + <li>@requested_permissions.item@</li> +</multiple> +</ul> +</div> + +<a href="@check_button@" title="check this service">Check this service</a> + + + + +<div class="get-urls"> + <h3>Obtain URLs</h3> + <if @users_mapped_p@ eq "t"> + <p>Something here...</p> + </if> + <else> + <p>You have to map map users before.</p> + </else> +</div> + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,204 @@ + ad_page_contract { + + Use a proper plugin to configure a service + @author lfuente@it.uc3m.es + @creation-date dic 2008 +} { + gservice_id + run_id + {plugin_URI ""} + gsi_request_id:optional + {do_check_p "f"} + {do_choose_p "f"} + {do_map_p "f"} + {do_configure_p "f"} +} +set page_title "IMS LD Service configuration" +set context [list "Service configuration"] +template::head::add_css -href "/resources/imsld/imsld.css" -media "screen" -order 0 + +#first, perform action (if requested) + +if {[string eq $do_check_p "t"]} { + #FIXME: ¿en un thread a parte? + +# ns_schedule_proc -thread -once 0 + imsld::gsi::initialize_check_request -gservice_id $gservice_id -plugin_URI $plugin_URI -run_id $run_id + + util_background_exec -pass_vars {gservice_id plugin_URI run_id} -name "check_in_background" { + ns_sleep 3 + set service_response [imsld::gsi::send_check_request -gservice_id $gservice_id -plugin_URI $plugin_URI -run_id $run_id] + imsld::gsi::store_check_results -gservice_id $gservice_id -run_id $run_id -service_response $service_response + } + +} +if {[string eq $do_choose_p "t"]} { + set users_in_run [imsld::runtime::users_in_run -run_id $run_id] + foreach user_id $users_in_run { + imsld::gsi::initialize_user -plugin_URI $plugin_URI -run_id $run_id -user_id $user_id + } + db_dml update_plugin { + UPDATE imsld_gsi_service_status + SET plugin_uri=:plugin_URI + WHERE run_id=:run_id and owner_id=:gservice_id + } + imsld::gsi::change_service_status -gservice_id $gservice_id -run_id $run_id -status "chosen" +} +if {[string eq $do_map_p "t"]} { + imsld::gsi::change_service_status -gservice_id $gservice_id -run_id $run_id -status "mapped" +} +if {[string eq $do_configure_p "t"]} { + if { ![string eq [imsld::gsi::get_service_status -run_id $run_id -gservice_id $gservice_id] "configured"]} { + set startup_actions [imsld::gsi::get_service_startup_actions -gservice_id $gservice_id] + set multiplicity [imsld::gsi::get_service_multiplicity -gservice_id $gservice_id] + + imsld::gsi::perform_startup_actions -run_id $run_id \ + -gservice_id $gservice_id \ + -startup_actions $startup_actions \ + -plugin_URI $plugin_URI \ + -multiplicity $multiplicity + + if {![db_0or1row is_service_set { + select 1 as ready + from imsld_gsi_p_gspread_usersmap + where run_id=:run_id + and spreadsheet_url is null + group by ready + }]} { + set users_in_service [imsld::gsi::get_users_in_service -gservice_id $gservice_id -run_id $run_id] + foreach user_id $users_in_service { + set service_URL [imsld::gsi::request_configured_instance -user_id $user_id -plugin_URI $plugin_URI -run_id $run_id -gservice_id $gservice_id] + set instance_id [db_string get_instance_id { + select att.instance_id + from imsld_attribute_instances att + where att.run_id=:run_id and + att.owner_id=:gservice_id and + att.user_id=:user_id + }] + foreach url_pair $service_URL { + set url [lindex $url_pair 1] + set url_title [lindex $url_pair 0] + db_dml insert_url {INSERT INTO imsld_gsi_serv_instances VALUES (:instance_id, :url, :url_title)} + } + } + + imsld::gsi::change_service_status -gservice_id $gservice_id -run_id $run_id -status "configured" + + #cuando todo esté en orden, hay que marcar el run como activo, pero sólo si no quedan más + #servicios por configurar + set remaining_services_p [db_0or1row get_services_in_run { + select count(*) + from imsld_gsi_service_status stat, + imsld_gsi_servicesi serv, + imsld_gsi_toolsi tools + where stat.run_id=:run_id and + serv.gsi_tool_id=tools.item_id and + stat.owner_id=serv.gsi_service_id and + stat.status!='configured'; + }] + + if {$remaining_services_p == 0} { + db_dml set_run_active { + update imsld_runs set status = 'active', + status_date = now() + where run_id=:run_id and imsld_id=:imsld_id + } + } else { + db_dml set_run_waitingservices { + update imsld_runs set status = 'waitingservices', + status_date = now() + where run_id=:run_id and imsld_id=:imsld_id + } + } + + db_dml set_run_active { + update imsld_runs set status = 'active', + status_date = now() + where run_id=:run_id + } + } + } +} + +#second, choose state +set service_status [imsld::gsi::get_service_status -run_id $run_id -gservice_id $gservice_id] +if { [string eq $service_status "not-configured"] } { + if {[db_0or1row get_request_id { + select req.gsi_request_id + from imsld_gsi_service_status stat, + imsld_gsi_service_requests req + where req.serv_status_id=stat.service_status_id and + stat.run_id=:run_id and + stat.owner_id=:gservice_id and + req.plugin_URI=:plugin_URI + }]} { + set state "checked" + } else { + set state "unchecked" + } +} elseif { [string eq $service_status "chosen"] } { + set state "chosen" +} elseif {[string eq $service_status "mapped"]} { + set state "mapped" +} elseif { [string eq $service_status "configured"] } { + set state "configured" +} else { + #you cannot be here... +} + + + +#then go to this state +switch $state { + unchecked { + set check_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id {do_check_p "t"}}] + set back_button [export_vars -base "imsld-gsi-service-search-results" {gservice_id run_id}] + } + checked { + set refresh_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id}] + set choose_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id {do_choose_p "t"}}] + set back_button [export_vars -base "imsld-gsi-service-search-results" {gservice_id run_id}] + } + chosen { + set plugin_URI [db_string get_status_plugin { + select plugin_uri + from imsld_gsi_service_status + where run_id =:run_id and + owner_id=:gservice_id + } ] + set map_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id {do_map_p "t"}}] + } + mapped { + set plugin_URI [db_string get_status_plugin { + select plugin_uri + from imsld_gsi_service_status + where run_id =:run_id and + owner_id=:gservice_id + } ] + set configure_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id {do_configure_p "t"}}] + } + configured { + set plugin_URI [db_string get_status_plugin { + select plugin_uri + from imsld_gsi_service_status + where run_id =:run_id and + owner_id=:gservice_id + } ] + + set still_waiting_p "t" + if {![db_0or1row is_still_waiting_p { + SELECT 1 as nothing + FROM imsld_attribute_instances att, + imsld_gsi_serv_instances serv + WHERE att.instance_id=serv.service_instance_id and + att.owner_id=:gservice_id and + att.run_id=:run_id and + url='' + GROUP BY nothing; + }] } { + set still_waiting_p "f" + } + } +} + + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.tcl.old =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.tcl.old,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-configure.tcl.old 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,126 @@ + ad_page_contract { + + Use a proper plugin to configure a service + @author lfuente@it.uc3m.es + @creation-date dic 2008 +} { + gservice_id + run_id + plugin_URI + gsi_request_id:optional + {do_check_p "f"} + {do_choose_p "f"} + {do_map_p "f"} + {do_configure_p "f"} +} + +set page_title "IMS LD Service configuration" +set context [list "Service configuration"] +template::head::add_css -href "/resources/imsld/imsld.css" -media "screen" -order 0 + +#first, perform action (if requested) + +if {[string eq $do_check_p "t"]} { + #FIXME: ¿en un thread a parte? + set service_response [imsld::gsi::send_check_request -gservice_id $gservice_id -plugin_URI $plugin_URI -run_id $run_id] + imsld::gsi::store_check_results -gservice_id $gservice_id -plugin_URI $plugin_URI -run_id $run_id -service_response $service_response + ns_log Notice "hecho el check" +} +if {[string eq $do_choose_p "t"]} {} +if {[string eq $do_map_p "t"]} {} +if {[string eq $do_configure_p "t"]} {} + +#second, choose state +set service_status [imsld::gsi::get_service_status -run_id $run_id -gservice_id $gservice_id] +if { [string eq $service_status "not-configured"] } { + if {[db_0or1row get_request_id { + select req.gsi_request_id + from imsld_gsi_service_status stat, + imsld_gsi_service_requests req + where req.serv_status_id=stat.service_status_id and + stat.run_id=:run_id and + stat.owner_id=:gservice_id and + req.plugin_URI=:plugin_URI + }]} { + set state "checked" + } else { + set state "void" + } +} elseif { [string eq $service_status "in-progress"] } { + set ddbb_plugin_uri [db_string get_status_plugin { + select plugin_uri + from imsld_gsi_service_status + where run_id =:run_id and + owner_id=:gservice_id + } ] + + if {[string eq $ddbb_plugin_uri ""]} { + set state "chosen" + } else { + set state "mapped" + } + +} elseif { [string eq $service_status "configured"] } { + set state "configured" +} else { + #you cannot be here... + ns_log notice "imsld-gsi-service-configure.tcl, status=not-found: you cannot be here" +} + + +#then go to this state +switch $state { + void { + ns_log Notice "estado void" + set check_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id {do_check_p "t"}}] + } + checked { + set refresh_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id}] + set choose_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id {do_choose_p "t"}}] + } + chosen {} + mapped {} + configured {} +} + +##set checked_p "f" +## +###build list of things that must be checked +## +##if { [string eq $do_check_p "t"]} { +##} +## +###FIXME: a sql query must build these values +###maybe, the request_id is not initialized (it is done in another thread) +##if { [info exists gsi_request_id] } { +## set request_response [imsld::gsi::get_request_response -request_id $gsi_request_id] +## +## set functions_response [lindex $request_response 0] +## set permissions_response [lindex $request_response 1] +## ns_log Notice "obtenidas respuestas de la bbdd" +## if {![string eq $do_map_p "t"] } { +## set choose_button [export_vars -base "imsld-gsi-service-configure" {plugin_URI gservice_id run_id {do_map_p t} {gsi_request_id $gsi_request_id}}] +## } +##} else { +## set functions_response "" +## set permissions_response "" +##} +## +##template::multirow create response_functions item +##foreach function_item $functions_response { +## template::multirow append response_functions $function_item +##} +## +##template::multirow create response_permissions item +##foreach perm_item $permissions_response { +## template::multirow append response_permissions $perm_item +##} +## +###map users +##if { [string eq $do_map_p "t"]} { +## set checked_p "t" +##} +###ask for service instances +##set users_mapped_p "f" +##set configured_p "f" +## Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-search-results.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-search-results.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-search-results.adp 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,12 @@ +<master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + +<if @connected_p@ eq "t"> + <h2 class="center">Theese are the available alternatives to configure the service</h2> + <div class="centered-table"><listtemplate name="lookup_results"></listtemplate></div> +</if> +<else> + <p>Could not connect to the services registry. It seems that it is not available at the moment.</p> + <p>Contact the administrator. (<a href="@return_addr@">Go back</a>)</p> +</else> Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-search-results.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-search-results.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-service-search-results.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,95 @@ +ad_page_contract { + + Presents the results of a registry search with the describing keywords for a given service + + @author lfuente@it.uc3m.es + @creation-date nov 2008 +} { + {gservice_id} + {run_id} +} + +set return_addr [export_vars -base imsld-gsi-serviceslist {gservice_id run_id}] + +#this is worth to be set as package parameter, but meanwhile... +set registry_address [parameter::get -parameter "GSIRegistryURL"] +set registry_port [parameter::get -parameter "GSIRegistryPort"] + +set page_title "IMS LD Service search results" +set context [list "Search results"] +template::head::add_css -href "/resources/imsld/imsld.css" -media "screen" -order 0 + + +#find service keywords: service->tool->keywords +set keywords_list [db_list find_service_keywords { + select key.value + from imsld_gsi_services serv, + imsld_gsi_toolsi tool, + imsld_gsi_keywordsi key, + acs_rels ar + where serv.gsi_tool_id=tool.item_id and + key.item_id=ar.object_id_one and + tool.item_id=ar.object_id_two and + serv.gsi_service_id=:gservice_id; +}] + +set keywords_string [join $keywords_list ","] + + +#lookup in the registry (open a socket and send a basic TCP package) +set fds [ns_sockopen -nonblock $registry_address $registry_port] +set rid [lindex $fds 0] +set wid [lindex $fds 1] +if [ns_sockcheck $wid] { + set connected_p "t" + imsld::gsi::change_service_status -gservice_id $gservice_id -run_id $run_id -status "not-configured" + + puts $wid "LOOKUP $keywords_string" + flush $wid + set results [read $rid] + close $rid + close $wid + + #present results (template::list::create) + set services_list [list] + set temp_list [split $results '\n'] + + #create the multirow + template::multirow create lookup_results_multirow name plugin description config_disp config_url + + foreach service $temp_list { + + set service_result [split $service '|'] + + set name [lindex $service_result 0] + set plugin_URI [lindex $service_result 1] + set description [lindex $service_result 2] + set config_disp "Try it" + set config_url [export_vars -base "imsld-gsi-service-configure" {gservice_id run_id plugin_URI} ] + + #add data in the multirow + template::multirow append lookup_results_multirow $name $plugin_URI $description $config_disp $config_url + } + + template::list::create \ + -name lookup_results \ + -multirow lookup_results_multirow \ + -key plugin \ + -elements { + name { + label "Service Name" + } + description { + label "Description" + } + plugin_URI { + label "" + display_col config_disp + link_url_col config_url + } + } +} else { + set connected_p "f" + imsld::gsi::change_service_status -gservice_id $gservice_id -run_id $run_id -status "not-found" +} + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-serviceslist.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-serviceslist.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-serviceslist.adp 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,7 @@ +<master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + + <h2 class="center">List of services in run</h2> + <div class="centered-table"><listtemplate name="serviceslist"></listtemplate></div> + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-serviceslist.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-serviceslist.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-serviceslist.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,71 @@ +ad_page_contract { + + Presents a list of external services to setup before running the UoL. + + @author lfuente@it.uc3m.es + @creation-date nov 2008 +} { + {run_id} +} + +set page_title "IMS LD Services in UoL" +set context [list "Services in UoL"] +template::head::add_css -href "/resources/imsld/imsld.css" -media "screen" -order 0 + +set action_disp "" +set action_url "" +set action_text "" + +template::list::create \ + -name serviceslist \ + -multirow gservices_in_run \ + -key gservice_id \ + -elements { + service_title { + label "Name" + } + tool { + label "Tool" + } + status { + label "Status" + } + action_url { + label "Action" + display_col action_disp + link_url_col action_url + link_html {title "$action_disp"} + } + } + +db_multirow -extend {action_url action_disp} gservices_in_run get_services_info { + select serv.gsi_service_id as gservice_id, + serv.title as service_title, + tools.gsi_tool_id, + tools.title as tool, + tools.description, + stat.status + from imsld_gsi_service_status stat, + imsld_gsi_servicesi serv, + imsld_gsi_toolsi tools + where stat.run_id=:run_id and + serv.gsi_tool_id=tools.item_id and + stat.owner_id=serv.gsi_service_id; +} { + if {[string eq $status "not-configured"]} { + set action_url [export_vars -base "imsld-gsi-service-search-results" {gservice_id $gservice_id run_id $run_id} ] + set action_disp "Configure" + } elseif {[string eq $status "not-found"]} { + set action_url [export_vars -base "imsld-gsi-service-search-results" {gservice_id $gservice_id run_id $run_id} ] + set action_disp "Try again" + } elseif {[string eq $status "chosen"] || [string eq $status "mapped"] } { + set action_url [export_vars -base "imsld-gsi-service-configure" {gservice_id $gservice_id run_id $run_id} ] + set action_disp "View Progress" + } elseif {[string eq $status "configured"]} { + set action_url [export_vars -base "imsld-gsi-service-configure" {gservice_id $gservice_id run_id $run_id} ] + set action_disp "View configuration" + } +} + + + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-configurated.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-configurated.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-configurated.adp 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,8 @@ +<div class="service-configurated"> +<if @still_waiting_p@ eq "f"> +<p>congratulations....</p> +</if> +<else> +<p>Wait a litte bit more, don't get nervous and refresh the page in a minute.</p> +</else> +</div> Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-configurated.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-configurated.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-configurated.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,10 @@ +##ad_page_contract { +# @author lfuente@it.uc3m.es +# @creation-date dic 2008 +#} { +# gservice_id +# run_id +# plugin_URI +#} + +ns_log notice "show-configuration..." Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-requirements.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-requirements.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-requirements.adp 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,20 @@ +<div class="check-service"> +<h2>Check service functionality</h2> +<!-- There is a list (ul-li) in the left with the requested capabilities, and a list in the rigth with the answer. CSS does the layout --> + +<div class="service-request"> +<h3>Functions</h3> +<ul> +<multiple name="requested_functions"> + <li>@requested_functions.item@</li> +</multiple> + +</ul> +<h3>Permissions</h3> +<ul> +<multiple name="requested_permissions"> + <li>@requested_permissions.item@</li> +</multiple> +</ul> +</div> + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-requirements.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-requirements.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-requirements.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,24 @@ +# ad_page_contract { +# +# @author lfuente@it.uc3m.es +# @creation-date dic 2008 +#} { +# gservice_id +#} + +#FIXME: a sql query inside a procedure must build these values +set functions [imsld::gsi::get_function_request_values -gservice_id $gservice_id] +set permissions [imsld::gsi::get_permission_request_values -gservice_id $gservice_id] + +template::multirow create requested_functions item +foreach function_item $functions { + template::multirow append requested_functions $function_item +} + +template::multirow create requested_permissions item +foreach perm_item $permissions { + template::multirow append requested_permissions $perm_item +} + + + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-response.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-response.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-response.adp 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,16 @@ +<div class="service-response"> + <h3>Response: Functions</h3> + <ul> + <multiple name="response_functions"> + <li>@response_functions.item@</li> + </multiple> + </ul> + <h3>Response: Permissions</h3> + <ul> + <multiple name="response_permissions"> + <li>@response_permissions.item@</li> + </multiple> + </ul> +</div> + + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-response.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-response.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-response.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,35 @@ +##ad_page_contract { +# @author lfuente@it.uc3m.es +# @creation-date dic 2008 +#} { +# gservice_id +# run_id +# plugin_URI +# gsi_request_id:optional +#} +if { ![info exists gsi_request_id] } { + set gsi_request_id [db_string get_request_id { + SELECT req.gsi_request_id + FROM imsld_gsi_service_requests req, + imsld_gsi_service_status stat + WHERE stat.service_status_id=req.serv_status_id and + stat.run_id=:run_id and + stat.owner_id=:gservice_id and + req.plugin_uri=:plugin_URI + }] +} +set request_response [imsld::gsi::get_request_response -request_id $gsi_request_id] + +set functions_response [lindex $request_response 0] +set permissions_response [lindex $request_response 1] + +template::multirow create response_functions item +foreach function_item $functions_response { +template::multirow append response_functions $function_item +} + +template::multirow create response_permissions item +foreach perm_item $permissions_response { +template::multirow append response_permissions $perm_item +} + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-user-mapping.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-user-mapping.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-user-mapping.adp 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,5 @@ +<div class="map-users"> + <h3>Map users</h3> + <listtemplate name="users_in_run"></listtemplate> +</div> + Index: openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-user-mapping.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-user-mapping.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/gsi/imsld-gsi-show-service-user-mapping.tcl 23 Jun 2009 17:21:19 -0000 1.1 @@ -0,0 +1,95 @@ +# ad_page_contract { +# @author lfuente@it.uc3m.es +# @creation-date dic 2008 +#} { +# gservice_id +# run_id +# plugin_URI:optional +# {mapped_p "f"} +#} +if {![info exists mapped_p]} { + set mapped_p "f" +} +if {[string eq $mapped_p "t"]} { + set mapped 0 + set to_map 1 +} else { + set mapped 1 + set to_map 0 +} + +set users_in_run [imsld::runtime::users_in_run -run_id $run_id] +template::multirow create users_in_run user_id username external_user user_form external_credentials credentials_form get_token +foreach user $users_in_run { + set username [acs_user::get_element -user_id $user -element name] + set external_user [imsld::gsi::get_external_user -user_id $user -plugin_URI $plugin_URI -run_id $run_id] + set external_credentials [imsld::gsi::get_external_credentials -user_id $user -plugin_URI $plugin_URI -run_id $run_id] +#CAUTION!! building HTML code inside tcl files!! It brokes some design rules, but is the only way to include a form as column in a template::list +####### + set user_form "<form name=\"ext_user_form\" action=\"imsld-gsi-mapuser\" method=\"get\">\n + <input type=\"text\" name=\"external_user\" value=\"$external_user\">\n + <input type=\"hidden\" name=\"user_id\" value=\"$user\">\n + <input type=\"hidden\" name=\"run_id\" value=\"$run_id\">\n + <input type=\"hidden\" name=\"plugin_URI\" value=\"$plugin_URI\">\n + <input type=\"hidden\" name=\"return_url\" value=\"imsld-gsi-service-configure?run_id=$run_id&gservice_id=$gservice_id\">\n + <input type=\"submit\" value=\"OK\">\n + </form>" + set credentials_form "<form name=\"ext_credentials_form\" action=\"imsld-gsi-mapuser\" method=\"get\">\n + <input type=\"password\" name=\"external_credentials\" value=\"$external_credentials\">\n + <input type=\"hidden\" name=\"user_id\" value=\"$user\">\n + <input type=\"hidden\" name=\"run_id\" value=\"$run_id\">\n + <input type=\"hidden\" name=\"plugin_URI\" value=\"$plugin_URI\">\n + <input type=\"hidden\" name=\"return_url\" value=\"imsld-gsi-service-configure?run_id=$run_id&gservice_id=$gservice_id\">\n + <input type=\"submit\" value=\"OK\">\n + </form>" + +set package_id [ad_conn package_id] +set package_mount_point [apm_package_url_from_id $package_id] + +ns_log Notice "user: $user" +set next_params "%3Frun_id%3D$run_id%26user_id%3D$user%26gservice_id%3D$gservice_id%26plugin_URI%3D$plugin_URI" +set next_value "[util_current_location]/$package_mount_point/admin/gsi/imsld-gsi-handle-token$next_params" +set token_url "https://www.google.com/accounts/AuthSubRequest?scope=http://docs.google.com/feeds/ http://spreadsheets.google.com/feeds/&session=1&secure=0&next=$next_value" +set get_token_url "<a href=\"$token_url\">Try this user</a>" +####### +####### + + template::multirow append users_in_run $user $username $external_user $user_form $external_credentials $credentials_form $token_url +ns_log Notice "get_token_url: $get_token_url" +} + +template::list::create \ + -name users_in_run \ + -multirow users_in_run \ + -key user_id \ + -elements { + username { + label "Username" + } + external_user { + label "Username in service" + hide_p $mapped + } + user_form { + label "Username in service" + display_template $user_form + hide_p $to_map + } + external_credentials { + label "Credentials in service" + hide_p $mapped + } + credentials_form { + label "Credentials in service" + display_template $credentials_form + hide_p $to_map + } + get_token { + label "Auto-fill" + link_url_col get_token + display_template "Try this user" + hide_p $to_map + } + } + +