version 1.10, 2004/04/04 14:56:05
|
version 1.11, 2004/04/04 17:48:22
|
Line 1
|
Line 1
|
# Objekte zur Erzeugung von Navigationselementen |
# Objekte zur Erzeugung von Navigationselementen |
|
|
|
from Globals import DTMLFile |
|
from OFS.Image import Image,cookId |
from OFS.Folder import Folder |
from OFS.Folder import Folder |
from OFS.SimpleItem import SimpleItem |
from OFS.SimpleItem import SimpleItem |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
Line 12 import os.path
|
Line 13 import os.path
|
from Globals import package_home |
from Globals import package_home |
import urllib |
import urllib |
|
|
|
class ECHO_contentType(Image): |
|
"""ContentType Object""" |
|
|
|
meta_type="ECHO_contentType" |
|
|
|
|
|
manage_options=Image.manage_options+( |
|
{'label':'Change Description','action':'changeECHO_contentTypeForm'}, |
|
) |
|
|
|
def changeECHO_contentTypeForm(self): |
|
"""Change the description text""" |
|
pt=PageTemplateFile('Products/ECHO_content/zpt/changeECHO_contentType.zpt').__of__(self) |
|
return pt() |
|
|
|
def changeECHO_contentType(self,description,RESPONSE=None): |
|
"""Change the Content""" |
|
self.description=description |
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
manage_addECHO_contentTypeForm=DTMLFile('dtml/ECHO_contentTypeAdd',globals(), |
|
Kind='ECHO_contentType',kind='ECHO_contentType') |
|
|
|
def manage_addECHO_contentType(self, id, file=None, title='', precondition='', content_type='', description='', |
|
REQUEST=None): |
|
""" |
|
Add a new Image object. |
|
|
|
Creates a new Image object 'id' with the contents of 'file'. |
|
""" |
|
|
|
id=str(id) |
|
title=str(title) |
|
content_type=str(content_type) |
|
precondition=str(precondition) |
|
|
|
id, title = cookId(id, title, file) |
|
|
|
self=self.this() |
|
|
|
# First, we create the image without data: |
|
self._setObject(id, ECHO_contentType(id,title,'',content_type, precondition)) |
|
|
|
self._getOb(id).description=description |
|
|
|
# Now we "upload" the data. By doing this in two steps, we |
|
# can use a database trick to make the upload more efficient. |
|
if file: |
|
self._getOb(id).manage_upload(file) |
|
if content_type: |
|
self._getOb(id).content_type=content_type |
|
|
|
if REQUEST is not None: |
|
try: url=self.DestinationURL() |
|
except: url=REQUEST['URL1'] |
|
REQUEST.RESPONSE.redirect('%s/manage_main' % url) |
|
return id |
|
|
|
|
class ECHO_sqlElement(SimpleItem): |
class ECHO_sqlElement(SimpleItem): |
"""Erzeuge navigation aus sql-abfrage""" |
"""Erzeuge navigation aus sql-abfrage""" |
meta_type="ECHO_sqlElement" |
meta_type="ECHO_sqlElement" |