- 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.
4.2.x
Dries Buytaert 2003-06-03 20:33:56 +00:00
parent ed528531c7
commit 3151a1cb71
4 changed files with 20 additions and 12 deletions

View File

@ -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":

View File

@ -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":

View File

@ -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>";

View File

@ -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>";