Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
Archetypes.Widget.CalendarWidget Class Reference
Inheritance diagram for Archetypes.Widget.CalendarWidget:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.Widget.CalendarWidget:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def process_form
def getName
def getType
def bootstrap
def populateProps
def isVisible
def setCondition
def getCondition
def testCondition
def copy

Public Attributes

 label
 condition

Static Public Attributes

tuple security = ClassSecurityInfo()

Static Private Attributes

tuple _properties = TypesWidget._properties.copy()

Detailed Description

Definition at line 398 of file Widget.py.


Member Function Documentation

def Archetypes.Widget.TypesWidget.bootstrap (   self,
  instance 
) [inherited]
Override if your widget needs data from the instance.

Definition at line 49 of file Widget.py.

00049 
00050     def bootstrap(self, instance):
00051         """Override if your widget needs data from the instance."""
00052         return

def Archetypes.Widget.TypesWidget.copy (   self) [inherited]
Return a copy of widget instance, consisting of field name and
properties dictionary.

Definition at line 130 of file Widget.py.

00130 
00131     def copy(self):
00132         """
00133         Return a copy of widget instance, consisting of field name and
00134         properties dictionary.
00135         """
00136         cdict = dict(vars(self))
00137         properties = deepcopy(cdict)
00138         return self.__class__(**properties)
00139 
00140 InitializeClass(TypesWidget)

Here is the call graph for this function:

def Archetypes.Widget.TypesWidget.getCondition (   self) [inherited]
Return the widget text condition.

Definition at line 101 of file Widget.py.

00101 
00102     def getCondition(self):
00103         """Return the widget text condition."""
00104         return self.condition

def Archetypes.Widget.TypesWidget.getName (   self) [inherited]

Definition at line 40 of file Widget.py.

00040 
00041     def getName(self):
00042         return self.__class__.__name__

Here is the caller graph for this function:

def Archetypes.Widget.TypesWidget.getType (   self) [inherited]
Return the type of this field as a string

Definition at line 44 of file Widget.py.

00044 
00045     def getType(self):
00046         """Return the type of this field as a string"""
00047         return className(self)

Here is the call graph for this function:

def Archetypes.Widget.TypesWidget.isVisible (   self,
  instance,
  mode = 'view' 
) [inherited]
decide if a field is visible in a given mode -> 'state'

Return values are visible, hidden, invisible

The value for the attribute on the field may either be a dict with a
mapping for edit and view::

    visible = { 'edit' :'hidden', 'view' : 'invisible' }

Or a single value for all modes::

    True/1:  'visible'
    False/0: 'invisible'
    -1:      'hidden'
    
visible: The field is shown in the view/edit screen
invisible: The field is skipped when rendering the view/edit screen
hidden: The field is added as <input type="hidden" />

The default state is 'visible'.

Definition at line 61 of file Widget.py.

00061 
00062     def isVisible(self, instance, mode='view'):
00063         """decide if a field is visible in a given mode -> 'state'
00064 
00065         Return values are visible, hidden, invisible
00066 
00067         The value for the attribute on the field may either be a dict with a
00068         mapping for edit and view::
00069 
00070             visible = { 'edit' :'hidden', 'view' : 'invisible' }
00071 
00072         Or a single value for all modes::
00073 
00074             True/1:  'visible'
00075             False/0: 'invisible'
00076             -1:      'hidden'
00077             
00078         visible: The field is shown in the view/edit screen
00079         invisible: The field is skipped when rendering the view/edit screen
00080         hidden: The field is added as <input type="hidden" />
00081 
00082         The default state is 'visible'.
00083         """
00084         vis_dic = getattr(aq_base(self), 'visible', _marker)
00085         state = 'visible'
00086         if vis_dic is _marker:
00087             return state
00088         if type(vis_dic) is DictType:
00089             state = vis_dic.get(mode, state)
00090         elif not vis_dic:
00091             state = 'invisible'
00092         elif vis_dic < 0:
00093             state = 'hidden'
00094         return state

def Archetypes.Widget.TypesWidget.populateProps (   self,
  field 
) [inherited]
This is called when the field is created.

Definition at line 54 of file Widget.py.

00054 
00055     def populateProps(self, field):
00056         """This is called when the field is created."""
00057         name = field.getName()
00058         if not self.label:
00059             self.label = capitalize(name)

def Archetypes.Widget.CalendarWidget.process_form (   self,
  instance,
  field,
  form,
  empty_marker = None,
  emptyReturnsMarker = False,
  validating = True 
)
Basic impl for form processing in a widget

Reimplemented from Archetypes.Widget.TypesWidget.

Definition at line 417 of file Widget.py.

00417 
00418                      emptyReturnsMarker=False, validating=True):
00419         """Basic impl for form processing in a widget"""
00420 
00421         fname = field.getName()
00422         value = form.get(fname, empty_marker)
00423         if value is empty_marker:
00424             return empty_marker
00425         # If JS support is unavailable, the value
00426         # in the request may be missing or incorrect
00427         # since it won't have been assembled from the
00428         # input components. Instead of relying on it,
00429         # assemble the date/time from its input components.
00430         year = form.get('%s_year' % fname, '0000')
00431         month = form.get('%s_month' % fname, '00')
00432         day = form.get('%s_day' % fname, '00')
00433         hour = form.get('%s_hour' % fname, '00')
00434         minute = form.get('%s_minute' % fname, '00')
00435         ampm = form.get('%s_ampm' % fname, '')
00436         if (year != '0000') and (day != '00') and (month != '00'):
00437             value = "%s-%s-%s %s:%s" % (year, month, day, hour, minute)
00438             if ampm:
00439                 value = '%s %s' % (value, ampm)
00440         else:
00441             value = ''
00442         if emptyReturnsMarker and value == '':
00443             return empty_marker
00444         # stick it back in request.form
00445         form[fname] = value
00446         return value, {}

def Archetypes.Widget.TypesWidget.setCondition (   self,
  condition 
) [inherited]
Set the widget expression condition.

Definition at line 96 of file Widget.py.

00096 
00097     def setCondition(self, condition):
00098         """Set the widget expression condition."""
00099         self.condition = condition

def Archetypes.Widget.TypesWidget.testCondition (   self,
  folder,
  portal,
  object 
) [inherited]
Test the widget condition.

Definition at line 106 of file Widget.py.

00106 
00107     def testCondition(self, folder, portal, object):
00108         """Test the widget condition."""
00109         try:
00110             if self.condition:
00111                 __traceback_info__ = (folder, portal, object, self.condition)
00112                 ec = createExprContext(folder, portal, object)
00113                 return Expression(self.condition)(ec)
00114             else:
00115                 return True
00116         except AttributeError:
00117             return True

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

tuple Archetypes.Widget.CalendarWidget._properties = TypesWidget._properties.copy() [static, private]

Reimplemented from Archetypes.Widget.TypesWidget.

Definition at line 399 of file Widget.py.

Definition at line 98 of file Widget.py.

Definition at line 58 of file Widget.py.

tuple Archetypes.Widget.CalendarWidget.security = ClassSecurityInfo() [static]

Reimplemented from Archetypes.Widget.TypesWidget.

Definition at line 413 of file Widget.py.


The documentation for this class was generated from the following file: