예제 #1
0
 def activation(self):
     if self.context.active:
         text = 'deactivate'
         return Link('+deactivate', text, icon='edit')
     else:
         text = 'activate'
         return Link('+activate', text, icon='edit')
예제 #2
0
 def nominate(self):
     """Return the 'Target/Nominate for series' Link."""
     launchbag = getUtility(ILaunchBag)
     target = launchbag.product or launchbag.distribution
     if check_permission("launchpad.Driver", target):
         text = "Target to series"
         return Link('+nominate', text, icon='milestone')
     elif (check_permission("launchpad.BugSupervisor", target) or
         self.user is None):
         text = 'Nominate for series'
         return Link('+nominate', text, icon='milestone')
     else:
         return Link('+nominate', '', enabled=False, icon='milestone')
예제 #3
0
 def rescore(self):
     """Only enabled for pending build records."""
     text = 'Rescore build'
     return Link('+rescore',
                 text,
                 icon='edit',
                 enabled=self.context.can_be_rescored)
예제 #4
0
 def addsubscriber(self):
     """Return the 'Subscribe someone else' Link."""
     text = 'Subscribe someone else'
     return Link(
         '+addsubscriber', text, icon='add', summary=(
             'Launchpad will email that person whenever this bugs '
             'changes'))
예제 #5
0
 def pending_review_mirrors(self):
     text = 'Pending-review mirrors'
     enabled = self._userCanSeeNonPublicMirrorListings()
     return Link('+pendingreviewmirrors',
                 text,
                 enabled=enabled,
                 icon='info')
예제 #6
0
 def answer_contact_for(self):
     summary = "Projects for which %s is an answer contact" % (
         self.context.displayname)
     return Link('+answer-contact-for',
                 'Answer contact for',
                 summary,
                 icon='edit')
 def view_recipes(self):
     text = 'View source package recipes'
     enabled = False
     if self.context.recipes.count():
         enabled = True
     return Link(
         '+recipes', text, icon='info', enabled=enabled, site='code')
예제 #8
0
 def branches(self):
     """Return a link to view the branches related to this series."""
     # Override to go to the branches for the product.
     text = 'Code'
     summary = 'View related branches of code'
     link = canonical_url(self.context.product, rootsite='code')
     return Link(link, text, summary=summary)
예제 #9
0
 def configure_bugtracker(self):
     text = 'Configure bug tracker'
     summary = 'Specify where bugs are tracked for this project'
     return Link(
         canonical_url(
             self.context.product, view_name='+configure-bugtracker'),
         text, summary, icon='edit')
예제 #10
0
 def cancel(self):
     """Only enabled for pending/active virtual builds."""
     text = 'Cancel build'
     return Link('+cancel',
                 text,
                 icon='edit',
                 enabled=self.context.can_be_cancelled)
예제 #11
0
 def browse_commits(self):
     """Return a link to the branch's commit log."""
     text = "All commits"
     url = "%s/log/?h=%s" % (
         self.context.repository.getCodebrowseUrl(),
         quote_plus(self.context.name.encode("UTF-8")))
     return Link(url, text)
예제 #12
0
 def retry(self):
     """Only enabled for build records that are active."""
     text = 'Retry this build'
     return Link('+retry',
                 text,
                 icon='retry',
                 enabled=self.context.can_be_retried)
예제 #13
0
 def translations_to_review(self):
     text = 'Translations to review'
     enabled = person_is_reviewer(self.person)
     return Link('+translations-to-review',
                 text,
                 enabled=enabled,
                 icon='info',
                 site='translations')
예제 #14
0
 def licensing(self):
     text = 'Translations licensing'
     enabled = (self.person == self.user)
     return Link('+licensing',
                 text,
                 enabled=enabled,
                 icon='info',
                 site='translations')
예제 #15
0
 def list_all(self):
     """Return a Link to list all FAQs."""
     # We adapt to IFAQCollection so that the link can be used
     # on objects which don't provide `IFAQCollection` directly, but for
     # which an adapter exists that gives the proper context.
     collection = IFAQCollection(self.context)
     url = canonical_url(collection, rootsite='answers') + '/+faqs'
     return Link(url, 'List all FAQs', icon='info')
예제 #16
0
 def linktocve(self):
     """Return the 'Link to CVE' Link."""
     text = structured(
         'Link to '
         '<abbr title="Common Vulnerabilities and Exposures Index">'
         'CVE'
         '</abbr>')
     return Link('+linkcve', text, icon='add')
예제 #17
0
 def view_snaps(self):
     text = 'View snap packages'
     context = self.context
     if isinstance(context, DecoratedBranch):
         context = context.branch
     enabled = not getUtility(ISnapSet).findByContext(
         context, visible_by_user=self.user).is_empty()
     return Link('+snaps', text, icon='info', enabled=enabled)
