Compare commits

...

11 Commits

Author SHA1 Message Date
Isaac Connor ce4ea7d42e version bump 2016-05-02 18:15:28 -04:00
Isaac Connor 2f1e6cbd6b finish merge 2016-05-02 17:44:52 -04:00
Isaac Connor 16953c6e2b Merge branch 'storageareas' into thumbnail_on_console
Conflicts:
	db/zm_update-1.29.1.sql
	docs/installationguide/index.rst
	src/Makefile.am
	src/zm_event.cpp
	src/zm_event.h
	src/zm_monitor.cpp
	src/zm_monitor.h
	src/zm_zone.cpp
	src/zmf.cpp
	web/skins/classic/views/console.php
	web/skins/classic/views/monitor.php
2016-05-02 17:41:14 -04:00
Isaac Connor 5c2ee5a1c5 Merge branch 'master' into thumbnail_on_console
Conflicts:
	CMakeLists.txt
	configure.ac
	db/zm_update-1.29.1.sql
	distros/ubuntu1504_cmake/control
	docs/installationguide/index.rst
	scripts/Makefile.am
	src/Makefile.am
	src/zm_event.cpp
	src/zm_event.h
	src/zm_monitor.cpp
	src/zm_monitor.h
	src/zm_zone.cpp
	src/zmf.cpp
	web/includes/Makefile.am
	web/skins/classic/views/Makefile.am
	web/skins/classic/views/console.php
	web/skins/classic/views/js/console.js
	web/skins/classic/views/monitor.php
2016-05-02 14:36:07 -04:00
Isaac Connor c377c96367 add a missing semi colon just for completeness 2016-03-01 12:18:27 -05:00
Isaac Connor 010fcec990 fix setButtonStates. The checkboxes are an array. 2016-03-01 12:17:59 -05:00
Isaac Connor 51ef83dd94 split Monitor info columns into a separate group and the events into a separate group 2016-03-01 11:33:25 -05:00
Isaac Connor a407f9a0b7 pretty much finish the conversion 2016-03-01 11:32:38 -05:00
Isaac Connor 0853f26062 convert console table to divs 2016-03-01 10:05:57 -05:00
Isaac Connor e7303ccb08 change styles from table constructs to class constructs 2016-03-01 09:56:57 -05:00
Isaac Connor 0d8c16bb56 move console styles to view/console 2016-03-01 09:56:36 -05:00
14 changed files with 1844 additions and 1752 deletions

View File

@ -2,59 +2,5 @@
-- This updates a 1.29.0 database to 1.29.1
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name = 'Storage'
AND table_schema = DATABASE()
) > 0,
"SELECT 'Storage table exists'",
"CREATE TABLE `Storage` (
`Id` smallint(5) unsigned NOT NULL auto_increment,
`Path` varchar(64) NOT NULL default '',
`Name` varchar(64) NOT NULL default '',
PRIMARY KEY (`Id`)
)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
--
-- Add StorageId column to Monitors
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Monitors'
AND table_schema = DATABASE()
AND column_name = 'StorageId'
) > 0,
"SELECT 'Column StorageId exists in Monitors'",
"ALTER TABLE Monitors ADD `StorageId` smallint(5) unsigned AFTER `ServerId`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
--
-- Add StorageId column to Eventss
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Events'
AND table_schema = DATABASE()
AND column_name = 'StorageId'
) > 0,
"SELECT 'Column StorageId exists in Events'",
"ALTER TABLE Events ADD `StorageId` smallint(5) unsigned AFTER `MonitorId`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
-- Increase the size of the Pid field for FreeBSD
ALTER TABLE Logs MODIFY Pid int(10);

View File

@ -108,3 +108,57 @@ SELECT * FROM (SELECT NULL as Id,
WHERE NOT EXISTS (
SELECT Name FROM Controls WHERE name = 'Vivotek ePTZ'
) LIMIT 1;
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name = 'Storage'
AND table_schema = DATABASE()
) > 0,
"SELECT 'Storage table exists'",
"CREATE TABLE `Storage` (
`Id` smallint(5) unsigned NOT NULL auto_increment,
`Path` varchar(64) NOT NULL default '',
`Name` varchar(64) NOT NULL default '',
PRIMARY KEY (`Id`)
)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
--
-- Add StorageId column to Monitors
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Monitors'
AND table_schema = DATABASE()
AND column_name = 'StorageId'
) > 0,
"SELECT 'Column StorageId exists in Monitors'",
"ALTER TABLE Monitors ADD `StorageId` smallint(5) unsigned AFTER `ServerId`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
--
-- Add StorageId column to Eventss
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Events'
AND table_schema = DATABASE()
AND column_name = 'StorageId'
) > 0,
"SELECT 'Column StorageId exists in Events'",
"ALTER TABLE Events ADD `StorageId` smallint(5) unsigned AFTER `MonitorId`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;

