Exemplo n.º 1
0
	def post(self, request):
		page = Page.get_by(id=request.form["page"])
		print request.form
		hbm = Plugin.get_by(name=u"HtmlBlockModule")
		content = HtmlBlock.get_or_create(plugin=hbm, placeholder=request.form["placeholder"], page=page)
		content.body = request.form["body"]
		session.commit()
		return Response(hbm.show(page, content.placeholder))
Exemplo n.º 2
0
	def post(self, request):
		page = Page.get_by(id=request.form["page"])
		vbp = Plugin.get_by(name=u"VideoBlockPlugin")
		video = VideoBlock.get_or_create(plugin=vbp, placeholder=request.form["placeholder"], page=page)
		video.link = request.form["link"]
		video.template=request.form["template"]
		session.commit()
		return Response(vbp.edit(page, video.placeholder))
Exemplo n.º 3
0
 def get(self, request):
     if "url" not in request.params or not request.params["url"]:
         request.params["url"] = ""
     page = Page.get_by(url=request.params["url"])
     if not page:
         return None
         # print request.user, request.user.has_access(page)
     if not request.user:
         if page.has_permissions():
             return RedirectResponse("/login?next=/")
     else:
         if not request.user.has_access(page):
             return Forbidden("You don't have permission'")
     content = ComponentInterface.plugin(page.plugin.name, fullname=False, ignorecase=True).content(page)
     return Response(content)