/** * @param Controller $controller * @param Job $job (optional) */ public function __construct($controller, $job = null) { if ($job) { $fields = $job->getFields(); $required = $job->getValidator(); } else { $fields = singleton('Job')->getFields(); $required = singleton('Job')->getValidator(); } $fields->merge(new FieldList(new LiteralField('Conditions', $controller->TermsAndConditionsText), new HiddenField('BackURL', '', $controller->Link('thanks')), new HiddenField('EmailFrom', '', $controller->getJobEmailFromAddress()), new HiddenField('EmailSubject', '', $controller->getJobEmailSubject()), $jobId = new HiddenField('JobID'))); if ($job) { $jobId->setValue($job->ID); $actions = new FieldList(new FormAction('doEditJob', _t('Jobboard.EDITLISTING', 'Edit Listing'))); } else { $actions = new FieldList(new FormAction('doAddJob', _t('JobBoard.CONFIRM', 'Confirm'))); } parent::__construct($controller, 'AddJobForm', $fields, $actions, $required); $this->setFormAction('JobBoardFormProcessor/doJobForm'); $this->setFormMethod('POST'); if ($job) { $this->loadDataFrom($job); } else { $this->enableSpamProtection(); } }
/** * @param string $message * @param string $messageType */ public function setError($message, $messageType) { // show the manual fields $this->manualToggle->setValue('1'); $name = $this->getName(); $field = $this->manualFields->dataFieldByName("{$name}[{$messageType}]"); if ($field) { $field->setError($message, 'validation'); } }
public function __construct($conversationId, $opponentId) { parent::__construct('newMailMessageForm'); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $field = new TextField('newMessageText'); $field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation')); $field->setId('newMessageText'); $this->addElement($field); $field = new HiddenField('attachment'); $this->addElement($field); $field = new HiddenField('conversationId'); $field->setValue($conversationId); $this->addElement($field); $field = new HiddenField('opponentId'); $field->setValue($opponentId); $this->addElement($field); $field = new HiddenField('uid'); $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId)); $this->addElement($field); $submit = new Submit('newMessageSendBtn'); $submit->setId('newMessageSendBtn'); $submit->setName('newMessageSendBtn'); $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button')); $this->addElement($submit); if (!OW::getRequest()->isAjax()) { $js = UTIL_JsGenerator::composeJsString(' owForms["newMailMessageForm"].bind( "submit", function( r ) { $("#newmessage-mail-send-btn").addClass("owm_preloader_circle"); });'); OW::getDocument()->addOnloadScript($js); } $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage')); }
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); }
public function __construct($opponentId) { parent::__construct('composeMessageForm'); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $field = new HiddenField('uid'); $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_new_message_' . $opponentId)); $this->addElement($field); $field = new HiddenField('opponentId'); $field->setValue($opponentId); $this->addElement($field); $field = new TextField('subject'); $field->setInvitation(OW::getLanguage()->text('mailbox', 'subject')); $field->setHasInvitation(true); $field->setRequired(); $this->addElement($field); $field = new Textarea('message'); $field->setInvitation(OW::getLanguage()->text('mailbox', 'text_message_invitation')); $field->setHasInvitation(true); $field->setRequired(); $this->addElement($field); $field = new HiddenField('attachment'); $this->addElement($field); $submit = new Submit('sendBtn'); $submit->setId('sendBtn'); $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button')); $this->addElement($submit); if (!OW::getRequest()->isAjax()) { $js = UTIL_JsGenerator::composeJsString(' owForms["composeMessageForm"].bind( "submit", function( r ) { $("#newmessage-mail-send-btn").addClass("owm_preloader_circle"); });'); OW::getDocument()->addOnloadScript($js); } }
function __construct($controller, $name, $speakerID, $use_actions = true) { $fields = new FieldList(); //point of contact $speakerIDfield = new HiddenField('speaker_id'); $speakerIDfield->setValue($speakerID); $fields->push($speakerIDfield); $fields->push(new TextField('org_name', 'Name of Organizer')); $fields->push(new EmailField('org_email', 'Email')); $fields->push(new TextField('event_name', 'Event')); $fields->push(new TextField('event_format', 'Format/Length')); $fields->push(new TextField('event_attendance', 'Expected Attendance (number)')); $fields->push(new TextField('event_date', 'Date of Event')); $fields->push(new TextField('event_location', 'Location')); $fields->push(new TextField('event_topic', 'Topic(s)')); $request = new HtmlEditorField('general_request', 'General Request'); $request->setRows(10); $fields->push($request); $sec_field = new TextField('field_98438688', 'field_98438688'); $sec_field->addExtraClass('honey'); $fields->push($sec_field); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('sendSpeakerEmail', 'Send')); } parent::__construct($controller, $name, $fields, $actions); }
public function __construct() { parent::__construct(); $language = OW::getLanguage(); $serviceLang = BOL_LanguageService::getInstance(); $addSectionForm = new Form('qst_add_section_form'); $addSectionForm->setAjax(); $addSectionForm->setAjaxResetOnSuccess(true); $addSectionForm->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder")); $input = new HiddenField('command'); $input->setValue('addSection'); $addSectionForm->addElement($input); $qstSectionName = new TextField('section_name'); $qstSectionName->addAttribute('class', 'ow_text'); $qstSectionName->addAttribute('style', 'width: auto;'); $qstSectionName->setRequired(); $qstSectionName->setLabel($language->text('admin', 'questions_new_section_label')); $addSectionForm->addElement($qstSectionName); $this->addForm($addSectionForm); $addSectionForm->bindJsFunction('success', ' function (result) { if ( result.result ) { OW.info(result.message); } else { OW.error(result.message); } window.location.reload(); } '); }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { // Add timepicker functionality // @see https://github.com/trentrichardson/jQuery-Timepicker-Addon Requirements::css(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css'); Requirements::css(ADVANCED_WORKFLOW_DIR . '/css/WorkflowFieldTimePicker.css'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/javascript/WorkflowField.js'); $this->setIsWorkflowInEffect(); if ($this->getIsWorkflowInEffect()) { $fields->addFieldsToTab('Root.PublishingSchedule', array(new HeaderField('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), new LiteralField('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = new Datetimefield('DesiredPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE', 'Requested publish date')), $ut = new Datetimefield('DesiredUnPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_UNPUBLISH_DATE', 'Requested un-publish date')), Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date'))->setDisabled(true), Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))->setDisabled(true), $uth = new HiddenField('PublishOnDateOwner'))); // Set a value to our hidden field $uth->setValue($this->owner->PublishOnDate); } else { $fields->addFieldsToTab('Root.PublishingSchedule', array(new HeaderField('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), new LiteralField('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = new Datetimefield('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date')), $ut = new Datetimefield('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date')))); } $dt->getDateField()->setConfig('showcalendar', true); $ut->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('timeformat', 'HH:mm:ss'); $ut->getTimeField()->setConfig('timeformat', 'HH:mm:ss'); // Enable a jQuery-UI timepicker widget if (self::$showTimePicker) { $dt->getTimeField()->addExtraClass('hasTimePicker'); $ut->getTimeField()->addExtraClass('hasTimePicker'); } }
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)); }
public function __construct(BASE_CommentsParams $params, $id, $formName) { parent::__construct(); $language = OW::getLanguage(); $form = new Form($formName); $textArea = new Textarea('commentText'); $textArea->setHasInvitation(true); $textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text')); $form->addElement($textArea); $hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1); foreach ($hiddenEls as $name => $value) { $el = new HiddenField($name); $el->setValue($value); $form->addElement($el); } $submit = new Submit('comment-submit'); $submit->setValue($language->text('base', 'comment_add_submit_label')); $form->addElement($submit); $form->setAjax(true); $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment')); // $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}"); // $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}"); $this->addForm($form); OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');"); $this->assign('form', true); $this->assign('id', $id); }
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')); }
public function __construct($userId) { parent::__construct(); $data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId)); $albums = empty($data["albums"]) ? array() : $data["albums"]; $source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId); $this->assign("source", $source == "album" ? "album" : "all"); $selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId); $form = new Form("pcGallerySettings"); $form->setEmptyElementsErrorMessage(null); $form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings")); $element = new HiddenField("userId"); $element->setValue($userId); $form->addElement($element); $element = new Selectbox("album"); $element->setHasInvitation(true); $element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation")); $validator = new PCGALLERY_AlbumValidator(); $element->addValidator($validator); $albumsPhotoCount = array(); foreach ($albums as $album) { $element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})"); $albumsPhotoCount[$album["id"]] = $album["photoCount"]; if ($album["id"] == $selectedAlbum) { $element->setValue($album["id"]); } } OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount))); $element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label")); $form->addElement($element); $submit = new Submit("save"); $submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label")); $form->addElement($submit); $this->addForm($form); }
/** * * @param type $value */ public function setValue($value) { if (is_string($value)) { $this->gridStateData = new GridState_Data(json_decode($value, true)); } parent::setValue($value); }
public function Field($properties = array()) { $titleArray = $itemIDs = array(); $titleList = $itemIDsList = ""; if ($items = $this->getItems()) { foreach ($items as $item) { $titleArray[] = $item->Title; } foreach ($items as $item) { $itemIDs[] = $item->ID; } if ($titleArray) { $titleList = implode(", ", $titleArray); } if ($itemIDs) { $itemIDsList = implode(",", $itemIDs); } } $field = new ReadonlyField($this->name . '_ReadonlyValue', $this->title); $field->setValue($titleList); $field->setForm($this->form); $valueField = new HiddenField($this->name); $valueField->setValue($itemIDsList); $valueField->setForm($this->form); return $field->Field() . $valueField->Field(); }
public function __construct($providerName) { parent::__construct('login-form'); $language = OW::getLanguage(); $this->setAction(""); $label = $language->text('yncontactimporter', 'login_email'); if ($providerName == 'hyves') { $label = $language->text('yncontactimporter', 'login_username'); } // email $email = new TextField('email'); $email->setLabel($label)->setRequired(true); $this->addElement($email); //pass $password = new PasswordField('password'); $password->setLabel($language->text('yncontactimporter', 'login_password'))->setRequired(true); $this->addElement($password); //providerName $hiddenProviderName = new HiddenField('providerName'); $hiddenProviderName->setValue($providerName); $this->addElement($hiddenProviderName); // button submit $submit = new Submit('submit'); $submit->setValue($language->text('yncontactimporter', 'submit_btn_label')); $this->addElement($submit); }
public function getCMSFields() { Requirements::javascript(LINK_EDIT_TOOLS_PATH . '/javascript/linkedit.js'); $localeField = new HiddenField('Locale'); $localeField->setValue($this->LinksFolder()->Locale); $fields = new FieldList(new TextField('Title', 'Link title'), new DropdownField('LinkType', 'Internal or External Link', singleton('Link')->dbObject('LinkType')->enumValues()), new TextField('URL'), new TreeDropdownField('InternalPageID', 'Choose an internal link', 'SiteTree'), new HtmlEditorField('Description'), $localeField); return $fields; }
/** * Note: Use {@link getDateField()} and {@link getTimeField()} * to set field-specific config options. * * @param string $name * @param mixed $val */ public function setConfig($name, $val) { $this->config[$name] = $val; if ($name == 'usertimezone') { $this->timezoneField->setValue($val); $this->setValue($this->dataValue()); } return $this; }
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); } }
public function __construct($feedAutoId, $feedType, $feedId, $actionVisibility) { $this->feedAutoId = $feedAutoId; parent::__construct(); $field = new HiddenField('feedType'); $field->setValue($feedType); $this->addElement($field); $field = new HiddenField('feedId'); $field->setValue($feedId); $this->addElement($field); $field = new HiddenField('visibility'); $field->setValue($actionVisibility); $this->addElement($field); $this->setAction(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('QUESTIONS_CTRL_Questions', 'newsfeedAdd'))); }
/** * Constructor. * * @param array $itemsList */ public function __construct($langId) { parent::__construct(); $this->service = BOL_LanguageService::getInstance(); if (empty($langId)) { $this->setVisible(false); return; } $languageDto = $this->service->findById($langId); if ($languageDto === null) { $this->setVisible(false); return; } $language = OW::getLanguage(); $form = new Form('lang_edit'); $form->setAjax(); $form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder')); $form->setAjaxResetOnSuccess(false); $labelTextField = new TextField('label'); $labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label')); $labelTextField->setDescription($language->text('admin', 'clone_form_descr_label')); $labelTextField->setRequired(); $labelTextField->setValue($languageDto->getLabel()); $form->addElement($labelTextField); $tagTextField = new TextField('tag'); $tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag')); $tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag')); $tagTextField->setRequired(); $tagTextField->setValue($languageDto->getTag()); if ($languageDto->getTag() == 'en') { $tagTextField->addAttribute('disabled', 'disabled'); } $form->addElement($tagTextField); $rtl = new CheckboxField('rtl'); $rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label')); $rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc')); $rtl->setValue((bool) $languageDto->getRtl()); $form->addElement($rtl); $hiddenField = new HiddenField('langId'); $hiddenField->setValue($languageDto->getId()); $form->addElement($hiddenField); $submit = new Submit('submit'); $submit->setValue($language->text('admin', 'btn_label_edit')); $form->addElement($submit); $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}"); $this->addForm($form); }
public function __construct($conversationId, $opponentId) { parent::__construct('newMessageForm'); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $field = new HiddenField('attachment'); $this->addElement($field); $field = new HiddenField('conversationId'); $field->setValue($conversationId); $this->addElement($field); $field = new HiddenField('opponentId'); $field->setValue($opponentId); $this->addElement($field); $field = new HiddenField('uid'); $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId)); $this->addElement($field); $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'attachment')); }
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); }
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 }"); }
public function __construct($userId) { parent::__construct(); $form = new Form("send_message_form"); $form->setAjax(true); $form->setAjaxResetOnSuccess(true); $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_AjaxSendMessageToEmail', 'sendMessage')); $user = new HiddenField("userId"); $user->setValue($userId); $form->addElement($user); $subject = new TextField('subject'); $subject->setInvitation(OW::getLanguage()->text('base', 'subject')); $subject->setRequired(true); $form->addElement($subject); $textarea = new WysiwygTextarea("message"); $textarea->setInvitation(OW::getLanguage()->text('base', 'message_invitation')); $requiredValidator = new WyswygRequiredValidator(); $requiredValidator->setErrorMessage(OW::getLanguage()->text('base', 'message_empty')); $textarea->addValidator($requiredValidator); $form->addElement($textarea); $submit = new Submit('send'); $submit->setLabel(OW::getLanguage()->text('base', 'send')); $form->addElement($submit); $form->bindJsFunction(Form::BIND_SUCCESS, ' function ( data ) { if ( data.result ) { OW.info(data.message); } else { OW.error(data.message); } if ( OW.getActiveFloatBox() ) { OW.getActiveFloatBox().close(); } } '); $this->addForm($form); }
public function __construct(BOL_MenuItem $menuItem, $custom = false) { parent::__construct("settingForm"); $this->menuItem = $menuItem; $language = OW::getLanguage(); $this->setAjax(); $this->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_MobileNavigation", "saveItemSettings")); $item = new HiddenField("key"); $item->setValue($menuItem->prefix . ':' . $menuItem->key); $this->addElement($item); $settings = BOL_MobileNavigationService::getInstance()->getItemSettings($this->menuItem); // Mail Settings $item = new TextField(BOL_MobileNavigationService::SETTING_LABEL); $item->setLabel($language->text("mobile", "admin_nav_item_label_field")); $item->setValue($settings[BOL_MobileNavigationService::SETTING_LABEL]); $this->addElement($item); if ($custom) { $item = new TextField(BOL_MobileNavigationService::SETTING_TITLE); $item->setLabel($language->text("mobile", "admin_nav_item_title_field")); $item->setValue($settings[BOL_MobileNavigationService::SETTING_TITLE]); $this->addElement($item); $item = new Textarea(BOL_MobileNavigationService::SETTING_CONTENT); $item->setLabel($language->text("mobile", "admin_nav_item_content_field")); $item->setValue($settings[BOL_MobileNavigationService::SETTING_CONTENT]); $this->addElement($item); $item = new CheckboxGroup(BOL_MobileNavigationService::SETTING_VISIBLE_FOR); $visibleFor = empty($settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR]) ? 0 : $settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR]; $options = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members')); $values = array(); foreach ($options as $value => $option) { if (!($value & $visibleFor)) { continue; } $values[] = $value; } $this->addElement($item->setOptions($options)->setValue($values)->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for'))); } // submit $submit = new Submit('save'); $submit->setValue($language->text('admin', 'save_btn_label')); $this->addElement($submit); }
public function __construct($entityType, $entityId) { parent::__construct('flag'); $this->setAjax(true); $this->setAction(OW::getRouter()->urlFor('BASE_CTRL_Flag', 'flag')); $element = new HiddenField('entityType'); $element->setValue($entityType); $this->addElement($element); $element = new HiddenField('entityId'); $element->setValue($entityId); $this->addElement($element); $element = new RadioField('reason'); $element->setOptions(array('spam' => OW::getLanguage()->text('base', 'flag_spam'), 'offence' => OW::getLanguage()->text('base', 'flag_offence'), 'illegal' => OW::getLanguage()->text('base', 'flag_illegal'))); $flagDto = BOL_FlagService::getInstance()->findFlag($entityType, $entityId, OW::getUser()->getId()); if ($flagDto !== null) { $element->setValue($flagDto->reason); } $this->addElement($element); OW::getDocument()->addOnloadScript("owForms['{$this->getName()}'].bind('success', function(json){\n\t\t\tswitch( json['result'] ){\n\t\t\t\tcase 'success':\n\t\t\t\t\tOW.registry['flag-panel-fb'].close();\n\t\t\t\t\tOW.addScript(json.js);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t})"); }
public function __construct($value, $languageData) { parent::__construct('lang-values-edit'); $this->setAjax(true); //$this->setAction('javascript://'); $hidden = new HiddenField('value'); $hidden->setValue($value); $this->addElement($hidden); $languageService = BOL_LanguageService::getInstance(); $list = $languageService->findActiveList(); foreach ($list as $item) { $textArea = new Textarea("lang[{$item->getId()}][value][{$value}]"); if (isset($languageData[$item->getId()])) { $textArea->setValue($languageData[$item->getId()]); } $this->addElement($textArea); } $submit = new Submit('submit'); $submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label')); $this->addElement($submit); }
public function __construct($type, $id, $title, $url, $langKey, $ownerId) { parent::__construct('flag'); $this->setAjax(true); $this->setAction(OW::getRouter()->urlFor('BASE_CTRL_Flag', 'flag')); $hiddenType = new HiddenField('type'); $hiddenId = new HiddenField('id'); $hiddenTitle = new HiddenField('title'); $hiddenUrl = new HiddenField('url'); $hiddenOwnerId = new HiddenField('ownerId'); $hiddenLangKey = new HiddenField('langKey'); $this->addElement($hiddenType->setValue($type))->addElement($hiddenId->setValue($id))->addElement($hiddenTitle->setValue(htmlspecialchars($title)))->addElement($hiddenUrl->setValue($url))->addElement($hiddenLangKey->setValue($langKey))->addElement($hiddenOwnerId->setValue($ownerId)); $reasonField = new RadioField('reason'); $reasonField->setOptions(array('spam' => OW::getLanguage()->text('base', 'flag_spam'), 'offence' => OW::getLanguage()->text('base', 'flag_offence'), 'illegal' => OW::getLanguage()->text('base', 'flag_illegal'))); $flagDto = BOL_FlagService::getInstance()->findFlag($type, $id, OW::getUser()->getId()); if ($flagDto !== null) { $reasonField->setValue($flagDto->reason); } $this->addElement($reasonField); OW::getDocument()->addOnloadScript("owForms['{$this->getName()}'].bind('success', function(json){\n\t\t\tswitch( json['result'] ){\n\t\t\t\tcase 'success':\n\t\t\t\t\tOW.registry['flag-panel-fb'].close();\n\t\t\t\t\teval(json.js);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t})"); }
/** * Class constructor */ public function __construct($tpls) { parent::__construct('edit-template-form'); $this->setAction(OW::getRouter()->urlFor('VIRTUALGIFTS_CTRL_Admin', 'editTemplate')); $single = count($tpls) == 1; $this->setEnctype('multipart/form-data'); $language = OW::getLanguage(); $giftService = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance(); if ($single) { $file = new FileField('file'); $file->setLabel($language->text('virtualgifts', 'gift_image')); $this->addElement($file); $tpl = $giftService->findTemplateById($tpls[0]); } $tplId = new HiddenField('tplId'); $tplId->setRequired(true); $tplId->setValue(implode('|', $tpls)); $this->addElement($tplId); if ($giftService->categoriesSetup()) { $categories = new Selectbox('category'); $categories->setLabel($language->text('virtualgifts', 'category')); $categories->setOptions($giftService->getCategories()); if ($single && isset($tpl)) { $categories->setValue($tpl->categoryId); } $this->addElement($categories); } if (OW::getPluginManager()->isPluginActive('usercredits')) { $price = new TextField('price'); $price->setLabel($language->text('virtualgifts', 'gift_price')); if ($single && isset($tpl)) { $price->setValue($tpl->price); } $this->addElement($price); } // submit $submit = new Submit('save'); $submit->setValue($language->text('virtualgifts', 'btn_save')); $this->addElement($submit); }
function __construct($controller, $name, $use_actions = true) { $RatingField = new TextField('rating', ''); $RatingField->setValue(0); $TitleField = new TextField('title', 'Title'); $CommentField = new HtmlEditorField('comment', 'Comment'); $CommentField->setRows(8); $CompanyServiceIDField = new HiddenField('company_service_ID', ''); $CompanyServiceIDField->setValue($controller->company_service_ID); $LoggedInField = new HiddenField('logged_in', ''); if (Member::CurrentUser()) { $LoggedInField->setValue(1); } $fields = new FieldList($RatingField, $TitleField, $CommentField, $CompanyServiceIDField, $LoggedInField); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('saveReview', 'Submit')); } $this->addExtraClass('review-form'); parent::__construct($controller, $name, $fields, $actions); }