-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
395 lines (330 loc) · 14.1 KB
/
index.php
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>UI and Graphics Team Dashboard</title>
<!-- <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"> -->
<link href="css/style.css" type="text/css" rel="stylesheet">
<!-- <link href="css/prettify.min.css" rel="stylesheet" type="text/css"> -->
<style type="text/css">.fn-gantt *, .fn-gantt *:after,.fn-gantt *:before {-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;} </style>
<!-- <script src="js/jquery-1.7.2.min.js"></script> -->
<!-- <script src="js/jquery.fn.gantt.js"></script> -->
<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="easyui/demo/demo.css">
<script type="text/javascript" src="easyui/jquery.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script src="js/jquery.fn.gantt.js"></script>
<link type="text/css" rel="Stylesheet" href="themes/vader/jquery-ui.css">
<script src="jsalert/jquery.alerts.js" type="text/javascript"></script>
<link href="jsalert/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
<!-- <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"> -->
<!-- <link href="css/style.css" type="text/css" rel="stylesheet"> -->
<!-- <link href="css/prettify.min.css" rel="stylesheet" type="text/css"> -->
<script type="text/javascript">
function RefreshPage() {
window.location.reload(true);
}
$(document).ajaxStart(function ()
{
$(document.body).css({ 'cursor': 'wait' })
});
$(document).ajaxComplete(function ()
{
$(document.body).css({ 'cursor': 'default' })
});
function startAjax()
{
jAlert("In Progress .....","Updating .....");
document.body.style.cursor='wait'
$.ajax({
type: "POST",
url: "update.php",
// data: "name=name&location=location",
success: function(msg)
{
if(msg.length == 22)
{
jAlert(msg,"Error");
//setTimeout('RefreshPage()',2000);
//alert("Updated. Please refresh the page");
}
else
{
jAlert(msg,"Done");
setTimeout('RefreshPage()',2000);
}
}});
}
$(document).ready(function ()
{
$(".gantt").gantt({
source:"json-generator.php?component=all&_showunworkedtasks=0&_showrecentonly=0&_weekly=1&_significant=1",
scale: "weeks",
navigate: "scroll",
maxScale: "months",
minScale: "days",
scrollToToday:true,
itemsPerPage:100,
useCookie: false,
onItemClick: function(data) {
//alert("showdata.php?"+data)
// $('#panel-title').attr('title', 'Photo by Kelly Clark');
$('#external').load("showdata.php?"+data, function(response, status, xhr) {
if (status == "error")
{
var msg = "Sorry but there was an error: ";
alert(msg + xhr.status + " " + xhr.statusText);
}
});
//var page = "showdata.php?"+data;
//alert(page);
//var pagetitle = "dfff";//$(this).attr("title")
//var height = 570;//$(this).attr("height")
//var width = 1200;//$(this).attr("width")
//var resizeable = false;//$(this).attr("resizeable")
//var $dialog = $('<div></div>')
//.html('<iframe style="" " src="' + page + '" width="99.5%" height="100%"></iframe>')
//.dialog({
// autoOpen: false,
// modal: true,
// height:height,
// resizable: resizeable,
// width: width,
// title: pagetitle
//});
//$dialog.dialog('open');
},
});
$('a#pop').live('click', function (e)
{
e.preventDefault();
var page = $(this).attr("href")
var pagetitle = $(this).attr("title")
var height = $(this).attr("height")
var width = $(this).attr("width")
var resizeable = $(this).attr("resizeable")
var $dialog = $('<div></div>')
.html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>')
.dialog({
autoOpen: false,
modal: true,
height:height,
resizable: resizeable,
width: width,
title: pagetitle
});
$dialog.dialog('open');
});
});
</script>
</head>
<?php
require_once('common.php');
require_once('db-interface.php');
$projects = ReadDataBase();
//SavePieChartRecentProjects($projects);
//return;
function GetEngineerList($component)
{
$eng_str = "";
foreach($component->recent_engineers as $engineer=>$value)
if($eng_str=="") $eng_str = DisplayName($engineer); else $eng_str = $eng_str." , ".DisplayName($engineer);
return $eng_str;
}
function GetWeekNumber($date)
{
$date = DateTime::createFromFormat("Y-m-d", $date);
return date("W", $date->getTimestamp());
}
function DisplayOldProjects()
{
global $projects;
foreach($projects as $component)
{
if(!$component->recent)
{
$tabs = "    ";
$encode_comp_name = str_replace(" ","%20",$component->name);
if($component->status == "In Progress") $link_color = "green";
else $link_color = "grey";
$link= 'showgantt.php?_component='.$encode_comp_name.'&_showunworkedtasks=1&_showrecentonly=0&_itemsperpage=200&_scroll=1';
echo '<p style="margin-left: .5cm;background-color: #f6f6f6;">';
$leftspan= '<a id="pop" width="1200" height="570" title="'.$component->name.'" href='.$link. '>'.$component->name.'</a>';
echo $leftspan;
echo '<span style="float:left: 6cm;color:'.$link_color.'">'.$tabs.round($component->dayspent)." Days</span>";
$egr_list = GetEngineerList($component);
echo '<span style="color:grey;font-size:80%;float:right; border-right: thick double #f6f6f6; border-right-width: 40px; background-color:f6f6f6">'.$egr_list."</span>";
echo '</p>';
}
}
}
function IsCurrentWeek($date)
{
$date_= DateTime::createFromFormat("Y-m-d", $date);
$ts_ = $date_->getTimestamp();
$this_week_no=date("W");
$week = date("W", $ts_);
//echo $date." is week ".$week.EOL;
//echo "This week no ".$this_week_no.EOL;
//echo $this_week_no - $week;
if($this_week_no == $week)
return true;
else
return false;
}
function DisplayResentWorkLogs()
{
global $projects;
echo '<div id="projects" title="Recent Project Feed" style="">';
echo '</div>';
echo '<div>';
echo "<p> Recent Projects </p>";
echo '</div>';
foreach($projects as $component)
{
if($component->recent)
{
$eng_str = GetEngineerList($component);
$tabs = "    ";
$encode_comp_name = str_replace(" ","%20",$component->name);
// echo count($component->parenttasks);
$link = '<span style="float:right;"><a id="pop" width="1200" height="570" style="padding-right: 1cm;" title="'.$component->name.'" href=showgantt.php?_component='.$encode_comp_name.'&_showunworkedtasks=1&_showrecentonly=0&_itemsperpage=200>Gantt</a></span>';
if($component->status == "In Progress")
$link_color = "green";
else
$link_color = "grey";
$title = "<span style='float:left;'>".$tabs.$component->name."<span style='color:".$link_color.";font-size:80%'>".$tabs.round($component->dayspent)." Days"."</span>"."</span><span style='color:grey;font-size:80%;float:right;padding-right:1cm;;'>".$eng_str."</span>";
//$title ="ddddd";
echo'<div id="project1" title="'.$title.'" data-options="selected:true" style="padding:10px;">';
echo $link."<br>";
foreach($component->parenttasks as $parenttask)
{
if($parenttask->recent)
{
echo $tabs.'<a id="pop" width="1200" height="570" style="font-weight: bold;" title="'.$parenttask->key.'" href='.JIRA_SERVER.'/browse/'.$parenttask->key.'>'.$parenttask->summary.'</a>'."".EOL;
$timespent = 0.0;
foreach($parenttask->worklogs as $worklog)
{
if($worklog->recent)
{
if( IsCurrentWeek($worklog->started))
$image = "thisweek.png";
else
$image = "prevweek.png";;
//$timespent = (float)$timespent + (float)$worklog->timespent;
echo '<p style="margin-left: .5cm;margin-right: .5cm;">';
$href=JIRA_SERVER.'/browse/'.$parenttask->key.'?focusedWorklogId='.$worklog->id.'&page=com.atlassian.jira.plugin.system.issuetabpanels%3Aworklog-tabpanel#worklog-'.$worklog->id.'>';
echo '<a id="pop" width="1200" height="570" style="font-weight: bold;" title="'.$parenttask->key.'" href="'.$href.'">';
echo '<img src="'.$image.'" alt="More" style="width:10;height:10px;">';
//echo WeekNumber($worklog->started).EOL;
echo '</a>';
echo " ".DisplayName($worklog->author)." ".$worklog->comment.EOL;
//echo $worklog->started;
echo '</p>';
}
}
foreach($parenttask->subtasks as $subtask)
{
if(!$subtask->recent)
continue;
echo '<p style="margin-left: .5cm;margin-right: .5cm;">';
echo '<a id="pop" width="1200" height="570" style="" title="'.$subtask->key.'" href='.JIRA_SERVER.'/browse/'.$subtask->key.'>'.$subtask->summary.'</a>'."".EOL;
echo '</p>';
foreach($subtask->worklogs as $worklog)
if($worklog->recent)
{
if( IsCurrentWeek($worklog->started))
$image = "thisweek.png";
else
$image = "prevweek.png";;
//$timespent = (float)$timespent + (float)$worklog->timespent;
echo '<p style="margin-left: .5cm;margin-right: .5cm;">';
// echo '<a id="pop" width="1200" height="570" style="" title="'.$subtask->key.'" href='.JIRA_SERVER.'/browse/'.$subtask->key.'>'.$subtask->summary.'</a>'."".EOL;
//echo $subtask->summary.'<br>';
$href=JIRA_SERVER.'/browse/'.$subtask->key.'?focusedWorklogId='.$worklog->id.'&page=com.atlassian.jira.plugin.system.issuetabpanels%3Aworklog-tabpanel#worklog-'.$worklog->id.'>';
echo '<a id="pop" width="1200" height="570" style="font-weight: bold;" title="'.$subtask->key.'" href="'.$href.'">';
echo '<img src="'.$image.'" alt="More" style="width:10;height:10px;">';
echo '</a>';
echo " ".DisplayName($worklog->author)." ".$worklog->comment.EOL;
//echo $worklog->started;
echo '</p>';
}
}
//$timespent = " (".truncate($timespent,1). " Days)";
//echo '<script>';
//echo '$("#task'.$task->id.'").append("'.$timespent.'")';
//echo '</script>';
}
}
echo'</div>';
}
}
}
function GetEastPanelContent()
{
echo '<div class="easyui-accordion" style="width:100%;">';
echo '<img style="max-width:500px;max-height:500px;width:auto; height:auto;" id="graph-image" alt="Pie chart" src="generated/projects.png" />';
echo '<img style="max-width:500px;max-height:500px;width:auto; height:auto;" id="graph-image" alt="Pie chart" src="generated/workload.png"/>';
global $projects;
$height = count($projects)*28;
//echo '<img style="max-width:500px;max-height:500px;width:auto; height:auto;" id="graph-image" alt="Pie chart" src="bar.jpg" />';
//echo '<iframe id="foo" name="foo" frameborder="0" scrolling="no" width="100%" height="'.$height.'" src="showgantt.php?component=all&_showunworkedtasks=0&_showrecentonly=0&_itemsperpage=200&_scroll=1&_weekly=1&_scale=weeks&_significant=1"></iframe>';
//echo '<div id="projects" title="Click for Old Projects" data-options="" style="">';
//DisplayOldProjects();
//echo '</div>';
echo '<div id="projects" title="Monthly Summary" data-options="selected:true" style="">';
echo '<div class="gantt" style="width:100%;" ></div>';
echo '</div>';
echo '</div>';
echo '<div id="worklog" class="easyui-panel" title="Work Logs" style="width:100%;height:50%;padding:10px;background:#F0F8FF;overflow: hiddden;" data-options="fit:true, closable:false, collapsible:false,minimizable:false,maximizable:false">';
//echo '<p>panel content.</p>';
echo '<div id="external" style="float:left; height: 100%; width:95%; display: flex; overflow: hiddden;" ></div>';
//echo '<p>panel content.</p>';
echo '</div>';
// echo '<div id="external" style="float:left; height: 100%; width:95%; display: flex; overflow: hiddden;" >sddsdsdsd</div>';
}
function GetWestPanelContent()
{
echo '<div class="easyui-accordion" style="width:100%;">';
DisplayResentWorkLogs();
echo '<div id="projects" title="Old Projects" data-options="" style="">';
DisplayOldProjects();
echo '</div>';
//global $projects;
//$height = count($projects)*29;
echo '</div>';
//echo '<img style="max-width:500px;max-height:500px;width:auto; height:auto; display:table-cell;margin: auto auto;" id="graph-image" alt="Pie chart" src="generated/projects.png" />';
//echo '<img style="max-width:500px;max-height:500px;width:auto; height:auto; display:table-cell;margin: auto auto;" id="graph-image" alt="Pie chart" src="generated/workload.png"/>';
}
function GetSouthPanelContent()
{
global $projects;
$height = count($projects)*29;
//echo '<iframe id="foo" name="foo" frameborder="0" scrolling="no" width="100%" height="'.$height.'" src="showgantt.php?component=all&_showunworkedtasks=0&_showrecentonly=0&_itemsperpage=200&_scroll=1&_weekly=1&_scale=weeks&_significant=1"></iframe>';
}
?>
<body class="easyui-layout">
<div data-options="region:'north'" style="height:25px">
<img src="blue-gradient.jpg" alt="Mountain View" style="width:100%;height:20px;">
</div>
<?php
$last_update_date = date ("Y/m/d+H:i" , filemtime(UPDATEFILE));
echo '<div data-options="region:\'west\',collapsible:false, split:false,title:\'UI & Graphics Dashboard - Last Updated '. $last_update_date .' \'" style="width:60%;">';
?>
<?php GetEastPanelContent()?>
</div>
<div style="background-image: url('whiteback.jpg');" data-options="region:'center',title:''"><?php GetWestPanelContent()?></div>
<div data-options="region:'south',split:true" style="height:30px;" >
<div style="background-image: url('blue-gradient.jpg')">
<?php
$update_link = "<a title='Update' onclick='startAjax(); return false;' href='#update' style='color:white;'>Click to update</a>";
echo $update_link;
echo '<span style="float:right;color:white;">For Queries and bugs contact [email protected]</span>';
?>
</div>
</div>
</body>
</html>