ListBox_ThreadAsHTML.zpt 5.76 KB
<tal:block
  xmlns:tal="http://xml.zope.org/namespaces/tal"
  xmlns:metal="http://xml.zope.org/namespaces/metal"
  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
  tal:define="field_id here/getId;
              form_id python: here.getForm().id;
              selection_name here/getSelectionName;
              selection here/getSelection;
              portal_url_string here/getPortalUrlString;
              real_context here/getContext;
              context_url real_context/absolute_url;
              md5_string here/getMD5Checksum;
              hide_rows_on_no_search_criterion here/isHideRowsOnNoSearchCriterion;
              line_list here/query;
              is_domain_tree_mode here/isDomainTreeMode;
              is_report_tree_mode here/isReportTreeMode;
              is_domain_tree_supported here/isDomainTreeSupported;
              is_report_tree_supported here/isReportTreeSupported;
              show_select_column here/showSelectColumn;
              show_anchor_column here/showAnchorColumn;
              show_search_line here/showSearchLine;
              is_web_mode request/is_web_mode | nothing;
              is_dialog_mode request/dialog_mode | nothing;
              list_style python:request.get('list_style', 
                selection.getParams().get('list_style', is_web_mode and 'table' or None));
              is_gadget_mode request/is_gadget_mode | nothing;
              ">
  <!-- ListBox starts here.  -->
  <input type="hidden" name="list_selection_name" value="default" tal:attributes="value selection_name" />
  <input type="hidden" name="list_selection_name" value="default"
                       tal:attributes="value selection_name;
                                       name string:${field_id}_list_selection_name" />
  <input tal:condition="md5_string" type="hidden" name="md5_object_uid_list" value="checksum" tal:attributes="value md5_string" />

  <tal:block tal:condition="is_gadget_mode">
    <tal:block tal:define="global box_relative_url python: request.get('box_relative_url', '');
               global box python: real_context.restrictedTraverse(box_relative_url); 
               global box_id python: 'visual_%s' %box_relative_url.split('/')[-1];
               global dom_id python: request.get('dom_id',None) or box_id;">
      <input tal:condition="python:form_id" 
            type="hidden" name="gadget_form_id"
            tal:attributes="value form_id" />
    </tal:block>
  </tal:block>
  <tal:replace tal:content="nothing">
    Because TAL cannot accept unbalanced tags, the support for a domain tree is realized by a macro.
    The macro ListBoxContainer is a no-op, if not in domain tree mode. Otherwise, the macro constructs
    a domain tree and extracts the body in an extra table.
  </tal:replace> 
  <tal:block tal:define="expand python: 0">
    <tal:block metal:define-macro="ListBoxContainer">
      <tal:block tal:condition="expand">
        <tal:block tal:condition="not: is_domain_tree_mode">
      <tal:block metal:define-slot="ListBoxBody" />
    </tal:block>
  </tal:block></tal:block></tal:block>
  <tal:block tal:define="expand python: 1">
    <tal:block metal:use-macro="template/macros/ListBoxContainer">
      <tal:block metal:fill-slot="ListBoxBody">
        <div class="ListContent" style="margin-bottom:5px;">
          <tal:block tal:repeat="line line_list">
            <div tal:define="post line/getBrain;">
              <div style="margin:5px; padding:10px; background-color:#ffffff; border-radius: 15px 15px; -moz-border-radius: 10px;"
                   tal:define="post line/getBrain;">
                <div style="background-color:#efefef; padding:3px;  height:20px; border-left:solid 3px #DE9435">
                  <div style="float:left; height:20px;">
                   <a tal:attributes="href post/getId">
                     <span style="margin:0; color #D98135; padding-left:5px; font:bold 1.2em Helvetica, Arial, sans-serif; margin-top:5px" tal:content="post/getTitle">
                     </span>
                   </a>
                  </div>
                 <div style="float:right; height:20px;">
                   <span style="color:#333; font-size:90%; margin:2px 0;"> by 
                    <a href="#">
                     <span style="color:#a40;font-size:90%;" tal:content="python: post.getSourceValue() is not None and post.getSourceValue().getTitle() or 'User Unknown'">
                     </span>
                    </a> on <span tal:replace="post/getCreationDate"></span></span>
                 </div>
               </div>
               <hr>
               <div style="margin-left:10px;">
                <span style="color:black;margin-top:10px;margin-bottom:10px;" tal:content="structure python:post.getTextContent()">
                </span><br />
               </div>
               <hr>
                 <div style="margin-left:10px;"><span style="color:#aaa">For signature</span></div>
               <hr>   
                 <button type="submit" title="Reply" 
                              name="DiscussionThreadModule_viewAddReplyDialog:method"
                              style="border:dashed 1px #3D6474; background-color:#eee; padding:3px;">   
                   <span>Reply</span>
                 </button>
               </div>
             </div>
           </tal:block>
        </div>
      </tal:block>
    </tal:block>
  </tal:block>
  <tal:block tal:condition="python: list_style == 'search'">
    <span metal:use-macro="real_context/ListBox_asSearchStyleHTML/macros/main"/>
  </tal:block>
  <tal:block tal:condition="python: list_style == 'table'">
    <span metal:use-macro="real_context/ListBox_asTableStyleHTML/macros/main"/>
  </tal:block>
  <tal:block tal:condition="python: list_style not in ('search', 'table')">
    <span metal:use-macro="real_context/ListBox_asStandardHTML/macros/main"/>
  </tal:block>

</tal:block>