Changeset 3753


Ignore:
Timestamp:
08/19/09 17:37:52 (11 years ago)
Author:
Criss
Message:

Update configuration pages

Location:
extensions/ContactForm
Files:
10 added
10 edited

Legend:

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

    r3748 r3753  
    11<?php 
    2 /* $Id: cf_language.tab.php,v 1.3 2009/08/18 14:10:09 Criss Exp $ */ 
     2/* $Id: cf_language.tab.php,v 1.5 2009/08/19 14:51:59 Criss Exp $ */ 
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    44check_status(ACCESS_ADMINISTRATOR); 
    5  
     5global $user; 
     6CF_Log::add_debug($user, 'USER'); 
    67$all_languages = get_languages(); 
    78$cf_languages = $cf_config->get_config_lang(); 
    89$cf_item_selected=''; 
    910if (isset($_POST['submit'])) { 
    10  
     11   
    1112  if (isset($_POST['cf_item']) and is_array($_POST['cf_item'])) { 
    12     CF_Log::add_debug($_POST['cf_item'], 'POST'); 
    1313    $cf_languages->mass_update($_POST['cf_item']); 
    1414  } 
     
    2323  } 
    2424   
    25   if (isset($_POST['cf_select'])) { 
    26     $cf_item_selected = $_POST['cf_select'];  
     25  if (isset($_POST['cf_selected'])) { 
     26    $cf_item_selected = trim(stripslashes($_POST['cf_selected']));  
    2727  } 
    2828} 
    2929 
    30 $config_keys=array(); 
    3130$config_values=array(); 
    3231 
     
    4544      ); 
    4645  } 
    47   $config_keys[$key] = l10n($key . '_label'); 
    48   $config_values[$key] = $current; 
     46  $config_values[$key] = array( 
     47      'KEY' => l10n($key . '_label'), 
     48      'VALUE' => $current, 
     49    ); 
     50} 
     51if ('' == $cf_item_selected) { 
     52  $cf_item_selected = 0; 
    4953} 
    5054$template->assign('CF_CONFIG_KEYS_SELECTED', $cf_item_selected); 
    51 $template->assign('CF_CONFIG_KEYS', $config_keys); 
    5255$template->assign('CF_CONFIG_VALUES', $config_values); 
    53  
    5456?> 
  • extensions/ContactForm/admin/template/cf_config.tab.tpl

    r3749 r3753  
    1 {* $Id: cf_config.tab.tpl,v 1.3 2009/08/18 14:40:36 Criss Exp $ *} 
     1{* $Id: cf_config.tab.tpl,v 1.5 2009/08/19 14:51:59 Criss Exp $ *} 
     2{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"} 
     3{known_script id="jquery.ui.tabs" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.tabs.packed.js"} 
    24<div class="titrePage"> 
    35    <h2>{$CF.TITLE} [{$CF.VERSION}]<br>{'cf_config'|@translate}</h2> 
    46</div> 
    5 <h3>{'cf_config_desc'|@translate}</h3> 
     7<h3 style="width: 100%;">{'cf_config_desc'|@translate}</h3> 
    68<form method="post" action="{$CF.F_ACTION}" id="update" enctype="multipart/form-data"> 
    79<fieldset> 
     
    8486<p><input class="submit" type="submit" value="{'cf_validate'|@translate}" name="submit"></p> 
    8587</form> 
     88{literal} 
     89<script type="text/javascript"> 
     90$(document).ready(function() { 
     91    $(".infos").fadeOut(800).fadeIn(1200).fadeOut(400).fadeIn(800).fadeOut(400); 
     92    $(".errors").fadeOut(200).fadeIn(200).fadeOut(300).fadeIn(300).fadeOut(400).fadeIn(400);  
     93  }); 
     94</script> 
     95{/literal} 
  • extensions/ContactForm/admin/template/cf_language.tab.tpl

    r3746 r3753  
    1 {* $Id: cf_language.tab.tpl,v 1.2 2009/08/17 14:53:42 Criss Exp $ *} 
    2 {literal} 
     1{* $Id: cf_language.tab.tpl,v 1.4 2009/08/19 14:51:59 Criss Exp $ *} 
     2{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"} 
     3{known_script id="jquery.ui.tabs" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.tabs.packed.js"} 
    34<script type="text/javascript"> 
    4 function cf_update_display() { 
    5   var select_item = document.getElementById('cf_select'); 
    6   for (var i=0 ; i<select_item.length ; i++) { 
    7     var div_item = document.getElementById('cf_div_' + select_item[i].value); 
    8     var visible = select_item[i].selected; 
    9     cf_set_visible(div_item, visible); 
     5function set_active(key) {ldelim} 
     6  var element = document.getElementById('cf_selected'); 
     7  element.value = key; 
     8} 
     9jQuery().ready( 
     10  function(){ldelim} 
     11    jQuery('#cf-keys').accordion({ldelim} 
     12      header: '.cf-label', 
     13      event: 'click', 
     14      active: {$CF_CONFIG_KEYS_SELECTED} 
     15    }); 
    1016  } 
    11 } 
     17); 
    1218</script> 
    13 {/literal}<div class="titrePage"> 
     19<div class="titrePage"> 
    1420    <h2>{$CF.TITLE} [{$CF.VERSION}]<br>{'cf_language'|@translate}</h2> 
    1521</div> 
    16 <h3>{'cf_language_desc'|@translate}</h3> 
     22<h3 style="width: 100%;">{'cf_language_desc'|@translate}</h3> 
    1723 
    1824<form method="post" action="{$CF.F_ACTION}" id="update" enctype="multipart/form-data"> 
    19 <table> 
    20   <tr> 
    21     <td style="vertical-align: top; text-align: center;"> 
    22       <div class="cf-label">{'cf_select_item'|@translate}</div> 
    23       <select size="1" name="cf_select" id="cf_select" 
    24         onclick="cf_update_display();" onchange="cf_update_display();"> 
    25       {html_options options=$CF_CONFIG_KEYS selected=$CF_CONFIG_KEYS_SELECTED} 
    26       </select> 
    27     </td> 
    28     <td style="width: 3px;">&nbsp;</td> 
    29     <td style="text-align: center; width: 280px"> 
    30       {foreach from=$CF_CONFIG_VALUES item=config_value key=config_key name=config_keys} 
    31       <div id="cf_div_{$config_key}" class="cf-lang"> 
    32         <div class="cf-label">{$CF_CONFIG_KEYS.$config_key}</div> 
    33         <table> 
    34         {foreach from=$config_value item=language_values key=language_key} 
    35           <tr> 
    36               <td align="right">{$language_values.NAME}</td> 
    37               <td>&nbsp;</td> 
    38               <td> 
    39                 <input type="text" name="cf_item[{$config_key}][{$language_key}]" value="{$language_values.VALUE}"/> 
    40               </td> 
    41           </tr> 
    42         {/foreach} 
    43         </table> 
    44       </div> 
    45       {/foreach} 
    46     </td> 
    47   </tr> 
    48 </table> 
     25<div id="cf-keys"> 
     26<input type="hidden" id ="cf_selected" name="cf_selected" value="{$CF_CONFIG_KEYS_SELECTED}"> 
     27{foreach from=$CF_CONFIG_VALUES item=config_value key=config_key name=config_values} 
     28  <div class="cf-label" onclick="set_active({$smarty.foreach.config_values.index});"> 
     29    {$config_value.KEY} 
     30  </div> 
     31  <div> 
     32    <table class="checking"> 
     33    {foreach from=$config_value.VALUE item=language_values key=language_key} 
     34      <tr> 
     35        <td class="cf-lang">{$language_values.NAME}</td> 
     36        <td class="cf-input"><input type="text" name="cf_item[{$config_key}][{$language_key}]" value="{$language_values.VALUE}" size="30"/></td> 
     37      </tr> 
     38    {/foreach} 
     39    </table> 
     40  </div> 
     41{/foreach} 
     42</div> 
    4943{* ----------- LANGUAGES ----------- *} 
    5044<p><input class="submit" type="submit" value="{'cf_validate'|@translate}" name="submit"></p> 
     
    5246{literal} 
    5347<script type="text/javascript"> 
    54 cf_update_display(); 
     48$(document).ready(function() { 
     49    $(".infos").fadeOut(800).fadeIn(1200).fadeOut(400).fadeIn(800).fadeOut(400); 
     50    $(".errors").fadeOut(200).fadeIn(200).fadeOut(300).fadeIn(300).fadeOut(400).fadeIn(400);  
     51  }); 
    5552</script> 
    5653{/literal} 
  • extensions/ContactForm/classes/cf_log.class.php

    r3748 r3753  
    2020        'contact_form_debug' => realpath(cf_get_template('cf_debug.tpl')), 
    2121      )); 
    22     $template->assign_var_from_handle('CF_DEBUG', 'contact_form_debug'); 
     22    $debug_text = $template->parse('contact_form_debug', true); 
     23    $template->assign('CF_DEBUG', $debug_text); 
     24     
     25    return $debug_text; 
    2326  } 
    2427 
  • extensions/ContactForm/config.php

    r3748 r3753  
    11<?php 
    2 /* $Id: config.php,v 1.2 2009/08/18 14:10:09 Criss Exp $ */ 
     2/* $Id: config.php,v 1.3 2009/08/19 13:30:25 Criss Exp $ */ 
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    44check_status(ACCESS_ADMINISTRATOR); 
     
    4545          'href="' . CF_INCLUDE . 'contactform.css' . '">', 
    4646          $smarty, $repeat); 
     47$admin_css = cf_get_template('contactform_admin.css', CF_AMDIN_TPL, 'admin_'); 
     48$template->block_html_head( '', 
     49          '<link rel="stylesheet" type="text/css" '. 
     50          'href="' . $admin_css . '">', 
     51          $smarty, $repeat); 
    4752$template->block_html_head( '', 
    4853          '<script type="text/javascript" '. 
  • extensions/ContactForm/include/cf_common.inc.php

    r3749 r3753  
    77 
    88// Version 
    9 define('CF_VERSION',            '1.0.3'); 
     9define('CF_VERSION',            '1.0.4'); 
    1010define('CF_TITLE',              'cf_plugin_name'); 
    1111 
  • extensions/ContactForm/include/cf_functions.inc.php

    r3746 r3753  
    7575 
    7676/* Return template for user template/theme*/ 
    77 function cf_get_template($file, $dir=CF_TEMPLATE) { 
     77function cf_get_template($file, $dir=CF_TEMPLATE, $prefix='') { 
    7878  global $user, $template; 
    7979 
    80   $theme_file = $dir.$user['template'].'/'.$user['theme'].'/'.$file; 
    81   $template_file = $dir.$user['template'].'/'.$file; 
     80  $theme_file = $dir. 
     81                $user[$prefix.'template'].'/'. 
     82                $user[$prefix.'theme'].'/'. 
     83                $file; 
     84  $template_file = $dir. 
     85                   $user[$prefix.'template'].'/'. 
     86                   $file; 
    8287 
    8388  if (file_exists($theme_file)) 
  • extensions/ContactForm/include/contactform.css

    r3748 r3753  
    1717  padding: 5px; 
    1818} 
    19 .cf-label { 
    20         margin-top: 0; 
    21         font-size: larger; 
    22         text-align: center; 
    23   min-height: 40px; 
    24   margin-bottom: 5px; 
    25 } 
    26 .cf-lang { 
    27   display: none; 
    28   visibility: hidden; 
    29 } 
    3019.cf-log-infos, .cf-log-errors { 
    3120        font-weight: bold; 
  • extensions/ContactForm/include/contactform.js

    r3743 r3753  
    2626  } 
    2727} 
    28  
    29 function cf_set_visible(element, visible) { 
    30   var new_state, new_display; 
    31   if (visible) { 
    32     new_state = "visible"; 
    33     new_display = "block"; 
    34   } else { 
    35     new_state = "hidden"; 
    36     new_display = "none"; 
    37   } 
    38   element.style.visibility = new_state; 
    39   element.style.display = new_display; 
    40 } 
    41  
    42 function hideShowDiv(select_item) { 
    43  
    44   for (var i=0 ; i<select_item.length ; i++) { 
    45     var div_item = document.getElementById(select_item[i].value); 
    46     var visible = select_item[i].selected; 
    47     cf_set_visible(div_item, visible); 
    48   } 
    49   return; 
    50   if (lCheckBoxSelected.checked) { 
    51     lShowCB = false; 
    52     lShowDiv = true; 
    53   } 
    54   var i=0; 
    55   for (i=0 ; i<lCategories.length ; i++) { 
    56     if (lCategories[i].id != current_category && 
    57       lCategories[i].id.match(gCategoryPrefix)) { 
    58        
    59       setVisible(lCategories[i], lShowCB); 
    60     } 
    61   } 
    62   for (i=0 ; i<lInputs.length ; i++) { 
    63     if (lInputs[i].type == 'checkbox' && lInputs[i].name == gCBName) { 
    64       lCB.push(lInputs[i]); 
    65     } 
    66   } 
    67   for (i=0 ; i<lCB.length ; i++) { 
    68     if (lCB[i].id != lIdSelected) { 
    69       setVisible(document.getElementById(gListPrefix + lCB[i].value), lShowCB); 
    70       lCB[i].checked = false; 
    71     } 
    72   } 
    73   if (!lShowDiv) { 
    74     setVisible(gFormDetailsDiv, lShowDiv); 
    75     setVisible(gProductDetailsDiv, lShowDiv); 
    76     clearDiv(); 
    77   } else { 
    78     getParameters(productId); 
    79   } 
    80 } 
  • extensions/ContactForm/main.inc.php

    r3749 r3753  
    22/* 
    33 Plugin Name: Contact Form 
    4  Version: 1.0.3 
     4 Version: 1.0.4 
    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.4 
     14                    Update configuration pages 
    1215 
    1316  2009-08-18 1.0.3 
Note: See TracChangeset for help on using the changeset viewer.