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

@ -32,12 +32,36 @@ class AdminPageTheme extends Themelet {
</form>
";
$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(&quot;dbqcheck&quot;).checked == false){
document.getElementById(&quot;dbqtags&quot;).disabled = true;
document.getElementById(&quot;dbqsubmit&quot;).disabled = true;
}else{
document.getElementById(&quot;dbqtags&quot;).disabled = false;
document.getElementById(&quot;dbqsubmit&quot;).disabled = false;
}";
/* Second check
Requires you to confirm the deletion by clicking ok. */
$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='text' name='query'>
<input type='submit' value='Go'>
<input type='text' id='dbqtags' disabled='true' name='query'>
<input type='submit' id='dbqsubmit' disabled='true' value='Go'>
</form>
";
$page->add_block(new Block("Delete by Query", $html));

View file

@ -47,7 +47,7 @@ EOD
$counter_html
<div class='space' id='foot'>
<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>
</small></small>
</div>

View file

@ -254,13 +254,16 @@ function make_http($link) {
*
* @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;
$auth = $user->get_auth_html();
$extra = empty($form_id) ? '' : " id='$form_id'";
if($multipart) {
$extra .= " enctype='multipart/form-data'";
}
if($onsubmit) {
$extra .= " onsubmit='$onsubmit'";
}
return "<form action='$target' method='$method'$extra>$auth";
}

View file

@ -52,8 +52,12 @@ class TagListTheme extends Themelet {
$html .= " <span class='tag_count'>$count</span>";
}
}
$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){
$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>";
}else{
$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$s&quot;).style.display = &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' />";
}else{
$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$a&quot;).style.display = &quot;&quot;;'>".
"<img src='ext/upload/plus.png' /></a>";
@ -113,15 +113,31 @@ class UploadTheme extends Themelet {
{
/* 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.
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');
$html .= '<p><a href="javascript:var img=document.getElementById(&quot;highres&quot;).href;var ste=&quot;' .
$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;);' .
'if (confirm(&quot;OK = Use Current tags.\nCancel = Use new tags.&quot;)==true)' .
'{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' .
'+&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;}' .
'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!))';
$html .= '<p><a href="javascript:'.
/* This should stop the bookmarklet being insanely long...not that it's already huge or anything. */
'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;);' .
//The default confirm sucks, mainly due to being unable to change the text in the Ok/Cancel box (Yes/No would be better.)
'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.
//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.
'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();
$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)) {
$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_heading(html_escape($image->get_tag_list()));
$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_pin($image), "main", 11));
}

View file

@ -42,7 +42,7 @@ class Layout {
$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 = "";
if(strlen($page->heading) > 100) {

View file

@ -42,7 +42,7 @@ class Layout {
$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>";
$wrapper = "";

View file

@ -37,7 +37,7 @@ class Layout {
$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)) {
$subheading = "";

View file

@ -138,7 +138,7 @@ class Layout {
$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>";
$wrapper = "";

View file

@ -3,6 +3,7 @@
class CustomViewImageTheme extends ViewImageTheme {
public function display_page($image, $editor_parts) {
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_heading(html_escape($image->get_tag_list()));
$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: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("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_pin($image), "main", 11));
}

View file

@ -37,7 +37,7 @@ class Layout {
$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>";
$wrapper = "";

View file

@ -47,7 +47,7 @@ class Layout {
$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>";
$wrapper = "";