Project

General

Profile

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

git_sitools_idoc / flarecast / workspace / client-admin / js / quickstart / QsProject.js @ master

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
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * SITools2 is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with SITools2.  If not, see <http://www.gnu.org/licenses/>.
18
 ***************************************/
19
/*global Ext, sitools, ID, i18n, document, showResponse, alertFailure*/
20
Ext.namespace('sitools.admin.quickstart');
21

    
22
Ext.define('sitools.admin.quickstart.QsProject', {
23
    extend: 'Ext.panel.Panel',
24
    widget: 'widget.qsProject',
25

    
26
    forceLayout: true,
27
    layout: {
28
        type: "vbox",
29
        align: 'center',
30
        pack: 'start'
31
    },
32
    border: false,
33
    bodyCls: 'quickStart',
34

    
35
    initComponent: function () {
36

    
37
        var title = Ext.create('Ext.form.Label', {
38
            cls: 'qs-h1',
39
            html: i18n.get('label.qsProjectTitle')
40
        });
41

    
42
        var desc = Ext.create('Ext.form.Label', {
43
            cls: 'qs-div',
44
            id: "start-desc",
45
            html: i18n.get('label.qsProjectDesc')
46
        });
47

    
48
        var img = Ext.create('Ext.form.Label', {
49
            html: '<img id="qs-projet" class="qs-image" src="/sitools/client-admin/res/html/quickStart/screenshots/projects.png"/>',
50
            listeners: {
51
                scope: this,
52
                afterrender: function (img) {
53
                    Ext.get("qs-projet").on('load', function () {
54

    
55
                        img.getEl().alignTo("start-desc", "c-c");
56

    
57
                        var imgProjet = Ext.create('Ext.form.Label', {
58
                            html: '<img id="qs-projet-logo" class="bouton_action" src="/sitools/client-admin/res/html/quickStart/icons/project-logo.png"/>',
59
                            tooltip: new Ext.ToolTip({
60
                                html: "Open Project"
61
                            }),
62
                            listeners: {
63
                                scope: this,
64
                                afterrender: function (imgProjet) {
65
                                    Ext.get("qs-projet-logo").on('load', function () {
66

    
67
                                        imgProjet.getEl().on('mouseleave', function (e, t, o) {
68
                                            Ext.get(t).update("<img id='qs-projet-logo' class='bouton_action' src='/sitools/client-admin/res/html/quickStart/icons/project-logo.png'/>");
69
                                        });
70
                                        imgProjet.getEl().on('mouseenter', function (e, t, o) {
71
                                            Ext.get(t).update("<img id='qs-projet-logo' class='bouton_action' src='/sitools/client-admin/res/html/quickStart/icons/project-logo-hover.png'/>");
72
                                        });
73
                                        imgProjet.getEl().on('click', function (e, t, o) {
74
                                            this.qs.openFeature("projectsNodeId");
75
                                        }, this);
76

    
77
//                                        imgProjet.getEl().alignTo("qs-projet", "br-br", [50, 40]);
78
                                        imgProjet.getEl().alignTo("qs-projet", "br-br", [50, 40]);
79

    
80
                                        new Ext.ToolTip({
81
                                            target: 'qs-projet-logo',
82
                                            anchor: 'left',
83
                                            autoShow: true,
84
                                            showDelay: 0,
85
                                            html: "<b>Open Project</b>"
86
                                        });
87

    
88
                                    }, this);
89
                                }
90
                            }
91
                        });
92
                        this.add(imgProjet);
93

    
94
                    }, this);
95
                }
96
            }
97
        });
98

    
99
        this.items = [title, desc, img];
100
        this.callParent(arguments);
101
    }
102
});