[CMF-checkins] SVN: CMF/branches/2.0/C - backporting full metadata edit form cleanup to the 2.0 branch

Jens Vagelpohl jens at dataflake.org
Sun Mar 12 15:45:17 EST 2006


Log message for revision 65928:
  - backporting full metadata edit form cleanup to the 2.0 branch

Changed:
  U   CMF/branches/2.0/CHANGES.txt
  U   CMF/branches/2.0/CMFDefault/browser/TODO.txt
  U   CMF/branches/2.0/CMFDefault/browser/configure.zcml
  U   CMF/branches/2.0/CMFDefault/browser/templates/metadata_edit.pt
  D   CMF/branches/2.0/CMFDefault/browser/templates/metadata_full_edit.pt
  D   CMF/branches/2.0/CMFDefault/skins/zpt_content/full_metadata_edit_form.py
  D   CMF/branches/2.0/CMFDefault/skins/zpt_content/full_metadata_edit_template.pt
  U   CMF/branches/2.0/CMFDefault/skins/zpt_content/metadata_edit_form.py
  U   CMF/branches/2.0/CMFDefault/skins/zpt_content/metadata_edit_template.pt

-=-
Modified: CMF/branches/2.0/CHANGES.txt
===================================================================
--- CMF/branches/2.0/CHANGES.txt	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CHANGES.txt	2006-03-12 20:45:16 UTC (rev 65928)
@@ -1,3 +1,11 @@
+CMF 2.0.0-beta2 (unreleased)
+
+  Others
+
+    - CMFDefault skins and views: Removed 'full_metadata_edit_form'.
+      'metadata_edit_form' is now used for the full set of metadata.
+
+
 CMF 2.0.0-beta (2006/02/26)
 
   New Features

Modified: CMF/branches/2.0/CMFDefault/browser/TODO.txt
===================================================================
--- CMF/branches/2.0/CMFDefault/browser/TODO.txt	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CMFDefault/browser/TODO.txt	2006-03-12 20:45:16 UTC (rev 65928)
@@ -44,12 +44,6 @@
       metadata_edit_template.pt -> templates/metadata_edit.pt
       metadata_edit_control.py -> MetadataEditView.edit_control
 
-  [x] full_metadata_edit_form:
-
-      full_metadata_edit_form.py -> MetadataEditView
-      full_metadata_edit_template.pt -> templates/metadata_full_edit.pt
-      metadata_edit_control.py -> MetadataEditView.edit_control
-
   [x] document_view:
 
       document_view.py -> DocumentView

Modified: CMF/branches/2.0/CMFDefault/browser/configure.zcml
===================================================================
--- CMF/branches/2.0/CMFDefault/browser/configure.zcml	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CMFDefault/browser/configure.zcml	2006-03-12 20:45:16 UTC (rev 65928)
@@ -42,15 +42,6 @@
       />
 
   <browser:page
-      for="Products.CMFCore.interfaces.IMutableDublinCore"
-      name="full_metadata_edit_form"
-      class=".metadata.MetadataEditView"
-      template="templates/metadata_full_edit.pt"
-      permission="cmf.ModifyPortalContent"
-      layer="cmf"
-      />
-
-  <browser:page
       for="Products.CMFDefault.interfaces.IDocument"
       name="document_view"
       class=".document.DocumentView"

Modified: CMF/branches/2.0/CMFDefault/browser/templates/metadata_edit.pt
===================================================================
--- CMF/branches/2.0/CMFDefault/browser/templates/metadata_edit.pt	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CMFDefault/browser/templates/metadata_edit.pt	2006-03-12 20:45:16 UTC (rev 65928)
@@ -2,7 +2,7 @@
 <body>
 
 <metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
-<h1 i18n:translate="">Standard Resource Metadata: <tal:span
+<h1 i18n:translate="">Resource Metadata: <tal:span
     tal:content="view/title" i18n:name="obj_title">Title</tal:span></h1>
 </metal:slot>
 
@@ -14,8 +14,8 @@
 <table class="FormLayout">
  <tr>
   <th i18n:translate="">Enable Discussion?</th>
-  <td>
-   <select name="allow_discussion" style="float: left">
+  <td colspan="3">
+   <select name="allow_discussion">
     <option value="default"
        tal:attributes="selected python: view.allow_discussion() is None"
        i18n:translate="">Default</option>
@@ -26,28 +26,24 @@
        tal:attributes="selected python: view.allow_discussion() is True"
        i18n:translate="">On</option>
    </select>
