コード例 #1
0
ファイル: test6.py プロジェクト: unit193/cherokee
    def __call__ (self):
        dialog = CTK.Dialog ({'title': "New Virtual Server", 'width': 500, 'autoOpen': True})
        dialog += CTK.Druid (CTK.RefreshableURL ('/url1'))

        page = CTK.Page()
        page += dialog
        return page.Render()
コード例 #2
0
ファイル: PageDownload.py プロジェクト: Rythm123/web
    def __call__ (self):
        title = _("Quickstart Guide")

        # Install Cherokee
        os_combo = OS_Panel()
        druid    = CTK.Druid (CTK.RefreshableURL ('%s/%s'%(URL_BASE, os_combo.os_selected)))

        box  = CTK.Box ({'id': 'platform-box'})
        box += os_combo

        step1  = CTK.Box({'id': 'qs-step-1', 'class': 'qs-step'})
        step1 += box
        step1 += CTK.RawHTML ("<h1>%s</h1>" %(title))
        step1 += CTK.RawHTML ('<h2>%s</h2>' %(_("Install Cherokee")))
        step1 += druid
        os_combo.bind ('change', druid.JS_to_goto('"%s/"+$("#%s").val()' %(URL_BASE, os_combo.combo.id)))

        # Page
        page = Page.Page_Menu_Side (title=title)
        page  += step1

        # Development version
        page.sidebar += Development_Version()

        # Mirros
        mirrors = Mirror_Sites.Mirrors()
        page.sidebar += mirrors

        # This page cannot be cached. It'd break the OS detection.
        return page.Render()
コード例 #3
0
ファイル: druid-submits.py プロジェクト: zevenet/cherokee
def main():
    page = CTK.Page()

    refresh = CTK.RefreshableURL ('/content', {'id': "test-refresh"})
    druid   = CTK.Druid (refresh)

    dialog = CTK.Dialog({'title': "Test", 'autoOpen': True})
    dialog += druid

    page += dialog
    return page.Render()
コード例 #4
0
    def __init__(self):
        CTK.Dialog.__init__(self, {
            'title': _("Maintenance"),
            'width': 600,
            'minHeight': 300
        })

        self.refresh = CTK.RefreshableURL()
        self.druid = CTK.Druid(self.refresh)
        self.druid.bind('druid_exiting', self.JS_to_close())
        self += self.druid
コード例 #5
0
    def __init__(self):
        CTK.Box.__init__(self, {'class': 'backup-restore'})

        # Druid
        druid = CTK.Druid(CTK.RefreshableURL())
        dialog = CTK.Dialog({'title': _(NOTE_RESTORE_H2), 'width': 480})
        dialog += druid

        # Trigger button
        link = CTK.Link("#", CTK.RawHTML(_('Restore…')))
        link.bind(
            'click',
            druid.JS_to_goto('"%s"' % (URL_RESTORE_NOTE)) +
            dialog.JS_to_show())

        self += dialog
        self += link
コード例 #6
0
    def __init__(self):
        CTK.Box.__init__(self, {'class': 'backup-save'})

        # Druid
        druid = CTK.Druid(CTK.RefreshableURL())
        dialog = CTK.Dialog({'title': _(NOTE_SAVE_H2), 'width': 480})
        dialog += druid
        druid.bind('druid_exiting', dialog.JS_to_close())

        # Trigger button
        link = CTK.Link("#", CTK.RawHTML(_('Back up…')))
        link.bind(
            'click',
            druid.JS_to_goto('"%s"' % (URL_SAVE_NOTE)) + dialog.JS_to_show())

        self += dialog
        self += link
コード例 #7
0
        def __init__ (self):
            CTK.Box.__init__ (self, {'class': 'panel-buttons'})

            # Add New
            dialog = CTK.Dialog ({'title': _('Add New Virtual Server'), 'width': 720})
            dialog.id = 'dialog-new-vserver'
            dialog.AddButton (_('Cancel'), "close")
            dialog.AddButton (_('Add'), dialog.JS_to_trigger('submit'))
            dialog += VirtualServerNew()

            druid  = CTK.Druid (CTK.RefreshableURL())
            wizard = CTK.Dialog ({'title': _('Virtual Server Configuration Assistant'), 'width': 550})
            wizard += druid
            druid.bind ('druid_exiting',
                        wizard.JS_to_close() +
                        self.JS_to_trigger('submit_success'))

            button = CTK.Button('<img src="/static/images/panel-new.png" />', {'id': 'vserver-new-button', 'class': 'panel-button', 'title': _('Add New Virtual Server')})
            button.bind ('click',
                         JS_ACTIVATE_FIRST %(dialog.id) +
                         dialog.JS_to_show())
            dialog.bind ('submit_success', dialog.JS_to_close())
            dialog.bind ('submit_success', self.JS_to_trigger('submit_success'))
            dialog.bind ('open_wizard',
                         dialog.JS_to_close() +
                         druid.JS_to_goto("'/wizard/vserver/' + event.wizard") +
                         wizard.JS_to_show())

            self += button
            self += dialog
            self += wizard

            # Clone
            dialog = CTK.Dialog ({'title': _('Clone Virtual Server'), 'width': 480})
            dialog.AddButton (_('Cancel'), "close")
            dialog.AddButton (_('Clone'), JS_CLONE + dialog.JS_to_close())
            dialog += CTK.RawHTML ('<p>%s</p>' %(_(NOTE_CLONE_DIALOG)))

            button = CTK.Button('<img src="/static/images/panel-clone.png" />', {'id': 'vserver-clone-button', 'class': 'panel-button', 'title': _('Clone Selected Virtual Server')})
            button.bind ('click', dialog.JS_to_show())

            self += dialog
            self += button
