non-vital information moved to the extension documentation page

This commit is contained in:
Shish 2009-01-16 20:00:52 -08:00
parent bab82b914d
commit 34857c4d25
3 changed files with 30 additions and 22 deletions

View File

@ -8,7 +8,7 @@
*/ */
class ExtensionInfo { // {{{ class ExtensionInfo { // {{{
var $ext_name, $name, $link, $author, $email, $description, $documentation; var $ext_name, $name, $link, $author, $email, $description, $documentation, $version;
function ExtensionInfo($main) { function ExtensionInfo($main) {
$matches = array(); $matches = array();
@ -29,6 +29,9 @@ class ExtensionInfo { // {{{
$this->link = make_link(substr($this->link, 1)); $this->link = make_link(substr($this->link, 1));
} }
} }
if(preg_match("/Version: (.*)/", $line, $matches)) {
$this->version = $matches[1];
}
if(preg_match("/Author: (.*) [<\(](.*@.*)[>\)]/", $line, $matches)) { if(preg_match("/Author: (.*) [<\(](.*@.*)[>\)]/", $line, $matches)) {
$this->author = $matches[1]; $this->author = $matches[1];
$this->email = $matches[2]; $this->email = $matches[2];

View File

@ -6,36 +6,23 @@ class ExtManagerTheme extends Themelet {
<form action='".make_link("ext_manager/set")."' method='POST'> <form action='".make_link("ext_manager/set")."' method='POST'>
<table class='zebra'> <table class='zebra'>
<thead> <thead>
<tr><th>Name</th><th>Author</th><th>Description</th><th>Links</th><th>Enabled</th></tr> <tr><th>Enabled</td><th>Name</th><th>Description</th></tr>
</thead> </thead>
"; ";
$n = 0; $n = 0;
foreach($extensions as $extension) { foreach($extensions as $extension) {
$ext_name = $extension->ext_name; $ext_name = $extension->ext_name;
$h_name = empty($extension->name) ? $ext_name : html_escape($extension->name); $h_name = empty($extension->name) ? $ext_name : html_escape($extension->name);
$h_email = html_escape($extension->email);
$h_link = isset($extension->link) ?
"<a href=\"".html_escape($extension->link)."\">Info</a>" : "";
$h_doc = isset($extension->documentation) ?
"<a href=\"".make_link("ext_doc/".html_escape($extension->ext_name))."\">Help</a>" : "";
$h_author = html_escape($extension->author);
$h_description = html_escape($extension->description); $h_description = html_escape($extension->description);
$h_enabled = $extension->enabled ? " checked='checked'" : ""; $h_enabled = $extension->enabled ? " checked='checked'" : "";
$h_link = make_link("ext_doc/".html_escape($extension->ext_name));
$oe = ($n++ % 2 == 0) ? "even" : "odd"; $oe = ($n++ % 2 == 0) ? "even" : "odd";
$html .= " $html .= "
<tr class='$oe'> <tr class='$oe'>
<td>$h_name</td> <td><input type='checkbox' name='ext_$ext_name'$h_enabled></td>
" . ( <td><a href='$h_link'>$h_name</a></td>
empty($h_email) ? <td style='text-align: left;'>$h_description</td>
"<td>$h_author</td>" :
"<td><a href='mailto:$h_email'>$h_author</a></td>"
) . "
<td>$h_description</td>
<td>$h_link $h_doc</td>
<td>
<input type='checkbox' name='ext_$ext_name'$h_enabled>
</td>
</tr>"; </tr>";
} }
$html .= " $html .= "
@ -106,7 +93,25 @@ class ExtManagerTheme extends Themelet {
} }
public function display_doc(Page $page, ExtensionInfo $info) { public function display_doc(Page $page, ExtensionInfo $info) {
$html = "<div style='margin: auto; text-align: left; width: 512px;'>".$info->documentation."</div>"; $author = "";
if($info->author) {
if($info->email) {
$author = "<br><b>Author:</b> <a href=\"mailto:".html_escape($info->email)."\">".html_escape($info->author)."</a>";
}
else {
$author = "<br><b>Author:</b> ".html_escape($info->author);
}
}
$version = ($info->version) ? "<br><b>Version:</b> ".html_escape($info->version) : "";
$link = ($info->link) ? "<br><b>Home Page:</b> <a href=\"".html_escape($info->link)."\">Link</a>" : "";
$doc = $info->documentation;
$html = "
<div style='margin: auto; text-align: left; width: 512px;'>
$author
$version
<p>$doc
</div>";
$page->set_title("Documentation for ".html_escape($info->name)); $page->set_title("Documentation for ".html_escape($info->name));
$page->set_heading(html_escape($info->name)); $page->set_heading(html_escape($info->name));
$page->add_block(new NavBlock()); $page->add_block(new NavBlock());

View File

@ -52,8 +52,8 @@ TD>INPUT[type="text"] {width: 100%;}
TD>INPUT[type="password"] {width: 100%;} TD>INPUT[type="password"] {width: 100%;}
TD>SELECT {width: 100%;} TD>SELECT {width: 100%;}
TABLE.zebra {} TABLE.zebra {border-spacing: 0px;}
TABLE.zebra TD {vertical-align: middle;} TABLE.zebra TD, TABLE.zebra TH {vertical-align: middle; padding: 4px;}
TABLE.zebra THEAD {border-bottom: 2px solid #DDD;} TABLE.zebra THEAD {border-bottom: 2px solid #DDD;}
TABLE.zebra TR {border-bottom: 1px solid #DDD;} TABLE.zebra TR {border-bottom: 1px solid #DDD;}
TABLE.zebra TR.odd {background: #EFEFEF;} TABLE.zebra TR.odd {background: #EFEFEF;}