[zopeorg-checkins] CVS: Products/ZopeOrg-NV - CaseStudy.py:1.1 ZopeServiceProvider.py:1.1

Sidnei da Silva sidnei at x3ng.com.br
Mon Jan 20 09:17:24 EST 2003


Update of /cvs-zopeorg/Products/ZopeOrg-NV
In directory cvs.zope.org:/tmp/cvs-serv8482

Added Files:
	CaseStudy.py ZopeServiceProvider.py 
Log Message:
Two new types: CaseStudy and ZopeServiceProvider. Management skins to come later. Reorganizing FS layout.


=== Added File Products/ZopeOrg-NV/CaseStudy.py ===
from Globals import InitializeClass
from Products.CMFCore.CMFCorePermissions import View, \
     ManageProperties, ListFolderContents, \
     ModifyPortalContent, AddPortalContent
from Products.CMFCore.utils import format_stx
from Products.CMFDefault.Document import Document
from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
from AccessControl import ClassSecurityInfo

class CaseStudy(Document):

    portal_type = meta_type = "Case Study"

    security = ClassSecurityInfo()

    _external_url = ''
    _problem = ''
    _solution = ''
    _logo = ''

    def __init__(self, id, title='', description='', text_format='', text=''):
        DefaultDublinCoreImpl.__init__(self)
        Document.__init__(self, id, title, description, text_format, text)

    security.declareProtected(View, 'Summary')
    Summary = Description

    security.declareProtected(ModifyPortalContent, 'setSummary')
    setSummary = setDescription

    security.declareProtected(View, 'CaseFacts')
    CaseFacts = CookedBody
    
    security.declareProtected(ModifyPortalContent, 'setCaseFacts')
    setCaseFacts = edit

    security.declareProtected(View, 'ExternalURL')
    def ExternalURL(self):
        return self._external_url

    security.declareProtected(ModifyPortalContent, 'setExternalURL')
    def setExternalURL(self, external_url):
        self._external_url = external_url

    security.declareProtected(View, 'getLogo')
    def getLogo(self):
        logo = self._logo
        if logo:
            return getattr(self, logo, None)
        return None

    security.declareProtected(ModifyPortalContent, 'setLogo')
    def setLogo(self, logo):
        self._logo = logo

    security.declareProtected(View, 'Problem')
    def Problem(self):
        return getCookedText(self, self._problem)

    security.declareProtected(ModifyPortalContent, 'setProblem')
    def setProblem(self, problem):
        self._problem = problem

    security.declareProtected(View, 'Solution')
    def Solution(self):
        return getCookedText(self, self._solution)

    security.declareProtected(ModifyPortalContent, 'setSolution')
    def setSolution(self, solution):
        self._solution = solution

InitializeClass(CaseStudy)

def getCookedText(self, text, stx_level=None):
    if (self.text_format == 'html' or self.text_format == 'plain'):
        return text
    else:
        cooked = format_stx(text, stx_level)
        return cooked
    


=== Added File Products/ZopeOrg-NV/ZopeServiceProvider.py ===
from Globals import InitializeClass
from Products.CMFCore.CMFCorePermissions import View, \
     ManageProperties, ListFolderContents, \
     ModifyPortalContent, AddPortalContent
from Products.CMFDefault.Document import Document
from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
from AccessControl import ClassSecurityInfo

class ZopeServiceProvider(Document):

    portal_type = meta_type = "Zope Service Provider"

    security = ClassSecurityInfo()

    _location = ''
    _logo = ''
    _company_url = ''
    _contact_name = ''
    _contact_email = ''

    def __init__(self, id, title='', description='', text_format='', text=''):
        DefaultDublinCoreImpl.__init__(self)
        Document.__init__(self, id, title, description, text_format, text)

    security.declareProtected(View, 'Company')
    Company = Title

    security.declareProtected(ModifyPortalContent, 'setCompany')
    setCompany = setTitle

    security.declareProtected(View, 'Summary')
    Summary = Description

    security.declareProtected(ModifyPortalContent, 'setSummary')
    setSummary = setDescription

    security.declareProtected(View, 'ServiceInfo')
    ServiceInfo = CookedBody
    
    security.declareProtected(ModifyPortalContent, 'setServiceInfo')
    setServiceInfo = edit

    security.declareProtected(View, 'Location')
    def Location(self):
        return self._location

    security.declareProtected(ModifyPortalContent, 'setLocation')
    def setLocation(self, location):
        self._location = location

    security.declareProtected(View, 'getLogo')
    def getLogo(self):
        logo = self._logo
        if logo:
            return getattr(self, logo, None)
        return None

    security.declareProtected(ModifyPortalContent, 'setLogo')
    def setLogo(self, logo):
        self._logo = logo

    security.declareProtected(View, 'ContactName')
    def ContactName(self):
        return self._contact_name

    security.declareProtected(ModifyPortalContent, 'setContactName')
    def setContactName(self, contact_name):
        self._contact_name = contact_name

    security.declareProtected(View, 'ContactEmail')
    def ContactEmail(self):
        return self._contact_email

    security.declareProtected(ModifyPortalContent, 'setContactEmail')
    def setContactEmail(self, contact_email):
        self._contact_email = contact_email

InitializeClass(ZopeServiceProvider)





More information about the zopeorg-checkins mailing list