예제 #1
0
 public function indexAction()
 {
     // action body
     $form1 = new Zend_Dojo_Form();
     $form1->setMethod('post')->setAction("/");
     $form1->addElement('DateTextBox', 'date1', array('label' => 'Choose a date:', 'datePattern' => 'yyyy-MM-dd', 'validators' => array('Date'), 'required' => true))->addElement('TimeTextBox', 'time1', array('label' => 'Choose a time:', 'timePattern' => 'HH:mm:ss'))->addElement('NumberSpinner', 'number1', array('label' => 'Choose a number:', 'value' => 0, 'smallDelta' => 1, 'min' => 0, 'max' => 30, 'defaultTimeout' => 100, 'timeoutChangeRate' => 100))->addElement('HorizontalSlider', 'slide1', array('label' => 'Let\'s slide:', 'minimum' => 0, 'maximum' => 25, 'discreteValues' => 10, 'style' => 'width: 450px;', 'topDecorationDijit' => 'HorizontalRuleLabels', 'topDecorationLabels' => array('0%', '50%', '100%'), 'topDecorationParams' => array('style' => 'padding-bottom: 20px;')))->addElement('SubmitButton', 'submit', array('label' => 'Submit!'));
     $this->view->form1 = $form1;
 }
예제 #2
0
 public function __construct($templateId)
 {
     parent::__construct();
     $router = new Shared_Controller_Router();
     $this->setAction($router->assemble(array('id' => $templateId), 'template'));
     $this->setMethod('post');
     // privacy
     $privacy = new Zend_Dojo_Form_Element_ComboBox('privacy');
     $privacy->setLabel(__('Privacy'));
     $privacy->setRequired(true);
     $privacy->addMultiOptions(array('private' => __('Private: users can follow this these events'), 'public' => __('Public: users cannot follow these events')));
     $privacy->setValue('public');
     $this->addElement($privacy);
     // web hooks
     $webhooks = new Zend_Dojo_Form_Element_CheckBox('web_hooks');
     $webhooks->setLabel(__('Allow web hooks'));
     $webhooks->setRequired(true);
     $webhooks->setChecked(true);
     $webhooks->setCheckedValue('yes');
     $webhooks->setUncheckedValue('no');
     $this->addElement($webhooks);
     // submit
     $submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
     $submit->setLabel(__('Submit'));
     $this->addElement($submit);
 }
예제 #3
0
파일: Login.php 프로젝트: neilgarb/myqron
 public function __construct()
 {
     parent::__construct();
     $router = new Shared_Controller_Router();
     $this->setAction($router->assemble(array(), 'login'));
     $this->setMethod('post');
     // email
     $email = new Zend_Dojo_Form_Element_TextBox('email');
     $email->setLabel(__('Email'));
     $email->setRequired(true);
     $this->addElement($email);
     // password
     $password = new Zend_Dojo_Form_Element_PasswordTextBox('password');
     $password->setLabel(__('Password'));
     $password->setRequired(true);
     $this->addElement($password);
     // remember
     $remember = new Zend_Dojo_Form_Element_CheckBox('remember');
     $remember->setLabel(__('Remember me on this computer'));
     $remember->setCheckedValue('yes');
     $remember->setUncheckedValue('no');
     $remember->setChecked(true);
     $this->addElement($remember);
     // submit
     $submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
     $submit->setLabel(__('Submit'));
     $this->addElement($submit);
 }
예제 #4
0
 public function __construct()
 {
     parent::__construct();
     $router = new Shared_Controller_Router();
     $this->setAction($router->assemble(array(), 'application-new'));
     $this->setMethod('post');
     // name
     $name = new Zend_Dojo_Form_Element_TextBox('name');
     $name->setLabel(__('Name'));
     $name->setRequired(true);
     $this->addElement($name);
     // description
     $description = new Zend_Dojo_Form_Element_Textarea('description');
     $description->setLabel(__('Description'));
     $description->setAttrib('rows', '5');
     $description->setAttrib('cols', '60');
     $this->addElement($description);
     // url
     $url = new Zend_Dojo_Form_Element_TextBox('url');
     $url->setLabel(__('URL'));
     $url->setRequired(true);
     $this->addElement($url);
     // privacy
     $privacy = new Zend_Dojo_Form_Element_ComboBox('privacy');
     $privacy->setLabel(__('Privacy'));
     $privacy->setRequired(true);
     $privacy->addMultiOptions(array('private' => __('Private: users cannot follow this application'), 'public' => __('Public: users can follow this application')));
     $privacy->setValue('public');
     $this->addElement($privacy);
     // submit
     $submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
     $submit->setLabel(__('Submit'));
     $this->addElement($submit);
 }
