Changeset d8de92 in indico


Ignore:
Timestamp:
12/01/11 13:38:14 (19 months ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
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)
Message:

[FIX] Fix importer dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/ext/importer/htdocs/js/importer.js

    r543f32 rd8de92  
    255255                 */ 
    256256                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'); 
    260259                    else 
    261                         self.insertButton.disable(); 
     260                        self.insertButton.disabledButtonWithTooltip('disable'); 
     261 
    262262                }; 
    263263                this.importerList = new ImporterList([], 
     
    271271                        this.emptySearchDiv.draw(), this.importerList.draw(), this.timetableList.draw()); 
    272272            }, 
    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() { 
    289277                        var destination = self.timetableList.getSelection(); 
    290278                        var entries = self.importerList.getSelectedList(); 
    291279                        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) { 
    294282                                self._hideLists(); 
    295283                                self.timetableList.clearSelection(); 
    296284                                self.importerList.clearSelection(); 
    297285                                self.emptySearchDiv.showAfterSearch(); 
    298                             } else 
     286                            } else { 
    299287                                self.close(); 
     288                            } 
    300289                        }); 
    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                ]; 
    311295            }, 
    312296            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()); 
    314303            } 
    315304        }, 
     
    325314        function(timetable){ 
    326315            var self = this; 
    327             this.ExclusivePopupWithButtons(Html.div({style:{textAlign:"center"}},$T("Import Entries"))); 
     316            this.ExclusivePopupWithButtons($T("Import Entries")); 
    328317            this.timetable = timetable?timetable:window.timetable; 
    329318            this.timetable = this.timetable.parentTimetable?this.timetable.parentTimetable:this.timetable 
     
    463452            }, 
    464453 
    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                        } 
    472461                        //Converts string containing contribution's start date(HH:MM) into a number of minutes. 
    473462                        //Using parseFloat because parseInt('08') = 0. 
     
    476465                        var method = self._extractMethod(); 
    477466                        //If last contribution finishes before 24:00 
    478                         if( time + duration * entriesLength <= 1440) { 
     467                        if( time + duration * self.entries.getLength() <= 1440) { 
    479468                            var killProgress = IndicoUI.Dialogs.Util.progress(); 
    480469                            var date = self.destination.startDate.date.replace(/-/g,'/'); 
     
    509498                                if(self.successFunction) 
    510499                                    self.successFunction(self.info.get('redirect')); 
    511                                 if( self.info.get('redirect') ) 
     500                                if(self.info.get('redirect')) 
    512501                                    window.location = self._extractRedirectUrl(); 
    513502                                self.close(); 
     
    516505                            ImporterUtils.multipleIndicoRequest(args, successCallback , null, finalCallback); 
    517506                        } 
    518                         else 
     507                        else { 
    519508                            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 
    523516            }, 
    524517            draw: function(){ 
    525                 return this.ExclusivePopupWithButtons.prototype.draw.call(this, this.drawContent(), this.drawButtons()); 
     518                return this.ExclusivePopupWithButtons.prototype.draw.call(this, this.drawContent()); 
    526519            } 
    527520        }, 
     
    537530        function(entries, destination, confId, timetable, importer, successFunction){ 
    538531            var self = this; 
    539             this.ExclusivePopupWithButtons(Html.div({style:{textAlign:"center"}},$T("Adjust entries"))); 
     532            this.ExclusivePopupWithButtons($T('Adjust entries')); 
    540533            this.confId = confId; 
    541534            this.entries = entries; 
Note: See TracChangeset for help on using the changeset viewer.