Пример #1
0
 public function __construct($configs, $features)
 {
     parent::__construct('MCOMPOSE_ConfigForm');
     $this->configs = $configs;
     $language = OW::getLanguage();
     $field = new TextField('max_users');
     $field->setRequired();
     $field->setValue($configs['max_users']);
     $this->addElement($field);
     if ($features["friends"]) {
         $field = new CheckboxField('friends_enabled');
         $field->setValue($configs['friends_enabled']);
         $this->addElement($field);
     }
     if ($features["groups"]) {
         $field = new CheckboxField('groups_enabled');
         $field->setValue($configs['groups_enabled']);
         $this->addElement($field);
     }
     if ($features["events"]) {
         $field = new CheckboxField('events_enabled');
         $field->setValue($configs['events_enabled']);
         $this->addElement($field);
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('mcompose', 'admin_save_btn'));
     $this->addElement($submit);
 }
Пример #2
0
 /**
  * Constructor.
  */
 public function __construct($ajax = false)
 {
     parent::__construct();
     $form = new Form('sign-in');
     $form->setAction("");
     $username = new TextField('identity');
     $username->setRequired(true);
     $username->setHasInvitation(true);
     $username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
     $form->addElement($username);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $form->addElement($password);
     $remeberMe = new CheckboxField('remember');
     $remeberMe->setValue(true);
     $remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
     $form->addElement($remeberMe);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     if ($ajax) {
         $form->setAjaxResetOnSuccess(false);
         $form->setAjax();
         $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
         $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
         $this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
     }
     $this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
 }
Пример #3
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        }");
 }
Пример #4
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);
 }
Пример #5
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_mobile_settings'));
     OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
     $settingsForm = new Form('mobile_settings');
     $disableMobile = new CheckboxField('disable_mobile');
     $disableMobile->setLabel($language->text('admin', 'mobile_settings_mobile_context_disable_label'));
     $disableMobile->setDescription($language->text('admin', 'mobile_settings_mobile_context_disable_desc'));
     $settingsForm->addElement($disableMobile);
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             $config->saveConfig('base', 'disable_mobile_context', (bool) $data['disable_mobile']);
             OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message'));
         } else {
             OW::getFeedback()->error('Error');
         }
         $this->redirect();
     }
     $disableMobile->setValue($config->getValue('base', 'disable_mobile_context'));
 }
Пример #6
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);
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $categoryFields = array();
     $nonCategoryFields = array();
     $fields->addFieldToTab('Root.Main', new TextField('ContentTitle', 'Content Title'));
     $fields->addFieldToTab('Root.Main', new DropdownField('ItemStyle', 'Item Style', self::$styles));
     $fields->addFieldToTab('Root.Main', new DropdownField('DefaultLayout', 'Default Layout', $this->dbObject('DefaultLayout')->enumValues()));
     $fields->addFieldToTab('Root.Main', new NumericField('LimitTopResults', 'Limit Top Results - how many items to show at top (defaults to 4)'));
     $fields->addFieldToTab('Root.Main', new NumericField('LimitBottomResults', 'Limit Bottom Results - how many items to show at bottom (defaults to 30)'));
     //children fields
     $fields->addFieldsToTab('Root.Main', array($useChildren = new CheckboxField('UseChildren', 'Use page as category?', 1), $categoryFields[] = $pageField = new ContentModuleTreeDropdownField('TopLevelPageID', 'Top Level Page', 'SiteTree'), $categoryFields[] = $showSearch = new CheckboxField('ShowSearch', 'Show search?'), $categoryFields[] = $hasCategories = new CheckBoxField('HasCategories', 'Has categories? (2 levels or single level)'), $categoryFields[] = $showCategories = new CheckboxField('ShowCategories', 'Show category navigation bar? (for filtering)')));
     $pageField->addExtraClass('use-children');
     $useChildren->addExtraClass('use-children');
     $showSearch->addExtraClass('show-search');
     $hasCategories->addExtraClass('has-categories');
     $showCategories->addExtraClass('show-categories');
     //add page fields
     $fields->addFieldsToTab('Root.Main', array($tree = new ContentModuleTreeDropdownField('NewPage', 'Add Page (choose from dropdown to add below)', 'SiteTree'), $enableSeeMore = new CheckboxField('DisableSeeMore', 'Disable "See more"?', 0), $nonCategoryFields[] = $rEditor = new ContentModuleRelationshipEditor('PagesRelationEditor', 'Pages', 'Pages', $this, array('Title' => 'Title', 'Parent.Title' => 'Parent'))));
     $rEditor->setSortField('SortOrder')->setShowDeleteButton(false);
     //url for adding page
     $tree->setAttribute('data-add_url', 'addPage');
     $nonCategoryFields[] = $tree;
     //setup classes for hiding show fields
     foreach ($categoryFields as $categoryField) {
         $categoryField->addExtraClass('category');
     }
     //setup classes for hiding show fields
     foreach ($nonCategoryFields as $categoryField) {
         $categoryField->addExtraClass('non-category');
     }
     Requirements::javascript(INPAGE_MODULES_DIR . '/javascript/RelatedPagesModuleCMS.js');
     return $fields;
 }
Пример #8
0
 public function __construct()
 {
     parent::__construct('questions_add');
     $language = OW::getLanguage();
     $this->setAjax();
     $this->setAjaxResetOnSuccess(false);
     $field = new Textarea('question');
     $field->addAttribute('maxlength', 500);
     $field->setRequired();
     $field->setHasInvitation(true);
     $field->setInvitation($language->text('questions', 'question_add_text_inv'));
     $field->addAttribute("inv", $language->text('questions', 'question_add_text_inv'));
     $this->addElement($field);
     $field = new CheckboxField('allowAddOprions');
     $field->addAttribute('checked');
     $field->setLabel($language->text('questions', 'question_add_allow_add_opt'));
     $this->addElement($field);
     $field = new QUESTIONS_OptionsField('answers');
     $field->setHasInvitation(true);
     $field->setInvitation($language->text('questions', 'question_add_option_inv'));
     $this->addElement($field);
     $submit = new Submit('save');
     $submit->setValue($language->text('questions', 'question_add_save'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_empty');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_min_length');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_max_length');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_two_apt_required');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_dublicate_option');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_option_max_length');
         $this->initJsResponder();
     }
     $this->setAction(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('QUESTIONS_CTRL_List', 'addQuestion')));
 }
Пример #9
0
 /**
  * Class constructor
  *
  */
 public function __construct($plugins)
 {
     parent::__construct('configForm');
     $language = OW::getLanguage();
     $values = OW::getConfig()->getValues('attachments');
     if ($plugins['video']) {
         $field = new CheckboxField('video_share');
         $field->setValue($values['video_share']);
         $this->addElement($field);
     }
     if ($plugins['links']) {
         $field = new CheckboxField('link_share');
         $field->setValue($values['link_share']);
         $this->addElement($field);
     }
     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('attachments', 'default_photo_album_name'));
         $field->setRequired();
         $this->addElement($field);
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('attachments', 'config_save_label'));
     $this->addElement($submit);
 }
 function __construct($controller, $name)
 {
     $fields = new FieldList(array($t1 = new TextField('ExternalOrderId', 'Eventbrite Order #'), $checkbox = new CheckboxField('SharedContactInfo', 'Allow to share contact info?')));
     $t1->setAttribute('placeholder', 'Enter your Eventbrite order #');
     $t1->addExtraClass('event-brite-order-number');
     $attendees = Session::get('attendees');
     if (count($attendees) > 0) {
         $t1->setValue(Session::get('ExternalOrderId'));
         $t1->setReadonly(true);
         $checkbox->setValue(intval(Session::get('SharedContactInfo')) === 1);
         $fields->add(new LiteralField('ctrl1', 'Current Order has following registered attendees, please select one:'));
         $options = array();
         foreach ($attendees as $attendee) {
             $ticket_external_id = intval($attendee['ticket_class_id']);
             $ticket_type = SummitTicketType::get()->filter('ExternalId', $ticket_external_id)->first();
             if (is_null($ticket_type)) {
                 continue;
             }
             $options[$attendee['id']] = $attendee['profile']['name'] . ' (' . $ticket_type->Name . ')';
         }
         $attendees_ctrl = new OptionSetField('SelectedAttendee', '', $options);
         $fields->add($attendees_ctrl);
         $validator = new RequiredFields(array('ExternalOrderId'));
         // Create action
         $actions = new FieldList($btn_clear = new FormAction('clearSummitAttendeeInfo', 'Clear'), $btn = new FormAction('saveSummitAttendeeInfo', 'Done'));
         $btn->addExtraClass('btn btn-default active');
         $btn_clear->addExtraClass('btn btn-danger active');
     } else {
         $validator = new RequiredFields(array('ExternalOrderId'));
         // Create action
         $actions = new FieldList($btn = new FormAction('saveSummitAttendeeInfo', 'Get Order'));
         $btn->addExtraClass('btn btn-default active');
     }
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
Пример #11
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);
 }
