Example #1
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'));
 }
Example #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'));
 }
Example #3
0
 public function index($params = array())
 {
     $userService = BOL_UserService::getInstance();
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('hotlist', 'admin_heading_settings'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
     $settingsForm = new Form('settingsForm');
     $settingsForm->setId('settingsForm');
     $expiration_time = new TextField('expiration_time');
     $expiration_time->setRequired();
     $expiration_time->setLabel($language->text('hotlist', 'label_expiration_time'));
     $expiration_time_value = (int) OW::getConfig()->getValue('hotlist', 'expiration_time') / 86400;
     $expiration_time->setValue($expiration_time_value);
     $settingsForm->addElement($expiration_time);
     $submit = new Submit('save');
     $submit->addAttribute('class', 'ow_ic_save');
     $submit->setValue($language->text('hotlist', 'label_save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             OW::getConfig()->saveConfig('hotlist', 'expiration_time', $data['expiration_time'] * 86400);
             OW::getFeedback()->info($language->text('hotlist', 'settings_saved'));
             $this->redirect();
         }
     }
 }
Example #4
0
 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);
 }
Example #5
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');
 }
Example #6
0
 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);
 }
Example #7
0
 public function getAdminInterface()
 {
     $st = "select ecomm_product.id as product_id, ecomm_product.name as product_name,\n\t\t\t\tecomm_product.supplier as supplier_id, ecomm_supplier.name as supplier_name, ecomm_product.price as product_price\n\t\t\t\tfrom ecomm_product left join ecomm_supplier on ecomm_product.supplier = ecomm_supplier.id\n\t\t\t\torder by ecomm_supplier.name,ecomm_product.name";
     $products = Database::singleton()->query_fetch_all($st);
     $formPath = "/admin/EComm&section=Plugins&page=ChangeProductPrice";
     $form = new Form('change_product_prices', 'post', $formPath);
     if ($form->validate() && isset($_REQUEST['submit'])) {
         foreach ($products as $product) {
             $ECommProduct = new Product($product['product_id']);
             $ECommProduct->setPrice($_REQUEST['product_' . $product['product_id']]);
             $ECommProduct->save();
         }
         return "Your products' prices have been changed successfully<br/><a href='{$formPath}'>Go back</a>";
     }
     $oldSupplier = 0;
     $currentSupplier = 0;
     $defaultValue = array();
     foreach ($products as $product) {
         $currentSupplier = $product['supplier_id'];
         if ($oldSupplier != $currentSupplier) {
             $form->addElement('html', '<br/><br/><hr/><h3>Supplier: ' . $product['supplier_name'] . '</h3>');
         }
         $form->addElement('text', 'product_' . $product['product_id'], $product['product_name']);
         $defaultValue['product_' . $product['product_id']] = $product['product_price'];
         $oldSupplier = $product['supplier_id'];
     }
     $form->addElement('submit', 'submit', 'Submit');
     $form->setDefaults($defaultValue);
     return $form->display();
 }
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);
 }
    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();
            } ');
    }
 public function render($stat_id = null)
 {
     global $rm_form_diary;
     echo '<div class="rmagic">';
     //$this->form_number = $rm_form_diary[$this->form_id];
     $form = new Form('form_' . $this->form_id . "_" . $this->form_number);
     $form->configure(array("prevent" => array("bootstrap", "jQuery", "focus"), "action" => "", "class" => "rmagic-form", "name" => "rm_form", "number" => $this->form_number, "view" => new View_UserForm(), "style" => isset($this->form_options->style_form) ? $this->form_options->style_form : null));
     //Render content above the form
     if (!empty($this->form_options->form_custom_text)) {
         $form->addElement(new Element_HTML('<div class="rmheader">' . $this->form_options->form_custom_text . '</div>'));
     }
     if ($this->is_expired()) {
         if ($this->form_options->form_message_after_expiry) {
             echo $this->form_options->form_message_after_expiry;
         } else {
             echo '<div class="rm-no-default-from-notification">' . RM_UI_Strings::get('MSG_FORM_EXPIRY') . '</div>';
         }
         echo '</div>';
         return;
     }
     if ($stat_id) {
         $form->addElement(new Element_HTML('<div id="rm_stat_container" style="display:none">'));
         $form->addElement(new Element_Number('RM_Stats', 'stat_id', array('value' => $stat_id, 'style' => 'display:none')));
         $form->addElement(new Element_HTML('</div>'));
     }
     parent::pre_render();
     $this->base_render($form);
     parent::post_render();
     echo '</div>';
 }
 function person_enter_render_xml()
 {
     $form = new Form();
     $form->addElement(new FormInputElement("first_name", "Voornaam"));
     $form->addElement(new FormInputElement("initials", "Voorletters"));
     $form->addElement(new FormInputElement("last_name_prefix", "Tussenvoegsel"));
     $form->addElement(new FormInputElement("last_name", "Achternaam"));
     $form->addElement(new FormInputElement("email_address", "E-mail adres", "email"));
     return $form->GenerateForm(NULL, "Voer persoonsgegevens in");
 }
 function render_xml()
 {
     $form = new Form();
     $form->addElement(new FormInputElement("address_street", "Straat"));
     $form->addElement(new FormInputElement("address_number", "Huisnummer"));
     $form->addElement(new FormInputElement("address_postalcode", "Postcode"));
     $form->addElement(new FormInputElement("address_city", "Stad"));
     //$form->addElement(new FormInputElement("address_province","Provincie"));
     //$form->addElement(new FormInputElement("address_country","Land")); //!! ISO CODE, DROPDOWN
     return $form->GenerateForm(NULL, "Voer adresgegevens in");
 }
