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'; $statusClass = 'danger';
} }
?> ?>
<nav class="navbar navbar-default" role="navigation"> <nav class="navbar navbar-default" role="navigation">
<div class="container-fluid"> <div class="container-fluid">
<span class="navbar-brand">ZoneMinder</span> <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> <span class="glyphicon glyphicon-off"></span>
</a> </button>
<ul class="nav navbar-nav pull-right"> <ul class="nav navbar-nav pull-right">
<li><a href="?view=console"><?= $SLANG['Console']; ?></a></li> <li><a href="?view=console"><?= $SLANG['Console']; ?></a></li>
<li><a href="?view=events&amp;page=1"><?= $SLANG['Events']; ?></a></li> <li><a href="?view=events&amp;page=1"><?= $SLANG['Events']; ?></a></li>
@ -33,3 +35,4 @@
</ul> </ul>
</div> </div>
</nav> </nav>
<?php include("state.php"); ?>

View File

@ -23,84 +23,64 @@ if ( !canEdit( 'System' ) )
$view = "error"; $view = "error";
return; return;
} }
$running = daemonCheck();
$states = dbFetchAll( "select * from States" ); $states = dbFetchAll( "select * from States" );
$focusWindow = true;
xhtmlHeaders(__FILE__, $SLANG['RunState'] );
?> ?>
<body> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div id="page"> <div class="modal-dialog">
<div id="header"> <div class="modal-content">
<h2><?= $SLANG['RunState'] ?></h2> <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>
<div id="content">
<div class="row">
<div class="col-md-6">
<form name="contentForm" id="contentForm" method="get" action="<?= $_SERVER['PHP_SELF'] ?>"> <form name="contentForm" id="contentForm" method="get" action="<?= $_SERVER['PHP_SELF'] ?>">
<?php <?php if ( empty($_REQUEST['apply']) ) { ?>
if ( empty($_REQUEST['apply']) )
{
?>
<input type="hidden" name="view" value="<?= $view ?>"/> <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"/> <input type="hidden" name="apply" value="1"/>
<p> <div class="form-group">
<select name="runState" onchange="checkState( this );"> <label for="runState">Change State</label>
<?php <select class="form-control" name="runState" id="runState" onchange="checkState( this );">
if ( $running ) <?php if ( $running ) { ?>
{
?>
<option value="stop" selected="selected"><?= $SLANG['Stop'] ?></option> <option value="stop" selected="selected"><?= $SLANG['Stop'] ?></option>
<option value="restart"><?= $SLANG['Restart'] ?></option> <option value="restart"><?= $SLANG['Restart'] ?></option>
<?php <?php } else { ?>
}
else
{
?>
<option value="start" selected="selected"><?= $SLANG['Start'] ?></option> <option value="start" selected="selected"><?= $SLANG['Start'] ?></option>
<?php <?php } ?>
} <?php foreach ( $states as $state ) { ?>
?>
<?php
foreach ( $states as $state )
{
?>
<option value="<?= $state['Name'] ?>"><?= $state['Name'] ?></option> <option value="<?= $state['Name'] ?>"><?= $state['Name'] ?></option>
<?php <?php } ?>
}
?>
</select> </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> </div>
<?php </div>
}
else <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="view" value="none"/>
<input type="hidden" name="action" value="state"/> <input type="hidden" name="action" value="state"/>
<input type="hidden" name="runState" value="<?= validHtmlStr($_REQUEST['runState']) ?>"/> <input type="hidden" name="runState" value="<?= validHtmlStr($_REQUEST['runState']) ?>"/>
<p><?= $SLANG['ApplyingStateChange'] ?></p> <p><?= $SLANG['ApplyingStateChange'] ?></p>
<p><?= $SLANG['PleaseWait'] ?></p> <p><?= $SLANG['PleaseWait'] ?></p>
<?php <?php } ?>
}
?>
</form> </form>
</div> </div>
</div> </div>
</body> </div>
</html>