From 4fd51adf879e376220f7d97a9e084a62892870ad Mon Sep 17 00:00:00 2001 From: Pascal Chevrel Date: Tue, 6 Mar 2012 17:29:13 +0100 Subject: Use a centralized template for the admin section to avoid repeating html --- admin/administration.php | 54 ++++++---------- admin/inc/nav.inc.php | 5 -- admin/index.php | 163 +++++++++++++++++++++-------------------------- admin/login.php | 35 +++------- admin/template.php | 44 +++++++++++++ 5 files changed, 148 insertions(+), 153 deletions(-) delete mode 100644 admin/inc/nav.inc.php create mode 100644 admin/template.php (limited to 'admin') diff --git a/admin/administration.php b/admin/administration.php index 1f02e78..894ebd3 100644 --- a/admin/administration.php +++ b/admin/administration.php @@ -1,21 +1,12 @@ getPeople(); -?> - - - - - - - - - moonmoon administration - + +require_once dirname(__FILE__) . '/inc/auth.inc.php'; +require_once dirname(__FILE__) . '/../app/lib/lib.opml.php'; + +$opml = OpmlManager::load(dirname(__FILE__) . '/../custom/people.opml'); +$opml_people = $opml->getPeople(); +$page_id = 'admin-admin'; +$header_extra = <<<"HTML" - - - -
- - - - -
+ +HTML; + +$page_content = <<<"FRAGMENT" +

Clear cache

@@ -43,14 +27,16 @@ $opml_people = $opml->getPeople();

Clearing the cache will make moonmoon reload all feeds.

- +

Change administrator password

-
-
- - \ No newline at end of file + +FRAGMENT; + +$footer_extra = ''; +$admin_access = 1; +require_once dirname(__FILE__) . '/template.php'; diff --git a/admin/inc/nav.inc.php b/admin/inc/nav.inc.php deleted file mode 100644 index d524348..0000000 --- a/admin/inc/nav.inc.php +++ /dev/null @@ -1,5 +0,0 @@ -

Logout

- \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index feee813..b075206 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,52 +1,75 @@ loadOpml(dirname(__FILE__).'/../custom/people.opml')) { - $Planet->loadFeeds(); - $items = $Planet->getItems(); +if (0 < $Planet->loadOpml(dirname(__FILE__) . '/../custom/people.opml')) { + $Planet->loadFeeds(); + $items = $Planet->getItems(); } - -$everyone = $Planet->getPeople(); -header('Content-type: text/HTML; charset=UTF-8'); -?> - - - - - - - +$everyone = $Planet->getPeople(); +$count_feeds = count($everyone); +$page_id = 'admin-feed'; +$footer_extra = << + var allCheckboxes = function(status){ + var form = document.getElementById('feedmanage'); + var selectboxes = form.getElementsByTagName('input'); + for (var i=0; imoonmoon administration - - + var btSelectnone = document.getElementById('selectnone'); + btSelectnone.onclick = function(){ + allCheckboxes(''); + } + } + +FRAGMENT; - -
- - - +ob_start(); +?> -

Add a new feed

@@ -63,7 +86,7 @@ header('Content-type: text/HTML; charset=UTF-8');

Manage existing feeds

- Number of feeds: + Number of feeds:

@@ -79,16 +102,16 @@ header('Content-type: text/HTML; charset=UTF-8'); - - - - + + + - get_items(); if (count($items) > 0) { echo $items[0]->get_date(); @@ -97,55 +120,17 @@ header('Content-type: text/HTML; charset=UTF-8'); } ?> - - + +
-
-
- - - - + - - - - - - - moonmoon administration - - - -
- - -
+$page_content = <<
-
+FRAGMENT; + +$footer_extra = << - - \ No newline at end of file + +FRAGMENT; + +$page_id = 'admin-login'; +$admin_access = 0; +require_once dirname(__FILE__) . '/template.php'; diff --git a/admin/template.php b/admin/template.php new file mode 100644 index 0000000..2c95d5b --- /dev/null +++ b/admin/template.php @@ -0,0 +1,44 @@ + + + + + + + + + + + moonmoon administration + + + + + +
+ + + + +

Logout

+ + + + +
+ + + +
+
+ + + + + -- cgit v1.2.1