mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +00:00
PHRAS-974 - PHRAS-974 - fix publication module
This commit is contained in:
@@ -73,6 +73,7 @@ gulp.task('build-prod-js', function(){
|
|||||||
config.paths.vendors + 'jquery-file-upload/js/jquery.iframe-transport.js',
|
config.paths.vendors + 'jquery-file-upload/js/jquery.iframe-transport.js',
|
||||||
config.paths.vendors + 'jquery-file-upload/js/jquery.fileupload.js',
|
config.paths.vendors + 'jquery-file-upload/js/jquery.fileupload.js',
|
||||||
config.paths.vendors + 'geonames-server-jquery-plugin/jquery.geonames.js',
|
config.paths.vendors + 'geonames-server-jquery-plugin/jquery.geonames.js',
|
||||||
|
config.paths.src + 'prod/js/components/publication.js',
|
||||||
config.paths.src + 'prod/js/jquery.form.2.49.js',
|
config.paths.src + 'prod/js/jquery.form.2.49.js',
|
||||||
config.paths.src + 'prod/js/jquery.Selection.js',
|
config.paths.src + 'prod/js/jquery.Selection.js',
|
||||||
config.paths.src + 'prod/js/jquery.Edit.js',
|
config.paths.src + 'prod/js/jquery.Edit.js',
|
||||||
|
|||||||
360
resources/www/prod/js/components/publication.js
Normal file
360
resources/www/prod/js/components/publication.js
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
var publicationModule = (function () {
|
||||||
|
|
||||||
|
var ajaxState = {
|
||||||
|
query: null,
|
||||||
|
isRunning: false
|
||||||
|
};
|
||||||
|
|
||||||
|
var curPage;
|
||||||
|
var $answers = $('#answers');
|
||||||
|
|
||||||
|
// refresh current view
|
||||||
|
$answers.on('click', '.feed_reload', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
fetchPublications(curPage)
|
||||||
|
});
|
||||||
|
|
||||||
|
// navigate to a specific feed
|
||||||
|
$answers.on('click', '.ajax_answers', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var $this = $(this);
|
||||||
|
var append = $this.hasClass('append');
|
||||||
|
var noScroll = $this.hasClass('no_scroll');
|
||||||
|
|
||||||
|
_fetchRemote($(event.currentTarget).attr('href'), {})
|
||||||
|
.then(function (data) {
|
||||||
|
if (!append) {
|
||||||
|
$answers.empty();
|
||||||
|
if (!noScroll) {
|
||||||
|
$answers.scrollTop(0);
|
||||||
|
}
|
||||||
|
$answers.append(data);
|
||||||
|
|
||||||
|
$answers.find("img.lazyload").lazyload({
|
||||||
|
container: $answers
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('.see_more.loading', $answers).remove();
|
||||||
|
$answers.append(data);
|
||||||
|
|
||||||
|
$answers.find("img.lazyload").lazyload({
|
||||||
|
container: $answers
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!noScroll) {
|
||||||
|
$answers.animate({
|
||||||
|
'scrollTop': ($answers.scrollTop() + $answers.innerHeight() - 80)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
afterSearch();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// subscribe_rss
|
||||||
|
$answers.on('click', '.subscribe_rss', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
if (typeof(renew) === 'undefined')
|
||||||
|
renew = 'false';
|
||||||
|
else
|
||||||
|
renew = renew ? 'true' : 'false';
|
||||||
|
|
||||||
|
var buttons = {};
|
||||||
|
buttons[language.renewRss] = function () {
|
||||||
|
$this.trigger({
|
||||||
|
type: 'click',
|
||||||
|
renew: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
buttons[language.fermer] = function () {
|
||||||
|
$('#DIALOG').empty().dialog('destroy');
|
||||||
|
};
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: $this.attr('href') + (event.renew === true ? '?renew=true' : ''),
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
if (data.texte !== false && data.titre !== false) {
|
||||||
|
if ($("#DIALOG").data("ui-dialog")) {
|
||||||
|
$("#DIALOG").dialog('destroy');
|
||||||
|
}
|
||||||
|
$("#DIALOG").attr('title', data.titre)
|
||||||
|
.empty()
|
||||||
|
.append(data.texte)
|
||||||
|
.dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
closeOnEscape: true,
|
||||||
|
resizable: false,
|
||||||
|
draggable: false,
|
||||||
|
modal: true,
|
||||||
|
buttons: buttons,
|
||||||
|
width: 650,
|
||||||
|
height: 250,
|
||||||
|
overlay: {
|
||||||
|
backgroundColor: '#000',
|
||||||
|
opacity: 0.7
|
||||||
|
}
|
||||||
|
}).dialog('open');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// edit a feed
|
||||||
|
$answers.on('click', '.feed .entry a.feed_edit', function () {
|
||||||
|
var $this = $(this);
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: $this.attr('href'),
|
||||||
|
dataType: 'html',
|
||||||
|
success: function (data) {
|
||||||
|
return _createPublicationModal(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// remove a feed
|
||||||
|
$answers.on('click', '.feed .entry a.feed_delete', function () {
|
||||||
|
if (!confirm('etes vous sur de vouloir supprimer cette entree ?'))
|
||||||
|
return false;
|
||||||
|
var $this = $(this);
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: $this.attr('href'),
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
if (data.error === false) {
|
||||||
|
var $entry = $this.closest('.entry');
|
||||||
|
$entry.animate({
|
||||||
|
height: 0,
|
||||||
|
opacity: 0
|
||||||
|
}, function () {
|
||||||
|
$entry.remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
alert(data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$answers.on('mouseover', '.feed .entry', function () {
|
||||||
|
$(this).addClass('hover');
|
||||||
|
});
|
||||||
|
|
||||||
|
$answers.on('mouseout', '.feed .entry', function () {
|
||||||
|
$(this).removeClass('hover');
|
||||||
|
});
|
||||||
|
|
||||||
|
$answers.on('click', '.see_more a', function (event) {
|
||||||
|
$see_more = $(this).closest('.see_more');
|
||||||
|
$see_more.addClass('loading');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var _fetchRemote = function (url, data) {
|
||||||
|
var page = 0;
|
||||||
|
if (data.page === undefined) {
|
||||||
|
page = data.page;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ajaxState.query = $.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: 'html',
|
||||||
|
data: data,
|
||||||
|
beforeSend: function () {
|
||||||
|
if (ajaxState.isRunning && ajaxState.query.abort)
|
||||||
|
answAjax.abort();
|
||||||
|
if (page === 0)
|
||||||
|
clearAnswers();
|
||||||
|
ajaxState.isRunning = true;
|
||||||
|
$answers.addClass('loading');
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
ajaxState.isRunning = false;
|
||||||
|
$answers.removeClass('loading');
|
||||||
|
},
|
||||||
|
timeout: function () {
|
||||||
|
ajaxState.isRunning = false;
|
||||||
|
$answers.removeClass('loading');
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
ajaxState.isRunning = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var _createPublicationModal = function (data) {
|
||||||
|
|
||||||
|
var buttons = {};
|
||||||
|
buttons[language.valider] = function () {
|
||||||
|
var dialog = p4.Dialog.get(1);
|
||||||
|
var error = false;
|
||||||
|
var $form = $('form.main_form', dialog.getDomElement());
|
||||||
|
|
||||||
|
$('.required_text', $form).each(function (i, el) {
|
||||||
|
if ($.trim($(el).val()) === '') {
|
||||||
|
$(el).addClass('error');
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
alert(language.feed_require_fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('input[name="feed_id"]', $form).val() === '') {
|
||||||
|
alert(language.feed_require_feed);
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: $form.attr('action'),
|
||||||
|
data: $form.serializeArray(),
|
||||||
|
dataType: 'json',
|
||||||
|
beforeSend: function () {
|
||||||
|
$('button', dialog.getDomElement()).prop('disabled', true);
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
$('button', dialog.getDomElement()).prop('disabled', false);
|
||||||
|
},
|
||||||
|
timeout: function () {
|
||||||
|
$('button', dialog.getDomElement()).prop('disabled', false);
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$('button', dialog.getDomElement()).prop('disabled', false);
|
||||||
|
if (data.error === true) {
|
||||||
|
alert(data.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('form.main_form', dialog.getDomElement()).hasClass('entry_update')) {
|
||||||
|
var id = $('form input[name="entry_id"]', dialog.getDomElement()).val();
|
||||||
|
var container = $('#entry_' + id);
|
||||||
|
|
||||||
|
container.replaceWith(data.datas);
|
||||||
|
|
||||||
|
container.hide().fadeIn();
|
||||||
|
|
||||||
|
$answers.find("img.lazyload").lazyload({
|
||||||
|
container: $answers
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
p4.Dialog.Close(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
p4.Dialog.Close(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialog = p4.Dialog.Create({
|
||||||
|
size: 'Full',
|
||||||
|
closeOnEscape: true,
|
||||||
|
closeButton: true,
|
||||||
|
buttons: buttons
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.setContent(data);
|
||||||
|
|
||||||
|
var $feeds_item = $('.feeds .feed', dialog.getDomElement());
|
||||||
|
var $form = $('form.main_form', dialog.getDomElement());
|
||||||
|
|
||||||
|
$feeds_item.bind('click', function () {
|
||||||
|
$feeds_item.removeClass('selected');
|
||||||
|
$(this).addClass('selected');
|
||||||
|
$('input[name="feed_id"]', $form).val($('input', this).val());
|
||||||
|
}).hover(function () {
|
||||||
|
$(this).addClass('hover');
|
||||||
|
}, function () {
|
||||||
|
$(this).removeClass('hover');
|
||||||
|
});
|
||||||
|
|
||||||
|
$form.bind('submit', function () {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
var fetchPublications = function (page) {
|
||||||
|
curPage = page;
|
||||||
|
return _fetchRemote('../prod/feeds/', {
|
||||||
|
page: page
|
||||||
|
})
|
||||||
|
.then(function (data) {
|
||||||
|
$('.next_publi_link', $answers).remove();
|
||||||
|
|
||||||
|
$answers.append(data);
|
||||||
|
|
||||||
|
$answers.find("img.lazyload").lazyload({
|
||||||
|
container: $answers
|
||||||
|
});
|
||||||
|
|
||||||
|
afterSearch();
|
||||||
|
if (page > 0) {
|
||||||
|
$answers.stop().animate({
|
||||||
|
scrollTop: $answers.scrollTop() + $answers.height()
|
||||||
|
}, 700);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var publishRecords = function (type, value) {
|
||||||
|
var options = {
|
||||||
|
lst: '',
|
||||||
|
ssel: '',
|
||||||
|
act: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case "IMGT":
|
||||||
|
case "CHIM":
|
||||||
|
options.lst = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "STORY":
|
||||||
|
options.story = value;
|
||||||
|
break;
|
||||||
|
case "SSTT":
|
||||||
|
options.ssel = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.post("../prod/feeds/requestavailable/"
|
||||||
|
, options
|
||||||
|
, function (data) {
|
||||||
|
|
||||||
|
return _createPublicationModal(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
fetchPublications: function (page) {
|
||||||
|
return fetchPublications(page);
|
||||||
|
},
|
||||||
|
publishRecords: function (type, value) {
|
||||||
|
return publishRecords(type, value)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -32,51 +32,7 @@ function getHome(cas, page) {
|
|||||||
newSearch($("#EDIT_query").val());
|
newSearch($("#EDIT_query").val());
|
||||||
break;
|
break;
|
||||||
case 'PUBLI':
|
case 'PUBLI':
|
||||||
answAjax = $.ajax({
|
publicationModule.fetchPublications(page, answAjax, answAjaxrunning);
|
||||||
type: "GET",
|
|
||||||
url: "../prod/feeds/",
|
|
||||||
dataType: 'html',
|
|
||||||
data: {
|
|
||||||
page: page
|
|
||||||
},
|
|
||||||
beforeSend: function () {
|
|
||||||
if (answAjaxrunning && answAjax.abort)
|
|
||||||
answAjax.abort();
|
|
||||||
if (page === 0)
|
|
||||||
clearAnswers();
|
|
||||||
answAjaxrunning = true;
|
|
||||||
$('#answers').addClass('loading');
|
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
answAjaxrunning = false;
|
|
||||||
$('#answers').removeClass('loading');
|
|
||||||
},
|
|
||||||
timeout: function () {
|
|
||||||
answAjaxrunning = false;
|
|
||||||
$('#answers').removeClass('loading');
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
answAjaxrunning = false;
|
|
||||||
var answers = $('#answers');
|
|
||||||
|
|
||||||
$('.next_publi_link', answers).remove();
|
|
||||||
|
|
||||||
answers.append(data);
|
|
||||||
|
|
||||||
answers.find("img.lazyload").lazyload({
|
|
||||||
container: answers
|
|
||||||
});
|
|
||||||
|
|
||||||
afterSearch();
|
|
||||||
if (page > 0) {
|
|
||||||
answers.stop().animate({
|
|
||||||
scrollTop: answers.scrollTop() + answers.height()
|
|
||||||
}, 700);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 'HELP':
|
case 'HELP':
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -1146,122 +1102,6 @@ $(document).ready(function () {
|
|||||||
$(this).highlight('#CCCCCC');
|
$(this).highlight('#CCCCCC');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#answers .see_more a').on('click', function (event) {
|
|
||||||
$see_more = $(this).closest('.see_more');
|
|
||||||
$see_more.addClass('loading');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#answers .feed .entry').on('mouseover', function () {
|
|
||||||
$(this).addClass('hover');
|
|
||||||
});
|
|
||||||
$('#answers .feed .entry').on('mouseout', function () {
|
|
||||||
$(this).removeClass('hover');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('a.ajax_answers').on('click', function (event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
var $this = $(this);
|
|
||||||
|
|
||||||
var append = $this.hasClass('append');
|
|
||||||
var no_scroll = $this.hasClass('no_scroll');
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: $this.attr('href'),
|
|
||||||
dataType: 'html',
|
|
||||||
success: function (data) {
|
|
||||||
var $answers = $('#answers');
|
|
||||||
|
|
||||||
if (!append) {
|
|
||||||
$answers.empty();
|
|
||||||
if (!no_scroll) {
|
|
||||||
$answers.scrollTop(0);
|
|
||||||
}
|
|
||||||
$answers.append(data);
|
|
||||||
|
|
||||||
$answers.find("img.lazyload").lazyload({
|
|
||||||
container: $answers
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('.see_more.loading', $answers).remove();
|
|
||||||
$answers.append(data);
|
|
||||||
|
|
||||||
$answers.find("img.lazyload").lazyload({
|
|
||||||
container: $answers
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!no_scroll) {
|
|
||||||
$answers.animate({
|
|
||||||
'scrollTop': ($answers.scrollTop() + $answers.innerHeight() - 80)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
afterSearch();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('a.subscribe_rss').on('click', function (event) {
|
|
||||||
|
|
||||||
var $this = $(this);
|
|
||||||
|
|
||||||
if (typeof(renew) === 'undefined')
|
|
||||||
renew = 'false';
|
|
||||||
else
|
|
||||||
renew = renew ? 'true' : 'false';
|
|
||||||
|
|
||||||
var buttons = {};
|
|
||||||
buttons[language.renewRss] = function () {
|
|
||||||
$this.trigger({
|
|
||||||
type: 'click',
|
|
||||||
renew: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
buttons[language.fermer] = function () {
|
|
||||||
$('#DIALOG').empty().dialog('destroy');
|
|
||||||
};
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
var $this = $(this);
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: $this.attr('href') + (event.renew === true ? '?renew=true' : ''),
|
|
||||||
dataType: 'json',
|
|
||||||
success: function (data) {
|
|
||||||
if (data.texte !== false && data.titre !== false) {
|
|
||||||
if ($("#DIALOG").data("ui-dialog")) {
|
|
||||||
$("#DIALOG").dialog('destroy');
|
|
||||||
}
|
|
||||||
$("#DIALOG").attr('title', data.titre)
|
|
||||||
.empty()
|
|
||||||
.append(data.texte)
|
|
||||||
.dialog({
|
|
||||||
autoOpen: false,
|
|
||||||
closeOnEscape: true,
|
|
||||||
resizable: false,
|
|
||||||
draggable: false,
|
|
||||||
modal: true,
|
|
||||||
buttons: buttons,
|
|
||||||
width: 650,
|
|
||||||
height: 250,
|
|
||||||
overlay: {
|
|
||||||
backgroundColor: '#000',
|
|
||||||
opacity: 0.7
|
|
||||||
}
|
|
||||||
}).dialog('open');
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#search_submit').on('mousedown', function (event) {
|
$('#search_submit').on('mousedown', function (event) {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@@ -1684,44 +1524,6 @@ $(document).ready(function () {
|
|||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#answers .feed .entry a.options').on('click', function () {
|
|
||||||
var $this = $(this);
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: $this.attr('href'),
|
|
||||||
dataType: 'html',
|
|
||||||
success: function (data) {
|
|
||||||
return set_up_feed_box(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$('#answers .feed .entry a.feed_delete').on('click', function () {
|
|
||||||
if (!confirm('etes vous sur de vouloir supprimer cette entree ?'))
|
|
||||||
return false;
|
|
||||||
var $this = $(this);
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: $this.attr('href'),
|
|
||||||
dataType: 'json',
|
|
||||||
success: function (data) {
|
|
||||||
if (data.error === false) {
|
|
||||||
var $entry = $this.closest('.entry');
|
|
||||||
$entry.animate({
|
|
||||||
height: 0,
|
|
||||||
opacity: 0
|
|
||||||
}, function () {
|
|
||||||
$entry.remove();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
alert(data.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('#loader_bar').stop().animate({
|
$('#loader_bar').stop().animate({
|
||||||
width: '100%'
|
width: '100%'
|
||||||
}, 450, function () {
|
}, 450, function () {
|
||||||
@@ -1730,7 +1532,6 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -2158,44 +1959,13 @@ function activeIcons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (value !== '') {
|
if (value !== '') {
|
||||||
feedThis(type, value);
|
publicationModule.publishRecords(type, value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert(language.nodocselected);
|
alert(language.nodocselected);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function feedThis(type, value) {
|
|
||||||
var options = {
|
|
||||||
lst: '',
|
|
||||||
ssel: '',
|
|
||||||
act: ''
|
|
||||||
};
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case "IMGT":
|
|
||||||
case "CHIM":
|
|
||||||
options.lst = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "STORY":
|
|
||||||
options.story = value;
|
|
||||||
break;
|
|
||||||
case "SSTT":
|
|
||||||
options.ssel = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.post("../prod/feeds/requestavailable/"
|
|
||||||
, options
|
|
||||||
, function (data) {
|
|
||||||
|
|
||||||
return set_up_feed_box(data);
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$container.on('click', '.TOOL_chgcoll_btn', function () {
|
$container.on('click', '.TOOL_chgcoll_btn', function () {
|
||||||
var value = {};
|
var value = {};
|
||||||
@@ -3027,104 +2797,7 @@ function autoorder() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_up_feed_box(data) {
|
|
||||||
|
|
||||||
var buttons = {};
|
|
||||||
buttons[language.valider] = function () {
|
|
||||||
var dialog = p4.Dialog.get(1);
|
|
||||||
var error = false;
|
|
||||||
var $form = $('form.main_form', dialog.getDomElement());
|
|
||||||
|
|
||||||
$('.required_text', $form).each(function (i, el) {
|
|
||||||
if ($.trim($(el).val()) === '') {
|
|
||||||
$(el).addClass('error');
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
alert(language.feed_require_fields);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($('input[name="feed_id"]', $form).val() === '') {
|
|
||||||
alert(language.feed_require_feed);
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: $form.attr('action'),
|
|
||||||
data: $form.serializeArray(),
|
|
||||||
dataType: 'json',
|
|
||||||
beforeSend: function () {
|
|
||||||
$('button', dialog.getDomElement()).prop('disabled', true);
|
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
$('button', dialog.getDomElement()).prop('disabled', false);
|
|
||||||
},
|
|
||||||
timeout: function () {
|
|
||||||
$('button', dialog.getDomElement()).prop('disabled', false);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
$('button', dialog.getDomElement()).prop('disabled', false);
|
|
||||||
if (data.error === true) {
|
|
||||||
alert(data.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($('form.main_form', dialog.getDomElement()).hasClass('entry_update')) {
|
|
||||||
var id = $('form input[name="entry_id"]', dialog.getDomElement()).val();
|
|
||||||
var container = $('#entry_' + id);
|
|
||||||
|
|
||||||
container.replaceWith(data.datas);
|
|
||||||
|
|
||||||
container.hide().fadeIn();
|
|
||||||
|
|
||||||
var answers = $('#answers');
|
|
||||||
|
|
||||||
answers.find("img.lazyload").lazyload({
|
|
||||||
container: answers
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
p4.Dialog.Close(1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
p4.Dialog.Close(1);
|
|
||||||
};
|
|
||||||
|
|
||||||
var dialog = p4.Dialog.Create({
|
|
||||||
size: 'Full',
|
|
||||||
closeOnEscape: true,
|
|
||||||
closeButton: true,
|
|
||||||
buttons: buttons
|
|
||||||
});
|
|
||||||
|
|
||||||
dialog.setContent(data);
|
|
||||||
|
|
||||||
var $feeds_item = $('.feeds .feed', dialog.getDomElement());
|
|
||||||
var $form = $('form.main_form', dialog.getDomElement());
|
|
||||||
|
|
||||||
$feeds_item.bind('click',function () {
|
|
||||||
$feeds_item.removeClass('selected');
|
|
||||||
$(this).addClass('selected');
|
|
||||||
$('input[name="feed_id"]', $form).val($('input', this).val());
|
|
||||||
}).hover(function () {
|
|
||||||
$(this).addClass('hover');
|
|
||||||
}, function () {
|
|
||||||
$(this).removeClass('hover');
|
|
||||||
});
|
|
||||||
|
|
||||||
$form.bind('submit', function () {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//clear search
|
//clear search
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="width:600px;">
|
<td style="width:600px;">
|
||||||
<h1>
|
<h1>
|
||||||
<img src="{% if feed.iconUrl == false %}/assets/common/images/icons/rss32.gif{% else %}{% endif %}" style="height:32px;"/>
|
<img src="{% if feed.iconUrl == false %}/assets/common/images/icons/rss32.gif{% else %}/custom/feed_{{ feed.iconUrl }}.jpg{% endif %}" style="height:32px;"/>
|
||||||
{% if feed.isAggregated %}
|
{% if feed.isAggregated %}
|
||||||
{{ 'Toutes les publications' | trans }}
|
{{ 'Toutes les publications' | trans }}
|
||||||
<a class="subscribe_rss" href="{{ path('prod_feeds_subscribe_aggregated') }}">
|
<a class="subscribe_rss" href="{{ path('prod_feeds_subscribe_aggregated') }}">
|
||||||
|
|||||||
@@ -18,10 +18,10 @@
|
|||||||
<td style="width:60px;text-align:right;">
|
<td style="width:60px;text-align:right;">
|
||||||
{% if entry.feed.isOwner(app.getAuthenticator().user) or entry.isPublisher(app.getAuthenticator().user) %}
|
{% if entry.feed.isOwner(app.getAuthenticator().user) or entry.isPublisher(app.getAuthenticator().user) %}
|
||||||
<a class="tools options feed_edit" href="{{ path('prod_feeds_entry_edit', { 'id' : entry.id }) }}">
|
<a class="tools options feed_edit" href="{{ path('prod_feeds_entry_edit', { 'id' : entry.id }) }}">
|
||||||
<img src="/assets/common/images/icons/file-edit.png" title="{{ 'boutton::editer' | trans }}"/>
|
<img src="/assets/common/images/icons/file-edit.png" title="{{ 'boutton::editer' | trans }}" width="16" height="16"/>
|
||||||
</a>
|
</a>
|
||||||
<a class="tools feed_delete"href="{{ path('prod_feeds_entry_delete', { 'id' : entry.id }) }}">
|
<a class="tools feed_delete"href="{{ path('prod_feeds_entry_delete', { 'id' : entry.id }) }}">
|
||||||
<img src="/assets/common/images/icons/delete.png" title="{{ 'boutton::supprimer' | trans }}"/>
|
<img src="/assets/common/images/icons/delete.png" title="{{ 'boutton::supprimer' | trans }}" width="16" height="16"/>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user