Move customize inside the current template. re #73
This commit is contained in:
parent
29eb9329a0
commit
428550f27c
56
base.php
56
base.php
|
@ -382,6 +382,8 @@ class Page
|
||||||
return new PageBookDetail ($id, $query, $n);
|
return new PageBookDetail ($id, $query, $n);
|
||||||
case Base::PAGE_ABOUT :
|
case Base::PAGE_ABOUT :
|
||||||
return new PageAbout ($id, $query, $n);
|
return new PageAbout ($id, $query, $n);
|
||||||
|
case Base::PAGE_CUSTOMIZE :
|
||||||
|
return new PageCustomize ($id, $query, $n);
|
||||||
default:
|
default:
|
||||||
$page = new Page ($id, $query, $n);
|
$page = new Page ($id, $query, $n);
|
||||||
$page->idPage = "cops:catalog";
|
$page->idPage = "cops:catalog";
|
||||||
|
@ -690,6 +692,59 @@ class PageAbout extends Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PageCustomize extends Page
|
||||||
|
{
|
||||||
|
public function InitializeContent ()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
$this->title = localize ("customize.title");
|
||||||
|
$this->entryArray = array ();
|
||||||
|
|
||||||
|
$use_fancybox = "";
|
||||||
|
if (getCurrentOption ("use_fancyapps") == 1) {
|
||||||
|
$use_fancybox = "checked='checked'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = "";
|
||||||
|
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||||
|
$content .= '<select id="style" onchange="updateCookie (this);">';
|
||||||
|
}
|
||||||
|
foreach (glob ("styles/style-*.css") as $filename) {
|
||||||
|
if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) {
|
||||||
|
$filename = $m [1];
|
||||||
|
}
|
||||||
|
$selected = "";
|
||||||
|
if (getCurrentOption ("style") == $filename) {
|
||||||
|
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||||
|
$selected = "selected='selected'";
|
||||||
|
} else {
|
||||||
|
$selected = "checked='checked'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||||
|
$content .= "<option value='{$filename}' {$selected}>{$filename}</option>";
|
||||||
|
} else {
|
||||||
|
$content .= "<input type='radio' onchange='updateCookieFromCheckbox (this);' id='style-{$filename}' name='style' value='{$filename}' {$selected} /><label for='style-{$filename}'> {$filename} </label>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||||
|
$content .= '</select>';
|
||||||
|
}
|
||||||
|
array_push ($this->entryArray, new Entry (localize ("customize.style"), "",
|
||||||
|
$content, "text",
|
||||||
|
array ()));
|
||||||
|
|
||||||
|
$content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" ' . $use_fancybox . ' />';
|
||||||
|
array_push ($this->entryArray, new Entry (localize ("customize.fancybox"), "",
|
||||||
|
$content, "text",
|
||||||
|
array ()));
|
||||||
|
$content = '<input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="' . getCurrentOption ("max_item_per_page") . '" min="-1" max="1200" pattern="^[-+]?[0-9]+$" />';
|
||||||
|
array_push ($this->entryArray, new Entry (localize ("customize.paging"), "",
|
||||||
|
$content, "text",
|
||||||
|
array ()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
abstract class Base
|
abstract class Base
|
||||||
{
|
{
|
||||||
|
@ -712,6 +767,7 @@ abstract class Base
|
||||||
const PAGE_ABOUT = "16";
|
const PAGE_ABOUT = "16";
|
||||||
const PAGE_ALL_LANGUAGES = "17";
|
const PAGE_ALL_LANGUAGES = "17";
|
||||||
const PAGE_LANGUAGE_DETAIL = "18";
|
const PAGE_LANGUAGE_DETAIL = "18";
|
||||||
|
const PAGE_CUSTOMIZE = "19";
|
||||||
|
|
||||||
const COMPATIBILITY_XML_ALDIKO = "aldiko";
|
const COMPATIBILITY_XML_ALDIKO = "aldiko";
|
||||||
|
|
||||||
|
|
124
customize.php
124
customize.php
|
@ -1,124 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* COPS (Calibre OPDS PHP Server) HTML main script
|
|
||||||
*
|
|
||||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
|
||||||
* @author Sébastien Lucas <sebastien@slucas.fr>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once ("config.php");
|
|
||||||
require_once ("base.php");
|
|
||||||
|
|
||||||
|
|
||||||
header ("Content-Type:text/html;charset=utf-8");
|
|
||||||
|
|
||||||
$database = GetUrlParam (DB);
|
|
||||||
$use_fancybox = "";
|
|
||||||
if (getCurrentOption ("use_fancyapps") == 1) {
|
|
||||||
$use_fancybox = "checked='checked'";
|
|
||||||
}
|
|
||||||
$max_item_per_page = getCurrentOption ("max_item_per_page");
|
|
||||||
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title><?php echo localize ("customize.title") ?></title>
|
|
||||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jQuery/jquery-1.10.1.min.js") ?>"></script>
|
|
||||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jquery-cookie/jquery.cookies.js") ?>"></script>
|
|
||||||
<link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Open+Sans:400,300italic,800,300,400italic,600,600italic,700,700italic,800italic' />
|
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/normalize/normalize.css") ?>" />
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
function updateCookie (id) {
|
|
||||||
if($(id).prop('pattern') && !$(id).val().match(new RegExp ($(id).prop('pattern')))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var name = $(id).attr('id');
|
|
||||||
var value = $(id).val ();
|
|
||||||
$.cookie(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateCookieFromCheckbox (id) {
|
|
||||||
var name = $(id).attr('id');
|
|
||||||
if ((/^style/).test (name)) {
|
|
||||||
name = "style";
|
|
||||||
}
|
|
||||||
if ($(id).is(":checked"))
|
|
||||||
{
|
|
||||||
if ($(id).is(':radio')) {
|
|
||||||
$.cookie(name, $(id).val ());
|
|
||||||
} else {
|
|
||||||
$.cookie(name, '1');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$.cookie(name, '0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<header>
|
|
||||||
<a class="headleft" href="index.php">
|
|
||||||
<img src="<?php echo getUrlWithVersion("images/home.png") ?>" alt="<?php echo localize ("home.alternate") ?>" />
|
|
||||||
</a>
|
|
||||||
<img class="headright" style="visibility: hidden;" id="searchImage" src="<?php echo getUrlWithVersion("images/setting64.png") ?>" alt="Settings and menu" />
|
|
||||||
<div class="headcenter">
|
|
||||||
<h1><?php echo localize ("customize.title") ?></h1>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<article class="frontpage">
|
|
||||||
<h2><?php echo localize ("customize.style") ?></h2>
|
|
||||||
<h4>
|
|
||||||
<?php
|
|
||||||
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
|
||||||
echo '<select id="style" onchange="updateCookie (this);">';
|
|
||||||
}
|
|
||||||
foreach (glob ("styles/style-*.css") as $filename) {
|
|
||||||
if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) {
|
|
||||||
$filename = $m [1];
|
|
||||||
}
|
|
||||||
$selected = "";
|
|
||||||
if (getCurrentOption ("style") == $filename) {
|
|
||||||
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
|
||||||
$selected = "selected='selected'";
|
|
||||||
} else {
|
|
||||||
$selected = "checked='checked'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
|
||||||
echo "<option value='{$filename}' {$selected}>{$filename}</option>";
|
|
||||||
} else {
|
|
||||||
echo "<input type='radio' onchange='updateCookieFromCheckbox (this);' id='style-{$filename}' name='style' value='{$filename}' {$selected} /><label for='style-{$filename}'> {$filename} </label>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
|
||||||
echo '</select>';
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
</h4>
|
|
||||||
</article>
|
|
||||||
<article class="frontpage">
|
|
||||||
<h2><?php echo localize ("customize.fancybox") ?></h2>
|
|
||||||
<h4><input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" <?php echo $use_fancybox ?> /></h4>
|
|
||||||
</article>
|
|
||||||
<article class="frontpage">
|
|
||||||
<h2><?php echo localize ("customize.paging") ?></h2>
|
|
||||||
<h4><input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="<?php echo $max_item_per_page ?>" min="-1" max="1200" pattern="^[-+]?[0-9]+$" /></h4>
|
|
||||||
</article>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -10,7 +10,7 @@
|
||||||
{{~it.book.datas:data:i}}
|
{{~it.book.datas:data:i}}
|
||||||
<a href="{{=data.url}}">{{=data.format}}</a>
|
<a href="{{=data.url}}">{{=data.format}}</a>
|
||||||
{{? data.mail == 1}}
|
{{? data.mail == 1}}
|
||||||
<a href="customize.php" onclick="sendToMailAddress (this, {{=data.id}}); return false;"><img src="images/mail-send.png?v={{=it.const.version}}" alt="Mail" /></a>
|
<a href="empty.php" onclick="sendToMailAddress (this, {{=data.id}}); return false;"><img src="images/mail-send.png?v={{=it.const.version}}" alt="Mail" /></a>
|
||||||
{{?}}
|
{{?}}
|
||||||
<br />
|
<br />
|
||||||
{{~}}
|
{{~}}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<footer>
|
<footer>
|
||||||
<div class="footleft">
|
<div class="footleft">
|
||||||
<a href="customize.php"><img src="images/theme.png?v={{=it.const.version}}" alt="{{=it.const.i18n.customizeTitle}}" /></a>
|
<a href="index.php?page=19"><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.const.version}}" alt="{{=it.const.i18n.aboutTitle}}" /></a>
|
<a class="fancyabout" href="{{=it.abouturl}}"><img src="images/info.png?v={{=it.const.version}}" alt="{{=it.const.i18n.aboutTitle}}" /></a>
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
{{? it.containsBook == 0}}
|
{{? it.containsBook == 0}}
|
||||||
<article>
|
<article>
|
||||||
<div class="frontpage">
|
<div class="frontpage">
|
||||||
<a href="{{=entry.navlink}}">
|
{{? entry.navlink != "#"}}<a href="{{=entry.navlink}}">{{?}}
|
||||||
<h2>{{=htmlEscape (entry.title)}}</h2>
|
<h2>{{=htmlEscape (entry.title)}}</h2>
|
||||||
<h4>{{=entry.content}}</h4>
|
<h4>{{=entry.content}}</h4>
|
||||||
</a>
|
{{? entry.navlink != "#"}}</a>{{?}}
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{{??}}
|
{{??}}
|
||||||
|
|
30
util.js
30
util.js
|
@ -14,6 +14,34 @@ function debug_log(text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateCookie (id) {
|
||||||
|
if($(id).prop('pattern') && !$(id).val().match(new RegExp ($(id).prop('pattern')))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var name = $(id).attr('id');
|
||||||
|
var value = $(id).val ();
|
||||||
|
$.cookie(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCookieFromCheckbox (id) {
|
||||||
|
var name = $(id).attr('id');
|
||||||
|
if ((/^style/).test (name)) {
|
||||||
|
name = "style";
|
||||||
|
}
|
||||||
|
if ($(id).is(":checked"))
|
||||||
|
{
|
||||||
|
if ($(id).is(':radio')) {
|
||||||
|
$.cookie(name, $(id).val ());
|
||||||
|
} else {
|
||||||
|
$.cookie(name, '1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$.cookie(name, '0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function elapsed () {
|
function elapsed () {
|
||||||
var elapsed = new Date () - before;
|
var elapsed = new Date () - before;
|
||||||
return "Elapsed : " + elapsed;
|
return "Elapsed : " + elapsed;
|
||||||
|
@ -109,7 +137,7 @@ function updatePage (data) {
|
||||||
$("#sortForm").hide ();
|
$("#sortForm").hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ajaxifyLinks ();
|
if (currentData.page != 19) ajaxifyLinks ();
|
||||||
|
|
||||||
$("#sort").click(function(){
|
$("#sort").click(function(){
|
||||||
$('.books').sortElements(function(a, b){
|
$('.books').sortElements(function(a, b){
|
||||||
|
|
Loading…
Reference in a new issue