Example #1
0
    def get(self):
        project = dao.get_project_by_id(self.request.get(u'_project_id'))
        if not dao.test_project_permissions(project, []):
            webapp2.abort(401)

        interview_service = InterviewService(project)
        interview_name = self.request.get(u'_interview_name')
        interview = interview_service.get_interview_by_name(interview_name)

        variable = dao.get_variable_by_internal_name(project, self.request.get(u'_variable_name'))

        index = self.request.get(u'_index')

        # Deliver HTTP response
        jinja_template = ui.get_template(self, u'project/upload_file.html')
        jinja_template_values = dao.get_standard_project_values(project)
        jinja_template_values[u'interview'] = interview
        jinja_template_values[u'variable'] = variable
        if index:
            jinja_template_values[u'show_index'] = True
            jinja_template_values[u'index'] = index

        jinja_template_values[u'upload_file_post_url'] = blobstore.create_upload_url('/project/upload_file_post')

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #2
0
    def render(self, site_user_id, site_user, error_msg):
        # Build list of permission checkboxes and whether they should be checked
        permissions = list()
        if site_user:
            for site_permission in dao.get_all_site_permissions():
                permission = {
                    u'name':
                    site_permission,
                    u'checked':
                    u'checked'
                    if site_permission in site_user.site_permissions else u''
                }
                permissions.append(permission)

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

        jinja_template_values = dao.get_standard_site_values()
        jinja_template_values[u'site_user_id'] = site_user_id
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[
            u'email'] = site_user.email if site_user else u'(unknown)'
        jinja_template_values[u'permissions'] = permissions

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #3
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))
Example #4
0
    def get(self):
        if not dao.test_current_user_registered():
            webapp2.abort(401)

        jinja_template = ui.get_template(self,
                                         u'project_admin/new_project.html')
        jinja_template_values = dao.get_standard_site_values()

        public_template_list = list()
        for template in dao.get_public_templates():
            if template.status == dao.STATUS_ACTIVE:
                template_view = dict()
                template_view[u'template_id'] = template.key.id()
                template_view[u'name'] = template.name
                template_view[u'description'] = template.description
                template_view[u'document_count'] = dao.get_document_count(
                    template)
                template_view[u'status'] = template.status
                public_template_list.append(template_view)
        jinja_template_values[u'public_templates'] = public_template_list

        private_template_list = list()
        for template in dao.get_private_templates():
            template_view = dict()
            template_view[u'template_id'] = template.key.id()
            template_view[u'name'] = template.name
            template_view[u'description'] = template.description
            template_view[u'document_count'] = dao.get_document_count(template)
            private_template_list.append(template_view)
        jinja_template_values[u'private_templates'] = private_template_list

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #5
0
    def render(self, project, assignment_entity, error_msg):
        assignment_names = dao.get_assignment_names(project)
        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'project/assignment/structure.html')

        jinja_template_values = dao.get_standard_project_values(project)
        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(project)
        jinja_template_values[u'assignment_names'] = assignment_names
        jinja_template_values[u'repeating_names'] = dao.get_repeating_names(
            project)

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #6
0
    def get(self):
        if not dao.test_site_permission(dao.SITE_ADMIN_SETTINGS):
            webapp2.abort(401)

        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'site_admin/site_settings.html')
        jinja_template_values = dao.get_standard_site_values()
        self.response.out.write(jinja_template.render(jinja_template_values))
Example #7
0
    def render(self, project, assignments):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'project_admin/console.html')

        jinja_template_values = dao.get_standard_project_values(project)
        jinja_template_values[u'assignments'] = assignments

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #8
0
    def render(self, project, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'project_admin/project_settings.html')

        jinja_template_values = dao.get_standard_project_values(project)
        jinja_template_values[u'error_msg'] = error_msg

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #9
0
    def get(self):
        project = dao.get_project_by_id(self.request.get(u'project_id'))
        if not dao.test_project_permissions(project, []):
            webapp2.abort(401)

        jinja_template = ui.get_template(self, u'project/index.html')
        jinja_template_values = dao.get_standard_project_values(project)
        self.response.out.write(jinja_template.render(jinja_template_values))
Example #10
0
    def get(self):
        if not dao.test_current_user_registered():
            webapp2.abort(401)

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

        jinja_template_values = dao.get_standard_site_values()
        self.response.out.write(jinja_template.render(jinja_template_values))
Example #11
0
    def get(self):
        if not dao.test_site_permission(dao.SITE_ADMIN_TEMPLATES):
            webapp2.abort(401)

        jinja_template = ui.get_template(self,
                                         u'site_admin/template_admin.html')
        jinja_template_values = dao.get_standard_site_values()
        jinja_template_values[u'templates'] = dao.get_public_templates()
        self.response.out.write(jinja_template.render(jinja_template_values))
Example #12
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))
Example #13
0
    def render(self, error_msg=None):
        # Create Jinja template and template values, render the page
        jinja_template = ui.get_template(self, u'template_admin/new_template.html')

        jinja_template_values = dao.get_standard_site_values()
        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')

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #14
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))
Example #15
0
    def render(self, project, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'project/style/add.html')

        jinja_template_values = dao.get_standard_project_values(project)
        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))
Example #16
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))
Example #17
0
    def render(self, project, error_msg=None, name=u'', description=u''):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self,
                                         u'project_admin/attachment_add.html')

        jinja_template_values = dao.get_standard_project_values(project)
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'name'] = name
        jinja_template_values[u'description'] = description

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #18
0
    def render(self, permissions, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self,
                                         u'site_admin/site_user_add.html')

        jinja_template_values = dao.get_standard_site_values()
        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))
Example #19
0
    def get(self):
        if dao.test_current_user_registered():
            jinja_template = ui.get_template(self, u'index.html')
            jinja_template_values = dao.get_standard_site_values()
        elif users.get_current_user():
            if ENABLE_AUTOREGISTER in os.environ.keys(
            ) and os.environ[ENABLE_AUTOREGISTER].lower() == u'true':
                dao.SiteUser(
                    email=users.get_current_user().email().lower()).put()
                jinja_template = ui.get_template(self, u'register.html')
                jinja_template_values = dao.get_standard_site_values()
            else:
                jinja_template = ui.get_template(self, u'register_closed.html')
                jinja_template_values = dao.get_standard_site_values()
        else:
            jinja_template = ui.get_template(self, u'login.html')
            jinja_template_values = {
                u'url': users.create_login_url(self.request.uri)
            }

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #20
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))
Example #21
0
    def render(self, template, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/document/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'doc_style'] = self.request.get(u'doc_style')
        jinja_template_values[u'doc_style_names'] = dao.get_style_names(template)

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #22
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))
Example #23
0
    def get(self):
        project = dao.get_project_by_id(self.request.get(u'project_id'))
        if not dao.test_project_permissions(project, []):
            webapp2.abort(401)

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

        jinja_template_values = dao.get_standard_project_values(project)
        jinja_template_values[u'users'] = dao.get_project_users(project)

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

        jinja_template_values = dao.get_standard_project_values(project)
        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))
Example #25
0
    def render(self, project, attachment, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(
            self, u'project_admin/attachment_edit.html')

        jinja_template_values = dao.get_standard_project_values(project)
        jinja_template_values[u'attachment_id'] = attachment.key.id()
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'name'] = attachment.name
        jinja_template_values[u'description'] = attachment.description
        jinja_template_values[u'filename'] = attachment.filename

        self.response.out.write(jinja_template.render(jinja_template_values))
    def render(self, error_msg):
        # Create template and template values, render the page
        jinja_template = ui.get_template(
            self, u'site_admin/project_or_template_delete.html')

        jinja_template_values = dao.get_standard_site_values()
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'name'] = self.request.get(u'name')
        jinja_template_values[u'email'] = self.request.get(u'email')
        jinja_template_values[u'project_or_template_type'] = self.request.get(
            u'project_or_template_type')

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #27
0
    def render(self, template_entity_id, template_entity, error_msg):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self,
                                         u'site_admin/template_edit.html')

        jinja_template_values = dao.get_standard_site_values()
        jinja_template_values[u'template_id'] = template_entity_id
        jinja_template_values[u'error_msg'] = error_msg
        jinja_template_values[u'name'] = template_entity.name
        jinja_template_values[u'description'] = template_entity.description
        jinja_template_values[u'status'] = template_entity.status

        self.response.out.write(jinja_template.render(jinja_template_values))
Example #28
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))
Example #29
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))
Example #30
0
    def render(self, template, error_msg=None):
        # Create template and template values, render the page
        jinja_template = ui.get_template(self, u'template/variable/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'type'] = self.request.get(u'type')
        jinja_template_values[u'input_field'] = self.request.get(
            u'input_field')

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