Skip to content

Commit 9ec4681

Browse files
committed
Add packet info to packet viewer
1 parent fb5ca83 commit 9ec4681

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

static/a/packet.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* BNETDocs (C) 2015 Creative Commons CC-BY-NC-SA 4.0 License
3+
*/
4+
5+
article > section > table.info th,
6+
article > section > table.info td {
7+
text-align: left;
8+
vertical-align: top;
9+
}
10+
article > section > table.info tr th:first-child,
11+
article > section > table.info tr td:first-child {
12+
text-align: right;
13+
vertical-align: top;
14+
}

templates/Packet/View.phtml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,32 @@ $this->opengraph->attach(new Pair("url", "/packet/" . urlencode($object_id)));
1616
$this->opengraph->attach(new Pair("type", "article"));
1717

1818
$url = Common::relativeUrlToAbsolute("/packet/" . urlencode($object_id));
19-
if ($object)
19+
if ($object) {
2020
$url .= "/" . Common::sanitizeForUrl($object->getPacketName(), true);
2121

22-
#$this->additional_css[] = "/a/packet.css";
22+
$packet_id = "0x" . strtoupper(substr("0" . dechex($object->getPacketId()), -2));
23+
$title = $packet_id . " " . $title;
24+
}
25+
26+
$this->additional_css[] = "/a/packet.css";
2327
require("./header.inc.phtml");
2428
?>
2529
<article>
2630
<?php if ($object) { ?>
2731
<a href="https://plus.google.com/share?url=<?php echo urlencode($url); ?>" rel="external" data-popup="1"><img class="social-btn float-right" src="<?php echo Common::relativeUrlToAbsolute("/a/social-gplus-24px.png"); ?>"/></a>
28-
<a href="https://twitter.com/share?text=<?php echo urlencode($object->getPacketName()); ?>&amp;url=<?php echo urlencode($url); ?>" rel="external" data-popup="1"><img class="social-btn float-right" src="<?php echo Common::relativeUrlToAbsolute("/a/social-twitter-24px.png"); ?>"/></a>
32+
<a href="https://twitter.com/share?text=<?php echo urlencode($packet_id . " " . $object->getPacketName()); ?>&amp;url=<?php echo urlencode($url); ?>" rel="external" data-popup="1"><img class="social-btn float-right" src="<?php echo Common::relativeUrlToAbsolute("/a/social-twitter-24px.png"); ?>"/></a>
2933
<a href="https://facebook.com/sharer/sharer.php?u=<?php echo urlencode($url); ?>" rel="external" data-popup="1"><img class="social-btn float-right" src="<?php echo Common::relativeUrlToAbsolute("/a/social-facebook-24px.png"); ?>"/></a>
30-
<header><a href="<?php echo $url; ?>"><?php echo htmlspecialchars($object->getPacketName(), ENT_HTML5, "UTF-8"); ?></a></header>
34+
<header><a href="<?php echo $url; ?>"><?php echo htmlspecialchars($packet_id . " " . $object->getPacketName(), ENT_HTML5, "UTF-8"); ?></a></header>
35+
<section>
36+
<table class="info"><tbody>
37+
<tr><th style="width:20%;">Message Id:</th><td><?php echo $packet_id; ?></td></tr>
38+
<tr><th>Message Name:</th><td><?php echo htmlspecialchars($object->getPacketName(), ENT_HTML5, "UTF-8"); ?></td></tr>
39+
<tr><th>Direction:</th><td><?php require("./NYI.inc.phtml"); ?></td></tr>
40+
<tr><th>Used By:</th><td><?php require("./NYI.inc.phtml"); ?></td></tr>
41+
<tr><th>Format:</th><td><pre><code><?php echo $object->getPacketFormat(); ?></code></pre></td></tr>
42+
</tbody></table>
43+
</section>
44+
<header>Remarks</header>
3145
<section>
3246
<?php echo $object->getPacketRemarks(true); ?>
3347
</section>

0 commit comments

Comments
 (0)