Commit 63297942 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Theme overhaul, included is a new MyPortfolio theme

parent d699dd8d
...@@ -89,7 +89,7 @@ if (empty($records)) { ...@@ -89,7 +89,7 @@ if (empty($records)) {
$records = array(); $records = array();
} }
$data = array(); $data = array();
$star = theme_get_image_url('star.png'); $star = theme_get_url('star.png');
$unread = get_string('unread', 'activity'); $unread = get_string('unread', 'activity');
foreach ($records as &$r) { foreach ($records as &$r) {
......
...@@ -92,9 +92,9 @@ foreach (plugin_types() as $plugin) { ...@@ -92,9 +92,9 @@ foreach (plugin_types() as $plugin) {
} }
} }
$loadingicon = theme_get_image_url('loading.gif'); $loadingicon = theme_get_url('loading.gif');
$successicon = theme_get_image_url('success.gif'); $successicon = theme_get_url('success.gif');
$failureicon = theme_get_image_url('failure.gif'); $failureicon = theme_get_url('failure.gif');
$loadingstring = get_string('upgradeloading', 'admin'); $loadingstring = get_string('upgradeloading', 'admin');
$successstring = get_string('upgradesuccesstoversion', 'admin'); $successstring = get_string('upgradesuccesstoversion', 'admin');
......
...@@ -58,9 +58,9 @@ foreach (array_keys($alltemplates) as $t) { ...@@ -58,9 +58,9 @@ foreach (array_keys($alltemplates) as $t) {
$alltemplates[$t]['installed'] = true; $alltemplates[$t]['installed'] = true;
} }
} }
$loadingicon = theme_get_image_url('loading.gif'); $loadingicon = theme_get_url('loading.gif');
$successicon = theme_get_image_url('success.gif'); $successicon = theme_get_url('success.gif');
$failureicon = theme_get_image_url('failure.gif'); $failureicon = theme_get_url('failure.gif');
$loadingstring = get_string('upgradeloading', 'admin'); $loadingstring = get_string('upgradeloading', 'admin');
$successstring = get_string('upgradesuccess', 'admin'); $successstring = get_string('upgradesuccess', 'admin');
......
...@@ -44,9 +44,9 @@ if (!$upgrades) { ...@@ -44,9 +44,9 @@ if (!$upgrades) {
} }
$js = 'var todo = ' . json_encode(array_keys($upgrades)) . ";\n"; $js = 'var todo = ' . json_encode(array_keys($upgrades)) . ";\n";
$loadingicon = theme_get_image_url('loading.gif'); $loadingicon = theme_get_url('loading.gif');
$successicon = theme_get_image_url('success.gif'); $successicon = theme_get_url('success.gif');
$failureicon = theme_get_image_url('failure.gif'); $failureicon = theme_get_url('failure.gif');
$loadingstring = get_string('upgradeloading', 'admin'); $loadingstring = get_string('upgradeloading', 'admin');
$installsuccessstring = get_string('installsuccess', 'admin'); $installsuccessstring = get_string('installsuccess', 'admin');
......
...@@ -146,7 +146,7 @@ class Session { ...@@ -146,7 +146,7 @@ class Session {
// @todo probably should be done with MochiKit.Signal // @todo probably should be done with MochiKit.Signal
$result .= '<div class="' . $data['type'] . '">'; $result .= '<div class="' . $data['type'] . '">';
$result .= '<div class="fr"><a href="" onclick="removeElement(this.parentNode.parentNode);return false;">'; $result .= '<div class="fr"><a href="" onclick="removeElement(this.parentNode.parentNode);return false;">';
$result .= '<img src="' . theme_get_image_url('images/icon_close.gif') . '" alt="[X]"></a></div>'; $result .= '<img src="' . theme_get_url('images/icon_close.gif') . '" alt="[X]"></a></div>';
$result .= $data['msg'] . '</div>'; $result .= $data['msg'] . '</div>';
} }
$_SESSION['messages'] = array(); $_SESSION['messages'] = array();
......
...@@ -34,10 +34,10 @@ $angles = array(40, 0, 340, 20, 310); ...@@ -34,10 +34,10 @@ $angles = array(40, 0, 340, 20, 310);
$lefts = array(30, 50, 70, 95, 110); $lefts = array(30, 50, 70, 95, 110);
$bottoms = array(24, 20, 28, 34, 33); $bottoms = array(24, 20, 28, 34, 33);
$file = theme_get_image_path('images/captcha.png'); $file = theme_get_path('images/captcha.png');
$img = imagecreatefrompng($file); $img = imagecreatefrompng($file);
$black = imagecolorallocate($img, 60, 60, 60); $black = imagecolorallocate($img, 60, 60, 60);
$ttf = theme_get_image_path('captcha.ttf'); $ttf = theme_get_path('captcha.ttf');
$captcha = ''; $captcha = '';
......
...@@ -288,9 +288,16 @@ function get_themes() { ...@@ -288,9 +288,16 @@ function get_themes() {
throw new Exception('Unable to read theme directory '.$themebase); throw new Exception('Unable to read theme directory '.$themebase);
} }
while (false !== ($subdir = readdir($themedir))) { while (false !== ($subdir = readdir($themedir))) {
// Where do we get theme names from?
if ($subdir != "." && $subdir != "..") { if ($subdir != "." && $subdir != "..") {
$themes[$subdir] = get_string($subdir); $themes[$subdir] = $subdir;
$config_path = get_config('docroot') . 'theme/' . $subdir . '/config.php';
if (is_readable($config_path)) {
require_once($config_path);
if (isset($theme->name)) {
$themes[$subdir] = $theme->name;
}
}
} }
} }
closedir($themedir); closedir($themedir);
...@@ -851,7 +858,7 @@ function password_validate(Pieform $form, $values, $username, $institution) { ...@@ -851,7 +858,7 @@ function password_validate(Pieform $form, $values, $username, $institution) {
if ($values['password1'] == 'mike01' || $values['password1'] == 'mike012') { if ($values['password1'] == 'mike01' || $values['password1'] == 'mike012') {
if (!$form->get_property('jsform')) { if (!$form->get_property('jsform')) {
die_info('<img src="' die_info('<img src="'
. theme_get_image_url('images/sidebox1_corner_botright.gif') . theme_get_url('images/sidebox1_corner_botright.gif')
. '" alt="(C) 2007 MSS Enterprises"></p>'); . '" alt="(C) 2007 MSS Enterprises"></p>');
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
/** /**
* Smarty {image_path} function plugin * Smarty {theme_path} function plugin
* *
* Type: function<br> * Type: function<br>
* Name: str<br> * Name: str<br>
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
* @param Smarty * @param Smarty
* @return Internationalized string * @return Internationalized string
*/ */
function smarty_function_image_path($params, &$smarty) { function smarty_function_theme_path($params, &$smarty) {
if (!isset($params['pluginlocation'])) { if (!isset($params['pluginlocation'])) {
$params['pluginlocation'] = ''; $params['pluginlocation'] = '';
} }
return theme_get_image_url($params['imagelocation'], $params['pluginlocation']); return theme_get_url($params['location'], $params['pluginlocation']);
} }
?> ?>
...@@ -431,7 +431,7 @@ function template_render($template, $mode, $data=array(), $view_id=null) { ...@@ -431,7 +431,7 @@ function template_render($template, $mode, $data=array(), $view_id=null) {
$javascript = ''; $javascript = '';
if ($mode == TEMPLATE_RENDER_EDITMODE) { if ($mode == TEMPLATE_RENDER_EDITMODE) {
$droplist = json_encode($droplist); $droplist = json_encode($droplist);
$spinner_url = json_encode(theme_get_image_url('loading.gif')); $spinner_url = json_encode(theme_get_url('loading.gif'));
$wwwroot = get_config('wwwroot'); $wwwroot = get_config('wwwroot');
$json_emptylabel = json_encode(get_string('emptylabel', 'view')); $json_emptylabel = json_encode(get_string('emptylabel', 'view'));
......
...@@ -178,6 +178,7 @@ EOF; ...@@ -178,6 +178,7 @@ EOF;
$smarty->assign('SITEMENU', site_menu()); $smarty->assign('SITEMENU', site_menu());
} }
$smarty->assign('THEMEURL', get_config('themeurl')); $smarty->assign('THEMEURL', get_config('themeurl'));
$smarty->assign('STYLESHEETLIST', array_reverse(theme_get_url('style/style.css', null, true)));
$smarty->assign('WWWROOT', $wwwroot); $smarty->assign('WWWROOT', $wwwroot);
if (defined('TITLE')) { if (defined('TITLE')) {
...@@ -302,11 +303,12 @@ function theme_setup() { ...@@ -302,11 +303,12 @@ function theme_setup() {
} }
} }
// always put the parent at the top of the tree, unless we're already it // always put the default theme at the top of the tree, unless we're already it
if ($theme->theme != 'default') { if ($theme->theme != 'default') {
$theme->template_dir[] = get_config('docroot') . 'theme/default/templates/'; $theme->template_dir[] = get_config('docroot') . 'theme/default/templates/';
$theme->inheritance[] = $parent; $theme->inheritance[] = 'default';
} }
return $theme; return $theme;
} }
...@@ -333,14 +335,24 @@ function theme_get_parent($currtheme) { ...@@ -333,14 +335,24 @@ function theme_get_parent($currtheme) {
* @param $imagelocation path to image relative to theme/$theme/static/ * @param $imagelocation path to image relative to theme/$theme/static/
* @param $pluginlocation path to plugin relative to docroot * @param $pluginlocation path to plugin relative to docroot
*/ */
function theme_get_image_url($imagelocation, $pluginlocation='') { function theme_get_url($location, $pluginlocation='', $all = false) {
$theme = theme_setup(); $theme = theme_setup();
$list = array();
foreach ($theme->inheritance as $themedir) { foreach ($theme->inheritance as $themedir) {
if (is_readable(get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $imagelocation)) { if (is_readable(get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $location)) {
return get_config('wwwroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $imagelocation; if ($all) {
$list[] = get_config('wwwroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $location;
}
else {
return get_config('wwwroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $location;
}
} }
} }
if ($all) {
return $list;
}
return;
} }
/** /**
...@@ -349,12 +361,12 @@ function theme_get_image_url($imagelocation, $pluginlocation='') { ...@@ -349,12 +361,12 @@ function theme_get_image_url($imagelocation, $pluginlocation='') {
* @param $imagelocation path to image relative to theme/$theme/static/ * @param $imagelocation path to image relative to theme/$theme/static/
* @param $pluginlocation path to plugin relative to docroot * @param $pluginlocation path to plugin relative to docroot
*/ */
function theme_get_image_path($imagelocation, $pluginlocation='') { function theme_get_path($location, $pluginlocation='') {
$theme = theme_setup(); $theme = theme_setup();
foreach ($theme->inheritance as $themedir) { foreach ($theme->inheritance as $themedir) {
if (is_readable(get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $imagelocation)) { if (is_readable(get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $location)) {
return get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $imagelocation; return get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $location;
} }
} }
} }
...@@ -1175,7 +1187,7 @@ function searchform() { ...@@ -1175,7 +1187,7 @@ function searchform() {
), ),
'submit' => array( 'submit' => array(
'type' => 'image', 'type' => 'image',
'src' => theme_get_image_url('images/btn_search_off.gif') 'src' => theme_get_url('images/btn_search_off.gif')
) )
) )
)); ));
......
<?php
$theme = new StdClass;
$theme->name = 'Default';
?>
...@@ -201,12 +201,6 @@ tr.required th { ...@@ -201,12 +201,6 @@ tr.required th {
background: #FFFFFF url(../images/header_corner_topleft.gif) no-repeat top left; background: #FFFFFF url(../images/header_corner_topleft.gif) no-repeat top left;
} }
/* header for myportfolio (remember to change logo in header.tpl to logo_myportfolio.gif)
#header {
background: #FFFFFF url(../images/header_myportfolio.gif) no-repeat top left;
}*/
#logo { #logo {
padding: 10px; padding: 10px;
} }
......
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
<tr class="{cycle values=r1,r0}"> <tr class="{cycle values=r1,r0}">
<td>{$name}</td> <td>{$name}</td>
<td>{if $template.installed} <td>{if $template.installed}
<img id="{$name}.status" alt="{str tag='yes'}" src="{image_path imagelocation='success.gif}" /> <img id="{$name}.status" alt="{str tag='yes'}" src="{theme_path location='success.gif}" />
{if !$template.error} {if !$template.error}
<a href="" onClick="{$installlink}('{$name}'); return false;" id="admintemplates_reinstall">{str tag='reinstall' section='admin'}</a> <a href="" onClick="{$installlink}('{$name}'); return false;" id="admintemplates_reinstall">{str tag='reinstall' section='admin'}</a>
<span id="{$name}.message"></span> <span id="{$name}.message"></span>
{/if} {/if}
{else} {else}
<img id="{$name}.status" alt="{str tag='yes'}" src="{image_path imagelocation='failure.gif}" /> <img id="{$name}.status" alt="{str tag='yes'}" src="{theme_path location='failure.gif}" />
{if !$template.installed && !$template.error} {if !$template.installed && !$template.error}
<a href="" onClick="{$installlink}('{$name}'); return false;" id="admintemplates_install">{str tag='install' section='admin'}</a> <a href="" onClick="{$installlink}('{$name}'); return false;" id="admintemplates_install">{str tag='install' section='admin'}</a>
<span id="{$name}.message"></span> <span id="{$name}.message"></span>
......
</div> </div>
<div id="footer"> <div id="footer">
<div class="footerright"><img src="{image_path imagelocation='images/footer_navbg_right.gif'}" border="0" alt=""></div> <div class="footerright"><img src="{theme_path location='images/footer_navbg_right.gif'}" border="0" alt=""></div>
<a href="http://mahara.org/">Mahara</a> {if $releaseargs}{str section=admin tag=release args=$releaseargs}{/if}, &copy; 2006 onwards, <a href="http://catalyst.net.nz/">Catalyst IT Ltd</a> <a href="http://mahara.org/">Mahara</a> {if $releaseargs}{str section=admin tag=release args=$releaseargs}{/if}, &copy; 2006 onwards, <a href="http://catalyst.net.nz/">Catalyst IT Ltd</a>
</div> </div>
<div class="housekeeping"></div> <div class="housekeeping"></div>
</div> </div>
<div id="bottom-corners"> <div id="bottom-corners">
<span class="footer-left"><img src="{image_path imagelocation='images/footer_corner_botleft.gif'}" border="0" alt=""></span><span class="footer-right"><img src="{image_path imagelocation='images/footer_corner_botright.gif'}" border="0" alt=""></span> <span class="footer-left"><img src="{theme_path location='images/footer_corner_botleft.gif'}" border="0" alt=""></span><span class="footer-right"><img src="{theme_path location='images/footer_corner_botright.gif'}" border="0" alt=""></span>
</div> </div>
</body> </body>
</html> </html>
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
{/foreach} {/foreach}
</ul> </ul>
{/if} {/if}
<div class="loginbox-botcorners"><img src="{image_path imagelocation='images/sidebox_bot.gif'}" border="0" alt=""></div> <div class="loginbox-botcorners"><img src="{theme_path location='images/sidebox_bot.gif'}" border="0" alt=""></div>
</div> </div>
</div> </div>
<div id="footer"> <div id="footer">
<div class="footerright"><img src="{image_path imagelocation='images/footer_navbg_right.gif'}" border="0" alt=""></div> <div class="footerright"><img src="{theme_path location='images/footer_navbg_right.gif'}" border="0" alt=""></div>
<a href="{$WWWROOT}terms.php">{str tag=termsandconditions}</a> | <a href="{$WWWROOT}terms.php">{str tag=termsandconditions}</a> |
<a href="{$WWWROOT}privacy.php">{str tag=privacystatement}</a> | <a href="{$WWWROOT}privacy.php">{str tag=privacystatement}</a> |
<a href="{$WWWROOT}about.php">{str tag=about}</a> | <a href="{$WWWROOT}about.php">{str tag=about}</a> |
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</div> </div>
</div> </div>
<div id="bottom-corners"> <div id="bottom-corners">
<div class="footer-left"><img src="{image_path imagelocation='images/footer_corner_botleft.gif'}" border="0" alt=""></div><div class="footer-right"><img src="{image_path imagelocation='images/footer_corner_botright.gif'}" border="0" alt=""></div> <div class="footer-left"><img src="{theme_path location='images/footer_corner_botleft.gif'}" border="0" alt=""></div><div class="footer-right"><img src="{theme_path location='images/footer_corner_botright.gif'}" border="0" alt=""></div>
</div> </div>
</div> </div>
</body> </body>
......
...@@ -18,9 +18,11 @@ ...@@ -18,9 +18,11 @@
</script> </script>
{/if} {/if}
<script type="text/javascript" src="/js/pieforms.js"></script> <script type="text/javascript" src="/js/pieforms.js"></script>
<link rel="stylesheet" type="text/css" href="{$THEMEURL}style/style.css"> {foreach from=$STYLESHEETLIST item=cssurl}
<link rel="stylesheet" type="text/css" href="{$THEMEURL}style/dev.css"> <link rel="stylesheet" type="text/css" href="{$cssurl}">
<link rel="stylesheet" type="text/css" href="{$THEMEURL}style/print.css" media="print"> {/foreach}
<link rel="stylesheet" type="text/css" href="{theme_path location='style/dev.css'}">
<link rel="stylesheet" type="text/css" href="{theme_path location='style/print.css'}" media="print">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
</head> </head>
<body> <body>
...@@ -43,7 +45,7 @@ ...@@ -43,7 +45,7 @@
</div> </div>
{/if} {/if}
<div id="header"> <div id="header">
<div class="fr"><img src="{image_path imagelocation='images/header_corner_topright.gif'}" border="0" alt=""></div> <div class="fr"><img src="{theme_path location='images/header_corner_topright.gif'}" border="0" alt=""></div>
<table cellspacing="0" class="searchbox fr"> <table cellspacing="0" class="searchbox fr">
{if !$nosearch && $LOGGEDIN} {if !$nosearch && $LOGGEDIN}
...@@ -62,14 +64,14 @@ ...@@ -62,14 +64,14 @@
</table> </table>
<div id="logo"><a href="{$WWWROOT}"><img src="{image_path imagelocation='images/logo_mahara.gif'}" border="0" alt=""></a></div> <div id="logo"><a href="{$WWWROOT}"><img src="{theme_path location='images/logo_mahara.gif'}" border="0" alt=""></a></div>
<h1 class="hiddenStructure"><a href="{$WWWROOT}">{$heading|default:"Mahara"|escape}</a></h1> <h1 class="hiddenStructure"><a href="{$WWWROOT}">{$heading|default:"Mahara"|escape}</a></h1>
</div> </div>
</div> </div>
<div id="mainwrapper"> <div id="mainwrapper">
{if $MAINNAV} {if $MAINNAV}
<ul id="mainnav"><div class="mainnavright"><img src="{image_path imagelocation='images/navbg_right.gif'}" border="0" alt=""></div> <ul id="mainnav"><div class="mainnavright"><img src="{theme_path location='images/navbg_right.gif'}" border="0" alt=""></div>
{foreach from=$MAINNAV item=item} {foreach from=$MAINNAV item=item}
{if $item.selected}{assign var=MAINNAVSELECTED value=$item} {if $item.selected}{assign var=MAINNAVSELECTED value=$item}
<li class="selected"><a href="{$item.link|escape}">{str section=$item.section tag=$item.name}</a></li> <li class="selected"><a href="{$item.link|escape}">{str section=$item.section tag=$item.name}</a></li>
...@@ -80,7 +82,7 @@ ...@@ -80,7 +82,7 @@
</ul> </ul>
{if $MAINNAVSELECTED.submenu} {if $MAINNAVSELECTED.submenu}
<ul id="subnav"><div class="subnavright"><img src="{image_path imagelocation='images/subnavbg_right.gif'}" border="0" alt=""></div> <ul id="subnav"><div class="subnavright"><img src="{theme_path location='images/subnavbg_right.gif'}" border="0" alt=""></div>
{foreach from=$MAINNAVSELECTED.submenu item=item} {foreach from=$MAINNAVSELECTED.submenu item=item}
<li{if $item.selected} class="selected"{/if}><a href="{$item.link|escape}">{str section=$item.section tag=$item.name}</a></li> <li{if $item.selected} class="selected"{/if}><a href="{$item.link|escape}">{str section=$item.section tag=$item.name}</a></li>
{/foreach} {/foreach}
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div id="loginbox"> <div id="loginbox">
<noscript><p>{str tag="javascriptnotenabled"}</p></noscript> <noscript><p>{str tag="javascriptnotenabled"}</p></noscript>
{$login_form} {$login_form}
<div class="sidebar-botcorners"><img src="{image_path imagelocation='images/sidebox_bot.gif'}" border="0" alt=""></div> <div class="sidebar-botcorners"><img src="{theme_path location='images/sidebox_bot.gif'}" border="0" alt=""></div>
</div> </div>
{/if} {/if}
{include file="adminmenu.tpl"} {include file="adminmenu.tpl"}
......
...@@ -18,6 +18,6 @@ ...@@ -18,6 +18,6 @@
<span id="quota_percentage">{$QUOTA_PERCENTAGE}%</span> <span id="quota_percentage">{$QUOTA_PERCENTAGE}%</span>
</p> </p>
{/if} {/if}
<div class="loginbox-botcorners"><img src="{image_path imagelocation='images/sidebox_bot.gif'}" border="0" alt=""></div> <div class="loginbox-botcorners"><img src="{theme_path location='images/sidebox_bot.gif'}" border="0" alt=""></div>
</div> </div>
{/if} {/if}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div id="column-right"> <div id="column-right">
<div class="sidebarforgotpassword"><a href="{$WWWROOT}forgotpass.php">{str tag=forgotpassword}</a></div> <div class="sidebarforgotpassword"><a href="{$WWWROOT}forgotpass.php">{str tag=forgotpassword}</a></div>
<div class="sidebarforgotpassword-botcorners"><img src="{image_path imagelocation='images/sidebox_bot.gif'}" border="0" alt=""></div> <div class="sidebarforgotpassword-botcorners"><img src="{theme_path location='images/sidebox_bot.gif'}" border="0" alt=""></div>
{include file="adminmenu.tpl"} {include file="adminmenu.tpl"}
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment