wip: move js modules into production-client npm module

This commit is contained in:
Florian BLOUET
2016-03-02 18:27:24 +01:00
parent ab368a7dee
commit d7c89a2199
16 changed files with 230 additions and 791 deletions

View File

@@ -79,19 +79,18 @@ gulp.task('build-prod-js', function(){
config.paths.src + 'prod/js/components/search/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/search/search-result.js',
config.paths.src + 'prod/js/components/publication.js', // config.paths.src + 'prod/js/components/publication.js',
config.paths.src + 'prod/js/components/workzone/workzone.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-basket.js',
config.paths.src + 'prod/js/components/workzone/workzone-facets.js', config.paths.src + 'prod/js/components/workzone/workzone-facets.js',
config.paths.src + 'prod/js/components/workzone/workzone-thesaurus.js', config.paths.src + 'prod/js/components/workzone/workzone-thesaurus.js',
config.paths.src + 'prod/js/components/cgu.js', // config.paths.src + 'prod/js/components/cgu.js',
config.paths.src + 'prod/js/components/preferences.js', // config.paths.src + 'prod/js/components/preferences.js',
// config.paths.src + 'prod/js/jquery.form.2.49.js',
config.paths.src + 'prod/js/components/record/editable-record.js', config.paths.src + 'prod/js/components/record/editable-record.js',
config.paths.src + 'prod/js/components/push/push.js', config.paths.src + 'prod/js/components/push/push.js',
config.paths.src + 'prod/js/prod.js', config.paths.src + 'prod/js/prod.js',
config.paths.src + 'prod/js/components/upload/upload.js', config.paths.src + 'prod/js/components/upload/upload.js',
config.paths.src + 'prod/js/components/video-editor.js', // config.paths.src + 'prod/js/components/video-editor.js',
config.paths.src + 'vendors/jquery-sprintf/js/jquery.sprintf.1.0.3.js', config.paths.src + 'vendors/jquery-sprintf/js/jquery.sprintf.1.0.3.js',
config.paths.src + 'prod/js/components/preview/preview.js', config.paths.src + 'prod/js/components/preview/preview.js',
config.paths.src + 'prod/js/components/editor/record-editor.js', config.paths.src + 'prod/js/components/editor/record-editor.js',

View File

@@ -33,11 +33,11 @@ var commonModule = (function ($, p4) {
$(this).removeClass('context-menu-item-hover'); $(this).removeClass('context-menu-item-hover');
}); });
$('#help-trigger').contextMenu('#mainMenu .helpcontextmenu', {openEvt: 'click', dropDown: true, theme: 'vista', dropDown: true, /*$('#help-trigger').contextMenu('#mainMenu .helpcontextmenu', {openEvt: 'click', dropDown: true, theme: 'vista', dropDown: true,
showTransition: 'slideDown', showTransition: 'slideDown',
hideTransition: 'hide', hideTransition: 'hide',
shadow: false shadow: false
}); });*/
}); });

View File

@@ -1,56 +0,0 @@
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));

View File

@@ -1,84 +0,0 @@
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

