Пример #1
0
    def get(self):
        artifact_id = to_int(self.get_argument('artifact_id'))
        info = artifact_get_req(self.current_user.id, artifact_id)
        status = info['visibility']
        buttons = []

        btn_base = ('<button onclick="set_admin_visibility(\'%s\', {0})" '
                    'class="btn btn-primary">%s</button>').format(artifact_id)

        if qiita_config.require_approval:
            if status == 'sandbox':
                # The request approval button only appears if the processed
                # data issandboxed and the qiita_config specifies that the
                # approval should be requested
                buttons.append(btn_base %
                               ('awaiting_approval', 'Request approval'))
            elif self.current_user.level == 'admin' and \
                    status == 'awaiting_approval':
                # The approve processed data button only appears if the user is
                # an admin, the processed data is waiting to be approved and
                # the qiita config requires processed data approval
                buttons.append(btn_base % ('private', 'Approve artifact'))
        if status == 'private':
            # The make public button only appears if the status is private
            buttons.append(btn_base % ('public', 'Make public'))

        # The revert to sandbox button only appears if the processed data is
        # not sandboxed or public
        if status not in {'sandbox', 'public'}:
            buttons.append(btn_base % ('sandbox', 'Revert to sandbox'))

        # Add EBI and VAMPS submission buttons if allowed
        if not info['ebi_run_accessions'] and info['can_submit_ebi']:
            buttons.append('<a class="btn btn-primary glyphicon '
                           'glyphicon-export" href="/ebi_submission/{{ppd_id}}'
                           '" style="word-spacing: -10px;"> Submit to EBI</a>')
        if not info['is_submitted_vamps'] and \
                info['can_submit_vamps']:
            buttons.append('<a class="btn btn-primary glyphicon '
                           'glyphicon-export" href="/vamps/{{ppd_id}}" '
                           'style="word-spacing: -10px;"> Submit to VAMPS</a>')
        # Add delete button if in sandbox status
        if status == 'sandbox':
            buttons = [
                '<button class="btn btn-danger" '
                'onclick="delete_artifact(%d)">Delete Artifact</button>' %
                (artifact_id)
            ]

        self.write(' '.join(buttons))
Пример #2
0
    def get(self):
        artifact_id = to_int(self.get_argument('artifact_id'))
        info = artifact_get_req(self.current_user.id, artifact_id)
        status = info['visibility']
        buttons = []

        btn_base = ('<button onclick="set_admin_visibility(\'%s\', {0})" '
                    'class="btn btn-primary">%s</button>').format(artifact_id)

        if qiita_config.require_approval:
            if status == 'sandbox':
                # The request approval button only appears if the processed
                # data issandboxed and the qiita_config specifies that the
                # approval should be requested
                buttons.append(
                    btn_base % ('awaiting_approval', 'Request approval'))
            elif self.current_user.level == 'admin' and \
                    status == 'awaiting_approval':
                # The approve processed data button only appears if the user is
                # an admin, the processed data is waiting to be approved and
                # the qiita config requires processed data approval
                buttons.append(btn_base % ('private', 'Approve artifact'))
        if status == 'private':
            # The make public button only appears if the status is private
            buttons.append(btn_base % ('public', 'Make public'))

        # The revert to sandbox button only appears if the processed data is
        # not sandboxed or public
        if status not in {'sandbox', 'public'}:
            buttons.append(btn_base % ('sandbox', 'Revert to sandbox'))

        # Add EBI and VAMPS submission buttons if allowed
        if not info['ebi_run_accessions'] and info['can_submit_ebi']:
            buttons.append('<a class="btn btn-primary glyphicon '
                           'glyphicon-export" href="/ebi_submission/{{ppd_id}}'
                           '" style="word-spacing: -10px;"> Submit to EBI</a>')
        if not info['is_submitted_vamps'] and \
                info['can_submit_vamps']:
            buttons.append('<a class="btn btn-primary glyphicon '
                           'glyphicon-export" href="/vamps/{{ppd_id}}" '
                           'style="word-spacing: -10px;"> Submit to VAMPS</a>')
        # Add delete button if in sandbox status
        if status == 'sandbox':
            buttons = ['<button class="btn btn-danger" '
                       'onclick="delete_artifact(%d)">Delete Artifact</button>'
                       % (artifact_id)]

        self.write(' '.join(buttons))
Пример #3
0
 def get(self):
     artifact_id = to_int(self.get_argument('artifact_id'))
     name = artifact_get_req(self.current_user.id, artifact_id)['name']
     self.write(name)
Пример #4
0
 def get(self):
     artifact_id = to_int(self.get_argument('artifact_id'))
     name = artifact_get_req(self.current_user.id, artifact_id)['name']
     self.write(name)