[z3-checkins] r17855 - z3/Five/branch/castle-marker-utility/utilities/browser

gotcha at codespeak.net gotcha at codespeak.net
Sun Sep 25 16:07:43 CEST 2005


Author: gotcha
Date: Sun Sep 25 16:07:42 2005
New Revision: 17855

Added:
   z3/Five/branch/castle-marker-utility/utilities/browser/
   z3/Five/branch/castle-marker-utility/utilities/browser/__init__.py
   z3/Five/branch/castle-marker-utility/utilities/browser/edit_marker.pt
   z3/Five/branch/castle-marker-utility/utilities/browser/markerview.py
Log:
checkin for whit

Added: z3/Five/branch/castle-marker-utility/utilities/browser/__init__.py
==============================================================================

Added: z3/Five/branch/castle-marker-utility/utilities/browser/edit_marker.pt
==============================================================================
--- (empty file)
+++ z3/Five/branch/castle-marker-utility/utilities/browser/edit_marker.pt	Sun Sep 25 16:07:42 2005
@@ -0,0 +1,179 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
+      lang="en"
+      metal:use-macro="context/main_template/macros/master"
+      i18n:domain="plone">
+
+  <head><title></title></head>
+  <body>
+    <div metal:fill-slot="main"
+         tal:define="errors options/state/getErrors">
+
+      <h1 i18n:translate="heading_edit_marker">
+        Edit Marker Interfaces
+      </h1>
+
+      <p i18n:translate="description_edit_marker">
+        A marker interface is used to identify an instance of a piece of content.
+        When in conjunction with Five, this allows you to enable and disable
+        views based on marker interfaces for example.
+      </p>
+
+      <form name="edit_form"
+            action="."
+            method="post"
+            enctype="multipart/form-data"
+            tal:attributes="action string:${context/getId}/${template/getId}"
+            tal:define="iface_tool iface_tool|portal/portal_interface|nothing;
+provided python:iface_tool.getDirectlyProvidedNames(context);
+                              available python:iface_tool.getMarkerInterfaceNames(context);
+                              impl python:iface_tool.getProvidedNames(context)"
+            tal:condition="iface_tool">
+
+        <fieldset>
+
+          <legend i18n:translate="legend_edit_marker">Marker Interfaces</legend>
+
+          <div tal:define="error errors/error|nothing"
+               tal:condition="error"
+               class="field error"
+               tal:content="error">Validation error output</div>
+
+          <div class="field"
+               tal:condition="provided"
+               tal:define="error errors/add | nothing;
+                           remove python:request.get('remove', ());"
+               tal:attributes="class python:test(error, 'field error', 'field')">
+
+            <label for="id" i18n:translate="label_marker_provided">Remove Interfaces</label>
+
+            <div class="formHelp" i18n:translate="help_marker_provided">
+              If you want, you can remove some interfaces from
+              the list of interfaces directly provided by your object.
+            </div>
+
+            <div tal:content="error">Validation error output</div>
+
+
+            <tal:block tal:repeat="iface provided">
+
+              <input type="checkbox"
+                     id="iface-name"
+                     name="remove:list"
+                     value=""
+                     size="40"
+                     tabindex=""
+                     tal:attributes="value iface;
+                                     id iface;
+                                     tabindex tabindex/next;
+                                     checked python:iface in remove and 'checked'"
+                     />
+
+              <label for=""
+                     i18n:translate=""
+                     tal:attributes="for iface"
+                     tal:content="iface" />
+
+              [<a href=""
+                   tal:attributes="href string:${here_url}/view_details?iface=${iface}&type=zope.publisher.interfaces.browser.IBrowserRequest">
+                  Views
+              </a>]
+
+              <br />
+
+            </tal:block>
+          </div>
+
+          <div class="field"
+               tal:define="error errors/add | nothing;
+                           add python:request.get('add', ());"
+               tal:attributes="class python:test(error, 'field error', 'field')">
+
+
+            <label for="id" i18n:translate="label_marker_add">Add Interfaces</label>
+
+            <div class="formHelp" i18n:translate="help_marker_add">
+              You can choose one or more interfaces to be added to
+              the list of provided interfaces for this object.
+            </div>
+
+            <div tal:content="error">Validation error output</div>
+
+
+            <tal:block tal:repeat="iface available">
+
+              <input type="checkbox"
+                     id="iface-name"
+                     name="add:list"
+                     value=""
+                     size="40"
+                     tabindex=""
+                     tal:attributes="value iface;
+                                     id iface;
+                                     tabindex tabindex/next;
+                                     checked python:iface in add and 'checked'"
+                     />
+
+              <label for=""
+                     i18n:translate=""
+                     tal:attributes="for iface"
+                     tal:content="iface"
+                     />
+
+              [<a href=""
+                   tal:attributes="href string:${context/absolute_url}/view_details?iface=${iface}&type=zope.publisher.interfaces.browser.IBrowserRequest">
+                  Views
+              </a>]
+
+              <br />
+
+            </tal:block>
+          </div>
+
+          <div class="formControls">
+            <input class="context"
+                   tabindex=""
+                   type="submit"
+                   name="form.button.Save"
+                   value="Save"
+                   i18n:attributes="value"
+                   tal:attributes="tabindex tabindex/next;"
+                   />
+          </div>
+
+          <input type="hidden" name="form.submitted" value="1" />
+
+        </fieldset>
+<fieldset>
+  <legend i18n:translate="legend_marker_additional">Additional Info</legend>
+          <div class="field"
+               tal:condition="impl">
+
+            <label for="id" i18n:translate="label_marker_implemented">Implemented Interfaces</label>
+
+            <div class="formHelp" i18n:translate="help_marker_implemented">
+              Those are the interfaces this object provides, either
+              directly or through its base classes.
+            </div>
+
+            <tal:block tal:repeat="iface impl">
+
+              <label for=""
+                     i18n:translate=""
+                     tal:attributes="for iface"
+                     tal:content="iface" />
+
+              [<a href=""
+                   tal:attributes="href string:${context/absolute_url}/view_details?iface=${iface}&type=zope.publisher.interfaces.browser.IBrowserRequest">
+                  Views
+              </a>]
+
+              <br />
+
+            </tal:block>
+          </div>
+
+</fieldset>
+      </form>
+    </div>
+  </body>
+</html>

Added: z3/Five/branch/castle-marker-utility/utilities/browser/markerview.py
==============================================================================
--- (empty file)
+++ z3/Five/branch/castle-marker-utility/utilities/browser/markerview.py	Sun Sep 25 16:07:42 2005
@@ -0,0 +1,15 @@
+from zope.interface import implements
+from Products.Five.browser import BrowserView
+from zope.app import zapi
+
+from Products.Five.utilities.interfaces import IMarkerUtility
+
+class MarkerView(BrowserView):
+    
+    def __init__(self, context, view):
+        BrowserView.__init__(self, context, view)
+        self.utility = zapi.getUtility(IMarkerUtility)
+
+    def getAvailableInterfaceNames(self):
+        
+    


More information about the z3-checkins mailing list