Changeset 217 for ether_megapoli


Ignore:
Timestamp:
10/04/11 17:50:31 (13 years ago)
Author:
vmipsl
Message:

download with popup

Location:
ether_megapoli/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/common/implementation/com/ether/ParameterConstants.java

    r213 r217  
    33public abstract class ParameterConstants 
    44{ 
     5    public static final String PARAMETER_RESULT = "result"; 
     6    public static final String PARAMETER_OK = "ok"; 
     7    public static final String PARAMETER_NOT_OK = "nok"; 
    58    public static final String PARAMETER_ID = "id"; 
    69    public static final String PARAMETER_DATE = "date"; 
  • ether_megapoli/trunk/web/src/ApplicationResources.properties

    r213 r217  
    478478data.visualization.axeType.2DPoints=2D (points) 
    479479data.authentification.text=Veuillez vous identifier en cliquant sur 'Acc\u00E8s aux donn\u00E9es' afin d'acc\u00E9der aux zones prot\u00E9g\u00E9es de ce site. 
     480data.access.extract.process.short=L'extraction des donn\u00E9es est en cours...<br/>Vous allez recevoir un e-mail pour r\u00E9cup\u00E9rer le(s) fichier(s) g\u00E9n\u00E9r\u00E9s. 
     481data.access.extract.process.error=Erreur de t\u00E9l\u00E9chargement. <BR>Veuillez essayer de corriger les erreurs suivantes ou contacter l'administrateur en indiquant les erreurs rencontr\u00E9es. 
    480482 
    481483simulation.visualization=Des simulations 
  • ether_megapoli/trunk/web/src/ApplicationResources_en.properties

    r213 r217  
    478478 
    479479data.authentification.text=Please login by click on 'Access to data' to access the protected areas of this website. 
     480data.access.extract.process.short=The downloading is in progress. You will receive an e-mail to get back the generated data file(s). 
     481data.access.extract.process.error=Download error. <BR>Please try to correct the following errors or contact the administrator with the detected errors. 
    480482 
    481483simulation.visualization=Simulations 
  • ether_megapoli/trunk/web/src/com/ether/Controller.java

    r216 r217  
    7373    } 
    7474 
    75     @ControllerMethod(view = VIEW_DOWNLOAD_OK, loginMandatory = true) 
    76     public Map<String, Object> downloadData( @ParamName(ParameterConstants.PARAMETER_DATE_BEGIN) final String dateBegin, 
    77                                              @ParamName(ParameterConstants.PARAMETER_DATE_END) final String dateEnd, 
    78                                              @ParamName(ParameterConstants.PARAMETER_PFID_PID_LIST) final String pIdPIdArrayString, 
    79                                              @NotNull final Personne personne ) 
     75    /** *********************************************************** **/ 
     76    /** *********************** CALLS ***************************** **/ 
     77    /** 
     78     * ********************************************************** * 
     79     */ 
     80    @ControllerMethod(jsonResult = true) 
     81    public JSONObject searchParametersByPlateform( @Mandatory @ParamName(ParameterConstants.PARAMETER_ID) final Integer plateformId ) 
     82            throws ServiceException, EtherException 
     83    { 
     84        final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 
     85 
     86        final JSONObject result = new JSONObject(); 
     87        result.put( ParameterConstants.PARAMETER_PARAMETERS, getJsonHelper().toJSON( parametersByPlateform ) ); 
     88        return result; 
     89    } 
     90 
     91 
     92    @ControllerMethod(jsonResult = true, loginMandatory = true) 
     93    public JSONObject downloadData( @ParamName(ParameterConstants.PARAMETER_DATE_BEGIN) final String dateBegin, 
     94                                    @ParamName(ParameterConstants.PARAMETER_DATE_END) final String dateEnd, 
     95                                    @ParamName(ParameterConstants.PARAMETER_PFID_PID_LIST) final String pIdPIdArrayString, 
     96                                    @NotNull final Personne personne ) 
    8097            throws ServiceException, WebException 
    8198    { 
     99        final JSONObject result = new JSONObject(); 
     100 
    82101        final List<Pair<String, String>> pfIdPIdList = EtherHelper.extractpfIdPIdListFromString( pIdPIdArrayString, String.class, String.class ); 
    83102        if( null == pfIdPIdList ) 
     
    121140        catch( Exception e ) 
    122141        { 
    123             e.printStackTrace(); 
    124         } 
    125  
    126         return new HashMap<String, Object>(); 
    127     } 
    128  
    129     /** *********************************************************** **/ 
    130     /** *********************** CALLS ***************************** **/ 
    131     /** 
    132      * ********************************************************** * 
    133      */ 
    134     @ControllerMethod(jsonResult = true) 
    135     public JSONObject searchParametersByPlateform( @Mandatory @ParamName(ParameterConstants.PARAMETER_ID) final Integer plateformId ) 
    136             throws ServiceException, EtherException 
    137     { 
    138         final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 
    139  
    140         final JSONObject result = new JSONObject(); 
    141         result.put( ParameterConstants.PARAMETER_PARAMETERS, getJsonHelper().toJSON( parametersByPlateform ) ); 
     142            result.put( ParameterConstants.PARAMETER_RESULT, ParameterConstants.PARAMETER_NOT_OK ); 
     143            return result; 
     144        } 
     145 
     146        result.put( ParameterConstants.PARAMETER_RESULT, ParameterConstants.PARAMETER_OK ); 
    142147        return result; 
    143148    } 
     
    196201        dataForm.setListeCoords( dataForm.getLatMin() + "," + dataForm.getLatMax() + "," + dataForm.getLonMin() + "," + dataForm.getLonMax() ); 
    197202        dataForm.setListeDates( dataForm.getDateDeb() + "," + dataForm.getDateFin() ); 
     203        dataForm.setOutput( FORMAT_DEFAULT ); 
     204        dataForm.setCompression( COMPRESSION_DEFAULT ); 
    198205 
    199206        return dataForm; 
  • ether_megapoli/trunk/web/visualization/visu_parameter_by_pf-script.jsp

    r213 r217  
    127127    }, 
    128128 
     129    requestDownload: function() 
     130    { 
     131        var urlObject = this.createUrl(); 
     132        new Ajax.Request( "?methodName=downloadData&" + urlObject.parameters, 
     133        { 
     134            onSuccess:this.handleDownload.bind( this ) 
     135        } ); 
     136    }, 
     137 
    129138    // HANDLES ******************************************************** 
    130139    handleParametersBySelectedPlateform: function( result ) 
     
    132141        this.jsonParameters = result.responseText.evalJSON().parameters; 
    133142        this.displayParameters(); 
     143    }, 
     144 
     145    handleDownload: function( result ) 
     146    { 
     147        var stateResult = result.responseText.evalJSON().result; 
     148 
     149        var downloadWindow = new Window( {className: "dialog", zIndex: 100, resizable: true, draggable:true, wiredDrag: true, showEffect:Effect.BlindDown, hideEffect: Effect.SwitchOff } ); 
     150        downloadWindow.setTitle( interfaceTexts["data.access.extract3"] ); 
     151        if( stateResult == "ok" ) 
     152        { 
     153            downloadWindow.getContent().innerHTML = '<div class="textExamplesTD">' + interfaceTexts["data.access.extract.process.short"] + '</div>'; 
     154            downloadWindow.setSize( 350, 50 ); 
     155        } 
     156        else 
     157        { 
     158            downloadWindow.getContent().innerHTML = '<div class="textExamplesTD">' + interfaceTexts["data.access.extract.process.error"] + '</div>'; 
     159            downloadWindow.setSize( 350, 60 ); 
     160        } 
     161        downloadWindow.show(); 
    134162    }, 
    135163 
     
    310338        } 
    311339        else 
    312         { 
    313             var urlObject = this.createUrl(); 
    314             window.location.href = "?methodName=downloadData&" + urlObject.parameters; 
    315         } 
     340            this.requestDownload(); 
    316341    }, 
    317342 
  • ether_megapoli/trunk/web/visualization/visu_parameter_by_pf.jsp

    r213 r217  
    9797                    <div id="containerOptionPlotsSelect" class="span-10"></div> 
    9898                    <div id="containerOptionPlotsButtons" class="span-10"> 
    99                         <img src="/megapoli/resources/icons/help.gif" id="toolTipPlots" height="19px" width="17px" class="toolTipPlots" onclick="javascript:onClickHelp();"> 
    100                    </div> 
     99                        <img src="/megapoli/resources/icons/help.gif" id="toolTipPlots" height="19px" width="17px" 
     100                             class="toolTipPlots" onclick="javascript:onClickHelp();"> 
     101                    </div> 
    101102                </div> 
    102103 
     
    143144            interfaceTexts["data.authentification.text"] = "<bean:message key="data.authentification.text"/>"; 
    144145 
     146            interfaceTexts["data.access.extract3"] = "<bean:message key="data.access.extract3"/>"; 
     147            interfaceTexts["data.access.extract.process.short"] = "<bean:message key="data.access.extract.process.short"/>"; 
     148            interfaceTexts["data.access.extract.process.error"] = "<bean:message key="data.access.extract.process.error"/>"; 
     149 
    145150            var interfaceVisualization = new InterfaceVisualization( ${plateforms}, ${axeTypesForFixedPlateforms}, ${axeTypesForMobilePlateforms} ); 
    146151        </script> 
Note: See TracChangeset for help on using the changeset viewer.