+++ /dev/null
-<?php
-// CardSet is a widget for displaying a stack of cards, e.g. for
-// user preferences. It is skinnable by overloading.
-// Default CardSet uses fieldsets for the cards,
-// the derived class TabbedCardSet uses JavaScript-based tabs
-//
-// Usage:
-// First, create a CardSet using the constructor
-// Then, add cards to it
-// Finally Render to get the HTML
-
-class CardSet {
-
- /* private */ var $mLabels, // Array of card labels
- $mBodies, // Array of card bodies
- $mTitle; // Title of this stack
-
- // Initialize an empty CardSet.
- function CardSet( $title )
- {
- $this->mLabels = array();
- $this->mBodies = array();
- $this->mTitle = $title;
- }
-
- // Add a card to the set. The body of the card is expected to be
- // HTML, not wikitext.
- function addCard( $label, $body )
- {
- $this->mLabels[] = $label;
- $this->mBodies[] = $body;
- }
-
- // Return the HTML of this CardSet
- function renderToOutpage( &$out )
- {
- for ( $i=0; $i<count( $this->mLabels ); $i++ )
- {
- $s .= "<fieldset>\n<legend>" . $this->mLabels[$i] . "</legend>\n"
- . $this->mBodies[$i] . "</fieldset>\n";
- }
-
- $out->addHTML( $s );
- }
-
-} // end of: class CardSet
-
-?>
require_once( "Feed.php" );
require_once( "Image.php" );
-require_once( "CardSet.php" );
# See skin.doc
return $toolbar;
}
- // Return a new cardset.
- // By overloading this function, Skins can alter the appearance of e.g. the preferences
- function newCardSet( $title = "")
- {
- return new CardSet( $title );
- }
}
require_once( "SkinStandard.php" );
+++ /dev/null
-<?php
-// CardSet is a widget for displaying a stack of cards, e.g. for
-// user preferences. It is skinnable by overloading.
-// Default CardSet uses fieldsets for the cards,
-// the derived class TabbedCardSet uses JavaScript-based tabs
-//
-// Usage:
-// First, create a CardSet using the constructor
-// Then, add cards to it
-// Finally Render to get the HTML
-
-class TabbedCardSet extends CardSet {
-
- // Return the HTML of this CardSet
- function renderToOutpage( &$out )
- {
- $s = "<div id=\"column-content\"><div id=\"content\">\n";
-
- for ( $i=0; $i<count( $this->mLabels ); $i++ )
- {
- $s .= "<div class=\"usage\" id=\"area{$i}\"><div id=\"subheading{$i}\"><h2><a id=\"card{$i}\"></a>".
- $this->mLabels[$i] . "</h2></div>" . $this->mBodies[$i] . "</div>\n\n";
- }
- $s .= "</div></div>\n\n<div id=\"bar\"><div id=\"p-cactions\" class=\"portlet\">\n<ul>\n";
-
- for ( $i=0; $i<count( $this->mLabels ); $i++ )
- {
- $selected = ($i==0 ? "class=\"selected\"" : "");
- $s .= "<li id=\"tab{$i}\" {$selected} onclick=\"chgArea({$i},this);\"
- onmouseover=\"hilight({$i});\" onmouseout=\"if(prev!={$i}){hilight(this,-1);}\"><a href=\"#card{$i}\">".
- $this->mLabels[$i] . "</a></li>";
- }
-
- $s .= "</ul></div></div>\n\n";
-
- $out->addScript("
- <script>
- var elements=". count( $this->mLabels ) .";
- var prev=-1;
-
- function hideall(){
- for(i=0; i<elements; i++){document.getElementById('area'+i).style.display='none';}
- document.getElementById('bar').style.display='inline';
- }
-
- function chgArea(n,obj){
- if(prev>=0){
- hilight( document.getElementById('tab'+prev) , -1);
- document.getElementById('area'+prev).style.display='none';
- }
- hilight(obj,n);
-
- document.getElementById('area'+n).style.display='inline';
- prev=n ;
- }
-
- function hilight(obj,n){
- if (n<0) { obj.className=\"\"; }
- else { obj.className=\"selected\"; }
- }
- function inittabs(){
- hideall();
- chgArea(0,document.getElementById('tab0'));
- }
- </script>
- " );
-
- $out->setOnloadHandler( $out->getOnloadHandler() . "inittabs();" );
- $out->addHTML( $s );
- }
-
-} // end of: class CardSet
-
-?>