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 2014/09/11 18:01:49 UTC

svn commit: r1624325 [1/13] - in /vcl/trunk/web: ./ .ht-inc/ .ht-inc/authmethods/ css/ js/ js/resources/

Author: jfthomps
Date: Thu Sep 11 16:01:48 2014
New Revision: 1624325

URL: http://svn.apache.org/r1624325
Log:
VCL-5 - multiple web servers
VCL-552 - create an easy way to view deleted computers
VCL-555 - need a way to give users access to add management nodes
VCL-559 - convert pages with large tables to use dojo datagrids
VCL-568 - refresh current reservations page 15 minutes after a reservation becomes available
VCL-584 - Extend features of Server loads - only added specify IP address and offline capture
VCL-592 - honor user preference to only show user groups matching user's affiliation on server profile pages
VCL-669 - ssh identity keys for end-users
VCL-673 - imaging reservation for an image with subimages prompts for revisions for each subimage
VCL-690 - There is no default selection on Manage computer
VCL-694 - problem with conditional in editOrAddComputer - $data['compid'] can be used when adding a computer
VCL-730 - cannot update image revision comments under Edit Image
VCL-733 - editing a block allocation recreates past block time entries
VCL-741 - a tomaintenance reservation can be created right after another tomaintenance reservation
VCL-742 - server reservations cannot be modified if they cannot be extended
VCL-776 - rework resource code to have a base class for all resources and inheriting classes for each resource type
VCL-778 - add graph for seeing historical usage of block allocations
VCL-779 - add method to dashboard for restarting failed imaging reservations

(sorry for the massive commit)

added resource.php, computer.php, config.php, image.php, managementnode.php, schedule.php, and storebackend.php: these are a rewrite of how resources are handled. resource.php is a base class with basic functionality common to all resources. the other files are inheriting classes that implement things specific to each resource
removed computers.php, images.php, managementnodes.php, and schedules.php: these are the older files that handled managing resources are replaced by the files above
added siteconfig.php

authentication.php: changed call to semUnlock to cleanSemaphore

ldapauth.php:
-modified validateLDAPUser: added test to see if ldap server is responding using fsockopen so that there is a faster response for offline servers
-modified updateLDAPUser: added extra check for getting user data from database when uid in db is NULL, auth method provides a numericid, and unityid and affiliationid match an entry in db
-modified updateLDAPUser: get usepublickeys and sshpublickeys from user table

shibauth.php: modified updateShibGroups: changed $groups argument to allow for optional 2nd case of passing an array with a single entry with a key of 'shibaffil' and a value that matches the shibname entry from the affiliation table. in this case, the user is simply added to a single group named "All <affil name> users" where <affil name> is the name value from the affiliation table

blockallocations.php:
-modified createListBlockData: fixed recreating old time slots when editing an allocation
-modified getCurrentBlockHTML: added link to show historical usage of block allocation and dijit dialog for displaying it
-added AJviewBlockAllocationUsage

conf-default.php:
-added MAXINITIALIMAGINGTIME
-added MAXSUBIMAGES

dashboard.php:
-added section for seeing failed imaging reservations if user has global view dashboard permission; allows an admin to easily restart an imaging reservation after fixing whatever caused it to fail
-added "in use" computers to current status section
-changed "Loading Reservations" to "Notable Reservations" and included any reservations that have started to be loaded that have a start time within the next hour to handle showing preloading reservations

errors.php:
-added error code 400 for reporting semaphore expiration problem which would be caused by a really sluggish web server
-modified errorHandler to use new semaphore calls

groups.php:
-modified check for blockRequest table to only check for user group usage if block status is requested or accepted. removed check in imagemeta table (not sure why that was there, not currently a usergroupid field in imagemeta table)
-modified submitDeleteGroup - added query to update blockrequests to set groupid to 0 if deleting the selected user group

privileges.php:
-modified userLookup: added IP address assigned to node to reservation history. added list of current reservations
-modified jsonGetUserGroupMembers - allow users with Manage Federated User Groups to see user group membership for federated groups
-modified jsonGetResourceGroupMembers - no longer include deleted images and computers in list

requests.php:
-large rewrite to combine "New Reservations" and "Current Reservations" pages into a single, more dynamic page
-updated to use new semaphore code
-updated calls to isAvailable to include $holdcomps argument
-moved making server reservations from serverprofiles.php to here
-added option to keep reservation and create image
-fixed bug where user was prompted for image revisions for every subimage assigned to an image when making an imaging reservation
-fixed bug where all user group showed up in server reservation selection of admin and access user groups even when user preference to only see groups matching user's affiliation was set
-modifed places where string of text is wrapped at 50 characters to wrap at end of line in addition to space and newline

serverprofiles.php:
-moved deploy code to requests.php
-modified manageProfilesHTML: added netmask, router, and dns servers to go along with fixedIP and a boxed area around fixedIP fields
-modified AJserverProfileData, AJsaveServerProfile, and procesProfileInput: include netmask, router, and dns
-moved getServerProfiles and getServerProfileImages to utils.php
-added AJfetchRouterDNS

sitemaintenance.php: modifed places where string of text is wrapped at 50 characters to wrap at end of line in addition to space and newline

