'.
@@ -238,40 +238,40 @@ function print_notifications(page)
// ''
- }
- });
+ }
+ });
}
function read_notifications()
{
- var notifications = [];
+ var notifications = [];
- $('#notification_box .unread').each(function(){
- notifications.push($(this).attr('id').split('_').pop());
- });
+ $('#notification_box .unread').each(function(){
+ notifications.push($(this).attr('id').split('_').pop());
+ });
- $.ajax({
- type: "POST",
- url: "/user/notifications/read/",
- data: {
- notifications:notifications.join('_')
- },
- success: function(data){
- $('#notification_trigger .counter').css('visibility','hidden').empty();
- }
- });
+ $.ajax({
+ type: "POST",
+ url: "/user/notifications/read/",
+ data: {
+ notifications:notifications.join('_')
+ },
+ success: function(data){
+ $('#notification_trigger .counter').css('visibility','hidden').empty();
+ }
+ });
}
function clear_notifications()
{
- var unread = $('#notification_box .unread');
+ var unread = $('#notification_box .unread');
- if(unread.length === 0)
- return;
+ if(unread.length === 0)
+ return;
- unread.removeClass('unread');
- $('#notification_trigger .counter').css('visibility','hidden').empty();
+ unread.removeClass('unread');
+ $('#notification_trigger .counter').css('visibility','hidden').empty();
}
@@ -283,254 +283,254 @@ function clear_notifications()
function getMyRss(renew)
{
- $.ajax({
- type: "POST",
- url: "/prod/prodFeedBack.php",
- dataType: 'json',
- data: datas,
- success: function(data){
- }
- });
+ $.ajax({
+ type: "POST",
+ url: "/prod/prodFeedBack.php",
+ dataType: 'json',
+ data: datas,
+ success: function(data){
+ }
+ });
}
function setPref(name,value)
{
- if(jQuery.data['pref_'+name] && jQuery.data['pref_'+name].abort)
- {
- jQuery.data['pref_'+name].abort();
- jQuery.data['pref_'+name] = false;
- }
+ if(jQuery.data['pref_'+name] && jQuery.data['pref_'+name].abort)
+ {
+ jQuery.data['pref_'+name].abort();
+ jQuery.data['pref_'+name] = false;
+ }
- jQuery.data['pref_'+name] = $.ajax({
- type: "POST",
- url: "/user/preferences/",
- data: {
- prop:name,
- value:value
- },
- dataType:'json',
- timeout: function(){
- jQuery.data['pref_'+name] = false;
- },
- error: function(){
- jQuery.data['pref_'+name] = false;
- },
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
- }
- else
- {
- humane.error(data.message);
- }
- jQuery.data['pref_'+name] = false;
- return;
- }
- });
+ jQuery.data['pref_'+name] = $.ajax({
+ type: "POST",
+ url: "/user/preferences/",
+ data: {
+ prop:name,
+ value:value
+ },
+ dataType:'json',
+ timeout: function(){
+ jQuery.data['pref_'+name] = false;
+ },
+ error: function(){
+ jQuery.data['pref_'+name] = false;
+ },
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ jQuery.data['pref_'+name] = false;
+ return;
+ }
+ });
}
function infoDialog(el)
{
- $("#DIALOG").attr('title','')
- .empty()
- .append(el.attr('infos'))
- .dialog({
+ $("#DIALOG").attr('title','')
+ .empty()
+ .append(el.attr('infos'))
+ .dialog({
- autoOpen:false,
- closeOnEscape:true,
- resizable:false,
- draggable:false,
- width:600,
- height:400,
- modal:true,
- overlay: {
- backgroundColor: '#000',
- opacity: 0.7
- }
- }).dialog('open').css({'overflow-x':'auto','overflow-y':'auto'});
+ autoOpen:false,
+ closeOnEscape:true,
+ resizable:false,
+ draggable:false,
+ width:600,
+ height:400,
+ modal:true,
+ overlay: {
+ backgroundColor: '#000',
+ opacity: 0.7
+ }
+ }).dialog('open').css({'overflow-x':'auto','overflow-y':'auto'});
}
function manageSession(data, showMessages)
{
- if(typeof(showMessages) == "undefined")
- showMessages = false;
+ if(typeof(showMessages) == "undefined")
+ showMessages = false;
- if(data.status == 'disconnected' || data.status == 'session')
- {
- disconnected();
- return false;
- }
- if(showMessages)
- {
- var box = $('#notification_box');
- box.empty().append(data.notifications);
+ if(data.status == 'disconnected' || data.status == 'session')
+ {
+ disconnected();
+ return false;
+ }
+ if(showMessages)
+ {
+ var box = $('#notification_box');
+ box.empty().append(data.notifications);
- if(box.is(':visible'))
- fix_notification_height();
+ if(box.is(':visible'))
+ fix_notification_height();
- if($('.notification.unread',box).length > 0)
- {
- var trigger = $('#notification_trigger') ;
- $('.counter',trigger)
- .empty()
- .append($('.notification.unread',box).length);
- $('.counter',trigger).css('visibility','visible');
+ if($('.notification.unread',box).length > 0)
+ {
+ var trigger = $('#notification_trigger') ;
+ $('.counter',trigger)
+ .empty()
+ .append($('.notification.unread',box).length);
+ $('.counter',trigger).css('visibility','visible');
- }
- else
- $('#notification_trigger .counter').css('visibility','hidden').empty();
+ }
+ else
+ $('#notification_trigger .counter').css('visibility','hidden').empty();
- 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;
+ 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++)
- {
- var sstt = $('#SSTT_'+data.changed[i]);
- if(sstt.size() === 0)
+ var main_open = false;
+ for(var i=0; i!=data.changed.length; i++)
{
- if(main_open === false)
- {
- $('#baskets .bloc').animate({'top':30}, function(){$('#baskets .alert_datas_changed:first').show()});
- main_open = true;
- }
+ 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()});
+ main_open = true;
+ }
+ }
+ else
+ {
+ if(!sstt.hasClass('active'))
+ sstt.addClass('unread');
+ else
+ {
+ $('.alert_datas_changed', $('#SSTT_content_'+data.changed[i])).show();
+ }
+ }
}
- else
- {
- if(!sstt.hasClass('active'))
- sstt.addClass('unread');
- else
- {
- $('.alert_datas_changed', $('#SSTT_content_'+data.changed[i])).show();
- }
- }
- }
- }
- if('' !== $.trim(data.message))
- {
- if($('#MESSAGE').length === 0)
- $('body').append('
');
- $('#MESSAGE')
- .empty()
- .append(data.message+' '+language.hideMessage+'
')
- .attr('title','Global Message')
- .dialog({
- autoOpen:false,
- closeOnEscape:true,
- resizable:false,
- draggable:false,
- modal:true,
- close:function()
- {
- if($('.dialog_remove:checked',$(this)).length > 0)
- setTemporaryPref('message',0);
- }
- })
- .dialog('open');
- }
- }
- return true;
+ }
+ if('' !== $.trim(data.message))
+ {
+ if($('#MESSAGE').length === 0)
+ $('body').append('
');
+ $('#MESSAGE')
+ .empty()
+ .append(data.message+' '+language.hideMessage+'
')
+ .attr('title','Global Message')
+ .dialog({
+ autoOpen:false,
+ closeOnEscape:true,
+ resizable:false,
+ draggable:false,
+ modal:true,
+ close:function()
+ {
+ if($('.dialog_remove:checked',$(this)).length > 0)
+ setTemporaryPref('message',0);
+ }
+ })
+ .dialog('open');
+ }
+ }
+ return true;
}
function disconnected()
{
- showModal('disconnected',{title:'Disconnection'});
+ showModal('disconnected',{title:'Disconnection'});
}
function showModal(cas, options){
- var content = '';
- var callback = null;
- var button = {
- "OK": function(e)
- {
- hideOverlay(3);
- $(this).dialog("close");
- return;
- }};
- var escape = true;
- var onClose = function(){};
+ var content = '';
+ var callback = null;
+ var button = {
+ "OK": function(e)
+ {
+ hideOverlay(3);
+ $(this).dialog("close");
+ return;
+ }};
+ var escape = true;
+ var onClose = function(){};
- switch (cas) {
- case 'timeout':
- content = language.serverTimeout;
- break;
- case 'error':
- content = language.serverError;
- break;
- case 'disconnected':
- content = language.serverDisconnected;
- escape=false;
- callback = function(e){ self.location.replace(self.location.href)};
- break;
- default:
- break;
- }
+ switch (cas) {
+ case 'timeout':
+ content = language.serverTimeout;
+ break;
+ case 'error':
+ content = language.serverError;
+ break;
+ case 'disconnected':
+ content = language.serverDisconnected;
+ escape=false;
+ callback = function(e){ self.location.replace(self.location.href)};
+ break;
+ default:
+ break;
+ }
- p4.Alerts(options.title, content, callback);
+ p4.Alerts(options.title, content, callback);
- return;
+ return;
}
function showOverlay(n,appendto,callback, zIndex){
- var div ="OVERLAY";
- if(typeof(n)!="undefined")
- div+=n;
- if($('#'+div).length === 0)
- {
- if(typeof(appendto)=='undefined')
- appendto = 'body';
- $(appendto).append('
');
- }
+ var div ="OVERLAY";
+ if(typeof(n)!="undefined")
+ div+=n;
+ if($('#'+div).length === 0)
+ {
+ if(typeof(appendto)=='undefined')
+ appendto = 'body';
+ $(appendto).append('
');
+ }
- var css = {
- display: 'block',
- opacity: 0,
- right:0,
- bottom:0,
- position:'absolute',
- top:0,
- zIndex:zIndex,
- left:0
- };
+ var css = {
+ display: 'block',
+ opacity: 0,
+ right:0,
+ bottom:0,
+ position:'absolute',
+ top:0,
+ zIndex:zIndex,
+ left:0
+ };
- if(parseInt(zIndex) > 0)
- css['zIndex'] = parseInt(zIndex);
+ if(parseInt(zIndex) > 0)
+ css['zIndex'] = parseInt(zIndex);
- if(typeof(callback) != 'function')
- 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'
- });
- }
+ if(typeof(callback) != 'function')
+ 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'
+ });
+ }
}
function hideDwnl(){
- hideOverlay(2);
- $('#MODALDL').css({
- 'display': 'none'
- });
+ hideOverlay(2);
+ $('#MODALDL').css({
+ 'display': 'none'
+ });
}
function hideOverlay(n){
- if ($.browser.msie && $.browser.version == '6.0') {
- $('select').css({
- visibility: 'visible'
- });
- }
- var div = "OVERLAY";
- if(typeof(n)!="undefined")
- div+=n;
- $('#'+div).hide().remove();
+ if ($.browser.msie && $.browser.version == '6.0') {
+ $('select').css({
+ visibility: 'visible'
+ });
+ }
+ var div = "OVERLAY";
+ if(typeof(n)!="undefined")
+ div+=n;
+ $('#'+div).hide().remove();
}
diff --git a/www/include/jquery.image_enhancer.js b/www/include/jquery.image_enhancer.js
index f47bd89f56..f10c5f247a 100644
--- a/www/include/jquery.image_enhancer.js
+++ b/www/include/jquery.image_enhancer.js
@@ -1,249 +1,249 @@
(function( $ ){
- var methods = {
- init : function( options ) {
- var settings = {
- 'zoomable' : false,
- 'display_full_screen' : false
- };
- return this.each(function() {
+ var methods = {
+ init : function( options ) {
+ var settings = {
+ 'zoomable' : false,
+ 'display_full_screen' : false
+ };
+ return this.each(function() {
- var $this = $(this), data = $(this).data('image_enhance');
+ var $this = $(this), data = $(this).data('image_enhance');
- if ( ! data )
- {
- if ( options ) {
- $.extend( settings, options );
- }
+ if ( ! data )
+ {
+ if ( options ) {
+ $.extend( settings, options );
+ }
- var wrapper = $('.thumb_wrapper', $(this));
- var $image =$('img', $this);
+ var wrapper = $('.thumb_wrapper', $(this));
+ var $image =$('img', $this);
- wrapper.css('position','relative');
+ wrapper.css('position','relative');
- reset_position($this);
+ reset_position($this);
- if(settings.display_full_screen)
- {
- $image.parent()
- .append('\n\
+ if(settings.display_full_screen)
+ {
+ $image.parent()
+ .append('
');
- var $titlebar = $('.image_enhance_titlebar',$this);
+ var $titlebar = $('.image_enhance_titlebar',$this);
- $('.image_enhance_title_bg',$titlebar).css('opacity',0.5);
+ $('.image_enhance_title_bg',$titlebar).css('opacity',0.5);
- $image.parent()
- .bind('mouseover.image_enhance', function(){
- $titlebar.stop().show().animate({
- 'height':28
- }, 150);
- })
- .bind('mouseout.image_enhance', function(){
- $titlebar.stop().animate({
- 'height':0
- }, 150, function(){
- $titlebar.hide()
- });
- });
+ $image.parent()
+ .bind('mouseover.image_enhance', function(){
+ $titlebar.stop().show().animate({
+ 'height':28
+ }, 150);
+ })
+ .bind('mouseout.image_enhance', function(){
+ $titlebar.stop().animate({
+ 'height':0
+ }, 150, function(){
+ $titlebar.hide()
+ });
+ });
- $('.image_enhance_titlebar .full', wrapper).bind('click.image_enhance', function(){
- $('body').append('
\n\
+ $('.image_enhance_titlebar .full', wrapper).bind('click.image_enhance', function(){
+ $('body').append('
\n\
\n\
close
\n\
\n\
');
- var $theatre = $('.image_enhance_theatre');
- var $theatre_img = $('img', $theatre);
- $(window).bind('resize.image_enhance dblclick.image_enhance',function(event){
+ var $theatre = $('.image_enhance_theatre');
+ var $theatre_img = $('img', $theatre);
+ $(window).bind('resize.image_enhance dblclick.image_enhance',function(event){
- if(event.type == 'dblclick')
- {
- $theatre_img.removeClass('zoomed');
+ if(event.type == 'dblclick')
+ {
+ $theatre_img.removeClass('zoomed');
+ }
+ else
+ {
+ if($theatre_img.hasClass('zoomed'))
+ return;
+ }
+ var datas = calculate_sizes($(this).width(), $(this).height(), image_width, image_height, 80);
+
+ $theatre_img.width(datas.width).height(datas.height).css('top',datas.top).css('left',datas.left);
+ })
+ $(window).trigger('resize.image_enhance');
+ $('.closer', $theatre).bind('click.image_enhance', function(){
+ $theatre.remove();
+ });
+
+ if(typeof $theatre.disableSelection !== 'function' && window.console)
+ console.error('enhanced image require jquery UI\'s disableSelection');
+ $('img', $theatre).disableSelection();
+ });
+ }
+
+
+ if(settings.zoomable)
+ {
+ if(typeof $image.draggable !== 'function' && window.console)
+ console.error('zoomable require jquery UI\'s draggable');
+
+ if($image.attr('ondragstart'))
+ {
+ $image.removeAttr('ondragstart');
+ }
+ $image.draggable();
+ $image.css({
+ 'max-width':'none',
+ 'max-height':'none'
+ });
+
+ var image_width = parseInt($('input[name="width"]', $this).val());
+ var image_height = parseInt($('input[name="height"]', $this).val());
+ var ratio = image_width / image_height;
+
+ $this.bind('mousewheel',function(event, delta){
+ $image.addClass('zoomed');
+ if(delta > 0)
+ {
+ event.stopPropagation();
+ zoomPreview(true, ratio, $image, $(this));
+ }
+ else
+ {
+ event.stopPropagation();
+ zoomPreview(false, ratio, $image, $(this));
+ }
+ return false;
+ }).bind('dblclick', function(event){
+ reset_position($this);
+ });
+ }
+
+ $(this).data('image_enhance', {
+ width:image_width,
+ height:image_height
+ });
}
- else
- {
- if($theatre_img.hasClass('zoomed'))
- return;
- }
- var datas = calculate_sizes($(this).width(), $(this).height(), image_width, image_height, 80);
- $theatre_img.width(datas.width).height(datas.height).css('top',datas.top).css('left',datas.left);
- })
- $(window).trigger('resize.image_enhance');
- $('.closer', $theatre).bind('click.image_enhance', function(){
- $theatre.remove();
- });
-
- if(typeof $theatre.disableSelection !== 'function' && window.console)
- console.error('enhanced image require jquery UI\'s disableSelection');
- $('img', $theatre).disableSelection();
});
- }
+ },
+ destroy : function( ) {
+ return this.each(function() {
+ $(this).data('image_enhance', null);
+ $('.image_enhance_titlebar, .image_enhance_theatre',this).remove();
+ });
+ }
+ };
+ function zoomPreview(bool, ratio, $img, $container)
+ {
+ if($img.length === 0)
+ return;
- if(settings.zoomable)
- {
- if(typeof $image.draggable !== 'function' && window.console)
- console.error('zoomable require jquery UI\'s draggable');
+ var t1 = parseInt($img.css('top'));
+ var l1 = parseInt($img.css('left'));
+ var w1 = $img.width();
+ var h1 = $img.height();
- if($image.attr('ondragstart'))
- {
- $image.removeAttr('ondragstart');
+ var w2,t2;
+
+ if(bool)
+ {
+ if((w1 * 1.08) < 32767) {
+ w2 = w1 * 1.08;
+ } else {
+ w2 = w1;
+ }
+ }
+ else
+ {
+ if((w1 / 1.08) > 20) {
+ w2 = w1 / 1.08;
+ } else {
+ w2 = w1;
}
- $image.draggable();
- $image.css({
- 'max-width':'none',
- 'max-height':'none'
- });
-
- var image_width = parseInt($('input[name="width"]', $this).val());
- var image_height = parseInt($('input[name="height"]', $this).val());
- var ratio = image_width / image_height;
-
- $this.bind('mousewheel',function(event, delta){
- $image.addClass('zoomed');
- if(delta > 0)
- {
- event.stopPropagation();
- zoomPreview(true, ratio, $image, $(this));
- }
- else
- {
- event.stopPropagation();
- zoomPreview(false, ratio, $image, $(this));
- }
- return false;
- }).bind('dblclick', function(event){
- reset_position($this);
- });
- }
-
- $(this).data('image_enhance', {
- width:image_width,
- height:image_height
- });
}
- });
- },
- destroy : function( ) {
- return this.each(function() {
- $(this).data('image_enhance', null);
- $('.image_enhance_titlebar, .image_enhance_theatre',this).remove();
- });
+ var datas = $(this).data('image_enhance');
+
+ h2 = Math.round(w2 / ratio);
+ w2 = Math.round(w2);
+
+ t2 = Math.round(t1 - (h2 - h1) / 2)+'px';
+ var l2 = Math.round(l1 - (w2 - w1) / 2)+'px';
+
+ var wPreview = $container.width()/2;
+ var hPreview = $container.height()/2;
+
+ var nt = Math.round((h2 / h1) * (t1 - hPreview) + hPreview);
+ var nl = Math.round(((w2 / w1) * (l1 - wPreview)) + wPreview);
+
+ $img.css({
+ left: nl,
+ top: nt
+ }).width(w2).height(h2);
}
- };
- function zoomPreview(bool, ratio, $img, $container)
- {
- if($img.length === 0)
- return;
-
- var t1 = parseInt($img.css('top'));
- var l1 = parseInt($img.css('left'));
- var w1 = $img.width();
- var h1 = $img.height();
-
- var w2,t2;
-
- if(bool)
+ function calculate_sizes(window_width, window_height,image_width, image_height, border)
{
- if((w1 * 1.08) < 32767) {
- w2 = w1 * 1.08;
- } else {
- w2 = w1;
- }
+ if(typeof border !== 'number')
+ border = 0;
+
+ var width, height;
+ var ratio_display = window_width / window_height;
+ var ratio_image = image_width / image_height;
+
+ if(ratio_image > ratio_display)
+ {
+ width = window_width - border;
+ height = Math.round(width / ratio_image);
+ }
+ else
+ {
+ height = window_height - border;
+ width = Math.round(height * ratio_image);
+ }
+
+ var top = Math.round((window_height - height) / 2);
+ var left = Math.round((window_width - width )/2);
+
+ return {
+ top:top,
+ left:left,
+ width:width,
+ height:height
+ };
}
- else
+
+ function reset_position($this)
{
- if((w1 / 1.08) > 20) {
- w2 = w1 / 1.08;
- } else {
- w2 = w1;
- }
+ var display_width = $this.width();
+ var display_height = $this.height();
+ var image_width = parseInt($('input[name="width"]', $this).val());
+ var image_height = parseInt($('input[name="height"]', $this).val());
+
+ var datas = calculate_sizes(display_width, display_height, image_width, image_height);
+ var $image =$('img', $this);
+
+ var top = Math.round((display_height - datas.height) / 2)+'px';
+ var left = Math.round((display_width - datas.width) / 2)+'px';
+
+ $image.width(datas.width).height(datas.height).css({top:top, left:left});
+ return;
}
- var datas = $(this).data('image_enhance');
+ $.fn.image_enhance = function(method) {
- h2 = Math.round(w2 / ratio);
- w2 = Math.round(w2);
+ if ( methods[method] ) {
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
+ } else if ( typeof method === 'object' || ! method ) {
+ return methods.init.apply( this, arguments );
+ } else {
+ $.error( 'Method ' + method + ' does not exist on jQuery.image_enhance' );
+ }
- t2 = Math.round(t1 - (h2 - h1) / 2)+'px';
- var l2 = Math.round(l1 - (w2 - w1) / 2)+'px';
- var wPreview = $container.width()/2;
- var hPreview = $container.height()/2;
-
- var nt = Math.round((h2 / h1) * (t1 - hPreview) + hPreview);
- var nl = Math.round(((w2 / w1) * (l1 - wPreview)) + wPreview);
-
- $img.css({
- left: nl,
- top: nt
- }).width(w2).height(h2);
- }
-
- function calculate_sizes(window_width, window_height,image_width, image_height, border)
- {
- if(typeof border !== 'number')
- border = 0;
-
- var width, height;
- var ratio_display = window_width / window_height;
- var ratio_image = image_width / image_height;
-
- if(ratio_image > ratio_display)
- {
- width = window_width - border;
- height = Math.round(width / ratio_image);
- }
- else
- {
- height = window_height - border;
- width = Math.round(height * ratio_image);
- }
-
- var top = Math.round((window_height - height) / 2);
- var left = Math.round((window_width - width )/2);
-
- return {
- top:top,
- left:left,
- width:width,
- height:height
};
- }
-
- function reset_position($this)
- {
- var display_width = $this.width();
- var display_height = $this.height();
- var image_width = parseInt($('input[name="width"]', $this).val());
- var image_height = parseInt($('input[name="height"]', $this).val());
-
- var datas = calculate_sizes(display_width, display_height, image_width, image_height);
- var $image =$('img', $this);
-
- var top = Math.round((display_height - datas.height) / 2)+'px';
- var left = Math.round((display_width - datas.width) / 2)+'px';
-
- $image.width(datas.width).height(datas.height).css({top:top, left:left});
- return;
- }
-
- $.fn.image_enhance = function(method) {
-
- if ( methods[method] ) {
- return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
- } else if ( typeof method === 'object' || ! method ) {
- return methods.init.apply( this, arguments );
- } else {
- $.error( 'Method ' + method + ' does not exist on jQuery.image_enhance' );
- }
-
-
- };
})( jQuery );
diff --git a/www/include/jquery.kb-event.js b/www/include/jquery.kb-event.js
index c1e4320fbd..18505af160 100644
--- a/www/include/jquery.kb-event.js
+++ b/www/include/jquery.kb-event.js
@@ -2,25 +2,25 @@
function is_ctrl_key(event)
{
- if(event.altKey)
- return true;
- if(event.ctrlKey)
- return true;
- if(event.metaKey) // apple key opera
- return true;
- if(event.keyCode == '17') // apple key opera
- return true;
- if(event.keyCode == '224') // apple key mozilla
- return true;
- if(event.keyCode == '91') // apple key safari
- return true;
+ if(event.altKey)
+ return true;
+ if(event.ctrlKey)
+ return true;
+ if(event.metaKey) // apple key opera
+ return true;
+ if(event.keyCode == '17') // apple key opera
+ return true;
+ if(event.keyCode == '224') // apple key mozilla
+ return true;
+ if(event.keyCode == '91') // apple key safari
+ return true;
- return false;
+ return false;
}
function is_shift_key(event)
{
- if(event.shiftKey)
- return true;
- return false;
+ if(event.shiftKey)
+ return true;
+ return false;
}
diff --git a/www/include/jquery.nicoslider.js b/www/include/jquery.nicoslider.js
index 38207f0d03..d0d9c4eece 100644
--- a/www/include/jquery.nicoslider.js
+++ b/www/include/jquery.nicoslider.js
@@ -1,144 +1,144 @@
(function($){
- $.fn.nicoslider = function(options)
- {
- var defaults = {
- start : 0,
- color : '#F6F2F1',
- sliderHeight : false
- };
+ $.fn.nicoslider = function(options)
+ {
+ var defaults = {
+ start : 0,
+ color : '#F6F2F1',
+ sliderHeight : false
+ };
- var opts = $.extend({}, $.fn.nicoslider.defaults,defaults, options);
+ var opts = $.extend({}, $.fn.nicoslider.defaults,defaults, options);
- return this.each(function(){
- new nicoslide(this, opts);
- });
- };
+ return this.each(function(){
+ new nicoslide(this, opts);
+ });
+ };
- var nicoslide = function(slider, o)
- {
- var $slider = $(slider);
+ var nicoslide = function(slider, o)
+ {
+ var $slider = $(slider);
- $sliderWidth = $slider.parent().innerWidth();
+ $sliderWidth = $slider.parent().innerWidth();
- $sliderCss = {
- 'width':$sliderWidth,
- 'background-color':o.color
- };
+ $sliderCss = {
+ 'width':$sliderWidth,
+ 'background-color':o.color
+ };
- $slider.css($sliderCss);
+ $slider.css($sliderCss);
- var ul = $slider.find("ul");
- var ulWidth = 0;
- var liHeight = 0;
+ var ul = $slider.find("ul");
+ var ulWidth = 0;
+ var liHeight = 0;
- $slider.find("li").each(function(){
- ulWidth += $(this).width() + 5;
- ulWidth += parseInt($(this).css("padding-left"));
- ulWidth += parseInt($(this).css("padding-right"));
- ulWidth += parseInt($(this).css("margin-left"));
- ulWidth += parseInt($(this).css("margin-right"));
- liHeight = Math.max(liHeight,$(this).outerHeight());
- });
- //5 % of slider width
- $scrollWidth = Math.round(parseInt($sliderWidth) * parseFloat("0.05"));
- //min 30 px;
- if($scrollWidth < 30)
- {
- $scrollWidth = 30;
- }
+ $slider.find("li").each(function(){
+ ulWidth += $(this).width() + 5;
+ ulWidth += parseInt($(this).css("padding-left"));
+ ulWidth += parseInt($(this).css("padding-right"));
+ ulWidth += parseInt($(this).css("margin-left"));
+ ulWidth += parseInt($(this).css("margin-right"));
+ liHeight = Math.max(liHeight,$(this).outerHeight());
+ });
+ //5 % of slider width
+ $scrollWidth = Math.round(parseInt($sliderWidth) * parseFloat("0.05"));
+ //min 30 px;
+ if($scrollWidth < 30)
+ {
+ $scrollWidth = 30;
+ }
- var $wrapperWidth = Math.round(parseInt($sliderWidth) - ( 2 * $scrollWidth ));
+ var $wrapperWidth = Math.round(parseInt($sliderWidth) - ( 2 * $scrollWidth ));
- if(ulWidth > $wrapperWidth)
- {
- ul.wrapAll("
");
- $wrapper = $slider.find(".wrapper");
- $ulHeight = ul.height();
- $wrapper.width($wrapperWidth);
- $wrapper.height($ulHeight);
+ if(ulWidth > $wrapperWidth)
+ {
+ ul.wrapAll("
");
+ $wrapper = $slider.find(".wrapper");
+ $ulHeight = ul.height();
+ $wrapper.width($wrapperWidth);
+ $wrapper.height($ulHeight);
- $wrapperCss= {
- 'overflow':'hidden',
- 'float':'left',
- 'position':'relative'
- };
+ $wrapperCss= {
+ 'overflow':'hidden',
+ 'float':'left',
+ 'position':'relative'
+ };
- $wrapper.css($wrapperCss);
- ul.css('position', 'absolute');
- ul.width(ulWidth);
- $slider.prepend("
");
- $slider.append("
");
+ $wrapper.css($wrapperCss);
+ ul.css('position', 'absolute');
+ ul.width(ulWidth);
+ $slider.prepend("
");
+ $slider.append("
");
- var rightScroll = $slider.find(".scrollright");
- var leftScroll = $slider.find(".scrollleft");
+ var rightScroll = $slider.find(".scrollright");
+ var leftScroll = $slider.find(".scrollleft");
- rightScroll.append("
>
");
- leftScroll.append("
<
");
+ rightScroll.append("
>
");
+ leftScroll.append("
<
");
- $("div.rb").css('float', 'right');
+ $("div.rb").css('float', 'right');
- rightCss = {
- 'width' : $scrollWidth - ($wrapper.outerWidth(true) - $wrapper.innerWidth()),
- 'height' : liHeight + 5,
- 'float' : 'right',
- 'background-color' : o.color,
- 'cursor': 'pointer',
- ' user-select': 'none'
- };
+ rightCss = {
+ 'width' : $scrollWidth - ($wrapper.outerWidth(true) - $wrapper.innerWidth()),
+ 'height' : liHeight + 5,
+ 'float' : 'right',
+ 'background-color' : o.color,
+ 'cursor': 'pointer',
+ ' user-select': 'none'
+ };
- leftCss = {
- 'width' : $scrollWidth - ($wrapper.outerWidth(true) - $wrapper.innerWidth()),
- 'height' : liHeight + 5,
- 'float' : 'left',
- 'background-color' : o.color,
- 'cursor': 'pointer',
- ' user-select': 'none'
- };
+ leftCss = {
+ 'width' : $scrollWidth - ($wrapper.outerWidth(true) - $wrapper.innerWidth()),
+ 'height' : liHeight + 5,
+ 'float' : 'left',
+ 'background-color' : o.color,
+ 'cursor': 'pointer',
+ ' user-select': 'none'
+ };
- leftScroll.css(leftCss);
- rightScroll.css(rightCss);
+ leftScroll.css(leftCss);
+ rightScroll.css(rightCss);
- var rightScrollWidth = rightScroll.width();
- var leftScrollWidth = leftScroll.width();
- var scrollXpos = 0;
- var scrollStepSpeed = 40;
- var speed = 8;
- var shift = o.start;
+ var rightScrollWidth = rightScroll.width();
+ var leftScrollWidth = leftScroll.width();
+ var scrollXpos = 0;
+ var scrollStepSpeed = 40;
+ var speed = 8;
+ var shift = o.start;
- //scroll a droite
- rightScroll.bind("click", function(e){
- var x = e.pageX - ($(this).offset().left);
- scrollXpos = Math.round((x / rightScrollWidth) * scrollStepSpeed);
- shift += (scrollXpos * speed);
+ //scroll a droite
+ rightScroll.bind("click", function(e){
+ var x = e.pageX - ($(this).offset().left);
+ scrollXpos = Math.round((x / rightScrollWidth) * scrollStepSpeed);
+ shift += (scrollXpos * speed);
- if(shift > (ulWidth - $wrapperWidth) + 50)
- {
- shift = (ulWidth - $wrapperWidth) + 50;
- }
- ul.animate({
- left: -shift
- }, 1);
- });
+ if(shift > (ulWidth - $wrapperWidth) + 50)
+ {
+ shift = (ulWidth - $wrapperWidth) + 50;
+ }
+ ul.animate({
+ left: -shift
+ }, 1);
+ });
- //scroll a gauche
- leftScroll.bind("click", function(e){
- var x = $(this).innerWidth() - (e.pageX - $(this).offset().left);
+ //scroll a gauche
+ leftScroll.bind("click", function(e){
+ var x = $(this).innerWidth() - (e.pageX - $(this).offset().left);
- scrollXpos = Math.round((x / leftScrollWidth) * scrollStepSpeed);
- shift -= (scrollXpos * speed);
+ scrollXpos = Math.round((x / leftScrollWidth) * scrollStepSpeed);
+ shift -= (scrollXpos * speed);
- if(shift < 0)
- {
- shift = 0;
- }
+ if(shift < 0)
+ {
+ shift = 0;
+ }
- ul.animate({
- left: -shift
- }, 1);
+ ul.animate({
+ left: -shift
+ }, 1);
- });
- }
- };
-})(jQuery);
\ No newline at end of file
+ });
+ }
+ };
+})(jQuery);
diff --git a/www/include/jquery.p4.modal.js b/www/include/jquery.p4.modal.js
index 1c8b7b6935..752fb33498 100644
--- a/www/include/jquery.p4.modal.js
+++ b/www/include/jquery.p4.modal.js
@@ -1,17 +1,17 @@
$(document).ready(function(){
- $('#tabs').tabs();
- $('input.input-button').hover(
- function(){parent.$(this).addClass('hover');},
- function(){parent.$(this).removeClass('hover');}
- );
- $(this).bind('keydown',function(event){
- switch(event.keyCode)
- {
- case 27:
- parent.hideDwnl();
- break;
- default:
- break;
- }
- });
-});
\ No newline at end of file
+ $('#tabs').tabs();
+ $('input.input-button').hover(
+ function(){parent.$(this).addClass('hover');},
+ function(){parent.$(this).removeClass('hover');}
+ );
+ $(this).bind('keydown',function(event){
+ switch(event.keyCode)
+ {
+ case 27:
+ parent.hideDwnl();
+ break;
+ default:
+ break;
+ }
+ });
+});
diff --git a/www/include/jquery.p4.preview.js b/www/include/jquery.p4.preview.js
index 69b9e62a6d..a59c30f420 100644
--- a/www/include/jquery.p4.preview.js
+++ b/www/include/jquery.p4.preview.js
@@ -3,480 +3,480 @@ prevAjaxrunning = false;
p4.slideShow = false;
$(document).ready(function(){
- $('#PREVIEWIMGDESC').tabs();
+ $('#PREVIEWIMGDESC').tabs();
});
function getNewVideoToken(lst, obj)
{
- $.ajax({
- type: "POST",
- url: "../prod/records/renew-url/",
- dataType: 'json',
- data: {
- lst: lst
- },
- success: function(data){
- if(!data[lst])
- return;
- obj.unload();
- obj.setClip({url:data[lst]});
- obj.play();
- return;
- }
+ $.ajax({
+ type: "POST",
+ url: "../prod/records/renew-url/",
+ dataType: 'json',
+ data: {
+ lst: lst
+ },
+ success: function(data){
+ if(!data[lst])
+ return;
+ obj.unload();
+ obj.setClip({url:data[lst]});
+ obj.play();
+ return;
+ }
- });
+ });
}
function openPreview(env, pos, contId, reload){
- if (contId == undefined)
- contId = '';
- var roll = 0;
- var justOpen = false;
+ if (contId == undefined)
+ contId = '';
+ var roll = 0;
+ var justOpen = false;
- if (!p4.preview.open) {
- showOverlay();
+ if (!p4.preview.open) {
+ showOverlay();
- $('#PREVIEWIMGCONT').disableSelection();
+ $('#PREVIEWIMGCONT').disableSelection();
- justOpen = true;
+ justOpen = true;
- if (!$.browser.msie) {
- $('#PREVIEWBOX').css({
- 'display': 'block',
- 'opacity': 0
- }).fadeTo(500, 1);
- }else
- {
- $('#PREVIEWBOX').css({
- 'display': 'block',
- 'opacity': 1
- });
- }
- p4.preview.open = true;
- p4.preview.nCurrent = 5;
- $('#PREVIEWCURRENT, #PREVIEWOTHERSINNER, #SPANTITLE').empty();
- resizePreview();
- if(env == 'BASK')
- roll = 1;
+ if (!$.browser.msie) {
+ $('#PREVIEWBOX').css({
+ 'display': 'block',
+ 'opacity': 0
+ }).fadeTo(500, 1);
+ }else
+ {
+ $('#PREVIEWBOX').css({
+ 'display': 'block',
+ 'opacity': 1
+ });
+ }
+ p4.preview.open = true;
+ p4.preview.nCurrent = 5;
+ $('#PREVIEWCURRENT, #PREVIEWOTHERSINNER, #SPANTITLE').empty();
+ resizePreview();
+ if(env == 'BASK')
+ roll = 1;
- }
+ }
- if(reload === true)
- roll = 1;
+ if(reload === true)
+ roll = 1;
- $('#tooltip').css({
- 'display': 'none'
- });
+ $('#tooltip').css({
+ 'display': 'none'
+ });
- $('#PREVIEWIMGCONT').empty();
+ $('#PREVIEWIMGCONT').empty();
- var options_serial = p4.tot_options;
- var query = p4.tot_query;
+ var options_serial = p4.tot_options;
+ var query = p4.tot_query;
- prevAjax = $.ajax({
- type: "POST",
- url: "../prod/records/",
- dataType: 'json',
- data: {
- env: env,
- pos: pos,
- cont: contId,
- roll: roll,
- options_serial:options_serial,
- query:query
- },
- beforeSend: function(){
- if (prevAjaxrunning)
- prevAjax.abort();
- if(env == 'RESULT')
- $('#current_result_n').empty().append(parseInt(pos)+1);
- prevAjaxrunning = true;
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').addClass('loading');
- },
- error: function(data){
- prevAjaxrunning = false;
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
- posAsk = null;
- },
- timeout: function(){
- prevAjaxrunning = false;
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
- posAsk = null;
- },
- success: function(data){
- cancelPreview();
- prevAjaxrunning = false;
- posAsk = null;
+ prevAjax = $.ajax({
+ type: "POST",
+ url: "../prod/records/",
+ dataType: 'json',
+ data: {
+ env: env,
+ pos: pos,
+ cont: contId,
+ roll: roll,
+ options_serial:options_serial,
+ query:query
+ },
+ beforeSend: function(){
+ if (prevAjaxrunning)
+ prevAjax.abort();
+ if(env == 'RESULT')
+ $('#current_result_n').empty().append(parseInt(pos)+1);
+ prevAjaxrunning = true;
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').addClass('loading');
+ },
+ error: function(data){
+ prevAjaxrunning = false;
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
+ posAsk = null;
+ },
+ timeout: function(){
+ prevAjaxrunning = false;
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
+ posAsk = null;
+ },
+ success: function(data){
+ cancelPreview();
+ prevAjaxrunning = false;
+ posAsk = null;
- if(data.error)
- {
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
- alert(data.error);
- if(justOpen)
- closePreview();
- return;
- }
- posAsk = data.pos - 1;
+ if(data.error)
+ {
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
+ alert(data.error);
+ if(justOpen)
+ closePreview();
+ return;
+ }
+ posAsk = data.pos - 1;
- $('#PREVIEWIMGCONT').empty().append(data.html_preview);
- $('#PREVIEWIMGCONT .thumb_wrapper')
- .width('100%').height('100%').image_enhance({zoomable:true});
+ $('#PREVIEWIMGCONT').empty().append(data.html_preview);
+ $('#PREVIEWIMGCONT .thumb_wrapper')
+ .width('100%').height('100%').image_enhance({zoomable:true});
- $('#PREVIEWIMGDESCINNER').empty().append(data.desc);
- $('#HISTORICOPS').empty().append(data.history);
- $('#popularity').empty().append(data.popularity);
+ $('#PREVIEWIMGDESCINNER').empty().append(data.desc);
+ $('#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 )
- {
- $( '#popularity .bitly_link_' + result.userHash ).append( ' (' + result.clicks + ' clicks)');
- }
- };
- BitlyClient.stats($('#popularity .bitly_link').html(), 'BitlyCB.statsResponse');
- }
+ BitlyCB.statsResponse = function(data) {
+ var result = data.results;
+ if( $( '#popularity .bitly_link_' + result.userHash ).length > 0 )
+ {
+ $( '#popularity .bitly_link_' + result.userHash ).append( ' (' + result.clicks + ' clicks)');
+ }
+ };
+ BitlyClient.stats($('#popularity .bitly_link').html(), 'BitlyCB.statsResponse');
+ }
- p4.preview.current = {};
- p4.preview.current.width = parseInt($('#PREVIEWIMGCONT input[name=width]').val());
- p4.preview.current.height = parseInt($('#PREVIEWIMGCONT input[name=height]').val());
- p4.preview.current.tot = data.tot;
- p4.preview.current.pos = data.pos;
+ p4.preview.current = {};
+ p4.preview.current.width = parseInt($('#PREVIEWIMGCONT input[name=width]').val());
+ p4.preview.current.height = parseInt($('#PREVIEWIMGCONT input[name=height]').val());
+ p4.preview.current.tot = data.tot;
+ p4.preview.current.pos = data.pos;
- if($('#PREVIEWBOX img.record.zoomable').length > 0)
- {
- $('#PREVIEWBOX img.record.zoomable').draggable();
- }
+ if($('#PREVIEWBOX img.record.zoomable').length > 0)
+ {
+ $('#PREVIEWBOX img.record.zoomable').draggable();
+ }
- setTitle(data.title);
- setPreview();
+ setTitle(data.title);
+ setPreview();
- if(env != 'RESULT')
- {
- setCurrent(data.current);
- viewCurrent($('#PREVIEWCURRENT li.selected'));
- }
- 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]))
- {
- getAnswerTrain(pos, data.tools, query,options_serial);
- }
+ if(env != 'RESULT')
+ {
+ setCurrent(data.current);
+ viewCurrent($('#PREVIEWCURRENT li.selected'));
+ }
+ 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]))
+ {
+ getAnswerTrain(pos, data.tools, query,options_serial);
+ }
- viewCurrent($('#PREVIEWCURRENT li.selected'));
- }
- if(env == 'REG' && $('#PREVIEWCURRENT').html() === '')
- {
- getRegTrain(contId,pos,data.tools);
- }
- setOthers(data.others);
- setTools(data.tools);
- $('#tooltip').css({
- 'display': 'none'
- });
- $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
- if(!justOpen || (p4.preview.mode != env))
- resizePreview();
+ viewCurrent($('#PREVIEWCURRENT li.selected'));
+ }
+ if(env == 'REG' && $('#PREVIEWCURRENT').html() === '')
+ {
+ getRegTrain(contId,pos,data.tools);
+ }
+ setOthers(data.others);
+ setTools(data.tools);
+ $('#tooltip').css({
+ 'display': 'none'
+ });
+ $('#PREVIEWIMGDESC, #PREVIEWOTHERS').removeClass('loading');
+ if(!justOpen || (p4.preview.mode != env))
+ resizePreview();
- p4.preview.mode = env;
- $('#EDIT_query').focus();
+ p4.preview.mode = env;
+ $('#EDIT_query').focus();
- $('#PREVIEWOTHERSINNER .otherBaskToolTip').tooltip();
+ $('#PREVIEWOTHERSINNER .otherBaskToolTip').tooltip();
- return;
- }
+ return;
+ }
- });
+ });
}
function zoomPreview(bool){
- var el = $('#PREVIEWIMGCONT img.record');
+ var el = $('#PREVIEWIMGCONT img.record');
- if(el.length === 0)
- return;
+ if(el.length === 0)
+ return;
- var t1 = parseInt(el.css('top'));
- var l1 = parseInt(el.css('left'));
- var w1 = el.width();
- var h1 = el.height();
+ var t1 = parseInt(el.css('top'));
+ var l1 = parseInt(el.css('left'));
+ var w1 = el.width();
+ var h1 = el.height();
- var w2,t2;
+ var w2,t2;
- if(bool)
- {
- if(w1 * 1.08 < 32767)
- w2 = w1 * 1.08;
- else
- w2 = w1;
- }
- else
- {
- if(w1 / 1.08 > 20)
- w2 = w1 / 1.08;
- else
- w2 = w1;
- }
+ if(bool)
+ {
+ if(w1 * 1.08 < 32767)
+ w2 = w1 * 1.08;
+ else
+ w2 = w1;
+ }
+ else
+ {
+ if(w1 / 1.08 > 20)
+ w2 = w1 / 1.08;
+ else
+ w2 = w1;
+ }
- var ratio = p4.preview.current.width / p4.preview.current.height;
- h2 = Math.round(w2 / ratio);
- w2 = Math.round(w2);
+ var ratio = p4.preview.current.width / p4.preview.current.height;
+ h2 = Math.round(w2 / ratio);
+ w2 = Math.round(w2);
- t2 = Math.round(t1 - (h2 - h1) / 2)+'px';
- var l2 = Math.round(l1 - (w2 - w1) / 2)+'px';
+ t2 = Math.round(t1 - (h2 - h1) / 2)+'px';
+ var l2 = Math.round(l1 - (w2 - w1) / 2)+'px';
- var wPreview = $('#PREVIEWIMGCONT').width()/2;
- var hPreview = $('#PREVIEWIMGCONT').height()/2;
+ var wPreview = $('#PREVIEWIMGCONT').width()/2;
+ var hPreview = $('#PREVIEWIMGCONT').height()/2;
- var nt = Math.round((h2 / h1) * (t1 - hPreview) + hPreview);
- var nl = Math.round(((w2 / w1) * (l1 - wPreview)) + wPreview);
+ var nt = Math.round((h2 / h1) * (t1 - hPreview) + hPreview);
+ var nl = Math.round(((w2 / w1) * (l1 - wPreview)) + wPreview);
- el.css({
- left: nl,
- top: nt
- }).width(w2).height(h2);
+ el.css({
+ left: nl,
+ top: nt
+ }).width(w2).height(h2);
}
function getAnswerTrain(pos, tools, query,options_serial)
{
- $('#PREVIEWCURRENTCONT').fadeOut('fast');
- $.ajax({
- type: "POST",
- url: "/prod/query/answer-train/",
- dataType: 'json',
- data: {
- pos:pos,
+ $('#PREVIEWCURRENTCONT').fadeOut('fast');
+ $.ajax({
+ type: "POST",
+ url: "/prod/query/answer-train/",
+ dataType: 'json',
+ data: {
+ pos:pos,
options_serial:options_serial,
query:query
- },
- success: function(data){
- setCurrent(data.current);
- viewCurrent($('#PREVIEWCURRENT li.selected'));
- setTools(tools);
- return;
- }
- });
+ },
+ success: function(data){
+ setCurrent(data.current);
+ viewCurrent($('#PREVIEWCURRENT li.selected'));
+ setTools(tools);
+ return;
+ }
+ });
}
function getRegTrain(contId,pos,tools)
{
- $.ajax({
- type: "POST",
- url: "/prod/query/reg-train/",
- dataType: 'json',
- data: {
- cont:contId,
- pos:pos
- },
- success: function(data){
- setCurrent(data.current);
- viewCurrent($('#PREVIEWCURRENT li.selected'));
- if(typeof(tools) != 'undefined')
- setTools(tools);
- return;
- }
- });
+ $.ajax({
+ type: "POST",
+ url: "/prod/query/reg-train/",
+ dataType: 'json',
+ data: {
+ cont:contId,
+ pos:pos
+ },
+ success: function(data){
+ setCurrent(data.current);
+ viewCurrent($('#PREVIEWCURRENT li.selected'));
+ if(typeof(tools) != 'undefined')
+ setTools(tools);
+ return;
+ }
+ });
}
function bounce(sbid, term, field){
- doThesSearch('T', sbid, term, field);
- closePreview();
+ doThesSearch('T', sbid, term, field);
+ closePreview();
}
function setTitle(title){
- $('#SPANTITLE').empty().append(title);
+ $('#SPANTITLE').empty().append(title);
}
function cancelPreview(){
- $('#PREVIEWIMGDESCINNER').empty();
- $('#PREVIEWIMGCONT').empty();
- p4.preview.current = false;
+ $('#PREVIEWIMGDESCINNER').empty();
+ $('#PREVIEWIMGCONT').empty();
+ p4.preview.current = false;
}
function startSlide(){
- if (!p4.slideShow) {
- p4.slideShow = true;
- }
- if (p4.slideShowCancel) {
- p4.slideShowCancel = false;
- p4.slideShow = false;
- $('#start_slide').show();
- $('#stop_slide').hide();
- }
- if(!p4.preview.open)
- {
- p4.slideShowCancel = false;
- p4.slideShow = false;
- $('#start_slide').show();
- $('#stop_slide').hide();
- }
- if (p4.slideShow) {
- $('#start_slide').hide();
- $('#stop_slide').show();
- getNext();
- setTimeout("startSlide()", 3000);
- }
+ if (!p4.slideShow) {
+ p4.slideShow = true;
+ }
+ if (p4.slideShowCancel) {
+ p4.slideShowCancel = false;
+ p4.slideShow = false;
+ $('#start_slide').show();
+ $('#stop_slide').hide();
+ }
+ if(!p4.preview.open)
+ {
+ p4.slideShowCancel = false;
+ p4.slideShow = false;
+ $('#start_slide').show();
+ $('#stop_slide').hide();
+ }
+ if (p4.slideShow) {
+ $('#start_slide').hide();
+ $('#stop_slide').show();
+ getNext();
+ setTimeout("startSlide()", 3000);
+ }
}
function stopSlide(){
- p4.slideShowCancel = true;
- $('#start_slide').show();
- $('#stop_slide').hide();
+ p4.slideShowCancel = true;
+ $('#start_slide').show();
+ $('#stop_slide').hide();
}
//var posAsk = null;
function getNext(){
- if (p4.preview.mode == 'REG' && parseInt(p4.preview.current.pos) === 0)
- $('#PREVIEWCURRENTCONT li img:first').trigger("click");
- else {
- if (p4.preview.mode == 'RESULT') {
- posAsk = parseInt(p4.preview.current.pos) + 1;
- posAsk = (posAsk > parseInt(p4.tot) || isNaN(posAsk)) ? 0 : posAsk;
- openPreview('RESULT', posAsk);
- }
- else
- {
- if(!$('#PREVIEWCURRENT li.selected').is(':last-child'))
- $('#PREVIEWCURRENT li.selected').next().children('img').trigger("click");
- else
- $('#PREVIEWCURRENT li:first-child').children('img').trigger("click");
- }
+ if (p4.preview.mode == 'REG' && parseInt(p4.preview.current.pos) === 0)
+ $('#PREVIEWCURRENTCONT li img:first').trigger("click");
+ else {
+ if (p4.preview.mode == 'RESULT') {
+ posAsk = parseInt(p4.preview.current.pos) + 1;
+ posAsk = (posAsk > parseInt(p4.tot) || isNaN(posAsk)) ? 0 : posAsk;
+ openPreview('RESULT', posAsk);
+ }
+ else
+ {
+ if(!$('#PREVIEWCURRENT li.selected').is(':last-child'))
+ $('#PREVIEWCURRENT li.selected').next().children('img').trigger("click");
+ else
+ $('#PREVIEWCURRENT li:first-child').children('img').trigger("click");
+ }
- }
+ }
}
function reloadPreview(){
- $('#PREVIEWCURRENT li.selected img').trigger("click");
+ $('#PREVIEWCURRENT li.selected img').trigger("click");
}
function getPrevious(){
- if (p4.preview.mode == 'RESULT')
- {
- posAsk = parseInt(p4.preview.current.pos) - 1;
- posAsk = (posAsk < 0) ? ((parseInt(p4.tot) - 1)) : posAsk;
- openPreview('RESULT', posAsk);
- }
- else
- {
- if(!$('#PREVIEWCURRENT li.selected').is(':first-child'))
- $('#PREVIEWCURRENT li.selected').prev().children('img').trigger("click");
- else
- $('#PREVIEWCURRENT li:last-child').children('img').trigger("click");
- }
+ if (p4.preview.mode == 'RESULT')
+ {
+ posAsk = parseInt(p4.preview.current.pos) - 1;
+ posAsk = (posAsk < 0) ? ((parseInt(p4.tot) - 1)) : posAsk;
+ openPreview('RESULT', posAsk);
+ }
+ else
+ {
+ if(!$('#PREVIEWCURRENT li.selected').is(':first-child'))
+ $('#PREVIEWCURRENT li.selected').prev().children('img').trigger("click");
+ else
+ $('#PREVIEWCURRENT li:last-child').children('img').trigger("click");
+ }
}
function setOthers(others){
- $('#PREVIEWOTHERSINNER').empty();
- if (others !== '') {
- $('#PREVIEWOTHERSINNER').append(others);
+ $('#PREVIEWOTHERSINNER').empty();
+ if (others !== '') {
+ $('#PREVIEWOTHERSINNER').append(others);
- $('#PREVIEWOTHERS table.otherRegToolTip').tooltip();
- }
+ $('#PREVIEWOTHERS table.otherRegToolTip').tooltip();
+ }
}
function setTools(tools){
- $('#PREVIEWTOOL').empty().append(tools);
- if(!p4.slideShowCancel && p4.slideShow)
- {
- $('#start_slide').hide();
- $('#stop_slide').show();
- }else
- {
- $('#start_slide').show();
- $('#stop_slide').hide();
- }
+ $('#PREVIEWTOOL').empty().append(tools);
+ if(!p4.slideShowCancel && p4.slideShow)
+ {
+ $('#start_slide').hide();
+ $('#stop_slide').show();
+ }else
+ {
+ $('#start_slide').show();
+ $('#stop_slide').hide();
+ }
}
function setCurrent(current){
- if (current !== '') {
- var el = $('#PREVIEWCURRENT');
- el.removeClass('loading').empty().append(current);
+ if (current !== '') {
+ var el = $('#PREVIEWCURRENT');
+ el.removeClass('loading').empty().append(current);
- $('ul',el).width($('li',el).length * 80);
- $('img.prevRegToolTip',el).tooltip();
- $.each($('img.openPreview'), function(i, el){
- var jsopt = $(el).attr('jsargs').split('|');
- $(el).removeAttr('jsargs');
- $(el).removeClass('openPreview');
- $(el).bind('click', function(){
- viewCurrent($(this).parent());
- openPreview(jsopt[0], jsopt[1], jsopt[2]);
- });
- });
- }
+ $('ul',el).width($('li',el).length * 80);
+ $('img.prevRegToolTip',el).tooltip();
+ $.each($('img.openPreview'), function(i, el){
+ var jsopt = $(el).attr('jsargs').split('|');
+ $(el).removeAttr('jsargs');
+ $(el).removeClass('openPreview');
+ $(el).bind('click', function(){
+ viewCurrent($(this).parent());
+ openPreview(jsopt[0], jsopt[1], jsopt[2]);
+ });
+ });
+ }
}
function viewCurrent(el){
- if (el.length === 0)
- {
- return;
- }
- $('#PREVIEWCURRENT li.selected').removeClass('selected');
- el.addClass('selected');
- $('#PREVIEWCURRENTCONT').animate({'scrollLeft':($('#PREVIEWCURRENT li.selected').position().left + $('#PREVIEWCURRENT li.selected').width()/2 - ($('#PREVIEWCURRENTCONT').width() / 2 ))});
- return;
+ if (el.length === 0)
+ {
+ return;
+ }
+ $('#PREVIEWCURRENT li.selected').removeClass('selected');
+ el.addClass('selected');
+ $('#PREVIEWCURRENTCONT').animate({'scrollLeft':($('#PREVIEWCURRENT li.selected').position().left + $('#PREVIEWCURRENT li.selected').width()/2 - ($('#PREVIEWCURRENTCONT').width() / 2 ))});
+ return;
}
function setPreview(){
- if (!p4.preview.current)
- return;
+ if (!p4.preview.current)
+ return;
- var zoomable = $('img.record.zoomable');
- if(zoomable.length > 0 && zoomable.hasClass('zoomed'))
- return;
+ var zoomable = $('img.record.zoomable');
+ if(zoomable.length > 0 && zoomable.hasClass('zoomed'))
+ return;
- var h = parseInt(p4.preview.current.height);
- var w = parseInt(p4.preview.current.width);
+ var h = parseInt(p4.preview.current.height);
+ var w = parseInt(p4.preview.current.width);
// if(p4.preview.current.type == 'video')
// {
// var h = parseInt(p4.preview.current.flashcontent.height);
// var w = parseInt(p4.preview.current.flashcontent.width);
// }
- var t=20;
- var de = 0;
+ var t=20;
+ var de = 0;
- var margX = 0;
- var margY = 0;
+ var margX = 0;
+ var margY = 0;
- if($('#PREVIEWIMGCONT .record_audio').length > 0)
- {
- margY = 100;
- de = 60;
- }
+ if($('#PREVIEWIMGCONT .record_audio').length > 0)
+ {
+ margY = 100;
+ de = 60;
+ }
// if(p4.preview.current.type != 'flash')
// {
- var ratioP = w / h;
- var ratioD = parseInt(p4.preview.width) / parseInt(p4.preview.height);
+ var ratioP = w / h;
+ var ratioD = parseInt(p4.preview.width) / parseInt(p4.preview.height);
- if (ratioD > ratioP) {
- //je regle la hauteur d'abord
- if ((parseInt(h) + margY) > parseInt(p4.preview.height)) {
- h = Math.round(parseInt(p4.preview.height) - margY);
- w = Math.round(h * ratioP);
- }
- }
- else {
- if ((parseInt(w) + margX) > parseInt(p4.preview.width)) {
- w = Math.round(parseInt(p4.preview.width) - margX);
- h = Math.round(w / ratioP);
- }
- }
+ if (ratioD > ratioP) {
+ //je regle la hauteur d'abord
+ if ((parseInt(h) + margY) > parseInt(p4.preview.height)) {
+ h = Math.round(parseInt(p4.preview.height) - margY);
+ w = Math.round(h * ratioP);
+ }
+ }
+ else {
+ if ((parseInt(w) + margX) > parseInt(p4.preview.width)) {
+ w = Math.round(parseInt(p4.preview.width) - margX);
+ h = Math.round(w / ratioP);
+ }
+ }
// }
// else
// {
@@ -484,42 +484,42 @@ function setPreview(){
// h = Math.round(parseInt(p4.preview.height) - margY);
// w = Math.round(parseInt(p4.preview.width) - margX);
// }
- t = Math.round((parseInt(p4.preview.height) - h - de) / 2);
- var l = Math.round((parseInt(p4.preview.width) - w) / 2);
- $('#PREVIEWIMGCONT .record').css({
- width: w,
- height: h,
- top: t,
- left: l
- }).attr('width',w).attr('height',h);
+ t = Math.round((parseInt(p4.preview.height) - h - de) / 2);
+ var l = Math.round((parseInt(p4.preview.width) - w) / 2);
+ $('#PREVIEWIMGCONT .record').css({
+ width: w,
+ height: h,
+ top: t,
+ left: l
+ }).attr('width',w).attr('height',h);
}
function classicMode(){
- $('#PREVIEWCURRENTCONT').animate({'scrollLeft' : ($('#PREVIEWCURRENT li.selected').position().left - 160)});
- p4.currentViewMode = 'classic';
+ $('#PREVIEWCURRENTCONT').animate({'scrollLeft' : ($('#PREVIEWCURRENT li.selected').position().left - 160)});
+ p4.currentViewMode = 'classic';
}
function doudouMode(){
- $('#PREVIEWCURRENT li').removeClass('see-all');
- $('#PREVIEWCURRENT ul').width('auto');
- $('#PREVIEWCURRENTCONT').css({
- 'overflow-x': 'hidden'
- });
- p4.currentViewMode = 'enhance';
- viewCurrent($('#PREVIEWCURRENT li.selected'));
+ $('#PREVIEWCURRENT li').removeClass('see-all');
+ $('#PREVIEWCURRENT ul').width('auto');
+ $('#PREVIEWCURRENTCONT').css({
+ 'overflow-x': 'hidden'
+ });
+ p4.currentViewMode = 'enhance';
+ viewCurrent($('#PREVIEWCURRENT li.selected'));
}
function closePreview(){
- p4.preview.open = false;
- hideOverlay();
+ p4.preview.open = false;
+ hideOverlay();
- $('#PREVIEWBOX').fadeTo(500, 0);
- $('#PREVIEWBOX').queue(function(){
- $(this).css({
- 'display': 'none'
- });
- cancelPreview();
- $(this).dequeue();
- });
+ $('#PREVIEWBOX').fadeTo(500, 0);
+ $('#PREVIEWBOX').queue(function(){
+ $(this).css({
+ 'display': 'none'
+ });
+ cancelPreview();
+ $(this).dequeue();
+ });
}
diff --git a/www/include/jquery.tooltip.js b/www/include/jquery.tooltip.js
index c251370e80..75d8f29370 100644
--- a/www/include/jquery.tooltip.js
+++ b/www/include/jquery.tooltip.js
@@ -15,630 +15,630 @@
(function($) {
- // the tooltip element
- var helper = {},
- // the title of the current element, used for restoring
- title,
- // timeout id for delayed tooltips
- tID,
- // IE 5.5 or 6
- IE = $.browser.msie && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent),
- // flag for mouse tracking
- track = false;
+ // the tooltip element
+ var helper = {},
+ // the title of the current element, used for restoring
+ title,
+ // timeout id for delayed tooltips
+ tID,
+ // IE 5.5 or 6
+ IE = $.browser.msie && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent),
+ // flag for mouse tracking
+ track = false;
- $.tooltip = {
- blocked: false,
- ajaxTimeout : false,
- ajaxRequest : false,
- ajaxEvent : false,
- current: null,
- visible: false,
- defaults: {
- delay: 700,
- fixable:false,
- fixableIndex:100,
- fade: true,
- showURL: true,
- outside: true,
- extraClass: "",
- top: 15,
- left: 15,
- id: "tooltip"
- },
- block: function() {
- $.tooltip.blocked = !$.tooltip.blocked;
- },
-
- delayAjax : function(a,b,c)
- {
- var options_serial = p4.tot_options;
- var query = p4.tot_query;
- var datas = {
- options_serial:options_serial,
- query:query
- };
- $.tooltip.ajaxRequest = $.ajax({
- url: $.tooltip.current.tooltipSrc,
- type:'post',
- data:datas,
- success: function(data) {
- title = data;
- positioning($.tooltip.ajaxEvent);
+ $.tooltip = {
+ blocked: false,
+ ajaxTimeout : false,
+ ajaxRequest : false,
+ ajaxEvent : false,
+ current: null,
+ visible: false,
+ defaults: {
+ delay: 700,
+ fixable:false,
+ fixableIndex:100,
+ fade: true,
+ showURL: true,
+ outside: true,
+ extraClass: "",
+ top: 15,
+ left: 15,
+ id: "tooltip"
+ },
+ block: function() {
+ $.tooltip.blocked = !$.tooltip.blocked;
},
- "error":function(){
- return;
- }
- });
- }
- };
- $.fn.extend({
- tooltip: function(settings) {
- settings = $.extend({}, $.tooltip.defaults, settings);
- createHelper(settings);
- return this.each(function() {
- $.data(this, "tooltip", settings);
- // copy tooltip into its own expando and remove the title
- this.tooltipText = $(this).attr('title');
- this.tooltipSrc = $(this).attr('tooltipsrc');
-
- this.ajaxLoad = ($.trim(this.tooltipText) === '' && this.tooltipSrc !== '');
- this.ajaxTimeout;
-
- this.orEl = $(this);
- $(this).removeAttr("title");
- // also remove alt attribute to prevent default tooltip in IE
- this.alt = "";
- })
- .mouseover(save)
- .mouseout(hide)
- .mousedown(fix);
- },
- fixPNG: IE ? function() {
- return this.each(function () {
- var image = $(this).css('backgroundImage');
- if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
- image = RegExp.$1;
- $(this).css({
- 'backgroundImage': 'none',
- 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
- }).each(function () {
- var position = $(this).css('position');
- if (position != 'absolute' && position != 'relative')
- $(this).css('position', 'relative');
- });
- }
- });
- } : function() {
- return this;
- },
- unfixPNG: IE ? function() {
- return this.each(function () {
- $(this).css({
- 'filter': '',
- backgroundImage: ''
- });
- });
- } : function() {
- return this;
- },
- hideWhenEmpty: function() {
- return this.each(function() {
- $(this)[ $(this).html() ? "show" : "hide" ]();
- });
- },
- url: function() {
- return this.attr('href') || this.attr('src');
- }
- });
-
- function createHelper(settings) {
- // there can be only one tooltip helper
- if( helper.parent )
- return;
- // create the helper, h3 for title, div for url
- helper.parent = $('
')
- // add to document
- .appendTo(document.body)
- // hide it at first
- .hide();
-
- // apply bgiframe if available
- if ( $.fn.bgiframe )
- helper.parent.bgiframe();
-
- // save references to title and url elements
- helper.title = $('h3', helper.parent);
- helper.body = $('div.body', helper.parent);
- helper.url = $('div.url', helper.parent);
- }
-
- function settings(element) {
- return $.data(element, "tooltip");
- }
-
- // main event handler to start showing tooltips
- function handle(event) {
-
- if($($.tooltip.current).hasClass('SSTT') && $($.tooltip.current).hasClass('ui-state-active'))
- return;
-
- // show helper, either with timeout or on instant
- if( settings(this).delay )
- tID = setTimeout(visible, settings(this).delay);
- else
- visible();
- show();
-
- // if selected, update the helper position when the mouse moves
- track = !!settings(this).track;
- $(document.body).bind('mousemove', update);
-
- // update at least once
- update(event);
- }
-
- // save elements title before the tooltip is displayed
- function save(event) {
- // if this is the current source, or it has no title (occurs with click event), stop
- if(event.stopPropagation)
- event.stopPropagation();
-
- event.cancelBubble = true;
-
- if ( $.tooltip.blocked || this == $.tooltip.current || (!this.tooltipText && !this.tooltipSrc && !settings(this).bodyHandler) )
- return;
-
- // save current
- $.tooltip.current = this;
- title = this.tooltipText;
-
- // if element has href or src, add and show it, otherwise hide it
- if( settings(this).showURL && $(this).url() )
- helper.url.html( $(this).url().replace('http://', '') ).show();
- else
- helper.url.hide();
-
- // add an optional class for this tip
- // helper.parent.addClass(settings(this).extraClass);
- if(this.ajaxLoad)
- {
- clearTimeout($.tooltip.ajaxTimeout);
- $.tooltip.ajaxTimeout = setTimeout("$.tooltip.delayAjax()", 300);
- $.tooltip.ajaxEvent = event;
- }
- else
- {
- title = '
'+
- '
'+
- '
'+
- '
'+
- title+
- '
'+
- '
'+
- '
';
-
- positioning.apply(this, arguments);
- }
- return;
- }
-
-
- 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)
- {
- var width = 'auto';
- var height = 'auto';
- var ratio = 1;
- var resizeImgTips = resizeVideoTips = false;
- var $imgTips = $('#' + settings($.tooltip.current).id + ' .imgTips');
- var $videoTips = $('#' + settings($.tooltip.current).id + ' .videoTips');
-
- if ($imgTips[0] && $('#' + settings($.tooltip.current).id + ' .noToolTipResize').length === 0) {
- resizeImgTips = true;
- width = parseInt($imgTips[0].style.width);
- height = parseInt($imgTips[0].style.height);
- ratio = width/height;
- $imgTips.css({top:'0px',left:'0px'});
- }
-
- if ($videoTips[0] && $('#' + settings($.tooltip.current).id + ' .noToolTipResize').length === 0) {
- resizeVideoTips = true;
- width = parseInt($videoTips.attr('width'));
- height = parseInt($videoTips.attr('height'));
- ratio = width/height;
- $videoTips.css({top:'0px',left:'0px'});
- }
-
- var v = viewport(),
- h = helper.parent;
- helper.parent.css({
- width:width,
- top:0,
- left:0,
- visibility:'hidden',
- // visibility:'visible',
- display:'block',
- height:height
- });
-
- $(h).width($(h).width());
- width = ($(h).width()>(v.x-40))?(v.x-40):$(h).width();
- height = ($(h).height()>(v.y-40))?(v.y-40):$(h).height();
-
-// $('#' + settings($.tooltip.current).id + ' .thumb_wrapper').width('auto').height('auto');
-
- if($('#' + settings($.tooltip.current).id + ' .audioTips').length > 0)
- {
- height = height < 26 ? 26 : height;
- }
-
- $(h).css({
- width:width,
- height:height
- });
-
- if (event) {
-
- var vert, vertS, hor, horS, top, left,ratioH,ratioV;
- // ratio = $(h).width()/$(h).height();
- var ratioSurfaceH;
- var ratioSurfaceV, wiH,wiV,heH,heV;
- var ratioImage = $(h).width()/$(h).height();
-
- //position de l'image
- if ($(event.target).offset().left > (v.x - $(event.target).offset().left - $(event.target).width())) {
- hor = 'gauche';
- wiH = $(event.target).offset().left;
-
- horS = wiH * v.y;
- ratioSurfaceH = wiH / v.y;
- }
- else {
- hor = 'droite';
- wiH = (v.x - $(event.target).offset().left - $(event.target).width());
- horS = wiH * v.y;
- ratioSurfaceH = wiH / v.y;
-
- }
- if ($(event.target).offset().top > (v.y - $(event.target).offset().top - $(event.target).height())) {
- vert = 'haut';
- heV = $(event.target).offset().top;
- vertS = heV * v.x;
- ratioSurfaceV = v.x / heV;
- }
- else {
- vert = 'bas';
- heV = (v.y - $(event.target).offset().top - $(event.target).height());
- vertS = heV * v.x;
- ratioSurfaceV = v.x / heV;
- }
-
-
- //correction par ratio
- if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) {
-
- if(ratioSurfaceH > ratioImage)
- {
- horS = v.y * ratioImage*v.y;
- }
- else
- {
- horS = wiH * wiH/ratioImage;
- }
- if(ratioSurfaceV > ratioImage)
- {
- vertS = heV * ratioImage*heV;
- }
- else
- {
- vertS = v.x * v.x/ratioImage;
- }
- }
-
- var zH;
-
- if((Math.abs(ratioSurfaceV - ratioImage) < Math.abs(ratioSurfaceH - ratioImage)))
+ delayAjax : function(a,b,c)
{
- 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)
- {
- case 'haut':
- height = (zH>(ETOT-40))?(ETOT-40):zH;
- top = ETOT - height-20;
- break;
- case 'bas':
- height = ((v.y-ETH-ETOT-40)>zH)?zH:(v.y-ETH-ETOT-40);
- top = ETOT +ETH+20;
- break;
- default:
- break;
- }
+ var options_serial = p4.tot_options;
+ var query = p4.tot_query;
+ var datas = {
+ options_serial:options_serial,
+ query:query
+ };
+ $.tooltip.ajaxRequest = $.ajax({
+ url: $.tooltip.current.tooltipSrc,
+ type:'post',
+ data:datas,
+ success: function(data) {
+ title = data;
+ positioning($.tooltip.ajaxEvent);
+ },
+ "error":function(){
+ return;
+ }
+ });
+ }
+ };
+
+ $.fn.extend({
+ tooltip: function(settings) {
+ settings = $.extend({}, $.tooltip.defaults, settings);
+ createHelper(settings);
+ return this.each(function() {
+ $.data(this, "tooltip", settings);
+ // copy tooltip into its own expando and remove the title
+ this.tooltipText = $(this).attr('title');
+ this.tooltipSrc = $(this).attr('tooltipsrc');
+
+ this.ajaxLoad = ($.trim(this.tooltipText) === '' && this.tooltipSrc !== '');
+ this.ajaxTimeout;
+
+ this.orEl = $(this);
+ $(this).removeAttr("title");
+ // also remove alt attribute to prevent default tooltip in IE
+ this.alt = "";
+ })
+ .mouseover(save)
+ .mouseout(hide)
+ .mousedown(fix);
+ },
+ fixPNG: IE ? function() {
+ return this.each(function () {
+ var image = $(this).css('backgroundImage');
+ if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
+ image = RegExp.$1;
+ $(this).css({
+ 'backgroundImage': 'none',
+ 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
+ }).each(function () {
+ var position = $(this).css('position');
+ if (position != 'absolute' && position != 'relative')
+ $(this).css('position', 'relative');
+ });
+ }
+ });
+ } : function() {
+ return this;
+ },
+ unfixPNG: IE ? function() {
+ return this.each(function () {
+ $(this).css({
+ 'filter': '',
+ backgroundImage: ''
+ });
+ });
+ } : function() {
+ return this;
+ },
+ hideWhenEmpty: function() {
+ return this.each(function() {
+ $(this)[ $(this).html() ? "show" : "hide" ]();
+ });
+ },
+ url: function() {
+ return this.attr('href') || this.attr('src');
+ }
+ });
+
+ function createHelper(settings) {
+ // there can be only one tooltip helper
+ if( helper.parent )
+ return;
+ // create the helper, h3 for title, div for url
+ helper.parent = $('
')
+ // add to document
+ .appendTo(document.body)
+ // hide it at first
+ .hide();
+
+ // apply bgiframe if available
+ if ( $.fn.bgiframe )
+ helper.parent.bgiframe();
+
+ // save references to title and url elements
+ helper.title = $('h3', helper.parent);
+ helper.body = $('div.body', helper.parent);
+ helper.url = $('div.url', helper.parent);
+ }
+
+ function settings(element) {
+ return $.data(element, "tooltip");
+ }
+
+ // main event handler to start showing tooltips
+ function handle(event) {
+
+ if($($.tooltip.current).hasClass('SSTT') && $($.tooltip.current).hasClass('ui-state-active'))
+ return;
+
+ // show helper, either with timeout or on instant
+ if( settings(this).delay )
+ tID = setTimeout(visible, settings(this).delay);
+ else
+ visible();
+ show();
+
+ // if selected, update the helper position when the mouse moves
+ track = !!settings(this).track;
+ $(document.body).bind('mousemove', update);
+
+ // update at least once
+ update(event);
+ }
+
+ // save elements title before the tooltip is displayed
+ function save(event) {
+ // if this is the current source, or it has no title (occurs with click event), stop
+ if(event.stopPropagation)
+ event.stopPropagation();
+
+ event.cancelBubble = true;
+
+ if ( $.tooltip.blocked || this == $.tooltip.current || (!this.tooltipText && !this.tooltipSrc && !settings(this).bodyHandler) )
+ return;
+
+ // save current
+ $.tooltip.current = this;
+ title = this.tooltipText;
+
+ // if element has href or src, add and show it, otherwise hide it
+ if( settings(this).showURL && $(this).url() )
+ helper.url.html( $(this).url().replace('http://', '') ).show();
+ else
+ helper.url.hide();
+
+ // add an optional class for this tip
+ // helper.parent.addClass(settings(this).extraClass);
+ if(this.ajaxLoad)
+ {
+ clearTimeout($.tooltip.ajaxTimeout);
+ $.tooltip.ajaxTimeout = setTimeout("$.tooltip.delayAjax()", 300);
+ $.tooltip.ajaxEvent = event;
}
else
{
- // height = ($(h).height()>(v.y-40))?(v.y-40):$(h).height();
- zH = $(h).height();
- var zT = event.pageY;
- var EOTL = $(event.target).offset().left;
- 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)
- {
- case 'gauche':
- width = (zw>(EOTL-40))?(EOTL-40):zw;
- left = EOTL - width-20;
- break;
- case 'droite':
- width = ((v.x-ETW-EOTL-40)>zw)?zw:(v.x-ETW-EOTL-40);
- left = EOTL +ETW+20;
- break;
- default:
- break;
- }
+ title = '
'+
+ '
'+
+ '
'+
+ '
'+
+ title+
+ '
'+
+ '
'+
+ '
';
+
+ positioning.apply(this, arguments);
}
-
- helper.parent.css({
- width: width,
- height: height,
- left: left,
- top: top
- });
+ return;
+ }
- //si ya une image on re-ajuste au ratio
- if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) {
- if(width == 'auto')
- width = $('#' + settings($.tooltip.current).id).width();
- if(height == 'auto')
- height = $('#' + settings($.tooltip.current).id).height();
- if (ratio > 1) {
- var nh = width / ratio;
- if (nh > height) {
- width = ratio * height;
- nh = width / ratio;
+ 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)
+ {
+ var width = 'auto';
+ var height = 'auto';
+ var ratio = 1;
+ var resizeImgTips = resizeVideoTips = false;
+ var $imgTips = $('#' + settings($.tooltip.current).id + ' .imgTips');
+ var $videoTips = $('#' + settings($.tooltip.current).id + ' .videoTips');
+
+ if ($imgTips[0] && $('#' + settings($.tooltip.current).id + ' .noToolTipResize').length === 0) {
+ resizeImgTips = true;
+ width = parseInt($imgTips[0].style.width);
+ height = parseInt($imgTips[0].style.height);
+ ratio = width/height;
+ $imgTips.css({top:'0px',left:'0px'});
}
- height = nh;
- }
- else {
- var nw = ratio * height;
- if (nw > width) {
- height = width / ratio;
- nw = height * ratio;
+
+ if ($videoTips[0] && $('#' + settings($.tooltip.current).id + ' .noToolTipResize').length === 0) {
+ resizeVideoTips = true;
+ width = parseInt($videoTips.attr('width'));
+ height = parseInt($videoTips.attr('height'));
+ ratio = width/height;
+ $videoTips.css({top:'0px',left:'0px'});
}
- width = nw;
- }
- }else
- {
- if(vertS < horS)
- {
- height = 'auto';
- }
+
+ var v = viewport(),
+ h = helper.parent;
+ helper.parent.css({
+ width:width,
+ top:0,
+ left:0,
+ visibility:'hidden',
+ // visibility:'visible',
+ display:'block',
+ height:height
+ });
+
+ $(h).width($(h).width());
+ width = ($(h).width()>(v.x-40))?(v.x-40):$(h).width();
+ height = ($(h).height()>(v.y-40))?(v.y-40):$(h).height();
+
+// $('#' + settings($.tooltip.current).id + ' .thumb_wrapper').width('auto').height('auto');
+
+ if($('#' + settings($.tooltip.current).id + ' .audioTips').length > 0)
+ {
+ height = height < 26 ? 26 : height;
+ }
+
+ $(h).css({
+ width:width,
+ height:height
+ });
+
+ if (event) {
+
+ var vert, vertS, hor, horS, top, left,ratioH,ratioV;
+ // ratio = $(h).width()/$(h).height();
+ var ratioSurfaceH;
+ var ratioSurfaceV, wiH,wiV,heH,heV;
+ var ratioImage = $(h).width()/$(h).height();
+
+ //position de l'image
+ if ($(event.target).offset().left > (v.x - $(event.target).offset().left - $(event.target).width())) {
+ hor = 'gauche';
+ wiH = $(event.target).offset().left;
+
+ horS = wiH * v.y;
+ ratioSurfaceH = wiH / v.y;
+ }
+ else {
+ hor = 'droite';
+ wiH = (v.x - $(event.target).offset().left - $(event.target).width());
+ horS = wiH * v.y;
+ ratioSurfaceH = wiH / v.y;
+
+ }
+ if ($(event.target).offset().top > (v.y - $(event.target).offset().top - $(event.target).height())) {
+ vert = 'haut';
+ heV = $(event.target).offset().top;
+ vertS = heV * v.x;
+ ratioSurfaceV = v.x / heV;
+ }
+ else {
+ vert = 'bas';
+ heV = (v.y - $(event.target).offset().top - $(event.target).height());
+ vertS = heV * v.x;
+ ratioSurfaceV = v.x / heV;
+ }
+
+
+ //correction par ratio
+ if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) {
+
+ if(ratioSurfaceH > ratioImage)
+ {
+ horS = v.y * ratioImage*v.y;
+ }
+ else
+ {
+ horS = wiH * wiH/ratioImage;
+ }
+ if(ratioSurfaceV > ratioImage)
+ {
+ vertS = heV * ratioImage*heV;
+ }
+ else
+ {
+ vertS = v.x * v.x/ratioImage;
+ }
+ }
+
+ var zH;
+
+ 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)
+ {
+ case 'haut':
+ height = (zH>(ETOT-40))?(ETOT-40):zH;
+ top = ETOT - height-20;
+ break;
+ case 'bas':
+ height = ((v.y-ETH-ETOT-40)>zH)?zH:(v.y-ETH-ETOT-40);
+ top = ETOT +ETH+20;
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ // height = ($(h).height()>(v.y-40))?(v.y-40):$(h).height();
+ zH = $(h).height();
+ var zT = event.pageY;
+ var EOTL = $(event.target).offset().left;
+ 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)
+ {
+ case 'gauche':
+ width = (zw>(EOTL-40))?(EOTL-40):zw;
+ left = EOTL - width-20;
+ break;
+ case 'droite':
+ width = ((v.x-ETW-EOTL-40)>zw)?zw:(v.x-ETW-EOTL-40);
+ left = EOTL +ETW+20;
+ break;
+ default:
+ break;
+ }
+ }
+
+ helper.parent.css({
+ width: width,
+ height: height,
+ left: left,
+ top: top
+ });
+
+
+ //si ya une image on re-ajuste au ratio
+ if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) {
+ if(width == 'auto')
+ width = $('#' + settings($.tooltip.current).id).width();
+ if(height == 'auto')
+ height = $('#' + settings($.tooltip.current).id).height();
+ if (ratio > 1) {
+ var nh = width / ratio;
+ if (nh > height) {
+ width = ratio * height;
+ nh = width / ratio;
+ }
+ height = nh;
+ }
+ else {
+ var nw = ratio * height;
+ if (nw > width) {
+ height = width / ratio;
+ nw = height * ratio;
+ }
+ width = nw;
+ }
+ }else
+ {
+ if(vertS < horS)
+ {
+ height = 'auto';
+ }
+ }
+
+ if(resizeImgTips)
+ {
+ var factor = Math.min((width - 45) / width, (height - 75) / height);
+ var imgWidth = Math.round(width * factor);
+ var imgHeight = Math.round(height * factor);
+
+ width = imgWidth + 45;
+ height = imgHeight + 85;
+
+ $imgTips.css({
+ maxWidth: imgWidth,
+ maxHeight: imgHeight
+ });
+ }
+
+ if(resizeVideoTips)
+ {
+ var factor = Math.min((width - 45) / width, (height - 75) / height);
+ var imgWidth = Math.round(width * factor);
+ var imgHeight = Math.round(height * factor);
+
+ width = imgWidth + 45;
+ height = imgHeight + 75;
+
+ $videoTips.css({
+ width: Math.round(imgWidth),
+ height: Math.round(imgHeight)
+ });
+ }
+
+ helper.parent.css({
+ width: Math.round(width),
+ height: Math.round(height),
+ left: left,
+ top: top
+ });
+
+ }
+
}
+ handle.apply($this, arguments);
+ return;
+ }
- if(resizeImgTips)
- {
- var factor = Math.min((width - 45) / width, (height - 75) / height);
- var imgWidth = Math.round(width * factor);
- var imgHeight = Math.round(height * factor);
+ // delete timeout and show helper
+ function show() {
+ tID = null;
- width = imgWidth + 45;
- height = imgHeight + 85;
-
- $imgTips.css({
- maxWidth: imgWidth,
- maxHeight: imgHeight
- });
+ if ((!IE || !$.fn.bgiframe) && settings($.tooltip.current).fade) {
+ if (helper.parent.is(":animated"))
+ helper.parent.stop().show().fadeTo(settings($.tooltip.current).fade, 100);
+ else
+ helper.parent.is(':visible') ? helper.parent.fadeTo(settings($.tooltip.current).fade, 100) : helper.parent.fadeIn(settings($.tooltip.current).fade);
+ } else {
+ helper.parent.show();
}
+ update();
+ }
- if(resizeVideoTips)
+ function fix(event)
+ {
+ if(!settings(this).fixable)
{
- var factor = Math.min((width - 45) / width, (height - 75) / height);
- var imgWidth = Math.round(width * factor);
- var imgHeight = Math.round(height * factor);
-
- width = imgWidth + 45;
- height = imgHeight + 75;
-
- $videoTips.css({
- width: Math.round(imgWidth),
- height: Math.round(imgHeight)
- });
+ hide(event);
+ return;
}
+ event.cancelBubble = true;
+ if(event.stopPropagation)
+ event.stopPropagation();
+ showOverlay('_tooltip','body',unfix_tooltip, settings(this).fixableIndex);
+ $('#tooltip .tooltip_closer').show().bind('click', unfix_tooltip);
+ $.tooltip.blocked = true;
+ }
+ function visible(){
+ $.tooltip.visible = true;
helper.parent.css({
- width: Math.round(width),
- height: Math.round(height),
- left: left,
- top: top
+ visibility:'visible'
});
-
- }
-
- }
- handle.apply($this, arguments);
- return;
- }
-
- // delete timeout and show helper
- function show() {
- tID = null;
-
- if ((!IE || !$.fn.bgiframe) && settings($.tooltip.current).fade) {
- if (helper.parent.is(":animated"))
- helper.parent.stop().show().fadeTo(settings($.tooltip.current).fade, 100);
- else
- helper.parent.is(':visible') ? helper.parent.fadeTo(settings($.tooltip.current).fade, 100) : helper.parent.fadeIn(settings($.tooltip.current).fade);
- } else {
- helper.parent.show();
- }
- update();
- }
-
- function fix(event)
- {
- if(!settings(this).fixable)
- {
- hide(event);
- return;
- }
- event.cancelBubble = true;
- if(event.stopPropagation)
- event.stopPropagation();
- showOverlay('_tooltip','body',unfix_tooltip, settings(this).fixableIndex);
- $('#tooltip .tooltip_closer').show().bind('click', unfix_tooltip);
- $.tooltip.blocked = true;
- }
-
- function visible(){
- $.tooltip.visible = true;
- helper.parent.css({
- visibility:'visible'
- });
- }
-
- /**
- * callback for mousemove
- * updates the helper position
- * removes itself when no current element
- */
- function update(event) {
-
- if($.tooltip.blocked)
- return;
-
- if (event && event.target.tagName == "OPTION") {
- return;
}
- // stop updating when tracking is disabled and the tooltip is visible
- if ( !track && helper.parent.is(":visible")) {
- $(document.body).unbind('mousemove', update);
- }
+ /**
+ * callback for mousemove
+ * updates the helper position
+ * removes itself when no current element
+ */
+ function update(event) {
- // if no current element is available, remove this listener
- if( $.tooltip.current === null ) {
- $(document.body).unbind('mousemove', update);
- return;
- }
+ if($.tooltip.blocked)
+ return;
- // remove position helper classes
- helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
-
- if(!settings($.tooltip.current).outside)
- {
- var left = helper.parent[0].offsetLeft;
- var top = helper.parent[0].offsetTop;
- helper.parent.width('auto');
- helper.parent.height('auto');
- if (event) {
- // position the helper 15 pixel to bottom right, starting from mouse position
- left = event.pageX + settings($.tooltip.current).left;
- top = event.pageY + settings($.tooltip.current).top;
- var right='auto';
- if (settings($.tooltip.current).positionLeft) {
- right = $(window).width() - left;
- left = 'auto';
+ if (event && event.target.tagName == "OPTION") {
+ return;
}
- helper.parent.css({
- left: left,
- right: right,
- top: top
- });
- }
- var v = viewport(),
- h = helper.parent[0];
- // check horizontal position
- if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
- left -= h.offsetWidth + 20 + settings($.tooltip.current).left;
- helper.parent.css({
- left: left + 'px'
- }).addClass("viewport-right");
- }
- // check vertical position
- if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
- top -= h.offsetHeight + 20 + settings($.tooltip.current).top;
- helper.parent.css({
- top: top + 'px'
- }).addClass("viewport-bottom");
- }
+ // stop updating when tracking is disabled and the tooltip is visible
+ if ( !track && helper.parent.is(":visible")) {
+ $(document.body).unbind('mousemove', update);
+ }
+
+ // if no current element is available, remove this listener
+ if( $.tooltip.current === null ) {
+ $(document.body).unbind('mousemove', update);
+ return;
+ }
+
+ // remove position helper classes
+ helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
+
+ if(!settings($.tooltip.current).outside)
+ {
+ var left = helper.parent[0].offsetLeft;
+ var top = helper.parent[0].offsetTop;
+ helper.parent.width('auto');
+ helper.parent.height('auto');
+ if (event) {
+ // position the helper 15 pixel to bottom right, starting from mouse position
+ left = event.pageX + settings($.tooltip.current).left;
+ top = event.pageY + settings($.tooltip.current).top;
+ var right='auto';
+ if (settings($.tooltip.current).positionLeft) {
+ right = $(window).width() - left;
+ left = 'auto';
+ }
+ helper.parent.css({
+ left: left,
+ right: right,
+ top: top
+ });
+ }
+
+ var v = viewport(),
+ h = helper.parent[0];
+ // check horizontal position
+ if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
+ left -= h.offsetWidth + 20 + settings($.tooltip.current).left;
+ helper.parent.css({
+ left: left + 'px'
+ }).addClass("viewport-right");
+ }
+ // check vertical position
+ if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
+ top -= h.offsetHeight + 20 + settings($.tooltip.current).top;
+ helper.parent.css({
+ top: top + 'px'
+ }).addClass("viewport-bottom");
+ }
+ }
}
- }
- function viewport() {
- return {
- x: $(window).width(),
- y: $(window).height(),
+ function viewport() {
+ return {
+ x: $(window).width(),
+ y: $(window).height(),
- cx: 0,
- cy: 0
- };
- }
+ cx: 0,
+ cy: 0
+ };
+ }
- // hide helper and restore added classes and the title
- function hide(event)
- {
- if($.tooltip.blocked || !$.tooltip.current)
- return;
- // clear timeout if possible
- if(tID)
- clearTimeout(tID);
- // no more current element
- $.tooltip.visible = false;
- var tsettings = settings($.tooltip.current);
- clearTimeout($.tooltip.ajaxTimeout);
- if($.tooltip.ajaxRequest && $.tooltip.ajaxRequest.abort)
+ // hide helper and restore added classes and the title
+ function hide(event)
{
- $.tooltip.ajaxRequest.abort();
- }
+ if($.tooltip.blocked || !$.tooltip.current)
+ return;
+ // clear timeout if possible
+ if(tID)
+ clearTimeout(tID);
+ // no more current element
+ $.tooltip.visible = false;
+ var tsettings = settings($.tooltip.current);
+ clearTimeout($.tooltip.ajaxTimeout);
+ if($.tooltip.ajaxRequest && $.tooltip.ajaxRequest.abort)
+ {
+ $.tooltip.ajaxRequest.abort();
+ }
- helper.body.empty();
- $.tooltip.current = null;
- 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);
- else
- helper.parent.stop().fadeOut(tsettings.fade, complete);
- } else
- complete();
+ helper.body.empty();
+ $.tooltip.current = null;
+ 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);
+ else
+ helper.parent.stop().fadeOut(tsettings.fade, complete);
+ } else
+ complete();
- if( tsettings.fixPNG )
- helper.parent.unfixPNG();
- }
+ if( tsettings.fixPNG )
+ helper.parent.unfixPNG();
+ }
})(jQuery);
function unfix_tooltip()
{
- $.tooltip.blocked = false;
- $.tooltip.visible = false;
- $.tooltip.current = null;
- $('#tooltip').hide();
- $('#tooltip .tooltip_closer').hide();
- hideOverlay('_tooltip');
+ $.tooltip.blocked = false;
+ $.tooltip.visible = false;
+ $.tooltip.current = null;
+ $('#tooltip').hide();
+ $('#tooltip .tooltip_closer').hide();
+ hideOverlay('_tooltip');
}
$(document).bind('keydown', function(event){
- if(event.keyCode == 27 && $.tooltip.blocked === true)
- {
- unfix_tooltip();
- }
+ if(event.keyCode == 27 && $.tooltip.blocked === true)
+ {
+ unfix_tooltip();
+ }
});
diff --git a/www/include/js/jquery.Edit.js b/www/include/js/jquery.Edit.js
index a821ea1e05..b5cf581a84 100644
--- a/www/include/js/jquery.Edit.js
+++ b/www/include/js/jquery.Edit.js
@@ -1,516 +1,516 @@
(function( window ) {
- function checkVocabId(VocabularyId)
- {
- if(typeof VocabularyId === 'undefined')
- VocabularyId = null;
-
- if(VocabularyId === '')
- VocabularyId = null;
-
- return VocabularyId;
- }
-
- var recordFieldValue = function(meta_id, value, VocabularyId) {
-
- VocabularyId = checkVocabId(VocabularyId);
-
- this.datas = {
- meta_id:meta_id,
- value:value,
- VocabularyId:VocabularyId
- };
-
- var $this = this;
- };
-
- recordFieldValue.prototype = {
- getValue : function() {
- return this.datas.value;
- },
- getMetaId : function() {
- return this.datas.meta_id;
- },
- getVocabularyId : function() {
- return this.datas.VocabularyId;
- },
- setValue : function(value, VocabularyId) {
-
- this.datas.value = value;
- this.datas.VocabularyId = checkVocabId(VocabularyId);
- return this;
- },
- remove : function() {
- this.datas.value = '';
- this.datas.VocabularyId = null;
-
- return this;
- }
- };
-
- var databoxField = function(name, label, meta_struct_id, options) {
-
- var defaults = {
- multi : false,
- required : false,
- readonly : false,
- maxLength : null,
- minLength : null,
- type : 'string',
- separator : null,
- vocabularyControl : null,
- vocabularyRestricted : false
- },
- options = (typeof options == 'object') ? options : {};
-
- if(isNaN(meta_struct_id))
+ function checkVocabId(VocabularyId)
{
- throw 'meta_struct_id should be a number';
+ if(typeof VocabularyId === 'undefined')
+ VocabularyId = null;
+
+ if(VocabularyId === '')
+ VocabularyId = null;
+
+ return VocabularyId;
}
- this.name = name;
- this.label = label;
- this.meta_struct_id = meta_struct_id;
- this.options = jQuery.extend(defaults, options);
+ var recordFieldValue = function(meta_id, value, VocabularyId) {
- if(this.options.multi === true && this.options.separator === null)
- {
- this.options.separator = ';';
- }
+ VocabularyId = checkVocabId(VocabularyId);
- };
-
- databoxField.prototype = {
- getMetaStructId : function() {
- return this.meta_struct_id;
- },
- getName : function() {
- return this.name;
- },
- getLabel : function() {
- return this.label;
- },
- isMulti : function() {
- return this.options.multi;
- },
- isRequired : function() {
- return this.options.required;
- },
- isReadonly : function() {
- return this.options.readonly;
- },
- getMaxLength : function() {
- return this.options.maxLength;
- },
- getMinLength : function() {
- return this.options.minLength;
- },
- getType : function() {
- return this.options.type;
- },
- getSeparator : function() {
- return this.options.separator;
- }
- };
-
- var recordField = function(databoxField, arrayValues) {
-
- this.databoxField = databoxField;
- this.options = {
- dirty : false
- };
- this.datas = new 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)
- {
- console.error('Trying to add a non-recordFieldValue to the field...');
- }
-
- continue;
- }
-
- 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)
- {
- console.error('Trying to add multi values in a non-multi field');
- }
- }
-
- if(window.console)
- {
- console.log('adding a value : ', arrayValues[v]);
- }
-
- this.datas.push(arrayValues[v]);
- first = false;
- }
- }
-
- var $this = this;
- }
- recordField.prototype = {
- getName : function() {
- return this.databoxField.getName();
- },
- getMetaStructId : function() {
- return this.databoxField.getMetaStructId();
- },
- isMulti : function() {
- return this.databoxField.isMulti();
- },
- isRequired : function() {
- return this.databoxField.isRequired();
- },
- isDirty : function() {
- return this.options.dirty;
- },
- addValue : function(value, merge, VocabularyId) {
-
- VocabularyId = checkVocabId(VocabularyId);
-
- merge = !!merge;
-
- if(this.databoxField.isReadonly())
- {
- if(window.console)
- {
- console.error('Unable to set a value to a readonly field');
- }
-
- return;
- }
-
- if(window.console)
- {
- console.log('adding value ',value,' vocId : ', VocabularyId , ' ; merge is ',merge);
- }
-
- 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)
- {
- console.log('already have ',value);
- }
- }
- }
- 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)
- {
- console.error('Cannot merge vocabularies');
- }
- this.datas[0].setValue(value, VocabularyId);
- }
- else
- {
-
- 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)
- {
- console.log('Updating value ',value);
- }
- this.datas[0].setValue(value, VocabularyId);
- }
- this.options.dirty = true;
- }
- }
- }
- }
-
- return this;
- },
- hasValue : function(value, VocabularyId) {
-
- 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)
- {
- console.log('already got the vocab ID');
- }
- return true;
- }
- }
- else if(this.datas[d].getVocabularyId() === null && this.datas[d].getValue() == value)
- {
- if(window.console)
- {
- console.log('already got this value');
- }
- return true;
- }
- }
- return false;
- },
- removeValue : function(value, vocabularyId) {
-
- if(this.databoxField.isReadonly())
- {
- if(window.console)
- {
- console.error('Unable to set a value to a readonly field');
- }
-
- return;
- }
-
- vocabularyId = checkVocabId(vocabularyId);
-
- if(window.console)
- {
- console.log('Try to remove value ', value, vocabularyId, this.datas);
- }
-
- 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)
- {
- 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)
- {
- console.log('Found ! removing... ');
- }
- this.datas[d].remove();
- this.options.dirty = true;
- }
- }
- return this;
- },
- isEmpty : function() {
- var empty = true;
-
- for(d in this.datas)
- {
- if(this.datas[d].getValue() !== '')
- empty = false;
- }
- return empty;
- },
- empty : function() {
-
- if(this.databoxField.isReadonly())
- {
- if(window.console)
- {
- console.error('Unable to set a value to a readonly field');
- }
-
- return;
- }
-
- for(d in this.datas)
- {
- this.datas[d].remove();
- this.options.dirty = true;
- }
- return this;
- },
- getValue : function() {
-
- if(this.isMulti())
- throw 'This field is multi, I can not give you a single value';
-
- if(this.isEmpty())
- return null;
-
- return this.datas[0];
- },
- getValues : function() {
-
- if(!this.isMulti())
- {
- throw 'This field is not multi, I can not give you multiple values';
- }
-
- if(this.isEmpty())
- return new Array();
-
- var arrayValues = [];
-
- for(d in this.datas)
- {
- if(this.datas[d].getValue() === '')
- continue;
-
- arrayValues.push(this.datas[d]);
- }
-
- return arrayValues;
- },
- sort : function(algo) {
- this.datas.sort(algo);
-
- return this;
- },
- getSerializedValues : function() {
-
- var arrayValues = [];
- var values = this.getValues();
-
- for(v in values)
- {
- arrayValues.push(values[v].getValue());
- }
-
- return arrayValues.join(' ' + this.databoxField.getSeparator() + ' ');
- },
- replaceValue : function(search, replace) {
-
- if(this.databoxField.isReadonly())
- {
- if(window.console)
- {
- console.error('Unable to set a value to a readonly field');
- }
-
- return 0;
- }
-
- var n = 0;
-
- 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)
- {
- continue;
- }
-
- n++;
-
- this.removeValue(value);
-
- if(!this.hasValue(replacedValue))
- {
- this.addValue(replacedValue);
- }
-
- this.options.dirty = true;
- }
-
- return n;
- },
- exportDatas : function() {
-
- var returnValue = new Array();
-
- 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()
+ this.datas = {
+ meta_id:meta_id,
+ value:value,
+ VocabularyId:VocabularyId
};
- if(this.datas[d].getVocabularyId())
- {
- temp.vocabularyId = this.datas[d].getVocabularyId();
+ var $this = this;
+ };
+
+ recordFieldValue.prototype = {
+ getValue : function() {
+ return this.datas.value;
+ },
+ getMetaId : function() {
+ return this.datas.meta_id;
+ },
+ getVocabularyId : function() {
+ return this.datas.VocabularyId;
+ },
+ setValue : function(value, VocabularyId) {
+
+ this.datas.value = value;
+ this.datas.VocabularyId = checkVocabId(VocabularyId);
+ return this;
+ },
+ remove : function() {
+ this.datas.value = '';
+ this.datas.VocabularyId = null;
+
+ return this;
}
- returnValue.push(temp);
- }
+ };
- return returnValue;
+ var databoxField = function(name, label, meta_struct_id, options) {
+
+ var defaults = {
+ multi : false,
+ required : false,
+ readonly : false,
+ maxLength : null,
+ minLength : null,
+ type : 'string',
+ separator : null,
+ vocabularyControl : null,
+ vocabularyRestricted : false
+ },
+ options = (typeof options == 'object') ? options : {};
+
+ if(isNaN(meta_struct_id))
+ {
+ throw 'meta_struct_id should be a number';
+ }
+
+ this.name = name;
+ this.label = label;
+ this.meta_struct_id = meta_struct_id;
+ this.options = jQuery.extend(defaults, options);
+
+ if(this.options.multi === true && this.options.separator === null)
+ {
+ this.options.separator = ';';
+ }
+
+ };
+
+ databoxField.prototype = {
+ getMetaStructId : function() {
+ return this.meta_struct_id;
+ },
+ getName : function() {
+ return this.name;
+ },
+ getLabel : function() {
+ return this.label;
+ },
+ isMulti : function() {
+ return this.options.multi;
+ },
+ isRequired : function() {
+ return this.options.required;
+ },
+ isReadonly : function() {
+ return this.options.readonly;
+ },
+ getMaxLength : function() {
+ return this.options.maxLength;
+ },
+ getMinLength : function() {
+ return this.options.minLength;
+ },
+ getType : function() {
+ return this.options.type;
+ },
+ getSeparator : function() {
+ return this.options.separator;
+ }
+ };
+
+ var recordField = function(databoxField, arrayValues) {
+
+ this.databoxField = databoxField;
+ this.options = {
+ dirty : false
+ };
+ this.datas = new 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)
+ {
+ console.error('Trying to add a non-recordFieldValue to the field...');
+ }
+
+ continue;
+ }
+
+ 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)
+ {
+ console.error('Trying to add multi values in a non-multi field');
+ }
+ }
+
+ if(window.console)
+ {
+ console.log('adding a value : ', arrayValues[v]);
+ }
+
+ this.datas.push(arrayValues[v]);
+ first = false;
+ }
+ }
+
+ var $this = this;
}
- };
+ recordField.prototype = {
+ getName : function() {
+ return this.databoxField.getName();
+ },
+ getMetaStructId : function() {
+ return this.databoxField.getMetaStructId();
+ },
+ isMulti : function() {
+ return this.databoxField.isMulti();
+ },
+ isRequired : function() {
+ return this.databoxField.isRequired();
+ },
+ isDirty : function() {
+ return this.options.dirty;
+ },
+ addValue : function(value, merge, VocabularyId) {
- window.p4 = window.p4 || {};
+ VocabularyId = checkVocabId(VocabularyId);
- window.p4.databoxField = databoxField;
- window.p4.recordFieldValue = recordFieldValue;
- window.p4.recordField = recordField;
+ merge = !!merge;
-})(window);
\ No newline at end of file
+ if(this.databoxField.isReadonly())
+ {
+ if(window.console)
+ {
+ console.error('Unable to set a value to a readonly field');
+ }
+
+ return;
+ }
+
+ if(window.console)
+ {
+ console.log('adding value ',value,' vocId : ', VocabularyId , ' ; merge is ',merge);
+ }
+
+ 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)
+ {
+ console.log('already have ',value);
+ }
+ }
+ }
+ 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)
+ {
+ console.error('Cannot merge vocabularies');
+ }
+ this.datas[0].setValue(value, VocabularyId);
+ }
+ else
+ {
+
+ 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)
+ {
+ console.log('Updating value ',value);
+ }
+ this.datas[0].setValue(value, VocabularyId);
+ }
+ this.options.dirty = true;
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+ hasValue : function(value, VocabularyId) {
+
+ 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)
+ {
+ console.log('already got the vocab ID');
+ }
+ return true;
+ }
+ }
+ else if(this.datas[d].getVocabularyId() === null && this.datas[d].getValue() == value)
+ {
+ if(window.console)
+ {
+ console.log('already got this value');
+ }
+ return true;
+ }
+ }
+ return false;
+ },
+ removeValue : function(value, vocabularyId) {
+
+ if(this.databoxField.isReadonly())
+ {
+ if(window.console)
+ {
+ console.error('Unable to set a value to a readonly field');
+ }
+
+ return;
+ }
+
+ vocabularyId = checkVocabId(vocabularyId);
+
+ if(window.console)
+ {
+ console.log('Try to remove value ', value, vocabularyId, this.datas);
+ }
+
+ 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)
+ {
+ 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)
+ {
+ console.log('Found ! removing... ');
+ }
+ this.datas[d].remove();
+ this.options.dirty = true;
+ }
+ }
+ return this;
+ },
+ isEmpty : function() {
+ var empty = true;
+
+ for(d in this.datas)
+ {
+ if(this.datas[d].getValue() !== '')
+ empty = false;
+ }
+ return empty;
+ },
+ empty : function() {
+
+ if(this.databoxField.isReadonly())
+ {
+ if(window.console)
+ {
+ console.error('Unable to set a value to a readonly field');
+ }
+
+ return;
+ }
+
+ for(d in this.datas)
+ {
+ this.datas[d].remove();
+ this.options.dirty = true;
+ }
+ return this;
+ },
+ getValue : function() {
+
+ if(this.isMulti())
+ throw 'This field is multi, I can not give you a single value';
+
+ if(this.isEmpty())
+ return null;
+
+ return this.datas[0];
+ },
+ getValues : function() {
+
+ if(!this.isMulti())
+ {
+ throw 'This field is not multi, I can not give you multiple values';
+ }
+
+ if(this.isEmpty())
+ return new Array();
+
+ var arrayValues = [];
+
+ for(d in this.datas)
+ {
+ if(this.datas[d].getValue() === '')
+ continue;
+
+ arrayValues.push(this.datas[d]);
+ }
+
+ return arrayValues;
+ },
+ sort : function(algo) {
+ this.datas.sort(algo);
+
+ return this;
+ },
+ getSerializedValues : function() {
+
+ var arrayValues = [];
+ var values = this.getValues();
+
+ for(v in values)
+ {
+ arrayValues.push(values[v].getValue());
+ }
+
+ return arrayValues.join(' ' + this.databoxField.getSeparator() + ' ');
+ },
+ replaceValue : function(search, replace) {
+
+ if(this.databoxField.isReadonly())
+ {
+ if(window.console)
+ {
+ console.error('Unable to set a value to a readonly field');
+ }
+
+ return 0;
+ }
+
+ var n = 0;
+
+ 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)
+ {
+ continue;
+ }
+
+ n++;
+
+ this.removeValue(value);
+
+ if(!this.hasValue(replacedValue))
+ {
+ this.addValue(replacedValue);
+ }
+
+ this.options.dirty = true;
+ }
+
+ return n;
+ },
+ exportDatas : function() {
+
+ var returnValue = new Array();
+
+ 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())
+ {
+ temp.vocabularyId = this.datas[d].getVocabularyId();
+ }
+ returnValue.push(temp);
+ }
+
+ return returnValue;
+ }
+ };
+
+ window.p4 = window.p4 || {};
+
+ window.p4.databoxField = databoxField;
+ window.p4.recordFieldValue = recordFieldValue;
+ window.p4.recordField = recordField;
+
+})(window);
diff --git a/www/include/js/jquery.Selection.js b/www/include/js/jquery.Selection.js
index d7f0532b97..f0415bfa33 100644
--- a/www/include/js/jquery.Selection.js
+++ b/www/include/js/jquery.Selection.js
@@ -6,278 +6,278 @@
(function( window ) {
- var Selectable = function($container, options) {
+ var Selectable = function($container, options) {
- var defaults = {
- allow_multiple : false,
- selector : '',
- callbackSelection : null,
- selectStart : null,
- selectStop : null,
- limit : null
+ var defaults = {
+ allow_multiple : false,
+ selector : '',
+ callbackSelection : null,
+ selectStart : null,
+ selectStop : null,
+ limit : null
+ },
+ options = (typeof options == 'object') ? options : {};
+
+ var $this = this;
+
+ if($container.data('selectionnable'))
+ {
+ /* this container is already selectionnable */
+ if(window.console)
+ {
+ console.error('Trying to apply new selection to existing one');
+ }
+
+ return $container.data('selectionnable');
+ }
+
+ this.$container = $container;
+ this.options = jQuery.extend(defaults, options);
+ this.datas = new Array();
+
+ this.$container.data('selectionnable', this);
+ this.$container.addClass('selectionnable');
+
+ jQuery(this.options.selector, this.$container)
+ .live('click', function(event){
+
+ if(typeof $this.options.selectStart === 'function')
+ {
+ $this.options.selectStart(jQuery.extend(jQuery.Event('selectStart'), event), $this);
+ }
+
+ var $that = jQuery(this);
+
+ var k = get_value($that, $this);
+
+ 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
= 0;
+ },
+ get : function(){
+
+ return this.datas;
+ },
+ empty : function(){
+ var $this = this;
+ this.datas = new Array();
+
+ jQuery(this.options.selector, this.$container).filter('.selected:visible').removeClass('selected');
+
+ if(typeof $this.options.selectStop === 'function')
{
- $this.push(k);
- $that.addClass('selected');
+ $this.options.selectStop(jQuery.Event('selectStop'), $this);
}
- else
+
+ return this;
+ },
+ length : function(){
+
+ return this.datas.length;
+ },
+ size : function(){
+
+ return this.datas.length;
+ },
+ serialize : function(separator){
+
+ separator = separator || ';';
+
+ return this.datas.join(separator);
+ },
+ selectAll : function(){
+ this.select('*');
+
+ return this;
+ },
+ select : function(selector){
+ var $this = this,
+ stopped = false;
+
+ jQuery(this.options.selector, this.$container).filter(selector).not('.selected').filter(':visible').each(function(){
+ if(!$this.hasReachLimit())
+ {
+ $this.push(get_value(this, $this));
+ $(this).addClass('selected');
+ }
+ else
+ {
+ if(stopped === false)
+ {
+ alert(language.max_record_selected);
+ }
+ stopped = true;
+ }
+ });
+
+
+ if(typeof $this.options.selectStop === 'function')
{
- alert(language.max_record_selected);
+ $this.options.selectStop(jQuery.Event('selectStop'), $this);
}
- }
+
+ return this;
}
- }
+ };
- jQuery('.last_selected', this.$container).removeClass('last_selected');
- $that.addClass('last_selected');
-
-
- if(typeof $this.options.selectStop === 'function')
- {
- $this.options.selectStop(jQuery.extend(jQuery.Event('selectStop'), event), $this);
- }
-
- return false;
-
- });
-
- return;
- };
-
- function get_value(element, Selectable)
- {
- if(typeof Selectable.options.callbackSelection === 'function')
- {
- return Selectable.options.callbackSelection(jQuery(element));
- }
- else
- {
- return jQuery('input[name="id"]', jQuery(element)).val();
- }
- }
-
- function is_ctrl_key(event)
- {
- if(event.altKey)
- return true;
- if(event.ctrlKey)
- return true;
- if(event.metaKey) // apple key opera
- return true;
- if(event.keyCode == '17') // apple key opera
- return true;
- if(event.keyCode == '224') // apple key mozilla
- return true;
- if(event.keyCode == '91') // apple key safari
- return true;
-
- return false;
- }
-
- function is_shift_key(event)
- {
- if(event.shiftKey)
- return true;
- return false;
- }
-
-
-
- Selectable.prototype = {
- push : function(element){
- if(this.options.allow_multiple === true || !this.has(element))
- {
- this.datas.push(element);
- }
-
- return this;
- },
- hasReachLimit : function() {
- if(this.options.limit !== null && this.options.limit <= this.datas.length)
- {
- return true;
- }
- return false;
- },
- remove : function(element){
- this.datas = jQuery.grep(this.datas, function(n){
- return(n !== element);
- });
-
- return this;
- },
- has : function(element){
-
- return jQuery.inArray(element,this.datas) >= 0;
- },
- get : function(){
-
- return this.datas;
- },
- empty : function(){
- var $this = this;
- this.datas = new Array();
-
- jQuery(this.options.selector, this.$container).filter('.selected:visible').removeClass('selected');
-
- if(typeof $this.options.selectStop === 'function')
- {
- $this.options.selectStop(jQuery.Event('selectStop'), $this);
- }
-
- return this;
- },
- length : function(){
-
- return this.datas.length;
- },
- size : function(){
-
- return this.datas.length;
- },
- serialize : function(separator){
-
- separator = separator || ';';
-
- return this.datas.join(separator);
- },
- selectAll : function(){
- this.select('*');
-
- return this;
- },
- select : function(selector){
- var $this = this,
- stopped = false;
-
- jQuery(this.options.selector, this.$container).filter(selector).not('.selected').filter(':visible').each(function(){
- if(!$this.hasReachLimit())
- {
- $this.push(get_value(this, $this));
- $(this).addClass('selected');
- }
- else
- {
- if(stopped === false)
- {
- alert(language.max_record_selected);
- }
- stopped = true;
- }
- });
-
-
- if(typeof $this.options.selectStop === 'function')
- {
- $this.options.selectStop(jQuery.Event('selectStop'), $this);
- }
-
- return this;
- }
- };
-
- window.Selectable = Selectable;
-})(window);
\ No newline at end of file
+ window.Selectable = Selectable;
+})(window);
diff --git a/www/include/js/jquery.lists.js b/www/include/js/jquery.lists.js
index 5d7111f5e7..64e3d286c7 100644
--- a/www/include/js/jquery.lists.js
+++ b/www/include/js/jquery.lists.js
@@ -2,284 +2,284 @@ var p4 = p4 || {};
(function( window, p4, $ ) {
- var Lists = function() {
-
- };
-
- var List = function (id) {
-
- if(parseInt(id) <= 0)
- {
- throw 'Invalid list id';
+ var Lists = function() {
+
+ };
+
+ var List = function (id) {
+
+ if(parseInt(id) <= 0)
+ {
+ throw 'Invalid list id';
+ }
+
+ this.id = id;
+ };
+
+ Lists.prototype = {
+ create : function(name, callback){
+
+ var $this = this;
+
+ $.ajax({
+ type: 'POST',
+ url: '/prod/lists/list/',
+ dataType: 'json',
+ data: {name : name},
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ var list = new List(data.list_id);
+ callback(list);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
+
+ },
+ get : function(callback, type) {
+
+ var $this = this;
+ type = typeof type === 'undefined' ? 'json' : type;
+
+ $.ajax({
+ type: 'GET',
+ url: '/prod/lists/all/',
+ dataType: type,
+ data: {},
+ success: function(data){
+ if(type == 'json')
+ {
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ callback(data.result);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ else
+ {
+ if(typeof callback === 'function')
+ {
+ callback(data);
+ }
+ }
+ }
+ });
+ }
+
}
-
- this.id = id;
- };
-
- Lists.prototype = {
- create : function(name, callback){
- var $this = this;
+ List.prototype = {
+ addUsers : function(arrayUsers, callback) {
- $.ajax({
- type: 'POST',
- url: '/prod/lists/list/',
- dataType: 'json',
- data: {name : name},
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
+ if(!arrayUsers instanceof Array)
{
- var list = new List(data.list_id);
- callback(list);
+ throw 'addUsers takes array as argument';
}
- }
- else
- {
- humane.error(data.message);
- }
+
+ var $this = this;
+ var data = {usr_ids : $(arrayUsers).toArray()};
+
+ $.ajax({
+ type: 'POST',
+ url: '/prod/lists/list/' + $this.id + '/add/',
+ dataType: 'json',
+ data: data,
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ callback($this, data);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
+ },
+ addUser : function(usr_id, callback) {
+ this.addUsers([usr_id], callback);
+ },
+ remove : function(callback) {
+
+ var $this = this;
+
+ $.ajax({
+ type: 'POST',
+ url: '/prod/lists/list/' + this.id + '/delete/',
+ dataType: 'json',
+ data: {},
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ callback($this);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
+ },
+ update : function(name, callback) {
+
+ var $this = this;
+
+ $.ajax({
+ type: 'POST',
+ url: '/prod/lists/list/' + this.id + '/update/',
+ dataType: 'json',
+ data: { name : name },
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ callback($this);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
+ },
+ removeUser : function(usr_id, callback) {
+
+ var $this = this;
+
+ $.ajax({
+ type: 'POST',
+ url: '/prod/lists/list/' + this.id + '/remove/' + usr_id + '/',
+ dataType: 'json',
+ data: {},
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ callback($this, data);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
+ },
+ shareWith : function(usr_id, role, callback) {
+
+ var $this = this;
+
+ $.ajax({
+ type: 'POST',
+ url: '/prod/lists/list/' + this.id + '/share/' + usr_id + '/',
+ dataType: 'json',
+ data: {role : role},
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ callback($this);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
+ },
+ unshareWith : function(callback) {
+
+ var $this = this;
+
+ $.ajax({
+ type: 'POST',
+ url: '/prod/lists/list/' + this.id + '/unshare/' + usr_id + '/',
+ dataType: 'json',
+ data: {},
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ callback($this);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
+ },
+ get : function(callback) {
+
+ var $this = this;
+
+ $.ajax({
+ type: 'GET',
+ url: '/prod/lists/list/' + this.id + '/',
+ dataType: 'json',
+ data: {},
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+
+ if(typeof callback === 'function')
+ {
+ callback($this, data);
+ }
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
}
- });
-
- },
- get : function(callback, type) {
-
- var $this = this;
- type = typeof type === 'undefined' ? 'json' : type;
-
- $.ajax({
- type: 'GET',
- url: '/prod/lists/all/',
- dataType: type,
- data: {},
- success: function(data){
- if(type == 'json')
- {
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
- {
- callback(data.result);
- }
- }
- else
- {
- humane.error(data.message);
- }
- }
- else
- {
- if(typeof callback === 'function')
- {
- callback(data);
- }
- }
- }
- });
}
-
- }
-
- List.prototype = {
- addUsers : function(arrayUsers, callback) {
-
- if(!arrayUsers instanceof Array)
- {
- throw 'addUsers takes array as argument';
- }
-
- var $this = this;
- var data = {usr_ids : $(arrayUsers).toArray()};
-
- $.ajax({
- type: 'POST',
- url: '/prod/lists/list/' + $this.id + '/add/',
- dataType: 'json',
- data: data,
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
- {
- callback($this, data);
- }
- }
- else
- {
- humane.error(data.message);
- }
- }
- });
- },
- addUser : function(usr_id, callback) {
- this.addUsers([usr_id], callback);
- },
- remove : function(callback) {
-
- var $this = this;
- $.ajax({
- type: 'POST',
- url: '/prod/lists/list/' + this.id + '/delete/',
- dataType: 'json',
- data: {},
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
- {
- callback($this);
- }
- }
- else
- {
- humane.error(data.message);
- }
- }
- });
- },
- update : function(name, callback) {
-
- var $this = this;
+ p4.Lists = new Lists();
+ document.List = List;
- $.ajax({
- type: 'POST',
- url: '/prod/lists/list/' + this.id + '/update/',
- dataType: 'json',
- data: { name : name },
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
- {
- callback($this);
- }
- }
- else
- {
- humane.error(data.message);
- }
- }
- });
- },
- removeUser : function(usr_id, callback) {
-
- var $this = this;
-
- $.ajax({
- type: 'POST',
- url: '/prod/lists/list/' + this.id + '/remove/' + usr_id + '/',
- dataType: 'json',
- data: {},
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
- {
- callback($this, data);
- }
- }
- else
- {
- humane.error(data.message);
- }
- }
- });
- },
- shareWith : function(usr_id, role, callback) {
-
- var $this = this;
-
- $.ajax({
- type: 'POST',
- url: '/prod/lists/list/' + this.id + '/share/' + usr_id + '/',
- dataType: 'json',
- data: {role : role},
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
- {
- callback($this);
- }
- }
- else
- {
- humane.error(data.message);
- }
- }
- });
- },
- unshareWith : function(callback) {
-
- var $this = this;
-
- $.ajax({
- type: 'POST',
- url: '/prod/lists/list/' + this.id + '/unshare/' + usr_id + '/',
- dataType: 'json',
- data: {},
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
- {
- callback($this);
- }
- }
- else
- {
- humane.error(data.message);
- }
- }
- });
- },
- get : function(callback) {
-
- var $this = this;
-
- $.ajax({
- type: 'GET',
- url: '/prod/lists/list/' + this.id + '/',
- dataType: 'json',
- data: {},
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
-
- if(typeof callback === 'function')
- {
- callback($this, data);
- }
- }
- else
- {
- humane.error(data.message);
- }
- }
- });
- }
- }
-
- p4.Lists = new Lists();
- document.List = List;
-
-})(document, p4, jQuery);
\ No newline at end of file
+})(document, p4, jQuery);
diff --git a/www/include/path_files_tests.jquery.js b/www/include/path_files_tests.jquery.js
index e16eafd147..90d10861fc 100644
--- a/www/include/path_files_tests.jquery.js
+++ b/www/include/path_files_tests.jquery.js
@@ -1,115 +1,115 @@
(function( $ ){
- var methods = {
- init : function( options ) {
- var settings = {
- 'url' : '/admin/tests/pathurl/path/'
- };
- return this.each(function() {
+ var methods = {
+ init : function( options ) {
+ var settings = {
+ 'url' : '/admin/tests/pathurl/path/'
+ };
+ return this.each(function() {
- var $this = $(this), data = $(this).data('path_file_tests');
+ var $this = $(this), data = $(this).data('path_file_tests');
- if ( ! data )
- {
- if ( options ) {
- $.extend( settings, options );
- }
- $this.data('path_file_tests', {});
-
- $this.after(' ');
- $this.after(' ');
- $this.after(' ');
-
-
- $this.bind('keyup blur', function(){
- var el_loader = $this.nextAll('.loader');
- var el_status = $this.nextAll('.status');
-
- if($this.data('ajax_path_test') && typeof $this.data('ajax_path_test').abort == 'function')
- $this.data('ajax_path_test').abort();
-
- if(!$this.hasClass('test_executable') && !$this.hasClass('test_writeable') && !$this.hasClass('test_readable'))
- return;
-
-
- if(!$this.hasClass('required') && $.trim($this.val()) === '')
- {
- el_status.css('visibility', 'hidden');
- return;
- }
-
- var ajax = $.ajax({
- dataType: 'json',
- type: "GET",
- url: settings.url,
- data: {
- path : $this.val()
- },
- beforeSend:function(){
- el_loader.css('visibility', 'visible');
- },
- success: function(data){
- el_loader.css('visibility', 'hidden');
- if($this.hasClass('required'))
+ if ( ! data )
{
- $this.addClass('field_error');
+ if ( options ) {
+ $.extend( settings, options );
+ }
+ $this.data('path_file_tests', {});
+
+ $this.after(' ');
+ $this.after(' ');
+ $this.after(' ');
+
+
+ $this.bind('keyup blur', function(){
+ var el_loader = $this.nextAll('.loader');
+ var el_status = $this.nextAll('.status');
+
+ if($this.data('ajax_path_test') && typeof $this.data('ajax_path_test').abort == 'function')
+ $this.data('ajax_path_test').abort();
+
+ if(!$this.hasClass('test_executable') && !$this.hasClass('test_writeable') && !$this.hasClass('test_readable'))
+ return;
+
+
+ if(!$this.hasClass('required') && $.trim($this.val()) === '')
+ {
+ el_status.css('visibility', 'hidden');
+ return;
+ }
+
+ var ajax = $.ajax({
+ dataType: 'json',
+ type: "GET",
+ url: settings.url,
+ data: {
+ path : $this.val()
+ },
+ beforeSend:function(){
+ el_loader.css('visibility', 'visible');
+ },
+ success: function(data){
+ el_loader.css('visibility', 'hidden');
+ if($this.hasClass('required'))
+ {
+ $this.addClass('field_error');
+ }
+ 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)
+ {
+ el_status.attr('src','/skins/icons/delete.png').css('visibility', 'visible');
+ return;
+ }
+ if($this.hasClass('test_readable') && data.readable === false)
+ {
+ el_status.attr('src','/skins/icons/delete.png').css('visibility', 'visible');
+ return;
+ }
+ el_status.attr('src','/skins/icons/ok.png').css('visibility', 'visible');
+ $this.removeClass('field_error');
+ return;
+ },
+ timeout:function(){
+ el_loader.css('visibility', 'hidden');
+ el_status.attr('src','/skins/icons/delete.png').css('visibility', 'visible');
+ },
+ error:function(){
+ el_loader.css('visibility', 'hidden');
+ el_status.attr('src','/skins/icons/delete.png').css('visibility', 'visible');
+ }
+ });
+ $this.data('ajax_path_test', ajax);
+ });
+
+ $this.trigger('keyup');
+
+ $this.nextAll('.reload').bind('click', function(){
+ $this.trigger('keyup');
+ });
}
- 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)
- {
- el_status.attr('src','/skins/icons/delete.png').css('visibility', 'visible');
- return;
- }
- if($this.hasClass('test_readable') && data.readable === false)
- {
- el_status.attr('src','/skins/icons/delete.png').css('visibility', 'visible');
- return;
- }
- el_status.attr('src','/skins/icons/ok.png').css('visibility', 'visible');
- $this.removeClass('field_error');
- return;
- },
- timeout:function(){
- el_loader.css('visibility', 'hidden');
- el_status.attr('src','/skins/icons/delete.png').css('visibility', 'visible');
- },
- error:function(){
- el_loader.css('visibility', 'hidden');
- el_status.attr('src','/skins/icons/delete.png').css('visibility', 'visible');
- }
});
- $this.data('ajax_path_test', ajax);
- });
-
- $this.trigger('keyup');
-
- $this.nextAll('.reload').bind('click', function(){
- $this.trigger('keyup');
- });
+ },
+ destroy : function( ) {
+ return this.each(function() {
+ $(this).data('path_file_tests', null);
+ });
}
- });
- },
- destroy : function( ) {
- return this.each(function() {
- $(this).data('path_file_tests', null);
- });
- }
- };
+ };
- $.fn.path_file_test = function(method) {
+ $.fn.path_file_test = function(method) {
- if ( methods[method] ) {
- return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
- } else if ( typeof method === 'object' || ! method ) {
- return methods.init.apply( this, arguments );
- } else {
- $.error( 'Method ' + method + ' does not exist on jQuery.path_file_test' );
- }
- };
+ if ( methods[method] ) {
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
+ } else if ( typeof method === 'object' || ! method ) {
+ return methods.init.apply( this, arguments );
+ } else {
+ $.error( 'Method ' + method + ' does not exist on jQuery.path_file_test' );
+ }
+ };
})( jQuery );
@@ -117,121 +117,121 @@
(function( $ ){
- var methods = {
- init : function( options ) {
- var settings = {
- 'url' : '/admin/tests/pathurl/url/'
- };
- return this.each(function() {
+ var methods = {
+ init : function( options ) {
+ var settings = {
+ 'url' : '/admin/tests/pathurl/url/'
+ };
+ return this.each(function() {
- var $this = $(this), data = $(this).data('url_tests');
+ var $this = $(this), data = $(this).data('url_tests');
- if ( ! data )
- {
- if ( options ) {
- $.extend( settings, options );
- }
- $this.data('url_tests', {});
-
- $this.after(' ');
- $this.after(' ');
- $this.after(' ');
-
- $this.bind('keyup blur', function(){
- var el_loader = $(this).nextAll('.loader');
- var el_status = $(this).nextAll('.status');
-
- var listable = $this.hasClass('listable');
- var required = $this.hasClass('required');
- var same_domain = $this.hasClass('same_domain');
-
- var value = $.trim($this.val());
-
- if(!required && value === '')
- {
- el_status.attr('src','/skins/icons/ok.png');
- return;
- }
- if(required && value === '')
- {
- el_status.attr('src','/skins/icons/delete.png');
- return;
- }
- if(same_domain && value.substring(0,1) != '/')
- {
- value = '/'+value;
- }
- if(same_domain)
- {
- value = location.protocol+'//'+location.hostname+value;
- }
-
- if($this.data('ajax_url_test') && typeof $this.data('ajax_url_test').abort == 'function')
- $this.data('ajax_url_test').abort();
-
- var ajax = $.ajax({
- type: "GET",
- url: settings.url,
- dataType:'json',
- data: {
- url : value
- },
- beforeSend:function(){
- el_loader.css('visibility', 'visible');
- },
- success: function(datas){
- el_loader.css('visibility', 'hidden');
- if(datas.code === 404)
+ if ( ! data )
{
- el_status.attr('src','/skins/icons/delete.png');
- return;
+ if ( options ) {
+ $.extend( settings, options );
+ }
+ $this.data('url_tests', {});
+
+ $this.after(' ');
+ $this.after(' ');
+ $this.after(' ');
+
+ $this.bind('keyup blur', function(){
+ var el_loader = $(this).nextAll('.loader');
+ var el_status = $(this).nextAll('.status');
+
+ var listable = $this.hasClass('listable');
+ var required = $this.hasClass('required');
+ var same_domain = $this.hasClass('same_domain');
+
+ var value = $.trim($this.val());
+
+ if(!required && value === '')
+ {
+ el_status.attr('src','/skins/icons/ok.png');
+ return;
+ }
+ if(required && value === '')
+ {
+ el_status.attr('src','/skins/icons/delete.png');
+ return;
+ }
+ if(same_domain && value.substring(0,1) != '/')
+ {
+ value = '/'+value;
+ }
+ if(same_domain)
+ {
+ value = location.protocol+'//'+location.hostname+value;
+ }
+
+ if($this.data('ajax_url_test') && typeof $this.data('ajax_url_test').abort == 'function')
+ $this.data('ajax_url_test').abort();
+
+ var ajax = $.ajax({
+ type: "GET",
+ url: settings.url,
+ dataType:'json',
+ data: {
+ url : value
+ },
+ beforeSend:function(){
+ el_loader.css('visibility', 'visible');
+ },
+ success: function(datas){
+ el_loader.css('visibility', 'hidden');
+ if(datas.code === 404)
+ {
+ el_status.attr('src','/skins/icons/delete.png');
+ return;
+ }
+ if(!listable && datas.code === 403)
+ {
+ el_status.attr('src','/skins/icons/ok.png');
+ }
+ else
+ {
+ el_status.attr('src','/skins/icons/delete.png');
+ }
+ return;
+ },
+ timeout:function(){
+ el_loader.css('visibility', 'hidden');
+ el_status.attr('src','/skins/icons/delete.png');
+ },
+ error:function(datas){
+ el_loader.css('visibility', 'hidden');
+ el_status.attr('src','/skins/icons/delete.png');
+ }
+ });
+ $this.data('ajax_url_test', ajax);
+ });
+
+ $this.trigger('keyup');
+ $this.nextAll('.reload').bind('click', function(){
+ $this.trigger('keyup');
+ });
}
- if(!listable && datas.code === 403)
- {
- el_status.attr('src','/skins/icons/ok.png');
- }
- else
- {
- el_status.attr('src','/skins/icons/delete.png');
- }
- return;
- },
- timeout:function(){
- el_loader.css('visibility', 'hidden');
- el_status.attr('src','/skins/icons/delete.png');
- },
- error:function(datas){
- el_loader.css('visibility', 'hidden');
- el_status.attr('src','/skins/icons/delete.png');
- }
});
- $this.data('ajax_url_test', ajax);
- });
-
- $this.trigger('keyup');
- $this.nextAll('.reload').bind('click', function(){
- $this.trigger('keyup');
- });
+ },
+ destroy : function( ) {
+ return this.each(function() {
+ $(this).data('url_tests', null);
+ });
}
- });
- },
- destroy : function( ) {
- return this.each(function() {
- $(this).data('url_tests', null);
- });
- }
- };
+ };
- $.fn.url_test = function(method) {
+ $.fn.url_test = function(method) {
- if ( methods[method] ) {
- return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
- } else if ( typeof method === 'object' || ! method ) {
- return methods.init.apply( this, arguments );
- } else {
- $.error( 'Method ' + method + ' does not exist on jQuery.url_test' );
- }
- };
+ if ( methods[method] ) {
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
+ } else if ( typeof method === 'object' || ! method ) {
+ return methods.init.apply( this, arguments );
+ } else {
+ $.error( 'Method ' + method + ' does not exist on jQuery.url_test' );
+ }
+ };
})( jQuery );
diff --git a/www/scripts/apps/admin/fields/app.js b/www/scripts/apps/admin/fields/app.js
index baf77a0925..6470c314ee 100644
--- a/www/scripts/apps/admin/fields/app.js
+++ b/www/scripts/apps/admin/fields/app.js
@@ -20,8 +20,8 @@ define([
"apps/admin/fields/views/fieldError",
"apps/admin/fields/errors/errorManager"
], function(
- $, _, Backbone, i18n, FieldsCollection, VocabulariesCollection,
- DcFieldsCollection, FieldListView, SaveView, FieldErrorView, ErrorManager) {
+ $, _, Backbone, i18n, FieldsCollection, VocabulariesCollection,
+ DcFieldsCollection, FieldListView, SaveView, FieldErrorView, ErrorManager) {
var initialize = function() {
AdminFieldApp = {
$window : $(window),
@@ -66,16 +66,16 @@ define([
// load all collections
$.when.apply($, [
- AdminFieldApp.fieldsCollection.fetch(),
- AdminFieldApp.vocabularyCollection.fetch(),
- AdminFieldApp.dcFieldsCollection.fetch(),
- $.ajax({
- url: '/available-languages',
- success: function(languages) {
- AdminFieldApp.languages = languages;
- }
- })
- ]).done(
+ AdminFieldApp.fieldsCollection.fetch(),
+ AdminFieldApp.vocabularyCollection.fetch(),
+ AdminFieldApp.dcFieldsCollection.fetch(),
+ $.ajax({
+ url: '/available-languages',
+ success: function(languages) {
+ AdminFieldApp.languages = languages;
+ }
+ })
+ ]).done(
function() {
// register views
AdminFieldApp.saveView = new SaveView({
diff --git a/www/scripts/apps/admin/fields/views/create.js b/www/scripts/apps/admin/fields/views/create.js
index 103e0bebab..db6a87db84 100644
--- a/www/scripts/apps/admin/fields/views/create.js
+++ b/www/scripts/apps/admin/fields/views/create.js
@@ -138,15 +138,15 @@ define([
AdminFieldApp.fieldsCollection.add(field);
_.last(AdminFieldApp.fieldListView.itemViews).clickAction().animate();
- new AlertView({alert: "info", message: i18n.t("created_success", {
- postProcess: "sprintf",
- sprintf: [field.get("name")]
- })
+ new AlertView({alert: "info", message: i18n.t("created_success", {
+ postProcess: "sprintf",
+ sprintf: [field.get("name")]
+ })
}).render();
},
error: function(xhr, textStatus, errorThrown) {
new AlertView({
- alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")}
+ alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")}
).render();
self.toggleCreateFormAction();
diff --git a/www/scripts/apps/admin/fields/views/dcField.js b/www/scripts/apps/admin/fields/views/dcField.js
index 369309ed31..089aa0f985 100644
--- a/www/scripts/apps/admin/fields/views/dcField.js
+++ b/www/scripts/apps/admin/fields/views/dcField.js
@@ -38,5 +38,5 @@ define([
}
});
- return DcFieldsView;
+ return DcFieldsView;
});
diff --git a/www/scripts/apps/admin/fields/views/edit.js b/www/scripts/apps/admin/fields/views/edit.js
index 2ff44573c9..16da4a4bbe 100644
--- a/www/scripts/apps/admin/fields/views/edit.js
+++ b/www/scripts/apps/admin/fields/views/edit.js
@@ -207,7 +207,7 @@ define([
},
// select temView by index in itemList
_selectModelView: function(index) {
- // select previous or next itemview
+ // select previous or next itemview
if (index >= 0) {
AdminFieldApp.fieldListView.itemViews[index].select().animate().click();
}
diff --git a/www/scripts/apps/admin/fields/views/listRow.js b/www/scripts/apps/admin/fields/views/listRow.js
index 1d0297d4df..87eef78d3d 100644
--- a/www/scripts/apps/admin/fields/views/listRow.js
+++ b/www/scripts/apps/admin/fields/views/listRow.js
@@ -63,7 +63,7 @@ define([
// highlight view if edit view model match current view model
if (AdminFieldApp.fieldEditView
- && AdminFieldApp.fieldEditView.model.get("id") === this.model.get("id")) {
+ && AdminFieldApp.fieldEditView.model.get("id") === this.model.get("id")) {
this.select();
}
diff --git a/www/scripts/apps/admin/fields/views/save.js b/www/scripts/apps/admin/fields/views/save.js
index dd9bbeee39..81fd1cf71a 100644
--- a/www/scripts/apps/admin/fields/views/save.js
+++ b/www/scripts/apps/admin/fields/views/save.js
@@ -38,19 +38,19 @@ define([
if (this._isModelDesync()) {
this._loadingState(true);
$.when.apply($, _.map(AdminFieldApp.fieldsToDelete, function(m){
- return m.destroy({
- success: function(model, response) {
- AdminFieldApp.fieldsToDelete = _.filter(AdminFieldApp.fieldsToDelete, function(m){
- return model.get("id") !== m.get("id");
- });
- },
- error: function(xhr, textStatus, errorThrown) {
- new AlertView({
- alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")
- }).render();
- }
- });
- })).done(
+ return m.destroy({
+ success: function(model, response) {
+ AdminFieldApp.fieldsToDelete = _.filter(AdminFieldApp.fieldsToDelete, function(m){
+ return model.get("id") !== m.get("id");
+ });
+ },
+ error: function(xhr, textStatus, errorThrown) {
+ new AlertView({
+ alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")
+ }).render();
+ }
+ });
+ })).done(
function() {
AdminFieldApp.fieldsCollection.save({
success: function(fields) {
@@ -69,8 +69,8 @@ define([
}).render();
}
}).done(function() {
- self._loadingState(false);
- });
+ self._loadingState(false);
+ });
}
);
}
diff --git a/www/scripts/apps/login/home/bind.js b/www/scripts/apps/login/home/bind.js
index 5656376945..49be549e7c 100644
--- a/www/scripts/apps/login/home/bind.js
+++ b/www/scripts/apps/login/home/bind.js
@@ -19,7 +19,7 @@ require([
resGetPath: Common.languagePath,
useLocalStorage: true
}, function() {
- new LoginForm({
+ new LoginForm({
el : $("form[name=loginForm]"),
rules: [{
name: "login",
diff --git a/www/scripts/apps/login/home/common.js b/www/scripts/apps/login/home/common.js
index 4283fa3dae..2e5f03d1f6 100644
--- a/www/scripts/apps/login/home/common.js
+++ b/www/scripts/apps/login/home/common.js
@@ -36,9 +36,9 @@ define([
} else {
return i18n.t(
options.length === 1 ? "one_collection_selected": "collections_selected", {
- postProcess: "sprintf",
- sprintf: [options.length]
- }) + ' ';
+ postProcess: "sprintf",
+ sprintf: [options.length]
+ }) + ' ';
}
}
});
diff --git a/www/scripts/apps/login/home/login.js b/www/scripts/apps/login/home/login.js
index 5656376945..49be549e7c 100644
--- a/www/scripts/apps/login/home/login.js
+++ b/www/scripts/apps/login/home/login.js
@@ -19,7 +19,7 @@ require([
resGetPath: Common.languagePath,
useLocalStorage: true
}, function() {
- new LoginForm({
+ new LoginForm({
el : $("form[name=loginForm]"),
rules: [{
name: "login",
diff --git a/www/scripts/apps/login/home/mapping.js b/www/scripts/apps/login/home/mapping.js
index 5656376945..49be549e7c 100644
--- a/www/scripts/apps/login/home/mapping.js
+++ b/www/scripts/apps/login/home/mapping.js
@@ -19,7 +19,7 @@ require([
resGetPath: Common.languagePath,
useLocalStorage: true
}, function() {
- new LoginForm({
+ new LoginForm({
el : $("form[name=loginForm]"),
rules: [{
name: "login",
diff --git a/www/scripts/apps/login/home/oauthLogin.js b/www/scripts/apps/login/home/oauthLogin.js
index ceb124a342..49be549e7c 100644
--- a/www/scripts/apps/login/home/oauthLogin.js
+++ b/www/scripts/apps/login/home/oauthLogin.js
@@ -17,9 +17,9 @@ require([
i18n.init({
resGetPath: Common.languagePath,
- useLocalStorage: true
+ useLocalStorage: true
}, function() {
- new LoginForm({
+ new LoginForm({
el : $("form[name=loginForm]"),
rules: [{
name: "login",
diff --git a/www/scripts/apps/login/home/recoverPassword.js b/www/scripts/apps/login/home/recoverPassword.js
index f3a285d749..cf048c80f5 100644
--- a/www/scripts/apps/login/home/recoverPassword.js
+++ b/www/scripts/apps/login/home/recoverPassword.js
@@ -14,8 +14,8 @@ require([
"common/forms/views/formType/passwordSetter"
], function($, i18n, Common, RenewPassword) {
i18n.init({
- resGetPath: Common.languagePath,
- useLocalStorage: true
+ resGetPath: Common.languagePath,
+ useLocalStorage: true
}, function() {
Common.initialize();
diff --git a/www/scripts/apps/login/home/register.js b/www/scripts/apps/login/home/register.js
index bf20ef5098..79a6fe98df 100644
--- a/www/scripts/apps/login/home/register.js
+++ b/www/scripts/apps/login/home/register.js
@@ -18,97 +18,97 @@ require([
var fieldsConfiguration = [];
$.when.apply($, [
- $.ajax({
- url: '/login/registration-fields/',
- success: function(config) {
- fieldsConfiguration = config;
- }
- })
- ]).done(function(){
- i18n.init({
- resGetPath: Common.languagePath,
- useLocalStorage: true
- }, function() {
- Common.initialize();
-
- 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", {
- postProcess: "sprintf",
- sprintf: ["1"]
- }),
- type: "multiple"
- }];
-
- _.each(fieldsConfiguration, function(field) {
- if (field.required) {
- var rule = {
- "name": field.name,
- "rules": "required",
- "message": i18n.t("validation_blank")
- };
-
- rules.push(rule);
+ $.ajax({
+ url: '/login/registration-fields/',
+ success: function(config) {
+ fieldsConfiguration = config;
}
- });
+ })
+ ]).done(function(){
+ i18n.init({
+ resGetPath: Common.languagePath,
+ useLocalStorage: true
+ }, function() {
+ Common.initialize();
- var $form = $("form[name=registerForm]");
+ 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", {
+ postProcess: "sprintf",
+ sprintf: ["1"]
+ }),
+ type: "multiple"
+ }];
- new RegisterForm({
- el : $form,
- rules: rules
- });
+ _.each(fieldsConfiguration, function(field) {
+ if (field.required) {
+ var rule = {
+ "name": field.name,
+ "rules": "required",
+ "message": i18n.t("validation_blank")
+ };
- var geocompleter = geonames.init($("#geonameid"), {
- "server": $form.data("geonames-server-adress"),
- "limit": 40,
- "init-input": false,
- "onInit": function(input, autoinput) {
- // Set default name to geonameid-completer
- autoinput.prop("name", "geonameid-completer");
- }
- });
+ rules.push(rule);
+ }
+ });
- // Positioning menu below input
- geocompleter.geocompleter("autocompleter", "option", "position", {
- "of": geocompleter.closest(".input-table"),
- "my": "left top",
- "at": "left bottom"
- });
+ var $form = $("form[name=registerForm]");
- // On open menu calculate max-width
- geocompleter.geocompleter("autocompleter", "on", "autocompleteopen", function(event, ui) {
- $(this).autocomplete("widget").css("min-width", geocompleter.closest(".input-table").outerWidth());
+ new RegisterForm({
+ el : $form,
+ rules: rules
+ });
+
+ var geocompleter = geonames.init($("#geonameid"), {
+ "server": $form.data("geonames-server-adress"),
+ "limit": 40,
+ "init-input": false,
+ "onInit": function(input, autoinput) {
+ // Set default name to geonameid-completer
+ autoinput.prop("name", "geonameid-completer");
+ }
+ });
+
+ // Positioning menu below input
+ geocompleter.geocompleter("autocompleter", "option", "position", {
+ "of": geocompleter.closest(".input-table"),
+ "my": "left top",
+ "at": "left bottom"
+ });
+
+ // On open menu calculate max-width
+ geocompleter.geocompleter("autocompleter", "on", "autocompleteopen", function(event, ui) {
+ $(this).autocomplete("widget").css("min-width", geocompleter.closest(".input-table").outerWidth());
+ });
});
});
- });
});
diff --git a/www/scripts/apps/login/home/registerProvider.js b/www/scripts/apps/login/home/registerProvider.js
index 087ba7b98e..76eb7221be 100644
--- a/www/scripts/apps/login/home/registerProvider.js
+++ b/www/scripts/apps/login/home/registerProvider.js
@@ -19,71 +19,71 @@ require([
var fieldsConfiguration = [];
$.when.apply($, [
- $.ajax({
- url: '/login/registration-fields/',
- success: function(config) {
- fieldsConfiguration = config;
- }
- })
- ]).done(function(){
- i18n.init({
- resGetPath: Common.languagePath,
- useLocalStorage: true
- }, function() {
- 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", {
- postProcess: "sprintf",
- sprintf: ["1"]
- }),
- type: "multiple"
- }];
-
- _.each(fieldsConfiguration, function(field) {
- if (field.required) {
- var rule = {
- "name": field.name,
- "rules": "required",
- "message": i18n.t("validation_blank")
- };
-
- rules.push(rule);
+ $.ajax({
+ url: '/login/registration-fields/',
+ success: function(config) {
+ fieldsConfiguration = config;
}
- });
+ })
+ ]).done(function(){
+ i18n.init({
+ resGetPath: Common.languagePath,
+ useLocalStorage: true
+ }, function() {
+ 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", {
+ postProcess: "sprintf",
+ sprintf: ["1"]
+ }),
+ type: "multiple"
+ }];
- new RegisterForm({
- el : $("form[name=registerForm]"),
- rules: rules
+ _.each(fieldsConfiguration, function(field) {
+ if (field.required) {
+ var rule = {
+ "name": field.name,
+ "rules": "required",
+ "message": i18n.t("validation_blank")
+ };
+
+ rules.push(rule);
+ }
+ });
+
+ new RegisterForm({
+ el : $("form[name=registerForm]"),
+ rules: rules
+ });
});
});
- });
});
diff --git a/www/scripts/apps/login/home/renewEmail.js b/www/scripts/apps/login/home/renewEmail.js
index c8e29aa3b4..fccb7b9c25 100644
--- a/www/scripts/apps/login/home/renewEmail.js
+++ b/www/scripts/apps/login/home/renewEmail.js
@@ -14,8 +14,8 @@ require([
"common/forms/views/form"
], function($, i18n, Common, RenewEmail) {
i18n.init({
- resGetPath: Common.languagePath,
- useLocalStorage: true
+ resGetPath: Common.languagePath,
+ useLocalStorage: true
}, function() {
Common.initialize();
diff --git a/www/scripts/apps/login/home/renewPassword.js b/www/scripts/apps/login/home/renewPassword.js
index 3646c32a3a..c09b7463c5 100644
--- a/www/scripts/apps/login/home/renewPassword.js
+++ b/www/scripts/apps/login/home/renewPassword.js
@@ -14,8 +14,8 @@ require([
"common/forms/views/formType/passwordSetter"
], function($, i18n, Common, RenewPassword) {
i18n.init({
- resGetPath: Common.languagePath,
- useLocalStorage: true
+ resGetPath: Common.languagePath,
+ useLocalStorage: true
}, function() {
Common.initialize();
diff --git a/www/scripts/common/forms/views/error.js b/www/scripts/common/forms/views/error.js
index 50a3c348cc..85f8034fbe 100644
--- a/www/scripts/common/forms/views/error.js
+++ b/www/scripts/common/forms/views/error.js
@@ -55,7 +55,7 @@ define([
return this;
},
reset: function() {
- this.$el.empty();
+ this.$el.empty();
}
});
diff --git a/www/scripts/common/forms/views/formType/passwordSetter.js b/www/scripts/common/forms/views/formType/passwordSetter.js
index 925e180520..e5f112aeaa 100644
--- a/www/scripts/common/forms/views/formType/passwordSetter.js
+++ b/www/scripts/common/forms/views/formType/passwordSetter.js
@@ -17,9 +17,9 @@ define([
], function($, _, i18n, Backbone, bootstrap, FormView) {
var PasswordSetterForm = FormView.extend({
events: function(){
- return _.extend({},FormView.prototype.events,{
- 'keyup input[type=password]' : 'onPasswordKeyup'
- });
+ return _.extend({},FormView.prototype.events,{
+ 'keyup input[type=password]' : 'onPasswordKeyup'
+ });
},
onPasswordKeyup : function(event) {
var input = $(event.target);
diff --git a/www/scripts/tests/specs/admin/fields.js b/www/scripts/tests/specs/admin/fields.js
index a600e35237..d1ef466795 100644
--- a/www/scripts/tests/specs/admin/fields.js
+++ b/www/scripts/tests/specs/admin/fields.js
@@ -32,7 +32,7 @@ define([
ModalView,
SaveView,
DcFieldView
-) {
+ ) {
var expect = chai.expect;
var assert = chai.assert;
var should = chai.should();
@@ -176,14 +176,14 @@ define([
describe("DcField Views", function() {
beforeEach(function() {
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"
- }
+ "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"
+ }
]);
var model = new FieldModel({"id": 1, "sbas-id": sbasId, "name": "Categorie", "tag": "XMP:Categorie"});
@@ -236,7 +236,7 @@ define([
});
it("should not render an error message if provided tag is empty", function() {
- var view = this.view.render();
+ var view = this.view.render();
view.$('input#tag').val("").blur();
diff --git a/www/scripts/tests/specs/login/home.js b/www/scripts/tests/specs/login/home.js
index 343f929a20..756eddb266 100644
--- a/www/scripts/tests/specs/login/home.js
+++ b/www/scripts/tests/specs/login/home.js
@@ -12,7 +12,7 @@ define([
FormView,
InputView,
ErrorView
-) {
+ ) {
var expect = chai.expect;
var assert = chai.assert;
var should = chai.should();
diff --git a/www/skins/account/account.js b/www/skins/account/account.js
index 7a56e9f3c1..e948fcd1dd 100644
--- a/www/skins/account/account.js
+++ b/www/skins/account/account.js
@@ -52,11 +52,11 @@ $(document).ready(function() {
saveBtn.show();
// wrapp current calback in an input
input
- .empty()
- .wrapInner(''
- + ' '
- );
+ .empty()
+ .wrapInner(''
+ + ' '
+ );
$(".url_callback").die();
@@ -71,9 +71,9 @@ $(document).ready(function() {
data :{callback : callback},
success : function(data) {
if(data.success) {
- input.empty().append(callback);
+ input.empty().append(callback);
} else {
- input.empty().append(inputVal);
+ input.empty().append(inputVal);
}
}
});
diff --git a/www/skins/admin/editusers.js b/www/skins/admin/editusers.js
index 89e5ae433f..6748579e89 100644
--- a/www/skins/admin/editusers.js
+++ b/www/skins/admin/editusers.js
@@ -1,507 +1,507 @@
function ini_edit_usrs(){
- $('.users_col.options').bind('click', function(event){
- $('#users_check_uncheck').remove();
- event.stopPropagation();
- event.preventDefault();
- check_uncheck_menu($('input[name="right"]', $(this)).val(),$('input[name="sbas_id"]', $(this)).val(), $(this));
- return false;
- });
-
- $(document).unbind('click.usersoptions').bind('click.usersoptions', function(event){
- $('#users_check_uncheck').remove();
- });
-
- $('table.hoverable tr').hover(
- function(){
- $(this).addClass('hovered');
- },
- function(){
- $(this).removeClass('hovered');
- }
- );
-
- $('table.hoverable td').hover(
- function(){
- var attr = $('input:first', this).attr('name');
- var right = attr ? attr.split('_').shift() : false;
- if(right)
- $('td.case_right_'+right).addClass('hovered');
- },
- function(){
- var attr = $('input:first', this).attr('name');
- var right = attr ? attr.split('_').shift() : false;
- if(right)
- $('td.hovered').removeClass('hovered');
- }
- );
-
- function user_click_box(event, element, status)
- {
- var newclass, newvalue, boxes;
-
- var $element = $(element);
-
- 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))))
- {
- newclass = 'checked';
- newvalue = '1';
-
- if(boxes)
- boxes.show();
- }
- else
- {
- newclass = 'unchecked';
- newvalue = '0';
-
- if(boxes)
- boxes.hide();
- }
-
- $element.find('input').val(newvalue);
- $element.removeClass('mixed checked unchecked').addClass(newclass);
- }
-
- $('#users_rights_form div.switch_right').bind('click', function(event){
- user_click_box(event, $(this));
- });
-$('#right-ajax button.users_rights_valid').bind('click', function(){
- var datas = {
- users:$('#users_rights_form input[name="users"]').val(),
- values:$('#users_rights_form').serialize(),
- template:$('#users_rights_form select[name="template"]').val(),
- user_infos:$('#user_infos_form').serialize()
- };
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/apply/',
- dataType:'json',
- data: datas,
- success: function(data){
- if(!data.error)
- $('a.zone_editusers').trigger('click');
- else
- alert(data.message);
- }
- });
- return false;
- });
-
- $('#right-ajax .users_rights_cancel').bind('click', function(){
- var $this = $(this);
- $('#right-ajax').empty().addClass('loading').parent().show();
- $('#right').hide();
- $.get($this.attr('href'), function(data) {
- $('#right-ajax').removeClass('loading').html(data);
+ $('.users_col.options').bind('click', function(event){
+ $('#users_check_uncheck').remove();
+ event.stopPropagation();
+ event.preventDefault();
+ check_uncheck_menu($('input[name="right"]', $(this)).val(),$('input[name="sbas_id"]', $(this)).val(), $(this));
+ return false;
});
- return false;
- });
+ $(document).unbind('click.usersoptions').bind('click.usersoptions', function(event){
+ $('#users_check_uncheck').remove();
+ });
- var time_buttons = {
- 'Ok':function(){
- save_time();
- },
- 'Cancel':function(){
- $('#time_dialog').dialog('close');
- }
- };
- $('#time_dialog').dialog({
- resizable:false,
- autoOpen:false,
- draggable:false,
- buttons:time_buttons,
- modal:true
- });
- var quota_buttons = {
- 'Ok':function(){
- save_quotas();
- },
- 'Cancel':function(){
- $('#quotas_dialog').dialog('close');
- }
- };
- $('#quotas_dialog').dialog({
- resizable:false,
- autoOpen:false,
- draggable:false,
- buttons:quota_buttons,
- modal:true
- });
+ $('table.hoverable tr').hover(
+ function(){
+ $(this).addClass('hovered');
+ },
+ function(){
+ $(this).removeClass('hovered');
+ }
+ );
- var masks_buttons = {
- 'Ok':function(){
- save_masks();
- },
- 'Cancel':function(){
- $('#masks_dialog').dialog('close');
- }
- };
- $('#masks_dialog').dialog({
- resizable:false,
- autoOpen:false,
- draggable:false,
- buttons:masks_buttons,
- width:900,
- height:300,
- modal:true
- });
- $('#users_rights_form .time_trigger').bind('click', function(){
- var base_id = $(this).find('input[name="time_base_id"]').val();
- if ('undefined' !== typeof base_id) {
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/time/',
- data: {
- users:$('#users_rights_form input[name="users"]').val(),
- base_id:base_id
- },
- success: function(data){
- var dialog = $('#time_dialog');
+ $('table.hoverable td').hover(
+ function(){
+ var attr = $('input:first', this).attr('name');
+ var right = attr ? attr.split('_').shift() : false;
+ if(right)
+ $('td.case_right_'+right).addClass('hovered');
+ },
+ function(){
+ var attr = $('input:first', this).attr('name');
+ var right = attr ? attr.split('_').shift() : false;
+ if(right)
+ $('td.hovered').removeClass('hovered');
+ }
+ );
- if (dialog.data("ui-dialog")) {
- dialog.html(data).dialog('open');
- }
+ function user_click_box(event, element, status)
+ {
+ var newclass, newvalue, boxes;
- $('div.switch_time', dialog).bind('click', function(event){
- var newclass, boxes;
+ var $element = $(element);
- boxes = $(this).closest('form').find('input.datepicker');
-
- if(($(this).hasClass('mixed') === true) ||Â ($(this).hasClass('unchecked') === true))
- {
- newclass = 'checked';
- boxes.removeAttr('readonly');
- }
- else
- {
- newclass = 'unchecked';
- boxes.attr('readonly','readonly');
- }
-
- $(this).removeClass('mixed checked unchecked').addClass(newclass);
- });
- }
- });
- } else {
- var sbas_id = $(this).find('input[name="time_sbas_id"]').val();
-
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/time/sbas/',
- data: {
- users:$('#users_rights_form input[name="users"]').val(),
- sbas_id:sbas_id
- },
- success: function(data){
- var dialog = $('#time_dialog');
-
- dialog.html(data);
- dialog.dialog('open');
-
- $('div.switch_time', dialog).bind('click', function(event){
- var newclass, boxes;
-
- boxes = $(this).closest('form').find('input.datepicker');
-
- if(($(this).hasClass('mixed') === true) ||Â ($(this).hasClass('unchecked') === true))
- {
- newclass = 'checked';
- boxes.removeAttr('readonly');
- }
- else
- {
- newclass = 'unchecked';
- boxes.attr('readonly','readonly');
- }
-
- $(this).removeClass('mixed checked unchecked').addClass(newclass);
- });
- }
- });
- }
- });
- $('#users_rights_form .quota_trigger').bind('click', function(){
- var base_id = $(this).find('input[name="quota_base_id"]').val();
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/quotas/',
- data: {
- users:$('#users_rights_form input[name="users"]').val(),
- base_id:base_id
- },
- success: function(data){
- var dialog = $('#quotas_dialog');
-
- if (dialog.data("ui-dialog")) {
- dialog.html(data).dialog('open');
+ if($element.hasClass('right_access'))
+ {
+ var base_id = $element.find('input').attr('name').split('_').pop();
+ boxes = $('div.base_'+base_id+':not(:first)');
}
- $('div.switch_quota', dialog).bind('click', function(event){
- var newclass, boxes;
-
- boxes = $(this).closest('form').find('input:text');
-
- if(($(this).hasClass('mixed')===true) ||Â ($(this).hasClass('unchecked') === true))
- {
+ if((typeof status !== 'undefined' && status == 'checked') ||Â (typeof status === 'undefined' && (($element.hasClass('mixed') === true) ||Â ($element.hasClass('unchecked') === true))))
+ {
newclass = 'checked';
- boxes.removeAttr('readonly');
- }
- else
- {
+ newvalue = '1';
+
+ if(boxes)
+ boxes.show();
+ }
+ else
+ {
newclass = 'unchecked';
- boxes.attr('readonly','readonly');
- }
+ newvalue = '0';
- $(this).removeClass('mixed checked unchecked').addClass(newclass);
- });
- }
- });
- });
+ if(boxes)
+ boxes.hide();
+ }
- $('#users_rights_form .masks_trigger').bind('click', function(){
- var base_id = $(this).find('input[name="masks_base_id"]').val();
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/masks/',
- data: {
- users:$('#users_rights_form input[name="users"]').val(),
- base_id:base_id
- },
- success: function(data){
- $('#masks_dialog').html(data).dialog('open');
-
- $('.switch_masks').bind('click', function(){
- var currentclass, newclass;
-
- var bit = $(this).find('input[name="bit"]').val();
- currentclass = 'unchecked';
- if($(this).hasClass('mixed'))
- {
- currentclass = 'mixed';
- }
- if($(this).hasClass('checked'))
- {
- currentclass = 'checked';
- }
- switch(currentclass)
- {
- case 'mixed':
- default:
- $('.bitnum_'+bit).removeClass('mixed checked unchecked').addClass('checked')
- break;
- case 'unchecked':
- $(this).removeClass('mixed checked unchecked').addClass('checked')
- break;
- case 'checked':
- if($('.checked.bitnum_'+bit).length == 2)
- {
- $(this).removeClass('mixed checked unchecked').addClass('unchecked')
- }
- else
- {
- alert("admin::user:mask: vous devez cocher au moins une case pour chaque status");
- return;
- }
- break;
- }
-
- var left = $('.bitnum_'+bit+'.bit_left');
- var right = $('.bitnum_'+bit+'.bit_right');
-
- var maskform = $('#masks_dialog form');
- var vand_and = $('input[name="vand_and"]', maskform);
- var vand_or = $('input[name="vand_or"]', maskform);
- var vxor_and = $('input[name="vxor_and"]', maskform);
- var vxor_or = $('input[name="vxor_or"]', maskform);
-
- 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') )
- {
- newbit_vand_and = "1";
- newbit_vand_or = "1";
- }
- else if( left.hasClass('unchecked') && right.hasClass('checked') )
- {
- newbit_vand_and = "1";
- newbit_vand_or = "1";
- newbit_vxor_and = "1";
- newbit_vxor_or = "1";
- }
- vand_and.val( vand_and.val().substr(0, 31 - bit) + newbit_vand_and + vand_and.val().substr(31 + 1 - bit) );
- vand_or.val ( vand_or.val().substr( 0, 31 - bit) + newbit_vand_or + vand_or.val().substr( 31 + 1 - bit) );
- vxor_and.val( vxor_and.val().substr(0, 31 - bit) + newbit_vxor_and + vxor_and.val().substr(31 + 1 - bit) );
- vxor_or.val ( vxor_or.val().substr( 0, 31 - bit) + newbit_vxor_or + vxor_and.val().substr(31 + 1 - bit) );
- }
- });
- }
- });
- });
-
-
- function save_masks()
- {
- var cont = $('#masks_dialog');
-
- var maskform = $('#masks_dialog form');
- var base_id = $('input[name="base_id"]', maskform).val();
- var users = $('input[name="users"]', maskform).val();
- var vand_and = $('input[name="vand_and"]', maskform).val();
- var vand_or = $('input[name="vand_or"]', maskform).val();
- var vxor_and = $('input[name="vxor_and"]', maskform).val();
- var vxor_or = $('input[name="vxor_or"]', maskform).val();
-
-
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/masks/apply/',
- data: {
- users:users,
- base_id:base_id,
- vand_and:vand_and,
- vand_or:vand_or,
- vxor_and:vxor_and,
- vxor_or:vxor_or
- },
- success: function(data){
- $('#masks_dialog').dialog('close');
- }
- });
- }
-
-
- function save_quotas()
- {
- var cont = $('#quotas_dialog');
- var base_id = $('input[name="base_id"]', cont).val();
- var users = $('input[name="users"]', cont).val();
- var droits = $('input[name="droits"]', cont).val();
- var restes = $('input[name="restes"]', cont).val();
-
- var switch_quota = $('.switch_quota', cont);
-
- if(switch_quota.hasClass('mixed'))
- return;
-
- var quota = 0;
-
- if(switch_quota.hasClass('checked'))
- quota = 1;
-
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/quotas/apply/',
- data: {
- act:"APPLYQUOTAS",
- users:users,
- base_id:base_id,
- quota:quota,
- droits:droits,
- restes:restes
- },
- success: function(data){
- $('#quotas_dialog').dialog('close');
- }
- });
- }
-
- function save_time()
- {
- var cont = $('#time_dialog');
- var dmin = $('input[name="dmin"]', cont).val();
- var dmax = $('input[name="dmax"]', cont).val();
- var users = $('input[name="users"]', cont).val();
- var base_id = $('input[name="base_id"]', cont).val();
- var sbas_id = $('input[name="sbas_id"]', cont).val();
-
- var switch_time = $('.switch_time', cont);
-
- if(switch_time.hasClass('mixed'))
- return;
-
- var limit = 0;
-
- if(switch_time.hasClass('checked'))
- limit = 1;
-
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/time/apply/',
- data: {
- users:users,
- base_id:base_id,
- sbas_id:sbas_id,
- limit:limit,
- dmin:dmin,
- dmax:dmax
- },
- success: function(data){
- $('#time_dialog').dialog('close');
- }
- });
- }
-
- function check_uncheck_menu(right, sbas_id, el)
- {
- var top = el.offset().top ;
- var left = el.offset().left + 16;
- $('body').append(''+
- '
'+
- language.check_all+
- ' '+
- ' '+
- '
'+
- '
'+
- language.uncheck_all+
- ' '+
- ' '+
- '
');
-
- $('#users_check_uncheck div').hover(
- function(){
- $(this).addClass('hovered');
- },
- function(){
- $(this).removeClass('hovered');
- }
- );
- $('#users_check_uncheck div.checker').bind('click',function(event){
- event.stopPropagation();
- event.preventDefault();
- users_check(true, $('input[name="sbas_id"]',$(this)).val(), $('input[name="right"]',$(this)).val());
- $('#users_check_uncheck').remove();
- });
- $('#users_check_uncheck div.unchecker').bind('click',function(event){
- event.stopPropagation();
- event.preventDefault();
- users_check(false, $('input[name="sbas_id"]',$(this)).val(), $('input[name="right"]',$(this)).val());
- $('#users_check_uncheck').remove();
- });
-
- }
- function users_check(bool, sbas_id, right)
- {
- var newclass;
- if(bool)
- {
- newclass="checked";
+ $element.find('input').val(newvalue);
+ $element.removeClass('mixed checked unchecked').addClass(newclass);
}
- else
- {
- newclass="unchecked";
- }
- $('.inside_sbas_'+sbas_id+'.'+right+':visible').each(function(i,n){
- user_click_box(null, $(n), newclass);
+
+ $('#users_rights_form div.switch_right').bind('click', function(event){
+ user_click_box(event, $(this));
});
- }
+ $('#right-ajax button.users_rights_valid').bind('click', function(){
+ var datas = {
+ users:$('#users_rights_form input[name="users"]').val(),
+ values:$('#users_rights_form').serialize(),
+ template:$('#users_rights_form select[name="template"]').val(),
+ user_infos:$('#user_infos_form').serialize()
+ };
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/apply/',
+ dataType:'json',
+ data: datas,
+ success: function(data){
+ if(!data.error)
+ $('a.zone_editusers').trigger('click');
+ else
+ alert(data.message);
+ }
+ });
+ return false;
+ });
+
+ $('#right-ajax .users_rights_cancel').bind('click', function(){
+ var $this = $(this);
+ $('#right-ajax').empty().addClass('loading').parent().show();
+ $('#right').hide();
+ $.get($this.attr('href'), function(data) {
+ $('#right-ajax').removeClass('loading').html(data);
+ });
+
+ return false;
+ });
+
+ var time_buttons = {
+ 'Ok':function(){
+ save_time();
+ },
+ 'Cancel':function(){
+ $('#time_dialog').dialog('close');
+ }
+ };
+ $('#time_dialog').dialog({
+ resizable:false,
+ autoOpen:false,
+ draggable:false,
+ buttons:time_buttons,
+ modal:true
+ });
+ var quota_buttons = {
+ 'Ok':function(){
+ save_quotas();
+ },
+ 'Cancel':function(){
+ $('#quotas_dialog').dialog('close');
+ }
+ };
+ $('#quotas_dialog').dialog({
+ resizable:false,
+ autoOpen:false,
+ draggable:false,
+ buttons:quota_buttons,
+ modal:true
+ });
+
+ var masks_buttons = {
+ 'Ok':function(){
+ save_masks();
+ },
+ 'Cancel':function(){
+ $('#masks_dialog').dialog('close');
+ }
+ };
+ $('#masks_dialog').dialog({
+ resizable:false,
+ autoOpen:false,
+ draggable:false,
+ buttons:masks_buttons,
+ width:900,
+ height:300,
+ modal:true
+ });
+ $('#users_rights_form .time_trigger').bind('click', function(){
+ var base_id = $(this).find('input[name="time_base_id"]').val();
+ if ('undefined' !== typeof base_id) {
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/time/',
+ data: {
+ users:$('#users_rights_form input[name="users"]').val(),
+ base_id:base_id
+ },
+ success: function(data){
+ var dialog = $('#time_dialog');
+
+ if (dialog.data("ui-dialog")) {
+ dialog.html(data).dialog('open');
+ }
+
+ $('div.switch_time', dialog).bind('click', function(event){
+ var newclass, boxes;
+
+ boxes = $(this).closest('form').find('input.datepicker');
+
+ if(($(this).hasClass('mixed') === true) ||Â ($(this).hasClass('unchecked') === true))
+ {
+ newclass = 'checked';
+ boxes.removeAttr('readonly');
+ }
+ else
+ {
+ newclass = 'unchecked';
+ boxes.attr('readonly','readonly');
+ }
+
+ $(this).removeClass('mixed checked unchecked').addClass(newclass);
+ });
+ }
+ });
+ } else {
+ var sbas_id = $(this).find('input[name="time_sbas_id"]').val();
+
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/time/sbas/',
+ data: {
+ users:$('#users_rights_form input[name="users"]').val(),
+ sbas_id:sbas_id
+ },
+ success: function(data){
+ var dialog = $('#time_dialog');
+
+ dialog.html(data);
+ dialog.dialog('open');
+
+ $('div.switch_time', dialog).bind('click', function(event){
+ var newclass, boxes;
+
+ boxes = $(this).closest('form').find('input.datepicker');
+
+ if(($(this).hasClass('mixed') === true) ||Â ($(this).hasClass('unchecked') === true))
+ {
+ newclass = 'checked';
+ boxes.removeAttr('readonly');
+ }
+ else
+ {
+ newclass = 'unchecked';
+ boxes.attr('readonly','readonly');
+ }
+
+ $(this).removeClass('mixed checked unchecked').addClass(newclass);
+ });
+ }
+ });
+ }
+ });
+ $('#users_rights_form .quota_trigger').bind('click', function(){
+ var base_id = $(this).find('input[name="quota_base_id"]').val();
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/quotas/',
+ data: {
+ users:$('#users_rights_form input[name="users"]').val(),
+ base_id:base_id
+ },
+ success: function(data){
+ var dialog = $('#quotas_dialog');
+
+ if (dialog.data("ui-dialog")) {
+ dialog.html(data).dialog('open');
+ }
+
+ $('div.switch_quota', dialog).bind('click', function(event){
+ var newclass, boxes;
+
+ boxes = $(this).closest('form').find('input:text');
+
+ if(($(this).hasClass('mixed')===true) ||Â ($(this).hasClass('unchecked') === true))
+ {
+ newclass = 'checked';
+ boxes.removeAttr('readonly');
+ }
+ else
+ {
+ newclass = 'unchecked';
+ boxes.attr('readonly','readonly');
+ }
+
+ $(this).removeClass('mixed checked unchecked').addClass(newclass);
+ });
+ }
+ });
+ });
+
+ $('#users_rights_form .masks_trigger').bind('click', function(){
+ var base_id = $(this).find('input[name="masks_base_id"]').val();
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/masks/',
+ data: {
+ users:$('#users_rights_form input[name="users"]').val(),
+ base_id:base_id
+ },
+ success: function(data){
+ $('#masks_dialog').html(data).dialog('open');
+
+ $('.switch_masks').bind('click', function(){
+ var currentclass, newclass;
+
+ var bit = $(this).find('input[name="bit"]').val();
+ currentclass = 'unchecked';
+ if($(this).hasClass('mixed'))
+ {
+ currentclass = 'mixed';
+ }
+ if($(this).hasClass('checked'))
+ {
+ currentclass = 'checked';
+ }
+ switch(currentclass)
+ {
+ case 'mixed':
+ default:
+ $('.bitnum_'+bit).removeClass('mixed checked unchecked').addClass('checked')
+ break;
+ case 'unchecked':
+ $(this).removeClass('mixed checked unchecked').addClass('checked')
+ break;
+ case 'checked':
+ if($('.checked.bitnum_'+bit).length == 2)
+ {
+ $(this).removeClass('mixed checked unchecked').addClass('unchecked')
+ }
+ else
+ {
+ alert("admin::user:mask: vous devez cocher au moins une case pour chaque status");
+ return;
+ }
+ break;
+ }
+
+ var left = $('.bitnum_'+bit+'.bit_left');
+ var right = $('.bitnum_'+bit+'.bit_right');
+
+ var maskform = $('#masks_dialog form');
+ var vand_and = $('input[name="vand_and"]', maskform);
+ var vand_or = $('input[name="vand_or"]', maskform);
+ var vxor_and = $('input[name="vxor_and"]', maskform);
+ var vxor_or = $('input[name="vxor_or"]', maskform);
+
+ 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') )
+ {
+ newbit_vand_and = "1";
+ newbit_vand_or = "1";
+ }
+ else if( left.hasClass('unchecked') && right.hasClass('checked') )
+ {
+ newbit_vand_and = "1";
+ newbit_vand_or = "1";
+ newbit_vxor_and = "1";
+ newbit_vxor_or = "1";
+ }
+ vand_and.val( vand_and.val().substr(0, 31 - bit) + newbit_vand_and + vand_and.val().substr(31 + 1 - bit) );
+ vand_or.val ( vand_or.val().substr( 0, 31 - bit) + newbit_vand_or + vand_or.val().substr( 31 + 1 - bit) );
+ vxor_and.val( vxor_and.val().substr(0, 31 - bit) + newbit_vxor_and + vxor_and.val().substr(31 + 1 - bit) );
+ vxor_or.val ( vxor_or.val().substr( 0, 31 - bit) + newbit_vxor_or + vxor_and.val().substr(31 + 1 - bit) );
+ }
+ });
+ }
+ });
+ });
+
+
+ function save_masks()
+ {
+ var cont = $('#masks_dialog');
+
+ var maskform = $('#masks_dialog form');
+ var base_id = $('input[name="base_id"]', maskform).val();
+ var users = $('input[name="users"]', maskform).val();
+ var vand_and = $('input[name="vand_and"]', maskform).val();
+ var vand_or = $('input[name="vand_or"]', maskform).val();
+ var vxor_and = $('input[name="vxor_and"]', maskform).val();
+ var vxor_or = $('input[name="vxor_or"]', maskform).val();
+
+
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/masks/apply/',
+ data: {
+ users:users,
+ base_id:base_id,
+ vand_and:vand_and,
+ vand_or:vand_or,
+ vxor_and:vxor_and,
+ vxor_or:vxor_or
+ },
+ success: function(data){
+ $('#masks_dialog').dialog('close');
+ }
+ });
+ }
+
+
+ function save_quotas()
+ {
+ var cont = $('#quotas_dialog');
+ var base_id = $('input[name="base_id"]', cont).val();
+ var users = $('input[name="users"]', cont).val();
+ var droits = $('input[name="droits"]', cont).val();
+ var restes = $('input[name="restes"]', cont).val();
+
+ var switch_quota = $('.switch_quota', cont);
+
+ if(switch_quota.hasClass('mixed'))
+ return;
+
+ var quota = 0;
+
+ if(switch_quota.hasClass('checked'))
+ quota = 1;
+
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/quotas/apply/',
+ data: {
+ act:"APPLYQUOTAS",
+ users:users,
+ base_id:base_id,
+ quota:quota,
+ droits:droits,
+ restes:restes
+ },
+ success: function(data){
+ $('#quotas_dialog').dialog('close');
+ }
+ });
+ }
+
+ function save_time()
+ {
+ var cont = $('#time_dialog');
+ var dmin = $('input[name="dmin"]', cont).val();
+ var dmax = $('input[name="dmax"]', cont).val();
+ var users = $('input[name="users"]', cont).val();
+ var base_id = $('input[name="base_id"]', cont).val();
+ var sbas_id = $('input[name="sbas_id"]', cont).val();
+
+ var switch_time = $('.switch_time', cont);
+
+ if(switch_time.hasClass('mixed'))
+ return;
+
+ var limit = 0;
+
+ if(switch_time.hasClass('checked'))
+ limit = 1;
+
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/time/apply/',
+ data: {
+ users:users,
+ base_id:base_id,
+ sbas_id:sbas_id,
+ limit:limit,
+ dmin:dmin,
+ dmax:dmax
+ },
+ success: function(data){
+ $('#time_dialog').dialog('close');
+ }
+ });
+ }
+
+ function check_uncheck_menu(right, sbas_id, el)
+ {
+ var top = el.offset().top ;
+ var left = el.offset().left + 16;
+ $('body').append(''+
+ '
'+
+ language.check_all+
+ ' '+
+ ' '+
+ '
'+
+ '
'+
+ language.uncheck_all+
+ ' '+
+ ' '+
+ '
');
+
+ $('#users_check_uncheck div').hover(
+ function(){
+ $(this).addClass('hovered');
+ },
+ function(){
+ $(this).removeClass('hovered');
+ }
+ );
+ $('#users_check_uncheck div.checker').bind('click',function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ users_check(true, $('input[name="sbas_id"]',$(this)).val(), $('input[name="right"]',$(this)).val());
+ $('#users_check_uncheck').remove();
+ });
+ $('#users_check_uncheck div.unchecker').bind('click',function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ users_check(false, $('input[name="sbas_id"]',$(this)).val(), $('input[name="right"]',$(this)).val());
+ $('#users_check_uncheck').remove();
+ });
+
+ }
+ function users_check(bool, sbas_id, right)
+ {
+ var newclass;
+ if(bool)
+ {
+ newclass="checked";
+ }
+ else
+ {
+ newclass="unchecked";
+ }
+ $('.inside_sbas_'+sbas_id+'.'+right+':visible').each(function(i,n){
+ user_click_box(null, $(n), newclass);
+ });
+ }
}
diff --git a/www/skins/admin/users.js b/www/skins/admin/users.js
index a328b240c9..fe6fdc98f2 100644
--- a/www/skins/admin/users.js
+++ b/www/skins/admin/users.js
@@ -6,387 +6,387 @@
$(document).ready(function(){
- function users_select_this(n,k)
- {
-
- if(p4.users.sel.length >= 800)
+ function users_select_this(n,k)
{
- alert(language.max_record_selected);
- return false;
- }
- p4.users.sel.push(k);
- $(n).addClass('selected');
- return true;
- }
- $('#users th.sortable').live('click', function(){
-
- var $this = $(this);
-
- var sort = $('input', $this).val();
-
- if((sort == $('#users_page_form input[name="srt"]').val())
- && ($('#users_page_form input[name="ord"]').val() == 'asc'))
- {
- var ord = 'desc';
- }
- else
- {
- var ord = 'asc';
- }
-
- $('#users_page_form input[name="srt"]').val(sort);
- $('#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');});
-
- var buttons = {};
- buttons[language.create_user] = function(){
- check_new_user(false);
- };
- buttons[language.annuler] = function(){
- $('#user_add_dialog').dialog('close')
- };
-
- $('#user_add_dialog').dialog({
- buttons:buttons,
- modal:true,
- resizable:false,
- draggable:false,
- width:500
-
- }).dialog('close');
-
- var buttons = {};
- buttons[language.create_template] = function(){
- check_new_user(true);
- };
- buttons[language.annuler] = function(){
- $('#template_add_dialog').dialog('close');
- };
-
- $('#template_add_dialog').dialog({
- buttons:buttons,
- modal:true,
- resizable:false,
- draggable:false,
- width:500
-
- }).dialog('close');
-
-
- function check_new_user(is_template)
- {
- var container = is_template ? $('#template_add_dialog') : $('#user_add_dialog');
- $('#new_user_loader').show();
- $.ajax({
- type: 'POST',
- url: '../admin/users/create/',
- dataType : 'json',
- data: {
- act:'CREATENEWUSER',
- value:$('input[name="value"]', container).val(),
- send_credentials: $('input[name="send_credentials"]', container).is(':checked') ? 1 : 0,
- validate_mail: $('input[name="validate_mail"]', container).is(':checked') ? 1 : 0,
- template:is_template ? '1':'0'
- },
- success: function(data){
- $('.new_user_loader', container).hide();
- if(!data.error)
+ if(p4.users.sel.length >= 800)
{
- if (container.data("ui-dialog")) {
- container.dialog('close');
- }
- $('input[name="value"]', container).val('');
- $('#right-ajax').empty().addClass('loading');
- p4.users.sel = [];
- $.ajax({
+ alert(language.max_record_selected);
+ return false;
+ }
+ p4.users.sel.push(k);
+ $(n).addClass('selected');
+ return true;
+ }
+
+ $('#users th.sortable').live('click', function(){
+
+ var $this = $(this);
+
+ var sort = $('input', $this).val();
+
+ if((sort == $('#users_page_form input[name="srt"]').val())
+ && ($('#users_page_form input[name="ord"]').val() == 'asc'))
+ {
+ var ord = 'desc';
+ }
+ else
+ {
+ var ord = 'asc';
+ }
+
+ $('#users_page_form input[name="srt"]').val(sort);
+ $('#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');});
+
+ var buttons = {};
+ buttons[language.create_user] = function(){
+ check_new_user(false);
+ };
+ buttons[language.annuler] = function(){
+ $('#user_add_dialog').dialog('close')
+ };
+
+ $('#user_add_dialog').dialog({
+ buttons:buttons,
+ modal:true,
+ resizable:false,
+ draggable:false,
+ width:500
+
+ }).dialog('close');
+
+ var buttons = {};
+ buttons[language.create_template] = function(){
+ check_new_user(true);
+ };
+ buttons[language.annuler] = function(){
+ $('#template_add_dialog').dialog('close');
+ };
+
+ $('#template_add_dialog').dialog({
+ buttons:buttons,
+ modal:true,
+ resizable:false,
+ draggable:false,
+ width:500
+
+ }).dialog('close');
+
+
+ function check_new_user(is_template)
+ {
+ var container = is_template ? $('#template_add_dialog') : $('#user_add_dialog');
+ $('#new_user_loader').show();
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/create/',
+ dataType : 'json',
+ data: {
+ act:'CREATENEWUSER',
+ value:$('input[name="value"]', container).val(),
+ send_credentials: $('input[name="send_credentials"]', container).is(':checked') ? 1 : 0,
+ validate_mail: $('input[name="validate_mail"]', container).is(':checked') ? 1 : 0,
+ template:is_template ? '1':'0'
+ },
+ success: function(data){
+ $('.new_user_loader', container).hide();
+ if(!data.error)
+ {
+ if (container.data("ui-dialog")) {
+ container.dialog('close');
+ }
+ $('input[name="value"]', container).val('');
+ $('#right-ajax').empty().addClass('loading');
+ p4.users.sel = [];
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/',
+ data: {
+ users : data.data
+ },
+ success: function(data){
+ $('#right-ajax').removeClass('loading').html(data);
+ }
+ });
+ }
+ else
+ {
+ alert(data.message);
+ }
+
+ },
+ error:function()
+ {
+ alert(language.serverError);
+ },
+ timeout:function()
+ {
+ alert(language.serverTimeout);
+ }
+ });
+ }
+
+
+ $('#users_page .user_adder').live('click', function(){
+ if ($('#user_add_dialog').data("ui-dialog")) {
+ $('#user_add_dialog').dialog('open');
+ }
+ });
+
+ $('#users_page .template_adder').live('click', function(){
+ if ($('#template_add_dialog').data("ui-dialog")) {
+ $('#template_add_dialog').dialog('open');
+ }
+ });
+
+ $('#users_page_form').live('submit', function(){
+ var datas = $('#users_page_form').serializeArray();
+ $('#right-ajax').empty().addClass('loading');
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/search/',
+ data: datas,
+ success: function(data){
+ $('#right-ajax').removeClass('loading').empty().html(data);
+ }
+ });
+
+ return false;
+ });
+
+ $('#users_page_search').live('submit', function(){
+ var datas = $('#users_page_search').serializeArray();
+ $('#right-ajax').empty().addClass('loading');
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/search/',
+ data: datas,
+ success: function(data){
+ $('#right-ajax').removeClass('loading').empty().html(data);
+ }
+ });
+
+ return false;
+ });
+
+ $('#users_page_form .pager').live('click', function(){
+ var form = $('#users_page_form');
+
+ var current_page = parseInt($('input[name="page"]', form).val());
+ var perPage = parseInt($('select[name="per_page"]', form).val());
+ current_page = isNaN(current_page) ? 1 : current_page;
+
+ var offset_start = 0;
+
+ if($(this).hasClass('prev'))
+ {
+ offset_start = (current_page-2) * perPage;
+ }
+ if($(this).hasClass('first'))
+ {
+ offset_start = 0;
+ }
+ if($(this).hasClass('next'))
+ {
+ offset_start = current_page * perPage;
+ }
+ if($(this).hasClass('last'))
+ {
+ offset_start = (Math.floor(parseInt($('input[name=total_results]').val()) / perPage))* perPage;
+ }
+
+ $('input[name="offset_start"]', form).val(offset_start);
+ });
+
+ $('#users tbody tr, #users tbody td').live('dblclick', function(evt){
+ $('#users_page_form .user_modifier').trigger('click');
+ });
+
+ $('#users tbody tr, #users tbody td').live('click', function(evt){
+ if(evt.stopPropagation)
+ evt.stopPropagation();
+ evt.cancelBubble = true;
+ evt.preventDefault();
+ var el = $(this).closest('tr');
+ var cont = $('#users');
+
+ var k = el.attr('id').split('_').pop();
+
+ 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=0)
+ {
+ p4.users.sel = $.grep(p4.users.sel,function(n){
+ return(n!=k);
+ });
+ $(el).removeClass('selected');
+ }
+ else
+ {
+ if(!users_select_this(el,k))
+ return false;
+ }
+ }
+ }
+ $('.last_selected', cont).removeClass('last_selected');
+ $(el).addClass('last_selected');
+ }).live('mousedown', function(evt){
+
+ if(evt.stopPropagation)
+ evt.stopPropagation();
+ evt.cancelBubble = true;
+ evt.preventDefault();
+ });
+
+ $('#users_apply_template').live('submit', function(){
+ var users = p4.users.sel.join(';');
+ if(users === '')
+ {
+ return false;
+ }
+
+ var $this = $(this);
+ var template = $('select[name="template_chooser"]', $this).val();
+
+ if(template === '')
+ {
+ return false;
+ }
+
+ $('#right-ajax').empty().addClass('loading');
+ p4.users.sel = [];
+
+ $.ajax({
+ type: $this.attr('method'),
+ url: $this.attr('action'),
+ data: {
+ users : users,
+ template : template
+ },
+ success: function(data){
+ $('#right-ajax').removeClass('loading').html(data);
+ }
+ });
+ return false;
+ });
+
+ $('#users_page_form .user_modifier').live('click', function(){
+ var users = p4.users.sel.join(';');
+ if(users === '')
+ {
+ return false;
+ }
+
+ $('#right-ajax').empty().addClass('loading');
+ p4.users.sel = [];
+ $.ajax({
type: 'POST',
url: '../admin/users/rights/',
data: {
- users : data.data
+ users : users
},
success: function(data){
- $('#right-ajax').removeClass('loading').html(data);
+ $('#right-ajax').removeClass('loading').html(data);
}
- });
- }
- else
- {
- alert(data.message);
- }
-
- },
- error:function()
- {
- alert(language.serverError);
- },
- timeout:function()
- {
- alert(language.serverTimeout);
- }
- });
- }
-
-
- $('#users_page .user_adder').live('click', function(){
- if ($('#user_add_dialog').data("ui-dialog")) {
- $('#user_add_dialog').dialog('open');
- }
- });
-
- $('#users_page .template_adder').live('click', function(){
- if ($('#template_add_dialog').data("ui-dialog")) {
- $('#template_add_dialog').dialog('open');
- }
- });
-
- $('#users_page_form').live('submit', function(){
- var datas = $('#users_page_form').serializeArray();
- $('#right-ajax').empty().addClass('loading');
- $.ajax({
- type: 'POST',
- url: '../admin/users/search/',
- data: datas,
- success: function(data){
- $('#right-ajax').removeClass('loading').empty().html(data);
- }
- });
-
- return false;
- });
-
- $('#users_page_search').live('submit', function(){
- var datas = $('#users_page_search').serializeArray();
- $('#right-ajax').empty().addClass('loading');
- $.ajax({
- type: 'POST',
- url: '../admin/users/search/',
- data: datas,
- success: function(data){
- $('#right-ajax').removeClass('loading').empty().html(data);
- }
- });
-
- return false;
- });
-
- $('#users_page_form .pager').live('click', function(){
- var form = $('#users_page_form');
-
- var current_page = parseInt($('input[name="page"]', form).val());
- var perPage = parseInt($('select[name="per_page"]', form).val());
- current_page = isNaN(current_page) ? 1 : current_page;
-
- var offset_start = 0;
-
- if($(this).hasClass('prev'))
- {
- offset_start = (current_page-2) * perPage;
- }
- if($(this).hasClass('first'))
- {
- offset_start = 0;
- }
- if($(this).hasClass('next'))
- {
- offset_start = current_page * perPage;
- }
- if($(this).hasClass('last'))
- {
- offset_start = (Math.floor(parseInt($('input[name=total_results]').val()) / perPage))* perPage;
- }
-
- $('input[name="offset_start"]', form).val(offset_start);
- });
-
- $('#users tbody tr, #users tbody td').live('dblclick', function(evt){
- $('#users_page_form .user_modifier').trigger('click');
- });
-
- $('#users tbody tr, #users tbody td').live('click', function(evt){
- if(evt.stopPropagation)
- evt.stopPropagation();
- evt.cancelBubble = true;
- evt.preventDefault();
- var el = $(this).closest('tr');
- var cont = $('#users');
-
- var k = el.attr('id').split('_').pop();
-
- 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=0)
+
+ $('#right-ajax').empty().addClass('loading');
+ p4.users.sel = [];
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/delete/',
+ data: {
+ users : users
+ },
+ success: function(data){
+ $('#right-ajax').removeClass('loading').html(data);
+ }
+ });
+ return false;
+ });
+ $('#users_page .invite_modifier, #users_page .autoregister_modifier').live('click', function(){
+ var users = $(this).next('input').val();
+
+ if($.trim(users) === '')
{
- p4.users.sel = $.grep(p4.users.sel,function(n){
- return(n!=k);
- });
- $(el).removeClass('selected');
- }
- else
- {
- if(!users_select_this(el,k))
return false;
}
- }
- }
- $('.last_selected', cont).removeClass('last_selected');
- $(el).addClass('last_selected');
- }).live('mousedown', function(evt){
- if(evt.stopPropagation)
- evt.stopPropagation();
- evt.cancelBubble = true;
- evt.preventDefault();
- });
-
- $('#users_apply_template').live('submit', function(){
- var users = p4.users.sel.join(';');
- if(users === '')
- {
- return false;
- }
-
- var $this = $(this);
- var template = $('select[name="template_chooser"]', $this).val();
-
- if(template === '')
- {
- return false;
- }
-
- $('#right-ajax').empty().addClass('loading');
- p4.users.sel = [];
-
- $.ajax({
- type: $this.attr('method'),
- url: $this.attr('action'),
- data: {
- users : users,
- template : template
- },
- success: function(data){
- $('#right-ajax').removeClass('loading').html(data);
- }
+ $('#right-ajax').empty().addClass('loading');
+ p4.users.sel = [];
+ $.ajax({
+ type: 'POST',
+ url: '../admin/users/rights/',
+ data: {
+ users : users
+ },
+ success: function(data){
+ $('#right-ajax').removeClass('loading').html(data);
+ }
+ });
+ return false;
});
- return false;
- });
-
- $('#users_page_form .user_modifier').live('click', function(){
- var users = p4.users.sel.join(';');
- if(users === '')
- {
- return false;
- }
-
- $('#right-ajax').empty().addClass('loading');
- p4.users.sel = [];
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/',
- data: {
- users : users
- },
- success: function(data){
- $('#right-ajax').removeClass('loading').html(data);
- }
- });
- return false;
- });
-
-
- $('#users_page_form .user_deleter').live('click', function(){
- var users = p4.users.sel.join(';');
- if(users === '')
- {
- return false;
- }
-
- $('#right-ajax').empty().addClass('loading');
- p4.users.sel = [];
- $.ajax({
- type: 'POST',
- url: '../admin/users/delete/',
- data: {
- users : users
- },
- success: function(data){
- $('#right-ajax').removeClass('loading').html(data);
- }
- });
- return false;
- });
- $('#users_page .invite_modifier, #users_page .autoregister_modifier').live('click', function(){
- var users = $(this).next('input').val();
-
- if($.trim(users) === '')
- {
- return false;
- }
-
- $('#right-ajax').empty().addClass('loading');
- p4.users.sel = [];
- $.ajax({
- type: 'POST',
- url: '../admin/users/rights/',
- data: {
- users : users
- },
- success: function(data){
- $('#right-ajax').removeClass('loading').html(data);
- }
- });
- return false;
- });
-})
\ No newline at end of file
+})
diff --git a/www/skins/client/jquery.p4client.1.0.js b/www/skins/client/jquery.p4client.1.0.js
index f9b25ef45f..cc3a04f56f 100644
--- a/www/skins/client/jquery.p4client.1.0.js
+++ b/www/skins/client/jquery.p4client.1.0.js
@@ -3,10 +3,10 @@
**************/
var p4 = $.extend(p4 || {}, {
- tot:0,
- preview :{open:false,current:false},
- currentViewMode:'classic',
- nbNoview:0
+ tot:0,
+ preview :{open:false,current:false},
+ currentViewMode:'classic',
+ nbNoview:0
});
var baskAjax,baskAjaxrunning;
@@ -25,417 +25,417 @@ var bodySize = {x:0,y:0};
function acceptCgus(name,value)
{
- setPref(name,value);
+ setPref(name,value);
}
function cancelCgus(id)
{
- $.ajax({
- type: "POST",
- url: "/prod/TOU/deny/"+id+"/",
- data: {},
- success: function(data){
- if(data == '1')
- {
- alert(language.cgusRelog);
- self.location.replace(self.location.href);
- }
- }
- });
+ $.ajax({
+ type: "POST",
+ url: "/prod/TOU/deny/"+id+"/",
+ data: {},
+ success: function(data){
+ if(data == '1')
+ {
+ alert(language.cgusRelog);
+ self.location.replace(self.location.href);
+ }
+ }
+ });
}
function activateCgus()
{
- $('.cgu-dialog:first').dialog({
- autoOpen : true,
- closeOnEscape:false,
- draggable:false,
- modal:true,
- resizable:false,
- width:800,
- height:600,
- open:function() {
- $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").remove();
- var currentdialog = $(this);
- $('.cgus-accept',$(this)).bind('click',function(){
- acceptCgus($('.cgus-accept',currentdialog).attr('id'),$('.cgus-accept',currentdialog).attr('date'));
- if ($('.cgu-dialog').data("ui-dialog")) {
- $('.cgu-dialog').dialog('close');
- }
- });
- $('.cgus-cancel',$(this)).bind('click',function(){
- if(confirm(language.warningDenyCgus))
- {
- cancelCgus($('.cgus-cancel',currentdialog).attr('id').split('_').pop());
- }
- });
- },
- close:function(){
- activateCgus();
- }
- });
+ $('.cgu-dialog:first').dialog({
+ autoOpen : true,
+ closeOnEscape:false,
+ draggable:false,
+ modal:true,
+ resizable:false,
+ width:800,
+ height:600,
+ open:function() {
+ $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").remove();
+ var currentdialog = $(this);
+ $('.cgus-accept',$(this)).bind('click',function(){
+ acceptCgus($('.cgus-accept',currentdialog).attr('id'),$('.cgus-accept',currentdialog).attr('date'));
+ if ($('.cgu-dialog').data("ui-dialog")) {
+ $('.cgu-dialog').dialog('close');
+ }
+ });
+ $('.cgus-cancel',$(this)).bind('click',function(){
+ if(confirm(language.warningDenyCgus))
+ {
+ cancelCgus($('.cgus-cancel',currentdialog).attr('id').split('_').pop());
+ }
+ });
+ },
+ close:function(){
+ activateCgus();
+ }
+ });
}
$(document).ready(function(){
- activateCgus();
+ activateCgus();
});
$(document).ready(function(){
- $.ajaxSetup({
+ $.ajaxSetup({
- error: function(){
- showModal('error',{title:'Server error'});
- },
- timeout: function(){
- showModal('timeout',{title:'Server not responding'});
- }
- });
+ error: function(){
+ showModal('error',{title:'Server error'});
+ },
+ timeout: function(){
+ showModal('timeout',{title:'Server not responding'});
+ }
+ });
- getLanguage();
- $('.datepicker').datepicker({
- firstDay: 1,
- changeYear: true, changeMonth:true,
- showOn: 'button', buttonImage:'/skins/icons/cal.png', buttonImageOnly: true
- });
+ getLanguage();
+ $('.datepicker').datepicker({
+ firstDay: 1,
+ changeYear: true, changeMonth:true,
+ showOn: 'button', buttonImage:'/skins/icons/cal.png', buttonImageOnly: true
+ });
- checkFilters();
- window.setTimeout("checkBaskets();", 5000);
+ checkFilters();
+ window.setTimeout("checkBaskets();", 5000);
- $('.actives').hover(function(){
- $(this).addClass("hover");
- },function(){
- $(this).removeClass("hover");
- });
+ $('.actives').hover(function(){
+ $(this).addClass("hover");
+ },function(){
+ $(this).removeClass("hover");
+ });
- sessionactive();
- resize();
- $(window).resize(function(){
- resize();
- resizeSearch();
- });
+ sessionactive();
+ resize();
+ $(window).resize(function(){
+ resize();
+ resizeSearch();
+ });
- initAnswerForm();
- initBasketForm();
+ initAnswerForm();
+ initBasketForm();
- $('#PREVIEWHD').bind('click',function(){
- $(this).hide();
- $(this).empty();
- });
+ $('#PREVIEWHD').bind('click',function(){
+ $(this).hide();
+ $(this).empty();
+ });
- $('#PREVIEWHD').trigger('click');
+ $('#PREVIEWHD').trigger('click');
- getBaskets();
+ getBaskets();
- afterSearch();
- $(this).bind('keydown',function(event)
- {
- if(p4.preview.open)
- {
- switch(event.keyCode)
- {
- case 39:
- getNext();
- break;
- case 37:
- getPrevious();
- break;
- case 27:
- if ($('#MODALDL').is(':visible')) {
- hideDwnl();
- }
- else {
- closePreview();
- }
- break;
- case 32:
- if(p4.slideShow)
- stopSlide();
- else
- startSlide();
- break;
- }
- }
- else
- {
- switch(event.keyCode)
- {
- case 39:
- $('#NEXT_PAGE').trigger('click');
- break;
- case 27:
- hideDwnl();
- break;
- case 37:
- $('#PREV_PAGE').trigger('click');
- break;
- case 38:
- $('#answers').scrollTop($('#answers').scrollTop()-50);
- break;
- case 40:
- $('#answers').scrollTop($('#answers').scrollTop()+50);
- break;
- }
- }
- });
+ afterSearch();
+ $(this).bind('keydown',function(event)
+ {
+ if(p4.preview.open)
+ {
+ switch(event.keyCode)
+ {
+ case 39:
+ getNext();
+ break;
+ case 37:
+ getPrevious();
+ break;
+ case 27:
+ if ($('#MODALDL').is(':visible')) {
+ hideDwnl();
+ }
+ else {
+ closePreview();
+ }
+ break;
+ case 32:
+ if(p4.slideShow)
+ stopSlide();
+ else
+ startSlide();
+ break;
+ }
+ }
+ else
+ {
+ switch(event.keyCode)
+ {
+ case 39:
+ $('#NEXT_PAGE').trigger('click');
+ break;
+ case 27:
+ hideDwnl();
+ break;
+ case 37:
+ $('#PREV_PAGE').trigger('click');
+ break;
+ case 38:
+ $('#answers').scrollTop($('#answers').scrollTop()-50);
+ break;
+ case 40:
+ $('#answers').scrollTop($('#answers').scrollTop()+50);
+ break;
+ }
+ }
+ });
- $('.boxPubli .diapo').css('width','').addClass('w160px').css('margin','0pt 0px 8px 8px');
+ $('.boxPubli .diapo').css('width','').addClass('w160px').css('margin','0pt 0px 8px 8px');
- }
+ }
);
function resizePreview(){
- $('#PREVIEWCURRENTCONT').width($('#PREVIEWCURRENT').width() - 80 - ($('#PREVMAINREG').length>0?$('#PREVMAINREG').width():0) - 90);
+ $('#PREVIEWCURRENTCONT').width($('#PREVIEWCURRENT').width() - 80 - ($('#PREVMAINREG').length>0?$('#PREVMAINREG').width():0) - 90);
- var h = $('#PREVIEWBOX').height();
- h = h - $('#PREVIEWTITLE').height();
- $.each($('div.preview_col'), function(i, n){
- $(n).height(h);
- });
- $('#PREVIEWIMGCONT').height(h - $('#PREVIEWCURRENT').height());
+ var h = $('#PREVIEWBOX').height();
+ h = h - $('#PREVIEWTITLE').height();
+ $.each($('div.preview_col'), function(i, n){
+ $(n).height(h);
+ });
+ $('#PREVIEWIMGCONT').height(h - $('#PREVIEWCURRENT').height());
- $('#PREVIEWIMGDESC').height(h-$('#PREVIEWOTHERS').height());
- $('#PREVIEWIMGDESC .descBoxes').height($('#PREVIEWIMGDESC').height() - 30);
+ $('#PREVIEWIMGDESC').height(h-$('#PREVIEWOTHERS').height());
+ $('#PREVIEWIMGDESC .descBoxes').height($('#PREVIEWIMGDESC').height() - 30);
- p4.preview.height = $('#PREVIEWIMGCONT').height();
- p4.preview.width = $('#PREVIEWIMGCONT').width();
- setPreview();
+ p4.preview.height = $('#PREVIEWIMGCONT').height();
+ p4.preview.width = $('#PREVIEWIMGCONT').width();
+ setPreview();
}
function controlPubliSize()
{
- $('#publications ul').height('auto');
- if(50+$('#publications ul').height()>bodySize.y)
- $('#publications ul').height(bodySize.y-50);
+ $('#publications ul').height('auto');
+ if(50+$('#publications ul').height()>bodySize.y)
+ $('#publications ul').height(bodySize.y-50);
}
function pquit(){
- if (parent.opener)
- self.close();
- else
- {
- document.forms['logout'].submit();
- }
+ if (parent.opener)
+ self.close();
+ else
+ {
+ document.forms['logout'].submit();
+ }
}
function resize(){
- var h = bodySize.y = $(document).height() - $('#mainMenu').outerHeight();
- var w = bodySize.x = $(document).width();
+ var h = bodySize.y = $(document).height() - $('#mainMenu').outerHeight();
+ var w = bodySize.x = $(document).width();
- controlPubliSize();
- var rightw = w - 265;
- rightw = ((rightw) > 0) ? rightw : 0;
+ controlPubliSize();
+ var rightw = w - 265;
+ rightw = ((rightw) > 0) ? rightw : 0;
- $('#container').height($(document).height());
- $('#container').width($(document).width());
- $('#right').width(rightw);
+ $('#container').height($(document).height());
+ $('#container').width($(document).width());
+ $('#right').width(rightw);
- $('#answers').height(h - $('#nb_answersEXT').outerHeight() - $('#navigation').outerHeight() - 20);
- $('#answers').width(rightw);
+ $('#answers').height(h - $('#nb_answersEXT').outerHeight() - $('#navigation').outerHeight() - 20);
+ $('#answers').width(rightw);
- resizeSearch();
+ resizeSearch();
- if (p4.preview.open) {
+ if (p4.preview.open) {
- resizePreview();
- }
- if ($.browser.msie && $.browser.version == '6.0') {
- $('#PREVIEWBOX').height(h * 0.94);
- $('#OVERLAY,#OVERLAY2').width(w);
- $('#OVERLAY,#OVERLAY2').height(h);
- $('#left').height(h);
- $('#right').height(h);
- }
- bodyW = rightw;
+ resizePreview();
+ }
+ if ($.browser.msie && $.browser.version == '6.0') {
+ $('#PREVIEWBOX').height(h * 0.94);
+ $('#OVERLAY,#OVERLAY2').width(w);
+ $('#OVERLAY,#OVERLAY2').height(h);
+ $('#left').height(h);
+ $('#right').height(h);
+ }
+ bodyW = rightw;
- if($('#MODALDL').is(':visible'))
- {
- $('#MODALDL').css({
- top:((h-$('#MODALDL').height())/2),
- left:((w-$('#MODALDL').width())/2)
- });
- }
- reModCol();
+ if($('#MODALDL').is(':visible'))
+ {
+ $('#MODALDL').css({
+ top:((h-$('#MODALDL').height())/2),
+ left:((w-$('#MODALDL').width())/2)
+ });
+ }
+ reModCol();
}
function getHome(cas){
- switch (cas) {
- case 'QUERY':
- newSearch();
- break;
- case 'PUBLI':
- $.ajax({
- type: "GET",
- url: "/client/publications/",
- dataType: 'html',
- data: {
- type: cas
- },
- beforeSend: function(){
- clearAnswers();
- answAjaxrunning = true;
- $('#answers').addClass('loading');
- },
- error: function(){
- answAjaxrunning = false;
- $('#answers').removeClass('loading');
- },
- timeout: function(){
- answAjaxrunning = false;
- $('#answers').removeClass('loading');
- },
- success: function(data){
- $('#answers').append(data);
- afterSearch();
- $('.boxPubli .diapo').css('width','').addClass('w160px').css('margin','0pt 0px 8px 8px');
- }
- });
- case 'HELP':
- $.ajax({
- type: "GET",
- url: "/client/help/",
- dataType: 'html',
- data: {
- type: cas
- },
- beforeSend: function(){
- clearAnswers();
- answAjaxrunning = true;
- $('#answers').addClass('loading');
- },
- error: function(){
- answAjaxrunning = false;
- $('#answers').removeClass('loading');
- },
- timeout: function(){
- answAjaxrunning = false;
- $('#answers').removeClass('loading');
- },
- success: function(data){
- $('#answers').append(data);
- afterSearch();
- }
- });
- break;
- default:
- break;
- }
+ switch (cas) {
+ case 'QUERY':
+ newSearch();
+ break;
+ case 'PUBLI':
+ $.ajax({
+ type: "GET",
+ url: "/client/publications/",
+ dataType: 'html',
+ data: {
+ type: cas
+ },
+ beforeSend: function(){
+ clearAnswers();
+ answAjaxrunning = true;
+ $('#answers').addClass('loading');
+ },
+ error: function(){
+ answAjaxrunning = false;
+ $('#answers').removeClass('loading');
+ },
+ timeout: function(){
+ answAjaxrunning = false;
+ $('#answers').removeClass('loading');
+ },
+ success: function(data){
+ $('#answers').append(data);
+ afterSearch();
+ $('.boxPubli .diapo').css('width','').addClass('w160px').css('margin','0pt 0px 8px 8px');
+ }
+ });
+ case 'HELP':
+ $.ajax({
+ type: "GET",
+ url: "/client/help/",
+ dataType: 'html',
+ data: {
+ type: cas
+ },
+ beforeSend: function(){
+ clearAnswers();
+ answAjaxrunning = true;
+ $('#answers').addClass('loading');
+ },
+ error: function(){
+ answAjaxrunning = false;
+ $('#answers').removeClass('loading');
+ },
+ timeout: function(){
+ answAjaxrunning = false;
+ $('#answers').removeClass('loading');
+ },
+ success: function(data){
+ $('#answers').append(data);
+ afterSearch();
+ }
+ });
+ break;
+ default:
+ break;
+ }
}
function changeModCol(){
- reModCol();
- doSearch();
+ reModCol();
+ doSearch();
}
function getLanguage(){
- $.ajax({
- type: "GET",
- url: "/client/language/",
- dataType: 'json',
- data: {},
- success: function(data){
- language = data;
- return false;
- }
- });
+ $.ajax({
+ type: "GET",
+ url: "/client/language/",
+ dataType: 'json',
+ data: {},
+ success: function(data){
+ language = data;
+ return false;
+ }
+ });
}
function initBasketForm(){
- var options = {
- target: '#baskets',
- beforeSend: function(){
- if (baskAjaxrunning)
- baskAjax.abort();
- baskAjaxrunning = true;
- $('.baskIndicator').addClass('baskLoading');
- },
- error: function(){
- baskAjaxrunning = false;
- $('#baskets').removeClass('loading');
- $('.baskIndicator').removeClass('baskLoading');
- },
- timeout: function(){
- baskAjaxrunning = false;
- $('#baskets').removeClass('loading');
- $('.baskIndicator').removeClass('baskLoading');
- },
- success: function(data){
- baskAjaxrunning = false;
- if(p4.preview.open && $.browser.msie && $.browser.version == '6.0')
- {
- $('select').css({
- visibility: 'hidden'
- });
- }
- setBaskStatus();
+ var options = {
+ target: '#baskets',
+ beforeSend: function(){
+ if (baskAjaxrunning)
+ baskAjax.abort();
+ baskAjaxrunning = true;
+ $('.baskIndicator').addClass('baskLoading');
+ },
+ error: function(){
+ baskAjaxrunning = false;
+ $('#baskets').removeClass('loading');
+ $('.baskIndicator').removeClass('baskLoading');
+ },
+ timeout: function(){
+ baskAjaxrunning = false;
+ $('#baskets').removeClass('loading');
+ $('.baskIndicator').removeClass('baskLoading');
+ },
+ success: function(data){
+ baskAjaxrunning = false;
+ if(p4.preview.open && $.browser.msie && $.browser.version == '6.0')
+ {
+ $('select').css({
+ visibility: 'hidden'
+ });
+ }
+ setBaskStatus();
- $('#baskets').removeClass('loading');
- $('.baskIndicator').removeClass('baskLoading');
- $('#blocBask img.baskTips').tooltip();
+ $('#baskets').removeClass('loading');
+ $('.baskIndicator').removeClass('baskLoading');
+ $('#blocBask img.baskTips').tooltip();
- $("#flechenochu").bind('click', function(){
- baskDisplay = false;
- saveBaskStatus(false);
- $("#blocBask").slideToggle("slow");
- $("#blocNoBask").slideToggle("slow").queue(function(){
- $('#baskets').height($('#blocNoBask').height() + 6);
- resizeSearch();
- $(this).dequeue();
- });
- });
- $("#flechechu").bind('click', function(){
- baskDisplay = true;
- saveBaskStatus(true);
- $("#blocNoBask").slideToggle("slow");
- $("#blocBask").slideToggle("slow").queue(function(){
- $('#baskets').height($('#blocBask').height() + 6);
- resizeSearch();
- $(this).dequeue();
- });
- });
+ $("#flechenochu").bind('click', function(){
+ baskDisplay = false;
+ saveBaskStatus(false);
+ $("#blocBask").slideToggle("slow");
+ $("#blocNoBask").slideToggle("slow").queue(function(){
+ $('#baskets').height($('#blocNoBask').height() + 6);
+ resizeSearch();
+ $(this).dequeue();
+ });
+ });
+ $("#flechechu").bind('click', function(){
+ baskDisplay = true;
+ saveBaskStatus(true);
+ $("#blocNoBask").slideToggle("slow");
+ $("#blocBask").slideToggle("slow").queue(function(){
+ $('#baskets').height($('#blocBask').height() + 6);
+ resizeSearch();
+ $(this).dequeue();
+ });
+ });
- if($('#chutier_name').length > 0) {
- $('#formChuBaskId')[0].value = $('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value;
- }
- $('#formChubas')[0].value = $('#formChup0')[0].value = '';
+ if($('#chutier_name').length > 0) {
+ $('#formChuBaskId')[0].value = $('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value;
+ }
+ $('#formChubas')[0].value = $('#formChup0')[0].value = '';
- return false;
- }
- };
+ return false;
+ }
+ };
- baskAjax = $('#formChu').ajaxForm(options);
+ baskAjax = $('#formChu').ajaxForm(options);
}
function setBaskStatus(){
- if (baskDisplay) {
- $("#blocNoBask").hide();
- $("#blocBask").show();
- $('#baskets').height($('#blocBask').height() + 6);
- }
- else {
- $("#blocNoBask").show();
- $('#baskets').height($('#blocNoBask').height() + 6);
- $("#blocBask").hide();
- }
- resizeSearch();
+ if (baskDisplay) {
+ $("#blocNoBask").hide();
+ $("#blocBask").show();
+ $('#baskets').height($('#blocBask').height() + 6);
+ }
+ else {
+ $("#blocNoBask").show();
+ $('#baskets').height($('#blocNoBask').height() + 6);
+ $("#blocBask").hide();
+ }
+ resizeSearch();
}
function saveBaskStatus(val) {
- $.post("/user/preferences/", {
- prop: "client_basket_status",
- value: (val?'1':'0')
- }, function(data){
- return false;
- });
+ $.post("/user/preferences/", {
+ prop: "client_basket_status",
+ value: (val?'1':'0')
+ }, function(data){
+ return false;
+ });
}
function checkBaskets(){
- $.post("/client/baskets/check/", {}, function(data){
+ $.post("/client/baskets/check/", {}, function(data){
if(data.success) {
if(parseInt(data.no_view) > p4.nbNoview){
getBaskets();
@@ -443,37 +443,37 @@ function checkBaskets(){
window.setTimeout("checkBaskets();", 52000);
return false;
}
- });
+ });
}
function initAnswerForm(){
- var options = {
- target: '#answers',
- beforeSend: function(formData){
- clearAnswers();
- if (answAjaxrunning)
- return;
- answAjaxrunning = true;
- $('#tooltip').css({
- 'display': 'none'
- });
- $('#answers').addClass('loading');
- },
- error: function(){
- answAjaxrunning = false;
- $('#answers').removeClass('loading');
- },
- timeout: function(){
- answAjaxrunning = false;
- $('#answers').removeClass('loading');
- },
- success: function(){
- answAjaxrunning = false;
- afterSearch();
- return false;
- }
- };
- $('#searchForm').ajaxForm(options);
+ var options = {
+ target: '#answers',
+ beforeSend: function(formData){
+ clearAnswers();
+ if (answAjaxrunning)
+ return;
+ answAjaxrunning = true;
+ $('#tooltip').css({
+ 'display': 'none'
+ });
+ $('#answers').addClass('loading');
+ },
+ error: function(){
+ answAjaxrunning = false;
+ $('#answers').removeClass('loading');
+ },
+ timeout: function(){
+ answAjaxrunning = false;
+ $('#answers').removeClass('loading');
+ },
+ success: function(){
+ answAjaxrunning = false;
+ afterSearch();
+ return false;
+ }
+ };
+ $('#searchForm').ajaxForm(options);
}
/*************
* SEARCH
@@ -482,44 +482,44 @@ function initAnswerForm(){
function afterSearch()
{
- $('#answers').removeClass('loading');
- $("#answers").scrollTop(0);
- $('div.infoTips, div.previewTips,img.captionTips',$('#answers')).tooltip();
- $('#nb_answers a.infoTips').tooltip();
+ $('#answers').removeClass('loading');
+ $("#answers").scrollTop(0);
+ $('div.infoTips, div.previewTips,img.captionTips',$('#answers')).tooltip();
+ $('#nb_answers a.infoTips').tooltip();
}
function chkSbas(val,el){
- var bool = false;
- if($(el)[0].checked)
- bool = true;
- $('.basItem' + val).each(function(){
- $(this)[0].checked = bool;
- });
+ var bool = false;
+ if($(el)[0].checked)
+ bool = true;
+ $('.basItem' + val).each(function(){
+ $(this)[0].checked = bool;
+ });
}
function chgOngSearch(tab){
- tTabs = new Array("ongSearch", "ongAdvSearch", "ongTopic");
- if($('#'+tab).length == 0)
- return;
- for (i = 0; i <= tTabs.length; i++) {
- if ((o = $('#' + tTabs[i])))
- var rmC = (tTabs[i] == tab) ? "inactif" : "actif";
- var addC = (tTabs[i] == tab) ? "actif" : "inactif";
- o.addClass(addC).removeClass(rmC);
+ tTabs = new Array("ongSearch", "ongAdvSearch", "ongTopic");
+ if($('#'+tab).length == 0)
+ return;
+ for (i = 0; i <= tTabs.length; i++) {
+ if ((o = $('#' + tTabs[i])))
+ var rmC = (tTabs[i] == tab) ? "inactif" : "actif";
+ var addC = (tTabs[i] == tab) ? "actif" : "inactif";
+ o.addClass(addC).removeClass(rmC);
- if ((o = document.getElementById("id" + tTabs[i]))) {
- o.style.display = (tTabs[i] == tab) ? "" : "none";
- }
- }
- $('#idongAdvSearch :text').each(function(){
- this.value = "";
- });
- if (tab == "ongAdvSearch") {
- document.getElementById("idongSearch").style.display = "";
- }
+ if ((o = document.getElementById("id" + tTabs[i]))) {
+ o.style.display = (tTabs[i] == tab) ? "" : "none";
+ }
+ }
+ $('#idongAdvSearch :text').each(function(){
+ this.value = "";
+ });
+ if (tab == "ongAdvSearch") {
+ document.getElementById("idongSearch").style.display = "";
+ }
- resizeSearch();
+ resizeSearch();
}
function doSpecialSearch(qry, allbase){
@@ -528,61 +528,61 @@ function doSpecialSearch(qry, allbase){
// else
// if($('#ongAdvSearch').length>0)
// chgOngSearch('ongAdvSearch');
- if (allbase) {
- $('input.basItem').each(function(){
- this.checked = true;
- });
- var first = true;
- $('#basSelector option').each(function(){
- this.selected = first;
- first = false;
- });
- }
- $("form[name='search'] input[name='qry']")[0].value = decodeURIComponent(qry).replace(/\+/g, " ");
- doSearch();
+ if (allbase) {
+ $('input.basItem').each(function(){
+ this.checked = true;
+ });
+ var first = true;
+ $('#basSelector option').each(function(){
+ this.selected = first;
+ first = false;
+ });
+ }
+ $("form[name='search'] input[name='qry']")[0].value = decodeURIComponent(qry).replace(/\+/g, " ");
+ doSearch();
}
function clearAnswers(){
- $('#formAnswerPage')[0].value = '';
- $("#nb_answers").empty();
- $("#navigation").empty();
- $("#answers").empty();
+ $('#formAnswerPage')[0].value = '';
+ $("#nb_answers").empty();
+ $("#navigation").empty();
+ $("#answers").empty();
}
function newSearch()
{
- $('#searchForm').submit();
+ $('#searchForm').submit();
}
function doSearch()
{
- $('#searchForm').submit();
+ $('#searchForm').submit();
}
function chgOng(num){
- for (i = 1; i <= 5; i++) {
- if ((o = document.getElementById("idOnglet" + i)))
- o.className = (i == num) ? "actif" : "inactif";
- if ((o = document.getElementById("onglet" + i)))
- o.style.display = (i == num) ? "block" : "none";
- }
- return;
+ for (i = 1; i <= 5; i++) {
+ if ((o = document.getElementById("idOnglet" + i)))
+ o.className = (i == num) ? "actif" : "inactif";
+ if ((o = document.getElementById("onglet" + i)))
+ o.style.display = (i == num) ? "block" : "none";
+ }
+ return;
}
function checkBases(etat){
- $('.basItem, .basChecker').each(function(){
- this.checked = etat;
- });
+ $('.basItem, .basChecker').each(function(){
+ this.checked = etat;
+ });
}
function resizeSearch(){
- var searchh = (bodySize.y-$('#baskets').height());
- searchh = ((searchh)>0)?searchh:0;
- var menu = $('#bigTabsBckg').height();
- $('#search').height(searchh);
- $('#idongTopic').height($("#search").height()-8-menu);
- $('#searchMiddle').height($("#search").height()-8-menu-$('#mainSearch').height());
+ var searchh = (bodySize.y-$('#baskets').height());
+ searchh = ((searchh)>0)?searchh:0;
+ var menu = $('#bigTabsBckg').height();
+ $('#search').height(searchh);
+ $('#idongTopic').height($("#search").height()-8-menu);
+ $('#searchMiddle').height($("#search").height()-8-menu-$('#mainSearch').height());
}
/*************
* Topics
@@ -591,40 +591,40 @@ function resizeSearch(){
function doThesSearch(type,sbid,term,field)
{
- if(type=='T')
- v = '*:"' + term.replace("(", "[").replace(")", "]") + '"';
- else
- v = '"' + term + '" IN ' + field;
- doSpecialSearch(v, true);
+ if(type=='T')
+ v = '*:"' + term.replace("(", "[").replace(")", "]") + '"';
+ else
+ v = '"' + term + '" IN ' + field;
+ doSpecialSearch(v, true);
}
function chgProp(path, v, k){
- var q2;
- if (!k)
- k = "*";
- if (k != null)
- v = v + " [" + k + "]";
- document.getElementById("thprop_a_" + path).innerHTML = '"' + v + '"';
+ var q2;
+ if (!k)
+ k = "*";
+ if (k != null)
+ v = v + " [" + k + "]";
+ document.getElementById("thprop_a_" + path).innerHTML = '"' + v + '"';
- q = document.getElementById("thprop_q").innerText;
- if (!q)
- if (document.getElementById("thprop_q") && document.getElementById("thprop_q").textContent)
- q = document.getElementById("thprop_q").textContent;
+ q = document.getElementById("thprop_q").innerText;
+ if (!q)
+ if (document.getElementById("thprop_q") && document.getElementById("thprop_q").textContent)
+ q = document.getElementById("thprop_q").textContent;
- q2 = "";
+ q2 = "";
- for (i = 0; i < q.length; i++)
- q2 += q.charCodeAt(i) == 160 ? " " : q.charAt(i); // correction pour safari !
- doSpecialSearch(q2, true);
- return (false);
+ for (i = 0; i < q.length; i++)
+ q2 += q.charCodeAt(i) == 160 ? " " : q.charAt(i); // correction pour safari !
+ doSpecialSearch(q2, true);
+ return (false);
}
function clktri(id){
- var o = $('#TOPIC_UL' + id);
- if ($('#TOPIC_UL' + id).hasClass('closed'))
- $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('closed').addClass('opened');
- else
- $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('opened').addClass('closed');
+ var o = $('#TOPIC_UL' + id);
+ if ($('#TOPIC_UL' + id).hasClass('closed'))
+ $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('closed').addClass('opened');
+ else
+ $('#TOPIC_TRI' + id + ' ,#TOPIC_UL' + id).removeClass('opened').addClass('closed');
}
@@ -647,115 +647,115 @@ function evt_add_in_chutier(sbas_id, record_id){
return false;
}
- $('#formChubas')[0].value = sbas_id;
- $('#formChup0')[0].value = record_id;
- $('#formChu').attr('action', '/client/baskets/add-element/').submit();
+ $('#formChubas')[0].value = sbas_id;
+ $('#formChup0')[0].value = record_id;
+ $('#formChu').attr('action', '/client/baskets/add-element/').submit();
}
function chg_chu()
{
- var id = document.getElementById("chutier_name").value;
- document.forms["formChu"].courChuId.value = id;
- $("#formChu").submit();
+ var id = document.getElementById("chutier_name").value;
+ document.forms["formChu"].courChuId.value = id;
+ $("#formChu").submit();
}
function getBaskets()
{
$('#formChu').attr("action","/client/baskets/")
- $('#formChu').submit();
+ $('#formChu').submit();
}
function newBasket(){
- var buttons = {};
+ 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(" ").attr('title',language.createWinInvite).dialog({
- autoOpen:false,
- closeOnEscape :true,
- resizable:false,
- draggable:false,
- modal:true
- }).dialog('open').dialog('option','buttons',buttons);
+ $('#DIALOG').empty().append(" ").attr('title',language.createWinInvite).dialog({
+ autoOpen:false,
+ closeOnEscape :true,
+ resizable:false,
+ draggable:false,
+ modal:true
+ }).dialog('open').dialog('option','buttons',buttons);
}
function saveNewBask(){
- var tmp = $('#newBaskName')[0].value;
- if (tmp == null)
- return;
- mytest = false;
- for (k = 0; (k < tmp.length && !mytest); k++) {
- if (tmp.charAt(k) != " ")
- mytest = true;
- }
- if (!mytest) {
- alert(language.chuNameEmpty);
- return;
- }
- $("#formChu").attr('action', '/client/baskets/new/')
- document.forms["formChu"].p0.value = tmp;
- $("#formChu").submit();
+ var tmp = $('#newBaskName')[0].value;
+ if (tmp == null)
+ return;
+ mytest = false;
+ for (k = 0; (k < tmp.length && !mytest); k++) {
+ if (tmp.charAt(k) != " ")
+ mytest = true;
+ }
+ if (!mytest) {
+ alert(language.chuNameEmpty);
+ return;
+ }
+ $("#formChu").attr('action', '/client/baskets/new/')
+ document.forms["formChu"].p0.value = tmp;
+ $("#formChu").submit();
}
function evt_chutier(arg_commande){
- switch (arg_commande) {
- case "DELSSEL":
- if (confirm(language.confirmDelBasket)) {
- if (document.forms["formChu"]) {
- document.forms["formChu"].p0.value = document.forms["formChu"].courChuId.value;
+ switch (arg_commande) {
+ case "DELSSEL":
+ if (confirm(language.confirmDelBasket)) {
+ if (document.forms["formChu"]) {
+ document.forms["formChu"].p0.value = document.forms["formChu"].courChuId.value;
$("#formChu").attr('action', '/client/baskets/delete/')
- $("#formChu").submit();
- }
- }
- break;
- }
+ $("#formChu").submit();
+ }
+ }
+ break;
+ }
}
function reload_chu(id){
- document.forms["formChu"].courChuId.value = id;
- $("#formChu").submit();
+ document.forms["formChu"].courChuId.value = id;
+ $("#formChu").submit();
}
function evt_del_in_chutier(selid){
- document.forms["formChu"].p0.value = selid;
+ document.forms["formChu"].p0.value = selid;
$("#formChu").attr("action", "/client/baskets/delete-element/")
- $("#formChu").submit();
+ $("#formChu").submit();
}
function openCompare(sselid){
- $('#ssel2val')[0].value = sselid;
- $('#validatorEject').submit();
+ $('#ssel2val')[0].value = sselid;
+ $('#validatorEject').submit();
}
function setVisible(el){
- el.style.visibility = 'visible';
+ el.style.visibility = 'visible';
}
function beforeAnswer(){
- if ($('#basSelector')) {
- var serialBas = $('#basSelector')[0].options[$('#basSelector')[0].selectedIndex].value;
- serialBas = serialBas.split(';');
- $.each($('.basItem'), function(i, el){
- el.checked = false;
- });
- $.each(serialBas, function(i, n){
- $('#basChk' + n)[0].checked = true;
- });
- }
- return true;
+ if ($('#basSelector')) {
+ var serialBas = $('#basSelector')[0].options[$('#basSelector')[0].selectedIndex].value;
+ serialBas = serialBas.split(';');
+ $.each($('.basItem'), function(i, el){
+ el.checked = false;
+ });
+ $.each(serialBas, function(i, n){
+ $('#basChk' + n)[0].checked = true;
+ });
+ }
+ return true;
}
function gotopage(pag){
- if ($('#searchForm').length > 0) {
- $('#searchForm input[name=nba]').val(p4.tot);
- $('#searchForm input[name=pag]').val(pag);
- $("#answers").empty();
- $('#searchForm').submit();
- }
- return false;
+ if ($('#searchForm').length > 0) {
+ $('#searchForm input[name=nba]').val(p4.tot);
+ $('#searchForm input[name=pag]').val(pag);
+ $("#answers").empty();
+ $('#searchForm').submit();
+ }
+ return false;
}
@@ -764,9 +764,9 @@ function evt_print(basrec){
if($('#chutier_name option').length === 0) {
return false;
}
- var datas = "&ssel="+$('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value;
+ var datas = "&ssel="+$('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value;
} else {
- var datas = "&lst=" + basrec;
+ var datas = "&lst=" + basrec;
}
var dialog = p4.Dialog.Create({title: typeof(language) !== 'undefined' ? language['print']: ''});
@@ -778,8 +778,8 @@ function evt_print(basrec){
$('.tabs', dialog.getDomElement()).tabs();
$('.close_button', dialog.getDomElement()).bind('click',function(){
- dialog.Close();
- });
+ dialog.Close();
+ });
return false;
});
@@ -788,13 +788,13 @@ function evt_print(basrec){
function evt_dwnl(lst)
{
- if(typeof(lst) == 'undefined') {
+ if(typeof(lst) == 'undefined') {
if($('#chutier_name option').length === 0) {
return false;
}
- var datas = "&ssel="+$('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value;
+ var datas = "&ssel="+$('#chutier_name')[0].options[$('#chutier_name')[0].selectedIndex].value;
} else {
- var datas = "&lst=" + lst;
+ var datas = "&lst=" + lst;
}
var dialog = p4.Dialog.Create({title: typeof(language) !== 'undefined' ? language['export']: ''});
@@ -806,8 +806,8 @@ function evt_dwnl(lst)
$('.tabs', dialog.getDomElement()).tabs();
$('.close_button', dialog.getDomElement()).bind('click',function(){
- dialog.Close();
- });
+ dialog.Close();
+ });
return false;
});
@@ -815,186 +815,186 @@ function evt_dwnl(lst)
function profil(value)
{
- var top;
- var left;
+ var top;
+ var left;
- if(value==undefined)
- value = "0";
+ if(value==undefined)
+ value = "0";
- var url = "" +
- "/include/profile.php" +
- "?callclient=1&onglet="+value;
+ var url = "" +
+ "/include/profile.php" +
+ "?callclient=1&onglet="+value;
- $('#MODALDL').attr('src',url);
+ $('#MODALDL').attr('src',url);
- var t = (bodySize.y - 550) / 2;
- var l = (bodySize.x - 490) / 2;
+ var t = (bodySize.y - 550) / 2;
+ var l = (bodySize.x - 490) / 2;
- $('#MODALDL').css({
- 'display': 'block',
- 'opacity': 0,
- 'width': '490px',
- 'position': 'absolute',
- 'top': t,
- 'left': l,
- 'height': '550px'
- }).fadeTo(500, 1);
+ $('#MODALDL').css({
+ 'display': 'block',
+ 'opacity': 0,
+ 'width': '490px',
+ 'position': 'absolute',
+ 'top': t,
+ 'left': l,
+ 'height': '550px'
+ }).fadeTo(500, 1);
- showOverlay(2);
+ showOverlay(2);
}
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,'+
- 'skins/client/'+color+'/ui.theme.css');
- $.post("/user/preferences/", {
- prop: "css",
- value: color
- }, function(data){
- return;
- });
- if ($.browser.msie && $.browser.version == '6.0')
- $('select').hide().show();
+ $('#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,'+
+ 'skins/client/'+color+'/ui.theme.css');
+ $.post("/user/preferences/", {
+ prop: "css",
+ value: color
+ }, function(data){
+ return;
+ });
+ if ($.browser.msie && $.browser.version == '6.0')
+ $('select').hide().show();
}
function lessPubli(sselid)
{
- $('#PUBLICONTMORE'+sselid+', #PUBLICONTLESS'+sselid).toggle();
- $('#PUBLICONT'+sselid).css({height: '135px'});
- $('#PUBLIMORE'+sselid+', #PUBLILESS'+sselid).toggle();
+ $('#PUBLICONTMORE'+sselid+', #PUBLICONTLESS'+sselid).toggle();
+ $('#PUBLICONT'+sselid).css({height: '135px'});
+ $('#PUBLIMORE'+sselid+', #PUBLILESS'+sselid).toggle();
}
function morePubli(sselid)
{
- $('#PUBLICONTMORE'+sselid+', #PUBLICONTLESS'+sselid).toggle();
- $('#PUBLICONT'+sselid).css({height: 'auto'});
- $('#PUBLIMORE'+sselid+', #PUBLILESS'+sselid).toggle();
+ $('#PUBLICONTMORE'+sselid+', #PUBLICONTLESS'+sselid).toggle();
+ $('#PUBLICONT'+sselid).css({height: 'auto'});
+ $('#PUBLIMORE'+sselid+', #PUBLILESS'+sselid).toggle();
}
function toggleFilter(filter,ele)
{
- var el = $('#'+filter);
- if(el.is(':hidden'))
- $(ele).parent().addClass('open');
- else
- $(ele).parent().removeClass('open');
- $('#'+filter).slideToggle('fast');
+ var el = $('#'+filter);
+ if(el.is(':hidden'))
+ $(ele).parent().addClass('open');
+ else
+ $(ele).parent().removeClass('open');
+ $('#'+filter).slideToggle('fast');
}
function checkFilters()
{
- var danger = false;
- var d = {};
- $('.filter_danger').each(function(){
- d[$(this).attr('id')] = false;
+ var danger = false;
+ var d = {};
+ $('.filter_danger').each(function(){
+ d[$(this).attr('id')] = false;
- });
+ });
- $('.basContTitle .base_filter :text').each(function(){
- if($(this)[0].value != "")
- {
- danger = true;
+ $('.basContTitle .base_filter :text').each(function(){
+ if($(this)[0].value != "")
+ {
+ danger = true;
- d['filter_danger'+parseInt($(this).attr('db'))] = true;
- }
- });
- $('.basContTitle .base_filter :checkbox').each(function(){
- if($(this)[0].checked)
- {
- danger = true;
+ d['filter_danger'+parseInt($(this).attr('db'))] = true;
+ }
+ });
+ $('.basContTitle .base_filter :checkbox').each(function(){
+ 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)
- {
- danger = true;
+ d['filter_danger'+parseInt($(this).attr('db'))] = true;
+ }
+ });
+ $('.basContTitle .base_filter select').each(function(){
+ if($(this)[0].selectedIndex != 0)
+ {
+ danger = true;
- d['filter_danger'+parseInt($(this).attr('db'))] = true;
- }
- });
+ d['filter_danger'+parseInt($(this).attr('db'))] = true;
+ }
+ });
- $.each(d,function(i,bool){
- if(bool)
- $('#'+i).show();
- else
- $('#'+i).hide();
- });
- if(danger)
- $('#filter_danger').show();
- else
- $('#filter_danger').hide();
+ $.each(d,function(i,bool){
+ if(bool)
+ $('#'+i).show();
+ else
+ $('#'+i).hide();
+ });
+ if(danger)
+ $('#filter_danger').show();
+ else
+ $('#filter_danger').hide();
}
function removeFilters(bas)
{
- if (typeof(bas) == 'undefined') {
- $('.basContTitle .base_filter :checkbox').each(function(){
- $(this)[0].checked = false;
- });
- $('.basContTitle .base_filter :text').each(function(){
- $(this)[0].value = "";
- });
- $('.basContTitle .base_filter select').each(function(){
- $(this)[0].selectedIndex = 0;
- });
- }
- else {
- $('#Filters' + bas + ' :checkbox').each(function(){
- $(this)[0].checked = false;
- });
- $('#Filters' + bas + ' :text').each(function(){
- $(this)[0].value = "";
- });
- $('#Filters' + bas + ' select').each(function(){
- $(this)[0].selectedIndex = 0;
- });
- }
- checkFilters();
+ if (typeof(bas) == 'undefined') {
+ $('.basContTitle .base_filter :checkbox').each(function(){
+ $(this)[0].checked = false;
+ });
+ $('.basContTitle .base_filter :text').each(function(){
+ $(this)[0].value = "";
+ });
+ $('.basContTitle .base_filter select').each(function(){
+ $(this)[0].selectedIndex = 0;
+ });
+ }
+ else {
+ $('#Filters' + bas + ' :checkbox').each(function(){
+ $(this)[0].checked = false;
+ });
+ $('#Filters' + bas + ' :text').each(function(){
+ $(this)[0].value = "";
+ });
+ $('#Filters' + bas + ' select').each(function(){
+ $(this)[0].selectedIndex = 0;
+ });
+ }
+ checkFilters();
}
function execLastAct(lastAct)
{
- if(lastAct.act)
- {
- switch (lastAct.act)
- {
- case 'dwnl':
- if(lastAct.SSTTID)
- {
- if (baskAjaxrunning) {
- setTimeout("execLastAct(lastAct);", 500);
- }
- else {
- if($('#chutier_name option').length === 0) {
- return false;
- }
+ if(lastAct.act)
+ {
+ switch (lastAct.act)
+ {
+ case 'dwnl':
+ if(lastAct.SSTTID)
+ {
+ if (baskAjaxrunning) {
+ setTimeout("execLastAct(lastAct);", 500);
+ }
+ else {
+ if($('#chutier_name option').length === 0) {
+ return false;
+ }
- 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;
- $('#chutier_name').trigger('change');
- setTimeout("execLastAct(lastAct);", 500);
- }
- });
- }else
- evt_dwnl();
- }
- }
- else
- if(lastAct.lst)
- {
- evt_dwnl(lastAct.lst);
- }
- break;
- }
- }
- return;
+ 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;
+ $('#chutier_name').trigger('change');
+ setTimeout("execLastAct(lastAct);", 500);
+ }
+ });
+ }else
+ evt_dwnl();
+ }
+ }
+ else
+ if(lastAct.lst)
+ {
+ evt_dwnl(lastAct.lst);
+ }
+ break;
+ }
+ }
+ return;
}
diff --git a/www/skins/lightbox/jquery.lightbox.ie6.js b/www/skins/lightbox/jquery.lightbox.ie6.js
index c113182262..24b46f818f 100644
--- a/www/skins/lightbox/jquery.lightbox.ie6.js
+++ b/www/skins/lightbox/jquery.lightbox.ie6.js
@@ -8,265 +8,265 @@ var bodySize = {
};
$(window).bind('beforeunload', function(){
- if(p4.releasable !== false)
- {
- if(confirm(p4.releasable))
+ if(p4.releasable !== false)
{
- $('#basket_options .confirm_report').trigger('click');
+ if(confirm(p4.releasable))
+ {
+ $('#basket_options .confirm_report').trigger('click');
+ }
}
- }
});
$(document).ready(function(){
bodySize.y = $('#mainContainer').height();
bodySize.x = $('#mainContainer').width();
- $(window).bind('resize',function(){
- resize();
- }).trigger('resize');
+ $(window).bind('resize',function(){
+ resize();
+ }).trigger('resize');
- function resize()
- {
+ function resize()
+ {
bodySize.y = $('#mainContainer').height();
bodySize.x = $('#mainContainer').width();
- var h = $(window).height();
- var w = $(window).width();
+ var h = $(window).height();
+ var w = $(window).width();
- $('body').width(w).height(h);
- $('#mainContent').width(w).height(h - $('#mainMenu').outerHeight());
- $('#innerWrapper').width(w - 20).height(h - $('#mainMenu').outerHeight() - 20);
- $('#innerTop').height(h - $('#mainMenu').outerHeight() - 20 - 186);
- $('#record_wrapper').width($('#innerWrapper').innerWidth() - $('#right_column').outerWidth() - 2);
+ $('body').width(w).height(h);
+ $('#mainContent').width(w).height(h - $('#mainMenu').outerHeight());
+ $('#innerWrapper').width(w - 20).height(h - $('#mainMenu').outerHeight() - 20);
+ $('#innerTop').height(h - $('#mainMenu').outerHeight() - 20 - 186);
+ $('#record_wrapper').width($('#innerWrapper').innerWidth() - $('#right_column').outerWidth() - 2);
// var right_column_wrapper_height = $('#right_column').innerHeight() - $('.right_column_title').outerHeight() - 10;
// $('.right_column_wrapper').height(right_column_wrapper_height);
- $('.record_display_box').each(function(i,n){
- $('.lightbox_container',n).height($(n).innerHeight() - $('.header').outerHeight());
- });
- display_record($('#record_compare').css('visibility') != 'hidden');
- }
+ $('.record_display_box').each(function(i,n){
+ $('.lightbox_container',n).height($(n).innerHeight() - $('.header').outerHeight());
+ });
+ display_record($('#record_compare').css('visibility') != 'hidden');
+ }
- $(this).data('slideshow',false);
- $(this).data('slideshow_ctime', false);
+ $(this).data('slideshow',false);
+ $(this).data('slideshow_ctime', false);
- $('#mainMenu, .unselectable').disableSelection();
+ $('#mainMenu, .unselectable').disableSelection();
- display_basket();
+ display_basket();
- $(window).bind('mousedown', function(){
- $(this).focus();
- }).trigger('mousedown');
+ $(window).bind('mousedown', function(){
+ $(this).focus();
+ }).trigger('mousedown');
- $('.basket_downloader').bind('click', function(){
- download_basket();
- });
+ $('.basket_downloader').bind('click', function(){
+ download_basket();
+ });
- $('.basket_wrapper').hover(
- function(){
- $(this).addClass('hover');
- },
- function(){
- $(this).removeClass('hover');
- }
- ).bind('click', function(){
- var id = $('input[name=ssel_id]',this).val();
- document.location = '/lightbox/validate/'+id+'/';
- return;
- });
- $('.right_column_title').bind('click', function(){
- var title = $('.right_column_title');
- if(!$('.right_column_wrapper_caption').is(':visible'))
- {
- $('.right_column_wrapper_user').height(0);
- $('.right_column_wrapper_caption').show();
- $('.caption', title).addClass('highlight');
- $('.validate', title).removeClass('highlight');
- }
- else
- {
- $('.right_column_wrapper_user').height('auto');
- $('.right_column_wrapper_caption').hide();
- $('.caption', title).removeClass('highlight');
- $('.validate', title).addClass('highlight');
- }
- }).addClass('clickable');
+ $('.basket_wrapper').hover(
+ function(){
+ $(this).addClass('hover');
+ },
+ function(){
+ $(this).removeClass('hover');
+ }
+ ).bind('click', function(){
+ var id = $('input[name=ssel_id]',this).val();
+ document.location = '/lightbox/validate/'+id+'/';
+ return;
+ });
+ $('.right_column_title').bind('click', function(){
+ var title = $('.right_column_title');
+ if(!$('.right_column_wrapper_caption').is(':visible'))
+ {
+ $('.right_column_wrapper_user').height(0);
+ $('.right_column_wrapper_caption').show();
+ $('.caption', title).addClass('highlight');
+ $('.validate', title).removeClass('highlight');
+ }
+ else
+ {
+ $('.right_column_wrapper_user').height('auto');
+ $('.right_column_wrapper_caption').hide();
+ $('.caption', title).removeClass('highlight');
+ $('.validate', title).addClass('highlight');
+ }
+ }).addClass('clickable');
- var sselcont = $('#sc_container .basket_element:first');
- if(sselcont.length > 0)
- {
- display_basket_element(false, sselcont.attr('id').split('_').pop());
- }
+ var sselcont = $('#sc_container .basket_element:first');
+ if(sselcont.length > 0)
+ {
+ display_basket_element(false, sselcont.attr('id').split('_').pop());
+ }
- set_sizeable($('#record_main .lightbox_container, #record_compare .lightbox_container'));
+ set_sizeable($('#record_main .lightbox_container, #record_compare .lightbox_container'));
- $('#navigation')
- .bind('change',
- function()
- {
- window.location.replace(window.location.protocol+"//"+window.location.host+'/lightbox/validate/'+$(this).val()+'/');
- }
- );
- bind_keyboard();
+ $('#navigation')
+ .bind('change',
+ function()
+ {
+ window.location.replace(window.location.protocol+"//"+window.location.host+'/lightbox/validate/'+$(this).val()+'/');
+ }
+ );
+ bind_keyboard();
});
function bind_keyboard()
{
- $(document).bind('keydown', function(event){
+ $(document).bind('keydown', function(event){
- var stop = false;
- $('.notes_wrapper').each(function(i,n){
- if(parseInt($(n).css('top')) >= 0)
- stop = true;
- });
+ var stop = false;
+ $('.notes_wrapper').each(function(i,n){
+ if(parseInt($(n).css('top')) >= 0)
+ stop = true;
+ });
- if(stop)
- return true;
+ if(stop)
+ return true;
- var cancelKey = false;
+ var cancelKey = false;
- var el, id;
+ var el, id;
- switch(event.keyCode)
- {
- case 39:
- get_next();
- cancelKey = true;
- break;
- case 37:
- get_prev();
- cancelKey = true;
- break;
- case 32:
- var bool = !$(document).data('slideshow');
- slideshow(bool);
- break;
- case 38:
- el = $('#sc_container .basket_element.selected');
- if(el.length === 1)
- {
- id = el.attr('id').split('_').pop();
- set_agreement(event, el, id, 1);
- }
- break;
- case 40:
- el = $('#sc_container .basket_element.selected');
- if(el.length === 1)
- {
- id = el.attr('id').split('_').pop();
- set_agreement(event, el, id, -1);
- }
- break;
- default:
- break;
- }
+ switch(event.keyCode)
+ {
+ case 39:
+ get_next();
+ cancelKey = true;
+ break;
+ case 37:
+ get_prev();
+ cancelKey = true;
+ break;
+ case 32:
+ var bool = !$(document).data('slideshow');
+ slideshow(bool);
+ break;
+ case 38:
+ el = $('#sc_container .basket_element.selected');
+ if(el.length === 1)
+ {
+ id = el.attr('id').split('_').pop();
+ set_agreement(event, el, id, 1);
+ }
+ break;
+ case 40:
+ el = $('#sc_container .basket_element.selected');
+ if(el.length === 1)
+ {
+ id = el.attr('id').split('_').pop();
+ set_agreement(event, el, id, -1);
+ }
+ break;
+ default:
+ break;
+ }
- if(cancelKey)
- {
- event.cancelBubble = true;
- if(event.stopPropagation)
- event.stopPropagation();
- return(false);
- }
- return true;
- });
+ if(cancelKey)
+ {
+ event.cancelBubble = true;
+ if(event.stopPropagation)
+ event.stopPropagation();
+ return(false);
+ }
+ return true;
+ });
}
function set_release(el)
{
- $('.loader', el).css({visibility:'visible'});
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_RELEASE/"+$('#navigation').val()+"/",
- dataType: 'json',
- error: function(data){
- $('.loader', el).css({visibility:'hidden'});
- },
- timeout: function(data){
- $('.loader', el).css({visibility:'hidden'});
- },
- success: function(data){
- $('.loader', el).css({
- visibility:'hidden'
- });
- if(data.datas)
- {
- alert(data.datas);
- }
- if(!data.error)
- {
- p4.releasable = false;
- }
+ $('.loader', el).css({visibility:'visible'});
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_RELEASE/"+$('#navigation').val()+"/",
+ dataType: 'json',
+ error: function(data){
+ $('.loader', el).css({visibility:'hidden'});
+ },
+ timeout: function(data){
+ $('.loader', el).css({visibility:'hidden'});
+ },
+ success: function(data){
+ $('.loader', el).css({
+ visibility:'hidden'
+ });
+ if(data.datas)
+ {
+ alert(data.datas);
+ }
+ if(!data.error)
+ {
+ p4.releasable = false;
+ }
- return;
- }
- });
+ return;
+ }
+ });
}
function load_report()
{
- $.ajax({
- type: "GET",
- url: "/lightbox/ajax/LOAD_REPORT/"+$('#navigation').val()+"/",
- dataType: 'html',
- success: function(data){
- $('#report').empty().append(data);
- $('#report .reportTips').tooltip({delay:false});
- $('#report').dialog({
- width : 600,
- height : Math.round($(window).height() * 0.8)
- }).dialog('open').show();
- return;
- }
- });
+ $.ajax({
+ type: "GET",
+ url: "/lightbox/ajax/LOAD_REPORT/"+$('#navigation').val()+"/",
+ dataType: 'html',
+ success: function(data){
+ $('#report').empty().append(data);
+ $('#report .reportTips').tooltip({delay:false});
+ $('#report').dialog({
+ width : 600,
+ height : Math.round($(window).height() * 0.8)
+ }).dialog('open').show();
+ return;
+ }
+ });
}
function set_sizeable(container)
{
- $(container).bind('mousewheel',function(event,delta){
+ $(container).bind('mousewheel',function(event,delta){
- if($(this).hasClass('note_editing'))
- return;
+ if($(this).hasClass('note_editing'))
+ return;
- var record = $('.record', this);
+ var record = $('.record', this);
- if(record.length === 0)
- return;
+ if(record.length === 0)
+ return;
- var o_top = parseInt(record.css('top'));
- var o_left = parseInt(record.css('left'));
+ var o_top = parseInt(record.css('top'));
+ var o_left = parseInt(record.css('left'));
- var o_width, o_height, width, height;
+ var o_width, o_height, width, height;
- if(delta > 0)
- {
- if (record.width() > 29788 || record.height() >= 29788)
- return;
- o_width = record.width();
- o_height = record.height();
- width = Math.round(o_width * 1.1);
- height = Math.round(o_height * 1.1);
- }
- else
- {
- if (record.width() < 30 || record.height() < 30)
- return;
- o_width = record.width();
- o_height = record.height();
- width = Math.round(o_width / 1.05);
- height = Math.round(o_height / 1.05);
- }
+ if(delta > 0)
+ {
+ if (record.width() > 29788 || record.height() >= 29788)
+ return;
+ o_width = record.width();
+ o_height = record.height();
+ width = Math.round(o_width * 1.1);
+ height = Math.round(o_height * 1.1);
+ }
+ else
+ {
+ if (record.width() < 30 || record.height() < 30)
+ return;
+ o_width = record.width();
+ o_height = record.height();
+ width = Math.round(o_width / 1.05);
+ height = Math.round(o_height / 1.05);
+ }
- var top = Math.round((height / o_height) * (o_top - $(this).height() / 2) + $(this).height() / 2);
- var left = Math.round((width / o_width) * (o_left - $(this).width() / 2) + $(this).width() / 2);
+ var top = Math.round((height / o_height) * (o_top - $(this).height() / 2) + $(this).height() / 2);
+ var left = Math.round((width / o_width) * (o_left - $(this).width() / 2) + $(this).width() / 2);
- record.width(width).height(height).css({top:top, left:left});
- });
+ record.width(width).height(height).css({top:top, left:left});
+ });
}
@@ -274,38 +274,38 @@ function set_sizeable(container)
function display_basket()
{
- var sc_wrapper = $('#sc_wrapper');
- var basket_options = $('#basket_options');
+ var sc_wrapper = $('#sc_wrapper');
+ var basket_options = $('#basket_options');
- $('.report').bind('click', function(){
- load_report();
- }).addClass('clickable');
- $('.confirm_report', basket_options).button({
- }).bind('click',function(){
- set_release($(this));
- });
+ $('.report').bind('click', function(){
+ load_report();
+ }).addClass('clickable');
+ $('.confirm_report', basket_options).button({
+ }).bind('click',function(){
+ set_release($(this));
+ });
- $('.basket_element',sc_wrapper).parent()
- .bind('click',function(event){
- scid_click(event, this);
- return false;
- })
- .addClass('clickable');
+ $('.basket_element',sc_wrapper).parent()
+ .bind('click',function(event){
+ scid_click(event, this);
+ return false;
+ })
+ .addClass('clickable');
- $('.agree_button, .disagree_button',sc_wrapper).bind('click',function(event){
+ $('.agree_button, .disagree_button',sc_wrapper).bind('click',function(event){
- var sselcont_id = $(this).closest('.basket_element').attr('id').split('_').pop();
+ var sselcont_id = $(this).closest('.basket_element').attr('id').split('_').pop();
- var agreement = $(this).hasClass('agree_button') ? '1' : '-1';
+ var agreement = $(this).hasClass('agree_button') ? '1' : '-1';
- set_agreement(event, $(this), sselcont_id, agreement);
- return false;
- }).addClass('clickable');
+ set_agreement(event, $(this), sselcont_id, agreement);
+ return false;
+ }).addClass('clickable');
- n = $('.basket_element',sc_wrapper).length;
- $('#sc_container').width(n * $('.basket_element_wrapper:first',sc_wrapper).outerWidth() + 1);
+ n = $('.basket_element',sc_wrapper).length;
+ $('#sc_container').width(n * $('.basket_element_wrapper:first',sc_wrapper).outerWidth() + 1);
- $('.previewTips').tooltip();
+ $('.previewTips').tooltip();
}
@@ -323,163 +323,163 @@ function display_basket()
function display_basket_element(compare, sselcont_id)
{
- var container;
- if(compare)
- {
- container = $('#record_compare');
- }
- else
- {
- container = $('#record_main');
- }
+ var container;
+ if(compare)
+ {
+ container = $('#record_compare');
+ }
+ else
+ {
+ container = $('#record_main');
+ }
$('.record_image', container).removeAttr('ondragstart');
- $('.record_image', container).draggable();
+ $('.record_image', container).draggable();
- var options_container = $('.options',container);
+ var options_container = $('.options',container);
- $('.download_button', options_container).button({
- text : false
- }).bind('click',function(){
- download($(this).next('form[name=download_form]').find('input').val());
- });
+ $('.download_button', options_container).button({
+ text : false
+ }).bind('click',function(){
+ download($(this).next('form[name=download_form]').find('input').val());
+ });
- $('.comment_button', options_container).button({
- text : true
- }).bind('click',function()
- {
- if($('.lightbox_container', container).hasClass('note_editing'))
- {
- hide_notes(container);
- }
- else
- {
- show_notes(container);
- }
- }
- );
+ $('.comment_button', options_container).button({
+ text : true
+ }).bind('click',function()
+ {
+ if($('.lightbox_container', container).hasClass('note_editing'))
+ {
+ hide_notes(container);
+ }
+ else
+ {
+ show_notes(container);
+ }
+ }
+ );
- activate_notes(container);
+ activate_notes(container);
- $('.previous_button', options_container).button({
- text : false
- }).bind('click',function(){
- get_prev();
- });
+ $('.previous_button', options_container).button({
+ text : false
+ }).bind('click',function(){
+ get_prev();
+ });
- $('.play_button', options_container).button({
- text : false
- }).bind('click',function(){
- slideshow(true);
- });
+ $('.play_button', options_container).button({
+ text : false
+ }).bind('click',function(){
+ slideshow(true);
+ });
- $('.pause_button', options_container).button({
- text : false
- }).bind('click',function(){
- slideshow(false);
- });
+ $('.pause_button', options_container).button({
+ text : false
+ }).bind('click',function(){
+ slideshow(false);
+ });
- if($(document).data('slideshow'))
- {
- $('.play_button, .next_button.play, .previous_button.play', options_container).hide();
- }
- else
- {
- $('.pause_button, .next_button.pause, .previous_button.pause', options_container).hide();
- }
+ if($(document).data('slideshow'))
+ {
+ $('.play_button, .next_button.play, .previous_button.play', options_container).hide();
+ }
+ else
+ {
+ $('.pause_button, .next_button.pause, .previous_button.pause', options_container).hide();
+ }
- $('.next_button', options_container).button({
- text : false
- }).bind('click',function(){
- get_next();
- });
+ $('.next_button', options_container).button({
+ text : false
+ }).bind('click',function(){
+ get_next();
+ });
- $('.lightbox_container', container).bind('dblclick',function(event){
- display_record();
- });
+ $('.lightbox_container', container).bind('dblclick',function(event){
+ display_record();
+ });
- $('#record_wrapper .agree_'+sselcont_id+', .big_box.agree')
- .bind('click',
- function(event)
- {
- set_agreement(event, $(this), sselcont_id, '1');
- }
- )
- .addClass('clickable');
+ $('#record_wrapper .agree_'+sselcont_id+', .big_box.agree')
+ .bind('click',
+ function(event)
+ {
+ set_agreement(event, $(this), sselcont_id, '1');
+ }
+ )
+ .addClass('clickable');
- $('#record_wrapper .disagree_'+sselcont_id+', .big_box.disagree')
- .bind('click',
- function(event)
- {
- set_agreement(event, $(this), sselcont_id, '-1');
- }
- )
- .addClass('clickable');
+ $('#record_wrapper .disagree_'+sselcont_id+', .big_box.disagree')
+ .bind('click',
+ function(event)
+ {
+ set_agreement(event, $(this), sselcont_id, '-1');
+ }
+ )
+ .addClass('clickable');
- if(compare == $('#record_wrapper').hasClass('single'))
- {
- if(compare)
- {
- $('#record_infos, #right_column').hide();
- $('#record_wrapper').stop().css({width:'100%'});
- display_record(compare);
- }
- else
- {
- $('#record_wrapper').css({
- width:($('#innerWrapper').width() - $('#record_infos').outerWidth() - $('#right_column').outerWidth() - 2)
- });
- display_record(compare);
- $('#record_infos, #right_column').show();
- $('#record_compare .lightbox_container').empty();
- }
+ if(compare == $('#record_wrapper').hasClass('single'))
+ {
+ if(compare)
+ {
+ $('#record_infos, #right_column').hide();
+ $('#record_wrapper').stop().css({width:'100%'});
+ display_record(compare);
+ }
+ else
+ {
+ $('#record_wrapper').css({
+ width:($('#innerWrapper').width() - $('#record_infos').outerWidth() - $('#right_column').outerWidth() - 2)
+ });
+ display_record(compare);
+ $('#record_infos, #right_column').show();
+ $('#record_compare .lightbox_container').empty();
+ }
- }
- else
- {
- display_record(compare);
- }
+ }
+ else
+ {
+ display_record(compare);
+ }
}
function set_container_status(status)
{
- $('#record_wrapper').removeClass('paysage portrait single').addClass(status);
+ $('#record_wrapper').removeClass('paysage portrait single').addClass(status);
}
function show_notes(container)
{
- $('.notes_wrapper', container).animate({top:0});
- $('.lightbox_container', container).addClass('note_editing');
+ $('.notes_wrapper', container).animate({top:0});
+ $('.lightbox_container', container).addClass('note_editing');
}
function hide_notes(container)
{
- $('.notes_wrapper', container).animate({top:'-100%'});
- $('.lightbox_container', container).removeClass('note_editing');
+ $('.notes_wrapper', container).animate({top:'-100%'});
+ $('.lightbox_container', container).removeClass('note_editing');
}
function activate_notes(container)
{
- $('.note_closer', container).button({
- text : true
- }).bind('click',function()
- {
+ $('.note_closer', container).button({
+ text : true
+ }).bind('click',function()
+ {
// $(this).blur();
- hide_notes(container);
- return false;
- }
- );
+ hide_notes(container);
+ return false;
+ }
+ );
- $('.note_saver', container).button({
- text : true
- }).bind('click',function()
- {
+ $('.note_saver', container).button({
+ text : true
+ }).bind('click',function()
+ {
// $(this).blur();
- save_note(container, this);
- return false;
- }
- );
+ save_note(container, this);
+ return false;
+ }
+ );
}
@@ -487,7 +487,7 @@ function activate_notes(container)
function download(value)
{
- var dialog = p4.Dialog.Create({title: typeof(language) !== 'undefined' ? language['export']: ''});
+ var dialog = p4.Dialog.Create({title: typeof(language) !== 'undefined' ? language['export']: ''});
$.post("/prod/export/multi-export/", "lst="+value, function(data) {
@@ -497,7 +497,7 @@ function download(value)
$('.close_button', dialog.getDomElement()).bind('click',function(){
dialog.Close();
- });
+ });
return false;
});
@@ -506,544 +506,544 @@ function download(value)
function display_record(compare)
{
- var main_container = $('#record_wrapper');
+ var main_container = $('#record_wrapper');
- main_container.width($('#innerWrapper').innerWidth() - $('#right_column').outerWidth() - 2);
+ main_container.width($('#innerWrapper').innerWidth() - $('#right_column').outerWidth() - 2);
- if(typeof compare == 'undefined')
- compare = !main_container.hasClass('single');
+ if(typeof compare == 'undefined')
+ compare = !main_container.hasClass('single');
- var main_box = $('#record_main');
- var compare_box = $('#record_compare');
+ var main_box = $('#record_main');
+ var compare_box = $('#record_compare');
- var main_record = $('.lightbox_container .record', main_box);
- var compare_record = $('.lightbox_container .record', compare_box);
+ var main_record = $('.lightbox_container .record', main_box);
+ var compare_record = $('.lightbox_container .record', compare_box);
- var main_record_width = parseInt($('input[name=width]', main_box).val());
- var main_record_height = parseInt($('input[name=height]', main_box).val());
- var compare_record_width = parseInt($('input[name=width]', compare_box).val());
- var compare_record_height = parseInt($('input[name=height]', compare_box).val());
+ var main_record_width = parseInt($('input[name=width]', main_box).val());
+ var main_record_height = parseInt($('input[name=height]', main_box).val());
+ var compare_record_width = parseInt($('input[name=width]', compare_box).val());
+ var compare_record_height = parseInt($('input[name=height]', compare_box).val());
- var main_container_width = main_container.width();
- var main_container_innerwidth = main_container.innerWidth();
- var main_container_height = main_container.height();
- var main_container_innerheight = main_container.innerHeight();
+ var main_container_width = main_container.width();
+ var main_container_innerwidth = main_container.innerWidth();
+ var main_container_height = main_container.height();
+ var main_container_innerheight = main_container.innerHeight();
- if(compare)
- {
- $('.agreement_selector').show();
- main_container.addClass('comparison');
+ if(compare)
+ {
+ $('.agreement_selector').show();
+ main_container.addClass('comparison');
- var double_portrait_width = main_container_innerwidth / 2;
- var double_portrait_height = main_container_innerheight - $('.header', main_box).outerHeight();
+ var double_portrait_width = main_container_innerwidth / 2;
+ var double_portrait_height = main_container_innerheight - $('.header', main_box).outerHeight();
- var double_paysage_width = main_container_innerwidth;
- var double_paysage_height = main_container_innerheight / 2 - $('.header', main_box).outerHeight();
+ var double_paysage_width = main_container_innerwidth;
+ var double_paysage_height = main_container_innerheight / 2 - $('.header', main_box).outerHeight();
- var main_display_portrait = calculate_display(
- double_portrait_width, double_portrait_height,
- main_record_width, main_record_height
- );
- var main_display_paysage = calculate_display(
- double_paysage_width, double_paysage_height,
- main_record_width, main_record_height
- );
+ var main_display_portrait = calculate_display(
+ double_portrait_width, double_portrait_height,
+ main_record_width, main_record_height
+ );
+ var main_display_paysage = calculate_display(
+ double_paysage_width, double_paysage_height,
+ main_record_width, main_record_height
+ );
- var compare_display_portrait = calculate_display(
- double_portrait_width, double_portrait_height,
- compare_record_width, compare_record_height
- );
- var compare_display_paysage = calculate_display(
- double_paysage_width, double_paysage_height,
- compare_record_width, compare_record_height
- );
+ var compare_display_portrait = calculate_display(
+ double_portrait_width, double_portrait_height,
+ compare_record_width, compare_record_height
+ );
+ var compare_display_paysage = calculate_display(
+ double_paysage_width, double_paysage_height,
+ compare_record_width, compare_record_height
+ );
- var surface_main_portrait = main_display_portrait.width * main_display_portrait.height;
- var surface_main_paysage = main_display_paysage.width * main_display_paysage.height;
- var surface_compare_portrait = compare_display_portrait.width * compare_display_portrait.height;
- var surface_compare_paysage = compare_display_paysage.width * compare_display_paysage.height;
+ var surface_main_portrait = main_display_portrait.width * main_display_portrait.height;
+ var surface_main_paysage = main_display_paysage.width * main_display_paysage.height;
+ var surface_compare_portrait = compare_display_portrait.width * compare_display_portrait.height;
+ var surface_compare_paysage = compare_display_paysage.width * compare_display_paysage.height;
- var double_portrait_surface = (surface_main_portrait + surface_compare_portrait) / 2;
- var double_paysage_surface = (surface_main_paysage + surface_compare_paysage) / 2;
+ var double_portrait_surface = (surface_main_portrait + surface_compare_portrait) / 2;
+ var double_paysage_surface = (surface_main_paysage + surface_compare_paysage) / 2;
- var smooth_image = false;
+ var smooth_image = false;
- var m_width_image, m_height_image, c_width_image, c_height_image, dim_container;
+ var m_width_image, m_height_image, c_width_image, c_height_image, dim_container;
- if(double_portrait_surface > double_paysage_surface)
- {
- if(!main_container.hasClass('portrait'))
- {
- smooth_image = true;
+ if(double_portrait_surface > double_paysage_surface)
+ {
+ if(!main_container.hasClass('portrait'))
+ {
+ smooth_image = true;
- smooth_transform(
- main_box,
- parseInt($('#innerWrapper').width() / 2 - 13),
- $('#innerWrapper').height(),
- function()
- {
- set_container_status('portrait');
- }
- );
+ smooth_transform(
+ main_box,
+ parseInt($('#innerWrapper').width() / 2 - 13),
+ $('#innerWrapper').height(),
+ function()
+ {
+ set_container_status('portrait');
+ }
+ );
- compare_box.css('visibility','hidden');
+ compare_box.css('visibility','hidden');
- smooth_transform(
- compare_box,
- parseInt($('#innerWrapper').width() / 2 - 13),
- $('#innerWrapper').height(),
- function()
- {
- compare_box.css('display','none')
- .css('visibility','visible').show();
- }
- );
- }
- m_width_image = main_display_portrait.width;
- m_height_image = main_display_portrait.height;
- c_width_image = compare_display_portrait.width;
- c_height_image = compare_display_portrait.height;
- dim_container = {width:double_portrait_width,height:double_portrait_height};
- }
- else
- {
- if(!main_container.hasClass('paysage'))
- {
- smooth_image = true;
-
- smooth_transform(
- main_box,
- $('#innerWrapper').width(),
- parseInt($('#innerWrapper').height() / 2),
- function()
- {
- set_container_status('paysage');
- }
- );
-
- compare_box.css('visibility','hidden');
-
- smooth_transform(
- compare_box,
- $('#innerWrapper').width(),
- parseInt($('#innerWrapper').height() / 2),
- function()
- {
- compare_box.css('display','none')
- .css('visibility','visible')
- .show();
- }
- );
- }
- m_width_image = main_display_paysage.width;
- m_height_image = main_display_paysage.height;
- c_width_image = compare_display_paysage.width;
- c_height_image = compare_display_paysage.height;
- dim_container = {width:double_paysage_width,height:double_paysage_height};
- }
-
- var image_callback = set_image_position(false, compare_record, c_width_image, c_height_image, dim_container, function(){});
- set_image_position(smooth_image, main_record, m_width_image, m_height_image, dim_container, image_callback);
- }
- else
- {
- $('.agreement_selector').hide();
- main_container.removeClass('comparison');
-
- if(compare_box.is(':visible'))
- {
- compare_box.hide().css('visibility','hidden').css('display','block');
- }
-
- var main_display = calculate_display(
- main_container_innerwidth
- , (main_container_innerheight - $('.header', main_box).outerHeight())
- , main_record_width
- , main_record_height
- );
-
- if(!main_container.hasClass('single'))
- {
- main_box.width('100%')
- .height('100%');
-
- set_container_status('single');
- }
-
- set_image_position(
- smooth_image
- , main_record
- , main_display.width
- , main_display.height
- , {
- width : main_container_width
- ,height : (main_container_height - $('.header', main_box).outerHeight())
+ smooth_transform(
+ compare_box,
+ parseInt($('#innerWrapper').width() / 2 - 13),
+ $('#innerWrapper').height(),
+ function()
+ {
+ compare_box.css('display','none')
+ .css('visibility','visible').show();
+ }
+ );
+ }
+ m_width_image = main_display_portrait.width;
+ m_height_image = main_display_portrait.height;
+ c_width_image = compare_display_portrait.width;
+ c_height_image = compare_display_portrait.height;
+ dim_container = {width:double_portrait_width,height:double_portrait_height};
}
- );
- }
+ else
+ {
+ if(!main_container.hasClass('paysage'))
+ {
+ smooth_image = true;
+
+ smooth_transform(
+ main_box,
+ $('#innerWrapper').width(),
+ parseInt($('#innerWrapper').height() / 2),
+ function()
+ {
+ set_container_status('paysage');
+ }
+ );
+
+ compare_box.css('visibility','hidden');
+
+ smooth_transform(
+ compare_box,
+ $('#innerWrapper').width(),
+ parseInt($('#innerWrapper').height() / 2),
+ function()
+ {
+ compare_box.css('display','none')
+ .css('visibility','visible')
+ .show();
+ }
+ );
+ }
+ m_width_image = main_display_paysage.width;
+ m_height_image = main_display_paysage.height;
+ c_width_image = compare_display_paysage.width;
+ c_height_image = compare_display_paysage.height;
+ dim_container = {width:double_paysage_width,height:double_paysage_height};
+ }
+
+ var image_callback = set_image_position(false, compare_record, c_width_image, c_height_image, dim_container, function(){});
+ set_image_position(smooth_image, main_record, m_width_image, m_height_image, dim_container, image_callback);
+ }
+ else
+ {
+ $('.agreement_selector').hide();
+ main_container.removeClass('comparison');
+
+ if(compare_box.is(':visible'))
+ {
+ compare_box.hide().css('visibility','hidden').css('display','block');
+ }
+
+ var main_display = calculate_display(
+ main_container_innerwidth
+ , (main_container_innerheight - $('.header', main_box).outerHeight())
+ , main_record_width
+ , main_record_height
+ );
+
+ if(!main_container.hasClass('single'))
+ {
+ main_box.width('100%')
+ .height('100%');
+
+ set_container_status('single');
+ }
+
+ set_image_position(
+ smooth_image
+ , main_record
+ , main_display.width
+ , main_display.height
+ , {
+ width : main_container_width
+ ,height : (main_container_height - $('.header', main_box).outerHeight())
+ }
+ );
+ }
}
function set_agreement(event, el, sselcont_id, boolean_value)
{
- if(event.stopPropagation)
- event.stopPropagation();
- event.cancelBubble = true;
+ if(event.stopPropagation)
+ event.stopPropagation();
+ event.cancelBubble = true;
- var id =
+ var id =
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/"+sselcont_id+"/",
- dataType: 'json',
- data: {
- agreement : boolean_value
- },
- success: function(datas){
- if(!datas.error)
- {
- if(boolean_value == '1')
- {
- $('.agree_'+sselcont_id+'').removeClass('not_decided');
- $('.disagree_'+sselcont_id+'').addClass('not_decided');
- $('.userchoice.me').addClass('agree').removeClass('disagree');
- }
- else
- {
- $('.agree_'+sselcont_id+'').addClass('not_decided');
- $('.disagree_'+sselcont_id+'').removeClass('not_decided');
- $('.userchoice.me').addClass('disagree').removeClass('agree');
- }
- p4.releasable = datas.releasable;
- if(datas.releasable !== false)
- {
- if(confirm(datas.releasable))
- $('#basket_options .confirm_report').trigger('click');
- }
- }
- else
- {
- alert(datas.datas);
- }
- return;
- }
- });
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/"+sselcont_id+"/",
+ dataType: 'json',
+ data: {
+ agreement : boolean_value
+ },
+ success: function(datas){
+ if(!datas.error)
+ {
+ if(boolean_value == '1')
+ {
+ $('.agree_'+sselcont_id+'').removeClass('not_decided');
+ $('.disagree_'+sselcont_id+'').addClass('not_decided');
+ $('.userchoice.me').addClass('agree').removeClass('disagree');
+ }
+ else
+ {
+ $('.agree_'+sselcont_id+'').addClass('not_decided');
+ $('.disagree_'+sselcont_id+'').removeClass('not_decided');
+ $('.userchoice.me').addClass('disagree').removeClass('agree');
+ }
+ p4.releasable = datas.releasable;
+ if(datas.releasable !== false)
+ {
+ if(confirm(datas.releasable))
+ $('#basket_options .confirm_report').trigger('click');
+ }
+ }
+ else
+ {
+ alert(datas.datas);
+ }
+ return;
+ }
+ });
}
function get_next()
{
- var current_wrapper = $('#sc_container .basket_element.selected').parent();
+ var current_wrapper = $('#sc_container .basket_element.selected').parent();
- if(current_wrapper.length === 0)
- return;
+ if(current_wrapper.length === 0)
+ return;
- current_wrapper = current_wrapper.next();
- if(current_wrapper.length === 0)
- current_wrapper = $('#sc_container .basket_element_wrapper:first');
+ current_wrapper = current_wrapper.next();
+ if(current_wrapper.length === 0)
+ current_wrapper = $('#sc_container .basket_element_wrapper:first');
- $('.basket_element', current_wrapper).trigger('click');
+ $('.basket_element', current_wrapper).trigger('click');
- adjust_visibility($('.basket_element', current_wrapper));
+ adjust_visibility($('.basket_element', current_wrapper));
- if($(document).data('slideshow'))
- {
- var timer = setTimeout('get_next();', 3500);
- $(document).data('slideshow_ctime', timer);
- }
+ if($(document).data('slideshow'))
+ {
+ var timer = setTimeout('get_next();', 3500);
+ $(document).data('slideshow_ctime', timer);
+ }
}
function get_prev()
{
- var current_wrapper = $('#sc_container .basket_element.selected').parent();
+ var current_wrapper = $('#sc_container .basket_element.selected').parent();
- if(current_wrapper.length === 0)
- return;
+ if(current_wrapper.length === 0)
+ return;
- slideshow(false);
+ slideshow(false);
- current_wrapper = current_wrapper.prev();
- if(current_wrapper.length === 0)
- current_wrapper = $('#sc_container .basket_element_wrapper:last');
+ current_wrapper = current_wrapper.prev();
+ if(current_wrapper.length === 0)
+ current_wrapper = $('#sc_container .basket_element_wrapper:last');
- $('.basket_element', current_wrapper).trigger('click');
+ $('.basket_element', current_wrapper).trigger('click');
- adjust_visibility($('.basket_element', current_wrapper));
+ adjust_visibility($('.basket_element', current_wrapper));
}
function is_viewable(el)
{
- var sc_wrapper = $('#sc_wrapper');
- var sc_container = $('#sc_container');
+ var sc_wrapper = $('#sc_wrapper');
+ var sc_container = $('#sc_container');
- var el_width = $(el).parent().outerWidth();
- var el_position = $(el).parent().position();
- var sc_scroll_left = sc_wrapper.scrollLeft();
+ var el_width = $(el).parent().outerWidth();
+ var el_position = $(el).parent().position();
+ var sc_scroll_left = sc_wrapper.scrollLeft();
- var boundup = sc_wrapper.width(),
- bounddown = 0,
- placeup = el_position.left + el_width - sc_scroll_left,
- placedown = el_position.left - sc_scroll_left;
+ var boundup = sc_wrapper.width(),
+ bounddown = 0,
+ placeup = el_position.left + el_width - sc_scroll_left,
+ placedown = el_position.left - sc_scroll_left;
- if(placeup <= boundup && placedown >= bounddown)
- return true;
- return false;
+ if(placeup <= boundup && placedown >= bounddown)
+ return true;
+ return false;
}
function adjust_visibility(el)
{
- if(is_viewable(el))
- return;
+ if(is_viewable(el))
+ return;
- var sc_wrapper = $('#sc_wrapper');
- var el_parent = $(el).parent();
+ var sc_wrapper = $('#sc_wrapper');
+ var el_parent = $(el).parent();
- var sc_left = el_parent.position().left + el_parent.outerWidth() / 2 - sc_wrapper.width() / 2;
+ var sc_left = el_parent.position().left + el_parent.outerWidth() / 2 - sc_wrapper.width() / 2;
- sc_wrapper.stop().animate({'scrollLeft':sc_left});
+ sc_wrapper.stop().animate({'scrollLeft':sc_left});
}
function slideshow(boolean_value)
{
- if(boolean_value == $(document).data('slideshow'))
- return;
+ if(boolean_value == $(document).data('slideshow'))
+ return;
- if(!boolean_value && $(document).data('slideshow_ctime'))
- {
- clearTimeout($(document).data('slideshow_ctime'));
- $(document).data('slideshow_ctime', false);
- }
+ if(!boolean_value && $(document).data('slideshow_ctime'))
+ {
+ clearTimeout($(document).data('slideshow_ctime'));
+ $(document).data('slideshow_ctime', false);
+ }
- $(document).data('slideshow', boolean_value);
+ $(document).data('slideshow', boolean_value);
- var headers = $('#record_wrapper .header');
+ var headers = $('#record_wrapper .header');
- if(boolean_value)
- {
- $('.play_button, .next_button.play, .previous_button.play').hide();
- $('.pause_button, .next_button.pause, .previous_button.pause').show();
- get_next();
- }
- else
- {
- $('.pause_button, .next_button.pause, .previous_button.pause').hide();
- $('.play_button, .next_button.play, .previous_button.play').show();
- }
+ if(boolean_value)
+ {
+ $('.play_button, .next_button.play, .previous_button.play').hide();
+ $('.pause_button, .next_button.pause, .previous_button.pause').show();
+ get_next();
+ }
+ else
+ {
+ $('.pause_button, .next_button.pause, .previous_button.pause').hide();
+ $('.play_button, .next_button.play, .previous_button.play').show();
+ }
}
function smooth_transform(box, width, height, callback)
{
- if(typeof callback == 'undefined')
- callback = function(){};
+ if(typeof callback == 'undefined')
+ callback = function(){};
- $(box).stop()
- .css(
- {
- width : width,
- height : height
- }
+ $(box).stop()
+ .css(
+ {
+ width : width,
+ height : height
+ }
// ,
// 500,
// callback
- );
- callback();
+ );
+ callback();
}
function save_note(container, button)
{
- var sselcont_id = $(button).attr('id').split('_').pop();
- var note = $('.notes_wrapper textarea', container).val();
+ var sselcont_id = $(button).attr('id').split('_').pop();
+ var note = $('.notes_wrapper textarea', container).val();
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_NOTE/"+sselcont_id+"/",
- dataType: 'json',
- data: {
- note : note
- },
- success: function(datas){
- hide_notes(container);
- $('.notes_wrapper', container).remove();
- $('.lightbox_container', container).append(datas.datas);
- activate_notes(container);
- return;
- }
- });
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_NOTE/"+sselcont_id+"/",
+ dataType: 'json',
+ data: {
+ note : note
+ },
+ success: function(datas){
+ hide_notes(container);
+ $('.notes_wrapper', container).remove();
+ $('.lightbox_container', container).append(datas.datas);
+ activate_notes(container);
+ return;
+ }
+ });
}
function calculate_display(display_width, display_height, width, height, margin)
{
- if(typeof margin == 'undefined')
- margin = 10;
+ if(typeof margin == 'undefined')
+ margin = 10;
- var display_ratio = display_width / display_height;
- var ratio = width / height;
- var w,h;
+ var display_ratio = display_width / display_height;
+ var ratio = width / height;
+ var w,h;
- if(ratio > display_ratio)//landscape
- {
- w = display_width - 2 * margin;
- if(w > width)
- w = width;
- h = w / ratio;
- }
- else
- {
- h = display_height - 2 * margin;
- if(h > height)
- h = height;
- w = ratio * h;
- }
+ if(ratio > display_ratio)//landscape
+ {
+ w = display_width - 2 * margin;
+ if(w > width)
+ w = width;
+ h = w / ratio;
+ }
+ else
+ {
+ h = display_height - 2 * margin;
+ if(h > height)
+ h = height;
+ w = ratio * h;
+ }
- return {width:w,height:h};
+ return {width:w,height:h};
}
function set_image_position(smooth, image, width, height, container, callback)
{
- var dimensions = {};
+ var dimensions = {};
- if(typeof container !== 'undefined')
- {
- var c_width = container.width;
- var c_height = container.height;
+ if(typeof container !== 'undefined')
+ {
+ var c_width = container.width;
+ var c_height = container.height;
- dimensions.top = parseInt((c_height - height) / 2);
- dimensions.left = parseInt((c_width - width) / 2);
- }
- if(typeof callback == 'undefined')
- {
- callback = function(){};
- }
+ dimensions.top = parseInt((c_height - height) / 2);
+ dimensions.left = parseInt((c_width - width) / 2);
}
+ if(typeof callback == 'undefined')
+ {
+ callback = function(){};
+ }
+}
- dimensions.width = parseInt(width);
- dimensions.height = parseInt(height);
+dimensions.width = parseInt(width);
+dimensions.height = parseInt(height);
// if(smooth)
// {
// $(image).stop().animate(dimensions,500,callback);
// }
// else
// {
- $(image).css(dimensions);
- callback;
+$(image).css(dimensions);
+callback;
// }
}
function scid_click(event, el)
{
- var compare = is_ctrl_key(event);
+ var compare = is_ctrl_key(event);
- if(compare)
- {
- if($('.basket_element', el).hasClass('selected'))
- return;
- }
- else
- {
- $('#sc_container .basket_element.selected').removeClass('selected');
- $('.basket_element', el).addClass('selected');
- }
+ if(compare)
+ {
+ if($('.basket_element', el).hasClass('selected'))
+ return;
+ }
+ else
+ {
+ $('#sc_container .basket_element.selected').removeClass('selected');
+ $('.basket_element', el).addClass('selected');
+ }
- var sselcont_id = $('.basket_element', el).attr('id').split('_').pop();
- var ssel_id = $('#navigation').val();
+ var sselcont_id = $('.basket_element', el).attr('id').split('_').pop();
+ var ssel_id = $('#navigation').val();
- var container = $('#sc_container');
+ var container = $('#sc_container');
- var request = container.data('request');
- if(request && typeof(request.abort) == 'function')
- {
- request.abort();
- }
+ var request = container.data('request');
+ if(request && typeof(request.abort) == 'function')
+ {
+ request.abort();
+ }
- request = $.ajax({
- type: "GET",
- url: $(el).attr('href'),//"/lightbox/ajax/LOAD_BASKET_ELEMENT/"+sselcont_id+'/',
- dataType: 'json',
- success: function(data){
- var container = false;
+ request = $.ajax({
+ type: "GET",
+ url: $(el).attr('href'),//"/lightbox/ajax/LOAD_BASKET_ELEMENT/"+sselcont_id+'/',
+ dataType: 'json',
+ success: function(data){
+ var container = false;
- if(compare)
- {
- container = $('#record_compare');
- }
- else
- {
- container = $('#record_main');
+ if(compare)
+ {
+ container = $('#record_compare');
+ }
+ else
+ {
+ container = $('#record_main');
- $('#record_infos .lightbox_container')
- .empty()
- .append(data.caption);
+ $('#record_infos .lightbox_container')
+ .empty()
+ .append(data.caption);
- $('#basket_infos')
- .empty()
- .append(data.agreement_html);
- }
+ $('#basket_infos')
+ .empty()
+ .append(data.agreement_html);
+ }
- $('.display_id',container)
- .empty()
- .append(data.number);
+ $('.display_id',container)
+ .empty()
+ .append(data.number);
- $('.title',container)
- .empty()
- .append(data.title)
- .attr('title', data.title);
+ $('.title',container)
+ .empty()
+ .append(data.title)
+ .attr('title', data.title);
- var options_container = $('.options',container);
- options_container
- .empty()
- .append(data.options_html);
+ var options_container = $('.options',container);
+ options_container
+ .empty()
+ .append(data.options_html);
- $('.lightbox_container', container).empty()
- .append(data.preview+data.selector_html+data.note_html);
+ $('.lightbox_container', container).empty()
+ .append(data.preview+data.selector_html+data.note_html);
- display_basket_element(compare, sselcont_id);
+ display_basket_element(compare, sselcont_id);
- return;
- }
- });
- container.data('request', request);
+ return;
+ }
+ });
+ container.data('request', request);
}
function download_basket()
{
- var ids = $.map($('#sc_container .download_form').toArray(), function(el, i){
- return $('input[name="basrec"]',$(el)).val();
- });
- download(ids.join(';'));
+ var ids = $.map($('#sc_container .download_form').toArray(), function(el, i){
+ return $('input[name="basrec"]',$(el)).val();
+ });
+ download(ids.join(';'));
}
function is_ctrl_key(event)
{
- if(event.altKey)
- return true;
- if(event.ctrlKey)
- return true;
- if(event.metaKey) // apple key opera
- return true;
- if(event.keyCode == '17') // apple key opera
- return true;
- if(event.keyCode == '224') // apple key mozilla
- return true;
- if(event.keyCode == '91') // apple key safari
- return true;
+ if(event.altKey)
+ return true;
+ if(event.ctrlKey)
+ return true;
+ if(event.metaKey) // apple key opera
+ return true;
+ if(event.keyCode == '17') // apple key opera
+ return true;
+ if(event.keyCode == '224') // apple key mozilla
+ return true;
+ if(event.keyCode == '91') // apple key safari
+ return true;
- return false;
+ return false;
}
function is_shift_key(event)
{
- if(event.shiftKey)
- return true;
- return false;
+ if(event.shiftKey)
+ return true;
+ return false;
}
diff --git a/www/skins/lightbox/jquery.lightbox.js b/www/skins/lightbox/jquery.lightbox.js
index 2c655e4a11..0753ca8bcd 100644
--- a/www/skins/lightbox/jquery.lightbox.js
+++ b/www/skins/lightbox/jquery.lightbox.js
@@ -9,1044 +9,1044 @@ var bodySize = {
$(document).ready(function(){
- bodySize.y = $('#mainContainer').height();
- bodySize.x = $('#mainContainer').width();
+ bodySize.y = $('#mainContainer').height();
+ bodySize.x = $('#mainContainer').width();
- $(this).data('slideshow',false);
- $(this).data('slideshow_ctime', false);
+ $(this).data('slideshow',false);
+ $(this).data('slideshow_ctime', false);
- $('#mainMenu, .unselectable').disableSelection();
+ $('#mainMenu, .unselectable').disableSelection();
- display_basket();
+ display_basket();
- $(window).bind('mousedown', function(){
- $(this).focus();
- }).trigger('mousedown');
+ $(window).bind('mousedown', function(){
+ $(this).focus();
+ }).trigger('mousedown');
- $('.basket_wrapper').hover(
- function(){
- $(this).addClass('hover');
- },
- function(){
- $(this).removeClass('hover');
- }
+ $('.basket_wrapper').hover(
+ function(){
+ $(this).addClass('hover');
+ },
+ function(){
+ $(this).removeClass('hover');
+ }
).bind('click', function(){
- var id = $('input[name=ssel_id]',this).val();
- document.location = '/lightbox/validate/'+id+'/';
- return;
- });
- $('.basket_downloader').bind('click', function(){
- download_basket();
- });
- if($('.right_column_wrapper_user').length > 0)
- {
- $('.right_column_title, #right_column_validation_toggle').bind('click', function(){
- if(!$('.right_column_wrapper_caption').is(':visible'))
- {
- $('.right_column_wrapper_user').height($('.right_column_wrapper_user').height()).css('top','auto').animate({
- 'height':0
+ var id = $('input[name=ssel_id]',this).val();
+ document.location = '/lightbox/validate/'+id+'/';
+ return;
});
- $('.right_column_wrapper_caption').slideDown();
- $('#right_column_validation_toggle').show();
- }
- else
- {
- $('.right_column_wrapper_user').height('auto').animate({
- 'top':$('.right_column_title').height()
- });
- $('.right_column_wrapper_caption').slideUp();
- $('#right_column_validation_toggle').hide();
- }
- var title = $('.right_column_title');
- title.hasClass('expanded') ? title.removeClass('expanded') : title.addClass('expanded');
- }).addClass('clickable');
- }
- var sselcont = $('#sc_container .basket_element:first');
- if(sselcont.length > 0)
- {
- display_basket_element(false, sselcont.attr('id').split('_').pop());
- }
-
-
- set_sizeable($('#record_main .lightbox_container, #record_compare .lightbox_container'));
-
- $('#navigation')
- .bind('change',
- function()
+ $('.basket_downloader').bind('click', function(){
+ download_basket();
+ });
+ if($('.right_column_wrapper_user').length > 0)
{
- window.location.replace(window.location.protocol+"//"+window.location.host+'/lightbox/validate/'+$(this).val()+'/');
+ $('.right_column_title, #right_column_validation_toggle').bind('click', function(){
+ if(!$('.right_column_wrapper_caption').is(':visible'))
+ {
+ $('.right_column_wrapper_user').height($('.right_column_wrapper_user').height()).css('top','auto').animate({
+ 'height':0
+ });
+ $('.right_column_wrapper_caption').slideDown();
+ $('#right_column_validation_toggle').show();
+ }
+ else
+ {
+ $('.right_column_wrapper_user').height('auto').animate({
+ 'top':$('.right_column_title').height()
+ });
+ $('.right_column_wrapper_caption').slideUp();
+ $('#right_column_validation_toggle').hide();
+ }
+ var title = $('.right_column_title');
+ title.hasClass('expanded') ? title.removeClass('expanded') : title.addClass('expanded');
+ }).addClass('clickable');
}
+ var sselcont = $('#sc_container .basket_element:first');
+ if(sselcont.length > 0)
+ {
+ display_basket_element(false, sselcont.attr('id').split('_').pop());
+ }
+
+
+ set_sizeable($('#record_main .lightbox_container, #record_compare .lightbox_container'));
+
+ $('#navigation')
+ .bind('change',
+ function()
+ {
+ window.location.replace(window.location.protocol+"//"+window.location.host+'/lightbox/validate/'+$(this).val()+'/');
+ }
);
- $('#left_scroller')
- .bind('click',
- function()
- {
- scroll_elements(false);
- }
+ $('#left_scroller')
+ .bind('click',
+ function()
+ {
+ scroll_elements(false);
+ }
);
- $('#right_scroller')
- .bind('click', function()
- {
- scroll_elements(true);
- }
- );
+ $('#right_scroller')
+ .bind('click', function()
+ {
+ scroll_elements(true);
+ }
+ );
- $(window)
- .bind('resize',function()
- {
- resize();
- }
- );
- bind_keyboard();
+ $(window)
+ .bind('resize',function()
+ {
+ resize();
+ }
+ );
+ bind_keyboard();
});
$(window).bind('beforeunload', function(){
- if(p4.releasable !== false)
- {
- if(confirm(p4.releasable))
+ if(p4.releasable !== false)
{
- $('#basket_options .confirm_report').trigger('click');
+ if(confirm(p4.releasable))
+ {
+ $('#basket_options .confirm_report').trigger('click');
+ }
}
- }
});
function bind_keyboard()
{
- $(document).bind('keydown', function(event){
+ $(document).bind('keydown', function(event){
- var stop = false;
- $('.notes_wrapper').each(function(i,n){
- if(parseInt($(n).css('top')) >= 0)
- stop = true;
+ var stop = false;
+ $('.notes_wrapper').each(function(i,n){
+ if(parseInt($(n).css('top')) >= 0)
+ stop = true;
+ });
+
+ if(stop)
+ return true;
+
+ var cancelKey = false;
+ var el, id;
+ switch(event.keyCode)
+ {
+ case 39:
+ get_next();
+ cancelKey = true;
+ break;
+ case 37:
+ get_prev();
+ cancelKey = true;
+ break;
+ case 32:
+ var bool = !$(document).data('slideshow');
+ slideshow(bool);
+ break;
+ case 38:
+ el = $('#sc_container .basket_element.selected');
+ if(el.length === 1)
+ {
+ id = el.attr('id').split('_').pop();
+ set_agreement(event, el, id, 1);
+ }
+ break;
+ case 40:
+ el = $('#sc_container .basket_element.selected');
+ if(el.length === 1)
+ {
+ id = el.attr('id').split('_').pop();
+ set_agreement(event, el, id, -1);
+ }
+ break;
+ default:
+ break;
+ }
+
+ if(cancelKey)
+ {
+ event.cancelBubble = true;
+ if(event.stopPropagation)
+ event.stopPropagation();
+ return(false);
+ }
+ return true;
});
-
- if(stop)
- return true;
-
- var cancelKey = false;
- var el, id;
- switch(event.keyCode)
- {
- case 39:
- get_next();
- cancelKey = true;
- break;
- case 37:
- get_prev();
- cancelKey = true;
- break;
- case 32:
- var bool = !$(document).data('slideshow');
- slideshow(bool);
- break;
- case 38:
- el = $('#sc_container .basket_element.selected');
- if(el.length === 1)
- {
- id = el.attr('id').split('_').pop();
- set_agreement(event, el, id, 1);
- }
- break;
- case 40:
- el = $('#sc_container .basket_element.selected');
- if(el.length === 1)
- {
- id = el.attr('id').split('_').pop();
- set_agreement(event, el, id, -1);
- }
- break;
- default:
- break;
- }
-
- if(cancelKey)
- {
- event.cancelBubble = true;
- if(event.stopPropagation)
- event.stopPropagation();
- return(false);
- }
- return true;
- });
}
function is_ctrl_key(event)
{
- if(event.altKey)
- return true;
- if(event.ctrlKey)
- return true;
- if(event.metaKey) // apple key opera
- return true;
- if(event.keyCode == '17') // apple key opera
- return true;
- if(event.keyCode == '224') // apple key mozilla
- return true;
- if(event.keyCode == '91') // apple key safari
- return true;
+ if(event.altKey)
+ return true;
+ if(event.ctrlKey)
+ return true;
+ if(event.metaKey) // apple key opera
+ return true;
+ if(event.keyCode == '17') // apple key opera
+ return true;
+ if(event.keyCode == '224') // apple key mozilla
+ return true;
+ if(event.keyCode == '91') // apple key safari
+ return true;
- return false;
+ return false;
}
function is_shift_key(event)
{
- if(event.shiftKey)
- return true;
- return false;
+ if(event.shiftKey)
+ return true;
+ return false;
}
function resize()
{
- bodySize.y = $('#mainContainer').height();
- bodySize.x = $('#mainContainer').width();
- display_record($('#record_compare').css('visibility') != 'hidden');
+ bodySize.y = $('#mainContainer').height();
+ bodySize.x = $('#mainContainer').width();
+ display_record($('#record_compare').css('visibility') != 'hidden');
}
function set_release(el)
{
- $('.loader', el).css({
- visibility:'visible'
- });
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_RELEASE/"+$('#navigation').val()+"/",
- dataType: 'json',
- error: function(data){
- $('.loader', el).css({
- visibility:'hidden'
- });
- },
- timeout: function(data){
- $('.loader', el).css({
- visibility:'hidden'
- });
- },
- success: function(data){
- $('.loader', el).css({
- visibility:'hidden'
- });
- if(data.datas)
- {
- alert(data.datas);
- }
- if(!data.error)
- {
- p4.releasable = false;
- }
+ $('.loader', el).css({
+ visibility:'visible'
+ });
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_RELEASE/"+$('#navigation').val()+"/",
+ dataType: 'json',
+ error: function(data){
+ $('.loader', el).css({
+ visibility:'hidden'
+ });
+ },
+ timeout: function(data){
+ $('.loader', el).css({
+ visibility:'hidden'
+ });
+ },
+ success: function(data){
+ $('.loader', el).css({
+ visibility:'hidden'
+ });
+ if(data.datas)
+ {
+ alert(data.datas);
+ }
+ if(!data.error)
+ {
+ p4.releasable = false;
+ }
- return;
- }
- });
+ return;
+ }
+ });
}
function load_report()
{
- $.ajax({
- type: "GET",
- url: "/lightbox/ajax/LOAD_REPORT/"+$('#navigation').val()+"/",
- dataType: 'html',
- success: function(data){
- $('#report').empty().append(data);
- $('#report .reportTips').tooltip({
- delay:false
- });
- $('#report').dialog({
- width : 600,
- modal:true,
- resizable:false,
- height : Math.round($(window).height() * 0.8)
- });
+ $.ajax({
+ type: "GET",
+ url: "/lightbox/ajax/LOAD_REPORT/"+$('#navigation').val()+"/",
+ dataType: 'html',
+ success: function(data){
+ $('#report').empty().append(data);
+ $('#report .reportTips').tooltip({
+ delay:false
+ });
+ $('#report').dialog({
+ width : 600,
+ modal:true,
+ resizable:false,
+ height : Math.round($(window).height() * 0.8)
+ });
- return;
- }
- });
+ return;
+ }
+ });
}
function display_basket()
{
- var sc_wrapper = $('#sc_wrapper');
- var basket_options = $('#basket_options');
+ var sc_wrapper = $('#sc_wrapper');
+ var basket_options = $('#basket_options');
- $('.report').live('click', function(){
- load_report();
- return false;
- }).addClass('clickable');
- // $('#basket_infos .report').button({
- // icons: {
- // primary: 'ui-icon-document'
- // }
- // }).bind('click',function(){
- // $(this).blur();
- // });
- $('.confirm_report', basket_options).button()
- .bind('click',function(){
- set_release($(this));
- });
+ $('.report').live('click', function(){
+ load_report();
+ return false;
+ }).addClass('clickable');
+ // $('#basket_infos .report').button({
+ // icons: {
+ // primary: 'ui-icon-document'
+ // }
+ // }).bind('click',function(){
+ // $(this).blur();
+ // });
+ $('.confirm_report', basket_options).button()
+ .bind('click',function(){
+ set_release($(this));
+ });
- $('.basket_element',sc_wrapper).parent()
- .bind('click',function(event){
- scid_click(event, this);
- return false;
- });
+ $('.basket_element',sc_wrapper).parent()
+ .bind('click',function(event){
+ scid_click(event, this);
+ return false;
+ });
- $('.agree_button, .disagree_button',sc_wrapper).bind('click',function(event){
+ $('.agree_button, .disagree_button',sc_wrapper).bind('click',function(event){
- var sselcont_id = $(this).closest('.basket_element').attr('id').split('_').pop();
+ var sselcont_id = $(this).closest('.basket_element').attr('id').split('_').pop();
- var agreement = $(this).hasClass('agree_button') ? '1' : '-1';
+ var agreement = $(this).hasClass('agree_button') ? '1' : '-1';
- set_agreement(event, $(this), sselcont_id, agreement);
- return false;
- }).addClass('clickable');
+ set_agreement(event, $(this), sselcont_id, agreement);
+ return false;
+ }).addClass('clickable');
- n = $('.basket_element',sc_wrapper).length;
- $('#sc_container').width(n * $('.basket_element_wrapper:first',sc_wrapper).outerWidth() + 1);
+ n = $('.basket_element',sc_wrapper).length;
+ $('#sc_container').width(n * $('.basket_element_wrapper:first',sc_wrapper).outerWidth() + 1);
- $('.previewTips').tooltip();
+ $('.previewTips').tooltip();
}
function scid_click(event, el)
{
- var compare = is_ctrl_key(event);
+ var compare = is_ctrl_key(event);
- if(compare)
- {
- if($('.basket_element', el).hasClass('selected'))
- return;
- }
- else
- {
- $('#sc_container .basket_element.selected').removeClass('selected');
- $('.basket_element', el).addClass('selected');
- }
-
- var sselcont_id = $('.basket_element', el).attr('id').split('_').pop();
- var ssel_id = $('#navigation').val();
-
- var container = $('#sc_container');
-
- var request = container.data('request');
- if(request && typeof(request.abort) == 'function')
- {
- request.abort();
- }
-
- request = $.ajax({
- type: "GET",
- url: $(el).attr('href'),//"/lightbox/ajax/LOAD_BASKET_ELEMENT/"+sselcont_id+'/',
- dataType: 'json',
- success: function(datas){
- var container = false;
- var data = datas;
-
- if(compare)
- {
- container = $('#record_compare');
- }
- else
- {
- container = $('#record_main');
-
- $('#record_infos .lightbox_container')
- .empty()
- .append(data.caption);
-
- $('#basket_infos')
- .empty()
- .append(data.agreement_html);
- }
-
- $('.display_id',container)
- .empty()
- .append(data.number);
-
- $('.title',container)
- .empty()
- .append(data.title)
- .attr('title', data.title);
-
- var options_container = $('.options',container);
- options_container
- .empty()
- .append(data.options_html);
-
- $('.lightbox_container', container).empty()
- .append(data.preview+data.selector_html+data.note_html);
-
-
- display_basket_element(compare, sselcont_id);
-
-
- return;
+ if(compare)
+ {
+ if($('.basket_element', el).hasClass('selected'))
+ return;
}
- });
- container.data('request', request);
+ else
+ {
+ $('#sc_container .basket_element.selected').removeClass('selected');
+ $('.basket_element', el).addClass('selected');
+ }
+
+ var sselcont_id = $('.basket_element', el).attr('id').split('_').pop();
+ var ssel_id = $('#navigation').val();
+
+ var container = $('#sc_container');
+
+ var request = container.data('request');
+ if(request && typeof(request.abort) == 'function')
+ {
+ request.abort();
+ }
+
+ request = $.ajax({
+ type: "GET",
+ url: $(el).attr('href'),//"/lightbox/ajax/LOAD_BASKET_ELEMENT/"+sselcont_id+'/',
+ dataType: 'json',
+ success: function(datas){
+ var container = false;
+ var data = datas;
+
+ if(compare)
+ {
+ container = $('#record_compare');
+ }
+ else
+ {
+ container = $('#record_main');
+
+ $('#record_infos .lightbox_container')
+ .empty()
+ .append(data.caption);
+
+ $('#basket_infos')
+ .empty()
+ .append(data.agreement_html);
+ }
+
+ $('.display_id',container)
+ .empty()
+ .append(data.number);
+
+ $('.title',container)
+ .empty()
+ .append(data.title)
+ .attr('title', data.title);
+
+ var options_container = $('.options',container);
+ options_container
+ .empty()
+ .append(data.options_html);
+
+ $('.lightbox_container', container).empty()
+ .append(data.preview+data.selector_html+data.note_html);
+
+
+ display_basket_element(compare, sselcont_id);
+
+
+ return;
+ }
+ });
+ container.data('request', request);
}
function save_note(container, button)
{
- var sselcont_id = $(button).attr('id').split('_').pop();
- var note = $('.notes_wrapper textarea', container).val();
+ var sselcont_id = $(button).attr('id').split('_').pop();
+ var note = $('.notes_wrapper textarea', container).val();
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_NOTE/"+sselcont_id+"/",
- dataType: 'json',
- data: {
- note : note
- },
- success: function(datas){
- hide_notes(container);
- $('.notes_wrapper', container).remove();
- $('.lightbox_container', container).append(datas.datas);
- activate_notes(container);
- return;
- }
- });
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_NOTE/"+sselcont_id+"/",
+ dataType: 'json',
+ data: {
+ note : note
+ },
+ success: function(datas){
+ hide_notes(container);
+ $('.notes_wrapper', container).remove();
+ $('.lightbox_container', container).append(datas.datas);
+ activate_notes(container);
+ return;
+ }
+ });
}
function display_basket_element(compare, sselcont_id)
{
- var container;
- if(compare)
- {
- container = $('#record_compare');
- }
- else
- {
- container = $('#record_main');
- }
- $('.record_image', container).removeAttr('ondragstart');
- $('.record_image', container).draggable();
-
- var options_container = $('.options',container);
-
- $('.download_button', options_container).bind('click',function(){
- // $(this).blur();
- download($(this).next('form[name=download_form]').find('input').val());
- });
-
- $('.comment_button', options_container).bind('click',function()
- {
- // $(this).blur();
- if($('.lightbox_container', container).hasClass('note_editing'))
- {
- hide_notes(container);
- }
- else
- {
- show_notes(container);
- }
- }
- );
-
- activate_notes(container);
-
- $('.previous_button', options_container).bind('click',function(){
- // $(this).blur();
- get_prev();
- });
-
- $('.play_button', options_container).bind('click',function(){
- // $(this).blur();
- slideshow(true);
- });
-
- $('.pause_button', options_container).bind('click',function(){
- // $(this).blur();
- slideshow(false);
- });
-
- if($(document).data('slideshow'))
- {
- $('.play_button, .next_button.play, .previous_button.play', options_container).hide();
- }
- else
- {
- $('.pause_button, .next_button.pause, .previous_button.pause', options_container).hide();
- }
-
- $('.next_button', options_container).bind('click',function(){
- // $(this).blur();
- slideshow(false);
- get_next();
- });
-
-
- $('.lightbox_container', container).bind('dblclick',function(event){
- display_record();
- });
-
-
- $('#record_wrapper .agree_'+sselcont_id+', .big_box.agree')
- .bind('click',
- function(event)
- {
- set_agreement(event, $(this), sselcont_id, '1');
- }
- )
- .addClass('clickable');
-
- $('#record_wrapper .disagree_'+sselcont_id+', .big_box.disagree')
- .bind('click',
- function(event)
- {
- set_agreement(event, $(this), sselcont_id, '-1');
- }
- )
- .addClass('clickable');
-
- if(compare == $('#record_wrapper').hasClass('single'))
- {
+ var container;
if(compare)
{
- // $('.agreement_selector').show();
- // $('#record_wrapper').stop().animate({right:0},100,function(){display_record(compare);});
- $('#record_wrapper').css({
- right:0
- });
- display_record(compare);
- $('#right_column').hide();
+ container = $('#record_compare');
}
else
{
- // $('.agreement_selector').hide();
- $('#record_wrapper').css({
- right:250
- });
- display_record(compare);
- $('#right_column').show();
- $('#record_compare .lightbox_container').empty();
+ container = $('#record_main');
+ }
+ $('.record_image', container).removeAttr('ondragstart');
+ $('.record_image', container).draggable();
+
+ var options_container = $('.options',container);
+
+ $('.download_button', options_container).bind('click',function(){
+ // $(this).blur();
+ download($(this).next('form[name=download_form]').find('input').val());
+ });
+
+ $('.comment_button', options_container).bind('click',function()
+ {
+ // $(this).blur();
+ if($('.lightbox_container', container).hasClass('note_editing'))
+ {
+ hide_notes(container);
+ }
+ else
+ {
+ show_notes(container);
+ }
+ }
+ );
+
+ activate_notes(container);
+
+ $('.previous_button', options_container).bind('click',function(){
+ // $(this).blur();
+ get_prev();
+ });
+
+ $('.play_button', options_container).bind('click',function(){
+ // $(this).blur();
+ slideshow(true);
+ });
+
+ $('.pause_button', options_container).bind('click',function(){
+ // $(this).blur();
+ slideshow(false);
+ });
+
+ if($(document).data('slideshow'))
+ {
+ $('.play_button, .next_button.play, .previous_button.play', options_container).hide();
+ }
+ else
+ {
+ $('.pause_button, .next_button.pause, .previous_button.pause', options_container).hide();
}
- }
- else
- {
- display_record(compare);
- }
+ $('.next_button', options_container).bind('click',function(){
+ // $(this).blur();
+ slideshow(false);
+ get_next();
+ });
+
+
+ $('.lightbox_container', container).bind('dblclick',function(event){
+ display_record();
+ });
+
+
+ $('#record_wrapper .agree_'+sselcont_id+', .big_box.agree')
+ .bind('click',
+ function(event)
+ {
+ set_agreement(event, $(this), sselcont_id, '1');
+ }
+ )
+ .addClass('clickable');
+
+ $('#record_wrapper .disagree_'+sselcont_id+', .big_box.disagree')
+ .bind('click',
+ function(event)
+ {
+ set_agreement(event, $(this), sselcont_id, '-1');
+ }
+ )
+ .addClass('clickable');
+
+ if(compare == $('#record_wrapper').hasClass('single'))
+ {
+ if(compare)
+ {
+ // $('.agreement_selector').show();
+ // $('#record_wrapper').stop().animate({right:0},100,function(){display_record(compare);});
+ $('#record_wrapper').css({
+ right:0
+ });
+ display_record(compare);
+ $('#right_column').hide();
+ }
+ else
+ {
+ // $('.agreement_selector').hide();
+ $('#record_wrapper').css({
+ right:250
+ });
+ display_record(compare);
+ $('#right_column').show();
+ $('#record_compare .lightbox_container').empty();
+ }
+
+ }
+ else
+ {
+ display_record(compare);
+ }
}
function show_notes(container)
{
- $('.notes_wrapper', container).animate({
- top:0
- });
- $('.lightbox_container', container).addClass('note_editing');
+ $('.notes_wrapper', container).animate({
+ top:0
+ });
+ $('.lightbox_container', container).addClass('note_editing');
}
function hide_notes(container)
{
- $('.notes_wrapper', container).animate({
- top:'-100%'
- });
- $('.lightbox_container', container).removeClass('note_editing');
+ $('.notes_wrapper', container).animate({
+ top:'-100%'
+ });
+ $('.lightbox_container', container).removeClass('note_editing');
}
function activate_notes(container)
{
- $('.note_closer', container).button({
- text : true
- }).bind('click',function()
- {
- $(this).blur();
- hide_notes(container);
- return false;
- }
- );
+ $('.note_closer', container).button({
+ text : true
+ }).bind('click',function()
+ {
+ $(this).blur();
+ hide_notes(container);
+ return false;
+ }
+ );
- $('.note_saver', container).button({
- text : true
- }).bind('click',function()
- {
- $(this).blur();
- save_note(container, this);
- return false;
- }
- );
+ $('.note_saver', container).button({
+ text : true
+ }).bind('click',function()
+ {
+ $(this).blur();
+ save_note(container, this);
+ return false;
+ }
+ );
}
function is_viewable(el)
{
- var sc_wrapper = $('#sc_wrapper');
- var sc_container = $('#sc_container');
+ var sc_wrapper = $('#sc_wrapper');
+ var sc_container = $('#sc_container');
- var el_width = $(el).parent().outerWidth();
- var el_position = $(el).parent().position();
- var sc_scroll_left = sc_wrapper.scrollLeft();
+ var el_width = $(el).parent().outerWidth();
+ var el_position = $(el).parent().position();
+ var sc_scroll_left = sc_wrapper.scrollLeft();
- var boundup = sc_wrapper.width(),
- bounddown = 0,
- placeup = el_position.left + el_width - sc_scroll_left,
- placedown = el_position.left - sc_scroll_left;
+ var boundup = sc_wrapper.width(),
+ bounddown = 0,
+ placeup = el_position.left + el_width - sc_scroll_left,
+ placedown = el_position.left - sc_scroll_left;
- if(placeup <= boundup && placedown >= bounddown)
- return true;
- return false;
+ if(placeup <= boundup && placedown >= bounddown)
+ return true;
+ return false;
}
function adjust_visibility(el)
{
- if(is_viewable(el))
- return;
+ if(is_viewable(el))
+ return;
- var sc_wrapper = $('#sc_wrapper');
- var el_parent = $(el).parent();
+ var sc_wrapper = $('#sc_wrapper');
+ var el_parent = $(el).parent();
- var sc_left = el_parent.position().left + el_parent.outerWidth() / 2 - sc_wrapper.width() / 2;
+ var sc_left = el_parent.position().left + el_parent.outerWidth() / 2 - sc_wrapper.width() / 2;
- sc_wrapper.stop().animate({
- 'scrollLeft':sc_left
- });
+ sc_wrapper.stop().animate({
+ 'scrollLeft':sc_left
+ });
}
function get_next()
{
- var current_wrapper = $('#sc_container .basket_element.selected').parent().parent();
+ var current_wrapper = $('#sc_container .basket_element.selected').parent().parent();
- if(current_wrapper.length === 0)
- return;
+ if(current_wrapper.length === 0)
+ return;
- current_wrapper = current_wrapper.next();
- if(current_wrapper.length === 0)
- current_wrapper = $('#sc_container .basket_element_wrapper:first');
+ current_wrapper = current_wrapper.next();
+ if(current_wrapper.length === 0)
+ current_wrapper = $('#sc_container .basket_element_wrapper:first');
- $('.basket_element', current_wrapper).parent().trigger('click');
+ $('.basket_element', current_wrapper).parent().trigger('click');
- adjust_visibility($('.basket_element', current_wrapper));
+ adjust_visibility($('.basket_element', current_wrapper));
- if($(document).data('slideshow'))
- {
- var timer = setTimeout('get_next();', 3500);
- $(document).data('slideshow_ctime', timer);
- }
+ if($(document).data('slideshow'))
+ {
+ var timer = setTimeout('get_next();', 3500);
+ $(document).data('slideshow_ctime', timer);
+ }
}
function get_prev()
{
- var current_wrapper = $('#sc_container .basket_element.selected').parent().parent();
+ var current_wrapper = $('#sc_container .basket_element.selected').parent().parent();
- if(current_wrapper.length === 0)
- return;
+ if(current_wrapper.length === 0)
+ return;
- slideshow(false);
+ slideshow(false);
- current_wrapper = current_wrapper.prev();
- if(current_wrapper.length === 0)
- current_wrapper = $('#sc_container .basket_element_wrapper:last');
+ current_wrapper = current_wrapper.prev();
+ if(current_wrapper.length === 0)
+ current_wrapper = $('#sc_container .basket_element_wrapper:last');
- $('.basket_element', current_wrapper).parent().trigger('click');
+ $('.basket_element', current_wrapper).parent().trigger('click');
- adjust_visibility($('.basket_element', current_wrapper));
+ adjust_visibility($('.basket_element', current_wrapper));
}
function slideshow(boolean_value)
{
- if(boolean_value == $(document).data('slideshow'))
- return;
+ if(boolean_value == $(document).data('slideshow'))
+ return;
- if(!boolean_value && $(document).data('slideshow_ctime'))
- {
- clearTimeout($(document).data('slideshow_ctime'));
- $(document).data('slideshow_ctime', false);
- }
+ if(!boolean_value && $(document).data('slideshow_ctime'))
+ {
+ clearTimeout($(document).data('slideshow_ctime'));
+ $(document).data('slideshow_ctime', false);
+ }
- $(document).data('slideshow', boolean_value);
+ $(document).data('slideshow', boolean_value);
- var headers = $('#record_wrapper .header');
+ var headers = $('#record_wrapper .header');
- if(boolean_value)
- {
- $('.play_button, .next_button.play, .previous_button.play', headers).hide();
- $('.pause_button, .next_button.pause, .previous_button.pause', headers).show();
- get_next();
- }
- else
- {
- $('.pause_button, .next_button.pause, .previous_button.pause', headers).hide();
- $('.play_button, .next_button.play, .previous_button.play', headers).show();
- }
+ if(boolean_value)
+ {
+ $('.play_button, .next_button.play, .previous_button.play', headers).hide();
+ $('.pause_button, .next_button.pause, .previous_button.pause', headers).show();
+ get_next();
+ }
+ else
+ {
+ $('.pause_button, .next_button.pause, .previous_button.pause', headers).hide();
+ $('.play_button, .next_button.play, .previous_button.play', headers).show();
+ }
}
function set_sizeable(container)
{
- $(container).bind('mousewheel',function(event,delta){
+ $(container).bind('mousewheel',function(event,delta){
- if($(this).hasClass('note_editing'))
- return;
+ if($(this).hasClass('note_editing'))
+ return;
- var record = $('.record_image', this);
+ var record = $('.record_image', this);
- if(record.length === 0)
- return;
+ if(record.length === 0)
+ return;
- var o_top = parseInt(record.css('top'));
- var o_left = parseInt(record.css('left'));
+ var o_top = parseInt(record.css('top'));
+ var o_left = parseInt(record.css('left'));
- var o_width, o_height, width, height;
+ var o_width, o_height, width, height;
- if(delta > 0)
- {
- if (record.width() > 29788 || record.height() >= 29788)
- return;
- o_width = record.width();
- o_height = record.height();
- width = Math.round(o_width * 1.1);
- height = Math.round(o_height * 1.1);
- }
- else
- {
- if (record.width() < 30 || record.height() < 30)
- return;
- o_width = record.width();
- o_height = record.height();
- width = Math.round(o_width / 1.05);
- height = Math.round(o_height / 1.05);
- }
+ if(delta > 0)
+ {
+ if (record.width() > 29788 || record.height() >= 29788)
+ return;
+ o_width = record.width();
+ o_height = record.height();
+ width = Math.round(o_width * 1.1);
+ height = Math.round(o_height * 1.1);
+ }
+ else
+ {
+ if (record.width() < 30 || record.height() < 30)
+ return;
+ o_width = record.width();
+ o_height = record.height();
+ width = Math.round(o_width / 1.05);
+ height = Math.round(o_height / 1.05);
+ }
- var top = Math.round((height / o_height) * (o_top - $(this).height() / 2) + $(this).height() / 2);
- var left = Math.round((width / o_width) * (o_left - $(this).width() / 2) + $(this).width() / 2);
+ var top = Math.round((height / o_height) * (o_top - $(this).height() / 2) + $(this).height() / 2);
+ var left = Math.round((width / o_width) * (o_left - $(this).width() / 2) + $(this).width() / 2);
- record.width(width).height(height).css({
- top:top,
- left:left
+ record.width(width).height(height).css({
+ top:top,
+ left:left
+ });
});
- });
}
function set_agreement(event, el, sselcont_id, boolean_value)
{
- if(event.stopPropagation)
- event.stopPropagation();
- event.cancelBubble = true;
+ if(event.stopPropagation)
+ event.stopPropagation();
+ event.cancelBubble = true;
- var id =
+ var id =
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/"+sselcont_id+"/",
- dataType: 'json',
- data: {
- agreement : boolean_value
- },
- success: function(datas){
- if(!datas.error)
- {
- if(boolean_value == '1')
- {
- $('.agree_'+sselcont_id+'').removeClass('not_decided');
- $('.disagree_'+sselcont_id+'').addClass('not_decided');
- $('.userchoice.me').addClass('agree').removeClass('disagree');
- }
- else
- {
- $('.agree_'+sselcont_id+'').addClass('not_decided');
- $('.disagree_'+sselcont_id+'').removeClass('not_decided');
- $('.userchoice.me').addClass('disagree').removeClass('agree');
- }
- p4.releasable = datas.releasable;
- if(datas.releasable !== false)
- {
- if(confirm(datas.releasable))
- $('#basket_options .confirm_report').trigger('click');
- }
- }
- else
- {
- alert(datas.datas);
- }
- return;
- }
- });
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/"+sselcont_id+"/",
+ dataType: 'json',
+ data: {
+ agreement : boolean_value
+ },
+ success: function(datas){
+ if(!datas.error)
+ {
+ if(boolean_value == '1')
+ {
+ $('.agree_'+sselcont_id+'').removeClass('not_decided');
+ $('.disagree_'+sselcont_id+'').addClass('not_decided');
+ $('.userchoice.me').addClass('agree').removeClass('disagree');
+ }
+ else
+ {
+ $('.agree_'+sselcont_id+'').addClass('not_decided');
+ $('.disagree_'+sselcont_id+'').removeClass('not_decided');
+ $('.userchoice.me').addClass('disagree').removeClass('agree');
+ }
+ p4.releasable = datas.releasable;
+ if(datas.releasable !== false)
+ {
+ if(confirm(datas.releasable))
+ $('#basket_options .confirm_report').trigger('click');
+ }
+ }
+ else
+ {
+ alert(datas.datas);
+ }
+ return;
+ }
+ });
}
function calculate_display(display_width, display_height, width, height, margin)
{
- if(typeof margin == 'undefined')
- margin = 10;
+ if(typeof margin == 'undefined')
+ margin = 10;
- var display_ratio = display_width / display_height;
- var ratio = width / height;
- var w,h;
+ var display_ratio = display_width / display_height;
+ var ratio = width / height;
+ var w,h;
- if(ratio > display_ratio)//landscape
- {
- w = display_width - 2 * margin;
- if(w > width)
- w = width;
- h = w / ratio;
- }
- else
- {
- h = display_height - 2 * margin;
- if(h > height)
- h = height;
- w = ratio * h;
- }
+ if(ratio > display_ratio)//landscape
+ {
+ w = display_width - 2 * margin;
+ if(w > width)
+ w = width;
+ h = w / ratio;
+ }
+ else
+ {
+ h = display_height - 2 * margin;
+ if(h > height)
+ h = height;
+ w = ratio * h;
+ }
- return {
- width:w,
- height:h
- };
+ return {
+ width:w,
+ height:h
+ };
}
function display_record(compare)
{
- var main_container = $('#record_wrapper');
+ var main_container = $('#record_wrapper');
- if(typeof compare == 'undefined')
- compare = !main_container.hasClass('single');
+ if(typeof compare == 'undefined')
+ compare = !main_container.hasClass('single');
- var main_box = $('#record_main');
- var compare_box = $('#record_compare');
+ var main_box = $('#record_main');
+ var compare_box = $('#record_compare');
- var main_record = $('.lightbox_container .record', main_box);
- var compare_record = $('.lightbox_container .record', compare_box);
+ var main_record = $('.lightbox_container .record', main_box);
+ var compare_record = $('.lightbox_container .record', compare_box);
- var main_record_width = parseInt($('input[name=width]', main_box).val());
- var main_record_height = parseInt($('input[name=height]', main_box).val());
- var compare_record_width = parseInt($('input[name=width]', compare_box).val());
- var compare_record_height = parseInt($('input[name=height]', compare_box).val());
+ var main_record_width = parseInt($('input[name=width]', main_box).val());
+ var main_record_height = parseInt($('input[name=height]', main_box).val());
+ var compare_record_width = parseInt($('input[name=width]', compare_box).val());
+ var compare_record_height = parseInt($('input[name=height]', compare_box).val());
- var main_container_width = main_container.width();
- var main_container_innerwidth = main_container.innerWidth();
- var main_container_height = main_container.height();
- var main_container_innerheight = main_container.innerHeight();
+ var main_container_width = main_container.width();
+ var main_container_innerwidth = main_container.innerWidth();
+ var main_container_height = main_container.height();
+ var main_container_innerheight = main_container.innerHeight();
- if(compare)
- {
- $('.agreement_selector').show();
- main_container.addClass('comparison');
-
- var double_portrait_width = main_container_innerwidth / 2;
- var double_portrait_height = main_container_innerheight - $('.header', main_box).outerHeight();
-
- var double_paysage_width = main_container_innerwidth;
- var double_paysage_height = main_container_innerheight / 2 - $('.header', main_box).outerHeight();
-
- var main_display_portrait = calculate_display(
- double_portrait_width, double_portrait_height,
- main_record_width, main_record_height
- );
- var main_display_paysage = calculate_display(
- double_paysage_width, double_paysage_height,
- main_record_width, main_record_height
- );
-
- var compare_display_portrait = calculate_display(
- double_portrait_width, double_portrait_height,
- compare_record_width, compare_record_height
- );
- var compare_display_paysage = calculate_display(
- double_paysage_width, double_paysage_height,
- compare_record_width, compare_record_height
- );
-
- var surface_main_portrait = main_display_portrait.width * main_display_portrait.height;
- var surface_main_paysage = main_display_paysage.width * main_display_paysage.height;
- var surface_compare_portrait = compare_display_portrait.width * compare_display_portrait.height;
- var surface_compare_paysage = compare_display_paysage.width * compare_display_paysage.height;
-
- var double_portrait_surface = (surface_main_portrait + surface_compare_portrait) / 2;
- var double_paysage_surface = (surface_main_paysage + surface_compare_paysage) / 2;
-
- var smooth_image = false;
-
- var m_width_image, m_height_image, c_width_image, c_height_image, dim_container;
-
- if(double_portrait_surface > double_paysage_surface)
+ if(compare)
{
- if(!main_container.hasClass('portrait'))
- {
- smooth_image = true;
+ $('.agreement_selector').show();
+ main_container.addClass('comparison');
- smooth_transform(
- main_box,
- '50%',
- '100%',
- function()
- {
- set_container_status('portrait');
- }
- );
+ var double_portrait_width = main_container_innerwidth / 2;
+ var double_portrait_height = main_container_innerheight - $('.header', main_box).outerHeight();
- compare_box.css('visibility','hidden');
+ var double_paysage_width = main_container_innerwidth;
+ var double_paysage_height = main_container_innerheight / 2 - $('.header', main_box).outerHeight();
- smooth_transform(
- compare_box,
- '50%',
- '100%',
- function()
- {
- compare_box.css('display','none')
- .css('visibility','visible')
- .fadeIn();
- }
- );
- }
- m_width_image = main_display_portrait.width;
- m_height_image = main_display_portrait.height;
- c_width_image = compare_display_portrait.width;
- c_height_image = compare_display_portrait.height;
- dim_container = {
- width:double_portrait_width,
- height:double_portrait_height
- };
+ var main_display_portrait = calculate_display(
+ double_portrait_width, double_portrait_height,
+ main_record_width, main_record_height
+ );
+ var main_display_paysage = calculate_display(
+ double_paysage_width, double_paysage_height,
+ main_record_width, main_record_height
+ );
+
+ var compare_display_portrait = calculate_display(
+ double_portrait_width, double_portrait_height,
+ compare_record_width, compare_record_height
+ );
+ var compare_display_paysage = calculate_display(
+ double_paysage_width, double_paysage_height,
+ compare_record_width, compare_record_height
+ );
+
+ var surface_main_portrait = main_display_portrait.width * main_display_portrait.height;
+ var surface_main_paysage = main_display_paysage.width * main_display_paysage.height;
+ var surface_compare_portrait = compare_display_portrait.width * compare_display_portrait.height;
+ var surface_compare_paysage = compare_display_paysage.width * compare_display_paysage.height;
+
+ var double_portrait_surface = (surface_main_portrait + surface_compare_portrait) / 2;
+ var double_paysage_surface = (surface_main_paysage + surface_compare_paysage) / 2;
+
+ var smooth_image = false;
+
+ var m_width_image, m_height_image, c_width_image, c_height_image, dim_container;
+
+ if(double_portrait_surface > double_paysage_surface)
+ {
+ if(!main_container.hasClass('portrait'))
+ {
+ smooth_image = true;
+
+ smooth_transform(
+ main_box,
+ '50%',
+ '100%',
+ function()
+ {
+ set_container_status('portrait');
+ }
+ );
+
+ compare_box.css('visibility','hidden');
+
+ smooth_transform(
+ compare_box,
+ '50%',
+ '100%',
+ function()
+ {
+ compare_box.css('display','none')
+ .css('visibility','visible')
+ .fadeIn();
+ }
+ );
+ }
+ m_width_image = main_display_portrait.width;
+ m_height_image = main_display_portrait.height;
+ c_width_image = compare_display_portrait.width;
+ c_height_image = compare_display_portrait.height;
+ dim_container = {
+ width:double_portrait_width,
+ height:double_portrait_height
+ };
+ }
+ else
+ {
+ if(!main_container.hasClass('paysage'))
+ {
+ smooth_image = true;
+
+ smooth_transform(
+ main_box,
+ '100%',
+ '50%',
+ function()
+ {
+ set_container_status('paysage');
+ }
+ );
+
+ compare_box.css('visibility','hidden');
+
+ smooth_transform(
+ compare_box,
+ '100%',
+ '50%',
+ function()
+ {
+ compare_box.css('display','none')
+ .css('visibility','visible')
+ .fadeIn();
+ }
+ );
+ }
+ m_width_image = main_display_paysage.width;
+ m_height_image = main_display_paysage.height;
+ c_width_image = compare_display_paysage.width;
+ c_height_image = compare_display_paysage.height;
+ dim_container = {
+ width:double_paysage_width,
+ height:double_paysage_height
+ };
+ }
+
+ var image_callback = set_image_position(false, compare_record, c_width_image, c_height_image, dim_container, function(){});
+ set_image_position(smooth_image, main_record, m_width_image, m_height_image, dim_container, image_callback);
}
else
{
- if(!main_container.hasClass('paysage'))
- {
- smooth_image = true;
+ $('.agreement_selector').hide();
+ main_container.removeClass('comparison');
- smooth_transform(
- main_box,
- '100%',
- '50%',
- function()
- {
- set_container_status('paysage');
- }
- );
+ if(compare_box.is(':visible'))
+ {
+ compare_box.hide().css('visibility','hidden').css('display','block');
+ }
- compare_box.css('visibility','hidden');
+ var main_display = calculate_display(
+ main_container_innerwidth, (main_container_innerheight - $('.header', main_box).outerHeight()),
+ main_record_width, main_record_height
+ );
- smooth_transform(
- compare_box,
- '100%',
- '50%',
- function()
- {
- compare_box.css('display','none')
- .css('visibility','visible')
- .fadeIn();
- }
- );
- }
- m_width_image = main_display_paysage.width;
- m_height_image = main_display_paysage.height;
- c_width_image = compare_display_paysage.width;
- c_height_image = compare_display_paysage.height;
- dim_container = {
- width:double_paysage_width,
- height:double_paysage_height
- };
+ if(!main_container.hasClass('single'))
+ {
+ main_box.width('100%')
+ .height('100%');
+
+ set_container_status('single');
+ }
+ set_image_position(smooth_image, main_record, main_display.width, main_display.height, {
+ width:main_container_width,
+ height:(main_container_height - $('.header', main_box).outerHeight())
+ });
}
-
- var image_callback = set_image_position(false, compare_record, c_width_image, c_height_image, dim_container, function(){});
- set_image_position(smooth_image, main_record, m_width_image, m_height_image, dim_container, image_callback);
- }
- else
- {
- $('.agreement_selector').hide();
- main_container.removeClass('comparison');
-
- if(compare_box.is(':visible'))
- {
- compare_box.hide().css('visibility','hidden').css('display','block');
- }
-
- var main_display = calculate_display(
- main_container_innerwidth, (main_container_innerheight - $('.header', main_box).outerHeight()),
- main_record_width, main_record_height
- );
-
- if(!main_container.hasClass('single'))
- {
- main_box.width('100%')
- .height('100%');
-
- set_container_status('single');
- }
- set_image_position(smooth_image, main_record, main_display.width, main_display.height, {
- width:main_container_width,
- height:(main_container_height - $('.header', main_box).outerHeight())
- });
- }
}
function set_container_status(status)
{
- $('#record_wrapper').removeClass('paysage portrait single').addClass(status);
+ $('#record_wrapper').removeClass('paysage portrait single').addClass(status);
}
function set_image_position(smooth, image, width, height, container, callback)
{
- var dimensions = {};
+ var dimensions = {};
- if(typeof container !== 'undefined')
- {
- var c_width = container.width;
- var c_height = container.height;
+ if(typeof container !== 'undefined')
+ {
+ var c_width = container.width;
+ var c_height = container.height;
- dimensions.top = parseInt((c_height - height) / 2);
- dimensions.left = parseInt((c_width - width) / 2);
- }
- if(typeof callback == 'undefined')
- {
- callback = function(){};
- }
+ dimensions.top = parseInt((c_height - height) / 2);
+ dimensions.left = parseInt((c_width - width) / 2);
+ }
+ if(typeof callback == 'undefined')
+ {
+ callback = function(){};
+ }
- dimensions.width = width;
- dimensions.height = height;
+ dimensions.width = width;
+ dimensions.height = height;
- if(smooth)
- {
- $(image).stop().animate(dimensions,500,callback);
- }
- else
- {
- $(image).css(dimensions);
- callback();
- }
+ if(smooth)
+ {
+ $(image).stop().animate(dimensions,500,callback);
+ }
+ else
+ {
+ $(image).css(dimensions);
+ callback();
+ }
}
function smooth_transform(box, width, height, callback)
{
- if(typeof callback == 'undefined')
- callback = function(){};
+ if(typeof callback == 'undefined')
+ callback = function(){};
- $(box).stop()
- .animate(
- {
- width : width,
- height : height
- },
- 500,
- callback
- );
+ $(box).stop()
+ .animate(
+ {
+ width : width,
+ height : height
+ },
+ 500,
+ callback
+ );
}
function scroll_elements(boolean_value)
{
- var sc_wrapper = $('#sc_wrapper');
- var value;
- if(boolean_value)
- value = sc_wrapper.scrollLeft() + 400;
- else
- value = sc_wrapper.scrollLeft() - 400;
+ var sc_wrapper = $('#sc_wrapper');
+ var value;
+ if(boolean_value)
+ value = sc_wrapper.scrollLeft() + 400;
+ else
+ value = sc_wrapper.scrollLeft() - 400;
- sc_wrapper.stop().animate({
- 'scrollLeft':value
- });
- return;
+ sc_wrapper.stop().animate({
+ 'scrollLeft':value
+ });
+ return;
}
function download_basket()
{
- var ids = $.map($('#sc_container .download_form').toArray(), function(el, i){
- return $('input[name="basrec"]',$(el)).val();
- });
- download(ids.join(';'));
+ var ids = $.map($('#sc_container .download_form').toArray(), function(el, i){
+ return $('input[name="basrec"]',$(el)).val();
+ });
+ download(ids.join(';'));
}
function download(value)
@@ -1061,7 +1061,7 @@ function download(value)
$('.close_button', dialog.getDomElement()).bind('click',function(){
dialog.Close();
- });
+ });
return false;
});
diff --git a/www/skins/lightbox/jquery.validator.mobile.js b/www/skins/lightbox/jquery.validator.mobile.js
index 7eb864557f..3ea9a12078 100644
--- a/www/skins/lightbox/jquery.validator.mobile.js
+++ b/www/skins/lightbox/jquery.validator.mobile.js
@@ -1,127 +1,127 @@
$(document).ready(function(){
- if(typeof validator_loaded === 'boolean')
- return;
+ if(typeof validator_loaded === 'boolean')
+ return;
-$('.confirm_report').live('click',function(){
- var $this = $(this);
+ $('.confirm_report').live('click',function(){
+ var $this = $(this);
- $('.loader', $this).css({
- visibility:'visible'
+ $('.loader', $this).css({
+ visibility:'visible'
+ });
+
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_RELEASE/" + $('#basket_validation_id').val() + "/",
+ dataType: 'json',
+ error: function(data) {
+ $('.loader', $this).css({
+ visibility: 'hidden'
+ });
+ },
+ timeout: function(data) {
+ $('.loader', $this).css({
+ visibility: 'hidden'
+ });
+ },
+ success: function(data) {
+ $('.loader', $this).css({
+ visibility: 'hidden'
+ });
+ if (data.datas) {
+ alert(data.datas);
+ }
+ if (!data.error) {
+ releasable = false;
+ }
+
+ return;
+ }
+ });
});
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_RELEASE/" + $('#basket_validation_id').val() + "/",
- dataType: 'json',
- error: function(data) {
- $('.loader', $this).css({
- visibility: 'hidden'
- });
- },
- timeout: function(data) {
- $('.loader', $this).css({
- visibility: 'hidden'
- });
- },
- success: function(data) {
- $('.loader', $this).css({
- visibility: 'hidden'
- });
- if (data.datas) {
- alert(data.datas);
- }
- if (!data.error) {
- releasable = false;
- }
+ $('.agreement_radio').live('vmousedown', function(){
+ var sselcont_id = $(this).attr('for').split('_').pop();
+ var agreement = $('#' + $(this).attr('for')).val() == 'yes' ? '1' : '-1';
+
+ $.mobile.loading();
+
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/"+sselcont_id+"/",
+ dataType: 'json',
+ data: {
+ agreement : agreement
+ },
+ error: function(datas){
+ alert('error');
+ $.mobile.loading();
+ },
+ timeout: function(datas){
+ alert('error');
+ $.mobile.loading();
+ },
+ success: function(datas){
+ if(!datas.error)
+ {
+ if(agreement == '1')
+ $('.valid_choice_'+sselcont_id).removeClass('disagree').addClass('agree');
+ else
+ $('.valid_choice_'+sselcont_id).removeClass('agree').addClass('disagree');
+ $.mobile.loading();
+ if(datas.error)
+ {
+ alert(datas.datas);
+ return;
+ }
+
+ releasable = datas.release;
+ }
+ else
+ {
+ alert(datas.datas);
+ }
+ return;
+ }
+ });
+ return false;
- return;
- }
});
+ $('.note_area_validate').live('click', function(){
+ var sselcont_id = $(this).closest('form').find('input[name="sselcont_id"]').val();
+
+ $.mobile.loading();
+ $.ajax({
+ type: "POST",
+ url: "/lightbox/ajax/SET_NOTE/"+sselcont_id+"/",
+ dataType: 'json',
+ data: {
+ note : $('#note_form_'+sselcont_id).find('textarea').val()
+ },
+ error: function(datas){
+ alert('error');
+ $.mobile.loading();
+ },
+ timeout: function(datas){
+ alert('error');
+ $.mobile.loading();
+ },
+ success: function(datas){
+ $.mobile.loading();
+ if(datas.error)
+ {
+ alert(datas.datas);
+ return;
+ }
+
+ $('#notes_'+sselcont_id).empty().append(datas.datas);
+ window.history.back();
+ return;
+ }
+ });
+ return false;
+ });
+
+ validator_loaded = true;
});
-
- $('.agreement_radio').live('vmousedown', function(){
- var sselcont_id = $(this).attr('for').split('_').pop();
- var agreement = $('#' + $(this).attr('for')).val() == 'yes' ? '1' : '-1';
-
- $.mobile.loading();
-
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_ELEMENT_AGREEMENT/"+sselcont_id+"/",
- dataType: 'json',
- data: {
- agreement : agreement
- },
- error: function(datas){
- alert('error');
- $.mobile.loading();
- },
- timeout: function(datas){
- alert('error');
- $.mobile.loading();
- },
- success: function(datas){
- if(!datas.error)
- {
- if(agreement == '1')
- $('.valid_choice_'+sselcont_id).removeClass('disagree').addClass('agree');
- else
- $('.valid_choice_'+sselcont_id).removeClass('agree').addClass('disagree');
- $.mobile.loading();
- if(datas.error)
- {
- alert(datas.datas);
- return;
- }
-
- releasable = datas.release;
- }
- else
- {
- alert(datas.datas);
- }
- return;
- }
- });
- return false;
-
- });
- $('.note_area_validate').live('click', function(){
- var sselcont_id = $(this).closest('form').find('input[name="sselcont_id"]').val();
-
- $.mobile.loading();
- $.ajax({
- type: "POST",
- url: "/lightbox/ajax/SET_NOTE/"+sselcont_id+"/",
- dataType: 'json',
- data: {
- note : $('#note_form_'+sselcont_id).find('textarea').val()
- },
- error: function(datas){
- alert('error');
- $.mobile.loading();
- },
- timeout: function(datas){
- alert('error');
- $.mobile.loading();
- },
- success: function(datas){
- $.mobile.loading();
- if(datas.error)
- {
- alert(datas.datas);
- return;
- }
-
- $('#notes_'+sselcont_id).empty().append(datas.datas);
- window.history.back();
- return;
- }
- });
- return false;
- });
-
- validator_loaded = true;
-});
\ No newline at end of file
diff --git a/www/skins/prod/ThumbExtractor.js b/www/skins/prod/ThumbExtractor.js
index beb9519b55..a8f1fc912d 100644
--- a/www/skins/prod/ThumbExtractor.js
+++ b/www/skins/prod/ThumbExtractor.js
@@ -1,245 +1,245 @@
;
(function(document){
- /*****************
- * Canva Object
- *****************/
- var Canva = function(domCanva){
- this.domCanva = domCanva;
- };
-
- Canva.prototype = {
- resize : function(elementDomNode){
- var w = elementDomNode.getWidth();
- var maxH = elementDomNode.getHeight();
-
- if ('' !== elementDomNode.getAspectRatio()) {
- var ratio = parseFloat(elementDomNode.getAspectRatio());
-
- var h = Math.round(w * (1 / ratio));
-
- if (h > maxH) {
- var h = maxH;
- var w = Math.round(h * ratio);
- }
- } else {
- var h = maxH;
- }
-
- this.domCanva.setAttribute("width", w);
- this.domCanva.setAttribute("height", h);
-
- return this;
- },
- getContext2d : function(){
-
- if (undefined === this.domCanva.getContext)
- {
- return G_vmlCanvasManager
- .initElement(this.domCanva)
- .getContext("2d");
- }
-
- return this.domCanva.getContext('2d');
- },
- extractImage : function(){
- return this.domCanva.toDataURL("image/png");
- },
- reset : function(){
- var context = this.getContext2d();
- var w = this.getWidth();
- var h = this.getHeight();
-
- context.save();
- context.setTransform(1, 0, 0, 1, 0, 0);
- context.clearRect(0, 0, w, h);
- context.restore();
-
- return this;
- },
- copy : function(elementDomNode){
- var context = this.getContext2d();
-
- context.drawImage(
- elementDomNode.getDomElement()
- , 0
- , 0
- , this.getWidth()
- , this.getHeight()
- );
-
- return this;
- },
- getDomElement : function(){
- return this.domCanva;
- },
- getHeight : function(){
- return this.domCanva.offsetHeight;
- },
- getWidth : function(){
- return this.domCanva.offsetWidth;
- }
- };
-
-
- /******************
- * Image Object
- ******************/
- var Image = function(domElement){
- this.domElement = domElement;
- };
-
- Image.prototype = {
- getDomElement : function(){
- return this.domElement;
- },
- getHeight : function(){
- return this.domElement.offsetHeight;
- },
- getWidth : function(){
- return this.domElement.offsetWidth;
- }
- };
-
- /******************
- * Video Object inherits from Image object
- ******************/
-
- var Video = function(domElement){
- Image.call(this, domElement);
- this.aspectRatio = domElement.getAttribute('data-ratio');
- };
-
- Video.prototype = new Image();
- Video.prototype.constructor = Video;
- Video.prototype.getCurrentTime = function(){
- return Math.floor(this.domElement.currentTime);
- };
- Video.prototype.getAspectRatio = function(){
- return this.aspectRatio;
- };
-
- /******************
- * Cache Object
- ******************/
- var Store = function(){
- this.datas = {};
- };
-
- Store.prototype = {
- set : function(id, item){
- this.datas[id] = item;
- return this;
- },
- get : function(id){
- if(!this.datas[id]){
- throw 'Unknown ID';
- }
- return this.datas[id];
- },
- remove : function(id) {
- delete this.datas[id];
- },
- getLength : function(){
- var count = 0;
- for (var k in this.datas){
- if (this.datas.hasOwnProperty(k)){
- ++count;
- }
- }
- return count;
- }
- };
-
- /******************
- * Screenshot Object
- ******************/
- var ScreenShot = function(id, canva, video){
-
- var date = new Date();
-
- canva.resize(video);
- canva.copy(video);
-
- this.id = id;
- this.timestamp = date.getTime();
- this.dataURI = canva.extractImage();
- this.videoTime = video.getCurrentTime();
- };
-
- ScreenShot.prototype = {
- getId:function(){
- return this.id;
- },
- getDataURI: function(){
- return this.dataURI;
- },
- getTimeStamp: function(){
- return this.timestamp;
- },
- getVideoTime : function(){
- return this.videoTime;
- }
- };
-
- /**
- * THUMB EDITOR
- */
- var ThumbEditor = function(videoId, canvaId){
-
- var domElement = document.getElementById(videoId);
-
- if (null !== domElement) {
- var editorVideo = new Video(domElement);
- }
- var store = new Store();
-
- function getCanva(){
- return document.getElementById(canvaId);
- }
-
- return {
- isSupported : function () {
- var elem = document.createElement('canvas');
-
- return !! document.getElementById(videoId) && document.getElementById(canvaId)
- && !! elem.getContext && !! elem.getContext('2d');
- },
- screenshot : function(){
- var screenshot = new ScreenShot(
- store.getLength() + 1,
- new Canva(getCanva()),
- editorVideo
- );
-
- store.set(screenshot.getId(), screenshot);
-
- return screenshot;
- },
- store : store,
- copy: function(elementDomNode){
- var element = new Image(elementDomNode);
- var editorCanva = new Canva(getCanva());
- editorCanva
- .reset()
- .resize(editorVideo)
- .copy(element);
- },
- getCanvaImage : function(){
- var canva = new Canva(getCanva());
- return canva.extractImage();
- },
- resetCanva : function(){
- var editorCanva = new Canva(getCanva());
- editorCanva.reset();
- },
- getNbScreenshot : function(){
- return store.getLength();
- }
+ /*****************
+ * Canva Object
+ *****************/
+ var Canva = function(domCanva){
+ this.domCanva = domCanva;
};
- };
- document.THUMB_EDITOR = ThumbEditor;
+ Canva.prototype = {
+ resize : function(elementDomNode){
+ var w = elementDomNode.getWidth();
+ var maxH = elementDomNode.getHeight();
+
+ if ('' !== elementDomNode.getAspectRatio()) {
+ var ratio = parseFloat(elementDomNode.getAspectRatio());
+
+ var h = Math.round(w * (1 / ratio));
+
+ if (h > maxH) {
+ var h = maxH;
+ var w = Math.round(h * ratio);
+ }
+ } else {
+ var h = maxH;
+ }
+
+ this.domCanva.setAttribute("width", w);
+ this.domCanva.setAttribute("height", h);
+
+ return this;
+ },
+ getContext2d : function(){
+
+ if (undefined === this.domCanva.getContext)
+ {
+ return G_vmlCanvasManager
+ .initElement(this.domCanva)
+ .getContext("2d");
+ }
+
+ return this.domCanva.getContext('2d');
+ },
+ extractImage : function(){
+ return this.domCanva.toDataURL("image/png");
+ },
+ reset : function(){
+ var context = this.getContext2d();
+ var w = this.getWidth();
+ var h = this.getHeight();
+
+ context.save();
+ context.setTransform(1, 0, 0, 1, 0, 0);
+ context.clearRect(0, 0, w, h);
+ context.restore();
+
+ return this;
+ },
+ copy : function(elementDomNode){
+ var context = this.getContext2d();
+
+ context.drawImage(
+ elementDomNode.getDomElement()
+ , 0
+ , 0
+ , this.getWidth()
+ , this.getHeight()
+ );
+
+ return this;
+ },
+ getDomElement : function(){
+ return this.domCanva;
+ },
+ getHeight : function(){
+ return this.domCanva.offsetHeight;
+ },
+ getWidth : function(){
+ return this.domCanva.offsetWidth;
+ }
+ };
+
+
+ /******************
+ * Image Object
+ ******************/
+ var Image = function(domElement){
+ this.domElement = domElement;
+ };
+
+ Image.prototype = {
+ getDomElement : function(){
+ return this.domElement;
+ },
+ getHeight : function(){
+ return this.domElement.offsetHeight;
+ },
+ getWidth : function(){
+ return this.domElement.offsetWidth;
+ }
+ };
+
+ /******************
+ * Video Object inherits from Image object
+ ******************/
+
+ var Video = function(domElement){
+ Image.call(this, domElement);
+ this.aspectRatio = domElement.getAttribute('data-ratio');
+ };
+
+ Video.prototype = new Image();
+ Video.prototype.constructor = Video;
+ Video.prototype.getCurrentTime = function(){
+ return Math.floor(this.domElement.currentTime);
+ };
+ Video.prototype.getAspectRatio = function(){
+ return this.aspectRatio;
+ };
+
+ /******************
+ * Cache Object
+ ******************/
+ var Store = function(){
+ this.datas = {};
+ };
+
+ Store.prototype = {
+ set : function(id, item){
+ this.datas[id] = item;
+ return this;
+ },
+ get : function(id){
+ if(!this.datas[id]){
+ throw 'Unknown ID';
+ }
+ return this.datas[id];
+ },
+ remove : function(id) {
+ delete this.datas[id];
+ },
+ getLength : function(){
+ var count = 0;
+ for (var k in this.datas){
+ if (this.datas.hasOwnProperty(k)){
+ ++count;
+ }
+ }
+ return count;
+ }
+ };
+
+ /******************
+ * Screenshot Object
+ ******************/
+ var ScreenShot = function(id, canva, video){
+
+ var date = new Date();
+
+ canva.resize(video);
+ canva.copy(video);
+
+ this.id = id;
+ this.timestamp = date.getTime();
+ this.dataURI = canva.extractImage();
+ this.videoTime = video.getCurrentTime();
+ };
+
+ ScreenShot.prototype = {
+ getId:function(){
+ return this.id;
+ },
+ getDataURI: function(){
+ return this.dataURI;
+ },
+ getTimeStamp: function(){
+ return this.timestamp;
+ },
+ getVideoTime : function(){
+ return this.videoTime;
+ }
+ };
+
+ /**
+ * THUMB EDITOR
+ */
+ var ThumbEditor = function(videoId, canvaId){
+
+ var domElement = document.getElementById(videoId);
+
+ if (null !== domElement) {
+ var editorVideo = new Video(domElement);
+ }
+ var store = new Store();
+
+ function getCanva(){
+ return document.getElementById(canvaId);
+ }
+
+ return {
+ isSupported : function () {
+ var elem = document.createElement('canvas');
+
+ return !! document.getElementById(videoId) && document.getElementById(canvaId)
+ && !! elem.getContext && !! elem.getContext('2d');
+ },
+ screenshot : function(){
+ var screenshot = new ScreenShot(
+ store.getLength() + 1,
+ new Canva(getCanva()),
+ editorVideo
+ );
+
+ store.set(screenshot.getId(), screenshot);
+
+ return screenshot;
+ },
+ store : store,
+ copy: function(elementDomNode){
+ var element = new Image(elementDomNode);
+ var editorCanva = new Canva(getCanva());
+ editorCanva
+ .reset()
+ .resize(editorVideo)
+ .copy(element);
+ },
+ getCanvaImage : function(){
+ var canva = new Canva(getCanva());
+ return canva.extractImage();
+ },
+ resetCanva : function(){
+ var editorCanva = new Canva(getCanva());
+ editorCanva.reset();
+ },
+ getNbScreenshot : function(){
+ return store.getLength();
+ }
+ };
+ };
+
+ document.THUMB_EDITOR = ThumbEditor;
})(document);
diff --git a/www/skins/prod/jquery.Alerts.js b/www/skins/prod/jquery.Alerts.js
index 511a17b3b1..762b33ea3f 100644
--- a/www/skins/prod/jquery.Alerts.js
+++ b/www/skins/prod/jquery.Alerts.js
@@ -2,63 +2,63 @@ var p4 = p4 || {};
(function(p4){
- function create_dialog()
- {
- if($('#p4_alerts').length === 0)
+ function create_dialog()
{
- $('body').append('
');
+ if($('#p4_alerts').length === 0)
+ {
+ $('body').append('
');
+ }
+
+ return $('#p4_alerts');
}
- return $('#p4_alerts');
- }
-
- function alert(title, message, callback)
- {
- var dialog = create_dialog();
-
- var button = new Object();
-
- button['Ok'] = function(){
- if(typeof callback === 'function')
- callback();
- else
- dialog.dialog('close');
- };
-
- if (dialog.data('ui-dialog')) {
- dialog.dialog('destroy');
- }
-
- dialog.attr('title',title)
- .empty()
- .append(message)
- .dialog({
- autoOpen:false,
- closeOnEscape:true,
- resizable:false,
- draggable:false,
- modal:true,
- buttons : button,
- overlay: {
- backgroundColor: '#000',
- opacity: 0.7
- }
- }).dialog('open');
-
- if(typeof callback === 'function')
- {
- dialog.bind( "dialogclose", function(event, ui) {callback();});
- }
- else
+ function alert(title, message, callback)
{
+ var dialog = create_dialog();
+ var button = new Object();
+
+ button['Ok'] = function(){
+ if(typeof callback === 'function')
+ callback();
+ else
+ dialog.dialog('close');
+ };
+
+ if (dialog.data('ui-dialog')) {
+ dialog.dialog('destroy');
+ }
+
+ dialog.attr('title',title)
+ .empty()
+ .append(message)
+ .dialog({
+ autoOpen:false,
+ closeOnEscape:true,
+ resizable:false,
+ draggable:false,
+ modal:true,
+ buttons : button,
+ overlay: {
+ backgroundColor: '#000',
+ opacity: 0.7
+ }
+ }).dialog('open');
+
+ if(typeof callback === 'function')
+ {
+ dialog.bind( "dialogclose", function(event, ui) {callback();});
+ }
+ else
+ {
+
+ }
+
+ return;
}
+ p4.Alerts = alert;
+
+
return;
- }
-
- p4.Alerts = alert;
-
-
- return;
}(p4));
diff --git a/www/skins/prod/jquery.Dialog.js b/www/skins/prod/jquery.Dialog.js
index 04106e58d8..dea87630dc 100644
--- a/www/skins/prod/jquery.Dialog.js
+++ b/www/skins/prod/jquery.Dialog.js
@@ -4,284 +4,284 @@ var p4 = p4 || {};
;
(function(p4, $){
- function getLevel (level) {
+ function getLevel (level) {
- level = parseInt(level);
+ level = parseInt(level);
- if(isNaN(level) || level < 1)
- {
- return 1;
- }
+ if(isNaN(level) || level < 1)
+ {
+ return 1;
+ }
- return level;
- };
-
- function getId (level)
- {
- return 'DIALOG' + getLevel(level);
- };
-
- function addButtons(buttons, dialog)
- {
- if(dialog.options.closeButton === true)
- {
- buttons[language.fermer] = function() {
- dialog.Close();
- };
- }
- if(dialog.options.cancelButton === true)
- {
- buttons[language.annuler] = function() {
- dialog.Close();
- };
- }
-
- return buttons;
- }
-
- var phraseaDialog = function (options, level) {
-
- var createDialog = function(level) {
-
- var $dialog = $('#' + getId(level));
-
- if($dialog.length > 0)
- {
- throw 'Dialog already exists at this level';
- }
-
- $dialog = $('
');
- $('body').append($dialog);
-
- return $dialog;
+ return level;
};
- var defaults = {
- size : 'Medium',
- buttons : {},
- loading : true,
- title : '',
- closeOnEscape : true,
- confirmExit:false,
- closeCallback:false,
- closeButton:false,
- cancelButton:false
- },
- options = typeof options === 'object' ? options : {},
- width,
- height,
- $dialog,
- $this = this;
-
- this.closing = false;
-
- this.options = $.extend(defaults, options);
-
- this.level = getLevel(level);
-
- this.options.buttons = addButtons(this.options.buttons, this);
-
- switch(this.options.size)
+ function getId (level)
{
- case 'Full':
- height = bodySize.y - 30;
- width = bodySize.x - 30 ;
- break;
- case 'Medium':
- width = Math.min(bodySize.x - 30, 730);
- height = Math.min(bodySize.y - 30, 520);
- break;
- default:
- case 'Small':
- width = Math.min(bodySize.x - 30, 420);
- height = Math.min(bodySize.y - 30, 300);
- break;
- case 'Alert':
- width = Math.min(bodySize.x - 30, 300);
- height = Math.min(bodySize.y - 30, 150);
- break;
- }
-
- /*
- * 3 avaailable dimensions :
- *
- * - Full | Full size ()
- * - Medium | 420 x 450
- * - Small | 730 x 480
- *
- **/
- this.$dialog = createDialog(this.level),
- zIndex = Math.min(this.level * 5000 + 5000, 32767);
-
- var CloseCallback = function() {
- if(typeof $this.options.closeCallback === 'function')
- {
- $this.options.closeCallback($this.$dialog);
- }
-
- if($this.closing === false)
- {
- $this.closing = true;
- $this.Close();
- }
+ return 'DIALOG' + getLevel(level);
};
- if (this.$dialog.data('ui-dialog')) {
- this.$dialog.dialog('destroy');
+ function addButtons(buttons, dialog)
+ {
+ if(dialog.options.closeButton === true)
+ {
+ buttons[language.fermer] = function() {
+ dialog.Close();
+ };
+ }
+ if(dialog.options.cancelButton === true)
+ {
+ buttons[language.annuler] = function() {
+ dialog.Close();
+ };
+ }
+
+ return buttons;
}
- this.$dialog.attr('title', this.options.title)
- .empty()
- .dialog({
- buttons:this.options.buttons,
- draggable:false,
- resizable:false,
- closeOnEscape:this.options.closeOnEscape,
- modal:true,
- width:width,
- height:height,
- open: function() {
- $(this).dialog("widget").css("z-index", zIndex);
- },
- close:CloseCallback
- })
- .dialog('open').addClass('dialog-' + this.options.size);
+ var phraseaDialog = function (options, level) {
- if(this.options.loading === true)
- {
- this.$dialog.addClass('loading');
- }
+ var createDialog = function(level) {
- if(this.options.size === 'Full')
- {
- var $this = this;
- $(window).unbind('resize.DIALOG' + getLevel(level))
- .bind('resize.DIALOG' + getLevel(level), function(){
- if ($this.$dialog.data("ui-dialog")) {
- $this.$dialog.dialog('option', {
- width : bodySize.x - 30,
- height : bodySize.y - 30
+ var $dialog = $('#' + getId(level));
+
+ if($dialog.length > 0)
+ {
+ throw 'Dialog already exists at this level';
+ }
+
+ $dialog = $('
');
+ $('body').append($dialog);
+
+ return $dialog;
+ };
+
+ var defaults = {
+ size : 'Medium',
+ buttons : {},
+ loading : true,
+ title : '',
+ closeOnEscape : true,
+ confirmExit:false,
+ closeCallback:false,
+ closeButton:false,
+ cancelButton:false
+ },
+ options = typeof options === 'object' ? options : {},
+ width,
+ height,
+ $dialog,
+ $this = this;
+
+ this.closing = false;
+
+ this.options = $.extend(defaults, options);
+
+ this.level = getLevel(level);
+
+ this.options.buttons = addButtons(this.options.buttons, this);
+
+ switch(this.options.size)
+ {
+ case 'Full':
+ height = bodySize.y - 30;
+ width = bodySize.x - 30 ;
+ break;
+ case 'Medium':
+ width = Math.min(bodySize.x - 30, 730);
+ height = Math.min(bodySize.y - 30, 520);
+ break;
+ default:
+ case 'Small':
+ width = Math.min(bodySize.x - 30, 420);
+ height = Math.min(bodySize.y - 30, 300);
+ break;
+ case 'Alert':
+ width = Math.min(bodySize.x - 30, 300);
+ height = Math.min(bodySize.y - 30, 150);
+ break;
+ }
+
+ /*
+ * 3 avaailable dimensions :
+ *
+ * - Full | Full size ()
+ * - Medium | 420 x 450
+ * - Small | 730 x 480
+ *
+ **/
+ this.$dialog = createDialog(this.level),
+ zIndex = Math.min(this.level * 5000 + 5000, 32767);
+
+ var CloseCallback = function() {
+ if(typeof $this.options.closeCallback === 'function')
+ {
+ $this.options.closeCallback($this.$dialog);
+ }
+
+ if($this.closing === false)
+ {
+ $this.closing = true;
+ $this.Close();
+ }
+ };
+
+ if (this.$dialog.data('ui-dialog')) {
+ this.$dialog.dialog('destroy');
+ }
+
+ this.$dialog.attr('title', this.options.title)
+ .empty()
+ .dialog({
+ buttons:this.options.buttons,
+ draggable:false,
+ resizable:false,
+ closeOnEscape:this.options.closeOnEscape,
+ modal:true,
+ width:width,
+ height:height,
+ open: function() {
+ $(this).dialog("widget").css("z-index", zIndex);
+ },
+ close:CloseCallback
+ })
+ .dialog('open').addClass('dialog-' + this.options.size);
+
+ if(this.options.loading === true)
+ {
+ this.$dialog.addClass('loading');
+ }
+
+ if(this.options.size === 'Full')
+ {
+ var $this = this;
+ $(window).unbind('resize.DIALOG' + getLevel(level))
+ .bind('resize.DIALOG' + getLevel(level), function(){
+ if ($this.$dialog.data("ui-dialog")) {
+ $this.$dialog.dialog('option', {
+ width : bodySize.x - 30,
+ height : bodySize.y - 30
+ });
+ }
+ });
+ }
+
+ return this;
+ };
+
+ phraseaDialog.prototype = {
+ Close : function() {
+ p4.Dialog.Close(this.level);
+ },
+ setContent : function (content) {
+ this.$dialog.removeClass('loading').empty().append(content);
+ },
+ getId : function () {
+ return this.$dialog.attr('id');
+ },
+ load : function(url, method, params) {
+ var $this = this;
+ this.loader = {
+ url : url,
+ method : typeof method === 'undefined' ? 'GET' : method,
+ params : typeof params === 'undefined' ? {} : params
+ };
+
+ $.ajax({
+ type: this.loader.method,
+ url: this.loader.url,
+ dataType: 'html',
+ data : this.loader.params,
+ beforeSend:function(){
+ },
+ success: function(data){
+ $this.setContent(data);
+ return;
+ },
+ error: function(){
+ return;
+ },
+ timeout: function(){
+ return;
+ }
});
+ },
+ refresh : function() {
+ if(typeof this.loader === 'undefined')
+ {
+ throw 'Nothing to refresh';
+ }
+ this.load(this.loader.url, this.loader.method, this.loader.params);
+ },
+ getDomElement : function () {
+ return this.$dialog;
+ },
+ getOption : function (optionName) {
+ if (this.$dialog.data("ui-dialog")) {
+ return this.$dialog.dialog('option', optionName);
+ }
+ return null;
+ },
+ setOption : function (optionName, optionValue) {
+ if(optionName === 'buttons')
+ {
+ optionValue = addButtons(optionValue, this);
+ }
+ if (this.$dialog.data("ui-dialog")) {
+ this.$dialog.dialog('option', optionName, optionValue);
+ }
}
- });
- }
+ };
- return this;
- };
+ var Dialog = function () {
+ this.currentStack = {};
+ };
- phraseaDialog.prototype = {
- Close : function() {
- p4.Dialog.Close(this.level);
- },
- setContent : function (content) {
- this.$dialog.removeClass('loading').empty().append(content);
- },
- getId : function () {
- return this.$dialog.attr('id');
- },
- load : function(url, method, params) {
- var $this = this;
- this.loader = {
- url : url,
- method : typeof method === 'undefined' ? 'GET' : method,
- params : typeof params === 'undefined' ? {} : params
- };
+ Dialog.prototype = {
+ Create : function(options, level) {
- $.ajax({
- type: this.loader.method,
- url: this.loader.url,
- dataType: 'html',
- data : this.loader.params,
- beforeSend:function(){
+ if(this.get(level) instanceof phraseaDialog)
+ {
+ this.get(level).Close();
+ }
+
+ $dialog = new phraseaDialog(options, level);
+
+ this.currentStack[$dialog.getId()] = $dialog;
+
+ return $dialog;
},
- success: function(data){
- $this.setContent(data);
- return;
+ get : function (level) {
+
+ var id = getId(level);
+
+ if(id in this.currentStack)
+ {
+ return this.currentStack[id];
+ }
+
+ return null;
},
- error: function(){
- return;
- },
- timeout: function(){
- return;
+ Close : function (level) {
+
+ $(window).unbind('resize.DIALOG' + getLevel(level));
+
+ this.get(level).closing = true;
+ var dialog = this.get(level).getDomElement();
+ if (dialog.data('ui-dialog')) {
+ dialog.dialog('close').dialog('destroy');
+ }
+ dialog.remove();
+
+ var id = this.get(level).getId();
+
+ if(id in this.currentStack)
+ {
+ delete this.currentStack.id;
+ }
}
- });
- },
- refresh : function() {
- if(typeof this.loader === 'undefined')
- {
- throw 'Nothing to refresh';
- }
- this.load(this.loader.url, this.loader.method, this.loader.params);
- },
- getDomElement : function () {
- return this.$dialog;
- },
- getOption : function (optionName) {
- if (this.$dialog.data("ui-dialog")) {
- return this.$dialog.dialog('option', optionName);
- }
- return null;
- },
- setOption : function (optionName, optionValue) {
- if(optionName === 'buttons')
- {
- optionValue = addButtons(optionValue, this);
- }
- if (this.$dialog.data("ui-dialog")) {
- this.$dialog.dialog('option', optionName, optionValue);
- }
- }
- };
+ };
- var Dialog = function () {
- this.currentStack = {};
- };
+ p4.Dialog = new Dialog();
- Dialog.prototype = {
- Create : function(options, level) {
-
- if(this.get(level) instanceof phraseaDialog)
- {
- this.get(level).Close();
- }
-
- $dialog = new phraseaDialog(options, level);
-
- this.currentStack[$dialog.getId()] = $dialog;
-
- return $dialog;
- },
- get : function (level) {
-
- var id = getId(level);
-
- if(id in this.currentStack)
- {
- return this.currentStack[id];
- }
-
- return null;
- },
- Close : function (level) {
-
- $(window).unbind('resize.DIALOG' + getLevel(level));
-
- this.get(level).closing = true;
- var dialog = this.get(level).getDomElement();
- if (dialog.data('ui-dialog')) {
- dialog.dialog('close').dialog('destroy');
- }
- dialog.remove();
-
- var id = this.get(level).getId();
-
- if(id in this.currentStack)
- {
- delete this.currentStack.id;
- }
- }
- };
-
- p4.Dialog = new Dialog();
-
-}(p4, jQuery));
\ No newline at end of file
+}(p4, jQuery));
diff --git a/www/skins/prod/jquery.Feedback.js b/www/skins/prod/jquery.Feedback.js
index 5afe2e301c..63bfdf1648 100644
--- a/www/skins/prod/jquery.Feedback.js
+++ b/www/skins/prod/jquery.Feedback.js
@@ -2,724 +2,724 @@
;
(function(window){
- var Feedback = function($container, context){
- this.container = $($container);
+ var Feedback = function($container, context){
+ this.container = $($container);
- this.Context = context;
+ this.Context = context;
- this.selection = new Selectable(
- $('.user_content .badges', this.container),
- {
- selector:'.badge'
- }
- );
+ this.selection = new Selectable(
+ $('.user_content .badges', this.container),
+ {
+ selector:'.badge'
+ }
+ );
- var $this = this;
+ var $this = this;
- $('.content .options .select-all', this.container).bind('click', function(){
- $this.selection.selectAll();
- });
+ $('.content .options .select-all', this.container).bind('click', function(){
+ $this.selection.selectAll();
+ });
- $('.content .options .unselect-all', this.container).bind('click', function(){
- $this.selection.empty();
- });
+ $('.content .options .unselect-all', this.container).bind('click', function(){
+ $this.selection.empty();
+ });
- $('.UserTips', this.container).tooltip();
+ $('.UserTips', this.container).tooltip();
- $('a.user_adder', this.container).bind('click', function(){
+ $('a.user_adder', this.container).bind('click', function(){
- var $this = $(this);
+ var $this = $(this);
- $.ajax({
- type: "GET",
- url: $this.attr('href'),
- dataType: 'html',
- beforeSend:function(){
- var options = {
- size : 'Medium',
- title : $this.html()
- };
- p4.Dialog.Create(options, 2).getDomElement().addClass('loading');
- },
- success: function(data){
- p4.Dialog.get(2).getDomElement().removeClass('loading').empty().append(data);
- return;
- },
- error: function(){
- p4.Dialog.get(2).Close();
- return;
- },
- timeout: function(){
- p4.Dialog.get(2).Close();
- return;
- }
- });
-
- return false;
- });
-
- $('.recommended_users', this.container).bind('click', function(){
-
- var usr_id = $('input[name="usr_id"]', $(this)).val();
-
- $this.loadUser(usr_id, $this.selectUser);
-
- return false;
- });
-
- $('.recommended_users_list', this.container).bind('click', function(){
-
- var content = $('#push_user_recommendations').html();
-
- var options = {
- size : 'Small',
- title : $(this).attr('title')
- };
-
- $dialog = p4.Dialog.Create(options, 2);
- $dialog.setContent(content);
-
- $dialog.getDomElement().find('a.adder').bind('click', function(){
-
- $(this).addClass('added');
-
- var usr_id = $(this).closest('tr').find('input[name="usr_id"]').val();
-
- $this.loadUser(usr_id, $this.selectUser);
-
- return false;
- });
-
- $dialog.getDomElement().find('a.adder').each(function(i, el){
-
- var usr_id = $(this).closest('tr').find('input[name="usr_id"]').val();
-
- if($('.badge_' + usr_id, $this.container).length > 0)
- {
- $(this).addClass('added');
- }
-
- });
-
-
-
-
- return false;
- });
-
- $('#PushBox form[name="FeedBackForm"]').bind('submit', function(){
-
- var $this = $(this);
-
- $.ajax({
- type: $this.attr('method'),
- url: $this.attr('action'),
- dataType: 'json',
- data: $this.serializeArray(),
- beforeSend:function(){
-
- },
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
- p4.Dialog.Close(1);
- p4.WorkZone.refresh();
- }
- else
- {
- humane.error(data.message);
- }
- return;
- },
- error: function(){
-
- return;
- },
- timeout: function(){
-
- return;
- }
- });
-
- return false;
- });
-
- $('.FeedbackSend', this.container).bind('click', function(){
- if($('.badges .badge', $container).length === 0)
- {
- alert(language.FeedBackNoUsersSelected);
- return;
- }
-
- var buttons = {};
-
- buttons[language.send] = function(){
- if ($.trim($('input[name="name"]', $dialog.getDomElement()).val()) === '') {
- options = {
- size : 'Alert',
- closeButton : true,
- title : language.warning
+ $.ajax({
+ type: "GET",
+ url: $this.attr('href'),
+ dataType: 'html',
+ beforeSend:function(){
+ var options = {
+ size : 'Medium',
+ title : $this.html()
+ };
+ p4.Dialog.Create(options, 2).getDomElement().addClass('loading');
},
- $dialog = p4.Dialog.Create(options, 3);
- $dialog.setContent(language.FeedBackNameMandatory);
-
- return false;
- }
+ success: function(data){
+ p4.Dialog.get(2).getDomElement().removeClass('loading').empty().append(data);
+ return;
+ },
+ error: function(){
+ p4.Dialog.get(2).Close();
+ return;
+ },
+ timeout: function(){
+ p4.Dialog.get(2).Close();
+ return;
+ }
+ });
- $dialog.Close();
-
- $('input[name="name"]', $FeedBackForm).val($('input[name="name"]', $dialog.getDomElement()).val());
- $('input[name="duration"]', $FeedBackForm).val($('select[name="duration"]', $dialog.getDomElement()).val());
- $('textarea[name="message"]', $FeedBackForm).val($('textarea[name="message"]', $dialog.getDomElement()).val());
- $('input[name="recept"]', $FeedBackForm).attr('checked', $('input[name="recept"]', $dialog.getDomElement()).attr('checked'));
-
- $FeedBackForm.trigger('submit');
- };
-
- var options = {
- size : 'Small',
- buttons : buttons,
- loading : true,
- title : language.send,
- closeOnEscape : true,
- cancelButton : true
- };
-
- var $dialog = p4.Dialog.Create(options, 2);
-
- var $FeedBackForm = $('form[name="FeedBackForm"]', $container);
-
- var html = _.template($("#feedback_sendform_tpl").html());
-
- $dialog.setContent(html);
-
- $('input[name="name"]', $dialog.getDomElement()).val($('input[name="name"]', $FeedBackForm).val());
- $('textarea[name="message"]', $dialog.getDomElement()).val($('textarea[name="message"]', $FeedBackForm).val());
- $('.' + $this.Context, $dialog.getDomElement()).show();
-
- $('form', $dialog.getDomElement()).submit(function() {
return false;
});
- });
- $('.user_content .badges', this.container).disableSelection();
+ $('.recommended_users', this.container).bind('click', function(){
- $('.user_content .badges .badge .toggle', this.container).die('click').live('click', function(event){
+ var usr_id = $('input[name="usr_id"]', $(this)).val();
- var $this = $(this);
+ $this.loadUser(usr_id, $this.selectUser);
- $this.toggleClass('status_off status_on');
+ return false;
+ });
- $this.find('input').val($this.hasClass('status_on') ? '1' : '0');
+ $('.recommended_users_list', this.container).bind('click', function(){
- return false;
- });
+ var content = $('#push_user_recommendations').html();
- $('.general_togglers .general_toggler', this.container).bind('click', function(){
- var feature = $(this).attr('feature');
+ var options = {
+ size : 'Small',
+ title : $(this).attr('title')
+ };
- var $badges = $('.user_content .badge.selected', this.container);
+ $dialog = p4.Dialog.Create(options, 2);
+ $dialog.setContent(content);
- var toggles = $('.status_off.toggle_' + feature, $badges);
+ $dialog.getDomElement().find('a.adder').bind('click', function(){
- if(toggles.length === 0)
- {
- var toggles = $('.status_on.toggle_' + feature, $badges);
- }
- if(toggles.length === 0)
- {
- humane.info('No user selected');
- }
+ $(this).addClass('added');
- toggles.trigger('click');
- return false;
- });
+ var usr_id = $(this).closest('tr').find('input[name="usr_id"]').val();
- $('.user_content .badges .badge .deleter', this.container).live('click', function(event){
- var $elem = $(this).closest('.badge');
- $elem.fadeOut(function(){
- $elem.remove();
- });
- return;
- });
+ $this.loadUser(usr_id, $this.selectUser);
- $('.list_manager', this.container).bind('click', function(){
- $('#PushBox').hide();
- $('#ListManager').show();
- return false;
- });
+ return false;
+ });
- $('a.list_loader', this.container).bind('click', function(){
- var url = $(this).attr('href');
+ $dialog.getDomElement().find('a.adder').each(function(i, el){
- var callbackList = function(list){
- for(var i in list.entries)
- {
- this.selectUser(list.entries[i].User);
- }
- };
+ var usr_id = $(this).closest('tr').find('input[name="usr_id"]').val();
- $this.loadList(url, callbackList);
+ if($('.badge_' + usr_id, $this.container).length > 0)
+ {
+ $(this).addClass('added');
+ }
- return false;
- });
+ });
- $('.options button', this.container);
- $('form.list_saver', this.container).bind('submit', function(){
- var $form = $(this);
- var $input = $('input[name="name"]', $form);
- var users = p4.Feedback.getUsers();
- if(users.length === 0)
- {
- humane.error('No users');
- return false;
- }
+ return false;
+ });
- p4.Lists.create($input.val(), function(list){
- $input.val('');
- list.addUsers(users);
- });
+ $('#PushBox form[name="FeedBackForm"]').bind('submit', function(){
- return false;
- });
+ var $this = $(this);
- $('input[name="users-search"]', this.container).autocomplete({
- minLength: 2,
- source: function( request, response ) {
- $.ajax({
- url: '/prod/push/search-user/',
- dataType: "json",
- data: {
- query: request.term
- },
- success: function( data ) {
- response(data);
- }
- });
- },
- focus: function( event, ui ) {
- $( 'input[name="users-search"]' ).val( ui.item.label );
- },
- select: function( event, ui ) {
- if(ui.item.type === 'USER') {
- $this.selectUser(ui.item);
- } else if(ui.item.type === 'LIST') {
- for(var e in ui.item.entries) {
- $this.selectUser(ui.item.entries[e].User);
+ $.ajax({
+ type: $this.attr('method'),
+ url: $this.attr('action'),
+ dataType: 'json',
+ data: $this.serializeArray(),
+ beforeSend:function(){
+
+ },
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+ p4.Dialog.Close(1);
+ p4.WorkZone.refresh();
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ return;
+ },
+ error: function(){
+
+ return;
+ },
+ timeout: function(){
+
+ return;
+ }
+ });
+
+ return false;
+ });
+
+ $('.FeedbackSend', this.container).bind('click', function(){
+ if($('.badges .badge', $container).length === 0)
+ {
+ alert(language.FeedBackNoUsersSelected);
+ return;
+ }
+
+ var buttons = {};
+
+ buttons[language.send] = function(){
+ if ($.trim($('input[name="name"]', $dialog.getDomElement()).val()) === '') {
+ options = {
+ size : 'Alert',
+ closeButton : true,
+ title : language.warning
+ },
+ $dialog = p4.Dialog.Create(options, 3);
+ $dialog.setContent(language.FeedBackNameMandatory);
+
+ return false;
+ }
+
+ $dialog.Close();
+
+ $('input[name="name"]', $FeedBackForm).val($('input[name="name"]', $dialog.getDomElement()).val());
+ $('input[name="duration"]', $FeedBackForm).val($('select[name="duration"]', $dialog.getDomElement()).val());
+ $('textarea[name="message"]', $FeedBackForm).val($('textarea[name="message"]', $dialog.getDomElement()).val());
+ $('input[name="recept"]', $FeedBackForm).attr('checked', $('input[name="recept"]', $dialog.getDomElement()).attr('checked'));
+
+ $FeedBackForm.trigger('submit');
+ };
+
+ var options = {
+ size : 'Small',
+ buttons : buttons,
+ loading : true,
+ title : language.send,
+ closeOnEscape : true,
+ cancelButton : true
+ };
+
+ var $dialog = p4.Dialog.Create(options, 2);
+
+ var $FeedBackForm = $('form[name="FeedBackForm"]', $container);
+
+ var html = _.template($("#feedback_sendform_tpl").html());
+
+ $dialog.setContent(html);
+
+ $('input[name="name"]', $dialog.getDomElement()).val($('input[name="name"]', $FeedBackForm).val());
+ $('textarea[name="message"]', $dialog.getDomElement()).val($('textarea[name="message"]', $FeedBackForm).val());
+ $('.' + $this.Context, $dialog.getDomElement()).show();
+
+ $('form', $dialog.getDomElement()).submit(function() {
+ return false;
+ });
+ });
+
+ $('.user_content .badges', this.container).disableSelection();
+
+ $('.user_content .badges .badge .toggle', this.container).die('click').live('click', function(event){
+
+ var $this = $(this);
+
+ $this.toggleClass('status_off status_on');
+
+ $this.find('input').val($this.hasClass('status_on') ? '1' : '0');
+
+ return false;
+ });
+
+ $('.general_togglers .general_toggler', this.container).bind('click', function(){
+ var feature = $(this).attr('feature');
+
+ var $badges = $('.user_content .badge.selected', this.container);
+
+ var toggles = $('.status_off.toggle_' + feature, $badges);
+
+ if(toggles.length === 0)
+ {
+ var toggles = $('.status_on.toggle_' + feature, $badges);
+ }
+ if(toggles.length === 0)
+ {
+ humane.info('No user selected');
+ }
+
+ toggles.trigger('click');
+ return false;
+ });
+
+ $('.user_content .badges .badge .deleter', this.container).live('click', function(event){
+ var $elem = $(this).closest('.badge');
+ $elem.fadeOut(function(){
+ $elem.remove();
+ });
+ return;
+ });
+
+ $('.list_manager', this.container).bind('click', function(){
+ $('#PushBox').hide();
+ $('#ListManager').show();
+ return false;
+ });
+
+ $('a.list_loader', this.container).bind('click', function(){
+ var url = $(this).attr('href');
+
+ var callbackList = function(list){
+ for(var i in list.entries)
+ {
+ this.selectUser(list.entries[i].User);
+ }
+ };
+
+ $this.loadList(url, callbackList);
+
+ return false;
+ });
+
+ $('.options button', this.container);
+
+ $('form.list_saver', this.container).bind('submit', function(){
+ var $form = $(this);
+ var $input = $('input[name="name"]', $form);
+
+ var users = p4.Feedback.getUsers();
+
+ if(users.length === 0)
+ {
+ humane.error('No users');
+ return false;
+ }
+
+ p4.Lists.create($input.val(), function(list){
+ $input.val('');
+ list.addUsers(users);
+ });
+
+ return false;
+ });
+
+ $('input[name="users-search"]', this.container).autocomplete({
+ minLength: 2,
+ source: function( request, response ) {
+ $.ajax({
+ url: '/prod/push/search-user/',
+ dataType: "json",
+ data: {
+ query: request.term
+ },
+ success: function( data ) {
+ response(data);
+ }
+ });
+ },
+ focus: function( event, ui ) {
+ $( 'input[name="users-search"]' ).val( ui.item.label );
+ },
+ select: function( event, ui ) {
+ if(ui.item.type === 'USER') {
+ $this.selectUser(ui.item);
+ } else if(ui.item.type === 'LIST') {
+ for(var e in ui.item.entries) {
+ $this.selectUser(ui.item.entries[e].User);
+ }
+ }
+ return false;
+ }
+ })
+ .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
+ var html = "";
+
+ if(item.type === 'USER') {
+ html = _.template($("#list_user_tpl").html(), {
+ item: item
+ });
+ } else if(item.type === 'LIST') {
+ html = _.template($("#list_list_tpl").html(), {
+ item: item
+ });
+ }
+
+ return $(html).data( "ui-autocomplete-item", item ).appendTo(ul);
+ };
+
+ return this;
+ };
+
+ Feedback.prototype = {
+ selectUser : function(user){
+ 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)
+ {
+ humane.info('User already selected');
+ return;
+ }
+
+ if(window.console)
+ {
+ console.log('Selecting', user);
+ }
+
+ var html = _.template($("#" + this.Context.toLowerCase() + "_badge_tpl").html(), {
+ user: user
+ });
+
+ p4.Feedback.appendBadge(html);
+ },
+ loadUser : function(usr_id, callback) {
+ var $this = this;
+
+ $.ajax({
+ type: 'GET',
+ url: '/prod/push/user/' + usr_id + '/',
+ dataType: 'json',
+ data: {
+ usr_id : usr_id
+ },
+ success: function(data){
+ if(typeof callback === 'function')
+ {
+ callback.call($this, data);
+ }
+ }
+ });
+ },
+ loadList : function(url, callback) {
+ var $this = this;
+
+ $.ajax({
+ type: 'GET',
+ url: url,
+ dataType: 'json',
+ success: function(data){
+ if(typeof callback === 'function')
+ {
+ callback.call($this, data);
+ }
+ }
+ });
+ },
+ appendBadge : function(badge){
+ $('.user_content .badges', this.container).append(badge);
+ },
+ addUser : function($form, callback){
+
+ var $this = this;
+
+ $.ajax({
+ type: 'POST',
+ url: '/prod/push/add-user/',
+ dataType: 'json',
+ data: $form.serializeArray(),
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+ $this.selectUser(data.user);
+ callback();
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ }
+ });
+ },
+ getSelection : function() {
+ return this.selection;
+ },
+ getUsers : function() {
+ return $('.user_content .badge', this.container).map(function(){
+ return $('input[name="id"]', $(this)).val();
+ });
+ }
+ };
+
+
+
+ var ListManager = function($container) {
+
+ this.list = null;
+ this.container = $container;
+
+ $('.back_link', this.container).bind('click', function(){
+ $('#PushBox').show();
+ $('#ListManager').hide();
return false;
- }
- })
- .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
- var html = "";
+ });
- if(item.type === 'USER') {
- html = _.template($("#list_user_tpl").html(), {
- item: item
+ $('a.list_sharer', this.container).die('click').live('click', function(){
+
+ var $this = $(this),
+ options = {
+ size : 'Small',
+ closeButton : true,
+ title : $this.attr('title')
+ },
+ $dialog = p4.Dialog.Create(options, 2);
+
+ $dialog.load($this.attr('href'), 'GET');
+
+ return false;
+ });
+
+
+ $('a.user_adder', this.container).bind('click', function(){
+
+ var $this = $(this);
+
+ $.ajax({
+ type: "GET",
+ url: $this.attr('href'),
+ dataType: 'html',
+ beforeSend:function(){
+ var options = {
+ size : 'Medium',
+ title : $this.html()
+ };
+ p4.Dialog.Create(options, 2).getDomElement().addClass('loading'); },
+ success: function(data){
+ p4.Dialog.get(2).getDomElement().removeClass('loading').empty().append(data);
+ return;
+ },
+ error: function(){
+ p4.Dialog.get(2).Close();
+ return;
+ },
+ timeout: function(){
+ p4.Dialog.get(2).Close();
+ return;
+ }
});
- } else if(item.type === 'LIST') {
- html = _.template($("#list_list_tpl").html(), {
- item: item
+
+ return false;
+ });
+
+
+
+ var initLeft = function() {
+ $('a.list_refresh', $container).bind('click', function(event){
+
+ var callback = function(datas){
+ $('.all-lists', $container).removeClass('loading').append(datas);
+ initLeft();
+ };
+
+ $('.all-lists', $container).empty().addClass('loading');
+
+ p4.Lists.get(callback, 'html');
+
+ return false;
});
- }
- return $(html).data( "ui-autocomplete-item", item ).appendTo(ul);
- };
+ $('a.list_adder', $container).bind('click', function(event){
- return this;
- };
+ var makeDialog = function (box) {
- Feedback.prototype = {
- selectUser : function(user){
- 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)
- {
- humane.info('User already selected');
- return;
- }
+ var buttons = {};
- if(window.console)
- {
- console.log('Selecting', user);
- }
+ buttons[language.valider] = function() {
- var html = _.template($("#" + this.Context.toLowerCase() + "_badge_tpl").html(), {
- user: user
- });
+ var callbackOK = function () {
+ $('a.list_refresh', $container).trigger('click');
+ p4.Dialog.get(2).Close();
+ };
- p4.Feedback.appendBadge(html);
- },
- loadUser : function(usr_id, callback) {
- var $this = this;
+ var name = $('input[name="name"]', p4.Dialog.get(2).getDomElement()).val();
- $.ajax({
- type: 'GET',
- url: '/prod/push/user/' + usr_id + '/',
- dataType: 'json',
- data: {
- usr_id : usr_id
- },
- success: function(data){
- if(typeof callback === 'function')
- {
- callback.call($this, data);
- }
- }
- });
- },
- loadList : function(url, callback) {
- var $this = this;
+ if($.trim(name) === '')
+ {
+ alert(language.listNameCannotBeEmpty);
+ return;
+ }
- $.ajax({
- type: 'GET',
- url: url,
- dataType: 'json',
- success: function(data){
- if(typeof callback === 'function')
- {
- callback.call($this, data);
- }
- }
- });
- },
- appendBadge : function(badge){
- $('.user_content .badges', this.container).append(badge);
- },
- addUser : function($form, callback){
+ p4.Lists.create(name, callbackOK);
+ };
- var $this = this;
+ var options = {
+ cancelButton : true,
+ buttons : buttons,
+ size:'Alert'
+ };
- $.ajax({
- type: 'POST',
- url: '/prod/push/add-user/',
- dataType: 'json',
- data: $form.serializeArray(),
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
- $this.selectUser(data.user);
- callback();
- }
- else
- {
- humane.error(data.message);
- }
- }
- });
- },
- getSelection : function() {
- return this.selection;
- },
- getUsers : function() {
- return $('.user_content .badge', this.container).map(function(){
- return $('input[name="id"]', $(this)).val();
- });
- }
- };
+ p4.Dialog.Create(options, 2).setContent(box);
+ };
+ var html = _.template($("#list_editor_dialog_add_tpl").html());
+ makeDialog(html);
- var ListManager = function($container) {
+ return false;
+ });
- this.list = null;
- this.container = $container;
+ $('li.list a.list_link', $container).bind('click', function(event){
- $('.back_link', this.container).bind('click', function(){
- $('#PushBox').show();
- $('#ListManager').hide();
- return false;
- });
+ var $this = $(this);
- $('a.list_sharer', this.container).die('click').live('click', function(){
+ $this.closest('.lists').find('.list.selected').removeClass('selected');
+ $this.parent('li.list').addClass('selected');
- var $this = $(this),
- options = {
- size : 'Small',
- closeButton : true,
- title : $this.attr('title')
- },
- $dialog = p4.Dialog.Create(options, 2);
+ $.ajax({
+ type: 'GET',
+ url: $this.attr('href'),
+ dataType: 'html',
+ success: function(data){
+ $('.editor', $container).removeClass('loading').append(data);
+ initRight();
+ },
+ beforeSend: function(){
+ $('.editor', $container).empty().addClass('loading');
+ }
+ });
- $dialog.load($this.attr('href'), 'GET');
-
- return false;
- });
-
-
- $('a.user_adder', this.container).bind('click', function(){
-
- var $this = $(this);
-
- $.ajax({
- type: "GET",
- url: $this.attr('href'),
- dataType: 'html',
- beforeSend:function(){
- var options = {
- size : 'Medium',
- title : $this.html()
- };
- p4.Dialog.Create(options, 2).getDomElement().addClass('loading'); },
- success: function(data){
- p4.Dialog.get(2).getDomElement().removeClass('loading').empty().append(data);
- return;
- },
- error: function(){
- p4.Dialog.get(2).Close();
- return;
- },
- timeout: function(){
- p4.Dialog.get(2).Close();
- return;
- }
- });
-
- return false;
- });
-
-
-
- var initLeft = function() {
- $('a.list_refresh', $container).bind('click', function(event){
-
- var callback = function(datas){
- $('.all-lists', $container).removeClass('loading').append(datas);
- initLeft();
+ return false;
+ });
};
- $('.all-lists', $container).empty().addClass('loading');
+ var initRight = function(){
- p4.Lists.get(callback, 'html');
+ var $container = $('#ListManager .editor');
- return false;
- });
+ $('form[name="list-editor-search"]', $container).bind('submit', function(){
- $('a.list_adder', $container).bind('click', function(event){
+ var $this = $(this);
+ var dest = $('.list-editor-results', $container);
- var makeDialog = function (box) {
+ $.ajax({
+ url: $this.attr('action'),
+ type: $this.attr('method'),
+ dataType: "html",
+ data: $this.serializeArray(),
+ beforeSend : function () {
+ dest.empty().addClass('loading');
+ },
+ success: function( datas ) {
- var buttons = {};
+ dest.empty().removeClass('loading').append(datas);
+ }
+ });
+ return false;
+ });
- buttons[language.valider] = function() {
+ $('form[name="list-editor-search"] select, form[name="list-editor-search"] input[name="ListUser"]', $container).bind('change', function(){
+ $(this).closest('form').trigger('submit');
+ });
- var callbackOK = function () {
- $('a.list_refresh', $container).trigger('click');
- p4.Dialog.get(2).Close();
+ $('.EditToggle', $container).bind('click', function(){
+ $('.content.readonly, .content.readwrite', $('#ListManager')).toggle();
+ return false;
+ });
+ $('.Refresher', $container).bind('click', function(){
+ $('#ListManager ul.lists .list.selected a').trigger('click');
+ return false;
+ });
+
+ $('form[name="SaveName"]', $container).bind('submit', function(){
+ var $this = $(this);
+
+ $.ajax({
+ type: $this.attr('method'),
+ url: $this.attr('action'),
+ dataType: 'json',
+ data: $this.serializeArray(),
+ beforeSend:function(){
+
+ },
+ success: function(data){
+ if(data.success)
+ {
+ humane.info(data.message);
+ $('#ListManager .lists .list_refresh').trigger('click');
+ }
+ else
+ {
+ humane.error(data.message);
+ }
+ return;
+ },
+ error: function(){
+
+ return;
+ },
+ timeout: function(){
+
+ return;
+ }
+ });
+
+ return false;
+ });
+
+
+ $('button.deleter', $container).bind('click', function(event){
+
+ var list_id = $(this).find('input[name=list_id]').val();
+
+ var makeDialog = function (box) {
+
+ var buttons = {};
+
+ buttons[language.valider] = function() {
+
+ var callbackOK = function () {
+ $('#ListManager .all-lists a.list_refresh').trigger('click');
+ p4.Dialog.get(2).Close();
+ };
+
+ var List = new document.List(list_id);
+ List.remove(callbackOK);
+ };
+
+ var options = {
+ cancelButton : true,
+ buttons : buttons,
+ size:'Alert'
+ };
+
+ p4.Dialog.Create(options, 2).setContent(box);
+ };
+
+ var html = _.template($("#list_editor_dialog_delete_tpl").html());
+
+ makeDialog(html);
+
+ return false;
+ });
+ };
+
+ initLeft();
+
+ $('.badges a.deleter', this.container).live('click', function(){
+
+ var badge = $(this).closest('.badge');
+
+ var usr_id = badge.find('input[name="id"]').val();
+
+
+ var callback = function(list, datas){
+ $('.counter.current, .list.selected .counter', $('#ListManager')).each(function(){
+ $(this).text(parseInt($(this).text()) - 1);
+ });
+
+ badge.remove();
};
- var name = $('input[name="name"]', p4.Dialog.get(2).getDomElement()).val();
+ p4.ListManager.getList().removeUser(usr_id, callback);
- if($.trim(name) === '')
- {
- alert(language.listNameCannotBeEmpty);
- return;
- }
-
- p4.Lists.create(name, callbackOK);
- };
-
- var options = {
- cancelButton : true,
- buttons : buttons,
- size:'Alert'
- };
-
- p4.Dialog.Create(options, 2).setContent(box);
- };
-
- var html = _.template($("#list_editor_dialog_add_tpl").html());
-
- makeDialog(html);
-
- return false;
- });
-
- $('li.list a.list_link', $container).bind('click', function(event){
-
- var $this = $(this);
-
- $this.closest('.lists').find('.list.selected').removeClass('selected');
- $this.parent('li.list').addClass('selected');
-
- $.ajax({
- type: 'GET',
- url: $this.attr('href'),
- dataType: 'html',
- success: function(data){
- $('.editor', $container).removeClass('loading').append(data);
- initRight();
- },
- beforeSend: function(){
- $('.editor', $container).empty().addClass('loading');
- }
+ return false;
});
- return false;
- });
};
- var initRight = function(){
-
- var $container = $('#ListManager .editor');
-
- $('form[name="list-editor-search"]', $container).bind('submit', function(){
-
- var $this = $(this);
- var dest = $('.list-editor-results', $container);
-
- $.ajax({
- url: $this.attr('action'),
- type: $this.attr('method'),
- dataType: "html",
- data: $this.serializeArray(),
- beforeSend : function () {
- dest.empty().addClass('loading');
- },
- success: function( datas ) {
-
- dest.empty().removeClass('loading').append(datas);
- }
- });
- return false;
- });
-
- $('form[name="list-editor-search"] select, form[name="list-editor-search"] input[name="ListUser"]', $container).bind('change', function(){
- $(this).closest('form').trigger('submit');
- });
-
- $('.EditToggle', $container).bind('click', function(){
- $('.content.readonly, .content.readwrite', $('#ListManager')).toggle();
- return false;
- });
- $('.Refresher', $container).bind('click', function(){
- $('#ListManager ul.lists .list.selected a').trigger('click');
- return false;
- });
-
- $('form[name="SaveName"]', $container).bind('submit', function(){
- var $this = $(this);
-
- $.ajax({
- type: $this.attr('method'),
- url: $this.attr('action'),
- dataType: 'json',
- data: $this.serializeArray(),
- beforeSend:function(){
-
- },
- success: function(data){
- if(data.success)
- {
- humane.info(data.message);
- $('#ListManager .lists .list_refresh').trigger('click');
- }
- else
- {
- humane.error(data.message);
- }
- return;
- },
- error: function(){
-
- return;
- },
- timeout: function(){
-
- return;
- }
- });
-
- return false;
- });
-
-
- $('button.deleter', $container).bind('click', function(event){
-
- var list_id = $(this).find('input[name=list_id]').val();
-
- var makeDialog = function (box) {
-
- var buttons = {};
-
- buttons[language.valider] = function() {
-
- var callbackOK = function () {
- $('#ListManager .all-lists a.list_refresh').trigger('click');
- p4.Dialog.get(2).Close();
- };
-
- var List = new document.List(list_id);
- List.remove(callbackOK);
- };
-
- var options = {
- cancelButton : true,
- buttons : buttons,
- size:'Alert'
- };
-
- p4.Dialog.Create(options, 2).setContent(box);
- };
-
- var html = _.template($("#list_editor_dialog_delete_tpl").html());
-
- makeDialog(html);
-
- return false;
- });
+ ListManager.prototype = {
+ workOn : function(list_id) {
+ this.list = new document.List(list_id);
+ },
+ getList : function(){
+ return this.list;
+ },
+ appendBadge : function(datas) {
+ $('#ListManager .badges').append(datas);
+ }
};
- initLeft();
-
- $('.badges a.deleter', this.container).live('click', function(){
-
- var badge = $(this).closest('.badge');
-
- var usr_id = badge.find('input[name="id"]').val();
- var callback = function(list, datas){
- $('.counter.current, .list.selected .counter', $('#ListManager')).each(function(){
- $(this).text(parseInt($(this).text()) - 1);
- });
-
- badge.remove();
- };
-
- p4.ListManager.getList().removeUser(usr_id, callback);
-
- return false;
- });
-
- };
-
- ListManager.prototype = {
- workOn : function(list_id) {
- this.list = new document.List(list_id);
- },
- getList : function(){
- return this.list;
- },
- appendBadge : function(datas) {
- $('#ListManager .badges').append(datas);
- }
- };
-
-
-
- window.Feedback = Feedback;
- window.ListManager = ListManager;
+ window.Feedback = Feedback;
+ window.ListManager = ListManager;
}(window));
diff --git a/www/skins/prod/jquery.Results.js b/www/skins/prod/jquery.Results.js
index 2322958a52..706acd3fb5 100644
--- a/www/skins/prod/jquery.Results.js
+++ b/www/skins/prod/jquery.Results.js
@@ -2,23 +2,23 @@ var p4 = p4 || {};
(function(p4, window){
- p4.Results = {
+ p4.Results = {
'Selection':new Selectable($('#answers'), {
- selector : '.IMGT',
- limit:800,
- selectStart:function(event, selection){
- $('#answercontextwrap table:visible').hide();
- },
- selectStop:function(event, selection){
- viewNbSelect();
- },
- callbackSelection:function(element){
- var elements = $(element).attr('id').split('_');
+ selector : '.IMGT',
+ limit:800,
+ selectStart:function(event, selection){
+ $('#answercontextwrap table:visible').hide();
+ },
+ selectStop:function(event, selection){
+ viewNbSelect();
+ },
+ callbackSelection:function(element){
+ var elements = $(element).attr('id').split('_');
- return elements.slice(elements.length - 2 ,elements.length).join('_');
- }
+ return elements.slice(elements.length - 2 ,elements.length).join('_');
+ }
})
- };
+ };
- return;
+ return;
}(p4, window));
diff --git a/www/skins/prod/jquery.WorkZone.js b/www/skins/prod/jquery.WorkZone.js
index 7232c22c47..f97508dee8 100644
--- a/www/skins/prod/jquery.WorkZone.js
+++ b/www/skins/prod/jquery.WorkZone.js
@@ -98,20 +98,20 @@ var p4 = p4 || {};
var texte = '' + language.confirmRemoveReg + '
' + language.hideMessage + '
';
$('body').append('
');
$("#DIALOG-baskets").attr('title', language.removeTitle)
- .empty()
- .append(texte)
- .dialog({
- autoOpen: false,
- closeOnEscape: true,
- resizable: false,
- draggable: false,
- modal: true,
- buttons: buttons,
- overlay: {
- backgroundColor: '#000',
- opacity: 0.7
- }
- }).dialog('open');
+ .empty()
+ .append(texte)
+ .dialog({
+ autoOpen: false,
+ closeOnEscape: true,
+ resizable: false,
+ draggable: false,
+ modal: true,
+ buttons: buttons,
+ overlay: {
+ backgroundColor: '#000',
+ opacity: 0.7
+ }
+ }).dialog('open');
return;
}
@@ -145,11 +145,11 @@ var p4 = p4 || {};
if (selectedItemIndex === 0 && carouselItemLength > 1) {
// click next item
selectedItem.next().find("img").trigger("click");
- // item is last item and list has at least 2 items
+ // item is last item and list has at least 2 items
} else if (carouselItemLength > 1 && selectedItemIndex === (carouselItemLength - 1)) {
// click previous item
selectedItem.prev().find("img").trigger("click");
- // Basket is empty
+ // Basket is empty
} else if (carouselItemLength > 1) {
// click next item
selectedItem.next().find("img").trigger("click");
@@ -236,24 +236,24 @@ var p4 = p4 || {};
}
$(".SSTT, .content", cache)
- .droppable({
- scope: 'objects',
- hoverClass: 'baskDrop',
- tolerance: 'pointer',
- accept: function(elem) {
- if ($(elem).hasClass('CHIM')) {
- if ($(elem).closest('.content').prev()[0] === $(this)[0]) {
- return false;
+ .droppable({
+ scope: 'objects',
+ hoverClass: 'baskDrop',
+ tolerance: 'pointer',
+ accept: function(elem) {
+ if ($(elem).hasClass('CHIM')) {
+ if ($(elem).closest('.content').prev()[0] === $(this)[0]) {
+ return false;
+ }
}
+ if ($(elem).hasClass('grouping') || $(elem).parent()[0] === $(this)[0])
+ return false;
+ return true;
+ },
+ drop: function(event, ui) {
+ dropOnBask(event, ui.draggable, $(this));
}
- if ($(elem).hasClass('grouping') || $(elem).parent()[0] === $(this)[0])
- return false;
- return true;
- },
- drop: function(event, ui) {
- dropOnBask(event, ui.draggable, $(this));
- }
- });
+ });
if ($('#basketcontextwrap').length === 0)
$('body').append('
');
@@ -312,8 +312,8 @@ var p4 = p4 || {};
$('a.WorkZoneElementRemover', dest).bind('mousedown', function(event) {
return false;
}).bind('click', function(event) {
- return WorkZoneElementRemover($(this), false);
- });
+ return WorkZoneElementRemover($(this), false);
+ });
dest.droppable({
accept: function(elem) {
@@ -339,10 +339,10 @@ var p4 = p4 || {};
dest.find('.CHIM').draggable({
helper: function() {
$('body').append('' +
- '
' +
- p4.WorkZone.Selection.length() + '
');
+ 'style="position:absolute;z-index:9999;background:red;' +
+ '-moz-border-radius:8px;-webkit-border-radius:8px;">' +
+ '' +
+ p4.WorkZone.Selection.length() + '
');
return $('#dragDropCursor');
},
scope: "objects",
@@ -356,7 +356,7 @@ var p4 = p4 || {};
start: function(event, ui) {
var baskets = $('#baskets');
baskets.append('
' +
- '
');
+ '
');
$('.bottom-scroller', baskets).bind('mousemove', function() {
$('#baskets .bloc').scrollTop($('#baskets .bloc').scrollTop() + 30);
});
@@ -366,8 +366,8 @@ var p4 = p4 || {};
},
stop: function() {
$('#baskets').find('.top-scroller, .bottom-scroller')
- .unbind()
- .remove();
+ .unbind()
+ .remove();
},
drag: function(event, ui) {
if (is_ctrl_key(event) || $(this).closest('.content').hasClass('grouping'))
@@ -572,13 +572,13 @@ var p4 = p4 || {};
frame.data('openwidth', frame.width());
frame.animate({width: 100},
- 300,
- 'linear',
- function() {
- answerSizer();
- linearize();
- $('#answers').trigger('resize');
- });
+ 300,
+ 'linear',
+ function() {
+ answerSizer();
+ linearize();
+ $('#answers').trigger('resize');
+ });
frame.addClass('closed');
$('.escamote', frame).hide();
$('li.ui-tabs-selected', frame).removeClass('ui-tabs-selected');
diff --git a/www/skins/prod/jquery.edit.js b/www/skins/prod/jquery.edit.js
index 9eadd155d8..d5e07f26a1 100644
--- a/www/skins/prod/jquery.edit.js
+++ b/www/skins/prod/jquery.edit.js
@@ -1,61 +1,61 @@
function initializeEdit()
{
- p4.edit = {};
- p4.edit.curField = "?";
- p4.edit.editBox = $('#idFrameE');
- p4.edit.textareaIsDirty = false;
- p4.edit.fieldLastValue = "";
- p4.edit.lastClickId = null;
- p4.edit.sbas_id = false;
- p4.edit.what = false;
- p4.edit.regbasprid = false;
- p4.edit.newrepresent = false;
- p4.edit.ssel = false;
+ p4.edit = {};
+ p4.edit.curField = "?";
+ p4.edit.editBox = $('#idFrameE');
+ p4.edit.textareaIsDirty = false;
+ p4.edit.fieldLastValue = "";
+ p4.edit.lastClickId = null;
+ p4.edit.sbas_id = false;
+ p4.edit.what = false;
+ p4.edit.regbasprid = false;
+ p4.edit.newrepresent = false;
+ p4.edit.ssel = false;
}
$(document).ready(function(){
- $(window).bind('resize',function(){
- setPreviewEdit();
- setSizeLimits();
- });
+ $(window).bind('resize',function(){
+ setPreviewEdit();
+ setSizeLimits();
+ });
});
function setSizeLimits()
{
- if(!$('#EDITWINDOW').is(':visible'))
- return;
+ if(!$('#EDITWINDOW').is(':visible'))
+ return;
- if ($('#EDIT_TOP').data("ui-resizable")) {
- $('#EDIT_TOP').resizable('option','maxHeight', ($('#EDIT_ALL').height() - $('#buttonEditing').height() - 10 - 160));
- }
- if ($('#divS_wrapper').data("ui-resizable")) {
- $('#divS_wrapper').resizable('option','maxWidth', ($('#EDIT_MID_L').width() - 270));
- }
- if ($('#EDIT_MID_R').data("ui-resizable")) {
- $('#EDIT_MID_R').resizable('option','maxWidth', ($('#EDIT_MID_R').width() + $('#idEditZone').width() - 240));
- }
+ if ($('#EDIT_TOP').data("ui-resizable")) {
+ $('#EDIT_TOP').resizable('option','maxHeight', ($('#EDIT_ALL').height() - $('#buttonEditing').height() - 10 - 160));
+ }
+ if ($('#divS_wrapper').data("ui-resizable")) {
+ $('#divS_wrapper').resizable('option','maxWidth', ($('#EDIT_MID_L').width() - 270));
+ }
+ if ($('#EDIT_MID_R').data("ui-resizable")) {
+ $('#EDIT_MID_R').resizable('option','maxWidth', ($('#EDIT_MID_R').width() + $('#idEditZone').width() - 240));
+ }
}
function edit_kdwn(evt, src)
{
- cancelKey = false;
+ cancelKey = false;
- switch(evt.keyCode)
- {
- case 13:
- case 10:
- if(p4.edit.T_fields[p4.edit.curField].type == "date")
- cancelKey = true;
- }
+ switch(evt.keyCode)
+ {
+ case 13:
+ case 10:
+ if(p4.edit.T_fields[p4.edit.curField].type == "date")
+ cancelKey = true;
+ }
- if(cancelKey)
- {
- evt.cancelBubble = true;
- if(evt.stopPropagation)
- evt.stopPropagation();
- return(false);
- }
- return(true);
+ if(cancelKey)
+ {
+ evt.cancelBubble = true;
+ if(evt.stopPropagation)
+ evt.stopPropagation();
+ return(false);
+ }
+ return(true);
}
// ----------------------------------------------------------------------------------------------
@@ -63,57 +63,57 @@ function edit_kdwn(evt, src)
// ----------------------------------------------------------------------------------------------
function edit_mdwn_ta(evt)
{
- evt.cancelBubble = true;
- return(true);
+ evt.cancelBubble = true;
+ return(true);
}
// mouse up textarea
function edit_mup_ta(evt, obj)
{
- if(p4.edit.T_fields[p4.edit.curField].tbranch)
- {
- if(obj.value != "")
- ETHSeeker.search(obj.value);
- }
- return(true);
+ if(p4.edit.T_fields[p4.edit.curField].tbranch)
+ {
+ if(obj.value != "")
+ ETHSeeker.search(obj.value);
+ }
+ return(true);
}
// key up textarea
function edit_kup_ta(evt, obj)
{
- var cancelKey = false;
- var o;
- switch(evt.keyCode)
- {
- case 27: // esc : on restore la valeur avant editing
- // $("#btn_cancel", p4.edit.editBox).parent().css("backgroundColor", "#000000");
- edit_validField(evt, "cancel");
- // self.setTimeout("document.getElementById('btn_cancel').parentNode.style.backgroundColor = '';", 100);
- cancelKey = true;
- break;
- }
+ var cancelKey = false;
+ var o;
+ switch(evt.keyCode)
+ {
+ case 27: // esc : on restore la valeur avant editing
+ // $("#btn_cancel", p4.edit.editBox).parent().css("backgroundColor", "#000000");
+ edit_validField(evt, "cancel");
+ // self.setTimeout("document.getElementById('btn_cancel').parentNode.style.backgroundColor = '';", 100);
+ cancelKey = true;
+ break;
+ }
- if(cancelKey)
- {
- evt.cancelBubble = true;
- if(evt.stopPropagation)
- evt.stopPropagation();
- return(false);
- }
- if(!p4.edit.textareaIsDirty && ($("#idEditZTextArea", p4.edit.editBox).val() != p4.edit.fieldLastValue))
- {
- p4.edit.textareaIsDirty = true;
- }
+ if(cancelKey)
+ {
+ evt.cancelBubble = true;
+ if(evt.stopPropagation)
+ evt.stopPropagation();
+ return(false);
+ }
+ if(!p4.edit.textareaIsDirty && ($("#idEditZTextArea", p4.edit.editBox).val() != p4.edit.fieldLastValue))
+ {
+ p4.edit.textareaIsDirty = true;
+ }
- var s = obj.value;
- if(p4.edit.T_fields[p4.edit.curField].tbranch)
- {
- if(s != "")
- ETHSeeker.search(s);
- }
- return(true);
+ var s = obj.value;
+ if(p4.edit.T_fields[p4.edit.curField].tbranch)
+ {
+ if(s != "")
+ ETHSeeker.search(s);
+ }
+ return(true);
}
// ---------------------------------------------------------------------------
@@ -121,12 +121,12 @@ function edit_kup_ta(evt, obj)
// ---------------------------------------------------------------------------
function edit_mdwn_status(evt)
{
- if(!p4.edit.textareaIsDirty || edit_validField(evt, "ask_ok")==true)
- editStatus(evt);
- evt.cancelBubble = true;
- if(evt.stopPropagation)
- evt.stopPropagation();
- return(false);
+ if(!p4.edit.textareaIsDirty || edit_validField(evt, "ask_ok")==true)
+ editStatus(evt);
+ evt.cancelBubble = true;
+ if(evt.stopPropagation)
+ evt.stopPropagation();
+ return(false);
}
// ---------------------------------------------------------------------------
@@ -134,8 +134,8 @@ function edit_mdwn_status(evt)
// ---------------------------------------------------------------------------
function edit_mdwn_fld(evt, meta_struct_id, fieldname)
{
- if(!p4.edit.textareaIsDirty || edit_validField(evt, "ask_ok")==true)
- editField(evt, meta_struct_id);
+ if(!p4.edit.textareaIsDirty || edit_validField(evt, "ask_ok")==true)
+ editField(evt, meta_struct_id);
}
// ---------------------------------------------------------------------------
@@ -143,23 +143,23 @@ function edit_mdwn_fld(evt, meta_struct_id, fieldname)
// ---------------------------------------------------------------------------
function edit_chgFld(evt, dir)
{
- var current_field = $('#divS .edit_field.active');
- if(current_field.length == 0)
- {
- current_field = $('#divS .edit_field:first');
- current_field.trigger('click');
- }
- else
- {
- if(dir >= 0)
+ var current_field = $('#divS .edit_field.active');
+ if(current_field.length == 0)
{
- current_field.next().trigger('click');
+ current_field = $('#divS .edit_field:first');
+ current_field.trigger('click');
}
else
{
- current_field.prev().trigger('click');
+ if(dir >= 0)
+ {
+ current_field.next().trigger('click');
+ }
+ else
+ {
+ current_field.prev().trigger('click');
+ }
}
- }
}
// ---------------------------------------------------------------------------
@@ -167,41 +167,41 @@ function edit_chgFld(evt, dir)
// ---------------------------------------------------------------------------
function editStatus(evt)
{
- $(".editDiaButtons", p4.edit.editBox).hide();
+ $(".editDiaButtons", p4.edit.editBox).hide();
- document.getElementById('idEditZTextArea').blur();
- document.getElementById('EditTextMultiValued').blur();
+ document.getElementById('idEditZTextArea').blur();
+ document.getElementById('EditTextMultiValued').blur();
- $("#idFieldNameEdit", p4.edit.editBox).html("[STATUS]") ;
- $("#idExplain", p4.edit.editBox).html(" ");
+ $("#idFieldNameEdit", p4.edit.editBox).html("[STATUS]") ;
+ $("#idExplain", p4.edit.editBox).html(" ");
- $("#ZTextMultiValued", p4.edit.editBox).hide();
- $("#ZTextMonoValued", p4.edit.editBox).hide();
- $("#ZTextStatus", p4.edit.editBox).show();
+ $("#ZTextMultiValued", p4.edit.editBox).hide();
+ $("#ZTextMonoValued", p4.edit.editBox).hide();
+ $("#ZTextStatus", p4.edit.editBox).show();
- $("#idEditZone", p4.edit.editBox).show();
+ $("#idEditZone", p4.edit.editBox).show();
- document.getElementById("editFakefocus").focus();
- p4.edit.curField = -1;
- activeField();
+ document.getElementById("editFakefocus").focus();
+ p4.edit.curField = -1;
+ activeField();
}
function activeField()
{
- var meta_struct_id = parseInt(p4.edit.curField);
+ var meta_struct_id = parseInt(p4.edit.curField);
- meta_struct_id = (isNaN(meta_struct_id) || meta_struct_id <0)?'status':meta_struct_id;
+ meta_struct_id = (isNaN(meta_struct_id) || meta_struct_id <0)?'status':meta_struct_id;
- $('#divS div.active, #divS div.hover').removeClass('active hover');
- $('#EditFieldBox_'+meta_struct_id).addClass('active');
+ $('#divS div.active, #divS div.hover').removeClass('active hover');
+ $('#EditFieldBox_'+meta_struct_id).addClass('active');
- var cont = $('#divS');
- var calc = $('#EditFieldBox_'+meta_struct_id).offset().top - cont.offset().top;// hauteur relative par rapport au visible
+ var cont = $('#divS');
+ var calc = $('#EditFieldBox_'+meta_struct_id).offset().top - cont.offset().top;// hauteur relative par rapport au visible
- if(calc > cont.height() || calc <0)
- {
- cont.scrollTop(calc + cont.scrollTop());
- }
+ if(calc > cont.height() || calc <0)
+ {
+ cont.scrollTop(calc + cont.scrollTop());
+ }
}
//// ---------------------------------------------------------------------------
@@ -210,257 +210,257 @@ function activeField()
function editField(evt, meta_struct_id)
{
- document.getElementById('idEditZTextArea').blur();
- document.getElementById('EditTextMultiValued').blur();
- $(".editDiaButtons", p4.edit.editBox).hide();
-
- $('#idEditZTextArea, #EditTextMultiValued').unbind('keyup.maxLength');
-
- p4.edit.curField = meta_struct_id;
- if(meta_struct_id >= 0)
- {
- var name = p4.edit.T_fields[meta_struct_id].label + (p4.edit.T_fields[meta_struct_id].required ? '
* ' : '');
- $("#idFieldNameEdit", p4.edit.editBox).html(name) ;
-
- var vocabType = p4.edit.T_fields[meta_struct_id].vocabularyControl;
-
- $('#idEditZTextArea, #EditTextMultiValued').autocomplete({
- minLength: 2,
- source: function( request, response ) {
- $.ajax({
- url: '../prod/records/edit/vocabulary/' + vocabType + '/',
- dataType: "json",
- data: {
- sbas_id: p4.edit.sbas_id,
- query: request.term
- },
- success: function( data ) {
- response( data.results );
- }
- });
- },
- select: function( event, ui ) {
-
- edit_addmval(ui.item.label, ui.item.id);
-
- return false;
- }
- });
-
-
- if(p4.edit.T_fields[meta_struct_id].maxLength > 0)
- {
- var idexplain = $("#idExplain");
- idexplain.html('');
-
- $('#idEditZTextArea, #EditTextMultiValued').bind('keyup.maxLength', function(){
- var remaining = Math.max((p4.edit.T_fields[meta_struct_id].maxLength - $(this).val().length), 0);
- idexplain.html("
Caracteres restants : "+(remaining)+"");
- $('.metadatas_restrictionsTips', idexplain).tooltip();
- }).trigger('keyup.maxLength');
- }
- else
- {
- $("#idExplain").html("");
- }
-
- if(!p4.edit.T_fields[meta_struct_id].multi)
- {
- // champ monovalue : textarea
- $(".editDiaButtons", p4.edit.editBox).hide();
-
- if(p4.edit.T_fields[meta_struct_id].type == "date")
- {
- $("#idEditZTextArea", p4.edit.editBox).css("height", "16px");
- $("#idEditDateZone", p4.edit.editBox).show();
- }
- else
- {
- $("#idEditDateZone", p4.edit.editBox).hide();
- $("#idEditZTextArea", p4.edit.editBox).css("height", "100%");
- }
-
- $("#ZTextStatus", p4.edit.editBox).hide();
- $("#ZTextMultiValued", p4.edit.editBox).hide();
- $("#ZTextMonoValued", p4.edit.editBox).show();
-
- if(p4.edit.T_fields[meta_struct_id]._status == 2)
- {
- // heterogene
- $("#idEditZTextArea", p4.edit.editBox).val(p4.edit.fieldLastValue = "") ;
- $("#idEditZTextArea", p4.edit.editBox).addClass("hetero");
- $("#idDivButtons", p4.edit.editBox).show(); // valeurs h�t�rog�nes : les 3 boutons remplacer/ajouter/annuler
- }
- else
- {
- // homogene
- $("#idEditZTextArea", p4.edit.editBox).val(p4.edit.fieldLastValue = p4.edit.T_fields[meta_struct_id]._value);
- $("#idEditZTextArea", p4.edit.editBox).removeClass("hetero");
-
- $("#idDivButtons", p4.edit.editBox).hide(); // valeurs homog�nes
- if(p4.edit.T_fields[meta_struct_id].type == "date")
- {
- var v = p4.edit.T_fields[meta_struct_id]._value.split(' ');
- d = v[0].split('/');
- var dateObj = new Date();
- if(d.length == 3)
- {
- dateObj.setYear(d[0]);
- dateObj.setMonth((d[1]-1));
- dateObj.setDate(d[2]);
- }
-
- if ($("#idEditDateZone", p4.edit.editBox).data("ui-datepicker")) {
- $("#idEditDateZone", p4.edit.editBox).datepicker('setDate', dateObj);
- }
- }
- }
- p4.edit.textareaIsDirty = false;
-
- $("#idEditZone", p4.edit.editBox).show();
-
- $('#idEditZTextArea').trigger('keyup.maxLength');
-
- self.setTimeout("document.getElementById('idEditZTextArea').focus();", 50);
- }
- else
- {
- // champ multivalue : liste
- $("#ZTextStatus", p4.edit.editBox).hide();
- $("#ZTextMonoValued", p4.edit.editBox).hide();
- $("#ZTextMultiValued", p4.edit.editBox).show();
-
- $("#idDivButtons", p4.edit.editBox).hide(); // valeurs homogenes
-
- updateCurrentMval(meta_struct_id);
-
- $('#EditTextMultiValued', p4.edit.editBox).val("");
- $('#idEditZone', p4.edit.editBox).show();
-
- $('#EditTextMultiValued').trigger('keyup.maxLength');
-
- self.setTimeout("document.getElementById('EditTextMultiValued').focus();", 50);
-
-// reveal_mval();
- }
- }
- else
- {
- // pas de champ, masquer la zone du textarea
- $("#idEditZone", p4.edit.editBox).hide();
+ document.getElementById('idEditZTextArea').blur();
+ document.getElementById('EditTextMultiValued').blur();
$(".editDiaButtons", p4.edit.editBox).hide();
- }
- activeField();
+ $('#idEditZTextArea, #EditTextMultiValued').unbind('keyup.maxLength');
+
+ p4.edit.curField = meta_struct_id;
+ if(meta_struct_id >= 0)
+ {
+ var name = p4.edit.T_fields[meta_struct_id].label + (p4.edit.T_fields[meta_struct_id].required ? '
* ' : '');
+ $("#idFieldNameEdit", p4.edit.editBox).html(name) ;
+
+ var vocabType = p4.edit.T_fields[meta_struct_id].vocabularyControl;
+
+ $('#idEditZTextArea, #EditTextMultiValued').autocomplete({
+ minLength: 2,
+ source: function( request, response ) {
+ $.ajax({
+ url: '../prod/records/edit/vocabulary/' + vocabType + '/',
+ dataType: "json",
+ data: {
+ sbas_id: p4.edit.sbas_id,
+ query: request.term
+ },
+ success: function( data ) {
+ response( data.results );
+ }
+ });
+ },
+ select: function( event, ui ) {
+
+ edit_addmval(ui.item.label, ui.item.id);
+
+ return false;
+ }
+ });
+
+
+ if(p4.edit.T_fields[meta_struct_id].maxLength > 0)
+ {
+ var idexplain = $("#idExplain");
+ idexplain.html('');
+
+ $('#idEditZTextArea, #EditTextMultiValued').bind('keyup.maxLength', function(){
+ var remaining = Math.max((p4.edit.T_fields[meta_struct_id].maxLength - $(this).val().length), 0);
+ idexplain.html("
Caracteres restants : "+(remaining)+"");
+ $('.metadatas_restrictionsTips', idexplain).tooltip();
+ }).trigger('keyup.maxLength');
+ }
+ else
+ {
+ $("#idExplain").html("");
+ }
+
+ if(!p4.edit.T_fields[meta_struct_id].multi)
+ {
+ // champ monovalue : textarea
+ $(".editDiaButtons", p4.edit.editBox).hide();
+
+ if(p4.edit.T_fields[meta_struct_id].type == "date")
+ {
+ $("#idEditZTextArea", p4.edit.editBox).css("height", "16px");
+ $("#idEditDateZone", p4.edit.editBox).show();
+ }
+ else
+ {
+ $("#idEditDateZone", p4.edit.editBox).hide();
+ $("#idEditZTextArea", p4.edit.editBox).css("height", "100%");
+ }
+
+ $("#ZTextStatus", p4.edit.editBox).hide();
+ $("#ZTextMultiValued", p4.edit.editBox).hide();
+ $("#ZTextMonoValued", p4.edit.editBox).show();
+
+ if(p4.edit.T_fields[meta_struct_id]._status == 2)
+ {
+ // heterogene
+ $("#idEditZTextArea", p4.edit.editBox).val(p4.edit.fieldLastValue = "") ;
+ $("#idEditZTextArea", p4.edit.editBox).addClass("hetero");
+ $("#idDivButtons", p4.edit.editBox).show(); // valeurs h�t�rog�nes : les 3 boutons remplacer/ajouter/annuler
+ }
+ else
+ {
+ // homogene
+ $("#idEditZTextArea", p4.edit.editBox).val(p4.edit.fieldLastValue = p4.edit.T_fields[meta_struct_id]._value);
+ $("#idEditZTextArea", p4.edit.editBox).removeClass("hetero");
+
+ $("#idDivButtons", p4.edit.editBox).hide(); // valeurs homog�nes
+ if(p4.edit.T_fields[meta_struct_id].type == "date")
+ {
+ var v = p4.edit.T_fields[meta_struct_id]._value.split(' ');
+ d = v[0].split('/');
+ var dateObj = new Date();
+ if(d.length == 3)
+ {
+ dateObj.setYear(d[0]);
+ dateObj.setMonth((d[1]-1));
+ dateObj.setDate(d[2]);
+ }
+
+ if ($("#idEditDateZone", p4.edit.editBox).data("ui-datepicker")) {
+ $("#idEditDateZone", p4.edit.editBox).datepicker('setDate', dateObj);
+ }
+ }
+ }
+ p4.edit.textareaIsDirty = false;
+
+ $("#idEditZone", p4.edit.editBox).show();
+
+ $('#idEditZTextArea').trigger('keyup.maxLength');
+
+ self.setTimeout("document.getElementById('idEditZTextArea').focus();", 50);
+ }
+ else
+ {
+ // champ multivalue : liste
+ $("#ZTextStatus", p4.edit.editBox).hide();
+ $("#ZTextMonoValued", p4.edit.editBox).hide();
+ $("#ZTextMultiValued", p4.edit.editBox).show();
+
+ $("#idDivButtons", p4.edit.editBox).hide(); // valeurs homogenes
+
+ updateCurrentMval(meta_struct_id);
+
+ $('#EditTextMultiValued', p4.edit.editBox).val("");
+ $('#idEditZone', p4.edit.editBox).show();
+
+ $('#EditTextMultiValued').trigger('keyup.maxLength');
+
+ self.setTimeout("document.getElementById('EditTextMultiValued').focus();", 50);
+
+// reveal_mval();
+ }
+ }
+ else
+ {
+ // pas de champ, masquer la zone du textarea
+ $("#idEditZone", p4.edit.editBox).hide();
+ $(".editDiaButtons", p4.edit.editBox).hide();
+
+ }
+ activeField();
}
function updateCurrentMval(meta_struct_id, HighlightValue, vocabularyId)
{
- // on compare toutes les valeurs de chaque fiche selectionnee
- p4.edit.T_mval = []; // tab des mots, pour trier
- var a = []; // key : mot ; val : nbr d'occurences distinctes
- var n = 0; // le nbr de records selectionnes
+ // on compare toutes les valeurs de chaque fiche selectionnee
+ p4.edit.T_mval = []; // tab des mots, pour trier
+ var a = []; // key : mot ; val : nbr d'occurences distinctes
+ var n = 0; // le nbr de records selectionnes
- for(r in p4.edit.T_records)
- {
- if(!p4.edit.T_records[r]._selected)
- continue;
-
- p4.edit.T_records[r].fields[meta_struct_id].sort(SortCompareMetas);
-
- var values = p4.edit.T_records[r].fields[meta_struct_id].getValues();
-
- for(v in values)
+ for(r in p4.edit.T_records)
{
- var word = values[v].getValue();
- var key = values[v].getVocabularyId() + '%' + word;
+ if(!p4.edit.T_records[r]._selected)
+ continue;
- if(typeof(a[key]) == 'undefined')
- {
- a[key] = {
- 'n':0,
- 'f':new Array()
- }; // n:nbr d'occurences DISTINCTES du mot ; f:flag presence mot dans r
- p4.edit.T_mval.push(values[v]);
- }
+ p4.edit.T_records[r].fields[meta_struct_id].sort(SortCompareMetas);
- if(!a[key].f[r])
- a[key].n++; // premiere apparition du mot dans le record r
- a[key].f[r] = true; // on ne recomptera pas le mot s'il apparait a nouveau dans le meme record
+ var values = p4.edit.T_records[r].fields[meta_struct_id].getValues();
- }
-
- n++;
- }
-
- p4.edit.T_mval.sort(SortCompareMetas);
-
- var t = "";
- for(var i in p4.edit.T_mval) // pour lire le tableau 'a' dans l'ordre trie par 'p4.edit.T_mval'
- {
- var value = p4.edit.T_mval[i];
- var word = value.getValue();
- var key = value.getVocabularyId() + '%' + word;
-
- var extra = value.getVocabularyId() ? '
' : '';
-
- if(i>0)
- {
- if(value.getVocabularyId() !== null && p4.edit.T_mval[i-1].getVocabularyId() == value.getVocabularyId())
- {
- continue;
- }
- if(value.getVocabularyId() === null && p4.edit.T_mval[i-1].getVocabularyId() === null)
- {
- if(p4.edit.T_mval[i-1].getValue() == value.getValue())
+ for(v in values)
{
- continue; // on n'accepte pas les doublons
+ var word = values[v].getValue();
+ var key = values[v].getVocabularyId() + '%' + word;
+
+ if(typeof(a[key]) == 'undefined')
+ {
+ a[key] = {
+ 'n':0,
+ 'f':new Array()
+ }; // n:nbr d'occurences DISTINCTES du mot ; f:flag presence mot dans r
+ p4.edit.T_mval.push(values[v]);
+ }
+
+ if(!a[key].f[r])
+ a[key].n++; // premiere apparition du mot dans le record r
+ a[key].f[r] = true; // on ne recomptera pas le mot s'il apparait a nouveau dans le meme record
+
}
- }
+
+ n++;
}
- t += "
"
- + '
'
- + extra
- + ''
- + $('
').text(word).html()
- + " "
- + ' '
- + ' '
- + "
"
- + "
";
- }
- $('#ZTextMultiValued_values', p4.edit.editBox).html(t);
+ p4.edit.T_mval.sort(SortCompareMetas);
- $('#ZTextMultiValued_values .add_all', p4.edit.editBox).unbind('click').bind('click', function(){
- var container = $(this).closest('div');
+ var t = "";
+ for(var i in p4.edit.T_mval) // pour lire le tableau 'a' dans l'ordre trie par 'p4.edit.T_mval'
+ {
+ var value = p4.edit.T_mval[i];
+ var word = value.getValue();
+ var key = value.getVocabularyId() + '%' + word;
- var span = $('span.value', container)
+ var extra = value.getVocabularyId() ? '
' : '';
- var value = span.text();
- var vocab_id = span.attr('vocabid');
+ if(i>0)
+ {
+ if(value.getVocabularyId() !== null && p4.edit.T_mval[i-1].getVocabularyId() == value.getVocabularyId())
+ {
+ continue;
+ }
+ if(value.getVocabularyId() === null && p4.edit.T_mval[i-1].getVocabularyId() === null)
+ {
+ if(p4.edit.T_mval[i-1].getValue() == value.getValue())
+ {
+ continue; // on n'accepte pas les doublons
+ }
+ }
+ }
+
+ t += "
"
+ + '
'
+ + extra
+ + ''
+ + $('
').text(word).html()
+ + " "
+ + ' '
+ + ' '
+ + "
"
+ + "
";
+ }
+ $('#ZTextMultiValued_values', p4.edit.editBox).html(t);
+
+ $('#ZTextMultiValued_values .add_all', p4.edit.editBox).unbind('click').bind('click', function(){
+ var container = $(this).closest('div');
+
+ var span = $('span.value', container)
+
+ var value = span.text();
+ var vocab_id = span.attr('vocabid');
+
+ edit_addmval(value, vocab_id);
+ updateFieldDisplay();
+ return false;
+ });
+ $('#ZTextMultiValued_values .remove_all', p4.edit.editBox).unbind('click').bind('click', function(){
+ var container = $(this).closest('div');
+
+ var span = $('span.value', container)
+
+ var value = span.text();
+ var vocab_id = span.attr('vocabid');
+
+ edit_delmval(value, vocab_id);
+ updateFieldDisplay();
+ return false;
+ });
- edit_addmval(value, vocab_id);
updateFieldDisplay();
- return false;
- });
- $('#ZTextMultiValued_values .remove_all', p4.edit.editBox).unbind('click').bind('click', function(){
- var container = $(this).closest('div');
-
- var span = $('span.value', container)
-
- var value = span.text();
- var vocab_id = span.attr('vocabid');
-
- edit_delmval(value, vocab_id);
- updateFieldDisplay();
- return false;
- });
-
- updateFieldDisplay();
}
@@ -469,9 +469,9 @@ function updateCurrentMval(meta_struct_id, HighlightValue, vocabularyId)
// ---------------------------------------------------------------------------
function edit_clkmval(mvaldiv, ival)
{
- $(mvaldiv).parent().find('.hilighted').removeClass('hilighted');
- $(mvaldiv).addClass('hilighted');
- reveal_mval(p4.edit.T_mval[ival].getValue(), p4.edit.T_mval[ival].getVocabularyId());
+ $(mvaldiv).parent().find('.hilighted').removeClass('hilighted');
+ $(mvaldiv).addClass('hilighted');
+ reveal_mval(p4.edit.T_mval[ival].getValue(), p4.edit.T_mval[ival].getVocabularyId());
}
@@ -481,68 +481,68 @@ function edit_clkmval(mvaldiv, ival)
// ---------------------------------------------------------------------------
function reveal_mval(value, vocabularyId)
{
- if(typeof vocabularyId === 'undefined')
- vocabularyId = null;
+ if(typeof vocabularyId === 'undefined')
+ vocabularyId = null;
- var textZone = $('#EditTextMultiValued');
+ var textZone = $('#EditTextMultiValued');
- if(p4.edit.T_fields[p4.edit.curField].tbranch)
- {
- if(value != "")
- ETHSeeker.search(value);
- }
-
- if(value != "")
- {
- // var nsel = 0;
- for(rec_i in p4.edit.T_records)
+ if(p4.edit.T_fields[p4.edit.curField].tbranch)
{
- if(p4.edit.T_records[rec_i].fields[p4.edit.curField].hasValue(value, vocabularyId))
- {
- $("#idEditDiaButtonsP_"+rec_i).hide();
- var talt = $.sprintf(language.editDelSimple,value);
- $("#idEditDiaButtonsM_"+rec_i).show()
- .attr('alt', talt)
- .attr('Title', talt)
- .unbind('click').bind('click', function(){
- var indice = $(this).attr('id').split('_').pop();
- edit_diabutton(indice, 'del', value, vocabularyId);
- });
- }
- else
- {
- $("#idEditDiaButtonsM_"+rec_i).hide();
- $("#idEditDiaButtonsP_"+rec_i).show();
- var talt = $.sprintf(language.editAddSimple,value);
- $("#idEditDiaButtonsP_"+rec_i).show().attr('alt', talt)
- .attr('Title', talt)
- .unbind('click').bind('click', function(){
- var indice = $(this).attr('id').split('_').pop();
- edit_diabutton(indice, 'add', value, vocabularyId);
- });
- }
+ if(value != "")
+ ETHSeeker.search(value);
}
- $(".editDiaButtons", p4.edit.editBox).show();
- }
- textZone.trigger('focus');
- return(true);
+ if(value != "")
+ {
+ // var nsel = 0;
+ for(rec_i in p4.edit.T_records)
+ {
+ if(p4.edit.T_records[rec_i].fields[p4.edit.curField].hasValue(value, vocabularyId))
+ {
+ $("#idEditDiaButtonsP_"+rec_i).hide();
+ var talt = $.sprintf(language.editDelSimple,value);
+ $("#idEditDiaButtonsM_"+rec_i).show()
+ .attr('alt', talt)
+ .attr('Title', talt)
+ .unbind('click').bind('click', function(){
+ var indice = $(this).attr('id').split('_').pop();
+ edit_diabutton(indice, 'del', value, vocabularyId);
+ });
+ }
+ else
+ {
+ $("#idEditDiaButtonsM_"+rec_i).hide();
+ $("#idEditDiaButtonsP_"+rec_i).show();
+ var talt = $.sprintf(language.editAddSimple,value);
+ $("#idEditDiaButtonsP_"+rec_i).show().attr('alt', talt)
+ .attr('Title', talt)
+ .unbind('click').bind('click', function(){
+ var indice = $(this).attr('id').split('_').pop();
+ edit_diabutton(indice, 'add', value, vocabularyId);
+ });
+ }
+ }
+ $(".editDiaButtons", p4.edit.editBox).show();
+ }
+
+ textZone.trigger('focus');
+ return(true);
}
function edit_diabutton(record_indice, act, value, vocabularyId)
{
- var meta_struct_id = p4.edit.curField; // le champ en cours d'editing
- if(act == 'del')
- {
- p4.edit.T_records[record_indice].fields[meta_struct_id].removeValue(value, vocabularyId);
- }
+ var meta_struct_id = p4.edit.curField; // le champ en cours d'editing
+ if(act == 'del')
+ {
+ p4.edit.T_records[record_indice].fields[meta_struct_id].removeValue(value, vocabularyId);
+ }
- if(act=='add')
- {
- p4.edit.T_records[record_indice].fields[meta_struct_id].addValue(value, false, vocabularyId);
- }
- updateCurrentMval(meta_struct_id, value, vocabularyId);
- reveal_mval(value, vocabularyId);
+ if(act=='add')
+ {
+ p4.edit.T_records[record_indice].fields[meta_struct_id].addValue(value, false, vocabularyId);
+ }
+ updateCurrentMval(meta_struct_id, value, vocabularyId);
+ reveal_mval(value, vocabularyId);
}
@@ -551,18 +551,18 @@ function edit_diabutton(record_indice, act, value, vocabularyId)
// ---------------------------------------------------------------------------
function edit_addmval(value, VocabularyId)
{
- var meta_struct_id = p4.edit.curField; // le champ en cours d'editing
+ var meta_struct_id = p4.edit.curField; // le champ en cours d'editing
- // on ajoute le mot dans tous les records selectionnes
- for(var r=0; r
= $('.diapo',cache).length)
- i = 0;
+ if(i < 0)
+ i = parseInt($('.diapo:last', cache).attr('pos'));
+ else
+ if(i >= $('.diapo',cache).length)
+ i = 0;
- edit_clk_editimg(evt, i);
+ edit_clk_editimg(evt, i);
}
function edit_select_all()
{
- $('#EDIT_FILM2 .diapo', p4.edit.editBox).addClass('selected');
+ $('#EDIT_FILM2 .diapo', p4.edit.editBox).addClass('selected');
- for(i in p4.edit.T_records)
- p4.edit.T_records[i]._selected = true;
+ for(i in p4.edit.T_records)
+ p4.edit.T_records[i]._selected = true;
- p4.edit.lastClickId = 1 ;
+ p4.edit.lastClickId = 1 ;
- updateEditSelectedRecords(null); // null : no evt available
+ updateEditSelectedRecords(null); // null : no evt available
}
// ---------------------------------------------------------------------------
@@ -678,76 +678,76 @@ function edit_select_all()
// ---------------------------------------------------------------------------
function edit_clk_editimg(evt, i)
{
- if(p4.edit.curField >= 0)
- {
- if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
- return;
- }
-
- // guideline : si on mousedown sur une selection, c'est qu'on risque de draguer, donc on ne desectionne pas
- if(evt && evt.type=="mousedown" && p4.edit.T_records[i]._selected)
- return;
-
- if( evt && is_shift_key(evt) && p4.edit.lastClickId != null )
- {
- // shift donc on sel du p4.edit.lastClickId a ici
- var pos_from = p4.edit.T_pos[p4.edit.lastClickId];
- var pos_to = p4.edit.T_pos[i];
- if( pos_from > pos_to )
+ if(p4.edit.curField >= 0)
{
- var tmp = pos_from;
- pos_from = pos_to;
- pos_to = tmp;
+ if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
+ return;
}
- var pos;
- for(pos=pos_from; pos<=pos_to; pos++ )
+ // guideline : si on mousedown sur une selection, c'est qu'on risque de draguer, donc on ne desectionne pas
+ if(evt && evt.type=="mousedown" && p4.edit.T_records[i]._selected)
+ return;
+
+ if( evt && is_shift_key(evt) && p4.edit.lastClickId != null )
{
- var id = p4.edit.T_id[pos];
- if(!p4.edit.T_records[id]._selected) // toutes les fiches selectionnees
- {
- p4.edit.T_records[id]._selected = true;
- $("#idEditDiapo_"+id, p4.edit.editBox).addClass('selected');
- }
- }
- }
- else
- {
- if( !evt || !is_ctrl_key(evt) )
- {
- // on deselectionne tout avant
- var id;
- for(id in p4.edit.T_records)
- {
- if(p4.edit.T_records[id]._selected) // toutes les fiches selectionnees
+ // shift donc on sel du p4.edit.lastClickId a ici
+ var pos_from = p4.edit.T_pos[p4.edit.lastClickId];
+ var pos_to = p4.edit.T_pos[i];
+ if( pos_from > pos_to )
{
- p4.edit.T_records[id]._selected = false;
- $("#idEditDiapo_"+id, p4.edit.editBox).removeClass('selected');
+ var tmp = pos_from;
+ pos_from = pos_to;
+ pos_to = tmp;
+ }
+
+ var pos;
+ for(pos=pos_from; pos<=pos_to; pos++ )
+ {
+ var id = p4.edit.T_id[pos];
+ if(!p4.edit.T_records[id]._selected) // toutes les fiches selectionnees
+ {
+ p4.edit.T_records[id]._selected = true;
+ $("#idEditDiapo_"+id, p4.edit.editBox).addClass('selected');
+ }
}
- }
}
- if(i >= 0)
+ else
{
- p4.edit.T_records[i]._selected = !p4.edit.T_records[i]._selected;
- if(p4.edit.T_records[i]._selected)
- $("#idEditDiapo_"+i, p4.edit.editBox).addClass('selected');
- else
- $("#idEditDiapo_"+i, p4.edit.editBox).removeClass('selected');
+ if( !evt || !is_ctrl_key(evt) )
+ {
+ // on deselectionne tout avant
+ var id;
+ for(id in p4.edit.T_records)
+ {
+ if(p4.edit.T_records[id]._selected) // toutes les fiches selectionnees
+ {
+ p4.edit.T_records[id]._selected = false;
+ $("#idEditDiapo_"+id, p4.edit.editBox).removeClass('selected');
+ }
+ }
+ }
+ if(i >= 0)
+ {
+ p4.edit.T_records[i]._selected = !p4.edit.T_records[i]._selected;
+ if(p4.edit.T_records[i]._selected)
+ $("#idEditDiapo_"+i, p4.edit.editBox).addClass('selected');
+ else
+ $("#idEditDiapo_"+i, p4.edit.editBox).removeClass('selected');
+ }
}
- }
- $('#TH_Opreview .PNB10').empty();
+ $('#TH_Opreview .PNB10').empty();
- var selected = $('#EDIT_FILM2 .diapo.selected');
- if(selected.length == 1)
- {
+ var selected = $('#EDIT_FILM2 .diapo.selected');
+ if(selected.length == 1)
+ {
- var r = selected.attr('id').split('_').pop();
- previewEdit(r);
- }
+ var r = selected.attr('id').split('_').pop();
+ previewEdit(r);
+ }
- p4.edit.lastClickId = i ;
- updateEditSelectedRecords(evt);
+ p4.edit.lastClickId = i ;
+ updateEditSelectedRecords(evt);
}
// ---------------------------------------------------------------------------
@@ -755,270 +755,270 @@ function edit_clk_editimg(evt, i)
// ---------------------------------------------------------------------------
function edit_clkstatus(evt, bit, val)
{
- var ck0 = $("#idCheckboxStatbit0_"+bit);
- var ck1 = $("#idCheckboxStatbit1_"+bit);
- switch(val)
- {
- case 0:
- ck0.attr('class', "gui_ckbox_1");
- ck1.attr('class', "gui_ckbox_0");
- break;
- case 1:
- ck0.attr('class', "gui_ckbox_0");
- ck1.attr('class', "gui_ckbox_1");
- break;
- }
- var id;
- for(id in p4.edit.T_records)
- {
- if(p4.edit.T_records[id]._selected) // toutes les fiches selectionnees
+ var ck0 = $("#idCheckboxStatbit0_"+bit);
+ var ck1 = $("#idCheckboxStatbit1_"+bit);
+ switch(val)
{
- if($('#idEditDiapo_'+id).hasClass('nostatus'))
- continue;
-
- p4.edit.T_records[id].statbits[bit].value = val;
- p4.edit.T_records[id].statbits[bit].dirty = true;
+ case 0:
+ ck0.attr('class', "gui_ckbox_1");
+ ck1.attr('class', "gui_ckbox_0");
+ break;
+ case 1:
+ ck0.attr('class', "gui_ckbox_0");
+ ck1.attr('class', "gui_ckbox_1");
+ break;
+ }
+ var id;
+ for(id in p4.edit.T_records)
+ {
+ if(p4.edit.T_records[id]._selected) // toutes les fiches selectionnees
+ {
+ if($('#idEditDiapo_'+id).hasClass('nostatus'))
+ continue;
+
+ p4.edit.T_records[id].statbits[bit].value = val;
+ p4.edit.T_records[id].statbits[bit].dirty = true;
+ }
}
- }
}
function updateEditSelectedRecords(evt)
{
- $(".editDiaButtons", p4.edit.editBox).hide();
+ $(".editDiaButtons", p4.edit.editBox).hide();
- for(n in p4.edit.T_statbits) // tous les statusbits de la base
- {
- p4.edit.T_statbits[n]._value = "-1"; // val unknown
+ for(n in p4.edit.T_statbits) // tous les statusbits de la base
+ {
+ p4.edit.T_statbits[n]._value = "-1"; // val unknown
+ for(i in p4.edit.T_records)
+ {
+ if(!p4.edit.T_records[i]._selected)
+ continue;
+ if(p4.edit.T_records[i].statbits.length === 0)
+ continue;
+
+ if(p4.edit.T_statbits[n]._value == "-1")
+ p4.edit.T_statbits[n]._value = p4.edit.T_records[i].statbits[n].value;
+ else
+ if(p4.edit.T_statbits[n]._value != p4.edit.T_records[i].statbits[n].value)
+ p4.edit.T_statbits[n]._value = "2";
+ }
+ var ck0 = $("#idCheckboxStatbit0_"+n);
+ var ck1 = $("#idCheckboxStatbit1_"+n);
+
+ switch(p4.edit.T_statbits[n]._value)
+ {
+ case "0":
+ case 0:
+ ck0.removeClass('gui_ckbox_0 gui_ckbox_2').addClass("gui_ckbox_1");
+ ck1.removeClass('gui_ckbox_1 gui_ckbox_2').addClass("gui_ckbox_0");
+ break;
+ case "1":
+ case 1:
+ ck0.removeClass('gui_ckbox_1 gui_ckbox_2').addClass("gui_ckbox_0");
+ ck1.removeClass('gui_ckbox_0 gui_ckbox_2').addClass("gui_ckbox_1");
+ break;
+ case "2":
+ ck0.removeClass('gui_ckbox_0 gui_ckbox_1').addClass("gui_ckbox_2");
+ ck1.removeClass('gui_ckbox_0 gui_ckbox_1').addClass("gui_ckbox_2");
+ break;
+ }
+ }
+
+
+ var nostatus = $('.diapo.selected.nostatus', p4.edit.editBox).length;
+ var status_box = $('#ZTextStatus');
+ $('.nostatus, .somestatus, .displaystatus', status_box).hide();
+
+ if(nostatus == 0)
+ {
+ $('.displaystatus', status_box).show();
+ }
+ else
+ {
+ var yesstatus = $('.diapo.selected', p4.edit.editBox).length;
+ if(nostatus == yesstatus)
+ {
+ $('.nostatus', status_box).show();
+ }
+ else
+ {
+ $('.somestatus, .displaystatus', status_box).show();
+ }
+ }
+
+ // calcul des valeurs suggerees COMMUNES aux records (collections) selectionnes //
+ for(f in p4.edit.T_fields) // tous les champs de la base
+ p4.edit.T_fields[f]._sgval = [];
+ var t_lsgval = {};
+ var t_selcol = {}; // les bases (coll) dont au - une thumb est selectionnee
+ var ncolsel = 0;
+ var nrecsel = 0;
for(i in p4.edit.T_records)
{
- if(!p4.edit.T_records[i]._selected)
- continue;
- if(p4.edit.T_records[i].statbits.length === 0)
- continue;
+ if(!p4.edit.T_records[i]._selected)
+ continue;
+ nrecsel++;
- if(p4.edit.T_statbits[n]._value == "-1")
- p4.edit.T_statbits[n]._value = p4.edit.T_records[i].statbits[n].value;
- else
- if(p4.edit.T_statbits[n]._value != p4.edit.T_records[i].statbits[n].value)
- p4.edit.T_statbits[n]._value = "2";
- }
- var ck0 = $("#idCheckboxStatbit0_"+n);
- var ck1 = $("#idCheckboxStatbit1_"+n);
+ var bid = "b"+p4.edit.T_records[i].bid;
+ if(t_selcol[bid])
+ continue;
- switch(p4.edit.T_statbits[n]._value)
- {
- case "0":
- case 0:
- ck0.removeClass('gui_ckbox_0 gui_ckbox_2').addClass("gui_ckbox_1");
- ck1.removeClass('gui_ckbox_1 gui_ckbox_2').addClass("gui_ckbox_0");
- break;
- case "1":
- case 1:
- ck0.removeClass('gui_ckbox_1 gui_ckbox_2').addClass("gui_ckbox_0");
- ck1.removeClass('gui_ckbox_0 gui_ckbox_2').addClass("gui_ckbox_1");
- break;
- case "2":
- ck0.removeClass('gui_ckbox_0 gui_ckbox_1').addClass("gui_ckbox_2");
- ck1.removeClass('gui_ckbox_0 gui_ckbox_1').addClass("gui_ckbox_2");
- break;
- }
- }
-
-
- var nostatus = $('.diapo.selected.nostatus', p4.edit.editBox).length;
- var status_box = $('#ZTextStatus');
- $('.nostatus, .somestatus, .displaystatus', status_box).hide();
-
- if(nostatus == 0)
- {
- $('.displaystatus', status_box).show();
- }
- else
- {
- var yesstatus = $('.diapo.selected', p4.edit.editBox).length;
- if(nostatus == yesstatus)
- {
- $('.nostatus', status_box).show();
- }
- else
- {
- $('.somestatus, .displaystatus', status_box).show();
- }
- }
-
- // calcul des valeurs suggerees COMMUNES aux records (collections) selectionnes //
- for(f in p4.edit.T_fields) // tous les champs de la base
- p4.edit.T_fields[f]._sgval = [];
- var t_lsgval = {};
- var t_selcol = {}; // les bases (coll) dont au - une thumb est selectionnee
- var ncolsel = 0;
- var nrecsel = 0;
- for(i in p4.edit.T_records)
- {
- if(!p4.edit.T_records[i]._selected)
- continue;
- nrecsel++;
-
- var bid = "b"+p4.edit.T_records[i].bid;
- if(t_selcol[bid])
- continue;
-
- t_selcol[bid] = 1;
- ncolsel++;
- for(f in p4.edit.T_sgval[bid])
- {
- if(!t_lsgval[f])
- t_lsgval[f] = {};
- for(ivs in p4.edit.T_sgval[bid][f])
- {
- vs = p4.edit.T_sgval[bid][f][ivs];
- if(!t_lsgval[f][vs])
- t_lsgval[f][vs] = 0;
- t_lsgval[f][vs]++;
- }
- }
- }
- var t_sgval = {};
- for(f in t_lsgval)
- {
- for(sv in t_lsgval[f])
- {
- if(t_lsgval[f][sv] == ncolsel)
- {
- p4.edit.T_fields[f]._sgval.push( {
- label:sv,
- onclick: function(menuItem, menu, e, label)
- {
- if(p4.edit.T_fields[p4.edit.curField].multi)
- {
- $("#EditTextMultiValued", p4.edit.editBox).val(label);
- $('#EditTextMultiValued').trigger('keyup.maxLength');
- edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);
- }
- else
- {
- if(is_ctrl_key(e))
- {
- var t = $("#idEditZTextArea", p4.edit.editBox).val();
- $("#idEditZTextArea", p4.edit.editBox).val(t + (t?" ; ":"") + label);
- }
- else
- {
- $("#idEditZTextArea", p4.edit.editBox).val(label);
- }
- $('#idEditZTextArea').trigger('keyup.maxLength');
- p4.edit.textareaIsDirty = true;
- if(p4.edit.T_fields[p4.edit.curField]._status != 2)
- edit_validField(evt, "ask_ok");
- }
- }
- }
- );
- }
- }
- if(p4.edit.T_fields[f]._sgval.length > 0)
- {
- $("#editSGtri_"+f, p4.edit.editBox).css("visibility", "visible");
- $("#editSGtri_"+f, p4.edit.editBox).unbind();
- $("#editSGtri_"+f, p4.edit.editBox).contextMenu(
- p4.edit.T_fields[f]._sgval,
+ t_selcol[bid] = 1;
+ ncolsel++;
+ for(f in p4.edit.T_sgval[bid])
{
- theme:'vista',
- openEvt:"click",
- beforeShow:function(a,b,c,d)
- {
- var fid = this.target.getAttribute('id').substr(10);
- if(!p4.edit.textareaIsDirty || edit_validField(null, "ask_ok")==true)
+ if(!t_lsgval[f])
+ t_lsgval[f] = {};
+ for(ivs in p4.edit.T_sgval[bid][f])
{
- editField(null, fid);
- return(true);
+ vs = p4.edit.T_sgval[bid][f][ivs];
+ if(!t_lsgval[f][vs])
+ t_lsgval[f][vs] = 0;
+ t_lsgval[f][vs]++;
}
- else
- {
- return(false);
- }
- }
}
- );
}
- else
+ var t_sgval = {};
+ for(f in t_lsgval)
{
- $("#editSGtri_"+f, p4.edit.editBox).css("visibility", "hidden");
+ for(sv in t_lsgval[f])
+ {
+ if(t_lsgval[f][sv] == ncolsel)
+ {
+ p4.edit.T_fields[f]._sgval.push( {
+ label:sv,
+ onclick: function(menuItem, menu, e, label)
+ {
+ if(p4.edit.T_fields[p4.edit.curField].multi)
+ {
+ $("#EditTextMultiValued", p4.edit.editBox).val(label);
+ $('#EditTextMultiValued').trigger('keyup.maxLength');
+ edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);
+ }
+ else
+ {
+ if(is_ctrl_key(e))
+ {
+ var t = $("#idEditZTextArea", p4.edit.editBox).val();
+ $("#idEditZTextArea", p4.edit.editBox).val(t + (t?" ; ":"") + label);
+ }
+ else
+ {
+ $("#idEditZTextArea", p4.edit.editBox).val(label);
+ }
+ $('#idEditZTextArea').trigger('keyup.maxLength');
+ p4.edit.textareaIsDirty = true;
+ if(p4.edit.T_fields[p4.edit.curField]._status != 2)
+ edit_validField(evt, "ask_ok");
+ }
+ }
+ }
+ );
+ }
+ }
+ if(p4.edit.T_fields[f]._sgval.length > 0)
+ {
+ $("#editSGtri_"+f, p4.edit.editBox).css("visibility", "visible");
+ $("#editSGtri_"+f, p4.edit.editBox).unbind();
+ $("#editSGtri_"+f, p4.edit.editBox).contextMenu(
+ p4.edit.T_fields[f]._sgval,
+ {
+ theme:'vista',
+ openEvt:"click",
+ beforeShow:function(a,b,c,d)
+ {
+ var fid = this.target.getAttribute('id').substr(10);
+ if(!p4.edit.textareaIsDirty || edit_validField(null, "ask_ok")==true)
+ {
+ editField(null, fid);
+ return(true);
+ }
+ else
+ {
+ return(false);
+ }
+ }
+ }
+ );
+ }
+ else
+ {
+ $("#editSGtri_"+f, p4.edit.editBox).css("visibility", "hidden");
+ }
}
- }
- $('#idFrameE .ww_status', p4.edit.editBox).html( nrecsel + " record(s) selected for editing");
+ $('#idFrameE .ww_status', p4.edit.editBox).html( nrecsel + " record(s) selected for editing");
- updateFieldDisplay();
+ updateFieldDisplay();
- if(p4.edit.curField == -1)
- editStatus(evt);
- else
- editField(evt, p4.edit.curField);
+ if(p4.edit.curField == -1)
+ editStatus(evt);
+ else
+ editField(evt, p4.edit.curField);
}
function updateFieldDisplay()
{
- for(f in p4.edit.T_fields) // tous les champs de la base
- {
- p4.edit.T_fields[f]._status = 0; // val unknown
- for(i in p4.edit.T_records)
+ for(f in p4.edit.T_fields) // tous les champs de la base
{
- if(!p4.edit.T_records[i]._selected)
- continue;
-
-
- if(p4.edit.T_records[i].fields[f].isEmpty())
- {
- var v = "";
- }
- else
- {
- // le champ existe dans la fiche
- if(p4.edit.T_fields[f].multi)
+ p4.edit.T_fields[f]._status = 0; // val unknown
+ for(i in p4.edit.T_records)
{
- // champ multi : on compare la concat des valeurs
- var v = p4.edit.T_records[i].fields[f].getSerializedValues()
- }
- else
- {
- var v = p4.edit.T_records[i].fields[f].getValue().getValue();
- }
- }
+ if(!p4.edit.T_records[i]._selected)
+ continue;
- if(p4.edit.T_fields[f]._status == 0)
- {
- p4.edit.T_fields[f]._value = v;
- p4.edit.T_fields[f]._status = 1;
- }
- else if(p4.edit.T_fields[f]._status == 1 && p4.edit.T_fields[f]._value != v)
- {
- p4.edit.T_fields[f]._value = "*****";
- p4.edit.T_fields[f]._status = 2;
- break; // plus la peine de verifier le champ sur les autres records
- }
+
+ if(p4.edit.T_records[i].fields[f].isEmpty())
+ {
+ var v = "";
+ }
+ else
+ {
+ // le champ existe dans la fiche
+ if(p4.edit.T_fields[f].multi)
+ {
+ // champ multi : on compare la concat des valeurs
+ var v = p4.edit.T_records[i].fields[f].getSerializedValues()
+ }
+ else
+ {
+ var v = p4.edit.T_records[i].fields[f].getValue().getValue();
+ }
+ }
+
+ if(p4.edit.T_fields[f]._status == 0)
+ {
+ p4.edit.T_fields[f]._value = v;
+ p4.edit.T_fields[f]._status = 1;
+ }
+ else if(p4.edit.T_fields[f]._status == 1 && p4.edit.T_fields[f]._value != v)
+ {
+ p4.edit.T_fields[f]._value = "*****";
+ p4.edit.T_fields[f]._status = 2;
+ break; // plus la peine de verifier le champ sur les autres records
+ }
+ }
+ if(o = document.getElementById("idEditField_"+f))
+ {
+ if(p4.edit.T_fields[f]._status == 2) // mixed
+ o.innerHTML = "xxxxx ";
+ else
+ o.innerHTML = cleanTags(p4.edit.T_fields[f]._value).replace(/\n/gm, "¶ ");
+ }
}
- if(o = document.getElementById("idEditField_"+f))
- {
- if(p4.edit.T_fields[f]._status == 2) // mixed
- o.innerHTML = "xxxxx ";
- else
- o.innerHTML = cleanTags(p4.edit.T_fields[f]._value).replace(/\n/gm, "¶ ");
- }
- }
}
function SortCompareMetas(a, b)
{
- if(typeof(a) != 'object')
- return(-1);
- if(typeof(b) != 'object')
- return(1);
- var na = a.getValue().toUpperCase();
- var nb = b.getValue().toUpperCase();
- if(na == nb)
- return(0);
- return(na < nb ? -1 : 1);
+ if(typeof(a) != 'object')
+ return(-1);
+ if(typeof(b) != 'object')
+ return(1);
+ var na = a.getValue().toUpperCase();
+ var nb = b.getValue().toUpperCase();
+ if(na == nb)
+ return(0);
+ return(na < nb ? -1 : 1);
}
//---------------------------------------------------------------------
@@ -1026,81 +1026,81 @@ function SortCompareMetas(a, b)
//---------------------------------------------------------------------
function cleanTags(string)
{
- var chars2replace = [ {
- f:"&",
- t:"&"
- }, {
- 'f':"<",
- 't':"<"
- }, {
- 'f':">",
- 't':">"
- } ];
- for(c in chars2replace)
- string = string.replace(RegExp(chars2replace[c].f,"g") ,chars2replace[c].t);
- return string;
+ var chars2replace = [ {
+ f:"&",
+ t:"&"
+ }, {
+ 'f':"<",
+ 't':"<"
+ }, {
+ 'f':">",
+ 't':">"
+ } ];
+ for(c in chars2replace)
+ string = string.replace(RegExp(chars2replace[c].f,"g") ,chars2replace[c].t);
+ return string;
}
function check_required(id_r, id_f)
{
- var required_fields = false;
+ var required_fields = false;
- if(typeof id_r == 'undefined')
- id_r = false;
- if(typeof id_f == 'undefined')
- id_f = false;
+ if(typeof id_r == 'undefined')
+ id_r = false;
+ if(typeof id_f == 'undefined')
+ id_f = false;
- for(f in p4.edit.T_fields)
- {
- if(id_f !== false && f != id_f)
- continue;
-
- var name = p4.edit.T_fields[f].name;
-
- if(!p4.edit.T_fields[f].required)
- continue;
-
- for(r in p4.edit.T_records)
+ for(f in p4.edit.T_fields)
{
- if(id_r !== false && r != id_r)
- continue;
+ if(id_f !== false && f != id_f)
+ continue;
- var elem = $('#idEditDiapo_'+r+' .require_alert');
+ var name = p4.edit.T_fields[f].name;
- elem.hide();
+ if(!p4.edit.T_fields[f].required)
+ continue;
- if(!p4.edit.T_records[r].fields[f])
- {
- elem.show();
- required_fields = true;
- }
- else
- {
-
- var check_required = '';
-
- // le champ existe dans la fiche
- if(p4.edit.T_fields[f].multi)
+ for(r in p4.edit.T_records)
{
- // champ multi : on compare la concat des valeurs
- check_required = $.trim(p4.edit.T_records[r].fields[f].getSerializedValues())
- }
- else if(p4.edit.T_records[r].fields[f].getValue())
- {
- check_required = $.trim(p4.edit.T_records[r].fields[f].getValue().getValue());
+ if(id_r !== false && r != id_r)
+ continue;
+
+ var elem = $('#idEditDiapo_'+r+' .require_alert');
+
+ elem.hide();
+
+ if(!p4.edit.T_records[r].fields[f])
+ {
+ elem.show();
+ required_fields = true;
+ }
+ else
+ {
+
+ var check_required = '';
+
+ // le champ existe dans la fiche
+ if(p4.edit.T_fields[f].multi)
+ {
+ // champ multi : on compare la concat des valeurs
+ check_required = $.trim(p4.edit.T_records[r].fields[f].getSerializedValues())
+ }
+ else if(p4.edit.T_records[r].fields[f].getValue())
+ {
+ check_required = $.trim(p4.edit.T_records[r].fields[f].getValue().getValue());
+ }
+
+
+ if(check_required == '')
+ {
+ elem.show();
+ required_fields = true;
+ }
+ }
}
-
- if(check_required == '')
- {
- elem.show();
- required_fields = true;
- }
- }
}
-
- }
- return required_fields;
+ return required_fields;
}
// ----------------------------------------------------------------------------------
@@ -1108,112 +1108,112 @@ function check_required(id_r, id_f)
// ----------------------------------------------------------------------------------
function edit_applyMultiDesc(evt)
{
- var sendorder = "";
- var sendChuOrder = "";
+ var sendorder = "";
+ var sendChuOrder = "";
- var t = [];
+ var t = [];
- if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
- return(false);
+ if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
+ return(false);
- var required_fields = check_required();
+ var required_fields = check_required();
- if(required_fields)
- {
- alert(language.some_required_fields);
- return;
- }
+ if(required_fields)
+ {
+ alert(language.some_required_fields);
+ return;
+ }
- $("#EDIT_ALL", p4.edit.editBox).hide();
+ $("#EDIT_ALL", p4.edit.editBox).hide();
- $("#EDIT_WORKING", p4.edit.editBox).show();
+ $("#EDIT_WORKING", p4.edit.editBox).show();
- for(r in p4.edit.T_records)
- {
- var record_datas = {
- record_id : p4.edit.T_records[r].rid,
- metadatas : [],
- edit : 0,
- status : null
+ for(r in p4.edit.T_records)
+ {
+ var record_datas = {
+ record_id : p4.edit.T_records[r].rid,
+ metadatas : [],
+ edit : 0,
+ status : null
+ };
+
+ var editDirty = false;
+
+ for(f in p4.edit.T_records[r].fields)
+ {
+ if(!p4.edit.T_records[r].fields[f].isDirty())
+ {
+ continue;
+ }
+
+ editDirty = true;
+ record_datas.edit = 1;
+
+ record_datas.metadatas = record_datas.metadatas.concat(
+ p4.edit.T_records[r].fields[f].exportDatas()
+ );
+ }
+
+ // les statbits
+ var tsb = [];
+ for(var n=0; n<64; n++)
+ tsb[n] = 'x';
+ sb_dirty = false;
+ for(var n in p4.edit.T_records[r].statbits)
+ {
+ if(p4.edit.T_records[r].statbits[n].dirty)
+ {
+ tsb[63-n] = p4.edit.T_records[r].statbits[n].value;
+ sb_dirty = true;
+ }
+ }
+
+ if(sb_dirty || editDirty)
+ {
+ if(sb_dirty === true)
+ record_datas.status = tsb.join("");
+
+ t.push(record_datas);
+ }
+ }
+
+ var options = {
+ mds:t,
+ sbid : p4.edit.sbas_id,
+ act:'WORK',
+ lst:$('#edit_lst').val(),
+ act_option:'SAVE'+p4.edit.what,
+ regbasprid:p4.edit.regbasprid,
+ // newrepresent:p4.edit.newrepresent,
+ ssel:p4.edit.ssel
};
+ if(p4.edit.newrepresent != false)
+ options.newrepresent = p4.edit.newrepresent;
- var editDirty = false;
-
- for(f in p4.edit.T_records[r].fields)
- {
- if(!p4.edit.T_records[r].fields[f].isDirty())
- {
- continue;
- }
-
- editDirty = true;
- record_datas.edit = 1;
-
- record_datas.metadatas = record_datas.metadatas.concat(
- p4.edit.T_records[r].fields[f].exportDatas()
- );
- }
-
- // les statbits
- var tsb = [];
- for(var n=0; n<64; n++)
- tsb[n] = 'x';
- sb_dirty = false;
- for(var n in p4.edit.T_records[r].statbits)
- {
- if(p4.edit.T_records[r].statbits[n].dirty)
- {
- tsb[63-n] = p4.edit.T_records[r].statbits[n].value;
- sb_dirty = true;
- }
- }
-
- if(sb_dirty || editDirty)
- {
- if(sb_dirty === true)
- record_datas.status = tsb.join("");
-
- t.push(record_datas);
- }
- }
-
- var options = {
- mds:t,
- sbid : p4.edit.sbas_id,
- act:'WORK',
- lst:$('#edit_lst').val(),
- act_option:'SAVE'+p4.edit.what,
- regbasprid:p4.edit.regbasprid,
- // newrepresent:p4.edit.newrepresent,
- ssel:p4.edit.ssel
- };
- if(p4.edit.newrepresent != false)
- options.newrepresent = p4.edit.newrepresent;
-
- // options.mds = t;
+ // options.mds = t;
- $.ajax({
- url :"../prod/records/edit/apply/"
- ,
- data : options
- // ,dataType:'json'
- ,
- type:'POST'
- ,
- success : function(data){
- if(p4.edit.what == 'GRP' || p4.edit.what == 'SSEL')
- {
- p4.WorkZone.refresh('current');
- }
- $("#Edit_copyPreset_dlg").remove();
- $('#EDITWINDOW').hide();
- hideOverlay(2);
- if(p4.preview.open)
- reloadPreview();
- return;
- }
- });
+ $.ajax({
+ url :"../prod/records/edit/apply/"
+ ,
+ data : options
+ // ,dataType:'json'
+ ,
+ type:'POST'
+ ,
+ success : function(data){
+ if(p4.edit.what == 'GRP' || p4.edit.what == 'SSEL')
+ {
+ p4.WorkZone.refresh('current');
+ }
+ $("#Edit_copyPreset_dlg").remove();
+ $('#EDITWINDOW').hide();
+ hideOverlay(2);
+ if(p4.preview.open)
+ reloadPreview();
+ return;
+ }
+ });
}
@@ -1221,47 +1221,47 @@ function edit_cancelMultiDesc(evt)
{
- var dirty = false;
+ var dirty = false;
- evt.cancelBubble = true;
- if(evt.stopPropagation)
- evt.stopPropagation();
+ evt.cancelBubble = true;
+ if(evt.stopPropagation)
+ evt.stopPropagation();
- if(p4.edit.curField >= 0)
- {
- if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
- return;
- }
-
- for(r in p4.edit.T_records)
- {
- for(f in p4.edit.T_records[r].fields)
+ if(p4.edit.curField >= 0)
{
- if( (dirty |= p4.edit.T_records[r].fields[f].isDirty()) )
- break;
+ if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
+ return;
}
- for(var n in p4.edit.T_records[r].statbits)
- {
- if( (dirty |= p4.edit.T_records[r].statbits[n].dirty) )
- break;
- }
- }
- if(!dirty || confirm(language.confirm_abandon))
- {
- $("#Edit_copyPreset_dlg").remove();
- $('#idFrameE .ww_content', p4.edit.editBox).empty();
- // on reaffiche tous les thesaurus
- for(i in p4.thesau.thlist) // tous les thesaurus
+ for(r in p4.edit.T_records)
{
- var bid = p4.thesau.thlist[i].sbas_id;
- var e = document.getElementById('TH_T.'+bid+'.T');
- if(e)
- e.style.display = "";
+ for(f in p4.edit.T_records[r].fields)
+ {
+ if( (dirty |= p4.edit.T_records[r].fields[f].isDirty()) )
+ break;
+ }
+ for(var n in p4.edit.T_records[r].statbits)
+ {
+ if( (dirty |= p4.edit.T_records[r].statbits[n].dirty) )
+ break;
+ }
}
- self.setTimeout("$('#EDITWINDOW').fadeOut();hideOverlay(2);", 100);
+ if(!dirty || confirm(language.confirm_abandon))
+ {
+ $("#Edit_copyPreset_dlg").remove();
+ $('#idFrameE .ww_content', p4.edit.editBox).empty();
- }
+ // on reaffiche tous les thesaurus
+ for(i in p4.thesau.thlist) // tous les thesaurus
+ {
+ var bid = p4.thesau.thlist[i].sbas_id;
+ var e = document.getElementById('TH_T.'+bid+'.T');
+ if(e)
+ e.style.display = "";
+ }
+ self.setTimeout("$('#EDITWINDOW').fadeOut();hideOverlay(2);", 100);
+
+ }
}
// ======================================================
@@ -1270,369 +1270,369 @@ function edit_cancelMultiDesc(evt)
function edit_clickThesaurus(event) // onclick dans le thesaurus
{
- // on cherche ou on a clique
- for(e=event.srcElement ? event.srcElement : event.target; e && ((!e.tagName) || (!e.id)); e=e.parentNode)
- ;
- if(e)
- {
- switch(e.id.substr(0,4))
+ // on cherche ou on a clique
+ for(e=event.srcElement ? event.srcElement : event.target; e && ((!e.tagName) || (!e.id)); e=e.parentNode)
+ ;
+ if(e)
{
- case "TH_P": // +/- de deploiement de mot
- js = "edit_thesaurus_ow('"+e.id.substr(5)+"')";
- self.setTimeout(js, 10);
- break;
+ switch(e.id.substr(0,4))
+ {
+ case "TH_P": // +/- de deploiement de mot
+ js = "edit_thesaurus_ow('"+e.id.substr(5)+"')";
+ self.setTimeout(js, 10);
+ break;
+ }
}
- }
- return(false);
+ return(false);
}
function edit_dblclickThesaurus(event) // ondblclick dans le thesaurus
{
- for(e=event.srcElement ? event.srcElement : event.target; e && ((!e.tagName) || (!e.id)); e=e.parentNode)
- ;
- if(e)
- {
- switch(e.id.substr(0,4))
+ for(e=event.srcElement ? event.srcElement : event.target; e && ((!e.tagName) || (!e.id)); e=e.parentNode)
+ ;
+ if(e)
{
- case "TH_W":
- if(p4.edit.curField >= 0)
+ switch(e.id.substr(0,4))
{
- var w = $(e).text();
- if(p4.edit.T_fields[p4.edit.curField].multi)
- {
- $("#EditTextMultiValued", p4.edit.editBox).val(w);
- $('#EditTextMultiValued').trigger('keyup.maxLength');
- edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);
- }
- else
- {
- $("#idEditZTextArea", p4.edit.editBox).val(w);
- $('#idEditZTextArea').trigger('keyup.maxLength');
- p4.edit.textareaIsDirty = true;
- }
+ case "TH_W":
+ if(p4.edit.curField >= 0)
+ {
+ var w = $(e).text();
+ if(p4.edit.T_fields[p4.edit.curField].multi)
+ {
+ $("#EditTextMultiValued", p4.edit.editBox).val(w);
+ $('#EditTextMultiValued').trigger('keyup.maxLength');
+ edit_addmval($('#EditTextMultiValued', p4.edit.editBox).val(), null);
+ }
+ else
+ {
+ $("#idEditZTextArea", p4.edit.editBox).val(w);
+ $('#idEditZTextArea').trigger('keyup.maxLength');
+ p4.edit.textareaIsDirty = true;
+ }
+ }
+ break;
}
- break;
}
- }
- return(false);
+ return(false);
}
function edit_thesaurus_ow(id) // on ouvre ou ferme une branche de thesaurus
{
- var o = document.getElementById("TH_K."+id);
- if(o.className=="o")
- {
- // on ferme
- o.className = "c";
- document.getElementById("TH_P."+id).innerHTML = "+";
- document.getElementById("TH_K."+id).innerHTML = language.loading;
- }
- else if(o.className=="c" || o.className=="h")
- {
- // on ouvre
- o.className = "o";
- document.getElementById("TH_P."+id).innerHTML = "-";
+ var o = document.getElementById("TH_K."+id);
+ if(o.className=="o")
+ {
+ // on ferme
+ o.className = "c";
+ document.getElementById("TH_P."+id).innerHTML = "+";
+ document.getElementById("TH_K."+id).innerHTML = language.loading;
+ }
+ else if(o.className=="c" || o.className=="h")
+ {
+ // on ouvre
+ o.className = "o";
+ document.getElementById("TH_P."+id).innerHTML = "-";
- var t_id = id.split(".");
- var sbas_id = t_id[0];
- t_id.shift();
- var thid = t_id.join(".");
- var url = "/xmlhttp/getterm_prod.x.php";
- var parms = "bid=" + sbas_id;
- parms += "&lng="+p4.lng;
- parms += "&sortsy=1";
- parms += "&id=" + thid;
- parms += "&typ=TH";
+ var t_id = id.split(".");
+ var sbas_id = t_id[0];
+ t_id.shift();
+ var thid = t_id.join(".");
+ var url = "/xmlhttp/getterm_prod.x.php";
+ var parms = "bid=" + sbas_id;
+ parms += "&lng="+p4.lng;
+ parms += "&sortsy=1";
+ parms += "&id=" + thid;
+ parms += "&typ=TH";
- ETHSeeker.openBranch(id, thid);
- }
- return(false);
+ ETHSeeker.openBranch(id, thid);
+ }
+ return(false);
}
function EditThesaurusSeeker(sbas_id)
{
- this.jq = null;
+ this.jq = null;
- this.sbas_id = sbas_id;
+ this.sbas_id = sbas_id;
- var zid = (""+sbas_id).replace(new RegExp("\\.", "g"), "\\.") + "\\.T";
+ var zid = (""+sbas_id).replace(new RegExp("\\.", "g"), "\\.") + "\\.T";
- this.TH_P_node = $("#TH_P\\." + zid, p4.edit.editBox);
- this.TH_K_node = $("#TH_K\\." + zid, p4.edit.editBox);
+ this.TH_P_node = $("#TH_P\\." + zid, p4.edit.editBox);
+ this.TH_K_node = $("#TH_K\\." + zid, p4.edit.editBox);
- this._ctimer = null;
+ this._ctimer = null;
- this.search = function(txt) {
- if(this._ctimer)
- clearTimeout(this._ctimer);
- var js = "ETHSeeker.search_delayed('"+txt.replace("'", "\\'")+"');" ;
- this._ctimer = setTimeout(js, 125);
- };
-
- this.search_delayed = function(txt) {
- if(this.jq && typeof this.jq.abort == "function")
- {
- this.jq.abort();
- this.jq = null;
- }
- txt = txt.replace("'", "\\'");
- var url = "/xmlhttp/openbranches_prod.h.php";
- var parms = {
- bid:this.sbas_id,
- lng:p4.lng,
- t:txt,
- mod:"TREE",
- u:Math.random()
+ this.search = function(txt) {
+ if(this._ctimer)
+ clearTimeout(this._ctimer);
+ var js = "ETHSeeker.search_delayed('"+txt.replace("'", "\\'")+"');" ;
+ this._ctimer = setTimeout(js, 125);
};
- var me = this;
+ this.search_delayed = function(txt) {
+ if(this.jq && typeof this.jq.abort == "function")
+ {
+ this.jq.abort();
+ this.jq = null;
+ }
+ txt = txt.replace("'", "\\'");
+ var url = "/xmlhttp/openbranches_prod.h.php";
+ var parms = {
+ bid:this.sbas_id,
+ lng:p4.lng,
+ t:txt,
+ mod:"TREE",
+ u:Math.random()
+ };
- this.jq = $.ajax({
- url: url,
- data: parms,
- type:'POST',
- success: function(ret)
- {
- me.TH_P_node.html("...");
- me.TH_K_node.attr("class", "h").html(ret);
- me.jq = null;
- },
- error:function(){
+ var me = this;
- },
- timeout:function(){
+ this.jq = $.ajax({
+ url: url,
+ data: parms,
+ type:'POST',
+ success: function(ret)
+ {
+ me.TH_P_node.html("...");
+ me.TH_K_node.attr("class", "h").html(ret);
+ me.jq = null;
+ },
+ error:function(){
- }
- });
- };
+ },
+ timeout:function(){
- this.openBranch = function(id, thid) {
- if(this.jq)
- {
- this.jq.abort();
- this.jq = null;
- }
- var url = "/xmlhttp/getterm_prod.h.php";
- var parms = {
- bid:this.sbas_id,
- lng:p4.lng,
- sortsy:1,
- id:thid,
- typ:"TH"
- } ;
- var me = this;
+ }
+ });
+ };
+
+ this.openBranch = function(id, thid) {
+ if(this.jq)
+ {
+ this.jq.abort();
+ this.jq = null;
+ }
+ var url = "/xmlhttp/getterm_prod.h.php";
+ var parms = {
+ bid:this.sbas_id,
+ lng:p4.lng,
+ sortsy:1,
+ id:thid,
+ typ:"TH"
+ } ;
+ var me = this;
- this.jq = $.ajax({
- url: url,
- data: parms,
- success: function(ret)
- {
- var zid = "#TH_K\\." + id.replace(new RegExp("\\.", "g"), "\\."); // escape les '.' pour jquery
- $(zid, p4.edit.editBox).html(ret);
- me.jq = null;
- },
- error:function(){
+ this.jq = $.ajax({
+ url: url,
+ data: parms,
+ success: function(ret)
+ {
+ var zid = "#TH_K\\." + id.replace(new RegExp("\\.", "g"), "\\."); // escape les '.' pour jquery
+ $(zid, p4.edit.editBox).html(ret);
+ me.jq = null;
+ },
+ error:function(){
- },
- timeout:function(){
+ },
+ timeout:function(){
- }
- });
- };
+ }
+ });
+ };
}
function replace()
{
- var field = $("#EditSRField", p4.edit.editBox).val();
- var search = $("#EditSearch", p4.edit.editBox).val();
- var replace = $("#EditReplace", p4.edit.editBox).val();
+ var field = $("#EditSRField", p4.edit.editBox).val();
+ var search = $("#EditSearch", p4.edit.editBox).val();
+ var replace = $("#EditReplace", p4.edit.editBox).val();
- var where = $("[name=EditSR_Where]:checked", p4.edit.editBox).val();
- var commut = "";
- var rgxp = $("#EditSROptionRX", p4.edit.editBox).attr('checked') ? true : false;
+ var where = $("[name=EditSR_Where]:checked", p4.edit.editBox).val();
+ var commut = "";
+ var rgxp = $("#EditSROptionRX", p4.edit.editBox).attr('checked') ? true : false;
- var r_search;
- if(rgxp)
- {
- r_search = search;
- commut = ($("#EditSR_RXG", p4.edit.editBox).attr('checked') ? "g" : "")
- + ($("#EditSR_RXI", p4.edit.editBox).attr('checked') ? "i" : "") ;
- }
- else
- {
- commut = $("#EditSR_case", p4.edit.editBox).attr('checked') ? "g" : "gi";
- r_search = "";
- for(i=0; i " + "" + p4.edit.T_fields[i].label + " : ";
- html += cleanTags(p4.edit.T_fields[i]._value) + " ";
+ if(p4.edit.T_fields[i]._status == 1)
+ {
+ if (p4.edit.T_fields[i].readonly) {
+ continue;
+ }
+ var c = p4.edit.T_fields[i]._value === "" ? "" : "checked=\"1\"";
+ var v = p4.edit.T_fields[i]._value;
+ html += " " + "" + p4.edit.T_fields[i].label + " : ";
+ html += cleanTags(p4.edit.T_fields[i]._value) + "
";
+ }
+ }
+ $("#Edit_copyPreset_dlg FORM DIV").html(html);
+ var $dialog = $("#Edit_copyPreset_dlg");
+ if ($dialog.data("ui-dialog")) {
+ // to show dialog on top of edit window
+ $dialog.dialog("widget").css("z-index", 1300);
+ $dialog.dialog("open");
}
- }
- $("#Edit_copyPreset_dlg FORM DIV").html(html);
- var $dialog = $("#Edit_copyPreset_dlg");
- if ($dialog.data("ui-dialog")) {
- // to show dialog on top of edit window
- $dialog.dialog("widget").css("z-index", 1300);
- $dialog.dialog("open");
- }
}
function preset_paint(data)
{
- $(".EDIT_presets_list", p4.edit.editBox).html(data.html);
- $(".EDIT_presets_list A.triangle").click(
- function()
- {
- $(this).parent().parent().toggleClass("opened");
- return false;
- }
+ $(".EDIT_presets_list", p4.edit.editBox).html(data.html);
+ $(".EDIT_presets_list A.triangle").click(
+ function()
+ {
+ $(this).parent().parent().toggleClass("opened");
+ return false;
+ }
);
- $(".EDIT_presets_list A.title").dblclick(
- function()
- {
- var preset_id = $(this).parent().parent().attr("id");
- if(preset_id.substr(0, 12)=="EDIT_PRESET_")
- preset_load(preset_id.substr(12));
- return false;
- }
+ $(".EDIT_presets_list A.title").dblclick(
+ function()
+ {
+ var preset_id = $(this).parent().parent().attr("id");
+ if(preset_id.substr(0, 12)=="EDIT_PRESET_")
+ preset_load(preset_id.substr(12));
+ return false;
+ }
);
- $(".EDIT_presets_list A.delete").click(
- function()
- {
- var li = $(this).closest("LI");
- var preset_id = li.attr("id");
- var title = $(this).parent().children(".title").html();
- if(preset_id.substr(0, 12)=="EDIT_PRESET_" && confirm("supprimer le preset '" + title + "' ?"))
- {
- preset_delete(preset_id.substr(12), li);
- }
- return false;
- }
+ $(".EDIT_presets_list A.delete").click(
+ function()
+ {
+ var li = $(this).closest("LI");
+ var preset_id = li.attr("id");
+ var title = $(this).parent().children(".title").html();
+ if(preset_id.substr(0, 12)=="EDIT_PRESET_" && confirm("supprimer le preset '" + title + "' ?"))
+ {
+ preset_delete(preset_id.substr(12), li);
+ }
+ return false;
+ }
);
}
function preset_delete(preset_id, li)
{
- var p = {
- "act":"DELETE",
- "presetid":preset_id
- };
- $.ajax({
- type: 'POST',
- url: "/xmlhttp/editing_presets.j.php",
- data: p,
- dataType: 'json',
- success: function(data, textStatus){
- li.remove();
- }
- });
+ var p = {
+ "act":"DELETE",
+ "presetid":preset_id
+ };
+ $.ajax({
+ type: 'POST',
+ url: "/xmlhttp/editing_presets.j.php",
+ data: p,
+ dataType: 'json',
+ success: function(data, textStatus){
+ li.remove();
+ }
+ });
}
function preset_load(preset_id)
{
- var p = {
- "act":"LOAD",
- "presetid":preset_id
- };
+ var p = {
+ "act":"LOAD",
+ "presetid":preset_id
+ };
- $.getJSON(
- "/xmlhttp/editing_presets.j.php",
- p,
- function(data, textStatus)
- {
- if ($("#Edit_copyPreset_dlg").data("ui-dialog")) {
- $("#Edit_copyPreset_dlg").dialog("close");
- }
-
- for(i in p4.edit.T_fields)
- {
- p4.edit.T_fields[i].preset = null;
- if(typeof(data.fields[p4.edit.T_fields[i].name]) != "undefined")
+ $.getJSON(
+ "/xmlhttp/editing_presets.j.php",
+ p,
+ function(data, textStatus)
{
- p4.edit.T_fields[i].preset = data.fields[p4.edit.T_fields[i].name];
- }
- }
- for(var r=0; r 0 && zoomable.hasClass('zoomed'))
- return;
-
- // var datas = p4.edit.T_records[id].preview;
-
- var h = parseInt($('input[name=height]', container).val());
- var w = parseInt($('input[name=width]', container).val());
-
- // if(datas.doctype == 'video')
- // {
- // var h = parseInt(datas.height);
- // var w = parseInt(datas.width);
- // }
- var t=0;
- var de = 0;
-
- var margX = 0;
- var margY = 0;
-
- if($('img.record.record_audio', container).length > 0)
- {
- var margY = 100;
- de = 60;
- }
-
- var display_box = $('#TH_Opreview .PNB10');
- var dwidth = display_box.width();
- var dheight = display_box.height();
-
-
- // if(datas.doctype != 'flash')
- // {
- var ratioP = w / h;
- var ratioD = dwidth / dheight;
-
- if (ratioD > ratioP) {
- //je regle la hauteur d'abord
- if ((parseInt(h) + margY) > dheight) {
- h = Math.round(dheight - margY);
- w = Math.round(h * ratioP);
+ if(selected.length != 1)
+ {
+ return;
}
- }
- else {
- if ((parseInt(w) + margX) > dwidth) {
- w = Math.round(dwidth - margX);
- h = Math.round(w / ratioP);
+
+ var id = selected.attr('id').split('_').pop();
+
+ var container = $('#TH_Opreview');
+ var zoomable = $('img.record.zoomable', container);
+
+ if(zoomable.length > 0 && zoomable.hasClass('zoomed'))
+ return;
+
+ // var datas = p4.edit.T_records[id].preview;
+
+ var h = parseInt($('input[name=height]', container).val());
+ var w = parseInt($('input[name=width]', container).val());
+
+ // if(datas.doctype == 'video')
+ // {
+ // var h = parseInt(datas.height);
+ // var w = parseInt(datas.width);
+ // }
+ var t=0;
+ var de = 0;
+
+ var margX = 0;
+ var margY = 0;
+
+ if($('img.record.record_audio', container).length > 0)
+ {
+ var margY = 100;
+ de = 60;
}
- }
- // }
- // else
- // {
- //
- // h = Math.round(dheight - margY);
- // w = Math.round(dwidth - margX);
- // }
- t = Math.round((dheight - h - de) / 2);
- var l = Math.round((dwidth - w) / 2);
- $('.record',container).css({
- width: w,
- height: h,
- top: t,
- left: l
- }).attr('width',w).attr('height',h);
+
+ var display_box = $('#TH_Opreview .PNB10');
+ var dwidth = display_box.width();
+ var dheight = display_box.height();
+
+
+ // if(datas.doctype != 'flash')
+ // {
+ var ratioP = w / h;
+ var ratioD = dwidth / dheight;
+
+ if (ratioD > ratioP) {
+ //je regle la hauteur d'abord
+ if ((parseInt(h) + margY) > dheight) {
+ h = Math.round(dheight - margY);
+ w = Math.round(h * ratioP);
+ }
+ }
+ else {
+ if ((parseInt(w) + margX) > dwidth) {
+ w = Math.round(dwidth - margX);
+ h = Math.round(w / ratioP);
+ }
+ }
+ // }
+ // else
+ // {
+ //
+ // h = Math.round(dheight - margY);
+ // w = Math.round(dwidth - margX);
+ // }
+ t = Math.round((dheight - h - de) / 2);
+ var l = Math.round((dwidth - w) / 2);
+ $('.record',container).css({
+ width: w,
+ height: h,
+ top: t,
+ left: l
+ }).attr('width',w).attr('height',h);
}
function previewEdit(r)
{
- $('#TH_Opreview .PNB10').empty().append(p4.edit.T_records[r].preview);
+ $('#TH_Opreview .PNB10').empty().append(p4.edit.T_records[r].preview);
- // var data = p4.edit.T_records[r].preview;
+ // var data = p4.edit.T_records[r].preview;
- // if ((data.doctype == 'video' || data.doctype == 'audio' || data.doctype == 'flash')) {
- // if(data.doctype != 'video' && data.flashcontent.url)
- // {
- // var flashvars = false;
- // var params = {
- // menu: "false",
- // flashvars: data.flashcontent.flashVars,
- // movie: data.flashcontent.url,
- // allowFullScreen :"true",
- // wmode: "transparent"
- // };
- // var attributes = false;
- // if (data.doctype != 'audio') {
- // attributes = {
- // styleclass: "PREVIEW_PIC"
- // };
- // }
- // swfobject.embedSWF(data.flashcontent.url, "FLASHPREVIEW", data.flashcontent.width, data.flashcontent.height, "9.0.0", false, flashvars, params, attributes);
- // }
- // else
- // {
- // flowplayer("FLASHPREVIEW", '/include/flowplayer/flowplayer-3.2.2.swf',{
- // clip: {
- // autoPlay: true,
- // autoBuffering:true,
- // provider: 'h264streaming',
- // metadata: false,
- // scaling:'fit',
- // url: data.flashcontent.flv
- // },
- // onError:function(code,message){
- // getNewVideoToken(p4.edit.T_records[r].sbas_id, p4.edit.T_records[r].rid, this);
- // },
- // plugins: {
- // h264streaming: {
- // url: '/include/flowplayer/flowplayer.pseudostreaming-3.2.2.swf'
- // }
- // }
- // });
- // }
- // }
+ // if ((data.doctype == 'video' || data.doctype == 'audio' || data.doctype == 'flash')) {
+ // if(data.doctype != 'video' && data.flashcontent.url)
+ // {
+ // var flashvars = false;
+ // var params = {
+ // menu: "false",
+ // flashvars: data.flashcontent.flashVars,
+ // movie: data.flashcontent.url,
+ // allowFullScreen :"true",
+ // wmode: "transparent"
+ // };
+ // var attributes = false;
+ // if (data.doctype != 'audio') {
+ // attributes = {
+ // styleclass: "PREVIEW_PIC"
+ // };
+ // }
+ // swfobject.embedSWF(data.flashcontent.url, "FLASHPREVIEW", data.flashcontent.width, data.flashcontent.height, "9.0.0", false, flashvars, params, attributes);
+ // }
+ // else
+ // {
+ // flowplayer("FLASHPREVIEW", '/include/flowplayer/flowplayer-3.2.2.swf',{
+ // clip: {
+ // autoPlay: true,
+ // autoBuffering:true,
+ // provider: 'h264streaming',
+ // metadata: false,
+ // scaling:'fit',
+ // url: data.flashcontent.flv
+ // },
+ // onError:function(code,message){
+ // getNewVideoToken(p4.edit.T_records[r].sbas_id, p4.edit.T_records[r].rid, this);
+ // },
+ // plugins: {
+ // h264streaming: {
+ // url: '/include/flowplayer/flowplayer.pseudostreaming-3.2.2.swf'
+ // }
+ // }
+ // });
+ // }
+ // }
- if($('img.PREVIEW_PIC.zoomable').length > 0)
- {
- $('img.PREVIEW_PIC.zoomable').draggable();
- }
- setPreviewEdit();
+ if($('img.PREVIEW_PIC.zoomable').length > 0)
+ {
+ $('img.PREVIEW_PIC.zoomable').draggable();
+ }
+ setPreviewEdit();
}
function startThisEditing(sbas_id,what,regbasprid,ssel)
{
- p4.edit.sbas_id = sbas_id;
- p4.edit.what = what;
- p4.edit.regbasprid = regbasprid;
- p4.edit.ssel = ssel;
+ p4.edit.sbas_id = sbas_id;
+ p4.edit.what = what;
+ p4.edit.regbasprid = regbasprid;
+ p4.edit.ssel = ssel;
- for(r in p4.edit.T_records)
- {
- var fields = {};
-
- for(f in p4.edit.T_records[r].fields)
+ for(r in p4.edit.T_records)
{
- var meta_struct_id = p4.edit.T_records[r].fields[f].meta_struct_id;
+ var fields = {};
- var name = p4.edit.T_fields[meta_struct_id].name;
- var label = p4.edit.T_fields[meta_struct_id].label;
+ for(f in p4.edit.T_records[r].fields)
+ {
+ var meta_struct_id = p4.edit.T_records[r].fields[f].meta_struct_id;
- var multi = p4.edit.T_fields[meta_struct_id].multi;
- var required = p4.edit.T_fields[meta_struct_id].required;
- var readonly = p4.edit.T_fields[meta_struct_id].readonly;
- var maxLength = p4.edit.T_fields[meta_struct_id].maxLength;
- var minLength = p4.edit.T_fields[meta_struct_id].minLength;
- var type = p4.edit.T_fields[meta_struct_id].type;
- var separator = p4.edit.T_fields[meta_struct_id].separator;
- var vocabularyControl = p4.edit.T_fields[meta_struct_id].vocabularyControl;
- var vocabularyRestricted = p4.edit.T_fields[meta_struct_id].vocabularyRestricted;
+ var name = p4.edit.T_fields[meta_struct_id].name;
+ var label = p4.edit.T_fields[meta_struct_id].label;
- var fieldOptions = {
- multi:multi,
- required:required,
- readonly:readonly,
- maxLength:maxLength,
- minLength:minLength,
- type:type,
- separator:separator,
- vocabularyControl:vocabularyControl,
- vocabularyRestricted:vocabularyRestricted
- };
+ var multi = p4.edit.T_fields[meta_struct_id].multi;
+ var required = p4.edit.T_fields[meta_struct_id].required;
+ var readonly = p4.edit.T_fields[meta_struct_id].readonly;
+ var maxLength = p4.edit.T_fields[meta_struct_id].maxLength;
+ var minLength = p4.edit.T_fields[meta_struct_id].minLength;
+ var type = p4.edit.T_fields[meta_struct_id].type;
+ var separator = p4.edit.T_fields[meta_struct_id].separator;
+ var vocabularyControl = p4.edit.T_fields[meta_struct_id].vocabularyControl;
+ var vocabularyRestricted = p4.edit.T_fields[meta_struct_id].vocabularyRestricted;
- var databoxField = new p4.databoxField(name, label, meta_struct_id, fieldOptions);
+ var fieldOptions = {
+ multi:multi,
+ required:required,
+ readonly:readonly,
+ maxLength:maxLength,
+ minLength:minLength,
+ type:type,
+ separator:separator,
+ vocabularyControl:vocabularyControl,
+ vocabularyRestricted:vocabularyRestricted
+ };
- var values = [];
+ var databoxField = new p4.databoxField(name, label, meta_struct_id, fieldOptions);
- for(v in p4.edit.T_records[r].fields[f].values)
- {
- var meta_id = p4.edit.T_records[r].fields[f].values[v].meta_id;
- var value = p4.edit.T_records[r].fields[f].values[v].value;
- var vocabularyId = p4.edit.T_records[r].fields[f].values[v].vocabularyId;
+ var values = [];
- values.push(new p4.recordFieldValue(meta_id, value, vocabularyId));
- }
+ for(v in p4.edit.T_records[r].fields[f].values)
+ {
+ var meta_id = p4.edit.T_records[r].fields[f].values[v].meta_id;
+ var value = p4.edit.T_records[r].fields[f].values[v].value;
+ var vocabularyId = p4.edit.T_records[r].fields[f].values[v].vocabularyId;
+
+ values.push(new p4.recordFieldValue(meta_id, value, vocabularyId));
+ }
+
+ fields[f] = new p4.recordField(databoxField, values);
+ }
+
+ p4.edit.T_records[r].fields = fields;
+ p4.edit.fields = fields;
- fields[f] = new p4.recordField(databoxField, values);
}
- p4.edit.T_records[r].fields = fields;
- p4.edit.fields = fields;
-
- }
-
- $('#EditTextMultiValued').bind('keyup', function(){
- reveal_mval($(this).val());
- });
-
- $('#EDIT_MID_R .tabs').tabs();
-
- $('#divS div.edit_field:odd').addClass('odd');
- $('#divS div').bind('mouseover',function(){
- $(this).addClass('hover');
- }).bind('mouseout',function(){
- $(this).removeClass('hover');
- });
-
- $('#editcontextwrap').remove();
-
- if($('#editcontextwrap').length == 0)
- $('body').append('
');
-
- self.setTimeout("edit_select_all();", 100);
-
- $('.previewTips, .DCESTips, .fieldTips', p4.edit.editBox).tooltip({
- fixable:true,
- fixableIndex:1200
- });
- $('.infoTips', p4.edit.editBox).tooltip();
-
- if(p4.edit.what == 'GRP')
- {
- $('#EDIT_FILM2 .reg_opts').show();
-
- $.each($('#EDIT_FILM2 .contextMenuTrigger'),function(){
-
- var id = $(this).attr('id').split('_').slice(1,3).join('_');
- $(this).contextMenu('#editContext_'+id+'',{
- appendTo:'#editcontextwrap',
- openEvt:'click',
- dropDown:true,
- theme:'vista',
- dropDown:true,
- showTransition:'slideDown',
- hideTransition:'hide',
- shadow:false
- });
+ $('#EditTextMultiValued').bind('keyup', function(){
+ reveal_mval($(this).val());
});
- }
- hsplit1();
- vsplit2()
- vsplit1();
+ $('#EDIT_MID_R .tabs').tabs();
- $('#EDIT_TOP', p4.edit.editBox).resizable({
- handles : 's',
- minHeight:100,
- resize:function(){
- hsplit1();
- setPreviewEdit();
- },
- stop:function(){
- hsplit1();
- setPref('editing_top_box', Math.floor($('#EDIT_TOP').height() * 100 / $('#EDIT_ALL').height()) + '%');
- setSizeLimits();
+ $('#divS div.edit_field:odd').addClass('odd');
+ $('#divS div').bind('mouseover',function(){
+ $(this).addClass('hover');
+ }).bind('mouseout',function(){
+ $(this).removeClass('hover');
+ });
+
+ $('#editcontextwrap').remove();
+
+ if($('#editcontextwrap').length == 0)
+ $('body').append('
');
+
+ self.setTimeout("edit_select_all();", 100);
+
+ $('.previewTips, .DCESTips, .fieldTips', p4.edit.editBox).tooltip({
+ fixable:true,
+ fixableIndex:1200
+ });
+ $('.infoTips', p4.edit.editBox).tooltip();
+
+ if(p4.edit.what == 'GRP')
+ {
+ $('#EDIT_FILM2 .reg_opts').show();
+
+ $.each($('#EDIT_FILM2 .contextMenuTrigger'),function(){
+
+ var id = $(this).attr('id').split('_').slice(1,3).join('_');
+ $(this).contextMenu('#editContext_'+id+'',{
+ appendTo:'#editcontextwrap',
+ openEvt:'click',
+ dropDown:true,
+ theme:'vista',
+ dropDown:true,
+ showTransition:'slideDown',
+ hideTransition:'hide',
+ shadow:false
+ });
+ });
}
- });
- $('#divS_wrapper', p4.edit.editBox).resizable({
- handles : 'e',
- minWidth:200,
- resize:function(){
- vsplit1();
- setPreviewEdit();
- },
- stop:function(){
- setPref('editing_right_box', Math.floor($('#divS').width() * 100 / $('#EDIT_MID_L').width()) + '%');
- vsplit1();
- setSizeLimits();
- }
- });
+ hsplit1();
+ vsplit2()
+ vsplit1();
-$('#EDIT_MID_R')
- .css('left', $('#EDIT_MID_L').position().left + $('#EDIT_MID_L').width() + 15)
- .resizable({
- handles : 'w',
- minWidth:200,
+ $('#EDIT_TOP', p4.edit.editBox).resizable({
+ handles : 's',
+ minHeight:100,
resize:function(){
- vsplit2();
- setPreviewEdit();
+ hsplit1();
+ setPreviewEdit();
},
stop:function(){
- setPref('editing_left_box', Math.floor($('#EDIT_MID_R').width() * 100 / $('#EDIT_MID').width()) + '%');
- vsplit2();
- setSizeLimits();
+ hsplit1();
+ setPref('editing_top_box', Math.floor($('#EDIT_TOP').height() * 100 / $('#EDIT_ALL').height()) + '%');
+ setSizeLimits();
}
});
- $('#EDIT_ZOOMSLIDER', p4.edit.editBox).slider({
- min:60,
- max:300,
- value:p4.edit.diapoSize,
- slide:function(event,ui)
- {
- var v = $(ui.value)[0];
- $('#EDIT_FILM2 .diapo', p4.edit.editBox).width(v).height(v);
- },
- change:function(event,ui)
- {
- p4.edit.diapoSize = $(ui.value)[0];
- setPref("editing_images_size", p4.edit.diapoSize);
- }
- });
+ $('#divS_wrapper', p4.edit.editBox).resizable({
+ handles : 'e',
+ minWidth:200,
+ resize:function(){
+ vsplit1();
+ setPreviewEdit();
+ },
+ stop:function(){
+ setPref('editing_right_box', Math.floor($('#divS').width() * 100 / $('#EDIT_MID_L').width()) + '%');
+ vsplit1();
+ setSizeLimits();
+ }
+ });
- var buttons = {};
- buttons[language.valider] = function(e)
- {
- $(this).dialog("close");
- edit_applyMultiDesc(e);
- };
- buttons[language.annuler] = function(e)
- {
- $(this).dialog("close");
- edit_cancelMultiDesc(e);
- };
+ $('#EDIT_MID_R')
+ .css('left', $('#EDIT_MID_L').position().left + $('#EDIT_MID_L').width() + 15)
+ .resizable({
+ handles : 'w',
+ minWidth:200,
+ resize:function(){
+ vsplit2();
+ setPreviewEdit();
+ },
+ stop:function(){
+ setPref('editing_left_box', Math.floor($('#EDIT_MID_R').width() * 100 / $('#EDIT_MID').width()) + '%');
+ vsplit2();
+ setSizeLimits();
+ }
+ });
- $("#EDIT_CLOSEDIALOG", p4.edit.editBox).dialog({
- autoOpen: false,
- closeOnEscape:true,
- resizable:false,
- draggable:false,
- modal:true,
- buttons: buttons
- });
+ $('#EDIT_ZOOMSLIDER', p4.edit.editBox).slider({
+ min:60,
+ max:300,
+ value:p4.edit.diapoSize,
+ slide:function(event,ui)
+ {
+ var v = $(ui.value)[0];
+ $('#EDIT_FILM2 .diapo', p4.edit.editBox).width(v).height(v);
+ },
+ change:function(event,ui)
+ {
+ p4.edit.diapoSize = $(ui.value)[0];
+ setPref("editing_images_size", p4.edit.diapoSize);
+ }
+ });
- var buttons = {};
- buttons[language.valider] = function()
- {
- var form = $("#Edit_copyPreset_dlg FORM");
- var jtitle = $(".EDIT_presetTitle", form);
- if(jtitle.val() == '')
+ var buttons = {};
+ buttons[language.valider] = function(e)
{
- alert(language.needTitle);
- jtitle[0].focus();
- return;
- }
+ $(this).dialog("close");
+ edit_applyMultiDesc(e);
+ };
+ buttons[language.annuler] = function(e)
+ {
+ $(this).dialog("close");
+ edit_cancelMultiDesc(e);
+ };
+
+ $("#EDIT_CLOSEDIALOG", p4.edit.editBox).dialog({
+ autoOpen: false,
+ closeOnEscape:true,
+ resizable:false,
+ draggable:false,
+ modal:true,
+ buttons: buttons
+ });
+
+ var buttons = {};
+ buttons[language.valider] = function()
+ {
+ var form = $("#Edit_copyPreset_dlg FORM");
+ var jtitle = $(".EDIT_presetTitle", form);
+ if(jtitle.val() == '')
+ {
+ alert(language.needTitle);
+ jtitle[0].focus();
+ return;
+ }
+
+ var p = {
+ "act":"SAVE",
+ "sbas":p4.edit.sbas_id,
+ "title":jtitle.val(),
+ "f":{}
+ };
+ var f = {};
+ var x = "";
+ $(":checkbox", form).each(
+ function(idx, elem)
+ {
+ if(elem.checked)
+ {
+ var i = 0|elem.value;
+ var f;
+ if(p4.edit.T_fields[i].multi)
+ f = p4.edit.T_fields[i]._value.split(";");
+ else
+ f = [ p4.edit.T_fields[i]._value ];
+ for(j in f)
+ {
+ x += "<"+p4.edit.T_fields[i].name+">"
+ + cleanTags(f[j])
+ + ""+p4.edit.T_fields[i].name+">";
+ }
+ }
+ }
+ );
+
+ x += " ";
+ p["f"] = x;
+
+ $.ajax({
+ type: 'POST',
+ url: "/xmlhttp/editing_presets.j.php",
+ data: p,
+ dataType: 'json',
+ success: function(data, textStatus)
+ {
+ preset_paint(data);
+
+ if ($("#Edit_copyPreset_dlg").data("ui-dialog")) {
+ $("#Edit_copyPreset_dlg").dialog("close");
+ }
+ }
+ });
+ };
+ buttons[language.annuler] = function()
+ {
+ $(this).dialog("close");
+
+ };
+
+ $("#Edit_copyPreset_dlg", p4.edit.editBox).dialog({
+ stack:true,
+ closeOnEscape:true,
+ resizable:false,
+ draggable:false,
+ autoOpen:false,
+ modal:true,
+ width:600,
+ title:language.newPreset,
+ close: function(event,ui) {
+ $(this).dialog("widget").css("z-index", "auto");
+ },
+ open:function(event, ui) {
+ $(this).dialog("widget").css("z-index", "5000");
+ $(".EDIT_presetTitle")[0].focus();
+ },
+ buttons:buttons
+ });
+
+ $('#idEditDateZone', p4.edit.editBox).datepicker({
+ changeYear: true,
+ changeMonth:true,
+ dateFormat: 'yy/mm/dd',
+ onSelect: function(dateText, inst)
+ {
+ var lval = $('#idEditZTextArea', p4.edit.editBox).val();
+ if(lval != dateText)
+ {
+ fieldLastValue = lval;
+ $('#idEditZTextArea', p4.edit.editBox).val(dateText);
+ $('#idEditZTextArea').trigger('keyup.maxLength');
+ textareaIsDirty = true;
+ edit_validField(null, 'ok');
+ }
+ }
+ });
+
+ ETHSeeker = new EditThesaurusSeeker(p4.edit.sbas_id);
+
+ setSizeLimits();
var p = {
- "act":"SAVE",
- "sbas":p4.edit.sbas_id,
- "title":jtitle.val(),
- "f":{}
+ "act":"LIST",
+ "sbas":p4.edit.sbas_id
};
- var f = {};
- var x = "";
- $(":checkbox", form).each(
- function(idx, elem)
- {
- if(elem.checked)
+ $.getJSON(
+ "/xmlhttp/editing_presets.j.php",
+ p,
+ function(data, textStatus)
{
- var i = 0|elem.value;
- var f;
- if(p4.edit.T_fields[i].multi)
- f = p4.edit.T_fields[i]._value.split(";");
- else
- f = [ p4.edit.T_fields[i]._value ];
- for(j in f)
- {
- x += "<"+p4.edit.T_fields[i].name+">"
- + cleanTags(f[j])
- + ""+p4.edit.T_fields[i].name+">";
- }
+ preset_paint(data);
}
- }
- );
-
- x += " ";
- p["f"] = x;
-
- $.ajax({
- type: 'POST',
- url: "/xmlhttp/editing_presets.j.php",
- data: p,
- dataType: 'json',
- success: function(data, textStatus)
- {
- preset_paint(data);
-
- if ($("#Edit_copyPreset_dlg").data("ui-dialog")) {
- $("#Edit_copyPreset_dlg").dialog("close");
- }
- }
- });
- };
- buttons[language.annuler] = function()
- {
- $(this).dialog("close");
-
- };
-
- $("#Edit_copyPreset_dlg", p4.edit.editBox).dialog({
- stack:true,
- closeOnEscape:true,
- resizable:false,
- draggable:false,
- autoOpen:false,
- modal:true,
- width:600,
- title:language.newPreset,
- close: function(event,ui) {
- $(this).dialog("widget").css("z-index", "auto");
- },
- open:function(event, ui) {
- $(this).dialog("widget").css("z-index", "5000");
- $(".EDIT_presetTitle")[0].focus();
- },
- buttons:buttons
- });
-
- $('#idEditDateZone', p4.edit.editBox).datepicker({
- changeYear: true,
- changeMonth:true,
- dateFormat: 'yy/mm/dd',
- onSelect: function(dateText, inst)
- {
- var lval = $('#idEditZTextArea', p4.edit.editBox).val();
- if(lval != dateText)
- {
- fieldLastValue = lval;
- $('#idEditZTextArea', p4.edit.editBox).val(dateText);
- $('#idEditZTextArea').trigger('keyup.maxLength');
- textareaIsDirty = true;
- edit_validField(null, 'ok');
- }
- }
- });
-
- ETHSeeker = new EditThesaurusSeeker(p4.edit.sbas_id);
-
- setSizeLimits();
-
- var p = {
- "act":"LIST",
- "sbas":p4.edit.sbas_id
- };
- $.getJSON(
- "/xmlhttp/editing_presets.j.php",
- p,
- function(data, textStatus)
- {
- preset_paint(data);
- }
);
- check_required();
+ check_required();
- $('#TH_Opresets button.adder').bind('click', function(){
- preset_copy();
- });
+ $('#TH_Opresets button.adder').bind('click', function(){
+ preset_copy();
+ });
- try{
- $('#divS .edit_field:first').trigger('mousedown');
- }
- catch(err)
- {
+ try{
+ $('#divS .edit_field:first').trigger('mousedown');
+ }
+ catch(err)
+ {
- }
+ }
}
function setRegDefault(n,record_id)
{
- p4.edit.newrepresent = record_id;
+ p4.edit.newrepresent = record_id;
- var src = $('#idEditDiapo_'+n).find('img.edit_IMGT').attr('src');
- var style = $('#idEditDiapo_'+n).find('img.edit_IMGT').attr('style');
+ var src = $('#idEditDiapo_'+n).find('img.edit_IMGT').attr('src');
+ var style = $('#idEditDiapo_'+n).find('img.edit_IMGT').attr('style');
- $('#EDIT_GRPDIAPO .edit_IMGT').attr('src',src).attr('style',style);
+ $('#EDIT_GRPDIAPO .edit_IMGT').attr('src',src).attr('style',style);
}
diff --git a/www/skins/prod/jquery.main-prod.js b/www/skins/prod/jquery.main-prod.js
index e7e03f5265..f495fd70a5 100644
--- a/www/skins/prod/jquery.main-prod.js
+++ b/www/skins/prod/jquery.main-prod.js
@@ -428,7 +428,7 @@ function afterSearch()
$('.rollover-gif-hover',this).hide();
$('.rollover-gif-out',this).show();
}
- );
+ );
viewNbSelect();
$('#answers div.IMGT').draggable({
helper : function(){
@@ -464,7 +464,7 @@ function initAnswerForm(){
searchForm.unbind('submit').bind('submit',function(){
var $this = $(this),
- method = $this.attr('method') ? $this.attr('method') : 'POST';
+ method = $this.attr('method') ? $this.attr('method') : 'POST';
answAjax = $.ajax({
type: method,
@@ -750,7 +750,7 @@ function toHex(N) {
N=Math.min(N,255);
N=Math.round(N);
return "0123456789ABCDEF".charAt((N-N%16)/16)
- + "0123456789ABCDEF".charAt(N%16);
+ + "0123456789ABCDEF".charAt(N%16);
}
function hsl2rgb(h, s, l) {
var m1, m2, hue;
@@ -917,10 +917,10 @@ $(document).ready(function(){
$('style[title=color_selection]').empty();
var datas = '.diapo.selected,#reorder_box .diapo.selected, #EDIT_ALL .diapo.selected, .list.selected, .list.selected .diapo' +
- '{'+
- ' COLOR: #'+back_hex+';'+
- ' BACKGROUND-COLOR: #'+hex+';'+
- '}';
+ '{'+
+ ' COLOR: #'+back_hex+';'+
+ ' BACKGROUND-COLOR: #'+hex+';'+
+ '}';
$('style[title=color_selection]').empty().text(datas);
}
});
@@ -1022,22 +1022,22 @@ $(document).ready(function(){
$("#DIALOG").dialog('destroy');
}
$("#DIALOG").attr('title',data.titre)
- .empty()
- .append(data.texte)
- .dialog({
- autoOpen:false,
- closeOnEscape:true,
- resizable:false,
- draggable:false,
- modal:true,
- buttons:buttons,
- width:650,
- height:250,
- overlay: {
- backgroundColor: '#000',
- opacity: 0.7
- }
- }).dialog('open');
+ .empty()
+ .append(data.texte)
+ .dialog({
+ autoOpen:false,
+ closeOnEscape:true,
+ resizable:false,
+ draggable:false,
+ modal:true,
+ buttons:buttons,
+ width:650,
+ height:250,
+ overlay: {
+ backgroundColor: '#000',
+ opacity: 0.7
+ }
+ }).dialog('open');
}
}
@@ -1053,8 +1053,8 @@ $(document).ready(function(){
$('#history-queries ul li').live('mouseover',function(){
$(this).addClass('hover');
}).live('mouseout',function(){
- $(this).removeClass('hover');
- });
+ $(this).removeClass('hover');
+ });
startThesaurus();
checkFilters();
@@ -1094,15 +1094,15 @@ $(document).ready(function(){
$('#idFrameC').stop().animate({
- width : nwidth
- },
- 300,
- 'linear',
- function(){
- answerSizer();
- linearize();
- saveWindows();
- });
+ width : nwidth
+ },
+ 300,
+ 'linear',
+ function(){
+ answerSizer();
+ linearize();
+ saveWindows();
+ });
}
});
@@ -1163,17 +1163,17 @@ $(document).ready(function(){
$('.tools .answer_selector').bind('click',function(){
selector($(this));
}).bind('mouseover',function(event){
- if(is_ctrl_key(event))
- {
- $(this).addClass('add_selector');
- }
- else
- {
+ if(is_ctrl_key(event))
+ {
+ $(this).addClass('add_selector');
+ }
+ else
+ {
+ $(this).removeClass('add_selector');
+ }
+ }).bind('mouseout',function(){
$(this).removeClass('add_selector');
- }
- }).bind('mouseout',function(){
- $(this).removeClass('add_selector');
- });
+ });
getLanguage();
@@ -1233,27 +1233,27 @@ $(document).ready(function(){
if(p4.preview.open)
{
if (($('#dialog_dwnl:visible').length === 0 && $('#DIALOG1').length === 0 && $('#DIALOG2').length === 0)) {
- switch(event.keyCode)
- {
- case 39:
- getNext();
- cancelKey = shortCut = true;
- break;
- case 37:
- getPrevious();
- cancelKey = shortCut = true;
- break;
- case 27://escape
- closePreview();
- break;
- case 32:
- if(p4.slideShow)
- stopSlide();
- else
- startSlide();
- cancelKey = shortCut = true;
- break;
- }
+ switch(event.keyCode)
+ {
+ case 39:
+ getNext();
+ cancelKey = shortCut = true;
+ break;
+ case 37:
+ getPrevious();
+ cancelKey = shortCut = true;
+ break;
+ case 27://escape
+ closePreview();
+ break;
+ case 32:
+ if(p4.slideShow)
+ stopSlide();
+ else
+ startSlide();
+ cancelKey = shortCut = true;
+ break;
+ }
}
}
else
@@ -1411,8 +1411,8 @@ $(document).ready(function(){
$('#EDIT_query').bind('focus',function(){
$(this).addClass('focused');
}).bind('blur',function(){
- $(this).removeClass('focused');
- });
+ $(this).removeClass('focused');
+ });
$('.basketTips').tooltip({
delay: 200
@@ -1716,7 +1716,7 @@ function toolREFACTOR(datas){
dialog.setContent(data);
return;
}
- );
+ );
}
@@ -2071,8 +2071,8 @@ function activeIcons()
}
/**
- * if works, then the object is not empty
- */
+ * if works, then the object is not empty
+ */
for(i in value)
{
return chgCollThis(value);
@@ -2098,7 +2098,7 @@ function activeIcons()
}
} else {
if ($this.hasClass('basket_element')) {
- params.ssel = $('.SSTT.active').attr('id').split('_').slice(1,2).pop();
+ params.ssel = $('.SSTT.active').attr('id').split('_').slice(1,2).pop();
} else {
if ($this.hasClass('story_window')) {
if (p4.WorkZone.Selection.length() > 0) {
@@ -2388,21 +2388,21 @@ function printThis(value)
$("#DIALOG").dialog('destroy');
}
$('#DIALOG').attr('title', language.print)
- .empty().addClass('loading')
- .dialog({
- resizable:false,
- closeOnEscape:true,
- modal:true,
- width:'800',
- height:'500',
- open: function(event, ui) {
- $(this).dialog("widget").css("z-index", "1999");
- },
- close: function(event, ui) {
- $(this).dialog("widget").css("z-index", "auto");
- }
- })
- .dialog('open');
+ .empty().addClass('loading')
+ .dialog({
+ resizable:false,
+ closeOnEscape:true,
+ modal:true,
+ width:'800',
+ height:'500',
+ open: function(event, ui) {
+ $(this).dialog("widget").css("z-index", "1999");
+ },
+ close: function(event, ui) {
+ $(this).dialog("widget").css("z-index", "auto");
+ }
+ })
+ .dialog('open');
$.ajax({
type: "POST",
@@ -2413,7 +2413,7 @@ function printThis(value)
},
success: function(data){
$('#DIALOG').removeClass('loading').empty()
- .append(data);
+ .append(data);
return;
}
});
@@ -2432,7 +2432,7 @@ function downloadThis(datas)
$('.close_button', dialog.getDomElement()).bind('click',function(){
dialog.Close();
- });
+ });
return false;
});
@@ -2581,8 +2581,8 @@ function doDelete(lst)
$.each(data,function(i,n){
var imgt = $('#IMGT_'+n),
- chim = $('.CHIM_'+n),
- stories = $('.STORY_'+n);
+ chim = $('.CHIM_'+n),
+ stories = $('.STORY_'+n);
$('.doc_infos', imgt).remove();
imgt.unbind("click").removeAttr("ondblclick").removeClass("selected").removeClass("IMGT").find("img").unbind();
@@ -3053,10 +3053,10 @@ function set_up_feed_box(data)
$(this).addClass('selected');
$('input[name="feed_id"]', $form).val($('input', this).val());
}).hover(function(){
- $(this).addClass('hover');
- },function(){
- $(this).removeClass('hover');
- });
+ $(this).addClass('hover');
+ },function(){
+ $(this).removeClass('hover');
+ });
$form.bind('submit', function(){
return false;
diff --git a/www/skins/prod/publicator.js b/www/skins/prod/publicator.js
index 59ac86a776..6b805c8ed9 100644
--- a/www/skins/prod/publicator.js
+++ b/www/skins/prod/publicator.js
@@ -8,11 +8,11 @@ function publicator_reload_publicator()
function init_publicator(datas)
{
- var dialog = p4.Dialog.Create({
- size:'Full',
- title:'Bridge',
- loading: false
- });
+ var dialog = p4.Dialog.Create({
+ size:'Full',
+ title:'Bridge',
+ loading: false
+ });
dialog.load('/prod/bridge/manager/', 'POST', datas);
}
diff --git a/www/skins/report/report.js b/www/skins/report/report.js
index 099901c164..990d97dfc5 100644
--- a/www/skins/report/report.js
+++ b/www/skins/report/report.js
@@ -101,8 +101,8 @@ function bindEvents() {
},
text: false
}).unbind("click").bind("click", function () {
- showMenu();
- });
+ showMenu();
+ });
$("#liste_dash").find("em").unbind("click").bind("click", function () {
id = $(this).attr('id').substr(3);
diff --git a/www/skins/thesaurus/sprintf.js b/www/skins/thesaurus/sprintf.js
index c139aa414e..3c0773938b 100644
--- a/www/skins/thesaurus/sprintf.js
+++ b/www/skins/thesaurus/sprintf.js
@@ -1,108 +1,108 @@
-//////////////////////////////////////////////////////////////////////////////
-// sprintf function for javascript
+//////////////////////////////////////////////////////////////////////////////
+// sprintf function for javascript
function sprintf()
-{
- if (!arguments || arguments.length < 1 || !RegExp)
- {
- return '';
- }
-
- str = arguments[0];
- while((newstr = str.replace("\n", "\x01")) != str)
- str = newstr;
- // var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
- var re = new RegExp("^([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)$", "m");
- re["$*"] = true;
- var a = b = [], numSubstitutions = 0, numMatches = 0;
- a = re.exec(str);
- 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++;
-
-// alert("str:"+str + "\nl:"+leftpart + "\nr:"+rightPart);
-
- if (pType == '%')
- {
- subst = '%';
- }
- else
- {
- numSubstitutions++;
- 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) == "'")
- {
- pad = leftpart.substr(1,1);
- }
- else if (pPad)
- {
- pad = pPad;
- }
- var justifyRight = true;
- if (pJustify && pJustify === "-")
- justifyRight = false;
- var minLength = -1;
- if (pMinLength)
- minLength = parseInt(pMinLength);
- var precision = -1;
- if (pPrecision && pType == 'f')
- {
- precision = parseInt(pPrecision.substring(1));
- }
- var subst = param;
- switch (pType)
- {
- case 'b':
- subst = parseInt(param).toString(2);
- break;
- case 'c':
- subst = String.fromCharCode(parseInt(param));
- break;
- case 'd':
- subst = parseInt(param)? parseInt(param) : 0;
- break;
- case 'u':
- subst = Math.abs(param);
- break;
- case 'f':
- subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision) : parseFloat(param);
- break;
- case 'o':
- subst = parseInt(param).toString(8);
- break;
- case 's':
- subst = param;
- break;
- case 'x':
- subst = ('' + parseInt(param).toString(16)).toLowerCase();
- break;
- case 'X':
- subst = ('' + parseInt(param).toString(16)).toUpperCase();
- break;
- default:
- break;
- }
- var padLeft = minLength - subst.toString().length;
- var padding;
- if (padLeft > 0)
- {
- var arrTmp = new Array(padLeft+1);
- padding = arrTmp.join(pad?pad:" ");
- }
- else
- {
- padding = "";
- }
- }
- str = leftpart + padding + subst + rightPart;
+{
+ if (!arguments || arguments.length < 1 || !RegExp)
+ {
+ return '';
+ }
+
+ str = arguments[0];
+ while((newstr = str.replace("\n", "\x01")) != str)
+ str = newstr;
+ // var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
+ var re = new RegExp("^([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)$", "m");
+ re["$*"] = true;
+ var a = b = [], numSubstitutions = 0, numMatches = 0;
a = re.exec(str);
- }
- while((newstr = str.replace("\x01", "\n")) != str)
- str = newstr;
- return(str);
-}
+ 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++;
+
+// alert("str:"+str + "\nl:"+leftpart + "\nr:"+rightPart);
+
+ if (pType == '%')
+ {
+ subst = '%';
+ }
+ else
+ {
+ numSubstitutions++;
+ 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) == "'")
+ {
+ pad = leftpart.substr(1,1);
+ }
+ else if (pPad)
+ {
+ pad = pPad;
+ }
+ var justifyRight = true;
+ if (pJustify && pJustify === "-")
+ justifyRight = false;
+ var minLength = -1;
+ if (pMinLength)
+ minLength = parseInt(pMinLength);
+ var precision = -1;
+ if (pPrecision && pType == 'f')
+ {
+ precision = parseInt(pPrecision.substring(1));
+ }
+ var subst = param;
+ switch (pType)
+ {
+ case 'b':
+ subst = parseInt(param).toString(2);
+ break;
+ case 'c':
+ subst = String.fromCharCode(parseInt(param));
+ break;
+ case 'd':
+ subst = parseInt(param)? parseInt(param) : 0;
+ break;
+ case 'u':
+ subst = Math.abs(param);
+ break;
+ case 'f':
+ subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision) : parseFloat(param);
+ break;
+ case 'o':
+ subst = parseInt(param).toString(8);
+ break;
+ case 's':
+ subst = param;
+ break;
+ case 'x':
+ subst = ('' + parseInt(param).toString(16)).toLowerCase();
+ break;
+ case 'X':
+ subst = ('' + parseInt(param).toString(16)).toUpperCase();
+ break;
+ default:
+ break;
+ }
+ var padLeft = minLength - subst.toString().length;
+ var padding;
+ if (padLeft > 0)
+ {
+ var arrTmp = new Array(padLeft+1);
+ padding = arrTmp.join(pad?pad:" ");
+ }
+ else
+ {
+ padding = "";
+ }
+ }
+ str = leftpart + padding + subst + rightPart;
+ a = re.exec(str);
+ }
+ while((newstr = str.replace("\x01", "\n")) != str)
+ str = newstr;
+ return(str);
+}
diff --git a/www/skins/thesaurus/thesaurus.js b/www/skins/thesaurus/thesaurus.js
index 7d67465046..3e93a69a7b 100644
--- a/www/skins/thesaurus/thesaurus.js
+++ b/www/skins/thesaurus/thesaurus.js
@@ -1,422 +1,422 @@
function loadXMLDoc(url, post_parms, asxml)
{
- if(typeof(asxml)=="undefined")
- asxml = false;
- out = null;
- xmlhttp = null;
- // code for Mozilla, etc.
- if (window.XMLHttpRequest)
- xmlhttp=new XMLHttpRequest();
- else if (window.ActiveXObject)
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- if (xmlhttp)
- {
- // xmlhttp.onreadystatechange=state_Change
- if(post_parms)
- {
- xmlhttp.open("POST", url, false);
- xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
- xmlhttp.send(post_parms);
- }
- else
- {
- xmlhttp.open("GET", url, false);
- xmlhttp.send(null);
- }
- out = asxml ? xmlhttp.responseXML : xmlhttp.responseText;
- }
- return(out);
+ if(typeof(asxml)=="undefined")
+ asxml = false;
+ out = null;
+ xmlhttp = null;
+ // code for Mozilla, etc.
+ if (window.XMLHttpRequest)
+ xmlhttp=new XMLHttpRequest();
+ else if (window.ActiveXObject)
+ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
+ if (xmlhttp)
+ {
+ // xmlhttp.onreadystatechange=state_Change
+ if(post_parms)
+ {
+ xmlhttp.open("POST", url, false);
+ xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
+ xmlhttp.send(post_parms);
+ }
+ else
+ {
+ xmlhttp.open("GET", url, false);
+ xmlhttp.send(null);
+ }
+ out = asxml ? xmlhttp.responseXML : xmlhttp.responseText;
+ }
+ return(out);
}
function showFound2(term, lterm, branch, depth)
{
- var c;
- var ret = 0;
- var thb = branch.firstChild.nextSibling.nextSibling;
- // branch est un
-
- if(thb)
- {
- for(c=thb.firstChild; c; c=c.nextSibling) // THE, les SY ou les TA
- {
- if(c.nodeName=="DIV")
- ret += showFound2(term, lterm, c, depth+1); // on descend uniquement les THE_yyy
- }
- }
+ var c;
+ var ret = 0;
+ var thb = branch.firstChild.nextSibling.nextSibling;
+ // branch est un
+
+ if(thb)
+ {
+ for(c=thb.firstChild; c; c=c.nextSibling) // THE, les SY ou les TA
+ {
+ if(c.nodeName=="DIV")
+ ret += showFound2(term, lterm, c, depth+1); // on descend uniquement les THE_yyy
+ }
+ }
- if(branch.firstChild.nextSibling.nodeValue.substr(0, lterm)==term)
- {
- ret = 1;
+ if(branch.firstChild.nextSibling.nodeValue.substr(0, lterm)==term)
+ {
+ ret = 1;
// alert(branch.firstChild.nextSibling.nodeValue + " : " + thb.id);
- }
+ }
-// if(ret > 0)
+// if(ret > 0)
// if(depth > 0)
// {
- if(ret > 0)
- {
- //eventObj.Src0.innerHTML = "+";
- thb.className = "OB";
- }
- else
- {
- //eventObj.Src0.innerHTML = "+";
- thb.className = "ob";
- }
+ if(ret > 0)
+ {
+ //eventObj.Src0.innerHTML = "+";
+ thb.className = "OB";
+ }
+ else
+ {
+ //eventObj.Src0.innerHTML = "+";
+ thb.className = "ob";
+ }
// }
-/*
- if(depth == 0)
- {
- document.getElementById("WT1").style.visibility="hidden";
- if(document.forms["fTh"].textT1.value!=term)
- {
- // oups! le mot a changé durant le traitement, on recommence
- evt_kup_T1();
- }
- }
-*/
- return(ret);
+ /*
+ if(depth == 0)
+ {
+ document.getElementById("WT1").style.visibility="hidden";
+ if(document.forms["fTh"].textT1.value!=term)
+ {
+ // oups! le mot a changé durant le traitement, on recommence
+ evt_kup_T1();
+ }
+ }
+ */
+ return(ret);
}
function showAll(branch, depth)
{
- depth = parseInt(depth);
- var c;
- for(c=branch.firstChild; c; c=c.nextSibling)
- {
- if(c.nodeType==1 && c.nodeName=="DIV") // 1=XML_ELEMENT_NODE
- showAll(c, depth+1);
- }
+ depth = parseInt(depth);
+ var c;
+ for(c=branch.firstChild; c; c=c.nextSibling)
+ {
+ if(c.nodeType==1 && c.nodeName=="DIV") // 1=XML_ELEMENT_NODE
+ showAll(c, depth+1);
+ }
- if(depth > 0)
- branch.style.display = "";
+ if(depth > 0)
+ branch.style.display = "";
- if(depth===0)
- {
- document.getElementById("WT1").style.visibility="hidden";
- if(document.forms["fTh"].textT1.value!=="")
- {
- // oups! le mot a changé durant le traitement, on recommence
- evt_kup_T1();
- }
- }
+ if(depth===0)
+ {
+ document.getElementById("WT1").style.visibility="hidden";
+ if(document.forms["fTh"].textT1.value!=="")
+ {
+ // oups! le mot a changé durant le traitement, on recommence
+ evt_kup_T1();
+ }
+ }
}
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
");
- }
- else
- {
- alert(msg + " : nodeType="+n.nodeType);
- }
- }
- else
- {
- alert(msg + " : NULL");
- }
+ if(typeof(msg)=="undefined")
+ msg = "";
+ if(n)
+ {
+ if(n.nodeType==1)
+ {
+ alert(msg + " : <"+n.nodeName+" id='"+n.id+"'>");
+ }
+ else
+ {
+ alert(msg + " : nodeType="+n.nodeType);
+ }
+ }
+ else
+ {
+ alert(msg + " : NULL");
+ }
}
function appendTerm(inputName, new_term, id)
{
- var tr = document.createElement("TR");
- tr.id = inputName + "_"+id;
- tr.className = "s_";
- var td = tr.appendChild(document.createElement("TD"));
- td.appendChild(document.createTextNode(new_term));
- td = tr.appendChild(document.createElement("TD"));
- td.innerHTML = " ";
- td = tr.appendChild(document.createElement("TD"));
- td.appendChild(document.createTextNode(" "));
+ var tr = document.createElement("TR");
+ tr.id = inputName + "_"+id;
+ tr.className = "s_";
+ var td = tr.appendChild(document.createElement("TD"));
+ td.appendChild(document.createTextNode(new_term));
+ td = tr.appendChild(document.createElement("TD"));
+ td.innerHTML = " ";
+ td = tr.appendChild(document.createElement("TD"));
+ td.appendChild(document.createTextNode(" "));
- var zTable = document.getElementById("L"+inputName);
- return(zTable.appendChild(tr));
+ var zTable = document.getElementById("L"+inputName);
+ return(zTable.appendChild(tr));
}
diff --git a/www/skins/thesaurus/win.js b/www/skins/thesaurus/win.js
index 35dde01227..ae8e3cd81d 100644
--- a/www/skins/thesaurus/win.js
+++ b/www/skins/thesaurus/win.js
@@ -5,788 +5,788 @@ debuglog = "";
function ww_setDragObj(obj)
{
- if(dragObj.objCursor)
- dragObj.objCursor.style.visibility = "hidden";
- dragObj.objCursor = obj ? obj : document.getElementById("dragDropCursor");
- obj.style.visibility = "visible";
+ if(dragObj.objCursor)
+ dragObj.objCursor.style.visibility = "hidden";
+ dragObj.objCursor = obj ? obj : document.getElementById("dragDropCursor");
+ obj.style.visibility = "visible";
}
function evt_dblclk_doc(event, gui)
{
- var gui = eval(gui);
- var button;
- if(typeof(event.which) != 'undefined')
- button = gui.firefoxButtons["b"+event.which];
- else
- button = event.button;
+ var gui = eval(gui);
+ var button;
+ if(typeof(event.which) != 'undefined')
+ button = gui.firefoxButtons["b"+event.which];
+ else
+ button = event.button;
- if(!dragObj.objCursor)
- dragObj.objCursor = document.getElementById("dragDropCursor");
- dragObj.Src0 = dragObj.Src = dragObj.Target = dragObj.Target0 = null;
- dragObj.dragging = 0;
+ if(!dragObj.objCursor)
+ dragObj.objCursor = document.getElementById("dragDropCursor");
+ dragObj.Src0 = dragObj.Src = dragObj.Target = dragObj.Target0 = null;
+ dragObj.dragging = 0;
- var srcElement = (event.target) ? event.target : event.srcElement;
- var src0;
- for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
- ;
+ var srcElement = (event.target) ? event.target : event.srcElement;
+ var src0;
+ for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
+ ;
// src0 = (event.srcElement.tagName) ? event.srcElement : null; // correction safari pour le srcElement
// alert("<"+src0.tagName + " id='"+src0.id+"'>");
- var clickfound = false;
- var xmouse = parseInt(event.clientX);
- var ymouse = parseInt(event.clientY);
- var acceptClick = true;
- var e;
- for(e=src0; e && acceptClick && (!e.tagName || !clickfound); e=e.parentNode)
- {
- if(e && e.clickable)
- {
- clickObj.X = xmouse;
- clickObj.Y = ymouse;
- clickObj.Src = e;
- clickObj.Src0 = src0;
+ var clickfound = false;
+ var xmouse = parseInt(event.clientX);
+ var ymouse = parseInt(event.clientY);
+ var acceptClick = true;
+ var e;
+ for(e=src0; e && acceptClick && (!e.tagName || !clickfound); e=e.parentNode)
+ {
+ if(e && e.clickable)
+ {
+ clickObj.X = xmouse;
+ clickObj.Y = ymouse;
+ clickObj.Src = e;
+ clickObj.Src0 = src0;
- clickfound = true;
- if(e.clickCallback)
- (e.clickCallback)(event, "DBLCLICK", clickObj);
- }
- }
+ clickfound = true;
+ if(e.clickCallback)
+ (e.clickCallback)(event, "DBLCLICK", clickObj);
+ }
+ }
}
var iiii=0;
- function ww_evt_mdwn_doc(gui, evt)
- {
- var gui = eval(gui);
-
- if(gui.elemBalloon)
- gui.elemBalloon.style.visibility = "hidden";
- if(timer_ballon)
- {
- clearTimeout(timer_ballon);
- timer_ballon = null;
- }
- var button;
- if(typeof(evt.which) != 'undefined')
- button = gui.firefoxButtons["b"+evt.which];
- else
- button = evt.button;
+function ww_evt_mdwn_doc(gui, evt)
+{
+ var gui = eval(gui);
- dragObj.objCursor = document.getElementById("dragDropCursor");
- dragObj.dragSrc0 = dragObj.dragSrc = dragObj.dragTarget = null;
- dragObj.dragging = 0;
-
- var srcElement = evt.srcElement ? evt.srcElement : evt.target;
+ if(gui.elemBalloon)
+ gui.elemBalloon.style.visibility = "hidden";
+ if(timer_ballon)
+ {
+ clearTimeout(timer_ballon);
+ timer_ballon = null;
+ }
+ var button;
+ if(typeof(evt.which) != 'undefined')
+ button = gui.firefoxButtons["b"+evt.which];
+ else
+ button = evt.button;
+
+ dragObj.objCursor = document.getElementById("dragDropCursor");
+ dragObj.dragSrc0 = dragObj.dragSrc = dragObj.dragTarget = null;
+ dragObj.dragging = 0;
+
+ var srcElement = evt.srcElement ? evt.srcElement : evt.target;
// for(src0=srcElement; src0 && (!src0.tagName); src0=src0.parentNode)
- for(src0=srcElement; src0 && (!src0.tagName || src0.tagName=='APPLET' || src0.tagName=='OBJECT' || !src0.id); src0=src0.parentNode)
- ;
-
- if(src0.className == 'hslider')
- {
- var x;
- var wslider = parseInt(src0.style.width);
- var posmax = parseInt(src0.parentNode.style.width)-wslider;
- var min=0, max=posmax;
- if( (x = src0.getAttribute('min')) != "")
- min = parseInt(x);
- if( (x = src0.getAttribute('max')) != "")
- max = parseInt(x);
- var pos = parseInt(src0.style.left);
- var val = min + (((max-min) * pos) / posmax);
- // var pos = (int)(((val-min) * divmax) / (max-min));
- var cb = null;
- if( (x=src0.getAttribute('callback')) != "")
- cb = eval(x);
+ for(src0=srcElement; src0 && (!src0.tagName || src0.tagName=='APPLET' || src0.tagName=='OBJECT' || !src0.id); src0=src0.parentNode)
+ ;
- gui.sliding = { 'obj':src0, 'dir':"H", 'posmax':posmax, 'opos':pos, 'pos':pos, 'min':min, 'max':max, 'val':val, 'callback':cb };
- return(false);
- }
- if(src0.className == 'hsplitter')
- {
- src0.setAttribute('otop', parseInt(src0.style.top));
- src0.setAttribute('ozindex', parseInt(src0.style.zIndex));
- src0.style.zIndex = 999;
- gui.splitting = src0;
- return(false);
- }
- if(src0.className == 'vsplitter')
- {
- src0.setAttribute('oleft', parseInt(src0.style.left));
- src0.setAttribute('ozindex', parseInt(src0.style.zIndex));
- src0.style.zIndex = 999;
- gui.splitting = src0;
- return(false);
- }
-
- var dragfound = false;
- var clickfound = false;
- var xmouse = parseInt(evt.clientX);
- var ymouse = parseInt(evt.clientY);
- var acceptClick = true;
- var e;
- for(var e=src0; e && acceptClick && (!e.tagName || !dragfound || !clickfound); e=e.parentNode)
- {
-
-
- if(e && e.clickable)
- {
- clickObj.X = xmouse;
- clickObj.Y = ymouse;
- clickObj.Src = e;
- clickObj.Src0 = src0;
-
- // d = new Date();
- // dT = d.getTime() - clickObj.lastClickT;
- // clickObj.lastClickT = d.getTime();
-
- // if(dT<5000)
- // alert("dT :" + dT);
-
- clickfound = true;
- if(e.clickCallback)
- {
- if(button == 1) // && !event.altKey) // left button
- acceptClick = (e.clickCallback)(evt, evt.ctrlKey ? "RMOUSEDOWN" : "MOUSEDOWN", clickObj);
- else
- if(button == 2 && !evt.ctrlKey) // right button
- acceptClick = (e.clickCallback)(evt, "RMOUSEDOWN", clickObj);
- }
- }
-
- if(acceptClick && e && e.draggable) // && (!src0.draggable || src0.draggable!=-1))
- {
- // alert(e.draggable);
- dragObj.lastClickX = xmouse;
- dragObj.lastClickY = ymouse;
- dragObj.Src = e;
- dragObj.Src0 = src0;
- // alert("<" + src0.tagName + " id='" + src0.id + "'>");
- dragObj.dragging = 1;
- //alert("src0:<"+src0.tagName+" id="+src0.id+" "+src0.draggable+"> \ne:<"+e.tagName+" id="+e.id+" "+e.draggable+">");
- dragfound = true;
- }
- }
- evt.cancelBubble = true;
- evt.returnValue = false;
- }
+ if(src0.className == 'hslider')
+ {
+ var x;
+ var wslider = parseInt(src0.style.width);
+ var posmax = parseInt(src0.parentNode.style.width)-wslider;
+ var min=0, max=posmax;
+ if( (x = src0.getAttribute('min')) != "")
+ min = parseInt(x);
+ if( (x = src0.getAttribute('max')) != "")
+ max = parseInt(x);
+ var pos = parseInt(src0.style.left);
+ var val = min + (((max-min) * pos) / posmax);
+ // var pos = (int)(((val-min) * divmax) / (max-min));
+ var cb = null;
+ if( (x=src0.getAttribute('callback')) != "")
+ cb = eval(x);
-/*
-function unused_evt_mmov_doc(event, gui)
-{
- var gui = eval(gui);
- var button, xmouse, ymouse;
-
- if(gui.elemBalloon)
- gui.elemBalloon.style.visibility = "hidden";
- if(timer_ballon)
- {
- clearTimeout(timer_ballon);
- timer_ballon = null;
- }
- dragObj.X = xmouse = parseInt(event.clientX);
- dragObj.Y = ymouse = parseInt(event.clientY);
- window.status = xmouse + '-' + ymouse;
+ gui.sliding = { 'obj':src0, 'dir':"H", 'posmax':posmax, 'opos':pos, 'pos':pos, 'min':min, 'max':max, 'val':val, 'callback':cb };
+ return(false);
+ }
+ if(src0.className == 'hsplitter')
+ {
+ src0.setAttribute('otop', parseInt(src0.style.top));
+ src0.setAttribute('ozindex', parseInt(src0.style.zIndex));
+ src0.style.zIndex = 999;
+ gui.splitting = src0;
+ return(false);
+ }
+ if(src0.className == 'vsplitter')
+ {
+ src0.setAttribute('oleft', parseInt(src0.style.left));
+ src0.setAttribute('ozindex', parseInt(src0.style.zIndex));
+ src0.style.zIndex = 999;
+ gui.splitting = src0;
+ return(false);
+ }
- under_ballon = (event.target) ? event.target : event.srcElement;
- if(under_ballon.id)
- {
- js = "timeout_ballon('"+under_ballon.id+"', "+xmouse+", "+ymouse+");"
- timer_ballon = setTimeout(js, 300);
- }
+ var dragfound = false;
+ var clickfound = false;
+ var xmouse = parseInt(evt.clientX);
+ var ymouse = parseInt(evt.clientY);
+ var acceptClick = true;
+ var e;
+ for(var e=src0; e && acceptClick && (!e.tagName || !dragfound || !clickfound); e=e.parentNode)
+ {
- if(!dragObj.Src)
- {
- if(dragObj.objCursor)
- dragObj.objCursor.style.visibility = "hidden";
- return;
- }
- if(dragObj.dragging == 1)
- {
- var dx = xmouse - dragObj.lastClickX;
- var dy = ymouse - dragObj.lastClickY;
- if(Math.abs(dx)>4 || Math.abs(dy)>4)
- {
- if(dragObj.objCursor)
- {
- dragObj.objCursor.style.visibility = "visible";
- }
- dragObj.dragging = 2;
- if(dragObj.Src.ondragstart)
- {
- // alert("gui is calling ondragstart");
- (dragObj.Src.ondragstart)();
- }
- if(dragObj.Src.dragCallback)
- {
- var r = (dragObj.Src.dragCallback)(event, "DRAGSTART", dragObj);
- if(!r)
- {
- dragObj.dragging = 0;
- dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null;
- if(dragObj.objCursor)
- dragObj.objCursor.style.visibility = "hidden";
- }
- }
- }
- }
- if(dragObj.dragging == 2)
- {
- if(dragObj.objCursor)
- {
- dragObj.objCursor.style.pixelLeft = xmouse+8;
- dragObj.objCursor.style.pixelTop = ymouse+8;
- }
- var srcElement = (event.target) ? event.target : event.srcElement;
- var src0;
- var e;
- for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
- ;
- for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode)
- ;
- if(src0)
- {
- dragObj.Target0 = src0;
- if(dragObj.Target && e != dragObj.Target) // && src0 != e)
- {
- if(dragObj.Target.ondragleave)
- (dragObj.Target.ondragleave)();
- if(dragObj.Target.dropCallback)
- (dragObj.Target.dropCallback)(event, "DRAGLEAVE", dragObj);
- dragObj.Target = null;
- }
- if(e)
- {
- if(!dragObj.Target)
- {
- dragObj.Target = e;
- if(e.ondragenter)
- (e.ondragenter)();
- if(dragObj.Target.dropCallback)
- (dragObj.Target.dropCallback)(event, "DRAGENTER", dragObj);
- }
- else
- {
- if(dragObj.Src.dragCallback)
- (dragObj.Src.dragCallback)(event, "DRAG", dragObj);
- if(dragObj.Target.dropCallback)
- (dragObj.Target.dropCallback)(event, "DRAGOVER", dragObj);
- }
- }
- }
- }
+ if(e && e.clickable)
+ {
+ clickObj.X = xmouse;
+ clickObj.Y = ymouse;
+ clickObj.Src = e;
+ clickObj.Src0 = src0;
+
+ // d = new Date();
+ // dT = d.getTime() - clickObj.lastClickT;
+ // clickObj.lastClickT = d.getTime();
+
+ // if(dT<5000)
+ // alert("dT :" + dT);
+
+ clickfound = true;
+ if(e.clickCallback)
+ {
+ if(button == 1) // && !event.altKey) // left button
+ acceptClick = (e.clickCallback)(evt, evt.ctrlKey ? "RMOUSEDOWN" : "MOUSEDOWN", clickObj);
+ else
+ if(button == 2 && !evt.ctrlKey) // right button
+ acceptClick = (e.clickCallback)(evt, "RMOUSEDOWN", clickObj);
+ }
+ }
+
+ if(acceptClick && e && e.draggable) // && (!src0.draggable || src0.draggable!=-1))
+ {
+ // alert(e.draggable);
+ dragObj.lastClickX = xmouse;
+ dragObj.lastClickY = ymouse;
+ dragObj.Src = e;
+ dragObj.Src0 = src0;
+ // alert("<" + src0.tagName + " id='" + src0.id + "'>");
+ dragObj.dragging = 1;
+ //alert("src0:<"+src0.tagName+" id="+src0.id+" "+src0.draggable+"> \ne:<"+e.tagName+" id="+e.id+" "+e.draggable+">");
+ dragfound = true;
+ }
+ }
+ evt.cancelBubble = true;
+ evt.returnValue = false;
}
-*/
-
- function ww_evt_mmov_doc(gui, evt)
- {
- var gui = eval(gui);
- var button, xmouse, ymouse;
-
- if(gui.elemBalloon)
- gui.elemBalloon.style.visibility = "hidden";
- if(timer_ballon)
- {
- clearTimeout(timer_ballon);
- timer_ballon = null;
- }
- dragObj.X = xmouse = parseInt(evt.clientX);
- dragObj.Y = ymouse = parseInt(evt.clientY);
+
+/*
+ function unused_evt_mmov_doc(event, gui)
+ {
+ var gui = eval(gui);
+ var button, xmouse, ymouse;
+
+ if(gui.elemBalloon)
+ gui.elemBalloon.style.visibility = "hidden";
+ if(timer_ballon)
+ {
+ clearTimeout(timer_ballon);
+ timer_ballon = null;
+ }
+ dragObj.X = xmouse = parseInt(event.clientX);
+ dragObj.Y = ymouse = parseInt(event.clientY);
+ window.status = xmouse + '-' + ymouse;
+
+ under_ballon = (event.target) ? event.target : event.srcElement;
+ if(under_ballon.id)
+ {
+ js = "timeout_ballon('"+under_ballon.id+"', "+xmouse+", "+ymouse+");"
+ timer_ballon = setTimeout(js, 300);
+ }
+
+ if(!dragObj.Src)
+ {
+ if(dragObj.objCursor)
+ dragObj.objCursor.style.visibility = "hidden";
+ return;
+ }
+ if(dragObj.dragging == 1)
+ {
+ var dx = xmouse - dragObj.lastClickX;
+ var dy = ymouse - dragObj.lastClickY;
+ if(Math.abs(dx)>4 || Math.abs(dy)>4)
+ {
+ if(dragObj.objCursor)
+ {
+ dragObj.objCursor.style.visibility = "visible";
+ }
+ dragObj.dragging = 2;
+ if(dragObj.Src.ondragstart)
+ {
+ // alert("gui is calling ondragstart");
+ (dragObj.Src.ondragstart)();
+ }
+ if(dragObj.Src.dragCallback)
+ {
+ var r = (dragObj.Src.dragCallback)(event, "DRAGSTART", dragObj);
+ if(!r)
+ {
+ dragObj.dragging = 0;
+ dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null;
+ if(dragObj.objCursor)
+ dragObj.objCursor.style.visibility = "hidden";
+ }
+ }
+ }
+ }
+ if(dragObj.dragging == 2)
+ {
+ if(dragObj.objCursor)
+ {
+ dragObj.objCursor.style.pixelLeft = xmouse+8;
+ dragObj.objCursor.style.pixelTop = ymouse+8;
+ }
+ var srcElement = (event.target) ? event.target : event.srcElement;
+ var src0;
+ var e;
+ for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
+ ;
+ for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode)
+ ;
+
+ if(src0)
+ {
+ dragObj.Target0 = src0;
+ if(dragObj.Target && e != dragObj.Target) // && src0 != e)
+ {
+ if(dragObj.Target.ondragleave)
+ (dragObj.Target.ondragleave)();
+ if(dragObj.Target.dropCallback)
+ (dragObj.Target.dropCallback)(event, "DRAGLEAVE", dragObj);
+ dragObj.Target = null;
+ }
+ if(e)
+ {
+ if(!dragObj.Target)
+ {
+ dragObj.Target = e;
+ if(e.ondragenter)
+ (e.ondragenter)();
+ if(dragObj.Target.dropCallback)
+ (dragObj.Target.dropCallback)(event, "DRAGENTER", dragObj);
+ }
+ else
+ {
+ if(dragObj.Src.dragCallback)
+ (dragObj.Src.dragCallback)(event, "DRAG", dragObj);
+ if(dragObj.Target.dropCallback)
+ (dragObj.Target.dropCallback)(event, "DRAGOVER", dragObj);
+ }
+ }
+ }
+ }
+ }
+ */
+
+function ww_evt_mmov_doc(gui, evt)
+{
+ var gui = eval(gui);
+ var button, xmouse, ymouse;
+
+ if(gui.elemBalloon)
+ gui.elemBalloon.style.visibility = "hidden";
+ if(timer_ballon)
+ {
+ clearTimeout(timer_ballon);
+ timer_ballon = null;
+ }
+ dragObj.X = xmouse = parseInt(evt.clientX);
+ dragObj.Y = ymouse = parseInt(evt.clientY);
//window.status = xmouse + '-' + ymouse;
-
- under_ballon = (evt.target) ? evt.target : evt.srcElement;
- if(under_ballon.id)
- {
- js = "timeout_ballon('"+under_ballon.id+"', "+xmouse+", "+ymouse+");";
- timer_ballon = setTimeout(js, 300);
- }
- xmouse = parseInt(evt.clientX);
- ymouse = parseInt(evt.clientY);
- if(dragObj.Src)
- {
- if(dragObj.dragging == 1)
- {
- dx = xmouse - dragObj.lastClickX;
- dy = ymouse - dragObj.lastClickY;
- if(Math.abs(dx)>4 || Math.abs(dy)>4)
- {
- if(dragObj.objCursor)
- {
- dragObj.objCursor.style.visibility = "visible";
- }
- dragObj.dragging = 2;
- if(dragObj.Src.ondragstart)
- {
- // alert("gui is calling ondragstart");
- (dragObj.Src.ondragstart)();
- }
- if(dragObj.Src.dragCallback)
- {
- var r = (dragObj.Src.dragCallback)(evt, "DRAGSTART", dragObj);
- if(!r)
- {
- dragObj.dragging = 0;
- dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null;
- if(dragObj.objCursor)
- dragObj.objCursor.style.visibility = "hidden";
- }
- }
- }
- }
- if(dragObj.dragging == 2)
- {
- if(dragObj.objCursor)
- {
+ under_ballon = (evt.target) ? evt.target : evt.srcElement;
+ if(under_ballon.id)
+ {
+ js = "timeout_ballon('"+under_ballon.id+"', "+xmouse+", "+ymouse+");";
+ timer_ballon = setTimeout(js, 300);
+ }
+
+ xmouse = parseInt(evt.clientX);
+ ymouse = parseInt(evt.clientY);
+ if(dragObj.Src)
+ {
+ if(dragObj.dragging == 1)
+ {
+ dx = xmouse - dragObj.lastClickX;
+ dy = ymouse - dragObj.lastClickY;
+ if(Math.abs(dx)>4 || Math.abs(dy)>4)
+ {
+ if(dragObj.objCursor)
+ {
+ dragObj.objCursor.style.visibility = "visible";
+ }
+ dragObj.dragging = 2;
+ if(dragObj.Src.ondragstart)
+ {
+ // alert("gui is calling ondragstart");
+ (dragObj.Src.ondragstart)();
+ }
+ if(dragObj.Src.dragCallback)
+ {
+ var r = (dragObj.Src.dragCallback)(evt, "DRAGSTART", dragObj);
+ if(!r)
+ {
+ dragObj.dragging = 0;
+ dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null;
+ if(dragObj.objCursor)
+ dragObj.objCursor.style.visibility = "hidden";
+ }
+ }
+ }
+ }
+ if(dragObj.dragging == 2)
+ {
+ if(dragObj.objCursor)
+ {
// window.status = xmouse + '-' + ymouse;
- dragObj.objCursor.style.left = (xmouse+8)+"px";
- dragObj.objCursor.style.top = (ymouse+8)+"px";
- }
- var srcElement = (evt.target) ? evt.target : evt.srcElement;
- var src0;
- var e;
- for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
- ;
- for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode)
- ;
-
- if(src0)
- {
- dragObj.Target0 = src0;
- if(dragObj.Target && e != dragObj.Target) // && src0 != e)
- {
- if(dragObj.Target.ondragleave)
- (dragObj.Target.ondragleave)();
- if(dragObj.Target.dropCallback)
- (dragObj.Target.dropCallback)(evt, "DRAGLEAVE", dragObj);
- dragObj.Target = null;
- }
- if(e)
- {
- if(!dragObj.Target)
- {
- dragObj.Target = e;
- if(e.ondragenter)
- (e.ondragenter)();
- if(dragObj.Target.dropCallback)
- (dragObj.Target.dropCallback)(evt, "DRAGENTER", dragObj);
- }
- else
- {
- if(dragObj.Src.dragCallback)
- (dragObj.Src.dragCallback)(evt, "DRAG", dragObj);
- if(dragObj.Target.dropCallback)
- (dragObj.Target.dropCallback)(evt, "DRAGOVER", dragObj);
- }
- }
- }
- }
- return; // if drag/drop, don't care about moving windows
- }
-/*
- dragObj.objCursor.style.visibility = "hidden";
-
- // msg("" + (e.clientX) + " - " + (e.clientY) );
- if(gui.w_active != -1 && (gui.sizing || gui.dragging || gui.splitting || gui.sliding))
- {
- t = "";
- var wwin = parseInt(gui.twin[gui.w_active].properties.width);
- var hwin = parseInt(gui.twin[gui.w_active].properties.height);
- var wgui = document.getElementById("idBody").clientWidth;
- var hgui = document.getElementById("idBody").clientHeight;
-
- if(gui.sliding)
- {
- //gui.sliding = { 'obj':src0, 'dir':"H", 'divmax':divmax, 'pos':pos, 'min':min, 'max':max, 'val':val };
- if(gui.sliding.dir == "H")
- {
- var opos = gui.sliding.opos;
- var npos = opos + (xmouse - gui.x0);
-// self.status = "otop=" + otop + " ntop="+ntop;
- if(npos < 0)
- npos = 0;
- else if(npos > gui.sliding.posmax )
- npos = gui.sliding.posmax;
- if(npos != opos)
- {
- var val = (gui.sliding.min + (((gui.sliding.max-gui.sliding.min) * npos) / gui.sliding.posmax));
- npos = Math.round(((val-gui.sliding.min) * gui.sliding.posmax) / (gui.sliding.max-gui.sliding.min));
- if(npos != opos)
- {
- gui.sliding.val = val;
- gui.sliding.pos = npos;
- gui.sliding.obj.style.left = npos+"px";
- var cb;
- if(cb = gui.sliding.callback)
- (cb)('HSLIDING', gui.sliding.pbj, val);
- }
- }
- }
- }
- if(gui.splitting)
- {
- if(gui.splitting.className == "hsplitter")
- {
- var otop = parseInt(gui.splitting.getAttribute('otop'));
- var ntop = otop + (ymouse - gui.y0);
-// self.status = "otop=" + otop + " ntop="+ntop;
- if(ntop > 40 && ntop < hwin-40 )
- gui.splitting.style.top = ntop+"px";
- }
- else if(gui.splitting.className == "vsplitter")
- {
- var oleft = parseInt(gui.splitting.getAttribute('oleft'));
- var nleft = oleft + (xmouse - gui.x0);
-// self.status = "otop=" + otop + " ntop="+ntop;
- if(nleft > 40 && nleft < wwin-40 )
- gui.splitting.style.left = nleft+"px";
- }
- }
-
- if(gui.dragging)
- {
- gui.new_t = gui.t0 + (ymouse - gui.y0);
- gui.new_l = gui.l0 + (xmouse - gui.x0);
- var magnetic = {T:"-", L:"-", B:"-", R:"-" };
- if(gui.new_l < 20)
- {
- gui.new_l = 0;
- magnetic.L = "L";
- }
- if(magnetic.L=="-" && gui.new_l + wwin > wgui-20)
- {
- gui.new_l = wgui-wwin;
- magnetic.R = "R";
- }
- if(gui.new_t < 20)
- {
- gui.new_t = 0;
- magnetic.T = "T";
- }
- if(magnetic.T=="-" && gui.new_t + hwin > hgui-20)
- {
- gui.new_t = hgui-hwin;
- magnetic.B = "B";
- }
- gui.twin[gui.w_active].magnetic = magnetic.T + magnetic.L + magnetic.B + magnetic.R;
+ dragObj.objCursor.style.left = (xmouse+8)+"px";
+ dragObj.objCursor.style.top = (ymouse+8)+"px";
+ }
+ var srcElement = (evt.target) ? evt.target : evt.srcElement;
+ var src0;
+ var e;
+ for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
+ ;
+ for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode)
+ ;
- t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; width:" + (gui.w0-4) + "px; height:" + (gui.h0-4) + "px; visibility:visible;" ;
+ if(src0)
+ {
+ dragObj.Target0 = src0;
+ if(dragObj.Target && e != dragObj.Target) // && src0 != e)
+ {
+ if(dragObj.Target.ondragleave)
+ (dragObj.Target.ondragleave)();
+ if(dragObj.Target.dropCallback)
+ (dragObj.Target.dropCallback)(evt, "DRAGLEAVE", dragObj);
+ dragObj.Target = null;
+ }
+ if(e)
+ {
+ if(!dragObj.Target)
+ {
+ dragObj.Target = e;
+ if(e.ondragenter)
+ (e.ondragenter)();
+ if(dragObj.Target.dropCallback)
+ (dragObj.Target.dropCallback)(evt, "DRAGENTER", dragObj);
+ }
+ else
+ {
+ if(dragObj.Src.dragCallback)
+ (dragObj.Src.dragCallback)(evt, "DRAG", dragObj);
+ if(dragObj.Target.dropCallback)
+ (dragObj.Target.dropCallback)(evt, "DRAGOVER", dragObj);
+ }
+ }
+ }
+ }
+ return; // if drag/drop, don't care about moving windows
+ }
+ /*
+ dragObj.objCursor.style.visibility = "hidden";
- gui.windowBorder.style.top = (gui.new_t)+"px";
- gui.windowBorder.style.left = (gui.new_l)+"px";
- }
- if(gui.sizing)
- {
- gui.new_h = gui.h0 + (ymouse - gui.y0);
- gui.new_w = gui.w0 + (xmouse - gui.x0);
- if(gui.new_w < gui.twin[gui.w_active].minwidth)
- gui.new_w = gui.twin[gui.w_active].minwidth;
- else
- if(gui.new_w > gui.twin[gui.w_active].maxwidth)
- gui.new_w = gui.twin[gui.w_active].maxwidth;
-
- if(gui.new_h < gui.twin[gui.w_active].minheight)
- gui.new_h = gui.twin[gui.w_active].minheight;
- else
- if(gui.new_h > gui.twin[gui.w_active].maxheight)
- gui.new_h = gui.twin[gui.w_active].maxheight;
-
- t = "top:" + (gui.t0) + "px; left:" + (gui.l0) + "px; width:" + (gui.new_w-4) + "px; height:" + (gui.new_h-4) + "px; visibility:visible" ;
+ // msg("" + (e.clientX) + " - " + (e.clientY) );
+ if(gui.w_active != -1 && (gui.sizing || gui.dragging || gui.splitting || gui.sliding))
+ {
+ t = "";
+ var wwin = parseInt(gui.twin[gui.w_active].properties.width);
+ var hwin = parseInt(gui.twin[gui.w_active].properties.height);
+ var wgui = document.getElementById("idBody").clientWidth;
+ var hgui = document.getElementById("idBody").clientHeight;
- gui.windowBorder.style.width = (gui.new_w-4)+"px";
- gui.windowBorder.style.height = (gui.new_h-4)+"px";
- }
-t += "z-index:999; display:block; background-color:#FFFF00; position:absolute;"
-// self.status = t;
+ if(gui.sliding)
+ {
+ //gui.sliding = { 'obj':src0, 'dir':"H", 'divmax':divmax, 'pos':pos, 'min':min, 'max':max, 'val':val };
+ if(gui.sliding.dir == "H")
+ {
+ var opos = gui.sliding.opos;
+ var npos = opos + (xmouse - gui.x0);
+ // self.status = "otop=" + otop + " ntop="+ntop;
+ if(npos < 0)
+ npos = 0;
+ else if(npos > gui.sliding.posmax )
+ npos = gui.sliding.posmax;
+ if(npos != opos)
+ {
+ var val = (gui.sliding.min + (((gui.sliding.max-gui.sliding.min) * npos) / gui.sliding.posmax));
+ npos = Math.round(((val-gui.sliding.min) * gui.sliding.posmax) / (gui.sliding.max-gui.sliding.min));
+ if(npos != opos)
+ {
+ gui.sliding.val = val;
+ gui.sliding.pos = npos;
+ gui.sliding.obj.style.left = npos+"px";
+ var cb;
+ if(cb = gui.sliding.callback)
+ (cb)('HSLIDING', gui.sliding.pbj, val);
+ }
+ }
+ }
+ }
+ if(gui.splitting)
+ {
+ if(gui.splitting.className == "hsplitter")
+ {
+ var otop = parseInt(gui.splitting.getAttribute('otop'));
+ var ntop = otop + (ymouse - gui.y0);
+ // self.status = "otop=" + otop + " ntop="+ntop;
+ if(ntop > 40 && ntop < hwin-40 )
+ gui.splitting.style.top = ntop+"px";
+ }
+ else if(gui.splitting.className == "vsplitter")
+ {
+ var oleft = parseInt(gui.splitting.getAttribute('oleft'));
+ var nleft = oleft + (xmouse - gui.x0);
+ // self.status = "otop=" + otop + " ntop="+ntop;
+ if(nleft > 40 && nleft < wwin-40 )
+ gui.splitting.style.left = nleft+"px";
+ }
+ }
- // gui.twin[gui.w_active].hide();
- // document.getElementById(gui.varname+"w"+gui.w_active).style.display = "none";
- // document.getElementById(gui.varname+"wb").style.cssText = t;
-// gui.windowBorder.style.cssText = t;
- }
-*/
- return false;
- }
+ if(gui.dragging)
+ {
+ gui.new_t = gui.t0 + (ymouse - gui.y0);
+ gui.new_l = gui.l0 + (xmouse - gui.x0);
+ var magnetic = {T:"-", L:"-", B:"-", R:"-" };
+ if(gui.new_l < 20)
+ {
+ gui.new_l = 0;
+ magnetic.L = "L";
+ }
+ if(magnetic.L=="-" && gui.new_l + wwin > wgui-20)
+ {
+ gui.new_l = wgui-wwin;
+ magnetic.R = "R";
+ }
+ if(gui.new_t < 20)
+ {
+ gui.new_t = 0;
+ magnetic.T = "T";
+ }
+ if(magnetic.T=="-" && gui.new_t + hwin > hgui-20)
+ {
+ gui.new_t = hgui-hwin;
+ magnetic.B = "B";
+ }
+ gui.twin[gui.w_active].magnetic = magnetic.T + magnetic.L + magnetic.B + magnetic.R;
-/*
+ t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; width:" + (gui.w0-4) + "px; height:" + (gui.h0-4) + "px; visibility:visible;" ;
-function unused_evt_mup_doc(event, gui)
-{
- var gui = eval(gui);
- var srcElement = (event.target) ? event.target : event.srcElement;
- var src0;
- for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
- ;
-
- var button;
- if(typeof(event.which) != 'undefined')
- button = gui.firefoxButtons["b"+event.which];
- else
- button = event.button;
- var xmouse = parseInt(event.clientX);
- var ymouse = parseInt(event.clientY);
- var e;
- var clickfound = false;
- for(e=src0; e && (!e.tagName || !clickfound); e=e.parentNode)
- {
- if(e && e.clickable)
- {
- clickObj.X = xmouse;
- clickObj.Y = ymouse;
- clickObj.Src = e;
- clickObj.Src0 = src0;
+ gui.windowBorder.style.top = (gui.new_t)+"px";
+ gui.windowBorder.style.left = (gui.new_l)+"px";
+ }
+ if(gui.sizing)
+ {
+ gui.new_h = gui.h0 + (ymouse - gui.y0);
+ gui.new_w = gui.w0 + (xmouse - gui.x0);
+ if(gui.new_w < gui.twin[gui.w_active].minwidth)
+ gui.new_w = gui.twin[gui.w_active].minwidth;
+ else
+ if(gui.new_w > gui.twin[gui.w_active].maxwidth)
+ gui.new_w = gui.twin[gui.w_active].maxwidth;
- clickfound = true;
- if(e.clickCallback)
- {
- if(button == 1 && !event.ctrlKey) // left button
- acceptClick = (e.clickCallback)(event, event.ctrlKey ? "RMOUSEUP" : "MOUSEUP", clickObj);
- else
- if(button == 2 && !event.ctrlKey) // right button
- acceptClick = (e.clickCallback)(event, "RMOUSEUP", clickObj);
- }
- }
- }
-
- if(!dragObj.Src)
- {
- if(dragObj.objCursor)
- dragObj.objCursor.style.visibility = "hidden";
- return;
- }
-
- if(dragObj.dragging==2)
- {
- for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode)
- {
- ;
- }
- if(e)
- {
- if(dragObj.Target && e == dragObj.Target)
- {
- if(dragObj.Target.ondrop)
- (dragObj.Target.ondrop)();
- if(dragObj.Target.dropCallback)
- (dragObj.Target.dropCallback)(event, "DROP", dragObj);
- }
- }
- }
- if(dragObj.Src.dropCallback)
- (dragObj.Src.dropCallback)(event, "DRAGEND", dragObj);
- dragObj.dragging = 0;
- dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null;
- if(dragObj.objCursor)
- dragObj.objCursor.style.visibility = "hidden";
+ if(gui.new_h < gui.twin[gui.w_active].minheight)
+ gui.new_h = gui.twin[gui.w_active].minheight;
+ else
+ if(gui.new_h > gui.twin[gui.w_active].maxheight)
+ gui.new_h = gui.twin[gui.w_active].maxheight;
+
+ t = "top:" + (gui.t0) + "px; left:" + (gui.l0) + "px; width:" + (gui.new_w-4) + "px; height:" + (gui.new_h-4) + "px; visibility:visible" ;
+
+ gui.windowBorder.style.width = (gui.new_w-4)+"px";
+ gui.windowBorder.style.height = (gui.new_h-4)+"px";
+ }
+ t += "z-index:999; display:block; background-color:#FFFF00; position:absolute;"
+ // self.status = t;
+
+ // gui.twin[gui.w_active].hide();
+ // document.getElementById(gui.varname+"w"+gui.w_active).style.display = "none";
+ // document.getElementById(gui.varname+"wb").style.cssText = t;
+ // gui.windowBorder.style.cssText = t;
+ }
+ */
+ return false;
+}
+
+/*
+
+ function unused_evt_mup_doc(event, gui)
+ {
+ var gui = eval(gui);
+ var srcElement = (event.target) ? event.target : event.srcElement;
+ var src0;
+ for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
+ ;
+
+ var button;
+ if(typeof(event.which) != 'undefined')
+ button = gui.firefoxButtons["b"+event.which];
+ else
+ button = event.button;
+ var xmouse = parseInt(event.clientX);
+ var ymouse = parseInt(event.clientY);
+ var e;
+ var clickfound = false;
+ for(e=src0; e && (!e.tagName || !clickfound); e=e.parentNode)
+ {
+ if(e && e.clickable)
+ {
+ clickObj.X = xmouse;
+ clickObj.Y = ymouse;
+ clickObj.Src = e;
+ clickObj.Src0 = src0;
+
+ clickfound = true;
+ if(e.clickCallback)
+ {
+ if(button == 1 && !event.ctrlKey) // left button
+ acceptClick = (e.clickCallback)(event, event.ctrlKey ? "RMOUSEUP" : "MOUSEUP", clickObj);
+ else
+ if(button == 2 && !event.ctrlKey) // right button
+ acceptClick = (e.clickCallback)(event, "RMOUSEUP", clickObj);
+ }
+ }
+ }
+
+ if(!dragObj.Src)
+ {
+ if(dragObj.objCursor)
+ dragObj.objCursor.style.visibility = "hidden";
+ return;
+ }
+
+ if(dragObj.dragging==2)
+ {
+ for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode)
+ {
+ ;
+ }
+ if(e)
+ {
+ if(dragObj.Target && e == dragObj.Target)
+ {
+ if(dragObj.Target.ondrop)
+ (dragObj.Target.ondrop)();
+ if(dragObj.Target.dropCallback)
+ (dragObj.Target.dropCallback)(event, "DROP", dragObj);
+ }
+ }
+ }
+ if(dragObj.Src.dropCallback)
+ (dragObj.Src.dropCallback)(event, "DRAGEND", dragObj);
+ dragObj.dragging = 0;
+ dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null;
+ if(dragObj.objCursor)
+ dragObj.objCursor.style.visibility = "hidden";
+ }
+ */
+function ww_evt_mup_doc(gui, evt)
+{
+ var gui = eval(gui);
+ var srcElement = (evt.target) ? evt.target : evt.srcElement;
+ var src0;
+ for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
+ ;
+
+ var button;
+ if(typeof(evt.which) != 'undefined')
+ button = gui.firefoxButtons["b"+evt.which];
+ else
+ button = evt.button;
+ var xmouse = parseInt(evt.clientX);
+ var ymouse = parseInt(evt.clientY);
+ var e;
+ var clickfound = false;
+ for(e=src0; e && (!e.tagName || !clickfound); e=e.parentNode)
+ {
+ if(e && e.clickable)
+ {
+ clickObj.X = xmouse;
+ clickObj.Y = ymouse;
+ clickObj.Src = e;
+ clickObj.Src0 = src0;
+
+ clickfound = true;
+ if(e.clickCallback)
+ {
+ if(button == 1 && !evt.ctrlKey) // left button
+ acceptClick = (e.clickCallback)(evt, evt.ctrlKey ? "RMOUSEUP" : "MOUSEUP", clickObj);
+ else
+ if(button == 2 && !evt.ctrlKey) // right button
+ acceptClick = (e.clickCallback)(evt, "RMOUSEUP", clickObj);
+ }
+ }
+ }
+ if(!dragObj.Src)
+ {
+ if(dragObj.objCursor)
+ dragObj.objCursor.style.visibility = "hidden";
+ }
+ else
+ {
+ if(dragObj.dragging==2)
+ {
+ for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode)
+ {
+ ;
+ }
+ if(e)
+ {
+ if(dragObj.Target && e == dragObj.Target)
+ {
+ if(dragObj.Target.ondrop)
+ (dragObj.Target.ondrop)();
+ if(dragObj.Target.dropCallback)
+ (dragObj.Target.dropCallback)(evt, "DROP", dragObj);
+ }
+ }
+ }
+ if(dragObj.Src.dropCallback)
+ (dragObj.Src.dropCallback)(evt, "DRAGEND", dragObj);
+ dragObj.dragging = 0;
+ dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null;
+ if(dragObj.objCursor)
+ dragObj.objCursor.style.visibility = "hidden";
+ }
+ /*
+ if(gui.sliding)
+ {
+ gui.sliding = null;
+ }
+
+ if(gui.splitting)
+ {
+ gui.splitting.style.zIndex = parseInt(gui.splitting.getAttribute('ozindex'));
+ gui.splitting = null;
+ }
+
+ if((gui.w_active != -1) && (gui.dragging || gui.sizing))
+ {
+ // document.getElementById(gui.varname+"wb").style.visibility = "hidden";
+ gui.windowBorder.style.visibility = "hidden";
+
+ gui.twin[gui.w_active].setProperties( { top:(gui.new_t)+"px", left:(gui.new_l)+"px", width:(gui.new_w)+"px", height:(gui.new_h)+"px" } );
+ // alert("ww_evt_mup_doc : new_w="+gui.new_w + " new_h="+gui.new_h);
+ // document.getElementById(gui.varname+"w"+gui.w_active).style.zIndex = 1;
+ if(gui.sizing && gui.twin[gui.w_active].onresized)
+ (gui.twin[gui.w_active].onresized)(gui.new_t, gui.new_l, gui.new_w, gui.new_h);
+
+ gui.dragging = gui.sizing = false;
+ // eval(gui.twin[gui.w_active].onresized);
+ }
+ */
+ return true;
}
-*/
- function ww_evt_mup_doc(gui, evt)
- {
- var gui = eval(gui);
- var srcElement = (evt.target) ? evt.target : evt.srcElement;
- var src0;
- for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
- ;
-
- var button;
- if(typeof(evt.which) != 'undefined')
- button = gui.firefoxButtons["b"+evt.which];
- else
- button = evt.button;
- var xmouse = parseInt(evt.clientX);
- var ymouse = parseInt(evt.clientY);
- var e;
- var clickfound = false;
- for(e=src0; e && (!e.tagName || !clickfound); e=e.parentNode)
- {
- if(e && e.clickable)
- {
- clickObj.X = xmouse;
- clickObj.Y = ymouse;
- clickObj.Src = e;
- clickObj.Src0 = src0;
-
- clickfound = true;
- if(e.clickCallback)
- {
- if(button == 1 && !evt.ctrlKey) // left button
- acceptClick = (e.clickCallback)(evt, evt.ctrlKey ? "RMOUSEUP" : "MOUSEUP", clickObj);
- else
- if(button == 2 && !evt.ctrlKey) // right button
- acceptClick = (e.clickCallback)(evt, "RMOUSEUP", clickObj);
- }
- }
- }
- if(!dragObj.Src)
- {
- if(dragObj.objCursor)
- dragObj.objCursor.style.visibility = "hidden";
- }
- else
- {
- if(dragObj.dragging==2)
- {
- for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode)
- {
- ;
- }
- if(e)
- {
- if(dragObj.Target && e == dragObj.Target)
- {
- if(dragObj.Target.ondrop)
- (dragObj.Target.ondrop)();
- if(dragObj.Target.dropCallback)
- (dragObj.Target.dropCallback)(evt, "DROP", dragObj);
- }
- }
- }
- if(dragObj.Src.dropCallback)
- (dragObj.Src.dropCallback)(evt, "DRAGEND", dragObj);
- dragObj.dragging = 0;
- dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null;
- if(dragObj.objCursor)
- dragObj.objCursor.style.visibility = "hidden";
- }
-/*
- if(gui.sliding)
- {
- gui.sliding = null;
- }
-
- if(gui.splitting)
- {
- gui.splitting.style.zIndex = parseInt(gui.splitting.getAttribute('ozindex'));
- gui.splitting = null;
- }
-
- if((gui.w_active != -1) && (gui.dragging || gui.sizing))
- {
- // document.getElementById(gui.varname+"wb").style.visibility = "hidden";
- gui.windowBorder.style.visibility = "hidden";
-
- gui.twin[gui.w_active].setProperties( { top:(gui.new_t)+"px", left:(gui.new_l)+"px", width:(gui.new_w)+"px", height:(gui.new_h)+"px" } );
- // alert("ww_evt_mup_doc : new_w="+gui.new_w + " new_h="+gui.new_h);
- // document.getElementById(gui.varname+"w"+gui.w_active).style.zIndex = 1;
- if(gui.sizing && gui.twin[gui.w_active].onresized)
- (gui.twin[gui.w_active].onresized)(gui.new_t, gui.new_l, gui.new_w, gui.new_h);
-
- gui.dragging = gui.sizing = false;
- // eval(gui.twin[gui.w_active].onresized);
- }
-*/
- return true;
- }
function ww_evt_kon_doc(gui, evt)
{
- var gui = eval(gui);
-
- if(gui.elemBalloon)
- gui.elemBalloon.style.visibility = "hidden";
- if(timer_ballon)
- {
- clearTimeout(timer_ballon);
- timer_ballon = null;
- }
-
- if(!dragObj.objCursor)
- dragObj.objCursor = document.getElementById("dragDropCursor");
- dragObj.Src0 = dragObj.Src = dragObj.Target = dragObj.Target0 = null;
- dragObj.dragging = 0;
+ var gui = eval(gui);
- var srcElement = (evt.target) ? evt.target : evt.srcElement;
- var src0;
- for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
- ;
+ if(gui.elemBalloon)
+ gui.elemBalloon.style.visibility = "hidden";
+ if(timer_ballon)
+ {
+ clearTimeout(timer_ballon);
+ timer_ballon = null;
+ }
- var dragfound = false;
- var clickfound = false;
- var xmouse = parseInt(evt.clientX);
- var ymouse = parseInt(evt.clientY);
- var acceptClick = true;
- var e;
- for(var e=src0; e && acceptClick && (!e.tagName || !dragfound || !clickfound); e=e.parentNode)
- {
- if(e && e.clickable)
- {
- clickObj.X = xmouse;
- clickObj.Y = ymouse;
- clickObj.Src = e;
- clickObj.Src0 = src0;
- clickfound = true;
- if(e.clickCallback)
- {
- // var js = "cbDD_T0('CONTEXTMENU', '"+src0.id+"')";
- // self.setTimeout(js, 3000);
- // (js)();
- acceptClick = (e.clickCallback)(evt, "CONTEXTMENU", clickObj);
- }
- }
- }
- evt.cancelBubble = true; // for firefox
- evt.returnValue = false; // for others
+ if(!dragObj.objCursor)
+ dragObj.objCursor = document.getElementById("dragDropCursor");
+ dragObj.Src0 = dragObj.Src = dragObj.Target = dragObj.Target0 = null;
+ dragObj.dragging = 0;
+
+ var srcElement = (evt.target) ? evt.target : evt.srcElement;
+ var src0;
+ for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
+ ;
+
+ var dragfound = false;
+ var clickfound = false;
+ var xmouse = parseInt(evt.clientX);
+ var ymouse = parseInt(evt.clientY);
+ var acceptClick = true;
+ var e;
+ for(var e=src0; e && acceptClick && (!e.tagName || !dragfound || !clickfound); e=e.parentNode)
+ {
+ if(e && e.clickable)
+ {
+ clickObj.X = xmouse;
+ clickObj.Y = ymouse;
+ clickObj.Src = e;
+ clickObj.Src0 = src0;
+ clickfound = true;
+ if(e.clickCallback)
+ {
+ // var js = "cbDD_T0('CONTEXTMENU', '"+src0.id+"')";
+ // self.setTimeout(js, 3000);
+ // (js)();
+ acceptClick = (e.clickCallback)(evt, "CONTEXTMENU", clickObj);
+ }
+ }
+ }
+ evt.cancelBubble = true; // for firefox
+ evt.returnValue = false; // for others
// return(false);
}
/*
-function disabled_evt_kon_doc(event, gui)
-{
-// var str=''; for (var k in event) {str+='event.'+k+'='+event[k]+' \n'}
-// document.getElementById("debug").innerHTML = "KON "+(iiii++)+" \n" + str ;
+ function disabled_evt_kon_doc(event, gui)
+ {
+ // var str=''; for (var k in event) {str+='event.'+k+'='+event[k]+' \n'}
+ // document.getElementById("debug").innerHTML = "KON "+(iiii++)+" \n" + str ;
- var gui = eval(gui);
-
- if(gui.elemBalloon)
- gui.elemBalloon.style.visibility = "hidden";
- if(timer_ballon)
- {
- clearTimeout(timer_ballon);
- timer_ballon = null;
- }
-
- if(!dragObj.objCursor)
- dragObj.objCursor = document.getElementById("dragDropCursor");
- dragObj.Src0 = dragObj.Src = dragObj.Target = dragObj.Target0 = null;
- dragObj.dragging = 0;
+ var gui = eval(gui);
- var srcElement = (event.target) ? event.target : event.srcElement;
- var src0;
- for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
- ;
+ if(gui.elemBalloon)
+ gui.elemBalloon.style.visibility = "hidden";
+ if(timer_ballon)
+ {
+ clearTimeout(timer_ballon);
+ timer_ballon = null;
+ }
- var dragfound = false;
- var clickfound = false;
- var xmouse = parseInt(event.clientX);
- var ymouse = parseInt(event.clientY);
- var acceptClick = true;
- var e;
- for(var e=src0; e && acceptClick && (!e.tagName || !dragfound || !clickfound); e=e.parentNode)
- {
- if(e && e.clickable)
- {
- clickObj.X = xmouse;
- clickObj.Y = ymouse;
- clickObj.Src = e;
- clickObj.Src0 = src0;
- clickfound = true;
- if(e.clickCallback)
- {
- // var js = "cbDD_T0('CONTEXTMENU', '"+src0.id+"')";
- // self.setTimeout(js, 3000);
- // (js)();
- acceptClick = (e.clickCallback)(event, "CONTEXTMENU", clickObj);
- }
- }
- }
- event.cancelBubble = true;
- event.returnValue = false;
-// document.getElementById("debug").innerHTML = "src0:("+src0.tagName+" id="+src0.id+" "+src0.draggable+") e:("+e.tagName+" id="+e.id+" "+e.draggable+") --- "+dragObj.dragging;
-}
-*/
+ if(!dragObj.objCursor)
+ dragObj.objCursor = document.getElementById("dragDropCursor");
+ dragObj.Src0 = dragObj.Src = dragObj.Target = dragObj.Target0 = null;
+ dragObj.dragging = 0;
+
+ var srcElement = (event.target) ? event.target : event.srcElement;
+ var src0;
+ for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode)
+ ;
+
+ var dragfound = false;
+ var clickfound = false;
+ var xmouse = parseInt(event.clientX);
+ var ymouse = parseInt(event.clientY);
+ var acceptClick = true;
+ var e;
+ for(var e=src0; e && acceptClick && (!e.tagName || !dragfound || !clickfound); e=e.parentNode)
+ {
+ if(e && e.clickable)
+ {
+ clickObj.X = xmouse;
+ clickObj.Y = ymouse;
+ clickObj.Src = e;
+ clickObj.Src0 = src0;
+ clickfound = true;
+ if(e.clickCallback)
+ {
+ // var js = "cbDD_T0('CONTEXTMENU', '"+src0.id+"')";
+ // self.setTimeout(js, 3000);
+ // (js)();
+ acceptClick = (e.clickCallback)(event, "CONTEXTMENU", clickObj);
+ }
+ }
+ }
+ event.cancelBubble = true;
+ event.returnValue = false;
+ // document.getElementById("debug").innerHTML = "src0:("+src0.tagName+" id="+src0.id+" "+src0.draggable+") e:("+e.tagName+" id="+e.id+" "+e.draggable+") --- "+dragObj.dragging;
+ }
+ */
// ------------------------------------------------------------------------------------------------------
@@ -796,1148 +796,1148 @@ var timer_ballon = null;
var under_ballon = null;
function timeout_ballon(id, xmouse, ymouse)
{
- var src0;
- if(src0 = document.getElementById(id))
- {
- var clickfound = false;
- for(var e=src0; e && (!e.tagName || !clickfound); e=e.parentNode)
- {
- if(e && e.clickable)
- {
- balloonObj.X = xmouse;
- balloonObj.Y = ymouse;
- balloonObj.Src = e;
- balloonObj.Src0 = src0;
- clickfound = true;
- if(e.clickCallback)
- (e.clickCallback)(null, "BALLOON", balloonObj);
- }
- }
- }
- // alert("uballon " + id);
- timer_ballon = null;
+ var src0;
+ if(src0 = document.getElementById(id))
+ {
+ var clickfound = false;
+ for(var e=src0; e && (!e.tagName || !clickfound); e=e.parentNode)
+ {
+ if(e && e.clickable)
+ {
+ balloonObj.X = xmouse;
+ balloonObj.Y = ymouse;
+ balloonObj.Src = e;
+ balloonObj.Src0 = src0;
+ clickfound = true;
+ if(e.clickCallback)
+ (e.clickCallback)(null, "BALLOON", balloonObj);
+ }
+ }
+ }
+ // alert("uballon " + id);
+ timer_ballon = null;
}
function ww_evt_balloon(msg)
{
// for(var i=0; i<24; i++)
// msg += " \n"+i;
- var measurediv=0;
- if(measurediv)
- {
- if(!this.elemMeasureBalloon)
- {
- var div = this.document.createElement("div");
- div.style.position = "absolute";
- div.style.top = div.style.left = "0px";
- div.style.width = div.style.height = "auto";
- div.style.backgroundColor = "#80ff80";
- div.style.zIndex = 998;
- div.innerHTML = "HELLO";
- this.elemMeasureBalloon = this.body.appendChild(div);
- }
- }
-
- var k=7;
- if(!this.elemBalloon)
- {
- var div = this.document.createElement("div");
- div.style.overflow = "visible";
- div.style.position = "absolute";
- div.style.width = "auto";
- div.style.height = "auto";
- div.style.backgroundColor = "#ff8800";
- div.style.zIndex = 999;
-
- for(var i=1; ialert('loaded');";
+ var msg_h = this.elemMeasureBalloon.clientHeight;
+ var msg_w = this.elemMeasureBalloon.clientWidth;
- if(measurediv)
- {
- this.elemMeasureBalloon.innerHTML = msg; // + "";
- var msg_h = this.elemMeasureBalloon.clientHeight;
- var msg_w = this.elemMeasureBalloon.clientWidth;
-
// alert(msg_w + " " + msg_h );
-
- }
-
+
+ }
+
// var msg_sbox = this.elemBalloon.firstChild;
// var msg_tbox = this.elemBalloon.children.item(k<1 ? 0 : k-1);
- var msg_tbox = this.elemBalloon.childNodes[k<1 ? 0 : k-1];
- if(measurediv)
- {
- msg_tbox.innerHTML = msg;
- msg_tbox.style.width = (msg_w+0)+"px";
- msg_tbox.style.height = (msg_h+0)+"px";
- }
- else
- {
- // this.elemBalloon.style.visibility = "visible";
- this.elemBalloon.style.top = "0px";
- this.elemBalloon.style.left = "0px";
- msg_tbox.style.width = "auto";
- msg_tbox.style.height = "auto";
- msg_tbox.innerHTML = msg;
- var msg_h = this.elemBalloon.clientHeight;
- var msg_w = this.elemBalloon.clientWidth;
- msg_tbox.style.width = (msg_w-4)+"px";
- msg_tbox.style.height = (msg_h-4)+"px";
- }
+ var msg_tbox = this.elemBalloon.childNodes[k<1 ? 0 : k-1];
+ if(measurediv)
+ {
+ msg_tbox.innerHTML = msg;
+ msg_tbox.style.width = (msg_w+0)+"px";
+ msg_tbox.style.height = (msg_h+0)+"px";
+ }
+ else
+ {
+ // this.elemBalloon.style.visibility = "visible";
+ this.elemBalloon.style.top = "0px";
+ this.elemBalloon.style.left = "0px";
+ msg_tbox.style.width = "auto";
+ msg_tbox.style.height = "auto";
+ msg_tbox.innerHTML = msg;
+ var msg_h = this.elemBalloon.clientHeight;
+ var msg_w = this.elemBalloon.clientWidth;
+ msg_tbox.style.width = (msg_w-4)+"px";
+ msg_tbox.style.height = (msg_h-4)+"px";
+ }
- var ymouse = 0+balloonObj.Y;
- var xmouse = 0+balloonObj.X;
+ var ymouse = 0+balloonObj.Y;
+ var xmouse = 0+balloonObj.X;
- var body_h = document.documentElement.clientHeight;
-
- var msg_t;
-
- msg_t = ymouse + 5; // en dessous
- if(msg_t + msg_h > body_h)
- {
- // tiens pas en dessous
- msg_t = ymouse - msg_h - 3; // au dessus
- if(msg_t < 3)
- {
- // tiens pas au dessus
- msg_t = body_h - msg_h - 10; // colle en bas
- if(msg_t < 3)
- {
- // tiens pas colle en bas
- msg_t = 3; // colle en haut, tant pis si ea deborde en bas
- }
- }
- }
- var msg_l;
- msg_l = xmouse + 3;
-
- this.elemBalloon.style.top = msg_t+"px";
- this.elemBalloon.style.left = msg_l+"px";
+ var body_h = document.documentElement.clientHeight;
- this.elemBalloon.style.visibility = "visible";
+ var msg_t;
+
+ msg_t = ymouse + 5; // en dessous
+ if(msg_t + msg_h > body_h)
+ {
+ // tiens pas en dessous
+ msg_t = ymouse - msg_h - 3; // au dessus
+ if(msg_t < 3)
+ {
+ // tiens pas au dessus
+ msg_t = body_h - msg_h - 10; // colle en bas
+ if(msg_t < 3)
+ {
+ // tiens pas colle en bas
+ msg_t = 3; // colle en haut, tant pis si ea deborde en bas
+ }
+ }
+ }
+ var msg_l;
+ msg_l = xmouse + 3;
+
+ this.elemBalloon.style.top = msg_t+"px";
+ this.elemBalloon.style.left = msg_l+"px";
+
+ this.elemBalloon.style.visibility = "visible";
}
function evt_false()
{
- return false;
+ return false;
}
function evt_true()
{
- return true;
+ return true;
}
function ww_mdwn_win(idx)
{
- wf = this.frontWindow();
- if(wf.modal && this.twin[idx] != wf)
- {
- wf.blink();
- return(false);
- }
+ wf = this.frontWindow();
+ if(wf.modal && this.twin[idx] != wf)
+ {
+ wf.blink();
+ return(false);
+ }
- if(o = document.getElementById(this.varname+"w"+idx))
- {
- e = window.event;
- z = o.style.zIndex;
- if(z != 99)
- {
- o.style.zIndex = this.twin[idx].properties["z-index"] = this.maxdepth;
- for(i=0; i z && z2 != 99)
- {
- z2--;
- o2.style.zIndex = this.twin[i].properties["z-index"] = z2;
- }
- }
- }
- }
+ if(o = document.getElementById(this.varname+"w"+idx))
+ {
+ e = window.event;
+ z = o.style.zIndex;
+ if(z != 99)
+ {
+ o.style.zIndex = this.twin[idx].properties["z-index"] = this.maxdepth;
+ for(i=0; i z && z2 != 99)
+ {
+ z2--;
+ o2.style.zIndex = this.twin[i].properties["z-index"] = z2;
+ }
+ }
+ }
+ }
- this.w_active=idx;
+ this.w_active=idx;
- this.new_t = this.t0 = o.offsetTop;
- this.new_l = this.l0 = o.offsetLeft;
- this.new_w = this.w0 = o.clientWidth;
- this.new_h = this.h0 = o.clientHeight;
+ this.new_t = this.t0 = o.offsetTop;
+ this.new_l = this.l0 = o.offsetLeft;
+ this.new_w = this.w0 = o.clientWidth;
+ this.new_h = this.h0 = o.clientHeight;
- // alert("ww_mdwn_win : w0="+this.w0 + " h0="+this.h0);
- this.x0 = e.clientX;
- this.y0 = e.clientY;
- return true;
- }
- return false;
+ // alert("ww_mdwn_win : w0="+this.w0 + " h0="+this.h0);
+ this.x0 = e.clientX;
+ this.y0 = e.clientY;
+ return true;
+ }
+ return false;
}
function ww_evt_mdwn_window(idx)
{
- this.mdwn_win(idx);
+ this.mdwn_win(idx);
}
function ww_evt_mdwn_title(idx)
{
- if(!this.twin[idx] || this.twin[idx].moveable<=0)
- return;
- if(this.mdwn_win(idx))
- {
- // this.twin[idx].hide();
- /* for(w in this.twin)
- {
- // this.twin[w].kontent = document.getElementById(this.varname+"w"+w).innerHTML;
- n = document.getElementById(this.varname+"w"+w);
- n.removeChild(this.twin[w].kontent = n.firstChild);
- // document.getElementById(this.varname+"w"+w).innerHTML = "beuark";
- }
- */
- this.dragging = true;
- /*
- */
- window.event.cancelBubble = true;
- if(window.event.stopPropagation)
- window.event.stopPropagation();
- }
+ if(!this.twin[idx] || this.twin[idx].moveable<=0)
+ return;
+ if(this.mdwn_win(idx))
+ {
+ // this.twin[idx].hide();
+ /* for(w in this.twin)
+ {
+ // this.twin[w].kontent = document.getElementById(this.varname+"w"+w).innerHTML;
+ n = document.getElementById(this.varname+"w"+w);
+ n.removeChild(this.twin[w].kontent = n.firstChild);
+ // document.getElementById(this.varname+"w"+w).innerHTML = "beuark";
+ }
+ */
+ this.dragging = true;
+ /*
+ */
+ window.event.cancelBubble = true;
+ if(window.event.stopPropagation)
+ window.event.stopPropagation();
+ }
}
function ww_evt_mdwn_sizer(idx)
{
- if(!this.twin[idx] || this.twin[idx].sizeable<=0)
- return;
- if(this.mdwn_win(idx))
- this.sizing = true;
- window.event.cancelBubble = true;
- if(window.event.stopPropagation)
- window.event.stopPropagation();
+ if(!this.twin[idx] || this.twin[idx].sizeable<=0)
+ return;
+ if(this.mdwn_win(idx))
+ this.sizing = true;
+ window.event.cancelBubble = true;
+ if(window.event.stopPropagation)
+ window.event.stopPropagation();
}
function ww_evt_mdwn_reducer(idx)
{
// alert("recucer");
- if(o = document.getElementById(this.varname+"w"+idx))
- {
- if(this.twin[idx].reduced)
- {
- // restore
- // o.style.clip = "rect(auto auto auto auto)";
- // alert(this.twin[idx].oldheight);
- this.twin[idx].setProperties({height:this.twin[idx].oldheight+"px"});
- //o.style.height = (this.twin[idx].oldheight + "px");
- this.twin[idx].reduced = false;
- }
- else
- {
- // reduce
- // o.style.clip = "rect(0px auto 17px auto)";
- this.twin[idx].oldheight = parseInt(o.style.height);
+ if(o = document.getElementById(this.varname+"w"+idx))
+ {
+ if(this.twin[idx].reduced)
+ {
+ // restore
+ // o.style.clip = "rect(auto auto auto auto)";
+ // alert(this.twin[idx].oldheight);
+ this.twin[idx].setProperties({height:this.twin[idx].oldheight+"px"});
+ //o.style.height = (this.twin[idx].oldheight + "px");
+ this.twin[idx].reduced = false;
+ }
+ else
+ {
+ // reduce
+ // o.style.clip = "rect(0px auto 17px auto)";
+ this.twin[idx].oldheight = parseInt(o.style.height);
- tith = (document.getElementById(this.varname+"tbar"+idx).clientHeight) + "px";
+ tith = (document.getElementById(this.varname+"tbar"+idx).clientHeight) + "px";
- this.twin[idx].setProperties({height:tith});
- this.twin[idx].reduced = true;
- }
- }
- window.event.cancelBubble = true;
- if(window.event.stopPropagation)
- window.event.stopPropagation();
- //if(!this.twin[idx] || this.twin[idx].sizeable<=0)
- // return;
- //if(this.mdwn_win(idx))
- // this.sizing = true;
+ this.twin[idx].setProperties({height:tith});
+ this.twin[idx].reduced = true;
+ }
+ }
+ window.event.cancelBubble = true;
+ if(window.event.stopPropagation)
+ window.event.stopPropagation();
+ //if(!this.twin[idx] || this.twin[idx].sizeable<=0)
+ // return;
+ //if(this.mdwn_win(idx))
+ // this.sizing = true;
}
function ww_evt_mdwn_closer(idx)
{
- if(o = document.getElementById(this.varname+"w"+idx))
- {
- // alert(this.twin[idx].onclose);
- if(!this.twin[idx].onclose || (this.twin[idx].onclose)(this.twin[idx])==true)
- {
- this.twin[idx].hide();
+ if(o = document.getElementById(this.varname+"w"+idx))
+ {
+ // alert(this.twin[idx].onclose);
+ if(!this.twin[idx].onclose || (this.twin[idx].onclose)(this.twin[idx])==true)
+ {
+ this.twin[idx].hide();
// o.style.visibility = "hidden";
- }
- window.event.cancelBubble = true;
- if(window.event.stopPropagation)
- window.event.stopPropagation();
- }
+ }
+ window.event.cancelBubble = true;
+ if(window.event.stopPropagation)
+ window.event.stopPropagation();
+ }
}
/*
-function ww_evt_mdwn_doc(gui)
-{
-// gui = eval(gui);
-// if(window.event.srcElement.id == gui.desktop)
-// {
- // on a clique sur le bureau
- if(window.event.srcElement.onMenu && (window.event.altKey || window.event.button==2))
- {
- eval(window.event.srcElement.onMenu);
- window.event.returnValue = false;
- return(false);
- }
-// }
-}
-*/
+ function ww_evt_mdwn_doc(gui)
+ {
+ // gui = eval(gui);
+ // if(window.event.srcElement.id == gui.desktop)
+ // {
+ // on a clique sur le bureau
+ if(window.event.srcElement.onMenu && (window.event.altKey || window.event.button==2))
+ {
+ eval(window.event.srcElement.onMenu);
+ window.event.returnValue = false;
+ return(false);
+ }
+ // }
+ }
+ */
/*
-function ww_evt_mmov_doc(gui)
-{
- gui = eval(gui);
- e = window.event;
- // msg("" + (e.clientX) + " - " + (e.clientY) );
- if(gui.w_active != -1 && (gui.sizing || gui.dragging))
- {
- t = "";
- if(gui.dragging)
- {
- gui.new_t = gui.t0 + (e.clientY - gui.y0);
- gui.new_l = gui.l0 + (e.clientX - gui.x0);
- t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; width:" + (gui.w0-4) + "px; height:" + (gui.h0-4) + "px; visibility:visible;" ;
- // t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; visibility:visible;" ;
- }
- if(gui.sizing)
- {
- gui.new_h = gui.h0 + (e.clientY - gui.y0);
- gui.new_w = gui.w0 + (e.clientX - gui.x0);
- if(gui.new_w < gui.twin[gui.w_active].minwidth)
- gui.new_w = gui.twin[gui.w_active].minwidth;
- else
- if(gui.new_w > gui.twin[gui.w_active].maxwidth)
- gui.new_w = gui.twin[gui.w_active].maxwidth;
+ function ww_evt_mmov_doc(gui)
+ {
+ gui = eval(gui);
+ e = window.event;
+ // msg("" + (e.clientX) + " - " + (e.clientY) );
+ if(gui.w_active != -1 && (gui.sizing || gui.dragging))
+ {
+ t = "";
+ if(gui.dragging)
+ {
+ gui.new_t = gui.t0 + (e.clientY - gui.y0);
+ gui.new_l = gui.l0 + (e.clientX - gui.x0);
+ t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; width:" + (gui.w0-4) + "px; height:" + (gui.h0-4) + "px; visibility:visible;" ;
+ // t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; visibility:visible;" ;
+ }
+ if(gui.sizing)
+ {
+ gui.new_h = gui.h0 + (e.clientY - gui.y0);
+ gui.new_w = gui.w0 + (e.clientX - gui.x0);
+ if(gui.new_w < gui.twin[gui.w_active].minwidth)
+ gui.new_w = gui.twin[gui.w_active].minwidth;
+ else
+ if(gui.new_w > gui.twin[gui.w_active].maxwidth)
+ gui.new_w = gui.twin[gui.w_active].maxwidth;
- if(gui.new_h < gui.twin[gui.w_active].minheight)
- gui.new_h = gui.twin[gui.w_active].minheight;
- else
- if(gui.new_h > gui.twin[gui.w_active].maxheight)
- gui.new_h = gui.twin[gui.w_active].maxheight;
+ if(gui.new_h < gui.twin[gui.w_active].minheight)
+ gui.new_h = gui.twin[gui.w_active].minheight;
+ else
+ if(gui.new_h > gui.twin[gui.w_active].maxheight)
+ gui.new_h = gui.twin[gui.w_active].maxheight;
- t = "top:" + (gui.t0) + "px; left:" + (gui.l0) + "px; width:" + (gui.new_w-4) + "px; height:" + (gui.new_h-4) + "px; visibility:visible" ;
- }
- // gui.twin[gui.w_active].hide();
- // document.getElementById(gui.varname+"w"+gui.w_active).style.display = "none";
- document.getElementById(gui.varname+"wb").style.cssText = t;
- }
- return false;
-}
-*/
+ t = "top:" + (gui.t0) + "px; left:" + (gui.l0) + "px; width:" + (gui.new_w-4) + "px; height:" + (gui.new_h-4) + "px; visibility:visible" ;
+ }
+ // gui.twin[gui.w_active].hide();
+ // document.getElementById(gui.varname+"w"+gui.w_active).style.display = "none";
+ document.getElementById(gui.varname+"wb").style.cssText = t;
+ }
+ return false;
+ }
+ */
function ww_setProperties(properties)
{
- style = "";
- for(p in this.properties)
- {
- if(properties[p])
- this.properties[p] = properties[p];
- style += p + ":" + this.properties[p] + ";" ;
- }
+ style = "";
+ for(p in this.properties)
+ {
+ if(properties[p])
+ this.properties[p] = properties[p];
+ style += p + ":" + this.properties[p] + ";" ;
+ }
// if(this.reduced)
// style += "clip:rect(0px auto 17px auto);" ;
- document.getElementById(this.varname+"w"+this.idx).style.cssText = style;
+ document.getElementById(this.varname+"w"+this.idx).style.cssText = style;
// alert("ww_setProperties : style="+style);
- tith = document.getElementById(this.varname+"tbar"+this.idx).clientHeight;
+ tith = document.getElementById(this.varname+"tbar"+this.idx).clientHeight;
// alert("tith=" + tith);
- tv = false;
- win_w = parseInt(this.properties.width);
- win_h = parseInt(this.properties.height);
- o_h = win_h-tith-2;
- if(o_h < 0)
- o_h = 0;
- if(this.twoviews && (o = document.getElementById(this.varname+"e"+this.idx).style))
- {
- /*
- if(this.hasscroll)
- o.overflow = "scroll";
- else
- o.overflow = "hiddden";
- */
- tv = true;
- o.height = (o_h) + "px" ;
- o.width = (Math.round(win_w*.25)-2) + "px" ;
- // document.getElementById(this.varname+"e"+this.idx).style.cssText = style;
- }
- if(o = document.getElementById(this.varname+"c"+this.idx).style)
- {
- /*
- if(this.hasscroll)
- o.style.overflow = "scroll";
- else
- o.style.overflow = "hiddden";
- */
- o.height = (o_h) + "px" ;
- if(tv)
- o.width = (Math.round(win_w*.75)-2) + "px" ;
- else
- o.width = (Math.round(win_w*1)-2) + "px" ;
- // style += "width:" + document.getElementById(this.varname+"c"+this.idx).style.width+";";
+ tv = false;
+ win_w = parseInt(this.properties.width);
+ win_h = parseInt(this.properties.height);
+ o_h = win_h-tith-2;
+ if(o_h < 0)
+ o_h = 0;
+ if(this.twoviews && (o = document.getElementById(this.varname+"e"+this.idx).style))
+ {
+ /*
+ if(this.hasscroll)
+ o.overflow = "scroll";
+ else
+ o.overflow = "hiddden";
+ */
+ tv = true;
+ o.height = (o_h) + "px" ;
+ o.width = (Math.round(win_w*.25)-2) + "px" ;
+ // document.getElementById(this.varname+"e"+this.idx).style.cssText = style;
+ }
+ if(o = document.getElementById(this.varname+"c"+this.idx).style)
+ {
+ /*
+ if(this.hasscroll)
+ o.style.overflow = "scroll";
+ else
+ o.style.overflow = "hiddden";
+ */
+ o.height = (o_h) + "px" ;
+ if(tv)
+ o.width = (Math.round(win_w*.75)-2) + "px" ;
+ else
+ o.width = (Math.round(win_w*1)-2) + "px" ;
+ // style += "width:" + document.getElementById(this.varname+"c"+this.idx).style.width+";";
- // alert("ww_setProperties : style=" + style);
- // document.getElementById(this.varname+"c"+this.idx).style.cssText = style;
- }
+ // alert("ww_setProperties : style=" + style);
+ // document.getElementById(this.varname+"c"+this.idx).style.cssText = style;
+ }
- if(o = document.getElementById(this.varname+"r"+this.idx))
- {
- t = "top:" + (parseInt(this.properties.height)-18) + "px; left:" + (parseInt(this.properties.width)-18) + "px;" ;
- o.style.cssText = t;
- }
+ if(o = document.getElementById(this.varname+"r"+this.idx))
+ {
+ t = "top:" + (parseInt(this.properties.height)-18) + "px; left:" + (parseInt(this.properties.width)-18) + "px;" ;
+ o.style.cssText = t;
+ }
}
/*
-function ww_evt_mup_doc(gui)
-{
- gui = eval(gui);
- if((gui.w_active != -1) && (gui.dragging || gui.sizing))
- {
- document.getElementById(gui.varname+"wb").style.visibility = "hidden";
+ function ww_evt_mup_doc(gui)
+ {
+ gui = eval(gui);
+ if((gui.w_active != -1) && (gui.dragging || gui.sizing))
+ {
+ document.getElementById(gui.varname+"wb").style.visibility = "hidden";
- gui.twin[gui.w_active].setProperties( { top:(gui.new_t)+"px", left:(gui.new_l)+"px", width:(gui.new_w)+"px", height:(gui.new_h)+"px" } );
- if(gui.sizing && gui.twin[gui.w_active].onresized)
- (gui.twin[gui.w_active].onresized)(gui.new_t, gui.new_l, gui.new_w, gui.new_h);
+ gui.twin[gui.w_active].setProperties( { top:(gui.new_t)+"px", left:(gui.new_l)+"px", width:(gui.new_w)+"px", height:(gui.new_h)+"px" } );
+ if(gui.sizing && gui.twin[gui.w_active].onresized)
+ (gui.twin[gui.w_active].onresized)(gui.new_t, gui.new_l, gui.new_w, gui.new_h);
- gui.dragging = gui.sizing = false;
- }
- return true;
-}
-*/
+ gui.dragging = gui.sizing = false;
+ }
+ return true;
+ }
+ */
function ww_repaint()
{
- w = parseInt(this.gui.twin[this.idx].properties.width);
- h = parseInt(this.gui.twin[this.idx].properties.height);
- this.gui.twin[this.idx].setProperties( { width:(w)+"px", height:(h)+"px" } );
+ w = parseInt(this.gui.twin[this.idx].properties.width);
+ h = parseInt(this.gui.twin[this.idx].properties.height);
+ this.gui.twin[this.idx].setProperties( { width:(w)+"px", height:(h)+"px" } );
}
function ww_sizeto(w, h)
{
- if(w == -1)
- w = parseInt(this.gui.twin[this.idx].properties.width);
- if(h == -1)
- h = parseInt(this.gui.twin[this.idx].properties.height);
- this.gui.twin[this.idx].setProperties( { width:(w)+"px", height:(h)+"px" } );
-/*
- if(w != -1 && h != -1)
- this.gui.twin[this.idx].setProperties( { width:(w)+"px", height:(h)+"px" } );
- else
- if(w != -1)
- this.gui.twin[this.idx].setProperties( { width:(w)+"px" } );
- else
- if(h != -1)
- this.gui.twin[this.idx].setProperties( { height:(h)+"px" } );
-*/
- if(this.gui.twin[this.idx].onresized)
- (this.gui.twin[this.idx].onresized)(parseInt(this.gui.twin[this.idx].properties.top)
- , parseInt(this.gui.twin[this.idx].properties.left), w, h);
+ if(w == -1)
+ w = parseInt(this.gui.twin[this.idx].properties.width);
+ if(h == -1)
+ h = parseInt(this.gui.twin[this.idx].properties.height);
+ this.gui.twin[this.idx].setProperties( { width:(w)+"px", height:(h)+"px" } );
+ /*
+ if(w != -1 && h != -1)
+ this.gui.twin[this.idx].setProperties( { width:(w)+"px", height:(h)+"px" } );
+ else
+ if(w != -1)
+ this.gui.twin[this.idx].setProperties( { width:(w)+"px" } );
+ else
+ if(h != -1)
+ this.gui.twin[this.idx].setProperties( { height:(h)+"px" } );
+ */
+ if(this.gui.twin[this.idx].onresized)
+ (this.gui.twin[this.idx].onresized)(parseInt(this.gui.twin[this.idx].properties.top)
+ , parseInt(this.gui.twin[this.idx].properties.left), w, h);
}
function ww_moveto(t, l)
{
- this.gui.twin[this.idx].setProperties( { top:(t)+"px", left:(l)+"px" } );
+ this.gui.twin[this.idx].setProperties( { top:(t)+"px", left:(l)+"px" } );
}
function ww_setTitle(t)
{
- document.getElementById(this.varname+"t"+this.idx).innerHTML = " "+t;
+ document.getElementById(this.varname+"t"+this.idx).innerHTML = " "+t;
}
function ww_setContent(t, view)
{
- if(!view || !this.twoviews || view != "e")
- view = "c";
- document.getElementById(this.varname+view+this.idx).innerHTML = t;
+ if(!view || !this.twoviews || view != "e")
+ view = "c";
+ document.getElementById(this.varname+view+this.idx).innerHTML = t;
}
function ww_show()
{
- this.properties.visibility = "visible";
- document.getElementById(this.varname+"w"+this.idx).style.visibility = "visible";
+ this.properties.visibility = "visible";
+ document.getElementById(this.varname+"w"+this.idx).style.visibility = "visible";
}
function ww_toFront()
{
- wf = this.gui.frontWindow();
- if(wf.modal && this != wf)
- {
- wf.blink();
- return(false);
- }
- var o;
- if(o = document.getElementById(this.varname+"w"+this.idx))
- {
- e = window.event;
- z = o.style.zIndex;
- if(z != 99)
- {
- o.style.zIndex = this.gui.twin[this.idx].properties["z-index"] = this.gui.maxdepth;
- for(i=0; i z && z2 != 99)
- {
- z2--;
- o2.style.zIndex = this.gui.twin[i].properties["z-index"] = z2;
- }
- }
- }
- // this.gui.frontWindow = this.idx;
- }
+ wf = this.gui.frontWindow();
+ if(wf.modal && this != wf)
+ {
+ wf.blink();
+ return(false);
+ }
+ var o;
+ if(o = document.getElementById(this.varname+"w"+this.idx))
+ {
+ e = window.event;
+ z = o.style.zIndex;
+ if(z != 99)
+ {
+ o.style.zIndex = this.gui.twin[this.idx].properties["z-index"] = this.gui.maxdepth;
+ for(i=0; i z && z2 != 99)
+ {
+ z2--;
+ o2.style.zIndex = this.gui.twin[i].properties["z-index"] = z2;
+ }
+ }
+ }
+ // this.gui.frontWindow = this.idx;
+ }
- this.gui.w_active=this.idx;
+ this.gui.w_active=this.idx;
- this.gui.new_t = this.gui.t0 = o.offsetTop;
- this.gui.new_l = this.gui.l0 = o.offsetLeft;
- this.gui.new_w = this.gui.w0 = o.clientWidth;
- this.gui.new_h = this.gui.h0 = o.clientHeight;
- return true;
- }
- return false;
+ this.gui.new_t = this.gui.t0 = o.offsetTop;
+ this.gui.new_l = this.gui.l0 = o.offsetLeft;
+ this.gui.new_w = this.gui.w0 = o.clientWidth;
+ this.gui.new_h = this.gui.h0 = o.clientHeight;
+ return true;
+ }
+ return false;
}
function ww_hide()
{
- this.properties.visibility = "hidden";
- document.getElementById(this.varname+"w"+this.idx).style.visibility = "hidden";
+ this.properties.visibility = "hidden";
+ document.getElementById(this.varname+"w"+this.idx).style.visibility = "hidden";
}
function ww_blink()
{
- if(o = document.getElementById(this.varname+"t"+this.idx))
- {
- o.className = "ww_title_blink";
- window.setTimeout("ww_noblink('"+this.varname+"t"+this.idx+"');", 500);
- }
+ if(o = document.getElementById(this.varname+"t"+this.idx))
+ {
+ o.className = "ww_title_blink";
+ window.setTimeout("ww_noblink('"+this.varname+"t"+this.idx+"');", 500);
+ }
}
function ww_noblink(titleid)
{
- if(o = document.getElementById(titleid))
- o.className = "ww_title";
+ if(o = document.getElementById(titleid))
+ o.className = "ww_title";
}
function ww_getClientSize(view)
{
- if(!view || !this.twoviews || view != "e")
- view = "c";
- if(o = document.getElementById(this.varname+view+this.idx))
- {
- // alert("ww_getClientSize : o.style.width="+o.style.width + " o.style.height="+o.style.height );
- // return({w:(o.clientWidth-20), h:(o.clientHeight-2)});
- return({w:(parseInt(o.style.width)-2), h:(parseInt(o.style.height)-2)});
- }
- return(null);
+ if(!view || !this.twoviews || view != "e")
+ view = "c";
+ if(o = document.getElementById(this.varname+view+this.idx))
+ {
+ // alert("ww_getClientSize : o.style.width="+o.style.width + " o.style.height="+o.style.height );
+ // return({w:(o.clientWidth-20), h:(o.clientHeight-2)});
+ return({w:(parseInt(o.style.width)-2), h:(parseInt(o.style.height)-2)});
+ }
+ return(null);
}
function ww_autoMove()
{
- // alert("ww_autoMove");
- var moved = false;
- var sized = false;
- if(o = document.getElementById(this.varname+"w"+this.idx).style)
- {
- wgui = document.getElementById(this.gui.desktop).clientWidth;
- hgui = document.getElementById(this.gui.desktop).clientHeight;
- twin = parseInt(o.top);
- lwin = parseInt(o.left);
- wwin = parseInt(o.width);
- hwin = parseInt(o.height);
- bwin = twin+hwin;
- if(lwin > wgui-wwin)
- {
- lwin = wgui-wwin;
- moved = true;
- }
- if(lwin < 0)
- {
- lwin = 0;
- wwin = wgui;
- moved = true;
- sized = true;
- }
- if(twin > hgui-hwin)
- {
- twin = hgui-hwin;
- moved = true;
- }
- if(twin < 0)
- {
- twin = 0;
- hwin = hgui;
- moved = true;
- sized = true;
- }
- // o.top = twin+"px";
- // o.left = lwin+"px";
- if(moved)
- this.moveto(twin, lwin);
- if(sized)
- this.sizeto(wwin, hwin);
+ // alert("ww_autoMove");
+ var moved = false;
+ var sized = false;
+ if(o = document.getElementById(this.varname+"w"+this.idx).style)
+ {
+ wgui = document.getElementById(this.gui.desktop).clientWidth;
+ hgui = document.getElementById(this.gui.desktop).clientHeight;
+ twin = parseInt(o.top);
+ lwin = parseInt(o.left);
+ wwin = parseInt(o.width);
+ hwin = parseInt(o.height);
+ bwin = twin+hwin;
+ if(lwin > wgui-wwin)
+ {
+ lwin = wgui-wwin;
+ moved = true;
+ }
+ if(lwin < 0)
+ {
+ lwin = 0;
+ wwin = wgui;
+ moved = true;
+ sized = true;
+ }
+ if(twin > hgui-hwin)
+ {
+ twin = hgui-hwin;
+ moved = true;
+ }
+ if(twin < 0)
+ {
+ twin = 0;
+ hwin = hgui;
+ moved = true;
+ sized = true;
+ }
+ // o.top = twin+"px";
+ // o.left = lwin+"px";
+ if(moved)
+ this.moveto(twin, lwin);
+ if(sized)
+ this.sizeto(wwin, hwin);
// this.setProperties( {top:twin+"px", left:lwin+"px" } );
- }
-/*
-*/
+ }
+ /*
+ */
}
function ww_Window(gui, anchor, varname, idx, properties)
{
- if(!document.getElementById(anchor))
- return;
- oldContent = document.getElementById(anchor).innerHTML;
- this.gui = gui;
- this.varname = varname;
- this.idx = idx;
- this.anchor = anchor;
- this.properties = { top:"0px", left:"0px", width:"200px", height:"200px", "z-index":"0", visibility:"visible" };
+ if(!document.getElementById(anchor))
+ return;
+ oldContent = document.getElementById(anchor).innerHTML;
+ this.gui = gui;
+ this.varname = varname;
+ this.idx = idx;
+ this.anchor = anchor;
+ this.properties = { top:"0px", left:"0px", width:"200px", height:"200px", "z-index":"0", visibility:"visible" };
// this.evt_mdwn_window = ww_evt_mdwn_window;
// this.evt_mdwn_title = ww_evt_mdwn_title;
// this.evt_mdwn_sizer = ww_evt_mdwn_sizer;
// this.evt_mdwn_reducer = ww_evt_mdwn_reducer;
- // this.evt_mdwn_closer = ww_evt_mdwn_closer;
- this.sizeto = ww_sizeto;
- this.moveto = ww_moveto;
- this.repaint = ww_repaint;
- this.setTitle = ww_setTitle;
- this.setContent = ww_setContent;
- this.setProperties = ww_setProperties;
- this.show = ww_show;
- this.hide = ww_hide;
- this.toFront = ww_toFront;
- this.autoMove = ww_autoMove;
- this.blink = ww_blink;
- this.getClientSize = ww_getClientSize;
+ // this.evt_mdwn_closer = ww_evt_mdwn_closer;
+ this.sizeto = ww_sizeto;
+ this.moveto = ww_moveto;
+ this.repaint = ww_repaint;
+ this.setTitle = ww_setTitle;
+ this.setContent = ww_setContent;
+ this.setProperties = ww_setProperties;
+ this.show = ww_show;
+ this.hide = ww_hide;
+ this.toFront = ww_toFront;
+ this.autoMove = ww_autoMove;
+ this.blink = ww_blink;
+ this.getClientSize = ww_getClientSize;
// this.mdwn_win = ww_mdwn_win;
- this.modal = (properties.modal && properties.modal>0);
- this.twoviews = (properties.twoviews && properties.twoviews>0);
- this.hasscroll = (properties.scroll && properties.scroll>0);
- this.closeable = (properties.closeable && properties.closeable>0);
- this.moveable = (properties.moveable && properties.moveable>0);
- this.sizeable = (properties.sizeable && properties.sizeable>0);
- this.visibility = (properties.visibility && properties.visibility=="hidden") ? "hidden":"visible";
- this.ontop = (properties.ontop && properties.ontop>0);
- this.minwidth = (properties.minwidth && properties.minwidth>0) ? properties.minwidth : 50;
- this.maxwidth = (properties.maxwidth && properties.maxwidth>0) ? properties.maxwidth : 20000;
- this.minheight = (properties.minheight && properties.minheight>0) ? properties.minheight : 40;
- this.maxheight = (properties.maxheight && properties.maxheight>0) ? properties.maxheight : 20000;
- this.onresized = properties.onresized;
- this.oncreated = properties.oncreated;
- this.onclose = properties.onclose;
- this.reduced = false;
- this.oldheight = -1;
+ this.modal = (properties.modal && properties.modal>0);
+ this.twoviews = (properties.twoviews && properties.twoviews>0);
+ this.hasscroll = (properties.scroll && properties.scroll>0);
+ this.closeable = (properties.closeable && properties.closeable>0);
+ this.moveable = (properties.moveable && properties.moveable>0);
+ this.sizeable = (properties.sizeable && properties.sizeable>0);
+ this.visibility = (properties.visibility && properties.visibility=="hidden") ? "hidden":"visible";
+ this.ontop = (properties.ontop && properties.ontop>0);
+ this.minwidth = (properties.minwidth && properties.minwidth>0) ? properties.minwidth : 50;
+ this.maxwidth = (properties.maxwidth && properties.maxwidth>0) ? properties.maxwidth : 20000;
+ this.minheight = (properties.minheight && properties.minheight>0) ? properties.minheight : 40;
+ this.maxheight = (properties.maxheight && properties.maxheight>0) ? properties.maxheight : 20000;
+ this.onresized = properties.onresized;
+ this.oncreated = properties.oncreated;
+ this.onclose = properties.onclose;
+ this.reduced = false;
+ this.oldheight = -1;
- if(!this.ontop)
- {
- // gui.frontWindow = this;
- this.properties["z-index"] = ++gui.maxdepth;
- }
- else
- this.properties["z-index"] = 99;
+ if(!this.ontop)
+ {
+ // gui.frontWindow = this;
+ this.properties["z-index"] = ++gui.maxdepth;
+ }
+ else
+ this.properties["z-index"] = 99;
- s = "";
- style = "";
- for(p in this.properties)
- {
- if(properties[p])
- {
- if(p=="height")
- {
- if(parseInt(properties[p])<60)
- properties[p] = "60px";
- }
- this.properties[p] = properties[p];
- }
- style += p + ":" + this.properties[p] + ";" ;
- }
- s += "\n";
+ s = "";
+ style = "";
+ for(p in this.properties)
+ {
+ if(properties[p])
+ {
+ if(p=="height")
+ {
+ if(parseInt(properties[p])<60)
+ properties[p] = "60px";
+ }
+ this.properties[p] = properties[p];
+ }
+ style += p + ":" + this.properties[p] + ";" ;
+ }
+ s += "
\n";
// s += "
";
// s += "
";
// s += "
";
- s += "
";
- s += "
\n";
+ s += "
";
+ s += "
\n";
- s += "
";
- s += " ";
- s += " ";
- if(properties.title)
- {
+ s += "";
+ s += " ";
+ s += " ";
+ if(properties.title)
+ {
// s += " " + properties.title + "
";
- s += " " + properties.title + " ";
- }
- else
- s += " ";
+ s += " " + properties.title + " ";
+ }
+ else
+ s += " ";
- if(properties.title2)
- {
- s += ""+properties.title2+" \n";
- s += " \n";
- }
+ if(properties.title2)
+ {
+ s += ""+properties.title2+" \n";
+ s += " \n";
+ }
- s += " ";
- s += "
";
- //if(properties.title)
- // s += " " + properties.title + "
\n";
- s += " ";
+ s += " ";
+ s += "
";
+ //if(properties.title)
+ // s += "
" + properties.title + "
\n";
+ s += "
";
- s += "
\n";
+ s += "
\n";
- s += "
";
- if(this.closeable)
- s += "
\n";
- //else
- // s += " ";
- s += "
\n";
+ s += "
";
+ if(this.closeable)
+ s += "
\n";
+ //else
+ // s += " ";
+ s += "
\n";
- s += "
\n";
+ s += "
\n";
- //s += "
";
- style = "";
- if(this.hasscroll)
- style += "overflow:scroll;";
- else
- style += "overflow:hidden;";
+ //s += "
";
+ style = "";
+ if(this.hasscroll)
+ style += "overflow:scroll;";
+ else
+ style += "overflow:hidden;";
- if(properties.width)
- style += "width" + ":" + (parseInt(this.properties["width"])-2) + "px;" ;
- if(properties.heigth)
- style += "heigth" + ":" + (parseInt(this.properties["heigth"])-20) + "px;" ;
+ if(properties.width)
+ style += "width" + ":" + (parseInt(this.properties["width"])-2) + "px;" ;
+ if(properties.heigth)
+ style += "heigth" + ":" + (parseInt(this.properties["heigth"])-20) + "px;" ;
- if(this.twoviews)
- {
- s += "
\n";
- s += "
" + oldContent + "
\n";
- }
- else
- {
- s += "
"+oldContent+"
\n";
- }
- if(this.sizeable)
- {
- s += "
\n";
- }
+ if(this.twoviews)
+ {
+ s += "
\n";
+ s += "
" + oldContent + "
\n";
+ }
+ else
+ {
+ s += "
"+oldContent+"
\n";
+ }
+ if(this.sizeable)
+ {
+ s += "
\n";
+ }
// alert("ww_Window : style=" + style);
- //s += "
\n";
- s += "
\n";
- s += "
\n";
+ //s += "
\n";
+ s += "
\n";
+ s += "
\n";
// alert(s);
// document.write(s);
- document.getElementById(anchor).innerHTML = s;
- this.setProperties( this.properties );
- if(this.oncreated)
- (this.oncreated)();
- return this;
+ document.getElementById(anchor).innerHTML = s;
+ this.setProperties( this.properties );
+ if(this.oncreated)
+ (this.oncreated)();
+ return this;
}
function ww_createWindow(anchor, properties)
{
- this.twin[this.nwin] = new ww_Window(this, anchor, this.varname, this.nwin, properties);
- //this.nwin++;
- return(this.twin[this.nwin++]);
+ this.twin[this.nwin] = new ww_Window(this, anchor, this.varname, this.nwin, properties);
+ //this.nwin++;
+ return(this.twin[this.nwin++]);
}
function ww_getWinPosAsXML()
{
- var t="";
+ var t="";
// t += "<"++"?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n\r\n";
- for(w in this.twin)
- {
- t += " \r\n";
- }
+ for(w in this.twin)
+ {
+ t += " \r\n";
+ }
// t += " ";
- return(t);
+ return(t);
}
// retourne la fenetre au premier plan (hors palettes 'ontop')
function ww_frontWindow()
{
- idx = -1;
- z = -1;
- for(i=0; i z && z2 != 99)
- {
- z = z2;
- idx = i;
- }
- }
- }
- return(idx >= 0 ? this.twin[idx] : null);
+ idx = -1;
+ z = -1;
+ for(i=0; i z && z2 != 99)
+ {
+ z = z2;
+ idx = i;
+ }
+ }
+ }
+ return(idx >= 0 ? this.twin[idx] : null);
}
function ww_openCenterWindow(zurl, w, h, name, params)
{
- p = new Array();
- p.directories = "no";
- p.location = "no";
- p.menubar = "no";
- p.toolbar = "no";
- p.help = "no";
- p.status = "no";
- p.resizable = "no";
- for(cc in params)
- {
- if(p[params[cc].n])
- p[params[cc].n] = params[cc].v;
- }
- t = ((document.getElementById(this.desktop).clientHeight - h)/2) + self.screenTop;
- l = ((document.getElementById(this.desktop).clientWidth - w)/2) + self.screenLeft;
- if(t<10)
- t = 10;
- if(l<10)
- l = 10;
- s = "top="+t+", left="+l+", width="+w+", height="+h;
- for(cc in p)
- s += "," + cc + "=" + p[cc];
- return(window.open(zurl, name, s, true));
+ p = new Array();
+ p.directories = "no";
+ p.location = "no";
+ p.menubar = "no";
+ p.toolbar = "no";
+ p.help = "no";
+ p.status = "no";
+ p.resizable = "no";
+ for(cc in params)
+ {
+ if(p[params[cc].n])
+ p[params[cc].n] = params[cc].v;
+ }
+ t = ((document.getElementById(this.desktop).clientHeight - h)/2) + self.screenTop;
+ l = ((document.getElementById(this.desktop).clientWidth - w)/2) + self.screenLeft;
+ if(t<10)
+ t = 10;
+ if(l<10)
+ l = 10;
+ s = "top="+t+", left="+l+", width="+w+", height="+h;
+ for(cc in p)
+ s += "," + cc + "=" + p[cc];
+ return(window.open(zurl, name, s, true));
}
function ww_select(obj)
{
- this.unselect();
- if(obj)
- {
- obj.className = obj.className.replace("s_", "S_");
- this.selectedObject = obj;
- }
+ this.unselect();
+ if(obj)
+ {
+ obj.className = obj.className.replace("s_", "S_");
+ this.selectedObject = obj;
+ }
}
function ww_unselect()
{
- if(this.selectedObject)
- {
- var cn = this.selectedObject.className;
- cn = cn.replace("S_", "s_");
- this.selectedObject.className = cn;
- this.selectedObject = null;
- }
+ if(this.selectedObject)
+ {
+ var cn = this.selectedObject.className;
+ cn = cn.replace("S_", "s_");
+ this.selectedObject.className = cn;
+ this.selectedObject = null;
+ }
}
function ww_runAsMenu(event, backparm)
{
- // alert(event);
- this.backparm = backparm;
- if(this.gui.activeMenu != null)
- {
- this.gui.activeMenu.style.visibility = "hidden";
- this.gui.activeMenu = null;
- }
-
- if(typeof(event.which) != 'undefined')
- button = this.gui.firefoxButtons["b"+event.which]; // safari aussi ???
- else
- button = event.button;
- xmouse = parseInt(event.clientX);
- ymouse = parseInt(event.clientY);
+ // alert(event);
+ this.backparm = backparm;
+ if(this.gui.activeMenu != null)
+ {
+ this.gui.activeMenu.style.visibility = "hidden";
+ this.gui.activeMenu = null;
+ }
- (this.menuCallback)("INIT", this.backparm, null);
-
- // this.style.top = (ymouse-3)+"px";
- // this.style.left = (xmouse-3)+"px";
-
- var bodyH = document.documentElement.clientHeight;
+ if(typeof(event.which) != 'undefined')
+ button = this.gui.firefoxButtons["b"+event.which]; // safari aussi ???
+ else
+ button = event.button;
+ xmouse = parseInt(event.clientX);
+ ymouse = parseInt(event.clientY);
- if(ymouse+this.clientHeight < bodyH)
- {
- // menu en dessous
- this.style.top = (ymouse-3)+"px";
- this.style.left = (xmouse-3)+"px";
- }
- else
- {
- // menu au dessus
- this.style.top = (ymouse+0-this.clientHeight)+"px";
- this.style.left = (xmouse-3)+"px";
- }
-
- this.style.visibility = "visible";
- this.gui.activeMenu = this;
+ (this.menuCallback)("INIT", this.backparm, null);
+
+ // this.style.top = (ymouse-3)+"px";
+ // this.style.left = (xmouse-3)+"px";
+
+ var bodyH = document.documentElement.clientHeight;
+
+ if(ymouse+this.clientHeight < bodyH)
+ {
+ // menu en dessous
+ this.style.top = (ymouse-3)+"px";
+ this.style.left = (xmouse-3)+"px";
+ }
+ else
+ {
+ // menu au dessus
+ this.style.top = (ymouse+0-this.clientHeight)+"px";
+ this.style.left = (xmouse-3)+"px";
+ }
+
+ this.style.visibility = "visible";
+ this.gui.activeMenu = this;
}
function ww_dieMenu(mid)
{
- var m = document.getElementById(mid);
- if(m.gui.activeMenu)
- {
- m.style.visibility = "hidden";
- m.gui.activeMenu = null;
- (m.menuCallback)("DIE", m.backparm, null);
- }
+ var m = document.getElementById(mid);
+ if(m.gui.activeMenu)
+ {
+ m.style.visibility = "hidden";
+ m.gui.activeMenu = null;
+ (m.menuCallback)("DIE", m.backparm, null);
+ }
}
function ww_evt_mouseout_menu()
{
- this.dieMenuTimer = self.setTimeout("ww_dieMenu('"+this.id+"');", 500);
+ this.dieMenuTimer = self.setTimeout("ww_dieMenu('"+this.id+"');", 500);
}
function ww_evt_mousemove_menu()
{
// var str=''; for (var k in event) {str+='event.'+k+'='+event[k]+' \n'}
// document.getElementById("debug").innerHTML = "MOVE "+(iiii++)+" \n" + str ;
- if(this.dieMenuTimer)
- {
- clearTimeout(this.dieMenuTimer);
- this.dieMenuTimer = null;
- }
+ if(this.dieMenuTimer)
+ {
+ clearTimeout(this.dieMenuTimer);
+ this.dieMenuTimer = null;
+ }
}
function ww_evt_click_menu(e)
{
- if(this.dieMenuTimer)
- {
- clearTimeout(this.dieMenuTimer);
- this.dieMenuTimer = null;
- }
- if(!e)
- e = window.event;
- var tg = (e.target) ? e.target : e.srcElement;
- while(tg && (tg.nodeType!=1 || !tg.id))
- tg = tg.parentNode;
- if(tg.className=="disabled")
- return;
- this.style.visibility = "hidden";
- this.gui.activeMenu = null;
- (this.menuCallback)("SELECT", this.backparm, tg.id);
+ if(this.dieMenuTimer)
+ {
+ clearTimeout(this.dieMenuTimer);
+ this.dieMenuTimer = null;
+ }
+ if(!e)
+ e = window.event;
+ var tg = (e.target) ? e.target : e.srcElement;
+ while(tg && (tg.nodeType!=1 || !tg.id))
+ tg = tg.parentNode;
+ if(tg.className=="disabled")
+ return;
+ this.style.visibility = "hidden";
+ this.gui.activeMenu = null;
+ (this.menuCallback)("SELECT", this.backparm, tg.id);
}
function ww_setAsMenu(id, callback)
{
- o=this.document.getElementById(id);
- o.ismenu=1;
- o.gui=this;
- o.runAsMenu=ww_runAsMenu;
- o.menuCallback = callback;
- o.onmouseout = ww_evt_mouseout_menu;
- o.onmousemove = ww_evt_mousemove_menu;
- o.onclick = ww_evt_click_menu;
+ o=this.document.getElementById(id);
+ o.ismenu=1;
+ o.gui=this;
+ o.runAsMenu=ww_runAsMenu;
+ o.menuCallback = callback;
+ o.onmouseout = ww_evt_mouseout_menu;
+ o.onmousemove = ww_evt_mousemove_menu;
+ o.onclick = ww_evt_click_menu;
}
function GUI(varname, idbody, skin)
{
- this.firefoxButtons = {"b65536":0, "b1":1, "b2":4, "b3":2};
- if(!skin)
- skin = "FR";
- this.skin = skin;
- this.document = document;
- this.sizing=false,
- this.dragging=false,
- this.w_active = -1,
- this.varname = varname;
- this.t0=0, this.l0=0, // le top/left initial de la win
- this.w0=0, this.h0=0, // le width/height
- this.x0=0, this.y0=0, // la pos de la souris
- this.new_t=0, this.new_l=0, this.new_w=0, this.new_h=0;
- this.nwin = 0;
- this.twin = new Array(); // le tableau des win
- this.maxdepth = 0; // le zindex de la win au premier plan (hors win 'ontop')
- // this.frontWindow = null; // la win au premier plan (hors win 'ontop')
- this.body = document.getElementById(idbody);
-
- this.elemBalloon = null;
+ this.firefoxButtons = {"b65536":0, "b1":1, "b2":4, "b3":2};
+ if(!skin)
+ skin = "FR";
+ this.skin = skin;
+ this.document = document;
+ this.sizing=false,
+ this.dragging=false,
+ this.w_active = -1,
+ this.varname = varname;
+ this.t0=0, this.l0=0, // le top/left initial de la win
+ this.w0=0, this.h0=0, // le width/height
+ this.x0=0, this.y0=0, // la pos de la souris
+ this.new_t=0, this.new_l=0, this.new_w=0, this.new_h=0;
+ this.nwin = 0;
+ this.twin = new Array(); // le tableau des win
+ this.maxdepth = 0; // le zindex de la win au premier plan (hors win 'ontop')
+ // this.frontWindow = null; // la win au premier plan (hors win 'ontop')
+ this.body = document.getElementById(idbody);
- this.createWindow = ww_createWindow;
- this.frontWindow = ww_frontWindow;
- this.evt_mdwn_window = ww_evt_mdwn_window;
- this.evt_mdwn_title = ww_evt_mdwn_title;
- this.evt_mdwn_sizer = ww_evt_mdwn_sizer;
- this.evt_mdwn_reducer = ww_evt_mdwn_reducer;
- this.evt_mdwn_closer = ww_evt_mdwn_closer;
- this.showBalloon = ww_evt_balloon;
- this.mdwn_win = ww_mdwn_win;
- this.getWinPosAsXML = ww_getWinPosAsXML;
- this.openCenterWindow = ww_openCenterWindow;
-
- var desk = document.getElementById(idbody);
-
- var node;
-
- node = document.createElement("div");
- node.id = this.varname+"wb";
- node.className = "ww_winborder";
- this.windowBorder = desk.appendChild(node);
+ this.elemBalloon = null;
+
+ this.createWindow = ww_createWindow;
+ this.frontWindow = ww_frontWindow;
+ this.evt_mdwn_window = ww_evt_mdwn_window;
+ this.evt_mdwn_title = ww_evt_mdwn_title;
+ this.evt_mdwn_sizer = ww_evt_mdwn_sizer;
+ this.evt_mdwn_reducer = ww_evt_mdwn_reducer;
+ this.evt_mdwn_closer = ww_evt_mdwn_closer;
+ this.showBalloon = ww_evt_balloon;
+ this.mdwn_win = ww_mdwn_win;
+ this.getWinPosAsXML = ww_getWinPosAsXML;
+ this.openCenterWindow = ww_openCenterWindow;
+
+ var desk = document.getElementById(idbody);
+
+ var node;
+
+ node = document.createElement("div");
+ node.id = this.varname+"wb";
+ node.className = "ww_winborder";
+ this.windowBorder = desk.appendChild(node);
// this.windowBorder = document.getElementById("winborder");
-
- node = document.createElement("img");
- node.id = "dragDropCursor";
- node.style.position = "absolute";
- node.style.top = "50px";
- node.style.left = "50px";
- node.style.zIndex = 99;
- node.style.visibility = "hidden";
- node.src = "cursors/nodrop01.gif";
- dragObj.objCursor = desk.appendChild(node);
- desk.onmousemove = function (e) {ww_evt_mmov_doc(varname, (e ? e : window.event));};
- desk.onmousedown = function (e) {
- var evt = e ? e : window.event;
- // ---- prevent selection into ff
- var srcElement = evt.srcElement ? evt.srcElement : evt.target;
- if (typeof evt.preventDefault != 'undefined' && (srcElement.tagName!="INPUT" && srcElement.tagName!="SELECT" && srcElement.tagName!="TEXTAREA"))
- {
- evt.preventDefault();
- }
- // ----
- ww_evt_mdwn_doc(varname, evt);
- };
- desk.onmouseup = function (e) {ww_evt_mup_doc(varname, (e ? e : window.event));};
+ node = document.createElement("img");
+ node.id = "dragDropCursor";
+ node.style.position = "absolute";
+ node.style.top = "50px";
+ node.style.left = "50px";
+ node.style.zIndex = 99;
+ node.style.visibility = "hidden";
+ node.src = "cursors/nodrop01.gif";
+ dragObj.objCursor = desk.appendChild(node);
- if(typeof(document.onselectstart) != "undefined")
- {
- // ie
- document.onselectstart = evt_select_doc;
- }
-
- // on interdit les menus contextuels de explorer
+ desk.onmousemove = function (e) {ww_evt_mmov_doc(varname, (e ? e : window.event));};
+ desk.onmousedown = function (e) {
+ var evt = e ? e : window.event;
+ // ---- prevent selection into ff
+ var srcElement = evt.srcElement ? evt.srcElement : evt.target;
+ if (typeof evt.preventDefault != 'undefined' && (srcElement.tagName!="INPUT" && srcElement.tagName!="SELECT" && srcElement.tagName!="TEXTAREA"))
+ {
+ evt.preventDefault();
+ }
+ // ----
+ ww_evt_mdwn_doc(varname, evt);
+ };
+ desk.onmouseup = function (e) {ww_evt_mup_doc(varname, (e ? e : window.event));};
+
+ if(typeof(document.onselectstart) != "undefined")
+ {
+ // ie
+ document.onselectstart = evt_select_doc;
+ }
+
+ // on interdit les menus contextuels de explorer
// document.oncontextmenu = function (e) { if(e){e.returnValue=false}else{window.event.returnValue=false}; return false; };
- document.oncontextmenu = function (e) {ww_evt_kon_doc(varname, (e ? e : window.event));};
-
+ document.oncontextmenu = function (e) {ww_evt_kon_doc(varname, (e ? e : window.event));};
- this.setClickable = function(id, clickCallback){o=this.document.getElementById(id); o.clickable=1; o.clickCallback=clickCallback; };
- this.setDraggable = function(id, dragCallback){o=this.document.getElementById(id); o.draggable=1; o.dragCallback=dragCallback; };
- this.setDroppable = function(id, dropCallback){o=this.document.getElementById(id); o.droppable=1; o.dropCallback=dropCallback; };
-
- this.activeMenu = null;
- // this.setAsMenu = function(id){o=this.document.getElementById(id); o.ismenu=1; o.gui=this; o.runAsMenu=ww_runAsMenu};
- this.setAsMenu = ww_setAsMenu;
-
- this.selectedObject = null;
- this.select = ww_select;
- this.unselect = ww_unselect;
- this.setDragObj = ww_setDragObj;
-/*
- s = "
";
- s += " ";
- document.write(s);
+ this.setClickable = function(id, clickCallback){o=this.document.getElementById(id); o.clickable=1; o.clickCallback=clickCallback; };
+ this.setDraggable = function(id, dragCallback){o=this.document.getElementById(id); o.draggable=1; o.dragCallback=dragCallback; };
+ this.setDroppable = function(id, dropCallback){o=this.document.getElementById(id); o.droppable=1; o.dropCallback=dropCallback; };
- // on enregistre des handlers sur le document pour le drag & drop
- document.onselectstart = ww_selectStart;
+ this.activeMenu = null;
+ // this.setAsMenu = function(id){o=this.document.getElementById(id); o.ismenu=1; o.gui=this; o.runAsMenu=ww_runAsMenu};
+ this.setAsMenu = ww_setAsMenu;
- var o = document.getElementById("desktop");
- o.onmouseover = evt_movr_doc;
+ this.selectedObject = null;
+ this.select = ww_select;
+ this.unselect = ww_unselect;
- var old = (document.onmousemove) ? document.onmousemove : function () {};
- document.onmousemove = function(e){if(e){old(e, varname); return(evt_mmov_doc(e, varname));}else{old(window.event, varname); return(evt_mmov_doc(window.event, varname));}};
+ this.setDragObj = ww_setDragObj;
+ /*
+ s = "
";
+ s += " ";
+ document.write(s);
- var old = (document.onmousedown) ? document.onmousedown : function () {};
- document.onmousedown = function(e){if(e){old(e, varname); return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); return(evt_mdwn_doc(window.event, varname));}};
+ // on enregistre des handlers sur le document pour le drag & drop
+ document.onselectstart = ww_selectStart;
- var old = (document.ondblclick) ? document.ondblclick : function () {};
- document.ondblclick = function(e){if(e){old(e, varname); return(evt_dblclk_doc(e, varname));}else{old(window.event, varname); return(evt_dblclk_doc(window.event, varname));}};
+ var o = document.getElementById("desktop");
+ o.onmouseover = evt_movr_doc;
- var old = (document.onmouseup) ? document.onmouseup : function () {};
- document.onmouseup = function(e){if(e){old(e, varname); return(evt_mup_doc(e, varname));}else{old(window.event, varname); return(evt_mup_doc(window.event, varname));} };
+ var old = (document.onmousemove) ? document.onmousemove : function () {};
+ document.onmousemove = function(e){if(e){old(e, varname); return(evt_mmov_doc(e, varname));}else{old(window.event, varname); return(evt_mmov_doc(window.event, varname));}};
- // on interdit les menus contextuels de explorer... ?
- // document.oncontextmenu = function () { window.event.returnValue=false; return false; };
- // ... en fait on simule un 'mousedown' pour safari qui ne le fait pas avec les souris 2 bouton
-// var old = (document.oncontextmenu) ? document.oncontextmenu : function () {};
+ var old = (document.onmousedown) ? document.onmousedown : function () {};
+ document.onmousedown = function(e){if(e){old(e, varname); return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); return(evt_mdwn_doc(window.event, varname));}};
-// document.oncontextmenu = function(e){if(e){old(e, varname); window.event.returnValue=false; return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); window.event.returnValue=false; return(evt_mdwn_doc(window.event, varname));}};
+ var old = (document.ondblclick) ? document.ondblclick : function () {};
+ document.ondblclick = function(e){if(e){old(e, varname); return(evt_dblclk_doc(e, varname));}else{old(window.event, varname); return(evt_dblclk_doc(window.event, varname));}};
-// document.oncontextmenu = function(e){if(e){old(e, varname); alert('rz'); return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); alert('xc'); return(evt_mdwn_doc(window.event, varname));}};
-// document.oncontextmenu = function(e){if(e){old(e, varname); return(evt_kon_doc(e, varname));}else{old(window.event, varname); return(evt_kon_doc(window.event, varname));} };
+ var old = (document.onmouseup) ? document.onmouseup : function () {};
+ document.onmouseup = function(e){if(e){old(e, varname); return(evt_mup_doc(e, varname));}else{old(window.event, varname); return(evt_mup_doc(window.event, varname));} };
-// document.onmousedown = w2md;
-// document.onmouseup = w2mu;
+ // on interdit les menus contextuels de explorer... ?
+ // document.oncontextmenu = function () { window.event.returnValue=false; return false; };
+ // ... en fait on simule un 'mousedown' pour safari qui ne le fait pas avec les souris 2 bouton
+ // var old = (document.oncontextmenu) ? document.oncontextmenu : function () {};
- document.oncontextmenu = function(e){if(!e) e=window.event; e.returnValue=false;
- if(e.stopPropagation) e.stopPropagation();
- if(e.preventDefault) e.preventDefault();
- return true;
- };
-*/
+ // document.oncontextmenu = function(e){if(e){old(e, varname); window.event.returnValue=false; return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); window.event.returnValue=false; return(evt_mdwn_doc(window.event, varname));}};
+
+ // document.oncontextmenu = function(e){if(e){old(e, varname); alert('rz'); return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); alert('xc'); return(evt_mdwn_doc(window.event, varname));}};
+ // document.oncontextmenu = function(e){if(e){old(e, varname); return(evt_kon_doc(e, varname));}else{old(window.event, varname); return(evt_kon_doc(window.event, varname));} };
+
+ // document.onmousedown = w2md;
+ // document.onmouseup = w2mu;
+
+ document.oncontextmenu = function(e){if(!e) e=window.event; e.returnValue=false;
+ if(e.stopPropagation) e.stopPropagation();
+ if(e.preventDefault) e.preventDefault();
+ return true;
+ };
+ */
}
function evt_select_doc(evt)
{
- evt = evt ? evt : window.event;
- var srcElement = evt.srcElement ? evt.srcElement : evt.target;
- return(srcElement.tagName=="INPUT" || srcElement.tagName=="TEXTAREA");
+ evt = evt ? evt : window.event;
+ var srcElement = evt.srcElement ? evt.srcElement : evt.target;
+ return(srcElement.tagName=="INPUT" || srcElement.tagName=="TEXTAREA");
}
-
+
function w2md(e)
{
- if(!e)
- e = window.event;
+ if(!e)
+ e = window.event;
// var str=''; for (var k in e) {str+='event.'+k+'='+e[k]+' \n'}
// document.getElementById("debug").innerHTML = "DOWN "+(iiii++)+" \n" + str ;
- document.getElementById("debug").innerHTML += "DOWN " ;
- e.cancelBubble=true;
- e.returnValue=false;
+ document.getElementById("debug").innerHTML += "DOWN " ;
+ e.cancelBubble=true;
+ e.returnValue=false;
// e.stopPropagation();
- return(false);
+ return(false);
}
function w2mu(e)
{
- if(!e)
- e = window.event;
+ if(!e)
+ e = window.event;
// var str=''; for (var k in e) {str+='event.'+k+'='+e[k]+' \n'}
// document.getElementById("debug").innerHTML = "UP "+(iiii++)+" \n" + str ;
- document.getElementById("debug").innerHTML += "UP " ;
- e.cancelBubble=true;
- e.returnValue=false;
+ document.getElementById("debug").innerHTML += "UP " ;
+ e.cancelBubble=true;
+ e.returnValue=false;
// e.stopPropagation();
- return(false);
+ return(false);
}
function w2k(e)
{
- if(!e)
- e = window.event;
+ if(!e)
+ e = window.event;
// var str=''; for (var k in e) {str+='event.'+k+'='+e[k]+' \n'}
// document.getElementById("debug").innerHTML = "KON "+(iiii++)+" \n" + str ;
- document.getElementById("debug").innerHTML += "KON " ;
+ document.getElementById("debug").innerHTML += "KON " ;
// e.cancelBubble=true;
// e.returnValue=false;
// e.stopPropagation();
- return(false);
+ return(false);
}
function ww_selectStart()
{
- return(window.event.srcElement.tagName=="INPUT" || window.event.srcElement.tagName=="TEXTAREA");
+ return(window.event.srcElement.tagName=="INPUT" || window.event.srcElement.tagName=="TEXTAREA");
}
escapeCharString = "*+@-/";
escapeCharCodes = new Array( 42,43,64,45,47 );
function fullEscape(s)
{
- var s2,ret,i,x,c;
- s2 = escape(s);
- ret = "";
- for(i=0; i