aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-08-08 23:02:03 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-08-08 23:02:03 +0200
commitef18c5f848a5e4d1239bdc1d89e0cc9f75a10512 (patch)
tree23b154c9d71e15c75a201822318eaa66dcefc99e /app
parente75e54d23d262940acd4c7df2a8cc7b7ab1751d5 (diff)
downloadwcms-ef18c5f848a5e4d1239bdc1d89e0cc9f75a10512.tar.gz
wcms-ef18c5f848a5e4d1239bdc1d89e0cc9f75a10512.zip
feature : terminal style option
+ bug fix : externallinkblank missing underscore
Diffstat (limited to 'app')
-rw-r--r--app/class/config.php14
-rw-r--r--app/class/controlleradmin.php6
-rw-r--r--app/class/controllerart.php11
-rw-r--r--app/class/modelmedia.php13
-rw-r--r--app/class/modelrender.php4
-rw-r--r--app/view/templates/admin.php57
-rw-r--r--app/view/templates/home.php3
-rw-r--r--app/view/templates/layout.php14
8 files changed, 103 insertions, 19 deletions
diff --git a/app/class/config.php b/app/class/config.php
index dbc6d80..dfeb4d7 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -23,6 +23,7 @@ abstract class Config
protected static $defaultprivacy = 0;
protected static $homepage = 'default';
protected static $homeredirect = null;
+ protected static $interfacecss = null;
// _______________________________________ F U N _______________________________________
@@ -199,6 +200,10 @@ abstract class Config
return self::$homeredirect;
}
+ public static function interfacecss()
+ {
+ return self::$interfacecss;
+ }
// __________________________________________ S E T ______________________________________
@@ -332,6 +337,15 @@ abstract class Config
self::$homeredirect = null;
}
}
+
+ public static function setinterfacecss($interfacecss)
+ {
+ if(is_string($interfacecss) && file_exists(Model::CSS_DIR . $interfacecss)) {
+ self::$interfacecss = $interfacecss;
+ } else {
+ self::$interfacecss = null;
+ }
+ }
diff --git a/app/class/controlleradmin.php b/app/class/controlleradmin.php
index 03fcb22..2101414 100644
--- a/app/class/controlleradmin.php
+++ b/app/class/controlleradmin.php
@@ -3,7 +3,10 @@
class Controlleradmin extends Controller
{
+ /** @var Modelart $artmanager */
protected $artmanager;
+
+ /** @var Modelmedia $mediamanager */
protected $mediamanager;
public function desktop()
@@ -13,6 +16,7 @@ class Controlleradmin extends Controller
$artlist = $this->artmanager->list();
$this->mediamanager = new Modelmedia();
$faviconlist = $this->mediamanager->listfavicon();
+ $interfacecsslist = $this->mediamanager->listinterfacecss();
if(in_array(Config::defaultart(), $artlist)) {
$defaultartexist = true;
} else {
@@ -27,7 +31,7 @@ class Controlleradmin extends Controller
$globalcss = "";
}
- $admin = ['artlist' => $artlist, 'defaultartexist' => $defaultartexist, 'globalcss' => $globalcss, 'faviconlist' => $faviconlist];
+ $admin = ['artlist' => $artlist, 'defaultartexist' => $defaultartexist, 'globalcss' => $globalcss, 'faviconlist' => $faviconlist, 'interfacecsslist' => $interfacecsslist];
$this->showtemplate('admin', $admin);
} else {
$this->routedirect('home');
diff --git a/app/class/controllerart.php b/app/class/controllerart.php
index f8155ea..027fc19 100644
--- a/app/class/controllerart.php
+++ b/app/class/controllerart.php
@@ -248,14 +248,21 @@ class Controllerart extends Controller
{
$art = $this->artmanager->getfromfile();
+
if(!empty($_POST['id'])) {
$art->setid(idclean($_POST['id']));
}
-
+
if($_POST['datecreation']) {
$art->setdatecreation($this->now);
}
-
+
+ if($_POST['author']) {
+ $art->setauthors([$this->user->id()]);
+ }
+
+ $art->setdaterender($art->datecreation('date'));
+
if($art !== false) {
if($_POST['erase'] || $this->artmanager->get($art) === false) {
$this->artmanager->add($art);
diff --git a/app/class/modelmedia.php b/app/class/modelmedia.php
index a30e902..209fc85 100644
--- a/app/class/modelmedia.php
+++ b/app/class/modelmedia.php
@@ -143,6 +143,19 @@ class Modelmedia extends Model
}
+ public function listinterfacecss()
+ {
+ $glob = Model::CSS_DIR . '*.css';
+ $listinterfacecss = glob($glob);
+ $count = strlen(Model::CSS_DIR);
+ $listinterfacecss = array_map(function ($input) use ($count) {
+ return substr($input, $count);
+ }, $listinterfacecss);
+ $listinterfacecss = array_diff($listinterfacecss, ['edit.css', 'home.css']);
+ return $listinterfacecss;
+ }
+
+
public function listdir($dir)
{
diff --git a/app/class/modelrender.php b/app/class/modelrender.php
index 2d3daf1..cc3b753 100644
--- a/app/class/modelrender.php
+++ b/app/class/modelrender.php
@@ -23,11 +23,11 @@ class Modelrender extends Modelart
$this->artlist = $this->getlister();
if(Config::internallinkblank()) {
- $this->internallinkblank = ' target="blank" ';
+ $this->internallinkblank = ' target="_blank" ';
}
if(Config::externallinkblank()) {
- $this->externallinkblank = ' target="blank" ';
+ $this->externallinkblank = ' target="_blank" ';
}
}
diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php
index 3eba1c4..c1d7ff4 100644
--- a/app/view/templates/admin.php
+++ b/app/view/templates/admin.php
@@ -158,6 +158,10 @@
</article>
+
+
+
+
<article>
<h2>CSS</h2>
@@ -166,19 +170,48 @@
<textarea name="globalcss" id="globalcss" cols="30" rows="10"><?= $globalcss ?></textarea>
<label for="defaultfavicon">Default favicon</label>
- <select name="defaultfavicon" id="defaultfavicon">
- <option value="">--no favicon--</option>
- <?php
- foreach ($faviconlist as $favicon) {
- ?>
- <option value="<?= $favicon ?>" <?= Config::defaultfavicon() === $favicon ? 'selected' : '' ?>><?= $favicon ?></option>
- <?php
- }
- ?>
- </select>
+ <select name="defaultfavicon" id="defaultfavicon">
+ <option value="">--no favicon--</option>
+ <?php
+ foreach ($faviconlist as $favicon) {
+ ?>
+ <option value="<?= $favicon ?>" <?= Config::defaultfavicon() === $favicon ? 'selected' : '' ?>><?= $favicon ?></option>
+ <?php
+ }
+ ?>
+ </select>
+
+ </article>
+
+
+
+
+
+
+
+ <article>
+
+ <h2>Interface</h2>
+
+ <p>Set interface Style</p>
+
+ <select name="interfacecss" id="interfacecss">
+ <option value="null">--default interface style---</option>
+ <?php
+ foreach ($interfacecsslist as $interfacecss) {
+ ?>
+ <option value="<?= $interfacecss ?>" <?= $interfacecss === Config::interfacecss() ? 'selected' : '' ?>><?= $interfacecss ?></option>
+ <?php
+ }
+ ?>
+ </select>
</article>
+
+
+
+
<article>
<h2>Tracking</h2>
@@ -190,6 +223,10 @@
</article>
+
+
+
+
<article>
<input type="submit" value="Update configuration">
</article>
diff --git a/app/view/templates/home.php b/app/view/templates/home.php
index 17dfc2d..e41c2cc 100644
--- a/app/view/templates/home.php
+++ b/app/view/templates/home.php
@@ -43,6 +43,9 @@
<input type="checkbox" name="datecreation" id="datecreation" value="1">
<label for="datecreation">Reset date creation as now</label>
</br>
+ <input type="checkbox" name="author" id="author" value="1">
+ <label for="author">Reset author(s) as just you</label>
+ </br>
<input type="checkbox" name="erase" id="erase" value="1">
<label for="erase">Replace if already existing</label>
</br>
diff --git a/app/view/templates/layout.php b/app/view/templates/layout.php
index b054791..3c38be4 100644
--- a/app/view/templates/layout.php
+++ b/app/view/templates/layout.php
@@ -1,17 +1,23 @@
<!DOCTYPE html>
<html>
+
<head>
<meta charset="utf8" />
-
+
<meta name="viewport" content="width=device-width" />
- <?php if(!empty($favicon)) {
+ <?php if (!empty($favicon)) {
?>
<link rel="shortcut icon" href="<?= Model::faviconpath() . $favicon ?>" type="image/x-icon">
- <?php } elseif(!empty(Config::defaultfavicon())) { ?>
+ <?php } elseif (!empty(Config::defaultfavicon())) { ?>
<link rel="shortcut icon" href="<?= Model::faviconpath() . Config::defaultfavicon() ?>" type="image/x-icon">
<?php } ?>
<title><?= $title ?></title>
<link rel="stylesheet" href="<?= $css ?>">
+ <?php
+ if (!empty(Config::interfacecss())) {
+ echo '<link rel="stylesheet" href="' . Model::csspath() . Config::interfacecss() . '">';
+ }
+ ?>
<script>
// global js vars
const basepath = '/<?= Config::basepath() ?>/';
@@ -21,7 +27,7 @@
-<?=$this->section('page')?>
+<?= $this->section('page') ?>
</html> \ No newline at end of file