merge the two List Controls blocks
This commit is contained in:
parent
6fcdf4717e
commit
f3aad43fa3
@ -103,7 +103,7 @@ class AdminPage extends Extension {
|
|||||||
public function onPostListBuilding(PostListBuildingEvent $event) {
|
public function onPostListBuilding(PostListBuildingEvent $event) {
|
||||||
global $user;
|
global $user;
|
||||||
if($user->can("manage_admintools") && !empty($event->search_terms)) {
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,18 +44,15 @@ class AdminPageTheme extends Themelet {
|
|||||||
$page->add_block(new Block("Misc Admin Tools", $html));
|
$page->add_block(new Block("Misc Admin Tools", $html));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_dbq($terms) {
|
public function dbq_html($terms) {
|
||||||
global $page;
|
|
||||||
|
|
||||||
$h_terms = html_escape($terms);
|
$h_terms = html_escape($terms);
|
||||||
|
|
||||||
$html = make_form(make_link("admin/delete_by_query"), "POST") . "
|
$html = make_form(make_link("admin/delete_by_query"), "POST") . "
|
||||||
<input type='button' class='shm-unlocker' data-unlock-sel='#dbqsubmit' value='Unlock'>
|
<input type='button' class='shm-unlocker' data-unlock-sel='#dbqsubmit' value='Unlock'>
|
||||||
<input type='hidden' name='query' value='$h_terms'>
|
<input type='hidden' name='query' value='$h_terms'>
|
||||||
<input type='submit' id='dbqsubmit' disabled='true' value='Delete All These Images'>
|
<input type='submit' id='dbqsubmit' disabled='true' value='Delete All These Images'>
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$page->add_block(new Block("List Controls", $html, "left"));
|
return $html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -122,10 +122,16 @@ class SearchTermParseException extends SCoreException {
|
|||||||
|
|
||||||
class PostListBuildingEvent extends Event {
|
class PostListBuildingEvent extends Event {
|
||||||
var $search_terms = null;
|
var $search_terms = null;
|
||||||
|
var $parts = array();
|
||||||
|
|
||||||
public function __construct($search) {
|
public function __construct($search) {
|
||||||
$this->search_terms = $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 {
|
class Index extends Extension {
|
||||||
@ -184,10 +190,14 @@ class Index extends Extension {
|
|||||||
$page->set_redirect(make_link('post/view/'.$images[0]->id));
|
$page->set_redirect(make_link('post/view/'.$images[0]->id));
|
||||||
}
|
}
|
||||||
else {
|
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->set_page($page_number, $total_pages, $search_terms);
|
||||||
$this->theme->display_page($page, $images);
|
$this->theme->display_page($page, $images);
|
||||||
|
if(count($plbe->parts) > 0) {
|
||||||
|
$this->theme->display_admin_block($plbe->parts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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("<br>", $parts), "left", 50));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function build_navigation($page_number, $total_pages, $search_terms) {
|
protected function build_navigation($page_number, $total_pages, $search_terms) {
|
||||||
$prev = $page_number - 1;
|
$prev = $page_number - 1;
|
||||||
|
@ -98,7 +98,7 @@ class TagEdit extends Extension {
|
|||||||
public function onPostListBuilding(PostListBuildingEvent $event) {
|
public function onPostListBuilding(PostListBuildingEvent $event) {
|
||||||
global $user;
|
global $user;
|
||||||
if($user->can("bulk_edit_image_source") && !empty($event->search_terms)) {
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,18 +19,15 @@ class TagEditTheme extends Themelet {
|
|||||||
$page->add_block(new Block("Mass Tag Edit", $html));
|
$page->add_block(new Block("Mass Tag Edit", $html));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_mss($terms) {
|
public function mss_html($terms) {
|
||||||
global $page;
|
|
||||||
|
|
||||||
$h_terms = html_escape($terms);
|
$h_terms = html_escape($terms);
|
||||||
|
|
||||||
$html = make_form(make_link("tag_edit/mass_source_set"), "POST") . "
|
$html = make_form(make_link("tag_edit/mass_source_set"), "POST") . "
|
||||||
<input type='hidden' name='tags' value='$h_terms'>
|
<input type='hidden' name='tags' value='$h_terms'>
|
||||||
<input type='text' name='source' value=''>
|
<input type='text' name='source' value=''>
|
||||||
<input type='submit' value='Set Source For All'>
|
<input type='submit' value='Set Source For All'>
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$page->add_block(new Block("List Controls", $html, "left"));
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_tag_editor_html(Image $image) {
|
public function get_tag_editor_html(Image $image) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user