Commit 568062c4 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 739528, Bug 1515826: Adding actual theme css files"

parents 8e4e4e3f 01f89709
...@@ -67,12 +67,26 @@ class PluginExportHtml extends PluginExport { ...@@ -67,12 +67,26 @@ class PluginExportHtml extends PluginExport {
. $this->get('user')->get('id') . '-' . $this->exporttime . '.zip'; . $this->get('user')->get('id') . '-' . $this->exporttime . '.zip';
// Find what stylesheets need to be included // Find what stylesheets need to be included
$themedirs = $THEME->get_path('', true, 'export/html'); $themedirs = $THEME->get_path('', true);
$stylesheets = array('style.css', 'jquery.rating.css');
foreach ($themedirs as $theme => $themedir) { foreach ($themedirs as $theme => $themedir) {
foreach ($stylesheets as $stylesheet) { if (is_readable($themedir . 'style/')) {
if (is_readable($themedir . 'style/' . $stylesheet)) { $files = scandir($themedir . 'style/');
array_unshift($this->stylesheets[''], 'theme/' . $theme . '/style/' . $stylesheet); 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 { ...@@ -251,7 +265,7 @@ class PluginExportHtml extends PluginExport {
$smarty->assign('export_time', $this->exporttime); $smarty->assign('export_time', $this->exporttime);
$smarty->assign('sitename', get_config('sitename')); $smarty->assign('sitename', get_config('sitename'));
$smarty->assign('stylesheets', $stylesheets); $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; return $smarty;
} }
...@@ -264,7 +278,7 @@ class PluginExportHtml extends PluginExport { ...@@ -264,7 +278,7 @@ class PluginExportHtml extends PluginExport {
*/ */
private function theme_path($path) { private function theme_path($path) {
global $THEME; global $THEME;
$themestaticdirs = $THEME->get_path('', true, 'export/html'); $themestaticdirs = $THEME->get_path('', true);
foreach ($themestaticdirs as $theme => $dir) { foreach ($themestaticdirs as $theme => $dir) {
if (is_readable($dir . $path)) { if (is_readable($dir . $path)) {
return 'static/theme/' . $theme . '/static/' . $path; return 'static/theme/' . $theme . '/static/' . $path;
...@@ -499,14 +513,31 @@ class PluginExportHtml extends PluginExport { ...@@ -499,14 +513,31 @@ class PluginExportHtml extends PluginExport {
require_once('file.php'); require_once('file.php');
$staticdir = $this->get('exportdir') . '/' . $this->get('rootdir') . '/static/'; $staticdir = $this->get('exportdir') . '/' . $this->get('rootdir') . '/static/';
$directoriestocopy = array(); $directoriestocopy = array();
$themestaticdirs = $THEME->get_path('', true);
// Get static directories from each theme for HTML export $statics = array('style', 'images', 'fonts', 'js');
$themestaticdirs = $THEME->get_path('', true, 'export/html');
foreach ($themestaticdirs as $theme => $dir) { foreach ($themestaticdirs as $theme => $dir) {
$themedir = $staticdir . 'theme/' . $theme . '/static/'; // Get static directories from each theme for HTML export
$directoriestocopy[$dir] = $themedir; foreach ($statics as $static) {
if (!check_dir_exists($themedir)) { $themedir = $staticdir . 'theme/' . $theme . '/static/' . $static;
throw new SystemException("Could not create theme directory for theme $theme"); 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 @@ ...@@ -3,8 +3,8 @@
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<title>{str tag=usersportfolio section=export.html args=$user|full_name|escape}</title> <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} {foreach from=$stylesheets item=sheet}
<link rel="stylesheet" type="text/css" href="{$rootpath}static/{$sheet}">
{/foreach} {/foreach}
</head> </head>
<body> <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