| 1 | <% import MaKaC %> |
|---|
| 2 | <% import simplejson %> |
|---|
| 3 | |
|---|
| 4 | <tr> |
|---|
| 5 | <td class="titleCellTD"><span class="titleCellFormat"><%= _("Place")%></span></td> |
|---|
| 6 | |
|---|
| 7 | <td> |
|---|
| 8 | <div id ="roomChooser"></div> |
|---|
| 9 | </td> |
|---|
| 10 | </tr> |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | <script type="text/javascript"> |
|---|
| 14 | |
|---|
| 15 | <% if modifying: %> |
|---|
| 16 | var info = $O(<%= jsonEncode(roomInfo(event, level='own')) %>); |
|---|
| 17 | <% end %> |
|---|
| 18 | <% else: %> |
|---|
| 19 | var info = $O(); |
|---|
| 20 | <% end %> |
|---|
| 21 | |
|---|
| 22 | var parentEvt = |
|---|
| 23 | <% if showParent: %> |
|---|
| 24 | $O(<%= jsonEncode(parentRoomInfo) %>) |
|---|
| 25 | <% end %> |
|---|
| 26 | <% else: %> |
|---|
| 27 | false |
|---|
| 28 | <% end %>; |
|---|
| 29 | |
|---|
| 30 | IndicoUI.executeOnLoad(function() { |
|---|
| 31 | |
|---|
| 32 | <% if self._rh._target and not isinstance(self._rh._target, MaKaC.conference.Category): %> |
|---|
| 33 | <% eventFavorites = self._rh._target.getConference().getFavoriteRooms() %> |
|---|
| 34 | <% end %> |
|---|
| 35 | <% else: %> |
|---|
| 36 | <% eventFavorites = [] %> |
|---|
| 37 | <% end %> |
|---|
| 38 | |
|---|
| 39 | <% if conf: %> |
|---|
| 40 | var ttdata = <%= simplejson.dumps(MaKaC.schedule.ScheduleToJson.process(conf.getSchedule(), conf.getTimezone(), None, |
|---|
| 41 | days = None, mgmtMode = True)) %> ; |
|---|
| 42 | <% from MaKaC.common.Conversion import Conversion %> |
|---|
| 43 | var bookedRooms = <%= Conversion.reservationsList(conf.getRoomBookingList()) %>; |
|---|
| 44 | rbWidget = new RoomBookingReservationWidget(Indico.Data.Locations, info, parentEvt, nullRoomInfo(info), <%= eventFavorites %>, <% if modifying: %>null<%end%><%else:%>Indico.Data.DefaultLocation<%end%>, bookedRooms, ttdata, null, "<%= eventId %>"); |
|---|
| 45 | <% end %> |
|---|
| 46 | <% else: %> |
|---|
| 47 | rbWidget = new RoomBookingWidget(Indico.Data.Locations, info, parentEvt, nullRoomInfo(info), <%= eventFavorites %>, <% if modifying: %>null<%end%><%else:%>Indico.Data.DefaultLocation<%end%>); |
|---|
| 48 | <% end %> |
|---|
| 49 | |
|---|
| 50 | var domContent = rbWidget.draw(); |
|---|
| 51 | |
|---|
| 52 | $E('roomChooser').set(domContent); |
|---|
| 53 | |
|---|
| 54 | rbWidget.postDraw(); |
|---|
| 55 | |
|---|
| 56 | }); |
|---|
| 57 | |
|---|
| 58 | function injectValuesInForm(form, otherActions) { |
|---|
| 59 | |
|---|
| 60 | form.observeEvent('submit', function() { |
|---|
| 61 | each({'room': 'roomName','location': 'locationName', 'address': 'locationAddress'}, |
|---|
| 62 | function(val, key) { |
|---|
| 63 | // prevent problem with back button |
|---|
| 64 | var input = $E('jsGenerated_'+key) || Html.input('hidden', {id: 'jsGenerated_'+key, name: val}); |
|---|
| 65 | if (info.get(key) != null) { |
|---|
| 66 | input.set(info.get(key)); |
|---|
| 67 | form.append(input); |
|---|
| 68 | } |
|---|
| 69 | }); |
|---|
| 70 | if (otherActions) { |
|---|
| 71 | return otherActions(); |
|---|
| 72 | } |
|---|
| 73 | }); |
|---|
| 74 | |
|---|
| 75 | }; |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | </script> |
|---|