Version Description
- tree is activated for pages during install, so the user does not need to set up anything during first run
Download this release
Release Info
Developer | eskapism |
Plugin | CMS Tree Page View |
Version | 0.6.3 |
Comparing to | |
See all releases |
Code changes from version 0.6.1 to 0.6.3
- functions.php +315 -115
- index.php +6 -3
- languages/cms-tree-page-view-de_DE.mo +0 -0
- languages/cms-tree-page-view-de_DE.po +163 -0
- readme.txt +48 -6
- screenshot-6.png +0 -0
- screenshot-7.png +0 -0
- scripts/cms_tree_page_view.js +166 -100
- styles/styles.css +37 -25
functions.php
CHANGED
@@ -19,10 +19,10 @@ function cms_tpv_admin_head() {
|
|
19 |
|
20 |
<!--[if IE 6]>
|
21 |
<style>
|
22 |
-
|
23 |
display: none !important;
|
24 |
}
|
25 |
-
|
26 |
}
|
27 |
</style>
|
28 |
<![endif]-->
|
@@ -31,7 +31,9 @@ function cms_tpv_admin_head() {
|
|
31 |
|
32 |
function cms_tpv_admin_init() {
|
33 |
|
34 |
-
|
|
|
|
|
35 |
wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
|
36 |
wp_enqueue_style( "jquery-alerts", CMS_TPV_URL . "styles/jquery.alerts.css", false, CMS_TPV_VERSION );
|
37 |
wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.biscuit.js", array("jquery")); // renamed from cookie to fix problems with mod_security
|
@@ -39,6 +41,9 @@ function cms_tpv_admin_init() {
|
|
39 |
wp_enqueue_script( "jquery-alerts", CMS_TPV_URL . "scripts/jquery.alerts.js", false, CMS_TPV_VERSION);
|
40 |
|
41 |
wp_enqueue_script( "cms_tree_page_view", CMS_TPV_URL . "scripts/cms_tree_page_view.js", false, CMS_TPV_VERSION);
|
|
|
|
|
|
|
42 |
|
43 |
load_plugin_textdomain('cms-tree-page-view', WP_CONTENT_DIR . "/plugins/languages", "/cms-tree-page-view/languages");
|
44 |
$oLocale = array(
|
@@ -64,42 +69,66 @@ function cms_tpv_admin_init() {
|
|
64 |
|
65 |
}
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
-
|
74 |
-
if ( get_option('cms_tpv_show_on_dashboard', 1) == 1 && current_user_can("edit_pages") ) {
|
75 |
-
return true;
|
76 |
-
} else {
|
77 |
-
return false;
|
78 |
-
}
|
79 |
}
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
}
|
86 |
}
|
87 |
|
|
|
88 |
/**
|
89 |
* Output on dashboard
|
90 |
*/
|
91 |
-
function cms_tpv_dashboard() {
|
92 |
-
|
93 |
cms_tpv_show_annoying_box();
|
94 |
-
cms_tpv_print_common_tree_stuff();
|
95 |
-
|
96 |
}
|
97 |
|
98 |
function cms_tpv_admin_menu() {
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
|
|
102 |
add_submenu_page( 'options-general.php' , CMS_TPV_NAME, CMS_TPV_NAME, "administrator", "cms-tpv-options", "cms_tpv_options");
|
|
|
103 |
}
|
104 |
|
105 |
|
@@ -107,6 +136,29 @@ function cms_tpv_admin_menu() {
|
|
107 |
* Output options page
|
108 |
*/
|
109 |
function cms_tpv_options() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
?>
|
111 |
|
112 |
<div class="wrap">
|
@@ -114,88 +166,197 @@ function cms_tpv_options() {
|
|
114 |
|
115 |
<form method="post" action="options.php">
|
116 |
<?php wp_nonce_field('update-options'); ?>
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
<input type="hidden" name="action" value="update" />
|
133 |
-
<input type="hidden" name="
|
|
|
134 |
<p class="submit">
|
135 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes', 'cms-tree-page-view') ?>" />
|
136 |
</p>
|
137 |
</form>
|
138 |
-
</div>
|
139 |
|
140 |
<?php
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
/**
|
145 |
* Print tree stuff that is common for both dashboard and page
|
146 |
*/
|
147 |
-
function cms_tpv_print_common_tree_stuff() {
|
148 |
-
$pages = cms_tpv_get_pages();
|
149 |
-
if (empty($pages)) {
|
150 |
-
echo '<div class="updated fade below-h2"><p>' . __("No pages found. Maybe you want to <a href='post-new.php?post_type=page'>add a new page</a>?", 'cms-tree-page-view') . '</p></div>';
|
151 |
-
} else {
|
152 |
-
// start the party!
|
153 |
-
global $cms_tpv_view;
|
154 |
-
?>
|
155 |
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
-
<
|
164 |
-
<form id="cms_tree_view_search_form" method="get" action="">
|
165 |
-
<input type="text" name="search" id="cms_tree_view_search" />
|
166 |
-
<a title="<?php _e("Clear search", 'cms-tree-page-view') ?>" id="cms_tree_view_search_form_reset" href="#">x</a>
|
167 |
-
<input type="submit" id="cms_tree_view_search_submit" value="<?php _e("Search", 'cms-tree-page-view') ?>" />
|
168 |
-
<span id="cms_tree_view_search_form_working"><?php _e("Searching...", 'cms-tree-page-view') ?></span>
|
169 |
-
</form>
|
170 |
-
</li>
|
171 |
-
</ul>
|
172 |
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
<div id="cms_tpv_page_actions">
|
180 |
-
<p>
|
181 |
-
<a href="#" title='<?php _e("Edit page", "cms-tree-page-view")?>' class='cms_tpv_action_edit'><?php _e("Edit", "cms-tree-page-view")?></a> |
|
182 |
-
<a href="#" title='<?php _e("View page", "cms-tree-page-view")?>' class='cms_tpv_action_view'><?php _e("View", "cms-tree-page-view")?></a>
|
183 |
-
</p>
|
184 |
-
<p>
|
185 |
-
<span class='cms_tpv_action_add_page'><?php _e("Add page", "cms-tree-page-view")?></span>
|
186 |
-
<a href="#" title='<?php _e("Add new page after", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_after'><?php _e("after", "cms-tree-page-view")?></a> |
|
187 |
-
<a href="#" title='<?php _e("Add new page inside", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_inside'><?php _e("inside", "cms-tree-page-view")?></a>
|
188 |
-
</p>
|
189 |
-
<dl>
|
190 |
-
<dt><?php _e("Last modified", "cms-tree-page-view") ?></dt>
|
191 |
-
<dd><span id="cms_tpv_page_actions_modified_time"></span> <?php _e("by", "cms-tree-page-view") ?> <span id="cms_tpv_page_actions_modified_by"></span></dd>
|
192 |
-
<dt><?php _e("Page ID", "cms-tree-page-view") ?></dt>
|
193 |
-
<dd><span id="cms_tpv_page_actions_page_id"></span></dd>
|
194 |
-
</dl>
|
195 |
-
<span id="cms_tpv_page_actions_arrow"></span>
|
196 |
-
</div>
|
197 |
-
<?php
|
198 |
-
}
|
199 |
} // func
|
200 |
|
201 |
|
@@ -204,9 +365,12 @@ function cms_tpv_print_common_tree_stuff() {
|
|
204 |
* A page with the tree. Good stuff.
|
205 |
*/
|
206 |
function cms_tpv_pages_page() {
|
|
|
|
|
|
|
207 |
?>
|
208 |
<div class="wrap">
|
209 |
-
<h2><?php echo
|
210 |
|
211 |
<?php
|
212 |
cms_tpv_show_annoying_box();
|
@@ -224,44 +388,56 @@ function cms_tpv_get_pages($args = null) {
|
|
224 |
global $wpdb;
|
225 |
|
226 |
$defaults = array(
|
227 |
-
|
|
|
228 |
"view" => "all" // all | public
|
229 |
);
|
230 |
$r = wp_parse_args( $args, $defaults );
|
231 |
-
extract($r, EXTR_SKIP);
|
232 |
|
233 |
-
$
|
234 |
-
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
-
|
238 |
-
|
239 |
-
if ($view == "all") {
|
240 |
} else {
|
241 |
-
|
242 |
-
// http://wordpress.org/support/topic/314325
|
243 |
-
$whereView = " AND ( post_status NOT IN ('pending', 'private', 'future', 'draft') ) ";
|
244 |
}
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
251 |
|
252 |
return $pages;
|
253 |
|
254 |
}
|
255 |
|
256 |
-
|
|
|
|
|
257 |
|
258 |
/**
|
259 |
* Output JSON for the children of a node
|
260 |
* $arrOpenChilds = array with id of pages to open children on
|
261 |
*/
|
262 |
-
function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null) {
|
263 |
|
264 |
-
$arrPages = cms_tpv_get_pages("parent=$pageID&view=$view");
|
265 |
if ($arrPages) {
|
266 |
?>[<?php
|
267 |
for ($i=0, $pagesCount = sizeof($arrPages); $i<$pagesCount; $i++) {
|
@@ -270,7 +446,7 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null) {
|
|
270 |
$content = wp_specialchars($onePage->post_content);
|
271 |
$content = str_replace(array("\n","\r"), "", $content);
|
272 |
$hasChildren = false;
|
273 |
-
$arrChildPages = cms_tpv_get_pages("parent={$onePage->ID}&view=$view");
|
274 |
|
275 |
if ($arrChildPages) {
|
276 |
$hasChildren = true;
|
@@ -341,7 +517,7 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null) {
|
|
341 |
// if id is in $arrOpenChilds then also output children on this one
|
342 |
if ($hasChildren && isset($arrOpenChilds) && in_array($onePage->ID, $arrOpenChilds)) {
|
343 |
?>, "children": <?php
|
344 |
-
cms_tpv_print_childs($onePage->ID, $view, $arrOpenChilds);
|
345 |
?><?php
|
346 |
}
|
347 |
?>
|
@@ -364,6 +540,7 @@ function cms_tpv_get_childs() {
|
|
364 |
|
365 |
$action = $_GET["action"];
|
366 |
$view = $_GET["view"]; // all | public
|
|
|
367 |
$search = trim($_GET["search_string"]); // exits if we're doing a search
|
368 |
if ($action) {
|
369 |
|
@@ -425,7 +602,10 @@ function cms_tpv_get_childs() {
|
|
425 |
|
426 |
exit;
|
427 |
|
428 |
-
} else {
|
|
|
|
|
|
|
429 |
$id = $_GET["id"];
|
430 |
$id = (int) str_replace("cms-tpv-", "", $id);
|
431 |
|
@@ -439,7 +619,7 @@ function cms_tpv_get_childs() {
|
|
439 |
}
|
440 |
}
|
441 |
|
442 |
-
cms_tpv_print_childs($id, $view, $jstree_open);
|
443 |
exit;
|
444 |
}
|
445 |
}
|
@@ -461,6 +641,8 @@ function cms_tpv_add_page() {
|
|
461 |
$pageID = $_POST["pageID"];
|
462 |
$pageID = str_replace("cms-tpv-", "", $pageID);
|
463 |
$page_title = trim($_POST["page_title"]);
|
|
|
|
|
464 |
if (!$page_title) { $page_title = __("New page", 'cms-tree-page-view'); }
|
465 |
|
466 |
$ref_post = get_post($pageID);
|
@@ -482,6 +664,7 @@ function cms_tpv_add_page() {
|
|
482 |
$post_new["post_status"] = "draft";
|
483 |
$post_new["post_title"] = $page_title;
|
484 |
$post_new["post_content"] = "";
|
|
|
485 |
$newPostID = wp_insert_post($post_new);
|
486 |
|
487 |
} else if ( "inside" == $type ) {
|
@@ -500,6 +683,7 @@ function cms_tpv_add_page() {
|
|
500 |
$post_new["post_status"] = "draft";
|
501 |
$post_new["post_title"] = $page_title;
|
502 |
$post_new["post_content"] = "";
|
|
|
503 |
$newPostID = wp_insert_post($post_new);
|
504 |
|
505 |
}
|
@@ -507,6 +691,9 @@ function cms_tpv_add_page() {
|
|
507 |
if ($newPostID) {
|
508 |
// return editlink for the newly created page
|
509 |
$editLink = get_edit_post_link($newPostID, '');
|
|
|
|
|
|
|
510 |
echo $editLink;
|
511 |
} else {
|
512 |
// fail, tell js
|
@@ -617,8 +804,8 @@ function cms_tpv_show_annoying_box() {
|
|
617 |
}
|
618 |
if ($show_box) {
|
619 |
?>
|
620 |
-
<div
|
621 |
-
<p
|
622 |
<p><strong>Thank you for using this plugin!</strong> If you need help please check out the <a href="http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">plugin homepage</a> or the <a href="http://wordpress.org/tags/cms-tree-page-view?forum_id=10">support forum</a>.</p>
|
623 |
<p>If you like this plugin, please <a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">support my work by donating</a> - or at least say something nice about this plugin in a blog post or tweet.</p>
|
624 |
<!-- <p>Thank you</p>
|
@@ -645,6 +832,19 @@ function bonny_d($var) {
|
|
645 |
function cms_tpv_install() {
|
646 |
// after upgrading/re-enabling the plugin, also re-enable the little please-donate-box
|
647 |
update_option('cms_tpv_show_annoying_little_box', 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
}
|
649 |
|
650 |
-
?>
|
19 |
|
20 |
<!--[if IE 6]>
|
21 |
<style>
|
22 |
+
.cms_tree_view_search_form {
|
23 |
display: none !important;
|
24 |
}
|
25 |
+
.cms_tpv_dashboard_widget .subsubsub li {
|
26 |
}
|
27 |
</style>
|
28 |
<![endif]-->
|
31 |
|
32 |
function cms_tpv_admin_init() {
|
33 |
|
34 |
+
// this no longer works since we can have multiple menu items
|
35 |
+
#define( "CMS_TPV_PAGE_FILE", menu_page_url("cms-tpv-pages-page", false));
|
36 |
+
|
37 |
wp_enqueue_style( "cms_tpv_styles", CMS_TPV_URL . "styles/styles.css", false, CMS_TPV_VERSION );
|
38 |
wp_enqueue_style( "jquery-alerts", CMS_TPV_URL . "styles/jquery.alerts.css", false, CMS_TPV_VERSION );
|
39 |
wp_enqueue_script( "jquery-cookie", CMS_TPV_URL . "scripts/jquery.biscuit.js", array("jquery")); // renamed from cookie to fix problems with mod_security
|
41 |
wp_enqueue_script( "jquery-alerts", CMS_TPV_URL . "scripts/jquery.alerts.js", false, CMS_TPV_VERSION);
|
42 |
|
43 |
wp_enqueue_script( "cms_tree_page_view", CMS_TPV_URL . "scripts/cms_tree_page_view.js", false, CMS_TPV_VERSION);
|
44 |
+
|
45 |
+
// DEBUG
|
46 |
+
//wp_enqueue_script( "jquery-hotkeys" );
|
47 |
|
48 |
load_plugin_textdomain('cms-tree-page-view', WP_CONTENT_DIR . "/plugins/languages", "/cms-tree-page-view/languages");
|
49 |
$oLocale = array(
|
69 |
|
70 |
}
|
71 |
|
72 |
+
// save settings
|
73 |
+
function cms_tpv_save_settings() {
|
74 |
+
if ($_POST["cms_tpv_action"] == "save_settings") {
|
75 |
+
$options = array();
|
76 |
+
$options["dashboard"] = (array) $_POST["post-type-dashboard"];
|
77 |
+
$options["menu"] = (array) $_POST["post-type-menu"];
|
78 |
+
update_option('cms_tpv_options', $options); // enable this to show box
|
79 |
+
#bonny_d($options);
|
80 |
}
|
81 |
+
/*
|
82 |
+
[post-type-dashboard] => Array
|
83 |
+
(
|
84 |
+
[0] => post
|
85 |
+
[1] => page
|
86 |
+
)
|
87 |
+
|
88 |
+
[post-type-menu] => Array
|
89 |
+
(
|
90 |
+
[0] => post
|
91 |
+
[1] => page
|
92 |
+
)
|
93 |
|
94 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
+
|
97 |
+
function cms_tpv_wp_dashboard_setup() {
|
98 |
+
$options = cms_tpv_get_options();
|
99 |
+
foreach ($options["dashboard"] as $one_dashboard_post_type) {
|
100 |
+
$post_type_object = get_post_type_object($one_dashboard_post_type);
|
101 |
+
$new_func_name = create_function('', "cms_tpv_dashboard($one_dashboard_post_type);");
|
102 |
+
wp_add_dashboard_widget( "cms_tpv_dashboard_widget_{$one_dashboard_post_type}", $post_type_object->labels->name . " Tree View", $new_func_name );
|
103 |
}
|
104 |
}
|
105 |
|
106 |
+
|
107 |
/**
|
108 |
* Output on dashboard
|
109 |
*/
|
110 |
+
function cms_tpv_dashboard($post_type = "") {
|
|
|
111 |
cms_tpv_show_annoying_box();
|
112 |
+
cms_tpv_print_common_tree_stuff($post_type);
|
|
|
113 |
}
|
114 |
|
115 |
function cms_tpv_admin_menu() {
|
116 |
+
|
117 |
+
// add
|
118 |
+
$options = cms_tpv_get_options();
|
119 |
+
foreach ($options["menu"] as $one_menu_post_type) {
|
120 |
+
// post is a special one.
|
121 |
+
if ($one_menu_post_type == "post") {
|
122 |
+
$slug = "edit.php";
|
123 |
+
} else {
|
124 |
+
$slug = "edit.php?post_type=$one_menu_post_type";
|
125 |
+
}
|
126 |
+
$post_type_object = get_post_type_object($one_menu_post_type);
|
127 |
+
add_submenu_page($slug, $post_type_object->labels->name . " Tree View", $post_type_object->labels->name . " Tree View", "administrator", "cms-tpv-page-$one_menu_post_type", "cms_tpv_pages_page");
|
128 |
}
|
129 |
+
|
130 |
add_submenu_page( 'options-general.php' , CMS_TPV_NAME, CMS_TPV_NAME, "administrator", "cms-tpv-options", "cms_tpv_options");
|
131 |
+
|
132 |
}
|
133 |
|
134 |
|
136 |
* Output options page
|
137 |
*/
|
138 |
function cms_tpv_options() {
|
139 |
+
|
140 |
+
/*
|
141 |
+
// Just som testing stuff
|
142 |
+
$args = array(
|
143 |
+
"numberposts" => "-1",
|
144 |
+
"orderby" => "menu_order",
|
145 |
+
"order" => "ASC",
|
146 |
+
"caller_get_posts" => 1, // get sticky posts in natural order (or so I understand it anyway)
|
147 |
+
"post_status" => "publish", // "any" seems to get all but auto-drafts
|
148 |
+
"post_type" => "page"
|
149 |
+
);
|
150 |
+
$posts = get_pages($args); // works
|
151 |
+
// $posts = get_posts($args); // does not work
|
152 |
+
var_dump($posts);
|
153 |
+
echo "num of posts: " . sizeof($posts);
|
154 |
+
foreach ($posts as $one_post) {
|
155 |
+
#bonny_d($one_post);
|
156 |
+
echo "<br><br>title: " . esc_html($one_post->post_title);
|
157 |
+
echo "<br>status: " . $one_post->post_status;
|
158 |
+
echo "<br>type: " . $one_post->post_type;
|
159 |
+
}
|
160 |
+
// */
|
161 |
+
|
162 |
?>
|
163 |
|
164 |
<div class="wrap">
|
166 |
|
167 |
<form method="post" action="options.php">
|
168 |
<?php wp_nonce_field('update-options'); ?>
|
169 |
+
|
170 |
+
<h3><?php _e("Select where to show a tree for pages and custom post types")?></h3>
|
171 |
+
|
172 |
+
<?php
|
173 |
+
$options = cms_tpv_get_options();
|
174 |
+
|
175 |
+
$post_types = get_post_types(array(), "objects");
|
176 |
+
$arr_page_options = array();
|
177 |
+
foreach ($post_types as $one_post_type) {
|
178 |
+
$name = $one_post_type->name;
|
179 |
+
|
180 |
+
if ($name == "post") {
|
181 |
+
// no support for pages. you could show them.. but since we can't reorder them there is not idea to show them.. or..?
|
182 |
+
continue;
|
183 |
+
}
|
184 |
+
|
185 |
+
if ($one_post_type->show_ui) {
|
186 |
+
|
187 |
+
$arr_page_options[] = "post-type-dashboard-$name";
|
188 |
+
$arr_page_options[] = "post-type-menu-$name";
|
189 |
+
echo "<p>";
|
190 |
+
echo "<strong>".$one_post_type->label."</strong>";
|
191 |
+
|
192 |
+
$checked = (in_array($name, $options["dashboard"])) ? " checked='checked' " : "";
|
193 |
+
echo "<br />";
|
194 |
+
echo "<input $checked type='checkbox' name='post-type-dashboard[]' value='$name' id='post-type-dashboard-$name' /> <label for='post-type-dashboard-$name'>" . __("On dashboard", 'cms-tree-page-view') . "</label>";
|
195 |
+
|
196 |
+
$checked = (in_array($name, $options["menu"])) ? " checked='checked' " : "";
|
197 |
+
echo "<br />";
|
198 |
+
echo "<input $checked type='checkbox' name='post-type-menu[]' value='$name' id='post-type-menu-$name' /> <label for='post-type-menu-$name'>" . __("In menu", 'cms-tree-page-view') . "</label>";
|
199 |
+
echo "</p>";
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
?>
|
204 |
+
|
205 |
<input type="hidden" name="action" value="update" />
|
206 |
+
<input type="hidden" name="cms_tpv_action" value="save_settings" />
|
207 |
+
<input type="hidden" name="page_options" value="<?php echo join($arr_page_options, ",") ?>" />
|
208 |
<p class="submit">
|
209 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes', 'cms-tree-page-view') ?>" />
|
210 |
</p>
|
211 |
</form>
|
212 |
+
</div>
|
213 |
|
214 |
<?php
|
215 |
}
|
216 |
|
217 |
+
function cms_tpv_get_options() {
|
218 |
+
$arr_options = (array) get_option('cms_tpv_options');
|
219 |
+
$arr_options["dashboard"] = (array) $arr_options["dashboard"];
|
220 |
+
$arr_options["menu"] = (array) $arr_options["menu"];
|
221 |
+
return $arr_options;
|
222 |
+
}
|
223 |
+
|
224 |
+
function cms_tpv_get_selected_post_type() {
|
225 |
+
$post_type = $_GET["post_type"];
|
226 |
+
if (!$post_type) { $post_type = "post"; }
|
227 |
+
return $post_type;
|
228 |
+
}
|
229 |
|
230 |
/**
|
231 |
* Print tree stuff that is common for both dashboard and page
|
232 |
*/
|
233 |
+
function cms_tpv_print_common_tree_stuff($post_type = "") {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
+
if (!$post_type) {
|
236 |
+
$post_type = cms_tpv_get_selected_post_type();
|
237 |
+
}
|
238 |
+
$post_type_object = get_post_type_object($post_type);
|
239 |
+
$get_pages_args = array("post_type" => $post_type);
|
240 |
+
$pages = cms_tpv_get_pages($get_pages_args);
|
241 |
+
|
242 |
+
$wpml_current_lang = "";
|
243 |
+
if (defined("ICL_SITEPRESS_VERSION") && $post_type == "page") {
|
244 |
+
global $sitepress;
|
245 |
+
$wpml_current_lang = $sitepress->get_current_language();
|
246 |
+
}
|
247 |
|
248 |
+
?><div class="cms_tpv_wrapper">
|
249 |
+
<input type="hidden" name="cms_tpv_meta_post_type" value="<?php echo $post_type ?>" />
|
250 |
+
<input type="hidden" name="cms_tpv_meta_post_type_hierarchical" value="<?php echo (int) $post_type_object->hierarchical ?>" />
|
251 |
+
<input type="hidden" name="cms_tpv_meta_wpml_language" value="<?php echo $wpml_current_lang ?>" />
|
252 |
+
<?php
|
253 |
+
|
254 |
+
// check if WPML is activated
|
255 |
+
// if: show a language-menu
|
256 |
+
if (defined("ICL_SITEPRESS_VERSION") && $post_type == "page") {
|
257 |
+
$wpml_langs = icl_get_languages();
|
258 |
+
$wpml_active_lang = null;
|
259 |
+
if (sizeof($wpml_langs)>=1) {
|
260 |
+
$lang_out = "";
|
261 |
+
$lang_out .= "<ul class='cms-tpv-subsubsub cms_tvp_switch_langs'>";
|
262 |
+
foreach ($wpml_langs as $one_lang) {
|
263 |
+
$one_lang_details = $sitepress->get_language_details($one_lang["language_code"]); // english_name | display_name
|
264 |
+
$selected = "";
|
265 |
+
if ($one_lang["active"]) {
|
266 |
+
$wpml_active_lang = $one_lang;
|
267 |
+
$selected = "current";
|
268 |
+
}
|
269 |
+
$lang_out .= "<li><a class='cms_tvp_switch_lang $selected cms_tpv_switch_language_code_{$one_lang["language_code"]}' href='#'>$one_lang_details[display_name]</a> | </li>";
|
270 |
+
}
|
271 |
+
$lang_out = preg_replace('/ \| <\/li>$/', "</li>", $lang_out);
|
272 |
+
$lang_out .= "</ul>";
|
273 |
+
echo $lang_out;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
/*
|
277 |
+
Array
|
278 |
+
(
|
279 |
+
[en] => Array
|
280 |
+
(
|
281 |
+
[id] => 1
|
282 |
+
[active] => 1
|
283 |
+
[native_name] => English
|
284 |
+
[language_code] => en
|
285 |
+
[translated_name] => English
|
286 |
+
[url] => http://localhost/wordpress3
|
287 |
+
[country_flag_url] => http://localhost/wordpress3/wp-content/plugins/sitepress-multilingual-cms/res/flags/en.png
|
288 |
+
)
|
289 |
+
*/
|
290 |
+
|
291 |
+
|
292 |
+
if (empty($pages)) {
|
293 |
+
echo '<div class="updated fade below-h2"><p>' . __("No posts found.", 'cms-tree-page-view') . '</p></div>';
|
294 |
+
} else {
|
295 |
+
// start the party!
|
296 |
+
global $cms_tpv_view;
|
297 |
+
?>
|
298 |
+
|
299 |
+
<ul class="cms-tpv-subsubsub">
|
300 |
+
<li><a class="cms_tvp_view_all <?php echo ($cms_tpv_view=="all") ? "current" : "" ?>" href="#"><?php _e("All", 'cms-tree-page-view') ?></a> |</li>
|
301 |
+
<li><a class="cms_tvp_view_public <?php echo ($cms_tpv_view=="public") ? "current" : "" ?>" href="#"><?php _e("Public", 'cms-tree-page-view') ?></a></li>
|
302 |
+
|
303 |
+
<?php
|
304 |
+
if ($post_type_object->hierarchical) {
|
305 |
+
?>
|
306 |
+
<li><a href="#" class="cms_tpv_open_all"><?php _e("Expand", 'cms-tree-page-view') ?></a> |</li>
|
307 |
+
<li><a href="#" class="cms_tpv_close_all"><?php _e("Collapse", 'cms-tree-page-view') ?></a></li>
|
308 |
+
<?php
|
309 |
+
}
|
310 |
+
?>
|
311 |
+
|
312 |
+
<li>
|
313 |
+
<form class="cms_tree_view_search_form" method="get" action="">
|
314 |
+
<input type="text" name="search" class="cms_tree_view_search" />
|
315 |
+
<a title="<?php _e("Clear search", 'cms-tree-page-view') ?>" class="cms_tree_view_search_form_reset" href="#">x</a>
|
316 |
+
<input type="submit" class="cms_tree_view_search_submit" value="<?php _e("Search", 'cms-tree-page-view') ?>" />
|
317 |
+
<span class="cms_tree_view_search_form_working"><?php _e("Searching...", 'cms-tree-page-view') ?></span>
|
318 |
+
<span class="cms_tree_view_search_form_no_hits"><?php _e("Nothing found.", 'cms-tree-page-view') ?></span>
|
319 |
+
</form>
|
320 |
+
</li>
|
321 |
+
</ul>
|
322 |
+
|
323 |
+
<div class="cms_tpv_working"><?php _e("Loading...", 'cms-tree-page-view') ?></div>
|
324 |
|
325 |
+
<div class="updated below-h2 hidden cms_tpv_search_no_hits"><p><?php _e("Search: no pages found", 'cms-tree-page-view') ?></p></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
|
327 |
+
<div class="cms_tpv_container tree-default"><?php _e("Loading tree", 'cms-tree-page-view') ?></div>
|
328 |
+
<div style="clear: both;"></div>
|
329 |
+
<div class="cms_tpv_page_actions">
|
330 |
+
<p>
|
331 |
+
<a href="#" title='<?php _e("Edit page", "cms-tree-page-view")?>' class='cms_tpv_action_edit'><?php _e("Edit", "cms-tree-page-view")?></a> |
|
332 |
+
<a href="#" title='<?php _e("View page", "cms-tree-page-view")?>' class='cms_tpv_action_view'><?php _e("View", "cms-tree-page-view")?></a>
|
333 |
+
</p>
|
334 |
+
<p>
|
335 |
+
<span class='cms_tpv_action_add_page'><?php echo $post_type_object->labels->add_new_item ?></span>
|
336 |
+
<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>
|
337 |
+
<?php
|
338 |
+
if ($post_type_object->hierarchical) {
|
339 |
+
?> | <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
|
340 |
+
}
|
341 |
+
?>
|
342 |
+
</p>
|
343 |
+
<dl>
|
344 |
+
<dt><?php _e("Last modified", "cms-tree-page-view") ?></dt>
|
345 |
+
<dd>
|
346 |
+
<span class="cms_tpv_page_actions_modified_time"></span> <?php _e("by", "cms-tree-page-view") ?>
|
347 |
+
<span class="cms_tpv_page_actions_modified_by"></span>
|
348 |
+
</dd>
|
349 |
+
<dt><?php _e("Page ID", "cms-tree-page-view") ?></dt>
|
350 |
+
<dd><span class="cms_tpv_page_actions_page_id"></span></dd>
|
351 |
+
</dl>
|
352 |
+
<span class="cms_tpv_page_actions_arrow"></span>
|
353 |
+
</div>
|
354 |
+
<?php
|
355 |
+
}
|
356 |
+
?>
|
357 |
|
358 |
+
</div>
|
359 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
} // func
|
361 |
|
362 |
|
365 |
* A page with the tree. Good stuff.
|
366 |
*/
|
367 |
function cms_tpv_pages_page() {
|
368 |
+
$post_type = cms_tpv_get_selected_post_type();
|
369 |
+
$post_type_object = get_post_type_object($post_type);
|
370 |
+
|
371 |
?>
|
372 |
<div class="wrap">
|
373 |
+
<h2><?php echo ($post_type_object->labels->name); ?> Tree View</h2>
|
374 |
|
375 |
<?php
|
376 |
cms_tpv_show_annoying_box();
|
388 |
global $wpdb;
|
389 |
|
390 |
$defaults = array(
|
391 |
+
"post_type" => "post",
|
392 |
+
"parent" => "",
|
393 |
"view" => "all" // all | public
|
394 |
);
|
395 |
$r = wp_parse_args( $args, $defaults );
|
|
|
396 |
|
397 |
+
$get_posts_args = array(
|
398 |
+
"numberposts" => "-1",
|
399 |
+
"orderby" => "menu_order",
|
400 |
+
"order" => "ASC",
|
401 |
+
"caller_get_posts" => 1, // get sticky posts in natural order (or so I understand it anyway)
|
402 |
+
// "post_type" => "any",
|
403 |
+
"post_type" => $r["post_type"],
|
404 |
+
"xsuppress_filters" => "0"
|
405 |
+
);
|
406 |
+
if ($r["parent"]) {
|
407 |
+
$get_posts_args["post_parent"] = $r["parent"];
|
408 |
+
} else {
|
409 |
+
$get_posts_args["post_parent"] = "0";
|
410 |
}
|
411 |
+
if ($r["view"] == "all") {
|
412 |
+
$get_posts_args["post_status"] = "any"; // "any" seems to get all but auto-drafts
|
|
|
413 |
} else {
|
414 |
+
$get_posts_args["post_status"] = "publish";
|
|
|
|
|
415 |
}
|
416 |
|
417 |
+
#do_action_ref_array('parse_query', array(&$this));
|
418 |
+
#bonny_d($get_posts_args);
|
419 |
+
|
420 |
+
$pages = get_posts($get_posts_args);
|
421 |
+
|
422 |
+
// filter out pages for wpml, by applying same filter as get_pages does
|
423 |
+
// only run if wpml is available or always?
|
424 |
+
$pages = apply_filters('get_pages', $pages, $get_posts_args);
|
425 |
|
426 |
return $pages;
|
427 |
|
428 |
}
|
429 |
|
430 |
+
function cms_tpv_parse_query($q) {
|
431 |
+
# bonny_d($q);
|
432 |
+
}
|
433 |
|
434 |
/**
|
435 |
* Output JSON for the children of a node
|
436 |
* $arrOpenChilds = array with id of pages to open children on
|
437 |
*/
|
438 |
+
function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $post_type) {
|
439 |
|
440 |
+
$arrPages = cms_tpv_get_pages("parent=$pageID&view=$view&post_type=$post_type");
|
441 |
if ($arrPages) {
|
442 |
?>[<?php
|
443 |
for ($i=0, $pagesCount = sizeof($arrPages); $i<$pagesCount; $i++) {
|
446 |
$content = wp_specialchars($onePage->post_content);
|
447 |
$content = str_replace(array("\n","\r"), "", $content);
|
448 |
$hasChildren = false;
|
449 |
+
$arrChildPages = cms_tpv_get_pages("parent={$onePage->ID}&view=$view&post_type=$post_type");
|
450 |
|
451 |
if ($arrChildPages) {
|
452 |
$hasChildren = true;
|
517 |
// if id is in $arrOpenChilds then also output children on this one
|
518 |
if ($hasChildren && isset($arrOpenChilds) && in_array($onePage->ID, $arrOpenChilds)) {
|
519 |
?>, "children": <?php
|
520 |
+
cms_tpv_print_childs($onePage->ID, $view, $arrOpenChilds, $post_type);
|
521 |
?><?php
|
522 |
}
|
523 |
?>
|
540 |
|
541 |
$action = $_GET["action"];
|
542 |
$view = $_GET["view"]; // all | public
|
543 |
+
$post_type = $_GET["post_type"];
|
544 |
$search = trim($_GET["search_string"]); // exits if we're doing a search
|
545 |
if ($action) {
|
546 |
|
602 |
|
603 |
exit;
|
604 |
|
605 |
+
} else {
|
606 |
+
|
607 |
+
// regular get
|
608 |
+
|
609 |
$id = $_GET["id"];
|
610 |
$id = (int) str_replace("cms-tpv-", "", $id);
|
611 |
|
619 |
}
|
620 |
}
|
621 |
|
622 |
+
cms_tpv_print_childs($id, $view, $jstree_open, $post_type);
|
623 |
exit;
|
624 |
}
|
625 |
}
|
641 |
$pageID = $_POST["pageID"];
|
642 |
$pageID = str_replace("cms-tpv-", "", $pageID);
|
643 |
$page_title = trim($_POST["page_title"]);
|
644 |
+
$post_type = $_POST["post_type"];
|
645 |
+
$wpml_lang = $_POST["wpml_lang"];
|
646 |
if (!$page_title) { $page_title = __("New page", 'cms-tree-page-view'); }
|
647 |
|
648 |
$ref_post = get_post($pageID);
|
664 |
$post_new["post_status"] = "draft";
|
665 |
$post_new["post_title"] = $page_title;
|
666 |
$post_new["post_content"] = "";
|
667 |
+
$post_new["post_type"] = $post_type;
|
668 |
$newPostID = wp_insert_post($post_new);
|
669 |
|
670 |
} else if ( "inside" == $type ) {
|
683 |
$post_new["post_status"] = "draft";
|
684 |
$post_new["post_title"] = $page_title;
|
685 |
$post_new["post_content"] = "";
|
686 |
+
$post_new["post_type"] = $post_type;
|
687 |
$newPostID = wp_insert_post($post_new);
|
688 |
|
689 |
}
|
691 |
if ($newPostID) {
|
692 |
// return editlink for the newly created page
|
693 |
$editLink = get_edit_post_link($newPostID, '');
|
694 |
+
if ($wpml_lang) {
|
695 |
+
$editLink = add_query_arg("lang", $wpml_lang, $editLink);
|
696 |
+
}
|
697 |
echo $editLink;
|
698 |
} else {
|
699 |
// fail, tell js
|
804 |
}
|
805 |
if ($show_box) {
|
806 |
?>
|
807 |
+
<div class="cms_tpv_annoying_little_box">
|
808 |
+
<p class="cms_tpv_annoying_little_box_close"><a href="<?php echo add_query_arg("action", "cms_tpv_remove_annoying_box")?>">Close</a></p>
|
809 |
<p><strong>Thank you for using this plugin!</strong> If you need help please check out the <a href="http://eskapism.se/code-playground/cms-tree-page-view/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">plugin homepage</a> or the <a href="http://wordpress.org/tags/cms-tree-page-view?forum_id=10">support forum</a>.</p>
|
810 |
<p>If you like this plugin, please <a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=banner&utm_campaign=promobox">support my work by donating</a> - or at least say something nice about this plugin in a blog post or tweet.</p>
|
811 |
<!-- <p>Thank you</p>
|
832 |
function cms_tpv_install() {
|
833 |
// after upgrading/re-enabling the plugin, also re-enable the little please-donate-box
|
834 |
update_option('cms_tpv_show_annoying_little_box', 1);
|
835 |
+
|
836 |
+
// check and update version
|
837 |
+
$version = get_option('cms_tpv_version', 0);
|
838 |
+
if ($version <= 0) {
|
839 |
+
// first install or pre custom posts version:
|
840 |
+
// make sure pages are enabled by default
|
841 |
+
$options = array();
|
842 |
+
$options["dashboard"] = array("page");
|
843 |
+
$options["menu"] = array("page");
|
844 |
+
update_option('cms_tpv_options', $options);
|
845 |
+
}
|
846 |
+
|
847 |
+
// set to current version
|
848 |
+
update_option('cms_tpv_version', CMS_TPV_VERSION);
|
849 |
}
|
850 |
|
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: CMS Tree Page View
|
4 |
Plugin URI: http://eskapism.se/code-playground/cms-tree-page-view/
|
5 |
Description: Adds a CMS-like tree view of all your pages, like the view often found in a page-focused CMS. By using the tree you can edit, view, add pages and even search pages (useful if you have many pages). And with drag and drop you can rearrange the order of your pages. Page management won't get any easier than this!
|
6 |
-
Version: 0.6.
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
@@ -27,12 +27,13 @@ License: GPL2
|
|
27 |
|
28 |
require("functions.php");
|
29 |
|
30 |
-
define( "CMS_TPV_VERSION", "0.6.
|
31 |
define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
|
32 |
define( "CMS_TPV_NAME", "CMS Tree Page View");
|
33 |
|
34 |
// on admin init: add styles and scripts
|
35 |
add_action( 'admin_init', 'cms_tpv_admin_init' );
|
|
|
36 |
|
37 |
// Hook onto dashboard and admin menu
|
38 |
add_action( 'wp_dashboard_setup', "cms_tpv_wp_dashboard_setup" );
|
@@ -47,4 +48,6 @@ add_action('wp_ajax_cms_tpv_add_page', 'cms_tpv_add_page');
|
|
47 |
// activation
|
48 |
register_activation_hook( WP_PLUGIN_DIR . "/cms-tree-page-view/index.php" , 'cms_tpv_install' );
|
49 |
|
50 |
-
|
|
|
|
3 |
Plugin Name: CMS Tree Page View
|
4 |
Plugin URI: http://eskapism.se/code-playground/cms-tree-page-view/
|
5 |
Description: Adds a CMS-like tree view of all your pages, like the view often found in a page-focused CMS. By using the tree you can edit, view, add pages and even search pages (useful if you have many pages). And with drag and drop you can rearrange the order of your pages. Page management won't get any easier than this!
|
6 |
+
Version: 0.6.3
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
27 |
|
28 |
require("functions.php");
|
29 |
|
30 |
+
define( "CMS_TPV_VERSION", "0.6.3");
|
31 |
define( "CMS_TPV_URL", WP_PLUGIN_URL . '/cms-tree-page-view/');
|
32 |
define( "CMS_TPV_NAME", "CMS Tree Page View");
|
33 |
|
34 |
// on admin init: add styles and scripts
|
35 |
add_action( 'admin_init', 'cms_tpv_admin_init' );
|
36 |
+
add_action( 'admin_init', 'cms_tpv_save_settings' );
|
37 |
|
38 |
// Hook onto dashboard and admin menu
|
39 |
add_action( 'wp_dashboard_setup', "cms_tpv_wp_dashboard_setup" );
|
48 |
// activation
|
49 |
register_activation_hook( WP_PLUGIN_DIR . "/cms-tree-page-view/index.php" , 'cms_tpv_install' );
|
50 |
|
51 |
+
// hook onto query
|
52 |
+
#add_action( 'parse_query', 'cms_tpv_parse_query' );
|
53 |
+
|
languages/cms-tree-page-view-de_DE.mo
ADDED
Binary file
|
languages/cms-tree-page-view-de_DE.po
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation of the WordPress plugin by .
|
2 |
+
# Copyright (C) 2010
|
3 |
+
# This file is distributed under the same license as the package.
|
4 |
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
5 |
+
#
|
6 |
+
#, fuzzy
|
7 |
+
msgid ""
|
8 |
+
msgstr ""
|
9 |
+
"Project-Id-Version: \n"
|
10 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/cms-tree-page-view\n"
|
11 |
+
"POT-Creation-Date: 2010-06-30 19:00+0000\n"
|
12 |
+
"PO-Revision-Date: 2010-07-21 11:30+0200\n"
|
13 |
+
"Last-Translator: Thomas Dullnig <thomas.dullnig@sevenspire.com>\n"
|
14 |
+
"Language-Team: \n"
|
15 |
+
"MIME-Version: 1.0\n"
|
16 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
17 |
+
"Content-Transfer-Encoding: 8bit\n"
|
18 |
+
|
19 |
+
#: functions.php:45
|
20 |
+
msgid "Enter title of new page"
|
21 |
+
msgstr "Titel der neuen Seite"
|
22 |
+
|
23 |
+
#: functions.php:46
|
24 |
+
msgid "child pages"
|
25 |
+
msgstr "Untergeordnete Seiten"
|
26 |
+
|
27 |
+
#: functions.php:47
|
28 |
+
msgid "Edit page"
|
29 |
+
msgstr "Seite bearbeiten"
|
30 |
+
|
31 |
+
#: functions.php:48
|
32 |
+
msgid "View page"
|
33 |
+
msgstr "Seite anzeigen"
|
34 |
+
|
35 |
+
#: functions.php:49
|
36 |
+
msgid "Edit"
|
37 |
+
msgstr "Bearbeiten"
|
38 |
+
|
39 |
+
#: functions.php:50
|
40 |
+
msgid "View"
|
41 |
+
msgstr "Anzeigen"
|
42 |
+
|
43 |
+
#: functions.php:51
|
44 |
+
msgid "Add page"
|
45 |
+
msgstr "Seite hinzufügen"
|
46 |
+
|
47 |
+
#: functions.php:52
|
48 |
+
msgid "Add new page after"
|
49 |
+
msgstr "Neue Seite danach hinzufügen"
|
50 |
+
|
51 |
+
#: functions.php:53
|
52 |
+
msgid "after"
|
53 |
+
msgstr "danach"
|
54 |
+
|
55 |
+
#: functions.php:54
|
56 |
+
msgid "inside"
|
57 |
+
msgstr "innerhalb"
|
58 |
+
|
59 |
+
#: functions.php:55
|
60 |
+
msgid "Add new page inside"
|
61 |
+
msgstr "Neue Seite innerhalb hinzufügen"
|
62 |
+
|
63 |
+
#: functions.php:56
|
64 |
+
msgid "draft"
|
65 |
+
msgstr "Entwurf"
|
66 |
+
|
67 |
+
#: functions.php:57
|
68 |
+
msgid "future"
|
69 |
+
msgstr "zukünftig"
|
70 |
+
|
71 |
+
#: functions.php:58
|
72 |
+
msgid "protected"
|
73 |
+
msgstr "geschützt"
|
74 |
+
|
75 |
+
#: functions.php:59
|
76 |
+
msgid "pending"
|
77 |
+
msgstr "unerledigt"
|
78 |
+
|
79 |
+
#: functions.php:60
|
80 |
+
msgid "private"
|
81 |
+
msgstr "privat"
|
82 |
+
|
83 |
+
#: functions.php:61
|
84 |
+
msgid "Password protected page"
|
85 |
+
msgstr "Passwortgeschützte Seite"
|
86 |
+
|
87 |
+
#: functions.php:113
|
88 |
+
msgid "settings"
|
89 |
+
msgstr "Einstellungen"
|
90 |
+
|
91 |
+
#: functions.php:120
|
92 |
+
msgid "Show tree"
|
93 |
+
msgstr "Zeige Baum"
|
94 |
+
|
95 |
+
#: functions.php:124
|
96 |
+
msgid "on the dashboard"
|
97 |
+
msgstr "im Dashboard"
|
98 |
+
|
99 |
+
#: functions.php:128
|
100 |
+
msgid "under the pages menu"
|
101 |
+
msgstr "im Menüpunkt unter 'Seiten'"
|
102 |
+
|
103 |
+
#: functions.php:135
|
104 |
+
msgid "Save Changes"
|
105 |
+
msgstr "Änderungen speichern"
|
106 |
+
|
107 |
+
#: functions.php:150
|
108 |
+
msgid ""
|
109 |
+
"No pages found. Maybe you want to <a href='post-new.php?post_type=page'>add "
|
110 |
+
"a new page</a>?"
|
111 |
+
msgstr "Keine Seiten gefunden. Jetzt eine neue Seite <a href='post-new.php?post_type=page'>anlegen</a>?"
|
112 |
+
|
113 |
+
#: functions.php:157
|
114 |
+
msgid "All"
|
115 |
+
msgstr "Alle"
|
116 |
+
|
117 |
+
#: functions.php:158
|
118 |
+
msgid "Public"
|
119 |
+
msgstr "Öffentlich"
|
120 |
+
|
121 |
+
#: functions.php:160
|
122 |
+
msgid "Expand"
|
123 |
+
msgstr "Ausklappen"
|
124 |
+
|
125 |
+
#: functions.php:161
|
126 |
+
msgid "Collapse"
|
127 |
+
msgstr "Einklappen"
|
128 |
+
|
129 |
+
#: functions.php:166
|
130 |
+
msgid "Clear search"
|
131 |
+
msgstr "Suche leeren"
|
132 |
+
|
133 |
+
#: functions.php:167
|
134 |
+
msgid "Search"
|
135 |
+
msgstr "Suche"
|
136 |
+
|
137 |
+
#: functions.php:168
|
138 |
+
msgid "Searching..."
|
139 |
+
msgstr "Suche läuft..."
|
140 |
+
|
141 |
+
#: functions.php:173
|
142 |
+
msgid "Loading..."
|
143 |
+
msgstr "Lade..."
|
144 |
+
|
145 |
+
#: functions.php:175
|
146 |
+
msgid "Search: no pages found"
|
147 |
+
msgstr "Suche: keine Seiten gefunden"
|
148 |
+
|
149 |
+
#: functions.php:177
|
150 |
+
msgid "Loading tree"
|
151 |
+
msgstr "Lade Baum"
|
152 |
+
|
153 |
+
#: functions.php:277
|
154 |
+
msgid "<Untitled page>"
|
155 |
+
msgstr "<Unbetitelte Seite>"
|
156 |
+
|
157 |
+
#: functions.php:295
|
158 |
+
msgid "Click to edit. Drag to move."
|
159 |
+
msgstr "Zum Editieren klicken. Zum Bewegen ziehen."
|
160 |
+
|
161 |
+
#: functions.php:432
|
162 |
+
msgid "New page"
|
163 |
+
msgstr "Neue Seite"
|
readme.txt
CHANGED
@@ -6,16 +6,16 @@ Requires at least: 3.0
|
|
6 |
Tested up to: 3.0
|
7 |
Stable tag: trunk
|
8 |
|
9 |
-
Adds a CMS-like tree overview of
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
This plugin adds a CMS-like tree overview of all your pages to WordPress - like the view often found in a page-focused CMS.
|
14 |
-
Within this
|
15 |
|
16 |
-
Page
|
17 |
|
18 |
-
|
19 |
|
20 |
#### Features and highlights:
|
21 |
|
@@ -24,11 +24,33 @@ Please note that this plugin now requires WordPress 3. If you are using WordPres
|
|
24 |
* edit pages
|
25 |
* view pages
|
26 |
* search pages
|
|
|
|
|
|
|
27 |
|
28 |
#### Screencast
|
29 |
-
|
|
|
30 |
[youtube http://www.youtube.com/watch?v=H4BGomLi_FU]
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
== Installation ==
|
33 |
|
34 |
1. Upload the folder "cms-tree-page-view" to "/wp-content/plugins/"
|
@@ -44,9 +66,23 @@ Now the tree with the pages will be visible both on the dashboard and in the men
|
|
44 |
3. Search pages.
|
45 |
4. Drag-and-drop to rearrange/change the order of the pages.
|
46 |
5. The tree is also available on the dashboard and therefore available immediately after you login.
|
|
|
|
|
47 |
|
48 |
== Changelog ==
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
= 0.6.1 =
|
51 |
- Forgot to close a p-tag correctly. Now it should validate again!
|
52 |
- Fixed a problem where move could seem to not work when trying to move pages when several pages had the same menu_order, so they where sorted by alpha instead.
|
@@ -149,3 +185,9 @@ Now the tree with the pages will be visible both on the dashboard and in the men
|
|
149 |
|
150 |
= 0.1a =
|
151 |
* First public version.
|
|
|
|
|
|
|
|
|
|
|
|
6 |
Tested up to: 3.0
|
7 |
Stable tag: trunk
|
8 |
|
9 |
+
Adds a CMS-like tree overview of your pages or custom posts. Rearrange the order of your pages (with drag and drop). Also edit, view, add, and search your pages.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
This plugin adds a CMS-like tree overview of all your pages and custom posts to WordPress - much like the view often found in a page-focused CMS, or like Windows Explorer or OS X Finder.
|
14 |
+
Within this tree you can edit pages, view pages, add pages, search pages, and drag and drop pages to rearrange the order.
|
15 |
|
16 |
+
CMS Tree Page View is a good alternative to plugins such as [pageMash](http://wordpress.org/extend/plugins/pagemash/), [WordPress Page Tree](http://wordpress.org/extend/plugins/page-tree/) and (http://wordpress.org/extend/plugins/my-page-order/)[My Page Order].
|
17 |
|
18 |
+
Page management won't get any easier than this!
|
19 |
|
20 |
#### Features and highlights:
|
21 |
|
24 |
* edit pages
|
25 |
* view pages
|
26 |
* search pages
|
27 |
+
* available for both regular pages and custom posts
|
28 |
+
* easy view your site hierarchy directly from the WordPress dashboard
|
29 |
+
* supports WPML, so you can manage all the languages of your site
|
30 |
|
31 |
#### Screencast
|
32 |
+
|
33 |
+
Watch this screencast to see how easy you could be managing your pages:
|
34 |
[youtube http://www.youtube.com/watch?v=H4BGomLi_FU]
|
35 |
|
36 |
+
#### Translations/Languages
|
37 |
+
This plugin is available in the following languages:
|
38 |
+
* English
|
39 |
+
* German
|
40 |
+
* French
|
41 |
+
* Russian
|
42 |
+
* Belorussian
|
43 |
+
* Swedish
|
44 |
+
|
45 |
+
#### Making the tree available for your vistors
|
46 |
+
If you're looking for a version of this page tree that the vistors of your site can use, then check out
|
47 |
+
this navigation widget called [Nice Navigation](http://wordpress.org/extend/plugins/nice-navigation/).
|
48 |
+
|
49 |
+
#### Donation and more plugins
|
50 |
+
* If you like this plugin don't forget to donate to support further development.
|
51 |
+
* Check out some [more plugins](http://wordpress.org/extend/plugins/profile/eskapism) by the same author.
|
52 |
+
|
53 |
+
|
54 |
== Installation ==
|
55 |
|
56 |
1. Upload the folder "cms-tree-page-view" to "/wp-content/plugins/"
|
66 |
3. Search pages.
|
67 |
4. Drag-and-drop to rearrange/change the order of the pages.
|
68 |
5. The tree is also available on the dashboard and therefore available immediately after you login.
|
69 |
+
6. The settings page - choose where you want the tree to show up
|
70 |
+
7. Users of WPML can find all their languages in the tree
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 0.6.3 =
|
75 |
+
- tree is activated for pages during install, so the user does not need to set up anything during first run
|
76 |
+
|
77 |
+
= 0.6.2 =
|
78 |
+
- Was released only as a public beta together with wpml.org, to test the wpml-integration
|
79 |
+
- Now supports custom post types.
|
80 |
+
- Now compatible with WPML Multilangual CMS (wpml.org).
|
81 |
+
- Uses WordPress own functions at some more places.
|
82 |
+
- When searching and no posts found you now get a message so you know that there were no matches.
|
83 |
+
- German translation added, by Thomas Dullnig (www.sevenspire.com). Thank you!
|
84 |
+
- Lots of code rewritten for this update of CMS Tree Page View, so please let me know if it works or if I broke something!
|
85 |
+
|
86 |
= 0.6.1 =
|
87 |
- Forgot to close a p-tag correctly. Now it should validate again!
|
88 |
- Fixed a problem where move could seem to not work when trying to move pages when several pages had the same menu_order, so they where sorted by alpha instead.
|
185 |
|
186 |
= 0.1a =
|
187 |
* First public version.
|
188 |
+
|
189 |
+
|
190 |
+
== Still on WordPress 2? ==
|
191 |
+
If you are using WordPress 2.x you can try this old version instead:
|
192 |
+
http://downloads.wordpress.org/plugin/cms-tree-page-view.0.4.9.zip
|
193 |
+
|
screenshot-6.png
ADDED
Binary file
|
screenshot-7.png
ADDED
Binary file
|
scripts/cms_tree_page_view.js
CHANGED
@@ -2,22 +2,12 @@
|
|
2 |
var cms_tpv_tree, treeOptions, div_actions;
|
3 |
jQuery(function($) {
|
4 |
|
5 |
-
cms_tpv_tree = $("
|
6 |
-
div_actions = $("
|
7 |
-
|
8 |
-
/**
|
9 |
-
* show div with options
|
10 |
-
*/
|
11 |
-
$("#cms_tpv_container li").live("mouseenter", function() {
|
12 |
-
$(this).find(".cms_tpv_tree_actions:first").show();
|
13 |
-
});
|
14 |
-
$("#cms_tpv_container li").live("mouseleave", function() {
|
15 |
-
$(this).find(".cms_tpv_tree_actions:first").hide();
|
16 |
-
});
|
17 |
|
18 |
treeOptions = {
|
19 |
xplugins: ["cookie","ui","crrm","themes","json_data","search","types","dnd"],
|
20 |
-
plugins: ["themes","json_data","cookies","search","dnd"],
|
21 |
core: {
|
22 |
"html_titles": true
|
23 |
},
|
@@ -51,47 +41,79 @@ jQuery(function($) {
|
|
51 |
}
|
52 |
}
|
53 |
|
54 |
-
if (
|
55 |
-
cms_tpv_bind_clean_node();
|
56 |
-
cms_tpv_tree.jstree(treeOptions);
|
57 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
}); // end ondomready
|
60 |
|
61 |
|
62 |
-
//
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
-
// edit page on click
|
74 |
-
jQuery(".cms_tpv_action_edit").live("click", function() {
|
75 |
-
var $li = jQuery(this).closest("li");
|
76 |
-
var editlink = $li.data("jstree").editlink;
|
77 |
-
if (editlink) {
|
78 |
-
document.location = editlink;
|
79 |
-
}
|
80 |
-
return false;
|
81 |
-
});
|
82 |
-
*/
|
83 |
|
84 |
// add page after
|
85 |
jQuery(".cms_tpv_action_add_page_after").live("click", function() {
|
86 |
var $this = jQuery(this);
|
|
|
|
|
87 |
jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
|
88 |
if (new_page_title) {
|
89 |
var pageID = $this.parents("li:first").attr("id");
|
90 |
jQuery.post(ajaxurl, {
|
91 |
-
action: "cms_tpv_add_page",
|
92 |
-
pageID: pageID,
|
93 |
-
type: "after",
|
94 |
-
page_title: new_page_title
|
|
|
|
|
95 |
}, function(data, textStatus) {
|
96 |
document.location = data;
|
97 |
});
|
@@ -104,14 +126,18 @@ jQuery(".cms_tpv_action_add_page_after").live("click", function() {
|
|
104 |
// add page inside
|
105 |
jQuery(".cms_tpv_action_add_page_inside").live("click", function() {
|
106 |
var $this = jQuery(this);
|
|
|
|
|
107 |
jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
|
108 |
if (new_page_title) {
|
109 |
var pageID = $this.parents("li:first").attr("id");
|
110 |
jQuery.post(ajaxurl, {
|
111 |
-
action: "cms_tpv_add_page",
|
112 |
-
pageID: pageID,
|
113 |
-
type: "inside",
|
114 |
-
page_title: new_page_title
|
|
|
|
|
115 |
}, function(data, textStatus) {
|
116 |
document.location = data;
|
117 |
});
|
@@ -122,8 +148,6 @@ jQuery(".cms_tpv_action_add_page_inside").live("click", function() {
|
|
122 |
|
123 |
|
124 |
|
125 |
-
|
126 |
-
|
127 |
// check if tree is beging dragged
|
128 |
function cms_tpv_is_dragging() {
|
129 |
var eDrag = jQuery("#vakata-dragged");
|
@@ -132,44 +156,43 @@ function cms_tpv_is_dragging() {
|
|
132 |
|
133 |
// mouse over, show actions
|
134 |
jQuery(".jstree li").live("mouseover", function(e) {
|
|
|
135 |
$li = jQuery(this);
|
136 |
-
|
|
|
|
|
137 |
if (cms_tpv_is_dragging() == false) {
|
138 |
|
139 |
-
if (
|
140 |
// do nada
|
141 |
-
//console.log("it's visible");
|
142 |
} else {
|
143 |
-
//console.log("it's not visible");
|
144 |
|
145 |
$li.find("a:first").addClass("hover");
|
146 |
|
147 |
-
// setup
|
148 |
-
|
149 |
-
// view page
|
150 |
-
$view = div_actions.find(".cms_tpv_action_view");
|
151 |
var permalink = $li.data("jstree").permalink;
|
152 |
$view.attr("href", permalink);
|
153 |
|
154 |
-
// edit page
|
155 |
-
$edit =
|
156 |
var editlink = $li.data("jstree").editlink;
|
157 |
$edit.attr("href", editlink);
|
158 |
|
159 |
// ..and some extras
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
|
164 |
// position and show action div
|
165 |
var $a = $li.find("a");
|
166 |
var width = $a.outerWidth(true);
|
167 |
-
$li.append(
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
}
|
174 |
}
|
175 |
});
|
@@ -284,68 +307,111 @@ function cms_tpv_bind_clean_node() {
|
|
284 |
}
|
285 |
|
286 |
// search: perform
|
287 |
-
jQuery("
|
288 |
-
jQuery(
|
289 |
-
|
|
|
290 |
s = jQuery.trim( s );
|
291 |
// search, oh the mighty search!
|
292 |
if (s) {
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
|
|
297 |
} else {
|
298 |
-
|
299 |
-
|
|
|
300 |
}
|
301 |
-
|
302 |
return false;
|
303 |
});
|
304 |
|
305 |
// search: reset
|
306 |
-
jQuery("
|
307 |
-
jQuery(
|
308 |
-
|
309 |
-
|
|
|
|
|
310 |
return false;
|
311 |
});
|
312 |
|
313 |
// open/close links
|
314 |
-
jQuery("
|
315 |
-
|
|
|
316 |
return false;
|
317 |
});
|
318 |
-
jQuery("
|
319 |
-
|
|
|
320 |
return false;
|
321 |
});
|
322 |
|
323 |
// view all or public
|
324 |
-
jQuery("
|
325 |
-
cms_tvp_set_view("all");
|
326 |
-
jQuery(this).addClass("current");
|
327 |
return false;
|
328 |
});
|
329 |
-
jQuery("
|
330 |
-
cms_tvp_set_view("public");
|
331 |
-
jQuery(this).addClass("current");
|
332 |
return false;
|
333 |
});
|
334 |
|
335 |
-
//
|
336 |
-
|
337 |
-
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
return false;
|
|
|
340 |
});
|
341 |
-
*/
|
342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
|
344 |
-
function cms_tvp_set_view(view) {
|
345 |
-
jQuery("#cms_tvp_view_all,#cms_tvp_view_public").removeClass("current");
|
346 |
-
jQuery("#cms_tpv_container").jstree("destroy").html("");
|
347 |
-
cms_tpv_bind_clean_node();
|
348 |
-
treeOptions.json_data.ajax.url = ajaxurl + CMS_TPV_AJAXURL + view;
|
349 |
-
cms_tpv_tree.jstree(treeOptions);
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
var cms_tpv_tree, treeOptions, div_actions;
|
3 |
jQuery(function($) {
|
4 |
|
5 |
+
cms_tpv_tree = $(".cms_tpv_container");
|
6 |
+
div_actions = $(".cms_tpv_page_actions");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
treeOptions = {
|
9 |
xplugins: ["cookie","ui","crrm","themes","json_data","search","types","dnd"],
|
10 |
+
plugins: ["themes","json_data","cookies","search","dnd", "types"],
|
11 |
core: {
|
12 |
"html_titles": true
|
13 |
},
|
41 |
}
|
42 |
}
|
43 |
|
44 |
+
if (cms_tpv_tree.length > 0) {
|
45 |
+
cms_tpv_bind_clean_node(); // don't remember why I run this here.. :/
|
|
|
46 |
}
|
47 |
+
cms_tpv_tree.each(function(i, elm) {
|
48 |
+
|
49 |
+
var $elm = $(elm);
|
50 |
+
|
51 |
+
// init tree, with settings specific for each post type
|
52 |
+
var treeOptionsTmp = jQuery.extend(true, {}, treeOptions);
|
53 |
+
treeOptionsTmp.json_data.ajax.url = treeOptionsTmp.json_data.ajax.url + "&post_type=" + cms_tpv_get_post_type(elm) + "&lang=" + cms_tpv_get_wpml_selected_lang(elm);
|
54 |
+
|
55 |
+
var isHierarchical = $(elm).closest(".cms_tpv_wrapper").find("[name=cms_tpv_meta_post_type_hierarchical]").val();
|
56 |
+
if (isHierarchical == 0) {
|
57 |
+
// no move to children if not hierarchical
|
58 |
+
treeOptionsTmp.types = {
|
59 |
+
"types": {
|
60 |
+
"default" : {
|
61 |
+
"valid_children" : [ "none" ]
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
$elm.bind("search.jstree", function (event, data) {
|
68 |
+
if (data.rslt.nodes.length == 0) {
|
69 |
+
// no hits. doh.
|
70 |
+
$(this).closest(".cms_tpv_wrapper").find(".cms_tree_view_search_form_no_hits").fadeIn("fast");
|
71 |
+
}
|
72 |
+
});
|
73 |
+
|
74 |
+
$elm.jstree(treeOptionsTmp);
|
75 |
+
|
76 |
+
});
|
77 |
+
|
78 |
+
|
79 |
|
80 |
}); // end ondomready
|
81 |
|
82 |
|
83 |
+
// get post type
|
84 |
+
// elm must be within .cms_tpv_wrapper to work
|
85 |
+
function cms_tpv_get_post_type(elm) {
|
86 |
+
return jQuery(elm).closest(".cms_tpv_wrapper").find("[name=cms_tpv_meta_post_type]").val();
|
87 |
+
}
|
88 |
+
// get selected lang
|
89 |
+
function cms_tpv_get_wpml_selected_lang(elm) {
|
90 |
+
return jQuery(elm).closest(".cms_tpv_wrapper").find("[name=cms_tpv_meta_wpml_language]").val();
|
91 |
+
}
|
92 |
+
|
93 |
+
function cms_tpv_get_page_actions_div(elm) {
|
94 |
+
return jQuery(elm).closest(".cms_tpv_wrapper").find(".cms_tpv_page_actions");
|
95 |
+
}
|
96 |
+
function cms_tpv_get_wrapper(elm) {
|
97 |
+
var $wrapper = jQuery(elm).closest(".cms_tpv_wrapper");
|
98 |
+
return $wrapper;
|
99 |
+
}
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
// add page after
|
103 |
jQuery(".cms_tpv_action_add_page_after").live("click", function() {
|
104 |
var $this = jQuery(this);
|
105 |
+
var post_type = cms_tpv_get_post_type(this);
|
106 |
+
var selected_lang = cms_tpv_get_wpml_selected_lang(this);
|
107 |
jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
|
108 |
if (new_page_title) {
|
109 |
var pageID = $this.parents("li:first").attr("id");
|
110 |
jQuery.post(ajaxurl, {
|
111 |
+
"action": "cms_tpv_add_page",
|
112 |
+
"pageID": pageID,
|
113 |
+
"type": "after",
|
114 |
+
"page_title": new_page_title,
|
115 |
+
"post_type": post_type,
|
116 |
+
"wpml_lang": selected_lang
|
117 |
}, function(data, textStatus) {
|
118 |
document.location = data;
|
119 |
});
|
126 |
// add page inside
|
127 |
jQuery(".cms_tpv_action_add_page_inside").live("click", function() {
|
128 |
var $this = jQuery(this);
|
129 |
+
var post_type = cms_tpv_get_post_type(this);
|
130 |
+
var selected_lang = cms_tpv_get_wpml_selected_lang(this);
|
131 |
jPrompt(cmstpv_l10n.Enter_title_of_new_page, "", "CMS Tree Page View", function(new_page_title) {
|
132 |
if (new_page_title) {
|
133 |
var pageID = $this.parents("li:first").attr("id");
|
134 |
jQuery.post(ajaxurl, {
|
135 |
+
"action": "cms_tpv_add_page",
|
136 |
+
"pageID": pageID,
|
137 |
+
"type": "inside",
|
138 |
+
"page_title": new_page_title,
|
139 |
+
"post_type": post_type,
|
140 |
+
"wpml_lang": selected_lang
|
141 |
}, function(data, textStatus) {
|
142 |
document.location = data;
|
143 |
});
|
148 |
|
149 |
|
150 |
|
|
|
|
|
151 |
// check if tree is beging dragged
|
152 |
function cms_tpv_is_dragging() {
|
153 |
var eDrag = jQuery("#vakata-dragged");
|
156 |
|
157 |
// mouse over, show actions
|
158 |
jQuery(".jstree li").live("mouseover", function(e) {
|
159 |
+
|
160 |
$li = jQuery(this);
|
161 |
+
|
162 |
+
var div_actions_for_post_type = cms_tpv_get_page_actions_div(this);
|
163 |
+
|
164 |
if (cms_tpv_is_dragging() == false) {
|
165 |
|
166 |
+
if (div_actions_for_post_type.is(":visible")) {
|
167 |
// do nada
|
|
|
168 |
} else {
|
|
|
169 |
|
170 |
$li.find("a:first").addClass("hover");
|
171 |
|
172 |
+
// setup link for view page
|
173 |
+
$view = div_actions_for_post_type.find(".cms_tpv_action_view");
|
|
|
|
|
174 |
var permalink = $li.data("jstree").permalink;
|
175 |
$view.attr("href", permalink);
|
176 |
|
177 |
+
// setup link for edit page
|
178 |
+
$edit = div_actions_for_post_type.find(".cms_tpv_action_edit");
|
179 |
var editlink = $li.data("jstree").editlink;
|
180 |
$edit.attr("href", editlink);
|
181 |
|
182 |
// ..and some extras
|
183 |
+
div_actions_for_post_type.find(".cms_tpv_page_actions_modified_time").text($li.data("jstree").modified_time);
|
184 |
+
div_actions_for_post_type.find(".cms_tpv_page_actions_modified_by").text($li.data("jstree").modified_author);
|
185 |
+
div_actions_for_post_type.find(".cms_tpv_page_actions_page_id").text($li.data("jstree").post_id);
|
186 |
|
187 |
// position and show action div
|
188 |
var $a = $li.find("a");
|
189 |
var width = $a.outerWidth(true);
|
190 |
+
$li.append(div_actions_for_post_type);
|
191 |
+
left_pos = width+28;
|
192 |
+
top_pos = -3;
|
193 |
+
div_actions_for_post_type.css("left", left_pos);
|
194 |
+
div_actions_for_post_type.css("top", top_pos);
|
195 |
+
div_actions_for_post_type.show();
|
196 |
}
|
197 |
}
|
198 |
});
|
307 |
}
|
308 |
|
309 |
// search: perform
|
310 |
+
jQuery(".cms_tree_view_search_form").live("submit", function() {
|
311 |
+
var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
|
312 |
+
$wrapper.find(".cms_tpv_search_no_hits").hide();
|
313 |
+
var s = $wrapper.find(".cms_tree_view_search").attr("value");
|
314 |
s = jQuery.trim( s );
|
315 |
// search, oh the mighty search!
|
316 |
if (s) {
|
317 |
+
$wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
|
318 |
+
$wrapper.find(".cms_tree_view_search_form_working").fadeIn("fast");
|
319 |
+
$wrapper.find(".cms_tree_view_search_form_reset")
|
320 |
+
$wrapper.find(".cms_tpv_container").jstree("search", s);
|
321 |
+
$wrapper.find(".cms_tree_view_search_form_reset").fadeIn("fast");
|
322 |
} else {
|
323 |
+
$wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
|
324 |
+
$wrapper.find(".cms_tpv_container").jstree("clear_search");
|
325 |
+
$wrapper.find(".cms_tree_view_search_form_reset").fadeOut("fast");
|
326 |
}
|
327 |
+
$wrapper.find(".cms_tree_view_search_form_working").fadeOut("fast");
|
328 |
return false;
|
329 |
});
|
330 |
|
331 |
// search: reset
|
332 |
+
jQuery(".cms_tree_view_search_form_reset").live("click", function() {
|
333 |
+
var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
|
334 |
+
$wrapper.find(".cms_tree_view_search").val("")
|
335 |
+
$wrapper.find(".cms_tpv_container").jstree("clear_search");
|
336 |
+
$wrapper.find(".cms_tree_view_search_form_reset").fadeOut("fast");
|
337 |
+
$wrapper.find(".cms_tree_view_search_form_no_hits").fadeOut("fast");
|
338 |
return false;
|
339 |
});
|
340 |
|
341 |
// open/close links
|
342 |
+
jQuery(".cms_tpv_open_all").live("click", function() {
|
343 |
+
var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
|
344 |
+
$wrapper.find(".cms_tpv_container").jstree("open_all");
|
345 |
return false;
|
346 |
});
|
347 |
+
jQuery(".cms_tpv_close_all").live("click", function() {
|
348 |
+
var $wrapper = jQuery(this).closest(".cms_tpv_wrapper");
|
349 |
+
$wrapper.find(".cms_tpv_container").jstree("close_all");
|
350 |
return false;
|
351 |
});
|
352 |
|
353 |
// view all or public
|
354 |
+
jQuery(".cms_tvp_view_all").live("click", function() {
|
355 |
+
cms_tvp_set_view("all", this);
|
356 |
+
//jQuery(this).addClass("current");
|
357 |
return false;
|
358 |
});
|
359 |
+
jQuery(".cms_tvp_view_public").live("click", function() {
|
360 |
+
cms_tvp_set_view("public", this);
|
361 |
+
//jQuery(this).addClass("current");
|
362 |
return false;
|
363 |
});
|
364 |
|
365 |
+
// change lang
|
366 |
+
jQuery("a.cms_tvp_switch_lang").live("click", function(e) {
|
367 |
+
$wrapper = cms_tpv_get_wrapper(this);
|
368 |
+
$wrapper.find("ul.cms_tvp_switch_langs a").removeClass("current");
|
369 |
+
jQuery(this).addClass("current");
|
370 |
+
|
371 |
+
var re = /cms_tpv_switch_language_code_([\w]+)/;
|
372 |
+
var matches = re.exec( jQuery(this).attr("class") );
|
373 |
+
var lang_code = matches[1];
|
374 |
+
$wrapper.find("[name=cms_tpv_meta_wpml_language]").val(lang_code);
|
375 |
+
|
376 |
+
var current_view = cms_tpv_get_current_view(this);
|
377 |
+
cms_tvp_set_view(current_view, this);
|
378 |
+
|
379 |
return false;
|
380 |
+
|
381 |
});
|
|
|
382 |
|
383 |
+
function cms_tpv_get_current_view(elm) {
|
384 |
+
$wrapper = cms_tpv_get_wrapper(elm);
|
385 |
+
if ($wrapper.find(".cms_tvp_view_all").hasClass("current")) {
|
386 |
+
return "all";
|
387 |
+
} else if ($wrapper.find(".cms_tvp_view_public").hasClass("current")) {
|
388 |
+
return "public";
|
389 |
+
} else {
|
390 |
+
return false; // like unknown
|
391 |
+
}
|
392 |
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
}
|
394 |
|
395 |
+
function cms_tvp_set_view(view, elm) {
|
396 |
+
|
397 |
+
var $wrapper = jQuery(elm).closest(".cms_tpv_wrapper");
|
398 |
+
|
399 |
+
var div_actions_for_post_type = cms_tpv_get_page_actions_div(elm);
|
400 |
+
$wrapper.append(div_actions_for_post_type);
|
401 |
+
|
402 |
+
$wrapper.find(".cms_tvp_view_all,.cms_tvp_view_public").removeClass("current");
|
403 |
+
$wrapper.find(".cms_tpv_container").jstree("destroy").html("");
|
404 |
+
cms_tpv_bind_clean_node();
|
405 |
+
|
406 |
+
if (view == "all") {
|
407 |
+
$wrapper.find(".cms_tvp_view_all").addClass("current");
|
408 |
+
} else if (view == "public") {
|
409 |
+
$wrapper.find(".cms_tvp_view_public").addClass("current");
|
410 |
+
} else {
|
411 |
+
|
412 |
+
}
|
413 |
+
|
414 |
+
var treeOptionsTmp = jQuery.extend(true, {}, treeOptions);
|
415 |
+
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);
|
416 |
+
$wrapper.find(".cms_tpv_container").jstree(treeOptionsTmp);
|
417 |
+
}
|
styles/styles.css
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
|
|
|
2 |
#cms_tpv_dashboard_widget {
|
3 |
z-index: 10;
|
4 |
}
|
|
|
5 |
|
6 |
|
7 |
-
|
|
|
|
|
|
|
8 |
clear: both;
|
9 |
overflow: visible;
|
10 |
margin-top: 1.5em;
|
@@ -28,7 +33,7 @@
|
|
28 |
zoom: 1; /* weird ie-problems otherwise, like li-items that disappear on search. */
|
29 |
}
|
30 |
|
31 |
-
|
32 |
clear: both;
|
33 |
}
|
34 |
|
@@ -126,18 +131,19 @@ li span.cms_tpv_action_add_page {
|
|
126 |
opacity: .9;
|
127 |
}
|
128 |
|
129 |
-
|
130 |
margin-left: 1em;
|
131 |
}
|
132 |
|
133 |
-
|
134 |
display: inline;
|
135 |
position: relative;
|
136 |
margin-left: 1em;
|
|
|
137 |
}
|
138 |
|
139 |
|
140 |
-
#cms_tpv_dashboard_widget
|
141 |
display: block;
|
142 |
margin-left: 0;
|
143 |
margin-top: .5em;
|
@@ -152,23 +158,28 @@ li span.cms_tpv_action_add_page {
|
|
152 |
bottom: auto;
|
153 |
}
|
154 |
|
155 |
-
|
156 |
width: 130px;
|
157 |
}
|
158 |
-
|
|
|
|
|
159 |
position: absolute;
|
160 |
-
left:
|
161 |
top: 2em;
|
162 |
display: none;
|
163 |
}
|
|
|
|
|
|
|
164 |
|
165 |
-
|
166 |
position: absolute;
|
167 |
line-height: 1;
|
168 |
display: none;
|
169 |
}
|
170 |
|
171 |
-
|
172 |
display: none;
|
173 |
position: absolute;
|
174 |
top: 2px;
|
@@ -178,23 +189,23 @@ li span.cms_tpv_action_add_page {
|
|
178 |
background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_888888_256x240.png) no-repeat -32px -194px;
|
179 |
text-indent: -9999px;
|
180 |
}
|
181 |
-
#cms_tpv_dashboard_widget
|
182 |
top: 8px;
|
183 |
}
|
184 |
-
|
185 |
background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_454545_256x240.png) no-repeat -32px -194px;
|
186 |
}
|
187 |
|
188 |
-
|
189 |
padding: 1em;
|
190 |
background-color: #FFFFE0;
|
191 |
border: 1px solid #E6DB55;
|
192 |
margin: 1em 0 1em 0;
|
193 |
}
|
194 |
-
|
195 |
margin: 0 0 .5em 0;
|
196 |
}
|
197 |
-
p
|
198 |
float: right;
|
199 |
margin-left: 2em;
|
200 |
font-size: .8em;
|
@@ -202,8 +213,9 @@ p#cms_tpv_annoying_little_box_close {
|
|
202 |
margin-right: -.5em;
|
203 |
}
|
204 |
|
205 |
-
|
206 |
width: auto;
|
|
|
207 |
height: auto;
|
208 |
background-color: white;
|
209 |
position: absolute;
|
@@ -215,10 +227,10 @@ p#cms_tpv_annoying_little_box_close {
|
|
215 |
-moz-box-shadow: 2px 2px 8px #ddd; /* FF3.5+ */
|
216 |
border: 1px solid #bbb;
|
217 |
}
|
218 |
-
|
219 |
margin: 0 0 .5em 0;
|
220 |
}
|
221 |
-
|
222 |
display: inline;
|
223 |
background: transparent;
|
224 |
text-decoration: underline;
|
@@ -226,17 +238,17 @@ p#cms_tpv_annoying_little_box_close {
|
|
226 |
color: #21759B;
|
227 |
}
|
228 |
|
229 |
-
|
230 |
{
|
231 |
color: #d54e21;
|
232 |
}
|
233 |
|
234 |
-
|
235 |
display: block;
|
236 |
overflow: auto;
|
237 |
margin: 0 0 1em 0;
|
238 |
}
|
239 |
-
|
240 |
padding: 0;
|
241 |
margin: 0;
|
242 |
background: none;
|
@@ -245,18 +257,18 @@ p#cms_tpv_annoying_little_box_close {
|
|
245 |
.cms_tpv_action_add_page {
|
246 |
display: block;
|
247 |
}
|
248 |
-
|
249 |
margin-top: 1em;
|
250 |
color: #333;
|
251 |
font-size: 11px;
|
252 |
}
|
253 |
-
|
254 |
}
|
255 |
-
|
256 |
color: #999;
|
257 |
}
|
258 |
|
259 |
-
|
260 |
width: 8px;
|
261 |
height: 15px;
|
262 |
background: url(images/arrow-left.gif) no-repeat top left;
|
1 |
|
2 |
+
/*
|
3 |
#cms_tpv_dashboard_widget {
|
4 |
z-index: 10;
|
5 |
}
|
6 |
+
*/
|
7 |
|
8 |
|
9 |
+
.cms_tpv_wrapper {
|
10 |
+
z-index: 10;
|
11 |
+
}
|
12 |
+
.cms_tpv_container {
|
13 |
clear: both;
|
14 |
overflow: visible;
|
15 |
margin-top: 1.5em;
|
33 |
zoom: 1; /* weird ie-problems otherwise, like li-items that disappear on search. */
|
34 |
}
|
35 |
|
36 |
+
.cms_tpv_search_no_hits {
|
37 |
clear: both;
|
38 |
}
|
39 |
|
131 |
opacity: .9;
|
132 |
}
|
133 |
|
134 |
+
.cms_tpv_open_all {
|
135 |
margin-left: 1em;
|
136 |
}
|
137 |
|
138 |
+
.cms_tree_view_search_form {
|
139 |
display: inline;
|
140 |
position: relative;
|
141 |
margin-left: 1em;
|
142 |
+
white-space: nowrap;
|
143 |
}
|
144 |
|
145 |
|
146 |
+
#cms_tpv_dashboard_widget .cms_tree_view_search_form {
|
147 |
display: block;
|
148 |
margin-left: 0;
|
149 |
margin-top: .5em;
|
158 |
bottom: auto;
|
159 |
}
|
160 |
|
161 |
+
.cms_tree_view_search {
|
162 |
width: 130px;
|
163 |
}
|
164 |
+
.cms_tree_view_search_form_working,
|
165 |
+
.cms_tree_view_search_form_no_hits
|
166 |
+
{
|
167 |
position: absolute;
|
168 |
+
left: .5em;
|
169 |
top: 2em;
|
170 |
display: none;
|
171 |
}
|
172 |
+
.cms_tree_view_search_form_no_hits {
|
173 |
+
font-weight: bold;
|
174 |
+
}
|
175 |
|
176 |
+
.cms_tpv_working {
|
177 |
position: absolute;
|
178 |
line-height: 1;
|
179 |
display: none;
|
180 |
}
|
181 |
|
182 |
+
.cms_tree_view_search_form_reset {
|
183 |
display: none;
|
184 |
position: absolute;
|
185 |
top: 2px;
|
189 |
background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_888888_256x240.png) no-repeat -32px -194px;
|
190 |
text-indent: -9999px;
|
191 |
}
|
192 |
+
#cms_tpv_dashboard_widget .cms_tree_view_search_form_reset {
|
193 |
top: 8px;
|
194 |
}
|
195 |
+
.cms_tree_view_search_form_reset:hover {
|
196 |
background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_454545_256x240.png) no-repeat -32px -194px;
|
197 |
}
|
198 |
|
199 |
+
.cms_tpv_annoying_little_box {
|
200 |
padding: 1em;
|
201 |
background-color: #FFFFE0;
|
202 |
border: 1px solid #E6DB55;
|
203 |
margin: 1em 0 1em 0;
|
204 |
}
|
205 |
+
.cms_tpv_annoying_little_box p {
|
206 |
margin: 0 0 .5em 0;
|
207 |
}
|
208 |
+
p.cms_tpv_annoying_little_box_close {
|
209 |
float: right;
|
210 |
margin-left: 2em;
|
211 |
font-size: .8em;
|
213 |
margin-right: -.5em;
|
214 |
}
|
215 |
|
216 |
+
.cms_tpv_page_actions {
|
217 |
width: auto;
|
218 |
+
min-width: 125px;
|
219 |
height: auto;
|
220 |
background-color: white;
|
221 |
position: absolute;
|
227 |
-moz-box-shadow: 2px 2px 8px #ddd; /* FF3.5+ */
|
228 |
border: 1px solid #bbb;
|
229 |
}
|
230 |
+
.cms_tpv_page_actions p {
|
231 |
margin: 0 0 .5em 0;
|
232 |
}
|
233 |
+
.cms_tpv_wrapper .cms_tpv_page_actions a {
|
234 |
display: inline;
|
235 |
background: transparent;
|
236 |
text-decoration: underline;
|
238 |
color: #21759B;
|
239 |
}
|
240 |
|
241 |
+
.cms_tpv_wrapper .cms_tpv_page_actions a:hover
|
242 |
{
|
243 |
color: #d54e21;
|
244 |
}
|
245 |
|
246 |
+
.cms_tpv_page_actions ul {
|
247 |
display: block;
|
248 |
overflow: auto;
|
249 |
margin: 0 0 1em 0;
|
250 |
}
|
251 |
+
.cms_tpv_page_actions li {
|
252 |
padding: 0;
|
253 |
margin: 0;
|
254 |
background: none;
|
257 |
.cms_tpv_action_add_page {
|
258 |
display: block;
|
259 |
}
|
260 |
+
.cms_tpv_page_actions dl {
|
261 |
margin-top: 1em;
|
262 |
color: #333;
|
263 |
font-size: 11px;
|
264 |
}
|
265 |
+
.cms_tpv_page_actions dl dd {
|
266 |
}
|
267 |
+
.cms_tpv_page_actions dl dt {
|
268 |
color: #999;
|
269 |
}
|
270 |
|
271 |
+
.cms_tpv_page_actions_arrow {
|
272 |
width: 8px;
|
273 |
height: 15px;
|
274 |
background: url(images/arrow-left.gif) no-repeat top left;
|