Moved the <form> block for the "Options-Storage" page to a separate file "_options_storage.php"
parent
320041ed4d
commit
e7795513f5
|
@ -143,78 +143,7 @@ foreach (array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as $
|
||||||
} else if ($tab == 'servers') {
|
} else if ($tab == 'servers') {
|
||||||
include('_options_servers.php');
|
include('_options_servers.php');
|
||||||
} else if ($tab == 'storage') {
|
} else if ($tab == 'storage') {
|
||||||
?>
|
include('_options_storage.php');
|
||||||
<form name="storageForm" method="post" action="?">
|
|
||||||
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
|
||||||
<input type="hidden" name="tab" value="<?php echo $tab ?>"/>
|
|
||||||
<input type="hidden" name="action" value="delete"/>
|
|
||||||
<input type="hidden" name="object" value="storage"/>
|
|
||||||
<div class="col px-0">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col overflow-auto">
|
|
||||||
<table id="contentTable" class="table table-striped">
|
|
||||||
<thead class="thead-highlight">
|
|
||||||
<tr>
|
|
||||||
<th class="colId"><?php echo translate('Id') ?></th>
|
|
||||||
<th class="colName"><?php echo translate('Name') ?></th>
|
|
||||||
<th class="colPath"><?php echo translate('Path') ?></th>
|
|
||||||
<th class="colType"><?php echo translate('Type') ?></th>
|
|
||||||
<th class="colScheme"><?php echo translate('StorageScheme') ?></th>
|
|
||||||
<th class="colServer"><?php echo translate('Server') ?></th>
|
|
||||||
<th class="colDiskSpace"><?php echo translate('DiskSpace') ?></th>
|
|
||||||
<th class="colEvents"><?php echo translate('Events') ?></th>
|
|
||||||
<th class="colMark"><?php echo translate('Mark') ?></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
foreach (ZM\Storage::find(null, array('order'=>'lower(Name)')) as $Storage) {
|
|
||||||
$filter = new ZM\Filter();
|
|
||||||
$filter->addTerm(array('attr'=>'StorageId','op'=>'=','val'=>$Storage->Id()));
|
|
||||||
if (count($user->unviewableMonitorIds())) {
|
|
||||||
$filter = $filter->addTerm(array('cnj'=>'and', 'attr'=>'MonitorId', 'op'=>'IN', 'val'=>$user->viewableMonitorIds()));
|
|
||||||
}
|
|
||||||
|
|
||||||
$str_opt = 'class="storageCol" data-sid="'.$Storage->Id().'"';
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="colId"><?php echo makeLink('#', validHtmlStr($Storage->Id()), $canEdit, $str_opt) ?></td>
|
|
||||||
<td class="colName"><?php echo makeLink('#', validHtmlStr($Storage->Name()), $canEdit, $str_opt) ?></td>
|
|
||||||
<td class="colPath"><?php echo makeLink('#', validHtmlStr($Storage->Path()), $canEdit, $str_opt) ?></td>
|
|
||||||
<td class="colType"><?php echo makeLink('#', validHtmlStr($Storage->Type()), $canEdit, $str_opt) ?></td>
|
|
||||||
<td class="colScheme"><?php echo makeLink('#', validHtmlStr($Storage->Scheme()), $canEdit, $str_opt) ?></td>
|
|
||||||
<td class="colServer"><?php echo makeLink('#', validHtmlStr($Storage->Server()->Name()), $canEdit, $str_opt) ?></td>
|
|
||||||
<td class="colDiskSpace"><?php
|
|
||||||
if ($Storage->disk_total_space()) {
|
|
||||||
echo intval(100*$Storage->disk_used_space()/$Storage->disk_total_space()).'% ';
|
|
||||||
}
|
|
||||||
echo human_filesize($Storage->disk_used_space()) . ' of ' . human_filesize($Storage->disk_total_space()) ?></td>
|
|
||||||
<td class="ColEvents"><?php echo makeLink('?view=events'.$filter->querystring(), $Storage->EventCount().' using '.human_filesize($Storage->event_disk_space() ? $Storage->event_disk_space() : 0) ); ?></td>
|
|
||||||
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Storage->Id() ?>" data-on-click-this="configureDeleteButton"
|
|
||||||
<?php
|
|
||||||
echo ($Storage->EventCount() or !$canEdit) ? ' disabled="disabled"' : '';
|
|
||||||
echo $Storage->EventCount() ? ' title="Can\'t delete as long as there are events stored here."' : '';
|
|
||||||
?>
|
|
||||||
/></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
} #end foreach Server
|
|
||||||
?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div><!-- .col -->
|
|
||||||
</div> <!-- .row -->
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<div id="contentButtons">
|
|
||||||
<button type="button" id="NewStorageBtn" value="<?php echo translate('AddNewStorage') ?>" disabled="disabled"><?php echo translate('AddNewStorage') ?></button>
|
|
||||||
<button type="submit" class="btn-danger" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> <!-- .row -->
|
|
||||||
</div> <!-- .col px-0 -->
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
} else if ($tab == 'dnsmasq' and file_exists('skins/classic/views/_options_dnsmasq.php')) {
|
} else if ($tab == 'dnsmasq' and file_exists('skins/classic/views/_options_dnsmasq.php')) {
|
||||||
include('_options_dnsmasq.php');
|
include('_options_dnsmasq.php');
|
||||||
} else if ($tab == 'users') {
|
} else if ($tab == 'users') {
|
||||||
|
@ -320,73 +249,73 @@ foreach (array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as $
|
||||||
<div class="row h-100">
|
<div class="row h-100">
|
||||||
<div id="options">
|
<div id="options">
|
||||||
<?php
|
<?php
|
||||||
if (!isset($configCats[$tab])) {
|
if (!isset($configCats[$tab])) {
|
||||||
echo 'There are no config entries for category '.$tab.'.<br/>';
|
echo 'There are no config entries for category '.$tab.'.<br/>';
|
||||||
} else {
|
} else {
|
||||||
foreach ($configCats[$tab] as $name=>$value) {
|
foreach ($configCats[$tab] as $name=>$value) {
|
||||||
$shortName = preg_replace( '/^ZM_/', '', $name );
|
$shortName = preg_replace( '/^ZM_/', '', $name );
|
||||||
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]['Prompt']:$value['Prompt'];
|
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]['Prompt']:$value['Prompt'];
|
||||||
$optionCanEdit = $canEdit && !$value['System'];
|
$optionCanEdit = $canEdit && !$value['System'];
|
||||||
?>
|
?>
|
||||||
<div class="form-group form-row <?php echo $name ?>">
|
<div class="form-group form-row <?php echo $name ?>">
|
||||||
<label for="<?php echo $name ?>" class="col-md-4 control-label text-md-right"><?php echo $shortName ?></label>
|
<label for="<?php echo $name ?>" class="col-md-4 control-label text-md-right"><?php echo $shortName ?></label>
|
||||||
<div class="col-md">
|
<div class="col-md">
|
||||||
<?php
|
<?php
|
||||||
if ($value['Type'] == 'boolean') {
|
if ($value['Type'] == 'boolean') {
|
||||||
echo '<input type="checkbox" id="'.$name.'" name="newConfig['.$name.']" value="1"'.
|
echo '<input type="checkbox" id="'.$name.'" name="newConfig['.$name.']" value="1"'.
|
||||||
( $value['Value'] ? ' checked="checked"' : '').
|
( $value['Value'] ? ' checked="checked"' : '').
|
||||||
( $optionCanEdit ? '' : ' disabled="disabled"').' />'.PHP_EOL;
|
( $optionCanEdit ? '' : ' disabled="disabled"').' />'.PHP_EOL;
|
||||||
} else if (is_array($value['Hint'])) {
|
} else if (is_array($value['Hint'])) {
|
||||||
$attributes = ['id'=>$name, 'class'=>'form-control-sm chosen'];
|
$attributes = ['id'=>$name, 'class'=>'form-control-sm chosen'];
|
||||||
if (!$optionCanEdit) $attributes['disabled']='disabled';
|
|
||||||
echo htmlSelect("newConfig[$name]", $value['Hint'], $value['Value'], $attributes);
|
|
||||||
} else if (preg_match('/\|/', $value['Hint'])) {
|
|
||||||
$options = explode('|', $value['Hint']);
|
|
||||||
if (count($options) > 3) {
|
|
||||||
$html_options = array();
|
|
||||||
foreach ($options as $option) {
|
|
||||||
if (preg_match('/^([^=]+)=(.+)$/', $option, $matches)) {
|
|
||||||
$html_options[$matches[2]] = $matches[1];
|
|
||||||
} else {
|
|
||||||
$html_options[$option] = $option;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$attributes = ['id'=>$name, 'class'=>'form-control-sm'.(count($html_options)>10?' chosen':'')];
|
|
||||||
if (!$optionCanEdit) $attributes['disabled']='disabled';
|
if (!$optionCanEdit) $attributes['disabled']='disabled';
|
||||||
echo htmlSelect("newConfig[$name]", $html_options, $value['Value'], $attributes);
|
echo htmlSelect("newConfig[$name]", $value['Hint'], $value['Value'], $attributes);
|
||||||
} else {
|
} else if (preg_match('/\|/', $value['Hint'])) {
|
||||||
foreach ($options as $option) {
|
$options = explode('|', $value['Hint']);
|
||||||
if (preg_match('/^([^=]+)=(.+)$/', $option)) {
|
if (count($options) > 3) {
|
||||||
$optionLabel = $matches[1];
|
$html_options = array();
|
||||||
$optionValue = $matches[2];
|
foreach ($options as $option) {
|
||||||
} else {
|
if (preg_match('/^([^=]+)=(.+)$/', $option, $matches)) {
|
||||||
$optionLabel = $optionValue = $option;
|
$html_options[$matches[2]] = $matches[1];
|
||||||
|
} else {
|
||||||
|
$html_options[$option] = $option;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$attributes = ['id'=>$name, 'class'=>'form-control-sm'.(count($html_options)>10?' chosen':'')];
|
||||||
|
if (!$optionCanEdit) $attributes['disabled']='disabled';
|
||||||
|
echo htmlSelect("newConfig[$name]", $html_options, $value['Value'], $attributes);
|
||||||
|
} else {
|
||||||
|
foreach ($options as $option) {
|
||||||
|
if (preg_match('/^([^=]+)=(.+)$/', $option)) {
|
||||||
|
$optionLabel = $matches[1];
|
||||||
|
$optionValue = $matches[2];
|
||||||
|
} else {
|
||||||
|
$optionLabel = $optionValue = $option;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<label class="font-weight-bold form-control-sm">
|
<label class="font-weight-bold form-control-sm">
|
||||||
<input type="radio" id="<?php echo $name.'_'.preg_replace('/[^a-zA-Z0-9]/', '', $optionValue) ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo $optionValue ?>"<?php if ( $value['Value'] == $optionValue ) { ?> checked="checked"<?php } ?><?php echo $optionCanEdit?'':' disabled="disabled"' ?>/>
|
<input type="radio" id="<?php echo $name.'_'.preg_replace('/[^a-zA-Z0-9]/', '', $optionValue) ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo $optionValue ?>"<?php if ( $value['Value'] == $optionValue ) { ?> checked="checked"<?php } ?><?php echo $optionCanEdit?'':' disabled="disabled"' ?>/>
|
||||||
<?php echo htmlspecialchars($optionLabel) ?>
|
<?php echo htmlspecialchars($optionLabel) ?>
|
||||||
</label>
|
</label>
|
||||||
<?php
|
<?php
|
||||||
} # end foreach option
|
} # end foreach option
|
||||||
} # end if count options > 3
|
} # end if count options > 3
|
||||||
} else if ( $value['Type'] == 'text' ) {
|
} else if ( $value['Type'] == 'text' ) {
|
||||||
echo '<textarea class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" rows="5" cols="40"'.($optionCanEdit?'':' disabled="disabled"').'>'.validHtmlStr($value['Value']).'</textarea>'.PHP_EOL;
|
echo '<textarea class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" rows="5" cols="40"'.($optionCanEdit?'':' disabled="disabled"').'>'.validHtmlStr($value['Value']).'</textarea>'.PHP_EOL;
|
||||||
} else if ( $value['Type'] == 'integer' ) {
|
} else if ( $value['Type'] == 'integer' ) {
|
||||||
echo '<input type="number" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).' step="1"/>'.PHP_EOL;
|
echo '<input type="number" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).' step="1"/>'.PHP_EOL;
|
||||||
} else if ( $value['Type'] == 'hexadecimal' ) {
|
} else if ( $value['Type'] == 'hexadecimal' ) {
|
||||||
echo '<input type="text" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).'/>'.PHP_EOL;
|
echo '<input type="text" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).'/>'.PHP_EOL;
|
||||||
} else if ( $value['Type'] == 'decimal' ) {
|
} else if ( $value['Type'] == 'decimal' ) {
|
||||||
echo '<input type="text" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).'/>'.PHP_EOL;
|
echo '<input type="text" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).'/>'.PHP_EOL;
|
||||||
} else if ( $value['Type'] == 'password' ) {
|
} else if ( $value['Type'] == 'password' ) {
|
||||||
echo '<input type="password" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).'/>'.PHP_EOL;
|
echo '<input type="password" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).'/>'.PHP_EOL;
|
||||||
echo '<span class="material-icons md-18" data-on-click-this="toggle_password_visibility" data-password-input="'.$name.'">visibility</span>';
|
echo '<span class="material-icons md-18" data-on-click-this="toggle_password_visibility" data-password-input="'.$name.'">visibility</span>';
|
||||||
} else {
|
} else {
|
||||||
echo '<input type="text" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).'/>'.PHP_EOL;
|
echo '<input type="text" class="form-control-sm" id="'.$name.'" name="newConfig['.$name.']" value="'.validHtmlStr($value['Value']).'" '.($optionCanEdit?'':' disabled="disabled"' ).'/>'.PHP_EOL;
|
||||||
}
|
}
|
||||||
if ($value['Value'] != constant($name)) {
|
if ($value['Value'] != constant($name)) {
|
||||||
echo '<p class="warning">Note: This value has been overriden via configuration files in '.ZM_CONFIG. ' or ' . ZM_CONFIG_SUBDIR.'.<br/>The overriden value is: '.constant($name).'</p>'.PHP_EOL;
|
echo '<p class="warning">Note: This value has been overriden via configuration files in '.ZM_CONFIG. ' or ' . ZM_CONFIG_SUBDIR.'.<br/>The overriden value is: '.constant($name).'</p>'.PHP_EOL;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<span class="form-text form-control-sm"><?php echo validHtmlStr($optionPromptText); echo makeHelpLink($name) ?></span>
|
<span class="form-text form-control-sm"><?php echo validHtmlStr($optionPromptText); echo makeHelpLink($name) ?></span>
|
||||||
</div><!-- End .col-md -->
|
</div><!-- End .col-md -->
|
||||||
|
|
Loading…
Reference in New Issue