Diff of /branches/Cavendish-1.5.0/Cavendish.php [000000] .. [r492]  Maximize  Restore

Switch to unified view

a b/branches/Cavendish-1.5.0/Cavendish.php
1
<?php
2
/**
3
 * Mozilla cavendish theme
4
 * Modified by DaSch for MW 1.19 and WeCoWi
5
 *
6
 * Loosely based on the cavendish style by Gabriel Wicke
7
 *
8
 * @todo document
9
 * @package MediaWiki
10
 * @subpackage Skins
11
 */
12
13
14
if( !defined( 'MEDIAWIKI' ) )
15
  die( -1 );
16
17
require_once('includes/SkinTemplate.php');
18
19
/**
20
 * Inherit main code from SkinTemplate, set the CSS and template filter.
21
 * @todo document
22
 * @package MediaWiki
23
 * @subpackage Skins
24
 */
25
 
26
/**
27
 * Inherit main code from SkinTemplate, set the CSS and template filter.
28
 * @todo document
29
 * @ingroup Skins
30
 */
31
class SkinCavendish extends SkinTemplate {
32
  /** Using cavendish. */
33
34
  function initPage( &$out ) {
35
      SkinTemplate::initPage( $out );
36
      $this->skinname = 'cavendish'; 
37
      $this->stylename = 'cavendish';
38
      $this->template = 'CavendishTemplate'; 
39
      $this->useHeadElement = true;
40
      }
41
  function setupSkinUserCss( OutputPage $out ) {
42
      global $wgHandheldStyle, $wgStyleVersion, $wgJsMimeType, $wgStylePath, $wgVersion;
43
      global $cavendishLogoURL, $cavendishLogoWidth, $cavendishLogoHeight, $cavendishLogoMargin, $cavendishSiteWith, $cavendishExtensionCSS, $cavendishSidebarSearchbox;
44
      parent::setupSkinUserCss( $out );
45
      // Append to the default screen common & print styles...
46
      $out->addStyle( 'cavendish/print.css', 'print' );
47
      $out->addStyle( 'cavendish/cavendish.css', 'screen' );
48
      if( $wgHandheldStyle ) {
49
          // Currently in testing... try 'chick/main.css'
50
          $out->addStyle( $wgHandheldStyle, 'handheld' );
51
      }
52
      $out->addStyle( 'cavendish/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
53
      $out->addStyle( 'cavendish/IE55Fixes.css', 'screen', 'IE 5.5000' );
54
      $out->addStyle( 'cavendish/IE60Fixes.css', 'screen', 'IE 6' );
55
      $out->addStyle( 'cavendish/IE70Fixes.css', 'screen', 'IE 7' );
56
      
57
      $out->addStyle( 'cavendish/rtl.css', 'screen', '', 'rtl' );
58
      
59
      /* README for details */
60
      if(!isset($cavendishLogoURL)) {
61
          $cavendishLogoURL=$wgStylePath . "/cavendish/wiki_header_logo.gif";
62
      }
63
      if(!isset($cavendishLogoWidth)) {
64
          $cavendishLogoWidth="322";
65
      }
66
      if(!isset($cavendishLogoHeight)) {
67
          $cavendishLogoHeight="53";
68
      }
69
      $cavendishLogoMarginToAdd="";
70
      if(isset($cavendishLogoMargin)) {
71
          $cavendishLogoMarginToAdd .= 'margin-top:'.$cavendishLogoMargin.'px;';
72
      }
73
      if(!isset($cavendishSidebarSearchbox)) {
74
          $cavendishSidebarSearchbox=false;
75
      }
76
      $cavendishSidebarSearchboxToAdd = "";
77
      if(!$cavendishSidebarSearchbox) {
78
          $cavendishSidebarSearchboxToAdd .= '#nav #p-search {display:none;}';
79
      } 
80
      $cavendishglobalWrapper="";
81
      if (isset($cavendishSiteWith)) {
82
          $cavendishglobalWrapper = '#globalWrapper {width:'. $cavendishSiteWith .'px;}';
83
      }
84
      if (!isset($cavendishExtensionCSS)) {
85
          $cavendishExtensionCSS = true;      
86
      }
87
      if ($cavendishExtensionCSS) {
88
          $out->addStyle( 'cavendish/extensions.css', 'screen' ); 
89
      }
90
      $headStyle = '#header h6 a { background: transparent url("'.$cavendishLogoURL.'") no-repeat; width:'.$cavendishLogoWidth.'px;height:'.$cavendishLogoHeight.'px;'.$cavendishLogoMarginToAdd.'}'.$cavendishglobalWrapper.$cavendishSidebarSearchboxToAdd;
91
      $out->addInlineStyle($headStyle);
92
  }
93
}
94
95
class CavendishTemplate extends MonoBookTemplate {
96
  var $skin;
97
  /**
98
   * Template filter callback for cavendish skin.
99
   * Takes an associative array of data set from a SkinTemplate-based
100
   * class, and a wrapper for MediaWiki's localization database, and
101
   * outputs a formatted page.
102
   *
103
   * @access private
104
   */
105
  function execute() {
106
      global $wgRequest, $wgLang;
107
      $styleversion = '1.5.0';
108
      $this->skin = $skin = $this->data['skin'];
109
      $action = $wgRequest->getText( 'action' );
110
      if ( $action == "") {
111
          $action = "view";
112
      }
113
      // Suppress warnings to prevent notices about missing indexes in $this->data
114
      wfSuppressWarnings();
115
      $this->html( 'headelement' );
116
?>
117
<div id="internal"></div>
118
<!-- Skin-Version: <?php echo $styleversion ?> //Please leave this for bugtracking purpose//-->
119
<div id="globalWrapper" class="<?php echo $action ?>">
120
  <div id="p-personal" class="portlet">
121
      <h5><?php $this->msg('personaltools') ?></h5>
122
      <div class="pBody">
123
          <ul <?php $this->html('userlangattributes') ?>>
124
          <?php foreach($this->data['personal_urls'] as $key => $item) {?>
125
          
126
          <li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>" class="<?php
127
                  if ($item['active']) { ?>active <?php } ?>top-nav-element">
128
              <span class="top-nav-left">&nbsp;</span>
129
              <a class="top-nav-mid <?php echo htmlspecialchars($item['class']) ?>" 
130
                 href="<?php echo htmlspecialchars($item['href']) ?>">
131
                 <?php echo htmlspecialchars($item['text']) ?></a>    
132
              <span class="top-nav-right">&nbsp;</span></li>
133
              <?php
134
              } ?>
135
          
136
          </ul>
137
      </div>
138
  </div>
139
  <div id="header">
140
      <a name="top" id="contentTop"></a>
141
      <h6>
142
      <a
143
      href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
144
      title="<?php $this->msg('mainpage') ?>"><?php $this->text('pagetitle') ?></a></h6>
145
      <div id="p-cactions" class="portlet"><ul>
146
<?php         foreach($this->data['content_actions'] as $key => $tab) {
147
                  echo '
148
              <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
149
                  if( $tab['class'] ) {
150
                      echo ' class="'.htmlspecialchars($tab['class']).'"';
151
                  }
152
                  echo '><a href="'.htmlspecialchars($tab['href']).'"';
153
                  # We don't want to give the watch tab an accesskey if the
154
                  # page is being edited, because that conflicts with the
155
                  # accesskey on the watch checkbox.  We also don't want to
156
                  # give the edit tab an accesskey, because that's fairly su-
157
                  # perfluous and conflicts with an accesskey (Ctrl-E) often
158
                  # used for editing in Safari.
159
                  if( in_array( $action, array( 'edit', 'submit' ) ) && in_array( $key, array( 'edit', 'watch', 'unwatch' ) ) ) {
160
                      echo $skin->tooltip( "ca-$key" );
161
                  }
162
                  else {
163
                      echo $skin->tooltip( "ca-$key" );
164
                  }
165
                  echo '>'.htmlspecialchars($tab['text']).'</a></li>';
166
              }
167
                              
168
              ?>
169
          </ul></div>
170
          <?php $this->searchBox(); ?>
171
  </div>
172
  <div id="mBody">
173
      <div id="side">
174
          <div id="nav">
175
<?php
176
      $sidebar = $this->data['sidebar'];
177
      if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
178
      if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
179
      if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
180
      foreach ($sidebar as $boxName => $cont) {
181
          if ( $boxName == 'SEARCH' ) {
182
//                $this->searchBox(); 
183
          } elseif ( $boxName == 'TOOLBOX' ) {
184
              $this->toolbox();
185
          } elseif ( $boxName == 'LANGUAGES' ) {
186
              $this->languageBox();
187
          } else {
188
              $this->customBox( $boxName, $cont );
189
          }
190
      }
191
      ?>
192
</div>
193
</div>
194
      </div><!-- end of SIDE div -->
195
      <div id="column-content">
196
          <div id="content">
197
              <a id="top"></a>
198
              <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
199
              <h1 id="firstHeading" class="firstHeading"><?php $this->html('title') ?></h1>
200
              <div id="bodyContent">
201
                  <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
202
                  <div id="contentSub"><?php $this->html('subtitle') ?></div>
203
                  <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
204
                  <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk')  ?></div><?php } ?>
205
                  <?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 } ?>
206
                  <!-- start content -->
207
                  <?php $this->html('bodytext') ?>
208
                  <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
209
                  <!-- end content -->
210
                  <?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?>
211
              </div>
212
          </div><!-- end of MAINCONTENT div -->   
213
      </div>
214
  </div><!-- end of MBODY div -->
215
  <div class="visualClear"></div>
216
  <div id="footer">
217
      <table>
218
          <!--<tr><td colspan="3"><a href="#internal">Up</a></td></tr>-->
219
          <tr>
220
              <td rowspan="2" class="f-iconsection">
221
      <?php if($this->data['copyrightico']) { ?><div id="f-copyrightico"><?php $this->html('copyrightico') ?></div><?php } ?>
222
              </td>
223
              <td align="center">
224
<?php // Generate additional footer links
225
      $footerlinks = array(
226
          'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
227
          'privacy', 'about', 'disclaimer', 'tagline',
228
      );
229
      $validFooterLinks = array();
230
      foreach( $footerlinks as $aLink ) {
231
          if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
232
              $validFooterLinks[] = $aLink;
233
          }
234
      }
235
      if ( count( $validFooterLinks ) > 0 ) {
236
?>            <ul id="f-list">
237
<?php
238
          foreach( $validFooterLinks as $aLink ) {
239
              if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
240
?>                    <li id="f-<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
241
<?php             }
242
          }
243
      }
244
?></ul></td>
245
              <td rowspan="2" class="f-iconsection">
246
                  <?php
247
                  $validFooterIcons = $this->getFooterIcons( "nocopyright" );
248
                  foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?>
249
                          <div id="f-<?php echo htmlspecialchars($blockName); ?>ico"><?php
250
                      foreach ( $footerIcons as $icon ) {
251
                          echo $this->skin->makeFooterIcon( $icon );
252
                          }
253
                  }
254
                  ?></div>
255
              </td>
256
          </tr>
257
          <tr>
258
              <td><div id="skin-info">
259
                  Mozilla Cavendish Theme based on Cavendish style by Gabriel Wicke modified by <a href="http://www.dasch-tour.de" target="_blank">DaSch</a> for the <a href="http://www.wecowi.de/">Web Community Wiki</a><br/>
260
                  <a href="http://sourceforge.net/projects/wecowi/">Sourceforge Projectpage</a> &ndash; <a href="https://sourceforge.net/tracker/?group_id=256816&atid=3135768">Report Bug</a> &ndash; Skin-Version: <?php echo $styleversion ?>
261
              </div></td>
262
          </tr>
263
      </table>
264
  </div><!-- end of the FOOTER div -->
265
</div><!-- end of the CONTAINER div -->
266
<!-- scripts and debugging information -->
267
<?php
268
269
      $this->printTrail();
270
      echo Html::closeElement( 'body' );
271
      echo Html::closeElement( 'html' );
272
      wfRestoreWarnings();
273
  }
274
} // end of class

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks