CMS Tree Page View - Version 0.9

Version Description

  • Only output scripts and styles on pages that the plugin uses. This should speed up other parts of the WordPress admin a little tiny itsy bitsy bit.
  • Added a hopefully not to spammy box about donation and stuff. Hopefully it it encourages some of you to give it a good review or maybe even donate some money. I've spent a lot, lot, LOT of time developing this plugin you know ;)
  • Changed title on dashboard widgets and changed name of the menu item under each supported post type. Makes the titles/names look/feel a bit less dorky.
  • Show icons next to the headline of top of pages with the tree
  • Minor CSS changes like a little bit bigger text on the pages and a bit more spacing between each page. Makes a bit easier to drag and drop/move them around.
  • Changed javascript to to use on() istead on live()
  • Removed hoverIntent since that is included in WordPress by default
  • Started using hoverIndent to make the popup with page actions show after a short while for each page. This also means that you can move outside the actions-pop-up for a short while without the pop up being closed - a thing that annoyed me very much. This makes the whole popup actions div thingie feels less in-your-face all the time. Hope you like it as much as I do!
Download this release

Release Info

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

Code changes from version 0.8.14 to 0.9

functions.php CHANGED
@@ -6,6 +6,8 @@
6
 
7
  function cms_tpv_admin_head() {
8
 
 
 
9
  global $cms_tpv_view;
10
  if (isset($_GET["cms_tpv_view"])) {
11
  $cms_tpv_view = htmlspecialchars($_GET["cms_tpv_view"]);
@@ -34,47 +36,85 @@ function cms_tpv_admin_head() {
34
  <?php
35
  }
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  function cms_admin_enqueue_scripts() {
38
 
39
- wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.biscuit.js", array("jquery")); // renamed from cookie to fix problems with mod_security
40
- wp_enqueue_script( "jquery-jstree", CMS_TPV_URL . "scripts/jquery.jstree.js", false, CMS_TPV_VERSION);
41
- wp_enqueue_script( "jquery-alerts", CMS_TPV_URL . "scripts/jquery.alerts.js", false, CMS_TPV_VERSION);
42
- wp_enqueue_script( "jquery-hoverintent", CMS_TPV_URL . "scripts/jquery.hoverIntent.minified.js", false, CMS_TPV_VERSION);
43
- #wp_enqueue_script( "jquery-ui-dialog", CMS_TPV_URL . "scripts/jquery.ui.dialog.min.js", false, CMS_TPV_VERSION);
44
- wp_enqueue_script( "cms_tree_page_view", CMS_TPV_URL . "scripts/cms_tree_page_view.js", false, CMS_TPV_VERSION);
45
-
46
- // @todo: only load these when we do show a tree, ie. on the dashboard or showing the tree for a post type
47
- // see: http://devpress.com/blog/how-to-load-javascript-in-the-wordpress-admin/
48
- // admin_enqueue_scripts-hook?
49
- wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
50
- wp_enqueue_style( "jquery-alerts", CMS_TPV_URL . "styles/jquery.alerts.css", false, CMS_TPV_VERSION );
51
-
52
- $oLocale = array(
53
- "Enter_title_of_new_page" => __("Enter title of new page", 'cms-tree-page-view'),
54
- "child_pages" => __("child pages", 'cms-tree-page-view'),
55
- "Edit_page" => __("Edit page", 'cms-tree-page-view'),
56
- "View_page" => __("View page", 'cms-tree-page-view'),
57
- "Edit" => __("Edit", 'cms-tree-page-view'),
58
- "View" => __("View", 'cms-tree-page-view'),
59
- "Add_page" => __("Add page", 'cms-tree-page-view'),
60
- "Add_new_page_after" => __("Add new page after", 'cms-tree-page-view'),
61
- "after" => __("after", 'cms-tree-page-view'),
62
- "inside" => __("inside", 'cms-tree-page-view'),
63
- "Can_not_add_sub_page_when_status_is_draft" => __("Sorry, can't create a sub page to a page with status \"draft\".", 'cms-tree-page-view'),
64
- "Can_not_add_sub_page_when_status_is_trash" => __("Sorry, can't create a sub page to a page with status \"trash\".", 'cms-tree-page-view'),
65
- "Can_not_add_page_after_when_status_is_trash" => __("Sorry, can't create a page after a page with status \"trash\".", 'cms-tree-page-view'),
66
- "Add_new_page_inside" => __("Add new page inside", 'cms-tree-page-view'),
67
- "Status_draft" => __("draft", 'cms-tree-page-view'),
68
- "Status_future" => __("future", 'cms-tree-page-view'),
69
- "Status_password" => __("protected", 'cms-tree-page-view'), // is "protected" word better than "password" ?
70
- "Status_pending" => __("pending", 'cms-tree-page-view'),
71
- "Status_private" => __("private", 'cms-tree-page-view'),
72
- "Status_trash" => __("trash", 'cms-tree-page-view'),
73
- "Password_protected_page" => __("Password protected page", 'cms-tree-page-view'),
74
- "Adding_page" => __("Adding page...", 'cms-tree-page-view'),
75
- );
76
- wp_localize_script( "cms_tree_page_view", 'cmstpv_l10n', $oLocale);
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  }
80
 
@@ -96,22 +136,11 @@ function cms_tpv_save_settings() {
96
  $options["menu"] = (array) $_POST["post-type-menu"];
97
  update_option('cms_tpv_options', $options); // enable this to show box
98
  }
99
- /*
100
- [post-type-dashboard] => Array
101
- (
102
- [0] => post
103
- [1] => page
104
- )
105
-
106
- [post-type-menu] => Array
107
- (
108
- [0] => post
109
- [1] => page
110
- )
111
-
112
- */
113
  }
114
 
 
 
 
115
  function cms_tpv_wp_dashboard_setup() {
116
  // add dashboard to capability edit_pages only
117
  if (current_user_can("edit_pages")) {
@@ -119,7 +148,8 @@ function cms_tpv_wp_dashboard_setup() {
119
  foreach ($options["dashboard"] as $one_dashboard_post_type) {
120
  $post_type_object = get_post_type_object($one_dashboard_post_type);
121
  $new_func_name = create_function('', "cms_tpv_dashboard('$one_dashboard_post_type');");
122
- wp_add_dashboard_widget( "cms_tpv_dashboard_widget_{$one_dashboard_post_type}", $post_type_object->labels->name . " Tree View", $new_func_name );
 
123
  }
124
  }
125
  }
@@ -129,7 +159,7 @@ function cms_tpv_wp_dashboard_setup() {
129
  * Output on dashboard
130
  */
131
  function cms_tpv_dashboard($post_type = "") {
132
- // cms_tpv_show_annoying_box();
133
  cms_tpv_print_common_tree_stuff($post_type);
134
  }
135
 
@@ -145,8 +175,10 @@ function cms_tpv_admin_menu() {
145
  $slug = "edit.php?post_type=$one_menu_post_type";
146
  }
147
  $post_type_object = get_post_type_object($one_menu_post_type);
148
- // print_r($post_type_object);
149
- 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");
 
 
150
  }
151
 
152
  add_submenu_page( 'options-general.php' , CMS_TPV_NAME, CMS_TPV_NAME, "administrator", "cms-tpv-options", "cms_tpv_options");
@@ -159,31 +191,11 @@ function cms_tpv_admin_menu() {
159
  */
160
  function cms_tpv_options() {
161
 
162
- /*
163
- // Just som testing stuff
164
- $args = array(
165
- "numberposts" => "-1",
166
- "orderby" => "menu_order",
167
- "order" => "ASC",
168
- "caller_get_posts" => 1, // get sticky posts in natural order (or so I understand it anyway)
169
- "post_status" => "publish", // "any" seems to get all but auto-drafts
170
- "post_type" => "page"
171
- );
172
- $posts = get_pages($args); // works
173
- // $posts = get_posts($args); // does not work
174
- var_dump($posts);
175
- echo "num of posts: " . sizeof($posts);
176
- foreach ($posts as $one_post) {
177
- #bonny_d($one_post);
178
- echo "<br><br>title: " . esc_html($one_post->post_title);
179
- echo "<br>status: " . $one_post->post_status;
180
- echo "<br>type: " . $one_post->post_type;
181
- }
182
- // */
183
-
184
  ?>
185
  <div class="wrap">
186
 
 
 
187
  <h2><?php echo CMS_TPV_NAME ?> <?php _e("settings", 'cms-tree-page-view') ?></h2>
188
 
189
  <form method="post" action="options.php">
@@ -257,7 +269,7 @@ function cms_tpv_get_selected_post_type() {
257
  }
258
  if (!$post_type) {
259
  // no post type, happens with ozh admin drop down, so get it via page instead
260
- $page = $_GET["page"];
261
  $post_type = str_replace("cms-tpv-page-", "", $page);
262
  }
263
 
@@ -405,9 +417,14 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
405
 
406
  <div style="clear: both;"></div>
407
 
 
408
  <div class="cms_tpv_page_actions">
409
- <p>
410
- <a href="#" title='<?php _e("Edit page", "cms-tree-page-view")?>' class='cms_tpv_action_edit'><?php _e("Edit", "cms-tree-page-view")?></a> |
 
 
 
 
411
  <a href="#" title='<?php _e("View page", "cms-tree-page-view")?>' class='cms_tpv_action_view'><?php _e("View", "cms-tree-page-view")?></a>
412
  </p>
413
  <p class="cms_tpv_action_add_and_edit_page">
@@ -416,7 +433,7 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
416
  <?php
417
  // if post type is hierarchical we can add pages inside
418
  if (cms_tpv_is_post_type_hierarchical($post_type_object)) {
419
- ?> | <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
420
  }
421
  // if post status = draft then we can not add pages inside because wordpress currently can not keep its parent if we edit the page
422
  ?>
@@ -451,10 +468,14 @@ function cms_tpv_pages_page() {
451
 
452
  $post_type = cms_tpv_get_selected_post_type();
453
  $post_type_object = get_post_type_object($post_type);
454
-
455
  ?>
456
  <div class="wrap">
457
- <h2><?php echo ($post_type_object->labels->name); ?> Tree View</h2>
 
 
 
 
458
 
459
  <?php
460
  /*
@@ -599,6 +620,9 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $po
599
 
600
  global $post;
601
 
 
 
 
602
  #cms_tpv_firedebug(timer_stop());
603
 
604
  ?>[<?php
@@ -727,6 +751,7 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $po
727
  "post_id": "<?php echo $onePage->ID ?>",
728
  "post_type": "<?php echo $onePage->post_type ?>",
729
  "post_status": "<?php echo $onePage->post_status ?>",
 
730
  "rel": "<?php echo $rel ?>",
731
  "childCount": <?php echo ( !empty( $arrChildPages ) ) ? sizeof( $arrChildPages ) : 0 ; ?>,
732
  "permalink": "<?php echo htmlspecialchars_decode(get_permalink($onePage->ID)) ?>",
@@ -734,7 +759,8 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $po
734
  "modified_time": "<?php echo $post_modified_time ?>",
735
  "modified_author": "<?php echo $post_author ?>",
736
  "columns": <?php echo $str_columns ?>,
737
- "user_can_edit_page": "<?php echo (int) $user_can_edit_page ?>"
 
738
  }
739
  <?php
740
  // if id is in $arrOpenChilds then also output children on this one
@@ -1043,7 +1069,9 @@ function cms_tpv_move_page() {
1043
  * Show a box with some dontate-links and stuff
1044
  */
1045
  function cms_tpv_show_annoying_box() {
1046
- #update_option('cms_tpv_show_annoying_little_box', 1); // enable this to show box
 
 
1047
  if ( isset($_GET["action"]) && "cms_tpv_remove_annoying_box" == $_GET["action"] ) {
1048
  $show_box = 0;
1049
  update_option('cms_tpv_show_annoying_little_box', $show_box);
@@ -1053,9 +1081,28 @@ function cms_tpv_show_annoying_box() {
1053
  if ($show_box) {
1054
  ?>
1055
  <div class="cms_tpv_annoying_little_box">
1056
- <p class="cms_tpv_annoying_little_box_close"><a href="<?php echo add_query_arg("action", "cms_tpv_remove_annoying_box")?>"><?php _e("Close", 'cms-tree-page-view') ?></a></p>
1057
- <p><?php _e('<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>.', 'cms-tree-page-view') ?></p>
1058
- <p><?php _e('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.', 'cms-tree-page-view') ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  </div>
1060
  <?php
1061
  }
6
 
7
  function cms_tpv_admin_head() {
8
 
9
+ if (!cms_tpv_is_one_of_our_pages()) return;
10
+
11
  global $cms_tpv_view;
12
  if (isset($_GET["cms_tpv_view"])) {
13
  $cms_tpv_view = htmlspecialchars($_GET["cms_tpv_view"]);
36
  <?php
37
  }
38
 
39
+ /**
40
+ * Detect if we are on a page that use CMS Tree Page View
41
+ */
42
+ function cms_tpv_is_one_of_our_pages() {
43
+
44
+ $options = cms_tpv_get_options();
45
+ $post_type = cms_tpv_get_selected_post_type();
46
+ $current_screen = get_current_screen(); # sf_d($current_screen);
47
+ $is_plugin_page = FALSE;
48
+
49
+ // Check if current page is one of the ones defined in $options["menu"]
50
+ foreach ($options["menu"] as $one_post_type) {
51
+ if ( strpos($current_screen->id, "_page_cms-tpv-page-{$one_post_type}") !== FALSE) {
52
+ $is_plugin_page = TRUE;
53
+ break;
54
+ }
55
+ }
56
+
57
+ if ($current_screen->id === "settings_page_cms-tpv-options") {
58
+ // Is settings page for plugin
59
+ $is_plugin_page = TRUE;
60
+ } elseif ($current_screen->id === "dashboard" && !empty($options["dashboard"])) {
61
+ $is_plugin_page = TRUE;
62
+ }
63
+
64
+ return $is_plugin_page;
65
+
66
+ }
67
+
68
+ /**
69
+ * Add styles and scripts to pages that use the plugin
70
+ */
71
  function cms_admin_enqueue_scripts() {
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
+ if (cms_tpv_is_one_of_our_pages()) {
75
+
76
+ wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.biscuit.js", array("jquery")); // renamed from cookie to fix problems with mod_security
77
+ wp_enqueue_script( "jquery-jstree", CMS_TPV_URL . "scripts/jquery.jstree.js", false, CMS_TPV_VERSION);
78
+ wp_enqueue_script( "jquery-alerts", CMS_TPV_URL . "scripts/jquery.alerts.js", false, CMS_TPV_VERSION);
79
+ wp_enqueue_script( "hoverIntent");
80
+ wp_enqueue_script( "cms_tree_page_view", CMS_TPV_URL . "scripts/cms_tree_page_view.js", false, CMS_TPV_VERSION);
81
+
82
+ wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
83
+ wp_enqueue_style( "jquery-alerts", CMS_TPV_URL . "styles/jquery.alerts.css", false, CMS_TPV_VERSION );
84
+
85
+ $oLocale = array(
86
+ "Enter_title_of_new_page" => __("Enter title of new page", 'cms-tree-page-view'),
87
+ "child_pages" => __("child pages", 'cms-tree-page-view'),
88
+ "Edit_page" => __("Edit page", 'cms-tree-page-view'),
89
+ "View_page" => __("View page", 'cms-tree-page-view'),
90
+ "Edit" => __("Edit", 'cms-tree-page-view'),
91
+ "View" => __("View", 'cms-tree-page-view'),
92
+ "Add_page" => __("Add page", 'cms-tree-page-view'),
93
+ "Add_new_page_after" => __("Add new page after", 'cms-tree-page-view'),
94
+ "after" => __("after", 'cms-tree-page-view'),
95
+ "inside" => __("inside", 'cms-tree-page-view'),
96
+ "Can_not_add_sub_page_when_status_is_draft" => __("Sorry, can't create a sub page to a page with status \"draft\".", 'cms-tree-page-view'),
97
+ "Can_not_add_sub_page_when_status_is_trash" => __("Sorry, can't create a sub page to a page with status \"trash\".", 'cms-tree-page-view'),
98
+ "Can_not_add_page_after_when_status_is_trash" => __("Sorry, can't create a page after a page with status \"trash\".", 'cms-tree-page-view'),
99
+ "Add_new_page_inside" => __("Add new page inside", 'cms-tree-page-view'),
100
+ "Status_draft" => __("draft", 'cms-tree-page-view'),
101
+ "Status_future" => __("future", 'cms-tree-page-view'),
102
+ "Status_password" => __("protected", 'cms-tree-page-view'), // is "protected" word better than "password" ?
103
+ "Status_pending" => __("pending", 'cms-tree-page-view'),
104
+ "Status_private" => __("private", 'cms-tree-page-view'),
105
+ "Status_trash" => __("trash", 'cms-tree-page-view'),
106
+ "Status_draft_ucase" => ucfirst( __("draft", 'cms-tree-page-view') ),
107
+ "Status_future_ucase" => ucfirst( __("future", 'cms-tree-page-view') ),
108
+ "Status_password_ucase" => ucfirst( __("protected", 'cms-tree-page-view') ), // is "protected" word better than "password" ?
109
+ "Status_pending_ucase" => ucfirst( __("pending", 'cms-tree-page-view') ),
110
+ "Status_private_ucase" => ucfirst( __("private", 'cms-tree-page-view') ),
111
+ "Status_trash_ucase" => ucfirst( __("trash", 'cms-tree-page-view') ),
112
+ "Password_protected_page" => __("Password protected page", 'cms-tree-page-view'),
113
+ "Adding_page" => __("Adding page...", 'cms-tree-page-view'),
114
+ );
115
+ wp_localize_script( "cms_tree_page_view", 'cmstpv_l10n', $oLocale);
116
+
117
+ }
118
 
119
  }
120
 
136
  $options["menu"] = (array) $_POST["post-type-menu"];
137
  update_option('cms_tpv_options', $options); // enable this to show box
138
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
 
141
+ /**
142
+ * Add widget to dashboard
143
+ */
144
  function cms_tpv_wp_dashboard_setup() {
145
  // add dashboard to capability edit_pages only
146
  if (current_user_can("edit_pages")) {
148
  foreach ($options["dashboard"] as $one_dashboard_post_type) {
149
  $post_type_object = get_post_type_object($one_dashboard_post_type);
150
  $new_func_name = create_function('', "cms_tpv_dashboard('$one_dashboard_post_type');");
151
+ $widget_name = _x(sprintf('%1$s Tree', $post_type_object->labels->name), "name of dashboard", "cms-tree-page-view");
152
+ wp_add_dashboard_widget( "cms_tpv_dashboard_widget_{$one_dashboard_post_type}", $widget_name, $new_func_name );
153
  }
154
  }
155
  }
159
  * Output on dashboard
160
  */
161
  function cms_tpv_dashboard($post_type = "") {
162
+ //cms_tpv_show_annoying_box();
163
  cms_tpv_print_common_tree_stuff($post_type);
164
  }
165
 
175
  $slug = "edit.php?post_type=$one_menu_post_type";
176
  }
177
  $post_type_object = get_post_type_object($one_menu_post_type);
178
+
179
+ $menu_name = _x("Tree View", "name in menu", "cms-tree-page-view");
180
+ $page_title = _x(sprintf('%1$s Tree View', $post_type_object->labels->name), "title on page with tree", "cms-tree-page-view");
181
+ add_submenu_page($slug, $page_title, $menu_name, $post_type_object->cap->edit_posts, "cms-tpv-page-$one_menu_post_type", "cms_tpv_pages_page");
182
  }
183
 
184
  add_submenu_page( 'options-general.php' , CMS_TPV_NAME, CMS_TPV_NAME, "administrator", "cms-tpv-options", "cms_tpv_options");
191
  */
192
  function cms_tpv_options() {
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  ?>
195
  <div class="wrap">
196
 
197
+ <?php cms_tpv_show_annoying_box(); ?>
198
+
199
  <h2><?php echo CMS_TPV_NAME ?> <?php _e("settings", 'cms-tree-page-view') ?></h2>
200
 
201
  <form method="post" action="options.php">
269
  }
270
  if (!$post_type) {
271
  // no post type, happens with ozh admin drop down, so get it via page instead
272
+ $page = isset($_GET["page"]) ? $_GET["page"] : "";
273
  $post_type = str_replace("cms-tpv-page-", "", $page);
274
  }
275
 
417
 
418
  <div style="clear: both;"></div>
419
 
420
+ <!-- template forpopup with actions -->
421
  <div class="cms_tpv_page_actions">
422
+
423
+ <!-- cms_tpv_page_actions_page_id -->
424
+ <h4 class="cms_tpv_page_actions_headline"></h4>
425
+
426
+ <p class="cms_tpv_action_edit_and_view">
427
+ <a href="#" title='<?php _e("Edit page", "cms-tree-page-view")?>' class='cms_tpv_action_edit'><?php _e("Edit", "cms-tree-page-view")?></a>
428
  <a href="#" title='<?php _e("View page", "cms-tree-page-view")?>' class='cms_tpv_action_view'><?php _e("View", "cms-tree-page-view")?></a>
429
  </p>
430
  <p class="cms_tpv_action_add_and_edit_page">
433
  <?php
434
  // if post type is hierarchical we can add pages inside
435
  if (cms_tpv_is_post_type_hierarchical($post_type_object)) {
436
+ ?><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
437
  }
438
  // if post status = draft then we can not add pages inside because wordpress currently can not keep its parent if we edit the page
439
  ?>
468
 
469
  $post_type = cms_tpv_get_selected_post_type();
470
  $post_type_object = get_post_type_object($post_type);
471
+
472
  ?>
473
  <div class="wrap">
474
+ <?php echo get_screen_icon(); ?>
475
+ <h2><?php
476
+ $page_title = _x(sprintf('%1$s Tree View', $post_type_object->labels->name), "headline of page with tree", "cms-tree-page-view");
477
+ echo $page_title;
478
+ ?></h2>
479
 
480
  <?php
481
  /*
620
 
621
  global $post;
622
 
623
+ // Translated post statuses
624
+ $post_statuses = get_post_statuses();
625
+
626
  #cms_tpv_firedebug(timer_stop());
627
 
628
  ?>[<?php
751
  "post_id": "<?php echo $onePage->ID ?>",
752
  "post_type": "<?php echo $onePage->post_type ?>",
753
  "post_status": "<?php echo $onePage->post_status ?>",
754
+ "post_status_translated": "<?php echo isset($post_statuses[$onePage->post_status]) ? $post_statuses[$onePage->post_status] : $onePage->post_status ?>",
755
  "rel": "<?php echo $rel ?>",
756
  "childCount": <?php echo ( !empty( $arrChildPages ) ) ? sizeof( $arrChildPages ) : 0 ; ?>,
757
  "permalink": "<?php echo htmlspecialchars_decode(get_permalink($onePage->ID)) ?>",
759
  "modified_time": "<?php echo $post_modified_time ?>",
760
  "modified_author": "<?php echo $post_author ?>",
761
  "columns": <?php echo $str_columns ?>,
762
+ "user_can_edit_page": "<?php echo (int) $user_can_edit_page ?>",
763
+ "post_title": "<?php echo $title ?>"
764
  }
765
  <?php
766
  // if id is in $arrOpenChilds then also output children on this one
1069
  * Show a box with some dontate-links and stuff
1070
  */
1071
  function cms_tpv_show_annoying_box() {
1072
+
1073
+ // update_option('cms_tpv_show_annoying_little_box', 1); // enable this to show box while testing
1074
+
1075
  if ( isset($_GET["action"]) && "cms_tpv_remove_annoying_box" == $_GET["action"] ) {
1076
  $show_box = 0;
1077
  update_option('cms_tpv_show_annoying_little_box', $show_box);
1081
  if ($show_box) {
1082
  ?>
1083
  <div class="cms_tpv_annoying_little_box">
1084
+
1085
+ <h3><?php _e('Thanks for using my plugin', 'cms-tree-page-view') ?></h3>
1086
+ <p class="cms_tpv_annoying_little_box_gravatar"><a href="https://twitter.com/eskapism"><?php echo get_avatar("par.thernstrom@gmail.com", '64'); ?></a></p>
1087
+ <p><?php _e('Hi there! I just wanna says thanks for using my plugin. I hope you like it as much as I do.', 'cms-tree-page-view') ?></p>
1088
+ <p class="cms_tpv_annoying_little_box_author"><a href="https://twitter.com/eskapism"><?php _e('/Pär Thernström - plugin creator', 'cms-tree-page-view') ?></a></p>
1089
+
1090
+ <h3><?php _e('I like this plugin<br>– how can I thank you?', 'cms-tree-page-view') ?></h3>
1091
+ <p><?php _e('There are serveral ways for you to show your appreciation:', 'cms-tree-page-view') ?></p>
1092
+ <ul>
1093
+ <li><?php printf(__('<a href="%1$s">Give it a nice review</a> over at the WordPress Plugin Directory', 'cms-tree-page-view'), "http://wordpress.org/support/view/plugin-reviews/cms-tree-page-view") ?></li>
1094
+ <li><?php printf(__('<a href="%1$s">Give a donation</a> – any amount will make me happy', 'cms-tree-page-view'), "http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox") ?></li>
1095
+ <li><?php printf(__('<a href="%1$s">Post a nice tweet</a> or make a nice blog post about the plugin', 'cms-tree-page-view'), "https://twitter.com/intent/tweet?text=I really like the CMS Tree Page View plugin for WordPress http://wordpress.org/extend/plugins/cms-tree-page-view/") ?></li>
1096
+ </ul>
1097
+
1098
+ <h3><?php _e('Support', 'cms-tree-page-view') ?></h3>
1099
+ <p><?php printf(__('Plese see the <a href="%1$s">support forum</a> for help.', 'cms-tree-page-view'), "http://wordpress.org/support/plugin/cms-tree-page-view") ?></p>
1100
+
1101
+ <p class="cms_tpv_annoying_little_box_close">
1102
+ <a href="<?php echo add_query_arg("action", "cms_tpv_remove_annoying_box")?>">
1103
+ <?php _e("Hide until next upgrade", 'cms-tree-page-view') ?>
1104
+ </a>
1105
+ </p>
1106
  </div>
1107
  <?php
1108
  }
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 view 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.14
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.8.14");
32
  define( "CMS_TPV_NAME", "CMS Tree Page View");
33
 
34
  // Find the plugin directory URL
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 view 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.9
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.9");
32
  define( "CMS_TPV_NAME", "CMS Tree Page View");
33
 
34
  // Find the plugin directory URL
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: eskapism, MarsApril
3
  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.4.2
7
- Stable tag: 0.8.14
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
 
@@ -52,6 +52,8 @@ This plugin is available in the following languages:
52
  * Polish
53
  * Greek
54
  * Danish
 
 
55
 
56
  #### Making the tree available for your vistors
57
  If you're looking for a version of this page tree that the vistors of your site can use, then check out
@@ -86,6 +88,16 @@ Now the tree with the pages will be visible both on the dashboard and in the men
86
 
87
  == Changelog ==
88
 
 
 
 
 
 
 
 
 
 
 
89
  = 0.8.14 =
90
  - Added Estonian translation
91
 
@@ -352,7 +364,3 @@ http://wordpress.org/support/topic/plugin-cms-tree-page-view-broken-for-language
352
  - First public version.
353
 
354
 
355
- == Still on WordPress 2? ==
356
- If you are using WordPress 2.x you can try this old version instead:
357
- http://downloads.wordpress.org/plugin/cms-tree-page-view.0.4.9.zip
358
-
3
  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.5
7
+ Stable tag: 0.9
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
 
52
  * Polish
53
  * Greek
54
  * Danish
55
+ * Lithuanian
56
+ * Estonian
57
 
58
  #### Making the tree available for your vistors
59
  If you're looking for a version of this page tree that the vistors of your site can use, then check out
88
 
89
  == Changelog ==
90
 
91
+ = 0.9 =
92
+ - Only output scripts and styles on pages that the plugin uses. This should speed up other parts of the WordPress admin a little tiny itsy bitsy bit.
93
+ - Added a hopefully not to spammy box about donation and stuff. Hopefully it it encourages some of you to give it a good review or maybe even donate some money. I've spent a lot, lot, LOT of time developing this plugin you know ;)
94
+ - Changed title on dashboard widgets and changed name of the menu item under each supported post type. Makes the titles/names look/feel a bit less dorky.
95
+ - Show icons next to the headline of top of pages with the tree
96
+ - Minor CSS changes like a little bit bigger text on the pages and a bit more spacing between each page. Makes a bit easier to drag and drop/move them around.
97
+ - Changed javascript to to use on() istead on live()
98
+ - Removed hoverIntent since that is included in WordPress by default
99
+ - Started using hoverIndent to make the popup with page actions show after a short while for each page. This also means that you can move outside the actions-pop-up for a short while without the pop up being closed - a thing that annoyed me very much. This makes the whole popup actions div thingie feels less in-your-face all the time. Hope you like it as much as I do!
100
+
101
  = 0.8.14 =
102
  - Added Estonian translation
103
 
364
  - First public version.
365
 
366
 
 
 
 
 
scripts/cms_tree_page_view.js CHANGED
@@ -3,11 +3,32 @@
3
  var cms_tpv_tree, treeOptions, div_actions, cms_tpv_current_li_id = null;
4
  jQuery(function($) {
5
 
6
- cms_tpv_tree = $(".cms_tpv_container");
7
- div_actions = $(".cms_tpv_page_actions");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  treeOptions = {
10
- xplugins: ["cookie","ui","crrm","themes","json_data","search","types","dnd"],
11
  plugins: ["themes","json_data","cookies","search","dnd", "types"],
12
  core: {
13
  "html_titles": true
@@ -17,55 +38,22 @@ jQuery(function($) {
17
  "url": ajaxurl + CMS_TPV_AJAXURL + CMS_TPV_VIEW,
18
  // this function is executed in the instance's scope (this refers to the tree instance)
19
  // the parameter is the node being loaded (may be -1, 0, or undefined when loading the root nodes)
20
- "data" : function (n) {
21
  // the result is fed to the AJAX request `data` option
22
  if (n.data) {
23
  var post_id = n.data("post_id");
24
  return {
25
  "id": post_id
26
- }
27
  }
28
  }
29
 
30
  }
31
- /*
32
- // data can be initially set like this
33
- // but it has to be set by type...
34
- "data": [{
35
- "data": {
36
- "title": "I am a new page",
37
- "attr": {
38
- "href": "http://localhost/wp-admin/post.php?post=1060&action=edit",
39
- "xid": "cms-tpv-1060"
40
- },
41
- "xicon": "http://localhost/wp-content/plugins/cms-tree-page-view/images/page_white_text.png"
42
- },
43
- "attr": {
44
- "xhref": "http://localhost/wp-admin/post.php?post=1060&action=edit",
45
- "id": "cms-tpv-1060",
46
- "xtitle": "Click to edit. Drag to move.",
47
- "class": "cms_tpv_user_can_edit_page_yes"
48
- },
49
- "metadata": {
50
- "id": "cms-tpv-1060",
51
- "post_id": "1060",
52
- "post_type": "page",
53
- "post_status": "publish",
54
- "rel": "publish",
55
- "childCount": 0,
56
- "permalink": "http://localhost/i-am-a-new-page/",
57
- "editlink": "http://localhost/wp-admin/post.php?post=1060&action=edit",
58
- "modified_time": "August 15, 2010",
59
- "modified_author": "admin",
60
- "columns": "%3Cdl%3E%3Cdt%3EComments%3C%2Fdt%3E%3Cdd%3E%3Cdiv%20class%3D%22post-com-count-wrapper%22%3E%3Ca%20href%3D%27edit-comments.php%3Fp%3D1060%27%20title%3D%270%20pending%27%3E%3Cspan%3E0%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fdiv%3E%3C%2Fdd%3E%3C%2Fdl%3E",
61
- "user_can_edit_page": "1"
62
- }
63
-
64
- }
65
- ]*/
66
  },
67
  "themes": {
68
- "theme": "wordpress"
 
69
  },
70
  "search": {
71
  "ajax" : {
@@ -75,7 +63,7 @@ jQuery(function($) {
75
  },
76
  "dnd": {
77
  }
78
- }
79
 
80
  if (cms_tpv_tree.length > 0) {
81
  cms_tpv_bind_clean_node(); // don't remember why I run this here.. :/
@@ -99,45 +87,82 @@ jQuery(function($) {
99
  "valid_children" : [ "none" ]
100
  }
101
  }
102
- }
103
  }
104
 
105
  $elm.bind("search.jstree", function (event, data) {
106
- if (data.rslt.nodes.length == 0) {
107
  // no hits. doh.
108
  $(this).closest(".cms_tpv_wrapper").find(".cms_tree_view_search_form_no_hits").fadeIn("fast");
109
  }
110
  });
111
 
 
 
112
  $elm.jstree(treeOptionsTmp);
113
 
114
  });
115
-
116
 
117
  }); // end ondomready
118
 
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  // get post type
121
  // elm must be within .cms_tpv_wrapper to work
122
  function cms_tpv_get_post_type(elm) {
123
- return jQuery(elm).closest(".cms_tpv_wrapper").find("[name=cms_tpv_meta_post_type]").val();
124
  }
125
  // get selected lang
126
  function cms_tpv_get_wpml_selected_lang(elm) {
127
- return jQuery(elm).closest(".cms_tpv_wrapper").find("[name=cms_tpv_meta_wpml_language]").val();
128
  }
129
 
130
  function cms_tpv_get_page_actions_div(elm) {
131
- return jQuery(elm).closest(".cms_tpv_wrapper").find(".cms_tpv_page_actions");
132
  }
133
  function cms_tpv_get_wrapper(elm) {
134
- var $wrapper = jQuery(elm).closest(".cms_tpv_wrapper");
135
  return $wrapper;
136
  }
137
 
138
 
139
- // add page after
140
- jQuery(".cms_tpv_action_add_page_after").live("click", function() {
 
141
  var $this = jQuery(this);
142
  var post_type = cms_tpv_get_post_type(this);
143
  var selected_lang = cms_tpv_get_wpml_selected_lang(this);
@@ -170,8 +195,8 @@ jQuery(".cms_tpv_action_add_page_after").live("click", function() {
170
  return false;
171
  });
172
 
173
- // add page inside
174
- jQuery(".cms_tpv_action_add_page_inside").live("click", function() {
175
  var $this = jQuery(this);
176
  var post_type = cms_tpv_get_post_type(this);
177
  var selected_lang = cms_tpv_get_wpml_selected_lang(this);
@@ -220,20 +245,46 @@ function cms_tpv_is_dragging() {
220
  return eDrag.is(":visible");
221
  }
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  // fired when mouse is over li
224
- function cms_tpv_mouseover_li(li) {
225
 
226
- //console.log("show actions div");
227
- $li = jQuery(li);
228
 
229
  var div_actions_for_post_type = cms_tpv_get_page_actions_div(li);
 
230
 
231
  if (cms_tpv_is_dragging() == false) {
232
-
233
- if (div_actions_for_post_type.is(":visible")) {
 
 
 
234
  // do nada
235
  } else {
236
 
 
 
 
 
 
 
 
237
  $li.find("a:first").addClass("hover");
238
 
239
  // setup link for view page
@@ -245,6 +296,37 @@ function cms_tpv_mouseover_li(li) {
245
  $edit = div_actions_for_post_type.find(".cms_tpv_action_edit");
246
  var editlink = $li.data("editlink");
247
  $edit.attr("href", editlink);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
  // check if user is allowed to edit page
250
  var $cms_tpv_action_add_and_edit_page = div_actions_for_post_type.find(".cms_tpv_action_add_and_edit_page");
@@ -253,80 +335,82 @@ function cms_tpv_mouseover_li(li) {
253
  $edit.hide();
254
  $cms_tpv_action_add_and_edit_page.hide();
255
  } else {
256
- $edit.show();
257
  $cms_tpv_action_add_and_edit_page.show();
 
258
  }
259
 
260
- // ..and some extras
261
- div_actions_for_post_type.find(".cms_tpv_page_actions_modified_time").text($li.data("modified_time"));
262
- div_actions_for_post_type.find(".cms_tpv_page_actions_modified_by").text($li.data("modified_author"));
263
- div_actions_for_post_type.find(".cms_tpv_page_actions_page_id").text($li.data("post_id"));
264
-
265
- div_actions_for_post_type.find(".cms_tpv_page_actions_columns").html( unescape($li.data("columns")) );
266
-
267
- // position and show action div
268
- var $a = $li.find("a");
269
- var width = $a.outerWidth(true);
270
- $li.append(div_actions_for_post_type);
271
- left_pos = width+28;
272
- top_pos = -8;
273
- div_actions_for_post_type.css("left", left_pos);
274
- div_actions_for_post_type.css("top", top_pos);
275
- div_actions_for_post_type.show();
276
  }
277
  }
278
 
279
  }
280
 
281
- // fired when mouse leaves li
282
- function cms_tpv_mouseout_li(li) {
283
- $li = jQuery(li);
284
- $li.find("a:first").removeClass("hover");
285
- div_actions.hide();
286
- }
287
-
288
- // mouse over, show actions
289
- // but only if the mouse not already is over the li (don't know why it fires multiple times, but it does)
290
- // 29 August, 2010 this worked nice but it had problems with child-lis...
291
- /*
292
- jQuery(".jstree li").live("mouseenter", function(e) {
293
-
294
- //console.log("mouseenter");
295
- var $li = jQuery(this);
296
- var li_id = $li.attr("id");
297
 
298
- // add hoverIntent, if not prev. attached
299
- if ($li.data("hasHoverIntent")) {
300
- // already got it
301
- } else {
302
- $li.data("hasHoverIntent", true);
303
- $li.hoverIntent(function() {
304
- // console.log("over");
305
- cms_tpv_mouseover_li(this);
306
- }, function() {
307
- console.log("out");
308
- //cms_tpv_mouseout_li(this);
309
- });
310
- // lastlt trigger mouseenter again so the popup will show
311
- $li.trigger("mouseover");
312
- }
 
 
 
 
 
313
 
314
- });
315
- */
316
 
317
- jQuery(".jstree li").live("mouseover", function(e) {
318
- var $li = jQuery(this);
319
- var li_id = $li.attr("id");
320
- cms_tpv_mouseover_li(this);
321
  });
322
- // ..and hide them again
323
- jQuery(".jstree li").live("mouseout", function() {
324
- //cms_tpv_current_li_id = null;
325
- //console.log("out");
326
- cms_tpv_mouseout_li(this);
 
 
 
327
  });
328
 
329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  // hide action links on drag
331
  jQuery.jstree.drag_start = function() {
332
  jQuery(".cms_tpv_action_view, .cms_tpv_action_edit, .cms_tpv_action_add_page, .cms_tpv_action_add_page_after, .cms_tpv_action_add_page_inside").hide();
@@ -395,6 +479,7 @@ function cms_tpv_bind_clean_node() {
395
  var obj = (data.rslt.obj);
396
  if (obj && obj != -1) {
397
  obj.each(function(i, elm) {
 
398
  var li = jQuery(elm);
399
  var aFirst = li.find("a:first");
400
 
@@ -404,48 +489,56 @@ function cms_tpv_bind_clean_node() {
404
  } else {
405
  li.data("done_cms_tpv_clean_node", true);
406
  }
407
- // new way:
408
- // console.log(li.data("childCount"));
409
- // add number of children
410
- //if (li.data("jstree")) {
411
- var childCount = li.data("childCount");
412
- if (childCount > 0) {
413
- aFirst.append("<span title='" + childCount + " " + cmstpv_l10n.child_pages + "' class='child_count'>("+childCount+")</span>");
414
- }
415
-
416
- // add protection type
417
- var rel = li.data("rel");
418
- if(rel == "password") {
419
- aFirst.find("ins").after("<span class='post_protected' title='" + cmstpv_l10n.Password_protected_page + "'>&nbsp;</span>");
420
- }
421
-
422
- // add page type
423
- var post_status = li.data("post_status");
424
- // post_status can be any value because of plugins like Edit flow
425
- // check if we have an existing translation for the string, otherwise use the post status directly
426
- var post_status_to_show = "";
427
- if (post_status_to_show = cmstpv_l10n["Status_"+post_status]) {
428
- // it's ok
429
- } else {
430
- post_status_to_show = post_status;
431
- }
432
- if (post_status != "publish") {
433
- aFirst.find("ins").first().after("<span class='post_type post_type_"+post_status+"'>" + post_status_to_show + "</span>");
434
- }
435
- //}
436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  });
438
  }
439
  });
440
  }
441
 
442
- // search: perform
443
- jQuery(".cms_tree_view_search_form").live("submit", function() {
 
444
  var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
445
  $wrapper.find(".cms_tpv_search_no_hits").hide();
446
  var s = $wrapper.find(".cms_tree_view_search").attr("value");
447
  s = jQuery.trim( s );
448
- // search, oh the mighty search!
449
  if (s) {
450
  $wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
451
  $wrapper.find(".cms_tree_view_search_form_working").fadeIn("fast");
@@ -458,13 +551,15 @@ jQuery(".cms_tree_view_search_form").live("submit", function() {
458
  $wrapper.find(".cms_tree_view_search_form_reset").fadeOut("fast");
459
  }
460
  $wrapper.find(".cms_tree_view_search_form_working").fadeOut("fast");
 
461
  return false;
 
462
  });
463
 
464
- // search: reset
465
- jQuery(".cms_tree_view_search_form_reset").live("click", function() {
466
  var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
467
- $wrapper.find(".cms_tree_view_search").val("")
468
  $wrapper.find(".cms_tpv_container").jstree("clear_search");
469
  $wrapper.find(".cms_tree_view_search_form_reset").fadeOut("fast");
470
  $wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
@@ -472,34 +567,37 @@ jQuery(".cms_tree_view_search_form_reset").live("click", function() {
472
  });
473
 
474
  // open/close links
475
- jQuery(".cms_tpv_open_all").live("click", function() {
476
  var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
477
  $wrapper.find(".cms_tpv_container").jstree("open_all");
478
  return false;
479
  });
480
- jQuery(".cms_tpv_close_all").live("click", function() {
 
481
  var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
482
  $wrapper.find(".cms_tpv_container").jstree("close_all");
483
  return false;
484
  });
485
 
486
  // view all or public or trash
487
- jQuery(".cms_tvp_view_all").live("click", function() {
488
  cms_tvp_set_view("all", this);
489
  return false;
490
  });
491
- jQuery(".cms_tvp_view_public").live("click", function() {
 
492
  cms_tvp_set_view("public", this);
493
  return false;
494
  });
495
- jQuery(".cms_tvp_view_trash").live("click", function() {
 
496
  cms_tvp_set_view("trash", this);
497
  return false;
498
  });
499
 
500
 
501
  // change lang
502
- jQuery("a.cms_tvp_switch_lang").live("click", function(e) {
503
  $wrapper = cms_tpv_get_wrapper(this);
504
  $wrapper.find("ul.cms_tvp_switch_langs a").removeClass("current");
505
  jQuery(this).addClass("current");
@@ -517,13 +615,15 @@ jQuery("a.cms_tvp_switch_lang").live("click", function(e) {
517
  });
518
 
519
  function cms_tpv_get_current_view(elm) {
 
520
  $wrapper = cms_tpv_get_wrapper(elm);
 
521
  if ($wrapper.find(".cms_tvp_view_all").hasClass("current")) {
522
  return "all";
523
  } else if ($wrapper.find(".cms_tvp_view_public").hasClass("current")) {
524
  return "public";
525
  } else {
526
- return false; // like unknown
527
  }
528
 
529
  }
@@ -548,8 +648,24 @@ function cms_tvp_set_view(view, elm) {
548
  } else {
549
 
550
  }
 
 
 
 
 
 
 
551
 
552
  var treeOptionsTmp = jQuery.extend(true, {}, treeOptions);
553
  treeOptionsTmp.json_data.ajax.url = ajaxurl + CMS_TPV_AJAXURL + view + "&post_type=" + cms_tpv_get_post_type(elm) + "&lang=" + cms_tpv_get_wpml_selected_lang(elm);
 
 
554
  $wrapper.find(".cms_tpv_container").jstree(treeOptionsTmp);
 
 
 
 
 
 
 
555
  }
3
  var cms_tpv_tree, treeOptions, div_actions, cms_tpv_current_li_id = null;
4
  jQuery(function($) {
5
 
6
+ // Globals, don't "var" them! :)
7
+ cms_tpv_tree = $("div.cms_tpv_container");
8
+ div_actions = $("div.cms_tpv_page_actions");
9
+
10
+ // try to override css
11
+ var height = "20", height2 = "18", ins_height = "18";
12
+ css_string = '' +
13
+ '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
14
+ '.jstree li { display:block; min-height:'+height+'px; line-height:'+height+'px; white-space:nowrap; margin-left:18px; min-width:18px; } ' +
15
+ '.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
16
+ '.jstree > ul > li { margin-left:0px; } ' +
17
+ '.jstree-rtl > ul > li { margin-right:0px; } ' +
18
+ '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:'+height+'px; margin:0 0 0 0; padding:0; } ' +
19
+ '.jstree a { display:inline-block; line-height:'+height2+'px; height:'+height2+'px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +
20
+ '.jstree a:focus { outline: none; } ' +
21
+ '.jstree a > ins { height:'+ins_height+'px; width:16px; } ' +
22
+ '.jstree a > .jstree-icon { margin-right:3px; } ' +
23
+ '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +
24
+ 'li.jstree-open > ul { display:block; } ' +
25
+ 'li.jstree-closed > ul { display:none; } ';
26
+ $.vakata.css.add_sheet({
27
+ str : css_string,
28
+ title : "jstree_cms_tpv"
29
+ });
30
 
31
  treeOptions = {
 
32
  plugins: ["themes","json_data","cookies","search","dnd", "types"],
33
  core: {
34
  "html_titles": true
38
  "url": ajaxurl + CMS_TPV_AJAXURL + CMS_TPV_VIEW,
39
  // this function is executed in the instance's scope (this refers to the tree instance)
40
  // the parameter is the node being loaded (may be -1, 0, or undefined when loading the root nodes)
41
+ "data" : function (n) {
42
  // the result is fed to the AJAX request `data` option
43
  if (n.data) {
44
  var post_id = n.data("post_id");
45
  return {
46
  "id": post_id
47
+ };
48
  }
49
  }
50
 
51
  }
52
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  },
54
  "themes": {
55
+ "theme": "wordpress",
56
+ "dots": false
57
  },
58
  "search": {
59
  "ajax" : {
63
  },
64
  "dnd": {
65
  }
66
+ };
67
 
68
  if (cms_tpv_tree.length > 0) {
69
  cms_tpv_bind_clean_node(); // don't remember why I run this here.. :/
87
  "valid_children" : [ "none" ]
88
  }
89
  }
90
+ };
91
  }
92
 
93
  $elm.bind("search.jstree", function (event, data) {
94
+ if (data.rslt.nodes.length === 0) {
95
  // no hits. doh.
96
  $(this).closest(".cms_tpv_wrapper").find(".cms_tree_view_search_form_no_hits").fadeIn("fast");
97
  }
98
  });
99
 
100
+ $elm.bind("loaded.jstree open_node.jstree", cms_tpv_tree_loaded);
101
+ //$wrapper.find(".cms_tpv_container").bind("loaded.jstree refresh.jstree open_node.jstree reopen.jstree after_open.jstree load_node.jstree", cms_tpv_tree_loaded);
102
  $elm.jstree(treeOptionsTmp);
103
 
104
  });
 
105
 
106
  }); // end ondomready
107
 
108
 
109
+ /**
110
+ * When tree is loaded: start hoverindenting stuff
111
+ * @todo: this is fireded several times, why not only once
112
+ */
113
+ function cms_tpv_tree_loaded(event, data) {
114
+
115
+ // console.log("loaded");
116
+
117
+ var $target = jQuery(event.target);
118
+ var $lis = $target.find("li a");
119
+ var $hoverIntentWrap = $target.find("div.cmstpv-hoverIntent-wrap");
120
+
121
+ // Bind hoverIntent
122
+ $hoverIntentWrap.hoverIntent({
123
+ over: cms_tpv_mouseover,
124
+ out: cms_tpv_mouseout,
125
+ timeout: 500, // default 0, 500 is good
126
+ sensitivity: 4 // default 7
127
+ });
128
+
129
+ function cms_tpv_mouseover(e) {
130
+ var $this = jQuery(this);
131
+ var $li = $this.closest("li");
132
+ cms_tpv_mouseover_li(e, $li.get(0));
133
+ }
134
+
135
+ function cms_tpv_mouseout(e) {
136
+ var $this = jQuery(this);
137
+ var $li = $this.closest("li");
138
+ cms_tpv_mouseout_li(e, $li.get(0));
139
+ }
140
+
141
+ }
142
+
143
+
144
  // get post type
145
  // elm must be within .cms_tpv_wrapper to work
146
  function cms_tpv_get_post_type(elm) {
147
+ return jQuery(elm).closest("div.cms_tpv_wrapper").find("[name=cms_tpv_meta_post_type]").val();
148
  }
149
  // get selected lang
150
  function cms_tpv_get_wpml_selected_lang(elm) {
151
+ return jQuery(elm).closest("div.cms_tpv_wrapper").find("[name=cms_tpv_meta_wpml_language]").val();
152
  }
153
 
154
  function cms_tpv_get_page_actions_div(elm) {
155
+ return jQuery(elm).closest("div.cms_tpv_wrapper").find("div.cms_tpv_page_actions");
156
  }
157
  function cms_tpv_get_wrapper(elm) {
158
+ var $wrapper = jQuery(elm).closest("div.cms_tpv_wrapper");
159
  return $wrapper;
160
  }
161
 
162
 
163
+ // Click on link to add page after the current page
164
+ jQuery(document).on("click", "a.cms_tpv_action_add_page_after", function(e) {
165
+
166
  var $this = jQuery(this);
167
  var post_type = cms_tpv_get_post_type(this);
168
  var selected_lang = cms_tpv_get_wpml_selected_lang(this);
195
  return false;
196
  });
197
 
198
+ // Click on link to add page insde another page
199
+ jQuery(document).on("click", "a.cms_tpv_action_add_page_inside", function(e) {
200
  var $this = jQuery(this);
201
  var post_type = cms_tpv_get_post_type(this);
202
  var selected_lang = cms_tpv_get_wpml_selected_lang(this);
245
  return eDrag.is(":visible");
246
  }
247
 
248
+ /*
249
+ jQuery(".jstree li").live("mouseover", function(e) {
250
+ var $li = jQuery(this);
251
+ var li_id = $li.attr("id");
252
+ cms_tpv_mouseover_li(this);
253
+ });
254
+ // ..and hide them again
255
+ jQuery(".jstree li").live("mouseout", function() {
256
+ //cms_tpv_current_li_id = null;
257
+ //console.log("out");
258
+ cms_tpv_mouseout_li(this);
259
+ });
260
+ */
261
+
262
+
263
+
264
  // fired when mouse is over li
265
+ function cms_tpv_mouseover_li(e, li) {
266
 
267
+ var $li = jQuery(li);
 
268
 
269
  var div_actions_for_post_type = cms_tpv_get_page_actions_div(li);
270
+ var $cms_tpv_container = $li.closest("div.cms_tpv_container");
271
 
272
  if (cms_tpv_is_dragging() == false) {
273
+
274
+ var is_visible = div_actions_for_post_type.is(":visible");
275
+ is_visible = false;
276
+
277
+ if (is_visible) {
278
  // do nada
279
  } else {
280
 
281
+ // Remove classes on all elements
282
+ $cms_tpv_container.find("li.has-visible-actions").removeClass("has-visible-actions");
283
+ $cms_tpv_container.find("a.hover").removeClass("hover");
284
+
285
+ // Add classes to only our new
286
+ $li.addClass("has-visible-actions");
287
+ $cms_tpv_container.addClass("has-visible-actions");
288
  $li.find("a:first").addClass("hover");
289
 
290
  // setup link for view page
296
  $edit = div_actions_for_post_type.find(".cms_tpv_action_edit");
297
  var editlink = $li.data("editlink");
298
  $edit.attr("href", editlink);
299
+
300
+ // ..and some extras
301
+ div_actions_for_post_type.find(".cms_tpv_page_actions_modified_time").text($li.data("modified_time"));
302
+ div_actions_for_post_type.find(".cms_tpv_page_actions_modified_by").text($li.data("modified_author"));
303
+ div_actions_for_post_type.find(".cms_tpv_page_actions_page_id").text($li.data("post_id"));
304
+
305
+ div_actions_for_post_type.find(".cms_tpv_page_actions_columns").html( unescape($li.data("columns")) );
306
+
307
+ // add post title as headline
308
+ div_actions_for_post_type.find(".cms_tpv_page_actions_headline").html( $li.data("post_title") );
309
+
310
+ // position and show action div
311
+ // put it inside cmstpv-hoverIntent-wrap so hoverIndent is cool with it
312
+ var $overIntentWrap = $li.find("div.cmstpv-hoverIntent-wrap:first");
313
+ //console.log( $overIntentWrap.length );
314
+ var $a = $li.find("a");
315
+ var width = $a.outerWidth(true);
316
+ //$li.append(div_actions_for_post_type);
317
+
318
+ $overIntentWrap.append(div_actions_for_post_type);
319
+
320
+ var new_offset = div_actions_for_post_type.offset();
321
+ var new_offset_left = e.pageX + 35;
322
+ // check that new left offset is not to close to the left of the a
323
+ // i.e. the mouse be x px more than the a for the experience to be optimal IMHO
324
+ var diff = e.pageX - $a.offset().left;
325
+ if (diff < 25) new_offset_left = new_offset_left + 25;
326
+
327
+ new_offset.left = new_offset_left;
328
+ new_offset.top = $a.offset().top - 30;
329
+ div_actions_for_post_type.offset(new_offset);
330
 
331
  // check if user is allowed to edit page
332
  var $cms_tpv_action_add_and_edit_page = div_actions_for_post_type.find(".cms_tpv_action_add_and_edit_page");
335
  $edit.hide();
336
  $cms_tpv_action_add_and_edit_page.hide();
337
  } else {
338
+ //$edit.show();
339
  $cms_tpv_action_add_and_edit_page.show();
340
+ div_actions_for_post_type.addClass("cms_tpv_page_actions_visible");
341
  }
342
 
343
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  }
345
  }
346
 
347
  }
348
 
349
+ // When mouse leaves the whole cms tree page view-area/div
350
+ jQuery(document).on("mouseleave", "div.cms_tpv_container", function(e) {
351
+ // hide actions div after moving mouse out of a page and not moving it on again for...a while
 
 
 
 
 
 
 
 
 
 
 
 
 
352
 
353
+ //var div_actions_for_post_type = cms_tpv_get_page_actions_div(li);
354
+ //var $cms_tpv_container = $li.closest("div.cms_tpv_container");
355
+ // console.log("mouse outside container");
356
+ var $container = jQuery(this);
357
+ jQuery.data(this, "cmstpv_do_hide_after_timeout", true);
358
+ var t = this;
359
+
360
+ setTimeout(function() {
361
+ //(function() {
362
+
363
+ // check if container has data value that still tells us to hide
364
+ // this value is reseted when we enter the div again
365
+ //$cms_tpv_container
366
+ //console.log("timeout passed; hide?");
367
+ //console.log( jQuery.data(t, "cmstpv_do_hide_after_timeout") );
368
+ if (jQuery.data(t, "cmstpv_do_hide_after_timeout")) {
369
+ $container.find("li.has-visible-actions").removeClass("has-visible-actions");
370
+ $container.find("a.hover").removeClass("hover");
371
+ $container.find("div.cms_tpv_page_actions").removeClass("cms_tpv_page_actions_visible");
372
+ }
373
 
374
+ //})();
375
+ }, 1000);
376
 
 
 
 
 
377
  });
378
+
379
+ // When mouse enter the whole cms tree page view-area/div
380
+ jQuery(document).on("mouseenter", "div.cms_tpv_container", function(e) {
381
+
382
+ // console.log("mouse inside container, reset hide data");
383
+ var $container = jQuery(this);
384
+ jQuery.data(this, "cmstpv_do_hide_after_timeout", false);
385
+
386
  });
387
 
388
 
389
+ // fired when mouse leaves li
390
+ function cms_tpv_mouseout_li(e, li) {
391
+
392
+ var $li = jQuery(li);
393
+ var $cms_tpv_container = $li.closest("div.cms_tpv_container");
394
+
395
+ /*
396
+ var div_actions_for_post_type = cms_tpv_get_page_actions_div(li);
397
+ var $cms_tpv_container = $li.closest("div.cms_tpv_container");
398
+ var is_visible = div_actions_for_post_type.is(":visible");
399
+ */
400
+
401
+ // Remove classes if we are not viewing any
402
+ // This function can get called also when a new li has been hoverIndent:ed
403
+ /*
404
+ $li.find("a:first").removeClass("hover");
405
+ $li.removeClass("has-visible-actions");
406
+ if (!is_visible) {
407
+ $cms_tpv_container.removeClass("has-visible-actions");
408
+ }
409
+ */
410
+ //div_actions.hide();
411
+ }
412
+
413
+
414
  // hide action links on drag
415
  jQuery.jstree.drag_start = function() {
416
  jQuery(".cms_tpv_action_view, .cms_tpv_action_edit, .cms_tpv_action_add_page, .cms_tpv_action_add_page_after, .cms_tpv_action_add_page_inside").hide();
479
  var obj = (data.rslt.obj);
480
  if (obj && obj != -1) {
481
  obj.each(function(i, elm) {
482
+
483
  var li = jQuery(elm);
484
  var aFirst = li.find("a:first");
485
 
489
  } else {
490
  li.data("done_cms_tpv_clean_node", true);
491
  }
492
+
493
+ var childCount = li.data("childCount");
494
+ if (childCount > 0) {
495
+ aFirst.append("<span title='" + childCount + " " + cmstpv_l10n.child_pages + "' class='child_count'>("+childCount+")</span>");
496
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
 
498
+ // add protection type
499
+ var rel = li.data("rel");
500
+ if(rel == "password") {
501
+ aFirst.find("ins").after("<span class='post_protected' title='" + cmstpv_l10n.Password_protected_page + "'>&nbsp;</span>");
502
+ }
503
+
504
+ // add page type
505
+ var post_status = li.data("post_status");
506
+ // post_status can be any value because of plugins like Edit flow
507
+ // check if we have an existing translation for the string, otherwise use the post status directly
508
+ var post_status_to_show = "";
509
+ if (post_status_to_show = cmstpv_l10n["Status_"+post_status + "_ucase"]) {
510
+ // it's ok
511
+ } else {
512
+ post_status_to_show = post_status;
513
+ }
514
+ if (post_status != "publish") {
515
+ aFirst.find("ins").first().after("<span class='post_type post_type_"+post_status+"'>" + post_status_to_show + "</span>");
516
+ }
517
+
518
+ // To make hoverindent work we must wrap something around the a bla bla bla
519
+
520
+ //li.find()
521
+ var div_wrap = jQuery("<div class='cmstpv-hoverIntent-wrap' />");
522
+ div_wrap.css({
523
+ "display": "inline-block",
524
+ "xwidth": "100%"
525
+ });
526
+ aFirst.wrap(div_wrap);
527
+
528
+
529
  });
530
  }
531
  });
532
  }
533
 
534
+ // Perform search when submiting form
535
+ jQuery(document).on("submit", "form.cms_tree_view_search_form", function(e) {
536
+
537
  var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
538
  $wrapper.find(".cms_tpv_search_no_hits").hide();
539
  var s = $wrapper.find(".cms_tree_view_search").attr("value");
540
  s = jQuery.trim( s );
541
+
542
  if (s) {
543
  $wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
544
  $wrapper.find(".cms_tree_view_search_form_working").fadeIn("fast");
551
  $wrapper.find(".cms_tree_view_search_form_reset").fadeOut("fast");
552
  }
553
  $wrapper.find(".cms_tree_view_search_form_working").fadeOut("fast");
554
+
555
  return false;
556
+
557
  });
558
 
559
+ // Reset search when click on x-link
560
+ jQuery(document).on("click", "a.cms_tree_view_search_form_reset", function(e) {
561
  var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
562
+ $wrapper.find(".cms_tree_view_search").val("");
563
  $wrapper.find(".cms_tpv_container").jstree("clear_search");
564
  $wrapper.find(".cms_tree_view_search_form_reset").fadeOut("fast");
565
  $wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
567
  });
568
 
569
  // open/close links
570
+ jQuery(document).on("click", "a.cms_tpv_open_all", function(e) {
571
  var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
572
  $wrapper.find(".cms_tpv_container").jstree("open_all");
573
  return false;
574
  });
575
+
576
+ jQuery(document).on("click", "a.cms_tpv_close_all", function(e) {
577
  var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
578
  $wrapper.find(".cms_tpv_container").jstree("close_all");
579
  return false;
580
  });
581
 
582
  // view all or public or trash
583
+ jQuery(document).on("click", "a.cms_tvp_view_all", function(e) {
584
  cms_tvp_set_view("all", this);
585
  return false;
586
  });
587
+
588
+ jQuery(document).on("click", "a.cms_tvp_view_public", function(e) {
589
  cms_tvp_set_view("public", this);
590
  return false;
591
  });
592
+
593
+ jQuery(document).on("click", "a.cms_tvp_view_trash", function() {
594
  cms_tvp_set_view("trash", this);
595
  return false;
596
  });
597
 
598
 
599
  // change lang
600
+ jQuery(document).on("click", "a.cms_tvp_switch_lang", function(e) {
601
  $wrapper = cms_tpv_get_wrapper(this);
602
  $wrapper.find("ul.cms_tvp_switch_langs a").removeClass("current");
603
  jQuery(this).addClass("current");
615
  });
616
 
617
  function cms_tpv_get_current_view(elm) {
618
+
619
  $wrapper = cms_tpv_get_wrapper(elm);
620
+
621
  if ($wrapper.find(".cms_tvp_view_all").hasClass("current")) {
622
  return "all";
623
  } else if ($wrapper.find(".cms_tvp_view_public").hasClass("current")) {
624
  return "public";
625
  } else {
626
+ return false; // like unknown
627
  }
628
 
629
  }
648
  } else {
649
 
650
  }
651
+
652
+ // Hide actions if open
653
+ var $cms_tpv_container = $wrapper.find("div.cms_tpv_container");
654
+ $cms_tpv_container.find("li.has-visible-actions").removeClass("has-visible-actions");
655
+ $cms_tpv_container.find("a.hover").removeClass("hover");
656
+ $cms_tpv_container.find("div.cms_tpv_page_actions").removeClass("cms_tpv_page_actions_visible");
657
+ jQuery("div.cms_tpv_page_actions_visible").removeClass("cms_tpv_page_actions_visible");
658
 
659
  var treeOptionsTmp = jQuery.extend(true, {}, treeOptions);
660
  treeOptionsTmp.json_data.ajax.url = ajaxurl + CMS_TPV_AJAXURL + view + "&post_type=" + cms_tpv_get_post_type(elm) + "&lang=" + cms_tpv_get_wpml_selected_lang(elm);
661
+
662
+ $wrapper.find(".cms_tpv_container").bind("loaded.jstree open_node.jstree", cms_tpv_tree_loaded);
663
  $wrapper.find(".cms_tpv_container").jstree(treeOptionsTmp);
664
+
665
+ /*
666
+ __calback loaded jquery.jstree.js:238
667
+ __calback reopen jquery.jstree.js:238
668
+ __calback reload_nodes
669
+ */
670
+
671
  }
scripts/jquery.hoverIntent.minified.js DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
3
- * <http://cherne.net/brian/resources/jquery.hoverIntent.html>
4
- *
5
- * @param f onMouseOver function || An object with configuration options
6
- * @param g onMouseOut function || Nothing (use configuration options object)
7
- * @author Brian Cherne <brian@cherne.net>
8
- */
9
- (function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
 
 
 
 
 
 
 
 
 
scripts/jquery.jstree.js CHANGED
@@ -66,6 +66,7 @@
66
  tmp.setAttribute('type',"text/css");
67
  if(opts.title) { tmp.setAttribute("id", opts.title + "-stylesheet"); }
68
  }
 
69
  if(tmp.styleSheet) {
70
  if(is_new) {
71
  document.getElementsByTagName("head")[0].appendChild(tmp);
@@ -267,6 +268,7 @@
267
 
268
  // load the css when DOM is ready
269
  $(function() {
 
270
  // code is copied from jQuery ($.browser is deprecated + there is a bug in IE)
271
  var u = navigator.userAgent.toLowerCase(),
272
  v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
66
  tmp.setAttribute('type',"text/css");
67
  if(opts.title) { tmp.setAttribute("id", opts.title + "-stylesheet"); }
68
  }
69
+
70
  if(tmp.styleSheet) {
71
  if(is_new) {
72
  document.getElementsByTagName("head")[0].appendChild(tmp);
268
 
269
  // load the css when DOM is ready
270
  $(function() {
271
+
272
  // code is copied from jQuery ($.browser is deprecated + there is a bug in IE)
273
  var u = navigator.userAgent.toLowerCase(),
274
  v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
scripts/themes/wordpress/style.css CHANGED
@@ -78,14 +78,18 @@
78
  padding-bottom: 2px;*/
79
  position: relative;
80
  }
81
- .jstree li.jstree-closed,
82
  .jstree li.jstree-open
83
  {
84
- /* padding-top: 4px;
85
- padding-bottom: 4px; */
86
- }
87
- .jstree li.hover a,
88
  .jstree li a.hover
89
  {
90
  background-color: #e7f4f9;
91
  }
 
 
 
 
 
78
  padding-bottom: 2px;*/
79
  position: relative;
80
  }
81
+ /*.jstree li.jstree-closed,
82
  .jstree li.jstree-open
83
  {
84
+ }*/
85
+
86
+ /*.jstree li.hover a,
 
87
  .jstree li a.hover
88
  {
89
  background-color: #e7f4f9;
90
  }
91
+ */
92
+
93
+ .jstree li a:hover {
94
+ background-color: #e7f4f9;
95
+ }
styles/images/arrow-top.gif ADDED
Binary file
styles/styles.css CHANGED
@@ -5,6 +5,8 @@
5
  }
6
  */
7
 
 
 
8
 
9
  .cms_tpv_wrapper {
10
  z-index: 10;
@@ -19,6 +21,7 @@
19
  /* clear: both; */
20
  overflow: visible;
21
  margin-top: 1.5em;
 
22
  }
23
 
24
  #wpbody-content .cms_tpv_container {
@@ -51,29 +54,6 @@
51
  clear: both;
52
  }
53
 
54
- /*
55
- span.cms_tpv_action_edit,
56
- li span.cms_tpv_action_view,
57
- li span.cms_tpv_action_add_page_after,
58
- li span.cms_tpv_action_add_page_inside
59
- {
60
- display: none;
61
- text-decoration: underline;
62
- border: 0;
63
- -moz-border-radius: 0;
64
- -webkit-border-radius: 0;
65
- border-radius: 0;
66
- padding: 0 0 0 .5ex;
67
-
68
- }
69
- li span.cms_tpv_action_add_page {
70
- display: none;
71
- border: 0;
72
- padding: 0 0 0 .5em;
73
- color: #666;
74
- }
75
- */
76
-
77
  .cms-tree-view-search
78
  {
79
  background-color: #ffefba;
@@ -99,7 +79,7 @@ li span.cms_tpv_action_add_page {
99
  background-color: transparent;
100
  color: #999;
101
  border: none;
102
- font-size: .8em;
103
  margin-left: .5em;
104
  }
105
 
@@ -113,11 +93,11 @@ li span.cms_tpv_action_add_page {
113
 
114
 
115
  .tree-default span.post_type {
116
- background-color: #f85b11;
117
- -moz-border-radius: 3px;
118
- -webkit-border-radius: 3px;
119
- border-radius: 3px;
120
- padding: 1px 4px 1px 4px;
121
  color: white;
122
  border: none;
123
  font-size: .8em;
@@ -127,16 +107,14 @@ li span.cms_tpv_action_add_page {
127
  .tree-default span.post_type_draft {
128
 
129
  }
130
- .tree-default span.post_type_password {
131
- background-color: #25b61a;
132
- }
133
  .tree-default span.post_type_private {
134
- background-color: #25b61a;
135
  }
136
  .tree-default span.post_type_pending,
137
  .tree-default span.post_type_future
138
  {
139
- background-color: #0069e0;
140
  }
141
 
142
 
@@ -211,53 +189,132 @@ li span.cms_tpv_action_add_page {
211
  }
212
 
213
  .cms_tpv_annoying_little_box {
214
- padding: 1em;
215
- background-color: #FFFBCC;
216
- border: 1px solid #E6DB55;
217
  margin: 1em 0 1em 0;
218
- -moz-border-radius: 6px;
219
- -webkit-border-radius: 6px;
220
- border-radius: 6px;
221
- }
222
- .cms_tpv_annoying_little_box p {
223
- margin: 0 0 .5em 0;
224
- }
225
- p.cms_tpv_annoying_little_box_close {
226
  float: right;
227
- margin-left: 2em;
228
- font-size: .8em;
229
- margin-top: -1em;
230
- margin-right: -.5em;
231
  }
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  .cms_tpv_page_actions {
 
234
  width: auto;
235
- min-width: 125px;
 
236
  height: auto;
237
  background-color: white;
238
  position: absolute;
239
  top: 0;
240
  white-space: normal;
241
  z-index: 100;
242
- padding: 7px;
243
- display: none;
244
- -moz-box-shadow: 2px 2px 8px #ddd; /* FF3.5+ */
245
- border: 1px solid #bbb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  }
 
 
 
 
 
 
247
  .cms_tpv_page_actions p {
248
- margin: 0 0 .5em 0;
 
 
 
 
 
 
249
  }
250
  .cms_tpv_wrapper .cms_tpv_page_actions a {
251
  display: inline;
252
  background: transparent;
253
  text-decoration: underline;
254
- padding: 0;
255
  color: #21759B;
 
 
 
 
 
 
 
256
  }
257
 
258
  .cms_tpv_wrapper .cms_tpv_page_actions a:hover
259
  {
260
  color: #d54e21;
 
261
  }
262
 
263
  .cms_tpv_page_actions ul {
@@ -276,24 +333,30 @@ p.cms_tpv_annoying_little_box_close {
276
  }
277
  .cms_tpv_page_actions dl {
278
  margin-top: 1em;
 
279
  color: #333;
280
  font-size: 11px;
 
281
  }
282
  .cms_tpv_page_actions dl dd {
283
  margin: 0;
284
  }
285
  .cms_tpv_page_actions dl dt {
286
  color: #999;
 
287
  }
288
 
289
  .cms_tpv_page_actions_arrow {
 
 
290
  width: 8px;
291
  height: 15px;
292
  background: url(images/arrow-left.gif) no-repeat top left;
293
  position: absolute;
294
  display: block;
295
- top: 7px;
296
  left: -8px;
 
 
297
  }
298
 
299
  .cms_tpv_page_actions_columns table td {
@@ -315,6 +378,14 @@ li.cms_tpv_user_can_edit_page_no a {
315
  -ms-filter: "alpha(opacity=60)"; /* IE 8 */
316
  }
317
 
 
 
 
 
 
 
 
 
318
  .bonny-plugins-inner-sidebar {
319
  float: right;
320
  width: 210px;
@@ -322,3 +393,4 @@ li.cms_tpv_user_can_edit_page_no a {
322
  padding-left: 10px;
323
  border-left: 1px solid #E3E3E3;
324
  }
 
5
  }
6
  */
7
 
8
+ @import url("http://s0.wordpress.com/i/noticons/noticons.css");
9
+
10
 
11
  .cms_tpv_wrapper {
12
  z-index: 10;
21
  /* clear: both; */
22
  overflow: visible;
23
  margin-top: 1.5em;
24
+ font-size: 13px;
25
  }
26
 
27
  #wpbody-content .cms_tpv_container {
54
  clear: both;
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  .cms-tree-view-search
58
  {
59
  background-color: #ffefba;
79
  background-color: transparent;
80
  color: #999;
81
  border: none;
82
+ font-size: .9em;
83
  margin-left: .5em;
84
  }
85
 
93
 
94
 
95
  .tree-default span.post_type {
96
+ background-color: rgba(248, 98, 16, .75);
97
+ -moz-border-radius: 2px;
98
+ -webkit-border-radius: 2px;
99
+ border-radius: 2px;
100
+ padding: 1px 4px 2px 4px;
101
  color: white;
102
  border: none;
103
  font-size: .8em;
107
  .tree-default span.post_type_draft {
108
 
109
  }
110
+ .tree-default span.post_type_password,
 
 
111
  .tree-default span.post_type_private {
112
+ background-color: rgba(37, 182, 26, .75);
113
  }
114
  .tree-default span.post_type_pending,
115
  .tree-default span.post_type_future
116
  {
117
+ background-color: rgba(0, 105, 224, .75);
118
  }
119
 
120
 
189
  }
190
 
191
  .cms_tpv_annoying_little_box {
192
+ padding: 1.5em;
193
+ background-color: #FAFAFA;
194
+ border: 1px solid #ddd;
195
  margin: 1em 0 1em 0;
 
 
 
 
 
 
 
 
196
  float: right;
197
+ width: 22em;
 
 
 
198
  }
199
 
200
+ .cms_tpv_annoying_little_box h3:first-of-type {
201
+ margin-top: 0;
202
+ }
203
+
204
+ .cms_tpv_annoying_little_box_author {
205
+ font-style: italic;
206
+ }
207
+
208
+ .cms_tpv_annoying_little_box p {
209
+ margin: 0 0 .5em 0;
210
+ }
211
+
212
+ p.cms_tpv_annoying_little_box_gravatar {
213
+ float: right;
214
+ margin: 0 0 1em 1em;
215
+ }
216
+
217
+ .cms_tpv_annoying_little_box ul {
218
+ list-style-type: disc;
219
+ margin-left: 20px;
220
+ }
221
+
222
+ p.cms_tpv_annoying_little_box_close {
223
+ text-align: right;
224
+ font-size: .8em;
225
+ margin-top: 1.5em;
226
+ margin-bottom: 0;
227
+ }
228
+
229
  .cms_tpv_page_actions {
230
+ /*transition: all .25s ease-in-out; -webkit-transition: all .25s ease-in-out; -moz-transition: all .25s ease-in-out; -o-transition: all .25s ease-in-out; -ms-transition: all .25s ease-in-out;*/
231
  width: auto;
232
+ min-width: 175px;
233
+ width: 175px;
234
  height: auto;
235
  background-color: white;
236
  position: absolute;
237
  top: 0;
238
  white-space: normal;
239
  z-index: 100;
240
+ padding: 10px 10px 0 10px;
241
+ visibility: hidden;
242
+ /*
243
+ jetpack style:
244
+ -moz-box-shadow: 0 4px 8px rgba(0,0,0,0.1);
245
+ -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
246
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);*/
247
+ /* admin bar style */
248
+ -moz-box-shadow: 0 4px 4px rgba(0, 0, 0, 0.2);
249
+ -webkit-box-shadow: 0 4px 4px rgba(0, 0, 0, 0.2);
250
+ box-shadow: 0 4px 4px rgba(0, 0, 0, 0.2);
251
+ border: 1px solid #DFDFDF;
252
+ opacity: 0;
253
+ font-family: sans-serif !important;
254
+ }
255
+
256
+ .cms_tpv_page_actions:before {
257
+ color: white;
258
+ position: absolute;
259
+ left: -16px;
260
+ top: 32px;
261
+ content: '\25C0'; /* left arrow */
262
+ display: inline-block;
263
+ -webkit-font-smoothing: antialiased;
264
+ font: normal 16px/1 'Noticons';
265
+ vertical-align: top;
266
+ text-shadow: 0px 1px 6px rgba(0, 0, 0, 0.2), -1px 0px 0 #DFDFDF;
267
+ overflow: hidden;
268
+ }
269
+
270
+ .cms_tpv_page_actions.cms_tpv_page_actions_visible {
271
+ /*display: block;*/
272
+ visibility: visible;
273
+ opacity: 1;
274
+ }
275
+
276
+
277
+ /*
278
+ div.cms_tpv_container.has-visible-actions li {
279
+ opacity: .5
280
+ }
281
+
282
+ div.cms_tpv_container.has-visible-actions li.has-visible-actions {
283
+ opacity: 1;
284
  }
285
+ */
286
+ li.has-visible-actions > div.cmstpv-hoverIntent-wrap:first-of-type > a:first-of-type {
287
+ /*font-weight: bold;*/
288
+ background-color: lightyellow;
289
+ }
290
+
291
  .cms_tpv_page_actions p {
292
+ margin: .5em 0 .5em 0;
293
+ line-height: 1.2;
294
+ }
295
+ p.cms_tpv_action_add_and_edit_page,
296
+ p.cms_tpv_action_edit_and_view
297
+ {
298
+ margin-top: 0em;
299
  }
300
  .cms_tpv_wrapper .cms_tpv_page_actions a {
301
  display: inline;
302
  background: transparent;
303
  text-decoration: underline;
 
304
  color: #21759B;
305
+ font-weight: normal;
306
+ padding: 0 .5em 0 0;
307
+ margin-right: .2em;
308
+ border-right: 1px solid #aaa;
309
+ }
310
+ .cms_tpv_wrapper .cms_tpv_page_actions a:last-child {
311
+ border: none;
312
  }
313
 
314
  .cms_tpv_wrapper .cms_tpv_page_actions a:hover
315
  {
316
  color: #d54e21;
317
+ background-color: transparent;
318
  }
319
 
320
  .cms_tpv_page_actions ul {
333
  }
334
  .cms_tpv_page_actions dl {
335
  margin-top: 1em;
336
+ margin-bottom: 1em;
337
  color: #333;
338
  font-size: 11px;
339
+ line-height: 1.2;
340
  }
341
  .cms_tpv_page_actions dl dd {
342
  margin: 0;
343
  }
344
  .cms_tpv_page_actions dl dt {
345
  color: #999;
346
+ margin: .5em 0 0 0;
347
  }
348
 
349
  .cms_tpv_page_actions_arrow {
350
+ display: none;
351
+ /*
352
  width: 8px;
353
  height: 15px;
354
  background: url(images/arrow-left.gif) no-repeat top left;
355
  position: absolute;
356
  display: block;
 
357
  left: -8px;
358
+ left: 0px;
359
+ */
360
  }
361
 
362
  .cms_tpv_page_actions_columns table td {
378
  -ms-filter: "alpha(opacity=60)"; /* IE 8 */
379
  }
380
 
381
+ h4.cms_tpv_page_actions_headline {
382
+ margin: 0 0 0 0;
383
+ font-weight: bold !important;
384
+ font-family: sans-serif !important;
385
+ line-height: 1.1;
386
+ }
387
+
388
+
389
  .bonny-plugins-inner-sidebar {
390
  float: right;
391
  width: 210px;
393
  padding-left: 10px;
394
  border-left: 1px solid #E3E3E3;
395
  }
396
+