Page 1 of 1

StaticPage List Sidebar Plugin

Posted: Thu Jun 02, 2005 7:27 pm
by RobA
Rather than manually maintaining a list of articles (created with the new static page plugin) I made this little sidebar plugin that displays the last N (where N is a configuration parameter) static pages as a clickable list in the sidebar.

Some things I noticed developing this were:

1. The timestamp field in the new staticpages table is null. I'm thinking it should get set as the updated date.
2. No category support for static articles.

If the timestamp issues gets fixed, I'll change the plugin. For now it is doing a reverse sort by ID, which is the order they were created. A fix for that would be in the serendipity_db_update function and I haven't chased it down. Could be a bug.

Looks like category support in the staticpage database would require a schema change, and I'm not prepared to hack that in. The plugin is currently non-stackable. If category support were added to static pages, this could be changed so that each instance plugin could display a different category.

A zip of the code can be downloaded from the page here http://ffaat.pointclark.net/blog/pages/staticpahelist.html

If someone wants to bundle this with the staticpage event plugin that would be great...It is a little beyond me at this time, though.

-Rob A>

Re: StaticPage List Sidebar Plugin

Posted: Thu Jun 02, 2005 8:22 pm
by garvinhicking
Hi Rob!

I took the liberty to commit your plugin to the Repository as serendipity_plugin_staticpage. Hope that's fine with you?

About the timestamp and category: I added the DB columns only as some kind of "forward compatibility". No features for that are currently implemented...

Thanks a lot for your contribution, I think it's really a good thing!

Regards,
Garvin

Posted: Fri Jun 03, 2005 4:26 pm
by RobA
Garvin -

My pleasure. I figured this was a better way than manually maintaining a HTML nugget with the links.

I have also roughed together an event plugin that displays ALL of the static headlines in the main body window, so if a user created many static pages then they could all be accessed from that summary page. This is an area where categories would make a big improvement. Code for that one to follow.

I was planning to "link" the two (event and sidebar) together, I believe I say mention of this capability. Can you point me to an example I can copy from?

Also, as this plugin depends on a specific version of another plugin (the newer static page), is there a way to check that the right version is installed, or even install it if it isn't?

Lastly, of the columns, which ARE in use:
id (yes)
articleformattitle (yes)
articleformat (?)
markup (?)
pagetitle (yes)
permalink (yes)
content (yes)
headline (yes)
filename (?)
timestamp (no)
authorid (?)

-Rob A>

Posted: Tue Jun 07, 2005 12:36 pm
by garvinhicking
I have recently submitted a patch by Falk to your plugin. I believe I've already bundled the two staticpage plugins together via "$this->dependencies" in the introspection part.

I agree that yes, categories would be a nice thing to have in the future. The patch from Falk to allow parent id's also goes in this direction.

Sadly there is no easy way to check the version dependencies; the only thing you can assume is that if the queries fail and the table does not exist, the user is using the old version...?

Regarding the comments, articelformat is used to denote the formatting of a staticpage. Markup also, to define whether to apply the BBCode and other transforms. Authorid, Filename and timestamp is not used.

Regards,
Garvin

Upgrade problems...

Posted: Tue Jun 07, 2005 3:26 pm
by RobA
:( Upgrade woes...

I was using the first version of the staticpage plugin that had its own table structure.

I replaced the serendipity_event_staticpage.php , the languages files, and added the new serendipity_plugin_staticpage.php to the serendipity_event_staticpage folder.

I went to the backend static page and can see my old entries, but they don't show up in the sidebar.

Digging more, it looks like the table structure wasn't altered on first load of the staticpage backend (no pass field, and no parent_id field).

While I could just add these in in the phpMyAdmin, I was wondering why it broke and if I did something wrong upgrading this way.

Thanks,

Rob A>

Re: Upgrade problems...

Posted: Tue Jun 07, 2005 3:57 pm
by garvinhicking
The "problem" is that the upgrade is done on frontend view, so you'd first need to visit your blog. I know this is a bit problematic and I'm looking into improving it, but currently have no time to take care of it...

Regards,
Garvin

Posted: Tue Jun 07, 2005 4:43 pm
by RobA
Garvin -
Still not working...

What page do I have to hit to trigger the upgrade?

I have gone to the s9y installation directory as well as the full URL of the old static pages, but it doesn't seem to do anything.

The table structure is not changed (looking in phpMyAdmin) and so the sidebar plugin doesn't work.

Any suggestions or further pointers to help debug? Like I said, I can just run the ALTER copmmands on the database, but would prefer this to work as designed :)

-Rob A>

Posted: Tue Jun 07, 2005 5:54 pm
by garvinhicking
I've just committed 2.3 of the plugin which should fix the problem's you're getting. So tell me tomorrow if it works please :)

Regards,
Garvin

Posted: Wed Jun 08, 2005 5:42 am
by RobA
Looks like that fixed it!

Thanks!

One suggestion to the sidebar plugin....In the original, it used the headline field to provide a more meaningful title to the user.

making the query string:

Code: Select all

$q = "SELECT id, parent_id, permalink, pagetitle, headline FROM{$serendipity['dbPrefix']}staticpages ORDER BY id LIMIT {$limit}";


and the link generation string:

Code: Select all

? sprintf("<a href=\"%s\" title=\"%s\" style=\"padding-left: %dpx;\">%s</a><br />\n", $page['permalink'], htmlspecialchars($page['pagetitle']), $page['depth']*10, htmlspecialchars($page['headline']))


makes it a it better (IMHO :) )

Posted: Wed Jun 08, 2005 10:10 am
by garvinhicking
Thanks, committed! :)

Regards,
Garvin