From 00d638ca5790cac5cf1d7b195e07d17f9cbb80a4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 6 Nov 2003 18:27:58 +0000 Subject: - Usability improvement: replaced many selection boxes by radio buttons. Patch by Stefan. - Usability improvement: introduced a form_group() function and updated the node and comment module to take advantage of it. Patch #149 by Eric Farris. --- includes/common.inc | 3 +++ modules/comment.module | 2 +- modules/comment/comment.module | 2 +- modules/node.module | 13 ++++++++----- modules/node/node.module | 13 ++++++++----- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 435318165..a0aa2d13a 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -905,6 +905,9 @@ function form($form, $method = "post", $action = 0, $options = 0) { function form_item($title, $value, $description = 0) { return "
". ($title ? "
$title:
" : "") . $value . ($description ? "
$description
" : "") ."
\n"; } +function form_group($legend, $group, $description = 0) { + return "
" . ($legend ? "$legend" : "") . $group . ($description ? "
$description
" : "") . "
\n"; +} function form_radio($title, $name, $value = 1, $checked = 0, $description = 0, $attributes = 0) { return form_item(0, " $title", $description); diff --git a/modules/comment.module b/modules/comment.module index 4f81d029f..8e5a2e7e0 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -1627,7 +1627,7 @@ function comment_nodeapi(&$node, $op, $arg = 0) { $output = form_radio(t("Disabled"), "comment", 0, ($selected == 0)); $output .= form_radio(t("Read only"), "comment", 1, ($selected == 1)); $output .= form_radio(t("Read/write"), "comment", 2, ($selected == 2)); - return form_item(t("Allow user comments"), $output); + return form_group(t("User comments"), $output); } break; case "validate": diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 4f81d029f..8e5a2e7e0 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1627,7 +1627,7 @@ function comment_nodeapi(&$node, $op, $arg = 0) { $output = form_radio(t("Disabled"), "comment", 0, ($selected == 0)); $output .= form_radio(t("Read only"), "comment", 1, ($selected == 1)); $output .= form_radio(t("Read/write"), "comment", 2, ($selected == 2)); - return form_item(t("Allow user comments"), $output); + return form_group(t("User comments"), $output); } break; case "validate": diff --git a/modules/node.module b/modules/node.module index e611697ea..b040a7aac 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1127,10 +1127,13 @@ function node_form($edit, $error = NULL) { if (user_access("administer nodes")) { $output .= "
"; + + $author = form_textfield(t("Authored by"), "name", $edit->name, 20, 60, $error["name"]); + $author .= form_textfield(t("Authored on"), "date", $edit->date, 20, 25, $error["date"]); + $output .= "
"; - $output .= form_textfield(t("Authored by"), "name", $edit->name, 20, 60, $error["name"]); - $output .= form_textfield(t("Authored on"), "date", $edit->date, 20, 25, $error["date"]); - $output .= "
"; + $output .= form_group(t("Authoring information"), $author); + $output .= "
\n"; $options .= form_checkbox(t("Published"), "status", 1, isset($edit->status) ? $edit->status : variable_get("node_status_$edit->type", 1)); $options .= form_checkbox(t("In moderation queue"), "moderate", 1, isset($edit->moderate) ? $edit->moderate : variable_get("node_moderate_$edit->type", 0)); @@ -1139,8 +1142,8 @@ function node_form($edit, $error = NULL) { $options .= form_checkbox(t("Create new revision"), "revision", 1, isset($edit->revision) ? $edit->revision : variable_get("node_revision_$edit->type", 0)); $output .= "
"; - $output .= form_item(t("Options"), $options); - $output .= "
"; + $output .= form_group("Options", $options); + $output .= "\n"; $extras .= implode("
", node_invoke_nodeapi($edit, "form admin")); $output .= $extras ? "
$extras
" : ""; diff --git a/modules/node/node.module b/modules/node/node.module index e611697ea..b040a7aac 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1127,10 +1127,13 @@ function node_form($edit, $error = NULL) { if (user_access("administer nodes")) { $output .= "
"; + + $author = form_textfield(t("Authored by"), "name", $edit->name, 20, 60, $error["name"]); + $author .= form_textfield(t("Authored on"), "date", $edit->date, 20, 25, $error["date"]); + $output .= "
"; - $output .= form_textfield(t("Authored by"), "name", $edit->name, 20, 60, $error["name"]); - $output .= form_textfield(t("Authored on"), "date", $edit->date, 20, 25, $error["date"]); - $output .= "
"; + $output .= form_group(t("Authoring information"), $author); + $output .= "
\n"; $options .= form_checkbox(t("Published"), "status", 1, isset($edit->status) ? $edit->status : variable_get("node_status_$edit->type", 1)); $options .= form_checkbox(t("In moderation queue"), "moderate", 1, isset($edit->moderate) ? $edit->moderate : variable_get("node_moderate_$edit->type", 0)); @@ -1139,8 +1142,8 @@ function node_form($edit, $error = NULL) { $options .= form_checkbox(t("Create new revision"), "revision", 1, isset($edit->revision) ? $edit->revision : variable_get("node_revision_$edit->type", 0)); $output .= "
"; - $output .= form_item(t("Options"), $options); - $output .= "
"; + $output .= form_group("Options", $options); + $output .= "\n"; $extras .= implode("
", node_invoke_nodeapi($edit, "form admin")); $output .= $extras ? "
$extras
" : ""; -- cgit v1.2.3