Rename Config* to ONVIF_*

This commit is contained in:
Isaac Connor 2020-05-12 15:46:07 -04:00
parent 1f3cf266a2
commit c83621822f
2 changed files with 42 additions and 42 deletions

View File

@ -1,55 +1,60 @@
-- --
-- This updates a 1.28.0 database to 1.28.99.0 -- This update adds ONVIF features
-- --
--
-- Add Config* fields; used for specifying ONVIF/PSIA options
--
SET @s = (SELECT IF( SET @s = (SELECT IF(
(SELECT COUNT(*) (SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Monitors' WHERE table_name = 'Monitors'
AND table_schema = DATABASE() AND table_schema = DATABASE()
AND column_name = 'ConfigType' AND column_name = 'ONVIF_URL'
) > 0, ) > 0,
"SELECT 'Column ConfigType already exists in Monitors'", "SELECT 'Column ONVIF_URL already exists in Monitors'",
"ALTER TABLE `Monitors` ADD COLUMN `ConfigType` ENUM('None','ONVIF','PSIA') NOT NULL DEFAULT 'None' AFTER `Triggers`" "ALTER TABLE `Monitors` ADD COLUMN `ONVIF_URL` VARCHAR(255) NOT NULL DEFAULT '' AFTER `Triggers`"
)); ));
PREPARE stmt FROM @s; PREPARE stmt FROM @s;
EXECUTE stmt; EXECUTE stmt;
--
-- Add Config* fields; used for specifying ONVIF/PSIA options
--
SET @s = (SELECT IF( SET @s = (SELECT IF(
(SELECT COUNT(*) (SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Monitors' WHERE table_name = 'Monitors'
AND table_schema = DATABASE() AND table_schema = DATABASE()
AND column_name = 'ConfigURL' AND column_name = 'ONVIF_Username'
) > 0, ) > 0,
"SELECT 'Column ConfigURL already exists in Monitors'", "SELECT 'Column ONVIF_Username already exists in Monitors'",
"ALTER TABLE `Monitors` ADD COLUMN `ConfigURL` VARCHAR(255) NOT NULL DEFAULT '' AFTER `ConfigType`" "ALTER TABLE `Monitors` ADD COLUMN `ONVIF_Username` VARCHAR(64) NOT NULL DEFAULT '' AFTER `ONVIF_URL`"
)); ));
PREPARE stmt FROM @s; PREPARE stmt FROM @s;
EXECUTE stmt; EXECUTE stmt;
--
-- Add Config* fields; used for specifying ONVIF/PSIA options
--
SET @s = (SELECT IF( SET @s = (SELECT IF(
(SELECT COUNT(*) (SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Monitors' WHERE table_name = 'Monitors'
AND table_schema = DATABASE() AND table_schema = DATABASE()
AND column_name = 'ConfigOptions' AND column_name = 'ONVIF_Password'
) > 0, ) > 0,
"SELECT 'Column ConfigOptions already exists in Monitors'", "SELECT 'Column ONVIF_Password already exists in Monitors'",
"ALTER TABLE `Monitors` ADD COLUMN `ConfigOptions` VARCHAR(64) NOT NULL DEFAULT '' AFTER `ConfigURL`" "ALTER TABLE `Monitors` ADD COLUMN `ONVIF_Password` VARCHAR(64) NOT NULL DEFAULT '' AFTER `ONVIF_Username`"
)); ));
PREPARE stmt FROM @s; PREPARE stmt FROM @s;
EXECUTE stmt; EXECUTE stmt;
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Monitors'
AND table_schema = DATABASE()
AND column_name = 'ONVIF_Options'
) > 0,
"SELECT 'Column ONVIF_Options already exists in Monitors'",
"ALTER TABLE `Monitors` ADD COLUMN `ONVIF_Options` VARCHAR(64) NOT NULL DEFAULT '' AFTER `ONVIF_Password`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;

View File

