コード例 #1
0
    def export_reservation(self, user):
        locations = Location.find_all(Location.name.in_(self._locations))
        if not locations:
            return

        for room_id, reservation in _export_reservations(self, False, True):
            yield reservation
コード例 #2
0
 def _process_args(self):
     self._with_kpi = request.args.get('withKPI', type=bool)
     self._actionSucceeded = request.args.get('actionSucceeded',
                                              default=False,
                                              type=bool)
     location_name = request.view_args.get('locationId')
     self._location = Location.find_one(name=location_name)
コード例 #3
0
 def _process_args(self):
     self._locationName = request.form.get('newLocationName').strip()
     if not self._locationName:
         raise BadRequest(_('Location name may not be empty'))
     if '/' in self._locationName:
         raise BadRequest(_('Location name may not contain slashes'))
     if Location.find_first(name=self._locationName):
         raise BadRequest(
             _('Location "{0}" already exists').format(self._locationName))
コード例 #4
0
    def export_roomName(self, user):
        loc = Location.find_first(name=self._location)
        if loc is None:
            return

        search_str = '%{}%'.format(self._room_name)
        rooms_data = Room.get_with_data(
            'vc_equipment',
            'non_vc_equipment',
            filters=[
                Room.location_id == loc.id,
                or_((Room.building + '-' + Room.floor +
                     '-' + Room.number).ilike(search_str),
                    Room.name.ilike(search_str))
            ])

        for result in rooms_data:
            yield _serializable_room(result)
コード例 #5
0
 def _process_args(self):
     self._location = Location.find_first(name=self._param('location'))
     aspect_data = self._param('aspect')
     try:
         zoom_level = int(aspect_data.get('zoom_level', '0'))
     except ValueError:
         zoom_level = 0
     self._aspect = Aspect(
         name=aspect_data.get('name', ''),
         center_latitude=aspect_data.get('center_latitude', ''),
         center_longitude=aspect_data.get('center_longitude', ''),
         zoom_level=zoom_level,
         top_left_latitude=aspect_data.get('top_left_latitude', ''),
         top_left_longitude=aspect_data.get('top_left_longitude', ''),
         bottom_right_latitude=aspect_data.get('bottom_right_latitude', ''),
         bottom_right_longitude=aspect_data.get('bottom_right_longitude',
                                                ''))
     self._default_on_startup = aspect_data.get('DefaultOnStartup', False)
コード例 #6
0
    def _process_args(self):
        name = request.view_args.get('locationId')
        self._location = Location.find_one(name=name)
        self._new_attr = None
        attr_title = request.form.get('newCustomAttributeName',
                                      default='').strip()
        if attr_title:
            attr_name = attr_title.replace(' ', '-').lower()
            if self._location.get_attribute_by_name(attr_name):
                raise BadRequest(
                    _('There is already an attribute named: {0}').format(
                        attr_name))

            self._new_attr = RoomAttribute(
                name=attr_name,
                title=attr_title,
                type='str',
                is_required=request.form.get(
                    'newCustomAttributeIsRequired') == 'on',
                is_hidden=request.form.get(
                    'newCustomAttributeIsHidden') == 'on')
コード例 #7
0
    def export_room(self, user):
        loc = Location.find_first(name=self._location)
        if loc is None:
            return

        # Retrieve rooms
        rooms_data = list(
            Room.get_with_data(
                'vc_equipment',
                'non_vc_equipment',
                filters=[Room.id.in_(self._ids), Room.location_id == loc.id]))

        # Retrieve reservations
        reservations = None
        if self._detail == 'reservations':
            reservations = OrderedMultiDict(
                _export_reservations(self, True, False, [
                    Reservation.room_id.in_(x['room'].id for x in rooms_data)
                ]))

        for result in rooms_data:
            yield _serializable_room(result, reservations)
