From 5dbdef7c07252ed740128155a85d397c392e3faa Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Tue, 24 Jul 2001 09:58:26 +0000 Subject: locale.module - fixed some minor HTML issues. - added some search/filter capabilities. --- modules/locale.module | 47 +++++++++++++++++++++++++++++++++++++------- modules/locale/locale.module | 47 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 80 insertions(+), 14 deletions(-) (limited to 'modules') diff --git a/modules/locale.module b/modules/locale.module index f0a053bf6..384d2f8a9 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -103,7 +103,7 @@ function locale_overview() { $result = db_query("SELECT * FROM locales ORDER BY string"); $output .= "\n"; - $output .= " \n"; + $output .= " \n"; while ($locale = db_fetch_object($result)) { $output .= " "; } @@ -116,7 +116,7 @@ function locale_translated($language) { $result = db_query("SELECT * FROM locales WHERE $language != '' ORDER BY string"); $output .= "
stringlanguagesoperations
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
\n"; - $output .= " \n"; + $output .= " \n"; while ($locale = db_fetch_object($result)) { $output .= " "; } @@ -129,7 +129,7 @@ function locale_untranslated($language) { $result = db_query("SELECT * FROM locales WHERE $language = '' ORDER BY string"); $output .= "
original stringtranslated stringoperations
original stringtranslated stringoperations
". check_output($locale->string) ."". check_output($locale->$language) ."id\"> edit localeid\">delete locale
\n"; - $output .= " \n"; + $output .= " \n"; while ($locale = db_fetch_object($result)) { $output .= " "; } @@ -138,6 +138,36 @@ function locale_untranslated($language) { return $output; } +function locale_search() { + global $edit, $languages, $REQUEST_URI; + + if (is_array($edit)) { + if ($edit[language] && $edit[status]) $query[] = check_input($edit[language]) . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''"; + if ($edit[module]) $query[] = "location LIKE '%module.php?mod=". check_input($edit[module]) ."%'"; + if ($edit[string]) $query[] = "string LIKE '%". check_input($edit[string]) ."%'"; + + $result = db_query("SELECT * FROM locales". (count($query) ? " WHERE ". @implode(" && ", $query) : "")); + + $output .= "
stringoperations
stringoperations
". check_output($locale->string) ."
$locale->location
id\"> edit localeid\">delete locale
\n"; + $output .= " \n"; + while ($locale = db_fetch_object($result)) { + $output .= " "; + } + $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
\n"; + + } + $form .= form_select("Language", "language", $edit[langauge], array_merge(array(0=>"All"), $languages)); + $form .= form_select("Status", "status", $edit[status], array("All", "Translated", "Untranslated"), "Only used when a language is selected."); + $form .= form_select("Module", "module", $edit[module], array_merge(array(0=>"All"), module_list())); + $form .= form_textfield("String", "string", $edit[string], 30, 30, "Leave blank to show all strings."); + + $form .= form_submit("Search"); + + $output .= form($REQUEST_URI, $form); + + return $output; +} + function locale_admin() { global $id, $edit, $op, $language; @@ -145,7 +175,7 @@ function locale_admin() { print status("locale disabled."); } else if (user_access("administer locales")) { - print "". locale_links(1) . locale_links(0) ."overview | help
\n"; + print "". locale_links(1) . locale_links(0) ."search | overview | help
\n"; switch ($op) { case "delete": @@ -158,15 +188,18 @@ function locale_admin() { case "edit": print locale_edit(check_input($id)); break; - case "Save translations": - print locale_save(check_input($id), $edit); - break; case "translated": print locale_translated($language); break; case "untranslated": print locale_untranslated($language); break; + case "Search": + case "search": + print locale_search(); + break; + case "Save translations": + print locale_save(check_input($id), $edit); default: print locale_overview(); } diff --git a/modules/locale/locale.module b/modules/locale/locale.module index f0a053bf6..384d2f8a9 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -103,7 +103,7 @@ function locale_overview() { $result = db_query("SELECT * FROM locales ORDER BY string"); $output .= "\n"; - $output .= " \n"; + $output .= " \n"; while ($locale = db_fetch_object($result)) { $output .= " "; } @@ -116,7 +116,7 @@ function locale_translated($language) { $result = db_query("SELECT * FROM locales WHERE $language != '' ORDER BY string"); $output .= "
stringlanguagesoperations
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
\n"; - $output .= " \n"; + $output .= " \n"; while ($locale = db_fetch_object($result)) { $output .= " "; } @@ -129,7 +129,7 @@ function locale_untranslated($language) { $result = db_query("SELECT * FROM locales WHERE $language = '' ORDER BY string"); $output .= "
original stringtranslated stringoperations
original stringtranslated stringoperations
". check_output($locale->string) ."". check_output($locale->$language) ."id\"> edit localeid\">delete locale
\n"; - $output .= " \n"; + $output .= " \n"; while ($locale = db_fetch_object($result)) { $output .= " "; } @@ -138,6 +138,36 @@ function locale_untranslated($language) { return $output; } +function locale_search() { + global $edit, $languages, $REQUEST_URI; + + if (is_array($edit)) { + if ($edit[language] && $edit[status]) $query[] = check_input($edit[language]) . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''"; + if ($edit[module]) $query[] = "location LIKE '%module.php?mod=". check_input($edit[module]) ."%'"; + if ($edit[string]) $query[] = "string LIKE '%". check_input($edit[string]) ."%'"; + + $result = db_query("SELECT * FROM locales". (count($query) ? " WHERE ". @implode(" && ", $query) : "")); + + $output .= "
stringoperations
stringoperations
". check_output($locale->string) ."
$locale->location
id\"> edit localeid\">delete locale
\n"; + $output .= " \n"; + while ($locale = db_fetch_object($result)) { + $output .= " "; + } + $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
\n"; + + } + $form .= form_select("Language", "language", $edit[langauge], array_merge(array(0=>"All"), $languages)); + $form .= form_select("Status", "status", $edit[status], array("All", "Translated", "Untranslated"), "Only used when a language is selected."); + $form .= form_select("Module", "module", $edit[module], array_merge(array(0=>"All"), module_list())); + $form .= form_textfield("String", "string", $edit[string], 30, 30, "Leave blank to show all strings."); + + $form .= form_submit("Search"); + + $output .= form($REQUEST_URI, $form); + + return $output; +} + function locale_admin() { global $id, $edit, $op, $language; @@ -145,7 +175,7 @@ function locale_admin() { print status("locale disabled."); } else if (user_access("administer locales")) { - print "". locale_links(1) . locale_links(0) ."overview | help
\n"; + print "". locale_links(1) . locale_links(0) ."search | overview | help
\n"; switch ($op) { case "delete": @@ -158,15 +188,18 @@ function locale_admin() { case "edit": print locale_edit(check_input($id)); break; - case "Save translations": - print locale_save(check_input($id), $edit); - break; case "translated": print locale_translated($language); break; case "untranslated": print locale_untranslated($language); break; + case "Search": + case "search": + print locale_search(); + break; + case "Save translations": + print locale_save(check_input($id), $edit); default: print locale_overview(); } -- cgit v1.2.3