Index: wp-admin/admin-ajax.php =================================================================== --- wp-admin/admin-ajax.php (revision 6137) +++ wp-admin/admin-ajax.php (working copy) @@ -312,6 +312,60 @@ } die('0'); break; +case 'page-order-load' : + + if ( !current_user_can('order_pages') ) { + header("HTTP/1.0 400 Bad Request"); + die(); + } + + require_once('../wp-includes/class-page-order.php'); + require_once('../wp-includes/class-JSON.php'); + $wppo = new WP_Page_Order(); + + //USER FETCHING DATA FROM THE SERVER + $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + $firstReq = $_REQUEST['firstIndex']; + $count = $_REQUEST['count']; + $hash = $wppo->get_paginated_pages($firstReq, $count); + $retJson = $json->encode($hash); + echo $retJson; + die(); + +case 'page-order-save' : + + if ( !current_user_can('order_pages') ) { + header("HTTP/1.0 400 Bad Request"); + die(); + } + + require_once('../wp-includes/class-page-order.php'); + $wppo = new WP_Page_Order(); + + //USER SENDING DATA TO THE SERVER + if(isset($_POST['nested-sortable-widget']) && is_array($_POST['nested-sortable-widget']['items'])) { + //if there is only one chunk of data + $page_chunks = array($_POST['nested-sortable-widget']); + } elseif (isset($_POST['nested-sortable-widget'][0]) && is_array($_POST['nested-sortable-widget'][0]['items'])) { + //more than one chunk + $page_chunks = $_POST['nested-sortable-widget']; + } else { + header("HTTP/1.0 400 Bad Request"); + die(); + } + foreach($page_chunks as $key => $chunk) { + if(!$wppo->save_page_order($chunk['items'])) { + $return_error = true; + } + } + if(!$return_error) { + echo "SUCCESS"; + } else { + header("HTTP/1.0 500 Internal Server Error"); + } + die(); + +break; default : do_action( 'wp_ajax_' . $_POST['action'] ); die('0'); Index: wp-admin/css/nestedsortablewidget.css =================================================================== --- wp-admin/css/nestedsortablewidget.css (revision 0) +++ wp-admin/css/nestedsortablewidget.css (revision 0) @@ -0,0 +1,141 @@ +/*##################################*/ +/*Units are written in em, considering a font size of 13px*/ + +.nsw-load-button { + margin: 14px 0 0 0 +} + +.nsw-list-wrap { + padding: 0em 1em 1em 1em; +} + +.nsw-header-wrap { + padding: 1em 1em 0em 1em; +} + +.nsw-wrap { + border:1px solid #BBBBBB; + padding: 1em 1em 1em 1em; +} + +.nsw-drop { + background: #F0F8FF; + color: #A0A0A0; + text-align: center; + margin: 0.5em 0 0.5em 0; + padding: 1em 0 1em 0; + border-color: #F2F2F2 rgb(232, 232, 232) rgb(232, 232, 232) rgb(242, 242, 242); + border-style: solid; + border-width: 1px; +} + +.nsw-active-drop { + background: yellow; +} + +.nsw-nav-previous { +float:left; +} +.nsw-nav-next { +float:right; +} +.nsw-nav-links { +display:block; +margin-bottom:1em; +margin-top:1em; +text-align:center; +clear: both; +float: none; +} + +.nsw-list-holder, .nsw-header { + list-style: none; + margin: 0; + padding: 0; +} + +.nsw-clear { + clear: both; +} + +.nsw-item , .nsw-header-item{ + margin: 0; + padding: 0; +} + +.nsw-alt-cell{ + background: #f1f1f1 !important; +} + +.nsw-item div div { + background: #f8f8f8; +} + +.nsw-header-item div div { + background: #DFDFDF; + font-weight: bold; +} + +.nsw-save-button, +.nsw-disabled-save-button, +.nsw-disabled-save-button:focus, +.nsw-disabled-save-button:active, +.nsw-save-button:focus { + background: url( ../images/fade-butt.png ); + background-color: #F2F2F2; + border-color:#CCCCCC rgb(153, 153, 153) rgb(153, 153, 153) rgb(204, 204, 204); + border-style:double; + border-width:3px; + color:#333333; + padding:0.25em; + float:right; +} + +.nsw-disabled-save-button, +.nsw-disabled-save-button:focus, +.nsw-disabled-save-button:active { + color: #AAAAAA; +} + +.nsw-save-button:active { + background:#F4F4F4 none repeat scroll 0%; + border-color:#999999 rgb(204, 204, 204) rgb(204, 204, 204) rgb(153, 153, 153); + border-style:double; + border-width:3px; +} + +.nsw-progress { + background: center url(../images/progress_indicator.gif) no-repeat; + width:16px; + height:16px; + left: 50%; + top: 0.5em; + position: absolute; +} + +.nsw-warning { + left: 30%; + top: 0.5em; + width: 40%; + position: absolute; + background: yellow; + border: solid 1px; + border-color:#CCCCCC rgb(153, 153, 153) rgb(153, 153, 153) rgb(204, 204, 204); + text-align: center; +} + +.nsw-save-progress-wrap { + position: static; +} + +.nsw-progress-warning-wrap { + position: relative; +} + +.nsw-handle { + font-weight: bold; +} + +.nsw-helper { +border:2px dashed #777777; +} Index: wp-admin/edit-pages.php =================================================================== --- wp-admin/edit-pages.php (revision 6137) +++ wp-admin/edit-pages.php (working copy) @@ -3,8 +3,16 @@ $title = __('Pages'); $parent_file = 'edit.php'; wp_enqueue_script( 'listman' ); +if ( current_user_can('order_pages') ) { + wp_enqueue_script( 'edit-page-order' ); +} + require_once('admin-header.php'); +if ( current_user_can('order_pages') ) { + wp_admin_css('css/nestedsortablewidget'); +} + $post_stati = array( // array( adj, noun ) 'publish' => array(__('Published'), __('Published pages')), 'draft' => array(__('Draft'), __('Draft pages')), Index: wp-admin/images/progress_indicator.gif =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: wp-admin\images\progress_indicator.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Index: wp-admin/includes/schema.php =================================================================== --- wp-admin/includes/schema.php (revision 6137) +++ wp-admin/includes/schema.php (working copy) @@ -251,6 +251,7 @@ populate_roles_160(); populate_roles_210(); populate_roles_230(); + populate_roles_240(); } function populate_roles_160() { @@ -392,4 +393,14 @@ } } +function populate_roles_240(){ + $roles = array('administrator', 'editor'); + foreach ($roles as $role) { + $role = get_role($role); + if ( empty($role) ) + continue; + $role->add_cap( 'order_pages' ); + } +} + ?> Index: wp-admin/includes/upgrade.php =================================================================== --- wp-admin/includes/upgrade.php (revision 6137) +++ wp-admin/includes/upgrade.php (working copy) @@ -194,10 +194,13 @@ if ( $wp_current_db_version < 5539 ) upgrade_230(); - + if ( $wp_current_db_version < 6124 ) upgrade_230_old_tables(); + if ( $wp_current_db_version < 6125 ) + upgrade_240(); + maybe_disable_automattic_widgets(); $wp_rewrite->flush_rules(); @@ -703,6 +706,10 @@ $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat'); } +function upgrade_240() { + populate_roles_240(); +} + function upgrade_old_slugs() { // upgrade people who were using the Redirect Old Slugs plugin global $wpdb; Index: wp-admin/js/edit-page-order.js =================================================================== --- wp-admin/js/edit-page-order.js (revision 0) +++ wp-admin/js/edit-page-order.js (revision 0) @@ -0,0 +1,64 @@ +jQuery( function($){ + + editPageOrderL10n.editButton += " \xBB"; + editPageOrderL10n.cancelButton = "\xAB " + editPageOrderL10n.cancelButton; + var addEditButtonEvent = function(button) { + wasSaved = false; + button.one ( + "click", + function() { + $('table.widefat').hide(); + $('#ajax-response').NestedSortableWidget({ + loadUrl: "admin-ajax.php", + loadUrlParams: {action:"page-order-load", cookie:document.cookie}, + saveUrlParams: {action:"page-order-save", cookie:document.cookie}, + loadRequestType : 'POST', + text: editPageOrderL10n, + colsWidth: [230, 170], + paginate: true, + greedy : true, + itemsPerPage: 20, + transitionAnim: 'fade-series', + nestedSortCfg: { + opacity: 0.6, + fx:400, + revert: true, + rightToLeft: (document.dir === "rtl") ? true : false + }, + onInitialLoad: function() { + addRemoveButtom(button, this); + }, + onLoadError: function() { + addRemoveButtom(button, this); + }, + onSave: function() { + wasSaved = true; + } + }); + } + ); + }; + + var addRemoveButtom = function(button, widget) { + button.val(editPageOrderL10n.cancelButton).one ( + "click", + function() { + if (wasSaved) { + window.location.reload(); + } else { + $('table.widefat').show(); + $(widget).NestedSortableWidgetDestroy(); + button.val(editPageOrderL10n.editButton); + addEditButtonEvent(button); + } + } + ); + }; + + + var editButton = $(''); + $('#searchform').after(editButton); + editButton.val(editPageOrderL10n.editButton); + addEditButtonEvent(editButton); +} +); \ No newline at end of file Index: wp-includes/class-JSON.php =================================================================== --- wp-includes/class-JSON.php (revision 0) +++ wp-includes/class-JSON.php (revision 0) @@ -0,0 +1,806 @@ + + * @author Matt Knapp + * @author Brett Stimmerman + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_SLICE', 1); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_STR', 2); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_ARR', 3); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_OBJ', 4); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_CMT', 5); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_LOOSE_TYPE', 16); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_SUPPRESS_ERRORS', 32); + +/** + * Converts to and from JSON format. + * + * Brief example of use: + * + * + * // create a new instance of Services_JSON + * $json = new Services_JSON(); + * + * // convert a complexe value to JSON notation, and send it to the browser + * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); + * $output = $json->encode($value); + * + * print($output); + * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] + * + * // accept incoming POST data, assumed to be in JSON notation + * $input = file_get_contents('php://input', 1000000); + * $value = $json->decode($input); + * + */ +class Services_JSON +{ + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); + + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } + + return false; + } +} + +if (class_exists('PEAR_Error')) { + + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } + +} else { + + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + + } + } + +} + +?> Index: wp-includes/class-page-order.php =================================================================== --- wp-includes/class-page-order.php (revision 0) +++ wp-includes/class-page-order.php (revision 0) @@ -0,0 +1,182 @@ + + * @link http://bitsinashortbit.wordpress.com + +*/ +class WP_Page_Order { + var $count = 0; + var $items; + var $completeHash; + + function WP_Page_Order() { + + } + + + /** + * Returns a nested symbolic array with pages organized hierarchically. + * + * Always returns full hierarchies of pages. + * + * @param integer $firstIndex The zero based index of the page after which the first returned page (in a root hierarchy) will be returned. + * @param integer $count Minimum number of pages that will be returned. + */ + function get_paginated_pages($firstIndex = null, $count = null) { + //Pagination here is still dumb; it fetches all the + //pages than filters the ones that are going to + //be sent. But hey, at least it works... + $this->_fetch_page_list(); + if($firstIndex === null || $count === null) { + return $this->completeHash; + } else { + $firstIndex = (int)$firstIndex; + $count = (int)$count; + $return = array( + "requestFirstIndex"=> $firstIndex, + "columns"=> $this->completeHash['columns'], + "totalCount" => $this->completeHash['totalCount'] + ); + + + $first = null; + $last = null; + $curPos = 0; + foreach ($this->completeHash['items'] as $key => $value) { + $nextPos = $this->_count_items($value) + 1 + $curPos; + if($first === null && $firstIndex === $curPos) { + $newFirstIndex = $curPos; + $first = $key; + } + if ($first === null && $nextPos > $firstIndex) { + $first = $key + 1; + $newFirstIndex = $nextPos; + } + if( $last === null && + $newFirstIndex!==null && + ($nextPos >= $newFirstIndex + $count || $nextPos >= $return['totalCount'] ) ) + { + $last = $key; //the root element where the item with the last index is + $newCount = $nextPos - $newFirstIndex; + break; //we are done if we got here + } + $curPos = $nextPos; + } + + $return['firstIndex'] = $newFirstIndex; + $return['count'] = $newCount; + $return['items'] = array_slice($this->completeHash['items'], $first, $last - $first + 1); + + return $return; + } + } + + + /** + * Saves the page order. + * + * This function calls itself recursivelly to save the order of its child pages. + * + * @param array $pages_array Array with the page ids organized in order and hiearachically. + * @param integer $parent_id The db index of the page which is the parent of all the passed in pages. + */ + function save_page_order($pages_array, $parent_id = 0) { + global $wpdb; + $first_page = $wpdb->escape($pages_array[0]['id']); + $current_menu_order = get_post_field('menu_order', $first_page, 'db'); + if(is_wp_error($current_menu_order)) return false; + if($parent_id === 0) { + //shifts the menu order for all the root pages after the ones we + //will alter + $num_root_pages = count($pages_array); + $query_ret = $wpdb->query("UPDATE $wpdb->posts SET menu_order = menu_order + $num_root_pages WHERE post_type = 'page' AND post_parent = 0 AND menu_order > $current_menu_order"); + if($query_ret === false) return false; + } + foreach ($pages_array as $index => $page) { + $page_id = $wpdb->escape($page['id']); + + $query_ret = $wpdb->query("UPDATE $wpdb->posts SET post_parent = '$parent_id', menu_order = '$current_menu_order' WHERE id ='$page_id'"); + + if($query_ret === false) return false; + + $current_menu_order++; + if (is_array($page['children'])) { + //does it for the children as well + if (!$this->save_page_order($page['children'], $page_id)) return false; + } + } + + return true; + } + + function _fetch_page_list() { + wp("post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc"); + if($GLOBALS['posts']) { + $this->items = $this->_build_items_array(0, 0, $GLOBALS['posts']); + $this->completeHash = array( + "requestFirstIndex" => 0, + "firstIndex" => 0, + "count" => $this->count, + "totalCount" => $this->count, + "columns" => array("Title (ID)", "Owner", "Updated"), + "items" => $this->items + ); + } + } + + function _count_items($item) { + $cur_count = 0; + + if($item['children']) { + foreach ($item['children'] as $i) { + $cur_count++; + $cur_count += $this->_count_items($i); + } + } + + return $cur_count; + } + + function _build_items_array( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { + //this is not the neatest of the algorithms, a lot of waste here + //based on get_pages() + global $wpdb, $post; + + if (!$pages ) + $pages = get_pages( 'sort_column=menu_order' ); + + if (! $pages ) + return false; + + $ret_array = array(); + foreach ( $pages as $post ) { + setup_postdata( $post); + if ( $hierarchy && ($post->post_parent != $parent) ) + continue; + $cur_index = count($ret_array); + $post->post_title = wp_specialchars( $post->post_title ); + $id = (int) $post->ID; + $ret_array[$cur_index] = array( + "id" => $id, + "info" => array(get_the_title() . " (" . $id .")", get_the_author(), ( '0000-00-00 00:00:00' ==$post->post_modified ) ? __('Unpublished'): mysql2date( __('Y-m-d g:i a'), $post->post_modified )) + ); + + $this->count ++; + + if ( $hierarchy ) { + $children = $this->_build_items_array( $id, $level + 1, $pages ); + if ( $children ) { + $ret_array[$cur_index]['children'] = $children; + } + } + } + + return $ret_array; + } + +} +?> \ No newline at end of file Index: wp-includes/js/jquery/inestedsortable.js =================================================================== --- wp-includes/js/jquery/inestedsortable.js (revision 0) +++ wp-includes/js/jquery/inestedsortable.js (revision 0) @@ -0,0 +1,17 @@ +/** + * + * Nested Sortable Plugin for jQuery/Interface. + * + * Version 1.0 + * + * Copyright (c) 2007 Bernardo de Padua dos Santos + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://code.google.com/p/nestedsortables/ + * + * Compressed using Dean Edwards' Packer (http://dean.edwards.name/packer/) + * + */ + +eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('2.6={26:9(e,o){5(e.L){2.6.1Q(e);8 2.6.1J(e)}r{8 2.6.1D(e,o)}},1D:2.n.29,1J:9(e){5(!2.u.z){8}5(!(e.1q.1s.1k()>0)){8}5(!e.3.Z){2.n.2n(e);e.3.Z=C}7 a=2.6.1A(e);7 b=2.6.1v(e,a);7 c=(!a)?2.6.23(e):p;7 d=p;5(a){5(e.3.1d===a&&e.3.1V===b){d=C}}r 5(e.3.1d===a&&e.3.1U===c){d=C}e.3.1d=a;e.3.1V=b;e.3.1U=c;5(d){8}5(a!==N){5(b){2.6.1T(e,a)}r{2.6.1P(e,a)}}r 5(c){2.6.1O(e)}},1Q:9(e){5(!e.3.17){8 p}7 a=e.3.16;7 b=e.3.15;7 c=2.u.z.B.2o;7 d=2.1i.1K();5((c.y-d.M)-d.t>-a){1G.1F(0,b)}5(c.y-d.t0){h+=\'&\'}h+=s+j+\'[\'+i+\'][1m]=\'+a;g[i]={1m:a};7 b=2(m).J(e.3.G+"."+e.3.S.V(" ").U(".")).v(0);7 c=j;j+=\'[\'+i+\'][J]\';7 d=k(b);5(d.I>0){g[i].J=d}j=c});8 g};5(s){5(2.n.19[s]){e=2(\'#\'+s).v(0);o[s]=k(e)}r{1N(a 1M s){5(2.n.19[s[a]]){e=2(\'#\'+s[a]).v(0);o[s[a]]=k(e)}}}}r{1N(i 1M 2.n.19){e=2(\'#\'+i).v(0);o[i]=k(e)}}8{2p:h,o:o}},1A:9(e){7 d=0;7 f=2.1L(e.1q.1s,9(i){7 a=(i.A.y<2.u.z.B.1j)&&(i.A.y>d);5(!a){8 p}7 b;5(e.3.O){b=(i.A.x+i.A.13+e.3.Q>2.u.z.B.12+2.u.z.B.1h.13)}r{b=(i.A.x-e.3.Q<2.u.z.B.12)}5(!b){8 p}7 c=2.6.1g(e,i);5(c){8 p}d=i.A.y;8 C});5(f.I>0){8 f[(f.I-1)]}r{8 N}},23:9(e){7 c;7 d=2.1L(e.1q.1s,9(i){7 a=(c===1I||i.A.y0){d=d[(d.I-1)];8 d.A.y<2.u.z.B.1j+2.u.z.B.1h.2m&&d.A.y>2.u.z.B.1j}r{8 p}},1g:9(e,a){7 b=2.u.z;5(!b){8 p}5(a==b){8 C}5(2(a).2l("."+e.1H.1e.V(" ").U(".")).2k(9(){8 m==b}).I!==0){8 C}r{8 p}},1v:9(e,a){5(!a){8 p}5(e.3.O){8 a.A.x+a.A.13-(e.3.H-e.3.Q)>2.u.z.B.12+2.u.z.B.1h.13}r{8 a.A.x+(e.3.H-e.3.Q)<2.u.z.B.12}},1T:9(e,a){7 b=2(a).J(e.3.G+"."+e.3.S.V(" ").U("."));7 c=2.n.P;1E=c.v(0).2j;1E.2i=\'2h\';5(!b.1k()){7 d="<"+e.3.G+" 2g=\'"+e.3.S+"\'>";b=2(a).2f(d).J(e.3.G).1z(e.3.1l)}2.6.Y(e,b);2.6.1b(e);b.1x(c.v(0));2.6.X(e)},1P:9(e,a){2.6.Y(e,2(a).1c());2.6.1b(e);2(a).2e(2.n.P.v(0));2.6.X(e)},1O:9(e){2.6.Y(e,e);2.6.1b(e);2(e).1x(2.n.P.v(0));2.6.X(e)},1b:9(e){7 a=2.n.P.1c(e.3.G+"."+e.3.S.V(" ").U("."));7 b=a.J("."+e.1H.1e.V(" ").U(".")+":2d").1k();5(b===0&&a.v(0)!==e){a.2c()}},X:9(e){7 a=2.n.P.1c();5(a.v(0)!==e){a.2b()}e.3.Z=p},Y:9(e,a){7 b=2(a);5((e.3.K)&&(!2.6.D||b.v(0)!=2.6.D.v(0))){5(2.6.D){2.6.D.1y(e.3.K)}5(b.v(0)!=e){2.6.D=b;b.2E(e.3.K);2.6.T=e.3.K}r{2.6.D=N;2.6.T=""}}},2a:9(){8 m.1p(9(){5(m.L){m.3=N;m.L=N;2(m).2D()}})},27:9(a){5(a.1e&&2.1i&&2.u&&2.1r&&2.n){m.1p(9(){m.L=C;m.3={O:a.O?C:p,H:24(a.H,10)||2C,K:a.K?a.K:"",1u:a.1u?a.1u:"",1f:a.1f?a.1f:p,17:a.17!==1I?a.17==C:C,16:a.16?a.16:20,15:a.15?a.15:20,11:a.11?a.11:/[^\\-]*$/};m.3.Q=24(m.3.H*0.4,10);m.3.G=m.2B;m.3.S=m.2A;m.3.1l=(m.3.O)?{"1a-1Z":0,"1a-1Y":m.3.H+\'1X\'}:{"1a-1Z":m.3.H+\'1X\',"1a-1Y":0};2(m.3.G,m).1z(m.3.1l)});2.n.29=2.6.26;2.n.14=2.6.14;2.n.W=2.6.W}8 m.2z(a)}};2.2y.2x({2w:2.6.27,2v:2.6.2a});2.1i.1K=9(e){7 t,l,w,h,R,M;5(e&&e.2u.2t()!=\'E\'){t=e.18;l=e.1o;w=e.1n;h=e.1t;R=0;M=0}r{5(q.F&&q.F.18){t=q.F.18;l=q.F.1o;w=q.F.1n;h=q.F.1t}r 5(q.E){t=q.E.18;l=q.E.1o;w=q.E.1n;h=q.E.1t}R=1S.2r||q.F.22||q.E.22||0;M=1S.2q||q.F.21||q.E.21||0}8{t:t,l:l,w:w,h:h,R:R,M:M}};',62,165,'||jQuery|nestedSortCfg||if|iNestedSortable|var|return|function|||||||||||||this|iSort||false|document|else|||iDrag|get||||dragged|pos|dragCfg|true|currentNesting|body|documentElement|nestingTag|nestingPxSpace|length|children|currentNestingClass|isNestedSortable|ih|null|rightToLeft|helper|snapTolerance|iw|nestingTagClass|latestNestingClass|join|split|serialize|afterHelperInsert|updateCurrentNestingClass|remeasured||serializeRegExp|nx|wb|check|scrollSpeed|scrollSensitivity|autoScroll|scrollTop|collected|padding|beforeHelperRemove|parent|lastPrecedingItem|accept|nestingLimit|isBeingDragged|oC|iUtil|ny|size|styleToAttach|id|scrollWidth|scrollLeft|each|dropCfg|iDrop|el|scrollHeight|currentParentClass|shouldNestItem|overzone|prepend|removeClass|css|findPrecedingItem|oldCheck|newCheck|oldCheckHover|styleHelper|scrollBy|window|sortCfg|undefined|newCheckHover|getScroll|grep|in|for|insertOnTop|appendItem|scroll|match|self|nestItem|lastTouchingFirst|lastShouldNest|thisChildren|px|right|left||clientHeight|clientWidth|isTouchingFirstItem|parseInt|newSerialize|checkHover|build|oldSerialize|checkhover|destroy|show|hide|visible|after|append|class|auto|width|style|filter|parents|hb|measure|currentPointer|hash|innerHeight|innerWidth|attr|toLowerCase|nodeName|NestedSortableDestroy|NestedSortable|extend|fn|Sortable|className|tagName|30|SortableDestroy|addClass'.split('|'),0,{})) \ No newline at end of file Index: wp-includes/js/jquery/jquery.nestedsortablewidget.js =================================================================== --- wp-includes/js/jquery/jquery.nestedsortablewidget.js (revision 0) +++ wp-includes/js/jquery/jquery.nestedsortablewidget.js (revision 0) @@ -0,0 +1,17 @@ +/** + * + * Nested Sortable Widget with pagination support for jQuery/Interface. + * + * Version 1.0 + * + * Copyright (c) 2007 Bernardo de Padua dos Santos + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://code.google.com/p/nestedsortables/ + * + * Compressed using Dean Edwards' Packer (http://dean.edwards.name/packer/) + * + */ + +eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('6.U={1M:R(e,a){e.5.3m=a;9 b=6(\'.\'+e.5.V.1O,e);7(a){b.1L()}S{b.1t()}},2L:R(e,a){9 b=6(\'.\'+e.5.V.1U,e).2i(a).1L(\'3Y\',R(){3Q(R(){b.1t(\'3Y\')},\'4R\')})},2A:R(e,a){9 b=e.5.2x;9 c=6.U.2u;9 d;34(a){1h\'1G\':7(e.5.1i){d=e.5.1Q-1}S{d=b-1}1o;1h\'1A\':7(e.5.1i){d=e.5.1u+1}S{d=b+1}1o}X c(e,d)},2u:R(e,d){9 f=R(){7(e.5.1W&&!e.5.3i){9 a;7(e.5.1i){9 b;7(d>e.5.1u){b=e.5.1u}S{b=e.5.1Q}a=6.U.2b(e,d,b)}S{a=6.U.2b(e,d,e.5.2x)}6.19(e.5.11,R(i){7(8.2B<=a.12&&(8.12+8.Z)>=(a.12+a.Z)){a=15;X Y}});X a}S 7(e.5.11.W===0){X{}}S{X 15}};9 g=R(a){9 b=e.5.37;7(b){e.5.37=15;b.3G();7(e.5.1S){e.5.1S.18(e)}}6.U.3B(e,a);6.U.30(e,d);7(e.5.1V){e.5.1V.18(e)}6.U.1M(e,Y)};9 h=R(a,b,c){6.U.2L(e,e.5.1g.4E);6.U.1M(e,Y);7(e.5.22){e.5.22.18(e)}};7(e.5.3m||e.5.2S){X Y}6.U.1M(e,1d);9 j;7(!e.5.13.1Z[d]&&(j=f())!==15){7(e.5.2k){6.24(j,e.5.2k)}6.4q({3k:e.5.2t,2K:j,5l:\'5j\',4d:g,49:h,45:e.5.2p})}S{6.U.30(e,d);6.U.1M(e,Y)}},2b:R(e,a,b){9 c=e.5.2r;9 d,Z;7(b){3d=e.5.13.1K[b].12;3U=e.5.13.1K[b].Z;7(b+1==a){d=3d+3U}S 7(b==a+1){d=(a-1)*c;7(d<0){d=0}Z=3d-d}}S{d=(a-1)*c}7(!Z){7(e.5.11[0]){9 f=e.5.11[0].2q;7(d+c>f){Z=f-d}S{Z=c}}S{Z=c}}X{12:d,Z:Z}},3B:R(e,a){9 b=15;9 c=15;9 d=0;6.19(e.5.11,R(i){7(a.12==8.12+8.Z){b=i}S 7(a.12+a.Z==8.12){c=i}S 7(a.12>8.12){d=i+1}});7(b!==15){e.5.11[b].17=e.5.11[b].17.2M(a.17);e.5.11[b].Z+=a.Z;7(c!==15){e.5.11[b].17=e.5.11[b].17.2M(e.5.11[c].17);e.5.11[b].Z+=e.5.11[c].Z;e.5.11.3P(c,1)}}S 7(c!==15){e.5.11[c].17=a.17.2M(e.5.11[c].17);e.5.11[c].12=a.12;e.5.11[c].2B=a.2B;e.5.11[c].Z+=a.Z}S{e.5.11.3P(d,0,a)}},2d:R(b){9 c=0;9 a;7(b.1f==1T){a=b}S{a=b.1J}7(a){6.19(a,R(i){c++;c+=6.U.2d(8)})}X c},3O:R(e,b,c){7(e.5.1W){9 d=e.5.11;9 f=e.5.2r;9 g;7(e.5.1i){9 h;7(b>e.5.1u){h=e.5.1u}S{h=e.5.1Q}g=6.U.2b(e,b,h)}S{g=6.U.2b(e,b,c)}9 j=g.12;9 k=g.Z;9 l;9 m=e.5.13.1K[b+1];7(m){l=m.12}S{l=d[0].2q}9 n=15;6.19(d,R(i){7(8.2B<=j&&(8.12+8.Z)>=(j+k)){n=8}});9 o=n.12;9 p=15;9 q=15;9 r=15;9 s=15;6.19(n.17,R(i){9 a=6.U.2d(8)+1+o;7(p===15&&j<=o){p=i;r=o}7(p===15&&a>j){p=i+1;r=a}7(q===15&&r!==15&&(a>=r+k||a>=l)){q=i;s=a-r;X Y}o=a});X{2a:n.2a,17:n.17.4Q(p,q+1),12:r,Z:s,2q:n.2q}}S{X e.5.11[0]}},30:R(e,t){9 u=R(k,l){9 m=R(a){9 b=[];9 c="";9 d=(6.38.2Z)?"1e=\'4P:1;4O: 4N(1R=33);\'":"";7(a.1y){c="1y=\'"+e.5.V.1l+\'-\'+a.1y+"\' "}b[b.W]="<2E "+c+"16=\'"+e.5.V.1C+" "+e.5.V.1l+"\' "+d+"\'>";9 f="";7(!e.5.1b){f="3w:3v;"}9 g=(6.38.2Z)?"2g:33%;":"";b[b.W]="";b[b.W]=o(a.5I,e.5.1b);b[b.W]="";7(a.1J){b[b.W]=n(a.1J)}b[b.W]="";X b.2n("")};9 n=R(a,b){9 c=[];c[c.W]="<2R "+((b)?"1y=\'"+e.5.1q+"-"+t+"\'":"")+"\' 16=\'"+e.5.V.4z+" "+e.5.V.1C+"\'>";3r(9 i=0;i";X c.2n("")};9 o=R(a,b){9 c=[];9 d=e.5.1X;9 f=e.5.1m.5E;3r(9 i=a.W-1;i>=0;i--){9 g="";7(i!==0){9 h;7(e.5.1a.1f===1T){h=(e.5.1a[i-1])?e.5.1a[i-1]:e.5.1a[e.5.1a.W-1]}S{h=e.5.1a}g+="5D: "+1c(h)+d+";";7(f){g+="4u:5A;";g+="23:0 0 0 "+1c(e.5.1n)+d+";"}S{g+="4u:5y;";g+="23:0 "+1c(e.5.1n)+d+" 0 0;"}}S{7(f){g+="23:0 "+1c(e.5.1n)+d+" 0 "+r+d+";"}S{g+="23:0 "+r+d+" 0 "+1c(e.5.1n)+d+";"}}9 j;7(e.5.1F.1f===1T){j=e.5.1F.2n(d+" ")+d}S{j=1c(e.5.1F)+d}g+="1F:"+j+";";c[c.W]="";7(b&&i===0){c[c.W]="<4r 16=\'"+e.5.V.1b+"\' 1e=\'3w:3v;\'>"+e.5.1g.1b+" "}c[c.W]=a[i]+""}X c.2n("")};9 p=R(b){9 c=0;9 d=e.5.1F;9 f;7(d.W===4){f=1c(d[1])+1c(d[3])}S{f=2*1c(d)}6.19(b,R(i){7(i===0){X 1d}9 a;7(e.5.1a.1f===1T){a=(e.5.1a[i-1])?e.5.1a[i-1]:e.5.1a[e.5.1a.W-1]}S{a=e.5.1a}c+=1c(a)+1c(e.5.1n)+f});X c+1c(e.5.1n)};9 q=[];9 r=p(k.2a);7(l===\'1z\'){7(k.2a){q[q.W]="";q[q.W]="<2R 16=\'"+e.5.V.1z+"\'>";q[q.W]="<2E 16=\'"+e.5.V.4k+"\'>";9 s=(6.38.2Z)?"2g:33%;":"";q[q.W]="";q[q.W]=o(k.2a);q[q.W]="";q[q.W]=""}}S{q[q.W]=n(k.17,1d)}X 6(q.2n(""))};9 v=R(){X 6("")};9 w=R(a){7(e.5.1W){9 b=\'\';7(a=="1G"){X 6(b).2i(e.5.1g.4f)}S 7(a=="1A"){X 6(b).2i(e.5.1g.4c)}S{X 15}}S{X 15}};9 x=R(){7(e.5.1W){9 a=e.5.V;9 b=e.5.1g;9 c="",2f="";7(L){c=6(""+b.41+"").4m("2H",R(){6.U.2A(e,"1G")})}7(M){2f=6(""+b.3X+"").4m("2H",R(){6.U.2A(e,"1A")})}X 6("").1s(c).1s(2f).1s("&1H;")}S{X 15}};9 y=R(){9 a=e.5.V;9 b=e.5.1g;9 c=6("<4Z 3k=\'4Y\' 16=\'"+a.2N+"\' 4U=\'"+b.2T+"\'/>");X 6("").1s("&1H;&1H;").1s(c).1s("&1H;")};9 z=R(a,b){e.5.2S=1d;7(!e.5.1i){7(2C e.5.1j==\'R\'){7(b){e.5.1j.18(a,[R(){A(b)}])}S{e.5.1j.18(a)}}S{a.1t();7(b){A(b)}}}};9 A=R(a){7(2C e.5.1r==\'R\'){e.5.1r.18(a,[R(){6.2U();e.5.2S=Y}])}S{a.1L();6.2U();e.5.2S=Y}};9 B=e.5.2x;9 C=e.5.1z;9 D=Y;7(!C){D=1d;C=e.5.1z=u(e.5.11[0],\'1z\')}9 E=e.5.2F;7(!E){E=e.5.2F=v()}9 F=e.5.13.1Z[t];9 G=e.5.13.1K[t];7(!F){G=e.5.13.1K[t]=6.U.3O(e,t,B);F=e.5.13.1Z[t]=u(G);7(E.2i()===""){E.1s(F)}}7(e.5.1i){G=e.5.11[0]}7(G.12>0){e.5.13.2z[t]=1d}S{e.5.13.2z[t]=Y}7(e.5.1i){G=e.5.11[e.5.11.W-1]}7((G.12+G.Z)e.5.1u){H=e.5.1u}S{H=e.5.1Q}}S{H=B}9 I=e.5.13.1Z[H];7(I){7(He.5.1u){e.5.1u=t}7(!e.5.1Q||t1?d:d[0];9 j;7(6.4A&&g.5.2Q){j={};j[g.5.1q]=6.4A(h);7(g.5.1N){6.24(j,g.5.1N)}}S{j="";7(g.5.1N){6.19(g.5.1N,R(a){7(j.W>0){j+="&"}j+=a+"="+8})}9 k=R(a,b){9 c="";6.19(a,R(i){7(c.W>0){c+=\'&\'}c+=b+\'[\'+i+\'][1y]=\'+8.1y;7(8.1J&&8.1J.1f==1T){c+="&"+k(8.1J,b+\'[\'+i+\'][1J]\')}});X c};7(h.1f==1T){6.19(h,R(i){7(j.W>0){j+="&"}j+=g.5.1q+"["+i+"][Z]="+8.Z+"&"+g.5.1q+"["+i+"][12]="+8.12+"&";j+=k(8.17,g.5.1q+"["+i+"][17]")})}S{7(j.W>0){j+="&"}j+=g.5.1q+"[Z]="+h.Z+"&"+g.5.1q+"[12]="+h.12+"&";j+=k(h.17,g.5.1q+"[17]")}}6.4q({45:g.5.2P,3k:g.5.2O,2K:j,4d:R(a){l(g,a)},49:R(a,b,c){m(g)},5G:R(a,b){n(g)}})}})},4y:R(){X 8.19(R(){7(8.2m){9 a=8.5.2l;6.19(8.5.13.1Z,R(i){7(8){6(8).5F()}});7(8.5.2w){8.5.2w.4x()}7(8.5.2v){8.5.2v.4x()}8.5=15;8.2m=Y;6(8).2i(\'\');7(a){a.18(8)}}})},4w:R(d){X 8.19(R(){7(8.2m||!d.2p||!6.3q||!6.3p||!6.1B||!6.3o||!6.3A){X}9 b=8;8.2m=1d;8.5={1q:d.1q?d.1q:"5C-5B-5z",2p:d.2p,2P:d.2P?d.2P:d.2p,2k:d.2k?d.2k:3n,1N:d.1N?d.1N:3n,2t:d.2t?d.2t:\'5x\',2O:d.2O?d.2O:\'5w\',2Q:d.2Q===3n?Y:d.2Q,1V:(d.1V&&d.1V.1f==1Y)?d.1V:Y,22:(d.22&&d.22.1f==1Y)?d.22:Y,1S:(d.1S&&d.1S.1f==1Y)?d.1S:Y,20:(d.20&&d.20.1f==1Y)?d.20:Y,21:(d.21&&d.21.1f==1Y)?d.21:Y,2l:(d.2l&&d.2l.1f==1Y)?d.2l:Y,1m:d.1m?d.1m:{},2j:d.2j?d.2j:Y,1a:d.1a?d.1a:5v,1n:d.1n?d.1n:2,1F:d.1F?d.1F:4,1X:d.1X?d.1X:"5u",1k:d.1k?d.1k:\'2W-1E\',1j:2C d.1j==\'R\'?d.1j:Y,1r:2C d.1r==\'R\'?d.1r:Y,1b:d.1b?d.1b:Y,1W:d.1W?1d:Y,3i:d.3i?1d:Y,1i:d.1i?d.1i:Y,2r:2V(d.2r,10)||10,2s:2V(d.2s,10)||1,2G:d.2G?d.2G:"5t",26:d.26?d.26:1d,2I:d.2I?d.2I:\'1R\'};8.5.V={2F:\'14-4p-1I\',4n:\'14-1z-1I\',1I:\'14-1I\',2J:\'14-2J\',36:\'14-5s-2J\',3W:\'14-3j-5r\',46:\'14-3j-4b\',4l:\'14-3j-2f\',4z:\'14-4p-5q\',1z:\'14-1z\',4k:\'14-1z-1l\',1C:\'14-1C\',1l:\'14-1l\',3s:\'14-5p-5o\',2h:\'14-1l-5m\',1O:\'14-1O\',2T:\'14-2o-4i\',2N:\'14-5k-2o-4i\',3c:\'14-2o-1O-1I\',3b:\'14-1O-1U-1I\',1U:\'14-1U\',1b:\'14-1b\',3e:\'14-3e\'};7(d.V){6.24(8.5.V,d.V)}8.5.1g={4c:"4h 1v 4g 4e 3V 3T 3f 3S 1v 1l 3g 1v 2f 48.",4f:"4h 1v 4g 4e 3V 3T 3f 3S 1v 1l 3g 1v 4b 48.",3X:"5i 47 &3Z;",41:"&5h; 5g 47",2T:"5f 5e &3Z; ",4E:"43 4a 5d 1v 2K 5c 1v 40.",4B:"43 4a 5b 1v 2K 3f 1v 40.",4C:"5a 5n 59.",1b:"[58]"};7(d.1g){6.24(8.5.1g,d.1g)}8.5.1m.2X=8.5.V.1l;9 c=8.5.1m.4j;8.5.1m.4j=R(a){7(c){c(a)}6.U.3z(b,a)};8.5.1m.57=8.5.V.3e;7(8.5.1b){8.5.1m.1b="."+8.5.V.1b}S{8.5.1m.1b="."+8.5.V.2h}8.5.3M=6("");8.5.11=[];8.5.13={1Z:[],1K:[],27:[],2z:[],2y:[],56:[],32:{}};8.5.37=6("").1s("&1H;&1H;").1s("&1H;").3L(8);34(8.5.1k){1h"2W-1E":8.5.1j=R(a){6.1p.4t.18(8,["1x",a])};8.5.1r=R(a){6.1p.4o.18(8,["1x",a])};8.5.1k="1w-1E";1o;1h"2W-1D":8.5.1j=R(a){6.1p.4t.18(8,["1x",a])};8.5.1r=R(a){6.1p.4o.18(8,["1x",a])};8.5.1k="1w-1D";1o;1h"55-1D":8.5.1j=R(a){8.54("4s",a)};8.5.1r=R(a){8.53("4s",a)};8.5.1k="1w-1D";1o;1h"1x-1E":8.5.1j=R(a){6.1p.1t.18(8,["1x",a])};8.5.1r=R(a){6.1p.1L.18(8,["1x",a])};8.5.1k="1w-1E";1o;1h"1x-1D":8.5.1j=R(a){6.1p.1t.18(8,["1x",a])};8.5.1r=R(a){6.1p.1L.18(8,["1x",a])};8.5.1k="1w-1D";1o;1h"1w-1D":1h"1w-1E":1o;1h"2c":52:8.5.1j=Y;8.5.1r=Y;8.5.1k="1w-1E";1o}7(8.5.2j){6(8.5.2j).2H(R(){6.U.2u(b,b.5.2s)})}S{6.U.2u(8,8.5.2s)}})}};6.1p.24({U:6.U.4w,3y:6.U.2o,51:6.U.4y});6.1B.50=6.2U=R(){6.1B.4v={};3r(i 3g 6.1B.2e){7(6.1B.2e[i]!=15){9 a=6.1B.2e[i].25(0);7(6(6.3p.3R).4X(\'.\'+a.1P.a)){a.1P.p=6.24(6.3q.4W(a),6.3q.4V(a));7(a.1P.4F){6.1B.2e[i].2Y(a.1P.4F)}6.1B.4v[i]=6.1B.2e[i];7(6.3o&&a.1P.s&&6.3p.3R.5K.4T){a.1P.4S=6(\'.\'+a.1P.a,a);6.3o.5O(a)}}}}};',62,361,'|||||nestedSortWidgetCfg|jQuery|if|this|var||||||||||||||||||||||||||||||||||||||||||||function|else|div|NestedSortableWidget|classes|length|return|false|count||loadedJsons|firstIndex|builtLists|nsw|null|class|items|apply|each|colsWidth|handle|parseFloat|true|style|constructor|text|case|incremental|transitionOut|transitionAnim|item|nestedSortCfg|whiteMargin|break|fn|name|transitionIn|append|hide|upperPage|the|custom|normal|id|header|after|iDrop|clear|series|parallel|padding|before|nbsp|wrap|children|jsons|show|setBusyState|saveUrlParams|progress|dropCfg|bottomPage|opacity|onInitialLoad|Array|warning|onLoad|paginate|measureUnit|Function|sorts|onSave|onSaveError|onLoadError|margin|extend|get|fadeOutHover|sers|onBoxOutOrDrop|prepend|columns|nextPageContents|none|countItems|zones|next|height|itemRow|html|loadButtonSel|loadUrlParams|onDestroy|isNestedSortableWidget|join|save|loadUrl|totalCount|itemsPerPage|startPage|loadRequestType|loadData|hoverAfter|hoverBefore|currentPage|pageAfter|pageBefore|loadPage|requestFirstIndex|typeof|display|li|listWrap|pageChangeTimer|click|fadeOutProperty|drop|data|userWarning|concat|disabledSaveButton|saveRequestType|saveUrl|serializeWithJSON|ul|busyAnimating|saveButton|recallDroppables|parseInt|slide|accept|addClass|msie|buildAndShowList|alternateClasses|indexFromSortId|100|switch|onBoxHover|activeDrop|tempProgress|browser|pageChanger|css|progressAndWarningWrap|saveAndProgressWrap|curFirstIndex|helper|to|in|callback|greedy|nav|type|both|busyLoading|undefined|iSort|iDrag|iUtil|for|altCell|lastTimeOut|jquery|move|cursor|removeClass|NestedSortableWidgetSave|onListChange|iNestedSortable|augmentJson|onDrop|onOut|onHover|hoverclass|remove|pointer|tolerance|Droppable|isDroppable|appendTo|divWrap|saveAndProgress|jsonToDisplay|splice|setTimeout|dragged|place|dragging|curCount|when|navLinks|nextItems|slow|raquo|server|previousItems|javascript|Could|href|url|navPrevious|Entries|page|error|not|previous|nextPageDrop|success|here|previousPageDrop|mouse|Hover|button|onChange|headerItem|navNext|bind|headerWrap|slideDown|list|ajax|span|fast|slideUp|float|highlighted|build|DroppableDestroy|destroy|listHolder|toJSON|saveError|saveMessage|find|loadError|ac|animate|preventDefault|lastPage|insertOnTop|NestedSortable|attr|isNestedSortable|alpha|FILTER|ZOOM|slice|10000|el|so|value|getSizeLite|getPosition|is|submit|input|remeasure|NestedSortableWidgetDestroy|default|fadeIn|fadeOut|fade|pageChangers|helperclass|drag|saved|Data|send|from|load|Order|Save|Previous|laquo|Next|json|disabled|dataType|row|successfully|cell|alt|holder|links|active|500|px|150|POST|GET|right|widget|left|sortable|nested|width|rightToLeft|NestedSortableDestroy|complete|returnText|info|even|dragCfg|odd|clearTimeout|stop|measure'.split('|'),0,{})) \ No newline at end of file Index: wp-includes/script-loader.php =================================================================== --- wp-includes/script-loader.php (revision 6137) +++ wp-includes/script-loader.php (working copy) @@ -76,6 +76,22 @@ $this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '1.0.3'); $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2'); + $this->add( 'nested-sortable', '/wp-includes/js/jquery/inestedsortable.js', array('interface'), '1.0'); + $this->add( 'nested-sortable-widget', '/wp-includes/js/jquery/jquery.nestedsortablewidget.js', array('nested-sortable'), '1.0'); + $this->add( 'edit-page-order', '/wp-admin/js/edit-page-order.js', array('nested-sortable-widget'), '20070827'); + $this->localize( 'edit-page-order', 'editPageOrderL10n', array( + 'saveButton' => __("Save Page Order »"), + 'editButton' => __("Edit Page Order"), + 'cancelButton' => __("Return to the Regular Page List"), + 'nextPageDrop' => __("Hover the mouse here when dragging to place the item in the next page."), + 'previousPageDrop' => __("Hover the mouse here when dragging to place the item in the previous page."), + 'nextItems' => __("Next Entries »"), + 'previousItems' => __("« Previous Entries"), + 'loadError' => __("Error loading data. Check your connection."), + 'saveError' => __("Error saving page order. Check you connection."), + 'saveMessage' => __("Page order saved successfully.") + ) ); + if ( is_admin() ) { global $pagenow; $man = false; Index: wp-includes/version.php =================================================================== --- wp-includes/version.php (revision 6137) +++ wp-includes/version.php (working copy) @@ -3,6 +3,6 @@ // This holds the version number in a separate file so we can bump it without cluttering the SVN $wp_version = '2.3-RC1'; -$wp_db_version = 6124; +$wp_db_version = 6125; ?>