Ejemplo n.º 1
0
def get_context(context):
	about_context = {
		"obj": webnotes.bean("About Us Settings", "About Us Settings").get_controller()
	}
	
	about_context.update(context)
	return render_blocks(about_context)
Ejemplo n.º 2
0
def get_context(context):
	web_page = webnotes.bean(context.ref_doctype, context.docname)
	
	if web_page.doc.slideshow:
		web_page.doc.fields.update(get_slideshow(web_page))
		
	web_page.doc.meta_description = web_page.doc.description
	
	web_page.doc.breadcrumbs = get_breadcrumbs(web_page)
	web_page.doc.toc_list = get_toc_list(web_page)
	
	# parent, child, next sibling links
	web_page.doc.links = get_navigation_links(web_page)
	
	if web_page.doc.enable_comments:
		web_page.doc.comment_list = webnotes.conn.sql("""select 
			comment, comment_by_fullname, creation
			from `tabComment` where comment_doctype="Web Page"
			and comment_docname=%s order by creation""", web_page.doc.name, as_dict=1) or []
			
	web_page.doc.fields.update({
		"style": web_page.doc.css or "",
		"script": web_page.doc.javascript or ""
	})
	
	web_page.doc.fields.update(context)
	
	return render_blocks(web_page.doc.fields)
Ejemplo n.º 3
0
def get_context(context):
	message_context = {}
	if hasattr(webnotes.local, "message"):
		message_context["title"] = webnotes.local.message_title
		message_context["message"] = webnotes.local.message
		if hasattr(webnotes.local, "message_success"):
			message_context["success"] = webnotes.local.message_success
	
	message_context.update(context)
	return render_blocks(message_context)
Ejemplo n.º 4
0
def get_context(context):
	bloggers = webnotes.conn.sql("""select * from `tabBlogger` 
	 	where ifnull(posts,0) > 0 and ifnull(disabled,0)=0 
		order by posts desc""", as_dict=1)
		
	writers_context = {
		"bloggers": bloggers,
		"texts": {
			"all_posts_by": "All posts by"
		},
		"categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
	}
	
	writers_context.update(webnotes.doc("Blog Settings", "Blog Settings").fields)
	writers_context.update(context)
	
	return render_blocks(writers_context)
Ejemplo n.º 5
0
def get_context(context):
	bean = webnotes.bean("Contact Us Settings", "Contact Us Settings")
	
	query_options = filter(None, bean.doc.query_options.replace(",", "\n").split()) if \
			bean.doc.query_options else ["Sales", "Support", "General"]
			
	address = webnotes.bean("Address", bean.doc.address).doc if bean.doc.address else None
	
	contact_context = {
		"query_options": query_options,
		"address": address,
		"heading": bean.doc.heading,
		"introduction": bean.doc.introduction
	}
	contact_context.update(context)
	
	return render_blocks(contact_context)
Ejemplo n.º 6
0
def get_context(context):
	bean = webnotes.bean(context.ref_doctype, context.docname)
	group, view = guess_group_view(bean, context)
	
	try:
		if not has_access(group, view):
			raise webnotes.PermissionError
			
		group_context = get_group_context(group, view, bean)
		group_context["access"] = get_access(group)
		group_context.update(context)
	
		return render_blocks(group_context)
	
	except webnotes.DoesNotExistError:
		return {
			"content": '<div class="alert alert-danger full-page">'
				'The page you are looking for does not exist.</div>'
			}
	except webnotes.PermissionError:
		return {
			"content": '<div class="alert alert-danger full-page">'
				'You are not permitted to view this page.</div>'
		}
Ejemplo n.º 7
0
def get_context(context):
	return render_blocks(context)
Ejemplo n.º 8
0
def get_context(context):
	blog_context = webnotes.doc("Blog Settings", "Blog Settings").fields
	blog_context.update(context)
	return render_blocks(blog_context)
Ejemplo n.º 9
0
def get_context(context):
	error_context = {"error": webnotes.get_traceback()}
	error_context.update(context)
	
	return render_blocks(error_context)