Addressing the downloadmanager

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Addressing the downloadmanager

Post by yellowled »

Sometimes I use constructs like this

Code: Select all

{if $view == 'entry'} ... {elseif $view == 'category} ... {/if}
to emit code i.e. in the sidebar depending on the "location" a user is in a blog. There are also possibilities to check whether a user is visiting the contact form or pages created by an event plugin.

What I need now (and can't figure out myself) is a way to detemine whether a user is visiting any page created by the download manager plugin. Any hints?

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Addressing the downloadmanager

Post by garvinhicking »

Hi!

Hm, I think the current logic of the downloadmanager plugin (I hate that one) doesn'T feature a possibility to distinct it.

You could try to change this code:

Code: Select all

                case 'entry_display' :
                    if ($this->selected()) {
                        if (is_array($eventData)) {
                            $eventData['clean_page'] = true;
                        } else {
                            $eventData = array ('clean_page' => true);
                        }
                    }
                    return true;

                    break;
to:

Code: Select all

                case 'entry_display' :
                    if ($this->selected()) {
                        $serendipity['view'] = 'downloadmanager';
                        define('IS_DOWNLOADMANAGER', 'true');
                        if (is_array($eventData)) {
                            $eventData['clean_page'] = true;
                        } else {
                            $eventData = array ('clean_page' => true);
                        }
                    }
                    return true;

                    break;
and later in your smarty code try to either check $view (I believe this won't work with current mechanism) or "{if (defined('IS_DOWNLOADMANAGER'))}...{/if}".

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Addressing the downloadmanager

Post by yellowled »

garvinhicking wrote:I think the current logic of the downloadmanager plugin (I hate that one)
I was gonna say: who doesn't? I have never really used it before, but man, it's a PITA! Emits horrible HTML code, too.
garvinhicking wrote:doesn'T feature a possibility to distinct it
I tested some of the variables used in the .tpl files (which, BTW, are more or less pointless since you can only modifiy the emitted HTML - did I mention it's horrible? - to a certain point), but none of them worked, so I'm pretty sure it doesn't have that.
garvinhicking wrote:You could try to change this code:
Hm, thanks, I'll keep that in mind. However, I'm not really comfortable with hacking a plugin - there's always the matter of backporting the changes in case of a plugin upgrade, which I tend to forget :mrgreen:

Maybe there's another solution in this particular project.

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Addressing the downloadmanager

Post by garvinhicking »

Hi!
Maybe there's another solution in this particular project.
No, there isn't. I was thkning you tell me if the patch worked, and if it did, I'd put it into the official plugin :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Addressing the downloadmanager

Post by yellowled »

garvinhicking wrote:I was thkning you tell me if the patch worked, and if it did, I'd put it into the official plugin :-)
Why didn't you say so? I LOVE being a guinea pig! :)

I'll test it asap and report back.

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Addressing the downloadmanager

Post by yellowled »

Hm, one thing, though:
garvinhicking wrote:and later in your smarty code try to either check $view (I believe this won't work with current mechanism) or "{if (defined('IS_DOWNLOADMANAGER'))}...{/if}".
In my project, it wouldn't suffice just to test whether one is on any page generated by the download manager, I would also need to distinguish between various categories in the download manager. I.e. emit different code if cat A, cat B, cat C, is visited.

Does this code cover that?

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Addressing the downloadmanager

Post by garvinhicking »

Hi!
Does this code cover that?
No, that is even harder to do, and I refuse to dig so much into the plugin *ggg*

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Addressing the downloadmanager

Post by yellowled »

garvinhicking wrote:No, that is even harder to do, and I refuse to dig so much into the plugin *ggg*
Perfectly fine. Maybe we should just throw it away and have someone rewrite it from scratch. *g*

Funny thing, though - all of the .tpl files of the download manager use a variable $pagetitle, which should be unique to each page generated by the dl manager. But I can seem to access that variable from my index.tpl - or can I?

YL
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Addressing the downloadmanager

Post by Don Chambers »

I think Grischa was maintaining that plugin, at least for awhile he was. At the time, he was very receptive to ideas. I once suggested a bunch of HTML improvements to it, but I think that was around the time he got really busy and had little time for s9y development. Maybe you can contact him personally and work out an update to the plugin together?
=Don=
Post Reply