Changeset 17945


Ignore:
Timestamp:
09/16/12 17:20:39 (7 years ago)
Author:
mistic100
Message:
  • stores emails in database (/!\ update only from published version, not from trunk)
  • allow emails to be categorized
Location:
extensions/ContactForm
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/admin/config.php

    r17483 r17945  
    1414    'cf_mandatory_name' =>    isset($_POST['cf_mandatory_name']), 
    1515    'cf_mail_type' =>         $_POST['cf_mail_type'], 
    16     'cf_admin_mails' =>       $conf['ContactForm']['cf_admin_mails'], 
    1716    ); 
    1817  $conf['ContactForm_before'] = $_POST['cf_before']; 
     
    3433  )); 
    3534 
    36 $template->set_filename('contact_form', dirname(__FILE__).'/template/config.tpl'); 
     35$template->set_filename('contact_form', realpath(CONTACT_FORM_PATH . 'admin/template/config.tpl')); 
    3736 
    3837?> 
  • extensions/ContactForm/admin/emails.php

    r17483 r17945  
    55if (isset($_POST['save_emails'])) 
    66{ 
     7  var_dump($_POST); 
    78  $emails = array(); 
    89  foreach ($_POST['emails'] as $entry) 
     
    1617    else 
    1718    { 
     19      if ($entry['group_name'] == -1) $entry['group_name'] = null; 
     20       
    1821      array_push($emails, array( 
    1922        'name' => $entry['name'], 
    2023        'email' => $entry['email'], 
    21         'active' => isset($entry['active']), 
     24        'group_name' => $entry['group_name'], 
     25        'active' => boolean_to_string(isset($entry['active'])), 
    2226        )); 
    2327    } 
    2428  } 
    2529   
    26   $conf['ContactForm']['cf_admin_mails'] = $emails; 
    27   conf_update_param('ContactForm', serialize($conf['ContactForm'])); 
     30  pwg_query('TRUNCATE TABLE `'. CONTACT_FORM_TABLE. '`'); 
     31   
     32  mass_inserts( 
     33    CONTACT_FORM_TABLE, 
     34    array('name','email','group_name','active'), 
     35    $emails 
     36    ); 
     37   
    2838  array_push($page['infos'], l10n('Information data registered in database')); 
    2939} 
     
    3141 
    3242// display emails 
    33 $template->assign('EMAILS', $conf['ContactForm']['cf_admin_mails']); 
     43$query = ' 
     44SELECT * 
     45  FROM '. CONTACT_FORM_TABLE .' 
     46  ORDER BY 
     47    group_name ASC, 
     48    name ASC 
     49'; 
     50$result = pwg_query($query); 
    3451 
    35 $template->set_filename('contact_form', dirname(__FILE__).'/template/emails.tpl'); 
     52$emails = $groups = array(); 
     53while ($data = pwg_db_fetch_assoc($result)) 
     54{ 
     55  $data['active'] = get_boolean($data['active']); 
     56  array_push($emails, $data); 
     57  if (!empty($data['group_name'])) 
     58  { 
     59    array_push($groups, $data['group_name']); 
     60  } 
     61} 
     62 
     63$template->assign(array( 
     64  'EMAILS' => $emails, 
     65  'GROUPS' => array_unique($groups), 
     66  )); 
     67 
     68$template->set_filename('contact_form', realpath(CONTACT_FORM_PATH . 'admin/template/emails.tpl')); 
    3669 
    3770?> 
  • extensions/ContactForm/admin/template/config.tpl

    r17483 r17945  
    5353        <label> 
    5454          <input type="text" name="cf_default_subject" value="{$cf_default_subject}" size="50"> 
    55           {'Default e-mail subject'|@translate} 
     55          {'Default e-mail subject'|@translate} ({'can be translated with LocalFiles Editor plugin'|@translate}) 
    5656        </label> 
    5757      </li> 
     
    5959        <label> 
    6060          <input type="text" name="cf_subject_prefix" value="{$cf_subject_prefix}" size="50"> 
    61           {'Prefix of the sent e-mail subject (you can use "%gallery_title%")'|@translate} 
     61          {'Prefix of the sent e-mail subject'|@translate} ({'you can use "%gallery_title%"'|@translate}) 
    6262        </label> 
    6363      </li> 
  • extensions/ContactForm/admin/template/emails.tpl

    r17483 r17945  
    11{combine_css path=$CONTACT_FORM_PATH|@cat:"admin/template/style.css"} 
    22 
    3 {footer_script}{literal} 
    4 jQuery(document).on('change', '.delete', function() { 
    5   if ($(this).is(':checked')) { 
    6     $(this).parents('tr').addClass('delete'); 
    7   } else { 
    8     $(this).parents('tr').removeClass('delete'); 
    9   } 
    10 }); 
    11 {/literal}{/footer_script} 
    123 
    134<div class="titrePage"> 
    145        <h2>Contact Form</h2> 
    156</div> 
     7 
    168 
    179<form method="post" action="{$CONTACT_FORM_ADMIN}-emails" class="properties"> 
     
    2012      <th>{'Name'|@translate}</th> 
    2113      <th>{'Email address'|@translate}</th> 
     14      <th>{'Category'|@translate}</th> 
    2215      <th>{'Active'|@translate}</th> 
    2316      <th>{'Delete'|@translate}</th> 
     
    2720    <tr class="{if $i is odd}row1{else}row2{/if}"> 
    2821      <td> 
    29         <input type="text" name="emails[{$i}][name]" value="{$entry.name}" size="20"> 
     22        <input type="text" name="emails[{$i}][name]" value="{$entry.name|escape:html}" size="20"> 
    3023      </td> 
    3124      <td> 
    3225        <input type="text" name="emails[{$i}][email]" value="{$entry.email}" size="30"> 
     26      </td> 
     27      <td> 
     28        <select name="emails[{$i}][group_name]" class="groups"> 
     29          <option value="-1">------------</option> 
     30          {html_options values=$GROUPS output=$GROUPS selected=$entry.group_name} 
     31        </select> 
    3332      </td> 
    3433      <td style="text-align:center;"> 
     
    4241  {/foreach} 
    4342    <tr class="{if $i is odd}row1{else}row2{/if}" id="addEntryContainer"> 
    44       <td colspan="4"> 
     43      <td colspan="2" style="text-align:center;"> 
    4544        <a id="addEntry">{'+ Add an email'|@translate}</a> 
     45      </td> 
     46      <td> 
     47        <a id="addGroup">{'+ Add a category'|@translate}</a> 
     48      </td> 
     49      <td colspan="2"  style="text-align:center;"> 
     50        <input type="submit" name="save_emails" value="{'Submit'|@translate}" class="submit"> 
    4651      </td> 
    4752    </tr> 
    4853  </table> 
    4954  {footer_script}var entry = {$i};{/footer_script} 
    50  
    51   <p><input type="submit" name="save_emails" value="{'Submit'|@translate}" class="submit"></p> 
    5255</form> 
    5356 
    54 {footer_script}{literal} 
     57 
     58 
     59{footer_script} 
     60var group_options = new Array; 
     61{foreach from=$GROUPS item=entry} 
     62group_options[group_options.length] = '<option value="{$entry|escape:javascript}">{$entry|escape:javascript}</option>'; 
     63{/foreach} 
     64 
     65{literal} 
     66var doBlink = function(obj,start,finish) { jQuery(obj).fadeOut(300).fadeIn(300); if(start!=finish) { start=start+1; doBlink(obj,start,finish); } }; 
     67jQuery.fn.blink = function(start,finish) { return this.each(function() { doBlink(this,start,finish) }); }; 
     68 
     69jQuery(document).on('change', '.delete', function() { 
     70  if ($(this).is(':checked')) { 
     71    $(this).parents('tr').addClass('delete'); 
     72  } else { 
     73    $(this).parents('tr').removeClass('delete'); 
     74  } 
     75}); 
     76 
    5577jQuery('#addEntry').click(function() { 
    5678  entry++; 
    5779  i = entry; 
    5880   
    59   $('#emails').append( 
     81  content = 
    6082    '<tr class="row'+ (i%2+1) +'">'+ 
    6183      '<td>'+ 
     
    6486      '<td>'+ 
    6587        '<input type="text" name="emails['+ i +'][email]" size="30">'+ 
     88      '</td>'+ 
     89      '<td>'+ 
     90        '<select name="emails['+ i +'][group_name]" class="groups">'+ 
     91          '<option value="-1">------------</option>'; 
     92          for (var j in group_options) { 
     93            content+= group_options[j]; 
     94          } 
     95        content+= '</select>'+ 
    6696      '</td>'+ 
    6797      '<td style="text-align:center;">'+ 
     
    72102      '</td>'+ 
    73103    '</tr>' 
    74     ); 
     104  $('#emails').append(content); 
    75105     
    76106  $('#addEntryContainer') 
     
    79109    .appendTo($('#emails')); 
    80110}); 
     111 
     112jQuery('#addGroup').click(function() { 
     113  name = prompt("{/literal}{'Name'|@translate}{literal}:"); 
     114  if (name != null && name != "") { 
     115    name = name.replace(new RegExp('"','g'),"'"); 
     116    content = '<option value="'+ name +'">'+ name +'</option>'; 
     117    group_options[group_options.length] = content; 
     118    $("select.groups").append(content).blink(1,2); 
     119  } 
     120}); 
    81121{/literal}{/footer_script} 
  • extensions/ContactForm/admin/template/style.css

    r17483 r17945  
    1 #emails input[type="text"] { 
     1#emails input[type="text"], select { 
    22  margin:2px 10px !important; 
    33} 
    44 
    5 tr.delete input { 
     5tr.delete input, tr.delete select { 
    66  opacity:0.5; 
    77} 
     8 
     9#addEntry { 
     10  display:inline-block; 
     11  padding:2px 5px; 
     12  margin:4px; 
     13  border-width:1px; 
     14  border-style:solid; 
     15  border-radius:10px; 
     16  font-weight:bold; 
     17} 
  • extensions/ContactForm/include/contact_form.inc.php

    r17483 r17945  
    1515{ 
    1616  $contact = array( 
    17     'author' => trim($_POST['author']), 
    18     'email' => trim($_POST['email']), 
    19     'subject' =>   trim($_POST['subject']), 
    20     'content' =>   $_POST['content'], 
     17    'author' =>  trim($_POST['author']), 
     18    'email' =>   trim($_POST['email']), 
     19    'group' =>   @$_POST['group'], 
     20    'subject' => trim($_POST['subject']), 
     21    'content' => $_POST['content'], 
    2122   ); 
    2223   
     
    4748      'author' => $user['username'], 
    4849      'email' => $user['email'], 
     50      'group' => null, 
    4951      'subject' => l10n($conf['ContactForm']['cf_default_subject']), 
    5052      'content' => null, 
     
    6769} 
    6870 
     71$query = ' 
     72SELECT DISTINCT group_name 
     73  FROM '. CONTACT_FORM_TABLE .' 
     74  ORDER BY group_name 
     75;'; 
     76$result = pwg_query($query); 
     77 
     78$groups = array(); 
     79while ($data = pwg_db_fetch_assoc($result)) 
     80{ 
     81  $groups[ $data['group_name'] ] = !empty($data['group_name']) ? l10n($data['group_name']) : l10n('Default'); 
     82} 
     83 
     84if (count($groups) > 1) 
     85{ 
     86  $template->assign('GROUPS', $groups); 
     87} 
     88 
    6989$template->assign(array( 
    7090  'contact' => $contact, 
     
    7797  )); 
    7898 
    79 $template->set_filename('index', dirname(__FILE__).'/../template/contact_form.tpl'); 
     99$template->set_filename('index', realpath(CONTACT_FORM_PATH . 'template/contact_form.tpl')); 
    80100 
    81101?> 
  • extensions/ContactForm/include/functions.inc.php

    r17662 r17945  
    8686      'name' => $row['username'], 
    8787      'email' => $row['email'], 
    88       'active' => true, 
     88      'active' => 'true', 
    8989      )); 
    9090  } 
    9191   
    92   $conf['ContactForm']['cf_admin_mails'] = $emails; 
     92  mass_inserts( 
     93    CONTACT_FORM_TABLE, 
     94    array('name','email','active'), 
     95    $email 
     96    ); 
     97   
    9398  $conf['ContactForm']['cf_must_initialize'] = false; 
    9499  conf_update_param('ContactForm', serialize($conf['ContactForm'])); 
     
    107112    $conf_mail = get_mail_configuration(); 
    108113  } 
     114   
     115  $query = ' 
     116SELECT DISTINCT group_name 
     117  FROM '. CONTACT_FORM_TABLE .' 
     118  ORDER BY group_name 
     119;'; 
     120  $groups = array_from_query($query, 'group_name'); 
    109121   
    110122  $comm = array_merge($comm, 
     
    159171  } 
    160172   
     173  // check group 
     174  if ( count($groups) > 1 and $comm['group'] == -1 ) 
     175  { 
     176    $comm['group'] = true; 
     177    array_push($page['errors'], l10n('Please choose a category')); 
     178    $comment_action='reject'; 
     179  } 
     180   
    161181  // check content 
    162182  if (empty($comm['content'])) 
     
    186206   
    187207  // get admin emails 
    188   $emails = get_contact_emails(); 
     208  $emails = get_contact_emails($comm['group']); 
    189209  if (!count($emails)) 
    190210  { 
     
    281301/** 
    282302 * get contact emails 
    283  */ 
    284 function get_contact_emails() 
     303 * @param mixed group: 
     304 *    - bool true:    all emails 
     305 *    - empty string: emails without group 
     306 *    - string:       emails with the specified group 
     307 */ 
     308function get_contact_emails($group=true) 
    285309{ 
    286310  global $conf; 
     
    288312  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 
    289313   
     314  $where = '1=1'; 
     315  if ($group!==true) 
     316  { 
     317    if (empty($group)) 
     318    { 
     319      $where = 'group_name IS NULL'; 
     320    } 
     321    else 
     322    { 
     323      $where = 'group_name="'.$group.'"'; 
     324    } 
     325  } 
     326   
     327  $query = ' 
     328SELECT * 
     329  FROM '. CONTACT_FORM_TABLE .' 
     330  WHERE  
     331    '.$where.' 
     332    AND active = "true" 
     333  ORDER BY name ASC 
     334'; 
     335  $result = pwg_query($query); 
     336   
    290337  $emails = array(); 
    291   foreach ($conf['ContactForm']['cf_admin_mails'] as $data) 
    292   { 
    293     if ($data['active']) 
    294     { 
    295       array_push($emails, format_email($data['name'], $data['email'])); 
    296     } 
     338  while ($data = pwg_db_fetch_assoc($result)) 
     339  { 
     340    array_push($emails, format_email($data['name'], $data['email'])); 
    297341  } 
    298342   
  • extensions/ContactForm/include/install.inc.php

    r17658 r17945  
    44function contact_form_install() 
    55{ 
    6   global $conf; 
     6  global $conf, $prefixeTable; 
     7   
     8  // email table 
     9  $query = ' 
     10CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'contact_form` ( 
     11  `id` smallint(5) NOT NULL AUTO_INCREMENT, 
     12  `name` varchar(128) NOT NULL, 
     13  `email` varchar(128) NOT NULL, 
     14  `active` enum("true","false") NOT NULL DEFAULT "true", 
     15  `group_name` varchar(128) DEFAULT NULL, 
     16  PRIMARY KEY (`id`), 
     17  UNIQUE KEY `UNIQUE` (`email`,`group_name`) 
     18) ENGINE=MyISAM DEFAULT CHARSET=utf8;'; 
     19  pwg_query($query); 
    720 
    821  // configuration 
     
    1932      'cf_redirect_delay' => 5, 
    2033      'cf_mail_type' => 'text/html', 
    21       'cf_admin_mails' => array(), 
    2234      )); 
    2335     
     
    3749    if (!isset($new_conf['cf_must_initialize'])) 
    3850    { 
     51      // new params 
    3952      $new_conf['cf_must_initialize'] = false; 
    4053      $new_conf['cf_default_subject'] = 'A comment on your site'; 
    4154      $new_conf['cf_mail_type'] = 'text/html'; 
    42       unset($new_conf['comment'], $new_conf['cf_redirect_delay'], $new_conf['cf_separator'], $new_conf['cf_separator_length']); 
    4355       
     56      // move emails to database 
     57      $email = array(); 
    4458      foreach ($new_conf['cf_admin_mails'] as $email => $data) 
    4559      { 
    46         $new_conf['cf_admin_mails'][] = array( 
     60        array_push($emails, array( 
    4761          'email' => $email, 
    4862          'name' => $data['NAME'], 
    49           'active' => $data['ACTIVE'], 
    50           ); 
    51         unset($new_conf['cf_admin_mails'][ $email ]); 
     63          'active' => boolean_to_string($data['ACTIVE']), 
     64          )); 
    5265      } 
    5366       
     67      mass_inserts( 
     68        $prefixeTable .'contact_form', 
     69        array('name','email','active'), 
     70        $emails 
     71        ); 
     72       
     73      // old params 
     74      unset( 
     75        $new_conf['comment'], $new_conf['cf_redirect_delay'],  
     76        $new_conf['cf_separator'], $new_conf['cf_separator_length'],  
     77        $new_conf['cf_admin_mails'] 
     78        ); 
     79       
     80      // save config 
    5481      $conf['ContactForm'] = serialize($new_conf); 
    5582      $conf['ContactForm_before'] = stripslashes($conf['persoformtop']); 
  • extensions/ContactForm/language/bg_BG/plugin.lang.php

    r17723 r17945  
    3939$lang['Please enter a message'] = 'Моля въведете съобщение'; 
    4040$lang['Error while sending e-mail'] = 'Грешка при изпращане на e-mail'; 
    41  
    42 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Префикс на изпращания имейл обект (Може да използвате "%gallery_title%")'; 
     41$lang['Prefix of the sent e-mail subject'] = 'Префикс на изпращания имейл обект'; 
     42$lang['you can use "%gallery_title%"'] = 'Може да използвате "%gallery_title%"'; 
    4343$lang['Plain text'] = 'Свободен текст'; 
    4444$lang['No active email address'] = 'Неактивет имейл адрес'; 
  • extensions/ContactForm/language/cs_CZ/plugin.lang.php

    r17559 r17945  
    3939$lang['Please enter a message'] = 'Prosím zadejte zprávu'; 
    4040$lang['Error while sending e-mail'] = 'Nastala chyba při odeslání zprávy'; 
    41  
    4241$lang['%s must not be more than %d characters long'] = '%s nesmí být delší než %d znaků'; 
    4342$lang['+ Add an email'] = '+ Přidat email'; 
     
    4847$lang['Plain text'] = 'Prostý text'; 
    4948$lang['Please enter an e-mail'] = 'Prosím, vložte e-mail'; 
    50 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Předpona poslaného e-mail předmětu (můžete použít "%gallery_title%")'; 
     49$lang['Prefix of the sent e-mail subject'] = 'Předpona poslaného e-mail předmětu'; 
     50$lang['you can use "%gallery_title%"'] = 'můžete použít "%gallery_title%"'; 
    5151$lang['%s must not be less than %d characters long'] = '%s nesmí být kratší než %d znaků'; 
    5252?> 
  • extensions/ContactForm/language/da_DK/plugin.lang.php

    r17502 r17945  
    3939$lang['Please enter a message'] = 'Angiv en beskred'; 
    4040$lang['Error while sending e-mail'] = 'Fejl ved afsendelse af e-mail'; 
    41  
    4241$lang['%s must not be less than %d characters long'] = '%s må ikke være kortere end %d karakterer'; 
    4342$lang['%s must not be more than %d characters long'] = '%s må ikke være længere end %d karakterer'; 
     
    4948$lang['Plain text'] = 'Ren tekst'; 
    5049$lang['Please enter an e-mail'] = 'Angiv en email adresse'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Præfix for email emne (du kan anvende "%gallery_title%")'; 
     50$lang['Prefix of the sent e-mail subject'] = 'Præfix for email emne'; 
     51$lang['you can use "%gallery_title%"'] = 'du kan anvende "%gallery_title%"'; 
    5252?> 
  • extensions/ContactForm/language/de_DE/plugin.lang.php

    r17530 r17945  
    3939$lang['Please enter a message'] = 'Bitte fügen Sie eine Mitteilung hinzu'; 
    4040$lang['Error while sending e-mail'] = 'Es ist ein Fehler beim Versand der E-Mail aufgetreten';  
    41  
    4241$lang['+ Add an email'] = '+ Eine Mail hinzufügen'; 
    4342$lang['E-mail format :'] = 'E-Mail Format:'; 
     
    4948$lang['%s must not be more than %d characters long'] = '%s darf nicht mehr als %d Zeichen lang sein'; 
    5049$lang['Default e-mail subject'] = 'Standard E-mail-Betreff'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Präfix des gesendeten e-Mail-Betreffs (Sie können "% Gallery_title" benutzen)'; 
     50$lang['Prefix of the sent e-mail subject'] = 'Präfix des gesendeten e-Mail-Betreffs'; 
     51$lang['you can use "%gallery_title%"'] = 'Sie können "%gallery_title%" benutzen'; 
    5252?> 
  • extensions/ContactForm/language/el_GR/plugin.lang.php

    r17499 r17945  
    3333$lang['Please enter a message'] = 'Παρακαλώ εισάγετε ένα μήνυμα'; 
    3434$lang['Error while sending e-mail'] = 'Λάθος κατά την απόστολή e-mail'; 
    35  
    36 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Πρόθεμα για το θέμα του e-mail που στέλνετε (μπορείτε να χρησιμοποιήσετε το " "%gallery_title%"")'; 
     35$lang['Prefix of the sent e-mail subject'] = 'Πρόθεμα για το θέμα του e-mail που στέλνετε'; 
     36$lang['you can use "%gallery_title%"'] = 'μπορείτε να χρησιμοποιήσετε το "%gallery_title%"'; 
    3737$lang['Please enter an e-mail'] = 'Παρακαλώ εισάγετε ένα e-mail'; 
    3838$lang['Plain text'] = 'Απλό κείμενο'; 
  • extensions/ContactForm/language/en_UK/plugin.lang.php

    r17498 r17945  
    2626$lang['Subject'] = 'Subject'; 
    2727$lang['Message'] = 'Message'; 
     28$lang['Category'] = 'Category'; 
    2829$lang['General configuration'] = 'General configuration'; 
    2930$lang['Add link in menu'] = 'Add link in menu'; 
     
    3536$lang['Plain text'] = 'Plain text'; 
    3637$lang['Default e-mail subject'] = 'Default e-mail subject'; 
    37 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Prefix of the sent e-mail subject (you can use "%gallery_title%")'; 
     38$lang['can be translated with LocalFiles Editor plugin'] = 'can be translated with LocalFiles Editor plugin'; 
     39$lang['Prefix of the sent e-mail subject'] = 'Prefix of the sent e-mail subject'; 
     40$lang['you can use "%gallery_title%"'] = 'you can use "%gallery_title%"'; 
    3841$lang['Text before the contact form'] = 'Text before the contact form'; 
    3942$lang['Text after the contact form'] = 'Text after the contact form'; 
    4043$lang['Active'] = 'Active'; 
    4144$lang['+ Add an email'] = '+ Add an email'; 
     45$lang['+ Add a category'] = '+ Add a category'; 
    4246$lang['No active email address'] = 'No active email address'; 
    4347$lang['E-mail sent successfully'] = 'E-mail sent successfully'; 
     
    4650$lang['Please enter a subject'] = 'Please enter a subject'; 
    4751$lang['Please enter a message'] = 'Please enter a message'; 
     52$lang['Please choose a category'] = 'Please choose a category'; 
    4853$lang['%s must not be less than %d characters long'] = '%s must not be less than %d characters long'; 
    4954$lang['%s must not be more than %d characters long'] = '%s must not be more than %d characters long'; 
  • extensions/ContactForm/language/es_ES/plugin.lang.php

    r17533 r17945  
    3838$lang['Please enter a message'] = 'Por favor, entre un mensaje'; 
    3939$lang['Error while sending e-mail'] = 'Error en el momento del envío del e-mail'; 
    40  
    4140$lang['%s must not be less than %d characters long'] = '%s no debe ser menor que %d caracteres'; 
    4241$lang['%s must not be more than %d characters long'] = '%s no debe ser mayor que %d caracteres'; 
     
    4948$lang['Plain text'] = 'Texto sin formato'; 
    5049$lang['Please enter an e-mail'] = 'Por favor, introduzca un e-mail'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Prefijo del asunto del correo electrónico de envío (se puede utilizar "%galería de title%")'; 
     50$lang['Prefix of the sent e-mail subject'] = 'Prefijo del asunto del correo electrónico de envío'; 
     51$lang['you can use "%gallery_title%"'] = 'se puede utilizar "%gallery_title%"'; 
    5252?> 
  • extensions/ContactForm/language/fa_IR/plugin.lang.php

    r17608 r17945  
    3939$lang['Please enter a subject'] = 'موضوع را وارد کنید'; 
    4040$lang['Please enter an e-mail'] = 'ایمیل خود را وارد کنید'; 
    41 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'پیشوند موضوع ایمیل (می توانید از "%gallery_title%" استفاده کنید)'; 
    4241$lang['Text after the contact form'] = 'متنِ پس از فرمِ تماس'; 
    4342$lang['Text before the contact form'] = 'متنِ پیش از فرمِ تماس'; 
  • extensions/ContactForm/language/fr_FR/plugin.lang.php

    r17498 r17945  
    2626$lang['Subject'] = 'Sujet'; 
    2727$lang['Message'] = 'Message'; 
     28$lang['Category'] = 'Catégorie'; 
    2829$lang['General configuration'] = 'Configuration générale'; 
    2930$lang['Add link in menu'] = 'Ajouter le lien dans le menu'; 
     
    3536$lang['Plain text'] = 'Texte brut'; 
    3637$lang['Default e-mail subject'] = 'Sujet par défaut'; 
    37 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Préfixe du sujet de l\'e-mail envoyé (vous pouvez utiliser "%gallery_title%")'; 
     38$lang['can be translated with LocalFiles Editor plugin'] = 'peut être traduit avec le plugin LocalFiles Editor'; 
     39$lang['Prefix of the sent e-mail subject'] = 'Préfixe du sujet de l\'e-mail envoyé'; 
     40$lang['you can use "%gallery_title%"'] = 'vous pouvez utiliser "%gallery_title%"'; 
    3841$lang['Text before the contact form'] = 'Texte au-dessus du formulaire de contact'; 
    3942$lang['Text after the contact form'] = 'Texte au-dessous du formulaire de contact'; 
    4043$lang['E-mails'] = 'E-mails'; 
    4144$lang['Active'] = 'Actif'; 
    42 $lang['+ Add an email'] = '+ Ajouter un email'; 
     45$lang['+ Add an email'] = '+ Ajouter une email'; 
     46$lang['+ Add a category'] = '+ Ajouter une categorie'; 
    4347$lang['No active email address'] = 'Aucune adresse email active'; 
    4448$lang['E-mail sent successfully'] = 'E-mail envoyé avec succès'; 
     
    4751$lang['Please enter a subject'] = 'Veuillez entrer un sujet'; 
    4852$lang['Please enter a message'] = 'Veuillez entrer un message'; 
     53$lang['Please choose a category'] = 'Veuillez choisir une categorie'; 
    4954$lang['%s must not be less than %d characters long'] = '%s ne doit pas faire moins de %d caractères'; 
    5055$lang['%s must not be more than %d characters long'] = '%s ne doit pas faire plus de %d caractères'; 
  • extensions/ContactForm/language/hu_HU/plugin.lang.php

    r17667 r17945  
    3939$lang['Please enter a message'] = 'Írja be az üzenetét'; 
    4040$lang['Error while sending e-mail'] = 'Hiba történt a levél küldése közben'; 
    41  
    4241$lang['%s must not be less than %d characters long'] = '%s nem lehet kevesebb %d karakternél'; 
    4342$lang['%s must not be more than %d characters long'] = '%s nem lehet több %d karakternél'; 
     
    4948$lang['Plain text'] = 'Egyszerű szöveg'; 
    5049$lang['Please enter an e-mail'] = 'Kérek egy e-mail címet'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Küldött e-mail tárgy előtag (a "%gallery_title%" használható)'; 
     50$lang['Prefix of the sent e-mail subject'] = 'Küldött e-mail tárgy előtag'; 
     51$lang['you can use "%gallery_title%"'] = 'a "%gallery_title%" használható'; 
    5252?> 
  • extensions/ContactForm/language/it_IT/plugin.lang.php

    r17610 r17945  
    3939$lang['Please enter a message'] = 'Entrare un messaggio'; 
    4040$lang['Error while sending e-mail'] = 'Errore durante l\'invio dell\'E-mail'; 
    41  
    42 $lang['%s must not be less than %d characters long'] = '% deve essere lungo non meno di % caratteri'; 
    43 $lang['%s must not be more than %d characters long'] = '% la lunghezza non deve essere maggiore di % caratteri'; 
     41$lang['%s must not be less than %d characters long'] = '%s deve essere lungo non meno di %d caratteri'; 
     42$lang['%s must not be more than %d characters long'] = '%s la lunghezza non deve essere maggiore di %d caratteri'; 
    4443$lang['Default e-mail subject'] = 'Oggetto email predefinito'; 
    4544$lang['E-mail format :'] = 'Formato email'; 
     
    4746$lang['Plain text'] = 'Testo non formattato'; 
    4847$lang['Please enter an e-mail'] = 'Aggiungi la tua email'; 
    49 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Presisso per le email gia inviate'; 
     48$lang['Prefix of the sent e-mail subject'] = 'Presisso per le email gia inviate'; 
    5049$lang['Active'] = 'Attivo'; 
    5150$lang['+ Add an email'] = 'Aggiungi la tua email'; 
  • extensions/ContactForm/language/lv_LV/plugin.lang.php

    r17557 r17945  
    3939$lang['Please enter a message'] = 'Lūdzu ievadiet ziņojumu'; 
    4040$lang['Error while sending e-mail'] = 'Kļūda sūtot e-pastu'; 
    41  
    42 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Nosūtītā e-pasta tēmas prefikss (varat lietot "%gallery_title%")'; 
     41$lang['Prefix of the sent e-mail subject'] = 'Nosūtītā e-pasta tēmas prefikss'; 
     42$lang['you can use "%gallery_title%"'] = 'varat lietot "%gallery_title%"'; 
    4343$lang['%s must not be more than %d characters long'] = '%s jābūt ne vairāk kā %d rakstzīmju garam'; 
    4444$lang['%s must not be less than %d characters long'] = '%s jābūt ne māzāk kā %d rakstzīmju garam'; 
  • extensions/ContactForm/language/nl_NL/plugin.lang.php

    r17634 r17945  
    3939$lang['Please enter a message'] = 'Vul een berichttekst in'; 
    4040$lang['Error while sending e-mail'] = 'Fout tijdens versturen van e-mail'; 
    41  
    4241$lang['%s must not be less than %d characters long'] = '%s mag niet kleiner zijn dan %d tekens'; 
    4342$lang['%s must not be more than %d characters long'] = '%s mag niet groter zijn dan %d tekens'; 
     
    4948$lang['Plain text'] = 'Platte tekst'; 
    5049$lang['Please enter an e-mail'] = 'Voer een email adres in'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Voorvoegsel voor het email onderwerp (je kan \'%gallery_title%\') gebruiken'; 
     50$lang['Prefix of the sent e-mail subject'] = 'Voorvoegsel voor het email onderwerp'; 
     51$lang['you can use "%gallery_title%"'] = 'je kan "%gallery_title%" gebruiken'; 
    5252?> 
  • extensions/ContactForm/language/pl_PL/plugin.lang.php

    r17584 r17945  
    4949$lang['Plain text'] = 'Sam tekst'; 
    5050$lang['Please enter an e-mail'] = 'Wprowadź proszę e-mail'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Prefix tematu wysyłanego maila (możesz wykorzystać tytuł galerii: "%gallery_title%")'; 
     51$lang['Prefix of the sent e-mail subject'] = 'Prefix tematu wysyłanego maila'; 
     52$lang['you can use "%gallery_title%"'] = 'możesz wykorzystać tytuł galerii: "%gallery_title%"'; 
    5253?> 
  • extensions/ContactForm/language/pt_PT/plugin.lang.php

    r17532 r17945  
    4949$lang['Plain text'] = 'Texto normal'; 
    5050$lang['Please enter an e-mail'] = 'Indique um Email por favor'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Prefixo do assunto Enviar e-mail (Pode usar "%gallery_title%")'; 
     51$lang['Prefix of the sent e-mail subject'] = 'Prefixo do assunto Enviar e-mail'; 
     52$lang['you can use "%gallery_title%"'] = 'Pode usar "%gallery_title%"'; 
    5253?> 
  • extensions/ContactForm/language/ru_RU/plugin.lang.php

    r17522 r17945  
    4040$lang['Error while sending e-mail'] = 'Ошибка при отправке сообщения'; 
    4141 
    42 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Префикс темы отправляемых e-mail (можно использовать "%gallery_title%")'; 
     42$lang['Prefix of the sent e-mail subject'] = 'Префикс темы отправляемых e-mail'; 
     43$lang['you can use "%gallery_title%"'] = 'можно использовать "%gallery_title%"'; 
    4344$lang['Please enter an e-mail'] = 'Пожалуйста, введите e-mail'; 
    4445$lang['Active'] = 'Активный'; 
  • extensions/ContactForm/language/sk_SK/plugin.lang.php

    r17531 r17945  
    4040$lang['Error while sending e-mail'] = 'Chyba počas posielania e-mailu'; 
    4141 
    42 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Predpona predmetu posielaného emailu (môžete použiť "%gallery_title%")'; 
     42$lang['Prefix of the sent e-mail subject'] = 'Predpona predmetu posielaného emailu'; 
     43$lang['you can use "%gallery_title%"'] = 'môžete použiť "%gallery_title%"'; 
    4344$lang['Please enter an e-mail'] = 'Prosím vložte email'; 
    4445$lang['Plain text'] = 'Obyčajný text'; 
  • extensions/ContactForm/language/tr_TR/plugin.lang.php

    r17535 r17945  
    4242$lang['%s must not be less than %d characters long'] = '%s, %d karakter uzunluğundan küçük olmamalıdır'; 
    4343$lang['%s must not be more than %d characters long'] = '%s, %d karakter uzunluğundan büyük olmamalıdır'; 
    44 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Gönderilen e-posta konusu başına bir ön takı ekle ("%gallery_title%" kullanabilirsiniz.)'; 
     44$lang['Prefix of the sent e-mail subject'] = 'Gönderilen e-posta konusu başına bir ön takı ekle'; 
     45$lang['you can use "%gallery_title%"'] = '"%gallery_title%" kullanabilirsiniz'; 
    4546$lang['+ Add an email'] = '+ Bir e-posta adresi ekle'; 
    4647$lang['Active'] = 'Etkin'; 
  • extensions/ContactForm/language/uk_UA/plugin.lang.php

    r17643 r17945  
    3939$lang['Please enter a message'] = 'Будь ласка, введіть повідомлення'; 
    4040$lang['Error while sending e-mail'] = 'Помилка при відправленні по електронній пошті'; 
    41  
    4241$lang['%s must not be less than %d characters long'] = '%s повинно бути не коротше %d символів'; 
    4342$lang['%s must not be more than %d characters long'] = '%s повинно бути не довше %d символів'; 
     
    4948$lang['Plain text'] = 'Простий текст'; 
    5049$lang['Please enter an e-mail'] = 'Будь ласка, введіть e-mail'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Префікс теми відправлених e-mail (можна використовувати "%gallery_title%")'; 
     50$lang['Prefix of the sent e-mail subject'] = 'Префікс теми відправлених e-mail'; 
     51$lang['you can use "%gallery_title%"'] = 'можна використовувати "%gallery_title%"'; 
    5252?> 
  • extensions/ContactForm/language/vi_VN/plugin.lang.php

    r17526 r17945  
    3939$lang['Please enter a message'] = 'Vui lòng nhập nội dung'; 
    4040$lang['Error while sending e-mail'] = 'Có lỗi trong quá trình gởi email'; 
    41  
    4241$lang['%s must not be less than %d characters long'] = '%s phải có ít nhất %d ký tự'; 
    4342$lang['%s must not be more than %d characters long'] = '%s phải có ít hơn %d ký tự'; 
     
    4948$lang['Plain text'] = 'Thô (không có định dạng gì)'; 
    5049$lang['Please enter an e-mail'] = 'Hãy nhập địa chỉ thư'; 
    51 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Chủ đề gắn vào trước chủ đề thư (ví dụ "%gallery_title%")'; 
     50$lang['Prefix of the sent e-mail subject'] = 'Chủ đề gắn vào trước chủ đề thư'; 
     51$lang['you can use "%gallery_title%"'] = 'ví dụ "%gallery_title%"'; 
    5252?> 
  • extensions/ContactForm/language/zh_CN/plugin.lang.php

    r17594 r17945  
    2222// +-----------------------------------------------------------------------+ 
    2323$lang['Please enter an e-mail'] = '请输入email地址'; 
    24 $lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'email标题的前缀 (您可以使用 "%gallery_title%")'; 
     24$lang['Prefix of the sent e-mail subject'] = 'email标题的前缀'; 
     25$lang['you can use "%gallery_title%"'] = '您可以使用 "%gallery_title%"'; 
    2526$lang['Subject'] = '标题'; 
    2627$lang['Text after the contact form'] = '联络表单之后的文字'; 
  • extensions/ContactForm/main.inc.php

    r17658 r17945  
    1111if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    1212 
    13 define('CONTACT_FORM_PATH',   PHPWG_PLUGINS_PATH . 'ContactForm/'); 
    14 define('CONTACT_FORM_ADMIN',  get_root_url() . 'admin.php?page=plugin-ContactForm'); 
    15 define('CONTACT_FORM_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'contact')) . '/'); 
    16 define('CONTACT_FORM_VERSION', '2.4.d'); 
     13global $prefixeTable; 
     14 
     15defined('CONTACT_FORM_ID') or define('CONTACT_FORM_ID', basename(dirname(__FILE__))); 
     16define('CONTACT_FORM_PATH',    PHPWG_PLUGINS_PATH . CONTACT_FORM_ID . '/'); 
     17define('CONTACT_FORM_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . CONTACT_FORM_ID); 
     18define('CONTACT_FORM_PUBLIC',  get_absolute_root_url() . make_index_url(array('section' => 'contact')) . '/'); 
     19define('CONTACT_FORM_TABLE',   $prefixeTable .'contact_form'); 
     20define('CONTACT_FORM_VERSION', '2.5.0'); 
    1721 
    1822 
    1923add_event_handler('init', 'contact_form_init'); 
    2024 
    21 add_event_handler('loc_end_section_init', 'contact_form_section_init'); 
    22 add_event_handler('loc_end_index', 'contact_form_page'); 
    23 add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 
    24  
    2525if (defined('IN_ADMIN')) 
    2626{ 
    2727  add_event_handler('get_admin_plugin_menu_links', 'contact_form_admin_menu'); 
     28} 
     29else 
     30{ 
     31  add_event_handler('loc_end_section_init', 'contact_form_section_init'); 
     32  add_event_handler('loc_end_index', 'contact_form_page'); 
     33  add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 
    2834} 
    2935 
     
    3945   
    4046  if ( 
    41     $pwg_loaded_plugins['ContactForm']['version'] == 'auto' or 
    42     version_compare($pwg_loaded_plugins['ContactForm']['version'], CONTACT_FORM_VERSION, '<') 
     47    $pwg_loaded_plugins[CONTACT_FORM_ID]['version'] == 'auto' or 
     48    version_compare($pwg_loaded_plugins[CONTACT_FORM_ID]['version'], CONTACT_FORM_VERSION, '<') 
    4349  ) 
    4450  { 
     
    4652    contact_form_install(); 
    4753     
    48     if ($pwg_loaded_plugins['ContactForm']['version'] != 'auto') 
     54    if ($pwg_loaded_plugins[CONTACT_FORM_ID]['version'] != 'auto') 
    4955    { 
    5056      $query = ' 
    5157UPDATE '. PLUGINS_TABLE .' 
    5258SET version = "'. CONTACT_FORM_VERSION .'" 
    53 WHERE id = "ContactForm"'; 
     59WHERE id = "'. CONTACT_FORM_ID .'"'; 
    5460      pwg_query($query); 
    5561       
    56       $pwg_loaded_plugins['ContactForm']['version'] = CONTACT_FORM_VERSION; 
     62      $pwg_loaded_plugins[CONTACT_FORM_ID]['version'] = CONTACT_FORM_VERSION; 
    5763       
    5864      if (defined('IN_ADMIN')) 
  • extensions/ContactForm/maintain.inc.php

    r17658 r17945  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    33 
    4 include_once(PHPWG_PLUGINS_PATH . 'ContactForm/include/install.inc.php'); 
     4defined('CONTACT_FORM_ID') or define('CONTACT_FORM_ID', basename(dirname(__FILE__))); 
     5include_once(PHPWG_PLUGINS_PATH . CONTACT_FORM_ID . '/include/install.inc.php'); 
    56 
    67function plugin_install()  
  • extensions/ContactForm/template/contact_form.tpl

    r17498 r17945  
    1212email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter an e-mail'|@translate}" }); 
    1313email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|@translate}" }); 
     14{/if} 
     15 
     16{if $GROUPS} 
     17var group = new LiveValidation('group', {ldelim} onlyOnSubmit: true }) 
     18group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|@translate}" }); 
    1419{/if} 
    1520 
     
    7580        </td> 
    7681      </tr> 
     82      {if $GROUPS} 
     83      <tr> 
     84        <td class="title"><label for="group">{'Category'|@translate}</label></td> 
     85        <td> 
     86          <select name="group" id="group"> 
     87            <option value="-1">------------</option> 
     88            {html_options options=$GROUPS selected=$contact.group} 
     89          </select> 
     90        </td> 
     91      </tr> 
     92      {/if} 
    7793      <tr> 
    7894        <td class="title"><label for="subject">{'Subject'|@translate}</label></td> 
  • extensions/ContactForm/template/style.css

    r17483 r17945  
    1818    margin-right:3px; 
    1919  } 
    20   .contact input[type="text"], .contact textarea { 
     20  .contact input[type="text"], .contact textarea, .contact select { 
    2121    border-radius:2px; 
    2222    padding:3px; 
     23  } 
     24  .content select { 
     25    padding:2px; 
    2326  } 
    2427 
Note: See TracChangeset for help on using the changeset viewer.