Move 'state' to header, as on/off btn, in a modal

This commit is contained in:
Kyle Johnson 2014-11-15 16:47:42 +00:00
parent 08d2cf801e
commit e359a1cf97
2 changed files with 47 additions and 64 deletions

View File

@ -7,13 +7,15 @@
$statusClass = 'danger';
}
?>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<span class="navbar-brand">ZoneMinder</span>
<a href="?view=state" class="btn btn-<?= $statusClass ?> btn-md navbar-btn pull-right" onclick="createPopup( '?view=state', 'zmState', 'state' ); return( false );">
<button type="button" class="btn btn-<?= $statusClass ?> btn-md navbar-btn pull-right" data-toggle="modal" data-target="#myModal">
<span class="glyphicon glyphicon-off"></span>
</a>
</button>
<ul class="nav navbar-nav pull-right">
<li><a href="?view=console"><?= $SLANG['Console']; ?></a></li>
<li><a href="?view=events&amp;page=1"><?= $SLANG['Events']; ?></a></li>
@ -33,3 +35,4 @@
</ul>
</div>
</nav>
<?php include("state.php"); ?>

View File

@ -23,84 +23,64 @@ if ( !canEdit( 'System' ) )
$view = "error";
return;
}
$running = daemonCheck();
$states = dbFetchAll( "select * from States" );
$focusWindow = true;
xhtmlHeaders(__FILE__, $SLANG['RunState'] );
?>
<body>
<div id="page">
<div id="header">
<h2><?= $SLANG['RunState'] ?></h2>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<p class="modal-title">State</p>
</div>
<div id="content">
<div class="row">
<div class="col-md-6">
<form name="contentForm" id="contentForm" method="get" action="<?= $_SERVER['PHP_SELF'] ?>">
<?php
if ( empty($_REQUEST['apply']) )
{
?>
<?php if ( empty($_REQUEST['apply']) ) { ?>
<input type="hidden" name="view" value="<?= $view ?>"/>
<input type="hidden" name="action" value=""/>
<input type="hidden" name="action" value="state"/>
<input type="hidden" name="apply" value="1"/>
<p>
<select name="runState" onchange="checkState( this );">
<?php
if ( $running )
{
?>
<div class="form-group">
<label for="runState">Change State</label>
<select class="form-control" name="runState" id="runState" onchange="checkState( this );">
<?php if ( $running ) { ?>
<option value="stop" selected="selected"><?= $SLANG['Stop'] ?></option>
<option value="restart"><?= $SLANG['Restart'] ?></option>
<?php
}
else
{
?>
<?php } else { ?>
<option value="start" selected="selected"><?= $SLANG['Start'] ?></option>
<?php
}
?>
<?php
foreach ( $states as $state )
{
?>
<?php } ?>
<?php foreach ( $states as $state ) { ?>
<option value="<?= $state['Name'] ?>"><?= $state['Name'] ?></option>
<?php
}
?>
<?php } ?>
</select>
</p>
<table id="contentTable" class="minor" cellspacing="0">
<tbody>
<tr>
<th scope="row"><?= $SLANG['NewState'] ?></th>
<td><input type="text" name="newState" value="" size="16" onchange="checkState( this );"/></td>
</tr>
</tbody>
</table>
<div id="contentButtons">
<input type="submit" value="<?= $SLANG['Apply'] ?>"/>
<input type="button" name="saveBtn" value="<?= $SLANG['Save'] ?>" disabled="disabled" onclick="saveState( this );"/>
<input type="button" name="deleteBtn" value="<?= $SLANG['Delete'] ?>" disabled="disabled" onclick="deleteState( this );"/>
<input type="button" value="<?= $SLANG['Cancel'] ?>" onclick="closeWindow()"/>
</div>
<?php
}
else
{
?>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="newState"> <?= $SLANG['NewState'] ?></label>
<input class="form-control" type="text" id="newState" name="newState" value="" size="16" onchange="checkState( this );"/>
</div>
</div>
</div>
<div class="modal-footer">
<input type="submit" class="btn btn-default" value="<?= $SLANG['Apply'] ?>" id="btnStateApply" data-loading-text="Applying..." />
<input type="button" class="btn btn-default" name="deleteBtn" value="<?= $SLANG['Delete'] ?>" disabled="disabled" onclick="deleteState( this );"/>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="button" class="btn btn-default" name="saveBtn" value="<?= $SLANG['Save'] ?>" disabled="disabled" onclick="saveState( this );"/>
</div>
<?php } else { ?>
<input type="hidden" name="view" value="none"/>
<input type="hidden" name="action" value="state"/>
<input type="hidden" name="runState" value="<?= validHtmlStr($_REQUEST['runState']) ?>"/>
<p><?= $SLANG['ApplyingStateChange'] ?></p>
<p><?= $SLANG['PleaseWait'] ?></p>
<?php
}
?>
<?php } ?>
</form>
</div>
</div>
</body>
</html>
</div>