コード例 #1
0
    FieldConf(id="mailtitle",
              datatype="string",
              size=100,
              default="",
              name="Mail title",
              description="")
]

# define the fields actually to be used in the cms element add and edit forms
fields = [
    "title", "topics", "receiver", "receiverName", "mailtitle", "pool_groups"
]
configuration.forms = {
    "create": {
        "fields": fields
    },
    "edit": {
        "fields": fields
    }
}

# define a new view to link our custom view class (ContactView) with the contact obj (ContactObj)
# this is required to call contact() from the template and process the form
configuration.views = [
    ViewConf(id="contactview",
             name="",
             attr="view",
             context=ContactObj,
             view=ContactView)
]
コード例 #2
0
ファイル: view.py プロジェクト: comlorda/nive_userdb
    listfields=("pool_state", "name", "email", "groups", "lastlogin", "id"),
    addfields=("name", "password", "email", "groups"),
    editfields=(FieldConf(
        id="pool_state",
        name=_("Active"),
        datatype="bool",
        widget=RadioChoiceWidget(values=((u"true", _(u"Yes")),
                                         (u"false", _(u"No"))))), "name",
                FieldConf(id="password",
                          name=_("Password"),
                          datatype="password",
                          settings={"update": True}), "email", "groups"))
t = configuration.templates
configuration.views = [
    # User Management Views
    ViewConf(name="", attr="view", renderer=t + "root.pt"),
    ViewConf(name="list", attr="view", renderer=t + "root.pt"),
    ViewConf(name="add", attr="add", renderer=t + "add.pt"),
    ViewConf(name="delete", attr="delete", renderer=t + "delete.pt"),
    ViewConf(name="",
             attr="edit",
             context=IUser,
             containment="nive_userdb.useradmin.adminroot.adminroot",
             renderer=t + "edit.pt"),
]

# view and form implementation ------------------------------------------------------------------

from nive.views import BaseView, Unauthorized, Mail
from nive.forms import ObjectForm, ValidationError
from nive_userdb.app import UsernameValidator, EmailValidator
コード例 #3
0
ファイル: cutcopy.py プロジェクト: timgates42/nive_cms
            obj.Signal("moved")
            #obj.Close()
            moved.append(obj)

        for o in moved:
            o.Commit(user)
            if ISort.providedBy(self):
                self.InsertAfter(o.id, pos, user=user)
            self.Signal("afterAdd", obj=o)
        if result:
            msgs.append(_(u"OK. Cut and pasted."))
        return result, msgs


views = [
    ViewConf(name="@cut", attr="cut", context=IContainer, permission="edit"),
    ViewConf(name="@copy", attr="copy", context=IContainer, permission="edit"),
    ViewConf(name="@paste", attr="paste", context=IContainer, permission="add")
]


class CopyView:
    """
    View functions for cut, copy and paste
    """
    CopyInfoKey = "CCP__"

    def cut(self):
        """
        """
        self.ResetFlashMessages()
コード例 #4
0
from nive.definitions import IPage
from nive.definitions import IToolboxWidgetConf, IEditorWidgetConf
from nive.definitions import ViewModuleConf, ViewConf, WidgetConf
from nive.cms.cmsview.view import Editor

configuration = ViewModuleConf(id="wfview",
                               name=_(u"CMS workflow extension"),
                               static="nive.cms.workflow:static",
                               permission="read",
                               context=IPage,
                               containment="nive.cms.cmsview.cmsroot.cmsroot",
                               view="nive.cms.workflow.view.WorkflowEdit")

configuration.views = [
    ViewConf(name="wfWidget",
             attr="widget",
             renderer="nive.cms.workflow:templates/widget.pt"),
    ViewConf(name="workflow",
             attr="workflow",
             renderer="nive.cms.workflow:templates/editorpage.pt"),
    ViewConf(name="action", attr="action"),
    ViewConf(name="pubr", attr="publishRecursive", permission="edit")
]

configuration.widgets = [
    WidgetConf(name=_("Workflow"),
               widgetType=IToolboxWidgetConf,
               apply=(IPage, ),
               viewmapper="wfWidget",
               id="cms.wf",
               sort=250),
コード例 #5
0
ファイル: exportJson.py プロジェクト: comlorda/nive
                    "Only file information and local paths (No file data)"
                },
                {
                    "id": "data",
                    "name": "Include all file data"
                },
            ],
            name=_(u"File data"),
            description=_(
                u"Include binary file data in json export (encoded as base64)")
        )
    ],
    views=[
        ViewConf(name="",
                 view=ToolView,
                 attr="form",
                 permission="system",
                 context="nive.tools.exportJson.exportJson"),
    ])


class exportJson(Tool):
    """
    """
    def _Run(self, **values):

        result = 1
        codepage = "utf-8"

        app = self.app
        datapool = app.db
コード例 #6
0
        # nive specific
        ('cmseditor.js', 'nive.cms.cmsview:static/cmseditor.js'),
        ('toolbox.css', 'nive.cms.cmsview:static/toolbox/toolbox.css'),
        ('overlay.css', 'nive.cms.cmsview:static/overlay/overlay.css'),
        ('cmseditor.css', 'nive.cms.cmsview:static/cmseditor.css'),
    ],
    description=__doc__)

# views -----------------------------------------------------------------------------
# copy and sort extension views are imported from their files and added at the end of the list

