aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCesar G <prototech91@gmail.com>2014-04-15 08:55:39 -0700
committerCesar G <prototech91@gmail.com>2014-04-15 08:56:34 -0700
commit975c5655f0e9b65b7de3f2b832f1ef660a473832 (patch)
tree5f6a754ebe73a5790097e6c7b2ac26301b8af5d2
parent161b610a947f9de814aad228a2e62719c2096746 (diff)
downloadforums-975c5655f0e9b65b7de3f2b832f1ef660a473832.tar
forums-975c5655f0e9b65b7de3f2b832f1ef660a473832.tar.gz
forums-975c5655f0e9b65b7de3f2b832f1ef660a473832.tar.bz2
forums-975c5655f0e9b65b7de3f2b832f1ef660a473832.tar.xz
forums-975c5655f0e9b65b7de3f2b832f1ef660a473832.zip
[ticket/12265] Define a loop for contact icons.
PHPBB3-12265
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewmessage.php51
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_viewmessage.html45
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html42
-rw-r--r--phpBB/viewtopic.php45
4 files changed, 117 insertions, 66 deletions
diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php
index 03064a31d3..1cdb87ebf0 100644
--- a/phpBB/includes/ucp/ucp_pm_viewmessage.php
+++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php
@@ -177,6 +177,18 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
}
}
+ $u_pm = $u_jabber = '';
+
+ if ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')))
+ {
+ $u_pm = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;u=' . $author_id);
+ }
+
+ if ($user_info['user_jabber'] && $auth->acl_get('u_sendim'))
+ {
+ $u_jabber = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=jabber&amp;u=' . $author_id);
+ }
+
$msg_data = array(
'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']),
'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']),
@@ -208,8 +220,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'EDITED_MESSAGE' => $l_edited_by,
'MESSAGE_ID' => $message_row['msg_id'],
- 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;u=' . $author_id) : '',
- 'U_JABBER' => ($user_info['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=jabber&amp;u=' . $author_id) : '',
+ 'U_PM' => $u_pm,
+ 'U_JABBER' => $u_jabber,
'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&amp;mode=compose&amp;action=delete&amp;f=$folder_id&amp;p=" . $message_row['msg_id'] : '',
'U_EMAIL' => $user_info['email'],
@@ -255,6 +267,32 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
$template->assign_vars($msg_data);
+ $contact_fields = array(
+ array(
+ 'ID' => 'pm',
+ 'NAME' => $user->lang['PRIVATE_MESSAGE'],
+ 'U_CONTACT' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;u=' . $author_id)
+ ),
+ array(
+ 'ID' => 'email',
+ 'NAME' => $user->lang['SEND_EMAIL'],
+ 'U_CONTACT' => $user_info['email'],
+ ),
+ array(
+ 'ID' => 'jabber',
+ 'NAME' => $user->lang['JABBER'],
+ 'U_CONTACT' => $u_jabber,
+ ),
+ );
+
+ foreach ($contact_fields as $field)
+ {
+ if ($field['U_CONTACT'])
+ {
+ $template->assign_block_vars('contact', $field);
+ }
+ }
+
// Display the custom profile fields
if (!empty($cp_row['row']))
{
@@ -263,6 +301,15 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
foreach ($cp_row['blockrow'] as $cp_block_row)
{
$template->assign_block_vars('custom_fields', $cp_block_row);
+
+ if ($cp_block_row['S_PROFILE_CONTACT'])
+ {
+ $template->assign_block_vars('contact', array(
+ 'ID' => $cp_block_row['PROFILE_FIELD_IDENT'],
+ 'NAME' => $cp_block_row['PROFILE_FIELD_NAME'],
+ 'U_CONTACT' => $cp_block_row['PROFILE_FIELD_CONTACT'],
+ ));
+ }
}
}
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
index 35a9e41c92..627b5aa6ed 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
@@ -34,8 +34,7 @@
<!-- EVENT ucp_pm_viewmessage_custom_fields_after -->
- <!-- IF U_PM or U_EMAIL or U_JABBER -->
- <!-- DEFINE $CNT = 0 -->
+ <!-- IF .contact -->
<dd class="profile-contact">
<strong>{L_CONTACT_USER}{L_COLON}</strong>
<div class="dropdown-container dropdown-left">
@@ -43,39 +42,19 @@
<div class="dropdown hidden">
<div class="pointer"><div class="pointer-inner"></div></div>
<div class="dropdown-contents contact-icons">
- <div>
- <!-- EVENT ucp_pm_viewmessage_contact_fields_before -->
- <!-- IF U_PM -->
- <!-- DEFINE $CNT = definition.CNT + 1 -->
- <!-- IF $CNT % 4 == 1 --><div><!-- ENDIF -->
- <a <!-- IF $CNT % 4 == 0 -->class="last-cell" <!-- ENDIF -->href="{U_PM}" title="{L_PRIVATE_MESSAGE}"><span class="contact-icon pm-icon"></span></a>
- <!-- IF $CNT % 4 == 0 --></div><!-- ENDIF -->
+ <!-- BEGIN contact -->
+ {% set REMAINDER = contact.S_ROW_COUNT % 4 %}
+ <!-- DEFINE $S_LAST_CELL = ((REMAINDER eq 3) or (contact.S_LAST_ROW and contact.S_NUM_ROWS < 4)) -->
+ <!-- IF REMAINDER eq 0 -->
+ <div>
<!-- ENDIF -->
- <!-- IF U_EMAIL -->
- <!-- DEFINE $CNT = definition.CNT + 1 -->
- <!-- IF $CNT % 4 == 1 --><div><!-- ENDIF -->
- <a <!-- IF $CNT % 4 == 0 -->class="last-cell" <!-- ENDIF -->href="{U_EMAIL}" title="{L_SEND_EMAIL_USER} {POST_AUTHOR}"><span class="contact-icon email-icon"></span></a>
- <!-- IF $CNT % 4 == 0 --></div><!-- ENDIF -->
+ <a href="<!-- IF contact.U_CONTACT -->{contact.U_CONTACT}<!-- ELSE -->{contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF contact.ID eq 'jabber' --> onclick="popup(this.href, 550, 320); return false;"<!-- ENDIF -->>
+ <span class="contact-icon {contact.ID}-icon"></span>
+ </a>
+ <!-- IF REMAINDER eq 3 or contact.S_LAST_ROW -->
+ </div>
<!-- ENDIF -->
- <!-- IF U_JABBER -->
- <!-- DEFINE $CNT = definition.CNT + 1 -->
- <!-- IF $CNT % 4 == 1 --><div><!-- ENDIF -->
- <a <!-- IF $CNT % 4 == 0 -->class="last-cell" <!-- ENDIF -->href="{U_JABBER}" onclick="popup(this.href, 550, 320); return false;" title="{L_JABBER}"><span class="contact-icon jabber-icon"></span></a>
- <!-- IF $CNT % 4 == 0 --></div><!-- ENDIF -->
- <!-- ENDIF -->
- <!-- BEGIN custom_fields -->
- <!-- IF custom_fields.S_PROFILE_CONTACT -->
- <!-- DEFINE $CNT = definition.CNT + 1 -->
- <!-- IF $CNT % 4 == 1 --><div><!-- ENDIF -->
- <a <!-- IF $CNT % 4 == 0 -->class="last-cell" <!-- ENDIF -->href="<!-- IF postrow.custom_fields.PROFILE_FIELD_CONTACT -->{custom_fields.PROFILE_FIELD_CONTACT}<!-- ELSE -->{U_POST_AUTHOR}<!-- ENDIF -->" title="{custom_fields.PROFILE_FIELD_NAME}">
- <span class="contact-icon {custom_fields.PROFILE_FIELD_IDENT}-icon"></span>
- </a>
- <!-- IF $CNT % 4 == 0 --></div><!-- ENDIF -->
- <!-- ENDIF -->
- <!-- END custom_fields -->
- <!-- EVENT ucp_pm_viewmessage_contact_fields_after -->
- <!-- IF $CNT % 4 != 0 --></div><!-- ENDIF -->
- </div>
+ <!-- END contact -->
</div>
</div>
</dd>
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index efdf5e9993..5069a406a3 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -143,8 +143,7 @@
<!-- END custom_fields -->
<!-- EVENT viewtopic_body_postrow_custom_fields_after -->
- <!-- IF not S_IS_BOT and (postrow.U_PM or postrow.U_EMAIL or postrow.U_JABBER) -->
- <!-- DEFINE $CNT = 0 -->
+ <!-- IF not S_IS_BOT and .postrow.contact -->
<dd class="profile-contact">
<strong>{L_CONTACT_USER}{L_COLON}</strong>
<div class="dropdown-container dropdown-left">
@@ -152,36 +151,19 @@
<div class="dropdown hidden">
<div class="pointer"><div class="pointer-inner"></div></div>
<div class="dropdown-contents contact-icons">
- <div>
- <!-- IF postrow.U_PM -->
- <!-- DEFINE $CNT = definition.CNT + 1 -->
- <!-- IF $CNT % 4 == 1 --><div><!-- ENDIF -->
- <a <!-- IF $CNT % 4 == 0 -->class="last-cell" <!-- ENDIF -->href="{postrow.U_PM}" title="{L_PRIVATE_MESSAGE}"><span class="contact-icon pm-icon"></span></a>
- <!-- IF $CNT % 4 == 0 --></div><!-- ENDIF -->
+ <!-- BEGIN contact -->
+ {% set REMAINDER = postrow.contact.S_ROW_COUNT % 4 %}
+ <!-- DEFINE $S_LAST_CELL = ((REMAINDER eq 3) or (postrow.contact.S_LAST_ROW and postrow.contact.S_NUM_ROWS < 4)) -->
+ <!-- IF REMAINDER eq 0 -->
+ <div>
<!-- ENDIF -->
- <!-- IF postrow.U_EMAIL -->
- <!-- DEFINE $CNT = definition.CNT + 1 -->
- <!-- IF $CNT % 4 == 1 --><div><!-- ENDIF -->
- <a <!-- IF $CNT % 4 == 0 -->class="last-cell" <!-- ENDIF -->href="{postrow.U_EMAIL}" title="{L_SEND_EMAIL_USER} {postrow.POST_AUTHOR}"><span class="contact-icon email-icon"></span></a>
- <!-- IF $CNT % 4 == 0 --></div><!-- ENDIF -->
+ <a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF postrow.contact.ID eq 'jabber' --> onclick="popup(this.href, 550, 320); return false;"<!-- ENDIF -->>
+ <span class="contact-icon {postrow.contact.ID}-icon"></span>
+ </a>
+ <!-- IF REMAINDER eq 3 or postrow.contact.S_LAST_ROW -->
+ </div>
<!-- ENDIF -->
- <!-- IF postrow.U_JABBER -->
- <!-- DEFINE $CNT = definition.CNT + 1 -->
- <!-- IF $CNT % 4 == 1 --><div><!-- ENDIF -->
- <a <!-- IF $CNT % 4 == 0 -->class="last-cell" <!-- ENDIF -->href="{postrow.U_JABBER}" onclick="popup(this.href, 550, 320); return false;" title="{L_JABBER}"><span class="contact-icon jabber-icon"></span></a>
- <!-- IF $CNT % 4 == 0 --></div><!-- ENDIF -->
- <!-- ENDIF -->
- <!-- BEGIN custom_fields -->
- <!-- IF postrow.custom_fields.S_PROFILE_CONTACT -->
- <!-- DEFINE $CNT = definition.CNT + 1 -->
- <!-- IF $CNT % 4 == 1 --><div><!-- ENDIF -->
- <a <!-- IF $CNT % 4 == 0 -->class="last-cell" <!-- ENDIF -->href="<!-- IF postrow.custom_fields.PROFILE_FIELD_CONTACT -->{postrow.custom_fields.PROFILE_FIELD_CONTACT}<!-- ELSE -->{postrow.U_POST_AUTHOR}<!-- ENDIF -->" title="{postrow.custom_fields.PROFILE_FIELD_NAME}">
- <span class="contact-icon {postrow.custom_fields.PROFILE_FIELD_IDENT}-icon"></span>
- </a>
- <!-- IF $CNT % 4 == 0 --></div><!-- ENDIF -->
- <!-- ENDIF -->
- <!-- END custom_fields -->
- <!-- IF $CNT % 4 != 0 --></div><!-- ENDIF -->
+ <!-- END contact -->
</div>
</div>
</div>
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 1a74ad3e38..5d7314635e 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1586,6 +1586,14 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
!$row['post_edit_locked']
)));
+ $u_pm = '';
+
+ if (($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm')
+ && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))))
+ {
+ $u_pm = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;action=quotepost&amp;p=' . $row['post_id']);
+ }
+
//
$post_row = array(
'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
@@ -1625,7 +1633,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
'U_SEARCH' => $user_cache[$poster_id]['search'],
- 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;action=quotepost&amp;p=' . $row['post_id']) : '',
+ 'U_PM' => $u_pm,
'U_EMAIL' => $user_cache[$poster_id]['email'],
'U_JABBER' => $user_cache[$poster_id]['jabber'],
@@ -1695,11 +1703,46 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
// Dump vars into template
$template->assign_block_vars('postrow', $post_row);
+ $contact_fields = array(
+ array(
+ 'ID' => 'pm',
+ 'NAME' => $user->lang['PRIVATE_MESSAGES'],
+ 'U_CONTACT' => $u_pm,
+ ),
+ array(
+ 'ID' => 'email',
+ 'NAME' => $user->lang['SEND_EMAIL'],
+ 'U_CONTACT' => $user_cache[$poster_id]['email'],
+ ),
+ array(
+ 'ID' => 'jabber',
+ 'NAME' => $user->lang['JABBER'],
+ 'U_CONTACT' => $user_cache[$poster_id]['jabber'],
+ ),
+ );
+
+ foreach ($contact_fields as $field)
+ {
+ if ($field['U_CONTACT'])
+ {
+ $template->assign_block_vars('postrow.contact', $field);
+ }
+ }
+
if (!empty($cp_row['blockrow']))
{
foreach ($cp_row['blockrow'] as $field_data)
{
$template->assign_block_vars('postrow.custom_fields', $field_data);
+
+ if ($field_data['S_PROFILE_CONTACT'])
+ {
+ $template->assign_block_vars('postrow.contact', array(
+ 'ID' => $field_data['PROFILE_FIELD_IDENT'],
+ 'NAME' => $field_data['PROFILE_FIELD_NAME'],
+ 'U_CONTACT' => $field_data['PROFILE_FIELD_CONTACT'],
+ ));
+ }
}
}