wip: component reorg, gathering js, css, images, ...

This commit is contained in:
Florian BLOUET
2015-11-17 16:23:04 +01:00
parent d729ac441b
commit f186091823
271 changed files with 466 additions and 1636 deletions

View File

@@ -17,11 +17,7 @@ gulp.task('build-admin', ['copy-admin-images', 'build-admin-css'], function(){
config.paths.vendors + 'underscore-amd/underscore.js',
config.paths.vendors + 'jquery.treeview/jquery.treeview.js',
config.paths.dist + 'include/jquery.kb-event.js',
config.paths.dist + 'skins/admin/template-dialogs.js',
// loaded via requirejs
// config.paths.vendors + 'blueimp-load-image/js/load-image.js',
// config.paths.vendors + 'jquery-file-upload/js/jquery.iframe-transport.js',
// config.paths.vendors + 'jquery-file-upload/js/jquery.fileupload.js',
config.paths.src + 'admin/js/template-dialogs.js',
config.paths.vendors + 'requirejs/require.js',
config.paths.dist + 'scripts/apps/admin/require.config.js',
config.paths.dist + 'scripts/apps/admin/main/main.js'

View File

@@ -38,7 +38,7 @@ gulp.task('build-common', ['copy-common-images', 'build-common-css'], function()
config.paths.dist + 'include/jslibs/jquery.contextmenu_scroll.js',
config.paths.dist + 'include/jquery.common.js',
config.paths.dist + 'include/jquery.tooltip.js',
config.paths.dist + 'skins/prod/jquery.Dialog.js',
config.paths.src + 'common/js/jquery.Dialog.js',
config.paths.vendors + 'swfobject/swfobject/swfobject.js', // @TODO: should be moved away (embed-bundle)
config.paths.dist + 'include/jslibs/flowplayer/flowplayer-3.2.13.min.js' // @TODO: should be moved away (embed-bundle)
];

View File

@@ -13,6 +13,13 @@ gulp.task('build-lightbox-mobile-css', function(){
], 'lightbox-mobile', 'lightbox/css/');
});
gulp.task('build-lightbox-mobile-js', function(){
return utils.buildJsGroup([
config.paths.src + 'lightbox/js/jquery.validator.mobile.js'
], 'lightbox-mobile', 'lightbox/js');
});
gulp.task('build-lightbox-ie6-css', function(){
return utils.buildCssGroup([
config.paths.src + 'lightbox/styles/main-ie6.scss'
@@ -25,13 +32,13 @@ gulp.task('build-lightbox-css', ['build-lightbox-mobile-css', 'build-lightbox-ie
], 'lightbox', 'lightbox/css/')
});
gulp.task('build-lightbox', ['copy-lightbox-images', 'build-lightbox-css'], function(){
gulp.task('build-lightbox', ['copy-lightbox-images', 'build-lightbox-css', 'build-lightbox-mobile-js'], function(){
var lightboxGroup = [
config.paths.dist + 'skins/lightbox/jquery.lightbox.js'
config.paths.src + 'lightbox/js/jquery.lightbox.js'
];
var lightboxIE6Group = [
config.paths.dist + 'skins/lightbox/jquery.lightbox.ie6.js'
config.paths.src + 'lightbox/js/jquery.lightbox.ie6.js'
];
utils.buildJsGroup(lightboxIE6Group, 'lightboxIe6', 'lightbox/js');
return utils.buildJsGroup(lightboxGroup, 'lightbox', 'lightbox/js');

View File

@@ -4,7 +4,7 @@ var utils = require('../utils.js');
gulp.task('copy-prod-images', function(){
// @TODO
return gulp.src([config.paths.src + 'prod/images/***'])
return gulp.src([config.paths.src + 'prod/images/**/*'])
.pipe(gulp.dest( config.paths.build + 'prod/images'));
});
@@ -40,19 +40,19 @@ gulp.task('build-prod', ['copy-prod-images', 'build-prod-css'], function(){
config.paths.dist + 'include/js/jquery.Selection.js',
config.paths.dist + 'include/js/jquery.Edit.js',
config.paths.dist + 'include/js/jquery.lists.js',
config.paths.dist + 'skins/prod/jquery.Prod.js',
config.paths.dist + 'skins/prod/jquery.Feedback.js',
config.paths.dist + 'skins/prod/jquery.Results.js',
config.paths.dist + 'skins/prod/jquery.main-prod.js',
config.paths.dist + 'skins/prod/jquery.WorkZone.js',
config.paths.dist + 'skins/prod/jquery.Alerts.js',
config.paths.dist + 'skins/prod/jquery.Upload.js',
config.paths.src + 'prod/js/jquery.Prod.js',
config.paths.src + 'prod/js/jquery.Feedback.js',
config.paths.src + 'prod/js/jquery.Results.js',
config.paths.src + 'prod/js/jquery.main-prod.js',
config.paths.src + 'prod/js/jquery.WorkZone.js',
config.paths.src + 'prod/js/jquery.Alerts.js',
config.paths.src + 'prod/js/jquery.Upload.js',
config.paths.dist + 'include/jslibs/pixastic.custom.js',
config.paths.dist + 'skins/prod/ThumbExtractor.js',
config.paths.dist + 'skins/prod/publicator.js',
config.paths.src + 'prod/js/ThumbExtractor.js',
config.paths.src + 'prod/js/publicator.js',
config.paths.dist + 'include/jslibs/jquery.sprintf.1.0.3.js',
config.paths.dist + 'include/jquery.p4.preview.js',
config.paths.dist + 'skins/prod/jquery.edit.js',
config.paths.src + 'prod/js/jquery.edit.js',
config.paths.dist + 'include/jslibs/jquery.color.animation.js',
config.paths.dist + 'include/jquery.image_enhancer.js',
config.paths.vendors + 'jquery.treeview/jquery.treeview.js',

View File

@@ -36,6 +36,7 @@ gulp.task('bootstrap-assets', function () {
});
gulp.task('build-bootstrap', ['bootstrap-assets', 'bootstrap-js'], function () {
// build standalone version (not used, see: Common Component)
gulp.src(config.paths.vendors + 'bootstrap-sass/vendor/assets/stylesheets/bootstrap.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest( config.paths.build + 'vendors/bootstrap/css/'))

View File

@@ -14,8 +14,8 @@
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, $colorButton), color-stop(100%, hsl(hue($colorButton), saturation($colorButton), $colorHsl))); /*Safari 4+, Chrome 2+*/
background: -webkit-linear-gradient($colorButton, hsl(hue($colorButton), saturation($colorButton), $colorHsl)); /* Safari 5.1+, Chrome 10+ */
background: -o-linear-gradient($colorButton, hsl(hue($colorButton), saturation($colorButton), $colorHsl)); /* Opera 11.10 */
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#ffffff'); IE6 & IE7
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#ffffff')"; IE8+ */
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#ffffff'); IE6 & IE7
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#ffffff')"; IE8+ */
background: linear-gradient($colorButton, hsl(hue($colorButton), saturation($colorButton), $colorHsl)); /* the standard */
}
@@ -132,7 +132,7 @@ $btnBackgroundHighlight: darken($white, 10%);
$btnBorder: #bbb;
$btnPrimaryBackground: $linkColor;
$btnPrimaryBackgroundHighlight: spin($btnPrimaryBackground, 20%);
$btnPrimaryBackgroundHighlight: darken($btnPrimaryBackground, 20%);
$btnInfoBackground: #3d8fa8;
$btnInfoBackgroundHighlight: #0d4461;
@@ -194,8 +194,8 @@ $zindexModal: 1050;
// Sprite icons path
// -------------------------
$iconSpritePath: "/skins/build/bootstrap/img/glyphicons-halflings.png";
$iconWhiteSpritePath: "/skins/build/bootstrap/img/glyphicons-halflings-white.png";
$iconSpritePath: "/assets/vendors/bootstrap/img/glyphicons-halflings.png";
$iconWhiteSpritePath: "/assets/vendors/bootstrap/img/glyphicons-halflings-white.png";
// Input placeholder text color

View File

@@ -1,9 +1,10 @@
$fontAwesomePath: "../../common/font"; // dist path
$iconsPath: '../../../skins/icons/';
@import '../../../../www/bower_components/normalize-css/normalize'; // not extension for inline import
@import '../../shared/styles/bootstrap';
@import '../../vendors/bootstrap/bootstrap';
// @TODO enable importation of: @import "../../../../plugins/login.less";
@import 'variables';
@import 'skin';
@import '../../shared/styles/skin/geonames';
@import '../../../../www/bower_components/font-awesome/sass/font-awesome.scss';

View File

@@ -0,0 +1,33 @@
var dialogUserResetTemplateConfirm = function (callback) {
var buttons = {};
buttons[language.reset_template_do_reset_apply_button] = function () { p4.Dialog.Close(2); callback('1'); };
var $dialog = p4.Dialog.Create({
size : '550x200',
closeOnEscape : true,
closeButton:false,
cancelButton:true,
title : language.reset_template_confirm_dialog_title,
buttons : buttons
}, 2);
$dialog.setContent(language.reset_template_do_confirm_choice);
}
var dialogUserTemplate = function (callback) {
var buttons = {};
buttons[language.reset_template_do_not_reset_button] = function () { p4.Dialog.Close(1); callback('0'); };
buttons[language.reset_template_do_reset_button] = function () { p4.Dialog.Close(1); dialogUserResetTemplateConfirm(callback); };
var $dialog = p4.Dialog.Create({
size : '550x200',
closeOnEscape : true,
closeButton:false,
cancelButton:true,
title : language.reset_template_dialog_title,
buttons : buttons
});
$dialog.setContent(language.reset_template_ask_choice);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,277 @@
;
var p4 = p4 || {};
;
(function (p4, $) {
function getLevel(level) {
level = parseInt(level);
if (isNaN(level) || level < 1) {
return 1;
}
return level;
};
function getId(level) {
return 'DIALOG' + getLevel(level);
};
function addButtons(buttons, dialog) {
if (dialog.options.closeButton === true) {
buttons[language.fermer] = function () {
dialog.Close();
};
}
if (dialog.options.cancelButton === true) {
buttons[language.annuler] = function () {
dialog.Close();
};
}
return buttons;
}
var phraseaDialog = function (options, level) {
var createDialog = function (level) {
var $dialog = $('#' + getId(level));
if ($dialog.length > 0) {
throw 'Dialog already exists at this level';
}
$dialog = $('<div style="display:none;" id="' + getId(level) + '"></div>');
$('body').append($dialog);
return $dialog;
};
var defaults = {
size: 'Medium',
buttons: {},
loading: true,
title: '',
closeOnEscape: true,
confirmExit: false,
closeCallback: false,
closeButton: false,
cancelButton: false
},
options = typeof options === 'object' ? options : {},
width,
height,
$dialog,
$this = this;
this.closing = false;
this.options = $.extend(defaults, options);
this.level = getLevel(level);
this.options.buttons = addButtons(this.options.buttons, this);
if (/\d+x\d+/.test(this.options.size)) {
var dimension = this.options.size.split('x');
height = dimension[1];
width = dimension[0];
} else {
switch (this.options.size) {
case 'Full':
height = bodySize.y - 30;
width = bodySize.x - 30;
break;
case 'Medium':
width = Math.min(bodySize.x - 30, 730);
height = Math.min(bodySize.y - 30, 520);
break;
default:
case 'Small':
width = Math.min(bodySize.x - 30, 420);
height = Math.min(bodySize.y - 30, 300);
break;
case 'Alert':
width = Math.min(bodySize.x - 30, 300);
height = Math.min(bodySize.y - 30, 150);
break;
}
}
/*
* 3 avaailable dimensions :
*
* - Full | Full size ()
* - Medium | 420 x 450
* - Small | 730 x 480
*
**/
this.$dialog = createDialog(this.level),
zIndex = Math.min(this.level * 5000 + 5000, 32767);
var CloseCallback = function () {
if (typeof $this.options.closeCallback === 'function') {
$this.options.closeCallback($this.$dialog);
}
if ($this.closing === false) {
$this.closing = true;
$this.Close();
}
};
if (this.$dialog.data('ui-dialog')) {
this.$dialog.dialog('destroy');
}
this.$dialog.attr('title', this.options.title)
.empty()
.dialog({
buttons: this.options.buttons,
draggable: false,
resizable: false,
closeOnEscape: this.options.closeOnEscape,
modal: true,
width: width,
height: height,
open: function () {
$(this).dialog("widget").css("z-index", zIndex);
},
close: CloseCallback
})
.dialog('open').addClass('dialog-' + this.options.size);
if (this.options.loading === true) {
this.$dialog.addClass('loading');
}
if (this.options.size === 'Full') {
var $this = this;
$(window).unbind('resize.DIALOG' + getLevel(level))
.bind('resize.DIALOG' + getLevel(level), function () {
if ($this.$dialog.data("ui-dialog")) {
$this.$dialog.dialog('option', {
width: bodySize.x - 30,
height: bodySize.y - 30
});
}
});
}
return this;
};
phraseaDialog.prototype = {
Close: function () {
p4.Dialog.Close(this.level);
},
setContent: function (content) {
this.$dialog.removeClass('loading').empty().append(content);
},
getId: function () {
return this.$dialog.attr('id');
},
load: function (url, method, params) {
var $this = this;
this.loader = {
url: url,
method: typeof method === 'undefined' ? 'GET' : method,
params: typeof params === 'undefined' ? {} : params
};
$.ajax({
type: this.loader.method,
url: this.loader.url,
dataType: 'html',
data: this.loader.params,
beforeSend: function () {
},
success: function (data) {
$this.setContent(data);
return;
},
error: function () {
return;
},
timeout: function () {
return;
}
});
},
refresh: function () {
if (typeof this.loader === 'undefined') {
throw 'Nothing to refresh';
}
this.load(this.loader.url, this.loader.method, this.loader.params);
},
getDomElement: function () {
return this.$dialog;
},
getOption: function (optionName) {
if (this.$dialog.data("ui-dialog")) {
return this.$dialog.dialog('option', optionName);
}
return null;
},
setOption: function (optionName, optionValue) {
if (optionName === 'buttons') {
optionValue = addButtons(optionValue, this);
}
if (this.$dialog.data("ui-dialog")) {
this.$dialog.dialog('option', optionName, optionValue);
}
}
};
var Dialog = function () {
this.currentStack = {};
};
Dialog.prototype = {
Create: function (options, level) {
if (this.get(level) instanceof phraseaDialog) {
this.get(level).Close();
}
$dialog = new phraseaDialog(options, level);
this.currentStack[$dialog.getId()] = $dialog;
return $dialog;
},
get: function (level) {
var id = getId(level);
if (id in this.currentStack) {
return this.currentStack[id];
}
return null;
},
Close: function (level) {
$(window).unbind('resize.DIALOG' + getLevel(level));
this.get(level).closing = true;
var dialog = this.get(level).getDomElement();
if (dialog.data('ui-dialog')) {
dialog.dialog('close').dialog('destroy');
}
dialog.remove();
var id = this.get(level).getId();
if (id in this.currentStack) {
delete this.currentStack.id;
}
}
};
p4.Dialog = new Dialog();
}(p4, jQuery));

View File

@@ -1,8 +1,8 @@
/**
* Common stylesheet, builded into assets/common/styles/common.css
*/
@import '../../shared/styles/bootstrap.scss';
@import '../../shared/styles/bootstrap-responsive.scss';
@import '../../vendors/bootstrap/bootstrap';
@import '../../vendors/bootstrap/responsive';
$fontAwesomePath: "../font"; // dist path
$iconsPath: '../../../skins/icons/';
@import '../../../../www/bower_components/font-awesome/sass/font-awesome.scss';

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

View File

@@ -0,0 +1,948 @@
var p4 = p4 || {};
p4.releasable = false;
var bodySize = {
x: 0,
y: 0
};
$(window).bind('beforeunload', function () {
if (p4.releasable !== false) {
if (confirm(p4.releasable)) {
$('#basket_options .confirm_report').trigger('click');
}
}
});
$(document).ready(function () {
bodySize.y = $('#mainContainer').height();
bodySize.x = $('#mainContainer').width();
$(window).bind('resize',function () {
resize();
}).trigger('resize');
function resize() {
bodySize.y = $('#mainContainer').height();
bodySize.x = $('#mainContainer').width();
var h = $(window).height();
var w = $(window).width();
$('body').width(w).height(h);
$('#mainContent').width(w).height(h - $('#mainMenu').outerHeight());
$('#innerWrapper').width(w - 20).height(h - $('#mainMenu').outerHeight() - 20);
$('#innerTop').height(h - $('#mainMenu').outerHeight() - 20 - 186);
$('#record_wrapper').width($('#innerWrapper').innerWidth() - $('#right_column').outerWidth() - 2);
// var right_column_wrapper_height = $('#right_column').innerHeight() - $('.right_column_title').outerHeight() - 10;
// $('.right_column_wrapper').height(right_column_wrapper_height);
$('.record_display_box').each(function (i, n) {
$('.lightbox_container', n).height($(n).innerHeight() - $('.header').outerHeight());
});
display_record($('#record_compare').css('visibility') != 'hidden');
}
$(this).data('slideshow', false);
$(this).data('slideshow_ctime', false);
$('#mainMenu, .unselectable').disableSelection();
display_basket();
$(window).bind('mousedown',function () {
$(this).focus();
}).trigger('mousedown');
$('.basket_downloader').bind('click', function () {
download_basket();
});
$('.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;
});
$('.right_column_title').bind('click',function () {
var title = $('.right_column_title');
if (!$('.right_column_wrapper_caption').is(':visible')) {
$('.right_column_wrapper_user').height(0);
$('.right_column_wrapper_caption').show();
$('.caption', title).addClass('highlight');
$('.validate', title).removeClass('highlight');
}
else {
$('.right_column_wrapper_user').height('auto');
$('.right_column_wrapper_caption').hide();
$('.caption', title).removeClass('highlight');
$('.validate', title).addClass('highlight');
}
}).addClass('clickable');
var sselcont = $('#sc_container .basket_element:first');
if (sselcont.length > 0) {
display_basket_element(false, sselcont.attr('id').split('_').pop());
}
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() + '/');
}
);
bind_keyboard();
});
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;
});
if (stop)
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 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,
height: Math.round($(window).height() * 0.8)
}).dialog('open').show();
return;
}
});
}
function set_sizeable(container) {
$(container).bind('mousewheel', function (event, delta) {
if ($(this).hasClass('note_editing'))
return;
var record = $('.record', 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 display_basket() {
var sc_wrapper = $('#sc_wrapper');
var basket_options = $('#basket_options');
$('.report').bind('click',function () {
load_report();
}).addClass('clickable');
$('.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;
})
.addClass('clickable');
$('.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 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).button({
text: false
}).bind('click', function () {
download($(this).next('form[name=download_form]').find('input').val());
});
$('.comment_button', options_container).button({
text: true
}).bind('click', function () {
if ($('.lightbox_container', container).hasClass('note_editing')) {
hide_notes(container);
}
else {
show_notes(container);
}
}
);
activate_notes(container);
$('.previous_button', options_container).button({
text: false
}).bind('click', function () {
get_prev();
});
$('.play_button', options_container).button({
text: false
}).bind('click', function () {
slideshow(true);
});
$('.pause_button', options_container).button({
text: false
}).bind('click', function () {
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).button({
text: false
}).bind('click', function () {
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) {
$('#record_infos, #right_column').hide();
$('#record_wrapper').stop().css({width: '100%'});
display_record(compare);
}
else {
$('#record_wrapper').css({
width: ($('#innerWrapper').width() - $('#record_infos').outerWidth() - $('#right_column').outerWidth() - 2)
});
display_record(compare);
$('#record_infos, #right_column').show();
$('#record_compare .lightbox_container').empty();
}
}
else {
display_record(compare);
}
}
function set_container_status(status) {
$('#record_wrapper').removeClass('paysage portrait single').addClass(status);
}
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;
}
);
$('.note_saver', container).button({
text: true
}).bind('click', function () {
// $(this).blur();
save_note(container, this);
return false;
}
);
}
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;
});
}
function display_record(compare) {
var main_container = $('#record_wrapper');
main_container.width($('#innerWrapper').innerWidth() - $('#right_column').outerWidth() - 2);
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,
parseInt($('#innerWrapper').width() / 2 - 13),
$('#innerWrapper').height(),
function () {
set_container_status('portrait');
}
);
compare_box.css('visibility', 'hidden');
smooth_transform(
compare_box,
parseInt($('#innerWrapper').width() / 2 - 13),
$('#innerWrapper').height(),
function () {
compare_box.css('display', 'none')
.css('visibility', 'visible').show();
}
);
}
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,
$('#innerWrapper').width(),
parseInt($('#innerWrapper').height() / 2),
function () {
set_container_status('paysage');
}
);
compare_box.css('visibility', 'hidden');
smooth_transform(
compare_box,
$('#innerWrapper').width(),
parseInt($('#innerWrapper').height() / 2),
function () {
compare_box.css('display', 'none')
.css('visibility', 'visible')
.show();
}
);
}
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);
}
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_agreement(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');
}
p4.releasable = datas.releasable;
if (datas.releasable !== false) {
if (confirm(datas.releasable))
$('#basket_options .confirm_report').trigger('click');
}
}
else {
alert(datas.datas);
}
return;
}
});
}
function get_next() {
var current_wrapper = $('#sc_container .basket_element.selected').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).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();
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).trigger('click');
adjust_visibility($('.basket_element', current_wrapper));
}
function is_viewable(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 adjust_visibility(el) {
if (is_viewable(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 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').hide();
$('.pause_button, .next_button.pause, .previous_button.pause').show();
get_next();
}
else {
$('.pause_button, .next_button.pause, .previous_button.pause').hide();
$('.play_button, .next_button.play, .previous_button.play').show();
}
}
function smooth_transform(box, width, height, callback) {
if (typeof callback == 'undefined')
callback = function () {
};
$(box).stop()
.css(
{
width: width,
height: height
}
// ,
// 500,
// callback
);
callback();
}
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 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;
}
return {width: w, height: h};
}
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 = parseInt(width);
dimensions.height = parseInt(height);
// if(smooth)
// {
// $(image).stop().animate(dimensions,500,callback);
// }
// else
// {
$(image).css(dimensions);
callback;
// }
}
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');
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 (data) {
var container = false;
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 download_basket() {
var ids = $.map($('#sc_container .download_form').toArray(), function (el, i) {
return $('input[name="basrec"]', $(el)).val();
});
download(ids.join(';'));
}
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;
}

