[ Index ]
 

Code source de Dotclear 2.0-beta6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/plugins/metadata/ -> tag_posts.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of DotClear.
   4  # Copyright (c) 2005 Olivier Meunier and contributors. All rights
   5  # reserved.
   6  #
   7  # DotClear is free software; you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation; either version 2 of the License, or
  10  # (at your option) any later version.
  11  # 
  12  # DotClear is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  # 
  17  # You should have received a copy of the GNU General Public License
  18  # along with DotClear; if not, write to the Free Software
  19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20  #
  21  # ***** END LICENSE BLOCK *****
  22  if (!defined('DC_CONTEXT_ADMIN')) { exit; }
  23  
  24  $tag = !empty($_REQUEST['tag']) ? $_REQUEST['tag'] : '';
  25  
  26  $this_url = $p_url.'&amp;m=tag_posts&amp;tag='.rawurlencode($tag);
  27  
  28  $meta = new dcMeta($core);
  29  
  30  $page = !empty($_GET['page']) ? $_GET['page'] : 1;
  31  $nb_per_page =  30;
  32  
  33  # Rename a meta
  34  if (!empty($_POST['new_meta_id']))
  35  {
  36      $new_id = dcMeta::sanitizeMetaID($_POST['new_meta_id']);
  37      try {
  38          if ($meta->updateMeta($tag,$new_id,'tag')) {
  39              http::redirect($p_url.'&m=tag_posts&tag='.$new_id.'&renamed=1');
  40          }
  41      } catch (Exception $e) {
  42          $core->error->add($e->getMessage());
  43      }
  44  }
  45  
  46  $params = array();
  47  $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
  48  $params['no_content'] = true;
  49  
  50  $params['meta_id'] = $tag;
  51  $params['meta_type'] = 'tag';
  52  
  53  # Get posts
  54  try {
  55      $posts = $meta->getPostsByMeta($params);
  56      $counter = $meta->getPostsByMeta($params,true);
  57      $post_list = new adminPostList($core,$posts,$counter->f(0));
  58  } catch (Exception $e) {
  59      $core->error->add($e->getMessage());
  60  }
  61  
  62  # Actions combo box
  63  $combo_action = array();
  64  if ($core->auth->check('publish,contentadmin',$core->blog->id))
  65  {
  66      $combo_action[__('publish')] = 'publish';
  67      $combo_action[__('unpublish')] = 'unpublish';
  68      $combo_action[__('schedule')] = 'schedule';
  69      $combo_action[__('mark as pending')] = 'pending';
  70  }
  71  if ($core->auth->check('delete,contentadmin',$core->blog->id))
  72  {
  73      $combo_action[__('delete')] = 'delete';
  74  }
  75  $combo_action[__('add tags')] = 'tags';
  76  
  77  ?>
  78  <html>
  79  <head>
  80    <title>Tags</title>
  81    <link rel="stylesheet" type="text/css" href="index.php?pf=metadata/style.css" />
  82    <script type="text/javascript" src="js/_posts_list.js"></script>
  83  </head>
  84  <body>
  85  
  86  <h2><?php echo html::escapeHTML($core->blog->name); ?> &gt;
  87  <?php echo __('Edit tag'); ?></h2>
  88  
  89  <?php
  90  if (!empty($_GET['renamed'])) {
  91      echo '<p class="message">'.__('Tag has been successfully renamed').'</p>';
  92  }
  93  
  94  echo '<p><a href="'.$p_url.'&amp;m=tags">'.__('Back to tags list').'</a></p>';
  95  
  96  if (!$core->error->flag())
  97  {
  98      if (!$posts->isEmpty())
  99      {
 100          echo
 101          '<form action="'.$this_url.'" method="post">'.
 102          '<p><label class="classic">'.__('Rename this tag:').' '.
 103          form::field('new_meta_id',20,255,html::escapeHTML($tag)).
 104          '</label> <input type="submit" value="'.__('save').'" /></p>'.
 105          '</form>';
 106      }
 107      
 108      # Show posts
 109      $post_list->display($page,$nb_per_page,
 110      '<form action="posts_actions.php" method="post" id="form-entries">'.
 111      
 112      '%s'.
 113      
 114      '<div class="two-cols">'.
 115      '<p class="col checkboxes-helpers"></p>'.
 116      
 117      '<p class="col right">'.__('Selected entries action:').
 118      dcPage::help('posts','p_actions').
 119      form::combo('action',$combo_action).
 120      '<input type="submit" value="'.__('ok').'" /></p>'.
 121      form::hidden('redir',$p_url.'&amp;m=tag_posts&amp;tag='.
 122          str_replace('%','%%',rawurlencode($tag)).'&amp;page='.$page).
 123      '</div>'.
 124      '</form>');
 125  }
 126  ?>
 127  </body>
 128  </html>


Généré le : Fri Feb 23 22:16:06 2007 par Balluche grâce à PHPXref 0.7