Merge branch 'master' of github.com:shish/shimmie2

This commit is contained in:
Shish 2012-01-01 16:54:58 +00:00
commit beff330a37
14 changed files with 75 additions and 27 deletions

View File

@ -33,11 +33,35 @@ class AdminPageTheme extends Themelet {
"; ";
$page->add_block(new Block("Misc Admin Tools", $html)); $page->add_block(new Block("Misc Admin Tools", $html));
/* First check
Requires you to click the checkbox to enable the delete by query form */
$dbqcheck = "
if(document.getElementById("dbqcheck").checked == false){
document.getElementById("dbqtags").disabled = true;
document.getElementById("dbqsubmit").disabled = true;
}else{
document.getElementById("dbqtags").disabled = false;
document.getElementById("dbqsubmit").disabled = false;
}";
/* Second check
Requires you to confirm the deletion by clicking ok. */
$html = " $html = "
".make_form(make_link("admin_utils"))." <script type='text/javascript'>
function checkform(){
if(confirm('Are you sure you wish to delete all images using these tags?')){
return true;
}else{
return false;
}
}
</script>"
.make_form(make_link("admin_utils"),"post",false,false,"return checkform()")."
<input type='checkbox' id='dbqcheck' name='action' onclick='$dbqcheck'>
<input type='hidden' name='action' value='delete by query'> <input type='hidden' name='action' value='delete by query'>
<input type='text' name='query'> <input type='text' id='dbqtags' disabled='true' name='query'>
<input type='submit' value='Go'> <input type='submit' id='dbqsubmit' disabled='true' value='Go'>
</form> </form>
"; ";
$page->add_block(new Block("Delete by Query", $html)); $page->add_block(new Block("Delete by Query", $html));

View File

@ -47,7 +47,7 @@ EOD
$counter_html $counter_html
<div class='space' id='foot'> <div class='space' id='foot'>
<small><small> <small><small>
<a href='$contact_link'>Contact</a> &ndash; Serving $num_comma posts &ndash; <a href='mailto:$contact_link'>Contact</a> &ndash; Serving $num_comma posts &ndash;
Running <a href='http://code.shishnet.org/shimmie2/'>Shimmie</a> Running <a href='http://code.shishnet.org/shimmie2/'>Shimmie</a>
</small></small> </small></small>
</div> </div>

View File

@ -254,13 +254,16 @@ function make_http($link) {
* *
* @retval string * @retval string
*/ */
function make_form($target, $method="POST", $multipart=False, $form_id="") { function make_form($target, $method="POST", $multipart=False, $form_id="", $onsubmit="") {
global $user; global $user;
$auth = $user->get_auth_html(); $auth = $user->get_auth_html();
$extra = empty($form_id) ? '' : " id='$form_id'"; $extra = empty($form_id) ? '' : " id='$form_id'";
if($multipart) { if($multipart) {
$extra .= " enctype='multipart/form-data'"; $extra .= " enctype='multipart/form-data'";
} }
if($onsubmit) {
$extra .= " onsubmit='$onsubmit'";
}
return "<form action='$target' method='$method'$extra>$auth"; return "<form action='$target' method='$method'$extra>$auth";
} }

View File

@ -53,7 +53,11 @@ class TagListTheme extends Themelet {
} }
} }
$page->add_block(new Block("Related", $html, "left")); if($config->get_string('tag_list_image_type')=="tags"){
$page->add_block(new Block("Tags", $html, "left", 10));}
else{
$page->add_block(new Block("Related Tags", $html, "left", 10));
}
} }

View File

@ -27,11 +27,11 @@ class UploadTheme extends Themelet {
if($i==0){ if($i==0){
$upload_list .= "<div id='hide$i'><img id='wrapper' src='ext/upload/minus.png' />" . $upload_list .= "<div id='hide$i'><img id='wrapper' src='ext/upload/minus.png' />" .
"<a href='javascript:document.getElementById(&quot;row$a&quot;).style.display = &quot;&quot;;javascript:document.getElementById(&quot;hide$i&quot;).style.display = &quot;none&quot;;javascript:document.getElementById(&quot;hide$a&quot;).style.display = &quot;&quot;;'>". "<a href='#' onclick='javascript:document.getElementById(&quot;row$a&quot;).style.display = &quot;&quot;;document.getElementById(&quot;hide$i&quot;).style.display = &quot;none&quot;;document.getElementById(&quot;hide$a&quot;).style.display = &quot;&quot;;'>".
"<img src='ext/upload/plus.png'></a></div></td>"; "<img src='ext/upload/plus.png'></a></div></td>";
}else{ }else{
$upload_list .="<div id='hide$i'> $upload_list .="<div id='hide$i'>
<a href='javascript:document.getElementById(&quot;row$i&quot;).style.display = &quot;none&quot;;". <a href='#' onclick='javascript:document.getElementById(&quot;row$i&quot;).style.display = &quot;none&quot;;".
"document.getElementById(&quot;hide$i&quot;).style.display = &quot;none&quot;;". "document.getElementById(&quot;hide$i&quot;).style.display = &quot;none&quot;;".
"document.getElementById(&quot;hide$s&quot;).style.display = &quot;&quot;;". "document.getElementById(&quot;hide$s&quot;).style.display = &quot;&quot;;".
"document.getElementById(&quot;data$i&quot;).value = &quot;&quot;;". "document.getElementById(&quot;data$i&quot;).value = &quot;&quot;;".
@ -41,7 +41,7 @@ class UploadTheme extends Themelet {
$upload_list .="<img id='wrapper' src='ext/upload/plus.png' />"; $upload_list .="<img id='wrapper' src='ext/upload/plus.png' />";
}else{ }else{
$upload_list .= $upload_list .=
"<a href='javascript:document.getElementById(&quot;row$a&quot;).style.display = &quot;&quot;;". "<a href='#' onclick='javascript:document.getElementById(&quot;row$a&quot;).style.display = &quot;&quot;;".
"document.getElementById(&quot;hide$i&quot;).style.display = &quot;none&quot;;". "document.getElementById(&quot;hide$i&quot;).style.display = &quot;none&quot;;".
"document.getElementById(&quot;hide$a&quot;).style.display = &quot;&quot;;'>". "document.getElementById(&quot;hide$a&quot;).style.display = &quot;&quot;;'>".
"<img src='ext/upload/plus.png' /></a>"; "<img src='ext/upload/plus.png' /></a>";
@ -113,15 +113,31 @@ class UploadTheme extends Themelet {
{ {
/* Danbooru > Shimmie Bookmarklet. /* Danbooru > Shimmie Bookmarklet.
This "should" work on any site running danbooru, unless for some odd reason they switched around the id's or aren't using post/list. This "should" work on any site running danbooru, unless for some odd reason they switched around the id's or aren't using post/list.
Most likely this will stop working when Danbooru updates to v2, all depends if they switch the ids or not >_>.
Clicking the link on a danbooru image page should give you something along the lines of:
'http://www.website.com/shimmie/upload?url="http://sonohara.donmai.us/data/crazylongurl.jpg&tags="too many tags"&rating="s"&source="http://danbooru.donmai.us/post/show/012345/"'
TODO: Possibly make the entire/most of the script into a .js file, and just make the bookmarklet load it on click (Something like that?)
*/ */
$title = "Danbooru to " . $config->get_string('title'); $title = "Danbooru to " . $config->get_string('title');
$html .= '<p><a href="javascript:var img=document.getElementById(&quot;highres&quot;).href;var ste=&quot;' . $html .= '<p><a href="javascript:'.
$link . $delimiter . 'url=&quot;;var tag=document.getElementById(&quot;post_old_tags&quot;).value;var doc=document.documentElement.innerHTML;var rtg=doc.match(&quot;<li>Rating: (.*)<\/li>&quot;);var srx=&quot;http://&quot; + document.location.hostname + document.location.href.match(&quot;\/post\/show\/.*\/&quot;);' . /* This should stop the bookmarklet being insanely long...not that it's already huge or anything. */
'if (confirm(&quot;OK = Use Current tags.\nCancel = Use new tags.&quot;)==true)' . 'var ste=&quot;'. $link . $delimiter .'url=&quot;;var tag=document.getElementById(&quot;post_tags&quot;).value;var rtg=document.documentElement.innerHTML.match(&quot;<li>Rating: (.*)<\/li>&quot;);var srx=&quot;http://&quot; + document.location.hostname+document.location.href.match(&quot;\/post\/show\/.*\/&quot;);' .
'{if(tag.search(/\bflash\b/)==-1){location.href=ste+img+&quot;&amp;tags=&quot;+tag+&quot;&rating=&quot;+rtg[1]+&quot;&amp;source=&quot;+srx;}else{location.href=ste+document.getElementsByName(&quot;movie&quot;)[0].value' . //The default confirm sucks, mainly due to being unable to change the text in the Ok/Cancel box (Yes/No would be better.)
'+&quot;&amp;tags=&quot;+tag+&quot;&amp;rating=&quot;+rtg[1]+&quot;&amp;source=&quot;+srx;}}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+&quot;&amp;rating=&quot;+rtg[1]+&quot;&amp;source=&quot;+srx;}' . 'if (confirm(&quot;OK = Use Current tags.\nCancel = Use new tags.&quot;)==true){' . //Just incase some people don't want the insane amount of tags danbooru has.
'else{location.href=ste+document.getElementsByName(&quot;movie&quot;)[0].value+&quot;&amp;tags=&quot;+p+&quot;&amp;rating=&quot;+rtg[1]+&quot;&amp;source=&quot;+srx;}}">' . //The flash check is kind of picky, although it should work on "most" images..there will be either some old or extremely new ones that lack the flash tag.
$title . '</a> (As above, Click on a Danbooru-run image page. (This also grabs the tags, rating & source!))'; 'if(tag.search(/\bflash\b/)==-1){'.
'location.href=ste+document.getElementById(&quot;highres&quot;).href+&quot;&amp;tags=&quot;+tag+&quot;&amp;rating=&quot;+rtg[1]+&quot;&amp;source=&quot;+srx;}'.
'else{'.
'location.href=ste+document.getElementsByName(&quot;movie&quot;)[0].value+&quot;&amp;tags=&quot;+tag+&quot;&amp;rating=&quot;+rtg[1]+&quot;&amp;source=&quot;+srx;}'.
//The following is more or less the same as above, instead using the tags on danbooru, should load a prompt box instead.
'}else{'.
'var p=prompt(&quot;Enter Tags&quot;,&quot;&quot;);'.
'if(tag.search(/\bflash\b/)==-1){'.
'location.href=ste+document.getElementById(&quot;highres&quot;).href+&quot;&amp;tags=&quot;+p+&quot;&amp;rating=&quot;+rtg[1]+&quot;&amp;source=&quot;+srx;}' .
'else{'.
'location.href=ste+document.getElementsByName(&quot;movie&quot;)[0].value+&quot;&amp;tags=&quot;+p+&quot;&amp;rating=&quot;+rtg[1]+&quot;&amp;source=&quot;+srx;}'.
'}">' .
$title . '</a> (As above, Click on a Danbooru-run image page. (This also grabs the tags/rating/source!))';
} }

View File

@ -88,7 +88,7 @@ class Layout {
$debug = get_debug_info(); $debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>"; $contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
if(empty($this->subheading)) { if(empty($this->subheading)) {
$subheading = ""; $subheading = "";

View File

@ -6,7 +6,7 @@ class CustomViewImageTheme extends ViewImageTheme {
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list())); $page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
$page->set_heading(html_escape($image->get_tag_list())); $page->set_heading(html_escape($image->get_tag_list()));
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0)); $page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 10)); $page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15));
$page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10)); $page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10));
$page->add_block(new Block(null, $this->build_pin($image), "main", 11)); $page->add_block(new Block(null, $this->build_pin($image), "main", 11));
} }

