<?php

class MySiteConfig extends DataObjectDecorator {

    public function extraStatics() {
        return array(
            "db" => array(
                "TopSitesNavigation" => "HTMLText",
                "XmlURL" => "Varchar(255)",
                "BannerLink" => "Varchar(255)",
                "BannerActive" => "Boolean"
            ),
            'has_one' => array( 
                'BannerImage' => 'Image',
                'BannerInnerPage' => 'Page'
            ) 
            
        );
    }
    
    public function updateCMSFields(FieldSet &$fields) {

        $fields->removeByName('Theme');
        $fields->addFieldToTab("Root.Main", 
                new TextField('XmlURL', 'Remote XML address'));
        $fields->addFieldToTab("Root.Main", 
                new HtmlEditorField('TopSitesNavigation', 
                        _t('SETTINGS.BottomNavigation', 'Sites Navigation')));
        
    
        $fields->addFieldsToTab("Root.Banner", array(
                new ImageField("BannerImage", 
                        _t('SETTINGS.BannerImage', "Banner image (180x160 px)")),
                $tree = new SimpleTreeDropdownField('BannerInnerPageID', 
                        _t('SETTINGS.BannerInnerPage', "Link to inner page (Has priority)"),
                        'Page'
                ),
                new TextField("BannerLink", 
                        _t('SETTINGS.BannerLink', "External link")),
                new CheckboxField('BannerActive', 
                        _t('SETTINGS.BannerActive', 'Active?'))
                
        )); 
        $tree->setEmptyString(_t('SETTINGS.EmptyString', "-- Select from pages --"));

    }


}