Blame view

desktop.php 9.81 KB
16035364   Benjamin Renard   First commit
1
<?php
1be6ea03   Erdogan Furkan   #10098 - Final co...
2
3

/**
16035364   Benjamin Renard   First commit
4
 * @file index.php
aa94fd24   elena   Merge with last svn
5
 * @version $Id: desktop.php 2934 2015-06-03 13:23:22Z elena $
16035364   Benjamin Renard   First commit
6
7
 *
 */
1be6ea03   Erdogan Furkan   #10098 - Final co...
8
9
10
11
12

require_once('php/config.php');

// error_reporting(E_ALL);
if (!isset($_POST['username'])) {
1f3ee1cd   Benjamin Renard   Improve login pag...
13
14
    header('Location: index.html');
    exit(1);
1be6ea03   Erdogan Furkan   #10098 - Final co...
15
}
1f3ee1cd   Benjamin Renard   Improve login pag...
16

1be6ea03   Erdogan Furkan   #10098 - Final co...
17
18
19
20
21
if (!isset($_POST['username'])) die('<a href="index.html">LOGIN SVP</a>');
$usrMgr = new UserMgr();

$sessionID = $usrMgr->init();
if ($sessionID === FALSE) {
1f3ee1cd   Benjamin Renard   Improve login pag...
22
23
    header('Location: index.html?error=1');
    exit(1);
1be6ea03   Erdogan Furkan   #10098 - Final co...
24
}
16035364   Benjamin Renard   First commit
25
26
27
28
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
1be6ea03   Erdogan Furkan   #10098 - Final co...
29

16035364   Benjamin Renard   First commit
30
31
32
33
34
35
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="PRAGMA" content="NO-CACHE">
    <meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
    <meta http-equiv="EXPIRES" content="-1">

1be6ea03   Erdogan Furkan   #10098 - Final co...
36
37
38
39
40
    <title><?php if (defined('TITLE')) {
                echo TITLE;
            } else {
                echo 'AMDANEW';
            } ?></title>
fdc5eae5   Elena.Budnik   Anomalie #6355
41
42
    <!-- Important ! the order of css loading : ext-all.css - should be the first -->
    <link rel="stylesheet" type="text/css" href="js/lib/ext/resources/css/ext-all.css" />
16035364   Benjamin Renard   First commit
43
44
    <link rel="stylesheet" type="text/css" href="js/resources/css/desktop.css" />
    <link rel="stylesheet" type="text/css" href="js/resources/css/amda.css" />
1be6ea03   Erdogan Furkan   #10098 - Final co...
45

e995f4ad   Erdogan Furkan   Added codeTextAre...
46
47
48
49
    <link rel="stylesheet" href="js/lib/codemirror/codemirror-5.65.12/lib/codemirror.css">
    <link rel="stylesheet" href="js/lib/codemirror/codemirror-5.65.12/addon/lint/lint.css">
    <link rel="stylesheet" href="js/lib/codemirror/codemirror-5.65.12/addon/hint/show-hint.css">

16035364   Benjamin Renard   First commit
50
    <link rel="icon" href="favicon.ico" type="image/x-icon">
1be6ea03   Erdogan Furkan   #10098 - Final co...
51
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
16035364   Benjamin Renard   First commit
52

1be6ea03   Erdogan Furkan   #10098 - Final co...
53
54
55
    <!--  <script type="text/javascript" src="js/lib/ext/builds/ext-core.js"></script> -->
    <!--  <script type="text/javascript" src="js/lib/ext/bootstrap.js"></script> -->
    <!--  <script type="text/javascript" src="js/lib/ext/ext-all-debug-w-comments.js"></script> -->
fdc5eae5   Elena.Budnik   Anomalie #6355
56
    <script type="text/javascript" src="js/lib/ext/ext-all.js"></script>
1be6ea03   Erdogan Furkan   #10098 - Final co...
57
    <!--	<script type="text/javascript" src="js/lib/ext/ext-all-dev.js"></script> -->
8cc08c31   Benjamin Renard   Fix columns resiz...
58
    <script type="text/javascript" src="js/lib/ext-override.js"></script>