-   <a href="full_metadata_edit_form" style="float: right"
-      tal:attributes="href string:${context/absolute_url}/full_metadata_edit_form"
-      i18n:translate=""
-     >Edit all metadata</a>
   </td>
  </tr>
  <tr>
   <th i18n:translate="">Identifier</th>
-  <td>
+  <td colspan="3">
    <tal:span tal:content="view/identifier" />
   </td>
  </tr>
  <tr>
   <th i18n:translate="">Title</th>
-  <td>
+  <td colspan="3">
    <input type="text" name="title" value="" size="80"
       tal:attributes="value view/title" />
   </td>
  </tr>
  <tr>
   <th i18n:translate="">Description</th>
-  <td>
+  <td colspan="3">
    <textarea name="description:text" rows="3" cols="80" wrap="soft"
       tal:content="view/description"></textarea>
   </td>
@@ -67,17 +63,54 @@
     </option>
    </select>
   </td>
+  <th i18n:translate="">Contributors</th>
+  <td tal:define="contrib_lines python: '\n'.join(view.contributors())">
+   <textarea name="contributors:lines" rows="5" cols="31"
+      tal:content="contrib_lines"></textarea>
+  </td>
  </tr>
  <tr>
+  <th i18n:translate="">Creation Date</th>
+  <td tal:content="context/CreationDate"></td>
+  <th i18n:translate="">Last Modified Date</th>
+  <td tal:content="context/ModificationDate"></td>
+ </tr>
+ <tr>
+  <th i18n:translate="">Effective Date</th>
+  <td>
+   <input type="text" name="effective_date" value=""
+      tal:attributes="value context/EffectiveDate" />
+  </td>
+  <th i18n:translate="">Expiration Date</th>
+  <td>
+   <input type="text" name="expiration_date" value=""
+      tal:attributes="value context/ExpirationDate" />
+  </td>
+ </tr>
+ <tr>
   <th i18n:translate="">Format</th>
-  <td>
+  <td colspan="3">
    <input type="text" name="format" value=""
       tal:attributes="value view/format" />
   </td>
  </tr>
  <tr>
+  <th i18n:translate="">Language</th>
+  <td colspan="3">
+   <input type="text" name="language" value=""
+      tal:attributes="value view/language" />
+  </td>
+ </tr>
+ <tr>
+  <th i18n:translate="">Rights</th>
+  <td colspan="3">
+   <input type="text" name="rights" value=""
+      tal:attributes="value view/rights" />
+  </td>
+ </tr>
+ <tr>
   <td>&nbsp;</td>
-  <td>
+  <td colspan="3">
    <metal:macro metal:use-macro="context/@@form_widget/buttons" />
   </td>
  </tr>

