aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/class/Colors.php37
-rw-r--r--app/class/Controllerhome.php14
-rw-r--r--app/class/Opt.php2
-rw-r--r--app/class/Routes.php1
-rw-r--r--app/view/templates/home.php2
-rw-r--r--app/view/templates/homemenu.php7
6 files changed, 56 insertions, 7 deletions
diff --git a/app/class/Colors.php b/app/class/Colors.php
index ce37d62..bf11229 100644
--- a/app/class/Colors.php
+++ b/app/class/Colors.php
@@ -2,7 +2,7 @@
namespace Wcms;
-class Colors
+class Colors extends Item
{
protected $file = MODEL::CSS_DIR . 'tagcolors.css';
@@ -84,13 +84,42 @@ class Colors
}
}
- public function htmlcolorpicker(array $csstagcolor): string
+ public function htmlcolorpicker(): string
{
$html = '<ul>';
- foreach ($csstagcolor as $tag => $color) {
- $html .= PHP_EOL . '<li><input type="color" name="colors[' . $tag . ']" value="' . $color . '"></li>';
+ foreach ($this->tagcolor as $tag => $color) {
+ $html .= PHP_EOL . '<li><input type="color" name="tagcolor[' . $tag . ']" value="' . $color . '" id="color_' . $tag . '"><label for="color_' . $tag . '" >' . $tag . '</label></li>';
}
$html .= PHP_EOL . '</ul>';
return $html;
}
+
+
+ // ______________________ G E T _________________________
+
+ public function rawcss()
+ {
+ return $this->rawcss;
+ }
+
+ public function tagcolor()
+ {
+ return $this->tagcolor;
+ }
+
+ // _______________________ S E T _________________________
+
+ public function setrawcss($rawcss)
+ {
+ if(is_string($rawcss)) {
+ $this->rawcss = $rawcss;
+ }
+ }
+
+ public function settagcolor($tagcolor)
+ {
+ if(is_array($tagcolor)) {
+ $this->tagcolor = $tagcolor;
+ }
+ }
}
diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php
index 9f8896c..d102930 100644
--- a/app/class/Controllerhome.php
+++ b/app/class/Controllerhome.php
@@ -36,7 +36,7 @@ class Controllerhome extends Controllerpage
$columns = $this->modelhome->setcolumns($this->user->columns());
- $vars = ['user' => $this->user, 'table2' => $table2, 'opt' => $this->opt, 'columns' => $columns, 'faviconlist' => $this->mediamanager->listfavicon(), 'editorlist' => $this->usermanager->getlisterbylevel(2, '>=')];
+ $vars = ['user' => $this->user, 'table2' => $table2, 'opt' => $this->opt, 'columns' => $columns, 'faviconlist' => $this->mediamanager->listfavicon(), 'editorlist' => $this->usermanager->getlisterbylevel(2, '>='), 'colors' => $colors];
$vars['footer'] = ['version' => getversion(), 'total' => count($table), 'database' => Config::pagetable()];
if (isset($_POST['query']) && $this->user->iseditor()) {
@@ -61,6 +61,18 @@ class Controllerhome extends Controllerpage
$this->routedirect('home');
}
+ public function colors()
+ {
+ if (isset($_POST['tagcolor']) && $this->user->issupereditor()) {
+ $colors = new Colors();
+ $colors->hydrate($_POST);
+ $colors->tocss();
+ $colors->writecssfile();
+ }
+ $this->routedirect('home');
+
+ }
+
public function search()
{
if (isset($_POST['id']) && !empty($_POST['id'])) {
diff --git a/app/class/Opt.php b/app/class/Opt.php
index e042aae..a489d5a 100644
--- a/app/class/Opt.php
+++ b/app/class/Opt.php
@@ -130,7 +130,7 @@ class Opt extends Item
{
$authorstring = "";
foreach ($authorlist as $author) {
- $authorstring .= '<a class="tag author_' . $author . '" href="?' . $this->getfilteradress(['authorfilter' => [$author]]) . '" >' . $author . '</a>' . PHP_EOL;
+ $authorstring .= '<a class="author author_' . $author . '" href="?' . $this->getfilteradress(['authorfilter' => [$author]]) . '" >' . $author . '</a>' . PHP_EOL;
}
return $authorstring;
}
diff --git a/app/class/Routes.php b/app/class/Routes.php
index 4a87fc8..c4571d9 100644
--- a/app/class/Routes.php
+++ b/app/class/Routes.php
@@ -20,6 +20,7 @@ class Routes
['GET', '/', 'Controllerhome#desktop', 'home'],
['POST', '/', 'Controllerhome#desktop', 'homequery'],
['POST', '/columns', 'Controllerhome#columns', 'homecolumns'],
+ ['POST', '/colors', 'Controllerhome#colors', 'homecolors'],
['GET', '//renderall', 'Controllerhome#renderall', 'homerenderall'],
['POST', '/bookmark', 'Controllerhome#bookmark', 'homebookmark'],
['POST', '/multi', 'Controllerhome#multi', 'multi'],
diff --git a/app/view/templates/home.php b/app/view/templates/home.php
index 0c1cc86..fa9ef63 100644
--- a/app/view/templates/home.php
+++ b/app/view/templates/home.php
@@ -16,7 +16,7 @@
<?php
$optlist = $optlist ?? null;
- $this->insert('homemenu', ['user' => $user, 'opt' => $opt, 'optlist' => $optlist, 'pagelist' => $pagelist, 'faviconlist' => $faviconlist, 'editorlist' => $editorlist]);
+ $this->insert('homemenu', ['user' => $user, 'opt' => $opt, 'optlist' => $optlist, 'pagelist' => $pagelist, 'faviconlist' => $faviconlist, 'editorlist' => $editorlist, 'colors' => $colors]);
?>
diff --git a/app/view/templates/homemenu.php b/app/view/templates/homemenu.php
index 669f9f2..51a58e9 100644
--- a/app/view/templates/homemenu.php
+++ b/app/view/templates/homemenu.php
@@ -304,6 +304,13 @@
</ul>
<input type="submit" value="update columns">
</form>
+ <?php if($user->issupereditor()) { ?>
+ <h2>Tag colors</h2>
+ <form action="<?= $this->url('homecolors') ?>" method="post">
+ <?= $colors->htmlcolorpicker() ?>
+ <input type="submit" value="update">
+ </form>
+ <?php } ?>
</div>
</details>