Commit 2be27bf9cd1801ded98cefbbe7c01544ecd3aede
1 parent
c7f6314f
Exists in
master
and in
39 other branches
Moved all trac bits to it's own django app
Showing
13 changed files
with
253 additions
and
300 deletions
Show diff stats
src/proxy/diazo/jenkins.xml
... | ... | @@ -1,27 +0,0 @@ |
1 | -<rules | |
2 | - xmlns="http://namespaces.plone.org/diazo" | |
3 | - xmlns:css="http://namespaces.plone.org/diazo/css" | |
4 | - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
5 | - | |
6 | - <before theme-children="/html/head" content-children="/html/head" /> | |
7 | - <before css:theme-children="#main-content" css:content-children="body" /> | |
8 | - | |
9 | - <merge attributes="class" css:theme="body" css:content="body" /> | |
10 | - <drop css:content="#top-panel" /> | |
11 | - | |
12 | - <drop attributes="style" css:content="#main-table" /> | |
13 | - | |
14 | - <after theme-children="/html/head"> | |
15 | - <script>jQuery.noConflict();</script> | |
16 | - <style> | |
17 | - #breadcrumbs { | |
18 | - border: 0 !important; | |
19 | - } | |
20 | - | |
21 | - #right-top-nav { | |
22 | - margin-right: 5em !important; | |
23 | - } | |
24 | - </style> | |
25 | - </after> | |
26 | - | |
27 | -</rules> |
src/proxy/diazo/trac.xml
... | ... | @@ -1,45 +0,0 @@ |
1 | -<rules | |
2 | - xmlns="http://namespaces.plone.org/diazo" | |
3 | - xmlns:css="http://namespaces.plone.org/diazo/css" | |
4 | - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
5 | - | |
6 | - <replace css:theme="#trac-css" content="//head/link" /> | |
7 | - <replace css:theme="#trac-js" content="//head/script" /> | |
8 | - <replace theme="//head/title" content="//head/title" /> | |
9 | - | |
10 | - <before css:theme-children="#main-content" css:content="#main" /> | |
11 | - | |
12 | - <after theme-children="/html/head"> | |
13 | - <style> | |
14 | - .navbar .nav ul { font-size: 14px; text-align: left; padding: 5px 0; } | |
15 | - .navbar .nav li { border: 0; padding: 0; white-space: normal; display: list-item;} | |
16 | - :link:not(.btn), | |
17 | - :visited:not(.btn) { border: 0; color: rgb(66, 139, 202); } | |
18 | - h1 { font-size: 24px; margin: 0.15em 1em 0.5em 0px; } | |
19 | - h2 { font-size: 20px } | |
20 | - h3 { font-size: 16px } | |
21 | - h4 { font-size: 14px } | |
22 | - input[type="checkbox"], input[type="radio"] { margin: 0 4px; } | |
23 | - fieldset { padding: 1em; margin: 1em 0; border: 1px solid rgb(215, 215, 215); } | |
24 | - label { font-weight: 400; } | |
25 | - legend { margin-bottom: 0; width: auto; } | |
26 | - input, textarea, select { margin: 2px; } | |
27 | - | |
28 | - .wikitoolbar, | |
29 | - .wikitoolbar:before, | |
30 | - .wikitoolbar:after { | |
31 | - -moz-box-sizing: content-box; | |
32 | - -webkit-box-sizing: content-box; | |
33 | - } | |
34 | - .wikitoolbar :link, | |
35 | - .wikitoolbar :visited { | |
36 | - border-width: 1px; | |
37 | - border-style: solid; | |
38 | - border-color: #fff #fff #fff #ccc; | |
39 | - -moz-box-sizing: content-box; | |
40 | - -webkit-box-sizing: content-box; | |
41 | - } | |
42 | - </style> | |
43 | - </after> | |
44 | - | |
45 | -</rules> |
... | ... | @@ -0,0 +1,27 @@ |
1 | +<rules | |
2 | + xmlns="http://namespaces.plone.org/diazo" | |
3 | + xmlns:css="http://namespaces.plone.org/diazo/css" | |
4 | + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
5 | + | |
6 | + <before theme-children="/html/head" content-children="/html/head" /> | |
7 | + <before css:theme-children="#main-content" css:content-children="body" /> | |
8 | + | |
9 | + <merge attributes="class" css:theme="body" css:content="body" /> | |
10 | + <drop css:content="#top-panel" /> | |
11 | + | |
12 | + <drop attributes="style" css:content="#main-table" /> | |
13 | + | |
14 | + <after theme-children="/html/head"> | |
15 | + <script>jQuery.noConflict();</script> | |
16 | + <style> | |
17 | + #breadcrumbs { | |
18 | + border: 0 !important; | |
19 | + } | |
20 | + | |
21 | + #right-top-nav { | |
22 | + margin-right: 5em !important; | |
23 | + } | |
24 | + </style> | |
25 | + </after> | |
26 | + | |
27 | +</rules> | ... | ... |
src/proxy/search_indexes.py
... | ... | @@ -1,157 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | - | |
3 | -import math | |
4 | -import string | |
5 | - | |
6 | -from django.template import loader, Context | |
7 | -from django.utils.text import slugify | |
8 | -from haystack import indexes | |
9 | -from haystack.utils import log as logging | |
10 | - | |
11 | -from search.base_indexes import BaseIndex | |
12 | -from .models import Attachment, Ticket, Wiki, Revision | |
13 | - | |
14 | - | |
15 | -logger = logging.getLogger('haystack') | |
16 | - | |
17 | -# the string maketrans always return a string encoded with latin1 | |
18 | -# http://stackoverflow.com/questions/1324067/how-do-i-get-str-translate-to-work-with-unicode-strings | |
19 | -table = string.maketrans( | |
20 | - string.punctuation, | |
21 | - '.' * len(string.punctuation) | |
22 | -).decode('latin1') | |
23 | - | |
24 | - | |
25 | -class AttachmentIndex(BaseIndex, indexes.Indexable): | |
26 | - title = indexes.CharField(model_attr='filename') | |
27 | - description = indexes.CharField(model_attr='description', null=True) | |
28 | - modified = indexes.DateTimeField(model_attr='created', null=True) | |
29 | - used_by = indexes.CharField(model_attr='used_by', null=True, stored=False) | |
30 | - mimetype = indexes.CharField( | |
31 | - model_attr='mimetype', | |
32 | - null=True, | |
33 | - stored=False | |
34 | - ) | |
35 | - size = indexes.IntegerField(model_attr='size', null=True, stored=False) | |
36 | - filename = indexes.CharField(stored=False) | |
37 | - | |
38 | - def get_model(self): | |
39 | - return Attachment | |
40 | - | |
41 | - def get_updated_field(self): | |
42 | - return 'created' | |
43 | - | |
44 | - def prepare(self, obj): | |
45 | - data = super(AttachmentIndex, self).prepare(obj) | |
46 | - | |
47 | - try: | |
48 | - file_obj = open(obj.filepath) | |
49 | - except IOError as e: | |
50 | - logger.warning(u'IOError: %s - %s', e.strerror, e.filename) | |
51 | - return data | |
52 | - backend = self._get_backend(None) | |
53 | - | |
54 | - extracted_data = backend.extract_file_contents(file_obj) | |
55 | - file_obj.close() | |
56 | - | |
57 | - if not extracted_data: | |
58 | - return data | |
59 | - | |
60 | - t = loader.select_template( | |
61 | - ('search/indexes/proxy/attachment_text.txt', ) | |
62 | - ) | |
63 | - data['text'] = t.render(Context({ | |
64 | - 'object': obj, | |
65 | - 'extracted': extracted_data, | |
66 | - })) | |
67 | - return data | |
68 | - | |
69 | - def prepare_filename(self, obj): | |
70 | - return obj.filename.translate(table).replace('.', ' ') | |
71 | - | |
72 | - def prepare_icon_name(self, obj): | |
73 | - return u'file' | |
74 | - | |
75 | - def prepare_type(self, obj): | |
76 | - return u'attachment' | |
77 | - | |
78 | - | |
79 | -class WikiIndex(BaseIndex, indexes.Indexable): | |
80 | - title = indexes.CharField(model_attr='name') | |
81 | - collaborators = indexes.CharField( | |
82 | - model_attr='collaborators', | |
83 | - null=True, | |
84 | - stored=False, | |
85 | - ) | |
86 | - | |
87 | - def get_model(self): | |
88 | - return Wiki | |
89 | - | |
90 | - def prepare_description(self, obj): | |
91 | - return u'{}\n{}'.format(obj.wiki_text, obj.collaborators) | |
92 | - | |
93 | - def prepare_icon_name(self, obj): | |
94 | - return u'book' | |
95 | - | |
96 | - def prepare_type(self, obj): | |
97 | - return u'wiki' | |
98 | - | |
99 | - | |
100 | -class TicketIndex(BaseIndex, indexes.Indexable): | |
101 | - tag = indexes.CharField(model_attr='status', null=True) | |
102 | - milestone = indexes.CharField(model_attr='milestone', null=True) | |
103 | - component = indexes.CharField(model_attr='component', null=True) | |
104 | - severity = indexes.CharField(model_attr='severity', null=True) | |
105 | - reporter = indexes.CharField(model_attr='reporter', null=True) | |
106 | - keywords = indexes.CharField(model_attr='keywords', null=True) | |
107 | - collaborators = indexes.CharField( | |
108 | - model_attr='collaborators', | |
109 | - null=True, | |
110 | - stored=False, | |
111 | - ) | |
112 | - | |
113 | - def get_model(self): | |
114 | - return Ticket | |
115 | - | |
116 | - def prepare_description(self, obj): | |
117 | - return u'{}\n{}\n{}\n{}\n{}\n{}\n{}'.format( | |
118 | - obj.description, obj.milestone, obj.component, obj.severity, | |
119 | - obj.reporter, obj.keywords, obj.collaborators | |
120 | - ) | |
121 | - | |
122 | - def prepare_icon_name(self, obj): | |
123 | - return u'tag' | |
124 | - | |
125 | - def prepare_title(self, obj): | |
126 | - return u'#{} - {}'.format(obj.pk, obj.summary) | |
127 | - | |
128 | - def prepare_type(self, obj): | |
129 | - return 'ticket' | |
130 | - | |
131 | - | |
132 | -class RevisionIndex(BaseIndex, indexes.Indexable): | |
133 | - description = indexes.CharField(model_attr='message', null=True) | |
134 | - modified = indexes.DateTimeField(model_attr='created', null=True) | |
135 | - repository_name = indexes.CharField( | |
136 | - model_attr='repository_name', | |
137 | - stored=False | |
138 | - ) | |
139 | - | |
140 | - def get_model(self): | |
141 | - return Revision | |
142 | - | |
143 | - def get_updated_field(self): | |
144 | - return 'created' | |
145 | - | |
146 | - def get_boost(self, obj): | |
147 | - boost = super(RevisionIndex, self).get_boost(obj) | |
148 | - return boost * 0.8 | |
149 | - | |
150 | - def prepare_icon_name(self, obj): | |
151 | - return u'align-right' | |
152 | - | |
153 | - def prepare_title(self, obj): | |
154 | - return u'{} [{}]'.format(obj.repository_name, obj.rev) | |
155 | - | |
156 | - def prepare_type(self, obj): | |
157 | - return 'changeset' |
src/proxy/templates/proxy/trac.html
src/proxy/test.html
... | ... | @@ -1,44 +0,0 @@ |
1 | -<!DOCTYPE html><html><head> | |
2 | - | |
3 | - | |
4 | - <title>Painel Principal [Jenkins]</title><link rel="stylesheet" type="text/css" href="/ci/static/93570b24/css/style.css" /><link rel="stylesheet" type="text/css" href="/ci/static/93570b24/css/color.css" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/ci/static/93570b24/favicon.ico" /><script>var isRunAsTest=false; var rootURL="/ci"; var resURL="/ci/static/93570b24";</script><script src="/ci/static/93570b24/scripts/prototype.js" type="text/javascript"></script><script src="/ci/static/93570b24/scripts/behavior.js" type="text/javascript"></script><script src='/ci/adjuncts/93570b24/org/kohsuke/stapler/bind.js' type='text/javascript'></script><script src="/ci/static/93570b24/scripts/yui/yahoo/yahoo-min.js"></script><script src="/ci/static/93570b24/scripts/yui/dom/dom-min.js"></script><script src="/ci/static/93570b24/scripts/yui/event/event-min.js"></script><script src="/ci/static/93570b24/scripts/yui/animation/animation-min.js"></script><script src="/ci/static/93570b24/scripts/yui/dragdrop/dragdrop-min.js"></script><script src="/ci/static/93570b24/scripts/yui/container/container-min.js"></script><script src="/ci/static/93570b24/scripts/yui/connection/connection-min.js"></script><script src="/ci/static/93570b24/scripts/yui/datasource/datasource-min.js"></script><script src="/ci/static/93570b24/scripts/yui/autocomplete/autocomplete-min.js"></script><script src="/ci/static/93570b24/scripts/yui/menu/menu-min.js"></script><script src="/ci/static/93570b24/scripts/yui/element/element-min.js"></script><script src="/ci/static/93570b24/scripts/yui/button/button-min.js"></script><script src="/ci/static/93570b24/scripts/yui/storage/storage-min.js"></script><script src="/ci/static/93570b24/scripts/hudson-behavior.js" type="text/javascript"></script><script src="/ci/static/93570b24/scripts/sortable.js" type="text/javascript"></script><script>crumb.init("", "");</script><link rel="stylesheet" type="text/css" href="/ci/static/93570b24/scripts/yui/container/assets/container.css" /><link rel="stylesheet" type="text/css" href="/ci/static/93570b24/scripts/yui/assets/skins/sam/skin.css" /><link rel="stylesheet" type="text/css" href="/ci/static/93570b24/scripts/yui/container/assets/skins/sam/container.css" /><link rel="stylesheet" type="text/css" href="/ci/static/93570b24/scripts/yui/button/assets/skins/sam/button.css" /><link rel="stylesheet" type="text/css" href="/ci/static/93570b24/scripts/yui/menu/assets/skins/sam/menu.css" /><link title="Jenkins" rel="search" type="application/opensearchdescription+xml" href="/ci/opensearch.xml" /><meta name="ROBOTS" content="INDEX,NOFOLLOW" /><link title="Jenkins:Tudo (all builds)" rel="alternate" type="application/rss+xml" href="/ci/rssAll" /><link title="Jenkins:Tudo (all builds) (RSS 2.0)" rel="alternate" type="application/rss+xml" href="/ci/rssAll?flavor=rss20" /><link title="Jenkins:Tudo (failed builds)" rel="alternate" type="application/rss+xml" href="/ci/rssFailed" /><link title="Jenkins:Tudo (failed builds) (RSS 2.0)" rel="alternate" type="application/rss+xml" href="/ci/rssFailed?flavor=rss20" /><script src="/ci/static/93570b24/scripts/yui/cookie/cookie-min.js"></script><script> | |
5 | - YAHOO.util.Cookie.set("screenResolution", screen.width+"x"+screen.height); | |
6 | - </script><script src="/ci/static/93570b24/scripts/yui/cookie/cookie-min.js"></script></head><body class="yui-skin-sam"><a href="#skip2content" class="skiplink">Skip to content</a><table id="header" cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td id="top-panel" colspan="2"><table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td style="font-weight:bold; font-size: 2em;"><a href="/ci/"><img alt="title" src="/ci/static/93570b24/images/title.png" /></a></td><td style="vertical-align: middle; text-align: right; padding-right: 1em;"><form style="position:relative;" name="search" action="/ci/search/" class="no-json" method="get"><div id="search-box-minWidth"></div><div id="search-box-sizer"></div><div id="searchform"><input id="search-box" name="q" value="buscar" class="has-default-text defaulted" /> <a href="http://wiki.jenkins-ci.org/display/JENKINS/Search+Box"><img height="16" alt="help for search" width="16" src="/ci/static/93570b24/images/16x16/help.png" /></a><div id="search-box-completion"></div><script>createSearchBox("/ci/search/");</script></div></form></td><td id="login-field"><span> <a style="color:inherit" href="/ci/login?from=%2Fci%2F"><b>Logar</b></a> | |
7 | - | | |
8 | - <a href="/ci/signup"><b>registrar</b></a></span></td></tr></table></td></tr><tr id="top-nav"><td id="left-top-nav" colspan="2"><link rel='stylesheet' href='/ci/adjuncts/93570b24/lib/layout/breadcrumbs.css' type='text/css' /><script src='/ci/adjuncts/93570b24/lib/layout/breadcrumbs.js' type='text/javascript'></script><div class="top-sticker noedge"><div class="top-sticker-inner"><div id="right-top-nav"><div id="right-top-nav"><div class="smallfont"><a href="?auto_refresh=true">ENABLE AUTO REFRESH</a></div></div></div><ul id="breadcrumbs"><li class="true?null:'no-context-menu'}"><a href="/ci/">Jenkins</a></li></ul><div id="breadcrumb-menu-target"></div></div></div></td></tr></table><table id="main-table" height="70%" style="background-image: url(/ci/static/93570b24/images/jenkins.png); background-repeat: no-repeat; background-position: bottom left;" width="100%" border="0"><tr><td id="side-panel" width="20%"><div id="navigation" style="min-height: 323px; height: auto !important; height: 323px;"><div id="tasks"><div class="task"> | |
9 | - | |
10 | - | |
11 | - <a href="/ci/view/Tudo/newJob"><img height="24" style="margin: 2px;" alt="" width="24" src="/ci/static/93570b24/images/24x24/new-package.png" /></a> <a href="/ci/view/Tudo/newJob">Novo(a) Job</a></div><div class="task"> | |
12 | - | |
13 | - | |
14 | - <a href="/ci/people/"><img height="24" style="margin: 2px;" alt="" width="24" src="/ci/static/93570b24/images/24x24/user.png" /></a> <a href="/ci/people/">Pessoas</a></div><div class="task"> | |
15 | - | |
16 | - | |
17 | - <a href="/ci/view/Tudo/builds"><img height="24" style="margin: 2px;" alt="" width="24" src="/ci/static/93570b24/images/24x24/notepad.png" /></a> <a href="/ci/view/Tudo/builds">Histórico de Construções</a></div><div class="task"> | |
18 | - | |
19 | - | |
20 | - <a href="/ci/manage"><img height="24" style="margin: 2px;" alt="" width="24" src="/ci/static/93570b24/images/24x24/setting.png" /></a> <a href="/ci/manage">Gerenciar Jenkins</a></div></div><table id="buildQueue" class="pane"><tr><td colspan="2" class="pane-header">Fila de Compilação</td></tr><tr><td class="pane" colspan="2">Nenhuma compilação na fila.</td></tr></table><script defer="defer">refreshPart('buildQueue',"./ajaxBuildQueue");</script><table id="executors" class="pane"><tr><td colspan="3" class="pane-header"><a href='/ci/computer/'>Estado do Executador de Compilação</a></td></tr><colgroup><col width="1*" /><col width="200*" /><col width="24" /></colgroup><tr><th class="pane">#</th><th class="pane" colspan="2"><div style="margin-right:19px">Estado</div></th></tr><tr><td class="pane" align="right" style="vertical-align: top">1</td><td class="pane">Ocioso</td><td class="pane"></td></tr><tr><td class="pane" align="right" style="vertical-align: top">2</td><td class="pane">Ocioso</td><td class="pane"></td></tr></table><script defer="defer">refreshPart('executors',"./ajaxExecutors");</script></div></td><td id="main-panel" width="80%" height="100%"><a name="skip2content"></a><div id="view-message"><div id="description"><div></div><div align="right"><a onclick="return replaceDescription();" href="editDescription"><img height="16" alt="" width="16" src="/ci/static/93570b24/images/16x16/notepad.png" />adicionar descrição</a></div></div></div><div class="dashboard"><table cellpadding="0" cellspacing="0" id="viewList"><tr style="height:3px;"><td style="height:3px; padding:0px"></td><td class="active" rowspan="2">Tudo</td><td style="height:3px; padding:0px"></td></tr><tr><td style="border: none; border-bottom: 1px solid #bbb;"> </td><td class="inactive noLeft"><a title="Nova Visão" href="/ci/newView">+</a></td><td class="filler"> </td></tr></table><table id="projectstatus" style="margin-top:0px; border-top: none;" class="sortable pane bigtable"><tr style="border-top: 0px;"><th tooltip="Estado da última compilação"> S</th><th tooltip="Relatório de clima mostrando o status consolidado das construções recentes"> W</th><th initialSortDir="down">Name</th><th>Último Sucesso</th><th>Última Falha</th><th>Última Duração</th><th width="1"> </th><th> </th></tr><tr id="job_Portal Interlegis"><td data="0"><img alt="Falhou" class="icon32x32" src="/ci/static/93570b24/images/32x32/red.png" tooltip="Falhou" /></td><td data="0" class="healthReport" onmouseover="this.className='healthReport hover';return true; | |
21 | - " onmouseout="this.className='healthReport';return true;"><a href="job/Portal%20Interlegis/lastBuild"><img alt="0%" class="icon32x32" src="/ci/static/93570b24/images/32x32/health-00to19.png" /></a><div class="healthReportDetails"><table border="0"><thead><tr><th align="left">W</th><th align="left">Descrição</th><th align="right">%</th></tr></thead><tbody><tr><td align="left"><img title="" alt="" src="/ci/static/93570b24/images/16x16/health-00to19.png" /></td><td>Estabilidade de construção: Todas as construções recentes falharam.</td><td align="right">0</td></tr></tbody></table></div></td><td><a class="model-link" href="job/Portal%20Interlegis/">Portal Interlegis</a></td><td data="-">N/D</td><td data="2012-09-03T20:01:05Z"> | |
22 | - 1 ano 2 meses | |
23 | - (<a class="model-link" href="job/Portal%20Interlegis/lastFailedBuild/">#13</a>) | |
24 | - </td><td data="4255">4,2 segundos</td><td><a href="job/Portal%20Interlegis/build?delay=0sec"><img title="Agendar uma construção" alt="Agendar uma construção" src="/ci/static/93570b24/images/24x24/clock.png" border="0" /></a></td><td> </td></tr></table><table style="width:100%"><tr><td>Ícone: | |
25 | - <a href="/ci/iconSize?16x16">S</a> <a href="/ci/iconSize?24x24">M</a> L</td><td><div align="right" style="margin:1em"><a href="/ci/legend">Legenda</a><span style="padding-left:1em"><a href="rssAll"><img height="16" alt="Feed" width="16" src="/ci/static/93570b24/images/atom.gif" border="0" /> RSS para todos</a></span><span style="padding-left:1em"><a href="rssFailed"><img height="16" alt="Feed" width="16" src="/ci/static/93570b24/images/atom.gif" border="0" /> RSS para falhas</a></span><span style="padding-left:1em"><a href="rssLatest"><img height="16" alt="Feed" width="16" src="/ci/static/93570b24/images/atom.gif" border="0" /> RSS apenas para as últimas construções</a></span></div></td></tr></table></div></td></tr></table><table width="100%"><tr><td id="footer"><span style="padding-right:2em; color:gray"> | |
26 | - Página gerada em: | |
27 | - 21/11/2013 16:59:30</span><span style="padding-right:2em"><a href="api/">REST API</a></span><a href="http://jenkins-ci.org/">Jenkins ver. 1.477</a></td></tr></table><script>Behaviour.addLoadEvent(function() { downloadService.download("hudson.tasks.Maven.MavenInstaller","http://updates.jenkins-ci.org/updates/hudson.tasks.Maven.MavenInstaller.json",{version:"1.477"},"/ci/descriptor/hudson.model.DownloadService/byId/hudson.tasks.Maven.MavenInstaller/postBack",null);});</script><script>Behaviour.addLoadEvent(function() { downloadService.download("hudson.tasks.Ant.AntInstaller","http://updates.jenkins-ci.org/updates/hudson.tasks.Ant.AntInstaller.json",{version:"1.477"},"/ci/descriptor/hudson.model.DownloadService/byId/hudson.tasks.Ant.AntInstaller/postBack",null);});</script><script>Behaviour.addLoadEvent(function() { downloadService.download("hudson.tools.JDKInstaller","http://updates.jenkins-ci.org/updates/hudson.tools.JDKInstaller.json",{version:"1.477"},"/ci/descriptor/hudson.model.DownloadService/byId/hudson.tools.JDKInstaller/postBack",null);});</script><div id="l10n-dialog" class="dialog"></div><div id="l10n-footer" style="display:none; float:left"><a href="#" onclick="return showTranslationDialog();"><img src="/ci/plugin/translation/flags.png" /> | |
28 | - Ajude-nos a traduzir esta página! | |
29 | - </a></div><script>var footer = document.getElementById('l10n-footer'); | |
30 | - var f = document.getElementById('footer'); | |
31 | - f.insertBefore(footer,f.firstChild); | |
32 | - footer.style.display="block"; | |
33 | - | |
34 | - var translation={}; | |
35 | - translation.bundles = "2NnwkGTHJrEDa0LWifLhzy0bMMKQpfr+V8jqndzlngw8BcpuWU5pjp88+DvojWmlwDWk5m1yDKf+uVfATuzn/o9R6ohC+FzqqtfmVvk5qee2XfHlwey+vSS7+I6CXDq+WEIAbvl4UyC0YbxXUNHV+UDWGj9u3noOvWQzyVZIAz7OwpltiCaChyLRN8o/Ga7v/FuhvR6ylHYU2qtTpGsRVucVXKcZIfthj+eGnVIio9aHNE+u7OWIApYbnftjJt3ulC39+i6H/i8r3iTr6qGxDrPBkvWUW5AGQsXZ4uS8UchpnPV1JWyPp8odeubPq1mzHevzbWXHSM4bg5PUQJI1r6tc5puI89i/CFOpKKVg3uZqnnbJ5f+CMBZMYSOYLg07t7iDUu60xIAZ43nXqKO301bRp8+MQEIvESNl1ljGyNUIVq4zqIabq6XJ6jtXJn8jFwQ4JuYZkqclHjQf6dIYHvu9QEYGzbbSdAX9JA0MY2Vg9olsS/nWqekhJ31sgEt5XTYlIpv3GwLWJjscFWith3uFsch1i/brTqK+05x/u4+7nLlJt1D+SViTWh+ocHddv0h06pZr2prrdGJCfSpCCmIp2+BYxLvBVaeceOtrabCUvFgKO2ofnSryjLrKj2bRwy+Ierw0TAVTDQP7gVF4edoMU9ATzAGNf2JtV9UvlkRGGxSuG6L+dvNVZ5gMVVHbHBtlgV7+pGIzgMTSfNHwz92R8ezx9ycor6Xo8WrXsMBCjTzy6mThLp1IpnIfyV+W4rYPpxcHe2/xWPysjLezZxgnmrhxLgtcQnKUK+buUHaL7GDooEPMx13v/NB2Ym3U"; | |
36 | - translation.detectedLocale = ""; | |
37 | - | |
38 | - function showTranslationDialog() { | |
39 | - if(!translation.launchDialog) | |
40 | - loadScript("/ci/plugin/translation/dialog.js"); | |
41 | - else | |
42 | - translation.launchDialog(); | |
43 | - return false; | |
44 | - }</script></body></html> | |
45 | 0 | \ No newline at end of file |
... | ... | @@ -0,0 +1,45 @@ |
1 | +<rules | |
2 | + xmlns="http://namespaces.plone.org/diazo" | |
3 | + xmlns:css="http://namespaces.plone.org/diazo/css" | |
4 | + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
5 | + | |
6 | + <replace css:theme="#trac-css" content="//head/link" /> | |
7 | + <replace css:theme="#trac-js" content="//head/script" /> | |
8 | + <replace theme="//head/title" content="//head/title" /> | |
9 | + | |
10 | + <before css:theme-children="#main-content" css:content="#main" /> | |
11 | + | |
12 | + <after theme-children="/html/head"> | |
13 | + <style> | |
14 | + .navbar .nav ul { font-size: 14px; text-align: left; padding: 5px 0; } | |
15 | + .navbar .nav li { border: 0; padding: 0; white-space: normal; display: list-item;} | |
16 | + :link:not(.btn), | |
17 | + :visited:not(.btn) { border: 0; color: rgb(66, 139, 202); } | |
18 | + h1 { font-size: 24px; margin: 0.15em 1em 0.5em 0px; } | |
19 | + h2 { font-size: 20px } | |
20 | + h3 { font-size: 16px } | |
21 | + h4 { font-size: 14px } | |
22 | + input[type="checkbox"], input[type="radio"] { margin: 0 4px; } | |
23 | + fieldset { padding: 1em; margin: 1em 0; border: 1px solid rgb(215, 215, 215); } | |
24 | + label { font-weight: 400; } | |
25 | + legend { margin-bottom: 0; width: auto; } | |
26 | + input, textarea, select { margin: 2px; } | |
27 | + | |
28 | + .wikitoolbar, | |
29 | + .wikitoolbar:before, | |
30 | + .wikitoolbar:after { | |
31 | + -moz-box-sizing: content-box; | |
32 | + -webkit-box-sizing: content-box; | |
33 | + } | |
34 | + .wikitoolbar :link, | |
35 | + .wikitoolbar :visited { | |
36 | + border-width: 1px; | |
37 | + border-style: solid; | |
38 | + border-color: #fff #fff #fff #ccc; | |
39 | + -moz-box-sizing: content-box; | |
40 | + -webkit-box-sizing: content-box; | |
41 | + } | |
42 | + </style> | |
43 | + </after> | |
44 | + | |
45 | +</rules> | ... | ... |
... | ... | @@ -0,0 +1,157 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +import math | |
4 | +import string | |
5 | + | |
6 | +from django.template import loader, Context | |
7 | +from django.utils.text import slugify | |
8 | +from haystack import indexes | |
9 | +from haystack.utils import log as logging | |
10 | + | |
11 | +from search.base_indexes import BaseIndex | |
12 | +from .models import Attachment, Ticket, Wiki, Revision | |
13 | + | |
14 | + | |
15 | +logger = logging.getLogger('haystack') | |
16 | + | |
17 | +# the string maketrans always return a string encoded with latin1 | |
18 | +# http://stackoverflow.com/questions/1324067/how-do-i-get-str-translate-to-work-with-unicode-strings | |
19 | +table = string.maketrans( | |
20 | + string.punctuation, | |
21 | + '.' * len(string.punctuation) | |
22 | +).decode('latin1') | |
23 | + | |
24 | + | |
25 | +class AttachmentIndex(BaseIndex, indexes.Indexable): | |
26 | + title = indexes.CharField(model_attr='filename') | |
27 | + description = indexes.CharField(model_attr='description', null=True) | |
28 | + modified = indexes.DateTimeField(model_attr='created', null=True) | |
29 | + used_by = indexes.CharField(model_attr='used_by', null=True, stored=False) | |
30 | + mimetype = indexes.CharField( | |
31 | + model_attr='mimetype', | |
32 | + null=True, | |
33 | + stored=False | |
34 | + ) | |
35 | + size = indexes.IntegerField(model_attr='size', null=True, stored=False) | |
36 | + filename = indexes.CharField(stored=False) | |
37 | + | |
38 | + def get_model(self): | |
39 | + return Attachment | |
40 | + | |
41 | + def get_updated_field(self): | |
42 | + return 'created' | |
43 | + | |
44 | + def prepare(self, obj): | |
45 | + data = super(AttachmentIndex, self).prepare(obj) | |
46 | + | |
47 | + try: | |
48 | + file_obj = open(obj.filepath) | |
49 | + except IOError as e: | |
50 | + logger.warning(u'IOError: %s - %s', e.strerror, e.filename) | |
51 | + return data | |
52 | + backend = self._get_backend(None) | |
53 | + | |
54 | + extracted_data = backend.extract_file_contents(file_obj) | |
55 | + file_obj.close() | |
56 | + | |
57 | + if not extracted_data: | |
58 | + return data | |
59 | + | |
60 | + t = loader.select_template( | |
61 | + ('search/indexes/proxy/attachment_text.txt', ) | |
62 | + ) | |
63 | + data['text'] = t.render(Context({ | |
64 | + 'object': obj, | |
65 | + 'extracted': extracted_data, | |
66 | + })) | |
67 | + return data | |
68 | + | |
69 | + def prepare_filename(self, obj): | |
70 | + return obj.filename.translate(table).replace('.', ' ') | |
71 | + | |
72 | + def prepare_icon_name(self, obj): | |
73 | + return u'file' | |
74 | + | |
75 | + def prepare_type(self, obj): | |
76 | + return u'attachment' | |
77 | + | |
78 | + | |
79 | +class WikiIndex(BaseIndex, indexes.Indexable): | |
80 | + title = indexes.CharField(model_attr='name') | |
81 | + collaborators = indexes.CharField( | |
82 | + model_attr='collaborators', | |
83 | + null=True, | |
84 | + stored=False, | |
85 | + ) | |
86 | + | |
87 | + def get_model(self): | |
88 | + return Wiki | |
89 | + | |
90 | + def prepare_description(self, obj): | |
91 | + return u'{}\n{}'.format(obj.wiki_text, obj.collaborators) | |
92 | + | |
93 | + def prepare_icon_name(self, obj): | |
94 | + return u'book' | |
95 | + | |
96 | + def prepare_type(self, obj): | |
97 | + return u'wiki' | |
98 | + | |
99 | + | |
100 | +class TicketIndex(BaseIndex, indexes.Indexable): | |
101 | + tag = indexes.CharField(model_attr='status', null=True) | |
102 | + milestone = indexes.CharField(model_attr='milestone', null=True) | |
103 | + component = indexes.CharField(model_attr='component', null=True) | |
104 | + severity = indexes.CharField(model_attr='severity', null=True) | |
105 | + reporter = indexes.CharField(model_attr='reporter', null=True) | |
106 | + keywords = indexes.CharField(model_attr='keywords', null=True) | |
107 | + collaborators = indexes.CharField( | |
108 | + model_attr='collaborators', | |
109 | + null=True, | |
110 | + stored=False, | |
111 | + ) | |
112 | + | |
113 | + def get_model(self): | |
114 | + return Ticket | |
115 | + | |
116 | + def prepare_description(self, obj): | |
117 | + return u'{}\n{}\n{}\n{}\n{}\n{}\n{}'.format( | |
118 | + obj.description, obj.milestone, obj.component, obj.severity, | |
119 | + obj.reporter, obj.keywords, obj.collaborators | |
120 | + ) | |
121 | + | |
122 | + def prepare_icon_name(self, obj): | |
123 | + return u'tag' | |
124 | + | |
125 | + def prepare_title(self, obj): | |
126 | + return u'#{} - {}'.format(obj.pk, obj.summary) | |
127 | + | |
128 | + def prepare_type(self, obj): | |
129 | + return 'ticket' | |
130 | + | |
131 | + | |
132 | +class RevisionIndex(BaseIndex, indexes.Indexable): | |
133 | + description = indexes.CharField(model_attr='message', null=True) | |
134 | + modified = indexes.DateTimeField(model_attr='created', null=True) | |
135 | + repository_name = indexes.CharField( | |
136 | + model_attr='repository_name', | |
137 | + stored=False | |
138 | + ) | |
139 | + | |
140 | + def get_model(self): | |
141 | + return Revision | |
142 | + | |
143 | + def get_updated_field(self): | |
144 | + return 'created' | |
145 | + | |
146 | + def get_boost(self, obj): | |
147 | + boost = super(RevisionIndex, self).get_boost(obj) | |
148 | + return boost * 0.8 | |
149 | + | |
150 | + def prepare_icon_name(self, obj): | |
151 | + return u'align-right' | |
152 | + | |
153 | + def prepare_title(self, obj): | |
154 | + return u'{} [{}]'.format(obj.repository_name, obj.rev) | |
155 | + | |
156 | + def prepare_type(self, obj): | |
157 | + return 'changeset' | ... | ... |
src/proxy/trac/urls.py
1 | 1 | |
2 | -from django.conf.urls import patterns, include, url | |
2 | +from django.conf.urls import patterns, url | |
3 | 3 | |
4 | 4 | from .views import TracProxyView |
5 | 5 | |
6 | 6 | |
7 | 7 | urlpatterns = patterns('', |
8 | - # Trac URLs | |
9 | - url(r'^(?P<path>(?:admin|wiki|changeset|newticket|ticket|chrome|timeline|roadmap|browser|report|tags|query|about|prefs|log|attachment|raw-attachment|diff|milestone).*)$', | |
10 | - TracProxyView.as_view()), | |
11 | - | |
12 | - # Trac | |
13 | - url(r'^trac/(?P<path>.*)$', TracProxyView.as_view()), | |
8 | + # Trac | |
9 | + url(r'^trac/(?P<path>.*)$', TracProxyView.as_view()), | |
14 | 10 | ) | ... | ... |
src/proxy/trac/views.py
1 | 1 | |
2 | -import os | |
3 | - | |
4 | 2 | from django.conf import settings |
5 | 3 | |
6 | -from revproxy.views import ProxyView | |
7 | 4 | from hitcounter.views import HitCounterViewMixin |
8 | 5 | |
6 | +from ..utils import ColabProxyView | |
9 | 7 | from .models import Wiki, Ticket, Revision |
10 | 8 | |
11 | 9 | |
12 | -CWD = os.path.abspath(os.path.dirname(__file__)) | |
13 | -DIAZO_RULES_DIR = os.path.join(CWD, 'diazo') | |
14 | - | |
15 | - | |
16 | -class TracProxyView(HitCounterViewMixin, ProxyView): | |
17 | - base_url = settings.COLAB_TRAC_URL | |
18 | - add_remote_user = settings.REVPROXY_ADD_REMOTE_USER | |
10 | +class TracProxyView(HitCounterViewMixin, ColabProxyView): | |
11 | + upstream = settings.COLAB_TRAC_URL | |
19 | 12 | diazo_theme_template = 'proxy/trac.html' |
20 | - diazo_rules = os.path.join(DIAZO_RULES_DIR, 'trac.xml') | |
21 | - html5 = True | |
22 | 13 | |
23 | 14 | def get_object(self): |
24 | 15 | obj = None | ... | ... |
src/proxy/urls.py