Changeset 530 for ether_megapoli/trunk/web
- Timestamp:
- 07/03/12 17:02:35 (12 years ago)
- Location:
- ether_megapoli/trunk/web
- Files:
-
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/web/WEB-INF/megapoli.properties
r528 r530 40 40 41 41 # ParamÚtres pour la simulation 42 directory.simulation=/home_local/ Simulations42 directory.simulation=/home_local/PROJETS/MEGAPOLI/Simulations -
ether_megapoli/trunk/web/backoffice/simulation-script.jsp
r528 r530 3 3 var interfaceBODataInsertion = Class.create( { 4 4 5 initialize: function( pathSimulationFiles )5 initialize: function( simulationFiles, simulationDirectories ) 6 6 { 7 7 // Values 8 this.files = pathSimulationFiles || null; 8 this.files = simulationFiles || null; 9 this.directories = simulationDirectories || null; 9 10 10 11 // Containers … … 41 42 42 43 // Bind buttons 43 // $( "#insert" ).bind( 'click', this, jQuery.proxy( this.onClickInsert, this ) );44 $( "#ncdumpButton" ).bind( 'click', this, jQuery.proxy( this.onClickLaunchNcDump, this ) ); 44 45 // $( "#cleanLocalisationAndFlagButton" ).bind( 'click', this, jQuery.proxy( this.onClickCleanLocalisationAndFlag, this ) ); 45 46 }, … … 58 59 }, 59 60 61 requestLaunchNcDump: function() 62 { 63 $.ajax( { 64 url: "backoffice?methodName=launchNCDumpInSimulationDirectory", 65 success:jQuery.proxy( this.handleLaunchNcDump, this ), 66 error: jQuery.proxy( this.showErrors, [this] ) 67 } ); 68 }, 69 70 requestInsertHeader: function( directoryName ) 71 { 72 $.ajax( { 73 url: "backoffice?methodName=insertHeader&directoryName=" + directoryName, 74 success:jQuery.proxy( this.handleInsertHeader, this ), 75 error: jQuery.proxy( this.showErrors, [this] ) 76 } ); 77 }, 60 78 61 79 // HANDLES ******************************************************** … … 67 85 }, 68 86 87 handleLaunchNcDump: function( result ) 88 { 89 this.files = jQuery.parseJSON( result ).simulationFiles; 90 this.directories = jQuery.parseJSON( result ).simulationDirectories; 91 this.displayFiles(); 92 }, 93 94 handleInsertHeader: function( result ) 95 { 96 // this.files = jQuery.parseJSON( result ).simulationFiles; 97 // this.directories = jQuery.parseJSON( result ).simulationDirectories; 98 // this.displayFiles(); 99 }, 100 69 101 // DISPLAYS ******************************************************** 70 102 displayFiles: function() 71 103 { 104 this.containerFileList_left.empty(); 105 this.containerFileList_right.empty(); 72 106 var number = this.files.length; 107 jQuery.each( this.directories, jQuery.proxy( function( i, directory ) 108 { 109 var divDirectory = $( document.createElement( "div" ) ); 110 var divDirectoryName = $( document.createElement( "div" ) ); 111 divDirectoryName.attr( {style:"float:left"} ); 112 divDirectoryName.html( "- " + directory + " " ); 113 divDirectory.append( divDirectoryName ); 114 115 var button = $( document.createElement( "button" ) ); 116 button.addClass( "small negative" ); 117 button.html( interfaceTexts["bo.simulation.save.header"] ); 118 button.bind( 'click', [this, directory], jQuery.proxy( this.onClickInsertHeader, this ) ); 119 divDirectory.append( button ); 120 121 this.containerFileList_left.append( divDirectory ); 122 }, this ) ); 123 73 124 jQuery.each( this.files, jQuery.proxy( function( i, file ) 74 125 { 75 if( (number / 2) > i ) 76 this.containerFileList_left.append( " - " + file + "<BR/>" ); 77 else 78 this.containerFileList_right.append( " - " + file + "<BR/>" ); 126 this.containerFileList_right.append( " - " + file + "<BR/>" ); 79 127 }, this ) ); 80 81 128 }, 82 129 … … 193 240 }, 194 241 195 onClickRemove: function( dataset ) 196 { 197 this.dataset = dataset; 198 199 this.containerErrors.hide(); 200 this.hideRemove(); 201 this.hideMove(); 202 this.hideInsert(); 203 204 this.displayFilesMove(); 205 206 $( "#categoryNameInsert" ).val( this.dataset.categoryName ); 207 $( "#datasetNameInsert" ).val( this.dataset.name ); 208 209 if( window.confirm( interfaceTexts["bo.dataset.remove.confirm"] + " " + dataset.name + " ?" ) ) 210 this.requestRemoveDataset(); 211 }, 212 213 onClickMove: function() 214 { 215 this.containerErrors.hide(); 216 this.containerResultRemove.addClass( "disable" ); 217 this.hideMove(); 218 this.hideInsert(); 219 this.requestFilesMove(); 220 }, 221 222 onClickInsert: function() 223 { 224 this.containerErrors.hide(); 225 this.containerResultMove.addClass( "disable" ); 226 this.hideInsert(); 227 228 if( "" != $( "#categoryNameInsert" ).val() && "" != $( "#datasetNameInsert" ).val() && "" != $( "#versionInsert" ).val() ) 229 this.requestDatasetInsert(); 230 else 231 this.showErrors( interfaceTexts["bo.dataset.fields"] ); 232 }, 233 234 onClickCleanLocalisationAndFlag: function() 235 { 236 if( window.confirm( interfaceTexts["bo.cleanTables.confirm"] ) ) 237 this.requestCleanLocalisationAndFlag(); 242 onClickLaunchNcDump: function() 243 { 244 this.requestLaunchNcDump(); 245 }, 246 247 onClickInsertHeader: function( parameters ) 248 { 249 var context = parameters.data[0]; 250 var directoryName = parameters.data[1]; 251 this.requestInsertHeader( directoryName ); 238 252 }, 239 253 -
ether_megapoli/trunk/web/backoffice/simulation.jsp
r528 r530 35 35 <div id="fileList_left" style="float:left"></div> 36 36 <div id="fileList_right" style="float:right"></div> 37 38 <div class="containerButtons"> 39 <button id="ncdumpButton" class="small positive" style="float:right"><bean:message key="bo.simulation.launchNcDump"/></button> 40 </div> 37 41 </div> 38 42 … … 106 110 <script type="text/javascript"> 107 111 var interfaceTexts = $A( "" ); 112 interfaceTexts["bo.simulation.save.header"] = '<bean:message key="bo.simulation.save.header"/>'; 108 113 109 new interfaceBODataInsertion( ${ pathSimulationFiles} );114 new interfaceBODataInsertion( ${simulationFiles}, ${simulationDirectories} ); 110 115 </script> 111 116 -
ether_megapoli/trunk/web/resources/css/backoffice.css
r520 r530 86 86 margin-right: 11px; 87 87 } 88 89 #fileList_left, #fileList_right { 90 margin: 0 40px; 91 } -
ether_megapoli/trunk/web/resources/css/megapoli.css
r528 r530 244 244 width: 950px; 245 245 margin-bottom: 10px; 246 } 247 248 .containerButtons { 249 float: right; 250 width: 800px; 251 margin-top: 12px; 246 252 } 247 253 -
ether_megapoli/trunk/web/src/ApplicationResources_en.properties
r528 r530 658 658 bo.simulation.database=Simulations in database 659 659 bo.simulation.list=List of simulations 660 bo.simulation.launchNcDump=Launch ncdump 661 bo.simulation.save.header=Save header in database -
ether_megapoli/trunk/web/src/com/ether/ControllerBackoffice.java
r528 r530 86 86 final JSONObject jsonObject = new JSONObject(); 87 87 final String pathSimulation = getProperty( "directory.simulation" ); 88 final File directory = new File( pathSimulation ); 88 89 final List<String> files = EtherHelper.getOnlyFileNames( pathSimulation, ".nc" ); 90 final List<String> directories = EtherHelper.getOnlyDirectorieNames( pathSimulation ); 89 91 jsonObject.put( "pathSimulation", pathSimulation ); 90 jsonObject.put( "pathSimulationFiles", directory.list() ); 92 jsonObject.put( "simulationFiles", files ); 93 jsonObject.put( "simulationDirectories", directories ); 91 94 return jsonObject; 92 95 } … … 94 97 /** *********************************************************** **/ 95 98 /** *********************** CALLS ***************************** **/ 99 /** *********************************************************** **/ 100 101 /** *********************************************************** **/ 102 /** *********************** USERS ***************************** **/ 96 103 /** *********************************************************** **/ 97 104 /** … … 293 300 } 294 301 302 /** *********************************************************** **/ 303 /** *********************** MCO ******************************* **/ 304 /** *********************************************************** **/ 295 305 /** 296 306 * This method sorts the MCO's requests … … 441 451 442 452 453 /** *********************************************************** **/ 454 /** *********************** DATASETS ************************** **/ 455 /** *********************************************************** **/ 443 456 /** 444 457 * This method sorts the datasets … … 568 581 // } 569 582 583 /** *********************************************************** **/ 584 /** *********************** SIMULATIONS *********************** **/ 585 /** *********************************************************** **/ 586 /** 587 * @return 588 * @throws WebException 589 */ 590 @ControllerMethod(jsonResult = true) 591 public JSONObject launchNCDumpInSimulationDirectory() 592 throws WebException 593 { 594 final JSONObject jsonObject = new JSONObject(); 595 try 596 { 597 final String pathSimulation = getProperty( "directory.simulation" ); 598 getEtherService().launchNCDumpInSimulationDirectory( pathSimulation ); 599 600 final List<String> files = EtherHelper.getOnlyFileNames( pathSimulation, ".nc" ); 601 final List<String> directories = EtherHelper.getOnlyDirectorieNames( pathSimulation ); 602 jsonObject.put( "simulationFiles", files ); 603 jsonObject.put( "simulationDirectories", directories ); 604 } 605 catch( ServiceException e ) 606 { 607 throw new WebException( WebException.WebCode.ERROR_PROCESS_SIMULATION_NCDUMP, e ); 608 } 609 return jsonObject; 610 } 611 612 @ControllerMethod(jsonResult = true) 613 public JSONObject insertHeader( @NotNull @ParamName(ParameterConstants.PARAMETER_DIRECTORY_NAME) final String directoryName ) 614 throws WebException 615 { 616 final JSONObject jsonObject = new JSONObject(); 617 try 618 { 619 final String pathSimulation = getProperty( "directory.simulation" ); 620 getEtherService().insertHeader( pathSimulation, directoryName ); 621 } 622 catch( ServiceException e ) 623 { 624 throw new WebException( WebException.WebCode.ERROR_INSERT_HEADER, e ); 625 } 626 return jsonObject; 627 } 628 629 /** *********************************************************** **/ 630 /** ************************ PRIVATES ************************* **/ 631 /** *********************************************************** **/ 570 632 /** 571 633 * This method create and send an email to the user to inform of the administrator decision -
ether_megapoli/trunk/web/src/com/ether/WebException.java
r520 r530 59 59 DOWNLOAD_DIRECTORY_DOESNOT_EXISTS, 60 60 ERROR_NO_CLEAN_LOCALISATION_AND_FLAG, 61 ERROR_TO_READ_FILE_PROPERTIES 61 ERROR_TO_READ_FILE_PROPERTIES, 62 ERROR_PROCESS_SIMULATION_NCDUMP, 63 ERROR_INSERT_HEADER 62 64 } 63 65 -
ether_megapoli/trunk/web/visualization/visu_simulation.jsp
r528 r530 10 10 11 11 <tiles:put name="insertCss" type="string"> 12 <ether:htmlCss cssFile="blueprint-css/blueprint/src/grid"/>13 <ether:htmlCss cssFile="visu_parameter_by_pf"/>14 12 <ether:htmlCss cssFile="select"/> 15 13 <ether:htmlCss cssFile="calendar/anytime"/> … … 20 18 <ether:htmlJs jsFile="classesForJQuery/etherClasses"/> 21 19 <ether:htmlJs jsFile="classesForJQuery/megapoliClasses"/> 22 <ether:htmlJsp jspFile="visu_parameter_by_pf-script"/> 23 <ether:htmlJs jsFile="classesForJQuery/Select"/> 20 <ether:htmlJsp jspFile="visu_simulation-script"/> 24 21 <ether:htmlJs jsFile="classesForJQuery/Loading"/> 25 22 <ether:htmlJs jsFile="calendar/anytime"/>
Note: See TracChangeset
for help on using the changeset viewer.