@@ -7,6 +7,21 @@ var recordPreviewModule = (function (p4) {
$(document).ready(function () { $(document).ready(function () {
$('#PREVIEWIMGDESC').tabs(); $('#PREVIEWIMGDESC').tabs();
$('#PREVIEWBOX .gui_vsplitter', p4.edit.editBox).draggable({
axis: 'x',
containment: 'parent',
drag: function (event, ui) {
var x = $(ui.position.left)[0];
if (x < 330 || x > (bodySize.x - 400)) {
return false;
}
var v = $(ui.position.left)[0];
$("#PREVIEWLEFT").width(v);
$("#PREVIEWRIGHT").css("left", $(ui.position.left)[0]);
recordPreviewModule.resizePreview();
}
});
}); });
/** /**
@@ -285,11 +300,6 @@ var recordPreviewModule = (function (p4) {
var h = parseInt(p4.preview.current.height); var h = parseInt(p4.preview.current.height);
var w = parseInt(p4.preview.current.width); var w = parseInt(p4.preview.current.width);
// if(p4.preview.current.type == 'video')
// {
// var h = parseInt(p4.preview.current.flashcontent.height);
// var w = parseInt(p4.preview.current.flashcontent.width);
// }
var t = 20; var t = 20;
var de = 0; var de = 0;
@@ -301,9 +311,6 @@ var recordPreviewModule = (function (p4) {
de = 60; de = 60;
} }
// if(p4.preview.current.type != 'flash')
// {
var ratioP = w / h; var ratioP = w / h;
var ratioD = parseInt(p4.preview.width) / parseInt(p4.preview.height); var ratioD = parseInt(p4.preview.width) / parseInt(p4.preview.height);
@@ -320,13 +327,7 @@ var recordPreviewModule = (function (p4) {
h = Math.round(w / ratioP); h = Math.round(w / ratioP);
} }
} }
// }
// else
// {
// h = Math.round(parseInt(p4.preview.height) - margY);
// w = Math.round(parseInt(p4.preview.width) - margX);
// }
t = Math.round((parseInt(p4.preview.height) - h - de) / 2); t = Math.round((parseInt(p4.preview.height) - h - de) / 2);
var l = Math.round((parseInt(p4.preview.width) - w) / 2); var l = Math.round((parseInt(p4.preview.width) - w) / 2);
$('#PREVIEWIMGCONT .record').css({ $('#PREVIEWIMGCONT .record').css({

View File

@@ -1,363 +0,0 @@
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)
});
}
}
searchModule.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)
searchModule.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 = dialogModule.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
});
}
dialogModule.dialog.close(1);
}
});
dialogModule.dialog.close(1);
};
var dialog = dialogModule.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
});
searchModule.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);
},
openModal: function(data) {
return _createPublicationModal(data);
}
};
})();

View File

@@ -1,6 +1,55 @@
var p4 = p4 || {}; var p4 = p4 || {};
var searchModule = (function (p4) { var searchModule = (function (p4) {
$(document).ready(function(){
$('.adv_search_button').on('click', function () {
var searchForm = $('#searchForm');
var parent = searchForm.parent();
var options = {
size: (bodySize.x - 120)+'x'+(bodySize.y - 120),
loading: false,
closeCallback: function (dialog) {
var datas = dialog.find('form.phrasea_query').appendTo(parent);//.clone();
$('.adv_trigger', searchForm).show();
$('.adv_options', searchForm).hide();
}
};
$dialog = dialogModule.dialog.create(options);
searchForm.appendTo($dialog.getDomElement());
$dialog.getDomElement().find('.adv_options').show();
$dialog.getDomElement().find('.adv_trigger').hide();
$dialog.getDomElement().find('form').bind('submit.conbo', function () {
$(this).unbind('submit.conbo');
$dialog.close();
return false;
});
return false;
});
$('input[name=search_type]').bind('click', function () {
var $this = $(this);
var $record_types = $('#recordtype_sel');
if ($this.hasClass('mode_type_reg')) {
$record_types.css("visibility", "hidden"); // better than hide because does not change layout
$record_types.prop("selectedIndex", 0);
} else {
$record_types.css("visibility", "visible");
}
});
});
function toggleCollection(deployer, todeploy_selector) function toggleCollection(deployer, todeploy_selector)
{ {
if($(deployer).hasClass("deployer_opened")) { if($(deployer).hasClass("deployer_opened")) {

View File

@@ -1,8 +1,9 @@
/*
var videoEditorModule = (function (document) { var videoEditorModule = (function (document) {
/***************** /!*****************
* Canva Object * Canva Object
*****************/ *****************!/
var Canva = function (domCanva) { var Canva = function (domCanva) {
this.domCanva = domCanva; this.domCanva = domCanva;
}; };
@@ -93,9 +94,9 @@ var videoEditorModule = (function (document) {
}; };
/****************** /!******************
* Image Object * Image Object
******************/ ******************!/
var Image = function (domElement) { var Image = function (domElement) {
this.domElement = domElement; this.domElement = domElement;
}; };
@@ -112,9 +113,9 @@ var videoEditorModule = (function (document) {
} }
}; };
/****************** /!******************
* Video Object inherits from Image object * Video Object inherits from Image object
******************/ ******************!/
var Video = function (domElement) { var Video = function (domElement) {
Image.call(this, domElement); Image.call(this, domElement);
@@ -130,9 +131,9 @@ var videoEditorModule = (function (document) {
return this.aspectRatio; return this.aspectRatio;
}; };
/****************** /!******************
* Cache Object * Cache Object
******************/ ******************!/
var Store = function () { var Store = function () {
this.datas = {}; this.datas = {};
}; };
@@ -163,9 +164,9 @@ var videoEditorModule = (function (document) {
} }
}; };
/****************** /!******************
* Screenshot Object * Screenshot Object
******************/ ******************!/
var ScreenShot = function (id, canva, video, altCanvas) { var ScreenShot = function (id, canva, video, altCanvas) {
var date = new Date(); var date = new Date();
@@ -214,9 +215,9 @@ var videoEditorModule = (function (document) {
} }
}; };
/** /!**
* THUMB EDITOR * THUMB EDITOR
*/ *!/
var ThumbnailEditor = function (videoId, canvaId, outputOptions) { var ThumbnailEditor = function (videoId, canvaId, outputOptions) {
var domElement = document.getElementById(videoId); var domElement = document.getElementById(videoId);
@@ -320,3 +321,4 @@ var videoEditorModule = (function (document) {
})(document); })(document);
*/

