Changeset 482
- Timestamp:
- 04/18/12 15:27:13 (12 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 96 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/service/implementation/com/ether/EtherServiceImpl.java
r476 r482 25 25 import org.springframework.transaction.annotation.Transactional; 26 26 27 import java.io.File;28 27 import java.util.ArrayList; 29 28 import java.util.Date; … … 550 549 } 551 550 552 /**553 * This method moves all dataset's files from download directory to upload directory554 *555 * @param jeu556 * @param downloadDirectory557 * @param uploadDirectory558 */559 public boolean moveFilesFromDownloadToUpload( @NotNull final Jeu jeu, @NotNull final String downloadDirectory, @NotNull final String uploadDirectory )560 throws ServiceException561 {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 return EtherHelper.moveFiles( downloadFilesPath, uploadFilesPath );569 }570 571 551 @Required 572 552 public void setPlateformDAO( final PlateformDAO plateformDAO ) -
ether_megapoli/trunk/service/interface/com/ether/EtherService.java
r476 r482 143 143 Jeu getJeuById( @NotNull final Integer jeuId ) 144 144 throws ServiceException; 145 146 boolean moveFilesFromDownloadToUpload( @NotNull final Jeu jeu, @NotNull final String downloadDirectory, @NotNull final String uploadDirectory )147 throws ServiceException;148 145 } -
ether_megapoli/trunk/web/backoffice/dataInsertion-script.jsp
r476 r482 15 15 // Containers 16 16 this.generalContainerDatasets = $( "#generalContainerDatasets" ); 17 this.containerDatasetsNumber = $( "#nbResults" ); 18 this.containerErrors = $( "#errors" ); 17 19 this.containerDatasets = $( "#containerDataSets" ); 18 this.containerErrors = $( "#errors" ); 19 this.containerDatasetsNumber = $( "#nbResults" ); 20 this.containerFilesMove = $( "#containerFilesMove" ); 21 this.containerResultFilesMove = $( "#resultFilesMove" ); 20 this.containerResultRemove = $( "#containerResultRemove" ); 21 this.containerMove = $( "#containerMove" ); 22 this.containerResultMove = $( "#containerResultMove" ); 23 this.containerInsert = $( "#containerInsert" ); 24 this.containerResultInsert = $( "#containerResultInsert" ); 22 25 23 26 this.containerSorts = $( "#containerSorts" ); … … 34 37 this.loadingDataset.display(); 35 38 39 var param = new Object(); 40 param.id = "loadingForDatasetRemove"; 41 param.parent = this.generalContainerDatasets; 42 param.className = "loading-data"; 43 this.loadingRemove = new Loading( param ); 44 45 var param = new Object(); 46 param.id = "loadingForDatasetInsert"; 47 param.parent = this.containerInsert; 48 param.className = "loading-data"; 49 this.loadingInsert = new Loading( param ); 50 36 51 this.containerErrors.hide(); 37 52 this.displaySorts(); 38 53 this.managePagination(); 39 54 this.displayDatasets(); 55 56 // Bind insert button 57 $( "#insert" ).bind( 'click', this, jQuery.proxy( this.onClickInsert, this ) ); 40 58 }, 41 59 42 60 // REQUESTS ******************************************************** 43 requestRemoveRequest: function() 44 { 61 requestRemoveDataset: function() 62 { 63 this.loadingRemove.display(); 45 64 if( this.dataset ) 46 65 $.ajax( { 47 66 url: "backoffice?methodName=removeJeu&id=" + this.dataset.id, 48 success:jQuery.proxy( this.handleRequest, this ) 67 success:jQuery.proxy( this.handleRemoveDataset, this ), 68 error: jQuery.proxy( this.showErrors, [this] ) 49 69 } ); 50 70 }, … … 57 77 var request = $.ajax( { 58 78 url: "backoffice?methodName=sortJeu&" + parametersUrl, 59 success:jQuery.proxy( this.handleSort Request, this ),79 success:jQuery.proxy( this.handleSortDataset, this ), 60 80 error: jQuery.proxy( this.showErrors, [this] ) 61 81 } ); … … 67 87 $.ajax( { 68 88 url: "backoffice?methodName=moveJeu&id=" + this.dataset.id, 69 success:jQuery.proxy( this.handleFilesMove, this ) 89 success:jQuery.proxy( this.handleFilesMove, this ), 90 error: jQuery.proxy( this.showErrors, [this] ) 70 91 } ); 71 92 }, 72 93 94 requestDatasetInsert: function() 95 { 96 this.loadingInsert.display(); 97 if( "" != $( "#categoryNameInsert" ).val() && "" != $( "#datasetNameInsert" ).val() && "" != $( "#versionInsert" ).val() ) 98 $.ajax( { 99 url: "backoffice?methodName=insertJeu&categoryName=" + $( "#categoryNameInsert" ).val() + "&datasetName=" + $( "#datasetNameInsert" ).val() + "&version=" + $( "#versionInsert" ).val() , 100 success:jQuery.proxy( this.handleDatasetInsert, this ), 101 error: jQuery.proxy( this.showErrors, [this] ) 102 } ); 103 }, 104 73 105 // HANDLES ******************************************************** 74 handleRequest: function() 75 { 76 this.requestSortDataset(); 77 }, 78 79 handleSortRequest: function( result ) 106 handleRemoveDataset: function( result ) 107 { 108 this.loadingRemove.hide(); 109 this.containerResultRemove.html( jQuery.parseJSON( result ).success + " " + this.dataset.categoryName + " / " + this.dataset.name ); 110 this.containerResultRemove.removeClass( "disable" ); 111 this.containerResultRemove.show(); 112 this.requestSortDataset(); 113 }, 114 115 handleSortDataset: function( result ) 80 116 { 81 117 this.jSonDatasets = jQuery.parseJSON( result ).jSonDatasets; 82 118 this.nbDatasets = jQuery.parseJSON( result ).datasetNumber; 83 119 this.displayDatasets(); 84 this.displayFilesMove();85 120 }, 86 121 87 122 handleFilesMove: function( result ) 88 123 { 89 this.containerResultFilesMove.html( "OK" ); 124 this.containerResultMove.html( jQuery.parseJSON( result ).success ); 125 this.containerResultMove.removeClass( "disable" ); 126 this.containerResultMove.show(); 127 }, 128 129 handleDatasetInsert: function( result ) 130 { 131 this.loadingInsert.hide(); 132 this.containerResultInsert.html( jQuery.parseJSON( result ).success + " " + this.dataset.categoryName + " / " + this.dataset.name ); 133 this.containerResultInsert.show(); 134 this.requestSortDataset(); 90 135 }, 91 136 … … 115 160 if( this.jSonDatasets && 0 < this.jSonDatasets.length ) 116 161 { 117 jQuery.each( this.jSonDatasets, jQuery.proxy( function( i, request )162 jQuery.each( this.jSonDatasets, jQuery.proxy( function( i, dataset ) 118 163 { 119 var tr = this.displayTRForDataset( request );164 var tr = this.displayTRForDataset( dataset ); 120 165 121 166 // Buttons 122 167 var tdRemove = $( document.createElement( "td" ) ); 123 new Button( {value:interfaceTexts["bo.remove"], parent:tdRemove, id:"button_remove", className: "small negative action_button", contextToSave: request, onClick:jQuery.proxy( this.onClickRemove, this )} );168 new Button( {value:interfaceTexts["bo.remove"], parent:tdRemove, id:"button_remove", className: "small negative action_button", contextToSave: dataset, onClick:jQuery.proxy( this.onClickRemove, this )} ); 124 169 tr.append( tdRemove ); 125 170 … … 176 221 if( this.dataset && this.dataset.categoryName ) 177 222 { 178 this.container FilesMove.html( "MOVE <span style='color:#FBE3E4'>" + this.downloadDirectory + "<%=File.separatorChar%>" + this.dataset.categoryName + "<%=File.separatorChar%>" + this.dataset.name + "<%=File.separatorChar%>* </span> <BR/>" +223 this.containerMove.html( "MOVE <span style='color:#FBE3E4'>" + this.downloadDirectory + "<%=File.separatorChar%>" + this.dataset.categoryName + "<%=File.separatorChar%>" + this.dataset.name + "<%=File.separatorChar%>* </span> <BR/>" + 179 224 "TO <span style='color:#FBE3E4'>" + this.uploadDirectory + "<%=File.separatorChar%>" + this.dataset.categoryName + "<%=File.separatorChar%>" + this.dataset.name + "<%=File.separatorChar%>* </span>" ); 180 225 181 new Button( {value:interfaceTexts["bo.move"], parent:this.containerFilesMove, id:"button_move", className: "small negative action_button", onClick:jQuery.proxy( this.onClickMove, this )} ); 226 new Button( {value:interfaceTexts["bo.move"], parent:this.containerMove, id:"button_move", className: "small negative action_button", onClick:jQuery.proxy( this.onClickMove, this )} ); 227 this.containerMove.show(); 182 228 } 183 229 }, 184 230 185 231 // EVENTS ******************************************************** 232 onClickSort: function() 233 { 234 this.containerPage.html( 1 ); 235 this.requestSortDataset(); 236 }, 237 238 onClickPrevious: function() 239 { 240 decrementPage( this.containerPage, this.containerMaxPage ); 241 this.requestSortDataset(); 242 }, 243 244 onClickNext: function() 245 { 246 incrementPage( this.containerPage, this.containerMaxPage ); 247 this.requestSortDataset(); 248 }, 249 186 250 onClickRemove: function( dataset ) 187 251 { 188 252 this.dataset = dataset; 253 254 this.containerErrors.hide(); 255 this.hideRemove(); 256 this.hideMove(); 257 this.hideInsert(); 258 259 this.displayFilesMove(); 260 261 $( "#categoryNameInsert" ).val( this.dataset.categoryName ); 262 $( "#datasetNameInsert" ).val( this.dataset.name ); 263 189 264 // if( window.confirm( interfaceTexts["bo.dataset.remove.confirm"] + " " + dataset.name + " ?" ) ) 190 jQuery.proxy( this.requestRemoveRequest(), this ); 191 }, 192 193 onClickSort: function() 194 { 195 this.containerPage.html( 1 ); 196 this.requestSortDataset(); 197 }, 198 199 onClickPrevious: function() 200 { 201 decrementPage( this.containerPage, this.containerMaxPage ); 202 this.requestSortDataset(); 203 }, 204 205 onClickNext: function() 206 { 207 incrementPage( this.containerPage, this.containerMaxPage ); 208 this.requestSortDataset(); 265 this.requestRemoveDataset(); 209 266 }, 210 267 211 268 onClickMove: function() 212 269 { 270 this.containerErrors.hide(); 271 this.containerResultRemove.addClass( "disable" ); 272 this.hideMove(); 273 this.hideInsert(); 213 274 this.requestFilesMove(); 275 }, 276 277 onClickInsert: function() 278 { 279 this.containerErrors.hide(); 280 this.containerResultMove.addClass( "disable" ); 281 this.hideInsert(); 282 283 if( "" != $( "#categoryNameInsert" ).val() && "" != $( "#datasetNameInsert" ).val() && "" != $( "#versionInsert" ).val() ) 284 this.requestDatasetInsert(); 285 else 286 this.showErrors( interfaceTexts["bo.dataset.fields"] ); 214 287 }, 215 288 … … 217 290 showErrors: function( result ) 218 291 { 219 var context = this[0] ;292 var context = this[0] ? this[0] : this; 220 293 var text = this[1]; 221 294 context.containerErrors.show(); … … 224 297 else if( interfaceTexts[result.responseText] ) 225 298 context.containerErrors.html( interfaceTexts[result.responseText] ); 299 else if( result.responseText ) 300 context.containerErrors.html( result.responseText ); 226 301 else 227 context.containerErrors.html( result .responseText);302 context.containerErrors.html( result ); 228 303 }, 229 304 … … 232 307 $( "#previous" ).bind( 'click', this, jQuery.proxy( this.onClickPrevious, this ) ); 233 308 $( "#next" ).bind( 'click', this, jQuery.proxy( this.onClickNext, this ) ); 309 }, 310 311 hideRemove: function() 312 { 313 this.loadingRemove.hide(); 314 this.containerResultRemove.hide(); 315 }, 316 317 hideMove: function() 318 { 319 this.containerResultMove.hide(); 320 }, 321 322 hideInsert: function() 323 { 324 this.loadingInsert.hide(); 325 this.containerResultInsert.hide(); 234 326 } 235 327 -
ether_megapoli/trunk/web/backoffice/dataInsertion.jsp
r476 r482 1 <%@ page import="com.ether.WebException" %> 1 2 <%@ page language="java" contentType="text/html; charset=UTF-8" %> 2 3 <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> … … 69 70 </div> 70 71 72 <div id="containerResultRemove" class="containerInfos"></div> 73 71 74 <div style="float:left"><bean:message key="bo.total.number"/> : 72 75 <div id="nbResults" style="float:right"></div> … … 82 85 </div> 83 86 84 85 87 <BR/> 86 88 <HR width="50%"> … … 89 91 <BR/> 90 92 91 <div id="container FilesMove"></div>92 <div id=" resultFilesMove"></div>93 <div id="containerMove"></div> 94 <div id="containerResultMove" class="containerInfos"></div> 93 95 <BR/> 94 96 <HR width="50%"> 95 97 96 98 <%-- ****************** DATASETS INSERTION ****************** --%> 97 <div class="title2">3rd <bean:message key="bo.step"/>.<bean:message key="bo.dataset.remove"/> :</div> 99 <div class="title2">3rd <bean:message key="bo.step"/>.<bean:message key="bo.dataset.insert"/> :</div> 100 <bean:message key="bo.category"/> : <input id="categoryNameInsert"> 101 <bean:message key="bo.name"/> : <input id="datasetNameInsert"> 102 <bean:message key="bo.version"/> : <input id="versionInsert"> 103 104 <div style="float:right"> 105 <button id="insert" class="small positive"><bean:message key="bo.insert"/></button> 106 </div> 107 <div id="containerInsert"></div> 108 <div id="containerResultInsert" class="containerInfos"></div> 98 109 <BR/> 99 110 … … 112 123 interfaceTexts["bo.go"] = '<bean:message key="bo.go"/>'; 113 124 interfaceTexts["bo.move"] = '<bean:message key="bo.move"/>'; 125 interfaceTexts["bo.dataset.fields"] = '<bean:message key="bo.dataset.fields"/>'; 126 127 interfaceTexts["<%=WebException.WebCode.DOWNLOAD_DIRECTORY_DOESNOT_EXISTS%>"] = "<bean:message key="bo.DOWNLOAD_DIRECTORY_DOESNOT_EXISTS"/>"; 114 128 115 129 new interfaceBODataInsertion( ${datasetNumber}, ${jSonDatasets} ); -
ether_megapoli/trunk/web/resources/css/backoffice.css
r475 r482 73 73 /** ************************ OTHER ********************** **/ 74 74 /** ***************************************************** **/ 75 #loadingForUser, #loadingForWaitingUser, #loadingForRequest, #loadingForDataset {75 #loadingForUser, #loadingForWaitingUser, #loadingForRequest, #loadingForDataset, #loadingForDatasetRemove { 76 76 margin: auto; 77 77 } -
ether_megapoli/trunk/web/resources/css/ether.css
r261 r482 116 116 width: 16px; 117 117 } 118 119 .loading-data { 120 background-image: url(../../resources/icons/loading_datas.gif); 121 height: 15px; 122 width: 128px; 123 } -
ether_megapoli/trunk/web/resources/css/megapoli.css
r472 r482 192 192 margin: 10px; 193 193 display: none; 194 } 195 196 .disable { 197 background-color: #f5f5f5; 198 border: 1px solid #565656; 199 color: #565656; 194 200 } 195 201 … … 261 267 262 268 .containerSlideButton { 263 float: left; 264 /*-moz-border-radius: 4px;*/ 265 /*-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/ 266 /*-webkit-border-radius: 4px;*/ 267 /*-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/ 268 /*box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);*/ 269 float: left; /*-moz-border-radius: 4px;*/ 270 /*-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/ 271 /*-webkit-border-radius: 4px;*/ 272 /*-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/ 273 /*box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);*/ 269 274 } 270 275 -
ether_megapoli/trunk/web/src/ApplicationResources_en.properties
r476 r482 640 640 bo.dataset.remove.confirm=Do you really want to remove the dataset 641 641 bo.move=Move 642 bo.dataset.insert=Dataset insert 643 bo.version=Version 644 bo.insert=Insert 645 bo.dataset.fields=The fields category, dataset and version must be filled 646 647 bo.DOWNLOAD_DIRECTORY_DOESNOT_EXISTS=The download directory doesn't exists ! No move available -
ether_megapoli/trunk/web/src/com/ether/ControllerBackoffice.java
r476 r482 21 21 22 22 import javax.mail.MessagingException; 23 import java.io.File; 23 24 import java.security.DigestException; 24 25 import java.security.NoSuchAlgorithmException; … … 462 463 } 463 464 464 @ControllerMethod( )465 public voidremoveJeu( @NotNull @ParamName(ParameterConstants.PARAMETER_ID) final Integer jeuId )465 @ControllerMethod(jsonResult = true) 466 public JSONObject removeJeu( @NotNull @ParamName(ParameterConstants.PARAMETER_ID) final Integer jeuId ) 466 467 throws WebException 467 468 { … … 469 470 { 470 471 getEtherService().removeJeuById( jeuId ); 472 473 final JSONObject result = new JSONObject(); 474 result.put( "success", "Dataset removed : " ); 475 return result; 471 476 } 472 477 catch( ServiceException e ) … … 482 487 try 483 488 { 489 final JSONObject result = new JSONObject(); 490 484 491 final Jeu jeu = getEtherService().getJeuById( jeuId ); 492 if( null == jeu.getCategorie() || null == jeu.getCategorie().getCategorieNom() ) 493 throw new WebException( WebException.WebCode.JEU_NOT_CORRECT, "ERROR to move jeu to download directory to upload directory" + jeu ); 494 485 495 final String downloadDirectory = (String) getServletContext().getAttribute( "accessDir" ); 486 final String uploadDirectory = (String) getServletContext().getAttribute( "uploadDir" ); 487 final boolean success = getEtherService().moveFilesFromDownloadToUpload( jeu, downloadDirectory, uploadDirectory ); 488 489 final JSONObject result = new JSONObject(); 490 result.put( "success", success ); 496 final String downloadFilesPath = downloadDirectory + File.separatorChar + jeu.getCategorie().getCategorieNom() + File.separatorChar + jeu.getJeuNom(); 497 498 if( !( new File( downloadFilesPath ) ).exists() ) 499 throw new WebException( WebException.WebCode.DOWNLOAD_DIRECTORY_DOESNOT_EXISTS, "The download directory doesn't exists ! No move available" + jeu, WebException.getExceptionThrowable() ); 500 501 else 502 { 503 final String uploadDirectory = (String) getServletContext().getAttribute( "uploadDir" ); 504 final String uploadFilesPath = uploadDirectory + File.separatorChar + jeu.getCategorie().getCategorieNom() + File.separatorChar + jeu.getJeuNom(); 505 506 final boolean success = EtherHelper.moveFiles( downloadFilesPath, uploadFilesPath ); 507 508 if( success ) 509 result.put( "success", "All files moved !" ); 510 else 511 throw new WebException( WebException.WebCode.JEU_NOT_CORRECT, "ERROR to move jeu to download directory to upload directory" + jeu ); 512 } 491 513 return result; 492 514 } -
ether_megapoli/trunk/web/src/com/ether/WebException.java
r475 r482 50 50 ERROR_NO_USER_FOUND, 51 51 ERROR_NO_REQUEST_FOUND, 52 ERROR_NO_JEU_FOUND 52 ERROR_NO_JEU_FOUND, 53 JEU_NOT_CORRECT, 54 DOWNLOAD_DIRECTORY_DOESNOT_EXISTS 53 55 } 54 56
Note: See TracChangeset
for help on using the changeset viewer.