Esempio n. 1
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
Esempio n. 2
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
Esempio n. 3
0
    def format_func_reviews (self, reviews_info):
        reviews  = reviews_info['reviews']
        app_id   = reviews_info['application_id']
        app_name = reviews_info['application_name']

        cont = CTK.Container()
        cont += CTK.RawHTML ("<h2>%s</h2>" %(_("Reviews")))

        # Render Reviews
        if not reviews:
            cont += CTK.Box ({'class': 'market-no-reviews'}, CTK.RawHTML(_("You can be the first one to review the application")))
        else:
            pags = CTK.Paginator('market-app-reviews', items_per_page=5)
            cont += pags

            for review in reviews:
                d, review_time = review['review_stamp'].value.split('T')
                review_date = "%s-%s-%s" %(d[0:4], d[4:6], d[6:])

                rev  = CTK.Box ({'class': 'market-app-review'})
                rev += CTK.Box ({'class': 'market-app-review-score'},    CTK.StarRating({'selected': review['review_score']}))
                rev += CTK.Box ({'class': 'market-app-review-title'},    CTK.RawHTML(review['review_title']))
                rev += CTK.Box ({'class': 'market-app-review-name'},     CTK.RawHTML(review['first_name'] + ' ' + review['last_name']))
                rev += CTK.Box ({'class': 'market-app-review-stamp'},    CTK.RawHTML(_('on %(date)s at %(time)s' %({'date':review_date, 'time': review_time}))))
                rev += CTK.Box ({'class': 'market-app-review-comment'},  CTK.RawHTML(review['review_comment']))
                pags += rev

        # Review
        if OWS_Login.is_logged():
            CTK.cfg['tmp!market!review!app_id']   = str(app_id)
            CTK.cfg['tmp!market!review!app_name'] = app_name

            druid  = CTK.Druid (CTK.RefreshableURL())
            dialog = CTK.Dialog ({'title':"%s: %s" %(_("Review"), app_name), 'width': 480})
            dialog += druid
            druid.bind ('druid_exiting', dialog.JS_to_close() + \
                                         self.xmlrpc_proxy_reviews.JS_to_refresh())

            add_review = CTK.Button(_("Review"), {'id':'button-review'})
            add_review.bind('click', dialog.JS_to_show() + \
                                     druid.JS_to_goto('"%s"'%(URL_REVIEW)))

            cont += dialog
            cont += add_review
        else:
            sign_box = CTK.Box ({'class': 'market-app-review-signin'})

            link = CTK.Link ('#', CTK.RawHTML (_("sign in")))
            link.bind ('click', self.login_dialog.JS_to_show())

            login_txt  = CTK.Box()
            login_txt += CTK.RawHTML ("%s, " %(_('Please')))
            login_txt += link
            login_txt += CTK.RawHTML (" %s" %(_('to review the product')))

            sign_box += login_txt

            cont += sign_box

        return cont.Render().toStr()
Esempio n. 4
0
    def __call__ (self):
        # Ensure OWS is enabled
        if not int(CTK.cfg.get_val("admin!ows!enabled", OWS_ENABLE)):
            return CTK.HTTP_Redir('/')

        page = Page_Market()

        # Featured
        page.mainarea += FeaturedBox()

        # Top
        page.mainarea += CTK.RawHTML("<h2>%s</h2>" %(_('Top Applications')))
        tabs = CTK.Tab()
        tabs.Add (_('Paid'),   TopApps('paid'))
        tabs.Add (_('Free'),   TopApps('free'))
        tabs.Add (_('Ranked'), TopApps('any'))
        page.mainarea += tabs

        # My Library
        if OWS_Login.is_logged():
            page.sidebar += Library.MyLibrary()

        # Maintanance
        if Maintenance.does_it_need_maintenance():
            refresh_maintenance = CTK.Refreshable({'id': 'market_maintenance'})
            refresh_maintenance.register (lambda: Maintenance.Maintenance_Box(refresh_maintenance).Render())
            page.sidebar += refresh_maintenance

        return page.Render()
Esempio n. 5
0
    def __call__(self):
        Cherokee.pid.refresh()

        # Top
        top = CTK.Box({'id': 'top-box'})
        top += CTK.RawHTML("<h1>%s</h1>" % _('Welcome to Cherokee Admin'))
        top += LanguageSelector()

        # Content: Left
        mainarea = CTK.Box({'id': 'main-area'})
        mainarea += OWS_Market_Info.Index_Block1()
        mainarea += ServerInfo()
        if int(OWS_ENABLE):
            mainarea += RemoteServices()

        if OWS_Login.is_logged() and \
           int (CTK.cfg.get_val("admin!ows!enabled", OWS_ENABLE)):
            mainarea += BackupService()

        mainarea += CPUInfo()
        mainarea += MemoryInfo()
        mainarea += CommunityBar()

        # Content: Right
        sidebar = CTK.Box({'id': 'sidebar'})
        sidebar += SupportBox()

        if int(CTK.cfg.get_val("admin!ows!enabled", OWS_ENABLE)):
            sidebar += OWS_Cherokee_Info.Latest_Release()

        sidebar += ProudUsers()
        sidebar += OWS_Market_Info.Index_Block2()
        sidebar += HaltAdmin()

        # Content
        cont = CTK.Box({'id': 'home-container'})
        cont += mainarea
        cont += sidebar

        # Page
        page = Page.Base(_('Welcome to Cherokee Admin'),
                         body_id='index',
                         helps=HELPS)
        page += top
        page += cont
        page += CTK.RawHTML(js=JS_SCROLL)

        return page.Render()
Esempio n. 6
0
    def __call__ (self):
        Cherokee.pid.refresh()

        # Top
        top = CTK.Box({'id': 'top-box'})
        top += CTK.RawHTML ("<h1>%s</h1>"% _('Welcome to Cherokee Admin'))
        top += LanguageSelector()

        # Content: Left
        mainarea = CTK.Box({'id': 'main-area'})
        mainarea += OWS_Market_Info.Index_Block1()
        mainarea += ServerInfo()
        if int(OWS_ENABLE):
            mainarea += RemoteServices()

        if OWS_Login.is_logged() and \
           int (CTK.cfg.get_val("admin!ows!enabled", OWS_ENABLE)):
            mainarea += BackupService()

        mainarea += CPUInfo()
        mainarea += MemoryInfo()
        mainarea += CommunityBar()

        # Content: Right
        sidebar = CTK.Box({'id': 'sidebar'})
        sidebar += SupportBox()

        if int (CTK.cfg.get_val("admin!ows!enabled", OWS_ENABLE)):
            sidebar += OWS_Cherokee_Info.Latest_Release()

        sidebar += ProudUsers()
        sidebar += OWS_Market_Info.Index_Block2()
        sidebar += HaltAdmin()

        # Content
        cont = CTK.Box({'id': 'home-container'})
        cont += mainarea
        cont += sidebar

        # Page
        page = Page.Base(_('Welcome to Cherokee Admin'), body_id='index', helps=HELPS)
        page += top
        page += cont
        page += CTK.RawHTML (js=JS_SCROLL)

        return page.Render()
Esempio n. 7
0
 def thread_func (username, password):
     try:
         OWS_Login.log_in (username, password)
     except ProtocolError:
         # Do not give up so easily
         OWS_Login.log_in (username, password)
Esempio n. 8
0
    def format_func_app (self, info):
        cont = CTK.Container()

        self.menu += "%s %s" %(_('Application'), info['application_name'])
        cont += self.menu

        app_id          = info['application_id']
        currency_symbol = CTK.util.to_utf8 (info['currency_symbol'])

        # Install dialog
        install = InstallDialog (info)
        cont += install

        # Publisher / Author
        by = CTK.Container()
        by += CTK.RawHTML ('%s '%(_('By')))
        if info.get('author_url') and info.get('author_name'):
            by += CTK.LinkWindow (info['author_url'], CTK.RawHTML(info['author_name']))
        else:
            by += CTK.LinkWindow (info['publisher_url'], CTK.RawHTML(info['publisher_name']))

        # Buy / Install button
        if OWS_Login.is_logged():
            if Library.is_appID_in_library (app_id):
                buy = CTK.Button (_("Install"))
            else:
                buy = CTK.Button ("%s%s %s" %(currency_symbol, info['amount'], _("Buy")))
            buy.bind ('click', install.JS_to_show())

        else:
            link = CTK.Link ('#', CTK.RawHTML (_("Sign in")))
            link.bind ('click', self.login_dialog.JS_to_show())

            login_txt = CTK.Box()
            login_txt += link

            if info['amount']:
                buy_button = CTK.Button ("%s%s %s" %(currency_symbol, info['amount'], _("Buy")), {"disabled": True})
                login_txt += CTK.RawHTML (" %s" %(_('to buy')))
            else:
                buy_button = CTK.Button ("%s, %s" %(_("Free"), _("Install")), {"disabled": True})
                login_txt += CTK.RawHTML (" %s" %(_('to install')))

            buy = CTK.Container()
            buy += buy_button
            buy += login_txt

        app  = CTK.Box ({'class': 'market-app-desc'})
        app += CTK.Box ({'class': 'market-app-desc-icon'},        CTK.Image({'src': OWS_STATIC + info['icon_big']}))
        app += CTK.Box ({'class': 'market-app-desc-buy'},         buy)
        app += CTK.Box ({'class': 'market-app-desc-title'},       CTK.RawHTML(info['application_name']))
        app += CTK.Box ({'class': 'market-app-desc-version'},     CTK.RawHTML("%s: %s" %(_("Version"), info['version_string'])))
        app += CTK.Box ({'class': 'market-app-desc-url'},         by)
        app += CTK.Box ({'class': 'market-app-desc-category'},    CTK.RawHTML("%s: %s" %(_("Category"), info['category_name'])))
        app += CTK.Box ({'class': 'market-app-desc-short-desc'},  CTK.RawHTML(info['summary']))
        cont += app

        ext_description = CTK.Box ({'class': 'market-app-desc-description'})
        ext_description += CTK.RawHTML(info['description'])
        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(info))

        # Tabs
        tabs = CTK.Tab()

        # Shots
        shot_entries = info.get('shots', [])
        if shot_entries:
            shots = CTK.CarouselThumbnails()
            tabs.Add (_('Screenshots'), shots)

            for s in shot_entries:
                shots += CTK.Image ({'src': "%s/%s" %(OWS_STATIC, s)})

        tabs.Add (_('Description'), desc_panel)
        app += tabs

        # Update the cache
        App.cache_app[str(app_id)] = info

        return cont.Render().toStr()
