Version Description
- New: create multiple pages at once! Add multiple pages faster than ever before! You can ever select if the new pages should be drafts or published. And ever drag and drop the pages to get the correct order even before adding them. I know - it's awesome!
- Fixed: adds new pages with the correct and selected WPML-language
- Added: you can now change the type of a post by draging the post between different trees on the dashboard. So if you have one custom post type called "Cars" and another called "Bicycles" you can now drag a page from the cars tree to the bicicyles tree and the post will converted to that post type. Pretty powerful feature that you used to need a separately plugin to be able to do.
- Misc fixes
- Added new POT-file for translators
- I decided to call this version 1. I've been using this plugin for so long time now and I use it in almost every WordPress project I participate in (all projects with lots of pages), so with this new add-mulitple-page-feature it feels like it's time to go to version 1. Hope you'll agree! :)
Download this release
Release Info
Developer | eskapism |
Plugin | CMS Tree Page View |
Version | 1.0 |
Comparing to | |
See all releases |
Code changes from version 0.10.1 to 1.0
- functions.php +233 -3
- index.php +3 -2
- languages/cms-tree-page-view.pot +135 -73
- readme.txt +9 -1
- scripts/cms_tree_page_view.js +193 -127
- styles/styles.css +64 -15
functions.php
CHANGED
@@ -1,5 +1,176 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
// for debug, remember to comment out (yes.. i *know* i will forget this later on...)
|
4 |
// require("FirePHPCore/FirePHP.class.php");
|
5 |
// $firephp = FirePHP::getInstance(true);
|
@@ -111,6 +282,7 @@ function cms_admin_enqueue_scripts() {
|
|
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 |
|
@@ -352,6 +524,7 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
|
|
352 |
ob_start();
|
353 |
cms_tpv_print_childs(0, $cms_tpv_view, $jstree_open, $post_type);
|
354 |
$json_data = ob_get_clean();
|
|
|
355 |
?>
|
356 |
<script type="text/javascript">
|
357 |
cms_tpv_jsondata.<?php echo $post_type ?> = <?php echo $json_data ?>;
|
@@ -442,9 +615,14 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
|
|
442 |
<a href="#" title='<?php _e("Edit page", "cms-tree-page-view")?>' class='cms_tpv_action_edit'><?php _e("Edit", "cms-tree-page-view")?></a>
|
443 |
<a href="#" title='<?php _e("View page", "cms-tree-page-view")?>' class='cms_tpv_action_view'><?php _e("View", "cms-tree-page-view")?></a>
|
444 |
</p>
|
|
|
|
|
445 |
<p class="cms_tpv_action_add_and_edit_page">
|
|
|
446 |
<span class='cms_tpv_action_add_page'><?php echo $post_type_object->labels->add_new_item ?></span>
|
|
|
447 |
<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>
|
|
|
448 |
<?php
|
449 |
// if post type is hierarchical we can add pages inside
|
450 |
if (cms_tpv_is_post_type_hierarchical($post_type_object)) {
|
@@ -453,7 +631,55 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
|
|
453 |
// if post status = draft then we can not add pages inside because wordpress currently can not keep its parent if we edit the page
|
454 |
?>
|
455 |
<!-- <span class="cms_tpv_action_add_page_inside_disallowed"><?php _e("Can not create page inside of a page with draft status", "cms-tree-page-view")?></span> -->
|
|
|
456 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
<dl>
|
458 |
<dt><?php _e("Last modified", "cms-tree-page-view") ?></dt>
|
459 |
<dd>
|
@@ -463,6 +689,7 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
|
|
463 |
<dt><?php _e("Page ID", "cms-tree-page-view") ?></dt>
|
464 |
<dd><span class="cms_tpv_page_actions_page_id"></span></dd>
|
465 |
</dl>
|
|
|
466 |
<div class="cms_tpv_page_actions_columns"></div>
|
467 |
<span class="cms_tpv_page_actions_arrow"></span>
|
468 |
</div>
|
@@ -1013,7 +1240,8 @@ function cms_tpv_move_page() {
|
|
1013 |
$post_to_save = array(
|
1014 |
"ID" => $post_node->ID,
|
1015 |
"menu_order" => 0,
|
1016 |
-
"post_parent" => $post_ref_node->ID
|
|
|
1017 |
);
|
1018 |
wp_update_post( $post_to_save );
|
1019 |
|
@@ -1034,7 +1262,8 @@ function cms_tpv_move_page() {
|
|
1034 |
$post_to_save = array(
|
1035 |
"ID" => $post_node->ID,
|
1036 |
"menu_order" => $post_ref_node->menu_order,
|
1037 |
-
"post_parent" => $post_ref_node->post_parent
|
|
|
1038 |
);
|
1039 |
wp_update_post( $post_to_save );
|
1040 |
|
@@ -1054,7 +1283,8 @@ function cms_tpv_move_page() {
|
|
1054 |
$post_to_save = array(
|
1055 |
"ID" => $post_node->ID,
|
1056 |
"menu_order" => $post_ref_node->menu_order+1,
|
1057 |
-
"post_parent" => $post_ref_node->post_parent
|
|
|
1058 |
);
|
1059 |
wp_update_post( $post_to_save );
|
1060 |
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Use the ajax action-thingie to catch our form with new pages
|
5 |
+
* Add pages and then redirect to...?
|
6 |
+
*/
|
7 |
+
function cms_tpv_add_pages() {
|
8 |
+
|
9 |
+
#sf_d($_POST);exit;
|
10 |
+
/*
|
11 |
+
Array
|
12 |
+
(
|
13 |
+
[action] => cms_tpv_add_pages
|
14 |
+
[cms_tpv_add_new_pages_names] => Array
|
15 |
+
(
|
16 |
+
[0] => xxxxx
|
17 |
+
[1] => yyyy
|
18 |
+
[2] =>
|
19 |
+
)
|
20 |
+
|
21 |
+
[cms_tpv_add_type] => inside
|
22 |
+
[cms_tpv_add_status] => draft
|
23 |
+
[lang] => de
|
24 |
+
)
|
25 |
+
*/
|
26 |
+
|
27 |
+
$post_position = $_POST["cms_tpv_add_type"];
|
28 |
+
$post_status = $_POST["cms_tpv_add_status"];
|
29 |
+
$post_names = (array) $_POST["cms_tpv_add_new_pages_names"];
|
30 |
+
$ref_post_id = (int) $_POST["ref_post_id"];
|
31 |
+
$lang = $_POST["lang"];
|
32 |
+
|
33 |
+
// If lang variable is set, then set some more wpml-related post/get-variables
|
34 |
+
if ($lang) {
|
35 |
+
// post seems to fix creating new posts in selcted lang
|
36 |
+
$_POST["icl_post_language"] = $lang;
|
37 |
+
// $_GET["lang"] = $lang;
|
38 |
+
}
|
39 |
+
|
40 |
+
// make sure the status is publish and nothing else (yes, perhaps I named it bad elsewhere)
|
41 |
+
if ("published" === $post_status) $post_status = "publish";
|
42 |
+
|
43 |
+
// remove possibly empty posts
|
44 |
+
$arr_post_names = array();
|
45 |
+
foreach ($post_names as $one_post_name) {
|
46 |
+
if ( trim($one_post_name) ) {
|
47 |
+
$arr_post_names[] = $one_post_name;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$arr_post_names_count = sizeof($arr_post_names);
|
52 |
+
|
53 |
+
// check that there are pages left
|
54 |
+
if (empty($arr_post_names)) die("Error: no pages to add.");
|
55 |
+
|
56 |
+
$ref_post = get_post($ref_post_id);
|
57 |
+
if (NULL === $ref_post) die("Error: could not load reference post.");
|
58 |
+
|
59 |
+
// Make room for our new pages
|
60 |
+
// Get all pages at a level level and loop until our reference page
|
61 |
+
// and then all pages after that one will get it's menu_order
|
62 |
+
// increased by the same number as the number of new posts we're gonna add
|
63 |
+
|
64 |
+
$post_parent = 0;
|
65 |
+
if ("after" === $post_position) {
|
66 |
+
$post_parent = $ref_post->post_parent;
|
67 |
+
} elseif ("inside" === $post_position) {
|
68 |
+
$post_parent = $ref_post->ID;
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/*
|
73 |
+
perhaps for wpml:
|
74 |
+
suppress_filters=0
|
75 |
+
|
76 |
+
*/
|
77 |
+
|
78 |
+
$args = array(
|
79 |
+
"post_status" => "any",
|
80 |
+
"post_type" => $ref_post->post_type,
|
81 |
+
"numberposts" => -1,
|
82 |
+
"offset" => 0,
|
83 |
+
"orderby" => 'menu_order',
|
84 |
+
'order' => 'asc',
|
85 |
+
'post_parent' => $post_parent,
|
86 |
+
"suppress_filters" => FALSE
|
87 |
+
);
|
88 |
+
//if ($lang) $args["lang"] = $lang;
|
89 |
+
$posts = get_posts($args);
|
90 |
+
|
91 |
+
#sf_d($_GET["lang"]);sf_d($args);sf_d($posts);exit;
|
92 |
+
|
93 |
+
// If posts exist at this level, make room for our new pages by increasing the menu order
|
94 |
+
if (sizeof($posts) > 0) {
|
95 |
+
|
96 |
+
if ("after" === $post_position) {
|
97 |
+
|
98 |
+
$has_passed_ref_post = FALSE;
|
99 |
+
foreach ($posts as $one_post) {
|
100 |
+
|
101 |
+
if ($has_passed_ref_post) {
|
102 |
+
|
103 |
+
$post_update = array(
|
104 |
+
"ID" => $one_post->ID,
|
105 |
+
"menu_order" => $one_post->menu_order + $arr_post_names_count
|
106 |
+
);
|
107 |
+
$return_id = wp_update_post($post_update);
|
108 |
+
if (0 ===$return_id) die("Error: could not update post with id " . $post_update->ID);
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( ! $has_passed_ref_post && $ref_post->ID === $one_post->ID) {
|
113 |
+
$has_passed_ref_post = TRUE;
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
$new_menu_order = $ref_post->menu_order;
|
119 |
+
|
120 |
+
} elseif ("inside" === $post_position) {
|
121 |
+
|
122 |
+
// in inside, place at beginning
|
123 |
+
// so just get first post and use that menu order as base
|
124 |
+
$new_menu_order = $posts[0]->menu_order - $arr_post_names_count;
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
} else {
|
130 |
+
|
131 |
+
// no posts, start at 0
|
132 |
+
$new_menu_order = 0;
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
$post_parent_id = NULL;
|
137 |
+
if ("after" === $post_position) {
|
138 |
+
$post_parent_id = $ref_post->post_parent;
|
139 |
+
} elseif ("inside" === $post_position) {
|
140 |
+
$post_parent_id = $ref_post->ID;
|
141 |
+
}
|
142 |
+
|
143 |
+
// Done maybe updating menu orders, add the new pages
|
144 |
+
$arr_added_pages_ids = array();
|
145 |
+
foreach ($arr_post_names as $one_new_post_name) {
|
146 |
+
|
147 |
+
$new_menu_order++;
|
148 |
+
$newpost_args = array(
|
149 |
+
"menu_order" => $new_menu_order,
|
150 |
+
"post_parent" => $post_parent_id,
|
151 |
+
"post_status" => $post_status,
|
152 |
+
"post_title" => $one_new_post_name,
|
153 |
+
"post_type" => $ref_post->post_type
|
154 |
+
);
|
155 |
+
$new_post_id = wp_insert_post($newpost_args);
|
156 |
+
|
157 |
+
if (0 === $new_post_id) {
|
158 |
+
die("Error: could not add post");
|
159 |
+
}
|
160 |
+
|
161 |
+
$arr_added_pages_ids[] = $new_post_id;
|
162 |
+
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
// Done. Redirect to the first page created.
|
167 |
+
$first_post_edit_link = get_edit_post_link($arr_added_pages_ids[0], "");
|
168 |
+
wp_redirect($first_post_edit_link);
|
169 |
+
|
170 |
+
exit;
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
// for debug, remember to comment out (yes.. i *know* i will forget this later on...)
|
175 |
// require("FirePHPCore/FirePHP.class.php");
|
176 |
// $firephp = FirePHP::getInstance(true);
|
282 |
"Status_trash_ucase" => ucfirst( __("trash", 'cms-tree-page-view') ),
|
283 |
"Password_protected_page" => __("Password protected page", 'cms-tree-page-view'),
|
284 |
"Adding_page" => __("Adding page...", 'cms-tree-page-view'),
|
285 |
+
"Adding" => __("Adding ...", 'cms-tree-page-view'),
|
286 |
);
|
287 |
wp_localize_script( "cms_tree_page_view", 'cmstpv_l10n', $oLocale);
|
288 |
|
524 |
ob_start();
|
525 |
cms_tpv_print_childs(0, $cms_tpv_view, $jstree_open, $post_type);
|
526 |
$json_data = ob_get_clean();
|
527 |
+
if (! $json_data) $json_data = '{}';
|
528 |
?>
|
529 |
<script type="text/javascript">
|
530 |
cms_tpv_jsondata.<?php echo $post_type ?> = <?php echo $json_data ?>;
|
615 |
<a href="#" title='<?php _e("Edit page", "cms-tree-page-view")?>' class='cms_tpv_action_edit'><?php _e("Edit", "cms-tree-page-view")?></a>
|
616 |
<a href="#" title='<?php _e("View page", "cms-tree-page-view")?>' class='cms_tpv_action_view'><?php _e("View", "cms-tree-page-view")?></a>
|
617 |
</p>
|
618 |
+
|
619 |
+
<!-- links to add page -->
|
620 |
<p class="cms_tpv_action_add_and_edit_page">
|
621 |
+
|
622 |
<span class='cms_tpv_action_add_page'><?php echo $post_type_object->labels->add_new_item ?></span>
|
623 |
+
|
624 |
<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>
|
625 |
+
|
626 |
<?php
|
627 |
// if post type is hierarchical we can add pages inside
|
628 |
if (cms_tpv_is_post_type_hierarchical($post_type_object)) {
|
631 |
// if post status = draft then we can not add pages inside because wordpress currently can not keep its parent if we edit the page
|
632 |
?>
|
633 |
<!-- <span class="cms_tpv_action_add_page_inside_disallowed"><?php _e("Can not create page inside of a page with draft status", "cms-tree-page-view")?></span> -->
|
634 |
+
|
635 |
</p>
|
636 |
+
|
637 |
+
<div class="cms_tpv_action_add_doit">
|
638 |
+
|
639 |
+
<form method="post" action="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>">
|
640 |
+
|
641 |
+
<input type="hidden" name="action" value="cms_tpv_add_pages">
|
642 |
+
<input type="hidden" name="ref_post_id" value="">
|
643 |
+
|
644 |
+
<!-- lang for wpml -->
|
645 |
+
<input type="hidden" name="lang" value="">
|
646 |
+
|
647 |
+
<!-- <fieldset> -->
|
648 |
+
|
649 |
+
<h4><?php _e("Add page(s)", "cms-tree-page-view") ?></h4>
|
650 |
+
|
651 |
+
<div>
|
652 |
+
<!-- Pages<br> -->
|
653 |
+
<ul class="cms_tpv_action_add_doit_pages">
|
654 |
+
<li><span></span><input placeholder="<?php _e("Enter title here") ?>" type="text" name="cms_tpv_add_new_pages_names[]"></li>
|
655 |
+
</ul>
|
656 |
+
</div>
|
657 |
+
|
658 |
+
<div>
|
659 |
+
Position<br>
|
660 |
+
<label><input type="radio" name="cms_tpv_add_type" value="after"> <?php _e("After", "cms-tree-page-view") ?></label>
|
661 |
+
<label><input type="radio" name="cms_tpv_add_type" value="inside"> <?php _e("Inside", "cms-tree-page-view") ?></label>
|
662 |
+
</div>
|
663 |
+
|
664 |
+
|
665 |
+
<div>
|
666 |
+
Status<br>
|
667 |
+
<label><input type="radio" name="cms_tpv_add_status" value="draft" checked> <?php _e("Draft", "cms-tree-page-view") ?></label>
|
668 |
+
<label><input type="radio" name="cms_tpv_add_status" value="published"> <?php _e("Published", "cms-tree-page-view") ?></label>
|
669 |
+
</div>
|
670 |
+
|
671 |
+
<div>
|
672 |
+
<input type="submit" value="Add" class="button-primary">
|
673 |
+
<?php _e("or", "cms-tree-page-view") ?>
|
674 |
+
<a href="#" class="cms_tpv_add_cancel"><?php _e("cancel", "cms-tree-page-view") ?></a>
|
675 |
+
</div>
|
676 |
+
|
677 |
+
<!-- </fieldset> -->
|
678 |
+
|
679 |
+
</form>
|
680 |
+
|
681 |
+
</div>
|
682 |
+
|
683 |
<dl>
|
684 |
<dt><?php _e("Last modified", "cms-tree-page-view") ?></dt>
|
685 |
<dd>
|
689 |
<dt><?php _e("Page ID", "cms-tree-page-view") ?></dt>
|
690 |
<dd><span class="cms_tpv_page_actions_page_id"></span></dd>
|
691 |
</dl>
|
692 |
+
|
693 |
<div class="cms_tpv_page_actions_columns"></div>
|
694 |
<span class="cms_tpv_page_actions_arrow"></span>
|
695 |
</div>
|
1240 |
$post_to_save = array(
|
1241 |
"ID" => $post_node->ID,
|
1242 |
"menu_order" => 0,
|
1243 |
+
"post_parent" => $post_ref_node->ID,
|
1244 |
+
"post_type" => $post_ref_node->post_type
|
1245 |
);
|
1246 |
wp_update_post( $post_to_save );
|
1247 |
|
1262 |
$post_to_save = array(
|
1263 |
"ID" => $post_node->ID,
|
1264 |
"menu_order" => $post_ref_node->menu_order,
|
1265 |
+
"post_parent" => $post_ref_node->post_parent,
|
1266 |
+
"post_type" => $post_ref_node->post_type
|
1267 |
);
|
1268 |
wp_update_post( $post_to_save );
|
1269 |
|
1283 |
$post_to_save = array(
|
1284 |
"ID" => $post_node->ID,
|
1285 |
"menu_order" => $post_ref_node->menu_order+1,
|
1286 |
+
"post_parent" => $post_ref_node->post_parent,
|
1287 |
+
"post_type" => $post_ref_node->post_type
|
1288 |
);
|
1289 |
wp_update_post( $post_to_save );
|
1290 |
|
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
|
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
|
31 |
define( "CMS_TPV_NAME", "CMS Tree Page View");
|
32 |
|
33 |
require(dirname(__FILE__)."/functions.php");
|
@@ -63,6 +63,7 @@ add_action( 'admin_head', "cms_tpv_admin_head" );
|
|
63 |
add_action('wp_ajax_cms_tpv_get_childs', 'cms_tpv_get_childs');
|
64 |
add_action('wp_ajax_cms_tpv_move_page', 'cms_tpv_move_page');
|
65 |
add_action('wp_ajax_cms_tpv_add_page', 'cms_tpv_add_page');
|
|
|
66 |
|
67 |
// activation
|
68 |
register_activation_hook( WP_PLUGIN_DIR . "/cms-tree-page-view/index.php" , 'cms_tpv_install' );
|
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: 1.0
|
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", "1.0");
|
31 |
define( "CMS_TPV_NAME", "CMS Tree Page View");
|
32 |
|
33 |
require(dirname(__FILE__)."/functions.php");
|
63 |
add_action('wp_ajax_cms_tpv_get_childs', 'cms_tpv_get_childs');
|
64 |
add_action('wp_ajax_cms_tpv_move_page', 'cms_tpv_move_page');
|
65 |
add_action('wp_ajax_cms_tpv_add_page', 'cms_tpv_add_page');
|
66 |
+
add_action('wp_ajax_cms_tpv_add_pages', 'cms_tpv_add_pages');
|
67 |
|
68 |
// activation
|
69 |
register_activation_hook( WP_PLUGIN_DIR . "/cms-tree-page-view/index.php" , 'cms_tpv_install' );
|
languages/cms-tree-page-view.pot
CHANGED
@@ -1,257 +1,319 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: \n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
-
#: functions.php:
|
16 |
msgid "Enter title of new page"
|
17 |
msgstr ""
|
18 |
|
19 |
-
#: functions.php:
|
20 |
msgid "child pages"
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: functions.php:
|
24 |
msgid "Edit page"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: functions.php:
|
28 |
msgid "View page"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: functions.php:
|
32 |
msgid "Edit"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: functions.php:
|
36 |
msgid "View"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: functions.php:
|
40 |
msgid "Add page"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: functions.php:
|
44 |
msgid "Add new page after"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: functions.php:
|
48 |
msgid "after"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: functions.php:
|
52 |
msgid "inside"
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: functions.php:
|
56 |
msgid "Sorry, can't create a sub page to a page with status \"draft\"."
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: functions.php:
|
60 |
msgid "Sorry, can't create a sub page to a page with status \"trash\"."
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: functions.php:
|
64 |
msgid "Sorry, can't create a page after a page with status \"trash\"."
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: functions.php:
|
68 |
msgid "Add new page inside"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: functions.php:
|
72 |
msgid "draft"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: functions.php:
|
76 |
msgid "future"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: functions.php:
|
80 |
msgid "protected"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: functions.php:
|
84 |
msgid "pending"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: functions.php:
|
88 |
msgid "private"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: functions.php:
|
92 |
msgid "trash"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: functions.php:
|
96 |
msgid "Password protected page"
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: functions.php:
|
100 |
msgid "Adding page..."
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: functions.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
msgid "settings"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: functions.php:
|
108 |
msgid "Select where to show a tree for pages and custom post types"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: functions.php:
|
112 |
msgid "On dashboard"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: functions.php:
|
116 |
msgid "In menu"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: functions.php:
|
120 |
msgid "Save Changes"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#: functions.php:
|
124 |
msgid "No posts found."
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: functions.php:
|
128 |
msgid "All"
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: functions.php:
|
132 |
msgid "Public"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: functions.php:
|
136 |
msgid "Trash"
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: functions.php:
|
140 |
msgid "Expand"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: functions.php:
|
144 |
msgid "Collapse"
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: functions.php:
|
148 |
msgid "Clear search"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: functions.php:
|
152 |
msgid "Search"
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: functions.php:
|
156 |
msgid "Searching..."
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: functions.php:
|
160 |
msgid "Nothing found."
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: functions.php:
|
164 |
msgid "Loading..."
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: functions.php:
|
168 |
msgid "Search: no pages found"
|
169 |
msgstr ""
|
170 |
|
171 |
-
#: functions.php:
|
172 |
msgid "Loading tree"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: functions.php:
|
176 |
msgid "After"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: functions.php:
|
180 |
msgid "Inside"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: functions.php:
|
184 |
msgid "Can not create page inside of a page with draft status"
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: functions.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
msgid "Last modified"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: functions.php:
|
192 |
msgid "by"
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: functions.php:
|
196 |
msgid "Page ID"
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: functions.php:
|
200 |
msgid "Unknown user"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: functions.php:
|
204 |
msgid "<Untitled page>"
|
205 |
msgstr ""
|
206 |
|
207 |
-
#: functions.php:
|
208 |
msgid "Comments"
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: functions.php:
|
212 |
msgid "%s pending"
|
213 |
msgstr ""
|
214 |
|
215 |
-
#: functions.php:
|
216 |
msgctxt "comment count"
|
217 |
msgid "0"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: functions.php:
|
221 |
msgctxt "comment count"
|
222 |
msgid "1"
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: functions.php:
|
226 |
msgctxt "comment count"
|
227 |
msgid "%"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: functions.php:
|
231 |
-
msgid "
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: functions.php:
|
235 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: functions.php:
|
239 |
-
msgid "
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: functions.php:
|
243 |
msgid ""
|
244 |
-
"<
|
245 |
-
"
|
246 |
-
"
|
247 |
-
|
248 |
-
|
|
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: functions.php:
|
252 |
msgid ""
|
253 |
-
"
|
254 |
-
"
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
msgstr ""
|
1 |
+
# Copyright (C) 2012
|
2 |
# This file is distributed under the same license as the package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: \n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
|
7 |
+
"POT-Creation-Date: 2012-11-25 12:49:16+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
+
#: functions.php:257
|
16 |
msgid "Enter title of new page"
|
17 |
msgstr ""
|
18 |
|
19 |
+
#: functions.php:258
|
20 |
msgid "child pages"
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: functions.php:259 functions.php:615
|
24 |
msgid "Edit page"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: functions.php:260 functions.php:616
|
28 |
msgid "View page"
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: functions.php:261 functions.php:615
|
32 |
msgid "Edit"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: functions.php:262 functions.php:616
|
36 |
msgid "View"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: functions.php:263
|
40 |
msgid "Add page"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: functions.php:264 functions.php:624
|
44 |
msgid "Add new page after"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: functions.php:265
|
48 |
msgid "after"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: functions.php:266
|
52 |
msgid "inside"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: functions.php:267
|
56 |
msgid "Sorry, can't create a sub page to a page with status \"draft\"."
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: functions.php:268
|
60 |
msgid "Sorry, can't create a sub page to a page with status \"trash\"."
|
61 |
msgstr ""
|
62 |
|
63 |
+
#: functions.php:269
|
64 |
msgid "Sorry, can't create a page after a page with status \"trash\"."
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: functions.php:270 functions.php:629
|
68 |
msgid "Add new page inside"
|
69 |
msgstr ""
|
70 |
|
71 |
+
#: functions.php:271 functions.php:277
|
72 |
msgid "draft"
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: functions.php:272 functions.php:278
|
76 |
msgid "future"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: functions.php:273 functions.php:279
|
80 |
msgid "protected"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: functions.php:274 functions.php:280 functions.php:949
|
84 |
msgid "pending"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: functions.php:275 functions.php:281
|
88 |
msgid "private"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: functions.php:276 functions.php:282
|
92 |
msgid "trash"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: functions.php:283
|
96 |
msgid "Password protected page"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: functions.php:284
|
100 |
msgid "Adding page..."
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: functions.php:285
|
104 |
+
msgid "Adding ..."
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: functions.php:315
|
108 |
+
msgid "Settings"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: functions.php:371
|
112 |
+
msgctxt "name in menu"
|
113 |
+
msgid "Tree View"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: functions.php:391
|
117 |
msgid "settings"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: functions.php:396
|
121 |
msgid "Select where to show a tree for pages and custom post types"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: functions.php:422
|
125 |
msgid "On dashboard"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: functions.php:426
|
129 |
msgid "In menu"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: functions.php:437
|
133 |
msgid "Save Changes"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: functions.php:564
|
137 |
msgid "No posts found."
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: functions.php:570
|
141 |
msgid "All"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: functions.php:571
|
145 |
msgid "Public"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: functions.php:572
|
149 |
msgid "Trash"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: functions.php:577
|
153 |
msgid "Expand"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: functions.php:578
|
157 |
msgid "Collapse"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: functions.php:586
|
161 |
msgid "Clear search"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: functions.php:587
|
165 |
msgid "Search"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: functions.php:588
|
169 |
msgid "Searching..."
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: functions.php:589
|
173 |
msgid "Nothing found."
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: functions.php:595
|
177 |
msgid "Loading..."
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: functions.php:600
|
181 |
msgid "Search: no pages found"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: functions.php:603
|
185 |
msgid "Loading tree"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: functions.php:624 functions.php:660
|
189 |
msgid "After"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: functions.php:629 functions.php:661
|
193 |
msgid "Inside"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: functions.php:633
|
197 |
msgid "Can not create page inside of a page with draft status"
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: functions.php:649
|
201 |
+
msgid "Add page(s)"
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#: functions.php:654
|
205 |
+
msgid "Enter title here"
|
206 |
+
msgstr ""
|
207 |
+
|
208 |
+
#: functions.php:667
|
209 |
+
msgid "Draft"
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#: functions.php:668
|
213 |
+
msgid "Published"
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
+
#: functions.php:673
|
217 |
+
msgid "or"
|
218 |
+
msgstr ""
|
219 |
+
|
220 |
+
#: functions.php:674
|
221 |
+
msgid "cancel"
|
222 |
+
msgstr ""
|
223 |
+
|
224 |
+
#: functions.php:684
|
225 |
msgid "Last modified"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: functions.php:686
|
229 |
msgid "by"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: functions.php:689
|
233 |
msgid "Page ID"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: functions.php:914
|
237 |
msgid "Unknown user"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: functions.php:919
|
241 |
msgid "<Untitled page>"
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: functions.php:939
|
245 |
msgid "Comments"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: functions.php:946
|
249 |
msgid "%s pending"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: functions.php:956
|
253 |
msgctxt "comment count"
|
254 |
msgid "0"
|
255 |
msgstr ""
|
256 |
|
257 |
+
#: functions.php:956
|
258 |
msgctxt "comment count"
|
259 |
msgid "1"
|
260 |
msgstr ""
|
261 |
|
262 |
+
#: functions.php:956
|
263 |
msgctxt "comment count"
|
264 |
msgid "%"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: functions.php:1141
|
268 |
+
msgid "New page"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: functions.php:1331
|
272 |
+
msgid "Thanks for using my plugin"
|
273 |
+
msgstr ""
|
274 |
+
|
275 |
+
#: functions.php:1333
|
276 |
+
msgid ""
|
277 |
+
"Hi there! I just wanna says thanks for using my plugin. I hope you like it "
|
278 |
+
"as much as I do."
|
279 |
+
msgstr ""
|
280 |
+
|
281 |
+
#: functions.php:1334
|
282 |
+
msgid "/Pär Thernström - plugin creator"
|
283 |
+
msgstr ""
|
284 |
+
|
285 |
+
#: functions.php:1336
|
286 |
+
msgid "I like this plugin<br>– how can I thank you?"
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: functions.php:1337
|
290 |
+
msgid "There are serveral ways for you to show your appreciation:"
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: functions.php:1339
|
294 |
msgid ""
|
295 |
+
"<a href=\"%1$s\">Give it a nice review</a> over at the WordPress Plugin "
|
296 |
+
"Directory"
|
297 |
+
msgstr ""
|
298 |
+
|
299 |
+
#: functions.php:1340
|
300 |
+
msgid "<a href=\"%1$s\">Give a donation</a> – any amount will make me happy"
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: functions.php:1341
|
304 |
msgid ""
|
305 |
+
"<a href=\"%1$s\">Post a nice tweet</a> or make a nice blog post about the "
|
306 |
+
"plugin"
|
307 |
+
msgstr ""
|
308 |
+
|
309 |
+
#: functions.php:1344
|
310 |
+
msgid "Support"
|
311 |
+
msgstr ""
|
312 |
+
|
313 |
+
#: functions.php:1345
|
314 |
+
msgid "Plese see the <a href=\"%1$s\">support forum</a> for help."
|
315 |
+
msgstr ""
|
316 |
+
|
317 |
+
#: functions.php:1349
|
318 |
+
msgid "Hide until next upgrade"
|
319 |
msgstr ""
|
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.5
|
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 |
|
@@ -88,6 +88,14 @@ Now the tree with the pages will be visible both on the dashboard and in the men
|
|
88 |
|
89 |
== Changelog ==
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
= 0.10.1 =
|
92 |
- Fixed popup closing to fast on Firefox.
|
93 |
- Enable menu item setting by default for hierarchical post types during first install. It was confusing when it was enabled for pages but not for other post types. Consistency!
|
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: 1.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 |
|
88 |
|
89 |
== Changelog ==
|
90 |
|
91 |
+
= 1.0 =
|
92 |
+
- New: create multiple pages at once! Add multiple pages faster than ever before! You can ever select if the new pages should be drafts or published. And ever drag and drop the pages to get the correct order even before adding them. I know - it's awesome!
|
93 |
+
- Fixed: adds new pages with the correct and selected WPML-language
|
94 |
+
- Added: you can now change the type of a post by draging the post between different trees on the dashboard. So if you have one custom post type called "Cars" and another called "Bicycles" you can now drag a page from the cars tree to the bicicyles tree and the post will converted to that post type. Pretty powerful feature that you used to need a separately plugin to be able to do.
|
95 |
+
- Misc fixes
|
96 |
+
- Added new POT-file for translators
|
97 |
+
- I decided to call this version 1. I've been using this plugin for so long time now and I use it in almost every WordPress project I participate in (all projects with lots of pages), so with this new add-mulitple-page-feature it feels like it's time to go to version 1. Hope you'll agree! :)
|
98 |
+
|
99 |
= 0.10.1 =
|
100 |
- Fixed popup closing to fast on Firefox.
|
101 |
- Enable menu item setting by default for hierarchical post types during first install. It was confusing when it was enabled for pages but not for other post types. Consistency!
|
scripts/cms_tree_page_view.js
CHANGED
@@ -14,7 +14,7 @@ Timers:
|
|
14 |
/**
|
15 |
* Should have a module for all instead...
|
16 |
*/
|
17 |
-
var cms_tree_page_view = (function () {
|
18 |
|
19 |
var my = {},
|
20 |
privateVariable = 1;
|
@@ -24,12 +24,127 @@ var cms_tree_page_view = (function () {
|
|
24 |
}
|
25 |
|
26 |
my.moduleProperty = 1;
|
27 |
-
my.
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
};
|
30 |
|
31 |
my.init = function() {
|
32 |
my.log("init cms tree page view");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
};
|
34 |
|
35 |
/**
|
@@ -42,9 +157,13 @@ var cms_tree_page_view = (function () {
|
|
42 |
};
|
43 |
|
44 |
return my;
|
45 |
-
}());
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
|
50 |
// @todo: add prefix to treeOptions, div_actions
|
@@ -173,11 +292,22 @@ function cms_tpv_mouseover(e) {
|
|
173 |
function cms_tpv_tree_loaded(event, data) {
|
174 |
|
175 |
var $container = jQuery(event.target);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
// when mouse enters a/link
|
178 |
// start timer and if no other a/link has been moused over since it started it's ok to show this one
|
179 |
jQuery($container).on("mouseenter", "a", function(e) {
|
180 |
|
|
|
|
|
|
|
181 |
cms_tree_page_view.log("mouseenter container");
|
182 |
|
183 |
var global_timer = $container.data("cmstpv_global_link_timer");
|
@@ -191,13 +321,23 @@ function cms_tpv_tree_loaded(event, data) {
|
|
191 |
// no timer exists, overwrite with ours
|
192 |
}
|
193 |
|
194 |
-
// create new timer, no matter if one exists already
|
|
|
195 |
cms_tree_page_view.log("add timer for mousover on link");
|
196 |
-
var timeoutID = setTimeout(function(e) {
|
197 |
-
cms_tpv_mouseover_li(e);
|
198 |
-
}, 500, e);
|
199 |
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
});
|
203 |
|
@@ -217,8 +357,6 @@ function cms_tpv_tree_loaded(event, data) {
|
|
217 |
$container.find("a.hover").removeClass("hover");
|
218 |
$wrapper.find("div.cms_tpv_page_actions").removeClass("cms_tpv_page_actions_visible");
|
219 |
|
220 |
-
|
221 |
-
|
222 |
});
|
223 |
|
224 |
}
|
@@ -237,89 +375,18 @@ function cms_tpv_get_wpml_selected_lang(elm) {
|
|
237 |
function cms_tpv_get_page_actions_div(elm) {
|
238 |
return jQuery(elm).closest("div.cms_tpv_wrapper").find("div.cms_tpv_page_actions");
|
239 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
function cms_tpv_get_wrapper(elm) {
|
241 |
var $wrapper = jQuery(elm).closest("div.cms_tpv_wrapper");
|
242 |
return $wrapper;
|
243 |
}
|
244 |
|
245 |
|
246 |
-
// Click on link to add page after the current page
|
247 |
-
jQuery(document).on("click", "a.cms_tpv_action_add_page_after", function(e) {
|
248 |
-
|
249 |
-
var $this = jQuery(this);
|
250 |
-
var post_type = cms_tpv_get_post_type(this);
|
251 |
-
var selected_lang = cms_tpv_get_wpml_selected_lang(this);
|
252 |
-
|
253 |
-
var post_status = $this.closest("li").data("post_status");
|
254 |
-
|
255 |
-
// not allowed when status is trash
|
256 |
-
if (post_status == "trash") {
|
257 |
-
jAlert(cmstpv_l10n.Can_not_add_page_after_when_status_is_trash);
|
258 |
-
return false;
|
259 |
-
}
|
260 |
-
|
261 |
-
jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
|
262 |
-
if (new_page_title) {
|
263 |
-
var pageID = $this.parents("li:first").attr("id");
|
264 |
-
jQuery(".cms_tpv_message").html("<p>"+cmstpv_l10n.Adding_page+"</p>").slideDown("fast");
|
265 |
-
jQuery.post(ajaxurl, {
|
266 |
-
"action": "cms_tpv_add_page",
|
267 |
-
"pageID": pageID,
|
268 |
-
"type": "after",
|
269 |
-
"page_title": new_page_title,
|
270 |
-
"post_type": post_type,
|
271 |
-
"wpml_lang": selected_lang
|
272 |
-
}, function(data, textStatus) {
|
273 |
-
document.location = data;
|
274 |
-
});
|
275 |
-
}
|
276 |
-
});
|
277 |
-
|
278 |
-
return false;
|
279 |
-
});
|
280 |
-
|
281 |
-
// Click on link to add page insde another page
|
282 |
-
jQuery(document).on("click", "a.cms_tpv_action_add_page_inside", function(e) {
|
283 |
-
var $this = jQuery(this);
|
284 |
-
var post_type = cms_tpv_get_post_type(this);
|
285 |
-
var selected_lang = cms_tpv_get_wpml_selected_lang(this);
|
286 |
-
|
287 |
-
var post_status = $this.closest("li").data("post_status");
|
288 |
-
|
289 |
-
// check page status, because we cant add a page inside a page with status draft or status trash
|
290 |
-
// if we edit the page wordpress will forget the parent
|
291 |
-
//$li.data("jstree").permalink;
|
292 |
-
//var post_status = li.data("jstree").post_status;
|
293 |
-
if (post_status == "draft") {
|
294 |
-
jAlert(cmstpv_l10n.Can_not_add_sub_page_when_status_is_draft);
|
295 |
-
return false;
|
296 |
-
}
|
297 |
-
|
298 |
-
// not allowed when status is trash
|
299 |
-
if (post_status == "trash") {
|
300 |
-
jAlert(cmstpv_l10n.Can_not_add_sub_page_when_status_is_trash);
|
301 |
-
return false;
|
302 |
-
}
|
303 |
-
|
304 |
-
jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
|
305 |
-
if (new_page_title) {
|
306 |
-
var pageID = $this.parents("li:first").attr("id");
|
307 |
-
jQuery(".cms_tpv_message").html("<p>" + cmstpv_l10n.Adding_page + "</p>").slideDown("fast");
|
308 |
-
jQuery.post(ajaxurl, {
|
309 |
-
"action": "cms_tpv_add_page",
|
310 |
-
"pageID": pageID,
|
311 |
-
"type": "inside",
|
312 |
-
"page_title": new_page_title,
|
313 |
-
"post_type": post_type,
|
314 |
-
"wpml_lang": selected_lang
|
315 |
-
}, function(data, textStatus) {
|
316 |
-
document.location = data;
|
317 |
-
});
|
318 |
-
}
|
319 |
-
});
|
320 |
-
return false;
|
321 |
-
});
|
322 |
-
|
323 |
|
324 |
|
325 |
// check if tree is beging dragged
|
@@ -334,8 +401,8 @@ function cms_tpv_mouseover_li(e) {
|
|
334 |
|
335 |
var $target = jQuery(e.target);
|
336 |
var $li = $target.closest("li");
|
337 |
-
|
338 |
var div_actions_for_post_type = cms_tpv_get_page_actions_div($li);
|
|
|
339 |
var $cms_tpv_container = $li.closest("div.cms_tpv_container");
|
340 |
|
341 |
if (cms_tpv_is_dragging() === false) {
|
@@ -347,6 +414,9 @@ function cms_tpv_mouseover_li(e) {
|
|
347 |
// do nada
|
348 |
} else {
|
349 |
|
|
|
|
|
|
|
350 |
// Remove classes on all elements
|
351 |
$cms_tpv_container.find("li.has-visible-actions").removeClass("has-visible-actions");
|
352 |
$cms_tpv_container.find("a.hover").removeClass("hover");
|
@@ -374,12 +444,11 @@ function cms_tpv_mouseover_li(e) {
|
|
374 |
|
375 |
// add post title as headline
|
376 |
div_actions_for_post_type.find(".cms_tpv_page_actions_headline").html( $li.data("post_title") );
|
|
|
|
|
|
|
377 |
|
378 |
// position and show action div
|
379 |
-
|
380 |
-
//console.log( jQuery(window).position() );
|
381 |
-
//console.log( jQuery(window).offset() );
|
382 |
-
|
383 |
var $a = $li.find("a");
|
384 |
var width = $a.outerWidth(true);
|
385 |
var new_offset = div_actions_for_post_type.offset();
|
@@ -402,7 +471,6 @@ function cms_tpv_mouseover_li(e) {
|
|
402 |
} else {
|
403 |
div_actions_for_post_type.removeClass("cms_tpv_page_actions_visible_from_bottom");
|
404 |
}
|
405 |
-
|
406 |
|
407 |
// check if user is allowed to edit page
|
408 |
var $cms_tpv_action_add_and_edit_page = div_actions_for_post_type.find(".cms_tpv_action_add_and_edit_page");
|
@@ -434,14 +502,19 @@ jQuery(document).on("mouseleave", "div.cms_tpv_container", function(e) {
|
|
434 |
var $wrapper = $container.closest("div.cms_tpv_wrapper");
|
435 |
var t = this;
|
436 |
|
437 |
-
//
|
438 |
var global_timer = $container.data("cmstpv_global_link_timer");
|
439 |
if (global_timer) {
|
440 |
cms_tree_page_view.log("clear global timer");
|
441 |
clearTimeout(global_timer);
|
442 |
}
|
443 |
|
444 |
-
// hide
|
|
|
|
|
|
|
|
|
|
|
445 |
var hideTimer = setTimeout(function() {
|
446 |
|
447 |
cms_tree_page_view.log("maybe hide popup because outside container");
|
@@ -461,26 +534,22 @@ jQuery(document).on("mouseleave", "div.cms_tpv_container", function(e) {
|
|
461 |
|
462 |
}, 500);
|
463 |
|
464 |
-
|
465 |
|
466 |
});
|
467 |
|
468 |
-
|
469 |
-
|
470 |
jQuery(document).on("mouseenter", "div.cms_tpv_page_actions", function(e) {
|
471 |
|
472 |
var $this = jQuery(this);
|
473 |
var $wrapper = $this.closest("div.cms_tpv_wrapper");
|
474 |
var $container = $wrapper.find("div.cms_tpv_container");
|
475 |
-
var
|
476 |
-
console.log(
|
477 |
-
|
478 |
-
console.log("clearedIt!");
|
479 |
-
clearTimeout(hideTimer);
|
480 |
-
}
|
481 |
|
482 |
});
|
483 |
-
*/
|
484 |
|
485 |
|
486 |
// When mouse enter the whole cms tree page view-area/div
|
@@ -528,22 +597,24 @@ function cms_tpv_bind_clean_node() {
|
|
528 |
data.r - the drop target
|
529 |
*/
|
530 |
|
|
|
|
|
531 |
if (nodePosition == "before") {
|
532 |
-
|
533 |
ref_node_id = jQuery( nodeRef ).attr( "id" );
|
534 |
} else if (nodePosition == "after") {
|
535 |
-
|
536 |
ref_node_id = jQuery( nodeR ).attr( "id" );
|
537 |
} else if (nodePosition == "inside") {
|
538 |
-
|
539 |
ref_node_id = jQuery( nodeR ).attr( "id" );
|
540 |
}
|
541 |
|
542 |
// Update parent or menu order
|
543 |
jQuery.post(ajaxurl, {
|
544 |
-
action: "cms_tpv_move_page",
|
545 |
-
"node_id": node_id,
|
546 |
-
"ref_node_id": ref_node_id,
|
547 |
"type": nodePosition,
|
548 |
"icl_post_language": selected_lang
|
549 |
}, function(data, textStatus) {
|
@@ -667,6 +738,7 @@ jQuery(document).on("click", "a.cms_tvp_view_trash", function() {
|
|
667 |
|
668 |
// change lang
|
669 |
jQuery(document).on("click", "a.cms_tvp_switch_lang", function(e) {
|
|
|
670 |
$wrapper = cms_tpv_get_wrapper(this);
|
671 |
$wrapper.find("ul.cms_tvp_switch_langs a").removeClass("current");
|
672 |
jQuery(this).addClass("current");
|
@@ -683,6 +755,11 @@ jQuery(document).on("click", "a.cms_tvp_switch_lang", function(e) {
|
|
683 |
|
684 |
});
|
685 |
|
|
|
|
|
|
|
|
|
|
|
686 |
function cms_tpv_get_current_view(elm) {
|
687 |
|
688 |
$wrapper = cms_tpv_get_wrapper(elm);
|
@@ -703,9 +780,11 @@ function cms_tvp_set_view(view, elm) {
|
|
703 |
|
704 |
var div_actions_for_post_type = cms_tpv_get_page_actions_div(elm);
|
705 |
$wrapper.append(div_actions_for_post_type);
|
706 |
-
|
707 |
$wrapper.find(".cms_tvp_view_all, .cms_tvp_view_public, .cms_tvp_view_trash").removeClass("current");
|
708 |
$wrapper.find(".cms_tpv_container").jstree("destroy").html("");
|
|
|
|
|
|
|
709 |
cms_tpv_bind_clean_node();
|
710 |
|
711 |
if (view == "all") {
|
@@ -717,13 +796,6 @@ function cms_tvp_set_view(view, elm) {
|
|
717 |
} else {
|
718 |
|
719 |
}
|
720 |
-
|
721 |
-
// Hide actions if open
|
722 |
-
var $cms_tpv_container = $wrapper.find("div.cms_tpv_container");
|
723 |
-
$cms_tpv_container.find("li.has-visible-actions").removeClass("has-visible-actions");
|
724 |
-
$cms_tpv_container.find("a.hover").removeClass("hover");
|
725 |
-
$cms_tpv_container.find("div.cms_tpv_page_actions").removeClass("cms_tpv_page_actions_visible");
|
726 |
-
jQuery("div.cms_tpv_page_actions_visible").removeClass("cms_tpv_page_actions_visible");
|
727 |
|
728 |
var treeOptionsTmp = jQuery.extend(true, {}, treeOptions);
|
729 |
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);
|
@@ -731,10 +803,4 @@ function cms_tvp_set_view(view, elm) {
|
|
731 |
$wrapper.find(".cms_tpv_container").bind("loaded.jstree open_node.jstree", cms_tpv_tree_loaded);
|
732 |
$wrapper.find(".cms_tpv_container").jstree(treeOptionsTmp);
|
733 |
|
734 |
-
/*
|
735 |
-
__calback loaded jquery.jstree.js:238
|
736 |
-
__calback reopen jquery.jstree.js:238
|
737 |
-
__calback reload_nodes
|
738 |
-
*/
|
739 |
-
|
740 |
}
|
14 |
/**
|
15 |
* Should have a module for all instead...
|
16 |
*/
|
17 |
+
var cms_tree_page_view = (function ($) {
|
18 |
|
19 |
var my = {},
|
20 |
privateVariable = 1;
|
24 |
}
|
25 |
|
26 |
my.moduleProperty = 1;
|
27 |
+
my.elements = {};
|
28 |
+
|
29 |
+
my.selectors = {
|
30 |
+
containers: "div.cms_tpv_container",
|
31 |
+
action_div: "div.cms_tpv_page_actions",
|
32 |
+
action_doit: "div.cms_tpv_action_add_doit"
|
33 |
};
|
34 |
|
35 |
my.init = function() {
|
36 |
my.log("init cms tree page view");
|
37 |
+
my.setup_elements();
|
38 |
+
my.setup_listeners();
|
39 |
+
};
|
40 |
+
|
41 |
+
// this is wrong, the action div and doit should be for each container, not for all
|
42 |
+
my.setup_elements = function() {
|
43 |
+
for (var elm in my.selectors) {
|
44 |
+
if (my.selectors.hasOwnProperty(elm))
|
45 |
+
my.elements[elm] = $(my.selectors[elm]);
|
46 |
+
}
|
47 |
+
};
|
48 |
+
|
49 |
+
my.setup_listeners = function() {
|
50 |
+
|
51 |
+
// When something has been written in one of the page titles: show another row
|
52 |
+
// Also: if more than one row are empty at the end, remove all but the last
|
53 |
+
$(document).on("keyup", "ul.cms_tpv_action_add_doit_pages li:last-child input", function(e) {
|
54 |
+
my.log(123);
|
55 |
+
var $t = $(this);
|
56 |
+
var $li = $t.closest("li");
|
57 |
+
|
58 |
+
if ($.trim($t.val()) !== "") {
|
59 |
+
|
60 |
+
var $new_li = $li.clone().hide();
|
61 |
+
$new_li.find("input").val("");
|
62 |
+
$li.after( $new_li );
|
63 |
+
$new_li.slideDown();
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
});
|
68 |
+
|
69 |
+
// Click on cancel-link = hide add-div
|
70 |
+
jQuery(document).on("click", "a.cms_tpv_add_cancel", function(e) {
|
71 |
+
|
72 |
+
e.preventDefault();
|
73 |
+
var actions_div_doit = cms_tpv_get_page_actions_div_doit(this);
|
74 |
+
actions_div_doit.slideUp("fast", function() {
|
75 |
+
|
76 |
+
// Reset status back to draft
|
77 |
+
$("input[name='cms_tpv_add_status'][value='draft']").attr("checked", true);
|
78 |
+
|
79 |
+
// Remove all LIs except the last one
|
80 |
+
$("ul.cms_tpv_action_add_doit_pages").find("li:not(:last)").remove();
|
81 |
+
|
82 |
+
});
|
83 |
+
|
84 |
+
});
|
85 |
+
|
86 |
+
// Click on link to add pages
|
87 |
+
jQuery(document).on("click", "a.cms_tpv_action_add_page_after, a.cms_tpv_action_add_page_inside", function(e) {
|
88 |
+
|
89 |
+
e.preventDefault();
|
90 |
+
var $this = jQuery(this);
|
91 |
+
var post_type = cms_tpv_get_post_type(this);
|
92 |
+
var selected_lang = cms_tpv_get_wpml_selected_lang(this);
|
93 |
+
var actions_div = cms_tpv_get_page_actions_div(this);
|
94 |
+
var actions_div_doit = cms_tpv_get_page_actions_div_doit(this);
|
95 |
+
var post_status = actions_div.data("post_status");
|
96 |
+
|
97 |
+
var add_type = "";
|
98 |
+
if ($this.hasClass("cms_tpv_action_add_page_after")) {
|
99 |
+
add_type = "after";
|
100 |
+
} else if ($this.hasClass("cms_tpv_action_add_page_inside")) {
|
101 |
+
add_type = "inside";
|
102 |
+
}
|
103 |
+
|
104 |
+
// not allowed when status is trash
|
105 |
+
if (post_status === "trash" && add_type === "inside") {
|
106 |
+
jAlert(cmstpv_l10n.Can_not_add_page_after_when_status_is_trash);
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
// if status is draft then it's not ok to add sub pages
|
111 |
+
if (post_status === "draft" && add_type === "inside") {
|
112 |
+
jAlert(cmstpv_l10n.Can_not_add_sub_page_when_status_is_draft);
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
|
116 |
+
// Make the list sortable
|
117 |
+
$("ul.cms_tpv_action_add_doit_pages").sortable({
|
118 |
+
"axis": "y",
|
119 |
+
"items": "> li:not(:last)",
|
120 |
+
"containment": 'parent',
|
121 |
+
"forceHelperSize": true,
|
122 |
+
"forcePlaceholderSize": true,
|
123 |
+
"handle": "span:first",
|
124 |
+
"placeholder": "ui-state-highlight"
|
125 |
+
});
|
126 |
+
|
127 |
+
// Set up correct values for input fields and radio buttons and then show form/section
|
128 |
+
actions_div_doit.find("[name='lang']").val(selected_lang);
|
129 |
+
actions_div_doit.find("[name='cms_tpv_add_type'][value='"+add_type+"']").attr("checked", "checked");
|
130 |
+
actions_div_doit.find("[name='ref_post_id']").val( actions_div.data("post_id") );
|
131 |
+
actions_div_doit.slideDown("fast", function() {
|
132 |
+
actions_div_doit.find("[name='cms_tpv_add_new_pages_names[]']").focus();
|
133 |
+
});
|
134 |
+
|
135 |
+
|
136 |
+
}); // click add page
|
137 |
+
|
138 |
+
// submit form with new pages
|
139 |
+
jQuery(document).on("submit", "div.cms_tpv_action_add_doit form", function(e) {
|
140 |
+
|
141 |
+
//e.preventDefault();
|
142 |
+
|
143 |
+
var $form = $(this);
|
144 |
+
$form.find("input[type='submit']").val( cmstpv_l10n.Adding ).attr("disabled", true);
|
145 |
+
|
146 |
+
});
|
147 |
+
|
148 |
};
|
149 |
|
150 |
/**
|
157 |
};
|
158 |
|
159 |
return my;
|
|
|
160 |
|
161 |
+
}(jQuery));
|
162 |
+
|
163 |
+
// Bott it up on domready
|
164 |
+
jQuery(function() {
|
165 |
+
cms_tree_page_view.init();
|
166 |
+
});
|
167 |
|
168 |
|
169 |
// @todo: add prefix to treeOptions, div_actions
|
292 |
function cms_tpv_tree_loaded(event, data) {
|
293 |
|
294 |
var $container = jQuery(event.target);
|
295 |
+
var actions_div_doit = cms_tpv_get_page_actions_div_doit(event.target);
|
296 |
+
|
297 |
+
// init = clear up some things
|
298 |
+
actions_div_doit.hide();
|
299 |
+
$container.find("li.has-visible-actions").removeClass("has-visible-actions");
|
300 |
+
$container.find("a.hover").removeClass("hover");
|
301 |
+
$container.find("div.cms_tpv_page_actions").removeClass("cms_tpv_page_actions_visible");
|
302 |
+
$container.find("div.cms_tpv_page_actions_visible").removeClass("cms_tpv_page_actions_visible");
|
303 |
|
304 |
// when mouse enters a/link
|
305 |
// start timer and if no other a/link has been moused over since it started it's ok to show this one
|
306 |
jQuery($container).on("mouseenter", "a", function(e) {
|
307 |
|
308 |
+
// Don't activate if entered on ins-tag. We use that only for drag and drop
|
309 |
+
// if (e.relatedTarget && e.relatedTarget.tagName === "INS") return;
|
310 |
+
|
311 |
cms_tree_page_view.log("mouseenter container");
|
312 |
|
313 |
var global_timer = $container.data("cmstpv_global_link_timer");
|
321 |
// no timer exists, overwrite with ours
|
322 |
}
|
323 |
|
324 |
+
// create new timer to show action div, no matter if one exists already
|
325 |
+
// but not if we are creating new pages
|
326 |
cms_tree_page_view.log("add timer for mousover on link");
|
|
|
|
|
|
|
327 |
|
328 |
+
if ( ! actions_div_doit.is(":visible") ) {
|
329 |
+
|
330 |
+
var timeoutID = setTimeout(function(e) {
|
331 |
+
cms_tpv_mouseover_li(e);
|
332 |
+
}, 500, e);
|
333 |
+
|
334 |
+
console.log("timer added");
|
335 |
+
|
336 |
+
$container.data("cmstpv_global_link_timer", timeoutID);
|
337 |
+
|
338 |
+
} else {
|
339 |
+
console.log("timer not added because doit visible");
|
340 |
+
}
|
341 |
|
342 |
});
|
343 |
|
357 |
$container.find("a.hover").removeClass("hover");
|
358 |
$wrapper.find("div.cms_tpv_page_actions").removeClass("cms_tpv_page_actions_visible");
|
359 |
|
|
|
|
|
360 |
});
|
361 |
|
362 |
}
|
375 |
function cms_tpv_get_page_actions_div(elm) {
|
376 |
return jQuery(elm).closest("div.cms_tpv_wrapper").find("div.cms_tpv_page_actions");
|
377 |
}
|
378 |
+
|
379 |
+
function cms_tpv_get_page_actions_div_doit(elm) {
|
380 |
+
return jQuery(elm).closest("div.cms_tpv_wrapper").find("div.cms_tpv_action_add_doit");
|
381 |
+
}
|
382 |
+
|
383 |
+
|
384 |
function cms_tpv_get_wrapper(elm) {
|
385 |
var $wrapper = jQuery(elm).closest("div.cms_tpv_wrapper");
|
386 |
return $wrapper;
|
387 |
}
|
388 |
|
389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
|
391 |
|
392 |
// check if tree is beging dragged
|
401 |
|
402 |
var $target = jQuery(e.target);
|
403 |
var $li = $target.closest("li");
|
|
|
404 |
var div_actions_for_post_type = cms_tpv_get_page_actions_div($li);
|
405 |
+
var actions_div_doit = cms_tpv_get_page_actions_div_doit($li);
|
406 |
var $cms_tpv_container = $li.closest("div.cms_tpv_container");
|
407 |
|
408 |
if (cms_tpv_is_dragging() === false) {
|
414 |
// do nada
|
415 |
} else {
|
416 |
|
417 |
+
// Add info to the action div from the li
|
418 |
+
div_actions_for_post_type.data("post_status", $li.data("post_status"));
|
419 |
+
|
420 |
// Remove classes on all elements
|
421 |
$cms_tpv_container.find("li.has-visible-actions").removeClass("has-visible-actions");
|
422 |
$cms_tpv_container.find("a.hover").removeClass("hover");
|
444 |
|
445 |
// add post title as headline
|
446 |
div_actions_for_post_type.find(".cms_tpv_page_actions_headline").html( $li.data("post_title") );
|
447 |
+
|
448 |
+
// add post id to data
|
449 |
+
div_actions_for_post_type.data("post_id", $li.data("post_id"));
|
450 |
|
451 |
// position and show action div
|
|
|
|
|
|
|
|
|
452 |
var $a = $li.find("a");
|
453 |
var width = $a.outerWidth(true);
|
454 |
var new_offset = div_actions_for_post_type.offset();
|
471 |
} else {
|
472 |
div_actions_for_post_type.removeClass("cms_tpv_page_actions_visible_from_bottom");
|
473 |
}
|
|
|
474 |
|
475 |
// check if user is allowed to edit page
|
476 |
var $cms_tpv_action_add_and_edit_page = div_actions_for_post_type.find(".cms_tpv_action_add_and_edit_page");
|
502 |
var $wrapper = $container.closest("div.cms_tpv_wrapper");
|
503 |
var t = this;
|
504 |
|
505 |
+
// Reset global timer
|
506 |
var global_timer = $container.data("cmstpv_global_link_timer");
|
507 |
if (global_timer) {
|
508 |
cms_tree_page_view.log("clear global timer");
|
509 |
clearTimeout(global_timer);
|
510 |
}
|
511 |
|
512 |
+
// Don't hide if in add-pages-mode
|
513 |
+
var actions_div_doit = cms_tpv_get_page_actions_div_doit(this);
|
514 |
+
if ( actions_div_doit.is(":visible") )
|
515 |
+
return;
|
516 |
+
|
517 |
+
// Maybe hide popup after a short while
|
518 |
var hideTimer = setTimeout(function() {
|
519 |
|
520 |
cms_tree_page_view.log("maybe hide popup because outside container");
|
534 |
|
535 |
}, 500);
|
536 |
|
537 |
+
$container.data("cmstpv_global_link_timer", hideTimer);
|
538 |
|
539 |
});
|
540 |
|
541 |
+
// When mouse enters actions div then cancel possibly global hide timer
|
542 |
+
// If moved outside container and then back, cancel possibly global timer
|
543 |
jQuery(document).on("mouseenter", "div.cms_tpv_page_actions", function(e) {
|
544 |
|
545 |
var $this = jQuery(this);
|
546 |
var $wrapper = $this.closest("div.cms_tpv_wrapper");
|
547 |
var $container = $wrapper.find("div.cms_tpv_container");
|
548 |
+
var timer = $container.data("cmstpv_global_link_timer");
|
549 |
+
// console.log("back to action div");
|
550 |
+
clearTimeout(timer);
|
|
|
|
|
|
|
551 |
|
552 |
});
|
|
|
553 |
|
554 |
|
555 |
// When mouse enter the whole cms tree page view-area/div
|
597 |
data.r - the drop target
|
598 |
*/
|
599 |
|
600 |
+
var node_id,
|
601 |
+
ref_node_id;
|
602 |
if (nodePosition == "before") {
|
603 |
+
node_id = jQuery( nodeBeingMoved ).attr( "id" );
|
604 |
ref_node_id = jQuery( nodeRef ).attr( "id" );
|
605 |
} else if (nodePosition == "after") {
|
606 |
+
node_id = jQuery( nodeBeingMoved ).attr( "id" );
|
607 |
ref_node_id = jQuery( nodeR ).attr( "id" );
|
608 |
} else if (nodePosition == "inside") {
|
609 |
+
node_id = jQuery( nodeBeingMoved ).attr( "id" );
|
610 |
ref_node_id = jQuery( nodeR ).attr( "id" );
|
611 |
}
|
612 |
|
613 |
// Update parent or menu order
|
614 |
jQuery.post(ajaxurl, {
|
615 |
+
action: "cms_tpv_move_page",
|
616 |
+
"node_id": node_id,
|
617 |
+
"ref_node_id": ref_node_id,
|
618 |
"type": nodePosition,
|
619 |
"icl_post_language": selected_lang
|
620 |
}, function(data, textStatus) {
|
738 |
|
739 |
// change lang
|
740 |
jQuery(document).on("click", "a.cms_tvp_switch_lang", function(e) {
|
741 |
+
|
742 |
$wrapper = cms_tpv_get_wrapper(this);
|
743 |
$wrapper.find("ul.cms_tvp_switch_langs a").removeClass("current");
|
744 |
jQuery(this).addClass("current");
|
755 |
|
756 |
});
|
757 |
|
758 |
+
function cms_tpv_hide_action_div() {
|
759 |
+
|
760 |
+
}
|
761 |
+
|
762 |
+
|
763 |
function cms_tpv_get_current_view(elm) {
|
764 |
|
765 |
$wrapper = cms_tpv_get_wrapper(elm);
|
780 |
|
781 |
var div_actions_for_post_type = cms_tpv_get_page_actions_div(elm);
|
782 |
$wrapper.append(div_actions_for_post_type);
|
|
|
783 |
$wrapper.find(".cms_tvp_view_all, .cms_tvp_view_public, .cms_tvp_view_trash").removeClass("current");
|
784 |
$wrapper.find(".cms_tpv_container").jstree("destroy").html("");
|
785 |
+
|
786 |
+
$wrapper.find("div.cms_tpv_page_actions").removeClass("cms_tpv_page_actions_visible");
|
787 |
+
|
788 |
cms_tpv_bind_clean_node();
|
789 |
|
790 |
if (view == "all") {
|
796 |
} else {
|
797 |
|
798 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
799 |
|
800 |
var treeOptionsTmp = jQuery.extend(true, {}, treeOptions);
|
801 |
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);
|
803 |
$wrapper.find(".cms_tpv_container").bind("loaded.jstree open_node.jstree", cms_tpv_tree_loaded);
|
804 |
$wrapper.find(".cms_tpv_container").jstree(treeOptionsTmp);
|
805 |
|
|
|
|
|
|
|
|
|
|
|
|
|
806 |
}
|
styles/styles.css
CHANGED
@@ -229,8 +229,7 @@
|
|
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 |
-
|
233 |
-
width: 175px;
|
234 |
height: auto;
|
235 |
background-color: white;
|
236 |
position: absolute;
|
@@ -357,15 +356,6 @@ p.cms_tpv_action_edit_and_view
|
|
357 |
|
358 |
.cms_tpv_page_actions_arrow {
|
359 |
display: none;
|
360 |
-
/*
|
361 |
-
width: 8px;
|
362 |
-
height: 15px;
|
363 |
-
background: url(images/arrow-left.gif) no-repeat top left;
|
364 |
-
position: absolute;
|
365 |
-
display: block;
|
366 |
-
left: -8px;
|
367 |
-
left: 0px;
|
368 |
-
*/
|
369 |
}
|
370 |
|
371 |
.cms_tpv_page_actions_columns table td {
|
@@ -377,10 +367,6 @@ p.cms_tpv_action_edit_and_view
|
|
377 |
padding-right: 2px;
|
378 |
vertical-align: middle;
|
379 |
}
|
380 |
-
.cms_tpv_page_actions_columns .post-com-count-wrapper {
|
381 |
-
}
|
382 |
-
.cms_tpv_wrapper .cms_tpv_page_actions_columns a.post-com-count {
|
383 |
-
}
|
384 |
|
385 |
li.cms_tpv_user_can_edit_page_no a {
|
386 |
opacity: .6; /* Standard: FF gt 1.5, Opera, Safari */
|
@@ -403,3 +389,66 @@ h4.cms_tpv_page_actions_headline {
|
|
403 |
border-left: 1px solid #E3E3E3;
|
404 |
}
|
405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
width: 200px;
|
|
|
233 |
height: auto;
|
234 |
background-color: white;
|
235 |
position: absolute;
|
356 |
|
357 |
.cms_tpv_page_actions_arrow {
|
358 |
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
}
|
360 |
|
361 |
.cms_tpv_page_actions_columns table td {
|
367 |
padding-right: 2px;
|
368 |
vertical-align: middle;
|
369 |
}
|
|
|
|
|
|
|
|
|
370 |
|
371 |
li.cms_tpv_user_can_edit_page_no a {
|
372 |
opacity: .6; /* Standard: FF gt 1.5, Opera, Safari */
|
389 |
border-left: 1px solid #E3E3E3;
|
390 |
}
|
391 |
|
392 |
+
.cms_tpv_action_add_doit {
|
393 |
+
/*background-color: lightyellow;*/
|
394 |
+
display: none;
|
395 |
+
}
|
396 |
+
|
397 |
+
.cms_tpv_action_add_doit fieldset {
|
398 |
+
border: 1px solid #ddd;
|
399 |
+
border-left-width: 0;
|
400 |
+
border-right-width: 0;
|
401 |
+
padding: .75em .25em .75em 0;
|
402 |
+
}
|
403 |
+
|
404 |
+
.cms_tpv_action_add_doit h4,
|
405 |
+
.cms_tpv_action_add_doit legend {
|
406 |
+
margin: 0;
|
407 |
+
}
|
408 |
+
|
409 |
+
.cms_tpv_action_add_doit form > div {
|
410 |
+
margin-top: .75em;
|
411 |
+
}
|
412 |
+
.cms_tpv_action_add_doit form > div:first-of-type {
|
413 |
+
margin-top: 0;
|
414 |
+
}
|
415 |
+
|
416 |
+
.cms_tpv_action_add_doit label {
|
417 |
+
margin-right: .5em;
|
418 |
+
}
|
419 |
+
|
420 |
+
ul.cms_tpv_action_add_doit_pages .ui-state-highlight {
|
421 |
+
display: block;
|
422 |
+
}
|
423 |
+
|
424 |
+
ul.cms_tpv_action_add_doit_pages {
|
425 |
+
position: relative;
|
426 |
+
margin: 0 0 0 -10px;
|
427 |
+
padding: 0;
|
428 |
+
overflow: auto;
|
429 |
+
}
|
430 |
+
.cms_tpv_action_add_doit_pages li {
|
431 |
+
display: block;
|
432 |
+
position: relative;
|
433 |
+
float: left;
|
434 |
+
padding: 0 0 0 0;
|
435 |
+
margin: 1px 0 1px 0;
|
436 |
+
}
|
437 |
+
.cms_tpv_action_add_doit_pages input {
|
438 |
+
float: left;
|
439 |
+
width: 90%;
|
440 |
+
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;
|
441 |
+
}
|
442 |
+
.cms_tpv_action_add_doit_pages span:first-child {
|
443 |
+
background: transparent url(https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/ui-darkness/images/ui-icons_222222_256x240.png) no-repeat -2px -228px;
|
444 |
+
margin-top: 7px;
|
445 |
+
margin-right: 3px;
|
446 |
+
float: left;
|
447 |
+
width: 8px;
|
448 |
+
height: 10px;
|
449 |
+
cursor: move;
|
450 |
+
}
|
451 |
+
|
452 |
+
.cms_tpv_action_add_doit_pages li:last-child span:first-child {
|
453 |
+
visibility: hidden;
|
454 |
+
}
|