diff --git a/web/includes/functions.php b/web/includes/functions.php index fa8a0aba9..dcbb448b7 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1207,7 +1207,7 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&' ) { } // end foreach remaining term } // end no StorageArea found yet - $filter['sql'] .= getDiskPercent( $StorageArea ); + $filter['sql'] .= getDiskPercent( $StorageArea->Path() ); break; case 'DiskBlocks': // Need to specify a storage area, so need to look through other terms looking for a storage area, else we default to ZM_EVENTS_PATH @@ -1410,10 +1410,18 @@ function getLoad() { return( $load[0] ); } -function getDiskPercent( $StorageArea = NULL ) { - if ( ! $StorageArea ) $StorageArea = new Storage(); - - return $StorageArea->disk_usage_percent(); +function getDiskPercent($path = ZM_DIR_EVENTS) { + $total = disk_total_space($path); + if ( ! $total ) { + Error("disk_total_space returned false for " . $path ); + return 0; + } + $free = disk_free_space($path); + if ( ! $free ) { + Error("disk_free_space returned false for " . $path ); + } + $space = round(($total - $free) / $total * 100); + return( $space ); } function getDiskBlocks() { diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 607a4d1c5..6e8c03af8 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -269,6 +269,7 @@ if ( canView( 'Stream' ) && $cycleCount > 1 ) { $func = function($S){ return $S->Name() . ': ' . $S->disk_usage_percent().'%'; }; echo implode( ', ', array_map ( $func, $storage_areas ) ); + echo ' ' . ZM_PATH_MAP .': '. getDiskPercent(ZM_PATH_MAP).'%'; ?> diff --git a/web/skins/classic/views/controlcap.php b/web/skins/classic/views/controlcap.php index 2a898de9c..88e0d1212 100644 --- a/web/skins/classic/views/controlcap.php +++ b/web/skins/classic/views/controlcap.php @@ -183,7 +183,7 @@ foreach ( $tabs as $name=>$value ) ?>
-
+ diff --git a/web/skins/classic/views/js/controlcap.js b/web/skins/classic/views/js/controlcap.js new file mode 100644 index 000000000..04a0b9e76 --- /dev/null +++ b/web/skins/classic/views/js/controlcap.js @@ -0,0 +1,24 @@ +function validateForm( form ) { + var errors = new Array(); + + // If "Can Move" is enabled, then the end user must also select at least one of the other check boxes (excluding Can Move Diagonally) + if ( form.elements['newControl[CanMove]'].checked ) { + if ( !form.elements['newControl[CanMoveCon]'].checked || !form.elements['newControl[CanMoveRel]'].checked || !form.elements['newControl[CanMoveAbs]'].checked || !form.elements['newControl[CanMoveMap]'].checked ) { + errors[errors.length] = "In addition to \"Can Move\", you also must select at least one of: \"Can Move Mapped\", \"Can Move Absolute\", \"Can Move Relative\", or \"Can Move Continuous\""; + } + } else { + // Now lets check for the opposite condition. If any of the boxes below Can Move are checked, but Can Move is not checked then signal an error + + if ( form.elements['newControl[CanMoveCon]'].checked || form.elements['newControl[CanMoveRel]'].checked || form.elements['newControl[CanMoveAbs]'].checked || form.elements['newControl[CanMoveMap]'].checked || form.elements['newControl[CanMoveDiag]'].checked ) { + errors[errors.length] = "\"Can Move\" must also be selected if any one of the movement types are sleceted"; + } + } + + if ( errors.length ) { + alert( errors.join( "\n" ) ); + return( false ); + } + return( true ); + +} +