{include file='include/colorbox.inc.tpl'} {combine_script id='piwecard' load="footer" path='plugins/Piwecard/js/piwecard.js'} {footer_script require="piwecard"}{literal} jQuery(document).ready(function(){ jQuery("#createECardOpen").colorbox({ inline:true, href:"#addECardForm", width:"50%", minWidth:"500px", height:"90%", onComplete:function(){ {/literal}var nbMaxRecipients = {$ecard.nb_max_recipients};{literal} $("#cboxLoadedContent").css('background-color', $("#thePicturePage").css('background-color')); $(".ecard_defaultText").each(function(){ defaultTextFocusOut($(this)); }); if (nbMaxRecipients <= 1) $('#ecard_add_recipient').css("display", "none"); } }); jQuery(document).on("focusin", ".ecard_defaultText", function() { defaultTextFocusIn($(this)); }); jQuery(document).on("focusout", ".ecard_defaultText", function() { defaultTextFocusOut($(this)); }); function defaultTextFocusIn(element) { if (element.val() == element[0].title) { element.removeClass("ecard_defaultTextActive"); element.val(""); } } function defaultTextFocusOut(element) { if (element.val() == "") { element.addClass("ecard_defaultTextActive"); element.val(element[0].title); } } $('#ecard_add_recipient').click(function() { var num = $('.ecard_name_recipient').length-1; var newNum = new Number(num + 1); {/literal}var nbMaxRecipients = {$ecard.nb_max_recipients}-1;{literal} if (newNum <= nbMaxRecipients) { var newRecipient = $('#ecard_field_recipient_' + num).clone().attr('id', 'ecard_field_recipient_' + newNum); newRecipient.find('.ecard_mandatory_fields').remove(); newRecipient.find('.ecard_error').css("display", "none"); newRecipient.find('#ecard_recipient_name_' + num + '_error').attr('id', 'ecard_recipient_name_' + newNum + '_error'); newRecipient.find('#ecard_recipient_email_' + num + '_error').attr('id', 'ecard_recipient_email_' + newNum + '_error'); newRecipient.find('#ecard_recipient_name_' + num).attr({ id: 'ecard_recipient_name_' + newNum, name: 'ecard_recipient_name[' + newNum+']', value: '' }); newRecipient.find('#ecard_recipient_email_' + num).attr({ id: 'ecard_recipient_email_' + newNum, name: 'ecard_recipient_email[' + newNum+']', value: '' }); newRecipient.find('#ecard_recipient_name_' + newNum).removeClass("ecard_error_input"); newRecipient.find('#ecard_recipient_email_' + newNum).removeClass("ecard_error_input"); defaultTextFocusOut(newRecipient.find('#ecard_recipient_name_' + newNum)); defaultTextFocusOut(newRecipient.find('#ecard_recipient_email_' + newNum)); $('#ecard_field_recipient_' + num).after(newRecipient); } if (newNum == nbMaxRecipients) { $('#ecard_add_recipient').css("display", "none"); } }); }); function piwecard_checkForm(form) { var titleOK = piwecard_checkField(form.ecard_title, 0, 'block'); var messageOK = piwecard_checkField(form.ecard_message, 0, 'block'); var senderNameOK = piwecard_checkField(form.ecard_sender_name, 0, 'block'); var senderEMailOK = piwecard_checkField(form.ecard_sender_email, 1, 'block'); var recipientNameOK = new Array(); var recipientEMailOK = new Array(); var nbAdditionalRecipients = 0; var allRecipientNamesOK = false; var allRecipientEmailsOK = false; while(document.getElementById("ecard_recipient_email_" + nbAdditionalRecipients)) { var id_name = "ecard_recipient_name_"+nbAdditionalRecipients; var id_email = "ecard_recipient_email_"+nbAdditionalRecipients; recipientEMailOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_email), 1, 'block', true); if (nbAdditionalRecipients == 0) { recipientNameOK[0] = piwecard_checkField(form.ecard_recipient_name_0, 0, 'block'); recipientEMailOK[0] = piwecard_checkField(form.ecard_recipient_email_0, 1, 'block'); } else if (recipientEMailOK[nbAdditionalRecipients] && document.getElementById(id_email).value != '') { recipientNameOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_name), 0, 'block', true); } nbAdditionalRecipients++; } for (var i=0; i
{'piwecard_send_stage1'|@translate}
{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}
{'Title'|@translate}* :
{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}
{'piwecard_message'|@translate}* :
{'piwecard_send_stage2'|@translate}
{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}
{'piwecard_error'|@translate} {'piwecard_error_email'|@translate}
{'piwecard_sender'|@translate}* :
{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}
{'piwecard_error'|@translate} {'piwecard_error_email'|@translate}
{'piwecard_recipient'|@translate}* :
{'piwecard_add_recipient'|@translate}
{'piwecard_send_stage3'|@translate}
{'piwecard_email_format'|@translate} : {foreach from=$ecard_email_format item=ecard_email_format} {/foreach}
{if isset($ecard_validity)} {'piwecard_validity_label'|@translate} : {foreach from=$ecard_validity item=ecard_validity} {/foreach} {else} {/if}
{'piwecard_send_stage4'|@translate}
* {'piwecard_send_mandatory_fields'|@translate}
{'piwecard_send_link'|@translate}