Browse files

Implement linking to new documentation

  • Loading branch information...
1 parent b07a6c4 commit 61a601fc735c0596aefb1544f1f3a704a19c61d5 @nijel nijel committed Nov 12, 2012
View
2 import.php
@@ -92,7 +92,7 @@
$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
View
2 index.php
@@ -329,7 +329,7 @@
PMA_printListItem(
__('Documentation'),
'li_pma_docs',
- 'Documentation.html',
+ PMA_Util::getDocuLink('index'),
null,
'_blank'
);
View
2 libraries/RecentTable.class.php
@@ -14,7 +14,7 @@
* Handles the recently used tables.
*
* @TODO Change the release version in table pma_recent
- * (#recent in Documentation.html)
+ * (#recent in documentation)
*
* @package PhpMyAdmin
*/
View
2 libraries/Table.class.php
@@ -1393,7 +1393,7 @@ protected function saveUiPrefsToDb()
$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 />');
View
34 libraries/Util.class.php
@@ -520,17 +520,43 @@ public static function showMySQLDocu(
} // 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 @@ public static function checkParameters($params, $request = true)
$error_message .= $reported_script_name
. ': ' . __('Missing parameter:') . ' '
. $param
- . self::showDocu('faqmissingparameters')
+ . self::showDocu('faq', 'faqmissingparameters')
. '<br />';
$found_error = true;
}
View
2 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
*/
View
5 libraries/config/FormDisplay.class.php
@@ -684,7 +684,10 @@ public function getDocLink($path)
if ($test == 'Import' || $test == 'Export') {
return '';
}
- return 'Documentation.html#cfg_' . $this->_getOptName($path);
+ return PMA_Util::getDocuLink(
+ 'config',
+ 'cfg_' . $this->_getOptName($path)
+ );
}
/**
View
8 libraries/database_interface.lib.php
@@ -66,7 +66,7 @@ function PMA_DBI_checkDbExtension($extension = 'mysql')
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 @@ function PMA_DBI_checkDbExtension($extension = 'mysql')
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'] : '')
View
3 libraries/display_export.lib.php
@@ -282,8 +282,9 @@ function PMA_exportCheckboxCheck($str)
);
$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);
View
2 libraries/display_import.lib.php
@@ -151,7 +151,7 @@ function(response) {
<?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
View
2 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">'
View
2 libraries/navigation/NavigationHeader.class.php
@@ -213,7 +213,7 @@ private function _links()
);
}
$retval .= $this->_getLink(
- 'Documentation.html',
+ PMA_Util::getDocuLink('index'),
$showText,
__('phpMyAdmin documentation'),
$showIcon,
View
2 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],
View
2 libraries/plugins/auth/AuthenticationCookie.class.php
@@ -179,7 +179,7 @@ public function auth()
<fieldset>
<legend>';
echo __('Log in');
- echo PMA_Util::showDocu('');
+ echo PMA_Util::showDocu('index');
echo '</legend>';
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
echo '
View
12 libraries/plugins/export/ExportLatex.class.php
@@ -119,17 +119,17 @@ protected function setProperties()
$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 @@ protected function setProperties()
$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');
View
2 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.
View
4 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]";
}
}
-?>
+?>
View
4 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]";
}
}
-?>
+?>
View
18 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,19 +259,19 @@ 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 .= __(
'Enable advanced features in configuration file '
. '(<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.
//
View
2 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";
View
6 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();
View
2 pmd_general.php
@@ -103,7 +103,7 @@ class="M_butt" id="display_field_button" target="_self">
<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>
View
2 prefs_manage.php
@@ -276,7 +276,7 @@
<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>
View
8 schema_edit.php
@@ -34,24 +34,24 @@
*/
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;
}
View
2 sql.php
@@ -300,7 +300,7 @@
);
$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 {
View
9 test/libraries/common/PMA_showDocu_test.php
@@ -23,13 +23,8 @@ function setup()
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')
);
}

0 comments on commit 61a601f

Please sign in to comment.