Project

General

Profile

Revision 5f2cd70a

ID5f2cd70a67dff4e8a540beb5ad335c9acce78363
Parent 20422a70
Child 6f56e540

Added by Francois POIROTTE over 14 years ago

Utilisation des templates et des fichiers statiques du thème.
Ajout d'une dépendance vers vigilo-themes-default à cet effet.

git-svn-id: https://vigilo-dev.si.c-s.fr/svn@853 b22e2e97-25c9-44ff-b637-2e5ceca36478

View differences:

setup.py
29 29
        "psycopg2",
30 30
        "tw.jquery >= 0.9.5",
31 31
        "vigilo-models",
32
        "vigilo-themes-default",
32 33
        "PasteScript >= 1.7", # setup_requires has issues
33 34
        "PasteDeploy",
34 35
        "Paste",
vigiboard/config/app_cfg.py
17 17
from tg.configuration import AppConfig
18 18

  
19 19
class MyAppConfig(AppConfig):
20
    """We overload AppConfig to prevent it from loading init_model()"""
21

  
22
    def __init__(self):
23
        AppConfig.__init__(self)
20
    """We overload AppConfig for our needs."""
21

  
22
    def __init__(self, app_name):
23
        super(MyAppConfig, self).__init__()
24
        self.__app_name = app_name
25
        self.__tpl_translator = None
26

  
27
    def __setup_template_translator(self):
28
        from pkg_resources import resource_filename
29
        import gettext
30
        from tg.i18n import get_lang
31

  
32
        if self.__tpl_translator is None:
33
            i18n_dir = resource_filename('vigilo.themes', 'i18n')
34
            lang = get_lang()
35

  
36
            # During unit tests, no language is defined
37
            # which results in an error if gettext.translation
38
            # is used to retrieve translations.
39
            if lang is None:
40
                self.__tpl_translator = gettext.NullTranslations()
41
            else:                
42
                self.__tpl_translator = gettext.translation(
43
                    'theme', i18n_dir, get_lang())
44

  
45
    def setup_paths(self):
46
        """Add egg-aware search path to genshi."""
47
        super(MyAppConfig, self).setup_paths()
48
        from pkg_resources import resource_filename
49

  
50
        app_templates = resource_filename(
51
            'vigilo.themes.templates', self.__app_name)
52
        common_templates = resource_filename(
53
            'vigilo.themes.templates', 'common')
54
        self.paths['templates'] = [app_templates, common_templates]
55

  
56
    def setup_genshi_renderer(self):
57
        """Setup templates to use an alternate translator."""
58
        # On reprend plusieurs éléments de "tg.configuration".
59
        from genshi.template import TemplateLoader
60
        from genshi.filters import Translator
61
        from tg.render import render_genshi
62
        from pkg_resources import resource_filename
63
        from tg.configuration import config
64

  
65
        def template_loaded(template):
66
            """Called when a template is done loading."""
67
            self.__setup_template_translator()
68
            template.filters.insert(0, Translator(self.__tpl_translator.ugettext))
69

  
70
        def my_render_genshi(template_name, template_vars, **kwargs):
71
            self.__setup_template_translator()
72
            template_vars['l_'] = self.__tpl_translator.ugettext
73
            return render_genshi(template_name, template_vars, **kwargs)
74

  
75
        loader = TemplateLoader(search_path=self.paths.templates,
76
                                auto_reload=self.auto_reload_templates,
77
                                callback=template_loaded)
78

  
79
        config['pylons.app_globals'].genshi_loader = loader
80
        self.render_functions.genshi = my_render_genshi
24 81

  
25 82
    def setup_sqlalchemy(self):
26 83
        """
......
34 91
from vigiboard import model
35 92
from vigiboard.lib import app_globals, helpers
36 93

  
37
base_config = MyAppConfig()
94
base_config = MyAppConfig('vigiboard')
38 95
base_config.renderers = []
39 96

  
97
# Pour gérer les thèmes, la notation "pointée" n'est pas utilisée.
98
# À la place, on indique le nom complet du template (ex: "index.html")
99
# lors de l'appel au décorateur @expose.
100
base_config.use_dotted_templatenames = False
101

  
102
# On définit la variable à False. En réalité, le comportement
103
# est le même que si elle valait toujours True, sauf que l'on
104
# met en place les middlewares nous même pour pouvoir gérer les
105
# thèmes (cf. ./middleware.py).
106
base_config.serve_static = False
107

  
40 108
base_config.package = vigiboard
41 109

  
42 110
#Set the default renderer
vigiboard/config/middleware.py
5 5
from vigiboard.config.app_cfg import base_config
6 6
from vigiboard.config.environment import load_environment
7 7

  
8
from pkg_resources import resource_filename
9
from paste.cascade import Cascade
10
from paste.urlparser import StaticURLParser
11

  
8 12
__all__ = ['make_app']
9 13

  
10 14
# Use base_config to setup the necessary PasteDeploy application factory. 
......
30 34
    @return: The vigiboard application with all the relevant middleware
31 35
        loaded.
32 36
    """
33
    app = make_base_app(global_conf, full_stack=True, **app_conf)
34

  
35
    # Wrap your base TurboGears 2 application with custom middleware here
37
    app = make_base_app(global_conf, full_stack=full_stack, **app_conf)
38

  
39
    # On définit 2 middlewares pour fichiers statiques qui cherchent
40
    # les fichiers dans le thème actuellement chargé.
41
    # Le premier va les chercher dans le dossier des fichiers spécifiques
42
    # à l'application, le second cherche dans les fichiers communs.
43
    app_static = StaticURLParser(resource_filename(
44
        'vigilo.themes.public', 'vigiboard'))
45
    common_static = StaticURLParser(resource_filename(
46
        'vigilo.themes.public', 'common'))
47
    app = Cascade([app_static, common_static, app])
36 48

  
37 49
    return app
38 50

  
vigiboard/controllers/error.py
18 18
    
19 19
    """
20 20

  
21
    @expose('vigiboard.templates.error')
21
    @expose('error.html')
22 22
    def document(self, *args, **kwargs):
23 23
        """Render the error document"""
24 24
        resp = request.environ.get('pylons.original_response')
vigiboard/controllers/root.py
38 38
        else :
39 39
            redirect('/')
40 40

  
41
    @expose('vigiboard.templates.vigiboard')
41
    @expose('vigiboard.html')
42 42
    @require(Any(not_anonymous(), msg=_("You need to be authenticated")))
43 43
    def default(self, page = None, host = None, service = None, output = None,
44 44
            trouble_ticket=None, *argv, **krgv):
......
205 205

  
206 206
    @validate(validators={'idaggregate':validators.String(not_empty=True)},
207 207
            error_handler=process_form_errors)
208
    @expose('vigiboard.templates.vigiboard')
208
    @expose('vigiboard.html')
209 209
    @require(Any(not_anonymous(), msg=_("You need to be authenticated")))
210 210
    def event(self, idaggregate):
211 211
        """
......
251 251

  
252 252
    @validate(validators={'host':validators.NotEmpty(),
253 253
        'service':validators.NotEmpty()}, error_handler=process_form_errors)
254
    @expose('vigiboard.templates.vigiboard')
254
    @expose('vigiboard.html')
255 255
    @require(Any(not_anonymous(), msg=_("You need to be authenticated")))
256 256
    def host_service(self, host, service):
257 257
        
vigiboard/controllers/vigiboard_controller.py
30 30

  
31 31
    error = ErrorController()
32 32

  
33
    @expose('vigiboard.templates.login')
33
    @expose('login.html')
34 34
    def login(self, came_from=url('/')):
35 35
        """Start the user login."""
36 36
        login_counter = request.environ['repoze.who.logins']
vigiboard/public/css/style.css
1
html {
2
	background: #555555 url('../images/pagebg.png') top left repeat-x;
3
	text-align: center;
4
	margin: 0;
5
	padding: 0;
6
}
7

  
8
body {
9
	text-align: left;
10
	width: 960px;
11
	margin: 0 auto;
12
	padding: 0;
13
	font-size: 12px;
14
	font-family:"Lucida Grande","Lucida Sans Unicode",geneva,verdana,sans-serif;
15
}
16

  
17
a {
18
	color: #286571;
19
}
20

  
21
#header {
22
	height: 132px;
23
	margin: 10px 10px 0 10px;
24
	background: url('../images/headerbg.png') top left no-repeat;
25
}
26

  
27
#header h1 {
28
	padding: 0;
29
	margin: 0;
30
	padding-top: 30px;
31
	padding-left: 180px;
32
	color: #fff;
33
	position: relative;
34
	font-size: 36px;
35
}
36

  
37
#header h1 .subtitle {
38
	font-size: 60%;
39
	position: absolute;
40
	left: 240px;
41
	top: 70px;
42
}
43

  
44
ul#mainmenu {
45
	margin: 0;
46
	padding: 0 10px;
47
	background: url('../images/menubg.png') top left no-repeat;
48
	height: 38px;
49
}
50

  
51
ul#mainmenu li {
52
	list-style-type: none;
53
	margin: 0;
54
	padding: 0;
55
	position: relative;
56
	display: inline;
57
	float: left;
58
}
59

  
60
ul#mainmenu li a {
61
	color: #fff;
62
	float: left;
63
	height: 31px;
64
	display: block;
65
	line-height: 30px;
66
	vertical-align: middle;
67
	padding: 0 10px;
68
	font-size: 12px;
69
	text-decoration: none;
70
	background: url('../images/menu-item-border.png') left top no-repeat;
71
}
72

  
73
ul#mainmenu li a:hover, ul#mainmenu li a.active {
74
	background: url('../images/menu-item-actibg.png') left top no-repeat;
75
}
76

  
77
ul#mainmenu li.first a {
78
	background: none;
79
}
80

  
81
ul#mainmenu li.first a:hover, ul#mainmenu li.first a.active {
82
	background: url('../images/menu-item-actibg-first.png') left top no-repeat;
83
}
84

  
85
ul#mainmenu li.loginlogout
86
{
87
    float: right;
88
    right: 10px;
89
}
90

  
91
ul#mainmenu li.loginlogout a:hover
92
{
93
    background: url('../images/menu-item-border.png') left top no-repeat;
94
}
95

  
96
#content {
97
	background: #fff url('../images/contentbg.png') left bottom no-repeat;
98
	margin : 0 10px 10px 10px;
99
	padding: 0 10px;
100
	overflow: hidden;
101
}
102

  
103
#content .currentpage {
104
	margin-top: 0;
