Vorhandes Produkt um weitere Felder erweitern: collective.realestatebroker

Michael Kiberu <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <[email protected]>
Hallo Allen,

ich habe das Produkt "collective.realestatebroker" für plone 3.x um ein 
paar Felder erweitert, die auch im Edit Modus angezeigt werden.

Nur in der Ansicht fehlen alle gänzlich. Ich werde nicht schlau aus dem 
Template, wie ich die neuen Felder ebenfalls anzeigen kann.

Vielleicht hat jemand ein Tip, wie ich vorgehen kann?
Folgende Änderungen machte ich:
interfaces.py  habe ich das Interface „IRealEstateContent“ erweitert:
	contact_name = schema.TextLine(title = _(u'Contact name'))



In der Datei „commercial.py“ und „residential.py“ habe ich der Klasse 
„Commercial“ und „Residential“  die zusätzlichen Felder implementiert.

contact_name = atapi.ATFieldProperty('contact_name')


In der Datei „schemata.py“ habe ich die zusätzlichen Felder implementiert

atapi.StringField('contact_name',

         storage=atapi.AnnotationStorage(),
         schemata=u'default',
         selfrendered=True, # For REB-specific template rendering.
         widget = atapi.StringWidget(label = _(u'Contact name'),
                  )
         ),

In der Datei „controlpanel.py“ die get und set Methoden implementiert,

     def get_contact_name(self):
         value = getattr(self.context, 'contact_name', u'')
         value = safe_unicode(value, getSiteEncoding(self.context))
         return value

     def set_contact_name(self, value):
         value = safe_unicode(value, getSiteEncoding(self.context))
         self.context._updateProperty('contact_name', value)

Super wäre es natürlich wenn jemand damit schon mal gearbeitet hat und 
mir noch unter die Arme greifen könnte. Sonst bin ich für jede Hilfe 
dankbar. Die View habe ich mitangehangen.

Gruß,
Michael



_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
realestate_view.pt (text/html, 2.3 KB)
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="collective.realestatebroker">

  <body>

    <div metal:fill-slot="main">

      <div tal:replace="structure provider:plone.abovecontenttitle" />
      <div tal:replace="structure provider:realestatebroker.titlemanager" />
      <div tal:replace="structure provider:plone.belowcontenttitle" />
      <div tal:replace="structure provider:plone.abovecontentbody" />
      
      <div class="visualClear" />
      
      <div tal:replace="structure provider:realestatebroker.actionsmanager" />

      <div class="rebDescription">
        <metal:field use-macro="python:context.widget('description', mode='view')">
          Description
        </metal:field>
      </div>
            
      <table class="listing charsTable">
        <th colspan="2" 
          i18n:translate="Characteristics">
          Characteristics
        </th>
        
        <tal:row tal:define="label_macro label_macro|context/widgets/field_table/macros/label;
                             data_macro data_macro|context/widgets/field_table/macros/data;
                             field_macro field_macro | context/widgets/field_table/macros/view;"
                 tal:repeat="field view/base_fields">
          <tal:if_visible define="mode string:view;
                                  visState python:field.widget.isVisible(context, mode);
                                  visCondition python:field.widget.testCondition(context.aq_inner.aq_parent, portal, context);"
                          condition="python:visState == 'visible' and visCondition">
            <tr class="field"
                tal:define="oddrow repeat/field/odd"
                tal:attributes="class python:oddrow and 'field odd' or 'field even'">
              <metal:use_base_view use-macro="context/widgets/field/macros/base_view" />
            </tr>
          </tal:if_visible>
        </tal:row>
      </table>
    
      <div>
        <metal:field use-macro="python:context.widget('text', mode='view')">
          Main text
        </metal:field>
      </div>
	  
	 

      <div tal:replace="structure provider:plone.belowcontentbody" />

    </div>
  </body>
</html>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.