コード例 #8
0
def generate_global_file():
    locations = Location.find_all() if config.ENABLE_ROOMBOOKING else []
    location_names = {loc.name: loc.name for loc in locations}
    default_location = next((loc.name for loc in locations if loc.is_default),
                            None)
    ext_auths = [{
        'name': auth.name,
        'title': auth.title,
        'supports_groups': auth.supports_groups
    } for auth in multipass.identity_providers.itervalues()
                 if auth.supports_search]

    fossir_vars = {
        'Urls': {
            'Base':
            config.BASE_URL,
            'BasePath':
            url_parse(config.BASE_URL).path.rstrip('/'),
            'JsonRpcService':
            url_for('api.jsonrpc'),
            'ExportAPIBase':
            url_for('api.httpapi', prefix='export'),
            'APIBase':
            url_for('api.httpapi', prefix='api'),
            'ImagesBase':
            config.IMAGES_BASE_URL,
            'Login':
            url_for_login(),
            'Favorites':
            url_for('users.user_favorites'),
            'FavoriteUserAdd':
            url_for('users.user_favorites_users_add'),
            'FavoriteUserRemove':
            url_rule_to_js('users.user_favorites_user_remove'),
            'AttachmentManager':
            url_rule_to_js('attachments.management'),
            'ManagementAttachmentInfoColumn':
            url_rule_to_js('attachments.management_info_column'),
            'RoomBookingBookRoom':
            url_rule_to_js('rooms.room_book'),
            'RoomBookingBook':
            url_rule_to_js('rooms.book'),
            'RoomBookingDetails':
            url_rule_to_js('rooms.roomBooking-roomDetails'),
            'RoomBookingCloneBooking':
            url_rule_to_js('rooms.roomBooking-cloneBooking'),
            'APIKeyCreate':
            url_for('api.key_create'),
            'APIKeyTogglePersistent':
            url_for('api.key_toggle_persistent'),
            'FontSassBundle':
            core_env['fonts_sass'].urls(),
            'EventCreation':
            url_rule_to_js('events.create'),
            'RegistrationForm': {
                'section': {
                    'add':
                    url_rule_to_angular('event_registration.add_section'),
                    'modify':
                    url_rule_to_angular('event_registration.modify_section'),
                    'toggle':
                    url_rule_to_angular('event_registration.toggle_section'),
                    'move':
                    url_rule_to_angular('event_registration.move_section')
                },
                'field': {
                    'add':
                    url_rule_to_angular('event_registration.add_field'),
                    'modify':
                    url_rule_to_angular('event_registration.modify_field'),
                    'toggle':
                    url_rule_to_angular('event_registration.toggle_field'),
                    'move':
                    url_rule_to_angular('event_registration.move_field')
                },
                'text': {
                    'add': url_rule_to_angular('event_registration.add_text'),
                    'modify':
                    url_rule_to_angular('event_registration.modify_text'),
                    'toggle':
                    url_rule_to_angular('event_registration.toggle_text'),
                    'move': url_rule_to_angular('event_registration.move_text')
                }
            },
            'Timetable': {
                'management': url_rule_to_js('timetable.management'),
                'default_pdf': url_rule_to_js('timetable.export_default_pdf'),
                'pdf': url_rule_to_js('timetable.export_pdf'),
                'reschedule': url_rule_to_js('timetable.reschedule'),
                'breaks': {
                    'add': url_rule_to_js('timetable.add_break')
                },
                'contributions': {
                    'add':
                    url_rule_to_js('timetable.add_contribution'),
                    'notScheduled':
                    url_rule_to_js('timetable.not_scheduled'),
                    'schedule':
                    url_rule_to_js('timetable.schedule'),
                    'protection':
                    url_rule_to_js('contributions.manage_contrib_protection')
                },
                'sessionBlocks': {
                    'add': url_rule_to_js('timetable.add_session_block'),
                    'fit': url_rule_to_js('timetable.fit_session_block')
                },
                'sessions': {
                    'add': url_rule_to_js('timetable.add_session')
                },
                'entries': {
                    'delete': url_rule_to_js('timetable.delete_entry'),
                    'edit': url_rule_to_js('timetable.edit_entry'),
                    'editDatetime':
                    url_rule_to_js('timetable.edit_entry_datetime'),
                    'editTime': url_rule_to_js('timetable.edit_entry_time'),
                    'move': url_rule_to_js('timetable.move_entry'),
                    'shift': url_rule_to_js('timetable.shift_entries'),
                    'swap': url_rule_to_js('timetable.swap_entries'),
                    'info': {
                        'display': url_rule_to_js('timetable.entry_info'),
                        'manage':
                        url_rule_to_js('timetable.entry_info_manage'),
                    },
                }
            },
            'Contributions': {
                'display_contribution':
                url_rule_to_js('contributions.display_contribution')
            },
            'Sessions': {
                'display_session': url_rule_to_js('sessions.display_session')
            },
            'Categories': {
                'info': url_rule_to_js('categories.info'),
                'infoFrom': url_rule_to_js('categories.info_from'),
                'search': url_rule_to_js('categories.search')
            }
        },
        'Data': {
            'WeekDays': [
                'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
                'Friday', 'Saturday'
            ],
            'DefaultLocation':
            default_location,
            'Locations':
            location_names
        },
        'Settings': {
            'ExtAuthenticators': ext_auths,
            'RoomBookingModuleActive': config.ENABLE_ROOMBOOKING
        },
        'FileRestrictions': {
            'MaxUploadFilesTotalSize': config.MAX_UPLOAD_FILES_TOTAL_SIZE,
            'MaxUploadFileSize': config.MAX_UPLOAD_FILE_SIZE
        }
    }

    return render_template('assets/vars_globals.js',
                           fossir_vars=fossir_vars,
                           config=config)
コード例 #9
0
 def _process_args(self):
     self._location = Location.find_first(name=self._param('location'))
コード例 #10
0
 def _process(self):
     is_default = Location.find().count() == 0
     db.session.add(Location(name=self._locationName,
                             is_default=is_default))
     flash(_(u'Location added'), 'success')
     return redirect(url_for('rooms_admin.roomBooking-admin'))
コード例 #11
0
 def _process_args(self):
     self._location = Location.get(int(request.form['location_id']))
     if not self._location:
         raise NotFound(u'No such location')
コード例 #12
0
 def _process(self):
     return WPRoomBookingAdmin(self,
                               'rb-rooms',
                               locations=Location.find_all()).display()
コード例 #13
0
 def _process_args(self):
     self._eq = request.form.get(self.PARAM)
     name = request.view_args.get('locationId')
     self._location = Location.find_one(name=name)
コード例 #14
0
 def _process_args(self):
     name = request.view_args.get('locationId')
     self._location = Location.find_one(name=name)
     self._attr = request.args.get('removeCustomAttributeName', '')
コード例 #15
0
 def _create_location(name, **params):
     location = Location(name=name, **params)
     db.session.add(location)
     db.session.flush()
     return location