Blame view

desktop.php 8.28 KB
16035364   Benjamin Renard   First commit
1
2
3
<?php
 /**
 * @file index.php
aa94fd24   elena   Merge with last svn
4
 * @version $Id: desktop.php 2934 2015-06-03 13:23:22Z elena $
16035364   Benjamin Renard   First commit
5
6
 *
 */
8d3a3d4b   Elena.Budnik   intercavive mod =...
7
   
16035364   Benjamin Renard   First commit
8
  require_once('php/config.php');
8d3a3d4b   Elena.Budnik   intercavive mod =...
9
  
16035364   Benjamin Renard   First commit
10
  // error_reporting(E_ALL);
1f3ee1cd   Benjamin Renard   Improve login pag...
11
12
13
14
15
  if (!isset($_POST['username'])) {
    header('Location: index.html');
    exit(1);
  }

16035364   Benjamin Renard   First commit
16
  if (!isset($_POST['username'])) die('<a href="index.html">LOGIN SVP</a>');
16035364   Benjamin Renard   First commit
17
  $usrMgr = new UserMgr();
8d3a3d4b   Elena.Budnik   intercavive mod =...
18
   
16035364   Benjamin Renard   First commit
19
  $sessionID = $usrMgr->init();
1f3ee1cd   Benjamin Renard   Improve login pag...
20
21
22
23
  if ($sessionID === FALSE) {
    header('Location: index.html?error=1');
    exit(1);
  }
16035364   Benjamin Renard   First commit
24
25
26
27
28
29
30
31
32
33
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<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">

68ac27e0   Elena.Budnik   Redmine #5227
34
    <title><?php if (defined('TITLE')) { echo TITLE; } else { echo 'AMDANEW'; } ?></title>
fdc5eae5   Elena.Budnik   Anomalie #6355
35
36
    <!-- 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
37
38
    <link rel="stylesheet" type="text/css" href="js/resources/css/desktop.css" />
    <link rel="stylesheet" type="text/css" href="js/resources/css/amda.css" />
fdc5eae5   Elena.Budnik   Anomalie #6355
39
    
16035364   Benjamin Renard   First commit
40
41
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> 
16035364   Benjamin Renard   First commit
42

74c32080   Elena.Budnik   isMigration false
43
44
<!--  <script type="text/javascript" src="js/lib/ext/builds/ext-core.js"></script> -->
<!--  <script type="text/javascript" src="js/lib/ext/bootstrap.js"></script> -->
8e40a14d   Elena.Budnik   new vars in desktop
45
<!--  <script type="text/javascript" src="js/lib/ext/ext-all-debug-w-comments.js"></script> -->
fdc5eae5   Elena.Budnik   Anomalie #6355
46
47
    <script type="text/javascript" src="js/lib/ext/ext-all.js"></script>
<!--	<script type="text/javascript" src="js/lib/ext/ext-all-dev.js"></script> -->
8cc08c31   Benjamin Renard   Fix columns resiz...
48
    <script type="text/javascript" src="js/lib/ext-override.js"></script>
16035364   Benjamin Renard   First commit
49
50
	
<!-- Direct API -->
fdc5eae5   Elena.Budnik   Anomalie #6355
51
    <script type="text/javascript" src="php/api.php"></script> 
16035364   Benjamin Renard   First commit
52

98a79839   Elena.Budnik   anomalie 4830
53
54
55
56
 
<!--  <script src="help/movies/Resources/scripts/prototype.js" language="JavaScript" type="text/javascript"></script>
      <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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72


    <script type="text/javascript">
    //Enable dynamic loading for improved debugging support
        Ext.Loader.setConfig({enabled: true});
 
        Ext.Loader.setPath({
            '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',
437c4dbc   Benjamin Renard   First implementat...
73
            'amdaPlotComp'      : 'js/app/views/PlotComponents',
16035364   Benjamin Renard   First commit
74
            'amdaModel'         : 'js/app/models',
437c4dbc   Benjamin Renard   First implementat...
75
            'amdaPlotObj'       : 'js/app/models/PlotObjects',
16035364   Benjamin Renard   First commit
76
77
78
79
80
81
82
83
84
85
86
87
            'amdaReader'        : 'js/app/stores',
            'amdaApp'           : 'js/app'
        });

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

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

        var myDesktopApp;
 
74c32080   Elena.Budnik   isMigration false
88
        var isMigration = false;
16035364   Benjamin Renard   First commit
89
90
        var sessionID = '<?php echo $sessionID; ?>';
        var isFirstVisit =  '<?php echo $usrMgr->isFirst; ?>';
74c32080   Elena.Budnik   isMigration false
91
        var isOldWS = false; // '<#?php echo $usrMgr->isOldWS; ?>';
16035364   Benjamin Renard   First commit
92
        var isSpecialInfo =  '<?php echo $usrMgr->isSpecialInfo; ?>';
aa94fd24   elena   Merge with last svn
93
94
95
        var isNewInfo =  '<?php echo $usrMgr->isNewInfo; ?>'; 
        var news = '../data/' + sessionID + '/INFO';

