Пример #1
0
    def AdministrationLinks(self, context=None):
        if context:
            apps = (context,)
        else:
            apps = self.context.app.portal.GetApps()
        links = []
        for app in apps:
            if not hasattr(app, "registry"):
                continue

            # search all view modules for admin links
            for vm in app.QueryConf(IViewModuleConf):
                if not vm.get("adminLink"):
                    continue
                if not self.Allowed(vm.permission, app):
                    continue
                url = self.ResolveUrl(vm.get("adminLink"), app)
                links.append({"href":url, "title":app.configuration.title + u": " + vm.name})

            # bw.0.9.13
            # search for cms editor and public view by root
            for root in app.GetRoots():
                if ICMSRoot.providedBy(root):
                    links.append({"href":self.Url(root), "title":app.configuration.title + u": " + _(u"editor")})
                elif IWebsiteRoot.providedBy(root):
                    links.append({"href":self.Url(root), "title":app.configuration.title + u": " + _(u"public")})

        return links
Пример #2
0
 def editorview(self):
     """
     Tries to load the editor view class. If none is registered the function 
     will simply return None. Otherwise the editor view class instance with 
     context and request set.
     """
     if hasattr(self, "_c_editor"):
         return self._c_editor
     # restrict editor to roots with ICMSRoot Interface. Otherwise the editor views
     # will not be found 
     root = self.context.root()
     if not ICMSRoot.providedBy(root):
         return None
     module = self.context.app.QueryConfByName(IViewModuleConf, "editor")
     if not module:
         return None
     cls =  ResolveName(module.view)
     editor = cls(self.context, self.request)
     self._c_editor = editor
     return editor
Пример #3
0
 def editorview(self):
     """
     Tries to load the editor view class. If none is registered the function 
     will simply return None. Otherwise the editor view class instance with 
     context and request set.
     """
     if hasattr(self, "_c_editor"):
         return self._c_editor
     # restrict editor to roots with ICMSRoot Interface. Otherwise the editor views
     # will not be found 
     root = self.context.dataroot
     if not ICMSRoot.providedBy(root):
         return None
     module = self.context.app.QueryConfByName(IViewModuleConf, "editor")
     if not module:
         return None
     cls =  DecorateViewClassWithViewModuleConf(module, module.view)
     editor = cls(self.context, self.request)
     self._c_editor = editor
     return editor
Пример #4
0
    def AdministrationLinks(self, context=None):
        if context:
            apps = (context, )
        else:
            apps = self.context.app.portal.GetApps()
        links = []
        for app in apps:
            if not hasattr(app, "registry"):
                continue

            # search all view modules for admin links
            for vm in app.QueryConf(IViewModuleConf):
                if not vm.get("adminLink"):
                    continue
                if not self.Allowed(vm.permission, app):
                    continue
                url = self.ResolveUrl(vm.get("adminLink"), app)
                links.append({
                    "href": url,
                    "title": app.configuration.title + u": " + vm.name
                })

            # bw.0.9.13
            # search for cms editor and public view by root
            for root in app.GetRoots():
                if ICMSRoot.providedBy(root):
                    links.append({
                        "href":
                        self.Url(root),
                        "title":
                        app.configuration.title + u": " + _(u"editor")
                    })
                elif IWebsiteRoot.providedBy(root):
                    links.append({
                        "href":
                        self.Url(root),
                        "title":
                        app.configuration.title + u": " + _(u"public")
                    })

        return links
Пример #5
0
 def AdministrationLinks(self, context=None):
     if context:
         apps = (context,)
     else:
         apps = self.context.app.portal.GetApps()
     links = []
     for app in apps:
         if not hasattr(app, "registry"):
             continue
         # search for cms editor
         for root in app.GetRoots():
             if ICMSRoot.providedBy(root):
                 links.append({"href":self.Url(root), "title":app.configuration.title + u": " + _(u"editor")})
             elif IWebsiteRoot.providedBy(root):
                 links.append({"href":self.Url(root), "title":app.configuration.title + u": " + _(u"public")})
         # administration
         links.append({"href":self.FolderUrl(app)+u"admin", "title":app.configuration.title + u": " + _(u"administration")})
         # user management
         if IUserDatabase.providedBy(app):
             links.append({"href":self.FolderUrl(app)+u"usermanagement", "title":app.configuration.title + u": " + _(u"user management")})
     return links
Пример #6
0
 def AdministrationLinks(self, context=None):
     if context:
         apps = (context,)
     else:
         apps = self.context.app.portal.GetApps()
     links = []
     for app in apps:
         if not hasattr(app, "registry"):
             continue
         # search for cms editor
         for root in app.GetRoots():
             if ICMSRoot.providedBy(root):
                 links.append({"href":self.Url(root), "title":app.configuration.title + u": " + _(u"editor")})
             elif IWebsiteRoot.providedBy(root):
                 links.append({"href":self.Url(root), "title":app.configuration.title + u": " + _(u"public")})
         # administration
         links.append({"href":self.FolderUrl(app)+u"admin", "title":app.configuration.title + u": " + _(u"administration")})
         # user management
         if IUserDatabase.providedBy(app):
             links.append({"href":self.FolderUrl(app)+u"usermanagement", "title":app.configuration.title + u": " + _(u"user management")})
     return links