One True Image Info Editor
git-svn-id: file:///home/shish/svn/shimmie2/trunk@616 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
@ -51,14 +51,15 @@ class NumericScore extends Extension {
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if(is_a($event, 'ImageInfoBoxBuildingEvent')) {
|
||||
global $user;
|
||||
global $config;
|
||||
if(!$user->is_anonymous() || $config->get_bool("numeric_score_anon")) {
|
||||
$this->theme->display_voter($event->page, $event->image->id, $event->image->numeric_score);
|
||||
$event->add_part($this->theme->get_voter_html($event->image));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
global $database;
|
||||
$database->execute("DELETE FROM numeric_score_votes WHERE image_id=?", array($event->image->id));
|
||||
|
@ -1,15 +1,16 @@
|
||||
<?php
|
||||
|
||||
class NumericScoreTheme extends Themelet {
|
||||
public function display_voter($page, $image_id, $score) {
|
||||
$i_image_id = int_escape($image_id);
|
||||
$i_score = int_escape($score);
|
||||
public function get_voter_html($image) {
|
||||
$i_image_id = int_escape($image->id);
|
||||
$i_score = int_escape($image->numeric_score);
|
||||
|
||||
$html = "
|
||||
<table style='width: 400px;'>
|
||||
<tr>
|
||||
<td>Current score is $i_score</td>
|
||||
<td>
|
||||
<!--
|
||||
<form action='".make_link("numeric_score/vote")."' method='POST'>
|
||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||
<input type='hidden' name='score' value='1'>
|
||||
@ -21,12 +22,12 @@ class NumericScoreTheme extends Themelet {
|
||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||
<input type='hidden' name='score' value='-1'>
|
||||
<input type='submit' value='Vote Down' />
|
||||
</form>
|
||||
</form>-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
";
|
||||
$page->add_block(new Block(null, $html, "main", 7));
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user