diff options
-rw-r--r-- | db_designer.php (renamed from pmd_general.php) | 41 | ||||
-rw-r--r-- | db_qbe.php | 2 | ||||
-rw-r--r-- | js/messages.php | 1 | ||||
-rw-r--r-- | js/pmd/ajax.js | 60 | ||||
-rw-r--r-- | js/pmd/move.js | 80 | ||||
-rw-r--r-- | libraries/Menu.class.php | 2 | ||||
-rw-r--r-- | libraries/db_designer.lib.php (renamed from libraries/pmd_general.lib.php) | 184 | ||||
-rw-r--r-- | libraries/designer.lib.php | 178 | ||||
-rw-r--r-- | libraries/pmd_common.php | 200 | ||||
-rw-r--r-- | libraries/tbl_relation.lib.php | 4 | ||||
-rw-r--r-- | pmd_display_field.php | 63 | ||||
-rw-r--r-- | pmd_relation_new.php | 134 | ||||
-rw-r--r-- | pmd_relation_upd.php | 70 | ||||
-rw-r--r-- | pmd_save_pos.php | 63 | ||||
-rw-r--r-- | test/libraries/PMA_designer_test.php | 8 |
15 files changed, 461 insertions, 629 deletions
diff --git a/pmd_general.php b/db_designer.php index 7f7b114bec..5d8b8a5655 100644 --- a/pmd_general.php +++ b/db_designer.php @@ -6,12 +6,9 @@ * @package PhpMyAdmin-Designer */ -/** - * - */ require_once 'libraries/common.inc.php'; require_once 'libraries/pmd_common.php'; -require_once 'libraries/pmd_general.lib.php'; +require_once 'libraries/db_designer.lib.php'; $script_display_field = PMA_getTablesInfo(); $tab_column = PMA_getColumnsInfo(); @@ -24,11 +21,10 @@ $response = PMA_Response::getInstance(); if (isset($_REQUEST['dialog'])) { - include_once 'libraries/designer.lib.php'; if ($_REQUEST['dialog'] == 'edit') { - $html = PMA_getHtmlForEditOrDeletePages($GLOBALS['db'], 'edit'); + $html = PMA_getHtmlForEditOrDeletePages($GLOBALS['db'], 'editPage'); } else if ($_REQUEST['dialog'] == 'delete') { - $html = PMA_getHtmlForEditOrDeletePages($GLOBALS['db'], 'delete'); + $html = PMA_getHtmlForEditOrDeletePages($GLOBALS['db'], 'deletePage'); } else if ($_REQUEST['dialog'] == 'save_as') { $html = PMA_getHtmlForPageSaveAs($GLOBALS['db']); } else if ($_REQUEST['dialog'] == 'export') { @@ -44,14 +40,14 @@ if (isset($_REQUEST['dialog'])) { if (isset($_REQUEST['operation'])) { - if ($_REQUEST['operation'] == 'delete') { + if ($_REQUEST['operation'] == 'deletePage') { $result = PMA_deletePage($_REQUEST['selected_page']); if ($result) { $response->isSuccess(true); } else { $response->isSuccess(false); } - } elseif ($_REQUEST['operation'] == 'save') { + } elseif ($_REQUEST['operation'] == 'savePage') { if ($_REQUEST['save_page'] == 'same') { $page = $_REQUEST['selected_page']; } elseif ($_REQUEST['save_page'] == 'new') { @@ -63,6 +59,31 @@ if (isset($_REQUEST['operation'])) { } else { $response->isSuccess(false); } + } elseif ($_REQUEST['operation'] == 'setDisplayField') { + PMA_saveDisplayField( + $_REQUEST['db'], $_REQUEST['table'], $_REQUEST['field'] + ); + $response->isSuccess(true); + } elseif ($_REQUEST['operation'] == 'addNewRelation') { + list($success, $message) = PMA_addNewRelation( + $_REQUEST['db'], + $_REQUEST['T1'], + $_REQUEST['F1'], + $_REQUEST['T2'], + $_REQUEST['F2'], + $_REQUEST['on_delete'], + $_REQUEST['on_update'] + ); + $response->isSuccess($success); + $response->addJSON($success ? 'message' : 'error', $message); + } elseif ($_REQUEST['operation'] == 'removeRelation') { + PMA_removeRelation( + $_REQUEST['T1'], + $_REQUEST['F1'], + $_REQUEST['T2'], + $_REQUEST['F2'] + ); + $response->isSuccess(true); } return; } else { @@ -86,12 +107,12 @@ $response = PMA_Response::getInstance(); $response->getFooter()->setMinimal(); $header = $response->getHeader(); $header->setBodyId('pmd_body'); + $scripts = $header->getScripts(); $scripts->addFile('jquery/jquery.fullscreen.js'); $scripts->addFile('pmd/designer_db.js'); $scripts->addFile('pmd/designer_objects.js'); $scripts->addFile('pmd/designer_page.js'); -$scripts->addFile('pmd/ajax.js'); $scripts->addFile('pmd/history.js'); $scripts->addFile('pmd/move.js'); $scripts->addFile('pmd/iecanvas.js', true); diff --git a/db_qbe.php b/db_qbe.php index fcf052f9ae..e703a0aca4 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -112,7 +112,7 @@ $db_qbe = new PMA_DBQbe($GLOBALS['db'], $savedSearchList, $savedSearch); * Displays the Query by example form */ if ($cfgRelation['pdfwork']) { - $url = 'pmd_general.php' . PMA_URL_getCommon( + $url = 'db_designer.php' . PMA_URL_getCommon( array_merge( $url_params, array('query' => 1) diff --git a/js/messages.php b/js/messages.php index 3f4d5933ad..d4d452d537 100644 --- a/js/messages.php +++ b/js/messages.php @@ -405,6 +405,7 @@ $js_messages['strEnterValidPageName'] = __('Please enter a valid page name'); $js_messages['strLeavingPage'] = __('Do you want to save the changes to the current page?'); $js_messages['strSuccessfulPageDelete'] = __('Successfully deleted the page'); $js_messages['strExportRelationalSchema'] = __('Export relational schema'); +$js_messages['strModificationSaved'] = __('Modifications have been saved'); /* Visual query builder (js/pmd/move.js) */ $js_messages['strAddOption'] = __('Add an option for column "%s".'); diff --git a/js/pmd/ajax.js b/js/pmd/ajax.js deleted file mode 100644 index ea764cd25f..0000000000 --- a/js/pmd/ajax.js +++ /dev/null @@ -1,60 +0,0 @@ -/* vim: set expandtab sw=4 ts=4 sts=4: */ -/** - * - * @package PhpMyAdmin-Designer - */ - -/** - * - */ -function PrintXML(data) -{ - var $root = $(data).find('root'); - if ($root.length === 0) { - // error - var myWin = window.open('', 'Report', 'width=400, height=250, resizable=1, scrollbars=1, status=1'); - var tmp = myWin.document; - tmp.write(data); - tmp.close(); - } else { - // success - if ($root.attr('act') == 'save_pos') { - PMA_ajaxShowMessage($root.attr('return')); - } else if ($root.attr('act') == 'relation_upd') { - PMA_ajaxShowMessage($root.attr('return')); - if ($root.attr('b') == '1') { - contr.splice($root.attr('K'), 1); - Re_load(); - } - } else if ($root.attr('act') == 'relation_new') { - PMA_ajaxShowMessage($root.attr('return')); - if ($root.attr('b') == '1') { - var i = contr.length; - var t1 = $root.attr('DB1') + '.' + $root.attr('T1'); - var f1 = $root.attr('F1'); - var t2 = $root.attr('DB2') + '.' + $root.attr('T2'); - var f2 = $root.attr('F2'); - contr[i] = []; - contr[i][''] = []; - contr[i][''][t2] = []; - contr[i][''][t2][f2] = []; - contr[i][''][t2][f2][0] = t1; - contr[i][''][t2][f2][1] = f1; - Re_load(); - } - } - } -} - -/** - * - */ -function makeRequest(url, parameters) -{ - var $msg = PMA_ajaxShowMessage(); - $.post(url, parameters, function (data) { - PMA_ajaxRemoveMessage($msg); - PrintXML(data); - }); - return true; -} diff --git a/js/pmd/move.js b/js/pmd/move.js index bce79e7ba5..067b795615 100644 --- a/js/pmd/move.js +++ b/js/pmd/move.js @@ -566,14 +566,24 @@ function Get_url_pos() function Save2(callback) { - _change = 0; if (pmd_tables_enabled) { - var poststr = 'IS_AJAX=1&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=1&selected_page=' + selected_page; + var poststr = '&operation=savePage&save_page=same&ajax_request=true'; + poststr += '&server=' + server + '&db=' + db + '&token=' + token + '&selected_page=' + selected_page; poststr += Get_url_pos(); - makeRequest('pmd_save_pos.php', poststr); - if (typeof callback !== 'undefined') { - callback(); - } + + var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); + $.post('db_designer.php', poststr, function (data) { + if (data.success === false) { + PMA_ajaxShowMessage(data.error, false); + } else { + PMA_ajaxRemoveMessage($msgbox); + PMA_ajaxShowMessage(PMA_messages.strModificationSaved); + _change = 0; + if (typeof callback !== 'undefined') { + callback(); + } + } + }); } else { var name = $("#page_name").html().trim(); Save_to_selected_page(db, selected_page, name, Get_url_pos(), function (page){ @@ -634,10 +644,10 @@ function Save3(callback) $(this).dialog('close'); }; - var $form = $('<form action="pmd_general.php" method="post" name="save_page" id="save_page" class="ajax"></form>') + var $form = $('<form action="db_designer.php" method="post" name="save_page" id="save_page" class="ajax"></form>') .append('<input type="hidden" name="db" value="' + db + '" />') .append('<input type="hidden" name="token" value="' + token + '" />') - .append('<input type="hidden" name="operation" value="save" />') + .append('<input type="hidden" name="operation" value="savePage" />') .append('<input type="hidden" name="save_page" value="new" />') .append('<label for="selected_value">' + PMA_messages.strPageName + '</label>:<input type="text" name="selected_value" />'); @@ -677,7 +687,7 @@ function Edit_pages() var $msgbox = PMA_ajaxShowMessage(); var params = 'ajax_request=true&dialog=edit&token=' + token + '&db=' + db; - $.get("pmd_general.php", params, function (data) { + $.get("db_designer.php", params, function (data) { if (data.success === false) { PMA_ajaxShowMessage(data.error, false); } else { @@ -703,6 +713,7 @@ function Edit_pages() }); // end $.get() }); } + // ----------------------------- DELETE PAGES --------------------------------------- function Delete_pages() { @@ -755,7 +766,7 @@ function Delete_pages() var $msgbox = PMA_ajaxShowMessage(); var params = 'ajax_request=true&dialog=delete&token=' + token + '&db=' + db; - $.get("pmd_general.php", params, function (data) { + $.get("db_designer.php", params, function (data) { if (data.success === false) { PMA_ajaxShowMessage(data.error, false); } else { @@ -853,7 +864,7 @@ function Save_as() var $msgbox = PMA_ajaxShowMessage(); var params = 'ajax_request=true&dialog=save_as&token=' + token + '&db=' + db; - $.get("pmd_general.php", params, function (data) { + $.get("db_designer.php", params, function (data) { if (data.success === false) { PMA_ajaxShowMessage(data.error, false); } else { @@ -931,7 +942,7 @@ function Export_pages() }; var $msgbox = PMA_ajaxShowMessage(); var params = 'ajax_request=true&dialog=export&token=' + token + '&db=' + db + '&selected_page=' + selected_page; - $.get("pmd_general.php", params, function (data) { + $.get("db_designer.php", params, function (data) { if (data.success === false) { PMA_ajaxShowMessage(data.error, false); } else { @@ -980,7 +991,7 @@ function Load_page(page) { if (page !== null) { param_page = '&page=' + page; } - $('<a href="pmd_general.php?db=' + db + '&token=' + token + param_page + '"></a>') + $('<a href="db_designer.php?db=' + db + '&token=' + token + param_page + '"></a>') .appendTo($('#page_content')) .click(); } else { @@ -1091,19 +1102,37 @@ function Click_field(T, f, PK) // table field document.getElementById('pmd_hint').innerHTML = ""; document.getElementById('pmd_hint').style.display = 'none'; document.getElementById('display_field_button').className = 'M_butt'; - makeRequest('pmd_display_field.php', 'T=' + T + '&F=' + f + '&server=' + server + '&db=' + db + '&token=' + token); + + var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); + $.post('db_designer.php', + {operation: 'setDisplayField', ajax_request: true, server: server, token: token, db: db, table: T, field: f}, + function (data) { + if (data.success === false) { + PMA_ajaxShowMessage(data.error, false); + } else { + PMA_ajaxRemoveMessage($msgbox); + PMA_ajaxShowMessage(PMA_messages.strModificationSaved); + } + }); } } function New_relation() { document.getElementById('layer_new_relation').style.display = 'none'; - link_relation += '&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=0'; + link_relation += '&server=' + server + '&db=' + db + '&token=' + token; link_relation += '&on_delete=' + document.getElementById('on_delete').value + '&on_update=' + document.getElementById('on_update').value; - link_relation += Get_url_pos(); + link_relation += '&operation=addNewRelation&ajax_request=true'; - //alert(link_relation); - makeRequest('pmd_relation_new.php', link_relation); + var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); + $.post('db_designer.php', link_relation, function (data) { + if (data.success === false) { + PMA_ajaxShowMessage(data.error, false); + } else { + PMA_ajaxRemoveMessage($msgbox); + Load_page(selected_page); + } + }); // end $.post() } //-------------------------- create tables ------------------------------------- @@ -1305,9 +1334,18 @@ function Canvas_click(id) function Upd_relation() { document.getElementById('layer_upd_relation').style.display = 'none'; - link_relation += '&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=0'; - link_relation += Get_url_pos(); - makeRequest('pmd_relation_upd.php', link_relation); + link_relation += '&server=' + server + '&db=' + db + '&token=' + token; + link_relation += '&operation=removeRelation&ajax_request=true'; + + var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); + $.post('db_designer.php', link_relation, function (data) { + if (data.success === false) { + PMA_ajaxShowMessage(data.error, false); + } else { + PMA_ajaxRemoveMessage($msgbox); + Load_page(selected_page); + } + }); // end $.post() } function VisibleTab(id, t_n) diff --git a/libraries/Menu.class.php b/libraries/Menu.class.php index caa3b7a297..824038ccb6 100644 --- a/libraries/Menu.class.php +++ b/libraries/Menu.class.php @@ -480,7 +480,7 @@ class PMA_Menu if (! $db_is_system_schema) { $tabs['designer']['text'] = __('Designer'); $tabs['designer']['icon'] = 'b_relations.png'; - $tabs['designer']['link'] = 'pmd_general.php'; + $tabs['designer']['link'] = 'db_designer.php'; $tabs['designer']['id'] = 'designer_tab'; } diff --git a/libraries/pmd_general.lib.php b/libraries/db_designer.lib.php index d8cb972825..1a59ce668b 100644 --- a/libraries/pmd_general.lib.php +++ b/libraries/db_designer.lib.php @@ -1,15 +1,181 @@ <?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** - * phpMyAdmin designer general code + * Set of functions related to designer * - * @package PhpMyAdmin-Designer + * @package PhpMyAdmin */ - if (! defined('PHPMYADMIN')) { exit; } +require_once 'libraries/relation.lib.php'; + +/** + * Function to get html for displaying the page edit/delete form + * + * @param string $db databasae name + * @param string $operation 'edit' or 'delete' depending on the operation + * + * @return string html content + */ +function PMA_getHtmlForEditOrDeletePages($db, $operation) +{ + $cfgRelation = PMA_getRelationsParam(); + $html = '<form action="db_designer.php" method="post"' + . ' name="edit_delete_pages" id="edit_delete_pages" class="ajax">'; + $html .= PMA_URL_getHiddenInputs($db); + $html .= '<fieldset id="page_edit_delete_options">'; + $html .= '<input type="hidden" name="operation" value="' . $operation . '" />'; + $html .= '<label for="selected_page">'; + if ($operation == 'edit') { + $html .= __("Page to open"); + } else { + $html .= __("Page to delete"); + } + $html .= ': </label>'; + $html .= '<select name="selected_page" id="selected_page">'; + $html .= '<option value="0">-- ' . __('Select page') . ' --</option>'; + if ($cfgRelation['pdfwork']) { + $pages = PMA_getPageIdsAndNames($db); + foreach ($pages as $nr => $desc) { + $html .= '<option value="' . $nr . '">'; + $html .= htmlspecialchars($desc) . '</option>'; + } + } + $html .= '</select>'; + $html .= '</fieldset>'; + $html .= '</form>'; + return $html; +} + +/** + * Function to get html for displaying the page save as form + * + * @param string $db databasae name + * + * @return string html content + */ +function PMA_getHtmlForPageSaveAs($db) +{ + $cfgRelation = PMA_getRelationsParam(); + $choices = array( + 'same' => __('Save to selected page'), + 'new' => __('Create a page and save to it') + ); + + $html = '<form action="db_designer.php" method="post"' + . ' name="save_as_pages" id="save_as_pages" class="ajax">'; + $html .= PMA_URL_getHiddenInputs($db); + $html .= '<fieldset id="page_save_as_options">'; + $html .= '<table><tbody>'; + + $html .= '<tr>'; + $html .= '<td>'; + $html .= '<input type="hidden" name="operation" value="savePage" />'; + $html .= '<select name="selected_page" id="selected_page">'; + $html .= '<option value="0">-- ' . __('Select page') . ' --</option>'; + + if ($cfgRelation['pdfwork']) { + $pages = PMA_getPageIdsAndNames($db); + foreach ($pages as $nr => $desc) { + $html .= '<option value="' . $nr . '">'; + $html .= htmlspecialchars($desc) . '</option>'; + } + } + $html .= '</select>'; + $html .= '</td>'; + $html .= '</tr>'; + + $html .= '<tr>'; + $html .= '<td>'; + $html .= PMA_Util::getRadioFields('save_page', $choices, 'same', true); + $html .= '</td>'; + $html .= '</tr>'; + + $html .= '<tr>'; + $html .= '<td>'; + $html .= '<label for="selected_value">' . __('New page name') . '</label>'; + $html .= '<input type="text" name="selected_value" id="selected_value" />'; + $html .= '</td>'; + $html .= '</tr>'; + + $html .= '</tbody></table>'; + $html .= '</fieldset>'; + $html .= '</form>'; + + return $html; +} + +/** + * Retrieve IDs and names of schema pages + * + * @param string $db database name + * + * @return array array of schema page id and names + */ +function PMA_getPageIdsAndNames($db) +{ + $cfgRelation = PMA_getRelationsParam(); + $page_query = "SELECT `page_nr`, `page_descr` FROM " + . PMA_Util::backquote($cfgRelation['db']) . "." + . PMA_Util::backquote($cfgRelation['pdf_pages']) + . " WHERE db_name = '" . PMA_Util::sqlAddSlashes($db) . "'" + . " ORDER BY `page_nr`"; + $page_rs = PMA_queryAsControlUser( + $page_query, false, PMA_DatabaseInterface::QUERY_STORE + ); + + $result = array(); + while ($curr_page = $GLOBALS['dbi']->fetchAssoc($page_rs)) { + $result[$curr_page['page_nr']] = $curr_page['page_descr']; + } + return $result; +} + +/** + * Function to get html for displaying the schema export + * + * @param string $db database name + * @param int $page the page to be exported + * + * @return string + */ +function PMA_getHtmlForSchemaExport($db, $page) +{ + /* Scan for schema plugins */ + $export_list = PMA_getPlugins( + "schema", + 'libraries/plugins/schema/', + null + ); + + /* Fail if we didn't find any schema plugin */ + if (empty($export_list)) { + return PMA_Message::error( + __('Could not load schema plugins, please check your installation!') + )->getDisplay(); + } + + + $htmlString = '<form method="post" action="schema_export.php"' + . ' class="disableAjax" id="id_export_pages">'; + $htmlString .= '<fieldset>'; + $htmlString .= PMA_URL_getHiddenInputs($db); + $htmlString .= '<label>' . __('Select Export Relational Type') + . '</label><br />'; + $htmlString .= PMA_pluginGetChoice( + 'Schema', 'export_type', $export_list, 'format' + ); + $htmlString .= '<input type="hidden" name="chpage"' + . ' value="' . htmlspecialchars($page) . '" />'; + $htmlString .= PMA_pluginGetOptions('Schema', $export_list); + $htmlString .= '</fieldset>'; + $htmlString .= '</form>'; + + return $htmlString; +} + /** * Returns HTML for including some variable to be accessed by JavaScript * @@ -86,7 +252,7 @@ function PMA_getDesignerPageTopMenu($selected_page) $html .= 'class="M_butt hide" target="_self">'; $html .= '<img title="' . __('Exit fullscreen') . '" alt="" '; $html .= 'src="' . $_SESSION['PMA_Theme']->getImgPath('pmd/exitFullscreen.png') - . '" />'; + . '" />'; $html .= '</a>'; $html .= '<img class="M_bord" alt="" '; @@ -275,7 +441,7 @@ function PMA_getHTMLTableList($tab_pos, $display_page) $html .= 'return false">'; $html .= '<img title="' . __('Hide/Show all') . '" alt="v" id="key_HS_all" '; $html .= 'src="' . $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow1.png') - . '" />'; + . '" />'; $html .= '</a>'; $html .= '<a href="#" class="M_butt" target="_self" '; @@ -284,7 +450,7 @@ function PMA_getHTMLTableList($tab_pos, $display_page) $html .= '<img alt="v" id="key_HS" '; $html .= 'title="' . __('Hide/Show Tables with no relation') . '"'; $html .= 'src="' . $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow2.png') - . '" />'; + . '" />'; $html .= '</a>'; $html .= '</div>'; @@ -464,8 +630,8 @@ function PMA_getDatabaseTables( ); for ( $j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); - $j < $id_cnt; - $j++ + $j < $id_cnt; + $j++ ) { $html .= '<tr id="id_tr_' . $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . '.' @@ -1192,4 +1358,4 @@ function PMA_getCacheImages() return $html; } - ?> +?>
\ No newline at end of file diff --git a/libraries/designer.lib.php b/libraries/designer.lib.php deleted file mode 100644 index 36a2a6a40f..0000000000 --- a/libraries/designer.lib.php +++ /dev/null @@ -1,178 +0,0 @@ -<?php -/* vim: set expandtab sw=4 ts=4 sts=4: */ -/** - * Set of functions related to designer - * - * @package PhpMyAdmin - */ -if (! defined('PHPMYADMIN')) { - exit; -} - -require_once 'libraries/relation.lib.php'; - -/** - * Function to get html for displaying the page edit/delete form - * - * @param string $db databasae name - * @param string $operation 'edit' or 'delete' depending on the operation - * - * @return string html content - */ -function PMA_getHtmlForEditOrDeletePages($db, $operation) -{ - $cfgRelation = PMA_getRelationsParam(); - $html = '<form action="pmd_general.php" method="post"' - . ' name="edit_delete_pages" id="edit_delete_pages" class="ajax">'; - $html .= PMA_URL_getHiddenInputs($db); - $html .= '<fieldset id="page_edit_delete_options">'; - $html .= '<input type="hidden" name="operation" value="' . $operation . '" />'; - $html .= '<label for="selected_page">'; - if ($operation == 'edit') { - $html .= __("Page to open"); - } else { - $html .= __("Page to delete"); - } - $html .= ': </label>'; - $html .= '<select name="selected_page" id="selected_page">'; - $html .= '<option value="0">-- ' . __('Select page') . ' --</option>'; - if ($cfgRelation['pdfwork']) { - $pages = PMA_getPageIdsAndNames($db); - foreach ($pages as $nr => $desc) { - $html .= '<option value="' . $nr . '">'; - $html .= htmlspecialchars($desc) . '</option>'; - } - } - $html .= '</select>'; - $html .= '</fieldset>'; - $html .= '</form>'; - return $html; -} - -/** - * Function to get html for displaying the page save as form - * - * @param string $db databasae name - * - * @return string html content - */ -function PMA_getHtmlForPageSaveAs($db) -{ - $cfgRelation = PMA_getRelationsParam(); - $choices = array( - 'same' => __('Save to selected page'), - 'new' => __('Create a page and save to it') - ); - - $html = '<form action="pmd_general.php" method="post"' - . ' name="save_as_pages" id="save_as_pages" class="ajax">'; - $html .= PMA_URL_getHiddenInputs($db); - $html .= '<fieldset id="page_save_as_options">'; - $html .= '<table><tbody>'; - - $html .= '<tr>'; - $html .= '<td>'; - $html .= '<input type="hidden" name="operation" value="save" />'; - $html .= '<select name="selected_page" id="selected_page">'; - $html .= '<option value="0">-- ' . __('Select page') . ' --</option>'; - - if ($cfgRelation['pdfwork']) { - $pages = PMA_getPageIdsAndNames($db); - foreach ($pages as $nr => $desc) { - $html .= '<option value="' . $nr . '">'; - $html .= htmlspecialchars($desc) . '</option>'; - } - } - $html .= '</select>'; - $html .= '</td>'; - $html .= '</tr>'; - - $html .= '<tr>'; - $html .= '<td>'; - $html .= PMA_Util::getRadioFields('save_page', $choices, 'same', true); - $html .= '</td>'; - $html .= '</tr>'; - - $html .= '<tr>'; - $html .= '<td>'; - $html .= '<label for="selected_value">' . __('New page name') . '</label>'; - $html .= '<input type="text" name="selected_value" id="selected_value" />'; - $html .= '</td>'; - $html .= '</tr>'; - - $html .= '</tbody></table>'; - $html .= '</fieldset>'; - $html .= '</form>'; - - return $html; -} - -/** - * Retrieve IDs and names of schema pages - * - * @param string $db database name - * - * @return array array of schema page id and names - */ -function PMA_getPageIdsAndNames($db) -{ - $cfgRelation = PMA_getRelationsParam(); - $page_query = "SELECT `page_nr`, `page_descr` FROM " - . PMA_Util::backquote($cfgRelation['db']) . "." - . PMA_Util::backquote($cfgRelation['pdf_pages']) - . " WHERE db_name = '" . PMA_Util::sqlAddSlashes($db) . "'" - . " ORDER BY `page_nr`"; - $page_rs = PMA_queryAsControlUser( - $page_query, false, PMA_DatabaseInterface::QUERY_STORE - ); - - $result = array(); - while ($curr_page = $GLOBALS['dbi']->fetchAssoc($page_rs)) { - $result[$curr_page['page_nr']] = $curr_page['page_descr']; - } - return $result; -} - -/** - * Function to get html for displaying the schema export - * - * @param string $db database name - * @param int $page the page to be exported - * - * @return string - */ -function PMA_getHtmlForSchemaExport($db, $page) -{ - /* Scan for schema plugins */ - $export_list = PMA_getPlugins( - "schema", - 'libraries/plugins/schema/', - null - ); - - /* Fail if we didn't find any schema plugin */ - if (empty($export_list)) { - return PMA_Message::error( - __('Could not load schema plugins, please check your installation!') - )->getDisplay(); - } - - - $htmlString = '<form method="post" action="schema_export.php"' - . ' class="disableAjax" id="id_export_pages">'; - $htmlString .= '<fieldset>'; - $htmlString .= PMA_URL_getHiddenInputs($db); - $htmlString .= '<label>' . __('Select Export Relational Type') - . '</label><br />'; - $htmlString .= PMA_pluginGetChoice( - 'Schema', 'export_type', $export_list, 'format' - ); - $htmlString .= '<input type="hidden" name="chpage"' - . ' value="' . htmlspecialchars($page) . '" />'; - $htmlString .= PMA_pluginGetOptions('Schema', $export_list); - $htmlString .= '</fieldset>'; - $htmlString .= '</form>'; - - return $htmlString; -} -?>
\ No newline at end of file diff --git a/libraries/pmd_common.php b/libraries/pmd_common.php index 3790bb3474..7789795f77 100644 --- a/libraries/pmd_common.php +++ b/libraries/pmd_common.php @@ -429,25 +429,199 @@ function PMA_saveTablePositions($pg) return $res; } +/** + * Saves the display field for a table. + * + * @param string $db database name + * @param string $table table name + * @param string $field display field name + * + * @return void + */ +function PMA_saveDisplayField($db, $table, $field) +{ + $cfgRelation = PMA_getRelationsParam(); + if (!$cfgRelation['displaywork']) { + return false; + } + + $disp = PMA_getDisplayField($db, $table); + if ($disp && $disp === $field) { + $field = ''; + } + + include_once 'libraries/tbl_relation.lib.php'; + PMA_handleUpdateForDisplayField($disp, $field, $db, $table, $cfgRelation); +} + +/** + * Adds a new foreign relation + * + * @param string $db database name + * @param string $T1 foreign table + * @param string $F1 foreign field + * @param string $T2 master table + * @param string $F2 master field + * @param string $on_delete on delete action + * @param string $on_update on updaet action + * + * @return array array of success/failure and message + */ +function PMA_addNewRelation($db, $T1, $F1, $T2, $F2, $on_delete, $on_update) +{ + $tables = $GLOBALS['dbi']->getTablesFull($db, $T1); + $type_T1 = strtoupper($tables[$T1]['ENGINE']); + $tables = $GLOBALS['dbi']->getTablesFull($db, $T2); + $type_T2 = strtoupper($tables[$T2]['ENGINE']); + + // native foreign key + if (PMA_Util::isForeignKeySupported($type_T1) + && PMA_Util::isForeignKeySupported($type_T2) + && $type_T1 == $type_T2 + ) { + // relation exists? + $existrel_foreign = PMA_getForeigners($db, $T2, '', 'foreign'); + $foreigner = PMA_searchColumnInForeigners($existrel_foreign, $F2); + if ($foreigner + && isset($foreigner['constraint']) + ) { + return array(false, __('Error: relation already exists.')); + } + // note: in InnoDB, the index does not requires to be on a PRIMARY + // or UNIQUE key + // improve: check all other requirements for InnoDB relations + $result = $GLOBALS['dbi']->query( + 'SHOW INDEX FROM ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($T1) . ';' + ); + + // will be use to emphasis prim. keys in the table view + $index_array1 = array(); + while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { + $index_array1[$row['Column_name']] = 1; + } + $GLOBALS['dbi']->freeResult($result); + + $result = $GLOBALS['dbi']->query( + 'SHOW INDEX FROM ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($T2) . ';' + ); + // will be used to emphasis prim. keys in the table view + $index_array2 = array(); + while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { + $index_array2[$row['Column_name']] = 1; + } + $GLOBALS['dbi']->freeResult($result); + + if (! empty($index_array1[$F1]) && ! empty($index_array2[$F2])) { + $upd_query = 'ALTER TABLE ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($T2) + . ' ADD FOREIGN KEY (' + . PMA_Util::backquote($F2) . ')' + . ' REFERENCES ' + . PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($T1) . '(' + . PMA_Util::backquote($F1) . ')'; + + if ($on_delete != 'nix') { + $upd_query .= ' ON DELETE ' . $on_delete; + } + if ($on_update != 'nix') { + $upd_query .= ' ON UPDATE ' . $on_update; + } + $upd_query .= ';'; + if ($GLOBALS['dbi']->tryQuery($upd_query)) { + return array(true, __('FOREIGN KEY relation has been added.')); + } + return array(false, __('Error: Relation could not be added!')); + } + } else { // internal (pmadb) relation + if ($GLOBALS['cfgRelation']['relwork'] == false) { + return array(false, __('Error: Relational features are disabled!')); + } else { + // no need to recheck if the keys are primary or unique at this point, + // this was checked on the interface part + + $q = 'INSERT INTO ' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) + . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['relation']) + . '(master_db, master_table, master_field,' + . 'foreign_db, foreign_table, foreign_field)' + . ' values(' + . '\'' . PMA_Util::sqlAddSlashes($db) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($T2) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($F2) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($db) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($T1) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($F1) . '\')'; + + if (PMA_queryAsControlUser($q, false, PMA_DatabaseInterface::QUERY_STORE)) { + return array(true, __('Internal relation has been added.')); + } else { + return array(false, __('Error: Relation could not be added!')); + } + } + } +} /** - * Prepares XML output for js/pmd/ajax.js to display a message + * Removes a foreign relation * - * @param string $b b attribute value - * @param string $ret Return attribute value + * @param string $T1 foreign db.table + * @param string $F1 foreign field + * @param string $T2 master db.table + * @param string $F2 master field * * @return void */ -function PMA_returnUpd($b, $ret) +function PMA_removeRelation($T1, $F1, $T2, $F2) { - // not sure where this was defined... - global $K; - - header("Content-Type: text/xml; charset=utf-8"); - header("Cache-Control: no-cache"); - die( - '<root act="relation_upd" return="' . $ret . '" b="' - . $b . '" K="' . $K . '"></root>' - ); + list($DB1, $T1) = explode(".", $T1); + list($DB2, $T2) = explode(".", $T2); + + $tables = $GLOBALS['dbi']->getTablesFull($DB1, $T1); + $type_T1 = strtoupper($tables[$T1]['ENGINE']); + $tables = $GLOBALS['dbi']->getTablesFull($DB2, $T2); + $type_T2 = strtoupper($tables[$T2]['ENGINE']); + + $try_to_delete_internal_relation = false; + + if (PMA_Util::isForeignKeySupported($type_T1) + && PMA_Util::isForeignKeySupported($type_T2) + && $type_T1 == $type_T2 + ) { + // InnoDB + $existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign'); + $foreigner = PMA_searchColumnInForeigners($existrel_foreign, $F2); + + if (isset($foreigner['constraint'])) { + $upd_query = 'ALTER TABLE ' . PMA_Util::backquote($DB2) + . '.' . PMA_Util::backquote($T2) . ' DROP FOREIGN KEY ' + . PMA_Util::backquote($foreigner['constraint']) + . ';'; + $upd_rs = $GLOBALS['dbi']->query($upd_query); + } else { + // there can be an internal relation even if InnoDB + $try_to_delete_internal_relation = true; + } + } else { + $try_to_delete_internal_relation = true; + } + if ($try_to_delete_internal_relation) { + // internal relations + PMA_queryAsControlUser( + 'DELETE FROM ' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . $GLOBALS['cfgRelation']['relation'] . ' WHERE ' + . 'master_db = \'' . PMA_Util::sqlAddSlashes($DB2) . '\'' + . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($T2) . '\'' + . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($F2) . '\'' + . ' AND foreign_db = \'' . PMA_Util::sqlAddSlashes($DB1) . '\'' + . ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($T1) . '\'' + . ' AND foreign_field = \'' . PMA_Util::sqlAddSlashes($F1) . '\'', + false, + PMA_DatabaseInterface::QUERY_STORE + ); + } } ?> diff --git a/libraries/tbl_relation.lib.php b/libraries/tbl_relation.lib.php index 6802f30f58..399aae74cc 100644 --- a/libraries/tbl_relation.lib.php +++ b/libraries/tbl_relation.lib.php @@ -767,7 +767,7 @@ function PMA_sendHtmlForTableDropdownList() /** * Function to handle update for display field * - * @param string $disp field name + * @param string $disp current display field * @param string $display_field display field * @param string $db current database * @param string $table current table @@ -789,7 +789,7 @@ function PMA_handleUpdateForDisplayField($disp, $display_field, $db, $table, /** * Function to get display query for handlingdisplay update * - * @param string $disp field name + * @param string $disp current display field * @param string $display_field display field * @param string $db current database * @param string $table current table diff --git a/pmd_display_field.php b/pmd_display_field.php deleted file mode 100644 index 8efe96f057..0000000000 --- a/pmd_display_field.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/* vim: set expandtab sw=4 ts=4 sts=4: */ -/** - * Handles the display field - * - * @package PhpMyAdmin-Designer - */ - -/** - * - */ -require_once './libraries/common.inc.php'; - -PMA_Response::getInstance()->disable(); - -require_once 'libraries/pmd_common.php'; - -$table = $_POST['T']; -$display_field = $_POST['F']; - -if ($cfgRelation['displaywork']) { - - $disp = PMA_getDisplayField($db, $table); - if ($disp) { - if ($display_field != $disp) { - $upd_query = 'UPDATE ' - . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) - . '.' - . PMA_Util::backquote($cfgRelation['table_info']) - . ' SET display_field = \'' - . PMA_Util::sqlAddSlashes($display_field) . '\'' - . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; - } else { - $upd_query = 'DELETE FROM ' - . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) - . '.' - . PMA_Util::backquote($cfgRelation['table_info']) - . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; - } - } elseif ($display_field != '') { - $upd_query = 'INSERT INTO ' - . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) - . '.' - . PMA_Util::backquote($cfgRelation['table_info']) - . '(db_name, table_name, display_field) ' - . ' VALUES(' - . '\'' . PMA_Util::sqlAddSlashes($db) . '\',' - . '\'' . PMA_Util::sqlAddSlashes($table) . '\',' - . '\'' . PMA_Util::sqlAddSlashes($display_field) . '\')'; - } - - if (isset($upd_query)) { - $upd_rs = PMA_queryAsControlUser($upd_query); - } -} // end if - -header("Content-Type: text/xml; charset=utf-8"); -header("Cache-Control: no-cache"); -die("<root act='save_pos' return='" - . __('Modifications have been saved') . "'></root>"); -?> diff --git a/pmd_relation_new.php b/pmd_relation_new.php deleted file mode 100644 index 4c6c611399..0000000000 --- a/pmd_relation_new.php +++ /dev/null @@ -1,134 +0,0 @@ -<?php -/* vim: set expandtab sw=4 ts=4 sts=4: */ -/** - * PMD handler for creating new relation - * - * @package PhpMyAdmin-Designer - */ - -/** - * - */ -require_once './libraries/common.inc.php'; - -PMA_Response::getInstance()->disable(); - -require_once 'libraries/pmd_common.php'; -$die_save_pos = 0; -require_once 'pmd_save_pos.php'; -extract($_POST, EXTR_SKIP); - -$tables = $GLOBALS['dbi']->getTablesFull($db, $T1); -$type_T1 = strtoupper($tables[$T1]['ENGINE']); -$tables = $GLOBALS['dbi']->getTablesFull($db, $T2); -$type_T2 = strtoupper($tables[$T2]['ENGINE']); - -// native foreign key -if (PMA_Util::isForeignKeySupported($type_T1) - && PMA_Util::isForeignKeySupported($type_T2) - && $type_T1 == $type_T2 -) { - // relation exists? - $existrel_foreign = PMA_getForeigners($db, $T2, '', 'foreign'); - $foreigner = PMA_searchColumnInForeigners($existrel_foreign, $F2); - if ($foreigner - && isset($foreigner['constraint']) - ) { - PMD_Return_new(0, __('Error: relation already exists.')); - } - // note: in InnoDB, the index does not requires to be on a PRIMARY - // or UNIQUE key - // improve: check all other requirements for InnoDB relations - $result = $GLOBALS['dbi']->query( - 'SHOW INDEX FROM ' . PMA_Util::backquote($db) - . '.' . PMA_Util::backquote($T1) . ';' - ); - $index_array1 = array(); // will be use to emphasis prim. keys in the table view - while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { - $index_array1[$row['Column_name']] = 1; - } - $GLOBALS['dbi']->freeResult($result); - - $result = $GLOBALS['dbi']->query( - 'SHOW INDEX FROM ' . PMA_Util::backquote($db) - . '.' . PMA_Util::backquote($T2) . ';' - ); - // will be used to emphasis prim. keys in the table view - $index_array2 = array(); - while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { - $index_array2[$row['Column_name']] = 1; - } - $GLOBALS['dbi']->freeResult($result); - - if (! empty($index_array1[$F1]) && ! empty($index_array2[$F2])) { - $upd_query = 'ALTER TABLE ' . PMA_Util::backquote($db) - . '.' . PMA_Util::backquote($T2) - . ' ADD FOREIGN KEY (' - . PMA_Util::backquote($F2) . ')' - . ' REFERENCES ' - . PMA_Util::backquote($db) . '.' - . PMA_Util::backquote($T1) . '(' - . PMA_Util::backquote($F1) . ')'; - - if ($on_delete != 'nix') { - $upd_query .= ' ON DELETE ' . $on_delete; - } - if ($on_update != 'nix') { - $upd_query .= ' ON UPDATE ' . $on_update; - } - $upd_query .= ';'; - $GLOBALS['dbi']->tryQuery($upd_query) - || PMD_Return_new(0, __('Error: Relation could not be added!')); - PMD_Return_new(1, __('FOREIGN KEY relation has been added.')); - } -} else { // internal (pmadb) relation - if ($GLOBALS['cfgRelation']['relwork'] == false) { - PMD_Return_new(0, __('Error: Relational features are disabled!')); - } else { - // no need to recheck if the keys are primary or unique at this point, - // this was checked on the interface part - - $q = 'INSERT INTO ' - . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) - . '.' . PMA_Util::backquote($cfgRelation['relation']) - . '(master_db, master_table, master_field,' - . 'foreign_db, foreign_table, foreign_field)' - . ' values(' - . '\'' . PMA_Util::sqlAddSlashes($db) . '\', ' - . '\'' . PMA_Util::sqlAddSlashes($T2) . '\', ' - . '\'' . PMA_Util::sqlAddSlashes($F2) . '\', ' - . '\'' . PMA_Util::sqlAddSlashes($db) . '\', ' - . '\'' . PMA_Util::sqlAddSlashes($T1) . '\',' - . '\'' . PMA_Util::sqlAddSlashes($F1) . '\')'; - - if (PMA_queryAsControlUser($q, false, PMA_DatabaseInterface::QUERY_STORE)) { - PMD_Return_new(1, __('Internal relation has been added.')); - } else { - PMD_Return_new(0, __('Error: Relation could not be added!')); - } - } -} - -/** - * Send xml - * - * @param string $b Value of attribute "b" - * @param string $ret Value of attribute "return" - * - * @return void - */ -function PMD_Return_new($b,$ret) -{ - global $db,$T1,$F1,$T2,$F2; - header("Content-Type: text/xml; charset=utf-8"); - header("Cache-Control: no-cache"); - die('<root act="relation_new" return="' . $ret . '" b="' . $b . - '" DB1="' . urlencode($db) . - '" T1="' . urlencode($T1) . - '" F1="' . urlencode($F1) . - '" DB2="' . urlencode($db) . - '" T2="' . urlencode($T2) . - '" F2="' . urlencode($F2) . - '"></root>'); -} -?> diff --git a/pmd_relation_upd.php b/pmd_relation_upd.php deleted file mode 100644 index 5e5b6f52dd..0000000000 --- a/pmd_relation_upd.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/* vim: set expandtab sw=4 ts=4 sts=4: */ -/** - * PMD relation update handler - * - * @package PhpMyAdmin-Designer - */ - -/** - * - */ -require_once './libraries/common.inc.php'; - -PMA_Response::getInstance()->disable(); - -require_once 'libraries/pmd_common.php'; -extract($_POST, EXTR_SKIP); -extract($_GET, EXTR_SKIP); -$die_save_pos = 0; -require_once 'pmd_save_pos.php'; -list($DB1, $T1) = explode(".", $T1); -list($DB2, $T2) = explode(".", $T2); - -$tables = $GLOBALS['dbi']->getTablesFull($db, $T1); -$type_T1 = strtoupper($tables[$T1]['ENGINE']); -$tables = $GLOBALS['dbi']->getTablesFull($db, $T2); -$type_T2 = strtoupper($tables[$T2]['ENGINE']); - -$try_to_delete_internal_relation = false; - -if (PMA_Util::isForeignKeySupported($type_T1) - && PMA_Util::isForeignKeySupported($type_T2) - && $type_T1 == $type_T2 -) { - // InnoDB - $existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign'); - $foreigner = PMA_searchColumnInForeigners($existrel_foreign, $F2); - - if (isset($foreigner['constraint'])) { - $upd_query = 'ALTER TABLE ' . PMA_Util::backquote($DB2) - . '.' . PMA_Util::backquote($T2) . ' DROP FOREIGN KEY ' - . PMA_Util::backquote($foreigner['constraint']) - . ';'; - $upd_rs = $GLOBALS['dbi']->query($upd_query); - } else { - // there can be an internal relation even if InnoDB - $try_to_delete_internal_relation = true; - } -} else { - $try_to_delete_internal_relation = true; -} -if ($try_to_delete_internal_relation) { - // internal relations - PMA_queryAsControlUser( - 'DELETE FROM ' - . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' - . $cfg['Server']['relation'] . ' WHERE ' - . 'master_db = \'' . PMA_Util::sqlAddSlashes($DB2) . '\'' - . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($T2) . '\'' - . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($F2) . '\'' - . ' AND foreign_db = \'' . PMA_Util::sqlAddSlashes($DB1) . '\'' - . ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($T1) . '\'' - . ' AND foreign_field = \'' . PMA_Util::sqlAddSlashes($F1) . '\'', - false, - PMA_DatabaseInterface::QUERY_STORE - ); -} -PMA_returnUpd(1, __('Relation deleted')); - -?> diff --git a/pmd_save_pos.php b/pmd_save_pos.php deleted file mode 100644 index a911ca4d63..0000000000 --- a/pmd_save_pos.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/* vim: set expandtab sw=4 ts=4 sts=4: */ -/** - * Save handler for PMD - * - * @package PhpMyAdmin-Designer - */ - -/** - * - */ -require_once './libraries/common.inc.php'; -require_once 'libraries/pmd_common.php'; - -$cfgRelation = PMA_getRelationsParam(); - -if (! $cfgRelation['pdfwork']) { - PMD_errorSave(); -} - -/** - * Sets globals from $_POST - */ -$post_params = array( - 'die_save_pos', -); - -foreach ($post_params as $one_post_param) { - if (isset($_POST[$one_post_param])) { - $GLOBALS[$one_post_param] = $_POST[$one_post_param]; - } -} - -if (isset($_REQUEST['selected_page'])) { - PMA_saveTablePositions($_REQUEST['selected_page']); -} - -/** - * Error handler - * - * @return void - */ -function PMD_errorSave() -{ - global $die_save_pos; // if this file included - if (! empty($die_save_pos)) { - header("Content-Type: text/xml; charset=utf-8"); - header("Cache-Control: no-cache"); - die( - '<root act="save_pos" return="' - . __('Error saving coordinates for Designer.') - . '"></root>' - ); - } -} - -if (! empty($die_save_pos)) { - header("Content-Type: text/xml; charset=utf-8"); - header("Cache-Control: no-cache"); - echo '<root act="save_pos" return="' - . __('Modifications have been saved') . '"></root>'; -} -?> diff --git a/test/libraries/PMA_designer_test.php b/test/libraries/PMA_designer_test.php index 1c1a154608..a6f4cf0b80 100644 --- a/test/libraries/PMA_designer_test.php +++ b/test/libraries/PMA_designer_test.php @@ -1,13 +1,13 @@ <?php /** - * Tests for libraries/designer.lib.php + * Tests for libraries/db_designer.lib.php * * @package PhpMyAdmin-test */ /* * Include to test. */ -require_once 'libraries/designer.lib.php'; +require_once 'libraries/db_designer.lib.php'; require_once 'libraries/database_interface.inc.php'; require_once 'libraries/Util.class.php'; @@ -16,7 +16,7 @@ require_once 'libraries/url_generating.lib.php'; require_once 'libraries/relation.lib.php'; /** - * Tests for libraries/designer.lib.php + * Tests for libraries/db_designer.lib.php * * @package PhpMyAdmin-test */ @@ -151,7 +151,7 @@ class PMA_DesginerTest extends PHPUnit_Framework_TestCase $result = PMA_getHtmlForPageSaveAs($db); $this->assertContains( - '<input type="hidden" name="operation" value="save" />', + '<input type="hidden" name="operation" value="savePage" />', $result ); $this->assertContains( |