105
}
106

  
107
/* Login form*/
108

  
109
#loginform
110
{
111
    text-align: center;
112
}
113

  
114
form.loginfields
115
{
116
    text-align: left;
117
    width: 270px;
118
    background: url('../images/loginbg.png') top left no-repeat;
119
    padding: 0;
120
    margin: 0 auto;
121
    border: 0;
122
}
123

  
124
form.loginfields h2
125
{
126
    font-size: 16px;
127
    float: left;
128
    padding: 0;
129
    margin: 5px;
130
    margin-top: 0;
131
    background: url('../images/loginheader-left.png') top left no-repeat;
132
}
133

  
134
* html form.loginfields h2
135
{
136
    margin-left: 3px;
137
    width: 80px;
138
    text-align: center;
139
}
140

  
141
form.loginfields h2 span
142
{
143
    background: url('../images/loginheader-right.png') right top no-repeat;
144
    height: 30px;
145
    line-height: 30px;
146
    display: block;
147
    font-size: 100%;
148
    font-weight: normal;
149
    color: #fff;
150
    padding: 0 10px;
151
}
152

  
153
*+html form.loginfields h2 span
154
{
155
    padding: 0 20px;
156
}
157

  
158
form.loginfields label
159
{
160
    clear: left;
161
    float: left;
162
    margin-top: 5px;
163
    margin-left: 10px;
164
    width: 65px;
165
    line-height: 31px;
166
    vertical-align: middle;
167
}
168

  
169
form.loginfields input.text
170
{
171
    float: left;
172
    margin-left: 10px;
173
    margin-top: 5px;
174
    width: 165px;
175
    height: 21px;
176
    padding: 5px;
177
    border: 0;
178
    background: url('../images/inputbg.png') top left no-repeat;
179
    color: #fff;
180
}
181

  
182
form.loginfields input#submit
183
{
184
    background: url('../images/loginbottombg.png') bottom left no-repeat;
185
    width: 270px;
186
    height: 61px;
187
    border: 0;
188
    margin-top: 10px;
189
    color: #fff;
190
    padding: 10px 140px 20px 10px;
191
}
192

  
193
* html form.loginfields input#submit
194
{
195
    clear: both;
196
    margin-left: -10px;
197
}
198

  
199
/* Sidebar */
200
.sidebar {
201
  border: 1px solid #cce;
202
  background-color: #eee;
203
  margin: 0.5em;
204
  margin-left: 1.5em;
205
  padding: 1em;
206
  float: right;
207
  width: 200px;
208
  font-size: 88%;
209
}
210

  
211
.sidebar h2 {
212
  margin-top: 0;
213
  color: black;
214
}
215

  
216
.sidebar ul {
217
  margin-left: 1.5em;
218
  padding-left: 0;
219
}
220

  
221

  
222

  
223
#sb_top {
224
  clear: right;
225
}
226

  
227
#sb_bottom {
228
  clear: right;
229
}
230

  
231
#getting_started {
232
  margin-left: 20px;
233
}
234

  
235
#getting_started_steps a {
236
  text-decoration: none;
237
}
238

  
239
#getting_started_steps a:hover {
240
  text-decoration: underline;
241
}
242

  
243
#getting_started_steps li {
244
  margin-bottom: 0.5em;
245
}
246

  
247
/* Other and footer */
248
#footer {
249
	background: #fff;
250
	padding: 10px;
251
	color:#888888;
252
	font-size:90%;
253
}
254
.flogo {
255
	float:left;
256
	margin-bottom:0px;
257
	padding-left:20px;
258
	padding-right:20px;
259
	padding-top:0px;
260
}
261
.foottext p {
262
	margin: 0; padding: 0;
263
}
264
.code {
265
font-family:monospace;
266
font-size:127%;
267
}
268
span.code {
269
background:#EEEEEE none repeat scroll 0% 0%;
270
font-weight:bold;
271
}
vigiboard/public/css/vigiboard_style.css
1
body {
2
        text-align: left;
3
        width: 99%;
4
        margin: auto;
5
        padding: 0;
6
        font-size: 10px;
7
        font-family:"Lucida Grande","Lucida Sans Unicode",geneva,verdana,sans-serif;
8
}
9

  
10
.table_top {
11
	border: solid 0px black;
12
	width: 100%;
13
	background-color: #F0F1F5;
14
	border-collapse:collapse;
15
	margin-bottom: 10px;
16
}
17
.table_top tr td {
18
	padding: 4px;
19
}
20

  
21
.history_table {
22
	width: 100%;
23
	margin-bottom: 30px;
24
}
25
.history_table thead {
26
	background-color:#F8F8F8;
27
	font-weight:bold;
28
}
29

  
30

  
31
.vigitable {
32
	width: 100%;
33
	border-collapse: collapse;
34
}
35

  
36
.vigitable thead {
37
	text-align: center;
38
}
39

  
40
.vigitable thead tr td {
41
	padding: 0px;
42
}
43

  
44
.vigitable thead tr th {
45
	padding: 4px 10px;
46
	background-color: #EBECF0;
47
	font-weight: bold;
48
	border: solid 1px #EBECF0;
49
}
50

  
51
.vigitable tbody tr {
52
	border: solid 1px white;
53
        empty-cells: show;
54
}
55

  
56
.vigitable tbody tr td {
57
	border: solid 1px white;
58
        padding: 3px 10px;
59
        empty-cells: show;
60
}
61

  
62
.vigitable .fleche_detail {
63
	padding: 3px;
64
}
65

  
66
tr.odd {
67
	background-color: #F8F8F8;
68
}
69

  
70
tr.even {
71
	background-color: #F0F0F0;
72
}
73

  
74
td.Minor {
75
	background-color: #FFFF00;
76
}
77

  
78
td.Major {
79
	background-color: #FF8700;
80
}
81

  
82
td.Critical {
83
	background-color: #FF0000;
84
}
85

  
86
td.Cleared {
87
	background-color: #73DE78;
88
}
89

  
90
td.MinorAck {
91
	background-color: #FCFCA2;
92

  
93
}
94

  
95
td.MajorAck {
96
	background-color: #FCCA90;
97
}
98

  
99
td.CriticalAck {
100
	background-color: #FC9090;
101
}
102

  
103
td.ClearedAck {
104
	background-color: #A9EBAC;
105
}
106

  
107
a {
108
	text-decoration: none;
109
	color: black;
110
}
111

  
112
img { 
113
	border: none;
114
	margin: 0px;
115
}
116

  
117
#flash {
118
	display: none;
119
}
120
#flash, .notice {
121
font-size:120%;
122
font-weight:bolder;
123
margin:0pt auto 0.5em;
124
margin-left: 26px;
125
width:400px;
126
position: absolute;
127
}
128
#flash div, .notice {
129
padding:8px 7px 6px 40px;
130
}
131
#flash .ok {
132
background:#d8ecd8 url(../images/ok.png) no-repeat scroll 0px center;
133
}
134
#flash .warning {
135
background:#fff483 url(../images/warning.png) no-repeat scroll 0px center;
136
}
137
#flash .error {
138
background:#f9c5c1 url(../images/error.png) no-repeat scroll 0px center;
139
}
140
#flash .alert,
141
#flash .info {
142
background:#EEEEFF url(../images/info.png) no-repeat scroll 0px center;
143
}
144
.notice {
145
background:#EEEEFF url(../images/info.png) no-repeat scroll 0px center;
146
}
147
.fielderror {
148
color:red;
149
font-weight:bold;
150
}
151
div.clearingdiv {
152
clear:both;
153
}
154

  
155
.refresh_select {
156
	background-color: #DBEAF5;
157
	border: 1px solid #4682B4;
158
}
159

  
160
.refresh_button {
161
	background-color: red;
162
	color: white
163
}
164

  
vigiboard/public/javascript/vigiboard_plugin/shn.js
1

  
2
function vigiboard_shndialog(url,idd) {
3
	$.getJSON(url+'get_plugin_value',{plugin_name:'shn',idaggregate:idd},function(json){ 				
4
		var ht = '';
5
		for (var i = 0; i < json.shns.length; i++) {
6
			ht += '<li>' + json.shns[i] + '</li>';
7
		}
8
		$('#SHNDialog_liste').html(ht);
9
		$('#SHNDialog').dialog('open');
10
	})
11
}
12
$('.SHNLien').each(function() {
13
	$(this).click(function(e){
14
	$('#SHNDialog').dialog('option','position',[e.clientX+10,e.clientY]);
15
	})});
vigiboard/templates/__init__.py
1
# -*- coding: utf-8 -*-
2
"""Templates package for the application."""
vigiboard/templates/debug.html
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
2
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"
4
      xmlns:py="http://genshi.edgewall.org/"
5
      xmlns:xi="http://www.w3.org/2001/XInclude">
6

  
7
<xi:include href="master.html" />
8

  
9
<head>
10
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
11
  <title>Sample Template, for looking at template locals</title>
12
</head>
13

  
14
<body>
15
    <h1>All objects from locals():</h1>
16

  
17
    <div py:for="item in sorted(locals()['data'].keys())">
18
      ${item}: ${repr(locals()['data'][item])}</div>
19
</body>
20
</html>
vigiboard/templates/error.html
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"
4
      xmlns:py="http://genshi.edgewall.org/"
5
      xmlns:xi="http://www.w3.org/2001/XInclude">
6

  
7
  <xi:include href="master.html" />
8

  
9
<head>
10
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
11
  <title>${_('A %(error_code)d Error has Occurred') % {'error_code': code}}</title>
12
</head>
13

  
14
<body>
15
<h1>${_('Error %(error_code)d') % {'error_code': code}}</h1>
16

  
17
<div>${XML(message)}</div>
18
</body>
19
</html>
vigiboard/templates/footer.html
1
<html xmlns:py="http://genshi.edgewall.org/"
2
      xmlns:xi="http://www.w3.org/2001/XInclude"
3
      py:strip="">
4
<py:def function="footer">
5
<div id="footer"> 
6
  <div class="flogo">
7
    <img src="${tg.url('/images/under_the_hood_blue.png')}" alt="TurboGears" />
8
    <p><a href="http://www.turbogears.org/2.0/">Powered by TurboGears 2</a></p>
9
  </div>
10
  <div class="foottext">
11
    <p>TurboGears is a open source front-to-back web development
12
      framework written in Python. Copyright (c) 2005-2008 </p>
13
  </div>
14
  <div class="clearingdiv"></div>
15
</div>
16
</py:def>    
17
</html>
vigiboard/templates/header.html
1
<html xmlns:py="http://genshi.edgewall.org/"
2
      xmlns:xi="http://www.w3.org/2001/XInclude"
3
      py:strip="">
4
<py:def function="header">
5
  <div id="header">
6
  	<h1>
7
  		Welcome to TurboGears 2
8
		<span class="subtitle">The Python web metaframework</span>
9
	</h1>
10
  </div>
11
</py:def>
12
</html>
vigiboard/templates/index.html
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
2
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"
4
      xmlns:py="http://genshi.edgewall.org/"
5
      xmlns:xi="http://www.w3.org/2001/XInclude">
6

  
7
  <xi:include href="master.html" />
8

  
9
<head>
10
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
11
  <title>Welcome to TurboGears 2.0, standing on the 
12
  shoulders of giants, since 2007</title>
13
</head>
14

  
15
<body>
16
    ${sidebar_top()}
17
  <div id="getting_started">
18
    <h2>Presentation</h2>
19
    <p>TurboGears 2 is rapid web application development toolkit designed to make your life easier.</p>
20
    <ol id="getting_started_steps">
21
      <li class="getting_started">
22
        <h3>Code your data model</h3>
23
        <p> Design your data model, Create the database, and Add some bootstrap data.</p>
24
      </li>
25
      <li class="getting_started">
26
        <h3>Design your URL architecture</h3>
27
        <p> Decide your URLs, Program your controller methods, Design your 
28
            templates, and place some static files (CSS and/or JavaScript). </p>
29
      </li>
30
      <li class="getting_started">
31
        <h3>Distribute your app</h3>
32
        <p> Test your source, Generate project documents, Build a distribution.</p>
33
      </li>
34
    </ol>
35
  </div>
36
  <div class="clearingdiv" />
37
  <div class="notice"> Thank you for choosing TurboGears. 
38
  </div>
39
</body>
40
</html>
vigiboard/templates/login.html
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
2
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"
4
    xmlns:py="http://genshi.edgewall.org/"
5
    xmlns:xi="http://www.w3.org/2001/XInclude">
6

  
7
<xi:include href="master.html" />
8

  
9
<head>
10
<meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
11
<title>Login Form</title>
12
</head>
13

  
14
<body>
15
<div id="loginform">
16
<form action="${tg.url('/login_handler', came_from = came_from.encode('utf-8'), __logins = login_counter.encode('utf-8'))}" method="POST" class="loginfields">
17
    <h2><span>Login</span></h2>
18
    <label for="login">Username:</label><input type="text" id="login" name="login" class="text"></input><br/>
19
    <label for="password">Password:</label><input type="password" id="password" name="password" class="text"></input>
20
    <input type="submit" id="submit" value="Login" />
21
</form>
22
</div>
23
</body>
24
</html>
vigiboard/templates/master.html
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"
4
      xmlns:py="http://genshi.edgewall.org/"
5
      xmlns:xi="http://www.w3.org/2001/XInclude"
6
      py:strip="">
7
    <xi:include href="header.html" />
8
    <xi:include href="sidebars.html" />
9
    <xi:include href="footer.html" />
10
<head py:match="head" py:attrs="select('@*')">
11
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
12
    <title py:replace="''">Your title goes here</title>
13
    <meta py:replace="select('*')"/>
14
    <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/css/style.css')}" />
15
</head>
16

  
17
<body py:match="body" py:attrs="select('@*')">
18
  ${header()}
19
  <ul id="mainmenu">
20
    <li class="first"><a href="${tg.url('/')}" class="${('', 'active')[defined('page') and page==page=='index']}">Welcome</a></li>
21
        <li><a href="${tg.url('/about')}" class="${('', 'active')[defined('page') and page==page=='about']}">About</a></li>
22
        <li py:if="tg.auth_stack_enabled"><a href="${tg.url('/auth')}" class="${('', 'active')[defined('page') and page==page=='auth']}">Authentication</a></li>
23
        <li><a href="http://groups.google.com/group/turbogears">Contact</a></li>
24
    	<li><a href="${tg.url('/vigiboard')}">Vigiboard</a></li>
25
    <span py:if="tg.auth_stack_enabled" py:strip="True">
26
        <li py:if="not request.identity" id="login" class="loginlogout"><a href="${tg.url('/login')}">Login</a></li>
27
        <li py:if="request.identity" id="login" class="loginlogout"><a href="${tg.url('/logout_handler')}">Logout</a></li>
28
        <li py:if="request.identity" id="admin" class="loginlogout"><a href="${tg.url('/admin')}">Admin</a></li>
29
    </span>
30
  </ul>
31
  <div id="content">
32
    <py:if test="defined('page')">
33
    <div class="currentpage">
34
     Now Viewing: <span py:replace="page"/>
35
     </div>
36
    </py:if>
37
    <py:with vars="flash=tg.flash_obj.render('flash', use_js=False)">
38
        <div py:if="flash" py:content="XML(flash)" />
39
    </py:with>
40
    <div py:replace="select('*|text()')"/>
41
    <!-- End of content -->
42
    ${footer()}
43
  </div>
44
</body>
45
</html>
vigiboard/templates/sidebars.html
1
<html xmlns:py="http://genshi.edgewall.org/"
2
      xmlns:xi="http://www.w3.org/2001/XInclude"
3
      py:strip="">
4

  
5
<py:def function="sidebar_top">
6
  <div id="sb_top" class="sidebar">
7
      <h2>Get Started with TG2</h2>
8
      <ul class="links">
9
        <li py:choose="">
10
        <span py:when="defined('page') and page=='index'">
11
            <a href="${tg.url('/about')}">About this page</a> 
12
            A quick guide to this TG2 site 
13
        </span>           
14
        <span py:otherwise=""><a href="${tg.url('/')}">Home</a> Back to your Quickstart Home page </span>
15
        </li>
16
        <li><a href="http://www.turbogears.org/2.0/docs/">TG2 Documents</a> - Read everything in the Getting Started section</li>
17
        <li><a href="http://docs.turbogears.org/1.0">TG1 docs</a> (still useful, although a lot has changed for TG2) </li>
18
        <li><a href="http://groups.google.com/group/turbogears"> Join the TG Mail List</a> for general TG use/topics  </li>
19
      </ul>
20
  </div>
21
</py:def>    
22

  
23
<py:def function="sidebar_bottom">
24
  <div id="sb_bottom" class="sidebar">
25
      <h2>Developing TG2</h2>
26
      <ul class="links">
27
        <li><a href="http://docs.turbogears.org/2.0/RoughDocs/">More TG2 Documents</a> in progress</li>
28
        <li><a href="http://trac.turbogears.org/query?status=new&amp;status=assigned&amp;status=reopened&amp;group=type&amp;milestone=2.0&amp;order=priority">TG2 Trac tickets</a> What's happening now in TG2 development</li>
29
        <li><a href="http://trac.turbogears.org/timeline">TG Dev timeline</a> (recent ticket updates, svn checkins, wiki changes)</li>
30
        <li><a href="http://svn.turbogears.org/trunk">TG2 SVN repository</a> For checking out a copy</li>
31
        <li><a href="http://turbogears.org/2.0/docs/main/Contributing.html#installing-the-development-version-of-turbogears-2-from-source">Follow these instructions</a> For installing your copy</li>
32
        <li><a href="http://trac.turbogears.org/browser/trunk">TG2 Trac's svn view</a> In case you need a quick look</li>
33
        <li><a href="http://groups.google.com/group/turbogears-trunk"> Join the TG-Trunk Mail List</a> for TG2 discuss/dev </li>
34
      </ul>
35
  </div>
36
</py:def>    
37

  
38
</html>
vigiboard/templates/vigiboard.html
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
2
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"
4
      xmlns:py="http://genshi.edgewall.org/"
5
      xmlns:xi="http://www.w3.org/2001/XInclude">
6

  
7
  <xi:include href="vigiboard_event_table.html" />
8

  
9
<head>
10
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
11
  <title>Vigiboard</title>
12
  <link rel="stylesheet" type="text/css" href="${tg.url('/css/vigiboard_style.css')}" />
13
</head>
14

  
15
<body style="font-size:${tg.session.get('fontsize',tg.config['vigiboard_font.size'])}">
16
	
