From 5a869a6983389377606418fa00afd361bae5a44f Mon Sep 17 00:00:00 2001 From: jmash Date: Sun, 16 Mar 2008 23:25:12 +0000 Subject: [PATCH] v1.0.2 git-svn-id: https://plugins.svn.wordpress.org/pagemash/trunk@35142 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- README.txt | 57 +++++++++------------- nested.js | 2 +- pagemash.php | 121 ++++++++++++++++++++--------------------------- saveList.php | 5 +- screenshot-1.png | Bin 24226 -> 58100 bytes screenshot-2.png | Bin 11006 -> 17266 bytes 6 files changed, 76 insertions(+), 109 deletions(-) diff --git a/README.txt b/README.txt index b78e238..302d83d 100644 --- a/README.txt +++ b/README.txt @@ -1,78 +1,67 @@ === pageMash > pageManagement === Contributors: JoelStarnes -Tags: order pages, ajax, re-order, drag-and-drop, admin, +Tags: order pages, ajax, re-order, drag-and-drop, admin, manage, page, pages, sidebar, header, hide, Requires at least: 2.0 Tested up to: 2.4-bleeding -Stable tag: 0.1.3 +Stable tag: 1.0.2 -Organise your page order with this simple drag-and-drop Ajax interface. +Organise page order and manage page structure with this simple drag-and-drop Ajax interface. == Description == -Customise the order your pages are listed in with a simple Ajax drag-and-drop administrative interface with an option to toggle the page visibility. Great tool to quickly re-arrange your menus. +Customise the order your pages are listed in and manage the parent structure with this simple Ajax drag-and-drop administrative interface with an option to toggle the page to be hidden from output. Great tool to quickly re-arrange your page menus. -If you want to see an example of the admin page check out: http://joelstarnes.co.uk/pagemash/example - - - -= Development Version 1.0.1 beta = - -Version 1.0.0 major rebuild of the plugin gives full recursive suppot for unlimited nested children in a collapsable list. [version 1.0.1 fixes a text-select bug in IE]. Give the beta app a download from the link below and if you have any feedback drop me a mail, [even if it works all fine and dandy its nice to know :D] http://joelstarnes.co.uk/contact - -http://joelstarnes.co.uk/pagemash/example_v1.0.1 - -http://downloads.wordpress.org/plugin/pagemash.zip +Checkout the example admin page: http://joelstarnes.co.uk/pagemash/example_v1.0.2 +Feedback is greatly appreciated: http://joelstarnes.co.uk/contact == Installation == 1. Download Plugin 1. Unzip & Upload to `/wp-content/plugins/` 1. Activate in 'Plugins' admin menu -1. {Edit your Template} +1. Then have fun.. -In most cases the plugin should work straight out the box, since most templates will include something similar to: `wp_list_pages('title_li=

Pages

);` +pageMash works with the `wp_list_pages` function. The easiest way to use it is to put the pages widget in your sidebar [WP admin page > Presentation > Widgets]. Click the configure button on the widget and ensure that 'sort by' is set to 'page order'. Hey presto, you're done. +You can also use the function anywhere in your theme code. e.g. in your sidebar.php file (but the code in here will not run if you're using any widgets) or your header.php file (somewhere under the body tag, you may want to use the depth=1 parameter to only show top levle pages). The code should look something like the following: -However to achieve full functionality including the 'exclude pages' feature you should replace the wp_list_pages() function with the following php code: +`Pages&depth=0'); ?>` - `if(function_exists('pageMash_exclude_pages'))` - `{$exclude_pages=pageMash_exclude_pages();} else{$exclude_pages='';}` - `wp_list_pages('title_li=

Pages

