source: ZMS/trunk/_zmsattributecontainer.py @ 1557

Revision 1557, 4.9 KB checked in by zmsdev, 11 months ago (diff)

removed old zms artefacts

Line 
1################################################################################
2# _zmsattributecontainer.py
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License
6# as published by the Free Software Foundation; either version 2
7# of the License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17################################################################################
18
19# Documentation string.
20__doc__ = """ZMS product module."""
21# Version string.
22__version__ = '0.1'
23
24# Imports.
25from App.special_dtml import HTMLFile
26from OFS.Folder import Folder
27import urllib
28import time
29import string
30# Product Imports.
31import _objattrs
32import _pathhandler
33
34
35"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
36Constructor
37"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
38def manage_addZMSAttributeContainer(self):
39  """ manage_addZMSAttributeContainer """
40  id = str(time.time())
41  while id in self.objectIds():
42    id = str(time.time())
43  obj = ZMSAttributeContainer(id)
44  self._setObject(id,obj)
45  obj = getattr(self,id)
46  return obj
47
48
49def containerFilter(container):
50  return container.meta_type.startswith('ZMS')
51
52
53"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
54Class
55"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
56class ZMSAttributeContainer(
57      Folder,
58      _objattrs.ObjAttrs,
59      _pathhandler.PathHandler):
60
61  # Properties.
62  # -----------
63  meta_type = 'ZMSAttributeContainer'
64
65  # Management Options.
66  # -------------------
67  manage_options = ( 
68        {'label': 'Contents', 'action': 'manage_main'},
69        {'label': 'Properties', 'action': 'manage_propertiesForm'},
70        )
71
72  # Management Interface.
73  # ---------------------
74  manage_propertiesForm = HTMLFile('dtml/objattrs/manage_propertiesform', globals())
75
76
77  """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
78  Constructor
79  """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
80  def __init__(self, id):
81    self.id = id
82
83
84  # ----------------------------------------------------------------------------
85  #  ZMSAttributeContainer.getObjAttrs:
86  #
87  #  Delegates getObjAttrs to parent.
88  # ----------------------------------------------------------------------------
89  def getObjAttrs(self, meta_type=None):
90    return self.aq_parent.getObjAttrs(meta_type)
91
92
93  # ----------------------------------------------------------------------------
94  #  ZMSAttributeContainer.getObjVersion:
95  #
96  #  Overrides method from _versionmanager.VersionManager.
97  # ----------------------------------------------------------------------------
98  def getObjVersion(self, REQUEST={}):
99    return self
100
101
102  # ----------------------------------------------------------------------------
103  #  ZMSAttributeContainer.getParentNode:
104  #
105  #  Delegates getParentNode to parent.
106  # ----------------------------------------------------------------------------
107  getParentNode__roles__ = None
108  def getParentNode(self):
109    """
110    Delegates getParentNode to parent.
111    """
112    return self.aq_parent.getParentNode()
113
114
115  # ----------------------------------------------------------------------------
116  #  ZMSAttributeContainer.getChildNodes:
117  # ----------------------------------------------------------------------------
118  def getChildNodes(self, REQUEST={}, meta_types=None, reid=None):
119    return []
120
121
122  ##############################################################################
123  #  ZMSAttributeContainer.manage_changeProperties:
124  #
125  #  Change properties.
126  ##############################################################################
127  def manage_changeProperties(self, REQUEST, RESPONSE):
128    """ ZMSAttributeContainer.manage_changeProperties """
129    message = ''
130    for key in self.getObjAttrs().keys():
131      obj_attr=self.getObjAttr(key)
132      if obj_attr['multilang']:
133        for lang in self.getLangIds():
134          REQUEST.set('lang',lang)
135          self.setReqProperty(key,REQUEST,1)
136      else:
137        REQUEST.set('lang',self.getPrimaryLanguage())
138        self.setReqProperty(key,REQUEST,1)
139    # Return with message.
140    return RESPONSE.redirect('manage_propertiesForm?manage_tabs_message=%s'%(urllib.quote(message)))
141
142################################################################################
Note: See TracBrowser for help on using the repository browser.