diff --git a/addons/Core/Core.inc b/addons/Core/Core.inc index 25f4002..9391012 100644 --- a/addons/Core/Core.inc +++ b/addons/Core/Core.inc @@ -178,6 +178,33 @@ class ComicPressAddonCore extends ComicPressAddon { return implode("\n", $output); } + function get_storyline_move_statuses() { + $nodes_with_statuses = array(); + for ($i = 0, $il = count($this->comicpress->category_tree); $i < $il; ++$i) { + $node = $this->comicpress->category_tree[$i]; + $nodes_with_statuses[$node] = array(); + $parts_count = count(explode("/", $node)); + foreach (array( + '0' => -1, + '1' => 1 + ) as $position => $direction) { + $current_node_index = $i; + $status = false; + do { + $current_node_index += $direction; + if (isset($this->comicpress->category_tree[$current_node_index])) { + $current_node = $this->comicpress->category_tree[$current_node_index]; + $current_parts_count = count(explode("/", $current_node)); + if ($current_parts_count == $parts_count) { $status = true; break; } + if ($current_parts_count < $parts_count) { break; } + } + } while (isset($this->comicpress->category_tree[$current_node_index])); + $nodes_with_statuses[$node][$position] = $status; + } + } + return $nodes_with_statuses; + } + function handle_update() { if (isset($_POST['attachments'])) { //coming from media editor diff --git a/addons/Core/partials/options-admin.inc b/addons/Core/partials/options-admin.inc index d94ebcd..113d723 100644 --- a/addons/Core/partials/options-admin.inc +++ b/addons/Core/partials/options-admin.inc @@ -4,7 +4,7 @@ - + - + - + + + + + - +
create_dimension_selector('cp[' . $field . ']', $this->comicpress->comicpress_options[$field]) ?>
+ comicpress->category_tree); $i < $il; ++$i) { + $node = $this->comicpress->category_tree[$i]; + $parts = explode("/", $node); + $category = get_category(end($parts)); + if (!empty($category)) { + ?> +
+ name ?> + __("Up", 'comicpress'), + "1" => __("Down", 'comicpress') + ) as $direction => $label) { + $target = ($i - $direction); + if (isset($this->comicpress->category_tree[$target])) { + $target_parts = explode("/", $this->comicpress->category_tree[$target]); + if (count($target_parts) == count($parts)) { + $query = add_query_arg('cp[_nonce]', $nonce); + $query = add_query_arg('cp[category]', $category->term_id, $query); + $query = add_query_arg('cp[move_direction', $direction, $query); + ?> + | + +
+ +

(categories can be modified on the Posts -> Categories page)

+
 " />
diff --git a/addons/Core/test/OptionsPageTest.php b/addons/Core/test/OptionsPageTest.php index 9c9fcc5..ecc26ef 100644 --- a/addons/Core/test/OptionsPageTest.php +++ b/addons/Core/test/OptionsPageTest.php @@ -2,6 +2,7 @@ require_once('PHPUnit/Framework.php'); require_once(dirname(__FILE__) . '/../../../../mockpress/mockpress.php'); +require_once(dirname(__FILE__) . '/../../../classes/ComicPressAddon.inc'); require_once(dirname(__FILE__) . '/../Core.inc'); class CoreTest extends PHPUnit_Framework_TestCase { @@ -171,6 +172,38 @@ class CoreTest extends PHPUnit_Framework_TestCase { $this->assertEquals($value, $this->core->comicpress->comicpress_options[$key]); } } + + function testGetStorylineMoveStatuses() { + $this->core->comicpress = (object)array( + 'category_tree' => array( + '0/1', + '0/1/2', + '0/1/2/3', + '0/1/2/4', + '0/1/2/5', + '0/1/6', + '0/1/6/7', + '0/1/6/8', + '0/1/9', + '0/1/9/10', + '0/1/11' + ) + ); + + $this->assertEquals(array( + '0/1' => array(false, false), + '0/1/2' => array(false, true), + '0/1/2/3' => array(false, true), + '0/1/2/4' => array(true, true), + '0/1/2/5' => array(true, false), + '0/1/6' => array(true, true), + '0/1/6/7' => array(false, true), + '0/1/6/8' => array(true, false), + '0/1/9' => array(true, true), + '0/1/9/10' => array(false, false), + '0/1/11' => array(true, false) + ), $this->core->get_storyline_move_statuses()); + } } ?> diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 012a57a..1ff74c7 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -9,6 +9,7 @@ class ComicPress { 'comic_dimensions' => '760x', 'rss_dimensions' => '350x', 'archive_dimensions' => '125x', + 'mini_dimensions' => '100x', 'category_order' => false, 'blogpost_count' => 10 ); diff --git a/test/ComicPressComicPostTest.php b/test/ComicPressComicPostTest.php index 59d46c7..494a75d 100644 --- a/test/ComicPressComicPostTest.php +++ b/test/ComicPressComicPostTest.php @@ -48,7 +48,6 @@ class ComicPressComicPostTest extends PHPUnit_Framework_TestCase { } function testNormalizeAttachmentSorting() { - update_post_meta(1, 'comic_order', '2,1') } }