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

committed by
Florian BLOUET

parent
03b821acb7
commit
3b6c7cd63a
@@ -165,7 +165,7 @@ class eventsmanager_broker
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (((int) $page + 1) * $n < $total) {
|
if (((int) $page + 1) * $n < $total) {
|
||||||
$data['next'] = '<a href="#" onclick="print_notifications(' . ((int) $page + 1) . ');return false;">' . $this->app->trans('charger d\'avantages de notifications') . '</a>';
|
$data['next'] = '<a href="#" class="notification__print-action" data-page="' . ((int) $page + 1) . '">' . $this->app->trans('charger d\'avantages de notifications') . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@@ -25,11 +25,14 @@
|
|||||||
"tmp": "0.0.23",
|
"tmp": "0.0.23",
|
||||||
"wrench": "^1.5.8"
|
"wrench": "^1.5.8"
|
||||||
},
|
},
|
||||||
"engines" : {
|
"engines": {
|
||||||
"node" : ">=0.12"
|
"node": ">=0.12"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "./node_modules/.bin/gulp build;",
|
"build": "./node_modules/.bin/gulp build;",
|
||||||
"postinstall": "./node_modules/.bin/gulp install;"
|
"postinstall": "./node_modules/.bin/gulp install;"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"phraseanet-production-client": "git+https://github.com/lostdalek/Phraseanet-production-client.git#notification"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@ gulp.task('build', ['build-vendors'], function(){
|
|||||||
// standalone vendors used across application
|
// standalone vendors used across application
|
||||||
gulp.task('build-vendors', [
|
gulp.task('build-vendors', [
|
||||||
'build-alchemy-embed',
|
'build-alchemy-embed',
|
||||||
|
'build-phraseanet-production-client',
|
||||||
'build-bootstrap',
|
'build-bootstrap',
|
||||||
'build-colorpicker',
|
'build-colorpicker',
|
||||||
'build-html5shiv',
|
'build-html5shiv',
|
||||||
|
25
resources/gulp/components/vendors/alchemy-phraseanet-production-client.js
vendored
Normal file
25
resources/gulp/components/vendors/alchemy-phraseanet-production-client.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
var gulp = require('gulp');
|
||||||
|
var config = require('../../config.js');
|
||||||
|
var utils = require('../../utils.js');
|
||||||
|
var debugMode = false;
|
||||||
|
|
||||||
|
// for dev purposes
|
||||||
|
gulp.task('copy-phraseanet-production-client-debug', function(){
|
||||||
|
debugMode = true;
|
||||||
|
gulp.start('copy-phraseanet-production-client');
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('copy-phraseanet-production-client', function(){
|
||||||
|
// copy all dist folder:
|
||||||
|
|
||||||
|
return gulp.src('node_modules/phraseanet-production-client/dist/**/*')
|
||||||
|
.pipe(gulp.dest( config.paths.build + 'production'));
|
||||||
|
});
|
||||||
|
gulp.task('watch-phraseanet-production-client-js', function() {
|
||||||
|
debugMode = true;
|
||||||
|
// in dev mode, watch composer's vendor path:
|
||||||
|
return gulp.watch('node_modules/phraseanet-production-client/dist/**/*', ['copy-phraseanet-production-client']);
|
||||||
|
});
|
||||||
|
gulp.task('build-phraseanet-production-client', function(){
|
||||||
|
gulp.start('copy-phraseanet-production-client');
|
||||||
|
});
|
@@ -34,6 +34,7 @@ gulp.task('watch-js', function(){
|
|||||||
gulp.start('watch-setup-js');
|
gulp.start('watch-setup-js');
|
||||||
gulp.start('watch-authentication-js');
|
gulp.start('watch-authentication-js');
|
||||||
gulp.start('watch-alchemy-embed-js');
|
gulp.start('watch-alchemy-embed-js');
|
||||||
|
gulp.start('watch-phraseanet-production-client-js');
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch', function(){
|
gulp.task('watch', function(){
|
||||||
@@ -46,7 +47,8 @@ var browserSync = require('browser-sync').create();
|
|||||||
gulp.task('sync', ['watch'], function(){
|
gulp.task('sync', ['watch'], function(){
|
||||||
// will open browser in http://localhost:3000/
|
// will open browser in http://localhost:3000/
|
||||||
browserSync.init({
|
browserSync.init({
|
||||||
proxy: "phraseanet-php55-nginx"
|
//proxy: "phraseanet-php55-nginx"
|
||||||
|
proxy: "www.phraseanet.vb"
|
||||||
});
|
});
|
||||||
gulp.watch(config.paths.build + '**/*.css').on('change', browserSync.reload);
|
gulp.watch(config.paths.build + '**/*.css').on('change', browserSync.reload);
|
||||||
gulp.watch(config.paths.build + '**/*.js').on('change', browserSync.reload);
|
gulp.watch(config.paths.build + '**/*.js').on('change', browserSync.reload);
|
||||||
|
@@ -37,243 +37,8 @@ $(document).ready(function () {
|
|||||||
hideTransition: 'hide',
|
hideTransition: 'hide',
|
||||||
shadow: false
|
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) {
|
function setPref(name, value) {
|
||||||
if (jQuery.data['pref_' + name] && jQuery.data['pref_' + name].abort) {
|
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'});
|
}).dialog('open').css({'overflow-x': 'auto', 'overflow-y': 'auto'});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @deprecated
|
||||||
function manageSession(data, showMessages) {
|
function manageSession(data, showMessages) {
|
||||||
if (typeof(showMessages) == "undefined")
|
if (typeof(showMessages) == "undefined")
|
||||||
showMessages = false;
|
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) {
|
function showOverlay(n, appendto, callback, zIndex) {
|
||||||
|
|
||||||
|
@@ -1246,7 +1246,7 @@ $(document).ready(function () {
|
|||||||
dateFormat: 'yy/mm/dd'
|
dateFormat: 'yy/mm/dd'
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ajaxSetup({
|
/*$.ajaxSetup({
|
||||||
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
//Request is aborted
|
//Request is aborted
|
||||||
@@ -1263,7 +1263,7 @@ $(document).ready(function () {
|
|||||||
title: 'Server not responding'
|
title: 'Server not responding'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
$('.tools .answer_selector').bind('click',function () {
|
$('.tools .answer_selector').bind('click',function () {
|
||||||
selector($(this));
|
selector($(this));
|
||||||
@@ -1278,7 +1278,7 @@ $(document).ready(function () {
|
|||||||
$(this).removeClass('add_selector');
|
$(this).removeClass('add_selector');
|
||||||
});
|
});
|
||||||
|
|
||||||
getLanguage();
|
// getLanguage();
|
||||||
|
|
||||||
activeIcons();
|
activeIcons();
|
||||||
|
|
||||||
@@ -1286,7 +1286,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
initLook();
|
initLook();
|
||||||
|
|
||||||
setTimeout("pollNotifications();", 10000);
|
// setTimeout("pollNotifications();", 10000);
|
||||||
|
|
||||||
$(this).bind('keydown', function (event) {
|
$(this).bind('keydown', function (event) {
|
||||||
var cancelKey = false;
|
var cancelKey = false;
|
||||||
|
@@ -750,14 +750,23 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{% include "prod/thesaurus.js.twig" with {'search_datas': search_datas} %}
|
{% include "prod/thesaurus.js.twig" with {'search_datas': search_datas} %}
|
||||||
</script>
|
</script>
|
||||||
|
<script type="text/javascript" src="/assets/production/app{% if not app.debug %}.min{% endif %}.js"></script>
|
||||||
<script type="text/javascript" src="/assets/common/js/common{% if not app.debug %}.min{% endif %}.js"></script>
|
<script type="text/javascript" src="/assets/common/js/common{% if not app.debug %}.min{% endif %}.js"></script>
|
||||||
<script type="text/javascript" src="/assets/prod/js/prod{% if not app.debug %}.min{% endif %}.js"></script>
|
<script type="text/javascript" src="/assets/prod/js/prod{% if not app.debug %}.min{% endif %}.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
ProductionApplication.bootstrap({
|
||||||
|
notify: {
|
||||||
|
url: "{{ path('list_notifications') }}",
|
||||||
|
moduleId: 1,
|
||||||
|
userId: {{app.getAuthenticatedUser().getId()}}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
p4.reg_delete="{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), "warning_on_delete_story") %}true{% else %}false{% endif %}";
|
p4.reg_delete="{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), "warning_on_delete_story") %}true{% else %}false{% endif %}";
|
||||||
});
|
});
|
||||||
|
|
||||||
function pollNotifications(){
|
/*function pollNotifications(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "{{ path('list_notifications') }}",
|
url: "{{ path('list_notifications') }}",
|
||||||
@@ -783,7 +792,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};*/
|
||||||
|
|
||||||
function setCss(color) {
|
function setCss(color) {
|
||||||
$("#skinCss").attr("href","/assets/prod/skins/" + color + "/skin-" + color + "{% if not app.debug %}.min{% endif %}.css");
|
$("#skinCss").attr("href","/assets/prod/skins/" + color + "/skin-" + color + "{% if not app.debug %}.min{% endif %}.css");
|
||||||
@@ -794,9 +803,6 @@
|
|||||||
}, function(data){
|
}, function(data){
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
if (( navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/) )) {
|
|
||||||
$("select").hide().show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="notification_title">
|
<div class="notification_title">
|
||||||
<a href="#" onclick="print_notifications(0);return false;">{{ 'toutes les notifications' | trans }}</a>
|
<a href="#" class="notification__print-action" data-page="0">{{ 'toutes les notifications' | trans }}</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user