Dotclear

source: plugins/tags/tag_posts.php @ 1553:e42635c9dc4a

Revision 1553:e42635c9dc4a, 4.9 KB checked in by Anne Kozlika <kozlika@…>, 11 years ago (diff)

Replace class="message" by class="success" where it is needed.

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_CONTEXT_ADMIN')) { return; }
13
14$tag = (!empty($_REQUEST['tag']) || $_REQUEST['tag'] == '0') ? $_REQUEST['tag'] : '';
15
16$this_url = $p_url.'&amp;m=tag_posts&amp;tag='.rawurlencode($tag);
17
18
19$page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1;
20$nb_per_page =  30;
21
22# Rename a tag
23if (!empty($_POST['new_tag_id']) || $_POST['new_tag_id'] == '0')
24{
25     $new_id = dcMeta::sanitizeMetaID($_POST['new_tag_id']);
26     try {
27          if ($core->meta->updateMeta($tag,$new_id,'tag')) {
28               http::redirect($p_url.'&m=tag_posts&tag='.$new_id.'&renamed=1');
29          }
30     } catch (Exception $e) {
31          $core->error->add($e->getMessage());
32     }
33}
34
35# Delete a tag
36if (!empty($_POST['delete']) && $core->auth->check('publish,contentadmin',$core->blog->id))
37{
38     try {
39          $core->meta->delMeta($tag,'tag');
40          http::redirect($p_url.'&m=tags&del=1');
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$params['post_type'] = '';
53
54# Get posts
55try {
56     $posts = $core->meta->getPostsByMeta($params);
57     $counter = $core->meta->getPostsByMeta($params,true);
58     $post_list = new adminPostList($core,$posts,$counter->f(0));
59} catch (Exception $e) {
60     $core->error->add($e->getMessage());
61}
62
63# Actions combo box
64$combo_action = array();
65if ($core->auth->check('publish,contentadmin',$core->blog->id))
66{
67     $combo_action[__('Status')] = array(
68          __('Publish') => 'publish',
69          __('Unpublish') => 'unpublish',
70          __('Schedule') => 'schedule',
71          __('Mark as pending') => 'pending'
72     );
73}
74$combo_action[__('Mark')] = array(
75     __('Mark as selected') => 'selected',
76     __('Mark as unselected') => 'unselected'
77);
78$combo_action[__('Change')] = array(__('Change category') => 'category');
79if ($core->auth->check('admin',$core->blog->id))
80{
81     $combo_action[__('Change')] = array_merge($combo_action[__('Change')],
82          array(__('Change author') => 'author'));
83}
84if ($core->auth->check('delete,contentadmin',$core->blog->id))
85{
86     $combo_action[__('Delete')] = array(__('Delete') => 'delete');
87}
88
89# --BEHAVIOR-- adminPostsActionsCombo
90$core->callBehavior('adminPostsActionsCombo',array(&$combo_action));
91
92?>
93<html>
94<head>
95  <title><?php echo __('Tags'); ?></title>
96  <link rel="stylesheet" type="text/css" href="index.php?pf=tags/style.css" />
97  <script type="text/javascript" src="js/_posts_list.js"></script>
98  <script type="text/javascript">
99  //<![CDATA[
100  dotclear.msg.confirm_tag_delete = '<?php echo html::escapeJS(sprintf(__('Are you sure you want to remove this %s?'),'tag')) ?>';
101  $(function() {
102    $('#tag_delete').submit(function() {
103      return window.confirm(dotclear.msg.confirm_tag_delete);
104    });
105  });
106  //]]>
107  </script>
108</head>
109<body>
110
111<?php
112echo dcPage::breadcrumb(
113     array(
114          html::escapeHTML($core->blog->name) => '',
115          __('Tags') => $p_url.'&amp;m=tags',
116          '<span class="page-title">'.__('Tag').' &ldquo;'.html::escapeHTML($tag).'&rdquo;'.'</span>' => ''
117     ));
118?>
119
120<?php
121if (!empty($_GET['renamed'])) {
122     dcPage::success(__('Tag has been successfully renamed'));
123}
124
125echo '<p><a class="back" href="'.$p_url.'&amp;m=tags">'.__('Back to tags list').'</a></p>';
126
127if (!$core->error->flag())
128{
129     if (!$posts->isEmpty())
130     {
131          echo
132          '<div class="fieldset">'.
133          '<form action="'.$this_url.'" method="post">'.
134          '<h3>'.__('Actions').'</h3>'.
135          '<p><label for="new_tag_id">'.__('Edit tag name:').'</label>'.
136          form::field('new_tag_id',20,255,html::escapeHTML($tag)).
137          '<input type="submit" value="'.__('Rename').'" />'.
138          $core->formNonce().
139          '</p></form>';
140          # Remove tag
141          if (!$posts->isEmpty() && $core->auth->check('contentadmin',$core->blog->id)) {
142               echo
143               '<form id="tag_delete" action="'.$this_url.'" method="post">'.
144               '<p>'.__('Delete this tag:').' '.
145               '<input type="submit" class="delete" name="delete" value="'.__('Delete').'" />'.
146               $core->formNonce().
147               '</p></form>';
148          }
149          echo '</div>';
150     }
151     
152     # Show posts
153     echo '<h3>'.sprintf(__('List of entries with the tag “%s”'),html::escapeHTML($tag)).'</h3>';
154     $post_list->display($page,$nb_per_page,
155     '<form action="posts_actions.php" method="post" id="form-entries">'.
156     
157     '%s'.
158     
159     '<div class="two-cols">'.
160     '<p class="col checkboxes-helpers"></p>'.
161     
162     '<p class="col right"><label for="action" class="classic">'.__('Selected entries action:').'</label> '.
163     form::combo('action',$combo_action).
164     '<input type="submit" value="'.__('OK').'" /></p>'.
165     form::hidden('post_type','').
166     form::hidden('redir',$p_url.'&amp;m=tag_posts&amp;tag='.
167          str_replace('%','%%',rawurlencode($tag)).'&amp;page='.$page).
168     $core->formNonce().
169     '</div>'.
170     '</form>');
171}
172?>
173</body>
174</html>
Note: See TracBrowser for help on using the repository browser.

Sites map