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
00035 class Mage_Adminhtml_Block_Permissions_User_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
00036 {
00037
00038 protected function _prepareForm()
00039 {
00040 $model = Mage::registry('permissions_user');
00041
00042 $form = new Varien_Data_Form();
00043
00044 $form->setHtmlIdPrefix('user_');
00045
00046 $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Account Information')));
00047
00048 if ($model->getUserId()) {
00049 $fieldset->addField('user_id', 'hidden', array(
00050 'name' => 'user_id',
00051 ));
00052 } else {
00053 if (! $model->hasData('is_active')) {
00054 $model->setIsActive(1);
00055 }
00056 }
00057
00058 $fieldset->addField('username', 'text', array(
00059 'name' => 'username',
00060 'label' => Mage::helper('adminhtml')->__('User Name'),
00061 'id' => 'username',
00062 'title' => Mage::helper('adminhtml')->__('User Name'),
00063 'required' => true,
00064 ));
00065
00066 $fieldset->addField('firstname', 'text', array(
00067 'name' => 'firstname',
00068 'label' => Mage::helper('adminhtml')->__('First Name'),
00069 'id' => 'firstname',
00070 'title' => Mage::helper('adminhtml')->__('First Name'),
00071 'required' => true,
00072 ));
00073
00074 $fieldset->addField('lastname', 'text', array(
00075 'name' => 'lastname',
00076 'label' => Mage::helper('adminhtml')->__('Last Name'),
00077 'id' => 'lastname',
00078 'title' => Mage::helper('adminhtml')->__('Last Name'),
00079 'required' => true,
00080 ));
00081
00082 $fieldset->addField('email', 'text', array(
00083 'name' => 'email',
00084 'label' => Mage::helper('adminhtml')->__('Email'),
00085 'id' => 'customer_email',
00086 'title' => Mage::helper('adminhtml')->__('User Email'),
00087 'class' => 'required-entry validate-email',
00088 'required' => true,
00089 ));
00090
00091 if ($model->getUserId()) {
00092 $fieldset->addField('password', 'password', array(
00093 'name' => 'new_password',
00094 'label' => Mage::helper('adminhtml')->__('New Password'),
00095 'id' => 'new_pass',
00096 'title' => Mage::helper('adminhtml')->__('New Password'),
00097 'class' => 'input-text validate-admin-password',
00098 ));
00099
00100 $fieldset->addField('confirmation', 'password', array(
00101 'name' => 'password_confirmation',
00102 'label' => Mage::helper('adminhtml')->__('Password Confirmation'),
00103 'id' => 'confirmation',
00104 'class' => 'input-text validate-cpassword',
00105 ));
00106 }
00107 else {
00108 $fieldset->addField('password', 'password', array(
00109 'name' => 'password',
00110 'label' => Mage::helper('adminhtml')->__('Password'),
00111 'id' => 'customer_pass',
00112 'title' => Mage::helper('adminhtml')->__('Password'),
00113 'class' => 'input-text required-entry validate-password',
00114 'required' => true,
00115 ));
00116 $fieldset->addField('confirmation', 'password', array(
00117 'name' => 'password_confirmation',
00118 'label' => Mage::helper('adminhtml')->__('Password Confirmation'),
00119 'id' => 'confirmation',
00120 'title' => Mage::helper('adminhtml')->__('Password Confirmation'),
00121 'class' => 'input-text required-entry validate-cpassword',
00122 'required' => true,
00123 ));
00124 }
00125
00126 if (Mage::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
00127 $fieldset->addField('is_active', 'select', array(
00128 'name' => 'is_active',
00129 'label' => Mage::helper('adminhtml')->__('This account is'),
00130 'id' => 'is_active',
00131 'title' => Mage::helper('adminhtml')->__('Account status'),
00132 'class' => 'input-select',
00133 'style' => 'width: 80px',
00134 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive')),
00135 ));
00136 }
00137
00138 $fieldset->addField('user_roles', 'hidden', array(
00139 'name' => 'user_roles',
00140 'id' => '_user_roles',
00141 ));
00142
00143 $data = $model->getData();
00144
00145 unset($data['password']);
00146
00147 $form->setValues($data);
00148
00149 $this->setForm($form);
00150
00151 return parent::_prepareForm();
00152 }
00153 }