Changeset 22769


Ignore:
Timestamp:
May 20, 2013, 7:29:15 PM (11 years ago)
Author:
ddtddt
Message:

[extensions] - meta - add metadata personal on all public page

Location:
extensions/meta
Files:
1 added
7 edited

Legend:

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

    r21161 r22769  
    1313//-------------------------------------------------------- sections definitions
    1414
    15 // Gestion des onglets
     15// TAB gest
    1616if (!isset($_GET['tab']))
    1717    $page['tab'] = 'gestion';
     
    2323               l10n('meta_onglet_gestion'),
    2424               $my_base_url.'&tab=gestion');
     25$tabsheet->add('Personal Meta',
     26               l10n('Personal Metadata'),
     27               $my_base_url.'&tab=persometa');
    2528$tabsheet->add('description',
    2629               l10n('meta_onglet_description'),
     
    2932$tabsheet->assign();
    3033
    31 // Onglet gestion des meta
     34// Tab gest
    3235switch ($page['tab'])
    3336{
    3437  case 'gestion':
    3538
    36 //charge la liste des meta
     39//read metadata list
    3740$groups = array();
    3841$query = '
     
    6467
    6568
    66 //edit de meta
     69//edit meta
    6770if (isset($_POST['submitchoixmeta']) and is_numeric($_POST['metalist']) and (!$_POST['metalist'])==0 and !is_adviser())
    6871        {
     
    9093        }
    9194
    92 //insértion de meta dans la table
    93 if (isset($_POST['submitinsmeta']) and !is_adviser())
     95//inser metadata in table
     96if (isset($_POST['submitinsmeta']))
    9497        {
    9598        $query = '
     
    103106    break;
    104107
    105 // Onglet  description
     108//description TAB
    106109  case 'description':
    107110
     
    113116          ));
    114117        break;
     118
     119// TAB personnal metadata
     120  case 'persometa':
     121
     122  $template->assign(
     123        'metapersoT',
     124        array(
     125          'meta'=>l10n('meta_name'),
     126          ));
     127$admin_base_url = $my_base_url.'&tab=persometa';
     128$metapersos = pwg_query("SELECT * FROM `". METAPERSO_TABLE .";");
     129
     130if (pwg_db_num_rows($metapersos)) {     
     131 while ($metaperso = pwg_db_fetch_assoc($metapersos))
     132        {
     133    $items = array(
     134      'METANAME' => $metaperso['metaname'],
     135      'METAVAL' => $metaperso['metaval'],
     136      'METATYPE' => $metaperso['metatype'],
     137          'U_DELETE' => $admin_base_url.'&delete='.$metaperso['id'],
     138      'U_EDIT' => $admin_base_url.'&edit='.$metaperso['id'],
     139                );
     140               
     141        $template->append('metapersos', $items);
     142        }
     143}
     144 if (isset($_POST['submitaddpersonalmeta']))
     145        {
     146          $template->assign(
     147        'meta_edit2',
     148        array(
     149          'meta'=>l10n('meta_name'),
     150          'METAID' => 0,
     151          ));
     152        }
     153
     154 if (isset($_POST['submitaddmetaperso']))
     155        {
     156                $query = '
     157DELETE
     158  FROM ' . METAPERSO_TABLE . '
     159  WHERE id = '.$_POST['invisibleID'].'
     160  ;';
     161$result = pwg_query($query);
     162       
     163       
     164        $q = '
     165INSERT INTO ' . $prefixeTable . 'metaperso(metaname,metaval,metatype)VALUES ("'.$_POST['insername'].'","'.$_POST['inserval'].'","'.$_POST['insertype'].'");';
     166    pwg_query($q);
     167        $_SESSION['page_infos'] = array(l10n('Personal metadata update'));
     168        redirect($admin_base_url); 
     169        }
     170       
     171          if (isset($_GET['edit']))
     172  {
     173    check_input_parameter('edit', $_GET, false, PATTERN_ID);
     174
     175                $query = '
     176select id,metaname,metaval,metatype
     177  FROM ' . METAPERSO_TABLE . '
     178  WHERE id = \''.$_GET['edit'].'\'
     179  ;';
     180$result = pwg_query($query);
     181$row = pwg_db_fetch_assoc($result);     
     182  $template->assign(
     183    'meta_edit2',
     184    array(
     185      'METAID' => $row['id'],
     186          'METANAME' => $row['metaname'],
     187      'METAVAL' => $row['metaval'],
     188      'METATYPE' => $row['metatype'],
     189      ));       
     190       
     191  }
     192               
     193        if (isset($_GET['delete']))
     194{
     195  check_input_parameter('delete', $_GET, false, PATTERN_ID);
     196 
     197  $query = '
     198DELETE
     199  FROM '.METAPERSO_TABLE.'
     200  WHERE id = '.$_GET['delete'].'
     201;';
     202  pwg_query($query);
     203 
     204  $_SESSION['page_infos'] = array(l10n('Personal metadata update'));
     205  redirect($admin_base_url);
     206}
     207       
     208       
     209        break;
     210
    115211       
    116212}
  • extensions/meta/admin/admin.tpl

    r9406 r22769  
    5454        </div>
    5555{/if}
    56 {if isset ($MAJ)}
    57         <div class="comment">
    58                 <div style="text-align:center;">
    59                 <input class="submit" name="submitMAJ" type="submit" value="{'meta_onglet_maj'|@translate}" {$TAG_INPUT_ENABLED} />
    60                 </div> 
    61         </div>
     56{if isset ($metapersoT)}
     57                <form method="post" >
     58                        <fieldset>
     59                        <input class="submit" name="submitaddpersonalmeta" type="submit" value="{'Add Personal metadata'|@translate}" {$TAG_INPUT_ENABLED} />
     60                        </fieldset>
     61                </form>
     62                <form method="post" >
     63                        <fieldset>
     64                                <legend>{'List Personal Metadata'|@translate}</legend>
     65  {foreach from=$metapersos item=metaperso}
     66          < meta {$metaperso.METATYPE}="{$metaperso.METANAME}" content="{$metaperso.METAVAL}">
     67      <a href="{$metaperso.U_EDIT}">
     68        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" alt="{'edit'|@translate}" title="{'edit'|@translate}" />
     69      </a>
     70      <a href="{$metaperso.U_DELETE}" onclick="return confirm( document.getElementById('btn_delete').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
     71        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" id="btn_delete" alt="{'delete'|@translate}" title="{'Delete'|@translate}" />
     72      </a>
     73        <br>
     74  {/foreach}
     75                        </fieldset>
     76                </form>
     77        {if isset ($meta_edit2)}
     78                <form method="post" >
     79                        <fieldset>
     80                                <legend>{'Personnal metadata'|@translate}</legend>
     81                                <input type="hidden" name="invisibleID" value="{$meta_edit2.METAID}">
     82                                < meta <input type="text" name="insertype" value="{$meta_edit2.METATYPE}" size="30" maxlenght="30"> ="<input type="text" name="insername" value="{$meta_edit2.METANAME}" size="30" maxlenght="30">" content="<input type="text" name="inserval" value="{$meta_edit2.METAVAL}" size="60" maxlenght="100">">
     83                                <br>   
     84                                <br>
     85                                        <div style="text-align:center;">
     86                                        <input class="submit" name="submitaddmetaperso" type="submit" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED} />
     87                                        </div>
     88                        </fieldset>
     89                </form>
     90        {/if}
    6291{/if}
  • extensions/meta/initadmin.php

    r21161 r22769  
    77function meta_admin_menu($menu)
    88{
     9  load_language('plugin.lang', meta_PATH);
    910  array_push($menu, array(
    10                 'NAME' => 'Meta',
     11        'NAME' => l10n('Manage tag Metadata'),
    1112    'URL' => get_admin_plugin_menu_link(meta_PATH . 'admin/admin.php')));
    1213  return $menu;
  • extensions/meta/language/en_UK/plugin.lang.php

    r10233 r22769  
    11<?php
     2
     3$lang['Manage tag Metadata'] = 'Manage tag Metadata';
    24
    35//tab gest
     
    2628$lang['meta_onglet_description'] = 'Description Metadata';
    2729$lang['meta_author'] = 'Description meta author';
    28 $lang['meta_author_help'] = 'Information on the author <br>
    29 Information on the author of the site ';
     30$lang['meta_author_help'] = 'Information on the author <br> Information on the author of the site ';
    3031$lang['meta_keywords'] = 'Description meta keywords';
    31 $lang['meta_keywords_help'] = '"Keyword, keyword, etc."<br>
    32 Keywords describing the web page. (Separated by a comma)';
     32$lang['meta_keywords_help'] = '"Keyword, keyword, etc."<br> Keywords describing the web page. (Separated by a comma)';
    3333$lang['meta_Description'] = 'Description meta Description';
    34 $lang['meta_Description_help'] = 'Description of your site<br>
    35 Allows to give an information to post during the result of a search';
     34$lang['meta_Description_help'] = 'Description of your site<br> Allows to give an information to post during the result of a search';
    3635$lang['meta_robots'] = 'Description meta robots';
    37 $lang['meta_robots_help'] = '
    38 all : Allows the robot to reference all the page (by default)<br>
    39 follow : Allows the robot to follow the links of the page<br>
    40 index : Allows the robot to index the page<br>
    41 nofollow : Forbidden the robot to follow the links<br>
    42 noindex : Forbidden the robot to index the page<br>
    43 none : Prevent the robot from pursuing the indexation of the site<br>
    44 ';
     36$lang['meta_robots_help'] = 'all : Allows the robot to reference all the page (by default)<br> follow : Allows the robot to follow the links of the page<br> index : Allows the robot to index the page<br> nofollow : Forbidden the robot to follow the links<br> noindex : Forbidden the robot to index the page<br> none : Prevent the robot from pursuing the indexation of the site<br>';
     37
     38//tab personal meta
     39$lang['Personal Metadata'] = 'Personal Metadata';
     40$lang['Personal metadata update'] = 'Personal metadata update';
     41$lang['Add Personal metadata'] = 'Add Personal metadata';
     42$lang['List Personal Metadata'] = 'List Personal Metadata';
     43
    4544?>
  • extensions/meta/language/fr_FR/plugin.lang.php

    r10233 r22769  
    11<?php
     2
     3$lang['Manage tag Metadata'] = 'Gèrer balises Metadonnées';
    24
    35//tab gest
     
    2628$lang['meta_onglet_description'] = 'Description des Metadonnées';
    2729$lang['meta_author'] = 'Description de meta author';
    28 $lang['meta_author_help'] = 'Informations sur l\'auteur<br>
    29 Informations sur l\'auteur du site';
     30$lang['meta_author_help'] = 'Informations sur l\'auteur<br> Informations sur l\'auteur du site';
    3031$lang['meta_keywords'] = 'Description de meta keywords';
    31 $lang['meta_keywords_help'] = '"mot clé, mot clé, etc."<br>
    32 Mots clés décrivant la page Web.(séparé par une virgule)';
     32$lang['meta_keywords_help'] = '"mot clé, mot clé, etc."<br> Mots clés décrivant la page Web.(séparé par une virgule)';
    3333$lang['meta_Description'] = 'Description de meta Description';
    34 $lang['meta_Description_help'] = 'Description de votre site<br>
    35 Permet de donner une information à afficher lors du résultat d\'une recherche.';
     34$lang['meta_Description_help'] = 'Description de votre site<br> Permet de donner une information à afficher lors du résultat d\'une recherche.';
    3635$lang['meta_robots'] = 'Description de meta robots';
    37 $lang['meta_robots_help'] = '
    38 all : Permet au robot de référencer toute la page (par défaut)<br>
    39 follow : Permet au robot de suivre les liens de la page<br>
    40 index : Permet au robot d\'indexer la page<br>
    41 nofollow : Interdit au robot de suivre les liens<br>
    42 noindex : Interdit au robot d\'indexer la page<br>
    43 none : Empêche le robot de poursuivre l\'indexation du site<br>
    44 ';
     36$lang['meta_robots_help'] = 'all : Permet au robot de référencer toute la page (par défaut)<br> follow : Permet au robot de suivre les liens de la page<br> index : Permet au robot d\'indexer la page<br> nofollow : Interdit au robot de suivre les liens<br> noindex : Interdit au robot d\'indexer la page<br> none : Empêche le robot de poursuivre l\'indexation du site<br> ';
     37
     38//tab personal meta
     39$lang['Personal Metadata'] = 'Metadonnées Personels';
     40$lang['Personal metadata update'] = 'Metadonnées Personels Misent à jours';
     41$lang['Add Personal metadata'] = 'Ajoutez des Metadonnées Personels';
     42$lang['List Personal Metadata'] = 'Liste des Metadonnées Personels';
     43
    4544
    4645?>
  • extensions/meta/main.inc.php

    r21161 r22769  
    1818define('meta_img_TABLE' , $prefixeTable . 'meta_img');
    1919define('meta_cat_TABLE' , $prefixeTable . 'meta_cat');
     20define('METAPERSO_TABLE', $prefixeTable.'metaperso');
    2021
    2122  // Plugin for admin
     
    110111    $template->append('head_elements', '<meta name="robots" content="'.$meta['robots'].'">');
    111112        }
    112 
     113       
     114        //Metaperso
     115        if (script_basename() !== 'admin')   
     116{
     117$metapersos = pwg_query("SELECT * FROM `". METAPERSO_TABLE .";");
     118
     119if (pwg_db_num_rows($metapersos)) {     
     120 while ($metaperso = pwg_db_fetch_assoc($metapersos))
     121        {
     122    $items = array(
     123      'METANAME' => $metaperso['metaname'],
     124      'METAVAL' => $metaperso['metaval'],
     125      'METATYPE' => $metaperso['metatype']
     126                );
     127               
     128        $template->append('metapersos', $items);
     129        }
     130       
     131
     132}
     133       
     134        $template->set_filename('PERSO_META', realpath(meta_PATH.'persometa.tpl'));     
     135        $template->append('head_elements', $template->parse('PERSO_META', true));
     136}       
     137       
    113138 }
    114139function add_metacat()
  • extensions/meta/maintain.inc.php

    r21161 r22769  
    1111                define('meta_img_TABLE' , $prefixeTable . 'meta_img');
    1212                define('meta_cat_TABLE' , $prefixeTable . 'meta_cat');
     13                define('METAPERSO_TABLE', $prefixeTable.'metaperso');
     14
     15        $query = "CREATE TABLE IF NOT EXISTS ". METAPERSO_TABLE ." (
     16id SMALLINT( 5 ) UNSIGNED NOT NULL auto_increment,
     17metaname VARCHAR( 255 ) NOT NULL ,
     18metaval lONGTEXT NOT NULL ,
     19metatype VARCHAR( 255 ) NOT NULL ,
     20PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
     21        $result = pwg_query($query);
    1322               
    1423//Gestion MAJ2
     
    156165PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
    157166        $result = pwg_query($query);
     167       
     168if (!defined('METAPERSO_TABLE')) define('METAPERSO_TABLE', $prefixeTable.'metaperso');
     169        $query = "CREATE TABLE IF NOT EXISTS ". METAPERSO_TABLE ." (
     170id SMALLINT( 5 ) UNSIGNED NOT NULL auto_increment,
     171metaname VARCHAR( 255 ) NOT NULL ,
     172metaval lONGTEXT NOT NULL ,
     173metatype VARCHAR( 255 ) NOT NULL ,
     174PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
     175        $result = pwg_query($query);
    158176
    159177        $majm1='meta 2.0.5';
Note: See TracChangeset for help on using the changeset viewer.