Moved vars for Monitors edit and add views to appropriate elements.
This saves a bunch of redundant code, while putting the code in the 'right place'.
This commit is contained in:
parent
fad481d472
commit
186f763a4c
|
@ -41,108 +41,6 @@
|
||||||
throw new NotFoundException(__('Invalid monitor'));
|
throw new NotFoundException(__('Invalid monitor'));
|
||||||
}
|
}
|
||||||
$this->set('monitor', $monitor['Monitor']);
|
$this->set('monitor', $monitor['Monitor']);
|
||||||
|
|
||||||
$typeoptions = array(
|
|
||||||
'Local' => 'Local',
|
|
||||||
'Remote' => 'Remote',
|
|
||||||
'File' => 'File',
|
|
||||||
'Ffmpeg' => 'Ffmpeg'
|
|
||||||
);
|
|
||||||
$this->set('typeoptions', $typeoptions);
|
|
||||||
|
|
||||||
$functionoptions = array(
|
|
||||||
'Modect' => 'Modect',
|
|
||||||
'Monitor' => 'Monitor',
|
|
||||||
'Record' => 'Record',
|
|
||||||
'None' => 'None',
|
|
||||||
'Nodect' => 'Nodect',
|
|
||||||
'Mocord' => 'Mocord'
|
|
||||||
);
|
|
||||||
$this->set('functionoptions', $functionoptions);
|
|
||||||
|
|
||||||
$protocoloptions = array(
|
|
||||||
'rtsp' => 'RTSP',
|
|
||||||
'http' => 'HTTP'
|
|
||||||
);
|
|
||||||
$this->set('protocoloptions', $protocoloptions);
|
|
||||||
|
|
||||||
$methodoptions = array(
|
|
||||||
'simple' => 'Simple',
|
|
||||||
'regexp' => 'Regexp'
|
|
||||||
);
|
|
||||||
$this->set('methodoptions', $methodoptions);
|
|
||||||
|
|
||||||
$optionsColours = array(
|
|
||||||
1 => '8 bit grayscale',
|
|
||||||
3 => '24 bit color',
|
|
||||||
4 => '32 bit color'
|
|
||||||
);
|
|
||||||
$this->set('optionsColours', $optionsColours);
|
|
||||||
|
|
||||||
$channeloptions = array();
|
|
||||||
for ($i=1; $i<32; $i++) {
|
|
||||||
array_push($channeloptions, $i);
|
|
||||||
}
|
|
||||||
$this->set('channeloptions', $channeloptions);
|
|
||||||
|
|
||||||
$formatoptions = array(
|
|
||||||
255 => "PAL",
|
|
||||||
45056 => "NTSC",
|
|
||||||
1 => "PAL B",
|
|
||||||
2 => "PAL B1",
|
|
||||||
4 => "PAL G",
|
|
||||||
8 => "PAL H",
|
|
||||||
16 => "PAL I",
|
|
||||||
32 => "PAL D",
|
|
||||||
64 => "PAL D1",
|
|
||||||
128 => "PAL K",
|
|
||||||
256 => "PAL M",
|
|
||||||
512 => "PAL N",
|
|
||||||
1024 => "PAL Nc",
|
|
||||||
2048 => "PAL 60",
|
|
||||||
4096 => "NTSC M",
|
|
||||||
8192 => "NTSC M JP",
|
|
||||||
16384 => "NTSC 443",
|
|
||||||
32768 => "NTSC M KR",
|
|
||||||
65536 => "SECAM B",
|
|
||||||
131072 => "SECAM D",
|
|
||||||
262144 => "SECAM G",
|
|
||||||
524288 => "SECAM H",
|
|
||||||
1048576 => "SECAM K",
|
|
||||||
2097152 => "SECAM K1",
|
|
||||||
4194304 => "SECAM L",
|
|
||||||
8388608 => "SECAM LC",
|
|
||||||
16777216 => "ATSC 8 VSB",
|
|
||||||
33554432 => "ATSC 16 VSB"
|
|
||||||
);
|
|
||||||
$this->set('formatoptions', $formatoptions);
|
|
||||||
|
|
||||||
$optionsPalette = array(
|
|
||||||
0 => 'Auto',
|
|
||||||
1497715271 => 'Gray',
|
|
||||||
877807426 => 'BGR32',
|
|
||||||
876758866 => 'RGB32',
|
|
||||||
861030210 => 'BGR24',
|
|
||||||
859981650 => 'RGB24',
|
|
||||||
1448695129 => '*YUYV',
|
|
||||||
1195724874 => '*JPEG',
|
|
||||||
1196444237 => '*MJPEG',
|
|
||||||
875836498 => '*RGB444',
|
|
||||||
1329743698 => '*RGB555',
|
|
||||||
1346520914 => '*RGB565',
|
|
||||||
1345466932 => '*YUV422P',
|
|
||||||
1345401140 => '*YUV411P',
|
|
||||||
875836505 => '*YUV444',
|
|
||||||
961959257 => '*YUV410',
|
|
||||||
842093913 => '*YUV420'
|
|
||||||
);
|
|
||||||
$this->set('optionsPalette', $optionsPalette);
|
|
||||||
|
|
||||||
$optionsMethod = array(
|
|
||||||
'v4l2' => 'Video For Linux 2'
|
|
||||||
);
|
|
||||||
$this->set('optionsMethod', $optionsMethod);
|
|
||||||
|
|
||||||
$this->set('linkedMonitors', $this->Monitor->find('list', array('fields' => array('Id', 'Name'))));
|
$this->set('linkedMonitors', $this->Monitor->find('list', array('fields' => array('Id', 'Name'))));
|
||||||
|
|
||||||
if ($this->request->is('put') || $this->request->is('post')) {
|
if ($this->request->is('put') || $this->request->is('post')) {
|
||||||
|
@ -161,6 +59,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add() {
|
public function add() {
|
||||||
|
$this->set('linkedMonitors', $this->Monitor->find('list', array('fields' => array('Id', 'Name'))));
|
||||||
if ($this->request->is('post')) {
|
if ($this->request->is('post')) {
|
||||||
$this->Monitor->create();
|
$this->Monitor->create();
|
||||||
if ($this->Monitor->save($this->request->data)) {
|
if ($this->Monitor->save($this->request->data)) {
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
<?php
|
||||||
|
$typeoptions = array(
|
||||||
|
'Local' => 'Local',
|
||||||
|
'Remote' => 'Remote',
|
||||||
|
'File' => 'File',
|
||||||
|
'Ffmpeg' => 'Ffmpeg'
|
||||||
|
);
|
||||||
|
$this->set('typeoptions', $typeoptions);
|
||||||
|
|
||||||
|
$functionoptions = array(
|
||||||
|
'Modect' => 'Modect',
|
||||||
|
'Monitor' => 'Monitor',
|
||||||
|
'Record' => 'Record',
|
||||||
|
'None' => 'None',
|
||||||
|
'Nodect' => 'Nodect',
|
||||||
|
'Mocord' => 'Mocord'
|
||||||
|
);
|
||||||
|
$this->set('functionoptions', $functionoptions);
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="general" class="tab-pane active">
|
<div id="general" class="tab-pane active">
|
||||||
<?php
|
<?php
|
||||||
echo $this->Form->input('Name');
|
echo $this->Form->input('Name');
|
||||||
|
|
|
@ -1,3 +1,88 @@
|
||||||
|
<?php
|
||||||
|
$optionsColours = array(
|
||||||
|
1 => '8 bit grayscale',
|
||||||
|
3 => '24 bit color',
|
||||||
|
4 => '32 bit color'
|
||||||
|
);
|
||||||
|
$this->set('optionsColours', $optionsColours);
|
||||||
|
|
||||||
|
$protocoloptions = array(
|
||||||
|
'rtsp' => 'RTSP',
|
||||||
|
'http' => 'HTTP'
|
||||||
|
);
|
||||||
|
$this->set('protocoloptions', $protocoloptions);
|
||||||
|
|
||||||
|
$methodoptions = array(
|
||||||
|
'simple' => 'Simple',
|
||||||
|
'regexp' => 'Regexp'
|
||||||
|
);
|
||||||
|
$this->set('methodoptions', $methodoptions);
|
||||||
|
|
||||||
|
$channeloptions = array();
|
||||||
|
for ($i=1; $i<32; $i++) {
|
||||||
|
array_push($channeloptions, $i);
|
||||||
|
}
|
||||||
|
$this->set('channeloptions', $channeloptions);
|
||||||
|
|
||||||
|
$formatoptions = array(
|
||||||
|
255 => "PAL",
|
||||||
|
45056 => "NTSC",
|
||||||
|
1 => "PAL B",
|
||||||
|
2 => "PAL B1",
|
||||||
|
4 => "PAL G",
|
||||||
|
8 => "PAL H",
|
||||||
|
16 => "PAL I",
|
||||||
|
32 => "PAL D",
|
||||||
|
64 => "PAL D1",
|
||||||
|
128 => "PAL K",
|
||||||
|
256 => "PAL M",
|
||||||
|
512 => "PAL N",
|
||||||
|
1024 => "PAL Nc",
|
||||||
|
2048 => "PAL 60",
|
||||||
|
4096 => "NTSC M",
|
||||||
|
8192 => "NTSC M JP",
|
||||||
|
16384 => "NTSC 443",
|
||||||
|
32768 => "NTSC M KR",
|
||||||
|
65536 => "SECAM B",
|
||||||
|
131072 => "SECAM D",
|
||||||
|
262144 => "SECAM G",
|
||||||
|
524288 => "SECAM H",
|
||||||
|
1048576 => "SECAM K",
|
||||||
|
2097152 => "SECAM K1",
|
||||||
|
4194304 => "SECAM L",
|
||||||
|
8388608 => "SECAM LC",
|
||||||
|
16777216 => "ATSC 8 VSB",
|
||||||
|
33554432 => "ATSC 16 VSB"
|
||||||
|
);
|
||||||
|
$this->set('formatoptions', $formatoptions);
|
||||||
|
|
||||||
|
$optionsPalette = array(
|
||||||
|
0 => 'Auto',
|
||||||
|
1497715271 => 'Gray',
|
||||||
|
877807426 => 'BGR32',
|
||||||
|
876758866 => 'RGB32',
|
||||||
|
861030210 => 'BGR24',
|
||||||
|
859981650 => 'RGB24',
|
||||||
|
1448695129 => '*YUYV',
|
||||||
|
1195724874 => '*JPEG',
|
||||||
|
1196444237 => '*MJPEG',
|
||||||
|
875836498 => '*RGB444',
|
||||||
|
1329743698 => '*RGB555',
|
||||||
|
1346520914 => '*RGB565',
|
||||||
|
1345466932 => '*YUV422P',
|
||||||
|
1345401140 => '*YUV411P',
|
||||||
|
875836505 => '*YUV444',
|
||||||
|
961959257 => '*YUV410',
|
||||||
|
842093913 => '*YUV420'
|
||||||
|
);
|
||||||
|
$this->set('optionsPalette', $optionsPalette);
|
||||||
|
|
||||||
|
$optionsMethod = array(
|
||||||
|
'v4l2' => 'Video For Linux 2'
|
||||||
|
);
|
||||||
|
$this->set('optionsMethod', $optionsMethod);
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="tab-pane" id="source">
|
<div class="tab-pane" id="source">
|
||||||
<?php
|
<?php
|
||||||
switch ($monitor['Type']) {
|
switch ($monitor['Type']) {
|
||||||
|
|
|
@ -1,46 +1,22 @@
|
||||||
<h2>Add Monitor</h2>
|
<ul class="nav nav-tabs">
|
||||||
|
<li><a data-toggle="tab" href="#general">General</a></li>
|
||||||
|
<li><a data-toggle="tab" href="#source">Source</a></li>
|
||||||
|
<li><a data-toggle="tab" href="#timestamp">Timestamp</a></li>
|
||||||
|
<li><a data-toggle="tab" href="#buffers">Buffers</a></li>
|
||||||
|
<li><a data-toggle="tab" href="#control">Control</a></li>
|
||||||
|
<li><a data-toggle="tab" href="#misc">Misc</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<?php
|
<?php echo $this->Form->create('Monitor', array( 'inputDefaults' => array( 'legend' => false, 'fieldset' => false))); ?>
|
||||||
$typeoptions = array("Local" => "Local", "Remote" => "Remote", "File" => "File", "Ffmpeg" => "Ffmpeg");
|
<?php echo $this->Form->input('Id', array('type' => 'hidden')); ?>
|
||||||
$functionoptions = array('Modect' => 'Modect', 'Monitor' => 'Monitor', 'Record' => 'Record', 'None' => 'None', 'Nodect' => 'Nodect', 'Mocord' => 'Mocord');
|
|
||||||
$defaultviewoptions = array('Events' => 'Events', 'Control' => 'Control');
|
|
||||||
$defaultrateoptions = array(10000 => '100x', 5000 => '50x', 2500 => '25x', 1000 => '10x', 400 => '4x', 200 => '2x', 100 => 'Real', 50 => '1/2x', 25 => '1/4x');
|
|
||||||
$defaultscaleoptions = array(400 => '4x', 300 => '4x', 200 => '2x', 100 => 'Actual', 75 => '3/4x', 50 => '1/2x', 33 => '1/3x', 25 => '1/4x');
|
|
||||||
|
|
||||||
echo $this->Form->create('Monitor');
|
<div class="tab-content">
|
||||||
echo $this->Form->inputs(array(
|
<?php echo $this->element('tabs-general'); ?>
|
||||||
'legend' => 'General',
|
<?php echo $this->element('tabs-source'); ?>
|
||||||
'Name',
|
<?php echo $this->element('tabs-timestamp'); ?>
|
||||||
'Type' => array('type' => 'select', 'options' => $typeoptions),
|
<?php echo $this->element('tabs-buffers'); ?>
|
||||||
'Function' => array('type' => 'select', 'options' => $functionoptions),
|
<?php echo $this->element('tabs-control'); ?>
|
||||||
'Enabled' => array('type' => 'checkbox')
|
<?php echo $this->element('tabs-misc'); ?>
|
||||||
));
|
</div>
|
||||||
echo $this->Form->inputs(array(
|
|
||||||
'legend' => 'Buffers',
|
|
||||||
'Image Buffer Size (frames)',
|
|
||||||
'Warmup Frames',
|
|
||||||
'Pre Event Image Count',
|
|
||||||
'Post Event Image Count',
|
|
||||||
'Stream Reply Image Buffer',
|
|
||||||
'Alarm Frame Count'
|
|
||||||
));
|
|
||||||
echo $this->Form->inputs(array(
|
|
||||||
'Timestamp Label Format' => array('default' => '%N - %d/%m/%y %H:%M:%S'),
|
|
||||||
'Timestamp Label X' => array('default' => 0),
|
|
||||||
'Timestamp Label Y' => array('default' => 0)
|
|
||||||
));
|
|
||||||
echo $this->Form->inputs(array(
|
|
||||||
'legend' => 'Misc',
|
|
||||||
'Event Prefix' => array('default' => 'Event-'),
|
|
||||||
'Section Length' => array('default' => 600),
|
|
||||||
'Frame Skip' => array('default' => 0),
|
|
||||||
'FPS Report Interval' => array('default' => 1000),
|
|
||||||
'Web Colour' => array('default' => 'red'),
|
|
||||||
'Signal Check Colour' => array('default' => '#0000c0'),
|
|
||||||
'Default View' => array('type' => 'select', 'options' => $defaultviewoptions, 'selected' => 'Events'),
|
|
||||||
'Default Rate' => array('type' => 'select', 'options' => $defaultrateoptions, 'selected' => 100),
|
|
||||||
'Default Scale' => array('type' => 'select', 'options' => $defaultscaleoptions, 'selected' => 100)
|
|
||||||
));
|
|
||||||
echo $this->Form->end('Save');
|
|
||||||
|
|
||||||
?>
|
<?php echo $this->Form->end('Save Monitor'); ?>
|
||||||
|
|
Loading…
Reference in New Issue