pageMash > Page Management - Version 1.0.2

Version Description

Download this release

Release Info

Developer jmash
Plugin Icon wp plugin pageMash > Page Management
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

Files changed (6) hide show
  1. README.txt +23 -34
  2. nested.js +1 -1
  3. pagemash.php +51 -71
  4. saveList.php +2 -3
  5. screenshot-1.png +0 -0
  6. screenshot-2.png +0 -0
README.txt CHANGED
@@ -1,78 +1,67 @@
1
  === pageMash > pageManagement ===
2
  Contributors: JoelStarnes
3
- Tags: order pages, ajax, re-order, drag-and-drop, admin,
4
  Requires at least: 2.0
5
  Tested up to: 2.4-bleeding
6
- Stable tag: 0.1.3
7
 
8
- Organise your page order with this simple drag-and-drop Ajax interface.
9
 
10
  == Description ==
11
 
12
- 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.
13
 
14
- If you want to see an example of the admin page check out: http://joelstarnes.co.uk/pagemash/example
15
-
16
-
17
-
18
- = Development Version 1.0.1 beta =
19
-
20
- 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
21
-
22
- http://joelstarnes.co.uk/pagemash/example_v1.0.1
23
-
24
- http://downloads.wordpress.org/plugin/pagemash.zip
25
 
 
26
 
27
  == Installation ==
28
 
29
  1. Download Plugin
30
  1. Unzip & Upload to `/wp-content/plugins/`
31
  1. Activate in 'Plugins' admin menu
32
- 1. {Edit your Template}
33
 
34
- In most cases the plugin should work straight out the box, since most templates will include something similar to: `wp_list_pages('title_li=<h2>Pages</h2>);`
35
 
 
36
 
37
- However to achieve full functionality including the 'exclude pages' feature you should replace the wp_list_pages() function with the following php code:
38
 
39
- `if(function_exists('pageMash_exclude_pages'))`
40
- `{$exclude_pages=pageMash_exclude_pages();} else{$exclude_pages='';}`
41
- `wp_list_pages('title_li=<h2>Pages</h2>&exclude='.$exclude_pages);`
42
 
 
43
 
44
- You can place the code wherever you would like your page listings to appear;
45
- usually either the header.php or sidebar.php file found in: `wp-content\themes\theme_name`
46
 
47
  == Frequently Asked Questions ==
48
 
49
- If you have any questions or comments,
50
- please drop me an email: joel@joelstarnes.co.uk
51
-
52
- = Can I use this with the 'Pages' sidebar widget? =
53
- 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'.
54
- 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;'.
55
 
56
 
57
  == Screenshots ==
58
 
59
- 1. Admin Interface.
60
 
61
- 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'.
62
 
63
 
64
  ==Change Log==
65
 
66
  0.1.0 > Initial Release
67
 
68
- 0.1.1 > Removed version check [line72] since some hosts will not allow external includes.
69
 
70
  0.1.2 > Fixed CSS&JS headers to only display on pageMash admin
71
 
72
- 0.1.3 > Fixed exclude pages feature \n
 
73
  1.0.0 beta > Major rebuild > Recusive page handles unlimited nested children, collapsable list items, interface makeover...
74
 
 
 
 
 
75
 
76
  == Localization ==
77
 
78
- Currently only available in english.
1
  === pageMash > pageManagement ===
2
  Contributors: JoelStarnes
3
+ Tags: order pages, ajax, re-order, drag-and-drop, admin, manage, page, pages, sidebar, header, hide,
4
  Requires at least: 2.0
5
  Tested up to: 2.4-bleeding
6
+ Stable tag: 1.0.2
7
 
8
+ Organise page order and manage page structure with this simple drag-and-drop Ajax interface.
9
 
10
  == Description ==
11
 
12
+ 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.
13
 
14
+ Checkout the example admin page: http://joelstarnes.co.uk/pagemash/example_v1.0.2
 
 
 
 
 
 
 
 
 
 
15
 
16
+ Feedback is greatly appreciated: http://joelstarnes.co.uk/contact
17
 
18
  == Installation ==
19
 
20
  1. Download Plugin
21
  1. Unzip & Upload to `/wp-content/plugins/`
22
  1. Activate in 'Plugins' admin menu
23
+ 1. Then have fun..
24
 
25
+ 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.
26
 
27
+ 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:
28
 
29
+ `<?php wp_list_pages('title_li=<h2>Pages</h2>&depth=0'); ?>`
30
 
31
+ You can also hard-code pages to exclude and these will be merged with the pages you set to exclude in your pageMash admin.
 
 
32
 
33
+ 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
34
 
 
 
35
 
36
  == Frequently Asked Questions ==
37
 
38
+ If you have any questions or comments, please drop me an email: http://joelstarnes.co.uk/contact
 
 
 
 
 
39
 
40
 
41
  == Screenshots ==
42
 
43
+ 1. Admin Interface
44
 
45
+ 2. Setting up the page widget. [WP-Admin > Presentation > Widgets]
46
 
47
 
48
  ==Change Log==
49
 
50
  0.1.0 > Initial Release
51
 
52
+ 0.1.1 > Removed version check since some hosts will not allow external includes.
53
 
54
  0.1.2 > Fixed CSS&JS headers to only display on pageMash admin
55
 
56
+ 0.1.3 > Fixed exclude pages feature
57
+
58
  1.0.0 beta > Major rebuild > Recusive page handles unlimited nested children, collapsable list items, interface makeover...
59
 
60
+ 1.0.1 beta > fixed IE drag selects text
61
+
62
+ 1.0.2 > Major code rewrite for exclude pages
63
+
64
 
65
  == Localization ==
66
 