Deleted: CMF/branches/2.0/CMFDefault/browser/templates/metadata_full_edit.pt
===================================================================
--- CMF/branches/2.0/CMFDefault/browser/templates/metadata_full_edit.pt	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CMFDefault/browser/templates/metadata_full_edit.pt	2006-03-12 20:45:16 UTC (rev 65928)
@@ -1,124 +0,0 @@
-<html metal:use-macro="context/@@standard_macros/page">
-<body>
-
-<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
-<h1 i18n:translate="">Resource Metadata: <tal:span
-    tal:content="view/title" i18n:name="obj_title">Title</tal:span></h1>
-</metal:slot>
-
-<metal:slot metal:fill-slot="body" i18n:domain="cmf_default">
-<div class="Desktop">
-
-<form action="metadata_edit_form" method="post"
-   tal:attributes="action view/form_action">
-<table class="FormLayout">
- <tr>
-  <th i18n:translate="">Enable Discussion?</th>
-  <td colspan="3">
-   <select name="allow_discussion">
-    <option value="default"
-       tal:attributes="selected python: view.allow_discussion() is None"
-       i18n:translate="">Default</option>
-    <option value="off"
-       tal:attributes="selected python: view.allow_discussion() is False"
-       i18n:translate="">Off</option>
-    <option value="on"
-       tal:attributes="selected python: view.allow_discussion() is True"
-       i18n:translate="">On</option>
-   </select>
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Identifier</th>
-  <td colspan="3">
-   <tal:span tal:content="view/identifier" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Title</th>
-  <td colspan="3">
-   <input type="text" name="title" value="" size="80"
-      tal:attributes="value view/title" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Description</th>
-  <td colspan="3">
-   <textarea name="description:text" rows="3" cols="80" wrap="soft"
-      tal:content="view/description"></textarea>
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Subject</th>
-  <td tal:define="subj_lines python: '\n'.join(view.extra_subjects())">
-   <textarea name="subject:lines" rows="3" cols="31"
-      tal:content="subj_lines"></textarea>
-   <br />
-   <select name="subject:list" multiple>
-    <option value=""
-       tal:repeat="subject view/allowed_subjects"
-       tal:attributes="value subject;
-                       selected python: subject in view.subject()"
-       tal:content="subject">
-    </option>
-   </select>
-  </td>
-  <th i18n:translate="">Contributors</th>
-  <td tal:define="contrib_lines python: '\n'.join(view.contributors())">
-   <textarea name="contributors:lines" rows="5" cols="31"
-      tal:content="contrib_lines"></textarea>
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Creation Date</th>
-  <td tal:content="context/CreationDate"></td>
-  <th i18n:translate="">Last Modified Date</th>
-  <td tal:content="context/ModificationDate"></td>
- </tr>
- <tr>
-  <th i18n:translate="">Effective Date</th>
-  <td>
-   <input type="text" name="effective_date" value=""
-      tal:attributes="value context/EffectiveDate" />
-  </td>
-  <th i18n:translate="">Expiration Date</th>
-  <td>
-   <input type="text" name="expiration_date" value=""
-      tal:attributes="value context/ExpirationDate" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Format</th>
-  <td colspan="3">
-   <input type="text" name="format" value=""
-      tal:attributes="value view/format" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Language</th>
-  <td colspan="3">
-   <input type="text" name="language" value=""
-      tal:attributes="value view/language" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Rights</th>
-  <td colspan="3">
-   <input type="text" name="rights" value=""
-      tal:attributes="value view/rights" />
-  </td>
- </tr>
- <tr>
-  <td>&nbsp;</td>
-  <td colspan="3">
-   <metal:macro metal:use-macro="context/@@form_widget/buttons" />
-  </td>
- </tr>
-</table>
-</form>
-
-</div>
-</metal:slot>
-
-</body>
-</html>

Deleted: CMF/branches/2.0/CMFDefault/skins/zpt_content/full_metadata_edit_form.py
===================================================================
--- CMF/branches/2.0/CMFDefault/skins/zpt_content/full_metadata_edit_form.py	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CMFDefault/skins/zpt_content/full_metadata_edit_form.py	2006-03-12 20:45:16 UTC (rev 65928)
@@ -1,56 +0,0 @@
-##parameters=change='', change_and_edit='', change_and_view=''
-##
-from Products.CMFCore.utils import getToolByName
-from Products.CMFDefault.utils import decode
-from Products.CMFDefault.utils import Message as _
-
-mdtool = getToolByName(script, 'portal_metadata')
-
-
-form = context.REQUEST.form
-if change and \
-        context.metadata_edit_control(**form) and \
-        context.setRedirect(context, 'object/metadata'):
-    return
-elif change_and_edit and \
-        context.metadata_edit_control(**form) and \
-        context.setRedirect(context, 'object/edit'):
-    return
-elif change_and_view and \
-        context.metadata_edit_control(**form) and \
-        context.setRedirect(context, 'object/view'):
-    return
-
-
-options = {}
-
-allow_discussion = getattr(context, 'allow_discussion', None)
-if allow_discussion is not None:
-    allow_discussion = bool(allow_discussion)
-options['allow_discussion'] = allow_discussion
-
-options['identifier'] = context.Identifier()
-options['title'] = form.get('title', context.Title())
-options['description'] = form.get('description', context.Description())
-
-subject = form.get('subject', context.Subject())
-allowed_subjects = mdtool.listAllowedSubjects(context)
-extra_subjects = [ s for s in subject if not s in allowed_subjects ]
-options['allowed_subjects'] = tuple(allowed_subjects)
-options['extra_subjects'] = tuple(extra_subjects)
-options['subject'] = tuple(subject)
-options['format'] = form.get('format', context.Format())
-options['contributors'] = form.get('contributors', context.Contributors())
-options['language'] = form.get('language', context.Language())
-options['rights'] = form.get('rights', context.Rights())
-
-buttons = []
-target = context.getActionInfo('object/metadata')['url']
-buttons.append( {'name': 'change', 'value': _(u'Change')} )
-buttons.append( {'name': 'change_and_edit', 'value': _(u'Change and Edit')} )
-buttons.append( {'name': 'change_and_view', 'value': _(u'Change and View')} )
-
-options['form'] = { 'action': target,
-                    'listButtonInfos': tuple(buttons) }
-
-return context.full_metadata_edit_template(**decode(options, script))

Deleted: CMF/branches/2.0/CMFDefault/skins/zpt_content/full_metadata_edit_template.pt
===================================================================
--- CMF/branches/2.0/CMFDefault/skins/zpt_content/full_metadata_edit_template.pt	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CMFDefault/skins/zpt_content/full_metadata_edit_template.pt	2006-03-12 20:45:16 UTC (rev 65928)
@@ -1,125 +0,0 @@
-<html metal:use-macro="context/main_template/macros/master">
-<body>
-
-<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
-<h1 i18n:translate="">Resource Metadata: <tal:span
-    tal:content="options/title" i18n:name="obj_title">Title</tal:span></h1>
-</metal:slot>
-
-<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
-   tal:define="form options/form">
-<div class="Desktop">
-
-<form action="metadata_edit_form" method="post"
-   tal:attributes="action form/action">
-<table class="FormLayout">
- <tr>
-  <th i18n:translate="">Enable Discussion?</th>
-  <td colspan="3">
-   <select name="allow_discussion">
-    <option value="default"
-       tal:attributes="selected python: options['allow_discussion'] is None"
-       i18n:translate="">Default</option>
-    <option value="off"
-       tal:attributes="selected python: options['allow_discussion'] is False"
-       i18n:translate="">Off</option>
-    <option value="on"
-       tal:attributes="selected python: options['allow_discussion'] is True"
-       i18n:translate="">On</option>
-   </select>
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Identifier</th>
-  <td colspan="3">
-   <tal:span tal:content="options/identifier" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Title</th>
-  <td colspan="3">
-   <input type="text" name="title" value="" size="80"
-      tal:attributes="value options/title" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Description</th>
-  <td colspan="3">
-   <textarea name="description:text" rows="3" cols="80" wrap="soft"
-      tal:content="options/description"></textarea>
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Subject</th>
-  <td tal:define="subj_lines python: '\n'.join(options['extra_subjects'])">
-   <textarea name="subject:lines" rows="3" cols="31"
-      tal:content="subj_lines"></textarea>
-   <br />
-   <select name="subject:list" multiple>
-    <option value=""
-       tal:repeat="subject options/allowed_subjects"
-       tal:attributes="value subject;
-                       selected python: subject in options['subject']"
-       tal:content="subject">
-    </option>
-   </select>
-  </td>
-  <th i18n:translate="">Contributors</th>
-  <td tal:define="contrib_lines python: '\n'.join(options['contributors'])">
-   <textarea name="contributors:lines" rows="5" cols="31"
-      tal:content="contrib_lines"></textarea>
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Creation Date</th>
-  <td tal:content="context/CreationDate"></td>
-  <th i18n:translate="">Last Modified Date</th>
-  <td tal:content="context/ModificationDate"></td>
- </tr>
- <tr>
-  <th i18n:translate="">Effective Date</th>
-  <td>
-   <input type="text" name="effective_date" value=""
-      tal:attributes="value context/EffectiveDate" />
-  </td>
-  <th i18n:translate="">Expiration Date</th>
-  <td>
-   <input type="text" name="expiration_date" value=""
-      tal:attributes="value context/ExpirationDate" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Format</th>
-  <td colspan="3">
-   <input type="text" name="format" value=""
-      tal:attributes="value options/format" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Language</th>
-  <td colspan="3">
-   <input type="text" name="language" value=""
-      tal:attributes="value options/language" />
-  </td>
- </tr>
- <tr>
-  <th i18n:translate="">Rights</th>
-  <td colspan="3">
-   <input type="text" name="rights" value=""
-      tal:attributes="value options/rights" />
-  </td>
- </tr>
- <tr>
-  <td>&nbsp;</td>
-  <td colspan="3">
-   <metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
-  </td>
- </tr>
-</table>
-</form>
-
-</div>
-</metal:slot>
-
-</body>
-</html>

Modified: CMF/branches/2.0/CMFDefault/skins/zpt_content/metadata_edit_form.py
===================================================================
--- CMF/branches/2.0/CMFDefault/skins/zpt_content/metadata_edit_form.py	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CMFDefault/skins/zpt_content/metadata_edit_form.py	2006-03-12 20:45:16 UTC (rev 65928)
@@ -40,6 +40,9 @@
 options['extra_subjects'] = tuple(extra_subjects)
 options['subject'] = tuple(subject)
 options['format'] = form.get('format', context.Format())
+options['contributors'] = form.get('contributors', context.Contributors())
+options['language'] = form.get('language', context.Language())
+options['rights'] = form.get('rights', context.Rights())
 
 buttons = []
 target = context.getActionInfo('object/metadata')['url']

Modified: CMF/branches/2.0/CMFDefault/skins/zpt_content/metadata_edit_template.pt
===================================================================
--- CMF/branches/2.0/CMFDefault/skins/zpt_content/metadata_edit_template.pt	2006-03-12 19:42:14 UTC (rev 65927)
+++ CMF/branches/2.0/CMFDefault/skins/zpt_content/metadata_edit_template.pt	2006-03-12 20:45:16 UTC (rev 65928)
@@ -2,7 +2,7 @@
 <body>
 
 <metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
-<h1 i18n:translate="">Standard Resource Metadata: <tal:span
+<h1 i18n:translate="">Resource Metadata: <tal:span
     tal:content="options/title" i18n:name="obj_title">Title</tal:span></h1>
 </metal:slot>
 
@@ -15,8 +15,8 @@
 <table class="FormLayout">
  <tr>
   <th i18n:translate="">Enable Discussion?</th>
-  <td>
-   <select name="allow_discussion" style="float: left">
+  <td colspan="3">
+   <select name="allow_discussion">
     <option value="default"
        tal:attributes="selected python: options['allow_discussion'] is None"
        i18n:translate="">Default</option>
@@ -27,28 +27,24 @@
        tal:attributes="selected python: options['allow_discussion'] is True"
        i18n:translate="">On</option>
    </select>
-   <a href="full_metadata_edit_form" style="float: right"
-      tal:attributes="href string:${context/absolute_url}/full_metadata_edit_form"
-      i18n:translate=""
-     >Edit all metadata</a>
   </td>
  </tr>
  <tr>
   <th i18n:translate="">Identifier</th>
-  <td>
+  <td colspan="3">
    <tal:span tal:content="options/identifier" />
   </td>
  </tr>
  <tr>
   <th i18n:translate="">Title</th>
-  <td>
+  <td colspan="3">
    <input type="text" name="title" value="" size="80"
       tal:attributes="value options/title" />
   </td>
  </tr>
  <tr>
   <th i18n:translate="">Description</th>
-  <td>
+  <td colspan="3">
    <textarea name="description:text" rows="3" cols="80" wrap="soft"
       tal:content="options/description"></textarea>
   </td>
@@ -68,17 +64,54 @@
     </option>
    </select>
   </td>
+  <th i18n:translate="">Contributors</th>
+  <td tal:define="contrib_lines python: '\n'.join(options['contributors'])">
+   <textarea name="contributors:lines" rows="5" cols="31"
+      tal:content="contrib_lines"></textarea>
+  </td>
  </tr>
  <tr>
+  <th i18n:translate="">Creation Date</th>
+  <td tal:content="context/CreationDate"></td>
+  <th i18n:translate="">Last Modified Date</th>
+  <td tal:content="context/ModificationDate"></td>
+ </tr>
+ <tr>
+  <th i18n:translate="">Effective Date</th>
+  <td>
+   <input type="text" name="effective_date" value=""
+      tal:attributes="value context/EffectiveDate" />
+  </td>
+  <th i18n:translate="">Expiration Date</th>
+  <td>
+   <input type="text" name="expiration_date" value=""
+      tal:attributes="value context/ExpirationDate" />
+  </td>
+ </tr>
+ <tr>
   <th i18n:translate="">Format</th>
-  <td>
+  <td colspan="3">
    <input type="text" name="format" value=""
       tal:attributes="value options/format" />
   </td>
  </tr>
  <tr>
+  <th i18n:translate="">Language</th>
+  <td colspan="3">
+   <input type="text" name="language" value=""
+      tal:attributes="value options/language" />
+  </td>
+ </tr>
+ <tr>
+  <th i18n:translate="">Rights</th>
+  <td colspan="3">
+   <input type="text" name="rights" value=""
+      tal:attributes="value options/rights" />
+  </td>
+ </tr>
+ <tr>
   <td>&nbsp;</td>
-  <td>
+  <td colspan="3">
    <metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
   </td>
  </tr>



More information about the CMF-checkins mailing list