Exemplo n.º 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
Exemplo n.º 2
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