Changeset 03e2c9 in indico


Ignore:
Timestamp:
01/25/10 14:50:17 (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, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
Children:
dbc739
Parents:
93394d
git-author:
Pedro Ferreira <jose.pedro.ferreira@…> (01/13/10 12:10:00)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (01/25/10 14:50:17)
Message:

[FIXED] Some fixes to Cesar's changes

  • Whitespaces and accidental line move;
  • Removed some redundant code;
  • Simplified regualr expression;
  • Renamed date/time formats;
Location:
indico
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/conference.py

    r93394d r03e2c9  
    68776877                self.setEndDate(st,2) 
    68786878 
    6879     def setValues(self,data,check=2, moveEntriesBelow=0,): 
     6879    def setValues(self,data,check=2, moveEntriesBelow=0): 
    68806880        """check parameter: 
    68816881            0: no check at all 
     
    68836883            2: check and adapt the owner dates 
    68846884        """ 
    6885          
     6885 
    68866886        # In order to move the entries below, it is needed to know the diff (we have to move them) 
    68876887        # and the list of entries to move. It's is needed to take those datas in advance because they 
     
    69396939        elif sDate != None: 
    69406940            sDateUTC = sDate.astimezone(timezone('UTC')) 
    6941             self.setStartDate(sDateUTC,check,moveEntries=move)        
     6941            self.setStartDate(sDateUTC,check,moveEntries=move) 
    69426942        if data.get("durHours","")!="" and data.get("durMins","")!="": 
    69436943            self.setDuration(hours=data["durHours"],minutes=data["durMins"],check=check) 
  • indico/MaKaC/schedule.py

    r93394d r03e2c9  
    103103        """Tells wether there is any entry after the specified date 
    104104        """ 
     105        entries=self.getEntries() 
    105106        if len(entries)==0: 
    106107            return False 
     
    108109 
    109110    def checkSanity( self ): 
    110         entries=self.getEntries() 
    111111        if self.hasEntriesBefore(self.getStartDate()) or self.hasEntriesAfter(self.getEndDate()): 
    112112            raise TimingError("Sorry, cannot perform this date change: Some entries in the timetable would be outside the new dates [conference id => %s ]"%(self.getOwner().getConference().getId())) 
     
    307307            return self.calculateDayEndDate(day) 
    308308 
    309     def calculateDayEndDate(self,day,hour=0,min=0):        
     309    def calculateDayEndDate(self,day,hour=0,min=0): 
    310310        if day is None: 
    311311            return self.calculateEndDate() 
     
    357357        if not day.tzinfo: 
    358358            day = timezone(self.getTimezone()).localize(day) 
    359         res = []      
     359        res = [] 
    360360        for entry in self.getEntries(): 
    361361            if entry.inDay( day ): 
  • indico/MaKaC/services/implementation/schedule.py

    r93394d r03e2c9  
    368368        self._description = pManager.extract("description", pType=str, 
    369369                                          allowEmpty=True) 
    370         self._dayChanged = pManager.extract("dayChanged", pType=bool, allowEmpty=True)  
     370        self._dayChanged = pManager.extract("dayChanged", pType=bool, allowEmpty=True) 
    371371 
    372372    def _performOperation(self): 
     
    446446 
    447447    def _addToSchedule(self, b): 
    448         if self._dayChanged:     
    449             owner = self._schEntry.getOwner()   
     448        if self._dayChanged: 
     449            owner = self._schEntry.getOwner() 
    450450 
    451451            self._schEntry.getSchedule().removeEntry(self._schEntry) 
    452452 
    453453            self._schEntry.setStartDate(self._dateTime) 
    454             if isinstance(owner, conference.Contribution): 
    455                 owner.setSession(None) 
    456454            self._conf.getSchedule().addEntry(self._schEntry, check=2) 
    457455 
     
    626624    def _performOperation(self): 
    627625        #if there is something inside the session we have to move it as well 
     626 
     627        values = {"title": self._title or "", 
     628                  "sDate": self._startDateTime, 
     629                  "eDate": self._endDateTime} 
     630 
    628631        if len(self._slot.getEntries()) != 0 : 
    629             self._slot.setValues({"title": self._title or "", 
    630                         "sDate": self._startDateTime, 
    631                         "eDate": self._endDateTime, 
    632                         "move": 1}) 
    633         else: 
    634             self._slot.setValues({"title": self._title or "", 
    635                         "sDate": self._startDateTime, 
    636                         "eDate": self._endDateTime}) 
     632            values.update({"move": 1}) 
     633 
     634        self._slot.setValues(values) 
     635 
    637636        self. _addConveners(self._slot) 
    638637        self._setLocationInfo(self._slot) 
  • indico/htdocs/js/indico/Core/Data.js

    r93394d r03e2c9  
    1111 
    1212        // [1234.]s0.0 
    13         m = id.match(/^(?:([^\.]+)\.)s(\d+)(\.|l)(\d+)$/); 
    14         if (m) {             
    15             return concat(["SessionSlot"], /*m.slice(1)*/concat(m.slice(1,3), m.slice(4))); 
     13        m = id.match(/^(?:([^\.]+)\.)s(\d+)(?:\.|l)(\d+)$/); 
     14        if (m) { 
     15            return concat(["SessionSlot"], m.slice(1)); 
    1616        } 
    1717 
     
    4545        var m1 = null, m2 = null; 
    4646 
    47         if (obj == null) { 
     47        if (obj === null) { 
    4848            return null; 
    4949        } 
     
    5454        } else if (typeof(obj) == 'object'){ 
    5555            // handle datetime dictionaries 
    56             // data comes from the server in %Y-%m-%d %H:%M 
    57             m1 = obj.date.match(/(\d+)[-/](\d+)[-/](\d+)/); 
     56            // data comes from the server in %Y-%m-%d %H:%M:%S 
     57            m1 = obj.date.match(/(\d+)[-\/](\d+)[-\/](\d+)/); 
    5858            m2 = obj.time.match(/(\d+):(\d+):(\d+)/); 
    5959        } else if (sourceFormat){ 
     
    6666            m1 = [null, results['%Y'], results['%m'], results['%d']]; 
    6767            //If we do not want to show the hour 
    68             if(sourceFormat == IndicoDateTimeFormats.InternationalHourLess || sourceFormat == IndicoDateTimeFormats.ServerHourSlashLess) 
    69                 m2 = [null, '', '', '']; 
    70             else 
    71                 m2 = [null, results['%H'], results['%M'], results['%S']]; 
     68            m2 = [null, any(results['%H'],''), any(results['%M'],''), any(results['%S'],'')]; 
    7269        } else { 
    7370            throw 'unknown source object'; 
     
    7875        } 
    7976 
    80         // follow the formatting rules. If no time needed we need to delete the ' :' after the date 
    81         var s = ''; 
    82         if(sourceFormat != IndicoDateTimeFormats.InternationalHourLess && sourceFormat != IndicoDateTimeFormats.ServerHourSlashLess) 
    83             s = ':'; 
    8477        return format.replace('%Y', zeropad(m1[1])). 
    8578        replace('%m', zeropad(m1[2])). 
     
    8780        replace('%H', zeropad(m2[1])). 
    8881        replace('%M', zeropad(m2[2])). 
    89         replace('%S', zeropad(m2[3])). 
    90         replace(' :', s); 
     82        replace('%S', zeropad(m2[3])); 
    9183    }, 
    9284 
     
    190182    International: '%d/%m/%Y %H:%M', 
    191183    ISO8601: '%Y/%m/%d %H:%M', 
    192     Default: '%d/%m/%Y %H:%M', 
    193     DefaultHourless: '%d/%m/%Y', 
    194     InternationalHourLess: '%d/%m/%Y', 
    195     ServerHourSlashLess: '%Y%m%d' 
     184    Ordinal: '%Y%m%d' 
    196185}; 
     186 
     187IndicoDateTimeFormats.Default = IndicoDateTimeFormats.International; 
     188IndicoDateTimeFormats.Server = IndicoDateTimeFormats.ISO8601; 
     189 
     190IndicoDateTimeFormats.DefaultHourless = IndicoDateTimeFormats.Default.split(' ')[0]; 
     191IndicoDateTimeFormats.ServerHourless = IndicoDateTimeFormats.Server.split(' ')[0]; 
  • indico/htdocs/js/indico/Legacy/Dialogs.js

    r93394d r03e2c9  
    124124                                   days, 
    125125                                   function(elem) { 
    126                                        var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.ServerHourSlashLess);  
     126                                       var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.Ordinal); 
    127127                                       return Html.option({value: elem}, d); 
    128128                                   } 
    129129                               ); 
    130                            //the hour added to dayStartDate is irrelevant and it won't be used, it is only passed to avoid the function crash 
    131                            conferenceDays.set(Util.formatDateTime(dayStartDate + ' 00:00', IndicoDateTimeFormats.ServerHourSlashLess, IndicoDateTimeFormats.Server)); 
    132                                 
     130                           conferenceDays.set(Util.formatDateTime(dayStartDate, IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.ServerHourless)); 
     131 
    133132                           //We need to update the value of startDateTime and endDateTime every time that is changed by the user 
    134133                           //value is the new date 
    135134                           conferenceDays.observe(function(value) { 
    136135                               //it is neccesary to update the date in dateArgs with the new date to make the request 
    137                                dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess); 
     136                               dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal); 
    138137                               //we make a timeStartMethod request specifying the date for the request 
    139138                               //and we get the result of the request in result 
     
    146145                                       var startDate = Util.parseJSDateTime(result, IndicoDateTimeFormats.Server); 
    147146                                       var endDate = Util.parseJSDateTime(result, IndicoDateTimeFormats.Server); 
    148                                         
     147 
    149148                                       var diffHours = dateArgs.endDate.time.substr(0,2) - dateArgs.startDate.time.substr(0,2); 
    150149                                       var diffMinutes = Math.abs(dateArgs.endDate.time.substr(3,2) - dateArgs.startDate.time.substr(3,2)); 
     
    154153                                           endDate.setHours(23); 
    155154                                           endDate.setMinutes(59); 
    156                                        } else {                                            
     155                                       } else { 
    157156                                           endDate.setHours(startDate.getHours()+diffHours); 
    158157                                           endDate.setMinutes(startDate.getMinutes()+diffMinutes); 
     
    162161                                   } 
    163162                               }); 
    164                                 
     163 
    165164                               /* 
    166165                                * parameterManager is not called because if you just change the date and it's not correct you just need 
    167166                                * to have red fields in the date, so what we're doing is just adding a dispatchEvent for both hour fields 
    168                                 * (they are Html.input, so they can be added to the dispatchEvent) to know when they have changed                                  
     167                                * (they are Html.input, so they can be added to the dispatchEvent) to know when they have changed 
    169168                                */ 
    170169                               startEndTimeField.startTimeField.dispatchEvent('change'); 
    171170                               startEndTimeField.endTimeField.dispatchEvent('change'); 
    172171                           }); 
    173                             
     172 
    174173                           var startEndTimeField = IndicoUI.Widgets.Generic.dateStartEndTimeField(info.get('startDateTime').substr(11,5), info.get('endDateTime').substr(11,5)); 
    175174                           var startEndTimeComponent; 
     
    178177                                   toTarget: function (value) { 
    179178                                       var aux = conferenceDays.get(); 
    180                                        return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess) + ' ' + value; 
     179                                       return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
    181180                                   }, 
    182181                                   toSource: function(value) { 
     
    247246               var args = isEdit?params:params.args 
    248247               var dateArgs = clone(args); 
    249                dateArgs.selectedDay = dayStartDate;                
     248               dateArgs.selectedDay = dayStartDate; 
    250249               var info = new WatchObject(); 
    251250               var favorites; 
     
    299298                               info.set('dayChanged', true); 
    300299                           else 
    301                                info.set('dayChanged', false);                                                                                                                                                                                                                                                                                                                                                                                        
     300                               info.set('dayChanged', false); 
    302301                           each(info, function(value, key) { 
    303302                               args[key] = value; 
     
    384383                                   days, 
    385384                                   function(elem) { 
    386                                        var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.ServerHourSlashLess);  
     385                                       var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.Ordinal); 
    387386                                       return Html.option({value: elem}, d); 
    388387                                   } 
    389388                               ); 
    390389                           //the hour added to dayStartDate is irrelevant and it won't be used, it is only passed to avoid the function crash 
    391                            conferenceDays.set(Util.formatDateTime(dayStartDate + ' 00:00', IndicoDateTimeFormats.ServerHourSlashLess, IndicoDateTimeFormats.Server)); 
    392                                 
     390                           conferenceDays.set(Util.formatDateTime(dayStartDate, IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.ServerHourless)); 
     391 
    393392                           //We need to update the value of startDateTime and endDateTime every time that is changed by the user 
    394393                           //value is the new date 
    395394                           conferenceDays.observe(function(value) { 
    396395                               //it is neccesary to update the date in dateArgs with the new date to make the request 
    397                                dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess); 
     396                               dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal); 
    398397                               //we make a timeStartMethod request specifying the date for the request 
    399398                               //and we get the result of the request in result 
     
    406405                                       var startDate = Util.parseJSDateTime(result, IndicoDateTimeFormats.Server); 
    407406                                       var endDate = Util.parseJSDateTime(result, IndicoDateTimeFormats.Server); 
    408                                         
     407 
    409408                                       var diffHours = dateArgs.endDate.time.substr(0,2) - dateArgs.startDate.time.substr(0,2); 
    410409                                       var diffMinutes = Math.abs(dateArgs.endDate.time.substr(3,2) - dateArgs.startDate.time.substr(3,2)); 
     
    422421                                   } 
    423422                               }); 
    424                                 
     423 
    425424                               /* 
    426425                                * parameterManager is not called because if you just change the date and it's not correct you just need 
    427426                                * to have red fields in the date, so what we're doing is just adding a dispatchEvent for both hour fields 
    428                                 * (they are Html.input, so they can be added to the dispatchEvent) to know when they have changed                                  
     427                                * (they are Html.input, so they can be added to the dispatchEvent) to know when they have changed 
    429428                                */ 
    430429                               startEndTimeField.startTimeField.dispatchEvent('change'); 
    431430                               startEndTimeField.endTimeField.dispatchEvent('change'); 
    432431                           }); 
    433                             
     432 
    434433                           var startEndTimeField = IndicoUI.Widgets.Generic.dateStartEndTimeField(info.get('startDateTime').substr(11,5), info.get('endDateTime').substr(11,5)); 
    435434                           var startEndTimeComponent; 
     
    437436                                   toTarget: function (value) { 
    438437                                       var aux = conferenceDays.get(); 
    439                                        return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess) + ' ' + value; 
     438                                       return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
    440439                                   }, 
    441440                                   toSource: function(value) { 
  • indico/htdocs/js/indico/Legacy/Widgets.js

    r93394d r03e2c9  
    939939            attributes = attributes || {}; 
    940940            var elem = Html.input("text",attributes); 
    941             IndicoUI.Widgets.Generic.input2dateField(elem, showTime, hiddenFields) 
     941            IndicoUI.Widgets.Generic.input2dateField(elem, showTime, hiddenFields); 
    942942            return elem; 
    943943      }, 
     
    945945            attributes = attributes || {}; 
    946946            var elem = Html.input("text",{'id':'sdate', 'name':'sdate'},attributes); 
    947             IndicoUI.Widgets.Generic.input2dateField(elem, showTime, hiddenFields) 
     947            IndicoUI.Widgets.Generic.input2dateField(elem, showTime, hiddenFields); 
    948948            return elem; 
    949949        }, 
     
    952952            attributes = attributes || {}; 
    953953            var elem = Html.input("text",{'id':'edate', 'name':'edate'},attributes); 
    954             IndicoUI.Widgets.Generic.input2dateField(elem, showTime, hiddenFields) 
     954            IndicoUI.Widgets.Generic.input2dateField(elem, showTime, hiddenFields); 
    955955            return elem; 
    956956        }, 
     
    10111011            return Html.edit(attributes, defaultVal); 
    10121012        }, 
    1013        
     1013 
    10141014        applyForParticipationForm: function(conf) { 
    10151015            alert('hejsan'); 
  • indico/htdocs/js/indico/Management/Timetable.js

    r93394d r03e2c9  
    201201                                  } 
    202202                                  else { 
     203 
    203204                                      var startDate = Util.parseJSDateTime(result, IndicoDateTimeFormats.Server); 
    204205 
     
    212213                                      } 
    213214                                      self.startTimeField.set(Util.formatDateTime(startDate, IndicoDateTimeFormats.Server).substr(11,5)); 
    214                                        
    215                                       self.info.set('startDate', Util.formatDateTime(startDate, IndicoDateTimeFormats.Server)); 
     215 
     216                                      self.info.set('startDate', Util.formatDateTime(startDate, IndicoDateTimeFormats.ServerHourless)); 
    216217                                      hook.set(true); 
    217218                                  } 
     
    220221            } 
    221222        }, 
    222          
    223          
     223 
     224 
    224225        function(hook) { 
    225226            var self = this; 
     
    290291        info.set('privileges', presListWidget.getPrivileges()); 
    291292 
    292         conferenceDays.set(Util.formatDateTime(self.datStartDate + ' ' + self.confStartDate.substr(11,5), IndicoDateTimeFormats.ServerHourSlashLess, IndicoDateTimeFormats.Server)); 
    293      
     293        conferenceDays.set(Util.formatDateTime(self.datStartDate + ' ' + self.confStartDate.substr(11,5), IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.ServerHourless)); 
     294 
    294295        //We need to update the value of Time and endDateTime every time that is changed by the user 
    295296        //value is the new date 
    296297        conferenceDays.observe(function(value) { 
    297             //it is neccesary to update the date in dateArgs with the new date                         
    298             self.dateArgs.selectedDay = Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats./*InternationalHourLess*/ServerHourSlashLess); 
     298            //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); 
    299300            //but we need to check if the contribution is inside a session and if the day changed, in order 
    300301            //to make the request for the session timetable or the top level timetable 
    301             if(exists(self.timetable.parentTimetable)){ 
     302 
     303            if(self.timetable.IntervalTimetableMixin){ 
    302304                if(self.previousDate.substr(0,10) != self.dateArgsselectedDay) 
    303305                    self.timeStartMethod = "schedule.event.getDayEndDate"; 
     
    305307                    self.timeStartMethod = "schedule.slot.getDayEndDate"; 
    306308            } 
    307              
     309 
    308310            //we make a timeStartMethod request specifying the date for the request 
    309311            //and we get the result of the request in result 
     
    323325               } 
    324326            }); 
    325              
     327 
    326328            /* 
    327329             * parameterManager is not called because if you just change the date and it's not correct you just need 
    328330             * to have red fields in the date, so what we're doing is just adding a dispatchEvent for both hour fields 
    329              * (they are Html.input, so they can be added to the dispatchEvent) to know when they have changed                                  
     331             * (they are Html.input, so they can be added to the dispatchEvent) to know when they have changed 
    330332             */ 
    331333            self.startTimeField.dispatchEvent('change'); 
     
    336338                toTarget: function (value) { 
    337339                    var aux = conferenceDays.get(); 
    338                     return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess) + ' ' + value; 
     340                    return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
    339341                }, 
    340342                toSource: function(value) { 
     
    345347        var datecomponent; 
    346348        var duration; 
    347         if (this.timeStartMethod !== null) {          
     349        if (this.timeStartMethod !== null) { 
    348350            $B(info.accessor('startDate'), self.startTimeField, timeTranslation); 
    349351            $B(info.accessor('duration'), self.timeField); 
     
    369371                            $T(' Duration '), this.timeField, $T('min'))], 
    370372                [$T('Presenter(s)'), presListWidget.draw()] 
    371             ]);         
    372  
    373          
    374          
     373            ]); 
     374 
     375 
     376 
    375377 
    376378    }, 
     
    485487                self.days, 
    486488                function(elem) { 
    487                     var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.ServerHourSlashLess); 
     489                    var d = Util.formatDateTime(elem, IndicoDateTimeFormats.DefaultHourless, IndicoDateTimeFormats.Ordinal); 
    488490                    return Html.option({value: elem}, d); 
    489491                } 
    490492            ); 
    491          
     493 
    492494        addButton.observeClick(function(){ 
    493495            //check if the day changed 
    494             if(Util.formatDateTime(conferenceDays.get(), IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess) != 
     496            if(Util.formatDateTime(conferenceDays.get(), IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) != 
    495497                self.previousDate.substr(0,10)){ 
    496498                self.dayChanged = true; 
     
    543545         this.successFunc = successFunc; 
    544546         this.favoriteRooms = favoriteRooms; 
    545           
     547 
    546548         this.previousDate = dayStartDate; 
    547549         this.info = new WatchObject(); 
     
    550552             args.schedule = false; 
    551553         } 
    552           
     554 
    553555         var attributes = { 
    554556                 style: { 
     
    618620                             startDate.setMinutes(0); 
    619621                         } 
    620                          self.startTimeField.set(Util.formatDateTime(startDate,  
     622                         self.startTimeField.set(Util.formatDateTime(startDate, 
    621623                                                                     IndicoDateTimeFormats.Server).substr(11,5)); 
    622                           
    623                          self.info.set('startDate', Util.formatDateTime(startDate,  
     624 
     625                         self.info.set('startDate', Util.formatDateTime(startDate, 
    624626                                             IndicoDateTimeFormats.Server)); 
    625627                         hook.set(true); 
     
    700702             addButton.observeClick(function(){ 
    701703                 //check if the day changed 
    702                  if(Util.formatDateTime(conferenceDays.get(), IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess) != 
     704                 if(Util.formatDateTime(conferenceDays.get(), 
     705                                        IndicoDateTimeFormats.ServerHourless, 
     706                                        IndicoDateTimeFormats.Ordinal) != 
    703707                     self.previousDate.substr(0,10)){ 
    704708                     self.dayChanged = true; 
     
    715719                 } 
    716720             }); 
    717               
     721 
    718722             //Create the list of the days in which the conference is being held 
    719723             var conferenceDays = bind.element( 
     
    721725                     self.days, 
    722726                     function(elem) { 
    723                          var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.ServerHourSlashLess); 
     727                         var d = Util.formatDateTime(elem, IndicoDateTimeFormats.International, IndicoDateTimeFormats.Ordinal); 
    724728                         return Html.option({value: elem}, d); 
    725729                     } 
    726730                 ); 
    727731 
    728              conferenceDays.set(Util.formatDateTime(self.info.get('startDate'), IndicoDateTimeFormats.ServerHourSlashLess, IndicoDateTimeFormats.Server)); 
    729               
     732             conferenceDays.set(Util.formatDateTime(self.info.get('startDate'), IndicoDateTimeFormats.Ordinal, IndicoDateTimeFormats.ServerHourless)); 
     733 
    730734             //We need to update the value of Time and endDateTime every time that is changed by the user 
    731735             //value is the new date 
    732736             conferenceDays.observe(function(value) { 
    733737                 //it is neccesary to update the date in dateArgs with the new date to make the request 
    734                  self.dateArgs.set("selectedDay", Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess)); 
     738                 self.dateArgs.set("selectedDay", Util.formatDateTime(value, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal)); 
    735739                 //but we need to check if are inside a session and if the day changed, in order 
    736740                 //to make the request for the session timetable or the top level timetable 
    737                  if(exists(self.managementActions.timetable.parentTimetable)){ 
    738                      if(self.previousDate.substr(0,10) != self.dateArgs.get('selectedDay')) 
     741 
     742                 if(self.managementActions.timetable.IntervalTimetableMixin && 
     743                    /* if we chose a different day, it doesn't matter 
     744                        if we are inside a session */ 
     745                    self.previousDate.substr(0,10) != 
     746                    self.dateArgs.get('selectedDay')){ 
    739747                         self.timeStartMethod = "schedule.event.getDayEndDate"; 
    740                      else 
     748                     } else { 
    741749                         self.timeStartMethod = "schedule.slot.getDayEndDate"; 
     750                     } 
    742751                 } 
    743752                 //we make a timeStartMethod request specifying the date for the request 
    744                  //and we get the result of the request in result 
     753                 //and we get the result of the request as a result 
    745754                 indicoRequest(self.timeStartMethod, self.dateArgs , function(result, error){ 
    746755                     if (error) { 
     
    760769                  * parameterManager is not called because if you just change the date and it's not correct you just need 
    761770                  * to have red fields in the date, so what we're doing is just adding a dispatchEvent for both hour fields 
    762                   * (they are Html.input, so they can be added to the dispatchEvent) to know when they have changed                                  
     771                  * (they are Html.input, so they can be added to the dispatchEvent) to know when they have changed 
    763772                  */ 
    764773                 self.startTimeField.dispatchEvent('change'); 
     
    769778                     toTarget: function (value) { 
    770779                         var aux = conferenceDays.get(); 
    771                          return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.ServerHourSlashLess) + ' ' + value; 
     780                         return Util.formatDateTime(aux, IndicoDateTimeFormats.Server, IndicoDateTimeFormats.Ordinal) + ' ' + value; 
    772781                     }, 
    773782                     toSource: function(value) { 
     
    775784                     } 
    776785             }; 
    777               
     786 
    778787             // some properties have default values, and the initialization 
    779788             // of the binding must be set 
     
    786795                            this.timeField, 
    787796                            this.isEdit); 
    788               
     797 
    789798             self.parameterManager.add(self.startTimeField, 'time', false); 
    790799             self.parameterManager.add(self.timeField, 'unsigned_int', false); 
    791               
     800 
    792801             return this.ServiceDialog.prototype.draw.call( 
    793802                 this, 
     
    798807                         width: '300px' 
    799808                     } 
    800                  })), this.info.accessor('title'))],  
    801                   
     809                 })), this.info.accessor('title'))], 
     810 
    802811                 [$T('Description'), $B(Html.textarea({ 
    803812                     cols: 40, 
    804813                     rows: 2 
    805                  }), this.info.accessor('description'))],  
    806                  [$T('Place'), this.roomEditor.draw()],  
     814                 }), this.info.accessor('description'))], 
     815                 [$T('Place'), this.roomEditor.draw()], 
    807816                 [$T('Date'), conferenceDays], 
    808817                 [$T('Start time'), Html.div({class: 'popUpLabel', style:{textAlign: 'left'}}, this.startTimeField, 
     
    884893             /* 
    885894              * if we are inside a session and we add a break outside that session, in another day, 
    886               * we need to update the entry in the parentTimetable.  
     895              * we need to update the entry in the parentTimetable. 
    887896              */ 
    888897             this.ChangeEditDialog(managementActions.methods[args.get('type')].add, 
     
    892901                                         if(exists(managementActions.timetable.parentTimetable) && this.dayChanged) 
    893902                                             managementActions.timetable.parentTimetable._updateEntry(result, result.id); 
    894                                          else     
     903                                         else 
    895904                                             managementActions.timetable._updateEntry(result, result.id); 
    896905                                   }); 
  • indico/htdocs/js/indico/Timetable/Base.js

    r93394d r03e2c9  
    268268    }, 
    269269 
     270    getDays: function() { 
     271        return keys(this.data); 
     272    }, 
     273 
    270274    disable: function() { 
    271275        this.enabled = false; 
     
    474478        this.infoBox.set(this._getInfoBoxContent()); 
    475479 
     480    }, 
     481 
     482    getDays: function() { 
     483        return this.parentTimetable.getDays(); 
    476484    }, 
    477485 
  • indico/htdocs/js/indico/Timetable/Management.js

    r93394d r03e2c9  
    319319 
    320320        var params; 
    321          
    322         //Get the days in which the conference is being held 
    323         //if the contribution is inside a session we need to get the days from parentTimetable, not from timetable 
    324         if(exists(this.timetable.parentTimetable)) 
    325             var days = keys(this.timetable.parentTimetable.getData()); 
    326         else 
    327             var days = keys(this.timetable.getData()); 
     321 
     322        var days = this.timetable.getDays(); 
    328323 
    329324        if (this.session !== null) { 
     
    355350 
    356351        var params; 
    357          
    358         //Get the days in which the conference is being held 
    359         //if the break is inside a session we need to get the days from parentTimetable, not from timetable 
    360         if(exists(this.timetable.parentTimetable)) 
    361             var days = keys(this.timetable.parentTimetable.getData()); 
    362         else 
    363             var days = keys(this.timetable.getData()); 
     352 
     353        var days = this.timetable.getDays(); 
    364354 
    365355        if (this.session !== null) { 
     
    385375 
    386376        var params; 
    387          
    388         //Get the days in which the conference is being held 
    389         //if the break is inside a session we need to get the days from parentTimetable, not from timetable 
    390         if(exists(this.timetable.parentTimetable)) 
    391             var days = keys(this.timetable.parentTimetable.getData()); 
    392         else 
    393             var days = keys(this.timetable.getData()); 
     377 
     378        var days = this.timetable.getDays(); 
    394379 
    395380        if (this.session !== null) { 
     
    449434        var params = this._addToSessionParams(session, 'SessionSlot'); 
    450435        params.parentType = 'Session'; 
    451          
     436 
    452437        //Get the days in which the conference is being held 
    453438        var days = keys(this.timetable.getData()); 
     
    475460        //Get the days in which the conference is being held 
    476461        var days = keys(this.timetable.getData()); 
    477          
     462 
    478463        each(eventData, function(value, key) { 
    479464            params[key] = value; 
     
    499484                 * You need to create the aux before doing the updateEntry because otherwise the subentries 
    500485                 * in the session won't have the correct value 
    501                  */  
     486                 */ 
    502487                self.timetable.data[result.day][result.id].entries = aux; 
    503488            }, 
Note: See TracChangeset for help on using the changeset viewer.