in a quasi-working state, don't use this build

This commit is contained in:
John Bintz 2009-07-25 13:15:13 -04:00
parent 4df37cd29b
commit 2e7028a72e
7 changed files with 191 additions and 111 deletions

View File

@ -6,20 +6,14 @@ Template Name: Comic Calendar Archive
global $comicpress; global $comicpress;
$comicpress->additional_stylesheets[] = '/style/archive-comic-calendar.css'; $comicpress->additional_stylesheets[] = '/style/archive-comic-calendar.css';
?>
<?php get_header() ?>
<?php
$dayWidth = 22; //set to .cpcal-day total width in pixels including: width, left & right border, left & right margin, left & right padding $dayWidth = 22; //set to .cpcal-day total width in pixels including: width, left & right border, left & right margin, left & right padding
$archive_year = !empty($_GET['archive_year']) ? $_GET['archive_year'] : date('Y'); $archive_year = !empty($_GET['archive_year']) ? (int)$_GET['archive_year'] : date('Y');
$temp_post = $post;
$comic_archive_posts = array(); $comic_archive_posts = array();
$comic_archive_query = new WP_Query(); $comic_archive_query = new WP_Query();
$comic_archive_query->query('&showposts=1000&cat=' . $comicpress->get_all_comic_categories_as_cat_string() . '&year='.$archive_year); $comic_archive_query->query('showposts=1000&cat=' . $comicpress->get_all_comic_categories_as_cat_string() . '&year=' . $archive_year);
while ($comic_archive_query->have_posts()) { while ($comic_archive_query->have_posts()) {
$comic_archive_query->the_post(); $comic_archive_query->the_post();
$comic_archive_posts[get_the_time('d-m')] = array( $comic_archive_posts[get_the_time('d-m')] = array(
@ -27,23 +21,26 @@ while ($comic_archive_query->have_posts()) {
'title' => get_the_title() 'title' => get_the_title()
); );
} }
$post = $temp_post;
$days_of_week = array(); $days_of_week = array();
for ($i = 0; $i < 7; ++$i) { for ($i = 0; $i < 7; ++$i) {
$days_of_week[] = substr(date("l", gmmktime(0, 0, 0, 7, 13 + $i, 2009)), 0, 1); $days_of_week[] = substr(date("l", gmmktime(0, 0, 0, 7, 13 + $i, 2009)), 0, 1);
} }
?> ob_start();
<div id="content" class="narrowcolumn"> ?>
<div class="post-page-head"></div> <div class="post-page-head"></div>
<div class="post-page"> <div class="post-page">
<?php while (have_posts()) { the_post(); ?> <?php
while (have_posts()) {
the_post(); ?>
<h2 class="pagetitle"><span class="archive-year"><?php echo $archive_year ?></span> <?php the_title() ?></h2> <h2 class="pagetitle"><span class="archive-year"><?php echo $archive_year ?></span> <?php the_title() ?></h2>
<div class="entry"><?php the_content() ?></div> <div class="entry"><?php the_content() ?></div>
<?php } ?> <?php
}
?>
<div class="archive-yearlist">| <div class="archive-yearlist">|
<?php <?php
@ -90,9 +87,10 @@ for ($i = 0; $i < 7; ++$i) {
</div> </div>
<div class="post-page-foot"></div> <div class="post-page-foot"></div>
<?php
</div> $content = ob_get_clean();
<?php get_sidebar() ?> include(get_template_directory() . '/layouts/' . $comicpress->comicpress_options['layout']);
<?php get_footer() ?> ?>

View File

@ -2,67 +2,13 @@
/* /*
Template Name: Comic Storyline with Thumbs Template Name: Comic Storyline with Thumbs
*/ */
global $comicpress;
$comicpress->additional_stylesheets[] = '/style/archive-comic-calendar.css';
?> ?>
<?php get_header() ?>
<style>
#storyline, #storyline ul {
padding: 0;
margin: 0;
list-style: none;
}
#storyline li {
padding: 0;
margin: 0;
}
#storyline li img {
height: 50px;
display: none;
}
#storyline li li img {
display: block;
float: right;
padding: 0 0 0 10px;
}
#storyline ul ul {
margin: 0 0 0 20px;
}
#storyline li li .storyline-title {
font-size: 24px;
font-weight: bold;
display: block;
color: #000;
}
#storyline li li .storyline-title:hover {
color: #900;
}
#storyline li li li a.storyline-title {
font-size: 18px;
}
#storyline li li li li a.storyline-title {
font-size: 14px;
}
.storyline-description {
font-size: 11px;
}
.storyline-foot {
clear: both;
margin: 0 0 10px 0;
height: 10px;
border-bottom: 4px solid #000;
}
#storyline li li .storyline-foot {
border-bottom: 2px solid #000;
}
#storyline li li li .storyline-foot {
border-bottom: 1px solid #000;
}
</style>
<div id="content" class="narrowcolumn">
<div class="post-page-head"></div> <div class="post-page-head"></div>
<div class="post-page"> <div class="post-page">
<?php while (have_posts()) : the_post(); ?> <?php while (have_posts()) : the_post(); ?>

View File

@ -5,7 +5,7 @@ Template Name: Comic Archive
global $comicpress; global $comicpress;
$comicpress->additional_stylesheets[] = '/style/archive-comic-calendar.css';
get_header(); get_header();
?> ?>

View File

@ -210,26 +210,28 @@ class ComicPress {
* Get the first comic in a category. * Get the first comic in a category.
*/ */
function get_first_comic() { function get_first_comic() {
return $this->get_terminal_post_in_category($this->get_all_comic_categories_as_cat_string()); return $this->get_terminal_post_in_category($category);
} }
/** /**
* Get the last comic in a category. * Get the last comic in a category.
*/ */
function get_last_comic() { function get_last_comic($category) {
return $this->get_terminal_post_in_category($this->get_all_comic_categories_as_cat_string(), false); return $this->get_terminal_post_in_category($category, false);
} }
/** /**
* Get the comics necessary to build the navigation. * Get the comics necessary to build the navigation.
* @tested * @tested
*/ */
function get_nav_comics() { function get_nav_comics($override_category_id = null) {
global $post; global $post;
$category = is_numeric($override_category_id) ? $override_category_id : $this->comicpress_options['comic_category_id'];
$comic_posts = array(); $comic_posts = array();
foreach (array('first', 'last', 'previous', 'next') as $which) { foreach (array('first', 'last', 'previous', 'next') as $which) {
$comic_posts[$which] = $this->{"get_${which}_comic"}(); $comic_posts[$which] = $this->{"get_${which}_comic"}($category);
} }
$comic_posts['show_first'] = (trim($post->ID) != trim($comic_posts['first']->ID)); $comic_posts['show_first'] = (trim($post->ID) != trim($comic_posts['first']->ID));

View File

@ -1,37 +1,39 @@
<?php <?php
global $comicpress; global $comicpress, $nav_comics;
comicpress_get_header(); comicpress_get_header();
ob_start();
if (have_posts()) { if (have_posts()) {
the_post(); the_post();
if (in_comic_category()) { include_partial('single-display-comic'); } if (in_comic_category()) { include_partial('single-display-comic'); }
} }
rewind_posts(); rewind_posts();
$nav_comics = $comicpress->get_nav_comics(); $comic = ob_get_clean();
?>
ob_start();
$nav_comics = $comicpress->get_nav_comics();
<div id="content" class="narrowcolumn">
<?php
if (have_posts()) { if (have_posts()) {
while (have_posts()) { the_post(); while (have_posts()) { the_post();
if (in_comic_category()) { if (in_comic_category()) {
if ($comicpress->comicpress_options['comic_space'] == "comic_only") { if ($comicpress->comicpress_options['comic_space'] == "comic_only") {
include(get_template_directory() . '/partials/single-comic-post.inc'); include_partial('single-comic-post');
} }
} else { } else {
include(get_template_directory() . '/partials/single-blog-post.inc'); include_partial('single-blog-post');
} }
comments_template(); comments_template();
} }
} else { } else {
include(get_template_directory() . '/partials/single-no-matches.inc'); include_partial('single-no-matches');
} }
$content = ob_get_clean();
include(get_template_directory() . '/layouts/' . $comicpress->comicpress_options['layout']);
?> ?>
</div>
<?php get_sidebar() ?>
<?php get_footer() ?>

View File

@ -0,0 +1,63 @@
#storyline, #storyline ul {
padding: 0;
margin: 0;
list-style: none;
}
#storyline li {
padding: 0;
margin: 0;
}
#storyline li img {
height: 50px;
display: none;
}
#storyline li li img {
display: block;
float: right;
padding: 0 0 0 10px;
}
#storyline ul ul {
margin: 0 0 0 20px;
}
#storyline li li .storyline-title {
font-size: 24px;
font-weight: bold;
display: block;
color: #000;
}
#storyline li li .storyline-title:hover {
color: #900;
}
#storyline li li li a.storyline-title {
font-size: 18px;
}
#storyline li li li li a.storyline-title {
font-size: 14px;
}
.storyline-description {
font-size: 11px;
}
.storyline-foot {
clear: both;
margin: 0 0 10px 0;
height: 10px;
border-bottom: 4px solid #000;
}
#storyline li li .storyline-foot {
border-bottom: 2px solid #000;
}
#storyline li li li .storyline-foot {
border-bottom: 1px solid #000;
}

View File

@ -172,6 +172,75 @@ class ComicPressTest extends PHPUnit_Framework_TestCase {
} }
} }
function providerTestGetStorylineNavComics() {
return array(
array(
array(
'1' => array(
'first' => 8,
'previous' => 9,
'next' => 11,
'last' => 12
),
'2' => array(
'first' => 10,
'previous' => false,
'next' => 15,
'last' => 15
),
'3' => array(
'first' => 20,
'previous' => 20,
'next' => false,
'last' => 21
)
)
),
array(
'1' => array(
'first' => true,
'previous' => true,
'next' => true,
'last' => true
),
'2' => array(
'first' => true,
'previous' => false,
'next' => false,
'last' => true
),
'3' => array(
'first' => true,
'previous' => false,
'next' => false,
'last' => true
)
)
);
}
/**
* @dataProvider providerTestGetStorylineNavComics
*/
function testGetStorylineNavComics($category_info, $expected_category_results) {
$cp = $this->getMock('ComicPress', array('get_first_comic', 'get_last_comic', 'get_previous_comic', 'get_next_comic'));
foreach ($category_info as $category => $nav_comics) {
foreach ($nav_comics as $key => $result) {
$return = (is_numeric($result)) ? (object)array('ID' => $result) : false;
$cp->expects($this->once())->method("get_${key}_comic")->with($category)->will($this->returnValue($return));
}
}
$post = (is_numeric($given_post)) ? (object)array('ID' => $given_post) : false;
$comic_posts = $cp->get_nav_comics();
foreach ($expected_shows as $show => $expected) {
$this->assertEquals($expected, $comic_posts["show_${show}"], $show);
}
}
function providerTestGetLayoutChoices() { function providerTestGetLayoutChoices() {
return array( return array(