make the image info editor only visible when relevant
This commit is contained in:
parent
58971bacd0
commit
646cf1decb
3 changed files with 16 additions and 22 deletions
|
@ -66,7 +66,13 @@ class TagEdit implements Extension {
|
|||
|
||||
if($event instanceof ImageInfoBoxBuildingEvent) {
|
||||
global $user;
|
||||
$event->add_part($this->theme->get_editor_html($event->image, $user), 40);
|
||||
global $config;
|
||||
if($config->get_bool("tag_edit_anon") || !$user->is_anonymous()) {
|
||||
$event->add_part($this->theme->get_tag_editor_html($event->image), 40);
|
||||
}
|
||||
if($config->get_bool("source_edit_anon") || !$user->is_anonymous()) {
|
||||
$event->add_part($this->theme->get_source_editor_html($event->image), 41);
|
||||
}
|
||||
}
|
||||
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
|
|
|
@ -18,28 +18,14 @@ class TagEditTheme extends Themelet {
|
|||
$page->add_block(new Block("Mass Tag Edit", $html));
|
||||
}
|
||||
|
||||
public function get_editor_html($image, $user) {
|
||||
$html = "";
|
||||
|
||||
|
||||
global $config;
|
||||
if($config->get_bool("tag_edit_anon") || !$user->is_anonymous()) {
|
||||
public function get_tag_editor_html($image) {
|
||||
$h_tags = html_escape($image->get_tag_list());
|
||||
return "<tr><td width='50px'>Tags</td><td width='300px'><input type='text' name='tag_edit__tags' value='$h_tags'></td></tr>";
|
||||
}
|
||||
|
||||
public function get_source_editor_html($image) {
|
||||
$h_source = html_escape($image->get_source());
|
||||
$i_image_id = int_escape($image->id);
|
||||
|
||||
$source_edit = "";
|
||||
if($config->get_bool("source_edit_anon") || !$user->is_anonymous()) {
|
||||
$source_edit = "<tr><td>Source</td><td><input type='text' name='tag_edit__source' value='$h_source'></td></tr>";
|
||||
}
|
||||
|
||||
$html .= "
|
||||
<tr><td width='50px'>Tags</td><td width='300px'><input type='text' name='tag_edit__tags' value='$h_tags'></td></tr>
|
||||
$source_edit
|
||||
";
|
||||
}
|
||||
|
||||
return $html;
|
||||
return "<tr><td>Source</td><td><input type='text' name='tag_edit__source' value='$h_source'></td></tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -90,6 +90,8 @@ class ViewImageTheme extends Themelet {
|
|||
}
|
||||
|
||||
protected function build_image_editor($image, $editor_parts) {
|
||||
if(count($editor_parts) == 0) return "";
|
||||
|
||||
if(isset($_GET['search'])) {$h_query = "search=".url_escape($_GET['search']);}
|
||||
else {$h_query = "";}
|
||||
|
||||
|
|
Reference in a new issue