[CMF-checkins] CVS: CMF/CMFDefault/skins/zpt_generic - getBatchItemInfos.py:1.1 index_html_categorized.pt:1.1 index_html_control.py:1.1 batch_widgets.pt:1.4 index_html.pt:1.9 zpt_stylesheet.css:1.11

Yvo Schubbe y.2004_ at wcm-solutions.de
Fri Jun 4 06:10:42 EDT 2004


Update of /cvs-repository/CMF/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv12813/CMFDefault/skins/zpt_generic

Modified Files:
	batch_widgets.pt index_html.pt zpt_stylesheet.css 
Added Files:
	getBatchItemInfos.py index_html_categorized.pt 
	index_html_control.py 
Log Message:
- copied the old index_html.py to index_html_categorized.py
- added new 'listing' widget and related getBatchItemInfos.py / css styles
- modified 'index_html' to show sub-objects in the selected order


=== Added File CMF/CMFDefault/skins/zpt_generic/getBatchItemInfos.py ===
## Script (Python) "getBatchItemInfos"
##parameters=batch_obj
##title=
##
from Products.CMFCore.utils import getToolByName

utool = getToolByName(script, 'portal_url')
portal_url = utool()

items = []

for item in batch_obj:
    item_description = item.Description()
    item_icon = item.getIcon(1)
    item_title = item.Title()
    item_type = remote_type = item.Type()
    if item_type == 'Favorite' and not item_icon == 'p_/broken':
        item = item.getObject()
        item_description = item_description or item.Description()
        item_title = item_title or item.Title()
        remote_type = item.Type()
    is_file = remote_type in ('File', 'Image')
    is_link = remote_type == 'Link'
    items.append( { 'description': item_description,
                    'format': is_file and item.Format() or '',
                    'icon': item_icon and
                            ( '%s/%s' % (portal_url, item_icon) ) or '',
                    'size': is_file and
                            '%0.0f kb' % ( item.get_size() / 1024.0 ) or '',
                    'title': item_title,
                    'type': item_type,
                    'url': is_link and item.getRemoteUrl() or
                            item.absolute_url() } )

return tuple(items)


=== Added File CMF/CMFDefault/skins/zpt_generic/index_html_categorized.pt ===
<html metal:use-macro="here/main_template/macros/master" >
<body style="position: relative">

<div metal:fill-slot="header"
     tal:define="global has_local python: 'local_pt' in here.objectIds();
                 global util_macros here/index_html_utils/macros;
                " >

  <div tal:condition="not: has_local">

     <div metal:use-macro="util_macros/index_header" />

  </div>

  <div tal:condition="has_local">

    <div metal:use-macro="here/local_pt/macros/header | default">
      'local_pt' header goes here.
    </div>

  </div>

</div><!-- header slot -->

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

  <div id="content_well"
       style="float: left; top: 0; width: 80%;">

    <div tal:condition="not: has_local">

      <br />

      <div metal:use-macro="util_macros/index_content" />
  
      <div metal:use-macro="util_macros/index_links" />

      <div metal:use-macro="util_macros/index_folders" />

    </div>

    <div tal:condition="has_local">

      <div metal:use-macro="here/local_pt/macros/body | default">
        'local_pt' body goes here.
      </div>

    </div>

  </div>

  <div id="right_sidebar"
       style="width: 20%">

    <div metal:use-macro="util_macros/news_box" />

  </div>

</div>

</body>
</html>


=== Added File CMF/CMFDefault/skins/zpt_generic/index_html_control.py ===
## Script (Python) "index_html_control"
##parameters=b_start=0
##title=
##
from ZTUtils import Batch

control = {}

key, reverse = context.getDefaultSorting()
items = context.listFolderContents()
items = sequence.sort( items, ((key, 'cmp', reverse and 'desc' or 'asc'),) )
batch_obj = Batch(items, 25, b_start, orphan=0)
listItemInfos = context.getBatchItemInfos(batch_obj)
target = context.getActionInfo('object/view')['url']
navigation = context.getBatchNavigation(batch_obj, target)
control['batch'] = { 'listItemInfos': listItemInfos,
                     'navigation': navigation }

return control


=== CMF/CMFDefault/skins/zpt_generic/batch_widgets.pt 1.3 => 1.4 ===
--- CMF/CMFDefault/skins/zpt_generic/batch_widgets.pt:1.3	Mon Feb  2 07:44:51 2004
+++ CMF/CMFDefault/skins/zpt_generic/batch_widgets.pt	Fri Jun  4 06:10:41 2004
@@ -1,4 +1,7 @@
 <html>
+<head>
+ <link rel="stylesheet" type="text/css" href="zpt_stylesheet.css">
+</head>
 <body>
 
 <tal:test tal:define="summary python: {'length': '9.999', 'type': 'items',
@@ -16,6 +19,34 @@
  ><p class="BatchSummary" tal:condition="not:batch/summary/length"
      i18n:translate="">There are no items matching your specified criteria.</p
 ></metal:block>
