diff --git a/core/includes/common.inc b/core/includes/common.inc index 14154af7b4f0c1fd8614b56e1561c769ca8a9748..3b35a746c2b94b3a2ea5a523928d11c5a20b891b 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -6570,7 +6570,7 @@ function element_set_attributes(array &$element, array $map) { $property = '#' . $attribute; } // Do not overwrite already existing attributes. - if (isset($element[$property]) && !isset($element['#attributes'][$attribute])) { + if (isset($element[$property]) && !empty($element[$property]) && !isset($element['#attributes'][$attribute])) { $element['#attributes'][$attribute] = $element[$property]; } } diff --git a/core/includes/form.inc b/core/includes/form.inc index a555bf09a1644559b22a57167347f66148fd0fba..5a5ab68197fd1e8acee253ccaaa366dd3d3ccc90 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -4371,33 +4371,37 @@ function theme_form_element($variables) { $prefix = isset($element['#field_prefix']) ? '' . $element['#field_prefix'] . ' ' : ''; $suffix = isset($element['#field_suffix']) ? ' ' . $element['#field_suffix'] . '' : ''; + $description = ''; + if (!empty($element['#description'])) { + $attributes = array('class' => 'description'); + if (!empty($element['#id'])) { + $attributes['id'] = $element['#id'] . '--description'; + } + $description .= '' . $element['#description'] . "\n"; + } + switch ($element['#title_display']) { case 'before': case 'invisible': $output .= ' ' . theme('form_element_label', $variables); + $output .= ' ' . $description; $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n"; break; case 'after': $output .= ' ' . $prefix . $element['#children'] . $suffix; $output .= ' ' . theme('form_element_label', $variables) . "\n"; + $output .= ' ' . $description; break; case 'none': case 'attribute': // Output no label and no required marker, only the children. $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n"; + $output .= ' ' . $description; break; } - if (!empty($element['#description'])) { - $attributes = array('class' => 'description'); - if (!empty($element['#id'])) { - $attributes['id'] = $element['#id'] . '--description'; - } - $output .= '' . $element['#description'] . "\n"; - } - $output .= "\n"; return $output; diff --git a/core/misc/collapse.js b/core/misc/collapse.js index b484a6fce3eb0a7f6ffdd67fe8a0a34ccb4e75c4..b79bf5bce2d7608056c07a05a60b619fdf29c793 100644 --- a/core/misc/collapse.js +++ b/core/misc/collapse.js @@ -11,6 +11,7 @@ Drupal.toggleFieldset = function (fieldset) { var $content = $fieldset.find('> .fieldset-wrapper').hide(); $fieldset .removeClass('collapsed') + .addClass('expanded') .trigger({ type: 'collapsed', value: false }) .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Hide')); $content.slideDown({ @@ -30,6 +31,7 @@ Drupal.toggleFieldset = function (fieldset) { $fieldset.trigger({ type: 'collapsed', value: true }); $fieldset.find('> .fieldset-wrapper').slideUp('fast', function () { $fieldset + .removeClass('expanded') .addClass('collapsed') .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Show')); fieldset.animating = false; diff --git a/core/misc/menu-collapsed-rtl.png b/core/misc/menu-collapsed-rtl.png index dc8d0b8823a90704b3743f980108b8a7d914193c..793d425fdeb5f3909365b518822f2e80e715c67c 100644 Binary files a/core/misc/menu-collapsed-rtl.png and b/core/misc/menu-collapsed-rtl.png differ diff --git a/core/misc/menu-collapsed.png b/core/misc/menu-collapsed.png index 91f3fd40ede024798b6de5ea2675bb692a3cfa95..287bb5cfc480418f8f56f3c1556be27d4c1f745b 100644 Binary files a/core/misc/menu-collapsed.png and b/core/misc/menu-collapsed.png differ diff --git a/core/misc/menu-expanded.png b/core/misc/menu-expanded.png index 46f39ecb351cff65243fa9a614a69d039e1302a5..cf3509486c44c75357377e4ccf6fa83ae4649218 100644 Binary files a/core/misc/menu-expanded.png and b/core/misc/menu-expanded.png differ diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 44aa50b53c8dd2f7fa7ac4880ed8ffae3562e1e2..1f60234b8ff5f35fb2d7324960e406e198e66e97 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -743,7 +743,6 @@ function hook_field_widget_info() { 'text_textfield' => array( 'label' => t('Text field'), 'field types' => array('text'), - 'settings' => array('size' => 60), 'behaviors' => array( 'multiple values' => FIELD_BEHAVIOR_DEFAULT, 'default value' => FIELD_BEHAVIOR_DEFAULT, diff --git a/core/modules/node/node.admin.css b/core/modules/node/node.admin.css index 5777b1f15963061355d755805a47e4abb1020815..ad0ba45ccab518245c1407f414f2443a36ef7f14 100644 --- a/core/modules/node/node.admin.css +++ b/core/modules/node/node.admin.css @@ -1,12 +1,372 @@ - /** * @file * Styles for administration pages. */ /** + * Resets. + * + * @todo These resets should be added to Drupal's core CSS. + */ +html, +button, +input, +select, +textarea { + font-family: sans-serif; +} +legend { + display: block; + float: left; + width: 100%; + white-space: normal; + *margin-left: -7px; +} + +/** + * Shrink-wrap the clickable region of labels to the label text. + */ +label { + display: table; +} + +/** + * Labels with explicit associations are clickable. + */ +label[for] { + cursor: pointer; +} + +/** * Revisions overview screen. */ .revision-current { background: #ffc; } + +/** + * Styles for the new node add/edit form. + */ +#page { + padding-top: 0 !important; +} +.page-node-add.overlay #page, +.page-node-edit.overlay #page { + padding: 0 0 0 2.5% !important; +} + +.overlay { + background: #f00; +} + +.page-node-add.overlay #branding, +.page-node-edit.overlay #branding { + background: transparent; + padding: 0; +} + +.breadcrumb { + display: none; +} + +.edit-primary, +.page-node-add #console, +.page-node-edit #console, +.page-node-add #help, +.page-node-edit #help { + float: left; + width: 65.5%; +} + +.overlay .edit-primary { + margin-top: 1em; +} + +.edit-secondary { + background-color: #eee; + border: 1px solid #dfdfdf; + position: relative; + margin-left: 68%; + margin-top: 2em; + width: 32%; +} +.overlay .edit-secondary { + margin-top: 0; + border: 0; + border-left: 1px solid hsla(0, 0%, 0%, .1); +} + +/** + * Gradients on .edit-secondary look odd because they are drawn over by the + * .collapsible borders. Fix that with pseudo-elements whose z-index we can + * control. We can't use :after because it might interfere with clearfix. + */ +.overlay .edit-secondary:before, +.overlay .node-form > div:before { + bottom: 0; + content: ""; + pointer-events: none; /* Allow clicks. */ + position: absolute; + top: 0; +} +.overlay .edit-secondary:before { + background-image: -moz-linear-gradient(left, rgba(0, 0, 0, .05), transparent); + background-image: -ms-linear-gradient(left, rgba(0, 0, 0, .05), transparent); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, .05), transparent); + background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .05), transparent); + left: 0; + width: .75em; + z-index: 3; +} + +#edit-revision-information { + border-top: 0; +} + +.edit-secondary .form-wrapper { + background-color: transparent; + border-top: 1px solid #fefefe; + border-right: 0px; + border-bottom: 1px solid #c9c9c9; + border-left: 0px; + padding: 0; +} +.edit-secondary .expanded { + background-color: #e2e2e2; + border-top: 1px solid #b5b5b5; + border-bottom: 1px solid #b3b3b3; + margin-top: -1px; + padding: 1px 0; + -moz-transition: background-color .1s; + -ms-transition: background-color .1s; + -o-transition: background-color .1s; + -webkit-transition: background-color .1s; + transition: background-color .1s; +} +.edit-secondary .expanded + .expanded { + border-top: 1px solid #f3f3f3; + margin-top: 0; +} +.edit-secondary .collapsed + .expanded, +.edit-secondary #edit-revision-information + .expanded, +.edit-secondary .expanded:first-child { + -moz-box-shadow: inset 0 2px .5em rgba(0, 0, 0, .1); + -webkit-box-shadow: inset 0 2px .5em rgba(0, 0, 0, .1); + box-shadow: inset 0 2px .5em rgba(0, 0, 0, .1); +} +.edit-secondary .collapsible .fieldset-legend { + background: none !important; /* Override system. */ + display: block; + left: 0; + margin: 0; + padding: 0 !important; /* Override system. */ + position: relative; + right: 0; +} + +/** + * Toggle anchor. + */ +.edit-secondary .collapsible .fieldset-title { + background: url(../../misc/menu-expanded.png) no-repeat 95% 50%; /* LTR */ + color: #004F80; + display: block; + font-size: 1.05em; + padding: .85em 1.25em; + text-transform: none; +} +.overlay .edit-secondary .collapsible .fieldset-title { + background-position: 93% 50%; +} +.overlay .edit-secondary .collapsible.collapsed .fieldset-title { + font-weight: normal; +} + +/** + * The legend is floated to force display. We need to clear it. + */ +.edit-secondary .collapsible .fieldset-wrapper { + clear: both; + padding: 0 1.25em 1.25em !important; +} +.edit-secondary .collapsed .fieldset-title { + background-image: url(../../misc/menu-collapsed.png); + color: #0074BD; +} + +.edit-secondary .button-duplicate { + margin-left: 10px; +} +.form-actions { + clear: both; +} +.description { + font-family: serif; + font-style: italic; +} +#edit-title { + width: 100%; +} +.fieldset-legend .summary { + display: none; +} +#edit-additional-settings { + border-top: 0; + border-right: 0px; + border-bottom: 1px solid #fdfdfd; + border-left: 0px; + margin: 0; + padding: 0; + text-shadow: 0px 1px 0px rgba(255, 255, 255, .75); +} +fieldset .form-wrapper { + margin: 0; +} +#edit-additional-settings, #edit-additional-settings > div.fieldset-wrapper { + padding: 0; +} +.node-form { + color: #464646; +} +ul.tips, div.description, .form-item div.description { + color: #464646; +} +.page-node-add #overlay-content, +.page-node-edit #overlay-content { + padding: 0; +} +.page-node-edit #help { + margin-top: 0; +} + +.node-summary { + margin: 0; + overflow: hidden; + padding: .5em 1.25em 0 1.25em; +} +.page-node-add .node-summary { + border-bottom: 1px solid #d1d1d1; + padding: .5em 1.25em 1.25em 1.25em; +} +.node-summary h3 { + margin-bottom: 0; +} +.node-summary p { + font-size: 90%; + margin-top: 0; + padding-top: 0; +} +.node-summary ul, +.node-summary li { + list-style: none; + margin-left: -20px; +} + +.node-form .node-actions { + background: -moz-linear-gradient(top, #f1f1f1, #fafafa); + background: -ms-linear-gradient(top, #f1f1f1, #fafafa); + background: -o-linear-gradient(top, #f1f1f1, #fafafa); + background: -webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#fafafa)); + background: -webkit-linear-gradient(top, #f1f1f1, #fafafa); + margin: 20px 0; + padding: 10px; +} +.node-form .node-actions input.form-submit { + background: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#e0e0e0)); + background: -moz-linear-gradient(top, #fefefe, #e0e0e0); + background: -ms-linear-gradient(top, #fefefe, #e0e0e0); + background: -o-linear-gradient(top, #fefefe, #e0e0e0); + background: -webkit-linear-gradient(top, #fefefe, #e0e0e0); + border: 1px solid #c8c8c8; + border-radius: 3px; + margin: 0 10px 0 0; + min-width: 135px; + padding: 6px 0; +} +.node-form .node-actions input#edit-submit { + background: -webkit-gradient(linear, left top, left bottom, from(#4fa0ea), to(#3974ae)); + background: -webkit-linear-gradient(top, #4fa0ea, #3974ae); + background: -moz-linear-gradient(top, #4fa0ea, #3974ae); + background: -ms-linear-gradient(top, #4fa0ea, #3974ae); + background: -o-linear-gradient(top, #4fa0ea, #3974ae); + border-color: #3974ae; + color: white; + text-shadow: 0px 1px 0px rgba(0, 0, 0, .25); +} + +.node-form input.form-autocomplete, +.node-form input.form-text, +.node-form input.form-tel, +.node-form input.form-email, +.node-form input.form-url, +.node-form input.form-search, +.node-form textarea.form-textarea, +.node-form select.form-select { + background: -moz-linear-gradient(top, #ececec, #fafafa); + background: -ms-linear-gradient(top, #ececec, #fafafa); + background: -o-linear-gradient(top, #ececec, #fafafa); + background: -webkit-gradient(linear, left top, left bottom, from(#ececec), to(#fafafa)); + background: -webkit-linear-gradient(top, #ececec, #fafafa); + border: 1px solid #c8c8c8; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #424242; + font-family: serif; + font-size: 1.2em; + padding: 8px; + max-width: 100%; +} +.node-form input.form-autocomplete:not([size]), +.node-form input.form-text:not([size]), +.node-form input.form-tel:not([size]), +.node-form input.form-email:not([size]), +.node-form input.form-url:not([size]), +.node-form input.form-search:not([size]), +.node-form textarea.form-textarea:not([size]) { + width: 100%; +} +.js .node-form input.form-autocomplete { + background-position: 100% 0; +} +.js .node-form input.throbbing { + background-position: 100% 0; +} +.node-form input.form-autocomplete:focus, +.node-form input.form-text:focus, +.node-form input.form-tel:focus, +.node-form input.form-email:focus, +.node-form input.form-url:focus, +.node-form input.form-search:focus, +.node-form textarea.form-textarea:focus, +.node-form select.form-select:focus { + border-color: #c8c8c8; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + outline: 2px solid #c8c8c8; + -moz-transition: none; + -webkit-transition: none; + transition: none; +} +.node-form .form-item label { + margin-bottom: 5px; + font-size: 1.2em; +} +.node-form .edit-secondary .form-item label { + font-size: 1em; +} +.node-form .edit-secondary input.form-autocomplete, +.node-form .edit-secondary input.form-text, +.node-form .edit-secondary input.form-tel, +.node-form .edit-secondary input.form-email, +.node-form .edit-secondary input.form-url, +.node-form .edit-secondary input.form-search { + width: 100%; + padding: 5px; +} +.node-form-revision-information { + border: 0; + background: none; + padding: 0; +} diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index 868acbd51021bc3c553b91acf576cdc24482e202..6820f46e45045edc5789afb7aebf98a9e3bd5bdf 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -33,6 +33,7 @@ function node_add_page() { // Bypass the node/add listing if only one content type is available. if (count($content) == 1) { $item = array_shift($content); + drupal_goto($item['href']); } return theme('node_add_list', array('content' => $content)); @@ -127,6 +128,15 @@ function node_form_validate($form, &$form_state) { function node_form($form, &$form_state, Node $node) { global $user; + // Wrap main form components in a div + $form['edit_primary'] = array( + '#type' => 'markup', + '#prefix' => '
', + '#suffix' => '
', + '#attached' => array( + 'css' => array(drupal_get_path('module', 'node') . '/node.admin.css'), + ), + ); // During initial form build, add the node entity to the form state for use // during form building and processing. During a rebuild, use what is in the // form state. @@ -157,6 +167,7 @@ function node_form($form, &$form_state, Node $node) { $form[$key] = array( '#type' => 'value', '#value' => isset($node->$key) ? $node->$key : NULL, + '#group' => 'edit_primary', ); } @@ -164,6 +175,7 @@ function node_form($form, &$form_state, Node $node) { $form['changed'] = array( '#type' => 'hidden', '#default_value' => isset($node->changed) ? $node->changed : NULL, + '#group' => 'edit_primary', ); // Invoke hook_form() to get the node-specific bits. Can't use node_invoke(), // because hook_form() needs to be able to receive $form_state by reference. @@ -173,6 +185,8 @@ function node_form($form, &$form_state, Node $node) { if (function_exists($function) && ($extra = $function($node, $form_state))) { $form = array_merge_recursive($form, $extra); } + $form['edit_primary']['title'] = $form['title']; + unset($form['title']); // If the node type has a title, and the node type form defined no special // weight for it, we default to a weight of -5 for consistency. if (isset($form['title']) && !isset($form['title']['#weight'])) { @@ -193,6 +207,7 @@ function node_form($form, &$form_state, Node $node) { '#default_value' => (isset($node->langcode) ? $node->langcode : ''), '#options' => $language_options, '#empty_value' => LANGUAGE_NOT_SPECIFIED, + '#group' => 'edit_primary', ); } else { @@ -201,22 +216,32 @@ function node_form($form, &$form_state, Node $node) { // New nodes without multilingual support get the default language, old // nodes keep their language if language.module is not available. '#value' => !isset($form['#node']->nid) ? language_default()->langcode : $node->langcode, + '#group' => 'edit_primary', ); } - $form['additional_settings'] = array( - '#type' => 'vertical_tabs', - '#weight' => 99, - ); + if (isset($node->title)) { + $published = (isset($node->status) && $node->status == 1) ? t('published') : t('not published'); + $node_summary = '

