Exemplo n.º 1
0
    def get(self):
        template = dao.get_template_by_id(self.request.get(u'template_id'))
        if not dao.test_template_permissions(
                template, [dao.TEMPLATE_OWN, dao.TEMPLATE_EDIT]):
            webapp2.abort(401)

        variable_list = list()

        for variable_entity in dao.get_variables(template):
            variable = dict()
            variable[u'id'] = variable_entity.key.id()
            variable[u'name'] = variable_entity.name
            variable[u'description'] = variable_entity.description
            variable[u'is_repeating'] = variable_entity.is_repeating
            variable[u'input_field'] = variable_entity.input_field
            variable[u'assignments'] = self.get_assignments(template, variable)
            variable[u'documents'] = self.get_documents(template, variable)
            variable_list.append(variable)

        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/variable/index.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'variables'] = variable_list

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 2
0
    def render(self, template, assignment_entity, error_msg):
        assignment_names = dao.get_assignment_names(template)
        if assignment_entity.name in assignment_names:
            assignment_names.remove(assignment_entity.name)

        # Create template and template values, render the page
        jinja_template = ui.get_template(
            self, u'template/assignment/structure.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'assignment_id'] = assignment_entity.key.id()
        jinja_template_values[u'name'] = assignment_entity.name
        jinja_template_values[u'is_repeating'] = assignment_entity.is_repeating
        jinja_template_values[
            u'instructions_to_manager'] = assignment_entity.instructions_to_manager if assignment_entity.instructions_to_manager else u''
        jinja_template_values[
            u'instructions_to_writer'] = assignment_entity.instructions_to_writer if assignment_entity.instructions_to_writer else u''
        jinja_template_values[
            'prereq_assignment_names'] = assignment_entity.prereq_assignment_names if assignment_entity.prereq_assignment_names else list(
            )
        jinja_template_values[
            u'variable_names'] = assignment_entity.variable_names
        jinja_template_values[
            u'checklist_items'] = assignment_entity.checklist_items
        jinja_template_values[u'single_names'] = dao.get_single_names(template)
        jinja_template_values[u'assignment_names'] = assignment_names
        jinja_template_values[u'repeating_names'] = dao.get_repeating_names(
            template)

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 3
0
    def render(self, template, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(
            self, u'template_admin/template_settings.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'template'] = template
        jinja_template_values[u'error_msg'] = error_msg

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 4
0
    def get(self):
        template = dao.get_template_by_id(self.request.get(u'template_id'))
        if not dao.test_template_permissions(
                template, [dao.TEMPLATE_OWN, dao.TEMPLATE_EDIT]):
            webapp2.abort(401)

        jinja_template = ui.get_template(self, u'template/index.html')
        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'template'] = template
        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 5
0
    def render(self, template, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self,
                                         u'template_admin/contribute.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'template'] = template
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'name'] = self.request.get(u'name')

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 6
0
    def render(self, template, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/style/add.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'name'] = self.request.get(u'name')
        jinja_template_values[u'description'] = self.request.get(u'description')
        jinja_template_values[u'css'] = self.request.get(u'css')

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 7
0
    def render(self, template, permissions, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(
            self, u'template_admin/template_user_add.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'email'] = self.request.get(u'email')
        jinja_template_values[u'permissions'] = permissions

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 8
0
    def get(self):
        template = dao.get_template_by_id(self.request.get(u'template_id'))
        if not dao.test_template_permissions(template, [dao.TEMPLATE_OWN, dao.TEMPLATE_EDIT]):
            webapp2.abort(401)

        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template_admin/template_user_admin.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'users'] = dao.get_template_users(template)

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 9
0
    def render(self, template, style_entity, error_msg):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/style/edit.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'style_id'] = style_entity.key.id()
        jinja_template_values[u'name'] = style_entity.name
        jinja_template_values[u'description'] = style_entity.description
        jinja_template_values[u'css'] = style_entity.css

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 10
0
    def render(self, template, document_entity, error_msg):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/document/structure.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'document_id'] = document_entity.key.id()
        jinja_template_values[u'name'] = document_entity.name
        jinja_template_values[u'items'] = dao.get_document_items(document_entity)
        jinja_template_values[u'single_names'] = dao.get_single_names(template)
        jinja_template_values[u'repeating_names'] = dao.get_repeating_names(template)
        jinja_template_values[u'style_names'] = dao.get_style_names(template)

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 11
0
    def render(self, template, variable_entity, error_msg):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/variable/edit.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'variable_id'] = variable_entity.key.id()
        jinja_template_values[u'name'] = variable_entity.name
        jinja_template_values[u'description'] = variable_entity.description
        jinja_template_values[
            u'type'] = u'repeating' if variable_entity.is_repeating else u'single'
        jinja_template_values[u'input_field'] = variable_entity.input_field

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 12
0
    def render(self, template, assignment_entity, error_msg):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self,
                                         u'template/assignment/edit.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'assignment_id'] = assignment_entity.key.id()
        jinja_template_values[u'name'] = assignment_entity.name
        jinja_template_values[u'description'] = assignment_entity.description
        jinja_template_values[
            u'type'] = u'repeating' if assignment_entity.is_repeating else u'single'

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 13
0
    def render(self, template, template_user_id, template_user, error_msg):
        # Build list of permission checkboxes and whether they should be checked
        permissions = list()
        if template_user:
            for template_permission in dao.get_all_template_permissions():
                permission = {u'name': template_permission, u'checked': u'checked' if template_permission in template_user.permissions else u''}
                permissions.append(permission)

        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template_admin/template_user_edit.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'template_user_id'] = template_user_id
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'email'] = template_user.email if template_user else u'(unknown)'
        jinja_template_values[u'permissions'] = permissions

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 14
0
    def get(self):
        template = dao.get_template_by_id(self.request.get(u'template_id'))
        if not dao.test_template_permissions(
                template, [dao.TEMPLATE_OWN, dao.TEMPLATE_EDIT]):
            webapp2.abort(401)
        style_list = list()

        for style_entity in dao.get_styles(template):
            style = dict()
            style[u'id'] = style_entity.key.id()
            style[u'name'] = style_entity.name
            style[u'description'] = style_entity.description
            style[u'css'] = style_entity.css
            style_list.append(style)

        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/style/index.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'styles'] = style_list

        self.response.out.write(jinja_template.render(jinja_template_values))
Exemplo n.º 15
0
    def get(self):
        template = dao.get_template_by_id(self.request.get(u'template_id'))
        if not dao.test_template_permissions(
                template, [dao.TEMPLATE_OWN, dao.TEMPLATE_EDIT]):
            webapp2.abort(401)

        document_list = list()

        for document_entity in dao.get_documents(template):
            document = dict()
            document[u'id'] = document_entity.key.id()
            document[u'name'] = document_entity.name
            document[u'description'] = document_entity.description
            document[u'style'] = document_entity.style_name
            document_list.append(document)

        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/document/index.html')

        jinja_template_values = dao.get_standard_template_values(template)
        jinja_template_values[u'documents'] = document_list

        self.response.out.write(jinja_template.render(jinja_template_values))