diff --git a/CHANGELOG b/CHANGELOG index bab28b71929..a420a05b908 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,7 +20,8 @@ Drupal x.x.x, xxxx-xx-xx * made all theme functions return their output. * migrated away from using the BaseTheme class. * added many new theme functions and refactored existing theme functions. - * replaced theme "UnConeD" by "Chameleon". + * added avatar support to 'Xtemplate'. + * replaced theme 'UnConeD' by 'Chameleon'. - usability: * added breadcrumb navigation to all pages. * made it possible to add context-sensitive help to all pages. @@ -36,8 +37,6 @@ Drupal x.x.x, xxxx-xx-xx * added PHPDoc/Doxygen comments. - improved the filter system to prevent conflicts between filters: * made it possible to change the order in which filters are applied. - * extra step for resolving conflicts with content that looks like HTML (e.g. - PHP code). Drupal 4.3.2, 2004-01-01 ------------------------ diff --git a/themes/xtemplate/xtemplate.css b/themes/xtemplate/xtemplate.css index 4bbabe82b9c..8bec39cc5cb 100644 --- a/themes/xtemplate/xtemplate.css +++ b/themes/xtemplate/xtemplate.css @@ -219,6 +219,11 @@ table { 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; @@ -234,6 +239,11 @@ table { float: right; color: red; } +.comment .avatar { + border: 1px solid #abc; + float: right; + margin: 0.5em; +} /* ** Module specific styles diff --git a/themes/xtemplate/xtemplate.theme b/themes/xtemplate/xtemplate.theme index 432ff4a1544..a7545225772 100644 --- a/themes/xtemplate/xtemplate.theme +++ b/themes/xtemplate/xtemplate.theme @@ -15,6 +15,7 @@ function xtemplate_settings() { $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."))); return $output; } @@ -49,6 +50,20 @@ function xtemplate_node($node, $main = 0, $page = 0) { $xtemplate->template->parse("node.title"); } + if (module_exist("profile") && variable_get("xtemplate_avatar_node", 0)) { + $avatar = $node->profile_avatar; + if (empty($avatar) || !file_exists($avatar)) { + $avatar = variable_get("xtemplate_avatar_default", ""); + } + else { + $avatar = file_create_url($avatar); + } + if ($avatar) { + $xtemplate->template->assign("avatar", "\"" $comment->name ? $comment->name : t(variable_get("anonymous", "Anonymous")))) . "\" />"); + $xtemplate->template->parse("node.avatar"); + } + } + if (module_exist("taxonomy") && ($taxonomy = taxonomy_link("taxonomy terms", $node))) { $xtemplate->template->assign("taxonomy", theme_links($taxonomy)); $xtemplate->template->parse("node.taxonomy"); @@ -82,10 +97,26 @@ function xtemplate_comment($comment, $links = 0) { if ($comment->new) { $xtemplate->template->parse("comment.new"); } + + if (module_exist("profile") && variable_get("xtemplate_avatar_comment", 0)) { + $avatar = $comment->profile_avatar; + if (empty($avatar) || !file_exists($avatar)) { + $avatar = variable_get("xtemplate_avatar_default", ""); + } + else { + $avatar = file_create_url($avatar); + } + if ($avatar) { + $xtemplate->template->assign("avatar", "\"" $comment->name ? $comment->name : t(variable_get("anonymous", "Anonymous")))) . "\" />"); + $xtemplate->template->parse("comment.avatar"); + } + } + if ($links) { $xtemplate->template->assign("links", $links); $xtemplate->template->parse("comment.links"); } + $xtemplate->template->parse("comment"); $output = $xtemplate->template->text("comment"); $xtemplate->template->reset("comment"); diff --git a/themes/xtemplate/xtemplate.xtmpl b/themes/xtemplate/xtemplate.xtmpl index b82f6f38de0..456a2424dcd 100644 --- a/themes/xtemplate/xtemplate.xtmpl +++ b/themes/xtemplate/xtemplate.xtmpl @@ -56,6 +56,9 @@
+ +
{avatar}
+

{title}

@@ -72,6 +75,9 @@
+ +
{avatar}
+

{title}

{new}
{content}