## Script (Python) "script_blog" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind state=state ##bind subpath=traverse_subpath ##parameters=answer='' ##title=Script Blog ## REQUEST=context.REQUEST action = REQUEST.get('action') if action == 'add_to_blogroll': add = context.blog.setBlogrollLinks(REQUEST) sameTitle = add[0] sameLink = add[1] if sameTitle == False and sameLink == False: return state.set( portal_status_message="Blog has been added to blogroll" ) else: REQUEST.RESPONSE.redirect('add_links_confirm?title='+REQUEST.get('new_title')+'&link='+REQUEST.get('new_link')+'&sametitle='+str(sameTitle)+'&samelink='+str(sameLink)) elif action == 'remove_from_blogroll': context.blog.delBlogrollLinks(REQUEST) return state.set( portal_status_message="Selected links are removed from blogroll" ) elif action == 'add_to_links': context.addToLinks(REQUEST.get('ltitle'),REQUEST.get('lurl')) state.set( portal_status_message="Your link was succesfully added" ) REQUEST.RESPONSE.redirect(context.absolute_url()+'/edit') elif action == 'cancel': return state.set( portal_status_message="You canceled your request" ) else: return state.set( portal_status_message="Attention: !Unknown action submitted!" )