From OrganicDesign
| Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, this is only useful for a historic record of work done. You may find a link to the currently used concept or function in this article, if not you can contact the author to find out what has taken the place of this legacy item.
|
|
<?
global $xwMsgToken, $xwCssToken, $xwTemplate, $xwDebug, $xwRaw, $wgSitename, $wgLogo, $xwHeaders, $xwSideBar;
global $xwWritable, $xwUserName, $xwIsAdmin, $xwIsUser, $xwAnonymous, $xwIsProperties, $xwIsSystem, $xwIsSpecial;
$urltitle = urlencode($title);
$tmpl = &$xwTemplate;
$data = &$tmpl->data;
$translator = &$tmpl->translator;
$head = "<head>\n$xwHeaders\n<title>$title</title>\n$xwCssToken\n";
# Just set up a minimal skin if no skin-hook has not set everything up
if ( $xwRaw || $_REQUEST['printable'] || !is_object($translator) ) {
$html = '<html>';
$head .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>';
$body = "<body class=\"ns-0\">$xwMsgToken";
$content = "<div id=\"bodyContent\"><!-- start content -->$article<!-- end content --><div class=\"visualClear\"></div></div>";
$article = "$html\n$head\n$body\n$content\n</body></html>";
}
else {
$html = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="';
$html .= htmlspecialchars($data['lang']).'" lang="'.htmlspecialchars($data['lang']).'" dir="';
$html .= htmlspecialchars($data['dir']).'">';
# Add Discussion link if special pages, or add copy-action if not special (and not anonymous)
if ($xwIsSpecial) $data['content_actions']['specialtalk'] = array('href' => "/wiki/index.php?title=Talk:$urltitle", 'text' => 'Discussion');
else if (!$xwAnonymous) $data['content_actions']['move'] = array('href' => "$script?title=$urltitle&xpath:/properties:view=copy.php", 'text' => 'Rename/Copy');
# Add properties & export if a meta-article, or change article-href if it is
if ($xwIsProperties) $data['content_actions']['nstab-main']['href'] = "$script?title=".preg_replace( '/^.+?:/i', '', $title);
elseif ($xwIsSystem) $data['content_actions']['nstab-main']['href'] = "$script?title=user:".preg_replace( '/^.+?:/i', '', $title);
else $data['content_actions']['xml'] = array('href' => "$script?title=xml:$urltitle&action=edit", 'text' => 'Properties');
# If admin and a user page, add system-action
if ($xwIsAdmin && $xwIsUser)
$data['content_actions']['sys'] = array( 'href' => '/wiki/index.php?title=sys:'.preg_replace( '/^user:/i', '', $title ).'&action=edit', 'text' => 'System' );
# Head
$head .= '<meta http-equiv="Content-Type" content="'.htmlspecialchars($data['mimetype']);
$head .= '; charset='.htmlspecialchars($data['charset']).'" />'.$data['headlinks'];
$head .= '<script type="text/javascript" src="'.$data['stylepath'].'/common/wikibits.js"></script>';
$head .= '<script type="text/javascript">
function sideBarState(a,b) {
sb = document.getElementById("entire-side-bar");
show = document.getElementById("show-side-bar");
hide = document.getElementById("hide-side-bar");
sb.style.display = hide.style.display = a;
show.style.display = b;
}
</script>';
$head .= '</head>';
# Body opening tag
$body = '<body ';
#if ( $data['body_ondblclick'] ) $body .= 'ondblclick="'.htmlspecialchars($data['body_ondblclick']).'" ';
if ( $data['nsclass'] ) $body .= 'class="'.htmlspecialchars($data['nsclass']).'"';
$body .= '>';
# Page Title
$page_title = "\n<h1 class=\"firstHeading\">$title</h1><div id=\"content\"><a name=\"top\" id=\"contentTop\"></a>";
# Content
$content = '<div id="bodyContent"><h3 id="siteSub">'.htmlspecialchars($translator->translate('tagline')).'</h3>';
if ($data['sitenotice']) $content .= '<div id="siteNotice">'.$data['sitenotice'].'</div>';
$content .= '<div id="contentSub">'.$data['subtitle'].'</div>';
if ($data['undelete']) $content .= '<div id="contentSub">'.$data['undelete'].'</div>';
if ($data['newtalk']) $content .= '<div class="usermessage">'.$data['newtalk'].'</div>';
$content .= "<!-- start content -->$article"; # <---- Actual article content inserted here
if ($data['catlinks']) $content .= '<div id="catlinks">'.$data['catlinks'].'</div>';
$content .= '<!-- end content --><div class="visualClear"></div>';
$content .= '</div></div>';
# Action-links (remove edit link if not writable)
$actions = '<div id="p-cactions" class="portlet"><h5>Views</h5><ul>';
$actions .= '<li><a style="display:none;" id="show-side-bar" href="javascript:sideBarState(\'\',\'none\')">►</a><a id="hide-side-bar" href="javascript:sideBarState(\'none\',\'\')">◄</a></li>';
foreach ($data['content_actions'] as $key => $action) {
$actions .= '<li id="ca-'.htmlspecialchars($key).'"';
if (!empty($action['class'])) $actions .= ' class="'.htmlspecialchars($action['class']).'"';
$href = '<a href="'.htmlspecialchars($action['href']).'">'.htmlspecialchars($action['text']).'</a>';
$actions .= ">$href</li>";
}
$actions .= '</ul></div>';
# Side bar & bookmarks
$bookmarks = $xwAnonymous ? "Bookmarks:Default" : "Bookmarks:$xwUserName";
$side = xwXmlWikiParse($xwSideBar ? $xwSideBar : 'xmlwiki-sidebar');
$side .= "<div class='portlet' id='p-nav'><h5><a href='$xwScript/wiki/index.php?title=$bookmarks&action=edit'>Bookmarks</a></h5><div class='pBody'>";
$side .= xwXmlWikiParse($bookmarks);
$side .= '</div></div>';
# Footer
$footer = '';
$space = ' ';
if ($data['lastmod']) $footer .= $space.$data['lastmod'];
if ($data['viewcount']) $footer .= $space.$data['viewcount'];
if ($data['about']) $footer .= $space.$data['about'];
# A hidden button with access-key for edit
$edit = "<table border=0 cellpadding=0 cellspacing=0><tr>
<td><form method=\"get\" action=\"$script\">
<input accesskey=e type=image src=\"/wiki/skins/common/images/Arr_.png\" />
<input name=title type=hidden value=\"$title\" />
<input name=action type=hidden value=edit />
</form>";
if (!$GLOBALS['xwEdit'] && !$GLOBALS['xwPreview'] && !$xwIsProperties && !$xwIsSystem) $edit .= "
<td><form method=\"get\" action=\"$script\">
<input accesskey=p type=image src=\"/wiki/skins/common/images/Arr_.png\" />
<input name=title type=hidden value=\"Xml:$title\" />
<input name=action type=hidden value=edit />
</form>";
$edit .= '</table>';
# Return assembled parts
$article = "$html
$head
$body
<table class='content'>
<tr>
<td id='entire-side-bar' class='side-bar' rowspan='2'>
$side
</td>
<td width=100%>
<table class='content'><tr>
<td class='top-bar'>$page_title</td>
<td class='top-bar'><div class='logo'>$wgSitename</div></td></tr>
<tr><td class='article-content' colspan='2'>
$edit
$actions
$xwMsgToken
$content
</td></tr>
</table>
</td>
</tr>
<tr><td class='footer'>$footer$email</td></tr>
</table>
</body>
</html>
";
}
?>