You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2010/04/07 17:26:08 UTC

svn commit: r931588 - in /incubator/vcl/trunk/web/.ht-inc: help.php privileges.php requests.php userpreferences.php utils.php

Author: jfthomps
Date: Wed Apr  7 15:26:08 2010
New Revision: 931588

URL: http://svn.apache.org/viewvc?rev=931588&view=rev
Log:
VCL-139

help.php:
-modified printHelpForm to only fill in the name of the user if name fields are defined and to handle magic_quotes being on
-modified submitHelpform to handle magic_quotes being on and to allow name to be empty

requests.php: removed adminEditRequest, confirmAdminEditRequest, and submitAdminEditRequest - these have been commented out for a long time and were referencing user's names. If the functionality was ever needed again, it would probably be implemented very differently; so, it was safe to dump these.

userpreferences.php: modified userpreferences() to only show the Personal section if apprioprate fields (names, email, local affiliation password) are set for the user

privileges.php: modified userLookup to only print name and email info if defined for the user

utils.php: modified main to only print the Hello message if names are defined for the user

Modified:
    incubator/vcl/trunk/web/.ht-inc/help.php
    incubator/vcl/trunk/web/.ht-inc/privileges.php
    incubator/vcl/trunk/web/.ht-inc/requests.php
    incubator/vcl/trunk/web/.ht-inc/userpreferences.php
    incubator/vcl/trunk/web/.ht-inc/utils.php

