]> git.joonet.de Git - adminer.git/commitdiff
Hide select export and import
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 11 Sep 2009 19:26:27 +0000 (19:26 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 11 Sep 2009 19:26:27 +0000 (19:26 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1096 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/adminer.inc.php
adminer/include/functions.inc.php
adminer/select.inc.php

index ac32380328d4e08e91be1d5aeb829392ef21e898..4cb09aca78d4aa8bb1283a4aeefd957b4cc983f1 100644 (file)
@@ -136,7 +136,7 @@ class Adminer {
        * @return null
        */
        function selectColumnsPrint($select, $columns) {
-               echo '<fieldset><legend><a href="#fieldset-select" onclick="return !toggle(\'fieldset-select\');">' . lang('Select') . "</a></legend><div id='fieldset-select'" . ($select ? "" : " class='hidden'") . ">\n";
+               print_fieldset("select", lang('Select'), $select);
                $i = 0;
                $fun_group = array(lang('Functions') => $this->functions, lang('Aggregation') => $this->grouping);
                foreach ($select as $key => $val) {
@@ -157,7 +157,7 @@ class Adminer {
        * @return null
        */
        function selectSearchPrint($where, $columns, $indexes) {
-               echo '<fieldset><legend><a href="#fieldset-search" onclick="return !toggle(\'fieldset-search\');">' . lang('Search') . "</a></legend><div id='fieldset-search'" . ($where ? "" : " class='hidden'") . ">\n";
+               print_fieldset("search", lang('Search'), $where);
                foreach ($indexes as $i => $index) {
                        if ($index["type"] == "FULLTEXT") {
                                echo "(<i>" . implode("</i>, <i>", array_map('h', $index["columns"])) . "</i>) AGAINST";
@@ -188,7 +188,7 @@ class Adminer {
        * @return null
        */
        function selectOrderPrint($order, $columns, $indexes) {
-               echo '<fieldset><legend><a href="#fieldset-sort" onclick="return !toggle(\'fieldset-sort\');">' . lang('Sort') . "</a></legend><div id='fieldset-sort'" . ($order ? "" : " class='hidden'") . ">\n";
+               print_fieldset("sort", lang('Sort'), $order);
                $i = 0;
                foreach ((array) $_GET["order"] as $key => $val) {
                        if (isset($columns[$val])) {
index ac4e6b2e2dedc3f0dc126330bcdb3a72ce77adc3..3eae0984ec0ab901906c33b9d0fc16b28275617d 100644 (file)
@@ -557,3 +557,13 @@ function is_email($email) {
        $domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component
        return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$", $email);
 }
+
+/** Print header for hidden fieldset (close by </div></fieldset>)
+* @param string
+* @param string
+* @param bool
+* @return null
+*/
+function print_fieldset($id, $legend, $visible = false) {
+       echo "<fieldset><legend><a href='#fieldset-$id' onclick=\"return !toggle('fieldset-$id');\">$legend</a></legend><div id='fieldset-$id'" . ($visible ? "" : " class='hidden'") . ">\n";
+}
index 482898908e1c843b47323849124992a45470d639..93b5c27ac9977098c0696f8bea127eab3ea594be 100644 (file)
@@ -282,9 +282,13 @@ if (!$columns) {
                        echo " (" . lang('%d row(s)', $found_rows) . ') <label><input type="checkbox" name="all" value="1">' . lang('whole result') . "</label>\n";
                        
                        echo (information_schema(DB) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' name='edit' value='" . lang('Edit') . "'> <input type='submit' name='clone' value='" . lang('Clone') . "'> <input type='submit' name='delete' value='" . lang('Delete') . "'$confirm></div></fieldset>\n");
-                       echo "<fieldset><legend>" . lang('Export') . "</legend><div>$dump_output $dump_format $dump_compress <input type='submit' name='export' value='" . lang('Export') . "'></div></fieldset>\n";
+                       print_fieldset("export", lang('Export'));
+                       echo "$dump_output $dump_format $dump_compress <input type='submit' name='export' value='" . lang('Export') . "'>\n";
+                       echo "</div></fieldset>\n";
                }
-               echo "<fieldset><legend>" . lang('CSV Import') . "</legend><div><input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> <input type='submit' name='import' value='" . lang('Import') . "'></div></fieldset>\n";
+               print_fieldset("import", lang('CSV Import'), !$result->num_rows);
+               echo "<input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> <input type='submit' name='import' value='" . lang('Import') . "'>\n";
+               echo "</div></fieldset>\n";
                
                $adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);