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') {
|
||||
include('_options_servers.php');
|
||||
} else if ($tab == 'storage') {
|
||||
?>
|
||||
<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
|
||||
include('_options_storage.php');
|
||||
} else if ($tab == 'dnsmasq' and file_exists('skins/classic/views/_options_dnsmasq.php')) {
|
||||
include('_options_dnsmasq.php');
|
||||
} 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 id="options">
|
||||
<?php
|
||||
if (!isset($configCats[$tab])) {
|
||||
echo 'There are no config entries for category '.$tab.'.<br/>';
|
||||
} else {
|
||||
foreach ($configCats[$tab] as $name=>$value) {
|
||||
$shortName = preg_replace( '/^ZM_/', '', $name );
|
||||
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]['Prompt']:$value['Prompt'];
|
||||
$optionCanEdit = $canEdit && !$value['System'];
|
||||
if (!isset($configCats[$tab])) {
|
||||
echo 'There are no config entries for category '.$tab.'.<br/>';
|
||||
} else {
|
||||
foreach ($configCats[$tab] as $name=>$value) {
|
||||
$shortName = preg_replace( '/^ZM_/', '', $name );
|
||||
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]['Prompt']:$value['Prompt'];
|
||||
$optionCanEdit = $canEdit && !$value['System'];
|
||||
?>
|
||||
<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>
|
||||
<div class="col-md">
|
||||
<?php
|
||||
if ($value['Type'] == 'boolean') {
|
||||
echo '<input type="checkbox" id="'.$name.'" name="newConfig['.$name.']" value="1"'.
|
||||
( $value['Value'] ? ' checked="checked"' : '').
|
||||
( $optionCanEdit ? '' : ' disabled="disabled"').' />'.PHP_EOL;
|
||||
} else if (is_array($value['Hint'])) {
|
||||
$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 ($value['Type'] == 'boolean') {
|
||||
echo '<input type="checkbox" id="'.$name.'" name="newConfig['.$name.']" value="1"'.
|
||||
( $value['Value'] ? ' checked="checked"' : '').
|
||||
( $optionCanEdit ? '' : ' disabled="disabled"').' />'.PHP_EOL;
|
||||
} else if (is_array($value['Hint'])) {
|
||||
$attributes = ['id'=>$name, 'class'=>'form-control-sm 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;
|
||||
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';
|
||||
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">
|
||||
<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) ?>
|
||||
</label>
|
||||
<?php
|
||||
} # end foreach option
|
||||
} # end if count options > 3
|
||||
} 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;
|
||||
} 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;
|
||||
} 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;
|
||||
} 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;
|
||||
} 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 '<span class="material-icons md-18" data-on-click-this="toggle_password_visibility" data-password-input="'.$name.'">visibility</span>';
|
||||
} else {
|
||||
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)) {
|
||||
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;
|
||||
}
|
||||
} # end foreach option
|
||||
} # end if count options > 3
|
||||
} 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;
|
||||
} 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;
|
||||
} 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;
|
||||
} 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;
|
||||
} 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 '<span class="material-icons md-18" data-on-click-this="toggle_password_visibility" data-password-input="'.$name.'">visibility</span>';
|
||||
} else {
|
||||
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)) {
|
||||
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>
|
||||
</div><!-- End .col-md -->
|
||||
|
|
Loading…
Reference in New Issue