#create a Folder called MiniCMS and do teh following inside that folder! ############ #create a DTML Document, MyContentObject #title it My Content Object

############## #create a DTML Template, editTemplate

Delete Paragraph

">
############### #create a Script (Python), addPropertyToDocument #it has a Parameter List: self=None r = context.REQUEST #we do this because sending a REQUEST returns us back to manage_ context.manage_addProperty(r['id'], r['value'], r['type']) return r.RESPONSE.redirect(r.URL1+'/editTemplate') ############ #create a Script (Python), getParagraphs #assumes obj has paragraph properties starting with para_ #propertyValues return tuple (id, value) paragraphs=[] prefix='para_' #DTML Methods acquire namespace/context, so we dont have to explicit pass in obj if self==None: self=context for id,val in self.propertyItems(): if id[:len(prefix)]==prefix: paragraphs.append(val) return paragraphs ############## #create a Script (Python), shiftPropertyOrdering #it has a Parameter List: self=None, propSequenceNumber=None req=context.REQUEST prfx='para_' del_no=int(propSequenceNumber) if self==None: self=context #sanity check if del_no==None: raise Exception, "sequence number out of range" hash = {} for id, val in self.propertyItems(): if id[:5]==prfx and int(id[5:])>=del_no: no = int(id[5:]) hash[no]=val pnums = [] pnums = hash.keys() pnums.sort() for x in pnums: if x+1 in hash.keys(): hash[x]=hash[x+1] else: #we've gotten to the last element and we can remove it hash[x]='' #not needed #we change the newly allocated properties self.manage_changeProperties(hash) #we delete the last property ids_to_remove=(prfx+str(pnums[-1]),) #sequence of ids to delete self.manage_delProperties(ids_to_remove) #redirect back to DTMLDocument/editTemplate return req.RESPONSE.redirect(req.URL1+'/editTemplate')