Commit 68facdda authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge changes from topic 'WR 314864'

* changes:
  Bug 1835869: Remove obsolete skin options
  Bug 1835869: Add skin background image to page header area
  Bug 1844953: Make the font specimens appear in modal
  Bug 1843202: Allow theme fonts to be included in skin_fonts table
parents e8475a33 0e0ef413
......@@ -32,7 +32,12 @@ if (!empty($font)) {
$fontdata = get_record('skin_fonts', 'name', $font);
$fonttitle = $fontdata->title;
if (!empty($fontdata->licence) && !is_null($fontdata->licence)) {
if (preg_match('/^t_(.*)/', $fontdata->fonttype, $matches)) {
$fontpath = get_config('wwwroot') . 'theme/' . $matches[1] . '/fonts/' . strtolower($fontdata->name) . '/';
}
else {
$fontpath = get_config('wwwroot') . 'skins/fonts/' . $fontdata->name . '/';
}
$fontlicence = '<a href="' . $fontpath . $fontdata->licence . '">' . get_string('fontlicence', 'skin') . '</a>';
}
else {
......@@ -49,7 +54,10 @@ $smarty->assign('fonttitle', $fonttitle);
$smarty->assign('fontlicence', $fontlicence);
$specimen = $smarty->fetch('skin/specimen.tpl');
header('Content-type: text/html');
echo $specimen;
exit;
json_reply(false, array(
'message' => null,
'data' => array(
'font' => $font,
'html' => $specimen
)
));
......@@ -48,7 +48,6 @@ $pagination = build_pagination(array(
'count' => $data->count,
'limit' => $limit,
'offset' => $offset,
'setlimit' => true,
'datatable' => 'fontlist',
'jsonscript' => 'admin/site/fonts.json.php',
'resultcounttextsingular' => get_string('font', 'skin'),
......
......@@ -83,6 +83,7 @@ $previewform = pieform(array(
'all' => get_string('fonttypes.all', 'skin'),
'site' => get_string('fonttypes.site', 'skin'),
'google' => get_string('fonttypes.google', 'skin'),
'theme' => get_string('fonttypes.theme', 'skin'),
),
'defaultvalue' => $fonttype,
),
......@@ -96,7 +97,7 @@ $previewform = pieform(array(
),
'submit' => array(
'type' => 'submit',
'class' => 'btn-secondary',
'class' => 'btn-secondary btn-sm',
'value' => get_string('preview', 'skin')
)
)
......@@ -105,7 +106,7 @@ $data = Skin::get_sitefonts_data($limit, $offset, $fonttype);
$sitefonts = '';
$googlefonts = '';
foreach ($data->data as $font) {
if ($font['fonttype'] == 'site') {
if ($font['fonttype'] == 'site' || preg_match('/^t_/', $font['fonttype'])) {
$sitefonts .= $font['title'] . '|';
}
if ($font['fonttype'] == 'google') {
......@@ -130,7 +131,6 @@ $pagination = build_pagination(array(
'count' => $data->count,
'limit' => $limit,
'offset' => $offset,
'setlimit' => true,
'datatable' => 'fontlist',
'jsonscript' => 'admin/site/fonts.json.php',
'resultcounttextsingular' => get_string('font', 'skin'),
......@@ -138,8 +138,23 @@ $pagination = build_pagination(array(
));
$js = <<< EOF
function wire_specimens() {
$('.btn-display').each(function() {
var btn = $(this);
$(btn).off('click');
$(btn).on('click', function(e) {
e.preventDefault();
e.stopPropagation();
var url = $(this).prop('href');
sendjsonrequest(url, {}, 'GET', function(data) {
$('#page-modal .modal-body').html(data.data.html);
$('#page-modal').modal('show');
});
});
});
}
jQuery(function ($) {
p = {$pagination['javascript']}
EOF;
if ($offset > 0) {
$js .= <<< EOF
......
......@@ -565,7 +565,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
LEFT OUTER JOIN {artefact} api ON api.parent = a.id AND api.artefacttype = \'profileicon\'
LEFT OUTER JOIN {view_artefact} va ON va.artefact = a.id
LEFT OUTER JOIN {artefact_attachment} aa ON aa.attachment = a.id
LEFT OUTER JOIN {skin} s ON (s.bodybgimg = a.id OR s.viewbgimg = a.id)
LEFT OUTER JOIN {skin} s ON (s.bodybgimg = a.id OR s.headingbgimg = a.id)
LEFT OUTER JOIN {interaction_forum_post_attachment} fpa ON fpa.attachment = a.id
LEFT OUTER JOIN {usr} u ON a.id = u.profileicon AND a.owner = u.id';
......
......@@ -18,7 +18,7 @@ $result = get_records_sql_array('SELECT a.id, a.title, a.note, (u.profileicon =
FROM {artefact} a
LEFT OUTER JOIN {view_artefact} va ON va.artefact = a.id
LEFT OUTER JOIN {artefact_attachment} aa ON aa.attachment = a.id
LEFT OUTER JOIN {skin} s ON (s.bodybgimg = a.id OR s.viewbgimg = a.id)
LEFT OUTER JOIN {skin} s ON (s.bodybgimg = a.id OR s.headingbgimg = a.id)
LEFT OUTER JOIN {interaction_forum_post_attachment} fpa ON fpa.attachment = a.id
LEFT OUTER JOIN {usr} u ON (u.id = a.owner)
WHERE artefacttype = \'profileicon\'
......
......@@ -74,6 +74,7 @@ $string['element.select.other'] = 'Other';
$string['element.select.remove'] = 'Remove "%s"';
$string['element.color.transparent'] = 'Default or ';
$string['element.font.themedefault'] = 'Use Theme font';
$string['rule.before.before'] = 'This cannot be after the field "%s"';
......
......@@ -16,6 +16,15 @@ $string['pluginname'] = 'Skin';
$string['myskins'] = 'Skins';
$string['siteskinmenu'] = 'Skins';
$string['themedefault'] = 'Theme default';
$string['headerbackgroundcolor'] = 'Header background colour';
$string['headerbackgroundcolordescription'] = 'Background color for page header - this will not show if a header image has been selected';
$string['headerbackgroundimage'] = 'Header background image';
$string['headerbackgroundimagedescription'] = 'Minimum ideal width: 1832px. Minimum ideal height: 232px.';
$string['bodybackgroundcolour'] = 'Page background colour';
$string['bodybackgroundimage'] = 'Page background image';
$string['deletethisskin'] = 'Delete this skin';
$string['skindeleted'] = 'Skin deleted';
$string['cantdeleteskin'] = 'You cannot delete this skin.';
......@@ -243,6 +252,11 @@ $string['fonttype.site'] = 'Local font';
$string['fonttypes.site'] = 'Local fonts';
$string['fonttype.google'] = 'Google web font';
$string['fonttypes.google'] = 'Google web fonts';
$string['fonttypes.theme'] = 'Theme fonts';
$string['fonttype.t_raw'] = 'Theme font: Raw';
$string['fonttype.t_ocean'] = 'Theme font: Ocean';
$string['fonttype.t_modern'] = 'Theme font: Modern';
$string['fonttype.t_primaryschool'] = 'Theme font: Primary school';
// For examples of pangrams, see: http://en.wikipedia.org/wiki/List_of_pangrams
$string['preview'] = 'Preview';
......
......@@ -1140,7 +1140,7 @@
<FIELD NAME="type" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="private" />
<FIELD NAME="viewskin" TYPE="text" LENGTH="big" NOTNULL="true" />
<FIELD NAME="bodybgimg" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="viewbgimg" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="headingbgimg" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="ctime" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="mtime" TYPE="datetime" NOTNULL="false" />
</FIELDS>
......@@ -1169,7 +1169,7 @@
<FIELD NAME="notice" TYPE="text" NOTNULL="false" />
<FIELD NAME="previewfont" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="variants" TYPE="text" LENGTH="big" NOTNULL="true" />
<FIELD NAME="fonttype" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="site" />
<FIELD NAME="fonttype" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="site" />
<FIELD NAME="onlyheading" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="fontstack" TYPE="text" NOTNULL="true" />
<FIELD NAME="genericfont" TYPE="char" LENGTH="10" NOTNULL="true" ENUM="true" ENUMVALUES="'cursive', 'fantasy', 'monospace', 'sans-serif', 'serif'" />
......
......@@ -1447,5 +1447,43 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2019090900) {
log_debug('Update the skin_fonts to know about the theme fonts also');
require_once(get_config('libroot') . 'skin.php');
$table = new XMLDBTable('skin_fonts');
if (table_exists($table)) {
$field = new XMLDBField('fonttype');
$field->setAttributes(XMLDB_TYPE_CHAR, 30, null, XMLDB_NOTNULL, null, null, null, 'site');
change_field_precision($table, $field);
install_skins_default();
}
}
if ($oldversion < 2019090901) {
log_debug('Update the "skin" table to change where we record background images');
$table = new XMLDBTable('skin');
if (table_exists($table)) {
log_debug('Adding headingbgimg');
$field = new XMLDBField('headingbgimg');
if (!field_exists($table, $field)) {
$field->setAttributes(XMLDB_TYPE_INTEGER, 10);
add_field($table, $field);
}
$field = new XMLDBField('viewbgimg');
if (field_exists($table, $field)) {
log_debug('Removing viewbgimg');
if ($records = get_records_sql_array("SELECT viewbgimg AS aid FROM {skin} WHERE viewbgimg > 0")) {
foreach ($records as $record) {
// Need to remove the view bg image
require_once(get_config('libroot') . 'skin.php');
Skin::remove_background($record->aid);
}
}
drop_field($table, $field);
}
}
}
return $status;
}
......@@ -3484,7 +3484,7 @@ function artefact_in_view($artefact, $view) {
SELECT s.id
FROM {view} v INNER JOIN {skin} s
ON v.skin = s.id
WHERE v.id = ? AND ? in (s.bodybgimg, s.viewbgimg)
WHERE v.id = ? AND ? in (s.bodybgimg, s.headingbgimg)
";
$params = array_merge($params, array($view, $artefact->get('id')));
......
This diff is collapsed.
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2019080802;
$config->version = 2019090901;
$config->series = '19.10';
$config->release = '19.10dev';
$config->minupgradefrom = 2017031605;
......
......@@ -52,9 +52,9 @@ if ($id > 0) {
$viewskin['body_background_image'] = false;
}
}
if (!empty($viewskin['view_background_image'])) { // TODO remove this
if (!record_exists('artefact', 'id', $viewskin['view_background_image'])) {
$viewskin['view_background_image'] = false;
if (!empty($viewskin['header_background_image'])) {
if (!record_exists('artefact', 'id', $viewskin['header_background_image'])) {
$viewskin['header_background_image'] = false;
}
}
}
......@@ -134,14 +134,52 @@ $elements['viewskin'] = array(
),
),
);
// Page
$elements['skinbg'] = array(
'type' => 'fieldset',
'legend' => get_string('skinbackgroundoptions1', 'skin'),
'legend' => get_string('view', 'mahara'),
'class' => $fieldset != 'skinbg' ? 'collapsed' : '',
'elements' => array(
'header_background_color' => array(
'type' => 'color',
'title' => get_string('headerbackgroundcolor', 'skin'),
'description' => get_string('headerbackgroundcolordescription', 'skin'),
'defaultvalue' => (!empty($viewskin['header_background_color']) ? $viewskin['header_background_color'] : '#FFFFFF'),
'size' => 7,
'options' => array(
'transparent' => true,
),
),
'header_background_image' => array(
'type' => 'filebrowser',
'title' => get_string('headerbackgroundimage', 'skin'),
'folder' => $folder,
'highlight' => $highlight,
'description' => get_string('headerbackgroundimagedescription', 'skin'),
'browse' => $browse,
'filters' => array(
'artefacttype' => array('image'),
),
'page' => get_config('wwwroot') . 'skin/design.php?id=' . $id . '&fs=skinbg',
'config' => array(
'upload' => false,
'uploadagreement' => get_config_plugin('artefact', 'file', 'uploadagreement'),
'resizeonuploaduseroption' => get_config_plugin('artefact', 'file', 'resizeonuploaduseroption'),
'resizeonuploaduserdefault' => $USER->get_account_preference('resizeonuploaduserdefault'),
'createfolder' => false,
'edit' => false,
'select' => true,
'selectone' => true,
),
'defaultvalue' => (!empty($viewskin['header_background_image']) ? array(intval($viewskin['header_background_image'])) : array()),
'selectlistcallback' => 'artefact_get_records_by_id',
// TODO: Make this work so skins can include site files
// 'tabs' => true,
),
'body_background_color' => array(
'type' => 'color',
'title' => get_string('bodybgcolor1', 'skin'),
'title' => get_string('bodybackgroundcolour', 'skin'),
'defaultvalue' => (!empty($viewskin['body_background_color']) ? $viewskin['body_background_color'] : '#FFFFFF'),
'size' => 7,
'options' => array(
......@@ -150,13 +188,14 @@ $elements['skinbg'] = array(
)
)
);
// Currently site files don't work properly with site skins. And since site files are the only files that would make
// sense with site skins, we're going to just hide background images entirely for site skins for the time being.
if (!$designsiteskin) {
$elements['skinbg']['elements'] = array_merge($elements['skinbg']['elements'], array(
'body_background_image' => array(
'type' => 'filebrowser',
'title' => get_string('bodybgimage1', 'skin'),
'title' => get_string('bodybackgroundimage', 'skin'),
'folder' => $folder,
'highlight' => $highlight,
'browse' => $browse,
......@@ -209,24 +248,45 @@ if (!$designsiteskin) {
)
));
}
// Add option for theme font
$themefontoption = array ('' => get_string('themedefault', 'skin'));
$headerfontoptions = Skin::get_all_font_options();
$fontoptions = Skin::get_textonly_font_options();
// Add theme font element to list of fonts
$headerfontoptions = $themefontoption + $headerfontoptions;
$fontoptions = $themefontoption + $fontoptions;
// Text
$elements['viewcontent'] = array(
'type' => 'fieldset',
'legend' => get_string('viewcontentoptions1', 'skin'),
'legend' => get_string('sampletext', 'skin'),
'class' => $fieldset != 'viewcontent' ? 'collapsed' : '',
'elements' => array(
'view_heading_font_family' => array(
'type' => 'select',
'title' => get_string('headingfontfamily', 'skin'),
'defaultvalue' => (!empty($viewskin['view_heading_font_family']) ? $viewskin['view_heading_font_family'] : 'Arial'),
'defaultvalue' => (!empty($viewskin['view_heading_font_family']) ? $viewskin['view_heading_font_family'] : '' ),
'width' => 144,
'options' => Skin::get_all_font_options(),
'options' => $headerfontoptions
),
'view_text_heading_color' => array(
'type' => 'color',
'title' => get_string('headingcolor', 'skin'),
'description' => get_string('headingcolordescription', 'skin'),
'defaultvalue' => (!empty($viewskin['view_text_heading_color']) ? $viewskin['view_text_heading_color'] : '#000000'),
'size' => 7,
'options' => array(
'transparent' => true,
),
),
'view_text_font_family' => array(
'type' => 'select',
'title' => get_string('textfontfamily', 'skin'),
'defaultvalue' => (!empty($viewskin['view_text_font_family']) ? $viewskin['view_text_font_family'] : 'Arial'),
'defaultvalue' => (!empty($viewskin['view_text_font_family']) ? $viewskin['view_text_font_family'] : ''),
'width' => 144,
'options' => Skin::get_textonly_font_options(),
'options' => $fontoptions
),
'view_text_font_size' => array(
'type' => 'select',
......@@ -253,16 +313,6 @@ $elements['viewcontent'] = array(
'transparent' => true,
),
),
'view_text_heading_color' => array(
'type' => 'color',
'title' => get_string('headingcolor', 'skin'),
'description' => get_string('headingcolordescription', 'skin'),
'defaultvalue' => (!empty($viewskin['view_text_heading_color']) ? $viewskin['view_text_heading_color'] : '#000000'),
'size' => 7,
'options' => array(
'transparent' => true,
),
),
'view_text_emphasized_color' => array(
'type' => 'color',
'title' => get_string('emphasizedcolor', 'skin'),
......@@ -315,7 +365,7 @@ $elements['viewadvanced'] = array(
'style' => 'font-family:monospace',
'resizable' => true,
'fullwidth' => true,
'title' => get_string('skincustomcss','skin'),
'title' => get_string('skincustomcss', 'skin'),
'description' => get_string('skincustomcssdescription', 'skin'),
'defaultvalue' => ((!empty($viewskin['view_custom_css'])) ? $viewskin['view_custom_css'] : null),
),
......@@ -420,6 +470,8 @@ function designskinform_submit(Pieform $form, $values) {
$skin['view_text_font_size'] = $values['view_text_font_size'];
$skin['view_text_font_color'] = $values['view_text_font_color'];
$skin['view_text_heading_color'] = $values['view_text_heading_color'];
$skin['header_background_color'] = $values['header_background_color'];
$skin['header_background_image'] = $values['header_background_image'];
$skin['view_text_emphasized_color'] = $values['view_text_emphasized_color'];
$skin['view_link_normal_color'] = $values['view_link_normal_color'];
$skin['view_link_normal_underline'] = $values['view_link_normal_underline'];
......
......@@ -73,35 +73,10 @@ if (!empty($exportskins)) {
$itemnode->setAttribute('background-attachment', $viewskin['body_background_attachment']);
$itemnode->setAttribute('background-position', Skin::background_position_number_to_value($viewskin['body_background_position']));
// Header element... // TODO remove this
// Header element...
$childelement = $xmldoc->createElement('header');
$itemnode = $rootelement->appendChild($childelement);
$itemnode->setAttribute('background-color', $viewskin['header_background_color']);
$itemnode->setAttribute('font-color', $viewskin['header_text_font_color']);
$itemnode->setAttribute('normal-color', $viewskin['header_link_normal_color']);
if (intval($viewskin['header_link_normal_underline']) == 0) {
$itemnode->setAttribute('normal-decoration', 'none');
}
else {
$itemnode->setAttribute('normal-decoration', 'underline');
}
$itemnode->setAttribute('hover-color', $viewskin['header_link_hover_color']);
if (intval($viewskin['header_link_hover_underline']) == 0) {
$itemnode->setAttribute('hover-decoration', 'none');
}
else {
$itemnode->setAttribute('hover-decoration', 'underline');
}
$itemnode->setAttribute('logo-image', $viewskin['header_logo_image']);
// View (page) element... // TODO remove this
$childelement = $xmldoc->createElement('view');
$itemnode = $rootelement->appendChild($childelement);
$itemnode->setAttribute('background-color', $viewskin['view_background_color']);
$itemnode->setAttribute('background-repeat', Skin::background_repeat_number_to_value($viewskin['view_background_repeat']));
$itemnode->setAttribute('background-attachment', $viewskin['view_background_attachment']);
$itemnode->setAttribute('background-position', Skin::background_position_number_to_value($viewskin['view_background_position']));
$itemnode->setAttribute('width', $viewskin['view_background_width'].'%');
// Text element...
$childelement = $xmldoc->createElement('text');
......@@ -131,13 +106,6 @@ if (!empty($exportskins)) {
$itemnode->setAttribute('hover-decoration', 'underline');
}
// Table element... // TODO remove this
$childelement = $xmldoc->createElement('table');
$itemnode = $rootelement->appendChild($childelement);
$itemnode->setAttribute('border-color', $viewskin['view_table_border_color']);
$itemnode->setAttribute('odd-row-color', $viewskin['view_table_odd_row_color']);
$itemnode->setAttribute('even-row-color', $viewskin['view_table_even_row_color']);
// Skin background image element...
$bodybg = $viewskin['body_background_image'];
if (!empty($bodybg) && $bodybg > 0) {
......@@ -165,33 +133,6 @@ if (!empty($exportskins)) {
}
}
// Page background image element... // TODO remove this
$viewbg = $viewskin['view_background_image'];
if (!empty($viewbg) && $viewbg > 0) {
// Get existing page background image data...
// Get existing skin background image data...
$artefactobj = new ArtefactTypeImage($viewbg);
if ($USER->can_view_artefact($artefactobj)) {
$artefact = get_record('artefact', 'id', $viewbg, null, null, null, null, 'artefacttype,title,description,note');
$artefactfilefiles = get_record('artefact_file_files', 'artefact', $viewbg);
$artefactfileimage = get_record('artefact_file_image', 'artefact', $viewbg);
// Open and read the contents of each file...
$viewbgimage = $artefactobj->get_path();
$fp = fopen($viewbgimage, 'rb');
$filesize = filesize($viewbgimage);
$contents = fread($fp, $filesize);
fclose($fp);
// Export each file...
$childelement = $xmldoc->createElement('image');
$itemnode = $rootelement->appendChild($childelement);
$itemnode->setAttribute('type', 'view-background-image');
$itemnode->setAttribute('artefact', serialize($artefact));
$itemnode->setAttribute('artefact_file_files', serialize($artefactfilefiles));
$itemnode->setAttribute('artefact_file_image', serialize($artefactfileimage));
$itemnode->setAttribute('contents', base64_encode($contents));
}
}
// Fonts element...
// for exporting site fonts, which get embedded via @font-face CSS rule...
$textfonttype = get_field('skin_fonts', 'fonttype', 'name', $viewskin['view_text_font_family']);
......
......@@ -125,38 +125,11 @@ function importskinform_submit(Pieform $form, $values) {
$skin = array_merge($skin, array('body_background_position' => Skin::background_position_value_to_number($item->getAttribute('background-position'))));
}
// Header element... // TODO remove this
// Header element...
$items = $skindata->getElementsByTagName('header');
foreach ($items as $item) {
$skin = array_merge($skin, array('header_background_color' => $item->getAttribute('background-color')));
$skin = array_merge($skin, array('header_text_font_color' => $item->getAttribute('font-color')));
$skin = array_merge($skin, array('header_link_normal_color' => $item->getAttribute('normal-color')));
if ($item->getAttribute('normal-decoration') == 'none') {
$skin = array_merge($skin, array('header_link_normal_underline' => 0));
}
else {
$skin = array_merge($skin, array('header_link_normal_underline' => 1));
}
$skin = array_merge($skin, array('header_link_hover_color' => $item->getAttribute('hover-color')));
if ($item->getAttribute('hover-decoration') == 'none') {
$skin = array_merge($skin, array('header_link_hover_underline' => 0));
}
else {
$skin = array_merge($skin, array('header_link_hover_underline' => 1));
}
$skin = array_merge($skin, array('header_logo_image' => $item->getAttribute('logo-image')));
}
// View element... // TODO remove this
$items = $skindata->getElementsByTagName('view');
foreach ($items as $item) {
$skin = array_merge($skin, array('view_background_color' => $item->getAttribute('background-color')));
$skin = array_merge($skin, array('view_background_image' => 0));
$skin = array_merge($skin, array('view_background_repeat' => Skin::background_repeat_value_to_number($item->getAttribute('background-repeat'))));
$skin = array_merge($skin, array('view_background_attachment' => $item->getAttribute('background-attachment')));
$skin = array_merge($skin, array('view_background_position' => Skin::background_position_value_to_number($item->getAttribute('background-position'))));
$skin = array_merge($skin, array('view_background_width' => str_replace("%", "", $item->getAttribute('width')))); // odstrani znak %!
$skin = array_merge($skin, array('view_background_margin' => $item->getAttribute('margin-top')));
$skin = array_merge($skin, array('header_background_image' => 0));
}
// Text element...
......@@ -189,14 +162,6 @@ function importskinform_submit(Pieform $form, $values) {
}
}
// Table element... // TODO remove this
$items = $skindata->getElementsByTagName('table');
foreach ($items as $item) {
$skin = array_merge($skin, array('view_table_border_color' => $item->getAttribute('border-color')));
$skin = array_merge($skin, array('view_table_odd_row_color' => $item->getAttribute('odd-row-color')));
$skin = array_merge($skin, array('view_table_even_row_color' => $item->getAttribute('even-row-color')));
}
// Custom CSS element...
$items = $skindata->getElementsByTagName('customcss');
foreach ($items as $item) {
......@@ -213,7 +178,7 @@ function importskinform_submit(Pieform $form, $values) {
// TODO: Background image file support for site skins
if ($siteskin) {
$skin['body_background_image'] = 0;
$skin['view_background_image'] = 0;
$skin['header_background_image'] = 0;
}
else {
$items = $skindata->getElementsByTagName('image');
......@@ -275,8 +240,8 @@ function importskinform_submit(Pieform $form, $values) {
if ($type == 'body-background-image') {
$skin['body_background_image'] = $id;
}
if ($type == 'view-background-image') { // TODO remove this
$skin['view_background_image'] = $id;
if ($type == 'header-background-image') {
$skin['header_background_image'] = $id;
}
}
}
......
......@@ -63,37 +63,27 @@ $smarty->assign('body_background_attachment', (!empty($body_background_image)) ?
$smarty->assign('body_background_position', (!empty($body_background_image)) ? Skin::background_position_number_to_value($skin->viewskin['body_background_position']) : '');
// HEADER
$smarty->assign('header_background_color', $skin->viewskin['header_background_color']); // TODO remove this
$smarty->assign('header_text_font_color', $skin->viewskin['header_text_font_color']); // TODO remove this
$smarty->assign('header_link_normal_color', $skin->viewskin['header_link_normal_color']); // TODO remove this
$smarty->assign('header_link_normal_underline', ($skin->viewskin['header_link_normal_underline'] == true ? 'underline' : 'none')); // TODO remove this
$smarty->assign('header_link_hover_color', $skin->viewskin['header_link_hover_color']); // TODO remove this
$smarty->assign('header_link_hover_underline', ($skin->viewskin['header_link_hover_underline'] == true ? 'underline' : 'none')); // TODO remove this
$smarty->assign('header_background_color', $skin->viewskin['header_background_color']);
// VIEW
$smarty->assign('view_background_color', $skin->viewskin['view_background_color']); // TODO remove this
if (empty($skin->viewskin['view_background_image']) || $skin->viewskin['view_background_image'] == null) { // TODO remove this
$view_background_image = '';
if (empty($skin->viewskin['header_background_image'])) {
$header_background_image = '';
}
else {
$view_background_image = 'url(\'' . get_config('wwwroot') . 'artefact/file/download.php?file=' . $skin->viewskin['view_background_image'];
$header_background_image = 'url(\'' . get_config('wwwroot') . 'artefact/file/download.php?file=' . $skin->viewskin['header_background_image'];
if ($viewid) {
$view_background_image .= "&view={$viewid}";
$header_background_image .= "&view={$viewid}";
}
$view_background_image .= '\')';
$header_background_image .= '\')';
}
$smarty->assign('view_background_image', $view_background_image); // TODO remove this
$smarty->assign('view_background_repeat', (!empty($view_background_image)) ? Skin::background_repeat_number_to_value($skin->viewskin['view_background_repeat']) : ''); // TODO remove this
$smarty->assign('view_background_attachment', (!empty($view_background_image)) ? $skin->viewskin['view_background_attachment'] : ''); // TODO remove this
$smarty->assign('view_background_position', (!empty($view_background_image)) ? Skin::background_position_number_to_value($skin->viewskin['view_background_position']) : ''); // TODO remove this
$smarty->assign('view_background_width', $skin->viewskin['view_background_width'].'%'); // TODO remove this
$smarty->assign('header_background_image', $header_background_image);
// TEXT
$smarty->assign('view_text_font_face', Skin::get_css_font_face_from_font_name($skin->viewskin['view_text_font_family']));
$smarty->assign('view_text_font_family', Skin::get_css_font_family_from_font_name($skin->viewskin['view_text_font_family']));
$smarty->assign('view_text_font_family', Skin::get_css_font_family_from_font_name($skin->viewskin['view_text_font_family'], 'text'));
$smarty->assign('tabs_height', Skin::get_tabs_height_from_font_name($skin->viewskin['view_text_font_family'])); // TODO remove this
$smarty->assign('view_heading_font_face', Skin::get_css_font_face_from_font_name($skin->viewskin['view_heading_font_family']));
$smarty->assign('view_heading_font_family', Skin::get_css_font_family_from_font_name($skin->viewskin['view_heading_font_family']));
$smarty->assign('view_heading_font_family', Skin::get_css_font_family_from_font_name($skin->viewskin['view_heading_font_family'], 'heading'));
$smarty->assign('view_text_font_size', $skin->viewskin['view_text_font_size']);
$smarty->assign('view_text_font_color', $skin->viewskin['view_text_font_color']);
$smarty->assign('view_text_heading_color', $skin->viewskin['view_text_heading_color']);
......@@ -105,18 +95,6 @@ $smarty->assign('view_link_normal_underline', ($skin->viewskin['view_link_normal