Skip to content

Commit 3641080

Browse files
committed
Moved block files from adminhtml/cms to cms/adminhtml
1 parent fbf858b commit 3641080

File tree

51 files changed

+2238
-1692
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2238
-1692
lines changed

app/code/core/Mage/Adminhtml/Block/Cms/Block.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -18,14 +18,8 @@
1818
*
1919
* @category Mage
2020
* @package Mage_Adminhtml
21+
* @deprecated
2122
*/
22-
class Mage_Adminhtml_Block_Cms_Block extends Mage_Adminhtml_Block_Widget_Grid_Container
23+
class Mage_Adminhtml_Block_Cms_Block extends Mage_Cms_Block_Adminhtml_Block
2324
{
24-
public function __construct()
25-
{
26-
$this->_controller = 'cms_block';
27-
$this->_headerText = Mage::helper('cms')->__('Static Blocks');
28-
$this->_addButtonLabel = Mage::helper('cms')->__('Add New Block');
29-
parent::__construct();
30-
}
3125
}

app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -18,46 +18,8 @@
1818
*
1919
* @category Mage
2020
* @package Mage_Adminhtml
21+
* @deprecated
2122
*/
22-
class Mage_Adminhtml_Block_Cms_Block_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
23+
class Mage_Adminhtml_Block_Cms_Block_Edit extends Mage_Cms_Block_Adminhtml_Block_Edit
2324
{
24-
public function __construct()
25-
{
26-
$this->_objectId = 'block_id';
27-
$this->_controller = 'cms_block';
28-
29-
parent::__construct();
30-
31-
$this->_updateButton('save', 'label', Mage::helper('cms')->__('Save Block'));
32-
$this->_updateButton('delete', 'label', Mage::helper('cms')->__('Delete Block'));
33-
34-
$this->_addButton('saveandcontinue', [
35-
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
36-
'onclick' => 'saveAndContinueEdit()',
37-
'class' => 'save',
38-
], -100);
39-
40-
$this->_formScripts[] = "
41-
function toggleEditor() {
42-
tinymce.execCommand('mceToggleEditor', false, wysiwygblock_content);
43-
}
44-
45-
function saveAndContinueEdit(){
46-
editForm.submit($('edit_form').action+'back/edit/');
47-
}
48-
";
49-
}
50-
51-
/**
52-
* Get edit form container header text
53-
*
54-
* @return string
55-
*/
56-
public function getHeaderText()
57-
{
58-
if (Mage::registry('cms_block')->getId()) {
59-
return Mage::helper('cms')->__("Edit Block '%s'", $this->escapeHtml(Mage::registry('cms_block')->getTitle()));
60-
}
61-
return Mage::helper('cms')->__('New Block');
62-
}
6325
}

app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php

Lines changed: 3 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -18,112 +18,8 @@
1818
*
1919
* @category Mage
2020
* @package Mage_Adminhtml
21+
* @deprecated
2122
*/
22-
class Mage_Adminhtml_Block_Cms_Block_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
23+
class Mage_Adminhtml_Block_Cms_Block_Edit_Form extends Mage_Cms_Block_Adminhtml_Block_Edit_Form
2324
{
24-
/**
25-
* Init form
26-
*/
27-
public function __construct()
28-
{
29-
parent::__construct();
30-
$this->setId('block_form');
31-
$this->setTitle(Mage::helper('cms')->__('Block Information'));
32-
}
33-
34-
/**
35-
* Load Wysiwyg on demand and Prepare layout
36-
*/
37-
protected function _prepareLayout()
38-
{
39-
parent::_prepareLayout();
40-
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
41-
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
42-
}
43-
return $this;
44-
}
45-
46-
protected function _prepareForm()
47-
{
48-
$model = Mage::registry('cms_block');
49-
50-
$form = new Varien_Data_Form(
51-
['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']
52-
);
53-
54-
$form->setHtmlIdPrefix('block_');
55-
56-
$fieldset = $form->addFieldset('base_fieldset', ['legend' => Mage::helper('cms')->__('General Information'), 'class' => 'fieldset-wide']);
57-
58-
if ($model->getBlockId()) {
59-
$fieldset->addField('block_id', 'hidden', [
60-
'name' => 'block_id',
61-
]);
62-
}
63-
64-
$fieldset->addField('title', 'text', [
65-
'name' => 'title',
66-
'label' => Mage::helper('cms')->__('Block Title'),
67-
'title' => Mage::helper('cms')->__('Block Title'),
68-
'required' => true,
69-
]);
70-
71-
$fieldset->addField('identifier', 'text', [
72-
'name' => 'identifier',
73-
'label' => Mage::helper('cms')->__('Identifier'),
74-
'title' => Mage::helper('cms')->__('Identifier'),
75-
'required' => true,
76-
'class' => 'validate-xml-identifier',
77-
]);
78-
79-
/**
80-
* Check is single store mode
81-
*/
82-
if (!Mage::app()->isSingleStoreMode()) {
83-
$field = $fieldset->addField('store_id', 'multiselect', [
84-
'name' => 'stores[]',
85-
'label' => Mage::helper('cms')->__('Store View'),
86-
'title' => Mage::helper('cms')->__('Store View'),
87-
'required' => true,
88-
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
89-
]);
90-
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
91-
$field->setRenderer($renderer);
92-
} else {
93-
$fieldset->addField('store_id', 'hidden', [
94-
'name' => 'stores[]',
95-
'value' => Mage::app()->getStore(true)->getId()
96-
]);
97-
$model->setStoreId(Mage::app()->getStore(true)->getId());
98-
}
99-
100-
$fieldset->addField('is_active', 'select', [
101-
'label' => Mage::helper('cms')->__('Status'),
102-
'title' => Mage::helper('cms')->__('Status'),
103-
'name' => 'is_active',
104-
'required' => true,
105-
'options' => [
106-
'1' => Mage::helper('cms')->__('Enabled'),
107-
'0' => Mage::helper('cms')->__('Disabled'),
108-
],
109-
]);
110-
if (!$model->getId()) {
111-
$model->setData('is_active', '1');
112-
}
113-
114-
$fieldset->addField('content', 'editor', [
115-
'name' => 'content',
116-
'label' => Mage::helper('cms')->__('Content'),
117-
'title' => Mage::helper('cms')->__('Content'),
118-
'style' => 'height:36em',
119-
'required' => true,
120-
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()
121-
]);
122-
123-
$form->setValues($model->getData());
124-
$form->setUseContainer(true);
125-
$this->setForm($form);
126-
127-
return parent::_prepareForm();
128-
}
12925
}

app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php

Lines changed: 3 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -18,111 +18,8 @@
1818
*
1919
* @category Mage
2020
* @package Mage_Adminhtml
21+
* @deprecated
2122
*/
22-
class Mage_Adminhtml_Block_Cms_Block_Grid extends Mage_Adminhtml_Block_Widget_Grid
23+
class Mage_Adminhtml_Block_Cms_Block_Grid extends Mage_Cms_Block_Adminhtml_Block_Grid
2324
{
24-
public function __construct()
25-
{
26-
parent::__construct();
27-
$this->setId('cmsBlockGrid');
28-
$this->setDefaultSort('title');
29-
$this->setDefaultDir('ASC');
30-
}
31-
32-
/**
33-
* @inheritDoc
34-
* @throws Exception
35-
*/
36-
protected function _prepareCollection()
37-
{
38-
$collection = Mage::getModel('cms/block')->getCollection();
39-
$this->setCollection($collection);
40-
return parent::_prepareCollection();
41-
}
42-
43-
/**
44-
* @inheritDoc
45-
* @throws Exception
46-
*/
47-
protected function _prepareColumns()
48-
{
49-
$this->addColumn('title', [
50-
'header' => Mage::helper('cms')->__('Title'),
51-
'align' => 'left',
52-
'index' => 'title',
53-
]);
54-
55-
$this->addColumn('identifier', [
56-
'header' => Mage::helper('cms')->__('Identifier'),
57-
'align' => 'left',
58-
'index' => 'identifier'
59-
]);
60-
61-
if (!Mage::app()->isSingleStoreMode()) {
62-
$this->addColumn('store_id', [
63-
'header' => Mage::helper('cms')->__('Store View'),
64-
'index' => 'store_id',
65-
'type' => 'store',
66-
'store_all' => true,
67-
'store_view' => true,
68-
'sortable' => false,
69-
'filter_condition_callback'
70-
=> [$this, '_filterStoreCondition'],
71-
]);
72-
}
73-
74-
$this->addColumn('is_active', [
75-
'header' => Mage::helper('cms')->__('Status'),
76-
'index' => 'is_active',
77-
'type' => 'options',
78-
'options' => [
79-
0 => Mage::helper('cms')->__('Disabled'),
80-
1 => Mage::helper('cms')->__('Enabled')
81-
],
82-
]);
83-
84-
$this->addColumn('creation_time', [
85-
'header' => Mage::helper('cms')->__('Date Created'),
86-
'index' => 'creation_time',
87-
'type' => 'datetime',
88-
]);
89-
90-
$this->addColumn('update_time', [
91-
'header' => Mage::helper('cms')->__('Last Modified'),
92-
'index' => 'update_time',
93-
'type' => 'datetime',
94-
]);
95-
96-
return parent::_prepareColumns();
97-
}
98-
99-
/**
100-
* @inheritDoc
101-
*/
102-
protected function _afterLoadCollection()
103-
{
104-
$this->getCollection()->walk('afterLoad');
105-
return parent::_afterLoadCollection();
106-
}
107-
108-
/**
109-
* @param Mage_Cms_Model_Resource_Block_Collection $collection
110-
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
111-
*/
112-
protected function _filterStoreCondition($collection, $column)
113-
{
114-
if ($value = $column->getFilter()->getValue()) {
115-
$collection->addStoreFilter($value);
116-
}
117-
}
118-
119-
/**
120-
* Row click url
121-
*
122-
* @return string
123-
*/
124-
public function getRowUrl($row)
125-
{
126-
return $this->getUrl('*/*/edit', ['block_id' => $row->getId()]);
127-
}
12825
}

0 commit comments

Comments
 (0)