示例#1
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);
 }
示例#2
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);
 }
示例#3
0
 public function __construct()
 {
     parent::__construct('config-form');
     $lang = OW::getLanguage();
     $months = new TextField('months');
     $months->setRequired(true);
     $months->addValidator(new IntValidator(1, 12));
     $months->setLabel($lang->text('ocsguests', 'store_period'));
     $this->addElement($months);
     $submit = new Submit('save');
     $submit->setLabel($lang->text('ocsguests', 'save'));
     $this->addElement($submit);
 }
示例#4
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");
     }
 }
示例#5
0
 public function __construct()
 {
     parent::__construct('goal-edit-form');
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $lang = OW::getLanguage();
     $id = new HiddenField('projectId');
     $id->setRequired(true);
     $this->addElement($id);
     $name = new TextField('name');
     $name->setRequired(true);
     $name->setLabel($lang->text('ocsfundraising', 'name'));
     $this->addElement($name);
     $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
     $desc = new WysiwygTextarea('description', $btnSet);
     $desc->setRequired(true);
     $sValidator = new StringValidator(1, 50000);
     $desc->addValidator($sValidator);
     $desc->setLabel($lang->text('ocsfundraising', 'description'));
     $this->addElement($desc);
     $category = new Selectbox('category');
     $category->setLabel($lang->text('ocsfundraising', 'category'));
     $list = OCSFUNDRAISING_BOL_Service::getInstance()->getCategoryList();
     if ($list) {
         foreach ($list as $cat) {
             $category->addOption($cat->id, $lang->text('ocsfundraising', 'category_' . $cat->id));
         }
     }
     $this->addElement($category);
     $target = new TextField('target');
     $target->setRequired(true);
     $target->setLabel($lang->text('ocsfundraising', 'target_amount'));
     $this->addElement($target);
     $min = new TextField('min');
     $min->setLabel($lang->text('ocsfundraising', 'min_amount'));
     $min->setValue(1);
     $this->addElement($min);
     $end = new DateField('end');
     $end->setMinYear(date('Y'));
     $end->setMaxYear(date('Y') + 2);
     $end->setLabel($lang->text('ocsfundraising', 'end_date'));
     $this->addElement($end);
     $imageField = new FileField('image');
     $imageField->setLabel($lang->text('ocsfundraising', 'image_label'));
     $this->addElement($imageField);
     $submit = new Submit('edit');
     $submit->setLabel($lang->text('ocsfundraising', 'edit'));
     $this->addElement($submit);
 }
 /**
  * @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);
 }
示例#7
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);
    }
示例#8
0
 public function __construct($templateId, $users)
 {
     parent::__construct('confirm-gift-form');
     $lang = OW::getLanguage();
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('VIRTUALGIFTS_CTRL_Gifts', 'ajaxSendGifts'));
     $tplId = new HiddenField('tplId');
     $tplId->setRequired(true);
     $tplId->setValue($templateId);
     $this->addElement($tplId);
     $message = new Textarea('message');
     $this->addElement($message);
     $userIdList = new HiddenField('userIdList');
     $userIdList->setValue($users);
     $this->addElement($userIdList);
     $isPrivate = new CheckboxField('isPrivate');
     $isPrivate->setLabel($lang->text('virtualgifts', 'send_private'));
     $this->addElement($isPrivate);
     $submit = new Submit('send');
     $submit->setLabel($lang->text('virtualgifts', 'btn_send'));
     $this->addElement($submit);
     $js = 'owForms["' . $this->getName() . '"].bind("success", function(data){
         if ( data.error != undefined ){
             OW.error(data.error);
         }
         if ( data.message != undefined ){
             OW.info(data.message);
         }
         giftConfirmFloatBox.close()
     });';
     OW::getDocument()->addOnloadScript($js);
 }