16035364   Benjamin Renard   First commit
59

3ccb373f   furkan   #6899 - Done
60
61
62
    <!--  Plotly module-->
    <script src="js/lib/plotly/plotly-2.14.0.min.js"></script>

e995f4ad   Erdogan Furkan   Added codeTextAre...
63
64
65
66
67
68
69
    <!--  CodeMirror module-->
    <script src="js/lib/codemirror/codemirror-5.65.12/lib/codemirror.js"></script>
    <script src="js/lib/codemirror/codemirror-5.65.12/addon/mode/simple.js"></script>
    <script src="js/lib/codemirror/codemirror-5.65.12/addon/edit/closebrackets.js"></script>
    <script src="js/lib/codemirror/codemirror-5.65.12/addon/lint/lint.js"></script>
    <script src="js/lib/codemirror/codemirror-5.65.12/addon/selection/active-line.js"></script>

1be6ea03   Erdogan Furkan   #10098 - Final co...
70
71
72
73
    <!-- Direct API -->
    <script type="text/javascript" src="php/api.php"></script>

    <!--  <script src="help/movies/Resources/scripts/prototype.js" language="JavaScript" type="text/javascript"></script>
98a79839   Elena.Budnik   anomalie 4830
74
75
      <script src="help/movies/Resources/scripts/qtp_poster.js" language="JavaScript" type="text/javascript"></script>          
      <link href="help/movies/Resources/stylesheets/qtp_poster.css" rel="StyleSheet" type="text/css" /> --->
16035364   Benjamin Renard   First commit
76
77
78


    <script type="text/javascript">
1be6ea03   Erdogan Furkan   #10098 - Final co...
79
80
81
82
83
        //Enable dynamic loading for improved debugging support
        Ext.Loader.setConfig({
            enabled: true
        });

16035364   Benjamin Renard   First commit
84
        Ext.Loader.setPath({
1be6ea03   Erdogan Furkan   #10098 - Final co...
85
86
87
88
89
90
91
92
93
94
95
96
97
98
            'Ext': 'js/lib/ext/src',
            'Ext.ux.desktop': 'js/lib/ux/desktop',
            'Ext.ux': 'js/lib/ext/examples/ux',
            'MyDesktop': 'js/lib/ux/desktop/exampleModules',
            'extensions': 'js/lib/ux',
            'Ext.ux.amdaGrid': 'js/lib/ux/grid',
            'samp': 'js/lib/SAMP',
            'amdaDesktop': 'js/app/controllers',
            'amdaUI': 'js/app/views',
            'amdaPlotComp': 'js/app/views/PlotComponents',
            'amdaModel': 'js/app/models',
            'amdaPlotObj': 'js/app/models/PlotObjects',
            'amdaReader': 'js/app/stores',
            'amdaApp': 'js/app'
16035364   Benjamin Renard   First commit
99
100
101
102
103
104
105
106
107
        });

        Ext.require('amdaDesktop.AmdaStateProvider');
        Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);

        Ext.require('amdaDesktop.JobsMgr');
        Ext.require('amdaApp.AmdaApp');

        var myDesktopApp;
1be6ea03   Erdogan Furkan   #10098 - Final co...
108

74c32080   Elena.Budnik   isMigration false
109
        var isMigration = false;
16035364   Benjamin Renard   First commit
110
        var sessionID = '<?php echo $sessionID; ?>';
1be6ea03   Erdogan Furkan   #10098 - Final co...
111
        var isFirstVisit = '<?php echo $usrMgr->isFirst; ?>';
74c32080   Elena.Budnik   isMigration false
112
        var isOldWS = false; // '<#?php echo $usrMgr->isOldWS; ?>';
1be6ea03   Erdogan Furkan   #10098 - Final co...
113
114
        var isSpecialInfo = '<?php echo $usrMgr->isSpecialInfo; ?>';
        var isNewInfo = '<?php echo $usrMgr->isNewInfo; ?>';
aa94fd24   elena   Merge with last svn
115
116
        var news = '../data/' + sessionID + '/INFO';