View File

@ -1,3 +1,9 @@
zoneminder (1.30.2-trusty-2016050202) trusty; urgency=medium
* include thumnbails on console
-- Isaac Connor <iconnor@connortechnology.com> Mon, 02 May 2016 17:50:37 -0400
zoneminder (1.30.2-trusty-2016050201) trusty; urgency=medium
* add Servers support to API

View File

@ -0,0 +1,14 @@
Installation Guide
======================================
Contents:
.. toctree::
:maxdepth: 2
ubuntu
debian
fedora
centos
redhat
multiserver

View File

@ -2078,7 +2078,7 @@ void Monitor::ReloadLinkedMonitors( const char *p_linked_monitors )
#if ZM_HAS_V4L
int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose purpose ) {
std::string sql = "select Id, Name, ServerId, StorageId, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, SaveJPEGs, VideoWriter, EncoderParameters, RecordAudio, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, LabelSize, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour, Exif from Monitors where Function != 'None' and Type = 'Local'";
;
if ( device[0] ) {
sql += " AND Device='";
sql += device;

View File

@ -303,6 +303,7 @@ int main( int argc, char *argv[] )
// Print errors if there was a problem
if ( n_bytes < 1 )
{
Error( "Only read %d bytes of %d\n", bytes_read, frame_header.image_length);
if ( n_bytes < 0 )
{

View File

@ -474,22 +474,3 @@ input[type=submit]:disabled {
}
/*
* Console table for the main event table
*/
#consoleTable td, #consoleTable th {
padding: 5px;
border-bottom: 2px solid #f2f2f2;
}
#consoleTable input[type=button] {
margin-right: 3px !important;
}
#consoleTable tfoot {
background-color: #f2f2f2;
}

View File

@ -40,46 +40,92 @@
#consoleTable {
width: 100%;
border-collapse: collapse;
display: table;
}
#consoleTable tr.highlight {
#consoleTable div.highlight {
background-color: #eeeeee;
}
#consoleTable thead th {
padding-bottom: 4px;
#consoleTable .thead .tr div {
vertical-align: middle;
}
#consoleTable tfoot td {
padding-top: 4px;
vertical-align: middle;
#consoleTable .MonitorInfo {
display: table-cell;
width: auto;
}
#consoleTable th,td {
height: 16px;
#consoleTable .MonitorInfo div {
display: inline-block;
text-align: left;
width: 19%;
padding: 5px 0;
}
#consoleTable .Events {
display: table-cell;
width: 381px;
}
#consoleTable .Events .Events {
width: 50px;
}
#consoleTable .Events div {
display: inline-block;
padding-bottom: 0;
}
#consoleTable .tfoot .tr {
padding-top: 4px;
}
#consoleTable .tfoot .tr div {
vertical-align: middle;
}
#consoleTable .tr div {
}
#consoleTable .colOrder {
width: 47px;
text-align: center;
display: table-cell;
}
#consoleTable .colMark {
width: 32px;
text-align: center;
display: table-cell;
}
#consoleTable .colEvents {
text-align: right;
}
#consoleTable .Hour {
width: 35px;
}
#consoleTable .Day {
width: 42px;
}
#consoleTable .Week {
width: 42px;
}
#consoleTable .Month {
width: 50px;
}
#consoleTable .Archived {
width: 62px;
}
#consoleTable .colZones {
width: 40px;
text-align: right;
display: table-cell;
}
#consoleTable .colLeftButtons {
text-align: left;
min-width:400px;
}
#consoleTable .colLeftButtons input {
@ -88,10 +134,47 @@
#consoleTable .colRightButtons {
text-align: right;
padding-right: 8px;
min-width: 158px;
margin-right: -32px;
}
#consoleTable .colRightButtons input {
margin: 0 8px;
}
/*
* Console table for the main event table
*/
#consoleTable .tr {
display: table-row;
}
#consoleTable .Monitor {
display: table-row;
}
#consoleTable .tr {
padding: 5px 0;
border-bottom: 2px solid #f2f2f2;
line-height: auto;
}
#consoleTable input[type=button] {
margin-right: 3px !important;
}
#consoleTable .tfoot {
display: table-footer-group;
background-color: #f2f2f2;
}
#consoleTable .tbody {
display: table-row-group;
}
#consoleTable .thead {
display: table-header-group;
text-transform: uppercase;
font-size: 0.8em;
font-weight: 600;
}

View File

@ -1,5 +1,4 @@
<?php
require_once('includes/Server.php');
$servers = Server::find_all();
require_once('includes/Storage.php');
$storage_areas = Storage::find_all();
@ -11,72 +10,75 @@ xhtmlHeaders( __FILE__, translate('Console') );
<form name="monitorForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="action" value=""/>
<?php include("skins/$skin/views/header.php") ?>
<div class="container-fluid">
<table id="consoleTable" cellspacing="0">
<thead>
<tr>
<th class="colName"><?php echo translate('Name') ?></th>
<th class="colFunction"><?php echo translate('Function') ?></th>
<div id="content" class="container-fluid">
<div id="consoleTable" cellspacing="0">
<div class="thead">
<div class="tr">
<div class="MonitorInfo">
<div class="colName"><?php echo translate('Name') ?></div>
<div class="colFunction"><?php echo translate('Function') ?></div>
<?php if ( count($servers) ) { ?>
<th class="colServer"><?php echo translate('Server') ?></th>
<div class="colServer"><?php echo translate('Server') ?></div>
<?php } ?>
<th class="colSource"><?php echo translate('Source') ?></th>
<div class="colSource"><?php echo translate('Source') ?></div>
<?php if ( $show_storage_areas ) { ?>
<th class="colStorage"><?php echo translate('Storage') ?></th>
<div class="colStorage"><?php echo translate('Storage') ?></div>
<?php } ?>
</div>
<div class="Events">
<?php
for ( $i = 0; $i < count($eventCounts); $i++ )
{
?>
<th class="colEvents"><?php echo $eventCounts[$i]['title'] ?></th>
<div class="colEvents <?php echo $eventCounts[$i]['title'] ?>"><?php echo $eventCounts[$i]['title'] ?></div>
<?php
}
?>
<th class="colZones"><?php echo translate('Zones') ?></th>
</div>
<div class="colZones"><?php echo translate('Zones') ?></div>
<?php
if ( canEdit('Monitors') )
{
?>
<th class="colOrder"><?php echo translate('Order') ?></th>
<div class="colOrder"><?php echo translate('Order') ?></div>
<?php
}
?>
<th class="colMark"><?php echo translate('Mark') ?></th>
</tr>
</thead>
<tfoot>
<tr>
<td class="colLeftButtons" colspan="<?php $columns = 3;
<div class="colMark"><?php echo translate('Mark') ?></div>
</div>
</div>
<div class="tfoot">
<div class="tr">
<div class="colLeftButtons" colspan="<?php $columns = 3;
if ( count($servers) > 1 ) { $columns += 1; }
if ( $show_storage_areas ) { $columns += 1; }
echo $columns;
?>">
<input type="button" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor( this )"/>
<!-- <?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?> -->
</td>
</div>
<div class="Events">
<?php
for ( $i = 0; $i < count($eventCounts); $i++ )
{
parseFilter( $eventCounts[$i]['filter'] );
?>
<td class="colEvents"><?php echo makePopupLink( '?view='.$eventsView.'&amp;page=1'.$eventCounts[$i]['filter']['query'], $eventsWindow, $eventsView, $eventCounts[$i]['total'], canView( 'Events' ) ) ?></td>
<div class="colEvents <?php echo $eventCounts[$i]['title'] ?>"><?php echo makePopupLink( '?view='.$eventsView.'&amp;page=1'.$eventCounts[$i]['filter']['query'], $eventsWindow, $eventsView, $eventCounts[$i]['total'], canView( 'Events' ) ) ?></div>
<?php
}
?>
<td class="colZones"><?php echo $zoneCount ?></td>
<td class="colRightButtons" colspan="<?php echo canEdit('Monitors')?2:1 ?>"><input class="btn btn-default" type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/><input class="btn btn-default" type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/></td>
</tr>
</tfoot>
<tbody>
</div>
<div class="colZones"><?php echo $zoneCount ?></div>
<div class="colRightButtons" colspan="<?php echo canEdit('Monitors')?2:1 ?>"><input class="btn btn-default" type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/><input class="btn btn-default" type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/></div>
</div>
</div>
<div class="tbody">
<?php
foreach( $displayMonitors as $monitor )
{
?>
<tr title="<?php echo $monitor['Id'] ?>">
<div class="tr" title="<?php echo $monitor['Id'] ?>">
<?php
if ( !$monitor['zmc'] )
$dclass = "errorText";
@ -98,20 +100,21 @@ foreach( $displayMonitors as $monitor )
$fclass .= " disabledText";
$scale = max( reScale( SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
?>
<td class="colName"><?php echo makePopupLink( '?view=watch&amp;mid='.$monitor['Id'], 'zmWatch'.$monitor['Id'], array( 'watch', reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ) ), $monitor['Name'], $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?></td>
<td class="colFunction"><?php echo makePopupLink( '?view=function&amp;mid='.$monitor['Id'], 'zmFunction', 'function', '<span class="'.$fclass.'">'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'</span>', canEdit( 'Monitors' ) ) ?></td>
<div class="MonitorInfo">
<div class="colName"><?php echo makePopupLink( '?view=watch&amp;mid='.$monitor['Id'], 'zmWatch'.$monitor['Id'], array( 'watch', reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ) ), $monitor['Name'], $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?></div>
<div class="colFunction"><?php echo makePopupLink( '?view=function&amp;mid='.$monitor['Id'], 'zmFunction', 'function', '<span class="'.$fclass.'">'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'</span>', canEdit( 'Monitors' ) ) ?></div>
<?php if ( count($servers) ) { ?>
<td class="colServer"><?php
<div class="colServer"><?php
$Server = new Server( $monitor['ServerId'] );
echo $Server->Name();
?></td>
?></div>
<?php } ?>
<?php if ( $monitor['Type'] == "Local" ) { ?>
<td class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$monitor['Device'].' ('.$monitor['Channel'].')</span>', canEdit( 'Monitors' ) ) ?></td>
<div class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$monitor['Device'].' ('.$monitor['Channel'].')</span>', canEdit( 'Monitors' ) ) ?></div>
<?php } elseif ( $monitor['Type'] == "Remote" ) { ?>
<td class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*@/', '', $monitor['Host'] ).'</span>', canEdit( 'Monitors' ) ) ?></td>
<div class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*@/', '', $monitor['Host'] ).'</span>', canEdit( 'Monitors' ) ) ?></div>
<?php } elseif ( $monitor['Type'] == "File" ) { ?>
<td class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*\//', '', $monitor['Path'] ).'</span>', canEdit( 'Monitors' ) ) ?></td>
<div class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*\//', '', $monitor['Path'] ).'</span>', canEdit( 'Monitors' ) ) ?></div>
<?php } elseif ( $monitor['Type'] == "Ffmpeg" || $monitor['Type'] == "Libvlc" ) {
$domain = parse_url( $monitor['Path'], PHP_URL_HOST );
$shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
@ -119,42 +122,41 @@ echo $Server->Name();
$shortpath = 'Monitor ' . $monitor['Id'];
}
?>
<td class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$shortpath.'</span>', canEdit( 'Monitors' ) ) ?></td>
<div class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$shortpath.'</span>', canEdit( 'Monitors' ) ) ?></div>
<?php } elseif ( $monitor['Type'] == "cURL" ) { ?>
<td class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*\//', '', $monitor['Path'] ).'</span>', canEdit( 'Monitors' ) ) ?></td>
<div class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*\//', '', $monitor['Path'] ).'</span>', canEdit( 'Monitors' ) ) ?></div>
<?php } else { ?>
<td class="colSource">&nbsp;</td>
<div class="colSource">&nbsp;</div>
<?php } ?>
<?php if ( $show_storage_areas ) { ?>
<td class="colStorage"><?php
$Storage = new Storage( $monitor['StorageId'] );
echo $Storage->Name();
?></td>
<div class="colStorage"><?php $Storage = new Storage( $monitor['StorageId'] ); echo $Storage->Name(); ?></div>
<?php } ?>
</div><div class="Events">
<?php
for ( $i = 0; $i < count($eventCounts); $i++ )
{
?>
<td class="colEvents"><?php echo makePopupLink( '?view='.$eventsView.'&amp;page=1'.$monitor['eventCounts'][$i]['filter']['query'], $eventsWindow, $eventsView, $monitor['EventCount'.$i], canView( 'Events' ) ) ?></td>
<div class="colEvents <?php echo $eventCounts[$i]['title'] ?>"><?php echo makePopupLink( '?view='.$eventsView.'&amp;page=1'.$monitor['eventCounts'][$i]['filter']['query'], $eventsWindow, $eventsView, $monitor['EventCount'.$i], canView( 'Events' ) ) ?></div>
<?php
}
?>
<td class="colZones"><?php echo makePopupLink( '?view=zones&amp;mid='.$monitor['Id'], 'zmZones', array( 'zones', $monitor['Width'], $monitor['Height'] ), $monitor['ZoneCount'], canView( 'Monitors' ) ) ?></td>
</div>
<div class="colZones"><?php echo makePopupLink( '?view=zones&amp;mid='.$monitor['Id'], 'zmZones', array( 'zones', $monitor['Width'], $monitor['Height'] ), $monitor['ZoneCount'], canView( 'Monitors' ) ) ?></div>
<?php
if ( canEdit('Monitors') )
{
?>
<td class="colOrder"><?php echo makeLink( '?view='.$view.'&amp;action=sequence&amp;mid='.$monitor['Id'].'&amp;smid='.$seqIdUpList[$monitor['Id']], '<img src="'.$seqUpFile.'" alt="Up"/>', $monitor['Sequence']>$minSequence ) ?><?php echo makeLink( '?view='.$view.'&amp;action=sequence&amp;mid='.$monitor['Id'].'&amp;smid='.$seqIdDownList[$monitor['Id']], '<img src="'.$seqDownFile.'" alt="Down"/>', $monitor['Sequence']<$maxSequence ) ?></td>
<div class="colOrder"><?php echo makeLink( '?view='.$view.'&amp;action=sequence&amp;mid='.$monitor['Id'].'&amp;smid='.$seqIdUpList[$monitor['Id']], '<img src="'.$seqUpFile.'" alt="Up"/>', $monitor['Sequence']>$minSequence ) ?><?php echo makeLink( '?view='.$view.'&amp;action=sequence&amp;mid='.$monitor['Id'].'&amp;smid='.$seqIdDownList[$monitor['Id']], '<img src="'.$seqDownFile.'" alt="Down"/>', $monitor['Sequence']<$maxSequence ) ?></div>
<?php
}
?>
<td class="colMark"><input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" onclick="setButtonStates( this )"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></td>
</tr>
<div class="colMark"><input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" onclick="setButtonStates( this );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></div>
</div>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div id="footer">

View File

@ -1,22 +1,27 @@
var jsTranslatedAddText;
var jsTranslatedCloneText;
function setButtonStates( element )
{
function setButtonStates( element ) {
var form = element.form;
var checked = 0;
for ( var i = 0; i < form.elements.length; i++ )
{
if ( form.elements[i].type == "checkbox" )
{
if ( form.elements[i].checked )
{
for ( var i = 0, i_length=form.elements.length; i < i_length; i++ ) {
if ( form.elements[i].type == "checkbox" ) {
if ( form.elements[i].checked ) {
if ( checked++ > 1 )
break;
}
} else if ( form.elements[i].length ) {
for( var j = 0, j_length = form.elements[i].length; j < j_length; j += 1 ) {
if ( form.elements[j].type == "checkbox" ) {
if ( form.elements[j].checked ) {
if ( checked++ > 1 )
break;
}
}
} // end foreach element
}
$(element).getParent( 'tr' ).toggleClass( 'highlight' );
} /// end for each element
$(element).getParent( '.tr' ).toggleClass( 'highlight' );
form.editBtn.disabled = (checked!=1);
form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;