Commit 7962b6cc authored by Dries's avatar Dries

- Fixed small form glitches.
parent ab20a866
......@@ -162,12 +162,19 @@ function book_delete(&$node) {
}
function book_form(&$node, &$help, &$error) {
global $user;
global $user, $op;
$output .= form_select(t("Parent"), "parent", $node->parent, book_toc(), t("The parent subject or category the page belongs in."));
if ($node->teaser && !$node->format) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
if ($node->format) {
if ($op != t("Preview")) {
$node->body = addslashes($node->body);
}
}
else {
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
......@@ -313,7 +320,7 @@ function book_body($node) {
ob_end_clean();
}
else {
$output = check_output($node->body, 1);
$output = check_output(filter($node->body), 1);
}
return $output;
......
......@@ -162,12 +162,19 @@ function book_delete(&$node) {
}
function book_form(&$node, &$help, &$error) {
global $user;
global $user, $op;
$output .= form_select(t("Parent"), "parent", $node->parent, book_toc(), t("The parent subject or category the page belongs in."));
if ($node->teaser && !$node->format) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
if ($node->format) {
if ($op != t("Preview")) {
$node->body = addslashes($node->body);
}
}
else {
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
......@@ -313,7 +320,7 @@ function book_body($node) {
ob_end_clean();
}
else {
$output = check_output($node->body, 1);
$output = check_output(filter($node->body), 1);
}
return $output;
......
......@@ -2,8 +2,8 @@
// $Id$
function page_node($field) {
$info["name"] = t("static page");
$info["description"] = t("If you just want to add a static page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue.");
$info["name"] = t("page");
$info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue.");
return $info[$field];
}
......@@ -48,7 +48,6 @@ function page_delete(&$node) {
function page_load($node) {
$page = db_fetch_object(db_query("SELECT format, link FROM page WHERE nid = '$node->nid'"));
return $page;
}
......@@ -66,15 +65,16 @@ function page_link($type) {
function page_body($node) {
global $theme, $op;
if ($node->format) {
/*
** Make sure only authorized users can preview PHP pages.
*/
/*
** Make sure only authorized users can preview static (PHP)
** pages.
*/
if ($op == t("Preview") && !user_access("adminster nodes")) {
return;
}
if ($op == t("Preview") && !user_access("adminster nodes")) {
return;
}
if ($node->format) {
ob_start();
eval($node->body);
$output = ob_get_contents();
......@@ -95,23 +95,30 @@ function page_view($node, $main = 0) {
** will be generated.
*/
$theme->box($node->title, page_body($body));
$output .= page_body($node);
/*
** Add the node specific links:
*/
$output .= "<div align=\"right\">". $theme->links(link_node($node, $main)) ."</div>";
$theme->box($node->title, $output);
}
function page_form(&$node, &$help, &$error) {
global $op;
if ($node->teaser && !$node->format) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
if ($node->format) {
if ($op != t("Preview")) {
$node->body = addslashes($node->body);
}
}
else {
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
}
/*
** Q: s this still required?
**
** if ($op != t("Preview") && $node->format) {
** $node->body = addslashes($node->body);
** }
*/
$output .= form_textarea("Body", "body", $node->body, 60, 20);
$output .= form_textfield("Link", "link", $node->link, 60, 64);
......
......@@ -2,8 +2,8 @@
// $Id$
function page_node($field) {
$info["name"] = t("static page");
$info["description"] = t("If you just want to add a static page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue.");
$info["name"] = t("page");
$info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue.");
return $info[$field];
}
......@@ -48,7 +48,6 @@ function page_delete(&$node) {
function page_load($node) {
$page = db_fetch_object(db_query("SELECT format, link FROM page WHERE nid = '$node->nid'"));
return $page;
}
......@@ -66,15 +65,16 @@ function page_link($type) {
function page_body($node) {
global $theme, $op;
if ($node->format) {
/*
** Make sure only authorized users can preview PHP pages.
*/
/*
** Make sure only authorized users can preview static (PHP)
** pages.
*/
if ($op == t("Preview") && !user_access("adminster nodes")) {
return;
}
if ($op == t("Preview") && !user_access("adminster nodes")) {
return;
}
if ($node->format) {
ob_start();
eval($node->body);
$output = ob_get_contents();
......@@ -95,23 +95,30 @@ function page_view($node, $main = 0) {
** will be generated.
*/
$theme->box($node->title, page_body($body));
$output .= page_body($node);
/*
** Add the node specific links:
*/
$output .= "<div align=\"right\">". $theme->links(link_node($node, $main)) ."</div>";
$theme->box($node->title, $output);
}
function page_form(&$node, &$help, &$error) {
global $op;
if ($node->teaser && !$node->format) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
if ($node->format) {
if ($op != t("Preview")) {
$node->body = addslashes($node->body);
}
}
else {
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
}
/*
** Q: s this still required?
**
** if ($op != t("Preview") && $node->format) {
** $node->body = addslashes($node->body);
** }
*/
$output .= form_textarea("Body", "body", $node->body, 60, 20);
$output .= form_textfield("Link", "link", $node->link, 60, 64);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment