Beispiel #1
0
 /**
  * Constructor.
  */
 public function __construct($ajax = false)
 {
     parent::__construct();
     $form = new Form('sign-in');
     $form->setAction("");
     $username = new TextField('identity');
     $username->setRequired(true);
     $username->setHasInvitation(true);
     $username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
     $form->addElement($username);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $form->addElement($password);
     $remeberMe = new CheckboxField('remember');
     $remeberMe->setValue(true);
     $remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
     $form->addElement($remeberMe);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     if ($ajax) {
         $form->setAjaxResetOnSuccess(false);
         $form->setAjax();
         $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
         $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
         $this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
     }
     $this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
 }
Beispiel #2
0
 /**
  * @param string $formName
  * @param string $submitDecorator
  * @return Form
  */
 public function getSignInForm($formName = 'sign-in', $submitDecorator = 'button')
 {
     $form = new Form($formName);
     $username = new TextField('identity');
     $username->setRequired(true);
     $username->setHasInvitation(true);
     $username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
     $form->addElement($username);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $form->addElement($password);
     $remeberMe = new CheckboxField('remember');
     $remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
     $remeberMe->setValue(true);
     $form->addElement($remeberMe);
     $submit = new Submit('submit', $submitDecorator);
     $submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
     $form->addElement($submit);
     return $form;
 }
Beispiel #3
0
 public function ftpAttrs()
 {
     $this->checkXP();
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('admin', 'page_title_manage_plugins_ftp_info'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
     $form = new Form('ftp');
     $login = new TextField('host');
     $login->setValue('localhost');
     $login->setRequired(true);
     $login->setLabel($language->text('admin', 'plugins_manage_ftp_form_host_label'));
     $form->addElement($login);
     $login = new TextField('login');
     $login->setHasInvitation(true);
     $login->setInvitation('login');
     $login->setRequired(true);
     $login->setLabel($language->text('admin', 'plugins_manage_ftp_form_login_label'));
     $form->addElement($login);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $password->setLabel($language->text('admin', 'plugins_manage_ftp_form_password_label'));
     $form->addElement($password);
     $port = new TextField('port');
     $port->setValue(21);
     $port->addValidator(new IntValidator());
     $port->setLabel($language->text('admin', 'plugins_manage_ftp_form_port_label'));
     $form->addElement($port);
     $submit = new Submit('submit');
     $submit->setValue($language->text('admin', 'plugins_manage_ftp_form_submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             OW::getSession()->set('ftpAttrs', array('host' => trim($data['host']), 'login' => trim($data['login']), 'password' => trim($data['password']), 'port' => (int) $data['port']));
             if (!empty($_GET['back_uri'])) {
                 $this->redirect(OW_URL_HOME . urldecode($_GET['back_uri']));
             } else {
                 $this->redirectToAction('index');
             }
         }
     }
 }
Beispiel #4
0
 /**
  * Requests local FTP attributes to update items/platform source code.
  */
 public function ftpAttrs()
 {
     $language = OW::getLanguage();
     $this->setPageHeading($language->text("admin", "page_title_manage_plugins_ftp_info"));
     $this->setPageHeadingIconClass("ow_ic_gear_wheel");
     $form = new Form("ftp");
     $login = new TextField("host");
     $login->setValue("localhost");
     $login->setRequired(true);
     $login->setLabel($language->text("admin", "plugins_manage_ftp_form_host_label"));
     $form->addElement($login);
     $login = new TextField("login");
     $login->setHasInvitation(true);
     $login->setInvitation("login");
     $login->setRequired(true);
     $login->setLabel($language->text("admin", "plugins_manage_ftp_form_login_label"));
     $form->addElement($login);
     $password = new PasswordField("password");
     $password->setHasInvitation(true);
     $password->setInvitation("password");
     $password->setRequired(true);
     $password->setLabel($language->text("admin", "plugins_manage_ftp_form_password_label"));
     $form->addElement($password);
     $port = new TextField("port");
     $port->setValue(21);
     $port->addValidator(new IntValidator());
     $port->setLabel($language->text("admin", "plugins_manage_ftp_form_port_label"));
     $form->addElement($port);
     $submit = new Submit("submit");
     $submit->setValue($language->text("admin", "plugins_manage_ftp_form_submit_label"));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $ftpAttrs = array("host" => trim($data["host"]), "login" => trim($data["login"]), "password" => trim($data["password"]), "port" => (int) $data["port"]);
             OW::getSession()->set("ftpAttrs", $ftpAttrs);
             $this->redirectToBackUri($_GET);
             $this->redirectToAction('index');
         }
     }
 }