Пример #1
0
    def renderSignatureLoot(self, signatureKey):
        result = Modal(
            id='lootModal',
            content=[
                T.div(id='containers')[
                    T.div(class_='buttons')[
                            T.button(type='button', class_='btn btn-success', **{'data-level': 'trivial'})['+ Debris'],
                            T.button(type='button', class_='btn btn-success', **{'data-level': 'easy'})['+ Rubble'],
                            T.button(type='button', class_='btn btn-warning', **{'data-level': 'medium'})['+ Remains'],
                            T.button(type='button', class_='btn btn-danger', **{'data-level': 'hard'})['+ Ruins'],
                    ],

                    T.div(id='contentPaste')[
                        Panel(
                            heading='Paste content of container below',
                            content=[
                                T.div(class_='row')[
                                    T.div(class_='col-xs-9')[
                                        T.textarea(class_="form-control", rows="2"),
                                    ],
                                    T.div(class_='col-xs-3')[
                                        T.button(class_='btn btn-default')['Submit'],
                                        T.div(class_='ajaxLoader', style='white-space: nowrap')[
                                            T.img(src='/static/images/ajax-loader.gif'),
                                            ' Processing'
                                        ],
                                    ],
                                ],
                            ]
                        ),
                    ],

                    T.div(class_='row container-list')[
                        T.div(class_='col-xs-3 blueprint')[
                            T.div(class_='thumbnail')[
                                T.img(src='#'),
                                T.div(class_='caption')[
                                    T.strong()['Lorem ipsum'],
                                    T.div(class_='totalWorth')['Lorem ipsum'],
                                ],

                                T.a(href='#', title='Delete', **{'data-toggle': 'tooltip', 'data-placement': 'top'})[
                                    T.span(class_='glyphicon glyphicon-remove-circle')
                                ]
                            ]

                        ]
                    ],
                ]
            ],
            heading=['Loot for signature ', T.strong[signatureKey]],
        )

        return result
Пример #2
0
    def render(self, form):

        formHtml = (
            T.form(class_="form-horizontal", method='POST')[

                forEach(form, lambda field: (
                    self.renderField(field)
                )),

                T.div(class_="form-group")[
                    T.div(class_="col-sm-offset-3 col-sm-9")[
                        [
                            T.button(class_="btn btn-default")[name]
                            for name in self.buttons
                        ]
                    ]
                ],
            ]
        )

        if self.renderPanel:
            formHtml = (
                T.div(class_="panel panel-default")[
                    T.div(class_="panel-body")[
                        formHtml
                    ]
                ]
            )

        return (
            formHtml
        )
Пример #3
0
    def renderApiKeys(self, keys):
        content = (
            T.h2['API Keys'],

            T.p[
                T.a(href=self.getUrl('profile/newKey'))[
                    T.button(class_='btn btn-primary')['Add key']
                ],
            ],

            T.div(class_='panel panel-default')[
                T.div(class_='panel-heading')['Added keys'],

                T.table(class_='table')[
                    T.thead[
                        T.tr[
                            T.th['Key ID'],
                            T.th['Expires'],
                            T.th['Characters'],
                            T.th()
                        ]
                    ],
                    T.tbody[
                        forEach(keys, lambda keyId, expires, characters: (
                            T.tr[
                                T.td[keyId],
                                T.td[expires],
                                T.td[
                                    [
                                        T.div[char]
                                        for char in characters
                                    ]
                                ],
                                T.td[
                                    T.a(class_='glyphicon glyphicon-info-sign withTooltip', title='Detailed info',
                                        href='#',
                                        **{'data-placement': 'top', 'data-toggle': 'tooltip'}),
                                    ' ',
                                    T.a(class_='glyphicon glyphicon-trash withTooltip text-danger', title='Delete key',
                                        href='#',
                                        **{'data-placement': 'top', 'data-toggle': 'tooltip'}),
                                ]
                            ]
                        )),
                    ]
                ]
            ]
        )

        html = HtmlLayout()
        html.setContent(content)
        return html
Пример #4
0
def Modal(id, content, heading=None, footer=None):
    result = []

    result.append(T.div(class_='modal fade', id=id, tabindex='-1', role='dialog')[
        T.div(class_='modal-dialog')[
            T.div(class_='modal-content')[
                T.div(class_='modal-header')[
                    T.button(type='button', class_='close', **{'data-dismiss': 'modal'})[
                        T.span[entities.times],
                        T.span(class_='sr-only')['Close']
                    ],
                    T.h4(class_='modal-title')[heading]
                ],
                T.div(class_='modal-body')[
                    content
                ],
                C.when(footer is not None)[
                    T.div(class_='modal-footer')[footer]
                ]
            ]
        ]
    ])

    return result
Пример #5
0
    def renderNavbar(self, tag, data):
        """
        :type data: (werkzeug.routing.MapAdapter, None)
        """

        (url, unused) = data

        currentEndpoint = url.match()[0]

        burgerToggle = lambda targetId: (
            T.button(class_='navbar-toggle', **{'data-toggle': 'collapse', 'data-target': '#%s' % targetId})[
                T.span(class_='sr-only')['Toggle navigation'],
                T.span(class_='icon-bar'),
                T.span(class_='icon-bar'),
                T.span(class_='icon-bar'),
            ]
        )

        mainNavigation = lambda: (
            forEach(self.modules, lambda mod: (
                T.li(class_='active' if currentEndpoint in mod.endpoints else None)[
                    T.a(href=url.build(mod.pages[0].endpoint))[mod.name]
                ]
            ))
        )

        html = (
            T.nav(class_='navbar navbar-default', role='navigation')[
                T.div(class_='container-fluid')[
                    T.div(class_='navbar-header')[
                        burgerToggle('mainNavCollapse'),
                        T.span(class_='navbar-brand')['Rudykocur Maxwell']
                    ],

                    T.div(class_='collapse navbar-collapse', id='mainNavCollapse')[
                        T.ul(class_="nav navbar-nav")[
                            mainNavigation()
                        ],

                        T.ul(class_="nav navbar-nav navbar-right")[
                            T.li(class_='dropdown')[
                                T.a(href='#', class_='dropdown-toggle', **{'data-toggle': 'dropdown'})[
                                    'Characters', ' ',
                                    T.span(class_='caret')
                                ],
                                T.ul(class_='dropdown-menu', role='menu')[
                                    T.li(role='presentation', class_='dropdown-header')['Account: Rudykocur'],
                                    T.li[T.a(href='#')['Rudykocur Maxwell']],
                                    T.li[T.a(href='#')['Imaginary Profile']],
                                    T.li(role='presentation', class_='divider'),
                                    T.li(role='presentation', class_='dropdown-header')['Account: Generic'],
                                    T.li[T.a(href='#')['All Skills V']],
                                ],
                            ],
                            T.li[
                                T.a(href=url.build('logout'))['Logout']
                            ]
                        ]
                    ]
                ]
            ]
        )

        return tag[html]
Пример #6
0
    def renderResponse(self, helper, signatures):

        layout = IGBLayout()
        layout.addJs('common.js')
        layout.addJs('scanning.js')
        layout.addJs('loot.js')

        if helper.isTrusted:

            content = [
                Panel(
                    heading=[
                        self._renderHeader(helper),
                    ],
                    content=[
                        T.div(class_='row')[
                            T.div(class_='col-xs-8')[
                                T.textarea(class_="form-control",
                                           id="signaturesInput",
                                           rows="2",
                                           style="overflow: hidden; resize: none",
                                           placeholder="Paste scanning content here")
                            ],
                            T.div(class_='col-xs-4')[
                                T.button(class_='btn btn-default', id='processButton')['Submit'],
                                T.img(id='ajaxLoader', src='/static/images/ajax-loader.gif'),
                            ],

                        ]
                    ]
                ),
                Panel(heading=['Known signatures in ', T.strong[helper.systemName],
                               T.div(class_='pull-right')[
                                   T.a(href=self.getUrl('scanning/help'))['How to use this tool']
                               ]],
                      content=[
                          T.div(id='bookmarkContainer')[
                              self.getKnownSignaturesTable(signatures)
                          ],

                      ]),
                T.script[
                    """
                    $(document).ready(function() {
                        BookmarkManager.init({
                            container: document.getElementById('bookmarkContainer'),
                            processButton: document.getElementById('processButton'),
                            signaturesInput: document.getElementById('signaturesInput'),
                            ajaxLoader: document.getElementById('ajaxLoader'),

                            systemName: '%(system)s'
                        });

                        LootInterface.init();
                    });
                    """ % dict(system=helper.systemName)
                ]
            ]

            layout.setContent(content)

        return layout