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)) { ...@@ -32,7 +32,12 @@ if (!empty($font)) {
$fontdata = get_record('skin_fonts', 'name', $font); $fontdata = get_record('skin_fonts', 'name', $font);
$fonttitle = $fontdata->title; $fonttitle = $fontdata->title;
if (!empty($fontdata->licence) && !is_null($fontdata->licence)) { if (!empty($fontdata->licence) && !is_null($fontdata->licence)) {
$fontpath = get_config('wwwroot') . 'skins/fonts/' . $fontdata->name . '/'; 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>'; $fontlicence = '<a href="' . $fontpath . $fontdata->licence . '">' . get_string('fontlicence', 'skin') . '</a>';
} }
else { else {
...@@ -49,7 +54,10 @@ $smarty->assign('fonttitle', $fonttitle); ...@@ -49,7 +54,10 @@ $smarty->assign('fonttitle', $fonttitle);
$smarty->assign('fontlicence', $fontlicence); $smarty->assign('fontlicence', $fontlicence);
$specimen = $smarty->fetch('skin/specimen.tpl'); $specimen = $smarty->fetch('skin/specimen.tpl');
json_reply(false, array(
header('Content-type: text/html'); 'message' => null,
echo $specimen; 'data' => array(
exit; 'font' => $font,
'html' => $specimen
)
));
...@@ -48,7 +48,6 @@ $pagination = build_pagination(array( ...@@ -48,7 +48,6 @@ $pagination = build_pagination(array(
'count' => $data->count, 'count' => $data->count,
'limit' => $limit, 'limit' => $limit,
'offset' => $offset, 'offset' => $offset,
'setlimit' => true,
'datatable' => 'fontlist', 'datatable' => 'fontlist',
'jsonscript' => 'admin/site/fonts.json.php', 'jsonscript' => 'admin/site/fonts.json.php',
'resultcounttextsingular' => get_string('font', 'skin'), 'resultcounttextsingular' => get_string('font', 'skin'),
......
...@@ -83,6 +83,7 @@ $previewform = pieform(array( ...@@ -83,6 +83,7 @@ $previewform = pieform(array(
'all' => get_string('fonttypes.all', 'skin'), 'all' => get_string('fonttypes.all', 'skin'),
'site' => get_string('fonttypes.site', 'skin'), 'site' => get_string('fonttypes.site', 'skin'),
'google' => get_string('fonttypes.google', 'skin'), 'google' => get_string('fonttypes.google', 'skin'),
'theme' => get_string('fonttypes.theme', 'skin'),
), ),
'defaultvalue' => $fonttype, 'defaultvalue' => $fonttype,
), ),
...@@ -96,7 +97,7 @@ $previewform = pieform(array( ...@@ -96,7 +97,7 @@ $previewform = pieform(array(
), ),
'submit' => array( 'submit' => array(
'type' => 'submit', 'type' => 'submit',
'class' => 'btn-secondary', 'class' => 'btn-secondary btn-sm',
'value' => get_string('preview', 'skin') 'value' => get_string('preview', 'skin')
) )
) )
...@@ -105,7 +106,7 @@ $data = Skin::get_sitefonts_data($limit, $offset, $fonttype); ...@@ -105,7 +106,7 @@ $data = Skin::get_sitefonts_data($limit, $offset, $fonttype);
$sitefonts = ''; $sitefonts = '';
$googlefonts = ''; $googlefonts = '';
foreach ($data->data as $font) { foreach ($data->data as $font) {
if ($font['fonttype'] == 'site') { if ($font['fonttype'] == 'site' || preg_match('/^t_/', $font['fonttype'])) {
$sitefonts .= $font['title'] . '|'; $sitefonts .= $font['title'] . '|';
} }
if ($font['fonttype'] == 'google') { if ($font['fonttype'] == 'google') {
...@@ -130,7 +131,6 @@ $pagination = build_pagination(array( ...@@ -130,7 +131,6 @@ $pagination = build_pagination(array(
'count' => $data->count, 'count' => $data->count,
'limit' => $limit, 'limit' => $limit,
'offset' => $offset, 'offset' => $offset,
'setlimit' => true,
'datatable' => 'fontlist', 'datatable' => 'fontlist',
'jsonscript' => 'admin/site/fonts.json.php', 'jsonscript' => 'admin/site/fonts.json.php',
'resultcounttextsingular' => get_string('font', 'skin'), 'resultcounttextsingular' => get_string('font', 'skin'),
...@@ -138,8 +138,23 @@ $pagination = build_pagination(array( ...@@ -138,8 +138,23 @@ $pagination = build_pagination(array(
)); ));
$js = <<< EOF $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 ($) { jQuery(function ($) {
p = {$pagination['javascript']}
EOF; EOF;
if ($offset > 0) { if ($offset > 0) {
$js .= <<< EOF $js .= <<< EOF
......
...@@ -565,7 +565,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType { ...@@ -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 {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 {view_artefact} va ON va.artefact = a.id
LEFT OUTER JOIN {artefact_attachment} aa ON aa.attachment = 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 {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'; 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 = ...@@ -18,7 +18,7 @@ $result = get_records_sql_array('SELECT a.id, a.title, a.note, (u.profileicon =
FROM {artefact} a FROM {artefact} a
LEFT OUTER JOIN {view_artefact} va ON va.artefact = a.id 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 {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 {interaction_forum_post_attachment} fpa ON fpa.attachment = a.id
LEFT OUTER JOIN {usr} u ON (u.id = a.owner) LEFT OUTER JOIN {usr} u ON (u.id = a.owner)
WHERE artefacttype = \'profileicon\' WHERE artefacttype = \'profileicon\'
......
...@@ -74,6 +74,7 @@ $string['element.select.other'] = 'Other'; ...@@ -74,6 +74,7 @@ $string['element.select.other'] = 'Other';
$string['element.select.remove'] = 'Remove "%s"'; $string['element.select.remove'] = 'Remove "%s"';
$string['element.color.transparent'] = 'Default or '; $string['element.color.transparent'] = 'Default or ';
$string['element.font.themedefault'] = 'Use Theme font';
$string['rule.before.before'] = 'This cannot be after the field "%s"'; $string['rule.before.before'] = 'This cannot be after the field "%s"';
......
...@@ -16,6 +16,15 @@ $string['pluginname'] = 'Skin'; ...@@ -16,6 +16,15 @@ $string['pluginname'] = 'Skin';
$string['myskins'] = 'Skins'; $string['myskins'] = 'Skins';
$string['siteskinmenu'] = '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['deletethisskin'] = 'Delete this skin';
$string['skindeleted'] = 'Skin deleted'; $string['skindeleted'] = 'Skin deleted';
$string['cantdeleteskin'] = 'You cannot delete this skin.'; $string['cantdeleteskin'] = 'You cannot delete this skin.';
...@@ -243,6 +252,11 @@ $string['fonttype.site'] = 'Local font'; ...@@ -243,6 +252,11 @@ $string['fonttype.site'] = 'Local font';
$string['fonttypes.site'] = 'Local fonts'; $string['fonttypes.site'] = 'Local fonts';
$string['fonttype.google'] = 'Google web font'; $string['fonttype.google'] = 'Google web font';
$string['fonttypes.google'] = 'Google web fonts'; $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 // For examples of pangrams, see: http://en.wikipedia.org/wiki/List_of_pangrams
$string['preview'] = 'Preview'; $string['preview'] = 'Preview';
......
...@@ -1140,7 +1140,7 @@ ...@@ -1140,7 +1140,7 @@
<FIELD NAME="type" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="private" /> <FIELD NAME="type" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="private" />
<FIELD NAME="viewskin" TYPE="text" LENGTH="big" NOTNULL="true" /> <FIELD NAME="viewskin" TYPE="text" LENGTH="big" NOTNULL="true" />
<FIELD NAME="bodybgimg" TYPE="int" LENGTH="10" NOTNULL="false" /> <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="ctime" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="mtime" TYPE="datetime" NOTNULL="false" /> <FIELD NAME="mtime" TYPE="datetime" NOTNULL="false" />
</FIELDS> </FIELDS>
...@@ -1169,7 +1169,7 @@ ...@@ -1169,7 +1169,7 @@
<FIELD NAME="notice" TYPE="text" NOTNULL="false" /> <FIELD NAME="notice" TYPE="text" NOTNULL="false" />
<FIELD NAME="previewfont" TYPE="char" LENGTH="255" NOTNULL="true" /> <FIELD NAME="previewfont" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="variants" TYPE="text" LENGTH="big" 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="onlyheading" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="fontstack" TYPE="text" NOTNULL="true" /> <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'" /> <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) { ...@@ -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; return $status;
} }
...@@ -3484,7 +3484,7 @@ function artefact_in_view($artefact, $view) { ...@@ -3484,7 +3484,7 @@ function artefact_in_view($artefact, $view) {
SELECT s.id SELECT s.id
FROM {view} v INNER JOIN {skin} s FROM {view} v INNER JOIN {skin} s
ON v.skin = s.id 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'))); $params = array_merge($params, array($view, $artefact->get('id')));
......
This diff is collapsed.
...@@ -16,7 +16,7 @@ $config = new stdClass(); ...@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy // 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. // 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->series = '19.10';
$config->release = '19.10dev'; $config->release = '19.10dev';
$config->minupgradefrom = 2017031605; $config->minupgradefrom = 2017031605;
......
...@@ -52,9 +52,9 @@ if ($id > 0) { ...@@ -52,9 +52,9 @@ if ($id > 0) {
$viewskin['body_background_image'] = false; $viewskin['body_background_image'] = false;
} }
} }
if (!empty($viewskin['view_background_image'])) { // TODO remove this if (!empty($viewskin['header_background_image'])) {
if (!record_exists('artefact', 'id', $viewskin['view_background_image'])) { if (!record_exists('artefact', 'id', $viewskin['header_background_image'])) {
$viewskin['view_background_image'] = false; $viewskin['header_background_image'] = false;
} }
} }
} }
...@@ -134,29 +134,68 @@ $elements['viewskin'] = array( ...@@ -134,29 +134,68 @@ $elements['viewskin'] = array(
), ),
), ),
); );
// Page
$elements['skinbg'] = array( $elements['skinbg'] = array(
'type' => 'fieldset', 'type' => 'fieldset',
'legend' => get_string('skinbackgroundoptions1', 'skin'), 'legend' => get_string('view', 'mahara'),
'class' => $fieldset != 'skinbg' ? 'collapsed' : '', 'class' => $fieldset != 'skinbg' ? 'collapsed' : '',
'elements' => array( 'elements' => array(
'body_background_color' => array( 'header_background_color' => array(
'type' => 'color', 'type' => 'color',
'title' => get_string('bodybgcolor1', 'skin'), 'title' => get_string('headerbackgroundcolor', 'skin'),
'defaultvalue' => (!empty($viewskin['body_background_color']) ? $viewskin['body_background_color'] : '#FFFFFF'), 'description' => get_string('headerbackgroundcolordescription', 'skin'),
'size' => 7, 'defaultvalue' => (!empty($viewskin['header_background_color']) ? $viewskin['header_background_color'] : '#FFFFFF'),
'options' => array( 'size' => 7,
'transparent' => true, '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('bodybackgroundcolour', 'skin'),
'defaultvalue' => (!empty($viewskin['body_background_color']) ? $viewskin['body_background_color'] : '#FFFFFF'),
'size' => 7,
'options' => array(
'transparent' => true,
),
)
) )
); );
// Currently site files don't work properly with site skins. And since site files are the only files that would make // 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. // sense with site skins, we're going to just hide background images entirely for site skins for the time being.
if (!$designsiteskin) { if (!$designsiteskin) {
$elements['skinbg']['elements'] = array_merge($elements['skinbg']['elements'], array( $elements['skinbg']['elements'] = array_merge($elements['skinbg']['elements'], array(
'body_background_image' => array( 'body_background_image' => array(
'type' => 'filebrowser', 'type' => 'filebrowser',
'title' => get_string('bodybgimage1', 'skin'), 'title' => get_string('bodybackgroundimage', 'skin'),
'folder' => $folder, 'folder' => $folder,
'highlight' => $highlight, 'highlight' => $highlight,
'browse' => $browse, 'browse' => $browse,
...@@ -209,24 +248,45 @@ if (!$designsiteskin) { ...@@ -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( $elements['viewcontent'] = array(
'type' => 'fieldset', 'type' => 'fieldset',
'legend' => get_string('viewcontentoptions1', 'skin'), 'legend' => get_string('sampletext', 'skin'),
'class' => $fieldset != 'viewcontent' ? 'collapsed' : '', 'class' => $fieldset != 'viewcontent' ? 'collapsed' : '',
'elements' => array( 'elements' => array(
'view_heading_font_family' => array( 'view_heading_font_family' => array(
'type' => 'select', 'type' => 'select',
'title' => get_string('headingfontfamily', 'skin'), '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, '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( 'view_text_font_family' => array(
'type' => 'select', 'type' => 'select',
'title' => get_string('textfontfamily', 'skin'), '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, 'width' => 144,
'options' => Skin::get_textonly_font_options(), 'options' => $fontoptions
), ),
'view_text_font_size' => array( 'view_text_font_size' => array(
'type' => 'select', 'type' => 'select',
...@@ -253,16 +313,6 @@ $elements['viewcontent'] = array( ...@@ -253,16 +313,6 @@ $elements['viewcontent'] = array(
'transparent' => true, '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( 'view_text_emphasized_color' => array(
'type' => 'color', 'type' => 'color',
'title' => get_string('emphasizedcolor', 'skin'), 'title' => get_string('emphasizedcolor', 'skin'),
...@@ -315,7 +365,7 @@ $elements['viewadvanced'] = array( ...@@ -315,7 +365,7 @@ $elements['viewadvanced'] = array(
'style' => 'font-family:monospace', 'style' => 'font-family:monospace',
'resizable' => true, 'resizable' => true,
'fullwidth' => true, 'fullwidth' => true,
'title' => get_string('skincustomcss','skin'), 'title' => get_string('skincustomcss', 'skin'),
'description' => get_string('skincustomcssdescription', 'skin'), 'description' => get_string('skincustomcssdescription', 'skin'),
'defaultvalue' => ((!empty($viewskin['view_custom_css'])) ? $viewskin['view_custom_css'] : null), 'defaultvalue' => ((!empty($viewskin['view_custom_css'])) ? $viewskin['view_custom_css'] : null),
), ),
...@@ -420,6 +470,8 @@ function designskinform_submit(Pieform $form, $values) { ...@@ -420,6 +470,8 @@ function designskinform_submit(Pieform $form, $values) {
$skin['view_text_font_size'] = $values['view_text_font_size']; $skin['view_text_font_size'] = $values['view_text_font_size'];
$skin['view_text_font_color'] = $values['view_text_font_color']; $skin['view_text_font_color'] = $values['view_text_font_color'];
$skin['view_text_heading_color'] = $values['view_text_heading_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_text_emphasized_color'] = $values['view_text_emphasized_color'];
$skin['view_link_normal_color'] = $values['view_link_normal_color']; $skin['view_link_normal_color'] = $values['view_link_normal_color'];
$skin['view_link_normal_underline'] = $values['view_link_normal_underline']; $skin['view_link_normal_underline'] = $values['view_link_normal_underline'];
......
...@@ -73,35 +73,10 @@ if (!empty($exportskins)) { ...@@ -73,35 +73,10 @@ if (!empty($exportskins)) {
$itemnode->setAttribute('background-attachment', $viewskin['body_background_attachment']); $itemnode->setAttribute('background-attachment', $viewskin['body_background_attachment']);
$itemnode->setAttribute('background-position', Skin::background_position_number_to_value($viewskin['body_background_position'])); $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'); $childelement = $xmldoc->createElement('header');
$itemnode = $rootelement->appendChild($childelement); $itemnode = $rootelement->appendChild($childelement);
$itemnode->setAttribute('background-color', $viewskin['header_background_color']); $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... // Text element...
$childelement = $xmldoc->createElement('text'); $childelement = $xmldoc->createElement('text');
...@@ -131,13 +106,6 @@ if (!empty($exportskins)) { ...@@ -131,13 +106,6 @@ if (!empty($exportskins)) {
$itemnode->setAttribute('hover-decoration', 'underline'); $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... // Skin background image element...
$bodybg = $viewskin['body_background_image']; $bodybg = $viewskin['body_background_image'];
if (!empty($bodybg) && $bodybg > 0) { if (!empty($bodybg) && $bodybg > 0) {
...@@ -165,33 +133,6 @@ if (!empty($exportskins)) { ...@@ -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);