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

4.4.x
Dries Buytaert 2004-02-11 19:11:59 +00:00
parent a333c05d74
commit d795565c32
4 changed files with 49 additions and 3 deletions

View File

@ -20,7 +20,8 @@ Drupal x.x.x, xxxx-xx-xx
* made all theme functions return their output. * made all theme functions return their output.
* migrated away from using the BaseTheme class. * migrated away from using the BaseTheme class.
* added many new theme functions and refactored existing theme functions. * 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: - usability:
* added breadcrumb navigation to all pages. * added breadcrumb navigation to all pages.
* made it possible to add context-sensitive help 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. * added PHPDoc/Doxygen comments.
- improved the filter system to prevent conflicts between filters: - improved the filter system to prevent conflicts between filters:
* made it possible to change the order in which filters are applied. * 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 Drupal 4.3.2, 2004-01-01
------------------------ ------------------------

View File

@ -219,6 +219,11 @@ table {
font-size: 0.8em; font-size: 0.8em;
padding: 1.5em; padding: 1.5em;
} }
.node .avatar {
border: 1px solid #ddd;
float: right;
margin: 0.5em;
}
.comment { .comment {
border: 1px solid #abc; border: 1px solid #abc;
padding: .5em; padding: .5em;
@ -234,6 +239,11 @@ table {
float: right; float: right;
color: red; color: red;
} }
.comment .avatar {
border: 1px solid #abc;
float: right;
margin: 0.5em;
}
/* /*
** Module specific styles ** Module specific styles

View File

@ -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("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_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_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; return $output;
} }
@ -49,6 +50,20 @@ function xtemplate_node($node, $main = 0, $page = 0) {
$xtemplate->template->parse("node.title"); $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))) { if (module_exist("taxonomy") && ($taxonomy = taxonomy_link("taxonomy terms", $node))) {
$xtemplate->template->assign("taxonomy", theme_links($taxonomy)); $xtemplate->template->assign("taxonomy", theme_links($taxonomy));
$xtemplate->template->parse("node.taxonomy"); $xtemplate->template->parse("node.taxonomy");
@ -82,10 +97,26 @@ function xtemplate_comment($comment, $links = 0) {
if ($comment->new) { if ($comment->new) {
$xtemplate->template->parse("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) { if ($links) {
$xtemplate->template->assign("links", $links); $xtemplate->template->assign("links", $links);
$xtemplate->template->parse("comment.links"); $xtemplate->template->parse("comment.links");
} }
$xtemplate->template->parse("comment"); $xtemplate->template->parse("comment");
$output = $xtemplate->template->text("comment"); $output = $xtemplate->template->text("comment");
$xtemplate->template->reset("comment"); $xtemplate->template->reset("comment");

View File

@ -56,6 +56,9 @@
<!-- BEGIN: node --> <!-- BEGIN: node -->
<div class="node {static}"> <div class="node {static}">
<!-- BEGIN: avatar -->
<div class="avatar">{avatar}</div>
<!-- END: avatar -->
<!-- BEGIN: title --> <!-- BEGIN: title -->
<h2 class="title"><a href="{link}">{title}</a></h2> <h2 class="title"><a href="{link}">{title}</a></h2>
<!-- END: title --> <!-- END: title -->
@ -72,6 +75,9 @@
<!-- BEGIN: comment --> <!-- BEGIN: comment -->
<div class="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 --> <h3 class="title">{title}</h3><!-- BEGIN: new --><span class="new">{new}</span><!-- END: new -->
<div class="submitted">{submitted}</div> <div class="submitted">{submitted}</div>
<div class="content">{content}</div> <div class="content">{content}</div>