Example #13
0
 public function __construct($entityType, $entityId, $displayType, $pluginKey, $ownerId, $commentCountOnPage, $id, $cmpContextId, $formName)
 {
     parent::__construct();
     $language = OW::getLanguage();
     //comment form init
     $form = new Form($formName);
     $textArea = new Textarea('commentText');
     $form->addElement($textArea);
     $entityTypeField = new HiddenField('entityType');
     $form->addElement($entityTypeField);
     $entityIdField = new HiddenField('entityId');
     $form->addElement($entityIdField);
     $displayTypeField = new HiddenField('displayType');
     $form->addElement($displayTypeField);
     $pluginKeyField = new HiddenField('pluginKey');
     $form->addElement($pluginKeyField);
     $ownerIdField = new HiddenField('ownerId');
     $form->addElement($ownerIdField);
     $attch = new HiddenField('attch');
     $form->addElement($attch);
     $cid = new HiddenField('cid');
     $form->addElement($cid);
     $commentsOnPageField = new HiddenField('commentCountOnPage');
     $form->addElement($commentsOnPageField);
     $submit = new Submit('comment-submit');
     $submit->setValue($language->text('base', 'comment_add_submit_label'));
     $form->addElement($submit);
     $form->getElement('entityType')->setValue($entityType);
     $form->getElement('entityId')->setValue($entityId);
     $form->getElement('displayType')->setValue($displayType);
     $form->getElement('pluginKey')->setValue($pluginKey);
     $form->getElement('ownerId')->setValue($ownerId);
     $form->getElement('cid')->setValue($id);
     $form->getElement('commentCountOnPage')->setValue($commentCountOnPage);
     $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);
     if (BOL_TextFormatService::getInstance()->isCommentsRichMediaAllowed()) {
         $attachmentCmp = new BASE_CLASS_Attachment($id);
         $this->addComponent('attachment', $attachmentCmp);
     }
     OW::getDocument()->addOnloadScript("owCommentCmps['{$id}'].initForm('" . $form->getElement('commentText')->getId() . "', '" . $form->getElement('attch')->getId() . "');");
     $this->assign('form', true);
     $this->assign('id', $id);
     if (OW::getUser()->isAuthenticated()) {
         $currentUserInfo = BOL_AvatarService::getInstance()->getDataForUserAvatars(array(OW::getUser()->getId()));
         $this->assign('currentUserInfo', $currentUserInfo[OW::getUser()->getId()]);
     }
 }
Example #14
0
 public function __construct()
 {
     parent::__construct();
     $language = OW::getLanguage();
     $form = new Form("change-user-password");
     $form->setId("change-user-password");
     $oldPassword = new PasswordField('oldPassword');
     $oldPassword->setLabel($language->text('base', 'change_password_old_password'));
     $oldPassword->addValidator(new OldPasswordValidator());
     $oldPassword->setRequired();
     $form->addElement($oldPassword);
     $newPassword = new PasswordField('password');
     $newPassword->setLabel($language->text('base', 'change_password_new_password'));
     $newPassword->setRequired();
     $newPassword->addValidator(new NewPasswordValidator());
     $form->addElement($newPassword);
     $repeatPassword = new PasswordField('repeatPassword');
     $repeatPassword->setLabel($language->text('base', 'change_password_repeat_password'));
     $repeatPassword->setRequired();
     $form->addElement($repeatPassword);
     $submit = new Submit("change");
     $submit->setLabel($language->text('base', 'change_password_submit'));
     $form->setAjax(true);
     $form->addElement($submit);
     if (OW::getRequest()->isAjax()) {
         $result = false;
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             BOL_UserService::getInstance()->updatePassword(OW::getUser()->getId(), $data['password']);
             $result = true;
         }
         echo json_encode(array('result' => $result));
         exit;
     } else {
         $messageError = $language->text('base', 'change_password_error');
         $messageSuccess = $language->text('base', 'change_password_success');
         $js = " owForms['" . $form->getName() . "'].bind( 'success',\n            function( json )\n            {\n            \tif( json.result == true )\n            \t{\n            \t    \$('#TB_closeWindowButton').click();\n            \t    OW.info('{$messageSuccess}');\n                }\n                else\n                {\n                    OW.error('{$messageError}');\n                }\n\n            } ); ";
         OW::getDocument()->addOnloadScript($js);
         $this->addForm($form);
         $language->addKeyForJs('base', 'join_error_password_not_valid');
         $language->addKeyForJs('base', 'join_error_password_too_short');
         $language->addKeyForJs('base', 'join_error_password_too_long');
         //include js
         $onLoadJs = " window.changePassword = new OW_BaseFieldValidators( " . json_encode(array('formName' => $form->getName(), 'responderUrl' => OW::getRouter()->urlFor("BASE_CTRL_Join", "ajaxResponder"), 'passwordMaxLength' => UTIL_Validator::PASSWORD_MAX_LENGTH, 'passwordMinLength' => UTIL_Validator::PASSWORD_MIN_LENGTH)) . ",\n                                                            " . UTIL_Validator::EMAIL_PATTERN . ", " . UTIL_Validator::USER_NAME_PATTERN . " ); ";
         $onLoadJs .= " window.oldPassword = new OW_ChangePassword( " . json_encode(array('formName' => $form->getName(), 'responderUrl' => OW::getRouter()->urlFor("BASE_CTRL_Edit", "ajaxResponder"))) . " ); ";
         OW::getDocument()->addOnloadScript($onLoadJs);
         $jsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl();
         OW::getDocument()->addScript($jsDir . "base_field_validators.js");
         OW::getDocument()->addScript($jsDir . "change_password.js");
     }
 }
Example #15
0
 public function index()
 {
     $groups = MODERATION_BOL_Service::getInstance()->getContentGroups();
     if (OW::getRequest()->isPost()) {
         $selectedGroups = empty($_POST["groups"]) ? array() : $_POST["groups"];
         $types = array();
         foreach ($groups as $group) {
             $selected = in_array($group["name"], $selectedGroups);
             foreach ($group["entityTypes"] as $type) {
                 $types[$type] = $selected;
             }
         }
         OW::getConfig()->saveConfig("moderation", "content_types", json_encode($types));
         OW::getFeedback()->info(OW::getLanguage()->text("moderation", "content_types_saved_message"));
         $this->redirect(OW::getRouter()->urlForRoute("moderation.admin"));
     }
     $this->setPageHeading(OW::getLanguage()->text("moderation", "admin_heading"));
     $this->setPageTitle(OW::getLanguage()->text("moderation", "admin_title"));
     $form = new Form("contentTypes");
     $submit = new Submit("save");
     $submit->setLabel(OW::getLanguage()->text("admin", "save_btn_label"));
     $form->addElement($submit);
     $this->addForm($form);
     $this->assign("groups", $groups);
 }
 public function admin()
 {
     $view = $this->getView();
     $request = $this->getPageRequest();
     if (!\Core\user()->checkAccess('g:admin')) {
         return View::ERROR_ACCESSDENIED;
     }
     $image = ConfigHandler::Get('/favicon/image');
     $form = new Form();
     $form->set('callsmethod', 'AdminController::_ConfigSubmit');
     $form->addElement(ConfigHandler::GetConfig('/favicon/image')->getAsFormElement());
     $form->addElement('submit', ['value' => t('STRING_SAVE')]);
     $view->title = 'Site Favicon';
     $view->assign('current', $image);
     $view->assign('form', $form);
 }
 public function index()
 {
     $view = $this->getView();
     $request = $this->getPageRequest();
     if (!\Core\user()->checkAccess('g:admin')) {
         return View::ERROR_ACCESSDENIED;
     }
     if ($request->isPost()) {
         // Update/save the site id.
         ConfigHandler::Set('/livefyre/siteid', $_POST['siteid']);
         \Core\set_message('Set Site ID Successfully!', 'success');
         \Core\reload();
     }
     // Pull the configuration options to see if livefyre is currently setup.
     $siteid = ConfigHandler::Get('/livefyre/siteid');
     // Generate the form to either set or update the siteid.
     $form = new Form();
     $form->set('method', 'POST');
     $form->addElement('text', ['name' => 'siteid', 'title' => 'Site ID', 'value' => $siteid]);
     $view->assign('siteid', $siteid);
     $view->assign('url', ROOT_URL_NOSSL);
     $view->assign('form', $form);
     // Setup instructions:
     // http://www.livefyre.com/install/
 }
Example #18
0
 /**
  * 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);
 }
Example #19
0
 public function getRegisterForm($target = '/Vote/register')
 {
     $form = new Form('group_register', 'POST', $target, '', array('class' => 'admin'));
     $form->addElement('text', 'first_name', 'First Name');
     $form->addElement('text', 'last_name', 'Last Name');
     $form->addElement('text', 'company', 'Company/Group');
     $form->addElement('text', 'email', 'E-mail');
     $form->addElement('text', 'phone', 'Work Phone');
     $form->addElement('text', 'cell_phone', 'Cell Phone');
     $form->addElement('submit', 'register_submit', 'Submit');
     $form->addRule('first_name', 'Please enter your first name', 'required');
     $form->addRule('last_name', 'Please enter your last name', 'required');
     $form->addRule('company', 'Please enter your company/group', 'required');
     $form->addRule('email', 'Please enter your e-mail address', 'required');
     $form->addRule('email', 'Please enter a valid email address', 'email');
     $form->addRule('phone', 'Please enter your phone number', 'required');
     if ($form->validate() && $form->isSubmitted() && isset($_REQUEST['register_submit'])) {
         $body = "New registration request: \n\n";
         $body .= "Name: " . $form->exportValue('last_name') . ', ' . $form->exportValue('first_name');
         $body .= "\nCompany/Group: " . $form->exportValue('company');
         $body .= "\nE-mail address: " . $form->exportValue('email');
         $body .= "\nPhone number(s): Work - " . $form->exportValue('phone') . ', Cell - ' . $form->exportValue('cell_phone');
         $body .= "\n\nRequest sent on " . date("w F jS \\a\\t g:ia");
         mail('*****@*****.**', 'Safeballot: New Request', $body, 'From: no-reply@safeballot.com');
     }
     return $form;
 }
Example #20
0
 public function fillAccountType($params)
 {
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     $user = OW::getUser()->getUserObject();
     $accountType = BOL_QuestionService::getInstance()->findAccountTypeByName($user->accountType);
     if (!empty($accountType)) {
         throw new Redirect404Exception();
     }
     $event = new OW_Event(OW_EventManager::ON_BEFORE_USER_COMPLETE_ACCOUNT_TYPE, array('user' => $user));
     OW::getEventManager()->trigger($event);
     $accounts = $this->getAccountTypes();
     if (count($accounts) == 1) {
         $accountTypeList = array_keys($accounts);
         $firstAccountType = reset($accountTypeList);
         $accountType = BOL_QuestionService::getInstance()->findAccountTypeByName($firstAccountType);
         if ($accountType) {
             $user->accountType = $firstAccountType;
             BOL_UserService::getInstance()->saveOrUpdate($user);
             //BOL_PreferenceService::getInstance()->savePreferenceValue('profile_details_update_stamp', time(), $user->getId());
             $this->redirect(OW::getRouter()->urlForRoute('base_default_index'));
         }
     }
     $form = new Form('accountTypeForm');
     $joinAccountType = new Selectbox('accountType');
     $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));
     $joinAccountType->setRequired();
     $joinAccountType->setOptions($accounts);
     $joinAccountType->setHasInvitation(false);
     $form->addElement($joinAccountType);
     $submit = new Submit('submit');
     $submit->addAttribute('class', 'ow_button ow_ic_save');
     $submit->setValue(OW::getLanguage()->text('base', 'continue_button'));
     $form->addElement($submit);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $this->saveRequiredQuestionsData($data, $user->id);
         }
     } else {
         OW::getDocument()->addOnloadScript(" OW.info(" . json_encode(OW::getLanguage()->text('base', 'complete_profile_info')) . ") ");
     }
     $this->addForm($form);
 }
 /**
  * Widget to quickly create a new Content page as a draft.
  */
 public function quickdraft()
 {
     $view = $this->getView();
     if (!\Core\user()->checkAccess('p:/content/manage_all')) {
         // Users who do not have access to manage page content do not get this.
         return '';
     }
     $form = new Form();
     $form->set('orientation', 'vertical');
     $form->set('callsmethod', 'ContentAdminWidget::QuickDraftSave');
     $form->addElement('text', ['name' => 'title', 'placeholder' => 'Page or Post Title']);
     $form->addElement('textarea', ['name' => 'content', 'placeholder' => "What's up?", 'cols' => 50]);
     $form->addElement('submit', ['value' => 'Save Draft']);
     // Load in all the pages on the site that are currently set as draft too, why not? ;)
     $drafts = PageModel::Find(['published_status = draft'], 10, 'updated DESC');
     $view->assign('form', $form);
     $view->assign('drafts', $drafts);
 }
Example #22
0
 public function index()
 {
     if (OW::getRequest()->isPost()) {
         OW::getConfig()->saveConfig('cloudflare', 'is_enabled', (bool) $_POST['enable']);
         OW::getFeedback()->info(OW::getLanguage()->text('cloudflare', 'admin_index_property_id_save_success_message'));
         $this->redirect();
     }
     $this->setPageHeading(OW::getLanguage()->text('cloudflare', 'admin_index_heading'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
     $form = new Form('cloudflare');
     $element = new CheckboxField('enable');
     $form->addElement($element);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label'));
     $form->addElement($submit);
     $element->setValue((bool) OW::getConfig()->getValue('cloudflare', 'is_enabled'));
     $this->addForm($form);
 }
 /**
  * @return Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $form = new Form('set_suspend_message');
     $form->setAjax(true);
     $form->setAjaxResetOnSuccess(true);
     $textarea = new Textarea('message');
     $textarea->setRequired();
     $form->addElement($textarea);
     $submit = new Submit('submit');
     $submit->setLabel(OW::getLanguage()->text('base', 'submit'));
     $form->addElement($submit);
     //        $form->bindJsFunction(Form::BIND_SUBMIT, ' function(e) {
     //                return false;  }
     //
     //                ');
     $this->addForm($form);
     $this->bindJs($form);
 }
Example #24
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $adminForm = new Form('adminForm');
     $element = new Selectbox('actionMember');
     $element->setLabel($language->text('grouprss', 'action_member_label'));
     $element->setDescription($language->text('grouprss', 'action_member_desc'));
     $element->setValue($config->getValue('grouprss', 'actionMember'));
     $element->setRequired();
     $element->addOption('admin', $language->text('grouprss', 'site_admin'));
     $element->addOption('owner', $language->text('grouprss', 'group_owner'));
     $element->addOption('both', $language->text('grouprss', 'both_admin_owner'));
     $adminForm->addElement($element);
     $element = new Selectbox('postLocation');
     $element->setLabel($language->text('grouprss', 'post_location_label'));
     $element->setDescription($language->text('grouprss', 'post_location_desc'));
     $element->setValue($config->getValue('grouprss', 'postLocation'));
     $element->setRequired();
     $element->addOption('wall', $language->text('grouprss', 'wall_location'));
     $element->addOption('newsfeed', $language->text('grouprss', 'newsfeed_location'));
     $adminForm->addElement($element);
     $element = new CheckboxField('disablePosting');
     $element->setLabel($language->text('grouprss', 'disable_posting_label'));
     $element->setDescription($language->text('grouprss', 'disable_posting_desc'));
     $element->setValue($config->getValue('grouprss', 'disablePosting'));
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue(OW::getLanguage()->text('grouprss', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $config->saveConfig('grouprss', 'actionMember', $values['actionMember']);
             $config->saveConfig('grouprss', 'postLocation', $values['postLocation']);
             $config->saveConfig('grouprss', 'disablePosting', $values['disablePosting']);
             GROUPRSS_BOL_FeedService::getInstance()->addAllGroupFeed();
             //OW::getFeedback()->info($language->text('grouprss', 'user_save_success'));
         }
     }
     $this->addForm($adminForm);
 }
Example #25
0
    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);
    }
 /**
  * View to set google API keys and other configuration options.
  */
 public function configure()
 {
     $view = $this->getView();
     $request = $this->getPageRequest();
     $configs = ['general' => ['title' => 'General', 'configs' => ['/google/services/public_api_key']], 'analytics' => ['title' => 'Analytics', 'configs' => ['/google-analytics/accountid', '/google/tagmanager/tagid']], 'maps' => ['title' => 'Maps', 'configs' => ['/googlemaps/enterprise/privatekey', '/googlemaps/enterprise/clientname']], 'cse' => ['title' => 'Custom Search', 'configs' => ['/google/cse/key']]];
     $form = new Form();
     $form->set('callsmethod', 'GoogleController::ConfigureSave');
     foreach ($configs as $gk => $gdat) {
         $group = new FormTabsGroup(['name' => $gk, 'title' => $gdat['title']]);
         foreach ($gdat['configs'] as $c) {
             /** @var ConfigModel $config */
             $config = ConfigHandler::GetConfig($c);
             $group->addElement($config->getAsFormElement());
         }
         $form->addElement($group);
     }
     $form->addElement('submit', ['name' => 'submit', 'value' => 'Update Settings']);
     $view->title = 'Google Keys and Apps ';
     $view->assign('form', $form);
 }
Example #27
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 #28
0
 /**
  * @param integer $userId
  */
 public function __construct($userId)
 {
     parent::__construct();
     $user = BOL_UserService::getInstance()->findUserById((int) $userId);
     if (!OW::getUser()->isAuthorized('base') || $user === null) {
         $this->setVisible(false);
         return;
     }
     $aService = BOL_AuthorizationService::getInstance();
     $roleList = $aService->findNonGuestRoleList();
     $form = new Form('give-role');
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'updateUserRoles'));
     $hidden = new HiddenField('userId');
     $form->addElement($hidden->setValue($userId));
     $userRoles = $aService->findUserRoleList($user->getId());
     $userRolesIdList = array();
     foreach ($userRoles as $role) {
         $userRolesIdList[] = $role->getId();
     }
     $tplRoleList = array();
     /* @var $role BOL_AuthorizationRole */
     foreach ($roleList as $role) {
         $field = new CheckboxField('roles[' . $role->getId() . ']');
         $field->setLabel(OW::getLanguage()->text('base', 'authorization_role_' . $role->getName()));
         $field->setValue(in_array($role->getId(), $userRolesIdList));
         if (in_array($role->getId(), $userRolesIdList) && $role->getSortOrder() == 1) {
             $field->addAttribute('disabled', 'disabled');
         }
         $form->addElement($field);
         $tplRoleList[$role->sortOrder] = $role;
     }
     ksort($tplRoleList);
     $form->addElement(new Submit('submit'));
     OW::getDocument()->addOnloadScript("owForms['{$form->getName()}'].bind('success', function(data){\n                if( data.result ){\n                    if( data.result == 'success' ){\n                         window.baseChangeUserRoleFB.close();\n                         window.location.reload();\n                         //OW.info(data.message);\n                    }\n                    else if( data.result == 'error'){\n                        OW.error(data.message);\n                    }\n                }\n\t\t})");
     $this->addForm($form);
     $this->assign('list', $tplRoleList);
 }
Example #29
0
 public function confirmDelete($label)
 {
     $group = new GroupObject();
     if ($group->load_by_label($label)) {
         if (isset($_POST['delete'])) {
             $group = new GroupObject();
             $group->load_by_label($label);
             $group->delete();
             header("Location:" . Page::url("/admin/groups"));
         }
         $theme = new Theme();
         $form = new Form("POST", Page::url("/admin/groups/confirm/{$label}"));
         $link = new FormElement("a", null, t("Retourner à la liste des groupes"), "", "");
         $link->setAttribute("href", Page::url("/admin/groups/"));
         $form->addElement($link);
         $form->addElement(new InputElement("delete", "", t("supprimer le groupe"), "submit"));
         $theme->add_to_body($theme->forming($form));
         $theme->set_title("Confirmer la suppression du groupe {$label}");
         $theme->process_theme(Theme::STRUCT_ADMIN);
     } else {
         header("Location:" . Page::url("/admin/groups?err=notexists"));
     }
 }
Example #30
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $language = OW::getLanguage();
     $form = new Form('inite-friends');
     $emailList = new TagsInputField('emailList');
     $emailList->setRequired();
     $emailList->setDelimiterChars(array(',', ' '));
     $emailList->setInvitation($language->text('contactimporter', 'email_field_inv_message'));
     $emailList->setJsRegexp('/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/');
     $form->addElement($emailList);
     $text = new Textarea('text');
     $text->setValue($language->text('contactimporter', 'email_invite_field_default_text'));
     $text->setHasInvitation(true);
     $form->addElement($text);
     $submit = new Submit('submit');
     $form->addElement($submit);
     $form->setAction(OW::getRouter()->urlFor('CONTACTIMPORTER_CTRL_Email', 'send'));
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $form->bindJsFunction(Form::BIND_SUCCESS, "\n            function(data){                \n                if( data.success ){\n                    OW.info(data.message);\n                    owForms['inite-friends'].resetForm();\n                    window.ciMailFloatBox.close();\n                }\n                else{\n                    OW.error(data.message);\n                }\n              }");
     $this->addForm($form);
 }