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: class Mage_XmlConnect_Block_Adminhtml_Queue_Edit
35: extends Mage_Adminhtml_Block_Widget_Form_Container
36: {
37: 38: 39:
40: public function __construct()
41: {
42: $this->_objectId = 'id';
43: $this->_controller = 'adminhtml_queue';
44: $this->_blockGroup = 'xmlconnect';
45: parent::__construct();
46:
47: $message = Mage::registry('current_message');
48: if ($message && $message->getStatus() != Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE) {
49: $this->_removeButton('reset');
50: $this->_removeButton('save');
51: } else {
52: $this->_updateButton('save', 'label', $this->__('Queue Message'));
53: $this->_updateButton('save', 'onclick', 'if (editForm.submit()) {disableElements(\'save\')}');
54: }
55: $this->_removeButton('delete');
56:
57: $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getBackUrl() . '\')');
58: }
59:
60: 61: 62: 63: 64:
65: public function getBackUrl()
66: {
67: $template = Mage::registry('current_template');
68: $message = Mage::registry('current_message');
69: return $message && !$message->getId() && $template && $template->getId()
70: ? $this->getUrl('*/*/template')
71: : $this->getUrl('*/*/queue');
72: }
73:
74: 75: 76: 77: 78:
79: public function ()
80: {
81: $message = Mage::registry('current_message');
82: if ($message && $message->getId()) {
83: return $this->__('Edit AirMail Message Queue #%s', $this->escapeHtml($message->getId()));
84: } else {
85: return $this->__('New AirMail Message Queue');
86: }
87: }
88: }
89: