Submitted by : 127.0.0.1 at: 2005-01-02T19:07:52+00:00 (13 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

Request for a feature that lists all pages that are not yet created (but have links to them). Most wiki engines seem to have this - very important for collaborative sites where members should see which pages need to be written.


comments:

did something like this --stefan rank, Mon, 03 Jan 2005 00:51:11 -0800 reply
hi did something like this recently, and although I think it needs work and that there maybe should be a no-dtml version of it, I'll attach the darcs-patch to this page.

I have two dtml pages that go with it, one that shows all links in the wiki (external and internal, existing or not) and the pages that contain them. And the other version is more like wanted pages, showing only the not yet created pages.

The source I use (in RestructuredText) follows.

AllWikiLinks?:

  This should display a table of all links in this wiki, if there are existing pages or not,
  including external links, next to the pages in which they occur. Kind of an Index actually.

  .. raw:: html

     <dtml-let pages=pages 
             map=linkindexmapping>

     <table border="0" cellspacing="0" cellpadding="0">
     <tr><td>Pages:</td><td><dtml-var "_.len(pages)"></td></tr>
     </table>
     <br />
     <table border="0" cellspacing="0" cellpadding="0">
     <tr><td><b>Link:</b></td><td><b>occurs in these pages</b></td></tr>

     <dtml-in expr="map.items()" sort=sequence-key>
     <tr <dtml-if sequence-even>bgcolor="#EEEEEE"</dtml-if> >
       <td>
         <dtml-let pagename=sequence-key>
         <dtml-if expr="pageWithNameOrId(pagename)">
           <a href="<dtml-var sequence-key>"><dtml-var sequence-key></a><br />
         <dtml-else>
           <dtml-var sequence-key>
         </dtml-if> 
         </dtml-let>
       </td>
       <td>
       <dtml-in sequence-item>
         <a href="<dtml-var sequence-item>"><dtml-var sequence-item></a><br />
       </dtml-in>
       </td>     
     </tr>   
     </dtml-in>

     </table>

     </dtml-let> 

and WaitingWikiLinks?:

  This should display a table of all wiki links, which do not correspond to an existing page, next to the pages in which
  they occur.

  .. raw:: html

     <dtml-let map=waitinglinkindexmapping>

     <table border="0" cellspacing="0" cellpadding="0">
     <tr><td><b>Link:</b></td><td><b>occurs in these pages</b></td></tr>

     <dtml-in expr="map.items()" sort=sequence-key>
     <tr <dtml-if sequence-even>bgcolor="#EEEEEE"</dtml-if> >
       <td>
         <dtml-var sequence-key>
       </td>
       <td>
       <dtml-in sequence-item>
         <a href="<dtml-var sequence-item>"><dtml-var sequence-item></a><br />
       </dtml-in>
       </td>     
     </tr>   
     </dtml-in>

     </table>

     </dtml-let> 

waitingwikilinks.patch

Could be done without patching ... --Dmitry Astapov, Fri, 14 Jan 2005 02:04:57 -0800 reply
I did it this way:

  .. raw:: html

    <h2>Stray links catalogue</h2>

    <table border=1>
    <th>Page</th><th>Stray links</th>

    <dtml-in pages sort=id prefix=p>

    <dtml-let page_links="p_sequence_item.links()">

    <dtml-call "REQUEST.set('strayLinks',[])">
    <dtml-in "[x[0] for x in _.reorder(page_links)]" prefix=x>
      <dtml-try>
       <dtml-let page="folder()[x_sequence_item.translate(_.string.maketrans('',''),'[]')]">
       </dtml-let>
      <dtml-except>
        <dtml-if "not x_sequence_item.startswith('http://')">
          <dtml-call "strayLinks.append(x_sequence_item)">
        </dtml-if>
      </dtml-try>
    </dtml-in>

    <dtml-if "strayLinks!=[]">
    <tr>
      <td><dtml-var "wikilink('['+p_sequence_item.title_or_id()+']')"></td>
      <td><dtml-var "', '.join(strayLinks)"></td>
    </tr>

  </dtml-if>

  </dtml-let>

  </dtml-in>
  </table>