This is an example mextURL function that I used to add a folder containing a page, and then go to the folder. Going to the page is just an addition to the last line.



    def nextURL(self):

        """ This function is called for redirection after folder creation.
We can use it to fill out metadata collected from a custom add form.

        # get the folder object we just created
        theObject = \

        # set the folder title to the title collected from the input form
        ICMFDublinCore(theObject).title = self.request['dctitle']

        # create default content for an index.html page
        msg = u"<h3>%s</h3>\n\n<p>Example Paragraph</p>" \
            % (self.request['dctitle'])

        # create a page template
        page = MontiPage()

        # set the page content
        page.source = msg

        # insert the page into the folder
        content = theObject.__setitem__('index.html', page)

        # set the page metadata from the form fields
        ICMFDublinCore(page).title = self.request['dctitle']
        ICMFDublinCore(page).description = self.request['dcdescription']
        ICMFDublinCore(page).subjects = [self.request['dcsubjects'],]
        ICMFDublinCore(page).creators = [self.request['dcauthor'],]

        # set the default menu
        msg = ['index.html', self.request['dctitle'], 'Folder index page']

        #  any call to annotations here sets the folder annotations
        IMontiFolderAnnotations(theObject).menulist = [msg]

        # in the zmi we need to return to the folder we were called from
        if self.request['referer'].find('@@contents.html') >= 0:
            return self.request['referer']

        # all done - now go to the index page in the newly created folder
        return  '../%s' % self.request['add_input_name']

John Smith wrote:
Would like to add an object to a container and jump to the edit screen for the newly created object immediately. Currently, adding an object to a container takes me to the container's content list. When there are 10 or 15 people all adding objects, finding the one I entered in order to edit it is a usability issue. Solutions:
 a) there is something already in zope3 that I don't know about :)
 b) create an "Add and Edit" button to go beside the "Refresh" and "Add" 
buttons in the standard template and create some handler for this.
Thanks in advance for any pointers. John Smith
Yahoo! Cars NEW - sell your car and browse thousands of new and used cars online search now ---------------------------------


Zope3-users mailing list
Zope3-users mailing list

Reply via email to