states.php:
-added to entry array: resource, config, image, computer, managementnode, schedule, RESTresourceBasic, RESTresourceDetail, siteconfig
-removed from entry array: newRequest, selectImageOption, viewSchedules, selectComputers, selectMgmtnodeOption, imageClickThrough
-added to noHTMLwrappers array: AJnewRequest, AJfilterCompGroups, AJfetchRouterDNS, AJviewBlockAllocationUsage, AJrestartImageCapture, jsonResourceStore, AJpromptToggleDeleteResource, AJsubmitToggleDeleteResource, AJsaveResource, AJeditResource, jsonResourceGroupingGroups, AJaddRemGroupResource, AJaddRemResourceGroup, jsonResourceGroupingResources, jsonResourceMappingMapToGroups, AJaddRemMapToGroup, jsonResourceMappingGroups, AJaddRemGroupMapTo, jsonConfigMapStore, AJeditConfigMapping, AJsaveConfigMapping, AJdeleteConfigMapping, AJsubmitDeleteConfigMapping, AJconfigSystem, RESTresourceBasic, RESTresourceDetail, AJstartImage, AJupdateImage, AJupdateTimeSource, AJreloadComputers, AJsubmitReloadComputers, AJdeleteComputers, AJsubmitDeleteComputers, AJcompScheduleChange, AJsubmitCompScheduleChange, AJgenerateDHCPdata, AJhostsData, AJcompStateChange, AJcompProvisioningChange, AJsubmitCompProvisioningChange, AJsubmitCompStateChange, AJsubmitComputerStateLater, AJconnectRequest
-removed from noHTMLwrappers: submitRequest, submitTestProd, AJupdateImage, jsonImageGroupingImages, jsonImageGroupingGroups, jsonImageMapCompGroups, jsonImageMapImgGroups, AJaddImageToGroup, AJremImageFromGroup, AJaddGroupToImage, AJremGroupFromImage, imageGroupingGrid, AJaddCompGrpToImgGrp, AJremCompGrpFromImgGrp, AJaddImgGrpToCompGrp, AJremImgGrpFromCompGrp, imageMappingGrid, jsonCompGroupingComps, jsonCompGroupingGroups, compGroupingGrid, AJaddCompToGroup, AJremCompFromGroup, AJaddGroupToComp, AJremGroupFromComp, generateDHCP, AJgetScheduleTimesData, AJsaveScheduleTimes, AJdeployServer, AJgenerateUtilData, submitEdit
-combined newReservations and viewRequests into reservations section
-removed manageImages, manageSchedules, manageComputers, and managementNodes sections
-added siteconfig, resource, and storebackend sections

statistics.php: modified to have load time counts for <2 min, 2-6 min, 6-8min, >8 min

userpreferences.php: added input and validation of public key fields to general preferences

utils.php:
-changed how semaphores are handled as described in http://mail-archives.apache.org/mod_mbox/vcl-dev/201307.mbox/%3C2232243.J55CAxcd2y@treebeard%3E
-removed modes that are no longer used due to changing resources to be class based
-added 'variables' to the session cache
-modified doQuery: skip recording 'UPDATE continuations SET expiretime ...' queries in the queryLog; added a loop around actually doing the query that checks for mysql error 1213 9deadlock) that makes a few more attempts if encountered
-modified getOSList: added installtype to returned data
-modified getImages: added deleted and datedeleted to image revision data; added ostypeid and ostype to image data; include maxconcurrent, checkuser, and rootaccess for all images
-moved getServerProfiles and getServerProfileImages here from serverprofiles.php
-modified getImageConnectMethods and getProductionRevisionid: added extra argument $nostatic that, if true, will get the data from the db again even if it had already been retrieved
-modified getUserResources: if managementnodeAdmin is in $userprivs, also add mgmtnodeAdmin; remove noimage from returned data
-modified addOwnedResources and getResourcesFromGroups: changed series of if/elseif to switch statement
-modified getUserInfo: added usepublickeys and sshpublickeys to returned data
-modified getOverallUserPrivs: if mgmtNodeAdmin in $privileges, add managementnodeAdmin
-modified isAvailable: added $holdcomps argument that is then passed to allocComputer to get insert a semaphore in the database for allocated computers; added ipwarning to $requestInfo that records if there may be a possible IP conflict with requested fixed IP at deploy time for future reservations; if $imagerevisionid is not an array, make it in to one; instead of returning values directly, return them through debugIsAvailable to allow for debugging what isAvailable is return unavailable; added code to check for requested fixedIP being in use on a management node; added code to prevent block allocations from counting toward max concurrent usage of an image for users that are part of the group specified for the block allocation; added code to ensure a management node is able to configure a node with specified fixedIP; added checks part way through that goes ahead and returns 0 if no computers are available so that later unnecessary parts are not run; changed how VMs are ordered when 
 selecting from VMhostCheck temp table; added extra block that checks for use of requested fixed IP address
