html( 'title' ) ?>
-getMsg( 'tagline' )->parse() ?>
+
+ outputPortlet( array(
+ 'id' => 'p-namespaces',
+ 'headerMessage' => 'timeless-namespaces',
+ 'content' => $pileOfTools['namespaces'],
+ ) );
+ ?>
+ outputPortlet( array(
+ 'id' => 'p-pagetools',
+ 'headerMessage' => 'timeless-pagetools',
+ 'content' => $pileOfTools['page-primary'],
+ ) );
+ ?>
+
+
html( 'catlinks' );
$this->html( 'dataAfterContent' );
?>
@@ -91,23 +140,7 @@ class TimelessTemplate extends BaseTemplate {
- getFooterLinks() as $category => $links ) {
- ?>
-
-
-
-
- html( $key ) ?> - -
-
+
- html( $key ) ?> + +
-
getFooterIcons( 'icononly' ) as $blockName => $footerIcons ) {
?>
@@ -122,6 +155,21 @@ class TimelessTemplate extends BaseTemplate {
}
?>
-
+
+
>
@@ -238,14 +291,13 @@ class TimelessTemplate extends BaseTemplate {
/**
* Outputs the sidebar
- * Set the elements to true to allow them to be part of the sidebar
*/
private function outputSiteNavigation() {
$sidebar = $this->getSidebar();
- $sidebar['SEARCH'] = false;
- $sidebar['TOOLBOX'] = true;
- $sidebar['LANGUAGES'] = true;
+ $sidebar['SEARCH'] = false; // Already hardcoded into header
+ $sidebar['TOOLBOX'] = false; // Parsed as part of pageTools
+ $sidebar['LANGUAGES'] = false; // PUT THIS ON THE OTHER SIDE
foreach ( $sidebar as $boxName => $box ) {
if ( $boxName === false ) {
@@ -254,33 +306,214 @@ class TimelessTemplate extends BaseTemplate {
$this->outputPortlet( $box, true );
}
}
- private function outputPageLinks() {
- $this->outputPortlet( array(
- 'id' => 'p-namespaces',
- 'headerMessage' => 'namespaces',
- 'content' => $this->data['content_navigation']['namespaces'],
- ) );
- $this->outputPortlet( array(
- 'id' => 'p-variants',
- 'headerMessage' => 'variants',
- 'content' => $this->data['content_navigation']['variants'],
- ) );
- $this->outputPortlet( array(
- 'id' => 'p-views',
- 'headerMessage' => 'views',
- 'content' => $this->data['content_navigation']['views'],
- ) );
- $this->outputPortlet( array(
- 'id' => 'p-actions',
- 'headerMessage' => 'actions',
- 'content' => $this->data['content_navigation']['actions'],
- ) );
- }
+
private function outputUserLinks() {
- $this->outputPortlet( array(
- 'id' => 'p-personal',
- 'headerMessage' => 'personaltools',
- 'content' => $this->getPersonalTools(),
- ) );
+ $user = $this->getSkin()->getUser();
+ ?>
+
+
+ getSkin()->getTitle();
+ $namespace = $title->getNamespace();
+
+ $sortedPileOfTools = array(
+ 'namespaces' => array(),
+ 'page-primary' => array(),
+ 'page-secondary' => array(),
+ 'user' => array(),
+ 'page-tertiary' => array(),
+ 'general' => array()
+ );
+
+ $pileOfTools = array();
+ foreach ( $this->data['content_navigation'] as $navKey => $navBlock ) {
+ /* Just use namespaces items as they are */
+ if ( $navKey == 'namespaces' ) {
+ if ( $namespace < 0 ) {
+ // Put special page ns_pages in the more pile so they're not so lonely
+ $sortedPileOfTools['page-tertiary'] = $navBlock;
+ } else {
+ $sortedPileOfTools['namespaces'] = $navBlock;
+ }
+ } else {
+ $pileOfTools = array_merge( $pileOfTools, $navBlock );
+ }
+ }
+ $pileOfTools = array_merge( $pileOfTools, $this->getToolbox() );
+ if ( $namespace >= 0 ) {
+ $pileOfTools['pagelog'] = array(
+ 'text' => $this->getMsg( 'timeless-pagelog' )->escaped(),
+ 'href' => SpecialPage::getTitleFor( 'Log', $title->getPrefixedText() )->getLocalURL(),
+ 'id' => 't-pagelog'
+ );
+ }
+
+ /* This is really dumb, but there is no sane way to do this. */
+ foreach ( $pileOfTools as $navKey => $navBlock ) {
+ $currentSet = null;
+
+ if ( in_array( $navKey, array( 'watch', 'unwatch' ) ) ) {
+ $currentSet = 'namespaces';
+ } elseif ( in_array( $navKey, array( 'edit', 'view', 'history', 'contributions', 'addsection' ) ) ) {
+ $currentSet = 'page-primary';
+ } elseif ( in_array( $navKey, array( 'delete', 'rename', 'protect', 'unprotect', 'viewsource', 'move' ) ) ) {
+ $currentSet = 'page-secondary';
+ } elseif (in_array( $navKey, array( 'blockip', 'userrights', 'log' ) ) ) {
+ $currentSet = 'user';
+ } elseif (in_array( $navKey, array( 'whatlinkshere', 'print', 'info', 'pagelog', 'recentchangeslinked', 'permalink' ) ) ) {
+ $currentSet = 'page-tertiary';
+ } else {
+ $currentSet = 'general';
+ }
+ $sortedPileOfTools[$currentSet][$navKey] = $navBlock;
+ }
+
+ return $sortedPileOfTools;
+ }
+
+ /*
+ * Assemble and output array of categories, regardless of view mode
+ * Just using Skin or OutputPage functions doesn't respect view modes (preview, history, whatever)
+ */
+ private function outputCategories() {
+ global $wgContLang;
+
+ $skin = $this->getSkin();
+ $title = $skin->getTitle();
+ $catList = false;
+
+ /* Get list from outputpage if in preview; otherwise get list from title */
+ if ( in_array( $skin->getRequest()->getVal( 'action' ), array( 'submit', 'edit' ) ) ) {
+ $allCats = array();
+ /* Can't just use getCategoryLinks because there's no equivalent for Title */
+ $allCats2 = $skin->getOutput()->getCategories();
+ foreach ( $allCats2 as $displayName ) {
+ $catTitle = Title::makeTitleSafe( NS_CATEGORY, $displayName );
+ $allCats[] = $catTitle->getDBkey();
+ }
+ } else {
+ /* This is probably to trim out some excessive stuff. Unless I was just high on cough syrup. */
+ $allCats = array_keys( $title->getParentCategories() );
+
+ $len = strlen( $wgContLang->getNsText( NS_CATEGORY ) . ':' );
+ foreach ( $allCats as $i => $catName ) {
+ $allCats[$i] = substr( $catName, $len );
+ }
+ }
+ if ( count( $allCats ) > 0 ) {
+ $dbr = wfGetDB( DB_SLAVE );
+ $res = $dbr->select(
+ array( 'page', 'page_props' ),
+ array( 'page_id', 'page_title' ),
+ array(
+ 'page_title' => $allCats,
+ 'page_namespace' => NS_CATEGORY,
+ 'pp_propname' => 'hiddencat'
+ ),
+ __METHOD__,
+ array(),
+ array( 'page_props' => array( 'JOIN', 'pp_page = page_id' ) )
+ );
+ $hiddenCats = array();
+ foreach ( $res as $row ) {
+ $hiddenCats[] = $row->page_title;
+ }
+ $normalCats = array_diff( $allCats, $hiddenCats );
+
+ $normalCount = count( $normalCats );
+ $hiddenCount = count( $hiddenCats );
+ $count = $normalCount;
+
+ /* Mostly consistent with how Skin does it. Doesn't have the classes. Either way can't be good for caching. */
+ if ( $skin->getUser()->getBoolOption( 'showhiddencats' ) || $title->getNamespace() == NS_CATEGORY ) {
+ $count += $hiddenCount;
+ } else {
+ /* We don't care if there are hidden ones. */
+ $hiddenCount = 0;
+ }
+
+ /* Assemble the html because why not... */
+ if ( $count ) {
+ $catList = '+ + isLoggedIn() ) { + $userName = $user->getName(); + // Make sure it fit firsts + if ( strlen( $userName ) < 15 ) { + echo htmlspecialchars( $userName, ENT_QUOTES ); + } else { + echo wfMessage( 'timeless-loggedin' )->escaped(); + } + } else { + echo wfMessage( 'timeless-anonymous' )->escaped(); + } + ?> + +
+
+
+ - html( 'userlangattributes' ) ?>>
+ getPersonalTools() as $key => $item ) {
+ if ( $key == 'userpage' ) {
+ $item['links'][0]['text'] = wfMessage( 'timeless-userpage' )->text();
+ }
+ if ( $key == 'mytalk' ) {
+ $item['links'][0]['text'] = wfMessage( 'timeless-talkpage' )->text();
+ }
+ echo $this->makeListItem( $key, $item );
+ }
+ ?>
+
';
+ if ( $normalCount ) {
+ $catList .= $this->assembleCatList( $normalCats, 'catlist-normal', 'categories' );
+ }
+ if ( $hiddenCount ) {
+ $catList .= $this->assembleCatList( $hiddenCats, 'catlist-hidden', 'hidden-categories' );
+ }
+ $catList .= '
';
+ }
+ }
+ if ( $catList ) {
+ echo $catList;
+ }
+ }
+ private function assembleCatList( $list, $id, $message ) {
+ $catList = '' . $this->getMsg( $message )->escaped() . '
'; + $catList .= '- ';
+ foreach ( $list as $category) {
+ $title = Title::makeTitleSafe( NS_CATEGORY, $category );
+ if ( !$title ) {
+ continue;
+ }
+ $category = Linker::link( $title, $title->getText() );
+ $catList .= '
- ' . $category . ' '; + } + $catList .= '