Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1170999
close_popup.tpl
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Sep 27, 9:56 PM
Size
3 KB
Mime Type
text/html
Expires
Mon, Sep 29, 9:56 PM (1 d, 15 h)
Engine
blob
Format
Raw Data
Handle
758624
Attached To
rINP In-Portal
close_popup.tpl
View Options
<
inp2:m_NoDebug
/>
<
inp2:m_Set
skip_last_template
=
"1"
/>
<
html
>
<
head
>
<
title
></
title
>
<
script
type
=
"text/javascript"
>
var
$
is_debug
=
<
inp2
:
m_if
check
=
"m_ConstOn"
name
=
"DBG_REDIRECT"
>
true
<
inp2
:
m_else
/>
false
<
/inp2:m_if>;
var
$
use_popups
=
<
inp2
:
m_if
check
=
"adm_UsePopups"
>
true
<
inp2
:
m_else
/>
false
<
/inp2:m_if>;
var
$
redirect_url
=
'<inp2:m_t t="dummy" opener="u" m_opener="u" escape="escape"/>'
;
var
$
modal_windows
=
<
inp2
:
m_if
check
=
"adm_UsePopups"
mode
=
"modal"
>
true
<
inp2
:
m_else
/>
false
<
/inp2:m_if>;
if
(
$
is_debug
)
{
document
.
write
(
'<a href="#" onclick="proceed_redirect()">'
+
$
redirect_url
.
replace
(
/%5C/g
,
'\\'
)
+
'</a>'
);
}
else
{
proceed_redirect
();
}
function
isset
(
variable
)
{
if
(
variable
==
null
)
return
false
;
return
(
typeof
(
variable
)
==
'undefined'
)
?
false
:
true
;
}
function
proceed_redirect
()
{
var
$
opener
=
getFrame
(
'main'
).
getWindowOpener
(
window
);
if
(
$
opener
)
{
// using popups & close_popup called (from anywhere)
try
{
window_close
(
function
()
{
$
opener
.
onAfterWindowClose
(
$
redirect_url
,
<
inp2
:
m_if
check
=
"adm_OpenNewWindow"
diff
=
"1"
>
true
<
inp2
:
m_else
/>
false
<
/inp2:m_if>, <inp2:m_if check="m_Get" name="skip_refresh">true<inp2:m_else/
>
false
<
/inp2:m_if>);
}
);
}
catch
(
err
)
{
// another website is opened in parent window
alert
(
'Error while trying to process redirect in window opener, you should probably close this window.'
+
"\n"
+
'Error message: ['
+
err
.
message
+
']'
);
}
}
else
if
(
!
$
use_popups
)
{
// not using popups (for editing), but close_popup called (e.g. from selector)
window
.
location
.
href
=
$
redirect_url
.
replace
(
/%5C/g
,
'\\'
);
}
}
// copied from "js/script.js" because it's not included here due performance reasons
function
getFrame
(
$
name
)
{
var
$
main_window
=
window
;
// 1. cycle through popups to get main window
try
{
// will be error, when other site is opened in parent window
var
$
i
=
0
;
while
(
$
main_window
.
opener
)
{
if
(
$
i
==
10
)
{
break
;
}
$
main_window
=
$
main_window
.
opener
;
$
i
++
;
}
}
catch
(
err
)
{
// catch Access/Permission Denied error
// alert('getFrame.Error: [' + err.description + ']');
return
window
;
}
var
$
frameset
=
$
main_window
.
parent
.
frames
;
for
(
$
i
=
0
;
$
i
<
$
frameset
.
length
;
$
i
++
)
{
if
(
$
frameset
[
$
i
].
name
==
$
name
)
{
return
$
frameset
[
$
i
];
}
}
return
$
main_window
.
parent
;
}
// copied locally, because won't work, when called via getFrame('main').window_close(...);
function
window_close
(
$
close_callback
)
{
// use this instead of "window.close();"
if
(
!
$
modal_windows
)
{
// don't use other (e.g. parent) window methods to detect type of
// variables from given window, because it won't work in IE
if
(
Object
.
prototype
.
toString
.
call
(
$
close_callback
)
===
'[object Function]'
)
{
// use close callback, because iframe will be removed later in this method
$
close_callback
();
}
window
.
close
();
return
;
}
if
(
window
.
name
==
'main'
)
{
return
;
}
if
(
$
close_callback
!==
undefined
)
{
return
getFrame
(
'main'
).
TB
.
remove
(
null
,
$
close_callback
);
}
return
getFrame
(
'main'
).
TB
.
remove
();
}
</
script
>
</
head
>
<
body
>
</
body
>
</
html
>
Event Timeline
Log In to Comment