Ejemplo n.º 1
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addPassword('password', 'Password')->setOption('description', 'minimal length is 5 char')->addRule($form::FILLED, 'Enter password')->addRule($form::MIN_LENGTH, 'Password is short', 5);
     $form->addPassword('password_confirm', 'Confirm password')->addRule($form::EQUAL, 'Invalid re password', $form['password']);
     return $form;
 }
Ejemplo n.º 2
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addSelect('registration', 'Registration type')->setOption(IComponentMapper::ITEMS_TITLE, 'name')->addRule($form::FILLED);
     $form->addText('email', 'Email')->addRule($form::FILLED)->addRule($form::EMAIL);
     return $form;
 }
Ejemplo n.º 3
0
 /**
  * @return \Nette\Forms\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addText('name', 'Name');
     $form->addSelect('parent', 'Parent')->setOption(IComponentMapper::ITEMS_TITLE, 'name')->setPrompt('root');
     $form->addSubmit('_submit', 'Save');
     return $form;
 }
Ejemplo n.º 4
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory ? $this->formFactory instanceof IFormFactory ? $this->formFactory->create() : call_user_func($this->formFactory) : new Form();
     if (!$form instanceof Form) {
         throw new InvalidStateException("Created object is not instance of 'Nette\\Application\\UI\\Form'.");
     }
     return $form;
 }
Ejemplo n.º 5
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addHidden('provider')->setValue($this->provider);
     $form['parameters'] = $this->securityManager->getLoginProviderByName($this->provider)->getFormContainer();
     $form->addSubmit('_submit', 'Save')->getControlPrototype()->class[] = 'btn-primary';
     $form->addSubmit('cancel', 'Cancel')->setValidationScope(false);
     return $form;
 }
Ejemplo n.º 6
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addText('name', 'Name');
     $form->addSelect('parent', 'Parent')->setOption(IComponentMapper::ITEMS_TITLE, function (Role $role) {
         return $role->getName();
     })->setPrompt('root');
     return $form;
 }
Ejemplo n.º 7
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addGroup();
     $form->addTextArea('text', 'Text');
     $form->setCurrentGroup();
     $form->addSubmit('_submit', 'Save');
     return $form;
 }
Ejemplo n.º 8
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $user = $form->addContainer('user');
     $user->setCurrentGroup($form->addGroup());
     $user->addText('email', 'E-mail')->addRule(Form::EMAIL, 'Enter email');
     $user['password'] = new PasswordContainer();
     return $form;
 }
Ejemplo n.º 9
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addGroup('Administration settings');
     $form->addText('routePrefix', 'Route prefix');
     $form->addText('defaultPresenter', 'Default presenter')->setDefaultValue('Admin:System:Dashboard');
     $form->setCurrentGroup();
     $form->addSubmit('_submit', 'Save');
     return $form;
 }
Ejemplo n.º 10
0
 /**
  * @return \Nette\Forms\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addGroup();
     $form->addSelect('user', 'Send notification to')->setTranslator()->setOption(IComponentMapper::ITEMS_TITLE, 'email');
     $form->addGroup('Criteria');
     $form->addSelect('type', 'Type')->setTranslator()->setOption(IComponentMapper::ITEMS_TITLE, 'message')->setPrompt('all');
     $form->addSelect('targetUser', 'Target user')->setTranslator()->setOption(IComponentMapper::ITEMS_TITLE, 'email')->setPrompt('all');
     return $form;
 }
Ejemplo n.º 11
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addGroup('Options');
     $form->addRadioList('section', 'Section', array('all' => 'All', 'cache' => 'Cache', 'sessions' => 'Sessions'))->setDefaultValue('all')->addCondition($form::EQUAL, 'namespace')->toggle('namespace');
     $form->setCurrentGroup();
     $form->addSubmit('_submit', 'Clear');
     $form->onSuccess[] = $this->success;
     return $form;
 }
Ejemplo n.º 12
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $user = $form->addContainer('user');
     $group = $form->addGroup();
     $user->setCurrentGroup($group);
     $user->addText('name', 'Name');
     $user->addTextArea('notation', 'Notation', 40, 4)->getControlPrototype()->attrs['class'] = 'input-block-level';
     $user['password'] = new PasswordContainer();
     return $form;
 }
Ejemplo n.º 13
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addGroup();
     $form->addText('name', 'Name')->addCondition($form::FILLED);
     $form->addGroup('Permissions');
     $form->addSelect('author', 'Owner')->setTranslator()->setOption(IComponentMapper::ITEMS_TITLE, 'email');
     $form->addMultiSelect('writeRoles', 'Write')->setOption(IComponentMapper::ITEMS_TITLE, 'name');
     $form->addCheckbox('protected', 'Protected')->addCondition($form::EQUAL, true)->toggle('form-permissions');
     $form->addGroup()->setOption('container', 'fieldset id=form-permissions');
     $form->addMultiSelect('readRoles', 'Read')->setOption(IComponentMapper::ITEMS_TITLE, 'name');
     return $form;
 }
Ejemplo n.º 14
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addText('username', 'E-mail')->setRequired('Please provide a e-mail.');
     $form->addPassword('password', 'Password')->setRequired('Please provide a password.');
     $form->addCheckbox('remember', 'Remember me on this computer');
     $form->addSubmit('_submit', 'Sign in')->getControlPrototype()->class[] = 'btn-primary';
     $socialButtons = $form->addContainer('socialButtons');
     foreach ($this->securityManager->getLoginProviders() as $loginProvider) {
         $socialButtons->addSubmit(str_replace(' ', '_', $loginProvider), $loginProvider)->setValidationScope(false);
     }
     return $form;
 }
Ejemplo n.º 15
0
 /**
  * @param callable $resetLinkCallback
  * @return \Venne\Forms\FormFactory
  */
 public function getFormFactory($resetLinkCallback)
 {
     return new FormFactory(function () use($resetLinkCallback) {
         $form = $this->formFactory->create();
         $form->setCurrentGroup();
         $form->addSubmit(static::SUBMIT_NAME, static::SUBMIT_CAPTION);
         $form->onSuccess[] = function (Form $form) use($resetLinkCallback) {
             if ($form->isSubmitted() === $form[self::SUBMIT_NAME]) {
                 $this->save($form, $resetLinkCallback);
             }
         };
         return $form;
     });
 }