17
<table class="table_top" summary="Toolbar">
18
	<tr>
19
		<td>
20
			<a py:if="tg.config.get('vigiboard_links.logo')" href="${tg.config['vigiboard_links.logo']}"><img alt="" src="${tg.url('/images/vigilo.png')}" style="width:58px;"/></a>
21
			<a py:if="not tg.config.get('vigiboard_links.logo')" href="${tg.url('/')}"><img alt="" src="${tg.url('/images/vigilo.png')}" style="width:58px;"/></a>
22
			v${tg.config['vigiboard_version']}
23
		</td>
24

  
25
		<td style="margin-left: 30px; float: right">
26
			<a href="${tg.url('/')}">
27
				<img src="${tg.url('/images/home.gif')}" alt="Home" title="Home" />
28
			</a>
29
			<a id="SearchLien" href="javascript:vigiboard_searchdialog()">
30
				<img src="${tg.url('/images/filter.png')}" alt="Filter display" title="Filter display"/>
31
			</a>
32
			<a href="${tg.url('/logout_handler')}">
33
				<img src="${tg.url('/images/logout.png')}" alt="Log out" title="Log out"/>
34
			</a>
35
		</td>
36

  
37
		<td style="margin-left: 30px; margin-top: 4px; float: right">
38
			<a href="javascript:change_fontsize('5px')"><img alt="Default font size" title="Default font size" src="${tg.url('/images/icn_text_sm.png')}" /></a>
39
			<a href="javascript:change_fontsize('10px')"><img alt="Medium font size" title="Medium font size" src="${tg.url('/images/icn_text_md.png')}" /></a>
40
			<a href="javascript:change_fontsize('25px')"><img alt="Large font size" title="Large font size" src="${tg.url('/images/icn_text_lg.png')}" /></a>
41
		</td>
42

  
43
		<td style="margin-left: 30px; float: right">
44
			<select id="refresh_time" class="refresh_select">
45
				<option value="0">Never</option>
46
				<option value="30000">30 Secondes</option>
47
				<option value="60000">1 Minute</option>
48
				<option value="300000">5 Minutes</option>
49
				<option value="600000">10 Minutes</option>
50
			</select>
51
			<input type="button" id="refresh_button" class="refresh_button" onclick="change_refresh($('#refresh_time').val())" value="[${_('Start')}]" />
52
		</td>
53

  
54
		<td style="margin-top: 8px; float: right">
55
			<span py:if="search['host'] or search['service'] or search['output'] or search['tt']" style="color: rgb(70, 130, 180)">
56
				<a href="${tg.url('/')}" style="color:rgb(70, 130, 180); text-decoration: underline;">${_('You are in Search mode, click here to return to the initial mode.')}</a>
57
			</span>
58
		</td>
59
	</tr>
60
</table>	
61

  
62
<py:with vars="flash=tg.flash_obj.render('flash', use_js=False)">
63
<div py:if="flash" py:content="XML(flash)" />
64
</py:with>
65
<div class="main_content">
66
	${event_table(events,page,pages,rows_info,event_edit_status_options,history,hist_error,search)}
67
</div>
68
<script type="text/javascript">
69
	$("#flash").show("slow",function(){
70
		setTimeout('$("#flash").hide("slow")',5000);
71
			});
72
	function change_fontsize(size) {
73
		document.body.style.fontSize = size;
74
		$.getJSON("${tg.url('/set_fontsize')}",{'fontsize':size},function(json){
75
			if (json.ret == 'fail')
76
				alert("${_('Unable to save preferences')}");
77
		})
78
	}		
79
	var refresh_timeout;
80
	function change_refresh_rate(timeout) {
81
		if (timeout != 0) {
82
			if (refresh_timeout) {
83
				clearTimeout(refresh_timeout);
84
				refresh_timeout = null;
85
				$('#refresh_time').removeAttr('disabled');
86
				$('#refresh_button').attr('value','[${_('Start')}]');
87
			} else {
88
				refresh_timeout = setTimeout('window.location.reload(true);', timeout);
89
				$('#refresh_time').attr("disabled", "disabled");
90
				$('#refresh_button').attr('value','[${_('Stop')}]');
91
			}
92
		}
93
	}
94
	function change_refresh(timeout) {
95
		$.getJSON("${tg.url('/set_refresh')}",{'refresh':timeout},function(json){});
96
		change_refresh_rate(timeout);
97
	}
98
	<py:if test="tg.session.get('refresh','0') != '0'">
99
	change_refresh_rate(${tg.session.get('refresh',0)});
100
	</py:if>
101
</script>
102
</body>
103
</html>
vigiboard/templates/vigiboard_event_table.html
1
<html xmlns:py="http://genshi.edgewall.org/"
2
      xmlns:xi="http://www.w3.org/2001/XInclude"
3
      py:strip="">
4

  
5

  
6
  <xi:include href="vigiboard_history_table.html" />
7

  
8
<py:def function="event_table(events,page,pages,rows_info,edit_event_status_options,history,hist_error,search)">
9
<?python from genshi import HTML ?>
10

  
11
<py:if test="len(events) > 1">
12
<table class="vigitable" summary="Event table">
13
	<thead>
14
		<tr >
15
			<td style="width:26px;border-right: solid 1px #4682b4">
16
				<a py:if="page > pages[0]" href="${tg.url('/%d' % (page-1))}"><img src="${tg.url('/images/fleche_up.png')}" alt="Previous" title="Previous page"/></a>
17
				<img py:if="page == pages[0]" src="${tg.url('/images/fleche_up.png')}" alt="Previous" title="Previous page" />
18
			</td>
19
			<!--!
20
				8 = nombre de champs affichés en permanence.
21
				events[1][6] contient une liste des en-têtes générés par les plugins.
22
				La somme est calculée de sorte que le bandeau de changement de pages
23
				soit aligné sur le reste du tableau (les alertes).
