Index: template.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/themes/zen/zen/template.php,v retrieving revision 1.44.2.6 diff -u -r1.44.2.6 template.php --- template.php 13 Feb 2009 19:02:49 -0000 1.44.2.6 +++ template.php 4 Mar 2009 22:37:50 -0000 @@ -187,6 +187,22 @@ // Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc. $classes[] = zen_id_safe('node-type-' . $vars['type']); $vars['classes'] = implode(' ', $classes); // Concatenate with spaces + + // Apply node-settings + $submitted_by_content_type = (theme_get_setting('submitted_by_enable_content_type') == 1) ? $vars['node']->type : 'default'; + $date_setting = (theme_get_setting('submitted_by_date_'. $submitted_by_content_type) == 1); + $author_setting = (theme_get_setting('submitted_by_author_'. $submitted_by_content_type) == 1); + + if ($author_setting && $date_setting) { + $out = theme('node_submitted', $vars['node']); + } + elseif($author_setting && !$date_setting) { + $out = t('Submitted by !username', array('!username' => theme('username', $vars['node']))); + } + else { + $out = t('Submitted on @datetime', array('@datetime' => format_date($vars['node']->created))); + } + $vars['submitted'] = $out; } /** Index: theme-settings.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/themes/zen/zen/theme-settings.css,v retrieving revision 1.3 diff -u -r1.3 theme-settings.css --- theme-settings.css 1 Dec 2008 05:30:12 -0000 1.3 +++ theme-settings.css 4 Mar 2009 22:39:53 -0000 @@ -68,3 +68,7 @@ display: block; margin-left: 200px; } + + #zen-nodesettings fieldset .form-item { + padding-left: 0; + } \ No newline at end of file Index: theme-settings.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/themes/zen/zen/theme-settings.js,v retrieving revision 1.2 diff -u -r1.2 theme-settings.js --- theme-settings.js 6 May 2008 13:32:35 -0000 1.2 +++ theme-settings.js 4 Mar 2009 22:41:01 -0000 @@ -1,4 +1,33 @@ $(document).ready( function() { + // Hide all nodes-type settings if using Default + function zen_nodesettings_default(show) { + if(show) { + $('fieldset.zen-nodesettings-submitted-other').css('display', 'none'); + $('#zen-nodesettings-submitted-default').show(); + } + else { + $('fieldset.zen-nodesettings-submitted-other').show(); + $('#zen-nodesettings-submitted-default').css('display', 'none'); + } + } + $('#edit-submitted-by-enable-content-type').change( + function() { + if ($('#edit-submitted-by-enable-content-type').attr('checked')) { + zen_nodesettings_default(false); + } + else { + zen_nodesettings_default(true); + } + } + ); + if ($('#edit-submitted-by-enable-content-type').val() == 1) { + zen_nodesettings_default(false); + } + else { + zen_nodesettings_default(true); + } + $('#edit-submitted-by-enable-content-type').change(); + // Hide the breadcrumb details, if no breadcrumb. $('#edit-zen-breadcrumb').change( function() { Index: theme-settings.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/themes/zen/zen/theme-settings.php,v retrieving revision 1.6 diff -u -r1.6 theme-settings.php --- theme-settings.php 15 Sep 2008 09:59:03 -0000 1.6 +++ theme-settings.php 4 Mar 2009 22:41:52 -0000 @@ -3,6 +3,7 @@ // Include the definition of zen_theme_get_default_settings(). include_once './' . drupal_get_path('theme', 'zen') . '/template.theme-registry.inc'; +include_once './' . drupal_get_path('theme', 'zen') . '/template.node-settings.inc'; /** @@ -89,6 +90,10 @@ '#suffix' => '', // #div-zen-breadcrumb ); + // Adding node-settings + $form += _zen_get_nodesettings_form($settings); + + // Theme developer settings $form['themedev'] = array( '#type' => 'fieldset', '#title' => t('Theme development settings'), --- template.node-settings.inc +++ template.node-settings.inc @@ -0,0 +1,140 @@ + 'fieldset', + '#title' => t('Node settings'), + '#description' => t('Here you can make adjustments to which information is shown with your content, and how it is displayed. You can modify these settings so they apply to all content types, or check the "Use content-type specific settings" box to customize them for each content type. For example, you may want to show the date on stories, but not pages.'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#attributes' => array('id' => 'zen-nodesettings'), + ); + + // Author & Date Settings + $form['nodesettings']['submitted_by_container'] = array( + '#type' => 'fieldset', + '#title' => t('Author & date'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + // Default & content-type specific settings + $form['nodesettings']['submitted_by_container']['submitted_by']['submitted_by_enable_content_type'] = array( + '#type' => 'checkbox', + '#title' => t('Use custom settings for each content type'), + '#description' => t('Using per-nodetype settings will result in a more granular options. If a node-settin is disabled means that it is disabled in Drupal Global theme settings.', array('!link' => url('admin/build/themes/settings'))), + '#default_value' => $settings['submitted_by_enable_content_type'], + ); + + foreach ((array('default' => 'Default') + node_get_types('names')) as $type => $name) { + $disabled = ($type != 'default') ? !$settings['toggle_node_info_' .$type] : FALSE; + $form['nodesettings']['submitted_by_container']['submitted_by'][$type] = array( + '#type' => 'fieldset', + '#title' => t('!name', array('!name' => t($name))), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#attributes' => array('class' => 'zen-nodesettings-submitted-other'), + ); + $form['nodesettings']['submitted_by_container']['submitted_by'][$type]['submitted_by_author_'. $type] = array( + '#type' => 'checkbox', + '#title' => t("Display author's username"), + '#default_value' => $settings['submitted_by_author_'. $type], + '#disabled' => $disabled, + ); + $form['nodesettings']['submitted_by_container']['submitted_by'][$type]['submitted_by_date_'. $type] = array( + '#type' => 'checkbox', + '#title' => t('Display date posted (you can customize this format on your Date and Time settings page)'), + '#default_value' => $settings['submitted_by_date_'. $type], + '#disabled' => $disabled, + ); + // Options for default settings + if ($type == 'default') { + $form['nodesettings']['submitted_by_container']['submitted_by']['default']['#attributes'] = array('id' => 'zen-nodesettings-submitted-default'); + $form['nodesettings']['submitted_by_container']['submitted_by']['default']['#title'] = t('Default'); + $form['nodesettings']['submitted_by_container']['submitted_by']['default']['#collapsed'] = $settings['submitted_by_enable_content_type'] ? TRUE : FALSE; + + } + /* + // Collapse content-type specific settings if default settings are being used + elseif ($settings['submitted_by_enable_content_type'] == 0) { + $form['submitted_by'][$type]['#collapsed'] = TRUE; + } + */ + } + + // Taxonomy Settings + if (FALSE && module_exists('taxonomy')) { + $form['nodesettings']['display_taxonomy_container'] = array( + '#type' => 'fieldset', + '#title' => t('Taxonomy terms'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + // Default & content-type specific settings + foreach ((array('default' => 'Default') + node_get_types('names')) as $type => $name) { + // taxonomy display per node + $form['nodesettings']['display_taxonomy_container']['display_taxonomy'][$type] = array( + '#type' => 'fieldset', + '#title' => t('!name', array('!name' => t($name))), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + // display + $form['nodesettings']['display_taxonomy_container']['display_taxonomy'][$type]['taxonomy_display_'. $type] = array( + '#type' => 'select', + '#title' => t('When should taxonomy terms be displayed?'), + '#default_value' => $settings['taxonomy_display_'. $type], + '#options' => array( + '' => '', + 'never' => t('Never display taxonomy terms'), + 'all' => t('Always display taxonomy terms'), + 'only' => t('Only display taxonomy terms on full node pages'), + ), + ); + // format + $form['nodesettings']['display_taxonomy_container']['display_taxonomy'][$type]['taxonomy_format_'. $type] = array( + '#type' => 'radios', + '#title' => t('Taxonomy display format'), + '#default_value' => $settings['taxonomy_format_'. $type], + '#options' => array( + 'vocab' => t('Display each vocabulary on a new line'), + 'list' => t('Display all taxonomy terms together in single list'), + ), + ); + // Get taxonomy vocabularies by node type + $vocabs = array(); + $vocabs_by_type = ($type == 'default') ? taxonomy_get_vocabularies() : taxonomy_get_vocabularies($type); + foreach ($vocabs_by_type as $key => $value) { + $vocabs[$value->vid] = $value->name; + } + // Display taxonomy checkboxes + foreach ($vocabs as $key => $vocab_name) { + $form['nodesettings']['display_taxonomy_container']['display_taxonomy'][$type]["taxonomy_vocab_display_{$type}_{$key}"] = array( + '#type' => 'checkbox', + '#title' => t('Display vocabulary: '. $vocab_name), + '#default_value' => $settings["taxonomy_vocab_display_{$type}_{$key}"], + ); + } + // Options for default settings + if ($type == 'default') { + $form['nodesettings']['display_taxonomy_container']['display_taxonomy']['default']['#title'] = t('Default'); + $form['nodesettings']['display_taxonomy_container']['display_taxonomy']['default']['#collapsed'] = $settings['taxonomy_enable_content_type'] ? TRUE : FALSE; + $form['nodesettings']['display_taxonomy_container']['display_taxonomy']['taxonomy_enable_content_type'] = array( + '#type' => 'checkbox', + '#title' => t('Use custom settings for each content type instead of the default above'), + '#default_value' => $settings['taxonomy_enable_content_type'], + ); + } + // Collapse content-type specific settings if default settings are being used + else if ($settings['taxonomy_enable_content_type'] == 0) { + $form['display_taxonomy'][$type]['#collapsed'] = TRUE; + } + } + } + return $form; +}