Author: jfthomps
Date: Fri Oct 3 19:06:17 2014
New Revision: 1629291
URL: http://svn.apache.org/r1629291
Log:
VCL-253 - Allow users to specify RDP port
userpreferences.php:
-added RDPPORTERR
-modified userpreferences: changed 'RDP File Preferences' to 'RDP Preferences';
added input for setting rdp port
-modified confirmUserPrefs: changed 'RDP File Preferences' to 'RDP
Preferences'; added confirm for rdp port
-modified submitUserPrefs: removed 'if' wrapping call to updateUserPrefs which
didn't do anything; added rdpport to data passed to updateUserPrefs
-modified processUserPrefsInput: added rdpport
-modified printUserprefJavascript: if no error for 'personal' section and there
is an error for rdpport, print js to show rdpfile section
utils.php:
-modified getUserInfo: added rdpport to returned data
-modified updateUserPrefs: added $rdpport argument and setting rdpport in query
Modified:
vcl/trunk/web/.ht-inc/userpreferences.php
vcl/trunk/web/.ht-inc/utils.php
Modified: vcl/trunk/web/.ht-inc/userpreferences.php
URL:
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/userpreferences.php?rev=1629291&r1=1629290&r2=1629291&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/userpreferences.php (original)
+++ vcl/trunk/web/.ht-inc/userpreferences.php Fri Oct 3 19:06:17 2014
@@ -28,6 +28,8 @@ define("WIDTHERR", 1 << 1);
define("HEIGHTERR", 1 << 2);
/// signifies an error with submitted new password
define("LOCALPASSWORDERR", 1 << 3);
+/// signifies an error with submitted rdpport
+define("RDPPORTERR", 1 << 4);
////////////////////////////////////////////////////////////////////////////////
///
@@ -70,7 +72,7 @@ function userpreferences() {
print "</li>\n";
}
print " <li><a href=#rdpfile onclick=\"";
- print _("show('rdpfile'); return
false;\">RDP File Preferences</a>");
+ print _("show('rdpfile'); return false;\">RDP Preferences</a>");
print "</li>\n";
print " <li><a href=#uiprefs onclick=\"javascript:show('uiprefs');
";
print _("return false\">General Preferences</a></li>\n");
@@ -174,7 +176,7 @@ function userpreferences() {
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 "Connect! page and the port on which RDP is listening\">\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
");
@@ -239,6 +241,16 @@ function userpreferences() {
print " </TD>\n";
print " <TD></TD>\n";
print " </TR>\n";
+ print " <TR>\n";
+ print " <TH align=right>" . _("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";
@@ -393,7 +405,7 @@ function confirmUserPrefs($type) {
}
}
elseif($type == 1) {
- print _("<H2>RDP File Preferences</H2>\n");
+ print _("<H2>RDP Preferences</H2>\n");
print _("<H3>Submit the following changes?</H3>\n");
print "<table>\n";
print " <TR>\n";
@@ -421,6 +433,10 @@ function confirmUserPrefs($type) {
print _(" <TH align=right>Map Local Serial Ports:</TH>\n");
print " <TD>$serial</TD>\n";
print " </TR>\n";
+ print " <TR>\n";
+ print " <TH align=right>" . _("RDP Port") . ":</TH>\n";
+ print " <TD>{$data['rdpport']}</TD>\n";
+ print " </TR>\n";
print "</table>\n";
}
print "<table>\n";
@@ -465,10 +481,9 @@ function submitUserPrefs() {
$height = 0;
}
}
- if(updateUserPrefs($user['id'], $data["preferredname"], $width,
$height,
- $data["bpp"], $data["audiomode"], $data["mapdrives"],
- $data["mapprinters"], $data["mapserial"])) {
- }
+ updateUserPrefs($user['id'], $data["preferredname"], $width, $height,
+ $data["bpp"], $data["audiomode"], $data["mapdrives"],
+ $data["mapprinters"], $data["mapserial"],
$data['rdpport']);
if($user['affiliation'] == 'Local' &&
! empty($data['newpassword'])) {
$query = "SELECT l.salt "
@@ -590,6 +605,7 @@ function processUserPrefsInput($checks=1
$return["mapdrives"] = processInputVar("mapdrives" , ARG_NUMERIC,
$user["mapdrives"]);
$return["mapprinters"] = processInputVar("mapprinters" , ARG_NUMERIC,
$user["mapprinters"]);
$return["mapserial"] = processInputVar("mapserial" , ARG_NUMERIC,
$user["mapserial"]);
+ $return["rdpport"] = processInputVar("rdpport" , ARG_NUMERIC,
$user["rdpport"]);
if(! $checks) {
return $return;
@@ -624,6 +640,10 @@ function processUserPrefsInput($checks=1
$submitErrMsg[LOCALPASSWORDERR] = _("Passwords do not
match");
}
}
+ if($return['rdpport'] < 1024 || $return['rdpport'] > 65535) {
+ $submitErr |= RDPPORTERR;
+ $submitErrMsg[RDPPORTERR] = _("RDP Port must be between 1024
and 65535");
+ }
return $return;
}
@@ -635,6 +655,7 @@ function processUserPrefsInput($checks=1
///
////////////////////////////////////////////////////////////////////////////////
function printUserprefJavascript() {
+ global $submitErr;
print <<<HTMLdone
<script type="text/javascript">
function show(id) {
@@ -664,7 +685,15 @@ function togglePubKeys(mode) {
else
dijit.byId('pubkeys').set('disabled', true);
}
-show("personal");
+
+HTMLdone;
+ if(! ($submitErr & PREFNAMEERR) &&
+ ! ($submitErr & LOCALPASSWORDERR) &&
+ ($submitErr & RDPPORTERR))
+ print "show(\"rdpfile\");\n";
+ else
+ print "show(\"personal\");\n";
+ print <<<HTMLdone
document.getElementById("preflinks").className = "shown";
document.getElementById("status").className = "visible";
</script>
Modified: vcl/trunk/web/.ht-inc/utils.php
URL:
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/utils.php?rev=1629291&r1=1629290&r2=1629291&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/utils.php (original)
+++ vcl/trunk/web/.ht-inc/utils.php Fri Oct 3 19:06:17 2014
@@ -3534,6 +3534,7 @@ function processInputData($data, $type,
/// \b mapdrives - 0 or 1 - map drives for rdp files; 1 means to map\n
/// \b mapprinters - 0 or 1 - map printers for rdp files; 1 means to map\n
/// \b mapserial - 0 or 1 - map serial ports for rdp files; 1 means to map\n
+/// \b rdpport - preferred port for RDP\n
/// \b showallgroups - 0 or 1 - show only user groups matching user's
/// affiliation or show all user groups\n
/// \b lastupdated - datetime the information was last updated\n
@@ -3574,6 +3575,7 @@ function getUserInfo($id, $noupdate=0, $
. "u.mapdrives AS mapdrives, "
. "u.mapprinters AS mapprinters, "
. "u.mapserial AS mapserial, "
+ . "COALESCE(u.rdpport, 3389) AS rdpport, "
. "u.showallgroups, "
. "u.lastupdated AS lastupdated, "
. "u.usepublickeys, "
@@ -3832,7 +3834,7 @@ function addUser($loginid) {
////////////////////////////////////////////////////////////////////////////////
///
/// \fn updateUserPrefs($userid, $preferredname, $width, $height, $bpp, $audio,
-/// $mapdrives, $mapprinters, $mapserial)
+/// $mapdrives, $mapprinters, $mapserial, $rdpport)
///
/// \param $userid - id from user table
/// \param $preferredname - user's preferred name
@@ -3843,6 +3845,7 @@ function addUser($loginid) {
/// \param $mapdrives - 0 or 1 - 1 to map local drives in rdp files
/// \param $mapprinters - 0 or 1 - 1 to map printers in rdp files
/// \param $mapserial - 0 or 1 - 1 to map serial ports in rdp files
+/// \param $rdpport - port for RDP to listen on
///
/// \return number of rows affected by update (\b NOTE: this may be 0 if none
/// of the values were actually changes
@@ -3851,10 +3854,12 @@ function addUser($loginid) {
///
////////////////////////////////////////////////////////////////////////////////
function updateUserPrefs($userid, $preferredname, $width, $height, $bpp,
$audio,
- $mapdrives, $mapprinters, $mapserial) {
+ $mapdrives, $mapprinters, $mapserial, $rdpport) {
global $mysql_link_vcl;
$preferredname = mysql_real_escape_string($preferredname);
$audio = mysql_real_escape_string($audio);
+ if($rdpport == 3389)
+ $rdpport = 'NULL';
$query = "UPDATE user SET "
. "preferredname = '$preferredname', "
. "width = '$width', "
@@ -3863,7 +3868,8 @@ function updateUserPrefs($userid, $prefe
. "audiomode = '$audio', "
. "mapdrives = $mapdrives, "
. "mapprinters = $mapprinters, "
- . "mapserial = $mapserial "
+ . "mapserial = $mapserial, "
+ . "rdpport = $rdpport "
. "WHERE id = $userid";
doQuery($query, 270);
return mysql_affected_rows($mysql_link_vcl);