diff --git a/account/newuser.in b/account/newuser.in index 6a3b151ae3daaa4915d610a6f97395b0a129fac0..bca5445ed774620d4a736815924a5c7365947dfb 100644 --- a/account/newuser.in +++ b/account/newuser.in @@ -154,7 +154,8 @@ my %usually_required = ("address" => "usr_addr", "country" => "usr_country", "phone" => "usr_phone", "title" => "usr_title", - "affiliation" => "usr_affil"); + "affiliation" => "usr_affil", + "affiliation_abbreviation" => "usr_affil_abbrev"); if ($type eq "wikionly") { %optional = (%optional, %usually_required); } else { diff --git a/backend/moduserinfo.in b/backend/moduserinfo.in index 6477464539c27574e6aeb4128828f9f988be5bcd..c86520afda58cf05b820aac8f2a71f6931b34a1d 100644 --- a/backend/moduserinfo.in +++ b/backend/moduserinfo.in @@ -136,6 +136,7 @@ my %xmlfields = "usr_name" => ["usr_name", $SLOT_OPTIONAL], "usr_title" => ["usr_title", $SLOT_OPTIONAL], "usr_affil" => ["usr_affil", $SLOT_OPTIONAL], + "usr_affil_abbrev" => ["usr_affil_abbrev", $SLOT_OPTIONAL], "usr_shell" => ["usr_shell", $SLOT_OPTIONAL], "usr_URL" => ["usr_URL", $SLOT_OPTIONAL], "usr_email" => ["usr_email", $SLOT_OPTIONAL], diff --git a/db/User.pm.in b/db/User.pm.in index f581909bdea27c4c456c1a9c228c6ffade8bc936..3544abccf333618005117cb87693cfbe01117ed0 100644 --- a/db/User.pm.in +++ b/db/User.pm.in @@ -145,6 +145,7 @@ sub modified($) { return field($_[0], "usr_modified"); } sub name($) { return field($_[0], "usr_name"); } sub title($) { return field($_[0], "usr_title"); } sub affil($) { return field($_[0], "usr_affil"); } +sub affil_abbrev($) { return field($_[0], "usr_affil_abbrev"); } sub email($) { return field($_[0], "usr_email"); } sub URL($) { return field($_[0], "usr_URL"); } sub addr($) { return field($_[0], "usr_addr"); } @@ -807,7 +808,8 @@ sub ModUserInfo($$$$) # (Others above already did their own updates.) # my %updates; - foreach my $col ("usr_name", "usr_title", "usr_affil", "usr_URL", + foreach my $col ("usr_name", "usr_title", "usr_affil", "usr_affil_abbrev", + "usr_URL", "usr_addr", "usr_addr2", "usr_city", "usr_state", "usr_zip", "usr_country", "usr_phone", "usr_shell") { # Copy args we want so that others can't get through. @@ -831,7 +833,8 @@ sub ModUserInfo($$$$) else { # Send an audit e-mail reporting what is being changed. my @report = ("Name:usr_name", "Email:usr_email", - "Job Title:usr_title", "Affiliation:usr_affil", + "Job Title:usr_title", "Affiliation:usr_affil", + "Affiliation Abbreviation:usr_affil_abbrev", "URL:usr_URL", "Address1:usr_addr", "Address2:usr_addr2", "City:usr_city", "State:usr_state", "ZIP/Postal Code:usr_zip", diff --git a/sql/database-fill.sql b/sql/database-fill.sql index e9eb55f4b0bc94bf6c430a3b9e1cd641a3921a08..8138d9ad9124fef33ab13c04e5a726236271022c 100644 --- a/sql/database-fill.sql +++ b/sql/database-fill.sql @@ -604,6 +604,7 @@ REPLACE INTO table_regex VALUES ('users','usr_email','text','regex','^([-\\w\\+\ REPLACE INTO table_regex VALUES ('users','usr_shell','text','regex','^(csh|sh|bash|tcsh|zsh)$',0,0,NULL); REPLACE INTO table_regex VALUES ('users','usr_title','text','redirect','default:tinytext',0,0,NULL); REPLACE INTO table_regex VALUES ('users','usr_affil','text','redirect','default:tinytext',0,0,NULL); +REPLACE INTO `table_regex` VALUES ('users','usr_affil_abbrev','text','regex','^[\\040-\\176]*$',0,16,NULL); REPLACE INTO table_regex VALUES ('users','usr_addr','text','redirect','default:tinytext',0,0,NULL); REPLACE INTO table_regex VALUES ('users','usr_addr2','text','redirect','default:tinytext',0,0,NULL); REPLACE INTO table_regex VALUES ('users','usr_state','text','redirect','default:tinytext',0,0,NULL); diff --git a/sql/database-migrate.txt b/sql/database-migrate.txt index f3948472f9c2e62a2ea8bedac2044bd7260e387f..58bf380b71ec009514a4d0449561be04c4258219 100644 --- a/sql/database-migrate.txt +++ b/sql/database-migrate.txt @@ -4478,10 +4478,13 @@ last_net_act,last_cpu_act,last_ext_act); ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 4.149: Add usr_affil_abbrev column to users and deleted users tables + and add 'slot' to table_regex alter table users add usr_affil_abbrev varchar(16) after usr_affil; alter table deleted_users add usr_affil_abbrev varchar(16) after usr_affil; + REPLACE INTO `table_regex` VALUES ('users','usr_affil_abbrev','text','regex','^[\\040-\\176]*$',0,16,NULL); + 4.150: Improvements to the sslcerts table for GENI support. Generally, its nice to support real revocation, but specifically, we want to remember expired and revoked @@ -4497,4 +4500,3 @@ last_net_act,last_cpu_act,last_ext_act); add `password` tinytext, add KEY `uid` (`uid`), add KEY `uid_idx` (`uid_idx`); - diff --git a/www/dbcheck.php3 b/www/dbcheck.php3 index cdbb5b073cd144fae52c522cbcc4ec5fabdd8723..c1e0e5f4139cfeaf941b4420e588f02f3b0c486f 100644 --- a/www/dbcheck.php3 +++ b/www/dbcheck.php3 @@ -238,6 +238,10 @@ function TBvalid_title($token) { function TBvalid_affiliation($token) { return TBvalid_userdata($token); } +function TBvalid_affiliation_abbreviation($token) { + return TBcheck_dbslot($token, "users", "usr_affil_abbrev", + TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR); +} function TBvalid_addr($token) { return TBvalid_userdata($token); } diff --git a/www/group_defs.php b/www/group_defs.php index 1183aef710d9a6c1ddceee0f0dc445f6c73126d1..54a1b9d7142f025c0ba80139bb063b47194228b9 100644 --- a/www/group_defs.php +++ b/www/group_defs.php @@ -1131,6 +1131,7 @@ class Group echo "<thead class='sort'>"; echo "<tr> <th>Name</th>\n"; + echo "<th>Affiliation</th>\n"; if (! $projgrp) { echo "<th>Email</th>\n"; } @@ -1149,6 +1150,7 @@ class Group TBERROR("Could not lookup object for user $uid_idx", 1); } $usr_name = $target_user->name(); + $usr_affil = $target_user->affil_abbrev(); $usr_email = $target_user->email(); $usr_uid = $target_user->uid(); $showuser_url = CreateURL("showuser", $target_user); @@ -1157,6 +1159,8 @@ class Group echo "<tr> <td>$usr_name</td>\n"; + echo "<td>$usr_affil</td>\n"; + if (! $projgrp) { echo "<td>$usr_email</td>\n"; } diff --git a/www/joinproject.php3 b/www/joinproject.php3 index 64d6989a9429025bacd56c85bd83f59ed1665dfb..ab4f15f50c11acd0b5bcc6a73d268ff038a0269e 100644 --- a/www/joinproject.php3 +++ b/www/joinproject.php3 @@ -238,12 +238,23 @@ function SPITFORM($formfields, $returning, $errors) # Affiliation: # echo "<tr> - <td colspan=2>*Institutional<br>Affiliation:</td> + <td colspan=2>*Institutional Affiliation:</td> <td class=left> - <input type=text + <table> + <tr> + <td>Name</td> + <td><input type=text name=\"formfields[usr_affil]\" value=\"" . $formfields["usr_affil"] . "\" - size=40> + size=40></td></tr> + <tr> + <td>Abbreviation:</td> + <td><input type=text + name=\"formfields[usr_affil_abbrev]\" + value=\"" . $formfields["usr_affil_abbrev"] . "\" + size=16 maxlength=16> (e.g. MIT)</td> + </tr> + </table> </td> </tr>\n"; @@ -491,6 +502,7 @@ if (! isset($submit)) { $defaults["usr_phone"] = ""; $defaults["usr_title"] = ""; $defaults["usr_affil"] = ""; + $defaults["usr_affil_abbrev"] = ""; $defaults["password1"] = ""; $defaults["password2"] = ""; $defaults["wikiname"] = ""; @@ -573,10 +585,17 @@ if (! $returning) { } if (!isset($formfields["usr_affil"]) || strcmp($formfields["usr_affil"], "") == 0) { - $errors["Affiliation"] = "Missing Field"; + $errors["Affiliation Name"] = "Missing Field"; } elseif (! TBvalid_affiliation($formfields["usr_affil"])) { - $errors["Affiliation"] = TBFieldErrorString(); + $errors["Affiliation Name"] = TBFieldErrorString(); + } + if (!isset($formfields["usr_affil_abbrev"]) || + strcmp($formfields["usr_affil_abbrev"], "") == 0) { + $errors["Affiliation Abbreviation"] = "Missing Field"; + } + elseif (! TBvalid_affiliation_abbreviation($formfields["usr_affil"])) { + $errors["Affiliation Name"] = TBFieldErrorString(); } } if (!isset($formfields["usr_email"]) || @@ -738,6 +757,7 @@ if (! $returning) { $args["shell"] = 'tcsh'; $args["title"] = $formfields["usr_title"]; $args["affiliation"] = $formfields["usr_affil"]; + $args["affiliation_abbreviation"] = $formfields["usr_affil_abbrev"]; $args["password"] = $formfields["password1"]; $args["wikiname"] = ($WIKISUPPORT ? $formfields["wikiname"] : ""); diff --git a/www/moduserinfo.php3 b/www/moduserinfo.php3 index bca31da2ed6be759c3ac5aa6e1181833a1dfd774..9743d7e0d68cf4017c68c010f36e3ad35a5e0df5 100644 --- a/www/moduserinfo.php3 +++ b/www/moduserinfo.php3 @@ -125,13 +125,24 @@ function SPITFORM($formfields, $errors) # Affiliation: # echo "<tr> - <td colspan=2>${optfield}Institutional<br>Affiliation:</td> - <td class=left> - <input type=text - name=\"formfields[usr_affil]\" - value=\"" . $formfields["usr_affil"] . "\" - size=40> - </td> + <td colspan=2>*Institutional Affiliation:</td> + <td class=left> + <table> + <tr> + <td>Name</td> + <td><input type=text + name=\"formfields[usr_affil]\" + value=\"" . $formfields["usr_affil"] . "\" + size=40></td></tr> + <tr> + <td>Abbreviation:</td> + <td><input type=text + name=\"formfields[usr_affil_abbrev]\" + value=\"" . $formfields["usr_affil_abbrev"] . "\" + size=16 maxlength=16> (e.g. MIT)</td> + </tr> + </table> + </td> </tr>\n"; # @@ -414,6 +425,7 @@ if (!isset($submit)) { $defaults["usr_phone"] = $target_user->phone(); $defaults["usr_title"] = $target_user->title(); $defaults["usr_affil"] = $target_user->affil(); + $defaults["usr_affil_abbrev"] = $target_user->affil_abbrev(); $defaults["usr_shell"] = $target_user->shell(); $defaults["notes"] = $target_user->notes(); $defaults["password1"] = ""; @@ -495,6 +507,10 @@ if (isset($formfields["usr_affil"]) && $formfields["usr_affil"] != "" && $formfields["usr_affil"] != $target_user->affil()) { $args["usr_affil"] = $formfields["usr_affil"]; } +if (isset($formfields["usr_affil_abbrev"]) && $formfields["usr_affil_abbrev"] != "" && + $formfields["usr_affil"] != $target_user->affil_abbrev()) { + $args["usr_affil_abbrev"] = $formfields["usr_affil_abbrev"]; +} if (isset($formfields["usr_shell"]) && $formfields["usr_shell"] != "" && $formfields["usr_shell"] != $target_user->shell()) { $args["usr_shell"] = $formfields["usr_shell"]; diff --git a/www/newproject.php3 b/www/newproject.php3 index 28a8b616cb498035d901c2a56e383e4014e3df88..66391c582e5df023d3c8afdf4adeb764eb074504 100755 --- a/www/newproject.php3 +++ b/www/newproject.php3 @@ -238,13 +238,24 @@ function SPITFORM($formfields, $returning, $errors) # Affiliation: # echo "<tr> - <td colspan=2>*Institutional<br>Affiliation:</td> - <td class=left> - <input type=text - name=\"formfields[usr_affil]\" - value=\"" . $formfields["usr_affil"] . "\" - size=40> - </td> + <td colspan=2>*Institutional Affiliation:</td> + <td class=left> + <table> + <tr> + <td>Name</td> + <td><input type=text + name=\"formfields[usr_affil]\" + value=\"" . $formfields["usr_affil"] . "\" + size=40></td></tr> + <tr> + <td>Abbreviation:</td> + <td><input type=text + name=\"formfields[usr_affil_abbrev]\" + value=\"" . $formfields["usr_affil_abbrev"] . "\" + size=16 maxlength=16> (e.g. MIT)</td> + </tr> + </table> + </td> </tr>\n"; # @@ -603,6 +614,7 @@ if (! isset($submit)) { $defaults["wikiname"] = ""; $defaults["usr_title"] = ""; $defaults["usr_affil"] = ""; + $defaults["usr_affil_abbrev"] = ""; $defaults["usr_URL"] = "$HTTPTAG"; $defaults["usr_email"] = ""; $defaults["usr_addr"] = ""; @@ -706,10 +718,17 @@ if (! $returning) { } if (!isset($formfields["usr_affil"]) || strcmp($formfields["usr_affil"], "") == 0) { - $errors["Affiliation"] = "Missing Field"; + $errors["Affiliation Name"] = "Missing Field"; } elseif (! TBvalid_affiliation($formfields["usr_affil"])) { - $errors["Affiliation"] = TBFieldErrorString(); + $errors["Affiliation Name"] = TBFieldErrorString(); + } + if (!isset($formfields["usr_affil_abbrev"]) || + strcmp($formfields["usr_affil_abbrev"], "") == 0) { + $errors["Affiliation Abbreviation"] = "Missing Field"; + } + elseif (! TBvalid_affiliation_abbreviation($formfields["usr_affil"])) { + $errors["Affiliation Name"] = TBFieldErrorString(); } if (!isset($formfields["usr_email"]) || strcmp($formfields["usr_email"], "") == 0) { @@ -904,6 +923,7 @@ if (!$returning) { $args["shell"] = 'tcsh'; $args["title"] = $formfields["usr_title"]; $args["affiliation"] = $formfields["usr_affil"]; + $args["affiliation_abbreviation"] = $formfields["usr_affil_abbrev"]; $args["password"] = $formfields["password1"]; $args["wikiname"] = ($WIKISUPPORT ? $formfields["wikiname"] : ""); diff --git a/www/showexp_list.php3 b/www/showexp_list.php3 index 622723a26915cec4eee5a2ebeba5c1344dc4af6d..17c1d6c6fbdc30a685d03bad40cf98e05ceb4ab6 100644 --- a/www/showexp_list.php3 +++ b/www/showexp_list.php3 @@ -384,6 +384,8 @@ if ($thumb && !$idle) { TBERROR("Could not lookup object for user $huid", 1); } $showuser_url = CreateURL("showuser", $head_user); + $head_affil = $head_user->affil_abbrev(); + $head_affil_text = $head_affil ? " ($head_affil)" : ""; if ($idle && ($str==" " || !$pcs)) { continue; } @@ -446,7 +448,7 @@ if ($thumb && !$idle) { } echo "<font size=-2><b>Created by:</b> ". - "<a href='$showuser_url'>$huid</a>". + "<a href='$showuser_url'>$huid</a>$head_affil_text". "</font><br />\n"; $special = 0; @@ -544,6 +546,9 @@ if ($thumb && !$idle) { TBERROR("Could not lookup object for user $huid", 1); } $showuser_url = CreateURL("showuser", $head_user); + $head_affil = $head_user->affil_abbrev(); + $head_affil_text = $head_affil ? " ($head_affil)" : ""; + if ($swapreqs && !$isidle) { $swapreqs = ""; @@ -695,7 +700,7 @@ if ($thumb && !$idle) { echo "<td>$name</td>\n"; } - echo "<td><A href='$showuser_url'>$huid</A></td>\n"; + echo "<td><A href='$showuser_url'>$huid</A>$head_affil_text</td>\n"; echo "</tr>\n"; } echo "</table>\n"; diff --git a/www/showproject_list.php3 b/www/showproject_list.php3 index 34b661e1317dcc007958999b4c13e9485be5dd10..8350b7730affe442239b1efcec434ec57cbeccb7 100644 --- a/www/showproject_list.php3 +++ b/www/showproject_list.php3 @@ -156,6 +156,7 @@ function GENPLIST ($query_result) echo "<th>PID</th>\n"; echo "<th>(Approved?) Description</th>\n"; echo "<th>Leader</th>\n"; + echo "<th>Affil</th>\n"; echo "<th>Days<br>Idle</th>\n"; echo "<th>Expts<br>Created</th>\n"; echo "<th>Expts<br>Run</th>\n"; @@ -188,6 +189,7 @@ function GENPLIST ($query_result) } $showuser_url = CreateURL("showuser", $head_user); $headuid = $head_user->uid(); + $affil = $head_user->affil_abbrev(); echo "<tr> <td><A href='showproject.php3?pid=$pid'>$pid</A></td> @@ -200,6 +202,7 @@ function GENPLIST ($query_result) } echo " $Pname</td> <td><A href='$showuser_url'>$headuid</A></td>\n"; + echo "<td>$affil</td>\n"; echo "<td>$idle</td>\n"; echo "<td>$expt_count</td>\n"; diff --git a/www/showuser_list.php3 b/www/showuser_list.php3 index 5a550b154bbe765b0c982795d225efeddfb0c6aa..929485d487f5c17cec5008729973c6efb3a096bd 100644 --- a/www/showuser_list.php3 +++ b/www/showuser_list.php3 @@ -167,6 +167,7 @@ echo "<tr> <th> </th> <th>UID</th> <th>Name</th> + <th>Affiliation</th> <th>Projects</th>\n"; if (! strcmp($showtype, "inactive")) { @@ -183,6 +184,7 @@ while ($row = mysql_fetch_array($query_result)) { $thisuid = $row["uid"]; $webid = $row["uid_idx"]; $name = $row["usr_name"]; + $affil = $row["usr_affil_abbrev"]; $status = $row["status"]; $unix_uid = $row["unix_uid"]; $webidle = $row["webidle"]; @@ -200,7 +202,8 @@ while ($row = mysql_fetch_array($query_result)) { } echo "<td><A href='$showuser_url'>$thisuid</A></td> - <td>$name</td>\n"; + <td>$name</td> + <td>$affil</td>\n"; # List of projects. reset($projmemb_array); diff --git a/www/user_defs.php b/www/user_defs.php index 60ecfd1883407bc343fcb02e34f653cbb64de6bf..6a05dfe78fb6747c1860e7b88cf0d54a2e25b3dc 100644 --- a/www/user_defs.php +++ b/www/user_defs.php @@ -252,6 +252,7 @@ class User function name() { return $this->field("usr_name"); } function title() { return $this->field("usr_title"); } function affil() { return $this->field("usr_affil"); } + function affil_abbrev() { return $this->field("usr_affil_abbrev"); } function email() { return $this->field("usr_email"); } function URL() { return $this->field("usr_URL"); } function addr() { return $this->field("usr_addr"); } @@ -647,6 +648,7 @@ class User $usr_shell = $user->shell(); $usr_title = $user->title(); $usr_affil = $user->affil(); + $usr_affil_abbrev = $user->affil_abbrev(); $status = $user->status(); $admin = $user->admin(); $notes = $user->notes(); @@ -777,6 +779,11 @@ class User <td>$usr_affil</td> </tr>\n"; + echo "<tr> + <td>Institutional Abbreviation:</td> + <td>$usr_affil_abbrev</td> + </tr>\n"; + echo "<tr> <td>Status:</td> <td>$status</td>