00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Catalog_Product_Edit extends Mage_Adminhtml_Block_Widget
00035 {
00036 public function __construct()
00037 {
00038 parent::__construct();
00039 $this->setTemplate('catalog/product/edit.phtml');
00040 $this->setId('product_edit');
00041 }
00042
00043
00044
00045
00046
00047
00048 public function getProduct()
00049 {
00050 return Mage::registry('current_product');
00051 }
00052
00053 protected function _prepareLayout()
00054 {
00055 if (!$this->getRequest()->getParam('popup')) {
00056 $this->setChild('back_button',
00057 $this->getLayout()->createBlock('adminhtml/widget_button')
00058 ->setData(array(
00059 'label' => Mage::helper('catalog')->__('Back'),
00060 'onclick' => 'setLocation(\''.$this->getUrl('*/*/', array('store'=>$this->getRequest()->getParam('store', 0))).'\')',
00061 'class' => 'back'
00062 ))
00063 );
00064 } else {
00065 $this->setChild('back_button',
00066 $this->getLayout()->createBlock('adminhtml/widget_button')
00067 ->setData(array(
00068 'label' => Mage::helper('catalog')->__('Close Window'),
00069 'onclick' => 'window.close()',
00070 'class' => 'cancel'
00071 ))
00072 );
00073 }
00074
00075 if (!$this->getProduct()->isReadonly()) {
00076 $this->setChild('reset_button',
00077 $this->getLayout()->createBlock('adminhtml/widget_button')
00078 ->setData(array(
00079 'label' => Mage::helper('catalog')->__('Reset'),
00080 'onclick' => 'setLocation(\''.$this->getUrl('*/*/*', array('_current'=>true)).'\')'
00081 ))
00082 );
00083
00084 $this->setChild('save_button',
00085 $this->getLayout()->createBlock('adminhtml/widget_button')
00086 ->setData(array(
00087 'label' => Mage::helper('catalog')->__('Save'),
00088 'onclick' => 'productForm.submit()',
00089 'class' => 'save'
00090 ))
00091 );
00092 }
00093
00094 if (!$this->getRequest()->getParam('popup')) {
00095 if (!$this->getProduct()->isReadonly()) {
00096 $this->setChild('save_and_edit_button',
00097 $this->getLayout()->createBlock('adminhtml/widget_button')
00098 ->setData(array(
00099 'label' => Mage::helper('catalog')->__('Save And Continue Edit'),
00100 'onclick' => 'saveAndContinueEdit(\''.$this->getSaveAndContinueUrl().'\')',
00101 'class' => 'save'
00102 ))
00103 );
00104 }
00105 if ($this->getProduct()->isDeleteable()) {
00106 $this->setChild('delete_button',
00107 $this->getLayout()->createBlock('adminhtml/widget_button')
00108 ->setData(array(
00109 'label' => Mage::helper('catalog')->__('Delete'),
00110 'onclick' => 'confirmSetLocation(\''.Mage::helper('catalog')->__('Are you sure?').'\', \''.$this->getDeleteUrl().'\')',
00111 'class' => 'delete'
00112 ))
00113 );
00114 }
00115
00116 if ($this->getProduct()->isDuplicable()) {
00117 $this->setChild('duplicate_button',
00118 $this->getLayout()->createBlock('adminhtml/widget_button')
00119 ->setData(array(
00120 'label' => Mage::helper('catalog')->__('Duplicate'),
00121 'onclick' => 'setLocation(\''.$this->getDuplicateUrl().'\')',
00122 'class' => 'add'
00123 ))
00124 );
00125 }
00126 }
00127
00128 return parent::_prepareLayout();
00129 }
00130
00131 public function getBackButtonHtml()
00132 {
00133 return $this->getChildHtml('back_button');
00134 }
00135
00136 public function getCancelButtonHtml()
00137 {
00138 return $this->getChildHtml('reset_button');
00139 }
00140
00141 public function getSaveButtonHtml()
00142 {
00143 return $this->getChildHtml('save_button');
00144 }
00145
00146 public function getSaveAndEditButtonHtml()
00147 {
00148 return $this->getChildHtml('save_and_edit_button');
00149 }
00150
00151 public function getDeleteButtonHtml()
00152 {
00153 return $this->getChildHtml('delete_button');
00154 }
00155
00156 public function getDuplicateButtonHtml()
00157 {
00158 return $this->getChildHtml('duplicate_button');
00159 }
00160
00161 public function getValidationUrl()
00162 {
00163 return $this->getUrl('*
00164
00165
00166
00167
00168 */save', array('_current'=>true, 'back'=>null));
00169 }
00170
00171 public function getSaveAndContinueUrl()
00172 {
00173 return $this->getUrl('*
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 */delete', array('_current'=>true));
00203 }
00204
00205 public function getDuplicateUrl()
00206 {
00207 return $this->getUrl('*
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249