summaryrefslogtreecommitdiff
path: root/modules/notification
diff options
context:
space:
mode:
authorTristan Zur <tzur@webserver.ccwn.org>2015-06-10 20:55:53 +0200
committerTristan Zur <tzur@webserver.ccwn.org>2015-06-10 20:55:53 +0200
commit406abd7c4df1ace2cd3e4e17159e8941a2e8c0c4 (patch)
treea324be16021f44f2fd6d55e609f47024e945b1db /modules/notification
Initial import
Diffstat (limited to 'modules/notification')
-rw-r--r--modules/notification/controllers/notification.php36
-rw-r--r--modules/notification/helpers/notification.php218
-rw-r--r--modules/notification/helpers/notification_event.php149
-rw-r--r--modules/notification/helpers/notification_installer.php54
-rw-r--r--modules/notification/models/pending_notification.php21
-rw-r--r--modules/notification/models/subscription.php21
-rw-r--r--modules/notification/module.info7
-rw-r--r--modules/notification/views/comment_published.html.php35
-rw-r--r--modules/notification/views/item_added.html.php29
-rw-r--r--modules/notification/views/item_deleted.html.php25
-rw-r--r--modules/notification/views/item_updated.html.php35
-rw-r--r--modules/notification/views/user_profile_notification.html.php12
12 files changed, 642 insertions, 0 deletions
diff --git a/modules/notification/controllers/notification.php b/modules/notification/controllers/notification.php
new file mode 100644
index 0000000..67f8ed3
--- /dev/null
+++ b/modules/notification/controllers/notification.php
@@ -0,0 +1,36 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2013 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Notification_Controller extends Controller {
+ function watch($id) {
+ access::verify_csrf();
+
+ $item = ORM::factory("item", $id);
+ access::required("view", $item);
+
+ if (notification::is_watching($item)) {
+ notification::remove_watch($item);
+ message::success(sprintf(t("You are no longer watching %s"), html::purify($item->title)));
+ } else {
+ notification::add_watch($item);
+ message::success(sprintf(t("You are now watching %s"), html::purify($item->title)));
+ }
+ url::redirect($item->abs_url());
+ }
+}
diff --git a/modules/notification/helpers/notification.php b/modules/notification/helpers/notification.php
new file mode 100644
index 0000000..96493a2
--- /dev/null
+++ b/modules/notification/helpers/notification.php
@@ -0,0 +1,218 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2013 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class notification {
+ static function get_subscription($item_id, $user=null) {
+ if (empty($user)) {
+ $user = identity::active_user();
+ }
+
+ return ORM::factory("subscription")
+ ->where("item_id", "=", $item_id)
+ ->where("user_id", "=", $user->id)
+ ->find();
+ }
+
+ static function is_watching($item, $user=null) {
+ if (empty($user)) {
+ $user = identity::active_user();
+ }
+
+ return ORM::factory("subscription")
+ ->where("item_id", "=", $item->id)
+ ->where("user_id", "=", $user->id)
+ ->find()
+ ->loaded();
+ }
+
+ static function add_watch($item, $user=null) {
+ if ($item->is_album()) {
+ if (empty($user)) {
+ $user = identity::active_user();
+ }
+ $subscription = ORM::factory("subscription");
+ $subscription->item_id = $item->id;
+ $subscription->user_id = $user->id;
+ $subscription->save();
+ }
+ }
+
+ static function remove_watch($item, $user=null) {
+ if ($item->is_album()) {
+ if (empty($user)) {
+ $user = identity::active_user();
+ }
+
+ $subscription = ORM::factory("subscription")
+ ->where("item_id", "=", $item->id)
+ ->where("user_id", "=", $user->id)
+ ->find()->delete();
+ }
+ }
+
+ static function get_subscribers($item) {
+ $subscriber_ids = array();
+ foreach (ORM::factory("subscription")
+ ->select("user_id")
+ ->join("items", "subscriptions.item_id", "items.id")
+ ->where("items.left_ptr", "<=", $item->left_ptr)
+ ->where("items.right_ptr", ">", $item->right_ptr)
+ ->find_all()
+ ->as_array() as $subscriber) {
+ $subscriber_ids[] = $subscriber->user_id;
+ }
+
+ if (empty($subscriber_ids)) {
+ return array();
+ }
+ $users = identity::get_user_list($subscriber_ids);
+
+ $subscribers = array();
+ foreach ($users as $user) {
+ if (access::user_can($user, "view", $item) && !empty($user->email)) {
+ $subscribers[$user->email] = $user->locale;
+ }
+ }
+ return $subscribers;
+ }
+
+ static function send_item_updated($original, $item) {
+ foreach (self::get_subscribers($item) as $email => $locale) {
+ $v = new View("item_updated.html");
+ $v->original = $original;
+ $v->item = $item;
+ $v->subject = $item->is_album() ?
+ t("Album \"%title\" updated", array("title" => $original->title, "locale" => $locale)) :
+ ($item->is_photo() ?
+ t("Photo \"%title\" updated", array("title" => $original->title, "locale" => $locale))
+ : t("Movie \"%title\" updated", array("title" => $original->title, "locale" => $locale)));
+ self::_notify($email, $locale, $item, $v->render(), $v->subject);
+ }
+ }
+
+ static function send_item_add($item) {
+ $parent = $item->parent();
+ foreach (self::get_subscribers($item) as $email => $locale) {
+ $v = new View("item_added.html");
+ $v->item = $item;
+ $v->subject = $item->is_album() ?
+ t("Album \"%title\" added to \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale)) :
+ ($item->is_photo() ?
+ t("Photo \"%title\" added to \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale)) :
+ t("Movie \"%title\" added to \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale)));
+ self::_notify($email, $locale, $item, $v->render(), $v->subject);
+ }
+ }
+
+ static function send_item_deleted($item) {
+ $parent = $item->parent();
+ foreach (self::get_subscribers($item) as $email => $locale) {
+ $v = new View("item_deleted.html");
+ $v->item = $item;
+ $v->subject = $item->is_album() ?
+ t("Album \"%title\" removed from \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale)) :
+ ($item->is_photo() ?
+ t("Photo \"%title\" removed from \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale))
+ : t("Movie \"%title\" removed from \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title,
+ "locale" => $locale)));
+ self::_notify($email, $locale, $item, $v->render(), $v->subject);
+ }
+ }
+
+ static function send_comment_published($comment) {
+ $item = $comment->item();
+ foreach (self::get_subscribers($item) as $email => $locale) {
+ $v = new View("comment_published.html");
+ $v->comment = $comment;
+ $v->subject = $item->is_album() ?
+ t("A new comment was published for album \"%title\"",
+ array("title" => $item->title, "locale" => $locale)) :
+ ($item->is_photo() ?
+ t("A new comment was published for photo \"%title\"",
+ array("title" => $item->title, "locale" => $locale))
+ : t("A new comment was published for movie \"%title\"",
+ array("title" => $item->title, "locale" => $locale)));
+ self::_notify($email, $locale, $item, $v->render(), $v->subject);
+ }
+ }
+
+ static function send_pending_notifications() {
+ foreach (db::build()
+ ->select(db::expr("DISTINCT `email`"))
+ ->from("pending_notifications")
+ ->execute() as $row) {
+ $email = $row->email;
+ $result = ORM::factory("pending_notification")
+ ->where("email", "=", $email)
+ ->find_all();
+ if ($result->count() == 1) {
+ $pending = $result->current();
+ Sendmail::factory()
+ ->to($email)
+ ->subject($pending->subject)
+ ->header("Mime-Version", "1.0")
+ ->header("Content-Type", "text/html; charset=UTF-8")
+ ->message($pending->text)
+ ->send();
+ $pending->delete();
+ } else {
+ $text = "";
+ $locale = null;
+ foreach ($result as $pending) {
+ $text .= $pending->text;
+ $locale = $pending->locale;
+ $pending->delete();
+ }
+ Sendmail::factory()
+ ->to($email)
+ ->subject(t("New activity for %site_name",
+ array("site_name" => item::root()->title, "locale" => $locale)))
+ ->header("Mime-Version", "1.0")
+ ->header("Content-Type", "text/html; charset=UTF-8")
+ ->message($text)
+ ->send();
+ }
+ }
+ }
+
+ private static function _notify($email, $locale, $item, $text, $subject) {
+ if (!batch::in_progress()) {
+ Sendmail::factory()
+ ->to($email)
+ ->subject($subject)
+ ->header("Mime-Version", "1.0")
+ ->header("Content-Type", "text/html; charset=UTF-8")
+ ->message($text)
+ ->send();
+ } else {
+ $pending = ORM::factory("pending_notification");
+ $pending->subject = $subject;
+ $pending->text = $text;
+ $pending->email = $email;
+ $pending->locale = $locale;
+ $pending->save();
+ }
+ }
+}
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php
new file mode 100644
index 0000000..264ec55
--- /dev/null
+++ b/modules/notification/helpers/notification_event.php
@@ -0,0 +1,149 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2013 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class notification_event_Core {
+ // The assumption is that the exception was logged at a lower level, but we
+ // don't want to screw up the processing that was generating the notification
+ // so we don't pass the exception up the call stack
+ static function item_created($item) {
+ try {
+ notification::send_item_add($item);
+ } catch (Exception $e) {
+ Kohana_Log::add("error", "@todo notification_event::item_created() failed");
+ Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
+ }
+
+ static function item_deleted($item) {
+ try {
+ notification::send_item_deleted($item);
+
+ if (notification::is_watching($item)) {
+ notification::remove_watch($item);
+ }
+ } catch (Exception $e) {
+ Kohana_Log::add("error", "@todo notification_event::item_deleted() failed");
+ Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
+ }
+
+ static function user_deleted($user) {
+ db::build()
+ ->delete("subscriptions")
+ ->where("user_id", "=", $user->id)
+ ->execute();
+ }
+
+ static function identity_provider_changed($old_provider, $new_provider) {
+ db::build()
+ ->delete("subscriptions")
+ ->execute();
+ }
+
+ static function comment_created($comment) {
+ try {
+ if ($comment->state == "published") {
+ notification::send_comment_published($comment);
+ }
+ } catch (Exception $e) {
+ Kohana_Log::add("error", "@todo notification_event::comment_created() failed");
+ Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
+ }
+
+ static function comment_updated($original, $new) {
+ try {
+ if ($new->state == "published" && $original->state != "published") {
+ notification::send_comment_published($new);
+ }
+ } catch (Exception $e) {
+ Kohana_Log::add("error", "@todo notification_event::comment_updated() failed");
+ Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
+ }
+
+ static function user_before_delete($user) {
+ try {
+ db::build()
+ ->delete("subscriptions")
+ ->where("user_id", "=", $user->id)
+ ->execute();
+ } catch (Exception $e) {
+ Kohana_Log::add("error", "@todo notification_event::user_before_delete() failed");
+ Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
+ }
+
+ static function batch_complete() {
+ try {
+ notification::send_pending_notifications();
+ } catch (Exception $e) {
+ Kohana_Log::add("error", "@todo notification_event::batch_complete() failed");
+ Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
+ }
+
+ static function site_menu($menu, $theme) {
+ if (!identity::active_user()->guest) {
+ $item = $theme->item();
+
+ if ($item && $item->is_album() && access::can("view", $item)) {
+ $watching = notification::is_watching($item);
+
+ $label = $watching ? t("Remove notifications") : t("Enable notifications");
+
+ $menu->get("options_menu")
+ ->append(Menu::factory("link")
+ ->id("watch")
+ ->label($label)
+ ->css_id("g-notify-link")
+ ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token())));
+ }
+ }
+ }
+
+ static function show_user_profile($data) {
+ // Guests don't see comment listings
+ if (identity::active_user()->guest) {
+ return;
+ }
+
+ // Only logged in users can see their comment listings
+ if (identity::active_user()->id != $data->user->id) {
+ return;
+ }
+
+ $view = new View("user_profile_notification.html");
+ $view->subscriptions = array();
+ foreach(ORM::factory("subscription")
+ ->where("user_id", "=", $data->user->id)
+ ->find_all() as $subscription) {
+ $item = ORM::factory("item")
+ ->where("id", "=", $subscription->item_id)
+ ->find();
+ if ($item->loaded()) {
+ $view->subscriptions[] = (object)array("id" => $subscription->id, "title" => $item->title,
+ "url" => $item->url());
+ }
+ }
+ if (count($view->subscriptions) > 0) {
+ $data->content[] = (object)array("title" => t("Watching"), "view" => $view);
+ }
+ }
+} \ No newline at end of file
diff --git a/modules/notification/helpers/notification_installer.php b/modules/notification/helpers/notification_installer.php
new file mode 100644
index 0000000..f6b05c1
--- /dev/null
+++ b/modules/notification/helpers/notification_installer.php
@@ -0,0 +1,54 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2013 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class notification_installer {
+ static function install() {
+ $db = Database::instance();
+ $db->query("CREATE TABLE IF NOT EXISTS {subscriptions} (
+ `id` int(9) NOT NULL auto_increment,
+ `item_id` int(9) NOT NULL,
+ `user_id` int(9) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY (`item_id`, `user_id`),
+ UNIQUE KEY (`user_id`, `item_id`))
+ DEFAULT CHARSET=utf8;");
+ $db->query("CREATE TABLE IF NOT EXISTS {pending_notifications} (
+ `id` int(9) NOT NULL auto_increment,
+ `locale` char(10) default NULL,
+ `email` varchar(128) NOT NULL,
+ `subject` varchar(255) NOT NULL,
+ `text` text,
+ PRIMARY KEY (`id`))
+ DEFAULT CHARSET=utf8;");
+ }
+
+ static function upgrade($version) {
+ $db = Database::instance();
+ if ($version == 1) {
+ $db->query("ALTER TABLE {pending_notifications} ADD COLUMN `locale` char(10) default NULL");
+ module::set_version("notification", $version = 2);
+ }
+ }
+
+ static function uninstall() {
+ $db = Database::instance();
+ $db->query("DROP TABLE IF EXISTS {subscriptions};");
+ $db->query("DROP TABLE IF EXISTS {pending_notifications};");
+ }
+}
diff --git a/modules/notification/models/pending_notification.php b/modules/notification/models/pending_notification.php
new file mode 100644
index 0000000..4033aed
--- /dev/null
+++ b/modules/notification/models/pending_notification.php
@@ -0,0 +1,21 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2013 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Pending_Notification_Model_Core extends ORM {
+} \ No newline at end of file
diff --git a/modules/notification/models/subscription.php b/modules/notification/models/subscription.php
new file mode 100644
index 0000000..64996b6
--- /dev/null
+++ b/modules/notification/models/subscription.php
@@ -0,0 +1,21 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2013 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Subscription_Model_Core extends ORM {
+} \ No newline at end of file
diff --git a/modules/notification/module.info b/modules/notification/module.info
new file mode 100644
index 0000000..0e2cdb6
--- /dev/null
+++ b/modules/notification/module.info
@@ -0,0 +1,7 @@
+name = "Notification"
+description = "Send notifications to users when changes are made to watched albums."
+version = 2
+author_name = "Gallery Team"
+author_url = "http://codex.galleryproject.org/Gallery:Team"
+info_url = "http://codex.galleryproject.org/Gallery3:Modules:notification"
+discuss_url = "http://galleryproject.org/forum_module_notification"
diff --git a/modules/notification/views/comment_published.html.php b/modules/notification/views/comment_published.html.php
new file mode 100644
index 0000000..ac36a2c
--- /dev/null
+++ b/modules/notification/views/comment_published.html.php
@@ -0,0 +1,35 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<html>
+ <head>
+ <title><?= html::clean($subject) ?> </title>
+ </head>
+ <body>
+ <h2><?= html::clean($subject) ?></h2>
+ <table>
+ <tr>
+ <td><?= t("Comment:") ?></td>
+ <td><?= nl2br(html::purify($comment->text)) ?></td>
+ </tr>
+ <tr>
+ <td><?= t("Author name:") ?></td>
+ <td><?= html::clean($comment->author_name()) ?></td>
+ </tr>
+ <tr>
+ <td><?= t("Author email:") ?></td>
+ <td><?= html::clean($comment->author_email()) ?></td>
+ </tr>
+ <tr>
+ <td><?= t("Author URL:") ?></td>
+ <td><?= html::clean($comment->author_url()) ?></td>
+ </tr>
+ <tr>
+ <td><?= t("Url:") ?></td>
+ <td>
+ <a href="<?= $comment->item()->abs_url() ?>#comments">
+ <?= $comment->item()->abs_url() ?>#comments
+ </a>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/modules/notification/views/item_added.html.php b/modules/notification/views/item_added.html.php
new file mode 100644
index 0000000..1ea3720
--- /dev/null
+++ b/modules/notification/views/item_added.html.php
@@ -0,0 +1,29 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<html>
+ <head>
+ <title><?= html::clean($subject) ?> </title>
+ </head>
+ <body>
+ <h2><?= html::clean($subject) ?></h2>
+ <table>
+ <tr>
+ <td><?= t("Title:") ?></td>
+ <td><?= html::purify($item->title) ?></td>
+ </tr>
+ <tr>
+ <td><?= t("Url:") ?></td>
+ <td>
+ <a href="<?= $item->abs_url() ?>">
+ <?= $item->abs_url() ?>
+ </a>
+ </td>
+ </tr>
+ <? if ($item->description): ?>
+ <tr>
+ <td><?= t("Description:") ?></td>
+ <td><?= nl2br(html::purify($item->description)) ?></td>
+ </tr>
+ <? endif ?>
+ </table>
+ </body>
+</html>
diff --git a/modules/notification/views/item_deleted.html.php b/modules/notification/views/item_deleted.html.php
new file mode 100644
index 0000000..a95cdd8
--- /dev/null
+++ b/modules/notification/views/item_deleted.html.php
@@ -0,0 +1,25 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<html>
+ <head>
+ <title><?= html::clean($subject) ?> </title>
+ </head>
+ <body>
+ <h2><?= html::clean($subject) ?></h2>
+ <table>
+ <tr>
+ <td colspan="2">
+ <?= t("To view the changed album %title use the link below.",
+ array("title" => html::purify($item->parent()->title))) ?>
+ </td>
+ </tr>
+ <tr>
+ <td><?= t("Url:") ?></td>
+ <td>
+ <a href="<?= $item->parent()->abs_url() ?>">
+ <?= $item->parent()->abs_url() ?>
+ </a>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/modules/notification/views/item_updated.html.php b/modules/notification/views/item_updated.html.php
new file mode 100644
index 0000000..7020fd5
--- /dev/null
+++ b/modules/notification/views/item_updated.html.php
@@ -0,0 +1,35 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<html>
+ <head>
+ <title><?= html::clean($subject) ?> </title>
+ </head>
+ <body>
+ <h2> <?= html::clean($subject) ?> </h2>
+ <table>
+ <tr>
+ <? if ($original->title != $item->title): ?>
+ <td><?= t("New title:") ?></td>
+ <td><?= html::clean($item->title) ?></td>
+ <? else: ?>
+ <td><?= t("Title:") ?></td>
+ <td><?= html::clean($item->title) ?></td>
+ <? endif ?>
+ </tr>
+ <tr>
+ <td><?= t("Url:") ?></td>
+ <td><a href="<?= $item->abs_url() ?>"><?= $item->abs_url() ?></a></td>
+ </tr>
+ <? if ($original->description != $item->description): ?>
+ <tr>
+ <td><?= t("New description:") ?></td>
+ <td><?= html::clean($item->description) ?></td>
+ </tr>
+ <? elseif (!empty($item->description)): ?>
+ <tr>
+ <td><?= t("Description:") ?></td>
+ <td><?= html::clean($item->description) ?></td>
+ </tr>
+ <? endif ?>
+ </table>
+ </body>
+</html>
diff --git a/modules/notification/views/user_profile_notification.html.php b/modules/notification/views/user_profile_notification.html.php
new file mode 100644
index 0000000..8864f0c
--- /dev/null
+++ b/modules/notification/views/user_profile_notification.html.php
@@ -0,0 +1,12 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="g-notification-detail">
+<ul>
+ <? foreach ($subscriptions as $subscription): ?>
+ <li id="g-watch-<?= $subscription->id ?>">
+ <a href="<?= $subscription->url ?>">
+ <?= html::purify($subscription->title) ?>
+ </a>
+ </li>
+ <? endforeach ?>
+</ul>
+</div>