wip: js modularization of record editor and cleanup

This commit is contained in:
Florian BLOUET
2016-02-24 16:28:12 +01:00
parent 239c3c3930
commit 0ca57b900f
21 changed files with 2220 additions and 2465 deletions

View File

@@ -77,24 +77,26 @@ gulp.task('build-prod-js', function(){
config.paths.src + 'prod/js/core/selectable.js',
config.paths.src + 'prod/js/core/alert.js',
config.paths.src + 'prod/js/components/search.js',
config.paths.src + 'prod/js/components/search/search.js',
config.paths.src + 'prod/js/components/search/search-result.js',
config.paths.src + 'prod/js/components/publication.js',
config.paths.src + 'prod/js/components/workzone.js',
config.paths.src + 'prod/js/components/workzone-basket.js',
config.paths.src + 'prod/js/components/workzone-facets.js',
config.paths.src + 'prod/js/components/workzone/workzone.js',
config.paths.src + 'prod/js/components/workzone/workzone-basket.js',
config.paths.src + 'prod/js/components/workzone/workzone-facets.js',
config.paths.src + 'prod/js/components/utils.js',
config.paths.src + 'prod/js/components/cgu.js',
config.paths.src + 'prod/js/components/preferences.js',
// config.paths.src + 'prod/js/jquery.form.2.49.js',
config.paths.src + 'prod/js/jquery.Edit.js',
config.paths.src + 'prod/js/jquery.Prod.js',
config.paths.src + 'prod/js/components/record/editable-record.js',
// config.paths.src + 'prod/js/jquery.Prod.js',
config.paths.src + 'prod/js/jquery.Feedback.js',
config.paths.src + 'prod/js/components/search-result.js',
config.paths.src + 'prod/js/jquery.main-prod.js',
config.paths.src + 'prod/js/jquery.Upload.js',
config.paths.src + 'prod/js/ThumbExtractor.js',
config.paths.src + 'prod/js/components/upload/upload.js',
config.paths.src + 'prod/js/components/video-editor.js',
config.paths.src + 'prod/js/publicator.js',
config.paths.src + 'vendors/jquery-sprintf/js/jquery.sprintf.1.0.3.js',
config.paths.src + 'prod/js/jquery.p4.preview.js',
config.paths.src + 'prod/js/record.editor.js',
config.paths.src + 'prod/js/components/editor/record-editor.js',
config.paths.src + 'prod/js/jquery.color.animation.js',
config.paths.src + 'vendors/jquery-image-enhancer/js/jquery.image_enhancer.js',
config.paths.vendors + 'jquery-treeview/jquery.treeview.js',

View File

@@ -0,0 +1,56 @@
var p4 = p4 || {};
var cguModule = (function (p4) {
function acceptCgus(name, value) {
userModule.setPref(name, value);
}
function cancelCgus(id) {
$.ajax({
type: "POST",
url: "../prod/TOU/deny/" + id + "/",
dataType: 'json',
success: function (data) {
if (data.success) {
alert(language.cgusRelog);
self.location.replace(self.location.href);
}
else {
humane.error(data.message);
}
}
});
}
function activateCgus() {
var $this = $('.cgu-dialog:first');
$this.dialog({
autoOpen: true,
closeOnEscape: false,
draggable: false,
modal: true,
resizable: false,
width: 800,
height: 500,
open: function () {
$this.parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").remove();
$('.cgus-accept', $(this)).bind('click', function () {
acceptCgus($('.cgus-accept', $this).attr('id'), $('.cgus-accept', $this).attr('date'));
$this.dialog('close').remove();
activateCgus();
});
$('.cgus-cancel', $(this)).bind('click', function () {
if (confirm(language.warningDenyCgus)) {
cancelCgus($('.cgus-cancel', $this).attr('id').split('_').pop());
}
});
}
});
}
return {
activateCgus: activateCgus
};
}(p4));

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
var p4 = p4 || {};
var preferencesModule = (function (p4) {
function initLook() {
$('#nperpage_slider').slider({
value: parseInt($('#nperpage_value').val()),
min: 10,
max: 100,
step: 10,
slide: function (event, ui) {
$('#nperpage_value').val(ui.value);
},
stop: function (event, ui) {
userModule.setPref('images_per_page', $('#nperpage_value').val());
}
});
$('#sizeAns_slider').slider({
value: parseInt($('#sizeAns_value').val()),
min: 90,
max: 270,
step: 10,
slide: function (event, ui) {
$('#sizeAns_value').val(ui.value);
},
stop: function (event, ui) {
userModule.setPref('images_size', $('#sizeAns_value').val());
}
});
}
// look_box
function setInitialStateOptions() {
var el = $('#look_box_settings select[name=start_page]');
switch (el.val()) {
case "LAST_QUERY":
case "PUBLI":
case "HELP":
$('#look_box_settings input[name=start_page_value]').hide();
break;
case "QUERY":
$('#look_box_settings input[name=start_page_value]').show();
break;
}
}
function setInitialState() {
var el = $('#look_box_settings select[name=start_page]');
var val = el.val();
var start_page_query = $('#look_box_settings input[name=start_page_value]').val();
if (val === 'QUERY') {
userModule.setPref('start_page_query', start_page_query);
}
userModule.setPref('start_page', val);
}
function lookBox(el, event) {
$("#look_box").dialog({
closeOnEscape: true,
resizable: false,
width: 450,
height: 500,
modal: true,
draggable: false,
overlay: {
backgroundColor: '#000',
opacity: 0.7
}
}).dialog('open');
}
return {
initLook: initLook,
lookBox: lookBox,
setInitialStateOptions: setInitialStateOptions,
setInitialState: setInitialState
};
}(p4));

View File

@@ -12,6 +12,41 @@ var searchModule = (function (p4) {
$(todeploy_selector).show();
}
}
/**
* adv search : check/uncheck all the collections (called by the buttons "all"/"none")
*
* @param bool
*/
function toggleDatabase(bool) {
$('form.phrasea_query .sbas_list').each(function () {
var sbas_id = $(this).find('input[name=reference]:first').val();
if (bool)
$(this).find(':checkbox').prop('checked', true);
else
$(this).find(':checkbox').prop('checked', false);
});
checkFilters(true);
}
function resetSearch() {
var container = $("#ADVSRCH_OPTIONS_ZONE");
var fieldsSort = $('#ADVSRCH_SORT_ZONE select[name=sort]', container);
var fieldsSortOrd = $('#ADVSRCH_SORT_ZONE select[name=ord]', container);
var dateFilterSelect = $('#ADVSRCH_DATE_ZONE select', container);
$("option.default-selection", fieldsSort).prop("selected", true);
$("option.default-selection", fieldsSortOrd).prop("selected", true);
$('#ADVSRCH_FIELDS_ZONE option').prop("selected", false);
$('#ADVSRCH_OPTIONS_ZONE input:checkbox.field_switch').prop("checked", false);
$("option:eq(0)", dateFilterSelect).prop("selected", true);
$('#ADVSRCH_OPTIONS_ZONE .datepicker').val('');
$('form.adv_search_bind input:text').val('');
toggleDatabase(true);
}
function selectDatabase(el, sbas_id) {
console.log('ok select')
@@ -309,11 +344,13 @@ var searchModule = (function (p4) {
return {
checkFilters: checkFilters,
toggleDatabase: toggleDatabase,
toggleCollection: toggleCollection,
selectDatabase: selectDatabase,
beforeSearch: beforeSearch,
afterSearch: afterSearch,
clearAnswers: clearAnswers,
newSearch: newSearch
newSearch: newSearch,
resetSearch: resetSearch
};
}(p4));

View File

@@ -1,5 +1,4 @@
;
(function (document) {
var videoEditorModule = (function (document) {
/*****************
* Canva Object
@@ -218,7 +217,7 @@
/**
* THUMB EDITOR
*/
var ThumbEditor = function (videoId, canvaId, outputOptions) {
var ThumbnailEditor = function (videoId, canvaId, outputOptions) {
var domElement = document.getElementById(videoId);
@@ -313,7 +312,11 @@
};
};
document.THUMB_EDITOR = ThumbEditor;
// document.THUMB_EDITOR = ThumbEditor;
return {
ThumbnailEditor: ThumbnailEditor
}
})(document);

View File

@@ -1,37 +0,0 @@
(function () {
$(document).ready(function () {
humane.info = humane.spawn({addnCls: 'humane-libnotify-info', timeout: 1000});
humane.error = humane.spawn({addnCls: 'humane-libnotify-error', timeout: 1000});
$('body').on('click', 'a.dialog', function (event) {
var $this = $(this), size = 'Medium';
if ($this.hasClass('small-dialog')) {
size = 'Small';
} else if ($this.hasClass('full-dialog')) {
size = 'Full';
}
var options = {
size: size,
loading: true,
title: $this.attr('title'),
closeOnEscape: true
};
$dialog = p4.Dialog.Create(options);
$.ajax({
type: "GET",
url: $this.attr('href'),
dataType: 'html',
success: function (data) {
$dialog.setContent(data);
return;
}
});
return false;
});
});
}());

View File

@@ -9,7 +9,43 @@ answAjaxrunning = false;
var searchAjax, searchAjaxRunning;
searchAjaxRunning = false;
var language = {};
$(document).ready(function () {
humane.info = humane.spawn({addnCls: 'humane-libnotify-info', timeout: 1000});
humane.error = humane.spawn({addnCls: 'humane-libnotify-error', timeout: 1000});
$('body').on('click', 'a.dialog', function (event) {
var $this = $(this), size = 'Medium';
if ($this.hasClass('small-dialog')) {
size = 'Small';
} else if ($this.hasClass('full-dialog')) {
size = 'Full';
}
var options = {
size: size,
loading: true,
title: $this.attr('title'),
closeOnEscape: true
};
$dialog = p4.Dialog.Create(options);
$.ajax({
type: "GET",
url: $this.attr('href'),
dataType: 'html',
success: function (data) {
$dialog.setContent(data);
return;
}
});
return false;
});
});
//var language = {}; // handled with external prodution module
var bodySize = {
x: 0,
y: 0
@@ -21,70 +57,8 @@ function resizePreview() {
setPreview();
}
function getHome(cas, page) {
if (typeof(page) === 'undefined')
page = 0;
switch (cas) {
case 'QUERY':
workzoneFacetsModule.resetSelectedFacets();
searchModule.newSearch($("#EDIT_query").val());
break;
case 'PUBLI':
publicationModule.fetchPublications(page, answAjax, answAjaxrunning);
break;
case 'HELP':
$.ajax({
type: "POST",
url: "/client/home/",
dataType: 'html',
data: {
type: cas
},
beforeSend: function () {
if (answAjaxrunning && answAjax.abort)
answAjax.abort();
searchModule.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;
$('#answers').append(data);
searchModule.afterSearch();
return;
}
});
break;
default:
break;
}
}
function getLanguage() {
$.ajax({
type: "GET",
url: "../prod/language/",
dataType: 'json',
success: function (data) {
language = data;
return;
}
});
}
// @TODO keyboard methods should be moved in an external component
function is_ctrl_key(event) {
if (event.altKey)
return true;
@@ -102,45 +76,13 @@ function is_ctrl_key(event) {
return false;
}
// @TODO keyboard methods should be moved in an external component
function is_shift_key(event) {
if (event.shiftKey)
return true;
return false;
}
/**
* adv search : check/uncheck all the collections (called by the buttons "all"/"none")
*
* @param bool
*/
function checkBases(bool) {
$('form.phrasea_query .sbas_list').each(function () {
var sbas_id = $(this).find('input[name=reference]:first').val();
if (bool)
$(this).find(':checkbox').prop('checked', true);
else
$(this).find(':checkbox').prop('checked', false);
});
searchModule.checkFilters(true);
}
/* NOT USED function toggleFilter(filter, ele) {
var el = $('#' + filter);
if (el.is(':hidden'))
$(ele).parent().addClass('open');
else
$(ele).parent().removeClass('open');
el.slideToggle('fast');
}*/
/* NOT USED function setVisible(el) {
el.style.visibility = 'visible';
}*/
function resize() {
var body = $('#mainContainer');
@@ -171,38 +113,8 @@ function resize() {
function reset_adv_search() {
var container = $("#ADVSRCH_OPTIONS_ZONE");
var fieldsSort = $('#ADVSRCH_SORT_ZONE select[name=sort]', container);
var fieldsSortOrd = $('#ADVSRCH_SORT_ZONE select[name=ord]', container);
var dateFilterSelect = $('#ADVSRCH_DATE_ZONE select', container);
$("option.default-selection", fieldsSort).prop("selected", true);
$("option.default-selection", fieldsSortOrd).prop("selected", true);
$('#ADVSRCH_FIELDS_ZONE option').prop("selected", false);
$('#ADVSRCH_OPTIONS_ZONE input:checkbox.field_switch').prop("checked", false);
$("option:eq(0)", dateFilterSelect).prop("selected", true);
$('#ADVSRCH_OPTIONS_ZONE .datepicker').val('');
$('form.adv_search_bind input:text').val('');
checkBases(true);
}
function search_doubles() {
workzoneFacetsModule.resetSelectedFacets();
$('#EDIT_query').val('sha256=sha256');
searchModule.newSearch('sha256=sha256');
}
function initAnswerForm() {
var searchForm = $('#searchForm');
$('button[type="submit"]', searchForm).bind('click', function () {
workzoneFacetsModule.resetSelectedFacets();
@@ -288,29 +200,7 @@ function initAnswerForm() {
});
return false;
});
if (searchForm.hasClass('triggerAfterInit')) {
searchForm.removeClass('triggerAfterInit').trigger('submit');
}
}
$(document).ready(function() {
});
function answerSizer() {
@@ -357,85 +247,12 @@ function linearize() {
}
function initLook() {
$('#nperpage_slider').slider({
value: parseInt($('#nperpage_value').val()),
min: 10,
max: 100,
step: 10,
slide: function (event, ui) {
$('#nperpage_value').val(ui.value);
},
stop: function (event, ui) {
userModule.setPref('images_per_page', $('#nperpage_value').val());
}
});
$('#sizeAns_slider').slider({
value: parseInt($('#sizeAns_value').val()),
min: 90,
max: 270,
step: 10,
slide: function (event, ui) {
$('#sizeAns_value').val(ui.value);
},
stop: function (event, ui) {
userModule.setPref('images_size', $('#sizeAns_value').val());
}
});
}
function acceptCgus(name, value) {
userModule.setPref(name, value);
}
function cancelCgus(id) {
$.ajax({
type: "POST",
url: "../prod/TOU/deny/" + id + "/",
dataType: 'json',
success: function (data) {
if (data.success) {
alert(language.cgusRelog);
self.location.replace(self.location.href);
}
else {
humane.error(data.message);
}
}
});
}
function activateCgus() {
var $this = $('.cgu-dialog:first');
$this.dialog({
autoOpen: true,
closeOnEscape: false,
draggable: false,
modal: true,
resizable: false,
width: 800,
height: 500,
open: function () {
$this.parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").remove();
$('.cgus-accept', $(this)).bind('click', function () {
acceptCgus($('.cgus-accept', $this).attr('id'), $('.cgus-accept', $this).attr('date'));
$this.dialog('close').remove();
activateCgus();
});
$('.cgus-cancel', $(this)).bind('click', function () {
if (confirm(language.warningDenyCgus)) {
cancelCgus($('.cgus-cancel', $this).attr('id').split('_').pop());
}
});
}
});
}
$(document).ready(function () {
humane.forceNew = true;
activateCgus();
cguModule.activateCgus();
});
@@ -816,7 +633,7 @@ $(document).ready(function () {
initAnswerForm();
initLook();
preferencesModule.initLook();
// setTimeout("pollNotifications();", 10000);
@@ -836,22 +653,22 @@ $(document).ready(function () {
switch (event.keyCode) {
case 9: // tab ou shift-tab
edit_chgFld(event, is_shift_key(event) ? -1 : 1);
recordEditorModule.edit_chgFld(event, is_shift_key(event) ? -1 : 1);
cancelKey = shortCut = true;
break;
case 27:
edit_cancelMultiDesc(event);
recordEditorModule.edit_cancelMultiDesc(event);
shortCut = true;
break;
case 33: // pg up
if (!p4.edit.textareaIsDirty || edit_validField(event, "ask_ok"))
skipImage(event, 1);
if (!p4.edit.textareaIsDirty || recordEditorModule.edit_validField(event, "ask_ok"))
recordEditorModule.skipImage(event, 1);
cancelKey = true;
break;
case 34: // pg dn
if (!p4.edit.textareaIsDirty || edit_validField(event, "ask_ok"))
skipImage(event, -1);
if (!p4.edit.textareaIsDirty || recordEditorModule.edit_validField(event, "ask_ok"))
recordEditorModule.skipImage(event, -1);
cancelKey = true;
break;
}
@@ -1106,7 +923,7 @@ function editThis(type, value) {
dataType: "html",
data: options,
success: function (data) {
initializeEdit();
recordEditorModule.initialize();
$('#idFrameE').removeClass('loading').empty().html(data);
$('#tooltip').hide();
return;
@@ -1142,7 +959,7 @@ function editThis(type, value) {
});
})(jQuery);
(function ($) {
/*(function ($) {
$.fn.extend({
flash: function (color) {
if ($(this).hasClass('animating')) {
@@ -1177,7 +994,7 @@ function editThis(type, value) {
});
}
});
})(jQuery);
})(jQuery);*/
function toggleRemoveReg(el) {
@@ -1393,7 +1210,7 @@ function remove_from_basket(el, confirm) {
function doSpecialSearch(qry, allbase) {
if (allbase) {
checkBases(true);
searchModule.toggleDatabase(true);
}
workzoneFacetsModule.resetSelectedFacets();
$('#EDIT_query').val(decodeURIComponent(qry).replace(/\+/g, " "));
@@ -1409,140 +1226,10 @@ function clktri(id) {
}
// ---------------------- fcts du thesaurus
/* NOT USED function chgProp(path, v, k) {
var q2;
if (!k)
k = "*";
//if(k!=null)
v = v + " [" + k + "]";
$("#thprop_a_" + path).html('"' + v + '"');
// q = document.getElementById("thprop_q").innerText;
// if(!q )
// if(document.getElementById("thprop_q") && document.getElementById("thprop_q").textContent)
// q = document.getElementById("thprop_q").textContent;
q = $("#thprop_q").text();
q2 = "";
for (i = 0; i < q.length; i++)
q2 += q.charCodeAt(i) == 160 ? " " : q.charAt(i);
workzoneFacetsModule.resetSelectedFacets();
$('#EDIT_query').val(q);
newSearch(q);
return(false);
}*/
/* NOT USED function doDelete(lst) {
var children = '0';
if (document.getElementById('del_children') && document.getElementById('del_children').checked)
children = '1';
$.ajax({
type: "POST",
url: "../prod/delete/",
dataType: 'json',
data: {
lst: lst.join(';'),
del_children: children
},
success: function (data) {
$.each(data, function (i, n) {
var imgt = $('#IMGT_' + n),
chim = $('.CHIM_' + n),
stories = $('.STORY_' + n);
$('.doc_infos', imgt).remove();
imgt.unbind("click").removeAttr("ondblclick").removeClass("selected").removeClass("IMGT").find("img").unbind();
if (imgt.data("ui-draggable")) {
imgt.draggable("destroy");
}
imgt.find(".thumb img").attr("src", "/assets/common/images/icons/deleted.png").css({
width: '100%',
height: 'auto',
margin: '0 10px',
top: '0'
});
chim.parent().slideUp().remove();
imgt.find(".status,.title,.bottom").empty();
p4.Results.Selection.remove(n);
if (stories.length > 0) {
p4.WorkZone.refresh();
}
else {
p4.WorkZone.Selection.remove(n);
}
});
viewNbSelect();
}
});
}*/
/* NOT USED function advSearch(event) {
event.cancelBubble = true;
// alternateSearch(false);
$('#idFrameC .tabs a.adv_search').trigger('click');
}*/
// look_box
function start_page_selector() {
var el = $('#look_box_settings select[name=start_page]');
switch (el.val()) {
case "LAST_QUERY":
case "PUBLI":
case "HELP":
$('#look_box_settings input[name=start_page_value]').hide();
break;
case "QUERY":
$('#look_box_settings input[name=start_page_value]').show();
break;
}
}
// look_box
function set_start_page() {
var el = $('#look_box_settings select[name=start_page]');
var val = el.val();
var start_page_query = $('#look_box_settings input[name=start_page_value]').val();
if (val === 'QUERY') {
userModule.setPref('start_page_query', start_page_query);
}
userModule.setPref('start_page', val);
}
// preferences modal
function lookBox(el, event) {
$("#look_box").dialog({
closeOnEscape: true,
resizable: false,
width: 450,
height: 500,
modal: true,
draggable: false,
overlay: {
backgroundColor: '#000',
opacity: 0.7
}
}).dialog('open');
}
function showAnswer(p) {
/* NOT USED function showAnswer(p) {
var o;
if (p === 'Results') {
// on montre les results
@@ -1580,7 +1267,7 @@ function showAnswer(p) {
setTimeout('document.getElementById("AnswerExplain").style.display = "block";', 200);
}
}
}
}*/
/** FROM INDEX.php **/
@@ -1589,31 +1276,6 @@ function saveeditPbar(idesc, ndesc) {
document.getElementById("saveeditPbarN").innerHTML = ndesc;
}
/* NOT USED function getSelText() {
var txt = '';
if (window.getSelection) {
txt = window.getSelection();
}
else if (document.getSelection) {
txt = document.getSelection();
}
else if (document.selection) {
txt = document.selection.createRange().text;
}
else
return;
return txt;
}*/
/* NOT USED function getWinPosAsXML() {
var ret = '<win id="search" ratio="' + ($('#idFrameC').outerWidth() / bodySize.x) + '"/>';
if ($('#idFrameE').is(':visible') && $('#EDITWINDOW').is(':visible'))
ret += '<win id="edit" ratio="' + ($('#idFrameE').outerWidth() / $('#EDITWINDOW').innerWidth()) + '"/>';
return ret;
}*/
function saveWindows() {
var key = '';
@@ -1637,78 +1299,6 @@ function gotopage(pag) {
$('#searchForm').submit();
}
/* NOT USED function addFilterMulti(filter, link, sbasid) {
var clone = $('#filter_multi_' + sbasid + '_' + filter);
var orig = clone;
if (!$('#filter_multi_' + sbasid + '_' + filter).is(':visible')) {
clone = orig.clone(true);
var par = orig.parent();
orig.remove();
par.append(clone);
clone.slideDown('fast', function () {
$(this);
});
$(link).addClass('filterActive');
}
else {
clone.slideUp();
$(link).removeClass('filterActive');
}
return false;
}*/
/* NOT USED function autoorder() {
var val = $.trim($('#auto_order').val());
if (val === '')
return;
var sorter = new Array();
$('#reorder_box .diapo form').each(function (i, n) {
var id = $('input[name=id]', n).val();
switch (val) {
case 'title':
default:
var data = $('input[name=title]', n).val();
break;
case 'default':
var data = $('input[name=default]', n).val();
break;
}
sorter[id] = data;
});
var data_type = 'string';
switch (val) {
case 'default':
var data_type = 'integer';
break;
}
sorter = arraySortByValue(sorter, data_type);
var last_moved = false;
for (i in sorter) {
var elem = $('#ORDER_' + i);
if (last_moved) {
elem.insertAfter(last_moved);
}
else {
$('#reorder_box').prepend(elem);
}
last_moved = elem;
}
}*/
//clear search
$(document).ready(function () {

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
<script src="../../../../../www/assets/vendors/jquery-ui/jquery-ui.js"></script>
<script src="../../../../../www/bower_components/qunit/qunit/qunit.js"></script>
<script src="../../../../../www/assets/vendors/blueimp-load-image/load-image.js"></script>
<script src="../jquery.Upload.js"></script>
<script src="../components/upload/jquery.Upload.js"></script>
<link type="text/css" rel="stylesheet" href="../../../../../www/bower_components/qunit/qunit/qunit.css"/>
<script> $(document).ready(function(){

View File

@@ -79,7 +79,7 @@
{# MODULE #}
{% if module == "prod" %}
<li>
<a href="#" onclick="getHome('PUBLI');" >
<a href="#" class="state-navigation" data-state="publication" >
<span>
{{ 'Publications' | trans }}
</span>

View File

@@ -16,7 +16,7 @@
</tr>
<tr>
<td colspan="2" style='text-align:left'>
{{ 'do you want to validate' | trans }} ?
{{ 'do you want to validate' | trans }}
</td>
</tr>
</tbody>

View File

@@ -348,7 +348,7 @@
</div>
<script type="text/javascript">
console.log('action tools')
$(document).ready(function(){
var $scope = $("#prod-tool-box");
var tabs = $("#tool-tabs", $scope).tabs();
@@ -403,7 +403,7 @@ $(document).ready(function(){
//thumbExtractor
var ThumbEditor = new this.THUMB_EDITOR("thumb_video", "thumb_canvas", {
var ThumbEditor = new videoEditorModule.ThumbnailEditor("thumb_video", "thumb_canvas", {
altCanvas: $('#alt_canvas_container .alt_canvas')
});

View File

@@ -35,7 +35,7 @@
<div class='titre'>
{{ record.get_original_name() }}
</div>
<img class="edit_IMGT" id="idEditDiapoImg_{{ i }}" style="position:absolute; top:{{ top|round }}%; width:{{ width }}; height:{{ height }}; left:{{ left|round }}%;" onclick="edit_clk_editimg(event, {{ i }});" src="{{ thumbnail }}" />
<img class="edit_IMGT" id="idEditDiapoImg_{{ i }}" style="position:absolute; top:{{ top|round }}%; width:{{ width }}; height:{{ height }}; left:{{ left|round }}%;" onclick="recordEditorModule.edit_clk_editimg(event, {{ i }});" src="{{ thumbnail }}" />
<div style='position:absolute; top:0px; left:0px; height:20px'>
<img class="require_alert" src="/assets/common/images/icons/alert.png" style="display:none;cursor:help;" title="{{ 'edit::Certains champs doivent etre remplis pour valider cet editing' | trans }}">
</div>
@@ -55,7 +55,7 @@
<td>
<div class="context-menu context-menu-theme-vista">
<div title="" class="context-menu-item">
<div class="context-menu-item-inner" onclick="setRegDefault('{{i}}','{{record.get_record_id()}}');">{{ 'edit: chosiir limage du regroupement' | trans }}</div>
<div class="context-menu-item-inner" onclick="recordEditorModule.setRegDefault('{{i}}','{{record.get_record_id()}}');">{{ 'edit: chosiir limage du regroupement' | trans }}</div>
</div>
</div>
</td>
@@ -71,7 +71,7 @@
{% endmacro %}
{% macro HTML_fieldlist(recordsRequest, fields) %}
<div class="edit_field" id="EditFieldBox_status" onclick="return(edit_mdwn_status(event));" >
<div class="edit_field" id="EditFieldBox_status" onclick="return(recordEditorModule.edit_mdwn_status(event));" >
{% trans %}prod::editing::fields: status{% endtrans %}
</div>
{% set cssfile = '000000' %}
@@ -81,7 +81,7 @@
{% for field in fields %}
{% set i = field.get_id() %}
{% if field.is_readonly() is empty %}
<div class="edit_field" id="EditFieldBox_{{i}}" onclick="return(edit_mdwn_fld(event, {{i}}, '{{field.get_name()}}'));" >
<div class="edit_field" id="EditFieldBox_{{i}}" onclick="return(recordEditorModule.edit_mdwn_fld(event, {{i}}, '{{field.get_name()}}'));" >
<i id="editSGtri_{{i}}" style="visibility:hidden;" class="icon-caret-right"></i>
<span class="icon-stack fieldTips" tooltipsrc="{{ path('prod_tooltip_metadata', { 'sbas_id' : field.get_databox().get_sbas_id(), 'field_id' : field.get_id() }) }}">
<i class="icon-circle icon-stack-base"></i>
@@ -170,27 +170,27 @@
<table style='position:relative; top:5px; table-layout:fixed; width:100%'>
<tr>
<td style='width:30px; text-align:right'>
<input type='button' value='&#9668;' class='btn btn-inverse' onclick="edit_chgFld(event, -1);return(false);" />
<input type='button' value='&#9668;' class='btn btn-inverse' onclick="recordEditorModule.edit_chgFld(event, -1);return(false);" />
</td>
<td id="idFieldNameEdit"></td>
<td style='width:30px; text-align:left'>
<input type='button' value='&#9658;' class='btn btn-inverse' onclick="edit_chgFld(event, 1);return(false);" />
<input type='button' value='&#9658;' class='btn btn-inverse' onclick="recordEditorModule.edit_chgFld(event, 1);return(false);" />
</td>
</tr>
</table>
</div>
<div id="EDIT_EDIT" class="PNB">
<div id="ZTextMonoValued">
<textarea id="idEditZTextArea" onmousedown="return(edit_mdwn_ta(event));" onmouseup="return(edit_mup_ta(event, this));" onkeyup="return(edit_kup_ta(event, this));" onKeyDown="return(edit_kdwn(event, this));"></textarea>
<textarea id="idEditZTextArea" onmousedown="return(recordEditorModule.edit_mdwn_ta(event));" onmouseup="return(recordEditorModule.edit_mup_ta(event, this));" onkeyup="return(recordEditorModule.edit_kup_ta(event, this));" onKeyDown="return(recordEditorModule.edit_kdwn(event, this));"></textarea>
<div id="idEditDateZone"></div>
</div>
<div id="ZTextMultiValued">
<form onsubmit="edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);return(false);" style="position:absolute; height:30px; left:2px; right:2px;">
<form onsubmit="recordEditorModule.edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);return(false);" style="position:absolute; height:30px; left:2px; right:2px;">
<div style="position:absolute; top:0px; left:0px; right:70px; height:17px;">
<input type='text' style="font-size:15px; position:absolute; top:0px; left:0px; width:100%; height:100%;" id="EditTextMultiValued" value="" />
</div>
<div style="position:absolute; top:6px; width:60px; right:0px; height:11px;">
<img id="EditButAddMultiValued" style="cursor:pointer" src="/assets/common/images/icons/plus16.png" onclick="edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);" />
<img id="EditButAddMultiValued" style="cursor:pointer" src="/assets/common/images/icons/plus16.png" onclick="recordEditorModule.edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);" />
</div>
</form>
<div id="ZTextMultiValued_values"></div>
@@ -207,7 +207,7 @@
{% for n, stat in status %}
<tr>
<td style="padding-left:10px">
<span style="cursor:pointer" onclick="edit_clkstatus(event, {{n}}, 0);">
<span style="cursor:pointer" onclick="recordEditorModule.edit_clkstatus(event, {{n}}, 0);">
<div id="idCheckboxStatbit0_{{n}}" class="gui_ckbox_0"></div>
{% if stat['img_off'] %}
<img src="{{stat['img_off']}}" title="{{stat['label0']}}" style="width:16px;height:16px;vertical-align:bottom" />
@@ -216,7 +216,7 @@
</span>
</td>
<td style="padding-left:20px">
<span style="cursor:pointer" onclick="edit_clkstatus(event, {{n}}, 1);">
<span style="cursor:pointer" onclick="recordEditorModule.edit_clkstatus(event, {{n}}, 1);">
<div id="idCheckboxStatbit1_{{n}}" class="gui_ckbox_0"></div>
{% if stat['img_on'] %}
<img src="{{stat['img_on']}}" title="{{stat['label1']}}" style="width:16px;height:16px;vertical-align:bottom" />
@@ -231,9 +231,9 @@
</div>
</div>
<div id="idDivButtons" class="PNB">
<input id="ok" type="button" value="{{ 'boutton::remplacer' | trans }}" class="btn btn-inverse" onclick="edit_validField(event, 'ok');return(false);">
<input id="fusion" type="button" value="{{ 'boutton::ajouter' | trans }}" class="btn btn-inverse" onclick="edit_validField(event, 'fusion');return(false);">
<input id="cancel" type="button" value="{{ 'boutton::annuler' | trans }}" class="btn btn-inverse" onclick="edit_validField(event, 'cancel');return(false);">
<input id="ok" type="button" value="{{ 'boutton::remplacer' | trans }}" class="btn btn-inverse" onclick="recordEditorModule.edit_validField(event, 'ok');return(false);">
<input id="fusion" type="button" value="{{ 'boutton::ajouter' | trans }}" class="btn btn-inverse" onclick="recordEditorModule.edit_validField(event, 'fusion');return(false);">
<input id="cancel" type="button" value="{{ 'boutton::annuler' | trans }}" class="btn btn-inverse" onclick="recordEditorModule.edit_validField(event, 'cancel');return(false);">
</div>
<div id="idExplain" class="PNB"></div>
</div>
@@ -252,7 +252,7 @@
</ul>
{% if thesaurus %}
<div id='TH_Ofull'>
<div class='thesaurus' ondblclick='return(edit_dblclickThesaurus(event));' onclick='return(edit_clickThesaurus(event));'>
<div class='thesaurus' ondblclick='return(recordEditorModule.edit_dblclickThesaurus(event));' onclick='return(recordEditorModule.edit_clickThesaurus(event));'>
<p id='TH_T.{{ databox.get_sbas_id() }}.T'>
<u id='TH_P.{{ databox.get_sbas_id() }}.T'>+</u><a id='GL_W.{{ databox.get_sbas_id() }}.T' style='FONT-WEIGHT: bold;'>{{ databox.get_label(app['locale']) }}</a>
</p>
@@ -297,7 +297,7 @@
<tr>
<td valign="top">{{ 'prod::editing:remplace: options de remplacement' | trans }}</td>
<td>
<input type="checkbox" class="checkbox" id="EditSROptionRX" value="regexp" onchange="changeReplaceMode(this);">
<input type="checkbox" class="checkbox" id="EditSROptionRX" value="regexp" onchange="recordEditorModule.changeReplaceMode(this);">
{{ 'prod::editing:remplace::option : utiliser une expression reguliere' | trans }}
{% set help_link = 'https://secure.wikimedia.org/wikipedia/en/wiki/Regular_expression' %}
{% if app['locale'] == 'de' %}
@@ -351,8 +351,8 @@
</div>
<div id="buttonEditing">
<input type='button' value="{{ 'boutton::valider' | trans }}" class="btn btn-inverse btn-small" onclick="edit_applyMultiDesc(event);" />
<input type='button' value="{{ 'boutton::annuler' | trans }}" class="btn btn-inverse btn-small" onclick="edit_cancelMultiDesc(event);" />
<input type='button' value="{{ 'boutton::valider' | trans }}" class="btn btn-inverse btn-small" onclick="recordEditorModule.edit_applyMultiDesc(event);" />
<input type='button' value="{{ 'boutton::annuler' | trans }}" class="btn btn-inverse btn-small" onclick="recordEditorModule.edit_cancelMultiDesc(event);" />
</div>
</div>
@@ -424,6 +424,6 @@
{% elseif not_actionable == 1 %}
alert("{{ 'prod::editing: 1 document ne peut etre edite car vos droits sont induffisants' | trans | e('js') }}");
{% endif %}
startThisEditing({{ databox.get_sbas_id }},{% if recordsRequest.isSingleStory() %}'GRP'{% else %}'LST'{% endif %},"",'');
recordEditorModule.startThisEditing({{ databox.get_sbas_id }},{% if recordsRequest.isSingleStory() %}'GRP'{% else %}'LST'{% endif %},"",'');
{% endif %}
</script>

View File

@@ -223,9 +223,9 @@
<div id="ADVSRCH_SBAS_ZONE" class="sbasglob">
<div class="btn-toolbar">
<input class="btn btn-inverse" type="button"
value="{{ 'boutton:: selectionner toutes les bases' | trans }}" onclick="checkBases(true);" />
value="{{ 'boutton:: selectionner toutes les bases' | trans }}" onclick="searchModule.toggleDatabase(true);" />
<input class="btn btn-inverse" type="button"
value="{{ 'boutton:: selectionner aucune base' | trans }}" onclick="checkBases(false);" />
value="{{ 'boutton:: selectionner aucune base' | trans }}" onclick="searchModule.toggleDatabase(false);" />
</div>
{{_self.bas_list(module_prod, search_datas)}}
</div>
@@ -233,7 +233,7 @@
<td style="width:50%; vertical-align:top;">
<div id="sbasfiltercont">
<div class="btn-toolbar">
<input class="btn btn-inverse" type="button" value="{{ 'Re-initialiser' | trans }}" onclick="reset_adv_search();" />
<input class="btn btn-inverse" type="button" value="{{ 'Re-initialiser' | trans }}" onclick="searchModule.resetSearch();" />
</div>
<div id="ADVSRCH_OPTIONS_ZONE">
<div id="ADVSRCH_SORT_ZONE">
@@ -393,21 +393,9 @@
<div id="idFrameT" class="PNB ui-corner-top">
<div class="tools PNB10 btn-toolbar">
{% include "prod/toolbar.html.twig" with {acl: app.getAclForUser(app.getAuthenticatedUser())} %}
<a href="#" id="settings" onclick="lookBox(this,event);return false;">{{ 'Preferences' | trans }} </a>
</div>
<div id="answers" class=" PNB10">
<script>
$(document).ready(function(){
{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'QUERY' %}
$('form[name="phrasea_query"]').addClass('triggerAfterInit');
{% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'LAST_QUERY' %}
$('form[name="phrasea_query"]').addClass('triggerAfterInit');
{% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'PUBLI' %}
getHome('PUBLI');
{% endif %}
});
</script>
<a href="#" id="settings" onclick="preferencesModule.lookBox(this,event);return false;">{{ 'Preferences' | trans }} </a>
</div>
<div id="answers" class=" PNB10"></div>
<div id="answers_status">
<div class="infos">
<span id="tool_results">
@@ -623,7 +611,7 @@
<h1>{{ 'Affichage au demarrage' | trans }}</h1>
<form class="form-inline">
{% set start_page_pref = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') %}
<select class="span4" name="start_page" onchange="start_page_selector();">
<select class="span4" name="start_page" onchange="preferencesModule.setInitialStateOptions();">
<option value="LAST_QUERY" {% if start_page_pref == 'LAST_QUERY' %}selected="selected"{% endif %} >
{{ 'Ma derniere question' | trans }}
</option>
@@ -638,7 +626,7 @@
</option>
</select>
<input type="text" class="span4" name="start_page_value" value="{{ app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_query')}}" style="display:{% if start_page_pref == 'QUERY' %}inline{% else %}none{% endif %}" />
<input type="button" class="btn btn-inverse" value="{{'boutton::valider' | trans }}" onclick="set_start_page();" />
<input type="button" class="btn btn-inverse" value="{{'boutton::valider' | trans }}" onclick="preferencesModule.setInitialState();" />
</form>
</div>
</div>
@@ -754,6 +742,16 @@
<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">
{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'QUERY' %}
{% set initialAppState = 'default' %}
{% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'LAST_QUERY' %}
{% set initialAppState = 'default' %}
{% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'PUBLI' %}
{% set initialAppState = 'publication' %}
{% endif %}
ProductionApplication.bootstrap({
lang: "{{ app.locale }}",
baseUrl: '{{ app['request'].getUriForPath('/') }}',
@@ -762,7 +760,8 @@
url: "{{ path('list_notifications') }}",
moduleId: 1,
userId: {{app.getAuthenticatedUser().getId()}}
}
},
initialState: "{{ initialAppState }}"
})
$(document).ready(function(){