FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

plugin preferences limit...

 
Post new topic   Reply to topic    PyLucid - CMS - Forum Forum Index -> system
View previous topic :: View next topic  
Author Message
jens
Administrator


Joined: 12 Oct 2005
Posts: 972
Location: duisburg, germany

PostPosted: Thu 26 Jun, 2008 17:10    Post subject: plugin preferences limit... Reply with quote

I found a ugly limit in the plugin preferences:

I started to implement a simple file/picture gallery plugin. For these types of plugins it's boring that there exist only one preferences "group"...

A user can only have _one_ gallerie for his page.

If we have somethings like "multiple" preferences, a user can create more than one galleries with different settings.

I think it's only a small step to implement this. We must break up the plugin table and split the preferences via foreign key.

The existing Preferences Form in the plugin config file is only for the default values. These values copied into a new instance.

e.g.:

1. The Admin changed some values in the default Gallery preferences.

2. The Admin created a new gallary named "FirstGallery". He can insert the gallery with: {% lucidTag gallery name="FirstGallery" %}

3. PyLucid create a new, individual Preferences entry for this FirstGallery and used all values from the default Gallery preferences.

4. Creating a new Gallery e.g. "SecondGallery" created a new preferences entry from the default preferences, too.

5. The Admin can now inserted {% lucidTag gallery name="SecondGallery" %} somewhere. He can setup both existing galleries completely different.

For some plugins there makes no sense to create different instance. e.g. back_links, admin_menu, find_and_replace, system_settings

The preferences API can de something like this:
Code:
# For plugins who only have one preferences:
preferences = self.get_preferences()

Code:
    def lucidTag(self, name):
        # For plugins with more preferences:
        preferences = self.get_preferences(name)


Any comments?
_________________

http://www.jensdiemer.de | http://www.htfx.de | http://www.python-forum.de
Back to top
View user's profile Send private message
jens
Administrator


Joined: 12 Oct 2005
Posts: 972
Location: duisburg, germany

PostPosted: Sun 29 Jun, 2008 08:16    Post subject: Reply with quote

OK. i think the easiest way is to use the id number instead of a additional name.

The models can look like this: http://trac.pylucid.net/wiki/PreferencesThoughts

e.g.:
default preferences:
{% lucidTag gallery %}
specified preferences:
{% lucidTag gallery id="10" %}
_________________

http://www.jensdiemer.de | http://www.htfx.de | http://www.python-forum.de
Back to top
View user's profile Send private message
jens
Administrator


Joined: 12 Oct 2005
Posts: 972
Location: duisburg, germany

PostPosted: Sun 29 Jun, 2008 13:28    Post subject: Reply with quote

add a patch: http://trac.pylucid.net/attachment/ticket/206/new_preferences1.patch
But's its not ready.
_________________

http://www.jensdiemer.de | http://www.htfx.de | http://www.python-forum.de
Back to top
View user's profile Send private message
jens
Administrator


Joined: 12 Oct 2005
Posts: 972
Location: duisburg, germany

PostPosted: Tue 08 Jul, 2008 18:03    Post subject: Reply with quote

Add the multiple preferences function: http://trac.pylucid.net/changeset/1660

But not everything is done. And i think the usage is not optimal...
_________________

http://www.jensdiemer.de | http://www.htfx.de | http://www.python-forum.de
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PyLucid - CMS - Forum Forum Index -> system All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

<< back to PyLucid CMS Homepage



Powered by phpBB © 2001, 2005 phpBB Group