Changeset 4174 for extensions


Ignore:
Timestamp:
Nov 2, 2009, 11:31:49 PM (14 years ago)
Author:
ddtddt
Message:

[extensions] meta - Correction bug:1227 - feature:1128 - add description FR

Location:
extensions/meta
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/meta/admin/admin.php

    r3978 r4174  
    11<?php
    2 
    32if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    43global $template, $conf, $user;
     
    1312
    1413//-------------------------------------------------------- sections definitions
     14
     15//Gestion MAJ
     16$majm='meta 2.0.5';
     17$query = '
     18select param,value
     19        FROM ' . CONFIG_TABLE . '
     20  WHERE param = \''.$majm.'\'
     21        ;';
     22$result = pwg_query($query);
     23
     24$row = mysql_fetch_array($result);
     25$majparam=$row['param'];
     26$majvalue=$row['value'];
     27
     28if (!$majvalue==1 and !is_adviser())
     29        {
     30$maj = 'maj';
     31$template->assign(
     32        $maj,
     33        array(
     34          'meta'=>l10n('meta_name'),
     35          ));
     36if (isset($_POST['maj']) and !is_adviser())
     37                {
     38    global $prefixeTable;
     39if (!defined('meta_img_TABLE')) define('meta_img_TABLE', $prefixeTable.'meta_img');
     40        $query = "CREATE TABLE IF NOT EXISTS ". meta_img_TABLE ." (
     41id SMALLINT( 5 ) UNSIGNED NOT NULL ,
     42metaKeyimg VARCHAR( 255 ) NOT NULL ,
     43PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
     44        $result = pwg_query($query);
     45
     46if (!defined('meta_cat_TABLE')) define('meta_cat_TABLE', $prefixeTable.'meta_cat');     
     47        $query = "CREATE TABLE IF NOT EXISTS ". meta_cat_TABLE ." (
     48id SMALLINT( 5 ) UNSIGNED NOT NULL ,
     49metaKeycat VARCHAR( 255 ) NOT NULL ,
     50PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
     51        $result = pwg_query($query);
     52
     53        $query = '
     54select id
     55  FROM ' . CATEGORIES_TABLE . '
     56  ORDER BY id DESC;';
     57$result = pwg_query($query);
     58$row = mysql_fetch_array($result);
     59
     60$comp=$row['id']+1;     
     61$i=1;
     62
     63        while($i < $comp)
     64{
     65        $query = '
     66select id,metaKeywords
     67  FROM ' . CATEGORIES_TABLE . '
     68  WHERE id = \''.$i.'\'';
     69$result = pwg_query($query);
     70$row = mysql_fetch_array($result);
     71
     72                if(!$row['id']==0 and !$row['metaKeywords']==0)
     73                {
     74        $query = '
     75INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat)VALUES ('.$row['id'].',"'.$row['metaKeywords'].'");';
     76        $result = pwg_query($query);
     77                }
     78        ++$i;
     79}
     80       
     81        $query = ' ALTER TABLE '. CATEGORIES_TABLE .' DROP COLUMN `metaKeywords`';
     82    pwg_query($query);
     83       
     84        $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'.$majm.'",1,"MAJ meta");';
     85    pwg_query($query);
     86                array_push($page['infos'], l10n('meta_majt'));
     87        $majvalue==1;
     88                $maj =0;
     89                }
     90        }
     91        else{
     92
    1593// Gestion des onglets
    1694if (!isset($_GET['tab']))
     
    26104               l10n('meta_onglet_categorie'),
    27105               $my_base_url.'&amp;tab=categorie');
     106$tabsheet->add('image',
     107               l10n('meta_onglet_image'),
     108               $my_base_url.'&amp;tab=image');
    28109$tabsheet->add('description',
    29110               l10n('meta_onglet_description'),
     
    105186
    106187    break;
     188
    107189// Onglet gestion des meta categorie
    108190  case 'categorie':
     
    142224$lire=$_POST['metacat'];
    143225        $query = '
    144 select id,name,metaKeywords
     226select id,name
    145227  FROM ' . CATEGORIES_TABLE . '
    146228  WHERE id = \''.$lire.'\'
     
    151233$idcat=$row['id'];
    152234$chnamecat=$row['name'];
    153 $chvalcat=$row['metaKeywords'];
     235
     236$query = '
     237select id,metaKeycat
     238  FROM ' . meta_cat_TABLE . '
     239  WHERE id = \''.$lire.'\'
     240  ;';
     241$result = pwg_query($query);
     242$row = mysql_fetch_array($result);
     243$idmetaKeycat=$row['id'];
     244$chvalcat=$row['metaKeycat'];
    154245
    155246  $selected3 = 0;
     
    169260        {
    170261        $query = '
    171 UPDATE ' . CATEGORIES_TABLE . '
    172   SET metaKeywords= \''.$_POST['inser'].'\'
     262DELETE
     263  FROM ' . meta_cat_TABLE . '
    173264  WHERE id = \''.$_POST['invisible'].'\'
    174     ;';
    175 $result = pwg_query($query);
     265  ;';
     266$result = pwg_query($query);
     267        $q = '
     268INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat)VALUES ('.$_POST['invisible'].',"'.$_POST['inser'].'");';
     269    pwg_query($q);
    176270        }
    177271 
    178272    break;
     273
     274// Onglet gestion des meta keywords images
     275  case 'image':
     276
     277//charge la liste des images
     278$groups = array();
     279$query = '
     280select id,name
     281  FROM ' . IMAGES_TABLE . '
     282  ORDER BY id ASC;';
     283$result = pwg_query($query);
     284
     285while ($row = mysql_fetch_array($result))
     286        {
     287  $groups[$row['id']] = $row['id'].' : '.$row['name'];
     288        }
     289       
     290        $selected = 0;
     291        $options[] = l10n('meta_selecti3');
     292        $options['a'] = '----------------------';
     293       
     294foreach($groups as $listid => $listid2)
     295        {
     296    $options[$listid] = $listid2;
     297        }
     298  $template->assign(
     299    'gestionC',
     300    array(
     301          'OPTIONS' => $options,
     302      'SELECTED' => $selected
     303      ));
     304       
     305//edit de la meta l'image
     306if (isset($_POST['submitchoiximg'])and is_numeric($_POST['metaimg']) and (!$_POST['metaimg'])==0 and !is_adviser())
     307        {
     308$lire=$_POST['metaimg'];
     309        $query = '
     310select id,name
     311  FROM ' . IMAGES_TABLE . '
     312  WHERE id = \''.$lire.'\'
     313  ;';
     314$result = pwg_query($query);
     315
     316$row = mysql_fetch_array($result);
     317$idimg=$row['id'];
     318$chnameimg=$row['name'];
     319
     320$query = '
     321select id,metaKeyimg
     322  FROM ' . meta_img_TABLE . '
     323  WHERE id = \''.$lire.'\'
     324  ;';
     325$result = pwg_query($query);
     326$row = mysql_fetch_array($result);
     327$idmetaKeyimg=$row['id'];
     328$chvalimg=$row['metaKeyimg'];
     329
     330  $selected3 = 0;
     331 
     332  $template->assign(
     333    'img_edit',
     334    array(
     335      'VALUE' => $idimg,
     336          'VALUEN' => $chnameimg,
     337      'CONTENT' => $chvalimg,
     338      'SELECTED' => $selected3
     339      ));
     340        }
     341
     342//insértion de meta img dans la table img
     343if (isset($_POST['submitinsimg']) and !is_adviser())
     344        {
     345        $query = '
     346DELETE
     347  FROM ' . meta_img_TABLE . '
     348  WHERE id = \''.$_POST['invisible'].'\'
     349  ;';
     350$result = pwg_query($query);
     351        $q = '
     352INSERT INTO ' . $prefixeTable . 'meta_img(id,metaKeyimg)VALUES ('.$_POST['invisible'].',"'.$_POST['inser'].'");';
     353    pwg_query($q);
     354        }
     355       
     356    break;
     357
    179358// Onglet  description
    180359  case 'description':
     
    187366          ));
    188367        break;
     368       
    189369}
    190 
     370}
    191371$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl'));
    192372$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
  • extensions/meta/admin/admin.tpl

    r3978 r4174  
    22  <h2>meta</h2>
    33</div>
    4 
     4{if isset ($maj)}
     5                <form method="post" >
     6                        <div style="text-align:center;">
     7                                <input class="submit" name="maj" type="submit" value="{'meta_maj'|@translate}" {$TAG_INPUT_ENABLED} />
     8                        </div>
     9                </form>
     10{/if}
    511{if isset ($gestionA)}
    612                  <h3>{'meta_desh3'|@translate}</h3>
     
    7076        {/if}
    7177{/if}
    72 
     78{if isset ($gestionC)}
     79          <h3>{'meta_img'|@translate}</h3>
     80        <div>
     81                <form method="post" >
     82                        <fieldset>
     83                                <legend>{'meta_selectimg'|@translate}</legend>
     84                                {'meta_listimg'|@translate}     
     85                {html_options name="metaimg" options=$gestionC.OPTIONS selected=$gestionC.SELECTED}
     86                                <br>   
     87                                <br>
     88                                        <div style="text-align:center;">
     89                                        <input class="submit" name="submitchoiximg" type="submit" value="{'meta_choiximg'|@translate}" {$TAG_INPUT_ENABLED} />
     90                                        </div>
     91                        </fieldset>
     92                </form>
     93        </div>
     94        {if isset ($img_edit)}
     95        <div>
     96                <form method="post" >
     97                        <fieldset>
     98                                <legend>{'meta_compimg'|@translate}</legend>
     99                                        <input type="hidden" name="invisible" value="{$img_edit.VALUE}">
     100                                        id&nbsp;:&nbsp;{$img_edit.VALUE}&nbsp;->&nbsp;{$img_edit.VALUEN}&nbsp;&nbsp;<input type="text" name="inser" value="{$img_edit.CONTENT}" size="110" maxlenght="110">
     101                                <br>   
     102                                <br>
     103                                        <div style="text-align:center;">
     104                                        <input class="submit" name="submitinsimg" type="submit" value="{'meta_inscat'|@translate}" {$TAG_INPUT_ENABLED} />
     105                                        </div>
     106                        </fieldset>
     107                </form>
     108        </div>
     109        {/if}
     110{/if}
    73111{if isset ($description)}
    74112        <div class="comment">
     
    89127        </div>
    90128{/if}
     129{if isset ($MAJ)}
     130        <div class="comment">
     131                <div style="text-align:center;">
     132                <input class="submit" name="submitMAJ" type="submit" value="{'meta_onglet_maj'|@translate}" {$TAG_INPUT_ENABLED} />
     133                </div> 
     134        </div>
     135{/if}
  • extensions/meta/language/en_UK/plugin.lang.php

    r3978 r4174  
    1616//onglet description categorie
    1717$lang['meta_onglet_categorie'] = 'Categorie\'s Metadata';
    18 $lang['meta_cath3'] = 'Add meta keywords to the categories';
    19 $lang['meta_select3'] = 'Select the category';
    20 $lang['meta_selectcat'] = 'Select the name of the category to be edit';
     18$lang['meta_cath3'] = 'Add meta keywords to categories';
     19$lang['meta_select3'] = 'Select category';
     20$lang['meta_selectcat'] = 'Select name of category to be edit';
    2121$lang['meta_listcat'] = 'List categories :';
    22 $lang['meta_choixcat'] = 'Edit the category';
    23 $lang['meta_compcat'] = 'Keywords of the category to be completed';
     22$lang['meta_choixcat'] = 'Edit categorie\'s Metadata';
     23$lang['meta_compcat'] = 'Keywords of category to be completed';
    2424$lang['meta_inscat'] = 'Insert Keywords into the base ';
     25
     26//onglet image
     27$lang['meta_onglet_image'] = 'Picture\'s Metadata';
     28$lang['meta_img'] = 'Add meta keywords to picture';
     29$lang['meta_selectimg'] = 'Select name of picture to be edit';
     30$lang['meta_listimg'] = 'List Picture';
     31$lang['meta_choiximg'] = 'Edit Picture\'s Metadata';
     32$lang['meta_selecti3'] = 'Select Picture';
     33$lang['meta_compimg'] = 'Keywords of picture to be completed';
    2534
    2635//onglet description
     
    4554';
    4655
    47 
     56//upgrade
     57$lang['meta_maj'] = 'Upgrade';
     58$lang['meta_majt'] = 'Upgrade Complete<br>Please click on the menu meta to return to management plugin';
    4859
    4960
  • extensions/meta/language/fr_FR/plugin.lang.php

    r3978 r4174  
    1414$lang['meta_insmeta'] = 'inserer la metadonnée dans la table';
    1515
    16 //onglet description categorie
     16//onglet categorie
    1717$lang['meta_onglet_categorie'] = 'Metadonnée des Catégories';
    1818$lang['meta_cath3'] = 'Ajouter des meta keywords aux catégories';
    1919$lang['meta_select3'] = 'Sélectionnez la catégorie';
    20 $lang['meta_selectcat'] = 'Sélectionnez le nom de la catégorie à éditer';
     20$lang['meta_selectcat'] = 'Sélectionnez le nom de la catégorie pour la méta keywords  à éditer';
    2121$lang['meta_listcat'] = 'Liste des catégories :';
    22 $lang['meta_choixcat'] = 'Éditer la catégorie';
     22$lang['meta_choixcat'] = 'Éditer la Metadonnée de la catégorie';
    2323$lang['meta_compcat'] = 'Mots clés de la catégorie à complèter';
    2424$lang['meta_inscat'] = 'Insérer les Mots clés dans la base';
     25
     26//onglet image
     27$lang['meta_onglet_image'] = 'Metadonnée des images';
     28$lang['meta_img'] = 'Ajouter des meta keywords aux images';
     29$lang['meta_selectimg'] = 'Sélectionnez le nom de l\'image pour la méta keywords  à éditer';
     30$lang['meta_listimg'] = 'Liste des images';
     31$lang['meta_choiximg'] = 'Éditer la Metadonnée de l\'image';
     32$lang['meta_selecti3'] = 'Sélectionnez l\'image';
     33$lang['meta_compimg'] = 'Mots clés de l\'image à complèter';
    2534
    2635//onglet description
     
    4554';
    4655
     56//upgrade
     57$lang['meta_maj'] = 'Mise à jour';
     58$lang['meta_majt'] = 'Mise à jour terminée<br> Faites un clic sur le menu meta pour revenir à la gestion du plugin';
    4759
    4860
  • extensions/meta/main.inc.php

    r3978 r4174  
    22/*
    33Plugin Name: meta
    4 Version: 2.0.0.c
     4Version: 2.0.5
    55Description: Allows to add metadata
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=220
     
    1616define('meta_PATH' , PHPWG_PLUGINS_PATH . meta_DIR . '/');
    1717define('meta_TABLE' , $prefixeTable . 'meta');
     18define('meta_img_TABLE' , $prefixeTable . 'meta_img');
     19define('meta_cat_TABLE' , $prefixeTable . 'meta_cat');
    1820
    1921add_event_handler('get_admin_plugin_menu_links', 'meta_admin_menu');
     
    8284
    8385  //meta categories
    84   if ( !empty($page['category']['name']) )   
     86  if ( !empty($page['category']['id']) )   
    8587  {
    86     $page['category']['info'] = get_cat_info($page['category']['id']);
    87     $page['category']['name'] = $page['category']['info']['name'];
    8888
    8989    $query = '
    90     select id,name,metakeywords,comment
    91       FROM ' . CATEGORIES_TABLE . '
     90    select id,metaKeycat
     91      FROM ' . meta_cat_TABLE . '
    9292      WHERE id = \''.$page['category']['id'].'\'
    9393      ;';
    9494    $result = pwg_query($query);
    9595    $row = mysql_fetch_array($result);
    96     if (!empty($row['metakeywords']))
     96    if (!empty($row['metaKeycat']))
    9797    {
    98       $template->append('related_tags', array('name' => $row['metakeywords']));
     98      $template->append('related_tags', array('name' => $row['metaKeycat']));
     99    }
     100  }
     101
     102
     103  //meta images
     104  if ( !empty($page['image_id']) )   
     105  {
     106    $query = '
     107    select id,metaKeyimg
     108      FROM ' . meta_img_TABLE . '
     109      WHERE id = \''.$page['image_id'].'\'
     110      ;';
     111    $result = pwg_query($query);
     112    $row = mysql_fetch_array($result);
     113    if (!empty($row['metaKeyimg']))
     114    {
     115      $template->append('related_tags', array('name' => $row['metaKeyimg']));
    99116    }
    100117  }
    101118}
    102 
    103119
    104120add_event_handler('loc_after_page_header', 'set_meta_back');
  • extensions/meta/maintain.inc.php

    r3978 r4174  
    22
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     4
     5$majm='meta 2.0.5';
    46
    57function plugin_install()
     
    2729    pwg_query($q);
    2830       
    29                 $q = '
     31        $q = '
    3032INSERT INTO ' . $prefixeTable . 'meta(id,metaname,metaval,metatype)VALUES (4,"robots","follow","name");';
    3133    pwg_query($q);
    3234
    33         $q = '
    34 ALTER TABLE '. CATEGORIES_TABLE.' ADD COLUMN `metaKeywords` VARCHAR( 255 )';   
    35     pwg_query($q);
     35if (!defined('meta_img_TABLE')) define('meta_img_TABLE', $prefixeTable.'meta_img');
     36        $query = "CREATE TABLE IF NOT EXISTS ". meta_img_TABLE ." (
     37id SMALLINT( 5 ) UNSIGNED NOT NULL ,
     38metaKeyimg VARCHAR( 255 ) NOT NULL ,
     39PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
     40        $result = pwg_query($query);
     41
     42if (!defined('meta_cat_TABLE')) define('meta_cat_TABLE', $prefixeTable.'meta_cat');     
     43        $query = "CREATE TABLE IF NOT EXISTS ". meta_cat_TABLE ." (
     44id SMALLINT( 5 ) UNSIGNED NOT NULL ,
     45metaKeycat VARCHAR( 255 ) NOT NULL ,
     46PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
     47        $result = pwg_query($query);
    3648       
     49        $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'.$majm.'",1,"MAJ meta");';
     50    pwg_query($query); 
    3751}
    3852
     
    4458    pwg_query($q);
    4559
    46         $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="meta" LIMIT 1;';
     60        $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="'.$majm.'" LIMIT 1;';
    4761    pwg_query($q);
    4862       
    49         $q = ' ALTER TABLE '. CATEGORIES_TABLE .' DROP COLUMN `metaKeywords`';
    50         pwg_query( $q );
     63        $q = 'DROP TABLE ' . $prefixeTable . 'meta_img;';
     64    pwg_query($q);
     65
     66        $q = 'DROP TABLE ' . $prefixeTable . 'meta_cat;';
     67    pwg_query($q);
    5168}
    5269
Note: See TracChangeset for help on using the changeset viewer.