Exemple #1
0
 public function __construct()
 {
     parent::__construct('upload-form');
     $language = OW::getLanguage();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $fileField = new FileField('photo');
     //$fileField->setRequired(true);
     $this->addElement($fileField);
     // album Field
     $albumField = new TextField('album');
     $albumField->setRequired(true);
     $albumField->setHasInvitation(true);
     $albumField->setId('album_input');
     $albumField->setInvitation($language->text('photo', 'create_album'));
     $this->addElement($albumField);
     // description Field
     $descField = new Textarea('description');
     $descField->setHasInvitation(true);
     $descField->setInvitation($language->text('photo', 'describe_photo'));
     $this->addElement($descField);
     $cancel = new Submit('cancel', false);
     $cancel->setValue($language->text('base', 'cancel_button'));
     $this->addElement($cancel);
     $submit = new Submit('submit', false);
     $this->addElement($submit);
 }
Exemple #2
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);
 }
 public function __construct()
 {
     parent::__construct('questions_add');
     $language = OW::getLanguage();
     $this->setAjax();
     $this->setAjaxResetOnSuccess(false);
     $field = new Textarea('question');
     $field->addAttribute('maxlength', 500);
     $field->setRequired();
     $field->setHasInvitation(true);
     $field->setInvitation($language->text('questions', 'question_add_text_inv'));
     $field->addAttribute("inv", $language->text('questions', 'question_add_text_inv'));
     $this->addElement($field);
     $field = new CheckboxField('allowAddOprions');
     $field->addAttribute('checked');
     $field->setLabel($language->text('questions', 'question_add_allow_add_opt'));
     $this->addElement($field);
     $field = new QUESTIONS_OptionsField('answers');
     $field->setHasInvitation(true);
     $field->setInvitation($language->text('questions', 'question_add_option_inv'));
     $this->addElement($field);
     $submit = new Submit('save');
     $submit->setValue($language->text('questions', 'question_add_save'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_empty');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_min_length');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_max_length');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_two_apt_required');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_dublicate_option');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_option_max_length');
         $this->initJsResponder();
     }
     $this->setAction(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('QUESTIONS_CTRL_List', 'addQuestion')));
 }
Exemple #4
0
 public function __construct()
 {
     parent::__construct('add-album');
     $this->setAjax();
     $this->setAjaxResetOnSuccess(FALSE);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'));
     $ajaxFunc = new HiddenField('ajaxFunc');
     $ajaxFunc->setValue('ajaxMoveToAlbum');
     $ajaxFunc->setRequired();
     $this->addElement($ajaxFunc);
     $fromAlbum = new HiddenField('from-album');
     $fromAlbum->setRequired();
     $fromAlbum->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($fromAlbum);
     $toAlbum = new HiddenField('to-album');
     $this->addElement($toAlbum);
     $photos = new HiddenField('photos');
     $photos->setRequired();
     $this->albumPhotosValidator = new AlbumPhotosValidator();
     $photos->addValidator($this->albumPhotosValidator);
     $this->addElement($photos);
     $albumName = new TextField('album-name');
     $albumName->setRequired();
     $albumName->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE));
     $albumName->setHasInvitation(TRUE);
     $albumName->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
     $albumName->addAttribute('class', 'ow_smallmargin');
     $this->addElement($albumName);
     $desc = new Textarea('desc');
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($desc);
     $this->addElement(new Submit('add'));
 }
 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);
 }
Exemple #6
0
 public function __construct($feedAutoId, $feedType, $feedId, $actionVisibility = null)
 {
     parent::__construct('newsfeed_update_status');
     $this->setEnctype(FORM::ENCTYPE_MULTYPART_FORMDATA);
     $field = new Textarea('status');
     $field->setHasInvitation(true);
     $field->setInvitation(OW::getLanguage()->text('newsfeed', 'status_field_invintation'));
     $this->addElement($field);
     $field = new HiddenField('attachment');
     $this->addElement($field);
     $field = new HiddenField('feedType');
     $field->setValue($feedType);
     $this->addElement($field);
     $field = new HiddenField('feedId');
     $field->setValue($feedId);
     $this->addElement($field);
     $field = new HiddenField('feedAutoId');
     $field->setValue($feedAutoId);
     $this->addElement($field);
     $field = new HiddenField('visibility');
     $field->setValue($actionVisibility);
     $this->addElement($field);
     $submit = new Submit('save');
     $submit->setValue(OW::getLanguage()->text('newsfeed', 'status_btn_label'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $js = UTIL_JsGenerator::composeJsString('
         owForms["newsfeed_update_status"].bind( "submit", function( r )
         {
             $("#newsfeed_status_save_btn_c").addClass("owm_preloader_circle");
         });');
         OW::getDocument()->addOnloadScript($js);
     }
     $this->setAction(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('NEWSFEED_MCTRL_Feed', 'statusUpdate')));
 }
 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);
     }
 }
Exemple #8
0
 public function __construct($albumId)
 {
     parent::__construct(self::FORM_NAME);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
     $this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
     $this->setAjax(true);
     $this->setAjaxResetOnSuccess(false);
     $albumIdField = new HiddenField(self::ELEMENT_ALBUM_ID);
     $albumIdField->setValue($album->id);
     $albumIdField->setRequired();
     $albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($albumIdField);
     $albumNameField = new TextField(self::ELEMENT_ALBUM_NAME);
     $albumNameField->setValue($album->name);
     $albumNameField->setRequired();
     if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
         $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(true, null, $album->name));
     }
     $albumNameField->addAttribute('class', 'ow_photo_album_name_input');
     $this->addElement($albumNameField);
     $desc = new Textarea(self::ELEMENT_DESC);
     $desc->setValue(!empty($album->description) ? $album->description : NULL);
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
     $desc->addAttribute('class', 'ow_photo_album_description_textarea');
     $this->addElement($desc);
     $this->triggerReady(array('albumId' => $albumId));
 }
Exemple #9
0
 public function __construct($photoId = NULL)
 {
     parent::__construct('photo-edit-form');
     $this->setAjax(TRUE);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
     $this->bindJsFunction('success', 'function( data )
         {
             OW.trigger("photo.afterPhotoEdit", data);
         }');
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
     $photoIdField = new HiddenField('photoId');
     $photoIdField->setRequired(TRUE);
     $photoIdField->setValue($photo->id);
     $photoIdField->addValidator(new PHOTO_CLASS_PhotoOwnerValidator());
     $this->addElement($photoIdField);
     $albumField = new TextField('album');
     $albumField->setId('ajax-upload-album');
     $albumField->setRequired();
     $albumField->setValue($album->name);
     $albumField->setLabel(OW::getLanguage()->text('photo', 'create_album'));
     $albumField->addAttribute('class', 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
     $albumField->addAttribute('autocomplete', 'off');
     $albumField->addAttribute('readonly');
     $this->addElement($albumField);
     $albumNameField = new TextField('album-name');
     $albumNameField->setRequired();
     $albumNameField->setValue($album->name);
     $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE, NULL, $album->name));
     $albumNameField->setHasInvitation(TRUE);
     $albumNameField->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
     $albumNameField->addAttribute('class', 'ow_smallmargin invitation');
     $this->addElement($albumNameField);
     $desc = new Textarea('description');
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($desc);
     $photoDesc = new PHOTO_CLASS_HashtagFormElement('photo-desc');
     $photoDesc->setValue($photo->description);
     $photoDesc->setLabel(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($photoDesc);
     $submit = new Submit('edit');
     $submit->setValue(OW::getLanguage()->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
    public function __construct($feedAutoId, $feedType, $feedId, $actionVisibility = null)
    {
        parent::__construct('newsfeed_update_status');
        $this->setAjax();
        $this->setAjaxResetOnSuccess(false);
        $field = new Textarea('status');
        $field->setHasInvitation(true);
        $field->setInvitation(OW::getLanguage()->text('newsfeed', 'status_field_invintation'));
        $this->addElement($field);
        $field = new HiddenField('attachment');
        $this->addElement($field);
        $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);
        $submit = new Submit('save');
        $submit->setValue(OW::getLanguage()->text('newsfeed', 'status_btn_label'));
        $this->addElement($submit);
        if (!OW::getRequest()->isAjax()) {
            $js = UTIL_JsGenerator::composeJsString('
            owForms["newsfeed_update_status"].bind( "submit", function( r )
            {
                $(".newsfeed-status-preloader", "#" + {$autoId}).show();
            });

            owForms["newsfeed_update_status"].bind( "success", function( r )
            {
                $(this.status).val("");
                $(".newsfeed-status-preloader", "#" + {$autoId}).hide();

                if ( r.error ) {
                    OW.error(r.error); return;
                }
                
                if ( r.message ) {
                    OW.info(r.message);
                }

                if ( r.item )
                {
                    window.ow_newsfeed_feed_list[{$autoId}].loadNewItem(r.item, false);
                }
            });', array('autoId' => $feedAutoId));
            OW::getDocument()->addOnloadScript($js);
        }
        $this->setAction(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('NEWSFEED_CTRL_Ajax', 'statusUpdate')));
    }
Exemple #11
0
 public function __construct($widgetUniqName = null, $content = null)
 {
     parent::__construct('about_me_form');
     $this->widgetUniqName = $widgetUniqName;
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('BASE_CTRL_ComponentPanel', 'ajaxSaveAboutMe'));
     $input = new Textarea('about_me');
     $input->addAttribute('style', 'width: 93%');
     $input->setId('about_me_widget_input');
     $input->setHasInvitation(true);
     $input->setInvitation(OW::getLanguage()->text('base', 'about_me_widget_inv_text'));
     //$input->setRequired(true);
     $input->setValue($content);
     $this->addElement($input);
     $hidden = new HiddenField('widget_uniq_name');
     $hidden->setValue($widgetUniqName);
     $this->addElement($hidden);
     $submit = new Submit('save');
     //$submit->setLabel(OW::getLanguage()->text('base', 'widget_about_me_save_btn'));
     $this->addElement($submit);
     OW::getDocument()->addOnloadScript('
        window.owForms["about_me_form"].bind("success", function(data){
             OW.info(data.message);
        });
        window.owForms["about_me_form"].reset = false;
     ');
 }
    public function __construct()
    {
        parent::__construct(self::FORM_NAME);
        $language = OW::getLanguage();
        $this->setAjax();
        $this->setAjaxResetOnSuccess(false);
        $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_AjaxUpload', 'checkFakeAlbumData'));
        $this->bindJsFunction(self::BIND_SUCCESS, UTIL_JsGenerator::composeJsString('function( data )
        {
            if ( !data.result )
            {
                var form = owForms[this.name];

                Object.keys(data.errors).forEach(function( item )
                {
                    var arr = data.errors[item];

                    if ( arr.length !== 0 )
                    {
                        form.getElement(item).showError(arr.shift());
                    }
                });

                return;
            }

            if ( OW.getActiveFloatBox() ) OW.getActiveFloatBox().close();

            var formData = data.data;
            var params = {
                albumId: 0,
                albumName: formData[{$album_name}],
                albumDescription: formData[{$album_desc}],
                url: "",
                data: formData
            };
            var ajaxUploadPhotoFB = OW.ajaxFloatBox("PHOTO_CMP_AjaxUpload", params, {
                title: {$title},
                width: "746px",
                onLoad: function()
                {
                    OW.trigger("photo.ready_fake_album", [formData]);
                }
            });

            ajaxUploadPhotoFB.bind("close", function()
            {
                if ( ajaxPhotoUploader.isHasData() )
                {
                    if ( confirm({$confirm}) )
                    {
                        OW.trigger("photo.onCloseUploaderFloatBox");

                        return true;
                    }

                    return false;
                }
                else
                {
                    OW.trigger("photo.onCloseUploaderFloatBox");
                }
            });
        }', array('album_name' => self::ELEMENT_ALBUM_NAME, 'album_desc' => self::ELEMENT_ALBUM_DESC, 'title' => $language->text('photo', 'upload_photos'), 'confirm' => $language->text('photo', 'close_alert'))));
        $albumNameInput = new TextField(self::ELEMENT_ALBUM_NAME);
        $albumNameInput->setRequired();
        $albumNameInput->addValidator(new PHOTO_CLASS_AlbumNameValidator(false));
        $albumNameInput->setHasInvitation(true);
        $albumNameInput->setInvitation($language->text('photo', 'album_name'));
        $this->addElement($albumNameInput);
        $albumDescInput = new Textarea(self::ELEMENT_ALBUM_DESC);
        $albumDescInput->setHasInvitation(true);
        $albumDescInput->setInvitation($language->text('photo', 'album_desc'));
        $this->addElement($albumDescInput);
        $submit = new Submit(self::SUBMIT_SUBMIT);
        $submit->setValue($language->text('photo', 'add_photos'));
        $this->addElement($submit);
        $this->triggerReady();
    }