Changeset 20254 for extensions/Piwecard
- Timestamp:
- Jan 19, 2013, 12:38:40 AM (12 years ago)
- Location:
- extensions/Piwecard
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Piwecard/admin/admin_configuration.php
r20229 r20254 10 10 $configuration = array(); 11 11 12 $configuration['nb_max_recipients'] = $_POST['ecard_nb_max_recipients']; 13 14 if (intval($configuration['nb_max_recipients']) == 0) { 15 $configuration['nb_max_recipients'] = 1; 16 $piwecard->config['nb_max_recipients'] = $configuration['nb_max_recipients']; 17 } else { 18 $piwecard->config['nb_max_recipients'] = intval($configuration['nb_max_recipients']); 19 } 20 12 21 $configuration['validity'] = $_POST['ecard_validity_list']; 13 22 $configuration['validity'] = explode(',', $configuration['validity']); … … 103 112 } 104 113 114 $template->assign('ecard_nb_max_recipients',((isset($configuration['nb_max_recipients'])) ? $configuration['nb_max_recipients'] : $piwecard->config['nb_max_recipients'])); 115 105 116 if (isset($errors['validity'])) { 106 117 $piwecard->config['validity'] = null; -
extensions/Piwecard/admin/template/admin_configuration.tpl
r20229 r20254 79 79 80 80 function piwecard_checkForm(form) { 81 var guestEmailOK = piwecard_checkField(form.ecard_default_guest_email, 1, true); 82 var subjectOK = piwecard_checkField(form.ecard_email_subject, 0); 83 var messageTextOK = piwecard_checkField(form.ecard_email_message_text, 0); 84 var messageHTMLOK = piwecard_checkField(form.ecard_email_message_html, 0); 85 86 if(guestEmailOK && subjectOK && messageTextOK && messageHTMLOK) 81 var nbMaxRecipientsOK = piwecard_checkField(form.ecard_nb_max_recipients, 2, 'inline'); 82 var guestEmailOK = piwecard_checkField(form.ecard_default_guest_email, 1, 'block', true); 83 var subjectOK = piwecard_checkField(form.ecard_email_subject, 0, 'block'); 84 var messageTextOK = piwecard_checkField(form.ecard_email_message_text, 0, 'block'); 85 var messageHTMLOK = piwecard_checkField(form.ecard_email_message_html, 0, 'block'); 86 87 if(nbMaxRecipientsOK && guestEmailOK && subjectOK && messageTextOK && messageHTMLOK) 87 88 return true; 88 89 else … … 120 121 <legend>{'piwecard_configuration'|@translate}</legend> 121 122 <div class="ecard_form_line"> 123 <label for="ecard_nb_max_recipients">{'piwecard_nb_max_recipients'|@translate} </label> 124 <input type="text" maxlength="3" size="3" name="ecard_nb_max_recipients" id="ecard_nb_max_recipients" value="{$ecard_nb_max_recipients}" /> 125 <span class="ecard_error" id="ecard_nb_max_recipients_error">{'piwecard_error'|@translate} {'piwecard_error_integer'|@translate}</span> 126 </div> 127 <div class="ecard_form_line"> 122 128 {'piwecard_validity_list'|@translate} 123 129 <span class="ecard_error" id="ecard_validity_list_error" style="{$ecard_errors.validity.style_error_text}">{'piwecard_error'|@translate} {'piwecard_error_validity_list'|@translate}</span> … … 179 185 </div> 180 186 </fieldset> 181 182 187 <fieldset> 183 188 <legend>{'piwecard_email_configuration'|@translate}</legend> … … 208 213 </div> 209 214 <div class="ecard_form_line ecard_email_config"> 210 <label for="ecard_default_guest_email">{'piwecard_default_guest_email'|@translate}</label><span class="ecard_error" id="ecard_default_guest_email_error" style="{$ecard_errors.default_guest_email.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_email'|@translate}</span>215 <label for="ecard_default_guest_email">{'piwecard_default_guest_email'|@translate}</label><span class="ecard_error" id="ecard_default_guest_email_error" style="{$ecard_errors.default_guest_email.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_email'|@translate}</span> 211 216 <input type="text" maxlength="50" name="ecard_default_guest_email" id="ecard_default_guest_email" {$ecard_errors.default_guest_email.style_error_input} value="{$ecard_default_guest_email}" onblur="piwecard_checkField(this, 1, true);" /> 212 217 </div> 213 218 <div class="ecard_form_line ecard_email_config"> 214 <label for="ecard_email_subject">{'piwecard_email_subject'|@translate}*</label><span class="ecard_error" id="ecard_email_subject_error" style="{$ecard_errors.email_subject.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>219 <label for="ecard_email_subject">{'piwecard_email_subject'|@translate}*</label><span class="ecard_error" id="ecard_email_subject_error" style="{$ecard_errors.email_subject.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span> 215 220 <input type="text" maxlength="255" name="ecard_email_subject" id="ecard_email_subject" {$ecard_errors.email_subject.style_error_input} value="{$ecard_email_subject}" /> 216 221 </div> 217 222 <div class="ecard_form_line ecard_email_config"> 218 <label for="ecard_email_message_text">{'piwecard_email_message_text'|@translate}*</label><span class="ecard_error" id="ecard_email_message_text_error" style="{$ecard_errors.email_message.text.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>223 <label for="ecard_email_message_text">{'piwecard_email_message_text'|@translate}*</label><span class="ecard_error" id="ecard_email_message_text_error" style="{$ecard_errors.email_message.text.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span> 219 224 <textarea name="ecard_email_message_text" id="ecard_email_message_text" {$ecard_errors.email_message.text.style_error_input}>{$ecard_email_message_text}</textarea> 220 225 </div> 221 226 <div class="ecard_form_line ecard_email_config"> 222 <label for="ecard_email_message_html">{'piwecard_email_message_html'|@translate}*</label><span class="ecard_error" id="ecard_email_message_html_error" style="{$ecard_errors.email_message.html.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>227 <label for="ecard_email_message_html">{'piwecard_email_message_html'|@translate}*</label><span class="ecard_error" id="ecard_email_message_html_error" style="{$ecard_errors.email_message.html.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span> 223 228 <textarea name="ecard_email_message_html" id="ecard_email_message_html" {$ecard_errors.email_message.html.style_error_input}>{$ecard_email_message_html}</textarea> 224 229 </div> -
extensions/Piwecard/admin/template/admin_management.tpl
r20229 r20254 4 4 {literal} 5 5 function piwecard_checkForm(form) { 6 var nbPageOK = piwecard_checkField(form.ecard_nb_ecard_page, 2 );6 var nbPageOK = piwecard_checkField(form.ecard_nb_ecard_page, 2, 'inline'); 7 7 8 8 if(nbPageOK) -
extensions/Piwecard/css/admin.css
r20162 r20254 43 43 } 44 44 45 #ECardAdminConfiguration #ecard_nb_max_recipients { 46 text-align: center; 47 } 45 48 46 49 #ECardAdminManagement .ecard_line { -
extensions/Piwecard/include/piwecard.class.php
r20202 r20254 252 252 'recipient_email' => l10n('piwecard_recipient_email'), 253 253 'copy' => $this->config['sender_copy'] ? 'checked="checked"' : '', 254 'changemail' => (!isset($user['email']) OR $this->config['sender_email_change']) ? '' : 'disabled="disabled"' 254 'changemail' => (!isset($user['email']) OR $this->config['sender_email_change']) ? '' : 'disabled="disabled"', 255 'nb_max_recipients' => $this->config['nb_max_recipients'], 255 256 ) 256 257 ); … … 414 415 //Send an email 415 416 function mail($email_infos) { 417 global $conf, $page, $lang_info; 418 $template_mail = new Template(PIWECARD_MAIL_PATH.'template'); 419 $smarty = $template_mail->smarty; 420 416 421 $from = $email_infos['from_name']." <".$email_infos['from_email'].">"; 417 422 $subject = encode_mime_header(trim(preg_replace('#[\n\r]+#s', '', $email_infos['subject']))); … … 433 438 $headers .= 'Content-Transfer-Encoding: 8bit'."\n"; 434 439 $message .= $email_infos['message']['text']; 440 $smarty->assign(array( 441 'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'], 442 'GALLERY_URL' => get_absolute_root_url(), 443 'MAIL' => get_webmaster_mail_address(), 444 ) 445 ); 446 $message .= $smarty->fetch('mail_text.tpl'); 447 $message = utf8_decode($message); 435 448 } else { 436 449 $headers .= 'MIME-Version: 1.0'."\n"; 437 450 $headers .= 'Content-Type: multipart/alternative; boundary="'.$boundary.'"'; 438 $message 451 $message .= 'This is a multi-part message in MIME format'."\n\n"; 439 452 $message .= '--'.$boundary."\n"; 440 453 $message .= 'Content-Type: text/plain; charset="'.get_pwg_charset().'"'."\n"; … … 444 457 $message .= 'Content-Type: text/html; charset="'.get_pwg_charset().'"'."\n"; 445 458 $message .= 'Content-Transfer-Encoding: binary;'."\n\n"; 446 $message .= $email_infos['message']['html']."\n\n"; 459 $smarty->assign(array( 460 'CONTENT_ENCODING' => get_pwg_charset(), 461 'GALLERY_URL' => get_absolute_root_url(), 462 'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'], 463 'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '', 464 'MAIL' => get_webmaster_mail_address(), 465 'MESSAGE_HTML' => $email_infos['message']['html'], 466 ) 467 ); 468 $message .= $smarty->fetch('mail_html.tpl'); 469 $message .= "\n\n"; 447 470 $message .= '--'.$boundary."--\n"; 448 471 } -
extensions/Piwecard/install/default_values.inc.php
r20202 r20254 9 9 10 10 //Configuration parameters 11 $ecard_default_values['nb_max_recipients'] = 5; //Max number of recipients 11 12 $ecard_default_values['validity'] = array('0', '5', '10', '15'); //Number of days a card is available 12 13 $ecard_default_values['validity_default'] = '10'; //Default number of days a card is available -
extensions/Piwecard/js/piwecard.js
r20202 r20254 1 function piwecard_checkField(element, elementType, nullIsOK) {1 function piwecard_checkField(element, elementType, display, nullIsOK) { 2 2 var TEXT = 0; 3 3 var EMAIL = 1; 4 4 var NUMBER = 2; 5 5 6 optionalArg = (typeof nullIsOK === "undefined") ? false : nullIsOK; 6 nullIsOK = (typeof nullIsOK === "undefined") ? false : nullIsOK; 7 display = (typeof display === "undefined") ? 'inline' : display; 7 8 8 9 if (nullIsOK && element.value === '') { … … 12 13 case TEXT: 13 14 if (element.value == '' || element.className.indexOf("ecard_defaultTextActive") > 0) { 14 document.getElementById(element.id+'_error').style.display = 'block'; 15 element.className += " ecard_error_input"; 15 add_error_style(element, display); 16 16 return false; 17 17 } else { 18 document.getElementById(element.id+'_error').style.display = 'none'; 19 element.className = element.className.replace( /(?:^|\s)ecard_error_input(?!\S)/g , ''); 18 remove_error_style(element); 20 19 return true; 21 20 } … … 24 23 var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 25 24 if (!filter.test(element.value)) { 26 document.getElementById(element.id+'_error').style.display = 'block'; 27 element.className += " ecard_error_input"; 25 add_error_style(element, display); 28 26 return false; 29 27 } else { 30 document.getElementById(element.id+'_error').style.display = 'none'; 31 element.className = element.className.replace( /(?:^|\s)ecard_error_input(?!\S)/g , ''); 28 remove_error_style(element); 32 29 return true; 33 30 } … … 35 32 case NUMBER: 36 33 if (element.value == '') { 37 document.getElementById(element.id+'_error').style.display = 'inline'; 38 element.className += " ecard_error_input"; 34 add_error_style(element, display); 39 35 return false; 40 36 } else { 41 37 if (parseFloat(element.value) % 1 == 0){ 38 remove_error_style(element); 42 39 return true; 43 40 } else { 44 document.getElementById(element.id+'_error').style.display = 'inline'; 45 element.className += " ecard_error_input"; 41 add_error_style(element, display); 46 42 return false; 47 43 } … … 54 50 } 55 51 } 52 53 function add_error_style(element, display) { 54 document.getElementById(element.id+'_error').style.display = display; 55 element.className += " ecard_error_input"; 56 } 57 58 function remove_error_style(element) { 59 document.getElementById(element.id+'_error').style.display = 'none'; 60 element.className = element.className.replace( /(?:^|\s)ecard_error_input(?!\S)/g , ''); 61 } -
extensions/Piwecard/language/en_UK/plugin.lang.php
r20229 r20254 29 29 //admin_configuration.tpl 30 30 $lang['piwecard_configuration'] = 'Standard configuration'; 31 $lang['piwecard_nb_max_recipients'] = 'Maximum number of recipients by e-card'; 31 32 $lang['piwecard_validity_list'] = 'List of validity periods in days (0 for unlimited)'; 32 33 $lang['piwecard_ecard_derivative'] = 'Choose the size of the image in the e-card:'; -
extensions/Piwecard/language/fr_FR/plugin.lang.php
r20242 r20254 29 29 //admin_configuration.tpl 30 30 $lang['piwecard_configuration'] = 'Configuration de base'; 31 $lang['piwecard_nb_max_recipients'] = 'Nombre maximum de destinataire par carte virtuelle'; 31 32 $lang['piwecard_validity_list'] = 'Liste des durées de validité en jours (0 pour illimité)'; 32 33 $lang['piwecard_ecard_derivative'] = 'Choix de la taille de l\'image dans la carte virtuelle :'; -
extensions/Piwecard/main.inc.php
r20162 r20254 20 20 define('PIWECARD_INC_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/include/'); 21 21 define('PIWECARD_INSTALL_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/install/'); 22 define('PIWECARD_MAIL_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/mail/'); 22 23 define('PIWECARD_TABLE', $prefixeTable . 'piwecard'); 23 24 define('PIWECARD_ADMIN', get_root_url() . 'admin.php?page=plugin-'.PIWECARD_DIR); -
extensions/Piwecard/template/ecard.tpl
r20229 r20254 11 11 height:"90%", 12 12 onComplete:function(){ 13 {/literal}var nbMaxRecipients = {$ecard.nb_max_recipients};{literal} 13 14 $("#cboxLoadedContent").css('background-color', $("#the_page #content").css('background-color')); 14 $(".ecard_defaultText").blur(); 15 $(".ecard_defaultText").each(function(){ 16 defaultTextFocusOut($(this)); 17 }); 18 if (nbMaxRecipients <= 1) 19 $('#ecard_add_recipient').css("display", "none"); 15 20 } 16 21 }); … … 41 46 var num = $('.ecard_name_recipient').length-1; 42 47 var newNum = new Number(num + 1); 48 {/literal}var nbMaxRecipients = {$ecard.nb_max_recipients}-1;{literal} 43 49 44 if (newNum < 5) {50 if (newNum <= nbMaxRecipients) { 45 51 var newRecipient = $('#ecard_field_recipient_' + num).clone().attr('id', 'ecard_field_recipient_' + newNum); 46 52 … … 66 72 $('#ecard_field_recipient_' + num).after(newRecipient); 67 73 } 74 if (newNum == nbMaxRecipients) { 75 $('#ecard_add_recipient').css("display", "none"); 76 } 68 77 }); 69 78 }); 70 79 71 80 function piwecard_checkForm(form) { 72 var titleOK = piwecard_checkField(form.ecard_title, 0 );73 var messageOK = piwecard_checkField(form.ecard_message, 0 );74 var senderNameOK = piwecard_checkField(form.ecard_sender_name, 0 );75 var senderEMailOK = piwecard_checkField(form.ecard_sender_email, 1 );81 var titleOK = piwecard_checkField(form.ecard_title, 0, 'block'); 82 var messageOK = piwecard_checkField(form.ecard_message, 0, 'block'); 83 var senderNameOK = piwecard_checkField(form.ecard_sender_name, 0, 'block'); 84 var senderEMailOK = piwecard_checkField(form.ecard_sender_email, 1, 'block'); 76 85 var recipientNameOK = new Array(); 77 86 var recipientEMailOK = new Array(); … … 83 92 var id_name = "ecard_recipient_name_"+nbAdditionalRecipients; 84 93 var id_email = "ecard_recipient_email_"+nbAdditionalRecipients; 85 recipientEMailOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_email), 1, true);94 recipientEMailOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_email), 1, 'block', true); 86 95 if (nbAdditionalRecipients == 0) { 87 recipientNameOK[0] = piwecard_checkField(form.ecard_recipient_name_0, 0 );88 recipientEMailOK[0] = piwecard_checkField(form.ecard_recipient_email_0, 1 );96 recipientNameOK[0] = piwecard_checkField(form.ecard_recipient_name_0, 0, 'block'); 97 recipientEMailOK[0] = piwecard_checkField(form.ecard_recipient_email_0, 1, 'block'); 89 98 } else if (recipientEMailOK[nbAdditionalRecipients] && document.getElementById(id_email).value != '') { 90 recipientNameOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_name), 0, true);99 recipientNameOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_name), 0, 'block', true); 91 100 } 92 101 nbAdditionalRecipients++; 93 102 } 94 103 95 for (var i=0; i< =nbAdditionalRecipients; i++) {104 for (var i=0; i<nbAdditionalRecipients; i++) { 96 105 if (recipientNameOK[i] && recipientEMailOK[i]) { 97 106 allRecipientNamesOK = true; … … 120 129 <div class="ecard_error" id="ecard_title_error">{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</div> 121 130 <span class="ecard_label">{'Title'|@translate}<span class="ecard_mandatory_fields">*</span> :</span> 122 <span class="ecard_input_right"><input name="ecard_title" type="text" id="ecard_title" class="ecard_defaultText" title="{$ecard.title}" ></span>131 <span class="ecard_input_right"><input name="ecard_title" type="text" id="ecard_title" class="ecard_defaultText" title="{$ecard.title}" onblur="piwecard_checkField(this, 0, 'block');" onfocus="remove_error_style(this);"></span> 123 132 </div> 124 133 <div class="ecard_field"> 125 134 <div class="ecard_error" id="ecard_message_error">{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</div> 126 135 <span class="ecard_label">{'piwecard_message'|@translate}<span class="ecard_mandatory_fields">*</span> :</span> 127 <span class="ecard_input_right"><textarea name="ecard_message" id="ecard_message" class="ecard_defaultText" title="{$ecard.message}" ></textarea></span>136 <span class="ecard_input_right"><textarea name="ecard_message" id="ecard_message" class="ecard_defaultText" title="{$ecard.message}" onblur="piwecard_checkField(this, 0, 'block');" onfocus="remove_error_style(this);"></textarea></span> 128 137 </div> 129 138 </fieldset> … … 134 143 <div class="ecard_error" id="ecard_sender_email_error">{'piwecard_error'|@translate} {'piwecard_error_email'|@translate}</div> 135 144 <span class="ecard_label">{'piwecard_sender'|@translate}<span class="ecard_mandatory_fields">*</span> :</span> 136 <span class="ecard_name"><input name="ecard_sender_name" type="text" id="ecard_sender_name" maxlength="100" value="{$ecard.sender_name}" ></span>137 <span class="ecard_email"><input name="ecard_sender_email" type="text" id="ecard_sender_email" maxlength="100" {$ecard.changemail} value="{$ecard.sender_email}" ></span>145 <span class="ecard_name"><input name="ecard_sender_name" type="text" id="ecard_sender_name" maxlength="100" value="{$ecard.sender_name}" onblur="piwecard_checkField(this, 0, 'block');" onfocus="remove_error_style(this);"></span> 146 <span class="ecard_email"><input name="ecard_sender_email" type="text" id="ecard_sender_email" maxlength="100" {$ecard.changemail} value="{$ecard.sender_email}" onblur="piwecard_checkField(this, 1, 'block');" onfocus="remove_error_style(this);"></span> 138 147 </div> 139 148 <div class="ecard_field" id="ecard_field_recipient_0"> … … 141 150 <div class="ecard_error" id="ecard_recipient_email_0_error">{'piwecard_error'|@translate} {'piwecard_error_email'|@translate}</div> 142 151 <span class="ecard_label">{'piwecard_recipient'|@translate}<span class="ecard_mandatory_fields">*</span> :</span> 143 <span class="ecard_name ecard_name_recipient"><input name="ecard_recipient_name[0]" type="text" id="ecard_recipient_name_0" class="ecard_defaultText" maxlength="100" title="{$ecard.recipient_name}" ></span>144 <span class="ecard_email"><input name="ecard_recipient_email[0]" type="text" id="ecard_recipient_email_0" class="ecard_defaultText" maxlength="100" title="{$ecard.recipient_email}" ></span>152 <span class="ecard_name ecard_name_recipient"><input name="ecard_recipient_name[0]" type="text" id="ecard_recipient_name_0" class="ecard_defaultText" maxlength="100" title="{$ecard.recipient_name}" onblur="piwecard_checkField(this, 0, 'block');" onfocus="remove_error_style(this);"></span> 153 <span class="ecard_email"><input name="ecard_recipient_email[0]" type="text" id="ecard_recipient_email_0" class="ecard_defaultText" maxlength="100" title="{$ecard.recipient_email}" onblur="piwecard_checkField(this, 1, 'block');" onfocus="remove_error_style(this);"></span> 145 154 </div> 146 155 <a href="javascript:void(0)" id="ecard_add_recipient">{'piwecard_add_recipient'|@translate}</a>
Note: See TracChangeset
for help on using the changeset viewer.