2020-08-14 13:36:36 +02:00
//meta podatki
var loaded = false ;
var editor _init = false ; // ce smo ze inicializirali editor (se zgodi, ko prvic odpremo editor na strani)
var srv _meta _anketa _id ;
var srv _meta _podstran ;
var srv _meta _akcija ;
var srv _meta _grupa ;
var srv _meta _branching ;
var srv _meta _full _screen _edit ;
var activationTimer ; // timer za aktivacijo
var _moved = 0 ; // ce je blo vprasanje premaknjeno, potem ni blo kliknjeno in to preprecimo
var _fullscreen = 0 ; // pove, ce smo v fullscreen urejanju vprasanja (da vemo katero polje refreshat)
var forma _preview = 0 ; // ce draggamo novo vprasanje pri formah se nastavi na 1 - da ne prikazemo preview-ja
var _ _vnosi = 0 ; // pove ce smo v vnosih (1)
var _ _analiza = 0 ; // pove ce smo v analizi (1)
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 ( ) ;
2021-09-30 14:11:09 +02:00
srv _meta _anketa _hash = $ ( "#srv_meta_anketa_hash" ) . val ( ) ;
2020-08-14 13:36:36 +02:00
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 ) ;
2021-09-30 14:11:09 +02:00
2020-08-14 13:36:36 +02:00
loaded = true ;
} ;
// nastavimo da se prikaze loading ob AJAX klicih, po nekem casu prikazemo vecji loading, da se bolj opazi
function ajax _start _stop ( ) {
var t ;
$ ( 'body' ) . ajaxStart ( function ( ) {
t = setTimeout ( function ( ) { $ ( 'body' ) . addClass ( 'waitlong' ) ; } , 1000 ) ;
$ ( 'body' ) . addClass ( 'wait' ) ;
} ) . ajaxStop ( function ( ) {
clearTimeout ( t ) ;
$ ( 'body' ) . removeClass ( 'wait' ) . removeClass ( 'waitlong' ) ;
} ) ;
} ;
// razlicne stvari, ki se nastavijo na zacetku, ko se nalozi stran
function onload _init ( ) {
// info box
$ ( "#surveyInfo" ) . hover (
function ( ) {
isInfoOver = true ;
} ,
function ( ) {
isInfoOver = false ;
setTimeout ( function ( ) { hideBottomInfoBox ( ) } , 350 ) ;
}
) ;
$ ( '#surveyTrajanje_close' ) . click ( function ( ) {
$ ( '#surveyTrajanje' ) . fadeOut ( 'slow' ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
return false ;
} ) ;
// prikaz izvozov na hover cez ikono
hover _show _export ( ) ;
// prikaz nastavitev v urejanju ankete na hover cez ikono
hover _show _settings ( )
// prikaz vprasanj za dodajanje na hover cez ikono
hover _show _qtypes ( )
// prikaz filtrov na hover cez ikono
hover _show _filter ( )
hover _show _filter2 ( ) ;
// vsem input poljem ki imajo nastavljen attribut maxLength dodamo omejitev
// za izpis števila znakov dodamo span z id-jem, ki je enak input + "_chars"
$ ( 'input[maxlength]' ) . keyup ( function ( ) {
var max = parseInt ( $ ( this ) . attr ( 'maxlength' ) ) ;
if ( $ ( this ) . val ( ) . length > max ) {
$ ( this ) . val ( $ ( this ) . val ( ) . substr ( 0 , $ ( this ) . attr ( 'maxlength' ) ) ) ;
}
$ ( "#" + $ ( this ) . attr ( 'id' ) + '_chars' ) . html ( $ ( this ) . val ( ) . length + " / " + max ) ;
} ) ;
$ ( 'textarea[maxlength]' ) . keyup ( function ( ) {
var max = parseInt ( $ ( this ) . attr ( 'maxlength' ) ) ;
if ( $ ( this ) . val ( ) . length > max ) {
$ ( this ) . val ( $ ( this ) . val ( ) . substr ( 0 , $ ( this ) . attr ( 'maxlength' ) ) ) ;
}
$ ( "#" + $ ( this ) . attr ( 'id' ) + '_chars' ) . html ( $ ( this ) . val ( ) . length + " / " + max ) ;
} ) ;
// vse elemente z atributom srv_misc="true" shrani v tabelo srv_misc
$ ( "[srv_misc=true]" ) . bind ( "blur" , { } , function ( e ) {
if ( $ ( this ) . attr ( 'srv_misc' ) == "true" )
$ . post ( 'ajax.php?a=saveSrvMisc' , { what : $ ( this ) . attr ( "name" ) , value : $ ( this ) . val ( ) , podstran : srv _meta _podstran } ) ;
} ) ;
// vse elemente z atributom srv_survey_misc="true" shrani v tabelo
// srv_survey_misc
$ ( "[srv_survey_misc=true]" ) . bind ( "blur" , { } , function ( e ) {
if ( $ ( this ) . attr ( 'srv_survey_misc' ) == "true" )
$ . post ( 'ajax.php?a=saveSrvSurveyMisc' , { anketa : srv _meta _anketa _id , what : $ ( this ) . attr ( "name" ) , value : $ ( this ) . val ( ) , podstran : srv _meta _podstran } ) ;
} ) ;
$ ( "#startsManual" ) . on ( "click" , function ( event ) {
updateManual ( ) ;
return false ;
} ) ;
$ ( "#expireManual" ) . on ( "click" , function ( event ) {
updateManual ( ) ;
return false ;
} ) ;
$ ( "#startsManual1" ) . on ( "click" , function ( event ) {
updateManual1 ( ) ;
return false ;
} ) ;
$ ( "#expireManual1" ) . on ( "click" , function ( event ) {
updateManual1 ( ) ;
return false ;
} ) ;
$ ( '#anketa_activate_more' ) . on ( "click" , function ( event ) {
$ ( '#div_anketa_activate_more' ) . hide ( ) ;
$ ( '#anketa_activate_settings' ) . show ( ) ;
} ) ;
$ ( '#anketa_activate_note' ) . on ( "click" , function ( event ) {
stopActivationTimer ( ) ;
} ) ;
$ ( '#xtradiv strong' ) . on ( "click" , function ( event ) {
$ ( '#xtradivSettings' ) . toggle ( ) ;
} ) ;
2021-08-02 12:06:41 +02:00
$ ( '#test_user_alert span' ) . blink ( {
fadeIn : 100 ,
fadeOut : 200 ,
pauseShow : 500
} ) ;
2020-08-14 13:36:36 +02:00
// Search na vrhu po pritisku na enter skoci na drupal search
$ ( '#searchSurvey' ) . keypress ( function ( e ) {
if ( e . which == 13 ) {
executeDrupalSearch ( ) ;
return false ;
}
} ) ;
}
/ * *
* Called from onblur event in element for hash link comment update
* @ param { type } input - input cell
* @ returns { undefined }
* /
function hash _comment _change ( input ) {
$ . post ( 'ajax.php?t=SurveyUrlLinks&a=saveComment' ,
{ anketa : $ ( input ) . data ( 'anketa' ) , hash : $ ( input ) . attr ( 'data-hash' ) , comment : $ ( input ) . text ( ) } ) ;
}
/ * *
* Call on refresh param change
* @ param { type } input
* @ returns { undefined }
* /
function hash _refresh _change ( input ) {
var refresh = $ ( input ) . is ( ':checked' ) ? '1' : '0' ;
$ . post ( 'ajax.php?t=SurveyUrlLinks&a=saveRefresh' ,
{ anketa : $ ( input ) . data ( 'anketa' ) , hash : $ ( input ) . attr ( 'data-hash' ) , refresh : refresh } ) ;
}
/ * *
* Called from onblur event in element for hash link access password update
* @ param { type } input
* @ returns { undefined }
* /
function hash _access _password _change ( input ) {
$ . post ( 'ajax.php?t=SurveyUrlLinks&a=saveAccessPassword' ,
{ anketa : $ ( input ) . data ( 'anketa' ) , hash : $ ( input ) . attr ( 'data-hash' ) , access _password : $ ( input ) . text ( ) } ) ;
}
// funkcija za redirectat po poslanem POST ajax klicu
jQuery . redirect = function ( url , options ) {
$ . post ( url , options ,
function ( url _redirect ) {
window . location = url _redirect ;
}
) ;
}
// vrne ID containerja (diva) kamor se pisejo podatki ob editiranju vprasanj (odvisno je ce imamo fullscreen, normal, ali samo eno na desni v branchingu)
function getContainer ( spremenljivka ) {
if ( _fullscreen == 1 ) // fullscreen
return '#fullscreen' ;
if ( collapsed _content == 1 ) // normalen inline nacin
return '#spremenljivka_' + spremenljivka ;
else // v branchingu, ko je samo
// 1 na desni
return '#branching_vprasanja' ;
}
// obvestilo za upgrade browserja
function browser _alert ( ) {
// obvestilo za IE uporabnike pred verzijo 8
if ( $ . browser . msie && gup ( 'anketa' ) == "" ) { // samo na prvi strani
if ( parseInt ( $ . browser . version ) < 8 )
if ( confirm ( lang [ 'srv_upgrade_ie' ] ) ) {
window . location = 'http://www.microsoft.com/windows/internet-explorer/worldwide-sites.aspx' ;
}
}
}
// na hover prikaz export ikon
function hover _show _export ( ) {
var timer ;
$ ( "#hover_export_icon" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#hover_export" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#hover_export" ) . hide ( ) ;
} , 500 ) ;
}
) ;
$ ( "#hover_export" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#hover_export" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#hover_export" ) . hide ( ) ;
} , 500 ) ;
}
) ;
}
// na hover prikaz nastavitev v urejanju
function hover _show _settings ( ) {
var timer ;
$ ( "#toolbox_advanced_settings" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#toolbox_advanced_settings_holder" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#toolbox_advanced_settings_holder" ) . hide ( ) ;
} , 500 ) ;
}
) ;
$ ( "#toolbox_advanced_settings_holder" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#toolbox_advanced_settings_holder" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#toolbox_advanced_settings_holder" ) . hide ( ) ;
} , 500 ) ;
}
) ;
}
// na hover prikaz vprasanj v urejanju
function hover _show _qtypes ( ) {
var timer ;
$ ( ".new_adv" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#toolbox_add_advanced" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#toolbox_add_advanced" ) . hide ( ) ;
} , 500 ) ;
}
) ;
$ ( "#toolbox_add_advanced" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#toolbox_add_advanced" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#toolbox_add_advanced" ) . hide ( ) ;
} , 500 ) ;
}
) ;
}
// na hover prikaz filtrov (podatki, analize...)
function hover _show _filter ( ) {
var timer ;
$ ( "#filters_span" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#div_analiza_filtri_right" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#div_analiza_filtri_right" ) . hide ( ) ;
} , 500 ) ;
}
) ;
$ ( "#div_analiza_filtri_right" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#div_analiza_filtri_right" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#div_analiza_filtri_right" ) . hide ( ) ;
} , 500 ) ;
}
) ;
}
// na hover prikaz nastavitev (podatki, analize...) - ideja Vasje da se filtre razdeli na 2 ikoni
function hover _show _filter2 ( ) {
var timer ;
$ ( "#filters_span2" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#div_analiza_filtri_right2" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#div_analiza_filtri_right2" ) . hide ( ) ;
} , 500 ) ;
}
) ;
$ ( "#div_analiza_filtri_right2" ) . hover (
function ( ) {
clearTimeout ( timer ) ;
$ ( "#div_analiza_filtri_right2" ) . show ( ) ;
} ,
function ( ) {
timer = setTimeout ( function ( ) {
$ ( "#div_analiza_filtri_right2" ) . hide ( ) ;
} , 500 ) ;
}
) ;
}
// ----------------------- funkcije, ki se klicejo iz htmlja -----------------------
// doda novo anketo
function anketa ( ) {
var akronim = jQuery . trim ( $ ( "#novaanketa_akronim" ) . val ( ) ) ;
var naslov = jQuery . trim ( $ ( "#novaanketa_naslov" ) . val ( ) ) ;
var intro _opomba = jQuery . trim ( $ ( "#novaanketa_opis" ) . val ( ) ) ;
var survey _type = jQuery . trim ( $ ( "#survey_type" ) . val ( ) ) ;
$ . redirect ( 'ajax.php?a=anketa' , { naslov : naslov , intro _opomba : intro _opomba , akronim : akronim , survey _type : survey _type } ) ;
}
function new _anketa ( ) {
var naslov = $ ( "#novaanketa_naslov" ) . val ( ) ;
$ ( "#fullscreen" ) . load ( 'ajax.php?a=new_anketa' , { naslov : naslov } ) . fadeIn ( 'fast' ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
}
// prikaže info Box
var isInfoOver = false ;
var isInfoLoaded = false ;
function showInfoBox ( action , e ) {
2022-01-04 12:05:12 +01:00
if ( action == 'show' ) {
2020-08-14 13:36:36 +02:00
if ( ! isInfoLoaded ) {
$ ( '#surveyInfo_msg' ) . load ( 'ajax.php?a=displayInfoBox' , { anketa : srv _meta _anketa _id } ) ;
isInfoLoaded = true ;
}
2022-01-04 12:05:12 +01:00
}
2020-08-14 13:36:36 +02:00
}
function hideBottomInfoBox ( ) {
2022-01-04 12:05:12 +01:00
if ( isInfoOver == false )
2020-08-14 13:36:36 +02:00
$ ( '#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 ( ) } ) ;
}
2022-01-04 12:05:12 +01:00
2020-08-14 13:36:36 +02:00
// spremeni opombo ankete
function edit _anketa _note ( anketa ) {
$ . post ( 'ajax.php?a=edit_anketa_note' , { anketa : anketa , note : $ ( '#anketa_note' ) . val ( ) } ) ;
}
2022-01-04 12:05:12 +01:00
2020-08-14 13:36:36 +02:00
// spremeni akronim-kratko ime ankete
function edit _anketa _akronim ( anketa ) {
$ . post ( 'ajax.php?a=edit_anketa_akronim' , { anketa : anketa , akronim : $ ( '#anketa_akronim' ) . val ( ) } ) ;
}
// spremeni active status ankete
function anketa _active ( anketa , state , folders , hierarhija ) {
var hierarhija = hierarhija || 0 ;
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
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) ;
// aktiviramo anketo in prikažemo okno
$ ( "#fullscreen" ) . load ( 'ajax.php?a=anketa_show_activation' , { anketa : anketa , folders : folders } , function ( ) {
if ( hierarhija == 1 ) {
$ ( '#divAvtoClose' ) . hide ( ) ;
// Pošljemo zahtevek za aktiviranje hierarhije
hierarhija _active ( anketa ) ;
} else {
startTimerActivation ( anketa , folders ) ;
}
} ) ;
}
// anketa ima napake
else {
// izpišemo obvestilo o napakah
$ ( '#fade' ) . fadeIn ( 'slow' ) ;
$ ( '#surveyTrajanje' ) . fadeIn ( 'slow' ) ;
$ ( '#surveyTrajanje_msg' ) . html ( data ) ;
}
} ) ;
}
else
{ // pri deaktvaciji ne sprašujemo po datumih
// ali lahko disejblamo anketo
var canDisableSurvey = 'false' ;
// Preverimo ali je anketa trajna
$ . post ( 'ajax.php?&a=check_survey_permanent' , { anketa : anketa } , function ( response ) {
if ( response == 'true' ) {
// anketa je označena kot trajna, zato damo pred deaktivacijo alert
if ( confirm ( lang [ "srv_permanent_diable" ] ) ) {
canDisableSurvey = 'true' ;
} else {
canDisableSurvey = 'false' ;
}
} else {
canDisableSurvey = 'true' ;
}
if ( canDisableSurvey == 'true' ) {
// Vprašamo ali želi deaktivirat
if ( confirm ( lang [ "srv_disable" ] ) ) {
if ( folders == 'true' ) // ali smo v folderjih
{
// $('#folders').load('ajax.php?a=anketa_active&ajaxa='+gup("a"), {anketa: anketa, folders: folders});
// po novem osvezimo samo ikonico za aktivnost - STARA KNJIZNICA
if ( $ ( "ul#surveyList" ) . length ) {
$ ( "ul#surveyList" ) . find ( "li#anketa_list_" + anketa ) . find ( ".sl_active" ) . load ( 'ajax.php?a=anketa_active&ajaxa=' + gup ( "a" ) , { anketa : anketa , folders : folders } ) ;
}
// NOVA KNJIZNICA
else {
$ . post ( 'ajax.php?a=anketa_active&ajaxa=' + gup ( "a" ) , { anketa : anketa , folders : folders } , function ( ) {
window . location . reload ( ) ;
} ) ;
}
}
else
{
2020-11-04 11:45:57 +01:00
//$('#anketa_activation').load('ajax.php?a=anketa_active&ajaxa='+gup("a"), {anketa: anketa, folders: folders}, function() {
$ . post ( 'ajax.php?a=anketa_active&ajaxa=' + gup ( "a" ) , { anketa : anketa , folders : folders } , function ( ) {
2020-08-14 13:36:36 +02:00
window . location . reload ( ) ; return ;
} ) ;
}
}
}
} ) ;
}
}
function startTimerActivation ( anketa , folders ) {
var sec = $ ( '#divAvtoClose span' ) . text ( ) || 0 ;
var active = 1 ;
activationTimer = setInterval ( function ( ) {
active = $ ( '#divAvtoClose' ) . attr ( 'active' ) ;
if ( active == 1 || active == '1' ) {
$ ( '#divAvtoClose span' ) . text ( -- sec ) ;
if ( sec == 0 ) {
// ustavimo timer in
stopActivationTimer ( ) ;
// zapremo brez dodatnega shranjevanja anketa je tako že aktivirana
anketa _activate _save ( anketa , folders ) ;
}
} else {
stopActivationTimer ( ) ;
}
} , 1000 ) ;
}
//funkcija preveri, če je hierarhija že zgrajena
function hierarhija _active ( anketa _id ) {
$ . post ( "ajax.php?anketa=" + anketa _id + "&t=hierarhija-ajax&a=aktivacija_ankete" ) ;
}
/ * *
* Preverimo , če ima anketa ustrezna vprašanja za hierarhijo in ponudimo dodatne opcije
* /
function preveriAnketoZaHierarhijo ( anketa _id ) {
if ( $ ( '#advanced_module_hierarhija' ) . prop ( 'checked' ) ) {
$ . post ( "ajax.php?anketa=" + anketa _id + "&t=hierarhija-ajax&a=preveri-ustreznost-ankete" ) . success ( function ( response ) {
if ( response == 'dostop' )
return false ;
// Vklopi in default nastavitve
$ ( '#hierarhija-opcije-vklopa' ) . show ( ) ;
$ ( '#error' ) . html ( '' ) . hide ( ) ;
$ ( '#hierarhija-knjiznica' ) . html ( '' ) . hide ( '' ) ;
$ ( '#hierarhija-prevzeta' ) . html ( '' ) . hide ( ) ;
$ ( '.buttonwrapper a' ) . removeClass ( 'button_gray' ) . addClass ( 'ovalbutton_orange' ) ;
// Vse damona prevzeto
$ ( '#hierarhija-opcije-vklopa label' ) . each ( function ( ) {
$ ( this ) . find ( 'input' ) . removeAttr ( 'checked' ) . removeAttr ( 'disabled' ) ;
$ ( this ) . css ( 'color' , '' ) ;
} ) ;
if ( response == 'privzeta' ) {
// Onemogočena izbira lastne ankete, ker je ni
$ ( '#obstojeca-anketa' ) . attr ( 'disabled' , 'disabled' ) ;
$ ( '#obstojeca-anketa' ) . parent ( ) . css ( 'color' , '#bbb' ) ;
//izbira prevzete ankete
$ ( '#prevzeta-anketa' ) . attr ( 'checked' , 'checked' ) ;
pridobiKnjiznicoZaHierarhijo ( 'privzeta' ) ;
}
if ( response == 'napacen-tip' || response == 'samo-besedilni-tip' ) {
// Onemogočena izbira lastne ankete, ker je napaka v njej
$ ( '#obstojeca-anketa' ) . attr ( 'disabled' , 'disabled' ) ;
$ ( '#obstojeca-anketa' ) . parent ( ) . css ( 'color' , '#bbb' ) ;
// Doamo opozorilo, ker ni pravega tipa
if ( response == 'napacen-tip' )
$ ( '#error' ) . show ( ) . html ( lang [ 'srv_hierarchy_create_error_2' ] ) ;
// Opozorilo, ker je samo besedilo brez vprašaj tipa 6
if ( response == 'samo-besedilni-tip' )
$ ( '#error' ) . show ( ) . html ( lang [ 'srv_hierarchy_create_error_3' ] ) ;
}
// Ponovno aktiviramo modul
if ( response == 'ponovna-aktivacija' )
return toggleAdvancedModule ( 'hierarhija' , 1 ) ;
// Vse v redu izberemo obstoječo anketo
if ( response == 'ok' )
$ ( '#obstojeca-anketa' ) . attr ( 'checked' , 'checked' ) ;
} ) ;
} else {
$ ( '#hierarhija-opcije-vklopa' ) . hide ( ) ;
}
}
/ * *
* Pridobi vse ankete , ki so v knjižnici za hierarhijo
* /
function pridobiKnjiznicoZaHierarhijo ( vrsta ) {
$ ( '.ime-ankete' ) . hide ( ) ;
if ( vrsta == 'vse' )
$ . post ( 'ajax.php?anketa=' + srv _meta _anketa _id + '&t=hierarhija-ajax&a=get-all-hierarchy-library' , {
vrsta : 'vse'
} ) . success ( function ( response ) {
$ ( '#hierarhija-knjiznica' ) . html ( response ) . show ( ) ;
} ) ;
if ( vrsta == 'privzeta' ) {
setTimeout ( function ( ) {
var vsebina = '<span><a href="/main/survey/index.php?anketa=122986&preview=on" target="_blank" title="Predogled ankete">' +
'<span class="sprites preview"></span>' +
'</a></span>' ;
$ ( '#hierarhija-prevzeta' ) . html ( vsebina ) . show ( ) ;
} , 100 ) ;
}
if ( vrsta == 'nova' ) {
$ ( '.ime-ankete' ) . show ( ) ;
}
}
/ * *
* Glede na izbiro ankete aktiviraj modul hierarhija
* /
function potrdiIzbiroAnkete ( ) {
var izbira = $ ( '[name="izberi-anketo"]:checked' ) . val ( ) || 0 ;
// nič ni izbrano
if ( izbira == 0 )
return false ;
// če je obstoječa anketa potem samo aktiviramo modul
if ( izbira == 'obstojeca' )
return toggleAdvancedModule ( 'hierarhija' , 1 ) ;
if ( izbira == 'nova' )
ustvariPraznoAnketoInVkljuciModulSA ( ) ;
if ( izbira == 'prevzeta' )
kopirajPrevzetoAnketoAliIzKnjizniceZaHierarhijo ( 'privzeta' ) ; // ID anketa 122986 - privzeta na 1ka.si // 5544 je na test.1ka.si
if ( izbira == 'knjiznica' ) {
var knjiznica _id = $ ( '[name="knjiznica_izbira"]:checked' ) . val ( ) ;
kopirajPrevzetoAnketoAliIzKnjizniceZaHierarhijo ( knjiznica _id ) ;
}
}
/ * *
* UStvari prazno anketo in vključi modul SA
* /
function ustvariPraznoAnketoInVkljuciModulSA ( ) {
var survey _type = 2 ;
var naslov = jQuery . trim ( $ ( "#novaanketa_naslov" ) . val ( ) ) ;
if ( $ ( "#novaanketa_naslov_1" ) . length > 0 ) {
naslov = jQuery . trim ( $ ( "#novaanketa_naslov_1" ) . val ( ) ) ;
}
var akronim = naslov ;
if ( $ ( "#novaanketa_akronim_1" ) . length > 0 ) {
var akronim = jQuery . trim ( $ ( "#novaanketa_akronim_1" ) . val ( ) ) ;
}
var folder = '-1' ;
var intro _opomba = jQuery . trim ( $ ( "#novaanketa_opis" ) . val ( ) ) ;
if ( $ ( "#lang_resp" ) . length > 0 && $ ( "#lang_resp" ) . val ( ) > 0 ) {
var lang _resp = jQuery . trim ( $ ( "#lang_resp" ) . val ( ) ) ;
} else {
var lang _resp = 1 ;
}
var skin = '1kaBlue' ;
$ . redirect ( 'ajax.php?a=nova-anketa-in-hierarhija' , {
naslov : naslov ,
intro _opomba : intro _opomba ,
akronim : akronim ,
survey _type : survey _type ,
lang _resp : lang _resp ,
skin : skin ,
folder : folder ,
vkljuciHierarhijo : 1
} ) ;
// $.redirect('ajax.php?a=anketa', {naslov: naslov,fgdgdfgdgd intro_opomba: intro_opomba, akronim: akronim, survey_type:survey_type, lang_resp:lang_resp, skin:skin, folder:folder});
}
/ * *
* Kopiraj prevzeto anketo ali anketo iz knjižnice
*
* @ param int id
* @ return reload with new id
* /
function kopirajPrevzetoAnketoAliIzKnjizniceZaHierarhijo ( id ) {
// Kopiramo prevzeto anketo za SA - anketa
$ . post ( 'ajax.php?t=library&a=anketa_copy_new' , {
ank _id : id ,
hierarhija : 1 ,
novaHierarhjia : 1
} ) . success ( function ( response ) {
// Shranimo nov id ankete
srv _meta _anketa _id = response ;
// Vključimo modul hierarhija
toggleAdvancedModule ( 'hierarhija' , 0 ) ;
// Preusmerimo z novim anketa ID na gradnjo hierarhije
var url = window . location . origin + window . location . pathname ;
window . location = url + '?anketa=' + srv _meta _anketa _id + '&a=hierarhija_superadmin&m=uredi-sifrante' ;
} ) ;
}
function stopActivationTimer ( ) {
clearInterval ( activationTimer ) ;
$ ( '#divAvtoClose' ) . attr ( 'active' , 0 ) ;
$ ( '#divAvtoClose' ) . fadeOut ( 'fast' ) ;
}
function anketa _activate _save ( anketa , folders ) {
// ali imamo odprto okno z dodatnimi nastavitvami
var doSave = ( $ ( "#anketa_activate_settings" ) . css ( "display" ) == "none" ) ? false : true ;
if ( doSave == true ) {
// shraniti je potrebno morebine nove nastavitve
var durationType = $ ( "input[name=radioTrajanje]:checked" ) . val ( ) ;
var durationStarts = $ ( "#startsManual" ) . val ( ) ;
var durationExpire = $ ( "#expireManual" ) . val ( ) ;
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 ) ;
} ) ;
} else {
refresh _anketa _activation ( anketa , folders ) ;
}
}
function refresh _anketa _activation ( anketa , folders ) {
window . location . reload ( ) ; return ;
}
function autoCloseActivationDiv ( anketa , folders )
{
timeout = $ ( '#spanAvtoClose' ) . html ( ) ;
timeout -- ;
if ( $ ( '#divAvtoClose' ) . is ( ':visible' ) )
{
if ( timeout > 0 )
{
$ ( '#spanAvtoClose' ) . html ( timeout ) ;
closeTimeout = setTimeout ( function ( ) { autoCloseActivationDiv ( anketa , folders ) ; } , 1000 ) ;
}
else
{ // avtomatsko aktiviramo anketo (1 mesec)
anketa _setActive ( anketa , folders ) ;
}
}
}
// uporabnik je potrdil datume aktivacije
function anketa _setActive ( anketa , folders )
{ // TODO: kontrolo na datume expire < starts = alert(error)
var manual = $ ( "input[name=radioTrajanje]:checked" ) . val ( ) ;
if ( manual == 0 )
{
var starts = $ ( "#startsAuto" ) . html ( ) ;
var expire = $ ( "#expireAuto" ) . html ( ) ;
}
else
{
var starts = $ ( "#startsManual" ) . val ( ) ;
var expire = $ ( "#expireManual" ) . val ( ) ;
}
$ ( '#surveyTrajanje' ) . fadeOut ( 'slow' ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
if ( folders == 'true' )
{
// $('#folders').load('ajax.php?a=anketa_active&ajaxa='+gup("a"), {anketa: anketa, starts: starts, expire: expire, manual: manual, folders: folders});
// po novem osvezimo samo ikonico za aktivnost
$ ( "ul#surveyList" ) . find ( "li#anketa_list_" + anketa ) . find ( ".sl_active" ) . load ( 'ajax.php?a=anketa_active&ajaxa=' + gup ( "a" ) , { anketa : anketa , starts : starts , expire : expire , manual : manual , folders : folders } ) ;
}
else
{
$ ( '#anketa_active' ) . load ( 'ajax.php?a=anketa_active&ajaxa=' + gup ( "a" ) , { anketa : anketa , starts : starts , expire : expire , manual : manual , folders : folders } ,
function ( ) {
//reload tudi spodnjih ikon pri formah
if ( $ ( "#anketa_aktivacija_note" ) . length > 0 ) {
$ ( "#anketa_aktivacija_note" ) . load ( 'ajax.php?a=anketa_aktivacija_note' , { anketa : anketa } ) ;
}
if ( $ ( "#btn_mailto_preview_holder" ) . length > 0 ) {
// popravimo gumb za preview email vabil ce smo v email vabilih
$ ( "#btn_mailto_preview_holder" ) . load ( 'ajax.php?a=anketa_aktivacija_mailto_preview' , { anketa : anketa } ) ;
}
if ( $ ( "#trajna_anketa" ) . length > 0 ) {
// ce smo na trajanju osvezimo trajanje
$ ( "#anketa_edit" ) . load ( 'ajax.php?a=refresh_nastavitve_trajanje' , { anketa : anketa } ) ;
}
} ) ;
}
}
function anketa _lock ( anketa , locked , mobile _created ) {
if ( locked == 0 ) {
var text = lang [ 'srv_unlock_alert' ] ;
if ( mobile _created == 1 )
text += '\n\n' + lang [ 'srv_unlock_mobile' ] ;
if ( confirm ( text ) ) {
$ . redirect ( 'ajax.php?t=branching&a=anketa_lock' , { anketa : anketa , locked : locked } ) ;
}
} else {
$ . redirect ( 'ajax.php?t=branching&a=anketa_lock' , { anketa : anketa , locked : locked } ) ;
}
}
// spremeni ime ankete
function anketa _title _edit ( anketa , status , naslov ) {
//status: 1 = start edit; 2 = save; 3 = stop edit and save
if ( status == null || status == undefined ) {
status = 1 ;
}
if ( ( naslov == null || naslov == undefined ) && $ ( "#naslov_edit_box" ) && $ ( "#naslov_edit_box" ) . val ( ) !== 'undefined' ) {
naslov = $ ( "#naslov_edit_box" ) . val ( ) ;
}
// v spodnje okno dodelimo enako ime
if ( naslov != '' ) {
$ ( '#anketa_polnoIme' ) . val ( naslov ) ;
}
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=quick_title_edit&ajaxa=' + gup ( "a" ) , { anketa : anketa , status : status , naslov : naslov } , function ( ) {
$ ( '#novaanketa_naslov_1' ) . focus ( ) ;
} ) ;
}
function quick _title _edit _save ( quick _settings ) {
var naslov = jQuery . trim ( $ ( "#novaanketa_naslov_1" ) . val ( ) ) ;
var akronim = jQuery . trim ( $ ( "#novaanketa_akronim_1" ) . val ( ) ) ;
var intro _opomba = jQuery . trim ( $ ( "#novaanketa_opis_1" ) . val ( ) ) ;
$ . redirect ( 'ajax.php?a=quick_title_edit_save&ajaxa=' + gup ( "a" ) , { anketa : srv _meta _anketa _id , naslov : naslov , akronim : akronim , intro _opomba : intro _opomba , quick _settings : quick _settings } ) ;
}
function quick _title _edit _cancel ( ) {
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
$ ( '#fullscreen' ) . fadeOut ( 'slow' ) . html ( '' ) ;
}
// izbrise anketo
function anketa _delete ( anketa , confirmtext ) {
if ( confirm ( confirmtext ) ) {
$ . redirect ( 'ajax.php?a=anketa_delete' , { anketa : anketa } ) ;
}
}
// spremeni tip ankete
function anketa _tip ( tip ) {
// $('#anketa_active').load('ajax.php?a=anketa_tip&ajaxa='+gup("a"), {anketa: srv_meta_anketa_id, tip: tip});
$ . post ( 'ajax.php?a=anketa_tip' , { anketa : srv _meta _anketa _id , tip : tip } ) ;
}
// doda novo grupo
function nova _grupa ( ) {
$ . redirect ( 'ajax.php?a=nova_grupa' , { anketa : srv _meta _anketa _id , grupa : srv _meta _grupa } ) ;
}
// spremeni ime grupe
function edit _grupa ( grupa , naslov ) {
$ . post ( 'ajax.php?a=edit_grupa' , { grupa : grupa , naslov : naslov } ) ;
$ ( "#fieldset_page_" + grupa ) . find ( "legend" ) . find ( "#grupaName" ) . html ( naslov ) ;
$ ( "#fieldset_page_" + grupa ) . find ( "legend" ) . find ( "#naslov_" + grupa ) . val ( naslov ) ;
$ ( '#pb_line_page_preview_' + grupa ) . html ( naslov ) ;
}
// spremeni ime grupe
function save _edit _grupa ( grupa , naslov ) {
$ ( "#fieldset_page_" + grupa + " legend" ) . load ( 'ajax.php?a=save_edit_grupa' , { grupa : grupa , naslov : naslov , anketa : srv _meta _anketa _id } ) ;
$ ( "#grupa_" + grupa + " h3 a" ) . html ( "" + naslov ) ;
//$("#grupa_"+grupa).find("h3").find("input[name=naslov]").val(""+naslov);
}
// spremeni ime grupe
function save _edit _uporabnost _link ( grupa , link ) {
$ ( "#fieldset_page_" + grupa + " legend" ) . load ( 'ajax.php?a=save_edit_uporabnost_link' , { grupa : grupa , link : link , anketa : srv _meta _anketa _id } ) ;
}
// izbrise grupo
function brisi _grupo ( grupa , text ) {
if ( confirm ( text ) ) {
$ . redirect ( 'ajax.php?a=brisi_grupo' , { grupa : grupa , anketa : srv _meta _anketa _id , thisgrupa : srv _meta _grupa } ) ;
}
}
function insert _grupa _before ( grupa ) {
$ . redirect ( 'ajax.php?a=insert_grupa_before' , { grupa : grupa , anketa : srv _meta _anketa _id } ) ;
}
function grupa _recount ( prevent _recount ) {
if ( prevent _recount ) {
2021-11-05 08:06:00 +01:00
$ . 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 ; } ) ;
2020-08-14 13:36:36 +02:00
} else {
$ . redirect ( 'ajax.php?a=grupa_recount' , { anketa : srv _meta _anketa _id , grupa : srv _meta _grupa } ) ;
}
}
// doda novo spremenljivko
function nova _spremenljivka ( grupa , spremenljivka ) {
$ ( '#vprasanja' ) . load ( 'ajax.php?a=nova_spremenljivka' , { anketa : srv _meta _anketa _id , grupa : srv _meta _grupa , spremenljivka : spremenljivka } ,
function ( ) {
$ ( "#grupe" ) . load ( 'ajax.php?a=refresh_grupe' , { anketa : srv _meta _anketa _id , grupa : srv _meta _grupa } ) ;
//$('#clipboard').fadeOut();
/ * $ . p o s t ( ' a j a x . p h p ? t = b r a n c h i n g & a = g e t _ n e w _ s p r ' , { a n k e t a : s r v _ m e t a _ a n k e t a _ i d } ,
function ( new _spr ) {
//--editor_display(new_spr);
}
) ; * /
// updejtamo še levo stran z gupo
$ ( "#grupe" ) . load ( 'ajax.php?a=refresh_grupe' , { anketa : srv _meta _anketa _id , grupa : grupa } ) ;
// osvezimo spodnji gumb
refreshBottomIcons ( 'gray' ) ;
}
) ;
}
// doda novo spremenljivko v posamezno grupo na pogledu z več stranmi
function nova _spremenljivka _in _grupa ( grupa , spremenljivka ) {
if ( srv _meta _full _screen _edit ) { // edit v full screen načinu
$ . post ( 'ajax.php?a=nova_spremenljivka_in_grupa' , { anketa : srv _meta _anketa _id , grupa : grupa , spremenljivka : spremenljivka , full _screen : srv _meta _full _screen _edit } ,
function ( nova _spremenljivka _id ) {
var movable = ( srv _meta _branching == 0 ) ? ' movable' : '' ;
if ( spremenljivka ) { //vstavimo pred izbrano spremenljivko
$ ( '<div id="spremenljivka_' + nova _spremenljivka _id + '" class="spremenljivka' + movable + '"></div>' ) . insertBefore ( "#spremenljivka_" + spremenljivka ) ;
} else { // vstavimo pred divom #nova_spremenljivka
$ ( '<div id="spremenljivka_' + nova _spremenljivka _id + '" class="spremenljivka' + movable + '"></div>' ) . insertBefore ( $ ( "#fieldset_page_" + grupa ) . find ( "#nova_spremenljivka" ) ) ;
}
// refreshamo levo stran z grupami
$ ( "#grupe" ) . load ( 'ajax.php?a=refresh_grupe' , { anketa : srv _meta _anketa _id , grupa : grupa } ) ;
// damo spremenljivko v normalmode na desni strani
$ ( '#spremenljivka_' + nova _spremenljivka _id ) . load ( 'ajax.php?a=normalmode_spremenljivka' , { spremenljivka : nova _spremenljivka _id , branching : srv _meta _branching , anketa : srv _meta _anketa _id } ) ;
// in odpremo edit v FS
fullscreenmode _spremenljivka ( nova _spremenljivka _id ) ;
}
) ;
} else { // edit v normalnem načinu
if ( spremenljivka ) {
// vstavimo pred izbrano spremenljivko
$ . post ( 'ajax.php?a=nova_spremenljivka_in_grupa' ,
{ anketa : srv _meta _anketa _id , grupa : grupa , spremenljivka : spremenljivka } ,
function ( nova _spremenljivka _response ) {
$ ( nova _spremenljivka _response ) . insertBefore ( $ ( "#spremenljivka_" + spremenljivka ) ) ;
// updejtamo še levo stran z grupo
$ ( "#grupe" ) . load ( 'ajax.php?a=refresh_grupe' , { anketa : srv _meta _anketa _id , grupa : grupa } ) ;
} ) ;
} else {
// vstavimo pred divom #nova_spremenljivka
$ . post ( 'ajax.php?a=nova_spremenljivka_in_grupa' ,
{ anketa : srv _meta _anketa _id , grupa : grupa , spremenljivka : spremenljivka } ,
function ( nova _spremenljivka _response ) {
$ ( nova _spremenljivka _response ) . insertBefore ( $ ( "#fieldset_page_" + grupa ) . find ( "#nova_spremenljivka" ) ) ;
// updejtamo še levo stran z grupo
$ ( "#grupe" ) . load ( 'ajax.php?a=refresh_grupe' , { anketa : srv _meta _anketa _id , grupa : grupa } ) ;
} ) ;
}
}
}
// izbrise spremenljivko
function brisi _spremenljivko ( spremenljivka , text , confirmed ) {
if ( text == undefined ) text = lang [ 'srv_brisispremenljivkoconfirm' ] ;
if ( confirmed == 1 || confirm ( text ) ) {
if ( confirmed == undefined )
confirmed = 1 ;
$ . post ( 'ajax.php?a=brisi_spremenljivko' , { spremenljivka : spremenljivka , confirmed : confirmed , grupa : srv _meta _grupa , anketa : srv _meta _anketa _id , branching : srv _meta _branching } ,
function ( data ) {
// to je v vnosih, ko lahko dodajamo dodatne kalkulacije
if ( _ _vnosi == 1 ) {
window . location . reload ( ) ;
}
// obicno...
else {
$ ( '#vprasanje_float_editing' ) . hide ( ) ;
$ ( '#calculation' ) . hide ( ) ;
$ ( '#quota' ) . hide ( ) ;
$ ( '#fade' ) . hide ( ) ;
$ ( '#dropped_alert' ) . hide ( ) ;
if ( data . error == 0 ) {
//refreshLeft();
$ ( '#branching' ) . html ( data . output ) ;
refreshRight ( ) ;
2022-08-10 10:17:55 +02:00
// 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 ) ;
2020-08-14 13:36:36 +02:00
}
else if ( data . error == 1 ) {
$ ( '#fade' ) . fadeIn ( 'slow' ) ;
2020-08-18 14:09:41 +02:00
$ ( '#dropped_alert' ) . html ( data . output ) . fadeIn ( 'slow' ) . animate ( { opacity : 1.0 } , 3000 , function ( ) {
$ ( '#fade' ) . fadeOut ( "slow" ) ;
$ ( '#dropped_alert' ) . fadeOut ( "slow" ) ;
} ) ;
2020-08-14 13:36:36 +02:00
}
else if ( data . error == 2 ) {
$ ( '#fade' ) . fadeIn ( 'slow' ) ;
2022-06-07 23:21:21 +02:00
$ ( '#dropped_alert' ) . html ( data . output ) . fadeIn ( 'slow' ) . css ( 'width' , '600px' ) ;
2020-08-14 13:36:36 +02:00
}
2022-08-16 16:54:37 +02:00
2020-08-14 13:36:36 +02:00
}
} , 'json'
) ;
}
}
// doda novo vrednost v spremenljivko
function nova _vrednost ( spremenljivka , other ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=nova_vrednost' , { spremenljivka : spremenljivka , other : other , anketa : srv _meta _anketa _id , branching : srv _meta _branching } ) ;
}
// spremeni ime vrednosti
function edit _vrednost ( vrednost , naslov , naslov2 , variable , refresh _spremenljivka ) {
$ . post ( 'ajax.php?a=edit_vrednost' , { vrednost : vrednost , naslov : naslov , naslov2 : naslov2 , variable : variable } ,
function ( ) {
// kadar vrednost editiramo s popup editorjem - refreshamo osnovni pogled
if ( refresh _spremenljivka > 0 )
editmode _spremenljivka ( refresh _spremenljivka ) ;
}
) ;
}
//spremeni sirino posamezne vrednosti(pri besedilu)
function edit _vrednost _size ( spremenljivka , vrednost , size ) {
$ ( "#spremenljivka_" + spremenljivka ) . load ( 'ajax.php?a=edit_vrednost_size' , { spremenljivka : spremenljivka , vrednost : vrednost , size : size , anketa : srv _meta _anketa _id , branching : srv _meta _branching } ) ;
}
// spremeni ime vrednosti vsote (pri tipu vsota)
function edit _vsota ( vrednost , spremenljivka ) {
$ . post ( 'ajax.php?a=edit_vsota' , { vrednost : vrednost , spremenljivka : spremenljivka } ) ;
}
// spremeni omejitev vsote (pri tipu vsota)
function edit _limit ( min , vrednost , spremenljivka ) {
$ . post ( 'ajax.php?a=edit_limit' , { min : min , vrednost : vrednost , spremenljivka : spremenljivka } ) ;
}
// spremeni tip omejitve (pri tipu vsota)
function edit _vsota _omejitve ( spremenljivka , checkbox ) {
var tip ;
if ( checkbox . checked )
tip = 1 ;
else
tip = 0 ;
$ ( '#vsota_' + spremenljivka ) . load ( 'ajax.php?a=edit_vsota_omejitve' , { tip : tip , spremenljivka : spremenljivka } ) ;
}
// odpre editor za editiranje vrednosti
function editor _vrednost ( vrednost ) {
$ ( '#div_float_editing' ) . html ( '' ) ;
$ ( '#div_float_editing' ) . fadeIn ( "slow" ) ;
$ ( '#div_float_editing' ) . load ( 'ajax.php?a=editor_vrednost' , { 'vrednost' : vrednost , anketa : srv _meta _anketa _id } ,
function ( ) {
create _editor ( 'naslovvrednost_' + vrednost ) ;
}
) . draggable ( { delay : 100 , ghosting : true , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
// zapre editor za editiranje vrednosti
function editor _vrednost _close ( vrednost , spremenljivka ) {
var content = CKEDITOR . get ( 'naslovvrednost_' + vrednost ) . getContent ( ) ;
content = content . replace ( '<p>' , '' ) ;
content = content . replace ( '</p>' , '' ) ;
edit _vrednost ( vrednost , content , $ ( '#naslov2_' + vrednost ) . val ( ) , $ ( '#variable_' + vrednost ) . val ( ) , spremenljivka ) ;
remove _editor ( 'naslovvrednost_' + vrednost ) ;
$ ( '#div_float_editing' ) . fadeOut ( "slow" ) ;
// to smo prestavl v edit_vrednost, da se refresha sele, ko je zares
// shranjeno v bazo (drugac vcasih pokaze se staro vrednost)
// editmode_spremenljivka(spremenljivka);
}
// odpre editor za editiranje info (opombe)
function editor _note ( spremenljivka ) {
$ ( '#div_float_editing' ) . html ( '' ) ;
$ ( '#div_float_editing' ) . fadeIn ( "slow" ) ;
$ ( '#div_float_editing' ) . load ( 'ajax.php?a=editor_note' , { anketa : srv _meta _anketa _id , spremenljivka : spremenljivka } ,
function ( ) {
create _editor ( 'naslovvnote_' + spremenljivka ) ;
}
) . draggable ( { delay : 100 , ghosting : true , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
//zapre editor opombe spremenljivke
function editor _note _close ( spremenljivka ) {
// remove_editor('naslovvnote_'+spremenljivka);
var content = CKEDITOR . get ( 'naslovvnote_' + spremenljivka ) . getContent ( ) ;
$ . post ( 'ajax.php?a=editor_note_save' , { anketa : srv _meta _anketa _id , spremenljivka : spremenljivka , content : content } , function ( ) {
// posodobimo spremenljvko
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=editmode_spremenljivka' , { spremenljivka : spremenljivka , branching : srv _meta _branching , anketa : srv _meta _anketa _id , grupa : srv _meta _grupa } ) ;
/ * i f ( s r v _ m e t a _ b r a n c h i n g = = 1 ) {
$ ( '#branching_' + spremenljivka + ' .branchborder' ) . addClass ( 'editing' ) ;
} * /
remove _editor ( 'naslovvnote_' + spremenljivka ) ;
$ ( '#div_float_editing' ) . fadeOut ( "slow" ) ;
} ) ;
}
// izbrise vrednost
function brisi _vrednost ( spremenljivka , vrednost ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=brisi_vrednost' , { vrednost : vrednost , anketa : srv _meta _anketa _id , branching : srv _meta _branching } ) ;
}
// spremeni ime vrednosti grida
function edit _gridvrednost ( spremenljivka , grid , naslov ) {
$ . post ( 'ajax.php?a=edit_gridvrednost' , { spremenljivka : spremenljivka , grid : grid , naslov : naslov } ) ;
}
// prikaze polja za edit IDjev grida
function edit _grids ( spremenljivka ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=edit_grids' , { spremenljivka : spremenljivka } ) ;
}
// spremeni ime spremenljivke grida
function edit _gridID ( spremenljivka , grid , grd _id ) {
$ . post ( 'ajax.php?a=edit_gridID' , { spremenljivka : spremenljivka , grid : grid , grd _id : grd _id } ) ;
}
// spremeni stevilo gridov
function edit _grid _number ( spremenljivka , grids ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=edit_grid_number' , { spremenljivka : spremenljivka , grids : grids , anketa : srv _meta _anketa _id } ) ;
}
// vkljuci/izkljuci random nacin razvrscanja vrednosti v spremenljivki
function spremenljivka _random ( spremenljivka ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=spremenljivka_random' , { spremenljivka : spremenljivka , anketa : srv _meta _anketa _id } ) ;
}
// toggla random na vrednosti
function random _vrednost ( vrednost ) {
$ ( '#random_vrednost_' + vrednost ) . load ( 'ajax.php?a=random_vrednost' , { vrednost : vrednost } ) ;
}
// vkljuci/izkljuci statistiko spremenljivke
function spremenljivka _stat ( spremenljivka ) {
$ ( '#stat_' + spremenljivka ) . load ( 'ajax.php?a=spremenljivka_stat' , { spremenljivka : spremenljivka } ) ;
}
// spremeni orientacijo spremenljivke
function spremenljivka _orientacija ( spremenljivka ) {
$ ( '#orientation_' + spremenljivka ) . load ( 'ajax.php?a=spremenljivka_orientation' , { spremenljivka : spremenljivka } ) ;
}
function spremenljivka _checkoxhide ( spremenljivka ) {
$ ( '#checkbox_hide_' + spremenljivka ) . load ( 'ajax.php?a=spremenljivka_checkbox_hide' , { spremenljivka : spremenljivka } ) ;
}
// reminder spremenljivke -- izkljucen / soft / hard
function spremenljivka _reminder ( spremenljivka ) {
$ ( '#reminder_' + spremenljivka ) . load ( 'ajax.php?a=spremenljivka_reminder' , { spremenljivka : spremenljivka } ) ;
}
// vkljuci/izkljuci sistemko spremenljivko
function spremenljivka _sistem ( spremenljivka ) {
$ ( '#sistem_' + spremenljivka ) . load ( 'ajax.php?a=spremenljivka_sistem' , { spremenljivka : spremenljivka } ) ;
}
// vkljuci/izkljuci prikaz spremenljivke
function spremenljivka _visible ( spremenljivka ) {
$ ( '#visible_' + spremenljivka ) . load ( 'ajax.php?a=spremenljivka_visible' , { spremenljivka : spremenljivka } ) ;
}
// vkljuci/izkljuci prikaz textfielda pri spremenljivki
function spremenljivka _textfield ( spremenljivka ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=spremenljivka_textfield' , { spremenljivka : spremenljivka } ) ;
}
// vkljuci/izkljuci timer spremenljivke
function spremenljivka _timer ( spremenljivka , timer ) {
$ ( '#timer_' + spremenljivka ) . load ( 'ajax.php?a=spremenljivka_timer' , { spremenljivka : spremenljivka , timer : timer } ) ;
}
// spremeni labelo textfielda pri spremenljivki
function edit _textfield ( vrednost , label ) {
$ . post ( 'ajax.php?a=edit_textfield' , { vrednost : vrednost , label : label } ) ;
}
// spremeni ime spremenljivke
function edit _spremenljivka ( spremenljivka , naslov , normalmode ) {
info = $ ( '#info_' + spremenljivka ) . val ( ) ;
$ . post ( 'ajax.php?a=edit_spremenljivka' , { spremenljivka : spremenljivka , naslov : naslov , info : info , anketa : srv _meta _anketa _id , branching : srv _meta _branching , normalmode : normalmode } ,
function ( response _data ) {
// ce zapremo urejanje (normalmode), se refresha se display, s previewjem namesto editinga
if ( normalmode == 1 || _fullscreen || _edit _fullscreen ) {
// ce smo v fullscreen skrijemo fade
_edit _fullscreen = false ;
_fullscreen = 0 ;
$ ( '#fullscreen' ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
//$(getContainer(spremenljivka)).load('ajax.php?a=normalmode_spremenljivka', {spremenljivka: spremenljivka, branching: srv_meta_branching, anketa: srv_meta_anketa_id});
$ ( getContainer ( spremenljivka ) ) . html ( response _data ) ;
}
// kadar editor submitamo ob kaksni drugi akciji (spremembi tipa vprasanja) in ga potem odstranimo - ker se izpise znova
if ( normalmode == 2 ) {
editor _remove ( spremenljivka ) ;
}
// v branchingu refreshamo levo stran (ime spremenljivke)
if ( srv _meta _branching == 1 ) {
$ ( '#branching_' + spremenljivka ) . load ( 'ajax.php?t=branching&a=refresh_spremenljivka_name' , { spremenljivka : spremenljivka , branching : srv _meta _branching } ) ;
}
// ce je bottom gumb gray ga nardimo orange, da mamo vedno samo en aktiven (orange) gumb
// po novem se klice iz ajaxa
}
) ;
return true ;
}
// spremeni ime labele, posebej je zato, ker je v editorju
function edit _spremenljivka _label ( spremenljivka , naslov ) {
$ . post ( 'ajax.php?a=edit_spremenljivka_label' , { spremenljivka : spremenljivka , naslov : naslov , branching : srv _meta _branching } ) ;
}
// spremeni variablo spremenljivke
function edit _spremenljivka _variable ( spremenljivka ) {
var variable = $ ( "#variable_" + spremenljivka ) . val ( ) ;
variable = check _valid _variable ( variable ) ;
$ ( "#variable_" + spremenljivka ) . val ( variable ) ;
$ ( '#variable_error_' + spremenljivka ) . load ( 'ajax.php?a=edit_spremenljivka_variable' , { spremenljivka : spremenljivka , variable : variable , anketa : srv _meta _anketa _id , branching : srv _meta _branching } ) ;
}
// spremeni tip spremenljivke
function edit _spremenljivka _tip ( spremenljivka , tip , size , undecided ) {
// skrijemo div z predogledom vprašanja
$ ( "#tip_preview" ) . hide ( ) ;
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=edit_spremenljivka_tip' , { spremenljivka : spremenljivka , tip : tip , size : size , undecided : undecided , anketa : srv _meta _anketa _id , branching : srv _meta _branching } ) ;
}
function edit _spremenljivka _skala ( spremenljivka ) {
var skala = ( $ ( "#spremenljivka_skala_" + spremenljivka ) . val ( ) ) ? $ ( "#spremenljivka_skala_" + spremenljivka ) . val ( ) : 0 ;
$ . post ( 'ajax.php?a=edit_spremenljivka_skala' , { spremenljivka : spremenljivka , anketa : srv _meta _anketa _id , branching : srv _meta _branching , skala : skala } ) ;
}
// spremeni number nastavitve spremenljivke
function edit _spremenljivka _number ( spremenljivka , cela , decimalna , enota ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=edit_spremenljivka_number' , { spremenljivka : spremenljivka , cela : cela , decimalna : decimalna , enota : enota , branching : srv _meta _branching , anketa : srv _meta _anketa _id } ) ;
}
// spremeni stevilo kosov pri tipu text
function edit _spremenljivka _textboxes ( spremenljivka , size ) {
// skrijemo div z predogledom vprašanja
$ ( "#tip_preview" ) . hide ( ) ;
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=edit_spremenljivka_textboxes' , { spremenljivka : spremenljivka , size : size , anketa : srv _meta _anketa _id , branching : srv _meta _branching } ) ;
}
// spremeni polzaj besedila pri tipu text
function edit _spremenljivka _text _orientation ( spremenljivka , orientation ) {
// skrijemo div z predogledom vprašanja
$ ( "#tip_preview" ) . hide ( ) ;
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=edit_spremenljivka_text_orientation' , { spremenljivka : spremenljivka , orientation : orientation , anketa : srv _meta _anketa _id , branching : srv _meta _branching } ) ;
}
// spremeni opozorila na preseg vsote
function edit _spremenljivka _vsota _reminder ( spremenljivka , reminder ) {
editor _save ( spremenljivka , 2 ) ;
$ . post ( 'ajax.php?a=edit_spremenljivka_vsota_reminder' , { spremenljivka : spremenljivka , reminder : reminder } ) ;
}
// spremeni antonuccijev krog nastavitve spremenljivke
function edit _spremenljivka _antonucci ( spremenljivka , antonucci ) {
$ . post ( 'ajax.php?a=edit_spremenljivka_antonucci' , { spremenljivka : spremenljivka , antonucci : antonucci , branching : srv _meta _branching } ) ;
}
// spremeni antonuccijev krog nastavitve spremenljivke
function edit _spremenljivka _design ( spremenljivka , design ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=edit_spremenljivka_design' , { spremenljivka : spremenljivka , design : design , branching : srv _meta _branching , anketa : srv _meta _anketa _id } ) ;
}
// spremeni antonuccijev krog nastavitve spremenljivke
function edit _spremenljivka _ranking _k ( spremenljivka , size ) {
$ . post ( 'ajax.php?a=edit_spremenljivka_ranking_k' , { spremenljivka : spremenljivka , size : size , branching : srv _meta _branching } ) ;
}
// spremeni antonuccijev krog nastavitve spremenljivke
function check _length ( id , text ) {
var length = text . length ;
if ( length > 50 )
document . getElementById ( 'ranking_warning_' + id ) . style . display = "inline" ;
else
document . getElementById ( 'ranking_warning_' + id ) . style . display = "none" ;
}
// spremeni tip socialne podpore
function edit _spremenljivka _podpora ( spremenljivka , podpora ) {
$ . post ( 'ajax.php?a=edit_spremenljivka_podpora' , { spremenljivka : spremenljivka , podpora : podpora , branching : srv _meta _branching } ) ;
}
// spremeni parameter spremenljivke
function edit _spremenljivka _param ( spremenljivka , paramName , paramValue ) {
editor _save ( spremenljivka , 2 ) ;
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=edit_spremenljivka_param' , { spremenljivka : spremenljivka , paramName : paramName , paramValue : paramValue , branching : srv _meta _branching , anketa : srv _meta _anketa _id } ) ;
}
// prikaze urejevalni nacin za grupo
function editmode _grupa ( grupa , pages ) {
if ( pages == 1 ) {
$ ( '#fieldset_page_' + grupa + " legend" ) . load ( 'ajax.php?a=editmode_grupa' , { anketa : srv _meta _anketa _id , grupa : grupa , pages : pages } ) ;
} else
$ ( '#grupa_' + grupa ) . load ( 'ajax.php?a=editmode_grupa' , { anketa : srv _meta _anketa _id , grupa : grupa } ) ;
}
// prikaze navadni nacin za grupo
function normalmode _grupa ( grupa ) {
$ ( '#grupa_' + grupa ) . load ( 'ajax.php?a=normalmode_grupa' , { anketa : srv _meta _anketa _id , grupa : grupa } ) ;
}
// prikaze urejevalni nacin za spremenljivko
function editmode _spremenljivka ( spremenljivka , fullscreen ) {
// najprej damo vse ostale spremenljivke v normal mode ker po novem lahko editiramo samo 1 spremenljivko na enkrat
$ ( ".spr_editmode" ) . each ( function ( ) {
if ( spremenljivka != $ ( this ) . attr ( "id" ) . substr ( 22 ) )
normalmode _spremenljivka ( $ ( this ) . attr ( "id" ) . substr ( 22 ) )
} )
// ce je bottom gumb orange ga nardimo gray, da mamo vedno samo en aktiven (orange) gumb
editor _remove ( spremenljivka ) ;
// tole mamo, ker pri premikanju vprasanja pride tudi do eventa onclick, in
// da se ne sprozi
if ( _moved == 1 ) {
_moved = 0 ;
return ;
}
if ( fullscreen >= 1 ) {
if ( fullscreen == 2 ) // ce imamo odprt editing, zbrisemo html, da se
// IDji ne podvajajo
{
//$(getContainer(spremenljivka)).html('');
$ ( getContainer ( spremenljivka ) ) . find ( ".spremenljivka_tekst_form" ) . remove ( ) ;
$ ( getContainer ( spremenljivka ) ) . find ( ".spremenljivka_tip_content" ) . remove ( ) ;
$ ( getContainer ( spremenljivka ) ) . find ( ".save_button" ) . remove ( ) ;
$ ( getContainer ( spremenljivka ) ) . find ( ".spr_settings" ) . remove ( ) ;
}
_fullscreen = 1 ;
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
}
$ ( getContainer ( spremenljivka ) ) . load ( 'ajax.php?a=editmode_spremenljivka' , { spremenljivka : spremenljivka , branching : srv _meta _branching , anketa : srv _meta _anketa _id , grupa : srv _meta _grupa , fullscreen : fullscreen } , function ( ) { refreshBottomIcons ( 'gray' ) ; } ) ;
/ * i f ( s r v _ m e t a _ b r a n c h i n g = = 1 ) {
$ ( '#branching_' + spremenljivka + ' .branchborder' ) . addClass ( 'editing' ) ;
} * /
}
function fullscreenmode _spremenljivka ( spremenljivka ) {
// tole mamo, ker pri premikanju vprasanja pride tudi do eventa onclick, in
// da se ne sprozi
if ( _moved == 1 ) {
_moved = 0 ;
return ;
}
_fullscreen = 1 ;
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
// preverimo ali spremenljivka ze v edit mode
var edit _mode = $ ( ".spremenljivka" ) . find ( ".spr_editmode" ) . length ;
// spremenljivko damo iz edit mode;
if ( edit _mode == 1 ) {
$ ( '#spremenljivka_' + spremenljivka ) . load ( 'ajax.php?a=normalmode_spremenljivka' , { spremenljivka : spremenljivka , branching : srv _meta _branching , anketa : srv _meta _anketa _id } , function ( ) {
// počakamo da se normal mode konča (zato je vgnezdeno)
$ ( "#fullscreen" ) . load ( 'ajax.php?a=editmode_spremenljivka' , { spremenljivka : spremenljivka , branching : srv _meta _branching , anketa : srv _meta _anketa _id , grupa : srv _meta _grupa , fullscreen : _fullscreen } , function ( ) { refreshBottomIcons ( 'gray' ) ; } ) ;
} ) ;
} else {
$ ( "#fullscreen" ) . load ( 'ajax.php?a=editmode_spremenljivka' , { spremenljivka : spremenljivka , branching : srv _meta _branching , anketa : srv _meta _anketa _id , grupa : srv _meta _grupa , fullscreen : _fullscreen } , function ( ) { refreshBottomIcons ( 'gray' ) ; } ) ;
// $('#fullscreen').load('ajax.php?a=editmode_spremenljivka', {spremenljivka: spremenljivka, branching: srv_meta_branching, anketa: srv_meta_anketa_id, grupa: srv_meta_grupa, fullscreen:fullscreen});
}
}
// prikaze navadni nacin za spremenljivko
function normalmode _spremenljivka ( spremenljivka ) {
refreshBottomIcons ( 'orange' ) ;
editor _save ( spremenljivka , 1 ) ;
if ( collapsed _content == 1 ) {
editor _remove ( spremenljivka ) ;
// tole smo prestavl v edit_spremenljivka, ker drugace je kdaj refreshal
// preview predn je shranil v bazo in tekst ni bil refreshan
// $('#spremenljivka_'+spremenljivka).load('ajax.php?a=normalmode_spremenljivka',
// {spremenljivka: spremenljivka, branching: srv_meta_branching, anketa:
// srv_meta_anketa_id});
}
/ * i f ( s r v _ m e t a _ b r a n c h i n g = = 1 ) {
$ ( '#branching_' + spremenljivka + ' .branchborder' ) . removeClass ( 'editing' ) ;
} * /
}
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
CKEDITOR START
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
// prikaze editor za ne-spremenljivko (za karkoli druzga pac)
function create _editor ( id , focus ) {
2022-08-22 12:14:53 +02:00
editor = CKEDITOR . replace ( id ) ;
// Dodamo gumb vec
editor . addCommand ( "advanced_editor_show" , {
exec : function ( edt ) {
advanced _editor _show ( ) ;
}
} ) ;
editor . ui . addButton ( 'More' , {
label : lang [ 'more2' ] ,
command : 'advanced_editor_show' ,
name : "More" ,
} ) ;
2020-08-14 13:36:36 +02:00
//namestitev editorja za tekst pri obveščanju
if ( gup ( 'a' ) == 'alert' && focus == false ) {
CKEDITOR . config . width = 560 ;
} else if ( gup ( 'a' ) == 'jezik' ) {
//editor pri urejanju spremenljivk
CKEDITOR . config . width = 600 ;
CKEDITOR . config . height = 140 ;
CKEDITOR . config . enterMode = CKEDITOR . ENTER _BR ;
} else {
var def = $ ( '#' + id ) . attr ( "default" ) ;
if ( def == 1 ) {
CKEDITOR . instances [ id ] . on ( 'focus' , function ( ) {
this . execCommand ( 'selectAll' ) ;
} ) ;
}
editor _init = true ;
}
}
/ *
Funkcija za hitro nalaganje slike pri odgovoru
* /
function create _editor _hitro _nalaganje _slike ( id ) {
var vrednost = $ ( '[name="vrednost"]' ) . val ( ) ;
// ckeditor dialogDefinition mora biti prej nastavljena preden se inicializira ckeditor, ker drugače obvelajo nastavitve iz config.js
CKEDITOR . on ( 'dialogDefinition' , function ( ev ) {
// Take the dialog name and its definition from the event data.
var dialogName = ev . data . name ;
var dialogDefinition = ev . data . definition ;
// Ko se odpre image dialog
// V kolikor se slika nalaga pri radio gumbu in istočasno želi uporabnik urejanja odgovora (svnčnik na desni), mu ne dovoli, ker
// ostanejo nastavitve od CKEDITOR-ja dialogDefinition, zato preverimo, če obstaja instanca za hitro nalaganje slik in šele nato
// dovolimo vse nadaljnje nastavitve
if ( dialogName == 'image' && typeof CKEDITOR . instances [ id ] != 'undefined' ) {
// funkcija on dialog hide izvede, da se vrednost skritega ckeditorja value shrani
dialogDefinition . onHide = function ( ) {
setTimeout ( function ( ) {
vrednost _insert _image _save ( vrednost )
} , 50 ) ;
} ;
// pobere celotno vsebino textarea, ki je sedaj naš CKEDITOR in če ima samo sliko
var poljeBesedila = CKEDITOR . instances [ id ] . getData ( ) ;
if ( poljeBesedila . length > 2 ) {
var src = $ ( poljeBesedila ) . attr ( 'src' ) ;
var urlField = dialogDefinition . getContents ( 'info' ) . get ( 'txtUrl' ) ;
urlField [ 'default' ] = src ;
}
// Prevzeta vrednost slike je 150px v kolikor se nalaga nova slika
var widthField = dialogDefinition . getContents ( 'info' ) . get ( 'txtWidth' ) ;
widthField [ 'default' ] = '150' ;
}
} ) ;
CKEDITOR . replace ( id , { toolbar : 'HotSpot' } ) ;
CKEDITOR . config . removePlugins = 'elementspath' ;
CKEDITOR . config . width = 600 ;
CKEDITOR . config . height = 200 ;
//pobrišemo text v kolikor v besedilu ni regex '<img '
clear _editor _text ( id , '<img ' ) ;
CKEDITOR . instances [ id ] . on ( 'focus' , function ( ) {
this . execCommand ( 'selectAll' ) ;
this . execCommand ( 'image' ) ;
} ) ;
editor _init = true ;
}
// Pobrišemo CKEDITOR text, v kolikor ne najde željene sintakse v besedilu
function clear _editor _text ( id , search ) {
search = search || 0 ;
// v kolikor ni texta za iskanje potem vedno pobriše vse
if ( search === 0 )
return CKEDITOR . instances [ id ] . setData ( '' ) ;
var text = CKEDITOR . instances [ id ] . getData ( ) ;
var re = new RegExp ( search , "g" ) ;
var matches = text . match ( re ) ;
if ( matches === null )
return CKEDITOR . instances [ id ] . setData ( '' ) ;
}
function create _editor _hotspot ( id , focus ) {
CKEDITOR . replace ( id , { toolbar : 'HotSpot' } ) ; //prikazi editor s HotSpot configuration
CKEDITOR . config . removePlugins = 'elementspath' ; //odstrani spodnji tag, kjer po default-u so oznake html (body, p, ipd.)
CKEDITOR . config . width = 700 ;
CKEDITOR . config . height = 500 ;
CKEDITOR . instances [ id ] . on ( 'focus' , function ( ) {
this . execCommand ( 'selectAll' ) ;
} ) ;
editor _init = true ;
}
2021-08-26 10:32:14 +02:00
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' ) ;
} ) ;
2022-03-28 23:06:03 +02:00
if ( id == 'notification' )
CKEDITOR . config . resize _enabled = false ;
CKEDITOR . config . height = 238 ;
2021-08-26 10:32:14 +02:00
editor _init = true ;
}
2020-08-14 13:36:36 +02:00
// 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
if ( CKEDITOR . instances [ id ] ) {
var u = CKEDITOR . instances [ id ] ;
//if(u.mode == 'source') //v kolikor je urejevalnik v načinu source moramo uporabiti filter za tekst, ki ga je vnesel
// u.setMode( 'wysiwyg' );
u . destroy ( ) ;
}
//spremenljivka za urejevalnik je ponovno izklopljena
editor _init = false ;
}
// prikaze editor za spremenljivko (definiran mora biti textarea za idjem naslov_$spremenljivka
function editor _display ( spremenljivka ) {
2022-08-22 12:14:53 +02:00
editor = CKEDITOR . replace ( 'naslov_' + spremenljivka ) ;
2020-08-14 13:36:36 +02:00
2022-08-22 12:14:53 +02:00
// Dodamo gumb vec
editor . addCommand ( "advanced_editor_show" , {
exec : function ( edt ) {
advanced _editor _show ( ) ;
}
} ) ;
editor . ui . addButton ( 'More' , {
label : lang [ 'more2' ] ,
command : 'advanced_editor_show' ,
name : "More" ,
} ) ;
//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' ) ;
} ) ;
}
2020-08-14 13:36:36 +02:00
}
function editor _display _hotspot ( vre _id ) {
2022-08-22 12:14:53 +02:00
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.)
2020-08-14 13:36:36 +02:00
2022-08-22 12:14:53 +02:00
//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' ) ;
} ) ;
2020-08-14 13:36:36 +02:00
}
// odstrani editor (treba preden se odstrani html)
function editor _remove ( spremenljivka ) {
//odstranimo CKEDITOR
CKEDITOR . instances [ id ] . destroy ( ) ;
//spremenljivka za urejevalnik je ponovno izklopljena
editor _init = false ;
}
// odstrani vse editorje
function alleditors _remove ( ) {
if ( editor _init == true ) {
CKEDITOR . instances . editor1 . destroy ( ) ;
editor _init = false ;
}
}
// submit editorja --tukaj dobimo vssebino, ki smo jo vnesli v editor
function editor _save ( spremenljivka , normalmode ) {
// vsilimo blur, da shranimo vrednosti na zadnjem elementu
$ ( "input" ) . prev ( ) . focus ( ) ;
var editor = CKEDITOR . get ( 'naslov_' + spremenljivka ) ;
try {
content = editor . getContent ( ) ;
editor . isNotDirty = true ;
// ce editor se ni naloadan in imamo textarea
} catch ( e ) {
content = $ ( '#naslov_' + spremenljivka ) . val ( ) ;
}
if ( spremenljivka > 0 )
var r = edit _spremenljivka ( spremenljivka , content , normalmode ) ;
else
var r = edit _introconcl ( spremenljivka , content , $ ( '#opomba_' + spremenljivka ) . val ( ) ) ;
return r ;
}
function get _full _editor ( id ) {
CKEDITOR . instances [ id ] . destroy ( ) ;
CKEDITOR . replace ( id , { toolbar : 'Full' } ) ;
}
/**************************** CKEDITOR END ***************************/
// skopira spremenljivko v nas clipboard (uporabimo cookie)
function copy _spremenljivka ( spremenljivka , cut ) {
$ ( '#clipboard' ) . load ( 'ajax.php?a=copy_spremenljivka' , { spremenljivka : spremenljivka , cut : cut , anketa : srv _meta _anketa _id } ,
function ( ) {
$ ( '.hidden_plus' ) . show ( ) ;
$ ( '.nova_spr, .hidden_plus' ) . effect ( 'pulsate' , { times : 3 } , 800 ) ;
}
) ;
}
// odstrani iz clipboarda (kukija)
function copy _remove ( ) {
$ ( '.hidden_plus' ) . hide ( ) ;
$ . post ( 'ajax.php?a=copy_remove' , { anketa : srv _meta _anketa _id } ,
function ( data ) {
$ ( '#clipboard' ) . append ( data ) ;
}
) ;
}
// izbri<72> e vse vnose respondentov (use with care :) )
function delete _all ( text ) {
if ( confirm ( text ) ) {
$ . redirect ( 'ajax.php?a=delete_all' , { anketa : srv _meta _anketa _id } ) ;
}
}
/*Telefon*/
// shrani osnovne nastavitve za klice
function telefon _settings _save ( id , elm ) {
//$.post('ajax.php?t=telefon&a=settings_save', {id:id,variable:variable,value:value});
$ . post ( 'ajax.php?t=telefon&a=settings_save' , { id : id , variable : elm . name , value : elm . value } , function ( data ) { if ( data ) { elm . value = data } } ) ;
}
/*DATA*/
function filter _editing ( ) {
$ ( '#div_float_editing' ) . html ( '' ) ;
$ ( '#div_float_editing' ) . fadeIn ( "slow" ) ;
$ ( '#div_float_editing' ) . load ( 'ajax.php?a=filter_editing' , { anketa : srv _meta _anketa _id } ) . draggable ( { delay : 100 , ghosting : true , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
function filter _remove ( ) {
$ . redirect ( 'ajax.php?a=filter_remove' , { anketa : srv _meta _anketa _id } ) ;
}
function filter _close ( ) {
$ . redirect ( 'ajax.php?a=filter_close' , { anketa : srv _meta _anketa _id } ) ;
}
// ----------------------- nastavitve za sortables -----------------------
// nastavi sortable grupam
function grupa _sortable ( preventMove ) {
$ ( '#grupe' ) . sortable ( { items : 'div.sortable' , axis : 'y' , opacity : '0.7' , scroll : false ,
stop : function ( ) {
if ( preventMove == true ) {
$ ( this ) . sortable ( 'cancel' ) ;
2021-11-05 08:06:00 +01:00
$ . 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 ; } ) ;
2020-08-14 13:36:36 +02:00
} else
$ . post ( 'ajax.php?a=vrstnired_grupa' , { serialize : $ ( '#grupe' ) . sortable ( 'serialize' ) } ) ;
}
} ) ;
}
// nastavi droppable grupam
function grupa _droppable ( classname ) {
//$('#'+classname).droppable({accept: 'div.spremenljivka', hoverClass: 'grupahover', tolerance: 'pointer',
// drop: function (e, ui) {
//
// var grupa = classname.substring(6);
// var spremenljivka = $(ui.draggable).attr('id').substr(14);
//
// $.post('ajax.php?a=premakni_vprasanje', {grupa: grupa, spremenljivka: spremenljivka},
// function (data) {
// window.location = 'index.php?anketa='+srv_meta_anketa_id+'&grupa='+grupa;
// }
// );
// }
//});
}
// nastavi sortable spremenljivkam
function spremenljivka _sortable ( preventMove ) {
$ ( '#vprasanja' ) . sortable ( { items : 'div.spremenljivka' , opacity : '0.7' , scroll : false , handle : '.spremenljivka_settings' , forcePlaceholderSize : 'ture' , revert : 'true' , dropOnEmpty : 'true' ,
/* start: function (e, ui) { $('#'+$(ui.item).attr('id')+' .nova_spr').animate({opacity: 0}, {duration: 1}); }, */
stop : function ( e , ui ) {
_moved = 1 ; // premaknili smo, onemogocimo onclick (za edit)
// $('#'+$(ui.item).attr('id')+' .nova_spr').animate({opacity: 1},
// {duration: 1});¸
if ( preventMove == true ) {
$ ( this ) . sortable ( 'cancel' ) ;
2021-11-05 08:06:00 +01:00
$ . 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 ; } ) ;
2020-08-14 13:36:36 +02:00
} else {
var moved = ui . item . attr ( 'id' ) ;
var topage = $ ( "#" + moved ) . parent ( ) . attr ( 'id' ) ;
$ . post ( 'ajax.php?a=vrstnired_vprasanje' , { serialize : $ ( '#vprasanja' ) . sortable ( 'serialize' ) , anketa : srv _meta _anketa _id , moved : moved , grupa : srv _meta _grupa , topage : topage } ) ;
// $("#vprasanja").load('ajax.php?a=vrstnired_vprasanje', {serialize: $('#vprasanja').sortable('serialize'), anketa: srv_meta_anketa_id, moved:moved, grupa: srv_meta_grupa, topage:topage});
}
}
} ) ;
}
// nastavi sortable spremenljivkam v pogledu FORMA (potreben je reload vseh vprasanj zaradi dodatnih praznih divov)
function spremenljivka _sortable _forma ( ) {
$ ( '#vprasanja' ) . sortable ( { items : 'div.spremenljivka' , opacity : '0.7' , scroll : false ,
/ * s t a r t : f u n c t i o n ( e , u i ) {
$ ( '#' + $ ( ui . item ) . attr ( 'id' ) + ' .nova_spr' ) . animate ( { opacity : 0 } , { duration : 1 } ) ;
} , * /
stop : function ( e , ui ) {
_moved = 1 ; // premaknili smo, onemogocimo onclick (za edit)
// $('#'+$(ui.item).attr('id')+' .nova_spr').animate({opacity: 1},
// {duration: 1});
$ ( '#vprasanja' ) . load ( 'ajax.php?a=vrstnired_vprasanje_forma' , { serialize : $ ( '#vprasanja' ) . sortable ( 'serialize' ) , anketa : srv _meta _anketa _id } ) ;
}
} ) ;
}
// nastavi sortable vrednostim
function vrednost _sortable ( classname ) {
$ ( 'div.' + classname ) . sortable ( { items : 'div.sortable' , opacity : '0.7' , scroll : false , handler : 'img.move' , axis : 'y' ,
start : function ( ) {
$ ( '#vprasanja' ) . sortable ( 'disable' ) ;
} ,
stop : function ( ) {
$ . post ( 'ajax.php?a=vrstnired_vrednost' , { serialize : $ ( 'div.' + classname ) . sortable ( 'serialize' ) } ) ;
$ ( '#vprasanja' ) . sortable ( 'enable' ) ;
}
} ) ;
}
// ----------------------- funkcije za urejanje vnosov -----------------------
function vnos _redirect ( url ) {
window . location = url ;
}
function edit _data _vrednost _ch ( spr _id , vre _id , usr _id , value ) {
$ . post ( 'ajax.php?a=edit_data_vrednost_ch' , { spr _id : spr _id , vre _id : vre _id , usr _id : usr _id , value : value , anketa : srv _meta _anketa _id } ) ;
}
function edit _data _vrednost ( spr _id , vre _id , usr _id ) {
$ . post ( 'ajax.php?a=edit_data_vrednost' , { spr _id : spr _id , vre _id : vre _id , usr _id : usr _id , anketa : srv _meta _anketa _id } ) ;
}
function edit _data _grid ( spr _id , vre _id , usr _id , grd _id ) {
$ . post ( 'ajax.php?a=edit_data_grid' , { spr _id : spr _id , vre _id : vre _id , usr _id : usr _id , grd _id : grd _id , anketa : srv _meta _anketa _id } ) ;
}
function edit _data _text ( spr _id , vre _id , usr _id , value , textfield ) {
$ . post ( 'ajax.php?a=edit_data_text' , { spr _id : spr _id , vre _id : vre _id , usr _id : usr _id , value : value , textfield : textfield , anketa : srv _meta _anketa _id } ) ;
}
function edit _data _delete ( usr _id , confirmtext ) {
if ( confirm ( confirmtext ) ) {
$ . post ( 'ajax.php?a=edit_data_delete' , { usr _id : usr _id , anketa : srv _meta _anketa _id } ) ;
$ ( "#usr_row_" + usr _id ) . hide ( ) ;
}
}
function respondent _data _delete ( usr _id , confirmtext ) {
if ( confirm ( confirmtext ) ) {
$ ( "#respondent_id_" + usr _id ) . hide ( ) ;
$ . post ( 'ajax.php?a=edit_data_delete' , { usr _id : usr _id , anketa : srv _meta _anketa _id } ) ;
}
}
function highlight _spremenljivka ( spr _id ) {
$ ( 'th[spr_id=' + spr _id + ']' ) . each ( function ( idx , elm ) {
th = $ ( elm ) ;
var td _pos = th . parent ( ) . children ( ) . index ( th ) ;
$ ( '#dataTable tbody td:nth-child(' + ( td _pos + 1 ) + ')' ) . addClass ( 'cellBlue' ) ;
} ) ;
}
function highlight _user ( usr _id ) {
for ( i in usr _id ) {
//console.log(usr_id[i]);
$ ( 'td.data_uid:contains(\'' + usr _id [ i ] + '\')' ) . parent ( ) . find ( 'td' ) . not ( '.enkaIcon' ) . not ( '.cellGreen' ) . addClass ( 'cellBlue' ) ;
}
}
/ * *
* v tabeli s podatki prikaže labele
* /
function data _show _labels ( ) {
// srv_meta_anketa_id se ni postavljen
srv _meta _anketa _id = srv _meta _anketa _id || $ ( "#srv_meta_anketa_id" ) . val ( ) ;
// 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 sprList = [ ] ;
// gremo cez vse stolpce ki imajo inline_edit=1 in si shranimo spr_id
tableHeadChildren . filter ( "th" ) . each ( function ( ii , column ) {
if ( ! isNaN ( $ ( column ) . attr ( 'spr_id' ) ) )
if ( $ . inArray ( $ ( column ) . attr ( 'spr_id' ) , sprList ) == - 1 )
sprList . push ( $ ( column ) . attr ( 'spr_id' ) ) ;
} ) ;
// poberemo html kodo forme
$ . post ( 'ajax.php?a=get_variable_labels' , { anketa : srv _meta _anketa _id , spr : sprList } , function ( response ) {
// gremo cez vse stolpce
for ( var i = 0 , len = response . length ; i < len ; i ++ ) {
var columns = $ ( 'th[spr_id=' + response [ i ] . spr + ']' ) ;
columns . each ( function ( iii , column ) {
var spr _id = $ ( column ) . attr ( 'spr_id' ) ;
// na kateri celici smo
var tableIndex = tableHeadChildren . index ( column ) ;
// nardimo korekcijo zaradi ikonic
tableIndex = tableIndex + ( tableIconColspan > 0 ? tableIconColspan : 1 ) ; // +1 ker je en stolpec uid (skrit)
// če mamo ikonce mormo prištet še 1 ker mamo prvi stolpec colspanan (headerji z ikoncami nimajo atrubuta inline_edit)
// gremo cez vse vrstice
$ ( '#dataTable tr' ) . each ( function ( ii , tr ) {
var element = $ ( tr ) . find ( ':nth-child(' + ( tableIndex ) + ')' ) ;
if ( $ ( element ) . is ( 'td' ) ) {
var usr _id = $ ( tr ) . find ( 'td.data_uid' ) . html ( ) ;
var val = element . html ( ) ;
if ( $ . trim ( element . html ( ) ) in response [ i ] [ 'values' ] ) {
element . append ( ' <span class="gray">(' + response [ i ] [ 'values' ] [ $ . trim ( element . html ( ) ) ] + ')</span>' ) ;
}
}
} ) ;
} ) ;
}
} , 'json' ) ;
}
// ----------------------- ostale funkcije -----------------------
// upload skina
function survey _upload ( ) {
val = document . upload . fajl . value ;
if ( val . length > 0 ) document . upload . submit ( ) ;
}
function survey _remove _logo ( profile ) {
$ . post ( 'ajax.php?a=remove_logo' , { profile : profile , anketa : srv _meta _anketa _id } , function ( ) {
window . location . reload ( ) ;
} ) ;
return false ;
}
// vrne GET parameter
function gup ( name )
{
name = name . replace ( /[\[]/ , "\\\[" ) . replace ( /[\]]/ , "\\\]" ) ;
var regexS = "[\\?&]" + name + "=([^&#]*)" ;
var regex = new RegExp ( regexS ) ;
var results = regex . exec ( window . location . href ) ;
if ( results == null )
return "" ;
else
return results [ 1 ] ;
}
// v odvisnosti od mode, odpere ali zapre vse psremenljivke za editiranje
// mode = 1 -> edit mode
// mode = 0 -> normal mode
function expandAll ( mode ) {
$ ( 'div[id^=spremenljivka_content_]' ) . each ( function ( index )
{
var id = $ ( this ) . attr ( 'id' ) . split ( 'spremenljivka_content_' ) ;
var activeString = $ ( this ) . attr ( 'class' ) . toString ( ) ;
var active = ( activeString !== 'spremenljivka_content' )
if ( mode == 1 )
{ //v edit mode damo samo tiste kateri so zaprti
if ( ! active )
{
if ( id [ 1 ] >= 0 )
editmode _spremenljivka ( id [ 1 ] ) ;
else {
editmode _introconcl ( id [ 1 ] )
}
}
}
else
{ //v normal mode damo samo tiste kateri so v edit
if ( active )
{ // TODO če je uvod ali zaključek je treba drugače
if ( id [ 1 ] >= 0 )
normalmode _spremenljivka ( id [ 1 ] ) ;
else {
if ( $ ( this ) . attr ( 'class' ) == 'spremenljivka_content active' ) // dodatni
// check
normalmode _introconcl ( id [ 1 ] )
}
}
}
} ) ;
}
// enablamo in disablamo form elemente
function toggleStatusAlertMore ( element ) {
if ( $ ( '#alert_more' ) . is ( ':checked' ) )
{
$ ( '#' + element ) . removeAttr ( 'disabled' ) ;
$ ( '#' + element ) . removeClass ( "alert_textarea" ) ;
} else {
$ ( '#' + element ) . addClass ( "alert_textarea" ) ;
$ ( '#' + element ) . attr ( 'disabled' , true ) ;
}
}
function toggleStatusAlertOtherCheckbox ( element ) {
// alert_expire_other
if ( $ ( '#alert_' + element ) . is ( ':checked' ) )
{
2021-12-23 03:31:10 +01:00
$ ( '#alert_holder_' + element + '_emails' ) . removeClass ( 'displayNone' ) ;
2020-08-14 13:36:36 +02:00
} else {
2021-12-23 03:31:10 +01:00
$ ( '#alert_holder_' + element + '_emails' ) . addClass ( 'displayNone' ) ; }
2020-08-14 13:36:36 +02:00
}
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/' ;
}
// 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
2022-03-24 14:24:29 +01:00
$ ( '#comment_add_' + spremenljivka ) . show ( ) ; // pokazemo opcijo Poglej komentarje
2020-08-14 13:36:36 +02:00
} else if ( view == 4 || view == 5 ) {
window . location . reload ( ) ;
}
} ) ;
}
// 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 ( {
2022-06-09 08:07:40 +02:00
content : { text : '<div class="qtip_comment"><h1>' + naslov + '</h1><div id="survey_comment_' + $ ( _ _this ) . attr ( 'spremenljivka' ) + '_' + $ ( _ _this ) . attr ( 'view' ) + '"></div></div>' , title : { button : '✕' } } ,
2020-08-14 13:36:36 +02:00
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
var corners = [ 'topLeft' , 'topRight' ] ;
var opposites = [ 'bottomRight' , 'bottomLeft' ] ;
var width = $ ( document ) . width ( ) ;
// nastavitve za help
$ ( 'a.help' ) . each ( function ( ) {
if ( $ ( this ) . attr ( 'qtip' ) != 'init' ) {
var help _text = $ ( this ) . attr ( 'title_txt' ) ;
// 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 ;
$ ( this ) . qtip ( {
content : { url : 'ajax.php?t=help&a=display_help&what=' + $ ( this ) . attr ( 'id' ) + '&lang=' + $ ( this ) . attr ( 'lang' ) , title : { text : help _text , button : '✕' } } ,
fixed : true , show : { when : 'click' , solo : true } , hide : { when : 'click' } ,
style : { name : 'light' , border : { } , width : 300 } ,
position : { corner : { tooltip : corners [ i ] , target : opposites [ i ] } , adjust : { screen : true } }
} ) . attr ( 'qtip' , 'init' ) ;
}
} ) ;
var help _text = "" ;
// editiranje helpa za admine
$ ( 'a.edithelp' ) . click ( function ( ) {
if ( $ ( this ) . attr ( 'qtip' ) != 'init' ) {
help _text = $ ( this ) . attr ( 'title_txt' ) ;
// preverimo ali prikažemo tip na levo stran
var position = $ ( this ) . offset ( ) ; // position = { left: 42, top: 567 }
var left = width - position . left - 250 ;
var i = ( left >= 0 ) ? 0 : 1 ;
var el _id = $ ( this ) . attr ( 'id' ) ;
var id = el _id . split ( 'help_' ) ;
var help _element _id = id [ 1 ] ;
// Destroy currrent tooltip if present
if ( $ ( this ) . data ( "qtip" ) )
$ ( this ) . qtip ( "destroy" ) ;
$ ( this ) . qtip ( {
content : {
url : 'ajax.php?t=help&a=display_edit_help&what=' + el _id + '&lang=' + $ ( this ) . attr ( 'lang' ) ,
title : { text : help _text , button : '✕' }
} ,
fixed : true ,
show : {
when : false , // Don't specify a show event
ready : true // Show the tooltip when ready
} ,
hide : { when : 'click' } ,
style : { name : 'light' , border : { width : 3 , radius : 8 } , width : 300 , tip : { corner : corners [ i ] } } ,
position : { corner : { tooltip : corners [ i ] , target : opposites [ i ] } , adjust : { screen : true } }
} ) . attr ( 'qtip' , 'init' ) ;
}
} ) ;
}
// help
function save _help ( what , lang ) {
var help = $ ( '#edithelp_' + what ) . val ( ) ;
$ . post ( 'ajax.php?t=help&a=save_help&lang=' + lang , { what : what , help : help } , function ( ) {
$ ( '#help_' + what ) . qtip ( "hide" ) ;
try { $ ( '#help_' + what ) . attr ( 'qtip' , '' ) . qtip ( 'destroy' ) ; } catch ( e ) { /*alert("Napaka"+e)*/ } ;
} ) ;
}
function saveGlobalSetting ( what )
{
var state = $ ( "input[name=" + what + "]:checked" ) . val ( ) ;
$ . post ( 'ajax.php?a=save_global' , { anketa : srv _meta _anketa _id , what : what , state : state } ) ;
}
function saveReportSetting ( uid , what )
{
var state = $ ( "input[name=" + what + "]:checked" ) . val ( ) ;
$ . post ( 'ajax.php?a=save_reportSetting' , { anketa : srv _meta _anketa _id , uid : uid , what : what , state : state } ) ;
}
function saveUserSetting ( uid , what )
{
var state = $ ( "input[name=" + what + "]:checked" ) . val ( ) ;
$ . post ( 'ajax.php?a=save_userSetting' , { uid : uid , what : what , state : state } ) ;
}
function statisticChangeDate ( what ) {
statisticRefreshAllBoxes ( what ) ;
}
function statisticRefreshAllBoxes ( what ) {
var isInterval = false ;
var stat _interval = '' ;
if ( what == 'interval' ) {
isInterval = true ;
stat _interval = $ ( "#stat_interval" ) . val ( ) ;
}
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
var userStatusBase = $ ( "#userStatusBase" ) . val ( ) ;
var filter _email _status = $ ( "#filter_email_status" ) . val ( ) ;
var inviation _dropdown = false ;
if ( what == 'invitation' && filter _email _status == 1 ) {
inviation _dropdown = true ;
}
// osvežimo invitation filter
$ ( "#dashboardEmailInvitationFilter" ) . load ( 'ajax.php?a=statisticReloadInvitationFilter' , { anketa : srv _meta _anketa _id , filter _email _status : filter _email _status } ) ;
// v vsakem boxu refresamo podatke
// osnovni info box
$ ( "#div_statistic_info" ) . load ( 'ajax.php?a=statisticInfoRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , isInterval : isInterval , stat _interval : stat _interval , filter _email _status : filter _email _status } ) ;
// answer_state
$ ( "#div_statistic_answer_state" ) . load ( 'ajax.php?a=statisticAnswerStateRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , isInterval : isInterval , stat _interval : stat _interval , userStatusBase : userStatusBase , filter _email _status : filter _email _status , inviation _dropdown : inviation _dropdown } ) ;
// box za pregled statusov
$ ( "#div_statistic_status" ) . load ( 'ajax.php?a=statisticStatusRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , isInterval : isInterval , stat _interval : stat _interval , filter _email _status : filter _email _status } ) ;
// box za pogled klikov po straneh
$ ( "#div_statistic_pages_state" ) . load ( 'ajax.php?a=statisticPageStateRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , isInterval : isInterval , stat _interval : stat _interval , filter _email _status : filter _email _status } ) ;
// box za datumski pregled klikov
$ ( "#div_statistic_visit_data" ) . load ( 'ajax.php?a=statisticDateRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , isInterval : isInterval , stat _interval : stat _interval , filter _email _status : filter _email _status } ) ;
// box z referali
$ ( "#div_statistic_referals" ) . load ( 'ajax.php?a=statisticReferalRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , isInterval : isInterval , stat _interval : stat _interval , filter _email _status : filter _email _status } ) ;
}
function statisticFilterDateRefresh ( ) {
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
var filter _email _status = $ ( "#filter_email_status" ) . val ( ) ;
var timelineDropDownType = $ ( "#timelineDropDownType" ) . is ( ':checked' ) ;
$ ( "#div_statistic_visit_data" ) . load ( 'ajax.php?a=statisticDateRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , timelineDropDownType : timelineDropDownType , filter _email _status : filter _email _status } ) ;
}
function statisticDropdownChange ( ) {
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
var timelineDropDownType = $ ( "#timelineDropDownType" ) . is ( ':checked' ) ;
var filter _email _status = $ ( "#filter_email_status" ) . val ( ) ;
$ ( "#span_timelineDropDownType" ) . load ( 'ajax.php?a=statisticTimelineDropdownRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , timelineDropDownType : timelineDropDownType } , function ( ) {
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
var timelineDropDownType = $ ( "#timelineDropDownType" ) . is ( ':checked' ) ;
$ ( "#div_statistic_visit_data" ) . load ( 'ajax.php?a=statisticDateRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , timelineDropDownType : timelineDropDownType , filter _email _status : filter _email _status } ) ;
} ) ;
}
function statisticStatusRefresh ( ) {
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
var filter _email _status = $ ( "#filter_email_status" ) . val ( ) ;
$ ( "#div_statistic_status" ) . load ( 'ajax.php?a=statisticStatusRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , filter _email _status : filter _email _status } ) ;
}
function changeUserStatusBase ( ) {
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
var userStatusBase = $ ( "#userStatusBase" ) . val ( ) ;
var filter _email _status = $ ( "#filter_email_status" ) . val ( ) ;
$ ( "#div_statistic_answer_state" ) . load ( 'ajax.php?a=statisticAnswerStateRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , userStatusBase : userStatusBase , filter _email _status : filter _email _status } ) ;
}
function changePageUserStatusBase ( ) {
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
var pageUserStatusBase = $ ( "#pageUserStatusBase" ) . val ( ) ;
var filter _email _status = $ ( "#filter_email_status" ) . val ( ) ;
$ ( "#div_statistic_pages_state" ) . load ( 'ajax.php?a=statisticPageStateRefresh' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status , pageUserStatusBase : pageUserStatusBase , filter _email _status : filter _email _status } ) ;
}
//na novo load parametrov za izvoz v pdf
function printStatusPDF ( ) {
var type = '' ;
var userStatusBase = '' ;
var period = '' ;
//napolnimo parametre
if ( $ ( "#userStatusBase" ) . length ) {
userStatusBase = '&userStatusBase=' + $ ( "#userStatusBase" ) . val ( ) ;
}
if ( $ ( "#type" ) . length ) {
type = '&type=' + $ ( "#type" ) . val ( ) ;
}
if ( $ ( "#period" ) . length ) {
period = '&period=' + $ ( "#period" ) . val ( ) ;
}
$ . post ( 'ajax.php?a=makeEncodedIzvozUrlString' , { anketa : srv _meta _anketa _id , string : "izvoz.php?a=status&anketa=" + srv _meta _anketa _id + "&data=" + userStatusBase + type + period } , function ( url ) {
window . open ( url , '_blank' ) ;
} ) ;
//window.open("izvoz.php?a=status&anketa=" + srv_meta_anketa_id + "&data="+userStatusBase+","+type+","+period);
}
//load parametrov za izvoz analiz urejanja v pdf
function printEditsAnalysisPDF ( ) {
var user = '&user=' + $ ( "#edits_analysis_continu_user" ) . val ( ) ;
var period = '&period=' + $ ( "#edits_analysis_continu_period" ) . val ( ) ;
var status = '&status=' + $ ( "#edits_analysis_status" ) . val ( ) ;
var time = '&time=' + $ ( "#diagnostics_date_selected" ) . val ( ) ;
var from = '&from=' + $ ( "#from" ) . val ( ) ;
var to = '&to=' + $ ( "#to" ) . val ( ) ;
$ . post ( 'ajax.php?a=makeEncodedIzvozUrlString' , { anketa : srv _meta _anketa _id , string : "izvoz.php?a=editsAnalysis&anketa=" + srv _meta _anketa _id + user + period + status + time + from + to } , function ( url ) {
window . open ( url , '_blank' ) ;
} ) ;
}
/ * *
* When criteria is changed , create new data
* @ returns { undefined }
* /
function editsAnalysisContinuousEditing ( ) {
var user = $ ( "#edits_analysis_continu_user" ) . val ( ) ;
var period = $ ( "#edits_analysis_continu_period" ) . val ( ) ;
var status = $ ( "#edits_analysis_status" ) . val ( ) ;
var time = $ ( "#diagnostics_date_selected" ) . val ( ) ;
var from = $ ( "#from" ) . val ( ) ;
var to = $ ( "#to" ) . val ( ) ;
$ ( "#edits_analysis_continu_table" ) . load ( 'ajax.php?a=editsAnalysisContinuousEditing' ,
{ anketa : srv _meta _anketa _id , user : user , period : period , status : status , time : time , from : from , to : to } ) ;
}
function saveSpremenljivkaSpecial _sysvar ( spremenljivka , tip )
{
var sysvar = jQuery . trim ( $ ( "#special_sysvar_hid_" + spremenljivka ) . val ( ) ) ;
edit _spremenljivka _tip ( spremenljivka , tip , 1 , sysvar )
}
function togleSpecialOffer ( id )
{
$ ( "#specialOptions_div_" + id ) . slideToggle ( 600 ) ;
}
function add _multigrid _drugo ( spremenljivka )
{
//alert(spremenljivka);
}
function enableEmailInvitation ( what ) {
//$(what).parent().hide();
$ . redirect ( 'ajax.php?a=enableEmailInvitation' , { anketa : srv _meta _anketa _id , what : what } ) ;
}
function handleUserCodeSetting ( )
{
var phone = $ ( "input[name=phone]:checked" ) . val ( ) ;
var email = $ ( "input[name=email]:checked" ) . val ( ) ;
$ ( "#userCodeSettings1" ) . load ( 'ajax.php?a=handleUserCodeSetting' , { anketa : srv _meta _anketa _id , phone : phone , email : email , all : '1' } ) ;
}
function handleUserCodeSkipSetting ( )
{
var usercode _skip = $ ( "input[name=usercode_skip]:checked" ) . val ( ) ;
$ ( "#userCodeSettings" ) . load ( 'ajax.php?a=handleUserCodeSetting' , { anketa : srv _meta _anketa _id , usercode _skip : usercode _skip } ) ;
}
function handleUserCodeRequiredSetting ( )
{
var usercode _required = $ ( "input[name=usercode_required]:checked" ) . val ( ) ;
$ ( "#userCodeSettings" ) . load ( 'ajax.php?a=handleUserCodeSetting' , { anketa : srv _meta _anketa _id , usercode _required : usercode _required } ) ;
}
function anketa _active _email ( status ) {
var anketa = srv _meta _anketa _id ;
$ . post ( 'ajax.php?a=anketaActiveEmail' , { anketa : anketa } , function ( ) { window . location = 'index.php?anketa=' + anketa + '&a=resp' } ) ;
}
function editRespondentVrednost ( obj ) {
var id = $ ( obj ) . attr ( 'id' ) ;
var spr _id = $ ( obj ) . attr ( 'spr_id' ) ;
var usr _id = $ ( obj ) . attr ( 'usr_id' ) ;
var val = $ ( obj ) . val ( ) ;
$ . post ( 'ajax.php?a=editRespondentVrednost' , { anketa : srv _meta _anketa _id , spr _id : spr _id , usr _id : usr _id , val : val } ) ;
}
function show _tip _preview _toolbox ( tip , copy , advanced , podtip ) {
// predogled novega vprasanja
if ( tip > 0 ) {
// preview v popupu za advanced tipe vprasanj
if ( advanced == 1 ) {
if ( $ ( "#tip_preview_sub_" + tip ) . length > 0 ) {
2022-01-04 12:05:12 +01:00
$ ( "#tip_preview" ) . css ( { "left" : "520px" } ) ;
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
// prikažemo glevni div
2020-08-14 13:36:36 +02:00
$ ( "#tip_preview" ) . show ( ) ;
// priredimo še vsebino
$ ( "[name=tip_preview_sub]:visible" , "#tip_preview" ) . hide ( ) ;
$ ( "#tip_preview_sub_" + tip ) . show ( ) ;
}
// preview v toolboxu levo
} else {
if ( $ ( "#tip_preview_sub_" + tip ) . length > 0 ) {
2022-01-04 12:05:12 +01:00
$ ( "#tip_preview" ) . css ( { "left" : "245px" } ) ;
// prikažemo glevni div
2020-08-14 13:36:36 +02:00
$ ( "#tip_preview" ) . show ( ) ;
// priredimo še vsebino
$ ( "[name=tip_preview_sub]:visible" , "#tip_preview" ) . hide ( ) ;
if ( podtip !== undefined ) tip = tip + '_' + podtip ;
$ ( "#tip_preview_sub_" + tip ) . show ( ) ;
}
}
// predogled knjiznice
} else {
// predogled pri trackingu vprasanj
if ( advanced == 1 )
var container = '' ;
else
var container = '#toolbox_library' ;
// --- zdaj je tole samo enkrat za obe varianti
// knjiznica vprasanj || knjiznica anket || demografija - spremeba tipa
var pos = $ ( "div[copy=" + copy + "]" , container ) . offset ( ) || $ ( "span.new_spr[copy=" + copy + "]" , container ) . offset ( ) || $ ( '#vprasanje_float_editing' ) . offset ( ) ;
var width = $ ( "div[copy=" + copy + "]" , container ) . width ( ) || $ ( "span.new_spr[copy=" + copy + "]" , container ) . width ( ) || $ ( '#vprasanje_float_editing' ) . offset ( ) ;
var cnt = $ ( '#toolbox_library' ) . offset ( ) || $ ( '#vprasanje_float_editing' ) . offset ( ) ;
if ( advanced == 1 )
$ ( "#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" } ) ;
// prikažemo glavni div
$ ( "#tip_preview" ) . show ( ) ;
// priredimo še vsebino
$ ( "[name=tip_preview_sub]:visible" , "#tip_preview" ) . hide ( ) ;
$ ( "#tip_preview_sub_0_" + copy ) . show ( ) ;
// --- zdaj je tole samo enkrat za obe varianti
// ce vprasanje se ni nalozeno, ga nalozimo z ajaxom
if ( $ ( "#tip_preview_sub_0_" + copy ) . length == 0 ) {
$ . post ( 'ajax.php?t=branching&a=preview_spremenljivka' , { anketa : srv _meta _anketa _id , spremenljivka : copy } , function ( data ) {
$ ( '#tip_preview div.inside' ) . append ( '<div id="tip_preview_sub_0_' + copy + '" class="tip_preview_sub" name="tip_preview_sub"><span>' + lang [ 'srv_new_question' ] + '</span><div class="tip_sample">' + data + '</div></div>' ) ;
// priredimo še vsebino
$ ( "[name=tip_preview_sub]:visible" , "#tip_preview" ) . hide ( ) ;
$ ( "#tip_preview_sub_0_" + copy ) . show ( ) ;
} ) ;
}
}
}
function show _tip _preview ( spr , value ) {
if ( $ ( 'select#spremenljivka_tip_' + spr ) . attr ( 'data-ajax' ) == 'true' ) {
show _tip _preview _toolbox ( 0 , value ) ;
return ;
}
2022-06-16 11:17:49 +02:00
// To zacasno izklopimo - mogoce tega raje ne uporabljamo??
2020-08-14 13:36:36 +02:00
//pozicioniramo div
2022-06-16 11:17:49 +02:00
/ * v a r p o s = $ ( " # v p r a s a n j e _ f l o a t _ e d i t i n g " ) . o f f s e t ( ) ;
2020-08-14 13:36:36 +02:00
var body = $ ( 'body' ) . width ( ) ;
2022-01-04 12:05:12 +01:00
2022-06-16 11:17:49 +02:00
$ ( "#tip_preview" ) . css ( { "left" : "auto" , "right" : "360px" , "top" : "250px" } ) ;
2022-01-04 12:05:12 +01:00
2020-08-14 13:36:36 +02:00
// prikažemo glevni div
$ ( "#tip_preview" ) . show ( ) ;
// priredimo še vsebino
$ ( "[name=tip_preview_sub]:visible" ) . hide ( ) ;
2022-06-16 11:17:49 +02:00
$ ( "#tip_preview_sub_" + value ) . show ( ) ; * /
2020-08-14 13:36:36 +02:00
}
2022-01-04 12:05:12 +01:00
2020-08-14 13:36:36 +02:00
//preview pri design, orientation in grid subtype dropdownu (ranking, radio b, multigrid)
function show _tip _preview _subtype ( spr , design , tip ) {
2022-01-04 12:05:12 +01:00
//ranking
if ( tip == '17' ) {
if ( design == '0' )
val = '17' ;
else if ( design == '1' )
val = '17_1' ;
else
val = '17_2' ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
//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' ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
//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' ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
//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' ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
//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' ;
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
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' ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
else if ( tip == '23' ) {
val = design ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
else if ( tip == '5' ) {
if ( design == '2' )
val = '5_2' ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
// lokacija
else if ( tip == '26' ) {
if ( design == '2' )
val = '26_2' ;
else if ( design == '1' )
val = '26_1' ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
// slider
else if ( tip == '7' ) {
val = '7_2' ;
}
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
// normalno
if ( spr >= 0 ) {
2020-08-14 13:36:36 +02:00
2022-01-04 12:05:12 +01:00
//pozicioniramo div
var pos = $ ( "#spremenljivka_podtip_" + spr ) . offset ( ) ;
var width = $ ( "#spremenljivka_podtip_" + spr ) . width ( ) ;
var body = $ ( 'body' ) . width ( ) ;
2022-01-05 13:33:56 +01:00
2022-01-04 12:05:12 +01:00
$ ( "#tip_preview" ) . css ( { "left" : "auto" , "right" : ( body - pos . left + 10 ) + "px" , "top" : ( pos . top ) + "px" } ) ;
2020-08-14 13:36:36 +02:00
2022-01-05 13:33:56 +01:00
// prikažemo glavni div
$ ( "#tip_preview" ) . show ( ) ;
2022-01-04 12:05:12 +01:00
2022-01-05 13:33:56 +01:00
// priredimo še vsebino
$ ( "[name=tip_preview_sub]:visible" ) . hide ( ) ;
$ ( "#tip_preview_sub_" + val ) . show ( ) ;
2022-01-04 12:05:12 +01:00
2022-01-05 13:33:56 +01:00
// 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 {
2020-08-14 13:36:36 +02:00
2022-01-05 13:33:56 +01:00
// pozicioniramo div
$ ( "#tip_preview" ) . css ( { "left" : "520px" } ) ;
2020-08-14 13:36:36 +02:00
2022-01-05 13:33:56 +01:00
// prikažemo glavni div
$ ( "#tip_preview" ) . show ( ) ;
2020-08-14 13:36:36 +02:00
2022-01-05 13:33:56 +01:00
// priredimo še vsebino
$ ( "[name=tip_preview_sub]:visible" ) . hide ( ) ;
$ ( "#tip_preview_sub_" + val ) . show ( ) ;
}
2020-08-14 13:36:36 +02:00
}
// skrijemo div za preview
function hide _tip _preview ( ) {
$ ( "#tip_preview" ) . hide ( ) ;
}
function edit _email _invitations ( id ) {
2022-01-04 12:05:12 +01:00
2020-08-14 13:36:36 +02:00
$ ( '#div_float_editing' ) . html ( '' ) ;
$ ( '#div_float_editing' ) . fadeIn ( "slow" ) ;
2022-01-04 12:05:12 +01:00
2020-08-14 13:36:36 +02:00
if ( id == 0 ) {
var email _subject = $ ( "#email_subject" ) . val ( ) ;
var email _text = $ ( "#email_text" ) . val ( ) ;
$ ( '#div_float_editing' ) . load ( 'ajax.php?a=edit_email_invitations' , { anketa : srv _meta _anketa _id , id : id , email _subject : email _subject , email _text : email _text } ,
function ( ) {
create _editor ( 'template_text_' + id ) ;
}
) . draggable ( { delay : 100 , ghosting : true , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
2022-01-04 12:05:12 +01:00
}
else {
2020-08-14 13:36:36 +02:00
$ ( '#div_float_editing' ) . load ( 'ajax.php?a=edit_email_invitations' , { anketa : srv _meta _anketa _id , id : id } ,
function ( ) {
CKEDITOR . replace ( 'template_text_' + id ) ;
}
) . draggable ( { delay : 100 , ghosting : true , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
}
function email _invitations _close ( what ) {
var id = $ ( "#template_id" ) . val ( ) ;
var template _name = $ ( "#template_name_" + id ) . val ( ) ;
var template _subject = $ ( "#template_subject_" + id ) . val ( ) ;
var editor = CKEDITOR . get ( 'template_text_' + id ) ;
try {
template _text = editor . getContent ( ) ;
editor . isNotDirty = true ;
} catch ( e ) {
template _text = $ ( '#template_text_' + id ) . val ( ) ;
}
if ( what != 'close' ) {
$ ( "#email_invitations_templates" ) . load ( 'ajax.php?a=edit_email_invitations_save' , { anketa : srv _meta _anketa _id , what : what , id : id , template _name : template _name , template _subject : template _subject , template _text : template _text } )
}
try {
remove _editor ( 'template_text_' + id ) ;
} catch ( e ) { }
$ ( '#div_float_editing' ) . fadeOut ( "slow" ) ;
}
function change _email _invitations _template ( id ) {
$ ( "#email_invitations_values" ) . load ( 'ajax.php?a=change_email_invitations_template' , { anketa : srv _meta _anketa _id , id : id } )
}
function email _invitation _use _template ( id ) {
$ ( "#email_subject" ) . val ( $ ( "#email_invitation_value_subject" ) . val ( ) ) ;
CKEDITOR . get ( 'email_text' ) . setContent ( $ ( "#email_invitation_value_text" ) . html ( ) ) ;
}
function email _invitation _delete _template ( id , confirmtext ) {
if ( confirm ( confirmtext ) ) {
$ ( "#email_invitations_templates" ) . load ( 'ajax.php?a=email_invitation_delete_template' , { anketa : srv _meta _anketa _id , id : id } )
}
}
function show _insert _email _respondents ( id ) {
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=show_insert_email_respondents' , { anketa : srv _meta _anketa _id , id : id } ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
function close _insert _email _respondents ( ) {
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
$ ( '#fullscreen' ) . fadeOut ( 'slow' ) . html ( '' ) ;
}
function show _edit _email _respondents ( id ) {
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=show_edit_email_respondents' , { anketa : srv _meta _anketa _id , id : id } ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
function close _edit _email _respondents ( what ) {
var list _id = $ ( "#list_id" ) . val ( ) ;
var list _variables = $ ( "#list_variables_" + list _id ) . val ( ) ;
var list _name = $ ( "#list_name_" + list _id ) . val ( ) ;
var list _text = $ ( "#list_text_" + list _id ) . val ( ) ;
if ( what != 'close' ) {
$ ( "#userInsertRight" ) . load ( 'ajax.php?a=edit_respondents_list_save' , { anketa : srv _meta _anketa _id , what : what , list _id : list _id , list _variables : list _variables , list _name : list _name , list _text : list _text } )
}
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
$ ( '#fullscreen' ) . fadeOut ( 'slow' ) . html ( '' ) ;
}
function respondents _list _add ( id ) {
show _insert _email _respondents ( id ) ;
}
function delete _respondents _list ( id , confirmtext ) {
if ( confirm ( confirmtext ) ) {
$ ( "#userInsertRight" ) . load ( 'ajax.php?a=delete_respondent_list' , { anketa : srv _meta _anketa _id , id : id } )
}
}
function change _mailto _radio ( ) {
//var statusi
var mailto _radio = $ ( '[name="mailto"]:checked' ) . val ( ) ;
var prefix = "" ;
var checkboxes = "" ;
$ ( '[name="mailto_status[]"]:checked' ) . each ( function ( el ) {
checkboxes = checkboxes + prefix + $ ( this ) . val ( ) ;
prefix = "," ;
} ) ;
$ ( "#mailto_right" ) . load ( 'ajax.php?a=change_mailto_radio' , { anketa : srv _meta _anketa _id , mailto _radio : mailto _radio , mailto _status : checkboxes } )
}
function change _mailto _status ( ) {
$ ( "#radio_mailto_status" ) . attr ( "checked" , "checked" ) ;
change _mailto _radio ( ) ;
}
function preview _mailto _email ( ) {
var mailto _radio = $ ( "[name=mailto]:checked" ) . val ( ) ;
var prefix = "" ;
var checkboxes = "" ;
$ ( '[name="mailto_status[]"]:checked' ) . each ( function ( el ) {
checkboxes = checkboxes + prefix + $ ( this ) . val ( ) ;
prefix = "," ;
} ) ;
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
// $('#fullscreen').html('');
// $('#fullscreen').fadeIn("slow");
$ ( '#fullscreen' ) . load ( 'ajax.php?a=preview_mailto_email' , { anketa : srv _meta _anketa _id , mailto _radio : mailto _radio , mailto _status : checkboxes } ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
function preview _mailto _email _cancle ( ) {
$ ( '#fullscreen' ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
function preview _mailto _email _submit ( ) {
$ ( '#frm_mailto_preview' ) . submit ( ) ;
$ ( '#fullscreen' ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
function show _surveyListSettings ( ) {
var sortby = $ ( 'input#sortby' ) . val ( ) ;
var sorttype = $ ( 'input#sorttype' ) . val ( ) ;
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=show_surveyListSettings' , { sortby : sortby , sorttype : sorttype } ) . draggable ( { handle : '#survey_list_inner' , cancel : 'input, #sortable, .buttonwrapper, #rows_per_page' } ) ;
}
function show _surveyListQickInfo ( ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#survey_ListQickInfo' ) . load ( 'ajax.php?a=show_surveyListQickInfo' ) . show ( ) ;
}
function show _surveyFind ( ) {
// če je polje za filter vidno, ga počistimo in skrijemo
if ( $ ( "#sl_find" ) . is ( ":visible" ) ) {
$ ( "#sl_find" ) . hide ( ) ;
$ ( "#sl_find_survey" ) . val ( '' ) ;
} else {
$ ( "#sl_find" ) . show ( ) ;
}
}
function sl _filter ( ) {
if ( $ ( "#sl_find" ) . is ( ":visible" ) ) {
var sl _filter = $ ( "#sl_find_survey" ) . val ( ) ;
$ ( '#survey_list' ) . load ( 'ajax.php?a=surveyListFilter' , { sl _filter : sl _filter } ) ;
//$('#survey_list').load('ajax.php?a=save_surveyListSettings', {data:data, vrstniRed:vrstniRed, sortby:sortby, sorttype:sorttype, rows_per_page:rows_per_page});
}
}
// prekli<6C> emo
function cancle _surveyListSettings ( ) {
$ ( '#fullscreen' ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
// obnovimo privzete vrednosti
function default _surveyListSettings ( ) {
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=default_surveyListSettings' ) . draggable ( { handle : '#survey_list_inner' , cancel : 'input, #sortable, .buttonwrapper' } ) ;
}
// shranimo katere celice prikazujemo in v kak<61> nem vrstnem redu
function save _surveyListSettings ( ) {
var data = "" ;
var prefix = "" ;
var vrstniRed = "" ;
var vrstniRedPrefix = "" ;
$ ( "input[name=sl_fields]" ) . each ( function ( ) {
if ( $ ( this ) . is ( ':checked' ) ) {
data = data + prefix + $ ( this ) . attr ( 'value' ) ;
prefix = "," ;
}
vrstniRed = vrstniRed + vrstniRedPrefix + $ ( this ) . attr ( 'value' ) ;
vrstniRedPrefix = "," ;
} ) ;
var sortby = $ ( 'input#sortby' ) . val ( ) ;
var sorttype = $ ( 'input#sorttype' ) . val ( ) ;
var rows _per _page = $ ( 'input#rows_per_page' ) . val ( ) ;
$ ( '#survey_list' ) . load ( 'ajax.php?a=save_surveyListSettings' , { data : data , vrstniRed : vrstniRed , sortby : sortby , sorttype : sorttype , rows _per _page : rows _per _page } ) ;
$ ( '#fullscreen' ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
// polovimo in shranimo <20> irine header celic po resizanju
function save _surveyListCssSettings ( event , ui ) {
var data = ui . helper . attr ( 'baseCss' ) + "," + ui . size [ 'width' ] ;
var sortby = $ ( 'input#sortby' ) . val ( ) ;
var sorttype = $ ( 'input#sorttype' ) . val ( ) ;
$ ( '#survey_list' ) . load ( 'ajax.php?a=save_surveyListCssSettings' , { data : data , sortby : sortby , sorttype : sorttype } ) ;
}
// Sortiramo moje ankete po stolpcih
function surveyList _goTo ( sortbyid , sorttype ) {
var onlyPhone = ( $ ( "#onlyPhone" ) . val ( ) == 1 ) ? true : false ;
// Pogledamo, ce smo slucajno v iskanju in nastavimo ustrezne parametre
var searchParams = '' ;
if ( $ ( "#searchParams" ) . val ( ) != '' ) {
searchParams = '&' + $ ( "#searchParams" ) . val ( ) ;
}
$ ( '#survey_list' ) . load ( 'ajax.php?a=surveyList_goTo' + searchParams , { sortby : sortbyid , sorttype : sorttype , onlyPhone : onlyPhone } ) ;
// window.location = url;
}
function surveyList _user ( what , el ) {
if ( what == 'i' ) {
var uid = $ ( el ) . attr ( 'iuid' ) ;
} else if ( what == 'e' ) {
var uid = $ ( el ) . attr ( 'euid' ) ;
} else if ( what == 'uid' ) {
what = 'i' ;
uid = el ;
} else {
var uid = 0 ;
}
$ ( '#survey_list' ) . load ( 'ajax.php?a=surveyList_user' , { list _user _type : what , uid : uid } ) ;
}
function surveyList _user _reload ( what , el ) {
if ( what == 'i' ) {
var uid = $ ( el ) . attr ( 'iuid' ) ;
} else if ( what == 'e' ) {
var uid = $ ( el ) . attr ( 'euid' ) ;
} else if ( what == 'uid' ) {
what = 'i' ;
uid = el ;
} else {
var uid = 0 ;
}
$ . post ( 'ajax.php?a=surveyList_user' , { list _user _type : what , uid : uid } , function ( ) {
location . reload ( ) ;
} ) ;
}
function surveyList _language ( lang _id ) {
$ ( '#survey_list' ) . load ( 'ajax.php?a=surveyList_language' , { lang _id : lang _id } ) ;
}
function surveyList _language _reload ( lang _id ) {
$ . post ( 'ajax.php?a=surveyList_language' , { lang _id : lang _id } , function ( ) {
location . reload ( ) ;
} ) ;
}
function surveyList _gdpr ( gdpr ) {
$ ( '#survey_list' ) . load ( 'ajax.php?a=surveyList_gdpr' , { gdpr : gdpr } ) ;
}
function surveyList _gdpr _reload ( gdpr ) {
$ . post ( 'ajax.php?a=surveyList_gdpr' , { gdpr : gdpr } , function ( ) {
location . reload ( ) ;
} ) ;
}
function surveyList _library ( ) {
var currentLibrary = $ ( "#library_filter :selected" ) . val ( ) ;
$ ( '#survey_list' ) . load ( 'ajax.php?a=surveyList_library' , { currentLibrary : currentLibrary } ) ;
}
function surveyList _info ( anketa ) {
if ( $ ( '#survey_list_info' ) . is ( ":visible" ) ) {
// Ce smo kliknili drug info
if ( $ ( '.info.icon-orange' ) . attr ( 'anketa' ) != anketa ) {
// Najprej ugasnemo odprtega
$ ( '.info' ) . removeClass ( 'icon-orange' ) ;
// Potem prikazemo novega
var position = $ ( '#info_icon_' + anketa ) . position ( ) ;
$ ( '#survey_list_info' ) . load ( 'ajax.php?t=surveyList&a=surveyList_display_info' , { anketa : anketa } , function ( ) {
$ ( '#info_icon_' + anketa ) . toggleClass ( 'icon-orange' ) ;
$ ( '#survey_list_info' ) . css ( 'top' , position . top + 34 ) ;
$ ( "#survey_list_info" ) . show ( ) ;
} ) ;
}
else {
// Samo ugasnemo odprtega
$ ( "#survey_list_info" ) . hide ( ) ;
$ ( '.info' ) . removeClass ( 'icon-orange' ) ;
}
}
// Prikazemo info box
else {
var position = $ ( '#info_icon_' + anketa ) . position ( ) ;
$ ( '#survey_list_info' ) . load ( 'ajax.php?t=surveyList&a=surveyList_display_info' , { anketa : anketa } , function ( ) {
$ ( '#info_icon_' + anketa ) . toggleClass ( 'icon-orange' ) ;
$ ( '#survey_list_info' ) . css ( 'top' , position . top + 34 ) ;
$ ( "#survey_list_info" ) . show ( ) ;
} ) ;
}
}
function survey _chaneg _type ( new _type , change _type _submit ) {
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=survey_chaneg_type' , { anketa : srv _meta _anketa _id , new _type : new _type , change _type _submit : change _type _submit } ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
function survey _chaneg _type _cancle ( ) {
$ ( '#fullscreen' ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
function preview _spremenljivka ( spremenljivka , lang _id ) {
2022-05-04 09:44:42 +02:00
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) ;
2020-08-14 13:36:36 +02:00
$ ( '#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' } ) ;
}
function preview _spremenljivka _analiza ( spremenljivka , lang _id ) {
2022-05-04 09:44:42 +02:00
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) ;
2020-08-14 13:36:36 +02:00
$ ( '#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' } ) ;
}
2022-04-29 07:08:42 +02:00
function preview _spremenljivka _cancel ( ) {
2020-08-14 13:36:36 +02:00
$ ( '#fullscreen' ) . hide ( ) ;
if ( $ ( '#vprasanje' ) . css ( 'display' ) != 'block' ) {
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
}
function preview _page ( ) {
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=preview_page' , { anketa : srv _meta _anketa _id , grupa : srv _meta _grupa } ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
function preview _page _cancle ( ) {
$ ( '#fullscreen' ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
/ * f u n c t i o n r e n a m e _ v a r i a b l e ( s p r e m e n l j i v k a , v a l u e , v a r i a b l e _ c u s t o m , s h o w ) {
$ ( "#div_variable_" + spremenljivka ) . load ( 'ajax.php?a=rename_variable' , { anketa : srv _meta _anketa _id , spremenljivka : spremenljivka , variable _custom : variable _custom , value : value , show : show } ) ;
} * /
// Odpravimo težave z IE7, kateri ne omogoča disejblat posameznih opcij
function IE7 _select _disabled _fix ( ) {
if ( jQuery . browser . msie && parseInt ( jQuery . browser . version ) < 8 ) {
$ ( 'option[disabled]' ) . css ( { 'color' : '#cccccc' } ) ;
$ ( 'select' ) . change ( function ( ) {
if ( this . options [ this . selectedIndex ] . disabled ) {
if ( this . options . length == 0 ) {
this . selectedIndex = - 1 ;
} else {
this . selectedIndex -- ;
}
$ ( this ) . trigger ( 'change' ) ;
}
} ) ;
$ ( 'select' ) . each ( function ( it ) {
if ( this . options [ this . selectedIndex ] . disabled ) {
this . onchange ( ) ;
}
} ) ;
}
} ;
function change _alert _respondent ( what , el ) {
var id = el . attr ( "id" ) ;
var checked = $ ( "#alert_" + what ) . is ( ':checked' ) ;
2021-12-23 14:37:41 +01:00
$ ( "#label_alert_" + what ) . load ( 'ajax.php?a=change_alert_respondent' , { anketa : srv _meta _anketa _id , checked : checked , what : what } ) ;
2020-08-14 13:36:36 +02:00
}
2021-12-23 03:31:10 +01:00
function change _alert _instruction ( el ) {
2020-08-14 13:36:36 +02:00
var checked = el . is ( ':checked' ) ;
if ( checked ) {
$ ( "#alert_respondent_cms_instruction" ) . show ( ) ;
} else {
$ ( "#alert_respondent_cms_instruction" ) . hide ( ) ;
}
}
function alert _add _necessary _sysvar ( what , el ) {
var id = el . attr ( "id" ) ;
var checked = $ ( "#alert_" + what ) . is ( ':checked' ) ;
2022-01-05 17:46:49 +01:00
$ ( "div#label_alert_" + what ) . load ( 'ajax.php?a=alert_add_necessary_sysvar' , { anketa : srv _meta _anketa _id , checked : checked , what : what } ) ;
2020-08-14 13:36:36 +02:00
}
function alert _change _user _from _cms ( what , el ) {
2022-01-05 17:46:49 +01:00
$ ( "div#label_alert_" + what ) . load ( 'ajax.php?a=alert_change_user_from_cms' , { anketa : srv _meta _anketa _id } ) ;
2020-08-14 13:36:36 +02:00
}
function alert _edit _if ( type , uid ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#div_condition_editing' ) . load ( 'ajax.php?a=alert_edit_if' , { anketa : srv _meta _anketa _id , uid : uid , type : type } ) . show ( ) ;
}
function alert _if _remove ( _if ) {
if ( confirm ( lang [ 'srv_brisiifconfirm' ] ) ) {
$ . post ( 'ajax.php?t=branching&a=if_remove' , { 'if' : _if , anketa : srv _meta _anketa _id } , function ( ) {
window . location . reload ( ) ;
} ) ;
$ ( '#div_condition_editing' ) . hide ( ) ;
//$('#fade').fadeOut('slow');
}
}
function alert _if _close ( _if ) {
$ ( '#div_condition_editing' ) . hide ( ) ;
window . location . reload ( ) ;
}
//nastavitve za glasovanje - what je spremenljivka v tabeli srv_glasovanje, ki jo spreminjamo
function edit _glasovanje ( spremenljivka , results , what ) {
if ( what == 'finish_author' || what == 'finish_respondent_cms' || what == 'finish_other' || what == 'show_results' || what == 'show_percent' || what == 'show_graph' ) {
if ( results . checked == true )
results = 1 ;
else
results = 0 ;
}
if ( $ ( "#glas_extra_settings" ) . is ( ":visible" ) == true )
var displayExtra = 1 ;
else
var displayExtra = 0 ;
$ ( "#glas_settings" ) . load ( 'ajax.php?a=glasovanje_settings&t=glasovanje' , { anketa : srv _meta _anketa _id , spremenljivka : spremenljivka , results : results , what : what , displayExtra : displayExtra } , function ( ) {
if ( what == 'show_intro' || what == 'show_concl' || what == 'stat' || what == 'embed' )
$ ( "#branching" ) . load ( 'ajax.php?a=glasovanje_vprasanja&t=glasovanje' , { anketa : srv _meta _anketa _id , spremenljivka : spremenljivka , what : what } ) ;
} ) ;
}
function glas _extra _settings ( ) {
$ ( '.more' ) . toggle ( ) ;
$ ( '.less' ) . toggle ( ) ;
2022-05-24 13:51:58 +02:00
$ ( '#glas_extra_settings' ) . slideToggle ( ) ;
2020-08-14 13:36:36 +02:00
}
//hitre nastavitve za formo - what je spremenljivka, ki jo spreminjamo
function edit _form _settings ( spremenljivka , results , what ) {
if ( what == 'finish_author' || what == 'finish_respondent_cms' || what == 'finish_other' ) {
if ( results . checked == true )
results = 1 ;
else
results = 0 ;
}
$ ( "#simple" ) . load ( 'ajax.php?a=form_settings' , { anketa : srv _meta _anketa _id , spremenljivka : spremenljivka , results : results , what : what } ) ;
//$.post('ajax.php?a=form_settings', {anketa: srv_meta_anketa_id, spremenljivka: spremenljivka, results: results, what: what});
if ( what == 'show_intro' || what == 'show_concl' )
$ ( "#vprasanja" ) . load ( 'ajax.php?a=glasovanje_vprasanja' , { anketa : srv _meta _anketa _id , spremenljivka : spremenljivka , what : what } ) ;
}
function newAnketaBlank ( type ) {
var survey _type = type || $ ( "input[name=newAnketaBlank]:checked" ) . val ( ) ;
var naslov = jQuery . trim ( $ ( "#novaanketa_naslov" ) . val ( ) ) ;
if ( $ ( "#novaanketa_naslov_1" ) . length > 0 ) {
naslov = jQuery . trim ( $ ( "#novaanketa_naslov_1" ) . val ( ) ) ;
}
var akronim = naslov ;
if ( $ ( "#novaanketa_akronim_1" ) . length > 0 ) {
var akronim = jQuery . trim ( $ ( "#novaanketa_akronim_1" ) . val ( ) ) ;
}
var folder = '-1' ;
if ( $ ( "#novaanketa_folder" ) . length ) {
folder = $ ( "#novaanketa_folder" ) . val ( ) ;
}
var intro _opomba = jQuery . trim ( $ ( "#novaanketa_opis" ) . val ( ) ) ;
if ( $ ( "#lang_resp" ) . length > 0 && $ ( "#lang_resp" ) . val ( ) > 0 ) {
var lang _resp = jQuery . trim ( $ ( "#lang_resp" ) . val ( ) ) ;
} else {
var lang _resp = 1 ;
}
var skin = jQuery . trim ( $ ( "#noSurvey_skin_id" ) . val ( ) ) ;
if ( skin == '' )
skin = '1kaBlue' ;
$ . redirect ( 'ajax.php?a=anketa' , { naslov : naslov , intro _opomba : intro _opomba , akronim : akronim , survey _type : survey _type , lang _resp : lang _resp , skin : skin , folder : folder } ) ;
}
function newAnketaCancle ( ) {
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
$ ( '#fullscreen' ) . html ( '' ) . fadeOut ( 'slow' ) ;
}
// Preklop skina pri ustvarjanju ankete
function change _noSurvey _skin ( skin ) {
// Deaktiviramo
$ ( '.selected' ) . removeClass ( 'selected' ) ;
// Aktiviramo novega
$ ( "#skin_" + skin ) . addClass ( 'selected' ) ;
$ ( 'input[name=skin]' ) . val ( skin ) ;
}
// Scroll po skinih
function scroll _noSurvey _skin ( direction ) {
var leftPos = $ ( '#skins_holder' ) . scrollLeft ( ) ;
if ( direction == 'left' ) {
$ ( "#skins_holder" ) . animate ( { scrollLeft : leftPos - 800 } , 1000 , 'easeOutQuart' ) ;
}
else {
$ ( "#skins_holder" ) . animate ( { scrollLeft : leftPos + 800 } , 1000 , 'easeOutQuart' ) ;
}
}
// Nova anketa s kopiranjem obstojece
function newAnketaCopy ( ) {
var ank _id = $ ( "#my_surveys" ) . val ( ) ;
$ . redirect ( 'ajax.php?t=library&a=anketa_copy_new' , { ank _id : ank _id } ) ;
}
// Preklop predloge pri ustvarjanju ankete iz predloge
function newAnketaTemplate _change ( id ) {
// Deaktiviramo in aktiviramo novega
$ ( '.selected' ) . removeClass ( 'selected' ) ;
$ ( "#template_" + id ) . addClass ( 'selected' ) ;
// Nastavimo naslov
var title = $ ( "#template_title_" + id ) . val ( ) ;
$ ( 'input[name=novaanketa_naslov_1]' ) . val ( title ) ;
$ ( 'input[name=novaanketa_akronim_1]' ) . val ( title ) ;
// Nastavimo id za post
$ ( 'input[name=noSurvey_template_id]' ) . val ( id ) ;
}
// Nova anketa s kopiranjem iz templata
function newAnketaTemplate ( ) {
var ank _id = $ ( "#noSurvey_template_id" ) . val ( ) ;
var naslov = jQuery . trim ( $ ( "#novaanketa_naslov_1" ) . val ( ) ) ;
var akronim = jQuery . trim ( $ ( "#novaanketa_akronim_1" ) . val ( ) ) ;
var folder = '-1' ;
if ( $ ( "#novaanketa_folder" ) . length ) {
folder = $ ( "#novaanketa_folder" ) . val ( ) ;
}
if ( ank _id == '' || ank _id < 1 ) {
2021-11-05 08:06:00 +01:00
genericAlertPopup ( 'srv_newSurvey_survey_template_error' ) ;
2020-08-14 13:36:36 +02:00
}
else {
$ . redirect ( 'ajax.php?t=library&a=anketa_copy_new' , { ank _id : ank _id , naslov : naslov , akronim : akronim , folder : folder } ) ;
}
}
// Preview vprasanj pri uvozu ankete iz besedila
function anketaFromText _preview ( text ) {
var text = $ ( "textarea#anketa_from_text_textarea" ) . val ( ) . trim ( ) ;
$ ( "#preview_field" ) . load ( 'ajax.php?t=newSurvey&a=from_text_preview' , { text : text } ) ;
}
// Ustvarimo anketo in ji uvozimo vprasanja iz texta
function newAnketaFromText ( ) {
var survey _type = '2' ;
var skin = '1kaBlue' ;
var naslov = jQuery . trim ( $ ( "#novaanketa_naslov" ) . val ( ) ) ;
if ( $ ( "#novaanketa_naslov_1" ) . length > 0 ) {
naslov = jQuery . trim ( $ ( "#novaanketa_naslov_1" ) . val ( ) ) ;
}
var akronim = naslov ;
if ( $ ( "#novaanketa_akronim_1" ) . length > 0 ) {
var akronim = jQuery . trim ( $ ( "#novaanketa_akronim_1" ) . val ( ) ) ;
}
if ( $ ( "#lang_resp" ) . length > 0 && $ ( "#lang_resp" ) . val ( ) > 0 ) {
var lang _resp = jQuery . trim ( $ ( "#lang_resp" ) . val ( ) ) ;
} else {
var lang _resp = 1 ;
}
// Uvoz vprasanj in variabel iz texta
var from _text = $ ( "textarea#anketa_from_text_textarea" ) . val ( ) . trim ( ) ;
$ . redirect ( 'ajax.php?a=anketa_from_text' , { naslov : naslov , akronim : akronim , survey _type : survey _type , lang _resp : lang _resp , skin : skin , from _text : from _text } ) ;
}
// Prikaz popupa znotraj ankete za uvoz iz texta
function popupImportAnketaFromText ( ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( "#popup_import_from_text" ) . load ( 'ajax.php?a=show_import_from_text' ) ;
$ ( "#popup_import_from_text" ) . show ( ) ;
}
// Prikaz popupa znotraj ankete za uvoz iz texta
function popupImportAnketaFromText _close ( ) {
$ ( "#popup_import_from_text" ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
// Uvozimo vprasanja v anketo iz texta
function importAnketaFromText ( ) {
// Uvoz vprasanj in variabel iz texta
var from _text = $ ( "textarea#anketa_from_text_textarea" ) . val ( ) . trim ( ) ;
$ . redirect ( 'ajax.php?a=import_from_text' , { anketa : srv _meta _anketa _id , from _text : from _text } , function ( ) {
popupImportAnketaFromText _close ( ) ;
} ) ;
}
/* funkcije za manipulacijo profilov respondentov */
function respondent _run ( pid ) {
init _progressBar ( true ) ;
var variables = $ ( "#respondent_profile_values" ) . find ( "#respondent_profile_variables" ) . val ( ) ;
var data = $ ( "#respondent_profile_values" ) . find ( "#respondent_profile_value_text" ) . val ( ) ;
var profile _from = $ ( "#profile_from" ) . val ( ) ;
// $("#survey_respondents").load('ajax.php?a=survey_respondents&b=run_respondent_profile', {anketa: srv_meta_anketa_id, pid:pid, variables:variables, data:data});
$ . redirect ( 'ajax.php?a=survey_respondents&b=run_respondent_profile' , { anketa : srv _meta _anketa _id , pid : pid , variables : variables , data : data , profile _from : profile _from } ) ;
}
function respondent _save ( pid ) {
var variables = $ ( "#respondent_profile_values" ) . find ( "#respondent_profile_variables" ) . val ( ) ;
var data = $ ( "#respondent_profile_values" ) . find ( "#respondent_profile_value_text" ) . val ( ) ;
$ ( "#survey_respondents" ) . load ( 'ajax.php?a=survey_respondents&b=save_respondent_profile' , { anketa : srv _meta _anketa _id , pid : pid , variables : variables , data : data } ) ;
}
function respondent _save _new ( pid ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( "#respondent_new_dialog" ) . find ( "#newProfileId" ) . val ( pid ) ;
$ ( "#respondent_new_dialog" ) . show ( ) ;
}
function change _respondent _profile ( pid ) {
var profile _from = $ ( "#profile_from" ) . val ( ) ;
$ ( "#survey_respondents" ) . load ( 'ajax.php?a=survey_respondents&b=change_respondent_profile' , { anketa : srv _meta _anketa _id , pid : pid , profile _from : profile _from } )
}
function respondent _saveNewProfile ( ) {
var pid = $ ( "#respondent_new_dialog" ) . find ( "#newProfileId" ) . val ( ) ;
var name = $ ( "#respondent_new_dialog" ) . find ( "#newProfileName" ) . val ( ) ;
var variables = $ ( "#respondent_profile_values" ) . find ( "#respondent_profile_variables" ) . val ( ) ;
var data = $ ( "#respondent_profile_values" ) . find ( "#respondent_profile_value_text" ) . val ( ) ;
$ ( "#survey_respondents" ) . load ( 'ajax.php?a=survey_respondents&b=save_new_respondent_profile' , { anketa : srv _meta _anketa _id , name : name , pid : pid , variables : variables , data : data } , function ( ) {
$ ( "#respondent_new_dialog" ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
} ) ;
}
function respondent _renameProfile ( ) {
var pid = $ ( "#respondent_rename_dialog" ) . find ( "#renameProfileId" ) . val ( ) ;
var name = $ ( "#respondent_rename_dialog" ) . find ( "#renameProfileName" ) . val ( ) ;
$ ( "#survey_respondents" ) . load ( 'ajax.php?a=survey_respondents&b=rename_respondent_profile' , { anketa : srv _meta _anketa _id , name : name , pid : pid } , function ( ) {
$ ( "#respondent_rename_dialog" ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
} ) ;
}
function respondent _deleteProfile ( ) {
var pid = $ ( "#respondent_delete_dialog" ) . find ( "#deleteProfileId" ) . val ( ) ;
$ ( "#survey_respondents" ) . load ( 'ajax.php?a=survey_respondents&b=delete_respondent_profile' , { anketa : srv _meta _anketa _id , pid : pid } , function ( ) {
$ ( "#respondent_delete_dialog" ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
} ) ;
}
function showRenameRespondentProfile ( ) {
var pid = $ ( "#respondent_profiles" ) . find ( ".option.active" ) . attr ( 'value' ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( "#respondent_rename_dialog" ) . find ( "#renameProfileId" ) . val ( pid ) ;
$ ( "#respondent_rename_dialog" ) . show ( ) ;
}
function showDeleteRespondentProfile ( ) {
var pid = $ ( "#respondent_profiles" ) . find ( ".option.active" ) . attr ( 'value' ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( "#respondent_delete_dialog" ) . find ( "#deleteProfileId" ) . val ( pid ) ;
$ ( "#respondent_delete_dialog" ) . show ( ) ;
}
function respondent _change _variable ( el ) {
var pid = $ ( "#respondent_profiles" ) . find ( ".option.active" ) . attr ( 'value' ) ;
var checked = "" ;
var prefix = "" ;
var manual = $ ( "input[name=resp_check]:checked" ) . each ( function ( ) {
checked = checked + prefix + $ ( this ) . val ( ) ;
prefix = "," ;
} ) ;
$ ( "#respondent_profile_variables" ) . val ( checked ) ;
}
/* konec funkcij za manipulacijo profilov respondentov */
/* funkcije za manipulacijo profilov email vabil */
function invitation _run ( pid ) {
var title = $ ( "#invitation_profile_values" ) . find ( "#invitation_profile_title" ) . val ( ) ;
var replyto = $ ( "#invitation_profile_values" ) . find ( "#invitation_profile_replyto" ) . val ( ) ;
// var content = $("#invitation_profile_values").find("#invitation_profile_content").val();
var content = CKEDITOR . get ( 'invitation_profile_content' ) . getContent ( ) ;
remove _editor ( "invitation_profile_content" ) ;
//$("#survey_invitation").load('ajax.php?a=survey_invitation&b=run_invitation_profile', {anketa: srv_meta_anketa_id, pid:pid, title:title, content:content}, function() {
// create_editor("invitation_profile_content");
//});
$ . redirect ( 'ajax.php?a=survey_invitation&b=run_invitation_profile' , { anketa : srv _meta _anketa _id , pid : pid , title : title , content : content , replyto : replyto } ) ;
}
function invitation _save ( pid ) {
var title = $ ( "#invitation_profile_values" ) . find ( "#invitation_profile_title" ) . val ( ) ;
var replyto = $ ( "#invitation_profile_values" ) . find ( "#invitation_profile_replyto" ) . val ( ) ;
// var content = $("#invitation_profile_values").find("#invitation_profile_content").val();
var content = CKEDITOR . get ( 'invitation_profile_content' ) . getContent ( ) ;
remove _editor ( "invitation_profile_content" ) ;
$ ( "#survey_invitation" ) . load ( 'ajax.php?a=survey_invitation&b=save_invitation_profile' , { anketa : srv _meta _anketa _id , pid : pid , title : title , content : content , replyto : replyto } , function ( ) {
create _editor ( "invitation_profile_content" ) ;
} ) ;
}
function invitation _save _new ( pid ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( "#invitation_new_dialog" ) . find ( "#newProfileId" ) . val ( pid ) ;
$ ( "#invitation_new_dialog" ) . show ( ) ;
}
function change _invitation _profile ( pid ) {
remove _editor ( "invitation_profile_content" ) ;
$ ( "#survey_invitation" ) . load ( 'ajax.php?a=survey_invitation&b=change_invitation_profile' , { anketa : srv _meta _anketa _id , pid : pid } , function ( ) {
create _editor ( "invitation_profile_content" ) ;
} ) ;
}
function invitation _saveNewProfile ( ) {
var pid = $ ( "#invitation_new_dialog" ) . find ( "#newProfileId" ) . val ( ) ;
var name = $ ( "#invitation_new_dialog" ) . find ( "#newProfileName" ) . val ( ) ;
var title = $ ( "#invitation_profile_values" ) . find ( "#invitation_profile_title" ) . val ( ) ;
var replyto = $ ( "#invitation_profile_values" ) . find ( "#invitation_profile_replyto" ) . val ( ) ;
// var content = $("#invitation_profile_values").find("#invitation_profile_content").val();
var content = CKEDITOR . get ( 'invitation_profile_content' ) . getContent ( ) ;
remove _editor ( "invitation_profile_content" ) ;
$ ( "#survey_invitation" ) . load ( 'ajax.php?a=survey_invitation&b=save_new_invitation_profile' , { anketa : srv _meta _anketa _id , name : name , pid : pid , title : title , content : content , replyto : replyto } , function ( ) {
create _editor ( "invitation_profile_content" ) ;
$ ( "#invitation_new_dialog" ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
} ) ;
}
function invitation _renameProfile ( ) {
var pid = $ ( "#invitation_rename_dialog" ) . find ( "#renameProfileId" ) . val ( ) ;
var name = $ ( "#invitation_rename_dialog" ) . find ( "#renameProfileName" ) . val ( ) ;
remove _editor ( "invitation_profile_content" ) ;
$ ( "#survey_invitation" ) . load ( 'ajax.php?a=survey_invitation&b=rename_invitation_profile' , { anketa : srv _meta _anketa _id , name : name , pid : pid } , function ( ) {
create _editor ( "invitation_profile_content" ) ;
$ ( "#invitation_rename_dialog" ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
} ) ;
}
function invitation _deleteProfile ( ) {
var pid = $ ( "#invitation_delete_dialog" ) . find ( "#deleteProfileId" ) . val ( ) ;
remove _editor ( "invitation_profile_content" ) ;
$ ( "#survey_invitation" ) . load ( 'ajax.php?a=survey_invitation&b=delete_invitation_profile' , { anketa : srv _meta _anketa _id , pid : pid } , function ( ) {
create _editor ( "invitation_profile_content" ) ;
$ ( "#invitation_delete_dialog" ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
} ) ;
}
function showRenameInvitationProfile ( ) {
var pid = $ ( "#invitation_profiles" ) . find ( ".option.active" ) . attr ( 'value' ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( "#invitation_rename_dialog" ) . find ( "#renameProfileId" ) . val ( pid ) ;
$ ( "#invitation_rename_dialog" ) . show ( ) ;
}
function showDeleteInvitationProfile ( ) {
var pid = $ ( "#invitation_profiles" ) . find ( ".option.active" ) . attr ( 'value' ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( "#invitation_delete_dialog" ) . find ( "#deleteProfileId" ) . val ( pid ) ;
$ ( "#invitation_delete_dialog" ) . show ( ) ;
}
/* konec funkcij za manipulacijo profilov email vabil */
function recalc _alert _expire ( days ) {
$ ( "#calc_alert_expire" ) . load ( 'ajax.php?a=recalc_alert_expire' , { anketa : srv _meta _anketa _id , days : days } ) ;
}
// enablamo in disablamo vnos max stevila glasov (trajanje)
function voteCountStatus ( status ) {
if ( status == 1 || status == 2 ) {
2021-11-30 01:27:23 +01:00
$ ( '#vote_limit_warning' ) . removeClass ( 'displayNone' ) ;
2021-12-15 13:27:11 +01:00
$ ( '#vote_limit' ) . removeClass ( 'bottom0' ) ;
2020-08-14 13:36:36 +02:00
} else {
2021-11-30 01:27:23 +01:00
$ ( '#vote_limit_warning' ) . addClass ( 'displayNone' ) ;
2021-12-15 13:27:11 +01:00
$ ( '#vote_limit' ) . addClass ( 'bottom0' ) ;
2020-08-14 13:36:36 +02:00
}
}
function voteCountToggle ( status ) {
if ( status == 1 || status == 2 ) {
$ ( '#voteCountToggle1' ) . show ( ) ;
} else {
$ ( '#voteCountToggle1' ) . hide ( ) ;
}
}
function survey _statistic _referal ( what ) {
2022-05-12 11:24:51 +02:00
2020-08-14 13:36:36 +02:00
if ( $ ( what ) . attr ( 'value' ) == '0' ) { // nalozimo vsebino samo prvi klik
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
$ ( "#survey_referals" ) . load ( 'ajax.php?a=survey_statistic_referal' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status } , function ( ) {
$ ( "#survey_referals" ) . slideDown ( ) ;
$ ( what ) . attr ( 'value' , '1' ) ;
} ) ;
2022-05-12 11:24:51 +02:00
}
else if ( $ ( what ) . attr ( 'value' ) == '1' ) { // skrijemo
2020-08-14 13:36:36 +02:00
$ ( "#survey_referals" ) . slideUp ( ) ;
$ ( what ) . attr ( 'value' , '2' ) ;
2022-05-12 11:24:51 +02:00
}
else { // prikazemo
2020-08-14 13:36:36 +02:00
$ ( "#survey_referals" ) . slideDown ( ) ;
$ ( what ) . attr ( 'value' , '1' ) ;
}
}
2022-05-12 11:24:51 +02:00
2020-08-14 13:36:36 +02:00
function ip _list _podrobno ( what ) {
2022-05-12 11:24:51 +02:00
2020-08-14 13:36:36 +02:00
if ( $ ( what ) . attr ( 'value' ) == '0' ) { // nalozimo vsebino samo prvi klik
var type = $ ( "#type" ) . val ( ) ;
var period = $ ( "#period" ) . val ( ) ;
var hideNullValues _dates = $ ( "#hideNullValues_dates" ) . is ( ':checked' ) ;
var hideNullValues _status = $ ( "#hideNullValues_status" ) . is ( ':checked' ) ;
$ ( "#ip_list_podrobno" ) . load ( 'ajax.php?a=survey_statistic_ip_list' , { anketa : srv _meta _anketa _id , type : type , period : period , hideNullValues _dates : hideNullValues _dates , hideNullValues _status : hideNullValues _status } , function ( ) {
$ ( "#ip_list_podrobno" ) . slideDown ( ) ;
$ ( what ) . attr ( 'value' , '1' ) ;
} ) ;
2022-05-12 11:24:51 +02:00
}
else if ( $ ( what ) . attr ( 'value' ) == '1' ) { // skrijemo
2020-08-14 13:36:36 +02:00
$ ( "#ip_list_podrobno" ) . slideUp ( ) ;
$ ( what ) . attr ( 'value' , '2' ) ;
2022-05-12 11:24:51 +02:00
}
else { // prikazemo
2020-08-14 13:36:36 +02:00
$ ( "#ip_list_podrobno" ) . slideDown ( ) ;
$ ( what ) . attr ( 'value' , '1' ) ;
}
}
function survey _statistic _status ( status ) {
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=survey_statistic_status' , { anketa : srv _meta _anketa _id , status : status } ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
}
function close _statistic _float _div ( ) {
$ ( '#fullscreen' ) . fadeOut ( 'slow' ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
function refreshBottomIcons ( color ) {
if ( color == undefined && $ ( ".spr_editmode" ) . length != 0 )
{ color = 'gray' ; }
if ( color == 'gray' ) {
$ ( "#bottom_invitaton_button" ) . removeClass ( 'ovalbutton_orange' ) . addClass ( 'ovalbutton_gray' ) ;
} else {
$ ( "#bottom_invitaton_button" ) . removeClass ( 'ovalbutton_gray' ) . addClass ( 'ovalbutton_orange' ) ;
}
}
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 ( ) {
2022-03-11 00:34:08 +01:00
actionNotePopup ( 'success_save' , 'success' ) ;
2020-08-14 13:36:36 +02:00
} ) ;
}
function updateManual ( ) {
$ ( "#radioManual" ) . attr ( "checked" , "checked" ) ;
}
function updateManual1 ( ) {
$ ( "#radioManual1" ) . attr ( "checked" , "checked" ) ;
}
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 ( ) {
2022-03-11 00:34:08 +01:00
actionNotePopup ( 'success_save' , 'success' ) ;
2020-08-14 13:36:36 +02:00
} ) ;
}
function doTxtExport ( ) {
$ ( '#export_txt_form' ) . submit ( ) ;
/ *
var fullMeta = ( $ ( '#fullMeta' ) . is ( ':checked' ) ) ? '&fullMeta=1' : '' ;
var hiddenSystem = ( $ ( '#hiddenSystem' ) . is ( ':checked' ) ) ? '&hiddenSystem=1' : '' ;
window . open ( 'ajax.php?t=export&a=doexport' + '&m=txt' + '&anketa=' + srv _meta _anketa _id + fullMeta + hiddenSystem ) ;
* /
return false ;
}
function doExcelXlsExport ( ) {
$ ( '#export_excel_xls_form' ) . submit ( ) ;
}
function doExcelExport ( ) {
$ ( '#export_excel_form' ) . submit ( ) ;
/ *
// preberemo katere statuse odpiramo
var fullMeta = ( $ ( '#fullMeta' ) . is ( ':checked' ) ) ? '&fullMeta=1' : '' ;
var hiddenSystem = ( $ ( '#hiddenSystem' ) . is ( ':checked' ) ) ? '&hiddenSystem=1' : '' ;
var export _labels = ( $ ( '#export_labels' ) . is ( ':checked' ) ) ? '&export_labels=1' : '' ;
/ *
var replace = '' ;
if ( $ ( '#do_replace' ) . is ( ':checked' ) ) {
replace = '&replace=' + $ ( '#replace_with' ) . val ( ) ;
}
* /
// tole nardimo malo bol zahtevno če bomo kdaj hoteli dodati možnost izbire večih zamenjevalnih polj
var checked = $ ( 'input[name="export_delimit"]:checked' ) . val ( ) ;
if ( checked == 0 ) {
var $div _selector = $ ( '#replace_export_delimit_semicolon' ) ;
} else {
var $div _selector = $ ( '#replace_export_delimit_comma' ) ;
}
var all _imputs = ( $div _selector . find ( 'input[type="text"]' ) . length ) / 2 ;
//alert(replaces);
// window.open( 'ajax.php?t=export&a=doexport'+'&m=excel'+'&anketa=' + srv_meta_anketa_id + fullMeta +hiddenSystem+ export_labels + replaces, {replaces:replaces});
//return false;
* /
}
2022-01-13 22:42:58 +01:00
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' ) ;
}
2020-08-14 13:36:36 +02:00
return false ;
}
function doSpssExport ( data ) {
if ( data == 'yes' ) {
var input = $ ( "<input>" ) . attr ( "type" , "hidden" ) . attr ( "name" , "exportData" ) . val ( "1" ) ;
$ ( '#export_spss_form' ) . append ( $ ( input ) ) ;
} else {
var input = $ ( "<input>" ) . attr ( "type" , "hidden" ) . attr ( "name" , "exportData" ) . val ( "0" ) ;
$ ( '#export_spss_form' ) . append ( $ ( input ) ) ;
}
$ ( '#export_spss_form' ) . submit ( ) ;
/ *
var exportData = ( data == 'yes' ) ? 'exportData&=1' : '' ;
var fullMeta = ( $ ( '#fullMeta' ) . is ( ':checked' ) ) ? '&fullMeta=1' : ''
var hiddenSystem = ( $ ( '#hiddenSystem' ) . is ( ':checked' ) ) ? '&hiddenSystem=1' : '' ;
window . open ( 'ajax.php?t=export&a=doexport' + '&m=spss' + '&anketa=' + srv _meta _anketa _id + fullMeta + hiddenSystem + exportData ) ;
* /
}
function doSAVExport ( ) {
$ ( '#export_sav_form' ) . submit ( ) ;
}
// Read a page's GET URL variables and return them as an associative array.
function getUrlVars ( )
{
var vars = [ ] , hash ;
var hashes = window . location . href . slice ( window . location . href . indexOf ( '?' ) + 1 ) . split ( '&' ) ;
for ( var i = 0 ; i < hashes . length ; i ++ )
{
hash = hashes [ i ] . split ( '=' ) ;
vars . push ( hash [ 0 ] ) ;
vars [ hash [ 0 ] ] = hash [ 1 ] ;
}
return vars ;
}
function check _valid _variable ( variable ) {
var ValidPattern = /^[A-Za-z0-9]*$/ ;
var ValidFirstChar = /^[A-Za-z]*$/ ;
var result = '' ;
for ( var i = 0 ; i < variable . length ; i ++ ) {
var chr = variable . charAt ( i ) ;
// prvi znak ne sme biti number
if ( i == 0 ) {
if ( ValidFirstChar . test ( chr ) ) {
result = result + chr ;
}
} else if ( ValidPattern . test ( chr ) ) { // ostali znaki so lahko tudi number
result = result + chr ;
}
}
result = result . substring ( 0 , 15 ) ;
// Dodaten pogoj da ponovimo, ker v nekaterih primerih ostane stevilka na prvem mestu
if ( ! ValidFirstChar . test ( result . charAt ( 0 ) ) ) {
result = check _valid _variable ( result ) ;
}
return result ;
}
function clearDefaultValue ( el ) {
if ( el . defaultValue == el . value ) el . value = ""
}
function showSearch ( ) {
//$('#searchSurvey').toggle("blind", { direction: 'horizontal', start: }, 500);
//$('#searchSurvey').animate({width: 'toggle'});
$ ( '#searchSurvey' ) . animate ( { width : 'toggle' } ) ;
}
function showSearchb ( ) {
//$('#searchSurvey').toggle("blind", { direction: 'horizontal', start: }, 500);
//$('#searchSurvey').animate({width: 'toggle'});
$ ( '#searchSurveyb' ) . animate ( { width : 'toggle' } ) ;
}
function executeDrupalSearch ( ) {
var url = $ ( '#drupal_search_url' ) . val ( ) ;
2021-01-05 10:23:50 +01:00
var searchString = $ ( '#searchSurvey' ) . val ( ) ;
2021-01-19 10:39:57 +01:00
window . open ( url + encodeURIComponent ( searchString ) , '_blank' ) ;
2020-08-14 13:36:36 +02:00
}
function showAdvancedSearch ( ) {
if ( $ ( '#advancedSearch' ) . is ( ":visible" ) ) {
$ ( '#advancedSearch' ) . slideUp ( 'slow' ) ;
2022-01-19 09:59:53 +01:00
$ ( '#advanced_settings_button' ) . removeClass ( 'active' ) ;
2020-08-14 13:36:36 +02:00
}
else {
$ ( '#advancedSearch' ) . slideDown ( 'slow' ) ;
2022-01-19 09:59:53 +01:00
$ ( '#advanced_settings_button' ) . addClass ( 'active' ) ;
2020-08-14 13:36:36 +02:00
}
}
function max _stevilo _vnosov ( ) {
var input = $ ( "input[name=stevilo_vnosov]" ) ;
if ( value = parseInt ( input . val ( ) ) ) {
if ( value > 1000 )
value = 1000 ;
} else {
value = 0 ;
}
input . val ( value ) ;
}
function link _enable _addvance ( what ) {
// najprej aktiviramo telefonsko ali e-mail anketo če še ni, nato pa redirektamo
$ . redirect ( 'ajax.php?a=enable_addvance' , { anketa : srv _meta _anketa _id , what : what } ) ;
}
function toggle _standardne _besede ( ) {
if ( $ ( '.standardne_besede' ) . css ( 'display' ) == 'none' ) {
$ ( 'input[name=std_besede]' ) . attr ( 'checked' , true ) ;
$ ( '.standardne_besede' ) . show ( ) ;
} else {
$ ( 'input[name=std_besede]' ) . attr ( 'checked' , false ) ;
$ ( '.standardne_besede' ) . hide ( ) ;
}
}
function dostopActiveShowAll ( show _hide ) {
if ( show _hide == 'true' ) {
$ ( "#dostop_active_show_1" ) . hide ( ) ;
$ ( "#dostop_active_show_2" ) . show ( ) ;
/ * $ ( " d i v [ n a m e = d o s t o p _ a c t i v e _ u i d ] " ) . e a c h ( f u n c t i o n ( ) {
$ ( this ) . css ( 'display' , 'block' ) ;
} ) ; * /
$ ( '#dostop_users_list' ) . load ( 'ajax.php?a=dostop_active_show_all' , { show _all : 1 , anketa : srv _meta _anketa _id } ) ;
}
else {
$ ( "#dostop_active_show_1" ) . show ( ) ;
$ ( "#dostop_active_show_2" ) . hide ( ) ;
/ * $ ( " d i v [ n a m e = d o s t o p _ a c t i v e _ u i d ] i n p u t : n o t ( : c h e c k e d ) " ) . e a c h ( f u n c t i o n ( ) {
$ ( this ) . parent ( ) . css ( 'display' , 'none' ) ;
} ) ; * /
$ ( '#dostop_users_list' ) . load ( 'ajax.php?a=dostop_active_show_all' , { show _all : 0 , anketa : srv _meta _anketa _id } ) ;
}
}
function dostopPassiveShowAll ( show _hide ) {
if ( show _hide == 'true' ) {
$ ( "#dostop_passive_show_1" ) . hide ( ) ;
$ ( "#dostop_passive_show_2" ) . show ( ) ;
$ ( "div[name=dostop_passive_uid]" ) . each ( function ( ) {
$ ( this ) . css ( 'display' , 'block' ) ;
} ) ;
} else {
$ ( "#dostop_passive_show_1" ) . show ( ) ;
$ ( "#dostop_passive_show_2" ) . hide ( ) ;
$ ( "div[name=dostop_passive_uid] input:not(:checked)" ) . each ( function ( ) {
$ ( this ) . parent ( ) . css ( 'display' , 'none' ) ;
} ) ;
}
}
2021-07-14 12:24:05 +02:00
function dostopNoteToggle ( ) {
if ( $ ( '#addusers_note_checkbox' ) . is ( ':checked' ) ) {
2021-12-20 15:12:13 +01:00
$ ( '#addusers_note' ) . removeClass ( 'displayNone' ) ;
2021-07-14 12:24:05 +02:00
}
else {
2021-12-20 15:12:13 +01:00
$ ( '#addusers_note' ) . addClass ( 'displayNone' ) ;
2021-07-14 12:24:05 +02:00
}
}
// 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 ) ;
2022-02-23 12:48:17 +01:00
$ ( '#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 ( ) {
2021-07-14 12:24:05 +02:00
// Refresh vsebine v ozadju
$ ( "#globalSetingsList" ) . load ( 'ajax.php?a=refresh_dostop_settings' , { anketa : srv _meta _anketa _id } ) ;
} ) ;
}
2020-08-14 13:36:36 +02:00
function comments _admin _toggle ( type ) {
if ( $ ( '#comments_admin' + type ) . attr ( 'admin_on' ) == 'true' ) {
comments _admin _off ( type ) ;
} else {
comments _admin _on ( type ) ;
}
}
function comments _admin _on ( type ) {
$ ( '#comments_admin' + type ) . attr ( 'admin_on' , 'true' ) ;
$ ( '#comments_admin' + type ) . attr ( 'checked' , true ) ;
if ( type == 1 ) {
$ ( 'select[name=survey_comment]' ) . val ( '3' ) ;
$ ( 'select[name=survey_comment_viewadminonly]' ) . val ( '3' ) ;
//$('input#survey_comment_showalways_0').attr('checked', true);
} else {
$ ( 'select[name=question_note_view]' ) . val ( '3' ) ;
$ ( 'select[name=question_note_write]' ) . val ( '0' ) ;
$ ( 'select[name=question_comment]' ) . val ( '3' ) ;
$ ( 'select[name=question_comment_viewadminonly]' ) . val ( '3' ) ;
}
}
function comments _admin _off ( type ) {
$ ( '#comments_admin' + type ) . attr ( 'admin_on' , 'false' ) ;
$ ( '#comments_admin' + type ) . attr ( 'checked' , false ) ;
if ( type == 1 ) {
$ ( 'select[name=survey_comment]' ) . val ( '' ) ;
$ ( 'select[name=survey_comment_viewadminonly]' ) . val ( '3' ) ;
//$('input#survey_comment_showalways_0').attr('checked', true);
} else {
$ ( 'select[name=question_note_view]' ) . val ( '' ) ;
$ ( 'select[name=question_note_write]' ) . val ( '' ) ;
$ ( 'select[name=question_comment]' ) . val ( '' ) ;
$ ( 'select[name=question_comment_viewadminonly]' ) . val ( '4' ) ;
}
}
function check _comments _admin ( type ) {
if ( type == 1 ) {
if (
$ ( 'select[name=survey_comment]' ) . val ( ) != '' / * &&
$ ( 'select[name=survey_comment_viewadminonly]' ) . val ( ) == '3' / * &&
$ ( 'input#survey_comment_showalways_0' ) . attr ( 'checked' ) == 'checked' * /
)
return true ;
else
return false ;
} else {
if (
/ * $ ( ' s e l e c t [ n a m e = q u e s t i o n _ n o t e _ v i e w ] ' ) . v a l ( ) = = ' 3 ' & &
$ ( 'select[name=question_note_write]' ) . val ( ) == '0' && * /
$ ( 'select[name=question_comment]' ) . val ( ) != '' / * &&
$ ( 'select[name=question_comment_viewadminonly]' ) . val ( ) == '3' * /
)
return true ;
else
return false ;
}
}
function check _comments _admin _off ( type ) {
if ( type == 1 ) {
if (
$ ( 'select[name=survey_comment]' ) . val ( ) == '' / * &&
$ ( 'select[name=survey_comment_viewadminonly]' ) . val ( ) == '4' &&
$ ( 'input#survey_comment_showalways_0' ) . attr ( 'checked' ) == 'checked' * /
)
return true ;
else
return false ;
} else {
if (
/ * $ ( ' s e l e c t [ n a m e = q u e s t i o n _ n o t e _ v i e w ] ' ) . v a l ( ) = = ' ' & &
$ ( 'select[name=question_note_write]' ) . val ( ) == '' && * /
$ ( 'select[name=question_comment]' ) . val ( ) == '' / * &&
$ ( 'select[name=question_comment_viewadminonly]' ) . val ( ) == '4' * /
)
return true ;
else
return false ;
}
}
function comments _resp _toggle ( type ) {
// Komentarji respondentov na vprasanje
if ( type == 1 ) {
if ( $ ( '#comments_resp' ) . attr ( 'resp_on' ) == 'true' ) {
comments _resp _off ( ) ;
} else {
comments _resp _on ( ) ;
}
}
// Komentarji respondentov na anketo
else {
if ( $ ( '#comments_resp2' ) . attr ( 'resp_on' ) == 'true' ) {
$ ( '#comments_resp2' ) . attr ( 'resp_on' , 'false' ) ;
$ ( '#comments_resp2' ) . attr ( 'checked' , false ) ;
$ ( 'select[name=survey_comment_resp]' ) . val ( '' ) ;
$ ( 'select[name=survey_comment_viewadminonly_resp]' ) . val ( '4' ) ;
} else {
$ ( '#comments_resp2' ) . attr ( 'resp_on' , 'true' ) ;
$ ( '#comments_resp2' ) . attr ( 'checked' , true ) ;
$ ( 'select[name=survey_comment_resp]' ) . val ( '4' ) ;
$ ( 'select[name=survey_comment_viewadminonly_resp]' ) . val ( '4' ) ;
}
}
}
function comments _resp _on ( ) {
$ ( '#comments_resp' ) . attr ( 'resp_on' , 'true' ) ;
$ ( '#comments_resp' ) . attr ( 'checked' , true ) ;
$ ( 'input#question_resp_comment_1' ) . attr ( 'checked' , true ) ;
$ ( 'select[name=question_resp_comment_viewadminonly]' ) . val ( '3' ) ;
$ ( 'input#question_resp_comment_show_open_0' ) . attr ( 'checked' , true ) ;
}
function comments _resp _off ( ) {
$ ( '#comments_resp' ) . attr ( 'resp_on' , 'false' ) ;
$ ( '#comments_resp' ) . attr ( 'checked' , false ) ;
$ ( 'input#question_resp_comment_0' ) . attr ( 'checked' , true ) ;
$ ( 'select[name=question_resp_comment_viewadminonly]' ) . val ( '' ) ;
$ ( 'input#question_resp_comment_show_open_0' ) . attr ( 'checked' , true ) ;
}
function check _comments _resp ( type ) {
// Komentarji respondentov na vprasanje
if ( type == 1 ) {
if (
$ ( 'input#question_resp_comment_1' ) . attr ( 'checked' ) == 'checked' &&
$ ( 'select[name=question_resp_comment_viewadminonly]' ) . val ( ) != '' / * &&
$ ( 'input#question_resp_comment_show_open_0' ) . attr ( 'checked' ) == 'checked' * /
)
return true ;
else
return false ;
}
// Komentarji respondentov na anketo
else {
if ( $ ( 'select[name=survey_comment_resp]' ) . val ( ) == '' )
return false ;
else
return true ;
}
}
function check _comments _resp _off ( ) {
if (
$ ( 'input#question_resp_comment_0' ) . attr ( 'checked' ) == 'checked' &&
$ ( 'select[name=question_resp_comment_viewadminonly]' ) . val ( ) == '' / * &&
$ ( 'input#question_resp_comment_show_open_0' ) . attr ( 'checked' ) == 'checked' * /
)
return true ;
else
return false ;
}
function testiranje _settings ( ) {
if ( $ ( '#question_resp_comment_0' ) . attr ( 'checked' ) == 'checked' ) {
$ ( '.question_resp_comment' ) . hide ( ) ;
} else {
$ ( '.question_resp_comment' ) . show ( ) ;
if ( $ ( '#question_resp_comment_inicialke_0' ) . attr ( 'checked' ) == 'checked' ) {
$ ( '.question_resp_comment_inicialke' ) . hide ( ) ;
} else {
$ ( '.question_resp_comment_inicialke' ) . show ( ) ;
}
}
}
// Brisanje testnih podatkov
function delete _test _data ( ) {
if ( confirm ( lang [ 'srv_delete_testdata_warning' ] ) ) {
window . location . href = 'index.php?anketa=' + srv _meta _anketa _id + '&a=testiranje&m=testnipodatki&delete_testdata=1' ;
}
}
function archivePopup ( ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#fullscreen' ) . html ( '' ) . fadeIn ( 'slow' ) . draggable ( { delay : 100 , cancel : 'input, textarea, select, .buttonwrapper' } ) ;
$ ( '#fullscreen' ) . load ( 'ajax.php?a=archivePopup' , { anketa : srv _meta _anketa _id } ) ;
}
function archivePopupView ( ) {
$ ( '#fullscreen' ) . fadeOut ( 'slow' ) . html ( '' ) ;
window . location = 'index.php?anketa=' + srv _meta _anketa _id + '&a=arhivi' ;
}
function archivePopupClose ( ) {
$ ( '#fullscreen' ) . fadeOut ( 'slow' ) . html ( '' ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
}
function add _to _library ( anketa , where ) {
$ . post ( 'ajax.php?a=add_to_library' , { anketa : anketa , where : where } ) ;
}
2022-05-05 19:25:45 +02:00
function create _archive _survey ( anketa ) {
2020-08-14 13:36:36 +02:00
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ . post ( 'index.php?anketa=' + anketa + '&a=backup_create' , { intro _opomba : $ ( '#intro_opomba' ) . val ( ) } ,
function ( ) {
window . location . reload ( ) ;
} ) ;
return false ;
}
2022-05-05 19:25:45 +02:00
function create _archive _survey _data ( anketa ) {
2020-08-14 13:36:36 +02:00
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ . post ( 'ajax.php?anketa=' + anketa + '&a=backup_data&data=true' , { intro _opomba : $ ( '#intro_opomba' ) . val ( ) } ,
function ( ) {
window . location . reload ( ) ;
} ) ;
return false ;
}
function submitSurveyDuration ( ) {
var durationType = 1 ;
var durationStarts = $ ( "#startsManual1" ) . val ( ) ;
var durationExpire = $ ( "#expireManual1" ) . val ( ) ;
var voteCountLimitType = $ ( "input[name=vote_limit]:checked" ) . val ( ) ;
var voteCountValue = $ ( "#vote_count" ) . val ( ) ;
$ . post ( 'ajax.php?a=anketa_save_activation' , { anketa : srv _meta _anketa _id , durationType : durationType , durationStarts : durationStarts , durationExpire : durationExpire , voteCountLimitType : voteCountLimitType , voteCountValue : voteCountValue } , function ( ) {
window . location . reload ( ) ;
//window.location = 'index.php?anketa='+srv_meta_anketa_id+'&a=vabila';
} ) ;
}
function diag _display _if ( ) {
$ . post ( 'ajax.php?t=branching&a=check_pogoji&izpis=long' , { anketa : srv _meta _anketa _id } , function ( data ) {
$ ( '#fade' ) . fadeIn ( "slow" ) ;
$ ( '#check_pogoji' ) . html ( data ) . fadeIn ( "slow" ) ;
} ) ;
}
function changeDataIcons ( ) {
var dataIcons _quick _view = $ ( '#dataIcons_quick_view' ) . is ( ':checked' ) ? '1' : '0' ;
var dataIcons _write = $ ( '#dataIcons_write' ) . is ( ':checked' ) ? '1' : '0' ;
var dataIcons _edit = $ ( '#dataIcons_edit' ) . is ( ':checked' ) ? '1' : '0' ;
var dataIcons _labels = $ ( '#dataIcons_labels' ) . is ( ':checked' ) ? '1' : '0' ;
var dataIcons _multiple = $ ( '#dataIcons_multiple' ) . is ( ':checked' ) ? '1' : '0' ;
$ . post ( 'ajax.php?t=dataSettingProfile&a=changeDataIcons' , { anketa : srv _meta _anketa _id , dataIcons _write : dataIcons _write , dataIcons _edit : dataIcons _edit , dataIcons _quick _view : dataIcons _quick _view , dataIcons _labels : dataIcons _labels , dataIcons _multiple : dataIcons _multiple } , function ( data ) {
window . location . reload ( ) ;
} ) ;
}
function surveyBaseSettingRadio ( what , foreceReload ) {
// Posebej obravnavamo dostop brez kode, ker je kombinacija checkboxa in radia
if ( what == 'usercode_skip' ) {
// Dostop brez - vsi ali samo avtor
if ( $ ( '#usercode_skip_0' ) . is ( ":checked" ) ) {
var value = $ ( "input[name=" + what + "]:checked" ) . val ( ) ;
if ( value == null )
value = '1' ;
}
// Ni dostopa brez kode
else {
var value = '0' ;
}
}
else {
var value = $ ( "input[name=" + what + "]:checked" ) . val ( ) ;
}
if ( foreceReload == true ) {
var foreceReload = true ;
} else {
var foreceReload = false ;
}
$ . post ( 'ajax.php?t=surveyBaseSetting&a=radio' , { anketa : srv _meta _anketa _id , what : what , value : value } , function ( data ) {
data = jQuery . parseJSON ( data ) ;
if ( data . error == 0 ) {
//if(data.action == 0) {
if ( foreceReload == true ) {
window . location . reload ( ) ;
//} else if (data.action == 1) {
}
} else {
2021-11-05 08:06:00 +01:00
genericAlertPopup ( 'alert_parameter_datamsg' , data . msg ) ;
2020-08-14 13:36:36 +02:00
}
} ) ;
}
function surveyBaseSettingText ( what , refresh ) {
var value = '' ;
if ( $ ( '#' + what ) . length ) {
value = $ ( '#' + what ) . val ( ) ;
} else if ( $ ( '[name=' + what + ']' ) . length ) {
value = $ ( '[name=' + what + ']' ) . val ( ) ;
} else {
2021-11-05 08:06:00 +01:00
genericAlertPopup ( 'alert_save_error' ) ;
2020-08-14 13:36:36 +02:00
return false ;
}
$ . post ( 'ajax.php?t=surveyBaseSetting&a=text' , { anketa : srv _meta _anketa _id , what : what , value : value , refresh : refresh } , function ( data ) {
data = jQuery . parseJSON ( data ) ;
if ( data . error == 0 ) {
if ( data . action == 0 && refresh == true ) {
window . location . reload ( ) ;
} else if ( data . action == 1 ) {
// todo show save window
}
} else {
2021-11-05 08:06:00 +01:00
genericAlertPopup ( 'alert_parameter_datamsg' , data . msg ) ;
2020-08-14 13:36:36 +02:00
}
} ) ;
}
function alert _custom ( type , uid ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#vrednost_edit' ) . show ( ) . load ( 'ajax.php?a=alert_custom' , { anketa : srv _meta _anketa _id , type : type , uid : uid } , function ( ) {
if ( $ ( "#text" ) ) create _editor ( 'text' , false ) ;
} ) ;
}
function exportChangeCheckbox ( name ) {
$ . post ( 'ajax.php?a=exportChangeCheckbox' , { anketa : srv _meta _anketa _id , name : name } ) ;
}
function exportChangeRadio ( id , name ) {
var value = $ ( "input[name=" + name + "]:checked" ) . val ( ) ;
$ . post ( 'ajax.php?a=exportChangeRadio' , { anketa : srv _meta _anketa _id , id : id , name : name , value : value } ) ;
}
function setExpirePermanent ( ) {
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' ) {
2021-12-09 01:25:25 +01:00
// enablamo polje
$ ( "#expireManual1" ) . removeClass ( "disabled" ) ;
2021-12-15 13:27:11 +01:00
$ ( "#expire" ) . find ( ".ui-datepicker-trigger" ) . removeClass ( "disabled" ) ;
2021-12-09 01:25:25 +01:00
2020-08-14 13:36:36 +02:00
} else {
2021-12-09 01:25:25 +01:00
// disablamo polje
$ ( "#expireManual1" ) . addClass ( "disabled" ) ;
2021-12-15 13:27:11 +01:00
$ ( "#expire" ) . find ( ".ui-datepicker-trigger" ) . addClass ( "disabled" ) ;
2021-12-15 12:36:12 +01:00
2020-08-14 13:36:36 +02:00
}
$ ( "#expireManual1" ) . val ( data . expire ) ;
} ) ;
}
function changeDoCMSUserFilterCheckbox ( ) {
var checked = $ ( "#doCMSUserFilterCheckbox" ) . is ( ":checked" ) ;
$ . post ( 'ajax.php?a=doCMSUserFilterCheckbox' , { anketa : srv _meta _anketa _id , meta _akcija : srv _meta _akcija , podstran : srv _meta _podstran , checked : checked } , function ( response ) {
return reloadData ( 'status' ) ;
} ) ;
}
function anketa _restore ( anketa ) {
2022-05-23 11:46:11 +02:00
if ( confirm ( lang [ 'srv_anketa_deleted_restore_confirm' ] ) ) {
2020-08-14 13:36:36 +02:00
$ . post ( 'ajax.php?a=anketa_restore' , { id : anketa } , function ( ) {
window . location . href = 'index.php?anketa=' + anketa ;
} )
}
}
function data _restore ( anketa ) {
2022-05-23 11:46:11 +02:00
if ( confirm ( lang [ 'srv_data_deleted_restore_confirm' ] ) ) {
2020-08-14 13:36:36 +02:00
$ . post ( 'ajax.php?a=data_restore' , { id : anketa } , function ( ) {
window . location . href = 'index.php?anketa=' + anketa ;
} )
}
}
function deleteSurveyDataFile ( note ) {
if ( confirm ( note ) ) {
2021-11-05 08:06:00 +01:00
$ . post ( 'ajax.php?a=deleteSurveyDataFile' , { anketa : srv _meta _anketa _id } , function ( result ) { genericAlertPopup ( 'alert_parameter_response' , response ) } ) ;
2020-08-14 13:36:36 +02:00
}
}
function userGlobalSettingChange ( what ) {
var type = $ ( what ) . attr ( 'type' ) ;
if ( type == 'checkbox' ) {
var name = $ ( what ) . attr ( 'name' ) ;
var value = ( $ ( what ) . attr ( 'value' ) !== undefined && $ ( what ) . attr ( 'value' ) !== 'on' ) ? $ ( what ) . attr ( 'value' ) : '1' ;
var state = $ ( what ) . is ( ':checked' ) ? value : '0' ;
$ . post ( 'ajax.php?t=globalUserSettings' , { name : name , value : state } , function ( data ) { } ) ;
} else {
2021-11-05 08:06:00 +01:00
genericAlertPopup ( 'alert_userGlobalSettingChange' , type ) ;
2020-08-14 13:36:36 +02:00
}
}
function changeSurveyLock ( what ) {
var value = ( $ ( what ) . attr ( 'value' ) !== undefined && $ ( what ) . attr ( 'value' ) !== 'on' ) ? $ ( what ) . attr ( 'value' ) : '1' ;
var state = $ ( what ) . is ( ':checked' ) ? value : '0' ;
$ ( "#div_lock_survey" ) . load ( 'ajax.php?t=changeSurveyLock' , { anketa : srv _meta _anketa _id , name : 'lockSurvey' , value : state } ) ;
}
$ . fn . blink = function ( opts ) {
// allows $elem.blink('stop');
if ( opts == 'stop' ) {
// sets 'blinkStop' on element to true, stops animations,
// and shows the element. Return this for chaining.
return this . data ( 'blinkStop' , true ) . stop ( true , true ) . show ( ) ;
}
// we aren't stopping, so lets set the blinkStop to false,
this . data ( 'blinkStop' , false ) ;
// load up some default options, and allow overriding them:
opts = $ . extend ( { } , {
fadeIn : 100 ,
fadeOut : 300 ,
pauseShow : 5000
} , opts || { } ) ;
function doFadeOut ( $elem ) {
$elem = $elem || $ ( this ) ; // so it can be called as a callback too
if ( $elem . data ( 'blinkStop' ) ) return ;
$elem . delay ( opts . pauseShow ) . fadeOut ( opts . fadeOut , doFadeIn ) ;
}
function doFadeIn ( $elem ) {
$elem = $elem || $ ( this ) ;
if ( $elem . data ( 'blinkStop' ) ) return ;
$elem . fadeIn ( opts . fadeIn , doFadeOut ) ;
}
doFadeOut ( this ) ;
return this ;
} ;
function dostop _admin ( remove ) {
$ ( '#request_help_content' ) . load ( 'ajax.php?a=dostop_admin' , { anketa : srv _meta _anketa _id , remove : remove } , function ( data ) {
$ ( '#request_help_content' ) . addClass ( 'displayBlock' ) . mouseover ( function ( ) { $ ( this ) . removeClass ( 'displayBlock' ) } ) ;
} ) ;
return false ;
}
function setDataView ( what , value ) {
$ . post ( 'ajax.php?t=setDataView' , { anketa : srv _meta _anketa _id , what : what , value : value } , function ( ) {
window . location . reload ( ) ; return ;
} ) ;
}
function testiranje _preview _settings ( ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( '#vrednost_edit' ) . load ( 'ajax.php?a=testiranje_preview_settings' , { anketa : srv _meta _anketa _id } ) . show ( ) ;
}
function testiranje _preview _settings _save ( ) {
$ ( '#vrednost_edit' ) . hide ( ) ;
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
$ . post ( 'ajax.php?a=testiranje_preview_settings_save' , $ ( 'form[name="testiranje_preview_settings"]' ) . serialize ( ) , function ( ) {
/*window.location = 'index.php?anketa=' + srv_meta_anketa_id + '&a=testiranje';*/
location . reload ( ) ;
} ) ;
}
function showTestSurveySMTP ( )
{
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
2022-05-24 08:35:38 +02:00
$ ( '#general_popup' ) . html ( '' ) . addClass ( 'PopUpNarrow' ) . fadeIn ( 'slow' ) ;
2022-05-20 04:34:13 +02:00
$ ( "#general_popup" ) . load ( 'ajax.php?t=showTestSurveySMTP' , $ ( 'form[name="settingsanketa_' + srv _meta _anketa _id + '"]' ) . serialize ( ) , function ( ) { } ) ;
2020-08-14 13:36:36 +02:00
return false ;
}
function showSurveyUrlLinks ( podstran , m )
{
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
2022-05-24 08:47:20 +02:00
$ ( '#fullscreen' ) . html ( '' ) . addClass ( 'divPopUp' ) . fadeIn ( 'slow' ) ;
2020-08-14 13:36:36 +02:00
$ ( "#fullscreen" ) . load ( 'ajax.php?t=SurveyUrlLinks&a=showLinks' ,
{
anketa : srv _meta _anketa _id ,
podstran : podstran ,
m : m
} ) ;
return false ;
}
function addSurveyUrlLink ( podstran , m )
{
$ ( "#fullscreen" ) . load ( 'ajax.php?t=SurveyUrlLinks&a=addLink' ,
{
anketa : srv _meta _anketa _id ,
podstran : podstran ,
m : m
} ) ;
return false ;
}
function deleteSurveyUrlLinks ( anketa , hash , podstran , m )
{
if ( confirm ( lang [ 'srv_urlLinks_delete' ] ) ) {
$ ( "#fullscreen" ) . load ( 'ajax.php?t=SurveyUrlLinks&a=deleteLink' ,
{
anketa : anketa ,
hash : hash ,
podstran : podstran ,
m : m
} ) ;
}
return false ;
}
function changeParaAnalysisCbx ( what , reverse ) {
var value = $ ( what ) . is ( ':checked' ) ;
if ( reverse ) {
value = ! value ;
}
var what _id = $ ( what ) . attr ( 'id' ) ;
2022-04-14 01:16:30 +02:00
2020-08-14 13:36:36 +02:00
$ . post ( 'ajax.php?t=ParaAnalysis&a=setCbx' , { anketa : srv _meta _anketa _id , value : value , what : what _id } , function ( ) {
window . location . reload ( ) ;
} ) ;
return false ;
}
2022-04-14 01:16:30 +02:00
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" ) ;
}
}
2020-08-14 13:36:36 +02:00
function changeParaAnalysisSelect ( what ) {
var value = $ ( what ) . val ( ) ;
var what _id = $ ( what ) . attr ( 'id' ) ;
$ . post ( 'ajax.php?t=ParaAnalysis&a=setValue' , { anketa : srv _meta _anketa _id , value : value , what : what _id } , function ( ) {
window . location . reload ( ) ;
} ) ;
return false ;
}
function changeParaGraphFilter ( ) {
var status = $ ( 'input[name=paraGraph_filter_status]:checked' ) . val ( ) ;
if ( $ ( '#paraGraph_filter_pc' ) . is ( ':checked' ) )
var pc = 1 ;
else
var pc = 0 ;
if ( $ ( '#paraGraph_filter_tablet' ) . is ( ':checked' ) )
var tablet = 1 ;
else
var tablet = 0 ;
if ( $ ( '#paraGraph_filter_mobi' ) . is ( ':checked' ) )
var mobi = 1 ;
else
var mobi = 0 ;
if ( $ ( '#paraGraph_filter_robot' ) . is ( ':checked' ) )
var robot = 1 ;
else
var robot = 0 ;
window . location = 'index.php?anketa=' + srv _meta _anketa _id + '&a=para_graph&status=' + status + '&pc=' + pc + '&tablet=' + tablet + '&mobi=' + mobi + '&robot=' + robot ;
}
function changeUsableRespSetting ( what ) {
var what _id = $ ( what ) . attr ( 'id' ) ;
if ( what _id == 'show_with_zero' || what _id == 'show_with_text' || what _id == 'show_with_other' || what _id == 'show_details' || what _id == 'show_calculations' ) {
if ( $ ( what ) . is ( ':checked' ) )
var value = true ;
else
var value = false ;
}
else {
var value = $ ( what ) . val ( ) ;
}
$ . post ( 'ajax.php?t=surveyUsableResp&a=changeSetting' , { anketa : srv _meta _anketa _id , value : value , what : what _id } , function ( ) {
window . location . reload ( ) ;
} ) ;
return false ;
}
function cookie _alert ( ) {
function cookie _alert _do ( ) {
if ( $ ( 'input[name=cookie]:checked' ) . val ( ) != '-1' ) {
$ ( '#cookie_alert' ) . show ( ) ;
} else {
$ ( '#cookie_alert' ) . hide ( ) ;
}
} ;
$ ( 'input[name=cookie]' ) . on ( 'change' , cookie _alert _do ) ;
cookie _alert _do ( ) ;
}
/* Napredni moduli -> vklop/izklop (po novem v urejanje->nastavitve) */
function toggleAdvancedModule ( what , reload ) {
if ( typeof reload == 'undefined' )
reload = 1 ;
if ( $ ( '#advanced_module_' + what ) . is ( ':checked' ) ) {
if ( what == 'user_from_cms' )
var value = 2 ;
else
var value = 1 ;
}
else {
var value = 0 ;
}
$ ( '#globalSettingsInner' ) . load ( 'ajax.php?a=toggle_advanced_module' , { what : what , value : value , anketa : srv _meta _anketa _id } , function ( ) {
if ( reload == 1 )
window . location . reload ( ) ;
} ) ;
}
function toggleDataCheckboxes ( podstran ) {
2022-03-29 16:57:55 +02:00
if ( podstran == 'paraAnalysisGraph' ) {
$ ( "#anketa" ) . addClass ( "drop_setting_transition" ) ;
$ ( "#anketa" ) . toggleClass ( "drop_setting_margin" ) ;
}
2020-08-14 13:36:36 +02:00
if ( $ ( '#dataSettingsCheckboxes' ) . css ( 'display' ) == 'none' ) {
2022-03-07 23:31:34 +01:00
$ ( "#dataSettingsCheckboxes" ) . fadeIn ( "medium" ) ;
2022-03-24 12:25:13 +01:00
$ ( "#toggleDataCheckboxes" ) . addClass ( "active" ) ;
2020-08-14 13:36:36 +02:00
var showSettings = 1 ;
2022-03-24 12:25:13 +01:00
2022-03-29 16:57:55 +02:00
$ ( ".fa-angle-down" ) . switchClass ( "fa-angle-down" , "fa-angle-up" ) ;
2020-08-14 13:36:36 +02:00
}
else {
2022-03-24 12:25:13 +01:00
$ ( "#dataSettingsCheckboxes" ) . fadeOut ( "medium" ) ;
$ ( "#toggleDataCheckboxes" ) . removeClass ( "active" ) ;
2020-08-14 13:36:36 +02:00
var showSettings = 0 ;
2022-03-29 16:57:55 +02:00
$ ( ".fa-angle-up" ) . switchClass ( "fa-angle-up" , "fa-angle-down" ) ;
2020-08-14 13:36:36 +02:00
}
if ( podstran == 'data' ) {
$ . post ( 'ajax.php?t=dataSettingProfile&a=changeDataIconsSettings' , { anketa : srv _meta _anketa _id , dataIcons _settings : showSettings } ) ;
} else if ( podstran == 'paraAnalysisGraph' ) {
$ . post ( 'ajax.php?t=dataSettingProfile&a=changeParaAnalysisGraphSettings' , { anketa : srv _meta _anketa _id , paraAnalysisGraph _settings : showSettings } ) ;
}
else {
$ . post ( 'ajax.php?t=dataSettingProfile&a=changeUsabilityIconsSettings' , { anketa : srv _meta _anketa _id , usabilityIcons _settings : showSettings } ) ;
}
}
2022-03-29 16:57:55 +02:00
function toggle _drop _settings _margin ( ) {
$ ( "#anketa" ) . addClass ( "drop_setting_margin" ) ;
}
2022-03-23 17:45:06 +01:00
// 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 } ) ;
}
2020-08-14 13:36:36 +02:00
// Iskanje po tabeli s podatki
function data _search _filter ( ) {
var value = $ ( "#data_search_value" ) . val ( ) ;
$ . post ( 'ajax.php?t=displayData&a=set_data_search_filter' , { anketa : srv _meta _anketa _id , value : value } , function ( ) {
window . location . reload ( ) ;
} ) ;
}
// Za tabele z fiksnim headerjem
/** FLOAT HEADER function for tables and div **/
/ * * c o n t a i n e r : c l a s s = " p e r s i s t - a r e a "
* header2flow : class = "persist-header"
* /
function UpdateTableHeaders ( ) {
$ ( ".persist-area" ) . each ( function ( ) {
var el = $ ( this ) ,
offset = el . offset ( ) ,
scrollTop = $ ( window ) . scrollTop ( ) ,
floatingHeader = $ ( ".floatingHeader" , this )
if ( ( scrollTop > offset . top ) && ( scrollTop < offset . top + el . height ( ) ) ) {
floatingHeader . css ( {
"visibility" : "visible"
} ) ;
} else {
floatingHeader . css ( {
"visibility" : "hidden"
} ) ;
} ;
} ) ;
}
// DOM Ready
$ ( function ( ) {
var $floatingHeader = $ ( ".persist-header" , this ) . clone ( ) ;
$floatingHeader . children ( ) . width ( function ( i , val ) {
return $ ( ".persist-header" ) . children ( ) . eq ( i ) . width ( ) ;
} ) ;
$floatingHeader . css ( "width" , $ ( ".persist-header" , this ) . width ( ) ) . addClass ( "floatingHeader" ) ;
$ ( ".persist-header" , this ) . before ( $floatingHeader ) ;
$ ( window )
. scroll ( UpdateTableHeaders )
. trigger ( "scroll" ) ;
// V kolikor gre za modul hierarhija, potem skrijemo podatke o knjižnici ali o prevzeti anketi
if ( $ ( '[name="izberi-anketo"]' ) ) {
$ ( '[name="izberi-anketo"]' ) . on ( 'change' , function ( ) {
$ ( '#hierarhija-knjiznica' ) . html ( '' ) . hide ( ) ;
$ ( '#hierarhija-prevzeta' ) . hide ( ) ;
} ) ;
}
} ) ;
//uporablja se tudi pri analizah urejanja - class.SurveyEditsAnalysis.php
function diagnosticsChooseDate ( ) {
var selected = $ ( "#diagnostics_date_selected" ) . find ( ":selected" ) ;
var data = $ ( "#diagnostics_date_selected" ) . find ( ":selected" ) . val ( ) ;
if ( data == '99date' ) {
$ ( "#from" ) . prop ( 'disabled' , false ) ;
$ ( "#to" ) . prop ( 'disabled' , false ) ;
Calendar . setup ( {
inputField : "from" ,
ifFormat : "%Y-%m-%d %H-%M" ,
button : "from_img" ,
singleClick : true
} ) ;
Calendar . setup ( {
inputField : "to" ,
ifFormat : "%Y-%m-%d %H-%M" ,
button : "to_img" ,
singleClick : true
} ) ;
} else {
$ ( "#from" ) . prop ( 'disabled' , true ) ;
$ ( "#from" ) . val ( '' ) ;
$ ( "#to" ) . prop ( 'disabled' , true ) ;
$ ( "#to" ) . val ( '' ) ;
$ ( "#diagnostics_form" ) . submit ( ) ;
}
}
function diagnosticsParadataChooseDate ( ) {
Calendar . setup ( {
inputField : "from" ,
ifFormat : "%d.%m.%Y" ,
button : "from_img" ,
singleClick : true
} ) ;
Calendar . setup ( {
inputField : "to" ,
ifFormat : "%d.%m.%Y" ,
button : "to_img" ,
singleClick : true
} ) ;
}
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 **/
/* START FUNKCIJA ZA UREJANJE STANDARDNIH BESED*/
function inline _jezik _edit ( id _value ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
var id = $ ( "#" + id _value ) ;
id . siblings ( '.sb-edit' ) . hide ( ) ;
id . replaceWith ( '<div class="fixed-position"><div id="vrednost_edit">' +
2022-02-15 15:45:40 +01:00
'<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>' +
2020-08-14 13:36:36 +02:00
2022-02-15 15:45:40 +01:00
'<textarea name="' + id _value + '" id="' + id _value + '">' + id . html ( ) + '</textarea>' +
2020-08-14 13:36:36 +02:00
// Hidden textarea kamor shranimo staro vrednost, da jo lahko ponastavimo
2022-02-15 15:45:40 +01:00
'<textarea name="old_val_' + id _value + '" style="visibility:hidden; display:none;">' + id . html ( ) + '</textarea>' +
2020-08-14 13:36:36 +02:00
2022-02-03 13:57:24 +01:00
// Gumb shrani / zapri
2022-02-15 15:45:40 +01:00
'<div class="button_holder popup">' +
2022-02-15 22:58:55 +01:00
'<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>' +
2022-02-03 13:57:24 +01:00
'</div>' +
2020-08-14 13:36:36 +02:00
'</div></div>' ) ;
create _editor ( id _value ) ;
}
function inline _jezik _reset ( 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 ( ) ;
par . replaceWith ( '<div contentEditable="true" class="standardna-beseda-urejanje" name="' + id _value + '" id="' + id _value + '">' + old _val + '</div>' ) ;
$ ( 'textarea#polje_' + id _value ) . html ( old _val ) ;
id . siblings ( '.sb-edit' ) . hide ( ) ;
// Na novo inicializiramo on focus
inline _jezik _hover ( ) ;
//postavimo se tam, kjer smo urejalejali textarea
var t = $ ( '#polje_' + id _value ) . offset ( ) . top ;
$ ( 'html, body' ) . animate ( {
scrollTop : t
} , 100 ) ;
}
function inline _jezik _save ( id _value ) {
var id = $ ( '#' + id _value ) ;
var par = id . closest ( '.fixed-position' ) ;
CKEDITOR . instances [ id _value ] . destroy ( ) ;
par . replaceWith ( '<div contentEditable="true" class="standardna-beseda-urejanje" name="' + id _value + '" id="' + id _value + '">' + id . val ( ) + '</div>' ) ;
$ ( 'textarea#polje_' + id _value ) . html ( id . val ( ) ) ;
id . siblings ( '.sb-edit' ) . hide ( ) ;
// Na novo inicializiramo on focus
inline _jezik _hover ( ) ;
//postavimo se tam, kjer smo urejalejali textarea
var t = $ ( '#polje_' + id _value ) . offset ( ) . top ;
$ ( 'html, body' ) . animate ( {
scrollTop : t
} , 100 ) ;
//alert("form[name=settingsanketa_"+$("input[name=anketa]").val()+"]");
$ ( "form[name=settingsanketa_" + $ ( "input[name=anketa]" ) . val ( ) + "]" ) . submit ( ) ;
}
function inline _jezik _close ( id _value ) {
var id = $ ( '#' + id _value ) ;
var par = id . closest ( '.fixed-position' ) ;
CKEDITOR . instances [ id _value ] . destroy ( ) ;
par . replaceWith ( '<div contentEditable="true" class="standardna-beseda-urejanje" name="' + id _value + '" id="' + id _value + '">' + id . val ( ) + '</div>' ) ;
$ ( 'textarea#polje_' + id _value ) . html ( id . val ( ) ) ;
id . siblings ( '.sb-edit' ) . hide ( ) ;
// Na novo inicializiramo on focus
inline _jezik _hover ( ) ;
//postavimo se tam, kjer smo urejalejali textarea
var t = $ ( '#polje_' + id _value ) . offset ( ) . top ;
$ ( 'html, body' ) . animate ( {
scrollTop : t
} , 100 ) ;
}
function inline _jezik _hover ( ) {
$ ( "div.standardna-beseda-urejanje" ) . on ( {
focus : function ( ) {
var id = $ ( this ) . attr ( 'id' ) ;
$ ( this ) . siblings ( '.sb-edit' ) . show ( ) ;
$ ( this ) . parent ( ) . addClass ( 'sb-editing' ) ;
} ,
blur : function ( ) {
var id = $ ( this ) . attr ( 'id' ) ;
var value = $ ( this ) . html ( ) ;
$ ( '#polje_' + id ) . html ( value ) ;
if ( ! $ ( this ) . siblings ( ) . hasClass ( '.sb-edit' ) ) {
window . setTimeout ( function ( ) {
$ ( '#' + id ) . siblings ( '.sb-edit' ) . hide ( ) ;
} , 210 ) ;
}
$ ( this ) . parent ( ) . removeClass ( 'sb-editing' ) ;
}
} ) ;
}
function ponastavi _prevod ( id ) {
$ . post ( 'ajax.php?a=editanketasettings' , {
anketa : $ ( '[name="anketa"]' ) . val ( ) ,
extra _translations : true ,
lang : id ,
remove _lang : 1 ,
data : $ ( 'form' ) . serialize ( )
} ) . success ( function ( ) {
window . location . reload ( ) ;
} ) ;
}
/* END STANDARDNE BESEDE */
// Generiranje API kredenc
function generate _API _key ( ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
$ ( "#unread_notifications" ) . load ( 'ajax.php?a=generate_API_key' , { anketa : srv _meta _anketa _id } , function ( ) {
$ ( '#unread_notifications' ) . show ( ) ;
} ) ;
}
function close _API _window ( ) {
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
$ ( '#unread_notifications' ) . fadeOut ( 'slow' ) ;
}
// Nastavitve modula za chat
function chat _save _settings ( ) {
var code = $ ( "#chat_code" ) . val ( ) ;
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 ( ) {
2022-03-11 00:34:08 +01:00
actionNotePopup ( 'success_save' , 'success' ) ;
2020-08-14 13:36:36 +02:00
} ) ;
}
// Nastavitve modula za kviz
function quiz _save _settings ( ) {
var results = $ ( "input[name=quiz_results]:checked" ) . val ( ) ;
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 ( ) {
2022-03-11 00:34:08 +01:00
actionNotePopup ( 'success_save' , 'success' ) ;
2020-08-14 13:36:36 +02:00
} ) ;
}
// Nastavitve modula napredni parapodatki
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 ( ) {
2022-03-11 00:34:08 +01:00
actionNotePopup ( 'success_save' , 'success' ) ;
2020-08-14 13:36:36 +02:00
} ) ;
}
// brisanje vseh podatkov ankete pri naprednih parapodatkih
function advanced _paradata _data _delete ( ) {
if ( confirm ( "Are you sure?" ) ) {
$ . post ( 'ajax.php?t=advanced_paradata&=advanced_paradata&a=logDataDelete' , { anketa : srv _meta _anketa _id } , function ( ) {
location . reload ( ) ;
} ) ;
}
}
// Nastavitve modula za panel
function panel _save _settings ( ) {
var user _id _name = $ ( 'input[name=user_id_name]' ) . val ( ) ;
var status _name = $ ( 'input[name=status_name]' ) . val ( ) ;
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 ( ) {
2022-03-11 00:34:08 +01:00
actionNotePopup ( 'success_save' , 'success' ) ;
2020-08-14 13:36:36 +02:00
} ) ;
}
//za predogled radio/checkbox tipov vprasanj
var radio _list = new Array ( ) ; // seznam obkljukanih radio buttnov (kamor spadajo tudi multigrid radii)
var radio _vals = new Array ( ) ; // value za skupino radio buttnov iz radio_list (kater je dejansko obkljukan)
// preveri, ce je bil radio obkljukan in v primeru, da smo se enkrat kliknili nanj, ga odkljuka
function checkChecked ( radio ) {
// najprej preverimo ce je trenutni radio checked (in ga v tem primeru odkljuka)
for ( var i = 0 ; i < radio _list . length ; i ++ ) {
if ( radio _list [ i ] == radio . name && radio _vals [ i ] == radio . value ) {
radio _list . splice ( i , 1 ) ;
radio _vals . splice ( i , 1 ) ;
radio . checked = false ;
return ;
}
}
// ni checked, torej ga bomo dodali na seznam
// najprej preverimo ce je bil ze izbran kater drug iz skupine
for ( var i = 0 ; i < radio _list . length ; i ++ ) {
if ( radio _list [ i ] == radio . name ) {
radio _vals [ i ] = radio . value ;
return ;
}
}
// checkan je bil prvi v skupini, tko da ga mormo na novo dodat
radio _list [ radio _list . length ] = radio . name ;
radio _vals [ radio _vals . length ] = radio . value ;
}
// Nastavi razred parentu da je odkljukan (da lahko odkljukanim textom nastavljamo css)
// mm - multi grid on mobile
function setCheckedClass ( element , type , ifId ) {
var id = element . value ;
if ( ifId && type != 'mm' ) {
id = ifId ;
if ( element . checked ) {
if ( type != 16 && type != '6-3-1' && type != '6-3-2' )
$ ( '#vrednost_if_' + id ) . find ( 'td' ) . removeClass ( 'checked' ) ; //vse ostale checkboxe odstranimo
if ( type == '6-3-1' )
$ ( '#vrednost_if_' + id ) . find ( 'input:not([name$="_part_2"])' ) . closest ( 'td' ) . removeClass ( 'checked' ) ;
if ( type == '6-3-2' )
$ ( '#vrednost_if_' + id ) . find ( 'input[name$="_part_2"]' ) . closest ( 'td' ) . removeClass ( 'checked' ) ;
$ ( element ) . closest ( 'td' ) . addClass ( 'checked' ) ;
}
else {
$ ( element ) . closest ( 'td' ) . removeClass ( 'checked' ) ;
}
}
if ( type == 'mm' ) {
if ( element . checked ) {
$ ( '[for="vrednost_' + ifId + '_grid_' + id + '"]' ) . parent ( ) . siblings ( ) . removeClass ( 'checked' ) ;
$ ( '[for="vrednost_' + ifId + '_grid_' + id + '"]' ) . parent ( ) . addClass ( 'checked' ) ;
} else {
$ ( '[for="vrednost_' + ifId + '_grid_' + id + '"]' ) . parent ( ) . removeClass ( 'checked' ) ;
}
}
else {
if ( element . checked ) {
$ ( "#vrednost_if_" + id ) . addClass ( 'checked' ) ;
}
else {
$ ( "#vrednost_if_" + id ) . removeClass ( 'checked' ) ;
}
}
// za radio gumbe se ugasnemo ostale
if ( type == 1 ) {
var name = $ ( element ) . attr ( 'name' ) ;
var idVprasanja = name . substring ( 9 ) ; //dobimo ID vprasanja
//Image HotSpot: za brisanje obmocja
//identifier za sliko na katero se veze mapa z obmocji
var image1 = $ ( '#hotspot_' + idVprasanja + '_image' ) ;
$ ( "input[name=" + name + "]" ) . each ( function ( ) {
var loop _id = this . value ;
id = element . value ;
if ( loop _id != id ) {
$ ( "#vrednost_if_" + loop _id ) . removeClass ( 'checked' ) ;
$ ( '#spremenljivka_' + idVprasanja + '_vrednost_' + loop _id ) . closest ( 'td' ) . removeClass ( 'checked' ) ;
//Image HotSpot: brisemo obmocja iz slike
image1 . mapster ( 'set' , false , loop _id ) ; //spucaj trenutno obmocje iz slike
//console.log(loop_id);
}
} ) ;
}
}
// spremeni nastavitve za evoli teammeter skupino
function evoli _tm _edit ( tm _id , what , value ) {
$ . post ( 'ajax.php?t=evoliTM&a=teammeter_edit' , { tm _id : tm _id , what : what , value : value , anketa : srv _meta _anketa _id } ) ;
}
// spremeni oddelek ki ga je oznacil respondent za evoli teammeter skupino
function evoli _tm _change _oddelek ( department _id , usr _id ) {
$ . post ( 'ajax.php?t=evoliTM&a=teammeter_change_oddelek' , { department _id : department _id , usr _id : usr _id , anketa : srv _meta _anketa _id } ) ;
}
// doda nov oddelek za evoli teammeter skupino
function evoli _tm _add _oddelek ( tm _id , oddelek ) {
$ . post ( 'ajax.php?t=evoliTM&a=teammeter_add_oddelek' , { tm _id : tm _id , oddelek : oddelek , anketa : srv _meta _anketa _id } ) ;
}
// doda nov oddelek za evoli teammeter skupino
function evoli _tm _settings _add _oddelek ( tm _id ) {
var oddelek = $ ( "#tm_add_oddelek" ) . val ( ) ;
$ . post ( 'ajax.php?t=evoliTM&a=teammeter_add_oddelek' , { tm _id : tm _id , oddelek : oddelek , anketa : srv _meta _anketa _id } , function ( ) {
window . location . reload ( ) ;
} ) ;
}
// Popravimo crte med vprasanji ce imamo blok s horizontalnim izrisom vprasanj
function blockHorizontalLine ( spr _id ) {
$ ( '.spremenljivka.horizontal_block' ) . each ( function ( ) {
if ( ! $ ( this ) . prev ( ) . hasClass ( 'horizontal_block' ) && ! $ ( this ) . prev ( ) . hasClass ( 'lineOnly' ) && ! $ ( this ) . prev ( ) . hasClass ( 'tip_5' ) ) {
$ ( this ) . before ( '<div class="spremenljivka lineOnly"></div>' ) ;
}
if ( ! $ ( this ) . next ( ) . hasClass ( 'horizontal_block' ) && ! $ ( this ) . next ( ) . hasClass ( 'clr' ) && ! $ ( this ) . next ( ) . hasClass ( 'tip_5' ) ) {
$ ( this ) . after ( '<div class="clr"></div>' ) ;
}
} ) ;
}
//globalni spremenljivki za elektronski podpis
var podpisposlan = [ ] ;
var optionsPodpis = [ ] ;
/ * *
* Izbrišemo 1 ka račun - status v bazi prestavimo na 0
* /
function izbrisi1kaRacun ( ) {
if ( confirm ( lang [ 'delete_account_conformation' ] ) ) {
$ . post ( 'ajax.php?a=editanketasettings&m=global_user_myProfile' , {
izbrisiRacun : 1
} ) . success ( function ( response ) {
window . location . href = "/" ;
} ) ;
}
}
/ * *
* Shranimo spremembe racuna - ce je spremenil geslo prikazemo popup
* /
function save1kaRacunSettings ( ) {
// Preverimo, ce gre za popravljanje gesla
var geslo1 = $ ( "#p1" ) . val ( ) ;
var geslo2 = $ ( "#p2" ) . val ( ) ;
// Ce ne gre zas popravljanje gesla samo submitamo
if ( geslo1 == 'PRIMERZELODOLGEGAGESLA' && geslo2 == 'PRIMERZELODOLGEGAGESLA' ) {
document . settingsanketa . submit ( ) ;
}
// Gesla nista enaka
else if ( geslo1 != geslo2 ) {
2021-11-05 08:06:00 +01:00
genericAlertPopup ( 'cms_error_password_incorrect' ) ;
2020-08-14 13:36:36 +02:00
}
// Geslo ni dovolj kompleksno
else if ( ! complexPassword ( geslo1 ) ) {
2021-11-05 08:06:00 +01:00
genericAlertPopup ( 'password_err_complex' ) ;
2020-08-14 13:36:36 +02:00
}
// Pri popravljanju gesla ga opozorimo, da bo odjavljen
else {
if ( confirm ( lang [ 'change_account_pass_conformation' ] ) ) {
document . settingsanketa . submit ( ) ;
}
}
}
// Preverjamo ce je geslo dovolj kompleksno
function complexPassword ( password ) {
// Geslo mora imeti vsaj 8 znakov
if ( password . length < 8 ) {
return false ;
}
// Geslo mora vsebovati vsaj eno stevilko
var digits = "0123456789" ;
if ( ! stringContains ( password , digits ) ) {
return false ;
}
// Geslo mora vsebovati vsaj 1 crko
var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;
if ( ! stringContains ( password , letters ) ) {
return false ;
}
return true ;
}
// Pomozna funkcija, ki preverja, ce string vsebuje dolocene znake
function stringContains ( password , allowedChars ) {
for ( i = 0 ; i < password . length ; i ++ ) {
var char = password . charAt ( i ) ;
if ( allowedChars . indexOf ( char ) >= 0 )
return true ;
}
return false ;
}
/ * *
* Izbrišemo alternativni email
*
* @ param id
* /
2022-05-12 11:24:51 +02:00
function izbrisiAlternativniEmail ( id , email ) {
if ( confirm ( lang [ 'alternative_email_delete' ] + ' ' + email + '?' ) ) {
2020-08-14 13:36:36 +02:00
$ . post ( 'ajax.php?a=editanketasettings&m=global_user_myProfile' , {
izbrisiAlternativniEmail : 1 ,
2022-05-12 11:24:51 +02:00
alternativniEmailId : id
2020-08-14 13:36:36 +02:00
} ) . success ( function ( response ) {
window . location . reload ( ) ;
} ) ;
2022-05-12 11:24:51 +02:00
2020-08-14 13:36:36 +02:00
}
}
function dodajAlternativniEmail ( ) {
var email = $ ( '#alternativni-email' ) . val ( ) ;
$ ( '#alternativni-obvestilo' ) . hide ( ) . removeClass ( 'error' ) . removeClass ( 'success' ) ;
$ . post ( 'ajax.php?a=editanketasettings&m=global_user_myProfile' , {
'alternative_email' : email
} ) . success ( function ( response ) {
if ( response == 'success' ) {
$ ( '.dodaj-alternativni-email .vnos' ) . hide ( ) ;
var besedilo = lang [ 'login_alternative_emails_success' ] . replace ( /#email#/g , email ) ;
$ ( '#alternativno-obvestilo' ) . addClass ( 'success' ) . fadeIn ( 'slow' ) . text ( besedilo ) ;
// Ko uporabnik prebere obvestilo osvežimo stran
setTimeout ( function ( ) {
window . location . reload ( ) ;
} , 8000 ) ;
} else {
$ ( '#alternativno-obvestilo' ) . fadeIn ( 'slow' ) . addClass ( 'error' ) . text ( lang [ 'login_alternative_emails_error' ] ) . delay ( 5000 ) . fadeOut ( 'slow' ) ;
}
} ) ;
}
function check _akronim ( ) {
if ( $ ( '#novaanketa_akronim_1' ) . attr ( 'changed' ) == '0' ) {
$ ( '#novaanketa_akronim_1' ) . val ( $ ( '#novaanketa_naslov_1' ) . val ( ) ) ;
}
var max = $ ( '#novaanketa_akronim_1' ) . attr ( 'maxlength' ) ;
var leng = $ ( '#novaanketa_akronim_1' ) . val ( ) . length ;
$ ( '#novaanketa_akronim_1_chars' ) . html ( leng + ' / ' + max ) ;
}
/* START FUNKCIJA ZA UREJANJE zakljucka po deaktivaciji - popup v urejanju zakljucka */
function vprasanje _jezik _edit _zakljucek ( id _value ) {
/*$('#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 />' +
// 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>' ) ;
create _editor ( 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 ( ) ;
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 ) ;
}
function vprasanje _jezik _save _zakljucek ( id _value ) {
var id = $ ( '#' + id _value ) ;
var par = id . closest ( '.fixed-position' ) ;
CKEDITOR . instances [ 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 ) ;
} ) ;
}
function prikaziGoogle2faKodo ( ) {
$ ( '#2fa-display' ) . toggle ( ) ;
}
function aktivirajGoogle2fa ( ) {
var koda = $ ( '[name="google-2fa-validate"]' ) . val ( ) ;
$ . post ( 'ajax.php?a=editanketasettings&m=global_user_myProfile' , {
'google_2fa_koda_validate' : koda ,
} ) . success ( function ( response ) {
if ( response == 'success' ) {
window . location . reload ( ) ;
} else {
$ ( '#google-2fa-bvestilo' ) . fadeIn ( 'slow' ) . show ( ) . delay ( 5000 ) . fadeOut ( 'slow' ) ;
}
} ) ;
}
function ponastaviGoogle2fa ( ) {
$ . post ( 'ajax.php?a=editanketasettings&m=global_user_myProfile' , {
'google_2fa_akcija' : 'reset'
} ) . success ( function ( response ) {
if ( response == 'success' ) {
window . location . reload ( ) ;
} else {
$ ( '#google-2fa-bvestilo' ) . fadeIn ( 'slow' ) . show ( ) . delay ( 5000 ) . fadeOut ( 'slow' ) ;
}
} ) ;
}
function prikaziGoogle2faDeaktivacija ( ) {
$ ( '#2fa-display' ) . toggle ( ) ;
}
function deaktivirajGoogle2fa ( ) {
var koda = $ ( '[name="google-2fa-deactivate"]' ) . val ( ) ;
$ . post ( 'ajax.php?a=editanketasettings&m=global_user_myProfile' , {
'google_2fa_deaktiviraj' : koda ,
'google_2fa_akcija' : 'deactivate'
} ) . success ( function ( response ) {
if ( response == 'success' ) {
window . location . reload ( ) ;
} else {
$ ( '#google-2fa-bvestilo' ) . fadeIn ( 'slow' ) . show ( ) . delay ( 5000 ) . fadeOut ( 'slow' ) ;
}
} ) ;
}
// Ko je stran naložena
$ ( document ) . ready ( function ( ) {
$ ( '#klik-dodaj-email' ) . on ( 'click' , function ( ) {
$ ( '.dodaj-alternativni-email' ) . toggle ( ) ;
} ) ;
/ * *
* Funkcije se uporabljajo pri ustvarjanju enkete
* /
$ ( '#novaanketa_naslov_1' ) . keyup ( function ( ) {
var max = parseInt ( $ ( this ) . attr ( 'maxlength' ) ) ;
if ( $ ( this ) . val ( ) . length > max ) {
$ ( this ) . val ( $ ( this ) . val ( ) . substr ( 0 , $ ( this ) . attr ( 'maxlength' ) ) ) ;
}
$ ( '#' + $ ( this ) . attr ( 'id' ) + '_chars' ) . html ( $ ( this ) . val ( ) . length + ' / ' + max ) ;
check _akronim ( ) ;
} ) ;
$ ( '#novaanketa_akronim_1' ) . keyup ( function ( ) {
var max = parseInt ( $ ( this ) . attr ( 'maxlength' ) ) ;
if ( $ ( this ) . val ( ) . length > max ) {
$ ( this ) . val ( $ ( this ) . val ( ) . substr ( 0 , $ ( this ) . attr ( 'maxlength' ) ) ) ;
}
$ ( '#' + $ ( this ) . attr ( 'id' ) + '_chars' ) . html ( $ ( this ) . val ( ) . length + ' / ' + max ) ;
} ) ;
$ ( "#novaanketa_naslov_1" ) . focus ( ) ;
$ ( "#novaanketa_opis" ) . keypress ( function ( e ) {
if ( e . keyCode == 13 ) {
return false ;
}
} ) ;
$ ( '#novaanketa_akronim_1, #novaanketa_naslov_1' ) . keypress ( function ( e ) {
if ( e . keyCode == 13 ) {
newAnketaBlank ( ) ;
}
if ( e . keyCode == 27 ) {
window . onkeypress = function ( ) { } ;
newAnketaCancle ( ) ;
}
} ) ;
} ) ;
2021-02-22 12:56:30 +01:00
// Popup za individualno svetovanje
function consultingPopupOpen ( ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
2022-02-23 12:48:17 +01:00
$ ( '#general_popup' ) . html ( '' ) . fadeIn ( 'slow' ) ;
$ ( "#general_popup" ) . load ( 'ajax.php?a=consulting_popup_open' , { anketa : srv _meta _anketa _id } ) ;
2021-02-22 12:56:30 +01:00
}
2021-05-05 10:53:33 +02:00
// Brisanje datoteke iz podatkov
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 } ) ;
}
2021-07-20 17:18:21 +02:00
// Kopiranje URLja za anketo
2021-07-23 16:23:00 +02:00
function CopyToClipboard ( copyText ) {
2021-07-20 17:18:21 +02:00
var temp _copy = $ ( '<input>' ) . val ( copyText ) . appendTo ( 'body' ) . select ( )
document . execCommand ( 'copy' )
2022-05-20 04:34:13 +02:00
temp _copy . remove ( )
2022-03-04 01:49:58 +01:00
}
2021-07-23 16:23:00 +02:00
// Popup - opozorilo na vsa vprašanja
function popupAlertAll ( alert _type ) {
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
2022-05-20 05:20:18 +02:00
$ ( '#general_popup' ) . html ( '' ) . addClass ( 'PopUpNarrow' ) . fadeIn ( 'slow' ) ;
2022-02-23 12:48:17 +01:00
$ ( "#general_popup" ) . load ( 'ajax.php?a=alert_all_popup' , { alert _type : alert _type , anketa : srv _meta _anketa _id } ) ;
2021-07-23 16:23:00 +02:00
}
2021-11-05 08:06:00 +01:00
//Generičen alert popup
2022-05-20 04:34:13 +02:00
function genericAlertPopup ( name , optional _parameter , class _string ) {
2021-11-05 08:06:00 +01:00
if ( optional _parameter === undefined ) {
optional _parameter = "" ;
}
2022-05-20 04:34:13 +02:00
if ( class _string !== undefined ) {
$ ( '#general_popup' ) . addClass ( class _string ) ;
}
2021-11-05 08:06:00 +01:00
$ ( '#fade' ) . fadeTo ( 'slow' , 1 ) ;
2022-02-23 12:48:17 +01:00
$ ( '#general_popup' ) . html ( '' ) . fadeIn ( 'slow' ) ;
$ ( "#general_popup" ) . load ( 'ajax.php?a=genericAlertPopup' , { name : name , optional _parameter : optional _parameter } ) ;
2022-05-20 04:34:13 +02:00
2021-11-05 08:06:00 +01:00
}
2021-12-10 05:55:27 +01:00
//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 ( 'no_margin' ) ;
$ ( "#connect_IP" ) . removeClass ( 'displayNone' ) ;
}
else {
$ ( "#save_IP_warning" ) . addClass ( 'displayNone' ) ;
$ ( "#save_IP" ) . addClass ( 'no_margin' ) ;
$ ( "#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
2022-02-23 12:48:17 +01:00
$ ( "#connect_identifier_warning" ) . addClass ( 'displayNone' ) ;
}
2021-12-10 05:55:27 +01:00
2022-02-23 12:48:17 +01:00
function popupClose ( ) {
2022-03-09 10:38:45 +01:00
$ ( '#general_popup' ) . fadeOut ( 'slow' ) . html ( '' ) . attr ( 'class' , 'divPopUp' ) ;
2022-02-23 12:48:17 +01:00
$ ( '#fade' ) . fadeOut ( 'slow' ) ;
2021-12-10 05:55:27 +01:00
}
2022-03-10 11:06:17 +01:00
// Note popup spodaj levo
function actionNotePopup ( name , type ) {
$ ( '#action_note_holder' ) . html ( '' ) . load ( 'ajax.php?a=actionNotePopup' , { name : name , type : type } , function ( ) {
setTimeout ( function ( ) {
actionNotePopupClose ( ) ;
2022-03-10 11:27:43 +01:00
} , 10000 ) ;
2022-03-10 11:06:17 +01:00
} ) ;
}
2022-03-10 11:27:43 +01:00
// Zapri note popup spodaj levo
2022-03-10 11:06:17 +01:00
function actionNotePopupClose ( ) {
2022-05-26 12:13:22 +02:00
$ ( '#action_note_holder .action_note_box' ) . fadeOut ( function ( ) {
2022-03-10 11:06:17 +01:00
$ ( '#action_note_holder' ) . html ( '' ) ;
} ) ;
}
2022-03-18 00:38:05 +01:00
//Hide top_note div
function top _note _hide ( id ) {
$ ( '#' + id ) . addClass ( 'displayNone' ) ;
}
2022-03-23 16:32:53 +01:00
//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 - 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' ) ;
}
}
2022-03-24 02:02:37 +01:00
2022-03-28 14:16:14 +02:00
//Objava - privzete nastavitve
function togglePublishSettings ( ) {
$ ( "#srv_objava_info_more1, #srv_objava_info_more2" ) . toggleClass ( "displayNone" ) ;
$ ( "#publish_settings_more" ) . slideToggle ( 'medium' ) ;
}
2022-03-24 02:02:37 +01:00
//Aktivnost - toggle dropdown checkboxes
2022-03-24 13:04:37 +01:00
function toggleAktivnostCheckboxes ( type ) {
if ( type == 'units' ) {
$ ( "#dataSettingsCheckboxes" ) . fadeIn ( "medium" ) ;
$ ( "#dataSettingsCheckboxes" ) . toggleClass ( "displayNone" ) ;
2022-03-24 14:20:58 +01:00
$ ( "#toggleDataCheckboxes" ) . toggleClass ( "border_blue" ) ;
2022-03-24 13:04:37 +01:00
}
else if ( type == 'date' ) {
$ ( "#dataSettingsCheckboxes_Date" ) . fadeIn ( "medium" ) ;
$ ( "#dataSettingsCheckboxes_Date" ) . toggleClass ( "displayNone" ) ;
2022-03-24 14:20:58 +01:00
$ ( "#toggleDataCheckboxes_Date" ) . toggleClass ( "border_blue" ) ;
2022-03-24 13:04:37 +01:00
}
2022-04-29 01:38:57 +02:00
}
function toggleAddComment ( box _id ) {
var toggle = '#comment_toggle_' + box _id ;
var wrapper = '#comment_wrapper_' + box _id ;
$ ( toggle ) . toggle ( ) ;
$ ( wrapper ) . toggle ( ) ;
2022-06-17 04:47:26 +02:00
}
2022-06-18 16:14:20 +02:00
function closeCommentQtip ( box _id ) {
var content = '#survey_comment_' + box _id ;
$ ( content ) . closest ( '.qtip ' ) . qtip ( "hide" ) ;
}
2022-06-17 04:47:26 +02:00
function toggleGrafiColorWheel ( ) {
$ ( "#chart_custom_skin_cover" ) . css ( "pointer-events" , "auto" ) ;
2022-07-08 08:02:54 +02:00
}
function toggleSurveyTopSettings ( ) {
$ ( "#top_napredne_icon" ) . toggleClass ( "fa-angle-down" ) ;
$ ( "#top_napredne_icon" ) . toggleClass ( "fa-angle-up" ) ;
$ ( "#top_napredne_gumb" ) . toggleClass ( "border_blue" ) ;
2022-07-11 13:33:44 +02:00
$ ( "#top_napredne_dropdown" ) . toggleClass ( "displayNone" ) ;
2022-07-14 15:07:24 +02:00
}
//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 } ) ;
2022-08-16 16:54:37 +02:00
}
// kliči popup
function show _gdpr _messeage ( id _sporocila ) {
$ ( '#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 : srv _meta _anketa _id } ) ;
console . log ( id _sporocila ) ;
2022-08-19 03:20:25 +02:00
}
function toggleCommentOptions ( id ) {
$ ( "#options_" + id ) . toggleClass ( "displayNone" ) ;
2022-03-28 14:16:14 +02:00
}