summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorJeena <spam@jeenaparadies.net>2015-07-23 00:32:01 +0200
committerJeena <spam@jeenaparadies.net>2015-07-24 20:57:54 +0200
commit85e80df0ba127936f9ba646ba00e25b37ddc2ec4 (patch)
tree3438827e96ff8b32cffeec79073a8c72c9f062e9 /views
parent91307d4a362a8fab0022aba19ab74bec9cb46f8f (diff)
Adds possibility to post photos.
With this it is possible to post a photo note with a description, nothing more. It doesn't move the file in the file system, just posts it from the temp location to the users server. It also does validate for file size, content type and max upload size and shows the errors to the user. If everything goes according to plan the response from the users server is shown, together with a link with the posted photos URL.
Diffstat (limited to 'views')
-rw-r--r--views/layout.php1
-rw-r--r--views/photo.php38
2 files changed, 39 insertions, 0 deletions
diff --git a/views/layout.php b/views/layout.php
index 072dea6..7c2dab9 100644
--- a/views/layout.php
+++ b/views/layout.php
@@ -66,6 +66,7 @@ if(property_exists($this, 'include_facebook')) {
<li><a href="/new">New Note</a></li>
<li><a href="/bookmark">Bookmark</a></li>
<li><a href="/favorite">Favorite</a></li>
+ <li><a href="/photo">Photo</a></li>
<? } ?>
<li><a href="/docs">Docs</a></li>
diff --git a/views/photo.php b/views/photo.php
new file mode 100644
index 0000000..364a55d
--- /dev/null
+++ b/views/photo.php
@@ -0,0 +1,38 @@
+ <div class="narrow">
+ <?= partial('partials/header') ?>
+
+ <form method="POST" role="form" style="margin-top: 20px;" id="note_form" enctype="multipart/form-data">
+
+ <div class="form-group">
+ <label for="note_photo"><code>photo</code></label>
+ <input type="file" name="note_photo" id="note_photo" accept="image/jpg,image/jpeg,image/gif,image/png">
+ <p class="help-block">Photo JPEG, GIF or PNG.</p>
+ </div>
+
+ <div class="form-group">
+ <label for="note_content"><code>content</code> (optional)</label>
+ <textarea name="note_content" id="note_content" value="" class="form-control" style="height: 4em;"><? if(isset($this->note_content)) echo $this->note_content ?></textarea>
+ </div>
+
+ <button class="btn btn-success" id="btn_post">Post</button>
+ </form>
+
+ <? if(!empty($this->location)): ?>
+ <div class="alert alert-success">
+ <strong>Success!</strong> Photo posted to: <em><a href="<?= $this->location ?>"><?= $this->location ?></a></em>
+ </div>
+ <? endif ?>
+
+ <? if(!empty($this->error)): ?>
+ <div class="alert alert-danger">
+ <strong>Error:</strong> <em><?= $this->error ?></em>
+ </div>
+ <? endif ?>
+
+ <? if(!empty($this->response)): ?>
+ <h4>Response:</h4>
+ <pre><?= $this->response ?></pre>
+ <? endif ?>
+
+
+ </div> \ No newline at end of file