things work now
git-svn-id: file:///home/shish/svn/shimmie2/trunk@542 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
a9d1671d17
commit
252bea060d
4 changed files with 18 additions and 11 deletions
|
@ -37,7 +37,7 @@ class NumericScore extends Extension {
|
||||||
$i_image_id = int_escape($_POST['image_id']);
|
$i_image_id = int_escape($_POST['image_id']);
|
||||||
|
|
||||||
if($i_score >= -1 || $i_score <= 1) {
|
if($i_score >= -1 || $i_score <= 1) {
|
||||||
send_event(new NumericScoreSetEvent($i_image_id, $event->user->id, $i_score));
|
send_event(new NumericScoreSetEvent($i_image_id, $event->user, $i_score));
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->page->set_mode("redirect");
|
$event->page->set_mode("redirect");
|
||||||
|
|
|
@ -3,21 +3,28 @@
|
||||||
class NumericScoreTheme extends Themelet {
|
class NumericScoreTheme extends Themelet {
|
||||||
public function display_voter($page, $image_id, $score) {
|
public function display_voter($page, $image_id, $score) {
|
||||||
$i_image_id = int_escape($image_id);
|
$i_image_id = int_escape($image_id);
|
||||||
$i_score = int_escape($score) / 2;
|
$i_score = int_escape($score);
|
||||||
|
|
||||||
$html = "
|
$html = "
|
||||||
Current score is $i_score
|
<table style='width: 400px;'>
|
||||||
<br>
|
<tr>
|
||||||
<form action='".make_link("numeric_score/vote")."' method='POST'>
|
<td>Current score is $i_score</td>
|
||||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
<td>
|
||||||
<input type='hidden' name='score' value='-1'>
|
|
||||||
<input type='submit' value='Vote Down' />
|
|
||||||
</form>
|
|
||||||
<form action='".make_link("numeric_score/vote")."' method='POST'>
|
<form action='".make_link("numeric_score/vote")."' method='POST'>
|
||||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||||
<input type='hidden' name='score' value='1'>
|
<input type='hidden' name='score' value='1'>
|
||||||
<input type='submit' value='Vote Up' />
|
<input type='submit' value='Vote Up' />
|
||||||
</form>
|
</form>
|
||||||
|
</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'>
|
||||||
|
<input type='submit' value='Vote Down' />
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
";
|
";
|
||||||
$page->add_block(new Block(null, $html, "main", 7));
|
$page->add_block(new Block(null, $html, "main", 7));
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class TextScore extends Extension {
|
||||||
$i_image_id = int_escape($_POST['image_id']);
|
$i_image_id = int_escape($_POST['image_id']);
|
||||||
|
|
||||||
if($i_score >= -2 || $i_score <= 2) {
|
if($i_score >= -2 || $i_score <= 2) {
|
||||||
send_event(new TextScoreSetEvent($i_image_id, $event->user->id, $i_score));
|
send_event(new TextScoreSetEvent($i_image_id, $event->user, $i_score));
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->page->set_mode("redirect");
|
$event->page->set_mode("redirect");
|
||||||
|
|
|
@ -13,7 +13,7 @@ class TextScoreTheme extends Themelet {
|
||||||
$s_score = $words[$score];
|
$s_score = $words[$score];
|
||||||
$html = "
|
$html = "
|
||||||
Current score is \"$s_score\"
|
Current score is \"$s_score\"
|
||||||
<br><form action='".make_link("score_text/vote")."' method='POST'>
|
<br><form action='".make_link("text_score/vote")."' method='POST'>
|
||||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||||
<input type='radio' name='score' value='-2' id='-2'><label for='-2'>Delete</label>
|
<input type='radio' name='score' value='-2' id='-2'><label for='-2'>Delete</label>
|
||||||
<input type='radio' name='score' value='-1' id='-1'><label for='-1'>Bad</label>
|
<input type='radio' name='score' value='-1' id='-1'><label for='-1'>Bad</label>
|
||||||
|
|
Reference in a new issue