00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00022 class SShodorLayout extends SLayout
00023 {
00024
00035 public function msBuild ($page, $ms, $layout)
00036 {
00037 switch($ms)
00038 {
00039 case 'TopBar':
00040 return $this->layoutTopBar($page, $ms, $layout);
00041 case 'PathBar':
00042 return $this->layoutPathBar($page, $ms, $layout);
00043 case 'PageTitle':
00044 return $this->layoutPageTitle($page, $ms, $layout);
00045 case 'ContentWell':
00046 return $this->layoutContentWell($page, $ms, $layout);
00047 case 'BottomBar':
00048 return $this->layoutBottomBar($page, $ms, $layout);
00049 case 'TabsBar1':
00050 return $this->layoutTabsBar1($page, $ms, $layout);
00051 case 'TabsBar2':
00052 return $this->layoutTabsBar2($page, $ms, $layout);
00053 case 'UpperFeatureWell':
00054 return $this->layoutUpperFeatureWell($page, $ms, $layout);
00055 case 'LowerFeatureWell':
00056 return $this->layoutLowerFeatureWell($page, $ms, $layout);
00057 case 'FlashWell':
00058 return $this->layoutFlashWell($page, $ms, $layout);
00059 default:
00060 return parent::msBuild($page, $ms, $layout);
00061 }
00062 }
00063
00064 function layoutHead($page, $ms, $dl)
00065 {
00066 $page->setSlot('WindowTitle', $page->getSlot('CollName') . ": " . $page->getSlot('PageName'));
00067 parent::layoutHead($page, $ms, $dl);
00068 }
00069
00070
00071
00072
00073
00074
00085 public function layoutFlashWell ($page, $ms, $dl)
00086 {
00087 $flash = $page->getSlot('Flash');
00088 if ($flash == "") return;
00089 $html =<<<END_HTML
00090
00091 <!--************************************
00092 Flash
00093 ************************************-->
00094
00095 <tbody id="FlashWell">
00096 <tr>
00097 <td class="pageLeftBorder pageRightBorder">
00098 $flash
00099 </td>
00100 </tr>
00101 <tr class="metaSlotDivider">
00102 <td><hr /></td>
00103 </tr>
00104 </tbody>
00105 END_HTML;
00106 $page->setMetaSlot('FlashWell', $html);
00107 }
00108
00109
00110
00111
00112
00113 function layoutTopBar($page, $ms, $dl)
00114 {
00115 $ctitle = $page->getSlot('CollName');
00116 $nw1 = $nw2 = $nw3 = " ";
00117 switch($dl){
00118 case 'ThreeNavWells':$nw1 = $page->getSlot('TopBarNavWell1');
00119 case 'TwoNavWells':$nw2 = $page->getSlot('TopBarNavWell2');
00120 case 'OneNavWell': $nw3 = $page->getSlot('TopBarNavWell3');
00121 default: break;
00122 }
00123 if ($nw2 == ""){ $nw2 = $nw1; $nw1 = " "; }
00124 if ($nw3 == ""){ $nw3 = $nw2; $nw2 = " "; }
00125
00126 $homeURL = SPath::getFullPath('Project');
00127
00128 $ss = ($page->getSlot('SearchScript')) ? $page->getSlot('SearchScript') : "Search";
00129
00130 $html =<<<END_HTML
00131
00132 <!--************************************
00133 TopBar
00134 ************************************-->
00135
00136 <tbody id="TopBar">
00137 <tr>
00138 <td>
00139 <form id="TopBarSearch" style="display:inline" method="get" action="$ss" target="_top" name="search">
00140 <table border="0" width="100%" cellpadding="0" cellspacing="0" id="TopBarTable">
00141 <tr>
00142 <td id="TopBarLogoWell" class="pageLeftBorder" >
00143 <a href="$homeURL" target="_top"><span id="Logo"></span></a><h2 id="LogoText">$ctitle</h2>
00144 </td>
00145 <td id="TopBarFlexSpace"></td>
00146 <td id="TopBarNavWell1" align="right">$nw1</td>
00147 <td id="TopBarDivider1"><span></span></td>
00148 <td id="TopBarNavWell2" width="50">$nw2</td>
00149 <td id="TopBarDivider2"><span></span></td>
00150 <td id="TopBarNavWell3" class="pageRightBorder" width="50">$nw3</td>
00151 </tr>
00152 </table>
00153 </form>
00154 </td>
00155 </tr>
00156 <tr class="metaSlotDivider">
00157 <td><hr /></td>
00158 </tr>
00159 </tbody>
00160 END_HTML;
00161 $page->setMetaSlot('TopBar', $html);
00162 }
00163
00164
00165
00166
00177 public function layoutPageTitle ($page, $ms, $dl)
00178 {
00179 if ($page->getSlot('PageTitleRightText') != "") {
00180 $rightSide = "<div class=\"PageTitleRightText\">" . $page->getSlot('PageTitleRightText')
00181 . "</div>";
00182 } else {
00183 $rightSide = "";
00184 }
00185
00186 $ptitle = $page->getSlot('PageName');
00187 $html =<<<END_HTML
00188
00189 <!--************************************
00190 PageTitle
00191 ************************************-->
00192
00193 <tbody id="PageTitle">
00194 <tr>
00195 <td class="pageLeftBorder pageRightBorder">
00196 $rightSide
00197 <h1>$ptitle</h1>
00198 </td>
00199 </tr>
00200 <tr class="metaSlotDivider">
00201 <td><hr /></td>
00202 </tr>
00203 </tbody>
00204 END_HTML;
00205 $page->setMetaSlot('PageTitle', $html);
00206 }
00207
00208
00209
00210
00221 public function layoutPathBar ($page, $ms, $l)
00222 {
00223 $ptitle = $page->getSlot('PageName');
00224 $path = $page->getSlot('Path');
00225
00226 $html =<<<END_HTML
00227
00228 <!--************************************
00229 PathBar
00230 ************************************-->
00231
00232 <tbody id="PathBar">
00233 <tr>
00234 <td class="pageLeftBorder pageRightBorder" id="PathBarTd">
00235 $path > $ptitle
00236 </td>
00237 </tr>
00238 <tr class="metaSlotDivider">
00239 <td><hr /></td>
00240 </tr>
00241 </tbody>
00242 END_HTML;
00243 $page->setMetaSlot('PathBar', $html);
00244 }
00245
00246
00247
00248
00249
00260 public function layoutUpperFeatureWell($page, $ms, $l)
00261 {
00262 $this->layoutWell('UpperFeatureWell', $page, $ms, $l);
00263 }
00264
00275 public function layoutLowerFeatureWell($page, $ms, $l)
00276 {
00277 $this->layoutWell('LowerFeatureWell', $page, $ms, $l);
00278 }
00279
00290 public function layoutContentWell ($page, $ms, $l)
00291 {
00292 $this->layoutWell('ContentWell', $page, $ms, $l);
00293 }
00294
00295
00296
00297
00298
00310 public function layoutWell ($wellname, $page, $ms, $l)
00311 {
00312
00313 $html =<<<END_HTML
00314
00315 <!--************************************
00316 $wellname
00317 ************************************-->
00318 <tbody id="$wellname">
00319 <tr>
00320 END_HTML;
00321
00322 $col2 = $col3 = $leftSideBar = $rightSideBar = "";
00323 $wrapperId = $wellname . "Wrapper";
00324
00325
00326 $wnc1 = $wellname . "Column1";
00327 $mainContent = ($wellname == "ContentWell") ? $page->getSlot('Main') : $page->getSlot("$wellname");
00328 $col1 = $this->packageColumn($mainContent, $wellname, '1');
00329 $wellTdName = $wellname . "Td";
00330
00331 $wellStart = <<<ENDSTART
00332 <td class="pageLeftBorder pageRightBorder" id="$wellTdName">
00333 <div align="center">
00334 <table class="WellWrapper" id="$wrapperId" border="0" cellspacing="0" cellpadding="0">
00335 <tr>
00336 ENDSTART;
00337 $wellEnd = <<<ENDEND
00338 </tr>
00339 </table>
00340 </div>
00341 </td>
00342 ENDEND;
00343
00344 $wellEnd .=<<<END_HTML
00345 </tr>
00346 <tr class="metaSlotDivider">
00347 <td><hr /></td>
00348 </tr>
00349 END_HTML;
00350
00351 $wellEnd .= "</tbody>";
00352
00353
00354
00355 switch($l){
00356 case 'Start':
00357 $page->setMetaSlot("$wellname", $html . $wellStart);
00358 return;
00359 case 'End':
00360 $page->setMetaSlot("$wellname", $wellEnd);
00361 return;
00362 case 'LeftSideBarOnly':
00363 $leftSideBar = $this->packageSideBar($page->getSlot($wellname . 'SideBar'), 'Left');
00364 $rightSideBar = "";
00365 break;
00366 case 'RightSideBarOnly':
00367 $leftSideBar = "";
00368 $rightSideBar = $this->packageSideBar($page->getSlot($wellname . 'SideBar'), 'Right');
00369 break;
00370 case 'BothSideBars':
00371 $leftSideBar = $this->packageSideBar($page->getSlot($wellname . 'SideBar'), 'Left');
00372 $rightSideBar = $this->packageSideBar($page->getSlot($wellname .'SideBar2'), 'Right');
00373 break;
00374 case 'ThreeColumns':
00375 $col3 = $this->packageColumn($page->getSlot($wellname . "Column3"), $wellname, '3');
00376
00377 case 'TwoColumns':
00378 $col2 = $this->packageColumn($page->getSlot($wellname . "Column2"), $wellname, '2');
00379 break;
00380 case 'OneColumn':
00381 case 'NoSideBars':
00382 default:
00383 break;
00384 }
00385
00386
00387 $html .=<<<END_HTML
00388 $wellStart
00389 $leftSideBar
00390 $col1
00391 $col2
00392 $col3
00393 $rightSideBar
00394 $wellEnd
00395 END_HTML;
00396
00397
00398 $page->setMetaSlot("$wellname", $html);
00399 }
00400
00411 protected function packageColumn ($content, $wellname, $number)
00412 {
00413 $id = $wellname . "Column" . $number;
00414
00415 return <<<END_RETURN
00416
00417 <td id="$id" valign="top">
00418 <div class="$wellname tdFillDiv">
00419 <div class="contentDiv">
00420 $content
00421 </div>
00422 </div>
00423 </td>
00424
00425 END_RETURN;
00426 }
00427
00437 protected function packageSideBar ($sidebar, $side)
00438 {
00439 $class = $side . "SideBarTd";
00440 return <<<END_RETURN
00441
00442 <td class="$class" valign="top">
00443 <div class="SideBar tdFillDiv">
00444 $sidebar
00445 </div>
00446 </td>
00447 END_RETURN;
00448 }
00449
00450
00451
00452
00463 public function layoutBottomBar ($page, $ms, $l)
00464 {
00465 $leftText = $page->getSlot('BottomBarLeftText');
00466 $rightText = $page->getSlot('BottomBarRightText');
00467 $bbrt = ($rightText == "") ? "" :
00468 "<div style=\"float:right\" id=\"BottomBarRightText\">$rightText</div>";
00469 $yearNow = date('Y');
00470 $homeURL = SPath::getFullPath('Project');
00471 $html =<<<END_HTML
00472
00473 <!--************************************
00474 BottomBar
00475 ************************************-->
00476 <tbody id="BottomBar"><tr>
00477 <td class="pageLeftBorder pageRightBorder contentTd">
00478 $bbrt
00479 <div ID="BottomBarLeftText"><a href="$homeURL/licensing">©1994-$yearNow Shodor</a> $leftText</div>
00480 </td></tr></tbody>
00481
00482 END_HTML;
00483 $page->setMetaSlot('BottomBar', $html);
00484 }
00485
00486
00487
00488
00499 public function layoutTabsBar1 ($page, $ms, $l)
00500 {
00501 $tabs = $page->getSlot('TabsBar1');
00502 if ($tabs == "" | $tabs == "<ul></ul>") return "";
00503 $html =<<<END_HTML
00504
00505 <!--************************************
00506 TabsBar Level 1
00507 ************************************-->
00508
00509 <tbody id="TabsBar1">
00510 <tr>
00511 <td class="pageLeftBorder pageRightBorder" id="TabsBar1Td">
00512 $tabs
00513 </td>
00514 </tr>
00515 <tr class="metaSlotDivider">
00516 <td><hr /></td>
00517 </tr>
00518 </tbody>
00519 END_HTML;
00520 $page->setMetaSlot('TabsBar1', $html);
00521 }
00522
00523
00524
00525
00536 public function layoutTabsBar2 ($page, $ms, $l)
00537 {
00538 $tabs = $page->getSlot('TabsBar2');
00539 if ($tabs == "" || $tabs == "<ul></ul>") return "";
00540 $html =<<<END_HTML
00541
00542 <!--************************************
00543 TabsBar Level 2
00544 ************************************-->
00545
00546 <tbody id="TabsBar2">
00547 <tr>
00548 <td class="pageLeftBorder pageRightBorder" id="TabsBar2Td">
00549 $tabs
00550 </td>
00551 </tr>
00552 <tr class="metaSlotDivider">
00553 <td><hr /></td>
00554 </tr>
00555 </tbody>
00556 END_HTML;
00557 $page->setMetaSlot('TabsBar2', $html);
00558 }
00559 }
00560
00561
00562 ?>