bjori           Tue Aug 14 17:51:13 2007 UTC

  Modified files:              
    /phd/themes/php     phpdotnet.php 
  Log:
  - The index page should also list its grandchildren
  - All "containers" (articles, chapters, sections, parts...) should list their 
childrens at the top
    with the exception of reference pages
  
  
http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.3&r2=1.4&diff_format=u
Index: phd/themes/php/phpdotnet.php
diff -u phd/themes/php/phpdotnet.php:1.3 phd/themes/php/phpdotnet.php:1.4
--- phd/themes/php/phpdotnet.php:1.3    Fri Aug 10 20:18:21 2007
+++ phd/themes/php/phpdotnet.php        Tue Aug 14 17:51:13 2007
@@ -1,5 +1,5 @@
 <?php
-/*  $Id: phpdotnet.php,v 1.3 2007/08/10 20:18:21 bjori Exp $ */
+/*  $Id: phpdotnet.php,v 1.4 2007/08/14 17:51:13 bjori Exp $ */
 
 class phpdotnet extends PhDHelper {
     protected $elementmap = array(
@@ -23,7 +23,7 @@
             'book'              => 'format_chunk',
             'part'              => 'format_chunk',
         ),
-        'book'                  => 'format_container_chunk',
+        'book'                  => 'format_root_chunk',
         'chapter'               => 'format_container_chunk',
         'colophon'              => 'format_chunk',
         'glossary'              => array(
@@ -157,27 +157,60 @@
     public function format_container_chunk($open, $name, $attrs) {
         $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]["id"];
         if ($open) {
-            return "<div>";
+            $content = "<div>";
+
+            if ($name != "reference") {
+                $chunks = PhDHelper::getChildren($id);
+                $content .= '<ul class="chunklist chunklist_'.$name.'">';
+                foreach($chunks as $chunkid => $junk) {
+                    $content .= sprintf('<li><a href="%s%s.%s">%s</a></li>', 
$this->chunked ? "" : "#", $chunkid, $this->ext, 
PhDHelper::getDescription($chunkid, true));
+                }
+                $content .= "</ul>\n";
+            }
+            return $content;
         }
-        $chunks = PhDHelper::getChildren($id);
+
         $content = "";
-        if (count($chunks) > 1) {
-            $content = '<ul class="chunklist chunklist_'.$name.'">';
-            if ($name == "reference") {
+        if ($name == "reference") {
+            $chunks = PhDHelper::getChildren($id);
+            if (count($chunks) > 1) {
+                $content = '<ul class="chunklist chunklist_reference>';
                 foreach($chunks as $chunkid => $junk) {
                     $content .= sprintf('<li><a href="%s%s.%s">%s</a> — 
%s</li>', $this->chunked ? "" : "#", $chunkid, $this->ext, 
PhDHelper::getDescription($chunkid, false), PhDHelper::getDescription($chunkid, 
true));
                 }
-            } else {
-                foreach($chunks as $chunkid => $junk) {
-                    $content .= sprintf('<li><a href="%s%s.%s">%s</a></li>', 
$this->chunked ? "" : "#", $chunkid, $this->ext, 
PhDHelper::getDescription($chunkid, true));
-                }
+                $content .= "</ul>\n";
             }
-            $content .= "</ul>\n";
         }
         $content .= "</div>\n";
         
         return $content;
     }
+    public function format_root_chunk($open, $name, $attrs) {
+        $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]["id"];
+        if ($open) {
+            return "<div>";
+        }
+
+        $chunks = PhDHelper::getChildren($id);
+        $content = '<ul class="chunklist chunklist_'.$name.'">';
+        foreach($chunks as $chunkid => $junk) {
+            $href = $this->chunked ? $chunkid .'.'. $this->ext : "#$chunkid";
+            $content .= sprintf('<li><a href="%s">%s</a>', $href, 
PhDHelper::getDescription($chunkid, true));
+            $children = PhDHelper::getChildren($chunkid);
+            if (count($children)) {
+                $content .= '<ul class="chunklist chunklist_'.$name.' 
chunklist_children">';
+                foreach(PhDHelper::getChildren($chunkid) as $childid => $junk) 
{
+                    $href = $this->chunked ? $childid .'.'. $this->ext : 
"#$childid";
+                    $content .= sprintf('<li><a href="%s">%s</a>', $href, 
PhDHelper::getDescription($childid, true));
+                }
+                $content .="</ul>";
+            }
+            $content .= "</li>";
+        }
+        $content .= "</ul>";
+
+        return $content;
+    }
 
     public function format_suppressed_tags($open, $name) {
         /* ignore it */

Reply via email to