*/ class Mage_Adminhtml_Block_Widget_Form_Container extends Mage_Adminhtml_Block_Widget_Container { protected $_objectId = 'id'; protected $_formScripts = array(); protected $_formInitScripts = array(); protected $_mode = 'edit'; protected $_blockGroup = 'adminhtml'; public function __construct() { parent::__construct(); if (!$this->hasData('template')) { $this->setTemplate('widget/form/container.phtml'); } $this->_addButton('back', array( 'label' => Mage::helper('adminhtml')->__('Back'), 'onclick' => 'setLocation(\'' . $this->getBackUrl() . '\')', 'class' => 'back', ), -1); $this->_addButton('reset', array( 'label' => Mage::helper('adminhtml')->__('Reset'), 'onclick' => 'setLocation(window.location.href)', ), -1); $objId = $this->getRequest()->getParam($this->_objectId); if (! empty($objId)) { $this->_addButton('delete', array( 'label' => Mage::helper('adminhtml')->__('Delete'), 'class' => 'delete', 'onclick' => 'deleteConfirm(\'' . Mage::helper('core')->jsQuoteEscape( Mage::helper('adminhtml')->__('Are you sure you want to do this?') ) .'\', \'' . $this->getDeleteUrl() . '\')', )); } $this->_addButton('save', array( 'label' => Mage::helper('adminhtml')->__('Save'), 'onclick' => 'editForm.submit();', 'class' => 'save', ), 1); } protected function _prepareLayout() { if ($this->_blockGroup && $this->_controller && $this->_mode) { $this->setChild('form', $this->getLayout()->createBlock($this->_blockGroup . '/' . $this->_controller . '_' . $this->_mode . '_form' ) ); } return parent::_prepareLayout(); } /** * Get URL for back (reset) button * * @return string */ public function getBackUrl() { return $this->getUrl('*/*/'); } public function getDeleteUrl() { return $this->getUrl('*/*/delete', array($this->_objectId => $this->getRequest()->getParam($this->_objectId))); } /** * Get form save URL * * @deprecated * @see getFormActionUrl() * @return string */ public function getSaveUrl() { return $this->getFormActionUrl(); } /** * Get form action URL * * @return string */ public function getFormActionUrl() { if ($this->hasFormActionUrl()) { return $this->getData('form_action_url'); } return $this->getUrl('*/' . $this->_controller . '/save'); } public function getFormHtml() { $this->getChild('form')->setData('action', $this->getSaveUrl()); return $this->getChildHtml('form'); } public function getFormInitScripts() { if ( !empty($this->_formInitScripts) && is_array($this->_formInitScripts) ) { return ''; } return ''; } public function getFormScripts() { if ( !empty($this->_formScripts) && is_array($this->_formScripts) ) { return ''; } return ''; } public function getHeaderWidth() { return ''; } public function getHeaderCssClass() { return 'icon-head head-' . strtr($this->_controller, '_', '-'); } public function getHeaderHtml() { return '