Changeset 75eb781 in indico


Ignore:
Timestamp:
03/28/11 16:32:29 (2 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
ce4589
Parents:
55c97c
git-author:
Adrian Moennich <jerome.ernst.monnich@…> (03/22/11 14:12:44)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (03/28/11 16:32:29)
Message:

[IMP] Preserve info when booking from map

  • Preserve the dates/times and repeatability when booking from calendar after filtering by those fields.
Location:
indico
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/webinterface/rh/roomBooking.py

    r55c97c r75eb781  
    515515        monthM = params.get("month") 
    516516        yearY = params.get("year") 
     517        dayEnd = params.get("dayEnd") 
     518        monthEnd = params.get("monthEnd") 
     519        yearEnd = params.get("yearEnd") 
     520 
     521        hourStart = params.get("hour") 
     522        minuteStart = params.get("minute") 
     523        hourEnd = params.get("hourEnd") 
     524        minuteEnd = params.get("minuteEnd") 
     525        repeatability = params.get("repeatability") 
     526 
     527        if hourStart and minuteStart and hourStart.isdigit() and minuteStart.isdigit(): 
     528            hourStart = int(hourStart) 
     529            minuteStart = int(minuteStart) 
     530        else: 
     531            hourStart = 8 
     532            minuteStart = 30 
     533 
     534        if hourEnd and minuteEnd and hourEnd.isdigit() and minuteEnd.isdigit(): 
     535            hourEnd = int(hourEnd) 
     536            minuteEnd = int(minuteEnd) 
     537        else: 
     538            hourEnd = 17 
     539            minuteEnd = 30 
    517540 
    518541        if dayD != None and dayD.isdigit() and \ 
    519542           monthM != None and monthM.isdigit() and \ 
    520543           yearY != None and yearY.isdigit(): 
    521             candResv.startDT = datetime(int(yearY), int(monthM), int(dayD), 8, 30) 
    522             candResv.endDT = datetime(int(yearY), int(monthM), int(dayD), 17, 30) 
     544            candResv.startDT = datetime(int(yearY), int(monthM), int(dayD), hourStart, minuteStart) 
     545            if dayEnd != None and dayEnd.isdigit() and \ 
     546               monthEnd != None and monthEnd.isdigit() and \ 
     547               yearEnd!= None and yearEnd.isdigit(): 
     548                candResv.endDT = datetime(int(yearEnd), int(monthEnd), int(dayEnd), hourEnd, minuteEnd) 
     549                if candResv.endDT.date() != candResv.startDT.date() and candResv.repeatability is None: 
     550                    candResv.repeatability = RepeatabilityEnum.daily 
     551            else: 
     552                candResv.endDT = datetime(int(yearY), int(monthM), int(dayD), hourEnd, minuteEnd) 
    523553        else: 
    524554            if candResv.startDT == None: 
    525                 candResv.startDT = datetime( now.year, now.month, now.day, 8, 30 ) 
     555                candResv.startDT = datetime( now.year, now.month, now.day, hourStart, minuteStart ) 
    526556            if candResv.endDT == None: 
    527                 candResv.endDT = datetime( now.year, now.month, now.day, 17, 30 ) 
     557                candResv.endDT = datetime( now.year, now.month, now.day, hourEnd, minuteEnd ) 
     558        if repeatability is not None: 
     559            if repeatability == 'None': 
     560                candResv.repeatability = None 
     561            else: 
     562                candResv.repeatability = int(repeatability) 
    528563        if self._getUser(): 
    529564            if candResv.bookedForName == None: 
     
    542577            candResv.needsAVCSupport = False 
    543578 
    544         if not ws.getVar( "dontAssign" ): 
     579        if not ws.getVar( "dontAssign" ) and not params.get("ignoreSession"): 
    545580            if ws.getVar( "defaultStartDT" ): 
    546581                candResv.startDT = ws.getVar( "defaultStartDT" ) 
  • indico/htdocs/js/indico/RoomBooking/MapOfRooms.js

    rc31158 r75eb781  
    197197 
    198198            // "Book" link 
    199             var book = Html.a({href:room.bookingUrl, target:'_parent', className:'mapBookRoomLink'}, $T("Book")); 
     199            var bookingUrl = room.bookingUrl; 
     200            if($E('isAvailable').dom.checked) { 
     201                bookingUrl += '&ignoreSession=on'; 
     202                each({ 
     203                    sDay: 'day', 
     204                    sMonth: 'month', 
     205                    sYear: 'year', 
     206                    eDay: 'dayEnd', 
     207                    eMonth: 'monthEnd', 
     208                    eYear: 'yearEnd', 
     209                    repeatability: 'repeatability' 
     210                }, function(param, field) { 
     211                    bookingUrl += '&' + param + '=' + encodeURIComponent($E(field).dom.value); 
     212                }); 
     213 
     214                var sTime = $E('sTime').dom.value.split(':'); 
     215                var eTime = $E('eTime').dom.value.split(':'); 
     216                if(sTime.length == 2 && eTime.length == 2) { 
     217                    bookingUrl += '&hour=' + parseInt(sTime[0], 10); 
     218                    bookingUrl += '&minute=' + parseInt(sTime[1], 10); 
     219                    bookingUrl += '&hourEnd=' + parseInt(eTime[0], 10); 
     220                    bookingUrl += '&minuteEnd=' + parseInt(eTime[1], 10); 
     221                } 
     222            } 
     223            var book = Html.a({href:bookingUrl, target:'_parent', className:'mapBookRoomLink'}, $T("Book")); 
    200224 
    201225            // "More" link - for room details 
Note: See TracChangeset for help on using the changeset viewer.