Closed #51 - anonymous uploads; simplified JS

This commit is contained in:
Marcin Kurczewski 2013-10-30 16:51:22 +01:00
parent 36caef3831
commit b7084d61ae
3 changed files with 13 additions and 13 deletions

View file

@ -89,18 +89,12 @@ $(function()
var postDom = posts.first(); var postDom = posts.first();
var url = postDom.find('form').attr('action') + '?json'; var url = postDom.find('form').attr('action') + '?json';
var sourceFile = postDom.data('file'); console.log(postDom.find('form').get(0));
var sourceUrl = postDom.data('url'); var fd = new FormData(postDom.find('form').get(0));
var tags = postDom.find('[name=tags]').val();
var safety = postDom.find('[name=safety]:checked').val(); fd.append('file', postDom.data('file'));
var source = postDom.find('[name=source]').val(); fd.append('url', postDom.data('url'));
var fd = new FormData();
fd.append('file', sourceFile);
fd.append('url', sourceUrl);
fd.append('tags', tags);
fd.append('safety', safety);
fd.append('source', source);
fd.append('submit', 1);
var ajaxData = var ajaxData =
{ {

View file

@ -318,7 +318,7 @@ class PostController
$dbPost->upload_date = time(); $dbPost->upload_date = time();
$dbPost->image_width = $imageWidth; $dbPost->image_width = $imageWidth;
$dbPost->image_height = $imageHeight; $dbPost->image_height = $imageHeight;
if ($this->context->loggedIn) if ($this->context->loggedIn and !InputHelper::get('anonymous'))
$dbPost->uploader = $this->context->user; $dbPost->uploader = $this->context->user;
$dbPost->ownFavoritee = []; $dbPost->ownFavoritee = [];
$dbPost->sharedTag = $dbTags; $dbPost->sharedTag = $dbTags;

View file

@ -101,6 +101,12 @@
<?php $checked = true ?> <?php $checked = true ?>
</label> </label>
<?php endforeach ?> <?php endforeach ?>
<input type="hidden" name="anonymous" value="0"/>
<label>
<input type="checkbox" name="anonymous" value="1"/>
Upload anonymously
</label>
</div> </div>
<div class="tags"> <div class="tags">