def atse_addSchemplate(self, atse_schemplate_id, schema_template, RESPONSE=None):
        """ Adds a schema template.
        
        @type atse_schemplate_id: String
        @param atse_schemplate_id: The id of the schema template to be created
        @type schema_template: String
        @param schema_template: The name of the template to redirect to
        """

        S = BaseSchema.copy()

        if self._schemas.has_key( atse_schemplate_id ):
            raise SchemaEditorError('Schema template with id %s already exists' % schema_id)
        else:
            self.atse_registerSchema( 
                            atse_schemplate_id,
                            S,     
                            filtered_schemas=SCHEMPLATE_IGNORE_SCHEMATA)
                
        self._schemas._p_changed = 1
    
        if RESPONSE:        
            util.redirect(RESPONSE, schema_template,
                          self.translate('atse_schema_template_added', 
                                         default='Schema template added',
                                         domain='ATSchemaEditorNG'), 
                          schema_id=atse_schemplate_id)
        return 
Beispiel #2
0
from Products.membrane.at.interfaces import IUserAuthProvider
from Products.membrane.at.interfaces import IUserAuthentication
from Products.membrane.at.interfaces import IPropertiesProvider
from Products.membrane.at.interfaces import ISchemataPropertiesProvider
from Products.membrane.at.interfaces import IGroupsProvider
from Products.membrane.at.interfaces import ISelectedGroupsProvider
from Products.membrane.at.interfaces import IGroupAwareRolesProvider
from Products.membrane.at.interfaces import IUserRoles
from Products.membrane.interfaces import user as user_ifaces
from Products.membrane.interfaces import group as group_ifaces
from Products.membrane.config import PROJECTNAME, TOOLNAME


GROUP_RELATIONSHIP = 'participatesInProject'

