46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
/*****************************************************************************
|
|
* MediaUploader.php
|
|
* Contains the media uploading template.
|
|
*
|
|
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
|
|
*****************************************************************************/
|
|
|
|
class MediaUploader extends SubTemplate
|
|
{
|
|
private Tag $tag;
|
|
|
|
public function __construct(Tag $tag)
|
|
{
|
|
$this->tag = $tag;
|
|
}
|
|
|
|
protected function html_content()
|
|
{
|
|
echo '
|
|
<form action="', BASEURL, '/uploadmedia/?tag=', $this->tag->id_tag, '" method="post" enctype="multipart/form-data">
|
|
<h2>Upload new photos to "', $this->tag->tag, '"</h2>
|
|
<div>
|
|
<h3>Select files</h3>
|
|
<input class="form-control" type="file" id="upload_queue" name="uploads[]" multiple>
|
|
</div>
|
|
<div>
|
|
<input class="btn btn-primary" name="save" id="photo_submit" type="submit" value="Upload the lot">
|
|
</div>
|
|
<div id="upload_preview_area">
|
|
</div>
|
|
</form>
|
|
<script type="text/javascript" src="', BASEURL, '/js/upload_queue.js" defer="defer"></script>
|
|
<script type="text/javascript" defer="defer">
|
|
setTimeout(function() {
|
|
var upload_queue = new UploadQueue({
|
|
queue_element: document.getElementById("upload_queue"),
|
|
preview_area: document.getElementById("upload_preview_area"),
|
|
submit_button: document.getElementById("photo_submit"),
|
|
upload_url: "', BASEURL, '/uploadmedia/?format=json&tag=', $this->tag->id_tag, '"
|
|
});
|
|
}, 100);
|
|
</script>';
|
|
}
|
|
}
|