From 04366e752a119dad2b83ab5c512cc6a665bf2c90 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 9 Jul 2015 11:41:46 -0400 Subject: [PATCH] add Servers to options, a server editing popup and a server selection to monitors --- web/api/app/Plugin/Crud | 2 +- web/includes/actions.php | 30 ++++++++++++++++++++++++++++- web/skins/classic/views/monitor.php | 16 +++++++++++++++ web/skins/classic/views/options.php | 29 ++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) diff --git a/web/api/app/Plugin/Crud b/web/api/app/Plugin/Crud index f1cf70fff..e22c1563a 160000 --- a/web/api/app/Plugin/Crud +++ b/web/api/app/Plugin/Crud @@ -1 +1 @@ -Subproject commit f1cf70ffff0657db29388eca94e6c5ea4944a164 +Subproject commit e22c1563a51d86aac0d5054beee28b4afb60c802 diff --git a/web/includes/actions.php b/web/includes/actions.php index f52a96db6..6fdb33a9b 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -637,7 +637,35 @@ if ( !empty($action) ) // System edit actions if ( canEdit( 'System' ) ) { - if ( $action == "version" && isset($_REQUEST['option']) ) + if ( $_REQUEST['object'] == 'server' ) { + + if ( $action == "save" ) { + if ( !empty($_REQUEST['id']) ) + $dbServer = dbFetchOne( "SELECT * FROM Servers WHERE Id=?", NULL, array($_REQUEST['id']) ); + else + $dbServer = array(); + + $types = array(); + $changes = getFormChanges( $dbServer, $_REQUEST['newServer'], $types ); + + if ( count( $changes ) ) { + if ( !empty($_REQUEST['id']) ) { + dbQuery( "UPDATE Servers SET ".implode( ", ", $changes )." WHERE Id = ?", array($_REQUEST['id']) ); + } else { + dbQuery( "INSERT INTO Servers set ".implode( ", ", $changes ) ); + } + $refreshParent = true; + } + $view = 'none'; + } else if ( $action == 'delete' ) { + if ( !empty($_REQUEST['markIds']) ) { + foreach( $_REQUEST['markIds'] as $Id ) + dbQuery( "DELETE FROM Servers WHERE Id=?", array($Id) ); + } + $refreshParent = true; + } + + } else if ( $action == "version" && isset($_REQUEST['option']) ) { $option = $_REQUEST['option']; switch( $option ) diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index cb81789ea..7a30fdb8d 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -40,11 +40,18 @@ if ( isset($_REQUEST['tab']) ) else $tab = "general"; + if ( defined( ZM_SERVER_ID ) ) { + $Server = dbFetchOne( 'SELECT * FROM Servers WHERE Id=?', NULL, array( ZM_SERVER_ID ) ); + } else { + $Server = array(); + } + if ( ! empty($_REQUEST['mid']) ) { $monitor = dbFetchMonitor( $_REQUEST['mid'] ); if ( ZM_OPT_X10 ) $x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['mid']) ); } else { + $nextId = getTableAutoInc( 'Monitors' ); $monitor = array( 'Id' => 0, @@ -106,6 +113,7 @@ if ( ! empty($_REQUEST['mid']) ) { 'Triggers' => "", 'V4LMultiBuffer' => '', 'V4LCapturesPerFrame' => 1, + 'ServerId' => $Server['Id'], ); } @@ -474,6 +482,7 @@ if ( $tab != 'general' ) { ?> + @@ -612,6 +621,13 @@ switch ( $tab ) { ?> + + + + + + + + + + + + + + + + + + + + + + +
disabled="disabled"/>
+
+ disabled="disabled"/> +
+ + +