aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/css/soft.css171
-rw-r--r--public/test.php24
-rw-r--r--public/test3.php10
-rw-r--r--w/class/art2.php14
-rw-r--r--w/class/controllerart.php18
-rw-r--r--w/class/modelart.php222
-rw-r--r--w/class/modeldb.php5
-rw-r--r--w/class/modelrender.php67
-rw-r--r--w/view/templates/edit.php27
-rw-r--r--w/view/templates/editleftbar.php (renamed from w/view/templates/editsidebar.php)34
-rw-r--r--w/view/templates/editrightbar.php20
-rw-r--r--w/view/templates/edittabs.php2
-rw-r--r--w/view/templates/edittopbar.php26
-rw-r--r--w/w.index.php8
14 files changed, 333 insertions, 315 deletions
diff --git a/public/css/soft.css b/public/css/soft.css
index 108f44e..ff65635 100644
--- a/public/css/soft.css
+++ b/public/css/soft.css
@@ -7,7 +7,176 @@ div#main {
display: inline-block;
}
+body {
+ margin: 0;
+ height: 100%;
+ background-color: #b1b1b1;
+}
+
.menu {
position: fixed;
right: 0;
-} \ No newline at end of file
+}
+
+.editor div#leftbar {
+ position: relative;
+ height: 100%;
+}
+
+.editor .tabs {
+ flex: 2;
+ position: relative;
+ height: 100%;
+}
+
+
+
+.editor #leftbarpanel, .editor #rightbarpanel {
+ width: 250px;
+ display: none;
+ height: 100%;
+ overflow-y: auto;
+}
+
+.editor #showleftpanel:checked ~ #leftbarpanel {
+ display: block;
+ overflow-y: auto;
+ height: 100%;
+}
+
+.editor #showrightpanel:checked ~ #rightbarpanel {
+ display: block;
+}
+
+.editor input.toggle {
+ display: none;
+}
+
+.editor label.toogle:hover {
+ color: white;
+ cursor: pointer;
+ background-color: #e2e2e2;
+}
+
+.editor label.toogle {
+ height: 100%;
+ line-height: 100%;
+ text-align: center;
+}
+
+.editor #leftbar label.toogle {
+ float: right;
+}
+
+.editor #rightbar label.toogle {
+ float: left;
+}
+
+
+#rightbarpanel {
+ display: none;
+ width: 250px;
+}
+#rightbar:target #rightbarpanel {
+ display: inline-block;
+ overflow-y: scroll;
+ height: 100%;
+}
+#rightbar:target #open {
+ display: none;
+}
+
+
+
+
+
+
+.editor #workspace {
+ display: flex;
+ height: calc(100% - 30px);
+ position: relative;
+}
+
+
+.tabs .tab
+{
+ float: left;
+}
+
+.tabs .tab .content
+{
+ position: absolute;
+ background-color: #dc8ad2;
+ left: 0px;
+ width: 100%;
+ height: calc(100% - 30px);
+}
+
+.checkboxtab
+{
+ display: none;
+}
+
+.tab label
+{
+ margin-right: 10px;
+ border: outset;
+ background-color: var(--color1);
+}
+
+.checkboxtab:checked ~ label
+{
+ border: inset;
+}
+
+.checkboxtab:checked ~ .content
+{
+ z-index: 1;
+}
+
+
+
+section.editor {
+ position: fixed;
+ width: 100%;
+ height: 100%;
+}
+
+
+html {
+ height: 100%;
+}
+
+.tabs textarea {height: 100%;width: 100%;border: none;resize: none;}
+
+* {
+ box-sizing: border-box;
+}
+
+.editor .tabs label {
+ line-height: 30px;
+}
+
+.editor #topbar {
+ line-height: 30px;
+}
+
+.editor ul {
+ list-style: none;
+ padding: 0;
+}
+
+.editor #leftbar select {
+ width: 100%;
+}
+
+.editor .panel input {
+ width: 100%;
+}
+
+
+.editor a {color: black;text-decoration: none;}
+
+.editor a:hover {
+ color: white;
+}
diff --git a/public/test.php b/public/test.php
index 7e24cd6..50ff4b1 100644
--- a/public/test.php
+++ b/public/test.php
@@ -18,33 +18,9 @@ $art = new Art2(['id' => 'rr']);
$art->reset();
$art->hydrate((['description' => 'fdsfs', 'secure' => 0, 'render' => $render2]));
-var_dump($art);
-$artencoded = json_encode($art);
-var_dump($artencoded);
-class Person
-{
- public $id;
- public $name;
- public $table = ['coucou', 'lol', 'chouette'];
- public $date;
-
- public function __construct(array $data)
- {
- $this->id = $data['id'];
- $this->name = $data['name'];
- $this->date = new DateTimeImmutable();
- }
-}
-
-$person = new Person(array('id' => 1, 'name' => 'Amir'));
-$jsonperson = json_encode($person);
-
-var_dump($jsonperson);
-
-var_dump(json_decode($jsonperson));
diff --git a/public/test3.php b/public/test3.php
index 327e2dd..571732b 100644
--- a/public/test3.php
+++ b/public/test3.php
@@ -1,15 +1,5 @@
<?php
-$path = '../w/class/';
-$lengh = strlen($path);
-$array = [];
-foreach (glob($path . '*.php') as $filename) {
- $array[] = substr(substr($filename, $lengh), 0, -4);
-}
-
-var_dump($array);
-
-
diff --git a/w/class/art2.php b/w/class/art2.php
index 970058b..867b17a 100644
--- a/w/class/art2.php
+++ b/w/class/art2.php
@@ -555,11 +555,21 @@ class Art2
public function settemplate($template)
{
if (is_string($template)) {
- $template = json_decode($template, true);
+ $templatearray = json_decode($template, true);
}
if (is_array($template)) {
- $this->template = $template;
+ $templatearray = $template;
}
+ if(is_object($template)) {
+ $templatearray = (array) $template;
+ }
+ $this->template = array_map(function ($value) {
+ if(empty($value)) {
+ return null;
+ } else {
+ return $value;
+ }
+ }, $templatearray);
}
public function setaffcount($affcount)
diff --git a/w/class/controllerart.php b/w/class/controllerart.php
index ef65f48..33bd93f 100644
--- a/w/class/controllerart.php
+++ b/w/class/controllerart.php
@@ -75,7 +75,20 @@ class Controllerart extends Controllerdb
public function edit()
{
if ($this->importart() && $this->user->canedit()) {
- $this->showtemplate('edit', ['art' => $this->art, 'artexist' => true]);
+ $tablist = ['section' => $this->art->md(), 'css' => $this->art->css(), 'header' => $this->art->header(), 'nav' => $this->art->nav(), 'aside' => $this->art->aside(), 'footer' => $this->art->footer(), 'html' => $this->art->html(), 'javascript' => $this->art->javascript()];
+
+ $artlist = $this->artmanager->list();
+
+ if(isset($_SESSION['workspace'])) {
+ $showleftpanel = $_SESSION['workspace']['showleftpanel'];
+ $showrightpanel = $_SESSION['workspace']['showrightpanel'];
+ } else {
+ $showleftpanel = false;
+ $showrightpanel = false;
+ }
+
+
+ $this->showtemplate('edit', ['art' => $this->art, 'artexist' => true, 'tablist' => $tablist, 'artlist' => $artlist, 'showleftpanel' => $showleftpanel, 'showrightpanel' => $showrightpanel]);
} else {
$this->redirect('?id=' . $this->art->id());
}
@@ -112,7 +125,8 @@ class Controllerart extends Controllerdb
public function update()
{
-
+ $_SESSION['workspace']['showrightpanel'] = isset($_POST['workspace']['showrightpanel']);
+ $_SESSION['workspace']['showleftpanel'] = isset($_POST['workspace']['showleftpanel']);
if ($this->importart() && $this->user->canedit()) {
$this->art->hydrate($_POST);
diff --git a/w/class/modelart.php b/w/class/modelart.php
index 37262ad..ef4d61d 100644
--- a/w/class/modelart.php
+++ b/w/class/modelart.php
@@ -34,14 +34,18 @@ class Modelart extends Modeldb
$this->artstore->store($artdata);
}
- public function get($art)
+ public function get($id)
{
- if($art instanceof Art2) {
- $id = $art->id();
+ if($id instanceof Art2) {
+ $id = $id->id();
}
- $artdata = $this->artstore->findById($id);
- if($artdata !== false) {
- return new Art2($artdata);
+ if(is_string($id)) {
+ $artdata = $this->artstore->findById($id);
+ if($artdata !== false) {
+ return new Art2($artdata);
+ } else {
+ return false;
+ }
} else {
return false;
}
@@ -59,205 +63,6 @@ class Modelart extends Modeldb
$this->artstore->store($artdata);
}
-
- public function exist3($id)
- {
-
- $req = $this->bdd->prepare(' SELECT COUNT(*) FROM ' . Config::arttable() . ' WHERE id = :id ');
- $req->execute(array('id' => $id));
- $donnees = $req->fetch(PDO::FETCH_ASSOC);
-
- return (bool)$donnees['COUNT(*)'];
- }
-
- public function add3(Art2 $art)
- {
-
- if ($this->exist($art->id())) {
- echo '<span class="alert">idalreadyexist</span>';
- } else {
-
- $now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
-
- $table = Config::arttable();
- $request = "INSERT INTO $table (id, title, description, tag, date, datecreation, datemodif, daterender, css, quickcss, javascript, html, header, section, nav, aside, footer, render, secure, invitepassword, interface, linkfrom, linkto, template, affcount, editcount)
- VALUES(:id, :title, :description, :tag, :date, :datecreation, :datemodif, :daterender, :css, :quickcss, :javascript, :html, :header, :section, :nav, :aside, :footer, :render, :secure, :invitepassword, :interface, :linkfrom, :linkto, :template, :affcount, :editcount)";
-
- $q = $this->bdd->prepare($request);
-
- $q->bindValue(':id', $art->id());
- $q->bindValue(':title', $art->title());
- $q->bindValue(':description', $art->description());
- $q->bindValue(':tag', $art->tag('string'));
- $q->bindValue(':date', $now->format('Y-m-d H:i:s'));
- $q->bindValue(':datecreation', $now->format('Y-m-d H:i:s'));
- $q->bindValue(':datemodif', $now->format('Y-m-d H:i:s'));
- $q->bindValue(':daterender', $now->format('Y-m-d H:i:s'));
- $q->bindValue(':css', $art->css());
- $q->bindValue(':quickcss', $art->quickcss('json'));
- $q->bindValue(':javascript', $art->javascript());
- $q->bindValue(':html', $art->html());
- $q->bindValue(':header', $art->header());
- $q->bindValue(':section', $art->md());
- $q->bindValue(':nav', $art->nav());
- $q->bindValue(':aside', $art->aside());
- $q->bindValue(':footer', $art->footer());
- $q->bindValue(':render', $art->render());
- $q->bindValue(':secure', $art->secure());
- $q->bindValue(':invitepassword', $art->invitepassword());
- $q->bindValue(':interface', $art->interface());
- $q->bindValue(':linkfrom', $art->linkfrom('json'));
- $q->bindValue(':linkto', $art->linkto('json'));
- $q->bindValue(':template', $art->template('json'));
- $q->bindValue(':affcount', $art->affcount());
- $q->bindValue(':editcount', $art->editcount());
-
- $q->execute();
- }
- }
-
-
- public function delete3(Art2 $art)
- {
- $req = $this->bdd->prepare('DELETE FROM ' . Config::arttable() . ' WHERE id = :id ');
- $req->execute(array('id' => $art->id()));
- $req->closeCursor();
- }
-
- public function get3(Art2 $art)
- {
-
- $req = $this->bdd->prepare('SELECT * FROM ' . Config::arttable() . ' WHERE id = :id ');
- $req->execute(array('id' => $art->id()));
- $donnees = $req->fetch(PDO::FETCH_ASSOC);
-
- return new Art2($donnees);
-
- $req->closeCursor();
-
- }
-
-
-
-
- public function update3(Art2 $art)
- {
- $now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
-
- //$request = 'UPDATE ' . $this->arttable . '(id, title, description, tag, date, datecreation, datemodif, daterender, css, quickcss, javascript, html, header, section, nav, aside, footer, render, secure, invitepassword, interface, linkfrom, template, affcount, editcount) VALUES(:id, :title, :description, :tag, :date, :datecreation, :datemodif, :daterender, :css, :quickcss, :javascript, :html, :header, :section, :nav, :aside, :footer, :render, :secure, :invitepassword, :interface, :linkfrom, :template, :affcount, :editcount) WHERE id = :id';
- $table = Config::arttable();
- $request = "UPDATE $table SET id = :id, title = :title, description = :description, tag = :tag, date = :date, datecreation = :datecreation, datemodif = :datemodif, daterender = :daterender, css = :css, quickcss = :quickcss, javascript = :javascript, html = :html, header = :header, section = :section, nav = :nav, aside = :aside, footer = :footer, render = :footer, secure = :secure, invitepassword = :invitepassword, interface = :interface, linkfrom = :linkfrom, linkto = :linkto, template = :template, affcount = :affcount, editcount = :editcount WHERE id = :id";
-
- $q = $this->bdd->prepare($request);
-
- $q->bindValue(':id', $art->id());
- $q->bindValue(':title', $art->title());
- $q->bindValue(':description', $art->description());
- $q->bindValue(':tag', $art->tag('string'));
- $q->bindValue(':date', $art->date('string'));
- $q->bindValue(':datecreation', $art->datecreation('string'));
- $q->bindValue(':datemodif', $now->format('Y-m-d H:i:s'));
- $q->bindValue(':daterender', $art->daterender('string'));
- $q->bindValue(':css', $art->css());
- $q->bindValue(':quickcss', $art->quickcss('json'));
- $q->bindValue(':javascript', $art->javascript());
- $q->bindValue(':html', $art->html());
- $q->bindValue(':header', $art->header());
- $q->bindValue(':section', $art->md());
- $q->bindValue(':nav', $art->nav());
- $q->bindValue(':aside', $art->aside());
- $q->bindValue(':footer', $art->footer());
- $q->bindValue(':render', $art->render());
- $q->bindValue(':secure', $art->secure());
- $q->bindValue(':invitepassword', $art->invitepassword());
- $q->bindValue(':interface', $art->interface());
- $q->bindValue(':linkfrom', $art->linkfrom('json'));
- $q->bindValue(':linkto', $art->linkto('json'));
- $q->bindValue(':template', $art->template('json'));
- $q->bindValue(':affcount', $art->affcount());
- $q->bindValue(':editcount', $art->editcount());
-
- $q->execute();
- }
-
-
-
-
- public function getlister3(array $selection = ['id'], array $opt = [])
- {
- // give an array using SELECTION columns and sort and desc OPTIONS
-
- $default = ['tri' => 'id', 'desc' => 'DESC'];
- $opt = array_update($default, $opt);
-
- $list = [];
- $option = ['datecreation', 'title', 'id', 'description', 'datemodif', 'tag', 'secure'];
- if (is_array($selection) && is_string($opt['tri']) && strlen($opt['tri']) < 16 && is_string($opt['desc']) && strlen($opt['desc']) < 5 && in_array($opt['tri'], $option)) {
-
- $selection = implode(", ", $selection);
-
-
- $select = 'SELECT ' . $selection . ' FROM ' . Config::arttable() . ' ORDER BY ' . $opt['tri'] . ' ' . $opt['desc'];
- $req = $this->bdd->query($select);
- while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) {
- $list[] = new Art2($donnees);
- }
- return $list;
- }
- }
-
-
-
- public function getlisterwhere3(array $select = ['id'], array $whereid = [], $by = 'id', $order = 'DESC')
- {
- // give an array using SELECTION columns and sort and desc OPTIONS
-
-
- $select = array_intersect(array_unique($select), self::SELECT);
- if (empty($select)) {
- $select = ' * ';
- } else {
- $select = implode(", ", $select);
- }
-
-
- $whereid = array_unique($whereid);
-
- $list = [];
-
- if (!in_array($by, self::BY)) {
- $by = 'id';
- }
- if (!in_array($order, self::ORDER)) {
- $order = 'DESC';
- }
-
-
- if (!empty($whereid)) {
- $wherestatements = array_map(function ($element) {
- return ' id= ?';
- }, $whereid);
- $where = 'WHERE ' . implode(' OR ', $wherestatements);
- } else {
- $where = '';
- }
-
- $table = Config::arttable();
- $prepare = "SELECT $select FROM $table $where ORDER BY $by $order";
- $req = $this->bdd->prepare($prepare);
- $req->execute($whereid);
- while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) {
- $list[] = new Art2($donnees);
- }
-
- return $list;
- }
-
-
-
-
-
-
public function getlisteropt(Opt $opt)
{
@@ -272,13 +77,6 @@ class Modelart extends Modeldb
}
- public function listcalclinkfrom(&$artlist)
- {
- foreach ($artlist as $art) {
- $art->calclinkto($artlist);
- }
- }
-
public function artcompare($art1, $art2, $method = 'id', $order = 1)
{
$result = ($art1->$method('sort') <=> $art2->$method('sort'));
diff --git a/w/class/modeldb.php b/w/class/modeldb.php
index 0d4e630..a5ebf6f 100644
--- a/w/class/modeldb.php
+++ b/w/class/modeldb.php
@@ -31,6 +31,11 @@ class Modeldb extends Model
return $artlist;
}
+ public function list()
+ {
+ return $this->artstore->getAllIds();
+ }
+
public function getlisterid(array $idlist = [])
{
$artdatalist = $this->artstore->query()
diff --git a/w/class/modelrender.php b/w/class/modelrender.php
index 963962b..53d1aca 100644
--- a/w/class/modelrender.php
+++ b/w/class/modelrender.php
@@ -20,31 +20,49 @@ class Modelrender extends Modelart
public function renderbody(Art2 $art)
{
- $body = $this->getbody($art);
+ $body = $this->getbody($this->gethtml($art), $this->getelements($art));
$parsebody = $this->parser($art, $body);
return $parsebody;
}
- public function getbody(Art2 $art)
+ public function getelements(Art2 $art)
{
- $body = '';
+ $elements = [];
foreach (self::TEXT_ELEMENTS as $element) {
- if (array_key_exists($element, $art->template('array'))) {
- $tempalteart = $this->get($art->template('array')[$element]);
+ if (isset($art->template('array')[$element])) {
+ $templateid = $art->template('array')[$element];
+ $tempalteart = $this->get($templateid);
$text = $tempalteart->$element() . PHP_EOL . $art->$element();
} else {
$text = $art->$element();
}
- if ($element == 'section') {
- $body .= PHP_EOL . '<' . $element . '><article>' . PHP_EOL . $this->markdown($text) . PHP_EOL . '</article></' . $element . '>' . PHP_EOL;
- } else {
- $body .= PHP_EOL . '<' . $element . '>' . PHP_EOL . $this->markdown($text) . PHP_EOL . '</' . $element . '>' . PHP_EOL;
- }
+ $elements[$element] = PHP_EOL . '<' . $element . '>' . PHP_EOL . $this->markdown($text) . PHP_EOL . '</' . $element . '>' . PHP_EOL;
+
}
- return $body;
+ return $elements;
+ }
+
+ public function gethtml(Art2 $art)
+ {
+ if (isset($art->template('array')['html'])) {
+ $templateid = $art->template('array')['html'];
+ $tempalteart = $this->get($templateid);
+ $html = $tempalteart->html() . PHP_EOL . $art->html();
+ } else {
+ $html = $art->html();
+ }
+ return $html;
+ }
+
+ public function getbody(string $html, array $elements)
+ {
+ $html = preg_replace_callback('~\%(SECTION|ASIDE|NAV|HEADER|FOOTER)\%~', function ($match) use ($elements) {
+ return $elements[strtolower($match[1])];
+ }, $html);
+ return $html;
}
public function write(Art2 $art)
@@ -81,22 +99,22 @@ class Modelrender extends Modelart
$head .= '<meta name="description" content="'.$art->description() .'" />' . PHP_EOL;
$head .= '<meta name="viewport" content="width=device-width" />' . PHP_EOL;
-
- if (array_key_exists('css', $art->template('array'))) {
- $tempaltecssart = $art->template('array')['css'];
- $head .= '<link href="' . Config::renderpath() . $tempaltecssart . '.css" rel="stylesheet" />' . PHP_EOL;
- }
- $head .= '<link href="' . Config::renderpath() . $art->id() . '.css" rel="stylesheet" />' . PHP_EOL;
- if (array_key_exists('quickcss', $art->template('array'))) {
+ if (isset($art->template('array')['quickcss'])) {
$tempaltequickcssart = $art->template('array')['quickcss'];
$head .= '<link href="' . Config::renderpath() . $tempaltequickcssart . '.quick.css" rel="stylesheet" />' . PHP_EOL;
}
$head .= '<link href="' . Config::renderpath() . $art->id() . '.quick.css" rel="stylesheet" />' . PHP_EOL;
- if (array_key_exists('javascript', $art->template('array'))) {
+ if (isset($art->template('array')['css'])) {
+ $tempaltecssart = $art->template('array')['css'];
+ $head .= '<link href="' . Config::renderpath() . $tempaltecssart . '.css" rel="stylesheet" />' . PHP_EOL;
+ }
+ $head .= '<link href="' . Config::renderpath() . $art->id() . '.css" rel="stylesheet" />' . PHP_EOL;
+
+ if (isset($art->template('array')['javascript'])) {
$templatejsart = $art->template('array')['javascript'];
- $head .= '<script src="' . Config::renderpath() . $templatejsart . '.js" /></script>' . PHP_EOL;
+ $head .= '<script src="' . Config::renderpath() . $templatejsart . '.js" async/></script>' . PHP_EOL;
}
- $head .= '<script src="' . Config::renderpath() . $art->id() . '.js" /></script>' . PHP_EOL;
+ $head .= '<script src="' . Config::renderpath() . $art->id() . '.js" async/></script>' . PHP_EOL;
return $head;
}
@@ -167,11 +185,10 @@ public function tooltip(array $linkfrom, string $text)
foreach ($linkfrom as $id) {
if (isset($descriptions[$id])) {
- $title = $descriptions[$id];
+ $linkfrom = 'href="?id=' . $id . '"';
+ $titlelinkfrom = ' title="' . $descriptions[$id] . '" ' . $linkfrom;
+ $text = str_replace($linkfrom, $titlelinkfrom, $text);
}
- $linkfrom = 'href="?id=' . $id . '"';
- $titlelinkfrom = ' title="' . $title . '" ' . $linkfrom;
- $text = str_replace($linkfrom, $titlelinkfrom, $text);
}
return $text;
}
diff --git a/w/view/templates/edit.php b/w/view/templates/edit.php
index ee231cd..33d42f4 100644
--- a/w/view/templates/edit.php
+++ b/w/view/templates/edit.php
@@ -3,42 +3,33 @@
-
-<?php $this->start('customhead') ?>
- <script src="./rsc/js/app.js"></script>
-<?php $this->stop() ?>
-
-
-
-
-
-
<?php $this->start('page') ?>
+<style>.tabs textarea{font-size: <?= Config::fontsize() ?>px}</style>
+
<body>
+<section class="editor">
<?php $this->insert('navart', ['user' => $user, 'art' => $art, 'artexist' => $artexist]) ?>
<?php $this->insert('edittopbar', ['art' => $art]) ?>
- <?php $this->insert('editsidebar', ['art' => $art]) ?>
-
-<style>textarea{font-size: <?= Config::fontsize() ?>px}</style>
+ <div id="workspace">
- <?php
- $tablist = ['section' => $art->md(), 'css' => $art->css(), 'header' => $art->header(), 'nav' => $art->nav(), 'aside' => $art->aside(), 'footer' => $art->footer(), 'html' => $art->html(), 'javascript' => $art->javascript()];
- $this->insert('edittabs', ['tablist' => $tablist, 'opentab' => $art->interface()])
- ?>
+ <?php $this->insert('editleftbar', ['art' => $art, 'tablist' => $tablist, 'artlist' => $artlist, 'showleftpanel' => $showleftpanel]) ?>
+ <?php $this->insert('edittabs', ['tablist' => $tablist, 'opentab' => $art->interface()]) ?>
+ <?php $this->insert('editrightbar', ['art' => $art, 'artlist' => $artlist, 'showrightpanel' => $showrightpanel]) ?>
-
+ </div>
<input type="hidden" name="id" value="<?= $art->id() ?>">
</form>
+</section>
</body>
<?php $this->stop() ?> \ No newline at end of file
diff --git a/w/view/templates/editsidebar.php b/w/view/templates/editleftbar.php
index 99612dd..7533599 100644
--- a/w/view/templates/editsidebar.php
+++ b/w/view/templates/editleftbar.php
@@ -1,4 +1,7 @@
-<div class="sidebar">
+<div id="leftbar">
+ <input id="showleftpanel" name="workspace[showleftpanel]" value="1" class="toggle" type="checkbox" <?= $showleftpanel == true ? 'checked' : '' ?>>
+ <label for="showleftpanel" class="toogle">◧</label>
+ <div id="leftbarpanel" class="panel">
<details id="editinfo" open>
<summary>Infos</summary>
<fieldset>
@@ -21,7 +24,33 @@
<summary>Advanced</summary>
<fieldset>
<h3>Template options</h3>
- <p>NOT WORKING</p>
+ <ul>
+ <?php
+ foreach ($tablist as $element => $value) {
+ if(isset($art->template()[$element])) {
+ $template = $art->template()[$element];
+ } else {
+ $template = '';
+ }
+ echo '<li>';
+ echo '<label for="'.$element.'template">'.$element.'</label>';
+ echo '<select name="template['.$element.']" id="'.$element.'template">';
+ ?>
+ <option value="" <?= $template === '' ? 'selected' : '' ?>>--no template--</option>
+ <?php
+ foreach ($artlist as $artid ) {
+
+ ?>
+ <option value="<?= $artid ?>" <?= $template === $artid ? 'selected' : '' ?>><?= $artid ?></option>
+ <?php
+ }
+ echo '</select>';
+ echo '</li>';
+ }
+
+
+ ?>
+ </ul>
</fieldset>
</details>
<details id="editcss" open>
@@ -36,5 +65,6 @@
</div>
</details>
+ </div>
</div> \ No newline at end of file
diff --git a/w/view/templates/editrightbar.php b/w/view/templates/editrightbar.php
new file mode 100644
index 0000000..92d5f81
--- /dev/null
+++ b/w/view/templates/editrightbar.php
@@ -0,0 +1,20 @@
+<div id="rightbar">
+ <input id="showrightpanel" name="workspace[showrightpanel]" value="1" class="toggle" type="checkbox" <?= $showrightpanel == true ? 'checked' : '' ?>>
+ <label for="showrightpanel" class="toogle">◧</label>
+ <div id="rightbarpanel" class="panel">
+ <details id="linkassist" open>
+ <summary>Links</summary>
+ <?php
+ foreach ($artlist as $item ) {
+ ?>
+ <a href="?id=<?= $item ?>&aff=edit"><?= $item ?></a>
+ <input type="text" value="[<?= $item ?>](=<?= $item ?>)">
+ <?php
+ }
+
+ ?>
+ </details>
+
+ </div>
+
+</div> \ No newline at end of file
diff --git a/w/view/templates/edittabs.php b/w/view/templates/edittabs.php
index c65a7c7..efb1650 100644
--- a/w/view/templates/edittabs.php
+++ b/w/view/templates/edittabs.php
@@ -10,7 +10,7 @@ foreach ($tablist as $key => $value) {
}
echo '<label for="tab' . $key . '">' . $key . '</label>';
echo '<div class="content">';
- echo '<textarea name="' . $key . '" id="' . $key . '" >' . $value . '</textarea>';
+ echo '<textarea name="' . $key . '" id="' . $key . '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">' . $value . '</textarea>';
echo '</div>';
echo '</div>';
}
diff --git a/w/view/templates/edittopbar.php b/w/view/templates/edittopbar.php
index 9973335..20c2d8b 100644
--- a/w/view/templates/edittopbar.php
+++ b/w/view/templates/edittopbar.php
@@ -1,23 +1,29 @@
-<div id="submit">
- <!-- <input type="submit" name="action" value="home" accesskey="w" onclick="document.getElementById('artedit').submit();" form="artedit"> -->
+<div id="topbar">
+ <form id="delete" action="./" method="get">
+ <input type="hidden" name="id" value="<?= $art->id() ?>">
+ </form>
+
+ <form action="?id=<?= $art->id() ?>&action=update" method="post" id="update">
+
+ <span>
<input type="submit" name="action" value="update" accesskey="x" form="update">
- <!-- <input type="submit" name="action" value="display" accesskey="c" onclick="document.getElementById('artedit').submit();" form="artedit"> -->
-
+ </span>
- <form id="delete" action="./" method="get">
- <input type="hidden" name="id" value="<?= $art->id() ?>">
- <input type="submit" name="action" value="delete" form="delete">
- </form>
+ <span>
+ <input type="submit" name="action" value="delete" form="delete">
+ </span>
+ <span>
<a href="?id=<?= $art->id() ?>" target="_blank">👁</a>
<a href="?id=<?= $art->id() ?>&aff=log" target="_blank">¶</a>
+ </span>
<span id="headid"><?= $art->id() ?></span>
-
- <form action="?id=<?= $art->id() ?>&action=update" method="post" id="update">
+<span>
<label for="fontsize">Font-size</label>
<input type="number" name="fontsize" value="<?= Config::fontsize() ?>" id="fontsize">
+</span>
</div> \ No newline at end of file
diff --git a/w/w.index.php b/w/w.index.php
index 8b59228..d247c84 100644
--- a/w/w.index.php
+++ b/w/w.index.php
@@ -24,14 +24,6 @@ require(__DIR__.'/../vendor/autoload.php');
spl_autoload_register('class_autoloader');
-
-
-//$text = 'blabla il fait un temps vraiment [dégeu](=degeulasse) parce quil pleut [baucoup](?id=orthographe), en amazonie la [vie](?id=prout) et la [mort](?id=prout) sont des notions très proches.';
-
-//$artmanager = new Modelart;
-
-// var_dump($artmanager->getlisterwhere(['id', 'description'], ['55', '44', 'lol']));
-
try {
$router = new Router;