1<%-- $HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/apps/igeoportal-standard/branches/2.5_testing/loadcontext.jsp $ --%> 2<%-- $Id: loadcontext.jsp 25889 2010-08-16 05:43:37Z jwilden $ --%> 3<%-- 4 This file is part of deegree, http://deegree.org/ 5 Copyright (C) 2001-2009 by: 6 - Department of Geography, University of Bonn - 7 and 8 - lat/lon GmbH - 9 10 This library is free software; you can redistribute it and/or modify it under 11 the terms of the GNU Lesser General Public License as published by the Free 12 Software Foundation; either version 2.1 of the License, or (at your option) 13 any later version. 14 This library is distributed in the hope that it will be useful, but WITHOUT 15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 17 details. 18 You should have received a copy of the GNU Lesser General Public License 19 along with this library; if not, write to the Free Software Foundation, Inc., 20 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 Contact information: 23 24 lat/lon GmbH 25 Aennchenstr. 19, 53177 Bonn 26 Germany 27 http://lat-lon.de/ 28 29 Department of Geography, University of Bonn 30 Prof. Dr. Klaus Greve 31 Postfach 1147, 53001 Bonn 32 Germany 33 http://www.geographie.uni-bonn.de/deegree/ 34 35 e-mail: info@deegree.org 36--%> 37<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 38<%@ page import="java.util.List"%> 39<%@ page import="java.util.Iterator"%> 40<%@ page import="org.deegree.i18n.Messages" %> 41<%@ page import="java.util.Locale" %> 42<% 43 Locale loc = request.getLocale(); 44%> 45<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 46<html> 47 <head> 48 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 49 <meta name="author" content="lat/lon GmbH" /> 50 <meta name="KeyWords" content="deegree iGeoPortal lat/lon" /> 51 <title>deegree iGeoPortal</title> 52 <link href="./css/deegree.css" rel="stylesheet" type="text/css" /> 53 <script language="JavaScript1.2" type="text/javascript"> 54 <!-- 55<% 56 List contextList = (List)request.getAttribute( "CONTEXT_LIST" ); 57 String user = (String)request.getAttribute( "USER" ); 58 String startContext = (String)request.getAttribute( "STARTCONTEXT" ); 59%> 60 function switchContext() { 61 var sel = document.getElementById('selid'); 62 if ( sel.selectedIndex != 0 ) { 63 var req = "control?rpc=<?xml version='1.0' encoding='UTF-8'?><methodCall>" + 64 "<methodName>mapClient:contextSwitch</methodName><params><param><value><struct>" + 65 "<member><name>mapContext</name><value><string>" + encodeURIComponent(sel.value) + "</string></value></member>" + 66 "</struct></value></param></params></methodCall>"; 67 opener.parent.window.location.replace(req); 68 window.close(); 69 } 70 } 71 72 function deleteContext() { 73 var sel = document.getElementById('selid'); 74 var startpos_contextname = sel.value.lastIndexOf('/') + 1; 75 var contextname = sel.value.substring(startpos_contextname, sel.value.length) 76 77 // only registered and logged in users are alowed to delet their own contexts 78 if ( opener.parent.controller.vSessionKeeper == null || 79 ( opener.parent.controller.vSessionKeeper != null && opener.parent.controller.vSessionKeeper.id == null ) ) { 80 alert( '<%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_MSG_LOGIN" ) %>' ); 81 return; 82 } 83 84 if ( sel.selectedIndex != 0 ) { 85 var userStartContext = "<%=startContext %>"; 86 var sessionID = opener.parent.controller.vSessionKeeper.id; 87 if ( contextname == userStartContext ) { 88 alert( '<%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_MSG_NO_DEL1") %> ' + contextname + ' <%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_MSG_NO_DEL2") %>' ); 89 return; 90 } 91 if ( !window.confirm( '<%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_MGS_CNFRM1" ) %> ' + contextname + '<%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_MGS_CNFRM2" ) %> ' ) ) { 92 return; 93 } 94 var req= "control?rpc=<?xml version='1.0' encoding='ISO-8859-1'?><methodCall>" + 95 "<methodName>mapClient:deleteContext</methodName><params><param><value><struct>"+ 96 "<member><name>mapContext</name><value><string>" + sel.value + "</string></value></member>" + 97 "<member><name>sessionID</name><value><string>" + sessionID + "</string></value></member>" + 98 "</struct></value></param></params></methodCall>"; 99 window.location.replace( req ); 100 } else { 101 alert( '<%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_MSG_SELECTWMC" ) %>' ); 102 } 103 } 104 // --> 105 </script> 106 </head> 107 <body class="pLoadContext"> 108 <!-- HEADER AREA --> 109 <table> 110 <tbody> 111 <tr> 112 <td colspan="2"> </td> 113 </tr> 114 <tr> 115 <td width="30"> </td> 116 <td class="header"><%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_HEADER" ) %></td> 117 </tr> 118 </tbody> 119 </table> 120 <form action="javascript:switchContext();"> 121 <!-- TEXT AREA --> 122 <table> 123 <tbody> 124 <tr> 125 <td colspan="3"> </td> 126 </tr> 127 <tr> 128 <td width="30"> </td> 129 <td class="text"><%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_TXT" ) %></td> 130 <td width="30"> </td> 131 </tr> 132 <tr> 133 <td colspan="3"> </td> 134 </tr> 135 <tr> 136 <td width="30"> </td> 137 <td> 138 <select id="selid"> 139 <option value="dummy"><%=Messages.get( loc, "IGEO_STD_CNTXT_LOAD_SELECT" ) %></option> 140<% 141 String path2Dir = "users/" + user + "/"; 142 for ( Iterator iter = contextList.iterator(); iter.hasNext(); ) { 143 String s = (String) iter.next(); 144 String name = s; 145 if ( s.lastIndexOf( "." ) > 0 ) { 146 name = s.substring( 0, s.lastIndexOf( "." ) ); 147 } 148 //out.println("<option value=\""+ path2Dir + s +"\">"+ s +"</option>" ); 149 out.println("<option value=\""+ path2Dir + s +"\">"+ name +"</option>" ); 150 } 151%> 152 </select> 153 </td> 154 <td width="30"> </td> 155 </tr> 156 </tbody> 157 </table> 158 <!-- BUTTON AREA --> 159 <br /><br /> 160 <a href="javascript:switchContext()" class="buttonArea1" title="<%=Messages.get( loc, "IGEO_STD_BTN_LOAD_TT" ) %>"><%=Messages.get( loc, "IGEO_STD_BTN_LOAD" ) %></a> 161 <a href="javascript:deleteContext()" class="buttonArea2" title="<%=Messages.get( loc, "IGEO_STD_BTN_DELETE_CNTXT_TT" ) %>"><%=Messages.get( loc, "IGEO_STD_BTN_DELETE_CNTXT" ) %></a> 162 <a href="javascript:window.close()" class="buttonArea3" title="<%=Messages.get( loc, "IGEO_STD_BTN_CANCEL_TT" ) %>"><%=Messages.get( loc, "IGEO_STD_BTN_CANCEL" ) %></a> 163 </form> 164 </body> 165</html> 166