Skip to content

Commit 0a4a7b5

Browse files
committed
Next pass at bootstrap conversion
1 parent 493cb0e commit 0a4a7b5

File tree

2 files changed

+42
-58
lines changed

2 files changed

+42
-58
lines changed

src/templates/Packet/Delete.phtml

Lines changed: 40 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,43 @@
1-
<?php
2-
1+
<?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */
32
namespace BNETDocs\Templates\Packet;
4-
53
use \CarlBennett\MVC\Libraries\Pair;
6-
7-
$title = "Delete Packet";
8-
$description = "This form allows an individual to delete a packet.";
9-
10-
$this->opengraph->attach(new Pair("url", "/packet/delete"));
11-
$this->opengraph->attach(new Pair("type", "article"));
12-
13-
switch ($this->getContext()->error) {
14-
case "ACL_NOT_SET":
15-
$message = "You do not have the privilege to delete packets.";
16-
break;
17-
case "NOT_FOUND":
18-
$message = "Cannot find packet by that id.";
19-
break;
20-
case "NOT_LOGGED_IN":
21-
$message = "You must be logged in to delete packets.";
22-
break;
23-
case "INTERNAL_ERROR":
24-
$message = "An internal error occurred while processing your request. "
25-
. "Our staff have been notified of the issue. Try again later.";
26-
break;
27-
default:
28-
$message = $this->getContext()->error;
4+
$title = 'Delete Packet';
5+
$description = 'This form allows an individual to delete a packet.';
6+
$this->opengraph->attach(new Pair('url', '/packet/delete'));
7+
$this->opengraph->attach(new Pair('type', 'article'));
8+
$error = $this->getContext()->error;
9+
switch ($error)
10+
{
11+
case 'ACL_NOT_SET': $message = 'You do not have the privilege to delete packets.'; break;
12+
case 'NOT_FOUND': $message = 'Cannot find packet by that id.'; break;
13+
case 'NOT_LOGGED_IN': $message = 'You must be logged in to delete packets.'; break;
14+
case 'INTERNAL_ERROR': $message = 'An internal error occurred while processing your request. Our staff have been notified of the issue. Try again later.'; break;
15+
default: $message = $error;
2916
}
30-
31-
require("./header.inc.phtml");
32-
?>
33-
<article>
34-
<?php if (is_null($this->getContext()->error)) { ?>
35-
<header>Delete Packet</header>
36-
<form method="POST" action="?id=<?php echo
37-
htmlspecialchars($this->getContext()->id, ENT_HTML5, "UTF-8"); ?>">
38-
<section>
39-
<p>Are you sure you wish to delete this packet?</p>
40-
<p><input type="text" readonly="readonly" value="<?php echo filter_var($this->getContext()->title, FILTER_SANITIZE_STRING); ?>" tabindex="1"/></p>
41-
<p><input type="submit" value="Delete Packet" tabindex="2" autofocus="autofocus"/></p>
42-
</section>
43-
</form>
44-
<?php } else if ($this->getContext()->error === false) { ?>
45-
<header class="green">Packet Deleted</header>
46-
<section class="green">
47-
<p>You have successfully deleted the packet!</p>
48-
<p>Use the navigation to the left to move to another page.</p>
49-
</section>
50-
<?php } else { ?>
51-
<header class="red">Delete Packet</header>
52-
<section class="red">
53-
<p>An error occurred while attempting to delete the packet.</p>
54-
<p><?php echo $message; ?></p>
55-
<p>Use the navigation to the left to move to another page.</p>
56-
</section>
57-
<?php } ?>
58-
</article>
59-
<?php require("./footer.inc.phtml"); ?>
17+
$id = filter_var($this->getContext()->id, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
18+
require('./header.inc.phtml'); ?>
19+
<div class="container">
20+
<? if (is_null($error)) { ?>
21+
<h1 class="text-danger"><?=$title?></h1>
22+
<p class="text-danger"><?=$description?></p>
23+
<form method="POST" action="?id=<?=$id?>">
24+
<div class="alert alert-danger">
25+
<p class="mb-0">Are you sure you wish to delete this packet?</p>
26+
</div>
27+
<pre><code class="language-objectivec"><? echo filter_var($this->getContext()->title, FILTER_SANITIZE_STRING); ?></code></pre>
28+
<input class="btn btn-danger" type="submit" value="Delete Packet" tabindex="2" autofocus="autofocus"/>
29+
</form>
30+
<? } else if ($error === false) { ?>
31+
<h1 class="text-success">Packet Deleted</h1>
32+
<div class="alert alert-success">
33+
<p class="mb-0">You have successfully deleted the packet!</p>
34+
</div>
35+
<? } else { ?>
36+
<h1 class="text-danger">Delete Packet</h1>
37+
<div class="alert alert-danger">
38+
<p>An error occurred while attempting to delete the packet.</p>
39+
<p class="mb-0"><?=$message?></p>
40+
</div>
41+
<? } ?>
42+
</div>
43+
<? require("./footer.inc.phtml"); ?>

src/templates/Packet/Edit.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ require('./header.inc.phtml'); ?>
4949
</div>
5050
<div class="form-group">
5151
<label class="font-weight-bold" for="format">Format:</label>
52-
<textarea class="bg-dark border border-primary form-control text-light" name="format" id="format" tabindex="3" required><?=$packet_format?></textarea>
52+
<textarea class="bg-dark border border-primary form-control language-objectivec text-light text-monospace" style="height:120px;" name="format" id="format" tabindex="3" required><?=$packet_format?></textarea>
5353
</div>
5454
<div class="form-group">
5555
<label class="font-weight-bold">Used by:</label>
@@ -84,7 +84,7 @@ require('./header.inc.phtml'); ?>
8484
<label class="custom-control-label" for="markdown" title="Use markdown or use raw HTML">Markdown</label>
8585
</div>
8686
</span>
87-
<textarea class="bg-dark border border-primary form-control text-light" name="remarks" id="remarks" tabindex="4" required><?=$packet_remarks?></textarea>
87+
<textarea class="bg-dark border border-primary form-control text-light" style="height:200px;" name="remarks" id="remarks" tabindex="4" required><?=$packet_remarks?></textarea>
8888
</div>
8989
<div class="form-group text-center">
9090
<input class="btn btn-success" type="submit" value="Save" tabindex="9"/>

0 commit comments

Comments
 (0)