Export htmlword coding style: wrap long lines
This commit is contained in:
parent
bccd3953f1
commit
bd8326a077
@ -21,17 +21,47 @@ if (isset($plugin_list)) {
|
||||
'force_file' => true,
|
||||
'options' => array(
|
||||
/* what to dump (structure/data/both) */
|
||||
array('type' => 'begin_group', 'name' => 'dump_what', 'text' => __('Dump table')),
|
||||
array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data'))),
|
||||
array('type' => 'end_group'),
|
||||
/* data options */
|
||||
array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure'),
|
||||
array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:')),
|
||||
array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row')),
|
||||
array('type' => 'end_group'),
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'dump_what',
|
||||
'text' => __('Dump table')
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'name' => 'structure_or_data',
|
||||
'values' => array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
),
|
||||
|
||||
/* data options */
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'data',
|
||||
'text' => __('Data dump options'),
|
||||
'force' => 'structure'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'null',
|
||||
'text' => __('Replace NULL with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'columns',
|
||||
'text' => __('Put columns names in the first row')
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
),
|
||||
),
|
||||
'options_text' => __('Options'),
|
||||
);
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
@ -61,10 +91,12 @@ if (isset($plugin_list)) {
|
||||
xmlns:x="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
|
||||
. ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
|
||||
<meta http-equiv="Content-type" content="text/html;charset='
|
||||
. (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
|
||||
</head>
|
||||
<body>'
|
||||
);
|
||||
@ -81,7 +113,9 @@ if (isset($plugin_list)) {
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>');
|
||||
return PMA_exportOutputHandler(
|
||||
'<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,10 +163,16 @@ if (isset($plugin_list)) {
|
||||
{
|
||||
global $what;
|
||||
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Dumping data for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
|
||||
if (! PMA_exportOutputHandler(
|
||||
'<h2>'
|
||||
. __('Dumping data for table') . ' ' . htmlspecialchars($table)
|
||||
. '</h2>'
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
|
||||
if (! PMA_exportOutputHandler(
|
||||
'<table class="width100" cellspacing="1">'
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -144,7 +184,11 @@ if (isset($plugin_list)) {
|
||||
if (isset($GLOBALS['htmlword_columns'])) {
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$schema_insert .= '<td class="print"><strong>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. htmlspecialchars(
|
||||
stripslashes(PMA_DBI_field_name($result, $i))
|
||||
)
|
||||
. '</strong></td>';
|
||||
} // end for
|
||||
$schema_insert .= '</tr>';
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
@ -163,7 +207,9 @@ if (isset($plugin_list)) {
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars($value) . '</td>';
|
||||
$schema_insert .= '<td class="print">'
|
||||
. htmlspecialchars($value)
|
||||
. '</td>';
|
||||
} // end for
|
||||
$schema_insert .= '</tr>';
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
@ -195,10 +241,18 @@ if (isset($plugin_list)) {
|
||||
|
||||
$columns_cnt = 4;
|
||||
$schema_insert .= '<tr class="print-category">';
|
||||
$schema_insert .= '<th class="print">' . __('Column') . '</th>';
|
||||
$schema_insert .= '<td class="print"><strong>' . __('Type') . '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>' . __('Null') . '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>' . __('Default') . '</strong></td>';
|
||||
$schema_insert .= '<th class="print">'
|
||||
. __('Column')
|
||||
. '</th>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Type')
|
||||
. '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Null')
|
||||
. '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Default')
|
||||
. '</strong></td>';
|
||||
$schema_insert .= '</tr>';
|
||||
|
||||
/**
|
||||
@ -230,22 +284,34 @@ if (isset($plugin_list)) {
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* PMA_exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $show_dates whether to include creation/update/check dates
|
||||
* @param bool $add_semicolon whether to add semicolon and end-of-line at the end
|
||||
* @param bool $add_semicolon whether to add semicolon and end-of-line
|
||||
* at the end
|
||||
* @param bool $view whether we're handling a view
|
||||
*
|
||||
* @return string resulting schema
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $show_dates = false, $add_semicolon = true, $view = false)
|
||||
{
|
||||
function PMA_getTableDef(
|
||||
$db,
|
||||
$table,
|
||||
$crlf,
|
||||
$error_url,
|
||||
$do_relation,
|
||||
$do_comments,
|
||||
$do_mime,
|
||||
$show_dates = false,
|
||||
$add_semicolon = true,
|
||||
$view = false
|
||||
) {
|
||||
global $cfgRelation;
|
||||
|
||||
$schema_insert = '';
|
||||
@ -287,19 +353,33 @@ if (isset($plugin_list)) {
|
||||
}
|
||||
|
||||
$schema_insert .= '<tr class="print-category">';
|
||||
$schema_insert .= '<th class="print">' . __('Column') . '</th>';
|
||||
$schema_insert .= '<td class="print"><strong>' . __('Type') . '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>' . __('Null') . '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>' . __('Default') . '</strong></td>';
|
||||
$schema_insert .= '<th class="print">'
|
||||
. __('Column')
|
||||
. '</th>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Type')
|
||||
. '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Null')
|
||||
. '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Default')
|
||||
. '</strong></td>';
|
||||
if ($do_relation && $have_rel) {
|
||||
$schema_insert .= '<td class="print"><strong>' . __('Links to') . '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Links to')
|
||||
. '</strong></td>';
|
||||
}
|
||||
if ($do_comments) {
|
||||
$schema_insert .= '<td class="print"><strong>' . __('Comments') . '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Comments')
|
||||
. '</strong></td>';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$schema_insert .= '<td class="print"><strong>' . htmlspecialchars('MIME') . '</strong></td>';
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. htmlspecialchars('MIME')
|
||||
. '</strong></td>';
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
$schema_insert .= '</tr>';
|
||||
@ -320,13 +400,28 @@ if (isset($plugin_list)) {
|
||||
$field_name = $column['Field'];
|
||||
|
||||
if ($do_relation && $have_rel) {
|
||||
$schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';
|
||||
$schema_insert .= '<td class="print">'
|
||||
. (isset($res_rel[$field_name])
|
||||
? htmlspecialchars(
|
||||
$res_rel[$field_name]['foreign_table']
|
||||
. ' (' . $res_rel[$field_name]['foreign_field']
|
||||
. ')'
|
||||
)
|
||||
: '') . '</td>';
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>';
|
||||
$schema_insert .= '<td class="print">'
|
||||
. (isset($comments[$field_name])
|
||||
? htmlspecialchars($comments[$field_name])
|
||||
: '') . '</td>';
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>';
|
||||
$schema_insert .= '<td class="print">'
|
||||
. (isset($mime_map[$field_name]) ?
|
||||
htmlspecialchars(
|
||||
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
|
||||
)
|
||||
: '') . '</td>';
|
||||
}
|
||||
|
||||
$schema_insert .= '</tr>';
|
||||
@ -360,10 +455,18 @@ if (isset($plugin_list)) {
|
||||
|
||||
foreach ($triggers as $trigger) {
|
||||
$dump .= '<tr class="print-category">';
|
||||
$dump .= '<td class="print">' . htmlspecialchars($trigger['name']) . '</td>';
|
||||
$dump .= '<td class="print">' . htmlspecialchars($trigger['action_timing']) . '</td>';
|
||||
$dump .= '<td class="print">' . htmlspecialchars($trigger['event_manipulation']) . '</td>';
|
||||
$dump .= '<td class="print">' . htmlspecialchars($trigger['definition']) . '</td>';
|
||||
$dump .= '<td class="print">'
|
||||
. htmlspecialchars($trigger['name'])
|
||||
. '</td>';
|
||||
$dump .= '<td class="print">'
|
||||
. htmlspecialchars($trigger['action_timing'])
|
||||
. '</td>';
|
||||
$dump .= '<td class="print">'
|
||||
. htmlspecialchars($trigger['event_manipulation'])
|
||||
. '</td>';
|
||||
$dump .= '<td class="print">'
|
||||
. htmlspecialchars($trigger['definition'])
|
||||
. '</td>';
|
||||
$dump .= '</tr>';
|
||||
}
|
||||
|
||||
@ -372,6 +475,7 @@ if (isset($plugin_list)) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
@ -379,43 +483,69 @@ if (isset($plugin_list)) {
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* PMA_exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view',
|
||||
* 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
*
|
||||
* @return bool Whether it succeeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
function PMA_exportStructure(
|
||||
$db,
|
||||
$table,
|
||||
$crlf,
|
||||
$error_url,
|
||||
$do_relation = false,
|
||||
$do_comments = false,
|
||||
$do_mime = false,
|
||||
$dates = false,
|
||||
$export_mode,
|
||||
$export_type
|
||||
) {
|
||||
$dump = '';
|
||||
|
||||
switch($export_mode) {
|
||||
case 'create_table':
|
||||
$dump .= '<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>';
|
||||
$dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates);
|
||||
$dump .= '<h2>'
|
||||
. __('Table structure for table') . ' ' . htmlspecialchars($table)
|
||||
. '</h2>';
|
||||
$dump .= PMA_getTableDef(
|
||||
$db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime,
|
||||
$dates
|
||||
);
|
||||
break;
|
||||
case 'triggers':
|
||||
$dump = '';
|
||||
$triggers = PMA_DBI_get_triggers($db, $table);
|
||||
if ($triggers) {
|
||||
$dump .= '<h2>' . __('Triggers') . ' ' . htmlspecialchars($table) . '</h2>';
|
||||
$dump .= '<h2>'
|
||||
. __('Triggers') . ' ' . htmlspecialchars($table)
|
||||
. '</h2>';
|
||||
$dump .= PMA_getTriggers($db, $table);
|
||||
}
|
||||
break;
|
||||
case 'create_view':
|
||||
$dump .= '<h2>' . __('Structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
|
||||
$dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true);
|
||||
$dump .= '<h2>'
|
||||
. __('Structure for view') . ' ' . htmlspecialchars($table)
|
||||
. '</h2>';
|
||||
$dump .= PMA_getTableDef(
|
||||
$db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime,
|
||||
$dates, true, true
|
||||
);
|
||||
break;
|
||||
case 'stand_in':
|
||||
$dump .= '<h2>' . __('Stand-in structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
|
||||
$dump .= '<h2>'
|
||||
. __('Stand-in structure for view') . ' ' . htmlspecialchars($table)
|
||||
. '</h2>';
|
||||
// export a stand-in definition to resolve view dependencies
|
||||
$dump .= PMA_getTableDefStandIn($db, $table, $crlf);
|
||||
} // end switch
|
||||
|
||||
Loading…
Reference in New Issue
Block a user