significant change to tab_edit method

Andy Altepeter <[email protected]> Wed, 30 Jan 2008 21:26:55 -0600
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
Hi Silva Developers,

I just committed a major refactoring of how the SMI edit tab (tab_edit.pt) 
works.

Previously in the trunk (and in all versions of Silva prior), there was one 
tab_edit.pt for each major class of content (IContent, IContainer, 
IVersionedContent, IAsset, etc).  Each one calls the edit.pt/py of the model 
as if it was a method. This has (at least) two disadvantages: 
1) edit.pt/py needs to redefine model, view, title, etc. which is inefficient. 
2) major code duplication.  The two and three-column layouts are  duplicated 
in each content type, along with probably many other code snippets.

To gain much more flexibility, the edit tab has been refactored to use macros.  
Now, each content type will define it's own 'tab_edit.pt' which will use one 
of three macros, depending on the class of content: views/macro_edit, 
views/Asset/macro_asset_edit, views/VersionedContent/macro_tab_edit

The main drivers for this new model are in views/macro_edit.  The "editor" 
macro is the primary macro used by the content's tab_edit.  There are two 
macros within macro_edit that define the two and three column layouts.  Below 
is an example of an IContent content type using a three column layout.

All of this is documented in the trunk/doc/developer_notes.txt.  Extensions 
for Silva 2.1 shouldn't need to convert to this new style of doing the edit 
tab, as the legacy style has only been deprecated and not removed.

All Silva core content types (including Silva Document) have been tested to 
ensure they work in the new environment.

Please let me know if you have any questions / concerns / etc.

Cheers,
Andy

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html tal:omit-tag=""
  lang="en"
  xml:lang="en"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:metal="http://xml.zope.org/namespaces/metal"
  xmlns:notal="http://www.infrae.com/silva/notal"
  xmlns:tal="http://xml.zope.org/namespaces/tal"
  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
  i18n:domain="silva"
  tal:define="model-action string:">

<metal:block use-macro="here/macro_edit/macros/editor">
 <metal:fill-editor-slot fill-slot="main">
  <metal:use-macro use-macro="here/macro_edit/macros/three-col-layout">
   <metal:fill-slot fill-slot="main-body">
    <tr><td>stuff here</td></tr>
   </metal:fill-slot>
   <metal:fill-slot fill-slot="main-foot">
    <tr><td><input type="submit" name="save_stuff:method"  value="save 
settings" />
   </metal:fill-slot>
   <metal:fill-slot fill-slot="right-column">
    <div class="info">
      Info Block describing content object
     </div>
   </metal:fill-slot>
  </metal:use-macro>
 </metal:fill-editor-slot>
</metal:block>
</html>