Ejemplo n.º 16
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $nette = $form->addContainer('nette');
     $venne = $form->addContainer('venne');
     $doctrine = $form->addContainer('doctrine');
     /** @var $debugger \Nette\Forms\Container */
     $debugger = $nette->addContainer('debugger');
     $application = $nette->addContainer('application');
     $routing = $nette->addContainer('routing');
     $container = $nette->addContainer('container');
     $security = $nette->addContainer('security');
     /* application */
     $application->setCurrentGroup($form->addGroup('Application'));
     $application->addSelect('catchExceptions', 'Catch exceptions', array(true => 'yes', false => 'no'))->setDefaultValue(true);
     /* session */
     $session = $venne->addContainer('session');
     $session->setCurrentGroup($form->addGroup('Session'));
     $session['savePath'] = (new TextWithSelect('Save path'))->setItems(array('%tempDir%/sessions' => '%tempDir%/sessions'));
     /* debugger */
     $debugger->setCurrentGroup($group = $form->addGroup('Debugger'));
     $debugger->addSelect('strictMode', 'Strict mode')->setItems(array(true => 'yes', false => 'no'));
     $debugger->addText('edit', 'Editor');
     $debugger->addText('browser', 'Browser');
     $debugger->addText('email', 'E-mail for logs')->addCondition($form::FILLED)->addRule($form::EMAIL);
     $application->setCurrentGroup($group);
     $application->addCheckbox('debugger', 'Debugger panel in bluescreen')->setDefaultValue(true);
     $routing->setCurrentGroup($group);
     $routing->addCheckbox('debugger', 'Routing panel')->setDefaultValue(true);
     $container->setCurrentGroup($group);
     $container->addCheckbox('debugger', 'DI panel')->setDefaultValue(true);
     $security->setCurrentGroup($group);
     $security->addCheckbox('debugger', 'Security panel')->setDefaultValue(true);
     $doctrine->setCurrentGroup($group);
     $doctrine->addCheckbox('debugger', 'Database panel')->setDefaultValue(true);
     /* session */
     $container = $nette->addContainer('session');
     $container->setCurrentGroup($form->addGroup('Sessions'));
     $container->addCheckbox('autoStart', 'Autostart')->setDefaultValue(false);
     $container->addText('expiration', 'Expiration');
     $container->addText('cookiePath', 'Cookie path')->setDefaultValue('/');
     $container->addText('cookieDomain', 'Cookie domain');
     /* templating */
     $nette->setCurrentGroup($form->addGroup('Templating'));
     $nette->addSelect('xhtml', 'XHTML', array(true => 'yes', false => 'no'))->setDefaultValue(true);
     $form->setCurrentGroup();
     $form->addSubmit('_submit', 'Save');
     return $form;
 }
Ejemplo n.º 17
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $reg = array();
     foreach ($this->registrationRepository->findAll() as $registration) {
         $reg[$registration->id] = $registration->name;
     }
     $form->addGroup('Authentication');
     $form->addSelect('autologin', 'Auto login')->setItems($this->securityManager->getLoginProviders(), false)->setPrompt('Deactivated')->addCondition($form::EQUAL, '')->elseCondition()->toggle('form-autoregistration');
     $form->addGroup()->setOption('id', 'form-autoregistration');
     $form->addSelect('autoregistration', 'Auto registration')->setPrompt('Deactivated')->setItems($reg);
     $form->setCurrentGroup();
     $form->addSubmit('_submit', 'Save');
     return $form;
 }
Ejemplo n.º 18
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $user = $form->addContainer('user');
     $group = $form->addGroup();
     $user->setCurrentGroup($group);
     $user->addCheckbox('published', 'Enable');
     $user->addText('email', 'E-mail')->addRule(Form::EMAIL, 'Enter email');
     $user->addText('name', 'Name');
     $user->addTextArea('notation', 'Notation', 40, 4)->getControlPrototype()->attrs['class'] = 'input-block-level';
     $user->addMultiSelect('roleEntities', 'Roles')->setOption(IComponentMapper::ITEMS_TITLE, 'name');
     $user->addText('key', 'Lock key')->setOption('description', 'If is set user cannot log in.');
     $user['password'] = new PasswordContainer();
     return $form;
 }
Ejemplo n.º 19
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addGroup('Job');
     $form->addSelect('type', 'Type')->setItems(array_keys($this->jobManager->getJobs()), false)->addRule($form::FILLED);
     $form->addSelect('state', 'State')->setItems(array(Job::STATE_SCHEDULED, Job::STATE_IN_PROGRESS, Job::STATE_FAILED), false)->addRule($form::FILLED);
     $form->addSelect('priority', 'priority')->setItems(array(Job::PRIORITY_LOW => 'low', Job::PRIORITY_NORMAL => 'normal', Job::PRIORITY_HIGH => 'high'))->addRule($form::FILLED);
     //		$form->addDateTime('date', 'Date')
     //			->addRule($form::FILLED);
     //
     //		$form->addDateTime('interval', 'Interval')
     //			->addRule($form::FILLED);
     $form->addText('round', 'Round')->addCondition($form::FILLED)->addRule($form::INTEGER);
     return $form;
 }
Ejemplo n.º 20
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $form->addGroup();
     $user = $form->addContainer('user');
     $providers = $user->addDynamic('loginProviders', function (Container $container) use($form) {
         $container->setCurrentGroup($form->addGroup('Login provider'));
         $container->addSelect('type', 'Type')->setItems($this->securityManager->getLoginProviders(), false);
         $container->addText('uid', 'UID');
         $container->addSubmit('remove', 'Remove')->addRemoveOnClick();
     });
     $providers->addSubmit('add', 'Add')->addCreateOnClick();
     $form->setCurrentGroup();
     $form->addSubmit('_submit', 'Save');
     return $form;
 }
