Changeset 3749


Ignore:
Timestamp:
Aug 18, 2009, 4:52:43 PM (15 years ago)
Author:
Criss
Message:

Add configuration option to define menu link or not

Location:
extensions/ContactForm
Files:
8 edited

Legend:

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

    r3748 r3749  
    11<?php
    2 /* $Id: cf_config.tab.php,v 1.2 2009/08/18 14:10:09 Criss Exp $ */
     2/* $Id: cf_config.tab.php,v 1.3 2009/08/18 14:40:36 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44check_status(ACCESS_ADMINISTRATOR);
     
    66
    77if (isset($_POST['submit'])) {
     8
     9  // Menu link
     10  $new_value = false;
     11  if (isset($_POST['cf_menu_link'])) {
     12    if ('1' == $_POST['cf_menu_link']) {
     13      $new_value = true;
     14    }
     15  }
     16  $cf_config->set_value(CF_CFG_MENU_LINK, $new_value);
     17 
    818  // Allow guest
    919  $new_value = false;
     
    98108
    99109$config_values = array(
     110    'MENU_LINK'         => $cf_config->get_value(CF_CFG_MENU_LINK)?
     111                              CF_CHECKED:'',
    100112    'GUEST'             => $cf_config->get_value(CF_CFG_ALLOW_GUEST)?
    101113                              CF_CHECKED:'',
  • extensions/ContactForm/admin/template/cf_config.tab.tpl

    r3748 r3749  
    1 {* $Id: cf_config.tab.tpl,v 1.2 2009/08/18 14:10:09 Criss Exp $ *}
     1{* $Id: cf_config.tab.tpl,v 1.3 2009/08/18 14:40:36 Criss Exp $ *}
    22<div class="titrePage">
    33    <h2>{$CF.TITLE} [{$CF.VERSION}]<br>{'cf_config'|@translate}</h2>
     
    88  <legend>{'cf_label_config'|@translate}</legend>
    99  <ul>
     10    <li>
     11      <label>
     12        <input type="checkbox" name="cf_menu_link" value="1" {$CF_CONFIG.MENU_LINK} />
     13        {'cf_menu_link'|@translate}
     14      </label>
     15    </li>
    1016    <li>
    1117      <label>
  • extensions/ContactForm/classes/cf_plugin.class.php

    r3748 r3749  
    5555 
    5656  function blockmanager_apply($aMenuRefArray) {
    57     if (!$this->check_allowed()) {
     57    if (!$this->check_menu_adding()) {
    5858      return;
    5959    }
     
    426426    return $infos;
    427427  }
    428 
     428  protected function check_menu_adding() {
     429    return ($this->config->get_value(CF_CFG_MENU_LINK) and
     430            $this->check_allowed());
     431  }
    429432  protected function check_allowed() {
    430433    if (is_a_guest() and !$this->config->get_value(CF_CFG_ALLOW_GUEST)) {
  • extensions/ContactForm/include/cf_common.inc.php

    r3748 r3749  
    77
    88// Version
    9 define('CF_VERSION',            '1.0.2');
     9define('CF_VERSION',            '1.0.3');
    1010define('CF_TITLE',              'cf_plugin_name');
    1111
     
    4747define('CF_CFG_VERSION',        'version');
    4848
     49define('CF_CFG_MENU_LINK',      'cf_menu_link');
    4950define('CF_CFG_SUBJECT_PREFIX', 'cf_subject_prefix');
    5051define('CF_CFG_SEPARATOR_LEN',  'cf_separator_length');
     
    7576global $conf;
    7677$cf_config_default = array();
     78$cf_config_default[CF_CFG_MENU_LINK] = true;
    7779$cf_config_default[CF_CFG_SUBJECT_PREFIX] = CF_DEFAULT_PREFIX;
    7880$cf_config_default[CF_CFG_SEPARATOR_LEN] = CF_SEPARATOR_LENGTH;
  • extensions/ContactForm/language/en_UK/plugin.lang.php

    r3748 r3749  
    11<?php
    2 /* $Id: plugin.lang.php,v 1.7 2009/08/18 14:10:09 Criss Exp $ */
     2/* $Id: plugin.lang.php,v 1.8 2009/08/18 14:40:36 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44global $lang;
     
    5252$lang['cf_label_config'] = 'General configuration';
    5353$lang['cf_label_mail'] = 'E-mail configuration';
     54$lang['cf_menu_link'] = 'Add link in menu';
    5455$lang['cf_guest_allowed'] = 'Allow guests to see the form';
    5556$lang['cf_mail_prefix'] = 'Prefix of the sent e-mail subject';
  • extensions/ContactForm/language/fr_FR/plugin.lang.php

    r3748 r3749  
    11<?php
    2 /* $Id: plugin.lang.php,v 1.7 2009/08/18 14:10:09 Criss Exp $ */
     2/* $Id: plugin.lang.php,v 1.8 2009/08/18 14:40:36 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44global $lang;
     
    5252$lang['cf_label_config'] = 'Configuration générale';
    5353$lang['cf_label_mail'] = 'Configuration de l\'e-mail';
     54$lang['cf_menu_link'] = 'Ajouter le lien dans le menu';
    5455$lang['cf_guest_allowed'] = 'Autoriser les invités à avoir le formulaire';
    5556$lang['cf_mail_prefix'] = 'Préfixe du sujet de l\'e-mail envoyé';
  • extensions/ContactForm/language/it_IT/plugin.lang.php

    r3748 r3749  
    11<?php
    2 /* $Id: plugin.lang.php,v 1.7 2009/08/18 14:10:09 Criss Exp $ */
     2/* $Id: plugin.lang.php,v 1.8 2009/08/18 14:40:36 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44global $lang;
     
    5252$lang['cf_label_config'] = 'Configurazione generale';
    5353// TODO $lang['cf_label_mail'] = '';
     54// TODO $lang['cf_menu_link'] = '';
    5455// TODO $lang['cf_guest_allowed'] = '';
    5556// TODO $lang['cf_mail_prefix'] = '';
  • extensions/ContactForm/main.inc.php

    r3748 r3749  
    22/*
    33 Plugin Name: Contact Form
    4  Version: 1.0.2
     4 Version: 1.0.3
    55 Description: Add a "Contact" item in the Menu block to offer a contact form to users
    66 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=304
     
    1010
    1111/** History **
     12
     13  2009-08-18 1.0.3
     14                    Add configuration option to define menu link or not
    1215
    1316  2009-08-18 1.0.2
Note: See TracChangeset for help on using the changeset viewer.