1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xml:lang="en"
lang="en"
dir="ltr"
i18n:domain="launchpad"
>
<head>
<metal:load-javascript
use-macro="context/@@+base-layout-macros/load-javascript" />
<metal:lp-client-cache
use-macro="context/@@+base-layout-macros/lp-client-cache" />
<metal:launchpad-stylesheet
use-macro="context/@@+base-layout-macros/launchpad-stylesheet-3-0" />
</head>
<body style="margin: 0; padding: 0">
<div id="timeline-container">
<div id="spinner"
style="position: absolute; margin: 0; top: 50%; left: 50%">
<img src="/@@/spinner" /> Loading...
</div>
</div>
<script>
function show_timeline_graph(include_inactive, resize_frame, start, size) {
if (include_inactive == 'true') {
include_inactive = true;
} else {
include_inactive = false;
}
var get_timeline_config = {
parameters: {include_inactive: include_inactive},
};
start = parseInt(start);
size = parseInt(size);
if (start != NaN && start >= 0) {
get_timeline_config.start = start;
}
if (size != NaN && size >= 1) {
get_timeline_config.size = size;
}
LPS.use('lp.registry.timeline', 'node', 'lp.app.dragscroll', 'lp.client',
function(Y) {
Y.on('domready', function(e) {
if (Y.UA.ie) {
return;
}
var display_graph = function(result) {
// The result for a single productseries needs to be
// wrapped in an array just as all the series for a
// product would be.
var entries = null;
if (result.entries === undefined) {
entries = [result];
}
else {
entries = result.entries;
}
// XXX: EdwinGrubbs 2010-11-18 bug=677671
// The get_timeline() REST method used to return an
// arbitrary chunk of JSON. Since lazr.restful can only
// batch entries, the LP.client is now wrapping in
// objects that provide more functionality for the
// entries, so we need to unwrap it before providing
// the info to the TimelineGraph object.
var timeline_data = [];
Y.each(entries.reverse(), function(series, i) {
var plain_series = {};
var fields = [
'is_development_focus',
'landmarks',
'name',
'status',
'uri'
];
Y.each(fields, function(field, j) {
plain_series[field] = series.get(field);
});
timeline_data.push(plain_series);
});
// Don't display graph if there are zero milestones or
// releases.
var container = Y.one('#timeline-container');
container.setStyle('display', 'block');
var config = {
timeline: timeline_data,
boundingBox: container
};
if (resize_frame !== '') {
config.resize_frame = resize_frame;
}
var graph = new Y.lp.registry.timeline.TimelineGraph(
config);
graph.render();
Y.one('#spinner').setStyle('display', 'none');
// Scroll to the most recent milestones or
// releases on the development focus series.
graph.scroll_to_last_development_focus_landmark();
}
get_timeline_config.on = {
success: display_graph,
failure: function(ignore, response, args) {
// XXX: EdwinGrubbs 2009-07-02 bug=394912
// Firefox triggers the failure handler with
// status=0 if the page load is interrupted.
if (response.status !== 0) {
alert(
response.status +
' Error retrieving series data.\n' +
response.responseText);
}
}
};
var client = new Y.lp.client.Launchpad();
client.named_get(
LP.cache['context']['self_link'],
'get_timeline', get_timeline_config);
var drag_scroll_handler =
new Y.lp.app.dragscroll.DragScrollEventHandler();
drag_scroll_handler.activate();
});
});
}
</script>
<script
tal:define="
include_inactive request/form/include_inactive | string:false;
resize_frame request/form/resize_frame | string:;
start request/form/start | string:;
size request/form/size | string:"
tal:content="
string: show_timeline_graph(
'${include_inactive}', '${resize_frame}', '${start}', '${size}');"/>
</body>
</html>
|