View File

@@ -1,3 +1,4 @@
/*
var p4 = p4 || {}; var p4 = p4 || {};
var workzoneBasketModule = (function (p4) { var workzoneBasketModule = (function (p4) {
@@ -104,4 +105,4 @@ var workzoneBasketModule = (function (p4) {
openBasketPreferences: openBasketPreferences openBasketPreferences: openBasketPreferences
} }
})(p4); })(p4);*/

View File

@@ -1,3 +1,4 @@
/*
var p4 = p4 || {}; var p4 = p4 || {};
var workzoneFacetsModule = (function (p4) { var workzoneFacetsModule = (function (p4) {
@@ -159,4 +160,4 @@ var workzoneFacetsModule = (function (p4) {
return { loadFacets: loadFacets, getSelectedFacets: getSelectedFacets, resetSelectedFacets: resetSelectedFacets} return { loadFacets: loadFacets, getSelectedFacets: getSelectedFacets, resetSelectedFacets: resetSelectedFacets}
})(p4); })(p4);*/

View File

@@ -1,3 +1,4 @@
/*
var p4 = p4 || {}; var p4 = p4 || {};
var workzoneThesaurusModule = (function (p4) { var workzoneThesaurusModule = (function (p4) {
@@ -31,3 +32,4 @@ var workzoneThesaurusModule = (function (p4) {
return {}; return {};
})(p4); })(p4);
*/

View File