-added debugIsAvailable - function that provides a way for admins to debug why isAvailable is returning that the requested image is not available
-modified allocComputer: include calls to getSemaphore to hold computers for later scheduling
-added getSemaphore: adds entry to semaphore table to hold computer briefly so that other web server processes will not book the computer
-added retryGetSemaphore: function that loops through a few tries calling getSemaphore; useful when needing to do something with a specific computer
-modified addRequest: moved insertion of entry into changelog to much later in function; changed insert into reservation table to be an insert using a select from the semaphore table
-modified updateRequest: added "LIMIT 1" to query that updates reservation entry to fix a bug that causes strange behavior with cluster reservations
-modified deleteRequest: added code to delete any fixedIPsr* entries from the variable table for related server reservations
-modified moveReservationsOffComputer: calls to isAvailable result in computers being semaphore locked; calls to this function now need to call cleanSemaphore after calling this function
-added moveReservationsOffVMs
-modified getCompFinalReservationTime: added argument to allow passing an additional set of request states to ignore
-added getCompFinalVMReservationTime
-added getExistingChageStateStartTime
-added updateExistingToState
-added getProvisioningtypes
-modified getManagementNodes: added $includedeleted and $id arguments to make similar to other resources; added block to get timesource data from variable table
-added getMnsFromImage
-added checkAvailableNetworks
-modified findAvailableTimes: added linking in provisioningOSinstalltype to better limit which computers can be returned
-modified getComputers: changed returned name of currently loaded image to be prettyname instead of name; added vmhostcomputerid to returned data
-changed printSelectInput to selectInputHTML that returns a string of HTML instead of printing it; changed printSelectInput to be a wrapper that calls selectInputHTML and prints the returned string
-added selectInputAutoDigitHTML - determines if filtering select or regular dijit select should be used and calls selectInputHTML with appropriate arguments
-added labeledFormItem
-added dijitButton
-modified requestIsReady: removed currentstateid == 24 && computer stateid == 8
-modified sendRDPfile: when sending Administrator as the username check that OStype is windows in addition to being an imaging reservation
-added getResourceGroupName
-added getConfigTypes, getConfigDataTypes, getConfigMapTypes, getMappedConfigs, getMappedSubConfigs, getImageConfigVariables, getConfigClusters, getConfigClustersRec, and getConfigSubimages
-added getOStypes
-modified compareDashedNumbers: commented out returning based on difference in domains
-modified timeToNextReservation: updated to handle clusters better
-removed semLock and semUnlock
-added cleanSemaphore
-modified addContinuationsEntry: if HTTP_USER_AGENT exists in $_SERVER, include it in md5 for continuation id
-added getVariable, getVariablesRegex, setVariable, and deleteVariable
-added validateIPv4addr
-added validateEmailAddress
-modified xmlRPCabort: added mysql error number to returned error data
-added helpIcon
-added helpTooltip
-modified sendJSON: added $REST argument that causes to send only output of json_encode instead of wrapping it
-modified menulistLI: updated to handle resource classes
-modified getNavMenu: collapsed "New Reservation" and "Current Reservations" and updated for new resource classes; added Site Configuration section
-modified getDojoHTML: removed old modes and added new modes to match resource class modes; added sections for siteconfig

vm.php:
-modified editVMInfo: added sorting of profiles
-modified updateVMlimit: removed redundant javascript alert when user does not have access to manage host
-modified AJvmFromHost: updated to use new semaphore code

xmlrpcWrappers.php:
-updated calls to isAvailable to include holdcomps argument
-modified XMLRPCdeployServer: changed to require serverCheckOut permission instead of serverProfileAdmin
-modified XMLRPCgetRequestIds: added 'admin' to returned data which is if the user is an admin of a server reservation or not
-modified XMLRPCextendRequest and XMLRPCsetRequestEnding: use new semaphore code
-modified XMLRCPautoCapture: use new image resource code
-modified XMLRCPaddNode: fixed bug where $tmp was checked for being NULL instead of $nodeInfo
-modified XMLRCPaddUserGroupPriv: fixed a few bugs
-modified XMLRCPeditUserGroup: fixed a bug in a query where a comma was missing
-modified XMLRPCprocessBlockTime: USE NEW SEMAPHORE CODE





