From 4f07deabcb5a618d9cd71315d5d043fa4c623b2e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 15 Feb 2004 14:54:39 +0000 Subject: - Changed the directory structure of theme chameleon. Each template is now in a subdirectory. This makes it easier to clone/fork an existing theme. Modified patch by MegaGrunt. - Added some help text, reorganized the Xtemplate configuration page, added /
tags, fixed a logo bug. --- themes/xtemplate/default/logo.gif | Bin 0 -> 3509 bytes themes/xtemplate/default/xtemplate.css | 349 +++++++++++++++++++++++++++++++ themes/xtemplate/default/xtemplate.xtmpl | 123 +++++++++++ themes/xtemplate/images/druplicon.gif | Bin 3509 -> 0 bytes themes/xtemplate/xtemplate.css | 349 ------------------------------- themes/xtemplate/xtemplate.theme | 58 +++-- themes/xtemplate/xtemplate.xtmpl | 123 ----------- 7 files changed, 511 insertions(+), 491 deletions(-) create mode 100644 themes/xtemplate/default/logo.gif create mode 100644 themes/xtemplate/default/xtemplate.css create mode 100644 themes/xtemplate/default/xtemplate.xtmpl delete mode 100644 themes/xtemplate/images/druplicon.gif delete mode 100644 themes/xtemplate/xtemplate.css delete mode 100644 themes/xtemplate/xtemplate.xtmpl diff --git a/themes/xtemplate/default/logo.gif b/themes/xtemplate/default/logo.gif new file mode 100644 index 000000000..ab6e59c3c Binary files /dev/null and b/themes/xtemplate/default/logo.gif differ diff --git a/themes/xtemplate/default/xtemplate.css b/themes/xtemplate/default/xtemplate.css new file mode 100644 index 000000000..cc42447dc --- /dev/null +++ b/themes/xtemplate/default/xtemplate.css @@ -0,0 +1,349 @@ +/* $Id$ */ + +/* +** HTML elements +*/ +body { + margin: 0; + padding: 0; + color: #000; + background-color: #fff; + font: 76% Verdana, Arial, Helvetica, sans-serif; +} +tr.dark { + background-color: #ddd; +} +tr.light { + background-color: #eee; +} +tr.dark td, tr.light td { + padding: 0.3em; +} +h1, h2, h3, h4, h5, h6 { + margin: 0; +} +h1 { + font-size: 1.3em; +} +h2 { + font-size: 1.2em; +} +h3, h4, h5, h6 { + font-size: 1.1em; +} +a { + text-decoration: none; + font-weight: bold; +} +a:link { + color: #39c; +} +a:visited { + color: #369; +} +a:hover { + color: #39c; + text-decoration: underline; +} +fieldset { + border: 1px solid #ccc; +} +pre { + background-color: #eee; + padding: 0.75em 1.5em; + font-size: 12px; + border: 1px solid #ddd; +} +table { + /* make sizes relative to body size! */ + font-size: 1em; +} +.form-item { + margin-top: 1em; +} +.form-item label { + font-size: 1em; + color: #222; +} +.item-list .title { + font-size: 1em; + color: #222; +} + +/* +** Page layout blocks / IDs +*/ +#header, #content { + width: 100%; +} +#header { + background-color: #69c; +} +#logo { + vertical-align: bottom; + border: 0; + font-weight: bold; + font-size: 1.9em; + color: #fff; +} +#logo img { + display: block; +} +#menu { + padding: 0.5em 0.5em 0 0.5em; + text-align: right; + vertical-align: middle; +} +#primary { + font-size: 1.0em; + padding: 0em 0.8em 0.5em 0; + color: #9cf; +} +#primary a { + font-weight: bold; + color: #fff; +} +#secondary { + padding: 0 1em 0.5em 0; + font-size: 0.8em; + color: #9cf; +} +#secondary a { + font-weight: bold; + color: #9cf; +} +#search .form-text, #search .form-submit { + border: 1px solid #369; + font-size: 1.1em; +} +#search .form-text { + width: 8em; + height: 1.4em; + padding: 0 0.5em 0 0.5em; + margin: 0 0 0.5em 0; +} +#search .form-submit { + height: 1.5em; +} +#mission { + background-color: #369; + padding: 1.5em 2em; + color: #fff; +} +#mission a, #mission a:visited { + color: #9cf; + font-weight: bold; +} +#main { + /* padding in px not ex because IE messes up 100% width tables otherwise */ + padding: 10px; +} +#mission, .node .content, .comment .content { + line-height: 1.4; +} +#help { + font-size: 0.9em; + margin-bottom: 1em; +} +.breadcrumb { + margin-bottom: .5em; +} +.message { + background-color: #eee; + border: 1px solid #ccc; + padding: 0.3em; + margin-bottom: 1em; +} +.error { + border-color: red; +} +#sidebar-left, #sidebar-right { + background-color: #ddd; + width: 16em; + /* padding in px not ex because IE messes up 100% width tables otherwise */ + padding: 10px; + vertical-align: top; +} +#footer { + background-color: #eee; + padding: 1em; + font-size: 0.8em; +} + +/* +** Common declarations for child classes of node, comment, block, box, etc. +** If you want any of them styled differently for a specific parent, add +** additional rules /with only the differing properties!/ to .parent .class. +** See .comment .title for an example. +*/ +.title, .title a { + font-weight: bold; + font-size: 1.3em; + color: #777; + margin: 0 auto 0 auto; /* decrease default margins for h.title */ +} +.submitted { + color: #999; + font-size: 0.8em; +} +.links { + color: #999; +} +.links a { + font-weight: bold; +} +.block, .box { + padding: 0 0 1.5em 0; +} +.block { + border-bottom: 1px solid #bbb; + padding-bottom: 0.75em; + margin-bottom: 1.5em; +} +.block .title { + margin-bottom: .25em; +} +.box .title { + font-size: 1.1em; +} +.node { + margin: .5em 0 1em 0; +} +.static { + padding: .5em; + background-color: #eee; + border: solid 1px #ddd; +} +.node .content, .comment .content { + padding: .5em 0 .75em 0; +} +.node .taxonomy { + color: #999; + font-size: 0.8em; + padding: 1.5em; +} +.node .avatar { + border: 1px solid #ddd; + float: right; + margin: 0.5em; +} +.comment { + border: 1px solid #abc; + padding: .5em; + margin-bottom: 1em; +} +.comment .title { + font-size: 1.1em; +} +.comment .new { + text-align: right; + font-weight: bold; + font-size: 0.8em; + float: right; + color: red; +} +.comment .avatar { + border: 1px solid #abc; + float: right; + margin: 0.5em; +} + +/* +** Module specific styles +*/ +#aggregator .feed { + background-color: #eee; + border: 1px solid #ccc; + padding: 1em; + margin: 1em 0 1em 0; +} +#aggregator .news-item .source { + color: #999; + font-style: italic; + font-size: 0.9em; +} +#aggregator .title { + font-size: 1em; +} +#aggregator h3 { + margin-top: 1em; +} +#tracker th { + text-align: left; + border-bottom: 1px solid #ddd; +} +#tracker tr.light, #tracker tr.dark { + background-color: #fff; +} +#tracker td { + vertical-align: top; + padding: 1em 1em 1em 0; + border-bottom: 1px solid #bbb; +} +#forum table { + width: 100%; +} +#forum td { + padding: 0.5em 0.5em 0.5em 0.5em; +} +#forum td.forum, #forum td.posts { + background-color: #eee; +} +#forum td.topics, #forum td.last-reply { + background-color: #ddd; +} +#forum td.container { + background-color: #ccc; +} +#forum td.container a { + color: #555; +} +#forum td.statistics, #forum td.settings, #forum td.pager { + height: 1.5em; + border: 1px solid #bbb; +} +#forum td .name { + color: #96c; +} +#forum td .links { + padding-top: 0.7em; + font-size: 0.9em; +} +.block-forum h3 { + margin-bottom: .5em; +} +.calendar a { + text-decoration: none; +} +.calendar td { + padding: 0; + border-color: #888; +} +.calendar td div { + padding: 0.4em 0; +} +.calendar .row-week td a { + padding: 0.4em 0; +} +.calendar .day-today { + background-color: #69c; +} +.calendar .day-today a { + color: #fff; +} +.calendar .day-selected { + background-color: #369; + color: #fff; +} +.calendar .header-month { + background-color: #bbb; +} +.calendar .header-week { + background-color: #ccc; +} +.calendar .day-blank { + background-color: #ccc; +} +.calendar .row-week td a:hover { + background-color: #fff; color: #000; +} diff --git a/themes/xtemplate/default/xtemplate.xtmpl b/themes/xtemplate/default/xtemplate.xtmpl new file mode 100644 index 000000000..aea3dd3db --- /dev/null +++ b/themes/xtemplate/default/xtemplate.xtmpl @@ -0,0 +1,123 @@ + + + + + + {head_title} + {head} + + + + + + + + + + + + + + + + + + + + + + +
+ +
{mission}
+ +
+ + {breadcrumb} +

{title}

+ + +
{help}
+ + +
{message}
+ + + + +
+ +
{avatar}
+ + +

{title}

+ + + + {taxonomy} + +
{content}
+ + + +
+ + + +
+ +
{avatar}
+ +

{title}

{new} + +
{content}
+ + + +
+ + + +
+

{title}

+
{content}
+
+ + + +
+

{title}

+
{content}
+
+ + + +
+
+ + + + +{footer} + + + diff --git a/themes/xtemplate/images/druplicon.gif b/themes/xtemplate/images/druplicon.gif deleted file mode 100644 index ab6e59c3c..000000000 Binary files a/themes/xtemplate/images/druplicon.gif and /dev/null differ diff --git a/themes/xtemplate/xtemplate.css b/themes/xtemplate/xtemplate.css deleted file mode 100644 index cc42447dc..000000000 --- a/themes/xtemplate/xtemplate.css +++ /dev/null @@ -1,349 +0,0 @@ -/* $Id$ */ - -/* -** HTML elements -*/ -body { - margin: 0; - padding: 0; - color: #000; - background-color: #fff; - font: 76% Verdana, Arial, Helvetica, sans-serif; -} -tr.dark { - background-color: #ddd; -} -tr.light { - background-color: #eee; -} -tr.dark td, tr.light td { - padding: 0.3em; -} -h1, h2, h3, h4, h5, h6 { - margin: 0; -} -h1 { - font-size: 1.3em; -} -h2 { - font-size: 1.2em; -} -h3, h4, h5, h6 { - font-size: 1.1em; -} -a { - text-decoration: none; - font-weight: bold; -} -a:link { - color: #39c; -} -a:visited { - color: #369; -} -a:hover { - color: #39c; - text-decoration: underline; -} -fieldset { - border: 1px solid #ccc; -} -pre { - background-color: #eee; - padding: 0.75em 1.5em; - font-size: 12px; - border: 1px solid #ddd; -} -table { - /* make sizes relative to body size! */ - font-size: 1em; -} -.form-item { - margin-top: 1em; -} -.form-item label { - font-size: 1em; - color: #222; -} -.item-list .title { - font-size: 1em; - color: #222; -} - -/* -** Page layout blocks / IDs -*/ -#header, #content { - width: 100%; -} -#header { - background-color: #69c; -} -#logo { - vertical-align: bottom; - border: 0; - font-weight: bold; - font-size: 1.9em; - color: #fff; -} -#logo img { - display: block; -} -#menu { - padding: 0.5em 0.5em 0 0.5em; - text-align: right; - vertical-align: middle; -} -#primary { - font-size: 1.0em; - padding: 0em 0.8em 0.5em 0; - color: #9cf; -} -#primary a { - font-weight: bold; - color: #fff; -} -#secondary { - padding: 0 1em 0.5em 0; - font-size: 0.8em; - color: #9cf; -} -#secondary a { - font-weight: bold; - color: #9cf; -} -#search .form-text, #search .form-submit { - border: 1px solid #369; - font-size: 1.1em; -} -#search .form-text { - width: 8em; - height: 1.4em; - padding: 0 0.5em 0 0.5em; - margin: 0 0 0.5em 0; -} -#search .form-submit { - height: 1.5em; -} -#mission { - background-color: #369; - padding: 1.5em 2em; - color: #fff; -} -#mission a, #mission a:visited { - color: #9cf; - font-weight: bold; -} -#main { - /* padding in px not ex because IE messes up 100% width tables otherwise */ - padding: 10px; -} -#mission, .node .content, .comment .content { - line-height: 1.4; -} -#help { - font-size: 0.9em; - margin-bottom: 1em; -} -.breadcrumb { - margin-bottom: .5em; -} -.message { - background-color: #eee; - border: 1px solid #ccc; - padding: 0.3em; - margin-bottom: 1em; -} -.error { - border-color: red; -} -#sidebar-left, #sidebar-right { - background-color: #ddd; - width: 16em; - /* padding in px not ex because IE messes up 100% width tables otherwise */ - padding: 10px; - vertical-align: top; -} -#footer { - background-color: #eee; - padding: 1em; - font-size: 0.8em; -} - -/* -** Common declarations for child classes of node, comment, block, box, etc. -** If you want any of them styled differently for a specific parent, add -** additional rules /with only the differing properties!/ to .parent .class. -** See .comment .title for an example. -*/ -.title, .title a { - font-weight: bold; - font-size: 1.3em; - color: #777; - margin: 0 auto 0 auto; /* decrease default margins for h.title */ -} -.submitted { - color: #999; - font-size: 0.8em; -} -.links { - color: #999; -} -.links a { - font-weight: bold; -} -.block, .box { - padding: 0 0 1.5em 0; -} -.block { - border-bottom: 1px solid #bbb; - padding-bottom: 0.75em; - margin-bottom: 1.5em; -} -.block .title { - margin-bottom: .25em; -} -.box .title { - font-size: 1.1em; -} -.node { - margin: .5em 0 1em 0; -} -.static { - padding: .5em; - background-color: #eee; - border: solid 1px #ddd; -} -.node .content, .comment .content { - padding: .5em 0 .75em 0; -} -.node .taxonomy { - color: #999; - font-size: 0.8em; - padding: 1.5em; -} -.node .avatar { - border: 1px solid #ddd; - float: right; - margin: 0.5em; -} -.comment { - border: 1px solid #abc; - padding: .5em; - margin-bottom: 1em; -} -.comment .title { - font-size: 1.1em; -} -.comment .new { - text-align: right; - font-weight: bold; - font-size: 0.8em; - float: right; - color: red; -} -.comment .avatar { - border: 1px solid #abc; - float: right; - margin: 0.5em; -} - -/* -** Module specific styles -*/ -#aggregator .feed { - background-color: #eee; - border: 1px solid #ccc; - padding: 1em; - margin: 1em 0 1em 0; -} -#aggregator .news-item .source { - color: #999; - font-style: italic; - font-size: 0.9em; -} -#aggregator .title { - font-size: 1em; -} -#aggregator h3 { - margin-top: 1em; -} -#tracker th { - text-align: left; - border-bottom: 1px solid #ddd; -} -#tracker tr.light, #tracker tr.dark { - background-color: #fff; -} -#tracker td { - vertical-align: top; - padding: 1em 1em 1em 0; - border-bottom: 1px solid #bbb; -} -#forum table { - width: 100%; -} -#forum td { - padding: 0.5em 0.5em 0.5em 0.5em; -} -#forum td.forum, #forum td.posts { - background-color: #eee; -} -#forum td.topics, #forum td.last-reply { - background-color: #ddd; -} -#forum td.container { - background-color: #ccc; -} -#forum td.container a { - color: #555; -} -#forum td.statistics, #forum td.settings, #forum td.pager { - height: 1.5em; - border: 1px solid #bbb; -} -#forum td .name { - color: #96c; -} -#forum td .links { - padding-top: 0.7em; - font-size: 0.9em; -} -.block-forum h3 { - margin-bottom: .5em; -} -.calendar a { - text-decoration: none; -} -.calendar td { - padding: 0; - border-color: #888; -} -.calendar td div { - padding: 0.4em 0; -} -.calendar .row-week td a { - padding: 0.4em 0; -} -.calendar .day-today { - background-color: #69c; -} -.calendar .day-today a { - color: #fff; -} -.calendar .day-selected { - background-color: #369; - color: #fff; -} -.calendar .header-month { - background-color: #bbb; -} -.calendar .header-week { - background-color: #ccc; -} -.calendar .day-blank { - background-color: #ccc; -} -.calendar .row-week td a:hover { - background-color: #fff; color: #000; -} diff --git a/themes/xtemplate/xtemplate.theme b/themes/xtemplate/xtemplate.theme index a75452257..bc300ee97 100644 --- a/themes/xtemplate/xtemplate.theme +++ b/themes/xtemplate/xtemplate.theme @@ -4,24 +4,43 @@ if (!class_exists("XTemplate")) { include_once("themes/xtemplate/xtemplate.inc"); } - -$GLOBALS["xtemplate"]->template = new XTemplate("themes/xtemplate/xtemplate.xtmpl"); +$template_directory = variable_get('xtemplate_template', 'default'); +$GLOBALS["xtemplate"]->template = new XTemplate('xtemplate.xtmpl', 'themes/xtemplate/' . $template_directory); $GLOBALS["xtemplate"]->template->SetNullBlock(" "); // "" doesnt work! function xtemplate_settings() { - $output .= form_textarea(t("Message on front page"), "xtemplate_mission", variable_get("xtemplate_mission", "edit mission"), 70, 6, t("This text will be displayed on the front page. It can be used to display a mission statement, announcement or site description..")); - $output .= form_textfield(t("Stylesheet URL"), "xtemplate_stylesheet", variable_get("xtemplate_stylesheet", "themes/xtemplate/xtemplate.css"), 70, 300, t("The URL for your theme's cascading stylesheet.")); - $output .= form_textarea(t("Logo"), "xtemplate_logo", variable_get("xtemplate_logo", "\"Druplicon"), 70, 4, t("The HTML code for displaying the logo.")); - $output .= form_textarea(t("Primary links"), "xtemplate_primary_links", variable_get("xtemplate_primary_links", l("edit primary links", "admin/system/themes/xtemplate")), 70, 8, t("The HTML code for the primary links.")); - $output .= form_textarea(t("Secondary links"), "xtemplate_secondary_links", variable_get("xtemplate_secondary_links", l("edit secondary links", "admin/system/themes/xtemplate")), 70, 8, t("The HTML code for the secondary links.")); - $output .= form_radios(t("Search box"), "xtemplate_search_box", variable_get("xtemplate_search_box", 0), array(t("Disabled"), t("Enabled")), t("Show a search box in the upper right corner.")); - $output .= form_group(t("Avatars"), form_checkbox(t("Display avatars with posts"), "xtemplate_avatar_node", 1, variable_get("xtemplate_avatar_node", 0), t("Display individualized pictures identifying users with posts they start.")) . form_checkbox(t("Display avatars with comments"), "xtemplate_avatar_comment", 1, variable_get("xtemplate_avatar_comment", 0), t("Display individualized pictures identifying users with their comments.")) . form_textfield(t("Default avatar"), "xtemplate_avatar_default", variable_get("xtemplate_avatar_default", ""), 70, 300, t("URL of avatar to display for users with no custom avatar selected. Leave blank for none."))); + /* + ** Compile a list of the available style sheets: + */ + + $fd = opendir('themes/xtemplate'); + while ($file = readdir($fd)) { + if (is_dir("themes/xtemplate/$file") && !in_array($file, array('.', '..', 'CVS'))) { + $files[$file] = $file; + } + } + closedir($fd); + + $template_directory = variable_get('xtemplate_template', 'default'); + $group = form_select(t('Template'), 'xtemplate_template', variable_get('xtemplate_template', 'default'), $files, t('Selecting a different template will change the look and feel of your site. To create a new template, create a new directory under themes/xtemplate and copy the contents of an existing template (e.g. themes/xtemplate/default) into it. The new template will automatically become available in the selection menu and will be identified by its directory name.')); + $output = form_group(t('Template selection'), $group); + + $group = form_textarea(t('Logo'), 'xtemplate_logo', variable_get('xtemplate_logo', "\"Logo\""), 70, 4, t('The HTML code for displaying the logo.')); + $group .= form_textarea(t('Primary links'), 'xtemplate_primary_links', variable_get('xtemplate_primary_links', l('edit primary links', 'admin/system/themes/xtemplate')), 70, 8, t('The HTML code for the primary links.')); + $group .= form_textarea(t('Secondary links'), 'xtemplate_secondary_links', variable_get('xtemplate_secondary_links', l('edit secondary links', 'admin/system/themes/xtemplate')), 70, 8, t('The HTML code for the secondary links.')); + $group .= form_textarea(t('Message on front page'), 'xtemplate_mission', variable_get('xtemplate_mission', 'edit mission'), 70, 6, t('This text will be displayed on the front page. It can be used to display a mission statement, announcement or site description..')); + $group .= form_radios(t('Search box'), 'xtemplate_search_box', variable_get('xtemplate_search_box', 0), array(t('Disabled'), t('Enabled')), t('Show a search box in the upper right corner.')); + $output .= form_group(t('Header settings'), $group); + + $group = form_checkbox(t('Display avatars with posts'), 'xtemplate_avatar_node', 1, variable_get('xtemplate_avatar_node', 0), t('Display individualized pictures identifying users with posts they start.')) . form_checkbox(t('Display avatars with comments'), 'xtemplate_avatar_comment', 1, variable_get('xtemplate_avatar_comment', 0), t('Display individualized pictures identifying users with their comments.')) . form_textfield(t('Default avatar'), 'xtemplate_avatar_default', variable_get('xtemplate_avatar_default', ''), 70, 300, t('URL of avatar to display for users with no custom avatar selected. Leave blank for none.')); + $output .= form_group(t('Avatar settings'), $group); + return $output; } function xtemplate_help($section) { - $output = ""; + $output = ''; switch ($section) { case 'admin/system/themes#description': @@ -133,17 +152,18 @@ function xtemplate_page($content, $title = NULL, $breadcrumb = NULL) { } global $xtemplate; + $template_directory = variable_get('xtemplate_template', 'default'); $xtemplate->template->assign(array( - "head_title" => (drupal_get_title() ? drupal_get_title() ." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")), - "site" => variable_get("site_name", "drupal"), - "head" => drupal_get_html_head(), - "stylesheet" => variable_get("xtemplate_stylesheet", "themes/xtemplate/xtemplate.css"), - "onload_attributes" => theme_onload_attribute(), - "logo" => variable_get("xtemplate_logo", "\"Druplicon"), - "primary_links" => variable_get("xtemplate_primary_links", l("edit primary links", "admin/system/themes/xtemplate")), - "secondary_links" => variable_get("xtemplate_secondary_links", l("edit secondary links", "admin/system/themes/xtemplate")) - )); + "head_title" => (drupal_get_title() ? drupal_get_title() ." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")), + "site" => variable_get("site_name", "drupal"), + "head" => drupal_get_html_head(), + "path" => "themes/xtemplate/$template_directory", + "onload_attributes" => theme_onload_attribute(), + "logo" => variable_get('xtemplate_logo', "\"Logo\""), + "primary_links" => variable_get("xtemplate_primary_links", l("edit primary links", "admin/system/themes/xtemplate")), + "secondary_links" => variable_get("xtemplate_secondary_links", l("edit secondary links", "admin/system/themes/xtemplate")) + )); if ($title = drupal_get_title()) { $xtemplate->template->assign("title", $title); diff --git a/themes/xtemplate/xtemplate.xtmpl b/themes/xtemplate/xtemplate.xtmpl deleted file mode 100644 index 456a2424d..000000000 --- a/themes/xtemplate/xtemplate.xtmpl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - {head_title} - {head} - - - - - - - - - - - - - - - - - - - - - - -
- -
{mission}
- -
- - {breadcrumb} -

{title}

- - -
{help}
- - -
{message}
- - - - -
- -
{avatar}
- - -

{title}

- - - - {taxonomy} - -
{content}
- - - -
- - - -
- -
{avatar}
- -

{title}

{new} - -
{content}
- - - -
- - - -
-

{title}

-
{content}
-
- - - -
-

{title}

-
{content}
-
- - - -
-
- - - - -{footer} - - - -- cgit v1.2.3