Skip to content

Commit

Permalink
Formal_white for 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabix committed Jul 6, 2010
1 parent 1ce5163 commit 57bfc29
Show file tree
Hide file tree
Showing 29 changed files with 1,156 additions and 0 deletions.
132 changes: 132 additions & 0 deletions theme/formal_white/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?php

////////////////////////////////////////////////////////////////////////////////
/// This file contains a few configuration variables that control
/// how Moodle uses this theme.
////////////////////////////////////////////////////////////////////////////////

// The name of our theme
$THEME->name = 'formal_white';


$THEME->sheets = array('dock','base','general','fw_corners','formalwhite','settings');
$layoutpage = 'general.php';
/// This variable is an array containing the names of all the
/// stylesheet files you want included in this theme, and in what order
////////////////////////////////////////////////////////////////////////////////

$THEME->parents = array('base'); // TODO: new themes can not be based on standardold, instead use 'base' as the base
/// This variable can be set to the name of a parent theme
/// which you want to have included before the current theme.
/// This can make it easy to make modifications to another
/// theme without having to actually change the files
/// If this variable is empty or false then a parent theme
/// is not used.
////////////////////////////////////////////////////////////////////////////////

$THEME->parents_exclude_sheets = array('base'=>array('styles_moz'));

$THEME->resource_mp3player_colors =
'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
'font=Arial&fontColour=3333FF&buffer=10&waitForPlay=no&autoPlay=yes';
/// With this you can control the colours of the "big" MP3 player
/// that is used for MP3 resources.


$THEME->filter_mediaplugin_colors =
'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
'waitForPlay=yes';
/// ...And this controls the small embedded player

$THEME->editor_sheets = array('styles_tinymce');

$THEME->layouts = array(
// Most pages - if we encounter an unknown or a missing page type, this one is used.
'base' => array(
'file' => $layoutpage,
'regions' => array()
),
'standard' => array(
'file' => $layoutpage,
'regions' => array('side-pre'),
'defaultregion' => 'side-post'
),
// Course page
'course' => array(
'file' => $layoutpage,
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post'
),
// Course page
'coursecategory' => array(
'file' => $layoutpage,
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post'
),
'incourse' => array(
'file' => $layoutpage,
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post'
),
'frontpage' => array(
'file' => $layoutpage,
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-pre'
),
'admin' => array(
'file' => $layoutpage,
'regions' => array('side-pre'),
'defaultregion' => 'side-pre'
),
'mydashboard' => array(
'file' => $layoutpage,
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post'
),
'mypublic' => array(
'file' => $layoutpage,
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post'
),
'login' => array(
'file' => $layoutpage,
'regions' => array()
),
// Pages that appear in pop-up windows - no navigation, no blocks, no header.
'popup' => array(
'file' => $layoutpage,
'regions' => array(),
'options' => array('nofooter'=>true, 'nonavbar'=>true, 'noblocks'=>true),
),
// No blocks and minimal footer - used for legacy frame layouts only!
'frametop' => array(
'file' => $layoutpage,
'regions' => array(),
'options' => array('nofooter', 'noblocks'=>true),
),
// Embeded pages, like iframe embeded in moodleform
'embedded' => array(
'file' => $layoutpage,
'regions' => array(),
'options' => array('nofooter'=>true, 'nonavbar'=>true, 'noblocks'=>true),
),
// Used during upgrade and install, and for the 'This site is undergoing maintenance' message.
// This must not have any blocks, and it is good idea if it does not have links to
// other places - for example there should not be a home link in the footer...
'maintenance' => array(
'file' => $layoutpage,
'regions' => array(),
'options' => array('nofooter'=>true, 'nonavbar'=>true, 'noblocks'=>true),
)
);

$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->enable_dock = true;
$THEME->javascripts_footer = array('navigation');

/**
* Sets the function that will replace our settings within the CSS
*/
$THEME->csspostprocess = 'formalwhite_process_css';
154 changes: 154 additions & 0 deletions theme/formal_white/javascript/navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
/**
* Customises the dock for the fw theme and does some other cool stuff
*/
function customise_dock_for_theme() {
// If we don't have M.core_dock or Y then bail
if (!M.core_dock) {
return false;
}
// Change the defautl remove all icon to work with our black dock
M.core_dock.cfg.display.removeallicon = M.util.image_url('dock_removeall', 'theme');

// On draw completed add the ability to move the dock to from the left to the right
M.core_dock.on('dock:drawcompleted', fw.dock.enable_side_switching, fw.dock);
// When the dock is first drawn check to see if it should be moved
M.core_dock.on('dock:drawstarted', fw.dock.check_initial_position, fw.dock);
// Corrects the panel x position for the theme
M.core_dock.on('dock:itemadded', function(item) {
item.on('dockeditem:showstart', fw.dock.correct_panel_x_position, fw.dock, item);
item.on('dockeditem:resizecomplete', fw.dock.correct_panel_x_position, fw.dock, item);
});

// Override the default fix_title_orientation method with our fw method
// this will use SVG and rotate the text if possible.
M.core_dock.genericblock.prototype.fix_title_orientation = fw.dock.fix_title_orientation;
M.core_dock.genericblock.prototype.resize_block_space = fw.dock.resize_block_space;
return true;
}

var fw = (function(){
return {
namespaces : {
svg : 'http://www.w3.org/2000/svg'
},
dock : {
enable_side_switching : function() {
var movedock = M.core_dock.Y.Node.create('<img src="'+M.util.image_url('movedock', 'theme')+'" />');
var c = M.core_dock.node.one('.controls');
c.insertBefore(M.core_dock.Y.Node.create('<br />'), c.one('img'));
c.insertBefore(movedock, c.one('br'));
movedock.on('click', this.switch_dock_side);
},
correct_panel_x_position : function(item) {
var dockoffset = M.core_dock.Y.one('#dock_item_'+item.id+'_title').get('offsetWidth');
var panelwidth = M.core_dock.Y.one(item.panel.body).get('offsetWidth');
var screenwidth = parseInt(M.core_dock.Y.get(document.body).get('winWidth'));
switch (M.core_dock.cfg.position) {
case 'left':
item.panel.cfg.setProperty('x', dockoffset);
break;
case 'right':
item.panel.cfg.setProperty('x', (screenwidth-panelwidth-dockoffset-5));
break;
}
},
switch_dock_side : function () {
var oldorientation = M.core_dock.cfg.orientation;
var oldclass = M.core_dock.cfg.css.dock+'_'+M.core_dock.cfg.position+'_'+oldorientation;
switch (M.core_dock.cfg.position) {
case 'right':
M.core_dock.cfg.position = 'left';
M.core_dock.cfg.orientation = 'vertical';
break;
case 'left':
M.core_dock.cfg.position = 'right';
M.core_dock.cfg.orientation = 'vertical';
break;
}
var newclass = M.core_dock.cfg.css.dock+'_'+M.core_dock.cfg.position+'_'+M.core_dock.cfg.orientation;
M.core_dock.node.replaceClass(oldclass, newclass);
M.core_dock.Y.Cookie.set('dock_position', M.core_dock.cfg.position);
},
check_initial_position : function () {
var cookieposition = M.core_dock.Y.Cookie.get('dock_position');
if (cookieposition && cookieposition != 'null' && cookieposition !== M.core_dock.cfg.position) {
var oldclass = M.core_dock.cfg.css.dock+'_'+M.core_dock.cfg.position+'_'+M.core_dock.cfg.orientation;
M.core_dock.cfg.position = cookieposition;
if (M.core_dock.node) {
var newclass = M.core_dock.cfg.css.dock+'_'+M.core_dock.cfg.position+'_'+M.core_dock.cfg.orientation;
M.core_dock.node.replaceClass(oldclass, newclass);
}
}
},
fix_title_orientation : function (node) {
if (M.core_dock.cfg.orientation == 'vertical') {
return fw.transform.make_vertical_text(node);
}
return node;
},
resize_block_space : function (node) {
var blockregions = {
pre: {hasblocks:true,c:'side-pre-only'},
post: {hasblocks:true,c:'side-post-only'},
noblocksc:'noblocks'
}
M.core_dock.Y.all('div.block-region').each(function(blockregion){
if (blockregion.hasClass('side-pre') && blockregion.all('.block').size() == 0) {
blockregions.pre.hasblocks = false;
} else if (blockregion.hasClass('side-post') && blockregion.all('.block').size() == 0) {
blockregions.post.hasblocks = false;
}
});
if (blockregions.pre.hasblocks && blockregions.post.hasblocks) {
// No classes required both regions have blocks
M.core_dock.Y.one(document.body).removeClass(blockregions.pre.c).removeClass(blockregions.post.c).removeClass(blockregions.noblocksc);
} else if (blockregions.pre.hasblocks) {
// side-pre-only required: remove any other classes
M.core_dock.Y.one(document.body).addClass(blockregions.pre.c).removeClass(blockregions.post.c).removeClass(blockregions.noblocksc);
} else if (blockregions.post.hasblocks) {
// side-post-only required: remove any other classes
M.core_dock.Y.one(document.body).removeClass(blockregions.pre.c).addClass(blockregions.post.c).removeClass(blockregions.noblocksc);
} else {
// All blocks have been docked: add noblocks remove side-xxx-only's if set
M.core_dock.Y.one(document.body).removeClass(blockregions.pre.c).removeClass(blockregions.post.c).addClass(blockregions.noblocksc);
}
return '200px';
}
},
transform : {
make_vertical_text : function(node) {

if (YAHOO.env.ua.ie > 0) {
if (YAHOO.env.ua.ie > 7) {
node.setAttribute('style', 'writing-mode: tb-rl; filter: flipV flipH;');
} else {
node.innerHTML = node.innerHTML.replace(/(.)/g, "$1<br />");
}
return node;
}

var test = M.core_dock.Y.Node.create('<div><span>'+node.firstChild.nodeValue+'</span></div>');
M.core_dock.Y.one(document.body).append(test);
var height = test.one('span').get('offsetWidth');
test.remove();

var txt = document.createElementNS(fw.namespaces.svg, 'text');
txt.setAttribute('x', '0');
txt.setAttribute('y', '0');
txt.setAttribute('transform','rotate(90, 5, 5)');
txt.appendChild(document.createTextNode(node.firstChild.nodeValue));

var svg = document.createElementNS(fw.namespaces.svg, 'svg');
svg.setAttribute('version', '1.1');
svg.setAttribute('height', height);
svg.setAttribute('width', 30);
svg.appendChild(txt);

var div = document.createElement(node.nodeName);
div.appendChild(svg);

return div;
}
}
}
})();
48 changes: 48 additions & 0 deletions theme/formal_white/lang/en/theme_formalwhite.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Strings for component 'theme_formalwhite', language 'en', branch 'MOODLE_20_STABLE'
*
* @package theme_formalwhite
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['choosereadme'] = '<div style="text-align:center;">
<h2 style="margin-bottom:2px;">Formal White theme pack - Preview Release 1</h2>
<h3 style="margin:0">by <a href="http://www.mediatouch.it/" title="MediaTouch 2000 Moodle Partner">MediaTouch 2000 - Italian Moodle Partner</a></h3><h4 style="margin:3px">Version: 20100601</h4>
</div>
<div>&nbsp;</div>
<h3 style="margin-bottom:5px; margin-top:5px;">Formal White for Moodle 2.0 - Preview Release 1</h3>
<p>Meadiatouch is pleased to announce that the first pre-release of its famous and worldwide adopted "Formal white" theme has been finally made available for Moodle 2</p>
<h3 style="margin-bottom:5px; margin-top:5px;">Licensing</h3>
<p>This theme is licensed under <a href="http://docs.moodle.org/en/License">Moodle\'s GNU General Public License</a>. Feel free to use it, share it and edit it to fit your needs.</p>
<p>Enjoy this theme.</p>';
$string['pluginname'] = 'Formal white';

$string['backgroundcolor'] = 'Blocks background colour';
$string['backgroundcolordesc'] = 'This sets the blocks background colour for the theme.';
$string['configtitle'] = 'Formalwhite settings';
$string['customcss'] = 'Custom CSS';
$string['customcssdesc'] = 'Any CSS you enter here will be added to every page allowing your to easily customise this theme.';
$string['footnote'] = 'Footnote';
$string['footnotedesc'] = 'The content from this textarea will be displayed in the footer of every page.';
$string['logo'] = 'Logo';
$string['logodesc'] = 'Enter the URL to an image to use as the logo for this site. Should be http://www.yoursite.com/path/to/logo.png<br />Preferred picture height is 100 pixels';
$string['regionwidth'] = 'Column width';
$string['regionwidthdesc'] = 'This sets the width of the two block regions that form the left and right columns.';
48 changes: 48 additions & 0 deletions theme/formal_white/lang/it/theme_formalwhite.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Strings for component 'theme_formalwhite', language 'it', branch 'MOODLE_20_STABLE'
*
* @package theme_formalwhite
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['choosereadme'] = '<div style="text-align:center;">
<h2 style="margin-bottom:2px;">Formal white - Versione preliminare 1.0</h2>
<h3 style="margin:0">by <a href="http://www.mediatouch.it/" title="MediaTouch 2000 Moodle Partner">MediaTouch 2000 Moodle Partner per l\'Italia</a></h3><h4 style="margin:3px">Version: 20100601</h4>
</div>
<div>&nbsp;</div>
<h3 style="margin-bottom:5px; margin-top:5px;">Formal white for Moodle 2.0 - Versione preliminare 1.0</h3>
<p>Meadiatouch ha il piacere di annunciare che la prima versione preliminare del famoso tema "Formal white", già adottato in innumerevoli realtà a livello modiale nella versione per moodle 1.x, è finalmente disponibile per Moodle 2</p>
<h3 style="margin-bottom:5px; margin-top:5px;">Licensing</h3>
<p>Questo tema è tutelato dalle stesse condizioni della licenza di <a href="http://docs.moodle.org/en/License">Moodle - GNU General Public License</a>. Sentiti libero di utilizzare, condividere e modificare a tuo piacimento questo tema.</p>
<p>Madiatouch si augura che questo tema possa essere di tuo gradimento.</p>';
$string['pluginname'] = 'Formal white';

$string['backgroundcolor'] = 'Blocks background colour';
$string['backgroundcolordesc'] = 'This sets the blocks background colour for the theme.';
$string['configtitle'] = 'Formalwhite settings';
$string['customcss'] = 'Custom CSS';
$string['customcssdesc'] = 'Any CSS you enter here will be added to every page allowing your to easily customise this theme.';
$string['footnote'] = 'Footnote';
$string['footnotedesc'] = 'The content from this textarea will be displayed in the footer of every page.';
$string['logo'] = 'Logo';
$string['logodesc'] = 'Enter the URL to an image to use as the logo for this site. Should be http://www.yoursite.com/path/to/logo.png<br />La dimensione ottimale delle immagini è di 100 pixel';
$string['regionwidth'] = 'Column width';
$string['regionwidthdesc'] = 'This sets the width of the two block regions that form the left and right columns.';
Loading

0 comments on commit 57bfc29

Please sign in to comment.