Merge pull request #57 from DakuTree/master

Few small fixes
This commit is contained in:
Shish Moom 2011-12-14 02:22:22 -08:00
commit 986d010f8e
2 changed files with 24 additions and 12 deletions

View File

@ -15,6 +15,7 @@ class TagList implements Extension {
if($event instanceof InitExtEvent) { if($event instanceof InitExtEvent) {
$config->set_default_int("tag_list_length", 15); $config->set_default_int("tag_list_length", 15);
$config->set_default_int("popular_tag_list_length", 15);
$config->set_default_int("tags_min", 3); $config->set_default_int("tags_min", 3);
$config->set_default_string("info_link", 'http://en.wikipedia.org/wiki/$tag'); $config->set_default_string("info_link", 'http://en.wikipedia.org/wiki/$tag');
$config->set_default_string("tag_list_image_type", 'related'); $config->set_default_string("tag_list_image_type", 'related');
@ -85,7 +86,8 @@ class TagList implements Extension {
$event->panel->add_block($sb); $event->panel->add_block($sb);
$sb = new SetupBlock("Popular / Related Tag List"); $sb = new SetupBlock("Popular / Related Tag List");
$sb->add_int_option("tag_list_length", "Show top "); $sb->add_label(" tags"); $sb->add_int_option("tag_list_length", "Show top "); $sb->add_label(" related tags");
$sb->add_int_option("popular_tag_list_length", "<br>Show top "); $sb->add_label(" popular tags");
$sb->add_text_option("info_link", "<br>Tag info link: "); $sb->add_text_option("info_link", "<br>Tag info link: ");
$sb->add_choice_option("tag_list_image_type", array( $sb->add_choice_option("tag_list_image_type", array(
"Image's tags only" => "tags", "Image's tags only" => "tags",
@ -301,9 +303,9 @@ class TagList implements Extension {
FROM tags FROM tags
WHERE count > 0 WHERE count > 0
ORDER BY count DESC ORDER BY count DESC
LIMIT :tag_list_length LIMIT :popular_tag_list_length
"; ";
$args = array("tag_list_length"=>$config->get_int('tag_list_length')); $args = array("popular_tag_list_length"=>$config->get_int('popular_tag_list_length'));
$tags = $database->get_all($query, $args); $tags = $database->get_all($query, $args);
$database->cache->set("popular_tags", $tags, 600); $database->cache->set("popular_tags", $tags, 600);

View File

@ -62,19 +62,29 @@ class UploadTheme extends Themelet {
"; ";
if($tl_enabled) { if($tl_enabled) {
$link = make_http(make_link("upload")); $link = make_http(make_link("upload"));
if($config->get_bool('nice_urls')){
$delimiter = '?';
} else {
$delimiter = '&amp;';
}
{
$title = "Upload to " . $config->get_string('title'); $title = "Upload to " . $config->get_string('title');
$html .= '<p><a href="javascript:location.href=&quot;' . $html .= '<p><a href="javascript:location.href=&quot;' .
$link . '?url=&quot;+location.href+&quot;&amp;tags=&quot;+prompt(&quot;enter tags&quot;)">' . $link . $delimiter . 'url=&quot;+location.href+&quot;&amp;tags=&quot;+prompt(&quot;enter tags&quot;)">' .
$title . '</a> (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; $title . '</a> (Drag & drop onto your bookmarks toolbar, then click when looking at an image)';
} }
if($tl_enabled) { {
$link = make_http(make_link("upload"));
$title = "Danbooru to " . $config->get_string('title'); $title = "Danbooru to " . $config->get_string('title');
$html .= '<p><a href="javascript:if(document.getElementById(&quot;post_old_tags&quot;).value.search(/\bflash\b/)==-1) { location.href=&quot;' . $html .= '<p><a href="javascript:var img=document.getElementById(&quot;highres&quot;).href;var ste=&quot;' .
$link . '?url=&quot;+document.getElementById(&quot;highres&quot;).href+&quot;&amp;tags=&quot;+document.getElementById(&quot;post_old_tags&quot;).value } else { location.href=&quot;' . $link . $delimiter . 'url=&quot;;var tag=document.getElementById(&quot;post_old_tags&quot;).value;if (confirm(&quot;OK = Use Current tags.\nCancel = Use new tags.&quot;)==true)' .
$link . '?url=&quot;+document.getElementsByName(&quot;movie&quot;)[0].value+&quot;&tags=&quot;+document.getElementById(&quot;post_old_tags&quot;).value } ">' . '{if(tag.search(/\bflash\b/)==-1){location.href=ste+img+&quot;&amp;tags=&quot;+tag;}else{location.href=ste+document.getElementsByName(&quot;movie&quot;)[0].value' .
'+&quot;&amp;tags=&quot;+tag;}}else{var p=prompt(&quot;Enter Tags&quot;,&quot;&quot;);if(tag.search(/\bflash\b/)==-1){location.href=ste+img+&quot;&amp;tags=&quot;+p;}' .
'else{location.href=ste+document.getElementsByName(&quot;movie&quot;)[0].value+&quot;&amp;tags=&quot;+p;}}">' .
$title . '</a> (As above, Click on a Danbooru-run image page. (This also grabs the tags!))'; $title . '</a> (As above, Click on a Danbooru-run image page. (This also grabs the tags!))';
}
} }
$page->set_title("Upload"); $page->set_title("Upload");
@ -187,4 +197,4 @@ class UploadTheme extends Themelet {
"; ";
} }
} }
?> ?>