Feature #745
add author field
| Status: | New | Start: | 08/18/2009 | |
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | default extensions | |||
| Target version: | 2.X | |||
Description
FILE ext/tag_edit/main.php
On line 18 add
and replace with
and replace with
find
and replace with
on line 363 add
On line 18 add
/*
* AuthorSetEvent:
* $image_id
* $author
*
*/
class AuthorSetEvent extends Event {
var $image;
var $author;
public function AuthorSetEvent(Image $image, $author) {
$this->image = $image;
$this->author = $author;
}
}
between line 59 and 60 add
if($this->can_author()) {
send_event(new AuthorSetEvent($event->image, $_POST['tag_edit__author']));
}
on line 73 add
if($event instanceof AuthorSetEvent) {
$event->image->set_author($event->author);
}
find
if($event instanceof ImageInfoBoxBuildingEvent) {
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);
}
}
and replace with
if($event instanceof ImageInfoBoxBuildingEvent) {
if($config->get_bool("tag_edit_anon") || !$user->is_anonymous()) {
if($config->get_bool("tag_edit_enable")){
$event->add_part($this->theme->get_tag_editor_html($event->image), 40);
}
}
if($config->get_bool("source_edit_anon") || !$user->is_anonymous()) {
if($config->get_bool("source_edit_enable")){
$event->add_part($this->theme->get_source_editor_html($event->image), 41);
}
}
if($config->get_bool("author_edit_anon") || !$user->is_anonymous()) {
if($config->get_bool("author_edit_enable")){
$event->add_part($this->theme->get_author_editor_html($event->image), 42);
}
}
}
find
if($event instanceof SetupBuildingEvent) {
$sb = new SetupBlock("Tag Editing");
$sb->add_bool_option("tag_edit_anon", "Allow anonymous tag editing: ");
$sb->add_bool_option("source_edit_anon", "<br>Allow anonymous source editing: ");
$event->panel->add_block($sb);
}
and replace with
if($event instanceof SetupBuildingEvent) {
$sb = new SetupBlock("Tag Editing");
$sb->add_bool_option("tag_edit_enable", "<br>Enable tag editing box: ");
$sb->add_bool_option("source_edit_enable", "<br>Enable source editing box: ");
$sb->add_bool_option("author_edit_enable", "<br>Enable author editing box: ");
$sb->add_bool_option("tag_edit_anon", "<hr>Allow anonymous tag editing: ");
$sb->add_bool_option("source_edit_anon", "<br>Allow anonymous source editing: ");
$sb->add_bool_option("author_edit_anon", "<br>Allow anonymous author editing: ");
$event->panel->add_block($sb);
}
FILE ext/tag_edit/theme.phpfind
return "<tr><td width='50px'>Tags</td><td width='300px'><input type='text' name='tag_edit__tags' value='$h_tags'></td></tr>";
and replace with
return "<tr><td>Tags</td><td><input class='editor_tags' type='text' name='tag_edit__tags' value='$h_tags'></td></tr>";
between line 29 and line 30 add
public function get_author_editor_html(Image $image) {
$h_author = html_escape($image->get_author());
return "<tr><td>Author</td><td><input class='editor_author' type='text' name='tag_edit__author' value='$h_author'></td></tr>";
}
FILE core/imageboard.pack.phpon line 363 add
public function get_author() {
return $this->author;
}
public function set_author($author) {
global $database;
if(empty($author)) $author = null;
$database->execute("UPDATE images SET author=? WHERE id=?", array($author, $this->id));
}
SQLALTER TABLE 'images' ADD 'author' VARCHAR( 255 ) NULL DEFAULT NULL AFTER 'source'Check and add class to editor fields.
class='editor_tags' class='editor_source' class='editor_author'
History
Updated by Sein Kraft 94 days ago
FILE ext/index/main.php
between line 141 and 142 add
Now the user can sear by author.
between line 141 and 142 add
else if(preg_match("/^author=([a-zA-Z0-9]*)$/i", $event->term, $matches)) {
$author = strtolower($matches[1]);
$event->add_querylet(new Querylet("images.author LIKE '%$author%'"));
}
Now the user can sear by author.
Updated by Shish Moom 94 days ago
- Target version changed from 2.3 to 2.X
Not sure how this is better than having the author name as a regular tag :S
Something tells me that there is something that can be done, but I can't think what off the top of my head (linking "authors" and "users"? maybe...)
Either way, the database is frozen for now, so I'm moving this to something after 2.3.0~
Updated by Sein Kraft 94 days ago
Danbooru has a separate system from the tags.
http://danbooru.donmai.us/artist/index?order=date
Its really useful (for me) have the things separated.