Version Description
- Added: You can now show the tree for regular posts. Appearently there are som plugins that use the hierarchy on posts.
- Fixed: The capability required to show the tree for a post type should now be correct. Previously it was hard-coded to "edit_pages". Thanks to Kevin Behrens, author of plugin Role Scoper, for solving this.
Download this release
Release Info
Developer | eskapism |
Plugin | CMS Tree Page View |
Version | 0.8 |
Comparing to | |
See all releases |
Code changes from version 0.7.20 to 0.8
- functions.php +23 -6
- index.php +2 -2
- readme.txt +5 -1
functions.php
CHANGED
@@ -36,6 +36,8 @@ function cms_tpv_admin_head() {
|
|
36 |
|
37 |
function cms_tpv_admin_init() {
|
38 |
|
|
|
|
|
39 |
wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
|
40 |
wp_enqueue_style( "jquery-alerts", CMS_TPV_URL . "styles/jquery.alerts.css", false, CMS_TPV_VERSION );
|
41 |
wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.biscuit.js", array("jquery")); // renamed from cookie to fix problems with mod_security
|
@@ -134,11 +136,12 @@ function cms_tpv_admin_menu() {
|
|
134 |
$slug = "edit.php?post_type=$one_menu_post_type";
|
135 |
}
|
136 |
$post_type_object = get_post_type_object($one_menu_post_type);
|
137 |
-
|
|
|
138 |
}
|
139 |
|
140 |
add_submenu_page( 'options-general.php' , CMS_TPV_NAME, CMS_TPV_NAME, "administrator", "cms-tpv-options", "cms_tpv_options");
|
141 |
-
|
142 |
}
|
143 |
|
144 |
|
@@ -189,7 +192,9 @@ foreach ($posts as $one_post) {
|
|
189 |
|
190 |
if ($name == "post") {
|
191 |
// no support for pages. you could show them.. but since we can't reorder them there is not idea to show them.. or..?
|
192 |
-
|
|
|
|
|
193 |
}
|
194 |
|
195 |
if ($one_post_type->show_ui) {
|
@@ -251,6 +256,18 @@ function cms_tpv_get_selected_post_type() {
|
|
251 |
return $post_type;
|
252 |
}
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
/**
|
255 |
* Print tree stuff that is common for both dashboard and page
|
256 |
*/
|
@@ -293,7 +310,7 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
|
|
293 |
|
294 |
<div class="cms_tpv_wrapper">
|
295 |
<input type="hidden" name="cms_tpv_meta_post_type" value="<?php echo $post_type ?>" />
|
296 |
-
<input type="hidden" name="cms_tpv_meta_post_type_hierarchical" value="<?php echo (int) $post_type_object
|
297 |
<input type="hidden" name="cms_tpv_meta_wpml_language" value="<?php echo $wpml_current_lang ?>" />
|
298 |
<?php
|
299 |
|
@@ -346,7 +363,7 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
|
|
346 |
<li><a class="cms_tvp_view_trash <?php echo ($cms_tpv_view=="trash") ? "current" : "" ?>" href="#"><?php _e("Trash", 'cms-tree-page-view') ?></a></li>
|
347 |
|
348 |
<?php
|
349 |
-
if ($post_type_object
|
350 |
?>
|
351 |
<li><a href="#" class="cms_tpv_open_all"><?php _e("Expand", 'cms-tree-page-view') ?></a> |</li>
|
352 |
<li><a href="#" class="cms_tpv_close_all"><?php _e("Collapse", 'cms-tree-page-view') ?></a></li>
|
@@ -389,7 +406,7 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
|
|
389 |
<a href="#" title='<?php _e("Add new page after", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_after'><?php _e("After", "cms-tree-page-view")?></a>
|
390 |
<?php
|
391 |
// if post type is hierarchical we can add pages inside
|
392 |
-
if ($post_type_object
|
393 |
?> | <a href="#" title='<?php _e("Add new page inside", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_inside'><?php _e("Inside", "cms-tree-page-view")?></a><?php
|
394 |
}
|
395 |
// if post status = draft then we can not add pages inside because wordpress currently can not keep its parent if we edit the page
|
36 |
|
37 |
function cms_tpv_admin_init() {
|
38 |
|
39 |
+
// @todo: only load these when we do show a tree, ie. on the dashboard or showing the tree for a post type
|
40 |
+
// see: http://devpress.com/blog/how-to-load-javascript-in-the-wordpress-admin/
|
41 |
wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
|
42 |
wp_enqueue_style( "jquery-alerts", CMS_TPV_URL . "styles/jquery.alerts.css", false, CMS_TPV_VERSION );
|
43 |
wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.biscuit.js", array("jquery")); // renamed from cookie to fix problems with mod_security
|
136 |
$slug = "edit.php?post_type=$one_menu_post_type";
|
137 |
}
|
138 |
$post_type_object = get_post_type_object($one_menu_post_type);
|
139 |
+
// print_r($post_type_object);
|
140 |
+
add_submenu_page($slug, $post_type_object->labels->name . " Tree View", $post_type_object->labels->name . " Tree View", $post_type_object->cap->edit_posts, "cms-tpv-page-$one_menu_post_type", "cms_tpv_pages_page");
|
141 |
}
|
142 |
|
143 |
add_submenu_page( 'options-general.php' , CMS_TPV_NAME, CMS_TPV_NAME, "administrator", "cms-tpv-options", "cms_tpv_options");
|
144 |
+
|
145 |
}
|
146 |
|
147 |
|
192 |
|
193 |
if ($name == "post") {
|
194 |
// no support for pages. you could show them.. but since we can't reorder them there is not idea to show them.. or..?
|
195 |
+
// 14 jul 2011: ok, let's enable it for posts too. some people says it useful
|
196 |
+
// http://wordpress.org/support/topic/this-plugin-should-work-also-on-posts
|
197 |
+
// continue;
|
198 |
}
|
199 |
|
200 |
if ($one_post_type->show_ui) {
|
256 |
return $post_type;
|
257 |
}
|
258 |
|
259 |
+
/**
|
260 |
+
* Determine if a post type is considered hierarchical
|
261 |
+
*/
|
262 |
+
function cms_tpv_is_post_type_hierarchical($post_type_object) {
|
263 |
+
$is_hierarchical = $post_type_object->hierarchical;
|
264 |
+
// special case for posts, fake-support hierachical
|
265 |
+
if ("post" == $post_type_object->name) {
|
266 |
+
$is_hierarchical = true;
|
267 |
+
}
|
268 |
+
return $is_hierarchical;
|
269 |
+
}
|
270 |
+
|
271 |
/**
|
272 |
* Print tree stuff that is common for both dashboard and page
|
273 |
*/
|
310 |
|
311 |
<div class="cms_tpv_wrapper">
|
312 |
<input type="hidden" name="cms_tpv_meta_post_type" value="<?php echo $post_type ?>" />
|
313 |
+
<input type="hidden" name="cms_tpv_meta_post_type_hierarchical" value="<?php echo (int) cms_tpv_is_post_type_hierarchical($post_type_object) ?>" />
|
314 |
<input type="hidden" name="cms_tpv_meta_wpml_language" value="<?php echo $wpml_current_lang ?>" />
|
315 |
<?php
|
316 |
|
363 |
<li><a class="cms_tvp_view_trash <?php echo ($cms_tpv_view=="trash") ? "current" : "" ?>" href="#"><?php _e("Trash", 'cms-tree-page-view') ?></a></li>
|
364 |
|
365 |
<?php
|
366 |
+
if (cms_tpv_is_post_type_hierarchical($post_type_object)) {
|
367 |
?>
|
368 |
<li><a href="#" class="cms_tpv_open_all"><?php _e("Expand", 'cms-tree-page-view') ?></a> |</li>
|
369 |
<li><a href="#" class="cms_tpv_close_all"><?php _e("Collapse", 'cms-tree-page-view') ?></a></li>
|
406 |
<a href="#" title='<?php _e("Add new page after", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_after'><?php _e("After", "cms-tree-page-view")?></a>
|
407 |
<?php
|
408 |
// if post type is hierarchical we can add pages inside
|
409 |
+
if (cms_tpv_is_post_type_hierarchical($post_type_object)) {
|
410 |
?> | <a href="#" title='<?php _e("Add new page inside", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_inside'><?php _e("Inside", "cms-tree-page-view")?></a><?php
|
411 |
}
|
412 |
// if post status = draft then we can not add pages inside because wordpress currently can not keep its parent if we edit the page
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: CMS Tree Page View
|
4 |
Plugin URI: http://eskapism.se/code-playground/cms-tree-page-view/
|
5 |
Description: Adds a CMS-like tree view of all your pages, like the view often found in a page-focused CMS. Use the tree you to edit, view, add pages and search pages (very useful if you have many pages). And with drag and drop you can rearrange the order of your pages. Page management won't get any easier than this!
|
6 |
-
Version: 0.
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
@@ -28,7 +28,7 @@ License: GPL2
|
|
28 |
#require("functions.php");
|
29 |
require(dirname(__FILE__)."/functions.php");
|
30 |
|
31 |
-
define( "CMS_TPV_VERSION", "0.
|
32 |
define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
|
33 |
define( "CMS_TPV_NAME", "CMS Tree Page View");
|
34 |
|
3 |
Plugin Name: CMS Tree Page View
|
4 |
Plugin URI: http://eskapism.se/code-playground/cms-tree-page-view/
|
5 |
Description: Adds a CMS-like tree view of all your pages, like the view often found in a page-focused CMS. Use the tree you to edit, view, add pages and search pages (very useful if you have many pages). And with drag and drop you can rearrange the order of your pages. Page management won't get any easier than this!
|
6 |
+
Version: 0.8
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
28 |
#require("functions.php");
|
29 |
require(dirname(__FILE__)."/functions.php");
|
30 |
|
31 |
+
define( "CMS_TPV_VERSION", "0.8");
|
32 |
define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
|
33 |
define( "CMS_TPV_NAME", "CMS Tree Page View");
|
34 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
|
|
4 |
Tags: page, pages, posts, custom posts, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Adds a tree of all your pages or custom posts. Use drag & drop to reorder your pages, and edit, view, add, and search your pages.
|
10 |
|
@@ -82,6 +82,10 @@ Now the tree with the pages will be visible both on the dashboard and in the men
|
|
82 |
|
83 |
== Changelog ==
|
84 |
|
|
|
|
|
|
|
|
|
85 |
= 0.7.20 =
|
86 |
* Changed caller_get_posts (deprecated since 3.1) to ignore_sticky_posts
|
87 |
* Norwegian translation added by Eigil Moe (http://www.eimoe.com)
|
4 |
Tags: page, pages, posts, custom posts, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 0.8
|
8 |
|
9 |
Adds a tree of all your pages or custom posts. Use drag & drop to reorder your pages, and edit, view, add, and search your pages.
|
10 |
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= 0.8 =
|
86 |
+
- Added: You can now show the tree for regular posts. Appearently there are som plugins that use the hierarchy on posts.
|
87 |
+
- Fixed: The capability required to show the tree for a post type should now be correct. Previously it was hard-coded to "edit_pages". Thanks to Kevin Behrens, author of plugin Role Scoper, for solving this.
|
88 |
+
|
89 |
= 0.7.20 =
|
90 |
* Changed caller_get_posts (deprecated since 3.1) to ignore_sticky_posts
|
91 |
* Norwegian translation added by Eigil Moe (http://www.eimoe.com)
|