View File

@@ -0,0 +1,980 @@
var p4 = p4 || {};
p4.releasable = false;
var bodySize = {
x: 0,
y: 0
};
$(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;
});
$('.basket_downloader').bind('click', function () {
download_basket();
});
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());
}
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 bind_keyboard() {
$(document).bind('keydown', function (event) {
var stop = false;
$('.notes_wrapper').each(function (i, n) {
if (parseInt($(n).css('top')) >= 0)
stop = true;
});
if (stop)
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').live('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;
});
$('.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');
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();
}
else {
// $('.agreement_selector').hide();
$('#record_wrapper').css({
right: 250
});
display_record(compare);
$('#right_column').show();
$('#record_compare .lightbox_container').empty();
}
}
else {
display_record(compare);
}
}
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;
}
);
$('.note_saver', container).button({
text: true
}).bind('click', function () {
$(this).blur();
save_note(container, this);
return false;
}
);
}
function is_viewable(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 adjust_visibility(el) {
if (is_viewable(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 get_next() {
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 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
});
});
}
function set_agreement(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');
}
p4.releasable = datas.releasable;
if (datas.releasable !== false) {
if (confirm(datas.releasable))
$('#basket_options .confirm_report').trigger('click');
}
}
else {
alert(datas.datas);
}
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;
}
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);
}
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;
});
}