group = BaseSchema.copy() + Schema((
    ReferenceField(
        name='manager',
        relationship='managesProject',
        allowed_types=('Member', 'TestMember',),
        vocabulary='listUsers',
        languageIndependent=1),
    ReferenceField(
        name="members",
        relationship=GROUP_RELATIONSHIP,
        multiValued=1,
        languageIndependent=1,
        allowed_types=('Member', 'TestMember',),
        vocabulary='listUsers',),
    LinesField(
        name="roles_",
Beispiel #3
0
from Products.membrane.at.interfaces import IGroupsProvider
from Products.membrane.at.interfaces import ISchemataPropertiesProvider
from Products.membrane.at.interfaces import ISelectedGroupsProvider
from Products.membrane.at.interfaces import IUserAuthentication
from Products.membrane.at.interfaces import IUserAuthProvider
from Products.membrane.at.interfaces import IUserPropertiesProvider
from Products.membrane.at.interfaces import IUserRoles
from Products.membrane.config import PROJECTNAME
from Products.membrane.config import TOOLNAME
from Products.membrane.interfaces import group as group_ifaces
from Products.membrane.interfaces import user as user_ifaces
from zope.interface import implementer

GROUP_RELATIONSHIP = 'participatesInProject'

group = BaseSchema.copy() + Schema((
    ReferenceField(name='manager',
                   relationship='managesProject',
                   allowed_types=(
                       'Member',
                       'TestMember',
                   ),
                   vocabulary='listUsers',
                   languageIndependent=1),
    ReferenceField(
        name="members",
        relationship=GROUP_RELATIONSHIP,
        multiValued=1,
        languageIndependent=1,
        allowed_types=(
            'Member',
Beispiel #4
0
from Products.Archetypes.public import BaseSchema
from plone.app.folder.folder import ATFolder, ATFolderSchema

BikaSchema = BaseSchema.copy()
BikaSchema['id'].widget.visible = False
BikaSchema['description'].widget.visible = False
BikaSchema['description'].schemata = 'default'
BikaSchema['description'].default_content_type = 'text/plain'
BikaSchema['description'].allowable_content_types = ('text/plain',)
BikaSchema['allowDiscussion'].widget.visible = False
BikaSchema['creators'].widget.visible = False
BikaSchema['contributors'].widget.visible = False
BikaSchema['rights'].widget.visible = False
BikaSchema['effectiveDate'].widget.visible = False
BikaSchema['expirationDate'].widget.visible = False
BikaSchema['subject'].widget.visible = False
BikaSchema['language'].widget.visible = False
BikaSchema['location'].widget.visible = False

BikaSchema['title'].validators = ('uniquefieldvalidator',)
# Update the validation layer after change the validator in runtime
BikaSchema['title']._validationLayer()

BikaFolderSchema = ATFolderSchema.copy()
BikaFolderSchema['excludeFromNav'].widget.visible = False
BikaFolderSchema['nextPreviousEnabled'].widget.visible = False
BikaFolderSchema['id'].widget.visible = False
BikaFolderSchema['description'].widget.visible = False
BikaFolderSchema['allowDiscussion'].widget.visible = False
BikaFolderSchema['creators'].widget.visible = False
BikaFolderSchema['contributors'].widget.visible = False
from Products.Archetypes.public import registerType
from Products.Archetypes.Marshall import RFC822Marshaller

# Quills imports
from Products.Quills import QuillsMessageFactory as _
from quills.core.interfaces import IWorkflowedWeblogEntry
from quills.app.topic import Topic
from quills.app.topic import AuthorTopic
from quills.app.utilities import QuillsMixin
from quills.app.interfaces import IWeblogEnhancedConfiguration

# Local imports
from config import PROJECTNAME
import permissions as perms

WeblogEntrySchema = BaseSchema.copy() + Schema((

    TextField('description',
              searchable=1,
              accessor='Description',
              widget=TextAreaWidget(
                     label=_(u'label_weblogentry_description', default=u'Excerpt'),
                     description=_(u'help_weblogentry_description', default='A brief introduction for this entry.'),
                     ),
              ),

    TextField('text',
              searchable=1,
              default_output_type='text/x-html-safe',
              widget=RichWidget(
                     label=_(u'label_text', default=u'Entry Text'),
Beispiel #6
0
from Products.Archetypes.public import AttributeStorage
from Products.Archetypes.public import BaseContent
from Products.Archetypes.public import BaseSchema
from Products.Archetypes.public import ImageField
from Products.Archetypes.public import ImageWidget
from Products.Archetypes.public import RichWidget
from Products.Archetypes.public import Schema
from Products.Archetypes.public import TextField
from Products.Archetypes.public import registerType
from Products.CMFCore.permissions import View
from Products.OrderableReferenceField import OrderableReferenceField
from Products.PloneGazette.config import PROJECTNAME
from archetypes.referencebrowserwidget import ReferenceBrowserWidget


NewsletterRichReferenceSchema = BaseSchema.copy() + Schema((
    TextField(
        'text',
        default='',
        searchable=1,
        required=1,
        default_output_type='text/x-html-safe',
        widget=RichWidget(
            description='',
            description_msgid='help_text',
            i18n_domain="plone",
            label='Text',
            label_msgid='label_text',
        )
    ),
    ImageField(
Beispiel #7
0
    ImageField('image',
               required=False,
               sizes={
                   'mini': (40, 40),
                   'thumb': (80, 80),
               },
               storage=FileSystemStorage(),
               widget=ImageWidget()),
    TextField('text',
              required=False,
              storage=FileSystemStorage(),
              widget=TextAreaWidget()),
),
                       marshall=PrimaryFieldMarshaller())

FSSItemSchema = BaseSchema.copy() + BaseItemShema.copy()
ATFSSItemSchema = ATContentTypeSchema.copy() + BaseItemShema.copy()


class FSSItem(BaseContent):
    """A simple item using FileSystemStorage"""
    archetypes_name = portal_type = meta_type = 'FSSItem'
    schema = FSSItemSchema
    _at_rename_after_creation = True


registerType(FSSItem, PROJECTNAME)


class ATFSSItem(ATCTContent):
    """A simple item using FileSystemStorage base on ATContentypes"""
Beispiel #8
0
from plone.app.blob.tests.base import ReplacementTestCase

from Products.Archetypes.public import BaseSchema, Schema, BaseContent
from Products.Archetypes.public import FileWidget, ImageWidget
from Products.Archetypes.public import registerType
from plone.app.blob.config import packageName, permissions
from plone.app.blob.field import FileField, ImageField
from plone.app.blob.tests.utils import getFile

SampleSchema = BaseSchema.copy() + Schema((

    FileField(
        name = 'foo',
        widget = FileWidget(label='File', description='a file')),

    ImageField(
        name = 'bar',
        widget = ImageWidget(label='Image', description='an image')),

    ImageField(
        name = 'hmm',
        sizes = {'tiny': (42, 42)},
        widget = ImageWidget(label='Image', description='an image')),

))


class SampleType(BaseContent):

    portal_type = 'SampleType'
    schema = SampleSchema
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
###############################################################################

from Products.Archetypes.public import BaseSchema
from Products.Archetypes.public import Schema
from Products.Archetypes.public import ImageField
from Products.Archetypes.public import ImageWidget
from Products.Archetypes.public import BaseContent
from Products.Archetypes.public import registerType

from Products.Archetypes.Marshall import PrimaryFieldMarshaller
from Products.CMFCore import permissions
from Products.CMFCore.utils import getToolByName
from Products.Quills.config import PROJECTNAME

WeblogTopicSchema = BaseSchema.copy() + Schema((
    ImageField('topicImage',
        required=1,
        sizes={'64' : (64,64),},
           widget=ImageWidget(label="Image",
               description="An image for your topic. The image should be 64x64.  If the image is larger it will be scaled down automatically to fit within a 64x64 square."),
        ),
    ),
    marshall=PrimaryFieldMarshaller(),
    )


WeblogTopicSchema['allowDiscussion'].default=0


class WeblogTopic(BaseContent):
Beispiel #10
0
# -*- coding: utf-8 -*-
from plone.app.blob.config import packageName
from plone.app.blob.config import permissions
from plone.app.blob.field import FileField
from plone.app.blob.field import ImageField
from plone.app.blob.tests.base import changeAllowedSizes
from plone.app.blob.tests.base import ReplacementTestCase
from plone.app.blob.tests.utils import getFile
from Products.Archetypes.public import BaseContent
from Products.Archetypes.public import BaseSchema
from Products.Archetypes.public import FileWidget
from Products.Archetypes.public import ImageWidget
from Products.Archetypes.public import registerType
from Products.Archetypes.public import Schema

SampleSchema = BaseSchema.copy() + Schema((
    FileField(name='foo',
              widget=FileWidget(label='File', description='a file')),
    ImageField(name='bar',
               widget=ImageWidget(label='Image', description='an image')),
    ImageField(name='hmm',
               sizes={'tiny': (42, 42)},
               widget=ImageWidget(label='Image', description='an image')),
))


class SampleType(BaseContent):

    portal_type = 'SampleType'
    schema = SampleSchema
Beispiel #11
0
from Products.EventRegistration.utils import getDisplayList
from Products.EventRegistration.utils import getPropSheet

# debugging needs
from Products.Archetypes.debug import log
from pprint import pformat

from Products.ATContentTypes.content import base

from zope.interface import Interface
from zope.interface import implements

# Initialize security manager
security = ClassSecurityInfo()

schema = BaseSchema.copy() + Schema((
    StringField(
        'id',
        widget=StringWidget(visible={
            'edit': 'hidden',
            'view': 'hidden',
        }),
    ),
    StringField(
        'title',
        widget=StringWidget(visible={
            'edit': 'hidden',
            'view': 'hidden',
        }),
        accessor='Title',
    ),
# 4617 Montrose Blvd., Suite C215
# Houston, Texas 77006 USA
# p. +1 713.942.2377 | f. +1 832.201.8856
# www.enfoldsystems.com
# [email protected]
#

from Products.Archetypes.public import registerType
from Products.Archetypes.public import Schema
from Products.Archetypes.public import BaseSchema
from Products.Archetypes.public import BaseContent
from Products.Archetypes.public import ReferenceField
from archetypes.uploadreferencewidget.widget import UploadReferenceWidget
from archetypes.uploadreferencewidget import config

URWSchema = BaseSchema.copy() + Schema((

    ReferenceField(
        name='ref1',
        allowed_types=('File', 'Image'),
        relationship='rel1',
        required=True,
        widget=UploadReferenceWidget(
            label='Single Reference',
            description='This is the first field. It can reference a '
                        'single item. This field uses the site root as '
                        'the the startup directory.',
            startup_directory='/',
        ),
    ),
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
###############################################################################

from Products.Archetypes.public import BaseSchema
from Products.Archetypes.public import Schema
from Products.Archetypes.public import ImageField
from Products.Archetypes.public import ImageWidget
from Products.Archetypes.public import BaseContent
from Products.Archetypes.public import registerType

from Products.Archetypes.Marshall import PrimaryFieldMarshaller
from Products.CMFCore import permissions
from Products.CMFCore.utils import getToolByName
from Products.Quills.config import PROJECTNAME

WeblogTopicSchema = BaseSchema.copy() + Schema(
    (
        ImageField(
            "topicImage",
            required=1,
            sizes={"64": (64, 64)},
            widget=ImageWidget(
                label="Image",
                description="An image for your topic. The image should be 64x64.  If the image is larger it will be scaled down automatically to fit within a 64x64 square.",
            ),
        ),
    ),
    marshall=PrimaryFieldMarshaller(),
)

from Products.Archetypes.public import registerType
from Products.Archetypes.Marshall import RFC822Marshaller

# Quills imports
from Products.Quills import QuillsMessageFactory as _
from quills.core.interfaces import IWorkflowedWeblogEntry
from quills.app.topic import Topic
from quills.app.topic import AuthorTopic
from quills.app.utilities import QuillsMixin
from quills.app.interfaces import IWeblogEnhancedConfiguration

# Local imports
from .config import PROJECTNAME
from . import permissions as perms

WeblogEntrySchema = BaseSchema.copy() + Schema(
    (
        TextField(
            'description',
            searchable=1,
            accessor='Description',
            widget=TextAreaWidget(
                label=_('label_weblogentry_description', default='Excerpt'),
                description=_('help_weblogentry_description',
                              default='A brief introduction for this entry.'),
            ),
        ),
        TextField(
            'text',
            searchable=1,
            default_output_type='text/x-html-safe',
Beispiel #15
0
                  i18n_domain="plone",
                  show_content_type=False,)),
    ImageField('image',
               required=False,
               sizes={
                   'mini':(40,40),
                   'thumb':(80,80),},
               storage=FileSystemStorage(),
               widget=ImageWidget()),
    TextField('text',
              required=False,
              storage=FileSystemStorage(),
              widget=TextAreaWidget()),
    ), marshall=PrimaryFieldMarshaller())

FSSItemSchema = BaseSchema.copy() + BaseItemShema.copy()
ATFSSItemSchema = ATContentTypeSchema.copy() + BaseItemShema.copy()

class FSSItem(BaseContent):
    """A simple item using FileSystemStorage"""
    archetypes_name = portal_type = meta_type = 'FSSItem'
    schema = FSSItemSchema
    _at_rename_after_creation = True


registerType(FSSItem, PROJECTNAME)

class ATFSSItem(ATCTContent):
    """A simple item using FileSystemStorage base on ATContentypes"""
    archetypes_name = portal_type = meta_type = 'ATFSSItem'
    schema = ATFSSItemSchema