diff --git a/ChangeLog b/ChangeLog index 88a209de6..cb5fa0ac7 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ $Source$ - make use of PMA_array_merge_recursive() - correctly reset config variables on changes in config.inc.php * sql.php: hide edit/delete links for information_schema (bug #1373201) + * db_operations.php: revised (style, code, xhtml output) 2005-12-05 Michal Čihař * many files: Use same script tag, use CDATA for scripts (RFE #995065). diff --git a/db_operations.php b/db_operations.php index 3bcb09d31..7dbad1b4f 100644 --- a/db_operations.php +++ b/db_operations.php @@ -2,10 +2,24 @@ /* $Id$ */ // vim: expandtab sw=4 ts=4 sts=4: +/** + * handles miscellaneous db operations: + * - move/rename + * - copy + * - changing collation + * - changing comment + * - adding tables + * - viewing PDF schemas + */ + +/** + * requirements + */ require_once('./libraries/common.lib.php'); require_once('./libraries/mysql_charsets.lib.php'); + /** - * Rename database or Copy database + * Rename/move or copy database */ if (isset($db) && ((isset($db_rename) && $db_rename == 'true') || @@ -56,7 +70,8 @@ if (isset($db) && } if ($this_what != 'nocopy') { - PMA_table_move_copy($db, $table, $newname, $table, isset($this_what) ? $this_what : 'data', $move); + PMA_table_move_copy($db, $table, $newname, $table, + isset($this_what) ? $this_what : 'data', $move); } $sql_query = $back . $sql_query; @@ -68,7 +83,8 @@ if (isset($db) && $get_fields = array('user','label','query'); $where_fields = array('dbase' => $db); $new_fields = array('dbase' => $newname); - PMA_duplicate_table_info('bookmarkwork', 'bookmark', $get_fields, $where_fields, $new_fields); + PMA_duplicate_table_info('bookmarkwork', 'bookmark', $get_fields, + $where_fields, $new_fields); } if ($move) { @@ -79,9 +95,11 @@ if (isset($db) && $local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';'; $sql_query .= "\n" . $local_query; PMA_DBI_query($local_query); - $message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname)); + $message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), + htmlspecialchars($newname)); } else { - $message = sprintf($strCopyDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname)); + $message = sprintf($strCopyDatabaseOK, htmlspecialchars($db), + htmlspecialchars($newname)); } $reload = TRUE; @@ -89,12 +107,11 @@ if (isset($db) && if ($move) { $db = $newname; } else { - $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']); if (isset($switch_to_new) && $switch_to_new == 'true') { - setcookie('pma_switch_to_new', 'true', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']); + PMA_setCookie( 'pma_switch_to_new', 'true' ); $db = $newname; } else { - setcookie('pma_switch_to_new', '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']); + PMA_setCookie( 'pma_switch_to_new', '' ); } } } @@ -131,7 +148,8 @@ if (empty($is_info)) { if (PMA_MYSQL_INT_VERSION >= 40101) { $db_collation = PMA_getDbCollation($db); } -if (PMA_MYSQL_INT_VERSION < 50002 || (PMA_MYSQL_INT_VERSION >= 50002 && $db != 'information_schema')) { +if (PMA_MYSQL_INT_VERSION < 50002 + || (PMA_MYSQL_INT_VERSION >= 50002 && $db != 'information_schema')) { $is_information_schema = FALSE; } else { $is_information_schema = TRUE; @@ -141,127 +159,164 @@ if (!$is_information_schema) { require('./libraries/display_create_table.lib.php'); - echo ''; if ($cfgRelation['commwork']) { -?> - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - + /** + * rename database + */ + ?> + + + + +
+ + '; + } + echo $strDBRename . ':'; + ?> + + + +
- + + ' . "\n"; + } + echo '' . "\n"; + echo PMA_generate_common_hidden_inputs($db); + ?> +
+ + '; + } + echo $strDBCopy . ':'; + ?> + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + style="vertical-align: middle" /> + +
+
+ +
+ + + = 40101) { // MySQL supports setting default charsets / collations for databases since // version 4.1.1. - echo ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n\n"; + echo ' ' . "\n" + . ' ' . "\n" + . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, + 'db_collation', 'select_db_collation', $db_collation, FALSE, 3) + . ' ' . "\n" + . '' . "\n" + . '' . "\n"; } - - echo '
+
+ + +
+ + '; + echo ''; } echo $strDBComment; $comment = PMA_getComments($db); - ?>
- - - - -
'; - } - echo $strDBRename.': '; - ?>
'; - echo '' - . PMA_generate_common_hidden_inputs($db); - ?>
'; - } - echo $strDBCopy.': '; - ?>
-' . "\n"; - } - echo '' . "\n" - . PMA_generate_common_hidden_inputs($db); - ?>
-   
-   
-   
- - -
-   
-
-
- - style="vertical-align: middle" />   -
- -
'; + echo '
' . "\n" + . PMA_generate_common_hidden_inputs($db, $table) + . ''; if ($cfg['PropertiesIconic']) { - echo ''; + echo ''; } - echo ' : ' . "\n" - . '
' - . PMA_generate_common_hidden_inputs($db, $table, 3) - . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', 'select_db_collation', $db_collation, FALSE, 3) - . ' ' - . ' ' . "\n" - . '
'; if ( $num_tables > 0 - && !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) { + && !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) { echo '

' . $strError . '

' - . sprintf( $strRelationNotWorking, '', '') + . sprintf( $strRelationNotWorking, + '', + '') . '
'; } // end if } // end if (!$is_information_schema) -// not sure about leaving the PDF dialog for information_schema +// not sure about leaving the PDF dialog for information_schema ?>
0) { $takeaway = $url_query . '&table=' . urlencode($table); } -if (($cfgRelation['pdfwork'] && $num_tables > 0) || - ($num_tables > 0 - && $cfgRelation['relwork'] && $cfgRelation['commwork'] - && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) - )) { ?> -
- 0) { ?> - - - - - - - 0) { ?> $test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE); if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { ?> - - - + echo PMA_generate_common_hidden_inputs($db); + if ($cfg['PropertiesIconic']) { + echo ''; + } + echo $strDisplayPDF; + ?>: + + +
- - - - - - - - - - - - + echo ' >' . $val . '' . "\n"; + } + ?> + + +
+ +
+ + + 0 - && $cfgRelation['relwork'] && $cfgRelation['commwork'] - && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) - ) { -?> - - - - - 0) || - ($num_tables > 0 - && $cfgRelation['relwork'] && $cfgRelation['commwork'] - && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) - )) { ?> -
- '; - } ?>PDF
- '; - if ($cfg['PropertiesIconic']) { - echo ''; - } - echo ''. $strEditPDFPages . ''; - ?> -
+
+ '; - } - echo $strDisplayPDF; ?>:  -
  - -
+ +
+ +
+ +
+ +
+ +
-
-
-
-
-
+ +
- -
- - - + $val) { + echo '
   
- '; - if ($cfg['PropertiesIconic']) { - echo ''; - } - echo $strImportDocSQL . ''; - ?> -
- - 0 + && $cfgRelation['relwork'] && $cfgRelation['commwork'] + && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) ) { + /** + * import docSQL files + */ + echo ''; } /** * Displays the footer */ -echo "\n"; require_once('./libraries/footer.inc.php'); ?>