~automne-team/automne/trunk

« back to all changes in this revision

Viewing changes to automne/phpMyAdmin/navigation.php

  • Committer: sebastien-pauchet
  • Date: 2012-02-15 16:47:40 UTC
  • mfrom: (363.2.105 4.2)
  • Revision ID: seb@automne-cms.org-20120215164740-xrk26iafkvztwv6s
Merge stable branch 4.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
/**
4
4
 * the navigation frame - displays server, db and table selection tree
5
5
 *
6
 
 * @version $Id$
7
6
 * @package phpMyAdmin
8
7
 * @uses $GLOBALS['pma']->databases
9
8
 * @uses $GLOBALS['server']
14
13
 * @uses $GLOBALS['text_dir']
15
14
 * @uses $GLOBALS['charset']
16
15
 * @uses $GLOBALS['pmaThemeImage']
17
 
 * @uses $GLOBALS['strNavTableFilter']
18
 
 * @uses $GLOBALS['strReset']
19
 
 * @uses $GLOBALS['strNoDatabases']
20
 
 * @uses $GLOBALS['strDatabase']
21
 
 * @uses $GLOBALS['strGo']
22
 
 * @uses $GLOBALS['strSelectADb']
23
 
 * @uses $GLOBALS['strNoTablesFound']
24
16
 * @uses $GLOBALS['cfg']['LeftFrameLight']
25
17
 * @uses $GLOBALS['cfg']['ShowTooltip']
26
18
 * @uses $GLOBALS['cfg']['ShowTooltipAliasDB']
102
94
$db_start = $GLOBALS['db'];
103
95
 
104
96
/**
105
 
 * the relation library
 
97
 * the relation settings
106
98
 */
107
 
require_once './libraries/relation.lib.php';
108
99
$cfgRelation = PMA_getRelationsParam();
109
100
 
110
101
/**
111
 
 * garvin: For re-usability, moved http-headers to a seperate file.
 
102
 * For re-usability, moved http-headers to a seperate file.
112
103
 * It can now be included by libraries/header.inc.php, querywindow.php.
113
104
 */
114
105
require_once './libraries/header_http.inc.php';
122
113
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
123
114
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
124
115
<html xmlns="http://www.w3.org/1999/xhtml"
125
 
    xml:lang="<?php echo $available_languages[$lang][2]; ?>"
126
 
    lang="<?php echo $available_languages[$lang][2]; ?>"
 
116
    xml:lang="<?php echo $available_languages[$lang][1]; ?>"
 
117
    lang="<?php echo $available_languages[$lang][1]; ?>"
127
118
    dir="<?php echo $GLOBALS['text_dir']; ?>">
128
119
 
129
120
<head>
134
125
        content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
135
126
    <base target="frame_content" />
136
127
    <link rel="stylesheet" type="text/css"
137
 
        href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;nocache=<?php echo $_SESSION['PMA_Config']->getThemeUniqueValue(); ?>" />
 
128
        href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
 
129
    <script src="./js/jquery/jquery-1.4.4.js" type="text/javascript"></script>
138
130
    <script type="text/javascript" src="js/navigation.js"></script>
139
131
    <script type="text/javascript" src="js/functions.js"></script>
140
132
    <script type="text/javascript">
192
184
    PMA_exitNavigationFrame();
193
185
} elseif (! count($GLOBALS['pma']->databases)) {
194
186
    // no database available, so we break here
195
 
    echo '<p>' . $GLOBALS['strNoDatabases'] . '</p>';
 
187
    echo '<p>' . __('No databases') . '</p>';
196
188
    PMA_exitNavigationFrame();
197
189
} elseif ($GLOBALS['cfg']['LeftFrameLight'] && count($GLOBALS['pma']->databases) > 1) {
198
190
    $list = $cfg['DisplayDatabasesList'];
215
207
 
216
208
    <div id="databaseList">
217
209
    <form method="post" action="index.php" target="_parent" id="left">
218
 
    <label for="lightm_db"><?php echo $GLOBALS['strDatabase']; ?></label>
219
210
    <?php
220
211
        echo PMA_generate_common_hidden_inputs() . "\n";
221
212
        echo $GLOBALS['pma']->databases->getHtmlSelectGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
222
213
        echo '<noscript>' . "\n"
223
 
            .'<input type="submit" name="Go" value="' . $GLOBALS['strGo'] . '" />' . "\n"
 
214
            .'<input type="submit" name="Go" value="' . __('Go') . '" />' . "\n"
224
215
            .'</noscript>' . "\n"
225
 
            .'</form>' . "\n";
 
216
            .'</form>' . "\n"
 
217
            . '</div>' . "\n";
226
218
    } else {
227
 
        if (! empty($db)) {
228
 
            echo '<div id="databaseList">' . "\n";
229
 
        }
230
219
        echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
231
220
    }
232
221
    $_url_params = array('pos' => $pos);
233
222
    PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
234
 
    if (! empty($db)) {
235
 
        echo '</div>' . "\n";
236
 
    }
237
223
}
238
224
?>
239
225
 
249
235
//    In this case, the database should not be collapsible/expandable
250
236
 
251
237
$img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
252
 
    .' width="9" height="9" alt="+" />';
 
238
    .' alt="+" />';
253
239
$img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
254
 
    .' width="9" height="9" alt="-" />';
 
240
    .' alt="-" />';
255
241
 
256
242
$href_left = '<a onclick="if (toggle(\'%d\')) return false;"'
257
243
    .' href="navigation.php?%s" target="_self">';
260
246
 
261
247
 
262
248
if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
263
 
    $table_list = PMA_getTableList($GLOBALS['db']);
264
 
    $table_count = count($table_list);
 
249
    $table_list = PMA_getTableList($GLOBALS['db'], null, $tpos, $cfg['MaxTableList']);
 
250
    $table_count = PMA_getTableCount($GLOBALS['db']);
265
251
 
266
252
    // show selected databasename as link to DefaultTabDatabase-page
267
253
    // with table count in ()
284
270
        $db_tooltip     = $GLOBALS['db'];
285
271
    }
286
272
 
287
 
    ?>
288
 
    <p><a class="item"
289
 
        href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query; ?>"
290
 
        title="<?php echo htmlspecialchars($db_tooltip); ?>" >
291
 
    <?php
292
 
    if ($GLOBALS['text_dir'] === 'rtl') {
293
 
        echo ' <bdo dir="ltr">(' . $table_count . ')</bdo> ';
294
 
    }
295
 
    echo '<span class="navi_dbName">' . htmlspecialchars($disp_name) . '</span>';
296
 
    if ($GLOBALS['text_dir'] === 'ltr') {
297
 
        echo ' <bdo dir="ltr">(' . $table_count . ')</bdo> ';
298
 
    }
299
 
    echo '</a></p>';
300
 
    if ($table_count) {
301
 
        echo '<span id=\'NavFilter\' style="display:none;"><span onclick="document.getElementById(\'fast_filter\').value=\'\'; fast_filter(\'\');document.getElementById(\'fast_filter\').focus();" style="background:white;color:black;cursor:pointer;padding:2px;margin:0 0 0 -20px;position:relative;float:right;" title="' . $strReset . '">X</span><input type="text" name="fast_filter" id="fast_filter" title="' . $strNavTableFilter . '" onkeyup="setTimeout(function(word){ return function(){ fast_filter(word);}}(this.value),1000);" style="width:90%;padding:0 -20px 0 0; padding:2px;"  onfocus="this.select();" /></span><script type="text/javascript">document.getElementById(\'NavFilter\').style.display=\'\';</script>';
 
273
    if ($table_count >= $GLOBALS['cfg']['LeftDisplayTableFilterMinimum']) {
 
274
        ?>
 
275
        <span id="NavFilter">
 
276
        <span id="clear_fast_filter" title="<?php echo __('Clear'); ?>">X</span>
 
277
            <input type="text" name="fast_filter" id="fast_filter" title="<?php echo __('Filter'); ?>" value="<?php echo __('filter tables by name'); ?>" />
 
278
        </span>
 
279
        <?php
302
280
    }
303
281
 
304
282
    /**
306
284
     * user can find a navigator to page thru all tables.
307
285
     *
308
286
     */
309
 
    $table_list = array_slice($table_list, $tpos, $cfg['MaxTableList']);
310
287
    if (! empty($table_list)) {
311
288
        // upper table list paginator
312
289
        if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
323
300
            PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
324
301
        }
325
302
    } else {
326
 
        echo $GLOBALS['strNoTablesFound'];
 
303
        echo __('No tables found in database.');
327
304
    }
328
305
    unset($table_list);
 
306
    if ($db != 'information_schema') {
 
307
        echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '">'
 
308
            .'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_snewtbl.png" id="icon_newtable" alt="' . _pgettext('short form', 'Create table') . '" />'
 
309
            . _pgettext('short form', 'Create table') . '</a></li></ul>';
 
310
    }