24
			-->
25
    		<td colspan="${8+len(events[1][6])}" style="color: white;background-color: #4682b4" >${_('Showing rows %(id_first_row)d to %(id_last_row)d of %(total_rows)d') % rows_info} <br />
26
				Pages <py:for each="p in pages">
27
				<a py:if="p != page" href="${tg.url('/%d' % p)}" py:content="p" />
28
				<span py:if="p == page" py:replace="p" />
29
				</py:for>
30
			</td>
31
			<td style="width:26px;border-left: solid 1px #4682b4">
32
				<a py:if="pages[-1] > page" href="${tg.url('/%d' % (page+1))}"><img src="${tg.url('/images/fleche_down.png')}" alt="Next" title="Next page"/></a>
33
				<img py:if="page == pages[-1]" src="${tg.url('/images/fleche_down.png')}"  alt="Next" title="Next page" />
34
			</td>
35
		</tr>
36

  
37
		<tr>
38
			<py:for each="(pname,pstyle) in events[0]">
39
			<th style="padding: 5px;" py:attrs="pstyle">${HTML(pname)}</th>
40
			</py:for>
41
			<th style="width:26px;padding: 0px;"><a class="Edit_EventsLien" href="javascript:vigiboard_edit_eventdialog('all')"><img src="${tg.url('/images/icon_page_edit.png')}" alt="Edit selected" title="Edit all selected events"/></a></th>
42
			<th style="padding:0px;"><input title="Select/Unselect all" id="vigiboard_checkall_checkbox" type="checkbox" onclick="vigiboard_checkall()" /></th>
43
		</tr>
44
	</thead>
45
	
46
	<tbody>
47
		<py:for each="(event,class_tr,class_td_severity,class_td_date,img_fleche,img_statu,plugin) in events[1:]">
48
		<tr py:attrs="class_tr">
49
			<td style="padding: 3px;" py:attrs="class_td_severity">
50
			    <a href="javascript:vigiboard_historydialog('${event.idaggregate}')" class="HistoryLien"><img src="${tg.url(img_fleche['src'])}" style="width:20px" alt="Details" title="Event details" /></a>
51
		    </td>
52
			<td py:attrs="class_td_date">
53
			    <span style="font-weight: bold;">${event.get_date('timestamp_active')}</span>
54
			    <br />[${event.get_since_date('timestamp_active')}]
55
			 </td>
56
			<td py:attrs="class_td_date" style="text-align:center">${event.occurrences}</td>
57
			<td>${event.cause.hostname}</td>
58
			<td>${event.cause.servicename}</td>
59
			<td>${event.cause.message}</td>
60
			<td py:for="plug in plugin" py:attrs="plug[1]">${HTML(plug[0])}</td>
61
			<td style="text-align: center"><a py:if="event.trouble_ticket is not None" href="${
62
					tg.config['vigiboard_links.tt'] % {
63
						'idaggregate': event.idaggregate,
64
						'host': event.cause.hostname,
65
						'service': event.cause.servicename,
66
						'tt': event.trouble_ticket }}">[${event.trouble_ticket}]</a></td>
67
			<td style="text-align: center"><img py:attrs="img_statu" py:if="img_statu != None" alt="Status" title="Event status"/></td>
68
			<td py:attrs="class_td_date" style="padding: 0px;text-align: center"><a class="Edit_EventsLien" href="javascript:vigiboard_edit_eventdialog('${event.idaggregate}')"><img src="${tg.url('/images/icon_page_edit.png')}" alt="Edit" title="Edit this event"/></a></td>
69
			<td py:attrs="class_td_date" style="padding:0px;text-align: center"><input type="checkbox" class="Edit_EventsCheckBox" value="${event.idaggregate}"/></td>
70
		</tr>
71

  
72
    		<py:if test="hist_error == True">
73
			<tr><td colspan="10+len(plugin)">
74
				${history_table(history[event.idcause],hist_error)}	
75
			</td></tr>
76
		    </py:if>
77
		</py:for>
78
	
79
	</tbody>
80

  
81
</table>
82

  
83
${tmpl_context.edit_eventdialog()}
84
${tmpl_context.searchdialog}
85
${tmpl_context.historydialog}
86
<py:for each="fct,tpl in plugin_context">
87
	${fct()}
88
	<xi:include href="vigiboard_plugin/${tpl}.html" /> 
89
</py:for>
90

  
91
<script type="text/javascript">
92
	function vigiboard_historydialog(idd) {
93
		$.getJSON("${tg.url('/history_dialog')}",{idaggregate:idd},function(json){
94
			$('#HistoryDialog_initial_state').html(json.initial_state);
95
			$('#HistoryDialog_current_state').html(json.current_state);
96
			$('#HistoryDialog_detailed_event').attr('href', '${tg.url('/event/')}' + json.idaggregate);
97
			$('#HistoryDialog_detailed_host').attr('href', '${tg.url('/host_service/')}' + json.host + "/" + json.service);
98
			<py:for each="edname, edit in tg.config['vigiboard_links.eventdetails'].iteritems()">
99
			$('#HistoryDialog_${edname}').attr('href', json.eventdetails['${edname}']);
100
			</py:for>
101
			$('#HistoryDialog').dialog('open');
102
		})
103
	}
104
	function vigiboard_edit_eventdialog(idd) {
105
		$('#edit_event_form_comment').attr('value','');
106
		$('#edit_event_form_trouble_ticket').attr('value','');
107
		$('#edit_event_form_tt_create').attr('checked',false);
108
		$('#edit_event_form_status').find('option:first').attr('selected', 'selected').parent('select');;
109
		if ( idd == 'all' ) {
110
			var a = '';
111
			$('.Edit_EventsCheckBox').each(function() {
112
				if ( $(this).attr('checked'))
113
					a += $(this).attr('value') + ',';
114
			});
115
			idd = a;
116
		}
117
		$('#edit_event_form_id').attr('value',idd);	
118
		$('#Edit_EventsDialog').dialog('open');
119
	}
