Beispiel #1
0
    def __call__ (self):
        # Find the DMG file
        dmg_refs = Downloads.get_latest_macosx_dmg()

        # No MacOS package found
        if not dmg_refs:
            content = CTK.Container()
            content += CTK.RawHTML ("<h3>%s</h3>" %(_("Could not find the MacOS X package")))
            content += CTK.RawHTML ("<p>%s</p>" %(_("It seems that the MacOS X package for the latest version has not been compiled yet.")))
            content += CTK.RawHTML ("<p>%s</p>" %(_("Due the circunstances, we encourage you to download the source code and compile it by hand.")))
            return CTK.HTTP_Cacheable (60, body = content.Render().toStr())

        dmg_local, dmg_web = dmg_refs
        dmg_url = "http://www.cherokee-project.com%s"%(dmg_web)

        if os.path.exists (dmg_local):
            mbs = os.path.getsize (dmg_local) / (1024**2)
        else:
            mbs = 0
        ver = re.findall (r'(\d+\.\d+\.\d+)', dmg_web)[0]

        download_button = CTK.Button ('Get Cherokee %s DMG'%(ver)) # ??? %sMb'%(mbs))
        download_button.bind ('click', CTK.DruidContent__JS_to_goto (download_button.id, URL_MACOSX_2))

        content = CTK.Container()
        content += CTK.RawHTML ('<h3>Binary Package</h3>')
        content += CTK.RawHTML ('<p>%s</p>'%(_("A binary package for MacOS X (Intel) is available for download: %sMb"%(mbs))))
        content += download_button

        return CTK.HTTP_Cacheable (60, body=content.Render().toStr())
Beispiel #2
0
    def __call__ (self):
        content = CTK.Container()
        content += CTK.RawHTML ("<h3>%s</h3>" %(_("The Windows port is an ongoing effort...")))
        content += CTK.RawHTML ("<p>%s</p>" %(_('Even though the source code of the Cherokee Web Server can be compiled on Windows (<i>with the mingw + msys</i>), it is not stable enough to be considered production ready.')))
        content += CTK.RawHTML ("<p>%s</p>" %(_('Developers are welcome to join the effort of finishing the port of Cherokee to Windows. Do not hesitate to <a href="http://git.cherokee-project.com/" target="_blank">join us</a>!')))

        return CTK.HTTP_Cacheable (60, body=content.Render().toStr())
Beispiel #3
0
    def __call__ (self):
        tarball_refs = Downloads.get_latest_tarball()
        tar_local, tar_web = tarball_refs

        # Automatic
        content = CTK.Container()
        content += CTK.RawHTML ("<h3>%s</h3>" %(_("Option 1: Automatic installation")))

        box  = CTK.Box()
        box += CTK.RawHTML ('<p>%s</p>' %(_('Open a terminal and enter:')))
        box += CTK.RawHTML ('<pre class="terminal">wget http://cherokee-project.com/install && python install</pre>')
        box += CTK.RawHTML ('<p>%s</p>' %(_('or')))
        box += CTK.RawHTML ('<pre class="terminal">curl -LO http://cherokee-project.com/install && python install</pre>')
        box += CTK.RawHTML ('<p>%s</p>' %(_('This will download and install Cherokee under /opt/cherokee')))
        content += box

        # By hand
        content += CTK.RawHTML ("<h3>%s</h2>" %(_("Option 2: Compile it by hand")))

        sources  = CTK.Box()
        sources += CTK.RawHTML ('%s '%(_("Download")))
        sources += CTK.Link (tar_web, CTK.RawHTML (_("latest source code package")))
        sources += CTK.RawHTML (', and install it by hand doing the <i>./configure, make, make install</i> dance.')
        sources += CTK.RawHTML ('<pre class="terminal">configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc<br/>make && sudo make install</pre>')
        sources += CTK.RawHTML ('Older releases are also available at our <a href="/download/">Downloads archive</a>.')

        content += sources

        return CTK.HTTP_Cacheable (60, body=content.Render().toStr())
Beispiel #4
0
    def __call__(self):
        application_id = CTK.request.url.split('/')[-1]

        # Build the content
        submit = CTK.Submitter(URL_REPORT_APPLY)
        submit += CTK.TextArea({
            'name': 'report',
            'rows': 10,
            'cols': 60,
            'class': 'noauto'
        })
        submit += CTK.Hidden('app_id', application_id)
        submit.bind('submit_fail',
                    CTK.DruidContent__JS_to_goto(submit.id, URL_REPORT_FAIL))
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(submit.id, URL_REPORT_OK))

        cont = CTK.Container()
        cont += CTK.RawHTML("<h2>%s</h2>" % (_(NOTE_REPORT_H2)))
        cont += CTK.RawHTML("<p>%s</p>" % (_(NOTE_REPORT_EXPLAIN)))
        cont += CTK.RawHTML("<p>%s</p>" % (_(NOTE_REPORT_COMMENT)))
        cont += submit

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Submit(_("Report"))
        buttons += CTK.DruidButton_Close(_("Cancel"))
        cont += buttons

        return cont.Render().toStr()
Beispiel #5
0
    def format_func(self, info, from_cache=False):
        cont = CTK.Container()

        # Empty library
        if not info:
            cont += CTK.RawHTML(_("You have not bought any app yet"))

        # Render app list
        for app in info:
            link = CTK.Link("%s/%s" % (URL_APP, app['application_id']),
                            CTK.RawHTML(app['application_name']))
            itembox = CTK.Box({'class': 'market-my-library-item'})
            itembox += CTK.Box({'class': 'market-my-library-icon'},
                               CTK.Image(
                                   {'src': OWS_STATIC + app['icon_small']}))
            itembox += CTK.Box({'class': 'market-my-library-name'}, link)
            cont += itembox

        # Cache
        if not from_cache:
            global cached_info
            global cache_expiration

            cached_info = info
            cache_expiration = time.time() + EXPIRATION

        return cont.Render().toStr()
Beispiel #6
0
def default_admin(message=None, assets=None):
    not_admin = Auth.assert_is_role(Role.ROLE_ADMIN)
    if not_admin:
        return not_admin

    # Render
    page = Page.Default()
    page += CTK.RawHTML("<h1>%s: Permisos</h1>" % ADMIN_LINK)
    contents = get_admin_contents()

    main = CTK.Container()
    if len(contents):
        main += Paginate(contents, DefaultWidget)
    else:
        main += CTK.RawHTML("<h2>No hay activos.</h2>")

    if assets != None:
        page += CTK.RawHTML("<h2>Activos buscados</h2>")
        page += acl_get_custom(assets)

    tabs = CTK.Tab()
    tabs.Add('Activos', main)
    tabs.Add('Búsqueda', WidgetLookup.get_fields_form(ACL_ADMIN_LOOKUP))
    page += tabs

    if message:
        page += Message(message)
    return page.Render()
Beispiel #7
0
    def __call__(self):
        table = CTK.PropsTable()
        table.Add(
            _('New Host Name'),
            CTK.TextCfg('%s!new_host' % (PREFIX), False, {
                'value': 'www.example.com',
                'class': 'noauto'
            }), _(NOTE_HOST))
        table.Add(
            _('Document Root'),
            CTK.TextCfg('%s!document_root' % (PREFIX), False, {
                'value': os_get_document_root(),
                'class': 'noauto'
            }), _(NOTE_DROOT))
        table.Add(_('Use Same Logs as'),
                  Wizard.CloneLogsCfg('%s!logs_as_vsrv' % (PREFIX)),
                  _(Wizard.CloneLogsCfg.NOTE))

        submit = CTK.Submitter(URL_APPLY)
        submit += CTK.Hidden('final', '1')
        submit += table

        cont = CTK.Container()
        cont += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_HOST_H1)))
        cont += submit
        cont += CTK.DruidButtonsPanel_PrevCreate_Auto()
        return cont.Render().toStr()
