1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34:
35: class Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Content
36: extends Mage_Adminhtml_Block_Widget_Form
37: implements Mage_Adminhtml_Block_Widget_Tab_Interface
38: {
39: 40: 41:
42: protected function _prepareLayout()
43: {
44: parent::_prepareLayout();
45: if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
46: $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
47: }
48: }
49:
50: protected function _prepareForm()
51: {
52:
53: $model = Mage::registry('cms_page');
54:
55: 56: 57:
58: if ($this->_isAllowedAction('save')) {
59: $isElementDisabled = false;
60: } else {
61: $isElementDisabled = true;
62: }
63:
64:
65: $form = new Varien_Data_Form();
66:
67: $form->setHtmlIdPrefix('page_');
68:
69: $fieldset = $form->addFieldset('content_fieldset', array('legend'=>Mage::helper('cms')->__('Content'),'class'=>'fieldset-wide'));
70:
71: $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(
72: array('tab_id' => $this->getTabId())
73: );
74:
75: $fieldset->addField('content_heading', 'text', array(
76: 'name' => 'content_heading',
77: 'label' => Mage::helper('cms')->__('Content Heading'),
78: 'title' => Mage::helper('cms')->__('Content Heading'),
79: 'disabled' => $isElementDisabled
80: ));
81:
82: $contentField = $fieldset->addField('content', 'editor', array(
83: 'name' => 'content',
84: 'style' => 'height:36em;',
85: 'required' => true,
86: 'disabled' => $isElementDisabled,
87: 'config' => $wysiwygConfig
88: ));
89:
90:
91: $renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')
92: ->setTemplate('cms/page/edit/form/renderer/content.phtml');
93: $contentField->setRenderer($renderer);
94:
95: $form->setValues($model->getData());
96: $this->setForm($form);
97:
98: Mage::dispatchEvent('adminhtml_cms_page_edit_tab_content_prepare_form', array('form' => $form));
99:
100: return parent::_prepareForm();
101: }
102:
103: 104: 105: 106: 107:
108: public function getTabLabel()
109: {
110: return Mage::helper('cms')->__('Content');
111: }
112:
113: 114: 115: 116: 117:
118: public function getTabTitle()
119: {
120: return Mage::helper('cms')->__('Content');
121: }
122:
123: 124: 125: 126: 127:
128: public function canShowTab()
129: {
130: return true;
131: }
132:
133: 134: 135: 136: 137:
138: public function isHidden()
139: {
140: return false;
141: }
142:
143: 144: 145: 146: 147: 148:
149: protected function _isAllowedAction($action)
150: {
151: return Mage::getSingleton('admin/session')->isAllowed('cms/page/' . $action);
152: }
153: }
154: