home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / wiki / template / common.php < prev    next >
PHP Script  |  2004-03-08  |  5KB  |  188 lines

  1. <?php
  2. // $Id: common.php,v 1.2 2004/02/26 14:44:51 comsubvie Exp $
  3.  
  4. // This function generates the common prologue and header
  5. // for the various templates.
  6. //
  7. // Its parameters are passed as an associative array with the following
  8. // members:
  9. //
  10. //   'norobots' => An integer; if nonzero, robots will be forbidden to
  11. //                 index the page or follow links from the page.
  12. //   'title'    => A string containing the page title.  This function
  13. //                 will append ' - WikiName' to the title.
  14. //   'heading'  => A string containing the page's heading.
  15. //   'headlink' => A string.  If not empty, it will be appended to the
  16. //                 page's heading as a link to find the contents of the
  17. //                 string in the database.
  18. //   'headsufx' => A string containing the heading suffix.  If not
  19. //                 empty, it will be printed after the heading link.
  20. //   'toolbar'  => An integer; if nonzero, the toolbar will be displayed.
  21.  
  22. function template_common_prologue($args)
  23. {
  24.   global $WikiName, $HomePage, $WikiLogo, $MetaKeywords, $MetaDescription;
  25.   global $StyleScript, $SeparateTitleWords, $SeparateHeaderWords;
  26.  
  27.   $keywords = ' ' . html_split_name($args['headlink']);
  28.   $keywords = str_replace('"', '"', $keywords);
  29.  
  30.   preg_match("/^(.*)\//", $args['headlink'], $path); // Find startpath of page
  31.   ob_start();                           // Start buffering output.
  32.  
  33.   if($SeparateTitleWords)
  34.     { $args['title'] = html_split_name($args['title']); }
  35. ?>
  36. <!DOCTYPE html
  37.           PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  38.           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  39. <html   xmlns   = "http://www.w3.org/1999/xhtml">
  40. <head>
  41. <meta name="KEYWORDS" content="<?php print $MetaKeywords . $keywords; ?>" />
  42. <meta name="DESCRIPTION" content="<?php print $MetaDescription; ?>" />
  43. <?php
  44.   if($args['norobots'])
  45.   {
  46. ?>
  47. <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
  48. <?php
  49.   }
  50. ?>
  51. <link rel="STYLESHEET" href="<?php print $StyleScript; ?>" type="text/css" />
  52. <title><?php print $args['title'] . ' - ' . $WikiName; ?></title>
  53. </head>
  54. <body>
  55. <div id="header">
  56.   <div class="logo">
  57.   <a href="<?php print viewURL($HomePage); ?>"><img
  58.     src="<?php print $WikiLogo; ?>" alt="[Home]" /></a>
  59.   </div>
  60.   <h1>
  61. <?php
  62.     print $args['heading'];
  63.     if($args['headlink'] != '')
  64.     {
  65. ?>
  66.     <a class="title" href="<?php print findURL($args['headlink']); ?>">
  67. <?php
  68.     if($SeparateHeaderWords)
  69.       { print html_split_name($args['headlink']); }
  70.     else
  71.       { print $args['headlink']; }
  72. ?></a>
  73. <?php
  74.     }
  75.     print $args['headsufx'];
  76. ?>
  77.   </h1>
  78.   <div id="toolbar-top">
  79. <?php
  80.   if($args['toolbar'])
  81.   {
  82.     if ( isset( $path[1] ) )
  83.     {
  84.       print html_toolbar_top($path[1]);
  85.     } else {
  86.       print html_toolbar_top("");
  87.     }
  88.   }
  89. ?>
  90.  
  91. </div>
  92. <hr />
  93. </div>
  94. <?php
  95. }
  96.  
  97. // This function generates the common prologue and header
  98. // for the various templates.
  99. //
  100. // Its parameters are passed as an associative array with the following
  101. // members:
  102. //
  103. //   'twin'      => A string containing the page's name; if not empty,
  104. //                  twin pages will be sought and printed.
  105. //   'edit'      => A string containing the page's name; if not empty,
  106. //                  an edit link will be printed.
  107. //   'editver'   => An integer containing the page's version; if not
  108. //                  zero, the edit link will be directed at the given
  109. //                  version.  If it is -1, the page cannot be edited,
  110. //                  and a message to that effect will be printed.
  111. //   'history'   => A string containing the page's name; if not empty,
  112. //                  a history link will be printed.
  113. //   'timestamp' => Timestamp for the page.  If not empty, a 'document
  114. //                  last modified' note will be printed.
  115. //   'nosearch'  => An integer; if nonzero, the search form will not appear.
  116.  
  117. function template_common_epilogue($args)
  118. {
  119.   global $FindScript, $pagestore;
  120.  
  121. ?>
  122. <div id="footer">
  123. <hr />
  124. <div id="toolbar-bottom">
  125. <?php
  126.   if($args['edit'])
  127.   {
  128.     if($args['editver'] == 0)
  129.     {
  130.       echo '<a href="'. editUrl($args['edit']) . '">'.TMPL_EditDocument.'</a>'; 
  131.     }
  132.     else if($args['editver'] == -1)
  133.     {
  134.       echo TMPL_NoEditDocument;
  135.     }
  136.     else
  137.     {
  138.       echo '<a href="' . editUrl($args['edit'], $args['editver']) . '">'.
  139.            TMPL_EditArchiveVersion . '</a>';
  140.     }
  141.  
  142.     if($args['history'])
  143.       { print ' | '; }
  144.   }
  145.   if($args['history'])
  146.   {
  147.     echo '<a href="'. historyURL($args['history']). '">'.
  148.          TMPL_ViewDocHistory . '</a><br />';
  149.   }
  150.   if($args['timestamp'])
  151.   {
  152.     echo "\n</div>\n". TMPL_DocLastModified . ' '. 
  153.          html_time($args['timestamp']) . '<br />';
  154.   }
  155.   if($args['twin'] != '')
  156.   {
  157.     if(count($twin = $pagestore->twinpages($args['twin'])))
  158.     {
  159.       echo TMPL_TwinPages . ' ';
  160.       for($i = 0; $i < count($twin); $i++)
  161.         { print html_twin($twin[$i][0], $twin[$i][1]) . ' <br />'; } 
  162.     }
  163.   }
  164.   if(!$args['nosearch'])
  165.   {
  166. ?>
  167. <form method="get" action="<?php print $FindScript; ?>">
  168. <div class="form">
  169.   <input type="hidden" name="action" value="find" />
  170.   <?php print TMPL_Search; ?> <input type="text" name="find" size="20" />
  171. </div>
  172. </form>
  173. <?php
  174.   }
  175. ?>
  176. </div>
  177. <!-- Commented out since this is done via Group-Office framework
  178. </body>
  179. </html>
  180. -->
  181. <?php
  182. // Following three lines are commented out since this is done via Group-Office framework
  183. //  $size = ob_get_length();
  184. //  header("Content-Length: $size");
  185. //  ob_end_flush();
  186. }
  187. ?>
  188.