convert console table to divs

This commit is contained in:
Isaac Connor 2016-03-01 10:05:57 -05:00
parent e7303ccb08
commit 0853f26062
1 changed files with 45 additions and 44 deletions

View File

@ -22,6 +22,7 @@ require_once('includes/Server.php');
$servers = Server::find_all(); $servers = Server::find_all();
require_once('includes/Storage.php'); require_once('includes/Storage.php');
$storage_areas = Storage::find_all(); $storage_areas = Storage::find_all();
require_once('includes/Monitor.php');
$show_storage_areas = count($storage_areas) > 1 and canEdit( 'System' ) ? 1 : 0; $show_storage_areas = count($storage_areas) > 1 and canEdit( 'System' ) ? 1 : 0;
$eventCounts = array( $eventCounts = array(
@ -240,41 +241,41 @@ else
?>&nbsp;<?php echo makePopupLink( '?view=bandwidth', 'zmBandwidth', 'bandwidth', $bwArray[$_COOKIE['zmBandwidth']], ($user && $user['MaxBandwidth'] != 'low' ) ) ?> <?php echo translate('BandwidthHead') ?></h3> ?>&nbsp;<?php echo makePopupLink( '?view=bandwidth', 'zmBandwidth', 'bandwidth', $bwArray[$_COOKIE['zmBandwidth']], ($user && $user['MaxBandwidth'] != 'low' ) ) ?> <?php echo translate('BandwidthHead') ?></h3>
</div> </div>
<div id="content"> <div id="content">
<table id="consoleTable" cellspacing="0"> <div id="consoleTable" cellspacing="0">
<thead> <div class="thead">
<tr> <div class="tr">
<th class="colName"><?php echo translate('Name') ?></th> <div class="colName"><?php echo translate('Name') ?></div>
<th class="colFunction"><?php echo translate('Function') ?></th> <div class="colFunction"><?php echo translate('Function') ?></div>
<?php if ( count($servers) ) { ?> <?php if ( count($servers) ) { ?>
<th class="colServer"><?php echo translate('Server') ?></th> <div class="colServer"><?php echo translate('Server') ?></div>
<?php } ?> <?php } ?>
<th class="colSource"><?php echo translate('Source') ?></th> <div class="colSource"><?php echo translate('Source') ?></div>
<?php if ( $show_storage_areas ) { ?> <?php if ( $show_storage_areas ) { ?>
<th class="colStorage"><?php echo translate('Storage') ?></th> <div class="colStorage"><?php echo translate('Storage') ?></div>
<?php } ?> <?php } ?>
<?php <?php
for ( $i = 0; $i < count($eventCounts); $i++ ) for ( $i = 0; $i < count($eventCounts); $i++ )
{ {
?> ?>
<th class="colEvents"><?php echo $eventCounts[$i]['title'] ?></th> <div class="colEvents"><?php echo $eventCounts[$i]['title'] ?></div>
<?php <?php
} }
?> ?>
<th class="colZones"><?php echo translate('Zones') ?></th> <div class="colZones"><?php echo translate('Zones') ?></div>
<?php <?php
if ( canEdit('Monitors') ) if ( canEdit('Monitors') )
{ {
?> ?>
<th class="colOrder"><?php echo translate('Order') ?></th> <div class="colOrder"><?php echo translate('Order') ?></div>
<?php <?php
} }
?> ?>
<th class="colMark"><?php echo translate('Mark') ?></th> <div class="colMark"><?php echo translate('Mark') ?></div>
</tr> </div>
</thead> </div>
<tfoot> <div class="tfoot">
<tr> <div class="tr">
<td class="colLeftButtons" colspan="<?php $columns = 3; <div class="colLeftButtons" colspan="<?php $columns = 3;
if ( count($servers) > 1 ) { $columns += 1; } if ( count($servers) > 1 ) { $columns += 1; }
if ( $show_storage_areas ) { $columns += 1; } if ( $show_storage_areas ) { $columns += 1; }
echo $columns; echo $columns;
@ -282,26 +283,26 @@ echo $columns;
<input type="button" value="<?php echo translate('Refresh') ?>" onclick="location.reload(true);"/> <input type="button" value="<?php echo translate('Refresh') ?>" onclick="location.reload(true);"/>
<?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?> <?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?>
<?php echo makePopupButton( '?view=filter&amp;filter[terms][0][attr]=DateTime&amp;filter[terms][0][op]=%3c&amp;filter[terms][0][val]=now', 'zmFilter', 'filter', translate('Filters'), canView( 'Events' ) ) ?> <?php echo makePopupButton( '?view=filter&amp;filter[terms][0][attr]=DateTime&amp;filter[terms][0][op]=%3c&amp;filter[terms][0][val]=now', 'zmFilter', 'filter', translate('Filters'), canView( 'Events' ) ) ?>
</td> </div>
<?php <?php
for ( $i = 0; $i < count($eventCounts); $i++ ) for ( $i = 0; $i < count($eventCounts); $i++ )
{ {
parseFilter( $eventCounts[$i]['filter'] ); 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 makePopupLink( '?view='.$eventsView.'&amp;page=1'.$eventCounts[$i]['filter']['query'], $eventsWindow, $eventsView, $eventCounts[$i]['total'], canView( 'Events' ) ) ?></div>
<?php <?php
} }
?> ?>
<td class="colZones"><?php echo $zoneCount ?></td> <div class="colZones"><?php echo $zoneCount ?></div>
<td class="colRightButtons" colspan="<?php echo canEdit('Monitors')?2:1 ?>"><input type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/><input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/></td> <div class="colRightButtons" colspan="<?php echo canEdit('Monitors')?2:1 ?>"><input type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/><input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/></div>
</tr> </div>
</tfoot> </div>
<tbody> <div class="tbody">
<?php <?php
foreach( $displayMonitors as $monitor ) foreach( $displayMonitors as $monitor )
{ {
?> ?>
<tr title="<?php echo $monitor['Id'] ?>"> <div class="tr" title="<?php echo $monitor['Id'] ?>">
<?php <?php
if ( !$monitor['zmc'] ) if ( !$monitor['zmc'] )
$dclass = "errorText"; $dclass = "errorText";
@ -323,20 +324,20 @@ foreach( $displayMonitors as $monitor )
$fclass .= " disabledText"; $fclass .= " disabledText";
$scale = max( reScale( SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); $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> <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>
<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="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) ) { ?> <?php if ( count($servers) ) { ?>
<td class="colServer"><?php <div class="colServer"><?php
$Server = new Server( $monitor['ServerId'] ); $Server = new Server( $monitor['ServerId'] );
echo $Server->Name(); echo $Server->Name();
?></td> ?></div>
<?php } ?> <?php } ?>
<?php if ( $monitor['Type'] == "Local" ) { ?> <?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" ) { ?> <?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" ) { ?> <?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" ) { <?php } elseif ( $monitor['Type'] == "Ffmpeg" || $monitor['Type'] == "Libvlc" ) {
$domain = parse_url( $monitor['Path'], PHP_URL_HOST ); $domain = parse_url( $monitor['Path'], PHP_URL_HOST );
$shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] ); $shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
@ -344,42 +345,42 @@ echo $Server->Name();
$shortpath = 'Monitor ' . $monitor['Id']; $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" ) { ?> <?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 { ?> <?php } else { ?>
<td class="colSource">&nbsp;</td> <div class="colSource">&nbsp;</div>
<?php } ?> <?php } ?>
<?php if ( $show_storage_areas ) { ?> <?php if ( $show_storage_areas ) { ?>
<td class="colStorage"><?php <div class="colStorage"><?php
$Storage = new Storage( $monitor['StorageId'] ); $Storage = new Storage( $monitor['StorageId'] );
echo $Storage->Name(); echo $Storage->Name();
?></td> ?></div>
<?php } ?> <?php } ?>
<?php <?php
for ( $i = 0; $i < count($eventCounts); $i++ ) 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 makePopupLink( '?view='.$eventsView.'&amp;page=1'.$monitor['eventCounts'][$i]['filter']['query'], $eventsWindow, $eventsView, $monitor['EventCount'.$i], canView( 'Events' ) ) ?></div>
<?php <?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 class="colZones"><?php echo makePopupLink( '?view=zones&amp;mid='.$monitor['Id'], 'zmZones', array( 'zones', $monitor['Width'], $monitor['Height'] ), $monitor['ZoneCount'], canView( 'Monitors' ) ) ?></div>
<?php <?php
if ( canEdit('Monitors') ) 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 <?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> <div class="colMark"><input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" onclick="setButtonStates( this )"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></div>
</tr> </div>
<?php <?php
} }
?> ?>
</tbody> </div>
</table> </div>
</div> </div>
</form> </form>
</div> </div>