Save new things in constants. re #73

This commit is contained in:
Sébastien Lucas 2013-06-17 21:21:52 +02:00
parent 074a2b8a0f
commit 8de878fa94
6 changed files with 32 additions and 31 deletions

View file

@ -26,7 +26,7 @@
$currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent (); $currentPage->InitializeContent ();
$out = array ( "title" => $currentPage->title, "version" => VERSION); $out = array ( "title" => $currentPage->title);
$entries = array (); $entries = array ();
foreach ($currentPage->entryArray as $entry) { foreach ($currentPage->entryArray as $entry) {
array_push ($entries, $entry->getContentArray ()); array_push ($entries, $entry->getContentArray ());
@ -55,7 +55,8 @@
$out ["currentPage"] = $currentPage->n; $out ["currentPage"] = $currentPage->n;
} }
if (!is_null (getURLParam ("complete"))) { if (!is_null (getURLParam ("complete"))) {
$out ["i18n"] = array ("coverAlt" => localize("i18n.coversection"), $out ["const"] = array ("version" => VERSION, "i18n" => array (
"coverAlt" => localize("i18n.coversection"),
"authorsTitle" => localize("authors.title"), "authorsTitle" => localize("authors.title"),
"bookwordTitle" => localize("bookword.title"), "bookwordTitle" => localize("bookword.title"),
"tagsTitle" => localize("tags.title"), "tagsTitle" => localize("tags.title"),
@ -72,7 +73,7 @@
"languagesTitle" => localize("language.title"), "languagesTitle" => localize("language.title"),
"contentTitle" => localize("content.summary"), "contentTitle" => localize("content.summary"),
"sortorderAsc" => localize("search.sortorder.asc"), "sortorderAsc" => localize("search.sortorder.asc"),
"sortorderDesc" => localize("search.sortorder.desc")); "sortorderDesc" => localize("search.sortorder.desc")));
} }
$out ["containsBook"] = 0; $out ["containsBook"] = 0;

View file

@ -2,7 +2,7 @@
<span class="cover"> <span class="cover">
{{? it.book.hasCover == 1}} {{? it.book.hasCover == 1}}
<a href="{{=it.book.coverurl}}"> <a href="{{=it.book.coverurl}}">
<img src="{{=it.book.thumbnailurl}}" alt="{{=it.i18n.coverAlt}}" /> <img src="{{=it.book.thumbnailurl}}" alt="{{=it.const.i18n.coverAlt}}" />
</a> </a>
{{?}} {{?}}
</span> </span>
@ -11,16 +11,16 @@
<a href="{{=data.url}}">{{=data.format}}</a><br /> <a href="{{=data.url}}">{{=data.format}}</a><br />
{{~}} {{~}}
</h2> </h2>
<h1><a rel="bookmark" href="{{=it.book.detailurl}}"><img src="images/Link.png?v={{=it.version}}" alt="{{=it.i18n.permalinkAlt}}" /></a>{{=htmlEscape (it.title)}}</h1> <h1><a rel="bookmark" href="{{=it.book.detailurl}}"><img src="images/Link.png?v={{=it.const.version}}" alt="{{=it.const.i18n.permalinkAlt}}" /></a>{{=htmlEscape (it.title)}}</h1>
<p class="popupless"> <p class="popupless">
<h3>{{=it.i18n.authorsTitle}}: </h3> <h3>{{=it.const.i18n.authorsTitle}}: </h3>
{{~it.book.authors:author:j}} {{~it.book.authors:author:j}}
{{? j > 0}}, {{?}}<a href="{{=author.url}}">{{=htmlEscape (author.name)}}</a> {{? j > 0}}, {{?}}<a href="{{=author.url}}">{{=htmlEscape (author.name)}}</a>
{{~}} {{~}}
</p> </p>
{{? it.book.tagsName != ""}} {{? it.book.tagsName != ""}}
<p class="popupless"> <p class="popupless">
<h3>{{=it.i18n.tagsTitle}}: </h3> <h3>{{=it.const.i18n.tagsTitle}}: </h3>
{{~it.book.tags:tag:k}} {{~it.book.tags:tag:k}}
{{? k > 0}}, {{?}}<a href="{{=tag.url}}">{{=htmlEscape (tag.name)}}</a> {{? k > 0}}, {{?}}<a href="{{=tag.url}}">{{=htmlEscape (tag.name)}}</a>
{{~}} {{~}}
@ -28,22 +28,22 @@
{{?}} {{?}}
{{? it.book.seriesName != ""}} {{? it.book.seriesName != ""}}
<p class="popupless"> <p class="popupless">
<h3><a href="{{=it.book.seriesurl}}">{{=it.i18n.seriesTitle}}</a> : </h3>{{=htmlEscape (it.book.seriesCompleteName)}} <h3><a href="{{=it.book.seriesurl}}">{{=it.const.i18n.seriesTitle}}</a> : </h3>{{=htmlEscape (it.book.seriesCompleteName)}}
</p> </p>
{{?}} {{?}}
{{? it.book.pubDate != ""}} {{? it.book.pubDate != ""}}
<p class="popupless"> <p class="popupless">
<h3>{{=it.i18n.pubdateTitle}}: </h3>{{=it.book.pubDate}} <h3>{{=it.const.i18n.pubdateTitle}}: </h3>{{=it.book.pubDate}}
</p> </p>
{{?}} {{?}}
{{? it.book.languagesName != ""}} {{? it.book.languagesName != ""}}
<p class="popupless"> <p class="popupless">
<h3>{{=it.i18n.languagesTitle}}: </h3>{{=it.book.languagesName}} <h3>{{=it.const.i18n.languagesTitle}}: </h3>{{=it.book.languagesName}}
</p> </p>
{{?}} {{?}}
{{? it.book.content != ""}} {{? it.book.content != ""}}
<br /> <br />
<h4>{{=it.i18n.contentTitle}}</h4> <h4>{{=it.const.i18n.contentTitle}}</h4>
<div>{{=it.book.content}}</div> <div>{{=it.book.content}}</div>
{{?}} {{?}}
</article> </article>

View file

@ -1,15 +1,15 @@
<footer> <footer>
<div class="footleft"> <div class="footleft">
<a href="customize.php"><img src="images/theme.png?v={{=it.version}}" alt="{{=it.i18n.customizeTitle}}" /></a> <a href="customize.php"><img src="images/theme.png?v={{=it.const.version}}" alt="{{=it.const.i18n.customizeTitle}}" /></a>
</div> </div>
<div class="footright"> <div class="footright">
<a class="fancyabout" href="{{=it.abouturl}}"><img src="images/info.png?v={{=it.version}}" alt="{{=it.i18n.aboutTitle}}" /></a> <a class="fancyabout" href="{{=it.abouturl}}"><img src="images/info.png?v={{=it.const.version}}" alt="{{=it.const.i18n.aboutTitle}}" /></a>
</div> </div>
{{? it.isPaginated == 1}} {{? it.isPaginated == 1}}
<div class="footcenter"> <div class="footcenter">
{{? it.prevLink != ""}}<a id="prevLink" href="{{=it.prevLink}}" ><img src="images/previous.png?v={{=it.version}}" alt="{{=it.i18n.previousAlt}}" /></a>{{?}} {{? it.prevLink != ""}}<a id="prevLink" href="{{=it.prevLink}}" ><img src="images/previous.png?v={{=it.const.version}}" alt="{{=it.const.i18n.previousAlt}}" /></a>{{?}}
<p> {{=it.currentPage}} / {{=it.maxPage}} </p> <p> {{=it.currentPage}} / {{=it.maxPage}} </p>
{{? it.nextLink != ""}}<a id="nextLink" href="{{=it.nextLink}}" ><img src="images/next.png?v={{=it.version}}" alt="{{=it.i18n.nextAlt}}" /></a>{{?}} {{? it.nextLink != ""}}<a id="nextLink" href="{{=it.nextLink}}" ><img src="images/next.png?v={{=it.const.version}}" alt="{{=it.const.i18n.nextAlt}}" /></a>{{?}}
</div> </div>
{{?}} {{?}}
</footer> </footer>

View file

