Edit button on photos view page.

in reference with http://www.boonex.com/forums/topic/Title-of-view-photo-page.htm

Here is the steps to add an edit button in the photo view page.

in modules/boonex/photos/templates/classes/BxPhotosPageView.php at line143 add this

 

function isEditAllowed() {

    $iId = getLoggedId();

    $Admin = isAdmin();

    if($this->aFileInfo['medProfId'] == $iId or $Admin) {

    return true;

    }

    return false;

    }

just after getBlockCode_ViewComments function

now come to line 186 and add this

 

'bx_if:edit' => array(

        'condition' => $this->isEditAllowed(),

        'content' => array(

        'id' => $this->aFileInfo['medID'],

        )

),

it will look like this

 

'bx_if:next' => array(

                'condition' => $this->aFileInfo['nextItem'] > 0,

                'content' => array(

                    'linkNext'  => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aNext['medUri'],

                    'titleNext' => $aNext['medTitle'],

                    'percent' => $this->aFileInfo['prevItem'] > 0 ? 50 : 100,

                )

            ),

 'bx_if:edit' => array(

        'condition' => $this->isEditAllowed(),

        'content' => array(

        'id' => $this->aFileInfo['medID'],

        )

),

save the file.

now come to modules/photos/template/base/view_unit.hml at line 17 after this

 

<div class="fileUnitPic" style="width:__width_ext__px;">

            <img src="__pic__" class="fileUnitSpacer"/>__id__

</div>

 

add

 <bx_if:edit>

        <div class="button_wrapper" style="width:100%; center; background-color:#CCFF66 margin: 0;" onclick="window.open('<bx_url_root />m/photos/edit/__id__', '_blank', 'width=500,height=400,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no') ">

    <button class="form_input_submit" type="button">

            <img alt="Edit" src="<bx_icon_url:edit.png />">

            Edit        </button>

    </div>

<div style="width:100%; margin: 0;"><h4 align="center">Site Members, please use the <b>"edit"</b> button above to change the name of your image to what you want..</h4>

        </div>

        </bx_if:edit>

This will show edit button to its photos owner and admins. It will be hidden to other members and guests.

hope it will help you all. enjoy..

so much to do....
Quote · 13 May 2012

Thanks again.

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 13 May 2012

Thank you Prashank!  I put the code back in... plus tweaked it (again) to place the button beside the photo title and removed the "Site Members" statement.  I think having the button next to the title is a strong enough hint that it can be used to revise nondescript titles.  I tested it... appears to work very well... nice work :-)

 

I used this code for the photo title section in the html file... to place the button next to the photo title:

<div class="fileTitle" style="width:__width_ext__px;">

    <bx_if:edit>

        <div class="button_wrapper" style="width:auto; background-image:none; margin: 0 0 2px 0;" onclick="window.open('<bx_url_root />m/photos/edit/__id__', '_blank', 'width=625,height=410,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no') ">

            <button class="form_input_submit" type="button"> <img alt="Edit" src="<bx_icon_url:edit.png />"> Edit </button>

</div>

    </bx_if:edit>                

    __fileTitle__

</div>

 
http://pkforum.dolphinhelp.com
Quote · 13 May 2012

You're welcome.

so much to do....
Quote · 14 May 2012

You can remove the autofill of the title field in the photos adding field

go to inc/classes/BxDolFilesUpload.php at line 558 and comment out this

'value' => $aDefaultValues['title']

it will be

'title' => array(

         'type' => 'text',

         'name' => 'title',

         'caption' => _t('_Title'),

'required' => true,

//'value' => $aDefaultValues['title']

),

same for description if someone need it too. line 572

NOTE: It does it for all modules like photos, videos, sounds.

enjoy :)

so much to do....
Quote · 7 Jul 2012
 
 
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.