Blame view

js/app/catalogTTList.js 5.43 KB
27990ec8   Erdogan Furkan   DONE
1
2
3
4
5

function columnWrap(val){
    return '<div style="white-space:normal !important;">'+val+'</div>';
}

6d4a5fa1   Erdogan Furkan   Some modifications
6
7
8
9
10
11
function dlLink(format, record){
    return 'php/getSharedObject.php?type='+record.get('type')
            +'&id='+record.get('id')+'&format='+format
            +'&nameToGive='+record.get('name');
}

27990ec8   Erdogan Furkan   DONE
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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'
        }
    });
6d4a5fa1   Erdogan Furkan   Some modifications
30
    var presentationPanel  = Ext.create('Ext.panel.Panel', {
e1b680c2   Benjamin Renard   Start collapsed i...
31
32
        height: 80,
        region: 'north',
6d4a5fa1   Erdogan Furkan   Some modifications
33
34
35
36
37
38
39
40
41
        layout:'hbox',
        bodyStyle: { background : '#dfe8f6'},
        items:[
            {
                xtype:'image',
                src: 'js/resources/images/Amda_coul_sur_blanc.svg',
                height:80,
                width:120,
                margin: '0 10 0 10',
6d4a5fa1   Erdogan Furkan   Some modifications
42
43
44
45
46
47
48
49
50
                
            },
            {
                xtype:'panel',
                border:false,
                autoScroll : true,
                padding:5,
                bodyStyle: { background : '#dfe8f6'},
                flex:1,
d6106d7d   Erdogan Furkan   Last modifications
51
                height:80,
6d4a5fa1   Erdogan Furkan   Some modifications
52
                html: '<p>This page presents catalogs and time tables available in the on-line analysis tool \
d6106d7d   Erdogan Furkan   Last modifications
53
                        <a href="http://amda.cdpp.eu" target="_blank">AMDA</a> \
6d4a5fa1   Erdogan Furkan   Some modifications
54
55
56
57
58
                        (see the "Shared" folders). These items come from published articles or \
                        community/project websites and can be downloaded in several formats \
                        (<a href="https://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html" target="_blank">VOTable</a>, \
                        <a href="https://spase-group.org/docs/conventions/HDMC-Event-List-Specification-v1.0.4.pdf" target="_blank">HPEvents</a> \
                        or ASCII compliant with AMDA). They can be uploaded in other analysis \
d6106d7d   Erdogan Furkan   Last modifications
59
60
                        tools like <a href="http://3dview.cdpp.eu/" target="_blank">3DView</a>, \
                        <a href="https://github.com/SciQLop/SciQLop" target="_blank">SciQLop</a>, ...</p>',
6d4a5fa1   Erdogan Furkan   Some modifications
61
62
63
64
            }
        ]
        
    });
27990ec8   Erdogan Furkan   DONE
65
66
    var grid = Ext.create('Ext.grid.Panel', {
        xtype:'grouped-grid',
e1b680c2   Benjamin Renard   Start collapsed i...
67
        region: 'center',
27990ec8   Erdogan Furkan   DONE
68
69
70
        requires: [
            'Ext.grid.feature.Grouping'
        ],
27990ec8   Erdogan Furkan   DONE
71
72
73
74
75
        store: store,
        features: [{
            ftype: 'grouping',
            groupHeaderTpl: '{columnName}: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})',
            hideGroupedHeader: true,
e1b680c2   Benjamin Renard   Start collapsed i...
76
            startCollapsed: true,
27990ec8   Erdogan Furkan   DONE
77
78
79
            id: 'typeGrouping'
        }],
        columns: [
6d4a5fa1   Erdogan Furkan   Some modifications
80
            //{ text: 'Id', width:100, dataIndex: 'id' },
27990ec8   Erdogan Furkan   DONE
81
            { text: 'Name',  width:100, dataIndex: 'name' },
27990ec8   Erdogan Furkan   DONE
82
83
            { text: 'Description',  flex:1, dataIndex: 'description', renderer:columnWrap },
            { text: '#', width:50, dataIndex: 'nbIntervals',tooltip: 'Number of line',align:'center' },
6d4a5fa1   Erdogan Furkan   Some modifications
84
85
86
87
            { text: 'Survey start',  width:135, dataIndex: 'surveyStart' },
            { text: 'Survey stop',  width:135, dataIndex: 'surveyStop' },
            { text: 'Creation date',  width:135, dataIndex: 'created' },
            { text: 'Sharing date',  width:135, dataIndex: 'sharedDate' },
27990ec8   Erdogan Furkan   DONE
88
89
            { text: 'Type', dataIndex: 'type' },
            {
6d4a5fa1   Erdogan Furkan   Some modifications
90
91
92
93
94
95
96
97
98
99
                width: 40, menuDisabled: true, xtype: 'actioncolumn', tooltip: 'Download the shared TT/Cat', align: 'center',
                renderer: function(value, metaData, record, rowIndex, colIndex, store) {
                    var buttonId = Ext.id();
                    Ext.defer(function() {
                        var button = Ext.create('Ext.button.Button', {
                            icon: 'js/resources/images/16x16/download_manager.png',
                            renderTo: buttonId,
                            menu: [
                                {
                                    text: 'ASCII',
d6106d7d   Erdogan Furkan   Last modifications
100
                                    handler: function() { window.open( dlLink('ASCII', record), '_blank');}
6d4a5fa1   Erdogan Furkan   Some modifications
101
102
103
                                },
                                {
                                    text: 'VOTable',
d6106d7d   Erdogan Furkan   Last modifications
104
                                    handler: function() { window.open( dlLink('VOTable', record), '_blank');}
6d4a5fa1   Erdogan Furkan   Some modifications
105
106
107
                                },
                                {
                                    text: 'HPEvent',
d6106d7d   Erdogan Furkan   Last modifications
108
                                    handler: function() {window.open( dlLink('HPEvent', record), '_blank');}
6d4a5fa1   Erdogan Furkan   Some modifications
109
110
                                },
                            ]
27990ec8   Erdogan Furkan   DONE
111
                        });
6d4a5fa1   Erdogan Furkan   Some modifications
112
113
                    }, 10);
                    return '<div style="height:1px;margin-top:-2px;" id="' + buttonId + '"></div>';
27990ec8   Erdogan Furkan   DONE
114
115
116
117
118
119
                }
            }
        ]
    });              

    var win = Ext.create('Ext.window.Window', {
6d4a5fa1   Erdogan Furkan   Some modifications
120
121
122
        width: 1100,
        height: 675,
        title: 'List of shared catalogs and time tables',
27990ec8   Erdogan Furkan   DONE
123
124
125
        closable:false,
        autoScroll : true,
        maximizable: true,
e1b680c2   Benjamin Renard   Start collapsed i...
126
        layout: 'border',
27990ec8   Erdogan Furkan   DONE
127
        items: [
6d4a5fa1   Erdogan Furkan   Some modifications
128
            presentationPanel,
27990ec8   Erdogan Furkan   DONE
129
130
131
132
133
134
            grid
                ]
    }).show();
    
    
});