checked in mising files in the blog demo.

This commit is contained in:
agentzh (章亦春)
2010-01-25 03:05:37 +08:00
parent 3079df6d8c
commit c5a7c04b77
35 changed files with 2771 additions and 0 deletions

View File

@ -0,0 +1,17 @@
[% DEFAULT
blog_name = 'Foo\'s blog',
blog_desc = 'This is my blog'
-%]
<div id="banner">
<div id="wait-message">
<img src="loading.gif" alt=""/>
&nbsp; <b>Loading...</b>&nbsp;
</div>
<div id="banner-inner" class="pkg">
<h1 id="banner-header">
<a href="#posts/1" onclick="init()" accesskey="1">[% blog_name | html %]</a>
</h1>
<h2 id="banner-description">[% blog_desc | html %]</h2>
</div>
</div>

View File

@ -0,0 +1,27 @@
<ul class="module-list">
[% FOREACH archive IN archives -%]
<li class="module-list-item">
[%- index = archive.month %]
<a href="#archive/[% archive.year %]/[% archive.month %]">[% months.$index %] [% archive.year %] ([% archive.count %])</a>
</li>
[% END -%]
</ul>
<p class="module-more">
[% IF offset > 0 %]
<a href="javascript:getArchiveList([% offset - count %])">&lt;&lt;</a>
[% END %]
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
[% IF archives.size == count %]
<a id="more-archives" href="javascript:getArchiveList([% offset + count %]);">
Next...
</a>
[% END %]
</p>

View File

@ -0,0 +1,16 @@
[% IF next %]
[%- index = next.month %]
<a href="#archive/[% next.year %]/[% next.month %]">
« [% months.$index %] [% next.year %]
</a>
[% END %]
|
<a href="#posts/1"> Main </a>
|
[% IF prev %]
[%- index = prev.month %]
<a href="#archive/[% prev.year %]/[% prev.month %]">
[% months.$index %] [% prev.year %] »
</a>
[% END %]

View File

@ -0,0 +1,71 @@
[%- index = month + 1 %]
<h2 class="module-header">[% months.$index %] [% year %]</h2>
<div class="module-content">
<table id="calendar-nav">
<tbody>
<tr>
<th>
<a class="nav-arrow"
href="javascript:void(0)"
onclick="getCalendar([% year - 1 %], [% month %])">
&lt;&lt;
</a>
</th>
<th>
<a class="nav-arrow"
href="javascript:void(0)"
onclick="getCalendar([% month - 1 < 0 ? year - 1 : year %], [% month - 1 < 0 ? 11 : month - 1 %])">
&lt;
</a>
</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>
<a class="nav-arrow"
href="javascript:void(0)"
onclick="getCalendar([% month + 1 > 11 ? year + 1: year %], [% month + 1 > 11 ? 0 : month + 1 %])">
&gt;
</a>
</th>
<th>
<a class="nav-arrow"
href="javascript:void(0)"
onclick="getCalendar([% year + 1 %], [% month %])">
&gt;&gt;
</a>
</th>
</tr>
</tbody>
</table>
<table summary="Monthly calendar with links to each day's posts">
<tbody>
<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
[%- day = 1; %]
[%- WHILE day <= end_of_month %]
<tr>
[%- day_of_week = 0 %]
[%- WHILE day_of_week <= 6 %]
[%- today_mark = day == today ? 'class="today-cell"' : '' %]
[%- IF (day > end_of_month) || (day == 1 && day_of_week < first_day_of_week) -%]
<td>&nbsp;</td>
[%- ELSE -%]
<td id="day-[% year %]-[% month %]-[% day %]" [% today_mark %]>[% day %]</td>
[%- day = day + 1 %]
[%- END %]
[%- day_of_week = day_of_week + 1 %]
[%- END %]
[%- END %]
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,29 @@
[%- FOREACH comment IN comments -%]
<a name="post-[% comment.post %]:comment-[% comment.id %]" id="post-[% comment.post %]:comment-[% comment.id %]"></a>
<div class="comment" id="comment-95523406">
<div class="comment-content">
[%- IF comment.body %]
[%- comment.body.replace('&', '&amp;')
.replace('<', '&lt;')
.replace('>', '&gt;')
.replace('\n', '<br/>')
.replace(' ', '&nbsp; ')
.replace('(http://(?:\%[A-Fa-f0-9]{2}|[-A-Za-z./0-9~_])+)', '<a href="$1">$1</a>') %]
[%- END %]
</div>
<p class="comment-footer">
Posted by:
[% IF comment.url %]
[%- url = comment.url %]
[% IF NOT url.match('^\\w+://');
url = 'http://' _ url;
END -%]
<a href="[% url | html %]">[% comment.sender | html %]</a>
[% ELSE %]
[% comment.sender | html %] |
[% END %]
[% comment.created | html %]
</p>
</div>
[%- END %]

View File

@ -0,0 +1,24 @@
[%
SET prev_post = undef;
SET next_post = undef;
FOREACH post IN posts;
IF post.id < current;
prev_post = post;
ELSE;
next_post = post;
END;
END -%]
[% IF next_post %]
<a href="#post-[% next_post.id %]">
« [% next_post.title %]
</a>
[% END %]
|
<a href="#post-list"> Main </a>
|
[% IF prev_post %]
<a href="#post-[% prev_post.id %]">
[% prev_post.title %] »
</a>
[% END %]

View File

@ -0,0 +1,51 @@
[% DEFAULT
page = 1,
page_count = undef,
title = 'Pages',
prefix = 'post-list/',
suffix = ''
-%]
[% IF page_count <= 10;
from = 1;
to = page_count;
ELSE;
from = page - 10 >= 1 ? page - 10 : 1
to = page + 9 >= page_count ? page_count : page + 9;
END -%]
<center>
<table class="paging">
<tr>
<td>
[% title %]:&nbsp; &nbsp;
</td>
<td>
[%- IF page > 1 %]
<span class="prev-page">
<a href="#[% prefix _ (page - 1) _ suffix %]">Previous</a>
</span>
[%- END %]
</td>
[%- i = from; %]
[%- WHILE i <= to %]
[%- IF i == page %]
<td class="highlight">[% i %]</td>
[%- ELSE %]
<td><a href="#[% prefix _ i _ suffix %]">[% i %]</a></td>
[%- END %]
[%- i = i + 1 %]
[%- END %]
<td>
[%- IF page < page_count %]
<span class="next-page">
<a href="#[% prefix _ (page + 1) _ suffix %]">Next</a>
</span>
[%- END %]
</td>
</tr>
</table>
</center>
<br/>

View File

@ -0,0 +1,5 @@
<div id="post-list-nav" class="content-nav"></div>
[% FOREACH post IN post_list %]
[% PROCESS 'post.tt' %]
[% END %]

View File

@ -0,0 +1,55 @@
<p class="content-nav">
</p>
<!-- entry -->
[% PROCESS 'post.tt' -%]
<a id="post-[%post.id%]:comments" name="post-[%post.id%]-comments"></a>
<div class="comments">
<h3 class="comments-header">Comments</h3>
<div class="comments-content">
<!-- comment list -->
</div>
</div>
<!-- comment form -->
<form id="comment-form" onsubmit="return false;" method="post">
<div class="comments-open">
<input id="comment-for" type="hidden" value="[% post.id %]"></input>
<h2 class="comments-open-header">Post a comment</h2>
<div class="comments-open-content">
<div id="comments-open-data">
<p>
<label for="comment-author">Name:</label>
<input id="comment-author" name="author" size="30" class="required"/>
</p>
<p>
<label for="comment-email">Email Address: <span class="comment-form-note">(Not displayed with comment.)</span></label>
<input id="comment-email" name="email" size="30" class="required" />
</p>
<p>
<label for="comment-url">URL:</label>
<input id="comment-url" name="url" size="30" />
</p>
<p>
<label for="comment-bake-cookie"><input type="checkbox"
id="comment-bake-cookie" name="bakecookie" value="1" />
Remember personal info?</label>
</p>
</div>
<p id="comments-open-text">
<label for="comment-text">Comments:</label>
<textarea id="comment-text" name="text" rows="10" cols="30" class="required"></textarea>
</p>
</div>
<div id="comments-open-footer" class="comments-open-footer">
<!-- <button name="preview" id="comment-preview">&nbsp;Preview&nbsp;</button> -->
<button name="post" id="comment-post" onclick="postComment([% post.id %]);">&nbsp;Post&nbsp;</button>
</div>
</div>
</form>

View File

@ -0,0 +1,32 @@
<h2 class="date-header">[% post.created %]</h2>
<div class="entry">
<h3 class="entry-header">
<a href="#post-[% post.id %]">
[%- post.title -%]
</a>
</h3>
<div class="entry-content">
<div class="entry-body">
[%- post.content -%]
<p/>
</div>
</div>
<div class="entry-footer">
<p class="entry-footer-info">
<span class="post-footers">
Posted by [% post.author %] at
[% post.created %] in
<a href="#post-[% post.id %]">Articles</a>
</span>
<span class="separator">|</span>
<a class="permalink" href="#post-[% post.id %]">Permalink</a>
<span class="separator">|</span>
<a href="#post-[% post.id %]:comments">Comments
(<span class="comment-count" post="[% post.id %]">[% post.comments %]</span>)
</a>
</p>
<!-- technorati tags -->
<!-- post footer links -->
</div>
</div>

View File

@ -0,0 +1,30 @@
<ul class="module-list">
[% last_id %]
[% FOREACH comment IN comments -%]
<li class="module-list-item">
<a href="#post-[% comment.post %]:comment-[% comment.id %]">
[% comment.sender | html %]</a> on
<a href="#post-[% comment.post %]">[% comment.title | html %]</a>
</li>
[%- last_id = comment.id %]
[% END -%]
</ul>
<p class="module-more">
[% IF offset > 0 %]
<a href="javascript:getRecentComments([% offset - count %])">&lt;&lt</a>
[% END %]
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
[% IF last_id > 1 && comments.size == count %]
<a id="more-recent-comments" href="javascript:getRecentComments([% offset + count %]);">
Next...
</a>
[% END %]
</p>

View File

@ -0,0 +1,28 @@
<ul class="module-list">
[% last_id %]
[% FOREACH post IN posts -%]
<li class="module-list-item">
<a href="#post-[% post.id %]">[% post.title %]</a>
</li>
[%- last_id = post.id %]
[% END -%]
</ul>
<p class="module-more">
[% IF offset > 0 %]
<a href="javascript:getRecentPosts([% offset - count %])">&lt;&lt;</a>
[% END %]
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
&nbsp; &nbsp;
[% IF last_id > 1 && posts.size == count %]
<a id="more-recent-posts" href="javascript:getRecentPosts([% offset + count %]);">
Next...
</a>
[% END %]
</p>

View File

@ -0,0 +1,11 @@
<div id="copyright">
<center>
<p>Powered by <a href="http://search.cpan.org/dist/OpenResty">OpenResty</a> and your web browser.</p>
<p>Chinese segmentation by <a target="_blank" href="http://code.google.com/p/nlpbamboo">Bamboo</a>
<!-- &nbsp; <script type="text/javascript" src="http://www.ohloh.net/projects/25889/widgets/project_thin_badge"></script>
-->
</p>
<p>Copyright © 2008 by Yahoo! China EEEE Works, Alibaba Inc.</p>
</center>
</div>

View File

@ -0,0 +1,36 @@
[% DEFAULT
blog_name = 'Foo\'s blog',
blog_desc = 'This is my blog';
-%]
[% IF NOT pack_js;
js_files = [
'jquery.js',
'blog-jemplate.js',
'openresty.js',
'dojo.openresty.js',
'blog.js',
];
ELSE;
js_files = ['jquery-dojo.js', 'blog_min.js'];
END;
-%]
<head>
<title>[% blog_name | html %]</title>
<meta name="description" content="[% blog_desc %]" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="http://search.cpan.org/perldoc?OpenResty" />
[%- FOREACH js_file IN js_files %]
<script type="text/javascript" src="[% js_file %]"></script>
[%- END %]
<link rel="stylesheet" href="blog.css" type="text/css" media="screen" />
<link rel="stylesheet" href="styles.css" type="text/css" media="screen" />
<link rel="stylesheet" href="themes/common/print.css" type="text/css" media="print" />
<link rel="alternate" type="application/rss+xml" title="Posts on '[% blog_name | html %]' (RSS 2.0)" href="http://[% resty_server %]/=/feed/Post/_user/[% blog_owner %].Public" />
<link rel="alternate" type="application/rss+xml" title="Comments on '[% blog_name | html %]' (RSS 2.0)" href="http://[% resty_server %]/=/feed/Comment/_user/[% blog_owner %].Public" />
</head>

View File

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
[%- PROCESS 'header.tt' -%]
<body class="layout-two-column-left">
<a name="top" class="blog-top"></a>
<!-- <a class="anchor-location"></a> -->
<div id="container">
<div id="container-inner" class="pkg">
<!-- banner -->
[%- PROCESS 'banner.tt' %]
<div id="pagebody">
<div id="pagebody-inner" class="pkg">
<div id="alpha">
<div id="alpha-inner" class="pkg">
<!-- sidebar -->
[%- PROCESS 'sidebar.tt' %]
</div>
</div>
<div id="beta">
<div class="pkg pager"></div>
<div id="beta-inner" class="pkg">
<!-- entries -->
</div>
<div class="pkg pager"></div>
<br/>
</div>
</div>
</div>
[%- PROCESS 'footer.tt' %]
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,98 @@
<div class="module-calendar module">
<!-- calendar.tt -->
</div>
<div class="module-archives module">
<h2 class="module-header">Site search</h2>
<div id="search-posts" class="module-content">
<form id="form-search" onsubmit="doPostSearch();return false;" action="">
<input type="text" size="20" maxlength="125" id="searchbox"/><br/>
<input type="submit" value="Search posts"/>
<!-- <input type="button" value="Comments"/> -->
</form>
</div>
</div>
<div class="module-archives module">
<h2 class="module-header">Recent Posts</h2>
<div id="recent-posts" class="module-content">
</div>
</div>
<div class="module-recent-comments module">
<h2 class="module-header">Recent Comments</h2>
<div class="module-content" id="recent-comments">
</div>
</div>
<div class="module-categories module">
<h2 class="module-header">Categories</h2>
<div class="module-content">
</div>
</div>
<div class="module-archives module">
<h2 class="module-header">Archives</h2>
<div class="module-content" id="archive-list">
</div>
</div>
[% IF blog_owner == 'agentzh' %]
<div class="module-feed module">
<h2 class="module-header">[% blog_owner %]</h2>
<div class="module-content" id="feed-d6e3ea166d4156b0ee0935b704a55dbf5f52a212">
</div>
</div>
<!-- user photo -->
<div class="module-photo module">
<div class="module-content"><img src="me.jpg" alt="My Photo" /></div>
<br/>
</div>
[% END %]
<div class="module-syndicate module">
<h2 class="module-header">RSS feed</h2>
<div class="module-content">
<!-- this is a hack; we'll use OpenAPI's own RSS feed support later -->
<ul class="module-list">
<li class="module-list-item">
<a href="http://[% resty_server %]/=/feed/Post/_user/[% blog_owner %].Public">Subscribe to the article feed</a>
</li>
<li class="module-list-item">
<a href="http://[% resty_server %]/=/feed/Comment/_user/[% blog_owner %].Public">Subscribe to the comment feed</a>
</li>
</ul>
</div>
</div>
<div class="module-download module">
<h2 class="module-header"><a
href="site-binary.tar.gz">Download this site</a></h2>
<div class="module-content">
<ul class="module-list">
<li class="module-list-item">
<a href="site-binary.tar.gz">Compiled form (.tar.gz)</a>
</li>
<li class="module-list-item">
<a target="_blank" href="http://github.com/agentzh/openresty/tree/8463c31834e1d007da26b8b6549e4d06b5963b70/demo/[% blog_owner == 'agentzh' ? "Blog" : "Blog2" %]/">
Source code (Git)
</a>
</li>
</ul>
</div>
</div>
<div class="module-typelist module">
<h2 class="module-header">License</h2>
<div class="module-content">
<ul class="module-list">
<li class="module-list-item">
This work is licensed under
<a href="http://en.wikipedia.org/wiki/MIT_License">
the MIT License
</a>.
</li>
</ul>
</div>
</div>