summaryrefslogtreecommitdiffstats
path: root/custom
diff options
context:
space:
mode:
authorRomain d'Alverny <rdalverny@gmail.com>2022-01-15 16:41:25 +0100
committerRomain d'Alverny <rdalverny@gmail.com>2022-01-15 16:41:25 +0100
commitfda57f3b7c52ea9747e8c132c4571772ab913752 (patch)
tree73e15148320882539b1ff9dd456f8bd02a9078db /custom
parentb9b9f483f54365ecb88572690f308a29d26da31c (diff)
downloadplanet-fda57f3b7c52ea9747e8c132c4571772ab913752.tar
planet-fda57f3b7c52ea9747e8c132c4571772ab913752.tar.gz
planet-fda57f3b7c52ea9747e8c132c4571772ab913752.tar.bz2
planet-fda57f3b7c52ea9747e8c132c4571772ab913752.tar.xz
planet-fda57f3b7c52ea9747e8c132c4571772ab913752.zip
Refactor main controller and templates
Templates for the public part: - archive/default views are merged into a single set - becomes HTML5 Controller code is reorganized for clarity. Compiled template caching is also fixed and activated when config cache value is > 0. Caching is also given new default larger values.
Diffstat (limited to 'custom')
-rwxr-xr-xcustom/views/archive/footer.tpl.php3
-rw-r--r--custom/views/archive/head.tpl.php6
-rwxr-xr-xcustom/views/archive/sidebar.tpl.php34
-rw-r--r--custom/views/archive/top.tpl.php4
-rw-r--r--[-rwxr-xr-x]custom/views/default/archive.tpl.php (renamed from custom/views/archive/index.tpl.php)35
-rwxr-xr-xcustom/views/default/footer.tpl.php8
-rw-r--r--custom/views/default/head.tpl.php9
-rw-r--r--custom/views/default/index.tpl.php19
-rw-r--r--custom/views/default/top.tpl.php11
9 files changed, 36 insertions, 93 deletions
diff --git a/custom/views/archive/footer.tpl.php b/custom/views/archive/footer.tpl.php
deleted file mode 100755
index c9c84b1..0000000
--- a/custom/views/archive/footer.tpl.php
+++ /dev/null
@@ -1,3 +0,0 @@
- <div id="footer">
- <p><?php echo str_replace('%s', 'href="http://moonmoon.org"', _g('Powered by <a %s>moonmoon</a>'))?> | <a href="./admin/"><?=_g('Administration')?></a></p>
- </div>
diff --git a/custom/views/archive/head.tpl.php b/custom/views/archive/head.tpl.php
deleted file mode 100644
index 005a75d..0000000
--- a/custom/views/archive/head.tpl.php
+++ /dev/null
@@ -1,6 +0,0 @@
- <link rel="stylesheet" media="screen" type="text/css" href="custom/style/default.css" title="Default" />
- <link rel="stylesheet" media="screen" type="text/css" href="custom/style/green.css" title="Green" />
- <link rel="stylesheet" media="screen" type="text/css" href="custom/style/light.css" title="Light" />
- <link rel="stylesheet" media="screen" type="text/css" href="custom/style/dark.css" title="Dark" />
-
- <link rel="alternate" type="application/atom+xml" title="ATOM" href="atom.php" />
diff --git a/custom/views/archive/sidebar.tpl.php b/custom/views/archive/sidebar.tpl.php
deleted file mode 100755
index 7a5d080..0000000
--- a/custom/views/archive/sidebar.tpl.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-$all_people = $Planet->getPeople();
-usort($all_people, array('PlanetFeed', 'compare'));
-?>
-<div id="sidebar">
- <div id="sidebar-people">
- <h2><?=_g('People')?> (<?php echo count($all_people); ?>)</h2>
- <ul>
- <?php foreach ($all_people as $person) : ?>
- <li>
- <a href="<?php echo htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8'); ?>" title="<?=_g('Feed')?>"><img src="postload.php?url=<?php echo urlencode(htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8')); ?>" alt="<?=_g('Feed')?>" height="12" width="12" /></a>
- <a href="<?php echo $person->getWebsite(); ?>" title="<?=_g('Website')?>"><?php echo htmlspecialchars($person->getName(), ENT_QUOTES, 'UTF-8'); ?></a>
- </li>
- <?php endforeach; ?>
- </ul>
- <p>
- <a href="custom/people.opml"><img src="custom/img/opml.png" alt="<?=_g('Feed')?>" height="12" width="12" />&nbsp;<?=_g('All feeds in OPML format')?></a>
- </p>
- </div>
-
- <div>
- <h2><?=_g('Syndicate')?></h2>
- <ul>
- <li><img src="custom/img/feed.png" alt="<?=_g('Feed')?>" height="12" width="12" />&nbsp;<a href="atom.php"><?=_g('Feed (ATOM)')?></a></li>
- </ul>
- </div>
-
- <div>
- <h2><?=_g('Archives')?></h2>
- <ul>
- <li><a href="?type=archive"><?=_g('See all headlines')?></a></li>
- </ul>
- </div>
-</div>
diff --git a/custom/views/archive/top.tpl.php b/custom/views/archive/top.tpl.php
deleted file mode 100644
index 7a818e1..0000000
--- a/custom/views/archive/top.tpl.php
+++ /dev/null
@@ -1,4 +0,0 @@
- <div id="top">
- <h1><a href="<?php echo $PlanetConfig->getUrl() ?>"><?php echo $PlanetConfig->getName(); ?></a></h1>
- </div>
- \ No newline at end of file
diff --git a/custom/views/archive/index.tpl.php b/custom/views/default/archive.tpl.php
index 679ef71..f775971 100755..100644
--- a/custom/views/archive/index.tpl.php
+++ b/custom/views/default/archive.tpl.php
@@ -1,4 +1,5 @@
<?php
+$pageTitle = $PlanetConfig->getName() . ' &middot; ' . _g('All Headlines');
$count = 0;
$today = array();
$week = array();
@@ -20,44 +21,36 @@ foreach ($items as $item) {
}
header('Content-type: text/html; charset=UTF-8');
-?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=$PlanetConfig->getLocale()?>" lang="<?=$PlanetConfig->getLocale()?>">
+?><!DOCTYPE html>
+<html lang="<?=$PlanetConfig->getLocale()?>" class="no-js">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
-
- <title><?php echo $PlanetConfig->getName(); ?></title>
<?php include(__DIR__.'/head.tpl.php'); ?>
</head>
-
<body>
<div id="page">
<?php include(__DIR__.'/top.tpl.php'); ?>
-
- <div id="content">
+ <main id="content">
<?php if (0 == count($items)) :?>
- <div class="article">
+ <article class="article">
<h2 class="article-title">
<?=_g('No article')?>
</h2>
<p class="article-content"><?=_g('No news, good news.')?></p>
- </div>
+ </article>
<?php endif; ?>
<?php if (count($today)) : ?>
- <div class="article">
+ <article class="article">
<h2><?=_g('Today')?></h2>
<ul>
<?php foreach ($today as $item) : ?>
<?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> &middot;
<a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
- </div>
+ </article>
<?php endif; ?>
<?php if (count($week)) : ?>
@@ -67,7 +60,7 @@ header('Content-type: text/html; charset=UTF-8');
<?php foreach ($week as $item) : ?>
<?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> &middot;
<a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
@@ -82,7 +75,7 @@ header('Content-type: text/html; charset=UTF-8');
<?php foreach ($month as $item) : ?>
<?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> &middot;
<a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
@@ -97,17 +90,15 @@ header('Content-type: text/html; charset=UTF-8');
<?php foreach ($older as $item) : ?>
<?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> &middot;
<a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
- </div>
-
+ </main>
<?php include_once(__DIR__.'/sidebar.tpl.php'); ?>
-
<?php include(__DIR__.'/footer.tpl.php'); ?>
</div>
</body>
diff --git a/custom/views/default/footer.tpl.php b/custom/views/default/footer.tpl.php
index d7d6c1a..eeff62b 100755
--- a/custom/views/default/footer.tpl.php
+++ b/custom/views/default/footer.tpl.php
@@ -1,4 +1,4 @@
- <div id="footer">
- <p><?php echo str_replace('%s', 'href="http://moonmoon.org" title="moonmoon '.$moon_version.'"', _g('Powered by <a %s>moonmoon</a>'))?>
- | <a href="./admin/"><?=_g('Administration')?></a></p>
- </div>
+<footer id="footer">
+ <p><?php echo str_replace('%s', 'href="http://moonmoon.org" title="moonmoon '.$moon_version.'"', _g('Powered by <a %s>moonmoon</a>'))?>
+ | <a href="./admin/"><?=_g('Administration')?></a></p>
+</footer>
diff --git a/custom/views/default/head.tpl.php b/custom/views/default/head.tpl.php
index 5773aa6..dbaf65c 100644
--- a/custom/views/default/head.tpl.php
+++ b/custom/views/default/head.tpl.php
@@ -1,3 +1,10 @@
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title><?php echo $pageTitle; ?></title>
<link rel="stylesheet" media="screen" type="text/css" href="custom/style/default.css" title="Default" />
-
<link rel="alternate" type="application/atom+xml" title="ATOM" href="atom.php" />
+
+ <script type="module">
+ document.documentElement.classList.remove("no-js");
+ document.documentElement.classList.add("js");
+ </script> \ No newline at end of file
diff --git a/custom/views/default/index.tpl.php b/custom/views/default/index.tpl.php
index 5e68161..cad2a6f 100644
--- a/custom/views/default/index.tpl.php
+++ b/custom/views/default/index.tpl.php
@@ -1,26 +1,15 @@
<?php
+$pageTitle = $PlanetConfig->getName();
$limit = $PlanetConfig->getMaxDisplay();
$count = 0;
header('Content-type: text/html; charset=UTF-8');
-?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=$PlanetConfig->getLocale()?>" lang="<?=$PlanetConfig->getLocale()?>">
+?><!DOCTYPE html>
+<html lang="<?=$PlanetConfig->getLocale()?>" class="no-js">
<head>
- <meta charset="utf-8">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-
- <title><?php echo $PlanetConfig->getName(); ?></title>
<?php include(__DIR__.'/head.tpl.php'); ?>
</head>
-
<body>
- <script type="text/javascript">
- document.body.className += 'js';
- </script>
<div id="page">
<?php include(__DIR__.'/top.tpl.php'); ?>
@@ -67,9 +56,7 @@ header('Content-type: text/html; charset=UTF-8');
<?php endforeach; ?>
<?php endif; ?>
</div>
-
<?php include_once(__DIR__.'/sidebar.tpl.php'); ?>
-
<?php include(__DIR__.'/footer.tpl.php'); ?>
</div>
</body>
diff --git a/custom/views/default/top.tpl.php b/custom/views/default/top.tpl.php
index 6db425c..ed6e19c 100644
--- a/custom/views/default/top.tpl.php
+++ b/custom/views/default/top.tpl.php
@@ -1,3 +1,8 @@
- <div id="header">
- <h1 id="top"><a href="<?php echo $PlanetConfig->getUrl(); ?>"><?php echo $PlanetConfig->getName(); ?></a></h1>
- </div> \ No newline at end of file
+<header id="header">
+ <h1 id="top">
+ <a href="<?php echo $PlanetConfig->getUrl(); ?>"><?php echo $PlanetConfig->getName(); ?></a>
+ <?php if ($pageRole == 'archive') : ?>
+ &middot; <?=_g('All Headlines') ?>
+ <?php endif; ?>
+ </h1>
+</header> \ No newline at end of file