' . $published . '

'; + $node_summary .= '

Last saved ' . format_date($node->changed) . '

'; + $node_summary .= '
  • Author ' . $node->name . '
  • '; + $node_summary .= '
  • URL ' . drupal_get_path_alias('node/' . $node->nid) . '
  • '; + $node_summary .= '
'; + } + else { + $published = t('not published'); + $node_summary = '

' . $published . '

'; + $node_summary .= '

Not saved yet

'; + $node_summary .= '
  • Author ' . $user->name . '
  • '; + $node_summary .= '
'; + } // Add a log field if the "Create new revision" option is checked, or if the // current user has the ability to check that option. $form['revision_information'] = array( '#type' => 'fieldset', - '#title' => t('Revision information'), - '#collapsible' => TRUE, - // Collapsed by default when "Create new revision" is unchecked - '#collapsed' => !$node->revision, + '#collapsible' => FALSE, + '#collapsed' => FALSE, '#group' => 'additional_settings', '#attributes' => array( 'class' => array('node-form-revision-information'), @@ -224,8 +249,8 @@ function node_form($form, &$form_state, Node $node) { '#attached' => array( 'js' => array(drupal_get_path('module', 'node') . '/node.js'), ), - '#weight' => 20, - '#access' => $node->revision || user_access('administer nodes'), + '#weight' => -99, + '#access' => (isset($node->title)) && ($node->revision || user_access('administer nodes')), ); $form['revision_information']['revision'] = array( '#type' => 'checkbox', @@ -249,6 +274,21 @@ function node_form($form, &$form_state, Node $node) { '#rows' => 4, '#default_value' => !empty($node->log) ? $node->log : '', '#description' => t('Briefly describe the changes you have made.'), + '#attributes' => array( + 'name' => 'log', + ), + '#states' => array( + 'visible' => array( + ':input[name="revision"]' => array('checked' => TRUE), + ), + ), + ); + + $form['additional_settings'] = array( + '#type' => 'fieldset', + '#weight' => 99, + '#prefix' => '
' . $node_summary, + '#suffix' => '
', ); // Node author information for administrators @@ -277,6 +317,7 @@ function node_form($form, &$form_state, Node $node) { '#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, + '#size' => 40, '#autocomplete_path' => 'user/autocomplete', '#default_value' => !empty($node->name) ? $node->name : '', '#weight' => -1, @@ -286,6 +327,7 @@ function node_form($form, &$form_state, Node $node) { '#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, + '#size' => 40, '#description' => t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? date_format(date_create($node->date), 'Y-m-d H:i:s O') : format_date($node->created, 'custom', 'Y-m-d H:i:s O'), '%timezone' => !empty($node->date) ? date_format(date_create($node->date), 'O') : format_date($node->created, 'custom', 'O'))), '#default_value' => !empty($node->date) ? $node->date : '', ); @@ -304,7 +346,7 @@ function node_form($form, &$form_state, Node $node) { '#attached' => array( 'js' => array(drupal_get_path('module', 'node') . '/node.js'), ), - '#weight' => 95, + '#weight' => -95, ); $form['options']['status'] = array( '#type' => 'checkbox', @@ -323,15 +365,16 @@ function node_form($form, &$form_state, Node $node) { ); // Add the buttons. - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array( + $form['edit_primary']['actions'] = array('#type' => 'actions',); + $form['edit_primary']['actions']['#attributes']['class'][] = 'node-actions'; + $form['edit_primary']['actions']['submit'] = array( '#type' => 'submit', '#access' => variable_get('node_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || (!form_get_errors() && isset($form_state['node_preview'])), '#value' => t('Save'), '#weight' => 5, '#submit' => array('node_form_submit'), ); - $form['actions']['preview'] = array( + $form['edit_primary']['actions']['preview'] = array( '#access' => variable_get('node_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_DISABLED, '#type' => 'submit', '#value' => t('Preview'), @@ -339,7 +382,7 @@ function node_form($form, &$form_state, Node $node) { '#submit' => array('node_form_build_preview'), ); if (!empty($node->nid) && node_access('delete', $node)) { - $form['actions']['delete'] = array( + $form['edit_primary']['actions']['delete'] = array( '#type' => 'submit', '#value' => t('Delete'), '#weight' => 15, @@ -358,7 +401,7 @@ function node_form($form, &$form_state, Node $node) { } $form += array('#submit' => array()); - field_attach_form('node', $node, $form, $form_state, $node->langcode); + field_attach_form('node', $node, $form['edit_primary'], $form_state, $node->langcode); return $form; }