diff options
author | Michal Čihař <mcihar@suse.cz> | 2012-11-12 12:48:05 +0400 |
---|---|---|
committer | Michal Čihař <mcihar@suse.cz> | 2012-11-12 12:48:05 +0400 |
commit | 61a601fc735c0596aefb1544f1f3a704a19c61d5 (patch) | |
tree | d9957ce249aaf285d606609e5f8d779e99d09f6d | |
parent | b07a6c4ee2e3d622d77fd0faf82d75bbe9e05a38 (diff) |
Implement linking to new documentation
26 files changed, 86 insertions, 55 deletions
diff --git a/import.php b/import.php index f84268b68c..5657c72a92 100644 --- a/import.php +++ b/import.php @@ -92,7 +92,7 @@ if ($_POST == array() && $_GET == array()) { $message = PMA_Message::error( __('You probably tried to upload a file that is too large. Please refer to %sdocumentation%s for a workaround for this limit.') ); - $message->addParam('[doc@faq1_16]'); + $message->addParam('[doc@faq1-16]'); $message->addParam('[/doc]'); // so we can obtain the message @@ -329,7 +329,7 @@ PMA_printListItem( PMA_printListItem( __('Documentation'), 'li_pma_docs', - 'Documentation.html', + PMA_Util::getDocuLink('index'), null, '_blank' ); diff --git a/libraries/RecentTable.class.php b/libraries/RecentTable.class.php index cb447f818a..9468eeb1c0 100644 --- a/libraries/RecentTable.class.php +++ b/libraries/RecentTable.class.php @@ -14,7 +14,7 @@ require_once './libraries/Message.class.php'; * Handles the recently used tables. * * @TODO Change the release version in table pma_recent - * (#recent in Documentation.html) + * (#recent in documentation) * * @package PhpMyAdmin */ diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 377419d548..8433b4c753 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -1393,7 +1393,7 @@ class PMA_Table $message = PMA_Message::error( sprintf( __('Failed to cleanup table UI preferences (see $cfg[\'Servers\'][$i][\'MaxTableUiprefs\'] %s)'), - PMA_Util::showDocu('cfg_Servers_MaxTableUiprefs') + PMA_Util::showDocu('config', 'cfg_Servers_MaxTableUiprefs') ) ); $message->addMessage('<br /><br />'); diff --git a/libraries/Util.class.php b/libraries/Util.class.php index ae51f1c915..ad9055f12e 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -520,17 +520,43 @@ class PMA_Util } // end of the 'showMySQLDocu()' function /** + * Returns link to documentation. + * + * @param string $page Page in documentation + * @param string $anchor Optional anchor in page + * + * @return string URL + */ + public static function getDocuLink($page, $anchor = '') + { + /* Construct base URL */ + $url = $page . '.html'; + if (!empty($anchor)) { + $url .= '#' . $anchor; + } + + /* Check if we have built local documentation */ + if (file_exists('doc/html/index.html')) { + return './doc/html/' . $url; + } else { + /* TODO: Should link to correct branch for released versions */ + return PMA_linkURL('https://phpmyadmin.readthedocs.org/en/latest/' . $url); + } + } + + /** * Displays a link to the phpMyAdmin documentation * - * @param string $anchor anchor in documentation + * @param string $page Page in documentation + * @param string $anchor Optional anchor in page * * @return string the html link * * @access public */ - public static function showDocu($anchor) + public static function showDocu($page, $anchor = '') { - return self::showDocLink('Documentation.html#' . $anchor); + return self::showDocLink(self::getDocuLink($page, $anchor)); } // end of the 'showDocu()' function /** @@ -2099,7 +2125,7 @@ class PMA_Util $error_message .= $reported_script_name . ': ' . __('Missing parameter:') . ' ' . $param - . self::showDocu('faqmissingparameters') + . self::showDocu('faq', 'faqmissingparameters') . '<br />'; $found_error = true; } diff --git a/libraries/config.default.php b/libraries/config.default.php index c51b7667c0..3e2dbbeafd 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -14,7 +14,7 @@ * phpMyAdmin default configuration, you can copy values from here to your * config.inc.php * - * All directives are explained in Documentation.html + * All directives are explained in the documentation * * @package PhpMyAdmin */ diff --git a/libraries/config/FormDisplay.class.php b/libraries/config/FormDisplay.class.php index 333b88a584..ee86f5384d 100644 --- a/libraries/config/FormDisplay.class.php +++ b/libraries/config/FormDisplay.class.php @@ -684,7 +684,10 @@ class FormDisplay if ($test == 'Import' || $test == 'Export') { return ''; } - return 'Documentation.html#cfg_' . $this->_getOptName($path); + return PMA_Util::getDocuLink( + 'config', + 'cfg_' . $this->_getOptName($path) + ); } /** diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index df897ad10a..365852adbc 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -66,7 +66,7 @@ if (defined('TESTSUITE')) { PMA_warnMissingExtension( $GLOBALS['cfg']['Server']['extension'], false, - PMA_Util::showDocu('faqmysql') + PMA_Util::showDocu('faq', 'faqmysql') ); if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') { @@ -80,7 +80,7 @@ if (defined('TESTSUITE')) { PMA_warnMissingExtension( $GLOBALS['cfg']['Server']['extension'], true, - PMA_Util::showDocu('faqmysql') + PMA_Util::showDocu('faq', 'faqmysql') ); } @@ -142,11 +142,11 @@ function PMA_DBI_DBG_query($query, $link, $result, $time) $trace = array(); foreach (debug_backtrace() as $trace_step) { - $trace[] = + $trace[] = (isset($trace_step['file']) ? PMA_Error::relPath($trace_step['file']) : '') - . (isset($trace_step['line']) + . (isset($trace_step['line']) ? '#' . $trace_step['line'] . ': ' : '') . (isset($trace_step['class']) ? $trace_step['class'] : '') diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php index dfc026e32a..70d9b4b2aa 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -282,8 +282,9 @@ $msg->addParam( ); $msg->addParam('</a>', false); $msg->addParam($trans); +$doc_url = PMA_Util::getDocuLink('faq', 'faq6-27'); $msg->addParam( - '<a href="Documentation.html#faq6_27" target="documentation">', + '<a href="'. $doc_url . '" target="documentation">', false ); $msg->addParam('</a>', false); diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index 374f1e503b..7975476219 100644 --- a/libraries/display_import.lib.php +++ b/libraries/display_import.lib.php @@ -151,7 +151,7 @@ if ($_SESSION[$SESSION_KEY]["handler"] != "UploadNoplugin") { <?php } else { // no plugin available ?> - $('#upload_form_status_info').html('<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" width="16" height="16" alt="ajax clock" /> <?php echo PMA_jsFormat(__('Please be patient, the file is being uploaded. Details about the upload are not available.'), false) . PMA_Util::showDocu('faq2_9'); ?>'); + $('#upload_form_status_info').html('<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" width="16" height="16" alt="ajax clock" /> <?php echo PMA_jsFormat(__('Please be patient, the file is being uploaded. Details about the upload are not available.'), false) . PMA_Util::showDocu('faq', 'faq2_9'); ?>'); $('#upload_form_status').css("display", "none"); <?php } // else diff --git a/libraries/display_select_lang.lib.php b/libraries/display_select_lang.lib.php index e77e9a9fa1..96f92845f2 100644 --- a/libraries/display_select_lang.lib.php +++ b/libraries/display_select_lang.lib.php @@ -56,7 +56,7 @@ function PMA_getLanguageSelectorHtml($use_fieldset = false, $show_doc = true) $language_title = __('Language') . (__('Language') != 'Language' ? ' - <em>Language</em>' : ''); if ($show_doc) { - $language_title .= PMA_Util::showDocu('faq7_2'); + $language_title .= PMA_Util::showDocu('faq', 'faq7-2'); } if ($use_fieldset) { $retval .= '<fieldset><legend lang="en" dir="ltr">' diff --git a/libraries/navigation/NavigationHeader.class.php b/libraries/navigation/NavigationHeader.class.php index bc9a04093a..e49da5c8c6 100644 --- a/libraries/navigation/NavigationHeader.class.php +++ b/libraries/navigation/NavigationHeader.class.php @@ -213,7 +213,7 @@ class PMA_NavigationHeader ); } $retval .= $this->_getLink( - 'Documentation.html', + PMA_Util::getDocuLink('index'), $showText, __('phpMyAdmin documentation'), $showIcon, diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index fa88b0d934..b4fe7f6d67 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -428,7 +428,7 @@ function PMA_pluginGetOneOption( $doc[2] ); } elseif (count($doc) == 1) { - $ret .= PMA_Util::showDocu($doc[0]); + $ret .= PMA_Util::showDocu('faq', $doc[0]); } else { $ret .= PMA_Util::showMySQLDocu( $doc[0], diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index 7d6321ed32..688190d4e6 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -179,7 +179,7 @@ class AuthenticationCookie extends AuthenticationPlugin <fieldset> <legend>'; echo __('Log in'); - echo PMA_Util::showDocu(''); + echo PMA_Util::showDocu('index'); echo '</legend>'; if ($GLOBALS['cfg']['AllowArbitraryServer']) { echo ' diff --git a/libraries/plugins/export/ExportLatex.class.php b/libraries/plugins/export/ExportLatex.class.php index 66891b6d33..7d448f3ee7 100644 --- a/libraries/plugins/export/ExportLatex.class.php +++ b/libraries/plugins/export/ExportLatex.class.php @@ -119,17 +119,17 @@ class ExportLatex extends ExportPlugin $leaf = new TextPropertyItem(); $leaf->setName("structure_caption"); $leaf->setText(__('Table caption')); - $leaf->setDoc('faq6_27'); + $leaf->setDoc('faq6-27'); $structureOptions->addProperty($leaf); $leaf = new TextPropertyItem(); $leaf->setName("structure_continued_caption"); $leaf->setText(__('Table caption (continued)')); - $leaf->setDoc('faq6_27'); + $leaf->setDoc('faq6-27'); $structureOptions->addProperty($leaf); $leaf = new TextPropertyItem(); $leaf->setName("structure_label"); $leaf->setText(__('Label key')); - $leaf->setDoc('faq6_27'); + $leaf->setDoc('faq6-27'); $structureOptions->addProperty($leaf); if (! empty($GLOBALS['cfgRelation']['relation'])) { $leaf = new BoolPropertyItem(); @@ -164,17 +164,17 @@ class ExportLatex extends ExportPlugin $leaf = new TextPropertyItem(); $leaf->setName("data_caption"); $leaf->setText(__('Table caption')); - $leaf->setDoc('faq6_27'); + $leaf->setDoc('faq6-27'); $dataOptions->addProperty($leaf); $leaf = new TextPropertyItem(); $leaf->setName("data_continued_caption"); $leaf->setText(__('Table caption (continued)')); - $leaf->setDoc('faq6_27'); + $leaf->setDoc('faq6-27'); $dataOptions->addProperty($leaf); $leaf = new TextPropertyItem(); $leaf->setName("data_label"); $leaf->setText(__('Label key')); - $leaf->setDoc('faq6_27'); + $leaf->setDoc('faq6-27'); $dataOptions->addProperty($leaf); $leaf = new TextPropertyItem(); $leaf->setName('null'); diff --git a/libraries/plugins/transformations/README b/libraries/plugins/transformations/README index ab6a16aa39..7d7a1255d2 100644 --- a/libraries/plugins/transformations/README +++ b/libraries/plugins/transformations/README @@ -1,4 +1,4 @@ TRANSFORMATION USAGE (Garvin Hicking, <me@supergarv.de>) ==================== -See the Documentation.html for complete instructions on how to use transformation plugins. +See the documentation for complete instructions on how to use transformation plugins. diff --git a/libraries/plugins/transformations/TEMPLATE b/libraries/plugins/transformations/TEMPLATE index 82a65ec109..6f116ce833 100644 --- a/libraries/plugins/transformations/TEMPLATE +++ b/libraries/plugins/transformations/TEMPLATE @@ -3,7 +3,7 @@ /** * This file contains the basic structure for a specific MIME Type and Subtype * transformations class. - * For instructions, read the /Documentation.html file. + * For instructions, read the documentation * * @package PhpMyAdmin-Transformations * @subpackage [TransformationName] @@ -43,4 +43,4 @@ class [MIMEType]_[MIMESubtype]_[TransformationName] return "[MIMESubtype]"; } } -?>
\ No newline at end of file +?> diff --git a/libraries/plugins/transformations/TEMPLATE_ABSTRACT b/libraries/plugins/transformations/TEMPLATE_ABSTRACT index 8c9c61cf94..5cc1d26bd0 100644 --- a/libraries/plugins/transformations/TEMPLATE_ABSTRACT +++ b/libraries/plugins/transformations/TEMPLATE_ABSTRACT @@ -3,7 +3,7 @@ /** * This file contains the basic structure for an abstract class defining a * transformation. - * For instructions, read the /Documentation.html file. + * For instructions, read the documentation * * @package PhpMyAdmin-Transformations * @subpackage [TransformationName] @@ -86,4 +86,4 @@ abstract class [TransformationName]TransformationsPlugin return "[TransformationName]"; } } -?>
\ No newline at end of file +?> diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index b59767a3af..caf14feab2 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -81,10 +81,12 @@ function PMA_getRelationsParamDiagnostic($cfgRelation) { $retval = ''; + $doc_url = PMA_Util::getDocuLink('config', 'cfg_Servers_%s'); + $messages['error'] = '<font color="red"><strong>' . __('not OK') . '</strong></font>' - . ' [ <a href="Documentation.html#%s" target="documentation">' + . ' [ <a href="' . $doc_url .'" target="documentation">' . __('Documentation') . '</a> ]'; @@ -142,7 +144,7 @@ function PMA_getRelationsParamDiagnostic($cfgRelation) 'pdf_pages', isset($cfgRelation['pdf_pages']), $messages, - 'table_coords' + 'pdf_pages' ); $retval .= PMA_getDiagMessageForFeature( __('Creation of PDFs'), @@ -153,7 +155,7 @@ function PMA_getRelationsParamDiagnostic($cfgRelation) 'column_info', isset($cfgRelation['column_info']), $messages, - 'col_com' + 'column_info' ); $retval .= PMA_getDiagMessageForFeature( __('Displaying Column Comments'), @@ -257,11 +259,11 @@ function PMA_getRelationsParamDiagnostic($cfgRelation) 'Create the needed tables with the ' . '<code>examples/create_tables.sql</code>.' ); - $retval .= ' ' . PMA_Util::showDocu('linked-tables'); + $retval .= ' ' . PMA_Util::showDocu('setup', 'linked-tables'); $retval .= '</li>'; $retval .= '<li>'; $retval .= __('Create a pma user and give access to these tables.'); - $retval .= ' ' . PMA_Util::showDocu('pmausr'); + $retval .= ' ' . PMA_Util::showDocu('config', 'cfg_Servers_controluser'); $retval .= '</li>'; $retval .= '<li>'; $retval .= __( @@ -269,7 +271,7 @@ function PMA_getRelationsParamDiagnostic($cfgRelation) . '(<code>config.inc.php</code>), for example by ' . 'starting from <code>config.sample.inc.php</code>.' ); - $retval .= ' ' . PMA_Util::showDocu('quick_install'); + $retval .= ' ' . PMA_Util::showDocu('setup', 'quick-install'); $retval .= '</li>'; $retval .= '<li>'; $retval .= __( @@ -314,7 +316,7 @@ function PMA_getDiagMessageForFeature($feature_name, * @param string $parameter config parameter name to display * @param boolean $relation_parameter_set whether this parameter is set * @param array $messages utility messages - * @param string $doc_anchor anchor in Documentation.html + * @param string $doc_anchor anchor in documentation * * @return void */ @@ -1079,7 +1081,7 @@ function PMA_getForeignData($foreigners, $field, $override_total, $foreign_filte $foreign_field = $foreigner['foreign_field']; // Count number of rows in the foreign table. Currently we do - // not use a drop-down if more than ForeignKeyMaxLimit rows in the + // not use a drop-down if more than ForeignKeyMaxLimit rows in the // foreign table, // for speed reasons and because we need a better interface for this. // diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php index 5d55f8b1d5..8f2c9a1416 100644 --- a/libraries/sql_query_form.lib.php +++ b/libraries/sql_query_form.lib.php @@ -408,7 +408,7 @@ function PMA_sqlQueryFormBookmark() echo '</div>' . "\n"; echo '<div class="formelement">' . "\n"; echo __('Variable'); - echo PMA_Util::showDocu('faqbookmark'); + echo PMA_Util::showDocu('faq', 'faqbookmark'); echo '<input type="text" name="bookmark_variable" class="textfield"' .' size="10" />' . "\n"; echo '</div>' . "\n"; diff --git a/libraries/sqlvalidator.lib.php b/libraries/sqlvalidator.lib.php index e6d6d5c992..de55e9a172 100644 --- a/libraries/sqlvalidator.lib.php +++ b/libraries/sqlvalidator.lib.php @@ -65,7 +65,11 @@ function PMA_validateSQL($sql) if (isset($GLOBALS['sqlvalidator_error']) && $GLOBALS['sqlvalidator_error'] ) { - $str = sprintf(__('The SQL validator could not be initialized. Please check if you have installed the necessary PHP extensions as described in the %sdocumentation%s.'), '<a href="Documentation.html#faqsqlvalidator" target="documentation">', '</a>'); + $str = sprintf( + __('The SQL validator could not be initialized. Please check if you have installed the necessary PHP extensions as described in the %sdocumentation%s.'), + '<a href="' . PMA_Util::getDocuLink('faq', 'faqsqlvalidator') . '" target="documentation">', + '</a>' + ); } else { // create new class instance $srv = new PMA_SQLValidator(); diff --git a/pmd_general.php b/pmd_general.php index 7fd204e142..64438791e6 100644 --- a/pmd_general.php +++ b/pmd_general.php @@ -103,7 +103,7 @@ echo '</div>'; <img title="<?php echo __('Reload'); ?>" alt="" src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/reload.png'); ?>" /> </a> - <a href="Documentation.html#faq6_31" target="documentation" class="M_butt" target="_self"> + <a href="<?php echo PMA_Util::getDocuLink('faq', 'faq6-31') ?>" target="documentation" class="M_butt" target="_self"> <img title="<?php echo __('Help'); ?>" alt="" src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/help.png'); ?>" /> </a> diff --git a/prefs_manage.php b/prefs_manage.php index 01be5b8d8f..e85ab3d3c1 100644 --- a/prefs_manage.php +++ b/prefs_manage.php @@ -276,7 +276,7 @@ PMA_printJsValue("PMA_messages['strSavedOn']", __('Saved on: @DATE@')); <div class="group-cnt"> <?php echo sprintf(__('You can set more settings by modifying config.inc.php, eg. by using %sSetup script%s.'), '<a href="setup/index.php" target="_blank">', '</a>'); - echo PMA_Util::showDocu('setup_script'); + echo PMA_Util::showDocu('setup', 'setup-script'); ?> </div> </div> diff --git a/schema_edit.php b/schema_edit.php index 89ffd62109..498ccb7afb 100644 --- a/schema_edit.php +++ b/schema_edit.php @@ -34,24 +34,24 @@ $cfgRelation = PMA_getRelationsParam(); */ if (! $cfgRelation['relwork']) { echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'relation', 'config.inc.php') . '<br />' . "\n" - . PMA_Util::showDocu('relation') . "\n"; + . PMA_Util::showDocu('config', 'cfg_Servers_relation') . "\n"; exit; } if (! $cfgRelation['displaywork']) { echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n" - . PMA_Util::showDocu('table_info') . "\n"; + . PMA_Util::showDocu('config', 'cfg_Servers_table_info') . "\n"; exit; } if (! isset($cfgRelation['table_coords'])) { echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n" - . PMA_Util::showDocu('table_coords') . "\n"; + . PMA_Util::showDocu('config', 'cfg_Servers_table_coords') . "\n"; exit; } if (! isset($cfgRelation['pdf_pages'])) { echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n" - . PMA_Util::showDocu('pdf_pages') . "\n"; + . PMA_Util::showDocu('config', 'cfg_Servers_pdf_pages') . "\n"; exit; } @@ -300,7 +300,7 @@ if (empty($sql_query) && strlen($table) && strlen($db)) { ); $GLOBALS['using_bookmark_message']->addParam($table); $GLOBALS['using_bookmark_message']->addMessage( - PMA_Util::showDocu('faq6_22') + PMA_Util::showDocu('faq', 'faq6-22') ); $sql_query = $book_sql_query; } else { diff --git a/test/libraries/common/PMA_showDocu_test.php b/test/libraries/common/PMA_showDocu_test.php index 717e59efe8..fd2223d543 100644 --- a/test/libraries/common/PMA_showDocu_test.php +++ b/test/libraries/common/PMA_showDocu_test.php @@ -23,13 +23,8 @@ class PMA_showDocu_test extends PHPUnit_Framework_TestCase function testShowDocu() { - $anchor = "relation"; - $expected = '<a href="Documentation.html#' . $anchor . '" target="documentation">' - . '<img src="themes/dot.gif" title="' . __('Documentation') . '" ' - . 'alt="' . __('Documentation') . '" class="icon ic_b_help" /></a>'; - - $this->assertEquals( - $expected, PMA_Util::showDocu($anchor) + $this->assertContains( + 'page.html#anchor', PMA_Util::showDocu('page', 'anchor') ); } |