Modified: incubator/vcl/trunk/web/.ht-inc/help.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/help.php?rev=931588&r1=931587&r2=931588&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/help.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/help.php Wed Apr  7 15:26:08 2010
@@ -43,9 +43,20 @@ function printHelpForm() {
 		$email = processInputVar("email", ARG_STRING);
 		$summary = processInputVar("summary", ARG_STRING);
 		$text = processInputVar("comments", ARG_STRING);
+		if(get_magic_quotes_gpc()) {
+			$name = stripslashes($name);
+			$name = preg_replace(array('/"/', '/>/'), array('"', '>'), $name);
+			$summary = stripslashes($summary);
+			$summary = preg_replace(array('/"/', '/>/'), array('"', '>'), $summary);
+			$text = stripslashes($text);
+		}
 	}
 	else {
-		$name = $user["firstname"] . " " . $user["lastname"];
+		$name = '';
+		if(! empty($user['lastname']) && ! empty($user['preferredname']))
+			$name = "{$user["preferredname"]} {$user['lastname']}";
+		elseif(! empty($user['lastname']) && ! empty($user['preferredname']))
+			$name = "{$user["firstname"]} {$user['lastname']}";
 		$email = $user["email"];
 		$summary = "";
 		$text = "";
@@ -114,9 +125,12 @@ function submitHelpForm() {
 	$summary = processInputVar("summary", ARG_STRING);
 	$text = processInputVar("comments", ARG_STRING);
 
-	if(! ereg('^([A-Za-z]{1,}( )([A-Za-z]){2,})$', $name)) {
+	$testname = $name;
+	if(get_magic_quotes_gpc())
+		$testname = stripslashes($name);
+	if(! ereg('^([-A-Za-z \']{1,} [-A-Za-z \']{2,})*$', $testname)) {
 		$submitErr |= NAMEERR;
-		$submitErrMsg[NAMEERR] = "You must submit your first and last name";
+		$submitErrMsg[NAMEERR] = "Name can only contain letters, spaces, apostrophes ('), and dashes (-)";
 	}
 	if(! eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$',
 	   $email)) {
@@ -158,7 +172,7 @@ function submitHelpForm() {
 		$text = stripslashes($text);
 	$message = "Problem report submitted from VCL web form:\n\n"
 	         . "User: " . $user["unityid"] . "\n"
-	         . "Name: " . $name . "\n"
+	         . "Name: " . $testname . "\n"
 	         . "Email: " . $email . "\n"
 	         . "Problem description:\n\n$text\n\n";
 	$end = time();
@@ -190,6 +204,8 @@ function submitHelpForm() {
 	if(! $indrupal)
 		print "<H2>VCL Help</H2>\n";
 	$mailParams = "-f" . ENVELOPESENDER;
+	if(get_magic_quotes_gpc())
+		$summary = stripslashes($summary);
 	if(! mail(HELPEMAIL, "$summary", $message,
 	   "From: $from\r\nReply-To: $email\r\n", $mailParams)){
 		print "The Server was unable to send mail at this time. Please e-mail ";

Modified: incubator/vcl/trunk/web/.ht-inc/privileges.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/privileges.php?rev=931588&r1=931587&r2=931588&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/privileges.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/privileges.php Wed Apr  7 15:26:08 2010
@@ -1117,22 +1117,30 @@ function userLookup() {
 			return;
 		}
 		print "<TABLE>\n";
-		print "  <TR>\n";
-		print "    <TH align=right>First Name:</TH>\n";
-		print "    <TD>{$userdata["firstname"]}</TD>\n";
-		print "  </TR>\n";
-		print "  <TR>\n";
-		print "    <TH align=right>Last Name:</TH>\n";
-		print "    <TD>{$userdata["lastname"]}</TD>\n";
-		print "  </TR>\n";
-		print "  <TR>\n";
-		print "    <TH align=right>Preferred Name:</TH>\n";
-		print "    <TD>{$userdata["preferredname"]}</TD>\n";
-		print "  </TR>\n";
-		print "  <TR>\n";
-		print "    <TH align=right>Email:</TH>\n";
-		print "    <TD>{$userdata["email"]}</TD>\n";
-		print "  </TR>\n";
+		if(! empty($userdata['firstname'])) {
+			print "  <TR>\n";
+			print "    <TH align=right>First Name:</TH>\n";
+			print "    <TD>{$userdata["firstname"]}</TD>\n";
+			print "  </TR>\n";
+		}
+		if(! empty($userdata['lastname'])) {
+			print "  <TR>\n";
+			print "    <TH align=right>Last Name:</TH>\n";
+			print "    <TD>{$userdata["lastname"]}</TD>\n";
+			print "  </TR>\n";
+		}
+		if(! empty($userdata['preferredname'])) {
+			print "  <TR>\n";
+			print "    <TH align=right>Preferred Name:</TH>\n";
+			print "    <TD>{$userdata["preferredname"]}</TD>\n";
+			print "  </TR>\n";
+		}
+		if(! empty($userdata['email'])) {
+			print "  <TR>\n";
+			print "    <TH align=right>Email:</TH>\n";
+			print "    <TD>{$userdata["email"]}</TD>\n";
+			print "  </TR>\n";
+		}
 		print "  <TR>\n";
 		print "    <TH align=right>Admin Level:</TH>\n";
 		print "    <TD>{$userdata["adminlevel"]}</TD>\n";

Modified: incubator/vcl/trunk/web/.ht-inc/requests.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/requests.php?rev=931588&r1=931587&r2=931588&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/requests.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/requests.php Wed Apr  7 15:26:08 2010
@@ -2941,126 +2941,6 @@ function printEditNewUpdate($request, $r
 
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \fn adminEditRequest()
-///
-/// \brief prints a page for an admin to edit a user's request
-///
-////////////////////////////////////////////////////////////////////////////////
-/*function adminEditRequest() {
-	$requestid = processInputVar("requestid", ARG_NUMERIC);
-	$request = getRequestInfo($requestid);
-	foreach($request["reservations"] as $res) {
-		if($res["forcheckout"]) {
-			$reservation = $res;
-			break;
-		}
-	}
-	$userinfo = getUserInfo($request["userid"]);
-	$images = getImages();
-	$unixstart = datetimeToUnix($request["start"]);
-	print "<H2>Modify Reservation</H2>\n";
-	if($unixstart > time()) {
-		$started = 0;
-	}
-	else {
-		$started = 1;
-		print "Because this reservation has already started, you can only ";
-		print "modify the end time of the reservation.  You will only be able ";
-		print "to extend the length if the computer the reservation is on ";
-		print "has time available before the next reservation.<br><br>\n";
-	}
-	$start = date('n/j/y,g,i,a', datetimeToUnix($request["start"]));
-	$startArr = explode(',', $start);
-
-	$end = date('n/j/y,g,i,a', datetimeToUnix($request["end"]));
-	$endArr = explode(',', $end);
-
-	print "Modify reservation for ";
-	if(! empty($userinfo["preferredname"])) {
-		print $userinfo["preferredname"] . " ";
-	}
-	else {
-		print $userinfo["firstname"] . " ";
-	}
-	print $userinfo["lastname"] . " (" . $userinfo["unityid"] . "):<br>\n";
-	print "<DIV align=center>\n";
-	print "<table summary=\"\" cellpadding=0>\n";
-	print "  <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
-	$minArr = array("zero" => "00", 
-						 "15" => "15",
-						 "30" => "30",
-						 "45" => "45");
-	if(! $started) {
-		print "  <TR>\n";
-		print "    <TH align=right>Requested&nbsp;Image:</TH>\n";
-		print "    <TD colspan=6>\n";
-		printSelectInput("imageid", $images, $reservation["imageid"]);
-		print "    </TD>\n";
-		print "  </TR>\n";
-		print "  <TR valign=middle>\n";
-		print "    <TH align=right>Start Time:</TH>\n";
-		print "    <TD>\n";
-		print "      <INPUT type=text name=day maxlength=8 size=8 ";
-		print "value=\"" . $startArr[0] . "\">\n";
-		print "    </TD>\n";
-		print "    <TD>\n";
-		print "      <INPUT type=text name=hour maxlength=2 size=2 ";
-		print "value=" . $startArr[1] . ">\n";
-		print "    <TD>:</TD>\n";
-		print "    </TD>\n";
-		print "    <TD>\n";
-		printSelectInput("minute", $minArr, $startArr[2]);
-		print "    </TD>\n";
-		print "    <TD>\n";
-		printSelectInput("meridian", array("am" => "am", "pm" => "pm"), $startArr[3]);
-		print "    </TD>\n";
-		print "    <TD>\n";
-		printSubmitErr(STARTDAYERR);
-		printSubmitErr(STARTHOURERR);
-		print "    </TD>\n";
-		print "  </TR>\n";
-	}
-	print "  <TR valign=middle>\n";
-	print "    <TH align=right>End Time:</TH>\n";
-	print "    <TD><INPUT type=text name=endday maxlength=8 size=8 ";
-	print "value=\"" . $endArr[0] . "\"></TD>\n";
-	print "    <TD><INPUT type=text name=endhour maxlength=2 size=2 ";
-	print "value=" . $endArr[1] . "></TD>\n";
-	print "    <TD>:</TD>\n";
-	print "    <TD>\n";
-	printSelectInput("endminute", $minArr, $endArr[2]);
-	print "    </TD>\n";
-	print "    <TD>\n";
-	printSelectInput("endmeridian", array("am" => "am", "pm" => "pm"), $endArr[3]);
-	print "    </TD>\n";
-	print "    <TD>\n";
-	printSubmitErr(ENDDAYERR);
-	printSubmitErr(ENDHOURERR);
-	print "    </TD>\n";
-	print "  </TR>\n";
-	print "</table>\n";
-	print "<table summary=\"\">\n";
-	print "  <TR valign=top>\n";
-	print "    <TD>\n";
-	print "      <INPUT type=hidden name=mode value=confirmAdminEditRequest>\n";
-	print "      <INPUT type=hidden name=requestid value=$requestid>\n";
-	print "      <INPUT type=hidden name=started value=$started>\n";
-	print "      <INPUT type=submit value=\"Confirm Changes\">\n";
-	print "      </FORM>\n";
-	print "    </TD>\n";
-	print "    <TD>\n";
-	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
-	print "      <INPUT type=hidden name=mode value=pickTimeTable>\n";
-	print "      <INPUT type=submit value=Cancel>\n";
-	print "      </FORM>\n";
-	print "    </TD>\n";
-	print "  </TR>\n";
-	print "</table>\n";
-	print "</DIV>\n";
-}*/
-
-////////////////////////////////////////////////////////////////////////////////
-///
 /// \fn confirmEditRequest()
 ///
 /// \brief prints a page confirming the change the user requested for his
@@ -3166,72 +3046,6 @@ function confirmEditRequest() {
 
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \fn confirmAdminEditRequest()
-///
-/// \brief prints a page confirming the changes the admin requested for the
-/// request
-///
-////////////////////////////////////////////////////////////////////////////////
-/*function confirmAdminEditRequest() {
-	global $submitErr;
-
-	$data = processRequestInput(1);
-	if($submitErr) {
-		adminEditRequest();
-		return;
-	}
-	$request = getRequestInfo($data["requestid"]);
-	$userinfo = getUserInfo($request["userid"]);
-	$images = getImages();
-
-	print "<H2>Modify Reservation</H2>\n";
-	print "Change reservation for ";
-	if(! empty($userinfo["preferredname"])) {
-		print $userinfo["preferredname"] . " ";
-	}
-	else {
-		print $userinfo["firstname"] . " ";
-	}
-	print $userinfo["lastname"] . " (" . $userinfo["unityid"] . "):<br>\n";
-	print "<table summary=\"\">\n";
-	if(! $data["started"]) {
-		print "  <TR>\n";
-		print "    <TH align=right>Image:</TH>\n";
-		print "    <TD>" . $images[$data["imageid"]]["prettyname"] . "</TD>\n";
-		print "  </TR>\n";
-		print "  <TR>\n";
-		print "    <TH align=right>Start Time:</TH>\n";
-		print "    <TD>" . $data["day"] . "&nbsp;" . $data["hour"] . ":";
-		print $data["minute"] . "&nbsp;" . $data["meridian"] . "</TD>\n";
-		print "  </TR>\n";
-	}
-	print "  <TR>\n";
-	print "    <TH align=right>End Time:</TH>\n";
-	print "    <TD>" . $data["endday"] . "&nbsp;" . $data["endhour"] . ":";
-	print $data["endminute"] . "&nbsp;" . $data["endmeridian"] . "</TD>\n";
-	print "  </TR>\n";
-	print "</table>\n";
-	print "<table summary=\"\">\n";
-	print "  <TR valign=top>\n";
-	print "    <TD>\n";
-	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
-	print "      <INPUT type=hidden name=mode value=submitAdminEditRequest>\n";
-	printHiddenInputs($data);
-	print "      <INPUT type=submit value=Submit>\n";
-	print "      </FORM>\n";
-	print "    </TD>\n";
-	print "    <TD>\n";
-	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
-	print "      <INPUT type=hidden name=mode value=pickTimeTable>\n";
-	print "      <INPUT type=submit value=Cancel>\n";
-	print "      </FORM>\n";
-	print "    </TD>\n";
-	print "  </TR>\n";
-	print "</table>\n";
-}*/
-
-////////////////////////////////////////////////////////////////////////////////
-///
 /// \fn submitEditRequest()
 ///
 /// \brief submits changes to a request and prints that it has been changed
@@ -3346,75 +3160,6 @@ function submitEditRequest() {
 
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \fn submitAdminEditRequest()
-///
-/// \brief submits changes to a request and prints that it has been changed
-///
-////////////////////////////////////////////////////////////////////////////////
-/*function submitAdminEditRequest() {
-	$data = processRequestInput(0);
-	$request = getRequestInfo($data["requestid"]);
-	$userinfo = getUserInfo($request["userid"]);
-	$images = getImages();
-
-	print "<H2>Modify Reservation</H2>\n";
-
-	$hour = $data["hour"];
-	if($data["hour"] == 12) {
-		if($data["meridian"] == "am") {
-			$hour = 0;
-		}
-	}
-	elseif($data["meridian"] == "pm") {
-		$hour = $data["hour"] + 12;
-	}
-
-	$endhour = $data["endhour"];
-	if($data["endhour"] == 12) {
-		if($data["endmeridian"] == "am") {
-			$endhour = 0;
-		}
-	}
-	elseif($data["endmeridian"] == "pm") {
-		$endhour = $data["endhour"] + 12;
-	}
-
-	$tmp = explode('/', $data["day"]);
-	$start = mktime($hour, $data["minute"], "0", $tmp[0], $tmp[1], $tmp[2]);
-	$tmp = explode('/', $data["endday"]);
-	$end = mktime($endhour, $data["endminute"], "0", $tmp[0], $tmp[1], $tmp[2]);
-
-	$rc = isAvailable($images, $data["imageid"], $start, $end, $data["os"], $data["requestid"]);
-	if($rc == -1) {
-		print "Modified reservation time is not available<br>\n";
-		addChangeLogEntry($request["logid"], NULL, unixToDatetime($end),
-		                  unixToDatetime($start), NULL, NULL, 0);
-	}
-	elseif($rc > 0) {
-		updateRequest($data["requestid"]);
-		print "Change reservation for ";
-		if(! empty($userinfo["preferredname"])) {
-			print $userinfo["preferredname"] . " ";
-		}
-		else {
-			print $userinfo["firstname"] . " ";
-		}
-		print $userinfo["lastname"] . " (" . $userinfo["unityid"] . "):<br>\n";
-		print "Reservation for " . $userinfo["firstname"] . " ";
-		print $userinfo["lastname"] . "(" . $userinfo["unityid"] . ") has ";
-		print "been updated to start at " . unixToDatetime($start) . " and ";
-		print "end at " . unixToDatetime($end) . " using image ";
-		print $images[$data["imageid"]]["prettyname"] . "<br>\n";
-	}
-	else {
-		print "Modified reservation time is not available<br>\n";
-		addChangeLogEntry($request["logid"], NULL, unixToDatetime($end),
-		                  unixToDatetime($start), NULL, NULL, 0);
-	}
-}*/
-
-////////////////////////////////////////////////////////////////////////////////
-///
 /// \fn confirmDeleteRequest()
 ///
 /// \brief prints a confirmation page about deleting a request

Modified: incubator/vcl/trunk/web/.ht-inc/userpreferences.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/userpreferences.php?rev=931588&r1=931587&r2=931588&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/userpreferences.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/userpreferences.php Wed Apr  7 15:26:08 2010
@@ -65,12 +65,17 @@ function userpreferences() {
 	print "</div>\n";
 	print "<table summary=\"\">\n";
 	print "  <TR>\n";
-	print "    <TD>\n";
+	print "    <TD valign=top>\n";
 	print "      <div id=preflinks class=hidden>\n";
 	print "      <ul class=preferenceslist>\n";
-	print "      <li><a href=#personal onclick=\"";
-	print "show('personal'); return false;\">Personal&nbsp;Information</a>";
-	print "</li>\n";
+	$showpersonal = 0;
+	if(! empty($user['firstname']) || ! empty($user['lastname']) || ! empty($user['email']) ||
+	   $user['affiliation'] == 'Local') {
+		$showpersonal = 1;
+		print "      <li><a href=#personal onclick=\"";
+		print "show('personal'); return false;\">Personal&nbsp;Information</a>";
+		print "</li>\n";
+	}
 	print "      <li><a href=#rdpfile onclick=\"";
 	print "show('rdpfile'); return false;\">RDP&nbsp;File&nbsp;Preferences</a>";
 	print "</li>\n";
@@ -85,81 +90,97 @@ function userpreferences() {
 	print "    </TD>\n";
 	print "    <TD rowspan=2 width=50px></TD>\n";
 	print "    <TD rowspan=2>\n";
-	print "      <fieldset id=personal class=shown>\n";
-	print "      <legend>Personal</legend>\n";
-	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
-	print "      <table summary=\"displays your personal information\">\n";
-	print "        <TR>\n";
-	print "          <TH align=right>First Name<a href=#updateinfo>*</a>:</TH>\n";
-	print "          <TD>" . $user["firstname"] . "</TD>\n";
-	print "          <TD></TD>\n";
-	print "        </TR>\n";
-	print "        <TR>\n";
-	print "          <TH align=right>Last Name<a href=#updateinfo>*</a>:</TH>\n";
-	print "          <TD>" . $user["lastname"] . "</TD>\n";
-	print "          <TD></TD>\n";
-	print "        </TR>\n";
-	print "        <TR>\n";
-	print "          <TH align=right>Preferred Name:</TH>\n";
-	print "          <TD><label class=hidden for=preferredname>Preferred Name</label>\n";
-	print "              <INPUT type=text name=preferredname maxlength=100 ";
-	print "size=15 value=\"" . $data["preferredname"] . "\"></TD>\n";
-	print "          <TD>";
-	printSubmitErr(PREFNAMEERR);
-	print "</TD>\n";
-	print "        </TR>\n";
-	print "        <TR>\n";
-	print "          <TH align=right>Email Address<a href=#updateinfo>*</a>:</TH>\n";
-	print "          <TD>" . $user["email"] . "</TD>\n";
-	print "          <TD></TD>\n";
-	print "        </TR>\n";
-	if($user['affiliation'] == 'Local') {
-		print "        <TR>\n";
-		print "          <TD colspan=3 align=center><h3>Change Password</h3></TD>\n";
-		print "        </TR>\n";
-		print "        <TR>\n";
-		print "          <TH align=right>Current Password:</TH>\n";
-		print "          <TD>\n";
-		print "            <label class=hidden for=currentpassword>Current Password</label>\n";
-		print "            <INPUT type=password name=currentpassword maxlength=100 size=15>\n";
-		print "          </TD>\n";
-		print "          <TD>";
-		printSubmitErr(LOCALPASSWORDERR);
-		print "</TD>\n";
-		print "        </TR>\n";
-		print "        <TR>\n";
-		print "          <TH align=right>New Password:</TH>\n";
-		print "          <TD>\n";
-		print "            <label class=hidden for=newpassword>New Password</label>\n";
-		print "            <INPUT type=password name=newpassword maxlength=100 ";
-		print "id=newpassword onkeyup=\"checkNewLocalPassword();\" size=15>\n";
-		print "          </TD>\n";
-		print "          <TD></TD>\n";
-		print "        </TR>\n";
-		print "        <TR>\n";
-		print "          <TH align=right>Confirm Password:</TH>\n";
-		print "          <TD>\n";
-		print "            <label class=hidden for=confirmpassword>Confirm Password</label>\n";
-		print "            <INPUT type=password name=confirmpassword maxlength=100 ";
-		print "id=confirmpassword onkeyup=\"checkNewLocalPassword();\" size=15>\n";
-		print "          </TD>\n";
-		print "          <TD><span id=pwdstatus></span></TD>\n";
-		print "        </TR>\n";
+	if($showpersonal) {
+		print "      <fieldset id=personal class=shown>\n";
+		print "      <legend>Personal</legend>\n";
+		print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
+		print "      <table summary=\"displays your personal information\">\n";
+		$showsubmit = 0;
+		if(! empty($user['firstname'])) {
+			print "        <TR>\n";
+			print "          <TH align=right>First Name<a href=#updateinfo>*</a>:</TH>\n";
+			print "          <TD>" . $user["firstname"] . "</TD>\n";
+			print "          <TD></TD>\n";
+			print "        </TR>\n";
+		}
+		if(! empty($user['lastname'])) {
+			print "        <TR>\n";
+			print "          <TH align=right>Last Name<a href=#updateinfo>*</a>:</TH>\n";
+			print "          <TD>" . $user["lastname"] . "</TD>\n";
+			print "          <TD></TD>\n";
+			print "        </TR>\n";
+		}
+		# preferred name is stored locally; allow setting preferred name if a firstname is defined
+		if(! empty($user['firstname'])) {
+			print "        <TR>\n";
+			print "          <TH align=right>Preferred Name:</TH>\n";
+			print "          <TD><label class=hidden for=preferredname>Preferred Name</label>\n";
+			print "              <INPUT type=text name=preferredname maxlength=100 ";
+			print "size=15 value=\"" . $data["preferredname"] . "\"></TD>\n";
+			print "          <TD>";
+			printSubmitErr(PREFNAMEERR);
+			print "</TD>\n";
+			print "        </TR>\n";
+			$showsubmit = 1;
+		}
+		if(! empty($user['email'])) {
+			print "        <TR>\n";
+			print "          <TH align=right>Email Address<a href=#updateinfo>*</a>:</TH>\n";
+			print "          <TD>" . $user["email"] . "</TD>\n";
+			print "          <TD></TD>\n";
+			print "        </TR>\n";
+		}
+		if($user['affiliation'] == 'Local') {
+			print "        <TR>\n";
+			print "          <TD colspan=3 align=center><h3>Change Password</h3></TD>\n";
+			print "        </TR>\n";
+			print "        <TR>\n";
+			print "          <TH align=right>Current Password:</TH>\n";
+			print "          <TD>\n";
+			print "            <label class=hidden for=currentpassword>Current Password</label>\n";
+			print "            <INPUT type=password name=currentpassword maxlength=100 size=15>\n";
+			print "          </TD>\n";
+			print "          <TD>";
+			printSubmitErr(LOCALPASSWORDERR);
+			print "</TD>\n";
+			print "        </TR>\n";
+			print "        <TR>\n";
+			print "          <TH align=right>New Password:</TH>\n";
+			print "          <TD>\n";
+			print "            <label class=hidden for=newpassword>New Password</label>\n";
+			print "            <INPUT type=password name=newpassword maxlength=100 ";
+			print "id=newpassword onkeyup=\"checkNewLocalPassword();\" size=15>\n";
+			print "          </TD>\n";
+			print "          <TD></TD>\n";
+			print "        </TR>\n";
+			print "        <TR>\n";
+			print "          <TH align=right>Confirm Password:</TH>\n";
+			print "          <TD>\n";
+			print "            <label class=hidden for=confirmpassword>Confirm Password</label>\n";
+			print "            <INPUT type=password name=confirmpassword maxlength=100 ";
+			print "id=confirmpassword onkeyup=\"checkNewLocalPassword();\" size=15>\n";
+			print "          </TD>\n";
+			print "          <TD><span id=pwdstatus></span></TD>\n";
+			print "        </TR>\n";
+			$showsubmit = 1;
+		}
+		print "      </table>\n";
+		$updateText = getAffiliationDataUpdateText($user['affiliationid']);
+		print "<a name=updateinfo></a>\n";
+		if(! empty($updateText[$user['affiliationid']]))
+			print "{$updateText[$user['affiliationid']]}<br><br>";
+		if($showsubmit) {
+			$cont = addContinuationsEntry('confirmpersonalprefs', array(), SECINDAY, 1, 1, 1);
+			print "      <INPUT type=hidden name=continuation value=\"$cont\">\n";
+			print "      <div align=center>\n";
+			print "      <INPUT type=submit value=\"Submit Changes\">\n";
+			print "      </div>\n";
+		}
+		print "      </FORM>\n";
+		print "      </fieldset>\n";
 	}
-	print "      </table>\n";
-	$updateText = getAffiliationDataUpdateText($user['affiliationid']);
-	print "<a name=updateinfo></a>\n";
-	if(! empty($updateText[$user['affiliationid']]))
-		print "{$updateText[$user['affiliationid']]}<br><br>";
-	$cont = addContinuationsEntry('confirmpersonalprefs', array(), SECINDAY, 1, 1, 1);
-	print "      <INPUT type=hidden name=continuation value=\"$cont\">\n";
-	print "      <div align=center>\n";
-	print "      <INPUT type=submit value=\"Submit Changes\">\n";
-	print "      </div>\n";
-	print "      </FORM>\n";
-	print "      </fieldset>\n";
 
-	print "      <fieldset id=rdpfile class=visible>\n";
+	print "      <fieldset id=rdpfile class=shown>\n";
 	print "      <legend>RDP</legend>\n";
 	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
 	print "      <table summary=\"lists adjustable preferences for the RDP ";
@@ -239,7 +260,7 @@ function userpreferences() {
 	print "      </FORM>\n";
 	print "      </fieldset>\n";
 
-	print "      <div id=uiprefs class=visible>\n";
+	print "      <div id=uiprefs class=shown>\n";
 	print "      <fieldset>\n";
 	print "      <legend>General Preferences</legend>\n";
 	print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
@@ -615,11 +636,15 @@ function printUserprefJavascript() {
 	print <<<HTMLdone
 <script type="text/javascript">
 function show(id) {
-	document.getElementById("personal").className = "hidden";
+	var obj = document.getElementById("personal");
+	if(obj)
+		obj.className = "hidden";
 	document.getElementById("rdpfile").className = "hidden";
 	document.getElementById("uiprefs").className = "hidden";
 	document.getElementById("viewmode").className = "hidden";
 	document.getElementById("status").className = "hidden";
+	if(id == 'personal' && ! obj)
+		id = 'rdpfile';
 	document.getElementById(id).className = "shown";
 }
 show("personal");

Modified: incubator/vcl/trunk/web/.ht-inc/utils.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=931588&r1=931587&r2=931588&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Wed Apr  7 15:26:08 2010
@@ -668,14 +668,10 @@ function main() {
 	global $user, $authed, $mode, $skin;
 	print "<H2>Welcome to the Virtual Computing Lab</H2>\n";
 	if($authed) {
-		print "Hello ";
-		if(! empty($user["preferredname"])) {
-			print $user["preferredname"] . " ";
-		}
-		else {
-			print $user["firstname"] . " ";
-		}
-		print $user["lastname"] . "<br><br>\n";
+		if(! empty($user['lastname']) && ! empty($user['preferredname']))
+			print "Hello {$user["preferredname"]} {$user['lastname']}<br><br>\n";
+		elseif(! empty($user['lastname']) && ! empty($user['preferredname']))
+			print "Hello {$user["firstname"]} {$user['lastname']}<br><br>\n";
 		$tmp = array_values($user['groups']);
 		if(count($tmp) == 1 && $tmp[0] == 'nodemo') {
 			print "Your account is a demo account that has expired. ";
@@ -3010,8 +3006,8 @@ function addUser($loginid) {
 
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \fn updateUserPrefs($userid, $preferredname, $width, $height, $bpp, 
-///                              $audio, $mapdrives, $mapprinters, $mapserial)
+/// \fn updateUserPrefs($userid, $preferredname, $width, $height, $bpp, $audio,
+///                     $mapdrives, $mapprinters, $mapserial)
 ///
 /// \param $userid - id from user table
 /// \param $preferredname - user's preferred name
@@ -3029,8 +3025,8 @@ function addUser($loginid) {
 /// \brief updates the preferences for the user
 ///
 ////////////////////////////////////////////////////////////////////////////////
-function updateUserPrefs($userid, $preferredname, $width, $height,
-                         $bpp, $audio, $mapdrives, $mapprinters, $mapserial) {
+function updateUserPrefs($userid, $preferredname, $width, $height, $bpp, $audio,
+                         $mapdrives, $mapprinters, $mapserial) {
 	global $mysql_link_vcl;
 	$preferredname = mysql_escape_string($preferredname);
 	$audio = mysql_escape_string($audio);