mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Fix issue with info box messages
This commit is contained in:
parent
251fc46d17
commit
deb69a0659
@ -378,33 +378,25 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
|
|||||||
// JavaScript help vars.
|
// JavaScript help vars.
|
||||||
$messageCreated = html_print_table($messageTable, true);
|
$messageCreated = html_print_table($messageTable, true);
|
||||||
$autocloseTime = ((int) $config['notification_autoclose_time'] * 1000);
|
$autocloseTime = ((int) $config['notification_autoclose_time'] * 1000);
|
||||||
$definedMessageTop = '20';
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function(){
|
|
||||||
var $definedTop = <?php echo $definedMessageTop; ?>;
|
|
||||||
var $listOfMessages = document.querySelectorAll('.info_box_container');
|
|
||||||
$("#<?php echo $id; ?>").css('top', (parseInt($definedTop) + (100*($listOfMessages.length)))+'px');
|
|
||||||
|
|
||||||
<?php if (($autoclose === true) && ($autocloseTime > 0)) : ?>
|
$classes = 'info_box_container';
|
||||||
setTimeout(() => { close_info_box('<?php echo $id; ?>'); }, <?php echo $autocloseTime; ?>);
|
$classes .= (($autoclose === true) && ($autocloseTime > 0)) ? ' info_box_autoclose' : '';
|
||||||
<?php endif; ?>
|
|
||||||
});
|
|
||||||
|
|
||||||
<?php if (($first_execution === true) && ($no_close_bool === false)) : ?>
|
// This session var is defined in index.
|
||||||
function close_info_box(id) { $("#" + id).fadeOut('slow', function(){ $("#" + id).remove(); }); }
|
if (isset($_SESSION['info_box_count']) === false) {
|
||||||
<?php endif; ?>
|
$_SESSION['info_box_count'] = 1;
|
||||||
</script>
|
} else {
|
||||||
<?php
|
$_SESSION['info_box_count']++;
|
||||||
$jsCode = ob_get_clean();
|
}
|
||||||
|
|
||||||
|
$position = (20 + ((int) $_SESSION['info_box_count'] * 100));
|
||||||
|
|
||||||
$output = html_print_div(
|
$output = html_print_div(
|
||||||
[
|
[
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'style' => 'top: 120px;',
|
'style' => 'top: '.$position.'px;',
|
||||||
'class' => 'info_box_container',
|
'class' => $classes,
|
||||||
'content' => $jsCode.$messageCreated,
|
'content' => $messageCreated,
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
@ -2296,3 +2296,15 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function close_info_box(id) {
|
||||||
|
$("#" + id).fadeOut("slow", function() {
|
||||||
|
$("#" + id).remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function autoclose_info_box(id, autoCloseTime) {
|
||||||
|
setTimeout(() => {
|
||||||
|
close_info_box(id);
|
||||||
|
}, autoCloseTime);
|
||||||
|
}
|
||||||
|
@ -42,6 +42,11 @@ if (__PAN_XHPROF__ === 1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Needed for InfoBox count.
|
||||||
|
if (isset($_SESSION['info_box_count']) === true) {
|
||||||
|
$_SESSION['info_box_count'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Set character encoding to UTF-8
|
// Set character encoding to UTF-8
|
||||||
// fixes a lot of multibyte character issues.
|
// fixes a lot of multibyte character issues.
|
||||||
if (function_exists('mb_internal_encoding') === true) {
|
if (function_exists('mb_internal_encoding') === true) {
|
||||||
@ -1674,6 +1679,17 @@ require 'include/php_to_js_values.php';
|
|||||||
"html"
|
"html"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Info messages action.
|
||||||
|
$(document).ready(function() {
|
||||||
|
var $autocloseTime = <?php echo ((int) $config['notification_autoclose_time'] * 1000); ?>;
|
||||||
|
var $listOfMessages = document.querySelectorAll('.info_box_autoclose');
|
||||||
|
$listOfMessages.forEach(
|
||||||
|
function(item) {
|
||||||
|
autoclose_info_box(item.id, $autocloseTime)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
if (__PAN_XHPROF__ === 1) {
|
if (__PAN_XHPROF__ === 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user