Piwigo.org

You are not logged in. (Register / Login)

Announcement

#16 2017-09-30 17:20:32

romanf
Member
Registered: 2017-01-22
Posts: 31

Re: [Menu Random Photo, 2.7.d] ReferenceError: MRP_blockHeight...

Theme: stripped (see mrp-1.png)
Config see mrp-2.png
MRP works... mrp-3.png

:(

-Roman


Uploaded Images

Offline

 

#17 2017-09-30 17:36:44

plg
Piwigo Team
Location: Nantes, France, Europe
Registered: 2002-04-05
Posts: 13072
Website

Re: [Menu Random Photo, 2.7.d] ReferenceError: MRP_blockHeight...

What you show works for me as well. Now go on the page of the photo, not on the page of albums :-) I mean on picture.php


Latest blog post (March 23th 2017) Piwigo.com Enterprise plans, now official!

Offline

 

#18 2017-09-30 18:20:34

romanf
Member
Registered: 2017-01-22
Posts: 31

Re: [Menu Random Photo, 2.7.d] ReferenceError: MRP_blockHeight...

Ah, ok, now I see it.

Let's see if I understand correctly:

1. main.inc.php is included/required because MRP is active

2. In main.inc.php -> MRP_blockmanager_apply() --> template/menu_random_photo.tpl is included (but this also means that a block must be present, correct?)

3. In main.inc.php -> MRP_end_page_header() --> template/menu_random_photo.js.tpl is NOT included --> so MRP_blockHeight will not be defined.

4. menu_random_photo.tpl includes mrp.js --> this references MRP_blockHeight which does not exist.

Is this correct?

If so, then shouldn't the test in MRP_blockmanager_apply() be the same as in MRP_end_page_header() to achieve "include either both or none"?

-Roman

Offline

 

#19 2017-10-01 10:37:29

romanf
Member
Registered: 2017-01-22
Posts: 31

Re: [Menu Random Photo, 2.7.d] ReferenceError: MRP_blockHeight...

Ok, I have put in some protection code at the beginning of mrp.js and created a new release.
For me this works now. Can you confirm? :)

-Roman

Offline

 

#20 2017-10-02 11:09:36

maximebrmd
Member
Registered: 2017-09-21
Posts: 9

Re: [Menu Random Photo, 2.7.d] ReferenceError: MRP_blockHeight...

Hello Romanf,

I don't understand this part of mrp.js :

var randomPict = MRP_Opt['pictures'];
    if (randomPict.length > 1 && $("#mbRandomPhoto").length > 0)
    {
        $('#imrp_ill0 a').attr("href", randomPict[0]['link']);
        $('#imrp_ill0 img').attr("src", randomPict[0]['thumb']);

        var randomPict = MRP_Opt['pictures'];
        if (randomPict.length > 1)
        {
            $('#imrp_ill0 a').attr("href", randomPict[0]['link']);
            $('#imrp_ill0 img').attr("src", randomPict[0]['thumb']);

why your assign randomPict two time with same value? And doing the same condition with randomPict.length ?

- Maxime

Offline

 

#21 2017-10-02 20:55:31

romanf
Member
Registered: 2017-01-22
Posts: 31

Re: [Menu Random Photo, 2.7.d] ReferenceError: MRP_blockHeight...

Aww. Thanks for pointing this out! Was a copy/paste error due to my total laymans'ness with SVN... <blush>

Thanks
Roman

Offline

 

#22 2017-10-05 16:03:05

maximebrmd
Member
Registered: 2017-09-21
Posts: 9

Re: [Menu Random Photo, 2.7.d] ReferenceError: MRP_blockHeight...

Hello romanf,

Thanks you roman !
Their is an other issue in main.inc.php, why are you displaying an error message to all users on the main page, if we have no picture in the gallery ? I think you should display it only if the user is an administrator.

Maxime,


Uploaded Images

Last edited by maximebrmd (2017-10-05 16:54:44)

Offline

 

#23 2017-10-05 18:51:56

romanf
Member
Registered: 2017-01-22
Posts: 31

Re: [Menu Random Photo, 2.7.d] ReferenceError: MRP_blockHeight...

Hi Maxime,

You are right. I'll have to research how to check for that... :-\

-Roman

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2017 · Contact