@ -1,8 +1,8 @@
<header> <header>
<a class="headleft" href="{{=it.homeurl}}"> <a class="headleft" href="{{=it.homeurl}}">
<img src="images/home.png?v={{=it.version}}" alt="{{=it.i18n.homeAlt}}" /> <img src="images/home.png?v={{=it.const.version}}" alt="{{=it.const.i18n.homeAlt}}" />
</a> </a>
<img class="headright" id="searchImage" src="images/setting64.png?v={{=it.version}}" alt="Settings and menu" /> <img class="headright" id="searchImage" src="images/setting64.png?v={{=it.const.version}}" alt="Settings and menu" />
<div class="headcenter"> <div class="headcenter">
<h1>{{=it.title}}</h1> <h1>{{=it.title}}</h1>
</div> </div>
@ -10,7 +10,7 @@
<div style="float: left; width: 60%"> <div style="float: left; width: 60%">
<form action="index.php" method="get"> <form action="index.php" method="get">
<div style="float: right"> <div style="float: right">
<input type="image" src="images/search32.png?v={{=it.version}}" alt="{{=it.i18n.searchAlt}}" /> <input type="image" src="images/search32.png?v={{=it.const.version}}" alt="{{=it.const.i18n.searchAlt}}" />
</div> </div>
<div class="stop"> <div class="stop">
<input type="hidden" name="current" value="{{=it.page}}" /> <input type="hidden" name="current" value="{{=it.page}}" />
@ -25,18 +25,18 @@
{{? it.containsBook == 1}} {{? it.containsBook == 1}}
<div style="float: right; width: 35%"> <div style="float: right; width: 35%">
<div style="float: right"> <div style="float: right">
<img id="sort" src="images/sort32.png?v={{=it.version}}" alt="{{=it.i18n.sortAlt}}" /> <img id="sort" src="images/sort32.png?v={{=it.const.version}}" alt="{{=it.const.i18n.sortAlt}}" />
</div> </div>
<div class="stop"> <div class="stop">
<select id="sortchoice"> <select id="sortchoice">
<option value="st">{{=it.i18n.bookwordTitle}}</option> <option value="st">{{=it.const.i18n.bookwordTitle}}</option>
<option value="sa">{{=it.i18n.authorsTitle}}</option> <option value="sa">{{=it.const.i18n.authorsTitle}}</option>
<option value="ss">{{=it.i18n.seriesTitle}}</option> <option value="ss">{{=it.const.i18n.seriesTitle}}</option>
<option value="sp">{{=it.i18n.pubdateTitle}}</option> <option value="sp">{{=it.const.i18n.pubdateTitle}}</option>
</select> </select>
<select id="sortorder"> <select id="sortorder">
<option value="asc">{{=it.i18n.sortorderAsc}}</option> <option value="asc">{{=it.const.i18n.sortorderAsc}}</option>
<option value="desc">{{=it.i18n.sortorderDesc}}</option> <option value="desc">{{=it.const.i18n.sortorderDesc}}</option>
</select> </select>
</div> </div>
</div> </div>

View file

@ -16,7 +16,7 @@
<article class="books"> <article class="books">
<span class="cover"> <span class="cover">
{{? entry.book.hasCover == 1}} {{? entry.book.hasCover == 1}}
<a data-fancybox-group="group" class="fancycover" href="{{=entry.coverurl}}"><img src="{{=entry.thumbnailurl}}" alt="{{=it.i18n.coverAlt}}" /></a> <a data-fancybox-group="group" class="fancycover" href="{{=entry.coverurl}}"><img src="{{=entry.thumbnailurl}}" alt="{{=it.const.i18n.coverAlt}}" /></a>
{{?}} {{?}}
</span> </span>
<h2 class="download"> <h2 class="download">
@ -30,9 +30,9 @@
{{? entry.book.pubDate != ""}}<span class="sp">({{=entry.book.pubDate}})</span>{{?}} {{? entry.book.pubDate != ""}}<span class="sp">({{=entry.book.pubDate}})</span>{{?}}
{{? entry.book.rating != ""}}<span class="sr">{{=entry.book.rating}}</span>{{?}} {{? entry.book.rating != ""}}<span class="sr">{{=entry.book.rating}}</span>{{?}}
</h2> </h2>
<h4>{{=it.i18n.authorsTitle}} : </h4><span class="sa">{{=htmlEscape (entry.book.authorsName)}}</span><br /> <h4>{{=it.const.i18n.authorsTitle}} : </h4><span class="sa">{{=htmlEscape (entry.book.authorsName)}}</span><br />
{{? entry.book.tagsName != ""}}<h4>{{=it.i18n.tagsTitle}} : </h4>{{=htmlEscape (entry.book.tagsName)}}<br />{{?}} {{? entry.book.tagsName != ""}}<h4>{{=it.const.i18n.tagsTitle}} : </h4>{{=htmlEscape (entry.book.tagsName)}}<br />{{?}}
{{? entry.book.seriesName != ""}}<h4>{{=it.i18n.seriesTitle}} : </h4>{{=htmlEscape (entry.book.seriesName)}}<br />{{?}} {{? entry.book.seriesName != ""}}<h4>{{=it.const.i18n.seriesTitle}} : </h4>{{=htmlEscape (entry.book.seriesName)}}<br />{{?}}
</div></a> </div></a>
</article> </article>
{{?}} {{?}}

View file

@ -36,7 +36,7 @@ function navigateTo (url) {
} }
function updatePage (data) { function updatePage (data) {
data ["i18n"] = currentData ["i18n"]; data ["const"] = currentData ["const"];
currentData = data; currentData = data;
var result = templatePage (data); var result = templatePage (data);
document.title = data.title; document.title = data.title;
@ -73,7 +73,7 @@ function updatePage (data) {
var url = $(this).attr("href"); var url = $(this).attr("href");
var jsonurl = url.replace ("bookdetail", "getJSON"); var jsonurl = url.replace ("bookdetail", "getJSON");
$.getJSON(jsonurl, function(data) { $.getJSON(jsonurl, function(data) {
data ["i18n"] = currentData ["i18n"]; data ["const"] = currentData ["const"];
var detail = templateBookDetail (data); var detail = templateBookDetail (data);
$.fancybox( { $.fancybox( {
content: detail, content: detail,