diff --git a/resources/gulp/components/common.js b/resources/gulp/components/common.js index 14985278db..b4c28a2d46 100644 --- a/resources/gulp/components/common.js +++ b/resources/gulp/components/common.js @@ -26,6 +26,7 @@ gulp.task('build-common-css', ['build-common-font-css'],function(){ gulp.task('build-common-js', function(){ var commonGroup = [ + config.paths.src + 'common/js/components/utils.js', config.paths.src + 'common/js/components/user.js', // config.paths.dist + 'assets/bootstrap/js/bootstrap.js', // should append no conflict config.paths.src + 'vendors/jquery-mousewheel/js/jquery.mousewheel.js', diff --git a/resources/gulp/components/prod.js b/resources/gulp/components/prod.js index d436fea27d..16db8ef6b8 100644 --- a/resources/gulp/components/prod.js +++ b/resources/gulp/components/prod.js @@ -84,7 +84,6 @@ gulp.task('build-prod-js', function(){ 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-thesaurus.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', diff --git a/resources/www/common/js/components/dialog.js b/resources/www/common/js/components/dialog.js index 05efb06e69..75e23e5369 100644 --- a/resources/www/common/js/components/dialog.js +++ b/resources/www/common/js/components/dialog.js @@ -1,8 +1,23 @@ ; var dialogModule = (function ($) { - + var $body = null; + var bodySize = {}; var _dialog = {}; + $('document').ready(function(){ + $body = $('body'); + + $(window).on('resize', function () { + bodySize.y = $body.height(); + bodySize.x = $body.width(); + + //@TODO modal resize should be in a stream + $('.overlay').height(bodySize.y).width(bodySize.x); + //_resizeAll(); + }); + }); + + function getLevel(level) { level = parseInt(level); @@ -79,6 +94,10 @@ var dialogModule = (function ($) { height = dimension[1]; width = dimension[0]; } else { + + bodySize.y = $body.height(); + bodySize.x = $body.width(); + switch (this.options.size) { case 'Full': height = bodySize.y - 30; diff --git a/resources/www/prod/js/components/utils.js b/resources/www/common/js/components/utils.js similarity index 100% rename from resources/www/prod/js/components/utils.js rename to resources/www/common/js/components/utils.js diff --git a/resources/www/lightbox/js/jquery.lightbox.js b/resources/www/lightbox/js/jquery.lightbox.js index cf2de62217..7ae5c766df 100644 --- a/resources/www/lightbox/js/jquery.lightbox.js +++ b/resources/www/lightbox/js/jquery.lightbox.js @@ -1,980 +1,963 @@ -var p4 = p4 || {}; +var lightboxModule = (function($){ + var _releasable = false; + var _bodySize = { + x: 0, + y: 0 + }; + $(document).ready(function () { -p4.releasable = false; + _bodySize.y = $('#mainContainer').height(); + _bodySize.x = $('#mainContainer').width(); -var bodySize = { - x: 0, - y: 0 -}; + $(this).data('slideshow', false); + $(this).data('slideshow_ctime', false); -$(document).ready(function () { - - bodySize.y = $('#mainContainer').height(); - bodySize.x = $('#mainContainer').width(); - - $(this).data('slideshow', false); - $(this).data('slideshow_ctime', false); - - $('#mainMenu, .unselectable').disableSelection(); - - display_basket(); - - $(window).bind('mousedown',function () { - $(this).focus(); - }).trigger('mousedown'); - - $('.basket_wrapper').hover( - function () { - $(this).addClass('hover'); - }, - function () { - $(this).removeClass('hover'); - } - ).bind('click', function () { - var id = $('input[name=ssel_id]', this).val(); - document.location = '/lightbox/validate/' + id + '/'; - return; + $(window).bind('beforeunload', function () { + if (_releasable !== false) { + if (confirm(_releasable)) { + $('#basket_options .confirm_report').trigger('click'); + } + } }); - $('.basket_downloader').bind('click', function () { - download_basket(); + + + $('#mainMenu, .unselectable').disableSelection(); + + _display_basket(); + + $(window).bind('mousedown',function () { + $(this).focus(); + }).trigger('mousedown'); + + $('.basket_wrapper').hover( + function () { + $(this).addClass('hover'); + }, + function () { + $(this).removeClass('hover'); + } + ).bind('click', function () { + var id = $('input[name=ssel_id]', this).val(); + document.location = '/lightbox/validate/' + id + '/'; + return; + }); + $('.basket_downloader').bind('click', function () { + _downloadBasket(); + }); + if ($('.right_column_wrapper_user').length > 0) { + $('.right_column_title, #right_column_validation_toggle').bind('click',function () { + if (!$('.right_column_wrapper_caption').is(':visible')) { + $('.right_column_wrapper_user').height($('.right_column_wrapper_user').height()).css('top', 'auto').animate({ + 'height': 0 + }); + $('.right_column_wrapper_caption').slideDown(); + $('#right_column_validation_toggle').show(); + } + else { + $('.right_column_wrapper_user').height('auto').animate({ + 'top': $('.right_column_title').height() + }); + $('.right_column_wrapper_caption').slideUp(); + $('#right_column_validation_toggle').hide(); + } + var title = $('.right_column_title'); + title.hasClass('expanded') ? title.removeClass('expanded') : title.addClass('expanded'); + }).addClass('clickable'); + } + var sselcont = $('#sc_container .basket_element:first'); + if (sselcont.length > 0) { + _display_basket_element(false, sselcont.attr('id').split('_').pop()); + } + + + _setSizeable($('#record_main .lightbox_container, #record_compare .lightbox_container')); + + $('#navigation') + .bind('change', + function () { + window.location.replace(window.location.protocol + "//" + window.location.host + '/lightbox/validate/' + $(this).val() + '/'); + } + ); + + $('#left_scroller') + .bind('click', + function () { + _scrollElements(false); + } + ); + + $('#right_scroller') + .bind('click', function () { + _scrollElements(true); + } + ); + + $(window) + .bind('resize', function () { + _resizeLightbox(); + } + ); + _bind_keyboard(); }); - if ($('.right_column_wrapper_user').length > 0) { - $('.right_column_title, #right_column_validation_toggle').bind('click',function () { - if (!$('.right_column_wrapper_caption').is(':visible')) { - $('.right_column_wrapper_user').height($('.right_column_wrapper_user').height()).css('top', 'auto').animate({ - 'height': 0 - }); - $('.right_column_wrapper_caption').slideDown(); - $('#right_column_validation_toggle').show(); - } - else { - $('.right_column_wrapper_user').height('auto').animate({ - 'top': $('.right_column_title').height() - }); - $('.right_column_wrapper_caption').slideUp(); - $('#right_column_validation_toggle').hide(); - } - var title = $('.right_column_title'); - title.hasClass('expanded') ? title.removeClass('expanded') : title.addClass('expanded'); + + function _resizeLightbox() { + _bodySize.y = $('#mainContainer').height(); + _bodySize.x = $('#mainContainer').width(); + _displayRecord($('#record_compare').css('visibility') != 'hidden'); + } + + function _display_basket() { + var sc_wrapper = $('#sc_wrapper'); + var basket_options = $('#basket_options'); + + $('.report').on('click',function () { + _loadReport(); + return false; }).addClass('clickable'); - } - var sselcont = $('#sc_container .basket_element:first'); - if (sselcont.length > 0) { - display_basket_element(false, sselcont.attr('id').split('_').pop()); + // $('#basket_infos .report').button({ + // icons: { + // primary: 'ui-icon-document' + // } + // }).bind('click',function(){ + // $(this).blur(); + // }); + $('.confirm_report', basket_options).button() + .bind('click', function () { + _setRelease($(this)); + }); + + $('.basket_element', sc_wrapper).parent() + .bind('click', function (event) { + _scid_click(event, this); + return false; + }); + + $('.agree_button, .disagree_button', sc_wrapper).bind('click',function (event) { + + var sselcont_id = $(this).closest('.basket_element').attr('id').split('_').pop(); + + var agreement = $(this).hasClass('agree_button') ? '1' : '-1'; + + _setAgreement(event, $(this), sselcont_id, agreement); + return false; + }).addClass('clickable'); + + n = $('.basket_element', sc_wrapper).length; + $('#sc_container').width(n * $('.basket_element_wrapper:first', sc_wrapper).outerWidth() + 1); + + $('.previewTips').tooltip(); } - set_sizeable($('#record_main .lightbox_container, #record_compare .lightbox_container')); - - $('#navigation') - .bind('change', - function () { - window.location.replace(window.location.protocol + "//" + window.location.host + '/lightbox/validate/' + $(this).val() + '/'); - } - ); - - $('#left_scroller') - .bind('click', - function () { - scroll_elements(false); - } - ); - - $('#right_scroller') - .bind('click', function () { - scroll_elements(true); - } - ); - - $(window) - .bind('resize', function () { - resize(); - } - ); - bind_keyboard(); -}); - -$(window).bind('beforeunload', function () { - if (p4.releasable !== false) { - if (confirm(p4.releasable)) { - $('#basket_options .confirm_report').trigger('click'); - } + function setReleasable(val) { + _releasable = val; } -}); -function bind_keyboard() { - $(document).bind('keydown', function (event) { + function _bind_keyboard() { + $(document).bind('keydown', function (event) { - var stop = false; - $('.notes_wrapper').each(function (i, n) { - if (parseInt($(n).css('top')) >= 0) - stop = true; - }); + var stop = false; + $('.notes_wrapper').each(function (i, n) { + if (parseInt($(n).css('top')) >= 0) + stop = true; + }); - if (stop) + if (stop) + return true; + + var cancelKey = false; + var el, id; + switch (event.keyCode) { + case 39: + _getNext(); + cancelKey = true; + break; + case 37: + _getPrev(); + cancelKey = true; + break; + case 32: + var bool = !$(document).data('slideshow'); + _slideshow(bool); + break; + case 38: + el = $('#sc_container .basket_element.selected'); + if (el.length === 1) { + id = el.attr('id').split('_').pop(); + _setAgreement(event, el, id, 1); + } + break; + case 40: + el = $('#sc_container .basket_element.selected'); + if (el.length === 1) { + id = el.attr('id').split('_').pop(); + _setAgreement(event, el, id, -1); + } + break; + default: + break; + } + + if (cancelKey) { + event.cancelBubble = true; + if (event.stopPropagation) + event.stopPropagation(); + return(false); + } return true; - - var cancelKey = false; - var el, id; - switch (event.keyCode) { - case 39: - get_next(); - cancelKey = true; - break; - case 37: - get_prev(); - cancelKey = true; - break; - case 32: - var bool = !$(document).data('slideshow'); - slideshow(bool); - break; - case 38: - el = $('#sc_container .basket_element.selected'); - if (el.length === 1) { - id = el.attr('id').split('_').pop(); - set_agreement(event, el, id, 1); - } - break; - case 40: - el = $('#sc_container .basket_element.selected'); - if (el.length === 1) { - id = el.attr('id').split('_').pop(); - set_agreement(event, el, id, -1); - } - break; - default: - break; - } - - if (cancelKey) { - event.cancelBubble = true; - if (event.stopPropagation) - event.stopPropagation(); - return(false); - } - return true; - }); -} - -function is_ctrl_key(event) { - if (event.altKey) - return true; - if (event.ctrlKey) - return true; - if (event.metaKey) // apple key opera - return true; - if (event.keyCode == '17') // apple key opera - return true; - if (event.keyCode == '224') // apple key mozilla - return true; - if (event.keyCode == '91') // apple key safari - return true; - - return false; -} - -function is_shift_key(event) { - if (event.shiftKey) - return true; - return false; -} - -function resize() { - bodySize.y = $('#mainContainer').height(); - bodySize.x = $('#mainContainer').width(); - display_record($('#record_compare').css('visibility') != 'hidden'); -} - -function set_release(el) { - $('.loader', el).css({ - visibility: 'visible' - }); - $.ajax({ - type: "POST", - url: "/lightbox/ajax/SET_RELEASE/" + $('#navigation').val() + "/", - dataType: 'json', - error: function (data) { - $('.loader', el).css({ - visibility: 'hidden' - }); - }, - timeout: function (data) { - $('.loader', el).css({ - visibility: 'hidden' - }); - }, - success: function (data) { - $('.loader', el).css({ - visibility: 'hidden' - }); - if (data.datas) { - alert(data.datas); - } - if (!data.error) { - p4.releasable = false; - } - - return; - } - }); -} - -function load_report() { - $.ajax({ - type: "GET", - url: "/lightbox/ajax/LOAD_REPORT/" + $('#navigation').val() + "/", - dataType: 'html', - success: function (data) { - $('#report').empty().append(data); - $('#report .reportTips').tooltip({ - delay: false - }); - $('#report').dialog({ - width: 600, - modal: true, - resizable: false, - height: Math.round($(window).height() * 0.8) - }); - - return; - } - }); -} - -function display_basket() { - var sc_wrapper = $('#sc_wrapper'); - var basket_options = $('#basket_options'); - - $('.report').on('click',function () { - load_report(); - return false; - }).addClass('clickable'); - // $('#basket_infos .report').button({ - // icons: { - // primary: 'ui-icon-document' - // } - // }).bind('click',function(){ - // $(this).blur(); - // }); - $('.confirm_report', basket_options).button() - .bind('click', function () { - set_release($(this)); }); + } - $('.basket_element', sc_wrapper).parent() - .bind('click', function (event) { - scid_click(event, this); - return false; + function _loadReport() { + $.ajax({ + type: "GET", + url: "/lightbox/ajax/LOAD_REPORT/" + $('#navigation').val() + "/", + dataType: 'html', + success: function (data) { + $('#report').empty().append(data); + $('#report .reportTips').tooltip({ + delay: false + }); + $('#report').dialog({ + width: 600, + modal: true, + resizable: false, + height: Math.round($(window).height() * 0.8) + }); + + return; + } }); - - $('.agree_button, .disagree_button', sc_wrapper).bind('click',function (event) { - - var sselcont_id = $(this).closest('.basket_element').attr('id').split('_').pop(); - - var agreement = $(this).hasClass('agree_button') ? '1' : '-1'; - - set_agreement(event, $(this), sselcont_id, agreement); - return false; - }).addClass('clickable'); - - n = $('.basket_element', sc_wrapper).length; - $('#sc_container').width(n * $('.basket_element_wrapper:first', sc_wrapper).outerWidth() + 1); - - $('.previewTips').tooltip(); -} - - -function scid_click(event, el) { - var compare = is_ctrl_key(event); - - if (compare) { - if ($('.basket_element', el).hasClass('selected')) - return; - } - else { - $('#sc_container .basket_element.selected').removeClass('selected'); - $('.basket_element', el).addClass('selected'); } - var sselcont_id = $('.basket_element', el).attr('id').split('_').pop(); - var ssel_id = $('#navigation').val(); - var container = $('#sc_container'); + function _scid_click(event, el) { + var compare = utilsModule.is_ctrl_key(event); - var request = container.data('request'); - if (request && typeof(request.abort) == 'function') { - request.abort(); - } - - request = $.ajax({ - type: "GET", - url: $(el).attr('href'),//"/lightbox/ajax/LOAD_BASKET_ELEMENT/"+sselcont_id+'/', - dataType: 'json', - success: function (datas) { - var container = false; - var data = datas; - - if (compare) { - container = $('#record_compare'); - } - else { - container = $('#record_main'); - - $('#record_infos .lightbox_container') - .empty() - .append(data.caption); - - $('#basket_infos') - .empty() - .append(data.agreement_html); - } - - $('.display_id', container) - .empty() - .append(data.number); - - $('.title', container) - .empty() - .append(data.title) - .attr('title', data.title); - - var options_container = $('.options', container); - options_container - .empty() - .append(data.options_html); - - $('.lightbox_container', container).empty() - .append(data.preview + data.selector_html + data.note_html); - - - display_basket_element(compare, sselcont_id); - - - return; - } - }); - container.data('request', request); -} - -function save_note(container, button) { - var sselcont_id = $(button).attr('id').split('_').pop(); - var note = $('.notes_wrapper textarea', container).val(); - - $.ajax({ - type: "POST", - url: "/lightbox/ajax/SET_NOTE/" + sselcont_id + "/", - dataType: 'json', - data: { - note: note - }, - success: function (datas) { - hide_notes(container); - $('.notes_wrapper', container).remove(); - $('.lightbox_container', container).append(datas.datas); - activate_notes(container); - return; - } - }); - -} - -function display_basket_element(compare, sselcont_id) { - var container; - if (compare) { - container = $('#record_compare'); - } - else { - container = $('#record_main'); - } - $('.record_image', container).removeAttr('ondragstart'); - $('.record_image', container).draggable(); - - var options_container = $('.options', container); - - $('.download_button', options_container).bind('click', function () { - // $(this).blur(); - download($(this).next('form[name=download_form]').find('input').val()); - }); - - $('.comment_button', options_container).bind('click', function () { - // $(this).blur(); - if ($('.lightbox_container', container).hasClass('note_editing')) { - hide_notes(container); - } - else { - show_notes(container); - } - } - ); - - activate_notes(container); - - $('.previous_button', options_container).bind('click', function () { - // $(this).blur(); - get_prev(); - }); - - $('.play_button', options_container).bind('click', function () { - // $(this).blur(); - slideshow(true); - }); - - $('.pause_button', options_container).bind('click', function () { - // $(this).blur(); - slideshow(false); - }); - - if ($(document).data('slideshow')) { - $('.play_button, .next_button.play, .previous_button.play', options_container).hide(); - } - else { - $('.pause_button, .next_button.pause, .previous_button.pause', options_container).hide(); - } - - $('.next_button', options_container).bind('click', function () { - // $(this).blur(); - slideshow(false); - get_next(); - }); - - - $('.lightbox_container', container).bind('dblclick', function (event) { - display_record(); - }); - - - $('#record_wrapper .agree_' + sselcont_id + ', .big_box.agree') - .bind('click', - function (event) { - set_agreement(event, $(this), sselcont_id, '1'); - } - ) - .addClass('clickable'); - - $('#record_wrapper .disagree_' + sselcont_id + ', .big_box.disagree') - .bind('click', - function (event) { - set_agreement(event, $(this), sselcont_id, '-1'); - } - ) - .addClass('clickable'); - - if (compare == $('#record_wrapper').hasClass('single')) { if (compare) { - // $('.agreement_selector').show(); - // $('#record_wrapper').stop().animate({right:0},100,function(){display_record(compare);}); - $('#record_wrapper').css({ - right: 0 - }); - display_record(compare); - $('#right_column').hide(); + if ($('.basket_element', el).hasClass('selected')) + return; } else { - // $('.agreement_selector').hide(); - $('#record_wrapper').css({ - right: 250 - }); - display_record(compare); - $('#right_column').show(); - $('#record_compare .lightbox_container').empty(); + $('#sc_container .basket_element.selected').removeClass('selected'); + $('.basket_element', el).addClass('selected'); } - } - else { - display_record(compare); - } + var sselcont_id = $('.basket_element', el).attr('id').split('_').pop(); + var ssel_id = $('#navigation').val(); -} + var container = $('#sc_container'); -function show_notes(container) { - $('.notes_wrapper', container).animate({ - top: 0 - }); - $('.lightbox_container', container).addClass('note_editing'); -} - -function hide_notes(container) { - $('.notes_wrapper', container).animate({ - top: '-100%' - }); - $('.lightbox_container', container).removeClass('note_editing'); -} - -function activate_notes(container) { - $('.note_closer', container).button({ - text: true - }).bind('click', function () { - $(this).blur(); - hide_notes(container); - return false; + var request = container.data('request'); + if (request && typeof(request.abort) == 'function') { + request.abort(); } - ); - $('.note_saver', container).button({ - text: true - }).bind('click', function () { - $(this).blur(); - save_note(container, this); - return false; - } - ); -} + request = $.ajax({ + type: "GET", + url: $(el).attr('href'),//"/lightbox/ajax/LOAD_BASKET_ELEMENT/"+sselcont_id+'/', + dataType: 'json', + success: function (datas) { + var container = false; + var data = datas; -function is_viewable(el) { - var sc_wrapper = $('#sc_wrapper'); - var sc_container = $('#sc_container'); + if (compare) { + container = $('#record_compare'); + } + else { + container = $('#record_main'); - var el_width = $(el).parent().outerWidth(); - var el_position = $(el).parent().position(); - var sc_scroll_left = sc_wrapper.scrollLeft(); + $('#record_infos .lightbox_container') + .empty() + .append(data.caption); - var boundup = sc_wrapper.width(), - bounddown = 0, - placeup = el_position.left + el_width - sc_scroll_left, - placedown = el_position.left - sc_scroll_left; + $('#basket_infos') + .empty() + .append(data.agreement_html); + } - if (placeup <= boundup && placedown >= bounddown) - return true; - return false; -} + $('.display_id', container) + .empty() + .append(data.number); -function adjust_visibility(el) { - if (is_viewable(el)) - return; + $('.title', container) + .empty() + .append(data.title) + .attr('title', data.title); - var sc_wrapper = $('#sc_wrapper'); - var el_parent = $(el).parent(); + var options_container = $('.options', container); + options_container + .empty() + .append(data.options_html); - var sc_left = el_parent.position().left + el_parent.outerWidth() / 2 - sc_wrapper.width() / 2; + $('.lightbox_container', container).empty() + .append(data.preview + data.selector_html + data.note_html); - sc_wrapper.stop().animate({ - 'scrollLeft': sc_left - }); -} -function get_next() { - var current_wrapper = $('#sc_container .basket_element.selected').parent().parent(); + _display_basket_element(compare, sselcont_id); - if (current_wrapper.length === 0) - return; - current_wrapper = current_wrapper.next(); - if (current_wrapper.length === 0) - current_wrapper = $('#sc_container .basket_element_wrapper:first'); - - $('.basket_element', current_wrapper).parent().trigger('click'); - - adjust_visibility($('.basket_element', current_wrapper)); - - if ($(document).data('slideshow')) { - var timer = setTimeout('get_next();', 3500); - $(document).data('slideshow_ctime', timer); - } -} - -function get_prev() { - var current_wrapper = $('#sc_container .basket_element.selected').parent().parent(); - - if (current_wrapper.length === 0) - return; - - slideshow(false); - - current_wrapper = current_wrapper.prev(); - if (current_wrapper.length === 0) - current_wrapper = $('#sc_container .basket_element_wrapper:last'); - - $('.basket_element', current_wrapper).parent().trigger('click'); - - adjust_visibility($('.basket_element', current_wrapper)); -} - -function slideshow(boolean_value) { - if (boolean_value == $(document).data('slideshow')) - return; - - if (!boolean_value && $(document).data('slideshow_ctime')) { - clearTimeout($(document).data('slideshow_ctime')); - $(document).data('slideshow_ctime', false); - } - - $(document).data('slideshow', boolean_value); - - var headers = $('#record_wrapper .header'); - - if (boolean_value) { - $('.play_button, .next_button.play, .previous_button.play', headers).hide(); - $('.pause_button, .next_button.pause, .previous_button.pause', headers).show(); - get_next(); - } - else { - $('.pause_button, .next_button.pause, .previous_button.pause', headers).hide(); - $('.play_button, .next_button.play, .previous_button.play', headers).show(); - } -} - -function set_sizeable(container) { - - $(container).bind('mousewheel', function (event, delta) { - - if ($(this).hasClass('note_editing')) - return; - - var record = $('.record_image', this); - - if (record.length === 0) - return; - - var o_top = parseInt(record.css('top')); - var o_left = parseInt(record.css('left')); - - var o_width, o_height, width, height; - - if (delta > 0) { - if (record.width() > 29788 || record.height() >= 29788) return; - o_width = record.width(); - o_height = record.height(); - width = Math.round(o_width * 1.1); - height = Math.round(o_height * 1.1); - } - else { - if (record.width() < 30 || record.height() < 30) - return; - o_width = record.width(); - o_height = record.height(); - width = Math.round(o_width / 1.05); - height = Math.round(o_height / 1.05); - } - - var top = Math.round((height / o_height) * (o_top - $(this).height() / 2) + $(this).height() / 2); - var left = Math.round((width / o_width) * (o_left - $(this).width() / 2) + $(this).width() / 2); - - record.width(width).height(height).css({ - top: top, - left: left + } }); - }); + container.data('request', request); + } -} + function _display_basket_element(compare, sselcont_id) { + var container; + if (compare) { + container = $('#record_compare'); + } + else { + container = $('#record_main'); + } + $('.record_image', container).removeAttr('ondragstart'); + $('.record_image', container).draggable(); -function set_agreement(event, el, sselcont_id, boolean_value) { - if (event.stopPropagation) - event.stopPropagation(); - event.cancelBubble = true; + var options_container = $('.options', container); - var id = + $('.download_button', options_container).bind('click', function () { + // $(this).blur(); + _download($(this).next('form[name=download_form]').find('input').val()); + }); + + $('.comment_button', options_container).bind('click', function () { + // $(this).blur(); + if ($('.lightbox_container', container).hasClass('note_editing')) { + _hideNotes(container); + } + else { + _showNotes(container); + } + } + ); + + _activateNotes(container); + + $('.previous_button', options_container).bind('click', function () { + // $(this).blur(); + _getPrev(); + }); + + $('.play_button', options_container).bind('click', function () { + // $(this).blur(); + _slideshow(true); + }); + + $('.pause_button', options_container).bind('click', function () { + // $(this).blur(); + _slideshow(false); + }); + + if ($(document).data('slideshow')) { + $('.play_button, .next_button.play, .previous_button.play', options_container).hide(); + } + else { + $('.pause_button, .next_button.pause, .previous_button.pause', options_container).hide(); + } + + $('.next_button', options_container).bind('click', function () { + // $(this).blur(); + _slideshow(false); + _getNext(); + }); + + + $('.lightbox_container', container).bind('dblclick', function (event) { + _displayRecord(); + }); + + + $('#record_wrapper .agree_' + sselcont_id + ', .big_box.agree') + .bind('click', + function (event) { + _setAgreement(event, $(this), sselcont_id, '1'); + } + ) + .addClass('clickable'); + + $('#record_wrapper .disagree_' + sselcont_id + ', .big_box.disagree') + .bind('click', + function (event) { + _setAgreement(event, $(this), sselcont_id, '-1'); + } + ) + .addClass('clickable'); + + if (compare == $('#record_wrapper').hasClass('single')) { + if (compare) { + // $('.agreement_selector').show(); + // $('#record_wrapper').stop().animate({right:0},100,function(){display_record(compare);}); + $('#record_wrapper').css({ + right: 0 + }); + _displayRecord(compare); + $('#right_column').hide(); + } + else { + // $('.agreement_selector').hide(); + $('#record_wrapper').css({ + right: 250 + }); + _displayRecord(compare); + $('#right_column').show(); + $('#record_compare .lightbox_container').empty(); + } + + } + else { + _displayRecord(compare); + } + + } + + function _getPrev() { + var current_wrapper = $('#sc_container .basket_element.selected').parent().parent(); + + if (current_wrapper.length === 0) + return; + + _slideshow(false); + + current_wrapper = current_wrapper.prev(); + if (current_wrapper.length === 0) + current_wrapper = $('#sc_container .basket_element_wrapper:last'); + + $('.basket_element', current_wrapper).parent().trigger('click'); + + _adjust_visibility($('.basket_element', current_wrapper)); + } + + function _getNext() { + var current_wrapper = $('#sc_container .basket_element.selected').parent().parent(); + + if (current_wrapper.length === 0) + return; + + current_wrapper = current_wrapper.next(); + if (current_wrapper.length === 0) + current_wrapper = $('#sc_container .basket_element_wrapper:first'); + + $('.basket_element', current_wrapper).parent().trigger('click'); + + _adjust_visibility($('.basket_element', current_wrapper)); + + if ($(document).data('slideshow')) { + var timer = setTimeout('get_next();', 3500); + $(document).data('slideshow_ctime', timer); + } + } + + function _slideshow(boolean_value) { + if (boolean_value == $(document).data('slideshow')) + return; + + if (!boolean_value && $(document).data('slideshow_ctime')) { + clearTimeout($(document).data('slideshow_ctime')); + $(document).data('slideshow_ctime', false); + } + + $(document).data('slideshow', boolean_value); + + var headers = $('#record_wrapper .header'); + + if (boolean_value) { + $('.play_button, .next_button.play, .previous_button.play', headers).hide(); + $('.pause_button, .next_button.pause, .previous_button.pause', headers).show(); + _getNext(); + } + else { + $('.pause_button, .next_button.pause, .previous_button.pause', headers).hide(); + $('.play_button, .next_button.play, .previous_button.play', headers).show(); + } + } + + function _adjust_visibility(el) { + if (_isViewable(el)) + return; + + var sc_wrapper = $('#sc_wrapper'); + var el_parent = $(el).parent(); + + var sc_left = el_parent.position().left + el_parent.outerWidth() / 2 - sc_wrapper.width() / 2; + + sc_wrapper.stop().animate({ + 'scrollLeft': sc_left + }); + } + + + function _setAgreement(event, el, sselcont_id, boolean_value) { + if (event.stopPropagation) + event.stopPropagation(); + event.cancelBubble = true; + + var id = + + $.ajax({ + type: "POST", + url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/" + sselcont_id + "/", + dataType: 'json', + data: { + agreement: boolean_value + }, + success: function (datas) { + if (!datas.error) { + if (boolean_value == '1') { + $('.agree_' + sselcont_id + '').removeClass('not_decided'); + $('.disagree_' + sselcont_id + '').addClass('not_decided'); + $('.userchoice.me').addClass('agree').removeClass('disagree'); + } + else { + $('.agree_' + sselcont_id + '').addClass('not_decided'); + $('.disagree_' + sselcont_id + '').removeClass('not_decided'); + $('.userchoice.me').addClass('disagree').removeClass('agree'); + } + _releasable = datas.releasable; + if (datas.releasable !== false) { + if (confirm(datas.releasable)) + $('#basket_options .confirm_report').trigger('click'); + } + } + else { + alert(datas.datas); + } + return; + } + }); + } + + function _displayRecord(compare) { + var main_container = $('#record_wrapper'); + + if (typeof compare == 'undefined') + compare = !main_container.hasClass('single'); + + var main_box = $('#record_main'); + var compare_box = $('#record_compare'); + + var main_record = $('.lightbox_container .record', main_box); + var compare_record = $('.lightbox_container .record', compare_box); + + var main_record_width = parseInt($('input[name=width]', main_box).val()); + var main_record_height = parseInt($('input[name=height]', main_box).val()); + var compare_record_width = parseInt($('input[name=width]', compare_box).val()); + var compare_record_height = parseInt($('input[name=height]', compare_box).val()); + + var main_container_width = main_container.width(); + var main_container_innerwidth = main_container.innerWidth(); + var main_container_height = main_container.height(); + var main_container_innerheight = main_container.innerHeight(); + + if (compare) { + $('.agreement_selector').show(); + main_container.addClass('comparison'); + + var double_portrait_width = main_container_innerwidth / 2; + var double_portrait_height = main_container_innerheight - $('.header', main_box).outerHeight(); + + var double_paysage_width = main_container_innerwidth; + var double_paysage_height = main_container_innerheight / 2 - $('.header', main_box).outerHeight(); + + var main_display_portrait = _calculateDisplay( + double_portrait_width, double_portrait_height, + main_record_width, main_record_height + ); + var main_display_paysage = _calculateDisplay( + double_paysage_width, double_paysage_height, + main_record_width, main_record_height + ); + + var compare_display_portrait = _calculateDisplay( + double_portrait_width, double_portrait_height, + compare_record_width, compare_record_height + ); + var compare_display_paysage = _calculateDisplay( + double_paysage_width, double_paysage_height, + compare_record_width, compare_record_height + ); + + var surface_main_portrait = main_display_portrait.width * main_display_portrait.height; + var surface_main_paysage = main_display_paysage.width * main_display_paysage.height; + var surface_compare_portrait = compare_display_portrait.width * compare_display_portrait.height; + var surface_compare_paysage = compare_display_paysage.width * compare_display_paysage.height; + + var double_portrait_surface = (surface_main_portrait + surface_compare_portrait) / 2; + var double_paysage_surface = (surface_main_paysage + surface_compare_paysage) / 2; + + var smooth_image = false; + + var m_width_image, m_height_image, c_width_image, c_height_image, dim_container; + + if (double_portrait_surface > double_paysage_surface) { + if (!main_container.hasClass('portrait')) { + smooth_image = true; + + _smoothTransform( + main_box, + '50%', + '100%', + function () { + _setContainerStatus('portrait'); + } + ); + + compare_box.css('visibility', 'hidden'); + + _smoothTransform( + compare_box, + '50%', + '100%', + function () { + compare_box.css('display', 'none') + .css('visibility', 'visible') + .fadeIn(); + } + ); + } + m_width_image = main_display_portrait.width; + m_height_image = main_display_portrait.height; + c_width_image = compare_display_portrait.width; + c_height_image = compare_display_portrait.height; + dim_container = { + width: double_portrait_width, + height: double_portrait_height + }; + } + else { + if (!main_container.hasClass('paysage')) { + smooth_image = true; + + _smoothTransform( + main_box, + '100%', + '50%', + function () { + _setContainerStatus('paysage'); + } + ); + + compare_box.css('visibility', 'hidden'); + + _smoothTransform( + compare_box, + '100%', + '50%', + function () { + compare_box.css('display', 'none') + .css('visibility', 'visible') + .fadeIn(); + } + ); + } + m_width_image = main_display_paysage.width; + m_height_image = main_display_paysage.height; + c_width_image = compare_display_paysage.width; + c_height_image = compare_display_paysage.height; + dim_container = { + width: double_paysage_width, + height: double_paysage_height + }; + } + + var image_callback = _setImagePosition(false, compare_record, c_width_image, c_height_image, dim_container, function () { + }); + _setImagePosition(smooth_image, main_record, m_width_image, m_height_image, dim_container, image_callback); + } + else { + $('.agreement_selector').hide(); + main_container.removeClass('comparison'); + + if (compare_box.is(':visible')) { + compare_box.hide().css('visibility', 'hidden').css('display', 'block'); + } + + var main_display = _calculateDisplay( + main_container_innerwidth, (main_container_innerheight - $('.header', main_box).outerHeight()), + main_record_width, main_record_height + ); + + if (!main_container.hasClass('single')) { + main_box.width('100%') + .height('100%'); + + _setContainerStatus('single'); + } + _setImagePosition(smooth_image, main_record, main_display.width, main_display.height, { + width: main_container_width, + height: (main_container_height - $('.header', main_box).outerHeight()) + }); + } + } + + function _calculateDisplay(display_width, display_height, width, height, margin) { + if (typeof margin == 'undefined') + margin = 10; + + var display_ratio = display_width / display_height; + var ratio = width / height; + var w, h; + + if (ratio > display_ratio)//landscape + { + w = display_width - 2 * margin; + if (w > width) + w = width; + h = w / ratio; + } + else { + h = display_height - 2 * margin; + if (h > height) + h = height; + w = ratio * h; + } + + return { + width: w, + height: h + }; + } + + function _downloadBasket() { + var ids = $.map($('#sc_container .download_form').toArray(), function (el, i) { + return $('input[name="basrec"]', $(el)).val(); + }); + _download(ids.join(';')); + } + + function _download(value) { + var dialog = dialogModule.dialog.create({title: typeof(language) !== 'undefined' ? language['export'] : ''}); + + $.post("/prod/export/multi-export/", "lst=" + value, function (data) { + + dialog.setContent(data); + + $('.tabs', dialog.getDomElement()).tabs(); + + $('.close_button', dialog.getDomElement()).bind('click', function () { + dialog.close(); + }); + + return false; + }); + } + + function _setSizeable(container) { + + $(container).bind('mousewheel', function (event, delta) { + + if ($(this).hasClass('note_editing')) + return; + + var record = $('.record_image', this); + + if (record.length === 0) + return; + + var o_top = parseInt(record.css('top')); + var o_left = parseInt(record.css('left')); + + var o_width, o_height, width, height; + + if (delta > 0) { + if (record.width() > 29788 || record.height() >= 29788) + return; + o_width = record.width(); + o_height = record.height(); + width = Math.round(o_width * 1.1); + height = Math.round(o_height * 1.1); + } + else { + if (record.width() < 30 || record.height() < 30) + return; + o_width = record.width(); + o_height = record.height(); + width = Math.round(o_width / 1.05); + height = Math.round(o_height / 1.05); + } + + var top = Math.round((height / o_height) * (o_top - $(this).height() / 2) + $(this).height() / 2); + var left = Math.round((width / o_width) * (o_left - $(this).width() / 2) + $(this).width() / 2); + + record.width(width).height(height).css({ + top: top, + left: left + }); + }); + + } + + function _setImagePosition(smooth, image, width, height, container, callback) { + var dimensions = {}; + + if (typeof container !== 'undefined') { + var c_width = container.width; + var c_height = container.height; + + dimensions.top = parseInt((c_height - height) / 2); + dimensions.left = parseInt((c_width - width) / 2); + } + if (typeof callback == 'undefined') { + callback = function () { + }; + } + + dimensions.width = width; + dimensions.height = height; + + if (smooth) { + $(image).stop().animate(dimensions, 500, callback); + } + else { + $(image).css(dimensions); + callback(); + } + } + + function _scrollElements(boolean_value) { + var sc_wrapper = $('#sc_wrapper'); + var value; + if (boolean_value) + value = sc_wrapper.scrollLeft() + 400; + else + value = sc_wrapper.scrollLeft() - 400; + + sc_wrapper.stop().animate({ + 'scrollLeft': value + }); + return; + } + + function _smoothTransform(box, width, height, callback) { + if (typeof callback == 'undefined') + callback = function () { + }; + + $(box).stop() + .animate( + { + width: width, + height: height + }, + 500, + callback + ); + } + + function _setContainerStatus(status) { + $('#record_wrapper').removeClass('paysage portrait single').addClass(status); + } + + function _isViewable(el) { + var sc_wrapper = $('#sc_wrapper'); + var sc_container = $('#sc_container'); + + var el_width = $(el).parent().outerWidth(); + var el_position = $(el).parent().position(); + var sc_scroll_left = sc_wrapper.scrollLeft(); + + var boundup = sc_wrapper.width(), + bounddown = 0, + placeup = el_position.left + el_width - sc_scroll_left, + placedown = el_position.left - sc_scroll_left; + + if (placeup <= boundup && placedown >= bounddown) + return true; + return false; + } + + function _saveNote(container, button) { + var sselcont_id = $(button).attr('id').split('_').pop(); + var note = $('.notes_wrapper textarea', container).val(); $.ajax({ type: "POST", - url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/" + sselcont_id + "/", + url: "/lightbox/ajax/SET_NOTE/" + sselcont_id + "/", dataType: 'json', data: { - agreement: boolean_value + note: note }, success: function (datas) { - if (!datas.error) { - if (boolean_value == '1') { - $('.agree_' + sselcont_id + '').removeClass('not_decided'); - $('.disagree_' + sselcont_id + '').addClass('not_decided'); - $('.userchoice.me').addClass('agree').removeClass('disagree'); - } - else { - $('.agree_' + sselcont_id + '').addClass('not_decided'); - $('.disagree_' + sselcont_id + '').removeClass('not_decided'); - $('.userchoice.me').addClass('disagree').removeClass('agree'); - } - p4.releasable = datas.releasable; - if (datas.releasable !== false) { - if (confirm(datas.releasable)) - $('#basket_options .confirm_report').trigger('click'); - } - } - else { - alert(datas.datas); - } + _hideNotes(container); + $('.notes_wrapper', container).remove(); + $('.lightbox_container', container).append(datas.datas); + _activateNotes(container); return; } }); -} - -function calculate_display(display_width, display_height, width, height, margin) { - if (typeof margin == 'undefined') - margin = 10; - - var display_ratio = display_width / display_height; - var ratio = width / height; - var w, h; - - if (ratio > display_ratio)//landscape - { - w = display_width - 2 * margin; - if (w > width) - w = width; - h = w / ratio; } - else { - h = display_height - 2 * margin; - if (h > height) - h = height; - w = ratio * h; + + function _activateNotes(container) { + $('.note_closer', container).button({ + text: true + }).bind('click', function () { + $(this).blur(); + _hideNotes(container); + return false; + } + ); + + $('.note_saver', container).button({ + text: true + }).bind('click', function () { + $(this).blur(); + _saveNote(container, this); + return false; + } + ); + } + + + function _showNotes(container) { + $('.notes_wrapper', container).animate({ + top: 0 + }); + $('.lightbox_container', container).addClass('note_editing'); + } + + function _hideNotes(container) { + $('.notes_wrapper', container).animate({ + top: '-100%' + }); + $('.lightbox_container', container).removeClass('note_editing'); + } + + function _setRelease(el) { + $('.loader', el).css({ + visibility: 'visible' + }); + $.ajax({ + type: "POST", + url: "/lightbox/ajax/SET_RELEASE/" + $('#navigation').val() + "/", + dataType: 'json', + error: function (data) { + $('.loader', el).css({ + visibility: 'hidden' + }); + }, + timeout: function (data) { + $('.loader', el).css({ + visibility: 'hidden' + }); + }, + success: function (data) { + $('.loader', el).css({ + visibility: 'hidden' + }); + if (data.datas) { + alert(data.datas); + } + if (!data.error) { + _releasable = false; + } + + return; + } + }); } return { - width: w, - height: h - }; -} - - -function display_record(compare) { - var main_container = $('#record_wrapper'); - - if (typeof compare == 'undefined') - compare = !main_container.hasClass('single'); - - var main_box = $('#record_main'); - var compare_box = $('#record_compare'); - - var main_record = $('.lightbox_container .record', main_box); - var compare_record = $('.lightbox_container .record', compare_box); - - var main_record_width = parseInt($('input[name=width]', main_box).val()); - var main_record_height = parseInt($('input[name=height]', main_box).val()); - var compare_record_width = parseInt($('input[name=width]', compare_box).val()); - var compare_record_height = parseInt($('input[name=height]', compare_box).val()); - - var main_container_width = main_container.width(); - var main_container_innerwidth = main_container.innerWidth(); - var main_container_height = main_container.height(); - var main_container_innerheight = main_container.innerHeight(); - - if (compare) { - $('.agreement_selector').show(); - main_container.addClass('comparison'); - - var double_portrait_width = main_container_innerwidth / 2; - var double_portrait_height = main_container_innerheight - $('.header', main_box).outerHeight(); - - var double_paysage_width = main_container_innerwidth; - var double_paysage_height = main_container_innerheight / 2 - $('.header', main_box).outerHeight(); - - var main_display_portrait = calculate_display( - double_portrait_width, double_portrait_height, - main_record_width, main_record_height - ); - var main_display_paysage = calculate_display( - double_paysage_width, double_paysage_height, - main_record_width, main_record_height - ); - - var compare_display_portrait = calculate_display( - double_portrait_width, double_portrait_height, - compare_record_width, compare_record_height - ); - var compare_display_paysage = calculate_display( - double_paysage_width, double_paysage_height, - compare_record_width, compare_record_height - ); - - var surface_main_portrait = main_display_portrait.width * main_display_portrait.height; - var surface_main_paysage = main_display_paysage.width * main_display_paysage.height; - var surface_compare_portrait = compare_display_portrait.width * compare_display_portrait.height; - var surface_compare_paysage = compare_display_paysage.width * compare_display_paysage.height; - - var double_portrait_surface = (surface_main_portrait + surface_compare_portrait) / 2; - var double_paysage_surface = (surface_main_paysage + surface_compare_paysage) / 2; - - var smooth_image = false; - - var m_width_image, m_height_image, c_width_image, c_height_image, dim_container; - - if (double_portrait_surface > double_paysage_surface) { - if (!main_container.hasClass('portrait')) { - smooth_image = true; - - smooth_transform( - main_box, - '50%', - '100%', - function () { - set_container_status('portrait'); - } - ); - - compare_box.css('visibility', 'hidden'); - - smooth_transform( - compare_box, - '50%', - '100%', - function () { - compare_box.css('display', 'none') - .css('visibility', 'visible') - .fadeIn(); - } - ); - } - m_width_image = main_display_portrait.width; - m_height_image = main_display_portrait.height; - c_width_image = compare_display_portrait.width; - c_height_image = compare_display_portrait.height; - dim_container = { - width: double_portrait_width, - height: double_portrait_height - }; - } - else { - if (!main_container.hasClass('paysage')) { - smooth_image = true; - - smooth_transform( - main_box, - '100%', - '50%', - function () { - set_container_status('paysage'); - } - ); - - compare_box.css('visibility', 'hidden'); - - smooth_transform( - compare_box, - '100%', - '50%', - function () { - compare_box.css('display', 'none') - .css('visibility', 'visible') - .fadeIn(); - } - ); - } - m_width_image = main_display_paysage.width; - m_height_image = main_display_paysage.height; - c_width_image = compare_display_paysage.width; - c_height_image = compare_display_paysage.height; - dim_container = { - width: double_paysage_width, - height: double_paysage_height - }; - } - - var image_callback = set_image_position(false, compare_record, c_width_image, c_height_image, dim_container, function () { - }); - set_image_position(smooth_image, main_record, m_width_image, m_height_image, dim_container, image_callback); + setReleasable: setReleasable } - else { - $('.agreement_selector').hide(); - main_container.removeClass('comparison'); - - if (compare_box.is(':visible')) { - compare_box.hide().css('visibility', 'hidden').css('display', 'block'); - } - - var main_display = calculate_display( - main_container_innerwidth, (main_container_innerheight - $('.header', main_box).outerHeight()), - main_record_width, main_record_height - ); - - if (!main_container.hasClass('single')) { - main_box.width('100%') - .height('100%'); - - set_container_status('single'); - } - set_image_position(smooth_image, main_record, main_display.width, main_display.height, { - width: main_container_width, - height: (main_container_height - $('.header', main_box).outerHeight()) - }); - } -} - -function set_container_status(status) { - $('#record_wrapper').removeClass('paysage portrait single').addClass(status); -} - -function set_image_position(smooth, image, width, height, container, callback) { - var dimensions = {}; - - if (typeof container !== 'undefined') { - var c_width = container.width; - var c_height = container.height; - - dimensions.top = parseInt((c_height - height) / 2); - dimensions.left = parseInt((c_width - width) / 2); - } - if (typeof callback == 'undefined') { - callback = function () { - }; - } - - dimensions.width = width; - dimensions.height = height; - - if (smooth) { - $(image).stop().animate(dimensions, 500, callback); - } - else { - $(image).css(dimensions); - callback(); - } -} - -function smooth_transform(box, width, height, callback) { - if (typeof callback == 'undefined') - callback = function () { - }; - - $(box).stop() - .animate( - { - width: width, - height: height - }, - 500, - callback - ); -} - - -function scroll_elements(boolean_value) { - var sc_wrapper = $('#sc_wrapper'); - var value; - if (boolean_value) - value = sc_wrapper.scrollLeft() + 400; - else - value = sc_wrapper.scrollLeft() - 400; - - sc_wrapper.stop().animate({ - 'scrollLeft': value - }); - return; -} - -function download_basket() { - var ids = $.map($('#sc_container .download_form').toArray(), function (el, i) { - return $('input[name="basrec"]', $(el)).val(); - }); - download(ids.join(';')); -} - -function download(value) { - var dialog = p4.Dialog.Create({title: typeof(language) !== 'undefined' ? language['export'] : ''}); - - $.post("/prod/export/multi-export/", "lst=" + value, function (data) { - - dialog.setContent(data); - - $('.tabs', dialog.getDomElement()).tabs(); - - $('.close_button', dialog.getDomElement()).bind('click', function () { - dialog.Close(); - }); - - return false; - }); -} - +})(jQuery); diff --git a/resources/www/prod/js/components/editor/record-editor.js b/resources/www/prod/js/components/editor/record-editor.js index 2ae966789f..04e649eff5 100644 --- a/resources/www/prod/js/components/editor/record-editor.js +++ b/resources/www/prod/js/components/editor/record-editor.js @@ -450,7 +450,6 @@ var recordEditorModule = (function (p4) { } function _setPreviewEdit() { - console.log('set preview edit on resize') if (!$('#TH_Opreview').is(':visible')) return false; diff --git a/resources/www/prod/js/components/push/push.js b/resources/www/prod/js/components/push/push.js index b160fdb3b5..16c586f355 100644 --- a/resources/www/prod/js/components/push/push.js +++ b/resources/www/prod/js/components/push/push.js @@ -44,11 +44,11 @@ var pushModule = (function (window, p4) { return; }, error: function () { - dialogModule.dialog.get(2).Close(); + dialogModule.dialog.get(2).close(); return; }, timeout: function () { - dialogModule.dialog.get(2).Close(); + dialogModule.dialog.get(2).close(); return; } }); @@ -159,7 +159,7 @@ var pushModule = (function (window, p4) { return false; } - $dialog.Close(); + $dialog.close(); $('input[name="name"]', $FeedBackForm).val($('input[name="name"]', $dialog.getDomElement()).val()); $('input[name="duration"]', $FeedBackForm).val($('select[name="duration"]', $dialog.getDomElement()).val()); @@ -454,11 +454,11 @@ var pushModule = (function (window, p4) { return; }, error: function () { - dialogModule.dialog.get(2).Close(); + dialogModule.dialog.get(2).close(); return; }, timeout: function () { - dialogModule.dialog.get(2).Close(); + dialogModule.dialog.get(2).close(); return; } }); @@ -492,7 +492,7 @@ var pushModule = (function (window, p4) { var callbackOK = function () { $('a.list_refresh', $container).trigger('click'); - dialogModule.dialog.get(2).Close(); + dialogModule.dialog.get(2).close(); }; var name = $('input[name="name"]', dialogModule.dialog.get(2).getDomElement()).val(); @@ -630,7 +630,7 @@ var pushModule = (function (window, p4) { var callbackOK = function () { $('#ListManager .all-lists a.list_refresh').trigger('click'); - dialogModule.dialog.get(2).Close(); + dialogModule.dialog.get(2).close(); }; var List = new document.List(list_id); diff --git a/resources/www/prod/js/core/selectable.js b/resources/www/prod/js/core/selectable.js index 6a53492f15..5f0ab5edd7 100644 --- a/resources/www/prod/js/core/selectable.js +++ b/resources/www/prod/js/core/selectable.js @@ -133,30 +133,6 @@ } } - /*function is_ctrl_key(event) { - if (event.altKey) - return true; - if (event.ctrlKey) - return true; - if (event.metaKey) // apple key opera - return true; - if (event.keyCode == '17') // apple key opera - return true; - if (event.keyCode == '224') // apple key mozilla - return true; - if (event.keyCode == '91') // apple key safari - return true; - - return false; - } - - function is_shift_key(event) { - if (event.shiftKey) - return true; - return false; - }*/ - - Selectable.prototype = { push: function (element) { if (this.options.allow_multiple === true || !this.has(element)) { diff --git a/resources/www/prod/js/prod.js b/resources/www/prod/js/prod.js index 0158b8e73d..8f022655ee 100644 --- a/resources/www/prod/js/prod.js +++ b/resources/www/prod/js/prod.js @@ -88,7 +88,7 @@ var prodModule = (function (p4, humane) { $dialog.getDomElement().find('form').bind('submit.conbo', function () { $(this).unbind('submit.conbo'); - $dialog.Close(); + $dialog.close(); return false; }); @@ -623,12 +623,10 @@ var prodModule = (function (p4, humane) { }); function _resizeAll() { - var body = $('#mainContainer'); + var body = $('body'); bodySize.y = body.height(); bodySize.x = body.width(); - $('.overlay').height(bodySize.y).width(bodySize.x); - var headBlockH = $('#headBlock').outerHeight(); var bodyY = bodySize.y - headBlockH - 2; var bodyW = bodySize.x - 2; @@ -845,7 +843,7 @@ var prodModule = (function (p4, humane) { $('.tabs', dialog.getDomElement()).tabs(); $('.close_button', dialog.getDomElement()).bind('click', function () { - dialog.Close(); + dialog.close(); }); return false; diff --git a/templates/web/common/dialog_export.html.twig b/templates/web/common/dialog_export.html.twig index 67a287acb0..f25f4b87b2 100644 --- a/templates/web/common/dialog_export.html.twig +++ b/templates/web/common/dialog_export.html.twig @@ -80,7 +80,7 @@ {% if app['conf'].get(['registry', 'actions', 'auth-required-for-export']) and app.getAuthenticatedUser().isGuest() %} {% endblock %} diff --git a/templates/web/prod/Baskets/Reorder.html.twig b/templates/web/prod/Baskets/Reorder.html.twig index d5439c035f..c759da93bd 100644 --- a/templates/web/prod/Baskets/Reorder.html.twig +++ b/templates/web/prod/Baskets/Reorder.html.twig @@ -202,7 +202,7 @@ alert(data.message); } p4.WorkZone.refresh('current'); - dialogModule.dialog.get(1).Close(); + dialogModule.dialog.get(1).close(); return; }, diff --git a/templates/web/prod/Baskets/Update.html.twig b/templates/web/prod/Baskets/Update.html.twig index e71c9c588a..dd98fdc923 100644 --- a/templates/web/prod/Baskets/Update.html.twig +++ b/templates/web/prod/Baskets/Update.html.twig @@ -29,7 +29,7 @@ }, success: function(data){ - $dialog = dialogModule.dialog.get(1).Close(); + $dialog = dialogModule.dialog.get(1).close(); if(data.success) { humane.info(data.message); return p4.WorkZone.refresh(data.basket.id); diff --git a/templates/web/prod/Story/Reorder.html.twig b/templates/web/prod/Story/Reorder.html.twig index 7b94d3c747..1e9b632b22 100644 --- a/templates/web/prod/Story/Reorder.html.twig +++ b/templates/web/prod/Story/Reorder.html.twig @@ -210,7 +210,7 @@ alert(data.message); } p4.WorkZone.refresh('current', null, false, 'story'); - dialogModule.dialog.get(1).Close(); + dialogModule.dialog.get(1).close(); return; }, diff --git a/templates/web/prod/WorkZone/Browser/Browser.html.twig b/templates/web/prod/WorkZone/Browser/Browser.html.twig index cc751382d0..efceb6676d 100644 --- a/templates/web/prod/WorkZone/Browser/Browser.html.twig +++ b/templates/web/prod/WorkZone/Browser/Browser.html.twig @@ -188,11 +188,11 @@ data: {}, success: function(datas){ if(datas.success) { - confirmBox.Close(); + confirmBox.close(); $('form[name="BasketBrowser"]', $container).trigger('submit'); p4.WorkZone.refresh(); } else { - confirmBox.Close(); + confirmBox.close(); var alertBox = dialogModule.dialog.create({ size : 'Alert', closeOnEscape : true, @@ -203,7 +203,7 @@ } }, error: function() { - confirmBox.Close(); + confirmBox.close(); var alertBox = dialogModule.dialog.create({ size : 'Alert', closeOnEscape : true, diff --git a/templates/web/prod/actions/Bridge/index.html.twig b/templates/web/prod/actions/Bridge/index.html.twig index dff328ad9c..70227e5feb 100644 --- a/templates/web/prod/actions/Bridge/index.html.twig +++ b/templates/web/prod/actions/Bridge/index.html.twig @@ -157,10 +157,10 @@ $(function() { data: {}, success: function(datas){ if(datas.success) { - confirmBox.Close(); + confirmBox.close(); pushModule.reloadBridge(managerUrl); } else { - confirmBox.Close(); + confirmBox.close(); var alertBox = dialogModule.dialog.create({ size : 'Alert', closeOnEscape : true, diff --git a/templates/web/prod/actions/Property/index.html.twig b/templates/web/prod/actions/Property/index.html.twig index 18595bcc75..c65ea701bb 100644 --- a/templates/web/prod/actions/Property/index.html.twig +++ b/templates/web/prod/actions/Property/index.html.twig @@ -151,7 +151,7 @@ var $dialogBox = $dialog.getDomElement(); $("button.cancel", $dialogBox).bind("click", function(){ - $dialog.Close(); + $dialog.close(); }); $("button.submiter", $dialogBox).bind("click", function(){ @@ -169,7 +169,7 @@ loader.show(); }, success: function(data){ - $dialog.Close(); + $dialog.close(); }, complete: function(){ $this.attr("disabled", false); diff --git a/templates/web/prod/actions/Property/type.html.twig b/templates/web/prod/actions/Property/type.html.twig index 502f76fa29..2d5fb35acb 100644 --- a/templates/web/prod/actions/Property/type.html.twig +++ b/templates/web/prod/actions/Property/type.html.twig @@ -59,7 +59,7 @@ var $dialogBox = $dialog.getDomElement(); $("button.cancel", $dialogBox).bind("click", function(){ - $dialog.Close(); + $dialog.close(); }); $("button.submiter", $dialogBox).bind("click", function(){ @@ -77,7 +77,7 @@ loader.show(); }, success: function(data){ - $dialog.Close(); + $dialog.close(); }, complete: function(){ $this.attr("disabled", false); diff --git a/templates/web/prod/actions/Tools/index.html.twig b/templates/web/prod/actions/Tools/index.html.twig index d7f8effad7..1e1d77331c 100644 --- a/templates/web/prod/actions/Tools/index.html.twig +++ b/templates/web/prod/actions/Tools/index.html.twig @@ -383,7 +383,7 @@ $(document).ready(function(){ humane.error(data.message); }else{ var dialog = dialogModule.dialog.get(1); - dialog.Close(); + dialog.close(); } }, complete: function(){ @@ -396,7 +396,7 @@ $(document).ready(function(){ $(".action_cancel", $scope).bind("click", function(){ var dialog = dialogModule.dialog.get(1); - dialog.Close(); + dialog.close(); return false; }); @@ -570,8 +570,8 @@ $(document).ready(function(){ if(data.success) { - dialog.Close(); - dialogModule.dialog.get(1).Close(); + dialog.close(); + dialogModule.dialog.get(1).close(); } else { diff --git a/templates/web/prod/actions/delete_records_confirm.html.twig b/templates/web/prod/actions/delete_records_confirm.html.twig index 495620744d..cdd9d587c3 100644 --- a/templates/web/prod/actions/delete_records_confirm.html.twig +++ b/templates/web/prod/actions/delete_records_confirm.html.twig @@ -35,7 +35,7 @@ var $cancelButton = $("button.cancel", $dialogBox); $cancelButton.bind("click", function(){ - $dialog.Close(); + $dialog.close(); }); $("button.submiter", $dialogBox).bind("click", function(){ @@ -56,7 +56,7 @@ loader.show(); }, success: function(data){ - $dialog.Close(); + $dialog.close(); $.each(data,function(i,n){ var imgt = $('#IMGT_'+n), chim = $('.CHIM_'+n), diff --git a/templates/web/prod/thesaurus.js.twig b/templates/web/prod/thesaurus.js.twig index e21e5099cf..293784b5cb 100644 --- a/templates/web/prod/thesaurus.js.twig +++ b/templates/web/prod/thesaurus.js.twig @@ -110,7 +110,7 @@ function T_replaceBy2(f) cancelButton: true, buttons: { "Ok" : function() { - confirmBox.Close(); + confirmBox.close(); T_replaceCandidates_OK(); } } @@ -248,7 +248,7 @@ function T_replaceCandidates_OK() trees.C._toReplace = null; thesauShowWizard("wiz_0", false); - replacingBox.Close(); + replacingBox.close(); if(result.msg != '') { @@ -346,10 +346,10 @@ function T_acceptCandidates_OK() } trees.C._toAccept = null; thesauShowWizard("wiz_0",false); - acceptingBox.Close(); + acceptingBox.close(); }, - error:function(){acceptingBox.Close();}, - timeout:function(){acceptingBox.Close();}, + error:function(){acceptingBox.close();}, + timeout:function(){acceptingBox.close();}, _ret: null // private alchemy }; @@ -387,7 +387,7 @@ function C_deleteCandidates_OK() timeout:10*60*1000, // 10 minutes ! success: function(result, textStatus) { - deletingBox.Close(); + deletingBox.close(); if(result.msg != '') { @@ -451,7 +451,7 @@ function T_acceptCandidates(menuItem, menu, type) cancelButton: true, buttons: { "Ok" : function() { - confirmBox.Close(); + confirmBox.close(); T_acceptCandidates_OK(); } } @@ -573,7 +573,7 @@ function C_MenuOption(menuItem, menu, option, parm) cancelButton: true, buttons: { "Ok" : function() { - confirmBox.Close(); + confirmBox.close(); C_deleteCandidates_OK(); } } @@ -638,7 +638,7 @@ function Xclick(e) { tids.pop(); var tid3 = tids.join('.'); - if(!is_ctrl_key(e) && !is_shift_key(e)) + if(!utilsModule.is_ctrl_key(e) && !utilsModule.is_shift_key(e)) { $("LI", trees[type].tree).removeClass('selected'); p4.thesau.lastClickedCandidate = null;