Ejemplo n.º 21
0
 /**
  * @param \Venne\Forms\IFormFactory $formFactory
  * @param \Kdyby\Doctrine\Entities\BaseEntity $entity
  * @return \Venne\Forms\FormFactory
  */
 protected function createFormFactory(IFormFactory $formFactory, BaseEntity $entity)
 {
     return new FormFactory(function () use($entity, $formFactory) {
         $form = $formFactory->create();
         $form->setCurrentGroup();
         $form->addSubmit(static::SUBMIT_NAME, static::SUBMIT_CAPTION);
         $form['_eventControl'] = $eventControl = new EventControl('_eventControl');
         $eventControl->onAttached[] = function () use($form, $entity) {
             $this->load($form, $entity);
         };
         $form->onSuccess[] = function (Form $form) use($entity) {
             if ($form->isSubmitted() === $form[self::SUBMIT_NAME]) {
                 $this->save($form, $entity);
             }
         };
         return $form;
     });
 }
Ejemplo n.º 22
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     \Kdyby\Replicator\Container::register();
     $form = $this->formFactory->create();
     $userTypes = array();
     foreach ($this->securityManager->getUserTypes() as $name => $val) {
         $userTypes[$name] = $val->getName();
     }
     $form->addCheckbox('enabled', 'Enabled');
     $form->addCheckbox('invitation', 'Only as invitation');
     $form->addText('name', 'Name');
     $form->addHidden('key');
     $form->addSelect('userType', 'Type', $userTypes);
     $form->addSelect('mode', 'Mode', Registration::getModes());
     $form->addSelect('loginProviderMode', 'Login provider mode', Registration::getLoginProviderModes());
     $form->addMultiSelect('roles', 'Roles')->setOption(IComponentMapper::ITEMS_TITLE, 'name');
     return $form;
 }
Ejemplo n.º 23
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory->create();
     $netteMailer = $form->addContainer('nette')->addContainer('mailer');
     $cmsMailer = $form->addContainer('system')->addContainer('mailer');
     $netteMailer->setCurrentGroup($group = $form->addGroup('Mailer'));
     $cmsMailer->setCurrentGroup($group);
     $cmsMailer->addText('senderEmail', 'Sender e-mail')->setDefaultValue('*****@*****.**');
     $cmsMailer->addText('senderName', 'Sender name')->setDefaultValue('Venne');
     $smtp = $netteMailer->addCheckbox('smtp', 'Use SMTP');
     $smtp->addCondition($form::EQUAL, true)->toggle('form-smtp');
     $netteMailer->setCurrentGroup($form->addGroup()->setOption('container', \Nette\Utils\Html::el('div')->id('form-smtp')));
     $netteMailer->addText('host', 'Host')->addConditionOn($smtp, $form::EQUAL, true)->addRule($form::FILLED, 'Enter host');
     $netteMailer->addText('port', 'Port')->addConditionOn($smtp, $form::EQUAL, true)->addCondition($form::FILLED)->addRule($form::INTEGER, 'Enter number format');
     $netteMailer['port']->setOption('placeholder', '25');
     $netteMailer->addSelect('secure', 'Secure', array('ssl' => 'ssl', 'tls' => 'tls'))->setPrompt('-----');
     $netteMailer->addText('username', 'Username')->addConditionOn($smtp, $form::EQUAL, true)->addCondition($form::FILLED)->addRule($form::EMAIL, 'Enter email address');
     $netteMailer->addPassword('password', 'Password');
     $netteMailer->addText('timeout', 'Timeout')->addConditionOn($smtp, $form::EQUAL, true)->addCondition($form::FILLED)->addRule($form::INTEGER, 'Enter number format');
     $form->setCurrentGroup();
     $form->addSubmit('_submit', 'Save');
     return $form;
 }
Ejemplo n.º 24
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = $this->formFactory ? $this->formFactory->create() : new Form();
     $this->configMapper->setForm($form);
     return $form;
 }