def create_user_content(self): content = Content() content.title = "Registration Confirmation :: " + self.ws.site.title content.content = template.render('defaults/register_notify.html', { "site" : self.ws.site }) return content
def create_admin_content(self): admin_content = Content() admin_content.title = "New User Registration " + self.ws.site.title admin_content.content = template.render('defaults/admin/admin_notify.html',{ "site" : self.ws.site }) return admin_content
def generate_admin_html(self, page, user): contents = Content.all().fetch(1000) roles = Role.all().fetch(1000) emaildata = {"contents": contents, "roles": roles} emailcontext = template.Context(emaildata) email_template = template.Template(open("templates/email.html").read()) email_html = email_template.render(emailcontext) admindata = { "page_edit": Page.to_form(self.request.path, "edit", page.key()), "theme_edit": Theme.to_form(self.request.path, "edit", page.theme.key(), page.key()), "page_key": page.key(), "path": self.request.path, "permission_table": Permission.get_table(page.key()), "sections": ( { "name": section.name.replace("section_", "").capitalize(), "theme_key": section.theme.key(), "theme_html": section.theme.html, "theme_css": section.theme.css, "theme_js": section.theme.js, "content": ( { "title": content.title, "content_edit": Content.to_edit_list("title", self.request.path), "content_form": Content.to_form( self.request.path, "edit", content.key(), section.key() ), "content_deepform": Content.to_form(self.request.path, rel_key=section.key()), } for content in section.get_contents() ), } for section in page.get_sections() ), "page_form": Page.to_form(self.request.path, rel_key=self.ws.site.key()), "user_form": User.to_form(self.request.path), "user_list": User.to_edit_list("email", self.request.path, True), "user_edit_form": User.to_form(self.request.path, "edit", user.key()), "user_import": open("defaults/admin/user_import.html").read(), "images": self.ws.site.images_for_use(), "email_blast": email_html, } context = template.Context(admindata) admin_template = template.Template(open("defaults/admin/tabs.html").read()) admin_html = admin_template.render(context) return admin_html
def get(self): contents = Content.all().fetch(1000) theme_packages = ThemePackage.all().fetch(1000) themes = Theme.all().fetch(1000) pages = Page.all().fetch(1000) images = Image.all().fetch(1000) roles = Role.all().fetch(1000) sections = Section.all().fetch(1000) _users = User.all().fetch(1000) actions = ACTIONS template_values = {'logout_url':self.ws.users.create_logout_url('/'),'theme_packages': theme_packages,'themes': themes, 'images': images, 'pages': pages, 'contents':contents, 'roles':roles, 'users':_users, 'actions': actions, 'sections': sections, 'site': self.ws.site} self.response.out.write(template.render('templates/manage.html',template_values))