mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-03-04 07:48 am

[dw-free] http://bugs.dwscoalition.org/show_bug.cgi?id=507

[commit: http://hg.dwscoalition.org/dw-free/rev/fefa0f878db4]

http://bugs.dwscoalition.org/show_bug.cgi?id=507

Add table of contents to FAQ page.

Patch by [personal profile] rho.

Files modified:
  • htdocs/support/faq.bml
  • htdocs/support/faq.bml.text
--------------------------------------------------------------------------------
diff -r f7c3d534fa00 -r fefa0f878db4 htdocs/support/faq.bml
--- a/htdocs/support/faq.bml	Wed Mar 04 07:28:35 2009 +0000
+++ b/htdocs/support/faq.bml	Wed Mar 04 07:48:22 2009 +0000
@@ -68,13 +68,26 @@ body<=
         $faqq{$f->faqid} = $f;
     }
 
+    # insert a table of contents
+    $ret .= "<?h2 $ML{'.toc.title'} h2?>";
+    $ret .= "<ul>";
+    foreach my $faqcat ( sort { $faqcat{$a}->{catorder} <=>
+                                $faqcat{$b}->{catorder} } keys %faqcat )
+    {
+        next if $GET{cat} && $GET{cat} ne $faqcat;
+        $ret .= "<li><a href=#$faqcat>";
+        $ret .= LJ::ehtml( $faqcat{$faqcat}->{faqcatname} );
+        $ret .= "</a></li>\n";
+    }
+    $ret .= "</ul><hr>";
+
     foreach my $faqcat (sort { $faqcat{$a}->{'catorder'} <=>
                                    $faqcat{$b}->{'catorder'} } keys %faqcat)
     {
         next if $GET{'cat'} && $GET{'cat'} ne $faqcat;
         $ret .= "<?h2 ";
         $ret .= LJ::ehtml($faqcat{$faqcat}->{'faqcatname'});
-        $ret .= " (<a href='faqbrowse.bml?faqcat=$faqcat'>";
+        $ret .= " (<a href='faqbrowse.bml?faqcat=$faqcat' name='$faqcat'>";
         $ret .= $ML{'.view.all'};
         $ret .= "</a>) h2?>\n";
         $ret .= "<ul class='faqlist'>\n";
diff -r f7c3d534fa00 -r fefa0f878db4 htdocs/support/faq.bml.text
--- a/htdocs/support/faq.bml.text	Wed Mar 04 07:28:35 2009 +0000
+++ b/htdocs/support/faq.bml.text	Wed Mar 04 07:48:22 2009 +0000
@@ -9,5 +9,7 @@
 
 .faq.title=Frequently Asked Questions
 
+.toc.title=Available Categories
+
 .view.all=view all
 
--------------------------------------------------------------------------------