View File

@ -42,7 +42,7 @@ class Layout {
$debug = get_debug_info(); $debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>"; $contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$wrapper = ""; $wrapper = "";
if(strlen($page->heading) > 100) { if(strlen($page->heading) > 100) {

View File

@ -42,7 +42,7 @@ class Layout {
$debug = get_debug_info(); $debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>"; $contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>"; $subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
$wrapper = ""; $wrapper = "";

View File

@ -37,7 +37,7 @@ class Layout {
$debug = get_debug_info(); $debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>"; $contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
if(empty($page->subheading)) { if(empty($page->subheading)) {
$subheading = ""; $subheading = "";

View File

@ -138,7 +138,7 @@ class Layout {
$debug = get_debug_info(); $debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>"; $contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>"; $subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
$wrapper = ""; $wrapper = "";

View File

@ -3,6 +3,7 @@
class CustomViewImageTheme extends ViewImageTheme { class CustomViewImageTheme extends ViewImageTheme {
public function display_page($image, $editor_parts) { public function display_page($image, $editor_parts) {
global $page; global $page;
$metatags = str_replace(" ", ", ", html_escape($image->get_tag_list()));
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list())); $page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
$page->set_heading(html_escape($image->get_tag_list())); $page->set_heading(html_escape($image->get_tag_list()));
$page->add_html_header("<meta name=\"keywords\" content=\"$metatags\">"); $page->add_html_header("<meta name=\"keywords\" content=\"$metatags\">");
@ -11,7 +12,7 @@ class CustomViewImageTheme extends ViewImageTheme {
$page->add_html_header("<meta property=\"og:image\" content=\"".make_http($image->get_thumb_link())."\">"); $page->add_html_header("<meta property=\"og:image\" content=\"".make_http($image->get_thumb_link())."\">");
$page->add_html_header("<meta property=\"og:url\" content=\"".make_http(make_link("post/view/{$image->id}"))."\">"); $page->add_html_header("<meta property=\"og:url\" content=\"".make_http(make_link("post/view/{$image->id}"))."\">");
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0)); $page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 10)); $page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15));
$page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10)); $page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10));
$page->add_block(new Block(null, $this->build_pin($image), "main", 11)); $page->add_block(new Block(null, $this->build_pin($image), "main", 11));
} }

View File

@ -37,7 +37,7 @@ class Layout {
$debug = get_debug_info(); $debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>"; $contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>"; $subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
$wrapper = ""; $wrapper = "";

View File

@ -47,7 +47,7 @@ class Layout {
$debug = get_debug_info(); $debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>"; $contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>"; $subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
$wrapper = ""; $wrapper = "";