1 |
dpavlin |
905 |
package Frey::Web::IFrame; |
2 |
|
|
use Moose; |
3 |
|
|
|
4 |
|
|
extends 'Frey'; |
5 |
|
|
with 'Frey::Web'; |
6 |
|
|
#with 'Frey::Storage'; |
7 |
|
|
|
8 |
|
|
has skeleton => ( |
9 |
|
|
is => 'rw', |
10 |
|
|
isa => 'Str', |
11 |
|
|
required => 1, |
12 |
|
|
default => 'skeleton', |
13 |
|
|
); |
14 |
|
|
|
15 |
|
|
sub as_markup { |
16 |
|
|
my ($self) = @_; |
17 |
|
|
|
18 |
|
|
$self->add_js( 'static/Frey/Web/IFrame.js' ); |
19 |
|
|
|
20 |
|
|
$self->add_js(q/ |
21 |
|
|
function ifr_close() { |
22 |
|
|
var e = self.document.getElementById('frey_iframe') || null; |
23 |
|
|
if (!e) return; |
24 |
|
|
e.style.height = '0px'; |
25 |
|
|
} |
26 |
|
|
function ifr_show() { |
27 |
|
|
self.document.getElementById('ifr_close').style.display=''; |
28 |
|
|
} |
29 |
|
|
/); |
30 |
|
|
|
31 |
|
|
my $html = qq| |
32 |
|
|
<a href="#" id="ifr_close" style="display:none;" onclick="ifr_close();this.style.display='none';return false;">close</a> |
33 |
|
|
<iframe id="frey_iframe" name="frey_iframe" width="100%" height="0" frameborder="0" border="0" onload="top.ifr_resize(this);"> |
34 |
|
|
</iframe> |
35 |
|
|
|; |
36 |
|
|
|
37 |
|
|
$html .= $self->iframe_open('/Frey::Web::IFrame','introspect in iframe'); |
38 |
|
|
|
39 |
|
|
return $html; |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
sub iframe_open { |
43 |
|
|
my ($self,$url,$text) = @_; |
44 |
|
|
|
45 |
|
|
qq| |
46 |
|
|
<a href="$url" target="frey_iframe" onclick="ifr_show(); return true;">$text</a> |
47 |
|
|
| |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
1; |