|
From: alan r. <ru...@ru...> - 2003-02-26 17:01:24
|
> I'm trying to keep the FAQ simple and to the point, so when these > wonderfuly detailed explinations come through, I am puting it first in > the How-To section, and then adding a simple answer in the FAQ with a > link to the How-To. you are the dictator of FAQ. If you feel these things dont fit in that form. dont put them there. I'm not offeneded ;-) keep up the great work! ~runyaga > Let me know what you think. > Richard > > -----Original Message----- From: alan runyan > [mailto:ru...@ru...] Sent: Tue 2/25/2003 8:16 PM To: plone- > do...@li... Cc: Subject: [Plone-docs] Scriptable Type > Information > > > > someone was asking how to make a pre-populated folder > through-the-web. here is a howto. I would appreciate it going into FAQ > and maybe Book? If someone would like to > post it into Zopelabs that would be great. > > ~runyaga > > Scriptable Type Information > > You want to create a new folderish object > that is pre-populated with a variety of content > objects. > > in ZMI: > > - goto portal_types > > - add new (Script) Python > - id: addPopulatedFolder > - title: prepopulated folder > > - parameters: container, id > > <code> > context.invokeFactory(id=id, type_name='Populated Folder') > #create a new instance of your portal_type in the the > #current context > > obj=getattr(context,id) > #get a reference to the newly created portal_type object > > obj.invokeFactory(id='newsitem_1', type_name='News Item') > obj.invokeFactory(id='document_1', type_name='Document') > obj.invokeFactory(id='image_1', type_name='Image') > #we have just populated it with 3 content objects. > > #we are creating folder1 inside of our Populated Folder instance > obj.invokeFactory(id='folder1', type_name='Folder') #get a reference to > the > newly created folder folder1=getattr(obj, 'folder1') #and create a > subfolder inside folder1.invokeFactory(id='subfolder1', > type_name='Folder') > #we nest a few folders; of course nesting Populated Folder would do bad > things > > return obj > #very important we must hand back the object so that > #the CMF machinery can imprint some type information onto > #the instance > </code> > > > - in portal_types in the drop down list there is a 'Scriptable Type > Information'; add it. > > - the only things you need to fill out are two things: > > - id: Populated Folder > > - use Default Type Information: CMFPlone: Plone Folder > > - now you created the type information, click on it to edit it. > > - Constructor permission: Add portal content > > - Constructor path: portal_types/addPopulatedFolder > #NOTE: the above is relative path to the portal from where you > # are adding the object. so anywhere inside a CMF portal > # you can easily access the portal_types by just traversing > # to it. This happens via Acquisition. > > Now you are done. You should be able to add 'Populated Folder' > instances > to your Folderish objects. If you are using Plone there is one more > step > to go. > > - in portal_properties/site_properties there is a property, > 'use_folder_tabs' > in that on a new line add 'Populated Folder' # without the ' - of > course > > Why is this? Because Plone attempted to layer functionality onto CMF > instead of > completely replace it. Since we tried to do this there was some > implementation > details (when something is a folder/object) that were exposed. The tab > code is > crufty and old but fairly easy to fix (especially if you arent try to be > all > things to all people). > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Scholarships for Techies! > Can't afford IT training? All 2003 ictp students receive scholarships. > Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. > www.ictp.com/training/sourceforge.asp > _______________________________________________ > Plone-docs mailing list > Plo...@li... > https://lists.sourceforge.net/lists/listinfo/plone-docs > None > > > -- ~runyaga |