[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_7-21539-g663958b

Michal Čihař nijel at users.sourceforge.net
Mon Oct 24 14:21:57 CEST 2011


The branch, master has been updated
       via  663958b564bd96a3b8976894e1dce641bf740f52 (commit)
       via  3dc06f4f704ce8ef49ddecf9a500796a7a41db47 (commit)
       via  848f057c498bc7ca1ca9aed12977718033475ad5 (commit)
       via  252481af4ac81d270b836dedfa38874ba51c40be (commit)
       via  7efab496f7d21fd79df0688be3e882bef02aa79a (commit)
       via  97b52b0fd35ce76fd814ddcf2a458334628fe305 (commit)
      from  a67bd381338453d707cf8e89445e12c0bd32af68 (commit)


- Log -----------------------------------------------------------------
commit 663958b564bd96a3b8976894e1dce641bf740f52
Author: Michal Čihař <mcihar at suse.cz>
Date:   Mon Oct 24 14:17:02 2011 +0200

    Use same logic for printing SQL results as elsewhere

commit 3dc06f4f704ce8ef49ddecf9a500796a7a41db47
Author: Michal Čihař <mcihar at suse.cz>
Date:   Mon Oct 24 14:13:47 2011 +0200

    Unify print button code and factor it out to function

commit 848f057c498bc7ca1ca9aed12977718033475ad5
Author: Michal Čihař <mcihar at suse.cz>
Date:   Mon Oct 24 14:10:18 2011 +0200

    Whitespace cleanup

commit 252481af4ac81d270b836dedfa38874ba51c40be
Author: Michal Čihař <mcihar at suse.cz>
Date:   Mon Oct 24 14:10:08 2011 +0200

    Factor out js code for printing

commit 7efab496f7d21fd79df0688be3e882bef02aa79a
Author: Michal Čihař <mcihar at suse.cz>
Date:   Mon Oct 24 14:05:52 2011 +0200

    Fix indentation

commit 97b52b0fd35ce76fd814ddcf2a458334628fe305
Author: Michal Čihař <mcihar at suse.cz>
Date:   Mon Oct 24 14:02:21 2011 +0200

    Fix message

-----------------------------------------------------------------------

Summary of changes:
 db_datadict.php                    |   17 +--------
 db_printview.php                   |   19 +---------
 js/functions.js                    |   25 ++++++++++--
 libraries/common.lib.php           |   12 ++++++
 libraries/header_printview.inc.php |    3 +
 sql.php                            |   14 +------
 tbl_printview.php                  |   72 +++++++++++++----------------------
 7 files changed, 65 insertions(+), 97 deletions(-)

diff --git a/db_datadict.php b/db_datadict.php
index c9b5560..e99ccf5 100644
--- a/db_datadict.php
+++ b/db_datadict.php
@@ -269,22 +269,7 @@ foreach ($tables as $table) {
 /**
  * Displays the footer
  */
-?>
-<script type="text/javascript">
-//<![CDATA[
-function printPage()
-{
-    document.getElementById('print').style.visibility = 'hidden';
-    // Do print the page
-    if (typeof(window.print) != 'undefined') {
-        window.print();
-    }
-    document.getElementById('print').style.visibility = '';
-}
-//]]>
-</script>
-<?php
-echo '<br /><br /><input type="button" id="print" value="' . __('Print') . '" onclick="printPage()" />';
+PMA_printButton();
 
 require './libraries/footer.inc.php';
 ?>
diff --git a/db_printview.php b/db_printview.php
index 2ede085..a03b8b1 100644
--- a/db_printview.php
+++ b/db_printview.php
@@ -244,24 +244,7 @@ if ($num_tables == 0) {
 /**
  * Displays the footer
  */
-?>
-
-<script type="text/javascript">
-//<![CDATA[
-function printPage()
-{
-    // Do print the page
-    if (typeof(window.print) != 'undefined') {
-        window.print();
-    }
-}
-//]]>
-</script>
-<br /><br />
-
-<input type="button" class="print_ignore"
-    id="print" value="<?php echo __('Print'); ?>" onclick="printPage()" />
+PMA_printButton();
 
-<?php
 require './libraries/footer.inc.php';
 ?>
diff --git a/js/functions.js b/js/functions.js
index dcd8f0f..5aa776a 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1821,7 +1821,7 @@ function PMA_SQLPrettyPrint(string)
 
     // Populate tokens array
     var str='';
-    while (! stream.eol()) { 
+    while (! stream.eol()) {
         stream.start = stream.pos;
         token = mode.token(stream, state);
         if(token != null) {
@@ -1897,7 +1897,7 @@ function PMA_SQLPrettyPrint(string)
         }
         // Normal indentatin and spaces for everything else
         else {
-            if (! spaceExceptionsBefore[tokens[i][1]] 
+            if (! spaceExceptionsBefore[tokens[i][1]]
                && ! (i > 0 && spaceExceptionsAfter[tokens[i-1][1]])
                && output.charAt(output.length -1) != ' ' ) {
                     output += " ";
@@ -1910,14 +1910,14 @@ function PMA_SQLPrettyPrint(string)
         }
 
         // split columns in select and 'update set' clauses, but only inside statements blocks
-        if (( lastStatementPart == 'select' || lastStatementPart == 'where'  || lastStatementPart == 'set') 
+        if (( lastStatementPart == 'select' || lastStatementPart == 'where'  || lastStatementPart == 'set')
             && tokens[i][1]==',' && blockStack[0] == 'statement') {
 
             output += "\n" + tabs(indentLevel + 1);
         }
 
         // split conditions in where clauses, but only inside statements blocks
-        if (lastStatementPart == 'where' 
+        if (lastStatementPart == 'where'
             && (tokens[i][1]=='and' || tokens[i][1]=='or' || tokens[i][1]=='xor')) {
 
             if (blockStack[0] == 'statement') {
@@ -2562,7 +2562,7 @@ function PMA_verifyColumnsProperties()
 }
 
 /**
- * Hides/shows the default value input field, depending on the default type 
+ * Hides/shows the default value input field, depending on the default type
  */
 function PMA_hideShowDefaultValue($default_type)
 {
@@ -3582,3 +3582,18 @@ function escapeHtml(unsafe) {
         .replace(/"/g, """)
         .replace(/'/g, "'");
 }
+
+/**
+ * Print button
+ */
+function printPage()
+{
+    // Do print the page
+    if (typeof(window.print) != 'undefined') {
+        window.print();
+    }
+}
+
+$(document).ready(function() {
+    $('input#print').click(printPage);
+});
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 6054412..8c3f285 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -3780,4 +3780,16 @@ function PMA_analyzeLimitClause($limit_clause)
         'length' => trim($start_and_length[1])
     );
 }
+
+/**
+ * Outputs HTML code for print button.
+ *
+ * @return nothing
+ */
+function PMA_printButton()
+{
+    echo '<p class="print_ignore">';
+    echo '<input type="button" id="print" value="' . __('Print') . '" />';
+    echo '</p>';
+}
 ?>
diff --git a/libraries/header_printview.inc.php b/libraries/header_printview.inc.php
index bef4658..39ec4cf 100644
--- a/libraries/header_printview.inc.php
+++ b/libraries/header_printview.inc.php
@@ -48,6 +48,9 @@ if ($text_dir == 'ltr') {
 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
 <title><?php echo __('SQL result'); ?> - phpMyAdmin <?php echo PMA_VERSION ?></title>
 <link rel="stylesheet" type="text/css" href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&js_frame=print&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
+<?php
+require_once './libraries/header_scripts.inc.php';
+?>
 </head>
 
 <body bgcolor="#ffffff">
diff --git a/sql.php b/sql.php
index 05b80b6..aa99c19 100644
--- a/sql.php
+++ b/sql.php
@@ -990,19 +990,7 @@ $(document).ready(makeProfilingChart);
 
     // Do print the page if required
     if (isset($printview) && $printview == '1') {
-        ?>
-<script type="text/javascript">
-//<![CDATA[
-// Do print the page
-window.onload = function()
-{
-    if (typeof(window.print) != 'undefined') {
-        window.print();
-    }
-}
-//]]>
-</script>
-        <?php
+        PMA_printButton();
     } // end print case
 
     if ($GLOBALS['is_ajax_request'] != true) {
diff --git a/tbl_printview.php b/tbl_printview.php
index 3643d58..d289d6b 100644
--- a/tbl_printview.php
+++ b/tbl_printview.php
@@ -69,7 +69,7 @@ if ($multi_tables) {
         $tbl_list .= (empty($tbl_list) ? '' : ', ')
                   . PMA_backquote($table);
     }
-    echo '<strong>'.  __('Show tables') . ': ' . htmlspecialchars($tbl_list) . '</strong>' . "\n";
+    echo '<strong>'.  __('Showing tables') . ': ' . htmlspecialchars($tbl_list) . '</strong>' . "\n";
     echo '<hr />' . "\n";
 } // end if
 
@@ -178,15 +178,14 @@ foreach ($the_tables as $key => $table) {
         if (!empty($analyzed_sql[0]['create_table_fields'][$field_name]['type']) && $analyzed_sql[0]['create_table_fields'][$field_name]['type'] == 'TIMESTAMP' && $analyzed_sql[0]['create_table_fields'][$field_name]['timestamp_not_null']) {
             $row['Null'] = '';
         }
-        ?>
 
-<tr><td>
-    <?php
-    if (isset($pk_array[$row['Field']])) {
-        echo '    <u>' . $field_name . '</u>' . "\n";
-    } else {
-        echo '    ' . $field_name . "\n";
-    }
+        echo '<tr><td>';
+
+        if (isset($pk_array[$row['Field']])) {
+            echo '    <u>' . $field_name . '</u>' . "\n";
+        } else {
+            echo '    ' . $field_name . "\n";
+        }
     ?>
     </td>
     <td><?php echo $type; ?><bdo dir="ltr"></bdo></td>
@@ -195,28 +194,28 @@ foreach ($the_tables as $key => $table) {
     <td><?php if (isset($row['Default'])) { echo $row['Default']; } ?> </td>
     <!--<td><?php echo $row['Extra']; ?> </td>-->
     <?php
-    if ($have_rel) {
+        if ($have_rel) {
+            echo '    <td>';
+            if (isset($res_rel[$field_name])) {
+                echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']);
+            }
+            echo ' </td>' . "\n";
+        }
         echo '    <td>';
-        if (isset($res_rel[$field_name])) {
-            echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']);
+        $comments = PMA_getComments($db, $table);
+        if (isset($comments[$field_name])) {
+            echo htmlspecialchars($comments[$field_name]);
         }
         echo ' </td>' . "\n";
-    }
-    echo '    <td>';
-    $comments = PMA_getComments($db, $table);
-    if (isset($comments[$field_name])) {
-        echo htmlspecialchars($comments[$field_name]);
-    }
-    echo ' </td>' . "\n";
-    if ($cfgRelation['mimework']) {
-        $mime_map = PMA_getMIME($db, $table, true);
+        if ($cfgRelation['mimework']) {
+            $mime_map = PMA_getMIME($db, $table, true);
 
-        echo '    <td>';
-        if (isset($mime_map[$field_name])) {
-            echo htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype']));
+            echo '    <td>';
+            if (isset($mime_map[$field_name])) {
+                echo htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype']));
+            }
+            echo ' </td>' . "\n";
         }
-        echo ' </td>' . "\n";
-    }
     ?>
 </tr>
         <?php
@@ -243,7 +242,7 @@ foreach ($the_tables as $key => $table) {
             if ($nonisam == false) {
                 // Gets some sizes
 
-        $mergetable = PMA_Table::isMerge($db, $table);
+                $mergetable = PMA_Table::isMerge($db, $table);
 
                 list($data_size, $data_unit)         = PMA_formatByteDown($showtable['Data_length']);
                 if ($mergetable == false) {
@@ -444,24 +443,7 @@ foreach ($the_tables as $key => $table) {
 /**
  * Displays the footer
  */
-?>
+PMA_printButton();
 
-<script type="text/javascript">
-//<![CDATA[
-function printPage()
-{
-    // Do print the page
-    if (typeof(window.print) != 'undefined') {
-        window.print();
-    }
-}
-//]]>
-</script>
-
-<p class="print_ignore">
-    <input type="button" id="print" value="<?php echo __('Print'); ?>"
-        onclick="printPage()" /></p>
-
-<?php
 require './libraries/footer.inc.php';
 ?>


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list