CMS Tree Page View - Version 0.6.1

Version Description

  • Forgot to close a p-tag correctly. Now it should validate again!
  • Fixed a problem where move could seem to not work when trying to move pages when several pages had the same menu_order, so they where sorted by alpha instead.
  • fixed a problem with qtranslate that resulted in endless "loading tree..."
  • the thank you/need help/please donate-box is re-enabled upon upgrade/re-activation of the plugin. Just so you won't forget that you can donate! :)
Download this release

Release Info

Developer eskapism
Plugin Icon wp plugin CMS Tree Page View
Version 0.6.1
Comparing to
See all releases

Code changes from version 0.6 to 0.6.1

Files changed (3) hide show
  1. functions.php +24 -7
  2. index.php +5 -2
  3. readme.txt +6 -0
functions.php CHANGED
@@ -185,7 +185,7 @@ function cms_tpv_print_common_tree_stuff() {
185
  <span class='cms_tpv_action_add_page'><?php _e("Add page", "cms-tree-page-view")?></span>
186
  <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> |
187
  <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>
188
- </ul>
189
  <dl>
190
  <dt><?php _e("Last modified", "cms-tree-page-view") ?></dt>
191
  <dd><span id="cms_tpv_page_actions_modified_time"></span> <?php _e("by", "cms-tree-page-view") ?> <span id="cms_tpv_page_actions_modified_by"></span></dd>
@@ -210,7 +210,6 @@ function cms_tpv_pages_page() {
210
 
211
  <?php
212
  cms_tpv_show_annoying_box();
213
-
214
  cms_tpv_print_common_tree_stuff();
215
  ?>
216
  </div>
@@ -289,9 +288,10 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null) {
289
  }
290
 
291
  // modified time
292
- $post_modified_time = get_post_modified_time('U', false, $onePage, false);
 
293
  $post_modified_time = date_i18n(get_option('date_format'), $post_modified_time, false);
294
-
295
  // last edited by
296
  global $post;
297
  $tmpPost = $post;
@@ -561,11 +561,22 @@ function cms_tpv_move_page() {
561
 
562
  // post_node is placed before ref_post_node
563
 
564
- // update menu_order of all pages with a meny order more than or equal ref_node_post and with the same parent as ref_node_post
 
565
  $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE post_parent = %d", $post_ref_node->post_parent ) );
566
 
 
 
 
 
567
  // update menu_order of $post_node to the menu_order that ref_post_node had, and update post_parent to the same as ref_post
568
- $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = %d, post_parent = %d WHERE ID = %d", $post_ref_node->menu_order, $post_ref_node->post_parent, $post_node->ID ) );
 
 
 
 
 
 
569
 
570
  echo "did before";
571
 
@@ -608,7 +619,7 @@ function cms_tpv_show_annoying_box() {
608
  ?>
609
  <div id="cms_tpv_annoying_little_box">
610
  <p id="cms_tpv_annoying_little_box_close"><a href="<?php echo CMS_TPV_PAGE_FILE ?>&action=cms_tpv_remove_annoying_box">Close</a></p>
611
- <p><strong>Thank you for using my plugin!</strong> If you need help please check out the <a href="http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">plugin homepage</a> or the <a href="http://wordpress.org/tags/cms-tree-page-view?forum_id=10">support forum</a>.</p>
612
  <p>If you like this plugin, please <a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">support my work by donating</a> - or at least say something nice about this plugin in a blog post or tweet.</p>
613
  <!-- <p>Thank you</p>
614
  <p><img src="<?php echo CMS_TPV_URL ?>/images/signature.gif" alt="Pär Thernström's signature" /></p>
@@ -630,4 +641,10 @@ function bonny_d($var) {
630
  }
631
  }
632
 
 
 
 
 
 
 
633
  ?>
185
  <span class='cms_tpv_action_add_page'><?php _e("Add page", "cms-tree-page-view")?></span>
186
  <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> |
187
  <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>
188
+ </p>
189
  <dl>
190
  <dt><?php _e("Last modified", "cms-tree-page-view") ?></dt>
191
  <dd><span id="cms_tpv_page_actions_modified_time"></span> <?php _e("by", "cms-tree-page-view") ?> <span id="cms_tpv_page_actions_modified_by"></span></dd>
210
 
211
  <?php
212
  cms_tpv_show_annoying_box();
 
213
  cms_tpv_print_common_tree_stuff();
214
  ?>
215
  </div>
288
  }
289
 
290
  // modified time
291
+ #$post_modified_time = get_post_modified_time('U', false, $onePage, false);
292
+ $post_modified_time = strtotime($onePage->post_modified);
293
  $post_modified_time = date_i18n(get_option('date_format'), $post_modified_time, false);
294
+
295
  // last edited by
296
  global $post;
297
  $tmpPost = $post;
561
 
562
  // post_node is placed before ref_post_node
563
 
564
+ // update menu_order of all pages with a menu order more than or equal ref_node_post and with the same parent as ref_node_post
565
+ // we do this so there will be room for our page if it's the first page
566
  $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE post_parent = %d", $post_ref_node->post_parent ) );
567
 
568
+ // update menu order with +1 for all pages below ref_node, this should fix the problem with "unmovable" pages because of
569
+ // multiple pages with the same menu order (...which is not the fault of this plugin!)
570
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE menu_order => %d", $post_ref_node->menu_order) );
571
+
572
  // update menu_order of $post_node to the menu_order that ref_post_node had, and update post_parent to the same as ref_post
573
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = %d, post_parent = %d WHERE ID = %d", $post_ref_node->menu_order+1, $post_ref_node->post_parent, $post_node->ID ) );
574
+
575
+ #2 moved..
576
+
577
+ #2 home
578
+ #2 our products
579
+ #3 contact us <- ref
580
 
581
  echo "did before";
582
 
619
  ?>
620
  <div id="cms_tpv_annoying_little_box">
621
  <p id="cms_tpv_annoying_little_box_close"><a href="<?php echo CMS_TPV_PAGE_FILE ?>&action=cms_tpv_remove_annoying_box">Close</a></p>
622
+ <p><strong>Thank you for using this plugin!</strong> If you need help please check out the <a href="http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">plugin homepage</a> or the <a href="http://wordpress.org/tags/cms-tree-page-view?forum_id=10">support forum</a>.</p>
623
  <p>If you like this plugin, please <a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">support my work by donating</a> - or at least say something nice about this plugin in a blog post or tweet.</p>
624
  <!-- <p>Thank you</p>
625
  <p><img src="<?php echo CMS_TPV_URL ?>/images/signature.gif" alt="Pär Thernström's signature" /></p>
641
  }
