diff --git a/catalogTTList.html b/catalogTTList.html new file mode 100644 index 0000000..c1f164c --- /dev/null +++ b/catalogTTList.html @@ -0,0 +1,14 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>AMDA Statistics</title> + <link rel="stylesheet" type="text/css" href="js/lib/ext/resources/css/ext-all.css"/> + <link rel="stylesheet" type="text/css" href="js/resources/css/amda.css"/> + <script type="text/javascript" src="js/lib/ext/ext-all.js"></script> + <script type="text/javascript" src="js/app/catalogTTList.js"></script> +</head> + +<body background="js/resources/images/desktop/wallpapers/Cdpp2.jpg"/> +</body> +</html> diff --git a/help/info.html b/help/info.html index b6d7d88..98ba7d7 100644 --- a/help/info.html +++ b/help/info.html @@ -48,8 +48,7 @@ </ul> <li><h4>Access to Shared Time Tables and Catalogs</h4> <ul> - <li><a title="TBD" target="_blank">Time Tables</a> - <li><a title="TBD" target="_blank">Catalogs</a> + <li><a href="../catalogTTList.html" target="_blank">Time Tables & Catalogs</a> </ul> </ul> </div> diff --git a/js/app/catalogTTList.js b/js/app/catalogTTList.js new file mode 100644 index 0000000..4a517d0 --- /dev/null +++ b/js/app/catalogTTList.js @@ -0,0 +1,95 @@ + +function columnWrap(val){ + return '<div style="white-space:normal !important;">'+val+'</div>'; +} + +Ext.onReady(function () { + Ext.define('CatalogTTModel', { + extend: 'Ext.data.Model', + fields: [ + 'id', 'name', 'type','created','description', + 'nbIntervals','surveyStart','surveyStop','sharedDate' + ] + }); + //The Store contains the AjaxProxy as an inline configuration + var store = Ext.create('Ext.data.Store', { + autoLoad:true, + model: 'CatalogTTModel', + groupField: 'type', + proxy: { + type: 'ajax', + url : 'php/catalogTTList.php' + } + }); + + var grid = Ext.create('Ext.grid.Panel', { + xtype:'grouped-grid', + requires: [ + 'Ext.grid.feature.Grouping' + ], + minHeight: 200, + store: store, + features: [{ + ftype: 'grouping', + groupHeaderTpl: '{columnName}: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})', + hideGroupedHeader: true, + startCollapsed: false, + id: 'typeGrouping' + }], + columns: [ + { text: 'Id', width:100, dataIndex: 'id' }, + { text: 'Name', width:100, dataIndex: 'name' }, + { text: 'Creation Date', width:135, dataIndex: 'created' }, + { text: 'Description', flex:1, dataIndex: 'description', renderer:columnWrap }, + { text: '#', width:50, dataIndex: 'nbIntervals',tooltip: 'Number of line',align:'center' }, + { text: 'Survey Start', width:135, dataIndex: 'surveyStart' }, + { text: 'Survey Stop', width:135, dataIndex: 'surveyStop' }, + { text: 'Shared Date', width:135, dataIndex: 'sharedDate' }, + { text: 'Type', dataIndex: 'type' }, + { + width: 30, menuDisabled: true, xtype: 'actioncolumn', tooltip: 'Download the shared TT/Cat', align: 'center', + icon: 'js/resources/images/16x16/download_manager.png', + handler: function(grid, rowIndex, colIndex, actionItem, event, record, row) { + var url=""; + if(record.data.type==="catalog") + url = 'php/rest/getCatalog.php?catID='+record.data.id+'&outputFormat=ASCII'; + if(record.data.type==="timeTable") + url = 'php/rest/getTimeTable.php?ttID='+record.data.id+'&outputFormat=ASCII'; + if(url.length !== 0){ + Ext.Ajax.request({ + url: url, + method: 'GET', // set the HTTP method to GET + success: function(response) { + window.open(response.responseText, '_blank'); + }, + failure: function(response) { + alert('Request failed:', response.statusText); + } + }); + } + else{ + alert('This data is not a TT/Cat.') + } + + + + } + } + ] + }); + + var win = Ext.create('Ext.window.Window', { + width: 1000, + height: 500, + closable:false, + autoScroll : true, + maximizable: true, + title: 'List of shared catalogs and time tables', + layout:'fit', + items: [ + grid + ] + }).show(); + + +}); \ No newline at end of file diff --git a/php/catalogTTList.php b/php/catalogTTList.php new file mode 100644 index 0000000..1665b5b --- /dev/null +++ b/php/catalogTTList.php @@ -0,0 +1,37 @@ +<?php + +require_once 'config.php'; + +function catalogTTList(){ + + $urls = [ + "catalog" => file_get_contents(webAlias.'/php/rest/getCatalogsList.php'), + "timeTable" => file_get_contents(webAlias.'/php/rest/getTimeTablesList.php') + ]; + + $parameters = []; + foreach ($urls as $key => $url){ + $xml = simplexml_load_string(file_get_contents($url)); + if (empty($xml)) + continue; + foreach($xml->xpath('//'.$key) as $parameter) { + $attributes = $parameter->attributes(); + $parameters[] = [ + "type" => $key, + "name" => (string) $attributes->name, + "id" => (string) $attributes->id, + "created" => (string) $attributes->created, + "description" => (string) $attributes->description, + "nbIntervals" => (string) $attributes->nbIntervals, + "surveyStart" => (string) $attributes->surveyStart, + "surveyStop" => (string) $attributes->surveyStop, + "sharedDate" => (string) $attributes->sharedDate + ]; + } + } + + return json_encode($parameters); +} + +echo catalogTTList(); +?> \ No newline at end of file -- libgit2 0.21.2