120
	function vigiboard_searchdialog() {
121
		$('#search_form_host').attr('value','${search['host']}');
122
		$('#search_form_service').attr('value','${search['service']}');
123
		$('#search_form_output').attr('value','${search['output']}');
124
		$('#search_form_trouble_ticket').attr('value', '${search['tt']}');
125
		$('#SearchDialog').dialog('open');	
126
	}
127
	function vigiboard_checkall() {
128
		var val = $('#vigiboard_checkall_checkbox').attr('checked');	
129
		$('input[type=checkbox]').each(function(){$(this).attr('checked',val);});
130
	}
131
	$('.HistoryLien').each(function() {
132
                $(this).click(function(e){
133
                $('#HistoryDialog').dialog('option','position',[e.clientX+10,e.clientY]);
134
		})});
135
	$('.Edit_EventsLien').each(function() {
136
                $(this).click(function(e){
137
                $('#Edit_EventsDialog').dialog('option','position',[e.clientX-400-20,e.clientY]);
138
		})});
139
	$('#SearchLien').click(function(e){
140
	        $('#SearchDialog').dialog('option','position','center');
141
	});
142
	
143

  
144
</script>
145

  
146
<div style="display:none" id="HistoryDialog">
147
Initial State: <span id="HistoryDialog_initial_state" /><br />
148
Current State: <span id="HistoryDialog_current_state" /><br />
149
<ul>
150
	<li><a id="HistoryDialog_detailed_event" href="#">Detailed history for this event</a></li>
151
	<li><a id="HistoryDialog_detailed_host" href="#">Detailed history for this host/service</a></li>
152
	<li py:for="edname, edit in tg.config['vigiboard_links.eventdetails'].iteritems()">
153
		<a href="#" id="HistoryDialog_${edname}">${edit[0]}</a>
154
	</li>
155
</ul>
156
</div>
157

  
158
<div  style="display:none" id="Edit_EventsDialog">
159
	${tmpl_context.edit_event_form()} 
160
</div>
161
<div  style="display:none" id="SearchDialog">
162
	${tmpl_context.search_form()}
163
</div>
164

  
165
</py:if>
166

  
167
<py:if test="1 >= len(events)">
168
<table class="vigitable">
169

  
170
        <thead>
171
                <tr>
172
                        <td style="width:26px;background-color: rgb(70, 130, 180);">
173
                                <img src="${tg.url('/images/fleche_up.png')}" alt="Previous" title="Previous page"/>
174
                        </td>
175
                        <td colspan="9" style="width:100%;background-color:#4682B4;color:white;text-align:center">Showing rows 0 to 0 of 0<br />
176
                                Page 0
177
                        </td>
178
                        <td style="width:26px">
179
                                <img src="${tg.url('/images/fleche_down.png')}" alt="Next" title="Next page" />
180
                        </td>
181
                </tr>
182

  
183
                <tr style="background-color:#F8F8F8;font-weight: bold">
184
			        <py:for each="(pname,pstyle) in events[0]">
185
                        <td py:attrs="pstyle">${HTML(pname)}</td>
186
                    </py:for>
187
			            <td style="text-align: center;"><img src="${tg.url('/images/icon_page_edit.png')}" alt="Edit selected" title="Edit all selected events"/></td>
188
                        <td style="text-align: center;"><input id="vigiboard_checkall_checkbox" type="checkbox" /></td>
189
                </tr>
190
        </thead>
191

  
192
        <tbody>
193
<tr><td colspan="9"><br />No event</td></tr>
194
</tbody>
195
</table>
196
${tmpl_context.searchdialog}
197
<div  style="display:none" id="SearchDialog">
198
        ${tmpl_context.search_form()}
199
</div>
200
<script type="text/javascript">
201
function vigiboard_searchdialog() {
202
                $('#search_form_host').attr('value','');
203
                $('#search_form_service').attr('value','');
204
                $('#search_form_output').attr('value','');
205
                $('#search_form_trouble_ticket').attr('value', '');
206
                $('#SearchDialog').dialog('open');      
207
        }
208
$('#SearchLien').click(function(e){
209
                $('#SearchDialog').dialog('option','position','center');
210
        });
211
</script>
212

  
213
</py:if>
214

  
215
</py:def>
216

  
217
</html>
vigiboard/templates/vigiboard_history_table.html
1
<html xmlns:py="http://genshi.edgewall.org/"
2
      xmlns:xi="http://www.w3.org/2001/XInclude"
3
      py:strip="">
4

  
5
<py:def function="history_table(history,error)">
6

  
7
<p py:if="(not history or len(history) == 0) and error == True">
8
There is no history.
9
</p>
10

  
11
<py:if test="history and len(history) > 0">
12
<table class="history_table" summary="History">
13
	<thead>
14
		<tr>
15
			<td>Time</td>
16
			<td>User</td>
17
			<td>Type</td>
18
			<td>Value</td>
19
			<td>Text</td>
20
		</tr>
21
	</thead>
22
	<tbody>
23
		<py:for each="(time,user,type,value,text,class_tr,class_value) in history">
24
		<tr py:attrs="class_tr">
25
			<td>${time}</td>
26
			<td>${user}</td>
27
			<td>${type}</td>
28
			<td py:attrs="class_value">${value}</td>
29
			<td>${text}</td>
30
		</tr>
31
		</py:for>
32
	</tbody>
33
</table>
34
</py:if>
35

  
36
</py:def>
37

  
38
</html>
vigiboard/templates/vigiboard_plugin/shn.html
1
<html xmlns:py="http://genshi.edgewall.org/"
2
      xmlns:xi="http://www.w3.org/2001/XInclude"
3
      py:strip="">
4
      
5

  
6
      <div id="SHNDialog">
7
	      <ul id="SHNDialog_liste">
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff