1: <?php
2: 3: 4:
5: class Horde_Block_Iframe extends Horde_Core_Block
6: {
7: 8:
9: public function __construct($app, $params = array())
10: {
11: parent::__construct($app, $params);
12:
13: $this->_name = _("View an external web page");
14: }
15:
16: 17:
18: protected function _params()
19: {
20: return array(
21: 'iframe' => array(
22: 'type' => 'text',
23: 'name' => _("URL"),
24: 'default' => ''
25: ),
26: 'title' => array(
27: 'type' => 'text',
28: 'name' => _("Title")
29: ),
30: 'height' => array(
31: 'type' => 'enum',
32: 'name' => _("Height"),
33: 'default' => '600',
34: 'values' => array(
35: '480' => _("Small"),
36: '600' => _("Medium"),
37: '768' => _("Large"),
38: '1024' => _("Extra Large")
39: )
40: )
41: );
42: }
43:
44: 45:
46: protected function _title()
47: {
48: global $registry;
49:
50: $title = !empty($this->_params['title'])
51: ? $this->_params['title']
52: : $this->_params['iframe'];
53: $url = new Horde_Url(Horde::externalUrl($this->_params['iframe']));
54:
55: return htmlspecialchars($title) .
56: $url->link(array('target' => '_blank')) .
57: Horde::img('external.png', '', array('style' => 'vertical-align:middle;padding-left:.3em')) . '</a>';
58: }
59:
60: 61:
62: protected function _content()
63: {
64: global $browser;
65:
66: if (!$browser->hasFeature('iframes')) {
67: return _("Your browser does not support this feature.");
68: }
69:
70: if (empty($this->_params['height'])) {
71: $height = ($browser->isBrowser('msie') || $browser->isBrowser('webkit'))
72: ? ''
73: : ' height="100%"';
74: } else {
75: $height = ' height="' . htmlspecialchars($this->_params['height']) . '"';
76: }
77:
78: return '<iframe src="' . htmlspecialchars($this->_params['iframe']) . '" width="100%"' . $height . ' marginheight="0" scrolling="auto" frameborder="0"></iframe>';
79: }
80:
81: }
82: