Add a photo instead of video comment

Has anyone changed the comments to add a photo instead of a video comment or video reply?

I want the photo to be "attached" to the user, so if they are deleted so is the photo.

instead of using a tinymce mce plugin, I just want a link that says PHOTO. 

Thanks!

http://www.mytikibar.com
Quote · 24 Nov 2014

Nobody has any ideas on this?

http://www.mytikibar.com
Quote · 26 Nov 2014

What's wrong with adding photos via TinyMCE text comments?

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 26 Nov 2014

It's not tied to a user, so if that uses is deleted, all those photos are left on the server.

I would prefer the photo be added and linked to a comments album in the users account.

Plus, an add photo option would allow the user to upload from their device rather than embed a photo from a different site.

These people are getting lazier by the minute!  LOL

http://www.mytikibar.com
Quote · 27 Nov 2014

Well, I managed to get this far, but, the continue button does not work.

No errors in my console, so I have no idea from here.

It was relatively easy to get this far tho.

Just a few coding changes.

addphoto.png · 55.7K · 271 views
http://www.mytikibar.com
Quote · 27 Nov 2014

Great Idea...

Csampson
Quote · 27 Nov 2014

I wish someone with more experience with the code could whip this one up real quick!

Either post it here, or make a mod, either way, it will be a great addition.

I LOVE the groups wall mod.  I just want to be able to add photo comments to what's posted on the wall.

It will bring me UP to the level of several other sites out there that have this ability.

http://www.mytikibar.com
Quote · 29 Nov 2014

For my site the user has the image/file manager to let them add images in comments so I did not need the add photo.  If I understand correctly, the images have to be stored in an album connected to the user so that when the user is deleted the images are deleted, is this correct.  The album; however, should not show up in the users albums since this album is only for inserting a photo into a comment.

First step is to list all of the parameters for the "Add Photo" so we can understand how this mod should work.

Geeks, making the world a better place
Quote · 29 Nov 2014

Well, this is what I have so far

 

/templates/base/scripts/BxBaseCmtsView.php

 

  function _getPostReplyBox($sType = 'comment', $iCmtParentId = 0) {       

//           $sSwitcher  = '<a class="cmt-post-reply-text inactive" href="javascript:void(0)" onclick="javascript:' . $this->_sJsObjName . '.toggleType(this)">' . _t('_Add Your Comment') . '</a><a class="cmt-post-reply-video" href="javascript:void(0)" onclick="javascript:' . $this->_sJsObjName . '.toggleType(this)">' . _t('_Record Your Comment') . '</a>';
        if($sType == 'comment')
            $sSwitcher = '<a class="cmt-post-reply-text inactive" href="javascript:void(0)" onclick="javascript:' .
            $this->_sJsObjName . '.toggleType(this)">' .
            _t('_Add Your Comment') .
            '</a><a class="cmt-post-reply-photo" href="javascript:void(0)" onclick="javascript:' .
            $this->_sJsObjName .
            '.toggleType(this)">' .
            _t('_bx_photos_add') . '</a>';
        else if($sType == 'reply')
            $sSwitcher = '<a class="cmt-post-reply-text inactive" href="javascript:void(0)" onclick="javascript:' .
            $this->_sJsObjName .
            '.toggleType(this)">' .
            _t('_Reply as text') .
            '</a><a class="cmt-post-reply-photo" href="javascript:void(0)" onclick="javascript:' .
            $this->_sJsObjName .
            '.toggleType(this)">' .
            _t('_bx_photos_add') . '</a>';   

 

    function _getFormBox($iCmtParentId = 0, $sText = "", $sFunction = "submitComment(this)",$bEditWall=0) {
      
          
            $sTinyStyle = ($this->iGlobAllowHtml == 1 && $this->iGlobUseTinyMCE == 1) ? ' tinypossible="true" ' : '';
###
#SteveSoft
#03-04-2013

       $sHelpImage       = getTemplateIcon('info.gif');
     
         $sStuff = '
                <form name="cmt-post-reply" onsubmit="' . $this->_sJsObjName . '.' . $sFunction . '; return false;">
                    <input type="hidden" name="CmtParent" value="' . $iCmtParentId . '" />
                    <input type="hidden" name="CmtType" value="text" />
                    <div class="cmt-post-reply-text">
                        <textarea name="CmtText" ' . $sTinyStyle . ' >' . $sText . '</textarea>
                    </div>';

// <div class="cmt-post-reply-video">' . getApplicationContent('video_comments', 'recorder', array('user' => $this->_getAuthorId(), 'password' => $this->_getAuthorPassword(), 'extra' => implode('_', array($this->_sSystem . '-' . $this->getId(), $iCmtParentId))), true) . '</div>
//$sStuff .=  '<div class="cmt-post-reply-video">' . getApplicationContent('video_comments', 'recorder', array('user' => $this->_getAuthorId(), 'password' => $this->_getAuthorPassword(), 'extra' => implode('_', array($this->_sSystem . '-' . $this->getId(), $iCmtParentId))), true) . '</div>';

$sPhotoUploader= BxDolService::call('photos', 'get_uploader_form', array(array('amode' => 'ajax', 'mode' => 'single', 'category' => 'comments', 'album'=>_t('_comments', getNickName($this->_iOwnerId)), 'from_wall' => 0, 'owner_id' => $this->_iOwnerId)), 'Uploader');

$sStuff .= '<div class="cmt-post-reply-photo">' .$sPhotoUploader. '</div>';



$sStuff .='
                    <div class="cmt-post-reply-post"><input type="submit" value="' . _t('_Submit Comment') . '" /></div>
                    ' . $sMood . '
               
                  </div> </div></form>';
                   
return $sStuff;
                   
    }

 

I know I will have to do some work in /inc/js/classes/BxDolCmts.js

in this function...

// submit comment and show it after posting
BxDolCmts.prototype.submitComment = function (f)
{   

once I get it to be able to add the photo!

 

THIS triggers the photo uploader function, it will assign it to an album of the person making the comment with the name "comment".

$sPhotoUploader= BxDolService::call('photos', 'get_uploader_form', array(array('amode' => 'ajax', 'mode' => 'single', 'category' => 'comments', 'album'=>_t('_comments', getNickName($this->_iOwnerId)), 'from_wall' => 0, 'owner_id' => $this->_iOwnerId)), 'Uploader');

When you click Add Photo, it loads the photo uploader, but then, nothing works after selecting the photo.  I don't see an error in my console, and even if I click the submit button, it doesn't work.

I'm stuck at this point.

Ignore the 'from_wall" parameter.  I use that when uploading to the wall so you cannot select a category when uploading photos to the wall.

THIS function works when posting a photo to the wall BTW....

echo BxDolService::call('photos', 'get_uploader_form', array(array('amode' => 'ajax', 'mode' => $_REQUEST['type'], 'category' => 'Wall', 'album'=>_t('_wall_photo_album', getNickName($_REQUEST['owner'])), 'from_wall' => 1, 'owner_id' => $_REQUEST['owner'])), 'Uploader');

I use this to choose what uploader to send a photo to the wall.

http://www.mytikibar.com
Quote · 29 Nov 2014

I also had to edit in BxDolCmts.js this function

 

BxDolCmts.prototype.toggleType = function(oLink) {
    var aSwitcher = {'cmt-post-reply-text': 'cmt-post-reply-photo', 'cmt-post-reply-photo': 'cmt-post-reply-text'};
    var sKey = $(oLink).hasClass('cmt-post-reply-text') ? 'cmt-post-reply-text' : 'cmt-post-reply-photo';
   
    if($(oLink).parents('.cmt-balloon').find('div.' + sKey).is(':hidden')) {
        $(oLink).addClass('inactive').parents('.cmt-balloon').find('div.' + aSwitcher[sKey]).bxdolcmtanim('hide', this._sAnimationEffect, this._iAnimationSpeed, function(){
            var sType = sKey.substring(sKey.lastIndexOf('-') + 1, sKey.length);
           
            $(oLink).siblings(':visible.inactive').removeClass('inactive');           
            $(this).siblings('[name = CmtType]').val(sType);
            $(this).siblings('div.' + sKey).bxdolcmtanim('show', this._sAnimationEffect, this._iAnimationSpeed);
            if(sType == 'photo')
                $(this).siblings('.cmt-post-reply-post').children(':submit').attr('disabled', 'disabled');
            else
                $(this).siblings('.cmt-post-reply-post').children(':submit').removeAttr('disabled');
        });   
    }
};

http://www.mytikibar.com
Quote · 30 Nov 2014

You will need to change the join creation so that it creates the "comment" album when the person joins; otherwise you have a mysql error when it tries to find the album in the database for the user when they go to leave a photo comment.  Also, the person would be able to delete objects in their "comment" album so photo comments could disappear if they delete the objects or even if for some reason they decide to delete the "comment" album.  Of course you could change the code so that the "comment" album is not displayed in their list of photo albums; this would prevent them from accessing the album.

 

My previous post was to do similar as what parameters we need to be thinking about for this to work.  The planning stage should never be skipped.

Geeks, making the world a better place
Quote · 30 Nov 2014

Well, yeah, the album can be hidden from the user pretty easy, and making a default comments album isn't a problem.  My users get 3 default albums anyway.

The issue is with the default boonex photo uploader, the submit button is disabled until the checkbox that says "I have the right to distribute..." is checked.  the problem with that is, the jquery does NOT enable the CONTINUE button when used in the comments section.

So... I am guessing a custom service will have to be created in the BxPhotos module to accommodate this.

http://www.mytikibar.com
Quote · 30 Nov 2014

in the file /modules/boonex/photos/js/upload.js

This little jewel is causing my grief!

BxPhotoUpload.prototype.changeContinueButtonStatus = function () {

    switch(this.getType()) {
        case 'upload':
            var sFileVal = $('#photo_upload_form .photo_upload_form_wrapper .form_input_file').val();
            var sAgreeVal = $('#photo_upload_form #photo_upload_form_input_agree').attr('checked');
            var sAcceptedFilesBlockVal = $('#accepted_files_block').text();
            shPhotoEnableSubmit(sFileVal != null && sFileVal != '' && sAgreeVal == true && sAcceptedFilesBlockVal == '');

            bPossibleToReload = true;
            break;
           
        case 'embed':
            this.checkEmbed();

            bPossibleToReload = true;
            break;
       
        case 'record':
            shPhotoEnableSubmit(bPhotoRecorded && $('#accepted_files_block').text() == "");

            bPossibleToReload = true;
            break;
           
        default:
            break;
    }
}

The case 'upload' is enabling the WRONG continue button!

http://www.mytikibar.com
Quote · 30 Nov 2014

After further investigation, it looks like the photo uploader WILL need a custom upload form, as I moved the service call outside this form and the text comments now work, however, it does not allow a photo upload at this point.

Any help would be appreciated!

http://www.mytikibar.com
Quote · 1 Dec 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.