Fix JS codestyle

This commit is contained in:
Romain Neutron
2013-11-12 12:49:23 +01:00
parent 51fb364d13
commit 9fa95db23c
78 changed files with 5184 additions and 6309 deletions

View File

@@ -2,16 +2,19 @@ var p4 = p4 || {};
$(document).ready(function () {
$('input.input-button').hover(
function(){$(this).addClass('hover');},
function(){$(this).removeClass('hover');}
function () {
$(this).addClass('hover');
},
function () {
$(this).removeClass('hover');
}
);
var locale = $.cookie('locale');
var jq_date = p4.lng = typeof locale !== "undefined" ? locale.split('_').reverse().pop() : 'en';
if(jq_date == 'en')
{
if (jq_date == 'en') {
jq_date = 'en-GB';
}
@@ -24,7 +27,11 @@ $(document).ready(function(){
});
var cache = $('#mainMenu .helpcontextmenu');
$('.context-menu-item',cache).hover(function(){$(this).addClass('context-menu-item-hover');},function(){$(this).removeClass('context-menu-item-hover');});
$('.context-menu-item', cache).hover(function () {
$(this).addClass('context-menu-item-hover');
}, function () {
$(this).removeClass('context-menu-item-hover');
});
$('#help-trigger').contextMenu('#mainMenu .helpcontextmenu', {openEvt: 'click', dropDown: true, theme: 'vista', dropDown: true,
showTransition: 'slideDown',
@@ -35,14 +42,12 @@ $(document).ready(function(){
$('#notification_trigger').bind('mousedown', function (event) {
event.stopPropagation();
var box = $('#notification_box');
if($(this).hasClass('open'))
{
if ($(this).hasClass('open')) {
box.hide();
$(this).removeClass('open');
clear_notifications();
}
else
{
else {
box.show();
fix_notification_height();
@@ -61,15 +66,17 @@ $(document).ready(function(){
event.stopPropagation();
});
$('#notification_box div.notification').live('mouseover',function(){$(this).addClass('hover');});
$('#notification_box div.notification').live('mouseout',function(){$(this).removeClass('hover');});
$('#notification_box div.notification').live('mouseover', function () {
$(this).addClass('hover');
});
$('#notification_box div.notification').live('mouseout', function () {
$(this).removeClass('hover');
});
$(this).bind('mousedown', function () {
var box = $('#notification_box');
if($('#notification_trigger').hasClass('open'))
{
if ($('#notification_trigger').hasClass('open')) {
box.hide();
$('#notification_trigger').removeClass('open');
clear_notifications();
@@ -82,11 +89,9 @@ $(document).ready(function(){
});
function login(what)
{
function login(what) {
if (confirm(language.confirmRedirectAuth)) {
if(what != undefined)
{
if (what != undefined) {
EcrireCookie('last_act', what, null, '/');
}
self.location.replace('/login/?postlog=1');
@@ -95,8 +100,7 @@ function login(what)
}
function EcrireCookie(nom, valeur)
{
function EcrireCookie(nom, valeur) {
var argv = EcrireCookie.arguments;
var argc = EcrireCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
@@ -111,8 +115,7 @@ function EcrireCookie(nom, valeur)
document.cookie = cook;
}
function fix_notification_height()
{
function fix_notification_height() {
var box = $('#notification_box');
var not = $('.notification', box);
var n = not.length;
@@ -125,8 +128,7 @@ function fix_notification_height()
box.stop().animate({height: h});
}
function set_notif_position()
{
function set_notif_position() {
var trigger = $('#notification_trigger');
if (trigger.length === 0)
return;
@@ -139,8 +141,7 @@ $(window).bind('resize', function(){
});
function print_notifications(page)
{
function print_notifications(page) {
page = parseInt(page);
var buttons = {};
@@ -166,8 +167,7 @@ function print_notifications(page)
backgroundColor: '#000',
opacity: 0.7
},
close:function(event,ui)
{
close: function (event, ui) {
$('#notifications-dialog').dialog('destroy').remove();
}
}).dialog('option', 'buttons', buttons)
@@ -196,18 +196,15 @@ function print_notifications(page)
else
$('.notification_next', cont).remove();
for (i in data.notifications)
{
for (i in data.notifications) {
var id = 'notif_date_' + i;
var date_cont = $('#' + id);
if(date_cont.length === 0)
{
if (date_cont.length === 0) {
cont.append('<div id="' + id + '"><div class="notification_title">' + data.notifications[i].display + '</div></div>');
date_cont = $('#' + id);
}
for (j in data.notifications[i].notifications)
{
for (j in data.notifications[i].notifications) {
var loc_dat = data.notifications[i].notifications[j];
var html = '<div style="position:relative;" id="notification_' + loc_dat.id + '" class="notification">' +
'<table style="width:100%;" cellspacing="0" cellpadding="0" border="0"><tr><td style="width:25px;">' +
@@ -223,8 +220,7 @@ function print_notifications(page)
var next_ln = $.trim(data.next);
if(next_ln !== '')
{
if (next_ln !== '') {
cont.append('<div class="notification_next">' + next_ln + '</div>');
}
@@ -243,8 +239,7 @@ function print_notifications(page)
}
function read_notifications()
{
function read_notifications() {
var notifications = [];
$('#notification_box .unread').each(function () {
@@ -263,8 +258,7 @@ function read_notifications()
});
}
function clear_notifications()
{
function clear_notifications() {
var unread = $('#notification_box .unread');
if (unread.length === 0)
@@ -275,13 +269,7 @@ function clear_notifications()
}
function getMyRss(renew)
{
function getMyRss(renew) {
$.ajax({
type: "POST",
@@ -294,10 +282,8 @@ function getMyRss(renew)
}
function setPref(name,value)
{
if(jQuery.data['pref_'+name] && jQuery.data['pref_'+name].abort)
{
function setPref(name, value) {
if (jQuery.data['pref_' + name] && jQuery.data['pref_' + name].abort) {
jQuery.data['pref_' + name].abort();
jQuery.data['pref_' + name] = false;
}
@@ -317,12 +303,10 @@ function setPref(name,value)
jQuery.data['pref_' + name] = false;
},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
}
else
{
else {
humane.error(data.message);
}
jQuery.data['pref_' + name] = false;
@@ -332,8 +316,7 @@ function setPref(name,value)
}
function infoDialog(el)
{
function infoDialog(el) {
$("#DIALOG").attr('title', '')
.empty()
@@ -353,26 +336,22 @@ function infoDialog(el)
}
}).dialog('open').css({'overflow-x': 'auto', 'overflow-y': 'auto'});
}
function manageSession(data, showMessages)
{
function manageSession(data, showMessages) {
if (typeof(showMessages) == "undefined")
showMessages = false;
if(data.status == 'disconnected' || data.status == 'session')
{
if (data.status == 'disconnected' || data.status == 'session') {
disconnected();
return false;
}
if(showMessages)
{
if (showMessages) {
var box = $('#notification_box');
box.empty().append(data.notifications);
if (box.is(':visible'))
fix_notification_height();
if($('.notification.unread',box).length > 0)
{
if ($('.notification.unread', box).length > 0) {
var trigger = $('#notification_trigger');
$('.counter', trigger)
.empty()
@@ -383,36 +362,31 @@ function manageSession(data, showMessages)
else
$('#notification_trigger .counter').css('visibility', 'hidden').empty();
if(data.changed.length > 0)
{
if (data.changed.length > 0) {
var current_open = $('.SSTT.ui-state-active');
var current_sstt = current_open.length > 0 ? current_open.attr('id').split('_').pop() : false;
var main_open = false;
for(var i=0; i!=data.changed.length; i++)
{
for (var i = 0; i != data.changed.length; i++) {
var sstt = $('#SSTT_' + data.changed[i]);
if(sstt.size() === 0)
{
if(main_open === false)
{
$('#baskets .bloc').animate({'top':30}, function(){$('#baskets .alert_datas_changed:first').show()});
if (sstt.size() === 0) {
if (main_open === false) {
$('#baskets .bloc').animate({'top': 30}, function () {
$('#baskets .alert_datas_changed:first').show()
});
main_open = true;
}
}
else
{
else {
if (!sstt.hasClass('active'))
sstt.addClass('unread');
else
{
else {
$('.alert_datas_changed', $('#SSTT_content_' + data.changed[i])).show();
}
}
}
}
if('' !== $.trim(data.message))
{
if ('' !== $.trim(data.message)) {
if ($('#MESSAGE').length === 0)
$('body').append('<div id="#MESSAGE"></div>');
$('#MESSAGE')
@@ -425,8 +399,7 @@ function manageSession(data, showMessages)
resizable: false,
draggable: false,
modal: true,
close:function()
{
close: function () {
if ($('.dialog_remove:checked', $(this)).length > 0)
setTemporaryPref('message', 0);
}
@@ -438,9 +411,7 @@ function manageSession(data, showMessages)
}
function disconnected()
{
function disconnected() {
showModal('disconnected', {title: 'Disconnection'});
}
@@ -449,14 +420,14 @@ function showModal(cas, options){
var content = '';
var callback = null;
var button = {
"OK": function(e)
{
"OK": function (e) {
hideOverlay(3);
$(this).dialog("close");
return;
}};
var escape = true;
var onClose = function(){};
var onClose = function () {
};
switch (cas) {
case 'timeout':
@@ -468,7 +439,9 @@ function showModal(cas, options){
case 'disconnected':
content = language.serverDisconnected;
escape = false;
callback = function(e){ self.location.replace(self.location.href)};
callback = function (e) {
self.location.replace(self.location.href)
};
break;
default:
break;
@@ -484,8 +457,7 @@ function showOverlay(n,appendto,callback, zIndex){
var div = "OVERLAY";
if (typeof(n) != "undefined")
div += n;
if($('#'+div).length === 0)
{
if ($('#' + div).length === 0) {
if (typeof(appendto) == 'undefined')
appendto = 'body';
$(appendto).append('<div id="' + div + '" style="display:none;">&nbsp;</div>');
@@ -506,8 +478,11 @@ function showOverlay(n,appendto,callback, zIndex){
css['zIndex'] = parseInt(zIndex);
if (typeof(callback) != 'function')
callback = function(){};
$('#'+div).css(css).addClass('overlay').fadeTo(500, 0.7).bind('click',function(){(callback)();});
callback = function () {
};
$('#' + div).css(css).addClass('overlay').fadeTo(500, 0.7).bind('click', function () {
(callback)();
});
if ($.browser.msie && $.browser.version == '6.0') {
$('select').css({
visibility: 'hidden'

View File

@@ -10,8 +10,7 @@
var $this = $(this), data = $(this).data('image_enhance');
if ( ! data )
{
if (!data) {
if (options) {
$.extend(settings, options);
}
@@ -23,8 +22,7 @@
reset_position($this);
if(settings.display_full_screen)
{
if (settings.display_full_screen) {
$image.parent()
.append('<div class="image_enhance_titlebar" style="display:none;">\n\
<div class="image_enhance_title_options"><span class="full"><img src="/skins/icons/fullscreen.gif" /></span></div>\n\
@@ -59,12 +57,10 @@
var $theatre_img = $('img', $theatre);
$(window).bind('resize.image_enhance dblclick.image_enhance', function (event) {
if(event.type == 'dblclick')
{
if (event.type == 'dblclick') {
$theatre_img.removeClass('zoomed');
}
else
{
else {
if ($theatre_img.hasClass('zoomed'))
return;
}
@@ -84,13 +80,11 @@
}
if(settings.zoomable)
{
if (settings.zoomable) {
if (typeof $image.draggable !== 'function' && window.console)
console.error('zoomable require jquery UI\'s draggable');
if($image.attr('ondragstart'))
{
if ($image.attr('ondragstart')) {
$image.removeAttr('ondragstart');
}
$image.draggable();
@@ -105,13 +99,11 @@
$this.bind('mousewheel',function (event, delta) {
$image.addClass('zoomed');
if(delta > 0)
{
if (delta > 0) {
event.stopPropagation();
zoomPreview(true, ratio, $image, $(this));
}
else
{
else {
event.stopPropagation();
zoomPreview(false, ratio, $image, $(this));
}
@@ -137,8 +129,7 @@
}
};
function zoomPreview(bool, ratio, $img, $container)
{
function zoomPreview(bool, ratio, $img, $container) {
if ($img.length === 0)
return;
@@ -149,16 +140,14 @@
var w2, t2;
if(bool)
{
if (bool) {
if ((w1 * 1.08) < 32767) {
w2 = w1 * 1.08;
} else {
w2 = w1;
}
}
else
{
else {
if ((w1 / 1.08) > 20) {
w2 = w1 / 1.08;
} else {
@@ -186,8 +175,7 @@
}).width(w2).height(h2);
}
function calculate_sizes(window_width, window_height,image_width, image_height, border)
{
function calculate_sizes(window_width, window_height, image_width, image_height, border) {
if (typeof border !== 'number')
border = 0;
@@ -195,13 +183,11 @@
var ratio_display = window_width / window_height;
var ratio_image = image_width / image_height;
if(ratio_image > ratio_display)
{
if (ratio_image > ratio_display) {
width = window_width - border;
height = Math.round(width / ratio_image);
}
else
{
else {
height = window_height - border;
width = Math.round(height * ratio_image);
}
@@ -217,8 +203,7 @@
};
}
function reset_position($this)
{
function reset_position($this) {
var display_width = $this.width();
var display_height = $this.height();
var image_width = parseInt($('input[name="width"]', $this).val());

View File

@@ -1,7 +1,4 @@
function is_ctrl_key(event)
{
function is_ctrl_key(event) {
if (event.altKey)
return true;
if (event.ctrlKey)
@@ -18,8 +15,7 @@ function is_ctrl_key(event)
return false;
}
function is_shift_key(event)
{
function is_shift_key(event) {
if (event.shiftKey)
return true;
return false;

View File

@@ -1,6 +1,5 @@
(function ($) {
$.fn.nicoslider = function(options)
{
$.fn.nicoslider = function (options) {
var defaults = {
start: 0,
color: '#F6F2F1',
@@ -15,8 +14,7 @@
};
var nicoslide = function(slider, o)
{
var nicoslide = function (slider, o) {
var $slider = $(slider);
$sliderWidth = $slider.parent().innerWidth();
@@ -43,15 +41,13 @@
//5 % of slider width
$scrollWidth = Math.round(parseInt($sliderWidth) * parseFloat("0.05"));
//min 30 px;
if($scrollWidth < 30)
{
if ($scrollWidth < 30) {
$scrollWidth = 30;
}
var $wrapperWidth = Math.round(parseInt($sliderWidth) - ( 2 * $scrollWidth ));
if(ulWidth > $wrapperWidth)
{
if (ulWidth > $wrapperWidth) {
ul.wrapAll("<div class='wrapper'></div>");
$wrapper = $slider.find(".wrapper");
$ulHeight = ul.height();
@@ -113,8 +109,7 @@
scrollXpos = Math.round((x / rightScrollWidth) * scrollStepSpeed);
shift += (scrollXpos * speed);
if(shift > (ulWidth - $wrapperWidth) + 50)
{
if (shift > (ulWidth - $wrapperWidth) + 50) {
shift = (ulWidth - $wrapperWidth) + 50;
}
ul.animate({
@@ -129,8 +124,7 @@
scrollXpos = Math.round((x / leftScrollWidth) * scrollStepSpeed);
shift -= (scrollXpos * speed);
if(shift < 0)
{
if (shift < 0) {
shift = 0;
}

View File

@@ -1,12 +1,15 @@
$(document).ready(function () {
$('#tabs').tabs();
$('input.input-button').hover(
function(){parent.$(this).addClass('hover');},
function(){parent.$(this).removeClass('hover');}
function () {
parent.$(this).addClass('hover');
},
function () {
parent.$(this).removeClass('hover');
}
);
$(this).bind('keydown', function (event) {
switch(event.keyCode)
{
switch (event.keyCode) {
case 27:
parent.hideDwnl();
break;

View File

@@ -7,8 +7,7 @@ $(document).ready(function(){
});
function getNewVideoToken(lst, obj)
{
function getNewVideoToken(lst, obj) {
$.ajax({
type: "POST",
url: "../prod/records/renew-url/",
@@ -47,8 +46,7 @@ function openPreview(env, pos, contId, reload){
'display': 'block',
'opacity': 0
}).fadeTo(500, 1);
}else
{
} else {
$('#PREVIEWBOX').css({
'display': 'block',
'opacity': 1
@@ -111,8 +109,7 @@ function openPreview(env, pos, contId, reload){
prevAjaxrunning = false;
posAsk = null;
if(data.error)
{
if (data.error) {
$('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
alert(data.error);
if (justOpen)
@@ -129,13 +126,11 @@ function openPreview(env, pos, contId, reload){
$('#HISTORICOPS').empty().append(data.history);
$('#popularity').empty().append(data.popularity);
if($('#popularity .bitly_link').length>0)
{
if ($('#popularity .bitly_link').length > 0) {
BitlyCB.statsResponse = function (data) {
var result = data.results;
if( $( '#popularity .bitly_link_' + result.userHash ).length > 0 )
{
if ($('#popularity .bitly_link_' + result.userHash).length > 0) {
$('#popularity .bitly_link_' + result.userHash).append(' (' + result.clicks + ' clicks)');
}
};
@@ -148,35 +143,29 @@ function openPreview(env, pos, contId, reload){
p4.preview.current.tot = data.tot;
p4.preview.current.pos = data.pos;
if($('#PREVIEWBOX img.record.zoomable').length > 0)
{
if ($('#PREVIEWBOX img.record.zoomable').length > 0) {
$('#PREVIEWBOX img.record.zoomable').draggable();
}
setTitle(data.title);
setPreview();
if(env != 'RESULT')
{
if (env != 'RESULT') {
setCurrent(data.current);
viewCurrent($('#PREVIEWCURRENT li.selected'));
}
else
{
if(!justOpen)
{
else {
if (!justOpen) {
$('#PREVIEWCURRENT li.selected').removeClass('selected');
$('#PREVIEWCURRENTCONT li.current' + pos).addClass('selected');
}
if(justOpen || ($('#PREVIEWCURRENTCONT li.current'+pos).length === 0) || ($('#PREVIEWCURRENTCONT li:last')[0] == $('#PREVIEWCURRENTCONT li.selected')[0]) || ($('#PREVIEWCURRENTCONT li:first')[0] == $('#PREVIEWCURRENTCONT li.selected')[0]))
{
if (justOpen || ($('#PREVIEWCURRENTCONT li.current' + pos).length === 0) || ($('#PREVIEWCURRENTCONT li:last')[0] == $('#PREVIEWCURRENTCONT li.selected')[0]) || ($('#PREVIEWCURRENTCONT li:first')[0] == $('#PREVIEWCURRENTCONT li.selected')[0])) {
getAnswerTrain(pos, data.tools, query, options_serial);
}
viewCurrent($('#PREVIEWCURRENT li.selected'));
}
if(env == 'REG' && $('#PREVIEWCURRENT').html() === '')
{
if (env == 'REG' && $('#PREVIEWCURRENT').html() === '') {
getRegTrain(contId, pos, data.tools);
}
setOthers(data.others);
@@ -214,15 +203,13 @@ function zoomPreview(bool){
var w2, t2;
if(bool)
{
if (bool) {
if (w1 * 1.08 < 32767)
w2 = w1 * 1.08;
else
w2 = w1;
}
else
{
else {
if (w1 / 1.08 > 20)
w2 = w1 / 1.08;
else
@@ -248,8 +235,7 @@ function zoomPreview(bool){
}).width(w2).height(h2);
}
function getAnswerTrain(pos, tools, query,options_serial)
{
function getAnswerTrain(pos, tools, query, options_serial) {
$('#PREVIEWCURRENTCONT').fadeOut('fast');
$.ajax({
type: "POST",
@@ -270,8 +256,7 @@ function getAnswerTrain(pos, tools, query,options_serial)
}
function getRegTrain(contId,pos,tools)
{
function getRegTrain(contId, pos, tools) {
$.ajax({
type: "POST",
url: "/prod/query/reg-train/",
@@ -316,8 +301,7 @@ function startSlide(){
$('#start_slide').show();
$('#stop_slide').hide();
}
if(!p4.preview.open)
{
if (!p4.preview.open) {
p4.slideShowCancel = false;
p4.slideShow = false;
$('#start_slide').show();
@@ -348,8 +332,7 @@ function getNext(){
posAsk = (posAsk > parseInt(p4.tot) || isNaN(posAsk)) ? 0 : posAsk;
openPreview('RESULT', posAsk);
}
else
{
else {
if (!$('#PREVIEWCURRENT li.selected').is(':last-child'))
$('#PREVIEWCURRENT li.selected').next().children('img').trigger("click");
else
@@ -363,14 +346,12 @@ function reloadPreview(){
}
function getPrevious() {
if (p4.preview.mode == 'RESULT')
{
if (p4.preview.mode == 'RESULT') {
posAsk = parseInt(p4.preview.current.pos) - 1;
posAsk = (posAsk < 0) ? ((parseInt(p4.tot) - 1)) : posAsk;
openPreview('RESULT', posAsk);
}
else
{
else {
if (!$('#PREVIEWCURRENT li.selected').is(':first-child'))
$('#PREVIEWCURRENT li.selected').prev().children('img').trigger("click");
else
@@ -390,12 +371,10 @@ function setOthers(others){
function setTools(tools) {
$('#PREVIEWTOOL').empty().append(tools);
if(!p4.slideShowCancel && p4.slideShow)
{
if (!p4.slideShowCancel && p4.slideShow) {
$('#start_slide').hide();
$('#stop_slide').show();
}else
{
} else {
$('#start_slide').show();
$('#stop_slide').hide();
}
@@ -421,8 +400,7 @@ function setCurrent(current){
}
function viewCurrent(el) {
if (el.length === 0)
{
if (el.length === 0) {
return;
}
$('#PREVIEWCURRENT li.selected').removeClass('selected');
@@ -452,8 +430,7 @@ function setPreview(){
var margX = 0;
var margY = 0;
if($('#PREVIEWIMGCONT .record_audio').length > 0)
{
if ($('#PREVIEWIMGCONT .record_audio').length > 0) {
margY = 100;
de = 60;
}

View File

@@ -49,8 +49,7 @@
$.tooltip.blocked = !$.tooltip.blocked;
},
delayAjax : function(a,b,c)
{
delayAjax: function (a, b, c) {
var options_serial = p4.tot_options;
var query = p4.tot_query;
var datas = {
@@ -201,14 +200,12 @@
// add an optional class for this tip
// helper.parent.addClass(settings(this).extraClass);
if(this.ajaxLoad)
{
if (this.ajaxLoad) {
clearTimeout($.tooltip.ajaxTimeout);
$.tooltip.ajaxTimeout = setTimeout("$.tooltip.delayAjax()", 300);
$.tooltip.ajaxEvent = event;
}
else
{
else {
title = '<div class="popover" style="display:block;position:relative;">' +
'<div class="arrow"></div>' +
'<div class="popover-inner" style="width:auto;">' +
@@ -224,16 +221,14 @@
}
function positioning(event)
{
function positioning(event) {
helper.body.html(title);
helper.body.show();
$this = $.tooltip.current;
// fix PNG background for IE
if (settings($this).fixPNG)
helper.parent.fixPNG();
if(settings($this).outside)
{
if (settings($this).outside) {
var width = 'auto';
var height = 'auto';
var ratio = 1;
@@ -275,8 +270,7 @@
// $('#' + settings($.tooltip.current).id + ' .thumb_wrapper').width('auto').height('auto');
if($('#' + settings($.tooltip.current).id + ' .audioTips').length > 0)
{
if ($('#' + settings($.tooltip.current).id + ' .audioTips').length > 0) {
height = height < 26 ? 26 : height;
}
@@ -325,36 +319,30 @@
//correction par ratio
if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) {
if(ratioSurfaceH > ratioImage)
{
if (ratioSurfaceH > ratioImage) {
horS = v.y * ratioImage * v.y;
}
else
{
else {
horS = wiH * wiH / ratioImage;
}
if(ratioSurfaceV > ratioImage)
{
if (ratioSurfaceV > ratioImage) {
vertS = heV * ratioImage * heV;
}
else
{
else {
vertS = v.x * v.x / ratioImage;
}
}
var zH;
if((Math.abs(ratioSurfaceV - ratioImage) < Math.abs(ratioSurfaceH - ratioImage)))
{
if ((Math.abs(ratioSurfaceV - ratioImage) < Math.abs(ratioSurfaceH - ratioImage))) {
var zL = event.pageX;
var zW = $(h).width();
zH = $(h).height();
var ETOT = $(event.target).offset().top;
var ETH = $(event.target).height();
left = (zL - zW / 2) < 20 ? 20 : (((zL + zW / 2 + 20) > v.x) ? (v.x - zW - 20) : (zL - zW / 2));
switch(vert)
{
switch (vert) {
case 'haut':
height = (zH > (ETOT - 40)) ? (ETOT - 40) : zH;
top = ETOT - height - 20;
@@ -367,8 +355,7 @@
break;
}
}
else
{
else {
// height = ($(h).height()>(v.y-40))?(v.y-40):$(h).height();
zH = $(h).height();
var zT = event.pageY;
@@ -376,8 +363,7 @@
var ETW = $(event.target).width();
var zw = $(h).width();
top = (zT - zH / 2) < 20 ? 20 : (((zT + zH / 2 + 20) > v.y) ? (v.y - zH - 20) : (zT - zH / 2));
switch(hor)
{
switch (hor) {
case 'gauche':
width = (zw > (EOTL - 40)) ? (EOTL - 40) : zw;
left = EOTL - width - 20;
@@ -421,16 +407,13 @@
}
width = nw;
}
}else
{
if(vertS < horS)
{
} else {
if (vertS < horS) {
height = 'auto';
}
}
if(resizeImgTips)
{
if (resizeImgTips) {
var factor = Math.min((width - 45) / width, (height - 75) / height);
var imgWidth = Math.round(width * factor);
var imgHeight = Math.round(height * factor);
@@ -444,8 +427,7 @@
});
}
if(resizeVideoTips)
{
if (resizeVideoTips) {
var factor = Math.min((width - 45) / width, (height - 75) / height);
var imgWidth = Math.round(width * factor);
var imgHeight = Math.round(height * factor);
@@ -488,10 +470,8 @@
update();
}
function fix(event)
{
if(!settings(this).fixable)
{
function fix(event) {
if (!settings(this).fixable) {
hide(event);
return;
}
@@ -538,8 +518,7 @@
// remove position helper classes
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
if(!settings($.tooltip.current).outside)
{
if (!settings($.tooltip.current).outside) {
var left = helper.parent[0].offsetLeft;
var top = helper.parent[0].offsetTop;
helper.parent.width('auto');
@@ -590,8 +569,7 @@
}
// hide helper and restore added classes and the title
function hide(event)
{
function hide(event) {
if ($.tooltip.blocked || !$.tooltip.current)
return;
// clear timeout if possible
@@ -601,8 +579,7 @@
$.tooltip.visible = false;
var tsettings = settings($.tooltip.current);
clearTimeout($.tooltip.ajaxTimeout);
if($.tooltip.ajaxRequest && $.tooltip.ajaxRequest.abort)
{
if ($.tooltip.ajaxRequest && $.tooltip.ajaxRequest.abort) {
$.tooltip.ajaxRequest.abort();
}
@@ -611,6 +588,7 @@
function complete() {
helper.parent.removeClass(tsettings.extraClass).hide().css("opacity", "");
}
if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
if (helper.parent.is(':animated'))
helper.parent.stop().fadeTo(tsettings.fade, 0, complete);
@@ -625,8 +603,7 @@
})(jQuery);
function unfix_tooltip()
{
function unfix_tooltip() {
$.tooltip.blocked = false;
$.tooltip.visible = false;
$.tooltip.current = null;
@@ -637,8 +614,7 @@ function unfix_tooltip()
$(document).bind('keydown', function (event) {
if(event.keyCode == 27 && $.tooltip.blocked === true)
{
if (event.keyCode == 27 && $.tooltip.blocked === true) {
unfix_tooltip();
}
});

View File

@@ -1,8 +1,6 @@
(function (window) {
function checkVocabId(VocabularyId)
{
function checkVocabId(VocabularyId) {
if (typeof VocabularyId === 'undefined')
VocabularyId = null;
@@ -64,8 +62,7 @@
},
options = (typeof options == 'object') ? options : {};
if(isNaN(meta_struct_id))
{
if (isNaN(meta_struct_id)) {
throw 'meta_struct_id should be a number';
}
@@ -74,8 +71,7 @@
this.meta_struct_id = meta_struct_id;
this.options = jQuery.extend(defaults, options);
if(this.options.multi === true && this.options.separator === null)
{
if (this.options.multi === true && this.options.separator === null) {
this.options.separator = ';';
}
@@ -122,45 +118,36 @@
};
this.datas = new Array();
if(arrayValues instanceof Array)
{
if (arrayValues instanceof Array) {
if (arrayValues.length > 1 && !databoxField.isMulti())
throw 'You can not add multiple values to a non multi field ' + databoxField.getName();
var first = true;
for(v in arrayValues)
{
if(typeof arrayValues[v] !== 'object')
{
if(window.console)
{
for (v in arrayValues) {
if (typeof arrayValues[v] !== 'object') {
if (window.console) {
console.error('Trying to add a non-recordFieldValue to the field...');
}
continue;
}
if(isNaN(arrayValues[v].getMetaId()))
{
if(window.console)
{
if (isNaN(arrayValues[v].getMetaId())) {
if (window.console) {
console.error('Trying to add a recordFieldValue without metaId...');
}
continue;
}
if(!first && this.options.multi === false)
{
if(window.console)
{
if (!first && this.options.multi === false) {
if (window.console) {
console.error('Trying to add multi values in a non-multi field');
}
}
if(window.console)
{
if (window.console) {
console.log('adding a value : ', arrayValues[v]);
}
@@ -193,79 +180,59 @@
merge = !!merge;
if(this.databoxField.isReadonly())
{
if(window.console)
{
if (this.databoxField.isReadonly()) {
if (window.console) {
console.error('Unable to set a value to a readonly field');
}
return;
}
if(window.console)
{
if (window.console) {
console.log('adding value ', value, ' vocId : ', VocabularyId, ' ; merge is ', merge);
}
if(this.isMulti())
{
if(!this.hasValue(value, VocabularyId))
{
if(window.console)
{
if (this.isMulti()) {
if (!this.hasValue(value, VocabularyId)) {
if (window.console) {
console.log('adding new multi value ', value);
}
this.datas.push(new recordFieldValue(null, value, VocabularyId));
this.options.dirty = true;
}
else
{
if(window.console)
{
else {
if (window.console) {
console.log('already have ', value);
}
}
}
else
{
if(merge === true && this.isEmpty() === false && VocabularyId === null)
{
if(window.console)
{
else {
if (merge === true && this.isEmpty() === false && VocabularyId === null) {
if (window.console) {
console.log('Merging value ', value);
}
this.datas[0].setValue(this.datas[0].getValue() + ' ' + value, VocabularyId);
this.options.dirty = true;
}
else
{
if(merge === true && this.isEmpty() === false && VocabularyId !== null)
{
if(window.console)
{
else {
if (merge === true && this.isEmpty() === false && VocabularyId !== null) {
if (window.console) {
console.error('Cannot merge vocabularies');
}
this.datas[0].setValue(value, VocabularyId);
}
else
{
else {
if(!this.hasValue(value, VocabularyId))
{
if(this.datas.length === 0)
{
if(window.console)
{
if (!this.hasValue(value, VocabularyId)) {
if (this.datas.length === 0) {
if (window.console) {
console.log('Adding new value ', value);
}
this.datas.push(new recordFieldValue(null, value, VocabularyId));
}
else
{
if(window.console)
{
else {
if (window.console) {
console.log('Updating value ', value);
}
this.datas[0].setValue(value, VocabularyId);
@@ -280,33 +247,25 @@
},
hasValue: function (value, VocabularyId) {
if(typeof value === 'undefined')
{
if(window.console)
{
if (typeof value === 'undefined') {
if (window.console) {
console.error('Trying to check the presence of an undefined value');
}
}
VocabularyId = checkVocabId(VocabularyId);
for(d in this.datas)
{
if(VocabularyId !== null)
{
if(this.datas[d].getVocabularyId() === VocabularyId)
{
if(window.console)
{
for (d in this.datas) {
if (VocabularyId !== null) {
if (this.datas[d].getVocabularyId() === VocabularyId) {
if (window.console) {
console.log('already got the vocab ID');
}
return true;
}
}
else if(this.datas[d].getVocabularyId() === null && this.datas[d].getValue() == value)
{
if(window.console)
{
else if (this.datas[d].getVocabularyId() === null && this.datas[d].getValue() == value) {
if (window.console) {
console.log('already got this value');
}
return true;
@@ -316,10 +275,8 @@
},
removeValue: function (value, vocabularyId) {
if(this.databoxField.isReadonly())
{
if(window.console)
{
if (this.databoxField.isReadonly()) {
if (window.console) {
console.error('Unable to set a value to a readonly field');
}
@@ -328,33 +285,25 @@
vocabularyId = checkVocabId(vocabularyId);
if(window.console)
{
if (window.console) {
console.log('Try to remove value ', value, vocabularyId, this.datas);
}
for(d in this.datas)
{
if(window.console)
{
for (d in this.datas) {
if (window.console) {
console.log('loopin... ', this.datas[d].getValue());
}
if(this.datas[d].getVocabularyId() !== null)
{
if(this.datas[d].getVocabularyId() == vocabularyId)
{
if(window.console)
{
if (this.datas[d].getVocabularyId() !== null) {
if (this.datas[d].getVocabularyId() == vocabularyId) {
if (window.console) {
console.log('Found within the vocab ! removing... ');
}
this.datas[d].remove();
this.options.dirty = true;
}
}
else if(this.datas[d].getValue() == value)
{
if(window.console)
{
else if (this.datas[d].getValue() == value) {
if (window.console) {
console.log('Found ! removing... ');
}
this.datas[d].remove();
@@ -366,8 +315,7 @@
isEmpty: function () {
var empty = true;
for(d in this.datas)
{
for (d in this.datas) {
if (this.datas[d].getValue() !== '')
empty = false;
}
@@ -375,18 +323,15 @@
},
empty: function () {
if(this.databoxField.isReadonly())
{
if(window.console)
{
if (this.databoxField.isReadonly()) {
if (window.console) {
console.error('Unable to set a value to a readonly field');
}
return;
}
for(d in this.datas)
{
for (d in this.datas) {
this.datas[d].remove();
this.options.dirty = true;
}
@@ -404,8 +349,7 @@
},
getValues: function () {
if(!this.isMulti())
{
if (!this.isMulti()) {
throw 'This field is not multi, I can not give you multiple values';
}
@@ -414,8 +358,7 @@
var arrayValues = [];
for(d in this.datas)
{
for (d in this.datas) {
if (this.datas[d].getValue() === '')
continue;
@@ -434,8 +377,7 @@
var arrayValues = [];
var values = this.getValues();
for(v in values)
{
for (v in values) {
arrayValues.push(values[v].getValue());
}
@@ -443,10 +385,8 @@
},
replaceValue: function (search, replace) {
if(this.databoxField.isReadonly())
{
if(window.console)
{
if (this.databoxField.isReadonly()) {
if (window.console) {
console.error('Unable to set a value to a readonly field');
}
@@ -455,18 +395,15 @@
var n = 0;
for(d in this.datas)
{
if(this.datas[d].getVocabularyId() !== null)
{
for (d in this.datas) {
if (this.datas[d].getVocabularyId() !== null) {
continue;
}
var value = this.datas[d].getValue();
var replacedValue = value.replace(search, replace);
if(value === replacedValue)
{
if (value === replacedValue) {
continue;
}
@@ -474,8 +411,7 @@
this.removeValue(value);
if(!this.hasValue(replacedValue))
{
if (!this.hasValue(replacedValue)) {
this.addValue(replacedValue);
}
@@ -488,16 +424,14 @@
var returnValue = new Array();
for(d in this.datas)
{
for (d in this.datas) {
var temp = {
meta_id: this.datas[d].getMetaId() ? this.datas[d].getMetaId() : '',
meta_struct_id: this.getMetaStructId(),
value: this.datas[d].getValue()
};
if(this.datas[d].getVocabularyId())
{
if (this.datas[d].getVocabularyId()) {
temp.vocabularyId = this.datas[d].getVocabularyId();
}
returnValue.push(temp);

View File

@@ -20,11 +20,9 @@
var $this = this;
if($container.data('selectionnable'))
{
if ($container.data('selectionnable')) {
/* this container is already selectionnable */
if(window.console)
{
if (window.console) {
console.error('Trying to apply new selection to existing one');
}
@@ -41,8 +39,7 @@
jQuery(this.options.selector, this.$container)
.live('click', function (event) {
if(typeof $this.options.selectStart === 'function')
{
if (typeof $this.options.selectStart === 'function') {
$this.options.selectStart(jQuery.extend(jQuery.Event('selectStart'), event), $this);
}
@@ -50,15 +47,13 @@
var k = get_value($that, $this);
if(is_shift_key(event) && jQuery('.last_selected', this.$container).filter($this.options.selector).length != 0)
{
if (is_shift_key(event) && jQuery('.last_selected', this.$container).filter($this.options.selector).length != 0) {
var lst = jQuery($this.options.selector, this.$container);
var index1 = jQuery.inArray(jQuery('.last_selected', this.$container).filter($this.options.selector)[0], lst);
var index2 = jQuery.inArray($that[0], lst);
if(index2<index1)
{
if (index2 < index1) {
var tmp = index1;
index1 = (index2 - 1) < 0 ? index2 : (index2 - 1);
index2 = tmp;
@@ -66,21 +61,17 @@
var stopped = false;
if(index2 != -1 && index1 != -1)
{
if (index2 != -1 && index1 != -1) {
var exp = $this.options.selector + ':gt(' + index1 + '):lt(' + (index2 - index1) + ')';
$.each(jQuery(exp, this.$container), function (i, n) {
if(!jQuery(n).hasClass('selected') && stopped === false)
{
if(!$this.hasReachLimit())
{
if (!jQuery(n).hasClass('selected') && stopped === false) {
if (!$this.hasReachLimit()) {
var k = get_value(jQuery(n), $this);
$this.push(k);
jQuery(n).addClass('selected');
}
else
{
else {
alert(language.max_record_selected);
stopped = true;
}
@@ -88,43 +79,33 @@
});
}
if($this.has(k) === false && stopped === false)
{
if(!$this.hasReachLimit())
{
if ($this.has(k) === false && stopped === false) {
if (!$this.hasReachLimit()) {
$this.push(k);
$that.addClass('selected');
}
else
{
else {
alert(language.max_record_selected);
}
}
}
else
{
if(!is_ctrl_key(event))
{
else {
if (!is_ctrl_key(event)) {
$this.empty().push(k);
jQuery('.selected', this.$container).filter($this.options.selector).removeClass('selected');
$that.addClass('selected');
}
else
{
if($this.has(k) === true)
{
else {
if ($this.has(k) === true) {
$this.remove(k);
$that.removeClass('selected');
}
else
{
if(!$this.hasReachLimit())
{
else {
if (!$this.hasReachLimit()) {
$this.push(k);
$that.addClass('selected');
}
else
{
else {
alert(language.max_record_selected);
}
}
@@ -135,8 +116,7 @@
$that.addClass('last_selected');
if(typeof $this.options.selectStop === 'function')
{
if (typeof $this.options.selectStop === 'function') {
$this.options.selectStop(jQuery.extend(jQuery.Event('selectStop'), event), $this);
}
@@ -147,20 +127,16 @@
return;
};
function get_value(element, Selectable)
{
if(typeof Selectable.options.callbackSelection === 'function')
{
function get_value(element, Selectable) {
if (typeof Selectable.options.callbackSelection === 'function') {
return Selectable.options.callbackSelection(jQuery(element));
}
else
{
else {
return jQuery('input[name="id"]', jQuery(element)).val();
}
}
function is_ctrl_key(event)
{
function is_ctrl_key(event) {
if (event.altKey)
return true;
if (event.ctrlKey)
@@ -177,27 +153,23 @@
return false;
}
function is_shift_key(event)
{
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))
{
if (this.options.allow_multiple === true || !this.has(element)) {
this.datas.push(element);
}
return this;
},
hasReachLimit: function () {
if(this.options.limit !== null && this.options.limit <= this.datas.length)
{
if (this.options.limit !== null && this.options.limit <= this.datas.length) {
return true;
}
return false;
@@ -223,8 +195,7 @@
jQuery(this.options.selector, this.$container).filter('.selected:visible').removeClass('selected');
if(typeof $this.options.selectStop === 'function')
{
if (typeof $this.options.selectStop === 'function') {
$this.options.selectStop(jQuery.Event('selectStop'), $this);
}
@@ -254,15 +225,12 @@
stopped = false;
jQuery(this.options.selector, this.$container).filter(selector).not('.selected').filter(':visible').each(function () {
if(!$this.hasReachLimit())
{
if (!$this.hasReachLimit()) {
$this.push(get_value(this, $this));
$(this).addClass('selected');
}
else
{
if(stopped === false)
{
else {
if (stopped === false) {
alert(language.max_record_selected);
}
stopped = true;
@@ -270,8 +238,7 @@
});
if(typeof $this.options.selectStop === 'function')
{
if (typeof $this.options.selectStop === 'function') {
$this.options.selectStop(jQuery.Event('selectStop'), $this);
}

View File

@@ -8,8 +8,7 @@ var p4 = p4 || {};
var List = function (id) {
if(parseInt(id) <= 0)
{
if (parseInt(id) <= 0) {
throw 'Invalid list id';
}
@@ -27,18 +26,15 @@ var p4 = p4 || {};
dataType: 'json',
data: {name: name},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
var list = new List(data.list_id);
callback(list);
}
}
else
{
else {
humane.error(data.message);
}
}
@@ -56,26 +52,20 @@ var p4 = p4 || {};
dataType: type,
data: {},
success: function (data) {
if(type == 'json')
{
if(data.success)
{
if (type == 'json') {
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback(data.result);
}
}
else
{
else {
humane.error(data.message);
}
}
else
{
if(typeof callback === 'function')
{
else {
if (typeof callback === 'function') {
callback(data);
}
}
@@ -88,8 +78,7 @@ var p4 = p4 || {};
List.prototype = {
addUsers: function (arrayUsers, callback) {
if(!arrayUsers instanceof Array)
{
if (!arrayUsers instanceof Array) {
throw 'addUsers takes array as argument';
}
@@ -102,17 +91,14 @@ var p4 = p4 || {};
dataType: 'json',
data: data,
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback($this, data);
}
}
else
{
else {
humane.error(data.message);
}
}
@@ -131,17 +117,14 @@ var p4 = p4 || {};
dataType: 'json',
data: {},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback($this);
}
}
else
{
else {
humane.error(data.message);
}
}
@@ -157,17 +140,14 @@ var p4 = p4 || {};
dataType: 'json',
data: { name: name },
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback($this);
}
}
else
{
else {
humane.error(data.message);
}
}
@@ -183,17 +163,14 @@ var p4 = p4 || {};
dataType: 'json',
data: {},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback($this, data);
}
}
else
{
else {
humane.error(data.message);
}
}
@@ -209,17 +186,14 @@ var p4 = p4 || {};
dataType: 'json',
data: {role: role},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback($this);
}
}
else
{
else {
humane.error(data.message);
}
}
@@ -235,17 +209,14 @@ var p4 = p4 || {};
dataType: 'json',
data: {},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback($this);
}
}
else
{
else {
humane.error(data.message);
}
}
@@ -261,17 +232,14 @@ var p4 = p4 || {};
dataType: 'json',
data: {},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback($this, data);
}
}
else
{
else {
humane.error(data.message);
}
}

View File

@@ -9,8 +9,7 @@
var $this = $(this), data = $(this).data('path_file_tests');
if ( ! data )
{
if (!data) {
if (options) {
$.extend(settings, options);
}
@@ -32,8 +31,7 @@
return;
if(!$this.hasClass('required') && $.trim($this.val()) === '')
{
if (!$this.hasClass('required') && $.trim($this.val()) === '') {
el_status.css('visibility', 'hidden');
return;
}
@@ -50,22 +48,18 @@
},
success: function (data) {
el_loader.css('visibility', 'hidden');
if($this.hasClass('required'))
{
if ($this.hasClass('required')) {
$this.addClass('field_error');
}
if($this.hasClass('test_executable') && (data.executable === false || data.file !== true))
{
if ($this.hasClass('test_executable') && (data.executable === false || data.file !== true)) {
el_status.attr('src', '/skins/icons/delete.png').css('visibility', 'visible');
return;
}
if($this.hasClass('test_writeable') && data.writeable === false)
{
if ($this.hasClass('test_writeable') && data.writeable === false) {
el_status.attr('src', '/skins/icons/delete.png').css('visibility', 'visible');
return;
}
if($this.hasClass('test_readable') && data.readable === false)
{
if ($this.hasClass('test_readable') && data.readable === false) {
el_status.attr('src', '/skins/icons/delete.png').css('visibility', 'visible');
return;
}
@@ -113,8 +107,6 @@
})(jQuery);
(function ($) {
var methods = {
@@ -126,8 +118,7 @@
var $this = $(this), data = $(this).data('url_tests');
if ( ! data )
{
if (!data) {
if (options) {
$.extend(settings, options);
}
@@ -147,22 +138,18 @@
var value = $.trim($this.val());
if(!required && value === '')
{
if (!required && value === '') {
el_status.attr('src', '/skins/icons/ok.png');
return;
}
if(required && value === '')
{
if (required && value === '') {
el_status.attr('src', '/skins/icons/delete.png');
return;
}
if(same_domain && value.substring(0,1) != '/')
{
if (same_domain && value.substring(0, 1) != '/') {
value = '/' + value;
}
if(same_domain)
{
if (same_domain) {
value = location.protocol + '//' + location.hostname + value;
}
@@ -181,17 +168,14 @@
},
success: function (datas) {
el_loader.css('visibility', 'hidden');
if(datas.code === 404)
{
if (datas.code === 404) {
el_status.attr('src', '/skins/icons/delete.png');
return;
}
if(!listable && datas.code === 403)
{
if (!listable && datas.code === 403) {
el_status.attr('src', '/skins/icons/ok.png');
}
else
{
else {
el_status.attr('src', '/skins/icons/delete.png');
}
return;

View File

@@ -19,9 +19,7 @@ define([
"apps/admin/fields/views/save",
"apps/admin/fields/views/fieldError",
"apps/admin/fields/errors/errorManager"
], function(
$, _, Backbone, i18n, FieldsCollection, VocabulariesCollection,
DcFieldsCollection, FieldListView, SaveView, FieldErrorView, ErrorManager) {
], function ($, _, Backbone, i18n, FieldsCollection, VocabulariesCollection, DcFieldsCollection, FieldListView, SaveView, FieldErrorView, ErrorManager) {
var initialize = function () {
AdminFieldApp = {
$window: $(window),

View File

@@ -39,7 +39,9 @@ define([
this.$el.addClass("alert-" + this.alert).html(template).alert();
if (this.delay > 0) {
window.setTimeout(function() { self.$el.alert('close') }, this.delay);
window.setTimeout(function () {
self.$el.alert('close')
}, this.delay);
}
$(".block-alert").empty().append(this.$el);

View File

@@ -21,15 +21,18 @@ require([
}, function () {
new LoginForm({
el: $("form[name=loginForm]"),
rules: [{
rules: [
{
name: "login",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password",
rules: "required",
message: i18n.t("validation_blank")
}]
}
]
});
});
});

View File

@@ -21,15 +21,18 @@ require([
}, function () {
new ForgotPassWordForm({
el: $("form[name=forgottenPasswordForm]"),
rules: [{
rules: [
{
name: "email",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "email",
rules: "valid_email",
message: i18n.t("validation_email")
}]
}
]
});
});
});

View File

@@ -21,15 +21,18 @@ require([
}, function () {
new LoginForm({
el: $("form[name=loginForm]"),
rules: [{
rules: [
{
name: "login",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password",
rules: "required",
message: i18n.t("validation_blank")
}]
}
]
});
});
});

View File

@@ -21,15 +21,18 @@ require([
}, function () {
new LoginForm({
el: $("form[name=loginForm]"),
rules: [{
rules: [
{
name: "login",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password",
rules: "required",
message: i18n.t("validation_blank")
}]
}
]
});
});
});

View File

@@ -21,15 +21,18 @@ require([
}, function () {
new LoginForm({
el: $("form[name=loginForm]"),
rules: [{
rules: [
{
name: "login",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password",
rules: "required",
message: i18n.t("validation_blank")
}]
}
]
});
});
});

View File

@@ -21,22 +21,26 @@ require([
new RenewPassword({
el: $("form[name=passwordRenewForm]"),
rules: [{
rules: [
{
name: "password[password]",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password[password]",
rules: "min_length[5]",
message: i18n.t("validation_length_min", {
postProcess: "sprintf",
sprintf: ["5"]
})
},{
},
{
name: "password[confirm]",
rules: "matches[password[password]]",
message: i18n.t("password_match")
}]
}
]
});
});
});

View File

@@ -31,35 +31,42 @@ require([
}, function () {
Common.initialize();
var rules = [{
var rules = [
{
name: "email",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "email",
rules: "valid_email",
message: i18n.t("validation_email")
},{
},
{
name: "password[password]",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password[password]",
rules: "min_length[5]",
message: i18n.t("validation_length_min", {
postProcess: "sprintf",
sprintf: ["5"]
})
},{
},
{
name: "password[confirm]",
rules: "matches[password[password]]",
message: i18n.t("password_match")
},{
},
{
name: "accept-tou",
rules: "required",
message: i18n.t("accept_tou"),
type: "checkbox"
},{
},
{
name: "collections[]",
rules: "min_length[1]",
message: i18n.t("validation_choice_min", {
@@ -67,7 +74,8 @@ require([
sprintf: ["1"]
}),
type: "multiple"
}];
}
];
_.each(fieldsConfiguration, function (field) {
if (field.required) {

View File

@@ -30,35 +30,42 @@ require([
resGetPath: Common.languagePath,
useLocalStorage: true
}, function () {
var rules = [{
var rules = [
{
name: "email",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "email",
rules: "valid_email",
message: i18n.t("validation_email")
},{
},
{
name: "password",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password",
rules: "min_length[5]",
message: i18n.t("validation_length_min", {
postProcess: "sprintf",
sprintf: ["5"]
})
},{
},
{
name: "passwordConfirm",
rules: "matches[password]",
message: i18n.t("password_match")
},{
},
{
name: "accept-tou",
rules: "required",
message: i18n.t("accept_tou"),
type: "checkbox"
},{
},
{
name: "collections[]",
rules: "min_length[1]",
message: i18n.t("validation_choice_min", {
@@ -66,7 +73,8 @@ require([
sprintf: ["1"]
}),
type: "multiple"
}];
}
];
_.each(fieldsConfiguration, function (field) {
if (field.required) {

View File

@@ -25,23 +25,28 @@ require([
onRenderError: function (name, $el) {
$el.closest(".control-group").addClass("error");
},
rules: [{
rules: [
{
name: "form_password",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "form_email",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "form_email",
rules: "email",
message: i18n.t("validation_email")
},{
},
{
name: "form_email_confirm",
rules: "matches[form_email]",
message: i18n.t("email_match")
}]
}
]
});
});
});

View File

@@ -21,26 +21,31 @@ require([
new RenewPassword({
el: $("form[name=passwordChangeForm]"),
rules: [{
rules: [
{
name: "oldPassword",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password[password]",
rules: "required",
message: i18n.t("validation_blank")
},{
},
{
name: "password[password]",
rules: "min_length[5]",
message: i18n.t("validation_length_min", {
postProcess: "sprintf",
sprintf: ["5"]
})
},{
},
{
name: "password[confirm]",
rules: "matches[password[password]]",
message: i18n.t("password_match")
}]
}
]
});
});
});

View File

@@ -195,7 +195,9 @@ define([
},
"min_length": function (field, length) {
if (field.type === "multiple") {
return _.filter(field.value.split(","), function(value){ return value !== ""; }).length >= parseInt(length, 10)
return _.filter(field.value.split(","),function (value) {
return value !== "";
}).length >= parseInt(length, 10)
}
if (!this.Regexp.numericRegex.test(length)) {
@@ -206,7 +208,9 @@ define([
},
"max_length": function (field, length) {
if (field.type === "multiple") {
return _.filter(field.value.split(","), function(value){ return value !== ""; }).length <= parseInt(length, 10)
return _.filter(field.value.split(","),function (value) {
return value !== "";
}).length <= parseInt(length, 10)
}
if (!this.Regexp.numericRegex.test(length)) {
@@ -217,7 +221,9 @@ define([
},
"exact_length": function (field, length) {
if (field.type === "multiple") {
return _.filter(field.value.split(","), function(value){ return value !== ""; }).length === parseInt(length, 10)
return _.filter(field.value.split(","),function (value) {
return value !== "";
}).length === parseInt(length, 10)
}
if (!this.Regexp.numericRegex.test(length)) {

View File

@@ -15,7 +15,7 @@ define([
var ErrorView = Backbone.View.extend({
tagName: "div",
initialize: function (options) {
options = options || {};
options = options || {};
if (false === "name" in options) {
throw "Missing name attribute in error view";
@@ -28,7 +28,7 @@ define([
this.name = options.name;
this.errorTemplate = options.errorTemplate;
this.errors = options.errors || {};
this.errors = options.errors || {};
this.onRenderError = options.onRenderError || null;
},
render: function () {

View File

@@ -20,7 +20,7 @@ define([
"submit": "_onSubmit"
},
initialize: function (options) {
options = options || {};
options = options || {};
var self = this;

View File

@@ -16,7 +16,7 @@ define([
], function ($, _, Backbone, ErrorView, MultiViews) {
var InputView = Backbone.View.extend(_.extend({}, MultiViews, {
initialize: function (options) {
options = options || {};
options = options || {};
if (false === "name" in options) {
throw "Missing name attribute in input view";

View File

@@ -1,4 +1,5 @@
;(function (root, factory) {
;
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([''], factory);
} else {

View File

@@ -39,7 +39,8 @@ mocha.setup({
globals: ['js-fixtures']
});
console = window.console || function() {};
console = window.console || function () {
};
window.notrack = true;

View File

@@ -15,24 +15,7 @@ define([
'apps/admin/fields/views/modal',
'apps/admin/fields/views/save',
'apps/admin/fields/views/dcField'
], function(
chai,
fixtures,
$,
App,
FieldModel,
FieldCollection,
DcFieldCollection,
VocabularyCollection,
SingleItemView,
ListItemView,
AlertView,
EditView,
FieldErrorView,
ModalView,
SaveView,
DcFieldView
) {
], function (chai, fixtures, $, App, FieldModel, FieldCollection, DcFieldCollection, VocabularyCollection, SingleItemView, ListItemView, AlertView, EditView, FieldErrorView, ModalView, SaveView, DcFieldView) {
var expect = chai.expect;
var assert = chai.assert;
var should = chai.should();
@@ -175,11 +158,13 @@ define([
describe("DcField Views", function () {
beforeEach(function () {
this.collection = new DcFieldCollection([{
this.collection = new DcFieldCollection([
{
"label": "Contributor",
"definition": "An entity responsible for making contributions to the resource.",
"URI": "http://dublincore.org/documents/dces/#contributor"
}, {
},
{
"label": "Coverage",
"definition": "The spatial or temporal topic of the resource, the spatial applicability of the resource,\n or the jurisdiction under which the resource\n is relevant.",
"URI": "http://dublincore.org/documents/dces/#coverage"
@@ -339,7 +324,9 @@ define([
});
it("should reorder collection on drop action", function () {
var ui = {item: {index: function() {return 2;}}};
var ui = {item: {index: function () {
return 2;
}}};
AdminFieldApp.fieldListView.itemViews[0].dropAction({}, ui);
assert.equal(AdminFieldApp.fieldListView.collection.last().get('sorter'), 3, 'model is updated');
});

View File

@@ -5,14 +5,7 @@ define([
'common/forms/views/form',
'common/forms/views/input',
'common/forms/views/error'
], function(
chai,
fixtures,
$,
FormView,
InputView,
ErrorView
) {
], function (chai, fixtures, $, FormView, InputView, ErrorView) {
var expect = chai.expect;
var assert = chai.assert;
var should = chai.should();
@@ -23,7 +16,9 @@ define([
describe("Login Home", function () {
describe("Form View", function () {
it("should initialize validator with proper rules", function () {
var rules = [{name: "hello",rules: "simple_rules"}];
var rules = [
{name: "hello", rules: "simple_rules"}
];
var form = new FormView({
el: $('form[name=loginForm]'),
rules: rules
@@ -50,11 +45,13 @@ define([
it("should render errors on submit", function () {
var form = new FormView({
el: $('form[name=loginForm]'),
rules: [{
rules: [
{
"name": "login",
"rules": "required",
"message": "something is wrong"
}]
}
]
});
form._onSubmit(document.createEvent("Event"));

View File

@@ -9,482 +9,603 @@ define([
describe("Validator rules", function () {
beforeEach(function () {
this.validator = new Validator([{
this.validator = new Validator([
{
name: "required",
rules: "required"
},{
},
{
name: "valid_email",
rules: "valid_email"
},{
},
{
name: "equal",
rules: "equal[toto]"
},{
},
{
name: "matches",
rules: "matches[to_match]"
},{
},
{
name: "valid_emails",
rules: "valid_emails"
},{
},
{
name: "min_length",
rules: "min_length[5]"
},{
},
{
name: "max_length",
rules: "max_length[5]"
},{
},
{
name: "exact_length",
rules: "exact_length[5]"
},{
},
{
name: "greater_than",
rules: "greater_than[5]"
},{
},
{
name: "less_than",
rules: "less_than[5]"
},{
},
{
name: "alpha",
rules: "alpha"
},{
},
{
name: "alpha_numeric",
rules: "alpha_numeric"
},{
},
{
name: "alpha_dash",
rules: "alpha_dash"
},{
},
{
name: "numeric",
rules: "numeric"
},{
},
{
name: "integer",
rules: "integer"
},{
},
{
name: "decimal",
rules: "decimal"
},{
},
{
name: "is_natural",
rules: "is_natural"
},{
},
{
name: "is_natural_no_zero",
rules: "is_natural_no_zero"
},{
},
{
name: "valid_ip",
rules: "valid_ip"
},{
},
{
name: "valid_url",
rules: "valid_url"
}]);
}
]);
});
it("should detect an error if field is required and value is blank", function () {
this.validator.validate([{
this.validator.validate([
{
name: "required",
value: ""
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should detect an error if field is not a valid email", function () {
this.validator.validate([{
this.validator.validate([
{
name: "valid_email",
value: "email.not.va@"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field is a valid email", function () {
this.validator.validate([{
this.validator.validate([
{
name: "valid_email",
value: "valid@email.com"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
this.validator.validate([{
this.validator.validate([
{
name: "valid_email",
value: "valid+34@email.com"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field is not a valid emails", function () {
this.validator.validate([{
this.validator.validate([
{
name: "valid_emails",
value: "valid@email.com, email.not.va@"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field is a valid emails", function () {
this.validator.validate([{
this.validator.validate([
{
name: "valid_emails",
value: "valid32@email.com, valid2@email.com"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
this.validator.validate([{
this.validator.validate([
{
name: "valid_emails",
value: "valid@email.com"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field is not equal to default string toto", function () {
this.validator.validate([{
this.validator.validate([
{
name: "equal",
value: "tata"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field is equal to default string toto", function () {
this.validator.validate([{
this.validator.validate([
{
name: "equal",
value: "toto"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'match 'is not equal to field value 'to_match'", function () {
this.validator.validate([{
this.validator.validate([
{
name: "matches",
value: "toto"
}, {
},
{
name: "to_match",
value: "tata"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'match' is equal to field value 'to_match'", function () {
this.validator.validate([{
this.validator.validate([
{
name: "matches",
value: "toto"
}, {
},
{
name: "to_match",
value: "toto"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'min_length' is < to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "min_length",
value: "toto"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'min_length' is >= to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "min_length",
value: "totos"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'max_length' is > to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "max_length",
value: "tostos"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'max_length' is <= to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "max_length",
value: "toto"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'greater_than' is < to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "greater_than",
value: "3"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'greater_than' is > to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "greater_than",
value: "6"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'less_than' is > to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "less_than",
value: "6"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'less_than' is <= to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "less_than",
value: "3"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'exact_length' is = to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "exact_length",
value: "toto"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'exact_length' is = to 5", function () {
this.validator.validate([{
this.validator.validate([
{
name: "exact_length",
value: "totos"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'alpha' is not alpha", function () {
this.validator.validate([{
this.validator.validate([
{
name: "alpha",
value: "toto12"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'alpha' is alpha", function () {
this.validator.validate([{
this.validator.validate([
{
name: "alpha",
value: "totos"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'alpha_numeric' is not alpha numeric", function () {
this.validator.validate([{
this.validator.validate([
{
name: "alpha_numeric",
value: "toto#"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'alpha_numeric' is alpha numeric", function () {
this.validator.validate([{
this.validator.validate([
{
name: "alpha_numeric",
value: "totos12"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'numeric' is not numeric", function () {
this.validator.validate([{
this.validator.validate([
{
name: "numeric",
value: "toto"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'numeric' is numeric", function () {
this.validator.validate([{
this.validator.validate([
{
name: "numeric",
value: "123"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'integer' is not integer", function () {
this.validator.validate([{
this.validator.validate([
{
name: "integer",
value: "3.44"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'integer' is integer", function () {
this.validator.validate([{
this.validator.validate([
{
name: "integer",
value: "123"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'decimal' is not decimal", function () {
this.validator.validate([{
this.validator.validate([
{
name: "decimal",
value: "23a"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'decimal' is decimal", function () {
this.validator.validate([{
this.validator.validate([
{
name: "decimal",
value: "1.23"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
this.validator.validate([{
this.validator.validate([
{
name: "decimal",
value: "123"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'natural' is not natural", function () {
this.validator.validate([{
this.validator.validate([
{
name: "is_natural",
value: "-2"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'natural' is natural", function () {
this.validator.validate([{
this.validator.validate([
{
name: "is_natural",
value: "0"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'is_natural_no_zero' is not a natural no zero", function () {
this.validator.validate([{
this.validator.validate([
{
name: "is_natural_no_zero",
value: "0"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'is_natural_no_zero' is a natural no zero", function () {
this.validator.validate([{
this.validator.validate([
{
name: "is_natural_no_zero",
value: "1"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'valid_ip' is not a valid ip", function () {
this.validator.validate([{
this.validator.validate([
{
name: "valid_ip",
value: "12.8.1.187.2"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
this.validator.validate([{
this.validator.validate([
{
name: "valid_ip",
value: "1234.12.12"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
this.validator.validate([{
this.validator.validate([
{
name: "valid_ip",
value: "0.0"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'valid_ip' a valid ip", function () {
this.validator.validate([{
this.validator.validate([
{
name: "valid_ip",
value: "127.0.0.1"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
this.validator.validate([{
this.validator.validate([
{
name: "valid_ip",
value: "my.domain"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});
it("should detect an error if field value 'valid_url' is not a valid http url", function () {
this.validator.validate([{
this.validator.validate([
{
name: "valid_url",
value: "toto"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
this.validator.validate([{
this.validator.validate([
{
name: "valid_url",
value: "toto.123s"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
this.validator.validate([{
this.validator.validate([
{
name: "valid_url",
value: "http:/#toto.com"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
this.validator.validate([{
this.validator.validate([
{
name: "valid_url",
value: "htp:/toto.com"
}]);
}
]);
this.validator.getErrors().length.should.equal(1);
});
it("should not detect an error if field value 'valid_url' is a valid http url", function () {
this.validator.validate([{
this.validator.validate([
{
name: "valid_url",
value: "http://valid.url.com"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
this.validator.validate([{
this.validator.validate([
{
name: "valid_url",
value: "https://valid.url.com"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
this.validator.getErrors().length.should.equal(0);
this.validator.validate([{
this.validator.validate([
{
name: "valid_url",
value: "http://valid.url.com/?test=3"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
this.validator.validate([{
this.validator.validate([
{
name: "valid_url",
value: "http://valid.url.com/?test=3#salut"
}]);
}
]);
this.validator.getErrors().length.should.equal(0);
});

View File

@@ -97,7 +97,8 @@ $(document).ready(function() {
url: $this.attr("value"),
dataType: 'json',
data: {grant: $this.is(":checked") ? "1" : "0"},
success : function(data){}
success: function (data) {
}
});
});

View File

@@ -35,28 +35,24 @@ function ini_edit_usrs(){
}
);
function user_click_box(event, element, status)
{
function user_click_box(event, element, status) {
var newclass, newvalue, boxes;
var $element = $(element);
if($element.hasClass('right_access'))
{
if ($element.hasClass('right_access')) {
var base_id = $element.find('input').attr('name').split('_').pop();
boxes = $('div.base_' + base_id + ':not(:first)');
}
if((typeof status !== 'undefined' && status == 'checked') || (typeof status === 'undefined' && (($element.hasClass('mixed') === true) || ($element.hasClass('unchecked') === true))))
{
if ((typeof status !== 'undefined' && status == 'checked') || (typeof status === 'undefined' && (($element.hasClass('mixed') === true) || ($element.hasClass('unchecked') === true)))) {
newclass = 'checked';
newvalue = '1';
if (boxes)
boxes.show();
}
else
{
else {
newclass = 'unchecked';
newvalue = '0';
@@ -174,13 +170,11 @@ function ini_edit_usrs(){
boxes = $(this).closest('form').find('input.datepicker');
if(($(this).hasClass('mixed') === true) || ($(this).hasClass('unchecked') === true))
{
if (($(this).hasClass('mixed') === true) || ($(this).hasClass('unchecked') === true)) {
newclass = 'checked';
boxes.removeAttr('readonly');
}
else
{
else {
newclass = 'unchecked';
boxes.attr('readonly', 'readonly');
}
@@ -210,13 +204,11 @@ function ini_edit_usrs(){
boxes = $(this).closest('form').find('input.datepicker');
if(($(this).hasClass('mixed') === true) || ($(this).hasClass('unchecked') === true))
{
if (($(this).hasClass('mixed') === true) || ($(this).hasClass('unchecked') === true)) {
newclass = 'checked';
boxes.removeAttr('readonly');
}
else
{
else {
newclass = 'unchecked';
boxes.attr('readonly', 'readonly');
}
@@ -248,13 +240,11 @@ function ini_edit_usrs(){
boxes = $(this).closest('form').find('input:text');
if(($(this).hasClass('mixed')===true) || ($(this).hasClass('unchecked') === true))
{
if (($(this).hasClass('mixed') === true) || ($(this).hasClass('unchecked') === true)) {
newclass = 'checked';
boxes.removeAttr('readonly');
}
else
{
else {
newclass = 'unchecked';
boxes.attr('readonly', 'readonly');
}
@@ -282,16 +272,13 @@ function ini_edit_usrs(){
var bit = $(this).find('input[name="bit"]').val();
currentclass = 'unchecked';
if($(this).hasClass('mixed'))
{
if ($(this).hasClass('mixed')) {
currentclass = 'mixed';
}
if($(this).hasClass('checked'))
{
if ($(this).hasClass('checked')) {
currentclass = 'checked';
}
switch(currentclass)
{
switch (currentclass) {
case 'mixed':
default:
$('.bitnum_' + bit).removeClass('mixed checked unchecked').addClass('checked')
@@ -300,12 +287,10 @@ function ini_edit_usrs(){
$(this).removeClass('mixed checked unchecked').addClass('checked')
break;
case 'checked':
if($('.checked.bitnum_'+bit).length == 2)
{
if ($('.checked.bitnum_' + bit).length == 2) {
$(this).removeClass('mixed checked unchecked').addClass('unchecked')
}
else
{
else {
alert("admin::user:mask: vous devez cocher au moins une case pour chaque status");
return;
}
@@ -323,15 +308,12 @@ function ini_edit_usrs(){
var newbit_vand_and = newbit_vand_or = newbit_vxor_and = newbit_vxor_or = 0;
if( left.length === 1 && right.length === 1 )
{
if(left.hasClass('checked') && right.hasClass('unchecked') )
{
if (left.length === 1 && right.length === 1) {
if (left.hasClass('checked') && right.hasClass('unchecked')) {
newbit_vand_and = "1";
newbit_vand_or = "1";
}
else if( left.hasClass('unchecked') && right.hasClass('checked') )
{
else if (left.hasClass('unchecked') && right.hasClass('checked')) {
newbit_vand_and = "1";
newbit_vand_or = "1";
newbit_vxor_and = "1";
@@ -348,8 +330,7 @@ function ini_edit_usrs(){
});
function save_masks()
{
function save_masks() {
var cont = $('#masks_dialog');
var maskform = $('#masks_dialog form');
@@ -379,8 +360,7 @@ function ini_edit_usrs(){
}
function save_quotas()
{
function save_quotas() {
var cont = $('#quotas_dialog');
var base_id = $('input[name="base_id"]', cont).val();
var users = $('input[name="users"]', cont).val();
@@ -414,8 +394,7 @@ function ini_edit_usrs(){
});
}
function save_time()
{
function save_time() {
var cont = $('#time_dialog');
var dmin = $('input[name="dmin"]', cont).val();
var dmax = $('input[name="dmax"]', cont).val();
@@ -450,8 +429,7 @@ function ini_edit_usrs(){
});
}
function check_uncheck_menu(right, sbas_id, el)
{
function check_uncheck_menu(right, sbas_id, el) {
var top = el.offset().top;
var left = el.offset().left + 16;
$('body').append('<div id="users_check_uncheck" style="position:absolute;top:' + top + 'px;left:' + left + 'px;">' +
@@ -488,15 +466,13 @@ function ini_edit_usrs(){
});
}
function users_check(bool, sbas_id, right)
{
function users_check(bool, sbas_id, right) {
var newclass;
if(bool)
{
if (bool) {
newclass = "checked";
}
else
{
else {
newclass = "unchecked";
}
$('.inside_sbas_' + sbas_id + '.' + right + ':visible').each(function (i, n) {
@@ -504,4 +480,3 @@ function ini_edit_usrs(){
});
}
}

View File

@@ -6,11 +6,9 @@
$(document).ready(function () {
function users_select_this(n,k)
{
function users_select_this(n, k) {
if(p4.users.sel.length >= 800)
{
if (p4.users.sel.length >= 800) {
alert(language.max_record_selected);
return false;
}
@@ -26,12 +24,10 @@ $(document).ready(function(){
var sort = $('input', $this).val();
if ((sort == $('#users_page_form input[name="srt"]').val())
&& ($('#users_page_form input[name="ord"]').val() == 'asc'))
{
&& ($('#users_page_form input[name="ord"]').val() == 'asc')) {
var ord = 'desc';
}
else
{
else {
var ord = 'asc';
}
@@ -39,8 +35,12 @@ $(document).ready(function(){
$('#users_page_form input[name="ord"]').val(ord);
$('#users_page_form').trigger('submit');
}).live('mouseover', function(){$(this).addClass('hover');})
.live('mouseout', function(){$(this).removeClass('hover');});
}).live('mouseover', function () {
$(this).addClass('hover');
})
.live('mouseout', function () {
$(this).removeClass('hover');
});
var buttons = {};
buttons[language.create_user] = function () {
@@ -77,8 +77,7 @@ $(document).ready(function(){
}).dialog('close');
function check_new_user(is_template)
{
function check_new_user(is_template) {
var container = is_template ? $('#template_add_dialog') : $('#user_add_dialog');
$('#new_user_loader').show();
$.ajax({
@@ -94,8 +93,7 @@ $(document).ready(function(){
},
success: function (data) {
$('.new_user_loader', container).hide();
if(!data.error)
{
if (!data.error) {
if (container.data("ui-dialog")) {
container.dialog('close');
}
@@ -113,18 +111,15 @@ $(document).ready(function(){
}
});
}
else
{
else {
alert(data.message);
}
},
error:function()
{
error: function () {
alert(language.serverError);
},
timeout:function()
{
timeout: function () {
alert(language.serverTimeout);
}
});
@@ -182,20 +177,16 @@ $(document).ready(function(){
var offset_start = 0;
if($(this).hasClass('prev'))
{
if ($(this).hasClass('prev')) {
offset_start = (current_page - 2) * perPage;
}
if($(this).hasClass('first'))
{
if ($(this).hasClass('first')) {
offset_start = 0;
}
if($(this).hasClass('next'))
{
if ($(this).hasClass('next')) {
offset_start = current_page * perPage;
}
if($(this).hasClass('last'))
{
if ($(this).hasClass('last')) {
offset_start = (Math.floor(parseInt($('input[name=total_results]').val()) / perPage)) * perPage;
}
@@ -216,29 +207,24 @@ $(document).ready(function(){
var k = el.attr('id').split('_').pop();
if(is_shift_key(evt) && $('tr.last_selected', cont).length!=0)
{
if (is_shift_key(evt) && $('tr.last_selected', cont).length != 0) {
var lst = $('tr', cont);
var index1 = $.inArray($('tr.last_selected', cont)[0], lst);
var index2 = $.inArray($(el)[0], lst);
if(index2<index1)
{
if (index2 < index1) {
var tmp = index1;
index1 = (index2 - 1) < 0 ? index2 : (index2 - 1);
index2 = tmp;
}
var stopped = false;
if(index2 != -1 && index1 != -1)
{
if (index2 != -1 && index1 != -1) {
var exp = 'tr:gt(' + index1 + '):lt(' + (index2 - index1) + ')';
$.each($(exp, cont), function (i, n) {
if(!$(n).hasClass('selected'))
{
if (!$(n).hasClass('selected')) {
if(!users_select_this(n,$(n).attr('id').split('_').pop()))
{
if (!users_select_this(n, $(n).attr('id').split('_').pop())) {
stopped = true;
return false;
}
@@ -246,18 +232,14 @@ $(document).ready(function(){
});
}
if(!stopped && $.inArray(k,p4.users.sel)<0)
{
if (!stopped && $.inArray(k, p4.users.sel) < 0) {
if (!users_select_this(el, k))
return false;
}
}
else
{
if(!is_ctrl_key(evt))
{
if($.inArray(k,p4.users.sel)<0)
{
else {
if (!is_ctrl_key(evt)) {
if ($.inArray(k, p4.users.sel) < 0) {
p4.users.sel = new Array();
$('tr', cont).removeClass('selected');
@@ -265,17 +247,14 @@ $(document).ready(function(){
return false;
}
}
else
{
if($.inArray(k,p4.users.sel)>=0)
{
else {
if ($.inArray(k, p4.users.sel) >= 0) {
p4.users.sel = $.grep(p4.users.sel, function (n) {
return(n != k);
});
$(el).removeClass('selected');
}
else
{
else {
if (!users_select_this(el, k))
return false;
}
@@ -293,16 +272,14 @@ $(document).ready(function(){
$('#users_apply_template').live('submit', function () {
var users = p4.users.sel.join(';');
if(users === '')
{
if (users === '') {
return false;
}
var $this = $(this);
var template = $('select[name="template_chooser"]', $this).val();
if(template === '')
{
if (template === '') {
return false;
}
@@ -325,8 +302,7 @@ $(document).ready(function(){
$('#users_page_form .user_modifier').live('click', function () {
var users = p4.users.sel.join(';');
if(users === '')
{
if (users === '') {
return false;
}
@@ -348,8 +324,7 @@ $(document).ready(function(){
$('#users_page_form .user_deleter').live('click', function () {
var users = p4.users.sel.join(';');
if(users === '')
{
if (users === '') {
return false;
}
@@ -370,8 +345,7 @@ $(document).ready(function(){
$('#users_page .invite_modifier, #users_page .autoregister_modifier').live('click', function () {
var users = $(this).next('input').val();
if($.trim(users) === '')
{
if ($.trim(users) === '') {
return false;
}

View File

@@ -23,21 +23,18 @@ var bodySize = {x:0,y:0};
**************/
function acceptCgus(name,value)
{
function acceptCgus(name, value) {
setPref(name, value);
}
function cancelCgus(id)
{
function cancelCgus(id) {
$.ajax({
type: "POST",
url: "/prod/TOU/deny/" + id + "/",
data: {},
success: function (data) {
if(data == '1')
{
if (data == '1') {
alert(language.cgusRelog);
self.location.replace(self.location.href);
}
@@ -46,8 +43,7 @@ function cancelCgus(id)
}
function activateCgus()
{
function activateCgus() {
$('.cgu-dialog:first').dialog({
autoOpen: true,
@@ -67,8 +63,7 @@ function activateCgus()
}
});
$('.cgus-cancel', $(this)).bind('click', function () {
if(confirm(language.warningDenyCgus))
{
if (confirm(language.warningDenyCgus)) {
cancelCgus($('.cgus-cancel', currentdialog).attr('id').split('_').pop());
}
});
@@ -130,12 +125,9 @@ $(document).ready(function(){
getBaskets();
afterSearch();
$(this).bind('keydown',function(event)
{
if(p4.preview.open)
{
switch(event.keyCode)
{
$(this).bind('keydown', function (event) {
if (p4.preview.open) {
switch (event.keyCode) {
case 39:
getNext();
break;
@@ -158,10 +150,8 @@ $(document).ready(function(){
break;
}
}
else
{
switch(event.keyCode)
{
else {
switch (event.keyCode) {
case 39:
$('#NEXT_PAGE').trigger('click');
break;
@@ -204,8 +194,7 @@ function resizePreview(){
setPreview();
}
function controlPubliSize()
{
function controlPubliSize() {
$('#publications ul').height('auto');
if (50 + $('#publications ul').height() > bodySize.y)
$('#publications ul').height(bodySize.y - 50);
@@ -214,8 +203,7 @@ function controlPubliSize()
function pquit() {
if (parent.opener)
self.close();
else
{
else {
document.forms['logout'].submit();
}
@@ -253,8 +241,7 @@ function resize(){
}
bodyW = rightw;
if($('#MODALDL').is(':visible'))
{
if ($('#MODALDL').is(':visible')) {
$('#MODALDL').css({
top: ((h - $('#MODALDL').height()) / 2),
left: ((w - $('#MODALDL').width()) / 2)
@@ -366,8 +353,7 @@ function initBasketForm(){
},
success: function (data) {
baskAjaxrunning = false;
if(p4.preview.open && $.browser.msie && $.browser.version == '6.0')
{
if (p4.preview.open && $.browser.msie && $.browser.version == '6.0') {
$('select').css({
visibility: 'hidden'
});
@@ -479,8 +465,7 @@ function initAnswerForm(){
* SEARCH
**************/
function afterSearch()
{
function afterSearch() {
$('#answers').removeClass('loading');
$("#answers").scrollTop(0);
@@ -549,13 +534,11 @@ function clearAnswers(){
$("#answers").empty();
}
function newSearch()
{
function newSearch() {
$('#searchForm').submit();
}
function doSearch()
{
function doSearch() {
$('#searchForm').submit();
}
@@ -588,8 +571,7 @@ function resizeSearch(){
* Topics
**************/
function doThesSearch(type,sbid,term,field)
{
function doThesSearch(type, sbid, term, field) {
if (type == 'T')
v = '*:"' + term.replace("(", "[").replace(")", "]") + '"';
@@ -628,7 +610,6 @@ function clktri(id){
}
/*************
* CHUTIER
**************/
@@ -652,15 +633,13 @@ function evt_add_in_chutier(sbas_id, record_id){
$('#formChu').attr('action', '/client/baskets/add-element/').submit();
}
function chg_chu()
{
function chg_chu() {
var id = document.getElementById("chutier_name").value;
document.forms["formChu"].courChuId.value = id;
$("#formChu").submit();
}
function getBaskets()
{
function getBaskets() {
$('#formChu').attr("action", "/client/baskets/")
$('#formChu').submit();
}
@@ -669,8 +648,13 @@ function getBaskets()
function newBasket() {
var buttons = {};
buttons["OK"] = function(e){saveNewBask();$(this).dialog('close');};
buttons[language.annuler] = function(e){$(this).dialog('close');};
buttons["OK"] = function (e) {
saveNewBask();
$(this).dialog('close');
};
buttons[language.annuler] = function (e) {
$(this).dialog('close');
};
$('#DIALOG').empty().append("<input type='text' value='' id='newBaskName' />").attr('title', language.createWinInvite).dialog({
autoOpen: false,
@@ -786,8 +770,7 @@ function evt_print(basrec){
}
function evt_dwnl(lst)
{
function evt_dwnl(lst) {
if (typeof(lst) == 'undefined') {
if ($('#chutier_name option').length === 0) {
return false;
@@ -813,8 +796,7 @@ function evt_dwnl(lst)
});
}
function profil(value)
{
function profil(value) {
var top;
var left;
@@ -844,8 +826,7 @@ function profil(value)
showOverlay(2);
}
function setCss(color)
{
function setCss(color) {
$('#skinCss').attr('href', '/include/minify/?f=skins/common/main.css,skins/client/' + color + '/clientcolor.css,' +
'skins/client/' + color + '/ui.core.css,' +
'skins/client/' + color + '/ui.datepicker.css,' +
@@ -860,22 +841,19 @@ function setCss(color)
$('select').hide().show();
}
function lessPubli(sselid)
{
function lessPubli(sselid) {
$('#PUBLICONTMORE' + sselid + ', #PUBLICONTLESS' + sselid).toggle();
$('#PUBLICONT' + sselid).css({height: '135px'});
$('#PUBLIMORE' + sselid + ', #PUBLILESS' + sselid).toggle();
}
function morePubli(sselid)
{
function morePubli(sselid) {
$('#PUBLICONTMORE' + sselid + ', #PUBLICONTLESS' + sselid).toggle();
$('#PUBLICONT' + sselid).css({height: 'auto'});
$('#PUBLIMORE' + sselid + ', #PUBLILESS' + sselid).toggle();
}
function toggleFilter(filter,ele)
{
function toggleFilter(filter, ele) {
var el = $('#' + filter);
if (el.is(':hidden'))
$(ele).parent().addClass('open');
@@ -884,8 +862,7 @@ function toggleFilter(filter,ele)
$('#' + filter).slideToggle('fast');
}
function checkFilters()
{
function checkFilters() {
var danger = false;
var d = {};
$('.filter_danger').each(function () {
@@ -894,24 +871,21 @@ function checkFilters()
});
$('.basContTitle .base_filter :text').each(function () {
if($(this)[0].value != "")
{
if ($(this)[0].value != "") {
danger = true;
d['filter_danger' + parseInt($(this).attr('db'))] = true;
}
});
$('.basContTitle .base_filter :checkbox').each(function () {
if($(this)[0].checked)
{
if ($(this)[0].checked) {
danger = true;
d['filter_danger' + parseInt($(this).attr('db'))] = true;
}
});
$('.basContTitle .base_filter select').each(function () {
if($(this)[0].selectedIndex != 0)
{
if ($(this)[0].selectedIndex != 0) {
danger = true;
d['filter_danger' + parseInt($(this).attr('db'))] = true;
@@ -930,8 +904,7 @@ function checkFilters()
$('#filter_danger').hide();
}
function removeFilters(bas)
{
function removeFilters(bas) {
if (typeof(bas) == 'undefined') {
$('.basContTitle .base_filter :checkbox').each(function () {
$(this)[0].checked = false;
@@ -957,15 +930,11 @@ function removeFilters(bas)
checkFilters();
}
function execLastAct(lastAct)
{
if(lastAct.act)
{
switch (lastAct.act)
{
function execLastAct(lastAct) {
if (lastAct.act) {
switch (lastAct.act) {
case 'dwnl':
if(lastAct.SSTTID)
{
if (lastAct.SSTTID) {
if (baskAjaxrunning) {
setTimeout("execLastAct(lastAct);", 500);
}
@@ -974,8 +943,7 @@ function execLastAct(lastAct)
return false;
}
if($('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value != lastAct.SSTTID)
{
if ($('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value != lastAct.SSTTID) {
$('#chutier_name option').each(function (i, n) {
if (lastAct.SSTTID == this.value) {
$('#chutier_name')[0].selectedIndex = i;
@@ -987,9 +955,7 @@ function execLastAct(lastAct)
evt_dwnl();
}
}
else
if(lastAct.lst)
{
else if (lastAct.lst) {
evt_dwnl(lastAct.lst);
}
break;

View File

@@ -8,10 +8,8 @@ var bodySize = {
};
$(window).bind('beforeunload', function () {
if(p4.releasable !== false)
{
if(confirm(p4.releasable))
{
if (p4.releasable !== false) {
if (confirm(p4.releasable)) {
$('#basket_options .confirm_report').trigger('click');
}
}
@@ -25,8 +23,7 @@ $(document).ready(function(){
resize();
}).trigger('resize');
function resize()
{
function resize() {
bodySize.y = $('#mainContainer').height();
bodySize.x = $('#mainContainer').width();
@@ -77,15 +74,13 @@ $(document).ready(function(){
});
$('.right_column_title').bind('click',function () {
var title = $('.right_column_title');
if(!$('.right_column_wrapper_caption').is(':visible'))
{
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
{
else {
$('.right_column_wrapper_user').height('auto');
$('.right_column_wrapper_caption').hide();
$('.caption', title).removeClass('highlight');
@@ -94,8 +89,7 @@ $(document).ready(function(){
}).addClass('clickable');
var sselcont = $('#sc_container .basket_element:first');
if(sselcont.length > 0)
{
if (sselcont.length > 0) {
display_basket_element(false, sselcont.attr('id').split('_').pop());
}
@@ -104,8 +98,7 @@ $(document).ready(function(){
$('#navigation')
.bind('change',
function()
{
function () {
window.location.replace(window.location.protocol + "//" + window.location.host + '/lightbox/validate/' + $(this).val() + '/');
}
);
@@ -113,8 +106,7 @@ $(document).ready(function(){
});
function bind_keyboard()
{
function bind_keyboard() {
$(document).bind('keydown', function (event) {
var stop = false;
@@ -130,8 +122,7 @@ function bind_keyboard()
var el, id;
switch(event.keyCode)
{
switch (event.keyCode) {
case 39:
get_next();
cancelKey = true;
@@ -146,16 +137,14 @@ function bind_keyboard()
break;
case 38:
el = $('#sc_container .basket_element.selected');
if(el.length === 1)
{
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)
{
if (el.length === 1) {
id = el.attr('id').split('_').pop();
set_agreement(event, el, id, -1);
}
@@ -164,8 +153,7 @@ function bind_keyboard()
break;
}
if(cancelKey)
{
if (cancelKey) {
event.cancelBubble = true;
if (event.stopPropagation)
event.stopPropagation();
@@ -175,8 +163,7 @@ function bind_keyboard()
});
}
function set_release(el)
{
function set_release(el) {
$('.loader', el).css({visibility: 'visible'});
$.ajax({
type: "POST",
@@ -192,12 +179,10 @@ function set_release(el)
$('.loader', el).css({
visibility: 'hidden'
});
if(data.datas)
{
if (data.datas) {
alert(data.datas);
}
if(!data.error)
{
if (!data.error) {
p4.releasable = false;
}
@@ -206,8 +191,7 @@ function set_release(el)
});
}
function load_report()
{
function load_report() {
$.ajax({
type: "GET",
url: "/lightbox/ajax/LOAD_REPORT/" + $('#navigation').val() + "/",
@@ -225,8 +209,7 @@ function load_report()
}
function set_sizeable(container)
{
function set_sizeable(container) {
$(container).bind('mousewheel', function (event, delta) {
@@ -243,8 +226,7 @@ function set_sizeable(container)
var o_width, o_height, width, height;
if(delta > 0)
{
if (delta > 0) {
if (record.width() > 29788 || record.height() >= 29788)
return;
o_width = record.width();
@@ -252,8 +234,7 @@ function set_sizeable(container)
width = Math.round(o_width * 1.1);
height = Math.round(o_height * 1.1);
}
else
{
else {
if (record.width() < 30 || record.height() < 30)
return;
o_width = record.width();
@@ -271,9 +252,7 @@ function set_sizeable(container)
}
function display_basket()
{
function display_basket() {
var sc_wrapper = $('#sc_wrapper');
var basket_options = $('#basket_options');
@@ -309,27 +288,12 @@ function display_basket()
}
function display_basket_element(compare, sselcont_id)
{
function display_basket_element(compare, sselcont_id) {
var container;
if(compare)
{
if (compare) {
container = $('#record_compare');
}
else
{
else {
container = $('#record_main');
}
$('.record_image', container).removeAttr('ondragstart');
@@ -345,14 +309,11 @@ function display_basket_element(compare, sselcont_id)
$('.comment_button', options_container).button({
text: true
}).bind('click',function()
{
if($('.lightbox_container', container).hasClass('note_editing'))
{
}).bind('click', function () {
if ($('.lightbox_container', container).hasClass('note_editing')) {
hide_notes(container);
}
else
{
else {
show_notes(container);
}
}
@@ -378,12 +339,10 @@ function display_basket_element(compare, sselcont_id)
slideshow(false);
});
if($(document).data('slideshow'))
{
if ($(document).data('slideshow')) {
$('.play_button, .next_button.play, .previous_button.play', options_container).hide();
}
else
{
else {
$('.pause_button, .next_button.pause, .previous_button.pause', options_container).hide();
}
@@ -399,8 +358,7 @@ function display_basket_element(compare, sselcont_id)
$('#record_wrapper .agree_' + sselcont_id + ', .big_box.agree')
.bind('click',
function(event)
{
function (event) {
set_agreement(event, $(this), sselcont_id, '1');
}
)
@@ -408,23 +366,19 @@ function display_basket_element(compare, sselcont_id)
$('#record_wrapper .disagree_' + sselcont_id + ', .big_box.disagree')
.bind('click',
function(event)
{
function (event) {
set_agreement(event, $(this), sselcont_id, '-1');
}
)
.addClass('clickable');
if(compare == $('#record_wrapper').hasClass('single'))
{
if(compare)
{
if (compare == $('#record_wrapper').hasClass('single')) {
if (compare) {
$('#record_infos, #right_column').hide();
$('#record_wrapper').stop().css({width: '100%'});
display_record(compare);
}
else
{
else {
$('#record_wrapper').css({
width: ($('#innerWrapper').width() - $('#record_infos').outerWidth() - $('#right_column').outerWidth() - 2)
});
@@ -434,37 +388,31 @@ function display_basket_element(compare, sselcont_id)
}
}
else
{
else {
display_record(compare);
}
}
function set_container_status(status)
{
function set_container_status(status) {
$('#record_wrapper').removeClass('paysage portrait single').addClass(status);
}
function show_notes(container)
{
function show_notes(container) {
$('.notes_wrapper', container).animate({top: 0});
$('.lightbox_container', container).addClass('note_editing');
}
function hide_notes(container)
{
function hide_notes(container) {
$('.notes_wrapper', container).animate({top: '-100%'});
$('.lightbox_container', container).removeClass('note_editing');
}
function activate_notes(container)
{
function activate_notes(container) {
$('.note_closer', container).button({
text: true
}).bind('click',function()
{
}).bind('click', function () {
// $(this).blur();
hide_notes(container);
return false;
@@ -473,8 +421,7 @@ function activate_notes(container)
$('.note_saver', container).button({
text: true
}).bind('click',function()
{
}).bind('click', function () {
// $(this).blur();
save_note(container, this);
return false;
@@ -483,10 +430,7 @@ function activate_notes(container)
}
function download(value)
{
function download(value) {
var dialog = p4.Dialog.Create({title: typeof(language) !== 'undefined' ? language['export'] : ''});
$.post("/prod/export/multi-export/", "lst=" + value, function (data) {
@@ -504,8 +448,7 @@ function download(value)
}
function display_record(compare)
{
function display_record(compare) {
var main_container = $('#record_wrapper');
main_container.width($('#innerWrapper').innerWidth() - $('#right_column').outerWidth() - 2);
@@ -530,8 +473,7 @@ function display_record(compare)
var main_container_innerheight = main_container.innerHeight();
if(compare)
{
if (compare) {
$('.agreement_selector').show();
main_container.addClass('comparison');
@@ -571,18 +513,15 @@ function display_record(compare)
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'))
{
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()
{
function () {
set_container_status('portrait');
}
);
@@ -593,8 +532,7 @@ function display_record(compare)
compare_box,
parseInt($('#innerWrapper').width() / 2 - 13),
$('#innerWrapper').height(),
function()
{
function () {
compare_box.css('display', 'none')
.css('visibility', 'visible').show();
}
@@ -606,18 +544,15 @@ function display_record(compare)
c_height_image = compare_display_portrait.height;
dim_container = {width: double_portrait_width, height: double_portrait_height};
}
else
{
if(!main_container.hasClass('paysage'))
{
else {
if (!main_container.hasClass('paysage')) {
smooth_image = true;
smooth_transform(
main_box,
$('#innerWrapper').width(),
parseInt($('#innerWrapper').height() / 2),
function()
{
function () {
set_container_status('paysage');
}
);
@@ -628,8 +563,7 @@ function display_record(compare)
compare_box,
$('#innerWrapper').width(),
parseInt($('#innerWrapper').height() / 2),
function()
{
function () {
compare_box.css('display', 'none')
.css('visibility', 'visible')
.show();
@@ -643,16 +577,15 @@ function display_record(compare)
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(){});
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
{
else {
$('.agreement_selector').hide();
main_container.removeClass('comparison');
if(compare_box.is(':visible'))
{
if (compare_box.is(':visible')) {
compare_box.hide().css('visibility', 'hidden').css('display', 'block');
}
@@ -663,8 +596,7 @@ function display_record(compare)
, main_record_height
);
if(!main_container.hasClass('single'))
{
if (!main_container.hasClass('single')) {
main_box.width('100%')
.height('100%');
@@ -677,16 +609,14 @@ function display_record(compare)
, main_display.width
, main_display.height
, {
width : main_container_width
,height : (main_container_height - $('.header', main_box).outerHeight())
width: main_container_width, height: (main_container_height - $('.header', main_box).outerHeight())
}
);
}
}
function set_agreement(event, el, sselcont_id, boolean_value)
{
function set_agreement(event, el, sselcont_id, boolean_value) {
if (event.stopPropagation)
event.stopPropagation();
event.cancelBubble = true;
@@ -701,29 +631,24 @@ function set_agreement(event, el, sselcont_id, boolean_value)
agreement: boolean_value
},
success: function (datas) {
if(!datas.error)
{
if(boolean_value == '1')
{
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
{
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 (datas.releasable !== false) {
if (confirm(datas.releasable))
$('#basket_options .confirm_report').trigger('click');
}
}
else
{
else {
alert(datas.datas);
}
return;
@@ -732,9 +657,7 @@ function set_agreement(event, el, sselcont_id, boolean_value)
}
function get_next()
{
function get_next() {
var current_wrapper = $('#sc_container .basket_element.selected').parent();
if (current_wrapper.length === 0)
@@ -748,15 +671,13 @@ function get_next()
adjust_visibility($('.basket_element', current_wrapper));
if($(document).data('slideshow'))
{
if ($(document).data('slideshow')) {
var timer = setTimeout('get_next();', 3500);
$(document).data('slideshow_ctime', timer);
}
}
function get_prev()
{
function get_prev() {
var current_wrapper = $('#sc_container .basket_element.selected').parent();
if (current_wrapper.length === 0)
@@ -772,8 +693,7 @@ function get_prev()
adjust_visibility($('.basket_element', current_wrapper));
}
function is_viewable(el)
{
function is_viewable(el) {
var sc_wrapper = $('#sc_wrapper');
var sc_container = $('#sc_container');
@@ -791,8 +711,7 @@ function is_viewable(el)
return false;
}
function adjust_visibility(el)
{
function adjust_visibility(el) {
if (is_viewable(el))
return;
@@ -805,13 +724,11 @@ function adjust_visibility(el)
}
function slideshow(boolean_value)
{
function slideshow(boolean_value) {
if (boolean_value == $(document).data('slideshow'))
return;
if(!boolean_value && $(document).data('slideshow_ctime'))
{
if (!boolean_value && $(document).data('slideshow_ctime')) {
clearTimeout($(document).data('slideshow_ctime'));
$(document).data('slideshow_ctime', false);
}
@@ -820,24 +737,22 @@ function slideshow(boolean_value)
var headers = $('#record_wrapper .header');
if(boolean_value)
{
if (boolean_value) {
$('.play_button, .next_button.play, .previous_button.play').hide();
$('.pause_button, .next_button.pause, .previous_button.pause').show();
get_next();
}
else
{
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)
{
function smooth_transform(box, width, height, callback) {
if (typeof callback == 'undefined')
callback = function(){};
callback = function () {
};
$(box).stop()
.css(
@@ -852,8 +767,7 @@ function smooth_transform(box, width, height, callback)
callback();
}
function save_note(container, button)
{
function save_note(container, button) {
var sselcont_id = $(button).attr('id').split('_').pop();
var note = $('.notes_wrapper textarea', container).val();
@@ -874,8 +788,7 @@ function save_note(container, button)
});
}
function calculate_display(display_width, display_height, width, height, margin)
{
function calculate_display(display_width, display_height, width, height, margin) {
if (typeof margin == 'undefined')
margin = 10;
@@ -890,8 +803,7 @@ function calculate_display(display_width, display_height, width, height, margin)
w = width;
h = w / ratio;
}
else
{
else {
h = display_height - 2 * margin;
if (h > height)
h = height;
@@ -902,21 +814,19 @@ function calculate_display(display_width, display_height, width, height, margin)
}
function set_image_position(smooth, image, width, height, container, callback)
{
function set_image_position(smooth, image, width, height, container, callback) {
var dimensions = {};
if(typeof container !== 'undefined')
{
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(){};
if (typeof callback == 'undefined') {
callback = function () {
};
}
}
@@ -934,17 +844,14 @@ callback;
}
function scid_click(event, el)
{
function scid_click(event, el) {
var compare = is_ctrl_key(event);
if(compare)
{
if (compare) {
if ($('.basket_element', el).hasClass('selected'))
return;
}
else
{
else {
$('#sc_container .basket_element.selected').removeClass('selected');
$('.basket_element', el).addClass('selected');
}
@@ -955,8 +862,7 @@ function scid_click(event, el)
var container = $('#sc_container');
var request = container.data('request');
if(request && typeof(request.abort) == 'function')
{
if (request && typeof(request.abort) == 'function') {
request.abort();
}
@@ -967,12 +873,10 @@ function scid_click(event, el)
success: function (data) {
var container = false;
if(compare)
{
if (compare) {
container = $('#record_compare');
}
else
{
else {
container = $('#record_main');
$('#record_infos .lightbox_container')
@@ -1012,17 +916,14 @@ function scid_click(event, el)
}
function download_basket()
{
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)
{
function is_ctrl_key(event) {
if (event.altKey)
return true;
if (event.ctrlKey)
@@ -1039,8 +940,7 @@ function is_ctrl_key(event)
return false;
}
function is_shift_key(event)
{
function is_shift_key(event) {
if (event.shiftKey)
return true;
return false;

View File

@@ -38,19 +38,16 @@ $(document).ready(function(){
$('.basket_downloader').bind('click', function () {
download_basket();
});
if($('.right_column_wrapper_user').length > 0)
{
if ($('.right_column_wrapper_user').length > 0) {
$('.right_column_title, #right_column_validation_toggle').bind('click',function () {
if(!$('.right_column_wrapper_caption').is(':visible'))
{
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
{
else {
$('.right_column_wrapper_user').height('auto').animate({
'top': $('.right_column_title').height()
});
@@ -62,8 +59,7 @@ $(document).ready(function(){
}).addClass('clickable');
}
var sselcont = $('#sc_container .basket_element:first');
if(sselcont.length > 0)
{
if (sselcont.length > 0) {
display_basket_element(false, sselcont.attr('id').split('_').pop());
}
@@ -72,30 +68,26 @@ $(document).ready(function(){
$('#navigation')
.bind('change',
function()
{
function () {
window.location.replace(window.location.protocol + "//" + window.location.host + '/lightbox/validate/' + $(this).val() + '/');
}
);
$('#left_scroller')
.bind('click',
function()
{
function () {
scroll_elements(false);
}
);
$('#right_scroller')
.bind('click', function()
{
.bind('click', function () {
scroll_elements(true);
}
);
$(window)
.bind('resize',function()
{
.bind('resize', function () {
resize();
}
);
@@ -103,17 +95,14 @@ $(document).ready(function(){
});
$(window).bind('beforeunload', function () {
if(p4.releasable !== false)
{
if(confirm(p4.releasable))
{
if (p4.releasable !== false) {
if (confirm(p4.releasable)) {
$('#basket_options .confirm_report').trigger('click');
}
}
});
function bind_keyboard()
{
function bind_keyboard() {
$(document).bind('keydown', function (event) {
var stop = false;
@@ -127,8 +116,7 @@ function bind_keyboard()
var cancelKey = false;
var el, id;
switch(event.keyCode)
{
switch (event.keyCode) {
case 39:
get_next();
cancelKey = true;
@@ -143,16 +131,14 @@ function bind_keyboard()
break;
case 38:
el = $('#sc_container .basket_element.selected');
if(el.length === 1)
{
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)
{
if (el.length === 1) {
id = el.attr('id').split('_').pop();
set_agreement(event, el, id, -1);
}
@@ -161,8 +147,7 @@ function bind_keyboard()
break;
}
if(cancelKey)
{
if (cancelKey) {
event.cancelBubble = true;
if (event.stopPropagation)
event.stopPropagation();
@@ -172,8 +157,7 @@ function bind_keyboard()
});
}
function is_ctrl_key(event)
{
function is_ctrl_key(event) {
if (event.altKey)
return true;
if (event.ctrlKey)
@@ -190,22 +174,19 @@ function is_ctrl_key(event)
return false;
}
function is_shift_key(event)
{
function is_shift_key(event) {
if (event.shiftKey)
return true;
return false;
}
function resize()
{
function resize() {
bodySize.y = $('#mainContainer').height();
bodySize.x = $('#mainContainer').width();
display_record($('#record_compare').css('visibility') != 'hidden');
}
function set_release(el)
{
function set_release(el) {
$('.loader', el).css({
visibility: 'visible'
});
@@ -227,12 +208,10 @@ function set_release(el)
$('.loader', el).css({
visibility: 'hidden'
});
if(data.datas)
{
if (data.datas) {
alert(data.datas);
}
if(!data.error)
{
if (!data.error) {
p4.releasable = false;
}
@@ -241,8 +220,7 @@ function set_release(el)
});
}
function load_report()
{
function load_report() {
$.ajax({
type: "GET",
url: "/lightbox/ajax/LOAD_REPORT/" + $('#navigation').val() + "/",
@@ -264,8 +242,7 @@ function load_report()
});
}
function display_basket()
{
function display_basket() {
var sc_wrapper = $('#sc_wrapper');
var basket_options = $('#basket_options');
@@ -308,17 +285,14 @@ function display_basket()
}
function scid_click(event, el)
{
function scid_click(event, el) {
var compare = is_ctrl_key(event);
if(compare)
{
if (compare) {
if ($('.basket_element', el).hasClass('selected'))
return;
}
else
{
else {
$('#sc_container .basket_element.selected').removeClass('selected');
$('.basket_element', el).addClass('selected');
}
@@ -329,8 +303,7 @@ function scid_click(event, el)
var container = $('#sc_container');
var request = container.data('request');
if(request && typeof(request.abort) == 'function')
{
if (request && typeof(request.abort) == 'function') {
request.abort();
}
@@ -342,12 +315,10 @@ function scid_click(event, el)
var container = false;
var data = datas;
if(compare)
{
if (compare) {
container = $('#record_compare');
}
else
{
else {
container = $('#record_main');
$('#record_infos .lightbox_container')
@@ -386,8 +357,7 @@ function scid_click(event, el)
container.data('request', request);
}
function save_note(container, button)
{
function save_note(container, button) {
var sselcont_id = $(button).attr('id').split('_').pop();
var note = $('.notes_wrapper textarea', container).val();
@@ -409,15 +379,12 @@ function save_note(container, button)
}
function display_basket_element(compare, sselcont_id)
{
function display_basket_element(compare, sselcont_id) {
var container;
if(compare)
{
if (compare) {
container = $('#record_compare');
}
else
{
else {
container = $('#record_main');
}
$('.record_image', container).removeAttr('ondragstart');
@@ -430,15 +397,12 @@ function display_basket_element(compare, sselcont_id)
download($(this).next('form[name=download_form]').find('input').val());
});
$('.comment_button', options_container).bind('click',function()
{
$('.comment_button', options_container).bind('click', function () {
// $(this).blur();
if($('.lightbox_container', container).hasClass('note_editing'))
{
if ($('.lightbox_container', container).hasClass('note_editing')) {
hide_notes(container);
}
else
{
else {
show_notes(container);
}
}
@@ -461,12 +425,10 @@ function display_basket_element(compare, sselcont_id)
slideshow(false);
});
if($(document).data('slideshow'))
{
if ($(document).data('slideshow')) {
$('.play_button, .next_button.play, .previous_button.play', options_container).hide();
}
else
{
else {
$('.pause_button, .next_button.pause, .previous_button.pause', options_container).hide();
}
@@ -484,8 +446,7 @@ function display_basket_element(compare, sselcont_id)
$('#record_wrapper .agree_' + sselcont_id + ', .big_box.agree')
.bind('click',
function(event)
{
function (event) {
set_agreement(event, $(this), sselcont_id, '1');
}
)
@@ -493,17 +454,14 @@ function display_basket_element(compare, sselcont_id)
$('#record_wrapper .disagree_' + sselcont_id + ', .big_box.disagree')
.bind('click',
function(event)
{
function (event) {
set_agreement(event, $(this), sselcont_id, '-1');
}
)
.addClass('clickable');
if(compare == $('#record_wrapper').hasClass('single'))
{
if(compare)
{
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({
@@ -512,8 +470,7 @@ function display_basket_element(compare, sselcont_id)
display_record(compare);
$('#right_column').hide();
}
else
{
else {
// $('.agreement_selector').hide();
$('#record_wrapper').css({
right: 250
@@ -524,35 +481,30 @@ function display_basket_element(compare, sselcont_id)
}
}
else
{
else {
display_record(compare);
}
}
function show_notes(container)
{
function show_notes(container) {
$('.notes_wrapper', container).animate({
top: 0
});
$('.lightbox_container', container).addClass('note_editing');
}
function hide_notes(container)
{
function hide_notes(container) {
$('.notes_wrapper', container).animate({
top: '-100%'
});
$('.lightbox_container', container).removeClass('note_editing');
}
function activate_notes(container)
{
function activate_notes(container) {
$('.note_closer', container).button({
text: true
}).bind('click',function()
{
}).bind('click', function () {
$(this).blur();
hide_notes(container);
return false;
@@ -561,8 +513,7 @@ function activate_notes(container)
$('.note_saver', container).button({
text: true
}).bind('click',function()
{
}).bind('click', function () {
$(this).blur();
save_note(container, this);
return false;
@@ -570,8 +521,7 @@ function activate_notes(container)
);
}
function is_viewable(el)
{
function is_viewable(el) {
var sc_wrapper = $('#sc_wrapper');
var sc_container = $('#sc_container');
@@ -589,8 +539,7 @@ function is_viewable(el)
return false;
}
function adjust_visibility(el)
{
function adjust_visibility(el) {
if (is_viewable(el))
return;
@@ -604,8 +553,7 @@ function adjust_visibility(el)
});
}
function get_next()
{
function get_next() {
var current_wrapper = $('#sc_container .basket_element.selected').parent().parent();
if (current_wrapper.length === 0)
@@ -619,15 +567,13 @@ function get_next()
adjust_visibility($('.basket_element', current_wrapper));
if($(document).data('slideshow'))
{
if ($(document).data('slideshow')) {
var timer = setTimeout('get_next();', 3500);
$(document).data('slideshow_ctime', timer);
}
}
function get_prev()
{
function get_prev() {
var current_wrapper = $('#sc_container .basket_element.selected').parent().parent();
if (current_wrapper.length === 0)
@@ -644,13 +590,11 @@ function get_prev()
adjust_visibility($('.basket_element', current_wrapper));
}
function slideshow(boolean_value)
{
function slideshow(boolean_value) {
if (boolean_value == $(document).data('slideshow'))
return;
if(!boolean_value && $(document).data('slideshow_ctime'))
{
if (!boolean_value && $(document).data('slideshow_ctime')) {
clearTimeout($(document).data('slideshow_ctime'));
$(document).data('slideshow_ctime', false);
}
@@ -659,21 +603,18 @@ function slideshow(boolean_value)
var headers = $('#record_wrapper .header');
if(boolean_value)
{
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
{
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)
{
function set_sizeable(container) {
$(container).bind('mousewheel', function (event, delta) {
@@ -690,8 +631,7 @@ function set_sizeable(container)
var o_width, o_height, width, height;
if(delta > 0)
{
if (delta > 0) {
if (record.width() > 29788 || record.height() >= 29788)
return;
o_width = record.width();
@@ -699,8 +639,7 @@ function set_sizeable(container)
width = Math.round(o_width * 1.1);
height = Math.round(o_height * 1.1);
}
else
{
else {
if (record.width() < 30 || record.height() < 30)
return;
o_width = record.width();
@@ -720,8 +659,7 @@ function set_sizeable(container)
}
function set_agreement(event, el, sselcont_id, boolean_value)
{
function set_agreement(event, el, sselcont_id, boolean_value) {
if (event.stopPropagation)
event.stopPropagation();
event.cancelBubble = true;
@@ -736,29 +674,24 @@ function set_agreement(event, el, sselcont_id, boolean_value)
agreement: boolean_value
},
success: function (datas) {
if(!datas.error)
{
if(boolean_value == '1')
{
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
{
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 (datas.releasable !== false) {
if (confirm(datas.releasable))
$('#basket_options .confirm_report').trigger('click');
}
}
else
{
else {
alert(datas.datas);
}
return;
@@ -767,8 +700,7 @@ function set_agreement(event, el, sselcont_id, boolean_value)
}
function calculate_display(display_width, display_height, width, height, margin)
{
function calculate_display(display_width, display_height, width, height, margin) {
if (typeof margin == 'undefined')
margin = 10;
@@ -783,8 +715,7 @@ function calculate_display(display_width, display_height, width, height, margin)
w = width;
h = w / ratio;
}
else
{
else {
h = display_height - 2 * margin;
if (h > height)
h = height;
@@ -798,8 +729,7 @@ function calculate_display(display_width, display_height, width, height, margin)
}
function display_record(compare)
{
function display_record(compare) {
var main_container = $('#record_wrapper');
if (typeof compare == 'undefined')
@@ -821,8 +751,7 @@ function display_record(compare)
var main_container_height = main_container.height();
var main_container_innerheight = main_container.innerHeight();
if(compare)
{
if (compare) {
$('.agreement_selector').show();
main_container.addClass('comparison');
@@ -862,18 +791,15 @@ function display_record(compare)
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'))
{
if (double_portrait_surface > double_paysage_surface) {
if (!main_container.hasClass('portrait')) {
smooth_image = true;
smooth_transform(
main_box,
'50%',
'100%',
function()
{
function () {
set_container_status('portrait');
}
);
@@ -884,8 +810,7 @@ function display_record(compare)
compare_box,
'50%',
'100%',
function()
{
function () {
compare_box.css('display', 'none')
.css('visibility', 'visible')
.fadeIn();
@@ -901,18 +826,15 @@ function display_record(compare)
height: double_portrait_height
};
}
else
{
if(!main_container.hasClass('paysage'))
{
else {
if (!main_container.hasClass('paysage')) {
smooth_image = true;
smooth_transform(
main_box,
'100%',
'50%',
function()
{
function () {
set_container_status('paysage');
}
);
@@ -923,8 +845,7 @@ function display_record(compare)
compare_box,
'100%',
'50%',
function()
{
function () {
compare_box.css('display', 'none')
.css('visibility', 'visible')
.fadeIn();
@@ -941,16 +862,15 @@ function display_record(compare)
};
}
var image_callback = set_image_position(false, compare_record, c_width_image, c_height_image, dim_container, function(){});
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
{
else {
$('.agreement_selector').hide();
main_container.removeClass('comparison');
if(compare_box.is(':visible'))
{
if (compare_box.is(':visible')) {
compare_box.hide().css('visibility', 'hidden').css('display', 'block');
}
@@ -959,8 +879,7 @@ function display_record(compare)
main_record_width, main_record_height
);
if(!main_container.hasClass('single'))
{
if (!main_container.hasClass('single')) {
main_box.width('100%')
.height('100%');
@@ -973,46 +892,41 @@ function display_record(compare)
}
}
function set_container_status(status)
{
function set_container_status(status) {
$('#record_wrapper').removeClass('paysage portrait single').addClass(status);
}
function set_image_position(smooth, image, width, height, container, callback)
{
function set_image_position(smooth, image, width, height, container, callback) {
var dimensions = {};
if(typeof container !== 'undefined')
{
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(){};
if (typeof callback == 'undefined') {
callback = function () {
};
}
dimensions.width = width;
dimensions.height = height;
if(smooth)
{
if (smooth) {
$(image).stop().animate(dimensions, 500, callback);
}
else
{
else {
$(image).css(dimensions);
callback();
}
}
function smooth_transform(box, width, height, callback)
{
function smooth_transform(box, width, height, callback) {
if (typeof callback == 'undefined')
callback = function(){};
callback = function () {
};
$(box).stop()
.animate(
@@ -1026,8 +940,7 @@ function smooth_transform(box, width, height, callback)
}
function scroll_elements(boolean_value)
{
function scroll_elements(boolean_value) {
var sc_wrapper = $('#sc_wrapper');
var value;
if (boolean_value)
@@ -1041,16 +954,14 @@ function scroll_elements(boolean_value)
return;
}
function download_basket()
{
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)
{
function download(value) {
var dialog = p4.Dialog.Create({title: typeof(language) !== 'undefined' ? language['export'] : ''});
$.post("/prod/export/multi-export/", "lst=" + value, function (data) {

View File

@@ -3,7 +3,6 @@ $(document).ready(function(){
return;
$('.confirm_report').live('click', function () {
var $this = $(this);
@@ -63,23 +62,20 @@ $(document).ready(function(){
$.mobile.loading();
},
success: function (datas) {
if(!datas.error)
{
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)
{
if (datas.error) {
alert(datas.datas);
return;
}
releasable = datas.release;
}
else
{
else {
alert(datas.datas);
}
return;
@@ -109,8 +105,7 @@ $(document).ready(function(){
},
success: function (datas) {
$.mobile.loading();
if(datas.error)
{
if (datas.error) {
alert(datas.datas);
return;
}

View File

@@ -33,8 +33,7 @@
},
getContext2d: function () {
if (undefined === this.domCanva.getContext)
{
if (undefined === this.domCanva.getContext) {
return G_vmlCanvasManager
.initElement(this.domCanva)
.getContext("2d");

View File

@@ -2,18 +2,15 @@ var p4 = p4 || {};
(function (p4) {
function create_dialog()
{
if($('#p4_alerts').length === 0)
{
function create_dialog() {
if ($('#p4_alerts').length === 0) {
$('body').append('<div id="p4_alerts"></div>');
}
return $('#p4_alerts');
}
function alert(title, message, callback)
{
function alert(title, message, callback) {
var dialog = create_dialog();
var button = new Object();
@@ -45,12 +42,12 @@ var p4 = p4 || {};
}
}).dialog('open');
if(typeof callback === 'function')
{
dialog.bind( "dialogclose", function(event, ui) {callback();});
if (typeof callback === 'function') {
dialog.bind("dialogclose", function (event, ui) {
callback();
});
}
else
{
else {
}

View File

@@ -8,29 +8,24 @@ var p4 = p4 || {};
level = parseInt(level);
if(isNaN(level) || level < 1)
{
if (isNaN(level) || level < 1) {
return 1;
}
return level;
};
function getId (level)
{
function getId(level) {
return 'DIALOG' + getLevel(level);
};
function addButtons(buttons, dialog)
{
if(dialog.options.closeButton === true)
{
function addButtons(buttons, dialog) {
if (dialog.options.closeButton === true) {
buttons[language.fermer] = function () {
dialog.Close();
};
}
if(dialog.options.cancelButton === true)
{
if (dialog.options.cancelButton === true) {
buttons[language.annuler] = function () {
dialog.Close();
};
@@ -45,8 +40,7 @@ var p4 = p4 || {};
var $dialog = $('#' + getId(level));
if($dialog.length > 0)
{
if ($dialog.length > 0) {
throw 'Dialog already exists at this level';
}
@@ -81,8 +75,7 @@ var p4 = p4 || {};
this.options.buttons = addButtons(this.options.buttons, this);
switch(this.options.size)
{
switch (this.options.size) {
case 'Full':
height = bodySize.y - 30;
width = bodySize.x - 30;
@@ -114,13 +107,11 @@ var p4 = p4 || {};
zIndex = Math.min(this.level * 5000 + 5000, 32767);
var CloseCallback = function () {
if(typeof $this.options.closeCallback === 'function')
{
if (typeof $this.options.closeCallback === 'function') {
$this.options.closeCallback($this.$dialog);
}
if($this.closing === false)
{
if ($this.closing === false) {
$this.closing = true;
$this.Close();
}
@@ -147,13 +138,11 @@ var p4 = p4 || {};
})
.dialog('open').addClass('dialog-' + this.options.size);
if(this.options.loading === true)
{
if (this.options.loading === true) {
this.$dialog.addClass('loading');
}
if(this.options.size === 'Full')
{
if (this.options.size === 'Full') {
var $this = this;
$(window).unbind('resize.DIALOG' + getLevel(level))
.bind('resize.DIALOG' + getLevel(level), function () {
@@ -207,8 +196,7 @@ var p4 = p4 || {};
});
},
refresh: function () {
if(typeof this.loader === 'undefined')
{
if (typeof this.loader === 'undefined') {
throw 'Nothing to refresh';
}
this.load(this.loader.url, this.loader.method, this.loader.params);
@@ -223,8 +211,7 @@ var p4 = p4 || {};
return null;
},
setOption: function (optionName, optionValue) {
if(optionName === 'buttons')
{
if (optionName === 'buttons') {
optionValue = addButtons(optionValue, this);
}
if (this.$dialog.data("ui-dialog")) {
@@ -240,8 +227,7 @@ var p4 = p4 || {};
Dialog.prototype = {
Create: function (options, level) {
if(this.get(level) instanceof phraseaDialog)
{
if (this.get(level) instanceof phraseaDialog) {
this.get(level).Close();
}
@@ -255,8 +241,7 @@ var p4 = p4 || {};
var id = getId(level);
if(id in this.currentStack)
{
if (id in this.currentStack) {
return this.currentStack[id];
}
@@ -275,8 +260,7 @@ var p4 = p4 || {};
var id = this.get(level).getId();
if(id in this.currentStack)
{
if (id in this.currentStack) {
delete this.currentStack.id;
}
}

View File

@@ -1,4 +1,3 @@
;
(function (window) {
@@ -94,16 +93,13 @@
var usr_id = $(this).closest('tr').find('input[name="usr_id"]').val();
if($('.badge_' + usr_id, $this.container).length > 0)
{
if ($('.badge_' + usr_id, $this.container).length > 0) {
$(this).addClass('added');
}
});
return false;
});
@@ -120,14 +116,12 @@
},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
p4.Dialog.Close(1);
p4.WorkZone.refresh();
}
else
{
else {
humane.error(data.message);
}
return;
@@ -146,8 +140,7 @@
});
$('.FeedbackSend', this.container).bind('click', function () {
if($('.badges .badge', $container).length === 0)
{
if ($('.badges .badge', $container).length === 0) {
alert(language.FeedBackNoUsersSelected);
return;
}
@@ -223,12 +216,10 @@
var toggles = $('.status_off.toggle_' + feature, $badges);
if(toggles.length === 0)
{
if (toggles.length === 0) {
var toggles = $('.status_on.toggle_' + feature, $badges);
}
if(toggles.length === 0)
{
if (toggles.length === 0) {
humane.info('No user selected');
}
@@ -254,8 +245,7 @@
var url = $(this).attr('href');
var callbackList = function (list) {
for(var i in list.entries)
{
for (var i in list.entries) {
this.selectUser(list.entries[i].User);
}
};
@@ -273,8 +263,7 @@
var users = p4.Feedback.getUsers();
if(users.length === 0)
{
if (users.length === 0) {
humane.error('No users');
return false;
}
@@ -336,21 +325,17 @@
Feedback.prototype = {
selectUser: function (user) {
if(typeof user !== 'object')
{
if(window.console)
{
if (typeof user !== 'object') {
if (window.console) {
console.log('trying to select a user with wrong datas');
}
}
if($('.badge_' + user.usr_id, this.container).length > 0)
{
if ($('.badge_' + user.usr_id, this.container).length > 0) {
humane.info('User already selected');
return;
}
if(window.console)
{
if (window.console) {
console.log('Selecting', user);
}
@@ -371,8 +356,7 @@
usr_id: usr_id
},
success: function (data) {
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback.call($this, data);
}
}
@@ -386,8 +370,7 @@
url: url,
dataType: 'json',
success: function (data) {
if(typeof callback === 'function')
{
if (typeof callback === 'function') {
callback.call($this, data);
}
}
@@ -406,14 +389,12 @@
dataType: 'json',
data: $form.serializeArray(),
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
$this.selectUser(data.user);
callback();
}
else
{
else {
humane.error(data.message);
}
}
@@ -430,7 +411,6 @@
};
var ListManager = function ($container) {
this.list = null;
@@ -471,7 +451,8 @@
size: 'Medium',
title: $this.html()
};
p4.Dialog.Create(options, 2).getDomElement().addClass('loading'); },
p4.Dialog.Create(options, 2).getDomElement().addClass('loading');
},
success: function (data) {
p4.Dialog.get(2).getDomElement().removeClass('loading').empty().append(data);
return;
@@ -490,7 +471,6 @@
});
var initLeft = function () {
$('a.list_refresh', $container).bind('click', function (event) {
@@ -521,8 +501,7 @@
var name = $('input[name="name"]', p4.Dialog.get(2).getDomElement()).val();
if($.trim(name) === '')
{
if ($.trim(name) === '') {
alert(language.listNameCannotBeEmpty);
return;
}
@@ -620,13 +599,11 @@
},
success: function (data) {
if(data.success)
{
if (data.success) {
humane.info(data.message);
$('#ListManager .lists .list_refresh').trigger('click');
}
else
{
else {
humane.error(data.message);
}
return;
@@ -718,7 +695,6 @@
};
window.Feedback = Feedback;
window.ListManager = ListManager;

View File

@@ -1,8 +1,7 @@
var p4 = p4 || {};
(function (p4) {
function refreshBaskets(baskId, sort, scrolltobottom, type)
{
function refreshBaskets(baskId, sort, scrolltobottom, type) {
type = typeof type === 'undefined' ? 'basket' : type;
var active = $('#baskets .SSTT.ui-state-active');
@@ -53,8 +52,7 @@ var p4 = p4 || {};
});
}
function setTemporaryPref(name, value)
{
function setTemporaryPref(name, value) {
$.ajax({
type: "POST",
url: "/user/preferences/temporary/",
@@ -79,8 +77,7 @@ var p4 = p4 || {};
getContent(active, order);
});
function WorkZoneElementRemover(el, confirm)
{
function WorkZoneElementRemover(el, confirm) {
var context = el.data('context');
if (confirm !== true && $(el).hasClass('groupings') && p4.reg_delete) {
@@ -170,8 +167,7 @@ var p4 = p4 || {};
}
function activeBaskets()
{
function activeBaskets() {
var cache = $("#idFrameC #baskets");
cache.accordion({
@@ -200,7 +196,8 @@ var p4 = p4 || {};
b_active.not('.ui-state-active').removeClass('active');
if (uiactive.length === 0) {
return; /* everything is closed */
return;
/* everything is closed */
}
uiactive.addClass('ui-state-focus active');
@@ -278,8 +275,7 @@ var p4 = p4 || {};
}
function getContent(header, order)
{
function getContent(header, order) {
if (window.console) {
console.log('Reload content for ', header);
}
@@ -383,8 +379,7 @@ var p4 = p4 || {};
});
}
function dropOnBask(event, from, destKey, singleSelection)
{
function dropOnBask(event, from, destKey, singleSelection) {
var action = "", from = $(from), dest_uri = '', lstbr = [], sselcont = [], act = "ADD";
if (from.hasClass("CHIM")) {
@@ -506,8 +501,7 @@ var p4 = p4 || {};
});
}
function fix()
{
function fix() {
$.ajax({
type: "POST",
url: "../prod/WorkZone/attachStories/",
@@ -520,8 +514,7 @@ var p4 = p4 || {};
});
}
function unfix(link)
{
function unfix(link) {
$.ajax({
type: "POST",
url: link,
@@ -564,8 +557,7 @@ var p4 = p4 || {};
'close': function () {
var frame = $('#idFrameC'), that = this;
if (!frame.hasClass('closed'))
{
if (!frame.hasClass('closed')) {
// hide tabs content
var activeTabIdx = $('#idFrameC .tabs').tabs("option", "active");
$('#idFrameC .tabs > div:eq(' + activeTabIdx + ')').hide();
@@ -590,8 +582,7 @@ var p4 = p4 || {};
'open': function () {
var frame = $('#idFrameC');
if (frame.hasClass('closed'))
{
if (frame.hasClass('closed')) {
var width = frame.data('openwidth') ? frame.data('openwidth') : 300;
frame.css({width: width});
answerSizer();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,10 @@
function publicator_reload_publicator()
{
function publicator_reload_publicator() {
var options = $('#dialog_publicator form[name="current_datas"]').serializeArray();
var dialog = p4.Dialog.get(1);
dialog.load('/prod/bridge/manager/', 'POST', options);
}
function init_publicator(datas)
{
function init_publicator(datas) {
var dialog = p4.Dialog.Create({
size: 'Full',
title: 'Bridge',

View File

@@ -1,9 +1,7 @@
//////////////////////////////////////////////////////////////////////////////
// sprintf function for javascript
function sprintf()
{
if (!arguments || arguments.length < 1 || !RegExp)
{
function sprintf() {
if (!arguments || arguments.length < 1 || !RegExp) {
return '';
}
@@ -15,32 +13,27 @@ function sprintf()
re["$*"] = true;
var a = b = [], numSubstitutions = 0, numMatches = 0;
a = re.exec(str);
while (a)
{
while (a) {
var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
var pPrecision = a[5], pType = a[6], rightPart = a[7]; numMatches++;
var pPrecision = a[5], pType = a[6], rightPart = a[7];
numMatches++;
// alert("str:"+str + "\nl:"+leftpart + "\nr:"+rightPart);
if (pType == '%')
{
if (pType == '%') {
subst = '%';
}
else
{
else {
numSubstitutions++;
if (numSubstitutions >= arguments.length)
{
if (numSubstitutions >= arguments.length) {
alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\n' + 'for the number of substitution parameters in string (' + numSubstitutions + ' so far).');
}
var param = arguments[numSubstitutions];
var pad = '';
if (pPad && pPad.substr(0,1) == "'")
{
if (pPad && pPad.substr(0, 1) == "'") {
pad = leftpart.substr(1, 1);
}
else if (pPad)
{
else if (pPad) {
pad = pPad;
}
var justifyRight = true;
@@ -50,13 +43,11 @@ function sprintf()
if (pMinLength)
minLength = parseInt(pMinLength);
var precision = -1;
if (pPrecision && pType == 'f')
{
if (pPrecision && pType == 'f') {
precision = parseInt(pPrecision.substring(1));
}
var subst = param;
switch (pType)
{
switch (pType) {
case 'b':
subst = parseInt(param).toString(2);
break;
@@ -89,13 +80,11 @@ function sprintf()
}
var padLeft = minLength - subst.toString().length;
var padding;
if (padLeft > 0)
{
if (padLeft > 0) {
var arrTmp = new Array(padLeft + 1);
padding = arrTmp.join(pad ? pad : " ");
}
else
{
else {
padding = "";
}
}

View File

@@ -1,6 +1,4 @@
function loadXMLDoc(url, post_parms, asxml)
{
function loadXMLDoc(url, post_parms, asxml) {
if (typeof(asxml) == "undefined")
asxml = false;
out = null;
@@ -10,17 +8,14 @@ function loadXMLDoc(url, post_parms, asxml)
xmlhttp = new XMLHttpRequest();
else if (window.ActiveXObject)
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
if (xmlhttp)
{
if (xmlhttp) {
// xmlhttp.onreadystatechange=state_Change
if(post_parms)
{
if (post_parms) {
xmlhttp.open("POST", url, false);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(post_parms);
}
else
{
else {
xmlhttp.open("GET", url, false);
xmlhttp.send(null);
}
@@ -30,15 +25,13 @@ function loadXMLDoc(url, post_parms, asxml)
}
function showFound2(term, lterm, branch, depth)
{
function showFound2(term, lterm, branch, depth) {
var c;
var ret = 0;
var thb = branch.firstChild.nextSibling.nextSibling;
// branch est un <DIV ID="THE_xxx">
if(thb)
{
if (thb) {
for (c = thb.firstChild; c; c = c.nextSibling) // THE, les SY ou les TA
{
if (c.nodeName == "DIV")
@@ -47,8 +40,7 @@ function showFound2(term, lterm, branch, depth)
}
if(branch.firstChild.nextSibling.nodeValue.substr(0, lterm)==term)
{
if (branch.firstChild.nextSibling.nodeValue.substr(0, lterm) == term) {
ret = 1;
// alert(branch.firstChild.nextSibling.nodeValue + " : " + thb.id);
}
@@ -56,13 +48,11 @@ function showFound2(term, lterm, branch, depth)
// if(ret > 0)
// if(depth > 0)
// {
if(ret > 0)
{
if (ret > 0) {
//eventObj.Src0.innerHTML = "+";
thb.className = "OB";
}
else
{
else {
//eventObj.Src0.innerHTML = "+";
thb.className = "ob";
}
@@ -81,12 +71,10 @@ function showFound2(term, lterm, branch, depth)
return(ret);
}
function showAll(branch, depth)
{
function showAll(branch, depth) {
depth = parseInt(depth);
var c;
for(c=branch.firstChild; c; c=c.nextSibling)
{
for (c = branch.firstChild; c; c = c.nextSibling) {
if (c.nodeType == 1 && c.nodeName == "DIV") // 1=XML_ELEMENT_NODE
showAll(c, depth + 1);
}
@@ -94,11 +82,9 @@ function showAll(branch, depth)
if (depth > 0)
branch.style.display = "";
if(depth===0)
{
if (depth === 0) {
document.getElementById("WT1").style.visibility = "hidden";
if(document.forms["fTh"].textT1.value!=="")
{
if (document.forms["fTh"].textT1.value !== "") {
// oups! le mot a changé durant le traitement, on recommence
evt_kup_T1();
}
@@ -106,17 +92,14 @@ function showAll(branch, depth)
}
function scanTerms(inputName, zTerm, showhide)
{
function scanTerms(inputName, zTerm, showhide) {
showhide = !!showhide;
var lTerm = zTerm.length;
var zTable = document.getElementById("L" + inputName);
var zTr = zTable.childNodes; // TR's
var l = zTr.length;
var found = null;
for(var i=0; i<l; i++)
{
for (var i = 0; i < l; i++) {
// if(renum)
// zTr[i].id = inputName+"_"+i
var t = zTr[i].firstChild.firstChild.nodeValue;
@@ -124,15 +107,13 @@ function scanTerms(inputName, zTerm, showhide)
if (zTerm == t)
found = zTr[i];
if(showhide === true)
{
if (showhide === true) {
if (lTerm == 0 || (t.substr(0, lTerm) == zTerm))
zTr[i].style.display = "";
else
zTr[i].style.display = "none";
}
else
{
else {
zTr[i].style.display = "";
}
}
@@ -150,17 +131,14 @@ function addTerm(inputName, zTerm, oldid) // inputName = "TS"|"TA"|"SY"
// found = scanTerms(inputName, true, false); // renuméroter et tout afficher
var found = scanTerms(inputName, zTerm, false); // tout afficher
if(!found)
{
if (!found) {
// on cherche la div "thb" si elle existe
var thb, thRef;
for(thb=selectedThesaurusItem.firstChild; thb; thb=thb.nextSibling)
{
for (thb = selectedThesaurusItem.firstChild; thb; thb = thb.nextSibling) {
if (thb.nodeType == 1 && thb.tagName == "DIV" && thb.id.substr(0, 4) == "THB_")
break;
}
if(!thb)
{
if (!thb) {
// on ajoute le premier fils ...
// ... on crée le +/- en face du terme
selectedThesaurusItem.firstChild.className = "tri";
@@ -188,13 +166,11 @@ function addTerm(inputName, zTerm, oldid) // inputName = "TS"|"TA"|"SY"
div.id = "THE_" + nextid;
else
div.id = selectedThesaurusItem.id + "." + nextid;
if(typeof(oldid)=="undefined")
{
if (typeof(oldid) == "undefined") {
// div.oldid = "?"; // permettra de repérer les nouveaux termes
div.setAttribute("oldid", "?"); // permettra de repérer les nouveaux termes
}
else
{
else {
// div.oldid = oldid; // le terme a provient des termes candidats
div.setAttribute("oldid", oldid); // le terme a provient des termes candidats
}
@@ -235,8 +211,7 @@ function addTerm(inputName, zTerm, oldid) // inputName = "TS"|"TA"|"SY"
evt_kup(inputName);
}
function dirty()
{
function dirty() {
thesaurusChanged = true;
document.getElementById("saveButton").style.display = "";
}
@@ -363,49 +338,39 @@ function dirty()
}
*/
// supprime un terme et tous ses fils (deplace 'e plat') dans '(deleted)'
function deleteBranch(the, thb_deleted)
{
if(the.id.substr(0,4)=="THE_")
{
function deleteBranch(the, thb_deleted) {
if (the.id.substr(0, 4) == "THE_") {
var d = thb_deleted.appendChild(document.createElement("DIV"));
d.className = "s_ R_";
d.id = "TCE_R" + (thb_deleted.parentNode.id.substr(1)) + "." + (thb_deleted.parentNode.getAttribute("nextid"));
thb_deleted.parentNode.setAttribute("nextid", parseInt(thb_deleted.parentNode.getAttribute("nextid") + 1));
d.appendChild(the.firstChild.nextSibling.cloneNode(false));
d.setAttribute("oldid", the.oldid ? the.oldid : the.id.substr(4));
if(the.firstChild.nextSibling.nextSibling)
{
for(var the=the.firstChild.nextSibling.nextSibling.firstChild; the; the=the.nextSibling)
{
if (the.firstChild.nextSibling.nextSibling) {
for (var the = the.firstChild.nextSibling.nextSibling.firstChild; the; the = the.nextSibling) {
deleteBranch(the, thb_deleted);
}
}
}
}
function alertNode(n, msg)
{
function alertNode(n, msg) {
if (typeof(msg) == "undefined")
msg = "";
if(n)
{
if(n.nodeType==1)
{
if (n) {
if (n.nodeType == 1) {
alert(msg + " : <" + n.nodeName + " id='" + n.id + "'>");
}
else
{
else {
alert(msg + " : nodeType=" + n.nodeType);
}
}
else
{
else {
alert(msg + " : NULL");
}
}
function appendTerm(inputName, new_term, id)
{
function appendTerm(inputName, new_term, id) {
var tr = document.createElement("TR");
tr.id = inputName + "_" + id;
tr.className = "s_";

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,4 @@
function loadXMLDoc(url, post_parms, asxml)
{
function loadXMLDoc(url, post_parms, asxml) {
if (typeof(asxml) == "undefined")
asxml = false;
out = null;
@@ -11,17 +9,14 @@ function loadXMLDoc(url, post_parms, asxml)
else if (window.ActiveXObject)
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
if (xmlhttp)
{
if (xmlhttp) {
// xmlhttp.onreadystatechange=state_Change
if(post_parms)
{
if (post_parms) {
xmlhttp.open("POST", url, false);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(post_parms);
}
else
{
else {
xmlhttp.open("GET", url, false);
xmlhttp.send(null);
}