Project

General

Profile

« Previous | Next » 

Revision 7874

remove custom classes from login form, simplify template, move js functions to separate file. prep for UI-refresh. https://projects.ecoinformatics.org/ecoinfo/issues/5951

View differences:

lib/style/common/templates/metacatui/login.js
1
function submitform(formObj) {
2

  
3
	if (trim(formObj.elements["loginAction"].value) != "Login")
4
		return true;
5
	// trim username & passwd:
6
	var username = trim(formObj.elements["uid"].value);
7
	var organization = trim(formObj.elements["organization"].value);
8
	var password = trim(formObj.elements["password"].value);
9

  
10
	if (username == "") {
11
		alert("You must type a username. \n" + popupMsg);
12
		formObj.elements["uid"].focus();
13
		return false;
14
	}
15

  
16
	if (organization == "") {
17
		alert("You must select an organization. \n" + popupMsg);
18
		formObj.elements["organization"].focus();
19
		return false;
20
	}
21

  
22
	if (password == "") {
23
		alert("You must type a password. \n" + popupMsg);
24
		formObj.elements["password"].focus();
25
		return false;
26
	}
27

  
28
	formObj.username.value = "uid=" + formObj.elements["uid"].value + ",o="
29
			+ formObj.elements["organization"].value
30
			+ ",dc=ecoinformatics,dc=org";
31
	return true;
32
}
33

  
34
function trim(stringToTrim) {
35
	return stringToTrim.replace(/^\s*/, '').replace(/\s*$/, '');
36
}
0 37

  
lib/style/common/templates/metacatui/loginForm.tmpl
1
[% IF cfg == 'nceas' %]
2
  [% INCLUDE "nceasHeader.tmpl" %]
3
[% ELSIF cfg == 'parc' %]
4
  [% INCLUDE "parcHeader.tmpl" %]
5
[% ELSE %]
6
  [% INCLUDE "genericHeader.tmpl" %]
1
[% INCLUDE "genericHeader.tmpl" %]
2
[% IF message != '' %]
3
	<p>[% message %]</p>
4
	<br />
5
	Dont have an account yet? <a href="[% cgiPrefix %]/ldapweb.cgi?cfg=[%cfg%]">Create a new account</a>
6
	<br />
7
	Forgot your password? <a href="[% cgiPrefix %]/ldapweb.cgi?cfg=[%cfg%]&amp;stage=resetpass">Reset your password</a>
8
	<br />
7 9
[% END %]
8
      <script language="JavaScript">
9
function submitform(formObj) {
10

  
11
  if (trim(formObj.elements["loginAction"].value)!="Login") return true;
12
  //trim username & passwd:
13
  var username = trim(formObj.elements["uid"].value);
14
  var organization  = trim(formObj.elements["organization"].value);
15
  var password      = trim(formObj.elements["password"].value);
16

  
17
  if (username=="") {
18
    alert("You must type a username. \n"+popupMsg);
19
        formObj.elements["uid"].focus();
20
    return false;
21
  }
22

  
23
  if (organization=="") {
24
    alert("You must select an organization. \n"+popupMsg);
25
        formObj.elements["organization"].focus();
26
    return false;
27
  }
28

  
29
  if (password=="") {
30
    alert("You must type a password. \n"+popupMsg);
31
        formObj.elements["password"].focus();
32
    return false;
33
  }
34

  
35
  formObj.username.value="uid="+formObj.elements["uid"].value+",o="+formObj.elements["organization"].value+",dc=ecoinformatics,dc=org";
36
  return true;
37
}
38

  
39
function trim(stringToTrim) {
40
  return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,'');
41
}
42
      </script>
43
  <br />
44
      [% IF message != '' %]
45
			<p class="redbold">[% message %]</p>
46
			</br>
47
		[%IF showInstructions %]
48
	  	[%IF cfg =='esa' %]
49
				<p><strong>Steps for registering an ESA data set</strong></p>
50
          
51
        
52
				<p><span class="greenbold">Step 1: Create an Account</span> <br>
53
		   			Create an account by registering with the <a href="[% cgiPrefix %]/ldapweb.cgi?cfg=[%cfg%]">KNB</a>.
54

  
55
					Many scientists will already have accounts in the KNB, especially those 
56
					from institutions like NCEAS and LTER. If you already have an account 
57
					please use that existing account rather than creating a new one.</p>
58
				<p><span class="greenbold">Step 2: Login</span><br />
59
		   			Login to the ESA Registry website with the account you created.</p>
60
				<p><span class="greenbold">Step 3: Register Data</span><br />
61
					Fill out the <a href="http://data.esa.org/esa/cgi-bin/register-dataset.cgi?cfg=esa">ESA Data Registry Form</a>
62
					A page titled "Success" will appear when the form has been successfully submitted.             </p>
63
				<p> <span class="greenbold">Step 4: Look for Feedback</span> <br />
64
					After you submit, watch for e-mail sent by the ESA moderator regarding whether your data set has been accepted.</p>
65
				<br /><br />
66
		[% END %]
67
		[% END %]
68
	  
69
      [% END %]
70
  <menu>
10
	
11
<script language="JavaScript" type="text/javascript" src="[% styleCommonPath %]/templates/metacatui/login.js"></script>
12
  