67
+ Currently only available in english.
nested.js CHANGED
@@ -229,7 +229,7 @@ var Nested = new Class({
229
  var kids;
230
  if (!listEl) listEl = this.list;
231
  $$(listEl.childNodes).each(function(node, i) {
232
- kids = $E(this.options.parentTag, node);
233
  serial[i] = {
234
  id: node.id,
235
  hide: (node.hasClass('remove')) ? 'exclude' : "",
229
  var kids;
230
  if (!listEl) listEl = this.list;
231
  $$(listEl.childNodes).each(function(node, i) {
232
+ kids = $E('ul', node); /* set 'this.options.parentTag' straight to 'ul' to avoid safari bug */
233
  serial[i] = {
234
  id: node.id,
235
  hide: (node.hasClass('remove')) ? 'exclude' : "",
pagemash.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: pageMash
4
  Plugin URI: http://joelstarnes.co.uk/pagemash/
5
  Description: pageMash > pageManagement [WP_Admin > Manage > pageMash]
6
  Author: Joel Starnes
7
- Version: 1.0.1
8
  Author URI: http://joelstarnes.co.uk/
9
 
10
  CHANGELOG:
@@ -15,6 +15,7 @@ Release: Date: Description:
15
  1.0.0 beta 19 Feb 2008 Major update > Recusive page handles unlimited nested children,
16
  collapsable list items, interface makeover...
17
  1.0.1 beta 14 Mar 2008 fixed IE > drag selects text
 
18
 
19
  FIXME:
20
  @fixme with instantUpdateFeature hide will not send the update
@@ -25,8 +26,7 @@ $minlevel = 7; /*[deafult=7]*/
25
  /* Minimum user level to access page order */
26
 
27
  $excludePagesFeature = true; /*[deafult=true]*/
28
- /* Allows you to set pages not to be listed
29
- Will only work if you have modified the template. */
30
 
31
  $instantUpdateFeature = false; /*[deafult=false]*/
32
  /* Updates the database instantly after a move using ajax
@@ -36,11 +36,12 @@ $instantUpdateFeature = false; /*[deafult=false]*/
36
 
37
  ###################################################################
38
  /*
39
- CREDITS:
40
  Valerio Proietti - Mootools JS Framework [http://mootools.net/]
41
  Stefan Lange-Hegermann - Mootools AJAX timeout class extension [http://www.blackmac.de/archives/44-Mootools-AJAX-timeout.html]
42
  vladimir - Mootools Sortables class extension [http://vladimir.akilles.cl/scripts/sortables/]
43
  ShiftThis - WP Page Order Plugin [http://www.shiftthis.net/wordpress-order-pages-plugin/]
 
44
  */
45
 
46
  /* 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
64
  function pageMash_getPages($post_parent){
65
  //this is a recurrsive function which calls itself to produce a nested list of elements
66
  //$post_parent should be 0 for root pages, or contain a pageID to return it's sub-pages
67
- global $wpdb, $wp_version, $instantUpdateFeature, $excludePagesFeature, $excludePagesList;
68
  if($wp_version >= 2.1){ //get pages from database
69
  $pageposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' AND post_parent = '$post_parent' ORDER BY menu_order");
70
  }else{
@@ -74,10 +75,10 @@ function pageMash_getPages($post_parent){
74
  if ($pageposts == true){ //if $pageposts == true then it does have sub-page(s), so list them.
75
  echo '<ul ';
76
  if($post_parent==0) echo 'id="pageMash_pages" '; //add this ID only to root 'ul' element
77
- echo 'style="list-style:none;">';
78
 
79
  foreach ($pageposts as $page): //list pages, [the 'li' ID must be the page ID] ?>
80
- <li id="pm_<?=$page->ID;?>" <?php if(strpos($excludePagesList, ','.$page->ID.',')){echo 'class="remove"';}//if page is in exclude list, add class remove ?>>
81
  <span class="title"><?=$page->post_title;?></span>
82
  <span class="pageMash_pageFunctions">
83
  id:<?=$page->ID;?>
@@ -97,18 +98,13 @@ function pageMash_getPages($post_parent){
97
  }
98
 
99
  function pageMash_main(){
100
- global $wpdb, $wp_version, $instantUpdateFeature, $excludePagesFeature, $excludePagesList;
101
-
102
- //get pages-to-hide from database
103
- $excludePagesObj = $wpdb->get_results("SELECT option_value FROM $wpdb->options WHERE option_name = 'exclude_pages'");
104
- $excludePagesList = '>,'.$excludePagesObj[0]->option_value;
105
- //precede with '>,' otherwise the first pageid will return 0 when strpos() is called to find it.
106
- //the initial coma allows us to search for ',$pageid,' so as to avoid partial matches
107
  ?>
108
  <div id="debug_list"></div>
109
  <div id="pageMash" class="wrap">
110
  <div id="pageMash_checkVersion" style="float:right; font-size:.7em; margin-top:5px;">
111
- version [1.0.1 beta]
112
  </div>
113
  <h2 style="margin-bottom:0; clear:none;">pageMash - pageManagement</h2>
114
  <p style="margin-top:4px;">
@@ -131,24 +127,15 @@ function pageMash_main(){
131
 
132
  <div class="wrap" style="width:160px; margin-bottom:0; padding:2px; text-align:center;"><a href="#" id="pageMashInfo_toggle" style="text-align:center;">Show|Hide Further Info</a></div>
133
  <div class="wrap" id="pageMashInfo" style="margin-top:-1px;">
134
- <h2>How to Install</h2>
135
- <p style="font-size:1.1em;">In most cases, to use this plugin you will not need to change anything, however if its not working you will need to either:</p>
136
- <ol style="list-style-type:upper-alpha;">
137
- <li>Check your 'pages' widget in the WP admin panel under the Presentation>Widgets tab and click the little icon on the pages widget and ensure that <strong>sort by</strong> is set to <strong>'page order'</strong>. </li>
138
- <li>If you want the pages listed else-where or do not use the widgets or you would like to use the excludePagesFeature, then you need to edit your template:
139
- <ol style="list-style-type:upper-roman;">
140
- <li style="margin-bottom:0;">To use the code in your sidebar.php file you need to remove all widgets in your WP admin to active the sidebar code and then find the <strong>wp_list_pages()</strong> function and change it to the code below </li>
141
- <li style="margin-bottom:0;">To insert the pages in your header; modify header.php insert the code anywhere inside the body tag. (You may want to add the depth=1 parameter on the 2nd line if you only want top level pages listed)</li>
142
- </ol>
143
- Then to enable the excludePagesFeature find the line $excludePagesFeature = false; near the top of pagemash.php and change the value to true.
144
- </li>
145
- </ol>
146
  <p style="margin-bottom:0; font-weight:bold;">Code:</p>
147
- <code>
148
- <span class="white">&lt;?php</span> <span class="purple">if(</span><span class="blue">function_exists(</span><span class="orange">'pageMash_exclude_pages'</span><span class="blue">)</span><span class="purple">){</span><span class="yellow">$exclude_pages</span><span class="white">=</span><span class="blue">pageMash_exclude_pages();</span><span class="purple">} else{</span><span class="yellow">$exclude_pages</span><span class="white">=</span><span class="orange">''</span><span class="blue">;</span><span class="purple">}</span><span class="white">?&gt;</span><br />
149
- <span class="white">&lt;?php</span> <span class="blue">wp_list_pages(</span><span class="orange">'title_li=&lt;h2&gt;Pages&lt;/h2&gt;&amp;exclude='</span><span class="green">.</span><span class="yellow">$exclude_pages</span><span class="blue">);</span><span class="white">?&gt;</span>
150
  </code>
151
- <p>The plugin code is very simple and flexible, for more information look at the wp_list_pages() function on the <a href="http://codex.wordpress.org/Template_Tags/wp_list_pages" title="wp_list_pages Documentation">Wordpress Codex</a> and if you have any further questions or feedback, just <a href="http://joelstarnes.co.uk/contact/" title="email Joel Starnes">drop me an email</a>.</p>
 
152
  </div>
153
  <?php
154
  }
@@ -161,10 +148,9 @@ if(strrpos('>'.$_GET["page"], 'pagemash')): // only include header stuff on page
161
  <style type="text/css">
162
  ul#pageMash_pages {
163
  margin:0 0 0 0;
 
164
  }
165
- ul#pageMash_pages li.collapsed ul {
166
- display:none;
167
- }
168
  ul#pageMash_pages li.children {
169
  background-image: url('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/collapse.png');
170
  }
@@ -179,15 +165,9 @@ if(strrpos('>'.$_GET["page"], 'pagemash')): // only include header stuff on page
179
  background:#F1F1F1 url('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/page.png') no-repeat 4px 4px;
180
  list-style-type:none;
181
  }
182
- ul#pageMash_pages li span.title {
183
- font-weight: bold;
184
- }
185
- ul#pageMash_pages li.collapsed.children span.title {
186
- text-decoration: underline;
187
- }
188
- ul#pageMash_pages li.collapsed.children li span.title {
189
- text-decoration: none;
190
- }
191
  #update_status {
192
  font-weight:bold;
193
  display:block;
@@ -195,7 +175,13 @@ if(strrpos('>'.$_GET["page"], 'pagemash')): // only include header stuff on page
195
  background-color: #DDA37A;
196
  padding: 2px 6px;
197
  }
198
- ul#pageMash_pages li.remove { color:grey; border-style:dashed; opacity:.5;}
 
 
 
 
 
 
199
  ul#pageMash_pages li.remove a { color:grey; }
200
  ul#pageMash_pages li span.pageMash_pageFunctions {
201
  border:1px solid #ccc;
@@ -204,6 +190,7 @@ if(strrpos('>'.$_GET["page"], 'pagemash')): // only include header stuff on page
204
  }
205
  ul#pageMash_pages li span.pageMash_pageFunctions a { border:0; }
206
 
 
207
  ul#pageMash_pages li span.pageMash_pageFunctions { display:none; }
208
  ul#pageMash_pages li:hover span.pageMash_pageFunctions { display:inline; }
209
  ul#pageMash_pages li:hover li span.pageMash_pageFunctions { display:none; }
@@ -217,15 +204,15 @@ if(strrpos('>'.$_GET["page"], 'pagemash')): // only include header stuff on page
217
  ul#pageMash_pages li:hover li:hover li:hover li:hover li:hover li span.pageMash_pageFunctions { display:none; }
218
  ul#pageMash_pages li:hover li:hover li:hover li:hover li:hover li:hover span.pageMash_pageFunctions { display:inline; }
219
 
220
- code {display:block; border:solid 3px #858EF4; background-color:#211E1E; padding:7px; margin:0px;}
221
- code .white{color:#DADADA;}
222
- code .purple{color:#9B2E4D; font-weight:bold;}
223
- code .green{color:#00FF00;}
224
- code .blue{color:#858EF4;}
225
- code .yellow{color:#C1C144;}
226
- code .orange{color:#EC9E00;}
227
  </style>
228
- <!-- Current JSON ajax code not compatible with newer releases of moo -->
229
  <script type="text/javascript" src="<?=get_settings('siteurl')?>/wp-content/plugins/pagemash/nest-mootools.v1.11.js"></script>
230
  <script type="text/javascript" src="<?=get_settings('siteurl')?>/wp-content/plugins/pagemash/nested.js"></script>
231
  <script type="text/javascript">
@@ -256,14 +243,14 @@ var SaveList = function() {
256
  new Ajax('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/saveList.php', {
257
  method: 'post',
258
  postBody: 'm='+Json.toString(theDump),
259
- /* update: "debug_list", */
260
  onComplete: function() {
261
  $('update_status').setText('Database Updated');
262
  new Fx.Style($('update_status'), 'opacity', {duration: 500}).start(0,1).chain(function() {
263
  new Fx.Style($('update_status'), 'opacity', {duration: 1500}).start(1,0);
264
  });
265
  },
266
- timeout: 5500,
267
  onTimeout: function() {
268
  $('update_status').setText('Error: Update Timeout');
269
  new Fx.Style($('update_status'), 'opacity', {duration: 200}).start(0,1);
@@ -353,15 +340,9 @@ window.addEvent('domready', function(){
353
  });
354
  });
355
 
356
- //disable drag text-selection
357
- var target = document.body;
358
- if (typeof target.onselectstart!="undefined") //for IE
359
- target.onselectstart=function(){return false}
360
- else if (typeof target.style.MozUserSelect!="undefined") //for mozilla
361
- target.style.MozUserSelect="none"
362
- else //for safari, opera, etc
363
- target.onmousedown=function(){return false}
364
-
365
 
366
  }); /* close dom ready */
367
  </script>
@@ -369,22 +350,21 @@ window.addEvent('domready', function(){
369
  endif; //main function only display head if jmash admin page
370
  }
371
 
372
-
 
 
 
 
 
373
  function pageMash_add_pages(){
374
  //add link in the management tab
375
  global $minlevel;
376
  add_management_page('pageMash page order', 'pageMash', $minlevel, __FILE__, 'pageMash_main');
377
  }
378
- function pageMash_exclude_pages(){
379
- /* returns coma delimited list of pages to exclude from output
380
- this is used as a parameter in the wp_list_pages() function */
381
- global $wpdb;
382
- $excludePagesObj = $wpdb->get_results("SELECT option_value FROM $wpdb->options WHERE option_name = 'exclude_pages'");
383
- return $excludePagesObj[0]->option_value;
384
- }
385
 
386
  add_action('admin_menu', 'pageMash_add_pages'); //add admin menu under management tab
387
  add_action('admin_head', 'pageMash_head'); //add css styles and JS code to head
 
388
 
389
 
390
  ?>
4
  Plugin URI: http://joelstarnes.co.uk/pagemash/
5
  Description: pageMash > pageManagement [WP_Admin > Manage > pageMash]
6
  Author: Joel Starnes
7
+ Version: 1.0.2
8
  Author URI: http://joelstarnes.co.uk/
9
 
10
  CHANGELOG:
15
  1.0.0 beta 19 Feb 2008 Major update > Recusive page handles unlimited nested children,
16
  collapsable list items, interface makeover...
17
  1.0.1 beta 14 Mar 2008 fixed IE > drag selects text
18
+ 1.0.2 16 Mar 2008 Major code rewrite for exclude pages
19
 
20
  FIXME:
21
  @fixme with instantUpdateFeature hide will not send the update
26
  /* Minimum user level to access page order */
27
 
28
  $excludePagesFeature = true; /*[deafult=true]*/
29
+ /* Allows you to set pages not to be listed */
 
30
 
31
  $instantUpdateFeature = false; /*[deafult=false]*/
32
  /* Updates the database instantly after a move using ajax
36
 
37
  ###################################################################
38
  /*
39
+ INSPIRATIONS/CREDITS:
40
  Valerio Proietti - Mootools JS Framework [http://mootools.net/]
41
  Stefan Lange-Hegermann - Mootools AJAX timeout class extension [http://www.blackmac.de/archives/44-Mootools-AJAX-timeout.html]
42
  vladimir - Mootools Sortables class extension [http://vladimir.akilles.cl/scripts/sortables/]
43
  ShiftThis - WP Page Order Plugin [http://www.shiftthis.net/wordpress-order-pages-plugin/]
44
+ Garrett Murphey - Page Link Manager [http://gmurphey.com/2006/10/05/wordpress-plugin-page-link-manager/]
45
  */
46
 
47
  /* Copyright 2008 Joel Starnes (email : joel@joelstarnes.co.uk)
65
  function pageMash_getPages($post_parent){
66
  //this is a recurrsive function which calls itself to produce a nested list of elements
67
  //$post_parent should be 0 for root pages, or contain a pageID to return it's sub-pages
68
+ global $wpdb, $wp_version, $excludePagesFeature, $excludePagesList;
69
  if($wp_version >= 2.1){ //get pages from database
70
  $pageposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' AND post_parent = '$post_parent' ORDER BY menu_order");
71
  }else{
75
  if ($pageposts == true){ //if $pageposts == true then it does have sub-page(s), so list them.
76
  echo '<ul ';
77
  if($post_parent==0) echo 'id="pageMash_pages" '; //add this ID only to root 'ul' element
78
+ echo '>';
79
 
80
  foreach ($pageposts as $page): //list pages, [the 'li' ID must be the page ID] ?>
81
+ <li id="pm_<?=$page->ID;?>" <?php if(in_array($page->ID, $excludePagesList)) echo 'class="remove"';//if page is in exclude list, add class remove ?>>
82
  <span class="title"><?=$page->post_title;?></span>
83
  <span class="pageMash_pageFunctions">
84
  id:<?=$page->ID;?>
98
  }
99
 
100
  function pageMash_main(){
101
+ global $instantUpdateFeature, $excludePagesFeature, $excludePagesList;
102
+ if(!is_array(get_option('exclude_pages'))) $excludePagesList=array(); else $excludePagesList = get_option('exclude_pages'); //if it's empty set as an empty array
 
 
 
 
 
103
  ?>
104
  <div id="debug_list"></div>
105
  <div id="pageMash" class="wrap">
106
  <div id="pageMash_checkVersion" style="float:right; font-size:.7em; margin-top:5px;">
107
+ version [1.0.2]
108
  </div>
109
  <h2 style="margin-bottom:0; clear:none;">pageMash - pageManagement</h2>
110
  <p style="margin-top:4px;">
127
 
128
  <div class="wrap" style="width:160px; margin-bottom:0; padding:2px; text-align:center;"><a href="#" id="pageMashInfo_toggle" style="text-align:center;">Show|Hide Further Info</a></div>
129
  <div class="wrap" id="pageMashInfo" style="margin-top:-1px;">
130
+ <h2>How to Use</h2>
131
+ <p>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.</p>
132
+ <p>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:</p>
 
 
 
 
 
 
 
 
 
133
  <p style="margin-bottom:0; font-weight:bold;">Code:</p>
134
+ <code id="pageMash_code">
135
+ <span class="white">&lt;?php</span> <span class="blue">wp_list_pages(</span><span class="orange">'title_li=&lt;h2&gt;Pages&lt;/h2&gt;&amp;depth=0'</span><span class="blue">);</span> <span class="white">?&gt;</span>
 
136
  </code>
137
+ <p>You can also hard-code pages to exclude and these will be merged with the pages you set to exclude in your pageMash admin.</p>
138
+ <p>The code here is very simple and flexible, for more information look up <a href="http://codex.wordpress.org/Template_Tags/wp_list_pages" title="wp_list_pages Documentation">wp_list_pages() in the Wordpress Codex</a> as it is very well documented and if you have any further questions or feedback I like getting messages, so <a href="http://joelstarnes.co.uk/contact/" title="email Joel Starnes">drop me an email</a>.</p>
139
  </div>
140
  <?php
141
  }
148
  <style type="text/css">
149
  ul#pageMash_pages {
150
  margin:0 0 0 0;
151
+ list-style:none;
152
  }
153
+ ul#pageMash_pages li.collapsed ul { display:none; }
 
 
154
  ul#pageMash_pages li.children {
155
  background-image: url('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/collapse.png');
156
  }
165
  background:#F1F1F1 url('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/page.png') no-repeat 4px 4px;
166
  list-style-type:none;
167
  }
168
+ ul#pageMash_pages li span.title { font-weight: bold; }
169
+ ul#pageMash_pages li.collapsed.children span.title { text-decoration: underline; }
170
+ ul#pageMash_pages li.collapsed.children li span.title { text-decoration: none; }
 
 
 
 
 
 
171
  #update_status {
172
  font-weight:bold;
173
  display:block;
175
  background-color: #DDA37A;
176
  padding: 2px 6px;
177
  }
178
+ ul#pageMash_pages li.remove {
179
+ color:grey;
180
+ border-style:dashed;
181
+ border-color:#aaa;
182
+ opacity:.5;
183
+ filter:alpha(opacity=50); zoom:1; /* ie hack[has layout] for opacity */
184
+ }
185
  ul#pageMash_pages li.remove a { color:grey; }
186
  ul#pageMash_pages li span.pageMash_pageFunctions {
187
  border:1px solid #ccc;
190
  }
191
  ul#pageMash_pages li span.pageMash_pageFunctions a { border:0; }
192
 
193
+ /* Show [page id, 'edit page' link and 'hide' link] function box on hover */
194
  ul#pageMash_pages li span.pageMash_pageFunctions { display:none; }
195
  ul#pageMash_pages li:hover span.pageMash_pageFunctions { display:inline; }
196
  ul#pageMash_pages li:hover li span.pageMash_pageFunctions { display:none; }
204
  ul#pageMash_pages li:hover li:hover li:hover li:hover li:hover li span.pageMash_pageFunctions { display:none; }
205
  ul#pageMash_pages li:hover li:hover li:hover li:hover li:hover li:hover span.pageMash_pageFunctions { display:inline; }
206
 
207
+ #pageMash_code {display:block; border:solid 3px #858EF4; background-color:#211E1E; padding:7px; margin:0px;}
208
+ #pageMash_code .white{color:#DADADA;}
209
+ #pageMash_code .purple{color:#9B2E4D; font-weight:bold;}
210
+ #pageMash_code .green{color:#00FF00;}
211
+ #pageMash_code .blue{color:#858EF4;}
212
+ #pageMash_code .yellow{color:#C1C144;}
213
+ #pageMash_code .orange{color:#EC9E00;}
214
  </style>
215
+ <!-- Current code not compatible with newer releases of moo -->
216
  <script type="text/javascript" src="<?=get_settings('siteurl')?>/wp-content/plugins/pagemash/nest-mootools.v1.11.js"></script>
217
  <script type="text/javascript" src="<?=get_settings('siteurl')?>/wp-content/plugins/pagemash/nested.js"></script>
218
  <script type="text/javascript">
243
  new Ajax('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/saveList.php', {
244
  method: 'post',
245
  postBody: 'm='+Json.toString(theDump),
246
+ // update: "debug_list",
247
  onComplete: function() {
248
  $('update_status').setText('Database Updated');
249
  new Fx.Style($('update_status'), 'opacity', {duration: 500}).start(0,1).chain(function() {
250
  new Fx.Style($('update_status'), 'opacity', {duration: 1500}).start(1,0);
251
  });
252
  },
253
+ timeout: 8500,
254
  onTimeout: function() {
255
  $('update_status').setText('Error: Update Timeout');
256
  new Fx.Style($('update_status'), 'opacity', {duration: 200}).start(0,1);
340
  });
341
  });
342
 
343
+ //disable drag text-selection for IE
344
+ if (typeof document.body.onselectstart!="undefined")
345
+ document.body.onselectstart=function(){return false}
 
 
 
 
 
 
346
 
347
  }); /* close dom ready */
348
  </script>
350
  endif; //main function only display head if jmash admin page
351
  }
