def render_page(self, template_values, in_action=None): page_title = template_values['page_title'] template_values['header_title'] = page_title template_values['page_headers'] = [ hook(self) for hook in self.PAGE_HEADER_HOOKS] template_values['breadcrumbs'] = page_title current_action = (in_action or self.request.get('action') or self.default_action_for_current_permissions()) current_menu_item = self.actions_to_menu_items.get(current_action) template_values['root_menu_group'] = self.root_menu_group template_values['current_menu_item'] = current_menu_item template_values['is_global_admin'] = True template_values['course_app_contexts'] = dashboard.get_visible_courses() template_values['gcb_course_base'] = '/' template_values['user_nav'] = safe_dom.NodeList().append( safe_dom.Text('%s | ' % users.get_current_user().email()) ).append( safe_dom.Element( 'a', href=users.create_logout_url(self.request.uri) ).add_text('Logout')) template_values[ 'page_footer'] = 'Page created on: %s' % datetime.datetime.now() template_values['coursebuilder_version'] = ( os.environ['GCB_PRODUCT_VERSION']) template_values['application_id'] = app.get_application_id() template_values['application_version'] = ( os.environ['CURRENT_VERSION_ID']) template_values['can_highlight_code'] = oeditor.CAN_HIGHLIGHT_CODE.value if not template_values.get('sections'): template_values['sections'] = [] self.response.write( self.get_template('view.html', []).render(template_values))
def render_page(self, template_values, in_action=None): page_title = template_values['page_title'] template_values['header_title'] = page_title template_values['page_headers'] = [ hook(self) for hook in self.PAGE_HEADER_HOOKS] template_values['breadcrumbs'] = page_title current_action = (in_action or self.request.get('action') or self.default_action_for_current_permissions()) current_menu_item = self.actions_to_menu_items.get(current_action) template_values['root_menu_group'] = self.root_menu_group template_values['current_menu_item'] = current_menu_item template_values['is_global_admin'] = True template_values['course_app_contexts'] = dashboard.get_visible_courses() template_values['gcb_course_base'] = '/' template_values['user_nav'] = safe_dom.NodeList().append( safe_dom.Text('%s | ' % users.get_current_user().email()) ).append( safe_dom.Element( 'a', href=users.create_logout_url(self.request.uri) ).add_text('Logout')) template_values[ 'page_footer'] = 'Page created on: %s' % datetime.datetime.now() template_values['coursebuilder_version'] = ( os.environ['GCB_PRODUCT_VERSION']) template_values['application_id'] = app.get_application_id() template_values['application_version'] = ( os.environ['CURRENT_VERSION_ID']) if not template_values.get('sections'): template_values['sections'] = [] self.response.write( self.get_template('view.html', []).render(template_values))
def render_page(self, template_values, in_action=None): """Render page contents and write them into the response. NOTE: The resulting contents are *not* sent to the client (user's browser) as a result of calling render_page(). webapp2 does not forward the response and its contents to the client until the handler itself completes. """ page_title = template_values['page_title'] template_values['header_title'] = page_title template_values['page_headers'] = [ hook(self) for hook in self.PAGE_HEADER_HOOKS] template_values['breadcrumbs'] = page_title # menu current_action = (in_action or self.request.get('action') or self.default_action_for_current_permissions()) template_values['current_menu_item'] = self.actions_to_menu_items\ .get(current_action) template_values['courses_menu_item'] = self.actions_to_menu_items.get( 'courses') template_values['root_menu_group'] = self.root_menu_group template_values['course_app_contexts'] = dashboard.get_visible_courses() template_values['gcb_course_base'] = self.BASE_URL template_values['user_nav'] = safe_dom.NodeList().append( safe_dom.Text('%s | ' % users.get_current_user().email()) ).append( safe_dom.Element( 'a', href=users.create_logout_url(self.request.uri) ).add_text('Logout')) template_values[ 'page_footer'] = 'Page created on: %s' % datetime.datetime.now() template_values['coursebuilder_version'] = ( os.environ['GCB_PRODUCT_VERSION']) template_values['application_id'] = app.get_application_id() version = os.environ['CURRENT_VERSION_ID'] if '.' not in version or not appengine_config.PRODUCTION_MODE: template_values['application_version'] = version else: version, deployed_at = version.split('.', 1) template_values['application_version'] = version template_values['deployed_at'] = datetime.datetime.utcfromtimestamp( int(deployed_at) >> 28) # Yes, really. if not template_values.get('sections'): template_values['sections'] = [] if not appengine_config.PRODUCTION_MODE: template_values['page_uuid'] = str(uuid.uuid1()) self.response.write( self.get_template('view.html').render(template_values))
def _render_about_courses(self): courses_list = ( courses.Course(None, app_context=app_context) for app_context in dashboard.get_visible_courses()) def list_files(app_context): return dashboard_utils.list_files(app_context, '/data/') def get_filesystem_type(app_context): return app_context.fs.impl.__class__.__name__ def get_home_folder(app_context): return sites.abspath(app_context.get_home_folder(), '/') return safe_dom.Template( self.get_template('course_infos.html'), courses=courses_list, get_filesystem_type=get_filesystem_type, get_home_folder=get_home_folder, list_files=list_files)
def render_page(self, template_values, in_action=None): page_title = template_values['page_title'] template_values['header_title'] = page_title template_values['page_headers'] = [ hook(self) for hook in self.PAGE_HEADER_HOOKS] template_values['breadcrumbs'] = page_title # menu current_action = (in_action or self.request.get('action') or self.default_action_for_current_permissions()) template_values['current_menu_item'] = self.actions_to_menu_items\ .get(current_action) template_values['courses_menu_item'] = self.actions_to_menu_items.get( 'courses') template_values['root_menu_group'] = self.root_menu_group template_values['course_app_contexts'] = dashboard.get_visible_courses() template_values['gcb_course_base'] = self.BASE_URL template_values['user_nav'] = safe_dom.NodeList().append( safe_dom.Text('%s | ' % users.get_current_user().email()) ).append( safe_dom.Element( 'a', href=users.create_logout_url(self.request.uri) ).add_text('Logout')) template_values[ 'page_footer'] = 'Page created on: %s' % datetime.datetime.now() template_values['coursebuilder_version'] = ( os.environ['GCB_PRODUCT_VERSION']) template_values['application_id'] = app.get_application_id() template_values['application_version'] = ( os.environ['CURRENT_VERSION_ID']) if not template_values.get('sections'): template_values['sections'] = [] if not appengine_config.PRODUCTION_MODE: template_values['page_uuid'] = str(uuid.uuid1()) self.response.write( self.get_template('view.html').render(template_values))