Ignore:
Timestamp:
Aug 21, 2009, 11:32:30 AM (15 years ago)
Author:
Criss
Message:

Add history tab

Location:
extensions/ContactForm
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/config.php

    r3753 r3771  
    11<?php
    2 /* $Id: config.php,v 1.3 2009/08/19 13:30:25 Criss Exp $ */
     2/* $Id: config.php,v 1.4 2009/08/21 09:24:18 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44check_status(ACCESS_ADMINISTRATOR);
     
    99$config_tabs[]='config';
    1010$config_tabs[]='language';
     11$config_tabs[]='history';
    1112
    1213global $template, $page;
  • extensions/ContactForm/include/cf_common.inc.php

    r3753 r3771  
    77
    88// Version
    9 define('CF_VERSION',            '1.0.4');
     9define('CF_VERSION',            '1.0.5');
    1010define('CF_TITLE',              'cf_plugin_name');
    1111
     
    2626// Files
    2727define('CF_OBSOLETE',           'obsolete.list');
     28define('CF_CHANGELOG',          'CHANGELOG');
    2829// Constants
    2930define('CF_DEBUG_ACTIVE',       false);
  • extensions/ContactForm/include/cf_functions.inc.php

    r3753 r3771  
    132132}
    133133
     134function cf_format_date($year, $month, $day, $format='%M %D, %Y') {
     135  $format = str_ireplace('%Y', $year, $format);
     136  $format = str_ireplace('%M', $month, $format);
     137  $format = str_ireplace('%D', $day, $format);
     138  return $format;
     139}
     140
     141function cf_get_history_list($file_name, &$errors = array()) {
     142  // Include language advices
     143  load_language('plugin.lang', CF_PATH);
     144  global $lang;
     145  $month_list = $lang['month'];
     146  $history = array();
     147  if (!file_exists($file_name)) {
     148    array_push($errors, sprintf(l10n('cf_file_not_found'), $file_name));
     149    return $history;
     150  }
     151  $raw_history = file($file_name,
     152                      FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
     153
     154  $index = -1;
     155  array_push($errors, sprintf(l10n('cf_file_empty'), $file_name));
     156  foreach($raw_history as $new_line) {
     157    $pos = strpos($new_line, ' ');
     158    switch ($pos) {
     159      case 0:
     160        // History item
     161        if (isset($history[$index]) and is_array($history[$index])) {
     162          array_push($history[$index]['CHANGES'], trim($new_line));
     163        }
     164        break;
     165      default:
     166        // New history date
     167        $index++;
     168        list($date, $version) = explode(' ', $new_line);
     169        list($year, $month, $day) = explode('-', $date);
     170        $date_array = array('RAW' => $date);
     171        if (isset($month)) {
     172          $month = $month_list[intval($month)];
     173        }
     174        if (isset($year) and isset($month) and isset($day)) {
     175          $date_array['FORMATTED'] = cf_format_date($year,
     176                                                    $month,
     177                                                    $day,
     178                                                    l10n('cf_format_date'));
     179        }
     180        $history[$index] = array(
     181            'DATE'     => $date_array,
     182            'VERSION'  => $version,
     183            'CHANGES'  => array(),
     184          );
     185    }
     186  }
     187  return $history;
     188}
     189
    134190?>
  • extensions/ContactForm/include/contactform.css

    r3753 r3771  
    33        padding-bottom: 10px;
    44}
     5div.contact-form-content {
     6  border-width: 0px;
     7  border-style: solid;
     8  margin-top: 5px;
     9  margin-bottom: 5px;
     10  margin-left: 20px;
     11  margin-right: 20px;
     12  padding: 10px;
     13}
     14.cf-input-disabled {
     15  position: relative;
     16}
     17.cf-input, .cf-input-disabled {
     18  left: 5px;
     19}
    520td.contact-form-left {
    621        padding-right: 5px;
    722        text-align: right;
    8         vertical-align: top;
     23        vertical-align: middle;
     24}
     25td.contact-form-left#cf_message_label {
     26  vertical-align: top;
     27  padding-top: 5px;
    928}
    1029td.contact-form-right {
  • extensions/ContactForm/language/en_UK/plugin.lang.php

    r3749 r3771  
    11<?php
    2 /* $Id: plugin.lang.php,v 1.8 2009/08/18 14:40:36 Criss Exp $ */
     2/* $Id: plugin.lang.php,v 1.9 2009/08/21 09:24:18 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44global $lang;
     
    7171$lang['contact_form_label'] = 'Name used in menubar';
    7272$lang['contact_form_link_label'] = 'Text used for contact link in the page footer';
     73// History tab
     74$lang['cf_tab_history'] = 'History';
     75$lang['cf_history'] = 'History';
     76$lang['cf_history_desc'] = 'Changes history';
     77$lang['cf_history_date'] = 'Date';
     78$lang['cf_history_version'] = 'Version';
     79$lang['cf_history_log'] = 'Changelog';
     80$lang['cf_file_not_found'] = 'File not found';
     81$lang['cf_file_empty'] = 'File is empty';
     82$lang['cf_format_date'] = '%M %D, %Y';
    7383?>
  • extensions/ContactForm/language/fr_FR/plugin.lang.php

    r3749 r3771  
    11<?php
    2 /* $Id: plugin.lang.php,v 1.8 2009/08/18 14:40:36 Criss Exp $ */
     2/* $Id: plugin.lang.php,v 1.9 2009/08/21 09:24:18 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44global $lang;
     
    7171$lang['contact_form_label'] = 'Nom affiché dans la barre de menus';
    7272$lang['contact_form_link_label'] = 'Texte utilisé pour le lien de contact en bas de page';
    73 
     73// History tab
     74$lang['cf_tab_history'] = 'Historique';
     75$lang['cf_history'] = 'Historique';
     76$lang['cf_history_desc'] = 'Historique des modifications';
     77$lang['cf_history_date'] = 'Date';
     78$lang['cf_history_version'] = 'Version';
     79$lang['cf_history_log'] = 'Changelog';
     80$lang['cf_file_not_found'] = 'Fichier non trouvé';
     81$lang['cf_file_empty'] = 'Fichier vide';
     82$lang['cf_format_date'] = '%D %M %Y';
    7483?>
  • extensions/ContactForm/language/it_IT/plugin.lang.php

    r3749 r3771  
    11<?php
    2 /* $Id: plugin.lang.php,v 1.8 2009/08/18 14:40:36 Criss Exp $ */
     2/* $Id: plugin.lang.php,v 1.9 2009/08/21 09:24:18 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44global $lang;
     
    7171// TODO $lang['contact_form_label'] = ' ';
    7272// TODO $lang['contact_form_link_label'] = ' ';
     73// History tab
     74// TODO $lang['cf_tab_history'] = '';
     75// TODO $lang['cf_history'] = '';
     76// TODO $lang['cf_history_desc'] = '';
     77// TODO $lang['cf_history_date'] = '';
     78// TODO $lang['cf_history_version'] = '';
     79// TODO $lang['cf_history_log'] = '';
     80// TODO $lang['cf_file_not_found'] = '';
     81// TODO $lang['cf_file_empty'] = '';
     82// TODO $lang['cf_format_date'] = '%D %M %Y';
    7383
    7484?>
  • extensions/ContactForm/main.inc.php

    r3753 r3771  
    22/*
    33 Plugin Name: Contact Form
    4  Version: 1.0.4
     4 Version: 1.0.5
    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
     
    99*/
    1010
    11 /** History **
    12 
    13   2009-08-18 1.0.4
    14                     Update configuration pages
    15 
    16   2009-08-18 1.0.3
    17                     Add configuration option to define menu link or not
    18 
    19   2009-08-18 1.0.2
    20                     Add configuration option to define template variable or not
    21 
    22   2009-08-17 1.0.1
    23                     Add default value to language translation
    24 
    25   2009-08-17 1.0.0
    26                     Put under SVN control
    27 
    28   2009-08-17 0.1.f
    29                     Add obsolete list
    30 
    31   2009-08-17 0.1.e
    32                     Add language configuration for items texts
    33                     Add template variable
    34 
    35   2009-08-14 0.1.d
    36                     Add a redirection page when successfully sent message
    37 
    38   2009-08-13 0.1.c
    39                     Fix regexp bug in mail format check in javascript
    40 
    41   2009-08-13 0.1.b
    42                     Add admin management
    43 
    44   2009-08-13 0.1.a
    45                     Plugin creation
    46 
    47 */
    4811if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    4912
  • extensions/ContactForm/template/cf_form.tpl

    r3743 r3771  
     1{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
     2{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
     3{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.resizable.packed.js"}
    14{literal}
    25<script type="text/javascript">
     6jQuery().ready(function(){
     7    // Resize possible for textarea
     8    jQuery("#cf_message").resizable({
     9        handles: "all",
     10        animate: true,
     11        animateDuration: "slow",
     12        animateEasing: "swing",
     13        preventDefault: true,
     14        preserveCursor: true,
     15        autoHide: true,
     16        ghost: true
     17      });
     18  });
     19jQuery().ready(function(){
     20  // Resize possible for textarea
     21  jQuery(".cf-input").resizable({
     22        handles: "e",
     23        animate: true,
     24        animateDuration: "slow",
     25        animateEasing: "swing",
     26        preventDefault: true,
     27        preserveCursor: true,
     28        autoHide: true,
     29        ghost: true
     30      });
     31  });
     32
    333function cf_validate() {
    434  var items = new Array('cf_from_name','cf_from_mail','cf_subject','cf_message');
     
    2959<div id="autre_content" class="contact-form">
    3060  <form  method="post" action="{$CF.F_ACTION}" class="filter" id="contactform" onsubmit="return cf_validate();">
    31   <fieldset>
     61  <div class="contact-form-content">
    3262    <table>
    3363      <tr>
     
    3565        <td class="contact-form-right">
    3666        {if $CF.LOGGED}
    37           <input type="text" name="cf_from_name_label" id="cf_from_name" size="40" value="{$CF.NAME}" disabled="disabled">
     67          <input type="text" name="cf_from_name_label" id="cf_from_name" size="40" value="{$CF.NAME}" disabled="disabled" class="cf-input-disabled">
    3868          <input type="hidden" name="cf_from_name" value="{$CF.NAME}" />
    3969        {else}
    40           <input type="text" name="cf_from_name" id="cf_from_name" size="40" value="{$CF.NAME}">
     70          <input type="text" name="cf_from_name" id="cf_from_name" size="40" value="{$CF.NAME}" class="cf-input">
    4171        {/if}
    4272        </td>
     
    4676        <td class="contact-form-right">
    4777        {if $CF.LOGGED and ''!=$CF.EMAIL}
    48           <input type="text" name="cf_from_mail_label" id="cf_from_mail" size="40" value="{$CF.EMAIL}" disabled="disabled">
     78          <input type="text" name="cf_from_mail_label" id="cf_from_mail" size="40" value="{$CF.EMAIL}" disabled="disabled" class="cf-input-disabled">
    4979          <input type="hidden" name="cf_from_mail" value="{$CF.EMAIL}" />
    5080        {else}
    51           <input type="text" name="cf_from_mail" id="cf_from_mail" size="40" value="{$CF.EMAIL}"></td>
     81          <input type="text" name="cf_from_mail" id="cf_from_mail" size="40" value="{$CF.EMAIL}" class="cf-input"></td>
    5282        {/if}
    5383        </td>
     
    5585      <tr>
    5686        <td class="contact-form-left">{'cf_subject'|@translate}</td>
    57         <td class="contact-form-right"><input type="text" name="cf_subject" id="cf_subject" size="40" value="{$CF.SUBJECT}"></td>
     87        <td class="contact-form-right"><input type="text" name="cf_subject" id="cf_subject" size="40" value="{$CF.SUBJECT}" class="cf-input"></td>
    5888      </tr>
    5989      <tr>
    60         <td class="contact-form-left">{'cf_message'|@translate}</td>
     90        <td class="contact-form-left" id="cf_message_label">{'cf_message'|@translate}</td>
    6191        <td class="contact-form-right"><textarea name="cf_message" id="cf_message" rows="10" cols="40">{$CF.MESSAGE}</textarea></td>
    6292      </tr>
     
    6898    <input type="hidden" name="cf_key" value="{$CF.KEY}" />
    6999    <input type="hidden" name="cf_id" value="{$CF.ID}" />
    70   </fieldset>
     100  </div>
    71101  </form>
    72102</div>
Note: See TracChangeset for help on using the changeset viewer.