Project

General

Profile

« Previous | Next » 

Revision 8955

Added by Jing Tao about 10 years ago

Fixed issues for login and logout on Saeon skin:
https://projects.ecoinformatics.org/ecoinfo/issues/6613'

M saeon/SaeonLogin.jspx

View differences:

lib/style/skins/saeon/SaeonLogin.jspx
19 19
<html xmlns="http://www.w3.org/1999/xhtml">
20 20
<head>
21 21

  
22
    <jsp:element name="servletURL">
23
        <jsp:attribute name="value">
24
            <jsp:expression>SERVLET_URL</jsp:expression>
25
        </jsp:attribute>
26
        <jsp:text />
27
    </jsp:element>
28
    
29
     <jsp:element name="script">
30
        <jsp:attribute name="language">JavaScript</jsp:attribute>
31
        <jsp:attribute name="src">
32
         <jsp:expression>STYLE_COMMON_URL + "/prototype-1.5.1.1/prototype.js"</jsp:expression>
33
        </jsp:attribute>
34
        <jsp:text />
35
    </jsp:element>
36
  
37
    <jsp:element name="script">
38
        <jsp:attribute name="language">JavaScript</jsp:attribute>
39
        <jsp:attribute name="src">
40
          <jsp:expression>STYLE_COMMON_URL+ "/ajax-utils.js"</jsp:expression>
41
        </jsp:attribute>
42
        <jsp:text />
43
      </jsp:element>
44
  
45
  <jsp:element name="script">
46
        <jsp:attribute name="language">JavaScript</jsp:attribute>
47
       <jsp:attribute name="src">
48
          <jsp:expression>STYLE_SKINS_URL + "/sanparks/sanparksLogin.js"</jsp:expression>
49
        </jsp:attribute>
50
        <jsp:text />
51
   </jsp:element>
52
     
22 53
	<jsp:element name="script">
23 54
		<jsp:attribute name="language">JavaScript</jsp:attribute>
24 55
		<jsp:attribute name="src">
25 56
			<jsp:expression>CONTEXT_URL + "/style/skins/saeon/searchPathQuery.js"</jsp:expression>
26 57
		</jsp:attribute>
58
		<jsp:text />
27 59
	</jsp:element>
28 60
	<script type="text/javascript" language="JavaScript">
29 61
		function trim(stringToTrim) {
......
56 88
		    
57 89
			return(result);
58 90
		}
91
		
92
		function submitLogoutFormIntoDiv(servletUrl, formObj, divId) {
93
                var formParas = Form.serialize(formObj);
94
                submitFormParasIntoDivAndReload(servletUrl, formParas, divId);
95

  
96
        }
97
		
98
		// Wait for the page to load first
99
        window.onload = function() {
100
          
101
          var urlElement = document.getElementsByTagName("servletURL")[0];
102
          var servlet_url = urlElement.getAttribute("value");
103
          
104
          //Get a reference to the link on the page
105
          // with an id of "logout"
106
          var a = document.getElementById("logout");
107

  
108
          //Set code to run when the link is clicked
109
          // by assigning a function to "onclick"
110
          a.onclick = function(e) {
111
          e.preventDefault();
112
          var myform=document.createElement("form");
113
          var elementQformat = document.createElement("INPUT");
114
          elementQformat.setAttribute("type", "hidden");
115
          elementQformat.setAttribute("name", "qformat");
116
          elementQformat.setAttribute("value", "saeon");
117
          myform.appendChild(elementQformat);
118
          var elementAction = document.createElement("INPUT");
119
          elementAction.setAttribute("type", "hidden");
120
          elementAction.setAttribute("name", "action");
121
          elementAction.setAttribute("value", "logout");
122
          myform.appendChild(elementAction);
123
          submitLogoutFormIntoDiv(servlet_url, myform, 'loginSection'); 
124

  
125
           //If you don't want the link to actually 
126
           // redirect the browser to another page,
127
           // "google.com" in our example here, then
128
           // return false at the end of this block.
129
           // Note that this also prevents event bubbling,
130
           // which is probably what we want here, but won't 
131
           // always be the case.
132
            return false;
133
          }
134
        }
135
        
136
        
137
		
59 138
	</script>
139
	
60 140

  
61 141
	<title>SAEON - South African Environmental Observation Network Repository</title>
62 142
	<jsp:element name="link">
......
215 295
	</jsp:element>
216 296
	
217 297
	</td>
298
	
218 299
	<td width="250px">
