summaryrefslogtreecommitdiffstats
path: root/admin/survey/script/GDPR.js
blob: 15be2569cbba4da1d1a7ff7718c8927cd5fc5ffd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/* FUNKCIJE ZA UREJANJE GDPR NASTAVITEV */
function editGDPRSurvey(ank_id){
	
	var form_serialize = $('form[name="settingsanketa_'+ank_id+'"]').serializeArray();
	form_serialize[form_serialize.length] = {name: 'ank_id', value: ank_id};
	
	$.post('ajax.php?t=gdpr&a=gdpr_edit_anketa&s=1', form_serialize, function(){
		window.location.reload();
	});
}
// Prikazemo/skrijemo nastavitve katere osebne podatke (gdpr) zbiramo
function showGDPRSettings(){
    
    // Prikazemo/skrijemo identifikatorje
    var is_gdpr = $("input[name='is_gdpr']:checked").val();

    var is_identifier = 0;
    is_identifier += parseInt($("input[name='name']:checked").val());
    is_identifier += parseInt($("input[name='email']:checked").val());
    is_identifier += parseInt($("input[name='location']:checked").val());
    is_identifier += parseInt($("input[name='phone']:checked").val());
    is_identifier += parseInt($("input[name='web']:checked").val());
    is_identifier += parseInt($("input[name='other']:checked").val());

    if(is_gdpr == '1'){
        $("#gdpr_data_identifiers").show('fast');
    }
    else{
        $("#gdpr_data_identifiers").hide('fast');
    }

	if(is_identifier > 0 && is_gdpr == '1'){
        $("#gdpr_data_settings").show('fast');
        $("#gdpr_additional_info").show('fast');
        $("#gdpr_export_individual").show('fast');
        $("#gdpr_export_activity").show('fast');
    }
	else{
        $("#gdpr_data_settings").hide('fast');
        $("#gdpr_additional_info").hide('fast');
        $("#gdpr_export_individual").hide('fast');
        $("#gdpr_export_activity").hide('fast');
    }
}
// Prikazemo/skrijemo opozorilo za uporabo gdpr templata
function showGDPRTemplate(val){
	
	if(val == '1'){
		$("#gdpr_data_template").show();
		$("#gdpr_data_template_warning").hide();
	}
	else{
		$("#gdpr_data_template").hide();
		$("#gdpr_data_template_warning").show();
	}
}
// Prikazemo preview uvoda v gdpr nasatvitvah ankete
function previewGDPRIntro(){
	
	var ank_id = $("input[name=anketa]").val();
	
	$('#fullscreen').html('').fadeIn('slow').draggable({
        delay: 100
    });
    $('#fade').fadeTo('slow', 1);
    $('#fullscreen').load('ajax.php?t=gdpr&a=gdpr_preview_intro', {
        ank_id: ank_id
    }).draggable({
        delay: 100
    });
}
// Prikazemo/skrijemo textarea za drugo pri zbiranju gdpr podatkov
function toggleGDPROtherText(obj){
    
    var val = $(obj).val();

    // Enable text input
    if(val == '1'){
        $('#other_text').show('fast');
    }
    // Disable text input
    else{
        $('#other_text').hide('fast');
    }
}
// Enablamo/disablamo text polja pri dodatnih informacijah
function toggleGDPRInfoText(obj){
    
    var name = $(obj).attr("name");
    var val = $(obj).val();

    // Enable text input
    if(val == '1'){
        $(".line_text." + name).prop("disabled", false);
    }
    // Disable text input
    else{
        $(".line_text." + name).prop("disabled", true);
    }
}

// Prikazemo preview posameznega izvoza
function previewGDPRExport(type){
	
	var ank_id = $("input[name=anketa]").val();

    $('#fullscreen').addClass("divPopUp");
	
	$('#fullscreen').html('').fadeIn('slow').draggable({
        delay: 100
    });
    $('#fade').fadeTo('slow', 1);
    $('#fullscreen').load('ajax.php?t=gdpr&a=gdpr_preview_export', {
        ank_id: ank_id,
        type: type
    }).draggable({
        delay: 100
    });
}

// Nastavimo anketo da je GDPR
function setGDPRSurvey(ank_id, checked){
	
	var gdpr = '0';
	if(checked)
		gdpr = '1';
	
	$("#gdpr_nastavitve").load('ajax.php?t=gdpr&a=gdpr_add_anketa', {ank_id: ank_id, value:gdpr});
}