Beispiel #8
0
    def __call__(self):
        container = CTK.Container()
        container += CTK.RawHTML("<h2>%s</h2>" %
                                 (_('Create a new configuration file:')))

        key = 'regular'
        name = _('Regular')
        label = _(
            'Regular configuration: Apache logs, MIME types, icons, etc.')
        container += Form(key, name, label)

        key = 'static'
        name = _('Static Content')
        label = _('Optimized to send static content.')
        container += Form(key, name, label)

        key = 'development'
        name = _('Server Development')
        label = _('No standard port, No log files, No PID file, etc.')
        container += Form(key, name, label)

        conf_file = CTK.cfg.file
        notice = CTK.Notice('warning')
        notice += CTK.RawHTML("<b>%s</b><br/>" % (_(WARNING_NOT_FOUND_1) %
                                                  (locals())))
        notice += CTK.RawHTML(WARNING_NOT_FOUND_2)

        page = Page.Base(_('New Configuration File'),
                         body_id='new-config',
                         helps=HELPS)
        page += CTK.RawHTML("<h1>%s</h1>" %
                            (_('Configuration File Not Found')))
        page += notice
        page += CTK.Indenter(container)
        return page.Render()
Beispiel #9
0
    def __call__(self):
        # Trim deployment options if needed
        if not path_find_binary(DEFAULT_BINS):
            RAILS_METHOD.remove(('fcgi', 'FastCGI'))

        submit = CTK.Submitter(URL_APPLY)
        table = CTK.PropsTable()
        submit += table

        table.Add(_('Project Directory'),
                  CTK.TextCfg('%s!ror_dir' % (PREFIX), False), _(NOTE_ROR_DIR))
        table.Add(
            _('RAILS_ENV environment'),
            CTK.ComboCfg('%s!ror_env' % (PREFIX), trans_options(RAILS_ENV),
                         {'class': 'noauto'}), _(NOTE_ENV))

        if len(RAILS_METHOD) > 1:
            table.Add(
                _('Deployment method'),
                CTK.ComboCfg('%s!ror_method' % (PREFIX),
                             trans_options(RAILS_METHOD), {'class': 'noauto'}),
                _(NOTE_METHOD))
        else:
            submit += CTK.Hidden('%s!ror_method' % (PREFIX),
                                 RAILS_METHOD[0][0])

        cont = CTK.Container()
        cont += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_LOCAL_H1)))
        cont += submit
        cont += CTK.DruidButtonsPanel_PrevNext_Auto()
        return cont.Render().toStr()
Beispiel #10
0
    def __call__ (self):
        vsrv_num = CTK.cfg.get_val("%s!vsrv_num"%(PREFIX))
        nick = CTK.cfg.get_val("vserver!%s!nick"%(vsrv_num))
        if not '.' in nick:
            nick = "example.com"

        refresh = CTK.Refreshable ({'id':'hotlinking_wizard_refresh'})
        refresh.register (lambda: self.Refresh().Render())

        combo_widget = CTK.ComboCfg ('%s!type'%(PREFIX), trans_options(TYPES))
        combo_widget.bind('change', refresh.JS_to_refresh())

        table = CTK.PropsTable()
        table.Add (_('Domain Name'), CTK.TextCfg ('%s!domain'%(PREFIX), False, {'value': nick}), _(NOTE_DOMAIN))
        table.Add (_('Reply type'), combo_widget, _(NOTE_TYPE))

        submit = CTK.Submitter (URL_APPLY)
        submit += CTK.Hidden('final', '1')
        submit += table

        cont = CTK.Container()
        cont += CTK.RawHTML ('<h2>%s</h2>' %(_(NOTE_RULE_H1)))
        cont += submit
        cont += refresh
        cont  += CTK.DruidButtonsPanel_PrevCreate_Auto()
        return cont.Render().toStr()
Beispiel #11
0
    def __call__(self):
        commands = []

        for app in CTK.cfg.keys('tmp!market!maintenance!remove'):
            # Should it be deleted?
            delete = CTK.cfg.get_val(
                'tmp!market!maintenance!remove!%s!del' % (app), 0)
            if not int(delete):
                continue

            # Build the command list
            name = CTK.cfg.get_val('tmp!market!maintenance!remove!%s!name' %
                                   (app))
            date = CTK.cfg.get_val('tmp!market!maintenance!remove!%s!date' %
                                   (app))

            entry = {}
            entry['description'] = _("Removing %(name)s (%(date)s)" %
                                     (locals()))
            entry['function'] = lambda app=app: _remove_app(app)

            commands += [entry]

        cont = CTK.Container()
        cont += CTK.RawHTML("<h2>%s</h2>" % (_("Removing Applications")))
        cont += CommandProgress.CommandProgress(commands,
                                                URL_MAINTENANCE_FINISHED)

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        cont += buttons

        return cont.Render().toStr()
Beispiel #12
0
    def __call__(self):
        # Parse request
        vsrv_num, rule_num = re.findall(URL_BASE, CTK.request.url)[0]
        vsrv_nam = CTK.cfg.get_val("vserver!%s!nick" % (vsrv_num),
                                   _("Unknown"))

        url_apply = '/vserver/%s/rule/content/%s/apply' % (vsrv_num, rule_num)

        # Ensure the rule exists
        if not CTK.cfg.keys('vserver!%s!rule!%s' % (vsrv_num, rule_num)):
            return CTK.HTTP_Redir('/vserver/%s' % (vsrv_num))

        # Header refresh
        refresh = CTK.Refreshable({'id': 'entry_header'})
        refresh.register(
            lambda: Header(refresh, vsrv_num, rule_num, vsrv_nam).Render())

        # Tabs
        tabs = CTK.Tab()
        tabs.Add(_('Rule'), RuleWidget(vsrv_num, rule_num, url_apply, refresh))
        tabs.Add(_('Handler'), HandlerWidget(vsrv_num, rule_num, url_apply))
        tabs.Add(_('Encoding'), EncodingWidget(vsrv_num, rule_num, url_apply))
        tabs.Add(_('Time'), TimeWidget(vsrv_num, rule_num, url_apply))
        tabs.Add(_('Security'), SecurityWidget(vsrv_num, rule_num, url_apply))
        tabs.Add(_('Traffic Shaping'),
                 TrafficWidget(vsrv_num, rule_num, url_apply))

        cont = CTK.Container()
        cont += refresh
        cont += tabs

        return cont.Render().toJSON()
Beispiel #13
0
    def __call__(self):
        table = CTK.PropsTable()
        table.Add(
            _('New Host Name'),
            CTK.TextCfg('%s!host' % (CFG_PREFIX), False, {
                'value': 'www.example.com',
                'class': 'noauto'
            }), _(NOTE_HOST))
        table.Add(_('Use Same Logs as'),
                  Wizard.CloneLogsCfg('%s!logs_as_vsrv' % (CFG_PREFIX)),
                  _(Wizard.CloneLogsCfg.NOTE))

        notice = CTK.Notice('error', props={'class': 'no-see'})

        submit = CTK.Submitter(URL_APPLY)
        submit += CTK.Hidden('final', '1')
        submit += table
        submit.bind(
            'submit_fail',
            "$('#%s').show().html(event.ret_data.errors.msg);" % (notice.id))

        cont = CTK.Container()
        cont += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_HOST_H1)))
        cont += submit
        cont += notice
        cont += CTK.DruidButtonsPanel_PrevCreate_Auto()
        return cont.Render().toStr()
    def __call__(self):
        # Form
        submit = CTK.Submitter(URL_SAVE_APPLY)
        submit += CTK.TextArea({
            'name':
            'comment',
            'class':
            'noauto backup-notes-textarea optional',
            'style':
            'width: 436px; height: 48px; margin-top: 8px;'
        })
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(submit.id, URL_SAVE_SUCCESS))
        submit.bind('submit_fail',
                    CTK.DruidContent__JS_to_goto(submit.id, URL_SAVE_FAIL))

        # Buttons
        panel = CTK.DruidButtonsPanel()
        panel += CTK.DruidButton_Close(_('Cancel'))
        panel += CTK.DruidButton_Submit(_('Back Up'))

        # Layout
        content = CTK.Container()
        content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_SAVE_P1)))
        content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_SAVE_P2)))
        box = CTK.Box()
        box += CTK.RawHTML("<strong>%s</strong>" % (_("Notes")))
        box += submit
        content += box
        content += panel

        return content.Render().toStr()
Beispiel #15
0
    def __init__ (self):
        CTK.Box.__init__ (self, {'id': 'copyright'})

        left = CTK.Container()
        left += CTK.RawHTML ('<h2>Author</h2>')
        left += CTK.RawHTML (BROUGHT_TO_YOU)

        right = CTK.Container()
        right += CTK.RawHTML ('<h2>Contributors</h2>')
        right += CTK.RawHTML (CONTRIBUTORS)

        table = CTK.Table()
        table += [left, right]
        self += table

        self += CTK.RawHTML ('<p id="copyright-notice">%s</p>' %(COPYRIGHT_NOTICE))
Beispiel #16
0
    def __call__(self):
        guessed_cgi = path_find_w_default(SRC_PATHS_CGI)
        guessed_data = path_find_w_default(SRC_PATHS_DATA)
        guessed_arch = path_find_w_default(SRC_PATHS_ARCH)
        guessed_imgs = path_find_w_default(SRC_PATHS_IMGS)

        table = CTK.PropsTable()
        table.Add(
            _('Mailman CGI directory'),
            CTK.TextCfg('%s!mailman_cgi_dir' % (PREFIX), False,
                        {'value': guessed_cgi}), _(NOTE_LOCAL_CGI_DIR))
        table.Add(
            _('Mailman Data directory'),
            CTK.TextCfg('%s!mailman_data_dir' % (PREFIX), False,
                        {'value': guessed_data}), _(NOTE_LOCAL_DATA_DIR))
        table.Add(
            _('Mail Archive directory'),
            CTK.TextCfg('%s!mailman_arch_dir' % (PREFIX), False,
                        {'value': guessed_arch}), _(NOTE_LOCAL_ARCH_DIR))
        table.Add(
            _('Mail Images directory'),
            CTK.TextCfg('%s!mailman_imgs_dir' % (PREFIX), False,
                        {'value': guessed_imgs}), _(NOTE_LOCAL_IMGS_DIR))

        submit = CTK.Submitter(URL_APPLY)
        submit += table

        cont = CTK.Container()
        cont += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_LOCAL_H1)))
        cont += submit
        cont += CTK.DruidButtonsPanel_PrevNext_Auto()
        return cont.Render().toStr()
Beispiel #17
0
    def __init__ (self):
        CTK.Box.__init__ (self, {'id': 'remote-services-section', 'class': 'infosection'})

        submit = CTK.Submitter (REMOTE_SERVS_APPLY)
        submit += CTK.CheckCfgText ("admin!ows!enabled", True, _(REMOTE_SERVS_ENABLE))
        submit.bind ('submit_success', CTK.JS.GotoURL('/'))

        infotable = CTK.Table({'class': 'info-table'})
        infotable.set_header (column=True, num=1)

        if int (CTK.cfg.get_val("admin!ows!enabled", OWS_ENABLE)):
            if OWS_Login.is_logged():
                infotable += [submit, OWS_Login.LoggedAs_Text()]
            else:
                dialog = OWS_Login.LoginDialog()
                dialog.bind ('submit_success', CTK.JS.GotoURL('/'))

                link = CTK.Link ("#", CTK.RawHTML('<span>%s</span>' %(_('Sign in'))))
                link.bind ('click', dialog.JS_to_show())

                cont = CTK.Container()
                cont += dialog
                cont += link

                infotable += [submit, cont]
        else:
            infotable += [submit]

        table = CTK.Table()
        table.set_header (column=True, num=1)
        table += [CTK.RawHTML (_('Remote Services')), infotable]
        self += table
Beispiel #18
0
    def __call__ (self):
        vserver = re.findall (URL_WIZARD_RULE_R, CTK.request.url)[0]

        cont = CTK.Container()
        cont += CTK.RawHTML ('<h2>%s</h2>' %(_(NOTE_WELCOME_H1)))
        cont += Wizard.Icon ('php', {'class': 'wizard-descr'})

        notice = CTK.Notice('error', props={'class': 'no-see'})

        box = CTK.Box ({'class': 'wizard-welcome'})
        box += CTK.RawHTML ('<p>%s</p>' %(_(NOTE_WELCOME_P1)))
        box += Wizard.CookBookBox ('cookbook_php')
        box += notice

        submit = CTK.Submitter (URL_WIZARD_APPLY %(vserver))
        submit += CTK.Hidden ('final', '1')

        vsrv_num = re.findall (r'^/wizard/vserver/(\d+)/', CTK.request.url)[0]
        submit += CTK.Hidden('%s!vsrv_num'%(CFG_PREFIX), vsrv_num)

        submit += box
        submit.bind ('submit_fail', "$('#%s').show().html(event.ret_data.errors.msg);"%(notice.id))

        cont += submit
        cont += CTK.DruidButtonsPanel_Create()

        return cont.Render().toStr()
Beispiel #19
0
    def __call__(self):
        cont = CTK.Container()
        cont += CTK.RawHTML("<h1>%s</h1>" % (_('Report sent successfully')))
        cont += CTK.RawHTML("<p>%s</p>" % (_(NOTE_REPORT_THANKS)))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Close'))
        cont += buttons

        return cont.Render().toStr()
Beispiel #20
0
    def __init__(self, image_name, comments):
        CTK.Box.__init__(self)

        c1 = CTK.Container()
        c1 += CTK.Link("/download/misc/logos/%s.png" % (image_name),
                       CTK.RawHTML("PNG Image"))
        c1 += CTK.RawHTML(": %s" % (comments[0]))

        c2 = CTK.Container()
        c2 += CTK.Link("/download/misc/logos/%s.svg" % (image_name),
                       CTK.RawHTML("SVG Graphic"))
        c2 += CTK.RawHTML(": %s" % (comments[1]))

        l = CTK.List()
        l += c1
        l += c2

        self += CTK.Image({'src': '/static/images/%s-mini.png' % (image_name)})
        self += l
Beispiel #21
0
 def __call__(self):
     cont = CTK.Container()
     cont += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_WELCOME_H1)))
     cont += Wizard.Icon('redirect', {'class': 'wizard-descr'})
     box = CTK.Box({'class': 'wizard-welcome'})
     box += CTK.RawHTML('<p>%s</p>' % (_(NOTE_WELCOME_P1)))
     box += Wizard.CookBookBox('cookbook_redirs')
     cont += box
     cont += CTK.DruidButtonsPanel_Next_Auto()
     return cont.Render().toStr()
    def __call__(self):
        panel = CTK.DruidButtonsPanel()
        panel += CTK.DruidButton_Close(_('Close'))

        # Layout
        content = CTK.Container()
        content += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_SAVE_OK_H2)))
        content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_SAVE_OK_P1)))
        content += panel
        return content.Render().toStr()
Beispiel #23
0
    def __init__ (self):
        CTK.Box.__init__ (self, {'id': 'remote-backup-section', 'class': 'infosection'})

        cont = CTK.Container()
        cont += OWS_Backup.Restore_Config_Button()
        cont += OWS_Backup.Save_Config_Button()

        table = CTK.Table()
        table.set_header (column=True, num=1)
        table += [CTK.RawHTML (_('Backup Service')), cont]
        self += table
Beispiel #24
0
    def __call__(self):
        cont = CTK.Container()
        cont += CTK.RawHTML("<h1>%s</h1>" % (_('Could not send the report')))
        cont += CTK.RawHTML("<p>%s</p>" % (_(NOTE_REPORT_ERROR)))
        cont += CTK.RawHTML("<p>%s</p>" % (_(NOTE_REPORT_TIPS)))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Close'))
        cont += buttons

        return cont.Render().toStr()
Beispiel #25
0
    def __call__(self):
        # Check the application
        db_type = None
        db_found = False

        for app in CTK.cfg.keys('tmp!market!maintenance!remove'):
            tmp = CTK.cfg.get_val('tmp!market!maintenance!remove!%s!db' %
                                  (app))
            if not tmp:
                continue

            if not CTK.cfg.get_val('tmp!market!maintenance!db!%s!user' %
                                   (tmp)):
                db_found = True
                db_type = tmp

        # No DBs, we are done here
        if not db_found:
            box = CTK.Box()
            box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(
                box.id, URL_MAINTENANCE_REMOVE))
            return box.Render().toStr()

        # Ask for the user and password
        table = CTK.PropsTable()
        table.Add(
            _('DB user'),
            CTK.TextField({
                'name': 'db_user',
                'class': 'noauto',
                'value': 'root'
            }), _(NOTE_DBUSER))
        table.Add(
            _('DB password'),
            CTK.TextFieldPassword({
                'name': 'db_pass',
                'class': 'noauto'
            }), _(NOTE_DBPASS))

        # Reload its content on submit success
        submit = CTK.Submitter(URL_MAINTENANCE_DB_APPLY)
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(table.id, URL_MAINTENANCE_DB))
        submit += CTK.Hidden('db_type', db_type)
        submit += table

        cont = CTK.Container()
        cont += CTK.RawHTML('<h2>%s (%s)</h2>' %
                            (_("Database Credentials"), db_type))
        cont += CTK.RawHTML('<p>%s</p>' % (_(DB_DEL_P1)))
        cont += submit

        return cont.Render().toStr()
Beispiel #26
0
    def __call__ (self):
        table = CTK.PropsTable()
        table.Add (_('Host'), CTK.TextCfg ('%s!new_source'%(PREFIX), False, {'value':"127.0.0.1:8500"}), _(NOTE_SOURCE))

        submit = CTK.Submitter (URL_APPLY)
        submit += table

        cont = CTK.Container()
        cont += CTK.RawHTML ('<h2>%s</h2>' %(_(NOTE_COMMON_H1)))
        cont += submit
        cont += CTK.DruidButtonsPanel_PrevNext_Auto()
        return cont.Render().toStr()
Beispiel #27
0
    def __call__ (self):
        table = CTK.PropsTable()
        table.Add (_('Django Local Directory'), CTK.TextCfg ('%s!django_dir'%(PREFIX), False), _(NOTE_LOCAL_DIR))

        submit = CTK.Submitter (URL_APPLY)
        submit += table

        cont = CTK.Container()
        cont += CTK.RawHTML ('<h2>%s</h2>' %(_(NOTE_LOCAL_H1)))
        cont += submit
        cont += CTK.DruidButtonsPanel_PrevNext_Auto()
        return cont.Render().toStr()
    def __call__(self):
        panel = CTK.DruidButtonsPanel()
        panel += CTK.DruidButton_Close(_('Close'))

        content = CTK.Container()
        content += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_RESTORE_FAIL_H2)))
        content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_RESTORE_FAIL_P1)))
        content += CTK.RawHTML(
            '<p><pre>%s</pre></p>' %
            (CTK.escape_html(CTK.cfg.get_val('tmp!backup!restore!error', ''))))
        content += panel
        return content.Render().toStr()
Beispiel #29
0
    def __call__ (self):
        table = CTK.PropsTable()
        table.Add (_('Document Root'), CTK.TextCfg ('%s!droot'%(CFG_PREFIX), False, {'value': '/var/www'}), _(NOTE_LOCAL_DIR))

        submit = CTK.Submitter (URL_APPLY)
        submit += table

        cont = CTK.Container()
        cont += CTK.RawHTML ('<h2>%s</h2>' %(_(NOTE_LOCAL_H1)))
        cont += submit
        cont += CTK.DruidButtonsPanel_PrevNext_Auto()
        return cont.Render().toStr()
Beispiel #30
0
def External_FindPHP():
    # Add PHP if needed
    have_php = check_php_interpreter()
    if not have_php:
        cont = CTK.Container()
        cont += CTK.RawHTML ('<h2>%s</h2>' %(_(NOTE_NOT_FOUND_H1)))
        cont += CTK.RawHTML ('<p>%s</p>' %(_(NOTE_NOT_FOUND)))
        cont += CTK.RawHTML ('<p>%s</p>' %(_(NOTE_NOT_FOUND2)))
        cont += CTK.DruidButtonsPanel_Cancel()
        return cont.Render().toStr()

    return CTK.DruidContent_TriggerNext().Render().toStr()