예제 #5
0
 public function addSubForm(Zend_Form $form, $name, $order = null)
 {
     $form->loadDefaultDecorators();
     $form->removeDecorator('Form');
     $form->addDecorator('Fieldset')->addDecorator('DtDdWrapper');
     $form->setElementsBelongTo($name);
     return parent::addSubForm($form, $name, $order);
 }
예제 #6
0
 public function __construct()
 {
     parent::__construct();
     //$fieldtype,$fieldname,$table,$columnname,$cssname,$labelname,$required,$validationtype,$min,$max,$decorator,$value
     $formfield = new App_Form_Field();
     //$vtype=array('Alpha');
     $datefrom = $formfield->field('Text', 'datefrom', '', '', 'mand', 'From date', true, '', '', '', '', '', 0, '');
     $this->addElements(array($datefrom));
 }
예제 #7
0
파일: Login.php 프로젝트: ajbrown/bitnotion
 public function init()
 {
     parent::init();
     $this->setName('loginForm');
     $this->setAttrib('id', 'login-form');
     $this->setAction('/account/login');
     $this->setMethod('post');
     $this->setDecorators(array('FormElements', 'DijitForm'));
     $this->addElement('ValidationTextBox', 'username', array('label' => 'Username', 'required' => true, 'trim' => true, 'filters' => array('StringToLower')));
     $this->addElement('PasswordTextBox', 'password', array('label' => 'Password', 'required' => true, 'trim' => false));
     $this->addElement('SubmitButton', 'submit', array('ignore' => true, 'label' => 'Log Me In'));
 }
예제 #8
0
    public function init()
    {
        parent::init();
        $this->setName('releaseForm');
        $this->setAttrib('id', 'release-form');
        $this->setMethod('post');
        $this->setDecorators(array('FormElements', 'DijitForm'));
        $this->addElement('ValidationTextBox', 'title', array('label' => 'Release Title', 'required' => true, 'trim' => true, 'validators' => array(array('Alnum', true, array('allowWhiteSpace' => true)))));
        $this->addElement('DateTextBox', 'publishDate', array('label' => 'Publish Date', 'description' => 'The date which this release will be available
		        	for purchase.  Note: tracks may be available as singles
		        	before this date.', 'default' => date('m/d/Y')));
        $this->addElement('SubmitButton', 'submit', array('ignore' => true, 'label' => 'Save Release'));
    }
예제 #9
0
 public function __construct($options = null)
 {
     if (isset($options['adaptors'])) {
         $this->adaptors = (array) $options['adaptors'];
     }
     if (isset($options['request'])) {
         // Should be on the same line but too long to fit
         $httpClassName = 'Zend_Controller_Request_Http';
         if (get_class($options['request']) === $httpClassName) {
             $this->request = $options['request'];
         }
     }
     parent::__construct($options);
 }
예제 #10
0
 public function __construct($path)
 {
     Zend_Dojo::enableForm($this);
     parent::__construct($path);
     $formfield = new App_Form_Field();
     // 	$fieldtype,$fieldname,$table,$columnname,$cssname,$labelname,$required,$validationtype,$min,$max,$rows,$cols,$decorator,$value
     $branch = $formfield->field('Select', 'branch', '', '', '', '', false, '', '', '', '', '', 0, 0);
     $branch->setAttrib('onchange', 'Getuser(this.value,"' . $path . '")');
     $loanofficer = $formfield->field('Select', 'loanofficer', '', '', '', '', false, '', '', '', '', '', 0, 0);
     $fromdate = $formfield->field('Text', 'fromdate', '', '', '', '', false, '', '', '', '', '', 0, 0);
     $submit = new Zend_Form_Element_Submit('Search');
     $pdf = new Zend_Form_Element_Submit('PDF');
     $this->addElements(array($fromdate, $branch, $loanofficer, $submit, $pdf));
 }
예제 #11
0
 public function init()
 {
     parent::init();
     $this->setName('confirmRegisterForm');
     $this->setAttrib('id', 'confirm-register-form');
     $this->addElementPrefixPath('App_Validate', 'App/Validate/', 'validate');
     $this->setDecorators(array('FormElements', 'DijitForm'));
     $config = Initializer::getConfig();
     //--------------------------------------
     // Elements
     //--------------------------------------
     $this->addElement('ValidationTextBox', 'emailAddress', array('label' => 'Your E-Mail Address', 'description' => 'The E-mail address you wish you confirm', 'required' => true, 'trim' => true, 'filters' => array('StringToLower'), 'validators' => array(array('EmailAddress', false, array('validateMx' => true)))));
     $this->addElement('TextBox', 'code', array('label' => 'Confirmation Code', 'description' => 'This is the code you received from us.', 'required' => true, 'trim' => true, 'filters' => array('StringToUpper'), 'validators' => array('Alnum')));
     $this->addElement('SubmitButton', 'submit', array('ignore' => true, 'label' => 'Confirm My E-Mail Address'));
 }
예제 #12
0
 public function init()
 {
     parent::init();
     $config = Initializer::getConfig();
     $userId = Zend_Auth::getInstance()->getIdentity()->id;
     $this->setAttrib('id', 'new-track-form');
     $this->setDecorators(array('FormElements', 'DijitForm'));
     $this->addElement('FilteringSelect', 'releaseId', array('label' => 'Release', 'storeId' => 'artistReleasesDataStore', 'storeType' => 'dojo.data.ItemFileReadStore', 'description' => 'The release to attach this track to.  The track will still be downloadable as a single track, but will be grouped under the release', 'autocomplete' => true, 'storeParams' => array('url' => '/data/artists/releases/' . $userId . '?published=0', 'requestMethod' => 'get'), 'dijitParams' => array('searchAttr' => 'title')));
     $this->addElement('ValidationTextBox', 'title', array('label' => 'Track Title', 'required' => true, 'trim' => true, 'description' => 'The display title, appears in store', 'validators' => array(array('Alnum', false, array('allowWhiteSpace' => true)))));
     $this->addElement('DateTextBox', 'publishDate', array('label' => 'Publish Date', 'description' => 'The date which this track will be available for purchase', 'default' => date('m/d/Y')));
     $audioFile = new Zend_Form_Element_File('audioFile');
     $audioFile->setLabel('Master Audio File')->addDecorators(array('Description'))->setRequired(true)->setDescription('The original (master) track.  Must be a .WAV file')->setDestination($config->injestion->workDir)->addValidator('Extension', false, explode(',', $config->injestion->allowedExtensions))->addValidator('MimeType', false, explode(',', $config->injestion->allowedMimeTypes))->addFilter('Rename', array('target' => $config->injestion->workDir . '/track_' . str_pad($userId, 8, '0') . '_' . date('Ymdhs') . '.wav', 'overwrite' => true));
     $this->addElement($audioFile);
     $this->setEnctype('multipart/form-data');
     $this->addElement('SubmitButton', 'submit', array('ignore' => true, 'label' => 'Upload Track'));
 }
예제 #13
0
 public function __construct($applicationId)
 {
     parent::__construct();
     $router = new Shared_Controller_Router();
     $this->setAction($router->assemble(array('id' => $applicationId), 'application'));
     $this->setMethod('post');
     // privacy
     $privacy = new Zend_Dojo_Form_Element_ComboBox('privacy');
     $privacy->setLabel(__('Privacy'));
     $privacy->setRequired(true);
     $privacy->addMultiOptions(array('private' => __('Private: users can follow this application'), 'public' => __('Public: users cannot follow this application')));
     $privacy->setValue('public');
     $this->addElement($privacy);
     // submit
     $submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
     $submit->setLabel(__('Submit'));
     $this->addElement($submit);
 }
예제 #14
0
 public function init()
 {
     parent::init();
     $this->setName('registerForm');
     $this->setAttrib('id', 'register-form');
     $this->setMethod('post');
     $this->addElementPrefixPath('App_Validate', 'App/Validate/', 'validate');
     $this->setDecorators(array('FormElements', 'DijitForm'));
     $config = Initializer::getConfig();
     //--------------------------------------
     // Elements
     //--------------------------------------
     $this->addElement('ValidationTextBox', 'emailAddress', array('label' => 'Your E-Mail Address', 'description' => 'Give us your valid E-mail address.  We check this, so make sure its valid and you can access it.', 'required' => true, 'trim' => true, 'filters' => array('StringToLower'), 'validators' => array(array('EmailAddress', false, array('validateMx' => true)), array('UniqueAccountDetail', false, array('field' => 'emailAddress')))));
     $this->addElement('PasswordTextBox', 'password', array('label' => 'Choose a Password', 'description' => 'Make it a good one. It must be at least 6 characters', 'required' => true, 'trim' => false, 'validators' => array(array('StringLength', false, array(6)), array('PasswordConfirmation', true, array('field' => 'confirm_password')))));
     $this->addElement('PasswordTextBox', 'confirm_password', array('label' => 'Retype Your Password', 'description' => 'Just to make sure you didn\'t mess up', 'required' => true, 'trim' => false));
     $this->addElement('CheckBox', 'sellerAccount', array('label' => 'I want to sell music, too.', 'description' => 'Check this box if you want to sell music on BitNotion.  You will still be able to purchase music using this account.'));
     $this->addElement('Captcha', 'captcha', array('label' => 'Are you human?', 'descripton' => 'Type the letters shown, and prove you\'re smarter than the average robot.', 'captcha' => array('captcha' => 'ReCaptcha', 'privkey' => $config->recaptcha->privateKey, 'pubkey' => $config->recaptcha->publicKey)));
     $this->addElement('SubmitButton', 'submit', array('ignore' => true, 'label' => 'Create My Account'));
 }
예제 #15
0
 public function __construct()
 {
     parent::__construct();
     $router = new Shared_Controller_Router();
     $this->setAction($router->assemble(array(), 'register'));
     $this->setMethod('post');
     // email
     $email = new Zend_Dojo_Form_Element_TextBox('email');
     $email->setLabel(__('Email'));
     $email->setRequired(true);
     $this->addElement($email);
     // password
     $password = new Zend_Dojo_Form_Element_PasswordTextBox('password');
     $password->setLabel(__('Password'));
     $password->setRequired(true);
     $this->addElement($password);
     // submit
     $submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
     $submit->setLabel(__('Submit'));
     $this->addElement($submit);
 }
예제 #16
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     //$this->setAction($options['action'])->setMethod('post');
     // initialize form
     $this->setName('newOutlayForm')->setAction('/projects/outlay/create')->setMethod('post');
     $humanResource = new Zend_Form_Element_Hidden('humanResource');
     $humanResource->addValidator('Int')->addFilter('StringTrim');
     $this->addElement($humanResource);
     $project = new Zend_Form_Element_Hidden('project');
     $project->addValidator('Int')->addFilter('StringTrim');
     $this->addElement($project);
     $action = new Zend_Form_Element_Hidden('action');
     $action->addValidator('Int')->addFilter('StringTrim');
     $this->addElement($action);
     $this->setDecorators(array('FormElements', array('TabContainer', array('id' => 'tabContainer', 'style' => 'width:660px; height:500px', 'dijitParams' => array('tabPosition' => 'top')), 'DijitForm')));
     // create rich editor
     $observation = new Zend_Dojo_Form_Element_Editor('observation');
     $observation->setLabel('Observation:')->setOptions(array('width' => '120px', 'height' => '40px'));
     $this->addElement($observation);
 }
예제 #17
0
 public function __construct($applicationId)
 {
     parent::__construct();
     $router = new Shared_Controller_Router();
     $this->setAction($router->assemble(array(), 'template-new') . '?applicationid=' . $applicationId);
     $this->setMethod('post');
     // name
     $name = new Zend_Dojo_Form_Element_TextBox('name');
     $name->setLabel(__('Name'));
     $name->setRequired(true);
     $this->addElement($name);
     // body
     $body = new Zend_Dojo_Form_Element_Textarea('body');
     $body->setLabel(__('Body'));
     $body->setRequired(true);
     $body->setAttrib('rows', '5');
     $body->setAttrib('cols', '60');
     $body->setDescription(__('HTML: You may only use the &lt;a&gt; tag.') . '<br />' . __('Tokens: Tokens should be %-delimeted, e.g. %post_url%.'));
     $body->getDecorator('Description')->setEscape(false);
     $this->addElement($body);
     // privacy
     $privacy = new Zend_Dojo_Form_Element_ComboBox('privacy');
     $privacy->setLabel(__('Privacy'));
     $privacy->setRequired(true);
     $privacy->addMultiOptions(array('private' => __('Private: users can follow this these events'), 'public' => __('Public: users cannot follow these events')));
     $privacy->setValue('public');
     $this->addElement($privacy);
     // web hooks
     $webhooks = new Zend_Dojo_Form_Element_CheckBox('web_hooks');
     $webhooks->setLabel(__('Allow web hooks'));
     $webhooks->setRequired(true);
     $webhooks->setChecked(true);
     $webhooks->setCheckedValue('yes');
     $webhooks->setUncheckedValue('no');
     $this->addElement($webhooks);
     // submit
     $submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
     $submit->setLabel(__('Submit'));
     $this->addElement($submit);
 }
예제 #18
0
 /**
  * Returns the html needed to createa a dijit form.  Also adds needed digit module and creates
  * the appropriate dijit javascript initialization
  * 
  * @param Zend_Dojo_Form $form - dojo form
  * @param bool $use_dojo - optional flag of whether to declare dijit.form.form (FF4 iframe has issues)
  * @return string
  */
 public function renderDojoFormTag($form, $use_dojo = true)
 {
     $this->view->dojo()->requireModule('dijit.form.Form');
     $id = $form->getId();
     $name = $form->getFullyQualifiedName();
     $style = $form->getAttrib('style');
     $method = $form->getMethod();
     $enctype = $form->getEnctype();
     $action = $form->getAction();
     $dojo_type = $use_dojo && $this->_useDeclarative() ? ' dojoType="dijit.form.Form"' : '';
     if (!$method) {
         $method = 'post';
     }
     $xhtml = '<form ' . ' id="' . $this->view->escape($id) . '"' . ' name="' . $this->view->escape($name) . '"' . ' action="' . $this->view->escape($action) . '"' . ' method="' . $method . '"' . ' enctype="' . $enctype . '"' . $dojo_type . ' style="' . $style . '">';
     if ($this->_useProgrammatic()) {
         //$dijitParams = $form->getDijitParams();
         $dijitParams['dojoType'] = 'dijit.form.Form';
         $this->view->dojo()->addDijit($id, $dijitParams);
     }
     return $xhtml;
 }
예제 #19
0
 public function getElement()
 {
     $element = new Zend_Dojo_Form();
     $element->setAttribs(array('name' => 'foo', 'style' => 'width: 300px; height: 500px;', 'class' => 'someclass', 'dijitParams' => array('labelAttr' => 'foobar', 'typeAttr' => 'barbaz')));
     return $element;
 }
예제 #20
0
 /**
  * @group ZF-4435
  */
 public function testShouldCreateAppropriateIdsForElementsInSubForms()
 {
     $form = new Zend_Dojo_Form();
     $form->setDecorators(array('FormElements', array('TabContainer', array('id' => 'tabContainer', 'style' => 'width: 600px; height: 300px;', 'dijitParams' => array('tabPosition' => 'top'))), 'DijitForm'));
     $sliderForm = new Zend_Dojo_Form_SubForm();
     $sliderForm->setAttribs(array('name' => 'slidertab', 'legend' => 'Slider Elements'));
     $sliderForm->addElement('HorizontalSlider', 'slide1', array('label' => 'Slide me:', 'minimum' => 0, 'maximum' => 25, 'discreteValues' => 10, 'style' => 'width: 450px;', 'topDecorationDijit' => 'HorizontalRuleLabels', 'topDecorationLabels' => array('0%', '50%', '100%'), 'topDecorationParams' => array('style' => 'padding-bottom: 20px;')));
     $form->addSubForm($sliderForm, 'slidertab')->setView($this->getView());
     $html = $form->render();
     $this->assertContains('id="slidertab-slide1-slider"', $html);
     $this->assertContains('id="slidertab-slide1-slider-topDecoration"', $html);
     $this->assertContains('id="slidertab-slide1-slider-topDecoration-labels"', $html);
 }
예제 #21
0
 public function __construct()
 {
     $filename = preg_replace('~php$~', 'ini', __FILE__);
     $ini = new Zend_Config_Ini($filename, 'fields');
     parent::__construct($ini);
 }
예제 #22
0
 public function testRenderingShouldEnforceFormName()
 {
     $element = new Zend_Dojo_Form();
     $element->setAttribs(array('style' => 'width: 300px; height: 500px;', 'class' => 'someclass', 'dijitParams' => array('labelAttr' => 'foobar', 'typeAttr' => 'barbaz')));
     $element->setView($this->view);
     $decorator = new Zend_Dojo_Form_Decorator_DijitForm();
     $decorator->setElement($element);
     $html = $decorator->render('');
     $this->assertRegexp('/id=".{1,}"/', $html, $html);
 }