summaryrefslogtreecommitdiffstats
path: root/application/views/file
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-10-22 15:42:07 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-10-22 22:36:55 +0200
commitde02b8cb514a95c100d0ec11ab469acfc687ca00 (patch)
tree9c09a70f4ac2b582ae80dd6e065f700ef460ed11 /application/views/file
parent36f0185d8c950933099268c69081cabc084545c9 (diff)
switch design to bootstrap; minor fixes along the way
Initial-work-by: Oliver Mader <b52@reaktor42.de> Additional-work-by: Markus Cisler <mrkscslr@gmail.com> Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/views/file')
-rw-r--r--application/views/file/footer.php3
-rw-r--r--application/views/file/header.php28
-rw-r--r--application/views/file/html_footer.php6
-rw-r--r--application/views/file/html_header.php131
-rw-r--r--application/views/file/upload_form.php131
-rw-r--r--application/views/file/upload_history.php53
6 files changed, 182 insertions, 170 deletions
diff --git a/application/views/file/footer.php b/application/views/file/footer.php
deleted file mode 100644
index eda863585..000000000
--- a/application/views/file/footer.php
+++ /dev/null
@@ -1,3 +0,0 @@
- </div>
-</body>
-</html>
diff --git a/application/views/file/header.php b/application/views/file/header.php
deleted file mode 100644
index 3029e4579..000000000
--- a/application/views/file/header.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
- <title><?php echo isset($title) ? $title : ''; ?></title>
- <link rel="stylesheet" type="text/css" href="<?php echo link_with_mtime("/data/default.css"); ?>" media="screen" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta name="robots" content="noindex,nofollow" />
-</head>
-
-<body>
- <div class="top">
- <?php echo anchor('file/index', 'New'); ?> |
- <?php echo anchor('file/upload_history', 'History'); ?> |
- <?php echo anchor('user/invite', 'Invite'); ?>
-
- <?php if(!isset($is_error_page)) { ?>
- <div class="right">
- <?php if(isset($username) && $username) { ?>
- <?=anchor("user/logout", "Logout"); ?>
- <?php } else { ?>
- <?=anchor("user/login", "Login"); ?>
- <?php } ?>
- </div>
- <?php } ?>
- </div>
-
- <div class="content">
diff --git a/application/views/file/html_footer.php b/application/views/file/html_footer.php
index ddc460a39..a2a1cfec2 100644
--- a/application/views/file/html_footer.php
+++ b/application/views/file/html_footer.php
@@ -1,5 +1,7 @@
</td>
</tr>
</table>
- </body>
-</html>
+ </div>
+ </div>
+
+<?php include(FCPATH."application/views/footer.php");
diff --git a/application/views/file/html_header.php b/application/views/file/html_header.php
index 60db38238..67e9d0cca 100644
--- a/application/views/file/html_header.php
+++ b/application/views/file/html_header.php
@@ -1,52 +1,85 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title><?php echo $title; ?></title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link rel="stylesheet" type="text/css" href="<?php echo link_with_mtime("/data/paste.css"); ?>" />
-<?php if (file_exists(FCPATH."/data/paste-$current_highlight.css")) {?>
- <link rel="stylesheet" type="text/css" href="<?php echo link_with_mtime("/data/paste-$current_highlight.css"); ?>" />
-<?php } ?>
- </head>
- <body>
- <div class="top_bar">
- <a class="raw_link no" href="<?php echo site_url(); ?>">New</a> |
- <a class="raw_link no" href="<?php echo site_url($id); ?>">Raw</a> |
- <a class="raw_link no" href="<?php echo site_url($id."/plain"); ?>">Plain</a> |
- <a class="raw_link no" href="<?php echo site_url($id."/info"); ?>">Info</a> |
- Currently: <?php echo $current_highlight; ?> |
- Timeout: <?php echo $timeout; ?>
- <div style="float:right;">
- <a class="raw_link no" href="<?php echo site_url($id)."/"; ?>">Code</a> |
- <a class="raw_link no" href="<?php echo site_url($id."/rmd"); ?>">Render Markdown</a>
- </div>
+<?php include(FCPATH."application/views/header.php"); ?>
+
</div>
-<script type="text/javascript">
-/* <![CDATA[ */
-function update_anchor_highlight() {
- var anchor = window.location.hash.substr(1);
- var element = document.getElementById("highlight_line");
- if (element) {
- element.parentNode.removeChild(element);
- }
- anchor = document.getElementById(anchor);
- if (!anchor) {
- return;
- }
- var newElement = document.createElement("div");
- newElement.setAttribute("id", "highlight_line");
- newElement.textContent=" ";
- anchor.parentNode.insertBefore(newElement, anchor.nextSibling);
-}
+ <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-block alert-error" style="text-align: center">
+ <?php echo $error_message; ?>
+ </div>
+ <?php } ?>
-if ("onhashchange" in window) {
- window.onload = function () {
- update_anchor_highlight();
- }
- window.onhashchange = function () {
- update_anchor_highlight();
- }
-}
-/* ]]> */
-</script>
+ <div class="container" style="padding-top:40px;background:#eee;padding:3px;">
+ <div style="border:1px solid #ccc;">
+ <div class="navbar navbar-static-top">
+ <div class="navbar-inner" style="box-shadow: none;">
+ <ul class="nav">
+ <li><a href="#file-info" class="brand" data-toggle="modal"><?php echo $title ?></a></li>
+ <li class="divider-vertical"></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="language-toggle">
+ Language: <?php echo $current_highlight; ?>
+ <b class="caret"></b>
+ </a>
+ <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">
+ <form>
+ <input type="text" id="language" placeholder="Language" class="input-medium">
+ </form>
+ </div>
+ </li>
+ <li class="divider-vertical"></li>
+ <li>
+ <a href="#file-info" role="button" data-toggle="modal">Info</a>
+ <div id="file-info" class="modal hide fade">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h3>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">
+ <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
+ </div>
+ </div>
+ </li>
+ </ul>
+ <div class="btn-group pull-right" style="margin-top: 7px; margin-right:-10px;">
+ <a href="<?php echo site_url($id."/plain") ?>" class="btn btn-small" rel="tooltip" title="View as plain text">Plain</a>
+ <a href="<?php echo site_url($id) ?>" class="btn btn-small" 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-small" rel="tooltip" title="Render as Code">Code</a>
+ <?php } else { ?>
+ <a href="<?php echo site_url($id."/rmd") ?>" class="btn btn-small" rel="tooltip" title="Render as Markdown">Markdown</a>
+ <?php } ?>
+ </div>
+ </div>
+ </div>
+ <div id="paste-container">
diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php
index 20fb1a3d8..d92cbfb5c 100644
--- a/application/views/file/upload_form.php
+++ b/application/views/file/upload_form.php
@@ -1,67 +1,72 @@
-<? if ($username) { ?>
-<div class="center">
- <?php echo form_open_multipart('file/do_upload'); ?>
- <p>
- File: <input type="file" id="file" name="file" size="30" />
- <input type="submit" value="Upload" id="upload_button" name="process" />
- </p>
- </form>
- <p><b>OR</b></p>
- <?php echo form_open_multipart('file/do_paste'); ?>
- <p>
- <textarea id="textarea" name="content" cols="80" rows="20"></textarea><br />
- <input type="submit" value="Paste" name="process" />
- </p>
- </form>
- <script type="text/javascript">
- /* <![CDATA[ */
- var max_upload_size = "<?php echo $max_upload_size; ?>";
- /* ]]> */
- </script>
- <script type="text/javascript" src="<?php echo link_with_mtime("/data/js/upload_form.js"); ?>"></script>
-</div>
-<? } else { ?>
-You have to <?=anchor("user/login", "log in"); ?> to be able to upload/paste.
-<div id="login-form">
- <?=form_open("user/login"); ?>
- <input type="text" name="username" />
- <input type="password" name="password" />
- <input type="submit" value="Login" name="process" />
- </form>
+<?php if (isset($username) && $username) { ?>
+<div class="well">
+ <div class="row-fluid">
+ <div class="span6">
+ <div style="border-right:1px solid #ddd;padding-right:25px;">
+ <?php echo form_open_multipart('file/do_paste'); ?>
+ <h2>Text paste</h2>
+ <textarea name="content" style="width:98%; height:300px;"></textarea>
+ <button type="submit" class="btn btn-primary">Paste it!</button>
+ </form>
+ </div>
+ </div>
+ <div class="span6">
+ <?php echo form_open_multipart('file/do_upload'); ?>
+ <h2>File upload</h2>
+ <input id="file" type="file" name="file"><br>
+ <button type="submit" id="upload_button" class="btn btn-primary">Upload it!</button>
+ </form>
+ <div class="alert alert-block alert-info">
+ <h4 class="alert-heading">Notice!</h4>
+ <p>
+ Uploads/pastes are deleted after <?php echo $upload_max_age; ?> days
+ <?php if($small_upload_size > 0) {
+ echo "unless they are smaller than ".format_bytes($small_upload_size);
+ } ?>. Maximum upload size is <?php echo format_bytes($max_upload_size); ?>
+ </p>
+ </div>
+ </div>
+ </div>
</div>
-<? } ?>
-<br />
-<p>Uploads/pastes are deleted after <?php echo $upload_max_age; ?> days<?php if($small_upload_size > 0): ?>
- unless they are smaller than <?php echo format_bytes($small_upload_size); ?>
- <?php endif; ?>. Maximum upload size is <?php echo format_bytes($max_upload_size); ?></p>
-<h2>Features</h2>
-<p>For shell uploading/pasting and download information for the client go to <a href="<?php echo site_url("file/client"); ?>"><?php echo site_url("file/client"); ?></a></p>
-<p>You can use the <?php echo anchor("file/upload_history", "history"); ?> to find old uploads.</p>
-<p>How to link your pastes:</p>
-<ul>
- <li><span class="example">/&lt;ID&gt;/</span> automatically highlight the paste</li>
- <li><span class="example">/&lt;ID&gt;</span> set the detected MIME type and let the browser do the rest</li>
- <li><span class="example">/&lt;ID&gt;/plain</span> force the MIME type to be text/plain</li>
- <li><span class="example">/&lt;ID&gt;/&lt;file extension&gt;</span> override auto detection and use the supplied file extension or language name for highlighting</li>
- <li><span class="example">/&lt;ID&gt;/qr</span> display a qr code containing a link to <span class="example">/&lt;ID&gt;/</span></li>
- <li><span class="example">/&lt;ID&gt;/rmd</span> convert markdown to HTML</li>
- <li><span class="example">/&lt;ID&gt;/ascii</span> convert text with ANSI (shell) escape codes to HTML</li>
- <li><span class="example">/&lt;ID&gt;/info</span> display some information about the ID</li>
-</ul>
-<p>If your upload is not detected as text, only
-<span class="example">/&lt;ID&gt;/qr</span>,
-<span class="example">/&lt;ID&gt;/plain</span> and
-<span class="example">/&lt;ID&gt;/info</span>
-will work as above and all others will simply return the file with the detected MIME type.</p>
-<h2>Information</h2>
-<p>This website's primary goal is aiding developers, power users, students and alike in solving problems, debugging software, sharing their configuration, etc. It is not intended to distribute confidential or harmful information, scripts or software.</p>
-
-<p>If you believe you deserve an account, ask someone who is already using this service to <?=anchor("user/invite", "invite"); ?> you.</p>
+<script type="text/javascript">
+ /* <![CDATA[ */
+ var max_upload_size = "<?php echo $max_upload_size; ?>";
+ /* ]]> */
+</script>
+<script type="text/javascript" src="<?php echo link_with_mtime("/data/js/upload_form.js"); ?>"></script>
-<?php if($contact_me_url) {?><p>If you experience any problems feel free to <a href="<?php echo $contact_me_url; ?>">contact me</a>.</p>
-<br /><?php }; ?>
-<div class="small">
- <p>Icons by <a href="http://p.yusukekamiyamane.com/">Yusuke Kamiyamane</a></p>
- <p>This service is provided without warranty of any kind and may not be used to distribute copyrighted content.</p>
+<?php } else { ?>
+ <?php echo form_open('user/login'); ?>
+ <input type="text" name="username" placeholder="Username" />
+ <input type="password" name="password" placeholder="Password" />
+ <input type="submit" class="btn btn-primary" value="Login" name="process" style="margin-bottom: 9px" />
+ </form>
+<?php } ?>
+<div class="row">
+ <div class="span6">
+ <div class="page-header"><h1>Features</h1></div>
+ <p>For shell uploading/pasting and download information for the client go to <a href="<?php echo site_url("file/client"); ?>"><?php echo site_url("file/client"); ?></a></p>
+ <p>You can use the <?php echo anchor("file/upload_history", "history"); ?> to find old uploads.</p>
+ <h3>How to link your pastes:</h3>
+ <dl class="dl-horizontal">
+ <dt>/&lt;ID&gt;/</dt><dd>automatically highlight the paste</dd>
+ <dt>/&lt;ID&gt;</dt><dd>set the detected MIME type and let the browser do the rest</dd>
+ <dt>/&lt;ID&gt;/plain</dt><dd>force the MIME type to be text/plain</dd>
+ <dt>/&lt;ID&gt;/&lt;file extension&gt;</dt><dd>override auto detection and use the supplied file extension or language name for highlighting</dd>
+ <dt>/&lt;ID&gt;/qr</dt><dd>display a qr code containing a link to <span class="example">/&lt;ID&gt;/</span></dd>
+ <dt>/&lt;ID&gt;/rmd</dt><dd>convert markdown to HTML</dd>
+ <dt>/&lt;ID&gt;/ascii</dt><dd>convert text with ANSI (shell) escape codes to HTML</dd>
+ <dt>/&lt;ID&gt;/info</dt><dd>display some information about the ID</dd>
+ </dl>
+ <p>If your upload is not detected as text, only <b>/&lt;ID&gt;/qr</b>, <b>/&lt;ID&gt;/plain</b> and <b>/&lt;ID&gt;/info</b> will work as above and all others will simply return the file with the detected MIME type.</p>
+ </div>
+ <div class="span6">
+ <div class="page-header"><h1>Information</h1></div>
+ <p>This website's primary goal is aiding developers, power users, students and alike in solving problems, debugging software, sharing their configuration, etc. It is not intended to distribute confidential or harmful information, scripts or software.</p>
+ <p>If you believe you deserve an account, ask someone who is already using this service to <a href="http://test.paste.xinu.at/index.php/user/invite">invite</a> you.</p>
+ <?php if(isset($contact_me_url) && $contact_me_url) { ?>
+ <p>If you experience any problems feel free to <a href="<?php echo $contact_me_url; ?>">contact me</a>.</p>
+ <?php } ?>
+ </div>
</div>
diff --git a/application/views/file/upload_history.php b/application/views/file/upload_history.php
index 41b055792..2f09240a1 100644
--- a/application/views/file/upload_history.php
+++ b/application/views/file/upload_history.php
@@ -1,28 +1,31 @@
-<?php echo form_open("file/do_delete"); ?>
- <table class="results">
- <tr>
- <th></th>
- <th>ID</th>
- <th>Filename</th>
- <th>Mimetype
- <th>Date</th>
- <th>Hash</th>
- <th>Size</th>
- </tr>
-
- <?php foreach($query as $key => $item): ?>
- <tr class="<?php echo even_odd(); ?>">
- <td><input type="checkbox" name="ids[<?php echo $item["id"]; ?>]" value="<?php echo $item["id"]; ?>" /></td>
- <td><a href="<?php echo site_url("/".$item["id"]); ?>/"><?php echo $item["id"]; ?></a></td>
- <td><?php echo htmlspecialchars($item["filename"]); ?></td>
- <td><?php echo $item["mimetype"]; ?></td>
- <td><?php echo $item["date"]; ?></td>
- <td><?php echo $item["hash"]; ?></td>
- <td><?php echo $item["filesize"]; ?></td>
- </tr>
- <?php endforeach; ?>
- </table>
- <input type="submit" value="Delete checked" name="process" />
+<?php echo form_open("file/do_delete") ?>
+ <table class="table table-striped">
+ <thead>
+ <tr>
+ <th><input type="checkbox" name="all-ids" id="history-all"></th>
+ <th>ID</th>
+ <th>Filename</th>
+ <th>Mimetype
+ <th>Date</th>
+ <th>Hash</th>
+ <th>Size</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach($query 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>
+ <td><?php echo htmlspecialchars($item["filename"]); ?></td>
+ <td><?php echo $item["mimetype"] ?></td>
+ <td><?php echo $item["date"] ?></td>
+ <td><?php echo $item["hash"] ?></td>
+ <td><?php echo $item["filesize"] ?></td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ <input class="btn btn-danger" type="submit" value="Delete checked" name="process">
</form>
<p>Total sum of your distinct uploads: <?php echo $total_size; ?>.</p>