71 13
<form method="post" action="[% cgiPrefix %]/register-dataset.cgi" onsubmit="return submitform(this);" >
72
    <input type="hidden" name="stage" value="login"> 
73
    <input type="hidden" name="username" value=""> 
74
    <input type="hidden" name="cfg" value="[%cfg%]"> 
14
	<input type="hidden" name="stage" value="login"> 
15
	<input type="hidden" name="username" value=""> 
16
	<input type="hidden" name="cfg" value="[%cfg%]"> 
75 17

  
76
    <table>
18
	<table>
19
		<tr>
20
	        <td>Username:</td>
21
	        <td>
22
				<input name="uid" type="text" value="">
23
			</td>
24
		</tr>
77 25

  
78
      <tr valign="middle">
79
        <td align="left" valign="middle" class="text_plain">
80
        Username:</td>
26
		<tr>
27
			<td>Organization:</td>
28
	        <td>
29
		        <select name="organization">
30
		          <option value=""    selected>&#8212; choose one &#8212;</option>
31
		          <option value="NCEAS"       >NCEAS</option>
32
		          <option value="LTER"        >LTER</option>
33
		          <option value="KU"          >KU</option>
34
		          <option value="OBFS"        >OBFS</option>
35
		          <option value="OSUSB"       >OSUSB</option>
36
		          <option value="PARC"        >PARC</option>
37
		          <option value="PISCO"       >PISCO</option>
38
		          <option value="SAEON"       >SAEON</option>
39
		          <option value="SANParks"    >SANParks</option>
40
		          <option value="SDSC"        >SDSC</option>
41
		          <option value="UCNRS"       >UCNRS</option>
42
		          <option value="unaffiliated">unaffiliated</option>
43
		        </select>
44
	        </td>
45
		</tr>
81 46

  
82
        <td width="173" align="left" class="text_plain" style=
83
        "padding-top: 2px; padding-bottom: 2px;"><input name="uid"
84
        type="text" style="width: 140px;" value=""></td>
85
      </tr>
47
		<tr>
48
	        <td>Password:</td>
49
	        <td>
50
	        	<input name="password" type="password" maxlength="50" value="">
51
	        </td>
52
		</tr>
53
      
54
		<tr>
55
			<td>&nbsp;</td>
56
	      	<td>
57
				<input type="submit" name="loginAction" value="Login">
58
			</td>
59
		</tr>
60
	</table>
61
</form>
86 62

  
87
      <tr valign="middle">
88
        <td height="28" align="left" valign="middle" class=
89
        "text_plain">Organization:</td>
90

  
91
        <td align="left" class="text_plain" style=
92
        "padding-top: 2px; padding-bottom: 2px;"><select name=
93
        "organization" style="width:140px;">
94
          <option value=""    selected>&#8212; choose one &#8212;</option>
95
          <option value="NCEAS"       >NCEAS</option>
96
          <option value="LTER"        >LTER</option>
97
          <option value="KU"          >KU</option>
98
          <option value="OBFS"        >OBFS</option>
99
          <option value="OSUSB"       >OSUSB</option>
100
          <option value="PARC"        >PARC</option>
101
          <option value="PISCO"       >PISCO</option>
102
          <option value="SAEON"       >SAEON</option>
103
          <option value="SANParks"    >SANParks</option>
104
          <option value="SDSC"        >SDSC</option>
105
          <option value="UCNRS"       >UCNRS</option>
106
          <option value="unaffiliated">unaffiliated</option>
107
        </select></td>
108
      </tr>
109

  
110
      <tr valign="middle">
111
        <td width="85" align="left" valign="middle" class=
112
        "text_plain">Password:</td>
113

  
114
        <td colspan="2" align="left" class="text_plain" style=
115
        "padding-top: 2px; padding-bottom: 2px;">
116
          <table width="100%" border="0" cellpadding="0"
117
          cellspacing="0">
118
            <tr>
119
              <td width="150" align="left"><input name="password"
120
              type="password" maxlength="50" style="width:140px;"
121
              value=""></td>
122

  
123
              <td align="center" class="buttonBG_login">
124
              <input type="submit" name="loginAction" value="Login"
125
              class="button_login"></td>
126

  
127
              <td align="left">&nbsp;</td>
128
            </tr>
129
          </table>
130
        </td>
131
      </tr>
132
    </table>
133
  </form>
134
  </menu>
135
  
136
  Dont have an account yet? <a href="[% cgiPrefix %]/ldapweb.cgi?cfg=[%cfg%]">Create a new account</a>
137
  <br />
138
  Forgot your password? <a href="[% cgiPrefix %]/ldapweb.cgi?cfg=[%cfg%]&amp;stage=resetpass">Reset your password</a>
139

  
140
[% IF cfg == 'nceas' %]
141
  [% INCLUDE "nceasFooter.tmpl" %]
142
[% ELSIF cfg == 'parc' %]
143
  [% INCLUDE "parcFooter.tmpl" %]
144
[% ELSE %]
145
  [% INCLUDE "genericFooter.tmpl" %]
146
[% END %]  
63
[% INCLUDE "genericFooter.tmpl" %]

Also available in: Unified diff