Commit 02c622de authored by Dries's avatar Dries

- Patch 4332 by Goba: eliminate compose tips module.
parent 01b5aa17
......@@ -934,10 +934,6 @@ function form_weight($title = NULL, $name = "weight", $value = 0, $delta = 10, $
return form_select($title, $name, $value, $weights, $description, $extra);
}
function form_allowed_tags_text() {
return variable_get("allowed_html", "") ? (t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))) : "";
}
/* @} */
/**
......
......@@ -184,7 +184,7 @@ function blog_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("blog", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : filter_tips_short());
return $output;
}
......
......@@ -184,7 +184,7 @@ function blog_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("blog", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : filter_tips_short());
return $output;
}
......
......@@ -185,7 +185,7 @@ function book_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("book", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 20, form_allowed_tags_text());
$output .= form_textarea(t("Body"), "body", $node->body, 60, 20, filter_tips_short());
$output .= form_textarea(t("Log message"), "log", $node->log, 60, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
if (user_access("administer nodes")) {
......
......@@ -185,7 +185,7 @@ function book_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("book", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 20, form_allowed_tags_text());
$output .= form_textarea(t("Body"), "body", $node->body, 60, 20, filter_tips_short());
$output .= form_textarea(t("Log message"), "log", $node->log, 60, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
if (user_access("administer nodes")) {
......
......@@ -150,7 +150,7 @@ function comment_user($type, $edit, &$user) {
break;
case "edit_form":
// when user tries to edit his own data
return form_textarea(t("Signature"), "signature", $user->signature, 70, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". form_allowed_tags_text());
return form_textarea(t("Signature"), "signature", $user->signature, 70, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". filter_tips_short());
case "edit_validate":
// validate user data editing
return array("signature" => $edit["signature"]);
......@@ -1259,7 +1259,7 @@ function theme_comment_form($edit, $title) {
$form .= form_textfield(t("Subject"), "subject", $edit["subject"], 50, 64);
// comment field:
$form .= form_textarea(t("Comment"), "comment", $edit["comment"] ? $edit["comment"] : $user->signature, 70, 10, form_allowed_tags_text());
$form .= form_textarea(t("Comment"), "comment", $edit["comment"] ? $edit["comment"] : $user->signature, 70, 10, filter_tips_short());
// preview button:
$form .= form_hidden("cid", $edit["cid"]);
......
......@@ -150,7 +150,7 @@ function comment_user($type, $edit, &$user) {
break;
case "edit_form":
// when user tries to edit his own data
return form_textarea(t("Signature"), "signature", $user->signature, 70, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". form_allowed_tags_text());
return form_textarea(t("Signature"), "signature", $user->signature, 70, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". filter_tips_short());
case "edit_validate":
// validate user data editing
return array("signature" => $edit["signature"]);
......@@ -1259,7 +1259,7 @@ function theme_comment_form($edit, $title) {
$form .= form_textfield(t("Subject"), "subject", $edit["subject"], 50, 64);
// comment field:
$form .= form_textarea(t("Comment"), "comment", $edit["comment"] ? $edit["comment"] : $user->signature, 70, 10, form_allowed_tags_text());
$form .= form_textarea(t("Comment"), "comment", $edit["comment"] ? $edit["comment"] : $user->signature, 70, 10, filter_tips_short());
// preview button:
$form .= form_hidden("cid", $edit["cid"]);
......
......@@ -7,12 +7,32 @@ function filter_help($section = "admin/help#filter") {
return t("Framework for handling filtering of content.");
case 'admin/system/filters':
return t("Filters fit between the raw text in a node and the HTML output. They allow you to replace text selectively. Uses include automatic conversion of emoticons into graphics and filtering HTML content from users' submissions.");
case 'filter#tip':
switch (variable_get("filter_html", 1)) {
case 0:
return t("All HTML tags allowed");
break;
case 1:
if ($allowed_html = variable_get("allowed_html", "<a> <b> <dd> <dl> <dt> <i> <li> <ol> <u> <ul>")) {
return t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html);
} else {
return t("No HTML tags allowed");
}
break;
case 2:
return t("No HTML tags allowed");
break;
}
break;
}
}
function filter_link($type) {
if ($type == "system" && user_access("administer site configuration")) {
menu("admin/system/filters", t("filters"), "filter_admin", 5);
if ($type == "system") {
if (user_access("administer site configuration")) {
menu("admin/system/filters", t("filters"), "filter_admin", 5);
}
menu("filter/tips", t("Compose tips"), "filter_tips_page", 0, MENU_HIDE);
}
}
......@@ -159,4 +179,19 @@ function filter_old_urls($text) {
return $text;
}
?>
\ No newline at end of file
function filter_tips_page() {
$tips = module_invoke_all("help", "filter#tip");
foreach ($tips as $tip) {
if ($tip) {
$tiplist .= "<li>$tip</li>\n";
}
}
$output = "<ul class=\"compose-tips\">\n$tiplist\n</ul>\n";
print theme("page", $output, t("Compose Tips"));
}
function filter_tips_short() {
return filter_help("filter#tip") . "<br />" . l(t("More information on formatting options."), "filter/tips", array("target" => "_blank"));
}
?>
......@@ -7,12 +7,32 @@ function filter_help($section = "admin/help#filter") {
return t("Framework for handling filtering of content.");
case 'admin/system/filters':
return t("Filters fit between the raw text in a node and the HTML output. They allow you to replace text selectively. Uses include automatic conversion of emoticons into graphics and filtering HTML content from users' submissions.");
case 'filter#tip':
switch (variable_get("filter_html", 1)) {
case 0:
return t("All HTML tags allowed");
break;
case 1:
if ($allowed_html = variable_get("allowed_html", "<a> <b> <dd> <dl> <dt> <i> <li> <ol> <u> <ul>")) {
return t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html);
} else {
return t("No HTML tags allowed");
}
break;
case 2:
return t("No HTML tags allowed");
break;
}
break;
}
}
function filter_link($type) {
if ($type == "system" && user_access("administer site configuration")) {
menu("admin/system/filters", t("filters"), "filter_admin", 5);
if ($type == "system") {
if (user_access("administer site configuration")) {
menu("admin/system/filters", t("filters"), "filter_admin", 5);
}
menu("filter/tips", t("Compose tips"), "filter_tips_page", 0, MENU_HIDE);
}
}
......@@ -159,4 +179,19 @@ function filter_old_urls($text) {
return $text;
}
?>
\ No newline at end of file
function filter_tips_page() {
$tips = module_invoke_all("help", "filter#tip");
foreach ($tips as $tip) {
if ($tip) {
$tiplist .= "<li>$tip</li>\n";
}
}
$output = "<ul class=\"compose-tips\">\n$tiplist\n</ul>\n";
print theme("page", $output, t("Compose Tips"));
}
function filter_tips_short() {
return filter_help("filter#tip") . "<br />" . l(t("More information on formatting options."), "filter/tips", array("target" => "_blank"));
}
?>
......@@ -83,7 +83,7 @@ function story_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("story", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : filter_tips_short());
return $output;
}
......
......@@ -83,7 +83,7 @@ function story_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("story", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : filter_tips_short());
return $output;
}
......
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