Version Description
- Added functionality to expand/collapse
Download this release
Release Info
| Developer | eskapism |
| Plugin | |
| Version | 1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 0.6 to 1.0
- index.php +43 -21
- jquery.biscuit.js +96 -0
- page-small-minus.gif +0 -0
- page-small-plus.gif +0 -0
- page-small.gif +0 -0
- readme.txt +3 -0
- scripts.js +49 -4
- styles.css +32 -5
index.php
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
/*
|
| 3 |
Plugin Name: Admin Menu Tree Page View
|
| 4 |
Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
|
| 5 |
-
Description:
|
| 6 |
-
Version: 0
|
| 7 |
Author: Pär Thernström
|
| 8 |
Author URI: http://eskapism.se/
|
| 9 |
License: GPL2
|
|
@@ -25,10 +25,6 @@ License: GPL2
|
|
| 25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
| 26 |
*/
|
| 27 |
|
| 28 |
-
/*
|
| 29 |
-
Admin Menu Tree Page View
|
| 30 |
-
admin-menu-tree-page-view
|
| 31 |
-
*/
|
| 32 |
add_action("admin_head", "admin_menu_tree_page_view_admin_head");
|
| 33 |
add_action('admin_menu', 'admin_menu_tree_page_view_admin_menu');
|
| 34 |
add_action("admin_init", "admin_menu_tree_page_view_admin_init");
|
|
@@ -36,18 +32,20 @@ add_action('wp_ajax_admin_menu_tree_page_view_add_page', 'admin_menu_tree_page_v
|
|
| 36 |
|
| 37 |
function admin_menu_tree_page_view_admin_init() {
|
| 38 |
|
| 39 |
-
define( "admin_menu_tree_page_view_VERSION", "0
|
| 40 |
define( "admin_menu_tree_page_view_URL", WP_PLUGIN_URL . '/admin-menu-tree-page-view/' );
|
| 41 |
|
| 42 |
wp_enqueue_style("admin_menu_tree_page_view_styles", admin_menu_tree_page_view_URL . "styles.css", false, admin_menu_tree_page_view_VERSION);
|
| 43 |
wp_enqueue_script("jquery.highlight", admin_menu_tree_page_view_URL . "jquery.highlight.js", array("jquery"));
|
|
|
|
| 44 |
wp_enqueue_script("admin_menu_tree_page_view", admin_menu_tree_page_view_URL . "scripts.js", array("jquery"));
|
| 45 |
|
|
|
|
| 46 |
$oLocale = array(
|
| 47 |
"Edit" => __("Edit", 'admin-menu-tree-page-view'),
|
| 48 |
"View" => __("View", 'admin-menu-tree-page-view'),
|
| 49 |
-
"Add_new_page_here" => __("
|
| 50 |
-
"Add_new_page_inside" => __("
|
| 51 |
"Untitled" => __("Untitled", 'admin-menu-tree-page-view'),
|
| 52 |
);
|
| 53 |
wp_localize_script( "admin_menu_tree_page_view", 'amtpv_l10n', $oLocale);
|
|
@@ -59,8 +57,6 @@ function admin_menu_tree_page_view_admin_head() {
|
|
| 59 |
|
| 60 |
function admin_menu_tree_page_view_get_pages($args) {
|
| 61 |
|
| 62 |
-
#$pages = get_pages($args);
|
| 63 |
-
|
| 64 |
$defaults = array(
|
| 65 |
"post_type" => "page",
|
| 66 |
"parent" => "0",
|
|
@@ -74,9 +70,18 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
| 74 |
|
| 75 |
$pages = get_posts($args);
|
| 76 |
$output = "";
|
|
|
|
| 77 |
foreach ($pages as $one_page) {
|
| 78 |
$edit_link = get_edit_post_link($one_page->ID);
|
| 79 |
$title = get_the_title($one_page->ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
$class = "";
|
| 81 |
if (isset($_GET["action"]) && $_GET["action"] == "edit" && isset($_GET["post"]) && $_GET["post"] == $one_page->ID) {
|
| 82 |
$class = "current";
|
|
@@ -89,11 +94,32 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
| 89 |
$status_span .= "<span class='admin-menu-tree-page-view-status admin-menu-tree-page-view-status-{$one_page->post_status}'>".__(ucfirst($one_page->post_status))."</span>";
|
| 90 |
}
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
$output .= "<li class='$class'>";
|
| 93 |
$output .= "<a href='$edit_link'>$status_span";
|
| 94 |
$output .= $title;
|
| 95 |
|
| 96 |
-
|
| 97 |
// add the view link, hidden, used in popup
|
| 98 |
$permalink = get_permalink($one_page->ID);
|
| 99 |
$output .= "<span class='admin-menu-tree-page-view-view-link'>$permalink</span>";
|
|
@@ -103,19 +129,15 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
| 103 |
$output .= "</a>";
|
| 104 |
|
| 105 |
// now fetch child articles
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
$
|
| 109 |
-
$args_childs["post_parent"] = $one_page->ID;
|
| 110 |
-
$args_childs["child_of"] = $one_page->ID;
|
| 111 |
-
#echo "<pre>";print_r($args_childs);
|
| 112 |
-
$output .= admin_menu_tree_page_view_get_pages($args_childs);
|
| 113 |
|
| 114 |
$output .= "</li>";
|
| 115 |
}
|
| 116 |
|
| 117 |
// if this is a child listing, add ul
|
| 118 |
-
if (isset($args["child_of"]) && $args["child_of"]) {
|
| 119 |
$output = "<ul class='admin-menu-tree-page-tree_childs'>$output</ul>";
|
| 120 |
}
|
| 121 |
|
|
@@ -194,7 +216,7 @@ function admin_menu_tree_page_view_add_page() {
|
|
| 194 |
#$pageID = str_replace("cms-tpv-", "", $pageID);
|
| 195 |
$page_title = trim($_POST["page_title"]);
|
| 196 |
$post_type = $_POST["post_type"];
|
| 197 |
-
$wpml_lang = $_POST["wpml_lang"];
|
| 198 |
if (!$page_title) { $page_title = __("New page", 'cms-tree-page-view'); }
|
| 199 |
|
| 200 |
$ref_post = get_post($pageID);
|
| 2 |
/*
|
| 3 |
Plugin Name: Admin Menu Tree Page View
|
| 4 |
Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
|
| 5 |
+
Description: Get a tree view of all your pages directly in the admin menu. Search, edit, view and add pages - all with just one click away!
|
| 6 |
+
Version: 1.0
|
| 7 |
Author: Pär Thernström
|
| 8 |
Author URI: http://eskapism.se/
|
| 9 |
License: GPL2
|
| 25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
| 26 |
*/
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
add_action("admin_head", "admin_menu_tree_page_view_admin_head");
|
| 29 |
add_action('admin_menu', 'admin_menu_tree_page_view_admin_menu');
|
| 30 |
add_action("admin_init", "admin_menu_tree_page_view_admin_init");
|
| 32 |
|
| 33 |
function admin_menu_tree_page_view_admin_init() {
|
| 34 |
|
| 35 |
+
define( "admin_menu_tree_page_view_VERSION", "1.0" );
|
| 36 |
define( "admin_menu_tree_page_view_URL", WP_PLUGIN_URL . '/admin-menu-tree-page-view/' );
|
| 37 |
|
| 38 |
wp_enqueue_style("admin_menu_tree_page_view_styles", admin_menu_tree_page_view_URL . "styles.css", false, admin_menu_tree_page_view_VERSION);
|
| 39 |
wp_enqueue_script("jquery.highlight", admin_menu_tree_page_view_URL . "jquery.highlight.js", array("jquery"));
|
| 40 |
+
wp_enqueue_script( "jquery-cookie", admin_menu_tree_page_view_URL . "jquery.biscuit.js", array("jquery")); // renamed from cookie to fix problems with mod_security
|
| 41 |
wp_enqueue_script("admin_menu_tree_page_view", admin_menu_tree_page_view_URL . "scripts.js", array("jquery"));
|
| 42 |
|
| 43 |
+
|
| 44 |
$oLocale = array(
|
| 45 |
"Edit" => __("Edit", 'admin-menu-tree-page-view'),
|
| 46 |
"View" => __("View", 'admin-menu-tree-page-view'),
|
| 47 |
+
"Add_new_page_here" => __("New page here", 'admin-menu-tree-page-view'),
|
| 48 |
+
"Add_new_page_inside" => __("New page inside", 'admin-menu-tree-page-view'),
|
| 49 |
"Untitled" => __("Untitled", 'admin-menu-tree-page-view'),
|
| 50 |
);
|
| 51 |
wp_localize_script( "admin_menu_tree_page_view", 'amtpv_l10n', $oLocale);
|
| 57 |
|
| 58 |
function admin_menu_tree_page_view_get_pages($args) {
|
| 59 |
|
|
|
|
|
|
|
| 60 |
$defaults = array(
|
| 61 |
"post_type" => "page",
|
| 62 |
"parent" => "0",
|
| 70 |
|
| 71 |
$pages = get_posts($args);
|
| 72 |
$output = "";
|
| 73 |
+
$str_child_output = "";
|
| 74 |
foreach ($pages as $one_page) {
|
| 75 |
$edit_link = get_edit_post_link($one_page->ID);
|
| 76 |
$title = get_the_title($one_page->ID);
|
| 77 |
+
|
| 78 |
+
// add num of children to the title
|
| 79 |
+
$post_children = get_children($one_page->ID);
|
| 80 |
+
$post_children_count = sizeof($post_children);
|
| 81 |
+
if ($post_children_count>0) {
|
| 82 |
+
$title .= " <span class='child-count'>($post_children_count)</span>";
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
$class = "";
|
| 86 |
if (isset($_GET["action"]) && $_GET["action"] == "edit" && isset($_GET["post"]) && $_GET["post"] == $one_page->ID) {
|
| 87 |
$class = "current";
|
| 94 |
$status_span .= "<span class='admin-menu-tree-page-view-status admin-menu-tree-page-view-status-{$one_page->post_status}'>".__(ucfirst($one_page->post_status))."</span>";
|
| 95 |
}
|
| 96 |
|
| 97 |
+
// add css if we have childs
|
| 98 |
+
$args_childs = $args;
|
| 99 |
+
$args_childs["parent"] = $one_page->ID;
|
| 100 |
+
$args_childs["post_parent"] = $one_page->ID;
|
| 101 |
+
$args_childs["child_of"] = $one_page->ID;
|
| 102 |
+
$str_child_output = admin_menu_tree_page_view_get_pages($args_childs);
|
| 103 |
+
if ($post_children_count>0) {
|
| 104 |
+
$class .= " admin-menu-tree-page-view-has-childs";
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// determine if ul should be opened or closed
|
| 108 |
+
$isOpened = FALSE;
|
| 109 |
+
|
| 110 |
+
// check cookie first
|
| 111 |
+
$cookie_opened = isset($_COOKIE["admin-menu-tree-page-view-open-posts"]) ? $_COOKIE["admin-menu-tree-page-view-open-posts"] : ""; // 2,95,n
|
| 112 |
+
$cookie_opened = explode(",", $cookie_opened);
|
| 113 |
+
if (in_array($one_page->ID, $cookie_opened) || $isOpened && $post_children_count>0) {
|
| 114 |
+
$class .= " admin-menu-tree-page-view-opened";
|
| 115 |
+
} elseif ($post_children_count>0) {
|
| 116 |
+
$class .= " admin-menu-tree-page-view-closed";
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
$output .= "<li class='$class'>";
|
| 120 |
$output .= "<a href='$edit_link'>$status_span";
|
| 121 |
$output .= $title;
|
| 122 |
|
|
|
|
| 123 |
// add the view link, hidden, used in popup
|
| 124 |
$permalink = get_permalink($one_page->ID);
|
| 125 |
$output .= "<span class='admin-menu-tree-page-view-view-link'>$permalink</span>";
|
| 129 |
$output .= "</a>";
|
| 130 |
|
| 131 |
// now fetch child articles
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
$output .= $str_child_output;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
$output .= "</li>";
|
| 137 |
}
|
| 138 |
|
| 139 |
// if this is a child listing, add ul
|
| 140 |
+
if (isset($args["child_of"]) && $args["child_of"] && $output != "") {
|
| 141 |
$output = "<ul class='admin-menu-tree-page-tree_childs'>$output</ul>";
|
| 142 |
}
|
| 143 |
|
| 216 |
#$pageID = str_replace("cms-tpv-", "", $pageID);
|
| 217 |
$page_title = trim($_POST["page_title"]);
|
| 218 |
$post_type = $_POST["post_type"];
|
| 219 |
+
$wpml_lang = isset($_POST["wpml_lang"]) ? $_POST["wpml_lang"] : "";
|
| 220 |
if (!$page_title) { $page_title = __("New page", 'cms-tree-page-view'); }
|
| 221 |
|
| 222 |
$ref_post = get_post($pageID);
|
jquery.biscuit.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Cookie plugin
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
| 5 |
+
* Dual licensed under the MIT and GPL licenses:
|
| 6 |
+
* http://www.opensource.org/licenses/mit-license.php
|
| 7 |
+
* http://www.gnu.org/licenses/gpl.html
|
| 8 |
+
*
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Create a cookie with the given name and value and other optional parameters.
|
| 13 |
+
*
|
| 14 |
+
* @example $.cookie('the_cookie', 'the_value');
|
| 15 |
+
* @desc Set the value of a cookie.
|
| 16 |
+
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
| 17 |
+
* @desc Create a cookie with all available options.
|
| 18 |
+
* @example $.cookie('the_cookie', 'the_value');
|
| 19 |
+
* @desc Create a session cookie.
|
| 20 |
+
* @example $.cookie('the_cookie', null);
|
| 21 |
+
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
| 22 |
+
* used when the cookie was set.
|
| 23 |
+
*
|
| 24 |
+
* @param String name The name of the cookie.
|
| 25 |
+
* @param String value The value of the cookie.
|
| 26 |
+
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
| 27 |
+
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
| 28 |
+
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
| 29 |
+
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
| 30 |
+
* when the the browser exits.
|
| 31 |
+
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
| 32 |
+
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
| 33 |
+
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
| 34 |
+
* require a secure protocol (like HTTPS).
|
| 35 |
+
* @type undefined
|
| 36 |
+
*
|
| 37 |
+
* @name $.cookie
|
| 38 |
+
* @cat Plugins/Cookie
|
| 39 |
+
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* Get the value of a cookie with the given name.
|
| 44 |
+
*
|
| 45 |
+
* @example $.cookie('the_cookie');
|
| 46 |
+
* @desc Get the value of a cookie.
|
| 47 |
+
*
|
| 48 |
+
* @param String name The name of the cookie.
|
| 49 |
+
* @return The value of the cookie.
|
| 50 |
+
* @type String
|
| 51 |
+
*
|
| 52 |
+
* @name $.cookie
|
| 53 |
+
* @cat Plugins/Cookie
|
| 54 |
+
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
| 55 |
+
*/
|
| 56 |
+
jQuery.cookie = function(name, value, options) {
|
| 57 |
+
if (typeof value != 'undefined') { // name and value given, set cookie
|
| 58 |
+
options = options || {};
|
| 59 |
+
if (value === null) {
|
| 60 |
+
value = '';
|
| 61 |
+
options.expires = -1;
|
| 62 |
+
}
|
| 63 |
+
var expires = '';
|
| 64 |
+
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
| 65 |
+
var date;
|
| 66 |
+
if (typeof options.expires == 'number') {
|
| 67 |
+
date = new Date();
|
| 68 |
+
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
| 69 |
+
} else {
|
| 70 |
+
date = options.expires;
|
| 71 |
+
}
|
| 72 |
+
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
|
| 73 |
+
}
|
| 74 |
+
// CAUTION: Needed to parenthesize options.path and options.domain
|
| 75 |
+
// in the following expressions, otherwise they evaluate to undefined
|
| 76 |
+
// in the packed version for some reason...
|
| 77 |
+
var path = options.path ? '; path=' + (options.path) : '';
|
| 78 |
+
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
| 79 |
+
var secure = options.secure ? '; secure' : '';
|
| 80 |
+
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
| 81 |
+
} else { // only name given, get cookie
|
| 82 |
+
var cookieValue = null;
|
| 83 |
+
if (document.cookie && document.cookie != '') {
|
| 84 |
+
var cookies = document.cookie.split(';');
|
| 85 |
+
for (var i = 0; i < cookies.length; i++) {
|
| 86 |
+
var cookie = jQuery.trim(cookies[i]);
|
| 87 |
+
// Does this cookie string begin with the name we want?
|
| 88 |
+
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
| 89 |
+
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
| 90 |
+
break;
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
return cookieValue;
|
| 95 |
+
}
|
| 96 |
+
};
|
page-small-minus.gif
ADDED
|
Binary file
|
page-small-plus.gif
ADDED
|
Binary file
|
page-small.gif
CHANGED
|
Binary file
|
readme.txt
CHANGED
|
@@ -39,6 +39,9 @@ Now the tree with the pages will be visible in the admin menu to the left.
|
|
| 39 |
|
| 40 |
== Changelog ==
|
| 41 |
|
|
|
|
|
|
|
|
|
|
| 42 |
= 0.6 =
|
| 43 |
- View link now uses wordpress function get_permalinks(). Previously you could get non-working links.
|
| 44 |
|
| 39 |
|
| 40 |
== Changelog ==
|
| 41 |
|
| 42 |
+
= 1.0 =
|
| 43 |
+
- Added functionality to expand/collapse
|
| 44 |
+
|
| 45 |
= 0.6 =
|
| 46 |
- View link now uses wordpress function get_permalinks(). Previously you could get non-working links.
|
| 47 |
|
scripts.js
CHANGED
|
@@ -4,7 +4,6 @@ jQuery(function($) {
|
|
| 4 |
setTimeout(function() {
|
| 5 |
jQuery("#toplevel_page_admin-menu-tree-page-tree_main").addClass("wp-menu-open");
|
| 6 |
}, 100);
|
| 7 |
-
|
| 8 |
|
| 9 |
// show menu when menu icon is clicked
|
| 10 |
jQuery(".admin-menu-tree-page-view-edit").click(function() {
|
|
@@ -60,11 +59,9 @@ jQuery(function($) {
|
|
| 60 |
div_popup.find(".admin-menu-tree-page-view-popup-view a").attr("href", view_link);
|
| 61 |
|
| 62 |
if (do_show) {
|
| 63 |
-
//console.log("show");
|
| 64 |
div_popup.fadeIn("fast");
|
| 65 |
} else {
|
| 66 |
// same popup, so close it
|
| 67 |
-
//console.log("hide");
|
| 68 |
div_popup.fadeOut("fast");
|
| 69 |
div_popup.find(".admin-menu-tree-page-view-popup-page").text("");
|
| 70 |
}
|
|
@@ -151,8 +148,56 @@ jQuery(function($) {
|
|
| 151 |
$t.closest(".admin-menu-tree-page-filter").find("input").focus();
|
| 152 |
});
|
| 153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
// http://stackoverflow.com/questions/187537/is-there-a-case-insensitive-jquery-contains-selector
|
| 156 |
jQuery.expr[':'].AminMenuTreePageContains = function(a,i,m){
|
| 157 |
return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
|
| 158 |
-
};
|
| 4 |
setTimeout(function() {
|
| 5 |
jQuery("#toplevel_page_admin-menu-tree-page-tree_main").addClass("wp-menu-open");
|
| 6 |
}, 100);
|
|
|
|
| 7 |
|
| 8 |
// show menu when menu icon is clicked
|
| 9 |
jQuery(".admin-menu-tree-page-view-edit").click(function() {
|
| 59 |
div_popup.find(".admin-menu-tree-page-view-popup-view a").attr("href", view_link);
|
| 60 |
|
| 61 |
if (do_show) {
|
|
|
|
| 62 |
div_popup.fadeIn("fast");
|
| 63 |
} else {
|
| 64 |
// same popup, so close it
|
|
|
|
| 65 |
div_popup.fadeOut("fast");
|
| 66 |
div_popup.find(".admin-menu-tree-page-view-popup-page").text("");
|
| 67 |
}
|
| 148 |
$t.closest(".admin-menu-tree-page-filter").find("input").focus();
|
| 149 |
});
|
| 150 |
|
| 151 |
+
var trees = jQuery(".admin-menu-tree-page-tree");
|
| 152 |
+
|
| 153 |
+
// add links to expand/collapse
|
| 154 |
+
trees.find(".admin-menu-tree-page-view-has-childs").prepend("<div class='admin-menu-tree-page-expand' title='Show/Hide child pages' />");
|
| 155 |
+
trees.find(".admin-menu-tree-page-expand").live("click", function(e) {
|
| 156 |
+
|
| 157 |
+
e.preventDefault();
|
| 158 |
+
var $t = $(this);
|
| 159 |
+
var $li = $t.closest("li");
|
| 160 |
+
var $a = $li.find("a:first");
|
| 161 |
+
var $ul = $li.find("ul:first");
|
| 162 |
+
|
| 163 |
+
var isOpen = false;
|
| 164 |
+
if ($ul.is(":visible")) {
|
| 165 |
+
$ul.slideUp(function() {
|
| 166 |
+
$li.addClass("admin-menu-tree-page-view-closed").removeClass("admin-menu-tree-page-view-opened");
|
| 167 |
+
});
|
| 168 |
+
|
| 169 |
+
} else {
|
| 170 |
+
$ul.slideDown(function() {
|
| 171 |
+
$li.addClass("admin-menu-tree-page-view-opened").removeClass("admin-menu-tree-page-view-closed");
|
| 172 |
+
});
|
| 173 |
+
isOpen = true;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
var post_id = $a.attr("href").match(/\?post=([\d]+)/)[1];
|
| 177 |
+
var array_pos = $.inArray(post_id, admin_menu_tree_page_view_opened_posts);
|
| 178 |
+
if (array_pos > -1) {
|
| 179 |
+
// did exist in cookie
|
| 180 |
+
admin_menu_tree_page_view_opened_posts = admin_menu_tree_page_view_opened_posts.splice(array_pos+1, 1);
|
| 181 |
+
}
|
| 182 |
+
// array now has not our post_id. so add it if visible/open
|
| 183 |
+
if (isOpen) {
|
| 184 |
+
admin_menu_tree_page_view_opened_posts.push(post_id);
|
| 185 |
+
}
|
| 186 |
+
jQuery.cookie('admin-menu-tree-page-view-open-posts', admin_menu_tree_page_view_opened_posts.join(","));
|
| 187 |
+
|
| 188 |
+
});
|
| 189 |
+
|
| 190 |
+
|
| 191 |
});
|
| 192 |
+
|
| 193 |
+
// array with all post ids that are open
|
| 194 |
+
var admin_menu_tree_page_view_opened_posts = jQuery.cookie('admin-menu-tree-page-view-open-posts') || "";
|
| 195 |
+
admin_menu_tree_page_view_opened_posts = admin_menu_tree_page_view_opened_posts.split(",");
|
| 196 |
+
if (admin_menu_tree_page_view_opened_posts[0] == "") {
|
| 197 |
+
// admin_menu_tree_page_view_opened_posts = [];
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
// http://stackoverflow.com/questions/187537/is-there-a-case-insensitive-jquery-contains-selector
|
| 201 |
jQuery.expr[':'].AminMenuTreePageContains = function(a,i,m){
|
| 202 |
return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
|
| 203 |
+
};
|
styles.css
CHANGED
|
@@ -3,8 +3,6 @@
|
|
| 3 |
background-image: none !important;
|
| 4 |
border-left-width: 1px;
|
| 5 |
border-left-style: solid;
|
| 6 |
-
xbackground: transparent url(page-small.gif) no-repeat 7px 2px !important;
|
| 7 |
-
xbackground: transparent url(http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/ui-darkness/images/ui-icons_cccccc_256x240.png) no-repeat -16px -126px;
|
| 8 |
padding-left: 19px;
|
| 9 |
}
|
| 10 |
#adminmenu li.wp-has-current-submenu ul.admin-menu-tree-page-tree {
|
|
@@ -34,13 +32,10 @@ li.toplevel_page_admin-menu-tree-page-tree_main .wp-submenu a {
|
|
| 34 |
border-left-style: solid;
|
| 35 |
border-right-width: 1px;
|
| 36 |
border-right-style: solid;
|
| 37 |
-
|
| 38 |
background: transparent url(page-small.gif) no-repeat 7px 2px !important;
|
| 39 |
-
|
| 40 |
padding-left: 19px;
|
| 41 |
padding-right: 8px;
|
| 42 |
}
|
| 43 |
-
|
| 44 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li a:hover {
|
| 45 |
background-color: #eaf2fa !important;
|
| 46 |
}
|
|
@@ -82,6 +77,14 @@ li.toplevel_page_admin-menu-tree-page-tree_main .wp-submenu a {
|
|
| 82 |
display: none;
|
| 83 |
}
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
li.admin-menu-tree-page-tree_headline,
|
| 87 |
li.admin-menu-tree-page-filter
|
|
@@ -253,3 +256,27 @@ ul.admin-menu-tree-page-tree .highlight {
|
|
| 253 |
color: #21759B;
|
| 254 |
}
|
| 255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
background-image: none !important;
|
| 4 |
border-left-width: 1px;
|
| 5 |
border-left-style: solid;
|
|
|
|
|
|
|
| 6 |
padding-left: 19px;
|
| 7 |
}
|
| 8 |
#adminmenu li.wp-has-current-submenu ul.admin-menu-tree-page-tree {
|
| 32 |
border-left-style: solid;
|
| 33 |
border-right-width: 1px;
|
| 34 |
border-right-style: solid;
|
|
|
|
| 35 |
background: transparent url(page-small.gif) no-repeat 7px 2px !important;
|
|
|
|
| 36 |
padding-left: 19px;
|
| 37 |
padding-right: 8px;
|
| 38 |
}
|
|
|
|
| 39 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li a:hover {
|
| 40 |
background-color: #eaf2fa !important;
|
| 41 |
}
|
| 77 |
display: none;
|
| 78 |
}
|
| 79 |
|
| 80 |
+
/* sublevels */
|
| 81 |
+
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-opened > a {
|
| 82 |
+
background-image: url(page-small-minus.gif) !important;
|
| 83 |
+
}
|
| 84 |
+
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-closed > a {
|
| 85 |
+
background-image: url(page-small-plus.gif) !important;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
|
| 89 |
li.admin-menu-tree-page-tree_headline,
|
| 90 |
li.admin-menu-tree-page-filter
|
| 256 |
color: #21759B;
|
| 257 |
}
|
| 258 |
|
| 259 |
+
|
| 260 |
+
ul.admin-menu-tree-page-tree .admin-menu-tree-page-expand {
|
| 261 |
+
display: block;
|
| 262 |
+
position: absolute;
|
| 263 |
+
left: 0px;
|
| 264 |
+
top: 1px;
|
| 265 |
+
width: 17px;
|
| 266 |
+
height: 14px;
|
| 267 |
+
}
|
| 268 |
+
ul.admin-menu-tree-page-tree ul .admin-menu-tree-page-expand {
|
| 269 |
+
top: 0px;
|
| 270 |
+
left: 9px;
|
| 271 |
+
}
|
| 272 |
+
ul.admin-menu-tree-page-tree ul {
|
| 273 |
+
display: none;
|
| 274 |
+
}
|
| 275 |
+
ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-opened > ul {
|
| 276 |
+
display: block;
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
ul.admin-menu-tree-page-tree span.child-count {
|
| 281 |
+
color: #999999;
|
| 282 |
+
}
|
