[opencms-dev] adding items to a list

Christoph Fröhlich cfauto at folge2.de
Wed Sep 21 09:06:27 CEST 2011


We will face this issue in a current project as well.
We haven't start working on it, but my first approach will possibly look like this:

a) When there is no item in the list, render a custom "add new item" button. 

Clicking the button triggers the following code:

b) Determine name of the new resource.
You can ask any Collector for a name that follows a certain pattern and does not exist in a specific folder
String createLink = OpenCms.getResourceManager().getContentCollector("allInFolder").getCreateLink(cmso, "allInFolder", "/.content/articles/n_%(number).html|v8article");

c) Create the resource programmatically
 A good instruction how to do this can be found here:
http://lists.opencms.org/pipermail/opencms-dev/2011q2/035914.html

d) reload the list. The new item appears

e) After the list was reloaded, the User uses the ADE-edit-Button to edit the new item

It is not perfect, since it would be more convenient for the user to see the edit form instantly after clicking on "Add new Item".
But it may serve as a workaround.

Regards
Christoph


Am 20.09.2011 um 11:22 schrieb tobias karrer:

> Any clues from Alkacon?
>  
>  
> Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von yangguang
> Gesendet: Samstag, 17. September 2011 12:26
> An: opencms-dev
> Betreff: Re: [opencms-dev] adding items to a list
>  
> I need this answer, too.
>  
>  
> tobias karrer <tobias.karrer <at> virtual-identity.com> writes:
>  
> > 
> > 
> > Hello everybody,
> >  
> > another question:
> >  
> > Adding new elements to a list by clicking „+“ works fine when there are items 
> in the list.
> >  
> > But how to add new items when the list ist empty?
> >  
> > Best,
> > Tobias
> >  
> >  
> > 
> > _____________________________________________________________________Vorstand: 
> Ralf Heller, Udo Mobes 
> >         Vorsitzende des Aufsichtsrates: Kirsten Heller 
> >         Sitz der Gesellschaft: Gruenwaelderstrasse 10-14, D-79098 Freiburg 
> >         Amtsgericht Freiburg HRB 6218
> >         Versand am 13.09.2011 17:27 von karrer tobias
> >         Validation-Code: 1717334457157
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > This mail is sent to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the list, please visit
> > http://lists.opencms.org/mailman/listinfo/opencms-dev
>  
>  
>  
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20110921/132fec86/attachment.htm>


More information about the opencms-dev mailing list