Example #1
0
 def display_websites(self, domain):
     if apps.isinstalled('orchestra.contrib.websites'):
         websites = domain.websites.all()
         if websites:
             links = []
             for website in websites:
                 site_link = get_on_site_link(website.get_absolute_url())
                 admin_url = change_url(website)
                 link = '<a href="%s">%s %s</a>' % (admin_url, website.name, site_link)
                 links.append(link)
             return '<br>'.join(links)
     site_link = get_on_site_link('http://%s' % domain.name)
     return _("No website %s") % site_link
Example #2
0
 def display_websites(self, domain):
     if apps.isinstalled('orchestra.contrib.websites'):
         websites = domain.websites.all()
         if websites:
             links = []
             for website in websites:
                 site_link = get_on_site_link(website.get_absolute_url())
                 admin_url = change_url(website)
                 title = _("Edit website")
                 link = format_html('<a href="{}" title="{}">{} {}</a>',
                                    admin_url, title, website.name,
                                    site_link)
                 links.append(link)
             return '<br>'.join(links)
         add_url = reverse('admin:websites_website_add')
         add_url += '?account=%i&domains=%i' % (domain.account_id,
                                                domain.pk)
         add_link = format_html(
             '<a href="{}" title="{}"><img src="{}" /></a>',
             add_url,
             _("Add website"),
             static('orchestra/images/add.png'),
         )
         return _("No website %s") % (add_link)
     return '---'
Example #3
0
 def display_webapps(self, website):
     webapps = []
     for content in website.content_set.all():
         site_link = get_on_site_link(content.get_absolute_url())
         webapp = content.webapp
         detail = _("Edit Webapp") + ' ' + webapp.get_type_display()
         try:
             detail += ' ' + webapp.type_instance.get_detail()
         except KeyError:
             pass
         url = change_url(webapp)
         name = "%s on %s" % (webapp.name, content.path or '/')
         webapps.append('<a href="%s" title="%s">%s %s</a>' % (url, detail, name, site_link))
     return '<br>'.join(webapps)
Example #4
0
 def display_websites(self, webapp):
     websites = []
     for content in webapp.content_set.all():
         site_url = content.get_absolute_url()
         site_link = get_on_site_link(site_url)
         website = content.website
         name = "%s on %s %s" % (website.name, content.path, site_link)
         link = admin_link(display=name)(website)
         websites.append(link)
     if not websites:
         add_url = reverse('admin:websites_website_add')
         add_url += '?account=%s' % webapp.account_id
         plus = '<strong style="color:green; font-size:12px">+</strong>'
         websites.append('<a href="%s">%s%s</a>' % (add_url, plus, ugettext("Add website")))
     return '<br>'.join(websites)
Example #5
0
 def display_url(self, saas):
     site_domain = saas.get_site_domain()
     site_link = '<a href="http://%s">%s</a>' % (site_domain, site_domain)
     links = [site_link]
     if saas.custom_url and isinstalled("orchestra.contrib.websites"):
         try:
             website = saas.service_instance.get_website()
         except ObjectDoesNotExist:
             warning = _("Related website directive does not exist for this custom URL.")
             link = '<span style="color:red" title="%s">%s</span>' % (warning, saas.custom_url)
         else:
             website_link = get_on_site_link(saas.custom_url)
             admin_url = change_url(website)
             link = '<a title="Edit website" href="%s">%s %s</a>' % (admin_url, saas.custom_url, website_link)
         links.append(link)
     return "<br>".join(links)
Example #6
0
 def display_webapps(self, website):
     webapps = []
     for content in website.content_set.all():
         site_link = get_on_site_link(content.get_absolute_url())
         webapp = content.webapp
         detail = _("Edit Webapp") + ' ' + webapp.get_type_display()
         try:
             detail += ' ' + webapp.type_instance.get_detail()
         except KeyError:
             pass
         url = change_url(webapp)
         name = "%s on %s" % (webapp.name, content.path or '/')
         webapp_info = format_html('<a href="{}" title="{}">{}</a> {}', url,
                                   detail, name, site_link)
         webapps.append(webapp_info)
     return '<br>'.join(webapps)
Example #7
0
 def display_url(self, saas):
     site_domain = saas.get_site_domain()
     site_link = '<a href="http://%s">%s</a>' % (site_domain, site_domain)
     links = [site_link]
     if saas.custom_url and isinstalled('orchestra.contrib.websites'):
         try:
             website = saas.service_instance.get_website()
         except ObjectDoesNotExist:
             warning = _("Related website directive does not exist for this custom URL.")
             link = '<span style="color:red" title="%s">%s</span>' % (warning, saas.custom_url)
         else:
             website_link = get_on_site_link(saas.custom_url)
             admin_url = change_url(website)
             link = '<a title="Edit website" href="%s">%s %s</a>' % (
                 admin_url, saas.custom_url, website_link
             )
         links.append(link)
     return '<br>'.join(links)
Example #8
0
 def display_websites(self, domain):
     if apps.isinstalled('orchestra.contrib.websites'):
         websites = domain.websites.all()
         if websites:
             links = []
             for website in websites:
                 site_link = get_on_site_link(website.get_absolute_url())
                 admin_url = change_url(website)
                 title = _("Edit website")
                 link = '<a href="%s" title="%s">%s %s</a>' % (
                     admin_url, title, website.name, site_link)
                 links.append(link)
             return '<br>'.join(links)
         add_url = reverse('admin:websites_website_add')
         add_url += '?account=%i&domains=%i' % (domain.account_id, domain.pk)
         image = '<img src="%s"></img>' % static('orchestra/images/add.png')
         add_link = '<a href="%s" title="%s">%s</a>' % (
             add_url, _("Add website"), image
         )
         return _("No website %s") % (add_link)
     return '---'