##// END OF EJS Templates
Added managment pages....
marcink -
r44:d924b931 default
parent child Browse files
Show More
@@ -0,0 +1,40 b''
1 <%inherit file="base/base.html"/>
2 <%def name="title()">
3 ${_('Repository managment')}
4 </%def>
5 <%def name="breadcrumbs()">
6 ${h.link_to(u'Home',h.url('/'))}
7 /
8 ${h.link_to(u'Admin',h.url('admin_home'))}
9 /
10 ${h.link_to(u'Repos managment',h.url('admin_repos_manage'))}
11 </%def>
12 <%def name="page_nav()">
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
14 <li class="current">${_('Admin')}</li>
15 </%def>
16 <%def name="main()">
17
18
19 <div class="twocol-form">
20 <h2>Create new repository</h2>
21 <form method="post" action="/repo/create/">
22 <table>
23 <tbody><tr><th><label for="id_name">Name:</label></th><td><input type="text" maxlength="255" name="name" id="id_name"></td></tr>
24 <tr><th><label for="id_description">Description:</label></th><td><textarea name="description" cols="40" rows="10" id="id_description"></textarea></td></tr>
25 <tr><th><label for="id_website">Website:</label></th><td><input type="text" maxlength="128" name="website" id="id_website"></td></tr>
26 <tr><th><label for="id_is_private">Private:</label></th><td><input type="checkbox" id="id_is_private" name="is_private"></td></tr>
27 <tr><th><label for="id_has_issues">Issue tracking:</label></th><td><input type="checkbox" id="id_has_issues" name="has_issues" checked="checked"></td></tr>
28 <tr><th><label for="id_has_wiki">Wiki:</label></th><td><input type="checkbox" id="id_has_wiki" name="has_wiki" checked="checked"></td></tr>
29
30
31 <tr><td colspan="2">&nbsp;</td></tr>
32 <tr>
33 <td colspan="2">
34 <input type="submit" class="primary-button" value="Create repository"> <input type="reset" onclick="document.location='http://bitbucket.org/';" class="secondary-button secondary-button-darkbg" value="Cancel">
35 </td>
36 </tr>
37 </tbody></table>
38 </form>
39 </div>
40 </%def> No newline at end of file
@@ -0,0 +1,34 b''
1 <%inherit file="base/base.html"/>
2 <%def name="title()">
3 ${_('Repository managment')}
4 </%def>
5 <%def name="breadcrumbs()">
6 ${h.link_to(u'Home',h.url('/'))}
7 /
8 ${h.link_to(u'Admin',h.url('admin_home'))}
9 /
10 ${h.link_to(u'Users managment',h.url('admin_users_manage'))}
11 </%def>
12 <%def name="page_nav()">
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
14 <li class="current">${_('Admin')}</li>
15 </%def>
16 <%def name="main()">
17
18 <table cellspacing="0">
19 <tr>
20 <th>Id</th>
21 <th>Username</th>
22 <th>Password</th>
23 <th>Active</th>
24 </tr>
25 %for i in c.users_list:
26 <tr>
27 <td>${i[0]}</td>
28 <td>${i[1]}</td>
29 <td>${i[2]}</td>
30 <td>${i[3]}</td>
31 </tr>
32 %endfor
33 </table>
34 </%def> No newline at end of file
@@ -22,7 +22,8 b' def make_map(config):'
22 22 with map.submapper(path_prefix='/_admin', controller='admin') as m:
23 23 m.connect('admin_home', '/', action='index')#main page
24 24 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
25 m.connect('admin_manage_users', '/manage_users', action='index')
25 m.connect('admin_users_manage', '/repos_manage', action='users_manage')
26 m.connect('admin_repos_manage', '/users_manage', action='repos_manage')
26 27
27 28 map.connect('hg', '/{path_info:.*}', controller='hg',
28 29 action="view", path_info='/')
@@ -8,6 +8,7 b' import os'
8 8 from mercurial import ui, hg
9 9 from mercurial.error import RepoError
10 10 from ConfigParser import ConfigParser
11 from pylons_app.lib import auth
11 12 log = logging.getLogger(__name__)
12 13
13 14 class AdminController(BaseController):
@@ -15,12 +16,21 b' class AdminController(BaseController):'
15 16
16 17 def __before__(self):
17 18 c.staticurl = g.statics
19 c.admin_user = True
18 20
19 21 def index(self):
20 22 # Return a rendered template
21 23 return render('/admin.html')
22 24
23
25 def repos_manage(self):
26 return render('/repos_manage.html')
27
28 def users_manage(self):
29 conn, cur = auth.get_sqlite_conn_cur()
30 cur.execute('SELECT * FROM users')
31 c.users_list = cur.fetchall()
32 return render('/users_manage.html')
33
24 34 def manage_hgrc(self):
25 35 pass
26 36
@@ -32,8 +42,8 b' class AdminController(BaseController):'
32 42
33 43
34 44 #extra check it can be add since it's the command
35 if new_repo == 'add':
36 c.msg = 'you basstard ! this repo is a command'
45 if new_repo == '_admin':
46 c.msg = 'DENIED'
37 47 c.new_repo = ''
38 48 return render('add.html')
39 49
@@ -8,13 +8,13 b' import crypt'
8 8 log = logging.getLogger(__name__)
9 9 ROOT = dn(dn(dn(os.path.realpath(__file__))))
10 10
11 def get_sqlite_cur_conn():
11 def get_sqlite_conn_cur():
12 12 conn = sqlite3.connect(os.path.join(ROOT, 'auth.sqlite'))
13 13 cur = conn.cursor()
14 14 return conn, cur
15 15
16 16 def authfunc(environ, username, password):
17 conn, cur = get_sqlite_cur_conn()
17 conn, cur = get_sqlite_conn_cur()
18 18 password_crypt = crypt.crypt(password, '6a')
19 19
20 20 try:
@@ -59,7 +59,7 b' def create_user_table():'
59 59 '''
60 60 Create a auth database
61 61 '''
62 conn, cur = get_sqlite_cur_conn()
62 conn, cur = get_sqlite_conn_cur()
63 63 try:
64 64 log.info('creating table %s', 'users')
65 65 cur.execute('''DROP TABLE IF EXISTS users ''')
@@ -83,7 +83,7 b' def create_user_table():'
83 83 cur.close()
84 84
85 85 def create_user(username, password):
86 conn, cur = get_sqlite_cur_conn()
86 conn, cur = get_sqlite_conn_cur()
87 87 password_crypt = crypt.crypt(password, '6a')
88 88 cur_date = datetime.now()
89 89 log.info('creating user %s', username)
@@ -105,5 +105,6 b' if __name__ == "__main__":'
105 105 create_user('bart', 'qweqwe')
106 106 create_user('maho', 'qweqwe')
107 107 create_user('michalg', 'qweqwe')
108 create_user('admin', 'qwe123qwe')
108 109
109 110 #authfunc('', 'marcink', 'qweqwe')
@@ -1,51 +1,53 b''
1 1 ## -*- coding: utf-8 -*-
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <link rel="icon" href="${c.staticurl}hgicon.png" type="image/png" />
6 <meta name="robots" content="index, nofollow"/>
7 <link rel="stylesheet" href="${c.staticurl}style-monoblue.css" type="text/css" />
8 <title>Mercurial repositories Admin</title>
9 </head>
10
11 <body>
12 <div id="container">
13 <div class="page-header">
14 <h1><a href="/">Home</a> / Admin</h1>
15 <ul class="page-nav">
16 </ul>
2 <%inherit file="base/base.html"/>
3 <%def name="title()">
4 ${_('Repository managment')}
5 </%def>
6 <%def name="breadcrumbs()">
7 ${h.link_to(u'Home',h.url('/'))}
8 /
9 ${h.link_to(u'Admin',h.url('admin_home'))}
10 </%def>
11 <%def name="page_nav()">
12 <li>${h.link_to(u'Home',h.url('/'))}</li>
13 <li class="current">${_('Admin')}</li>
14 </%def>
15 <%def name="main()">
16 %if c.admin_user:
17 <ul class="submenu">
18 <li>
19 ${h.link_to(u'Repos managment',h.url('admin_repos_manage'))}
20 </li>
21 <li>
22 ${h.link_to(u'Users managment',h.url('admin_users_manage'))}
23 </li>
24 </ul>
25 <br/>
26 <div>
27
28 <h2>Hi !</h2>
17 29 </div>
18 <table cellspacing="0">
19 <tr>
20 <td>${h.link_to(u'Create "ccc" repository',h.url('admin_add_repo',new_repo='ccc'))}</td>
21 </tr>
22 <tr>
23 <td>${h.link_to(u'Create "ccc" repository',h.url('admin_add_repo',new_repo='ccc'))}</td>
24 </tr>
25 <tr>
26 <td>${h.link_to(u'Create "ccc" repository',h.url('admin_add_repo',new_repo='ccc'))}</td>
27 </tr>
28 <tr>
29 <td><h2>${c.new_repo}</h2></td>
30 </tr>
31 </table>
32 <div class="page-footer">
33 Mercurial Repository: admin
34 </div>
35
36 <div id="powered-by">
37 <p>
38 <a href="http://mercurial.selenic.com/" title="Mercurial">
39 <img src="${c.staticurl}hglogo.png" width="75" height="90" alt="mercurial"></a>
40 </p>
41 </div>
42
43 <div id="corner-top-left"></div>
44 <div id="corner-top-right"></div>
45 <div id="corner-bottom-left"></div>
46 <div id="corner-bottom-right"></div>
47
48 </div>
49 </body>
50 </html>
51 No newline at end of file
30 %else:
31 <div>
32 <br />
33 <h2>${_('Login')}</h2>
34 ${h.form(h.url.current())}
35 <table>
36 <tr>
37 <td>${_('Username')}</td>
38 <td>${h.text('username')}</td>
39 </tr>
40 <tr>
41 <td>${_('Password')}</td>
42 <td>${h.text('password')}</td>
43 </tr>
44 <tr>
45 <td></td>
46 <td>${h.submit('login','login')}</td>
47 </tr>
48 </table>
49 ${h.end_form()}
50 </div>
51 %endif
52
53 </%def> No newline at end of file
@@ -2,33 +2,39 b''
2 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 3 <html xmlns="http://www.w3.org/1999/xhtml">
4 4 <head>
5 <style type="text/css">
6 </style>
7 <title>${next.page_title()}</title>
8 <meta name="author" content=""/>
9 <meta name="keywords" content=""/>
10 <meta name="description" content=""/>
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
12 <link rel="shortcut icon" type="image/x-icon" href="/images/sample.ico"/>
13 <script src="/css_browser_selector.js" type="text/javascript"></script>
14 <script type="text/javascript" src="/js/yui/utilities/utilities.js"></script>
15 <link rel="stylesheet" type="text/css" href="/css/style.css"/>
16
5 <link rel="icon" href="${c.staticurl}hgicon.png" type="image/png" />
6 <meta name="robots" content="index, nofollow"/>
7 <link rel="stylesheet" href="${c.staticurl}style-monoblue.css" type="text/css" />
8 <title>${next.title()}</title>
17 9 </head>
18 <body>
19 10
20 <div id="top-glow"></div>
21
22 <div id="container">
23 ${next.body()}
11 <body>
12 <div id="container">
13 <div class="page-header">
14 <h1>
15 ${next.breadcrumbs()}
16 </h1>
17 <ul class="page-nav">
18 ${next.page_nav()}
19 </ul>
20 </div>
21 ${next.main()}
22 <div class="page-footer">
23 Mercurial Repository: ${c.repo_name}
24 </div>
24 25
25 <div id="footer" class="clearfix">
26 ${next.footer()}
27 </div><!-- /footer -->
26 <div id="powered-by">
27 <p>
28 <a href="http://mercurial.selenic.com/" title="Mercurial">
29 <img src="${c.staticurl}hglogo.png" width="75" height="90" alt="mercurial"></a>
30 </p>
31 </div>
28 32
29 </div><!-- /container -->
33 <div id="corner-top-left"></div>
34 <div id="corner-top-right"></div>
35 <div id="corner-bottom-left"></div>
36 <div id="corner-bottom-right"></div>
30 37
31 <div id="bottom-glow"></div>
32
33 </body>
34 </html> No newline at end of file
38 </div>
39 </body>
40 </html> No newline at end of file
@@ -8,6 +8,8 b''
8 8 <div class="page-header">
9 9 <h1>${c.repos_prefix} Mercurial Repositories</h1>
10 10 <ul class="page-nav">
11 <li class="current">Home</li>
12 <li>${h.link_to(u'Admin',h.url('admin_home'))}</li>
11 13 </ul>
12 14 </div>
13 15
General Comments 0
You need to be logged in to leave comments. Login now