setShowGlobalIcon(true); } protected function _prepareForm() { /* * Checking if user have permissions to save information */ if ($this->_isAllowedAction('save')) { $isElementDisabled = false; } else { $isElementDisabled = true; } $form = new Varien_Data_Form(); $form->setHtmlIdPrefix('page_'); $model = Mage::registry('cms_page'); $layoutFieldset = $form->addFieldset('layout_fieldset', array( 'legend' => Mage::helper('cms')->__('Page Layout'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled )); $layoutFieldset->addField('root_template', 'select', array( 'name' => 'root_template', 'label' => Mage::helper('cms')->__('Layout'), 'required' => true, 'values' => Mage::getSingleton('page/source_layout')->toOptionArray(), 'disabled' => $isElementDisabled )); if (!$model->getId()) { $model->setRootTemplate(Mage::getSingleton('page/source_layout')->getDefaultValue()); } $layoutFieldset->addField('layout_update_xml', 'textarea', array( 'name' => 'layout_update_xml', 'label' => Mage::helper('cms')->__('Layout Update XML'), 'style' => 'height:24em;', 'disabled' => $isElementDisabled )); $designFieldset = $form->addFieldset('design_fieldset', array( 'legend' => Mage::helper('cms')->__('Custom Design'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled )); $dateFormatIso = Mage::app()->getLocale()->getDateFormat( Mage_Core_Model_Locale::FORMAT_TYPE_SHORT ); $designFieldset->addField('custom_theme_from', 'date', array( 'name' => 'custom_theme_from', 'label' => Mage::helper('cms')->__('Custom Design From'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso, 'disabled' => $isElementDisabled )); $designFieldset->addField('custom_theme_to', 'date', array( 'name' => 'custom_theme_to', 'label' => Mage::helper('cms')->__('Custom Design To'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso, 'disabled' => $isElementDisabled )); $designFieldset->addField('custom_theme', 'select', array( 'name' => 'custom_theme', 'label' => Mage::helper('cms')->__('Custom Theme'), 'values' => Mage::getModel('core/design_source_design')->getAllOptions(), 'disabled' => $isElementDisabled )); $designFieldset->addField('custom_root_template', 'select', array( 'name' => 'custom_root_template', 'label' => Mage::helper('cms')->__('Custom Layout'), 'values' => Mage::getSingleton('page/source_layout')->toOptionArray(true), 'disabled' => $isElementDisabled )); $designFieldset->addField('custom_layout_update_xml', 'textarea', array( 'name' => 'custom_layout_update_xml', 'label' => Mage::helper('cms')->__('Custom Layout Update XML'), 'style' => 'height:24em;', 'disabled' => $isElementDisabled )); Mage::dispatchEvent('adminhtml_cms_page_edit_tab_design_prepare_form', array('form' => $form)); $form->setValues($model->getData()); $this->setForm($form); return parent::_prepareForm(); } /** * Prepare label for tab * * @return string */ public function getTabLabel() { return Mage::helper('cms')->__('Design'); } /** * Prepare title for tab * * @return string */ public function getTabTitle() { return Mage::helper('cms')->__('Design'); } /** * Returns status flag about this tab can be showen or not * * @return true */ public function canShowTab() { return true; } /** * Returns status flag about this tab hidden or not * * @return true */ public function isHidden() { return false; } /** * Check permission for passed action * * @param string $action * @return bool */ protected function _isAllowedAction($action) { return Mage::getSingleton('admin/session')->isAllowed('cms/page/' . $action); } }