diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book.module | 51 | ||||
-rw-r--r-- | modules/book/book.module | 51 | ||||
-rw-r--r-- | modules/node.module | 42 | ||||
-rw-r--r-- | modules/node/node.module | 42 |
4 files changed, 68 insertions, 118 deletions
diff --git a/modules/book.module b/modules/book.module index d284cda3b..70dcd6da4 100644 --- a/modules/book.module +++ b/modules/book.module @@ -96,60 +96,41 @@ function book_form($edit = array()) { $output .= "<FORM ACTION=\"$REQUEST_URI\" METHOD=\"post\">\n"; - $output .= "<B>". t("Author") .":</B><BR>\n"; - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[userid]\" VALUE=\"$edit[userid]\">\n"; - $output .= format_username(($edit[userid] ? $edit[userid] : $user->userid)) ."<P>\n"; - - $output .= "<B>". t("Subject") .":</B><BR>\n"; - $output .= "<INPUT TYPE=\"text\" NAME=\"edit[title]\" SIZE=\"50\" MAXLENGTH=\"128\" VALUE=\"". check_textfield($edit[title]) ."\"><P>\n"; - - $output .= "<B>". t("Category") .":</B><BR>\n"; - $output .= category_form_select("book", $edit) ."<P>"; + $output .= form_item(t("Author"), format_username(($edit[userid] ? $edit[userid] : $user->userid))); + $output .= form_hidden(userid, $edit[userid]); + $output .= form_textfield(t("Subject"), "title", $edit[title], 50, 128); + $output .= form_item(t("Category"), category_form_select("book", $edit)); if ($edit[pid]) { $node = node_get_object("nid", $edit[pid]); - $output .= "<B>". t("Parent") .":</B><BR>\n"; - $output .= "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A><P>\n"; - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[parent]\" VALUE=\"$edit[parent]\">\n"; - $output .= "<SMALL><I>". t("The parent subject or category the page belongs in.") ."</I></SMALL><P>\n"; + $output .= form_item(t("Parent"), "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A>", t("The parent subject or category the page belongs in.")); + $output .= form_hidden("parent". $edit[parent]); } else { - $output .= "<B>". t("Parent") .":</B><BR>\n"; - foreach (book_toc() as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($edit[parent] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; - if (user_access($user, "book")) $options2 .= "<OPTION VALUE=\"0\"". ($edit[parent] == 0 ? " SELECTED" : "") ."> </OPTION>"; - $output .= "<SELECT NAME=\"edit[parent]\">$options2</SELECT><BR>\n"; - $output .= "<SMALL><I>". t("The parent subject or category the page belongs in.") ."</I></SMALL><P>\n"; + $output .= form_select(t("Parent"), "parent", user_access($user, "book") ? array_merge(array(0 => " "), book_toc()) : book_toc(), $edit[parent], t("The parent subject or category the page belongs in.")); } - $output .= "<B>". t("Content") .":</B><BR>\n"; - $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"edit[body]\" MAXLENGTH=\"20\">". check_textarea($edit[body]) ."</TEXTAREA><BR>\n"; - $output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n"; - - $output .= "<B>". t("Log message") .":</B><BR>\n"; - $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"5\" NAME=\"edit[log]\" MAXLENGTH=\"20\">". check_textarea($edit[log]) ."</TEXTAREA><BR>\n"; - $output .= "<SMALL><I>". t("An explanation of the additions or updates being made to help the group understand your motivations.") ."</I></SMALL><P>\n"; + $output .= form_textarea(t("Content"), "body", $edit[body], 50, 10, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html)); + $output .= form_textarea(t("Log message"), "log", $edit[log], 50, 5, t("An explanation of the additions or updates being made to help the group understand your motivations.")); if (user_access($user, "book")) { - $output .= "<B>". t("Weight") .":</B><BR>\n"; - for ($count = 0; $count < 25; $count++) $options3 .= "<OPTION VALUE=\"$count\"". ($edit[weight] == $count ? " SELECTED" : "") .">$count</OPTION>"; - $output .= "<SELECT NAME=\"edit[weight]\">$options3</SELECT><BR>\n"; - $output .= "<SMALL><I>". t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top.") ."</I></SMALL><P>\n"; + $output .= form_select(t("Weight"), "weight", array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30), $edit[weight], t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top.")); } if (!$edit) { - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n"; + $output .= form_submit(t("Preview")); } else if (!$edit[title]) { $output .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n"; + $output .= form_submit(t("Preview")); } else { - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Submit") ."\">\n"; + $output .= form_submit(t("Preview")); + $output .= form_submit(t("Submit")); } - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[pid]\" VALUE=\"$edit[pid]\">\n"; - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$edit[nid]\">\n"; + $output .= form_hidden("pid", $edit[pid]); + $output .= form_hidden("nid", $edit[nid]); $output .= "</FORM>\n"; diff --git a/modules/book/book.module b/modules/book/book.module index d284cda3b..70dcd6da4 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -96,60 +96,41 @@ function book_form($edit = array()) { $output .= "<FORM ACTION=\"$REQUEST_URI\" METHOD=\"post\">\n"; - $output .= "<B>". t("Author") .":</B><BR>\n"; - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[userid]\" VALUE=\"$edit[userid]\">\n"; - $output .= format_username(($edit[userid] ? $edit[userid] : $user->userid)) ."<P>\n"; - - $output .= "<B>". t("Subject") .":</B><BR>\n"; - $output .= "<INPUT TYPE=\"text\" NAME=\"edit[title]\" SIZE=\"50\" MAXLENGTH=\"128\" VALUE=\"". check_textfield($edit[title]) ."\"><P>\n"; - - $output .= "<B>". t("Category") .":</B><BR>\n"; - $output .= category_form_select("book", $edit) ."<P>"; + $output .= form_item(t("Author"), format_username(($edit[userid] ? $edit[userid] : $user->userid))); + $output .= form_hidden(userid, $edit[userid]); + $output .= form_textfield(t("Subject"), "title", $edit[title], 50, 128); + $output .= form_item(t("Category"), category_form_select("book", $edit)); if ($edit[pid]) { $node = node_get_object("nid", $edit[pid]); - $output .= "<B>". t("Parent") .":</B><BR>\n"; - $output .= "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A><P>\n"; - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[parent]\" VALUE=\"$edit[parent]\">\n"; - $output .= "<SMALL><I>". t("The parent subject or category the page belongs in.") ."</I></SMALL><P>\n"; + $output .= form_item(t("Parent"), "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A>", t("The parent subject or category the page belongs in.")); + $output .= form_hidden("parent". $edit[parent]); } else { - $output .= "<B>". t("Parent") .":</B><BR>\n"; - foreach (book_toc() as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($edit[parent] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; - if (user_access($user, "book")) $options2 .= "<OPTION VALUE=\"0\"". ($edit[parent] == 0 ? " SELECTED" : "") ."> </OPTION>"; - $output .= "<SELECT NAME=\"edit[parent]\">$options2</SELECT><BR>\n"; - $output .= "<SMALL><I>". t("The parent subject or category the page belongs in.") ."</I></SMALL><P>\n"; + $output .= form_select(t("Parent"), "parent", user_access($user, "book") ? array_merge(array(0 => " "), book_toc()) : book_toc(), $edit[parent], t("The parent subject or category the page belongs in.")); } - $output .= "<B>". t("Content") .":</B><BR>\n"; - $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"edit[body]\" MAXLENGTH=\"20\">". check_textarea($edit[body]) ."</TEXTAREA><BR>\n"; - $output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n"; - - $output .= "<B>". t("Log message") .":</B><BR>\n"; - $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"5\" NAME=\"edit[log]\" MAXLENGTH=\"20\">". check_textarea($edit[log]) ."</TEXTAREA><BR>\n"; - $output .= "<SMALL><I>". t("An explanation of the additions or updates being made to help the group understand your motivations.") ."</I></SMALL><P>\n"; + $output .= form_textarea(t("Content"), "body", $edit[body], 50, 10, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html)); + $output .= form_textarea(t("Log message"), "log", $edit[log], 50, 5, t("An explanation of the additions or updates being made to help the group understand your motivations.")); if (user_access($user, "book")) { - $output .= "<B>". t("Weight") .":</B><BR>\n"; - for ($count = 0; $count < 25; $count++) $options3 .= "<OPTION VALUE=\"$count\"". ($edit[weight] == $count ? " SELECTED" : "") .">$count</OPTION>"; - $output .= "<SELECT NAME=\"edit[weight]\">$options3</SELECT><BR>\n"; - $output .= "<SMALL><I>". t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top.") ."</I></SMALL><P>\n"; + $output .= form_select(t("Weight"), "weight", array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30), $edit[weight], t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top.")); } if (!$edit) { - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n"; + $output .= form_submit(t("Preview")); } else if (!$edit[title]) { $output .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n"; + $output .= form_submit(t("Preview")); } else { - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Submit") ."\">\n"; + $output .= form_submit(t("Preview")); + $output .= form_submit(t("Submit")); } - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[pid]\" VALUE=\"$edit[pid]\">\n"; - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$edit[nid]\">\n"; + $output .= form_hidden("pid", $edit[pid]); + $output .= form_hidden("nid", $edit[nid]); $output .= "</FORM>\n"; diff --git a/modules/node.module b/modules/node.module index 3c377a2a4..af5292fb4 100644 --- a/modules/node.module +++ b/modules/node.module @@ -24,40 +24,34 @@ function node_admin_view($id) { $node = node_get_object("nid", $id); $output .= "<FORM ACTION=\"admin.php?mod=node&id=$node->nid\" METHOD=\"post\">\n"; - $output .= "<B>Title:</B><BR>". check_output($node->title) ."<P>\n"; - $output .= "<B>Author:</B><BR>". format_username($node->userid) ."<P>\n"; - $output .= "<B>Status:</B><BR>". $rstatus[$node->status] ."<P>\n"; - $output .= "<B>Comment:</B><BR>". node_comment_status($node->comment) ."<P>\n"; - $output .= "<B>Promote:</B><BR>". node_promote_status($node->promote) ."<P>\n"; - $output .= "<B>Date:</B><BR>". format_date($node->timestamp) ."<P>\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Edit node\">\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Delete node\">\n"; + $output .= form_item("Title", check_output($node->title)); + $output .= form_item("Author", format_username($node->userid)); + $output .= form_item("Status", $rstatus[$node->status]); + $output .= form_item("Comment", node_comment_status($node->comment)); + $output .= form_item("Promote", node_promote_status($node->promote)); + $output .= form_item("Date", format_date($node->timestamp)); + $output .= form_submit("Edit node"); + $output .= form_submit("Delete node"); $output .= "</FORM>\n"; return $output; } function node_admin_edit($id) { - global $user, $status; + global $user; $node = node_get_object("nid", $id); - foreach (array($node->userid => $node->author, $user->userid => $user->id) as $value=>$key) $author .= " <OPTION VALUE=\"$key\"". (($node->author == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (array(format_date($node->timestamp) ." (original)" => $node->timestamp, format_date(time()) ." (current)" => time()) as $value=>$key) $timestamp .= " <OPTION VALUE=\"$key\"". (($node->timestamp == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (node_status($node) as $value) $display .= " <OPTION VALUE=\"". $status[$value] ."\"". (($node->status == $status[$value]) ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (node_comment_status() as $key=>$value) $comment .= " <OPTION VALUE=\"$key\"". ($node->comment == $key ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (node_promote_status() as $key=>$value) $promote .= " <OPTION VALUE=\"$key\"". ($node->promote == $key ? " SELECTED" : "") .">$value</OPTION>\n"; - $output .= "<FORM ACTION=\"admin.php?mod=node&id=$node->nid\" METHOD=\"post\">\n"; - $output .= "<B>Title:</B><BR>". check_output($node->title) ."<P>\n"; - $output .= "<B>Author:</B><BR><SELECT NAME=\"edit[author]\">$author</SELECT><P>\n"; - $output .= "<B>Status:</B><BR><SELECT NAME=\"edit[status]\">$display</SELECT><P>\n"; - $output .= "<B>Comment:</B><BR><SELECT NAME=\"edit[comment]\">$comment</SELECT><P>\n"; - $output .= "<B>Promote:</B><BR><SELECT NAME=\"edit[promote]\">$promote</SELECT><P>\n"; - $output .= "<B>Date:</B><BR><SELECT NAME=\"edit[timestamp]\">$timestamp</SELECT><P>\n"; - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$node->nid\">\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"View node\">\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save node\">\n"; + $output .= form_item("Title", check_output($node->title)); + $output .= form_select("Author", "author", array($node->author => $node->userid, $user->id => $user->userid), $node->author); + $output .= form_select("Status", "status", node_status($node), $node->status); + $output .= form_select("Comment", "comment", node_comment_status(), $node->comment); + $output .= form_select("Promote", "promote", node_promote_status(), $node->promote); + $output .= form_select("Date", "timestamp", array($node->timestamp => format_date($node->timestamp) ." (original)", time() => format_date(time()) ." (current)"), $node->timestamp); + $output .= form_hidden("nid", $node->nid); + $output .= form_submit("View node"); + $output .= form_submit("Save node"); $output .= "</FORM>\n"; return $output; diff --git a/modules/node/node.module b/modules/node/node.module index 3c377a2a4..af5292fb4 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -24,40 +24,34 @@ function node_admin_view($id) { $node = node_get_object("nid", $id); $output .= "<FORM ACTION=\"admin.php?mod=node&id=$node->nid\" METHOD=\"post\">\n"; - $output .= "<B>Title:</B><BR>". check_output($node->title) ."<P>\n"; - $output .= "<B>Author:</B><BR>". format_username($node->userid) ."<P>\n"; - $output .= "<B>Status:</B><BR>". $rstatus[$node->status] ."<P>\n"; - $output .= "<B>Comment:</B><BR>". node_comment_status($node->comment) ."<P>\n"; - $output .= "<B>Promote:</B><BR>". node_promote_status($node->promote) ."<P>\n"; - $output .= "<B>Date:</B><BR>". format_date($node->timestamp) ."<P>\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Edit node\">\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Delete node\">\n"; + $output .= form_item("Title", check_output($node->title)); + $output .= form_item("Author", format_username($node->userid)); + $output .= form_item("Status", $rstatus[$node->status]); + $output .= form_item("Comment", node_comment_status($node->comment)); + $output .= form_item("Promote", node_promote_status($node->promote)); + $output .= form_item("Date", format_date($node->timestamp)); + $output .= form_submit("Edit node"); + $output .= form_submit("Delete node"); $output .= "</FORM>\n"; return $output; } function node_admin_edit($id) { - global $user, $status; + global $user; $node = node_get_object("nid", $id); - foreach (array($node->userid => $node->author, $user->userid => $user->id) as $value=>$key) $author .= " <OPTION VALUE=\"$key\"". (($node->author == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (array(format_date($node->timestamp) ." (original)" => $node->timestamp, format_date(time()) ." (current)" => time()) as $value=>$key) $timestamp .= " <OPTION VALUE=\"$key\"". (($node->timestamp == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (node_status($node) as $value) $display .= " <OPTION VALUE=\"". $status[$value] ."\"". (($node->status == $status[$value]) ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (node_comment_status() as $key=>$value) $comment .= " <OPTION VALUE=\"$key\"". ($node->comment == $key ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (node_promote_status() as $key=>$value) $promote .= " <OPTION VALUE=\"$key\"". ($node->promote == $key ? " SELECTED" : "") .">$value</OPTION>\n"; - $output .= "<FORM ACTION=\"admin.php?mod=node&id=$node->nid\" METHOD=\"post\">\n"; - $output .= "<B>Title:</B><BR>". check_output($node->title) ."<P>\n"; - $output .= "<B>Author:</B><BR><SELECT NAME=\"edit[author]\">$author</SELECT><P>\n"; - $output .= "<B>Status:</B><BR><SELECT NAME=\"edit[status]\">$display</SELECT><P>\n"; - $output .= "<B>Comment:</B><BR><SELECT NAME=\"edit[comment]\">$comment</SELECT><P>\n"; - $output .= "<B>Promote:</B><BR><SELECT NAME=\"edit[promote]\">$promote</SELECT><P>\n"; - $output .= "<B>Date:</B><BR><SELECT NAME=\"edit[timestamp]\">$timestamp</SELECT><P>\n"; - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$node->nid\">\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"View node\">\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save node\">\n"; + $output .= form_item("Title", check_output($node->title)); + $output .= form_select("Author", "author", array($node->author => $node->userid, $user->id => $user->userid), $node->author); + $output .= form_select("Status", "status", node_status($node), $node->status); + $output .= form_select("Comment", "comment", node_comment_status(), $node->comment); + $output .= form_select("Promote", "promote", node_promote_status(), $node->promote); + $output .= form_select("Date", "timestamp", array($node->timestamp => format_date($node->timestamp) ." (original)", time() => format_date(time()) ." (current)"), $node->timestamp); + $output .= form_hidden("nid", $node->nid); + $output .= form_submit("View node"); + $output .= form_submit("Save node"); $output .= "</FORM>\n"; return $output; |