Anonymous toggle for voting things
git-svn-id: file:///home/shish/svn/shimmie2/trunk@543 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
252bea060d
commit
a2551cf3eb
@ -28,6 +28,7 @@ class NumericScore extends Extension {
|
|||||||
if($config->get_int("ext_numeric_score_version", 0) < 1) {
|
if($config->get_int("ext_numeric_score_version", 0) < 1) {
|
||||||
$this->install();
|
$this->install();
|
||||||
}
|
}
|
||||||
|
$config->set_default_bool("numeric_score_anon", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_a($event, 'PageRequestEvent') && $event->page_name == "numeric_score" &&
|
if(is_a($event, 'PageRequestEvent') && $event->page_name == "numeric_score" &&
|
||||||
@ -45,18 +46,22 @@ class NumericScore extends Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(is_a($event, 'NumericScoreSetEvent')) {
|
if(is_a($event, 'NumericScoreSetEvent')) {
|
||||||
|
if(!$event->user->is_anonymous() || $config->get_bool("numeric_score_anon")) {
|
||||||
$this->add_vote($event->image_id, $event->user->id, $event->score);
|
$this->add_vote($event->image_id, $event->user->id, $event->score);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(is_a($event, 'DisplayingImageEvent')) {
|
if(is_a($event, 'DisplayingImageEvent')) {
|
||||||
|
global $user;
|
||||||
|
if(!$user->is_anonymous() || $config->get_bool("numeric_score_anon")) {
|
||||||
$this->theme->display_voter($event->page, $event->image->id, $event->image->numeric_score);
|
$this->theme->display_voter($event->page, $event->image->id, $event->image->numeric_score);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(is_a($event, 'SetupBuildingEvent')) {
|
if(is_a($event, 'SetupBuildingEvent')) {
|
||||||
/*
|
$sb = new SetupBlock("Numeric Score");
|
||||||
TODO: disable anon voting
|
$sb->add_bool_option("numeric_score_anon", "Allow anonymous votes: ");
|
||||||
TODO: switch between average and sum modes
|
$event->panel->add_block($sb);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class TextScore extends Extension {
|
|||||||
if($config->get_int("ext_text_score_version", 0) < 1) {
|
if($config->get_int("ext_text_score_version", 0) < 1) {
|
||||||
$this->install();
|
$this->install();
|
||||||
}
|
}
|
||||||
|
$config->set_default_bool("text_score_anon", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_a($event, 'PageRequestEvent') && $event->page_name == "text_score" &&
|
if(is_a($event, 'PageRequestEvent') && $event->page_name == "text_score" &&
|
||||||
@ -45,18 +46,22 @@ class TextScore extends Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(is_a($event, 'TextScoreSetEvent')) {
|
if(is_a($event, 'TextScoreSetEvent')) {
|
||||||
|
if(!$event->user->is_anonymous() || $config->get_bool("text_score_anon")) {
|
||||||
$this->add_vote($event->image_id, $event->user->id, $event->score);
|
$this->add_vote($event->image_id, $event->user->id, $event->score);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(is_a($event, 'DisplayingImageEvent')) {
|
if(is_a($event, 'DisplayingImageEvent')) {
|
||||||
|
global $user;
|
||||||
|
if(!$user->is_anonymous() || $config->get_bool("text_score_anon")) {
|
||||||
$this->theme->display_scorer($event->page, $event->image->id, $event->image->text_score);
|
$this->theme->display_scorer($event->page, $event->image->id, $event->image->text_score);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(is_a($event, 'SetupBuildingEvent')) {
|
if(is_a($event, 'SetupBuildingEvent')) {
|
||||||
/*
|
$sb = new SetupBlock("Text Score");
|
||||||
TODO: disable anon voting
|
$sb->add_bool_option("text_score_anon", "Allow anonymous votes: ");
|
||||||
TODO: switch between average and sum modes
|
$event->panel->add_block($sb);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user