Adding multibox to lightbox plugin?

Creating and modifying plugins.
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post by ormus7577 »

lordcoffee: You are right... Fixed the slash, now the regexp problem is next on the list. Please try the shadowbox a little, testing never hurts ;)
judebert wrote:At last, someone who can work with the boxes. I've wanted to add that gallery option for a while. At the very least the plugin shouldn't upset the gallery links I've already inserted in my images.

Any chance you can extend the gallery option to the other *boxes? After you finish lordcoffee's issue, of course.
Not all boxes allow the gallery thing I think. I'll have a look (let's hope the markup is not too complicated). Not upsetting the already inserted links: Well, you could disable the Lightbox markup for those entries if you already set it anyway ;) Other than that it depends on the *box variation, some use rel, other class attributes. Any link where I can have a look at your gallery?
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post by ormus7577 »

lordcoffee wrote:O.K. figured it out:

I have changed shadowbox.js on line 78 to:

Code: Select all

        loadingImage:       'plugins/serendipity_event_lightbox/shadowbox/images/loading.gif',
and on line 101 to:

Code: Select all

        flvPlayer:          'plugins/serendipity_event_lightbox/shadowbox/flvplayer.swf',
It was only the missing paths. ;-) Now the Player works fine and the loading image is also shown.
I suggest not to edit shadowbox.js. You can set those paths in the plugin settings of s9y (that's exactly the reason I've added the field):

Code: Select all

{
flvPlayer:          'plugins/serendipity_event_lightbox/shadowbox/flvplayer.swf',
loadingImage:'plugins/serendipity_event_lightbox/shadowbox/images/loading.gif'
}
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Post by lordcoffee »

ormus7577 wrote: I suggest not to edit shadowbox.js. You can set those paths in the plugin settings of s9y (that's exactly the reason I've added the field):
OK, that makes sense. Woudlnt it be good set this value

Code: Select all

{
flvPlayer:'plugins/serendipity_event_lightbox/shadowbox/flvplayer.swf',
loadingImage:'plugins/serendipity_event_lightbox/shadowbox/images/loading.gif'
}
as a standard preset value. Because it might be useful for no advanced users.
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post by ormus7577 »

That's a good idea. Done.
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Post by lordcoffee »

Wow, we are fast today ;-) On more prob:

It doesn't seem to work on static pages:

Code: Select all

Warning: preg_replace() [function.preg-replace]: Empty regular expression in /var/www/blablablubb/html/weblog/plugins/serendipity_event_lightbox/serendipity_event_lightbox.php on line 274
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post by ormus7577 »

Ah, that's the same error I get for the comment sidebar plugin. It's because of the .flv link replace, but I have no idea why (yet). Me and Mr Reg Exp, we don't get along so well... :?

Deactivating video links should remove the error, right?
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

I'd like the plugin to automatically detect the images on a single page as a gallery here, and I manually set up the images as a gallery (using lightbox[name] for Lightbox Plus) here, only to have them overwritten by the plugin.

I'm a regexp guy. Long-time vi and *nix user. I've downloaded your mods and I'm checking it out now.
Judebert
---
Website | Wishlist | PayPal
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Post by lordcoffee »

You're right, deactivating video links removes the error.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

The error indicates the $regexVideo is empty.

This can only happen if it doesn't get set.

That can only happen (from the context of line 165) is $regex is not null, or the type is not 'shadowbox'.

Considering that $regex is static, it gets set on any call to a registered event_hook. By the time we get around to executing 'frontend_display' (where the error occurs), we've already executed 'frontend_header'.

$regex and $regexVideo get set on that first call. $regex stays set, because it's static; $regexVideo is discarded, because it's not.

I think if you set $regexVideo every time, or make it static, you'll avoid that error.

Incidentally, the regexp is well-crafted. There may be some interaction between PHP escaping and regexp escaping at the "\.", though. I'll check into that for you.
Judebert
---
Website | Wishlist | PayPal
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Nope, the regexp is good. (I was worried that the "\." might escape to a plain ".", but that's not the way single-quotes work in PHP.)

Carry on!
Judebert
---
Website | Wishlist | PayPal
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post by ormus7577 »

Back again... I've updated all *boxes to their current version today and added the gallery linking functionality to all *boxes that support it. I've tested all *boxes on my local install and they work fine (which surprised me). Greybox has a display error on my local setup in gallery mode. I'll test all of them again on my online install later tonight. The static page error/sidebar error should be fixed as well, thanks to judeberts hints.

As for the detection part, judebert: do you think regexp can help us here? We would have to check for already existing rel/class attributes of links. Thickboxs uses the class attribute, so we would have to set a second class anyway (beside serendipity_image_link). Easiest solution I can think of: turn of javascript load optimization of the plugin and deactivate Lightbox markup for the entry you've already edited. That way all future entries can use the automatic link feature, while your 'manual' entry stays untouched...

Oh, judebert, I see you use shadowbox already... You should set the Init field to point to the correct location of the loading image, it's missing (pick the settings you need, more are explained in the shadowbox javascript...):

Code: Select all

{
flvPlayer:'/serendipity/plugins/serendipity_event_lightbox/shadowbox/flvplayer.swf',
loadingImage:'/serendipity/plugins/serendipity_event_lightbox/shadowbox/images/loading.gif',
counterType:        'skip',
continuous: true
}
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Awesome work, Ormus! I think you may have dragged this from "broken, partly-functional crud" to "desirable working plugin".

Incidentally, I originally couldn't run Shadowbox at all. Thanks to LordCoffee's hint, I discovered that the problem was my path: it needed the slash on the end. As soon as I added it, three box types that didn't work before started working.
ormus7577 wrote:As for the detection part, judebert: do you think regexp can help us here? We would have to check for already existing rel/class attributes of links. Thickboxs uses the class attribute, so we would have to set a second class anyway (beside serendipity_image_link).
Yes, it does get complicated, requiring lookbacks, alternative branches, and negations. I wouldn't want to come up with a regex for that. (Or multiple passes to mark and unmark stuff.)

However, we might be able to solve the problem with preg_replace_callback. The callback function could use class variables to determine what to look for, and in what attribute. We could roll the check-for-replacement stuff in there too, eliminating the 5.1 version check. I'm just worried about performance. After you get everything working, maybe I'll look into that.
ormus7577 wrote:Easiest solution I can think of: turn of javascript load optimization of the plugin and deactivate Lightbox markup for the entry you've already edited. That way all future entries can use the automatic link feature, while your 'manual' entry stays untouched...
Yes, I figure that will work, too. I just hate entry-specific stuff. It feels like cheating. But if the only other option is to hurt everybody, I'll turn off Lightbox markup for that entry.
ormus7577 wrote:Oh, judebert, I see you use shadowbox already... You should set the Init field to point to the correct location of the loading image, it's missing (pick the settings you need, more are explained in the shadowbox javascript...):
I'll look into that. My problem at the moment is that everything is getting 'rel="lightbox"' attached to it. I added some debugging and found that $type, $regex, and $sub are correctly set. I turned off caching. I eventually got so frustrated that I started pulling out my hair, so I stopped. (You never know if that stuff is going to grow back.) "It works, that's good enough."
Judebert
---
Website | Wishlist | PayPal
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post by ormus7577 »

judebert wrote:Awesome work, Ormus! I think you may have dragged this from "broken, partly-functional crud" to "desirable working plugin".
I'm not done yet. Still having to check a few things (not necessarily in the lightbox plugin, but somewhat related):
* any easy way to have descriptions without switching to code view?
* create an entry from just a media gallery folder - media blogging without much work, that's what I need. My wife is asking me to add pictures all the time and that would save so much work...
judebert wrote: Incidentally, I originally couldn't run Shadowbox at all. Thanks to LordCoffee's hint, I discovered that the problem was my path: it needed the slash on the end. As soon as I added it, three box types that didn't work before started working.
I've reworked it, so that every *box works with the same plugin path setting. Now you can just try all the boxes without touching a setting...
judebert wrote:Yes, it does get complicated, requiring lookbacks, alternative branches, and negations. I wouldn't want to come up with a regex for that. (Or multiple passes to mark and unmark stuff.)

However, we might be able to solve the problem with preg_replace_callback. The callback function could use class variables to determine what to look for, and in what attribute. We could roll the check-for-replacement stuff in there too, eliminating the 5.1 version check. I'm just worried about performance. After you get everything working, maybe I'll look into that.
That is too hard for me, glad you volunteer ;) Thickbox creates a second class attribute (that's bad for html validation i think), all boxes might create a second class attribute. Not sure how to manage the rel thing.
judebert wrote:My problem at the moment is that everything is getting 'rel="lightbox"' attached to it. I added some debugging and found that $type, $regex, and $sub are correctly set. I turned off caching. I eventually got so frustrated that I started pulling out my hair, so I stopped. (You never know if that stuff is going to grow back.) "It works, that's good enough."
Everything as in every link? Haven't had a look at my created entry source yet, the regexp implied only image links should be touched... I'll check the source tonight.
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

No, not every link, just every image link. I was expecting rel="shadowbox[gallery_id]", what I got was rel="lightbox".

I also discovered that my frontend_display hook wasn't getting called unless there were comments on the page. I don't know why that happened, either. But I don't think any of it is the plugin's fault, especially not after my debugging output showed all variables as expected.

Updated zip available?
Judebert
---
Website | Wishlist | PayPal
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post by ormus7577 »

updated zip:

http://tmp.loben.net/serendipity_event_lightbox.zip

Please keep your previous folder, the plugin is only tested at my local sandbox... But I sure don't mind someone testing all *boxes on different installations.
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
Post Reply