In your theme Python code, add:

    def footer(self, d, **keywords):
        page = d['page']
        parts = [
            self.endPage(),
            self.emit_custom_html(self.cfg.page_footer1),
            u'<div class="footer">',
            self.pageinfo(page),
            self.comments(d), # ADD THIS LINE
            u'</div>',
            self.emit_custom_html(self.cfg.page_footer2),
            etc...

    etc...


    def comments(self, d):
        page = d['page']
        if not self.request.user.may.read(page.page_name):
            return u""
        
        comment_html = self._format("<<Comments>>")
        add_comment_html = self._format("<<AddComment>>")

        return u'''
        <div style="text-align: left">

          <!-- code to hide/show the new comment form -->
          <script type="text/javascript">
          function toggle_footer_comments_block () {
            var tb = document.getElementById('footer_comments_block');
            var tbl = document.getElementById('footer_comments_block_link');
            if (tb == null) return;
            if (tb.style.display) {
              tb.style.display = '';
              tbl.innerHTML = "(Hide)";
            }
            else {
              tb.style.display = 'none';
              tbl.innerHTML = "(Add comment)";
            }
          }
          </script>

          <!-- existing comments -->
          <i>'''+ comment_html +'''</i>


          <!-- hide/show link -->
          <small>
            <a id="footer_comments_block_link"
               href="javascript:toggle_footer_comments_block()">(Add comment)</a>
          </small>

          <!-- new comment form -->
          <span id="footer_comments_block">
            <script type="text/javascript">toggle_footer_comments_block()</script>
            '''+ add_comment_html +''' &nbsp;Thank you. Your comment will await moderation.
          </span>

        </div>
        '''

MoinMoin: MacroMarket/MoinComments/IntegratingIntoTheTheme (last edited 2009-10-06 05:55:03 by PascalBauermeister)