vcl.css:
-added html and body sections that set width and height to 100%
-added ready and wait classes that set the font color
-added gridcontainer table th, gridcontainer table td, extrafiltersdiv table th, extrafiltersdiv table td to section that sets font size to 1em
-added .editmntable, #deployprofilediv table, #serverprofiledata table
-added .boxedtablerows
-added #systemconfigdiv .dojoxMultiSelectSelectedOption, #groupbyresourcediv .dojoxMultiSelectSelectedOption, #groupbygroupdiv .dojoxMultiSelectSelectedOption, #mapbyresgroupdiv .dojoxMultiSelectSelectedOption, #mapbymaptogroupdiv .dojoxMultiSelectSelectedOption
-added #systemconfigdiv .dojoxGridHeader, #groupbyresourcediv .dojoxGridHeader, #groupbygroupdiv .dojoxGridHeader, #mapbyresgroupdiv .dojoxGridHeader, #mapbymaptogroupdiv .dojoxGridHeader, #configvariablegriddiv .dojoxGridHeader
-added #systemconfigdiv .dojoxGrid, #groupbyresourcediv .dojoxGrid, #groupbygroupdiv .dojoxGrid, #mapbyresgroupdiv .dojoxGrid, #mapbymaptogroupdiv .dojoxGrid, #subimagegriddiv .dojoxGrid, #configvariablegriddiv .dojoxGrid
-added #systemconfigdiv .dojoxGridRow, #systemconfigdiv .dojoxGridRowOdd, #groupbyresourcediv .dojoxGridRow, #groupbyresourcediv .dojoxGridRowOdd, #groupbygroupdiv .dojoxGridRow, #groupbygroupdiv .dojoxGridRowOdd, #mapbyresgroupdiv .dojoxGridRow, #mapbyresgroupdiv .dojoxGridRowOdd, #mapbymaptogroupdiv .dojoxGridRow, #mapbymaptogroupdiv .dojoxGridRowOdd, #subimagegriddiv .dojoxGridRow, #subimagegriddiv .dojoxGridRowOdd, #configvariablegriddiv .dojoxGridRow, #configvariablegriddiv .dojoxGridRowOdd
-added #content #systemconfigdiv table, #content #groupbyresourcediv table, #content #groupbygroupdiv table, #content #mapbyresgroupdiv table, #content #mapbymaptogroupdiv table, #content #subimagegriddiv table, #content #configvariablegriddiv table
-added #systemconfigdiv .dojoxGridRowSelected, #groupbyresourcediv .dojoxGridRowSelected, #groupbygroupdiv .dojoxGridRowSelected, #mapbyresgroupdiv .dojoxGridRowSelected, #mapbymaptogroupdiv .dojoxGridRowSelected, #subimagegriddiv .dojoxGridRowSelected, #configvariablegriddiv .dojoxGridRowSelected
-added #systemconfigdiv .dojoxGridRowSelected td, #groupbyresourcediv .dojoxGridRowSelected td, #groupbygroupdiv .dojoxGridRowSelected td, #mapbyresgroupdiv .dojoxGridRowSelected td, #mapbymaptogroupdiv .dojoxGridRowSelected td, #subimagegriddiv .dojoxGridRowSelected td, #configvariablegriddiv .dojoxGridRowSelected td
-added #systemconfigdiv .dojoxGridCell, #systemconfigdiv .dojoxGridCellFocus, #systemconfigdiv .dojoxGridCellOver, #groupbyresourcediv .dojoxGridCell, #groupbyresourcediv .dojoxGridCellFocus, #groupbyresourcediv .dojoxGridCellOver, #groupbygroupdiv .dojoxGridCell, #groupbygroupdiv .dojoxGridCellFocus, #groupbygroupdiv .dojoxGridCellOver, #mapbyresgroupdiv .dojoxGridCell, #mapbyresgroupdiv .dojoxGridCellFocus, #mapbyresgroupdiv .dojoxGridCellOver, #mapbymaptogroupdiv .dojoxGridCell, #mapbymaptogroupdiv .dojoxGridCellFocus, #mapbymaptogroupdiv .dojoxGridCellOver, #subimagegriddiv .dojoxGridCell, #subimagegriddiv .dojoxGridCellFocus, #subimagegriddiv .dojoxGridCellOver, #configvariablegriddiv .dojoxGridCell, #configvariablegriddiv .dojoxGridCellFocus, #configvariablegriddiv .dojoxGridCellOver
-added #systemconfigdiv .dojoxMultiSelectItemBox, #groupbyresourcediv .dojoxMultiSelectItemBox, #groupbygroupdiv .dojoxMultiSelectItemBox, #mapbyresgroupdiv .dojoxMultiSelectItemBox, #mapbymaptogroupdiv .dojoxMultiSelectItemBox, #subimagegriddiv .dojoxMultiSelectItemBox, #configvariablegriddiv .dojoxMultiSelectItemBox
-added #addeditdlgcontent label, #newreslabelfields label
-added #newreslabelfields label
-added #addeditdlgcontent .labeledform
-added #advancedoptions .labeledform
-added #mgmtnodedlgcontent label
-added #mgmtnodedlgcontent .labeledform
-added #computerdlgcontent label
-added #computerdlgcontent .labeledform
-added #advancedoptions label
-added #cfgvartypelbl
-added #addeditdlgcontent .labeledforminnerlabel
-added #newreslabelfields .labeledform
-added #configvariables
-added .strikethrough
-added #nrfixedipdiv
-added .boxedoptions
-added #imageRevisionDlg .dijitDialogPaneContent
-added .disabledlabel





index.php:
-updated $VCLversion
-changed to use cleanSemaphore instead of semUnlock
-modified how $actionFunction is called to check if in a continuation and there is an object in it if the specified function does not exist globally, then call the object's function if it exists there





in javascript files, moved RPCwrapper to code.js from all other files to centralize it

added resources.js, resources/computer.js, resources/config.js, resources/image.js, resources/managementnode.js, and resources/schedule.js: these are part of a rewrite of how resources are handled; resources.js handles things common to all resources; the other files handle things specific to each resource type
removed computers.js, images.js, managementnodes.js, and schedules.js which are replaced by the above files
added siteconfig.js

blockallocations.js: added viewBlockUsage and viewBlockUsageCB

code.js:
-moved RPCwrapper from all other files to here
-modified RPCwrapper to call returnCheck as the load function if dojson specified and do not actually handle returned content as json
-added returnCheck - trys to decode returned data as json, if fails, notifies user of error, if succeeds, calls the passed in callback function
-changed genericCB to generalCB
-modified setLoading and unsetLoading to use dijit.byId instead of dojo.widget.byId
-removed checkAllCompUtils
-removed uncheckAllCompUtils
-removed reloadComputerSubmit
-removed compStateChangeSubmit
-removed compScheduleChangeSubmit
-removed toggleRowSelect
-removed toggleColSelect
-added resizeRecenterDijitDialog
-added checkValidatedObj
-added resetSelect

