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_Catalog_Product_Attribute_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
36: {
37:
38: public function __construct()
39: {
40: $this->_objectId = 'attribute_id';
41: $this->_controller = 'catalog_product_attribute';
42:
43: parent::__construct();
44:
45: if($this->getRequest()->getParam('popup')) {
46: $this->_removeButton('back');
47: $this->_addButton(
48: 'close',
49: array(
50: 'label' => Mage::helper('catalog')->__('Close Window'),
51: 'class' => 'cancel',
52: 'onclick' => 'window.close()',
53: 'level' => -1
54: )
55: );
56: } else {
57: $this->_addButton(
58: 'save_and_edit_button',
59: array(
60: 'label' => Mage::helper('catalog')->__('Save and Continue Edit'),
61: 'onclick' => 'saveAndContinueEdit()',
62: 'class' => 'save'
63: ),
64: 100
65: );
66: }
67:
68: $this->_updateButton('save', 'label', Mage::helper('catalog')->__('Save Attribute'));
69: $this->_updateButton('save', 'onclick', 'saveAttribute()');
70:
71: if (! Mage::registry('entity_attribute')->getIsUserDefined()) {
72: $this->_removeButton('delete');
73: } else {
74: $this->_updateButton('delete', 'label', Mage::helper('catalog')->__('Delete Attribute'));
75: }
76: }
77:
78: public function ()
79: {
80: if (Mage::registry('entity_attribute')->getId()) {
81: $frontendLabel = Mage::registry('entity_attribute')->getFrontendLabel();
82: if (is_array($frontendLabel)) {
83: $frontendLabel = $frontendLabel[0];
84: }
85: return Mage::helper('catalog')->__('Edit Product Attribute "%s"', $this->htmlEscape($frontendLabel));
86: }
87: else {
88: return Mage::helper('catalog')->__('New Product Attribute');
89: }
90: }
91:
92: public function getValidationUrl()
93: {
94: return $this->getUrl('*/*/validate', array('_current'=>true));
95: }
96:
97: public function getSaveUrl()
98: {
99: return $this->getUrl('*/'.$this->_controller.'/save', array('_current'=>true, 'back'=>null));
100: }
101: }
102: