git-svn-id: https://plugins.svn.wordpress.org/pagemash/trunk@39824 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
jmash 2008-04-11 19:14:04 +00:00
parent a2c94645a0
commit 391e1f422b
2 changed files with 20 additions and 19 deletions

View File

@ -3,7 +3,7 @@ Contributors: JoelStarnes
Tags: order pages, ajax, re-order, drag-and-drop, admin, manage, page, pages, sidebar, header, hide, Tags: order pages, ajax, re-order, drag-and-drop, admin, manage, page, pages, sidebar, header, hide,
Requires at least: 2.0 Requires at least: 2.0
Tested up to: 2.4-bleeding Tested up to: 2.4-bleeding
Stable tag: 1.0.3 Stable tag: 1.0.4
Organise page order and manage page structure with this simple drag-and-drop Ajax interface. Organise page order and manage page structure with this simple drag-and-drop Ajax interface.
@ -66,6 +66,8 @@ No. You no longer need to add the pageMash parameter as you did with the previou
1.0.3 > Fixed datatype bug causing array problems 1.0.3 > Fixed datatype bug causing array problems
1.0.4 > Removed shorthand PHP and updated CSS and JS headers to admin_print_scripts hook.
== Localization == == Localization ==

View File

@ -4,7 +4,7 @@ Plugin Name: pageMash
Plugin URI: http://joelstarnes.co.uk/pagemash/ Plugin URI: http://joelstarnes.co.uk/pagemash/
Description: pageMash > pageManagement [WP_Admin > Manage > pageMash] Description: pageMash > pageManagement [WP_Admin > Manage > pageMash]
Author: Joel Starnes Author: Joel Starnes
Version: 1.0.3 Version: 1.0.4
Author URI: http://joelstarnes.co.uk/ Author URI: http://joelstarnes.co.uk/
CHANGELOG: CHANGELOG:
@ -17,6 +17,7 @@ Release: Date: Description:
1.0.1 beta 14 Mar 2008 Fixed IE > drag selects text 1.0.1 beta 14 Mar 2008 Fixed IE > drag selects text
1.0.2 16 Mar 2008 Major code rewrite for exclude pages, funct hooks onto wp_list_pages 1.0.2 16 Mar 2008 Major code rewrite for exclude pages, funct hooks onto wp_list_pages
1.0.3 18 Mar 2008 Fixed datatype bug causing array problems 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.
FIXME: FIXME:
@fixme with instantUpdateFeature hide will not send the update @fixme with instantUpdateFeature hide will not send the update
@ -79,11 +80,11 @@ function pageMash_getPages($post_parent){
echo '>'; echo '>';
foreach ($pageposts as $page): //list pages, [the 'li' ID must be the page ID] ?> foreach ($pageposts as $page): //list pages, [the 'li' ID must be the page ID] ?>
<li id="pm_<?=$page->ID;?>" <?php if(get_option('exclude_pages')){ if(in_array($page->ID, $excludePagesList)) echo 'class="remove"'; }//if page is in exclude list, add class remove ?>> <li id="pm_<?php echo $page->ID; ?>" <?php if(get_option('exclude_pages')){ if(in_array($page->ID, $excludePagesList)) echo 'class="remove"'; }//if page is in exclude list, add class remove ?>>
<span class="title"><?=$page->post_title;?></span> <span class="title"><?php echo $page->post_title; ?></span>
<span class="pageMash_pageFunctions"> <span class="pageMash_pageFunctions">
id:<?=$page->ID;?> id:<?php echo $page->ID; ?>
[<a href="<?=get_settings('siteurl').'/wp-admin/post.php?action=edit&post='.$page->ID; ?>" title="Edit This Page">edit</a>] [<a href="<?php echo get_settings('siteurl').'/wp-admin/post.php?action=edit&post='.$page->ID; ?>" title="Edit This Page">edit</a>]
<?php if($excludePagesFeature): ?> <?php if($excludePagesFeature): ?>
[<a href="#" title="Show|Hide" class="excludeLink" onclick="toggleRemove(this); return false">hide</a>] [<a href="#" title="Show|Hide" class="excludeLink" onclick="toggleRemove(this); return false">hide</a>]
<?php endif; ?> <?php endif; ?>
@ -105,7 +106,7 @@ function pageMash_main(){
<div id="debug_list"></div> <div id="debug_list"></div>
<div id="pageMash" class="wrap"> <div id="pageMash" class="wrap">
<div id="pageMash_checkVersion" style="float:right; font-size:.7em; margin-top:5px;"> <div id="pageMash_checkVersion" style="float:right; font-size:.7em; margin-top:5px;">
version [1.0.3] version [1.0.4]
</div> </div>
<h2 style="margin-bottom:0; clear:none;">pageMash - pageManagement</h2> <h2 style="margin-bottom:0; clear:none;">pageMash - pageManagement</h2>
<p style="margin-top:4px;"> <p style="margin-top:4px;">
@ -142,7 +143,6 @@ function pageMash_main(){
} }
function pageMash_head(){ function pageMash_head(){
if(strrpos('>'.$_GET["page"], 'pagemash')): // only include header stuff on pagemash admin page
//stylesheet & javascript to go in page header //stylesheet & javascript to go in page header
global $instantUpdateFeature, $excludePagesFeature; global $instantUpdateFeature, $excludePagesFeature;
?> ?>
@ -153,17 +153,17 @@ if(strrpos('>'.$_GET["page"], 'pagemash')): // only include header stuff on page
} }
ul#pageMash_pages li.collapsed ul { display:none; } ul#pageMash_pages li.collapsed ul { display:none; }
ul#pageMash_pages li.children { ul#pageMash_pages li.children {
background-image: url('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/collapse.png'); background-image: url('<?php echo get_settings("siteurl") ?>/wp-content/plugins/pagemash/collapse.png');
} }
ul#pageMash_pages li.collapsed.children { ul#pageMash_pages li.collapsed.children {
background-image: url('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/expand.png'); background-image: url('<?php echo get_settings("siteurl") ?>/wp-content/plugins/pagemash/expand.png');
} }
ul#pageMash_pages li { ul#pageMash_pages li {
display:block; display:block;
margin:2px 0 0 0; margin:2px 0 0 0;
border-bottom:1px solid #aaa; border-right:1px solid #aaa; border-top:1px solid #ccc; border-left:1px solid #ccc; border-bottom:1px solid #aaa; border-right:1px solid #aaa; border-top:1px solid #ccc; border-left:1px solid #ccc;
padding:4px 6px 4px 24px; padding:4px 6px 4px 24px;
background:#F1F1F1 url('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/page.png') no-repeat 4px 4px; background:#F1F1F1 url('<?php echo get_settings("siteurl") ?>/wp-content/plugins/pagemash/page.png') no-repeat 4px 4px;
list-style-type:none; list-style-type:none;
} }
ul#pageMash_pages li span.title { font-weight: bold; } ul#pageMash_pages li span.title { font-weight: bold; }
@ -214,8 +214,8 @@ if(strrpos('>'.$_GET["page"], 'pagemash')): // only include header stuff on page
#pageMash_code .orange{color:#EC9E00;} #pageMash_code .orange{color:#EC9E00;}
</style> </style>
<!-- Current code not compatible with newer releases of moo --> <!-- Current code not compatible with newer releases of moo -->
<script type="text/javascript" src="<?=get_settings('siteurl')?>/wp-content/plugins/pagemash/nest-mootools.v1.11.js"></script> <script type="text/javascript" src="<?php echo get_settings('siteurl') ?>/wp-content/plugins/pagemash/nest-mootools.v1.11.js"></script>
<script type="text/javascript" src="<?=get_settings('siteurl')?>/wp-content/plugins/pagemash/nested.js"></script> <script type="text/javascript" src="<?php echo get_settings('siteurl') ?>/wp-content/plugins/pagemash/nested.js"></script>
<script type="text/javascript"> <script type="text/javascript">
/* add timeout to Ajax class */ /* add timeout to Ajax class */
@ -241,7 +241,7 @@ Ajax = Ajax.extend({
/* function to retrieve list data and send to server in JSON format */ /* function to retrieve list data and send to server in JSON format */
var SaveList = function() { var SaveList = function() {
var theDump = sortIt.serialize(); var theDump = sortIt.serialize();
new Ajax('<?=get_settings("siteurl")?>/wp-content/plugins/pagemash/saveList.php', { new Ajax('<?php echo get_settings("siteurl") ?>/wp-content/plugins/pagemash/saveList.php', {
method: 'post', method: 'post',
postBody: 'm='+Json.toString(theDump), postBody: 'm='+Json.toString(theDump),
// update: "debug_list", // update: "debug_list",
@ -348,10 +348,9 @@ window.addEvent('domready', function(){
}); /* close dom ready */ }); /* close dom ready */
</script> </script>
<?php <?php
endif; //main function only display head if jmash admin page
} }
function pageMash_add_excludes($excludes) { function pageMash_add_excludes($excludes){
//merge array of hardcoded exclude pages with pageMash ones //merge array of hardcoded exclude pages with pageMash ones
if(is_array(get_option('exclude_pages'))){ if(is_array(get_option('exclude_pages'))){
$excludes = array_merge( get_option('exclude_pages'), $excludes ); $excludes = array_merge( get_option('exclude_pages'), $excludes );
@ -359,15 +358,15 @@ function pageMash_add_excludes($excludes) {
sort($excludes); sort($excludes);
return $excludes; return $excludes;
} }
function pageMash_add_pages(){ function pageMash_add_pages(){
//add link in the management tab //add link in the management tab
global $minlevel; global $minlevel;
add_management_page('pageMash page order', 'pageMash', $minlevel, __FILE__, 'pageMash_main'); $page = add_management_page('pageMash page order', 'pageMash', $minlevel, __FILE__, 'pageMash_main');
add_action( "admin_print_scripts-$page", 'pageMash_head' ); //add css styles and JS code to head
} }
add_action('admin_menu', 'pageMash_add_pages'); //add admin menu under management tab add_action('admin_menu', 'pageMash_add_pages'); //add admin menu under management tab
add_action('admin_head', 'pageMash_head'); //add css styles and JS code to head
add_filter('wp_list_pages_excludes', 'pageMash_add_excludes'); //add exclude pages to wp_list_pages funct add_filter('wp_list_pages_excludes', 'pageMash_add_excludes'); //add exclude pages to wp_list_pages funct
?> ?>