t = configuration.templates
configuration.views = [
    ViewConf(name="editor",
             attr="editor",
             context=IContainer,
             permission="read",
             containment=IApplication),
    ViewConf(name="exiteditor",
             attr="exit",
             context=IContainer,
             permission="view",
             containment=IApplication),
    ViewConf(name="exiteditor",
             attr="exitapp",
             context=IApplication,
             permission="view",
             containment=IPortal),

    #ViewConf(id="rootview", name = "",     attr = "view", context = ICMSRoot, containment=IApplication),
    #ViewConf(id="objview",  name = "",     attr = "view", context = IPage),
コード例 #7
0
ファイル: view.py プロジェクト: nive-cms/nive
# view module definition ------------------------------------------------------------------

#@nive_module
configuration = ViewModuleConf(id="userview",
                               name=_(u"User signup"),
                               static="nive.userdb.userview:static",
                               containment="nive.userdb.app.UserDB",
                               context="nive.userdb.root.root",
                               view="nive.userdb.userview.view.UserView",
                               templates="nive.userdb.userview:",
                               permission="view")
t = configuration.templates
configuration.views = [
    # User Views
    ViewConf(name="login", attr="login", renderer=t + "loginpage.pt"),
    ViewConf(name="signup",
             attr="create",
             renderer=t + "signup.pt",
             permission="signup"),
    ViewConf(name="update",
             attr="update",
             renderer=t + "update.pt",
             permission="updateuser"),
    ViewConf(name="resetpass", attr="resetpass", renderer=t + "resetpass.pt"),
    ViewConf(name="logout", attr="logout"),
    # disabled
    #ViewConf(name="mailpass", attr="mailpass", renderer=t+"mailpass.pt"),
]

# view and form implementation ------------------------------------------------------------------
コード例 #8
0
ファイル: admin.py プロジェクト: nive-cms/nive
from nive.definitions import IApplication, IAdminWidgetConf
from nive.adminview.view import AdminBasics, ConfigurationForm

# view module definition ------------------------------------------------------------------

#@nive_module
configuration = ViewModuleConf(id="cms_admin",
                               name=_(u"CMS Administration"),
                               context=IApplication,
                               view="nive.cms.cmsview.admin.CMSAdminView",
                               templates="nive.adminview:",
                               permission="administration")

t = configuration.templates
configuration.views = [
    ViewConf(name="design", attr="design", renderer=t + "form.pt"),
    ViewConf(name="help",
             attr="help",
             renderer=t + "help.pt",
             permission="read"),
]

configuration.widgets = [
    WidgetConf(name=_(u"Design"),
               viewmapper="design",
               id="admin.design",
               sort=1500,
               apply=(IApplication, ),
               widgetType=IAdminWidgetConf,
               description=u""),
    WidgetConf(name=_(u"Help"),
コード例 #9
0
# view module definition ------------------------------------------------------------------

#@nive_module
configuration = ViewModuleConf(
    id = "administration",
    name = _(u"Administration"),
    static = "",
    context = IApplication,
    view = "nive.adminview.view.AdminView",
    templates = "nive.adminview:",
    permission = "administration"
)
t = configuration.templates
configuration.views = [
    # User Management Views
    ViewConf(name = "admin",    attr = "view",       renderer = t+"root.pt"),
    ViewConf(name = "basics",   attr = "editbasics", renderer = t+"form.pt"),
    #ViewConf(name = "portal",   attr = "editportal", renderer = t+"form.pt"),
    ViewConf(name = "tools",    attr = "tools",      renderer = t+"tools.pt"),
    ViewConf(name = "modules",  attr = "view",       renderer = t+"modules.pt"),
    ViewConf(name = "views",    attr = "view",       renderer = t+"views.pt"),
]

configuration.widgets = [
    WidgetConf(name=_(u"Basics"),    viewmapper="basics",     id="admin.basics",   sort=1000,   apply=(IApplication,), widgetType=IAdminWidgetConf,
               description=u""),
    #WidgetConf(name=_(u"Global"),    viewmapper="portal",     id="admin.portal",   sort=300,   apply=(IApplication,), widgetType=IAdminWidgetConf),
    WidgetConf(name=_(u"Tools"),     viewmapper="tools",      id="admin.tools",    sort=5000,   apply=(IApplication,), widgetType=IAdminWidgetConf,
               description=u""),
    WidgetConf(name=_(u"Modules"),   viewmapper="modules",    id="admin.modules",  sort=10000,   apply=(IApplication,), widgetType=IAdminWidgetConf,
               description=_(u"Read only listing of all registered modules and settings.")),
コード例 #10
0
    name = _(u"User signup"),
    static = "nive_userdb.userview:static",
    containment = "nive_userdb.app.UserDB",
    context = "nive_userdb.root.root",
    view = "nive_userdb.userview.view.UserView",
    templates = "nive_userdb.userview:",
    template = "main.pt",
    permission = "view",
    assets = (),
    # form settings: additional slot to configure the forms used in the views
    form = {}
)
t = configuration.templates
configuration.views = [
    # User Views
    ViewConf(name="login",          attr="login",      renderer=t+"loginpage.pt"),
    ViewConf(name="signup",         attr="create",     renderer=t+"signup.pt",    permission="signup"),
    ViewConf(name="activate",       attr="activate",   renderer=t+"form.pt"),
    ViewConf(name="update",         attr="update",     renderer=t+"update.pt",    permission="updateuser"),
    ViewConf(name="updatepass",     attr="updatepass", renderer=t+"form.pt",      permission="updateuser"),
    ViewConf(name="updatemail1",    attr="updatemail1",renderer=t+"form.pt",      permission="updateuser"),
    ViewConf(name="updatemail2",    attr="updatemail2",renderer=t+"form.pt"),
    ViewConf(name="resetpass",      attr="resetpass",  renderer=t+"form.pt"),
    ViewConf(name="logout",         attr="logout"),
    ViewConf(name="contact",        attr="contact",    renderer=t+"form.pt",      permission="contactuser"),
    ViewConf(name="closefirstrun",  attr="closefirstrun",renderer="json",         permission="updateuser"),
    ViewConf(name="remove",         attr="remove",     renderer=t+"remove.pt",    permission="removeuser"),
]


コード例 #11
0
ファイル: cmsstatistics.py プロジェクト: comlorda/nive
from nive.utils.utils import FormatBytesForDisplay

configuration = ToolConf(
    id="cmsstatistics",
    context="nive.tools.cmsstatistics.cmsstatistics",
    name=_(u"CMS Statistics"),
    description=
    _("This function provides a short summary of elements and data contained in the website."
      ),
    apply=(IApplication, ),
    mimetype="text/html",
    data=[],
    views=[
        ViewConf(name="",
                 view=ToolView,
                 attr="run",
                 permission="system",
                 context="nive.tools.cmsstatistics.cmsstatistics")
    ])


class cmsstatistics(Tool):
    """
    """
    def _Run(self, **values):

        try:
            localizer = get_localizer(get_current_request())
        except:
            localizer = FakeLocalizer()
コード例 #12
0
]
configuration.forms = {
    "create": {
        "fields": fields
    },
    "edit": {
        "fields": fields
    }
}

# define a new view to link our custom view class (SubscriptionView) with the form obj (CmsFormObj)
# this is required to call subscribe() from the template and process the form
configuration.views = [
    ViewConf(id="subscriptionview",
             name="",
             attr="view",
             context=CmsFormObj,
             view=SubscriptionView)
]

# newsuser definition ------------------------------------------------------------------


class NewsuserObj(ObjectBase):
    def Activate(self, currentUser):
        """
        Activate newsuser and remove activation id
        calls workflow commit, if possible
        
        signals event: activate
        """
コード例 #13
0
            c.unlock()
            c.extensions = tuple(e)
            c.lock()
    
    add(app.GetAllRootConfs())
    add(app.GetAllObjectConfs())


toolconf = ToolConf(
    id = "updatefulltext",
    context = "nive_cms.extensions.fulltextpage.RewriteFulltext",
    name = _(u"Rewrite fulltext index"),
    description = _("Delete and rewrite the fulltext index."),
    apply = (IApplication,),
    mimetype = "text/html",
    data = [],
    views = [
        ViewConf(name="", view=ToolView, attr="form", permission="system", context="nive_cms.extensions.fulltextpage.RewriteFulltext")
    ]
)

configuration = ModuleConf(
    id = "pagefulltext",
    name = u"Web page fulltext extension",
    context = PageFulltext,
    events = (Conf(event="startRegistration", callback=SetupFulltext),),
    modules = [toolconf]
)


コード例 #14
0
ファイル: sort.py プロジェクト: timgates42/nive_cms
                lastObj = obj
            else:
                order.append(obj)
        if lastObj:
            order.append(lastObj)
        else:
            order.append(id)
        ok, msgs = self.UpdateSort(order, user=user)
        return ok, msgs


views = [
    # sort
    ViewConf(name="@sortpages",
             attr="sortpages",
             context=IPage,
             renderer="nive_cms.cmsview:sort.pt",
             permission="edit"),
    ViewConf(name="@sortpages",
             attr="sortpages",
             context=IRoot,
             renderer="nive_cms.cmsview:sort.pt",
             permission="edit"),
    ViewConf(name="@sortelements",
             attr="sortelements",
             context=IContainer,
             renderer="nive_cms.cmsview:sort.pt",
             permission="edit"),
    ViewConf(name="@moveup",
             attr="moveup",
             context=IContainer,
コード例 #15
0
# Released under GPL3. See license.txt
#

from nive.tool import Tool, ToolView
from nive.definitions import ToolConf, FieldConf, ViewConf


configuration = ToolConf(
    id = "exampletool",
    context = "nive.tools.example.tool",
    name = u"Empty tool for tests",
    description = "",
    apply = None,  #(IObject,)
    mimetype = "text/html",
)
configuration.data = [
    FieldConf(id="parameter1", datatype="bool",               default=0,  name=u"Show 1", description=u"Display 1"),
    FieldConf(id="parameter2", datatype="string", required=1, default="", name=u"Show 2", description=u"Display 2")
]
configuration.views = [
    ViewConf(name="", view=ToolView, attr="run", permission="system", context="nive.tools.example.tool")
]


class tool(Tool):

    def _Run(self, **values):
        result = u"<h1>OK</h1>"
        return result

コード例 #16
0
ファイル: dbSqlDump.py プロジェクト: comlorda/nive
    FieldConf(id="excludeSystem",
              datatype="checkbox",
              default=[],
              listItems=[{
                  "id": "pool_sys",
                  "name": "pool_sys"
              }, {
                  "id": "pool_fulltext",
                  "name": "pool_fulltext"
              }],
              name=_(u"Exclude system columns"))
]
configuration.views = [
    ViewConf(name="",
             view=ToolView,
             attr="form",
             permission="system",
             context="nive.tools.dbSqlDump.dbSqlDump")
]


class dbSqlDump(Tool):
    """
    """
    def _Run(self, **values):

        result = 1
        codepage = "utf-8"

        app = self.app
        datapool = app.db
コード例 #17
0
ファイル: dbStructureUpdater.py プロジェクト: nive-cms/nive
        return self.SendResponse(data, mime=self.context.mimetype, raiseException=False) 
    
            
configuration = ToolConf()
configuration.id = "dbStructureUpdater"
configuration.context = "nive.components.tools.dbStructureUpdater.dbStructureUpdater"
configuration.name = _(u"Database Structure")
configuration.description = _(u"Generate or update the database structure based on configuration settings.")
configuration.apply = (IApplication,)
configuration.data = [
    FieldConf(id="modify",     datatype="bool", default=0, name=_(u"Modify existing columns"),  description=_(u"Change existing database columns to new configuration. Depending on the changes, data may be lost!")),
    FieldConf(id="showSystem", datatype="bool", default=0, name=_(u"Show system columns"),      description=u"")
]
configuration.mimetype = "text/html"
configuration.views = [
    ViewConf(name="", view=dbView, attr="view", permission="system", context="nive.components.tools.dbStructureUpdater.dbStructureUpdater")
]

class dbStructureUpdater(Tool):

    def _Run(self, **values):

        result = 1
        importWf = 1
        importSecurity = 0
        showSystem = values.get("showSystem")
        modify = values.get("modify")
        request = values["original"]
        
        try:
            localizer = get_localizer(get_current_request())
コード例 #18
0
ファイル: dbStructureUpdater.py プロジェクト: comlorda/nive
            datatype="bool",
            default=0,
            name=_(u"Modify existing columns"),
            description=
            _(u"Change existing database columns to new configuration. Depending on the changes, data may be lost!"
              )),
        FieldConf(id="showSystem",
                  datatype="bool",
                  default=0,
                  name=_(u"Show system columns"),
                  description=u"")
    ],
    views=[
        ViewConf(name="",
                 view=ToolView,
                 attr="run",
                 permission="system",
                 context="nive.tools.dbStructureUpdater.dbStructureUpdater")
    ])


class dbStructureUpdater(Tool):
    def _Run(self, **values):

        result = 1
        importWf = 1
        importSecurity = 0
        showSystem = values.get("showSystem")
        modify = values.get("modify")
        request = values["original"]
コード例 #19
0
from nive.views import BaseView
from nive.helper import ResolveName

# view module definition ------------------------------------------------------------------

#@nive_module
configuration = ViewModuleConf(
    id="design",
    name=_(u"Website design and view"),
    static="nive.cms.design:static",
    templates="nive.cms.design:templates",
    mainTemplate="index.pt",
    permission="view",
    view="nive.cms.design.view.Design",
    views=[
        ViewConf(id="appview", name="", attr="app", context=IWebsite),
        ViewConf(id="search", name="search", attr="search", context=IRoot),
        ViewConf(id="su", name="su", attr="open", context=IRoot),
        ViewConf(id="rootview", name="", attr="view", context=IWebsiteRoot),
        ViewConf(id="objview",
                 name="",
                 attr="view",
                 context=IPage,
                 containment=IWebsiteRoot),
        ViewConf(id="objview", name="", attr="view", context=IPageElement),
        ViewConf(id="objfile", name="file", attr="file", context=IFile),
        # restricted permmissions if called in editor
        ViewConf(id="rootview",
                 name="",
                 attr="view",
                 context=ICMSRoot,