Project

General

Profile

1
 /*
2
  *   '$RCSfile$'
3
  *     Purpose: Default style sheet for SANPark project login pages 
4
  *              Using this stylesheet rather than placing styles directly in 
5
  *              the KNP web documents allows us to globally change the 
6
  *              formatting styles of the entire site in one easy place.
7
  *   Copyright: 2009 Regents of the University of California and the
8
  *               National Center for Ecological Analysis and Synthesis
9
  *     Authors: Matt Jones
10
  *
11
  *    '$Author: daigle $'
12
  *      '$Date: 2009-09-04 15:12:17 -0700 (Fri, 04 Sep 2009) $'
13
  *  '$Revision: 5057 $'
14
  *
15
  * This program is free software; you can redistribute it and/or modify
16
  * it under the terms of the GNU General Public License as published by
17
  * the Free Software Foundation; either version 2 of the License, or
18
  * (at your option) any later version.
19
  *
20
  * This program is distributed in the hope that it will be useful,
21
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
  * GNU General Public License for more details.
24
  *
25
  * You should have received a copy of the GNU General Public License
26
  * along with this program; if not, write to the Free Software
27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
  */
29

    
30
function submitLoginFormIntoDiv(servletUrl, formObj, divId) {
31

    
32
	//var formObj = document.getElementById(formId);
33
	var shortUserName = formObj.shortusername.value;
34
	//alert("starting userName: " + shortUserName);
35
	var organization = formObj.organization.value;
36
	//alert("organization: " + organization);
37
	formObj.username.value = createLdapString(shortUserName, organization);
38
	var formParas = Form.serialize(formObj);
39
	//alert("ending userName: " + formObj.username.value);
40
	var loggingInContent = "<table><tr><td width='600px' align='center'><p>logging in</p></td></tr></table>"
41
	document.getElementById(divId).innerHTML = loggingInContent;
42
	
43
	submitFormParasIntoDiv(servletUrl, formParas, divId);
44

    
45
}
46

    
47
function submitLoginFormIntoDivAndReload(servletUrl, formObj, divId) {
48

    
49
	//var formObj = document.getElementById(formId);
50
	var shortUserName = formObj.shortusername.value;
51
	//alert("starting userName: " + shortUserName);
52
	var organization = formObj.organization.value;
53
	//alert("organization: " + organization);
54
	formObj.username.value = createLdapString(shortUserName, organization);
55
	var formParas = Form.serialize(formObj);
56
	//alert("ending userName: " + formObj.username.value);
57
	var loggingInContent = "<table><tr><td width='600px' align='center'><p>logging in</p></td></tr></table>"
58
	document.getElementById(divId).innerHTML = loggingInContent;
59
	
60
	submitFormParasIntoDivAndReload(servletUrl, formParas, divId);
61

    
62
}
63

    
64
function submitLogoutFormIntoDiv(servletUrl, formObj, divId) {
65
	var formParas = Form.serialize(formObj);
66
	var loggingOutContent = "<table><tr><td width='600px' align='center'><p>logging out</p></td></tr></table>"
67
	document.getElementById(divId).innerHTML = loggingOutContent;
68
	
69
	submitFormParasIntoDiv(servletUrl, formParas, divId);
70

    
71
}
72

    
73
function createLdapString(userName, organization) {
74
    var ldapTemplate = "uid=%1s,o=%2s,dc=ecoinformatics,dc=org";
75
    var tmp = ldapTemplate.replace("%1s", userName);
76
    var ldapUserName = tmp.replace("%2s", organization);
77
 
78
 	return ldapUserName;
79
}
80

    
(21-21/36)