Example #1
0
 public function __construct($albumId)
 {
     parent::__construct('albumEditForm');
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
     $this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
     $this->setAjax(TRUE);
     $this->setAjaxResetOnSuccess(FALSE);
     $albumIdField = new HiddenField('album-id');
     $albumIdField->setValue($album->id);
     $albumIdField->setRequired();
     $albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($albumIdField);
     $albumNameField = new TextField('albumName');
     $albumNameField->setValue($album->name);
     $albumNameField->setRequired();
     if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
         $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(TRUE, NULL, $album->name));
     }
     $albumNameField->addAttribute('class', 'ow_photo_album_name_input');
     $this->addElement($albumNameField);
     $desc = new Textarea('desc');
     $desc->setValue(!empty($album->description) ? $album->description : NULL);
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
     $desc->addAttribute('class', 'ow_photo_album_description_textarea');
     $this->addElement($desc);
 }
Example #2
0
 /**
  * Class constructor
  *
  */
 public function __construct($configs)
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $field = new RadioField('itunes_mode');
     $field->setOptions(array("test" => $language->text("skadateios", "itunes_mode_test"), "live" => $language->text("skadateios", "itunes_mode_live")));
     $field->setValue($configs["itunes_mode"]);
     $this->addElement($field);
     $field = new CheckboxField('billing_enabled');
     $field->setValue($configs["billing_enabled"]);
     $this->addElement($field);
     $field = new TextField('itunes_secret');
     $field->addValidator(new ConfigRequireValidator());
     $field->setValue($configs["itunes_secret"]);
     $this->addElement($field);
     $promoUrl = new TextField('app_url');
     $promoUrl->setRequired();
     $promoUrl->addValidator(new UrlValidator());
     $promoUrl->setLabel($language->text('skadateios', 'app_url_label'));
     $promoUrl->setDescription($language->text('skadateios', 'app_url_desc'));
     $promoUrl->setValue($configs['app_url']);
     $this->addElement($promoUrl);
     $smartBanner = new CheckboxField('smart_banner');
     $smartBanner->setLabel($language->text('skadateios', 'smart_banner_label'));
     $smartBanner->setDescription($language->text('skadateios', 'smart_banner_desc'));
     $smartBanner->setValue($configs['smart_banner']);
     $this->addElement($smartBanner);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
Example #3
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $configs = OW::getConfig()->getValues('googlelocation');
     $element = new TextField('api_key');
     $element->setValue($configs['api_key']);
     $validator = new StringValidator(0, 40);
     $validator->setErrorMessage($language->text('googlelocation', 'api_key_too_long'));
     $element->addValidator($validator);
     $this->addElement($element);
     $options = array(GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_MILES => $language->text('googlelocation', 'miles'), GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_KM => $language->text('googlelocation', 'kms'));
     $distanseUnits = new Selectbox('distanse_units');
     $distanseUnits->setOptions($options);
     $distanseUnits->setValue(GOOGLELOCATION_BOL_LocationService::getInstance()->getDistanseUnits());
     $distanseUnits->setHasInvitation(false);
     $this->addElement($distanseUnits);
     $restrictions = new Selectbox('country_restriction');
     $restrictions->setValue(!empty($configs['country_restriction']) ? $configs['country_restriction'] : null);
     $restrictions->setOptions($this->countryList);
     $restrictions->setInvitation(OW::getLanguage()->text('googlelocation', 'no_country_restriction'));
     $this->addElement($restrictions);
     $autofill = OW::getConfig()->getValue('googlelocation', 'auto_fill_location_on_search');
     $autoFillLocationOnSearch = new CheckboxField('auto_fill_location_on_search');
     $autoFillLocationOnSearch->setValue(empty($autofill) || $autofill == '0' ? false : $autofill);
     $this->addElement($autoFillLocationOnSearch);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('base', 'edit_button'));
     $this->addElement($submit);
 }
Example #4
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $field = new TextField('public_key');
     $field->addValidator(new ConfigRequireValidator());
     $this->addElement($field);
     $field = new CheckboxField('billing_enabled');
     $this->addElement($field);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
     $promoUrl = new TextField('app_url');
     $promoUrl->setRequired();
     $promoUrl->addValidator(new UrlValidator());
     $promoUrl->setLabel($language->text('skandroid', 'app_url_label'));
     $promoUrl->setDescription($language->text('skandroid', 'app_url_desc'));
     $promoUrl->setValue(OW::getConfig()->getValue('skandroid', 'app_url'));
     $this->addElement($promoUrl);
     $smartBanner = new CheckboxField('smart_banner');
     $smartBanner->setLabel($language->text('skandroid', 'smart_banner_label'));
     $smartBanner->setDescription($language->text('skandroid', 'smart_banner_desc'));
     $smartBanner->setValue(OW::getConfig()->getValue('skandroid', 'smart_banner'));
     $this->addElement($smartBanner);
 }
Example #5
0
 public function __construct()
 {
     parent::__construct('add-album');
     $this->setAjax();
     $this->setAjaxResetOnSuccess(FALSE);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'));
     $ajaxFunc = new HiddenField('ajaxFunc');
     $ajaxFunc->setValue('ajaxMoveToAlbum');
     $ajaxFunc->setRequired();
     $this->addElement($ajaxFunc);
     $fromAlbum = new HiddenField('from-album');
     $fromAlbum->setRequired();
     $fromAlbum->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($fromAlbum);
     $toAlbum = new HiddenField('to-album');
     $this->addElement($toAlbum);
     $photos = new HiddenField('photos');
     $photos->setRequired();
     $this->albumPhotosValidator = new AlbumPhotosValidator();
     $photos->addValidator($this->albumPhotosValidator);
     $this->addElement($photos);
     $albumName = new TextField('album-name');
     $albumName->setRequired();
     $albumName->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE));
     $albumName->setHasInvitation(TRUE);
     $albumName->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
     $albumName->addAttribute('class', 'ow_smallmargin');
     $this->addElement($albumName);
     $desc = new Textarea('desc');
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($desc);
     $this->addElement(new Submit('add'));
 }
Example #6
0
 public function __construct($albumId)
 {
     parent::__construct(self::FORM_NAME);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
     $this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
     $this->setAjax(true);
     $this->setAjaxResetOnSuccess(false);
     $albumIdField = new HiddenField(self::ELEMENT_ALBUM_ID);
     $albumIdField->setValue($album->id);
     $albumIdField->setRequired();
     $albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($albumIdField);
     $albumNameField = new TextField(self::ELEMENT_ALBUM_NAME);
     $albumNameField->setValue($album->name);
     $albumNameField->setRequired();
     if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
         $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(true, null, $album->name));
     }
     $albumNameField->addAttribute('class', 'ow_photo_album_name_input');
     $this->addElement($albumNameField);
     $desc = new Textarea(self::ELEMENT_DESC);
     $desc->setValue(!empty($album->description) ? $album->description : NULL);
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
     $desc->addAttribute('class', 'ow_photo_album_description_textarea');
     $this->addElement($desc);
     $this->triggerReady(array('albumId' => $albumId));
 }
Example #7
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
     $this->setAjax();
     $lang = OW::getLanguage();
     $affName = new TextField('name');
     $affName->setRequired(true);
     $affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
     $this->addElement($affName);
     $email = new TextField('email');
     $email->setRequired(true);
     $email->setLabel($lang->text('ocsaffiliates', 'email'));
     $email->addValidator(new EmailValidator());
     $this->addElement($email);
     $password = new PasswordField('password');
     $password->setRequired(true);
     $password->setLabel($lang->text('ocsaffiliates', 'password'));
     $this->addElement($password);
     $payment = new Textarea('payment');
     $payment->setRequired(true);
     $payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
     $this->addElement($payment);
     if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
         $terms = new CheckboxField('terms');
         $validator = new RequiredValidator();
         $validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
         $terms->addValidator($validator);
         $this->addElement($terms);
     }
     $submit = new Submit('signup');
     $submit->setValue($lang->text('ocsaffiliates', 'signup_btn'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.location.reload();\n            }\n        }");
 }
Example #8
0
 public function settings()
 {
     $adminForm = new Form('adminForm');
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $element = new TextField('autoclick');
     $element->setRequired(true);
     $validator = new IntValidator(1);
     $validator->setErrorMessage($language->text('autoviewmore', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $element->setLabel($language->text('autoviewmore', 'admin_auto_click'));
     $element->setValue($config->getValue('autoviewmore', 'autoclick'));
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue($language->text('autoviewmore', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $config = OW::getConfig();
             $config->saveConfig('autoviewmore', 'autoclick', $values['autoclick']);
             OW::getFeedback()->info($language->text('autoviewmore', 'user_save_success'));
         }
     }
     $this->addForm($adminForm);
 }
Example #9
0
 public function index()
 {
     $language = OW::getLanguage();
     $billingService = BOL_BillingService::getInstance();
     $adminForm = new Form('adminForm');
     $element = new TextField('creditValue');
     $element->setRequired(true);
     $element->setLabel($language->text('billingcredits', 'admin_usd_credit_value'));
     $element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc'));
     $element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue'));
     $validator = new FloatValidator(0.1);
     $validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue($language->text('billingcredits', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']);
             OW::getFeedback()->info($language->text('billingcredits', 'user_save_success'));
         }
     }
     $this->addForm($adminForm);
     $this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
     $this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_app');
 }
 public function __construct($interlocutorId)
 {
     $language = OW::getLanguage();
     parent::__construct('mailbox-create-conversation-form');
     $this->setAction(OW::getRouter()->urlFor('MAILBOX_CTRL_Mailbox', 'sendMessageAjaxResponder', array('userId' => $interlocutorId)));
     $this->setId('mailbox-create-conversation-form');
     $this->setEnctype('multipart/form-data');
     $this->setAjax();
     $this->setAjaxResetOnSuccess(false);
     $hidden = new HiddenField('userId');
     $hidden->setValue($interlocutorId);
     $this->addElement($hidden);
     //thickbox
     $validatorSubject = new StringValidator(0, 2048);
     $validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048)));
     $subject = new TextField('subject');
     $subject->setLabel($language->text('mailbox', 'subject'))->addAttribute('class', 'ow_text');
     $subject->addValidator($validatorSubject);
     $subject->setRequired(true);
     $this->addElement($subject);
     $validatorTextarea = new StringValidator(0, 24000);
     $validatorTextarea->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 24000)));
     $message = new WysiwygTextarea('message', array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO), false);
     $message->setLabel($language->text('mailbox', 'text'))->addAttribute('class', 'ow_text');
     $message->addAttribute('rows', '10');
     $message->addValidator($validatorTextarea);
     $message->setRequired(true);
     $this->addElement($message);
     if (OW::getConfig()->getValue('mailbox', 'enable_attachments')) {
         $multiUpload = new MAILBOX_CLASS_AjaxFileUpload('attachments');
         $multiUpload->setId('attachments');
         $this->addElement($multiUpload);
     }
     $captcha = new MailboxCaptchaField('captcha');
     $captcha->addValidator(new MailboxCaptchaValidator($captcha->getId()));
     $LastSendStamp = BOL_PreferenceService::getInstance()->getPreferenceValue('mailbox_create_conversation_stamp', OW::getUser()->getId());
     $this->displayCapcha = BOL_PreferenceService::getInstance()->getPreferenceValue('mailbox_create_conversation_display_capcha', OW::getUser()->getId());
     if (!$this->displayCapcha && $LastSendStamp + self::DISPLAY_CAPTCHA_TIMEOUT > time()) {
         BOL_PreferenceService::getInstance()->savePreferenceValue('mailbox_create_conversation_display_capcha', true, OW::getUser()->getId());
         $this->displayCapcha = true;
     }
     $captcha->addAttribute('disabled', 'disabled');
     $this->addElement($captcha);
     $submit = new Submit('send');
     $submit->setValue($language->text('mailbox', 'send_button'));
     $submit->addAttribute('class', 'ow_button ow_ic_mail');
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $messageError = $language->text('mailbox', 'create_conversation_fail_message');
         $messageSuccess = $language->text('mailbox', 'create_conversation_message');
         $js = " owForms['mailbox-create-conversation-form'].bind( 'success',\n            function( json )\n            {\n                var from = \$('#mailbox-create-conversation-form');\n                var captcha = from.find('input[name=captcha]');\n\n                if ( json.result == 'permission_denied' )\n                {\n                    if ( json.message != undefined )\n                    {\n                        OW.error(json.message);\n                    }\n                    else\n                    {\n                        OW.error(" . json_encode(OW::getLanguage()->text('mailbox', 'write_permission_denied')) . ");\n                    }\n                }\n                else if ( json.result == 'display_captcha' )\n            \t{\n                   window." . $captcha->jsObjectName . ".refresh();\n\n                   if ( captcha.attr('disabled') != 'disabled' )\n                   {\n                        owForms['mailbox-create-conversation-form'].getElement('captcha').showError(" . json_encode(OW::getLanguage()->text('base', 'form_validator_captcha_error_message')) . ");\n                   }\n                   else\n                   {\n                        captcha.removeAttr('disabled');\n                   }\n\n                   from.find('tr.captcha').show();\n                   from.find('tr.mailbox_conversation').hide();\n                }\n                else if ( json.result == true )\n            \t{\n            \t    window.mailbox_send_message_floatbox.close();\n                    \$('#attach_file_inputs').hide();\n\n                    captcha.attr('disabled','disabled');\n                    from.find('tr.captcha').hide();\n                    owForms['mailbox-create-conversation-form'].resetForm();\n                    window." . $captcha->jsObjectName . ".refresh();\n\n            \t    OW.info('{$messageSuccess}');\n                    from.find('tr.captcha').hide();\n                    from.find('tr.mailbox_conversation').show();\n                }\n                else\n                {\n                    OW.error('{$messageError}');\n                }\n\n                \$('#mailbox-create-conversation-form input[name=userId]').val(" . $interlocutorId . ");\n\n        \t} ); ";
         OW::getDocument()->addOnloadScript($js);
     }
 }
Example #11
0
 public function __construct($name)
 {
     parent::__construct($name);
     $lang = OW::getLanguage();
     $period = new TextField('period');
     $period->setRequired(true);
     $period->setLabel($lang->text('ocsaffiliates', 'settings_timeout'));
     $this->addElement($period);
     $status = new Selectbox('status');
     $status->setRequired(true);
     $status->setHasInvitation(false);
     $options = array('active' => $lang->text('ocsaffiliates', 'status_active'), 'unverified' => $lang->text('ocsaffiliates', 'status_unverified'));
     $status->addOptions($options);
     $status->setLabel($lang->text('ocsaffiliates', 'settings_status'));
     $this->addElement($status);
     $clickAmount = new TextField('clickAmount');
     $clickAmount->setRequired(true);
     $clickAmount->setLabel($lang->text('ocsaffiliates', 'settings_click_amount'));
     $clickAmount->addValidator(new FloatValidator());
     $this->addElement($clickAmount);
     $regAmount = new TextField('regAmount');
     $regAmount->setRequired(true);
     $regAmount->setLabel($lang->text('ocsaffiliates', 'settings_reg_amount'));
     $regAmount->addValidator(new FloatValidator());
     $this->addElement($regAmount);
     $saleCommission = new Selectbox('saleCommission');
     $saleCommission->setRequired(true);
     $options = array('amount' => $lang->text('ocsaffiliates', 'commission_amount'), 'percent' => $lang->text('ocsaffiliates', 'commission_percent'));
     $saleCommission->addOptions($options);
     $saleCommission->setLabel($lang->text('ocsaffiliates', 'settings_sale_commission'));
     $this->addElement($saleCommission);
     $saleAmount = new TextField('saleAmount');
     $saleAmount->setLabel($lang->text('ocsaffiliates', 'settings_sale_amount'));
     $saleAmount->addValidator(new FloatValidator());
     $this->addElement($saleAmount);
     $salePercent = new TextField('salePercent');
     $salePercent->setLabel($lang->text('ocsaffiliates', 'settings_sale_percent'));
     $salePercent->addValidator(new FloatValidator());
     $this->addElement($salePercent);
     $showRates = new CheckboxField('showRates');
     $showRates->setLabel($lang->text('ocsaffiliates', 'show_rates'));
     $this->addElement($showRates);
     $allowBanners = new CheckboxField('allowBanners');
     $allowBanners->setLabel($lang->text('ocsaffiliates', 'allow_banners'));
     $this->addElement($allowBanners);
     $terms = new CheckboxField('terms');
     $terms->setLabel($lang->text('ocsaffiliates', 'enable_terms'));
     $this->addElement($terms);
     $submit = new Submit('save');
     $submit->setLabel($lang->text('ocsaffiliates', 'save'));
     $this->addElement($submit);
 }
Example #12
0
 public function __construct($name, $senderId, $context = MCOMPOSE_BOL_Service::CONTEXT_USER, $initJs = true, $inPopup = true)
 {
     parent::__construct($name);
     $language = OW::getLanguage();
     $this->userId = $senderId;
     $this->context = $context;
     $this->setAction(OW::getRouter()->urlFor('MCOMPOSE_CTRL_Compose', 'send', array('userId' => $senderId, 'formName' => $this->getName())));
     $this->setMethod(self::METHOD_POST);
     $this->setId($this->getName());
     $this->setEnctype('multipart/form-data');
     $this->setAjax();
     $this->setAjaxResetOnSuccess(false);
     $to = new MCOMPOSE_CLASS_UserSelectField('recipients', OW::getLanguage()->text('mcompose', 'selector_invitation_label'));
     $to->setRequired();
     $this->addElement($to);
     //thickbox
     $validatorSubject = new StringValidator(0, 2048);
     $validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048)));
     $subject = new TextField('subject');
     $subject->setInvitation('Subject');
     $subject->setHasInvitation(true);
     $subject->setLabel($language->text('mailbox', 'subject'))->addAttribute('class', 'ow_text');
     $subject->addValidator($validatorSubject);
     $subject->setRequired(true);
     $this->addElement($subject);
     $validatorTextarea = new StringValidator(0, 24000);
     $validatorTextarea->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 24000)));
     $message = new WysiwygTextarea('message', array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO), true);
     $message->setLabel($language->text('mailbox', 'text'))->addAttribute('class', 'ow_text');
     $message->setSize(300);
     $message->addValidator($validatorTextarea);
     $message->setRequired(true);
     $this->addElement($message);
     if (OW::getConfig()->getValue('mailbox', 'enable_attachments')) {
         $multiUpload = new MAILBOX_CLASS_AjaxFileUpload('attachments');
         //$multiUpload->setId('attachments');
         $this->addElement($multiUpload);
     }
     // Captcha
     $captcha = new MailboxCaptchaField('captcha');
     $captcha->addValidator(new MailboxCaptchaValidator($captcha->getId()));
     $captcha->addAttribute('disabled', 'disabled');
     $this->addElement($captcha);
     $submit = new Submit('send');
     $submit->setValue($language->text('mailbox', 'send_button'));
     $submit->addAttribute('class', 'ow_button ow_ic_mail');
     $this->addElement($submit);
     if ($initJs) {
         $js = "owForms['" . $this->getName() . "'].bind( 'success',\n            function( json )\n            {\n                var _complete = function(){ \n                    if ( _scope.floatBox ) _scope.floatBox.close();\n                };\n\n                var form = \$('#" . $this->getName() . "');\n                var captcha = form.find('input[name=captcha]');\n\n                if ( json.result == 'permission_denied' )\n                {\n                    if ( json.message )\n                    {\n                        OW.error(json.message);\n                    }\n                    else\n                    {\n                        OW.error(" . json_encode(OW::getLanguage()->text('mailbox', 'write_permission_denied')) . ");\n                    }\n                    \n                    _complete();\n                }\n                else if ( json.result == 'display_captcha' )\n            \t{\n                   window." . $captcha->jsObjectName . ".refresh();\n\n                   if ( captcha.attr('disabled') != 'disabled' )\n                   {\n                        owForms['" . $this->getName() . "'].getElement('captcha').showError(" . json_encode(OW::getLanguage()->text('base', 'form_validator_captcha_error_message')) . ");\n                   }\n                   else\n                   {\n                        captcha.removeAttr('disabled');\n                   }\n\n                   form.find('tr.captcha').show();\n                   form.find('tr.mailbox_conversation').hide();\n                }\n                else if ( json.result == true )\n            \t{\n                    captcha.attr('disabled','disabled');\n                    form.find('tr.captcha').hide();\n                    window." . $captcha->jsObjectName . ".refresh();\n\n                    form.find('tr.captcha').hide();\n                    form.find('tr.mailbox_conversation').show();\n\n                    owForms['" . $this->getName() . "'].resetForm();\n                    form.find('textarea[name=message]').get(0).htmlareaRefresh();\n\n                    if ( json.error )\n                        OW.error(json.error);\n\n                    if ( json.warning )\n                        OW.warning(json.warning);\n\n                     if ( json.message )\n                        OW.info(json.message);\n                        \n                    _complete();\n                }\n                else if ( json.error )\n                {\n                    OW.error(json.error);\n                    \n                    _complete();\n                }\n\n            }); ";
         OW::getDocument()->addOnloadScript($js);
     }
 }
Example #13
0
 public function __construct()
 {
     parent::__construct('config-form');
     $lang = OW::getLanguage();
     $months = new TextField('months');
     $months->setRequired(true);
     $months->addValidator(new IntValidator(1, 12));
     $months->setLabel($lang->text('ocsguests', 'store_period'));
     $this->addElement($months);
     $submit = new Submit('save');
     $submit->setLabel($lang->text('ocsguests', 'save'));
     $this->addElement($submit);
 }
Example #14
0
 public function __construct()
 {
     parent::__construct('settings-form');
     $lang = OW::getLanguage();
     $period = new TextField('period');
     $period->setLabel($lang->text('membership', 'remind_expiration'));
     $period->setRequired(true);
     $period->addValidator(new IntValidator(2, 10000));
     $this->addElement($period);
     $submit = new Submit('save');
     $submit->setValue($lang->text('base', 'edit_button'));
     $this->addElement($submit);
 }
Example #15
0
 public function __construct()
 {
     parent::__construct('insertVideo');
     // link
     $linkField = new TextField('link');
     $linkField->setRequired(true)->setHasInvitation(true)->setInvitation(OW::getLanguage()->text('base', 'ws_video_text_label'));
     $linkField->addValidator(new UrlValidator());
     $this->addElement($linkField);
     // submit
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('base', 'ws_insert_label'));
     $this->addElement($submit);
 }
Example #16
0
 public function __construct()
 {
     parent::__construct('insertLink');
     // title
     $titleField = new TextField('title');
     $titleField->setRequired(true)->setHasInvitation(true)->setInvitation(OW::getLanguage()->text('base', 'ws_link_text_label'));
     $sValidator = new StringValidator(self::MIN_TITLE_LENGTH, self::MAX_TITLE_LENGTH);
     $sValidator->setErrorMessage(OW::getLanguage()->text('base', 'chars_limit_exceeded', array('limit' => self::MAX_TITLE_LENGTH)));
     $titleField->addValidator($sValidator);
     $this->addElement($titleField);
     // link
     $linkField = new TextField('link');
     $linkField->setRequired(true)->setHasInvitation(true)->setInvitation(OW::getLanguage()->text('base', 'ws_link_url_label'));
     $sValidator = new StringValidator(self::MIN_LINK_LENGTH, self::MAX_LINK_LENGTH);
     $sValidator->setErrorMessage(OW::getLanguage()->text('base', 'chars_limit_exceeded', array('limit' => self::MAX_LINK_LENGTH)));
     $linkField->addValidator($sValidator);
     $linkField->addValidator(new UrlValidator());
     $this->addElement($linkField);
     // submit
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('base', 'ws_insert_label'));
     $this->addElement($submit);
 }
Example #17
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_reset_pass'));
     $this->setAjax();
     $lang = OW::getLanguage();
     $email = new TextField('email');
     $email->setRequired(true);
     $email->setLabel($lang->text('ocsaffiliates', 'email'));
     $email->addValidator(new EmailValidator());
     $this->addElement($email);
     $submit = new Submit('reset');
     $submit->setValue($lang->text('ocsaffiliates', 'send'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.forgotPasswordFloatBox.close();\n                OW.info(data.message);\n            }\n        }");
 }
Example #18
0
 public function index(array $params = array())
 {
     $config = OW::getConfig();
     $configs = $config->getValues('antibruteforce');
     $form = new Form('settings');
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $form->setAction(OW::getRouter()->urlForRoute('antibruteforce.admin'));
     $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if(data.result){OW.info("Settings successfuly saved");}else{OW.error("Parser error");}}');
     $auth = new CheckboxField('auth');
     $auth->setValue($configs['authentication']);
     $form->addElement($auth);
     $reg = new CheckboxField('reg');
     $reg->setValue($configs['registration']);
     $form->addElement($reg);
     $tryCount = new TextField('tryCount');
     $tryCount->setRequired();
     $tryCount->addValidator(new IntValidator(1));
     $tryCount->setValue($configs['try_count']);
     $form->addElement($tryCount);
     $expTime = new TextField('expTime');
     $expTime->setRequired();
     $expTime->setValue($configs['expire_time']);
     $expTime->addValidator(new IntValidator(1));
     $form->addElement($expTime);
     $title = new TextField('title');
     $title->setRequired();
     $title->setValue($configs['lock_title']);
     $form->addElement($title);
     $desc = new Textarea('desc');
     $desc->setValue($configs['lock_desc']);
     $form->addElement($desc);
     $submit = new Submit('save');
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isAjax()) {
         if ($form->isValid($_POST)) {
             $config->saveConfig('antibruteforce', 'authentication', $form->getElement('auth')->getValue());
             $config->saveConfig('antibruteforce', 'registration', $form->getElement('reg')->getValue());
             $config->saveConfig('antibruteforce', 'try_count', $form->getElement('tryCount')->getValue());
             $config->saveConfig('antibruteforce', 'expire_time', $form->getElement('expTime')->getValue());
             $config->saveConfig('antibruteforce', 'lock_title', strip_tags($form->getElement('title')->getValue()));
             $config->saveConfig('antibruteforce', 'lock_desc', strip_tags($form->getElement('desc')->getValue()));
             exit(json_encode(array('result' => true)));
         }
     }
 }