1be6ea03   Erdogan Furkan   #10098 - Final co...
117
118
119
        var AMDAVERSION = '<?php if (defined('AMDA_VERSION')) echo AMDA_VERSION; ?>';

        var wsSize = '<?php echo $usrMgr->getWsSize(); ?>';
16035364   Benjamin Renard   First commit
120
121
122
123
124
        var diskQuota = '<?php echo DISK_QUOTA; ?>';

        var freeSpace = diskQuota - wsSize;

        var helpDir = 'help/';
16035364   Benjamin Renard   First commit
125
        var isGuest = sessionID.match('guest');
4f728fd9   Erdogan Furkan   For now 2
126
127
128
        var amdaDefaultValues = null;
        var amdaDefaultConfigs = null;
        var amdaDefaultOptions = null;
8e40a14d   Elena.Budnik   new vars in desktop
129

7baca0ef   Elena.Budnik   user special sett...
130
        var max_uploaded_file_size = '<?php echo MAX_UPLOADED_FILESIZE; ?>';
1be6ea03   Erdogan Furkan   #10098 - Final co...
131
132
133
134
135
        var guestSessionDuration = '<?php echo GuestSessionDuration * 60; ?>'; // in secs
        var maxGuestTimeInterval = '<?php echo MaxGuestTimeInterval; ?>'; // in days

        var gatewayTimeout = '<?php if (defined('GATEWAY_TIMEOUT')) echo GATEWAY_TIMEOUT;
                                else echo 300000; ?>'; // in msec
2cfa3a1a   Benjamin Renard   Give the possibil...
136

65448ffe   Benjamin Renard   Minor fix
137
        var logExecTime = <?php echo (defined('LOG_EXEC_TIME') && (LOG_EXEC_TIME === TRUE) ? 'true' : 'false'); ?>;
16035364   Benjamin Renard   First commit
138
139
        //create mask class (LoadMask for elements has been deprecated, use Ext.dom.Element.mask & Ext.dom.Element.unmask)
        var AMDAMask = new Ext.Class({
1be6ea03   Erdogan Furkan   #10098 - Final co...
140
141
142
            show: function(interactivePlot) {
                var msg = 'Processing...Please wait';
                if (interactivePlot)
16035364   Benjamin Renard   First commit
143
144
                    msg += ' <br/> <p align="center"><input id="killopBtn" type="button" value="Kill process" /></p>';

be6060f0   Benjamin Renard   Fix z-index defin...
145
                var mask = Ext.getBody().mask(msg, 'amda-mask');
16035364   Benjamin Renard   First commit
146

1be6ea03   Erdogan Furkan   #10098 - Final co...
147
                if (interactivePlot) {
8e40a14d   Elena.Budnik   new vars in desktop
148
                    var killBtn = Ext.get('killopBtn');
1be6ea03   Erdogan Furkan   #10098 - Final co...
149
150
151
152
153
154
155
156
157
158
159
160
161
                    killBtn.on('click', function(e, t) {
                            AmdaAction.killPlotRequest(function(result, e) {
                                var t = e.getTransaction();
                                if (e.status) {
                                    if (!result)
                                        myDesktopApp.errorMsg('Cannot kill process');
                                } else
                                    myDesktopApp.errorMsg(e.message);

                            }, this);

                        },
                        this);
16035364   Benjamin Renard   First commit
162
163
164

                }
            },
1be6ea03   Erdogan Furkan   #10098 - Final co...
165
            hide: function() {
16035364   Benjamin Renard   First commit
166
167
168
                Ext.getBody().unmask();
                this.tid = null;
            },
1be6ea03   Erdogan Furkan   #10098 - Final co...
169
            isMasked: function() {
16035364   Benjamin Renard   First commit
170
171
172
                return Ext.getBody().isMasked();
            }
        });
1be6ea03   Erdogan Furkan   #10098 - Final co...
173

16035364   Benjamin Renard   First commit
174
175
        var loadMask;

