Merge branch 'master' of github.com:ZoneMinder/zoneminder

This commit is contained in:
Isaac Connor 2020-08-26 13:31:36 -04:00
commit b4fbe84f6b
6 changed files with 63 additions and 39 deletions

View File

@ -21,7 +21,7 @@ endif(ZM_TARGET_DISTRO MATCHES "^el")
# Configure the common zoneminder files # Configure the common zoneminder files
configure_file(common/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY) configure_file(common/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY)
configure_file(common/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY) configure_file(common/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY)
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events temp) file(MAKE_DIRECTORY sock swap zoneminder events temp)
# Configure the Apache zoneminder files # Configure the Apache zoneminder files
configure_file(httpd/zm-httpd.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zm-httpd.conf @ONLY) configure_file(httpd/zm-httpd.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zm-httpd.conf @ONLY)
@ -51,7 +51,6 @@ install(DIRECTORY sock swap DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSION
install(DIRECTORY zoneminder DESTINATION /var/log DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY zoneminder DESTINATION /var/log DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder DESTINATION /var/run DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY zoneminder DESTINATION /var/run DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder DESTINATION /var/cache DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY zoneminder DESTINATION /var/cache DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder-upload DESTINATION /var/spool DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY events temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY events temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# Install the Apache zoneminder files # Install the Apache zoneminder files

View File

@ -107,7 +107,7 @@ void zmLoadConfig() {
snprintf(staticConfig.video_file_format, sizeof(staticConfig.video_file_format), "%%s/%%s"); snprintf(staticConfig.video_file_format, sizeof(staticConfig.video_file_format), "%%s/%%s");
} }
void process_configfile(char* configFile) { void process_configfile(char const *configFile) {
FILE *cfg; FILE *cfg;
char line[512]; char line[512];
if ( (cfg = fopen(configFile, "r")) == NULL ) { if ( (cfg = fopen(configFile, "r")) == NULL ) {

View File

@ -62,7 +62,7 @@
extern void zmLoadConfig(); extern void zmLoadConfig();
extern void process_configfile( char* configFile ); extern void process_configfile(char const *configFile);
struct StaticConfig { struct StaticConfig {
std::string DB_HOST; std::string DB_HOST;

View File

@ -244,7 +244,7 @@ echo $table_head;
for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) { for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
$monitor = $displayMonitors[$monitor_i]; $monitor = $displayMonitors[$monitor_i];
$Monitor = new ZM\Monitor($monitor); $Monitor = new ZM\Monitor($monitor);
include('function.php');
if ( $monitor_i and ( $monitor_i % 100 == 0 ) ) { if ( $monitor_i and ( $monitor_i % 100 == 0 ) ) {
echo '</table>'; echo '</table>';
echo $table_head; echo $table_head;
@ -325,7 +325,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
?> ?>
</div></td> </div></td>
<td class="colFunction"> <td class="colFunction">
<?php echo makePopupLink( '?view=function&amp;mid='.$monitor['Id'], 'zmFunction', 'function', '<span class="'.$function_class.'">'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', <span class="disabledText">disabled</span>' : '' ) .'</span>', canEdit('Monitors') ) ?><br/> <a class="functionLnk <?php echo $function_class ?>" data-mid="<?php echo $monitor['Id'] ?>" id="functionLnk-<?php echo $monitor['Id'] ?>" href="#"><?php echo translate('Fn'.$monitor['Function']) ?></a><br/>
<?php echo translate('Status'.$monitor['Status']) ?><br/> <?php echo translate('Status'.$monitor['Status']) ?><br/>
<div class="small text-nowrap text-muted"> <div class="small text-nowrap text-muted">
<?php <?php
@ -348,7 +348,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
<td class="colServer"><?php $Server = isset($ServersById[$monitor['ServerId']]) ? $ServersById[$monitor['ServerId']] : new ZM\Server($monitor['ServerId']); echo validHtmlStr($Server->Name()); ?></td> <td class="colServer"><?php $Server = isset($ServersById[$monitor['ServerId']]) ? $ServersById[$monitor['ServerId']] : new ZM\Server($monitor['ServerId']); echo validHtmlStr($Server->Name()); ?></td>
<?php <?php
} }
echo '<td class="colSource">'. makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$source_class.'">'.validHtmlStr($Monitor->Source()).'</span>', canEdit('Monitors') ).'</td>'; echo '<td class="colSource">'. makeLink( '?view=monitor&amp;mid='.$monitor['Id'], '<span class="'.$source_class.'">'.validHtmlStr($Monitor->Source()).'</span>', canEdit('Monitors') ).'</td>';
if ( $show_storage_areas ) { if ( $show_storage_areas ) {
?> ?>
<td class="colStorage"><?php echo isset($StorageById[$monitor['StorageId']]) ? validHtmlStr($StorageById[$monitor['StorageId']]->Name()) : ($monitor['StorageId']?'<span class="error">Deleted '.$monitor['StorageId'].'</span>' : '') ?></td> <td class="colStorage"><?php echo isset($StorageById[$monitor['StorageId']]) ? validHtmlStr($StorageById[$monitor['StorageId']]->Name()) : ($monitor['StorageId']?'<span class="error">Deleted '.$monitor['StorageId'].'</span>' : '') ?></td>

View File

@ -22,42 +22,35 @@ if ( !canEdit('Monitors') ) {
$view = 'error'; $view = 'error';
return; return;
} }
$monitor = ZM\Monitor::find_one(array('Id'=>$_REQUEST['mid']));
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Function').' - '.validHtmlStr($monitor->Name()));
?> ?>
<body>
<div id="page"> <div id="modalFunction-<?php echo $Monitor->Id() ?>" class="modal" tabindex="-1">
<div id="header"> <div class="modal-dialog">
<h2><?php echo translate('Function').' - '.validHtmlStr($monitor->Name()) ?></h2> <div class="modal-content">
</div> <div class="modal-header">
<div id="content"> <h5 class="modal-title"><?php echo translate('Function').' - '.validHtmlStr($Monitor->Name()) ?></h5>
<form name="contentForm" id="contentForm" method="post" action="?"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<input type="hidden" name="view" value="function"/> <span aria-hidden="true">&times;</span>
<input type="hidden" name="action" value="function"/> </button>
<input type="hidden" name="mid" value="<?php echo $monitor->Id() ?>"/> </div>
<div class="modal-body">
<p> <p>
<select name="newFunction"> <select name="newFunction" id="funcSelect-<?php echo $monitor['Id'] ?>">
<?php <?php
foreach ( getEnumValues('Monitors', 'Function') as $optFunction ) { foreach ( getEnumValues('Monitors', 'Function') as $optFunction ) {
?> $selected = ( $optFunction == $Monitor->Function() ) ? ' selected="selected"' : '';
<option value="<?php echo $optFunction ?>"<?php if ( $optFunction == $monitor->Function() ) { ?> selected="selected"<?php } ?>><?php echo translate('Fn'.$optFunction) ?></option> echo '<option value="' .$optFunction. '"'. $selected. '>' .translate('Fn'.$optFunction). '</option>'.PHP_EOL;
<?php }
} ?>
?>
</select> </select>
<label for="newEnabled"><?php echo translate('Enabled') ?></label> <label for="newEnabled"><?php echo translate('Enabled') ?></label>
<input type="checkbox" name="newEnabled" id="newEnabled" value="1"<?php echo $monitor->Enabled() ?' checked="checked"' : '' ?>/> <input type="checkbox" name="newEnabled" id="newEnabled-<?php echo $monitor['Id'] ?>" value="1"<?php echo $Monitor->Enabled() ?' checked="checked"' : '' ?>/>
</p> </p>
<div id="contentButtons"> </div>
<button type="submit" value="Save"><?php echo translate('Save') ?></button> <div class="modal-footer">
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button> <button data-mid="<?php echo $monitor['Id'] ?>" type="button" class="funcSaveBtn btn btn-primary"><?php echo translate('Save') ?></button>
</div> <button data-mid="<?php echo $monitor['Id'] ?>" type="button" class="funcCancelBtn btn btn-secondary" data-dismiss="modal"><?php echo translate('Cancel') ?></button>
</form> </div>
</div> </div>
</div> </div>
</body> </div>
</html>

View File

@ -135,6 +135,18 @@ function reloadWindow() {
} }
function initPage() { function initPage() {
$j('.functionLnk').click(function(evt) {
if ( ! canEditEvents ) {
alert("You do not have permission to change monitor function.");
return;
}
var mid = evt.currentTarget.getAttribute("data-mid");
evt.preventDefault();
$j('#modalFunction-'+mid).modal('show');
});
reloadWindow.periodical(consoleRefreshTimeout); reloadWindow.periodical(consoleRefreshTimeout);
if ( showVersionPopup ) { if ( showVersionPopup ) {
createPopup('?view=version', 'zmVersion', 'version'); createPopup('?view=version', 'zmVersion', 'version');
@ -154,6 +166,26 @@ function initPage() {
// Setup the thumbnail video animation // Setup the thumbnail video animation
initThumbAnimation(); initThumbAnimation();
// Manage the CANCEL modal buttons
$j('.funcCancelBtn').click(function(evt) {
var mid = evt.currentTarget.getAttribute("data-mid");
evt.preventDefault();
$j('#modalFunction-'+mid).modal('hide');
});
// Manage the SAVE modal buttons
$j('.funcSaveBtn').click(function(evt) {
var mid = evt.currentTarget.getAttribute("data-mid");
var newFunc = $j("#funcSelect-"+mid).val();
var newEnabled = $j('#newEnabled-'+mid).is(':checked') ? 1 : 0;
evt.preventDefault();
$j.getJSON(thisUrl + '?view=function&action=function&mid='+mid+'&newFunction='+newFunc+'&newEnabled='+newEnabled);
window.location.reload(true);
});
} }
function applySort(event, ui) { function applySort(event, ui) {