Commit 27990ec8dfd1fb5945b1bc0c7f47b5f7b990ef55
Committed by
Benjamin Renard
1 parent
b954fc79
Exists in
master
and in
23 other branches
DONE
Showing
4 changed files
with
147 additions
and
2 deletions
Show diff stats
... | ... | @@ -0,0 +1,14 @@ |
1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
2 | +<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | +<head> | |
4 | + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
5 | + <title>AMDA Statistics</title> | |
6 | + <link rel="stylesheet" type="text/css" href="js/lib/ext/resources/css/ext-all.css"/> | |
7 | + <link rel="stylesheet" type="text/css" href="js/resources/css/amda.css"/> | |
8 | + <script type="text/javascript" src="js/lib/ext/ext-all.js"></script> | |
9 | + <script type="text/javascript" src="js/app/catalogTTList.js"></script> | |
10 | +</head> | |
11 | + | |
12 | +<body background="js/resources/images/desktop/wallpapers/Cdpp2.jpg"/> | |
13 | +</body> | |
14 | +</html> | |
... | ... |
help/info.html
... | ... | @@ -48,8 +48,7 @@ |
48 | 48 | </ul> |
49 | 49 | <li><h4>Access to Shared Time Tables and Catalogs</h4> |
50 | 50 | <ul> |
51 | - <li><a title="TBD" target="_blank">Time Tables</a> | |
52 | - <li><a title="TBD" target="_blank">Catalogs</a> | |
51 | + <li><a href="../catalogTTList.html" target="_blank">Time Tables & Catalogs</a> | |
53 | 52 | </ul> |
54 | 53 | </ul> |
55 | 54 | </div> |
... | ... |
... | ... | @@ -0,0 +1,95 @@ |
1 | + | |
2 | +function columnWrap(val){ | |
3 | + return '<div style="white-space:normal !important;">'+val+'</div>'; | |
4 | +} | |
5 | + | |
6 | +Ext.onReady(function () { | |
7 | + Ext.define('CatalogTTModel', { | |
8 | + extend: 'Ext.data.Model', | |
9 | + fields: [ | |
10 | + 'id', 'name', 'type','created','description', | |
11 | + 'nbIntervals','surveyStart','surveyStop','sharedDate' | |
12 | + ] | |
13 | + }); | |
14 | + //The Store contains the AjaxProxy as an inline configuration | |
15 | + var store = Ext.create('Ext.data.Store', { | |
16 | + autoLoad:true, | |
17 | + model: 'CatalogTTModel', | |
18 | + groupField: 'type', | |
19 | + proxy: { | |
20 | + type: 'ajax', | |
21 | + url : 'php/catalogTTList.php' | |
22 | + } | |
23 | + }); | |
24 | + | |
25 | + var grid = Ext.create('Ext.grid.Panel', { | |
26 | + xtype:'grouped-grid', | |
27 | + requires: [ | |
28 | + 'Ext.grid.feature.Grouping' | |
29 | + ], | |
30 | + minHeight: 200, | |
31 | + store: store, | |
32 | + features: [{ | |
33 | + ftype: 'grouping', | |
34 | + groupHeaderTpl: '{columnName}: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})', | |
35 | + hideGroupedHeader: true, | |
36 | + startCollapsed: false, | |
37 | + id: 'typeGrouping' | |
38 | + }], | |
39 | + columns: [ | |
40 | + { text: 'Id', width:100, dataIndex: 'id' }, | |
41 | + { text: 'Name', width:100, dataIndex: 'name' }, | |
42 | + { text: 'Creation Date', width:135, dataIndex: 'created' }, | |
43 | + { text: 'Description', flex:1, dataIndex: 'description', renderer:columnWrap }, | |
44 | + { text: '#', width:50, dataIndex: 'nbIntervals',tooltip: 'Number of line',align:'center' }, | |
45 | + { text: 'Survey Start', width:135, dataIndex: 'surveyStart' }, | |
46 | + { text: 'Survey Stop', width:135, dataIndex: 'surveyStop' }, | |
47 | + { text: 'Shared Date', width:135, dataIndex: 'sharedDate' }, | |
48 | + { text: 'Type', dataIndex: 'type' }, | |
49 | + { | |
50 | + width: 30, menuDisabled: true, xtype: 'actioncolumn', tooltip: 'Download the shared TT/Cat', align: 'center', | |
51 | + icon: 'js/resources/images/16x16/download_manager.png', | |
52 | + handler: function(grid, rowIndex, colIndex, actionItem, event, record, row) { | |
53 | + var url=""; | |
54 | + if(record.data.type==="catalog") | |
55 | + url = 'php/rest/getCatalog.php?catID='+record.data.id+'&outputFormat=ASCII'; | |
56 | + if(record.data.type==="timeTable") | |
57 | + url = 'php/rest/getTimeTable.php?ttID='+record.data.id+'&outputFormat=ASCII'; | |
58 | + if(url.length !== 0){ | |
59 | + Ext.Ajax.request({ | |
60 | + url: url, | |
61 | + method: 'GET', // set the HTTP method to GET | |
62 | + success: function(response) { | |
63 | + window.open(response.responseText, '_blank'); | |
64 | + }, | |
65 | + failure: function(response) { | |
66 | + alert('Request failed:', response.statusText); | |
67 | + } | |
68 | + }); | |
69 | + } | |
70 | + else{ | |
71 | + alert('This data is not a TT/Cat.') | |
72 | + } | |
73 | + | |
74 | + | |
75 | + | |
76 | + } | |
77 | + } | |
78 | + ] | |
79 | + }); | |
80 | + | |
81 | + var win = Ext.create('Ext.window.Window', { | |
82 | + width: 1000, | |
83 | + height: 500, | |
84 | + closable:false, | |
85 | + autoScroll : true, | |
86 | + maximizable: true, | |
87 | + title: 'List of shared catalogs and time tables', | |
88 | + layout:'fit', | |
89 | + items: [ | |
90 | + grid | |
91 | + ] | |
92 | + }).show(); | |
93 | + | |
94 | + | |
95 | +}); | |
0 | 96 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php | |
2 | + | |
3 | +require_once 'config.php'; | |
4 | + | |
5 | +function catalogTTList(){ | |
6 | + | |
7 | + $urls = [ | |
8 | + "catalog" => file_get_contents(webAlias.'/php/rest/getCatalogsList.php'), | |
9 | + "timeTable" => file_get_contents(webAlias.'/php/rest/getTimeTablesList.php') | |
10 | + ]; | |
11 | + | |
12 | + $parameters = []; | |
13 | + foreach ($urls as $key => $url){ | |
14 | + $xml = simplexml_load_string(file_get_contents($url)); | |
15 | + if (empty($xml)) | |
16 | + continue; | |
17 | + foreach($xml->xpath('//'.$key) as $parameter) { | |
18 | + $attributes = $parameter->attributes(); | |
19 | + $parameters[] = [ | |
20 | + "type" => $key, | |
21 | + "name" => (string) $attributes->name, | |
22 | + "id" => (string) $attributes->id, | |
23 | + "created" => (string) $attributes->created, | |
24 | + "description" => (string) $attributes->description, | |
25 | + "nbIntervals" => (string) $attributes->nbIntervals, | |
26 | + "surveyStart" => (string) $attributes->surveyStart, | |
27 | + "surveyStop" => (string) $attributes->surveyStop, | |
28 | + "sharedDate" => (string) $attributes->sharedDate | |
29 | + ]; | |
30 | + } | |
31 | + } | |
32 | + | |
33 | + return json_encode($parameters); | |
34 | +} | |
35 | + | |
36 | +echo catalogTTList(); | |
37 | +?> | |
0 | 38 | \ No newline at end of file |
... | ... |