git-svn-id: https://plugins.svn.wordpress.org/pagemash/trunk@43487 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
jmash 2008-04-29 21:51:13 +00:00
parent 44334a550b
commit b70918f428
4 changed files with 22 additions and 54 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.1 Requires at least: 2.1
Tested up to: 2.5 Tested up to: 2.5
Stable tag: 1.1.0 Stable tag: 1.1.1
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.
@ -51,6 +51,9 @@ Any good up-to-date browser should work fine. I test in Firefox, IE7, Safari and
==Change Log== ==Change Log==
* 1.1.1
* Fix a bug with console.log for safari, removed php code from js&css scripts to fix error
* 1.1.0 * 1.1.0
* Added quick rename * Added quick rename
* Externalised scripts * Externalised scripts

View File

@ -1,8 +1,3 @@
<?php
header('Content-Type: text/css');
require_once('../../../wp-config.php');
global $instantUpdateFeature, $excludePagesFeature, $pageMash_abs_dir;
?>
/* __ __ _ /* __ __ _
WordPress Plugin | \/ | | | WordPress Plugin | \/ | | |
_ __ __ _ __ _ ___| \ / | __ _ ___| |__ _ __ __ _ __ _ ___| \ / | __ _ ___| |__
@ -23,17 +18,17 @@ body.wp-admin div#wpwrap div#wpcontent ul#pageMash_pages {
} }
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('<?php echo $pageMash_abs_dir; ?>collapse.png'); background-image: url('collapse.png');
} }
ul#pageMash_pages li.collapsed.children { ul#pageMash_pages li.collapsed.children {
background-image: url('<?php echo $pageMash_abs_dir; ?>expand.png'); background-image: url('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('<?php echo $pageMash_abs_dir; ?>page.png') no-repeat 4px 4px; background:#F1F1F1 url('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; }

View File

@ -1,8 +1,3 @@
<?php
require_once('../../../wp-config.php');
cache_javascript_headers();
global $instantUpdateFeature, $excludePagesFeature, $pageMash_abs_dir;
?>
/* __ __ _ /* __ __ _
WordPress Plugin | \/ | | | WordPress Plugin | \/ | | |
_ __ __ _ __ _ ___| \ / | __ _ ___| |__ _ __ __ _ __ _ ___| \ / | __ _ ___| |__
@ -16,24 +11,15 @@
*/ */
window.addEvent('domready', function(){ window.addEvent('domready', function(){
// When logging debug messages with console.warn // If user doesn't have Firebug, create empty functions for the console.
// if user doesn't have Firebug, write them to the DOM instead if (!window.console || !console.firebug)
if (typeof console == "undefined") { {
// Create an unordered list to display warning messages var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
var logsOutput = document.createElement('ul'); "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
$("debug_list").appendChild(logsOutput);
// Define console.warn() function window.console = {};
console = { for (var i = 0; i < names.length; ++i)
warn: function(msg) { window.console[names[i]] = function() {}
logsOutput.innerHTML += '<li>' + msg + '</li>';
}
};
// Create an empty function for all other console methods
var consoleMethods = ["log", "debug", "info", "error", "assert", "dir", "dirxml", "group",
"groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
for (var i = 0; i < consoleMethods.length; ++i)
console[consoleMethods[i]] = function() {}
} }
}); });
@ -63,7 +49,7 @@ var SaveList = function() {
var theDump = sortIt.serialize(); var theDump = sortIt.serialize();
console.group('Database Update'); console.group('Database Update');
console.time('Update Chronometer'); console.time('Update Chronometer');
new Ajax('<?php echo $pageMash_abs_dir; ?>saveList.php', { new Ajax('../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",
@ -87,12 +73,10 @@ var SaveList = function() {
}).request(); }).request();
}; };
/* toggle the remove class of grandparent */ /* toggle the remove class of grandparent */
<?php if($excludePagesFeature): ?>
var toggleRemove = function(el) { var toggleRemove = function(el) {
el.parentNode.parentNode.parentNode.toggleClass('remove'); el.parentNode.parentNode.parentNode.toggleClass('remove');
console.log("Page: '%s' has been %s", $E('span.title', el.parentNode.parentNode.parentNode).innerHTML, (el.parentNode.parentNode.hasClass('remove') ? 'HIDDEN': 'MADE VISIBLE' )); console.log("Page: '%s' has been %s", $E('span.title', el.parentNode.parentNode.parentNode).innerHTML, (el.parentNode.parentNode.hasClass('remove') ? 'HIDDEN': 'MADE VISIBLE' ));
} }
<?php endif; ?>
/* ******** dom ready ******** */ /* ******** dom ready ******** */
@ -102,7 +86,6 @@ window.addEvent('domready', function(){
onComplete: function(el) { onComplete: function(el) {
el.setStyle('background-color', '#F1F1F1'); el.setStyle('background-color', '#F1F1F1');
sortIt.altColor(); sortIt.altColor();
<?php if($instantUpdateFeature): ?>SaveList();<?php endif; ?>
$ES('li','pageMash_pages').each(function(el) { $ES('li','pageMash_pages').each(function(el) {
if( el.getElement('ul') ){ if( el.getElement('ul') ){
@ -131,13 +114,11 @@ window.addEvent('domready', function(){
sortIt.altColor(); sortIt.altColor();
$('update_status').setStyle('opacity', 0); $('update_status').setStyle('opacity', 0);
<?php if(!$instantUpdateFeature): ?>
$('pageMash_submit').addEvent('click', function(e){ $('pageMash_submit').addEvent('click', function(e){
e = new Event(e); e = new Event(e);
SaveList(); SaveList();
e.stop(); e.stop();
}); });
<?php endif; ?>
var pageMashInfo = new Fx.Slide('pageMashInfo'); var pageMashInfo = new Fx.Slide('pageMashInfo');
$('pageMashInfo_toggle').addEvent('click', function(e){ $('pageMashInfo_toggle').addEvent('click', function(e){

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.1.0 Version: 1.1.1
Author URI: http://joelstarnes.co.uk/ Author URI: http://joelstarnes.co.uk/
CHANGELOG: CHANGELOG:
@ -18,10 +18,7 @@ Release: Date: Description:
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. 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.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
FIXME:
@fixme with instantUpdateFeature hide will not send the update
@todo readme txt CMS, mass edit pages, exclude pages, manage, organise,
*/ */
#########CONFIG OPTIONS############################################ #########CONFIG OPTIONS############################################
@ -31,12 +28,6 @@ $minlevel = 7; /*[deafult=7]*/
$excludePagesFeature = true; /*[deafult=true]*/ $excludePagesFeature = true; /*[deafult=true]*/
/* Allows you to set pages not to be listed */ /* Allows you to set pages not to be listed */
$instantUpdateFeature = false; /*[deafult=false]*/
/* Updates the database instantly after a move using ajax
otherwise it will wait for update button press.
nb. this feature has not been optimised and enabling will cause
much increased server load */
################################################################### ###################################################################
/* /*
INSPIRATIONS/CREDITS: INSPIRATIONS/CREDITS:
@ -105,13 +96,13 @@ function pageMash_getPages($post_parent){
} }
function pageMash_main(){ function pageMash_main(){
global $instantUpdateFeature, $excludePagesFeature, $excludePagesList; global $excludePagesFeature, $excludePagesList;
if(!is_array(get_option('exclude_pages'))) $excludePagesList=array(); else $excludePagesList = get_option('exclude_pages'); //if it's empty set as an empty array if(!is_array(get_option('exclude_pages'))) $excludePagesList=array(); else $excludePagesList = get_option('exclude_pages'); //if it's empty set as an empty array
?> ?>
<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.1.0] version [1.1.1]
</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;">
@ -123,9 +114,7 @@ function pageMash_main(){
<p class="submit"> <p class="submit">
<div id="update_status" style="float:left; margin-left:40px; opacity:0;"></div> <div id="update_status" style="float:left; margin-left:40px; opacity:0;"></div>
<?php if(!$instantUpdateFeature): ?>
<input type="submit" id="pageMash_submit" tabindex="2" style="font-weight: bold; float:right;" value="Update" name="submit"/> <input type="submit" id="pageMash_submit" tabindex="2" style="font-weight: bold; float:right;" value="Update" name="submit"/>
<?php endif; ?>
</p> </p>
<br style="margin-bottom: .8em;" /> <br style="margin-bottom: .8em;" />
</div> </div>
@ -154,7 +143,7 @@ function pageMash_head(){
wp_enqueue_script('pagemash_mootools', '/'.$pageMash_rel_dir.'nest-mootools.v1.11.js', false, false); //code is not compatible with other releases of moo wp_enqueue_script('pagemash_mootools', '/'.$pageMash_rel_dir.'nest-mootools.v1.11.js', false, false); //code is not compatible with other releases of moo
wp_enqueue_script('pagemash_nested', '/'.$pageMash_rel_dir.'nested.js', array('pagemash_mootools'), false); wp_enqueue_script('pagemash_nested', '/'.$pageMash_rel_dir.'nested.js', array('pagemash_mootools'), false);
wp_enqueue_script('pagemash_inlineEdit', '/'.$pageMash_rel_dir.'inlineEdit.v1.2.js', array('pagemash_mootools'), false); wp_enqueue_script('pagemash_inlineEdit', '/'.$pageMash_rel_dir.'inlineEdit.v1.2.js', array('pagemash_mootools'), false);
wp_enqueue_script('pagemash', '/'.$pageMash_rel_dir.'pagemash-js.php', array('pagemash_mootools'), false); wp_enqueue_script('pagemash', '/'.$pageMash_rel_dir.'pagemash.js', array('pagemash_mootools'), false);
add_action('admin_head', 'pageMash_add_css', 1); add_action('admin_head', 'pageMash_add_css', 1);
} }
@ -162,7 +151,7 @@ function pageMash_head(){
function pageMash_add_css(){ function pageMash_add_css(){
global $pageMash_abs_dir; global $pageMash_abs_dir;
?> ?>
<link rel="stylesheet" type="text/css" href="<?php echo $pageMash_abs_dir ?>pagemash-css.php" /> <link rel="stylesheet" type="text/css" href="<?php echo $pageMash_abs_dir ?>pagemash.css" />
<!-- __ __ _ <!-- __ __ _
WordPress Plugin | \/ | | | WordPress Plugin | \/ | | |
_ __ __ _ __ _ ___| \ / | __ _ ___| |__ _ __ __ _ __ _ ___| \ / | __ _ ___| |__