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_Oauth_Block_Adminhtml_Oauth_Consumer_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36: {
37: 38: 39: 40: 41:
42: protected $_model;
43:
44: 45: 46: 47: 48:
49: public function getModel()
50: {
51: if (null === $this->_model) {
52: $this->_model = Mage::registry('current_consumer');
53: }
54: return $this->_model;
55: }
56:
57: 58: 59: 60: 61:
62: protected function _prepareForm()
63: {
64: $model = $this->getModel();
65: $form = new Varien_Data_Form(array(
66: 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'
67: ));
68:
69: $fieldset = $form->addFieldset('base_fieldset', array(
70: 'legend' => Mage::helper('oauth')->__('Consumer Information'), 'class' => 'fieldset-wide'
71: ));
72:
73: if ($model->getId()) {
74: $fieldset->addField('id', 'hidden', array('name' => 'id', 'value' => $model->getId()));
75: }
76: $fieldset->addField('name', 'text', array(
77: 'name' => 'name',
78: 'label' => Mage::helper('oauth')->__('Name'),
79: 'title' => Mage::helper('oauth')->__('Name'),
80: 'required' => true,
81: 'value' => $model->getName(),
82: ));
83:
84: $fieldset->addField('key', 'text', array(
85: 'name' => 'key',
86: 'label' => Mage::helper('oauth')->__('Key'),
87: 'title' => Mage::helper('oauth')->__('Key'),
88: 'disabled' => true,
89: 'required' => true,
90: 'value' => $model->getKey(),
91: ));
92:
93: $fieldset->addField('secret', 'text', array(
94: 'name' => 'secret',
95: 'label' => Mage::helper('oauth')->__('Secret'),
96: 'title' => Mage::helper('oauth')->__('Secret'),
97: 'disabled' => true,
98: 'required' => true,
99: 'value' => $model->getSecret(),
100: ));
101:
102: $fieldset->addField('callback_url', 'text', array(
103: 'name' => 'callback_url',
104: 'label' => Mage::helper('oauth')->__('Callback URL'),
105: 'title' => Mage::helper('oauth')->__('Callback URL'),
106: 'required' => false,
107: 'value' => $model->getCallbackUrl(),
108: 'class' => 'validate-url',
109: ));
110:
111: $fieldset->addField('rejected_callback_url', 'text', array(
112: 'name' => 'rejected_callback_url',
113: 'label' => Mage::helper('oauth')->__('Rejected Callback URL'),
114: 'title' => Mage::helper('oauth')->__('Rejected Callback URL'),
115: 'required' => false,
116: 'value' => $model->getRejectedCallbackUrl(),
117: 'class' => 'validate-url',
118: ));
119:
120: $form->setAction($this->getUrl('*/*/save'));
121: $form->setUseContainer(true);
122: $this->setForm($form);
123:
124: return parent::_prepareForm();
125: }
126: }
127: