From 157f42aa696202d5a04186abf0bc73e1126543ed Mon Sep 17 00:00:00 2001 From: jmash Date: Sat, 24 May 2008 08:31:26 +0000 Subject: [PATCH] v1.1.2 git-svn-id: https://plugins.svn.wordpress.org/pagemash/trunk@47649 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- README.txt | 5 +++- pagemash.js | 44 ++++++++++++++++++++++------------- pagemash.php | 66 +++++++++++++++++++++++++++++++++++----------------- reorder.php | 15 ------------ saveList.php | 6 +++-- 5 files changed, 81 insertions(+), 55 deletions(-) delete mode 100644 reorder.php diff --git a/README.txt b/README.txt index a4a5b4b..1a4ed99 100644 --- a/README.txt +++ b/README.txt @@ -3,7 +3,7 @@ Contributors: JoelStarnes Tags: order pages, ajax, re-order, drag-and-drop, admin, manage, page, pages, sidebar, header, hide, Requires at least: 2.1 Tested up to: 2.5 -Stable tag: 1.1.1 +Stable tag: 1.1.2 Organise page order and manage page structure with this simple drag-and-drop Ajax interface. @@ -51,6 +51,9 @@ Any good up-to-date browser should work fine. I test in Firefox, IE7, Safari and ==Change Log== +* 1.1.2 + * Added Expand all | Collapse all buttons + * 1.1.1 * Fix a bug with console.log for safari * Removed php code from js&css scripts to fix error diff --git a/pagemash.js b/pagemash.js index af10658..f3d22ff 100644 --- a/pagemash.js +++ b/pagemash.js @@ -150,26 +150,38 @@ window.addEvent('domready', function(){ e.stop(); }); }); + + $('collapse_all').addEvent('click', function(e){ e = new Event(e); + $ES('li','pageMash_pages').each(function(el) { + if(el.hasClass('children')) el.addClass('collapsed'); + }); + e.stop(); }); + + $('expand_all').addEvent('click', function(e){ e = new Event(e); + $ES('li','pageMash_pages').each(function(el) { + if(el.hasClass('children')) el.removeClass('collapsed'); + }); + e.stop(); }); /* disable drag text-selection for IE */ if (typeof document.body.onselectstart!="undefined") document.body.onselectstart=function(){return false} - -/* InlineEdit: rename pages */ -$$('#pageMash_pages li span.title').each(function(el){ //#pageMash_pages li span.title - el.setStyle('cursor','pointer'); - $E('a.rename', el.parentNode).addEvent('click',function(){ - el.inlineEdit({ - onStart:function(el){ - el.parentNode.addClass('renaming'); - }, - onComplete:function(el,oldContent,newContent){ - el.parentNode.removeClass('renaming').addClass('renamed'); - console.log("Page: '%s' has been RENAMED to: '%s'", oldContent, newContent); - } + + /* InlineEdit: rename pages */ + $$('#pageMash_pages li span.title').each(function(el){ //#pageMash_pages li span.title + el.setStyle('cursor','pointer'); + $E('a.rename', el.parentNode).addEvent('click',function(){ + el.inlineEdit({ + onStart:function(el){ + el.parentNode.addClass('renaming'); + }, + onComplete:function(el,oldContent,newContent){ + el.parentNode.removeClass('renaming').addClass('renamed'); + console.log("Page: '%s' has been RENAMED to: '%s'", oldContent, newContent); + } + }); }); }); -}); - -console.info("We're all up and running.") + + console.info("We're all up and running.") }); /* close dom ready */ \ No newline at end of file diff --git a/pagemash.php b/pagemash.php index 7118f2c..11c210f 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.1.1 +Version: 1.1.2 Author URI: http://joelstarnes.co.uk/ CHANGELOG: @@ -18,7 +18,8 @@ Release: Date: Description: 1.0.3 18 Mar 2008 Fixed datatype bug causing array problems 1.0.4 11 Apr 2008 removed shorthand PHP and updated CSS and JS headers to admin_print_scripts hook. 1.1.0 24 Apr 2008 Added quick rename, externalised scripts, changed display of edit|hide|rename links, deregisters prototype -1.11 29 Apr 2008 Fix a bug with console.log for safari, removed php code from js&css scripts to fix error +1.1.1 29 Apr 2008 Fix a bug with console.log for safari, removed php code from js&css scripts to fix error +1.1.2 24 May 2008 Added Expand all | Collapse all buttons */ #########CONFIG OPTIONS############################################ @@ -28,6 +29,12 @@ $minlevel = 7; /*[deafult=7]*/ $excludePagesFeature = true; /*[deafult=true]*/ /* Allows you to set pages not to be listed */ +$renamePagesFeature = true; /*[deafult=true]*/ +/* Lets you rename pages */ + +$CollapsePagesOnLoad = false; /*[deafult=true]*/ +/* Collapse all parent pages on load */ + ################################################################### /* INSPIRATIONS/CREDITS: @@ -62,7 +69,7 @@ $pageMash_abs_dir = get_bloginfo('wpurl').'/'.$pageMash_rel_dir; 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, $excludePagesFeature, $excludePagesList; + global $wpdb, $wp_version, $excludePagesFeature, $excludePagesList, $renamePagesFeature; 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{ @@ -71,8 +78,13 @@ function pageMash_getPages($post_parent){ if ($pageposts == true){ //if $pageposts == true then it does have sub-page(s), so list them. echo (0 === $post_parent) ? '