summaryrefslogtreecommitdiffstats
path: root/application/views/file
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-08-29 17:41:33 +0200
committerFlorian Pritz <bluewind@xinu.at>2014-08-29 17:43:19 +0200
commitd7621c2c01074bdcabd6a8c1a8e95c95d00319bf (patch)
treebfcff5599f26939f185bd0208538b56f39a3dc57 /application/views/file
parent08c68f84f4a8519912e31f85823694186de804cf (diff)
add multipaste support
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/views/file')
-rw-r--r--application/views/file/file_info.php2
-rw-r--r--application/views/file/fragments/alert-wide.php3
-rw-r--r--application/views/file/fragments/thumbnail.php9
-rw-r--r--application/views/file/fragments/uploads_table.php26
-rw-r--r--application/views/file/html_footer.php4
-rw-r--r--application/views/file/html_header.php89
-rw-r--r--application/views/file/html_paste_footer.php2
-rw-r--r--application/views/file/html_paste_header.php79
-rw-r--r--application/views/file/multipaste_info.php26
-rw-r--r--application/views/file/upload_form.php1
-rw-r--r--application/views/file/upload_history.php2
-rw-r--r--application/views/file/upload_history_thumbnails.php9
12 files changed, 154 insertions, 98 deletions
diff --git a/application/views/file/file_info.php b/application/views/file/file_info.php
index 6c2772a21..0620ac9bd 100644
--- a/application/views/file/file_info.php
+++ b/application/views/file/file_info.php
@@ -1,4 +1,4 @@
-<div class="center">
+<div class="center simple-container">
<?php if($filedata): ?>
<div class="table-responive">
<table class="table" style="margin: auto">
diff --git a/application/views/file/fragments/alert-wide.php b/application/views/file/fragments/alert-wide.php
new file mode 100644
index 000000000..ae303e119
--- /dev/null
+++ b/application/views/file/fragments/alert-wide.php
@@ -0,0 +1,3 @@
+<div class="alert alert-danger alert-wide">
+ <?php echo $error_message; ?>
+</div>
diff --git a/application/views/file/fragments/thumbnail.php b/application/views/file/fragments/thumbnail.php
new file mode 100644
index 000000000..6bd82fcb9
--- /dev/null
+++ b/application/views/file/fragments/thumbnail.php
@@ -0,0 +1,9 @@
+<!-- Comment markers background: http://stackoverflow.com/a/14776780/953022 -->
+<div class="container container-wide">
+<div class="upload_thumbnails"><!--
+ <?php foreach($items as $key => $item): ?>
+ --><a href="<?php echo site_url("/".$item["id"])."/"; ?>" title="<?php echo htmlentities($item["filename"]); ?>" data-content="<?php echo htmlentities($item["tooltip"]); ?>" data-id="<?php echo $item["id"]; ?>"><img class="thumb" src="<?php echo site_url("file/thumbnail/".$item["id"]); ?>"></a><!--
+ <?php endforeach; ?>
+ -->
+</div>
+</div>
diff --git a/application/views/file/fragments/uploads_table.php b/application/views/file/fragments/uploads_table.php
new file mode 100644
index 000000000..142d19e91
--- /dev/null
+++ b/application/views/file/fragments/uploads_table.php
@@ -0,0 +1,26 @@
+<?php register_js_include("/data/js/jquery.tablesorter.min.js"); ?>
+<div class="table-responsive container-wide">
+ <p>Non-previewable file(s):</p>
+ <table class="table table-striped tablesorter">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Filename</th>
+ <th>Mimetype</th>
+ <th>Date</th>
+ <th>Size</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach($items as $item): ?>
+ <tr>
+ <td><a href="<?php echo site_url("/".$item["id"]) ?>/"><?php echo $item["id"] ?></a></td>
+ <td class="wrap"><?php echo htmlspecialchars($item["filename"]); ?></td>
+ <td><?php echo $item["mimetype"] ?></td>
+ <td class="nowrap" data-sort-value="<?=$item["date"]; ?>"><?php echo date("r", $item["date"]); ?></td>
+ <td><?php echo format_bytes($item["filesize"]) ?></td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+</div>
diff --git a/application/views/file/html_footer.php b/application/views/file/html_footer.php
index bbec7ebd1..bd07b63f9 100644
--- a/application/views/file/html_footer.php
+++ b/application/views/file/html_footer.php
@@ -1,6 +1,4 @@
- </div>
- </div>
-
+<div class="container">
<?php
$force_full_html = true;
include(FCPATH."application/views/footer.php");
diff --git a/application/views/file/html_header.php b/application/views/file/html_header.php
index 2c556720c..fdce101a2 100644
--- a/application/views/file/html_header.php
+++ b/application/views/file/html_header.php
@@ -2,95 +2,14 @@
$force_full_html = true;
include(FCPATH."application/views/header.php"); ?>
-</div>
+</div><!-- .container -->
<script type="text/javascript">
/* <![CDATA[ */
window.lexers = <?php echo json_encode($lexers); ?>;
- window.paste_base = '<?php echo site_url($id) ?>';
/* ]]> */
</script>
-<?php if (isset($error_message)) { ?>
-<div class="alert alert-danger" style="text-align: center; border-radius: 0;">
- <?php echo $error_message; ?>
-</div>
-<?php } ?>
-
-<div class="container paste-container">
- <div style="border:1px solid #ccc;">
- <div class="navbar navbar-default navbar-static-top navbar-paste">
- <ul class="nav navbar-nav navbar-left dont-float">
- <li><a href="#file-info" class="navbar-brand" data-toggle="modal"><?php echo $title ?></a></li>
- <li class="divider"></li>
- <li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="language-toggle">
- Language: <?php echo htmlspecialchars($current_highlight); ?>
- <b class="caret"></b>
- </a>
- <div class="dropdown-menu" style="padding: 15px;">
- <form>
- <input type="text" id="language" placeholder="Language" class="form-control">
- </form>
- </div>
- </li>
- <li class="divider"></li>
- <li>
- <a href="#file-info" role="button" data-toggle="modal">Info</a>
- </li>
- <li class="divider"></li>
- <li><a href="<?php echo site_url('file/index?repaste='.$id); ?>" role="button">Repaste</a></li>
- </ul>
- <div class="btn-group navbar-right" style="margin: 8px;">
- <a id="linewrap" class="btn btn-default" rel="tooltip" title="Toggle wrapping of long lines">Linewrap</a>
- <a href="<?php echo site_url($id."/plain") ?>" class="btn btn-default" rel="tooltip" title="View as plain text">Plain</a>
- <a href="<?php echo site_url($id) ?>" class="btn btn-default" rel="tooltip" title="View as raw file (org. mime type)">Raw</a>
- <?php if ($current_highlight === 'rmd') { ?>
- <a href="<?php echo site_url($id)."/" ?>" class="btn btn-default" rel="tooltip" title="Render as Code">Code</a>
- <?php } else { ?>
- <a href="<?php echo site_url($id."/rmd") ?>" class="btn btn-default" rel="tooltip" title="Render as Markdown">Markdown</a>
- <?php } ?>
- </div>
- </div> <!-- .navbar -->
- <div id="file-info" class="modal fade" role="dialog" aria-labelledby="file-info" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">&times;</button>
- <h3 class="modal-title">Paste Information</h3>
- </div>
- <div class="modal-body">
- <table class="table">
- <tr>
- <td style="border:0;">Filename:</td>
- <td style="border:0;"><?php echo htmlspecialchars($filedata["filename"]) ?></td>
- </tr>
- <tr>
- <td>Size:</td>
- <td><?php echo format_bytes($filedata["filesize"]) ?></td>
- </tr>
- <tr>
- <td>Mimetype:</td>
- <td><?php echo $filedata["mimetype"] ?></td>
- </tr>
- <tr>
- <td>Uploaded:</td>
- <td><?php echo date("r", $filedata["date"]) ?></td>
- </tr>
- <tr>
- <td>Removal:</td>
- <td><?php echo $timeout ?></td>
- </tr>
- </table>
- </div>
- <div class="modal-footer">
- <?php echo form_open("file/do_delete/", array("style" => "display: inline")); ?>
- <input type="hidden" name="ids[<?php echo $id; ?>]" value="<?php echo $id; ?>">
- <button class="btn btn-danger pull-left" aria-hidden="true">Delete</button>
- </form>
- <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
- </div>
- </div>
- </div>
- </div> <!-- .modal -->
- <div>
+<?php if (isset($error_message)) {
+ include 'framgents/alert-wide.php';
+} ?>
diff --git a/application/views/file/html_paste_footer.php b/application/views/file/html_paste_footer.php
new file mode 100644
index 000000000..22bc4dabb
--- /dev/null
+++ b/application/views/file/html_paste_footer.php
@@ -0,0 +1,2 @@
+</div><!-- .container .paste-container -->
+
diff --git a/application/views/file/html_paste_header.php b/application/views/file/html_paste_header.php
new file mode 100644
index 000000000..f4d3021ec
--- /dev/null
+++ b/application/views/file/html_paste_header.php
@@ -0,0 +1,79 @@
+<div class="container paste-container container-wide">
+ <div style="border:1px solid #ccc;">
+ <div class="navbar navbar-default navbar-static-top navbar-paste">
+ <ul class="nav navbar-nav navbar-left dont-float">
+ <li><a href="<?=site_url($id)."/"; ?>" class="navbar-brand" data-toggle="modal"><?php echo $title ?></a></li>
+ <li class="divider"></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="language-toggle-<?=$id; ?>">
+ Language: <?php echo htmlspecialchars($current_highlight); ?>
+ <b class="caret"></b>
+ </a>
+ <div class="dropdown-menu" style="padding: 15px;">
+ <form>
+ <input data-base-url="<?=site_url($id); ?>" type="text" id="language-<?=$id; ?>" placeholder="Language" class="form-control">
+ </form>
+ </div>
+ </li>
+ <li class="divider"></li>
+ <li>
+ <a href="#file-info-<?=$id; ?>" role="button" data-toggle="modal">Info</a>
+ </li>
+ <?php if (isset($user_logged_in) && $user_logged_in) { ?>
+ <li class="divider"></li>
+ <li><a href="<?php echo site_url('file/index?repaste='.$id); ?>" role="button">Repaste</a></li>
+ <?php } ?>
+ </ul>
+ <div class="btn-group navbar-right" style="margin: 8px;">
+ <a id="linewrap-<?=$id; ?>" class="btn btn-default" rel="tooltip" title="Toggle wrapping of long lines">Linewrap</a>
+ <a href="<?php echo site_url($id."/plain") ?>" class="btn btn-default" rel="tooltip" title="View as plain text">Plain</a>
+ <a href="<?php echo site_url($id) ?>" class="btn btn-default" rel="tooltip" title="View as raw file (org. mime type)">Raw</a>
+ <?php if ($current_highlight === 'rmd') { ?>
+ <a href="<?php echo site_url($id)."/" ?>" class="btn btn-default" rel="tooltip" title="Render as Code">Code</a>
+ <?php } else { ?>
+ <a href="<?php echo site_url($id."/rmd") ?>" class="btn btn-default" rel="tooltip" title="Render as Markdown">Markdown</a>
+ <?php } ?>
+ </div>
+ </div> <!-- .navbar -->
+ <div id="file-info-<?=$id; ?>" class="modal fade" role="dialog" aria-labelledby="file-info-<?=$id; ?>" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal">&times;</button>
+ <h3 class="modal-title">Paste Information</h3>
+ </div>
+ <div class="modal-body">
+ <table class="table">
+ <tr>
+ <td style="border:0;">Filename:</td>
+ <td style="border:0;"><?php echo htmlspecialchars($filedata["filename"]) ?></td>
+ </tr>
+ <tr>
+ <td>Size:</td>
+ <td><?php echo format_bytes($filedata["filesize"]) ?></td>
+ </tr>
+ <tr>
+ <td>Mimetype:</td>
+ <td><?php echo $filedata["mimetype"] ?></td>
+ </tr>
+ <tr>
+ <td>Uploaded:</td>
+ <td><?php echo date("r", $filedata["date"]) ?></td>
+ </tr>
+ <tr>
+ <td>Removal:</td>
+ <td><?php echo $timeout ?></td>
+ </tr>
+ </table>
+ </div>
+ <div class="modal-footer">
+ <?php echo form_open("file/do_delete/", array("style" => "display: inline")); ?>
+ <input type="hidden" name="ids[<?php echo $id; ?>]" value="<?php echo $id; ?>">
+ <button class="btn btn-danger pull-left" aria-hidden="true">Delete</button>
+ </form>
+ <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
+ </div>
+ </div>
+ </div>
+ </div> <!-- .modal -->
+ </div>
diff --git a/application/views/file/multipaste_info.php b/application/views/file/multipaste_info.php
new file mode 100644
index 000000000..5baf732a2
--- /dev/null
+++ b/application/views/file/multipaste_info.php
@@ -0,0 +1,26 @@
+<div class="center simple-container">
+ <div class="table-responive">
+ <table class="table" style="margin: auto">
+ <tr>
+ <td class="title">ID</td>
+ <td class="text"><a href="<?=site_url($id); ?>/"><?=$id; ?></a></td>
+ </tr>
+ <tr>
+ <td class="title">Number of files</td>
+ <td class="text"><?=$file_count; ?></td>
+ </tr>
+ <tr>
+ <td class="title">Date of upload</td>
+ <td class="text"><?=date("r", $upload_date); ?></td>
+ </tr>
+ <tr>
+ <td class="title">Date of removal</td>
+ <td class="text"><?=$timeout_string; ?></td>
+ </tr>
+ <tr>
+ <td class="title">Total size (including duplicates)</td>
+ <td class="text"><?=format_bytes($size); ?></td>
+ </tr>
+ </table>
+ </div>
+</div>
diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php
index 612a1bf82..44828c53a 100644
--- a/application/views/file/upload_form.php
+++ b/application/views/file/upload_form.php
@@ -29,6 +29,7 @@
<div>
<input class="file-upload" type="file" name="file[]" multiple="multiple"><br>
</div>
+ <label><input type="checkbox" name="multipaste" value="1"> Create multipaste</label><br>
<button type="submit" id="upload_button" class="btn btn-primary">Upload it!</button>
</div>
</div>
diff --git a/application/views/file/upload_history.php b/application/views/file/upload_history.php
index 5015e9bf6..10afc53e9 100644
--- a/application/views/file/upload_history.php
+++ b/application/views/file/upload_history.php
@@ -15,7 +15,7 @@
</tr>
</thead>
<tbody>
- <?php foreach($query as $key => $item): ?>
+ <?php foreach($items as $key => $item): ?>
<tr>
<td><input type="checkbox" name="ids[<?php echo $item["id"] ?>]" value="<?php echo $item["id"] ?>" class="delete-history"></td>
<td><a href="<?php echo site_url("/".$item["id"]) ?>/"><?php echo $item["id"] ?></a></td>
diff --git a/application/views/file/upload_history_thumbnails.php b/application/views/file/upload_history_thumbnails.php
index bcafc44ca..a061d9676 100644
--- a/application/views/file/upload_history_thumbnails.php
+++ b/application/views/file/upload_history_thumbnails.php
@@ -6,14 +6,7 @@
</div>
<?php include 'nav_history.php'; ?>
-
-<!-- Comment markers background: http://stackoverflow.com/a/14776780/953022 -->
-<div class="upload_history_thumbnails"><!--
- <?php foreach($query as $key => $item): ?>
- --><a href="<?php echo site_url("/".$item["id"]); ?>" title="<?php echo htmlentities($item["filename"]); ?>" data-content="<?php echo htmlentities($item["tooltip"]); ?>" data-id="<?php echo $item["id"]; ?>"><img class="thumb" src="<?php echo site_url("file/thumbnail/".$item["id"]); ?>"></a><!--
- <?php endforeach; ?>
- -->
-</div>
+<?php include 'fragments/thumbnail.php'; ?>
<div class="row-fluid">
<div class="span12 alert alert-block alert-info">