diff --git a/ext/admin/main.php b/ext/admin/main.php
index 2395f139..e7fceee0 100644
--- a/ext/admin/main.php
+++ b/ext/admin/main.php
@@ -103,7 +103,7 @@ class AdminPage extends Extension {
public function onPostListBuilding(PostListBuildingEvent $event) {
global $user;
if($user->can("manage_admintools") && !empty($event->search_terms)) {
- $this->theme->display_dbq(implode(" ", $event->search_terms));
+ $event->add_control($this->theme->dbq_html(implode(" ", $event->search_terms)));
}
}
diff --git a/ext/admin/theme.php b/ext/admin/theme.php
index ab29b630..c6e8fb94 100644
--- a/ext/admin/theme.php
+++ b/ext/admin/theme.php
@@ -44,18 +44,15 @@ class AdminPageTheme extends Themelet {
$page->add_block(new Block("Misc Admin Tools", $html));
}
- public function display_dbq($terms) {
- global $page;
-
+ public function dbq_html($terms) {
$h_terms = html_escape($terms);
-
$html = make_form(make_link("admin/delete_by_query"), "POST") . "
";
- $page->add_block(new Block("List Controls", $html, "left"));
+ return $html;
}
}
?>
diff --git a/ext/index/main.php b/ext/index/main.php
index c8a0273b..ee76203b 100644
--- a/ext/index/main.php
+++ b/ext/index/main.php
@@ -122,10 +122,16 @@ class SearchTermParseException extends SCoreException {
class PostListBuildingEvent extends Event {
var $search_terms = null;
+ var $parts = array();
public function __construct($search) {
$this->search_terms = $search;
}
+
+ public function add_control(/*string*/ $html, /*int*/ $position=50) {
+ while(isset($this->parts[$position])) $position++;
+ $this->parts[$position] = $html;
+ }
}
class Index extends Extension {
@@ -184,10 +190,14 @@ class Index extends Extension {
$page->set_redirect(make_link('post/view/'.$images[0]->id));
}
else {
- send_event(new PostListBuildingEvent($search_terms));
+ $plbe = new PostListBuildingEvent($search_terms);
+ send_event($plbe);
$this->theme->set_page($page_number, $total_pages, $search_terms);
$this->theme->display_page($page, $images);
+ if(count($plbe->parts) > 0) {
+ $this->theme->display_admin_block($plbe->parts);
+ }
}
}
}
diff --git a/ext/index/theme.php b/ext/index/theme.php
index 89a9cb68..8ef8bff5 100644
--- a/ext/index/theme.php
+++ b/ext/index/theme.php
@@ -63,6 +63,11 @@ and of course start organising your images :-)
}
}
+ public function display_admin_block(/*array(string)*/ $parts) {
+ global $page;
+ $page->add_block(new Block("List Controls", join("
", $parts), "left", 50));
+ }
+
protected function build_navigation($page_number, $total_pages, $search_terms) {
$prev = $page_number - 1;
diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php
index a47d3f6a..442d826a 100644
--- a/ext/tag_edit/main.php
+++ b/ext/tag_edit/main.php
@@ -98,7 +98,7 @@ class TagEdit extends Extension {
public function onPostListBuilding(PostListBuildingEvent $event) {
global $user;
if($user->can("bulk_edit_image_source") && !empty($event->search_terms)) {
- $this->theme->display_mss(implode(" ", $event->search_terms));
+ $event->add_control($this->theme->mss_html(implode(" ", $event->search_terms)));
}
}
diff --git a/ext/tag_edit/theme.php b/ext/tag_edit/theme.php
index 33119847..362cd6fa 100644
--- a/ext/tag_edit/theme.php
+++ b/ext/tag_edit/theme.php
@@ -19,18 +19,15 @@ class TagEditTheme extends Themelet {
$page->add_block(new Block("Mass Tag Edit", $html));
}
- public function display_mss($terms) {
- global $page;
-
+ public function mss_html($terms) {
$h_terms = html_escape($terms);
-
$html = make_form(make_link("tag_edit/mass_source_set"), "POST") . "
";
- $page->add_block(new Block("List Controls", $html, "left"));
+ return $html;
}
public function get_tag_editor_html(Image $image) {