&exclude='.$exclude_pages);` +You can also hard-code pages to exclude and these will be merged with the pages you set to exclude in your pageMash admin. +The code here is very simple and flexible, for more information look up `wp_list_pages()` in the Wordpress Codex: http://codex.wordpress.org/Template_Tags/wp_list_pages -You can place the code wherever you would like your page listings to appear; -usually either the header.php or sidebar.php file found in: `wp-content\themes\theme_name` == Frequently Asked Questions == -If you have any questions or comments, -please drop me an email: joel@joelstarnes.co.uk - -= Can I use this with the 'Pages' sidebar widget? = -Yes. Go into the wordpress admin; Presentation > Widgets and drag the pages widget to the sidebar, then go to it's settings by clicking the icon on the right and ensure that 'sort by' value is set to 'page order'. -Note however that the exclude pages feature will not work, so disable this in the top of the pagemash.php file by setting '$excludePagesFeature = false;'. +If you have any questions or comments, please drop me an email: http://joelstarnes.co.uk/contact == Screenshots == -1. Admin Interface. +1. Admin Interface -2. If you are having problems using the pages widget; goto [Admin > Presentation > Widgets] and check that the 'sort by' value is set to 'page order'. +2. Setting up the page widget. [WP-Admin > Presentation > Widgets] ==Change Log== 0.1.0 > Initial Release -0.1.1 > Removed version check [line72] since some hosts will not allow external includes. +0.1.1 > Removed version check since some hosts will not allow external includes. 0.1.2 > Fixed CSS&JS headers to only display on pageMash admin -0.1.3 > Fixed exclude pages feature \n +0.1.3 > Fixed exclude pages feature + 1.0.0 beta > Major rebuild > Recusive page handles unlimited nested children, collapsable list items, interface makeover... +1.0.1 beta > fixed IE drag selects text + +1.0.2 > Major code rewrite for exclude pages + == Localization == -Currently only available in english. +Currently only available in english. \ No newline at end of file diff --git a/nested.js b/nested.js index b7d8737..8879786 100644 --- a/nested.js +++ b/nested.js @@ -229,7 +229,7 @@ var Nested = new Class({ var kids; if (!listEl) listEl = this.list; $$(listEl.childNodes).each(function(node, i) { - kids = $E(this.options.parentTag, node); + kids = $E('ul', node); /* set 'this.options.parentTag' straight to 'ul' to avoid safari bug */ serial[i] = { id: node.id, hide: (node.hasClass('remove')) ? 'exclude' : "", diff --git a/pagemash.php b/pagemash.php index f4bfde3..2bed955 100644 --- a/pagemash.php +++ b/pagemash.php @@ -4,7 +4,7 @@ Plugin Name: pageMash Plugin URI: http://joelstarnes.co.uk/pagemash/ Description: pageMash > pageManagement [WP_Admin > Manage > pageMash] Author: Joel Starnes -Version: 1.0.1 +Version: 1.0.2 Author URI: http://joelstarnes.co.uk/ CHANGELOG: @@ -15,6 +15,7 @@ Release: Date: Description: 1.0.0 beta 19 Feb 2008 Major update > Recusive page handles unlimited nested children, collapsable list items, interface makeover... 1.0.1 beta 14 Mar 2008 fixed IE > drag selects text +1.0.2 16 Mar 2008 Major code rewrite for exclude pages FIXME: @fixme with instantUpdateFeature hide will not send the update @@ -25,8 +26,7 @@ $minlevel = 7; /*[deafult=7]*/ /* Minimum user level to access page order */ $excludePagesFeature = true; /*[deafult=true]*/ -/* Allows you to set pages not to be listed - Will only work if you have modified the template. */ +/* Allows you to set pages not to be listed */ $instantUpdateFeature = false; /*[deafult=false]*/ /* Updates the database instantly after a move using ajax @@ -36,11 +36,12 @@ $instantUpdateFeature = false; /*[deafult=false]*/ ################################################################### /* -CREDITS: +INSPIRATIONS/CREDITS: Valerio Proietti - Mootools JS Framework [http://mootools.net/] Stefan Lange-Hegermann - Mootools AJAX timeout class extension [http://www.blackmac.de/archives/44-Mootools-AJAX-timeout.html] vladimir - Mootools Sortables class extension [http://vladimir.akilles.cl/scripts/sortables/] ShiftThis - WP Page Order Plugin [http://www.shiftthis.net/wordpress-order-pages-plugin/] +Garrett Murphey - Page Link Manager [http://gmurphey.com/2006/10/05/wordpress-plugin-page-link-manager/] */ /* Copyright 2008 Joel Starnes (email : joel@joelstarnes.co.uk) @@ -64,7 +65,7 @@ ShiftThis - WP Page Order Plugin [http://www.shiftthis.net/wordpress-order-pages function pageMash_getPages($post_parent){ //this is a recurrsive function which calls itself to produce a nested list of elements //$post_parent should be 0 for root pages, or contain a pageID to return it's sub-pages - global $wpdb, $wp_version, $instantUpdateFeature, $excludePagesFeature, $excludePagesList; + global $wpdb, $wp_version, $excludePagesFeature; if($wp_version >= 2.1){ //get pages from database $pageposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' AND post_parent = '$post_parent' ORDER BY menu_order"); }else{ @@ -74,10 +75,10 @@ function pageMash_getPages($post_parent){ if ($pageposts == true){ //if $pageposts == true then it does have sub-page(s), so list them. echo '