329
311
} elseif ($GLOBALS['cfg']['LeftFrameLight']) {
330
 
    echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
 
312
    /* No need to tell user to select database if we're showing complete list */
 
313
    if (!$list) {
 
314
        echo '<p>' . __('Please select a database') . '</p>';
 
315
    }
331
316
} else {
332
317
    echo '<div id="databaseList">' . "\n";
333
318
    $_url_params = array('pos' => $pos);
343
328
 *
344
329
 * @uses    $_REQUEST['dbgroup']
345
330
 * @uses    $GLOBALS['cfg']['DefaultTabDatabase']
346
 
 * @uses    $GLOBALS['strSelectADb']
347
331
 * @uses    strpos()
348
332
 * @uses    urlencode()
349
333
 * @uses    printf()
440
424
                            . '?' . $common_url_query; ?>', 'main');
441
425
                        return false;">
442
426
                    <?php
443
 
                    if ($GLOBALS['text_dir'] === 'rtl') {
444
 
                        echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
 
427
                    // Might be unset if CountTables directive is false
 
428
                    if (isset($db['num_tables'])) {
 
429
                        if ($GLOBALS['text_dir'] === 'rtl') {
 
430
                            echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
 
431
                        }
445
432
                    }
446
433
                    echo htmlspecialchars($db['disp_name']);
447
 
                    if ($GLOBALS['text_dir'] === 'ltr') {
448
 
                        echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
 
434
                    if (isset($db['num_tables'])) {
 
435
                        if ($GLOBALS['text_dir'] === 'ltr') {
 
436
                            echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
 
437
                        }
449
438
                    }
450
439
                    ?>
451
440
                </a>
452
441
                <?php
453
442
            } else {
454
 
                // with only 1 db available we dont need to refresh left frame
 
443
                // with only 1 db available we dont need to refresh navi frame
455
444
                // on db selection, only phpmain
456
445
                ?>
457
446
                <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
459
448
                    id="<?php echo htmlspecialchars($db['name']); ?>"
460
449
                    title="<?php echo htmlspecialchars($db['comment']); ?>">
461
450
                    <?php
462
 
                    if ($GLOBALS['text_dir'] === 'rtl') {
463
 
                        echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
 
451
                    if (isset($db['num_tables'])) {
 
452
                        if ($GLOBALS['text_dir'] === 'rtl') {
 
453
                            echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
 
454
                        }
464
455
                    }
465
456
                    echo htmlspecialchars($db['disp_name']);
466
 
                    if ($GLOBALS['text_dir'] === 'ltr') {
467
 
                        echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
 
457
                    if (isset($db['num_tables'])) {
 
458
                        if ($GLOBALS['text_dir'] === 'ltr') {
 
459
                            echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
 
460
                        }
468
461
                    }
469
462
                    ?>
470
463
                </a>
471
464
                <?php
472
465
            }
473
 
            if ($db['num_tables']) {
 
466
            if (($GLOBALS['cfg']['Server']['CountTables'] === false) || $db['num_tables']) {
474
467
                if (isset($tables_full[$db['name']])) {
475
468
                    $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
476
469
                } elseif (isset($tables_full[strtolower($db['name'])])) {
490
483
            } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
491
484
                // no tables and LeftFrameLight:
492
485
                // display message no tables in selected db
493
 
                echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
 
486
                echo '<p>' . __('Please select a database') . '</p>' . "\n";
494
487
            }
495
488
            echo '</li>' . "\n";
496
489
        } // end foreach db
527
520
 * @uses    $GLOBALS['cfg']['LeftFrameTableSeparator']
528
521
 * @uses    $GLOBALS['cfg']['DefaultTabDatabase']
529
522
 * @uses    $GLOBALS['cfg']['DefaultTabTable']
530
 
 * @uses    $GLOBALS['strRows']
531
 
 * @uses    $GLOBALS['strBrowse']
532
523
 * @global  integer the element counter
533
524
 * @global  string  html code for '-' image
534
525
 * @global  string  html code for '+' image
554
545
        echo '<ul id="subel' . $element_counter . '" style="display: none">';
555
546
    }
556
547
    foreach ($tables as $group => $table) {
557
 
        // only allow grouping if the group has more than 1 table       
 
548
        // only allow grouping if the group has more than 1 table
558
549
        if (isset($table['is' . $sep . 'group']) && $table['tab' . $sep . 'count'] > 1) {
559
550
            $common_url_query = $GLOBALS['common_url_query']
560
551
                . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
612
603
            echo '</li>' . "\n";
613
604
        } elseif (is_array($table)) {
614
605
            // the table was not grouped because it is the only one with its prefix
615
 
            if (isset($table['is' . $sep . 'group'])) {
 
606
            while (isset($table['is' . $sep . 'group'])) {
616
607
                // get the array with the actual table information
617
608
                foreach ($table as $value) {
618
609
                    if(is_array($value)) {
623
614
            $link_title = PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']);
624
615
            // quick access icon next to each table name
625
616
            echo '<li>' . "\n";
626
 
            echo '<a title="'
 
617
            echo '<a class="tableicon" title="'
627
618
                . htmlspecialchars($link_title)
628
619
                . ': ' . htmlspecialchars($table['Comment'])
629
 
                .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')"'
 
620
                .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"'
630
621
                .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
631
622
                .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
632
623
                . $GLOBALS['common_url_query']
640
631
                echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
641
632
            }
642
633
            echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
643
 
                .' width="10" height="10" alt="' . htmlspecialchars($link_title) . '" /></a>' . "\n";
 
634
                .' alt="' . htmlspecialchars($link_title) . '" /></a>' . "\n";
644
635
 
645
636
            // link for the table name itself
646
637
            $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
648
639
                .urlencode($table['Name']) . '&amp;pos=0';
649
640
            echo '<a href="' . $href
650
641
            . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
651
 
                .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows']) . ')"'
 
642
                .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows')) . ')"'
652
643
                .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
653
644
                // preserve spaces in table name
654
645
                . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';