From d8b9129130a11e643e4b90efad6e71c268d46f5c Mon Sep 17 00:00:00 2001
From: Gabriel Dunne
Date: Mon, 3 Sep 2012 17:07:45 -0700
Subject: [PATCH] Getting editing working again.
---
content/config | 0
content/log/islands | 0
content/log/overlords | 0
content/log/temple | 0
content/log/water_is_life | 0
content/projects/.audio | 0
content/projects/.egg | 0
content/projects/.obsession | 0
content/projects/.rattle | 0
content/projects/.stars | 0
content/projects/.statement_2007 | 0
content/projects/.tessellated | 0
content/projects/.web | 0
content/projects/config | 0
content/projects/mask | 0
content/projects/prism | 0
data/content/log/tags.json | 1 -
data/content/projects/tags.json | 1 -
data/tags.json | 1 -
index.php | 2 +-
lib/config.ini | 5 +-
lib/data.php | 13 +----
lib/edit.php | 30 ++++++++++
lib/model.php | 25 +++++++-
templates/archive.html.tpl | 8 +--
templates/edit.html.tpl | 32 +++++++++++
templates/linked-archive.html.tpl | 49 ----------------
templates/photo.html.tpl | 94 -------------------------------
28 files changed, 96 insertions(+), 165 deletions(-)
mode change 100644 => 100755 content/config
mode change 100644 => 100755 content/log/islands
mode change 100644 => 100755 content/log/overlords
mode change 100644 => 100755 content/log/temple
mode change 100644 => 100755 content/log/water_is_life
mode change 100644 => 100755 content/projects/.audio
mode change 100644 => 100755 content/projects/.egg
mode change 100644 => 100755 content/projects/.obsession
mode change 100644 => 100755 content/projects/.rattle
mode change 100644 => 100755 content/projects/.stars
mode change 100644 => 100755 content/projects/.statement_2007
mode change 100644 => 100755 content/projects/.tessellated
mode change 100644 => 100755 content/projects/.web
mode change 100644 => 100755 content/projects/config
mode change 100644 => 100755 content/projects/mask
mode change 100644 => 100755 content/projects/prism
delete mode 100644 data/content/log/tags.json
delete mode 100644 data/content/projects/tags.json
delete mode 100644 data/tags.json
create mode 100644 lib/edit.php
create mode 100644 templates/edit.html.tpl
delete mode 100644 templates/linked-archive.html.tpl
delete mode 100644 templates/photo.html.tpl
diff --git a/content/config b/content/config
old mode 100644
new mode 100755
diff --git a/content/log/islands b/content/log/islands
old mode 100644
new mode 100755
diff --git a/content/log/overlords b/content/log/overlords
old mode 100644
new mode 100755
diff --git a/content/log/temple b/content/log/temple
old mode 100644
new mode 100755
diff --git a/content/log/water_is_life b/content/log/water_is_life
old mode 100644
new mode 100755
diff --git a/content/projects/.audio b/content/projects/.audio
old mode 100644
new mode 100755
diff --git a/content/projects/.egg b/content/projects/.egg
old mode 100644
new mode 100755
diff --git a/content/projects/.obsession b/content/projects/.obsession
old mode 100644
new mode 100755
diff --git a/content/projects/.rattle b/content/projects/.rattle
old mode 100644
new mode 100755
diff --git a/content/projects/.stars b/content/projects/.stars
old mode 100644
new mode 100755
diff --git a/content/projects/.statement_2007 b/content/projects/.statement_2007
old mode 100644
new mode 100755
diff --git a/content/projects/.tessellated b/content/projects/.tessellated
old mode 100644
new mode 100755
diff --git a/content/projects/.web b/content/projects/.web
old mode 100644
new mode 100755
diff --git a/content/projects/config b/content/projects/config
old mode 100644
new mode 100755
diff --git a/content/projects/mask b/content/projects/mask
old mode 100644
new mode 100755
diff --git a/content/projects/prism b/content/projects/prism
old mode 100644
new mode 100755
diff --git a/data/content/log/tags.json b/data/content/log/tags.json
deleted file mode 100644
index da87f8a..0000000
--- a/data/content/log/tags.json
+++ /dev/null
@@ -1 +0,0 @@
-{"tags":{"photo":2,"water":1,"writing":1,"quote":2,"india":1}}
\ No newline at end of file
diff --git a/data/content/projects/tags.json b/data/content/projects/tags.json
deleted file mode 100644
index 7a2a5ff..0000000
--- a/data/content/projects/tags.json
+++ /dev/null
@@ -1 +0,0 @@
-{"tags":{"prism":1,"painting":2,"mask":1}}
\ No newline at end of file
diff --git a/data/tags.json b/data/tags.json
deleted file mode 100644
index 1d66e51..0000000
--- a/data/tags.json
+++ /dev/null
@@ -1 +0,0 @@
-{"tags":{"photo":2,"water":1,"writing":1,"quote":2,"india":1,"prism":1,"painting":2,"mask":1}}
\ No newline at end of file
diff --git a/index.php b/index.php
index 7012cf2..6c9cf6d 100644
--- a/index.php
+++ b/index.php
@@ -5,7 +5,7 @@ require 'lib/init.php';
$request = get_request();
-$m = new Model ($request);
+$m = new Model($request);
$v = new View();
diff --git a/lib/config.ini b/lib/config.ini
index 919a806..885c226 100644
--- a/lib/config.ini
+++ b/lib/config.ini
@@ -1,3 +1,6 @@
+[development]
+dev = true
+
[settings]
; general settings
site_title = plog
@@ -35,8 +38,6 @@ file_ignores[] = config
file_ignores[] = .DS_Store
-[development]
-dev = true
; define ('SITE_TITLE', 'quilime');
diff --git a/lib/data.php b/lib/data.php
index 1888d80..145dc7c 100644
--- a/lib/data.php
+++ b/lib/data.php
@@ -169,7 +169,6 @@ function get_tags($path = "", $args = array() )
$tags = array_count_values($tags);
-
if ($create_datafile) {
if (!is_dir($data_path)) {
if (!mkdir($data_path, 0777, true)) {
@@ -182,17 +181,9 @@ function get_tags($path = "", $args = array() )
if (!file_exists( $data_file )) {
throw new Exception('Error creating tags json in get_tags(). Permissions?');
}
- }
-
-
- // $fp = fopen( $data_file, 'w');
- // fwrite($fp, json_encode(array( 'tags' => $tags )));
- // fclose($fp);
- // if (!file_exists( $data_file)) {
- // throw new Exception('Error creating tags.json. Permissions?');
- // }
+ }
}
-
+
$json = json_decode(file_get_contents($data_file));
return (array) $json->tags;
}
diff --git a/lib/edit.php b/lib/edit.php
new file mode 100644
index 0000000..761a8c5
--- /dev/null
+++ b/lib/edit.php
@@ -0,0 +1,30 @@
+getMessage(), "\n";
+ }
+ $edit = false;
+} else {
+ $edit = true;
+}
diff --git a/lib/model.php b/lib/model.php
index 44cf54b..ad5c215 100644
--- a/lib/model.php
+++ b/lib/model.php
@@ -26,7 +26,30 @@ class Model
function parse_request( $request )
{
- # if entries (dir in CONTENT dir)
+
+/*
+ $dirs = explode('/', $request['path']);
+ switch($dirs[0]) {
+ # EDITING
+ case 'edit' :
+ include 'edit.php';
+ break;
+ # TAG
+ case 'tag' :
+ echo 'tag time.';
+ exit;
+ break;
+ }
+
+
+ # edit
+ if (DEV && isset($edit) && $edit) {
+ $this->template = 'edit.html.tpl';
+ }
+
+*/
+
+ # if multiple (multiple files in CONTENT dir)
if ($this->is_multiple()) {
# check if config file exists in dir
if ($this->has_config()) {
diff --git a/templates/archive.html.tpl b/templates/archive.html.tpl
index 6ba5573..204ac17 100644
--- a/templates/archive.html.tpl
+++ b/templates/archive.html.tpl
@@ -12,16 +12,16 @@
- foreach($entries as $entry): ?>
+ foreach($entries as $entry): ?>
-
— = $entry['title']; ?>
- endforeach; ?>
+ endforeach; ?>
-
+
- $this->include_template('footer.html.tpl') ?>
+ $this->include_template('footer.html.tpl') ?>
$this->include_template('nav.html.tpl') ?>
+
+ $this->include_template('nav.html.tpl') ?>
+
+
+
+ if ($entry): ?>
+ $fileContents = file_get_contents($entry->fileInfo); ?>
+
+
+
+ endif; ?>
+
+
+
+ $this->include_template('footer.html.tpl') ?>
+
+
diff --git a/templates/edit.html.tpl b/templates/edit.html.tpl
new file mode 100644
index 0000000..e27c80f
--- /dev/null
+++ b/templates/edit.html.tpl
@@ -0,0 +1,32 @@
+
+