+
+
+<tal:test tal:define="items python: ( {'description': 'Description',
+                                       'format': 'application/pdf',
+                                       'icon': 'file_icon.gif',
+                                       'size': '99.9 kb', 'title': 'Title',
+                                       'type': 'File', 'url': '?'}, );
+                      global batch python: {'listItemInfos': items}" />
+
+ <metal:macro metal:define-macro="listing">
+ <p class="BatchListing" tal:repeat="item_info batch/listItemInfos"
+ ><a href="" tal:attributes="href item_info/url"
+  ><img src="" alt="" title="" border="0" width="16" height="16"
+      tal:attributes="src item_info/icon; alt item_info/type;
+                      title item_info/type"
+      i18n:attributes="alt; title" /></a
+ ><tal:case tal:condition="item_info/title">&nbsp;
+  <a href="" tal:attributes="href item_info/url"
+     tal:content="item_info/title">Title</a></tal:case
+ ><tal:case tal:condition="item_info/description">
+  <br /><tal:span tal:content="item_info/description"
+ >Description</tal:span></tal:case
+ ><tal:case tal:condition="item_info/format">
+  <br /><span><tal:span tal:content="item_info/format" i18n:translate=""
+  >format</tal:span><tal:case tal:condition="item_info/size"
+  >, <tal:span tal:content="item_info/size">99.9 KB</tal:span></tal:case
+ ></span></tal:case></p
+></metal:macro>
 
 
 <tal:test tal:define="previous python: {'length': '20', 'text': 'Previous',


=== CMF/CMFDefault/skins/zpt_generic/index_html.pt 1.8 => 1.9 ===
--- CMF/CMFDefault/skins/zpt_generic/index_html.pt:1.8	Thu Jul 25 10:48:46 2002
+++ CMF/CMFDefault/skins/zpt_generic/index_html.pt	Fri Jun  4 06:10:41 2004
@@ -1,62 +1,45 @@
-<html metal:use-macro="here/main_template/macros/master" >
-<body style="position: relative">
-
-<div metal:fill-slot="header"
-     tal:define="global has_local python: 'local_pt' in here.objectIds();
-                 global util_macros here/index_html_utils/macros;
-                " >
+<tal:page
+   xmlns:tal="http://xml.zope.org/namespaces/tal"
+   xmlns:metal="http://xml.zope.org/namespaces/metal"
+   tal:define="control python: here.index_html_control(**request.form);
+               has_local python: 'local_pt' in here.objectIds()"
+   tal:condition="control"
+><html metal:use-macro="here/main_template/macros/master">
+<body>
 
+<metal:slot metal:fill-slot="header">
   <div tal:condition="not: has_local">
-
-     <div metal:use-macro="util_macros/index_header" />
-
+<metal:macro metal:use-macro="here/index_html_utils/macros/index_header" />
   </div>
-
   <div tal:condition="has_local">
-
     <div metal:use-macro="here/local_pt/macros/header | default">
       'local_pt' header goes here.
     </div>
-
   </div>
+</metal:slot>
 
-</div><!-- header slot -->
-
-<div metal:fill-slot="main">
-
+<metal:slot metal:fill-slot="main" i18n:domain="cmf_default" tal:define="batch control/batch">
   <div id="content_well"
        style="float: left; top: 0; width: 80%;">
-
     <div tal:condition="not: has_local">
 
-      <br />
-
-      <div metal:use-macro="util_macros/index_content" />
-  
-      <div metal:use-macro="util_macros/index_links" />
-
-      <div metal:use-macro="util_macros/index_folders" />
+<metal:macro metal:use-macro="context/batch_widgets/macros/listing" />
+<metal:macro metal:use-macro="context/batch_widgets/macros/navigation" />
 
     </div>
-
     <div tal:condition="has_local">
-
       <div metal:use-macro="here/local_pt/macros/body | default">
         'local_pt' body goes here.
       </div>
-
     </div>
-
   </div>
-
   <div id="right_sidebar"
        style="width: 20%">
 
-    <div metal:use-macro="util_macros/news_box" />
+<metal:macro metal:use-macro="here/index_html_utils/macros/news_box" />
 
   </div>
-
-</div>
+</metal:slot>
 
 </body>
-</html>
+</html></tal:page>


=== CMF/CMFDefault/skins/zpt_generic/zpt_stylesheet.css 1.10 => 1.11 ===
--- CMF/CMFDefault/skins/zpt_generic/zpt_stylesheet.css:1.10	Thu Apr 15 09:42:59 2004
+++ CMF/CMFDefault/skins/zpt_generic/zpt_stylesheet.css	Fri Jun  4 06:10:41 2004
@@ -1,10 +1,8 @@
 body {
     background-color: White;
     color: Black;
-    margin-top: 0;
-    margin-left:2pt;
-    margin-right:2pt;
-    margin-bottom:0;
+    margin: 0;
+    padding: 0;
 }
 
 p {
@@ -205,8 +203,8 @@
 }
 
 #Desktop {
-    margin-left: 8pt;
-    margin-right: 8pt;
+    margin-left: 2pt;
+    margin-right: 2pt;
 }
 
 #ContentByline {
@@ -359,6 +357,20 @@
 
 p.NewsHeadline {
     background-color:  #336699;
+}
+
+.BatchListing {
+    text-indent: -25px;
+    margin: 7pt 0pt 1pt 25px;
+}
+
+.BatchListing img {
+    vertical-align: baseline;
+}
+
+.BatchListing span {
+    font: bold 8pt Verdana, sans-serif;
+    color: #aaaaaa;
 }
 
 .BatchTable {




More information about the CMF-checkins mailing list