Exemplo n.º 1
0
    def process(self, req, start_response):
        self.do_init()

        templ = self.app.get_template('index.xml')

        cat = None
        v = UI.VContainer(spacing=0)

        # Sort plugins by name
        cats = self.categories
        cats = sorted(cats, key=lambda p: p.text)

        for fld in self.folder_ids:
            cat_vc = UI.VContainer(spacing=0)
            if self.folders[fld] == '':
                cat_folder = cat_vc  # Omit wrapper for special folders
            else:
                cat_folder = UI.CategoryFolder(
                    cat_vc,
                    text=self.folders[fld],
                    icon='/dl/core/ui/catfolders/' + fld +
                    '.png' if self.folders[fld] != '' else '',
                    id=fld)
            # cat_vc will be VContainer or CategoryFolder

            exp = False
            empty = True
            for c in cats:
                if c.folder == fld:  # Put corresponding plugins in this folder
                    empty = False
                    if c == self.selected_category:
                        cat_vc.append(
                            UI.Category(icon=c.icon,
                                        name=c.text,
                                        id=c.get_name(),
                                        selected='true'))
                        exp = True
                    else:
                        cat_vc.append(
                            UI.Category(icon=c.icon,
                                        name=c.text,
                                        id=c.get_name()))

            if not empty: v.append(cat_folder)
            cat_folder['expanded'] = exp

        templ.appendChildInto('leftplaceholder', v)
        templ.appendChildInto('rightplaceholder', self.main_ui().elements())
        templ.appendChildInto('version',
                              UI.Label(text='Ajenti ' + version, size=2))
        templ.appendChildInto(
            'links',
            UI.HContainer(
                UI.LinkLabel(text='About', id='about'),
                UI.OutLinkLabel(text='License',
                                url='http://www.gnu.org/licenses/lgpl.html')))

        return templ.render()
Exemplo n.º 2
0
 def get_ui_about(self):
     ui = UI.Centerer(
         UI.VContainer(
             UI.Image(file='/dl/core/ui/logo_big.png'), UI.Spacer(height=6),
             UI.Label(text='Ajenti ' + version, size=4),
             UI.Label(text='Your personal server affairs agent'),
             UI.Spacer(height=10),
             UI.HContainer(
                 UI.OutLinkLabel(
                     url
                     ='http://www.assembla.com/spaces/ajenti/wiki?id=aLa8XiGfWr36nLeJe5cbLA',
                     text='Wiki'),
                 UI.OutLinkLabel(
                     url=
                     'http://www.assembla.com/spaces/ajenti/wiki?id=ajenti&wiki_id=Developers',
                     text='Credits'),
                 UI.OutLinkLabel(
                     text='License',
                     url='http://www.gnu.org/licenses/lgpl.html'),
                 UI.OutLinkLabel(
                     text='Bugs',
                     url=
                     'http://www.assembla.com/spaces/ajenti/support/tickets'
                 ),
                 spacing=6), UI.Spacer(height=10),
             UI.Button(text='Close', id='closeabout')))
     return UI.DialogBox(ui, hideok=True, hidecancel=True)
Exemplo n.º 3
0
        def get_main_ui(self):
            panel = UI.ServicePluginPanel(title=self.ws_title,
                                          icon=self.ws_icon,
                                          status=self.service_status,
                                          servicename=self.service_name)

            if not self._backend.is_installed():
                panel.append(
                    UI.VContainer(
                        UI.ErrorBox(title='Error',
                                    text='%s is not installed' %
                                    self.ws_name)))
            else:
                panel.append(self.get_default_ui())

            return panel
Exemplo n.º 4
0
        def get_ui_hosts(self):
            tbl = UI.DataTable(
                UI.DataTableRow(UI.Label(),
                                UI.Label(text='Name'),
                                UI.Label(),
                                header=True))

            hosts = self._backend.get_hosts()
            for x in sorted(hosts.keys()):
                tbl.append(
                    UI.DataTableRow(
                        UI.Image(file='/dl/core/ui/stock/status-%sabled.png' %
                                 ('en' if hosts[x].enabled else 'dis')),
                        UI.Label(text=x),
                        UI.DataTableCell(UI.HContainer(
                            UI.MiniButton(id='edithost/' + x, text='Edit'),
                            UI.MiniButton(id='togglehost/' + x,
                                          text='Disable'
                                          if hosts[x].enabled else 'Enable'),
                            UI.WarningMiniButton(id='deletehost/' + x,
                                                 text='Delete',
                                                 msg='Delete host %s' % x),
                            spacing=0),
                                         hidden=True)))

            ui = UI.VContainer(tbl, UI.Button(text='Add host', id='addhost'))

            if self._creating_host:
                ui.append(
                    UI.InputBox(text='Host config name:', id='dlgCreateHost'))

            if self._editing_host is not None:
                ui.append(
                    UI.AreaInputBox(text='Host config:',
                                    value=self._backend.get_hosts()[
                                        self._editing_host].config,
                                    id='dlgEditHost'))

            return ui
Exemplo n.º 5
0
Arquivo: root.py Projeto: vlara/ajenti
    def process(self, req, start_response):
        self.do_init()

        templ = self.app.get_template('index.xml')

        cat = None
        v = UI.VContainer(spacing=0)

        # Sort plugins by name
        cats = self.app.grab_plugins(ICategoryProvider)
        cats = sorted(cats, key=lambda p: p.text)

        for fld in self.folder_ids:
            cat_vc = UI.VContainer(spacing=0)
            if self.folders[fld] == '':
                cat_folder = cat_vc # Omit wrapper for special folders
            else:
                cat_folder = UI.CategoryFolder(
                                cat_vc,
                                text=self.folders[fld],
                                icon='/dl/core/ui/catfolders/'+ fld + '.png'
                                    if self.folders[fld] != '' else '',
                                id=fld
                             )
            # cat_vc will be VContainer or CategoryFolder

            exp = False
            empty = True
            for c in cats:
                if c.folder == fld: # Put corresponding plugins in this folder
                    empty = False
                    if c == self.selected_category:
                        exp = True
                    cat_vc.append(UI.Category(
                        icon=c.icon,
                        name=c.text,
                        id=c.plugin_id,
                        counter=c.get_counter(),
                        selected=c == self.selected_category
                    ))

            if not empty: v.append(cat_folder)
            cat_folder['expanded'] = exp

        for c in cats:
            if c.folder in ['top', 'bottom']:
                templ.append(
                    'topplaceholder-'+c.folder,
                    UI.TopCategory(
                        text=c.text,
                        id=c.plugin_id,
                        icon=c.icon,
                        counter=c.get_counter(),
                        selected=c==self.selected_category
                    )
                )

        templ.append('_head', UI.HeadTitle(text='Ajenti @ %s'%platform.node()))
        templ.append('leftplaceholder', v)
        templ.append('version', UI.Label(text='Ajenti '+version(), size=2))
        templ.insertText('cat-username', self.app.auth.user)
        templ.appendAll('links', 
                UI.LinkLabel(text='About', id='about'),
                UI.OutLinkLabel(text='License', url='http://www.gnu.org/licenses/lgpl.html')
            )

        return templ.render()