2009-02-27 03:41:21 +01:00
< ? php
class IFramePage extends Page {
static $db = array (
'IFrameUrl' => 'Text' ,
'DynamicHeight' => 'Boolean' ,
2009-06-04 04:35:03 +02:00
'FixedHeight' => 'Int' ,
'AlternateContent' => 'HTMLText' ,
'BottomContent' => 'HTMLText'
2009-02-27 03:41:21 +01:00
);
function getCMSFields () {
$fields = parent :: getCMSFields ();
$fields -> removeFieldFromTab ( 'Root.Content.Main' , 'Content' );
$fields -> addFieldToTab ( 'Root.Content.Main' , new TextField ( 'IFrameUrl' , 'IFrame URL' ));
2009-03-03 06:41:44 +01:00
//$fields->addFieldToTab('Root.Content.Main', new CheckboxField('DynamicHeight', 'Dynamically resize the IFrame height (this doesn\'t work if IFrame URL is on a different domain)'));
2009-02-27 03:41:21 +01:00
$fields -> addFieldToTab ( 'Root.Content.Main' , new NumericField ( 'FixedHeight' , 'Fixed Height (in pixels)' ));
2009-06-04 04:35:03 +02:00
$fields -> addFieldToTab ( 'Root.Content.Main' , new HtmlEditorField ( 'Content' , 'Content (appears above IFrame)' ));
$fields -> addFieldToTab ( 'Root.Content.Main' , new HtmlEditorField ( 'BottomContent' , 'Content (appears below IFrame)' ));
$fields -> addFieldToTab ( 'Root.Content.Main' , new HtmlEditorField ( 'AlternateContent' , 'Alternate Content (appears when user has IFrames disabled)' ));
2009-02-27 03:41:21 +01:00
return $fields ;
}
}
class IFramePage_Controller extends Page_Controller {
function Height () {
2009-03-03 06:41:44 +01:00
/* if ( $this -> DynamicHeight ) {
2009-02-27 03:41:21 +01:00
return 'class="iframeautosize"' ;
2009-03-03 06:41:44 +01:00
} else { */
2009-02-27 03:41:21 +01:00
return 'style="height: ' . $this -> FixedHeight . 'px;"' ;
2009-03-03 06:41:44 +01:00
//}
2009-02-27 03:41:21 +01:00
}
}
?>