[Zope-CMF] CMF-1.2 Plone and folders..

Timothy J F Gildersleeve tim@otcs-online.co.uk
Tue, 19 Mar 2002 06:00:19 -0000


Thanks Chris

I think I've got it sorted now.  I found that by putting a cmf document type
of index_html in the root of the CMF site, I can replace the start page
(pretty standard stuff really - not sure why I didnt try it before! - a
DTML-Document type didnt work, it has to be a CMF document.

For the other problem, I had to edit a template as you have suggested for
the first problem.  MY problem was that directories listed the documents,
but if you clicked on them it didnt open the document but again listed them
in folder_listing mode.  WHat I did was edit(create a copy in custom and
edit it) the /portal_skins/plone_forms/folder_listing to be as follows:
(this is without expanding macros)


<!-- presents a directory like listing of apache -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
      lang="en-US"
      metal:use-macro="here/portal_template/macros/master">
<body>
  <div metal:fill-slot="main"
       tal:define="DateTime python:modules['DateTime'].DateTime">
      <div tal:repeat="obj here/contentValues">
        <span tal:condition="obj/isPrincipiaFolderish | nothing">
              <img src="/misc_/OFSP/Folder_icon.gif" tal:attributes="src
obj/icon" /></span>
        <span tal:condition="obj/isPrincipiaFolderish | nothing">
        <font size=2><a href="#" tal:attributes="href
string:${obj/absolute_url}"
           tal:content="obj/title_or_id" /></font></span>
      </div>
      <div tal:repeat="obj here/contentValues">
        <span tal:condition="not: obj/isPrincipiaFolderish | nothing">
              <img src="/misc_/OFSP/Folder_icon.gif" tal:attributes="src
obj/icon" /></span>
        <span tal:condition="not: obj/isPrincipiaFolderish | nothing">
        <font size=2><a href="#" tal:attributes="href
string:${obj/absolute_url}"
           tal:content="obj/title_or_id" /></font> </span>
      </div>
      <div tal:condition="not: here/contentValues">
         There are currently no files in this directory. <br />
      </div>
  </div>
</body>
</html>


This version does several things.  First it puts the document type icon at
the front of the line.  Second it puts all the folders first then the other
file types.  Thirdly and most important, it allows you to open the document
by clicking on the file name.  Im sure that the last should happen anyway
but there was something wrong with the template before.  Im sure my solution
isnt pretty and certainly not very clean template language but I was
pleasesd to get it doing what I wanted after a quick look at the Zope Book
chapter on page templates.

Thanks

Tim