summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-09-06 14:11:39 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-11-01 17:26:31 +0100
commitc9fa3ed37fd1371ef24f6c3330995025295d7baf (patch)
tree1828f5961dcf4cce5959a2af076e3e0401fa074a
parentc553bb64715f40d1755bb84c277442df88e3a925 (diff)
Allow creation of multipastes from upload history
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/controllers/file/file_default.php34
-rw-r--r--application/views/file/upload_history.php8
2 files changed, 40 insertions, 2 deletions
diff --git a/application/controllers/file/file_default.php b/application/controllers/file/file_default.php
index 2b77866a0..3b5eb0ee4 100644
--- a/application/controllers/file/file_default.php
+++ b/application/controllers/file/file_default.php
@@ -683,6 +683,40 @@ class File_default extends MY_Controller {
$this->load->view('footer', $this->data);
}
+ public function handle_history_submit()
+ {
+ $this->muser->require_access("apikey");
+
+ $process = $this->input->post("process");
+
+ $dispatcher = [
+ "delete" => function() {
+ return $this->do_delete();
+ },
+ "multipaste" => function() {
+ return $this->_append_multipaste_queue();
+ },
+ ];
+
+ if (isset($dispatcher[$process])) {
+ $dispatcher[$process]();
+ } else {
+ throw new \exceptions\UserInputException("file/handle_history_submit/invalid-process-value", "Value in process field not found in dispatch table");
+ }
+ }
+
+ private function _append_multipaste_queue()
+ {
+ $ids = $this->input->post("ids");
+ if ($ids === false) {
+ $ids = [];
+ }
+
+ $m = new \service\multipaste_queue();
+ $m->append($ids);
+ redirect("file/multipaste/queue");
+ }
+
function upload_history()
{
$this->muser->require_access("apikey");
diff --git a/application/views/file/upload_history.php b/application/views/file/upload_history.php
index 253c0aa9e..54324d5b3 100644
--- a/application/views/file/upload_history.php
+++ b/application/views/file/upload_history.php
@@ -1,7 +1,10 @@
-<?php echo form_open("file/do_delete") ?>
+<?php echo form_open("file/handle_history_submit") ?>
<div class="nav-history">
<div class="container">
- <input class="btn btn-danger pull-right" type="submit" value="Delete checked" name="process">
+ <div class="pull-right">
+ <button class="btn btn-danger" name="process" value="delete">Delete checked</button>
+ <button class="btn btn-primary" name="process" value="multipaste">Add checked to multipaste queue</button>
+ </div>
<?php include 'nav_history.php'; ?>
</div>
</div>
@@ -32,6 +35,7 @@
</table>
</div>
<input class="btn btn-danger" type="submit" value="Delete checked" name="process">
+ <button class="add_multipaste btn btn-primary">Add checked to multipaste queue</button>
</form>
<p>Total sum of your distinct uploads: <?php echo $total_size; ?>.</p>