View File

@@ -0,0 +1,122 @@
$(document).ready(function () {
if (typeof validator_loaded === 'boolean')
return;
$('.confirm_report').live('click', function () {
var $this = $(this);
$('.loader', $this).css({
visibility: 'visible'
});
$.ajax({
type: "POST",
url: "/lightbox/ajax/SET_RELEASE/" + $('#basket_validation_id').val() + "/",
dataType: 'json',
error: function (data) {
$('.loader', $this).css({
visibility: 'hidden'
});
},
timeout: function (data) {
$('.loader', $this).css({
visibility: 'hidden'
});
},
success: function (data) {
$('.loader', $this).css({
visibility: 'hidden'
});
if (data.datas) {
alert(data.datas);
}
if (!data.error) {
releasable = false;
}
return;
}
});
});
$('.agreement_radio').live('vmousedown', function () {
var sselcont_id = $(this).attr('for').split('_').pop();
var agreement = $('#' + $(this).attr('for')).val() == 'yes' ? '1' : '-1';
$.mobile.loading();
$.ajax({
type: "POST",
url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/" + sselcont_id + "/",
dataType: 'json',
data: {
agreement: agreement
},
error: function (datas) {
alert('error');
$.mobile.loading();
},
timeout: function (datas) {
alert('error');
$.mobile.loading();
},
success: function (datas) {
if (!datas.error) {
if (agreement == '1')
$('.valid_choice_' + sselcont_id).removeClass('disagree').addClass('agree');
else
$('.valid_choice_' + sselcont_id).removeClass('agree').addClass('disagree');
$.mobile.loading();
if (datas.error) {
alert(datas.datas);
return;
}
releasable = datas.release;
}
else {
alert(datas.datas);
}
return;
}
});
return false;
});
$('.note_area_validate').live('click', function () {
var sselcont_id = $(this).closest('form').find('input[name="sselcont_id"]').val();
$.mobile.loading();
$.ajax({
type: "POST",
url: "/lightbox/ajax/SET_NOTE/" + sselcont_id + "/",
dataType: 'json',
data: {
note: $('#note_form_' + sselcont_id).find('textarea').val()
},
error: function (datas) {
alert('error');
$.mobile.loading();
},
timeout: function (datas) {
alert('error');
$.mobile.loading();
},
success: function (datas) {
$.mobile.loading();
if (datas.error) {
alert(datas.datas);
return;
}
$('#notes_' + sselcont_id).empty().append(datas.datas);
window.history.back();
return;
}
});
return false;
});
validator_loaded = true;
});

View File

@@ -1,5 +1,5 @@
$iconsPath: '../../../skins/icons/';
$lightboxPath: '../../../skins/lightbox/';
$lightboxPath: '../images/';
@import '../../shared/styles/jquery.contextmenu';
body {

View File

@@ -1,5 +1,5 @@
$iconsPath: '../../../skins/icons/';
$lightboxPath: '../../../skins/lightbox/';
$lightboxPath: '../images/';
@import '../../shared/styles/jquery.contextmenu';
body {

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Some files were not shown because too many files have changed in this diff Show More