Example #1
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_USERS);
     $config_users_obj = new Object("<br/>");
     $this->result_obj = new Object();
     $this->result_obj->setId("page_result_area");
     $config_users_obj->add($this->result_obj);
     $this->users_table_obj = new Object();
     $this->users_table_obj->setId("users_table_obj");
     $config_users_obj->add($this->users_table_obj, "<br/><br/>");
     $user_table = new Table();
     $form = new Form($this);
     if (extension_loaded('openssl')) {
         $form->setEncryptObject(new EncryptDataWspObject());
     }
     $this->edt_login = new TextBox($form);
     $validation = new LiveValidation();
     $user_table->addRowColumns(__(LOGIN) . ":&nbsp;", $this->edt_login->setLiveValidation($validation->addValidatePresence()));
     $this->cmb_rights = new ComboBox($form);
     $this->cmb_rights->addItem(Page::RIGHTS_ADMINISTRATOR, "Administrator");
     $this->cmb_rights->addItem(Page::RIGHTS_MODERATOR, "Moderator");
     $this->cmb_rights->addItem(Page::RIGHTS_TRANSLATOR, "Translator");
     $this->cmb_rights->addItem(Page::RIGHTS_DEVELOPER, "Developer");
     $this->cmb_rights->addItem(Page::RIGHTS_AUTH_USER, "Authentificated user");
     $this->cmb_rights->addItem(Page::RIGHTS_GUEST, "Guest");
     $user_table->addRowColumns(__(RIGHTS) . ":&nbsp;", $this->cmb_rights);
     $this->edt_old_password = new Password($form);
     $validation = new LiveValidation();
     $this->old_passwd_row = $user_table->addRowColumns(__(OLD_PASSWORD) . ":&nbsp;", $this->edt_old_password->setLiveValidation($validation->addValidatePresence()->setFieldName(__(OLD_PASSWORD))));
     $this->old_passwd_row->setId("old_passwd_row");
     $this->edt_password = new Password($form);
     $validation = new LiveValidation();
     $user_table->addRowColumns(__(PASSWORD) . ":&nbsp;", $this->edt_password->setLiveValidation($validation->addValidatePresence()->setFieldName(__(PASSWORD))));
     $this->edt_confirm_passwd = new Password($form);
     $live_validation = new LiveValidation();
     $live_validation->addValidatePresence()->setFieldName(__(CONFIRM_PASSWD));
     $live_validation->addValidateConfirmation($this->edt_password->getId());
     $user_table->addRowColumns(__(CONFIRM_PASSWD) . " :&nbsp;", $this->edt_confirm_passwd->setLiveValidation($live_validation))->setStyle("color:black;");
     $user_table->addRow();
     $this->validate_btn = new Button($form);
     $this->validate_btn->setValue(__(ADD))->onClick("addWspUser")->setAjaxEvent()->disableAjaxWaitMessage()->assignEnterKey();
     $this->modify_btn = new Button($form);
     $this->modify_btn->setValue(__(SAVE))->onClick("changeWspUser")->setAjaxEvent()->disableAjaxWaitMessage()->assignEnterKey();
     $this->cancel_btn = new Button($this);
     $this->cancel_btn->setValue(__(CANCEL))->onClick("refresh")->setAjaxEvent()->disableAjaxWaitMessage();
     $modif_btn_table = new Table();
     $modif_btn_table->addRowColumns($this->validate_btn, "&nbsp;", $this->modify_btn, "&nbsp;", $this->cancel_btn);
     $user_table->addRow($modif_btn_table)->setColspan(2)->setAlign(RowTable::ALIGN_CENTER);
     $config_users_obj->add($form->setContent($user_table), "<br/><br/>");
     $this->render = new AdminTemplateForm($this, $config_users_obj);
 }