Author: jfthomps
Date: Tue Mar 17 17:19:29 2009
New Revision: 755329
URL: http://svn.apache.org/viewvc?rev=755329&view=rev
Log:
VCL-29
utils.php:
modified getVMProfiles: added username and password to returned data
vm.php:
modified editVMInfo: added rows under profile section for editing the username
and password associated with the profile
modified AJupdateVMprofileItem: added code specific to handling the password
field
vm.js:
modified getVMprofileDataCB: added code to handle username and password
modified updateProfile: added code to handle specifics of saving the profile
password
added checkProfilePassword
Modified:
incubator/vcl/trunk/web/.ht-inc/utils.php
incubator/vcl/trunk/web/.ht-inc/vm.php
incubator/vcl/trunk/web/js/vm.js
Modified: incubator/vcl/trunk/web/.ht-inc/utils.php
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=755329&r1=755328&r2=755329&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Tue Mar 17 17:19:29 2009
@@ -7778,6 +7778,8 @@
/// \b virtualswitch1 - name of second virtual switch\n
/// \b vmdisk - "localdisk" or "networkdisk" - whether or not vm files are
/// stored on local disk or network attached storage
+/// \b username - vmware username associated with this profile\n
+/// \b password - vmware password associated with this profile
///
/// \brief gets information about vm profiles and returns it as an array
///
@@ -7794,7 +7796,9 @@
. "vp.vmpath, "
. "vp.virtualswitch0, "
. "vp.virtualswitch1, "
- . "vp.vmdisk "
+ . "vp.vmdisk, "
+ . "vp.username, "
+ . "vp.password "
. "FROM vmprofile vp "
. "LEFT JOIN vmtype vt ON (vp.vmtypeid = vt.id) "
. "LEFT JOIN image i ON (vp.imageid = i.id)";
Modified: incubator/vcl/trunk/web/.ht-inc/vm.php
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/vm.php?rev=755329&r1=755328&r2=755329&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/vm.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/vm.php Tue Mar 17 17:19:29 2009
@@ -234,6 +234,33 @@
print " <th align=right>VM Disk:</th>\n";
print " <td><select id=pvmdisk
dojoType=\"dijit.form.FilteringSelect\" searchAttr=\"name\"
onchange=\"updateProfile('pvmdisk', 'vmdisk');\"></span></td>\n";
print " </tr>\n";
+ print " <tr>\n";
+ print " <th align=right>Username:</th>\n";
+ print " <td><span id=pusername dojoType=\"dijit.InlineEditBox\"
onChange=\"updateProfile('pusername', 'username');\"></span></td>\n";
+ print " </tr>\n";
+ print " <tr>\n";
+ print " <th align=right>Password:</th>\n";
+ print " <td><input type=password id=ppassword
onkeyup=\"checkProfilePassword();\"></input></td>\n";
+ print " </tr>\n";
+ print " <tr>\n";
+ print " <th align=right>Confirm:</th>\n";
+ print " <td>\n";
+ print " <input type=password id=ppwdconfirm
onkeyup=\"checkProfilePassword();\"></input>\n";
+ print " <span id=ppwdmatch></span>\n";
+ print " </td>\n";
+ print " </tr>\n";
+ print " <tr>\n";
+ print " <td></td>\n";
+ print " <td>\n";
+ print " <button dojoType=\"dijit.form.Button\"
id=\"savePwdBtn\">\n";
+ print " Save Password\n";
+ print " <script type=\"dojo/method\" event=onClick>\n";
+ print " updateProfile('ppassword', 'password');\n";
+ print " </script>\n";
+ print " </button>\n";
+ print " <span id=savestatus></span>\n";
+ print " </td>\n";
+ print " </tr>\n";
print "</table>\n";
print "</div>\n";
print "</div>\n";
@@ -763,14 +790,16 @@
}
$profileid = processInputVar('profileid', ARG_NUMERIC);
$item = processInputVar('item', ARG_STRING);
- $newvalue = processInputVar('newvalue', ARG_STRING);
+ if($item == 'password')
+ $newvalue = $_POST['newvalue'];
+ else
+ $newvalue = processInputVar('newvalue', ARG_STRING);
if($newvalue == '')
$newvalue2 = 'NULL';
else {
- if(get_magic_quotes_gpc()) {
- $newvalue2 = stripslashes($newvalue);
- $newvalue2 = mysql_escape_string($newvalue2);
- }
+ if(get_magic_quotes_gpc())
+ $newvalue = stripslashes($newvalue);
+ $newvalue2 = mysql_escape_string($newvalue);
$newvalue2 = "'$newvalue2'";
}
@@ -781,6 +810,11 @@
. "SET `$item` = $newvalue2 "
. "WHERE id = $profileid";
doQuery($query, 101);
+ if($item == 'password') {
+ print "document.getElementById('savestatus').innerHTML =
'Saved'; ";
+ print "setTimeout(function()
{document.getElementById('savestatus').innerHTML = '';}, 3000); ";
+ }
+ $newvalue = preg_replace("/'/", "\\'", $newvalue);
print "curprofile.$item = '$newvalue';";
}
Modified: incubator/vcl/trunk/web/js/vm.js
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/js/vm.js?rev=755329&r1=755328&r2=755329&view=diff
==============================================================================
--- incubator/vcl/trunk/web/js/vm.js (original)
+++ incubator/vcl/trunk/web/js/vm.js Tue Mar 17 17:19:29 2009
@@ -564,6 +564,7 @@
dijit.byId('pvmpath').noValueIndicator = '(empty)';
dijit.byId('pvs0').noValueIndicator = '(empty)';
dijit.byId('pvs1').noValueIndicator = '(empty)';
+ dijit.byId('pusername').noValueIndicator = '(empty)';
dijit.byId('pname').setValue(curprofile.name);
dijit.byId('pnasshare').setValue(curprofile.nasshare);
@@ -571,6 +572,10 @@
dijit.byId('pvmpath').setValue(curprofile.vmpath);
dijit.byId('pvs0').setValue(curprofile.virtualswitch0);
dijit.byId('pvs1').setValue(curprofile.virtualswitch1);
+ dijit.byId('pusername').setValue(curprofile.username);
+ document.getElementById('ppassword').value = curprofile.password;
+ document.getElementById('ppwdconfirm').value = curprofile.password;
+ checkProfilePassword();
document.getElementById('vmprofiledata').className = 'shown';
document.body.style.cursor = 'default';
}
@@ -692,9 +697,14 @@
}
function updateProfile(id, field) {
- var newvalue = dijit.byId(id).value;
+ if(dijit.byId(id))
+ var newvalue = dijit.byId(id).value;
+ else
+ var newvalue = document.getElementById(id).value;
if(curprofile[field] == newvalue)
return;
+ if(field == 'password')
+ document.getElementById('savestatus').innerHTML = 'Saving...';
document.body.style.cursor = 'wait';
var profileid = document.getElementById('profileid').value;
@@ -718,3 +728,19 @@
eval(data);
document.body.style.cursor = 'default';
}
+
+function checkProfilePassword() {
+ var pobj = document.getElementById('ppassword');
+ var cobj = document.getElementById('ppwdconfirm');
+ var mobj = document.getElementById('ppwdmatch');
+
+ if(pobj.value == "" && cobj.value == "") {
+ mobj.innerHTML = '';
+ }
+ else if(pobj.value == cobj.value) {
+ mobj.innerHTML = '<font color="#008000">match</font>';
+ }
+ else {
+ mobj.innerHTML = '<font color="red">no match</font>';
+ }
+}