diff --git a/core/modules/node/node.admin.css b/core/modules/node/node.admin.css index 5777b1f..04a37d0 100644 --- a/core/modules/node/node.admin.css +++ b/core/modules/node/node.admin.css @@ -10,3 +10,288 @@ .revision-current { background: #ffc; } + +/** + * Styles for the new node add/edit form. + */ +#edit-primary { + float: left; + width: 66%; + margin-top: 3em; +} + +.overlay { + background: #f00; +} + +#edit-secondary { + width: 32%; + background-color: #FAFAFA; + top: 0; + margin-left: 68%; + padding-top: 0; + background: -webkit-gradient(linear, left top, right top, from(#ebebeb), to(#fafafa)); + background: -webkit-linear-gradient(left, #ebebeb, #fafafa); + background: -moz-linear-gradient(left, #ebebeb, #fafafa); + background: -ms-linear-gradient(left, #ebebeb, #fafafa); + background: -o-linear-gradient(left, #ebebeb, #fafafa); +} + +#edit-secondary fieldset .fieldset-legend { + margin-top: 0.9em; +} + +#edit-secondary .node-summary { + margin: 15px; +} + +#edit-secondary .button-duplicate { + margin-left: 10px; +} + +.form-actions { + clear: both; +} + +.description { + font-style: italic; + font-family: serif; +} + +#edit-title { + width: 100%; +} + +fieldset#edit-additional-settings { + padding: 0; + margin: 0; + /* border-top:1px solid #dedede; */ + border-bottom:1px solid #fdfdfd; + border-left:0px; + border-right:0px; + text-shadow: 0px 1px 0px rgba(255, 255, 255, .75); +} + +#edit-additional-settings fieldset.collapsed { + border-top:1px solid #fdfdfd; + border-bottom:1px solid #dedede; + border-left:0px; + border-right:0px; + background-color: transparent; + -moz-box-shadow: inset 0 0 0px #000000; + -webkit-box-shadow: inset 0 0 0px #000000; + box-shadow: inset 0 0 0px #000000; +} + +#edit-additional-settings fieldset { + padding: 3em 0 0 0; + background-color: #e2e2e2; + -moz-box-shadow: inset 0 0 10px #ccc; + -webkit-box-shadow: inset 0 0 10px #ccc; + box-shadow: inset 0 0 10px #ccc; +} + +.fieldset-legend .summary { + display: none; +} + +.js fieldset.collapsible > legend .fieldset-legend { + background: url(../../misc/menu-expanded.png) 90% 65% no-repeat; /* LTR */ + padding-left: 15px; /* LTR */ + display: block; + width: 100%; +} +.js fieldset.collapsed > legend .fieldset-legend { + background-image: url(../../misc/menu-collapsed.png); /* LTR */ + background-position: 90% 65%; /* LTR */ + display: block; + width: 100%; +} + +.js fieldset.collapsed > legend .fieldset-legend a, +.js fieldset.collapsible > legend .fieldset-legend a { + display: block; + text-transform: none; + font-weight: bold; + width: 95%; +} + +.js fieldset.collapsed > legend .fieldset-legend a { + font-weight: normal; +} + +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-add #branding, +.page-node-edit #branding { + position: absolute; +} + +.page-node-edit #help { + margin-top: 0; +} + +#overlay #page, +#overlay #page { + padding: 0 0 0 20px; + background: none; +} + +.node-summary { + margin-top: 0; + padding-top: 0; + margin-bottom: 10px; +} + +.node-summary p { + margin-top: -10px; + padding-top: 0; + font-size: 90%; +} + +.node-summary ul, .node-summary li { + list-style: none; + margin-left: -20px; +} + +.node-form .node-actions { + margin: 20px 0; + padding: 10px; + background: -webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#fafafa)); + background: -webkit-linear-gradient(top, #f1f1f1, #fafafa); + background: -moz-linear-gradient(top, #f1f1f1, #fafafa); + background: -ms-linear-gradient(top, #f1f1f1, #fafafa); + background: -o-linear-gradient(top, #f1f1f1, #fafafa); +} + +.node-form .node-actions input.form-submit { + min-width: 135px; + margin: 0 10px 0 0; + padding: 6px 0; + border: 1px solid #c8c8c8; + -moz-border-radius: 3px; + border-radius: 3px; + background: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#e0e0e0)); + background: -webkit-linear-gradient(top, #fefefe, #e0e0e0); + background: -moz-linear-gradient(top, #fefefe, #e0e0e0); + background: -ms-linear-gradient(top, #fefefe, #e0e0e0); + background: -o-linear-gradient(top, #fefefe, #e0e0e0); +} + +.node-form .node-actions input#edit-submit { + color: white; + border-color: #3974ae; + 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); + 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 { + padding: 10px; + font-size: 1.1em; + color: #424242; + border: 1px solid #c8c8c8; + font-family: serif; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + max-width: 100%; + background: -webkit-gradient(linear, left top, left bottom, from(#ececec), to(#fafafa)); + background: -webkit-linear-gradient(top, #ececec, #fafafa); + background: -moz-linear-gradient(top, #ececec, #fafafa); + background: -ms-linear-gradient(top, #ececec, #fafafa); + background: -o-linear-gradient(top, #ececec, #fafafa); +} + +.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 { + padding: 9px; + border-width: 2px; + border-color: #c8c8c8; + outline: none; + -webkit-transition: none; + -moz-transition: none; + transition: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + +.node-form .form-item label { + margin-bottom: 10px; + font-size: 1.2em; +} + + +.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%; +} + +#edit-revision-information { + border: none; + background: -webkit-gradient(linear, left top, right top, from(#ebebeb), to(#fafafa)); + background: -webkit-linear-gradient(left, #ebebeb, #fafafa); + background: -moz-linear-gradient(left, #ebebeb, #fafafa); + background: -ms-linear-gradient(left, #ebebeb, #fafafa); + background: -o-linear-gradient(left, #ebebeb, #fafafa); + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + +fieldset#edit-revision-information { + padding: 0 0 0 0; + margin-top: -10px; + background-color: #e2e2e2; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + border: none; +} diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index 4e94b26..17fcb38 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -32,6 +32,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)); @@ -118,6 +119,15 @@ function node_form_validate($form, &$form_state) { function node_form($form, &$form_state, $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. @@ -151,6 +161,7 @@ function node_form($form, &$form_state, $node) { $form[$key] = array( '#type' => 'value', '#value' => isset($node->$key) ? $node->$key : NULL, + '#group' => 'edit_primary', ); } @@ -158,6 +169,7 @@ function node_form($form, &$form_state, $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. @@ -167,6 +179,8 @@ function node_form($form, &$form_state, $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'])) { @@ -187,6 +201,7 @@ function node_form($form, &$form_state, $node) { '#default_value' => (isset($node->langcode) ? $node->langcode : ''), '#options' => $language_options, '#empty_value' => LANGUAGE_NOT_SPECIFIED, + '#group' => 'edit_primary', ); } else { @@ -195,22 +210,32 @@ function node_form($form, &$form_state, $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', ); } + if (isset($node->title)) { + if (isset($node->status) && $node->status == 1) { + $published = t('published'); + } else { + $published = t('not published'); + } - $form['additional_settings'] = array( - '#type' => 'vertical_tabs', - '#weight' => 99, - ); + $node_summary = '

' . $published . '

'; + $node_summary .= '

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

'; + $node_summary .= '
'; + } else { + $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'), @@ -218,8 +243,8 @@ function node_form($form, &$form_state, $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', @@ -243,6 +268,21 @@ function node_form($form, &$form_state, $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 @@ -271,6 +311,7 @@ function node_form($form, &$form_state, $node) { '#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, + '#size' => 40, '#autocomplete_path' => 'user/autocomplete', '#default_value' => !empty($node->name) ? $node->name : '', '#weight' => -1, @@ -280,6 +321,7 @@ function node_form($form, &$form_state, $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 : '', ); @@ -298,7 +340,7 @@ function node_form($form, &$form_state, $node) { '#attached' => array( 'js' => array(drupal_get_path('module', 'node') . '/node.js'), ), - '#weight' => 95, + '#weight' => -95, ); $form['options']['status'] = array( '#type' => 'checkbox', @@ -317,15 +359,16 @@ function node_form($form, &$form_state, $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'), @@ -333,7 +376,7 @@ function node_form($form, &$form_state, $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, @@ -352,7 +395,7 @@ function node_form($form, &$form_state, $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; }