Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
archetypes.kss.fields.ATDocumentFieldsView Class Reference
Inheritance diagram for archetypes.kss.fields.ATDocumentFieldsView:
Inheritance graph
[legend]
Collaboration diagram for archetypes.kss.fields.ATDocumentFieldsView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def isTableOfContentsEnabled
def replaceField
def replaceWithView
def saveField
def renderViewField
def getTemplate
def renderEditField
def macroContent
def issueAllPortalMessages

Static Public Attributes

tuple view_field_wrapper = ZopeTwoPageTemplateFile('browser/view_field_wrapper.pt')
 KSS methods.
tuple edit_field_wrapper = ZopeTwoPageTemplateFile('browser/edit_field_wrapper.pt')
tuple header_macros = ZopeTwoPageTemplateFile('browser/macro_wrapper.pt')

Detailed Description

Definition at line 222 of file fields.py.


Member Function Documentation

def archetypes.kss.fields.FieldsView.getTemplate (   self,
  templateId,
  context = None 
) [inherited]
traverse/search template

Definition at line 77 of file fields.py.

00077 
00078     def getTemplate(self, templateId, context=None):
00079         """
00080         traverse/search template
00081         """
00082 
00083         if not context:
00084             context = self.context
00085 
00086         template = context.restrictedTraverse(templateId)
00087         
00088         if IBrowserView.providedBy(template):
00089             view = template
00090             for attr in ('index', 'template', '__call__'):
00091                 template = getattr(view, attr, None)
00092                 if template is not None and hasattr(template, 'macros'):
00093                     break
00094             if template is None:
00095                 raise KeyError("Unable to find template for view %s" % templateId)
00096         return template
00097 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 45 of file plonekssview.py.

00045 
00046     def issueAllPortalMessages(self):
00047         if hasattr(self.request.RESPONSE, 'cookies'):
00048             cookie = self.request.RESPONSE.cookies.get(STATUSMESSAGEKEY)
00049             if cookie:
00050                 encodedstatusmessages = cookie['value']
00051                 statusmessages = _decodeCookieValue(encodedstatusmessages)
00052             else:
00053                 statusmessages = []
00054             for msg in statusmessages:
00055                 self.getCommandSet('plone').issuePortalMessage(msg)
00056             self.request.RESPONSE.expireCookie(STATUSMESSAGEKEY, path='/')

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 224 of file fields.py.

00224 
00225     def isTableOfContentsEnabled(self):
00226         getTableContents = getattr(self.context, 'getTableContents', None)
00227         result = False
00228         if getTableContents is not None:
00229             result = getTableContents()
00230         return result

Here is the call graph for this function:

Here is the caller graph for this function:

def plone.app.kss.plonekssview.PloneKSSView.macroContent (   self,
  macropath,
  kw 
) [inherited]

Definition at line 24 of file plonekssview.py.

00024 
00025     def macroContent(self, macropath, **kw):
00026         'Renders a macro and returns its text'
00027         path = macropath.split('/')
00028         if len(path) < 2 or path[-2] != 'macros':
00029             raise RuntimeError, 'Path must end with macros/name_of_macro (%s)' % (repr(macropath), )
00030         # needs string, do not tolerate unicode (causes but at traverse)
00031         jointpath = '/'.join(path[:-2]).encode('ascii')
00032         macroobj = self.context.restrictedTraverse(jointpath)
00033         try:
00034             the_macro = macroobj.macros[path[-1]]
00035         except AttributeError, IndexError:
00036             raise RuntimeError, 'Macro not found'
00037         #  
00038         # put parameters on the request, by saving the original context
00039         self.request.form, orig_form = kw, self.request.form
00040         content = self.header_macros.__of__(macroobj.aq_parent)(the_macro=the_macro)
00041         self.request.form = orig_form
00042         # Always encoded as utf-8
00043         content = force_unicode(content, 'utf')
00044         return content

Here is the call graph for this function:

Here is the caller graph for this function:

def archetypes.kss.fields.FieldsView.renderEditField (   self,
  fieldname,
  templateId,
  macro,
  uid = None 
) [inherited]
renders the edit widget inside the macro coming from the view template

Definition at line 98 of file fields.py.

00098 
00099     def renderEditField(self, fieldname, templateId, macro, uid=None):
00100         """
00101         renders the edit widget inside the macro coming from the view template
00102         """
00103 
00104         context = self._getFieldContext(uid)
00105         template = self.getTemplate(templateId, context)
00106         containingMacro = template.macros[macro]
00107         fieldname = fieldname.split('archetypes-fieldname-')[-1]
00108         field = context.getField(fieldname)
00109         widget = field.widget
00110         widgetMacro = widget('edit', context)
00111         
00112         res = self.edit_field_wrapper(containingMacro=containingMacro,
00113                                       widgetMacro=widgetMacro,
00114                                       field=field, instance=context,
00115                                       mode='edit',
00116                                       templateId=templateId)
00117 
00118         return res
00119 

Here is the call graph for this function:

Here is the caller graph for this function:

def archetypes.kss.fields.FieldsView.renderViewField (   self,
  fieldname,
  templateId,
  macro,
  uid = None 
) [inherited]
renders the macro coming from the view template

Definition at line 62 of file fields.py.

00062 
00063     def renderViewField(self, fieldname, templateId, macro, uid=None):
00064         """
00065         renders the macro coming from the view template
00066         """
00067 
00068         context = self._getFieldContext(uid)
00069         template = self.getTemplate(templateId, context)
00070 
00071         viewMacro = template.macros[macro]
00072         res = self.view_field_wrapper(viewMacro=viewMacro,
00073                                       context=context,
00074                                       templateId=templateId,
00075                                       fieldName=fieldname)
00076         return res

Here is the call graph for this function:

Here is the caller graph for this function:

def archetypes.kss.fields.ATDocumentFieldsView.replaceField (   self,
  fieldname,
  templateId,
  macro,
  uid = None,
  target = None,
  edit = False 
)
kss commands to replace the field value by the edit widget

The edit parameter may be used if we are coming from something else
than an edit view.

Reimplemented from archetypes.kss.fields.FieldsView.

Definition at line 231 of file fields.py.

00231 
00232     def replaceField(self, fieldname, templateId, macro, uid=None, target=None, edit=False):
00233         if fieldname == "text" and self.isTableOfContentsEnabled():  
00234             self.getCommandSet('core').setStyle("#document-toc", name="display", value="none")
00235         FieldsView.replaceField(self, fieldname, templateId, macro, uid=uid, target=target, edit=edit)
00236         return self.render()

def archetypes.kss.fields.ATDocumentFieldsView.replaceWithView (   self,
  fieldname,
  templateId,
  macro,
  uid = None,
  target = None,
  edit = False 
)
kss commands to replace the edit widget by the field view

Reimplemented from archetypes.kss.fields.FieldsView.

Definition at line 237 of file fields.py.

00237 
00238     def replaceWithView(self, fieldname, templateId, macro, uid=None, target=None, edit=False):
00239         FieldsView.replaceWithView(self, fieldname, templateId, macro, uid=uid, target=target, edit=edit)
00240         if fieldname == "text" and self.isTableOfContentsEnabled(): 
00241             self.getCommandSet('core').setStyle("#document-toc", name="display", value="block")
00242             self.getCommandSet('plone-legacy').createTableOfContents()
00243         return self.render()
    
def archetypes.kss.fields.ATDocumentFieldsView.saveField (   self,
  fieldname,
  value = None,
  templateId = None,
  macro = None,
  uid = None,
  target = None 
)
This method saves the current value to the field. and returns the rendered
view macro.

Reimplemented from archetypes.kss.fields.FieldsView.

Definition at line 244 of file fields.py.

00244 
00245     def saveField(self, fieldname, value=None, templateId=None, macro=None, uid=None, target=None):
00246         FieldsView.saveField(self, fieldname,
00247                 value = value,
00248                 templateId = templateId,
00249                 macro = macro,
00250                 uid = uid,
00251                 target = target,
00252                 )
00253         if fieldname == "text" and self.isTableOfContentsEnabled(): 
00254             self.getCommandSet('plone-legacy').createTableOfContents() 
00255             #manager = getMultiAdapter((self.context, self.request, self),
00256             #                          IViewletManager,
00257             #                          name='plone.abovecontentbody')
00258             #self.getCommandSet('refreshviewlet').refreshViewlet('document-toc',
00259             #                                                    manager,
00260             #                                                    'plone.tableofcontents')
00261         return self.render()
00262 


Member Data Documentation

tuple archetypes.kss.fields.FieldsView.edit_field_wrapper = ZopeTwoPageTemplateFile('browser/edit_field_wrapper.pt') [static, inherited]

Definition at line 60 of file fields.py.

tuple plone.app.kss.plonekssview.PloneKSSView.header_macros = ZopeTwoPageTemplateFile('browser/macro_wrapper.pt') [static, inherited]

Definition at line 22 of file plonekssview.py.

tuple archetypes.kss.fields.FieldsView.view_field_wrapper = ZopeTwoPageTemplateFile('browser/view_field_wrapper.pt') [static, inherited]

KSS methods.

Definition at line 59 of file fields.py.


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