mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Huge improvement on the public console visualization
This commit is contained in:
parent
1f455a5958
commit
2bea12d737
@ -75,102 +75,148 @@ $bheight = $layout["height"];
|
|||||||
if (!isset($config['pure']))
|
if (!isset($config['pure']))
|
||||||
$config['pure'] = 0;
|
$config['pure'] = 0;
|
||||||
|
|
||||||
// Render map
|
$xhr = (bool) get_parameter('xhr');
|
||||||
$options = array();
|
if ($xhr) {
|
||||||
echo '<div style="width: 95%; background: white; margin: 20px auto 20px auto; box-shadow: 10px 10px 5px #000;">';
|
$width = (int) get_parameter('width');
|
||||||
echo "<h1>" . $layout_name . "</h1>";
|
if ($width <= 0) $width = null;
|
||||||
|
$height = (int) get_parameter('height');
|
||||||
|
if ($height <= 0) $height = null;
|
||||||
|
|
||||||
visual_map_print_visual_map ($id_layout, true, true, null, null, '../../', true, $graph_javascript);
|
ob_start();
|
||||||
|
// Render map
|
||||||
$values = array ();
|
visual_map_print_visual_map($id_layout, true, true, $width, $height,
|
||||||
$values[5] = human_time_description_raw (5);
|
'../../', true, $graph_javascript, true);
|
||||||
$values[30] = human_time_description_raw (30);
|
return;
|
||||||
$values[SECONDS_1MINUTE] = human_time_description_raw(SECONDS_1MINUTE);
|
}
|
||||||
$values[SECONDS_2MINUTES] = human_time_description_raw(SECONDS_2MINUTES);
|
else {
|
||||||
$values[SECONDS_5MINUTES] = human_time_description_raw(SECONDS_5MINUTES);
|
echo '<div id="vc-container"></div>';
|
||||||
$values[SECONDS_10MINUTES] = human_time_description_raw(SECONDS_10MINUTES);
|
|
||||||
$values[SECONDS_30MINUTES] = human_time_description_raw(SECONDS_30MINUTES);
|
|
||||||
|
|
||||||
$table->width = '90%';
|
|
||||||
$table->data = array ();
|
|
||||||
$table->style = array ();
|
|
||||||
$table->style[2] = 'text-align: center';
|
|
||||||
$table->data[0][0] = __('Autorefresh time');
|
|
||||||
|
|
||||||
$table->data[0][1] = html_print_select ($values, 'refr', $refr, '', 'N/A', 0, true, false, false);
|
|
||||||
$table->data[0][2] = html_print_submit_button (__('Refresh'), '', false, 'class="sub next"', true);
|
|
||||||
$table->data[0][2] .= html_print_input_hidden ('vc_refr', $config["vc_refr"], true);
|
|
||||||
$table->data[0][3] .= '<a href="javascript: show_dialog_qrcode();">' .
|
|
||||||
'<img src="../../images/qrcode_icon.jpg"/>' .
|
|
||||||
'</a>';
|
|
||||||
|
|
||||||
echo '<div style="height:30px"> </div>';
|
|
||||||
|
|
||||||
if ($refr > 0) {
|
|
||||||
echo '<div id="countdown"><br /></div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div style="height:30px"> </div>';
|
// Floating menu - Start
|
||||||
|
echo '<div id="vc-controls">';
|
||||||
|
|
||||||
echo "<div style='display: none;' id='qrcode_container' title='" . __('QR code of the page') . "'>";
|
echo '<div id="menu_tab">';
|
||||||
echo "<div id='qrcode_container_image'></div>";
|
echo '<ul class="mn">';
|
||||||
echo "</div>";
|
|
||||||
|
|
||||||
echo '<form method="post">';
|
// QR code
|
||||||
html_print_input_hidden ('pure', $config["pure"]);
|
echo '<li class="nomn">';
|
||||||
html_print_input_hidden ('id', $id_layout);
|
echo '<a href="javascript: show_dialog_qrcode();">';
|
||||||
html_print_table ($table);
|
echo '<img class="vc-qr" src="../../images/qrcode_icon.jpg"/>';
|
||||||
echo '</form>';
|
echo '</a>';
|
||||||
|
echo '</li>';
|
||||||
|
|
||||||
|
// Countdown
|
||||||
|
echo '<li class="nomn">';
|
||||||
|
echo '<div class="vc-refr">';
|
||||||
|
echo '<div class="vc-countdown"></div>';
|
||||||
|
echo '<div id="vc-refr-form">';
|
||||||
|
echo __('Refresh') . ':';
|
||||||
|
echo html_print_select(get_refresh_time_array(), 'refr', $refr, '', '', 0, true, false, false);
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
|
echo '</li>';
|
||||||
|
|
||||||
|
// Console name
|
||||||
|
echo '<li class="nomn">';
|
||||||
|
echo '<div class="vc-title">' . $layout_name . '</div>';
|
||||||
|
echo '</li>';
|
||||||
|
|
||||||
|
echo '</ul>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
echo '</div>';
|
||||||
|
// Floating menu - End
|
||||||
|
|
||||||
ui_require_jquery_file ('countdown');
|
// QR code dialog
|
||||||
ui_require_css_file ('countdown');
|
echo '<div style="display: none;" id="qrcode_container" title="' . __('QR code of the page') . '">';
|
||||||
|
echo '<div id="qrcode_container_image"></div>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
ui_require_jquery_file('countdown');
|
||||||
|
ui_require_javascript_file('wz_jsgraphics');
|
||||||
ui_require_javascript_file ('wz_jsgraphics');
|
ui_require_javascript_file('pandora_visual_console');
|
||||||
ui_require_javascript_file ('pandora_visual_console');
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
div#vc-controls {
|
||||||
|
position: fixed;
|
||||||
|
top: 30px;
|
||||||
|
right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#vc-controls div.vc-title, div#vc-controls div.vc-refr {
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-left: 3px;
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
div#vc-controls div.vc-refr>div {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
div#vc-controls img.vc-qr {
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
/* <![CDATA[ */
|
$(document).ready(function () {
|
||||||
$(document).ready (function () {
|
var refr = <?php echo (int) $refr; ?>;
|
||||||
$(document).ready(function() {
|
|
||||||
$( "#qrcode_container" ).dialog({
|
var fetchMap = function () {
|
||||||
|
$.ajax({
|
||||||
|
url: 'public_console.php',
|
||||||
|
type: 'GET',
|
||||||
|
dataType: 'html',
|
||||||
|
data: {
|
||||||
|
hash: '<?php echo $hash; ?>',
|
||||||
|
id_layout: <?php echo $id_layout; ?>,
|
||||||
|
graph_javascript: <?php echo (int) $graph_javascript; ?>,
|
||||||
|
id_user: '<?php echo $config['id_user']; ?>',
|
||||||
|
width: $(window).width(),
|
||||||
|
height: $(window).height(),
|
||||||
|
xhr: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.done(function (data, textStatus, xhr) {
|
||||||
|
$('div#vc-container').html(data);
|
||||||
|
startCountDown(refr, fetchMap);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var startCountDown = function (duration, cb) {
|
||||||
|
$('div.vc-countdown').countdown('destroy');
|
||||||
|
if (!duration) return;
|
||||||
|
var t = new Date();
|
||||||
|
t.setTime(t.getTime() + duration * 1000);
|
||||||
|
$('div.vc-countdown').countdown({
|
||||||
|
until: t,
|
||||||
|
format: 'MS',
|
||||||
|
layout: '(%M%nn%M:%S%nn%S <?php echo __('Until refresh'); ?>) ',
|
||||||
|
alwaysExpire: true,
|
||||||
|
onExpiry: function () {
|
||||||
|
$('div.vc-countdown').countdown('destroy');
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto hide controls
|
||||||
|
var controls = document.getElementById('vc-controls');
|
||||||
|
autoHideElement(controls, 1000);
|
||||||
|
|
||||||
|
$('#qrcode_container').dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true
|
modal: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('select#refr').change(function (event) {
|
||||||
|
refr = Number.parseInt(event.target.value, 10);
|
||||||
|
startCountDown(refr, fetchMap);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#refr").change(function () {
|
// Start the map fetch
|
||||||
$("#hidden-vc_refr").val($("#refr option:selected").val());
|
fetchMap();
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php
|
|
||||||
if ($refr > 0) {
|
|
||||||
?>
|
|
||||||
t = new Date();
|
|
||||||
t.setTime (t.getTime() + <?php echo $refr * 1000; ?>);
|
|
||||||
$("#countdown").countdown(
|
|
||||||
{
|
|
||||||
until: t,
|
|
||||||
format: 'MS',
|
|
||||||
description: '<?php echo __('Until refresh'); ?>',
|
|
||||||
onExpiry: function () {
|
|
||||||
href = "<?php echo ui_get_full_url();?>";
|
|
||||||
$exists_refr = href.indexOf("refr");
|
|
||||||
if ($exists_refr == -1) {
|
|
||||||
href = href + "&refr=<?php echo $refr;?>";
|
|
||||||
}
|
|
||||||
$(document).attr ("location", href);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
});
|
|
||||||
|
|
||||||
/* ]]> */
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user