16035364   Benjamin Renard   First commit
96
97
98
99
100
101
102
103
        var AMDAVERSION =  '<?php if (defined('AMDA_VERSION')) echo AMDA_VERSION;?>';
 
        var wsSize =  '<?php echo $usrMgr->getWsSize(); ?>';
        var diskQuota = '<?php echo DISK_QUOTA; ?>';

        var freeSpace = diskQuota - wsSize;

        var helpDir = 'help/';
16035364   Benjamin Renard   First commit
104
        var isGuest = sessionID.match('guest');
8e40a14d   Elena.Budnik   new vars in desktop
105

7baca0ef   Elena.Budnik   user special sett...
106
        var max_uploaded_file_size = '<?php echo MAX_UPLOADED_FILESIZE; ?>';
16035364   Benjamin Renard   First commit
107
        var guestSessionDuration = '<?php echo GuestSessionDuration*60; ?>'; // in secs
45f46b61   Elena.Budnik   ext-all.js
108
        var maxGuestTimeInterval = '<?php echo MaxGuestTimeInterval; ?>';    // in days
f2b3e0e8   Elena.Budnik   ajax timeout = ga...
109
110
        
        var gatewayTimeout = '<?php if (defined('GATEWAY_TIMEOUT')) echo GATEWAY_TIMEOUT; else echo 300000; ?>'; // in msec
2cfa3a1a   Benjamin Renard   Give the possibil...
111

65448ffe   Benjamin Renard   Minor fix
112
        var logExecTime = <?php echo (defined('LOG_EXEC_TIME') && (LOG_EXEC_TIME === TRUE) ? 'true' : 'false'); ?>;
16035364   Benjamin Renard   First commit
113
114
        //create mask class (LoadMask for elements has been deprecated, use Ext.dom.Element.mask & Ext.dom.Element.unmask)
        var AMDAMask = new Ext.Class({
dca17cf3   Benjamin Renard   New implementatio...
115
            show : function(interactivePlot)
16035364   Benjamin Renard   First commit
116
117
            {
                var msg = 'Processing...Please wait';  
dca17cf3   Benjamin Renard   New implementatio...
118
                if (interactivePlot)   
16035364   Benjamin Renard   First commit
119
120
                    msg += ' <br/> <p align="center"><input id="killopBtn" type="button" value="Kill process" /></p>';

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

dca17cf3   Benjamin Renard   New implementatio...
123
                if (interactivePlot)
16035364   Benjamin Renard   First commit
124
                {
8e40a14d   Elena.Budnik   new vars in desktop
125
                    var killBtn = Ext.get('killopBtn');
16035364   Benjamin Renard   First commit
126
                    killBtn.on('click',function(e,t) {                     
c6ac946e   Benjamin Renard   Clean mask component
127
                        AmdaAction.killPlotRequest(function (result, e)
16035364   Benjamin Renard   First commit
128
129
130
131
132
133
134
135
136
137
                        {
                            var t = e.getTransaction();
                            if (e.status)
                            { 
                                if (!result)
                                    myDesktopApp.errorMsg('Cannot kill process');
                            }
                            else
                                myDesktopApp.errorMsg(e.message);

16035364   Benjamin Renard   First commit
138
139
140
                        },this);  
                   
                    },
c6ac946e   Benjamin Renard   Clean mask component
141
                    this);
16035364   Benjamin Renard   First commit
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

                }
            },
            hide : function()
            {
                Ext.getBody().unmask();
                this.tid = null;
            },
            isMasked : function()
            {
                return Ext.getBody().isMasked();
            }
        });
 
        var loadMask;

        Ext.onReady(function () { 
            //TODO update jobsStatus onLogin             
            Ext.Ajax.extraParams = {sessionID : sessionID};
f2b3e0e8   Elena.Budnik   ajax timeout = ga...
161
162
163
164
            Ext.Ajax.timeout = gatewayTimeout; // msec ; should be the same value (or less) as gateway timeout

            Ext.Ajax.on('requestexception', function(conn, response, options, e) { 

16035364   Benjamin Renard   First commit
165
166
                if (loadMask && loadMask.isMasked())
                    loadMask.hide();
f2b3e0e8   Elena.Budnik   ajax timeout = ga...
167
168
169
                    
                if (response && response.statusText) {
                    if (response.timedout) 
8d3a3d4b   Elena.Budnik   intercavive mod =...
170
                       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'); 
f2b3e0e8   Elena.Budnik   ajax timeout = ga...
171
                    else 
74c32080   Elena.Budnik   isMigration false
172
                        alert(response.statusText);
f2b3e0e8   Elena.Budnik   ajax timeout = ga...
173
                }
16035364   Benjamin Renard   First commit
174
                else
74c32080   Elena.Budnik   isMigration false
175
                    alert('Communication failure');
16035364   Benjamin Renard   First commit
176
                });
f2b3e0e8   Elena.Budnik   ajax timeout = ga...
177
           
16035364   Benjamin Renard   First commit
178
179
180
181
182
183
184
185
            // 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)) {
                     e.stopEvent();
                }
            });

            var stateProvider = Ext.create('amdaDesktop.AmdaStateProvider');
16035364   Benjamin Renard   First commit
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
            stateProvider.on({
                scope: this,
                afterrestore: function(provider)
                {
                    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();
                }
            });

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