Ignore:
Timestamp:
07/03/12 17:02:35 (12 years ago)
Author:
vmipsl
Message:

Simulations
Process ncdump
Sérialisation jaxb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/web/backoffice/simulation-script.jsp

    r528 r530  
    33var interfaceBODataInsertion = Class.create( { 
    44 
    5     initialize: function( pathSimulationFiles ) 
     5    initialize: function( simulationFiles, simulationDirectories ) 
    66    { 
    77        // Values 
    8         this.files = pathSimulationFiles || null; 
     8        this.files = simulationFiles || null; 
     9        this.directories = simulationDirectories || null; 
    910 
    1011        // Containers 
     
    4142 
    4243        // Bind buttons 
    43 //        $( "#insert" ).bind( 'click', this, jQuery.proxy( this.onClickInsert, this ) ); 
     44        $( "#ncdumpButton" ).bind( 'click', this, jQuery.proxy( this.onClickLaunchNcDump, this ) ); 
    4445//        $( "#cleanLocalisationAndFlagButton" ).bind( 'click', this, jQuery.proxy( this.onClickCleanLocalisationAndFlag, this ) ); 
    4546    }, 
     
    5859    }, 
    5960 
     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    }, 
    6078 
    6179    // HANDLES ******************************************************** 
     
    6785    }, 
    6886 
     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 
    69101    // DISPLAYS ******************************************************** 
    70102    displayFiles: function() 
    71103    { 
     104        this.containerFileList_left.empty(); 
     105        this.containerFileList_right.empty(); 
    72106        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 
    73124        jQuery.each( this.files, jQuery.proxy( function( i, file ) 
    74125        { 
    75             if( (number / 2) > i ) 
    76                 this.containerFileList_left.append( "&nbsp;&nbsp;-&nbsp;" + file + "<BR/>" ); 
    77             else 
    78                 this.containerFileList_right.append( "&nbsp;&nbsp;-&nbsp;" + file + "<BR/>" ); 
     126            this.containerFileList_right.append( "&nbsp;&nbsp;-&nbsp;" + file + "<BR/>" ); 
    79127        }, this ) ); 
    80  
    81128    }, 
    82129 
     
    193240    }, 
    194241 
    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 ); 
    238252    }, 
    239253 
Note: See TracChangeset for help on using the changeset viewer.