ericmckean / google-highly-open-participation-plone

Automatically exported from code.google.com/p/google-highly-open-participation-plone
0 stars 0 forks source link

Create a Plone 3 portlet that lets site administrators create a list of links and have them appear as buttons. #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using the new portlets infrastructure in Plone 3, create a portlet that allows 
a site administrator to 
enter a number of titles and associated URLs (e.g. in a grid), rendering these 
as a list of buttons 
(preferably divs, not input tags, but styled as discrete clickable regions).

Original issue reported on code.google.com by optil...@gmail.com on 19 Nov 2007 at 11:39

GoogleCodeExporter commented 9 years ago

Original comment by l...@gmail.com on 27 Nov 2007 at 7:10

GoogleCodeExporter commented 9 years ago
I claim this task.

Original comment by filip.ha...@googlemail.com on 30 Dec 2007 at 10:37

GoogleCodeExporter commented 9 years ago
It's all yours man!  Remember this is a Plone 3 portlet, not an old style Plone 
2 one.

Original comment by mw4...@googlemail.com on 30 Dec 2007 at 4:41

GoogleCodeExporter commented 9 years ago
I've got a first version. But the add- and editform is not so userfriendly.
In the .pt I used class="context" to show the Links like Buttons. If you want 
an own
.css, where to define to it in a Portlet created with "paster create -t
plone3_portlet ... " and how can I bind it in into the .pt? 

Original comment by filip.ha...@googlemail.com on 30 Dec 2007 at 5:21

Attachments:

GoogleCodeExporter commented 9 years ago
You'll need to add the CSS in the browser/stylesheets directory and then add it 
to
the CSS registry in profiles/default/stylesheets.xml

The best way is to add it yourself in portal_css, export it in portal_setup and
remove all the entries but the one you just added.

Original comment by mw4...@googlemail.com on 1 Jan 2008 at 11:10

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Ah, somebody else has spotted the mistake.  You're trying to use two namespaces
packages and it's not loving it.

I recommend re-creating it as collective.portlet.links

Nimbus:src matthewwilkes$ paster create -t nested_namespace 
collective.portlet.links
Selected and implied templates:
  ZopeSkel#nested_namespace  A project with two nested namespaces.

Variables:
  egg:      collective.portlet.links
  package:  collectiveportletlinks
  project:  collective.portlet.links
Enter namespace_package (Namespace package (like plone)) ['plone']: collective
Enter namespace_package2 (Nested namespace package (like app)) ['app']: portlet
Enter package (The package contained namespace package (like example)) 
['example']: links
.
.
.
.
.

That will give you a collective.portlet.links directory.  In
collective.portlet.links/collective/portlet/links/ there's just an __init__.py 
file

If you copy across the contents of
plone3_portlet.LinkPortlet/plone3_portlet/portlet/LinkPortlet to that directory.

Then, if you modify
./__init__.py
./configure.zcml
./linkportlet.pt
./profiles/default/portlets.xml
./tests/base.py
./tests/test_portlet.py
to refer to collective.portlet.links instead of plone3_portlet.LinkPortlet and 
you
should be good to go.

Original comment by mw4...@googlemail.com on 2 Jan 2008 at 12:10

GoogleCodeExporter commented 9 years ago
I don't have a browser diretory and a stylesheet.xml.
Do I have to create one?
How to register it ?

Original comment by filip.ha...@googlemail.com on 2 Jan 2008 at 11:08

GoogleCodeExporter commented 9 years ago
An example would be good. :-)

Original comment by filip.ha...@googlemail.com on 2 Jan 2008 at 11:09

GoogleCodeExporter commented 9 years ago
If you look at the napoli skin at:
http://dev.plone.org/collective/browser/plonetheme.napoli/trunk/plonetheme/napol
i

You can see the browser directory.  You need to create the images and 
stylesheets
directories, __init__.py and include configure.zcml with the following:

<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    i18n_domain="collective.portlet.links">

    <browser:resourceDirectory
        name="collective.portlet.links.stylesheets"
        directory="stylesheets"
        />

    <browser:resourceDirectory
        name="collective.portlet.links.images"
        directory="images"
        />

</configure>

and in the configure.zcml of browser's parent directory (this should already 
exist)
make sure you have <include package=".browser" />

Finally, the code you'll have in stylesheets.xml will be along these lines:

<stylesheet title="" 
 id="++resource++collective.portlet.links.stylesheets/main.css"
 media="screen" rel="stylesheet" rendering="import"
 cacheable="True" compression="safe" cookable="True"
 enabled="1" expression=""/>

Original comment by mw4...@googlemail.com on 2 Jan 2008 at 3:39

GoogleCodeExporter commented 9 years ago
It looks like this now, but my main.css isn't used

Original comment by filip.ha...@googlemail.com on 2 Jan 2008 at 6:09

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, that now loads.

To get the CSS to load, you need to have a full stylesheets file, I just pasted 
a
hint.  Look at
http://dev.plone.org/collective/browser/plonetheme.essay/trunk/plonetheme/essay/
profiles/default/cssregistry.xml
for a real example (note, it's called cssregistry.xml - oops)

The style you've applied is a bit odd, it's a very large border around 3 sides. 
 To
make the bottom have a border you need to make the directive refer to 
a.context, not
just .context.  To be honest, you probably want .portletLinkPortlet a.context 
to make
sure the style doesn't conflict with anything else.

Finally, the configuration screen isn't very easy to understand.  Would you 
look into
using a dict for this?

There's an example at: 
http://www.google.co.uk/codesearch?hl=en&q=+zope.schema+dict+%22symbols+%3D+Dict
(%22+show:Lk-q_p5pBYg:gdfEP_Za6SY:Jpc3KkeJOlk&sa=N&cd=1&ct=rc&cs_p=http://www.zo
pe.org/Products/Zope3/3.1.0c3/Zope-3.1.0c3.tgz&cs_f=Zope-3.1.0c3/Dependencies/zo
pe.i18n-Zope-3.1.0c3/zope.i18n/interfaces/__init__.py#l331

If you see, it asks for a key_type and a value_type.  If you set your existing 
"url"
field to be the key and "titles" field to be the value then it shouldn't be 
much work
to change the code to display correctly.

Thanks

Matt

Original comment by mw4...@googlemail.com on 2 Jan 2008 at 6:33

GoogleCodeExporter commented 9 years ago
Hi, 
I'm sorry, but nothing works neither the css nor the schema.Dict.
I tryed to use schema.Dict but I get:
ComponentLookupError: ((<zope.schema._field.Dict object at 0xe1dfbac>, 
<HTTPRequest,
URL=http://localhost:8080/new/++contextportlets++plone.leftcolumn/+/collective.p
ortlet.links.LinkPortlet>),
<InterfaceClass zope.app.form.interfaces.IInputWidget>, u'')

The Css isn't used yet.

I'm stick in this. I think in my zcmls is something wrong, but I don't know 
what.

PS: Cool the Essaytheme is made by me ^^

Original comment by filip.ha...@googlemail.com on 3 Jan 2008 at 1:50

Attachments:

GoogleCodeExporter commented 9 years ago
I found this info regarding Dict widgets… I didn't test anything there but it 
might
be of some help…

http://readlist.com/lists/zope.org/zope3-users/0/1148.html
first message in thread:
http://readlist.com/lists/zope.org/zope3-users/0/1137.html

Aside note: I'm not sure you can use a dict attribute for a Portlet 
assignement. You
might need to play with a PersistentDict

Original comment by davconv...@gmail.com on 3 Jan 2008 at 8:57

GoogleCodeExporter commented 9 years ago
From reading your code I don't see exactly what you are trying to achieve in the
Portlet assignment with the symbols Dict. Maybe you can play with something 
else than
a Dict, like persistent python objects…

The examples of most complicated forms created with formlib that I know of are 
the
ones I see in plone.app.controlpanel. There are examples there that show how to
render forms handling lists of objects (that have attributes). Those forms work 
with
adaptation, the case of their use is a bit different than a real addForm or 
editFom
like the one we have here, but there might be some inspiration to take from 
there.  

Original comment by davconv...@gmail.com on 3 Jan 2008 at 9:33

GoogleCodeExporter commented 9 years ago
Ok, well this is starting to get a bit complicated, I'm going to say that 
you've done
enough for this task to be considered completed, but I'd say the best thing for 
you
to do is upload the portlet to the Collective (our shared SVN repository)

You can request write access at:
http://plone.org/development/info/write-access-collective

You'd need to use SVN, for windows I recommend TortoiseSVN and reading their
documentation.  You can always ask in #plone for help with using the collective.

This way it's in a public place; you can ask people in #plone for help and be 
able to
point them to your code more easily.  Then, if you manage to a better UI working
before the contest finishes we'll take that into account when working out how to
assess this task.  It'll also allow you to move onto a different task if you 
like!

Original comment by mw4...@googlemail.com on 7 Jan 2008 at 4:05

GoogleCodeExporter commented 9 years ago

Original comment by mw4...@googlemail.com on 14 Jan 2008 at 8:17