Changeset dbc739 in indico


Ignore:
Timestamp:
01/25/10 14:50:18 (3 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-webex, prov-dual-interface, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
3cd3b7
Parents:
03e2c9
git-author:
Cesar Munoz Orena <cesar.munoz.orena@…> (01/15/10 11:16:52)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (01/25/10 14:50:18)
Message:

[FIXED] Several fixes to timetable

-All the fixes to the timetable suggested by Pedro after the code revision.

-fixes #46

Location:
indico
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/services/implementation/schedule.py

    r03e2c9 rdbc739  
    368368        self._description = pManager.extract("description", pType=str, 
    369369                                          allowEmpty=True) 
    370         self._dayChanged = pManager.extract("dayChanged", pType=bool, allowEmpty=True) 
    371370 
    372371    def _performOperation(self): 
     
    443442        sessionServices.SessionSlotModifCoordinationBase._checkParams(self) 
    444443        ScheduleEditBreakBase._checkParams(self) 
     444        if self._schEntry.getStartDate().date() != self._dateTime.date(): 
     445            self._dayChanged = True 
     446        else: 
     447            self._dayChanged = False 
    445448        self._brk = self._schEntry 
    446449 
     
    620623        self._roomInfo = pManager.extract("roomInfo", pType=dict, allowEmpty=True) 
    621624        self._isSessionTimetable = pManager.extract("sessionTimetable", pType=bool, allowEmpty=True) 
    622         self._dayChanged = pManager.extract("dayChanged", pType=bool, allowEmpty=True) 
    623625 
    624626    def _performOperation(self): 
  • indico/htdocs/js/indico/Legacy/Dialogs.js

    r03e2c9 rdbc739  
    4242                               info.set('startDateTime', Util.formatDateTime(startDate, IndicoDateTimeFormats.Server)); 
    4343                               info.set('endDateTime', Util.formatDateTime(endDate, IndicoDateTimeFormats.Server)); 
     44                               dateArgs.startDate = startDate; 
     45                               dateArgs.endDate = endDate; 
    4446                               hook.set(true); 
    4547                           } 
     
    124126                                   days, 
    125127                                   function(elem) { 
    126                                        var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.Ordinal); 
     128                                       var d = Util.formatDateTime(elem, IndicoDateTimeFormats.DefaultHourless, IndicoDateTimeFormats.Ordinal); 
    127129                                       return Html.option({value: elem}, d); 
    128130                                   } 
     
    134136                           conferenceDays.observe(function(value) { 
    135137                               //it is neccesary to update the date in dateArgs with the new date to make the request 
    136                                dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal); 
     138                               dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats.Ordinal); 
    137139                               //we make a timeStartMethod request specifying the date for the request 
    138140                               //and we get the result of the request in result 
     
    146148                                       var endDate = Util.parseJSDateTime(result, IndicoDateTimeFormats.Server); 
    147149 
    148                                        var diffHours = dateArgs.endDate.time.substr(0,2) - dateArgs.startDate.time.substr(0,2); 
    149                                        var diffMinutes = Math.abs(dateArgs.endDate.time.substr(3,2) - dateArgs.startDate.time.substr(3,2)); 
     150                                       var diffHours = dateArgs.endDate.getHours() - dateArgs.startDate.getHours(); 
     151                                       var diffMinutes = Math.abs(dateArgs.endDate.getMinutes() - dateArgs.startDate.getMinutes()); 
    150152                                       if (startDate.getHours() >= 23) { 
    151153                                           startDate.setHours(23); 
     
    177179                                   toTarget: function (value) { 
    178180                                       var aux = conferenceDays.get(); 
    179                                        return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
     181                                       return Util.formatDateTime(aux, IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
    180182                                   }, 
    181183                                   toSource: function(value) { 
     
    254256 
    255257               IndicoUtil.waitLoad([ 
    256                    isEdit?function(hook){hook.set(true);}:function(hook) { 
     258                   isEdit?function(hook){ 
     259                       dateArgs.startDate = new Date(dateArgs.startDate.date.substr(0,4), 
     260                               dateArgs.startDate.date.substr(5,2), 
     261                               dateArgs.startDate.date.substr(8,2), 
     262                               dateArgs.startDate.time.substr(0,2), 
     263                               dateArgs.startDate.time.substr(3,2), 
     264                               dateArgs.startDate.time.substr(6,2)); 
     265                       dateArgs.endDate = new Date(dateArgs.endDate.date.substr(0,4), 
     266                               dateArgs.endDate.date.substr(5,2), 
     267                               dateArgs.endDate.date.substr(8,2), 
     268                               dateArgs.endDate.time.substr(0,2), 
     269                               dateArgs.endDate.time.substr(3,2), 
     270                               dateArgs.endDate.time.substr(6,2)); 
     271                       hook.set(true);}:function(hook) { 
    257272                       // Get "end date" for container, so that the break be added after the rest 
    258273                       indicoRequest(timeStartMethod, dateArgs , function(result, error){ 
     
    276291                                   endDate.setHours(startDate.getHours()+1); 
    277292                               } 
    278                                info.set('startDateTime', Util.formatDateTime(startDate, IndicoDateTimeFormats.Server)); 
    279                                info.set('endDateTime', Util.formatDateTime(endDate, IndicoDateTimeFormats.Server)); 
     293                                
     294                               dateArgs.startDate = startDate; 
     295                               dateArgs.endDate = endDate; 
     296                               info.set('startDateTime', Util.formatDateTime(startDate, IndicoDateTimeFormats.ServerHourless)); 
     297                               info.set('endDateTime', Util.formatDateTime(endDate, IndicoDateTimeFormats.ServerHourless)); 
    280298                               hook.set(true); 
    281299                           } 
     
    294312                   }], function(retVal) { 
    295313                       var submitInfo = function(){ 
    296                            //if the day changed 
    297                            if(previousDay != info.get("startDateTime").substr(0,10)) 
    298                                info.set('dayChanged', true); 
    299                            else 
    300                                info.set('dayChanged', false); 
    301314                           each(info, function(value, key) { 
    302315                               args[key] = value; 
     
    383396                                   days, 
    384397                                   function(elem) { 
    385                                        var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.Ordinal); 
     398                                       var d = Util.formatDateTime(elem, IndicoDateTimeFormats.DefaultHourless, IndicoDateTimeFormats.Ordinal); 
    386399                                       return Html.option({value: elem}, d); 
    387400                                   } 
    388401                               ); 
    389                            //the hour added to dayStartDate is irrelevant and it won't be used, it is only passed to avoid the function crash 
    390402                           conferenceDays.set(Util.formatDateTime(dayStartDate, IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.ServerHourless)); 
    391403 
     
    394406                           conferenceDays.observe(function(value) { 
    395407                               //it is neccesary to update the date in dateArgs with the new date to make the request 
    396                                dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal); 
     408                               dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats.Ordinal); 
    397409                               //we make a timeStartMethod request specifying the date for the request 
    398410                               //and we get the result of the request in result 
     
    406418                                       var endDate = Util.parseJSDateTime(result, IndicoDateTimeFormats.Server); 
    407419 
    408                                        var diffHours = dateArgs.endDate.time.substr(0,2) - dateArgs.startDate.time.substr(0,2); 
    409                                        var diffMinutes = Math.abs(dateArgs.endDate.time.substr(3,2) - dateArgs.startDate.time.substr(3,2)); 
     420                                       var diffHours = dateArgs.endDate.getHours() - dateArgs.startDate.getHours(); 
     421                                       var diffMinutes = Math.abs(dateArgs.endDate.getMinutes() - dateArgs.startDate.getMinutes()); 
    410422                                       if (startDate.getHours() >= 23) { 
    411423                                           startDate.setHours(23); 
     
    436448                                   toTarget: function (value) { 
    437449                                       var aux = conferenceDays.get(); 
    438                                        return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
     450                                       return Util.formatDateTime(aux, IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
    439451                                   }, 
    440452                                   toSource: function(value) { 
  • indico/htdocs/js/indico/Management/Timetable.js

    r03e2c9 rdbc739  
    213213                                      } 
    214214                                      self.startTimeField.set(Util.formatDateTime(startDate, IndicoDateTimeFormats.Server).substr(11,5)); 
    215  
    216215                                      self.info.set('startDate', Util.formatDateTime(startDate, IndicoDateTimeFormats.ServerHourless)); 
    217216                                      hook.set(true); 
     
    291290        info.set('privileges', presListWidget.getPrivileges()); 
    292291 
    293         conferenceDays.set(Util.formatDateTime(self.datStartDate + ' ' + self.confStartDate.substr(11,5), IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.ServerHourless)); 
     292        conferenceDays.set(Util.formatDateTime(self.datStartDate, IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.ServerHourless)); 
    294293 
    295294        //We need to update the value of Time and endDateTime every time that is changed by the user 
     
    297296        conferenceDays.observe(function(value) { 
    298297            //it is neccesary to update the date in dateArgs with the new date 
    299             self.dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats./*DefaultHourless*/Ordinal); 
     298            self.dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats./*DefaultHourless*/Ordinal); 
    300299            //but we need to check if the contribution is inside a session and if the day changed, in order 
    301300            //to make the request for the session timetable or the top level timetable 
    302  
    303             if(self.timetable.IntervalTimetableMixin){ 
    304                 if(self.previousDate.substr(0,10) != self.dateArgsselectedDay) 
    305                     self.timeStartMethod = "schedule.event.getDayEndDate"; 
     301            if(exists(self.timetable.parentTimetable)){ 
     302                if(self.previousDate.substr(0,10) != self.dateArgs.selectedDay) 
     303                    self.timeStartMethod = self.timetable.managementActions.methods['Event'].getDayEndDate; 
    306304                else 
    307                     self.timeStartMethod = "schedule.slot.getDayEndDate"; 
     305                    self.timeStartMethod = self.timetable.managementActions.methods['SessionSlot'].getDayEndDate; 
    308306            } 
    309307 
     
    338336                toTarget: function (value) { 
    339337                    var aux = conferenceDays.get(); 
    340                     return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
     338                    return Util.formatDateTime(aux, IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
    341339                }, 
    342340                toSource: function(value) { 
     
    458456                self.info.set(key, value); 
    459457            }); 
     458 
    460459            if (self.parameterManager.check()) { 
    461460                var killProgress = IndicoUI.Dialogs.Util.progress(); 
     
    494493        addButton.observeClick(function(){ 
    495494            //check if the day changed 
    496             if(Util.formatDateTime(conferenceDays.get(), IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) != 
     495            if(Util.formatDateTime(conferenceDays.get(), IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats.Ordinal) != 
    497496                self.previousDate.substr(0,10)){ 
    498497                self.dayChanged = true; 
    499498            } 
    500             self.info.set("dayChanged", self.dayChanged); 
    501499 
    502500            //if we are inside a session and the new contribution is set for a different day, we suppose that the contribution is not part of the session 
    503             if(self.method == "schedule.slot.addContribution" && self.dayChanged){ 
    504                 self.method = "schedule.event.addContribution"; 
     501            if(self.dayChanged){ 
     502                self.method = self.timetable.managementActions.methods['Contribution'].add; 
    505503            } 
    506504            submitInfo(); 
     
    708706                     self.dayChanged = true; 
    709707                 } 
    710                  self.info.set("dayChanged", self.dayChanged); 
    711708                 if (self.isEdit) { 
    712709                     self._saveInfo(); 
    713710                 } else { 
    714711                     //in case we're inside a session and the break is added to a different day, we suppose it's not inside the session anymore 
    715                      if(self.method == "schedule.slot.addBreak" && self.dayChanged){ 
    716                          self.method = "schedule.event.addBreak"; 
     712                     if(self.dayChanged){ 
     713                         self.method = self.managementActions.methods['Break'].add; 
     714                     } 
     715                     else{ 
     716                         if(exists(self.managementActions.timetable.parentTimetable)) 
     717                             self.method = self.managementActions.methods['SessionBreak'].add; 
    717718                     } 
    718719                     self._submitInfo(); 
     
    725726                     self.days, 
    726727                     function(elem) { 
    727                          var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.Ordinal); 
     728                         var d = Util.formatDateTime(elem, IndicoDateTimeFormats.DefaultHourless, IndicoDateTimeFormats.Ordinal); 
    728729                         return Html.option({value: elem}, d); 
    729730                     } 
    730731                 ); 
    731732 
    732              conferenceDays.set(Util.formatDateTime(self.info.get('startDate'), IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.ServerHourless)); 
     733             conferenceDays.set(Util.formatDateTime(self.info.get('startDate'), IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.Server/*Hourless*/)); 
    733734 
    734735             //We need to update the value of Time and endDateTime every time that is changed by the user 
     
    736737             conferenceDays.observe(function(value) { 
    737738                 //it is neccesary to update the date in dateArgs with the new date to make the request 
    738                  self.dateArgs.set("selectedDay", Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal)); 
     739                 self.dateArgs.set("selectedDay", Util.formatDateTime(value, IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats.Ordinal)); 
    739740                 //but we need to check if are inside a session and if the day changed, in order 
    740741                 //to make the request for the session timetable or the top level timetable 
    741742 
    742                  if(self.managementActions.timetable.IntervalTimetableMixin && 
     743                 if(self.previousDate.substr(0,10) != self.dateArgs.get('selectedDay')){ 
    743744                    /* if we chose a different day, it doesn't matter 
    744745                        if we are inside a session */ 
    745                     self.previousDate.substr(0,10) != 
    746                     self.dateArgs.get('selectedDay')){ 
    747                          self.timeStartMethod = "schedule.event.getDayEndDate"; 
    748                      } else { 
    749                          self.timeStartMethod = "schedule.slot.getDayEndDate"; 
    750                      } 
     746                         self.timeStartMethod = self.managementActions.methods['Event'].dayEndDate; 
     747                 } else { 
     748                         if(exists(self.managementActions.timetable.parentTimetable)) 
     749                             self.timeStartMethod = self.managementActions.methods[self.originalArgs.parentType].dayEndDate; 
    751750                 } 
     751                  
    752752                 //we make a timeStartMethod request specifying the date for the request 
    753753                 //and we get the result of the request as a result 
    754                  indicoRequest(self.timeStartMethod, self.dateArgs , function(result, error){ 
     754                 indicoRequest(self.timeStartMethod, self.dateArgs, function(result, error){ 
    755755                     if (error) { 
    756756                         IndicoUtil.errorReport(error); 
     
    778778                     toTarget: function (value) { 
    779779                         var aux = conferenceDays.get(); 
    780                          return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
     780                         return Util.formatDateTime(aux, IndicoDateTimeFormats.ServerHourless, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
    781781                     }, 
    782782                     toSource: function(value) { 
  • indico/htdocs/js/indico/Timetable/Base.js

    r03e2c9 rdbc739  
    268268    }, 
    269269 
    270     getDays: function() { 
    271         return keys(this.data); 
     270    getDays: function() {         
     271        return this.sortedKeys; 
    272272    }, 
    273273 
  • indico/htdocs/js/indico/Timetable/Management.js

    r03e2c9 rdbc739  
    338338            this.eventInfo.isConference, 
    339339            this.eventInfo.favoriteRooms, 
    340             days.reverse(), 
     340            days, 
    341341            this.timetable, 
    342342            function(result) { 
     
    364364            $O(params.roomInfo), 
    365365            false, 
    366             days.reverse(), 
     366            days, 
    367367            this.eventInfo.favoriteRooms); 
    368368 
     
    404404            $O(params.roomInfo), 
    405405            true, 
    406             days.reverse(), 
     406            days, 
    407407            this.eventInfo.favoriteRooms); 
    408408        editDialog.open(); 
     
    416416 
    417417        //Get the days in which the conference is being held 
    418         var days = keys(this.timetable.getData()); 
     418        var days = this.timetable.getDays(); 
    419419 
    420420        IndicoUI.Dialogs.addSession( 
     
    426426            params.selectedDay, 
    427427            this.eventInfo.favoriteRooms, 
    428             days.reverse(), 
     428            days, 
    429429            function(result) { self.timetable._updateEntry(result, result.id); }); 
    430430    }, 
     
    436436 
    437437        //Get the days in which the conference is being held 
    438         var days = keys(this.timetable.getData()); 
     438        var days = this.timetable.getDays(); 
    439439 
    440440        IndicoUI.Dialogs.addSessionSlot( 
     
    447447            params.selectedDay, 
    448448            this.eventInfo.favoriteRooms, 
    449             days.reverse(), 
     449            days, 
    450450            function(result) { self.timetable._updateEntry(result, result.id); } 
    451451        ); 
     
    459459 
    460460        //Get the days in which the conference is being held 
    461         var days = keys(this.timetable.getData()); 
     461        var days = this.timetable.getDays(); 
    462462 
    463463        each(eventData, function(value, key) { 
     
    477477            params.selectedDay, 
    478478            this.eventInfo.favoriteRooms, 
    479             days.reverse(), 
     479            days, 
    480480            function(result) { 
    481481                var aux = result.entry.entries 
Note: See TracChangeset for help on using the changeset viewer.