@@ -1,8 +1,127 @@
var p4 = p4 || {}; var p4 = p4 || {};
var workzoneModule = (function (p4) { var workzoneModule = (function (p4) {
var nextBasketScroll = false;
var warnOnRemove = true; var warnOnRemove = true;
$(document).ready(function () { $(document).ready(function () {
$('#idFrameC').resizable({
handles: 'e',
resize: function () {
answerSizer();
linearizeUi();
},
stop: function () {
var el = $('.SSTT.active').next().find('div:first');
var w = el.find('div.chim-wrapper:first').outerWidth();
var iw = el.innerWidth();
var diff = $('#idFrameC').width() - el.outerWidth();
var n = Math.floor(iw / w);
$('#idFrameC').height('auto');
var nwidth = (n) * w + diff + n;
if (isNaN(nwidth)) {
_saveWindows();
return;
}
if (nwidth < 265)
nwidth = 265;
if (el.find('div.chim-wrapper:first').hasClass('valid') && nwidth < 410)
nwidth = 410;
$('#idFrameC').stop().animate({
width: nwidth
},
300,
'linear',
function () {
answerSizer();
linearizeUi();
_saveWindows();
});
}
});
$('#idFrameC .ui-tabs-nav li').on('click', function (event) {
if($('#idFrameC').attr('data-status') == 'closed'){
$('#idFrameC').width(300);
$('#rightFrame').css('left', 300);
$('#rightFrame').width($(window).width()-300);
$('#baskets, #proposals, #thesaurus_tab').hide();
$('.ui-resizable-handle, #basket_menu_trigger').show();
var IDname = $(this).attr('aria-controls');
$('#'+IDname).show();
}
$('#idFrameC').attr('data-status', 'open');
$('.WZbasketTab').css('background-position', '9px 21px');
$('#idFrameC').removeClass('closed');
});
var previousTab = "";
$('#idFrameC #retractableButton').bind('click', function (event) {
if($('#idFrameC').attr('data-status') != 'closed'){
$(this).find('i').removeClass('icon-double-angle-left').addClass('icon-double-angle-right')
$('#idFrameC').width(80);
$('#rightFrame').css('left', 80);
$('#rightFrame').width($(window).width()-80);
$('#idFrameC').attr('data-status', 'closed');
$('#baskets, #proposals, #thesaurus_tab, .ui-resizable-handle, #basket_menu_trigger').hide();
$('#idFrameC .ui-tabs-nav li').removeClass('ui-state-active');
$('.WZbasketTab').css('background-position', '15px 16px');
$('#idFrameC').addClass('closed');
previousTab = $('#idFrameC .icon-menu').find('li.ui-tabs-active');
}else{
$(this).find('i').removeClass('icon-double-angle-right').addClass('icon-double-angle-left')
$('#idFrameC').width(300);
$('#rightFrame').css('left', 300);
$('#rightFrame').width($(window).width()-300);
$('#idFrameC').attr('data-status', 'open');
$('.ui-resizable-handle, #basket_menu_trigger').show();
$('.WZbasketTab').css('background-position', '9px 16px');
$('#idFrameC').removeClass('closed');
$('#idFrameC .icon-menu li').last().find('a').trigger('click');
$('#idFrameC .icon-menu li').first().find('a').trigger('click');
$(previousTab).find('a').trigger('click');
}
event.stopImmediatePropagation();
//p4.WorkZone.close();
return false;
});
$('#basket_menu_trigger').contextMenu('#basket_menu', {
openEvt: 'click',
dropDown: true,
theme: 'vista',
showTransition: 'slideDown',
hideTransition: 'hide',
shadow: false
});
$('#basket_menu_trigger').trigger("click");
$('#basket_menu_trigger').trigger("click");
$('.basketTips').tooltip({
delay: 200
});
$('#idFrameC .tabs').tabs({
activate: function (event, ui) {
if (ui.newTab.context.hash == "#thesaurus_tab") {
thesau_show();
}
p4.WorkZone.open();
}
});
$('.basket_refresher').on('click', function () {
return p4.WorkZone.refresh('current');
return false;
});
activeBaskets(); activeBaskets();
$('a.story_unfix').on('click', function () { $('a.story_unfix').on('click', function () {
@@ -117,7 +236,7 @@ var workzoneModule = (function (p4) {
return; return;
} }
p4.next_bask_scroll = true; nextBasketScroll = true;
return; return;
} }
}); });
@@ -250,8 +369,8 @@ var workzoneModule = (function (p4) {
header: 'div.header', header: 'div.header',
activate: function (event, ui) { activate: function (event, ui) {
var b_active = $('#baskets .SSTT.active'); var b_active = $('#baskets .SSTT.active');
if (p4.next_bask_scroll) { if (nextBasketScroll) {
p4.next_bask_scroll = false; nextBasketScroll = false;
if (!b_active.next().is(':visible')) if (!b_active.next().is(':visible'))
return; return;

View File

@@ -17,7 +17,7 @@ var prodModule = (function (p4, humane) {
humane.info = humane.spawn({addnCls: 'humane-libnotify-info', timeout: 1000}); humane.info = humane.spawn({addnCls: 'humane-libnotify-info', timeout: 1000});
humane.error = humane.spawn({addnCls: 'humane-libnotify-error', timeout: 1000}); humane.error = humane.spawn({addnCls: 'humane-libnotify-error', timeout: 1000});
humane.forceNew = true; humane.forceNew = true;
cguModule.activateCgus(); // cguModule.activateCgus();
$('body').on('click', 'a.dialog', function (event) { $('body').on('click', 'a.dialog', function (event) {
var $this = $(this), size = 'Medium'; var $this = $(this), size = 'Medium';
@@ -49,52 +49,8 @@ var prodModule = (function (p4, humane) {
return false; return false;
}); });
$('input[name=search_type]').bind('click', function () {
console.log('search bind')
var $this = $(this);
var $record_types = $('#recordtype_sel');
console.log($this.hasClass('mode_type_reg'), $record_types)
if ($this.hasClass('mode_type_reg')) {
$record_types.css("visibility", "hidden"); // better than hide because does not change layout
$record_types.prop("selectedIndex", 0);
} else {
$record_types.css("visibility", "visible");
}
});
$('.adv_search_button').on('click', function () {
var searchForm = $('#searchForm');
var parent = searchForm.parent();
var options = {
size: (bodySize.x - 120)+'x'+(bodySize.y - 120),
loading: false,
closeCallback: function (dialog) {
var datas = dialog.find('form.phrasea_query').appendTo(parent);//.clone();
$('.adv_trigger', searchForm).show();
$('.adv_options', searchForm).hide();
}
};
$dialog = dialogModule.dialog.create(options);
searchForm.appendTo($dialog.getDomElement());
$dialog.getDomElement().find('.adv_options').show();
$dialog.getDomElement().find('.adv_trigger').hide();
$dialog.getDomElement().find('form').bind('submit.conbo', function () {
$(this).unbind('submit.conbo');
$dialog.close();
return false;
});
return false;
});
$(document).bind('contextmenu', function (event) { $(document).bind('contextmenu', function (event) {
var targ; var targ;
@@ -119,73 +75,22 @@ var prodModule = (function (p4, humane) {
return gogo; return gogo;
}); });
$('.basket_refresher').on('click', function () {
return p4.WorkZone.refresh('current');
return false;
});
$('#loader_bar').stop().animate({ $('#loader_bar').stop().animate({
width: '70%' width: '70%'
}, 450); }, 450);
p4.preview = { p4.preview = {
open: false, open: false,
current: false current: false
}; };
p4.currentViewMode = 'classic';
p4.nbNoview = 0;
p4.sel = []; p4.sel = [];
p4.baskSel = [];
p4.edit = {}; p4.edit = {};
p4.thesau = { p4.thesau = {
tabs: null tabs: null
}; };
p4.active_zone = false; p4.active_zone = false;
p4.next_bask_scroll = false;
$('#backcolorpickerHolder').ColorPicker({
flat: true,
color: '404040',
livePreview: false,
eventName: 'mouseover',
onSubmit: function (hsb, hex, rgb, el) {
var back_hex = '';
var unactive = '';
if (hsb.b >= 50) {
back_hex = '000000';
var sim_b = 0.1 * hsb.b;
}
else {
back_hex = 'FFFFFF';
var sim_b = 100 - 0.1 * (100 - hsb.b);
}
var sim_b = 0.1 * hsb.b;
var sim_rgb = utilsModule.hsl2rgb(hsb.h, hsb.s, sim_b);
var sim_hex = utilsModule.RGBtoHex(sim_rgb.r, sim_rgb.g, sim_rgb.b);
userModule.setPref('background-selection', hex);
userModule.setPref('background-selection-disabled', sim_hex);
userModule.setPref('fontcolor-selection', back_hex);
$('style[title=color_selection]').empty();
var datas = '.diapo.selected,#reorder_box .diapo.selected, #EDIT_ALL .diapo.selected, .list.selected, .list.selected .diapo' +
'{' +
' COLOR: #' + back_hex + ';' +
' BACKGROUND-COLOR: #' + hex + ';' +
'}';
$('style[title=color_selection]').empty().text(datas);
}
});
$('#backcolorpickerHolder').find('.colorpicker_submit').append($('#backcolorpickerHolder .submiter')).bind('click', function () {
$(this).highlight('#CCCCCC');
});
$('#search_submit').on('mousedown', function (event) { $('#search_submit').on('mousedown', function (event) {
return false; return false;
@@ -206,97 +111,9 @@ var prodModule = (function (p4, humane) {
_triggerShortcuts(); _triggerShortcuts();
}); });
$('#idFrameC').resizable({
handles: 'e',
resize: function () {
answerSizer();
linearizeUi();
},
stop: function () {
var el = $('.SSTT.active').next().find('div:first');
var w = el.find('div.chim-wrapper:first').outerWidth();
var iw = el.innerWidth();
var diff = $('#idFrameC').width() - el.outerWidth();
var n = Math.floor(iw / w);
$('#idFrameC').height('auto');
var nwidth = (n) * w + diff + n;
if (isNaN(nwidth)) {
_saveWindows();
return;
}
if (nwidth < 265)
nwidth = 265;
if (el.find('div.chim-wrapper:first').hasClass('valid') && nwidth < 410)
nwidth = 410;
$('#idFrameC').stop().animate({
width: nwidth
},
300,
'linear',
function () {
answerSizer();
linearizeUi();
_saveWindows();
});
}
});
$('#idFrameC .ui-tabs-nav li').on('click', function (event) {
if($('#idFrameC').attr('data-status') == 'closed'){
$('#idFrameC').width(300);
$('#rightFrame').css('left', 300);
$('#rightFrame').width($(window).width()-300);
$('#baskets, #proposals, #thesaurus_tab').hide();
$('.ui-resizable-handle, #basket_menu_trigger').show();
var IDname = $(this).attr('aria-controls');
$('#'+IDname).show();
}
$('#idFrameC').attr('data-status', 'open');
$('.WZbasketTab').css('background-position', '9px 21px');
$('#idFrameC').removeClass('closed');
});
var previousTab = "";
$('#idFrameC #retractableButton').bind('click', function (event) {
if($('#idFrameC').attr('data-status') != 'closed'){
$(this).find('i').removeClass('icon-double-angle-left').addClass('icon-double-angle-right')
$('#idFrameC').width(80);
$('#rightFrame').css('left', 80);
$('#rightFrame').width($(window).width()-80);
$('#idFrameC').attr('data-status', 'closed');
$('#baskets, #proposals, #thesaurus_tab, .ui-resizable-handle, #basket_menu_trigger').hide();
$('#idFrameC .ui-tabs-nav li').removeClass('ui-state-active');
$('.WZbasketTab').css('background-position', '15px 16px');
$('#idFrameC').addClass('closed');
previousTab = $('#idFrameC .icon-menu').find('li.ui-tabs-active');
}else{
$(this).find('i').removeClass('icon-double-angle-right').addClass('icon-double-angle-left')
$('#idFrameC').width(300);
$('#rightFrame').css('left', 300);
$('#rightFrame').width($(window).width()-300);
$('#idFrameC').attr('data-status', 'open');
$('.ui-resizable-handle, #basket_menu_trigger').show();
$('.WZbasketTab').css('background-position', '9px 16px');
$('#idFrameC').removeClass('closed');
$('#idFrameC .icon-menu li').last().find('a').trigger('click');
$('#idFrameC .icon-menu li').first().find('a').trigger('click');
$(previousTab).find('a').trigger('click');
}
event.stopImmediatePropagation();
//p4.WorkZone.close();
return false;
});
$('#look_box .tabs').tabs();
_resizeAll(); _resizeAll();
@@ -307,17 +124,6 @@ var prodModule = (function (p4, humane) {
$('body').append('<iframe id="idHFrameZ" src="about:blank" style="display:none;" name="HFrameZ"></iframe>'); $('body').append('<iframe id="idHFrameZ" src="about:blank" style="display:none;" name="HFrameZ"></iframe>');
$('#basket_menu_trigger').contextMenu('#basket_menu', {
openEvt: 'click',
dropDown: true,
theme: 'vista',
showTransition: 'slideDown',
hideTransition: 'hide',
shadow: false
});
$('#basket_menu_trigger').trigger("click");
$('#basket_menu_trigger').trigger("click");
$('.datepicker').datepicker({ $('.datepicker').datepicker({
changeYear: true, changeYear: true,
@@ -362,8 +168,6 @@ var prodModule = (function (p4, humane) {
_initAnswerForm(); _initAnswerForm();
preferencesModule.initLook();
// setTimeout("pollNotifications();", 10000); // setTimeout("pollNotifications();", 10000);
$(this).bind('keydown', function (event) { $(this).bind('keydown', function (event) {
@@ -574,33 +378,9 @@ var prodModule = (function (p4, humane) {
$(this).removeClass('focused'); $(this).removeClass('focused');
}); });
$('.basketTips').tooltip({
delay: 200
});
$('#idFrameC .tabs').tabs({
activate: function (event, ui) {
if (ui.newTab.context.hash == "#thesaurus_tab") {
thesau_show();
}
p4.WorkZone.open();
}
});
$('#PREVIEWBOX .gui_vsplitter', p4.edit.editBox).draggable({
axis: 'x',
containment: 'parent',
drag: function (event, ui) {
var x = $(ui.position.left)[0];
if (x < 330 || x > (bodySize.x - 400)) {
return false;
}
var v = $(ui.position.left)[0];
$("#PREVIEWLEFT").width(v);
$("#PREVIEWRIGHT").css("left", $(ui.position.left)[0]);
recordPreviewModule.resizePreview();
}
});
$('input.input_select_copy').on('focus', function () { $('input.input_select_copy').on('focus', function () {
$(this).select(); $(this).select();
@@ -688,14 +468,14 @@ var prodModule = (function (p4, humane) {
} }
function doSpecialSearch(qry, allbase) { /*function doSpecialSearch(qry, allbase) {
if (allbase) { if (allbase) {
searchModule.toggleDatabase(true); searchModule.toggleDatabase(true);
} }
workzoneFacetsModule.resetSelectedFacets(); workzoneFacetsModule.resetSelectedFacets();
$('#EDIT_query').val(decodeURIComponent(qry).replace(/\+/g, " ")); $('#EDIT_query').val(decodeURIComponent(qry).replace(/\+/g, " "));
searchModule.newSearch(qry); searchModule.newSearch(qry);
} }*/
function addToBasket(sbas_id, record_id, event, singleSelection) { function addToBasket(sbas_id, record_id, event, singleSelection) {
var singleSelection = singleSelection || false; var singleSelection = singleSelection || false;

View File

@@ -19,13 +19,13 @@
<script type="text/javascript" src="/assets/vendors/modernizr/modernizr{% if not app.debug %}.min{% endif %}.js"></script> <script type="text/javascript" src="/assets/vendors/modernizr/modernizr{% if not app.debug %}.min{% endif %}.js"></script>
{% if app.debug %} {% if app.debug %}
<script type="text/javascript" src="/assets/vendors/better/better.js"></script> {#<script type="text/javascript" src="/assets/vendors/better/better.js"></script>
<script> <script>
// instanciate the object // instanciate the object
var globalDetector = new Better.GlobalDetector(); var globalDetector = new Better.GlobalDetector();
// start monitoring globals // start monitoring globals
globalDetector.start(); globalDetector.start();
</script> </script>#}
{% endif %} {% endif %}
<script type="text/javascript" src="/assets/vendors/jquery/jquery{% if not app.debug %}.min{% endif %}.js"></script> <script type="text/javascript" src="/assets/vendors/jquery/jquery{% if not app.debug %}.min{% endif %}.js"></script>
{#<script src="//code.jquery.com/jquery-migrate-1.2.1.js"></script>#} {#<script src="//code.jquery.com/jquery-migrate-1.2.1.js"></script>#}

View File

@@ -402,11 +402,14 @@ $(document).ready(function(){
}); });
//thumbExtractor //thumbExtractor
var ThumbEditor = new ProductionApplication.VideoEditor("thumb_video", "thumb_canvas", {
var ThumbEditor = new videoEditorModule.ThumbnailEditor("thumb_video", "thumb_canvas", {
altCanvas: $('#alt_canvas_container .alt_canvas') altCanvas: $('#alt_canvas_container .alt_canvas')
}); });
/*var ThumbEditor = new videoEditorModule.ThumbnailEditor("thumb_video", "thumb_canvas", {
altCanvas: $('#alt_canvas_container .alt_canvas')
});*/
if(ThumbEditor.isSupported()) { if(ThumbEditor.isSupported()) {
var $sliderWrapper = $("#thumb_wrapper", $scope); var $sliderWrapper = $("#thumb_wrapper", $scope);

View File

@@ -393,7 +393,7 @@
<div id="idFrameT" class="PNB ui-corner-top"> <div id="idFrameT" class="PNB ui-corner-top">
<div class="tools PNB10 btn-toolbar"> <div class="tools PNB10 btn-toolbar">
{% include "prod/toolbar.html.twig" with {acl: app.getAclForUser(app.getAuthenticatedUser())} %} {% include "prod/toolbar.html.twig" with {acl: app.getAclForUser(app.getAuthenticatedUser())} %}
<a href="#" id="settings" onclick="preferencesModule.lookBox(this,event);return false;">{{ 'Preferences' | trans }} </a> <a href="#" id="settings" class="open-preferences" data-action="">{{ 'Preferences' | trans }} </a>
</div> </div>
<div id="answers" class=" PNB10"></div> <div id="answers" class=" PNB10"></div>
<div id="answers_status"> <div id="answers_status">
@@ -403,22 +403,6 @@
</span> </span>
</div> </div>
</div> </div>
<!--div id="answers_status" class="PNB">
<table>
<tr>
<td class="infos">
<a href="#" onclick="preferencesModule.lookBox(this,event);return false;">{{ 'Preferences' | trans }} </a>
|
<span id="tool_results">
</span>
</td>
<td class="navigation">
<div id="tool_navigate"></div>
</td>
</tr>
</table>
</div-->
</div> </div>
</div> </div>
</div> </div>
@@ -611,7 +595,7 @@
<h1>{{ 'Affichage au demarrage' | trans }}</h1> <h1>{{ 'Affichage au demarrage' | trans }}</h1>
<form class="form-inline"> <form class="form-inline">
{% set start_page_pref = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') %} {% set start_page_pref = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') %}
<select class="span4" name="start_page" onchange="preferencesModule.setInitialStateOptions();"> <select class="span4 preferences-options-start-page" name="start_page">
<option value="LAST_QUERY" {% if start_page_pref == 'LAST_QUERY' %}selected="selected"{% endif %} > <option value="LAST_QUERY" {% if start_page_pref == 'LAST_QUERY' %}selected="selected"{% endif %} >
{{ 'Ma derniere question' | trans }} {{ 'Ma derniere question' | trans }}
</option> </option>
@@ -626,7 +610,7 @@
</option> </option>
</select> </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="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="preferencesModule.setInitialState();" /> <input type="button" class="btn btn-inverse preferences-options-submit" value="{{'boutton::valider' | trans }}" />
</form> </form>
</div> </div>
</div> </div>
@@ -752,7 +736,7 @@
{% set initialAppState = 'publication' %} {% set initialAppState = 'publication' %}
{% endif %} {% endif %}
ProductionApplication.bootstrap({ var prodApp = ProductionApplication.bootstrap({
lang: "{{ app.locale }}", lang: "{{ app.locale }}",
baseUrl: '{{ app['request'].getUriForPath('/') }}', baseUrl: '{{ app['request'].getUriForPath('/') }}',
basePath: '{{ app.request.basePath|e('js') }}', basePath: '{{ app.request.basePath|e('js') }}',
@@ -763,6 +747,7 @@
}, },
initialState: "{{ initialAppState }}" initialState: "{{ initialAppState }}"
}) })
prodApp.appEvents.emit('search.doSpecialSearch', {'special': true});
$(document).ready(function(){ $(document).ready(function(){
workzoneModule.setRemoveWarning("{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), "warning_on_delete_story") %}true{% else %}false{% endif %}"); workzoneModule.setRemoveWarning("{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), "warning_on_delete_story") %}true{% else %}false{% endif %}");