mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 17:59:21 +02:00
Overlay notifications updated.
This commit is contained in:
parent
ab0600151e
commit
5ff1ca45f8
7 changed files with 78 additions and 27 deletions
|
@ -497,7 +497,7 @@ class Stream_Playlist
|
|||
}
|
||||
|
||||
$democratic->add_vote($items);
|
||||
mouse_message(T_('Vote added'));
|
||||
display_notification(T_('Vote added'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
//
|
||||
$(document).ready(function () {
|
||||
initTabs();
|
||||
$(document).mousemove(mouse_message_move);
|
||||
$('#notification').click(function() {
|
||||
clearNotification();
|
||||
});
|
||||
});
|
||||
|
||||
function initTabs()
|
||||
|
@ -86,23 +88,25 @@ function toggleVisible(element) {
|
|||
}
|
||||
}
|
||||
|
||||
var mouseTimeout = null;
|
||||
function mouseMessage(message, timeout) {
|
||||
if (mouseTimeout != null) {
|
||||
clearTimeout(mouseTimeout);
|
||||
mouseTimeout = null;
|
||||
var notificationTimeout = null;
|
||||
function displayNotification(message, timeout) {
|
||||
if (notificationTimeout != null || !message) {
|
||||
clearNotification();
|
||||
}
|
||||
$('#mouse_message').html(message);
|
||||
$('#mouse_message').fadeIn();
|
||||
mouseTimeout = setTimeout(function() {
|
||||
$('#mouse_message').fadeOut();
|
||||
|
||||
if (message) {
|
||||
$('#notification-content').html(message);
|
||||
$('#notification').removeClass('notification-out');
|
||||
notificationTimeout = setTimeout(function() {
|
||||
clearNotification();
|
||||
}, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
function mouse_message_move(e) {
|
||||
$('#mouse_message').css({top: e.clientY + 10,
|
||||
left: e.clientX + 10
|
||||
});
|
||||
function clearNotification() {
|
||||
clearTimeout(notificationTimeout);
|
||||
notificationTimeout = null;
|
||||
$('#notification').addClass("notification-out");
|
||||
}
|
||||
|
||||
// delayRun
|
||||
|
|
|
@ -666,10 +666,10 @@ function toggle_visible($element)
|
|||
|
||||
} // toggle_visible
|
||||
|
||||
function mouse_message($message, $timeout = 1000)
|
||||
function display_notification($message, $timeout = 5000)
|
||||
{
|
||||
echo "<script type='text/javascript'>";
|
||||
echo "mouseMessage('" . $message . "', " . $timeout . ");";
|
||||
echo "displayNotification('" . $message . "', " . $timeout . ");";
|
||||
echo "</script>\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ require_once 'lib/init.php';
|
|||
$title = "";
|
||||
$text = "";
|
||||
$next_url = "";
|
||||
$notification_text = "";
|
||||
|
||||
// Switch on the action
|
||||
switch ($_REQUEST['action']) {
|
||||
|
@ -60,6 +61,12 @@ switch ($_REQUEST['action']) {
|
|||
load_gettext();
|
||||
|
||||
$preferences = $GLOBALS['user']->get_preferences($_REQUEST['tab'], $system);
|
||||
|
||||
if ($_POST['method'] == 'admin') {
|
||||
$notification_text = T_('Server preferences updated successfully');
|
||||
} else {
|
||||
$notification_text = T_('User preferences updated successfully');
|
||||
}
|
||||
break;
|
||||
case 'admin_update_preferences':
|
||||
// Make sure only admins here
|
||||
|
@ -74,6 +81,7 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
|
||||
update_preferences($_POST['user_id']);
|
||||
|
||||
header("Location: " . AmpConfig::get('web_path') . "/admin/users.php?action=show_preferences&user_id=" . scrub_out($_POST['user_id']));
|
||||
break;
|
||||
case 'admin':
|
||||
|
@ -131,11 +139,13 @@ switch ($_REQUEST['action']) {
|
|||
$GLOBALS['user']->upload_avatar();
|
||||
Error::add('general', T_('Error Update Failed'));
|
||||
} else {
|
||||
$_REQUEST['action'] = 'confirm';
|
||||
//$_REQUEST['action'] = 'confirm';
|
||||
$title = T_('Updated');
|
||||
$text = T_('Your Account has been updated');
|
||||
$next_url = AmpConfig::get('web_path') . '/preferences.php?tab=account';
|
||||
}
|
||||
|
||||
$notification_text = T_('User updated successfully');
|
||||
break;
|
||||
default:
|
||||
$fullname = $GLOBALS['user']->fullname;
|
||||
|
@ -153,6 +163,10 @@ switch ($_REQUEST['action']) {
|
|||
show_confirmation($title,$text,$next_url,$cancel);
|
||||
break;
|
||||
default:
|
||||
if (!empty($notification_text)) {
|
||||
display_notification($notification_text);
|
||||
}
|
||||
|
||||
// Show the default preferences page
|
||||
require AmpConfig::get('prefix') . '/templates/show_preferences.inc.php';
|
||||
break;
|
||||
|
|
|
@ -132,7 +132,7 @@ switch ($_REQUEST['action']) {
|
|||
ob_end_clean();*/
|
||||
debug_event('playlist', 'Items added successfully!', '5');
|
||||
ob_start();
|
||||
mouse_message(T_('Added to playlist'));
|
||||
display_notification(T_('Added to playlist'));
|
||||
$results['rfc3514'] = ob_get_clean();
|
||||
} else {
|
||||
debug_event('playlist', 'No item to add. Aborting...', '5');
|
||||
|
|
|
@ -297,7 +297,7 @@ $_SESSION['login'] = false;
|
|||
<?php } ?>
|
||||
<!-- rfc3514 implementation -->
|
||||
<div id="rfc3514" style="display:none;">0x0</div>
|
||||
<div id="mouse_message"></div>
|
||||
<div id="notification" class="notification-out"><img src="<?php echo $web_path; ?>/images/icon_info.png" /><span id="notification-content"></span></div>
|
||||
<div id="maincontainer">
|
||||
<div id="header" class="header-<?php echo AmpConfig::get('ui_fixed') ? 'fixed' : 'float'; ?>"><!-- This is the header -->
|
||||
<h1 id="headerlogo">
|
||||
|
|
|
@ -188,12 +188,42 @@ input[type=button]:focus:active, input[type=submit]:focus:active {
|
|||
background-position: right;
|
||||
}
|
||||
|
||||
#mouse_message {
|
||||
z-index: 9999;
|
||||
#notification {
|
||||
position: fixed;
|
||||
color: #303335;
|
||||
text-shadow: 2px 2px 9px #fff;
|
||||
font-weight: bold;
|
||||
top: auto;
|
||||
bottom: 20px;
|
||||
left: 50%;
|
||||
z-index: 8888;
|
||||
width: 50%;
|
||||
padding: 5px 20px;
|
||||
margin: 0;
|
||||
background-color: #000;
|
||||
border-radius: 10px;
|
||||
-webkit-box-shadow: 0 4px 12px rgba(0,0,0,.5);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,.5);
|
||||
-webkit-transition: all .5s;
|
||||
transition: all .5s;
|
||||
-webkit-transform: translate(-50%,0);
|
||||
-ms-transform: translate(-50%,0);
|
||||
transform: translate(-50%,0);
|
||||
}
|
||||
|
||||
#notification.notification-out {
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
-webkit-transform: translate(-50%,80px);
|
||||
-ms-transform: translate(-50%,80px);
|
||||
transform: translate(-50%,80px);
|
||||
}
|
||||
|
||||
#notification img {
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
#notification-content {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
|
@ -1041,6 +1071,8 @@ div.box.box_rules {
|
|||
.cel_song, .cel_album, .cel_artist {
|
||||
max-width: 350px;
|
||||
white-space: normal !important;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
|
@ -1361,6 +1393,7 @@ span.fatalerror {
|
|||
.dynamic-star-rating {
|
||||
width:95px;
|
||||
}
|
||||
|
||||
.star-rating ul,
|
||||
.star-rating a:hover,
|
||||
.star-rating .current-rating {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue