Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

[dev] more add menu changes

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


y.2008 at wcm-solutions

Aug 7, 2008, 3:26 AM

Post #1 of 10 (1492 views)
Permalink
[dev] more add menu changes

Hi!


We now have to support two ways to add content:


1.) oldstyle (no add view specified)
------------------------------------

The addable types are listed in folder_factories. After specifying type
and ID the object is added. constructContent redirects to the immediate
view.


2.) newstyle (add view is specified)
------------------------------------

The addable types are listed as actions. These actions should show up in
a menu. The add action points to a type specific add form. After
completion of the form the object is added. The add form redirects to
the immediate view.

Some parts are still missing:

- add a traverser that allows to use pretty URLs and better portal type
handling for add views (not part of this proposal)

- don't show newstyle types in folder_factories

- show add actions in the CMFDefault skin


Proposal 1: allowedContentTypes
-------------------------------

This PortalFolder method is used by folder_factories and by
folder_contents to decide if the 'New...' button is added. I propose to
add a new skip_add_views argument to allowedContentTypes. If true,
newstyle types are skipped.


Proposal 2: main_template
-------------------------

CMFDefault menus are implemented in main_template. I propose to add a
new section for 'folder/add' actions.


If there are no objections I'll make these changes on trunk.


Cheers,

Yuppie


_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


jens at dataflake

Aug 7, 2008, 4:23 AM

Post #2 of 10 (1437 views)
Permalink
Re: [dev] more add menu changes [In reply to]

On Aug 7, 2008, at 12:26 , yuppie wrote:
> Proposal 1: allowedContentTypes
> -------------------------------
>
> This PortalFolder method is used by folder_factories and by
> folder_contents to decide if the 'New...' button is added. I propose
> to add a new skip_add_views argument to allowedContentTypes. If
> true, newstyle types are skipped.
>
>
> Proposal 2: main_template
> -------------------------
>
> CMFDefault menus are implemented in main_template. I propose to add
> a new section for 'folder/add' actions.
>
>
> If there are no objections I'll make these changes on trunk.

+1

jens



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


optilude at gmx

Aug 7, 2008, 9:09 AM

Post #3 of 10 (1435 views)
Permalink
Re: [dev] more add menu changes [In reply to]

Hi Yuppie,



yuppie-4 wrote:
>
> Hi!
>
>
> We now have to support two ways to add content:
>
>
> 1.) oldstyle (no add view specified)
> ------------------------------------
>
> The addable types are listed in folder_factories. After specifying type
> and ID the object is added. constructContent redirects to the immediate
> view.
>
>
> 2.) newstyle (add view is specified)
> ------------------------------------
>
> The addable types are listed as actions. These actions should show up in
> a menu. The add action points to a type specific add form. After
> completion of the form the object is added. The add form redirects to
> the immediate view.
>
> Some parts are still missing:
>
> - add a traverser that allows to use pretty URLs and better portal type
> handling for add views (not part of this proposal)
>
> - don't show newstyle types in folder_factories
>
> - show add actions in the CMFDefault skin
>
>
> Proposal 1: allowedContentTypes
> -------------------------------
>
> This PortalFolder method is used by folder_factories and by
> folder_contents to decide if the 'New...' button is added. I propose to
> add a new skip_add_views argument to allowedContentTypes. If true,
> newstyle types are skipped.
>

Please let this default to False. I wonder if it's better to have a separate
method that does the skipping. allowedContentTypes may be used by other
things already. Plone uses it in a few places, for example. :)

I don't suppose there's a way to make all FTI's expose actions, and just
construct an appropriate fallback URL (e.g. createObject or whatever) if no
add view has been specified? That'd mean folder_factories could just loop
through the actions.



> Proposal 2: main_template
> -------------------------
>
> CMFDefault menus are implemented in main_template. I propose to add a
> new section for 'folder/add' actions.
>
>
> If there are no objections I'll make these changes on trunk.
>

+0 - Plone would need this in its content menu implementation, but that's
custom anyway.

Martin
--
View this message in context: http://www.nabble.com/-dev--more-add-menu-changes-tp18867664p18873994.html
Sent from the Zope - CMF list2 mailing list archive at Nabble.com.

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


y.2008 at wcm-solutions

Aug 7, 2008, 10:04 AM

Post #4 of 10 (1438 views)
Permalink
Re: [dev] more add menu changes [In reply to]

Hi Martin!


Martin Aspeli wrote:
> yuppie-4 wrote:
>>
>> Some parts are still missing:
>>
>> - add a traverser that allows to use pretty URLs and better portal type
>> handling for add views (not part of this proposal)
>>
>> - don't show newstyle types in folder_factories
>>
>> - show add actions in the CMFDefault skin
>>
>>
>> Proposal 1: allowedContentTypes
>> -------------------------------
>>
>> This PortalFolder method is used by folder_factories and by
>> folder_contents to decide if the 'New...' button is added. I propose to
>> add a new skip_add_views argument to allowedContentTypes. If true,
>> newstyle types are skipped.
>>
>
> Please let this default to False.

Sure.

> I wonder if it's better to have a separate
> method that does the skipping. allowedContentTypes may be used by other
> things already. Plone uses it in a few places, for example. :)

I have no strong opinion about this. What would be a good name for a
separate method?

> I don't suppose there's a way to make all FTI's expose actions, and just
> construct an appropriate fallback URL (e.g. createObject or whatever) if no
> add view has been specified? That'd mean folder_factories could just loop
> through the actions.

Not sure I understand what you propose. folder_factories is a form that
allows to specify type and ID. I don't think we should ask for the ID
*before* showing the add view. And if we have no add view, we need
folder_factories' ID input field.

But this might work: If we also implement the traverser, the traverser
could return a default add view that just asks for the ID. In that case
we could use actions for newstyle and oldstyle types.

That solution would change the add procedure for oldstyle types, but
maybe that's better than listing newstyle and oldstyle types in two
different places.


Any opinions?


Cheers,

Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


optilude at gmx

Aug 7, 2008, 10:21 AM

Post #5 of 10 (1433 views)
Permalink
Re: [dev] more add menu changes [In reply to]

Hi Yuppie,


yuppie-4 wrote:
>
>> I don't suppose there's a way to make all FTI's expose actions, and just
>> construct an appropriate fallback URL (e.g. createObject or whatever) if
>> no
>> add view has been specified? That'd mean folder_factories could just loop
>> through the actions.
>
> Not sure I understand what you propose. folder_factories is a form that
> allows to specify type and ID. I don't think we should ask for the ID
> *before* showing the add view. And if we have no add view, we need
> folder_factories' ID input field.
>

Ah.... In Plone, folder_factories is a list of addable types. You click
"Add" next to each one and it's created with a temporary ID. Then you save
it, and it's renamed to a better ID, usually.



> But this might work: If we also implement the traverser, the traverser
> could return a default add view that just asks for the ID. In that case
> we could use actions for newstyle and oldstyle types.
>

That may be nice.



> That solution would change the add procedure for oldstyle types, but
> maybe that's better than listing newstyle and oldstyle types in two
> different places.
>

I think so. Why should the user have to know whether something is "old" or
"new"?

Martin
--
View this message in context: http://www.nabble.com/-dev--more-add-menu-changes-tp18867664p18875455.html
Sent from the Zope - CMF list2 mailing list archive at Nabble.com.

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


charlie at begeistert

Aug 7, 2008, 2:09 PM

Post #6 of 10 (1427 views)
Permalink
Re: [dev] more add menu changes [In reply to]

Am 07.08.2008 um 19:21 schrieb Martin Aspeli:

> Ah.... In Plone, folder_factories is a list of addable types. You
> click
> "Add" next to each one and it's created with a temporary ID. Then
> you save
> it, and it's renamed to a better ID, usually.


Add forms are much nicer than that. Objects are only created if the
add form is correctly completed. I haven't looked at yuppie's latest
implementation but the use of INameChooser for default id's is very
usable - in many context management situations auto-generated id's are
preferable although Plone's are a bit verbose.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


optilude at gmx

Aug 7, 2008, 4:46 PM

Post #7 of 10 (1418 views)
Permalink
Re: [dev] more add menu changes [In reply to]

Charlie Clark wrote:
> Am 07.08.2008 um 19:21 schrieb Martin Aspeli:
>
>> Ah.... In Plone, folder_factories is a list of addable types. You
>> click
>> "Add" next to each one and it's created with a temporary ID. Then
>> you save
>> it, and it's renamed to a better ID, usually.
>
>
> Add forms are much nicer than that.

Of course. We just haven't had many of them until recently.

> Objects are only created if the
> add form is correctly completed.

Yes, that's why they call them add forms ....

> I haven't looked at yuppie's latest
> implementation but the use of INameChooser for default id's is very
> usable - in many context management situations auto-generated id's are
> preferable although Plone's are a bit verbose.

No kidding. :)

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


charlie at begeistert

Sep 11, 2008, 7:22 AM

Post #8 of 10 (1242 views)
Permalink
Re: [dev] more add menu changes [In reply to]

Am 07.08.2008 um 12:26 schrieb yuppie:

> Proposal 2: main_template
> -------------------------
>
> CMFDefault menus are implemented in main_template. I propose to add
> a new section for 'folder/add' actions.


Hi yuppie,

finally had a bit of time to look at this. First of all thank you very
much for your work on this. It's a great pity your not here at the
DZUG conference to discuss.

I have an extremely basic implementation of this for the CMF:

from Products.CMFCore.utils import getToolByName

tt = getToolByName(context, 'portal_types')
ti = tt.getTypeInfo(context)

poss_types = ti.allowed_content_types

add_forms = []

for t in poss_types:
# get type info for child
nti = tt.getTypeInfo(t)
if nti.add_view_expr != '':
url = nti.add_view_expr_object
add_forms.append({'title':nti.title, 'url':url(context)})

return add_forms

I can't think of any other way to do this other than to call this
expression before returning it to the template. But it's more than
possible I've overlooked something.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


y.2008 at wcm-solutions

Sep 12, 2008, 1:56 AM

Post #9 of 10 (1239 views)
Permalink
Re: [dev] more add menu changes [In reply to]

Charlie Clark wrote:
> Am 07.08.2008 um 12:26 schrieb yuppie:
>
>> Proposal 2: main_template
>> -------------------------
>>
>> CMFDefault menus are implemented in main_template. I propose to add
>> a new section for 'folder/add' actions.
>
>
> Hi yuppie,
>
> finally had a bit of time to look at this. First of all thank you very
> much for your work on this. It's a great pity your not here at the
> DZUG conference to discuss.
>
> I have an extremely basic implementation of this for the CMF:
>
> from Products.CMFCore.utils import getToolByName
>
> tt = getToolByName(context, 'portal_types')
> ti = tt.getTypeInfo(context)
>
> poss_types = ti.allowed_content_types
>
> add_forms = []
>
> for t in poss_types:
> # get type info for child
> nti = tt.getTypeInfo(t)
> if nti.add_view_expr != '':
> url = nti.add_view_expr_object
> add_forms.append({'title':nti.title, 'url':url(context)})
>
> return add_forms

I doubt that works: 'context' and expression context are not the same.

> I can't think of any other way to do this other than to call this
> expression before returning it to the template. But it's more than
> possible I've overlooked something.

Why do you want to bypass the actions machinery?

Something like that should work in main_template:
tal:define="add_forms python: actions.get('folder/add', {});"

Cheers, Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Sep 12, 2008, 4:32 AM

Post #10 of 10 (1235 views)
Permalink
Re: [dev] more add menu changes [In reply to]

Am 12.09.2008 um 10:56 schrieb yuppie:

> I doubt that works: 'context' and expression context are not the same.

It does 'cos it came from my working demo.

>> I can't think of any other way to do this other than to call this
>> expression before returning it to the template. But it's more than
>> possible I've overlooked something.
>
> Why do you want to bypass the actions machinery?

Because I was too stupid to realise I could use it!

> Something like that should work in main_template:
> tal:define="add_forms python: actions.get('folder/add', {});"


Indeed it does. Thank you very much.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.