forked from n2bh/magento-enterprise-1.13.1.0
/
Edit.php
89 lines (86 loc) · 3.67 KB
/
Edit.php
1
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/**
* Magento Enterprise Edition
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition License
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.magentocommerce.com/license/enterprise-edition
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Enterprise
* @package Enterprise_Cms
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
* @license http://www.magentocommerce.com/license/enterprise-edition
*/
/**
* Cms page edit form revisions tab
*
* @category Enterprise
* @package Enterprise_Cms
* @author Magento Core Team <core@magentocommerce.com>
*/
class Enterprise_Cms_Block_Adminhtml_Cms_Page_Edit
extends Mage_Adminhtml_Block_Template
{
/**
* Adding js to CE blocks to implement special functionality which
* will allow go back to edit page with pre loaded tab passed through query string.
* Added permission checking to remove some buttons if needed.
*
* @return Enterprise_Cms_Block_Adminhtml_Cms_Page_Edit
*/
protected function _prepareLayout()
{
$tabsBlock = $this->getLayout()->getBlock('cms_page_edit_tabs');
/* @var $tabBlock Mage_Adminhtml_Block_Cms_Page_Edit_Tabs */
if ($tabsBlock) {
$editBlock = $this->getLayout()->getBlock('cms_page_edit');
/* @var $editBlock Mage_Adminhtml_Block_Cms_Page_Edit */
if ($editBlock) {
$page = Mage::registry('cms_page');
if ($page) {
if ($page->getId()) {
$editBlock->addButton('preview', array(
'label' => Mage::helper('enterprise_cms')->__('Preview'),
'onclick' => 'pagePreviewAction()',
'class' => 'preview',
));
}
$formBlock = $editBlock->getChild('form');
if ($formBlock) {
$formBlock->setTemplate('enterprise/cms/page/edit/form.phtml');
if ($page->getUnderVersionControl()) {
$tabId = $this->getRequest()->getParam('tab');
if ($tabId) {
$formBlock->setSelectedTabId($tabsBlock->getId() . '_' . $tabId)
->setTabJsObject($tabsBlock->getJsObjectName());
}
}
}
// If user non-publisher he can save page only if it has disabled status
if ($page->getUnderVersionControl()) {
if ($page->getId() && $page->getIsActive() == Mage_Cms_Model_Page::STATUS_ENABLED) {
if (!Mage::getSingleton('enterprise_cms/config')->canCurrentUserPublishRevision()) {
$editBlock->removeButton('delete');
$editBlock->removeButton('save');
$editBlock->removeButton('saveandcontinue');
}
}
}
}
}
}
return $this;
}
}