mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
wip: add external production client
This commit is contained in:

committed by
Florian BLOUET

parent
03b821acb7
commit
3b6c7cd63a
@@ -37,243 +37,8 @@ $(document).ready(function () {
|
||||
hideTransition: 'hide',
|
||||
shadow: false
|
||||
});
|
||||
|
||||
$('#notification_trigger').bind('mousedown', function (event) {
|
||||
event.stopPropagation();
|
||||
var box = $('#notification_box');
|
||||
if ($(this).hasClass('open')) {
|
||||
box.hide();
|
||||
$(this).removeClass('open');
|
||||
clear_notifications();
|
||||
}
|
||||
else {
|
||||
box.show();
|
||||
|
||||
fix_notification_height();
|
||||
|
||||
$(this).addClass('open');
|
||||
read_notifications();
|
||||
}
|
||||
});
|
||||
|
||||
$(this).bind('mousedown', function () {
|
||||
var not_trigger = $('#notification_trigger');
|
||||
if (not_trigger.hasClass('open'))
|
||||
not_trigger.trigger('click');
|
||||
});
|
||||
$('#notification_box').bind('mousedown', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
$('#notification_box div.notification').on('mouseover', function () {
|
||||
$(this).addClass('hover');
|
||||
});
|
||||
$('#notification_box div.notification').on('mouseout', function () {
|
||||
$(this).removeClass('hover');
|
||||
});
|
||||
|
||||
|
||||
$(this).bind('mousedown', function () {
|
||||
var box = $('#notification_box');
|
||||
if ($('#notification_trigger').hasClass('open')) {
|
||||
box.hide();
|
||||
$('#notification_trigger').removeClass('open');
|
||||
clear_notifications();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ajaxError(function( event, jqxhr, settings, exception ) {
|
||||
if(jqxhr.status == 403 && jqxhr.getResponseHeader("X-Phraseanet-End-Session") == "1") {
|
||||
disconnected();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
set_notif_position();
|
||||
|
||||
});
|
||||
|
||||
function EcrireCookie(nom, valeur) {
|
||||
var argv = EcrireCookie.arguments;
|
||||
var argc = EcrireCookie.arguments.length;
|
||||
var expires = (argc > 2) ? argv[2] : null;
|
||||
var path = (argc > 3) ? argv[3] : null;
|
||||
var domain = (argc > 4) ? argv[4] : null;
|
||||
var secure = (argc > 5) ? argv[5] : false;
|
||||
var cook = nom + "=" + escape(valeur) +
|
||||
((expires === null) ? "" : ("; expires=" + expires.toGMTString())) +
|
||||
((path === null) ? "" : ("; path=" + path)) +
|
||||
((domain === null) ? "" : ("; domain=" + domain)) +
|
||||
((secure === true) ? "; secure" : "");
|
||||
document.cookie = cook;
|
||||
}
|
||||
|
||||
function fix_notification_height() {
|
||||
var box = $('#notification_box');
|
||||
var not = $('.notification', box);
|
||||
var n = not.length;
|
||||
var not_t = $('.notification_title', box);
|
||||
var n_t = not_t.length;
|
||||
|
||||
h = not.outerHeight() * n + not_t.outerHeight() * n_t;
|
||||
h = h > 350 ? 350 : h;
|
||||
|
||||
box.stop().animate({height: h});
|
||||
}
|
||||
|
||||
function set_notif_position() {
|
||||
var trigger = $('#notification_trigger');
|
||||
if (trigger.length === 0)
|
||||
return;
|
||||
$('#notification_box').css({
|
||||
'left': Math.round(trigger.offset().left - 1)
|
||||
});
|
||||
}
|
||||
$(window).bind('resize', function () {
|
||||
set_notif_position();
|
||||
});
|
||||
|
||||
|
||||
function print_notifications(page) {
|
||||
|
||||
page = parseInt(page);
|
||||
var buttons = {};
|
||||
|
||||
buttons[language.fermer] = function () {
|
||||
$('#notifications-dialog').dialog('close');
|
||||
};
|
||||
|
||||
if ($('#notifications-dialog').length === 0)
|
||||
$('body').append('<div id="notifications-dialog" class="loading"></div>');
|
||||
|
||||
$('#notifications-dialog')
|
||||
.dialog({
|
||||
title: language.notifications,
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
modal: true,
|
||||
width: 500,
|
||||
height: 400,
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.7
|
||||
},
|
||||
close: function (event, ui) {
|
||||
$('#notifications-dialog').dialog('destroy').remove();
|
||||
}
|
||||
}).dialog('option', 'buttons', buttons)
|
||||
.dialog('open');
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/user/notifications/",
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: page
|
||||
},
|
||||
error: function (data) {
|
||||
$('#notifications-dialog').removeClass('loading');
|
||||
},
|
||||
timeout: function (data) {
|
||||
$('#notifications-dialog').removeClass('loading');
|
||||
},
|
||||
success: function (data) {
|
||||
$('#notifications-dialog').removeClass('loading');
|
||||
var cont = $('#notifications-dialog');
|
||||
|
||||
if (page === 0)
|
||||
cont.empty();
|
||||
else
|
||||
$('.notification_next', cont).remove();
|
||||
|
||||
for (i in data.notifications) {
|
||||
var id = 'notif_date_' + i;
|
||||
var date_cont = $('#' + id);
|
||||
if (date_cont.length === 0) {
|
||||
cont.append('<div id="' + id + '"><div class="notification_title">' + data.notifications[i].display + '</div></div>');
|
||||
date_cont = $('#' + id);
|
||||
}
|
||||
|
||||
for (j in data.notifications[i].notifications) {
|
||||
var loc_dat = data.notifications[i].notifications[j];
|
||||
var html = '<div style="position:relative;" id="notification_' + loc_dat.id + '" class="notification">' +
|
||||
'<table style="width:100%;" cellspacing="0" cellpadding="0" border="0"><tr><td style="width:25px;">' +
|
||||
loc_dat.icon +
|
||||
'</td><td>' +
|
||||
'<div style="position:relative;" class="' + loc_dat.classname + '">' +
|
||||
loc_dat.text + ' <span class="time">' + loc_dat.time + '</span></div>' +
|
||||
'</td></tr></table>' +
|
||||
'</div>';
|
||||
date_cont.append(html);
|
||||
}
|
||||
}
|
||||
|
||||
var next_ln = $.trim(data.next);
|
||||
|
||||
if (next_ln !== '') {
|
||||
cont.append('<div class="notification_next">' + next_ln + '</div>');
|
||||
}
|
||||
|
||||
// '<div style="position:relative;" id="notification_'.$row['id'].'" class="notification '.($row['unread'] == '1' ? 'unread':'').'">'.
|
||||
// '<table style="width:100%;" cellspacing="0" cellpadding="0" border="0"><tr><td style="width:25px;">'.
|
||||
// '<img src="'.$this->pool_classes[$row['type']]->icon_url().'" style="vertical-align:middle;width:16px;margin:2px;" />'.
|
||||
// '</td><td>'.
|
||||
// '<div style="position:relative;" class="'.$data['class'].'">'.
|
||||
// $data['text'].' <span class="time"></span></div>'.
|
||||
// '</td></tr></table>'.
|
||||
// '</div>'
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function read_notifications() {
|
||||
var notifications = [];
|
||||
|
||||
$('#notification_box .unread').each(function () {
|
||||
notifications.push($(this).attr('id').split('_').pop());
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/user/notifications/read/",
|
||||
data: {
|
||||
notifications: notifications.join('_')
|
||||
},
|
||||
success: function (data) {
|
||||
$('#notification_trigger .counter').css('visibility', 'hidden').empty();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function clear_notifications() {
|
||||
var unread = $('#notification_box .unread');
|
||||
|
||||
if (unread.length === 0)
|
||||
return;
|
||||
|
||||
unread.removeClass('unread');
|
||||
$('#notification_trigger .counter').css('visibility', 'hidden').empty();
|
||||
}
|
||||
|
||||
|
||||
function getMyRss(renew) {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/prod/prodFeedBack.php",
|
||||
dataType: 'json',
|
||||
data: datas,
|
||||
success: function (data) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function setPref(name, value) {
|
||||
if (jQuery.data['pref_' + name] && jQuery.data['pref_' + name].abort) {
|
||||
@@ -329,6 +94,7 @@ function infoDialog(el) {
|
||||
}).dialog('open').css({'overflow-x': 'auto', 'overflow-y': 'auto'});
|
||||
}
|
||||
|
||||
// @deprecated
|
||||
function manageSession(data, showMessages) {
|
||||
if (typeof(showMessages) == "undefined")
|
||||
showMessages = false;
|
||||
@@ -416,51 +182,6 @@ function manageSession(data, showMessages) {
|
||||
}
|
||||
|
||||
|
||||
function disconnected() {
|
||||
showModal('disconnected', {title: language.serverDisconnected});
|
||||
}
|
||||
|
||||
function showModal(cas, options) {
|
||||
|
||||
var content = '';
|
||||
var callback = null;
|
||||
var button = {
|
||||
"OK": function (e) {
|
||||
hideOverlay(3);
|
||||
$(this).dialog("close");
|
||||
return;
|
||||
}};
|
||||
var escape = true;
|
||||
var onClose = function () {
|
||||
};
|
||||
|
||||
switch (cas) {
|
||||
case 'timeout':
|
||||
content = language.serverTimeout;
|
||||
break;
|
||||
case 'error':
|
||||
content = language.serverError;
|
||||
break;
|
||||
case 'disconnected':
|
||||
content = language.serverDisconnected;
|
||||
escape = false;
|
||||
callback = function (e) {
|
||||
self.location.replace(self.location.href);
|
||||
};
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(typeof(p4.Alerts) == "undefined") {
|
||||
alert(language.serverDisconnected);
|
||||
self.location.replace(self.location.href);
|
||||
}
|
||||
else {
|
||||
p4.Alerts(options.title, content, callback);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function showOverlay(n, appendto, callback, zIndex) {
|
||||
|
||||
|
Reference in New Issue
Block a user