Commit 01f89709 authored by Robert Lyon's avatar Robert Lyon Committed by Aaron Wells

Bug 739528, Bug 1515826: Adding actual theme css files

And getting them to display in the export html files

behatnotneeded

Change-Id: I881817dfb94d78a1fd2ac8b0e85b3ebed83b42cf
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent a917f2d9
......@@ -67,12 +67,26 @@ class PluginExportHtml extends PluginExport {
. $this->get('user')->get('id') . '-' . $this->exporttime . '.zip';
// Find what stylesheets need to be included
$themedirs = $THEME->get_path('', true, 'export/html');
$stylesheets = array('style.css', 'jquery.rating.css');
$themedirs = $THEME->get_path('', true);
foreach ($themedirs as $theme => $themedir) {
foreach ($stylesheets as $stylesheet) {
if (is_readable($themedir . 'style/' . $stylesheet)) {
array_unshift($this->stylesheets[''], 'theme/' . $theme . '/style/' . $stylesheet);
if (is_readable($themedir . 'style/')) {
$files = scandir($themedir . 'style/');
foreach ($files as $stylesheet) {
if (substr_count($stylesheet, '.css') > 0) {
array_unshift($this->stylesheets[''], 'theme/' . $theme . '/static/style/' . $stylesheet);
}
}
}
}
// Find what export plugin stylesheets need to be included
$exportthemedirs = $THEME->get_path('', true, 'export/html');
foreach ($exportthemedirs as $theme => $themedir) {
if (is_readable($themedir . 'style/')) {
$files = scandir($themedir . 'style/');
foreach ($files as $stylesheet) {
if (substr_count($stylesheet, '.css') > 0) {
array_unshift($this->stylesheets[''], 'theme/' . $theme . '/static/export/style/' . $stylesheet);
}
}
}
}
......@@ -251,7 +265,7 @@ class PluginExportHtml extends PluginExport {
$smarty->assign('export_time', $this->exporttime);
$smarty->assign('sitename', get_config('sitename'));
$smarty->assign('stylesheets', $stylesheets);
$smarty->assign('maharalogo', $rootpath . $this->theme_path('images/logo.png'));
$smarty->assign('maharalogo', $rootpath . $this->theme_path('images/site-logo.png'));
return $smarty;
}
......@@ -264,7 +278,7 @@ class PluginExportHtml extends PluginExport {
*/
private function theme_path($path) {
global $THEME;
$themestaticdirs = $THEME->get_path('', true, 'export/html');
$themestaticdirs = $THEME->get_path('', true);
foreach ($themestaticdirs as $theme => $dir) {
if (is_readable($dir . $path)) {
return 'static/theme/' . $theme . '/static/' . $path;
......@@ -499,14 +513,31 @@ class PluginExportHtml extends PluginExport {
require_once('file.php');
$staticdir = $this->get('exportdir') . '/' . $this->get('rootdir') . '/static/';
$directoriestocopy = array();
$themestaticdirs = $THEME->get_path('', true);
// Get static directories from each theme for HTML export
$themestaticdirs = $THEME->get_path('', true, 'export/html');
$statics = array('style', 'images', 'fonts', 'js');
foreach ($themestaticdirs as $theme => $dir) {
$themedir = $staticdir . 'theme/' . $theme . '/static/';
$directoriestocopy[$dir] = $themedir;
if (!check_dir_exists($themedir)) {
throw new SystemException("Could not create theme directory for theme $theme");
// Get static directories from each theme for HTML export
foreach ($statics as $static) {
$themedir = $staticdir . 'theme/' . $theme . '/static/' . $static;
if (is_readable($dir . $static)) {
$directoriestocopy[$dir . '/' . $static] = $themedir;
if (!check_dir_exists($themedir)) {
throw new SystemException("Could not create theme directory for theme $theme");
}
}
}
}
$exportthemedirs = $THEME->get_path('', true, 'export/html');
foreach ($exportthemedirs as $theme => $dir) {
foreach ($statics as $static) {
$themedir = $staticdir . 'theme/' . $theme . '/static/export/' . $static;
if (is_readable($dir . $static)) {
$directoriestocopy[$dir . '/' . $static] = $themedir;
if (!check_dir_exists($themedir)) {
throw new SystemException("Could not create theme directory for theme $theme");
}
}
}
}
......
/* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
div.rating-cancel,div.star-rating{float:left;width:19px;height:19px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
div.rating-cancel,div.rating-cancel a{background:url(../images/rating_delete.png) no-repeat 0 -19px}
div.star-rating,div.star-rating a{background:url(../images/rating_star.png) no-repeat 0 0px}
div.rating-cancel a,div.star-rating a{display:block;width:19px;height:100%;background-position:0 0px;border:0}
div.star-rating-on a{background-position:0 -19px!important}
div.star-rating-hover a{background-position:0 -38px}
/* Read Only CSS */
div.star-rating-readonly a{cursor:default !important}
/* Partial Star CSS */
div.star-rating{background:transparent!important;overflow:hidden!important}
/* END jQuery.Rating Plugin CSS */
\ No newline at end of file
......@@ -3,8 +3,8 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<title>{str tag=usersportfolio section=export.html args=$user|full_name|escape}</title>
<link rel="stylesheet" type="text/css" href="{$rootpath}static/views.css">
{foreach from=$stylesheets item=sheet}
<link rel="stylesheet" type="text/css" href="{$rootpath}static/{$sheet}">
{/foreach}
</head>
<body>
......
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