New theme base for SuiteDesk

This commit is contained in:
Manuel Cillero 2017-07-25 13:55:37 +02:00
parent c1bbd9d6f5
commit 8cf3c56044
137 changed files with 12866 additions and 8 deletions

View file

@ -0,0 +1,7 @@
Zen 6.x-2.0 @TODO
-----------------
- #: Add fix to auto-correct tabs broken by contrib modules
- #: Display "edit menu" only when Menu block is displaying menu.module links
- * confirm all the variables of every tpl are documented.
- #341140: drupal_get_filename() is broken in Drupal 6. When that is fixed,
replace _zen_path() with drupal_get_path('theme', 'zen').

View file

@ -0,0 +1,80 @@
#!/bin/sh
# This script is used by the MAINTAINER to generate composite stylesheets for
# the base Zen theme from the stylesheets in the STARTERKIT.
FIXED=( \
html-reset \
wireframes \
layout-fixed \
page-backgrounds \
tabs \
messages \
pages \
block-editing \
blocks \
navigation \
views-styles \
nodes \
comments \
forms \
fields \
);
STYLESHEET='zen-fixed.css';
RTL_STYLESHEET='zen-fixed-rtl.css';
echo > $STYLESHEET;
echo > $RTL_STYLESHEET;
for FILENAME in ${FIXED[*]}; do
echo >> $STYLESHEET;
echo "/* $FILENAME.css */" >> $STYLESHEET;
echo >> $STYLESHEET;
cat ../../STARTERKIT/css/$FILENAME.css >> $STYLESHEET;
if [[ -e ../../STARTERKIT/css/$FILENAME-rtl.css ]]; then
echo >> $RTL_STYLESHEET;
echo "/* $FILENAME-rtl.css */" >> $RTL_STYLESHEET;
echo >> $RTL_STYLESHEET;
cat ../../STARTERKIT/css/$FILENAME-rtl.css >> $RTL_STYLESHEET;
fi
done
LIQUID=( \
html-reset \
wireframes \
layout-liquid \
page-backgrounds \
tabs \
messages \
pages \
block-editing \
blocks \
navigation \
views-styles \
nodes \
comments \
forms \
fields \
);
STYLESHEET='zen-liquid.css';
RTL_STYLESHEET='zen-liquid-rtl.css';
echo > $STYLESHEET;
echo > $RTL_STYLESHEET;
for FILENAME in ${LIQUID[*]}; do
echo >> $STYLESHEET;
echo "/* $FILENAME.css */" >> $STYLESHEET;
echo >> $STYLESHEET;
cat ../../STARTERKIT/css/$FILENAME.css >> $STYLESHEET;
if [[ -e ../../STARTERKIT/css/$FILENAME-rtl.css ]]; then
echo >> $RTL_STYLESHEET;
echo "/* $FILENAME-rtl.css */" >> $RTL_STYLESHEET;
echo >> $RTL_STYLESHEET;
cat ../../STARTERKIT/css/$FILENAME-rtl.css >> $RTL_STYLESHEET;
fi
done
cp ../../STARTERKIT/css/print.css .;
cp ../../STARTERKIT/css/ie.css .;
cp ../../STARTERKIT/css/ie6.css .;
cp ../../STARTERKIT/css/ie6-rtl.css .;

View file

@ -0,0 +1,47 @@
/**
* @file
* CSS targeted specifically for Internet Explorer for Windows.
*
* Any CSS in this file will apply to all versions of IE. You can target
* specific versions of IE by using conditional comments. See your sub-theme's
* .info file for an easy way to use them.
*
* While building your theme, you should be aware that IE limits Drupal to 31
* stylesheets total. The work-around for the bug is to enable CSS aggregation
* under: admin / settings / performance.
*/
/*
* Tabs
*/
ul.primary li a,
ul.primary li a .tab,
ul.secondary li a,
ul.secondary li a .tab {
cursor: pointer;
}
/*
* Drupal nodes
*/
.node-unpublished .node-inner>* {
position: relative; /* Otherwise these elements will appear below the "Unpublished" text. */
}
/*
* Drupal admin tables
*/
tr.even th,
tr.even td,
tr.odd th,
tr.odd td {
border-bottom: 1px solid #ccc; /* IE doesn't display borders on table rows */
}
/*
* Markup free clearing
*/
.clearfix {
zoom: 1;
}

View file

