2007-12-02 17:50:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class ExtManagerTheme extends Themelet {
|
2012-02-10 04:04:37 +00:00
|
|
|
public function display_table(Page $page, /*array*/ $extensions, /*bool*/ $editable) {
|
2010-05-28 13:26:46 +00:00
|
|
|
global $user;
|
2010-01-05 09:40:26 +00:00
|
|
|
$en = $editable ? "<th>Enabled</th>" : "";
|
2007-12-02 17:50:03 +00:00
|
|
|
$html = "
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("ext_manager/set"))."
|
2011-08-13 01:40:51 +00:00
|
|
|
<script type='text/javascript'>
|
2009-07-07 12:42:34 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
$(\"#extensions\").tablesorter();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<table id='extensions' class='zebra'>
|
2009-01-17 03:27:18 +00:00
|
|
|
<thead>
|
2010-01-05 09:40:26 +00:00
|
|
|
<tr>$en<th>Name</th><th>Description</th></tr>
|
2009-01-17 03:27:18 +00:00
|
|
|
</thead>
|
2009-01-17 04:53:11 +00:00
|
|
|
<tbody>
|
2007-12-02 17:50:03 +00:00
|
|
|
";
|
2009-01-17 03:27:18 +00:00
|
|
|
$n = 0;
|
2007-12-02 17:50:03 +00:00
|
|
|
foreach($extensions as $extension) {
|
2010-01-05 13:13:11 +00:00
|
|
|
if(!$editable && $extension->visibility == "admin") continue;
|
|
|
|
|
2008-04-11 06:04:22 +00:00
|
|
|
$ext_name = $extension->ext_name;
|
|
|
|
$h_name = empty($extension->name) ? $ext_name : html_escape($extension->name);
|
|
|
|
$h_description = html_escape($extension->description);
|
2010-01-05 09:40:26 +00:00
|
|
|
if($extension->enabled === TRUE) $h_enabled = " checked='checked'";
|
|
|
|
else if($extension->enabled === FALSE) $h_enabled = "";
|
2010-01-05 10:32:39 +00:00
|
|
|
else $h_enabled = " disabled checked='checked'";
|
2009-01-17 04:00:52 +00:00
|
|
|
$h_link = make_link("ext_doc/".html_escape($extension->ext_name));
|
2009-01-17 03:27:18 +00:00
|
|
|
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
2009-01-17 02:25:39 +00:00
|
|
|
|
2010-01-05 09:40:26 +00:00
|
|
|
$en = $editable ? "<td><input type='checkbox' name='ext_$ext_name'$h_enabled></td>" : "";
|
2007-12-02 17:50:03 +00:00
|
|
|
$html .= "
|
2009-01-17 03:27:18 +00:00
|
|
|
<tr class='$oe'>
|
2010-01-05 09:40:26 +00:00
|
|
|
$en
|
2009-01-17 04:00:52 +00:00
|
|
|
<td><a href='$h_link'>$h_name</a></td>
|
|
|
|
<td style='text-align: left;'>$h_description</td>
|
2007-12-02 17:50:03 +00:00
|
|
|
</tr>";
|
|
|
|
}
|
2010-01-05 09:40:26 +00:00
|
|
|
$set = $editable ? "<tfoot><tr><td colspan='5'><input type='submit' value='Set Extensions'></td></tr></tfoot>" : "";
|
2007-12-02 17:50:03 +00:00
|
|
|
$html .= "
|
2009-01-17 04:53:11 +00:00
|
|
|
</tbody>
|
2010-01-05 09:40:26 +00:00
|
|
|
$set
|
2007-12-02 17:50:03 +00:00
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
|
|
|
|
$page->set_title("Extensions");
|
|
|
|
$page->set_heading("Extensions");
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
$page->add_block(new Block("Extension Manager", $html));
|
|
|
|
}
|
2009-01-16 05:41:59 +00:00
|
|
|
|
2010-03-12 18:44:14 +00:00
|
|
|
/*
|
2009-01-17 02:49:15 +00:00
|
|
|
public function display_blocks(Page $page, $extensions) {
|
2010-05-28 13:26:46 +00:00
|
|
|
global $user;
|
2009-01-17 02:49:15 +00:00
|
|
|
$n = 0;
|
|
|
|
$col_1 = "";
|
|
|
|
$col_2 = "";
|
|
|
|
foreach($extensions as $extension) {
|
|
|
|
$ext_name = $extension->ext_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)."\">Original Site</a>" : "";
|
|
|
|
$h_doc = isset($extension->documentation) ?
|
|
|
|
"<a href=\"".make_link("ext_doc/".html_escape($extension->ext_name))."\">Documentation</a>" : "";
|
|
|
|
$h_author = html_escape($extension->author);
|
|
|
|
$h_description = html_escape($extension->description);
|
|
|
|
$h_enabled = $extension->enabled ? " checked='checked'" : "";
|
|
|
|
$h_author_link = empty($h_email) ?
|
|
|
|
"$h_author" :
|
|
|
|
"<a href='mailto:$h_email'>$h_author</a>";
|
|
|
|
|
|
|
|
$html = "
|
|
|
|
<p><table border='1'>
|
|
|
|
<tr>
|
|
|
|
<th colspan='2'>$h_name</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>By $h_author_link</td>
|
|
|
|
<td width='25%'>Enabled: <input type='checkbox' name='ext_$ext_name'$h_enabled></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style='text-align: left' colspan='2'>$h_description<p>$h_link $h_doc</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
";
|
|
|
|
if($n++ % 2 == 0) {
|
|
|
|
$col_1 .= $html;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$col_2 .= $html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$html = "
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("ext_manager/set"))."
|
2010-05-28 13:26:46 +00:00
|
|
|
".$user->get_auth_html()."
|
2009-01-17 02:49:15 +00:00
|
|
|
<table border='0'>
|
|
|
|
<tr><td width='50%'>$col_1</td><td>$col_2</td></tr>
|
|
|
|
<tr><td colspan='2'><input type='submit' value='Set Extensions'></td></tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
|
|
|
|
$page->set_title("Extensions");
|
|
|
|
$page->set_heading("Extensions");
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
$page->add_block(new Block("Extension Manager", $html));
|
|
|
|
}
|
2010-03-12 18:44:14 +00:00
|
|
|
*/
|
2009-01-17 02:49:15 +00:00
|
|
|
|
2009-01-16 05:41:59 +00:00
|
|
|
public function display_doc(Page $page, ExtensionInfo $info) {
|
2009-01-17 04:00:52 +00:00
|
|
|
$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
|
2010-01-05 10:11:53 +00:00
|
|
|
$link
|
2009-01-17 04:00:52 +00:00
|
|
|
<p>$doc
|
2010-01-05 10:11:53 +00:00
|
|
|
<hr>
|
|
|
|
<p><a href='".make_link("ext_manager")."'>Back to the list</a>
|
2009-01-17 04:00:52 +00:00
|
|
|
</div>";
|
|
|
|
|
2009-01-16 05:41:59 +00:00
|
|
|
$page->set_title("Documentation for ".html_escape($info->name));
|
|
|
|
$page->set_heading(html_escape($info->name));
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
$page->add_block(new Block("Documentation", $html));
|
|
|
|
}
|
2007-12-02 17:50:03 +00:00
|
|
|
}
|
|
|
|
?>
|