Blame view

desktop.php 7.47 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
 *
 */
aa94fd24   elena   Merge with last svn
7
8
 
 
16035364   Benjamin Renard   First commit
9
  require_once('php/config.php');
aa94fd24   elena   Merge with last svn
10

16035364   Benjamin Renard   First commit
11
12
13
14
15
  // error_reporting(E_ALL);
  if (!isset($_POST['username'])) die('<a href="index.html">LOGIN SVP</a>');
 
  $usrMgr = new UserMgr();
  $sessionID = $usrMgr->init();
16035364   Benjamin Renard   First commit
16
17
18
19
20
21
22
23
24
25
?>

<!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
26
    <title><?php if (defined('TITLE')) { echo TITLE; } else { echo 'AMDANEW'; } ?></title>
16035364   Benjamin Renard   First commit
27
28
29
30
31
32
33

    <link rel="stylesheet" type="text/css" href="js/resources/css/desktop.css" />
    <link rel="stylesheet" type="text/css" href="js/resources/css/amda.css" />
    <link rel="stylesheet" type="text/css" href="js/lib/ext/resources/css/ext-all.css" />
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> 
    
98a79839   Elena.Budnik   anomalie 4830
34
35
<!--  <script type="text/javascript" src="js/lib/ext/builds/ext-core.js"></script> -->
<!--  <script type="text/javascript" src="js/lib/ext/bootstrap.js"></script> -->
846e2c94   Elena.Budnik   no SimuDel in des...
36
37
<!--  <script type="text/javascript" src="js/lib/ext/ext-all-debug-w-comments.js"></script>  -->
 	<script type="text/javascript" src="js/lib/ext/ext-all.js"></script> 
68ac27e0   Elena.Budnik   Redmine #5227
38
 <!--  <script type="text/javascript" src="js/lib/ext/ext-all-dev.js">  --> 
846e2c94   Elena.Budnik   no SimuDel in des...
39
 <!--	<script type="text/javascript" src="js/lib/ext-override.js"></script> -->
aa94fd24   elena   Merge with last svn
40

16035364   Benjamin Renard   First commit
41
42
43

	
<!-- Direct API -->
98a79839   Elena.Budnik   anomalie 4830
44
     <script type="text/javascript" src="php/api.php"></script> 
16035364   Benjamin Renard   First commit
45

98a79839   Elena.Budnik   anomalie 4830
46
47
48
49
 
<!--  <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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65


    <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...
66
            'amdaPlotComp'      : 'js/app/views/PlotComponents',
16035364   Benjamin Renard   First commit
67
            'amdaModel'         : 'js/app/models',
437c4dbc   Benjamin Renard   First implementat...
68
            'amdaPlotObj'       : 'js/app/models/PlotObjects',
16035364   Benjamin Renard   First commit
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
            '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;
 
        var sessionID = '<?php echo $sessionID; ?>';
        var isFirstVisit =  '<?php echo $usrMgr->isFirst; ?>';
        var isSpecialInfo =  '<?php echo $usrMgr->isSpecialInfo; ?>';
aa94fd24   elena   Merge with last svn
84
85
86
        var isNewInfo =  '<?php echo $usrMgr->isNewInfo; ?>'; 
        var news = '../data/' + sessionID + '/INFO';

16035364   Benjamin Renard   First commit
87
88
89
90
91
92
93
94
        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
95
96
97
        var isGuest = sessionID.match('guest');

        var guestSessionDuration = '<?php echo GuestSessionDuration*60; ?>'; // in secs
45f46b61   Elena.Budnik   ext-all.js
98
        var maxGuestTimeInterval = '<?php echo MaxGuestTimeInterval; ?>';    // in days
16035364   Benjamin Renard   First commit
99
100
101
 
        //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...
102
            show : function(interactivePlot)
16035364   Benjamin Renard   First commit
103
104
            {
                var msg = 'Processing...Please wait';  
dca17cf3   Benjamin Renard   New implementatio...
105
                if (interactivePlot)   
16035364   Benjamin Renard   First commit
106
107
108
109
110
111
112
113
114
115
116
117
                    msg += ' <br/> <p align="center"><input id="killopBtn" type="button" value="Kill process" /></p>';

                var mask = Ext.getBody().mask(msg);

                mask.dom.style.zIndex = '99998';
 
                var maskMsg = Ext.DomQuery.select('div[class=x-mask-msg]');
                if (maskMsg)
                    maskMsg = maskMsg[0];
    
                if (maskMsg)
                    maskMsg.style.zIndex = '99999';
dca17cf3   Benjamin Renard   New implementatio...
118
                if (interactivePlot)
16035364   Benjamin Renard   First commit
119
                {
c6ac946e   Benjamin Renard   Clean mask component
120
					var killBtn = Ext.get('killopBtn');
16035364   Benjamin Renard   First commit
121
                    killBtn.on('click',function(e,t) {                     
c6ac946e   Benjamin Renard   Clean mask component
122
                        AmdaAction.killPlotRequest(function (result, e)
16035364   Benjamin Renard   First commit
123
124
125
126
127
128
129
130
131
132
                        {
                            var t = e.getTransaction();
                            if (e.status)
                            { 
                                if (!result)
                                    myDesktopApp.errorMsg('Cannot kill process');
                            }
                            else
                                myDesktopApp.errorMsg(e.message);

16035364   Benjamin Renard   First commit
133
134
135
                        },this);  
                   
                    },
c6ac946e   Benjamin Renard   Clean mask component
136
                    this);
16035364   Benjamin Renard   First commit
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

                }
            },
            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};
            Ext.Ajax.timeout = 600000;
            Ext.Ajax.on('requestexception', function(conn, response, options, e) {                   
                if (loadMask && loadMask.isMasked())
                    loadMask.hide();
               if (response && response.statusText)
                    myDesktopApp.errorMsg(response.statusText);
                else
                    myDesktopApp.errorMsg('Communication failure');
                });
            // 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
            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