@ -0,0 +1,12 @@
/**
* @file
* RTL companion for the ie6.css file.
*/
/*
* Layout CSS
*/
#page {
text-align: right; /* 2nd part of IE5/IE6quirks centering hack */
}

View file

@ -0,0 +1,105 @@
/**
* @file
* CSS targeted specifically for Internet Explorer 5 and 6 for Windows.
*
* Any CSS in this file will override the rules specified in the ie.css file.
*/
/*
* Layout CSS
*/
body {
text-align: center; /* 1st part of IE5/IE6quirks centering hack */
}
#page {
text-align: left; /* LTR */ /* 2nd part of IE5/IE6quirks centering hack */
}
#main-wrapper {
zoom: 1; /* Otherwise with a liquid layout, sidebars disappear when resizing the windows in IE6 */
}
#content,
#navigation,
.region-sidebar-first,
.region-sidebar-second /* Floating divs */ {
display: inline; /* display inline or double your floated margin! [1] */
overflow: hidden; /* in ie6, overflow auto is broken [2] and so is overflow visible [3] */
overflow-y: visible;
}
/*
* Tabs - IE 5 and 6 don't support PNGs with alpha transparency.
*/
ul.primary li a,
ul.primary li a .tab,
ul.secondary li a,
ul.secondary li a .tab {
display: inline-block; /* Otherwise the blocks mistakenly get 100% width in IE6 */
}
ul.primary li a {
background: url(../images/tab-left-ie6.png) no-repeat left -38px;
}
ul.primary li a .tab {
background: url(../images/tab-right-ie6.png) no-repeat right -38px;
}
ul.primary li a:hover,
ul.primary li a:focus {
background: url(../images/tab-left-ie6.png) no-repeat left -76px;
}
ul.primary li a:hover .tab,
ul.primary li a:focus .tab {
background: url(../images/tab-right-ie6.png) no-repeat right -76px;
}
ul.primary li.active a,
ul.primary li.active a:hover,
ul.primary li.active a:focus {
background: url(../images/tab-left-ie6.png) no-repeat left 0;
}
ul.primary li.active a .tab,
ul.primary li.active a:hover .tab,
ul.primary li.active a:focus .tab {
background: url(../images/tab-right-ie6.png) no-repeat right 0;
}
/*
* Messages - IE 5 and 6 don't support PNGs with alpha transparency.
*/
div.messages,
div.status,
div.warning,
div.error /* Important messages (status, warning, and error) for the user */ {
background-image: url(../images/messages-status-ie6.png);
}
div.warning /* Medium priority messages */ {
background-image: url(../images/messages-warning-ie6.png);
}
div.error /* High priority messages. See also the .error declaration below. */ {
background-image: url(../images/messages-error-ie6.png);
}
/*
* REFERENCES
*
1. http://www.positioniseverything.net/explorer/doubled-margin.html
2. http://browservulsel.blogspot.com/2005/04/ie-overflow-auto-scrollbar-overlap.html
3. http://www.howtocreate.co.uk/wrongWithIE/?chapter=overflow%3Avisible%3B
4. http://www.ryanbrill.com/archives/multiple-classes-in-ie
*
*/

View file

@ -0,0 +1,73 @@
/**
* @file
* Print styling
*
* We provide some sane print styling for Drupal using Zen's layout method.
*/
/* underline all links */
a:link,
a:visited {
text-decoration: underline !important;
}
/* Don't underline header */
#site-name a:link,
#site-name a:visited {
text-decoration: none !important;
}
/* CSS2 selector to add visible href after links */
#content a:link:after,
#content a:visited:after {
content: " (" attr(href) ") ";
font-size: 0.8em;
font-weight: normal;
}
/* Un-float the content */
#content,
#content .section {
float: none;
width: 100%;
margin: 0 !important;
padding: 0 !important;
}
/* Turn off any background colors or images */
body,
#page-wrapper,
#page,
#main-wrapper,
#main,
#content,
#content .section {
color: #000;
background-color: transparent !important;
background-image: none !important;
}
/* Hide sidebars and nav elements */
#skip-link,
#navigation,
.region-sidebar-first,
.region-sidebar-second,
#footer,
.breadcrumb,
div.tabs,
.links,
.taxonomy,
.book-navigation,
.forum-topic-navigation,
.pager,
.feed-icons {
visibility: hidden;
display: none;
}
/* If you un-comment the "page { overflow-y: hidden; }" ruleset, Firefox clips
the content after the first page. */
#page-wrapper {
overflow-y: visible;
}

View file

@ -0,0 +1,56 @@
/**
* @file
* Theme settings styling
*
* This file is only loaded on the Theme Settings page for Zen and its
* subthemes: admin/build/themes/settings
*/
#zen-settings fieldset .form-item
{
padding-left: 0;
padding-right: 200px;
}
#zen-settings fieldset .form-checkboxes .form-item,
#zen-settings fieldset .form-radios .form-item
{
padding-right: 0;
}
#zen-settings fieldset .form-item label
{
float: right;
margin-left: 10px;
margin-right: -200px;
text-align: left;
}
#zen-settings fieldset .form-item label.option
{
text-align: right;
}
#div-zen-registry strong,
#div-zen-wireframes strong
{
float: right;
margin-left: 10px;
margin-right: 0;
text-align: left;
}
#div-zen-registry fieldset .form-item,
#div-zen-wireframes fieldset .form-item
{
margin-right: 0;
padding-right: 0;
}
#div-zen-registry fieldset .form-item .description,
#div-zen-wireframes fieldset .form-item .description
{
margin-left: 0;
margin-right: 200px;
}

View file

@ -0,0 +1,69 @@
/**
* @file
* Theme settings styling
*
* This file is only loaded on the Theme Settings page for Zen and its
* subthemes: admin/build/themes/settings
*/
#zen-settings fieldset .form-item
{
padding-left: 200px; /* LTR */
}
#zen-settings fieldset .form-checkboxes .form-item,
#zen-settings fieldset .form-radios .form-item
{
padding-left: 0; /* LTR */
}
#zen-settings fieldset .form-item label
{
float: left; /* LTR */
width: 190px;
margin-left: -200px; /* LTR */
margin-right: 10px; /* LTR */
text-align: right; /* LTR */
_display: inline-block; /* IE6 is dumb. */
}
#zen-settings fieldset .form-item label.option
{
float: none;
width: auto;
margin-left: 0;
margin-right: 0;
text-align: left; /* LTR */
}
#div-zen-registry,
#div-zen-wireframes
{
margin: 1em 0;
}
#div-zen-registry strong,
#div-zen-wireframes strong
{
float: left; /* LTR */
width: 190px;
margin-left: 0; /* LTR */
margin-right: 10px; /* LTR */
text-align: right; /* LTR */
}
#div-zen-registry fieldset .form-item,
#div-zen-wireframes fieldset .form-item
{
display: inline;
margin-left: 0; /* LTR */
padding-left: 0; /* LTR */
}
#div-zen-registry fieldset .form-item .description,
#div-zen-wireframes fieldset .form-item .description
{
display: block;
margin-left: 200px; /* LTR */
}

View file

