Re: [Zope-CMF] [dev] more add menu changes

2008-09-12 Thread yuppie
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@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] [dev] more add menu changes

2008-09-12 Thread Charlie Clark

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@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] [dev] more add menu changes

2008-09-11 Thread Charlie Clark

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@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] [dev] more add menu changes

2008-08-07 Thread yuppie

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@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] [dev] more add menu changes

2008-08-07 Thread Jens Vagelpohl


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@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] [dev] more add menu changes

2008-08-07 Thread Martin Aspeli

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@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] [dev] more add menu changes

2008-08-07 Thread Martin Aspeli

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@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] [dev] more add menu changes

2008-08-07 Thread Charlie Clark


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@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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