1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-19 23:32:02 +02:00

[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()
{
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(
'NOTIFICATION_ID' => $this->notification_id,
@ -138,7 +149,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
'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();
if (($redirect = request_var('redirect', '')))
{
redirect(append_sid($phpbb_root_path . $redirect));
}
redirect($notification->get_url());
}
}

View File

@ -137,7 +137,7 @@
<ul class="topiclist forums">
<!-- BEGIN notifications -->
<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>
{notifications.AVATAR}
<span class="notification_title">
@ -146,6 +146,11 @@
</span>
</span>
<!-- 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>
<!-- END notifications -->
</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 -->">
<dl>
<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>
{notification_list.AVATAR}
<span class="notification_title">
@ -86,9 +86,14 @@
</span>
</span>
<!-- 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>
<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>
</li>
<!-- END notification_list -->

View File

@ -683,6 +683,10 @@ p.rules a {
line-height: 1.5em;
}
.notification_list ul.topiclist dt {
width: 70%;
}
.notification_list ul li a span img {
float: left;
max-width: 50px;
@ -706,3 +710,9 @@ p.rules a {
.notification_time {
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">
<table class="tablebg" width="310px" cellspacing="1">
<!-- BEGIN notifications -->
<tr>
<tr class="row<!-- IF notifications.UNREAD -->2<!-- ELSE -->1<!-- ENDIF -->">
<!-- IF notifications.AVATAR -->
<td class="row1" width="50px">
<td width="50px">
{notifications.AVATAR}
</td>
<td class="row1" valign="top">
<td valign="top">
<!-- ELSE -->
<td class="row1" colspan="2" valign="top">
<td colspan="2" valign="top">
<!-- 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}
<!-- IF notifications.URL --></a><!-- ENDIF --><br />
{notifications.TIME}
<!-- IF not notifications.URL and notifications.UNREAD -->
<br /><a href="{notifications.U_MARK_READ}">{L_MARK_READ}</a>
<!-- ENDIF -->
</td>
</tr>
<!-- END notifications -->

View File

@ -88,22 +88,22 @@
<th width="15%">{L_MARK_READ}</th>
</tr>
<!-- 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 -->
<td width="50px">
<td width="50px">
{notification_list.AVATAR}
</td>
<td valign="top">
<!-- ELSE -->
<td colspan="2" valign="top">
<td colspan="2" valign="top" height="50px">
<!-- 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}
<!-- IF notification_list.URL --></a><!-- ENDIF --><br />
{notification_list.TIME}
</td>
<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>
</tr>
<!-- END notification_list -->