Esempio n. 9
0
    def format_func_app (self, info):
        cont = CTK.Container()

        self.menu += "%s %s" %(_('Application'), info['application_name'])
        cont += self.menu

        app_id          = info['application_id']
        currency_symbol = CTK.util.to_utf8 (info['currency_symbol'])

        # Install dialog
        install = InstallDialog (info)
        cont += install

        # Publisher / Author
        by = CTK.Container()
        by += CTK.RawHTML ('%s '%(_('By')))
        if info.get('author_url') and info.get('author_name'):
            by += CTK.LinkWindow (info['author_url'], CTK.RawHTML(info['author_name']))
        else:
            by += CTK.LinkWindow (info['publisher_url'], CTK.RawHTML(info['publisher_name']))

        # Buy / Install button
        if OWS_Login.is_logged():
            if Library.is_appID_in_library (app_id):
                buy = CTK.Button (_("Install"))
            else:
                if info['amount']:
                    buy = CTK.Button ("%s%s %s" %(currency_symbol, info['amount'], _("Buy")))
                else:
                    buy = CTK.Button ("%s, %s" %(_("Free"), _("Install")))
            buy.bind ('click', install.JS_to_show())

        else:
            link = CTK.Link ('#', CTK.RawHTML (_("Sign in")))
            link.bind ('click', self.login_dialog.JS_to_show())

            login_txt = CTK.Box()
            login_txt += link

            if info['amount']:
                buy_button = CTK.Button ("%s%s %s" %(currency_symbol, info['amount'], _("Buy")), {"disabled": True})
                login_txt += CTK.RawHTML (" %s" %(_('to buy')))
            else:
                buy_button = CTK.Button ("%s, %s" %(_("Free"), _("Install")), {"disabled": True})
                login_txt += CTK.RawHTML (" %s" %(_('to install')))

            buy = CTK.Container()
            buy += buy_button
            buy += login_txt

        # Report button
        report = CTK.Container()
        if OWS_Login.is_logged():
            CTK.cfg['tmp!market!report!app_id'] = str(self.text_app_id)

            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"'%(URL_REPORT)))

            report += report_dialog
            report += report_link

        app  = CTK.Box ({'class': 'market-app-desc'})
        app += CTK.Box ({'class': 'market-app-desc-icon'},        CTK.Image({'src': OWS_STATIC + info['icon_big']}))
        app += CTK.Box ({'class': 'market-app-desc-buy'},         buy)
        app += CTK.Box ({'class': 'market-app-desc-title'},       CTK.RawHTML(info['application_name']))
        app += CTK.Box ({'class': 'market-app-desc-version'},     CTK.RawHTML("%s: %s" %(_("Version"), info['version_string'])))
        app += CTK.Box ({'class': 'market-app-desc-url'},         by)
        app += CTK.Box ({'class': 'market-app-desc-category'},    CTK.RawHTML("%s: %s" %(_("Category"), info['category_name'])))
        app += CTK.Box ({'class': 'market-app-desc-short-desc'},  CTK.RawHTML(info['summary']))
        app += CTK.Box ({'class': 'market-app-desc-report'},      report)
        cont += app

        ext_description = CTK.Box ({'class': 'market-app-desc-description'})
        ext_description += CTK.RawHTML(info['description'])
        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(info))

        # Tabs
        tabs = CTK.Tab()

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

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

        tabs.Add (_('Screenshots'), shots)
        tabs.Add (_('Description'), desc_panel)
        app += tabs

        # Update the cache
        App.cache_app[str(app_id)] = info

        return cont.Render().toStr()