diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-03-04 06:25:55 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-03-04 06:25:55 +0000 |
commit | b493a534f2966e23eb0244654e8929320721da8e (patch) | |
tree | 93f239b73a197d94300620bbf821599fceda96e3 /modules/notification/views | |
parent | 83e12961b13d1ab1e11a60e30b335d26b1875a25 (diff) |
A variety of cleanups:
* Allow for the "movie" type in all of our text
* Try to follow the pattern of mainly only passing ORM objects
to the view and let it generate its own text (this becomes
even more important when 3rd parties want to customize notification
messages)
* Rename _send_message to be _notify_subscribers to be more acccurate
and have it explicitly take a subject in the API
* Use Item_Model::url() in the views instead of hand crafting URLs
* Reformat HTML in views
* Use $comment->author_xxx() functions instead of replicating that code
* Fix several places where we were encoding data by doing ucfirst($item->type)
with conditionals where we form the text properly. We should *never*
be showing data types to the end user! This is not localizable!
Note that this probably breaks the existing batch processing code. I
am going to redo that in a subsequent pass.
Diffstat (limited to 'modules/notification/views')
-rw-r--r-- | modules/notification/views/comment_published.html.php | 44 | ||||
-rw-r--r-- | modules/notification/views/item_added.html.php | 44 | ||||
-rw-r--r-- | modules/notification/views/item_deleted.html.php | 33 | ||||
-rw-r--r-- | modules/notification/views/item_updated.html.php | 63 |
4 files changed, 99 insertions, 85 deletions
diff --git a/modules/notification/views/comment_published.html.php b/modules/notification/views/comment_published.html.php index 4a7936e6..23588c72 100644 --- a/modules/notification/views/comment_published.html.php +++ b/modules/notification/views/comment_published.html.php @@ -1,19 +1,31 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <html> -<head> - <title><?= $subject ?> </title> -</head> -<body> - <h2><?= sprintf(t("A new comment was added by %s"), $author); ?></h2> - <table> - <tr> - <td><?= t("Comment:") ?></td> - <td><?= $text ?></td> - </tr> - <tr> - <td><?= t("Url:") ?></td> - <td><a href="<?= $url ?>"><?= $url ?></a></td> - </tr> - </table> -</body> + <head> + <title><?= $subject ?> </title> + </head> + <body> + <h2><?= $subject ?></h2> + <table> + <tr> + <td><?= t("Comment:") ?></td> + <td><?= $comment->text ?></td> + </tr> + <tr> + <td><?= t("Author Name:") ?></td> + <td><?= $comment->author_name() ?></td> + </tr> + <tr> + <td><?= t("Author Email:") ?></td> + <td><?= $comment->author_email() ?></td> + </tr> + <tr> + <td><?= t("Author URL:") ?></td> + <td><?= $comment->author_url() ?></td> + </tr> + <tr> + <td><?= t("Url:") ?></td> + <td><a href="<?= $comment->item()->url(array(), true) ?>#comments"><?= $comment->item()->url(array(), true) ?>#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 index 1832fb39..b67b9f38 100644 --- a/modules/notification/views/item_added.html.php +++ b/modules/notification/views/item_added.html.php @@ -1,25 +1,25 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <html> -<head> - <title><?= $subject ?> </title> -</head> -<body> - <h2><?= sprintf(t("A new %s was added to %s"), $type, $parent_title); ?></h2> - <table> - <tr> - <td><?= t("Title:") ?></td> - <td><?= $item_title ?></td> - </tr> - <tr> - <td><?= t("Url:") ?></td> - <td><a href="<?= $url ?>"><?= $url ?></a></td> - </tr> - <? if (!empty($description)): ?> - <tr> - <td><?= t("Description:") ?></td> - <td><?= $description ?></td> - </tr> - <? endif ?> - </table> -</body> + <head> + <title><?= $subject ?> </title> + </head> + <body> + <h2><?= $subject ?></h2> + <table> + <tr> + <td><?= t("Title:") ?></td> + <td><?= $item->title ?></td> + </tr> + <tr> + <td><?= t("Url:") ?></td> + <td><a href="<?= $item->url(array(), true) ?>"><?= $item->url(array(), true) ?></a></td> + </tr> + <? if ($item->description): ?> + <tr> + <td><?= t("Description:") ?></td> + <td><?= $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 index f3e098da..ac9ab594 100644 --- a/modules/notification/views/item_deleted.html.php +++ b/modules/notification/views/item_deleted.html.php @@ -1,18 +1,21 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <html> -<head> - <title><?= $subject ?> </title> -</head> -<body> - <h2><?= sprintf(t("%s: %s was removed from %s"), $type, $item_title, $parent_title) ?></h2> - <table> - <tr> - <td colspan="2"><?= sprintf(t("To view the changed album %s use the link below."), $parent_title) ?></td> - </tr> - <tr> - <td><?= t("Url:") ?></td> - <td><a href="<?= $url ?>"><?= $url ?></a></td> - </tr> - </table> -</body> + <head> + <title><?= $subject ?> </title> + </head> + <body> + <h2><?= $subject ?></h2> + <table> + <tr> + <td colspan="2"> + <?= t("To view the changed album %title use the link below.", + array("title" => $item->parent()->title)) ?> + </td> + </tr> + <tr> + <td><?= t("Url:") ?></td> + <td><a href="<?= $item->parent()->url(array(), true) ?>"><?= $item->parent()->url(array(), true) ?></a></td> + </tr> + </table> + </body> </html> diff --git a/modules/notification/views/item_updated.html.php b/modules/notification/views/item_updated.html.php index 126bd5cc..cba522e8 100644 --- a/modules/notification/views/item_updated.html.php +++ b/modules/notification/views/item_updated.html.php @@ -1,36 +1,35 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <html> -<head> - <title><?= $subject ?> </title> -</head> -<body> - <h2><?= sprintf(t("%s %s was updated"), ucfirst($type), $item_title); ?></h2> - <table> - <tr> - <? if (!empty($new_title)): ?> - <td><?= t("New Title:") ?></td> - <td><?= $new_title ?></td> - <? else: ?> - <td><?= t("Title:") ?></td> - <td><?= $item_title ?></td> + <head> + <title><?= $subject ?> </title> + </head> + <body> + <h2> <?= $subject ?> </h2> + <table> + <tr> + <? if ($old->title != $new->title): ?> + <td><?= t("New Title:") ?></td> + <td><?= $new->title ?></td> + <? else: ?> + <td><?= t("Title:") ?></td> + <td><?= $new->title ?></td> + <? endif ?> + </tr> + <tr> + <td><?= t("Url:") ?></td> + <td><a href="<?= $new->url(array(), true) ?>"><?= $new->url(array(), true) ?></a></td> + </tr> + <? if ($old->description != $new->description): ?> + <tr> + <td><?= t("New Description:") ?></td> + <td><?= $new->description ?></td> + </tr> + <? elseif (!empty($new->description)): ?> + <tr> + <td><?= t("Description:") ?></td> + <td><?= $new->description ?></td> + </tr> <? endif ?> - </tr> - <tr> - <td><?= t("Url:") ?></td> - <td><a href="<?= $url ?>"><?= $url ?></a></td> - </tr> - <? if (!empty($new_description)): ?> - <tr> - <td><?= t("New Description:") ?></td> - <td><?= $new_description ?></td> - </tr> - <? else: if (!empty($description)): ?> - <tr> - <td><?= t("Description:") ?></td> - <td><?= $description ?></td> - </tr> - <? endif ?> - <? endif ?> - </table> -</body> + </table> + </body> </html> |