コード例 #8
0
    def __init__(self, app_name):
        index = Distro.Index()
        app = index.get_package(app_name, 'software')

        title = "%s  —  %s" % (app['name'], _("Cherokee Market"))

        CTK.Dialog.__init__(self, {
            'title': title,
            'width': 600,
            'minHeight': 300
        })
        self.info = app

        # Copy a couple of preliminary config entries
        CTK.cfg['tmp!market!install!app!application_id'] = app['id']
        CTK.cfg['tmp!market!install!app!application_name'] = app['name']

        self.refresh = CTK.RefreshableURL()
        self.druid = CTK.Druid(self.refresh)
        self.druid.bind('druid_exiting', self.JS_to_close())

        self += self.druid
コード例 #9
0
    def __init__(self, app_name):
        CTK.Box.__init__(self, {'class': 'cherokee-market-app'})

        index = Distro.Index()

        app = index.get_package(app_name, 'software')
        maintainer = index.get_package(app_name, 'maintainer')

        # Install dialog
        install = InstallDialog(app_name)

        # Author
        by = CTK.Container()
        by += CTK.RawHTML('%s ' % (_('By')))
        by += CTK.LinkWindow(app['URL'], CTK.RawHTML(app['author']))

        install_button = CTK.Button(_("Install"))
        install_button.bind('click', install.JS_to_show())

        # Report button
        druid = CTK.Druid(CTK.RefreshableURL())
        report_dialog = CTK.Dialog({
            'title': (_("Report Application")),
            'width': 480
        })
        report_dialog += druid
        druid.bind('druid_exiting', report_dialog.JS_to_close())

        report_link = CTK.Link(None, CTK.RawHTML(_("Report issue")))
        report_link.bind ('click', report_dialog.JS_to_show() + \
                                   druid.JS_to_goto('"%s/%s"'%(URL_REPORT, app_name)))

        report = CTK.Container()
        report += report_dialog
        report += report_link

        # Info
        repo_url = CTK.cfg.get_val('admin!ows!repository', REPO_MAIN)
        url_icon_big = os.path.join(repo_url, app['id'], "icons",
                                    app['icon_big'])

        appw = CTK.Box({'class': 'market-app-desc'})
        appw += CTK.Box({'class': 'market-app-desc-icon'},
                        CTK.Image({'src': url_icon_big}))
        appw += CTK.Box({'class': 'market-app-desc-buy'}, install_button)
        appw += CTK.Box({'class': 'market-app-desc-title'},
                        CTK.RawHTML(app['name']))
        appw += CTK.Box({'class': 'market-app-desc-version'},
                        CTK.RawHTML("%s: %s" % (_("Version"), app['version'])))
        appw += CTK.Box({'class': 'market-app-desc-url'}, by)
        appw += CTK.Box(
            {'class': 'market-app-desc-packager'},
            CTK.RawHTML("%s: %s" %
                        (_("Packager"), maintainer['name'] or _("Orphan"))))
        appw += CTK.Box({'class': 'market-app-desc-category'},
                        CTK.RawHTML("%s: %s" %
                                    (_("Category"), app['category'])))
        appw += CTK.Box({'class': 'market-app-desc-short-desc'},
                        CTK.RawHTML(app['desc_short']))
        appw += CTK.Box({'class': 'market-app-desc-report'}, report)

        # Support
        ext_description = CTK.Box({'class': 'market-app-desc-description'})
        ext_description += CTK.RawHTML(app['desc_long'])
        desc_panel = CTK.Box({'class': 'market-app-desc-desc-panel'})
        desc_panel += ext_description
        desc_panel += CTK.Box({'class': 'market-app-desc-support-box'},
                              SupportBox(app_name))

        # Shots
        shots = CTK.CarouselThumbnails()
        shot_entries = app.get('screenshots', [])

        if shot_entries:
            for s in shot_entries:
                shots += CTK.Image({
                    'src':
                    os.path.join(repo_url, app_name, "screenshots", s)
                })
        else:
            shots += CTK.Box({'id': 'shot-box-empty'},
                             CTK.RawHTML('<h2>%s</h2>' %
                                         (_("No screenshots"))))

        # Tabs
        tabs = CTK.Tab()
        tabs.Add(_('Screenshots'), shots)
        tabs.Add(_('Description'), desc_panel)

        # GUI Layout
        self += appw
        self += tabs
        self += install