예제 #18
0
    def create_snap(self):
        # Only enabled if the snap_private flag is enabled for
        # private contexts.
        enabled = (
            not self.context.private or
            bool(getFeatureFlag(SNAP_PRIVATE_FEATURE_FLAG)))

        text = 'Create snap package'
        return Link('+new-snap', text, enabled=enabled, icon='add')
예제 #19
0
 def subscription(self):
     if self.context.hasSubscription(self.user):
         url = '+edit-subscription'
         text = 'Edit your subscription'
         icon = 'edit'
     else:
         url = '+subscribe'
         text = 'Subscribe yourself'
         icon = 'add'
     return Link(url, text, icon=icon)
예제 #20
0
 def sign(self):
     text = 'Sign it'
     if (self.context.current and
         self.user and
         not self.user.is_ubuntu_coc_signer):
         # Then...
         enabled = True
     else:
         enabled = False
     return Link('+sign', text, enabled=enabled, icon='edit')
예제 #21
0
 def set_branch(self):
     """Return a link to set the bazaar branch for this series."""
     if self.context.branch is None:
         text = 'Link to branch'
         icon = 'add'
         summary = 'Set the branch for this series'
     else:
         text = "Change branch"
         icon = 'edit'
         summary = 'Change the branch for this series'
     return Link('+setbranch', text, summary, icon=icon)
예제 #22
0
 def create_faq(self):
     """Return a Link to create a new FAQ."""
     collection = IFAQCollection(self.context)
     if IProjectGroup.providedBy(self.context):
         url = ''
         enabled = False
     else:
         url = canonical_url(collection,
                             view_name='+createfaq',
                             rootsite='answers')
         enabled = True
     return Link(url, 'Create a new FAQ', icon='add', enabled=enabled)
예제 #23
0
 def link_blueprint(self):
     if list(self.context.getSpecificationLinks(self.user)):
         text = 'Link to another blueprint'
     else:
         text = 'Link to a blueprint'
     # XXX: JonathanLange 2009-05-13 spec=package-branches: Actually,
     # distroseries can also have blueprints, so it makes sense to
     # associate package-branches with them.
     #
     # Since the blueprints are only related to products, there is no
     # point showing this link if the branch is junk.
     enabled = self.context.product is not None
     return Link('+linkblueprint', text, icon='add', enabled=enabled)
예제 #24
0
    def translationdownload(self):
        text = 'Download'
        preferred_series = self.context.primary_translatable
        enabled = (service_uses_launchpad(self.context.translations_usage)
                   and preferred_series is not None)
        link = ''
        if enabled:
            link = canonical_url(preferred_series,
                                 rootsite='translations',
                                 view_name='+export')
            text = 'Download "%s"' % preferred_series.name

        return Link(link, text, icon='download', enabled=enabled)
예제 #25
0
    def mute_subscription(self):
        """Return the 'Mute subscription' Link."""
        user = getUtility(ILaunchBag).user
        if self.context.bug.isMuted(user):
            text = "Unmute bug mail"
            icon = 'unmute'
        else:
            text = "Mute bug mail"
            icon = 'mute'

        return Link(
            '+mute', text, icon=icon, summary=(
                "Mute this bug so that you will not receive emails "
                "about it."))
예제 #26
0
    def request_daily_build(self):
        """Provide a link for requesting a daily build of a recipe."""
        recipe = self.context
        ppa = recipe.daily_build_archive
        if (ppa is None or not ppa.enabled or not recipe.build_daily
                or not recipe.is_stale or not recipe.distroseries):
            show_request_build = False
        else:
            has_upload = ppa.checkArchivePermission(recipe.owner)
            show_request_build = has_upload

        show_request_build = (show_request_build
                              and check_permission('launchpad.Edit', recipe))
        return Link('+request-daily-build',
                    'Build now',
                    enabled=show_request_build)
예제 #27
0
 def subscription(self):
     """Return the 'Subscribe/Unsubscribe' Link."""
     user = getUtility(ILaunchBag).user
     if user is None:
         text = 'Subscribe/Unsubscribe'
         icon = 'edit'
     elif user is not None and (
         self.context.bug.isSubscribed(user) or
         self.context.bug.isSubscribedToDupes(user)):
         if self.context.bug.isMuted(user):
             text = 'Subscribe'
             icon = 'add'
         else:
             text = 'Edit subscription'
             icon = 'edit'
     else:
         text = 'Subscribe'
         icon = 'add'
     return Link('+subscribe', text, icon=icon, summary=(
             'When you are subscribed, Launchpad will email you each time '
             'this bug changes'))
예제 #28
0
 def builds(self):
     text = 'Show builds'
     return Link('+builds', text, icon='info')
예제 #29
0
 def set_upstream(self):
     return Link("+edit-packaging",
                 "Set upstream link",
                 icon="add",
                 enabled=self.userCanDeletePackaging())
예제 #30
0
 def remove_packaging(self):
     return Link('+remove-packaging',
                 'Remove upstream link',
                 icon='remove',
                 enabled=self.userCanDeletePackaging())