[ticket/11103] Mark read link if notification has no URL to view it

Other style stuff

PHPBB3-11103
This commit is contained in:
Nathaniel Guse 2012-10-16 10:51:07 -05:00
parent a2d6e40f1b
commit c8b66a26ef
7 changed files with 53 additions and 14 deletions

View file

@ -126,6 +126,17 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
*/ */
public function prepare_for_display() public function prepare_for_display()
{ {
if ($this->get_url())
{
$u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id);
}
else
{
$redirect = (($this->user->page['page_dir']) ? $this->user->page['page_dir'] . '/' : '') . $this->user->page['page_name'] . (($this->user->page['query_string']) ? '?' . $this->user->page['query_string'] : '');
$u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id . '&redirect=' . urlencode($redirect));
}
return array( return array(
'NOTIFICATION_ID' => $this->notification_id, 'NOTIFICATION_ID' => $this->notification_id,
@ -138,7 +149,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
'UNREAD' => $this->unread, 'UNREAD' => $this->unread,
'U_MARK_READ' => append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id), 'U_MARK_READ' => ($this->unread) ? $u_mark_read : '',
); );
} }

View file

@ -36,6 +36,11 @@ if (($mark_notification = request_var('mark_notification', 0)))
$notification->mark_read(); $notification->mark_read();
if (($redirect = request_var('redirect', '')))
{
redirect(append_sid($phpbb_root_path . $redirect));
}
redirect($notification->get_url()); redirect($notification->get_url());
} }
} }

View file

@ -137,7 +137,7 @@
<ul class="topiclist forums"> <ul class="topiclist forums">
<!-- BEGIN notifications --> <!-- BEGIN notifications -->
<li class="row<!-- IF notifications.UNREAD --> bg2<!-- ENDIF -->"> <li class="row<!-- IF notifications.UNREAD --> bg2<!-- ENDIF -->">
<!-- IF notifications.URL or notifications.U_MARK_READ --><a href="<!-- IF notifications.UNREAD -->{notifications.U_MARK_READ}<!-- ELSE -->{notifications.URL}<!-- ENDIF -->"><!-- ENDIF --> <!-- IF notifications.URL --><a href="<!-- IF notifications.UNREAD -->{notifications.U_MARK_READ}<!-- ELSE -->{notifications.URL}<!-- ENDIF -->"><!-- ENDIF -->
<span> <span>
{notifications.AVATAR} {notifications.AVATAR}
<span class="notification_title"> <span class="notification_title">
@ -146,6 +146,11 @@
</span> </span>
</span> </span>
<!-- IF notifications.URL --></a><!-- ENDIF --> <!-- IF notifications.URL --></a><!-- ENDIF -->
<!-- IF not notifications.URL and notifications.UNREAD -->
<span class="mark_notification_read">
<a href="{notifications.U_MARK_READ}">{L_MARK_READ}</a>
</span>
<!-- ENDIF -->
</li> </li>
<!-- END notifications --> <!-- END notifications -->
</ul> </ul>

View file

@ -77,7 +77,7 @@
<li class="row<!-- IF notification_list.UNREAD --> bg3<!-- ELSE --><!-- IF notification_list.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- ENDIF -->"> <li class="row<!-- IF notification_list.UNREAD --> bg3<!-- ELSE --><!-- IF notification_list.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- ENDIF -->">
<dl> <dl>
<dt> <dt>
<!-- IF notification_list.URL or notification_list.U_MARK_READ --><a href="<!-- IF notification_list.UNREAD -->{notification_list.U_MARK_READ}<!-- ELSE -->{notification_list.URL}<!-- ENDIF -->"><!-- ENDIF --> <!-- IF notification_list.URL --><a href="<!-- IF notification_list.UNREAD -->{notification_list.U_MARK_READ}<!-- ELSE -->{notification_list.URL}<!-- ENDIF -->"><!-- ENDIF -->
<span> <span>
{notification_list.AVATAR} {notification_list.AVATAR}
<span class="notification_title"> <span class="notification_title">
@ -86,9 +86,14 @@
</span> </span>
</span> </span>
<!-- IF notification_list.URL --></a><!-- ENDIF --> <!-- IF notification_list.URL --></a><!-- ENDIF -->
<!-- IF not notifications.URL and notifications.UNREAD -->
<span class="mark_notification_read">
<a href="{notifications.U_MARK_READ}">{L_MARK_READ}</a>
</span>
<!-- ENDIF -->
</dt> </dt>
<dd class="mark"><!-- IF notification_list.UNREAD --><input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}" /> <dfn>{L_MARK_READ}</dfn><!-- ENDIF --></dd> <dd class="mark">&nbsp;<!-- IF notification_list.UNREAD --><input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}" /> <dfn>{L_MARK_READ}</dfn><!-- ENDIF -->&nbsp;</dd>
</dl> </dl>
</li> </li>
<!-- END notification_list --> <!-- END notification_list -->

View file

@ -683,6 +683,10 @@ p.rules a {
line-height: 1.5em; line-height: 1.5em;
} }
.notification_list ul.topiclist dt {
width: 70%;
}
.notification_list ul li a span img { .notification_list ul li a span img {
float: left; float: left;
max-width: 50px; max-width: 50px;
@ -706,3 +710,9 @@ p.rules a {
.notification_time { .notification_time {
margin-top: 0.5em; margin-top: 0.5em;
} }
.mark_notification_read {
clear: both;
float: left;
margin-top: 0.5em;
}

View file

@ -154,19 +154,22 @@ function marklist(id, name, state)
<div id="notification_list" class="notification_list"> <div id="notification_list" class="notification_list">
<table class="tablebg" width="310px" cellspacing="1"> <table class="tablebg" width="310px" cellspacing="1">
<!-- BEGIN notifications --> <!-- BEGIN notifications -->
<tr> <tr class="row<!-- IF notifications.UNREAD -->2<!-- ELSE -->1<!-- ENDIF -->">
<!-- IF notifications.AVATAR --> <!-- IF notifications.AVATAR -->
<td class="row1" width="50px"> <td width="50px">
{notifications.AVATAR} {notifications.AVATAR}
</td> </td>
<td class="row1" valign="top"> <td valign="top">
<!-- ELSE --> <!-- ELSE -->
<td class="row1" colspan="2" valign="top"> <td colspan="2" valign="top">
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF notifications.URL or notifications.U_MARK_READ --><a href="<!-- IF notifications.UNREAD -->{notifications.U_MARK_READ}<!-- ELSE -->{notifications.URL}<!-- ENDIF -->"><!-- ENDIF --> <!-- IF notifications.URL --><a href="<!-- IF notifications.UNREAD -->{notifications.U_MARK_READ}<!-- ELSE -->{notifications.URL}<!-- ENDIF -->"><!-- ENDIF -->
{notifications.FORMATTED_TITLE} {notifications.FORMATTED_TITLE}
<!-- IF notifications.URL --></a><!-- ENDIF --><br /> <!-- IF notifications.URL --></a><!-- ENDIF --><br />
{notifications.TIME} {notifications.TIME}
<!-- IF not notifications.URL and notifications.UNREAD -->
<br /><a href="{notifications.U_MARK_READ}">{L_MARK_READ}</a>
<!-- ENDIF -->
</td> </td>
</tr> </tr>
<!-- END notifications --> <!-- END notifications -->

View file

@ -88,22 +88,22 @@
<th width="15%">{L_MARK_READ}</th> <th width="15%">{L_MARK_READ}</th>
</tr> </tr>
<!-- BEGIN notification_list --> <!-- BEGIN notification_list -->
<!-- IF notification_list.UNREAD --><tr class="row3"><!-- ELSEIF notification_list.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> <tr class="row<!-- IF notification_list.UNREAD -->3<!-- ELSEIF notification_list.S_ROW_COUNT is even -->1<!-- ELSE -->2<!-- ENDIF -->">
<!-- IF notification_list.AVATAR --> <!-- IF notification_list.AVATAR -->
<td width="50px"> <td width="50px">
{notification_list.AVATAR} {notification_list.AVATAR}
</td> </td>
<td valign="top"> <td valign="top">
<!-- ELSE --> <!-- ELSE -->
<td colspan="2" valign="top"> <td colspan="2" valign="top" height="50px">
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF notification_list.URL or notification_list.U_MARK_READ --><a href="<!-- IF notification_list.UNREAD -->{notification_list.U_MARK_READ}<!-- ELSE -->{notification_list.URL}<!-- ENDIF -->"><!-- ENDIF --> <!-- IF notification_list.URL --><a href="<!-- IF notification_list.UNREAD -->{notification_list.U_MARK_READ}<!-- ELSE -->{notification_list.URL}<!-- ENDIF -->"><!-- ENDIF -->
{notification_list.FORMATTED_TITLE} {notification_list.FORMATTED_TITLE}
<!-- IF notification_list.URL --></a><!-- ENDIF --><br /> <!-- IF notification_list.URL --></a><!-- ENDIF --><br />
{notification_list.TIME} {notification_list.TIME}
</td> </td>
<td align="center"> <td align="center">
<!-- IF not notification_list.UNREAD --><input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}" /><!-- ENDIF --> <!-- IF notification_list.UNREAD --><input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}" /><!-- ENDIF -->
</td> </td>
</tr> </tr>
<!-- END notification_list --> <!-- END notification_list -->