Changeset d8de92 in indico
- Timestamp:
- 12/01/11 13:38:14 (19 months ago)
- Branches:
- master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
- Children:
- 7b4e91
- Parents:
- ebdd5f
- git-author:
- Adrian Moennich <jerome.ernst.monnich@…> (07/11/11 10:51:38)
- git-committer:
- Pedro Ferreira <jose.pedro.ferreira@…> (12/01/11 13:38:14)
- File:
-
- 1 edited
-
indico/ext/importer/htdocs/js/importer.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/ext/importer/htdocs/js/importer.js
r543f32 rd8de92 255 255 */ 256 256 var _observeInsertButton = function(){ 257 if(self.importerList.getSelectedList().getLength() > 0 && 258 self.timetableList.getSelection() ) 259 self.insertButton.enable(); 257 if(self.importerList.getSelectedList().getLength() > 0 && self.timetableList.getSelection() ) 258 self.insertButton.disabledButtonWithTooltip('enable'); 260 259 else 261 self.insertButton.disable(); 260 self.insertButton.disabledButtonWithTooltip('disable'); 261 262 262 }; 263 263 this.importerList = new ImporterList([], … … 271 271 this.emptySearchDiv.draw(), this.importerList.draw(), this.timetableList.draw()); 272 272 }, 273 /** 274 * Draws buttons at the bottom of the dialog. 275 */ 276 drawButtons: function(){ 277 var self = this; 278 this.insertButton = new DisabledButton(Html.input('button',{disabled:true}, $T('Proceed...'))); 279 var insertButtonTooltip; 280 this.insertButton.observeEvent('mouseover', function(event){ 281 if (!self.insertButton.isEnabled()) { 282 insertButtonTooltip = IndicoUI.Widgets.Generic.errorTooltip(event.clientX, event.clientY, $T("Please select contributions to be added and their destination."), "tooltipError"); 283 } 284 }); 285 this.insertButton.observeEvent('mouseout', function(event){ 286 Dom.List.remove(document.body, insertButtonTooltip); 287 }); 288 this.insertButton.observeClick(function() { 273 _getButtons: function() { 274 var self = this; 275 return [ 276 [$T('Proceed...'), function() { 289 277 var destination = self.timetableList.getSelection(); 290 278 var entries = self.importerList.getSelectedList(); 291 279 var importer = self.importerList.getLastImporter(); 292 new ImporterDurationDialog(entries, destination, self.confId, self.timetable, importer, function(redirect) {293 if( !redirect) {280 new ImporterDurationDialog(entries, destination, self.confId, self.timetable, importer, function(redirect) { 281 if(!redirect) { 294 282 self._hideLists(); 295 283 self.timetableList.clearSelection(); 296 284 self.importerList.clearSelection(); 297 285 self.emptySearchDiv.showAfterSearch(); 298 } else 286 } else { 299 287 self.close(); 288 } 300 289 }); 301 }); 302 return Html.div({}, this.insertButton.draw()); 303 }, 304 /** 305 * Overloaded method. Sets height and width of the dialog. 306 */ 307 _adjustContentWrapper: function() { 308 this.ExclusivePopupWithButtons.prototype._adjustContentWrapper.call(this); 309 this.contentWrapper.setStyle("height", this.height); 310 this.contentWrapper.setStyle("width", this.width); 290 }], 291 [$T('Close'), function() { 292 self.close(); 293 }] 294 ]; 311 295 }, 312 296 draw: function(){ 313 return this.ExclusivePopupWithButtons.prototype.draw.call(this, this.drawContent(), this.drawButtons()); 297 this.insertButton = this.buttons.eq(0); 298 this.insertButton.disabledButtonWithTooltip({ 299 tooltip: $T('Please select contributions to be added and their destination.'), 300 disabled: true 301 }); 302 return this.ExclusivePopupWithButtons.prototype.draw.call(this, this.drawContent()); 314 303 } 315 304 }, … … 325 314 function(timetable){ 326 315 var self = this; 327 this.ExclusivePopupWithButtons( Html.div({style:{textAlign:"center"}},$T("Import Entries")));316 this.ExclusivePopupWithButtons($T("Import Entries")); 328 317 this.timetable = timetable?timetable:window.timetable; 329 318 this.timetable = this.timetable.parentTimetable?this.timetable.parentTimetable:this.timetable … … 463 452 }, 464 453 465 drawButtons: function(){466 var self = this; 467 var insertButton = Html.input("button",{},$T("Insert"));468 var entriesLength = self.entries.getLength();469 470 insertButton.observeClick(function(){471 if( self.parameterManager.check() ) {454 _getButtons: function() { 455 var self = this; 456 return [ 457 [$T('Insert'), function() { 458 if(!self.parameterManager.check()) { 459 return; 460 } 472 461 //Converts string containing contribution's start date(HH:MM) into a number of minutes. 473 462 //Using parseFloat because parseInt('08') = 0. … … 476 465 var method = self._extractMethod(); 477 466 //If last contribution finishes before 24:00 478 if( time + duration * entriesLength<= 1440) {467 if( time + duration * self.entries.getLength() <= 1440) { 479 468 var killProgress = IndicoUI.Dialogs.Util.progress(); 480 469 var date = self.destination.startDate.date.replace(/-/g,'/'); … … 509 498 if(self.successFunction) 510 499 self.successFunction(self.info.get('redirect')); 511 if( self.info.get('redirect'))500 if(self.info.get('redirect')) 512 501 window.location = self._extractRedirectUrl(); 513 502 self.close(); … … 516 505 ImporterUtils.multipleIndicoRequest(args, successCallback , null, finalCallback); 517 506 } 518 else 507 else { 519 508 new WarningPopup("Warning", "Some contributions will end after 24:00. Please modify start time and duration.").open(); 520 } 521 }); 522 return Html.div({}, insertButton); 509 } 510 }], 511 [$T('Cancel'), function() { 512 self.close(); 513 }] 514 ]; 515 523 516 }, 524 517 draw: function(){ 525 return this.ExclusivePopupWithButtons.prototype.draw.call(this, this.drawContent() , this.drawButtons());518 return this.ExclusivePopupWithButtons.prototype.draw.call(this, this.drawContent()); 526 519 } 527 520 }, … … 537 530 function(entries, destination, confId, timetable, importer, successFunction){ 538 531 var self = this; 539 this.ExclusivePopupWithButtons( Html.div({style:{textAlign:"center"}},$T("Adjust entries")));532 this.ExclusivePopupWithButtons($T('Adjust entries')); 540 533 this.confId = confId; 541 534 this.entries = entries;
Note: See TracChangeset
for help on using the changeset viewer.
