diff --git a/.gitignore b/.gitignore index 1f58e74..f72461b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ generic_data/newKernelDDBase/ js/lib/ext help/simu/simu* *~ + diff --git a/desktop.php b/desktop.php index 8e4ce34..ac9f168 100644 --- a/desktop.php +++ b/desktop.php @@ -1,26 +1,24 @@ <?php /** * @file index.php - * @version $Id: desktop.php 2915 2015-05-19 10:34:38Z elena $ - * + * @version $Id: desktop.php 2934 2015-06-03 13:23:22Z elena $ * */ - + + require_once('php/config.php'); - + // error_reporting(E_ALL); if (!isset($_POST['username'])) die('<a href="index.html">LOGIN SVP</a>'); $usrMgr = new UserMgr(); $sessionID = $usrMgr->init(); - //AKKA - Delete immediate results is now done in AmdaApp.js // ToDo : do the same mechanism for simu files and simuparams //delete immediate results if logout was not proper //$jobsMgr = new JobsMgr(); //$jobsMgr->deleteTmp(); - //delete simu files & clean simuparams in base.xml and WSparam.xml $myBaseMgr = new BaseManager(); $myBaseMgr->delSimuFiles("mywsrdata"); @@ -48,15 +46,13 @@ <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> --> <!-- <script type="text/javascript" src="js/lib/ext/ext-all-dev.js"> --> - <script type="text/javascript" src="js/lib/ext-override.js"></script> + <script type="text/javascript" src="js/lib/ext-override.js"></script> + <!-- Direct API --> <script type="text/javascript" src="php/api.php"></script> - <!-- This extjs script is not automatically loaded (probably due to a bug on extjs 4) --> - <!-- <script type="text/javascript" src="js/lib/ux/Browser.js"></script> --> - <!-- <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> @@ -93,7 +89,9 @@ var sessionID = '<?php echo $sessionID; ?>'; var isFirstVisit = '<?php echo $usrMgr->isFirst; ?>'; var isSpecialInfo = '<?php echo $usrMgr->isSpecialInfo; ?>'; - var isNewInfo = '<?php echo $usrMgr->isNewInfo; ?>'; + var isNewInfo = '<?php echo $usrMgr->isNewInfo; ?>'; + var news = '../data/' + sessionID + '/INFO'; + var AMDAVERSION = '<?php if (defined('AMDA_VERSION')) echo AMDA_VERSION;?>'; var wsSize = '<?php echo $usrMgr->getWsSize(); ?>'; @@ -102,7 +100,6 @@ var freeSpace = diskQuota - wsSize; var helpDir = 'help/'; - var isGuest = sessionID.match('guest'); var guestSessionDuration = '<?php echo GuestSessionDuration*60; ?>'; // in secs @@ -220,3 +217,4 @@ </head> <body/> </html> + diff --git a/help/MAVEN b/help/MAVEN new file mode 100644 index 0000000..e50e669 --- /dev/null +++ b/help/MAVEN @@ -0,0 +1,19 @@ +<h2>Mars Atmosphere and Volatile Evolution Mission (MAVEN)</h2> +MAVEN launched on November 18, 2013, and entered orbit around Mars on September 21, 2014. +The mission’s goal is to explore the planet’s upper atmosphere, ionosphere, and interactions +with the Sun and solar wind. Scientists will use MAVEN data to explore the loss of volatile +compounds—such as CO2, N2, and H2O—from the Martian atmosphere to space. Understanding atmospheric +loss will give scientists insight into the history of Mars' atmosphere and climate, liquid water, +and planetary habitability. <br/><br/>MAVEN Principal Investigator: +Dr. Bruce M. Jakosky (University of Colorado; Laboratory for Atmospheric and Space Physics). +<br/><br/> +For more information visit MAVEN <a href="http://lasp.colorado.edu/home/maven/" target="new">home page</a>. +<br/><br/> +MAVEN data in AMDA come from +<a href="http://ppi.pds.nasa.gov/search/?t=Mars&sc=MAVEN&i=null&title=Mars%20:%20MAVEN" target="new"> +PDS/PPI</a>. +<br/><br/> +Please follow MAVEN +<a href="http://lasp.colorado.edu/home/maven/files/2014/09/MAVEN_public-rules-of-the-road-v3.pdf" target="new"> +rules of the road</a> while using MAVEN data. + \ No newline at end of file diff --git a/help/mavenMAG b/help/mavenMAG new file mode 100644 index 0000000..594c5f8 --- /dev/null +++ b/help/mavenMAG @@ -0,0 +1,8 @@ +<h2>Magnetometer (MAG)</h2> +MAG is a part of the MAVEN Particles and Fields (P & F) +Package and measures interplanetary solar wind and ionospheric magnetic fields.<br/><br/> + +<a href="http://1.usa.gov/jecbio" target="new">Jack Connerney</a> (GSFC) is the instrument lead for the MAG.</br/><br/> + +For detailed information about MAG visit <a href="http://lasp.colorado.edu/home/maven/science/instrument-package/mag/" target="new"> +MAG home page</a> diff --git a/help/mavenSWEA b/help/mavenSWEA new file mode 100644 index 0000000..9006bd2 --- /dev/null +++ b/help/mavenSWEA @@ -0,0 +1,7 @@ +<h2>The Solar Wind Electron Analyzer (SWEA)</h2> +SWEA is a part of the MAVEN Particles and Fields (P & F) Package and measures the solar wind and ionospheric electrons.<br/><br/> + +<a href="http://bit.ly/dmitchellbio" target="new">David L. Mitchell</a> (SSL) is the instrument lead for SWEA.</br/><br/> +Christian Mazelle (IRAP) is responsible for hardware supply (electron spectrometer).</br/><br/> +For detailed information about SWEA visit <a href="http://lasp.colorado.edu/home/maven/science/instrument-package/swea/" target="new"> +SWEA home page</a> diff --git a/help/mavenSWIA b/help/mavenSWIA new file mode 100644 index 0000000..0e8ed08 --- /dev/null +++ b/help/mavenSWIA @@ -0,0 +1,9 @@ +<h2>Solar Wind Ion Analyzer (SWIA)</h2> +The Solar Wind Ion Analyzer (SWIA) is a part of the MAVEN Particles and Fields (P & F) +Package and measures the solar wind and magnetosheath proton flow +around Mars and constrains the nature of solar wind interactions with the upper atmosphere.<br/><br/> + +The SWIA instrument lead is <a href="http://www.physics.uiowa.edu/~jhalekas" target="new">Jasper Halekas</a> (University of Iowa). +<br/><br/> +For detailed information about SWIA visit <a href="http://lasp.colorado.edu/home/maven/science/instrument-package/swia/" target="new"> +SWIA home page</a> diff --git a/help/parameters/PC b/help/parameters/PC new file mode 100644 index 0000000..52b8f2b --- /dev/null +++ b/help/parameters/PC @@ -0,0 +1,32 @@ + +<h2>Ground based indices at AMDA : Polar Cap Index </h2> +<UL> + + <li> Polar Cap Index (North and South) is taken from the + <a href="http://pc-index.org" TARGET=_BLANK>Polar Cap Magnetic Index Site</a>. +<P><br?> + The PC index is characteristic of the polar cap magnetic + activity generated by geoeffective solar wind acting on the magnetosphere. + The index is derived by magnetic data of only two stations Thule and Vostok located in +the northern (PCN) and southern (PCS) near-pole regions. In 2013 the International Association of +Geomagnetism and Aeronomy (IAGA) recommended to international scientific community to use PC index as a +proxy for energy that enters into the magnetosphere during solar wind – magnetosphere coupling. +The procedure adopted in AARI and DTU provides on-line calculation of the PCS and PCN +indices corresponding to geoeffective interplanetary electric field EKL value irrespective of time, +season and solar cycle. +<P><br/> +<i><b>IAGA Resolution No. 3 (2013)</b><br/> +Polar Cap (PC) index<br/><br/> + +IAGA, noting that polar cap magnetic activity is not yet described by existing IAGA geomagnetic indices, +considering that the Polar Cap (PC) index constitutes a quantitative estimate of geomagnetic activity at polar +latitudes and serves as a proxy for energy that enters into the magnetosphere during solar wind-magnetosphere +coupling, emphasising that the usefulness of such an index is dependent on having a continuous data series, +recognising that the PC index is derived in partnership between the Arctic and Antarctic Research Institute +(AARI, Russian Federation) and the National Space Institute, Technical University of Denmark (DTU, Denmark) +recommends use of the PC index by the international scientific community in its near-real time and definitive +forms, and urges that all possible efforts be made to maintain continuous operation of all geomagnetic +observatories contributing to the PC index. +</i> +</UL> + diff --git a/help/policy.html b/help/policy.html index 254dac3..40ba897 100755 --- a/help/policy.html +++ b/help/policy.html @@ -21,11 +21,12 @@ <li><a href="http://spdf.gsfc.nasa.gov/new_users.html" target="_blank">CDAWEB</a> <li><a href="http://ppi.pds.nasa.gov/citations_policy.jsp" target="_blank">PDS</a> <li><a href="http://mapsview.engin.umich.edu/use_policy" target="_blank">MAPSKP</a> - <li><a href="http://themis.ssl.berkeley.edu/roadrules.shtml" target="_blank">THEMIS</a> + <li><a href="http://themis.ssl.berkeley.edu/roadrules.shtml" target="_blank">THEMIS</a> + <li><a href="http://lasp.colorado.edu/home/maven/files/2014/09/MAVEN_public-rules-of-the-road-v3.pdf" target="_blank">MAVEN</a> <li><a href="SKR.html">CASSINI/RPWS/SKR</a> <li><a href="VEXGRAZ.html">VEXGRAZ</a> <li><a href="http://caa.estec.esa.int/caa/ror.xml" target="_blank">CAA</a> / <a href="http://www.cosmos.esa.int/web/csa/rules-of-the-road" target="_blank">CSA</a> - <li><a href="STEREO.html">STEREO</a> + <li><a href="STEREO.html">STEREO</a> <li><a href="http://ccmc.gsfc.nasa.gov/PubPolicy.php" target="_blank">CCMC</a> </ul> </div> @@ -48,3 +49,4 @@ to remote centres, please follow the corresponding Rules of the Road. </div> </div></div></div> </body></html> + diff --git a/js/app/AmdaApp.js b/js/app/AmdaApp.js index a259ed2..f9a7f1d 100755 --- a/js/app/AmdaApp.js +++ b/js/app/AmdaApp.js @@ -5,7 +5,7 @@ * @extends Ext.ux.desktop.App * @brief Main class defining Amda Desktop and its Modules * @author Ext JS Library 4.0 Copyright(c) 2006-2011 Sencha Inc. licensing@sencha.com - * @version $Id: AmdaApp.js 2540 2014-10-03 09:22:29Z natacha $ + * @version $Id: AmdaApp.js 2932 2015-06-02 09:35:47Z elena $ * @todo Load/Unload Modules on need ******************************************************************************* * FT Id : Date : Name - Description @@ -159,6 +159,7 @@ Ext.define('amdaApp.AmdaApp', { scope : this, beforeunload : function () { + var interopModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id); if (interopModule) interopModule.forceSampDisconnect(); @@ -167,40 +168,8 @@ Ext.define('amdaApp.AmdaApp', { ready : function () { //AKKA - Clean user WS - AmdaAction.cleanUserWS(function(res,e){},this); - - if (freeSpace < diskQuota / 20) { - myDesktopApp.warningMsg('Think of cleaning up your work space.<br/>Only ' + - Math.round(freeSpace/1024/1024)+ 'MB of '+Math.round(diskQuota/1024/1024) + - 'MB rests'); - } - - if (isFirstVisit && !isGuest) { - if (isSpecialInfo) { - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) { - module.createWindow(isSpecialInfo, 'Welcome to AMDA', true); - }); - } else { - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) { - module.createWindow(isSpecialInfo, 'Welcome to AMDA', true); - }); - } - } - else { - if (isSpecialInfo) { - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) { - module.createWindow(isSpecialInfo, 'Welcome to AMDA', true); - }); - } - } - if (isGuest) { - myDesktopApp.warningMsg("Welcome to Guest Session<br/>Guest session lasts for "+ - guestSessionDuration/3600+" h maximum<br/>"+ - "For extended use time and functionalities (saved sessions)<br/> please register at amda@irap.omp.eu"); - Ext.Function.defer(myDesktopApp.warningMsg,(guestSessionDuration-300)*1000, this, ["Your session will be closed in 5 min!"]); - Ext.Function.defer(myDesktopApp.forceLogout, guestSessionDuration*1000); - } - } + AmdaAction.cleanUserWS(function(res,e){},this); + } }, init: function() { @@ -294,9 +263,7 @@ Ext.define('amdaApp.AmdaApp', { if (!wallpaper) wallpaper = 'js/resources/images/desktop/wallpapers/Cdpp2.jpg'; return Ext.apply(ret, { - id : desktopId, - // cls: 'ux-desktop-black', // TODO: investigate about uncomplete theme application !!! - + id : desktopId, contextMenuItems: [ { text: 'Change Settings', handler: me.onSettings, scope: me } ], @@ -306,13 +273,14 @@ Ext.define('amdaApp.AmdaApp', { data: [ { name: 'Help', iconCls: 'help', module: 'help-win' }, { name: 'Create/Modify parameter', iconCls: 'edit', module: 'param-win' }, - { name: 'Plotting data', iconCls: 'plot', module: 'plot-win'}, + { name: 'Plot data', iconCls: 'plot', module: 'plot-win'}, { name: 'Data mining', iconCls: 'search', module: 'search-win'}, { name: 'Download data', iconCls: 'download_manager', module: 'down-win'}, { name: 'Upload data', iconCls: 'mydata', module: 'up-win'}, - { name: 'Manage Time Tables', iconCls: 'timeTable', module: 'timetab-win' }, - { name: 'TimeTables Operations', iconCls: 'operations', module: 'ttsOpe-win' },//, - // { name: 'My catalogs', iconCls: 'catalog', module: 'catalog-win'}, + { name: 'Manage TimeTables', iconCls: 'timeTable', module: 'timetab-win' }, + { name: 'TimeTables operations', iconCls: 'operations', module: 'ttsOpe-win' }, + // { name: 'Generate/Edit catalogs', iconCls: 'catalog', module: 'catalog-win'}, + // { name: 'Visualize catalogs', iconCls: 'visu_catalog', module: 'visucatalog-win'}, { name: 'Interoperability', iconCls: 'interop', module: 'interop-win' } ] }), @@ -325,7 +293,6 @@ Ext.define('amdaApp.AmdaApp', { // config for the start menu getStartConfig : function() { var me = this, ret = me.callParent(); - return Ext.apply(ret, { title: sessionID, iconCls: 'icon-user', @@ -460,7 +427,6 @@ Ext.define('amdaApp.AmdaApp', { getTaskbarConfig: function () { var ret = this.callParent(); - return Ext.apply(ret, { quickStart: [], trayItems: [ @@ -636,12 +602,48 @@ Ext.define('amdaApp.AmdaApp', { module.createWindow(); }); }, this); + + if (freeSpace < diskQuota / 20) { + myDesktopApp.warningMsg('Think of cleaning up your work space.<br/>Only ' + + Math.round(freeSpace/1024/1024)+ 'MB of '+Math.round(diskQuota/1024/1024) + + 'MB rests'); + } + + if (isFirstVisit && !isGuest) { + if (isSpecialInfo) { + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) { + module.createWindow(isSpecialInfo, 'Welcome to AMDA', true); + }); + } else { + + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.help.id, true, function(module) { + module.createWindow(); + }); + } + } + else { + if (isSpecialInfo && !isNewInfo) { + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) { + module.createWindow(isSpecialInfo, 'Welcome to AMDA', true); + }); + } + } - if (isNewInfo) { - this.getLoadedModule(this.dynamicModules.info.id, true, function (module) { - module.createWindow('releaseNotes.' + AMDAVERSION, 'New Release V'+ AMDAVERSION); - }); + if (isNewInfo) { + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) { + // module.createWindow('releaseNotes.' + AMDAVERSION, 'New Release V'+ AMDAVERSION); + module.createWindow(news, 'Amda Latest News'); + }); + } + + if (isGuest) { + myDesktopApp.warningMsg("Welcome to Guest Session<br/>Guest session lasts for "+ + guestSessionDuration/3600+" h maximum<br/>"+ + "For extended use time and functionalities (saved sessions)<br/> please register at amda@irap.omp.eu"); + Ext.Function.defer(myDesktopApp.warningMsg,(guestSessionDuration-300)*1000, this, ["Your session will be closed in 5 min!"]); + Ext.Function.defer(myDesktopApp.forceLogout, guestSessionDuration*1000); } + this.desktop.taskbar.tray.width = 130; @@ -654,3 +656,4 @@ Ext.define('amdaApp.AmdaApp', { }})); } }); + diff --git a/js/app/models/DownloadNode.js b/js/app/models/DownloadNode.js index da43f14..bd9fb50 100644 --- a/js/app/models/DownloadNode.js +++ b/js/app/models/DownloadNode.js @@ -5,12 +5,7 @@ * @extends amdaModel.ExecutableNode * @brief Basic Model of Node corresponding to a download request * @author Myriam - * @version $Id: DownloadNode.js 2640 2014-11-18 11:57:25Z elena $ - * @todo - ******************************************************************************* - * FT Id : Date : Name - Description - ******************************************************************************* - * : 15/12/2011 - file creation + * @version $Id: DownloadNode.js 2949 2015-06-23 10:25:59Z elena $ */ //TODO amdaModel.SingletonNode class ??? Ext.define('amdaModel.DownloadNode', { @@ -37,12 +32,7 @@ Ext.define('amdaModel.DownloadNode', { getObjectCallback : function(result,remoteEvent){ var t = remoteEvent.getTransaction(); if (result) { - // var reader = Ext.create('Ext.data.reader.Json',{ - // model: this.get('objectDataModel') - // }); - // var resultSet = reader.read(result); - // var paramObj = resultSet.records[0];// - var paramObj = Ext.create(this.get('objectDataModel'), result); + var paramObj = Ext.create(this.get('objectDataModel'), result); // set parameter into node this.set('object', paramObj); var downObject = amdaModel.DownloadNode.decodeObject(); @@ -156,7 +146,6 @@ Ext.define('amdaModel.DownloadNode', { parseArgs: function(param) { var name = param.name; var args = param.downloadParamArgs; - if (args.energyMax){ var nameToSent = name + '_' + args.energyMin + '_' + args.energyMax; return nameToSent; @@ -184,6 +173,11 @@ Ext.define('amdaModel.DownloadNode', { if (args.SW_Monitor) { var nameToSent = name + '_' + args.Spacecraft + '_' + args.SW_Monitor; return nameToSent; + } + // Cain ; Morschhauser + if (args.Spacecraft && args.Sampling) { + var nameToSent = name + '_' + args.Spacecraft + '_' + args.Sampling; + return nameToSent; } // LATMOS if (args.ClockAngle && args.Satellite) { @@ -235,7 +229,7 @@ Ext.define('amdaModel.DownloadNode', { AmdaAction.execute({nodeType : this.get('nodeType')}, jsonObject, function(res,e){ loadMask.hide(); - + //AKKA - Rework of the result treatment for the integration with the new kernel if (!e.status) { @@ -287,6 +281,7 @@ Ext.define('amdaModel.DownloadNode', { var obj = this.get('object').getJsonValues(); //TODO text, name, outputName - if all is needed //new object to attach to new bkgJobNode + //TODO Ext.clone() var newobj = Ext.copyTo({}, obj, this.get('object').propertiesToCopy); @@ -294,7 +289,6 @@ Ext.define('amdaModel.DownloadNode', { newobj.resultId = res.result; newobj.folderId = res.folder; newobj = Ext.create(this.get('object').$className, newobj); - return newobj; } diff --git a/js/lib/ux/desktop/exampleModules/Settings.js b/js/lib/ux/desktop/exampleModules/Settings.js index 4c2ac2a..e34a925 100755 --- a/js/lib/ux/desktop/exampleModules/Settings.js +++ b/js/lib/ux/desktop/exampleModules/Settings.js @@ -106,7 +106,8 @@ Ext.define('MyDesktop.Settings', { child('Cdpp2.jpg'), child('sky.jpg'), child('rosetta.jpg'), - child('rosetta2.jpg') + child('rosetta2.jpg'), + child('SObackground.png') ] } }) diff --git a/js/resources/images/desktop/wallpapers/SObackground.png b/js/resources/images/desktop/wallpapers/SObackground.png new file mode 100644 index 0000000..23201d3 Binary files /dev/null and b/js/resources/images/desktop/wallpapers/SObackground.png differ diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index 2ac3c4b..6abc472 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -1,7 +1,7 @@ <?php /** * @class AmdaAction - * @version $Id: AmdaAction.php 2333 2014-04-30 10:38:02Z elena $ + * @version $Id: AmdaAction.php 2976 2015-07-01 15:05:40Z benjamin $ * */ @@ -16,11 +16,13 @@ class AmdaAction { 'bkgWorks' => 'jobs.xml'); private $user, $amdaStat; - + public function __construct() - { - if (!defined('NEWKERNEL_DEBUG') || !NEWKERNEL_DEBUG) - $this->amdaStat = new AmdaStats(); + { + $dd = new UserMgr(); + $this->user = $dd->user; + if (!defined('NEWKERNEL_DEBUG') || !NEWKERNEL_DEBUG) + $this->amdaStat = new AmdaStats($dd->user); } private function getUrlDirs($url) { @@ -292,10 +294,12 @@ class AmdaAction { } + //TODO proper conditions if (substr($id,0,3) == 'ros') { if ( !(strpos($id,'_r_') || strpos($id,'_xyz_') || strpos($id,'_cg_') - || strpos($id,'_sc_') || strpos($id,'_aux_')) ) + || strpos($id,'_sc_') || strpos($id,'_aux_') || strpos($id,'_sw_') + || strpos($id,'_tao_') )) { $not_yet = true; } @@ -550,6 +554,7 @@ class AmdaAction { return array("error" => $nodeType." NOT_IMPLEMENTED_YET"); } return $objectMgr -> getUploadedObject($name, $format, true); + } /* @@ -571,6 +576,7 @@ class AmdaAction { * temporary object from Search */ public function getTmpObject($folderId, $name, $nodeType) { + switch ($nodeType) { case 'timeTable' : @@ -580,6 +586,7 @@ class AmdaAction { return array("error" => $nodeType." NOT_IMPLEMENTED_YET"); } return $objectMgr -> getTmpObject($folderId, $name, true); + } @@ -636,6 +643,7 @@ class AmdaAction { case 'bkgWorks' : require_once(INTEGRATION_SRC_DIR."RequestManager.php"); return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSDELETE); + case 'myData' : $objectMgr = new FilesMgr(); break; @@ -728,8 +736,7 @@ class AmdaAction { } return $objectMgr -> modifyObject($obj); - } - + } /* * {obj.name, obj.nodeType, obj.leaf} */ @@ -756,6 +763,7 @@ class AmdaAction { /* * Get Jobs en cours */ + public function getJobs() { require_once(INTEGRATION_SRC_DIR."RequestManager.php"); @@ -913,7 +921,6 @@ class AmdaAction { return $result; } - public function initTTCache() { $cacheMgr = new TimeTableCacheMgr(); @@ -991,7 +998,7 @@ class AmdaAction { $cacheMgr = new TimeTableCacheMgr(); return $cacheMgr->getStatus(); } - + /* * Send a feedback * @@ -1190,8 +1197,7 @@ class AmdaAction { $res = array('success' => true,'addedRuns' => $obj); return $res; - } - + } //AKKA - New action to clean user WS public function cleanUserWS() { @@ -1207,3 +1213,4 @@ class AmdaAction { } } ?> + diff --git a/php/classes/AmdaClient.php b/php/classes/AmdaClient.php index 72b1fe7..0b414e0 100644 --- a/php/classes/AmdaClient.php +++ b/php/classes/AmdaClient.php @@ -1,7 +1,7 @@ <?php /** @class AmdaClient - * @version $Id: AmdaClient.php 2322 2014-04-26 12:36:49Z elena $ + * @version $Id: AmdaClient.php 2888 2015-04-29 15:25:42Z elena $ * @brief Client of DD Web Server * */ @@ -24,7 +24,6 @@ class AmdaClient { * DDServer is defined in DD.res */ $SERVER = file($DDPATH."/DD.res"); - if (!file_exists(DATAPATH."wsdl.location")) { $msg = "No WSDL location file -> Nothing done".PHP_EOL; error_log($msg, 1, email); @@ -769,3 +768,4 @@ class AmdaClient { } */ } + diff --git a/php/classes/AmdaNews.php b/php/classes/AmdaNews.php new file mode 100644 index 0000000..bb79d5a --- /dev/null +++ b/php/classes/AmdaNews.php @@ -0,0 +1,122 @@ +<?php +/** + * @class AmdaNews + * @version $Id: AmdaNews.php 2957 2015-06-25 13:40:38Z elena $ + * + */ + +class AmdaNews { + + public $user, $userdir, $infodir; + + public function __construct($user) { + if ($user) { + $this->user = $user; + $this->userdir = USERPATH."/".$user."/"; + $this->infodir = HELPPATH."INFO/"; + } + } + +/** +* Add new info message and mark user dir with newInfo file +*/ + public function addInfo($group){ + + // special dir for group news + if ($group) $this->infodir = BASE_PATH.'help/'.$group.'_INFO/'; + else $this->infodir = BASE_PATH.'help/INFO/'; + + $timeStamp = time(); + $stringDate = date("Y-m-d",$timeStamp); + + if (!is_dir($this->infodir)) mkdir($this->infodir); + + $ff = fopen($this->infodir.'info.'.$timeStamp,'w'); + $infoToWrite = $_POST['info']; + + if (strpos($infoToWrite,"<a href=") !== false) { + $infoToWrite = str_replace("<a href=","<a target='new' href=", $infoToWrite); + } + fwrite($ff,'<li><b>'.$stringDate.'</b><br/>'.$infoToWrite.PHP_EOL); + fclose($ff); + + $userDir = BASE_PATH."data/"; + + $users = glob($userDir."*"); + foreach ($users as $user) { + + $file = $user.'/newInfo'; + touch($file); + chmod($file, 0775); + } + + return array("msg" => "New Info is saved", "success" => true); + + } + +/** +* Concate individual info messages inti one to be shown to user +*/ + public function makeInfo($groups){ + + if (file_exists($this->userdir.'lastLogin')) { + + $timeStamp = filemtime($this->userdir.'lastLogin'); + + $ff = fopen($this->userdir.'INFO','w'); + fwrite($ff,'<IMG align="right" SRC="help/images/picto_amda.png"/><br/><h2>AMDA Latest News</h2><br/>'); + fclose($ff); + + $userGrps = explode(',',strtoupper($groups)); + + foreach ($userGrps as $grp) { + if (is_dir(HELPPATH.$grp."_INFO")) { + $grpDir = HELPPATH.$grp."_INFO/"; + $grpInfoFiles = glob($grpDir."info*"); + $grpFileList = array(); + + foreach ($grpInfoFiles as $file) { + $grpFileList[filemtime($file)] = $file; + } + + ksort($grpFileList); + $grpFileList = array_reverse($grpFileList, TRUE); + + foreach ($grpFileList as $info) { + if (filemtime($info) > $timeStamp) { + file_put_contents($this->userdir.'INFO', file_get_contents($info), FILE_APPEND); + $NN++; + } + } + } + } + + $publicInfoFiles = glob($this->infodir."info*"); + $fileList = array(); + + foreach ($publicInfoFiles as $file) { + $fileList[filemtime($file)] = $file; + } + + ksort($fileList); + $fileList = array_reverse($fileList, TRUE); + + $NN = 0; + + foreach ($fileList as $info) { + if (filemtime($info) > $timeStamp) { + file_put_contents($this->userdir.'INFO', file_get_contents($info), FILE_APPEND); + $NN++; + } + } + + if ($NN == 0) { + unlink($this->userdir.'INFO'); // No news + return 0; + } + else return 1; + } + else return 0; + } +} +?> diff --git a/php/classes/AmdaStats.php b/php/classes/AmdaStats.php index 7c660e0..e99395f 100644 --- a/php/classes/AmdaStats.php +++ b/php/classes/AmdaStats.php @@ -1,7 +1,7 @@ <?php /** * @class AmdaStats - * @version $Id: AmdaStats.php 2716 2015-01-19 13:22:05Z elena $ + * @version $Id: AmdaStats.php 2964 2015-06-26 07:53:48Z elena $ * */ @@ -24,7 +24,7 @@ class AmdaStats { if (!$user){ // general - to read define('StatsXml',DATAPATH.'Statistics/Stats.xml'); - if (file_exists(StatsXml)) unlink(StatsXml); + // if (file_exists(StatsXml)) unlink(StatsXml); } else { // individual - to write @@ -69,7 +69,6 @@ class AmdaStats { $doc2 = new DomDocument("1.0"); $users=glob(USERPATH."*"); - foreach ($users as $user) { $name2 = $user."/Stats.xml"; @@ -89,7 +88,12 @@ class AmdaStats { } } } - + + // write task statistics as json + $this->getModulesStat(null,null,true); + // write data statistics as json + $this->getDataStat(0,null,null,true); + return $this->statXml->save(StatsXml); } @@ -189,7 +193,12 @@ class AmdaStats { /* * Show Statistics */ - public function getModulesStat($start, $stop){ + public function getModulesStat($start, $stop, $update){ + + + if (!$update && file_exists(DATAPATH.'Statistics/tasks.json')) { + return file_get_contents(DATAPATH.'Statistics/tasks.json'); + } $taskArray = array(); @@ -199,90 +208,100 @@ class AmdaStats { $hints = $items->length; $startStop = $this->getStartStop($items, $start, $stop); - $taskArray[] = array('task' => $task, 'number' => $hints, - 'start' => $startStop[0], 'stop' => $startStop[1]); + 'start' => $startStop[0], 'stop' => $startStop[1]); } - - $objToReturn = array('stats' => $taskArray); + + $objToReturn = json_encode(array('stats' => $taskArray)); + + file_put_contents(DATAPATH.'Statistics/tasks.json', $objToReturn); + return $objToReturn; } /* * Show Statistics */ - public function getDataStat($index, $start, $stop){ + public function getDataStat($index, $start, $stop, $update){ - $VIarray = array(); - $TOTALarray = array(); - $STARTarray = array(); - $STOParray = array(); - foreach ($this->tasks as $task) { + if (!$update && file_exists(DATAPATH.'Statistics/data.json')) { + $GENERALarray = json_decode(file_get_contents(DATAPATH.'Statistics/data.json')); + } + else { + $VIarray = array(); + $TOTALarray = array(); + $STARTarray = array(); + $STOParray = array(); - $theTask = $this->statXml->getElementsByTagName($task)->item(0); - $items = $theTask->getElementsByTagName('item'); - $TASKarray = array(); - - foreach ($items as $item){ - - $VIs = $item->getElementsByTagName('dataset'); - $time = strtotime($item->getAttribute('date')); - - foreach ($VIs as $VI) { - $id = $VI->nodeValue; - if ($id) { - if ($TASKarray[$id]) { - $TASKarray[$id]++; - $TOTALarray[$id]++; - if ($STARTarray[$id] > $time) - $STARTarray[$id] = $time; - if ($STOParray[$id] < $time) - $STOParray[$id] = $time; - } - else { - if (!$TOTALarray[$id]) { - $STARTarray[$id] = $time; - $STOParray[$id] = $time; - $TOTALarray[$id] = 1; - } - else { - if ($STARTarray[$id] > $time) + foreach ($this->tasks as $task) { + + $theTask = $this->statXml->getElementsByTagName($task)->item(0); + $items = $theTask->getElementsByTagName('item'); + $TASKarray = array(); + + foreach ($items as $item){ + + $VIs = $item->getElementsByTagName('dataset'); + $time = strtotime($item->getAttribute('date')); + + foreach ($VIs as $VI) { + $id = $VI->nodeValue; + if ($id) { + if ($TASKarray[$id]) { + $TASKarray[$id]++; + $TOTALarray[$id]++; + if ($STARTarray[$id] > $time) $STARTarray[$id] = $time; - if ($STOParray[$id] < $time) + if ($STOParray[$id] < $time) $STOParray[$id] = $time; - $TOTALarray[$id]++; - } - $TASKarray[$id] = 1; - } - } + } + else { + if (!$TOTALarray[$id]) { + $STARTarray[$id] = $time; + $STOParray[$id] = $time; + $TOTALarray[$id] = 1; + } + else { + if ($STARTarray[$id] > $time) + $STARTarray[$id] = $time; + if ($STOParray[$id] < $time) + $STOParray[$id] = $time; + $TOTALarray[$id]++; + } + $TASKarray[$id] = 1; + } + } + } + } + $VIarray[$task] = $TASKarray; } - } - $VIarray[$task] = $TASKarray; - } - - $GENERALarray = array(); - arsort($TOTALarray); - - foreach ($TOTALarray as $key => $value) { - $viStart = $STARTarray[$key]; - $viStop = $STOParray[$key]; - $plot = $VIarray['plot'][$key]; - $mining = $VIarray['mining'][$key]; - $print = $VIarray['print'][$key]; - if ($key != 'undefined') - { - $GENERALarray[] = array('id' => $key, 'number' => $value, - 'plot' => $plot, 'mining' => $mining, - 'print' => $print, 'start' => $viStart, - 'stop' => $viStop); - } - } - + + $GENERALarray = array(); + arsort($TOTALarray); + + foreach ($TOTALarray as $key => $value) { + $viStart = $STARTarray[$key]; + $viStop = $STOParray[$key]; + $plot = $VIarray['plot'][$key]; + $mining = $VIarray['mining'][$key]; + $print = $VIarray['print'][$key]; + if ($key != 'undefined') + { + $GENERALarray[] = array('id' => $key, 'number' => $value, + 'plot' => $plot, 'mining' => $mining, + 'print' => $print, 'start' => $viStart, + 'stop' => $viStop); + } + } + } + $Nmax = count($GENERALarray); $length = $index + 20 > $Nmax ? $Nmax - $index + 1 : 20; $objToReturn = array('stats' => array_reverse(array_slice($GENERALarray, $index, $length))); + + file_put_contents(DATAPATH.'Statistics/data.json',json_encode($GENERALarray)); // $objToReturn = array('stats' => $GENERALarray); return $objToReturn; } @@ -302,6 +321,37 @@ class AmdaStats { return array(min($date), max($date)); } + + public function mergeStats($inXml) { + + + if (!file_exists(StatsXml)) return 0; + + if (!file_exists($inXml)) return 0; + + $tags = array_merge($this->tasks,$this->tasksAdd); + + $doc1 = new DomDocument("1.0"); + $doc2 = new DomDocument("1.0"); + + if (!$doc1->load(StatsXml)) return 0; + if (!$doc2->load($inXml)) return 0; + + foreach ($tags as $tag){ + $tag1 = $doc1->getElementsByTagName($tag)->item(0); + $tag2 = $doc2->getElementsByTagName($tag)->item(0); + $items2 = $tag2->getElementsByTagName("item"); + if ($items2->length > 0) { + foreach ($items2 as $item2) { + $item1 = $doc1->importNode($item2, true); + $tag1->appendChild($item1); + } + } + } + + return $doc1->save(StatsXml); + + } } ?> diff --git a/php/classes/SimuArgsMgr.php b/php/classes/SimuArgsMgr.php index cde9305..5805ca4 100644 --- a/php/classes/SimuArgsMgr.php +++ b/php/classes/SimuArgsMgr.php @@ -98,7 +98,7 @@ case 'SINP': if ($this->simulatedRegion == 'Mercury.Magnetosphere'){ $grp[] = array("group" => "BD", "args" => array("value" => "-196.0")); - $grp[] = array("group" => "Flux", "args" => array("value" => "131.0")); + $grp[] = array("group" => "Flux", "args" => array("value" => "4.0")); $grp[] = array("group" => "Rss", "args" => array("value" => "1.35")); $grp[] = array("group" => "R2", "args" => array("value" => "1.32")); $grp[] = array("group" => "DZ", "args" => array("value" => "0.0")); diff --git a/php/classes/SimuParamMgr.php b/php/classes/SimuParamMgr.php index 37ce877..4c42095 100755 --- a/php/classes/SimuParamMgr.php +++ b/php/classes/SimuParamMgr.php @@ -380,4 +380,5 @@ } } -?> \ No newline at end of file +?> + diff --git a/php/classes/UserMgr.php b/php/classes/UserMgr.php index 5551ff5..c3c5079 100644 --- a/php/classes/UserMgr.php +++ b/php/classes/UserMgr.php @@ -1,7 +1,7 @@ <?php /** * @class UserMgr - * @version $Id: UserMgr.php 2820 2015-03-18 06:46:57Z elena $ + * @version $Id: UserMgr.php 2926 2015-06-01 14:01:53Z elena $ * */ @@ -70,8 +70,6 @@ define('JOBPATH', USERPATH.'jobs/'); $this->user = $_GET['sessionID']; else if (isset($sessionID)) $this->user = $sessionID; - - $this->amdaClient = new AmdaClient(); } @@ -81,7 +79,8 @@ define('JOBPATH', USERPATH.'jobs/'); } - public function getIPclient(){ + + public function getIPclient(){ /* REMOTE_ADDR is the only really reliable information, @@ -113,7 +112,7 @@ define('JOBPATH', USERPATH.'jobs/'); protected function getAvailableMissionsByUser() { $res = $this->amdaClient->getUserAvailableMissions($this->user); - + if (!$res['success']) return array('local' => array(), 'external' => array()); return array('local' => $res['local'], 'external' => $res['external']); @@ -294,7 +293,6 @@ define('JOBPATH', USERPATH.'jobs/'); else $nodeNew->setAttribute('rank', 999); } } - $Amda->appendChild($nodeNew); } } @@ -608,13 +606,31 @@ define('JOBPATH', USERPATH.'jobs/'); $this->isFirst = true; } - // if new info exists it will be shown to each user + if (file_exists($this->userdir.'newLogin')) { + copy($this->userdir.'newLogin',$this->userdir.'lastLogin'); + $dt = filemtime($this->userdir.'newLogin'); + touch($this->userdir.'lastLogin', $dt); + } + else + touch($this->userdir.'lastLogin', time() - 5*86400); // last 5 days + + // if new info exists it will be shown to : + // public => to all + // special => to group members if (file_exists($this->userdir.'newInfo')) - { - $this->isNewInfo = true; + { + $amdaInfo = new AmdaNews($this->user); + // if status = 0 - it is special info to group members only + // else to all + $info = $this->getUserInfo($this->user); + $status = $amdaInfo->makeInfo($info['group']); + + if ($status) $this->isNewInfo = true; + unlink($this->userdir.'newInfo'); } - + touch($this->userdir.'newLogin'); + $this->setPath(); $this->userMissions = $this->getAvailableMissionsByUser(); diff --git a/php/classes/WebServer.php b/php/classes/WebServer.php index f46ee4b..7300ba4 100644 --- a/php/classes/WebServer.php +++ b/php/classes/WebServer.php @@ -2,9 +2,8 @@ /** * @file WebServer.php * @brief Web services AMDA -* -* -* @version $Id: WebServer.php 2879 2015-04-29 11:47:52Z myriam $ +* +* @version $Id: WebServer.php 2968 2015-06-29 13:17:00Z natacha $ */ class WebResultMgr { @@ -423,9 +422,24 @@ class WebServer $cmd = DDBIN."DD_Plot request.list ".$this->userID." ".$this->IP." ".DDPROJECT." ".DDPROJLIB; $reqMgr = new RequestMgr(); $pid = $reqMgr->background($cmd); - sleep(1); - $plotWSresult=WSRESULT.$ID."/request.list.png"; - return array('success' => true, 'plotFileURL' => 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$plotWSresult)); + + + return array('success' => true, 'plotDirectoryURL' => $ID); + } + + public function getResultPlot($data) { + + $res = $this->init($data); + $vars = $res['vars']; + $ID = $vars["plotDirectoryURL"]; + $filename = WSRESULT.$ID."/request.list.png"; + if (file_exists($filename)) { + $plotWSresult=WSRESULT.$ID."/request.list.png"; + return array('success' => true, 'plotFileURL' => 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$plotWSresult)); + } + else + return array('success' => false); + } @@ -969,3 +983,4 @@ return array('success' => false, 'message' => $message); } ?> + diff --git a/php/old_amda/Parser.php b/php/old_amda/Parser.php index 86e4703..a2dd4d1 100755 --- a/php/old_amda/Parser.php +++ b/php/old_amda/Parser.php @@ -1,6 +1,6 @@ <?php /** @class Parser -* @version $Id: Parser.php 2918 2015-05-19 13:12:09Z elena $ +* @version $Id: Parser.php 2938 2015-06-05 16:23:33Z elena $ * @brief * */ @@ -121,17 +121,18 @@ class Parser { public function replaceConstants($chain) { if ($this->isThereConstant($chain)) { - + $this->dom->load($this->constantsXML); $constants_ = $this->dom->getElementsByTagName("constant"); - - for ($i = 1; $i < $constants_->length; $i++) { + + for ($i = 0; $i < $constants_->length; $i++) { + $constants["@".$constants_->item($i)->getAttribute("name")] = "(".$constants_->item($i)->nodeValue.")"; } $chainReplaced = strtr($chain, $constants); - + return $chainReplaced; } return $chain; diff --git a/public/wsdl/Methods_AMDA.wsdl b/public/wsdl/Methods_AMDA.wsdl index 1e0d852..b092325 100644 --- a/public/wsdl/Methods_AMDA.wsdl +++ b/public/wsdl/Methods_AMDA.wsdl @@ -36,6 +36,9 @@ <xs:element name="getPlot" type="tns:getPlot"/> <xs:element name="getPlotResponse" type="tns:getPlotResponse"/> + <xs:element name="getResultPlot" type="tns:getResultPlot"/> + <xs:element name="getResultPlotResponse" type="tns:getResultPlotResponse"/> + <xs:element name="getOrbites" type="tns:getOrbites"/> <xs:element name="getOrbitesResponse" type="tns:getOrbitesResponse"/> @@ -860,10 +863,35 @@ of a set of typically orthogonal axes. <xs:sequence> <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> <xs:annotation> - <xs:documentation>Url of png plot</xs:documentation> + <xs:documentation>success or not</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="plotFileURL" type="xs:anyURI" minOccurs="1" maxOccurs="1"> + <xs:element name="plotDirectoryURL" type="xs:string" minOccurs="1" maxOccurs="1"> + <xs:annotation> + <xs:documentation>URL of directory of png file</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="getResultPlot"> + <xs:sequence> + <xs:element name="plotDirectoryURL" type="xs:string" minOccurs="1" maxOccurs="1"> + <xs:annotation> + <xs:documentation>URL of directory of png file</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="getResultPlotResponse"> + <xs:sequence> + <xs:element name="success" minOccurs="1" maxOccurs="1" type="xs:boolean"> + <xs:annotation> + <xs:documentation>success=true if plot exists and else false </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="plotFileURL" type="xs:anyURI" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>URL of png file</xs:documentation> </xs:annotation> @@ -1090,6 +1118,14 @@ of a set of typically orthogonal axes. <wsdl:part name="parameters" element="tns:getPlotResponse"> </wsdl:part> </wsdl:message> + <wsdl:message name="getResultPlot"> + <wsdl:part name="parameters" element="tns:getResultPlot"> </wsdl:part> + </wsdl:message> + + <wsdl:message name="getResultPlotResponse"> + <wsdl:part name="parameters" element="tns:getResultPlotResponse"> </wsdl:part> + </wsdl:message> + <wsdl:message name="getOrbites"> <wsdl:part name="parameters" element="tns:getOrbites"> </wsdl:part> @@ -1146,6 +1182,11 @@ of a set of typically orthogonal axes. <wsdl:output message="tns:getPlotResponse"> </wsdl:output> </wsdl:operation> + <wsdl:operation name="getResultPlot"> + <wsdl:input message="tns:getResultPlot"> </wsdl:input> + <wsdl:output message="tns:getResultPlotResponse"> </wsdl:output> + </wsdl:operation> + <wsdl:operation name="getOrbites"> <wsdl:input message="tns:getOrbites"> </wsdl:input> <wsdl:output message="tns:getOrbitesResponse"> </wsdl:output> @@ -1233,6 +1274,16 @@ of a set of typically orthogonal axes. </wsdl:output> </wsdl:operation> + <wsdl:operation name="getResultPlot"> + <soap:operation soapAction="" style="document"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="getOrbites"> <soap:operation soapAction="" style="document"/> <wsdl:input> @@ -1258,7 +1309,7 @@ of a set of typically orthogonal axes. <wsdl:service name="Methods_AMDA"> <wsdl:port name="Methods_AMDAPort" binding="tns:Methods_AMDASoapBinding"> - <soap:address location="http://cdpp1.cesr.fr/AMDA-NG/php/AMDA_METHODS_WSDL.php"/> + <soap:address location="http://apus.cesr.fr/AMDA-TEST/php/AMDA_METHODS_WSDL.php"/> </wsdl:port> </wsdl:service> </wsdl:definitions> -- libgit2 0.21.2