Show More
@@ -25,6 +25,8 b' def make_map(config):' | |||||
25 |
|
25 | |||
26 | map.resource('repo', 'repos', path_prefix='/_admin') |
|
26 | map.resource('repo', 'repos', path_prefix='/_admin') | |
27 | map.resource('user', 'users', path_prefix='/_admin') |
|
27 | map.resource('user', 'users', path_prefix='/_admin') | |
|
28 | ||||
|
29 | map.connect('hg_home', '/', controller='hg', action='index') | |||
28 |
|
30 | |||
29 | map.connect('hg', '/{path_info:.*}', controller='hg', |
|
31 | map.connect('hg', '/{path_info:.*}', controller='hg', | |
30 | action="view", path_info='/') |
|
32 | action="view", path_info='/') |
@@ -1,11 +1,19 b'' | |||||
1 | #!/usr/bin/python |
|
1 | #!/usr/bin/python | |
2 | # -*- coding: utf-8 -*- |
|
2 | # -*- coding: utf-8 -*- | |
3 | import logging |
|
3 | import logging | |
|
4 | import os | |||
4 | from pylons_app.lib.base import BaseController |
|
5 | from pylons_app.lib.base import BaseController | |
5 | from pylons import tmpl_context as c, app_globals as g, session, request, config |
|
6 | from pylons import tmpl_context as c, app_globals as g, session, request, config | |
6 | from pylons_app.lib import helpers as h |
|
7 | from pylons_app.lib import helpers as h | |
7 | from mako.template import Template |
|
8 | from mako.template import Template | |
8 | from pylons.controllers.util import abort |
|
9 | from pylons.controllers.util import abort | |
|
10 | from pylons_app.lib.base import BaseController, render | |||
|
11 | try: | |||
|
12 | from vcs.backends.hg import get_repositories | |||
|
13 | except ImportError: | |||
|
14 | print 'You have to import vcs module' | |||
|
15 | from mercurial.util import matchdate, Abort, makedate | |||
|
16 | from mercurial.hgweb.common import get_contact | |||
9 |
|
17 | |||
10 | log = logging.getLogger(__name__) |
|
18 | log = logging.getLogger(__name__) | |
11 |
|
19 | |||
@@ -13,8 +21,33 b' class HgController(BaseController):' | |||||
13 |
|
21 | |||
14 | def __before__(self): |
|
22 | def __before__(self): | |
15 | c.repos_prefix = config['repos_name'] |
|
23 | c.repos_prefix = config['repos_name'] | |
|
24 | c.staticurl = g.statics | |||
|
25 | ||||
|
26 | def index(self): | |||
|
27 | c.repos_list = [] | |||
|
28 | ||||
|
29 | def get_mtime(spath): | |||
|
30 | cl_path = os.path.join(spath, "00changelog.i") | |||
|
31 | if os.path.exists(cl_path): | |||
|
32 | return os.stat(cl_path).st_mtime | |||
|
33 | else: | |||
|
34 | return os.stat(spath).st_mtime | |||
|
35 | ||||
|
36 | for name, r in get_repositories(g.paths[0][0], g.paths[0][1]).items(): | |||
|
37 | last_change = (get_mtime(r.spath), makedate()[1]) | |||
|
38 | tmp = {} | |||
|
39 | tmp['name'] = name | |||
|
40 | tmp['desc'] = r.ui.config('web', 'description', 'Unknown', untrusted=True) | |||
|
41 | tmp['last_change'] = last_change, | |||
|
42 | tip = r.changectx('tip') | |||
|
43 | tmp['tip'] = tip.__str__(), | |||
|
44 | tmp['rev'] = tip.rev() | |||
|
45 | tmp['contact'] = get_contact(r.ui.config) | |||
|
46 | c.repos_list.append(tmp) | |||
|
47 | return render('/index.html') | |||
16 |
|
48 | |||
17 | def view(self, *args, **kwargs): |
|
49 | def view(self, *args, **kwargs): | |
|
50 | #TODO: reimplement this not tu use hgwebdir | |||
18 | response = g.hgapp(request.environ, self.start_response) |
|
51 | response = g.hgapp(request.environ, self.start_response) | |
19 |
|
52 | |||
20 | http_accept = request.environ.get('HTTP_ACCEPT', False) |
|
53 | http_accept = request.environ.get('HTTP_ACCEPT', False) |
@@ -28,14 +28,15 b' class Globals(object):' | |||||
28 | self.cache = CacheManager(**parse_cache_config_options(config)) |
|
28 | self.cache = CacheManager(**parse_cache_config_options(config)) | |
29 | self.hgapp = wsgiapplication(self.make_web_app) |
|
29 | self.hgapp = wsgiapplication(self.make_web_app) | |
30 |
|
30 | |||
31 |
|
||||
32 | def make_web_app(self): |
|
31 | def make_web_app(self): | |
33 | repos = "hgwebdir.config" |
|
32 | repos = "hgwebdir.config" | |
34 | baseui = ui.ui() |
|
33 | baseui = ui.ui() | |
35 | cfg = config.config() |
|
34 | cfg = config.config() | |
36 | cfg.read(repos) |
|
35 | cfg.read(repos) | |
37 | paths = cfg.items('paths') |
|
36 | paths = cfg.items('paths') | |
|
37 | self.paths = paths | |||
38 | self.check_repo_dir(paths) |
|
38 | self.check_repo_dir(paths) | |
|
39 | ||||
39 | self.set_statics(cfg) |
|
40 | self.set_statics(cfg) | |
40 |
|
41 | |||
41 | for k, v in cfg.items('web'): |
|
42 | for k, v in cfg.items('web'): |
@@ -1,161 +1,47 b'' | |||||
1 |
|
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file = "base/base.html"/> |
|
|||
3 |
|
||||
4 | <%def name="page_title()"> |
|
|||
5 | ${_('Wire transfer')} |
|
|||
6 | </%def> |
|
|||
7 |
|
||||
8 | <%def name="body()"> |
|
|||
9 | <div id="header"> |
|
|||
10 |
|
||||
11 | <h1 id="logo"><a href="index.html">Luminous Studios</a></h1> |
|
|||
12 |
|
||||
13 | </div><!-- /header --> |
|
|||
14 |
|
||||
15 | <div id="navigation"> |
|
|||
16 | <ul> |
|
|||
17 | <li><a href="index.html" id="home-button">Home</a></li> |
|
|||
18 | <li><a href="about.html" id="about-button">About</a></li> |
|
|||
19 | <li><a href="services.html" id="services-button">Services</a></li> |
|
|||
20 | <li><a href="portfolio.html" id="portfolio-button">Portfolio</a></li> |
|
|||
21 | <li><a href="blog.html" id="blog-button">Blog</a></li> |
|
|||
22 | <li><a href="scontact.php" id="contact-button">Contact</a></li> |
|
|||
23 | </ul> |
|
|||
24 | </div><!-- /navigation --> |
|
|||
25 |
|
||||
26 | <!-- /featured --> |
|
|||
27 |
|
||||
28 | <div id="main" class="clearfix"> |
|
|||
29 |
|
||||
30 | <div id="sidebar"> |
|
|||
31 |
|
||||
32 | <div class="sidebox"> |
|
|||
33 | <h2 id="recent-posts-title">Recent Blog Posts</h2> |
|
|||
34 | <div class="sidebox-content"> |
|
|||
35 | <ul id="recent-posts"> |
|
|||
36 | <li><a href="#">Lorem Ipsum is simply dummy text of the printing industry. <span class="more-link">More Β»</span></a></li> |
|
|||
37 | <li><a href="#">Lorem Ipsum is simply dummy text of the printing industry. <span class="more-link">More Β»</span></a></li> |
|
|||
38 | <li><a href="#">Lorem Ipsum is simply dummy text of the printing industry. <span class="more-link">More Β»</span></a></li> |
|
|||
39 | </ul> |
|
|||
40 | </div> |
|
|||
41 | </div><!-- /sidebox --> |
|
|||
42 |
|
||||
43 | <div class="sidebox"> |
|
|||
44 | <h2 id="clients-title">What Clients Say</h2> |
|
|||
45 | <div class="sidebox-content"> |
|
|||
46 | <p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem |
|
|||
47 | accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab |
|
|||
48 | illo inventore veritatis et quasi architecto beatae vitae dicta sunt |
|
|||
49 | explicabo."</p> |
|
|||
50 | <strong>- John Doe</strong> |
|
|||
51 | </div> |
|
|||
52 | </div><!-- /sidebox --> |
|
|||
53 |
|
||||
54 | </div><!-- /sidebar --> |
|
|||
55 |
|
||||
56 | <div id="content"> |
|
|||
57 |
|
||||
58 | <h2>Hello we are Luminous</h2> |
|
|||
59 | <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do |
|
|||
60 | eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad |
|
|||
61 | minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip |
|
|||
62 | ex ea commodo consequat.</p><br class="br"> |
|
|||
63 |
|
||||
64 | <h2>What we do</h2> |
|
|||
65 |
|
||||
66 | <div class="frontpage-box clearfix"> |
|
|||
67 |
|
||||
68 | <img class="frontpage-box-img" src="/computer_48.png" |
|
|||
69 | alt="" width="48" height="48"> |
|
|||
70 |
|
||||
71 | <div class="frontpage-box-text"> |
|
|||
72 | <h3>Design</h3> |
|
|||
73 | <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do |
|
|||
74 | eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad |
|
|||
75 | minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip |
|
|||
76 | ex ea. <a href="#">More Β»</a></p> |
|
|||
77 | </div> |
|
|||
78 |
|
||||
79 | </div><!-- /frontpage-box --> |
|
|||
80 |
|
2 | |||
81 | <div class="frontpage-box clearfix"> |
|
3 | <%inherit file="base/base.html"/> | |
82 |
|
4 | <%def name="title()"> | ||
83 | <img class="frontpage-box-img" src="/app_48.png" alt="" |
|
5 | ${c.repos_prefix} Mercurial Repositories | |
84 | width="48" height="48"> |
|
6 | </%def> | |
85 |
|
7 | <%def name="breadcrumbs()"> | ||
86 | <div class="frontpage-box-text"> |
|
8 | <h1>${c.repos_prefix} Mercurial Repositories</h1> | |
87 | <h3>Development</h3> |
|
9 | </%def> | |
88 | <p>${h.secure_form('/home/make_payment',method='post',id="secure_form")} |
|
10 | <%def name="page_nav()"> | |
89 | ##Secure Form Tag for prevention of Cross-site request forgery (CSRF) attacks. |
|
11 | <li class="current">${_('Home')}</li> | |
90 | ##Generates form tags that include client-specific authorization tokens to be verified by the destined web app. |
|
12 | <li>${h.link_to(u'Admin',h.url('admin_home'))}</li> | |
91 |
|
||||
92 | <table class="editor_disp"> |
|
|||
93 | <tr> |
|
|||
94 | <td colspan="3">${h.get_error('_authentication_token',c.form_errors)}</td> |
|
|||
95 | </tr> |
|
|||
96 | <tr> |
|
|||
97 | <td class="label">${_('Account number')}</td> |
|
|||
98 | <td>${h.text('account_number',size=44,maxlength=38)}</td> |
|
|||
99 | <td id="e_account_number">${h.get_error('account_number',c.form_errors)}</td> |
|
|||
100 | </tr> |
|
|||
101 | <tr> |
|
|||
102 | <td class="label">${_('Title')}</td> |
|
|||
103 | <td>${h.textarea("title", "", cols=43, rows=5,maxlength=20)}</td> |
|
|||
104 | <td id="e_title">${h.get_error('title',c.form_errors)}</td> |
|
|||
105 | </tr> |
|
|||
106 | <tr> |
|
|||
107 | <td class="label">${_('Recipient')}</td> |
|
|||
108 | <td>${h.select('recipient',1,c.recipients_list)}</td> |
|
|||
109 | <td id="e_recipient">${h.get_error('recipient',c.form_errors)}</td> |
|
|||
110 | </tr> |
|
|||
111 | <tr> |
|
|||
112 | <td class="label">${_('Recipient address')}</td> |
|
|||
113 | <td>${h.text('recipient_address',size=44)}</td> |
|
|||
114 | <td id="e_recipient_address">${h.get_error('recipient_address',c.form_errors)}</td> |
|
|||
115 | </tr> |
|
|||
116 | <tr> |
|
|||
117 | <td class="label">${_('Amount')}</td> |
|
|||
118 | <td>${h.text('amount',size='7')}zΕ</td> |
|
|||
119 | <td id="e_amount">${h.get_error('amount',c.form_errors)}</td> |
|
|||
120 | </tr> |
|
|||
121 | <tr> |
|
|||
122 | <td class="label"></td> |
|
|||
123 | <td>${h.submit('send',_('send'))}</td> |
|
|||
124 | </tr> |
|
|||
125 | </table> |
|
|||
126 | ${h.end_form()}<a href="#">More Β»</a></p> |
|
|||
127 | </div> |
|
|||
128 |
|
||||
129 | </div><!-- /frontpage-box --> |
|
|||
130 |
|
||||
131 | <div class="frontpage-box clearfix"> |
|
|||
132 |
|
||||
133 | <img class="frontpage-box-img" src="/globe_48.png" alt="" width="48" height="48"> |
|
|||
134 |
|
||||
135 | <div class="frontpage-box-text"> |
|
|||
136 | <h3>Marketing</h3> |
|
|||
137 | <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do |
|
|||
138 | eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad |
|
|||
139 | minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip |
|
|||
140 | ex ea. <a href="#">More Β»</a></p> |
|
|||
141 | </div> |
|
|||
142 |
|
||||
143 | </div><!-- /frontpage-box --> |
|
|||
144 |
|
||||
145 | </div><!-- /content --> |
|
|||
146 |
|
||||
147 | </div><!-- /main --> |
|
|||
148 |
|
||||
149 | </%def> |
|
13 | </%def> | |
150 |
|
14 | <%def name="main()"> | ||
151 |
<%def name=" |
|
15 | <%def name="get_sort(name)"> | |
152 | <p id="footer-copyright">Β© 2009</p> |
|
16 | <a href="?sort=${name.lower().replace(' ','-')}">${name}</a> | |
153 |
|
17 | </%def> | ||
154 | <ul id="footer-nav"> |
|
18 | <table> | |
155 | <li><a href="#">Home</a></li> |
|
19 | <tr> | |
156 | <li><a href="#">About</a></li> |
|
20 | <td>${get_sort(_('Name'))}</td> | |
157 | <li><a href="#">Services</a></li> |
|
21 | <td>${get_sort(_('Description'))}</td> | |
158 | <li><a href="#">Portfolio</a></li> |
|
22 | <td>${get_sort(_('Last change'))}</td> | |
159 | <li><a href="#">Contact</a></li> |
|
23 | <td>${get_sort(_('Tip'))}</td> | |
160 | </ul> |
|
24 | <td>${get_sort(_('Contact'))}</td> | |
161 | </%def> |
|
25 | </tr> | |
|
26 | %for cnt,repo in enumerate(c.repos_list): | |||
|
27 | <tr class="parity${cnt%2}"> | |||
|
28 | <td><a href="/${repo['name']}">${repo['name']}</a></td> | |||
|
29 | <td>${repo['desc']}</td> | |||
|
30 | <td>${repo['last_change']}</td> | |||
|
31 | <td>r${repo['rev']}:${repo['tip']}</td> | |||
|
32 | <td>${repo['contact']}</td> | |||
|
33 | <td class="indexlinks"> | |||
|
34 | <a href="/${repo['name']}/archive/tip.zip">zip</a> | |||
|
35 | <a href="/${repo['name']}/archive/tip.tar.gz">gz</a> | |||
|
36 | <a href="/${repo['name']}/archive/tip.tar.bz2">bz2</a> | |||
|
37 | </td> | |||
|
38 | <td> | |||
|
39 | <div class="rss_logo"> | |||
|
40 | <a href="/${repo['name']}/rss-log">RSS</a> | |||
|
41 | <a href="/${repo['name']}/atom-log">Atom</a> | |||
|
42 | </div> | |||
|
43 | </td> | |||
|
44 | </tr> | |||
|
45 | %endfor | |||
|
46 | </table> | |||
|
47 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now