diff options
author | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2001-06-04 15:17:10 +0000 |
---|---|---|
committer | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2001-06-04 15:17:10 +0000 |
commit | 2ecc3e4c78d032bf3f05018da6522437ffca3906 (patch) | |
tree | da8d9ad42ab5f23fcab3415842ee9d1dbef877da | |
parent | 6563382974be2a2d76b49adfaafc2600e2943c02 (diff) | |
download | brdo-2ecc3e4c78d032bf3f05018da6522437ffca3906.tar.gz brdo-2ecc3e4c78d032bf3f05018da6522437ffca3906.tar.bz2 |
- Output disabled message when locale is disabled.
- If $languages is empty and locale is enabled output $na instead of script
errors.
-rw-r--r-- | modules/locale.module | 34 | ||||
-rw-r--r-- | modules/locale/locale.module | 34 |
2 files changed, 40 insertions, 28 deletions
diff --git a/modules/locale.module b/modules/locale.module index b8dd70fa6..b4f254cc0 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -53,25 +53,31 @@ function locale_edit($id) { } function locale_languages($translation) { - global $languages; - foreach ($languages as $key=>$value) { - $output .= ($translation->$key) ? "$key " : "<STRIKE>$key</STRIKE> "; + global $languages, $na; + if (count($languages)) { + foreach ($languages as $key=>$value) { + $output .= ($translation->$key) ? "$key " : "<STRIKE>$key</STRIKE> "; + } + return $output; } - return $output; + return $na; } function locale_overview() { - $result = db_query("SELECT * FROM locales ORDER BY string"); - - $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; - $output .= " <TR><TH>string</TH><TH>languages</TH><TH COLSPAN=\"2\">operations</TH><TR>\n"; - while ($locale = db_fetch_object($result)) { - $languages = locale_languages($locale); - $output .= " <TR><TD>". check_output($locale->string) ."<BR><SMALL><I>$locale->location</I></SMALL></TD><TD ALIGN=\"center\">$languages</TD><TD><A HREF=\"admin.php?mod=locale&op=edit&id=$locale->id\">edit</A></TD><TD><A HREF=\"admin.php?mod=locale&op=delete&id=$locale->id\">delete</A></TD></TR>"; + if (variable_get("locale", 0)) { + $result = db_query("SELECT * FROM locales ORDER BY string"); + + $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; + $output .= " <TR><TH>string</TH><TH>languages</TH><TH COLSPAN=\"2\">operations</TH><TR>\n"; + while ($locale = db_fetch_object($result)) { + $languages = locale_languages($locale); + $output .= " <TR><TD>". check_output($locale->string) ."<BR><SMALL><I>$locale->location</I></SMALL></TD><TD ALIGN=\"center\">$languages</TD><TD><A HREF=\"admin.php?mod=locale&op=edit&id=$locale->id\">edit</A></TD><TD><A HREF=\"admin.php?mod=locale&op=delete&id=$locale->id\">delete</A></TD></TR>"; + } + $output .= "</TABLE>\n"; + + return $output; } - $output .= "</TABLE>\n"; - - return $output; + return "Locale disabled."; } function locale_admin() { diff --git a/modules/locale/locale.module b/modules/locale/locale.module index b8dd70fa6..b4f254cc0 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -53,25 +53,31 @@ function locale_edit($id) { } function locale_languages($translation) { - global $languages; - foreach ($languages as $key=>$value) { - $output .= ($translation->$key) ? "$key " : "<STRIKE>$key</STRIKE> "; + global $languages, $na; + if (count($languages)) { + foreach ($languages as $key=>$value) { + $output .= ($translation->$key) ? "$key " : "<STRIKE>$key</STRIKE> "; + } + return $output; } - return $output; + return $na; } function locale_overview() { - $result = db_query("SELECT * FROM locales ORDER BY string"); - - $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; - $output .= " <TR><TH>string</TH><TH>languages</TH><TH COLSPAN=\"2\">operations</TH><TR>\n"; - while ($locale = db_fetch_object($result)) { - $languages = locale_languages($locale); - $output .= " <TR><TD>". check_output($locale->string) ."<BR><SMALL><I>$locale->location</I></SMALL></TD><TD ALIGN=\"center\">$languages</TD><TD><A HREF=\"admin.php?mod=locale&op=edit&id=$locale->id\">edit</A></TD><TD><A HREF=\"admin.php?mod=locale&op=delete&id=$locale->id\">delete</A></TD></TR>"; + if (variable_get("locale", 0)) { + $result = db_query("SELECT * FROM locales ORDER BY string"); + + $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; + $output .= " <TR><TH>string</TH><TH>languages</TH><TH COLSPAN=\"2\">operations</TH><TR>\n"; + while ($locale = db_fetch_object($result)) { + $languages = locale_languages($locale); + $output .= " <TR><TD>". check_output($locale->string) ."<BR><SMALL><I>$locale->location</I></SMALL></TD><TD ALIGN=\"center\">$languages</TD><TD><A HREF=\"admin.php?mod=locale&op=edit&id=$locale->id\">edit</A></TD><TD><A HREF=\"admin.php?mod=locale&op=delete&id=$locale->id\">delete</A></TD></TR>"; + } + $output .= "</TABLE>\n"; + + return $output; } - $output .= "</TABLE>\n"; - - return $output; + return "Locale disabled."; } function locale_admin() { |