summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-08-28 12:33:47 -0700
committerBharat Mediratta <bharat@menalto.com>2009-08-28 12:33:47 -0700
commite24d23bf14af8ac3bbcc2431c56be118f9f881b4 (patch)
tree04e5f043ddefc2efa197b007f1fe8eb6325ce0f1 /modules
parentb9aca313fade910254be14f8e25d9a6c41752851 (diff)
parent5133f93290e3ab0052909c27dcec05983c819ebe (diff)
Merge branch 'master' of git@github.com:talmdal/gallery3 into talmdal_branch
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/libraries/Sendmail.php4
-rw-r--r--modules/gallery/views/permissions_browse.html.php42
-rw-r--r--modules/notification/helpers/notification_event.php65
3 files changed, 71 insertions, 40 deletions
diff --git a/modules/gallery/libraries/Sendmail.php b/modules/gallery/libraries/Sendmail.php
index 90998457..7bc21a67 100644
--- a/modules/gallery/libraries/Sendmail.php
+++ b/modules/gallery/libraries/Sendmail.php
@@ -52,6 +52,7 @@ class Sendmail_Core {
break;
case "header":
if (count($value) != 2) {
+ Kohana::log("error", wordwrap("Invalid header parameters\n" . Kohana::debug($value)));
throw new Exception("@todo INVALID_HEADER_PARAMETERS");
}
$this->headers[$value[0]] = $value[1];
@@ -70,6 +71,7 @@ class Sendmail_Core {
public function send() {
if (empty($this->to)) {
+ Kohana::log("error", wordwrap("Sending mail failed:\nNo to address specified"));
throw new Exception("@todo TO_IS_REQUIRED_FOR_MAIL");
}
$to = implode(", ", $this->to);
@@ -84,8 +86,6 @@ class Sendmail_Core {
$headers = implode($this->header_separator, $headers);
$message = wordwrap($this->message, $this->line_length, "\n");
if (!$this->mail($to, $this->subject, $message, $headers)) {
- Kohana::log("error", wordwrap("Sending mail failed:\nTo: $to\n $this->subject\n" .
- "Headers: $headers\n $this->message"));
throw new Exception("@todo SEND_MAIL_FAILED");
}
return $this;
diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php
index 888a27f7..f990896c 100644
--- a/modules/gallery/views/permissions_browse.html.php
+++ b/modules/gallery/views/permissions_browse.html.php
@@ -5,8 +5,9 @@
$.ajax({
url: form_url.replace("__ITEM__", id),
success: function(data) {
- $("div.form").slideUp();
- $("div#edit-" + id).html(data).slideDown();
+ $("#gEditPermissionForm").html(data);
+ $(".active").removeClass("active");
+ $("#item-" + id).addClass("active");
}
});
}
@@ -18,7 +19,7 @@
url: action_url.replace("__CMD__", cmd).replace("__GROUP__", group_id).
replace("__PERM__", perm_id).replace("__ITEM__", item_id),
success: function(data) {
- $("div#edit-" + item_id).load(form_url.replace("__ITEM__", item_id));
+ $("#gEditPermissionForm").load(form_url.replace("__ITEM__", item_id));
}
});
}
@@ -31,26 +32,25 @@
</li>
</ul>
<? endif ?>
- <ul>
+
+ <p>Edit permissions for album:</p>
+
+ <ul class="gBreadcrumbs">
<? foreach ($parents as $parent): ?>
- <li>
+ <li id="item-<?= $parent->id ?>">
<a href="javascript:show(<?= $parent->id ?>)">
- <?= p::clean($parent->title) ?>
+ <?= p::purify($parent->title) ?>
</a>
- <div class="form" id="edit-<?= $parent->id ?>"></div>
- <ul>
- <? endforeach ?>
- <li>
- <a href="javascript:show(<?= $item->id ?>)">
- <?= p::purify($item->title) ?>
- </a>
- <div class="form" id="edit-<?= $item->id ?>">
- <?= $form ?>
- </div>
- </li>
- <? foreach ($parents as $parent): ?>
- </ul>
</li>
+ <? endforeach ?>
+ <li class="active" id="item-<?= $item->id ?>">
+ <a href="javascript:show(<?= $item->id ?>)">
+ <?= p::purify($item->title) ?></li>
+ </a>
+ </li>
</ul>
- <? endforeach ?>
-</div>
+
+ <div id="gEditPermissionForm">
+ <?= $form ?>
+ </div>
+</div> \ No newline at end of file
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php
index d1b76e93..8fbeda92 100644
--- a/modules/notification/helpers/notification_event.php
+++ b/modules/notification/helpers/notification_event.php
@@ -18,42 +18,73 @@
* 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_updated($original, $new) {
- notification::send_item_updated($new);
+ try {
+ notification::send_item_updated($new);
+ } catch (Exception $e) {
+ Kohana::log("error", "@todo notification_event::item_updated() failed");
+ }
}
static function item_created($item) {
- notification::send_item_add($item);
+ try {
+ notification::send_item_add($item);
+ } catch (Exception $e) {
+ Kohana::log("error", "@todo notification_event::item_created() failed");
+ }
}
static function item_deleted($item) {
- notification::send_item_deleted($item);
+ try {
+ notification::send_item_deleted($item);
- if (notification::is_watching($item)) {
- notification::remove_watch($item);
+ if (notification::is_watching($item)) {
+ notification::remove_watch($item);
+ }
+ } catch (Exception $e) {
+ Kohana::log("error", "@todo notification_event::item_deleted() failed");
}
}
static function comment_created($comment) {
- if ($comment->state == "published") {
- notification::send_comment_published($comment);
+ try {
+ if ($comment->state == "published") {
+ notification::send_comment_published($comment);
+ }
+ } catch (Exception $e) {
+ Kohana::log("error", "@todo notification_event::comment_created() failed");
}
}
static function comment_updated($original, $new) {
- if ($new->state == "published" && $original->state != "published") {
- notification::send_comment_published($new);
+ try {
+ if ($new->state == "published" && $original->state != "published") {
+ notification::send_comment_published($new);
+ }
+ } catch (Exception $e) {
+ Kohana::log("error", "@todo notification_event::comment_updated() failed");
}
}
static function user_before_delete($user) {
- ORM::factory("subscription")
- ->where("user_id", $user->id)
- ->delete_all();
+ try {
+ ORM::factory("subscription")
+ ->where("user_id", $user->id)
+ ->delete_all();
+ } catch (Exception $e) {
+ Kohana::log("error", "@todo notification_event::user_before_delete() failed");
+ }
}
static function batch_complete() {
- notification::send_pending_notifications();
+ try {
+ notification::send_pending_notifications();
+ } catch (Exception $e) {
+ Kohana::log("error", "@todo notification_event::batch_complete() failed");
+ }
}
static function site_menu($menu, $theme) {
@@ -67,10 +98,10 @@ class notification_event_Core {
$menu->get("options_menu")
->append(Menu::factory("link")
- ->id("watch")
- ->label($label)
- ->css_id("gNotifyLink")
- ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token())));
+ ->id("watch")
+ ->label($label)
+ ->css_id("gNotifyLink")
+ ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token())));
}
}
}