@ -0,0 +1,243 @@
/* html-reset-rtl.css */
/**
* @file
* RTL companion for the html-reset.css file.
*/
/*
* Lists
*
* We need to standardize the list item indentation.
*/
ul,
ol {
padding-left: 0;
padding-right: 2em;
}
.block ul,
.item-list ul /* Drupal overrides */ {
padding: 0 2em 0 0;
}
dd {
margin: 0 2em 0 0;
}
/*
* Tables
*
* Drupal provides table styling which is only useful for its admin section
* forms, so we override this default CSS. (We set it back in forms.css.)
*/
th,
thead th,
tbody th {
text-align: right;
}
/* layout-fixed-rtl.css */
/**
* @file
* RTL companion for the layout-fixed.css file.
*/
/*
* Content
*/
#content,
.no-sidebars #content {
float: right;
margin-left: -960px; /* Negative value of #content's width + right margin. */
margin-right: 0;
}
.sidebar-first #content {
margin-left: -960px; /* Negative value of #content's width + right margin. */
margin-right: 200px; /* The width of .region-sidebar-first. */
}
.sidebar-second #content {
margin-left: -760px; /* Negative value of #content's width + right margin. */
margin-right: 0;
}
.two-sidebars #content {
margin-left: -760px; /* Negative value of #content's width + right margin. */
margin-right: 200px; /* The width of .region-sidebar-first */
}
/*
* Navigation
*/
#navigation {
float: right;
margin-left: -100%; /* Negative value of #navigation's width + right margin. */
margin-right: 0;
}
#navigation ul /* Primary and secondary links */ {
text-align: right;
}
#navigation li /* A simple method to get navigation links to appear in one line. */ {
float: right;
padding: 0 0 0 10px;
}
/*
* First sidebar
*/
.region-sidebar-first {
float: right;
margin-left: -200px; /* Negative value of .region-sidebar-first's width + right margin. */
margin-right: 0;
}
.region-sidebar-first .section {
margin: 0 0 0 20px;
}
/*
* Second sidebar
*/
.region-sidebar-second {
float: right;
margin-left: -960px; /* Negative value of .region-sidebar-second's width + right margin. */
margin-right: 760px; /* Width of content + sidebar-first. */
}
.region-sidebar-second .section {
margin: 0 20px 0 0;
}
/* tabs-rtl.css */
/**
* @file
* RTL companion for the tabs.css file.
*/
ul.primary {
padding: 0 10px 0 0;
}
ul.primary li {
float: right;
}
ul.secondary {
padding: 0 5px 0 0;
}
ul.secondary li {
float: right;
border-left: none;
}
/* messages-rtl.css */
/**
* @file
* RTL companion for the messages.css file.
*/
div.messages,
div.status,
div.warning,
div.error /* Important messages (status, warning, and error) for the user */ {
padding: 5px 35px 5px 5px;
background-position: 99.5% 5px;
}
/* pages-rtl.css */
/**
* @file
* RTL companion for the pages.css file.
*/
/*
* Header
*/
#logo /* Wrapping link for logo */ {
float: right;
}
/*
* Content
*/
.more-link /* Aggregator, blog, and forum more link */ {
text-align: left;
}
/* block-editing-rtl.css */
/**
* @file
* RTL companion for the block-editing.css file.
*/
div.block.with-block-editing div.edit {
left: 0;
right: auto;
}
/* forms-rtl.css */
/**
* @file
* RTL companion for the forms.css file.
*/
/*
* Drupal's default login form block
*/
#user-login-form {
text-align: right;
}
/*
* OpenID
*
* The default styling for the OpenID login link seems to assume Garland's
* styling of list items.
*/
#user-login-form li.openid-link /* The "Log in using OpenID" link. */ {
margin-left: 0;
margin-right: -20px; /* Un-do some of the padding on the ul list. */
}
#user-login li.openid-link,
#user-login li.user-link /* The OpenID links on the /user form. */ {
margin-left: 0;
margin-right: -2em; /* Un-do all of the padding on the ul list. */
}
/*
* Drupal admin tables
*
* We overrode these styles in html-elements.css, but restore them for the admin
* section of the site.
*/
form th,
form thead th {
text-align: right;
padding-left: 1em;
padding-right: 0;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,237 @@
/* html-reset-rtl.css */
/**
* @file
* RTL companion for the html-reset.css file.
*/
/*
* Lists
*
* We need to standardize the list item indentation.
*/
ul,
ol {
padding-left: 0;
padding-right: 2em;
}
.block ul,
.item-list ul /* Drupal overrides */ {
padding: 0 2em 0 0;
}
dd {
margin: 0 2em 0 0;
}
/*
* Tables
*
* Drupal provides table styling which is only useful for its admin section
* forms, so we override this default CSS. (We set it back in forms.css.)
*/
th,
thead th,
tbody th {
text-align: right;
}
/* layout-liquid-rtl.css */
/**
* @file
* RTL companion for the layout-liquid.css file.
*/
/*
* Content
*/
#content {
float: right;
margin-left: -100%; /* Negative value of #content's width + right margin. */
margin-right: 0;
}
.sidebar-first #content .section {
padding-left: 0;
padding-right: 200px; /* The width + right margin of .region-sidebar-first. */
}
.sidebar-second #content .section {
padding-left: 200px; /* The width + left margin of .region-sidebar-second. */
padding-right: 0;
}
/*
* Navigation
*/
#navigation {
float: right;
margin-left: -100%; /* Negative value of #navigation's width + right margin. */
margin-right: 0;
}
#navigation ul /* Primary and secondary links */ {
text-align: right;
}
#navigation li /* A simple method to get navigation links to appear in one line. */ {
float: right;
padding: 0 0 0 10px;
}
/*
* First sidebar
*/
.region-sidebar-first {
float: right;
margin-left: -200px; /* Negative value of .region-sidebar-first's width + right margin. */
margin-right: 0;
}
.region-sidebar-first .section {
margin: 0 0 0 20px;
}
/*
* Second sidebar
*/
.region-sidebar-second {
float: left;
margin-left: 0;
margin-right: -200px; /* Negative value of .region-sidebar-second's width + left margin. */
}
.region-sidebar-second .section {
margin: 0 20px 0 0;
}
/* tabs-rtl.css */
/**
* @file
* RTL companion for the tabs.css file.
*/
ul.primary {
padding: 0 10px 0 0;
}
ul.primary li {
float: right;
}
ul.secondary {
padding: 0 5px 0 0;
}
ul.secondary li {
float: right;
border-left: none;
}
/* messages-rtl.css */
/**
* @file
* RTL companion for the messages.css file.
*/
div.messages,
div.status,
div.warning,
div.error /* Important messages (status, warning, and error) for the user */ {
padding: 5px 35px 5px 5px;
background-position: 99.5% 5px;
}
/* pages-rtl.css */
/**
* @file
* RTL companion for the pages.css file.
*/
/*
* Header
*/
#logo /* Wrapping link for logo */ {
float: right;
}
/*
* Content
*/
.more-link /* Aggregator, blog, and forum more link */ {
text-align: left;
}
/* block-editing-rtl.css */
/**
* @file
* RTL companion for the block-editing.css file.
*/
div.block.with-block-editing div.edit {
left: 0;
right: auto;
}
/* forms-rtl.css */
/**
* @file
* RTL companion for the forms.css file.
*/
/*
* Drupal's default login form block
*/
#user-login-form {
text-align: right;
}
/*
* OpenID
*
* The default styling for the OpenID login link seems to assume Garland's
* styling of list items.
*/
#user-login-form li.openid-link /* The "Log in using OpenID" link. */ {
margin-left: 0;
margin-right: -20px; /* Un-do some of the padding on the ul list. */
}
#user-login li.openid-link,
#user-login li.user-link /* The OpenID links on the /user form. */ {
margin-left: 0;
margin-right: -2em; /* Un-do all of the padding on the ul list. */
}
/*
* Drupal admin tables
*
* We overrode these styles in html-elements.css, but restore them for the admin
* section of the site.
*/
form th,
form thead th {
text-align: right;
padding-left: 1em;
padding-right: 0;
}

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