Пример #12
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     parent::__construct('update-question-form');
     $this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editQuestion'));
     $lang = OW::getLanguage();
     $questionId = new HiddenField('questionId');
     $questionId->setRequired(true);
     $this->addElement($questionId);
     $question = new TextField('question');
     $question->setRequired(true);
     $question->setLabel($lang->text('ocsfaq', 'question'));
     $this->addElement($question);
     $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
     $answer = new WysiwygTextarea('answer', $btnSet);
     $answer->setRequired(true);
     $answer->setLabel($lang->text('ocsfaq', 'answer'));
     $this->addElement($answer);
     $isFeatured = new CheckboxField('isFeatured');
     $isFeatured->setLabel($lang->text('ocsfaq', 'is_featured'));
     $this->addElement($isFeatured);
     $categories = OCSFAQ_BOL_FaqService::getInstance()->getCategories();
     if ($categories) {
         $category = new Selectbox('category');
         foreach ($categories as $cat) {
             $category->addOption($cat->id, $cat->name);
         }
         $category->setLabel($lang->text('ocsfaq', 'category'));
         $this->addElement($category);
     }
     // submit
     $submit = new Submit('update');
     $submit->setValue($lang->text('ocsfaq', 'btn_save'));
     $this->addElement($submit);
 }
Пример #13
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);
 }
Пример #14
0
    public function __construct()
    {
        parent::__construct('hint-form');
        $this->setAjax(TRUE);
        $this->setAction(OW::getRouter()->urlForRoute('profileprogressbar.admin_hint'));
        $this->setAjaxResetOnSuccess(FALSE);
        $this->bindJsFunction('success', 'function(data)
        {
            $("#profile-progressbar").tipTip({content: data.content});

            OW.info("Settings successfully saved");
        }');
        $checkBox = new CheckboxField('show-hint');
        if ((bool) OW::getConfig()->getValue('profileprogressbar', 'show_hint')) {
            $checkBox->addAttribute('checked', 'checked');
        }
        $checkBox->setLabel(OW::getLanguage()->text('profileprogressbar', 'show_hint_label'));
        $checkBox->setDescription(OW::getLanguage()->text('profileprogressbar', 'show_hint_desc'));
        $this->addElement($checkBox);
        $hintText = new WysiwygTextarea('hint-text');
        $hintText->setRequired();
        $hintText->setSize(WysiwygTextarea::SIZE_L);
        $hintText->setValue(OW::getLanguage()->text('profileprogressbar', 'hint_text'));
        $hintText->setLabel(OW::getLanguage()->text('profileprogressbar', 'hint_label'));
        $hintText->setDescription(OW::getLanguage()->text('profileprogressbar', 'hint_desc'));
        $this->addElement($hintText);
        $submit = new Submit('save');
        $submit->setValue('Save');
        $this->addElement($submit);
    }
 public function UpdateCMSFields(FieldList $fields)
 {
     if ($this->IsInSocialMedia()) {
         $fields->addFieldToTab('Root.Main', $text = new CompositeField(), 'Content');
         $text->setDescription('Tämä blogiartikkeli on julkaistu sosiaalisessa mediassa. Muutokset blogiin eivät enää päivity sosiaaliseen mediaan. Jos poistat blogin, se ei poistu somesta automaattisesti.');
     } else {
         $fields->addFieldToTab('Root.Main', $checkbox = new CheckboxField('PublishInSocialMedia', 'Julkaise sosiaalisessa mediassa'), 'Content');
         $checkbox->setDescription('Julkaisu tapahtuu kun klikkaat "Tallenna ja julkaise". Jos teet muutoksia sisältöön ensimmäisen some-julkaisun jälkeen, muutokset päivittyvät ainoastaan blogiin, eivätkä mene someen. Jos poistat artikkelin, se täytyy käydä erikseen poistamassa somessa.');
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('PageListingWidgetID');
     $fields->addFieldToTab('Root.Main', new TreeDropdownField("PageID", "Related page", "SiteTree"));
     $showChildrenField = new CheckboxField("ShowChildren", "Show Children");
     $showChildrenField->setDescription("If ticked, links to the selected pages children are shown.<br/>If not ticked, a link to the selected page is shown");
     $fields->addFieldToTab('Root.Main', $showChildrenField);
     return $fields;
 }
Пример #17
0
 /**
  * (non-PHPdoc)
  * @see framework/forms/FormField#Field()
  */
 function Field($properties = array())
 {
     if ($this->isReadonly()) {
         $nullableCheckbox = new CheckboxField_Readonly($this->getIsNullId());
     } else {
         $nullableCheckbox = new CheckboxField($this->getIsNullId());
     }
     $nullableCheckbox->setValue(is_null($this->dataValue()));
     return $this->valueField->Field() . ' ' . $nullableCheckbox->Field() . '&nbsp;<span>' . $this->getIsNullLabel() . '</span>';
 }
Пример #18
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $form = new Form('privacy_settings');
     $userApprove = new CheckboxField('user_approve');
     $userApprove->setLabel($language->text('admin', 'permissions_index_user_approve'));
     $form->addElement($userApprove);
     $whoCanJoin = new RadioField('who_can_join');
     $whoCanJoin->addOptions(array('1' => $language->text('admin', 'permissions_index_anyone_can_join'), '2' => $language->text('admin', 'permissions_index_by_invitation_only_can_join')));
     $whoCanJoin->setLabel($language->text('admin', 'permissions_index_who_can_join'));
     $form->addElement($whoCanJoin);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->addOptions(array('1' => $language->text('admin', 'permissions_index_all_users_can_invate'), '2' => $language->text('admin', 'permissions_index_admin_only_can_invate')));
     $whoCanInvite->setLabel($language->text('admin', 'permissions_index_who_can_invite'));
     $form->addElement($whoCanInvite);
     $guestsCanView = new RadioField('guests_can_view');
     $guestsCanView->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '2' => $language->text('admin', 'permissions_index_no'), '3' => $language->text('admin', 'permissions_index_with_password')));
     $guestsCanView->setLabel($language->text('admin', 'permissions_index_guests_can_view_site'));
     $guestsCanView->setDescription($language->text('admin', 'permissions_idex_if_not_yes_will_override_settings'));
     $form->addElement($guestsCanView);
     $password = new TextField('password');
     $form->addElement($password);
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'permissions_index_save'));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $config->saveConfig('base', 'who_can_join', (int) $data['who_can_join']);
             $config->saveConfig('base', 'who_can_invite', (int) $data['who_can_invite']);
             $config->saveConfig('base', 'mandatory_user_approve', (bool) $data['user_approve'] ? 1 : 0);
             if ((int) $data['guests_can_view'] === 3 && empty($data['password'])) {
                 OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_empty_pass_error_message'));
             } else {
                 if ((int) $data['guests_can_view'] === 3 && strlen(trim($data['password'])) < 4) {
                     OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_pass_length_error_message'));
                 } else {
                     $config->saveConfig('base', 'guests_can_view', (int) $data['guests_can_view']);
                     $config->saveConfig('base', 'guests_can_view_password', trim($data['password']));
                 }
             }
             OW::getFeedback()->info($language->text('admin', 'permission_global_privacy_settings_success_message'));
             $this->redirect();
         }
     }
     $baseConfigs = $config->getValues('base');
     $form->getElement('who_can_join')->setValue($baseConfigs['who_can_join']);
     $form->getElement('who_can_invite')->setValue($baseConfigs['who_can_invite']);
     $form->getElement('guests_can_view')->setValue($baseConfigs['guests_can_view']);
     $form->getElement('user_approve')->setValue($baseConfigs['mandatory_user_approve']);
     $form->getElement('password')->setValue($baseConfigs['guests_can_view_password']);
 }
Пример #19
0
 public function __construct()
 {
     parent::__construct('EQUESTIONS_SetupForm');
     $language = OW::getLanguage();
     $field = new CheckboxField('copyData');
     $field->setValue(true);
     $field->setLabel($language->text('equestions', 'admin_setup_copy_data_label'));
     $this->addElement($field);
     $button = new Submit('upgrade');
     $button->setValue($language->text('equestions', 'admin_setup_upgrade_label'));
     $this->addElement($button);
 }
Пример #20
0
 public function __construct()
 {
     parent::__construct('settings-form');
     $lang = OW::getLanguage();
     $canView = new CheckboxField('canView');
     $canView->setLabel($lang->text('ocsfavorites', 'can_view_favorites'));
     $this->addElement($canView);
     // submit
     $submit = new Submit('save');
     $submit->setValue($lang->text('ocsfavorites', 'btn_save'));
     $this->addElement($submit);
 }
Пример #21
0
 public function source($datas)
 {
     foreach ($datas as $value => $label) {
         $this->checkboxes[$value] = $checkbox = new CheckboxField();
         $checkbox->push('name', $this->nameFor($value));
         $checkbox->push('value', '1');
         $this->labels[$this->nameFor($value)] = $label;
         foreach ($this->pushSave as $var => $val) {
             $checkbox->push($var, $val);
         }
     }
 }
Пример #22
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);
 }
Пример #23
0
 public function __construct($configs)
 {
     parent::__construct('EQUESTIONS_ConfigSaveForm');
     $this->configs = $configs;
     $language = OW::getLanguage();
     $field = new CheckboxField('allow_comments');
     $field->setLabel($language->text('equestions', 'admin_allow_comments_label'));
     $field->setValue($configs['allow_comments']);
     $this->addElement($field);
     $field = new CheckboxField('ask_friends');
     $field->setLabel($language->text('equestions', 'admin_enable_ask_friends_label'));
     $field->setValue($configs['ask_friends']);
     $this->addElement($field);
     $field = new Selectbox('list_order');
     foreach (array(EQUESTIONS_CMP_Feed::ORDER_LATEST, EQUESTIONS_CMP_Feed::ORDER_POPULAR) as $v) {
         $field->addOption($v, $language->text('equestions', 'feed_order_' . $v));
     }
     $field->setHasInvitation(false);
     $field->setLabel($language->text('equestions', 'admin_list_order_label'));
     $field->setValue($configs['list_order']);
     $this->addElement($field);
     $field = new CheckboxField('enable_follow');
     $field->setLabel($language->text('equestions', 'admin_enable_follow_label'));
     $field->setValue($configs['enable_follow']);
     $this->addElement($field);
     $field = new CheckboxField('allow_popups');
     $field->setLabel($language->text('equestions', 'admin_allow_popups_label'));
     $field->setValue($configs['allow_popups']);
     $this->addElement($field);
     $field = new CheckboxField('attachments');
     $field->setLabel($language->text('equestions', 'admin_enable_attachments_label'));
     $field->setValue($configs['attachments']);
     $this->addElement($field);
     $field = new CheckboxField('attachments_video');
     $field->setLabel($language->text('equestions', 'admin_attachments_video_enable_label'));
     $field->setValue($configs['attachments_video']);
     $this->addElement($field);
     $field = new CheckboxField('attachments_image');
     $field->setLabel($language->text('equestions', 'admin_attachments_image_enable_label'));
     $field->setValue($configs['attachments_image']);
     $this->addElement($field);
     $field = new CheckboxField('attachments_link');
     $field->setLabel($language->text('equestions', 'admin_attachments_link_enable_label'));
     $field->setValue($configs['attachments_link']);
     $this->addElement($field);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('equestions', 'admin_save_btn'));
     $this->addElement($submit);
 }
 function __construct($controller, $name)
 {
     $current_user = Member::currentUser();
     $fields = new FieldList($this->first_name_field = new TextField('FirstName', 'First name / Given name', $current_user->FirstName), $this->last_name_field = new TextField('Surname', 'Last name / Family name', $current_user->Surname), $os_activity = new CustomCheckboxSetField('OpenStackActivity', 'Which of the following do you yourself personally do?<BR>Select All That Apply', DeploymentSurveyOptions::$activities_options), $os_relationship = new TextAreaField('OpenStackRelationship', 'Please describe your relationship with OpenStack'), $this->email_field = new TextField('Email', 'Your Email', $current_user->Email), $ok_2_contact = new CheckboxField('OkToContact', 'The OpenStack Foundation and User Committee may communicate with me in the future about my usage.'));
     $os_relationship->addExtraClass('hidden');
     $os_relationship->setColumns(30);
     $ok_2_contact->setValue(0);
     $this->email_field->setDisabled(true);
     $nextButton = new FormAction('NextStep', '  Next Step  ');
     $actions = new FieldList($nextButton);
     $validator = new RequiredFields();
     Requirements::javascript('surveys/js/deployment_survey_aboutyou_form.js');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 /**
  * Builds the entry form so the user can choose what to export.
  */
 function ExportForm()
 {
     $fields = new FieldList();
     // Display available yml files so we can re-export easily.
     $ymlDest = BASE_PATH . '/' . TestDataController::get_data_dir();
     $existingFiles = scandir($ymlDest);
     $ymlFiles = array();
     foreach ($existingFiles as $file) {
         if (preg_match("/.*\\.yml/", $file)) {
             $ymlFiles[$file] = $file;
         }
     }
     if ($ymlFiles) {
         $fields->push(new DropdownField('Reexport', 'Reexport to file (will override any other setting): ', $ymlFiles, '', null, '-- choose file --'));
     }
     // Get the list of available DataObjects
     $dataObjectNames = ClassInfo::subclassesFor('DataObject');
     unset($dataObjectNames['DataObject']);
     sort($dataObjectNames);
     foreach ($dataObjectNames as $dataObjectName) {
         // Skip test only classes.
         $class = singleton($dataObjectName);
         if ($class instanceof TestOnly) {
             continue;
         }
         // Skip testdata internal class
         if ($class instanceof TestDataTag) {
             continue;
         }
         // 	Create a checkbox for including this object in the export file
         $count = $class::get()->Count();
         $fields->push($class = new CheckboxField("Class[{$dataObjectName}]", $dataObjectName . " ({$count})"));
         $class->addExtraClass('class-field');
         // 	Create an ID range selection input
         $fields->push($range = new TextField("Range[{$dataObjectName}]", ''));
         $range->addExtraClass('range-field');
     }
     // Create the "traverse relations" option - whether it should automatically include relation objects even if not explicitly ticked.
     $fields->push(new CheckboxField('TraverseRelations', 'Traverse relations (implicitly includes objects, for example pulls Groups for Members): ', 1));
     // Create the option to include real files.
     $path = BASE_PATH . '/' . TestDataController::get_data_dir();
     $fields->push(new CheckboxField('IncludeFiles', "Copy real files (into {$path}files)", 0));
     // Create file name input field
     $fields->push(new TextField('FileName', 'Name of the output YML file: ', 'output.yml'));
     // Create actions for the form
     $actions = new FieldList(new FormAction("export", "Export"));
     $form = new Form($this, "ExportForm", $fields, $actions);
     $form->setFormAction(Director::baseURL() . 'dev/data/export/TestDataExporter/ExportForm');
     return $form;
 }
Пример #26
0
 function testSavingUnchecked()
 {
     /* Create a new test data record */
     $article = new CheckboxFieldTest_Article();
     /* Create a field, with no value */
     $field = new CheckboxField('IsChecked', 'Checked');
     /* Save the field into our Article object */
     $field->saveInto($article);
     /* Write the record to the test database */
     $article->write();
     /* Check that IsChecked column contains a 0 */
     $this->assertEquals(DB::query("SELECT IsChecked FROM CheckboxFieldTest_Article")->value(), 0, 'We have a 0 set in the database, because the field saved into as a 0');
     /* Delete the record we tested */
     $article->delete();
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Main", $checkboxField = CheckboxField::create('DebugToolsDisabled', 'Disable debug tools'));
     $checkboxField->setDescription('When enabled, debug will only show if set to <code>DEV</code> or <code>TEST</code> in <code>_ss_environment.php</code>');
     $fields->addFieldToTab("Root.Main", $checkboxField = CheckboxField::create('EmulateUserDisabled', 'Disable user emulation'));
     $checkboxField->setDescription('When enabled, <strong>only admins</strong> can log in as any other <code>Member</code> object');
 }
 public function updateCMSFields(\FieldList $fields)
 {
     if (!$this->owner->exists()) {
         return;
     }
     $fields->addFieldsToTab('Root.Recommended', [\TextField::create('Recommended_Title', _t('Product.Recommended_Title', 'Title'))->setAttribute('placeholder', $this->owner->config()->recommended_title ?: _t('Product.Default-Recommended_Title', 'Recommended Products')), \CheckboxField::create('Recommended_AlsoBought', _t('Product.Recommended_AlsoBought', 'Prioritise products that were bought with this product?'))->setDescription(_t('Product.Desc-Recommended_AlsoBought', 'This will use products that previous customers have bought with this product, otherwise it will select from your choice below.')), \SelectionGroup::create('Recommended_FindBy', $this->getMethodFormFields())]);
 }
 public function getFormFields(Order $order)
 {
     $member = Member::currentUser() ?: $order->Member();
     if (!$member || !$member->exists() || !$member->AddressBook()->exists()) {
         return parent::getFormFields($order);
     }
     $options = [];
     $default = $this->getDefaultAddress($member);
     $params = ['addfielddescriptions' => $this->formfielddescriptions];
     $addressFields = $default->getFrontEndFields($params);
     if ($this->allowSaveAsNew) {
         $addressFields->push(CheckboxField::create('saveAsNew', _t('AlternateAddressBookCheckoutComponent.SAVE_AS_NEW', 'Save as new address')));
     }
     $options[] = SelectionGroup_Item::create('address-' . $default->ID, HasOneCompositeField::create('address-' . $default->ID, $default, $addressFields), _t('AlternateAddressBookCheckoutComponent.USE_DEFAULT', '{address}', ['address' => $default->Title]));
     if ($member->AddressBook()->exclude('ID', $default->ID)->exists()) {
         foreach ($member->AddressBook()->exclude('ID', $default->ID) as $address) {
             $addressFields = $address->getFrontEndFields($params);
             $addressFields->push(CheckboxField::create('saveAsNew', _t('AlternateAddressBookCheckoutComponent.SAVE_AS_NEW', 'Save as new address')));
             if ($member->DefaultShippingAddressID != $address->ID) {
                 $addressFields->push(CheckboxField::create('useAsDefaultShipping', _t('AlternateAddressBookCheckoutComponent.USE_AS_DEFAULT_SHIPPING', 'Use as default shipping address')));
             }
             if ($member->DefaultBillingAddressID != $address->ID) {
                 $addressFields->push(CheckboxField::create('useAsDefaultBilling', _t('AlternateAddressBookCheckoutComponent.USE_AS_DEFAULT_BILLING', 'Use as default billing address')));
             }
             $options[] = SelectionGroup_Item::create('address-' . $address->ID, HasOneCompositeField::create('address-' . $address->ID, $address, $addressFields), _t('AlternateAddressBookCheckoutComponent.SHIP_TO_SELECTED_ADDRESS', '{address}', ['address' => $address->Title]));
         }
     }
     if ($this->allowNew) {
         $addressFields = parent::getFormFields($order);
         $addressFields->push(CheckboxField::create('useAsDefaultShipping', _t('AlternateAddressBookCheckoutComponent.USE_AS_DEFAULT_SHIPPING', 'Use as default shipping address')));
         $addressFields->push(CheckboxField::create('useAsDefaultBilling', _t('AlternateAddressBookCheckoutComponent.USE_AS_DEFAULT_BILLING', 'Use as default billing address')));
         $options[] = SelectionGroup_Item::create('new', HasOneCompositeField::create('new', Address::create(), $addressFields), _t('AlternateAddressBookCheckoutComponent.' . $this->addresstype . '_TO_NEW_ADDRESS', 'New ' . ucfirst($this->addresstype) . ' Address'));
     }
     return FieldList::create(TabbedSelectionGroup::create('Use', $options)->setTitle(_t('ShippingDetails.' . $this->addresstype . '_ADDRESS', ucfirst($this->addresstype) . ' Address'))->setLabelTab(true)->showAsDropdown(true));
 }
 public function getCMSFields()
 {
     $DefaultAlbumCoverField = UploadField::create('DefaultAlbumCover');
     $DefaultAlbumCoverField->folderName = "PhotoGallery";
     $DefaultAlbumCoverField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $fields = parent::getCMSFields();
     $AlbumsGridField = new GridField("PhotoAlbums", "Album", $this->PhotoAlbums(), GridFieldConfig::create()->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldAddNewButton('toolbar-header-right'))->addComponent(new GridFieldSortableHeader())->addComponent(new GridFieldDataColumns())->addComponent(new GridFieldPaginator(50))->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldFilterHeader())->addComponent($sortable = new GridFieldSortableRows('SortID')));
     if ($this->AlbumDefaultTop == true) {
         $sortable->setAppendToTop(true);
     }
     $fields->addFieldToTab("Root.Albums", $AlbumsGridField);
     $fields->addFieldToTab("Root.Config", HeaderField::create("Album Settings"));
     $fields->addFieldToTab("Root.Config", $DefaultAlbumCoverField);
     $fields->addFieldToTab("Root.Config", SliderField::create('AlbumsPerPage', 'Number of Albums Per Page', 1, 25));
     $fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailWidth", "Album Cover Thumbnail Width", 50, 400));
     $fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailHeight", "Album Cover Thumbnail Height", 50, 400));
     $fields->addFieldToTab("Root.Config", CheckboxField::create("ShowAllPhotoAlbums")->setTitle("Show photo album even if it's empty"));
     $fields->addFieldToTab("Root.Config", CheckboxField::create("AlbumDefaultTop")->setTitle("Sort new albums to the top by default"));
     $fields->addFieldToTab("Root.Config", HeaderField::create("Photo Settings"));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotosPerPage", "Number of Photos Per Page", 1, 50));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailWidth", "Photo Thumbnail Width", 50, 400));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailHeight", "Photo Thumbnail Height", 50, 400));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullWidth", "Photo Fullsize Width", 400, 1200));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullHeight", "Photo Fullsize Height", 400, 1200));
     $fields->addFieldToTab("Root.Config", CheckboxField::create("PhotoDefaultTop")->setTitle("Sort new photos to the top by default"));
     return $fields;
 }