Commit d795565c authored by Dries's avatar Dries

- Patch 5789 by TDobes: added avatar support to the Xtemplate theme.

parent a333c05d
......@@ -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
------------------------
......
......@@ -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
......
......@@ -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", "<img src=\"$avatar\" alt=\"" . t("%user's avatar", array("%user" => $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", "<img src=\"$avatar\" alt=\"" . t("%user's avatar", array("%user" => $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");
......
......@@ -56,6 +56,9 @@
<!-- BEGIN: node -->
<div class="node {static}">
<!-- BEGIN: avatar -->
<div class="avatar">{avatar}</div>
<!-- END: avatar -->
<!-- BEGIN: title -->
<h2 class="title"><a href="{link}">{title}</a></h2>
<!-- END: title -->
......@@ -72,6 +75,9 @@
<!-- BEGIN: comment -->
<div class="comment">
<!-- BEGIN: avatar -->
<div class="avatar">{avatar}</div>
<!-- END: avatar -->
<h3 class="title">{title}</h3><!-- BEGIN: new --><span class="new">{new}</span><!-- END: new -->
<div class="submitted">{submitted}</div>
<div class="content">{content}</div>
......
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