158 lines
4.1 KiB
JavaScript
158 lines
4.1 KiB
JavaScript
$(document).ready(function(){
|
|
|
|
$( "#tabs" ).tabs({
|
|
cookie: { expires: 1 },
|
|
});
|
|
|
|
$("li.tooltip").each(function(){
|
|
var title = $('a', this).attr('title');
|
|
var width = $(this).attr('wdth');
|
|
$(this).qtip({
|
|
solo:true,
|
|
content: title,
|
|
style: {
|
|
width: width,
|
|
classes: "ui-tooltip-dark"
|
|
},
|
|
position: {
|
|
my: 'top right',
|
|
at: 'bottom right',
|
|
}
|
|
});
|
|
});
|
|
|
|
$("div.slider-range").slider({
|
|
range: true,
|
|
create: function(event, ui) {
|
|
var max = $("#"+$(this).attr('input')).attr('max');
|
|
var min = $("#"+$(this).attr('input')).attr('min');
|
|
|
|
$(this).slider( "option", "min", min );
|
|
$(this).slider( "option", "max", max );
|
|
},
|
|
values : [0, 10000000000],
|
|
slide: function( event, ui ) {
|
|
var name = $(this).attr('input');
|
|
$( "#"+name ).val( ui.values[ 0 ] + " , " + ui.values[ 1 ] );
|
|
},
|
|
step: 10,
|
|
stop: function( event, ui ) {
|
|
var name = $(this).attr('input');
|
|
set(name, ui.values[ 0 ] + "," + ui.values[ 1 ]);
|
|
},
|
|
});
|
|
|
|
$("input.datepicker").datepicker({ dateFormat: 'dd/mm/yy' } );
|
|
|
|
$( "#accordion" ).accordion({
|
|
autoHeight: false,
|
|
navigation: true,
|
|
icons: {
|
|
header: "ui-icon-circle-arrow-e",
|
|
headerSelected: "ui-icon-circle-arrow-s"
|
|
}
|
|
});
|
|
|
|
$( "#toggle" ).button().toggle(function() {
|
|
$( "#accordion" ).accordion( "option", "icons", false );
|
|
}, function() {
|
|
$( "#accordion" ).accordion( "option", "icons", icons );
|
|
});
|
|
|
|
$( ".column" ).sortable({
|
|
connectWith: ".column"
|
|
});
|
|
|
|
$( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
|
|
.find( ".portlet-header" )
|
|
.addClass( "ui-widget-header ui-corner-all" )
|
|
.prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
|
|
.end()
|
|
.find( ".portlet-content" );
|
|
|
|
$( ".portlet-header .ui-icon" ).click(function() {
|
|
$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
|
|
$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
|
|
});
|
|
|
|
$( ".column" ).disableSelection();
|
|
|
|
$('#tabs').delegate('select.criteres', 'change', function(e){
|
|
var valeur = $(this, ':selected').val();
|
|
e.stopPropagation();
|
|
set($(this).attr('name'), $(this, ':selected').val());
|
|
|
|
});
|
|
|
|
$('#tabs').delegate('input[type=checkbox].criteres', 'click', function(e){
|
|
e.stopPropagation();
|
|
set($(this).attr('name'), $(this).val());
|
|
});
|
|
|
|
$('#tabs').delegate('input[type=radio].criteres', 'click', function(e){
|
|
e.stopPropagation();
|
|
set($(this).attr('name'), $(this).val());
|
|
});
|
|
|
|
$('#tabs').delegate('input[type=text].criteres', 'blur', function(e){
|
|
e.stopPropagation();
|
|
set($(this).attr('name'), $(this).val());
|
|
});
|
|
|
|
$('#tabs').delegate('textarea', 'blur', function(e){
|
|
e.stopPropagation();
|
|
set($(this).attr('name'), $(this).val());
|
|
});
|
|
|
|
$('#tabs').delegate('a.interval', 'click', function(e){
|
|
e.preventDefault();
|
|
var key = $(this).attr('id');
|
|
var values = $('input[name='+key+'1]').val() + ',' + $('input[name='+key+'2]').val();
|
|
set(key, values);
|
|
return false;
|
|
});
|
|
|
|
$('#tabs').delegate('a.arborescence', 'click', function(e) {
|
|
e.preventDefault();
|
|
var title = $(this).attr('title');
|
|
var href = $(this).attr('href');
|
|
var dialogOpts = {
|
|
bgiframe: true,
|
|
title: title,
|
|
width: 800,
|
|
height: 600,
|
|
modal: true,
|
|
open: function(event, ui) {
|
|
$(this).html('Chargement...');
|
|
$(this).load(href);
|
|
},
|
|
buttons: {
|
|
Valider: function() {
|
|
alert('ok');
|
|
alert($('.jstree').get_checked ( null, true));
|
|
},
|
|
Annuler: function() { $(this).dialog('close'); }
|
|
},
|
|
close: function() { $('#dialognaf').remove(); }
|
|
};
|
|
$('<div id="dialognaf"></div>').dialog(dialogOpts);
|
|
return false;
|
|
});
|
|
|
|
});
|
|
|
|
function set(key, value)
|
|
{
|
|
$('#comptage').css('display', 'none');
|
|
$('#attente').css('display', 'block');
|
|
$.post('/comptage', { cle:key, valeur:value}, function(data, status) {
|
|
var html = 'Nombre sélectionnées : <span class="valeur">' +
|
|
data.count + '</span> (dont <span class="valeur">'+
|
|
data.insee +'</span> unité(s) insee)';
|
|
$('#attente').css('display', 'none');
|
|
$('#comptage').html(html).css('display','block');
|
|
}, 'json')
|
|
.error(function(){ alert('error'); });
|
|
}
|
|
|