View file

@ -0,0 +1,27 @@
$(document).ready( function() {
// Hide the breadcrumb details, if no breadcrumb.
$('#edit-zen-breadcrumb').change(
function() {
div = $('#div-zen-breadcrumb-collapse');
if ($('#edit-zen-breadcrumb').val() == 'no') {
div.slideUp('slow');
} else if (div.css('display') == 'none') {
div.slideDown('slow');
}
}
);
if ($('#edit-zen-breadcrumb').val() == 'no') {
$('#div-zen-breadcrumb-collapse').css('display', 'none');
}
$('#edit-zen-breadcrumb-title').change(
function() {
checkbox = $('#edit-zen-breadcrumb-trailing');
if ($('#edit-zen-breadcrumb-title').attr('checked')) {
checkbox.attr('disabled', 'disabled');
} else {
checkbox.removeAttr('disabled');
}
}
);
$('#edit-zen-breadcrumb-title').change();
} );

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,88 @@
<?php
/**
* @file
* Contains functions only needed if the user has block editing permissions.
*/
/**
* Add block editing variables into the block templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("block" in this case.)
*/
function zen_preprocess_block_editing(&$vars, $hook) {
$block = $vars['block'];
// Display 'edit block' for custom blocks.
if ($block->module == 'block') {
$vars['edit_links_array']['block-edit'] = l('<span>' . t('edit block') . '</span>', 'admin/build/block/configure/' . $block->module . '/' . $block->delta,
array(
'attributes' => array(
'title' => t('edit the content of this block'),
'class' => 'block-edit',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'configure' for other blocks.
else {
$vars['edit_links_array']['block-config'] = l('<span>' . t('configure') . '</span>', 'admin/build/block/configure/' . $block->module . '/' . $block->delta,
array(
'attributes' => array(
'title' => t('configure this block'),
'class' => 'block-config',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'edit view' for Views blocks.
if ($block->module == 'views' && user_access('administer views')) {
list($view_name, $view_block) = explode('-block', $block->delta);
$vars['edit_links_array']['block-edit-view'] = l('<span>' . t('edit view') . '</span>', 'admin/build/views/edit/' . $view_name,
array(
'attributes' => array(
'title' => t('edit the view that defines this block'),
'class' => 'block-edit-view',
),
'query' => drupal_get_destination(),
'fragment' => 'views-tab-block' . $view_block,
'html' => TRUE,
)
);
}
// Display 'edit menu' for Menu blocks.
elseif (($block->module == 'menu' || ($block->module == 'user' && $block->delta == 1)) && user_access('administer menu')) {
$menu_name = ($block->module == 'user') ? 'navigation' : $block->delta;
$vars['edit_links_array']['block-edit-menu'] = l('<span>' . t('edit menu') . '</span>', 'admin/build/menu-customize/' . $menu_name,
array(
'attributes' => array(
'title' => t('edit the menu that defines this block'),
'class' => 'block-edit-menu',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'edit menu' for Menu block blocks.
elseif ($block->module == 'menu_block' && user_access('administer menu')) {
list($menu_name, ) = split(':', variable_get("menu_block_{$block->delta}_parent", 'navigation:0'));
$vars['edit_links_array']['block-edit-menu'] = l('<span>' . t('edit menu') . '</span>', 'admin/build/menu-customize/' . $menu_name,
array(
'attributes' => array(
'title' => t('edit the menu that defines this block'),
'class' => 'block-edit-menu',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
}

View file

@ -0,0 +1,58 @@
<?php
/**
* @file
* Contains functions only needed when rendering comments.
*/
/**
* Override or insert variables into the comment templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("comment" in this case.)
*/
function _zen_preprocess_comment(&$vars, $hook) {
// In Drupal 7, $date has been renamed to $created.
$vars['created'] = $vars['date'];
// If comment subjects are disabled, don't display them.
if (variable_get('comment_subject_field_' . $vars['node']->type, 1) == 0) {
$vars['title'] = '';
}
// New comment.
if ($vars['comment']->new) {
$vars['classes_array'][] = 'comment-new';
}
// Add an "unpublished" flag.
if ($vars['comment']->status == COMMENT_NOT_PUBLISHED) {
$vars['unpublished'] = TRUE;
$vars['classes_array'][] = $vars['status'];
}
else {
$vars['unpublished'] = FALSE;
}
// Zebra striping.
if ($vars['id'] == 1) {
$vars['classes_array'][] = 'first';
}
if ($vars['id'] == $vars['node']->comment_count) {
$vars['classes_array'][] = 'last';
}
$vars['classes_array'][] = $vars['zebra'];
if ($vars['comment']->uid == 0) {
// Comment is by an anonymous user.
$vars['classes_array'][] = 'comment-by-anonymous';
}
else {
if ($vars['comment']->uid == $vars['node']->uid) {
// Comment is by the node author.
$vars['classes_array'][] = 'comment-by-node-author';
}
if ($vars['comment']->uid == $GLOBALS['user']->uid) {
// Comment was posted by current user.
$vars['classes_array'][] = 'comment-by-viewer';
}
}
}

View file

@ -0,0 +1,112 @@
<?php
// The code for conditional stylesheets started out as a patch for Zen. Now that
// it has been spun out to its own separate module, It would be nice to prevent
// code drift between the Zen implementation and the conditional_styles.module,
// so Zen now includes an exact copy of conditonal_style module's
// conditional_styles.theme.inc file.
/**
* @file
* Allows themes to add conditional stylesheets.
*
* @see http://msdn.microsoft.com/en-us/library/ms537512.aspx
*/
/**
* Return paths for the theme and its base themes.
*
* @param $theme
* The name of the theme.
* @return
* An array of all the theme paths.
*/
function conditional_styles_paths_to_basetheme($theme) {
static $theme_paths;
if (empty($theme_paths[$theme])) {
$theme_paths[$theme] = array();
$themes = list_themes();
// Grab the paths from the base theme.
if (!empty($themes[$theme]->base_theme)) {
$theme_paths[$theme] = conditional_styles_paths_to_basetheme($themes[$theme]->base_theme);
}
$theme_paths[$theme][$theme] = dirname($themes[$theme]->filename);
}
return $theme_paths[$theme];
}
/**
* When the theme registry is rebuilt, we also build the conditional stylesheets.
*/
function _conditional_styles_theme($existing, $type, $theme, $path) {
// Process the conditional stylesheets for every active theme.
$themes = list_themes();
foreach (array_keys($themes) AS $theme) {
// We only need to process active themes.
if ($themes[$theme]->status || $GLOBALS['theme'] == $theme) {
$paths = conditional_styles_paths_to_basetheme($theme);
// Grab all the conditional stylesheets.
$stylesheets = array();
// Start with the base theme and travel up the chain to the active theme.
foreach ($paths AS $theme_name => $path) {
// Look at the conditional-stylesheets defined in the theme's .info file.
if (!empty($themes[$theme_name]->info['conditional-stylesheets'])) {
foreach ($themes[$theme_name]->info['conditional-stylesheets'] AS $condition => $css) {
// Allow the theme to override its base themes' styles.
foreach ($css AS $media => $files) {
foreach ($files AS $file) {
$stylesheets[$condition][$media][$file] = $path;
}
}
}
}
}
// Render the stylesheets to link elements.
$conditional_styles = $conditional_styles_rtl = '';
if (!empty($stylesheets)) {
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
$base_path = base_path();
foreach ($stylesheets AS $condition => $css) {
// Each condition requires its own set of links.
$output = $output_rtl = '';
foreach ($css AS $media => $files) {
foreach ($files AS $file => $path) {
// Don't allow non-existent stylesheets to clutter the logs with 404.
if (file_exists("./$path/$file")) {
$link = "<link type=\"text/css\" rel=\"stylesheet\" media=\"$media\" href=\"$base_path$path/$file$query_string\" />\n";
$output .= $link;
$output_rtl .= $link;
$file_rtl = str_replace('.css', '-rtl.css', $file);
if (file_exists("./$path/$file_rtl")) {
$output_rtl .= "<link type=\"text/css\" rel=\"stylesheet\" media=\"$media\" href=\"$base_path$path/$file_rtl$query_string\" />\n";
}
}
}
}
if ($output) {
$conditional_styles .= "<!--[$condition]>\n$output<![endif]-->\n";
$conditional_styles_rtl .= "<!--[$condition]>\n$output_rtl<![endif]-->\n";
}
}
}
// Save the stylesheets for later retrieval.
if ($conditional_styles) {
if (db_is_active()) {
variable_set('conditional_styles_' . $theme, $conditional_styles);
variable_set('conditional_styles_' . $theme . '_rtl', $conditional_styles_rtl);
}
else {
$GLOBALS['conf']['conditional_styles_' . $theme] = $conditional_styles;
$GLOBALS['conf']['conditional_styles_' . $theme . '_rtl'] = $conditional_styles_rtl;
}
}
elseif (db_is_active()) {
variable_del('conditional_styles_' . $theme);
variable_del('conditional_styles_' . $theme . '_rtl');
}
}
}
// Return nothing.
return array();
}

View file

@ -0,0 +1,137 @@
<?php
/**
* @file
* Contains infrequently used theme registry build functions.
*/
/**
* Implements HOOK_theme().
*
* We are simply using this hook as a convenient time to do some related work.
*/
function _zen_theme(&$existing, $type, $theme, $path) {
// Compute the conditional stylesheets.
if (!module_exists('conditional_styles')) {
include_once './' . _zen_path() . '/zen-internals/template.conditional-styles.inc';
// _conditional_styles_theme() only needs to be run once.
if ($theme == 'zen') {
_conditional_styles_theme($existing, $type, $theme, $path);
}
}
// Since we are rebuilding the theme registry and the theme settings' default
// values may have changed, make sure they are saved in the database properly.
zen_theme_get_default_settings($theme);
// If we are auto-rebuilding the theme registry, warn about the feature.
// Always display the warning in the admin section, otherwise limit to three
// warnings per hour.
if (function_exists('user_access') && user_access('administer site configuration') && theme_get_setting('zen_rebuild_registry') && $theme == $GLOBALS['theme'] && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) {
flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning');
drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is <em>extremely</em> important to <a href="!link">turn off this feature</a> on production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning', FALSE);
}
// Keep track of all the base themes.
static $base_themes = array();
$base_themes[] = $theme;
// Add a "process" phase to come after the "preprocess" functions.
if ($type == 'theme') {
foreach (array_keys($existing) as $hook) {
// Normally, preprocess functions are added to the registry after
// HOOK_theme() returns, but if we add them first, they won't be re-added.
if (function_exists($theme . '_preprocess')) {
$existing[$hook]['preprocess functions'][] = $theme . '_preprocess';
}
if (function_exists($theme . '_preprocess_' . $hook)) {
$existing[$hook]['preprocess functions'][] = $theme . '_preprocess_' . $hook;
}
// Add base theme process functions.
foreach ($base_themes as $base_theme) {
if (function_exists($base_theme . '_process')) {
$existing[$hook]['preprocess functions'][] = $base_theme . '_process';
}
if (function_exists($base_theme . '_process_' . $hook)) {
$existing[$hook]['preprocess functions'][] = $base_theme . '_process_' . $hook;
}
}
// Add the theme process functions.
if (function_exists($theme . '_process')) {
$existing[$hook]['preprocess functions'][] = $theme . '_process';
}
if (function_exists($theme . '_process_' . $hook)) {
$existing[$hook]['preprocess functions'][] = $theme . '_process_' . $hook;
}
}
}
// Manipulations only to be done by the base theme.
if ($theme == 'zen') {
// Insert zen_show_blocks_discovery() before template_preprocess_page().
$existing['page']['preprocess functions'] = array_merge(array('zen_show_blocks_discovery'), $existing['page']['preprocess functions']);
// Allow theme hook suggestions on theme_links.
$existing['links']['pattern'] = 'links__';
// The base theme registers region.tpl.php.
$templates = array(
'region' => array(
'arguments' => array('elements' => NULL),
'pattern' => 'region_',
'path' => drupal_get_path('theme', 'zen') . '/templates',
'template' => 'region',
// drupal_find_theme_templates() requires this, so manually add it.
'include files' => array(),
),
);
// We have to manually find template suggestions since phptemplate_theme()
// is in charge of that, but runs before zen_theme().
$templates += drupal_find_theme_templates($templates, '.tpl.php', $path);
// We manually register the preprocess and process functions, since Drupal
// won't auto-register template_preprocess or process functions.
foreach (array_keys($templates) as $key) {
$templates[$key]['preprocess functions'] = array(
'template_preprocess',
'zen_preprocess',
'zen_preprocess_region',
'zen_process',
);
}
return $templates;
}
// Else return nothing.
return array();
}
/**
* Return the theme settings' default values from the .info and save them into the database.
*
* @param $theme
* The name of theme.
*/
function zen_theme_get_default_settings($theme) {
$themes = list_themes();
// Get the default values from the .info file.
$defaults = !empty($themes[$theme]->info['settings']) ? $themes[$theme]->info['settings'] : array();
if (!module_exists('domain_theme') && !empty($defaults)) {
// Merge the defaults with the theme settings saved in the database.
$settings = array_merge($defaults, variable_get('theme_'. $theme .'_settings', array()));
// Save the settings back to the database.
if (db_is_active()) {
variable_set('theme_'. $theme .'_settings', $settings);
}
else {
$GLOBALS['conf']['theme_'. $theme .'_settings'] = $settings;
}
// If the active theme has been loaded, force refresh of Drupal internals.
if (!empty($GLOBALS['theme_key'])) {
theme_get_setting('', TRUE);
}
}
// Return the default settings.
return $defaults;
}

View file

@ -0,0 +1,41 @@
<?php
/**
* @file
* Add stylesheets that are only needed when Zen is the enabled theme.
*
* Don't do something this dumb in your sub-theme. Stylesheets should be added
* using your sub-theme's .info file. If you desire styles that apply
* conditionally, you can conditionally add a "body class" in the
* preprocess_page function. For example, see how wireframes.css is handled in
* zen_preprocess_page() and wireframes.css.
*/
/**
* If the user is silly and enables Zen as the theme, manually add some stylesheets.
*/
function _zen_preprocess_page(&$vars, $hook) {
$directory = _zen_path() . '/zen-internals/css';
// Add default styles.
if (theme_get_setting('zen_layout') == 'zen-columns-fixed') {
drupal_add_css($directory . '/zen-fixed.css', 'theme', 'all');
}
else {
drupal_add_css($directory . '/zen-liquid.css', 'theme', 'all');
}
// Add print styles.
drupal_add_css($directory . '/print.css', 'theme', 'print');
// Regenerate the stylesheets.
$vars['css'] = drupal_add_css();
$vars['styles'] = drupal_get_css();
// Add IE styles.
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
$base_path = base_path() . $directory;
$vars['styles'] .= <<< IE_STYLES
<!--[if IE]><link type="text/css" rel="stylesheet" media="all" href="$base_path/ie.css$query_string" /><![endif]-->
<!--[if lte IE 6]><link type="text/css" rel="stylesheet" media="all" href="$base_path/ie6.css$query_string" /><![endif]-->
IE_STYLES;
}