Difference between revisions of "PsyCrit/archive/skin"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
m (→‎Contents: now with syntax highlighting (note: apostrophe in comment in HTML causes highlighting bug))
(link to a contemporaneous/relevant page)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
=={{hide|Navigation}}==
 
[[computing]]: [[software]]: [[MediaWiki]]: [[MediaWiki customization|customization]]: [[MediaWiki customization for an outward-looking site|outward-looking]]: [[modified skin for PsyCrit|modified skin]]
 
 
==Overview==
 
==Overview==
 +
''see also [[MediaWiki/archive/customizing/outward-looking]]''
 +
 
To create the custom skins for [[PsyCrit]], I copied the "monobook" folder and "MonoBook.php" to "psycrit" and "PsyCrit.php" respectively. Then I edited PsyCrit.php, with the final results as follows.
 
To create the custom skins for [[PsyCrit]], I copied the "monobook" folder and "MonoBook.php" to "psycrit" and "PsyCrit.php" respectively. Then I edited PsyCrit.php, with the final results as follows.
 
==Contents==
 
==Contents==
<php>
+
<syntaxhighlight lang=php>
 
<?php
 
<?php
 
/**
 
/**
Line 208: Line 208:
 
<?php if($this->data['undelete']) { ?><div id="contentSub2"><?php    $this->html('undelete') ?></div><?php } ?>
 
<?php if($this->data['undelete']) { ?><div id="contentSub2"><?php    $this->html('undelete') ?></div><?php } ?>
 
<?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk')  ?></div><?php } ?>
 
<?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk')  ?></div><?php } ?>
<?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
+
<?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?>
 +
<a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>,
 +
<a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
 
<!-- start content -->
 
<!-- start content -->
 
<?php $this->html('bodytext') ?>
 
<?php $this->html('bodytext') ?>
Line 271: Line 273:
 
<?php }
 
<?php }
 
}
 
}
?>
+
?><li>This website is in no way affiliated with "psyccritiques" or the American Psychological Association.
</ul>
 
</div>
 
</body></html>
 
<?php
 
wfRestoreWarnings();
 
} // end of execute() method
 
} // end of class
 
?>
 
</php>
 
 
 
<h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->text('title'):$this->html('title') ?></h1>
 
<div id="bodyContent">
 
<h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
 
<div id="contentSub"><?php $this->html('subtitle') ?></div>
 
<?php if($this->data['undelete']) { ?><div id="contentSub2"><?php    $this->html('undelete') ?></div><?php } ?>
 
<?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk')  ?></div><?php } ?>
 
<?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
 
<!-- start content -->
 
<?php $this->html('bodytext') ?>
 
<?php if($this->data['catlinks']) { ?><div id="catlinks"><?php      $this->html('catlinks') ?></div><?php } ?>
 
<!-- end content -->
 
<div class="visualClear"></div>
 
</div>
 
</div>
 
</div>
 
<div id="column-one">
 
 
<!--
 
2006-07-26 This section normally displays the per-user options at the top; we're turning those off.
 
2006-07-31 This would need to be relocated anyway, to fit in with the HTML-based layout
 
 
 
<div class="portlet" id="p-personal">
 
<h5><?php $this->msg('personaltools') ?></h5>
 
<div class="pBody">
 
<ul>
 
<?php foreach($this->data['personal_urls'] as $key => $item) { ?>
 
<li id="pt-<?php echo htmlspecialchars($key) ?>"<?php
 
if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
 
echo htmlspecialchars($item['href']) ?>"<?php
 
if(!empty($item['class'])) { ?> class="<?php
 
echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
 
echo htmlspecialchars($item['text']) ?></a></li>
 
<?php } ?>
 
</ul>
 
</div>
 
</div>
 
-->
 
 
 
<div class="visualClear"></div>
 
<?php
 
if($this->data['poweredbyico']) { ?>
 
<div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
 
<?php }
 
if($this->data['copyrightico']) { ?>
 
<div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
 
<?php }
 
 
 
?>
 
<?php
 
/* $footerlinks = array(
 
'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
 
'privacy', 'about', 'disclaimer', 'tagline', */
 
$footerlinks = array(
 
'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
 
'tagline',
 
);
 
?>
 
<script type="text/javascript"> if (window.runOnloadHook) runOnloadHook();</script>
 
</div>
 
<?php $this->html('reporttime') ?>
 
<div id="footer">
 
<ul id="f-list">
 
<?php
 
// Generate additional footer links
 
foreach( $footerlinks as $aLink ) {
 
if( $this->data[$aLink] ) {
 
?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
 
<?php }
 
}
 
?>
 
 
</ul>
 
</ul>
 
</div>
 
</div>
Line 360: Line 282:
 
} // end of class
 
} // end of class
 
?>
 
?>
</pre>
+
</syntaxhighlight>

Latest revision as of 23:08, 14 December 2017

Overview

see also MediaWiki/archive/customizing/outward-looking

To create the custom skins for PsyCrit, I copied the "monobook" folder and "MonoBook.php" to "psycrit" and "PsyCrit.php" respectively. Then I edited PsyCrit.php, with the final results as follows.

Contents

<?php
/**
 * MonoBook nouveau
 *
 * Translated from gwicke's previous TAL template version to remove
 * dependency on PHPTAL.
 *
 * @todo document
 * @package MediaWiki
 * @subpackage Skins
 */

if( !defined( 'MEDIAWIKI' ) )
	die( -1 );

/** */
require_once('includes/SkinTemplate.php');

/**
 * Inherit main code from SkinTemplate, set the CSS and template filter.
 * @todo document
 * @package MediaWiki
 * @subpackage Skins
 */
class SkinPsyCrit extends SkinTemplate {
	/** Using monobook. */
	function initPage( &$out ) {
		SkinTemplate::initPage( $out );
		$this->skinname  = 'psycrit';
		$this->stylename = 'psycrit';
		$this->template  = 'PsyCritTemplate';
	}
}

/**
 * @todo document
 * @package MediaWiki
 * @subpackage Skins
 */
class PsyCritTemplate extends QuickTemplate {
	/**
	 * Template filter callback for MonoBook skin.
	 * Takes an associative array of data set from a SkinTemplate-based
	 * class, and a wrapper for MediaWiki's localization database, and
	 * outputs a formatted page.
	 *
	 * @access private
	 */
	function execute() {
		// Suppress warnings to prevent notices about missing indexes in $this->data
		wfSuppressWarnings();

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
	<head>
		<meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
		<?php $this->html('headlinks') ?>
		<title><?php $this->text('pagetitle') ?></title>
		<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?9"; /*]]>*/</style>
		<link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css" />
		<!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
		<!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
		<!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
		<!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?1";</style><![endif]-->
		<!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
		<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
		<script type="<?php $this->text('jsmimetype') ?>">var skin = '<?php $this->text('skinname')?>';var stylepath = '<?php $this->text('stylepath')?>';</script>
		<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?1"><!-- wikibits js --></script>
<?php	if($this->data['jsvarurl'  ]) { ?>
		<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl'  ) ?>"><!-- site js --></script>
<?php	} ?>
<?php	if($this->data['pagecss'   ]) { ?>
		<style type="text/css"><?php $this->html('pagecss'   ) ?></style>
<?php	}
		if($this->data['usercss'   ]) { ?>
		<style type="text/css"><?php $this->html('usercss'   ) ?></style>
<?php	}
		if($this->data['userjs'    ]) { ?>
		<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
<?php	}
		if($this->data['userjsprev']) { ?>
		<script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
<?php	}
		if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
		<!-- Head Scripts -->
		<?php $this->html('headscripts') ?>
	</head>
<body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
<?php if($this->data['body_onload'    ]) { ?>onload="<?php     $this->text('body_onload')     ?>"<?php } ?>
 class="<?php $this->text('nsclass') ?> <?php $this->text('dir') ?>">

<!-- This section displays the logo banner -->
<table width=100% class=topbanner><tr><td>

<!-- SEARCHBOX -->
	<table align=right><tr><td>
	<div id="p-search" class="portlet">
		<h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
		<div id="searchBody" class="pBody">
			<form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
				<input id="searchInput" name="search" type="text" <?php
					if($this->haveMsg('accesskey-search')) {
						?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php }
					if( isset( $this->data['search'] ) ) {
						?> value="<?php $this->text('search') ?>"<?php } ?> />
				<input type='submit' name="go" class="searchButton" id="searchGoButton"	value="<?php $this->msg('go') ?>" />&nbsp;
				<input type='submit' name="fulltext" class="searchButton" value="<?php $this->msg('search') ?>" />
			</div></form>
		</div>
	</div>
	</td></tr></table>

<!-- TOP BANNER -->
<a <?php
			?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" <?php
			?>title="<?php $this->msg('mainpage') ?>"><img class=topbanner src="/skins/common/images/OwlBanner2.135pxh.png"></a>
</td></tr></table>

<?php /* =================== main contents =========================== */ ?>

<!-- (Wzl) action/view tabs -->
<div id="p-cactions" class="portlet">
		<h5><?php $this->msg('views') ?></h5>
		<ul>
<?php
	global $wgUser;
/* OLD CODE FOR SELECTIVELY SHOWING STANDARD MW TABS
	foreach($this->data['content_actions'] as $key => $tab) {
#		if ($wgUser->isAllowed($key)) { ? >
		$tabOk = true;
		if (($key == 'talk') || ($key == 'edit') || ($key == 'delete') || ($key == 'move')) {
			switch ($key) {
			case 'talk':
				$tabOk = true;
				break;
			case 'edit':
				$userGrps = $wgUser->getGroups();
				$tabOk = in_array('sysop', $userGrps);
#			$tabOk = true;
#				$tabOk = false;
				break;
			case 'delete':
				$tabOk = $wgUser->isAllowed('delete');
#			$tabOk = true;
				break;
			case 'move':
				$tabOk = $wgUser->isAllowed('move');
#			$tabOk = true;
				break;
			}
		}
		if ($tabOk) { ?>
			<li id="ca-<?php echo htmlspecialchars($key) ?>"<?php
			if($tab['class']) {
				?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php 
			}
			?>><a href="<?php echo htmlspecialchars($tab['href']) ?>">
			<?php echo htmlspecialchars($tab['text']) ?></a></li><?php
		}
	}
?>
*/
// 2006-07-26 NEW CODE FOR JUST SHOWING JERS TABS
// yes, there's a better way to do this which makes it easier to edit the tabs,
//	but I don't have time to figure it out now.
	$title = $this->data['title'];
	$kSelected = ' class="selected"';
	switch ($title) {
	case 'Introduction':
		$class_Home = $kSelected;
		break;
	case 'About PsyCrit':
		$class_About = $kSelected;
		break;
	case 'Articles':
		$class_Main = $kSelected;
		break;
	case 'Instructions to Authors':
		$class_Auth = $kSelected;
		break;
	}
?>

		<li<?php echo$class_Home ?>><a href="/">introduction</a>
		<li<?php echo$class_About ?>><a href="/About PsyCrit">about PsyCrit</a>
		<li<?php echo$class_Main ?>><a href="/Articles">articles</a>
		<li<?php echo$class_Auth ?>><a href="/Instructions to Authors">instructions to authors</a>

		</ul>
	</div>
<!-- Wzl mod ends here -->

	<div id="globalWrapper">
		<div id="column-content">
	<div id="content">
		<a name="top" id="top"></a>
		<?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
		<h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->text('title'):$this->html('title') ?></h1>
		<div id="bodyContent">
			<h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
			<div id="contentSub"><?php $this->html('subtitle') ?></div>
			<?php if($this->data['undelete']) { ?><div id="contentSub2"><?php     $this->html('undelete') ?></div><?php } ?>
			<?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk')  ?></div><?php } ?>
			<?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?>
			<a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>,
			<a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
			<!-- start content -->
			<?php $this->html('bodytext') ?>
			<?php if($this->data['catlinks']) { ?><div id="catlinks"><?php       $this->html('catlinks') ?></div><?php } ?>
			<!-- end content -->
			<div class="visualClear"></div>
		</div>
	</div>
		</div>
		<div id="column-one">
	
<!-- 
2006-07-26 This section normally displays the per-user options at the top; we are turning those off.
2006-07-31 This would need to be relocated anyway, to fit in with the HTML-based layout

	<div class="portlet" id="p-personal">
		<h5><?php $this->msg('personaltools') ?></h5>
		<div class="pBody">
			<ul>
<?php 			foreach($this->data['personal_urls'] as $key => $item) { ?>
				<li id="pt-<?php echo htmlspecialchars($key) ?>"<?php
					if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
				echo htmlspecialchars($item['href']) ?>"<?php
				if(!empty($item['class'])) { ?> class="<?php
				echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
				echo htmlspecialchars($item['text']) ?></a></li>
<?php			} ?>
			</ul>
		</div>
	</div>
-->

			<div class="visualClear"></div>
<?php
		if($this->data['poweredbyico']) { ?>
				<div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
<?php 	}
		if($this->data['copyrightico']) { ?>
				<div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
<?php	}

?>
<?php
/*		$footerlinks = array(
			'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
			'privacy', 'about', 'disclaimer', 'tagline', */
		$footerlinks = array(
			'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
			'tagline',
		);
?>
	<script type="text/javascript"> if (window.runOnloadHook) runOnloadHook();</script>
</div>
<?php $this->html('reporttime') ?>
<div id="footer">
<ul id="f-list">
<?php
		// Generate additional footer links
		foreach( $footerlinks as $aLink ) {
			if( $this->data[$aLink] ) {
?>				<li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
<?php 		}
		}
?><li>This website is in no way affiliated with "psyccritiques" or the American Psychological Association.
</ul>
</div>
</body></html>
<?php
	wfRestoreWarnings();
	} // end of execute() method
} // end of class
?>