[CMF-checkins] CVS: Products/CMFDefault/skins/zpt_generic - index_html.py:1.1 index_html_template.pt:1.1 search.py:1.1 search_results_template.pt:1.1 index_html.pt:NONE index_html_control.py:NONE search.pt:NONE search_results_control.py:NONE

Yvo Schubbe y.2004_ at wcm-solutions.de
Tue Jul 6 18:19:22 EDT 2004


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

Added Files:
	index_html.py index_html_template.pt search.py 
	search_results_template.pt 
Removed Files:
	index_html.pt index_html_control.py search.pt 
	search_results_control.py 
Log Message:
- renamed index_html.pt and search.pt to *_template.pt
- renamed *_control.py to index_html.py and search.py: these scripts are now called directly
- modified kw handling a bit to work with the new calling order


=== Added File Products/CMFDefault/skins/zpt_generic/index_html.py ===
##parameters=b_start=0
##
from ZTUtils import Batch

options = {}

options['has_local'] = 'local_pt' in context.objectIds()

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)
options['batch'] = { 'listItemInfos': listItemInfos,
                     'navigation': navigation }

return context.index_html_template(**options)


=== Added File Products/CMFDefault/skins/zpt_generic/index_html_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>

<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
  <div tal:condition="not: options/has_local">
<metal:macro metal:use-macro="context/index_html_utils/macros/index_header" />
  </div>
  <div tal:condition="options/has_local">
    <div metal:use-macro="context/local_pt/macros/header | default">
      'local_pt' header goes here.
    </div>
  </div>
</metal:slot>

<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
  tal:define="batch options/batch">
  <div id="content_well"
       style="float: left; top: 0; width: 80%;">
    <div tal:condition="not: options/has_local">

<metal:macro metal:use-macro="context/batch_widgets/macros/listing" />
<metal:macro metal:use-macro="context/batch_widgets/macros/navigation" />

    </div>
    <div tal:condition="options/has_local">
      <div metal:use-macro="context/local_pt/macros/body | default">
        'local_pt' body goes here.
      </div>
    </div>
  </div>
  <div id="right_sidebar"
       style="width: 20%">

<metal:macro metal:use-macro="context/index_html_utils/macros/news_box" />

  </div>
</metal:slot>

</body>
</html>


=== Added File Products/CMFDefault/skins/zpt_generic/search.py ===
##parameters=b_start=0
##
from Products.PythonScripts.standard import thousands_commas
from ZTUtils import Batch
from Products.CMFCore.utils import getToolByName

ctool = getToolByName(script, 'portal_catalog')
utool = getToolByName(script, 'portal_url')
portal_url = utool()
epoch = DateTime('1970/01/01 00:00:01 GMT')


options = {}

target = '%s/search' % portal_url
kw = context.REQUEST.form.copy()
for k, v in kw.items():
    if k in ('review_state', 'Title', 'Subject', 'Description', 'portal_type',
             'listCreators'):
        if same_type(v, []):
            v = filter(None, v)
        if not v:
            del kw[k]
    elif k in ('created',):
        if v['query'] == epoch and v['range'] == 'min':
            del kw[k]
        else:
            # work around problems with DateTime in records
            kw[k] = v.copy()
    elif k in ('go', 'go.x', 'go.y', 'b_start'):
            del kw[k]
items = ctool.searchResults(kw)
batch_obj = Batch(items, 25, b_start, orphan=1)
length = batch_obj.sequence_length
summary = { 'length': length and thousands_commas(length) or '',
            'type': (length == 1) and 'item' or 'items',
            'match': kw.get('SearchableText') }
navigation = context.getBatchNavigation(batch_obj, target, **kw)
options['batch'] = { 'summary': summary,
                     'listItemBrains': batch_obj,
                     'navigation': navigation }

return context.search_results_template(**options)


=== Added File Products/CMFDefault/skins/zpt_generic/search_results_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>

<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Search Results</h1>
</metal:slot>

<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
   tal:define="batch options/batch">
<div class="Desktop">

<metal:macro metal:use-macro="context/batch_widgets/macros/summary" />
<table class="SearchResults" tal:condition="batch/listItemBrains">
 <thead>
  <tr>
   <td width="16">&nbsp;</td>
   <th i18n:translate="">Title</th>
   <th i18n:translate="">Type</th>
   <th i18n:translate="">Date</th>
  </tr>
 </thead>
 <tbody tal:repeat="item_brain batch/listItemBrains">
  <tr tal:define="objURL string:${item_brain/getURL}/view">
   <td><a href=""
     tal:condition="item_brain/getIcon|nothing"
         tal:attributes="href objURL"><img src="" border="0" alt="" title=""
             tal:define="alt item_brain/Type"
             tal:attributes="src item_brain/getIcon;
                             alt alt;
                             title alt" /></a></td>
   <td><a href=""
     tal:attributes="href objURL"><span
         tal:condition="item_brain/Title"
             tal:replace="item_brain/Title">Title</span><span
         tal:condition="not:item_brain/Title"
             tal:omit-tag=""
             i18n:translate="">(No title)</span></a></td>
   <td tal:content="item_brain/Type" i18n:translate="">Type</td>
   <td tal:content="item_brain/Date">Date</td>
  </tr>
  <tr>
   <td>&nbsp;</td>
   <td colspan="3"><em
     tal:condition="item_brain/Description"
         tal:content="item_brain/Description">Description</em><em
     tal:condition="not:item_brain/Description"
         i18n:translate="">(No description)</em></td>
  </tr>
 </tbody>
</table>
<metal:macro metal:use-macro="context/batch_widgets/macros/navigation" />

</div>
</metal:slot>

</body>
</html>

=== Removed File Products/CMFDefault/skins/zpt_generic/index_html.pt ===

=== Removed File Products/CMFDefault/skins/zpt_generic/index_html_control.py ===

=== Removed File Products/CMFDefault/skins/zpt_generic/search.pt ===

=== Removed File Products/CMFDefault/skins/zpt_generic/search_results_control.py ===



More information about the CMF-checkins mailing list