示例#1
0
 public function initFields($extra = array())
 {
     $this->request = $extra['request'];
     $this->fields['first_name'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('First name'), 'initial' => '', 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['last_name'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Last name'), 'initial' => '', 'widget_attrs' => array('maxlength' => 50, 'size' => 20)));
     $this->fields['login'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Login'), 'max_length' => 15, 'min_length' => 3, 'initial' => '', 'help_text' => __('The login must be between 3 and 15 characters long and contains only letters and digits.'), 'widget_attrs' => array('maxlength' => 15, 'size' => 10)));
     $this->fields['email'] = new Pluf_Form_Field_Email(array('required' => true, 'label' => __('Email'), 'initial' => '', 'help_text' => __('Double check the email address as the password is directly sent to the user.')));
     $this->fields['language'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Language'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_SelectInput', 'widget_attrs' => array('choices' => Pluf_L10n::getInstalledLanguages())));
     $this->fields['public_key'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Add a public key'), 'initial' => '', 'widget_attrs' => array('rows' => 3, 'cols' => 40), 'widget' => 'Pluf_Form_Widget_TextareaInput', 'help_text' => __('Paste a SSH or monotone public key. Be careful to not provide your private key here!')));
 }
示例#2
0
 public function initFields($extra = array())
 {
     $this->user = $extra['user'];
     $this->fields['first_name'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('First name'), 'initial' => $this->user->first_name, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['last_name'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Last name'), 'initial' => $this->user->last_name, 'widget_attrs' => array('maxlength' => 50, 'size' => 20)));
     $this->fields['email'] = new Pluf_Form_Field_Email(array('required' => true, 'label' => __('Your mail'), 'initial' => $this->user->email, 'help_text' => __('If you change your email address, an email will be sent to the new address to confirm it.')));
     $this->fields['language'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Language'), 'initial' => $this->user->language, 'widget' => 'Pluf_Form_Widget_SelectInput', 'widget_attrs' => array('choices' => Pluf_L10n::getInstalledLanguages())));
     $this->fields['password'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Your password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', 'help_text' => Pluf_Template::markSafe(__('Leave blank if you do not want to change your password.') . '<br />' . __('Your password must be hard for other people to find it, but easy for you to remember.')), 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['password2'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Confirm your password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['ssh_key'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Add a public SSH key'), 'initial' => '', 'widget_attrs' => array('rows' => 3, 'cols' => 40), 'widget' => 'Pluf_Form_Widget_TextareaInput', 'help_text' => __('Be careful to provide your public key and not your private key!')));
 }
示例#3
0
 public function initFields($extra = array())
 {
     $this->user = $extra['user'];
     $this->fields['first_name'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('First name'), 'initial' => $this->user->first_name, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['last_name'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Last name'), 'initial' => $this->user->last_name, 'widget_attrs' => array('maxlength' => 50, 'size' => 20)));
     $this->fields['email'] = new Pluf_Form_Field_Email(array('required' => true, 'label' => __('Email'), 'initial' => $this->user->email, 'widget_attrs' => array('maxlength' => 50, 'size' => 20)));
     $this->fields['language'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Language'), 'initial' => $this->user->language, 'widget' => 'Pluf_Form_Widget_SelectInput', 'widget_attrs' => array('choices' => Pluf_L10n::getInstalledLanguages())));
     $this->fields['password'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', 'help_text' => Pluf_Template::markSafe(__('Leave blank if you do not want to change the password.') . '<br />' . __('The password must be hard for other people to find it, but easy for the user to remember.')), 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['password2'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Confirm password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     if ($extra['request']->user->administrator) {
         $this->fields['staff'] = new Pluf_Form_Field_Boolean(array('required' => false, 'label' => __('Staff'), 'initial' => $this->user->staff, 'widget' => 'Pluf_Form_Widget_CheckboxInput', 'help_text' => __('If you give staff rights to a user, you really need to trust him.')));
     }
     $attrs = $extra['request']->user->id == $this->user->id ? array('readonly' => 'readonly') : array();
     $this->fields['active'] = new Pluf_Form_Field_Boolean(array('required' => false, 'label' => __('Active'), 'initial' => $this->user->active, 'widget' => 'Pluf_Form_Widget_CheckboxInput', 'widget_attrs' => $attrs, 'help_text' => __('If the user is not getting the confirmation email or is abusing the system, you can directly enable or disable his account here.')));
 }
示例#4
0
 public function initFields($extra = array())
 {
     $this->user = $extra['user'];
     $user_data = IDF_UserData::factory($this->user);
     $this->fields['first_name'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('First name'), 'initial' => $this->user->first_name, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['last_name'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Last name'), 'initial' => $this->user->last_name, 'widget_attrs' => array('maxlength' => 50, 'size' => 20)));
     $this->fields['email'] = new Pluf_Form_Field_Email(array('required' => true, 'label' => __('Your mail'), 'initial' => $this->user->email, 'help_text' => __('If you change your email address, an email will be sent to the new address to confirm it.')));
     $this->fields['language'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Language'), 'initial' => $this->user->language, 'widget' => 'Pluf_Form_Widget_SelectInput', 'widget_attrs' => array('choices' => Pluf_L10n::getInstalledLanguages())));
     $this->fields['password'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Your password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', 'help_text' => Pluf_Template::markSafe(__('Leave blank if you do not want to change your password.') . '<br />' . __('Your password must be hard for other people to find it, but easy for you to remember.')), 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['password2'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Confirm your password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['description'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Description'), 'initial' => $user_data->description, 'widget_attrs' => array('rows' => 3, 'cols' => 40), 'widget' => 'Pluf_Form_Widget_TextareaInput'));
     $this->fields['twitter'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Twitter username'), 'initial' => $user_data->twitter, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['public_email'] = new Pluf_Form_Field_Email(array('required' => false, 'label' => __('Public email address'), 'initial' => $user_data->public_email, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['website'] = new Pluf_Form_Field_Url(array('required' => false, 'label' => __('Website URL'), 'initial' => $user_data->website, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['custom_avatar'] = new Pluf_Form_Field_File(array('required' => false, 'label' => __('Upload custom avatar'), 'initial' => '', 'max_size' => Pluf::f('max_upload_size', 2097152), 'move_function_params' => array('upload_path' => Pluf::f('upload_path') . '/avatars', 'upload_path_create' => true, 'upload_overwrite' => true, 'file_name' => 'user_' . $this->user->id . '_%s'), 'help_text' => __('An image file with a width and height not larger than 60 pixels (bigger images are scaled down).')));
     $this->fields['remove_custom_avatar'] = new Pluf_Form_Field_Boolean(array('required' => false, 'label' => __('Remove custom avatar'), 'initial' => false, 'widget' => 'Pluf_Form_Widget_CheckboxInput', 'widget_attrs' => array(), 'help_text' => __('Tick this to delete the custom avatar.')));
     $this->fields['public_key'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Add a public key'), 'initial' => '', 'widget_attrs' => array('rows' => 3, 'cols' => 40), 'widget' => 'Pluf_Form_Widget_TextareaInput', 'help_text' => __('Paste a SSH or monotone public key. Be careful to not provide your private key here!')));
 }
示例#5
0
 public function initFields($extra = array())
 {
     $this->user = $extra['user'];
     $user_data = IDF_UserData::factory($this->user);
     $this->fields['first_name'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('First name'), 'initial' => $this->user->first_name, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['last_name'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Last name'), 'initial' => $this->user->last_name, 'widget_attrs' => array('maxlength' => 50, 'size' => 20)));
     $this->fields['email'] = new Pluf_Form_Field_Email(array('required' => true, 'label' => __('Email'), 'initial' => $this->user->email, 'widget_attrs' => array('maxlength' => 50, 'size' => 20)));
     $this->fields['language'] = new Pluf_Form_Field_Varchar(array('required' => true, 'label' => __('Language'), 'initial' => $this->user->language, 'widget' => 'Pluf_Form_Widget_SelectInput', 'widget_attrs' => array('choices' => Pluf_L10n::getInstalledLanguages())));
     $this->fields['password'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', 'help_text' => Pluf_Template::markSafe(__('Leave blank if you do not want to change the password.') . '<br />' . __('The password must be hard for other people to find it, but easy for the user to remember.')), 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['password2'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Confirm password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['description'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Description'), 'initial' => $user_data->description, 'widget_attrs' => array('rows' => 3, 'cols' => 40), 'widget' => 'Pluf_Form_Widget_TextareaInput'));
     $this->fields['twitter'] = new Pluf_Form_Field_Varchar(array('required' => false, 'label' => __('Twitter username'), 'initial' => $user_data->twitter, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['public_email'] = new Pluf_Form_Field_Email(array('required' => false, 'label' => __('Public email address'), 'initial' => $user_data->public_email, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['website'] = new Pluf_Form_Field_Url(array('required' => false, 'label' => __('Website URL'), 'initial' => $user_data->website, 'widget_attrs' => array('maxlength' => 50, 'size' => 15)));
     $this->fields['custom_avatar'] = new Pluf_Form_Field_File(array('required' => false, 'label' => __('Upload custom avatar'), 'initial' => '', 'max_size' => Pluf::f('max_upload_size', 2097152), 'move_function_params' => array('upload_path' => Pluf::f('upload_path') . '/avatars', 'upload_path_create' => true, 'upload_overwrite' => true, 'file_name' => 'user_' . $this->user->id . '_%s'), 'help_text' => __('An image file with a width and height not larger than 60 pixels (bigger images are scaled down).')));
     $this->fields['remove_custom_avatar'] = new Pluf_Form_Field_Boolean(array('required' => false, 'label' => __('Remove custom avatar'), 'initial' => false, 'widget' => 'Pluf_Form_Widget_CheckboxInput', 'widget_attrs' => array(), 'help_text' => __('Tick this to delete the custom avatar.')));
     if ($extra['request']->user->administrator) {
         $this->fields['staff'] = new Pluf_Form_Field_Boolean(array('required' => false, 'label' => __('Staff'), 'initial' => $this->user->staff, 'widget' => 'Pluf_Form_Widget_CheckboxInput', 'help_text' => __('If you give staff rights to a user, you really need to trust him.')));
     }
     $attrs = $extra['request']->user->id == $this->user->id ? array('readonly' => 'readonly') : array();
     $this->fields['active'] = new Pluf_Form_Field_Boolean(array('required' => false, 'label' => __('Active'), 'initial' => $this->user->active, 'widget' => 'Pluf_Form_Widget_CheckboxInput', 'widget_attrs' => $attrs, 'help_text' => __('If the user is not getting the confirmation email or is abusing the system, you can directly enable or disable his account here.')));
 }