[Home]SideMenu

UseModWiki | RecentChanges | Preferences

Description

The Side Menu allows for Left and/or Right areas of the page to be loaded with anything you want. Typically this will be your custom menus and thus suitable div styles have been created.

This also does a number of fixes on the Footers and tidies up the Goto Bar. They are all in here as they all need each other to work together.

How to use it

Set the parameters. For example
 $LeftColumnWidth = 150;
 $FullColumns = 1;

Create a page [.LeftColumn] and add menu items using <div> tags. Here is an example:

<div class='menuname'>Wiki Actions</div>
<div class=menuitem>RecentChanges</div>
<div class=menuitem><a href="wiki.pl?action=upload">Upload File</a></div>
<div class=menuitem><a href="wiki.pl?action=index">Site Map</a></div>

With Full Columns = 1 will make the menu bar travel from the top of the web page to the bottom. As the default the header and footer will be the full width of the window.

|------------|    |----|---------| 
|  Header    |    |Menu| Header  | 
|------------|    |Item|---------| 
|Menu|       |    |Item|         | 
|Item| Page  |    |    | Page    | 
|Item|       |    |    |         | 
|    |       |    |    |         | 
|------------|    |    |---------| 
|  Footer    |    |    | Footer  | 
|------------|    |----|---------| 

Goto Bar Changes

Footer Changes

--MarkButler


Comments

I haven't been able to get this mod to work. Did discover though that with the <TBODY> tags included in the code, the tag is used only by Microsoft IE and is not supported by World Wide Web Consortium (W3C) or Netscape. Hasn't worked on Mozilla Firebird either. (Looked at it through IE and it wasn't working on that browser either.) Could anyone provide insight how to get this mod working? Thanks in advance. -- AnitaB?

I just did this mod and it worked fine. Go through and make sure you're making the changes exactly. One thing: even with the preformatted text tag used on this page, the & l t ; and & g t ; entities used in the mod are being displayed as < and > (even using the nowiki tag doesn't stop this!) the line added in the GetRedirectPage sub should be copied from the textbox of the edit screen of this page, rather than what is displayed when you view it. -- Dan


The Mod

--- wiki.1.0.0.pl	Thu Sep 12 10:53:14 2002
+++ wikipatch.SideMenu.pl	Fri Jan 09 12:18:56 2004
@@ -44,12 +44,13 @@
   $ShowEdits $ThinLine $LinkPattern $InterLinkPattern $InterSitePattern
   $UrlProtocols $UrlPattern $ImageExtensions $RFCPattern $ISBNPattern
   $FS $FS1 $FS2 $FS3 $CookieName $SiteBase $StyleSheet $NotFoundPg
-  $FooterNote $EditNote $MaxPost $NewText $NotifyDefault $HttpCharset
+  $FooterNote $EditNote $MaxPost $NewText $NotifyDefault $HttpCharset $UseGotoBar
   $UserGotoBar $DeletedPage $ReplaceFile @ReplaceableFiles $TableSyntax
   $MetaKeywords $NamedAnchors $InterWikiMoniker $SiteDescription $RssLogoUrl
   $NumberDates $EarlyRules $LateRules $NewFS $KeepSize $SlashLinks $BGColor
   $UpperFirst $AdminBar $RepInterMap $DiffColor1 $DiffColor2 $ConfirmDel
   $MaskHosts $LockCrash $ConfigFile $HistoryEdit $OldThinLine 
+  @BorderPageList $LeftColumnWidth $RightColumnWidth $FullColumns
   @IsbnNames @IsbnPre @IsbnPost $EmailFile $FavIcon $RssDays $UserHeader
   $UserBody $StartUID $ParseParas $AuthorFooter $UseUpload $AllUpload
   $UploadDir $UploadUrl $LimitFileUrl $MaintTrimRc $SearchButton 
@@ -112,6 +113,10 @@
 $UploadDir   = '';              # Full path (like /foo/www/uploads) for files
 $UploadUrl   = '';              # Full URL (like http://foo.com/uploads)
 @ImageSites  = qw();            # Url prefixes of good image sites: ()=all
+$LeftColumnWidth = 0;           # Size in pixels of left column. 0 turns it off
+$RightColumnWidth= 0;           # Size in pixels of right column. 0 turns it off
+$FullColumns = 0;               # Left and Right columns run full height of window 
+$UseGotoBar = 0;                # Default preference state for goto bar 0 is off
 
 # Major options:
 $UseSubpage  = 1;           # 1 = use subpages,       0 = do not use subpages
@@ -321,6 +326,7 @@
   $RFCPattern = "RFC\\s?(\\d+)";
   $ISBNPattern = "ISBN:?([0-9- xX]{10,})";
   $UploadPattern = "upload:([^\\]\\s\"<>$FS]+)$QDelim";
+  @BorderPageList = ( ".LeftColumn", ".RightColumn" );
 }
 
 # Simple HTML cache
@@ -1083,6 +1089,36 @@
 }
 
 # ==== HTML and page-oriented functions ====
+sub leftColumn {
+  my $result = '';
+  if (($LeftColumnWidth != 0) || ($RightColumnWidth != 0)) {
+    $result .= qq(<TABLE cellpadding=0 cellspacing=0 border=0 width="100%" summary=""><TBODY><TR VALIGN="TOP">);
+    if ($LeftColumnWidth != 0) {
+      my $fileName = $PageDir."/other/.LeftColumn.db.wiki";
+      my ($status, $fileData) = &ReadFile($fileName);
+      my $wikiData = &WikiToHTML($fileData);
+      $result .= qq(<TD class='leftColumn' width=$LeftColumnWidth><div class='leftColumn'>$wikiData</div></TD>);
+    }
+    $result .= qq(<TD>);
+  }
+  return $result;
+}
+
+sub rightColumn {
+  my $result = '';
+  if (($LeftColumnWidth != 0) || ($RightColumnWidth != 0)) {
+    $result .= qq(</TD>);
+    if ($RightColumnWidth != 0) {
+      my $fileName = $PageDir."/other/.RightColumn.db.wiki";
+      my ($status, $fileData) = &ReadFile($fileName);
+      my $wikiData = &WikiToHTML($fileData);
+      $result .= qq(<TD class='rightColumn' width=$RightColumnWidth><div class='rightColumn'>$wikiData</div></TD>);
+    }
+    $result .= qq(</TR></TBODY></TABLE>);
+  }
+  return $result;
+}
+
 sub ScriptLinkChar {
   if ($SlashLinks) {
     return '/';
@@ -1294,6 +1330,7 @@
   $result .= &GetHtmlHeader("$SiteName: $title");
   return $result  if ($embed);
 
+  $result .= &leftColumn() if ($FullColumns);
   $result .= '<div class=wikiheader>';
   if ($oldId ne '') {
     $result .= $q->h3('(' . Ts('redirected from %s', 
@@ -1311,10 +1348,12 @@
   } else {
     $result .= $q->h1($header . $title);
   }
-  if (&GetParam("toplinkbar", 1)) {
+  if (&GetParam("toplinkbar", $UseGotoBar)) {
     $result .= &GetGotoBar($id) . "<hr class=wikilineheader>";
   }
   $result .= '</div>';
+  $result .= &leftColumn() if (!$FullColumns);
+  $result .= '<div class=mainPage>';
   return $result;
 }
 
@@ -1383,12 +1422,13 @@
   my ($id, $rev) = @_;
   my $result;
 
+  $result = '</div>';
   if (&GetParam('embed', $EmbedWiki)) {
-    return $q->end_html;
+    $result .= $q->end_html;
+    return $result;
   }
-  $result = '<div class=wikifooter>';
-  $result .= &GetFormStart();
-  $result .= &GetGotoBar($id);
+  $result .= &rightColumn() if (!$FullColumns);
+  $result .= '<hr class=wikilinefooter><div class=wikifooter>';
   if (&UserCanEdit($id, 0)) {
     if ($rev ne '') {
       $result .= &GetOldPageLink('edit',   $id, $rev,
@@ -1425,7 +1465,6 @@
   if ($UseDiff) {
     $result .= ' ' . &ScriptLinkDiff(4, $id, T('(diff)'), $rev);
   }
-  $result .= '<br>' . &GetSearchForm();
   if ($AdminBar && &UserIsAdmin()) {
     $result .= '<br>' . &GetAdminBar($id);
   }
@@ -1438,30 +1477,53 @@
     $result .= '<br><b>' . T('Config file error:') . '</b> '
                . $ConfigError . '<br>';
   }
-  $result .= $q->endform;
   if ($FooterNote ne '') {
     $result .= T($FooterNote);
   }
   $result .= '</div>';
-  $result .= &GetMinimumFooter();
+  $result .= &rightColumn() if ($FullColumns);
+  $result .= '<hr class=wikilinefooter><div class=wikifooter></div>';
+  $result .= $q->end_html;
   return $result;
 }
 
 sub GetCommonFooter {
   my ($html);
 
-  $html = '<hr class=wikilinefooter>' . '<div class=wikifooter>'
-          . &GetFormStart() . &GetGotoBar('')
-          . &GetSearchForm() . $q->endform;
+  $html .= '</div>';
+  if (&GetParam('embed', $EmbedWiki)) {
+    $html .= $q->end_html;
+    return $html;
+  }
+  $html .= &rightColumn() if (!$FullColumns);
+  $html .= '<hr class=wikilinefooter><div class=wikifooter> ';
   if ($FooterNote ne '') {
     $html .= T($FooterNote);
   }
-  $html .= '</div>' . $q->end_html;
+  $html .= '</div>';
+  $html .= &rightColumn() if ($FullColumns);
+  $html .= '<hr class=wikilinefooter><div class=wikifooter></div>';
+  $html .= $q->end_html;
   return $html;
 }
 
 sub GetMinimumFooter {
-  return $q->end_html;
+  my $result = "";
+  $result .= '</div>';
+  if (&GetParam('embed', $EmbedWiki)) {
+    $result .= $q->end_html;
+    return $result;
+  }
+  $result .= &rightColumn() if (!$FullColumns);
+  $result .= '<hr class=wikilinefooter><div class=wikifooter> ';
+  if ($FooterNote ne '') {
+    $result .= "<div class='footnote'>".T($FooterNote)."</div>";
+  }
+  $result .= "</div>";
+  $result .= &rightColumn() if ($FullColumns);
+  $result .= '<hr class=wikilinefooter><div class=wikifooter></div>';
+  $result .= $q->end_html;
+  return $result;
 }
 
 sub GetFormStart {
@@ -1490,20 +1552,21 @@
   if ($UserGotoBar ne '') {
     $bartext .= " | " . $UserGotoBar;
   }
-  $bartext .= "<br>\n";
+  $bartext .= " | " .&GetSearchForm();
   return $bartext;
 }
 
 sub GetSearchForm {
   my ($result);
 
-  $result = T('Search:') . ' ' . $q->textfield(-name=>'search', -size=>20);
   if ($SearchButton) {
+    $result = $q->textfield(-name=>'search', -size=>15);
     $result .= $q->submit('dosearch', T('Go!'));
   } else {  
+    $result = T('Search:') . ' ' . $q->textfield(-name=>'search', -size=>15);
     $result .= &GetHiddenValue("dosearch", 1);
   }
-  return $result;
+  return &GetFormStart() . $result . $q->endform;
 }
 
 sub GetRedirectPage {
@@ -1622,6 +1685,7 @@
       }
     } else {
       # Note that these tags are restricted to a single line
+      s/\<div(.*?)\>(.*?)\<\/div\>/<div$1>$2<\/div>/gi;
       s/\<b\>(.*?)\<\/b\>/<b>$1<\/b>/gi;
       s/\<i\>(.*?)\<\/i\>/<i>$1<\/i>/gi;
       s/\<strong\>(.*?)\<\/strong\>/<strong>$1<\/strong>/gi;
@@ -2605,6 +2669,11 @@
 sub ValidId {
   my ($id) = @_;
 
+  foreach my $pageName (@BorderPageList) {
+    if( $id eq $pageName ) {
+      return "";
+    }
+  }
   if (length($id) > 120) {
     return Ts('Page name is too long: %s', $id);
   }
@@ -3300,11 +3369,7 @@
     print "<h2>", T('Preview only, not yet saved'), "</h2>\n";
     print '</div>';
   }
-  print '<div class=wikifooter>';
-  print &GetHistoryLink($id, T('View other revisions')) . "<br>\n";
-  print &GetGotoBar($id);
   print $q->endform;
-  print '</div>';
   print &GetMinimumFooter();
 }
 
@@ -3396,7 +3461,7 @@
         T('Edit area rows:'), ' ', &GetFormText('editrows', 20, 4, 4),
         ' ', T('columns:'),   ' ', &GetFormText('editcols', 65, 4, 4);
 
-  print '<br>', &GetFormCheck('toplinkbar', 1,
+  print '<br>', &GetFormCheck('toplinkbar', $UseGotoBar,
                               T('Show link bar on top'));
   print '<br>', &GetFormCheck('linkrandom', 0,
                               T('Add "Random Page" link to link bar'));
@@ -3404,11 +3469,7 @@
         &GetFormText('stylesheet', "", 30, 150);
   print '<br>', $q->submit(-name=>'Save', -value=>T('Save')), "\n";
   print '</div>';
-  print "<hr class=wikilinefooter>\n";
-  print '<div class=wikifooter>';
-  print &GetGotoBar('');
   print $q->endform;
-  print '</div>';
   print &GetMinimumFooter();
 }
 
@@ -3627,8 +3688,6 @@
         $q->password_field(-name=>'p_password', -value=>'', 
                            -size=>15, -maxlength=>50);
   print '<br>', $q->submit(-name=>'Login', -value=>T('Login')), "\n";
-  print "<hr class=wikilinefooter>\n";
-  print &GetGotoBar('');
   print $q->endform;
   print &GetMinimumFooter();
 }
@@ -3659,9 +3718,6 @@
   } else {
     print Ts('Login for user ID %s failed.', $uid);
   }
-  print "<hr class=wikilinefooter>\n";
-  print &GetGotoBar('');
-  print $q->endform;
   print &GetMinimumFooter();
 }
 
@@ -3992,6 +4048,12 @@
   &SavePage();
   &WriteRcLog($id, $summary, $isEdit, $editTime, $Section{'revision'},
               $user, $Section{'host'});
+  foreach my $pageName (@BorderPageList) {
+    if( $id eq $pageName ) {
+      my $file = &GetPageFile($OpenPageName);
+      &WriteStringToFile($file.".wiki", $string);
+    }
+  }
   if ($UseCache) {
     &UnlinkHtmlCache($id);         # Old cached copy is invalid
     if ($Page{'revision'} < 2) {   # If this is a new page...
@@ -4419,8 +4481,6 @@
         "^123\\.21\\.3\\.\\d+\$<p>";
   print &GetTextArea('banlist', $banList, 12, 50);
   print "<br>", $q->submit(-name=>'Save'), "\n";
-  print "<hr class=wikilinefooter>\n";
-  print &GetGotoBar("");
   print $q->endform;
   print &GetMinimumFooter();
 }
@@ -4471,8 +4531,6 @@
   print $q->checkbox(-name=>"p_changetext", -override=>1, -checked=>1,
                       -label=>"Substitute text for rename");
   print "<br>", $q->submit(-name=>'Edit'), "\n";
-  print "<hr class=wikilinefooter>\n";
-  print &GetGotoBar("");
   print $q->endform;
   print &GetMinimumFooter();
 }

UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited November 5, 2023 4:41 pm by MarkusLude (diff)
Search: