Dotclear

Changeset 584


Ignore:
Timestamp:
12/08/08 19:12:59 (14 years ago)
Author:
vincent
google:author:
forxer
Message:
  • permission
  • validation XHTML
Location:
plugins/acronyms/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • plugins/acronyms/trunk/_admin.php

    r583 r584  
    1616$_menu['Blog']->addItem(__('Acronyms Manager'),'plugin.php?p=acronyms','index.php?pf=acronyms/icon.png', 
    1717          preg_match('/plugin.php\?p=acronyms(&.*)?$/',$_SERVER['REQUEST_URI']), 
    18           $core->auth->check('usage,contentadmin',$core->blog->id)); 
     18          $core->auth->check('acronyms',$core->blog->id)); 
     19 
     20$core->auth->setPermissionType('acronyms',__('manage acronyms')); 
    1921 
    2022$core->addBehavior('coreInitWikiPost',array('acronymsBehaviors','coreInitWikiPost')); 
     
    2931 
    3032          $core->wiki2xhtml->setOpt('acronyms_file',$acronyms->file); 
    31           $core->wiki2xhtml->acro_table = $core->wiki2xhtml->__getAcronyms(); 
     33          $core->wiki2xhtml->acro_table = $acronyms->getList(); 
    3234     } 
    3335} 
  • plugins/acronyms/trunk/_define.php

    r583 r584  
    1616     /* Description*/         "Add, remove and modify acronyms for the wiki syntax.", 
    1717     /* Author */             "Vincent Garnier", 
    18      /* Version */            '0.1', 
    19      /* Permissions */        'usage,contentadmin' 
     18     /* Version */            '0.2', 
     19     /* Permissions */        'acronyms' 
    2020); 
    21 ?> 
  • plugins/acronyms/trunk/index.php

    r583 r584  
    1919 
    2020# modfication de la liste des acronymes 
    21 if (isset($_POST['p_edit'])) 
     21if (!empty($_POST['p_edit'])) 
    2222{ 
    23      $post_array = array_map('trim', $_POST); 
     23     $p_acronyms = !empty($_POST['p_acronyms']) && is_array($_POST['p_acronyms']) ? array_map('trim', $_POST['p_acronyms']) : array(); 
    2424 
    2525     $acronyms_list = array(); 
    26      foreach ($post_array as $nk=>$nv) 
     26     foreach ($p_acronyms as $nk=>$nv) 
    2727     { 
    28           $prefix = substr($nk, 0, 8); 
    29           if (($prefix == 'acronym_') && ($nv != '')) { 
    30                $acronyms_list[substr($nk, 8)] = $nv; 
     28          if ($nv != '') { 
     29               $acronyms_list[$nk] = $nv; 
     30          } 
     31          else { 
     32               unset($acronyms_list[$nk]); 
    3133          } 
    3234     } 
     
    4446          $a_acro = !empty($_POST['a_acro']) ? trim($_POST['a_acro']) : ''; 
    4547          $a_title = !empty($_POST['a_title']) ? trim($_POST['a_title']) : ''; 
    46       
     48 
    4749          if ($a_acro == '') { 
    4850               throw new Exception(__('You must give an acronym')); 
    4951          } 
    50       
     52 
    5153          if ($a_title == '') { 
    5254               throw new Exception(__('You must give a title')); 
    5355          } 
    54       
     56 
    5557          if (isset($acronyms_list[$a_acro])) { 
    5658               throw new Exception(__('This acronym already exists')); 
    5759          } 
    58            
     60 
    5961          $acronyms_list[$a_acro] = $a_title; 
    6062          ksort($acronyms_list); 
    61       
     63 
    6264          $acronyms->writeFile($acronyms_list); 
    6365          http::redirect($p_url.'&added=1'); 
     
    9799          <p class="acroleft"><label for="a_acro"><?php echo __('Acronym'); ?></label> 
    98100          <?php echo form::field('a_acro',10,'',$a_acro,'',''); ?></p> 
    99       
     101 
    100102          <p class="acroright"><label for="a_title"><?php echo __('Title'); ?></label> 
    101103          <?php echo form::field('a_title',60,'',$a_title,'',''); ?></p> 
     
    113115          <div id="listacro"> 
    114116          <?php 
     117          $i = 1; 
    115118          foreach ($acronyms_list as $k=>$v) 
    116119          { 
    117120               echo 
    118121               '<p class="field">'."\n". 
    119                '<label for="acronym_'.$k.'"><acronym title="'.$v.'">'.html::escapeHTML($k).'</acronym></label>'."\n". 
    120                form::field('acronym_'.$k,60,'',html::escapeHTML($v))."\n". 
     122               '<label for="acronym_'.$i.'"><acronym title="'.$v.'">'.html::escapeHTML($k).'</acronym></label>'."\n". 
     123               form::field(array('p_acronyms['.$k.']','acronym_'.$i),60,'',html::escapeHTML($v))."\n". 
    121124               '</p>'."\n\n"; 
     125 
     126               ++$i; 
    122127          } 
    123128          ?> 
     129          </div><!-- #listacro --> 
    124130          </fieldset> 
    125131          <p class="clear"><?php echo form::hidden('p_edit', '1'); 
  • plugins/acronyms/trunk/locales/fr/main.po

    r583 r584  
    44msgid "Add, remove and modify acronyms for the wiki syntax." 
    55msgstr "Ajouter, supprimer et modifier les acromymes pour la syntaxe wiki." 
     6 
     7msgid "manage acronyms" 
     8msgstr "gérer les acronymes" 
    69 
    710msgid "Add an acronym" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map