diff options
Diffstat (limited to 'admin/survey/script/script_analiza.js')
-rw-r--r-- | admin/survey/script/script_analiza.js | 627 |
1 files changed, 228 insertions, 399 deletions
diff --git a/admin/survey/script/script_analiza.js b/admin/survey/script/script_analiza.js index e166278..9cd011c 100644 --- a/admin/survey/script/script_analiza.js +++ b/admin/survey/script/script_analiza.js @@ -1,5 +1,7 @@ function analiza_init () {
+
var srv_site_url = $("#srv_site_url").val();
+
// dodamo klike za odpiranje divov profilov (ker so z linki ble tezave)
$("#link_filter_profile").live("click", function(event) {
if (event.button != 0) { // wasn't the left button - ignore
@@ -9,15 +11,6 @@ function analiza_init () { return false; // "capture" the click
});
-/*
- $("#link_collect_data_setting").live("click", function(event) {
- if (event.button != 0) { // wasn't the left button - ignore
- return true;
- }
- show_collect_data_setting();
- return false; // "capture" the click
- });
-*/
$("#link_status_casi").live("click", function(event) {
if (event.button != 0) { // wasn't the left button - ignore
return true;
@@ -48,13 +41,13 @@ function analiza_init () { });
// brisanje vnosa
- $('#dataTable td .delete_circle').live('click', function(event) {
+ $('#dataTable td .delete').live('click', function(event) {
// polovimo user id
var usr_id = $(this).parent().parent().find('.data_uid').html();
var row = $(this).parent().parent();
- var note = 'srv_ask_delete';
+ var note = 'srv_ask_delete_data';
// Preverimo ce je med njimi tudi kaksno vabilo - dodatno opozorilo
if($(this).parent().parent().find('.invitation_cell').length == 1){
@@ -70,20 +63,36 @@ function analiza_init () { if (response == '0') {
row.hide();
} else {
- alert(response);
+ genericAlertPopup('alert_parameter_response',response);
}
});
} else {
- alert("Napaka pri brisanju!");
+ genericAlertPopup('alert_delete_error');
}
}
});
});
+ // klik na checkbox za oznacevanje za brisanje
+ $('#dataTable td .delete_data_row').live('click', function(event) {
+
+ // Preverimo ce je kaksen checkbox oznacen - prikazemo gumb za mass delete
+ if($(this).is(':checked')){
+ $("#switch_on").hide();
+ $("#switch_off").show();
+ $("#mass_delete_button").show();
+ }
+ // Skrijemo gumb za mass delete
+ else if($('#dataTable td .delete_data_row:checked').length == 0){
+ $("#switch_on").show();
+ $("#switch_off").hide();
+ $("#mass_delete_button").hide();
+ }
+ });
// editiranje starega vnosa
$('#dataTable td .edit_square').live('click', function(event) {
// polovimo user id
var uid = $(this).parent().parent().find('.data_uid').html();
- var href = srv_site_url+'main/survey/edit_anketa.php?anketa='+srv_meta_anketa_id+'&usr_id='+uid+'';
+ var href = srv_site_url+'main/survey/edit_anketa.php?anketa='+srv_meta_anketa_hash+'&usr_id='+uid+'';
if (uid > 0 ){
window.open(href, '_blank');
}
@@ -211,15 +220,7 @@ function analiza_init () { $("#span_color_residual_legend2").toggle();
});
- /*
- $(document).ready(function() {
- $('#dataTable tbody tr:odd').addClass('odd');
-
- $('#dataTable tbody tr:even').addClass('even');
-
- });
- */
// inspect za frekvence
$("td.fr_inspect").live("click", function(event) {
doInspectFromFrequency(this,event);
@@ -249,36 +250,36 @@ function analiza_init () { $('.div_analiza_holder').live({
mouseenter: function(){
$(this).find('.div_analiza_icons').stop().animate({opacity:1}, 600);
- $(this).find('.div_analiza_scale').stop().animate({opacity:1}, 600);
+ //$(this).find('.div_analiza_scale').stop().animate({opacity:1}, 600);
},
mouseleave: function(){
$(this).find('.div_analiza_icons').stop().animate({opacity:0}, 600);
- $(this).find('.div_analiza_scale').stop().animate({opacity:0}, 600);
+ //$(this).find('.div_analiza_scale').stop().animate({opacity:0}, 600);
}
});
+
// prikazovanje gumbov za hitro skrolanje levo desno v podatkih
- $('#tableContainer').live(
- {
- mouseenter: function()
- {
- var windowWidth = $(window).width(); //retrieve current window width
- var dtWidth = $('#dataTable').outerWidth();
- if ( (dtWidth - windowWidth) > 0)
- {
- $(this).find('#dataTableScroller').stop().animate({opacity:1}, 600);
- }
- },
- mouseleave: function()
- {
- var windowWidth = $(window).width(); //retrieve current window width
- var dtWidth = $('#dataTable').outerWidth();
- if ( (dtWidth - windowWidth) > 0)
- {
- $(this).find('#dataTableScroller').stop().animate({opacity:0}, 600);
- }
- }
- });
+ // Sirina in visina okna
+ var windowWidth = $(window).width();
+ var windowHeight = $(window).height();
+
+ // Sirina in visina tabele
+ var tableWidth = $('#dataTable').width();
+ var tableHeight = $('#dataTable').height();
+
+ // Puscice za scroll prikazemo samo ce je tabela prevelika
+ if(tableWidth > windowWidth && tableHeight > 0.8*windowHeight){
+
+ $('#tableContainer').live({
+ mouseenter: function(){
+ $(this).find('#dataTableScroller').stop().animate({opacity:1}, 600);
+ },
+ mouseleave: function(){
+ $(this).find('#dataTableScroller').stop().animate({opacity:0}, 600);
+ }
+ });
+ }
};
/**
@@ -286,19 +287,21 @@ function analiza_init () { */
function statusCasiAction(action) {
- $("#loading").show();
+
if (action == 'change') {
pid = $("#vnosi_current_status_casi").val();
$.post('ajax.php?a=vnosi_change_status_casi', {anketa: srv_meta_anketa_id, pid:pid}, function() {
return reloadData();
});
- } else if (action == 'run') {
- $("#loading").show();
+ }
+ else if (action == 'run') {
+
pid = $("#status_casi .active").attr('value');
// polovimo statuse
var statusCnt = 0;
var srv_userstatus = "";
prefix="";
+
$("input[name^=srv_userstatus]:checked").each(function() {
srv_userstatus = srv_userstatus + prefix + $(this).attr('id');
prefix = ",";
@@ -311,12 +314,13 @@ function statusCasiAction(action) { // osvezimo vnose
return reloadData();
});
+
// skrijemo vse dive
$("#div_status_values").hide(200);
- //$('#fade').fadeOut('slow');
$("#div_status_values").html('');
- } else if (action == 'run_rezanje') {
- $("#loading").show();
+ }
+ else if (action == 'run_rezanje') {
+
var rezanje = $("input[name=rezanje]:checked").val();
var rezanje_meja_sp = $("select[name=rezanje_meja_sp]").val();
var rezanje_meja_zg = $("select[name=rezanje_meja_zg]").val();
@@ -333,16 +337,19 @@ function statusCasiAction(action) { $("#div_status_values").hide(200);
//$('#fade').fadeOut('slow');
$("#div_status_values").html('');
- } else if (action == 'cancle') {
- $('#loading').hide();
+ }
+ else if (action == 'cancle') {
+
$("#div_status_values").hide(200);
$('#fade').fadeOut('slow');
$("#div_status_values").html('');
- } else if (action == 'newName') { // dodelimo novo ime profilu
+ }
+ else if (action == 'newName') { // dodelimo novo ime profilu
$("#statusCasiCoverDiv").show();
$("#newProfile").show();
- } else if (action == 'newSave') { // shranimo kot nov profil in pozenemo
- $("#loading").show();
+ }
+ else if (action == 'newSave') { // shranimo kot nov profil in pozenemo
+
pid = $("#status_casi .active").attr('value');
name = $("#newProfileName").val();
$("#newProfile").hide();
@@ -366,15 +373,18 @@ function statusCasiAction(action) { $("#div_status_values").hide(200);
$('#fade').fadeOut('slow');
$("#div_status_values").html('');
- } else if (action == 'deleteAsk') { // vprašamo po potrditvi
+ }
+ else if (action == 'deleteAsk') { // vprašamo po potrditvi
$("#statusProfileCoverDiv").show();
$("#deleteProfileDiv").show();
- } else if (action == 'deleteCancle') { // prekicemo brisanje
+ }
+ else if (action == 'deleteCancle') { // prekicemo brisanje
$("#deleteProfileDiv").hide();
$("#statusProfileCoverDiv").fadeOut();
- } else if (action == 'deleteConfirm') { // izbrisemo profil
- $("#loading").show();
+ }
+ else if (action == 'deleteConfirm') { // izbrisemo profil
+
pid = $("#status_casi .active").attr('value');
$.post('ajax.php?a=vnosi_delete_status_casi', {anketa: srv_meta_anketa_id, pid:pid}, function() {
// dropdownu izberemo profil
@@ -382,6 +392,7 @@ function statusCasiAction(action) { // osvezimo vnose
return reloadData();
});
+
$("#deleteProfileDiv").hide();
$("#statusProfileCoverDiv").fadeOut();
$("#div_status_values").hide(200);
@@ -423,7 +434,7 @@ function vnosi_show_rezanje_casi() var left = width - (msg.width() )-42;
var top = height/2 - (msg.height() / 2);
// pozicioniramo na center strani
- $("#div_status_values").show(200).draggable({delay:100, cancel: 'input, .buttonwrapper, select'});
+ $("#div_status_values").show(200);
}
// prikaže skrit div za nastavitev manjkajočih vrednosti
@@ -478,39 +489,22 @@ function showspremenljivkaSingleVarPopup(id) { });
}
-function showSpremenljivkaTextAnswersPopup(id,seq) {
- var size = "location=0,height=500,width=700,scrollbars=1,fullscreen=0,menubar=0,status=0,titlebar=0,toolbar=0,channelmode=0,directories=0";
- var recipe = window.open('','RecipeWindow',size);
-
- $.post('ajax.php?t=analysis&a=showSpremenljivkaTextAnswersPopup&setSkipCreate=1', {anketa: srv_meta_anketa_id, id:id,seq:seq}, function(response) {
- recipe.document.open();
- recipe.document.write(response);
- recipe.document.close();
- recipe.focus();
- return false;
- });
+function showSpremenljivkaTextAnswersPopup(id) {
+ $('#fade').fadeTo('slow', 1);
+ $('#analysis_popup').html('').fadeIn('slow');
+ $('#analysis_popup').load('ajax.php?t=analysis&a=showSpremenljivkaTextAnswersPopup&setSkipCreate=1', {anketa: srv_meta_anketa_id, id:id});
}
-function showAnalizaSingleVarPopup(id,zaPodstran,navedbe,loop) {
- var size = "location=0,height=500,width=700,scrollbars=1,fullscreen=0,menubar=0,status=0,titlebar=0,toolbar=0,channelmode=0,directories=0";
- var recipe = window.open('','RecipeWindow',size);
-
- $.post('ajax.php?t=analysis&a=showAnalizaSingleVarPopup&setSkipCreate=1', {anketa: srv_meta_anketa_id, podstran: zaPodstran, zaPodstran:zaPodstran, id:id,navedbe:navedbe,loop:loop}, function(response) {
- recipe.document.open();
- recipe.document.write(response);
- recipe.document.close();
- recipe.focus();
- return false;
- });
- /*
- $("#fullscreen").load('ajax.php?t=analysis&a=showAnalizaSingleVar', {anketa: srv_meta_anketa_id, podstran: zaPodstran, zaPodstran:zaPodstran, id:id}, function() {
- $('#fullscreen').show();
- $('#fade').fadeTo('slow', 1);
- }).draggable({handle: '#div_analiza_single_var_close, #div_analiza_single_var' });
- */
+function showAnalizaSingleVarPopup(id, zaPodstran, navedbe, loop, _this) {
+
+ var title = encodeURIComponent($(_this).html());
+
+ $('#fade').fadeTo('slow', 1);
+ $('#analysis_popup').html('').fadeIn('slow');
+ $('#analysis_popup').load('ajax.php?t=analysis&a=showAnalizaSingleVarPopup&setSkipCreate=1', {anketa:srv_meta_anketa_id, podstran:zaPodstran, zaPodstran:zaPodstran, id:id, navedbe:navedbe, loop:loop, title:title});
}
-function showAnalizaSingleChartPopup(id,zaPodstran) {
+function showAnalizaSingleChartPopup(id, zaPodstran) {
var size = "location=0,height=550,width=830,scrollbars=1,fullscreen=0,menubar=0,status=0,titlebar=0,toolbar=0,channelmode=0,directories=0";
var recipe = window.open('','RecipeWindow',size);
@@ -543,7 +537,7 @@ function hideAnalizaSingleVarPopup() { }
function show_single_missing(id, what) {
- //
+
if (what == 0) {
$('tr[name=missing_detail_'+id+']').each(function() {$(this).removeClass('displayNone');});
$("#single_missing_0"+id).hide();
@@ -553,7 +547,8 @@ function show_single_missing(id, what) { $("#single_missing_percent_"+id).hide();
$("#single_missing_title_"+id).hide();
- } else {
+ }
+ else {
$('tr[name=missing_detail_'+id+']').each(function() {$(this).addClass('displayNone');});
$("#single_missing_0"+id).show();
$("#single_missing_1"+id).hide();
@@ -561,7 +556,6 @@ function show_single_missing(id, what) { $("#single_missing_suma_freq_"+id).hide();
$("#single_missing_percent_"+id).show();
$("#single_missing_title_"+id).show();
-
}
}
@@ -687,27 +681,6 @@ function renameFilterProfile() { });
}
-/*function showHideRenameFilterProfile(showhide) {
- if (showhide=='true') {
- //$("#filterProfileCoverDiv").show();
- $("#renameFilterProfileDiv").show();
- }
- else {
- //$("#filterProfileCoverDiv").hide();
- $("#renameFilterProfileDiv").hide();
- }
-}
-function showHideDeleteFilterProfile(showhide) {
- if (showhide=='true') {
- //$("#filterProfileCoverDiv").show();
- $("#deleteFilterProfileDiv").show();
- }
- else {
- //$("#filterProfileCoverDiv").hide();
- $("#deleteFilterProfileDiv").hide();
- }
-}*/
-
function toggle_click_missing(what) {
var variabla = $(what).attr('id').substr(14); // odrezemo prvih 14 znakov : click_missing_
@@ -718,85 +691,85 @@ function toggle_click_missing(what) { }
if (state == 0) {
- // odstranimo spodnjo polno črto, ostane rdeca crtkana
- $("#anl_click_missing_tr_"+variabla).removeClass('anl_bb');
- $("#anl_click_missing_tr_"+variabla).addClass('anl_dash_red_bb');
- // nič od missingov še ni vidno. prikažemo osnovne missinge in skupo sumo
- $("#click_missing_1_"+variabla).show();
- $("#click_missing_suma_"+variabla).show();
- $(what).attr('value',1);
- // skrijemo osnovni link za vklop manjkajocih (manjkajoci)
- $("#click_missing_"+variabla).hide();
- $("#single_missing_title_"+variabla).show();
- } else if (state == 1 || state == 2 || state == ""){
- // dodamo spodnjo polno črto, skrijemo rdeco crtkana
- $("#anl_click_missing_tr_"+variabla).addClass('anl_bb');
- $("#anl_click_missing_tr_"+variabla).removeClass('anl_dash_red_bb');
- // nič od missingov še ni vidno. prikažemo osnovne missinge in skupo sumo
- $("#click_missing_1_"+variabla).hide();
- $("#click_missing_suma_"+variabla).hide();
- $(what).attr('value',0);
- $("#click_missing_"+variabla).show();
- $("#single_missing_title_"+variabla).hide();
+
+ // Odpremo missinge in skupno sumo
+ $('tr[name=missing_detail_'+variabla+']').each(function() {
+ $(this).removeClass('displayNone');
+ });
+
+ $(what).attr('value', 1);
+
+ // Zamenjamo puscico
+ $(what).find('.arrow2_d').removeClass('arrow2_d').addClass('arrow2_u');
+ }
+ else if (state == 1 || state == 2 || state == ""){
+
+ // Zapremo missinge
+ $('tr[name=missing_detail_'+variabla+']').each(function() {
+ $(this).addClass('displayNone');
+ });
+
+ $(what).attr('value', 0);
+
+ // Zamenjamo puscico
+ $(what).find('.arrow2_u').removeClass('arrow2_u').addClass('arrow2_d');
}
}
-function show_single_percent(id,status) {
+function show_single_percent(id, status) {
- if (status == 0) {
- // pokazemo frekvence in skrijemo procente
- $('[name=single_sums_percent_'+id+']').each(function() {$(this).hide();});
- $('[name=single_sums_percent_cnt_'+id+']').each(function() {$(this).show();});
- $('[name=single_sums_percent_cnt_'+id+']').removeClass('anl_dash_bb');
+ // Vklop/izklop frekvenc
+ if (status == 1) {
- // popravimo css link-e
- $("#img_analysis_f_p_1_"+id+", #img_analysis_f_p_2_"+id).addClass("displayNone");
- $("#img_analysis_f_1_"+id+", #img_analysis_f_2_"+id).removeClass("displayNone");
- $("#img_analysis_p_1_"+id+", #img_analysis_p_2_"+id).addClass("displayNone");
-
- } else if (status == 1) {
- // pokazemo oboje
- $('[name=single_sums_percent_cnt_'+id+']').addClass('anl_dash_bb');
- $('[name=single_sums_percent_'+id+']').each(function() {$(this).show();});
- $('[name=single_sums_percent_cnt_'+id+']').each(function() {$(this).show();});
-
- // popravimo css link-e
- $("#img_analysis_f_p_1_"+id+", #img_analysis_f_p_2_"+id).removeClass("displayNone");
- $("#img_analysis_f_1_"+id+", #img_analysis_f_2_"+id).addClass("displayNone");
- $("#img_analysis_p_1_"+id+", #img_analysis_p_2_"+id).addClass("displayNone");
-
- // skrijemo še vrednosti v vrstici z procenti
- $("#span_do_hide_1"+id).hide();
- $("#span_do_hide_2"+id).hide();
- $("#span_do_hide_3"+id).hide();
- $("#span_do_hide_4"+id).hide();
- $("#span_do_hide_5"+id).hide();
-
- } else {
- $('[name=single_sums_percent_cnt_'+id+']').removeClass('anl_dash_bb');
- // pokazemo procente skrijemo frekvence
- $('[name=single_sums_percent_'+id+']').each(function() {$(this).show();});
- $('[name=single_sums_percent_cnt_'+id+']').each(function() {$(this).hide();});
-
- // popravimo css link-e
- $("#img_analysis_f_p_1_"+id+", #img_analysis_f_p_2_"+id).addClass("displayNone");
- $("#img_analysis_f_1_"+id+", #img_analysis_f_2_"+id).addClass("displayNone");
- $("#img_analysis_p_1_"+id+", #img_analysis_p_2_"+id).removeClass("displayNone");
-
- // skrijemo še vrednosti v vrstici z procenti
- $("#span_do_hide_1"+id).show();
- $("#span_do_hide_2"+id).show();
- $("#span_do_hide_3"+id).show();
- $("#span_do_hide_4"+id).show();
- $("#span_do_hide_5"+id).show();
+ // Ugasnemo - samo ce je drug vklopljen
+ if($('#freq-p_button_1_'+id).hasClass('active')){
- }
+ if($('#freq-p_button_2_'+id).hasClass('active')){
+ $('[name=single_sums_percent_cnt_'+id+']').each(function() {
+ $(this).hide().parent().parent().removeClass('freq_row');
+ });
+
+ $('#freq-p_button_1_'+id).removeClass('active');
+ }
+ }
+ // Prizgemo
+ else{
+ $('[name=single_sums_percent_cnt_'+id+']').each(function() {
+ $(this).show().parent().parent().addClass('freq_row');
+ });
+
+ $('#freq-p_button_1_'+id).addClass('active');
+ }
+ }
+ // Vklop/izklop procentov
+ else if (status == 2) {
+
+ // Ugasnemo - samo ce je drug vklopljen
+ if($('#freq-p_button_2_'+id).hasClass('active')){
+
+ if($('#freq-p_button_1_'+id).hasClass('active')){
+ $('[name=single_sums_percent_'+id+']').each(function() {
+ $(this).hide().parent().parent().removeClass('percent_row');
+ });
+
+ $('#freq-p_button_2_'+id).removeClass('active');
+ }
+ }
+ // Prizgemo
+ else{
+ $('[name=single_sums_percent_'+id+']').each(function() {
+ $(this).show().parent().parent().addClass('percent_row');
+ });
+
+ $('#freq-p_button_2_'+id).addClass('active');
+ }
+ }
}
function printAnaliza(ime)
{
if(ime == 'Crosstab')
- var divToPrint=document.getElementById('crosstab_table');
+ var divToPrint=document.getElementById('crosstab_tables');
else if(ime == 'MultiCrosstab')
var divToPrint=document.getElementById('mc_holder');
else if(ime == 'Means')
@@ -857,10 +830,11 @@ function scrollToProfile(_target) { }
function cancleArchiveAnaliza() {
- $('#fullscreen').hide();
+ $('#fullscreen').hide().removeClass('PopUpNarrow').removeClass('divPopUp');
$('#fade').fadeOut('slow');
}
function doArchiveAnaliza() {
+ $("#fullscreen").addClass('PopUpNarrow').addClass('divPopUp');
$("#fullscreen").load('ajax.php?a=doArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran}, function() {
$('#fade').fadeTo('slow', 1);
@@ -885,7 +859,7 @@ function submitArchiveAnaliza() { }
function closeArchiveAnaliza() {
- $('#fullscreen').hide();
+ $('#fullscreen').hide().removeClass('PopUpNarrow').removeClass('divPopUp');
$('#fade').fadeOut('slow');
}
@@ -935,7 +909,7 @@ function saveArchiveAnaliza(aid) { });
} else {
- alert('Napaka!');
+ genericAlertPopup('error');
$('#fullscreen').hide();
$('#fade').fadeOut('slow');
@@ -951,7 +925,7 @@ function saveArchiveAnaliza(aid) { function toggleAnalysisArchiveAccessPassword() {
var value = $("input[name=newAnalysisArchiveAccess]:checked").val();
var pass_div = document.getElementById("newAnalysisArchiveAccessPasswordDiv");
- value == 2 ? pass_div.style.visibility='visible' : pass_div.style.visibility='hidden';
+ value == 2 ? pass_div.style.display='block' : pass_div.style.display='none';
}
function AnalysisArchiveDelete(aid) {
@@ -968,7 +942,7 @@ function doDeleteArchiveAnaliza(aid) { $('#fade').fadeOut('slow');
});
} else {
- alert('Napaka!');
+ genericAlertPopup('error');
$('#fullscreen').hide();
$('#fade').fadeOut('slow');
}
@@ -984,15 +958,15 @@ function createArchiveBeforeEmail() { if (parseInt(response) > 0) {
var aid = parseInt(response);
$("#fullscreen").load('ajax.php?a=emailArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, aid:aid}, function() {
- $('#fullscreen').show();
+ $('#fullscreen').addClass("divPopUp").show();
});
} else {
if (parseInt(response) == -1) {
- alert("Nothing to archive!"+response);
+ genericAlertPopup('alert_no_archive_response',response);
} else {
- alert("Error while creating archive!"+response);
+ genericAlertPopup('alert_archive_error_response',response);
}
- $('#fullscreen').hide();
+ $('#fullscreen').removeClass("PopUpNarrow divPopUp").hide();
$('#fade').fadeOut('slow');
}
});
@@ -1003,173 +977,45 @@ function showHidenTextRow($sequence) { }
-function showHidenTextTable(spid,num_records,loop_id) {
+function showHidenTextTable(spid, num_records, loop_id) {
+
+ var srv_site_url = $("#srv_site_url").val();
+
if ($("#srv_meta_podstran").length == 0 ) {
var podstran = srv_meta_podstran;
- } else {
+ }
+ else {
var podstran = $("#srv_meta_podstran").val();
}
+
if ($("#srv_meta_anketa_id").length == 0 ) {
var srv_meta_anketa_id = srv_meta_anketa_id;
- } else {
+ }
+ else {
var srv_meta_anketa_id = $("#srv_meta_anketa_id").val();
}
if (podstran == 'frequency') {
- $('#freq_'+spid+'[loop="'+loop_id+'"]').load('ajax.php?t=analysis&a=show_spid_more_table', {anketa:srv_meta_anketa_id, podstran: podstran, spid:spid, num_records:num_records, loop_id:loop_id});
- } else if (podstran == 'sumarnik') {
- $('#sum_'+spid+'[loop="'+loop_id+'"]').load('ajax.php?t=analysis&a=show_spid_more_table', {anketa:srv_meta_anketa_id, podstran: podstran, spid:spid, num_records:num_records, loop_id:loop_id});
- } else if (podstran == 'charts') {
- $('#chart_'+spid+'_loop_'+loop_id).load('ajax.php?t=charts&a=show_spid_more_table', {anketa:srv_meta_anketa_id, spid:spid, num_records:num_records, loop:loop_id});
- }
-}
-/*
-var intervalPB='';
-var hasStarted=false;
-
-function createCollectData(auto) {
- var _automatic = '&automatic=false';
- if (arguments.length > 0 ) {
- if (auto == true) {
- _automatic = '';
- }
+ $('#freq_'+spid+'[loop="'+loop_id+'"]').load(srv_site_url+'/admin/survey/ajax.php?t=analysis&a=show_spid_more_table', {anketa:srv_meta_anketa_id, podstran: podstran, spid:spid, num_records:num_records, loop_id:loop_id});
+ }
+ else if (podstran == 'sumarnik') {
+ $('#sum_'+spid+'[loop="'+loop_id+'"]').load(srv_site_url+'/admin/survey/ajax.php?t=analysis&a=show_spid_more_table', {anketa:srv_meta_anketa_id, podstran: podstran, spid:spid, num_records:num_records, loop_id:loop_id});
+ }
+ else if (podstran == 'charts') {
+ $('#chart_'+spid+'_loop_'+loop_id).load(srv_site_url+'/admin/survey/ajax.php?t=charts&a=show_spid_more_table', {anketa:srv_meta_anketa_id, spid:spid, num_records:num_records, loop:loop_id});
}
-
- if (hasStarted == false) {
- // skrijemo tekst z file statusom
- $('#vnosi_file_status').hide();
-
- // nalozimo div za izris poteka
- $('#fade').fadeTo('slow', 1);
- $('#fullscreen').show();
-
- $("#fullscreen").load('prepareDataCrontab.php?action=LoadProgresBar', {anketa: srv_meta_anketa_id}, function () {
- $('#pbAllPercent div').css('width','0%');
- $('#pbCurrPercent div').css('width','0%');
- $('#pbRowPercent div').css('width','0%');
-
- $('#pbAllPercent').css('visibility','visible');
- $('#pbCurrPercent').css('visibility','visible');
- $('#hpbRowPercent, #pbRowPercent').css('visibility','visible');
-
- $.ajax({
- cache: false,
- type: 'post',
- url: 'prepareDataCrontab.php?action=collectSingle'+_automatic+'&anketa='+srv_meta_anketa_id,
- beforeSend: start_display_progressBar()
- });
- });
- }
-}
-
-var pbLabels= new Array()
-pbLabels['1'] = lang['srv_collectdata_progress_status1'];
-pbLabels['2'] = lang['srv_collectdata_progress_status2'];
-pbLabels['3'] = lang['srv_collectdata_progress_status3'];
-pbLabels['8'] = lang['srv_collectdata_progress_status8'];
-pbLabels['9'] = lang['srv_collectdata_progress_status9']
-pbLabels['-1'] = lang['srv_collectdata_progress_status0']
-
-function start_display_progressBar(type) {
- if (type == undefined) type = 'true';
- if (intervalPB=="") {
- $('#start').css('visibility','hidden');
- intervalPB=window.setInterval("display_progressBar('"+type+"')",750); // interval = 400 ms
- $('#loader').css('display','inline');
- } else {
- stop_display_progressBar();
- }
}
-function stop_display_progressBar() {
- $("#loading").show();
- if (intervalPB!="") {
- $('#start').css('visibility','visible');
- window.clearInterval(intervalPB);
- intervalPB="";
+function show_navedbe(spid, status) {
-// $('#fade').fadeOut('slow');
- $('#fullscreen').hide();
- $('#fullscreen').html('');
-
- hasStarted = true;
- return reloadData();
- }
-}
-function display_progressBar(type) {
- if (type == undefined) type = 'true';
- $.ajax({
- cache: false,
- type: 'get',
- url: 'getCollectTimer.php?ajaxTimer='+type,
- success: function(response) {
- var data = jQuery.parseJSON(response);
-
- $('#actionLabel').html(pbLabels[data.id]+' ('+data.t+')');
- $('#pbAllPercent div').css('width',data.pa+'%');
- if ( data.id == '2') {
- // na koliko % smo v header datoteki
- $('#pbCurrPercent div').css('width',data.ph+'%');
- $('#pbCurrPercentLabel').html(data.ph+'%');
- // na katerem zapisu smo
- $('#pbRowPercent div').css('width',data.pr+'%');
- $('#pbRowPercentLabel').html(data.nr);
-
- }
- if ( data.id == '3') {
-// $('#hpbRowPercent, #pbRowPercent').css('visibility','visible');
- // na koliko % smo v data datoteki
- $('#pbCurrPercent div').css('width',data.pd+'%');
- $('#pbCurrPercentLabel').html(data.pd+'%');
- // na katerem zapisu smo
- $('#pbRowPercent div').css('width',data.pr+'%');
- $('#pbRowPercentLabel').html(data.nr);
- }
-
- if ( data.id == '9' || data.id == '-1' ) { // 9 = konec
- hasStarted = true;
- // konec prenosa
- $('#pbCurrPercent div').css('width','100%');
- $('#pbRowPercent div').css('width','100%');
- $('#pbCurrPercentLabel').html('100%');
- $('#pbRowPercentLabel').html('100%');
- stop_display_progressBar();
- }
- }
- });
-}
-*/
-function show_navedbe(spid,status) {
- if (status == 1) {
- // vidno je oboje
- // pokažemo pravilne linke
-// $("[name=span_show_navedbe_1_"+spid+"]").each(function() {$(this).addClass('displayNone'); });
- $("[name=span_show_navedbe_2_"+spid+"]").each(function() {$(this).removeClass('displayNone'); });
- $("[name=span_show_navedbe_3_"+spid+"]").each(function() {$(this).addClass('displayNone'); });
- $("#div_navedbe_1_"+spid).removeClass('displayNone');
- $("#div_navedbe_2_"+spid).addClass('displayNone');
-
- } else if (status == 2) {
- // pokažemo samo navedbe
- // pokažemo pravilne linke
-// $("[name=span_show_navedbe_1_"+spid+"]").each(function() {$(this).removeClass('displayNone'); });
- $("[name=span_show_navedbe_2_"+spid+"]").each(function() {$(this).addClass('displayNone'); });
- $("[name=span_show_navedbe_3_"+spid+"]").each(function() {$(this).removeClass('displayNone'); });
- $("#div_navedbe_1_"+spid).addClass('displayNone');
- $("#div_navedbe_2_"+spid).removeClass('displayNone');
- /*
- } else {
-
- // pokažemo samo odgovore
-
- // pokažemo pravilne linke
- $("[name=span_show_navedbe_1_"+spid+"]").each(function() {$(this).addClass('displayNone'); });
- $("[name=span_show_navedbe_2_"+spid+"]").each(function() {$(this).removeClass('displayNone'); });
- $("[name=span_show_navedbe_3_"+spid+"]").each(function() {$(this).addClass('displayNone'); });
- $("#div_navedbe_1_"+spid).removeClass('displayNone');
- $("#div_navedbe_2_"+spid).addClass('displayNone');
-*/
- }
+ if (status == 1) {
+ $("#div_navedbe_1_"+spid).removeClass('displayNone');
+ $("#div_navedbe_2_"+spid).addClass('displayNone');
+ }
+ else if (status == 2) {
+ $("#div_navedbe_1_"+spid).addClass('displayNone');
+ $("#div_navedbe_2_"+spid).removeClass('displayNone');
+ }
}
// Pobrisemo vec vnosov hkrati
@@ -1177,7 +1023,7 @@ function deleteMultipleData(){ var userArray = new Array;
- var note = 'srv_ask_delete';
+ var note = 'srv_ask_delete_multiple_data';
// Napolnimo array z checkanimi userji
$('#div_vnosi_data input:checked').each(function() {
@@ -1205,7 +1051,7 @@ function deleteMultipleData(){ });
} else {
- alert(lang["srv_data_delete_not_selected"]);
+ genericAlertPopup('srv_data_delete_not_selected');
}
}
@@ -1215,11 +1061,13 @@ function selectAll(val){ $(".delete_data_row").attr("checked", "true");
$("#switch_on").hide();
$("#switch_off").show();
+ $("#mass_delete_button").show();
}
else{
$('.delete_data_row').removeAttr('checked');
$("#switch_off").hide();
$("#switch_on").show();
+ $("#mass_delete_button").hide();
}
}
@@ -1238,11 +1086,11 @@ function quickEditAction(action, usr_id){ var href = srv_site_url+'admin/survey/index.php?anketa='+srv_meta_anketa_id+'&a=data&m=quick_edit';
window.location = href;
} else {
- alert(response);
+ genericAlertPopup('alert_parameter_response',response);
}
});
} else {
- alert("Napaka pri brisanju!");
+ genericAlertPopup('alert_delete_error');
}
}
});
@@ -1250,7 +1098,7 @@ function quickEditAction(action, usr_id){ // editiranje starega vnosa
if(action == 'edit'){
- var href = srv_site_url+'main/survey/edit_anketa.php?anketa='+srv_meta_anketa_id+'&usr_id='+usr_id+'';
+ var href = srv_site_url+'main/survey/edit_anketa.php?anketa='+srv_meta_anketa_hash+'&usr_id='+usr_id+'';
if (usr_id > 0 ){
window.open(href, '_blank');
}
@@ -1305,7 +1153,7 @@ function quickEditAction(action, usr_id){ window.location = href;
});
} else {
- alert("Napaka pri kopiranju!");
+ genericAlertPopup('alert_copy_error');
}
}
});
@@ -1419,7 +1267,7 @@ function doArchiveChart() { $('#fullscreen').show();
});
} else {
- alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.');
+ genericAlertPopup('alert_no_archive_tables');
}
}
function submitArchiveChart() {
@@ -1438,7 +1286,7 @@ function submitArchiveChart() { $("#fullscreen").show();
});
} else {
- alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.');
+ genericAlertPopup('alert_no_archive_tables');
}
}
@@ -1456,9 +1304,9 @@ function createArchiveChartBeforeEmail() { });
} else {
if (parseInt(response) == -1) {
- alert("Nothing to archive!"+response);
+ genericAlertPopup('alert_no_archive_response',response);
} else {
- alert("Error while creating archive!"+response);
+ genericAlertPopup('alert_archive_error_response',response);
}
$('#fullscreen').hide();
$('#fade').fadeOut('slow');
@@ -1466,7 +1314,7 @@ function createArchiveChartBeforeEmail() { });
} else {
- alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.');
+ genericAlertPopup('alert_no_archive_tables');
}
};
@@ -1501,23 +1349,6 @@ function printCurrentAnalysis(spid) { pri.print();
}
-/*
- * $.fn.center = function() {
- this.css({
- 'position': 'fixed',
- 'left': '50%',
- 'top': '50%'
- });
- this.css({
- 'margin-left': -this.width() / 2 + 'px',
- 'margin-top': -this.height() / 2 + 'px'
- });
-
- return this;
- }
-
-
- */
$.fn.followTo = function ( pos ) {
var $this = this,
@@ -1541,37 +1372,35 @@ $.fn.followTo = function ( pos ) { };
+// Horizontalen scroll tabele s podatki pri kliku na puscice
+function dataTableScroll(where){
+ var scroll_width = $(window).width() / 4 * 3;
-/**
- * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
- * Dual licensed under MIT and GPL.
- * @author Ariel Flesler
- * @version 1.4.3.1
- */
-//(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
-
-
-/**
- * Copyright (c) 2007-2014 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
- * Licensed under MIT
- * @author Ariel Flesler
- * @version 1.4.14
- */
-//(function(k){'use strict';k(['jquery'],function($){var j=$.scrollTo=function(a,b,c){return $(window).scrollTo(a,b,c)};j.defaults={axis:'xy',duration:0,limit:!0};j.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(f,g,h){if(typeof g=='object'){h=g;g=0}if(typeof h=='function')h={onAfter:h};if(f=='max')f=9e9;h=$.extend({},j.defaults,h);g=g||h.duration;h.queue=h.queue&&h.axis.length>1;if(h.queue)g/=2;h.offset=both(h.offset);h.over=both(h.over);return this._scrollable().each(function(){if(f==null)return;var d=this,$elem=$(d),targ=f,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=win?$(targ):$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}var e=$.isFunction(h.offset)&&h.offset(d,targ)||h.offset;$.each(h.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=j.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(h.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=e[pos]||0;if(h.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*h.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(h.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&h.queue){if(old!=attr[key])animate(h.onAfterFirst);delete attr[key]}});animate(h.onAfter);function animate(a){$elem.animate(attr,g,h.easing,a&&function(){a.call(this,targ,h)})}}).end()};j.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}return j})}(typeof define==='function'&&define.amd?define:function(a,b){if(typeof module!=='undefined'&&module.exports){module.exports=b(require('jquery'))}else{b(jQuery)}}));
-
-function dataTableScroll(where)
-{
if (where == 'left'){
- //$(window).scrollTo('-=500px', 300, { axis:'x' });
-
- var leftPos = $('html').scrollLeft();
- $("html").animate({scrollLeft: leftPos - 700}, 800);
+ var leftPos = $('#tableContainer').scrollLeft();
+ $("#tableContainer").animate({scrollLeft: leftPos - scroll_width}, 600);
}
if (where == 'right'){
- //$(window).scrollTo('+=500px', 300, { axis:'x' });
-
- var leftPos = $('html').scrollLeft();
- $("html").animate({scrollLeft: leftPos + 700}, 800);
+ var leftPos = $('#tableContainer').scrollLeft();
+ $("#tableContainer").animate({scrollLeft: leftPos + scroll_width}, 600);
}
+}
+
+// Prikaz ikon (frekvence, sums...) pri kliku na 3 pikice
+function show_settings_survey_analysis(id_of_element){
+
+ if($('#options'+id_of_element).is(":visible")){
+ $('#options'+id_of_element).hide();
+ }
+ else{
+ $('.options').hide();
+ $('#options'+id_of_element).show();
+ }
+}
+
+// Zapremo popup z analizo
+function closeAnalizaPopup(){
+ $('#analysis_popup').fadeOut('slow').html('');
+ $('#fade').fadeOut('slow');
}
\ No newline at end of file |