]> git.quilime.com - plog.git/commitdiff
Added editing mode when DEV
authorGabriel Dunne <gdunne@quilime.com>
Mon, 3 Sep 2012 01:40:37 +0000 (18:40 -0700)
committerGabriel Dunne <gdunne@quilime.com>
Mon, 3 Sep 2012 01:40:37 +0000 (18:40 -0700)
29 files changed:
content/config [changed mode: 0644->0755]
content/news/bavc_2013 [changed mode: 0644->0755]
content/news/config [changed mode: 0644->0755]
content/news/icosi_gaffta [changed mode: 0644->0755]
content/process/clmpr [changed mode: 0644->0755]
content/process/egg [changed mode: 0644->0755]
content/process/icosi [changed mode: 0644->0755]
content/process/icosi2 [changed mode: 0644->0755]
content/process/icosi_biennial [changed mode: 0644->0755]
content/process/icosi_rider [changed mode: 0644->0755]
content/process/permenant [changed mode: 0644->0755]
content/process/schedule [changed mode: 0644->0755]
content/projects/boat [changed mode: 0644->0755]
content/projects/bodyneg [changed mode: 0644->0755]
content/projects/cabspotting [changed mode: 0644->0755]
content/projects/config [changed mode: 0644->0755]
content/projects/obsession [changed mode: 0644->0755]
content/projects/rattle [changed mode: 0644->0755]
content/projects/seaquence [changed mode: 0644->0755]
content/projects/stars [changed mode: 0644->0755]
content/projects/synonymovement [changed mode: 0644->0755]
css/style.css
data/tags.json
index.php
lib/data.php
templates/edit.html.tpl [new file with mode: 0644]
templates/entry.html.tpl
templates/projects.html.tpl
templates/single.html.tpl

old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 6186855..a22b946
@@ -1,16 +1,16 @@
-title = icosi fabrication
-date = 2010-07-01
-tags = fabrication icosi design sculpture mapping
---
-Fabrication process for ICOSI projection surface. The form is a section of an icosidodecahedron (scaled on the z-axis by 0.5).
-
-<a href="http://www.flickr.com/photos/quilime/4743498955/" title="view on flickr">
-<img src="http://farm5.static.flickr.com/4077/4743498955_d8d524bd27.jpg" /></a>
-<br />
-A laser-cut a small working model.
-
-<a href="http://www.flickr.com/photos/quilime/4744981890/" title="view on flickr"><img src="http://farm5.static.flickr.com/4142/4744981890_2a41c9f374.jpg" /></a><br />
-Custom jig for slicing the angles.
-
-<a href="http://www.flickr.com/photos/quilime/4769443639/in/photostream/"><img src="http://farm5.static.flickr.com/4076/4769443639_728b077b3a.jpg" /></a><br />
-Priming the panels, readying them to be stretched with screen-fabric.
+title = icosi fabrication\r
+date = 2010-07-01\r
+tags = fabrication icosi design sculpture mapping\r
+--\r
+Fabrication process for ICOSI projection surface. The form is a section of an icosidodecahedron (scaled on the z-axis by 0.5).\r
+\r
+<a href="http://www.flickr.com/photos/quilime/4743498955/" title="view on flickr">\r
+<img src="http://farm5.static.flickr.com/4077/4743498955_d8d524bd27.jpg" /></a>\r
+<br />\r
+A laser-cut a small working model.\r
+\r
+<a href="http://www.flickr.com/photos/quilime/4744981890/" title="view on flickr"><img src="http://farm5.static.flickr.com/4142/4744981890_2a41c9f374.jpg" /></a><br />\r
+Custom jig for slicing the angles.\r
+\r
+<a href="http://www.flickr.com/photos/quilime/4769443639/in/photostream/"><img src="http://farm5.static.flickr.com/4076/4769443639_728b077b3a.jpg" /></a><br />\r
+Priming the panels, readying them to be stretched with screen-fabric.\r
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 6293558..796c9c1
@@ -1,9 +1,8 @@
-title = Seaquence
-tags = code audio www
-notes = this might need to be split up into a few posts
-date = 2010-10-04
---
-
-Alpha release of [Seaquence: A experimental web-based musical ecosystem](http://seaquence.org). 
-
-[http://seaquence.org](http://seaquence.org)
+title = Seaquence\r
+tags = audio www\r
+date = 2010-10-04\r
+--\r
+\r
+Alpha release of [Seaquence: A experimental web-based musical ecosystem](http://seaquence.org). \r
+\r
+[http://seaquence.org](http://seaquence.org)\r
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index f64757ee3d2b13df0c81349f244b6a8958507ab7..55352a78ff6d300c7b281423e178008e2d32e2e1 100644 (file)
@@ -105,8 +105,7 @@ blockquote {
 
 
 
-#content {
-  padding-bottom:50px; }  
+#content {}  
   #content p:first-child {
   margin-top: 0pt;}
 
@@ -190,6 +189,16 @@ text-decoration:none;
 
 
 
+#content.edit textarea {
+  font-family: monaco, monospace;
+  padding:20px;
+  width:100%;
+  font-size:12px;
+  background:#222;
+  color:#eee;
+  height:400px;
+}
+
 .caption {
 margin-top: 5px;
 }
index 5fd61db0ca2c15203618828b0d7f6ec881dd2239..50fb70b84d7a524f814f229aced8459cb9d84b2c 100644 (file)
@@ -1 +1 @@
-{"tags":{"datavis":1,"software":1,"stamen":1,"print":1,"installation":2,"code":2,"www":2,"opensource":1,"audio":2,"performance":1,"projection":1,"visual":1,"icosi":2,"fabrication":2,"design":1,"sculpture":1,"mapping":1,"timelapse":1,"photography":1}}
\ No newline at end of file
+{"tags":{"datavis":1,"software":1,"stamen":1,"print":1,"installation":2,"code":2,"www":2,"opensource":1,"projection-mapping":1,"performance":2,"audiovisual":1,"audio":2,"projection":1,"visual":1,"icosi":2,"fabrication":2,"design":1,"sculpture":1,"mapping":1,"timelapse":1,"photography":1}}
\ No newline at end of file
index 7513a921317940d50c415e54ff81a4f9eaf3923b..9541f094ca9c7ebf72b34f00cd8ccc0ed2aaa5e5 100644 (file)
--- a/index.php
+++ b/index.php
@@ -9,7 +9,6 @@ $content_req = LOCAL_ROOT . CONTENT_DIR . DIRECTORY_SEPARATOR . $url['url'];
 $page_req =  LOCAL_ROOT . PAGE_DIR . DIRECTORY_SEPARATOR . $url['url'];
 $total = 0;
 
-
 # setup template
 $template = 'default.html.tpl';
 $t = get_template_instance();
@@ -18,14 +17,43 @@ $t->assign('url', $url);
 
 # special endpoints
 $dirs = explode('/', $url['url']);
-# tag
-if ($dirs[0] == 'tag') {
-    $page_req = LOCAL_ROOT . PAGE_DIR . DIRECTORY_SEPARATOR . $dirs[0];
-    if (isset($dirs[1])) {
-        $t->assign('tag', $dirs[1]);
-    }
-}
+switch($dirs[0]) {
+    case 'tag' :
+        $page_req = LOCAL_ROOT . PAGE_DIR . DIRECTORY_SEPARATOR . $dirs[0];
+        if (isset($dirs[1]))
+            $t->assign('tag', $dirs[1]);
+        break;
+    case 'edit' : 
+        
+        if (!DEV) 
+            break;
 
+        array_shift($dirs);
+        $newurl = implode($dirs, '/');
+        $content_req = LOCAL_ROOT . CONTENT_DIR . DIRECTORY_SEPARATOR . $newurl;
+        $page_req =  LOCAL_ROOT . PAGE_DIR . DIRECTORY_SEPARATOR . $newurl;
+
+        // TODO: Sercurity risk?
+        if ($_SERVER['REQUEST_METHOD'] == 'POST' && 
+            isset($_POST['edited_file_contents']) && 
+            isset($_POST['edited_file'])) {
+            try {
+                $fp = fopen( $_POST['edited_file'], 'w');
+                if ($fp) {
+                    fwrite($fp, $_POST['edited_file_contents']);
+                    fclose($fp);
+                }
+                if (!file_exists( $_POST['edited_file'] )) {
+                    throw new Exception('Error creating tags.json. Permissions?');
+                }
+            } catch (Exception $e) {
+                echo 'Caught exception: ',  $e->getMessage(), "\n";
+            }
+            $edit = false;
+        } else {
+            $edit = true;
+        }
+}
 
 # content exists, and is a folder
 if (is_dir($content_req)) {
@@ -42,16 +70,16 @@ if (is_dir($content_req)) {
 
 # content exists, and is a single entry
 else if (is_file($content_req)) {
-    $t->assign('data', parse_entry(new SplFileInfo($content_req)));
+    $t->assign('entry', parse_entry(new SplFileInfo($content_req)));
     $t->assign('single', true);
     $template = 'single.'.$response_format.'.tpl';
 }
 
 # content exists, and is a page
 else if (is_file($page_req)) {
-    $page = parse_entry(new SplFileInfo($page_req), 1);
-    $t->assign('data', $page);
-    $template = isset($page['config']['template']) ? $page['config']['template'] .
+    $config = parse_entry(new SplFileInfo($page_req), 1);
+    $t->assign('data', $config);
+    $template = isset($config['config']['template']) ? $config['config']['template'] .
     '.' . $response_format . '.tpl' : 'page.' . $response_format . '.tpl';
 }
 
@@ -60,6 +88,11 @@ else {
     $template = '404.html.tpl';
 }
 
+# edit
+if (DEV && isset($edit) && $edit) {
+    $template = 'edit.html.tpl';
+}
+
 # render
 $t->response_format = $response_format;
 $t->assign('view', isset($_GET['v']) ? $_GET['v'] : null);
index b266ac3632133613bb5d6845d236e04cd681e931..7f3b5b03e56eb03814d33cda430df7536b4560c8 100644 (file)
@@ -169,6 +169,7 @@ function parse_entry($fileInfo, $page = 0)
        $file['title'] = isset($file['config']['title']) ? $file['config']['title'] : $fileInfo->getFilename();
        $file['filename'] = $fileInfo->getFilename();
        $file['path'] = $fileInfo->getPath();
+       $file['fileInfo'] = $fileInfo;
        $file['config']['date'] = isset($file['config']['date']) ? $file['config']['date'] : null;
        $file['timestamp'] = $file['config']['date'] ? date('U', strtotime( $file['config']['date'])) : $fileInfo->getCTime();
        $file['tags'] = isset($file['config']['tags']) ? explode(" ", $file['config']['tags']) : null;
diff --git a/templates/edit.html.tpl b/templates/edit.html.tpl
new file mode 100644 (file)
index 0000000..386b087
--- /dev/null
@@ -0,0 +1,32 @@
+<html>
+<head>
+
+    <? $this->include_template('head-inc.html.tpl') ?>
+
+    <title><?=SITE_TITLE?><?=TITLE_DELIMITER?><?=$entry['title']?></title>
+
+</head>
+<body>
+
+    <? $this->include_template('nav.html.tpl') ?>
+
+<div id="content" class="edit">
+
+       <? if ($entry): ?>
+    <? $fileContents = file_get_contents($entry['fileInfo']); ?>
+
+    <form action="" method="POST">
+    <textarea name="edited_file_contents"><?=$fileContents?></textarea>
+    <input type="hidden" name="edited_file" value="<?=$entry['fileInfo']->getPath().DIRECTORY_SEPARATOR.$entry['fileInfo']->getFilename();?>">
+    <input type="button" onClick="window.location = '<?=$entry['url']?>'"value="cancel">
+    <input type="submit" value="save">
+    </form>
+
+    <? endif; ?>
+
+</div>
+
+       <? $this->include_template('footer.html.tpl') ?>
+
+</body>
+</html>
index 8454017a075246ebaab2a8161b8bdec432e58152..a35963670d00e7dda67ec89f1b1e2525b94b3b79 100644 (file)
@@ -35,3 +35,9 @@
                <a href="<?=$entry['url']?>">&rarr;</a>
        </div>
 <? endif; ?>
+
+<? if (DEV) : ?>
+
+<a href="<?=WEB_ROOT?>edit<?=$entry['cat']['url'] . $entry['filename']?>">edit</a>
+<? endif; ?>
+
index 52cf96c8b51efc15774e7309ee3fbb7e4d05b179..a3b31865263269e76776f81f5c779985d01dc53f 100644 (file)
@@ -13,7 +13,7 @@
 <div id="content">
 
        <ul class="projects">
-       <? foreach($data as $entry): ?>
+       <? foreach($entries as $entry): ?>
                <li>
                    <a href="<?=$entry['url']?>" class="thumb">
                        <img src="<?=$entry['thumb']?>" /><br/>
index 90269bb637f25e47584c26484a5de389ae1d0432..f87b4563966b020ea69bc1a3df52392cbbde47aa 100644 (file)
@@ -3,7 +3,7 @@
 
     <? $this->include_template('head-inc.html.tpl') ?>
 
-    <title><?=$data['title'];?></title>
+    <title><?=$entry['title'];?></title>
 
 </head>
 <body>
@@ -12,7 +12,7 @@
 
        <div id="content" class="single entry">
            <div class="entry">
-           <? $this->include_template('entry.html.tpl', array('data' => $data, 'single' => true)); ?>
+           <? $this->include_template('entry.html.tpl', array('entry' => $entry, 'single' => true)); ?>
            </div>
        </div>