// Urejamo GDPR profilne nastavitve avtorja
function editGDPRProfile(){
	
	var form_serialize = $("#form_gdpr_user_settings").serializeArray();
	
	$("#gdpr_nastavitve").load('ajax.php?t=gdpr&a=gdpr_edit_user&s=1', form_serialize);
}
// Prikazemo/skrijemo nastavitve katere osebne podatke (gdpr) zbiramo
function editGDPRAuthority(country){

	$("#gdpr_authority_info").load('ajax.php?t=gdpr&a=gdpr_edit_authority', {country: country});
}
// Prikazemo/skrijemo nastavitve organizacije in dpo-ja (ce je zasebnik)
function toggleGDPRDPO(){

	var organization = $('input[name=type]:checked').val();
	var has_dpo = $('input[name=has_dpo]:checked').val();

	if(organization == '1' || has_dpo == '1')
        $("#gdpr_dpo").removeClass('displayNone');

	else
        $("#gdpr_dpo").addClass('displayNone');

        
    if(organization == '1'){
        $("#gdpr_organization").removeClass('displayNone');
        $("#gdpr_has_dpo").addClass('displayNone');
        $("#gdpr_has_dpo").find('.setting_holder').removeClass('bottom16');

    }
	else{
        $("#gdpr_organization").addClass('displayNone');
        $("#gdpr_has_dpo").removeClass('displayNone');
        $("#gdpr_has_dpo").find('.setting_holder').addClass('bottom16');
    }
}
// Prikazemo/skrijemo nastavitve organizacije in dpo-ja (ce je zasebnik)
function toggleGDPRHasDPO(){

	var has_dpo = $('input[name=has_dpo]:checked').val();

	if(has_dpo == '1')
		$("#gdpr_dpo").removeClass('displayNone');

	else
		$("#gdpr_dpo").addClass('displayNone');
}

// Nastavimo zahtevo za izbris da je opravljena
function setGDPRRequestStatus(request_id, checked){
		
	var value = '0';
	if(checked)
		value = '1';
	
	$("#gdpr_nastavitve").load('ajax.php?t=gdpr&a=gdpr_request_done', {request_id: request_id, value:value});
}
// Nastavimo zahtevo za izbris da je opravljena - znotraj ankete
function setGDPRRequestStatusSurvey(request_id, checked){
	
	var ank_id = $("input[name=anketa]").val();
		
	var value = '0';
	if(checked)
		value = '1';
	
	$("#survey_requests").load('ajax.php?t=gdpr&a=gdpr_request_done_survey', {request_id: request_id, value:value, ank_id:ank_id});
}

// Nastavimo komentar zahtevi za izbris
function setGDPRRequestComment(request_id, text){
		
	var value = text;
	
	$("#gdpr_nastavitve").load('ajax.php?t=gdpr&a=gdpr_request_comment', {request_id: request_id, value:value});
}
// Nastavimo komentar zahtevi za izbris - znotraj ankete
function setGDPRRequestCommentSurvey(request_id, text){
	
	var ank_id = $("input[name=anketa]").val();
	var value = text;
	
	$("#survey_requests").load('ajax.php?t=gdpr&a=gdpr_request_comment_survey', {request_id: request_id, value:value, ank_id:ank_id});
}


// Filter po gdpr anketah - seznam anket
function gdpr_ankete(){

    var check_gdpr_ankete = document.getElementById('gdpr_ankete_check');
    
    if (check_gdpr_ankete.checked){
        check_gdpr_ankete.checked = false;

        // box-u odstranimo barvo
        $('#num_box1').removeClass('checked');

        // skrijemo vrstice v tabeli
        $('.green_row').hide();
    }
    else {
        check_gdpr_ankete.checked = true;

        // box-u dodamo barvo
        $('#num_box1').addClass('checked');

        // prikazemo vrstice v tabeli
        $('.green_row').show();
    }
}

// Filter po potencialnih gdpr anketah - seznam anket
function potenc_gdpr_ankete(){

    var check_potenc_gdpr = document.getElementById('potenc_gdpr_ankete_check');

    if (check_potenc_gdpr.checked){
        check_potenc_gdpr.checked = false;

        // box-u odstranimo barvo
        $('#num_box2').removeClass('checked');

        // skrijemo vrstice v tabeli
        $('.red_row').hide();
    }
    else {
        check_potenc_gdpr.checked = true;
        
        // box-u dodamo barvo
        $('#num_box2').addClass('checked');

        // prikazemo vrstice v tabeli
        $('.red_row').show();
    }
}

// Filter po ne-gdpr anketah - seznam anket
function ne_gdpr_ankete(){

    var check_negdpr_ankete = document.getElementById('ne_gdpr_ankete');

    if (check_negdpr_ankete.checked){
        check_negdpr_ankete.checked = false;

        // box-u odstranimo barvo
        $('#num_box3').removeClass('checked');

        // skrijemo vrstice v tabeli
        $('.grey_row').hide();
    }
    else {
        check_negdpr_ankete.checked = true;
        
        // box-u dodamo barvo
        $('#num_box3').addClass('checked');

        // prikazemo vrstice v tabeli
        $('.grey_row').show();
    }
}