300
	<div id="loginSection">
219 301
	
220 302
	<!-- Login section -->
221 303
	<jsp:scriptlet>
......
227 309
			Log in
228 310
		</dt>
229 311
		<dd class="portletItem odd">
230
			<form name="loginForm" method="post" action="./"
231
				onsubmit="return allowSubmit(this);">
312
			<jsp:element name="form">
313
			    <jsp:attribute name="name">loginForm</jsp:attribute>
314
                <jsp:attribute name="id">loginForm</jsp:attribute>
315
                <jsp:attribute name="method">post</jsp:attribute>
316
                <jsp:attribute name="onsubmit">
317
                    <jsp:expression>"submitLoginFormIntoDivAndReload('"+SERVLET_URL +"', this, 'loginSection');return false;"</jsp:expression>
318
                </jsp:attribute>
319

  
320
                        
232 321
				<input name="qformat" type="hidden" value="saeon" />
322
				<input name="action" type="hidden" value="login"/>
233 323
				<table>
234 324
					<tr valign="top">
235 325
						<td>
236 326
							<span class="required">User name</span>	
237 327
						</td>
238 328
						<td>
239
							<input name="username" type="text" value=""
329
							<input name="shortusername" type="text" value=""
240 330
							style="width: 140" />
241 331
						</td>
332
						<td>
333
						   <input name="username" type="hidden" value="" />
334
						</td>
335
						
242 336
					</tr>
243 337
					<tr>
244 338
						<td><span class="required">Organization</span></td>
......
257 351
					<tr>
258 352
						<td></td>
259 353
						<td colspan="1" align="right">
260
							<input name="action"
261
							value="Login" type="submit" class="button_login" />
354
							<input name="loginSubmit"
355
							value="login" type="submit" class="button_login" />
262 356
						</td>
263 357
					</tr>
264 358
				</table>
265
			</form>
359
			</jsp:element>
266 360
		</dd>
267 361

  
268 362
		<dd class="portletItem even">
......
319 413
			</table>
320 414
		</dd>
321 415
		<dd class="portletItem even">
322
			<jsp:element name="a">
323
				<jsp:attribute name="target">_top</jsp:attribute>
324
				<jsp:attribute name="href">
325
					<jsp:expression>CONTEXT_URL + "/style/skins/saeon/index.jsp?action=Logout&amp;qformat=saeon"</jsp:expression>
326
				</jsp:attribute>
327
				<jsp:element name="img">
328
					<jsp:attribute name="src">
329
						<jsp:expression>CONTEXT_URL + "/style/skins/saeon/images/user.gif"</jsp:expression>
330
					</jsp:attribute>
331
					<jsp:attribute name="alt">logout</jsp:attribute>
332
					<jsp:attribute name="title">User</jsp:attribute>
333
					<jsp:attribute name="height">16</jsp:attribute>
334
					<jsp:attribute name="width">16</jsp:attribute>
335
				</jsp:element>	
336
				logout
337
			</jsp:element>
416
		   <jsp:element name="a">
417
                    <jsp:attribute name="target">_top</jsp:attribute>
418
                    <jsp:attribute name="id">
419
                        <jsp:expression>"logout"</jsp:expression>
420
                    </jsp:attribute>
421
                    <jsp:attribute name="href">
422
                        <!--<jsp:expression>SERVLET_URL + "?action=logout&amp;qformat=saeon"</jsp:expression> -->
423
                        <jsp:expression>CONTEXT_URL + "/style/skins/saeon"</jsp:expression>
424
                    </jsp:attribute>
425
                    <jsp:element name="img">
426
                        <jsp:attribute name="src">
427
                            <jsp:expression>CONTEXT_URL + "/style/skins/saeon/images/user.gif"</jsp:expression>
428
                        </jsp:attribute>
429
                        <jsp:attribute name="alt">logout</jsp:attribute>
430
                        <jsp:attribute name="title">User</jsp:attribute>
431
                        <jsp:attribute name="height">16</jsp:attribute>
432
                        <jsp:attribute name="width">16</jsp:attribute>
433
                    </jsp:element>  
434
                    logout
435
                 </jsp:element>
436
			
338 437
		</dd>
339 438
		<dd class="portletItem">
340 439
			<jsp:element name="a">
......
413 512
		
414 513
		</dd>
415 514
	</dl>	
416
	
515
	</div>
417 516
	</td>
418 517
	
419 518
	<!-- so the map frame doesn't overlap content -->

Also available in: Unified diff