Added view on site on webapps

This commit is contained in:
Marc Aymerich 2015-09-29 08:45:47 +00:00
parent 6d8ce2bbc1
commit 764301555c
7 changed files with 144 additions and 13 deletions

View File

@ -1,6 +1,7 @@
from django import forms from django import forms
from django.contrib import admin from django.contrib import admin
from django.db.models.functions import Concat, Coalesce from django.db.models.functions import Concat, Coalesce
from django.templatetags.static import static
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from orchestra.admin import ExtendedModelAdmin from orchestra.admin import ExtendedModelAdmin
@ -79,12 +80,19 @@ class DomainAdmin(AccountAdminMixin, ExtendedModelAdmin):
def display_websites(self, domain): def display_websites(self, domain):
if apps.isinstalled('orchestra.contrib.websites'): if apps.isinstalled('orchestra.contrib.websites'):
webs = domain.websites.all() websites = domain.websites.all()
if webs: if websites:
links = [] links = []
for web in webs: for website in websites:
url = change_url(web) context = {
links.append('<a href="%s">%s</a>' % (url, web.name)) 'title': _("View on site"),
'url': website.get_absolute_url(),
'image': '<img src="%s"></img>' % static('orchestra/images/view-on-site.png'),
}
site_link = '<a href="%(url)s" title="%(title)s">%(image)s</a>' % context
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) return '<br>'.join(links)
return _("No website") return _("No website")
display_websites.admin_order_field = 'websites__name' display_websites.admin_order_field = 'websites__name'

View File

@ -11,7 +11,6 @@ SYSTEMUSERS_SHELLS = Setting('SYSTEMUSERS_SHELLS',
( (
('/dev/null', _("No shell, FTP only")), ('/dev/null', _("No shell, FTP only")),
('/bin/rssh', _("No shell, SFTP/RSYNC only")), ('/bin/rssh', _("No shell, SFTP/RSYNC only")),
('/usr/bin/git-shell', _("No shell, GIT only")),
('/bin/bash', "/bin/bash"), ('/bin/bash', "/bin/bash"),
('/bin/sh', "/bin/sh"), ('/bin/sh', "/bin/sh"),
), ),
@ -29,7 +28,6 @@ SYSTEMUSERS_DISABLED_SHELLS = Setting('SYSTEMUSERS_DISABLED_SHELLS',
default=( default=(
'/dev/null', '/dev/null',
'/bin/rssh', '/bin/rssh',
'/usr/bin/git-shell',
), ),
) )

View File

@ -1,6 +1,7 @@
from django import forms from django import forms
from django.contrib import admin from django.contrib import admin
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.templatetags.static import static
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext, ugettext_lazy as _ from django.utils.translation import ugettext, ugettext_lazy as _
@ -64,10 +65,17 @@ class WebAppAdmin(SelectPluginAdminMixin, AccountAdminMixin, ExtendedModelAdmin)
def display_websites(self, webapp): def display_websites(self, webapp):
websites = [] websites = []
for content in webapp.content_set.all(): for content in webapp.content_set.all():
context = {
'title': _("View on site"),
'url': content.get_absolute_url(),
'image': '<img src="%s"></img>' % static('orchestra/images/view-on-site.png'),
}
site_link = '<a href="%(url)s" title="%(title)s">%(image)s</a>' % context
website = content.website website = content.website
url = change_url(website) admin_url = change_url(website)
name = "%s on %s" % (website.name, content.path) name = "%s on %s" % (website.name, content.path)
websites.append('<a href="%s">%s</a>' % (url, name)) link = '<a href="%s">%s %s</a>' % (admin_url, name, site_link)
websites.append(link)
if not websites: if not websites:
add_url = reverse('admin:websites_website_add') add_url = reverse('admin:websites_website_add')
add_url += '?account=%s' % webapp.account_id add_url += '?account=%s' % webapp.account_id

View File

@ -1,8 +1,5 @@
import os
import textwrap import textwrap
from django.utils.translation import ugettext_lazy as _
from orchestra.contrib.orchestration import ServiceController from orchestra.contrib.orchestration import ServiceController
@ -10,7 +7,7 @@ class WordPressURLBackend(ServiceController):
""" """
Configures WordPress site URL with associated website domain. Configures WordPress site URL with associated website domain.
""" """
verbose_name = _("WordPress URL") verbose_name = "WordPress URL"
model = 'websites.Content' model = 'websites.Content'
default_route_match = "content.webapp.type == 'wordpress-php'" default_route_match = "content.webapp.type == 'wordpress-php'"

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="10"
height="10"
viewBox="0 0 1120 1120"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="view-on-site.svg"
inkscape:export-filename="/home/glic3rinu/orchestra/django-orchestra/orchestra/static/orchestra/images/view-on-site.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<metadata
id="metadata50">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1024"
id="namedview48"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:zoom="19.666667"
inkscape:cx="-1.2324659"
inkscape:cy="13.73059"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<sodipodi:guide
orientation="0,1"
position="28.474576,210.71186"
id="guide3371" />
</sodipodi:namedview>
<defs
id="defs4">
<g
id="up">
<path
d="m 1412,895 q 0,-27 -18,-45 L 1032,488 941,397 q -18,-18 -45,-18 -27,0 -45,18 l -91,91 -362,362 q -18,18 -18,45 0,27 18,45 l 91,91 q 18,18 45,18 27,0 45,-18 L 768,842 v 502 q 0,26 19,45 19,19 45,19 h 128 q 26,0 45,-19 19,-19 19,-45 V 842 l 189,189 q 19,19 45,19 26,0 45,-19 l 91,-91 q 18,-18 18,-45 z m 252,1 q 0,209 -103,385.5 Q 1458,1458 1281.5,1561 1105,1664 896,1664 687,1664 510.5,1561 334,1458 231,1281.5 128,1105 128,896 128,687 231,510.5 334,334 510.5,231 687,128 896,128 1105,128 1281.5,231 1458,334 1561,510.5 1664,687 1664,896 z"
id="path7"
inkscape:connector-curvature="0" />
</g>
<g
id="down">
<path
d="m 1412,897 q 0,-27 -18,-45 l -91,-91 q -18,-18 -45,-18 -27,0 -45,18 L 1024,950 V 448 q 0,-26 -19,-45 -19,-19 -45,-19 H 832 q -26,0 -45,19 -19,19 -19,45 V 950 L 579,761 q -19,-19 -45,-19 -26,0 -45,19 l -91,91 q -18,18 -18,45 0,27 18,45 l 362,362 91,91 q 18,18 45,18 27,0 45,-18 l 91,-91 362,-362 q 18,-18 18,-45 z m 252,-1 q 0,209 -103,385.5 Q 1458,1458 1281.5,1561 1105,1664 896,1664 687,1664 510.5,1561 334,1458 231,1281.5 128,1105 128,896 128,687 231,510.5 334,334 510.5,231 687,128 896,128 1105,128 1281.5,231 1458,334 1561,510.5 1664,687 1664,896 z"
id="path10"
inkscape:connector-curvature="0" />
</g>
<g
id="left">
<path
d="M 1408,960 V 832 q 0,-26 -19,-45 -19,-19 -45,-19 H 842 l 189,-189 q 19,-19 19,-45 0,-26 -19,-45 l -91,-91 q -18,-18 -45,-18 -27,0 -45,18 l -362,362 -91,91 q -18,18 -18,45 0,27 18,45 l 91,91 362,362 q 18,18 45,18 27,0 45,-18 l 91,-91 q 18,-18 18,-45 0,-27 -18,-45 L 842,1024 h 502 q 26,0 45,-19 19,-19 19,-45 z m 256,-64 q 0,209 -103,385.5 Q 1458,1458 1281.5,1561 1105,1664 896,1664 687,1664 510.5,1561 334,1458 231,1281.5 128,1105 128,896 128,687 231,510.5 334,334 510.5,231 687,128 896,128 1105,128 1281.5,231 1458,334 1561,510.5 1664,687 1664,896 z"
id="path13"
inkscape:connector-curvature="0" />
</g>
<g
id="right">
<path
d="m 1413,896 q 0,-27 -18,-45 L 1304,760 942,398 q -18,-18 -45,-18 -27,0 -45,18 l -91,91 q -18,18 -18,45 0,27 18,45 L 950,768 H 448 q -26,0 -45,19 -19,19 -19,45 v 128 q 0,26 19,45 19,19 45,19 h 502 l -189,189 q -19,19 -19,45 0,26 19,45 l 91,91 q 18,18 45,18 27,0 45,-18 l 362,-362 91,-91 q 18,-18 18,-45 z m 251,0 q 0,209 -103,385.5 Q 1458,1458 1281.5,1561 1105,1664 896,1664 687,1664 510.5,1561 334,1458 231,1281.5 128,1105 128,896 128,687 231,510.5 334,334 510.5,231 687,128 896,128 1105,128 1281.5,231 1458,334 1561,510.5 1664,687 1664,896 z"
id="path16"
inkscape:connector-curvature="0" />
</g>
<g
id="clearall">
<path
transform="matrix(0.75,0,0,0.75,336,336)"
d="m 1037,1395 102,-102 q 19,-19 19,-45 0,-26 -19,-45 L 832,896 1139,589 q 19,-19 19,-45 0,-26 -19,-45 L 1037,397 q -19,-19 -45,-19 -26,0 -45,19 L 493,851 q -19,19 -19,45 0,26 19,45 l 454,454 q 19,19 45,19 26,0 45,-19 z m 627,-499 q 0,209 -103,385.5 Q 1458,1458 1281.5,1561 1105,1664 896,1664 687,1664 510.5,1561 334,1458 231,1281.5 128,1105 128,896 128,687 231,510.5 334,334 510.5,231 687,128 896,128 1105,128 1281.5,231 1458,334 1561,510.5 1664,687 1664,896 z"
id="path19"
inkscape:connector-curvature="0" />
</g>
<g
id="chooseall">
<path
transform="matrix(0.75,0,0,0.75,336,336)"
d="m 845,1395 454,-454 q 19,-19 19,-45 0,-26 -19,-45 L 845,397 q -19,-19 -45,-19 -26,0 -45,19 L 653,499 q -19,19 -19,45 0,26 19,45 l 307,307 -307,307 q -19,19 -19,45 0,26 19,45 l 102,102 q 19,19 45,19 26,0 45,-19 z m 819,-499 q 0,209 -103,385.5 Q 1458,1458 1281.5,1561 1105,1664 896,1664 687,1664 510.5,1561 334,1458 231,1281.5 128,1105 128,896 128,687 231,510.5 334,334 510.5,231 687,128 896,128 1105,128 1281.5,231 1458,334 1561,510.5 1664,687 1664,896 z"
id="path22"
inkscape:connector-curvature="0" />
</g>
</defs>
<use
xlink:href="#chooseall"
x="0"
y="19712"
id="use46"
style="fill:#447e9b"
width="1792"
height="21504"
transform="matrix(0.97281073,0,0,0.97281073,-421.06779,-19594.265)" />
</svg>

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -40,10 +40,14 @@ sed -i "s/\tlocalhost$/\tlocalhost $NAME/" $CONTAINER/etc/hosts
sed -i "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" $CONTAINER/etc/locale.gen sed -i "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" $CONTAINER/etc/locale.gen
chroot $CONTAINER locale-gen chroot $CONTAINER locale-gen
echo -e "#!/bin/sh\nexit 101\n" > $CONTAINER/usr/sbin/policy-rc.d
chmod 755 $CONTAINER/usr/sbin/policy-rc.d
chroot $CONTAINER apt-get update chroot $CONTAINER apt-get update
chroot $CONTAINER apt-get install -y --force-yes \ chroot $CONTAINER apt-get install -y --force-yes \
nano git screen sudo iputils-ping python3 python3-pip wget curl dnsutils rsyslog nano git screen sudo iputils-ping python3 python3-pip wget curl dnsutils rsyslog
rm $CONTAINER/usr/sbin/policy-rc.d
chroot $CONTAINER apt-get clean chroot $CONTAINER apt-get clean