Ejemplo n.º 1
0
function userpreferences()
{
    global $user, $submitErr, $mode;
    if ($submitErr) {
        $data = processUserPrefsInput(0);
        $data['affiliation'] = $user['affiliation'];
    } else {
        $data = $user;
        if ($data["width"] == 0) {
            $data["resolution"] = "Full Screen";
        } else {
            $data["resolution"] = $user["width"] . "x" . $user["height"];
        }
    }
    print i("<H2 align=center>User Preferences</H2>\n");
    print "<div align=center id=status class=visible>\n";
    if ($mode == "submituserprefs") {
        print "<font color=green>" . i("User preferences successfully updated") . "</font><br>\n";
    }
    print "</div>\n";
    print "<table summary=\"\">\n";
    print "  <TR>\n";
    print "    <TD valign=top>\n";
    print "      <div id=preflinks class=hidden>\n";
    print "      <ul class=preferenceslist>\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;\">" . i("Personal Information") . "</a>";
        print "</li>\n";
    }
    print "      <li><a href=#rdpfile onclick=\"";
    print "show('rdpfile'); return false;\">" . i("RDP Preferences") . "</a>";
    print "</li>\n";
    print "      <li><a href=#uiprefs onclick=\"javascript:show('uiprefs'); ";
    print "return false\">" . i("General Preferences") . "</a></li>\n";
    print "      </ul>\n";
    print "      </div>\n";
    print "    </TD>\n";
    print "    <TD rowspan=2 width=50px></TD>\n";
    print "    <TD rowspan=2>\n";
    if ($showpersonal) {
        print "      <fieldset id=personal class=shown>\n";
        print "      <legend>" . i("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>" . i("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>" . i("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>" . i("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>" . i("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>" . i("Change Password") . "</h3></TD>\n";
            print "        </TR>\n";
            print "        <TR>\n";
            print "          <TH align=right>" . i("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>" . i("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>" . i("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=\"" . i("Submit Changes") . "\">\n";
            print "      </div>\n";
        }
        print "      </FORM>\n";
        print "      </fieldset>\n";
    }
    print "      <fieldset id=rdpfile class=shown>\n";
    print "      <legend>" . i("RDP") . "</legend>\n";
    print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
    print "      <table summary=\"lists adjustable preferences for the RDP ";
    print "file that is sent when you click the Get RDP File button on the ";
    print "Connect! page and the port on which RDP is listening\">\n";
    print "        <TR>\n";
    print "          <TD colspan=3><div style=\"width: 300px;\"><small>";
    print i("Try decreasing <em>Resolution</em> or <em>Color Depth</em> to speed up your connection if things seem slow when connected to a remote computer.");
    print "</div></small></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>" . i("Resolution:") . "</TH>\n";
    $resolutionArray = array("Full Screen" => "Full Screen", "1920x1440" => "1920x1440", "1600x1200" => "1600x1200", "1280x1024" => "1280x1024", "1152x864" => "1152x864", "1024x768" => "1024x768", "800x600" => "800x600", "640x480" => "640x480", "1680x1050" => "1680x1050", "1600x1024" => "1600x1024", "1440x900" => "1440x900", "1280x854" => "1280x854", "1280x768" => "1280x768", "1024x576" => "1024x576");
    print "          <TD>\n";
    printSelectInput("resolution", $resolutionArray, $data["resolution"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>" . i("Color Depth:") . "</TH>\n";
    print "          <TD>\n";
    $colordepth = array("8" => "8", "16" => "16", "24" => "24", "32" => "32");
    printSelectInput("bpp", $colordepth, $data["bpp"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>" . i("Audio:") . "</TH>\n";
    print "          <TD>\n";
    $audio = array("none" => i("None"), "local" => i("Use my speakers"));
    printSelectInput("audiomode", $audio, $data["audiomode"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>" . i("Map Local Drives:") . "</TH>\n";
    print "          <TD>\n";
    $yesno = array(1 => i("Yes"), 0 => i("No"));
    printSelectInput("mapdrives", $yesno, $data["mapdrives"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>" . i("Map Local Printers:") . "</TH>\n";
    print "          <TD>\n";
    printSelectInput("mapprinters", $yesno, $data["mapprinters"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>" . i("Map Local Serial Ports:") . "</TH>\n";
    print "          <TD>\n";
    printSelectInput("mapserial", $yesno, $data["mapserial"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>" . i("RDP Port") . ":</TH>\n";
    print "          <TD>\n";
    print "            <INPUT type=text name=rdpport maxlength=5 ";
    print "size=8 value=\"" . $data["rdpport"] . "\"></TD>\n";
    print "          </TD>\n";
    print "          <TD>\n";
    printSubmitErr(RDPPORTERR);
    print "          </TD>\n";
    print "        </TR>\n";
    print "      </table>\n";
    $cont = addContinuationsEntry('confirmrdpprefs', array(), SECINDAY, 1, 1, 1);
    print "      <INPUT type=hidden name=continuation value=\"{$cont}\">\n";
    print "      <div align=center>\n";
    print "      <INPUT type=submit value=\"" . i("Submit Changes") . "\">\n";
    print "      </div>\n";
    print "      </FORM>\n";
    print "      </fieldset>\n";
    print "      <div id=uiprefs class=shown>\n";
    print "      <fieldset>\n";
    print "      <legend>" . i("General Preferences") . "</legend>\n";
    print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post ";
    print "onsubmit=\"return validatePublicKeys();\">\n";
    $cdata = array();
    if ($user['showallgroups']) {
        $selected['affiliation'] = '';
        $selected['allgroups'] = 'checked';
    } else {
        $selected['affiliation'] = 'checked';
        $selected['allgroups'] = '';
    }
    print "      <p>" . i("View User Groups:") . "<br>\n";
    print "      <INPUT type=radio id=r1 name=groupview value=affiliation ";
    print "{$selected['affiliation']}" . "><label for=r1>" . i("matching my affiliation");
    print "</label><br>\n";
    print "      <INPUT type=radio id=r2 name=groupview value=allgroups ";
    print "{$selected['allgroups']}" . "><label for=r2>" . i("from all affiliations");
    print "</label></p>\n";
    if ($user['emailnotices']) {
        $selected['enabled'] = 'checked';
        $selected['disabled'] = '';
    } else {
        $selected['enabled'] = '';
        $selected['disabled'] = 'checked';
    }
    print "      <p>" . i("Send email notifications about reservations:") . "<br>\n";
    print "      <INPUT type=radio id=r3 name=emailnotify value=2 ";
    print "{$selected['enabled']}" . "><label for=r3>" . i("Enabled");
    print "</label><br>\n";
    print "      <INPUT type=radio id=r4 name=emailnotify value=1 ";
    print "{$selected['disabled']}" . "><label for=r4>" . i("Disabled");
    print "</label></p>\n";
    ###########################
    # temporary
    if (!array_key_exists('usepublickeys', $user)) {
        $user['usepublickeys'] = 0;
        $_SESSION['user']['usepublickeys'] = 0;
        $user['sshpublickeys'] = '';
        $_SESSION['user']['sshpublickeys'] = '';
    }
    # end temporary
    ###########################
    if ($user['usepublickeys']) {
        $selected['enabled'] = 'checked';
        $selected['disabled'] = '';
    } else {
        $selected['enabled'] = '';
        $selected['disabled'] = 'checked';
    }
    print "      <p>" . i("Use public key authentication for SSH logins:") . "<br>\n";
    print "      <INPUT type=radio id=r5 name=pubkeyauth value=2 ";
    print "{$selected['enabled']} onclick=\"togglePubKeys(1);\"><label for=r5>";
    print i("Enabled") . "</label><br>\n";
    print "      <INPUT type=radio id=r6 name=pubkeyauth value=1 ";
    print "{$selected['disabled']} onclick=\"togglePubKeys(0);\"><label for=r6>";
    print i("Disabled") . "</label><br><br>\n";
    print "      " . i("Public keys:") . "<br>\n";
    print "      <div style=\"width: 300px;\" id=\"pubkeyerr\" ";
    print "class=\"hidden\">";
    print "<font color=\"red\"><em>\n      ";
    print i("Public keys can only contain letters, numbers, spaces, and these characters: + / @ . =");
    print "</em></font></div>\n";
    print "      <textarea id=\"pubkeys\" dojoType=\"dijit.form.Textarea\" ";
    print "name=\"pubkeys\" style=\"width: 27em;\"";
    if (!$user['usepublickeys']) {
        print " disabled=\"disabled\"";
    }
    print ">{$user['sshpublickeys']}</textarea><br><br>\n";
    print "<strong>" . i("NOTE:") . "</strong> ";
    $h = "      " . i("Images using network storage (such as AFS) may not work well with public key authentication. In some cases, you may still be prompted for a password. In other cases, you may need to run additional commands after logging in to gain access to the network storage.");
    print preg_replace("/(.{1,55}([ \n]|\$))/", '\\1<br>', $h) . "\n";
    print "      </p>\n";
    $cont = addContinuationsEntry('submitgeneralprefs', $cdata, SECINDAY, 1, 0);
    print "      <INPUT type=hidden name=continuation value=\"{$cont}\">\n";
    print "      <INPUT type=submit value=\"" . i("Submit General Preferences") . "\">\n";
    print "      </FORM>\n";
    print "      </fieldset>\n";
    print "      </div>\n";
    print "    </TD>\n";
    print "  </TR>\n";
    print "</table>\n";
    printUserprefJavascript();
}
Ejemplo n.º 2
0
function userpreferences()
{
    global $user, $submitErr, $viewmode, $mode;
    if ($submitErr) {
        $data = processUserPrefsInput(0);
        $data['affiliation'] = $user['affiliation'];
    } else {
        $data = $user;
        if ($data["width"] == 0) {
            $data["resolution"] = "Full Screen";
        } else {
            $data["resolution"] = $user["width"] . "x" . $user["height"];
        }
    }
    $adminleveldeveloper = 0;
    if ($user['adminlevelid'] == ADMIN_DEVELOPER) {
        $adminleveldeveloper = 1;
    }
    print "<H2 align=center>User Preferences</H2>\n";
    print "<div align=center id=status class=visible>\n";
    if ($mode == "submituserprefs") {
        print "<font color=green>User preferences successfully updated</font><br>\n";
    }
    print "</div>\n";
    print "<table id=layouttable summary=\"\">\n";
    print "  <TR>\n";
    print "    <TD>\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";
    print "      <li><a href=#rdpfile onclick=\"";
    print "show('rdpfile'); return false;\">RDP&nbsp;File&nbsp;Preferences</a>";
    print "</li>\n";
    print "      <li><a href=#uiprefs onclick=\"javascript:show('uiprefs'); ";
    print "return false\">General&nbsp;Preferences</a></li>\n";
    if ($adminleveldeveloper) {
        print "      <li><a href=#viewmode onclick=\"javascript:";
        print "show('viewmode'); return false\">View&nbsp;Mode</a></li>\n";
    }
    print "      </ul>\n";
    print "      </div>\n";
    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";
    }
    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 "      <legend>RDP</legend>\n";
    print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
    print "      <table summary=\"lists adjustable preferences for the RDP ";
    print "file that is sent when you click the Get RDP File button on the ";
    print "Connect! page\">\n";
    print "        <TR>\n";
    print "          <TD colspan=3><small>Try decreasing <em>Resolution</em> or <em>";
    print "Color Depth</em> to<br>speed up your connection if things seem ";
    print "slow<br>when connected to a remote computer.</small></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>Resolution:</TH>\n";
    $resolutionArray = array("Full Screen" => "Full Screen", "1920x1440" => "1920x1440", "1600x1200" => "1600x1200", "1280x1024" => "1280x1024", "1152x864" => "1152x864", "1024x768" => "1024x768", "800x600" => "800x600", "640x480" => "640x480", "1680x1050" => "1680x1050", "1600x1024" => "1600x1024", "1440x900" => "1440x900", "1280x854" => "1280x854", "1280x768" => "1280x768", "1024x576" => "1024x576");
    print "          <TD>\n";
    printSelectInput("resolution", $resolutionArray, $data["resolution"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>Color Depth:</TH>\n";
    print "          <TD>\n";
    #$colordepth = array("8" => "8", "16" => "16", "24" => "24");
    $colordepth = array("8" => "8", "16" => "16", "24" => "24", "32" => "32 (Vista only)");
    printSelectInput("bpp", $colordepth, $data["bpp"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>Audio:</TH>\n";
    print "          <TD>\n";
    $audio = array("none" => "None", "local" => "Use my speakers");
    printSelectInput("audiomode", $audio, $data["audiomode"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>Map Local Drives:</TH>\n";
    print "          <TD>\n";
    $yesno = array(1 => "Yes", 0 => "No");
    printSelectInput("mapdrives", $yesno, $data["mapdrives"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>Map Local Printers:</TH>\n";
    print "          <TD>\n";
    printSelectInput("mapprinters", $yesno, $data["mapprinters"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "        <TR>\n";
    print "          <TH align=right>Map Local Serial Ports:</TH>\n";
    print "          <TD>\n";
    printSelectInput("mapserial", $yesno, $data["mapserial"]);
    print "          </TD>\n";
    print "          <TD></TD>\n";
    print "        </TR>\n";
    print "      </table>\n";
    $cont = addContinuationsEntry('confirmrdpprefs', 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 "      <div id=uiprefs class=visible>\n";
    print "      <fieldset>\n";
    print "      <legend>General Preferences</legend>\n";
    print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
    $cdata = array();
    if (in_array("userGrant", $user["privileges"])) {
        if ($user['showallgroups']) {
            $selected['affiliation'] = '';
            $selected['allgroups'] = 'checked';
        } else {
            $selected['affiliation'] = 'checked';
            $selected['allgroups'] = '';
        }
        print "      <p>View User Groups:<br>\n";
        print "      <INPUT type=radio id=r1 name=groupview value=affiliation ";
        print "{$selected['affiliation']}><label for=r1>matching my affiliation";
        print "</label><br>\n";
        print "      <INPUT type=radio id=r2 name=groupview value=allgroups ";
        print "{$selected['allgroups']}><label for=r2>from all affiliations";
        print "</label></p>\n";
    } else {
        $cdata['groupview'] = 'affiliation';
    }
    if ($user['emailnotices']) {
        $selected['enabled'] = 'checked';
        $selected['disabled'] = '';
    } else {
        $selected['enabled'] = '';
        $selected['disabled'] = 'checked';
    }
    print "      <p>Send email notifications about reservations:<br>\n";
    print "      <INPUT type=radio id=r3 name=emailnotify value=2 ";
    print "{$selected['enabled']}><label for=r3>Enabled";
    print "</label><br>\n";
    print "      <INPUT type=radio id=r4 name=emailnotify value=1 ";
    print "{$selected['disabled']}><label for=r4>Disabled";
    print "</label></p>\n";
    $cont = addContinuationsEntry('submitgeneralprefs', $cdata, SECINDAY, 1, 0);
    print "      <INPUT type=hidden name=continuation value=\"{$cont}\">\n";
    print "      <INPUT type=submit value=\"Submit General Preferences\">\n";
    print "      </FORM>\n";
    print "      </fieldset>\n";
    print "      </div>\n";
    print "      <div id=viewmode class=visible>\n";
    if ($adminleveldeveloper) {
        print "      <fieldset>\n";
        print "      <legend>View Mode</legend>\n";
        print "      <FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
        if ($viewmode == ADMIN_FULL) {
            $selected[ADMIN_NONE] = "";
            $selected[ADMIN_FULL] = "checked";
            $selected[ADMIN_DEVELOPER] = "";
        } elseif ($viewmode == ADMIN_DEVELOPER) {
            $selected[ADMIN_NONE] = "";
            $selected[ADMIN_FULL] = "";
            $selected[ADMIN_DEVELOPER] = "checked";
        } else {
            $selected[ADMIN_NONE] = "checked";
            $selected[ADMIN_FULL] = "";
            $selected[ADMIN_DEVELOPER] = "";
        }
        if ($user["adminlevelid"] != ADMIN_NONE) {
            print "      <p>View site as:<br>\n";
            print "      <INPUT type=radio name=viewmode value=" . ADMIN_NONE . " ";
            print $selected[ADMIN_NONE] . ">Normal User<br>\n";
            if ($user["adminlevel"] == "full" || $user["adminlevel"] == "developer") {
                print "      <INPUT type=radio name=viewmode value=" . ADMIN_FULL . " ";
                print $selected[ADMIN_FULL] . ">Admin Level<br>\n";
            }
            if ($user["adminlevel"] == "developer") {
                print "      <INPUT type=radio name=viewmode value=" . ADMIN_DEVELOPER . " ";
                print $selected[ADMIN_DEVELOPER] . ">Developer Level<br>\n";
            }
            print "      </p>\n";
        }
        print "      View As User: <INPUT type=text name=viewasuser  ";
        if (!array_key_exists('unityid', $data)) {
            print "size=20 value=\"{$user["unityid"]}@{$user['affiliation']}\">\n";
        } else {
            print "size=20 value=\"{$data["unityid"]}@{$data['affiliation']}\">\n";
        }
        printSubmitErr(VIEWASUSERERR);
        print "<br>\n";
        $cont = addContinuationsEntry('submitviewmode', array(), SECINDAY, 1, 0);
        print "      <INPUT type=hidden name=continuation value=\"{$cont}\">\n";
        print "      <INPUT type=submit value=\"Submit View Mode\">\n";
        print "      </FORM>\n";
        print "      </fieldset>\n";
    }
    print "      </div>\n";
    print "    </TD>\n";
    print "  </TR>\n";
    print "</table>\n";
    printUserprefJavascript();
}