Changeset 475


Ignore:
Timestamp:
04/12/12 16:56:04 (12 years ago)
Author:
vmipsl
Message:

BO insertion données _ move files

Location:
ether_megapoli/trunk
Files:
12 edited

Legend:

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

    r279 r475  
    66 
    77import java.io.BufferedWriter; 
     8import java.io.File; 
    89import java.io.FileWriter; 
    910import java.io.IOException; 
     
    1213import java.security.NoSuchAlgorithmException; 
    1314import java.util.ArrayList; 
     15import java.util.Calendar; 
    1416import java.util.List; 
    1517import java.util.Random; 
     
    196198    } 
    197199 
     200 
     201    /** 
     202     * This method move all files from fromDirectory to toDirectory 
     203     * The toDirectory DOESN'T MUST exist ! 
     204     * (otherwise it is renamed with date) 
     205     * 
     206     * @param fromDirectory 
     207     * @param toDirectory 
     208     * @return 
     209     */ 
     210    public static boolean moveFiles( @NotNull final String fromDirectory, @NotNull final String toDirectory ) 
     211    { 
     212        final File fromDirectoryFiles = new File( fromDirectory ); 
     213        final File toDirectoryFiles = new File( toDirectory ); 
     214 
     215        if( toDirectoryFiles.exists() ) 
     216            toDirectoryFiles.renameTo( new File( toDirectory + "_" + Calendar.getInstance().getTimeInMillis() ) ); 
     217 
     218        return fromDirectoryFiles.renameTo( toDirectoryFiles ); 
     219    } 
     220 
    198221} 
  • ether_megapoli/trunk/common/implementation/com/medias/Context.java

    r282 r475  
    9696 
    9797    /** 
     98     * This method returns from the servletContext the property initialized during the init() of MegapoliInitialisation.java 
     99     * 
     100     * @param request 
     101     * @param property 
     102     * @return 
     103     */ 
     104    public static String getProperty( @NotNull final HttpServletRequest request, @NotNull final String property ) 
     105    { 
     106        return (String) request.getSession().getServletContext().getAttribute( property ); 
     107    } 
     108 
     109    /** 
    98110     * Permet de définir le nom de la racine à partir de laquelle les paths sont calculés. 
    99111     * 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherServiceImpl.java

    r474 r475  
    2525import org.springframework.transaction.annotation.Transactional; 
    2626 
     27import java.io.File; 
    2728import java.util.ArrayList; 
    2829import java.util.Date; 
     
    505506    @Nullable 
    506507    @Transactional(readOnly = true) 
    507     public PaginatedResult<Jeu> searchDatasets( @NotNull final JeuFilter filter ) 
     508    public PaginatedResult<Jeu> searchJeux( @NotNull final JeuFilter filter ) 
    508509            throws ServiceException 
    509510    { 
     
    514515        catch( PersistenceException e ) 
    515516        { 
    516             throw new ServiceException( ServiceException.ServiceCode.DATASET_NOT_FOUND, e ); 
    517         } 
     517            throw new ServiceException( ServiceException.ServiceCode.JEU_NOT_FOUND, e ); 
     518        } 
     519    } 
     520 
     521    @Transactional(rollbackFor = Exception.class) 
     522    public void removeJeuById( @NotNull final Integer jeuId ) 
     523            throws ServiceException 
     524    { 
     525        // TODO lancer moulinette à VP 
     526        final String bob = "bib"; 
     527//        try 
     528//        { 
     529//            _jeuDAO.deleteByPrimaryKey( jeuId ); 
     530//        } 
     531//        catch( PersistenceException e ) 
     532//        { 
     533//            throw new ServiceException( ServiceException.ServiceCode.PERSISTENCE, e ); 
     534//        } 
     535    } 
     536 
     537    @Nullable 
     538    @Transactional(readOnly = true) 
     539    public Jeu getJeuById( @NotNull final Integer jeuId ) 
     540            throws ServiceException 
     541    { 
     542        try 
     543        { 
     544            return _jeuDAO.selectByPrimaryKey( jeuId ); 
     545        } 
     546        catch( PersistenceException e ) 
     547        { 
     548            throw new ServiceException( ServiceException.ServiceCode.JEU_NOT_FOUND, e ); 
     549        } 
     550    } 
     551 
     552    /** 
     553     * This method moves all dataset's files from download directory to upload directory 
     554     * 
     555     * @param jeu 
     556     * @param downloadDirectory 
     557     * @param uploadDirectory 
     558     */ 
     559    public void moveFilesFromDownloadToUpload( @NotNull final Jeu jeu, @NotNull final String downloadDirectory, @NotNull final String uploadDirectory ) 
     560            throws ServiceException 
     561    { 
     562        if( null == jeu.getCategorie() || null == jeu.getCategorie().getCategorieNom() ) 
     563            throw new ServiceException( ServiceException.ServiceCode.JEU_NOT_CORRECT, "ERROR to move jeu to download directory to upload directory" + jeu ); 
     564 
     565        final String downloadFilesPath = downloadDirectory + File.separatorChar + jeu.getCategorie().getCategorieNom() + File.separatorChar + jeu.getJeuNom(); 
     566        final String uploadFilesPath = uploadDirectory + File.separatorChar + jeu.getCategorie().getCategorieNom() + File.separatorChar + jeu.getJeuNom(); 
     567 
     568        final boolean success = EtherHelper.moveFiles( downloadFilesPath, uploadFilesPath ); 
     569        if( !success ) 
     570        { 
     571            // File was not successfully moved 
     572        } 
     573        final String bob = "bib"; 
    518574    } 
    519575 
  • ether_megapoli/trunk/service/interface/com/ether/EtherService.java

    r474 r475  
    135135            throws ServiceException; 
    136136 
    137     PaginatedResult<Jeu> searchDatasets( @NotNull final JeuFilter filter ) 
     137    PaginatedResult<Jeu> searchJeux( @NotNull final JeuFilter filter ) 
     138            throws ServiceException; 
     139 
     140    void removeJeuById( @NotNull final Integer jeuId ) 
     141            throws ServiceException; 
     142 
     143    Jeu getJeuById( @NotNull final Integer jeuId ) 
     144            throws ServiceException; 
     145 
     146    void moveFilesFromDownloadToUpload( @NotNull final Jeu jeu, @NotNull final String downloadDirectory, @NotNull final String uploadDirectory ) 
    138147            throws ServiceException; 
    139148} 
  • ether_megapoli/trunk/service/interface/com/ether/ServiceException.java

    r473 r475  
    2020    } 
    2121 
     22    public ServiceException( final Enum<? extends Code> code, final String message ) 
     23    { 
     24        super( code, message ); 
     25    } 
     26 
    2227    public static enum ServiceCode 
    2328            implements Code 
     
    3843        PERSON_NOT_FOUND, 
    3944        REQUEST_NOT_FOUND, 
    40         DATASET_NOT_FOUND 
     45        JEU_NOT_FOUND, 
     46        JEU_NOT_CORRECT 
    4147    } 
    4248} 
  • ether_megapoli/trunk/web/backoffice/dataInsertion-script.jsp

    r474 r475  
     1<%@ page import="com.medias.Context" %> 
     2<%@ page import="java.io.File" %> 
    13<script type="text/javascript"> 
    2 var interfaceBOMco = Class.create( { 
    3  
    4     initialize: function( requestNumber, jSonRequests, jSonRequestStates, jSonRequestTypes ) 
     4var interfaceBODataInsertion = Class.create( { 
     5 
     6    initialize: function( datasetNumber, jSonDatasets ) 
    57    { 
    68        // Values 
    7         this.jSonRequests = jSonRequests || null; 
    8         this.jSonRequestStates = jSonRequestStates || null; 
    9         this.jSonRequestTypes = jSonRequestTypes || null; 
    10         this.request = false; 
    11         this.nbRequests = requestNumber || false; 
     9        this.jSonDatasets = jSonDatasets || null; 
     10        this.dataset = false; 
     11        this.nbDatasets = datasetNumber || false; 
     12        this.downloadDirectory = '<%=Context.getProperty(request, "accessDir")%>'; 
     13        this.uploadDirectory = '<%=Context.getProperty(request, "uploadDir")%>'; 
    1214 
    1315        // Containers 
    14         this.generalContainerRequests = $( "#generalContainerRequests" ); 
    15         this.containerRequests = $( "#containerRequests" ); 
    16         this.containerAddOrModifyTitle = $( "#addOrModifyTitle" ); 
     16        this.generalContainerDatasets = $( "#generalContainerDatasets" ); 
     17        this.containerDatasets = $( "#containerDataSets" ); 
    1718        this.containerErrors = $( "#errors" ); 
    18         this.containerRequestsNumber = $( "#nbResults" ); 
     19        this.containerDatasetsNumber = $( "#nbResults" ); 
     20        this.containerFilesMove = $( "#containerFilesMove" ); 
     21        this.containerResultFilesMove = $( "#resultFilesMove" ); 
    1922 
    2023        this.containerSorts = $( "#containerSorts" ); 
    21         this.containerSortsStates = $( "#containerSorts_states" ); 
    22         this.containerSortsTypes = $( "#containerSorts_types" ); 
    2324        this.containerSortsDisplay = $( "#containerSorts_display" ); 
    2425        this.containerPage = $( "#page" ); 
     
    2829        // Create loading object for users 
    2930        var param = new Object(); 
    30         param.id = "loadingForRequest"; 
    31         param.parent = this.generalContainerRequests; 
    32         this.loadingRequest = new Loading( param ); 
    33         this.loadingRequest.display(); 
     31        param.id = "loadingForDataset"; 
     32        param.parent = this.generalContainerDatasets; 
     33        this.loadingDataset = new Loading( param ); 
     34        this.loadingDataset.display(); 
    3435 
    3536        this.containerErrors.hide(); 
    36         this.updateAddRequestButtonAndTitle(); 
    3737        this.displaySorts(); 
    38         this.managePartAddOrModify(); 
    3938        this.managePagination(); 
    40         this.displayRequests(); 
     39        this.displayDatasets(); 
    4140    }, 
    4241 
    4342    // REQUESTS ******************************************************** 
    44     requestAddRequest: function() 
    45     { 
    46         if( !this.verifyFields() ) 
    47         { 
    48             var parametersUrl = "code=" + stripVowelAccent( $( "#code" ).val() ) + "&email=" + $( "#email" ).val() + "&state=" + this.selectStates.getValue() + "&type=" + this.selectTypes.getValue() + 
    49                     "&title=" + stripVowelAccent( $( "#titleRequest" ).val() ) + "&informations=" + stripVowelAccent( $( "#informations" ).val() ); 
    50             var request = $.ajax( { 
    51                 url: "backoffice?methodName=addRequest&" + parametersUrl, 
    52                 success:jQuery.proxy( this.handleRequest, this ), 
    53                 error: jQuery.proxy( this.showErrors, [this] ) 
    54             } ); 
    55         } 
    56     }, 
    57  
    58     requestCloseRequest: function() 
    59     { 
    60         if( this.request ) 
     43    requestRemoveRequest: function() 
     44    { 
     45        if( this.dataset ) 
    6146            $.ajax( { 
    62                 url: "backoffice?methodName=closeRequest&id=" + this.request.id, 
     47                url: "backoffice?methodName=removeJeu&id=" + this.dataset.id, 
    6348                success:jQuery.proxy( this.handleRequest, this ) 
    6449            } ); 
    6550    }, 
    6651 
    67     requestRemoveRequest: function() 
    68     { 
    69         if( this.request ) 
    70             $.ajax( { 
    71                 url: "backoffice?methodName=removeRequest&id=" + this.request.id, 
    72                 success:jQuery.proxy( this.handleRequest, this ) 
    73             } ); 
    74     }, 
    75  
    76     requestModifyRequest: function() 
    77     { 
    78         if( this.request && !this.verifyFields() ) 
    79         { 
    80             var parametersUrl = "id=" + this.request.id + "&code=" + stripVowelAccent( $( "#code" ).val() ) + "&email=" + $( "#email" ).val() + 
    81                     "&type=" + this.selectTypes.getValue() + "&state=" + this.selectStates.getValue() + "&title=" + stripVowelAccent( $( "#titleRequest" ).val() ) + "&informations=" + stripVowelAccent( $( "#informations" ).val() ); 
    82             $.ajax( { 
    83                 url: "backoffice?methodName=modifyRequest&" + parametersUrl, 
    84                 success:jQuery.proxy( this.handleRequest, this ), 
    85                 error: jQuery.proxy( this.showErrors, [this] ) 
    86             } ); 
    87         } 
    88     }, 
    89  
    90     requestSortRequest: function() 
    91     { 
    92         var parametersUrl = "sort=" + this.selectSorts.getValue() + "&sortState=" + this.selectSortsStates.getValue() + "&sortType=" + this.selectSortsTypes.getValue() + 
     52    requestSortDataset: function() 
     53    { 
     54        var parametersUrl = "sort=" + this.selectSorts.getValue() + 
    9355                "&searchText=" + $( "#search_text" ).val() + 
    9456                "&maxResults=" + this.selectSortsDisplay.getValue() + "&page=" + this.containerPage.html(); 
    9557        var request = $.ajax( { 
    96             url: "backoffice?methodName=sortRequest&" + parametersUrl, 
     58            url: "backoffice?methodName=sortJeu&" + parametersUrl, 
    9759            success:jQuery.proxy( this.handleSortRequest, this ), 
    9860            error: jQuery.proxy( this.showErrors, [this] ) 
     
    10062    }, 
    10163 
     64    requestFilesMove: function() 
     65    { 
     66        if( this.dataset ) 
     67            $.ajax( { 
     68                url: "backoffice?methodName=moveJeu&id=" + this.dataset.id, 
     69                success:jQuery.proxy( this.handleFilesMove, this ) 
     70            } ); 
     71    }, 
     72 
    10273    // HANDLES ******************************************************** 
    10374    handleRequest: function() 
    10475    { 
    105         this.requestSortRequest(); 
     76        this.requestSortDataset(); 
    10677    }, 
    10778 
    10879    handleSortRequest: function( result ) 
    10980    { 
    110         this.jSonRequests = jQuery.parseJSON( result ).jSonRequests; 
    111         this.nbRequests = jQuery.parseJSON( result ).requestNumber; 
    112         this.displayRequests(); 
    113         this.clearAddOrModifyRequestFields(); 
    114         this.updateAddRequestButtonAndTitle(); 
     81        this.jSonDatasets = jQuery.parseJSON( result ).jSonDatasets; 
     82        this.nbDatasets = jQuery.parseJSON( result ).datasetNumber; 
     83        this.displayDatasets(); 
     84        this.displayFilesMove(); 
     85    }, 
     86 
     87    handleFilesMove: function( result ) 
     88    { 
     89        this.containerResultFilesMove.html( "OK" ); 
    11590    }, 
    11691 
    11792    // DISPLAYS ******************************************************** 
    118     displayTRForRequest: function( request ) 
     93    displayTRForDataset: function( dataset ) 
    11994    { 
    12095        var tr = $( document.createElement( "tr" ) ); 
    12196        var tdId = $( document.createElement( "td" ) ); 
    122         tdId.html( request.id ); 
     97        tdId.html( dataset.id ); 
    12398        tr.append( tdId ); 
    124         var tdType = $( document.createElement( "td" ) ); 
    125         tdType.html( interfaceTexts[request.type] ); 
    126         tr.append( tdType ); 
    127         var tdCode = $( document.createElement( "td" ) ); 
    128         tdCode.html( request.code ); 
    129         tr.append( tdCode ); 
     99        var tdName = $( document.createElement( "td" ) ); 
     100        tdName.html( dataset.name ); 
     101        tr.append( tdName ); 
    130102        var tdCreationDate = $( document.createElement( "td" ) ); 
    131         tdCreationDate.html( formatDate( new Date( request.creationDate.time ) ) ); 
     103        tdCreationDate.html( formatDate( new Date( dataset.creationDate.time ) ) ); 
    132104        tr.append( tdCreationDate ); 
    133         var tdEmail = $( document.createElement( "td" ) ); 
    134         tdEmail.html( request.emailUser ); 
    135         tr.append( tdEmail ); 
    136         var tdState = $( document.createElement( "td" ) ); 
    137         tdState.html( interfaceTexts[request.state] ); 
    138         tr.append( tdState ); 
    139         var tdClosingDate = $( document.createElement( "td" ) ); 
    140 //        if( request.closingDate ) 
    141 //            tdClosingDate.html( formatDate( new Date( request.closingDate.time ) ) ); 
    142 //        tr.append( tdClosingDate ); 
    143105        return tr; 
    144106    }, 
    145107 
    146     displayRequests: function() 
    147     { 
    148         this.containerRequests.empty(); 
    149  
    150         if( this.jSonRequests && 0 < this.jSonRequests.length ) 
     108    displayDatasets: function() 
     109    { 
     110        this.containerDatasets.empty(); 
     111 
     112        if( this.jSonDatasets && 0 < this.jSonDatasets.length ) 
    151113        { 
    152             jQuery.each( this.jSonRequests, jQuery.proxy( function( i, request ) 
     114            jQuery.each( this.jSonDatasets, jQuery.proxy( function( i, request ) 
    153115            { 
    154                 var tr = this.displayTRForRequest( request ); 
     116                var tr = this.displayTRForDataset( request ); 
    155117 
    156118                // Buttons 
    157                 var tdModify = $( document.createElement( "td" ) ); 
    158                 new Button( {value:interfaceTexts["bo.modify"], parent:tdModify, id:"button_modify", className: "small positive action_button", contextToSave: request, onClick:jQuery.proxy( this.onClickModify, this )} ); 
    159                 tr.append( tdModify ); 
    160  
    161                 var tdClose = $( document.createElement( "td" ) ); 
    162                 new Button( {value:interfaceTexts["bo.close"], parent:tdClose, id:"button_close", className: "small action_button", contextToSave: request, onClick:jQuery.proxy( this.onClickClose, this )} ); 
    163                 tr.append( tdClose ); 
    164  
    165119                var tdRemove = $( document.createElement( "td" ) ); 
    166120                new Button( {value:interfaceTexts["bo.remove"], parent:tdRemove, id:"button_remove", className: "small negative action_button", contextToSave: request, onClick:jQuery.proxy( this.onClickRemove, this )} ); 
    167121                tr.append( tdRemove ); 
    168122 
    169                 this.containerRequests.append( tr ); 
     123                this.containerDatasets.append( tr ); 
    170124 
    171125            }, this ) ); 
     
    175129            var tr = $( document.createElement( "tr" ) ); 
    176130            var td = $( document.createElement( "td" ) ); 
    177             td.attr( {colspan:"11"} ); 
    178             td.html( "<center><BR/>" + interfaceTexts["bo.noRequest"] + "<BR/><BR/></center>" ); 
     131            td.attr( {colspan:"4"} ); 
     132            td.html( "<center><BR/>" + interfaceTexts["bo.noDataset"] + "<BR/><BR/></center>" ); 
    179133            tr.append( td ); 
    180             this.containerRequests.append( tr ); 
     134            this.containerDatasets.append( tr ); 
    181135        } 
    182136 
    183137        // Update number of users and max pages 
    184         this.containerRequestsNumber.html( this.nbRequests ); 
    185         this.containerMaxPage.html( Math.ceil( this.nbRequests / this.selectSortsDisplay.getValue() ) ); 
    186         this.loadingRequest.hide(); 
     138        this.containerDatasetsNumber.html( this.nbDatasets ); 
     139        this.containerMaxPage.html( Math.ceil( this.nbDatasets / this.selectSortsDisplay.getValue() ) ); 
     140        this.loadingDataset.hide(); 
    187141    }, 
    188142 
     
    195149        this.selectSorts = new Select( paramSelect ); 
    196150        this.selectSorts.add( "jeuId", interfaceTexts["bo.id"] ); 
     151        this.selectSorts.add( "jeuNom", interfaceTexts["bo.name"] ); 
    197152        this.selectSorts.add( "jeuDateinser", interfaceTexts["bo.user.creationDate"] ); 
    198153        this.selectSorts.selectFirst( false ); 
    199  
    200         // Sort by state 
    201         var paramSelect = new Object(); 
    202         paramSelect.id = "select_sorts_states"; 
    203         paramSelect.parent = this.containerSortsStates; 
    204         this.selectSortsStates = new Select( paramSelect ); 
    205         this.selectSortsStates.add( "ALL", interfaceTexts["bo.all"] ); 
    206         jQuery.each( this.jSonRequestStates, jQuery.proxy( function ( i, jSonRequestState ) 
    207         { 
    208             this.selectSortsStates.add( jSonRequestState.value, interfaceTexts[jSonRequestState.text] ); 
    209         }, this ) ); 
    210         this.selectSortsStates.selectFirst( false ); 
    211  
    212         // Sort by type 
    213         var paramSelect = new Object(); 
    214         paramSelect.id = "select_sorts_types"; 
    215         paramSelect.parent = this.containerSortsTypes; 
    216         this.selectSortsTypes = new Select( paramSelect ); 
    217         this.selectSortsTypes.add( "ALL", interfaceTexts["bo.all"] ); 
    218         jQuery.each( this.jSonRequestTypes, jQuery.proxy( function ( i, jSonRequestType ) 
    219         { 
    220             this.selectSortsTypes.add( jSonRequestType.value, interfaceTexts[jSonRequestType.text] ); 
    221         }, this ) ); 
    222         this.selectSortsTypes.selectFirst( false ); 
    223154 
    224155        // Number of displays 
     
    237168    }, 
    238169 
     170    displayFilesMove: function() 
     171    { 
     172        if( this.dataset && this.dataset.categoryName ) 
     173        { 
     174            this.containerFilesMove.html( "MOVE <span style='color:#FBE3E4'>" + this.downloadDirectory + "<%=File.separatorChar%>" + this.dataset.categoryName + "<%=File.separatorChar%>" + this.dataset.name + "<%=File.separatorChar%>* </span> <BR/>" + 
     175                    "TO &nbsp;&nbsp;&nbsp;&nbsp; <span style='color:#FBE3E4'>" + this.uploadDirectory + "<%=File.separatorChar%>" + this.dataset.categoryName + "<%=File.separatorChar%>" + this.dataset.name + "<%=File.separatorChar%>* </span>" ); 
     176 
     177            new Button( {value:interfaceTexts["bo.move"], parent:this.containerFilesMove, id:"button_move", className: "small negative action_button", onClick:jQuery.proxy( this.onClickMove, this )} ); 
     178        } 
     179    }, 
     180 
    239181    // EVENTS ******************************************************** 
    240     onClickModify: function( request ) 
    241     { 
    242         this.request = request; 
    243         $( "#code" ).val( request.code ); 
    244         $( "#creationDate" ).val( formatDate( new Date( request.creationDate.time ) ) ); 
    245         if( request.closingDate ) 
    246             $( "#closingDate" ).val( formatDate( new Date( request.closingDate.time ) ) ); 
    247         $( "#email" ).val( request.emailUser ); 
    248         $( "#titleRequest" ).val( request.title ); 
    249         $( "#informations" ).val( request.informations ); 
    250         this.selectTypes.select( request.type, false ); 
    251         this.selectStates.select( request.state, false ); 
    252  
    253         this.updateModifyRequestButtonAndTitle( request.id ); 
    254     }, 
    255  
    256     onClickClose: function( request ) 
    257     { 
    258         this.request = request; 
    259         jQuery.proxy( this.requestCloseRequest(), this ); 
    260     }, 
    261  
    262     onClickRemove: function( request ) 
    263     { 
    264         this.request = request; 
    265         if( window.confirm( interfaceTexts["bo.mco.remove.confirm"] + " " + request.code + " ?" ) ) 
    266             jQuery.proxy( this.requestRemoveRequest(), this ); 
    267     }, 
    268  
    269     onClickInit: function() 
    270     { 
    271         this.updateAddRequestButtonAndTitle(); 
    272         this.clearAddOrModifyRequestFields(); 
     182    onClickRemove: function( dataset ) 
     183    { 
     184        this.dataset = dataset; 
     185//        if( window.confirm( interfaceTexts["bo.dataset.remove.confirm"] + " " + dataset.name + " ?" ) ) 
     186        jQuery.proxy( this.requestRemoveRequest(), this ); 
    273187    }, 
    274188 
     
    276190    { 
    277191        this.containerPage.html( 1 ); 
    278         this.requestSortRequest(); 
     192        this.requestSortDataset(); 
    279193    }, 
    280194 
     
    282196    { 
    283197        decrementPage( this.containerPage, this.containerMaxPage ); 
    284         this.requestSortRequest(); 
     198        this.requestSortDataset(); 
    285199    }, 
    286200 
     
    288202    { 
    289203        incrementPage( this.containerPage, this.containerMaxPage ); 
    290         this.requestSortRequest(); 
     204        this.requestSortDataset(); 
     205    }, 
     206 
     207    onClickMove: function() 
     208    { 
     209        this.requestFilesMove(); 
    291210    }, 
    292211 
  • ether_megapoli/trunk/web/backoffice/dataInsertion.jsp

    r473 r475  
    3030    <tiles:put name="body" type="string"> 
    3131        <%-- ****************** DATASETS REMOVE ****************** --%> 
    32         <div class="title2"><bean:message key="bo.dataset.remove"/> :</div> 
     32        <div class="title2">1st <bean:message key="bo.step"/>. <bean:message key="bo.dataset.remove"/> :</div> 
    3333        <BR/> 
    3434 
     
    8787        <BR/> 
    8888        <HR width="50%"> 
     89        <%-- ****************** FILES MOVE ****************** --%> 
     90        <div class="title2">2nd <bean:message key="bo.step"/>. <bean:message key="bo.file.move"/> :</div> 
     91        <BR/> 
     92        <div id="containerFilesMove"></div> 
     93        <div id="resultFilesMove"></div> 
     94        <BR/> 
     95        <HR width="50%"> 
    8996 
    9097        <%-- ****************** DATASETS INSERTION ****************** --%> 
    91         <div class="title2"><bean:message key="bo.dataset.remove"/> :</div> 
     98        <div class="title2">3rd <bean:message key="bo.step"/>.<bean:message key="bo.dataset.remove"/> :</div> 
    9299        <BR/> 
    93100 
     
    96103        <script type="text/javascript"> 
    97104            var interfaceTexts = $A( "" ); 
    98             interfaceTexts["bo.noRequest"] = '<bean:message key="bo.noRequest"/>'; 
    99             interfaceTexts["bo.add"] = '<bean:message key="bo.add"/>'; 
    100             interfaceTexts["bo.modify"] = '<bean:message key="bo.modify"/>'; 
     105            interfaceTexts["bo.noDataset"] = '<bean:message key="bo.noDataset"/>'; 
    101106            interfaceTexts["bo.remove"] = '<bean:message key="bo.remove"/>'; 
    102             interfaceTexts["bo.close"] = '<bean:message key="bo.close"/>'; 
    103             interfaceTexts["bo.mco.remove.confirm"] = '<bean:message key="bo.mco.remove.confirm"/>'; 
     107            interfaceTexts["bo.dataset.remove.confirm"] = '<bean:message key="bo.dataset.remove.confirm"/>'; 
    104108            interfaceTexts["bo.id"] = '<bean:message key="bo.id"/>'; 
    105             interfaceTexts["bo.mco.add"] = '<bean:message key="bo.mco.add"/>'; 
    106             interfaceTexts["bo.mco.modify"] = '<bean:message key="bo.mco.modify"/>'; 
    107             interfaceTexts["bo.user.email"] = '<bean:message key="bo.user.email"/>'; 
     109            interfaceTexts["bo.name"] = '<bean:message key="bo.name"/>'; 
    108110            interfaceTexts["bo.user.creationDate"] = '<bean:message key="bo.user.creationDate"/>'; 
    109             interfaceTexts["bo.closingDate"] = '<bean:message key="bo.closingDate"/>'; 
    110111            interfaceTexts["bo.all"] = '<bean:message key="bo.all"/>'; 
    111             interfaceTexts["bo.field.code"] = '<bean:message key="bo.field.code"/>'; 
    112             interfaceTexts["bo.field.email"] = '<bean:message key="bo.field.email"/>'; 
     112            interfaceTexts["bo.go"] = '<bean:message key="bo.go"/>'; 
     113            interfaceTexts["bo.move"] = '<bean:message key="bo.move"/>'; 
    113114 
    114             interfaceTexts["<%=McoState.A_OPENED%>"] = "<bean:message key="bo.opened"/>"; 
    115             interfaceTexts["<%=McoState.C_REFUSED%>"] = "<bean:message key="bo.user.refused"/>"; 
    116             interfaceTexts["<%=McoState.D_CLOSED%>"] = "<bean:message key="bo.closed"/>"; 
    117             interfaceTexts["<%=McoState.B_IN_WORK%>"] = "<bean:message key="bo.inWork"/>"; 
    118  
    119             interfaceTexts["<%=McoType.NEW_ACCOUNT%>"] = "<bean:message key="bo.new.account"/>"; 
    120             interfaceTexts["<%=McoType.EMAIL_LOGIN%>"] = "<bean:message key="bo.email.login"/>"; 
    121             interfaceTexts["<%=McoType.NO_ACCESS%>"] = "<bean:message key="bo.no.access"/>"; 
    122             interfaceTexts["<%=McoType.PROBLEM%>"] = "<bean:message key="bo.problem"/>"; 
    123             interfaceTexts["<%=McoType.PROBLEM_DATA%>"] = "<bean:message key="bo.problem.data"/>"; 
    124             interfaceTexts["<%=McoType.PROBLEM_DATE%>"] = "<bean:message key="bo.problem.date"/>"; 
    125             interfaceTexts["<%=McoType.BETA_TEST%>"] = "<bean:message key="bo.beta.test"/>"; 
    126             interfaceTexts["<%=McoType.OTHER%>"] = "<bean:message key="bo.other"/>"; 
    127  
    128             interfaceTexts["<%=WebException.WebCode.MCO_ALREADY_EXISTS%>"] = "<bean:message key="bo.mco.already.exist"/>"; 
    129  
    130             new interfaceBOMco( ${requestNumber}, ${jSonRequests}, ${jSonRequestStates}, ${jSonRequestTypes} ); 
     115            new interfaceBODataInsertion( ${datasetNumber}, ${jSonDatasets} ); 
    131116        </script> 
    132117 
  • ether_megapoli/trunk/web/resources/css/backoffice.css

    r463 r475  
    7373/** ************************ OTHER ********************** **/ 
    7474/** ***************************************************** **/ 
    75 #loadingForUser, #loadingForWaitingUser, #loadingForRequest { 
     75#loadingForUser, #loadingForWaitingUser, #loadingForRequest, #loadingForDataset { 
    7676    margin: auto; 
    7777} 
     
    8181    font-weight: bold; 
    8282} 
     83 
     84#button_move { 
     85    float: right; 
     86    margin-right: 11px; 
     87} 
  • ether_megapoli/trunk/web/src/ApplicationResources_en.properties

    r473 r475  
    630630bo.other=Other 
    631631 
     632bo.step=step 
    632633bo.data.insertion=Data insertion 
    633634bo.dataset.remove=Dataset remove 
    634635bo.dataset.list=List of datasets 
    635636bo.name=Name 
     637bo.file.move=Move files from download directory to upload directory 
     638bo.noDataset=No dataset 
     639bo.dataset.remove.confirm=Do you really want to remove the dataset 
     640bo.move=Move 
  • ether_megapoli/trunk/web/src/com/ether/ControllerBackoffice.java

    r474 r475  
    7676            throws WebException 
    7777    { 
    78         return sortDataSet( "jeuId", null, 5, 1 ); 
     78        return sortJeu( "jeuId", null, 5, 1 ); 
    7979    } 
    8080 
     
    439439     */ 
    440440    @ControllerMethod(jsonResult = true) 
    441     public JSONObject sortDataSet( @NotNull @ParamName("sort") final String sort, 
    442                                    @Nullable @ParamName("searchText") final String searchText, 
    443                                    @ParamName(ParameterConstants.PARAMETER_MAX_RESULTS) final Integer maxResults, 
    444                                    @ParamName(ParameterConstants.PARAMETER_PAGE) final Integer page ) 
     441    public JSONObject sortJeu( @NotNull @ParamName("sort") final String sort, 
     442                               @Nullable @ParamName("searchText") final String searchText, 
     443                               @ParamName(ParameterConstants.PARAMETER_MAX_RESULTS) final Integer maxResults, 
     444                               @ParamName(ParameterConstants.PARAMETER_PAGE) final Integer page ) 
    445445            throws WebException 
    446446    { 
     
    449449            final JeuFilter filter = new JeuFilter( sort, searchText, maxResults, page ); 
    450450 
    451             final PaginatedResult<Jeu> datasets = getEtherService().searchDatasets( filter ); 
     451            final PaginatedResult<Jeu> datasets = getEtherService().searchJeux( filter ); 
    452452 
    453453            final JSONObject result = new JSONObject(); 
     
    459459        { 
    460460            throw new WebException( WebException.WebCode.ERROR_NO_REQUEST_FOUND, e ); 
     461        } 
     462    } 
     463 
     464    @ControllerMethod() 
     465    public void removeJeu( @NotNull @ParamName(ParameterConstants.PARAMETER_ID) final Integer jeuId ) 
     466            throws WebException 
     467    { 
     468        try 
     469        { 
     470            getEtherService().removeJeuById( jeuId ); 
     471        } 
     472        catch( ServiceException e ) 
     473        { 
     474            throw new WebException( WebException.WebCode.ERROR_NO_JEU_FOUND, e ); 
     475        } 
     476    } 
     477 
     478    @ControllerMethod() 
     479    public void moveJeu( @NotNull @ParamName(ParameterConstants.PARAMETER_ID) final Integer jeuId ) 
     480            throws WebException 
     481    { 
     482        try 
     483        { 
     484            final Jeu jeu = getEtherService().getJeuById( jeuId ); 
     485            final String downloadDirectory = (String) getServletContext().getAttribute( "accessDir" ); 
     486            final String uploadDirectory = (String) getServletContext().getAttribute( "uploadDir" ); 
     487            getEtherService().moveFilesFromDownloadToUpload( jeu, downloadDirectory, uploadDirectory ); 
     488        } 
     489        catch( ServiceException e ) 
     490        { 
     491            throw new WebException( WebException.WebCode.ERROR_NO_JEU_FOUND, e ); 
    461492        } 
    462493    } 
  • ether_megapoli/trunk/web/src/com/ether/WebException.java

    r463 r475  
    4949        MCO_ALREADY_EXISTS, 
    5050        ERROR_NO_USER_FOUND, 
    51         ERROR_NO_REQUEST_FOUND 
     51        ERROR_NO_REQUEST_FOUND, 
     52        ERROR_NO_JEU_FOUND 
    5253    } 
    5354 
  • ether_megapoli/trunk/web/src/json/serializers/JeuJsonSerializer.java

    r474 r475  
    1515        serialize( result, "name", jeu.getJeuNom(), jsonConfig ); 
    1616        serialize( result, "creationDate", jeu.getJeuDateinser(), jsonConfig ); 
     17        if( null != jeu.getCategorie() ) 
     18            serialize( result, "categoryName", jeu.getCategorie().getCategorieNom(), jsonConfig ); 
    1719 
    1820        return result; 
Note: See TracChangeset for help on using the changeset viewer.