1be6ea03   Erdogan Furkan   #10098 - Final co...
176
        Ext.onReady(function() {
16035364   Benjamin Renard   First commit
177
            //TODO update jobsStatus onLogin             
1be6ea03   Erdogan Furkan   #10098 - Final co...
178
179
180
            Ext.Ajax.extraParams = {
                sessionID: sessionID
            };
f2b3e0e8   Elena.Budnik   ajax timeout = ga...
181
182
            Ext.Ajax.timeout = gatewayTimeout; // msec ; should be the same value (or less) as gateway timeout

1be6ea03   Erdogan Furkan   #10098 - Final co...
183
            Ext.Ajax.on('requestexception', function(conn, response, options, e) {
f2b3e0e8   Elena.Budnik   ajax timeout = ga...
184

16035364   Benjamin Renard   First commit
185
186
                if (loadMask && loadMask.isMasked())
                    loadMask.hide();
1be6ea03   Erdogan Furkan   #10098 - Final co...
187

f2b3e0e8   Elena.Budnik   ajax timeout = ga...
188
                if (response && response.statusText) {
1be6ea03   Erdogan Furkan   #10098 - Final co...
189
190
191
                    if (response.timedout)
                        alert('Request processing time exceeds gateway timeout\n In case of parameter from Remote Bases : please re-launch the same request in 10 min,\n otherwise select "non-screen" FileOutput or contact AMDA team');
                    else
74c32080   Elena.Budnik   isMigration false
192
                        alert(response.statusText);
1be6ea03   Erdogan Furkan   #10098 - Final co...
193
                } else
74c32080   Elena.Budnik   isMigration false
194
                    alert('Communication failure');
1be6ea03   Erdogan Furkan   #10098 - Final co...
195
196
            });

16035364   Benjamin Renard   First commit
197
198
199
            // backspace key disable           
            Ext.EventManager.on(window, 'keydown', function(e, t) {
                if (e.getKey() == e.BACKSPACE && ((!/^input$/i.test(t.tagName) && !/^textarea$/i.test(t.tagName)) || t.disabled || t.readOnly)) {
1be6ea03   Erdogan Furkan   #10098 - Final co...
200
                    e.stopEvent();
16035364   Benjamin Renard   First commit
201
202
203
204
                }
            });

            var stateProvider = Ext.create('amdaDesktop.AmdaStateProvider');
16035364   Benjamin Renard   First commit
205
206
            stateProvider.on({
                scope: this,
1be6ea03   Erdogan Furkan   #10098 - Final co...
207
                afterrestore: function(provider) {
4f728fd9   Erdogan Furkan   For now 2
208
                    AmdaAction.getDefaultValueTree(false, function(defaults){
b1dc2eb3   Erdogan Furkan   More modifications
209
210
                        if(defaults['success'])
                            amdaDefaultValues=defaults['defaultValues'];
4f728fd9   Erdogan Furkan   For now 2
211
                        AmdaAction.getDefaultValueConfigs(function(configs){
b1dc2eb3   Erdogan Furkan   More modifications
212
213
                            if(configs["success"])
                                amdaDefaultConfigs = configs["configs"];
4f728fd9   Erdogan Furkan   For now 2
214
215

                            AmdaAction.getDefaultValueLinks(function(links){
b1dc2eb3   Erdogan Furkan   More modifications
216
217
                                if(links["success"])
                                    amdaDefaultOptions = links['links'];
4f728fd9   Erdogan Furkan   For now 2
218
                                
4f728fd9   Erdogan Furkan   For now 2
219
220
221
222
223
224
225
226
227
228
229
230
231
                                amdaDesktop.JobsMgr.getStatus();
                                Ext.state.Manager.setProvider(provider);
                                myDesktopApp = new amdaApp.AmdaApp();
                                // global message bus
                                myDesktopApp.EventManager = new Ext.util.Observable();
                                // not needed - for documentation only
                                myDesktopApp.EventManager.addEvents('refresh');
                                loadMask = new AMDAMask();
                            }) ;
                        });
                    }) ;

                    
16035364   Benjamin Renard   First commit
232
233
234
235
236
237
238
                }
            });

            stateProvider.restoreState();
        });
    </script>
</head>
aa94fd24   elena   Merge with last svn
239

1be6ea03   Erdogan Furkan   #10098 - Final co...
240
241
242
<body />

</html>