Example #1
0
def render_book_body(context,**pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        latex_escape = context.get('latex_escape', UNDEFINED)
        contribs = context.get('contribs', UNDEFINED)
        _session = context.get('_session', UNDEFINED)
        show_ids = context.get('show_ids', UNDEFINED)
        event = context.get('event', UNDEFINED)
        def book_body():
            return render_book_body(context)
        __M_writer = context.writer()
        __M_writer('\n')
        for contrib in contribs:
            if contrib.can_access(_session.user):
                __M_writer('            \\fancyhead[L]{\\small \\rmfamily \\color{gray} \\truncateellipses{')
                __M_writer(latex_escape(str(encode_if_unicode(event.title ))))
                __M_writer('}{300pt} / ')
                __M_writer(latex_escape(str(encode_if_unicode(_("Book of Abstracts") ))))
                __M_writer('}\n            \\fancyhead[R]{}\n\n            \\phantomsection\n            \\addcontentsline{toc}{chapter}{')
                __M_writer(latex_escape(str(encode_if_unicode(contrib.title ))))
                __M_writer(' ')
                __M_writer(str(encode_if_unicode(('{0}').format(contrib.friendly_id) if show_ids else '')))
                __M_writer('\n            }\n\n            ')
                runtime._include_file(context, 'inc/contribution_condensed.tpl', _template_uri, contrib=contrib)
                __M_writer('\n            \\vspace{3em}\n\n\n            \\fancyfoot[C]{\\small \\rmfamily \\color{gray} ')
                __M_writer(str(encode_if_unicode( latex_escape(_("Page {0}"), ignore_braces=True).format(r"\thepage") )))
                __M_writer('}\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
def render_body(context,**pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        imgSrc = context.get('imgSrc', UNDEFINED)
        helpContent = context.get('helpContent', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('\n<span class="contextHelp" title="')
        __M_writer(str(encode_if_unicode( helpContent )))
        __M_writer('">\n   <img style="padding-left:5px; vertical-align: middle;" src="')
        __M_writer(str(encode_if_unicode( imgSrc )))
        __M_writer('" />\n</span>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #3
0
    def _applyConfDisplayDecoration(self, body):
        frame = WConfDisplayFrame(self._conf)
        event = self._conf.as_event

        announcement = ''
        if layout_settings.get(event, 'show_announcement'):
            announcement = layout_settings.get(event, 'announcement')

        frameParams = {
            "confModifURL": url_for('event_management.settings', event),
            "logoURL": self.logo_url,
            "currentURL": request.url,
            "announcement": announcement,
            'active_menu_entry_id': self.sidemenu_option
        }
        if self.event.has_logo:
            frameParams["logoURL"] = self.logo_url
        body = '''
            <div class="confBodyBox clearfix {}">
                <div class="mainContent">
                    <div class="col2">
                        {}
                    </div>
                </div>
            </div>
        '''.format('event-locked' if event.is_locked else '',
                   encode_if_unicode(body))
        return frame.getHTML(body, frameParams)
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        helpId = context.get('helpId', UNDEFINED)
        imgSrc = context.get('imgSrc', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('\n<span class="contextHelp" data-src="#')
        __M_writer(str(encode_if_unicode(helpId)))
        __M_writer(
            '">\n   <span style="color: Green; margin-left: 6px; font-size:smaller;"><img style="vertical-align:text-bottom;border: None;" src="'
        )
        __M_writer(str(encode_if_unicode(imgSrc)))
        __M_writer('" alt="Tooltip" /></span>\n</span>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #5
0
def render_content(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        latex_escape = context.get('latex_escape', UNDEFINED)

        def table_of_contents():
            return render_table_of_contents(context)

        contribs = context.get('contribs', UNDEFINED)

        def content():
            return render_content(context)

        md_convert = context.get('md_convert', UNDEFINED)

        def first_page():
            return render_first_page(context)

        user = context.get('user', UNDEFINED)
        boa_text = context.get('boa_text', UNDEFINED)
        event = context.get('event', UNDEFINED)

        def book_body():
            return render_book_body(context)

        __M_writer = context.writer()
        __M_writer(
            '\n    \\setcounter{tocdepth}{0} %% remove table of contents numbering\n\n'
        )
        __M_writer('   %% first page\n    \\frontmatter\n    ')
        if 'parent' not in context._data or not hasattr(
                context._data['parent'], 'first_page'):
            context['self'].first_page(**pageargs)

        __M_writer('\n\n')
        if boa_text:
            __M_writer(
                '        \\begin{boa_text}\n            \\thispagestyle{fancy}\n            \\fancyhead{}\n            \\vspace{1em}\n            \\normalsize {\n                \\rmfamily {\n                    '
            )
            __M_writer(str(encode_if_unicode(md_convert(boa_text))))
            __M_writer(
                '\n                }\n            }\n            \\fancyfoot[C]{\\thepage}\n        \\end{boa_text}\n'
            )
        __M_writer('\n    ')
        if 'parent' not in context._data or not hasattr(
                context._data['parent'], 'table_of_contents'):
            context['self'].table_of_contents(**pageargs)

        __M_writer('\n\n')
        __M_writer('   %% body\n    \\mainmatter\n    ')
        if 'parent' not in context._data or not hasattr(
                context._data['parent'], 'book_body'):
            context['self'].book_body(**pageargs)

        __M_writer('\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
def render_body(context,**pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        tabs = context.get('tabs', UNDEFINED)
        body = context.get('body', UNDEFINED)
        activeTab = context.get('activeTab', UNDEFINED)
        tabControlId = context.get('tabControlId', UNDEFINED)
        enumerate = context.get('enumerate', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('<div class="static-tabs" style="display:table; width:100%;" data-active="')
        __M_writer(str(encode_if_unicode(activeTab)))
        __M_writer('">\n    <ul>\n')
        for i, (label, link, active, className) in enumerate(tabs):
            __M_writer('            <li><a href="')
            __M_writer(str(encode_if_unicode(('#static-tabs-%s-content' % tabControlId) if active else link)))
            __M_writer('" ')
            __M_writer(str(encode_if_unicode('class='+className if className else '')))
            __M_writer(' data-href="')
            __M_writer(str(encode_if_unicode(link)))
            __M_writer('">')
            __M_writer(str(encode_if_unicode(label)))
            __M_writer('</a></li>\n')
        __M_writer('    </ul>\n\n    <div id="static-tabs-')
        __M_writer(str(encode_if_unicode(tabControlId)))
        __M_writer('-content">\n        ')
        __M_writer(str(encode_if_unicode( body )))
        __M_writer('\n    </div>\n</div>')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #7
0
 def cleanText(self, text):
     # clean the text from illegal XML characters
     cm = []
     for c in range(256):
         if c < 0x20 and chr(c) not in '\t\r\n':
             cm.append(" ")
         else:
             cm.append(chr(c))
     return str(encode_if_unicode(text)).translate("".join(cm))
Example #8
0
 def cleanText(self, text):
     # clean the text from illegal XML characters
     cm = []
     for c in range(256):
         if c < 0x20 and chr(c) not in '\t\r\n':
             cm.append(" ")
         else:
             cm.append(chr(c))
     return str(encode_if_unicode(text)).translate("".join(cm))
Example #9
0
def render_body(context,errors,msg,**pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(msg=msg,pageargs=pageargs,errors=errors)
        __M_writer = context.writer()
        __M_writer('\n')
        if errors:
            __M_writer('    <div class="error-message-box">\n        <div class="message-text">\n            ')
            __M_writer(str(encode_if_unicode( msg )))
            __M_writer(':\n            <ul>\n')
            for error in errors:
                __M_writer('                    <li>')
                __M_writer(str(encode_if_unicode( error )))
                __M_writer('</li>\n')
            __M_writer('            </ul>\n        </div>\n    </div>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #10
0
def render_header_extra(context,**pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        def header_extra():
            return render_header_extra(context)
        parent = context.get('parent', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('\n    ')
        __M_writer(str(encode_if_unicode(parent.header_extra())))
        __M_writer('\n    ')
        runtime._include_file(context, 'inc/toc_definitions.tpl', _template_uri)
        __M_writer('\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #11
0
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        __M_writer = context.writer()
        __M_writer(
            '\n            <!-- Repeatition -->\n            <div id="repetitionHelp" class="tip">\n                 '
        )
        __M_writer(
            str(
                encode_if_unicode(
                    _("""If you want to create repeating booking,
                just select repeating Type to what you prefer.
                System will deduce week day and week of a month if necessary,
                using start date you have provided."""))))
        __M_writer('\n                <br />\n            </div>\n\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        my_rooms = context.get('my_rooms', UNDEFINED)
        errors = context.get('errors', UNDEFINED)
        form = context.get('form', UNDEFINED)
        rooms = context.get('rooms', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('<h2 class="page-title">\n    ')
        __M_writer(str(encode_if_unicode(_('Search bookings'))))
        __M_writer('\n</h2>\n\n')
        runtime._include_file(
            context,
            'ErrorList.tpl',
            _template_uri,
            errors=errors,
            msg=_("There are some errors in the search criteria"))
        __M_writer(
            '\n\n<form method="post" action="" id="searchBookings">\n    ')
        __M_writer(
            str(encode_if_unicode(
                form.csrf_token() if form.meta.csrf else '')))
        __M_writer(
            '\n    <h2 class="group-title">\n        <i class="icon-location"></i>\n        '
        )
        __M_writer(str(encode_if_unicode(_('Taking place in'))))
        __M_writer(
            '\n    </h2>\n\n    <div id="roomselector"></div>\n\n    <div id="timespan">\n        <h2 class="group-title">\n            <i class="icon-time"></i>\n            '
        )
        __M_writer(str(encode_if_unicode(_('Timespan'))))
        __M_writer(
            '\n        </h2>\n\n        <div class="toolbar thin space-after">\n            <div class="group with-datepicker">\n                <span class="i-button label heavy">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('Start Date'))))
        __M_writer(
            '\n                </span>\n                <span class="datepicker thin">\n                    <input type="text" name="start_date" id="start_date"/>\n                </span>\n            </div>\n\n            <div class="group right with-datepicker">\n                <span class="i-button label heavy">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('End Date'))))
        __M_writer(
            '\n                </span>\n                <span class="datepicker thin">\n                    <input type="text" name="end_date" id="end_date"/>\n                </span>\n            </div>\n        </div>\n        <div id="timerange"></div>\n    </div>\n\n    <div id="bookingDetails">\n        <h2 class="group-title">\n            <i class="icon-info"></i>\n            '
        )
        __M_writer(str(encode_if_unicode(_('Booking details'))))
        __M_writer(
            '\n        </h2>\n\n        <div class="toolbar thin space-after">\n            <div class="group">\n                <span class="i-button label">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('Booked for'))))
        __M_writer(
            '\n                </span>\n                <input size="30" type="text" id="booked_for_name" name="booked_for_name"\n                    placeholder="'
        )
        __M_writer(str(encode_if_unicode(_('Enter name...'))))
        __M_writer(
            '" />\n            </div>\n        </div>\n        <div class="toolbar thin space-after">\n            <div class="group">\n                <span class="i-button label">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('Reason'))))
        __M_writer(
            '\n                </span>\n                <input size="30" type="text" id="reason" name="reason"\n                    placeholder="'
        )
        __M_writer(str(encode_if_unicode(_('Enter reason...'))))
        __M_writer(
            '"/>\n            </div>\n        </div>\n\n        <div class="toolbar thin space-after table">\n            <div class="group i-selection">\n                <span class="i-button label">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('Booked'))))
        __M_writer(
            '\n                </span>\n                <input type="radio" id="any_booker" name="is_only_mine" value="false" checked/>\n                <label for="any_booker" class="i-button"\n                    title="'
        )
        __M_writer(str(encode_if_unicode(_('Shows all bookings'))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Anyone'))))
        __M_writer(
            '\n                </label>\n                <input type="radio" id="only_mine" name="is_only_mine" value="true"/>\n                <label for="only_mine" class="i-button"\n                    title="'
        )
        __M_writer(str(encode_if_unicode(_('Filter by your bookings'))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Me'))))
        __M_writer(
            '\n                </label>\n            </div>\n        </div>\n\n        <div class="toolbar thin space-after table">\n            <div class="group i-selection">\n                <span class="i-button label">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('Type'))))
        __M_writer(
            '\n                </span>\n                <input type="checkbox" id="is_only_bookings" name="is_only_bookings"/>\n                <label for="is_only_bookings" class="i-button"\n                    title="'
        )
        __M_writer(str(encode_if_unicode(_('Filter by confirmed bookings'))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Bookings'))))
        __M_writer(
            '\n                </label>\n                <input type="checkbox" id="is_only_pre_bookings" name="is_only_pre_bookings"/>\n                <label for="is_only_pre_bookings" class="i-button"\n                    title="'
        )
        __M_writer(str(encode_if_unicode(_('Filter by pre-bookings'))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Pre-Bookings'))))
        __M_writer(
            '\n                </label>\n            </div>\n        </div>\n\n        <div class="toolbar thin space-after table">\n            <div class="group i-selection">\n                <span class="i-button label">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('State'))))
        __M_writer(
            '\n                </span>\n                <input type="checkbox" id="is_rejected" name="is_rejected"/>\n                <label for="is_rejected" class="i-button"\n                    title="'
        )
        __M_writer(str(encode_if_unicode(_('Filter by rejected bookings'))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Rejected'))))
        __M_writer(
            '\n                </label>\n                <input type="checkbox" id="is_cancelled" name="is_cancelled"/>\n                <label for="is_cancelled" class="i-button"\n                    title="'
        )
        __M_writer(str(encode_if_unicode(_('Filter by cancelled bookings'))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Cancelled'))))
        __M_writer(
            '\n                </label>\n                <input type="checkbox" id="is_archived" name="is_archived"/>\n                <label for="is_archived" class="i-button"\n                    title="'
        )
        __M_writer(str(encode_if_unicode(_('Filter by archived bookings'))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Archived'))))
        __M_writer(
            '\n                </label>\n            </div>\n        </div>\n\n        <div class="toolbar thin space-after table">\n            <div class="group i-selection">\n                <span class="i-button label">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('Services'))))
        __M_writer(
            '\n                </span>\n                <input type="checkbox" id="uses_vc" name="uses_vc"/>\n                <label for="uses_vc" class="i-button"\n                    title="'
        )
        __M_writer(
            str(
                encode_if_unicode(
                    _('Filter by bookings which will use videoconference systems'
                      ))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Videoconference'))))
        __M_writer(
            '\n                </label>\n            </div>\n        </div>\n\n        <div class="toolbar thin table">\n            <div class="group i-selection">\n                <span class="i-button label">\n                    '
        )
        __M_writer(str(encode_if_unicode(_('Assistance'))))
        __M_writer(
            '\n                </span>\n                <input type="checkbox" id="needs_vc_assistance" name="needs_vc_assistance"/>\n                <label for="needs_vc_assistance" class="i-button"\n                    title="'
        )
        __M_writer(
            str(
                encode_if_unicode(
                    _('Filter by bookings which requested assistance for the startup of the videoconference session'
                      ))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Videoconference'))))
        __M_writer(
            '\n                </label>\n                <input type="checkbox" id="needs_assistance" name="needs_assistance"/>\n                <label for="needs_assistance" class="i-button"\n                    title="'
        )
        __M_writer(
            str(
                encode_if_unicode(
                    _('Filter by bookings which requested assistance for the startup of the meeting'
                      ))))
        __M_writer('">\n                    ')
        __M_writer(str(encode_if_unicode(_('Startup'))))
        __M_writer(
            '\n                </label>\n            </div>\n        </div>\n    </div>\n\n    <h2 class="group-title"></h2>\n    <div class="submit-button-wrapper">\n        <button type="send" class="i-button highlight">\n            <i class="icon-search"></i>\n            <span>\n                '
        )
        __M_writer(str(encode_if_unicode(_('Search'))))
        __M_writer(
            '\n            </span>\n        </button>\n    </div>\n</form>\n\n<script>\n    var rooms = '
        )
        __M_writer(
            j([r.to_serializable('__public_exhaustive__') for r in rooms]))
        __M_writer(';\n    var myRooms = ')
        __M_writer(j(my_rooms))
        __M_writer(
            ";\n\n    function adjustDates(s, e) {\n        if (s.datepicker('getDate') > e.datepicker('getDate'))\n            e.datepicker('setDate', s.datepicker('getDate'));\n    }\n\n    function initWidgets() {\n        $('#roomselector').roomselector({\n            allowEmpty: false,\n            rooms: rooms,\n            myRooms: myRooms,\n            selectName: 'room_ids',\n            simpleMode: true\n        });\n\n        $('#timerange').timerange({\n            sliderWidth: '320px'\n        });\n\n        var s = $('#start_date'), e = $('#end_date');\n        $('#start_date, #end_date').datepicker({\n            onSelect: function() {\n                adjustDates(s, e);\n                $('#searchBookings').trigger('change');\n            }\n        });\n        s.datepicker('setDate', '+0');\n        e.datepicker('setDate', '+6');\n    }\n\n    // Reads out the invalid textboxes and returns false if something is invalid.\n    // Returns true if form may be submited.\n    function forms_are_valid() {\n        // Clean up - make all textboxes white again\n        var searchForm = $('#searchBookings');\n        $(':input', searchForm).removeClass('hasError');\n\n        // Init\n        var isValid = true;\n\n        // Datepicker\n        if (!moment($('#start_date').val(), 'DD/MM/YYYY').isValid()) {\n            isValid = false;\n            $('#start_date').addClass('hasError');\n        }\n        if (!moment($('#end_date').val(), 'DD/MM/YYYY').isValid()) {\n            isValid = false;\n            $('#end_date').addClass('hasError');\n        }\n\n        // Time period\n        isValid = isValid && $('#timerange').timerange('validate');\n\n        return isValid;\n    }\n\n    $(function() {\n        initWidgets();\n\n        $('#searchBookings').delegate(':input', 'keyup change', function() {\n            forms_are_valid();\n        }).submit(function(e) {\n            if (!forms_are_valid(true)) {\n                new AlertPopup($T('Error'), $T('There are errors in the form. Please correct fields with red background.')).open();\n                e.preventDefault();\n            }\n            else if(!$('#roomselector').roomselector('validate')) {\n                new AlertPopup($T('Select room'), $T('Please select a room (or several rooms).')).open();\n                e.preventDefault();\n            }\n        });\n    });\n</script>\n"
        )
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #13
0
 def wrapper(*args, **kwargs):
     return encode_if_unicode(fn(*args, **kwargs))
Example #14
0
def render_body(context,
                form=None,
                flexibility=False,
                can_override=False,
                min_date=None,
                date_changed=None,
                past_date=None,
                **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(can_override=can_override,
                                      form=form,
                                      pageargs=pageargs,
                                      min_date=min_date,
                                      flexibility=flexibility,
                                      date_changed=date_changed,
                                      past_date=past_date)
        booking_limit = context.get('booking_limit', UNDEFINED)
        serializable_room = context.get('serializable_room', UNDEFINED)
        room = context.get('room', UNDEFINED)
        min = context.get('min', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('\n')
        from datetime import datetime

        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(
            __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                              for __M_key in ['datetime']
                              if __M_key in __M_locals_builtin_stored]))
        __M_writer(
            '\n\n<!-- Slider -->\n<div id="timerange"></div>\n\n<!-- Repeatibility options -->\n<div class="toolbar thin space-before space-after">\n    <div id="repeatability" class="group i-selection">\n        <span class="i-button label">'
        )
        __M_writer(str(encode_if_unicode(_('Frequency'))))
        __M_writer('</span>\n')
        for option in form.repeat_frequency:
            __M_writer('            ')
            __M_writer(str(encode_if_unicode(option)))
            __M_writer('\n            ')
            __M_writer(str(encode_if_unicode(option.label(class_='i-button'))))
            __M_writer('\n')
        __M_writer('    </div>\n\n')
        if flexibility:
            __M_writer(
                '        <div id="flexibleDates" class="group i-selection">\n            <span class="i-button label">'
            )
            __M_writer(str(encode_if_unicode(_('Flexibility'))))
            __M_writer('</span>\n')
            for option in form.flexible_dates_range:
                __M_writer('                ')
                __M_writer(str(encode_if_unicode(option)))
                __M_writer('\n                ')
                __M_writer(
                    str(encode_if_unicode(option.label(class_='i-button'))))
                __M_writer('\n')
            __M_writer('        </div>\n')
        __M_writer(
            '</div>\n\n<!-- Datepicker -->\n<div id="datePeriod">\n    <div id="sDatePlaceDiv" class="datepicker" style="clear: both;">\n        <div id="sDatePlaceTitle" class="datepicker-title">'
        )
        __M_writer(str(encode_if_unicode(_('Booking date'))))
        __M_writer(
            '</div>\n        <div id="sDatePlace"></div>\n    </div>\n    <div id="eDatePlaceDiv" class="datepicker" style="display:none;">\n        <div id=\'eDatePlaceTitle\' class=\'datepicker-title\'>'
        )
        __M_writer(str(encode_if_unicode(_('End date'))))
        __M_writer(
            '</div>\n        <div id="eDatePlace"></div>\n    </div>\n    <div class="datepicker-info">\n'
        )
        if room and room.max_advance_days:
            __M_writer(
                '            <div class="info-message-box">\n                <div class="message-text">\n                    '
            )
            __M_writer(
                str(
                    encode_if_unicode(
                        _('This room can only be booked {0} days in advance').
                        format(room.max_advance_days))))
            __M_writer('\n                </div>\n            </div>\n')
        __M_writer(
            '        <div id="holidays-warning" class="info-message-box" style="display: none">\n            <div class="message-text"></div>\n        </div>\n'
        )
        if past_date:
            __M_writer(
                '            <div class="highlight-message-box js-default-date-warning">\n                <div class="message-text">\n                    '
            )
            __M_writer(
                str(
                    encode_if_unicode(
                        _("Looks like you were trying to book a room in the past so we moved you forward to the present."
                          ))))
            __M_writer('\n                </div>\n            </div>\n')
        if date_changed:
            __M_writer(
                '            <div class="highlight-message-box js-default-date-warning">\n                <div class="message-text">\n                    '
            )
            __M_writer(
                str(
                    encode_if_unicode(
                        _("It's late, so we selected the next day for you."))))
            __M_writer('<br>\n                    <small> ')
            __M_writer(
                str(
                    encode_if_unicode(
                        _("You can still select today in the calendar."))))
            __M_writer(
                '</small>\n                </div>\n            </div>\n')
        __M_writer(
            '        <div class="error-message-box booking-limit-warning hidden">\n            <div class="message-text">\n                '
        )
        __M_writer(
            str(
                encode_if_unicode(
                    _('It is not possible to book the selected room for more than {0} days'
                      ).format(booking_limit))))
        __M_writer(
            '\n            </div>\n        </div>\n        <div class="error-message-box booking-limit-room-warning hidden">\n            <div class="message-text"></div>\n        </div>\n    </div>\n</div>\n\n'
        )
        __M_writer(str(encode_if_unicode(form.start_dt(type='hidden'))))
        __M_writer('\n')
        __M_writer(str(encode_if_unicode(form.end_dt(type='hidden'))))
        __M_writer('\n')
        __M_writer(str(encode_if_unicode(form.repeat_interval(type='hidden'))))
        __M_writer(
            '\n\n<script>\n    $(document).ready(function() {\n        \'use strict\';\n\n        function checkFrequency() {\n            var frequency = $(\'#repeatability input:radio[name=repeat_frequency]:checked\').val();\n\n            if (frequency === \'0\') {\n                $(\'#sDatePlaceTitle\').text("'
        )
        __M_writer(str(encode_if_unicode(_('Booking date'))))
        __M_writer(
            '");\n                $(\'#eDatePlaceDiv\').hide();\n                $(\'#repeat_interval\').val(\'0\');\n            } else {\n                $(\'#sDatePlaceTitle\').text("'
        )
        __M_writer(str(encode_if_unicode(_('Start date'))))
        __M_writer(
            '");\n                $(\'#eDatePlaceDiv\').show();\n                $(\'#repeat_interval\').val(\'1\');\n                disableInvalidDays();\n                refreshDatePicker($(\'#eDatePlace\'));\n                selectEndDate();\n            }\n\n            $(\'#flexibleDates input:radio\').prop(\'disabled\', frequency === \'1\');\n        }\n\n        function combineDatetime() {\n            var startDate = moment($(\'#sDatePlace\').datepicker(\'getDate\')).format(\'D/MM/YYYY\');\n            var endDate = moment($(\'#eDatePlace\').datepicker(\'getDate\')).format(\'D/MM/YYYY\');\n            var startTime = $(\'#timerange\').timerange(\'getStartTime\');\n            var endTime = $(\'#timerange\').timerange(\'getEndTime\');\n\n\n            $(\'#start_dt\').val(\'{0} {1}\'.format(startDate, startTime));\n            $(\'#end_dt\').val(\'{0} {1}\'.format(endDate, endTime));\n        }\n\n        function checkHolidays() {\n            var data = {};\n            var repeat_frequency = $(\'input[name=repeat_frequency]:checked\').val();\n\n            data.start_date = moment($(\'#start_dt\').val(), \'D/MM/YYYY H:m\').format(\'YYYY-MM-D\');\n            if (repeat_frequency !== \'0\') {\n                data.end_date = moment($(\'#end_dt\').val(), \'D/MM/YYYY H:m\').format(\'YYYY-MM-D\')\n            } else {\n                data.end_date = data.start_date;\n            }\n\n            var holidaysWarning = indicoSource(\'roomBooking.getDateWarning\', data);\n            holidaysWarning.state.observe(function(state) {\n                if (state == SourceState.Loaded) {\n                    var msg = holidaysWarning.get();\n                    $(\'#holidays-warning .message-text\').html(msg);\n                    $(\'#holidays-warning\').toggle(!!msg);\n                }\n            });\n        }\n\n        function disableInvalidDays() {\n            var startDate = $(\'#sDatePlace\').datepicker(\'getDate\');\n            var endMonth = +$(\'#eDatePlace .ui-datepicker-month\').val();\n            var endYear = +$(\'#eDatePlace .ui-datepicker-year\').val();\n            // Create a date on the first of the month, two months after the endMonth, endYear values.\n            var endDate = new Date(endMonth > 9 ? endYear + 1 : endYear, (endMonth + 2) % 12, 1);\n            var frequency = $(\'#repeatability input:radio[name=repeat_frequency]:checked\').val();\n\n            validEndDates = generateValidEndDates(startDate, endDate, frequencies[frequency]);\n        }\n\n        function selectEndDate() {\n            var repetition = {};\n            repetition[RRule.DAILY] = \'days\';\n            repetition[RRule.WEEKLY] = \'weeks\';\n            repetition[RRule.MONTHLY] = \'months\';\n\n            var startDate = $(\'#sDatePlace\').datepicker(\'getDate\');\n            var selectedEndDate = $(\'#eDatePlace\').datepicker(\'getDate\');\n            var frequency = frequencies[$(\'#repeatability input:radio[name=repeat_frequency]:checked\').val()];\n            var forceSetEndDate = false;\n            var endDate;\n\n            if (selectedEndDate.getTime() <= startDate.getTime()) {\n                endDate = moment(startDate).add(2, repetition[frequency]).toDate();\n                forceSetEndDate = true;\n            } else {\n                endDate = moment(selectedEndDate).add(1, repetition[frequency]).toDate();\n            }\n            var endDates = generateValidEndDates(startDate, endDate, frequency);\n\n            if (endDates !== null && endDates.length &&\n                    (forceSetEndDate || endDates.indexOf(selectedEndDate.getTime()) === -1)) {\n                $(\'#eDatePlace\').datepicker(\'setDate\', getClosestDate(endDates, selectedEndDate));\n                refreshDatePicker($(\'#eDatePlace\'));\n            }\n        }\n\n        function commonOnSelect() {\n            $(\'.js-default-date-warning\').fadeOut();\n            combineDatetime();\n            checkHolidays();\n            validateForm();\n        }\n\n        function getClosestDate(dates, date) {\n            // dates must be a sorted array of int which represent value in ms\n            // date is a date or a date in ms\n            if (date instanceof Date) {\n                date = date.getTime();\n            }\n\n            var min = 0, max = dates.length - 1;\n            var lo = 0, hi = dates.length - 1, mid = null;\n            while (lo <= hi) {\n                mid = Math.floor((lo + hi) / 2);\n                if (date < dates[mid]) {\n                    hi = mid - 1;\n                } else if (date > dates[mid]) {\n                    lo = mid + 1;\n                } else {\n                    return new Date(dates[mid]);\n                }\n            }\n\n            // Check for invalid indexes\n            if (hi < 0 && lo <= dates.length - 1) {\n                return new Date(dates[lo]);\n            } else if (lo > dates.length - 1 && hi >= 0) {\n                return new Date(dates[hi]);\n            }\n\n            var dLo = Math.abs(date - dates[lo]);\n            var dHi = Math.abs(date - dates[hi]);\n            return dLo <= dHi ? new Date(dates[lo]) : new Date(dates[hi]);\n        }\n\n        function refreshDatePicker($dpElem) {\n            var disabled = $dpElem.datepicker(\'isDisabled\');\n            $dpElem.datepicker(\'refresh\');\n            if (disabled) {\n                $dpElem.datepicker(\'disable\');\n            }\n        }\n\n        function checkBookingLimit() {\n            var oneDay = 86400 * 1000;\n            var startDate = $(\'#sDatePlace\').datepicker(\'getDate\');\n            var endDate = $(\'#eDatePlace\').datepicker(\'getDate\');\n            var selectedDaysPeriod = (endDate - startDate) / oneDay;\n            var selectedRooms;\n'
        )
        if serializable_room:
            __M_writer(
                '                // Individual booking\n                selectedRooms = ['
            )
            __M_writer(j(serializable_room))
            __M_writer('];\n')
        else:
            __M_writer(
                '                // Multiple select booking\n                var selectedRoomsIndexes = $("#roomselector").roomselector("selection");\n                selectedRooms = _.map(selectedRoomsIndexes, function(i) { return rooms[i]; });\n'
            )
        __M_writer(
            '            var selectedNotLimitedRooms = _.clone(selectedRooms);\n            var limitedRoomsInvalid = [];\n            _.each(selectedRooms, function(room) {\n                var roomBookingLimit = room.booking_limit_days;\n                if (roomBookingLimit) {\n                    selectedNotLimitedRooms.splice(selectedNotLimitedRooms.indexOf(room), 1);\n                    if (selectedDaysPeriod > roomBookingLimit) {\n                        limitedRoomsInvalid.push(room);\n                    }\n                }\n            });\n            handleLimitedRoomsInvalid(limitedRoomsInvalid);\n            if (selectedNotLimitedRooms.length) {\n                var bookingDaysLimit = '
        )
        __M_writer(str(encode_if_unicode(booking_limit)))
        __M_writer(
            ';\n                var isLimitExceeded = endDate > startDate && selectedDaysPeriod > bookingDaysLimit;\n                $(\'.booking-limit-warning\').toggleClass(\'hidden\', !isLimitExceeded);\n                $(\'#searchForm :submit, #bookingForm :submit\').prop(\'disabled\', isLimitExceeded);\n            } else {\n                $(\'.booking-limit-warning\').addClass(\'hidden\');\n                $(\'#searchForm :submit, #bookingForm :submit\').prop(\'disabled\', !!limitedRoomsInvalid.length);\n            }\n        }\n\n        function handleLimitedRoomsInvalid(rooms) {\n            if (rooms.length) {\n                var warningMsgRooms = [];\n                _.map(rooms, function(room) {\n                    warningMsgRooms.push("\'{0}\' for more than {1} days".format(room.name, room.booking_limit_days));\n                });\n                var warningMsg = $T.gettext("It is not possible to book room {0}").format(warningMsgRooms.join(", "));\n                $(\'.booking-limit-room-warning .message-text\').html(warningMsg);\n            }\n            $(\'.booking-limit-room-warning\').toggleClass(\'hidden\', !rooms.length);\n        }\n\n        var validEndDates = null;\n        var frequencies = {\n            \'1\' : RRule.DAILY,\n            \'2\' : RRule.WEEKLY,\n            \'3\' : RRule.MONTHLY\n        };\n\n        $(\'#timerange\').timerange({\n            initStartTime: \''
        )
        __M_writer(str(encode_if_unicode(
            form.start_dt.data.strftime("%H:%M"))))
        __M_writer("',\n            initEndTime: '")
        __M_writer(str(encode_if_unicode(form.end_dt.data.strftime("%H:%M"))))
        __M_writer(
            "',\n            startTimeName: 'sTime',\n            endTimeName: 'eTime',\n            sliderWidth: '512px',\n            change: function() {\n                combineDatetime();\n                validateForm();\n            }\n        });\n\n        $('#sDatePlace, #eDatePlace').datepicker({\n            dateformat: 'dd/mm/yy',\n"
        )
        if not can_override:
            __M_writer('                maxDate: ')
            __M_writer(
                str(
                    encode_if_unicode(
                        room.max_advance_days -
                        1 if room and room.max_advance_days else 'null')))
            __M_writer(',\n')
        __M_writer(
            "            showButtonPanel: true,\n            changeMonth: true,\n            changeYear: true,\n            showOn: 'focus',\n            unifyNumRows: true\n        });\n\n"
        )
        if not can_override:
            __M_writer(
                "            $('#sDatePlace').datepicker('option', 'minDate', "
            )
            __M_writer(
                str(
                    encode_if_unicode("'{}'".format(
                        min(min_date, form.start_dt.data).strftime('%d/%m/%Y')
                    ) if min_date else 0)))
            __M_writer(
                ");\n            $('#eDatePlace').datepicker('option', 'minDate', "
            )
            __M_writer(
                str(
                    encode_if_unicode("'{}'".format(
                        min_date.strftime('%d/%m/%Y')) if min_date else 0)))
            __M_writer(');\n')
        __M_writer(
            '\n        $(\'#eDatePlace\').datepicker(\'option\', \'beforeShowDay\', function validateDate(date) {\n            if (validEndDates === null) {\n                return [true, \'\', \'\'];\n            }\n            return [validEndDates.indexOf(date.getTime()) !== -1, \'\', \'\'];\n        });\n\n        $(\'#sDatePlace\').datepicker(\'option\', \'onSelect\', function startDateOnSelect(selectedDateText) {\n            disableInvalidDays();\n            refreshDatePicker($(\'#eDatePlace\'));\n            selectEndDate();\n            commonOnSelect();\n            checkBookingLimit();\n        });\n\n        $(\'#eDatePlace\').datepicker(\'option\', \'onSelect\', function() {\n            commonOnSelect();\n            checkBookingLimit();\n        });\n\n        $(\'#eDatePlace\').datepicker(\'option\', \'onChangeMonthYear\', disableInvalidDays);\n\n        $(\'#sDatePlace\').datepicker(\'setDate\', "'
        )
        __M_writer(
            str(encode_if_unicode(form.start_dt.data.strftime('%d/%m/%Y'))))
        __M_writer('");\n        $(\'#eDatePlace\').datepicker(\'setDate\', "')
        __M_writer(
            str(encode_if_unicode(form.end_dt.data.strftime('%d/%m/%Y'))))
        __M_writer(
            '");\n\n        $(\'#repeatability input:radio[name=repeat_frequency]\').change(function() {\n            checkFrequency();\n        });\n\n        $(\'#roomselector\').on(\'click\', \'.ui-multiselect-checkboxes :checkbox, .ui-multiselect-all, .ui-multiselect-none\', function() {\n            checkBookingLimit();\n        });\n\n        checkFrequency();\n        checkHolidays();\n\n'
        )
        if not can_override:
            if form.start_dt.data < datetime.now():
                __M_writer(
                    "                $('#timerange').timerange('disable');\n                var startDate = moment($('#sDatePlace').datepicker('getDate')).format('D/MM/YYYY');\n                // Disable the datea in calendar as well as the calendar itself...\n                $('#sDatePlace').datepicker('option', 'beforeShowDay', function validateDate(date) {\n                    return [moment(date).format('D/MM/YYYY') == startDate, '', ''];\n                });\n                $('#sDatePlace').datepicker('disable');\n"
                )
            if form.end_dt.data < datetime.now():
                __M_writer(
                    "                var endDate = moment($('#eDatePlace').datepicker('getDate')).format('D/MM/YYYY');\n                // Disable the datea in calendar as well as the calendar itself...\n                $('#eDatePlace').datepicker('option', 'beforeShowDay', function validateDate(date) {\n                    return [moment(date).format('D/MM/YYYY') == endDate, '', ''];\n                });\n                $('#eDatePlace').datepicker('disable');\n                $('#repeatability > input[name=repeat_frequency]').not(':checked').prop('disabled', true);\n"
                )
        __M_writer('\n    });\n</script>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #15
0
 def display(self, **params):
     """
     """
     return "%s%s%s" % (self._getHTMLHeader(),
                        encode_if_unicode(
                            self._display(params)), self._getHTMLFooter())
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        url_for = context.get('url_for', UNDEFINED)
        blockings = context.get('blockings', UNDEFINED)
        len = context.get('len', UNDEFINED)
        str = context.get('str', UNDEFINED)
        formatDate = context.get('formatDate', UNDEFINED)
        rh = context.get('rh', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('<h2 class="page-title">\n    ')
        __M_writer(
            str(
                encode_if_unicode(
                    "My Blockings" if rh.only_mine else "Blockings")))
        __M_writer('\n</h2>\n<br />\n')
        if blockings:
            __M_writer(
                '    <br />\n    <table class="blockingTable">\n        <thead>\n        <tr>\n          <td class="dataCaptionFormat">'
            )
            __M_writer(str(encode_if_unicode(_("Period"))))
            __M_writer('</td>\n          <td class="dataCaptionFormat">')
            __M_writer(str(encode_if_unicode(_("Owner"))))
            __M_writer('</td>\n          <td class="dataCaptionFormat">')
            __M_writer(str(encode_if_unicode(_("Rooms"))))
            __M_writer('</td>\n          <td class="dataCaptionFormat">')
            __M_writer(str(encode_if_unicode(_("Reason"))))
            __M_writer('</td>\n          <td class="dataCaptionFormat">')
            __M_writer(str(encode_if_unicode(_("Actions"))))
            __M_writer('</td>\n        </tr>\n        </thead>\n        ')
            lastBlock = None

            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(
                __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                                  for __M_key in ['lastBlock']
                                  if __M_key in __M_locals_builtin_stored]))
            __M_writer('\n')
            for block in blockings:
                if lastBlock:
                    __M_writer(
                        '                <tbody class="blockingSpacer"><tr><td></td></tr></tbody>\n'
                    )
                __M_writer(
                    '            <tbody>\n            <tr class="blockingHover blockingPadding">\n                <td>'
                )
                __M_writer(str(encode_if_unicode(formatDate(
                    block.start_date))))
                __M_writer('&nbsp;&mdash;&nbsp;')
                __M_writer(str(encode_if_unicode(formatDate(block.end_date))))
                __M_writer('</td>\n                <td>')
                __M_writer(
                    str(encode_if_unicode(block.created_by_user.full_name)))
                __M_writer('</td>\n                <td>')
                __M_writer(str(encode_if_unicode(len(block.blocked_rooms))))
                __M_writer(' room')
                __M_writer(
                    str(
                        encode_if_unicode(
                            (len(block.blocked_rooms) != 1 and 's' or ''))))
                __M_writer('</td>\n                <td>')
                __M_writer(str(encode_if_unicode(block.reason)))
                __M_writer('</td>\n                <td><a href="')
                __M_writer(
                    str(
                        encode_if_unicode(
                            url_for('rooms.blocking_details',
                                    blocking_id=str(block.id)))))
                __M_writer(
                    '">Details</a> | <a href="#" class="blockingShowRooms">Show rooms</a></td>\n            </tr>\n            <tr class="blockingHover blockingRoomList">\n                <td colspan="2"></td>\n                <td colspan="2">\n                    <div>\n                        '
                )
                __M_writer(
                    str(
                        encode_if_unicode('<br />'.join(
                            '<a href="{}">{}</a>'.format(
                                url_for('rooms.roomBooking-roomDetails',
                                        br.room), br.room.full_name)
                            for br in block.blocked_rooms))))
                __M_writer(
                    '\n                    </div>\n                </td>\n                <td></td>\n            </tr>\n            </tbody>\n            '
                )
                lastBlock = block

                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(
                    __M_dict_builtin([
                        (__M_key, __M_locals_builtin_stored[__M_key])
                        for __M_key in ['lastBlock']
                        if __M_key in __M_locals_builtin_stored
                    ]))
                __M_writer('\n')
            __M_writer(
                '    </table>\n\n    <script type="text/javascript">\n        $(\'.blockingShowRooms\').on(\'click\', function(e) {\n            e.preventDefault();\n            var $this = $(this);\n            var roomList = $this.closest(\'tr\').next(\'.blockingRoomList\');\n            var show = roomList.is(\':hidden\');\n            $this.text(show ? $T(\'Hide rooms\') : $T(\'Show rooms\'));\n            roomList.toggle(show);\n            $this.closest(\'tbody\').toggleClass(\'hasRoomList\', show);\n        });\n    </script>\n'
            )
        else:
            __M_writer('    <br />\n    <em>None found.</em>\n    <br />\n')
        __M_writer('<br />\nFilter blockings by creator:\n<a href="')
        __M_writer(
            str(
                encode_if_unicode(
                    url_for('rooms.blocking_list',
                            timeframe=rh.timeframe,
                            only_mine=False))))
        __M_writer('" class="')
        __M_writer(str(encode_if_unicode(('' if rh.only_mine else 'active'))))
        __M_writer('">all users</a> |\n<a href="')
        __M_writer(
            str(
                encode_if_unicode(
                    url_for('rooms.blocking_list',
                            timeframe=rh.timeframe,
                            only_mine=True))))
        __M_writer('" class="')
        __M_writer(str(encode_if_unicode(('active' if rh.only_mine else ''))))
        __M_writer(
            '">only myself</a>\n<br />\nFilter blockings by date:\n<a href="')
        __M_writer(
            str(
                encode_if_unicode(
                    url_for('rooms.blocking_list',
                            only_mine=rh.only_mine,
                            timeframe='recent'))))
        __M_writer('" class="')
        __M_writer(
            str(
                encode_if_unicode(
                    ('active' if rh.timeframe == 'recent' else ''))))
        __M_writer('">active and future blockings</a> |\n<a href="')
        __M_writer(
            str(
                encode_if_unicode(
                    url_for('rooms.blocking_list',
                            only_mine=rh.only_mine,
                            timeframe='year'))))
        __M_writer('" class="')
        __M_writer(
            str(encode_if_unicode(
                ('active' if rh.timeframe == 'year' else ''))))
        __M_writer('">all blockings for this year</a> |\n<a href="')
        __M_writer(
            str(
                encode_if_unicode(
                    url_for('rooms.blocking_list',
                            only_mine=rh.only_mine,
                            timeframe='all'))))
        __M_writer('" class="')
        __M_writer(
            str(encode_if_unicode(
                ('active' if rh.timeframe == 'all' else ''))))
        __M_writer('">all blockings</a>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #17
0
 def wrapper(*args, **kwargs):
     return encode_if_unicode(fn(*args, **kwargs))
def render_body(context,**pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        url_for = context.get('url_for', UNDEFINED)
        form = context.get('form', UNDEFINED)
        int = context.get('int', UNDEFINED)
        contextHelp = context.get('contextHelp', UNDEFINED)
        inlineContextHelp = context.get('inlineContextHelp', UNDEFINED)
        rooms = context.get('rooms', UNDEFINED)
        equipment_locations = context.get('equipment_locations', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('<!-- CONTEXT HELP DIVS -->\n<div id="tooltipPool" style="display: none">\n  <!-- Choose Button -->\n  <div id="chooseButtonHelp" class="tip">\n    <span>')
        __M_writer(str(encode_if_unicode( _('Black</span> - rooms that <b>do not</b> require confirmation') )))
        __M_writer('<br/>\n    <span class="moderatedRoom">')
        __M_writer(str(encode_if_unicode( _('Orange</span> - rooms that <b>require confirmation') )))
        __M_writer('</b><br />\n    <span class="privateRoom">')
        __M_writer(str(encode_if_unicode( _('Red</span> - rooms not publically bookable') )))
        __M_writer('<br />\n  </div>\n  <!-- Free Search -->\n  <div id="freeSearchHelp" class="tip">\n    ')
        __M_writer(str(encode_if_unicode( _('Type in anything you remember about the room, i.e.') )))
        __M_writer(':\n    <ul>\n      <li class="tip-no-borders"> ')
        __M_writer(str(encode_if_unicode( _('building or room number') )))
        __M_writer('</li>\n      <li class="tip-no-borders"> ')
        __M_writer(str(encode_if_unicode( _('person responsible') )))
        __M_writer('</li>\n      <li class="tip-no-borders"> ')
        __M_writer(str(encode_if_unicode( _('part of comment') )))
        __M_writer('</li>\n      <li class="tip-no-borders"> ')
        __M_writer(str(encode_if_unicode( _('equipment') )))
        __M_writer('</li>\n      <li class="tip-no-borders"> ')
        __M_writer(str(encode_if_unicode( _('room site') )))
        __M_writer('</li>\n      <li class="tip-no-borders"> ')
        __M_writer(str(encode_if_unicode( _('telephone') )))
        __M_writer('</li>\n      <li class="tip-no-borders">...</li>\n    </ul>\n    ')
        __M_writer(str(encode_if_unicode( _('Results will include rooms that have at least one of the specified words somewhere in description.') )))
        __M_writer('\n    <br />\n    ')
        __M_writer(str(encode_if_unicode( _('Examples') )))
        __M_writer(':\n    <ul>\n      <li class="tip-no-borders">Hauser&nbsp;(')
        __M_writer(str(encode_if_unicode( _('name of person responsible') )))
        __M_writer(')</li>\n      <li class="tip-no-borders">513- 31- 28-&nbsp;(')
        __M_writer(str(encode_if_unicode( _('buildings') )))
        __M_writer(')</li>\n      <li class="tip-no-borders">-006 -C19&nbsp;(')
        __M_writer(str(encode_if_unicode( _('rooms') )))
        __M_writer(')</li>\n      <li class="tip-no-borders">prevessin&nbsp;(')
        __M_writer(str(encode_if_unicode( _('site') )))
        __M_writer(')</li>\n    </ul>\n      ')
        __M_writer(str(encode_if_unicode( _('Searching is case-insensitive and concerns all room\'s attributes.') )))
        __M_writer('\n  </div>\n  <!-- Capacity -->\n  <div id="capacityHelp" class="tip">\n    <p class="tip-no-borders">\n      ')
        __M_writer(str(encode_if_unicode( _("""Find only rooms having capacity within 20% range.
           In example for capacity = 20, rooms having capacity 16 - 24
           will be included in searching results.""") )))
        __M_writer('<br />\n    </p>\n    <p class="tip-no-borders">\n      ')
        __M_writer(str(encode_if_unicode( _("""If there are no rooms of capacity within 20% range,
           system will search for greater capacity.""") )))
        __M_writer('\n    </p>\n    <p class="tip-no-borders">\n      ')
        __M_writer(str(encode_if_unicode( _("""Example: for capacity equal 1, system will try to find rooms for
           only one person. This of course fails, so it will
           return rooms with capacity greater than 1.""") )))
        __M_writer('\n    </p>\n  </div>\n  <!-- Availability -->\n  <div id="availabilityHelp" class="tip">\n    <ul>\n      <li class="tip-no-borders">\n        ')
        __M_writer(str(encode_if_unicode( _('Available - the room must be available in the <b>whole</b> period') )))
        __M_writer('\n      </li>\n      <li class="tip-no-borders">\n        ')
        __M_writer(str(encode_if_unicode( _('Booked - the room must be booked <b>any time</b> in the period') )))
        __M_writer('\n      </li>\n      <li class="tip-no-borders">\n        ')
        __M_writer(str(encode_if_unicode( _('Don\'t care - room\'s availability is not checked') )))
        __M_writer('\n      </li>\n    </ul>\n  </div>\n  ')
        runtime._include_file(context, 'CHBookingRepetition.tpl', _template_uri)
        __M_writer('\n</div>\n<!-- END OF CONTEXT HELP DIVS -->\n\n\n<h2 class="page-title">\n    ')
        __M_writer(str(encode_if_unicode( _('Search rooms') )))
        __M_writer('\n</h2>\n\n')
        runtime._include_file(context, 'ErrorList.tpl', _template_uri, errors=form.error_list, msg=_("There are some errors in the data you submitted"))
        __M_writer('\n\n<!-- Choose a room -->\n<h2 class="group-title">\n    <i class="icon-location"></i>\n    ')
        __M_writer(str(encode_if_unicode( _('Check a room') )))
        __M_writer('\n</h2>\n<select name="roomName" id="roomName">\n')
        for room in rooms:
            __M_writer('        <option value="')
            __M_writer(str(encode_if_unicode( url_for('rooms.roomBooking-roomDetails', room) )))
            __M_writer('" class="')
            __M_writer(str(encode_if_unicode( room.kind )))
            __M_writer('">\n            ')
            __M_writer(str(encode_if_unicode( u'{}: &nbsp; {}'.format(room.location_name, room.full_name) )))
            __M_writer('\n        </option>\n')
        __M_writer('</select>\n\n<input class="i-button highlight" type="button" value="')
        __M_writer(str(encode_if_unicode( _('Go to room') )))
        __M_writer('" onclick="location.href = $(\'#roomName\').val(); return false;"/>\n')
        __M_writer(str(encode_if_unicode( contextHelp('chooseButtonHelp') )))
        __M_writer('\n\n<!-- Search for rooms -->\n<div id="searchRooms">\n    <form id="searchRoomsForm" method="post" action="">\n        ')
        __M_writer(str(encode_if_unicode( form.csrf_token() if form.meta.csrf else '' )))
        __M_writer('\n        ')
        __M_writer(str(encode_if_unicode( form.start_dt() )))
        __M_writer('\n        ')
        __M_writer(str(encode_if_unicode( form.end_dt() )))
        __M_writer('\n        <h2 class="group-title">\n            <i class="icon-search"></i>\n            ')
        __M_writer(str(encode_if_unicode( _('Search for a room') )))
        __M_writer('\n        </h2>\n\n        <table width="100%" border="0" cellspacing="0" cellpadding="0">\n            <!-- LOCATION -->\n            <tr>\n                <td class="titleCellTD" style="width: 125px;">\n                    <span class="titleCellFormat">')
        __M_writer(str(encode_if_unicode( _('Location') )))
        __M_writer('</span>\n                </td>\n                <td>\n                    <table width="100%" cellspacing="4px">\n                        <tr>\n                            <td align="left" class="blacktext">\n                                ')
        __M_writer(str(encode_if_unicode( form.location() )))
        __M_writer('\n                            </td>\n                        </tr>\n                    </table>\n                </td>\n            </tr>\n\n            <!-- FREE TEXT -->\n            <tr>\n                <td class="titleCellTD" style="width: 125px;">\n                    <span class="titleCellFormat">')
        __M_writer(str(encode_if_unicode( _('Room details') )))
        __M_writer('</span>\n                </td>\n                <td>\n                    <table width="100%" cellspacing="4px">\n                        <tr>\n                            <td align="left" class="blacktext">\n                                ')
        __M_writer(str(encode_if_unicode( form.details(size=30) )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( contextHelp('freeSearchHelp') )))
        __M_writer('\n                            </td>\n                        </tr>\n                    </table>\n                </td>\n            </tr>\n\n            <!-- AVAILABILITY -->\n            <tr>\n                <td class="titleCellTD" style="width: 125px;">\n                    <span class="titleCellFormat"> ')
        __M_writer(str(encode_if_unicode( _('Availability') )))
        __M_writer('</span>\n                </td>\n                <td>\n                    <table width="100%" cellspacing="4px">\n                        <tr>\n                            <td align="left" class="blacktext">\n                                ')
        __M_writer(str(encode_if_unicode( form.available(label_args={'style': 'font-weight: normal;'}) )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( contextHelp('availabilityHelp') )))
        __M_writer('\n                            </td>\n                        </tr>\n                        ')
        runtime._include_file(context, 'RoomBookingPeriodFormOld.tpl', _template_uri)
        __M_writer('\n                        <tr id=\'includePrebookingsTR\'>\n                            <td class="subFieldWidth" align="right" >\n                                <small> ')
        __M_writer(str(encode_if_unicode( _('PRE-Bookings') )))
        __M_writer('</small>\n                            </td>\n                            <td align="left" class="blacktext">\n                                ')
        __M_writer(str(encode_if_unicode( form.include_pre_bookings() )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( form.include_pre_bookings.label(style='font-weight: normal;') )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( inlineContextHelp(_('Check if you want to avoid conflicts with PRE-bookings. By default conflicts are checked only against confirmed bookings.')) )))
        __M_writer('\n                            </td>\n                        </tr>\n                        <tr id=\'includePendingBlockingsTR\'>\n                            <td class="subFieldWidth" align="right" >\n                                <small>')
        __M_writer(str(encode_if_unicode( _('Blockings') )))
        __M_writer('</small>\n                            </td>\n                            <td align="left" class="blacktext">\n                                ')
        __M_writer(str(encode_if_unicode( form.include_pending_blockings() )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( form.include_pending_blockings.label(style='font-weight: normal;') )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( inlineContextHelp(_('Check if you want to avoid conflicts with pending blockings. By default conflicts are checked only against confirmed blockings.')) )))
        __M_writer('\n                            </td>\n                        </tr>\n                    </table>\n                </td>\n            </tr>\n\n            <!-- CAPACITY -->\n            <tr>\n                <td class="titleCellTD" style="width: 125px;">\n                    <span class="titleCellFormat">')
        __M_writer(str(encode_if_unicode( form.capacity.label(style='font-weight: normal;') )))
        __M_writer('</span>\n                </td>\n                <td align="right">\n                    <table width="100%" cellspacing="4px">\n                        <tr>\n                            <td align="left" class="blacktext">\n                                ')
        __M_writer(str(encode_if_unicode( form.capacity(size=3) )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( _('seats') )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( contextHelp('capacityHelp') )))
        __M_writer('\n                            </td>\n                        </tr>\n                    </table>\n                </td>\n            </tr>\n\n            <!-- REQUIRED EQUIPMENT -->\n            <tr id="equipment-search">\n                <td nowrap class="titleCellTD" style="width: 125px;">\n                    <span class="titleCellFormat">')
        __M_writer(str(encode_if_unicode( _("Required equipment") )))
        __M_writer('</span>\n                </td>\n                <td align="right">\n                    <table width="100%" cellspacing="4px">\n                        <tr>\n                            <td align="left" class="blacktext">\n')
        for eq in form.available_equipment:
            __M_writer('                                    <div class="')
            __M_writer(str(encode_if_unicode( 'js-location js-location-{}'.format(equipment_locations[int(eq.data)]) )))
            __M_writer('">\n                                        ')
            __M_writer(str(encode_if_unicode( eq() )))
            __M_writer('\n                                        ')
            __M_writer(str(encode_if_unicode( eq.label(style='font-weight: normal;') )))
            __M_writer('\n                                    </div>\n')
        __M_writer('                            </td>\n                        </tr>\n                    </table>\n                </td>\n            </tr>\n\n            <tr>\n                <td nowrap class="titleCellTD" style="width: 125px;">\n                    <span class="titleCellFormat">')
        __M_writer(str(encode_if_unicode( _('Special attributes') )))
        __M_writer('</span>\n                </td>\n                <td align="right">\n                    <table width="100%" cellspacing="4px">\n                        <tr>\n                            <td align="left" class="blacktext">\n                                ')
        __M_writer(str(encode_if_unicode( form.is_only_public() )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( form.is_only_public.label(style='font-weight: normal;') )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( inlineContextHelp(_('Include only publically reservable rooms.')) )))
        __M_writer('\n                                <br>\n                                ')
        __M_writer(str(encode_if_unicode( form.is_auto_confirm() )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( form.is_auto_confirm.label(style='font-weight: normal;') )))
        __M_writer('\n                                ')
        __M_writer(str(encode_if_unicode( inlineContextHelp(_('Include only rooms, where bookings are automatically confirmed. This is the case for most rooms.')) )))
        __M_writer('\n')
        if form.is_only_my_rooms:
            __M_writer('                                    <br>\n                                    ')
            __M_writer(str(encode_if_unicode( form.is_only_my_rooms() )))
            __M_writer('\n                                    ')
            __M_writer(str(encode_if_unicode( form.is_only_my_rooms.label(style='font-weight: normal;') )))
            __M_writer('\n                                    ')
            __M_writer(str(encode_if_unicode( inlineContextHelp(_('Include only rooms you are responsible for.')) )))
            __M_writer('\n')
        if form.is_only_active:
            __M_writer('                                    <br>\n                                    ')
            __M_writer(str(encode_if_unicode( form.is_only_active() )))
            __M_writer('\n                                    ')
            __M_writer(str(encode_if_unicode( form.is_only_active.label(style='font-weight: normal;') )))
            __M_writer('\n                                    ')
            __M_writer(str(encode_if_unicode( inlineContextHelp(_('Include only active rooms. <b>This should be checked.</b> Please note that inactive rooms are considered deleted.')) )))
            __M_writer('\n')
        __M_writer('                            </td>\n                        </tr>\n                    </table>\n                </td>\n            </tr>\n\n            <tr>\n                <td colspan="2" style="padding-left:20px">\n                    <button type="send" class="i-button highlight">\n                        <i class="icon-search"></i>\n                        ')
        __M_writer(str(encode_if_unicode( _('Search') )))
        __M_writer('\n                    </button>\n                </td>\n            </tr>\n        </table>\n    </form>\n</div>\n\n<script type="text/javascript">\n\n    // Displays div with dates and hours\n    function display_availability(bool) {\n        $(\'#sdatesTR, #edatesTR, #hoursTR, #repTypeTR, #includePrebookingsTR, #includePendingBlockingsTR\').toggle(bool);\n    }\n    // Reds out the invalid textboxes and returns false if something is invalid.\n    // Returns true if form may be submited.\n    function forms_are_valid(onSubmit) {\n        if (onSubmit != true) {\n            onSubmit = false;\n        }\n\n        // Clean up - make all textboxes white again\n        var searchForm = $(\'#searchRoomsForm\');\n        $(\':input\', searchForm).removeClass(\'invalid\');\n        // Init\n        var isValid = true;\n\n        // Simple search -------------------------------------\n        // Availability\n        if ($(\'input[name="available"]:checked\', searchForm).val() != \'-1\') { // only if NOT "Don\'t care"\n            // validate_period is not defined, wth, apparently the old if condition was never net\n            // isValid = validate_period();\n        }\n        // capacity\n        if ($(\'#capacity\').val().length > 0 && parseInt($(\'#capacity\').val(), 10).toString() == \'NaN\') {\n            $(\'#capacity\').addClass(\'invalid\');\n            isValid = false;\n        }\n\n        // Holidays warning\n        if (isValid && !onSubmit) {\n            var lastDateInfo = searchForm.data(\'lastDateInfo\');\n            var dateInfo = $(\'#sDay, #sMonth, #sYear, #eDay, #eMonth, #eYear\').serialize();\n            if (dateInfo != lastDateInfo) {\n                searchForm.data(\'lastDateInfo\', dateInfo);\n                var holidaysWarning = indicoSource(\'roomBooking.getDateWarning\', searchForm.serializeObject());\n\n                holidaysWarning.state.observe(function(state) {\n                    if (state == SourceState.Loaded) {\n                        $E(\'holidays-warning\').set(holidaysWarning.get());\n                    }\n                });\n            }\n        }\n\n        if (!$(\'#sdate\').val()) {\n            $(\'#sdate\').addClass(\'invalid\');\n            isValid = false;\n        }\n\n        if (!$(\'#edate\').val()) {\n            $(\'#edate\').addClass(\'invalid\');\n            isValid = false;\n        }\n\n        return isValid;\n    }\n\n\n    $(window).on(\'load\', function() {\n        $(\'#searchRoomsForm\').on(\'keyup change\', \':input\', function() {\n            forms_are_valid();\n        }).on(\'submit\', function(e) {\n            if (!forms_are_valid(true)) {\n                e.preventDefault();\n                new AlertPopup($T("Error"), $T("There are errors in the form. Please correct fields with red background.")).open();\n            }\n        });\n\n        if (forms_are_valid()) {\n            set_repeatition_comment();\n        }\n        $(\'#searchRoomsForm input[name="available"]\').change(function() {\n            display_availability(this.value != \'-1\');\n        });\n        display_availability($(\'input[name="available"]:checked\').val() != \'-1\');\n        $(\'#freeSearch\').focus();\n    });\n\n    $(\'#location\').on(\'change\', function() {\n        var locationId = $(this).val();\n        $(\'#equipment-search\').toggle(locationId != \'__None\')\n        $(\'.js-location\').hide().find(\'input:checkbox\').prop(\'checked\', false);\n        $(\'.js-location-\' + locationId).show();\n    }).trigger(\'change\');\n\n</script>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        sessions = context.get('sessions', UNDEFINED)
        url_for = context.get('url_for', UNDEFINED)
        event = context.get('event', UNDEFINED)
        contribs = context.get('contribs', UNDEFINED)
        escape = context.get('escape', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('<p>\n    ')
        __M_writer(
            str(
                encode_if_unicode(
                    _('Booking a room through this interface allows two options:'
                      ))))
        __M_writer('\n</p>\n<ul>\n    <li>\n        ')
        __M_writer(
            str(
                encode_if_unicode(
                    _('Book a room using your name - You may come back later on and assign the booked room to a particular event.'
                      ))))
        __M_writer('\n    </li>\n    <li>\n        ')
        __M_writer(
            str(
                encode_if_unicode(
                    _('Book a room and assign it automatically to the event (Room and Location of the selected event will be automatically set).'
                      ))))
        __M_writer(
            '\n    </li>\n</ul>\n<p><strong>Select event:</strong></p>\n<form action="'
        )
        __M_writer(
            str(encode_if_unicode(url_for('event_mgmt.rooms_book', event))))
        __M_writer(
            '" method="get">\n    <ul style="margin-bottom: 20px; list-style-type: none;">\n        <li style="margin-bottom: 1em;">\n            <input type="radio" name="assign" value="nothing" id="assign-nothing" checked>\n            <label for="assign-nothing" style="font-weight: normal;"><strong>'
        )
        __M_writer(
            str(encode_if_unicode(
                _('Just book the room without assigning it'))))
        __M_writer(
            '</strong></label>\n        </li>\n        <li>\n            <input type="radio" name="assign" value="event" id="assign-event">\n            <label for="assign-event" style="font-weight: normal;">'
        )
        __M_writer(str(encode_if_unicode(event.type_.title)))
        __M_writer(': <strong>')
        __M_writer(str(encode_if_unicode(escape(event.title))))
        __M_writer('</strong></label>\n        </li>\n')
        for sess in sessions:
            __M_writer(
                '            <li>\n                <input type="radio" name="assign" value="session-'
            )
            __M_writer(str(encode_if_unicode(sess.id)))
            __M_writer('" id="assign-session-')
            __M_writer(str(encode_if_unicode(sess.id)))
            __M_writer('">\n                <label for="assign-session-')
            __M_writer(str(encode_if_unicode(sess.id)))
            __M_writer('" style="font-weight: normal;">Session: <strong>')
            __M_writer(str(encode_if_unicode(escape(sess.title))))
            __M_writer('</strong></label>\n            </li>\n')
        for contrib in contribs:
            __M_writer(
                '            <li>\n                <input type="radio" name="assign" value="contribution-'
            )
            __M_writer(str(encode_if_unicode(contrib.id)))
            __M_writer('" id="assign-contribution-')
            __M_writer(str(encode_if_unicode(contrib.id)))
            __M_writer('">\n                <label for="assign-contribution-')
            __M_writer(str(encode_if_unicode(contrib.id)))
            __M_writer('" style="font-weight: normal;">Contribution: <strong>')
            __M_writer(str(encode_if_unicode(escape(contrib.title))))
            __M_writer('</strong></label>\n            </li>\n')
        __M_writer(
            '    </ul>\n    <div>\n        <input class="i-button" type="submit" value="'
        )
        __M_writer(str(encode_if_unicode(_('Book Room'))))
        __M_writer('">\n    </div>\n</form>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #20
0
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)

        def document_class():
            return render_document_class(context._locals(__M_locals))

        def geometry():
            return render_geometry(context._locals(__M_locals))

        def header_extra():
            return render_header_extra(context._locals(__M_locals))

        def content():
            return render_content(context._locals(__M_locals))

        __M_writer = context.writer()

        import os
        import pkg_resources
        distribution = pkg_resources.get_distribution('indico-fonts')
        font_dir = os.path.join(distribution.location, 'indico_fonts')
        # Trailing slash is necessary
        font_dir = os.path.join(font_dir, '')

        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(
            __M_dict_builtin([
                (__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in
                ['distribution', 'os', 'pkg_resources', 'font_dir']
                if __M_key in __M_locals_builtin_stored
            ]))
        __M_writer('\n\n')
        if 'parent' not in context._data or not hasattr(
                context._data['parent'], 'document_class'):
            context['self'].document_class(**pageargs)

        __M_writer('\n\n')
        if 'parent' not in context._data or not hasattr(
                context._data['parent'], 'geometry'):
            context['self'].geometry(**pageargs)

        __M_writer(
            '\n\n\\usepackage{hyperref}\n\\usepackage{amssymb}\n\\usepackage{amsmath}\n\\usepackage{fontspec}\n\n\\usepackage[english]{babel}\n\\usepackage[final, babel]{microtype} %% texblog.net/latex-archive/layout/pdflatex-microtype/\n\n\\usepackage{float} %% improved interface for floating objects\n\\usepackage[export]{adjustbox}\n\\usepackage[usenames,dvipsnames]{xcolor} %% named colors\n\\usepackage{sectsty} %% style sections\n\\usepackage{xstring}\n\\usepackage{tcolorbox}\n\\usepackage[inline]{enumitem}\n\\usepackage[breakall]{truncate}\n\\usepackage[parfill]{parskip}\n\n'
        )
        if 'parent' not in context._data or not hasattr(
                context._data['parent'], 'header_extra'):
            context['self'].header_extra(**pageargs)

        __M_writer('\n\n\n\\begin{document}\n\n')
        __M_writer(
            '   %% set fonts\n    \\setmainfont{LinLibertine_R.otf}[\n        BoldFont = LinLibertine_RB.otf,\n        ItalicFont = LinLibertine_RI.otf,\n        BoldItalicFont = LinLibertine_RBI.otf,\n        Path = '
        )
        __M_writer(str(encode_if_unicode(font_dir)))
        __M_writer(
            ']\n    \\setsansfont{LinBiolinum_R.otf}[\n        BoldFont = LinBiolinum_RB.otf,\n        ItalicFont = LinBiolinum_RI.otf,\n        Path = '
        )
        __M_writer(str(encode_if_unicode(font_dir)))
        __M_writer(']\n\n')
        __M_writer(
            '   %% no indentation\n    \\setlength{\\parindent}{0cm}\n\n')
        __M_writer(
            '   %% helper commands\n\n    \\newcommand{\\truncateellipses}[2]{\n       \\truncate{#2}{#1}\n    }\n\n'
        )
        __M_writer(
            '   %% remove section heading numbering\n    \\setcounter{secnumdepth}{0}\n\n    '
        )
        if 'parent' not in context._data or not hasattr(
                context._data['parent'], 'content'):
            context['self'].content(**pageargs)

        __M_writer('\n\n\\end{document}\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #21
0
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        endDT = context.get('endDT', UNDEFINED)
        contextHelp = context.get('contextHelp', UNDEFINED)
        endT = context.get('endT', UNDEFINED)
        startT = context.get('startT', UNDEFINED)
        startDT = context.get('startDT', UNDEFINED)
        __M_writer = context.writer()
        __M_writer(
            '\n<script type="text/javascript">\n\n    $(document).ready(function()\n    {\n        var startDate = IndicoUI.Widgets.Generic.dateField_sdate(false,null,[\'sDay\', \'sMonth\', \'sYear\']);\n        $E(\'sDatePlace\').set(startDate);\n\n        var endDate = IndicoUI.Widgets.Generic.dateField_edate(false,null,[\'eDay\', \'eMonth\', \'eYear\']);\n        $E(\'eDatePlace\').set(endDate);\n\n        /* In case the date changes, we need to check whether the start date is greater than the end date,\n        and if it\'s so we need to change it */\n        startDate.observe(function(value) {\n            if ( IndicoUtil.parseDate(startDate.get()) > IndicoUtil.parseDate(endDate.get()) ) {\n                endDate.set(startDate.get());\n                set_repeatition_comment();\n            }\n            updateFields();\n        });\n\n        endDate.observe(function(value) {\n            if ( IndicoUtil.parseDate(startDate.get()) > IndicoUtil.parseDate(endDate.get()) ) {\n                startDate.set(endDate.get());\n                set_repeatition_comment();\n            }\n            updateFields();\n        });\n\n        $(\'#sTime, #eTime\').on(\'change\', function() {\n            updateFields();\n        });\n\n        function updateFields() {\n            $(\'#start_dt\').val(\'{0}/{1}/{2} {3}\'.format($(\'#sDay\').val(), $(\'#sMonth\').val(), $(\'#sYear\').val(), $(\'#sTime\').val()));\n            $(\'#end_dt\').val(\'{0}/{1}/{2} {3}\'.format($(\'#eDay\').val(), $(\'#eMonth\').val(), $(\'#eYear\').val(), $(\'#eTime\').val()));\n        }\n\n'
        )
        if startDT.day != '':
            __M_writer("            startDate.set('")
            __M_writer(str(encode_if_unicode(startDT.day)))
            __M_writer('/')
            __M_writer(str(encode_if_unicode(startDT.month)))
            __M_writer('/')
            __M_writer(str(encode_if_unicode(startDT.year)))
            __M_writer("');\n")
        __M_writer('\n')
        if endDT.day != '':
            __M_writer("            endDate.set('")
            __M_writer(str(encode_if_unicode(endDT.day)))
            __M_writer('/')
            __M_writer(str(encode_if_unicode(endDT.month)))
            __M_writer('/')
            __M_writer(str(encode_if_unicode(endDT.year)))
            __M_writer("');\n")
        __M_writer(
            '\n        updateFields();\n     });\n</script>\n    <tr id="sdatesTR" >\n        <td class="subFieldWidth" align="right" > '
        )
        __M_writer(str(encode_if_unicode(_("Start Date"))))
        __M_writer(
            '&nbsp;&nbsp;</td>\n        <td class="blacktext">\n            <span id="sDatePlace"></span>\n            <input type="hidden" value="'
        )
        __M_writer(str(encode_if_unicode(startDT.day)))
        __M_writer(
            '" name="sDay" id="sDay"/>\n            <input type="hidden" value="'
        )
        __M_writer(str(encode_if_unicode(startDT.month)))
        __M_writer(
            '" name="sMonth" id="sMonth"/>\n            <input type="hidden" value="'
        )
        __M_writer(str(encode_if_unicode(startDT.year)))
        __M_writer(
            '" name="sYear" id="sYear"/>\n        </td>\n      </tr>\n     <tr id="edatesTR" >\n        <td class="subFieldWidth" align="right" >'
        )
        __M_writer(str(encode_if_unicode(_("End Date"))))
        __M_writer(
            '&nbsp;&nbsp;</td>\n        <td>\n            <span id="eDatePlace"></span>\n            <input type="hidden" value="'
        )
        __M_writer(str(encode_if_unicode(endDT.day)))
        __M_writer(
            '" name="eDay" id="eDay"/>\n            <input type="hidden" value="'
        )
        __M_writer(str(encode_if_unicode(endDT.month)))
        __M_writer(
            '" name="eMonth" id="eMonth"/>\n            <input type="hidden" value="'
        )
        __M_writer(str(encode_if_unicode(endDT.year)))
        __M_writer(
            '" name="eYear" id="eYear"/>\n        </td>\n    </tr>\n    <tr id="hoursTR" >\n        <td class="subFieldWidth" align="right" >'
        )
        __M_writer(str(encode_if_unicode(_("Hours"))))
        __M_writer(
            '&nbsp;&nbsp;</td>\n        <td align="left" class="blacktext">\n            <input name="sTime" id="sTime" maxlength="5" size="5" type="text" value="'
        )
        __M_writer(str(encode_if_unicode(startT)))
        __M_writer(
            '"> &nbsp;&mdash;&nbsp;\n            <input name="eTime" id="eTime" maxlength="5" size="5" type="text" value="'
        )
        __M_writer(str(encode_if_unicode(endT)))
        __M_writer(
            '">\n            <span id="holidays-warning" style="color: Red; font-weight:bold;"></span>\n        </td>\n    </tr>\n    <tr id="repTypeTR" >\n        <td class="subFieldWidth" align="right" >'
        )
        __M_writer(str(encode_if_unicode(_("Type"))))
        __M_writer(
            '&nbsp;&nbsp;</td>\n        <td align="left" class="blacktext" >\n            <select name="repeatability" id="repeatability" onchange="set_repeatition_comment();">\n                <option value="None" selected> '
        )
        __M_writer(str(encode_if_unicode(_("Single day"))))
        __M_writer('</option>\n                <option value="0"> ')
        __M_writer(str(encode_if_unicode(_("Repeat daily"))))
        __M_writer('</option>\n                <option value="1"> ')
        __M_writer(str(encode_if_unicode(_("Repeat once a week"))))
        __M_writer('</option>\n                <option value="2"> ')
        __M_writer(str(encode_if_unicode(_("Repeat once every two weeks"))))
        __M_writer('</option>\n                <option value="3"> ')
        __M_writer(str(encode_if_unicode(_("Repeat once every three weeks"))))
        __M_writer('</option>\n                <option value="4"> ')
        __M_writer(str(encode_if_unicode(_("Repeat every month"))))
        __M_writer(
            '</option>\n            </select>\n            <span id="repComment" style="margin-left: 12px"></span>\n            '
        )
        __M_writer(str(encode_if_unicode(contextHelp('repetitionHelp'))))
        __M_writer('\n        </td>\n    </tr>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
def render_body(context,**pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        contextHelp = context.get('contextHelp', UNDEFINED)
        url_for = context.get('url_for', UNDEFINED)
        locations = context.get('locations', UNDEFINED)
        _session = context.get('_session', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('<!-- CONTEXT HELP DIVS -->\n<div id="tooltipPool" style="display: none">\n  <!-- Where is key? -->\n  <div id="defaultLocationCH" class="tip">\n    ')
        __M_writer(str(encode_if_unicode( _("First location/location by default offered to users"))))
        __M_writer('\n  </div>\n  ')
        runtime._include_file(context, 'CHBookingRepetition.tpl', _template_uri)
        __M_writer('\n</div>\n<!-- END OF CONTEXT HELP DIVS -->\n\n\n<table align="center" width="95%">\n\n<!-- ==================== Manage Locations  ==================== -->\n<!-- =========================================================== -->\n<tr>\n  <td>\n    <table>\n    <tr>\n      <td class="titleUpCellTD" style="width: 160px;">\n        <span class="titleCellFormat">')
        __M_writer(str(encode_if_unicode( _('Available locations'))))
        __M_writer('</span>\n      </td>\n      <td bgcolor="white" valign="top" class="blacktext" style="padding-left: 12px;">\n')
        if locations:
            __M_writer('        <form action="')
            __M_writer(str(encode_if_unicode( url_for('rooms_admin.roomBooking-deleteLocation') )))
            __M_writer('" method="POST">\n          <input type="hidden" name="csrf_token" value="')
            __M_writer(str(encode_if_unicode( _session.csrf_token )))
            __M_writer('">\n          <p>\n')
            for loc in locations:
                __M_writer('              <input type="radio" name="location_id" value="')
                __M_writer(str(encode_if_unicode( loc.id )))
                __M_writer('">\n              <a href="')
                __M_writer(str(encode_if_unicode( url_for('rooms_admin.roomBooking-adminLocation', loc) )))
                __M_writer('">\n                ')
                __M_writer(str(encode_if_unicode( loc.name )))
                __M_writer('\n              </a><br>\n')
            __M_writer('            <input type="submit" class="i-button" value="')
            __M_writer(str(encode_if_unicode( _('Remove') )))
            __M_writer('" />\n          </p>\n        </form>\n')
        __M_writer('        <form action="')
        __M_writer(str(encode_if_unicode( url_for('rooms_admin.roomBooking-saveLocation') )))
        __M_writer('" method="POST">\n          <input type="hidden" name="csrf_token" value="')
        __M_writer(str(encode_if_unicode( _session.csrf_token )))
        __M_writer('">\n          <p>\n            <input type="text" id="newLocationName" name="newLocationName" value="" size="28" />\n            <input type="submit" class="i-button" value="')
        __M_writer(str(encode_if_unicode( _('Add') )))
        __M_writer('" />\n          </p>\n        </form>\n      </td>\n    </tr>\n')
        if locations:
            __M_writer('    <tr>\n      <td class="titleUpCellTD" style="width: 160px;">\n        <span class="titleCellFormat">')
            __M_writer(str(encode_if_unicode( _("Default location") )))
            __M_writer('</span>\n      </td>\n      <td bgcolor="white" valign="top" class="blacktext" style="padding-left: 12px;">\n        <form action="')
            __M_writer(str(encode_if_unicode( url_for('rooms_admin.roomBooking-setDefaultLocation') )))
            __M_writer('" method="POST">\n          <input type="hidden" name="csrf_token" value="')
            __M_writer(str(encode_if_unicode( _session.csrf_token )))
            __M_writer('">\n          <select name="location_id" id="defaultLocation">\n')
            for loc in locations:
                __M_writer('              <option value="')
                __M_writer(str(encode_if_unicode( loc.id )))
                __M_writer('" ')
                __M_writer(str(encode_if_unicode(' selected' if loc.is_default else '')))
                __M_writer(' >')
                __M_writer(str(encode_if_unicode( loc.name )))
                __M_writer('</option>\n')
            __M_writer('          </select>\n          <input type="submit" class="i-button" value="')
            __M_writer(str(encode_if_unicode( _('Change') )))
            __M_writer('">\n          ')
            __M_writer(str(encode_if_unicode( contextHelp('defaultLocationCH') )))
            __M_writer('\n        </form>\n      </td>\n    </tr>\n')
        __M_writer('    </table>\n    <br />\n  </td>\n</tr>\n</table>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #23
0
def render_body(context, event, title, show_dates=False, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs,
                                      show_dates=show_dates,
                                      event=event,
                                      title=title)
        url = context.get('url', UNDEFINED)
        latex_escape = context.get('latex_escape', UNDEFINED)
        tz = context.get('tz', UNDEFINED)
        logo_img = context.get('logo_img', UNDEFINED)
        __M_writer = context.writer()
        __M_writer(
            '\n\n\\begin{titlepage}\n\n\\thispagestyle{fancy}\n\n\\begin{center}\n    \\fontsize{30}{36}\\selectfont \\textbf{'
        )
        __M_writer(
            latex_escape(str(encode_if_unicode(event.title.encode('utf-8')))))
        __M_writer('}\n\\end{center}\n\n\\vspace{2em}\n\n')
        if show_dates:
            __M_writer('    \\begin{center}\n        \\Large\n        ')
            __M_writer(
                latex_escape(
                    str(
                        encode_if_unicode(
                            event.start_dt.astimezone(tz).strftime(
                                "%A %d %B %Y")))))
            __M_writer(' -\n        ')
            __M_writer(
                latex_escape(
                    str(
                        encode_if_unicode(
                            event.end_dt.astimezone(tz).strftime(
                                "%A %d %B %Y")))))
            __M_writer('\n    \\end{center}\n\n')
            if event.venue_name:
                __M_writer(
                    '        \\begin{center}\n            \\Large\n            '
                )
                __M_writer(
                    latex_escape(str(encode_if_unicode(event.venue_name))))
                __M_writer('\n        \\end{center}\n')
            __M_writer('\n    \\vspace{2em}\n')
        __M_writer('\n')
        if logo_img:
            __M_writer(
                '    \\begin{figure}[h!]\n        \\includegraphics[max width=0.85\\linewidth, min width=0.5\\linewidth]{'
            )
            __M_writer(str(encode_if_unicode(logo_img)))
            __M_writer(
                '}\n        \\centering\n    \\end{figure}\n\n    \\vspace{4em}\n'
            )
        else:
            __M_writer('    \\vspace{2em}\n')
        __M_writer(
            '\n\n\n\\vspace{2em}\n\n\\begin{center}\n    {\\fontsize{35}{42}\\selectfont \\sffamily \\textbf{'
        )
        __M_writer(latex_escape(str(encode_if_unicode(title))))
        __M_writer('}}\n\\end{center}\n\n')
        if url:
            __M_writer('    \\fancyfoot[C]{\\tt ')
            __M_writer(latex_escape(str(encode_if_unicode(url))))
            __M_writer('}\n')
        else:
            __M_writer('    \\fancyfoot[C]{}\n')
        __M_writer('\n\\end{titlepage}\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #24
0
 def display( self, **params ):
     """
     """
     return "%s%s%s" % (self._getHTMLHeader(),
                        encode_if_unicode(self._display(params)),
                        self._getHTMLFooter())
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        errors = context.get('errors', UNDEFINED)
        inlineContextHelp = context.get('inlineContextHelp', UNDEFINED)
        blocking = context.get('blocking', UNDEFINED)
        form = context.get('form', UNDEFINED)
        __M_writer = context.writer()

        start_date = blocking.start_date if blocking else form.start_date.data
        end_date = blocking.end_date if blocking else form.end_date.data

        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(
            __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                              for __M_key in ['start_date', 'end_date']
                              if __M_key in __M_locals_builtin_stored]))
        __M_writer(
            '\n\n<div style="width:80%;">\n    <h2 class="page-title">\n')
        if not blocking:
            __M_writer('             ')
            __M_writer(str(encode_if_unicode(_("New Blocking"))))
            __M_writer('\n')
        else:
            __M_writer('             ')
            __M_writer(str(encode_if_unicode(_("Modify Blocking"))))
            __M_writer('\n')
        __M_writer('    </h2>\n')
        if not blocking:
            __M_writer('        <em>')
            __M_writer(
                str(
                    encode_if_unicode(
                        _("""When blocking rooms nobody but you, the rooms' managers and those users/groups you specify in the "Allowed users" list will be able to create bookings for the specified rooms in the given timeframe.
        You can also block rooms you do not own - however, those blockings have to be approved by the owners of those rooms."""
                          ))))
            __M_writer('</em>\n        <br />\n')
        __M_writer('</div>\n\n<form id="blockingForm" method="post">\n    ')
        __M_writer(str(encode_if_unicode(form.csrf_token())))
        __M_writer('\n    ')
        __M_writer(str(encode_if_unicode(form.blocked_rooms())))
        __M_writer(
            '\n    <table cellpadding="0" cellspacing="0" border="0" width="80%">\n        <tr>\n            <td class="intermediateleftvtab" style="border-left: 2px solid #777777; border-right: 2px solid #777777; font-size: xx-small;" width="100%">&nbsp;</td> <!-- lastvtabtitle -->\n        </tr>\n        <tr>\n            <td class="bottomvtab" width="100%">\n                <table width="100%" cellpadding="0" cellspacing="0" class="htab" border="0">\n                    <tr>\n                        <td class="maincell">\n'
        )
        if errors:
            __M_writer(
                '                                <p class="error-message">')
            __M_writer(str(encode_if_unicode(_("Saving failed."))))
            __M_writer('<br>')
            __M_writer(str(encode_if_unicode('<br>'.join(errors))))
            __M_writer('</p>\n')
        __M_writer(
            '                            <table width="100%" align="left" border="0">\n                                <!-- WHEN -->\n                                <tr>\n                                    <td class="titleUpCellTD" valign="top"><span class="titleCellFormat">'
        )
        __M_writer(str(encode_if_unicode(_("Period"))))
        __M_writer(
            '</span></td>\n                                    <td bgcolor="white" width="100%">\n                                        <div id="dateRange"></div>\n                                    </td>\n                                </tr>\n                                <tr><td>&nbsp;</td></tr>\n                                <!-- REASON -->\n                                <tr>\n                                    <td class="titleUpCellTD" valign="top"><span class="titleCellFormat"> '
        )
        __M_writer(str(encode_if_unicode(_("Reason"))))
        __M_writer(' ')
        __M_writer(
            str(
                encode_if_unicode(
                    inlineContextHelp(
                        _("<b>Required.</b> The justification for blocking. Will be displayed to users trying to book."
                          )))))
        __M_writer(
            '</span></td>\n                                    <td bgcolor="white" width="100%">\n                                        '
        )
        __M_writer(str(encode_if_unicode(form.reason(rows=3, cols=50))))
        __M_writer(
            '\n                                    </td>\n                                </tr>\n                                <tr><td>&nbsp;</td></tr>\n                                <!-- ROOMS -->\n                                <tr>\n                                    <td class="titleUpCellTD" valign="top"><span class="titleCellFormat"> '
        )
        __M_writer(str(encode_if_unicode(_("Rooms"))))
        __M_writer(' ')
        __M_writer(
            str(
                encode_if_unicode(
                    inlineContextHelp(
                        _("These rooms will be blocked. Note that the room owner will have to confirm the blocking first unless it is owned by you."
                          )))))
        __M_writer(
            '</span></td>\n                                    <td bgcolor="white" width="100%">\n                                        <div id="roomList" class="PeopleListDiv"></div>\n                                        <div id="roomChooser"></div>\n                                        <div id="roomAddButton"></div>\n                                    </td>\n                                </tr>\n                                <tr><td>&nbsp;</td></tr>\n                                <!-- ACL -->\n                                <tr>\n                                    <td class="titleUpCellTD" valign="top"><span class="titleCellFormat"> '
        )
        __M_writer(str(encode_if_unicode(_("Allowed users/groups"))))
        __M_writer(' ')
        __M_writer(
            str(
                encode_if_unicode(
                    inlineContextHelp(
                        _("These users/groups are allowed to book the selected rooms during the blocking. Note that you as the creator of the blocking are always allowed to book them."
                          )))))
        __M_writer(
            '</span></td>\n                                    <td bgcolor="white" width="100%">\n                                        '
        )
        __M_writer(str(encode_if_unicode(form.principals())))
        __M_writer(
            '\n                                    </td>\n                                </tr>\n                                <tr><td>&nbsp;</td></tr>\n                                <!-- ACTIONS -->\n                                <tr>\n                                   <td colspan="2">\n                                       <table style="width: 100%; background-color: rgb(236, 236, 236); border-top: 1px dashed rgb(119, 119, 119);">\n                                           <tr>\n                                               <td class="titleUpCellTD"></td>\n                                               <td>\n                                                   <input id="submitBlocking" type="submit" class="btn" value="'
        )
        __M_writer(
            str(
                encode_if_unicode(
                    _('Create the blocking') if not blocking else _('Save'))))
        __M_writer(
            '" disabled>\n                                               </td>\n                                           </tr>\n                                       </table>\n                                   </td>\n                                </tr>\n                            </table>\n                        </td>\n                    </tr>\n                </table>\n            </td>\n        </tr>\n    </table>\n</form>\n\n<script>\n    $(document).ready(function() {\n        $(\'#dateRange\').daterange({\n'
        )
        if blocking:
            __M_writer("            labels: ['', ''],\n")
        __M_writer(
            "            fieldNames: ['start_date', 'end_date'],\n            allowPast: "
        )
        __M_writer(str(encode_if_unicode('false' if not blocking else 'true')))
        __M_writer(',\n            disabled: ')
        __M_writer(str(encode_if_unicode('false' if not blocking else 'true')))
        __M_writer(",\n            startDate: '")
        __M_writer(str(encode_if_unicode(start_date.day)))
        __M_writer('/')
        __M_writer(str(encode_if_unicode(start_date.month)))
        __M_writer('/')
        __M_writer(str(encode_if_unicode(start_date.year)))
        __M_writer("',\n            endDate: '")
        __M_writer(str(encode_if_unicode(end_date.day)))
        __M_writer('/')
        __M_writer(str(encode_if_unicode(end_date.month)))
        __M_writer('/')
        __M_writer(str(encode_if_unicode(end_date.year)))
        __M_writer(
            '\'\n        });\n\n        var pm = new IndicoUtil.parameterManager();\n        var hasRooms = false;\n\n        $(\'#submitBlocking\').on(\'click\', function(){\n            if (!pm.check()) {\n                return false;\n            }\n            else if(!hasRooms) {\n                new AlertPopup($T("Warning"), $T("Please add at least one room.")).open();\n                return false;\n            }\n'
        )
        if not blocking:
            __M_writer(
                '                new ConfirmPopup($T("Create blocking"), $T("Do you want to create the blocking? Please note that the start and end date cannot be changed after creation."), function(confirmed) {\n                    if(confirmed) {\n                        $("#blockingForm").submit();\n                    }\n                }).open();\n                return false;\n'
            )
        else:
            __M_writer('                return true;\n')
        __M_writer(
            '        });\n\n        var serializeRooms = function() {\n            var roomGuids = [];\n            enumerate(blockedRoomList.getAll(), function(value, key) {\n                roomGuids.push(key);\n            });\n            hasRooms = (roomGuids.length > 0);\n            $(\'#blocked_rooms\').val(Json.write(roomGuids));\n        };\n\n\n        var blockedRoomList = new RoomListWidget(\'user-list\', function(roomToRemove, setResult) {\n            setResult(true);\n            blockedRoomList.set(roomToRemove, null);\n            serializeRooms();\n        }, true);\n        var roomSelectedBefore = JSON.parse($(\'#blocked_rooms\').val());\n        $E(\'roomList\').set(blockedRoomList.draw());\n\n        var roomChooser = new SelectRemoteWidget(\'roomBooking.locationsAndRooms.listWithGuids\', {isActive: true}, function() {\n            $E(\'roomChooser\').set(roomChooser.draw(), addRoomButton);\n            // sort by room name. we cannot do it serverside since objects are not ordered\n            $(\'#roomChooser select > option\').detach().sort(function(a, b) {\n                return strnatcmp($(a).text().toLowerCase(), $(b).text().toLowerCase());\n            }).appendTo($(\'#roomChooser select\'));\n\n            // Preselect default if we have any\n            $.each(roomSelectedBefore, function(i, id) {\n                var roomName = $(\'option\', roomChooser.select.dom).filter(function() {\n                    return this.value == id;\n                }).text();\n                blockedRoomList.set(id, roomName);\n            });\n            serializeRooms(); // Shouldn\'t be necessary but let\'s stay on the safe side\n            $(\'#submitBlocking\').prop(\'disabled\', false);\n        }, null, null, null, false);\n        var addRoomButton = Html.input("button", {style:{marginRight: pixels(5)}}, $T(\'Add Room\') );\n        addRoomButton.observeClick(function(setResult){\n            var selectedValue = roomChooser.select.get();\n            var roomName = roomChooser.select.dom.options[roomChooser.select.dom.selectedIndex].innerHTML; // horrible..\n            blockedRoomList.set(selectedValue, roomName);\n            serializeRooms();\n        });\n        $E(\'roomAddButton\').set();\n\n        pm.add($E(\'reason\'), \'text\', false);\n    });\n</script>\n'
        )
        return ''
    finally:
        context.caller_stack._pop_frame()
Example #26
0
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        can_navigate = context.get('can_navigate', UNDEFINED)
        details_in_new_tab = context.get('details_in_new_tab', UNDEFINED)
        bars = context.get('bars', UNDEFINED)
        days = context.get('days', UNDEFINED)
        flexible_days = context.get('flexible_days', UNDEFINED)
        specific_room = context.get('specific_room', UNDEFINED)
        show_summary = context.get('show_summary', UNDEFINED)
        show_navbar = context.get('show_navbar', UNDEFINED)
        form_data = context.get('form_data', UNDEFINED)
        repeat_frequency = context.get('repeat_frequency', UNDEFINED)
        start_dt = context.get('start_dt', UNDEFINED)
        end_dt = context.get('end_dt', UNDEFINED)
        __M_writer = context.writer()
        if can_navigate:
            if not form_data:
                __M_writer(
                    '        <form id="room-booking-calendar-form" method="GET">\n            <input type="hidden" name="start_date" value="'
                )
                __M_writer(
                    str(encode_if_unicode(
                        start_dt.date().strftime('%d/%m/%Y'))))
                __M_writer(
                    '">\n            <input type="hidden" name="end_date" value="'
                )
                __M_writer(
                    str(encode_if_unicode(end_dt.date().strftime('%d/%m/%Y'))))
                __M_writer('">\n        </form>\n')
            else:
                __M_writer(
                    '        <form id="room-booking-calendar-form" method="POST">\n'
                )
                for name, values in form_data.iterlists():
                    for value in values:
                        __M_writer(
                            '                    <input type="hidden" name="')
                        __M_writer(str(encode_if_unicode(name)))
                        __M_writer('" value="')
                        __M_writer(str(encode_if_unicode(value)))
                        __M_writer('">\n')
                __M_writer('        </form>\n')
        __M_writer(
            '\n<div id="roomBookingCal"></div>\n<script>\n    var roomBookingCalendar = new RoomBookingCalendar({\n        bars: '
        )
        __M_writer(j(bars))
        __M_writer(',\n        dayAttrs: ')
        __M_writer(j(days))
        __M_writer(',\n        firstDay: ')
        __M_writer(j(start_dt.date().strftime('%Y-%m-%d')))
        __M_writer(',\n        lastDay: ')
        __M_writer(j(end_dt.date().strftime('%Y-%m-%d')))
        __M_writer(',\n        specificRoom: ')
        __M_writer(j(specific_room))
        __M_writer(',\n        repeatFrequency: ')
        __M_writer(j(repeat_frequency))
        __M_writer(',\n        flexibleDays: ')
        __M_writer(j(flexible_days))
        __M_writer(
            ",\n        rejectAllLink: '',\n        openDetailsInNewTab: ")
        __M_writer(j(details_in_new_tab))
        __M_writer(',\n        showSummary: ')
        __M_writer(j(show_summary))
        __M_writer(',\n        showNavBar: ')
        __M_writer(j(show_navbar))
        __M_writer(',\n        canNavigate: ')
        __M_writer(j(can_navigate))
        __M_writer(',\n        paramFormat: ')
        __M_writer(j(('DD/MM/YYYY' if form_data else 'YYYY-MM-DD')))
        __M_writer(
            "\n    });\n\n    $E('roomBookingCal').set(roomBookingCalendar.draw());\n    roomBookingCalendar.addRepeatabilityBarsHovers();\n</script>\n"
        )
        return ''
    finally:
        context.caller_stack._pop_frame()
def render_body(context, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        errors = context.get('errors', UNDEFINED)
        form = context.get('form', UNDEFINED)
        _session = context.get('_session', UNDEFINED)
        max_room_capacity = context.get('max_room_capacity', UNDEFINED)
        my_rooms = context.get('my_rooms', UNDEFINED)
        ignore_userdata = context.get('ignore_userdata', UNDEFINED)
        serializable_rooms = context.get('serializable_rooms', UNDEFINED)
        __M_writer = context.writer()
        __M_writer('<h2 class="page-title">\n    ')
        __M_writer(str(encode_if_unicode(_('Book a room'))))
        __M_writer(
            '\n</h2>\n\n<ul id="breadcrumbs" style="margin: 0px 0px 0px -15px; padding: 0; list-style: none;">\n    <li><span class="current">'
        )
        __M_writer(str(encode_if_unicode(_('Specify Search Criteria'))))
        __M_writer('</span></li>\n    <li><span>')
        __M_writer(str(encode_if_unicode(_('Select Available Period'))))
        __M_writer('</span></li>\n    <li><span>')
        __M_writer(str(encode_if_unicode(_('Confirm Reservation'))))
        __M_writer('</span></li>\n</ul>\n\n')
        runtime._include_file(
            context,
            'ErrorList.tpl',
            _template_uri,
            errors=errors,
            msg=_("There are some errors in the search criteria"))
        __M_writer('\n\n<form id="searchForm" method="POST" action="">\n    ')
        __M_writer(str(encode_if_unicode(form.csrf_token())))
        __M_writer(
            '\n    <input type="hidden" name="step" value="1">\n\n    <h2 class="group-title">\n        <i class="icon-location"></i>\n        '
        )
        __M_writer(str(encode_if_unicode(_('Rooms'))))
        __M_writer(
            '\n    </h2>\n    <div id="roomselector"></div>\n\n    <h2 class="group-title">\n        <i class="icon-time"></i>\n        '
        )
        __M_writer(str(encode_if_unicode(_('Booking time & date'))))
        __M_writer('\n    </h2>\n    ')
        runtime._include_file(context,
                              'RoomBookingNewBookingPeriodWidget.tpl',
                              _template_uri,
                              form=form,
                              flexibility=True)
        __M_writer(
            '\n\n    <h2 class="group-title"></h2>\n    <button type="submit" class="i-button highlight">'
        )
        __M_writer(str(encode_if_unicode(_('Continue'))))
        __M_writer(
            '</button>\n</form>\n\n<script>\n    var userId = "rb-user-')
        __M_writer(
            str(
                encode_if_unicode(
                    _session.user.id if _session.user else 'not-logged')))
        __M_writer(
            '";\n    var rbUserData = $.jStorage.get(userId, {});\n    var maxRoomCapacity = '
        )
        __M_writer(str(encode_if_unicode(max_room_capacity)))
        __M_writer(';\n    var rooms = ')
        __M_writer(j(serializable_rooms))
        __M_writer(';\n    var myRooms = ')
        __M_writer(j(my_rooms))
        __M_writer(
            ';\n\n    $(document).ready(function() {\n        initWidgets();\n'
        )
        if not ignore_userdata:
            __M_writer('            restoreUserData();\n')
        __M_writer(
            "\n        function initWidgets() {\n            $('#roomselector').roomselector({\n                allowEmpty: false,\n                rooms: rooms,\n                myRooms: myRooms,\n                roomMaxCapacity: maxRoomCapacity,\n                userData: "
        )
        __M_writer(
            str(encode_if_unicode(
                'rbUserData' if not ignore_userdata else {})))
        __M_writer(",\n                selectName: '")
        __M_writer(str(encode_if_unicode(form.room_ids.name)))
        __M_writer("',\n                selectedRooms: ")
        __M_writer(j(form.room_ids.data))
        __M_writer(
            '\n            });\n        }\n\n        function restoreUserData() {\n            if (rbUserData.startDate) {\n                var savedStartDate = moment(rbUserData.startDate).toDate();\n                if ($(\'#sDatePlace\').datepicker(\'getDate\').getTime() != savedStartDate.getTime()) {\n                    $(\'.js-default-date-warning\').hide();\n                }\n                $(\'#sDatePlace\').datepicker(\'setDate\', savedStartDate);\n            }\n            if (rbUserData.endDate) {\n                $("#eDatePlace").datepicker(\'setDate\', moment(rbUserData.endDate).toDate());\n            }\n\n            $("#finishDate").val(rbUserData.finishDate);\n            $("input[name=repeat_frequency][value=" + rbUserData.repeatFrequency + "]").prop(\'checked\', true).change();\n            $("#flexibleDates input[name=flexible_dates_range][value=" + rbUserData.flexibleDatesRange + "]").prop(\'checked\', true);\n\n            if (rbUserData.startTime && rbUserData.endTime) {\n                $(\'#timerange\').timerange(\'setStartTime\', rbUserData.startTime).timerange(\'setEndTime\', rbUserData.endTime);\n            }\n        }\n    });\n</script>\n'
        )
        return ''
    finally:
        context.caller_stack._pop_frame()