summaryrefslogtreecommitdiffstats
path: root/admin/survey/script/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/script/script.js')
-rw-r--r--admin/survey/script/script.js1597
1 files changed, 1013 insertions, 584 deletions
diff --git a/admin/survey/script/script.js b/admin/survey/script/script.js
index c0aa65b..450aacc 100644
--- a/admin/survey/script/script.js
+++ b/admin/survey/script/script.js
@@ -24,11 +24,13 @@ var __tabele = 0; // pove ce smo v analizi v krostabulacijah(1)
// poklice se v onload.js
function load_meta_variables () {
srv_meta_anketa_id = $("#srv_meta_anketa_id").val();
+ srv_meta_anketa_hash = $("#srv_meta_anketa_hash").val();
srv_meta_podstran = $("#srv_meta_podstran").val();
srv_meta_akcija = $("#srv_meta_akcija").val();
srv_meta_grupa = $("#srv_meta_grupa").val();
srv_meta_branching = $("#srv_meta_branching").val();
srv_meta_full_screen_edit = ($("#srv_meta_full_screen_edit").val() == 1 ? true : false);
+
loaded = true;
};
@@ -38,7 +40,7 @@ function ajax_start_stop () {
$('body').ajaxStart(function() {
t=setTimeout(function() {$('body').addClass('waitlong');},1000);
$('body').addClass('wait');
- }).ajaxStop(function() {
+ }).ajaxComplete(function() {
clearTimeout(t);
$('body').removeClass('wait').removeClass('waitlong');
});
@@ -138,8 +140,11 @@ function onload_init () {
});
- $('#test_user_alert span').blink(
- {fadeIn: 100, fadeOut: 200,pauseShow:500});
+ $('#test_user_alert span').blink({
+ fadeIn: 100,
+ fadeOut: 200,
+ pauseShow:500
+ });
// Search na vrhu po pritisku na enter skoci na drupal search
$('#searchSurvey').keypress(function (e) {
@@ -376,54 +381,32 @@ function new_anketa() {
var isInfoOver = false;
var isInfoLoaded = false;
function showInfoBox(action,e) {
- if (action == 'show') {
-
- /*
- isInfoOver = true;
- // ugotovimo elementovo pozicijo
- var pos = e.offset();
- // ugotovimo dimenzije info boxa
- var surveyInfo_height = $("#surveyInfo").height();
-
- // ce infobox ne moremo prikazati navzgor, ga prikazemo navzdol
- // ugotovimo velikost strani
- var w_height = $(window).height();
- var w_width = $(document).width();
-
- if (pos.top - surveyInfo_height && (pos.top + surveyInfo_height) < w_height) {
- // risemo navzdol
- show_top = pos.top + e.height() + 5;
- }
- else { // risemo navzgor
- show_top = pos.top - surveyInfo_height - e.height() - 5;
- }*/
+
+ if (action == 'show') {
if (!isInfoLoaded) {
$('#surveyInfo_msg').load('ajax.php?a=displayInfoBox', {anketa: srv_meta_anketa_id});
isInfoLoaded = true;
}
- //$("#surveyInfo").css( { "left": (pos.left+e.width()+5)+ "px", "top": show_top + "px" } ).show().draggable();
-
- } /*else {
- isInfoOver = false;
- setTimeout(function() {hideBottomInfoBox()}, 350);
- }*/
+ }
}
function hideBottomInfoBox() {
- if (isInfoOver == false)
+
+ if (isInfoOver == false)
$('#surveyInfo').fadeOut(400);
-
}
// spremeni ime ankete
function edit_anketa_naslov (anketa) {
$('#anketa_naslov').load('ajax.php?a=edit_anketa', {anketa: anketa, naslov: $('#anketa_polnoIme').val()});
}
+
// spremeni opombo ankete
function edit_anketa_note (anketa){
$.post('ajax.php?a=edit_anketa_note', {anketa: anketa, note: $('#anketa_note').val()});
}
+
// spremeni akronim-kratko ime ankete
function edit_anketa_akronim (anketa){
$.post('ajax.php?a=edit_anketa_akronim', {anketa: anketa, akronim: $('#anketa_akronim').val()});
@@ -436,8 +419,8 @@ function anketa_active (anketa, state, folders, hierarhija) {
if (state == 0) {
// Če aktiviramo anketo, najprej vprašamo po datumih
- $.post('ajax.php?t=branching&a=check_pogoji&izpis=short', {anketa: anketa}, function (data) {
- if (data == '1') { // vse ok, anketa nima napak
+ //$.post('ajax.php?t=branching&a=check_pogoji&izpis=short', {anketa: anketa}, function (data) {
+ //if (data == '1') { // vse ok, anketa nima napak
$('#fade').fadeTo('slow', 1);
$('#fullscreen').html('').fadeIn('slow');
// aktiviramo anketo in prikažemo okno
@@ -447,18 +430,18 @@ function anketa_active (anketa, state, folders, hierarhija) {
// Pošljemo zahtevek za aktiviranje hierarhije
hierarhija_active(anketa);
}else {
- startTimerActivation(anketa, folders);
+ //startTimerActivation(anketa, folders);
}
});
- }
+ //}
// anketa ima napake
- else {
+ /* else {
// izpišemo obvestilo o napakah
$('#fade').fadeIn('slow');
$('#surveyTrajanje').fadeIn('slow');
$('#surveyTrajanje_msg').html(data);
- }
- });
+ } */
+ //});
}
else
@@ -748,12 +731,16 @@ function anketa_activate_save(anketa,folders) {
var voteCountLimitType = $("input[name=vote_count_limit]:checked").val();
var voteCountValue = $("#vote_count_val").val();
- $.post('ajax.php?a=anketa_save_activation', {anketa:anketa,
- durationType:durationType, durationStarts:durationStarts, durationExpire:durationExpire, voteCountLimitType:voteCountLimitType, voteCountValue:voteCountValue}, function (response) {
- refresh_anketa_activation(anketa,folders);
- });
+ $.post('ajax.php?a=anketa_activate', {anketa:anketa,folders:folders}, function (response) {
+ $.post('ajax.php?a=anketa_save_activation', {anketa:anketa,
+ durationType:durationType, durationStarts:durationStarts, durationExpire:durationExpire, voteCountLimitType:voteCountLimitType, voteCountValue:voteCountValue}, function (response) {
+ refresh_anketa_activation(anketa,folders);
+ });
+ });
} else {
- refresh_anketa_activation(anketa,folders);
+ $.post('ajax.php?a=anketa_activate', {anketa:anketa,folders:folders}, function (response) {
+ refresh_anketa_activation(anketa,folders);
+ });
}
}
@@ -930,7 +917,7 @@ function insert_grupa_before(grupa) {
function grupa_recount(prevent_recount) {
if (prevent_recount) {
- $.post('ajax.php?a=outputLanguageNote', {anketa: srv_meta_anketa_id, note: 'srv_grupa_recount_alert_have_branching'}, function(response) { alert(response); return false;});
+ $.post('ajax.php?a=outputLanguageNote', {anketa: srv_meta_anketa_id, note: 'srv_grupa_recount_alert_have_branching'}, function(response) { genericAlertPopup('alert_parameter_response',response); return false;});
} else {
$.redirect('ajax.php?a=grupa_recount', {anketa: srv_meta_anketa_id, grupa: srv_meta_grupa});
}
@@ -1031,17 +1018,23 @@ function brisi_spremenljivko (spremenljivka, text, confirmed) {
//refreshLeft();
$('#branching').html(data.output);
refreshRight();
+
+ // Prikazemo gumb za pobrisana vprasanja (toolbox na levi) in povecamo counter
+ $('#vprasanje_deleted_border, #vprasanje_deleted_toolbox').removeClass('displayNone');
+ var vprasanje_deleted_count = parseInt($('#vprasanje_deleted_count').html()) + 1;
+ $('#vprasanje_deleted_count').html(vprasanje_deleted_count);
}
else if (data.error == 1) {
$('#fade').fadeIn('slow');
- $('#dropped_alert').html(data.output).fadeIn('slow').animate({opacity: 1.0}, 3000, function(){
+ /*$('#dropped_alert').html(data.output).fadeIn('slow').animate({opacity: 1.0}, 3000, function(){
$('#fade').fadeOut("slow");
$('#dropped_alert').fadeOut("slow");
- });
+ });*/
+ $('#dropped_alert').html(data.output).fadeIn('slow').css('width', '600px');
}
else if (data.error == 2) {
$('#fade').fadeIn('slow');
- $('#dropped_alert').html(data.output).fadeIn('slow').css('width', '400px');
+ $('#dropped_alert').html(data.output).fadeIn('slow').css('width', '600px');
}
}
@@ -1516,7 +1509,33 @@ function normalmode_spremenljivka (spremenljivka) {
// prikaze editor za ne-spremenljivko (za karkoli druzga pac)
function create_editor (id, focus) {
- CKEDITOR.replace(id);
+ editor = CKEDITOR.replace(id);
+
+ // Dodamo gumb vec
+ editor.addCommand("advanced_editor_show", {
+ exec: function(edt) {
+ $('#'+edt.id+'_toolbox').addClass('advanced');
+ }
+ });
+
+ editor.ui.addButton('More', {
+ label: lang['more2'],
+ command: 'advanced_editor_show',
+ name: "More",
+ });
+
+ // Dodamo gumb manj
+ editor.addCommand("advanced_editor_hide", {
+ exec: function(edt) {
+ $('#'+edt.id+'_toolbox').removeClass('advanced');
+ }
+ });
+
+ editor.ui.addButton('Less', {
+ label: lang['less2'],
+ command: 'advanced_editor_hide',
+ name: "Less",
+ });
//namestitev editorja za tekst pri obveščanju
if(gup('a') == 'alert' && focus == false){
@@ -1623,6 +1642,23 @@ function create_editor_hotspot (id, focus) {
editor_init = true;
}
+function create_editor_notification(id) {
+
+ CKEDITOR.replace( id, {toolbar: 'Notification'}); // prikazi editor s Notification configuration
+
+ CKEDITOR.config.removePlugins = 'elementspath'; //odstrani spodnji tag, kjer po default-u so oznake html (body, p, ipd.)
+
+ CKEDITOR.instances[id].on('focus', function () {
+ this.execCommand('selectAll');
+ });
+
+ if (id == 'notification')
+ CKEDITOR.config.resize_enabled = false;
+ CKEDITOR.config.height = 238;
+
+ editor_init = true;
+}
+
// odstrani editor za ne-spremenljivka (treba preden se odstrani html)
function remove_editor (id) {
//odstranimo CKEDITOR v kolikor je inicializiran -> če preverjanja potem javi error in ostala javascript datoteka ne deluje
@@ -1639,35 +1675,53 @@ function remove_editor (id) {
// prikaze editor za spremenljivko (definiran mora biti textarea za idjem naslov_$spremenljivka
function editor_display (spremenljivka) {
- //if (editor_init != true) {
- CKEDITOR.replace( 'naslov_'+spremenljivka );
+ editor = CKEDITOR.replace( 'naslov_'+spremenljivka );
- //v kolikor je default vrednost potem naredimo selectAll
- var def = $('#naslov_'+spremenljivka).attr("default");
- if( def == 1) {
- CKEDITOR.instances['naslov_' + spremenljivka].on('focus', function () {
- this.execCommand('selectAll');
- });
- }
- // editor_init = true;
- //}
+ // Dodamo gumb vec
+ editor.addCommand("advanced_editor_show", {
+ exec: function(edt) {
+ $('#'+edt.id+'_toolbox').addClass('advanced');
+ }
+ });
+ editor.ui.addButton('More', {
+ label: lang['more2'],
+ command: 'advanced_editor_show',
+ name: "More",
+ });
+
+ // Dodamo gumb manj
+ editor.addCommand("advanced_editor_hide", {
+ exec: function(edt) {
+ $('#'+edt.id+'_toolbox').removeClass('advanced');
+ }
+ });
+
+ editor.ui.addButton('Less', {
+ label: lang['less2'],
+ command: 'advanced_editor_hide',
+ name: "Less",
+ });
+
+ //v kolikor je default vrednost potem naredimo selectAll
+ var def = $('#naslov_'+spremenljivka).attr("default");
+ if( def == 1) {
+ CKEDITOR.instances['naslov_' + spremenljivka].on('focus', function () {
+ this.execCommand('selectAll');
+ });
+ }
}
function editor_display_hotspot (vre_id) {
- //if (editor_init != true) {
- CKEDITOR.replace( 'hotspot_image_'+vre_id, {toolbar: 'HotSpot', width: 300, removePlugins: 'elementspath'}); //izberi config toolbar HotSpot, sirina naj bo 300px, odstrani spodnji tag, kjer po default-u so oznake html (body, p, ipd.)
+ CKEDITOR.replace( 'hotspot_image_'+vre_id, {toolbar: 'HotSpot', width: 300, removePlugins: 'elementspath'}); //izberi config toolbar HotSpot, sirina naj bo 300px, odstrani spodnji tag, kjer po default-u so oznake html (body, p, ipd.)
- //v kolikor je default vrednost potem naredimo selectAll
- var def = $('#hotspot_image_'+vre_id).attr("default");
- //if( def == 1) {
- CKEDITOR.instances['hotspot_image_' + vre_id].on('focus', function () {
- this.execCommand('selectAll');
- });
- //}
- // editor_init = true;
- //}
+ //v kolikor je default vrednost potem naredimo selectAll
+ var def = $('#hotspot_image_'+vre_id).attr("default");
+
+ CKEDITOR.instances['hotspot_image_' + vre_id].on('focus', function () {
+ this.execCommand('selectAll');
+ });
}
// odstrani editor (treba preden se odstrani html)
@@ -1789,7 +1843,7 @@ function grupa_sortable (preventMove) {
stop: function () {
if (preventMove == true) {
$(this).sortable('cancel');
- $.post('ajax.php?a=outputLanguageNote', {anketa: srv_meta_anketa_id, note: 'srv_grupa_move_alert_have_branching'}, function(response) { alert(response); return false;});
+ $.post('ajax.php?a=outputLanguageNote', {anketa: srv_meta_anketa_id, note: 'srv_grupa_move_alert_have_branching'}, function(response) { genericAlertPopup('alert_parameter_response',response); return false;});
} else
$.post('ajax.php?a=vrstnired_grupa', {serialize: $('#grupe').sortable('serialize')});
}
@@ -1826,7 +1880,7 @@ function spremenljivka_sortable (preventMove) {
// {duration: 1});¸
if (preventMove == true) {
$(this).sortable('cancel');
- $.post('ajax.php?a=outputLanguageNote', {anketa: srv_meta_anketa_id, note: 'srv_spremenljivka_move_alert_have_branching'}, function(response) { alert(response); return false;});
+ $.post('ajax.php?a=outputLanguageNote', {anketa: srv_meta_anketa_id, note: 'srv_spremenljivka_move_alert_have_branching'}, function(response) { genericAlertPopup('alert_parameter_response',response); return false;});
} else {
var moved = ui.item.attr('id');
var topage = $("#"+moved).parent().attr('id');
@@ -1942,7 +1996,7 @@ function data_show_labels () {
// povemo koliko stolpcev z ikonicami imamo (se nastavi v html)
var tableIconColspan = parseInt( $("#tableIconColspan").val() ) || 0;
- var tableHeadChildren = $('#dataTable tr:nth-child(3)').children(); // th-ji vrstice header tabele
+ var tableHeadChildren = $('#dataTable tr:nth-child(2)').children(); // th-ji vrstice header tabele
var sprList = [];
@@ -2078,138 +2132,22 @@ function toggleStatusAlertOtherCheckbox(element) {
// alert_expire_other
if ( $('#alert_'+element).is(':checked') )
{
- $('#alert_holder_'+element+'_emails').show();
+ $('#alert_holder_'+element+'_emails').removeClass('displayNone');
} else {
- $('#alert_holder_'+element+'_emails').hide(); }
+ $('#alert_holder_'+element+'_emails').addClass('displayNone'); }
}
-function clear_analizaFilters()
-{
-$('input[id^=analiza_mv_checkbox_]').each(function()
-{ if ( $(this).is(':checked') )
- $(this).trigger('click');
-});
-}
-
-/* komentarji */
-
-// funkcija, ki pohendla komentarje ankete in vprasanj (preusmeri v forum in po potrebi (pri vprasanju) kreira novo temo, ce se ni)
-function comment_manage(type, spremenljivka) {
- $.redirect('ajax.php?t=branching&a=comment_manage', {anketa: srv_meta_anketa_id, type: type, spremenljivka: spremenljivka});
-}
-
-var siteurl = '';
-if ( typeof srv_site_url !== 'undefined' ) { // komentarji v izpolnjevanju ankete
- siteurl = srv_site_url + '/admin/survey/';
-}
+function clear_analizaFilters(){
-// doda komentar in osvezi oblacek
-// type=0 : anketa, type=1 : vprasanje
-function add_comment (spremenljivka, type, view, vsebina) {
- $('div#survey_comment_'+spremenljivka+'_'+view).load(siteurl+'ajax.php?t=branching&a=comment_manage', {type: type, view: view, spremenljivka: spremenljivka, vsebina: vsebina, anketa: srv_meta_anketa_id, refresh: '1'},
- function () {
- if (view == 0) {
- $('#surveycomment_'+spremenljivka+'_0').qtip("hide"); // pri opciji Dodaj komentar, skrijemo oblacek po submitu
- $('#comment_add_'+spremenljivka).css('visibility', 'visible'); // pokazemo opcijo Poglej komentarje
- } else if (view == 4 || view == 5) {
- window.location.reload();
- }
+ $('input[id^=analiza_mv_checkbox_]').each(function(){
+ if ( $(this).is(':checked') )
+ $(this).trigger('click');
});
}
-// nastavi podanemu linku (a.surveycomment) oblacek za komentarje
-function load_comment (__this, show) {
- if (show == 1) { // opcije za takrat, ko je po defaultu ze na zacetku prikazan - za dodat komentar na anketo
- _when = false;
- _ready = true;
- var corners = ['leftMiddle', 'leftMiddle'];
- var opposites = ['rightMiddle', 'rightMiddle'];
- } else if (show == 2) { // opcija za takrat, ko se aktivira preko oblacka, ko se prikaze takoj
- _when = 'click';
- _ready = true;
- var corners = ['topRight', 'topRight'];
- var opposites = ['bottomLeft', 'bottomLeft'];
- } else { // default za normalne komentarje, da se odpre na klik
- _when = 'click';
- _ready = false;
- var corners = ['topLeft', 'topRight'];
- var opposites = ['bottomRight', 'bottomLeft'];
- }
-
- var width = $(document).width();
- // nastavitve za help
-
- // preverimo ali prikažemo tip na levo stran
- var position = $(__this).offset(); // position = { left: 42, top: 567 }
-
- var left = width - position.left;
-
- var i = (left >= 350) ? 0 : 1;
-
- if ($(__this).data("qtip")) {
- $(__this).qtip("destroy");
- $('div.qtip').html('');
- }
-
- // Posebej naslov ce smo v urejanju
- if($(__this).attr('view') == '1' && !show && $('#comment_qtip_title').length > 0 && $(__this).attr('subtype') == undefined){
- var naslov = $('#comment_qtip_title').val();
- }
- // komentar na vprasanje
- else if($(__this).attr('subtype') == 'q_admin_add'){
- var naslov = lang['srv_testiranje_komentar_q_title'];
- }
- // komentar na if
- else if($(__this).attr('subtype') == 'if_admin_add'){
- var naslov = lang['srv_testiranje_komentar_if_title'];
- }
- // komentarji na if
- else if($(__this).attr('subtype') == 'if_admin_all'){
- var naslov = lang['srv_testiranje_komentar_if_all_title'];
- }
- // komentar na blok
- else if($(__this).attr('subtype') == 'blok_admin_add'){
- var naslov = lang['srv_testiranje_komentar_blok_title'];
- }
- // komentarji na blok
- else if($(__this).attr('subtype') == 'blok_admin_all'){
- var naslov = lang['srv_testiranje_komentar_blok_all_title'];
- }
- // komentarji na vprasanja
- else if($(__this).attr('subtype') == 'q_admin_all'){
- var naslov = lang['srv_testiranje_komentar_q_all_title'];
- }
- // komentarji respondentov na vprasanja
- else if($(__this).attr('subtype') == 'q_resp_all'){
- var naslov = lang['srv_testiranje_komentar_q_resp_all_title'];
- }
- else{
- var naslov = lang['srv_testiranje_komentarji_anketa_title2'];
- }
-
- $(__this).qtip({
- content: {text: '<div id="survey_comment_'+$(__this).attr('spremenljivka')+'_'+$(__this).attr('view')+'"></div>', title: {text: naslov, button: '&#x2715;'}},
- fixed: false, show: {when: _when, ready: _ready, solo: true},hide: {when: 'click'},
- style: {name: 'light', border: {width: 3, radius: 8}, width: 350, tip: {corner: corners[i]}},
- position: {corner: {tooltip: corners[i], target: opposites[i] }, adjust: {screen : true}},
- api: {
- beforeShow: function () {
- // tuki se poklice zato, ker se drugace content: {url: ....} ne refresha, ce zapres in spet odpres oblacek
- _comment = 1;
- $('div#survey_comment_'+$(__this).attr('spremenljivka')+'_'+$(__this).attr('view')).load(siteurl+'ajax.php?t=branching&a=comment_manage', {anketa: srv_meta_anketa_id, type: $(__this).attr('type'), view: $(__this).attr('view'), spremenljivka: $(__this).attr('spremenljivka'), vsebina: '', anketa: srv_meta_anketa_id, refresh: '1'});
- },
- onShow: function () {
- $('div.qtip').draggable();
- }
- }
- });
-
-}
-var _comment = 0;
/* help */
-
function load_help () { // ta funkcija je še mal slaba.
// prvi oblacek se ob vsakem ajax klicu overloadajo in se pol prikaze veckrat
// drugi oblacek ne dela v IE
@@ -2286,6 +2224,22 @@ function save_help (what, lang) {
try { $('#help_'+what).attr('qtip', '').qtip('destroy'); } catch (e) {/*alert("Napaka"+e)*/};
});
}
+
+// shrani vprasajcek iz masovnega urejanja iz nastavitev vprasajckov
+function save_help_mass(what, lang) {
+
+ var help = $('#edithelp_mass_'+what).val();
+
+ $.post('ajax.php?t=help&a=save_help&lang='+lang, {what: what, help: help}, function(){
+ try {
+ $('#help_'+what).attr('qtip', '').qtip('destroy');
+ }
+ catch (e) {
+ /*alert("Napaka"+e)*/
+ };
+ });
+}
+
function saveGlobalSetting(what)
{
var state = $("input[name="+what+"]:checked").val();
@@ -2517,34 +2471,25 @@ function show_tip_preview_toolbox (tip, copy, advanced, podtip) {
if (advanced == 1) {
if ($("#tip_preview_sub_"+tip).length > 0) {
- var pos = $("p[tip="+tip+"]", "#toolbox_add_advanced").offset();
- var width = $("p[tip="+tip+"]", "#toolbox_add_advanced").width();
+
+ $("#tip_preview").css({"left":"520px"});
- $("#tip_preview").css( { "left": (10+pos.left + width) + "px", "right":"auto", "top":(10+pos.top) + "px" } );
- // prikažemo glevni div
+ // prikažemo glevni div
$("#tip_preview").show();
// priredimo še vsebino
$("[name=tip_preview_sub]:visible", "#tip_preview").hide();
$("#tip_preview_sub_"+tip).show();
-
- // Na koncu zamaknemo gor za visino diva (pri nizkih ekranih)
- //var w_height = $(window).height();
- var height = $("#tip_preview").height();
- //if(w_height < height + pos.top){
- $("#tip_preview").css( { "top":(30+pos.top-height) + "px" } );
- //}
}
// preview v toolboxu levo
} else {
if ($("#tip_preview_sub_"+tip).length > 0) {
- var pos = $("p[tip="+tip+"]:not(.adv)", "#toolbox_basic").offset();
- var width = $("p[tip="+tip+"]:not(.adv)", "#toolbox_basic").width();
- $("#tip_preview").css( { "left": (13+pos.left + width) + "px", "right":"auto", "top":(pos.top) + "px" } );
- // prikažemo glevni div
+ $("#tip_preview").css({"left":"245px"});
+
+ // prikažemo glevni div
$("#tip_preview").show();
// priredimo še vsebino
@@ -2573,7 +2518,6 @@ function show_tip_preview_toolbox (tip, copy, advanced, podtip) {
$("#tip_preview").css( { "right": ($(window).width()-cnt.left) + "px", "left":"auto", "top":(10+pos.top) + "px" } );
else
$("#tip_preview").css( { "right": ($(window).width()-cnt.left) + "px", "left":"auto", "top":(10+pos.top) + "px" } );
- //$("#tip_preview").css( { "left": (10+pos.left + width) + "px", "right":"auto", "top":(10+pos.top) + "px" } );
// prikažemo glavni div
$("#tip_preview").show();
@@ -2601,241 +2545,194 @@ function show_tip_preview_toolbox (tip, copy, advanced, podtip) {
}
function show_tip_preview(spr, value) {
-// if ($("#tip_preview").is(':hidden'))
if ( $('select#spremenljivka_tip_'+spr).attr('data-ajax') == 'true' ) {
show_tip_preview_toolbox(0, value);
return;
}
+
+ // To zacasno izklopimo - mogoce tega raje ne uporabljamo??
//pozicioniramo div
- var pos = $("#spremenljivka_tip_"+spr).offset();
- var width = $("#spremenljivka_tip_"+spr).width();
+ /*var pos = $("#vprasanje_float_editing").offset();
var body = $('body').width();
- //$("#tip_preview").css( { "left": (10+pos.left + width) + "px", "top":(10+pos.top) + "px" } );
- $("#tip_preview").css( { "left":"auto", "right": (body - pos.left + 10) + "px", "top":(pos.top) + "px" } );
+
+ $("#tip_preview").css( { "left":"auto", "right": "360px", "top": "250px" } );
+
// prikažemo glevni div
$("#tip_preview").show();
// priredimo še vsebino
$("[name=tip_preview_sub]:visible").hide();
- $("#tip_preview_sub_"+value).show();
-}
-function show_tip_preview_first(value) {
-
- if(value < 5 || value == 7 || value == 21)
- stolpec = 1;
- else if(value == 6 || value == 16 || value == 19 || value == 20)
- stolpec = 2;
- else if(value == 5 || value == 8 || value == 17 || value == 18)
- stolpec = 3;
- else if(value > 8 && value < 16)
- stolpec = 'SN';
- else
- stolpec = 4;
-
- //pozicioniramo div
- var pos = $(".questions"+stolpec).offset();
- var width = $(".questions"+stolpec).width();
- var height = $(".questions"+stolpec).height();
-
- if(stolpec == 1 || stolpec == 3)
- $("#tip_preview").css( { "left": (10+pos.left + width) + "px", "right":"auto", "top":(10+pos.top) + "px" } );
- else if(stolpec == 2 || stolpec == 4)
- $("#tip_preview").css( { "left": (pos.left - 200) + "px", "right":"auto", "top":(10+pos.top+height) + "px" } );
- else
- $("#tip_preview").css( { "left": (pos.left - 250) + "px", "right":"auto", "top":(10+pos.top+height) + "px" } );
-
- // prikažemo glevni div
- $("#tip_preview").show();
+ $("#tip_preview_sub_"+value).show();*/
+}
- // priredimo še vsebino
- $("[name=tip_preview_sub]:visible").hide();
- $("#tip_preview_sub_"+value).show();
+//preview pri design, orientation in grid subtype dropdownu (ranking, radio b, multigrid)
+function show_tip_preview_subtype(spr, design, tip) {
-}
-function nova_spremenljivka_type(type) {
- $("#tip_preview").hide();
+ //ranking
+ if(tip == '17'){
+ if(design == '0')
+ val = '17';
+ else if(design == '1')
+ val = '17_1';
+ else
+ val = '17_2';
+ }
- if (srv_meta_branching == 1) {
- $('#branching').load('ajax.php?t=branching&a=spremenljivka_new', {anketa: srv_meta_anketa_id, q_type:type}, function() {
- refreshRight();
- refreshBottomIcons('gray');
- });
+ //SN generator imen
+ else if(tip == '9'){
+ if(design == '0')
+ val = '9';
+ else if(design == '1')
+ val = '9_1';
+ else if(design == '2')
+ val = '9_2';
+ else if(design == '3')
+ val = '9_3';
+ }
- } else {
- $('#vprasanja').load('ajax.php?a=nova_spremenljivka', {anketa: srv_meta_anketa_id, grupa: srv_meta_grupa, q_type:type}, function() {
- $("#grupe").load('ajax.php?a=refresh_grupe', {anketa: srv_meta_anketa_id, grupa: srv_meta_grupa});
- refreshBottomIcons('gray');
- });
+ //multigrid
+ else if(tip == '6'){
+ if(design == '0')
+ val = '6';
+ else if(design == '1')
+ val = '6_1';
+ else if(design == '2')
+ val = '6_2';
+ else if(design == '3')
+ val = '6_3';
+ else if(design == '4')
+ val = '6_4';
+ else if(design == '5')
+ val = '6_5';
+ else if(design == '6')
+ val = '6_6';
+ else if(design == '8')
+ val = '6_8';
+ else if(design == '9')
+ val = '6_9';
+ else if(design == '10')
+ val = '6_10';
}
-}
-//preview pri design, orientation in grid subtype dropdownu (ranking, radio b, multigrid)
-function show_tip_preview_subtype(spr, design, tip) {
-// if ($("#tip_preview").is(':hidden'))
- {
- //ranking
- if(tip == '17'){
- if(design == '0')
- val = '17';
- else if(design == '1')
- val = '17_1';
- else
- val = '17_2';
- }
+ //radio
+ else if(tip == '1'){
+ if(design == '0')
+ val = '1_1';
+ else if(design == '1')
+ val = '1';
+ else if(design == '2')
+ val = '1_2';
+ else if(design == '4')
+ val = '3';
+ else if (design == '5')
+ val = '1_5';
+ else if (design == '6')
+ val = '1_6';
+ else if (design == '8')
+ val = '1_8';
+ else if (design == '9')
+ val = '1_9';
+ else if (design == '10')
+ val = '1_10';
+ else if (design == '11')
+ val = '1_11';
+ }
- //SN generator imen
- else if(tip == '9'){
- if(design == '0')
- val = '9';
- else if(design == '1')
- val = '9_1';
- else if(design == '2')
- val = '9_2';
- else if(design == '3')
- val = '9_3';
- }
+ //checkbox
+ else if(tip == '2'){
+ if(design == '1')
+ val = '2';
+ else if(design == '0')
+ val = '2_1';
+ else if(design == '2')
+ val = '2_2';
+ else if (design == '6')
+ val = '1_6';
+ else if (design == '8')
+ val = '2_8';
+ else if (design == '10')
+ val = '2_10';
+ else
+ val = '2';
- //multigrid
- else if(tip == '6'){
- if(design == '0')
- val = '6';
- else if(design == '1')
- val = '6_1';
- else if(design == '2')
- val = '6_2';
- else if(design == '3')
- val = '6_3';
- else if(design == '4')
- val = '6_4';
- else if(design == '5')
- val = '6_5';
- else if(design == '6')
- val = '6_6';
- else if(design == '8')
- val = '6_8';
- else if(design == '9')
- val = '6_9';
- else if(design == '10')
- val = '6_10';
- }
+ }
- //radio
- else if(tip == '1'){
- if(design == '0')
- val = '1_1';
- else if(design == '1')
- val = '1';
- else if(design == '2')
- val = '1_2';
- else if(design == '4')
- val = '3';
- else if (design == '5')
- val = '1_5';
- else if (design == '6')
- val = '1_6';
- else if (design == '8')
- val = '1_8';
- else if (design == '9')
- val = '1_9';
- else if (design == '10')
- val = '1_10';
- else if (design == '11')
- val = '1_11';
- }
+ else if (tip == '21') {
+ if (design == '1')
+ val = '21_1';
+ else if (design == '2')
+ val = '21_2';
+ else if (design == '3')
+ val = '21_3';
+ else if (design == '4')
+ val = '21_4';
+ else if (design == '5')
+ val = '21_5';
+ else if (design == '6')
+ val = '21_6';
+ else if (design == '7')
+ val = '21_7';
+ }
- //checkbox
- else if(tip == '2'){
- if(design == '1')
- val = '2';
- else if(design == '0')
- val = '2_1';
- else if(design == '2')
- val = '2_2';
- else if (design == '6')
- val = '1_6';
- else if (design == '8')
- val = '2_8';
- else if (design == '10')
- val = '2_10';
- else
- val = '2';
+ else if (tip == '23') {
+ val = design;
+ }
- }
+ else if (tip == '5') {
+ if(design == '2')
+ val = '5_2';
+ }
- else if (tip == '21') {
- if (design == '1')
- val = '21_1';
- else if (design == '2')
- val = '21_2';
- else if (design == '3')
- val = '21_3';
- else if (design == '4')
- val = '21_4';
- else if (design == '5')
- val = '21_5';
- else if (design == '6')
- val = '21_6';
- else if (design == '7')
- val = '21_7';
- }
+ // lokacija
+ else if(tip == '26'){
+ if(design == '2')
+ val = '26_2';
+ else if(design == '1')
+ val = '26_1';
+ }
- else if (tip == '23') {
- val = design;
- }
+ // slider
+ else if (tip == '7') {
+ val = '7_2';
+ }
- else if (tip == '5') {
- if(design == '2')
- val = '5_2';
- }
- // lokacija
- else if(tip == '26'){
- if(design == '2')
- val = '26_2';
- else if(design == '1')
- val = '26_1';
- }
+ // normalno
+ if (spr >= 0) {
- // slider
- else if (tip == '7') {
- val = '7_2';
- }
+ //pozicioniramo div
+ var pos = $("#spremenljivka_podtip_"+spr).offset();
+ var width = $("#spremenljivka_podtip_"+spr).width();
+ var body = $('body').width();
+ $("#tip_preview").css( { "left":"auto", "right": (body - pos.left + 10) + "px", "top":(pos.top) + "px" } );
- // normalno
- if (spr >= 0) {
+ // prikažemo glavni div
+ $("#tip_preview").show();
- //pozicioniramo div
- var pos = $("#spremenljivka_podtip_"+spr).offset();
- var width = $("#spremenljivka_podtip_"+spr).width();
- var body = $('body').width();
- //$("#tip_preview").css( { "left": (pos.left) + "px", "right":"auto", "top":(100+pos.top) + "px" } );
- $("#tip_preview").css( { "left":"auto", "right": (body - pos.left + 10) + "px", "top":(pos.top) + "px" } );
+ // priredimo še vsebino
+ $("[name=tip_preview_sub]:visible").hide();
+ $("#tip_preview_sub_" + val).show();
- // pri popuupu za dodajanje advanced tipov vprasanj
- } else {
+ // Na koncu zamaknemo gor za visino diva (pri nizkih ekranih)
+ var height = $("#tip_preview").height();
+ $("#tip_preview").css( { "top":(30+pos.top-height) + "px" } );
+ }
+ // pri popuupu za dodajanje advanced tipov vprasanj
+ else {
- //pozicioniramo div
- var pos = $("#toolbox_add_advanced p[tip="+tip+"][podtip="+design+"]").offset();
- var width = $("#toolbox_add_advanced p[tip="+tip+"][podtip="+design+"]").width();
- $("#tip_preview").css( { "left": (10+pos.left + width) + "px", "right":"auto", "top":(10+pos.top) + "px" } );
- }
+ // pozicioniramo div
+ $("#tip_preview").css({"left":"520px"});
- // prikažemo glavni div
- $("#tip_preview").show();
- }
- // priredimo še vsebino
- $("[name=tip_preview_sub]:visible").hide();
- $("#tip_preview_sub_" + val).show();
+ // prikažemo glavni div
+ $("#tip_preview").show();
- // Na koncu zamaknemo gor za visino diva (pri nizkih ekranih)
- //var w_height = $(window).height();
- var height = $("#tip_preview").height();
- //if(w_height < height + pos.top){
- $("#tip_preview").css( { "top":(30+pos.top-height) + "px" } );
- //}
+ // priredimo še vsebino
+ $("[name=tip_preview_sub]:visible").hide();
+ $("#tip_preview_sub_" + val).show();
+ }
}
// skrijemo div za preview
@@ -2845,8 +2742,10 @@ function hide_tip_preview () {
}
function edit_email_invitations(id) {
+
$('#div_float_editing').html('');
$('#div_float_editing').fadeIn("slow");
+
if (id == 0) {
var email_subject = $("#email_subject").val();
var email_text = $("#email_text").val();
@@ -2855,11 +2754,11 @@ function edit_email_invitations(id) {
create_editor('template_text_'+id);
}
).draggable({delay:100, ghosting: true , cancel: 'input, textarea, select, .buttonwrapper'});
- } else {
+ }
+ else {
$('#div_float_editing').load('ajax.php?a=edit_email_invitations', {anketa: srv_meta_anketa_id, id: id},
function () {
CKEDITOR.replace('template_text_'+id);
-// create_editor('template_text_'+id);
}
).draggable({delay:100, ghosting: true , cancel: 'input, textarea, select, .buttonwrapper'});
}
@@ -3172,18 +3071,18 @@ function survey_chaneg_type_cancle() {
$('#fade').fadeOut('slow');
}
function preview_spremenljivka(spremenljivka, lang_id) {
- $('#fullscreen').html('').fadeIn('slow').draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'});
+ $('#fullscreen').html('').fadeIn('slow');
$('#fade').fadeTo('slow', 1);
- $('#fullscreen').load('ajax.php?a=preview_spremenljivka', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, lang_id: lang_id,podstran: srv_meta_podstran}).draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'});
+ $('#fullscreen').load('ajax.php?a=preview_spremenljivka', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, lang_id: lang_id,podstran: srv_meta_podstran})/* .draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'}) */;
}
function preview_spremenljivka_analiza(spremenljivka, lang_id) {
- $('#fullscreen').html('').fadeIn('slow').draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'});
+ $('#fullscreen').html('').fadeIn('slow');
$('#fade').fadeTo('slow', 1);
- $('#fullscreen').load('ajax.php?t=analysis&a=preview_spremenljivka', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, lang_id: lang_id,podstran: srv_meta_podstran}).draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'});
+ $('#fullscreen').load('ajax.php?t=analysis&a=preview_spremenljivka', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, lang_id: lang_id,podstran: srv_meta_podstran})/* .draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'}) */;
}
-function preview_spremenljivka_cancle() {
+function preview_spremenljivka_cancel() {
$('#fullscreen').hide();
if ($('#vprasanje').css('display') != 'block') {
$('#fade').fadeOut('slow');
@@ -3230,9 +3129,9 @@ function IE7_select_disabled_fix () {
function change_alert_respondent(what,el) {
var id = el.attr("id");
var checked = $("#alert_"+what).is(':checked');
- $("span#label_alert_"+what).load('ajax.php?a=change_alert_respondent', {anketa: srv_meta_anketa_id, checked: checked, what:what});
+ $("#label_alert_"+what).load('ajax.php?a=change_alert_respondent', {anketa: srv_meta_anketa_id, checked: checked, what:what});
}
-function chnage_alert_instruction(el) {
+function change_alert_instruction(el) {
var checked = el.is(':checked');
if (checked) {
$("#alert_respondent_cms_instruction").show();
@@ -3243,10 +3142,10 @@ function chnage_alert_instruction(el) {
function alert_add_necessary_sysvar(what,el) {
var id = el.attr("id");
var checked = $("#alert_"+what).is(':checked');
- $("span#label_alert_"+what).load('ajax.php?a=alert_add_necessary_sysvar', {anketa: srv_meta_anketa_id, checked: checked, what:what});
+ $("div#label_alert_"+what).load('ajax.php?a=alert_add_necessary_sysvar', {anketa: srv_meta_anketa_id, checked: checked, what:what});
}
function alert_change_user_from_cms(what, el) {
- $("span#label_alert_"+what).load('ajax.php?a=alert_change_user_from_cms', {anketa: srv_meta_anketa_id});
+ $("div#label_alert_"+what).load('ajax.php?a=alert_change_user_from_cms', {anketa: srv_meta_anketa_id});
}
function alert_edit_if (type, uid) {
@@ -3297,19 +3196,9 @@ function edit_glasovanje(spremenljivka, results, what){
function glas_extra_settings(){
$('.more').toggle();
$('.less').toggle();
- $('#glas_extra_settings').toggle();
-}
-
-//reload za editiranje uvoda/zakljucka pri formi
-/*function load_formIO(spremenljivka, what){
- $("#question_holder").load('ajax.php?a=form_extra', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, what: what});
+ $('#glas_extra_settings').slideToggle();
}
-//reload za editiranje uvoda/zakljucka pri glasovanju
-function load_glasIO(spremenljivka, what){
- $("#question_holder").load('ajax.php?a=form_extra', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, what: what});
-}*/
-
//hitre nastavitve za formo - what je spremenljivka, ki jo spreminjamo
function edit_form_settings(spremenljivka, results, what){
@@ -3426,13 +3315,57 @@ function newAnketaTemplate() {
}
if(ank_id == '' || ank_id < 1){
- alert(lang['srv_newSurvey_survey_template_error']);
+ genericAlertPopup('srv_newSurvey_survey_template_error');
}
else{
$.redirect('ajax.php?t=library&a=anketa_copy_new', {ank_id:ank_id, naslov:naslov, akronim:akronim, folder:folder});
}
}
+// preveri ali je uploadana datoteka .1ka in pokazi obvestilo
+function checkFileExtension1ka() {
+ var fileName = document.getElementById("restore").value;
+ var fileExtension = fileName.split(".").pop().toLowerCase();
+
+ if(fileName){
+ document.getElementById("file-input-label-populated").textContent = fileName.split("\\").pop();
+
+ document.getElementById("info_text_populated").style.display = "block";
+ document.getElementById("info_text_empty").style.display = "none";
+
+ document.getElementById("file-input-label-clear").style.display = "inline-block";
+ document.getElementById("file-input-label-empty").style.display = "none";
+ document.getElementById("file-input-label-populated").style.display = "inline-block";
+
+ if (fileExtension === "1ka") {
+ document.getElementById("1ka_file_approved_text").style.display = "block";
+ document.getElementById("1ka_file_not_approved_text").style.display = "none";
+ document.getElementById("noSurvey_create").disabled = false;
+ } else {
+ document.getElementById("1ka_file_approved_text").style.display = "none";
+ document.getElementById("1ka_file_not_approved_text").style.display = "block";
+ document.getElementById("noSurvey_create").disabled = true;
+ }
+ }
+ else{
+ document.getElementById("info_text_populated").style.display = "none";
+ document.getElementById("info_text_empty").style.display = "block";
+
+ document.getElementById("file-input-label-clear").style.display = "none";
+ document.getElementById("file-input-label-empty").style.display = "block";
+ document.getElementById("file-input-label-populated").style.display = "none";
+
+ document.getElementById("1ka_file_approved_text").style.display = "none";
+ document.getElementById("1ka_file_not_approved_text").style.display = "none";
+ document.getElementById("noSurvey_create").disabled = true;
+ }
+}
+
+function clearFileInput() {
+ document.getElementById("restore").value = "";
+ checkFileExtension1ka();
+}
+
// Preview vprasanj pri uvozu ankete iz besedila
function anketaFromText_preview(text) {
@@ -3661,12 +3594,19 @@ function recalc_alert_expire(days) {
// enablamo in disablamo vnos max stevila glasov (trajanje)
function voteCountStatus(status) {
+
if (status == 1 || status == 2) {
- $('#vote_count').removeAttr('disabled');
- $('.vote_limit_warning').show();
+ $('#vote_limit_warning').removeClass('displayNone');
+ $('#vote_limit').removeClass('bottom0');
} else {
- $('#vote_count').attr('disabled', true);
- $('.vote_limit_warning').hide();
+ $('#vote_limit_warning').addClass('displayNone');
+ $('#vote_limit').addClass('bottom0');
+ }
+
+ if (status == 1) {
+ $('#vote_limit_all_warning').removeClass('displayNone');
+ } else {
+ $('#vote_limit_all_warning').addClass('displayNone');
}
}
function voteCountToggle(status) {
@@ -3678,6 +3618,7 @@ function voteCountToggle(status) {
}
function survey_statistic_referal(what) {
+
if ($(what).attr('value') == '0') { // nalozimo vsebino samo prvi klik
var type = $("#type").val();
var period = $("#period").val();
@@ -3688,15 +3629,19 @@ function survey_statistic_referal(what) {
$("#survey_referals").slideDown();
$(what).attr('value','1');
});
- } else if ($(what).attr('value') == '1') { // skrijemo
+ }
+ else if ($(what).attr('value') == '1') { // skrijemo
$("#survey_referals").slideUp();
$(what).attr('value','2');
- } else { // prikazemo
+ }
+ else { // prikazemo
$("#survey_referals").slideDown();
$(what).attr('value','1');
}
}
+
function ip_list_podrobno (what) {
+
if ($(what).attr('value') == '0') { // nalozimo vsebino samo prvi klik
var type = $("#type").val();
var period = $("#period").val();
@@ -3707,20 +3652,15 @@ function ip_list_podrobno (what) {
$("#ip_list_podrobno").slideDown();
$(what).attr('value','1');
});
- } else if ($(what).attr('value') == '1') { // skrijemo
+ }
+ else if ($(what).attr('value') == '1') { // skrijemo
$("#ip_list_podrobno").slideUp();
$(what).attr('value','2');
- } else { // prikazemo
+ }
+ else { // prikazemo
$("#ip_list_podrobno").slideDown();
$(what).attr('value','1');
}
-/*
- if ($('#ip_list_podrobno').css('display') == 'none') {
- $('#ip_list_podrobno').slideDown();
- } else {
- $('#ip_list_podrobno').slideUp();
- }
- */
}
function survey_statistic_status(status) {
$('#fullscreen').html('').fadeIn('slow').draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'});
@@ -3749,7 +3689,7 @@ function save_user_settings() {
var icons_always_on = $("input[name=icons_always_on]:checked").val();
var full_screen_edit = $("input[name=full_screen_edit]:checked").val();
$.post('ajax.php?a=save_user_settings', {icons_always_on: icons_always_on, full_screen_edit: full_screen_edit}, function() {
- show_success_save();
+ actionNotePopup('success_save', 'success');
});
}
@@ -3760,24 +3700,13 @@ function updateManual1() {
$("#radioManual1").attr("checked", "checked");
}
-function show_success_save(timeout){
-
- if (timeout == undefined)
- timeout = 2500;
-
- $(".btn_savesettings").addClass('ovalbutton_orange').removeClass('ovalbutton_orange');
- $('#success_save').load('ajax.php?a=display_success_save', {anketa: srv_meta_anketa_id}).show();
-
- setTimeout(function() {$('#success_save').animate({opacity:0})}, timeout);
-}
-
function chnage_full_screen_edit() {
//srv_meta_full_screen_edit = $("input[name=full_screen_edit]:checked").val();
srv_meta_full_screen_edit = $("input[name=full_screen_edit]").is(':checked') ? 1 : 0;
$.post('ajax.php?a=save_user_settings', {anketa: srv_meta_anketa_id, full_screen_edit: srv_meta_full_screen_edit}, function() {
- show_success_save();
+ actionNotePopup('success_save', 'success');
});
}
@@ -3826,9 +3755,16 @@ function doExcelExport() {
//return false;
*/
}
-function excelExportChangeDelimit() {
- $('#replace_export_delimit_semicolon').toggle();
- $('#replace_export_delimit_comma').toggle();
+function excelExportChangeDelimit($param) {
+ if ($param == 1) {
+ $('#replace_export_delimit_semicolon').removeClass('displayNone');
+ $('#replace_export_delimit_comma').addClass('displayNone');
+ }
+ else if ($param == 2) {
+ $('#replace_export_delimit_semicolon').addClass('displayNone');
+ $('#replace_export_delimit_comma').removeClass('displayNone');
+ }
+
return false;
}
@@ -3899,6 +3835,25 @@ function check_valid_variable(variable) {
return result;
}
+function check_valid_radio_variable(variable) {
+
+ var ValidPattern = /^[0-9\-]*$/;
+ var result = '';
+
+ for (var i=0; i<variable.length; i++) {
+ var chr = variable.charAt(i);
+
+ // Radio ima lahko samo number
+ if (ValidPattern.test(chr) ){
+ result = result + chr;
+ }
+ }
+
+ result = result.substring(0, 15);
+
+ return result;
+}
+
function clearDefaultValue(el) {
if (el.defaultValue==el.value) el.value = ""
}
@@ -3910,6 +3865,22 @@ function showSearch() {
$('#searchSurvey').animate({width: 'toggle'});
}
+// search for data table
+function showDataTableSearch() {
+ if($('#data_search_value').is(":visible"))
+ $('#data_search_filter').css('background-color', '#f8f8f8');
+ else
+ $('#data_search_filter').css('background-color', 'white');
+
+ $('#data_search_value').animate({width: 'toggle'});
+}
+
+// clear search for data table
+function clearDataTableSearch() {
+ $('#data_search_value').val('');
+ data_search_filter();
+}
+
function showSearchb() {
//$('#searchSurvey').toggle("blind", { direction: 'horizontal', start: }, 500);
//$('#searchSurvey').animate({width: 'toggle'});
@@ -3929,11 +3900,11 @@ function showAdvancedSearch(){
if ($('#advancedSearch').is(":visible")) {
$('#advancedSearch').slideUp('slow');
- $('#searchSettings').find('.minus').removeClass('minus').addClass('plus');
+ $('#advanced_settings_button').removeClass('active');
}
else {
$('#advancedSearch').slideDown('slow');
- $('#searchSettings').find('.plus').removeClass('plus').addClass('minus');
+ $('#advanced_settings_button').addClass('active');
}
}
@@ -4010,6 +3981,35 @@ function dostopPassiveShowAll(show_hide) {
}
}
+function dostopNoteToggle () {
+
+ if($('#addusers_note_checkbox').is(':checked')){
+ $('#addusers_note').removeClass('displayNone');
+ }
+ else{
+ $('#addusers_note').addClass('displayNone');
+ }
+}
+
+// Ajax klic za dodajanje dostopa in posiljanje obvestila
+function dostopAddAccess () {
+
+ var addusers = $('#addusers').val();
+ var addusers_note = '';
+ if($('#addusers_note_checkbox').is(':checked')){
+ addusers_note = $('#addusers_note').val();
+ }
+
+ // Popup z rezultatom (uspesno ali neuspesno dodajanje dostopa)
+ $('#fade').fadeTo('slow', 1);
+ $('#general_popup').html('').fadeIn('slow');
+ $("#general_popup").load('ajax.php?a=add_survey_dostop_popup', {addusers:addusers, addusers_note:addusers_note, anketa:srv_meta_anketa_id}, function(){
+
+ // Refresh vsebine v ozadju
+ $("#globalSetingsList").load('ajax.php?a=refresh_dostop_settings', {anketa:srv_meta_anketa_id});
+ });
+}
+
function comments_admin_toggle (type) {
if ( $('#comments_admin'+type).attr('admin_on') == 'true' ) {
comments_admin_off(type);
@@ -4228,10 +4228,8 @@ function add_to_library(anketa,where) {
$.post('ajax.php?a=add_to_library', {anketa:anketa, where:where});
}
-function create_archive_survey(anketa, msg) {
+function create_archive_survey(anketa) {
$('#fade').fadeTo('slow', 1);
- $('#fullscreen').html('').fadeIn('slow').draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'});
- $('#fullscreen').append('<div id="survey_archive_note">'+msg+'</div>');
$.post('index.php?anketa='+anketa+'&a=backup_create', {intro_opomba: $('#intro_opomba').val()},
function() {
window.location.reload();
@@ -4239,10 +4237,8 @@ function create_archive_survey(anketa, msg) {
return false;
}
-function create_archive_survey_data(anketa, msg) {
+function create_archive_survey_data(anketa) {
$('#fade').fadeTo('slow', 1);
- $('#fullscreen').html('').fadeIn('slow').draggable({delay:100, cancel: 'input, textarea, select, .buttonwrapper'});
- $('#fullscreen').append('<div id="survey_archive_note">'+msg+'</div>');
$.post('ajax.php?anketa='+anketa+'&a=backup_data&data=true', {intro_opomba: $('#intro_opomba').val()},
function() {
window.location.reload();
@@ -4315,7 +4311,7 @@ function surveyBaseSettingRadio(what,foreceReload) {
//} else if (data.action == 1) {
}
} else {
- alert(data.msg);
+ genericAlertPopup('alert_parameter_datamsg',data.msg);
}
});
}
@@ -4327,7 +4323,7 @@ function surveyBaseSettingText(what,refresh) {
} else if ($('[name='+what+']').length) {
value = $('[name='+what+']').val();
} else {
- alert('Error while saving!');
+ genericAlertPopup('alert_save_error');
return false;
}
@@ -4340,7 +4336,7 @@ function surveyBaseSettingText(what,refresh) {
// todo show save window
}
} else {
- alert(data.msg);
+ genericAlertPopup('alert_parameter_datamsg',data.msg);
}
});
}
@@ -4354,9 +4350,9 @@ function alert_custom(type, uid) {
}
-function exportChangeCheckbox (name) {
-
- $.post('ajax.php?a=exportChangeCheckbox', {anketa:srv_meta_anketa_id, name:name});
+function exportChangeCheckbox () {
+ var value = $("input[name=exportSetting]:checked").val();
+ $.post('ajax.php?a=exportChangeCheckbox', {anketa:srv_meta_anketa_id, value:value});
}
function exportChangeRadio (id,name) {
@@ -4364,17 +4360,43 @@ function exportChangeRadio (id,name) {
$.post('ajax.php?a=exportChangeRadio', {anketa:srv_meta_anketa_id, id:id, name:name, value:value});
}
function setExpirePermanent() {
+ // check for warnings of IF
+ $.post('ajax.php?t=branching&a=check_pogoji&izpis=short', {anketa: srv_meta_anketa_id}, function (data) {
+ // if there are warning, we dont allow change of statement
+ if (data !== '1') {
+ //reset checkox to initial state
+ $("#expirePermanent").prop('checked', !$("#expirePermanent").is(':checked'));
+ $('#fade').fadeTo('slow', 1);
+ $('#fullscreen').html('').fadeIn('slow');
+ // aktiviramo anketo in prikažemo okno
+ $("#fullscreen").load('ajax.php?a=anketa_show_activation', {anketa: srv_meta_anketa_id, folders: folders, izpis:'only_warnings'}, function() {
+ });
+ }
+ //all ok, proced with set permanent
+ else{
+ setExpirePermanentSetting();
+ }
+ });
+}
+function setExpirePermanentSetting() {
makePermanent = $("#expirePermanent").is(':checked');
$.post('ajax.php?a=setExpirePermanent', {anketa:srv_meta_anketa_id, makePermanent:makePermanent}, function (data) {
data = jQuery.parseJSON(data);
if (data.permanent == '0') {
- // pokažemo koledarcek
- $("#expire_img_manual1").show();
+ // enablamo polje
+ $("#expireManual1").removeClass("disabled");
+ $("#expire").find(".ui-datepicker-trigger").removeClass("disabled");
+
} else {
- // skrijemo koledarcek
- $("#expire_img_manual1").hide();
+ // disablamo polje
+ $("#expireManual1").addClass("disabled");
+ $("#expire").find(".ui-datepicker-trigger").addClass("disabled");
+
}
$("#expireManual1").val(data.expire);
+
+ // reload, da se na strani prika#e anketa kot aktivna (switch, link,...)
+ window.location.reload(); return;
});
}
@@ -4389,35 +4411,25 @@ function changeDoCMSUserFilterCheckbox() {
function anketa_restore(anketa) {
- if ( confirm('?') ) {
-
+ if ( confirm(lang['srv_anketa_deleted_restore_confirm']) ) {
$.post('ajax.php?a=anketa_restore', {id: anketa}, function () {
-
window.location.href = 'index.php?anketa='+anketa;
-
})
-
}
-
}
function data_restore(anketa) {
- if ( confirm('?') ) {
-
+ if ( confirm(lang['srv_data_deleted_restore_confirm']) ) {
$.post('ajax.php?a=data_restore', {id: anketa}, function () {
-
window.location.href = 'index.php?anketa='+anketa;
-
})
-
}
-
}
function deleteSurveyDataFile(note) {
if (confirm(note)) {
- $.post('ajax.php?a=deleteSurveyDataFile', {anketa:srv_meta_anketa_id}, function (result) {alert(result)});
+ $.post('ajax.php?a=deleteSurveyDataFile', {anketa:srv_meta_anketa_id}, function (result) {genericAlertPopup('alert_parameter_response',response)});
}
}
function userGlobalSettingChange(what) {
@@ -4430,7 +4442,7 @@ function userGlobalSettingChange(what) {
var state = $(what).is(':checked') ? value : '0';
$.post('ajax.php?t=globalUserSettings', {name:name, value:state}, function (data) {});
} else {
- alert("TODO:userGlobalSettingChange ("+type+")");
+ genericAlertPopup('alert_userGlobalSettingChange',type);
}
}
function changeSurveyLock(what) {
@@ -4505,8 +4517,8 @@ function testiranje_preview_settings_save () {
function showTestSurveySMTP()
{
$('#fade').fadeTo('slow', 1);
- $('#fullscreen').html('').fadeIn('slow');
- $("#fullscreen").load('ajax.php?t=showTestSurveySMTP', $('form[name="settingsanketa_'+srv_meta_anketa_id+'"]').serialize(), function() {});
+ $('#general_popup').html('').addClass('PopUpNarrow').fadeIn('slow');
+ $("#general_popup").load('ajax.php?t=showTestSurveySMTP', $('form[name="settingsanketa_'+srv_meta_anketa_id+'"]').serialize(), function() {});
return false;
}
@@ -4514,7 +4526,7 @@ function showTestSurveySMTP()
function showSurveyUrlLinks(podstran, m)
{
$('#fade').fadeTo('slow', 1);
- $('#fullscreen').html('').fadeIn('slow');
+ $('#fullscreen').html('').addClass('divPopUp').fadeIn('slow');
$("#fullscreen").load('ajax.php?t=SurveyUrlLinks&a=showLinks',
{
anketa:srv_meta_anketa_id,
@@ -4524,7 +4536,7 @@ function showSurveyUrlLinks(podstran, m)
return false;
}
-function addSurveyUrlLink(podstran ,m)
+function addSurveyUrlLink(podstran, m)
{
$("#fullscreen").load('ajax.php?t=SurveyUrlLinks&a=addLink',
{
@@ -4556,13 +4568,28 @@ function changeParaAnalysisCbx(what, reverse) {
value = !value;
}
var what_id = $(what).attr('id');
-
+
$.post('ajax.php?t=ParaAnalysis&a=setCbx', {anketa: srv_meta_anketa_id,value:value,what:what_id}, function () {
window.location.reload();
});
return false;
}
+
+function check_para_wrap() {
+
+ var value = $("#show_with_zero").is(":checked");
+ if (value) {
+ $("#scroll1").removeClass("table-horizontal-scroll-wrapper1");
+ $("#scroll2").removeClass("table-horizontal-scroll-wrapper2");
+ }
+ else {
+ $("#scroll1").addClass("table-horizontal-scroll-wrapper1");
+ $("#scroll2").addClass("table-horizontal-scroll-wrapper2");
+ }
+
+}
+
function changeParaAnalysisSelect(what) {
var value = $(what).val();
@@ -4660,17 +4687,24 @@ function toggleAdvancedModule(what, reload){
function toggleDataCheckboxes(podstran){
+ if (podstran == 'paraAnalysisGraph'){
+ $("#anketa").addClass("drop_setting_transition");
+ $("#anketa").toggleClass("drop_setting_margin");
+ }
+
if($('#dataSettingsCheckboxes').css('display') == 'none'){
- $("#dataSettingsCheckboxes").slideDown("slow");
+ $("#dataSettingsCheckboxes").fadeIn("medium");
+ $("#toggleDataCheckboxes").addClass("active");
var showSettings = 1;
-
- $(".dropdown_blue").switchClass("dropdown_blue", "dropup_blue");
+
+ $(".fa-angle-down").switchClass("fa-angle-down", "fa-angle-up");
}
else{
- $("#dataSettingsCheckboxes").slideUp("slow");
+ $("#dataSettingsCheckboxes").fadeOut("medium");
+ $("#toggleDataCheckboxes").removeClass("active");
var showSettings = 0;
- $(".dropup_blue").switchClass("dropup_blue", "dropdown_blue");
+ $(".fa-angle-up").switchClass("fa-angle-up", "fa-angle-down");
}
if(podstran == 'data'){
@@ -4683,6 +4717,28 @@ function toggleDataCheckboxes(podstran){
}
}
+function toggle_drop_settings_margin(){
+ $("#anketa").addClass("drop_setting_margin");
+}
+
+// Preklop tabele s podatki - fullscreen / navaden pogled
+function data_fullscreen(data_fullscreen){
+
+ // Fullscreen
+ if(data_fullscreen == 1){
+ $('body').addClass('data_fullscreen');
+ $('#data_fullscreen_1').addClass('active');
+ $('#data_fullscreen_0').removeClass('active');
+ }
+ else{
+ $('body').removeClass('data_fullscreen');
+ $('#data_fullscreen_0').addClass('active');
+ $('#data_fullscreen_1').removeClass('active');
+ }
+
+ $.post('ajax.php?t=dataSettingProfile&a=changeDataFullscreen', {anketa: srv_meta_anketa_id, data_fullscreen:data_fullscreen});
+}
+
// Iskanje po tabeli s podatki
function data_search_filter(){
@@ -4789,12 +4845,9 @@ function diagnosticsParadataChooseDate(){
});
}
function changeSelectOption(){
- //console.log($("#diagnostics_date_selected").val());
- //console.log($("#diagnostics_date_selected").find(":selected").val());
$("#diagnostics_date_selected").find(":selected").prop('selected',false);
//$("#diagnostics_date_selected option").find("[value=99data]").prop('selected',true);
$("#option_99date").prop('selected',true);
- //console.log($("#diagnostics_date_selected").find(":selected").val());
diagnosticsChooseDate();
}
/** END FLOAT HEADER function for tables and div **/
@@ -4809,21 +4862,22 @@ function inline_jezik_edit(id_value){
id.siblings('.sb-edit').hide();
id.replaceWith('<div class="fixed-position"><div id="vrednost_edit">'+
+
+ '<h2><span class="faicon edit-vprasanje st-besede-popup blue"></span><span>'+lang['srv_editor_title']+'</span></h2>'+
+
+ '<div class="popup_close"><a href="#" onclick="inline_jezik_reset(\''+id_value+'\');">✕</a></div>'+
- '<br><textarea name="'+id_value+'" id="'+id_value+'">'+id.html()+'</textarea>'+
+ '<textarea name="'+id_value+'" id="'+id_value+'">'+id.html()+'</textarea>'+
// Hidden textarea kamor shranimo staro vrednost, da jo lahko ponastavimo
- '<textarea name="old_val_'+id_value+'" style="visibility:hidden; display:none;">'+id.html()+'</textarea><br />'+
+ '<textarea name="old_val_'+id_value+'" style="visibility:hidden; display:none;">'+id.html()+'</textarea>'+
- // Gumb shrani
- '<span class="buttonwrapper floatRight"><a class="ovalbutton ovalbutton_orange" href="#" onclick="inline_jezik_save(\''+id_value+'\');">'+
- '<span>'+lang['save']+'</span>'+
- '</a></span>'+
-
- // Gumb zapri
- '<span class="buttonwrapper floatRight spaceRight"><a class="ovalbutton ovalbutton_gray" href="#" onclick="inline_jezik_reset(\''+id_value+'\');">'+
- '<span>'+lang['srv_zapri']+'</span>'+
- '</a></span><br><br>'+
+ // Gumb shrani / zapri
+
+ '<div class="button_holder popup">'+
+ '<button class="white-blue medium" onclick="inline_jezik_reset(\''+id_value+'\');">'+lang['srv_zapri']+'</button>'+
+ '<button class="blue medium" onclick="inline_jezik_save(\''+id_value+'\');">'+lang['save']+'</button>'+
+ '</div>'+
'</div></div>');
@@ -4951,6 +5005,125 @@ function close_API_window(){
}
+// Prikaz popupap za izvoz paketa anket
+function archive_surveys_display_export(){
+ $('#fade').fadeTo('slow', 1);
+ $('#general_popup').html('').addClass('PopUpNarrow').fadeIn('slow');
+ $("#general_popup").load('ajax.php?t=archiveSurveys&a=display_export');
+}
+
+// Toggle checkboxov za seznam anket za izvoz
+function archive_surveys_export_toggle(val){
+
+ // oznacimo vse checkboxe
+ if(val == 1){
+ $(".survey_archive_checkbox").attr("checked", "true");
+ $("#switch_on").addClass("displayNone");
+ $("#switch_off").removeClass("displayNone");
+ }
+ else{
+ $('.survey_archive_checkbox').removeAttr('checked');
+ $("#switch_off").addClass("displayNone");
+ $("#switch_on").removeClass("displayNone");
+ }
+
+ archive_surveys_export_counter();
+}
+
+// Posodobimo stevilo oznacenih anket - counter
+function archive_surveys_export_counter(){
+
+ var selectedCheckboxes = $('.survey_archive_checkbox:checked');
+ var selectedCount = selectedCheckboxes.length;
+
+ $('#mass_select_counter_number').text(selectedCount);
+}
+
+// Ustvari paket anket
+function archive_surveys_export(){
+
+ var form_serialize = $("#survey_archive_form").serializeArray();
+
+ $("#general_popup").load('ajax.php?t=archiveSurveys&a=export', form_serialize);
+}
+
+// Download Izvoza paketa anket
+function archive_surveys_download_export(url) {
+
+ var link = $('<a>', {
+ href: url,
+ target: '_blank',
+ download: url.substring(url.lastIndexOf('/') + 1)
+ });
+
+ link.on('click', function() {
+ $(this).remove();
+ });
+
+ $('body').append(link);
+ link[0].click();
+
+ popupClose();
+}
+
+// Prikaz popupa za uvoz paketa anket
+function archive_surveys_display_import(){
+ $('#fade').fadeTo('slow', 1);
+ $('#general_popup').html('').addClass('PopUpNarrow').fadeIn('slow');
+ $("#general_popup").load('ajax.php?t=archiveSurveys&a=display_import');
+}
+
+// Izbran paket za uvoz - preverimo ce je zip in prikazemo gumb za uvoz
+function archive_surveys_select_import(){
+
+ var fileInput = $('#archive_surveys_input')[0];
+ var fileName = fileInput.value;
+ //var fileName = $('#archive_surveys_input').val();
+ var fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
+ var fileSize = fileInput.files[0].size;
+
+ var warningFileSize = 5 * 1024 * 1024;
+ var maxFileSize = 20 * 1024 * 1024;
+
+ // Napaka - paket ni zip
+ if (fileExtension !== 'zip') {
+ $('#archive_surveys_error').removeClass('displayNone');
+ $('#archive_surveys_import_button, #archive_surveys_error2, #archive_surveys_error3').addClass('displayNone');
+ }
+ // Napaka - paket je vecji od 20 mb
+ else if (fileSize > maxFileSize) {
+ $('#archive_surveys_error3').removeClass('displayNone');
+ $('#archive_surveys_import_button, #archive_surveys_error, #archive_surveys_error2').addClass('displayNone');
+ }
+ // Opozorilo - paket je vecji od 5 mb
+ else if (fileSize > warningFileSize) {
+ $('#archive_surveys_error2, #archive_surveys_import_button').removeClass('displayNone');
+ $('#archive_surveys_error, #archive_surveys_error3').addClass('displayNone');
+ }
+ else {
+ $('#archive_surveys_import_button').removeClass('displayNone');
+ $('#archive_surveys_error, #archive_surveys_error2, #archive_surveys_error2').addClass('displayNone');
+ }
+}
+
+// Izvedemo uvoz paketa anket
+function archive_surveys_import(){
+
+ var formData = new FormData($('#restore')[0]);
+
+ $.ajax({
+ url: 'ajax.php?t=archiveSurveys&a=import',
+ type: 'POST',
+ data: formData,
+ processData: false,
+ contentType: false,
+ success: function(response) {
+ $("#general_popup").html(response);
+ }
+ });
+}
+
+
// Nastavitve modula za chat
function chat_save_settings() {
@@ -4958,7 +5131,7 @@ function chat_save_settings() {
var chat_type = $('input[name=chat_type]:checked').val();
$.post('ajax.php?t=chat&a=save_settings', {anketa: srv_meta_anketa_id, code:code, chat_type:chat_type}, function(){
- show_success_save();
+ actionNotePopup('success_save', 'success');
});
}
@@ -4970,7 +5143,7 @@ function quiz_save_settings() {
var results_chart = $("input[name=quiz_results_chart]:checked").val();
$.post('ajax.php?t=quiz&a=save_settings', {anketa: srv_meta_anketa_id, results:results, results_chart:results_chart}, function(){
- show_success_save();
+ actionNotePopup('success_save', 'success');
});
}
@@ -4981,7 +5154,7 @@ function advanced_paradata_save_settings() {
var collect_post_time = $("input[name=collect_post_time]:checked").val();
$.post('ajax.php?t=advanced_paradata&a=save_settings', {anketa: srv_meta_anketa_id, collect_post_time:collect_post_time}, function(){
- show_success_save();
+ actionNotePopup('success_save', 'success');
});
}
// brisanje vseh podatkov ankete pri naprednih parapodatkih
@@ -5003,8 +5176,27 @@ function panel_save_settings() {
var status_default = $('input[name=status_default]').val();
var url = $('input[name=url]').val();
- $("#globalSettingsInner").load('ajax.php?t=panel&a=save_settings', {anketa: srv_meta_anketa_id, user_id_name:user_id_name, status_name:status_name, status_default:status_default, url:url}, function(){
- show_success_save();
+ var cookie_return = $('input[name=cookie_return]:checked').val();
+
+ var continue_later = 0;
+ continue_later = $('input[name=continue_later]:checked').val();
+
+ $("#globalSettingsInner").load('ajax.php?t=panel&a=save_settings', {anketa: srv_meta_anketa_id, user_id_name:user_id_name, status_name:status_name, status_default:status_default, url:url, cookie_return:cookie_return, continue_later:continue_later}, function(){
+ actionNotePopup('success_save', 'success');
+ });
+}
+
+
+// Nastavitve modula za dostop z emailom
+function email_access_save_settings() {
+
+ var captcha = 0;
+ captcha = $('input[name=captcha]:checked').val();
+
+ var terms_text = $('textarea[name=terms_text]').val();
+
+ $("#globalSettingsInner").load('ajax.php?t=email_access&a=save_settings', {anketa:srv_meta_anketa_id, captcha:captcha, terms_text:terms_text}, function(){
+ actionNotePopup('success_save', 'success');
});
}
@@ -5102,7 +5294,6 @@ function setCheckedClass(element, type, ifId){
//Image HotSpot: brisemo obmocja iz slike
image1.mapster('set', false, loop_id); //spucaj trenutno obmocje iz slike
- //console.log(loop_id);
}
});
@@ -5139,9 +5330,6 @@ function evoli_tm_settings_add_oddelek(tm_id) {
}
-// Zakaj je to tukaj?? - ne sme biti tako, ker drugače povozi funkcijo z istim imenom v main/survey (ce se kdaj klice iz tam - recimo pri komentarjih)
-//function checkBranching(){}
-
// Popravimo crte med vprasanji ce imamo blok s horizontalnim izrisom vprasanj
function blockHorizontalLine(spr_id){
@@ -5187,11 +5375,11 @@ function save1kaRacunSettings(){
}
// Gesla nista enaka
else if(geslo1 != geslo2){
- alert(lang['cms_error_password_incorrect']);
+ genericAlertPopup('cms_error_password_incorrect');
}
// Geslo ni dovolj kompleksno
else if(!complexPassword(geslo1)){
- alert(lang['password_err_complex']);
+ genericAlertPopup('password_err_complex');
}
// Pri popravljanju gesla ga opozorimo, da bo odjavljen
else{
@@ -5241,14 +5429,17 @@ function stringContains(password, allowedChars){
*
* @param id
*/
-function izbrisiAlternativniEmail(id){
- if (confirm(lang['delete_alternative_email'])) {
+function izbrisiAlternativniEmail(id, email){
+
+ if (confirm(lang['alternative_email_delete'] + ' ' + email + '?')) {
+
$.post('ajax.php?a=editanketasettings&m=global_user_myProfile', {
izbrisiAlternativniEmail: 1,
- alternativniEmailId: id
+ alternativniEmailId: id
}).success(function(response){
window.location.reload();
});
+
}
}
@@ -5291,63 +5482,53 @@ function check_akronim() {
/* START FUNKCIJA ZA UREJANJE zakljucka po deaktivaciji - popup v urejanju zakljucka */
function vprasanje_jezik_edit_zakljucek(id_value){
- /*$('#fade').fadeTo('slow', 1);*/
+ $('#fade').fadeTo('slow', 1);
var id = $("#"+id_value);
- id.replaceWith('<div class="fixed-position"><div id="vrednost_edit">'+
-
- '<br /><textarea name="'+id_value+'" id="'+id_value+'">'+id.val()+'</textarea>'+
-
- // Hidden textarea kamor shranimo staro vrednost, da jo lahko ponastavimo
- '<textarea name="old_val_'+id_value+'" style="visibility:hidden; display:none;">'+id.val()+'</textarea><br />'+
+ $('#vrednost_edit').show().html(
+ '<h2><span class="faicon edit-vprasanje st-besede-popup blue"></span><span>'+lang['srv_concl_deactivation_text_edit']+'</span></h2>'+
- // Gumb shrani
- '<span class="buttonwrapper floatRight"><a class="ovalbutton ovalbutton_orange" href="#" onclick="vprasanje_jezik_save_zakljucek(\''+id_value+'\');">'+
- '<span>'+lang['save']+'</span>'+
- '</a></span>'+
-
- // Gumb zapri
- '<span class="buttonwrapper floatRight spaceRight"><a class="ovalbutton ovalbutton_gray" href="#" onclick="vprasanje_jezik_reset_zakljucek(\''+id_value+'\');">'+
- '<span>'+lang['srv_zapri']+'</span>'+
- '</a></span>'+
-
- '</div></div>');
+ '<div class="popup_close"><a href="#" onclick="inline_jezik_reset(\''+id_value+'\');">✕</a></div>'+
+
+ '<textarea name="popup_'+id_value+'" id="popup_'+id_value+'">'+id.val()+'</textarea>'+
+
+ // Hidden textarea kamor shranimo staro vrednost, da jo lahko ponastavimo
+ '<textarea name="old_val_'+id_value+'" style="visibility:hidden; display:none;">'+id.html()+'</textarea>'+
+
+ // Gumb shrani / zapri
+ '<div class="button_holder popup">'+
+ '<button class="white-blue medium" onclick="vprasanje_jezik_reset_zakljucek(\''+id_value+'\');">'+lang['srv_zapri']+'</button>'+
+ '<button class="blue medium" onclick="vprasanje_jezik_save_zakljucek(\''+id_value+'\');">'+lang['save']+'</button>'+
+ '</div>'
+ );
- create_editor(id_value);
+ create_editor('popup_'+id_value);
}
-function vprasanje_jezik_reset_zakljucek(id_value){
-
- //$('#fade').fadeOut('slow');
-
- var id = $('#'+id_value);
- var old_val = $("textarea[name=old_val_"+id_value+"]").val();
-
- var par = id.closest('.fixed-position');
-
- CKEDITOR.instances[id_value].destroy();
+function vprasanje_jezik_reset_zakljucek(){
- par.replaceWith('<textarea name="srvlang_srv_survey_non_active" id="srvlang_srv_survey_non_active" style="width:190px">'+old_val+'</textarea>');
-
- // postavimo se na dno strani
- $('html, body').animate({scrollTop:$(document).height()}, 100);
+ $('#fade').fadeOut('slow');
+ $('#vrednost_edit').hide().html();
}
function vprasanje_jezik_save_zakljucek(id_value){
- var id = $('#'+id_value);
- var par = id.closest('.fixed-position');
-
- CKEDITOR.instances[id_value].destroy();
+ $('#fade').fadeOut('slow');
+
+ CKEDITOR.instances['popup_'+id_value].destroy();
- par.replaceWith('<textarea name="srvlang_srv_survey_non_active" id="srvlang_srv_survey_non_active" style="width:190px">'+id.val()+'</textarea>');
-
- $('html, body').animate({scrollTop:$(document).height()}, 100, function(){
- vprasanje_save(true);
- });
+ var value = $('#popup_'+id_value).val();
+ $('#'+id_value).val(value);
+
+ $('html, body').animate({scrollTop:$(document).height()}, 100, function(){
+ vprasanje_save(true);
+ });
+
+ $('#vrednost_edit').hide().html();
}
+
function prikaziGoogle2faKodo(){
$('#2fa-display').toggle();
}
@@ -5460,13 +5641,8 @@ $(document).ready(function(){
function consultingPopupOpen(){
$('#fade').fadeTo('slow', 1);
- $('#popup_note').html('').fadeIn('slow');
- $("#popup_note").load('ajax.php?a=consulting_popup_open', {anketa: srv_meta_anketa_id});
-}
-function consultingPopupClose(){
-
- $('#popup_note').fadeOut('slow').html('');
- $('#fade').fadeOut('slow');
+ $('#general_popup').html('').fadeIn('slow');
+ $("#general_popup").load('ajax.php?a=consulting_popup_open', {anketa: srv_meta_anketa_id});
}
@@ -5475,3 +5651,256 @@ function removeUploadFromData(usr_id, spr_id, code){
$("#fullscreen").load('ajax.php?t=postprocess&a=edit_data_question_upload_delete', {anketa: srv_meta_anketa_id, usr_id: usr_id, spr_id: spr_id, code: code});
}
+
+// Kopiranje URLja za anketo
+function CopyToClipboard(copyText){
+ var temp_copy = $('<input>').val(copyText).appendTo('body').select()
+ document.execCommand('copy')
+ temp_copy.remove()
+}
+
+// Popup - opozorilo na vsa vprašanja
+function popupAlertAll(alert_type){
+
+ $('#fade').fadeTo('slow', 1);
+ $('#general_popup').html('').addClass('PopUpNarrow').fadeIn('slow');
+ $("#general_popup").load('ajax.php?a=alert_all_popup', {alert_type:alert_type, anketa:srv_meta_anketa_id});
+}
+
+
+//Generičen alert popup
+function genericAlertPopup(name, optional_parameter, class_string){
+
+ if (optional_parameter === undefined) {
+ optional_parameter = "";
+ }
+ if (class_string !== undefined) {
+ $('#general_popup').addClass(class_string);
+ }
+ $('#fade').fadeTo('slow', 1);
+ $('#general_popup').html('').fadeIn('slow');
+ $("#general_popup").load('ajax.php?a=genericAlertPopup', {name:name, optional_parameter:optional_parameter});
+
+}
+
+//Toggle za prikaz nastavitev in opozoril v parapodatkih
+function toggleParapodatki(){
+
+ var survey_ip = $('input[name=survey_ip]:checked').val();
+ var survey_show_ip = $('input[name=survey_show_ip ]:checked').val();
+ var show_email = $('input[name=show_email ]:checked').val();
+
+ if(survey_ip == '0') {
+ $("#save_IP_warning").removeClass('displayNone');
+ $("#save_IP").removeClass('bottom0');
+ $("#connect_IP").removeClass('displayNone');
+ }
+
+ else {
+ $("#save_IP_warning").addClass('displayNone');
+ $("#save_IP").addClass('bottom0');
+ $("#connect_IP").addClass('displayNone');
+ }
+
+ if(survey_show_ip == '1')
+ $("#connect_IP_warning").removeClass('displayNone');
+
+ else
+ $("#connect_IP_warning").addClass('displayNone');
+
+ if(show_email == '1')
+ $("#connect_identifier_warning").removeClass('displayNone');
+
+ else
+ $("#connect_identifier_warning").addClass('displayNone');
+}
+
+
+function popupClose(){
+ $('#general_popup').fadeOut('slow').html('').attr('class', 'divPopUp');
+ $('#fade').fadeOut('slow');
+}
+
+
+// Note popup spodaj levo
+function actionNotePopup(name, type){
+
+ let anketa = (typeof srv_meta_anketa_id !== 'undefined') ? srv_meta_anketa_id : '';
+
+ $('#action_note_holder').html('').load('ajax.php?a=actionNotePopup', {anketa:anketa, name:name, type:type}, function(){
+
+ setTimeout(function(){
+ actionNotePopupClose();
+ }, 10000);
+ });
+}
+
+// Zapri note popup spodaj levo
+function actionNotePopupClose(){
+
+ $('#action_note_holder .action_note_box').fadeOut(function(){
+ $('#action_note_holder').html('');
+ });
+}
+
+//Hide top_note div
+function top_note_hide(id) {
+
+ $('#'+id).addClass('displayNone');
+
+}
+
+//Objava - pregled (gumbi)
+function publishPopupOpen(name){
+
+ $('#fade').fadeTo('slow', 1);
+ $('#general_popup').html('').fadeIn('slow');
+ $("#general_popup").load('ajax.php?a=publish_popup_open', {anketa: srv_meta_anketa_id, name: name});
+}
+
+//Objava - check lepi link
+function addPrettyURL(){
+ $.post('ajax.php?a=nice_url_check', {anketa: srv_meta_anketa_id, nice_url: $('#nice_url').val()},
+ function(response) {
+ console.log(response);
+ if(response==""){
+ $.redirect('ajax.php?a=nice_url', {anketa: srv_meta_anketa_id, nice_url: $('#nice_url').val()});
+ }
+ else{
+ $('#add_url_error').html(response).fadeIn('slow');
+ }
+ });
+ return false;
+}
+
+//Objava - prikaz dodajanje lepega linka
+function toggleNiceURL(type) {
+
+ if (type == 'show') {
+ $("#nice_url_button").addClass('displayNone');
+ $("#nice_url_holder").removeClass('displayNone');
+ }
+ else if (type == 'hide') {
+ $("#nice_url_button").removeClass('displayNone');
+ $("#nice_url_holder").addClass('displayNone');
+ }
+}
+
+//Objava - privzete nastavitve
+function togglePublishSettings() {
+ $("#srv_objava_info_more1, #srv_objava_info_more2").toggleClass("displayNone");
+ $("#publish_settings_more").slideToggle('medium');
+}
+
+//Aktivnost - toggle dropdown checkboxes
+function toggleAktivnostCheckboxes(type) {
+ if (type == 'units') {
+ $("#dataSettingsCheckboxes").fadeIn("medium");
+ $("#dataSettingsCheckboxes").toggleClass("displayNone");
+ $("#toggleDataCheckboxes").toggleClass("border_blue");
+ }
+ else if (type == 'date') {
+ $("#dataSettingsCheckboxes_Date").fadeIn("medium");
+ $("#dataSettingsCheckboxes_Date").toggleClass("displayNone");
+ $("#toggleDataCheckboxes_Date").toggleClass("border_blue");
+
+ }
+}
+
+function toggleAddComment (box_id) {
+
+ var toggle = '#comment_toggle_' + box_id;
+ var wrapper = '#comment_wrapper_' + box_id;
+
+ $(toggle).toggle();
+ $(wrapper).toggle();
+}
+
+function closeCommentQtip (box_id) {
+
+ var content = '#survey_comment_' + box_id;
+ $(content).closest('.qtip ').qtip("hide");
+}
+
+function toggleGrafiColorWheel () {
+ $("#chart_custom_skin_cover").css("pointer-events", "auto");
+}
+
+function toggleSurveyTopSettings() {
+ $("#top_napredne_gumb").toggleClass("border_blue");
+ $("#top_napredne_dropdown").toggleClass("displayNone");
+}
+
+//Vprašalnik - enklikarhiv gumb
+function oneClickArchive(){
+
+ $('#fade').fadeTo('slow', 1);
+ $('#general_popup').addClass('PopUpNarrow');
+ $('#general_popup').html('').fadeIn('slow');
+ $("#general_popup").load('ajax.php?a=oneClickArchive', {anketa: srv_meta_anketa_id});
+}
+
+
+
+// kliči popup
+function show_gdpr_messeage(id_sporocila, anketa){
+
+ $('#fade').fadeTo('slow', 1);
+ $('#general_popup').addClass('PopUpNarrow');
+ $('#general_popup').html('hello').fadeIn('slow');
+ $("#general_popup").load('ajax.php?a=show_gdpr_messeage', {id_sporocila: id_sporocila, anketa: anketa});
+
+}
+
+
+//Toggle za dodajanje uporabnika (admini in managerji)
+function toggleAddUser(value){
+ $('.add_user_option').addClass('displayNone');
+ $("#add_user_option_"+value).removeClass('displayNone');
+}
+
+
+function toggleAnketaOpomba () {
+ $("#dodaj-opombo").toggleClass('displayNone');
+}
+
+function toggleAnketaMapa () {
+ $("#dodaj-v-mapo").toggleClass('displayNone');
+ $("#anketa-toggle").toggleClass('bottom0');
+}
+
+//lahko se klice na onclick in downloada file iz url
+function download_file(url) {
+ const a = document.createElement('a')
+ a.href = url
+ a.download = url.split('/').pop()
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
+}
+
+//header when scrolling
+$(function() {
+ $(window).on("scroll", { passive: true }, function() {
+ var header = $(".desktop_header");
+ var top_center_settings = $("#branching .top_center_settings");
+
+ var scroll = $(window).scrollTop();
+
+ if (scroll > 190) {
+ top_center_settings.addClass("top_sticky");
+ header.addClass("shrink_header");
+ }
+ else if (0 < scroll && scroll <= 190) {
+ header.addClass("shrink_header");
+ top_center_settings.removeClass("top_sticky");
+ }
+ else if(scroll > 0){
+ header.addClass("shrink_header");
+ }
+ else {
+ header.removeClass("shrink_header");
+ top_center_settings.removeClass("top_sticky");
+ }
+ });
+}); \ No newline at end of file