Commit bef0244c authored by Dries's avatar Dries

- Usability improvement: made the theme selector and module selector pages
  use the new table rendering functions.
parent d626a6cf
...@@ -185,8 +185,7 @@ function system_listing($type, $directory, $required = array()) { ...@@ -185,8 +185,7 @@ function system_listing($type, $directory, $required = array()) {
ksort($files); ksort($files);
$output = "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; $header = array(t("name"), t("description"), t("status"));
$output .= "<tr><th>" . t("name") . "</th><th>" . t("description") . "</th><th>" . t("enabled") . "</th></tr>\n";
foreach ($files as $filename => $file) { foreach ($files as $filename => $file) {
include_once($filename); include_once($filename);
...@@ -210,14 +209,10 @@ function system_listing($type, $directory, $required = array()) { ...@@ -210,14 +209,10 @@ function system_listing($type, $directory, $required = array()) {
db_query("DELETE FROM system WHERE filename = '%s' AND type = '%s'", $filename, $type); db_query("DELETE FROM system WHERE filename = '%s' AND type = '%s'", $filename, $type);
db_query("INSERT INTO system (name, description, type, filename, status) VALUES ('%s', '%s', '%s', '%s', %d)", $info->name, $info->description, $type, $filename, $file->status); db_query("INSERT INTO system (name, description, type, filename, status) VALUES ('%s', '%s', '%s', '%s', %d)", $info->name, $info->description, $type, $filename, $file->status);
$output .= "<tr>"; $rows[] = array($info->name, $info->description, array("data" => (in_array($filename, $required) ? form_hidden("status][$filename", 1) . t("required") : form_checkbox("", "status][$filename", 1, $file->status)), "align" => "center"));
$output .= "<td>$info->name</td>";
$output .= "<td>$info->description</td>";
$output .= "<td align=\"center\">". (in_array($filename, $required) ? form_hidden("status][$filename", 1) . t("required") : form_checkbox("", "status][$filename", 1, $file->status)) ."</td>";
$output .= "</tr>\n";
} }
$output .= "</table><br />\n";
$output .= form_submit(t("Save $type settings")); $output = table($header, $rows) . form_submit(t("Save $type settings"));
return form($output); return form($output);
} }
......
...@@ -185,8 +185,7 @@ function system_listing($type, $directory, $required = array()) { ...@@ -185,8 +185,7 @@ function system_listing($type, $directory, $required = array()) {
ksort($files); ksort($files);
$output = "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; $header = array(t("name"), t("description"), t("status"));
$output .= "<tr><th>" . t("name") . "</th><th>" . t("description") . "</th><th>" . t("enabled") . "</th></tr>\n";
foreach ($files as $filename => $file) { foreach ($files as $filename => $file) {
include_once($filename); include_once($filename);
...@@ -210,14 +209,10 @@ function system_listing($type, $directory, $required = array()) { ...@@ -210,14 +209,10 @@ function system_listing($type, $directory, $required = array()) {
db_query("DELETE FROM system WHERE filename = '%s' AND type = '%s'", $filename, $type); db_query("DELETE FROM system WHERE filename = '%s' AND type = '%s'", $filename, $type);
db_query("INSERT INTO system (name, description, type, filename, status) VALUES ('%s', '%s', '%s', '%s', %d)", $info->name, $info->description, $type, $filename, $file->status); db_query("INSERT INTO system (name, description, type, filename, status) VALUES ('%s', '%s', '%s', '%s', %d)", $info->name, $info->description, $type, $filename, $file->status);
$output .= "<tr>"; $rows[] = array($info->name, $info->description, array("data" => (in_array($filename, $required) ? form_hidden("status][$filename", 1) . t("required") : form_checkbox("", "status][$filename", 1, $file->status)), "align" => "center"));
$output .= "<td>$info->name</td>";
$output .= "<td>$info->description</td>";
$output .= "<td align=\"center\">". (in_array($filename, $required) ? form_hidden("status][$filename", 1) . t("required") : form_checkbox("", "status][$filename", 1, $file->status)) ."</td>";
$output .= "</tr>\n";
} }
$output .= "</table><br />\n";
$output .= form_submit(t("Save $type settings")); $output = table($header, $rows) . form_submit(t("Save $type settings"));
return form($output); return form($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