642
  }
643
 
644
+
645
+ function cms_tpv_install() {
646
+ // after upgrading/re-enabling the plugin, also re-enable the little please-donate-box
647
+ update_option('cms_tpv_show_annoying_little_box', 1);
648
+ }
649
+
650
  ?>
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. By using the tree you can edit, view, add pages and even search pages (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.6
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -27,7 +27,7 @@ License: GPL2
27
 
28
  require("functions.php");
29
 
30
- define( "CMS_TPV_VERSION", "0.6");
31
  define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
32
  define( "CMS_TPV_NAME", "CMS Tree Page View");
33
 
@@ -44,4 +44,7 @@ add_action('wp_ajax_cms_tpv_get_childs', 'cms_tpv_get_childs');
44
  add_action('wp_ajax_cms_tpv_move_page', 'cms_tpv_move_page');
45
  add_action('wp_ajax_cms_tpv_add_page', 'cms_tpv_add_page');
46
 
 
 
 
47
  ?>
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. By using the tree you can edit, view, add pages and even search pages (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.6.1
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
27
 
28
  require("functions.php");
29
 
30
+ define( "CMS_TPV_VERSION", "0.6.1");
31
  define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
32
  define( "CMS_TPV_NAME", "CMS Tree Page View");
33
 
44
  add_action('wp_ajax_cms_tpv_move_page', 'cms_tpv_move_page');
45
  add_action('wp_ajax_cms_tpv_add_page', 'cms_tpv_add_page');
46
 
47
+ // activation
48
+ register_activation_hook( WP_PLUGIN_DIR . "/cms-tree-page-view/index.php" , 'cms_tpv_install' );
49
+
50
  ?>
readme.txt CHANGED
@@ -47,6 +47,12 @@ Now the tree with the pages will be visible both on the dashboard and in the men
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
50
  = 0.6 =
51
  - updated french translation
52
  - new box for mouse-over/pop-up - please let me know what you think about it
47
 
48
  == Changelog ==
49
 
50
+ = 0.6.1 =
51
+ - Forgot to close a p-tag correctly. Now it should validate again!
52
+ - Fixed a problem where move could seem to not work when trying to move pages when several pages had the same menu_order, so they where sorted by alpha instead.
53
+ - fixed a problem with qtranslate that resulted in endless "loading tree..."
54
+ - the thank you/need help/please donate-box is re-enabled upon upgrade/re-activation of the plugin. Just so you won't forget that you can donate! :)
55
+
56
  = 0.6 =
57
  - updated french translation
58
  - new box for mouse-over/pop-up - please let me know what you think about it