@ -495,13 +495,12 @@ if ( ZM_HAS_V4L && ($tab != 'source' || $monitor->Type() != 'Local') ) {
<input type="hidden" name="newMonitor[V4LCapturesPerFrame]" value="<?php echo validHtmlStr($monitor->V4LCapturesPerFrame()) ?>"/> <input type="hidden" name="newMonitor[V4LCapturesPerFrame]" value="<?php echo validHtmlStr($monitor->V4LCapturesPerFrame()) ?>"/>
<?php <?php
} }
if ( $tab != 'config' ) { if ( $tab != 'onvif' ) {
?> ?>
<input type="hidden" name="newMonitor[ConfigType]" value="<?php echo validHtmlStr($monitor->ConfigType()) ?>"/> <input type="hidden" name="newMonitor[ONVIF_URL]" value="<?php echo validHtmlStr($monitor->ONVIF_URL()) ?>"/>
<input type="hidden" name="newMonitor[ConfigURL]" value="<?php echo validHtmlStr($monitor->ConfigURL()) ?>"/> <input type="hidden" name="newMonitor[ONVIF_Username]" value="<?php echo validHtmlStr($monitor->ONVIF_User()) ?>"/>
<input type="hidden" name="newMonitor[User]" value="<?php echo validHtmlStr($monitor->User()) ?>"/> <input type="hidden" name="newMonitor[ONVIF_Password]" value="<?php echo validHtmlStr($monitor->ONVIF_Password()) ?>"/>
<input type="hidden" name="newMonitor[Pass]" value="<?php echo validHtmlStr($monitor->Pass()) ?>"/> <input type="hidden" name="newMonitor[ONVIF_Options]" value="<?php echo validHtmlStr($monitor->ONVIF_Options()) ?>"/>
<input type="hidden" name="newMonitor[ConfigOptions]" value="<?php echo validHtmlStr($monitor->ConfigOptions()) ?>"/>
<?php <?php
} }
if ( $tab != 'source' || $monitor->Type()!= 'Remote' ) { if ( $tab != 'source' || $monitor->Type()!= 'Remote' ) {
@ -759,28 +758,24 @@ switch ( $tab ) {
} }
break; break;
} }
case 'config' : case 'onvif' :
{ {
?> ?>
<tr> <tr>
<td><?php echo translate('ConfigType') ?></td> <td><?php echo translate('ONVIF_URL') ?></td>
<td><?php echo htmlSelect('newMonitor[ConfigType]', $configTypes, $monitor->ConfigType(), "submitTab('$tab')"); ?></td> <td><input type="text" name="newMonitor[ONVIF_URL]" value="<?php echo validHtmlStr($monitor->ONVIF_URL()) ?>"/></td>
</tr>
<tr>
<td><?php echo translate('ConfigURL') ?></td>
<td><input type="text" name="newMonitor[ConfigURL]" value="<?php echo validHtmlStr($monitor->ConfigURL()) ?>"/></td>
</tr> </tr>
<tr> <tr>
<td><?php echo translate('Username') ?></td> <td><?php echo translate('Username') ?></td>
<td><input type="text" name="newMonitor[User]" value="<?php echo validHtmlStr($monitor->User()) ?>"/></td> <td><input type="text" name="newMonitor[ONVIF_Username]" value="<?php echo validHtmlStr($monitor->ONVIF_Username()) ?>"/></td>
</tr> </tr>
<tr> <tr>
<td><?php echo translate('Password') ?></td> <td><?php echo translate('Password') ?></td>
<td><input type="text" name="newMonitor[Pass]" value="<?php echo validHtmlStr($monitor->Pass()) ?>"/></td> <td><input type="text" name="newMonitor[ONVIF_Password]" value="<?php echo validHtmlStr($monitor->ONVIF_Password()) ?>"/></td>
</tr> </tr>
<tr> <tr>
<td><?php echo translate('ConfigOptions') ?></td> <td><?php echo translate('ONVIF_Options') ?></td>
<td><input type="text" name="newMonitor[ConfigOptions]" value="<?php echo validHtmlStr($monitor->ConfigOptions()) ?>"/></td> <td><input type="text" name="newMonitor[ONVIF_Options]" value="<?php echo validHtmlStr($monitor->ONVIF_Options()) ?>"/></td>
</tr> </tr>
<?php <?php
break; break;