From dbdff59c140fe45d858f4dc2c611daf56005aef6 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Wed, 29 Jan 2020 14:18:52 +0100 Subject: new feature : secure level coloration in home --- app/class/Opt.php | 50 +++++++++++++++------------------------------ app/view/templates/home.php | 6 +++--- assets/css/home.css | 18 ++++++++++++++++ 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/app/class/Opt.php b/app/class/Opt.php index 4e1eb72..253e4f6 100644 --- a/app/class/Opt.php +++ b/app/class/Opt.php @@ -111,66 +111,48 @@ class Opt extends Item * @param array $taglist List of tag to be * @return string html code to be printed */ - public function tag(array $taglist = []) : string + public function taglinks(array $taglist = []) : string { $tagstring = ""; foreach ($taglist as $tag ) { - $tagstring .= '' . $tag . '' . PHP_EOL; + $tagstring .= '' . $tag . '' . PHP_EOL; } return $tagstring; } - /** - * Generate http query based on a new tagfilter input - * - * @param string $tag The tag to be selected - * @return string Query string without `?` - */ - public function gettagadress(string $tag = "") : string - { - $object = $this->drylist(['sortby', 'order', 'secure', 'tagcompare', 'authorfilter', 'authorcompare', 'invert', 'limit']); - if(!empty($tag)) { - $object['tagfilter'][] = $tag; - } - $object['submit'] = 'filter'; - - return urldecode(http_build_query($object)); - } - - /** * Get the link list for each authors of an page * * @param array $authorlist List of author to be * @return string html code to be printed */ - public function author(array $authorlist = []) : string + public function authorlinks(array $authorlist = []) : string { $authorstring = ""; foreach ($authorlist as $author ) { - $authorstring .= '' . $author . '' . PHP_EOL; + $authorstring .= '' . $author . '' . PHP_EOL; } return $authorstring; } - /** - * Generate http query based on a new authorfilter input - * - * @param string $author The author to be selected - * @return string Query string without `?` - */ - public function getauthoradress(string $author = "") : string + public function securelink(int $level, string $secure) { - $object = $this->drylist(['sortby', 'order', 'secure', 'tagfilter', 'tagcompare', 'authorcompare', 'invert', 'limit']); - if(!empty($author)) { - $object['authorfilter'][] = $author; - } - $object['submit'] = 'filter'; + return '' . $secure . '' . PHP_EOL; + } + + public function getfilteradress(array $vars = []) + { + $varlist = ['sortby', 'order', 'secure', 'tagfilter', 'tagcompare', 'authorfilter', 'authorcompare', 'invert', 'limit']; + // array_filter($vars, function ()) + $object = $this->drylist($varlist); + $object = array_merge($object, $vars); + $object['submit'] = 'filter'; return urldecode(http_build_query($object)); } + /** * Get the query as http string * diff --git a/app/view/templates/home.php b/app/view/templates/home.php index 6b3bca3..60dd836 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -97,7 +97,7 @@ - tag($item->tag('array')) ?> + taglinks($item->tag('array')) ?> title() ?> @@ -121,10 +121,10 @@ date('dmy') ?> - secure('string') ?> + securelink($item->secure('int') , $item->secure('string')) ?> - author($item->authors('array')) ?> + authorlinks($item->authors('array')) ?> visitcount() ?> diff --git a/assets/css/home.css b/assets/css/home.css index bfae718..b14f9a1 100644 --- a/assets/css/home.css +++ b/assets/css/home.css @@ -119,6 +119,22 @@ table a.tag { padding: 1px 4px; } +table a.secure{ + padding: 1px 3px; +} + +table a.secure.private { + background-color: #b9b67b; +} + +table a.secure.not_published { + background-color: #b97b7b; +} + +table a.secure.public { + background-color: #80b97b; +} + body { margin: 0; @@ -541,3 +557,5 @@ footer { } + + -- cgit v1.2.3