The ignored categories is now in the customize UI page. re #34
It's far from complete but it works. I'll have to check the strings consistancy.
This commit is contained in:
parent
e0e7392817
commit
c71f443356
41
base.php
41
base.php
|
@ -33,7 +33,11 @@ function getURLParam ($name, $default = NULL) {
|
|||
function getCurrentOption ($option) {
|
||||
global $config;
|
||||
if (isset($_COOKIE[$option])) {
|
||||
return $_COOKIE[$option];
|
||||
if (isset($config ["cops_" . $option]) && is_array ($config ["cops_" . $option])) {
|
||||
return explode (",", $_COOKIE[$option]);
|
||||
} else {
|
||||
return $_COOKIE[$option];
|
||||
}
|
||||
}
|
||||
if ($option == "style") {
|
||||
return "default";
|
||||
|
@ -464,22 +468,23 @@ class Page
|
|||
Base::clearDb ();
|
||||
}
|
||||
} else {
|
||||
if (!in_array (PageQueryResult::SCOPE_AUTHOR, $config ['cops_ignored_categories'])) {
|
||||
//error_log (var_dump (getCurrentOption ('ignored_categories')));
|
||||
if (!in_array (PageQueryResult::SCOPE_AUTHOR, getCurrentOption ('ignored_categories'))) {
|
||||
array_push ($this->entryArray, Author::getCount());
|
||||
}
|
||||
if (!in_array (PageQueryResult::SCOPE_SERIES, $config ['cops_ignored_categories'])) {
|
||||
if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) {
|
||||
$series = Serie::getCount();
|
||||
if (!is_null ($series)) array_push ($this->entryArray, $series);
|
||||
}
|
||||
if (!in_array (PageQueryResult::SCOPE_PUBLISHER, $config ['cops_ignored_categories'])) {
|
||||
if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) {
|
||||
$publisher = Publisher::getCount();
|
||||
if (!is_null ($publisher)) array_push ($this->entryArray, $publisher);
|
||||
}
|
||||
if (!in_array (PageQueryResult::SCOPE_TAG, $config ['cops_ignored_categories'])) {
|
||||
if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) {
|
||||
$tags = Tag::getCount();
|
||||
if (!is_null ($tags)) array_push ($this->entryArray, $tags);
|
||||
}
|
||||
if (!in_array ("language", $config ['cops_ignored_categories'])) {
|
||||
if (!in_array ("language", getCurrentOption ('ignored_categories'))) {
|
||||
$languages = Language::getCount();
|
||||
if (!is_null ($languages)) array_push ($this->entryArray, $languages);
|
||||
}
|
||||
|
@ -813,7 +818,20 @@ class PageCustomize extends Page
|
|||
if (getCurrentOption ("html_tag_filter") == 1) {
|
||||
$html_tag_filter = "checked='checked'";
|
||||
}
|
||||
|
||||
|
||||
$ignored_categories = array ();
|
||||
$ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR,
|
||||
PageQueryResult::SCOPE_TAG,
|
||||
PageQueryResult::SCOPE_SERIES,
|
||||
PageQueryResult::SCOPE_PUBLISHER,
|
||||
"language");
|
||||
foreach ($ignoredBaseArray as $key) {
|
||||
if (in_array ($key, getCurrentOption ('ignored_categories'))) {
|
||||
$ignored_categories [$key] = "checked='checked'";
|
||||
} else {
|
||||
$ignored_categories [$key] = "";
|
||||
}
|
||||
}
|
||||
|
||||
$content = "";
|
||||
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
|
@ -861,6 +879,15 @@ class PageCustomize extends Page
|
|||
array_push ($this->entryArray, new Entry (localize ("customize.filter"), "",
|
||||
$content, "text",
|
||||
array ()));
|
||||
$content = "";
|
||||
foreach ($ignoredBaseArray as $key) {
|
||||
$keyPlural = preg_replace ('/(ss)$/', 's', $key . "s");
|
||||
$content .= '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $ignored_categories [$key] . ' > ' . localize ("{$keyPlural}.title") . '</input> ';
|
||||
}
|
||||
|
||||
array_push ($this->entryArray, new Entry (localize ("customize.ignored"), "",
|
||||
$content, "text",
|
||||
array ()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
book.php
4
book.php
|
@ -602,7 +602,7 @@ where data.book = books.id and data.id = ?');
|
|||
PageQueryResult::SCOPE_SERIES,
|
||||
PageQueryResult::SCOPE_PUBLISHER,
|
||||
PageQueryResult::SCOPE_BOOK) as $key) {
|
||||
if (in_array($key, $config ['cops_ignored_categories']) ||
|
||||
if (in_array($key, getCurrentOption ('ignored_categories')) ||
|
||||
(!array_key_exists ($key, $query) && !array_key_exists ("all", $query))) {
|
||||
$critArray [$i] = self::BAD_SEARCH;
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ function getJson ($complete = false) {
|
|||
PageQueryResult::SCOPE_SERIES,
|
||||
PageQueryResult::SCOPE_TAG,
|
||||
PageQueryResult::SCOPE_PUBLISHER) as $key) {
|
||||
if (in_array($key, $config ['cops_ignored_categories'])) {
|
||||
if (in_array($key, getCurrentOption ('ignored_categories'))) {
|
||||
continue;
|
||||
}
|
||||
switch ($key) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"##TODO##customize.email":"Set your email (to allow book emailing)",
|
||||
"##TODO##customize.fancybox":"Use a Lightbox",
|
||||
"##TODO##customize.filter":"Enable tag filtering",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"##TODO##customize.paging":"Max number of books per page (-1 to disable)",
|
||||
"##TODO##customize.style":"Theme",
|
||||
"##TODO##customize.title":"Customize COPS UI",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"Geben Sie Ihre E-Mail-Adresse an (erlaubt das Zusenden von Büchern)",
|
||||
"customize.fancybox":"Benutze die Lightbox",
|
||||
"customize.filter":"Erlaube das Filtern durch Tags",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"customize.paging":"Maximale Anzahl von Büchern pro Seite (-1 zum deaktivieren)",
|
||||
"customize.style":"Thema",
|
||||
"customize.title":"Anpassungen an COPS",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"Set your email (to allow book emailing)",
|
||||
"customize.fancybox":"Use a Lightbox",
|
||||
"customize.filter":"Enable tag filtering",
|
||||
"customize.ignored":"Ignored categories",
|
||||
"customize.paging":"Max number of books per page (-1 to disable)",
|
||||
"customize.style":"Theme",
|
||||
"customize.title":"Customize COPS UI",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"##TODO##customize.email":"Set your email (to allow book emailing)",
|
||||
"##TODO##customize.fancybox":"Use a Lightbox",
|
||||
"##TODO##customize.filter":"Enable tag filtering",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"##TODO##customize.paging":"Max number of books per page (-1 to disable)",
|
||||
"##TODO##customize.style":"Theme",
|
||||
"##TODO##customize.title":"Customize COPS UI",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"Adresse email (pour l'envoi automatique de livres)",
|
||||
"customize.fancybox":"Utiliser une Lightbox",
|
||||
"customize.filter":"Filtrage via les étiquettes",
|
||||
"customize.ignored":"Catégories ignorées",
|
||||
"customize.paging":"Nombre de livres par page (-1 pour désactiver)",
|
||||
"customize.style":"Thème",
|
||||
"customize.title":"Paramétrage de COPS",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"Imposta la tua email (per permettere l'invio di email)",
|
||||
"customize.fancybox":"Usa una Lightbox",
|
||||
"customize.filter":"Abilita il filtro per argomento",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"customize.paging":"Numero massimo di libri per pagina (-1 per disabilitare)",
|
||||
"customize.style":"Tema",
|
||||
"customize.title":"Personalizza l'interfaccia di COPS",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"Sett e-pstadresse (for å sende bøker i e-post)",
|
||||
"customize.fancybox":"Bruk en Lightbox",
|
||||
"customize.filter":"Tillat filtrering på nøkkelord",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"customize.paging":"Maks antall bøker per side (-1 for å deaktivere)",
|
||||
"customize.style":"Tema",
|
||||
"customize.title":"Tilpass COPS brukergrensesnitt",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"Email-adres ontvanger (om boeken te versturen per elektronische post)",
|
||||
"customize.fancybox":"Gebruik een Lightbox",
|
||||
"customize.filter":"Zet filteren op tag aan",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"customize.paging":"Maximaal aantal boeken per pagina (-1 voor oneindig aantal)",
|
||||
"customize.style":"Opmaak COPS gebruikersomgeving",
|
||||
"customize.title":"Aanpassen COPS gebruikersomgeving",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"Forneça seu email (para enviar o ebook)",
|
||||
"customize.fancybox":"Usar o Lightbox",
|
||||
"customize.filter":"Ativar filtro por etiqueta",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"customize.paging":"Número máximo de livros por página (-1 para desabilitar)",
|
||||
"customize.style":"Tema",
|
||||
"customize.title":"Personalizar a interface do COPS",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"Укажите Ваш email (для отправки книг по электронной почте)",
|
||||
"customize.fancybox":"Использовать Lightbox",
|
||||
"customize.filter":"Включить фильтрацию по меткам",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"customize.paging":"Макс. число книг на странице (-1 - не ограничивать)",
|
||||
"customize.style":"Тема",
|
||||
"customize.title":"Изменить Интерфейс COPS",
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"customize.email":"设置您的电子邮件(以允许发送邮件)",
|
||||
"customize.fancybox":"使用灯箱",
|
||||
"customize.filter":"打开标签过滤",
|
||||
"##TODO##customize.ignored":"Ignored categories",
|
||||
"customize.paging":"页内最大书籍数(-1表示禁用)",
|
||||
"customize.style":"主题",
|
||||
"customize.title":"自定义界面",
|
||||
|
|
13
util.js
13
util.js
|
@ -52,6 +52,19 @@ function updateCookieFromCheckbox (id) {
|
|||
}
|
||||
}
|
||||
|
||||
/*exported updateCookieFromCheckboxGroup */
|
||||
function updateCookieFromCheckboxGroup (id) {
|
||||
var name = $(id).attr('name');
|
||||
var idBase = name.replace (/\[\]/, "");
|
||||
var group = [];
|
||||
$(':checkbox[name="' + name + '"]:checked').each (function () {
|
||||
var id = $(this).attr("id");
|
||||
group.push (id.replace (idBase + "_", ""));
|
||||
});
|
||||
$.cookie(idBase, group.join (), { expires: 365 });
|
||||
}
|
||||
|
||||
|
||||
function elapsed () {
|
||||
var elapsedTime = new Date () - before;
|
||||
return "Elapsed : " + elapsedTime;
|
||||
|
|
Loading…
Reference in a new issue