352
 
353
+ function pageMash_add_excludes($excludes) {
354
+ //merge array of hardcoded exclude pages with pageMash ones
355
+ $excludes = array_merge( get_option('exclude_pages'), $excludes );
356
+ sort($excludes);
357
+ return $excludes;
358
+ }
359
  function pageMash_add_pages(){
360
  //add link in the management tab
361
  global $minlevel;
362
  add_management_page('pageMash page order', 'pageMash', $minlevel, __FILE__, 'pageMash_main');
363
  }
 
 
 
 
 
 
 
364
 
365
  add_action('admin_menu', 'pageMash_add_pages'); //add admin menu under management tab
366
  add_action('admin_head', 'pageMash_head'); //add css styles and JS code to head
367
+ add_filter('wp_list_pages_excludes', 'pageMash_add_excludes'); //add exclude pages to wp_list_pages funct
368
 
369
 
370
  ?>
saveList.php CHANGED
@@ -5,7 +5,6 @@ require('myjson.php'); //JSON decode lib
5
  require('./../../../wp-config.php'); //config to connect to database
6
 
7
  global $wpdb, $excludePages;
8
- $excludePages = "";
9
 
10
  // fetch JSON object from $_POST['m']
11
  $json = new Services_JSON();
@@ -22,8 +21,8 @@ function saveList($parent, $children) {
22
  //IDs are 'JM_#' so strip first 3 characters
23
  $id = (int) substr($children[$k]->id, 3);
24
 
25
- //if it had the remove class it is now added to the excludePages var
26
- if($v->hide=='exclude') $excludePages .= $id.',';
27
 
28
  //update pages in db
29
  $postquery = "UPDATE $wpdb->posts SET menu_order='$i', post_parent='$parent' WHERE ID='$id'";
5
  require('./../../../wp-config.php'); //config to connect to database
6
 
7
  global $wpdb, $excludePages;
 
8
 
9
  // fetch JSON object from $_POST['m']
10
  $json = new Services_JSON();
21
  //IDs are 'JM_#' so strip first 3 characters
22
  $id = (int) substr($children[$k]->id, 3);
23
 
24
+ //if it had the remove class it is now added to the excludePages array
25
+ if($v->hide=='exclude') $excludePages[] = $id;
26
 
27
  //update pages in db
28
  $postquery = "UPDATE $wpdb->posts SET menu_order='$i', post_parent='$parent' WHERE ID='$id'";
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file