diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-06-03 20:33:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-06-03 20:33:56 +0000 |
commit | 3151a1cb71b972bc70aa083b2fd6a90ab36b7921 (patch) | |
tree | 99f3391490a05a6c9e64ccae446b61fb1bf02cab | |
parent | ed528531c75929aa77c68e302d7f051d542974ed (diff) | |
download | brdo-3151a1cb71b972bc70aa083b2fd6a90ab36b7921.tar.gz brdo-3151a1cb71b972bc70aa083b2fd6a90ab36b7921.tar.bz2 |
- Usability improvements to the node form. Patch by Al. Will incorporate
some of Moshe's node form work later on.
TODO:
- I just spotted a problem with the promote field; it does not seem to be
"sticky" when you click the preview button. I checked and this was also
the case prior to applying this patch.
-rw-r--r-- | modules/comment.module | 6 | ||||
-rw-r--r-- | modules/comment/comment.module | 6 | ||||
-rw-r--r-- | modules/node.module | 10 | ||||
-rw-r--r-- | modules/node/node.module | 10 |
4 files changed, 20 insertions, 12 deletions
diff --git a/modules/comment.module b/modules/comment.module index e61cda4ef..e0780b416 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -1485,7 +1485,11 @@ function comment_nodeapi(&$node, $op, $arg = 0) { return array("comment"); case "form admin": if (user_access("administer comments")) { - return form_select(t("Allow user comments"), "comment", isset($node->comment) ? $node->comment : variable_get("comment_$node->type", 2), array(t("Disabled"), t("Read only"), t("Read-write"))); + $selected = isset($node->comment) ? $node->comment : variable_get("comment_$node->type", 2); + $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); } break; case "validate": diff --git a/modules/comment/comment.module b/modules/comment/comment.module index e61cda4ef..e0780b416 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1485,7 +1485,11 @@ function comment_nodeapi(&$node, $op, $arg = 0) { return array("comment"); case "form admin": if (user_access("administer comments")) { - return form_select(t("Allow user comments"), "comment", isset($node->comment) ? $node->comment : variable_get("comment_$node->type", 2), array(t("Disabled"), t("Read only"), t("Read-write"))); + $selected = isset($node->comment) ? $node->comment : variable_get("comment_$node->type", 2); + $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); } break; case "validate": diff --git a/modules/node.module b/modules/node.module index 5d916d04e..09db9f19e 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1102,12 +1102,12 @@ function node_form($edit, $error = NULL) { $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 .= "<br />"; - $output .= form_select(t("Set public/published"), "status", isset($edit->status) ? $edit->status : variable_get("node_status_$edit->type", 1), array(t("Disabled"), t("Enabled"))); - $output .= form_select(t("Promote to front page"), "promote", isset($edit->promote) ? $edit->promote : variable_get("node_promote_$edit->type", 1), array(t("Disabled"), t("Enabled"))); - $output .= form_select(t("Moderation status"), "moderate", isset($edit->moderate) ? $edit->moderate : variable_get("node_moderate_$edit->type", 0), array(t("Approved"), t("Awaiting approval"))); - $output .= form_select(t("Static on front page"), "static", isset($edit->static) ? $edit->static : variable_get("node_static_$edit->type", 0), array(t("Disabled"), t("Enabled"))); + $output .= form_checkbox(t("Published"), "status", 1, isset($edit->status) ? $edit->status : variable_get("node_status_$edit->type", 1)); + $output .= form_checkbox(t("Approved"), "moderate", 1, isset($edit->moderate) ? $edit->moderate : variable_get("node_moderate_$edit->type", 0)); + $output .= form_checkbox(t("Promoted to front page"), "promote", 1, isset($edit->promote) ? $edit->promote : variable_get("node_promote_$edit->type", 1)); + $output .= form_checkbox(t("Static on front page"), "static", 1, isset($edit->static) ? $edit->static : variable_get("node_static_$edit->type", 0)); + $output .= form_checkbox(t("Create new revision"), "revision", 1, isset($edit->revision) ? $edit->revision : variable_get("node_revision_$edit->type", 0)); $output .= implode("", node_invoke_all($edit, "nodeapi", "form admin")); - $output .= form_select(t("Create new revision"), "revision", isset($edit->revision) ? $edit->revision : variable_get("node_revision_$edit->type", 0), array(t("Disabled"), t("Enabled"))); } $output .= " </td>"; diff --git a/modules/node/node.module b/modules/node/node.module index 5d916d04e..09db9f19e 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1102,12 +1102,12 @@ function node_form($edit, $error = NULL) { $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 .= "<br />"; - $output .= form_select(t("Set public/published"), "status", isset($edit->status) ? $edit->status : variable_get("node_status_$edit->type", 1), array(t("Disabled"), t("Enabled"))); - $output .= form_select(t("Promote to front page"), "promote", isset($edit->promote) ? $edit->promote : variable_get("node_promote_$edit->type", 1), array(t("Disabled"), t("Enabled"))); - $output .= form_select(t("Moderation status"), "moderate", isset($edit->moderate) ? $edit->moderate : variable_get("node_moderate_$edit->type", 0), array(t("Approved"), t("Awaiting approval"))); - $output .= form_select(t("Static on front page"), "static", isset($edit->static) ? $edit->static : variable_get("node_static_$edit->type", 0), array(t("Disabled"), t("Enabled"))); + $output .= form_checkbox(t("Published"), "status", 1, isset($edit->status) ? $edit->status : variable_get("node_status_$edit->type", 1)); + $output .= form_checkbox(t("Approved"), "moderate", 1, isset($edit->moderate) ? $edit->moderate : variable_get("node_moderate_$edit->type", 0)); + $output .= form_checkbox(t("Promoted to front page"), "promote", 1, isset($edit->promote) ? $edit->promote : variable_get("node_promote_$edit->type", 1)); + $output .= form_checkbox(t("Static on front page"), "static", 1, isset($edit->static) ? $edit->static : variable_get("node_static_$edit->type", 0)); + $output .= form_checkbox(t("Create new revision"), "revision", 1, isset($edit->revision) ? $edit->revision : variable_get("node_revision_$edit->type", 0)); $output .= implode("", node_invoke_all($edit, "nodeapi", "form admin")); - $output .= form_select(t("Create new revision"), "revision", isset($edit->revision) ? $edit->revision : variable_get("node_revision_$edit->type", 0), array(t("Disabled"), t("Enabled"))); } $output .= " </td>"; |