Project

General

Profile

Download (3.39 KB) Statistics
| Branch: | Revision:

git_sitools_idoc / szcluster-db / workspace / client-user / js / components / datasetServices / viewDataDetailsService.js @ d16caf89

1
/*******************************************************************************
2
 * Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
3
 * 
4
 * This file is part of SITools2.
5
 * 
6
 * SITools2 is free software: you can redistribute it and/or modify it under the
7
 * terms of the GNU General Public License as published by the Free Software
8
 * Foundation, either version 3 of the License, or (at your option) any later
9
 * version.
10
 * 
11
 * SITools2 is distributed in the hope that it will be useful, but WITHOUT ANY
12
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
 * 
15
 * You should have received a copy of the GNU General Public License along with
16
 * SITools2. If not, see <http://www.gnu.org/licenses/>.
17
 ******************************************************************************/
18
/*global Ext, sitools, ID, i18n, document, showResponse, alertFailure, LOCALE, ImageChooser, loadUrl, extColModelToStorage, SitoolsDesk*/
19

    
20
Ext.namespace('sitools.user.component.dataviews.services');
21

    
22
/**
23
 * service used to show the details of a specific record
24
 * 
25
 * @required datasetId
26
 * @required datasetUrl
27
 * @cfg {Ext.data.JsonStore} the store where nodes are saved
28
 * @class sitools.user.component.dataviews.services.addSelectionService
29
 * @extends Ext.Window
30
 */
31
sitools.user.component.dataviews.services.viewDataDetailsService = {};
32

    
33
Ext.reg('sitools.user.component.dataviews.services.viewDataDetailsService', sitools.user.component.dataviews.services.viewDataDetailsService);
34

    
35
sitools.user.component.dataviews.services.viewDataDetailsService.getParameters = function () {
36
    return [];
37
};
38

    
39
sitools.user.component.dataviews.services.viewDataDetailsService.executeAsService = function (config) {
40
    
41
    var grid = config.dataview;
42
    var fromWhere = config.origin;
43
    var urlRecords = grid.urlRecords;
44
    var datasetId = grid.datasetId;
45
    var datasetUrl = grid.sitoolsAttachementForUsers;
46
    var datasetName = grid.datasetName;
47
    var selections = grid.getSelections();
48
    
49

    
50

    
51
    if (Ext.isEmpty(selections) || selections.length === 0) {
52
        return Ext.Msg.alert(i18n.get('label.warning'), i18n.get('warning.noselection'));
53
    }
54
    
55
    var componentCfg = {
56
        baseUrl : urlRecords + "/",
57
        grid : grid,
58
        fromWhere : fromWhere,
59
        datasetId : datasetId,
60
        datasetUrl : datasetUrl,
61
        selections : selections,
62
        preferencesPath : "/" + datasetName,
63
        preferencesFileName : "dataDetails"
64
    };
65
    var jsObj = sitools.user.component.viewDataDetail;
66

    
67
    var windowConfig = {
68
        id : "dataDetail" + datasetId,
69
        title : "Details", //i18n.get('label.viewDataDetail') + " : " + datasetName,
70
        datasetName : datasetName,
71
        saveToolbar : true,
72
        iconCls : "dataDetail",
73
        type : "dataDetail",
74
        shadow : true,
75
        shadowOffset : 5,
76
        toolbarItems : [ {
77
            iconCls : 'arrow-back',
78
            handler : function () {
79
                this.ownerCt.ownerCt.items.items[0].goPrevious();
80
            }
81
        }, {
82
            iconCls : 'arrow-next',
83
            handler : function () {
84
                this.ownerCt.ownerCt.items.items[0].goNext();
85
            }
86
        } ]
87
    };
88
    
89
    SitoolsDesk.addDesktopWindow(windowConfig, componentCfg, jsObj, true);
90
};