Example #19
0
 public function __construct($photoId = NULL)
 {
     parent::__construct('photo-edit-form');
     $this->setAjax(TRUE);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
     $this->bindJsFunction('success', 'function( data )
         {
             OW.trigger("photo.afterPhotoEdit", data);
         }');
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
     $photoIdField = new HiddenField('photoId');
     $photoIdField->setRequired(TRUE);
     $photoIdField->setValue($photo->id);
     $photoIdField->addValidator(new PHOTO_CLASS_PhotoOwnerValidator());
     $this->addElement($photoIdField);
     $albumField = new TextField('album');
     $albumField->setId('ajax-upload-album');
     $albumField->setRequired();
     $albumField->setValue($album->name);
     $albumField->setLabel(OW::getLanguage()->text('photo', 'create_album'));
     $albumField->addAttribute('class', 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
     $albumField->addAttribute('autocomplete', 'off');
     $albumField->addAttribute('readonly');
     $this->addElement($albumField);
     $albumNameField = new TextField('album-name');
     $albumNameField->setRequired();
     $albumNameField->setValue($album->name);
     $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE, NULL, $album->name));
     $albumNameField->setHasInvitation(TRUE);
     $albumNameField->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
     $albumNameField->addAttribute('class', 'ow_smallmargin invitation');
     $this->addElement($albumNameField);
     $desc = new Textarea('description');
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($desc);
     $photoDesc = new PHOTO_CLASS_HashtagFormElement('photo-desc');
     $photoDesc->setValue($photo->description);
     $photoDesc->setLabel(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($photoDesc);
     $submit = new Submit('edit');
     $submit->setValue(OW::getLanguage()->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Example #20
0
 public function __construct($name, $mode)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_edit'));
     $this->setAjax();
     $lang = OW::getLanguage();
     $idField = new HiddenField('affiliateId');
     $this->addElement($idField);
     $modeField = new HiddenField('mode');
     $modeField->setValue($mode);
     $this->addElement($modeField);
     if ($mode == 'admin') {
         $emailVerified = new CheckboxField('emailVerified');
         $emailVerified->setLabel($lang->text('ocsaffiliates', 'email_verified'));
         $this->addElement($emailVerified);
         $status = new Selectbox('status');
         $status->setLabel($lang->text('ocsaffiliates', 'status'));
         $status->setHasInvitation(false);
         $status->setRequired(true);
         $options = array('active' => $lang->text('ocsaffiliates', 'status_active'), 'unverified' => $lang->text('ocsaffiliates', 'status_unverified'));
         $status->setOptions($options);
         $this->addElement($status);
     }
     $affName = new TextField('name');
     $affName->setRequired(true);
     $affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
     $this->addElement($affName);
     $email = new TextField('email');
     $email->setRequired(true);
     $email->setLabel($lang->text('ocsaffiliates', 'email'));
     $email->addValidator(new EmailValidator());
     $this->addElement($email);
     $password = new PasswordField('password');
     $password->setLabel($lang->text('ocsaffiliates', 'password'));
     $this->addElement($password);
     $payment = new Textarea('payment');
     $payment->setRequired(true);
     $payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
     $this->addElement($payment);
     $submit = new Submit('save');
     $submit->setValue($lang->text('ocsaffiliates', 'edit'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.location.reload();\n            }\n        }");
 }
Example #21
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $adminForm = new Form('adminForm');
     $element = new TextField('logsPerPage');
     $element->setRequired(true);
     $element->setValue($config->getValue('credits', 'logsPerPage'));
     $element->setLabel($language->text('credits', 'logs_per_page'));
     $element->addValidator(new IntValidator(1));
     $adminForm->addElement($element);
     $element = new CheckboxField('enableEmail');
     $element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_email'));
     $element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_email_desc'));
     $element->setValue($config->getValue('credits', 'enableEmail'));
     $adminForm->addElement($element);
     $element = new CheckboxField('enablePM');
     $element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_pm'));
     $element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_pm_desc'));
     $element->setValue($config->getValue('credits', 'enablePM'));
     $adminForm->addElement($element);
     $element = new CheckboxField('enableNotification');
     $element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_notification'));
     $element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_notification_desc'));
     $element->setValue($config->getValue('credits', 'enableNotification'));
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue(OW::getLanguage()->text('credits', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $config->saveConfig('credits', 'logsPerPage', $values['logsPerPage']);
             $config->saveConfig('credits', 'enableEmail', $values['enableEmail']);
             $config->saveConfig('credits', 'enablePM', $values['enablePM']);
             $config->saveConfig('credits', 'enableNotification', $values['enableNotification']);
             OW::getFeedback()->info($language->text('credits', 'save_sucess_msg'));
         }
     }
     $this->addForm($adminForm);
 }
Example #22
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signin'));
     $this->setAjax();
     $this->setAjaxResetOnSuccess(false);
     $lang = OW::getLanguage();
     $email = new TextField('email');
     $email->setRequired(true);
     $email->setLabel($lang->text('ocsaffiliates', 'email'));
     $email->addValidator(new EmailValidator());
     $this->addElement($email);
     $password = new PasswordField('password');
     $password->setRequired(true);
     $password->setLabel($lang->text('ocsaffiliates', 'password'));
     $this->addElement($password);
     $submit = new Submit('signin');
     $submit->setValue($lang->text('ocsaffiliates', 'signin_btn'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.location.reload();\n            }\n        }");
 }
Example #23
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $slideshowTime = new TextField('slideshowTime');
     $frValidator = new IntValidator();
     $frValidator->setMinValue(1);
     $slideshowTime->addValidator($frValidator);
     $slideshowTime->setLabel($language->text('gphotoviewer', 'slideshow_time_per_a_photo'));
     $this->addElement($slideshowTime);
     $enablePhotoviewer = new CheckboxField('enablePhotoviewer');
     $enablePhotoviewer->setLabel($language->text('gphotoviewer', 'enable_photo_viewer'));
     $this->addElement($enablePhotoviewer);
     $downloadable = new CheckboxField('downloadable');
     $downloadable->setLabel($language->text('gphotoviewer', 'can_users_to_download_photos'));
     $this->addElement($downloadable);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Example #24
0
 public function dept()
 {
     $this->setPageTitle(OW::getLanguage()->text('contactus', 'admin_dept_title'));
     $this->setPageHeading(OW::getLanguage()->text('contactus', 'admin_dept_heading'));
     $contactEmails = array();
     $deleteUrls = array();
     $contacts = CONTACTUS_BOL_Service::getInstance()->getDepartmentList();
     foreach ($contacts as $contact) {
         /* @var $contact CONTACTUS_BOL_Department */
         $contactEmails[$contact->id]['name'] = $contact->id;
         $contactEmails[$contact->id]['email'] = $contact->email;
         $contactEmails[$contact->id]['label'] = CONTACTUS_BOL_Service::getInstance()->getDepartmentLabel($contact->id);
         $deleteUrls[$contact->id] = OW::getRouter()->urlFor(__CLASS__, 'delete', array('id' => $contact->id));
     }
     $this->assign('contacts', $contactEmails);
     $this->assign('deleteUrls', $deleteUrls);
     $form = new Form('add_dept');
     $this->addForm($form);
     $fieldEmail = new TextField('email');
     $fieldEmail->setRequired();
     $fieldEmail->addValidator(new EmailValidator());
     $fieldEmail->setInvitation(OW::getLanguage()->text('contactus', 'label_invitation_email'));
     $fieldEmail->setHasInvitation(true);
     $form->addElement($fieldEmail);
     $fieldLabel = new TextField('label');
     $fieldLabel->setRequired();
     $fieldLabel->setInvitation(OW::getLanguage()->text('contactus', 'label_invitation_label'));
     $fieldLabel->setHasInvitation(true);
     $form->addElement($fieldLabel);
     $submit = new Submit('add');
     $submit->setValue(OW::getLanguage()->text('contactus', 'form_add_dept_submit'));
     $form->addElement($submit);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             CONTACTUS_BOL_Service::getInstance()->addDepartment($data['email'], $data['label']);
             $this->redirect();
         }
     }
 }
Example #25
0
 /**
  * Class constructor
  */
 public function __construct($clipId)
 {
     parent::__construct('videoEditForm');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('GVIDEOVIEWER_CTRL_Index', 'ajaxUpdateVideo'));
     $language = OW::getLanguage();
     // clip id field
     $clipIdField = new HiddenField('id');
     $clipIdField->setRequired(true);
     $this->addElement($clipIdField);
     // title Field
     $titleField = new TextField('title');
     $titleField->addValidator(new StringValidator(1, 128));
     $titleField->setRequired(true);
     $this->addElement($titleField->setLabel($language->text('video', 'title')));
     // description Field
     $descField = new WysiwygTextarea('description');
     $descField->setId("video-desc-area");
     $this->addElement($descField->setLabel($language->text('video', 'description')));
     $code = new Textarea('code');
     $code->setRequired(true);
     $this->addElement($code->setLabel($language->text('video', 'code')));
     $entityTags = BOL_TagService::getInstance()->findEntityTags($clipId, 'video');
     if ($entityTags) {
         $tags = array();
         foreach ($entityTags as $entityTag) {
             $tags[] = $entityTag->label;
         }
         $tagsField = new TagsInputField('tags');
         $tagsField->setValue($tags);
     } else {
         $tagsField = new TagsInputField('tags');
     }
     $this->addElement($tagsField->setLabel($language->text('video', 'tags')));
     $submit = new Submit('edit');
     $submit->setValue($language->text('video', 'btn_edit'));
     $this->addElement($submit);
 }
 protected function getPresentationClass($presentation, $questionName, $configs = null)
 {
     $event = new OW_Event('base.questions_field_get_label', array('presentation' => $presentation, 'fieldName' => $questionName, 'configs' => $configs, 'type' => 'edit'));
     OW::getEventManager()->trigger($event);
     $label = $event->getData();
     $class = null;
     $event = new OW_Event('base.questions_field_init', array('type' => 'search', 'presentation' => $presentation, 'fieldName' => $questionName, 'configs' => $configs));
     OW::getEventManager()->trigger($event);
     $class = $event->getData();
     if (empty($class)) {
         switch ($presentation) {
             case BOL_QuestionService::QUESTION_PRESENTATION_TEXT:
             case BOL_QuestionService::QUESTION_PRESENTATION_TEXTAREA:
                 $class = new TextField($questionName);
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_CHECKBOX:
                 $class = new CheckboxField($questionName);
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_RADIO:
             case BOL_QuestionService::QUESTION_PRESENTATION_SELECT:
             case BOL_QuestionService::QUESTION_PRESENTATION_MULTICHECKBOX:
                 $class = new Selectbox($questionName);
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_BIRTHDATE:
             case BOL_QuestionService::QUESTION_PRESENTATION_AGE:
                 $class = new USEARCH_CLASS_AgeRangeField($questionName);
                 if (!empty($configs) && mb_strlen(trim($configs)) > 0) {
                     $configsList = json_decode($configs, true);
                     foreach ($configsList as $name => $value) {
                         if ($name = 'year_range' && isset($value['from']) && isset($value['to'])) {
                             $class->setMinYear($value['from']);
                             $class->setMaxYear($value['to']);
                         }
                     }
                 }
                 $class->addValidator(new USEARCH_CLASS_AgeRangeValidator($class->getMinAge(), $class->getMaxAge()));
                 break;
             case self::QUESTION_PRESENTATION_RANGE:
                 $class = new Range($fieldName);
                 if (empty($this->birthdayConfig)) {
                     $birthday = $this->findQuestionByName("birthdate");
                     if (!empty($birthday)) {
                         $this->birthdayConfig = $birthday->custom;
                     }
                 }
                 $rangeValidator = new RangeValidator();
                 if (!empty($this->birthdayConfig) && mb_strlen(trim($this->birthdayConfig)) > 0) {
                     $configsList = json_decode($this->birthdayConfig, true);
                     foreach ($configsList as $name => $value) {
                         if ($name = 'year_range' && isset($value['from']) && isset($value['to'])) {
                             $class->setMinValue(date("Y") - $value['to']);
                             $class->setMaxValue(date("Y") - $value['from']);
                             $rangeValidator->setMinValue(date("Y") - $value['to']);
                             $rangeValidator->setMaxValue(date("Y") - $value['from']);
                         }
                     }
                 }
                 $class->addValidator($rangeValidator);
                 break;
             case self::QUESTION_PRESENTATION_DATE:
                 $class = new DateRange($fieldName);
                 if (!empty($configs) && mb_strlen(trim($configs)) > 0) {
                     $configsList = json_decode($configs, true);
                     foreach ($configsList as $name => $value) {
                         if ($name = 'year_range' && isset($value['from']) && isset($value['to'])) {
                             $class->setMinYear($value['from']);
                             $class->setMaxYear($value['to']);
                         }
                     }
                 }
                 $class->addValidator(new DateValidator($class->getMinYear(), $class->getMaxYear()));
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_URL:
                 $class = new TextField($questionName);
                 $class->addValidator(new UrlValidator());
                 break;
         }
         if (!empty($label)) {
             $class->setLabel($label);
         }
         if (empty($class)) {
             $class = BOL_QuestionService::getInstance()->getSearchPresentationClass($presentation, $questionName, $configs);
         }
     }
     return $class;
 }
Example #27
0
 function __construct()
 {
     parent::__construct('clone-form');
     $this->ajax = true;
     $this->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'ajaxClone'));
     $this->setMethod('post');
     $labelTextField = new TextField('label');
     $labelTextField->setLabel(OW::getLanguage()->text('admin', 'clone_form_lbl_label'))->setDescription(OW::getLanguage()->text('admin', 'clone_form_descr_label'));
     $this->addElement($labelTextField);
     $tagTextField = new TextField('tag');
     $tagTextField->addValidator(new LanguageTagValidator());
     $tagTextField->setLabel(OW::getLanguage()->text('admin', 'clone_form_lbl_tag'))->setDescription(OW::getLanguage()->text('admin', 'clone_form_descr_tag'));
     $this->addElement($tagTextField);
     $hiddenField = new HiddenField('language');
     $hiddenField->addAttribute('class', 'hidden_lang_tag');
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('admin', 'clone_form_lbl_submit'));
     $this->addElement($submit);
     $this->addElement($hiddenField);
     //value to be set by javascript
     if (!OW::getRequest()->isAjax()) {
         OW::getDocument()->addOnloadScript("owForms['{$this->getName()}'].bind('success', function(){location.reload();});");
     }
 }
Example #28
0
 /**
  * Generates edit group form
  * 
  * @param string $action
  * @return Form
  */
 private function generateEditGroupForm($action)
 {
     $form = new Form('edit-group-form');
     $form->setAction($action);
     $lang = OW::getLanguage();
     $groupName = new TextField('group-name');
     $groupName->setRequired(true);
     $sValidator = new StringValidator(1, 255);
     $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 255)));
     $groupName->addValidator($sValidator);
     $form->addElement($groupName);
     $description = new Textarea('description');
     $description->setRequired(true);
     $sValidator = new StringValidator(1, 50000);
     $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 50000)));
     $description->addValidator($sValidator);
     $form->addElement($description);
     $groupId = new HiddenField('group-id');
     $groupId->setRequired(true);
     $form->addElement($groupId);
     $isPrivate = new CheckboxField('is-private');
     $form->addElement($isPrivate);
     $roles = new CheckboxGroup('roles');
     $authService = BOL_AuthorizationService::getInstance();
     $roleList = $authService->getRoleList();
     $options = array();
     foreach ($roleList as $role) {
         $options[$role->id] = $authService->getRoleLabel($role->name);
     }
     $roles->addOptions($options);
     $roles->setColumnCount(2);
     $form->addElement($roles);
     $submit = new Submit('save');
     $submit->setValue($lang->text('forum', 'edit_group_btn'));
     $form->addElement($submit);
     $form->setAjax(true);
     return $form;
 }
Example #29
0
 public function getResetForm($formName = 'forgot-password')
 {
     $language = OW::getLanguage();
     $form = new Form($formName);
     $email = new TextField('email');
     $email->setRequired(true);
     $email->addValidator(new EmailValidator());
     $email->setHasInvitation(true);
     $email->setInvitation($language->text('base', 'forgot_password_email_invitation_message'));
     $form->addElement($email);
     $submit = new Submit('submit');
     $submit->setValue($language->text('base', 'forgot_password_submit_label'));
     $form->addElement($submit);
     return $form;
 }
Example #30
0
 /**
  * Class constructor
  *
  */
 public function __construct($plugins)
 {
     parent::__construct('configForm');
     $language = OW::getLanguage();
     $values = OW::getConfig()->getValues('uheader');
     if ($plugins['photo']) {
         $field = new CheckboxField('photo_share');
         $field->setId('photo_share_check');
         $field->setValue($values['photo_share']);
         $this->addElement($field);
         $field = new TextField('photo_album_name');
         $field->setValue(OW::getLanguage()->text('uheader', 'default_photo_album_name'));
         $field->setRequired();
         $this->addElement($field);
     }
     $field = new TextField('cover_height');
     $field->setValue($values['cover_height']);
     $field->addValidator(new IntValidator(self::COVER_MIN_HEIGHT, self::COVER_MAX_HEIGHT));
     $field->setRequired();
     $this->addElement($field);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('uheader', 'config_save_label'));
     $this->addElement($submit);
 }