dashboard.js:
-modified updateDashboardCB: added variable to track refresh timeout; added call to updateFailedImaging
-modified updateTopFailed: updated to include separate counts for user fails and reload fails
-added updateFailedImaging
-added restartImagingCB

privileges.js: modified submitAddUserGroup: fixed bug where cascade was not getting submitted

requests.js:
-large rewrite to combine "New Reservations" and "Current Reservations" pages into a single, more dynamic page
-added global variables: waittimetimeout, durationchanged, initialimageset, resconfigmapid, revisiongrids, waittimeobj, waittimeh, profilesstoredata
-added initViewRequests, showNewResDlg, resetNewResDlg, setLastImage, selectResType, checkSelectedInList, setFirstAvailableImage, validateDeployInputs, getDeployData, getConfigData, getImageDescription, durationChange, setEndDuration, resetDeployBtnLabel, configureSystem, configureSystemCB, showConfigureSystem, closeConfigureSystem, subimageSelected, addReservationConfig, configSelected, setApplyConfig, showConfigData, selectConfigVariable, saveSelectedConfig, saveSelectedConfigVar, promptRevisions, promptRevisionsCB, addRevisionSelection, showRevisionDlg, submitNewReservation, submitNewReservationCB, connectRequest, connectRequestCB
-removed useSuggestedEditSlot, showRDPbutton
-moved setStartNow, setStartLater, setEndIndef, and setEndAt from serverprofiles.js to here
-added 30 second timout to several RPCwrapper calls

serverprofiles.php:
-moved code related to deploying to either newresservercommon.js or requests.js
-moved populateProfileStore, populateProfileStoreCB, deployProfileChanged, getServerProfileData, and getServerProfileDataDeployCB to newresservercommon.js
-moved setStartNow, setStartLater, setEndIndef, and setEndAt to requests.js
-uncommented fixedIP stuff
-added code for netmask, router, and dns

sitemaintenance.js: moved RPCwrapper to code.js

statistics.js: added 5 minute timeouts to RPCwrapper calls for graphs

Added:
    vcl/trunk/web/.ht-inc/computer.php
    vcl/trunk/web/.ht-inc/config.php
    vcl/trunk/web/.ht-inc/image.php
    vcl/trunk/web/.ht-inc/managementnode.php
    vcl/trunk/web/.ht-inc/resource.php
    vcl/trunk/web/.ht-inc/schedule.php
    vcl/trunk/web/.ht-inc/siteconfig.php
    vcl/trunk/web/.ht-inc/storebackend.php
    vcl/trunk/web/js/resources/
    vcl/trunk/web/js/resources.js
    vcl/trunk/web/js/resources/computer.js
    vcl/trunk/web/js/resources/config.js
    vcl/trunk/web/js/resources/image.js
    vcl/trunk/web/js/resources/managementnode.js
    vcl/trunk/web/js/resources/schedule.js
    vcl/trunk/web/js/siteconfig.js
Removed:
    vcl/trunk/web/.ht-inc/computers.php
    vcl/trunk/web/.ht-inc/images.php
    vcl/trunk/web/.ht-inc/managementnodes.php
    vcl/trunk/web/.ht-inc/schedules.php
    vcl/trunk/web/js/computers.js
    vcl/trunk/web/js/images.js
    vcl/trunk/web/js/managementnodes.js
    vcl/trunk/web/js/schedules.js
Modified:
    vcl/trunk/web/.ht-inc/authentication.php
    vcl/trunk/web/.ht-inc/authmethods/ldapauth.php
    vcl/trunk/web/.ht-inc/authmethods/shibauth.php
    vcl/trunk/web/.ht-inc/blockallocations.php
    vcl/trunk/web/.ht-inc/conf-default.php
    vcl/trunk/web/.ht-inc/dashboard.php
    vcl/trunk/web/.ht-inc/errors.php
    vcl/trunk/web/.ht-inc/groups.php
    vcl/trunk/web/.ht-inc/privileges.php
    vcl/trunk/web/.ht-inc/requests.php
    vcl/trunk/web/.ht-inc/serverprofiles.php
    vcl/trunk/web/.ht-inc/sitemaintenance.php
    vcl/trunk/web/.ht-inc/states.php
    vcl/trunk/web/.ht-inc/statistics.php
    vcl/trunk/web/.ht-inc/userpreferences.php
    vcl/trunk/web/.ht-inc/utils.php
    vcl/trunk/web/.ht-inc/vm.php
    vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
    vcl/trunk/web/css/vcl.css
    vcl/trunk/web/index.php
    vcl/trunk/web/js/blockallocations.js
    vcl/trunk/web/js/code.js
    vcl/trunk/web/js/dashboard.js
    vcl/trunk/web/js/privileges.js
    vcl/trunk/web/js/requests.js
    vcl/trunk/web/js/serverprofiles.js
    vcl/trunk/web/js/sitemaintenance.js
    vcl/trunk/web/js/statistics.js
    vcl/trunk/web/js/vm.js

Modified: vcl/trunk/web/.ht-inc/authentication.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/authentication.php?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/authentication.php (original)
+++ vcl/trunk/web/.ht-inc/authentication.php Thu Sep 11 16:01:48 2014
@@ -232,7 +232,7 @@ function printLoginPage($servertimeout=0
 	if($userid == _('Proceed to Login'))
 		$userid = '';
 	if(! array_key_exists($authtype, $authMechs)) {
-		// FIXME - hackerish
+		// FIXME - hackish
 		dbDisconnect();
 		exit;
 	}
@@ -423,8 +423,9 @@ function ldapLogin($authtype, $userid, $
 	}
 	else {
 		addLoginLog($userid, $authtype, $authMechs[$authtype]['affiliationid'], 1);
+		# used to rely on later code to update user info if update timestamp was expired
 		// see if user in our db
-		$query = "SELECT id "
+		/*$query = "SELECT id "
 		       . "FROM user "
 		       . "WHERE unityid = '$esc_userid' AND "
 		       .       "affiliationid = {$authMechs[$authtype]['affiliationid']}";
@@ -434,7 +435,11 @@ function ldapLogin($authtype, $userid, $
 			$newid = updateLDAPUser($authtype, $userid);
 			if(is_null($newid))
 				abort(8);
-		}
+		}*/
+		# now, we always update the user info
+		$newid = updateLDAPUser($authtype, $userid);
+		if(is_null($newid))
+			abort(8);
 		// get cookie data
 		$cookie = getAuthCookieData("$userid@" . getAffiliationName($authMechs[$authtype]['affiliationid']));
 		// set cookie
@@ -627,7 +632,7 @@ function checkExpiredDemoUser($userid, $
 				print "mailto:" . HELPEMAIL . "\">" . HELPEMAIL . "</a> if you need ";
 				print "further access to VCL.<br>\n";
 			}
-			semUnlock();
+			cleanSemaphore(); # probably not needed but ensures we do not leave stale entries
 			printHTMLFooter();
 			dbDisconnect();
 			exit;

Modified: vcl/trunk/web/.ht-inc/authmethods/ldapauth.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/authmethods/ldapauth.php?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/authmethods/ldapauth.php (original)
+++ vcl/trunk/web/.ht-inc/authmethods/ldapauth.php Thu Sep 11 16:01:48 2014
@@ -112,7 +112,7 @@ function addLDAPUser($authtype, $userid)
 /// \param $type - an array from the $authMechs table
 /// \param $loginid - a userid without the affiliation part
 ///
-/// \return 1 if user was found in ldap, 0 if not
+/// \return 1 if user was found in ldap, 0 if not, -1 on ldap error
 ///
 /// \brief checks to see if a user is in ldap
 ///
@@ -120,6 +120,11 @@ function addLDAPUser($authtype, $userid)
 function validateLDAPUser($type, $loginid) {
 	global $authMechs;
 	$auth = $authMechs[$type];
+	$savehdlr = set_error_handler(create_function('', ''));
+	if(! ($fh = fsockopen($auth['server'], 636, $errno, $errstr, 5)))
+		return -1;
+	set_error_handler($savehdlr);
+	fclose($fh);
 	$ds = ldap_connect("ldaps://{$auth['server']}/");
 	if(! $ds)
 		return -1;
@@ -140,6 +145,7 @@ function validateLDAPUser($type, $logini
 	                      $auth['binddn'], 
 	                      "{$auth['unityid']}=$loginid",
 	                      $return, 0, 3, 15);
+
 	if(! $search)
 		return -1;
 
@@ -173,7 +179,7 @@ function updateLDAPUser($authtype, $user
 	$now = unixToDatetime(time());
 
 	// select desired data from db
-	$query = "SELECT i.name AS IMtype, "
+	$qbase = "SELECT i.name AS IMtype, "
 	       .        "u.IMid AS IMid, "
 	       .        "u.affiliationid, "
 	       .        "af.name AS affiliation, "
@@ -197,12 +203,22 @@ function updateLDAPUser($authtype, $user
 	       .       "af.id = $affilid AND ";
 	if(array_key_exists('numericid', $userData) &&
 	   is_numeric($userData['numericid']))
-		$query .=   "u.uid = {$userData['numericid']}";
+		$query = $qbase . "u.uid = {$userData['numericid']}";
 	else {
-		$query .=   "u.unityid = '$esc_userid' AND "
-		       .    "u.affiliationid = $affilid";
+		$query = $qbase . "u.unityid = '$esc_userid' AND "
+		       .          "u.affiliationid = $affilid";
 	}
 	$qh = doQuery($query, 255);
+	$updateuid = 0;
+	# check to see if there is a matching entry where uid is NULL but unityid and affiliationid match
+	if(array_key_exists('numericid', $userData) &&
+	   is_numeric($userData['numericid']) &&
+	   ! mysql_num_rows($qh)) {
+		$updateuid = 1;
+		$query = $qbase . "u.unityid = '$esc_userid' AND "
+		       .          "u.affiliationid = $affilid";
+		$qh = doQuery($query, 255);
+	}
 	// if get a row
 	//    update db
 	//    update results from select
@@ -216,10 +232,13 @@ function updateLDAPUser($authtype, $user
 		       . "SET unityid = '$esc_userid', "
 		       .     "firstname = '{$userData['first']}', "
 		       .     "lastname = '{$userData['last']}', "
-		       .     "email = '{$userData['email']}', "
-		       .     "lastupdated = '$now' ";
+		       .     "email = '{$userData['email']}', ";
+		if($updateuid)
+			$query .= "uid = {$userData['numericid']}, ";
+		$query .=    "lastupdated = '$now' ";
 		if(array_key_exists('numericid', $userData) &&
-		   is_numeric($userData['numericid']))
+		   is_numeric($userData['numericid']) &&
+		   ! $updateuid)
 			$query .= "WHERE uid = {$userData['numericid']}";
 		else
 			$query .= "WHERE unityid = '$esc_userid' AND "
@@ -248,6 +267,8 @@ function updateLDAPUser($authtype, $user
 		       .        "u.mapprinters AS mapprinters, "
 		       .        "u.mapserial AS mapserial, "
 		       .        "u.showallgroups, "
+		       .        "u.usepublickeys, "
+		       .        "u.sshpublickeys, "
 		       .        "u.lastupdated AS lastupdated "
 		       . "FROM user u, "
 		       .      "IMtype i, "
@@ -258,6 +279,7 @@ function updateLDAPUser($authtype, $user
 		$qh = doQuery($query, 101);
 		if(! $user = mysql_fetch_assoc($qh))
 			return NULL;
+		$user['sshpublickeys'] = htmlspecialchars($user['sshpublickeys']);
 	}
 
 	// TODO handle generic updating of groups
@@ -325,6 +347,7 @@ function getLDAPUserData($authtype, $use
 	                      $auth['binddn'], 
 	                      "{$auth['unityid']}=$searchuser",
 	                      $ldapsearch, 0, 3, 15);
+
 	$return = array();
 	if($search) {
 		$tmpdata = ldap_get_entries($ds, $search);

Modified: vcl/trunk/web/.ht-inc/authmethods/shibauth.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/authmethods/shibauth.php?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/authmethods/shibauth.php (original)
+++ vcl/trunk/web/.ht-inc/authmethods/shibauth.php Thu Sep 11 16:01:48 2014
@@ -163,13 +163,21 @@ function addShibUser($user) {
 ///
 /// \param $usernid - id from user table
 /// \param $groups - data provided in the eduPersonScopedAffiliation attribute
+/// or an array with a single element where the key is 'shibaffil' and the
+/// value matches an entry for shibname from the affiliation table
 ///
 /// \brief converts the shibboleth affiliation to VCL affiliation, prepends
 /// 'shib-' to each of the group names and calls updateGroups to add the user
-/// to each of the shibboleth groups
+/// to each of the shibboleth groups; if $groups is the array option, user is
+/// added to a single group named "All <affil name> users" where <affil name>
+/// is the name field from the affiliation table
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function updateShibGroups($usernid, $groups) {
+	if(is_array($groups) && array_key_exists('shibaffil', $groups)) {
+		$shibaffil = $groups['shibaffil'];
+		$groups = '';
+	}
 	$groups = explode(';', $groups);
 	$newusergroups = array();
 	foreach($groups as $group) {
@@ -186,13 +194,14 @@ function updateShibGroups($usernid, $gro
 		$grp = mysql_real_escape_string("shib-" . $name);
 		array_push($newusergroups, getUserGroupID($grp, $affilid));
 	}
-	/*if($shibaffil == 'example1.edu') {
-		$query = "SELECT id FROM affiliation WHERE shibname = '$shibaffil'";
-		$qh = doQuery($query, 101);
-		$row = mysql_fetch_assoc($qh);
-		$affilid = $row['id'];
-		array_push($newusergroups, getUserGroupID('All Example1 users', $affilid));
-	}*/
+
+	$query = "SELECT id, name FROM affiliation WHERE shibname = '$shibaffil'";
+	$qh = doQuery($query, 101);
+	$row = mysql_fetch_assoc($qh);
+	$affilid = $row['id'];
+	$grp = mysql_real_escape_string("All {$row['name']} users");
+	array_push($newusergroups, getUserGroupID($grp, $affilid));
+
 	$newusergroups = array_unique($newusergroups);
 	if(! empty($newusergroups))
 		updateGroups($newusergroups, $usernid);

Modified: vcl/trunk/web/.ht-inc/blockallocations.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/blockallocations.php?rev=1624325&r1=1624324&r2=1624325&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/blockallocations.php (original)
+++ vcl/trunk/web/.ht-inc/blockallocations.php Thu Sep 11 16:01:48 2014
@@ -986,9 +986,11 @@ function createListBlockData($blockid, $
 			$sdatedt = unixToDatetime($sdatets);
 			$edatets = strtotime("$date {$tmp[2]}:00");
 			$edatedt = unixToDatetime($edatets);
-			$btvals[] = "($blockid, "
-			          . "'$sdatedt', "
-			          . "'$edatedt')";
+			if($method != 'edit' || $edatets >= time()) {
+				$btvals[] = "($blockid, "
+				          . "'$sdatedt', "
+				          . "'$edatedt')";
+			}
 		}
 		if($method != 'accept') {
 			$start = explode(':', $tmp[1]);
@@ -1346,7 +1348,7 @@ function getCurrentBlockHTML($listonly=0
 		$rt .= "    </TD>\n";
 		$rt .= "    <TD>{$block['blockname']}</TD>\n";
 		$rt .= "    <TD>{$block['image']}</TD>\n";
-		$rt .= "    <TD>{$block['machinecnt']}</TD>\n";
+		$rt .= "    <TD><a href=\"javascript:void(0)\" onclick=\"viewBlockUsage({$block['id']});\">{$block['machinecnt']}</a></TD>\n";
 		$rt .= "    <TD>{$block['group']}</TD>\n";
 		$rt .= "    <TD>{$block['available']}</TD>\n";
 		if($block['nextstartactive']) {
@@ -1448,6 +1450,22 @@ function getCurrentBlockHTML($listonly=0
 	$rt .= "</div>\n";
 	$rt .= "<input type=hidden id=toggletimecont>\n";
 	$rt .= "</div>\n"; # times dialog
+
+	$rt .= "<div id=\"viewUsageDialog\" dojoType=\"dijit.Dialog\" title=\"Block Allocation Usage\">\n";
+	$rt .= "<div id=\"blockusagechartdiv\" class=\"hidden\"></div>\n";
+	$rt .= "<div id=\"blockusageemptydiv\" class=\"hidden\">This block allocation has never been used.</div>\n";
+	$rt .= "<div align=\"center\">\n";
+	$rt .= "<button dojoType=\"dijit.form.Button\" type=\"button\">\n";
+	$rt .= "  Close\n";
+	$rt .= "  <script type=\"dojo/method\" event=\"onClick\">\n";
+	$rt .= "    dijit.byId('viewUsageDialog').hide();\n";
+	$rt .= "  </script>\n";
+	$rt .= "</button>\n";
+	$rt .= "</div>\n";
+	$blockids = array_keys($blocks);
+	$cont = addContinuationsEntry('AJviewBlockAllocationUsage', array('blockids' => $blockids), SECINDAY);
+	$rt .= "<input type=hidden id=viewblockusagecont value=\"$cont\">\n";
+	$rt .= "</div>\n"; # usage dialog
 	return $rt;
 }
 
@@ -3729,4 +3747,74 @@ function AJgetBlockAllocatedMachineData(
 	$alldata['cont'] = $cont;
 	sendJSON($alldata);
 }
+
+////////////////////////////////////////////////////////////////////////////////
+///
+/// \fn AJviewBlockAllocationUsage()
+///
+/// \brief generates graph data showing how usage of a block allocation
+///
+////////////////////////////////////////////////////////////////////////////////
+function AJviewBlockAllocationUsage() {
+	$blockid = processInputVar('blockid', ARG_NUMERIC);
+	$allowedblockids = getContinuationVar('blockids');
+	if(! in_array($blockid, $allowedblockids)) {
+		sendJSON(array('status' => 'failed', 'message' => 'noaccess'));
+		return;
+	}
+	$query = "SELECT COUNT(s.computerid) AS used, "
+	       .        "br.numMachines AS allocated, "
+	       .        "s.blockStart "
+	       . "FROM blockRequest br "
+	       . "LEFT JOIN sublog s ON (s.blockRequestid = br.id) "
+	       . "WHERE br.id = $blockid "
+	       . "GROUP BY s.blockRequestid, s.blockStart, s.blockEnd "
+	       . "ORDER BY s.blockStart";
+	$qh = doQuery($query);
+	$usage = array();
+	$first = 1;
+	$firststart = '';
+	$laststart = '';
+	while($row = mysql_fetch_assoc($qh)) {
+		if($first && ! is_null($row['blockStart'])) {
+			$firststart = datetimeToUnix($row['blockStart']);
+			$first = 0;
+		}
+		elseif(! is_null($row['blockStart']))
+			$laststart = datetimeToUnix($row['blockStart']);
+		if(is_null($row['blockStart']))
+			continue;
+		$percent = (int)($row['used'] / $row['allocated'] * 100);
+		$startts = datetimeToUnix($row['blockStart']);
+		$usage[$startts] = array('percent' => $percent,
+		                         'label' => $row['blockStart']);
+	}
+	if($firststart == '') {
+		sendJSON(array('status' => 'empty', 'message' => 'nousage'));
+		return;
+	}
+	$data = array('points' => array(), 'xlabels' => array());
+	$cnt = 0;
+	$tmp = localtime($firststart, 1);
+	$firstisdst = 0;
+	if($tmp['tm_isdst'])
+		$firstisdst = 1;
+	for($i = $firststart; $i <= $laststart + 3600; $i += SECINDAY) {
+		$tmp = localtime($i, 1);
+		$time = $i;
+		if($firstisdst && ! $tmp['tm_isdst'])
+			$time += 3600;
+		if(! $firstisdst && $tmp['tm_isdst'])
+			$time -= 3600;
+		$cnt++;
+		$label = date('m/d g:i a', $time);
+		if(array_key_exists($time, $usage))
+			$data['points'][] = array('y' => $usage[$time]['percent'], 'tooltip' => "$label: " . $usage[$time]['percent'] . " %");
+		else
+			$data['points'][] = array('y' => 0, 'tooltip' => "$label: 0");
+		$data['xlabels'][] = array('value' => $cnt, 'text' => $label);
+	}
+	sendJSON(array('status' => 'success',
+	               'usage' => $data));
+}
 ?>