1
0

Fixed typo in admin area

Added option to hide the user cloud for guests
Don't send notification mail on new comment when notification module is active and user is watching item
This commit is contained in:
hukoeth 2010-09-09 22:14:18 +08:00 committed by Bharat Mediratta
parent b7ee10fce4
commit daf1d8a66c
4 changed files with 37 additions and 14 deletions

View File

@ -89,6 +89,8 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
"photoannotation", "nonotifications", $form->notifications->nonotifications->value, true);
module::set_var(
"photoannotation", "notificationoptout", $form->notifications->notificationoptout->value, true);
module::set_var(
"photoannotation", "allowguestsearch", $form->notifications->allowguestsearch->value, true);
module::set_var(
"photoannotation", "newtagsubject", strip_tags($form->newtagmail->newtagsubject->value));
module::set_var(
@ -251,19 +253,21 @@ class Admin_Photoannotation_Controller extends Admin_Controller {
->value(module::get_var("photoannotation", "hovercolor", "990000"))
->rules("valid_alpha_numeric|length[6]");
$group = $form->group("legendsettings")->label(t("Legend settings"));
$group->checkbox("showusers")->label(t("Show face annotation below photo."))
$group->checkbox("showusers")->label(t("Show user annotations below photo."))
->checked(module::get_var("photoannotation", "showusers", false));
$group->checkbox("showfaces")->label(t("Show face annotation below photo."))
$group->checkbox("showfaces")->label(t("Show tag annotations below photo."))
->checked(module::get_var("photoannotation", "showfaces", false));
$group->checkbox("shownotes")->label(t("Show note annotations below photo."))
->checked(module::get_var("photoannotation", "shownotes", false));
$group->checkbox("fullname")->label(t("Show full name of a user instead of the username on annotations (username will be dispayed for users without a full name)."))
->checked(module::get_var("photoannotation", "fullname", false));
$group = $form->group("notifications")->label(t("Notification settings"));
$group = $form->group("notifications")->label(t("Notification and user cloud settings"));
$group->checkbox("nonotifications")->label(t("Disable user notifications."))
->checked(module::get_var("photoannotation", "nonotifications", false));
$group->checkbox("notificationoptout")->label(t("Notify users by default (only applies to new users and user who have not saved their profile after installing this module)."))
->checked(module::get_var("photoannotation", "notificationoptout", false));
$group->checkbox("allowguestsearch")->label(t("Show user cloud and allow user search for guests."))
->checked(module::get_var("photoannotation", "allowguestsearch", false));
$group = $form->group("newtagmail")->label(t("Customize the mail sent to users when a user annotation is created"));
$group->input("newtagsubject")->label(t("Subject"))
->value(module::get_var("photoannotation", "newtagsubject", "Someone tagged a photo of you"));

View File

@ -18,7 +18,12 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class photoannotation_Controller extends Controller {
public function showuser($item_id) {
public function showuser() {
if (identity::active_user()->guest && !module::get_var("photoannotation", "allowguestsearch", false)) {
message::error(t("You have to log in to perform a user search."));
url::redirect(url::site());
return;
}
$form = photoannotation::get_user_search_form("g-user-cloud-form");
$user_id = Input::instance()->get("name", "");
if ($user_id == "") {
@ -40,10 +45,10 @@ class photoannotation_Controller extends Controller {
list ($count, $result) = photoannotation::search_user($user_id, $page_size, $offset);
$max_pages = max(ceil($count / $page_size), 1);
if ($page > 1) {
$previous_page_url = url::site("photoannotation/showuser/". $item_id ."?name=". $user_id ."&page=". ($page - 1));
$previous_page_url = url::site("photoannotation/showuser?name=". $user_id ."&page=". ($page - 1));
}
if ($page < $max_pages) {
$next_page_url = url::site("photoannotation/showuser/". $item_id ."?name=". $user_id ."&amp;page=". ($page + 1));
$next_page_url = url::site("photoannotation/showuser?name=". $user_id ."&amp;page=". ($page + 1));
}
if ($user_id == "") {
$user_id = "*";

View File

@ -171,6 +171,12 @@ class photoannotation_Core {
case "newcomment":
//Only send if user has this option enabled
if ($notification_settings->comment) {
//Don't send if the notification module is active and the user is watching this item
if (module::is_active("notification")) {
if (notification::is_watching($item, $recipient)) {
return false;
}
}
//Get subject and body and send the mail
$subject = module::get_var("photoannotation", "newcommentsubject", "Someone added a comment to photo of you");
$body = module::get_var("photoannotation", "newcommentbody", "Hello %name, please visit %url to read the comment.");
@ -181,6 +187,12 @@ class photoannotation_Core {
case "updatecomment":
//Only send if user has this option enabled
if ($notification_settings->comment) {
//Don't send if the notification module is active and the user is watching this item
if (module::is_active("notification")) {
if (notification::is_watching($item, $recipient)) {
return false;
}
}
//Get subject and body and send the mail
$subject = module::get_var("photoannotation", "updatedcommentsubject", "Someone updated a comment to photo of you");
$body = module::get_var("photoannotation", "updatedcommentbody", "Hello %name, please visit %url to read the comment.");

View File

@ -24,15 +24,17 @@ class photoannotation_block_Core {
static function get($block_id, $theme) {
$block = "";
switch ($block_id) {
case "photoannotation":
$block = new Block();
$block->css_id = "g-photoannotation";
$block->title = t("Users");
$block->content = new View("photoannotation_block.html");
$block->content->cloud = photoannotation::cloud(30);
$block->content->form = photoannotation::get_user_search_form("g-user-cloud-form");
if (!identity::active_user()->guest || module::get_var("photoannotation", "allowguestsearch", false)) {
switch ($block_id) {
case "photoannotation":
$block = new Block();
$block->css_id = "g-photoannotation";
$block->title = t("Users");
$block->content = new View("photoannotation_block.html");
$block->content->cloud = photoannotation::cloud(30);
$block->content->form = photoannotation::get_user_search_form("g-user-cloud-form");
}
}
return $block;
}
}