diff --git a/admin/survey/classes/class.SurveyInvitationsNew.php b/admin/survey/classes/class.SurveyInvitationsNew.php index 72e4273cd..4ae70995c 100644 --- a/admin/survey/classes/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/class.SurveyInvitationsNew.php @@ -533,12 +533,6 @@ class SurveyInvitationsNew { $default_fields['inv_field_relation'] = 0; } - // pri personaliziranih aporočilih je e-mail obvezno polje - //if (!in_array('inv_field_email',$fields)) { - // array_push($fields, 'inv_field_email'); - //} - - # skreiramo nov vrstni red polj if (count($fields) > 0) { foreach ($fields as $key=>$field) { @@ -558,10 +552,9 @@ class SurveyInvitationsNew { $import_type = isset($_POST['import_type']) ? (int)$_POST['import_type'] : 2; session_start(); $checked = (isset($_SESSION['inv_rec_only_this_survey']) && (int)$_SESSION['inv_rec_only_this_survey'] == 1) ? '1' : '0'; - # profili respondentov - #echo '
'; + + # profili respondentov echo '
'; - # echo '
'; echo '
'; echo '
'; @@ -578,18 +571,20 @@ class SurveyInvitationsNew { list($sysUserToAdd) = mysqli_fetch_row($sysUserToAddQuery); } - # echo ''; echo ''; echo ''; echo ''; - echo Help::display('inv_recipiens_from_system'); + + echo Help::display('inv_recipiens_from_system'); + + echo '
'; echo '
'; - echo '
'; - if ($import_type == 3) { - #$this->displayFromSystemVariables(); + + if ($import_type == 3) { $this->createSystemVariablesMapping(); - } else { + } + else { # sporočilo za personalizirana e-vabila in respondente iz baze @@ -8858,10 +8853,7 @@ class SurveyInvitationsNew { } # pri personaliziranih aporočilih je e-mail obvezno polje - //if (!in_array('inv_field_email',$fields)) { - array_push($fields, 'inv_field_email'); - #} - + array_push($fields, 'inv_field_email'); # skreiramo nov vrstni red polj if (count($fields) > 0) { diff --git a/admin/survey/script/invitations.js b/admin/survey/script/invitations.js index 863c0059a..e84fccc69 100644 --- a/admin/survey/script/invitations.js +++ b/admin/survey/script/invitations.js @@ -3,8 +3,6 @@ function deleteRecipient_confirm(inv_rid) { $('#fade').fadeTo('slow', 1); $('#fullscreen').html('').fadeIn('slow'); $("#fullscreen").load('ajax.php?t=invitations&a=delete_recipient_confirm', {anketa:srv_meta_anketa_id, inv_rid:inv_rid,noNavi:'true'}); - - //#$(".anketa_edit_main").load('ajax.php?t=invitations&a=delete_recipient', {anketa:srv_meta_anketa_id, inv_rid:inv_rid}); } function inv_delete_recipient() { var inv_rid = $("#inv_delete_rec_confirm input#inv_rid").val(); @@ -32,7 +30,8 @@ function inv_arch_recipients_close() { function inv_arch_save_comment() { var aid = $("#inv_arch_id").val(); var comment = $("#inv_arch_comment").val(); - $.post('ajax.php?t=invitations&a=arch_save_comment', {anketa:srv_meta_anketa_id, aid:aid, comment:comment, noNavi:'true'}, function(data) { + + $.post('ajax.php?t=invitations&a=arch_save_comment', {anketa:srv_meta_anketa_id, aid:aid, comment:comment, noNavi:'true'}, function(data) { // to ni vredu.window.location.reload(); $('#fade').fadeOut('slow'); $('#fullscreen').fadeOut('slow').html(''); @@ -48,7 +47,7 @@ function inv_arch_recipients_send() { checkboxes = checkboxes+prefix+$(this).val(); prefix = ","; }); - //$("#inv_send_mail_finish").html('Pošiljam...'); + $('#fullscreen').load('ajax.php?t=invitations&a=send_mail', {anketa:srv_meta_anketa_id, noNavi:'true',send_type:send_type, checkboxes:checkboxes} ); @@ -56,15 +55,18 @@ function inv_arch_recipients_send() { function inv_change_import_type() { var import_type = $('input[name=inv_import_type]:checked').val(); - $("#inv_import").load('ajax.php?t=invitations&a=change_import_type', {anketa:srv_meta_anketa_id, import_type:import_type,noNavi:'true'}); + $("#inv_import").load('ajax.php?t=invitations&a=change_import_type', {anketa:srv_meta_anketa_id, import_type:import_type,noNavi:'true'}, function(){ + refreshFieldsList(); + }); } function toggleInvCheckbox(what) { var id = $(what).attr("id"); if ( $(what).is(":checked") ) { - $(what).parent().addClass('inv_field_enabled'); - } else { - $(what).parent().removeClass('inv_field_enabled'); + $(what).parent().addClass('inv_field_enabled'); + } + else { + $(what).parent().removeClass('inv_field_enabled'); } refreshFieldsList(); @@ -193,47 +195,18 @@ function inv_save_recipient() { $.post('ajax.php?t=invitations&a=save_recipient', {anketa:srv_meta_anketa_id, inv_rid:inv_rid, rec_email:rec_email, rec_password:rec_password, rec_firstname:rec_firstname, rec_lastname:rec_lastname, rec_salutation:rec_salutation, rec_phone:rec_phone, rec_custom:rec_custom, rec_relation:rec_relation, noNavi:'true'}, function(data) { - data = jQuery.parseJSON(data); - if (data.error == "0") { + + data = jQuery.parseJSON(data); + + if (data.error == "0") { // smo shranli lahko zapremo okno in refrešamo podatke $('#fade').fadeOut('slow'); $('#fullscreen').fadeOut('slow').html(''); // Refreshamo celotno stran - location.reload(); - - // zamenjamo samo podatke v izbrani vrstici - TO NE DELA - //$(".anketa_edit_main").load('ajax.php?t=invitations&a=view_recipients', {anketa:srv_meta_anketa_id}); - /*var tr = $('#tbl_recipients_list tr td input[value="'+data.rid+'"]').closest('tr'); - - emailHtml= ''+data.rec.email+''; - // email = 7 - if ($('#tbl_recipients_list tr th:nth-child(5)').html()==('EMAIL')) { - $(tr).find(':nth-child(7)').html(emailHtml); - } - // geslo = 8 - if ($('#tbl_recipients_list tr th:nth-child(6)').html()==('PASSWORD')) - $(tr).find(':nth-child(8)').html(data.rec.password); - // email = 9 - if ($('#tbl_recipients_list tr th:nth-child(7)').html()==('FIRSTNAME')) - $(tr).find(':nth-child(9)').html(data.rec.firstname); - // geslo = 10 - if ($('#tbl_recipients_list tr th:nth-child(8)').html()==('LASTNAME')) - $(tr).find(':nth-child(10)').html(data.rec.lastname); - // email = 11 - if ($('#tbl_recipients_list tr th:nth-child(9)').html()==('SALUTATION')) - $(tr).find(':nth-child(11)').html(data.rec.salutation); - // geslo = 12 - if ($('#tbl_recipients_list tr th:nth-child(10)').html()==('PHONE')) - $(tr).find(':nth-child(12)').html(data.rec.phone); - // geslo = 13 - if ($('#tbl_recipients_list tr th:nth-child(11)').html()==('CUSTOM')) - $(tr).find(':nth-child(13)').html(data.rec.custom); - // odnos - if ($('#tbl_recipients_list tr th:nth-child(12)').html()==('RELATION')) - $(tr).find(':nth-child(14)').html(data.rec.relation); */ - - } else { + location.reload(); + } + else { // prikažemo obvestilo o napaki $("#inv_error_note").html(data.msg); $("#inv_error_note").show(); @@ -377,16 +350,20 @@ function mailToSourceChange() { } function mailToSourceCheckboxChange() { + var send_type = $('input[name=mailto]:checked').val(); var prefix = ""; - var checkboxes = ""; + var checkboxes = ""; + $('input[name="mailto_status[]"]:checked').each(function(el) { checkboxes = checkboxes+prefix+$(this).val(); prefix = ","; - }); + }); + var source_type = $('input[name=mailsource]:checked').val(); var source_lists = ""; - var prefix = ""; + var prefix = ""; + $('input[name="mailsource_lists[]"]:checked').each(function(el) { source_lists = source_lists+prefix+$(this).val(); prefix = ","; @@ -394,36 +371,43 @@ function mailToSourceCheckboxChange() { $("#inv_select_mail_to_respondents").load('ajax.php?t=invitations&a=view_send_recipients', {anketa:srv_meta_anketa_id, noNavi:'true',send_type:send_type, checkboxes:checkboxes, source_type:source_type, source_lists:source_lists}, function(){ var cb = $('#tbl_recipients_send_list tr td').length; - if (cb > 0 ) { + + if (cb > 0 ) { $("#inv_send_mail_btn").show(); - } else { + } + else { $("#inv_send_mail_btn").hide(); } - if (cb > 4999 ) { + + if (cb > 4999 ) { $("#inv_send_mail_limit").show(); - } else { + } + else { $("#inv_send_mail_limit").hide(); } - }); - } function mailTocheCheckboxChange() { + // izberemo rado za status $('#mailto4').attr('checked', true); - var send_type = $('input[name=mailto]:checked').val(); + + var send_type = $('input[name=mailto]:checked').val(); var prefix = ""; var checkboxes = ""; - $('input[name="mailto_status[]"]:checked').each(function(el) { + + $('input[name="mailto_status[]"]:checked').each(function(el) { checkboxes = checkboxes+prefix+$(this).val(); prefix = ","; }); - var source_type = $('input[name=mailsource]:checked').val(); + + var source_type = $('input[name=mailsource]:checked').val(); var source_lists = ""; var prefix = ""; - $('input[name="mailsource_lists[]"]:checked').each(function(el) { + + $('input[name="mailsource_lists[]"]:checked').each(function(el) { source_lists = source_lists+prefix+$(this).val(); prefix = ","; }); @@ -440,13 +424,14 @@ function mailTocheCheckboxChange() { } else { $("#inv_send_mail_limit").hide(); } - }); }; function invitations_init() { + $(".inv_checkbox").live('change', function(event) { toggleInvCheckbox(this); - }); + }); + $("#inv_upload_recipients").live('click', function(event) { var inv_iid = $("#inv_iid").val(); $("#inv_recipients_upload_form").submit(); @@ -970,19 +955,23 @@ function invSendMail() { }; */ function inv_del_rec_profile() { - var pid = $("#inv_import_list_profiles ol li.active").attr("pid"); + + var pid = $("#inv_import_list_profiles ol li.active").attr("pid"); + if (confirm(lang['srv_inv_recipients_delete_profile_confirm'])) { + $.post('ajax.php?t=invitations&a=delete_rec_profile', {anketa:srv_meta_anketa_id, pid:pid, noNavi:'true'}, function(data) { - // osvežimo polja - //inv_change_import_type(); - var new_pid = $("#inv_import_list_profiles ol li").first().attr('pid'); - // če je slučajno isti kot smo ga zbrisli izberemo nasledenjega + + // osvežimo polja + var new_pid = $("#inv_import_list_profiles ol li").first().attr('pid'); + + // če je slučajno isti kot smo ga zbrisli izberemo nasledenjega if (new_pid == pid) { var new_pid = $("#inv_import_list_profiles ol li").first().next().attr('pid'); - } + } + $(".anketa_edit_main").load('ajax.php?t=invitations&a=use_recipients_list', {anketa:srv_meta_anketa_id, pid:new_pid }); }); - } } @@ -1554,36 +1543,7 @@ function mailSourceMesageChange(what) { $("#inv_select_mail_preview").load('ajax.php?t=invitations&a=make_default_from_preview', {anketa:srv_meta_anketa_id, mid:mid,noNavi:'true'}); } } -/* -function inv_add_sysusers() { - // polovimo izbrane sistemske variable in prikazemo podatke - var sysVariables = $("#inv_sys_container ul.connectedSortable").sortable('toArray'); - $(".anketa_edit_main").load('ajax.php?t=invitations&a=addSysusers', {anketa:srv_meta_anketa_id, sysVariables:sysVariables}); -} -function inv_sysvar_change(what) { - var elChecked = $(what).is(':checked'); - var elSprId = $(what).attr('spr_id'); - var elId = $(what).attr('id'); - var elNaslov = $(what).attr('naslov'); - //odvisno ali checkbox obkljukamo ali odstranimo, osvežimo izbor polij - if (elChecked) { - // element dodamo na konec - $("#inv_sys_container ul.connectedSortable") - .append('
  • '+elNaslov+'
  • '); - } else { - $('#invSysVarLi_'+elSprId).remove(); - } - inv_sysvar_refresh_data(); -} - -function inv_sysvar_refresh_data() { - // polovimo izbrane sistemske variable in prikazemo podatke - var sysVariables = $("#inv_sys_container ul.connectedSortable").sortable('toArray'); - //alert(sysVariables); - $("#inv_sys_user_list").load('ajax.php?t=invitations&a=showSysUsers', {anketa:srv_meta_anketa_id,noNavi:'true', sysVariables:sysVariables}); -} -*/ function inv_set_sort_field(field,type) { $.post('ajax.php?t=invitations&a=setSortField', {anketa:srv_meta_anketa_id,noNavi:'true', field:field,type:type}, function() { $(".anketa_edit_main").load('ajax.php?t=invitations&a=view_recipients', {anketa:srv_meta_anketa_id});