Changeset 14756


Ignore:
Timestamp:
May 5, 2012, 12:56:27 AM (12 years ago)
Author:
plg
Message:

simplify custom text management

Location:
extensions/ContactForm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/admin/cf_persoform.tab.php

    r14428 r14756  
    11<?php
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     3
    34check_status(ACCESS_ADMINISTRATOR);
    45
    56global $template, $conf, $user;
    67
     8if (isset($_POST['submitpersoform']))
     9{
     10  conf_update_param('persoformtop', $_POST['persoform_top']);
     11  conf_update_param('persoformbottom', $_POST['persoform_bottom']);
     12
     13  // reload configuration
     14  load_conf_from_db();
     15}
     16
    717//charge Persoform
    8 $query = '
    9 select param,value
    10         FROM ' . CONFIG_TABLE . '
    11   WHERE param = "persoformtop"
    12         ;';
    13 $result = pwg_query($query);
    14 
    15 $row = mysql_fetch_array($result);
    16    
    17   $template->assign(
    18     array(
    19       'PERSOFORMTOP' => $row['value'],
    20       ));
    21 
    22 $query = '
    23 select param,value
    24         FROM ' . CONFIG_TABLE . '
    25   WHERE param = "persoformbottom"
    26         ;';
    27 $result = pwg_query($query);
    28 
    29 $row = mysql_fetch_array($result);
    30    
    31   $template->assign(
    32     array(
    33       'PERSOFORMBOTTOM' => $row['value'],
    34       ));
    35 
    36 if (isset($_POST['submitpersoform']))
    37         {
    38         $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="persoformtop" LIMIT 1;';
    39     pwg_query($q);
    40                 $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("persoformtop","'.$_POST['persoform_top'].'","Add text above form to contactform plugin");';
    41     pwg_query($query);
    42 
    43   $template->assign(
    44     array(
    45       'PERSOFORMTOP' => stripslashes($_POST['persoform_top']),
    46       ));
    47 
    48         $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="persoformbottom" LIMIT 1;';
    49     pwg_query($q);
    50         $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("persoformbottom","'.$_POST['persoform_bottom'].'","Add text below form to contactform plugin");';
    51     pwg_query($query);
    52 
    53   $template->assign(
    54     array(
    55       'PERSOFORMBOTTOM' => stripslashes($_POST['persoform_bottom']),
    56       ));
    57         }       
    58        
     18$template->assign(
     19  array(
     20    'PERSOFORMTOP' => $conf['persoformtop'],
     21    'PERSOFORMBOTTOM' => $conf['persoformbottom'],
     22    )
     23  );
    5924?>
  • extensions/ContactForm/admin/themes/cf_persoform.tab.tpl

    r14428 r14756  
    22    <h2>{$CF.TITLE}<br>{'cf_tab_persoform'|@translate}</h2>
    33</div>
    4 <h3>{'Add text to the contact form'|@translate}</h3>
    5 <br>
    6         <form method="post" >
    7          <fieldset id="mainConf">
    8                         <span class="property">
    9                                 <label for="persoformtop">{'Add text above'|@translate} *1</label>
    10                         </span>
    11                         <br>
    12                         <textarea rows="4" cols="80" class="description" name="persoform_top" id="persoform_top">{$PERSOFORMTOP}</textarea>
    13                         <br>
    14                         <br>
    15                         <h3>{'contact_form_title'|@translate}</h3>
    16                         <br>
    17                         <br>
    18                         <span class="property">
    19                                 <label for="persoformbottom">{'Add text below'|@translate} *2</label>
    20                         </span>
    21                         <br>
    22                         <textarea rows="4" cols="80" class="description" name="persoform_bottom" id="persoform_bottom">{$PERSOFORMBOTTOM}</textarea>
    23   <p>
    24     <input class="submit" type="submit" name="submitpersoform" value="{'Submit'|@translate}">
    25   </p>
    26         </form>
    27 <br>
    28 <br>
    29 <br>
    30 <br>
    31 *1 {'use tag < div id="persoformtop" > to customize your personal text'|@translate}<br>
    32 *2 {'use tag < div id="persoformbottom" > to customize your personal text'|@translate}<br>
    33 {'if plugin ExtendedDescription is actif, you can use tags [lang]'|@translate}<br>
     4
     5<form method="post" >
     6<fieldset>
     7  <legend>{'Text before the contact form'|@translate}</legend>
     8  <textarea rows="4" cols="80" class="description" name="persoform_top" id="persoform_top">{$PERSOFORMTOP}</textarea>
    349</fieldset>
     10
     11<fieldset>
     12  <legend>{'Text after the contact form'|@translate}</legend>
     13  <textarea rows="4" cols="80" class="description" name="persoform_bottom" id="persoform_bottom">{$PERSOFORMBOTTOM}</textarea>
     14</fieldset>
     15
     16<p>
     17  <input class="submit" type="submit" name="submitpersoform" value="{'Submit'|@translate}">
     18</p>
     19</form>
  • extensions/ContactForm/language/en_UK/plugin.lang.php

    r14428 r14756  
    6868$lang['cf_refresh'] = 'Regenerate e-mail list address';
    6969// persoformtab
    70 $lang['cf_tab_persoform'] = 'Add text Form';
    71 $lang['Add text to the contact form'] = 'Add text to the contact form';
    72 $lang['Add text above'] = 'Add text above';
    73 $lang['Add text below'] = 'Add text below';
    74 $lang['use tag < div id="persoformtop" > to customize your personal text'] = 'use tag < div id="persoformtop" > to customize your personal text';
    75 $lang['use tag < div id="persoformbottom" > to customize your personal text'] = 'use tag < div id="persoformbottom" > to customize your personal text';
    76 $lang['if plugin ExtendedDescription is actif, you can use tags [lang]'] = 'if plugin ExtendedDescription is actif, you can use tags [lang]';
     70$lang['cf_tab_persoform'] = 'Add custom text';
     71$lang['Text before the contact form'] = 'Text before the contact form';
     72$lang['Text after the contact form'] = 'Text after the contact form';
    7773?>
  • extensions/ContactForm/language/fr_FR/plugin.lang.php

    r14428 r14756  
    6868$lang['cf_refresh'] = 'Regénérer la liste des adresses';
    6969// persoformtab
    70 $lang['cf_tab_persoform'] = 'Ajouter texte perso au Formulaire';
    71 $lang['Add text to the contact form'] = 'Ajouter du texte au formulaire de contact';
    72 $lang['Add text above'] = 'Texte ajouter au dessus';
    73 $lang['Add text below'] = 'Texte ajouter en dessous';
    74 $lang['use tag < div id="persoformtop" > to customize your personal text'] = 'utiiser la balise < div id="persoformtop" > pour personaliser le texte';
    75 $lang['use tag < div id="persoformbottom" > to customize your personal text'] = 'utiiser la balise < div id="persoformbottom" > pour personaliser le texte';
    76 $lang['if plugin ExtendedDescription is actif, you can use tags [lang]'] = 'Si le plugin ExtendedDescription est actif, vous pouvez utiliser les balises [lang]';
     70$lang['cf_tab_persoform'] = 'Ajouter du texte personnel';
     71$lang['Text before the contact form'] = 'Texte au-dessus du formulaire de contact';
     72$lang['Text after the contact form'] = 'Texte en-dessous du formulaire de contact';
    7773?>
Note: See TracChangeset for help on using the changeset viewer.