[ticket/11795] Move PM popup JS to forum_fn.js

Move PM popup JavaScript from overall_header to forum_fn.js
Use TWIG to escape PM popup URL

PHPBB3-11795
This commit is contained in:
Vjacheslav Trushkin 2013-08-16 19:45:38 +03:00
parent 4c2aad4ca9
commit 22c8df5403
4 changed files with 12 additions and 14 deletions

View file

@ -5333,7 +5333,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'),
'U_RETURN_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'),
'U_POPUP_PM' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=popup'),
'UA_POPUP_PM' => addslashes(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=popup')),
'U_MEMBERLIST' => append_sid("{$phpbb_root_path}memberlist.$phpEx"),
'U_VIEWONLINE' => ($auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid("{$phpbb_root_path}viewonline.$phpEx") : '',
'U_LOGIN_LOGOUT' => $u_login_logout,

View file

@ -323,6 +323,12 @@ jQuery(document).ready(apply_onkeypress_event);
jumpto($(this));
});
// PM popup
$('body[data-popup-pm-url]').each(function() {
var url = this.getAttribute('data-popup-pm-url');
window.open(url.replace(/&/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
});
// Adjust HTML code for IE8 and older versions
var test = document.createElement('div'),
oldBrowser = (typeof test.style.borderRadius == 'undefined');

View file

@ -24,17 +24,6 @@
Modified by:
-->
<script type="text/javascript">
// <![CDATA[
<!-- IF S_USER_PM_POPUP and S_NEW_PM -->
var url = '{UA_POPUP_PM}';
window.open(url.replace(/&amp;/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
<!-- ENDIF -->
// ]]>
</script>
<link href="{T_THEME_PATH}/print.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="print" title="printonly" />
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
@ -47,12 +36,16 @@
<link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" />
<![endif]-->
<!-- IF S_USER_PM_POPUP and S_NEW_PM -->
{% set body_attributes %}{{ body_attributes }} data-popup-pm-url="{{ U_POPUP_PM|e('html_attr') }}"{% endset %}
<!-- ENDIF -->
<!-- EVENT overall_header_head_append -->
{$STYLESHEETS}
</head>
<body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}">
<body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}"{{ body_attributes }}>
<div id="wrap">
<a id="top" accesskey="t"></a>

View file

@ -23,7 +23,7 @@
<script type="text/javascript">
// <![CDATA[
<!-- IF S_USER_PM_POPUP and S_NEW_PM -->
popup('{UA_POPUP_PM}', 400, 225, '_phpbbprivmsg');
popup('{{ U_POPUP_PM|e('js') }}', 400, 225, '_phpbbprivmsg');
<!-- ENDIF -->
function popup(url, width, height, name)