Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 34 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 14, 2011
@asleonardo Navlinks refactor - 1
-Refactored the files that have navlinks.
-Fixed wrong navlinks code.
0f927c2
@asleonardo Navlinks refactor - 2
-Refactored Misc->printNavLinks.
-Refactored Example->add_plugin_navlinks.
-Created Example->show_databases_extension.
-Created Example->show_display_extension.
-Created new entries in languages files of Example.
fd24587
@asleonardo New comments for Example's methods. 54ce3db
View
4 aggregates.php
@@ -263,7 +263,7 @@ function doProperties($msg = '') {
'content' => $lang['strdrop']
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'aggregates-properties');
}
@@ -330,7 +330,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreateaggregate']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'aggregates-aggregates');
}
/**
View
3  all_db.php
@@ -433,8 +433,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreatedatabase']
)
);
- $misc->printNavLinks($navlinks);
-
+ $misc->printNavLinks($navlinks, 'all_db-databases');
}
function doTree() {
View
9 classes/Misc.php
@@ -1185,7 +1185,9 @@ function getTopLinks() {
/**
* Display the navlinks
*
- * @param $navlinks - An array with the the attributes and values that will be shown.
+ * @param $navlinks - An array with the the attributes and values that will be shown.
+ * @param $place - Place where the $navlinks are displayed. Like 'display-browse', where 'display' is the file (display.php)
+ * and 'browse' is the place inside that code (doBrowse).
*
* $navlinks = array (
* array (
@@ -1197,12 +1199,13 @@ function getTopLinks() {
* )
* );
*/
- function printNavLinks($navlinks=array()) {
+ function printNavLinks($navlinks=array(), $place) {
global $plugin_manager;
// Navlinks hook's place
$plugin_functions_parameters = array(
- 'navlinks' => &$navlinks
+ 'navlinks' => &$navlinks,
+ 'place' => $place
);
$plugin_manager->do_hook('navlinks', $plugin_functions_parameters);
View
4 colproperties.php
@@ -278,9 +278,7 @@ function attPre(&$rowdata) {
);
}
- $misc->printNavLinks($navlinks);
-
-
+ $misc->printNavLinks($navlinks, 'colproperties-colproperties');
}
}
View
2  constraints.php
@@ -487,7 +487,7 @@ function cnPre(&$rowdata) {
'content' => $lang['straddfk']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'constraints-constraints');
}
function doTree() {
View
2  display.php
@@ -643,7 +643,7 @@ function doBrowse($msg = '') {
'content' => $lang['strrefresh']
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'display-browse');
}
View
11 domains.php
@@ -246,7 +246,7 @@ function doProperties($msg = '') {
'content' => $lang['stralter']
);
}
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'domains-properties');
}
/**
@@ -429,8 +429,13 @@ function doDefault($msg = '') {
$misc->printTable($domains, $columns, $actions, $lang['strnodomains']);
- echo "<p><a class=\"navlink\" href=\"domains.php?action=create&amp;{$misc->href}\">{$lang['strcreatedomain']}</a></p>\n";
-
+ $navlinks = array (
+ array (
+ 'attr'=> array ('href' => "domains.php?action=create&amp;{$misc->href}"),
+ 'content' => $lang['strcreatedomain']
+ )
+ );
+ $misc->printNavLinks($navlinks, 'domains-domains');
}
/**
View
8 fulltext.php
@@ -64,7 +64,7 @@ function doDefault($msg = '') {
'content' => $lang['strftscreateconfig']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'fulltext-fulltext');
}
function doDropConfig($confirm) {
@@ -354,7 +354,7 @@ function doViewParsers($msg = '') {
// 'content' => $lang['strftscreateparser']
// )
//);
- //$misc->printNavLinks($navlinks);
+ //$misc->printNavLinks($navlinks, 'fulltext-viewparsers');
}
@@ -411,7 +411,7 @@ function doViewDicts($msg = '') {
'content' => $lang['strftscreatedict']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'fulltext-viewdicts');
}
@@ -478,7 +478,7 @@ function doViewConfig($ftscfg, $msg = '') {
'content' => $lang['strftsaddmapping']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'fulltext-viewconfig');
}
/**
View
4 functions.php
@@ -338,7 +338,7 @@ function doProperties($msg = '') {
'content' => $lang['strdrop']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'functions-properties');
}
/**
@@ -845,7 +845,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreatecfunction']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'functions-functions');
}
/**
View
5 groups.php
@@ -111,7 +111,7 @@ function doProperties($msg = '') {
'content' => $lang['strshowallgroups']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'groups-properties');
}
/**
@@ -249,8 +249,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreategroup']
)
);
- $misc->printNavLinks($navlinks);
-
+ $misc->printNavLinks($navlinks, 'groups-groups');
}
$misc->printHeader($lang['strgroups']);
View
2  history.php
@@ -84,7 +84,7 @@ function doDefault() {
'attr'=> array ('href' => "history.php?action=download&amp;{$misc->href}"),
'content' => $lang['strdownload']
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'history-history');
}
function doDelHistory($qid, $confirm) {
View
2  indexes.php
@@ -317,7 +317,7 @@ function indPre(&$rowdata, $actions) {
'content' => $lang['strcreateindex']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'indexes-indexes');
}
function doTree() {
View
2  operators.php
@@ -70,7 +70,7 @@ function doProperties($msg = '') {
'content' => $lang['strshowalloperators']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'operators-properties');
}
else
doDefault($lang['strinvalidparam']);
View
2  plugins/Example/lang/english.php
@@ -16,6 +16,8 @@
$plugin_lang['strlinklevel2'] = 'Level 2';
$plugin_lang['strlinklevel3'] = 'Level 3';
$plugin_lang['strlinklevel4'] = 'Level 4';
+ $plugin_lang['strdisplayext'] = 'Display extension';
+ $plugin_lang['strdbext'] = 'Databases extension';
//Pages
$plugin_lang['strdesclevel2'] = 'This is the level 2';
View
2  plugins/Example/lang/portuguese-br.php
@@ -16,6 +16,8 @@
$plugin_lang['strlinklevel2'] = 'Nível 2';
$plugin_lang['strlinklevel3'] = 'Nível 3';
$plugin_lang['strlinklevel4'] = 'Nível 4';
+ $plugin_lang['strdisplayext'] = 'Extensão de exibição';
+ $plugin_lang['strdbext'] = 'Extensão das bases de dados';
//Paginas
$plugin_lang['strdesclevel2'] = 'Este é o nível 2';
View
2  plugins/Example/lang/recoded/english.php
@@ -16,6 +16,8 @@
$plugin_lang['strlinklevel2'] = 'Level 2';
$plugin_lang['strlinklevel3'] = 'Level 3';
$plugin_lang['strlinklevel4'] = 'Level 4';
+ $plugin_lang['strdisplayext'] = 'Display extension';
+ $plugin_lang['strdbext'] = 'Databases extension';
//Pages
$plugin_lang['strdesclevel2'] = 'This is the level 2';
View
2  plugins/Example/lang/recoded/portuguese-br.php
@@ -16,6 +16,8 @@
$plugin_lang['strlinklevel2'] = 'N&#237;vel 2';
$plugin_lang['strlinklevel3'] = 'N&#237;vel 3';
$plugin_lang['strlinklevel4'] = 'N&#237;vel 4';
+ $plugin_lang['strdisplayext'] = 'Extens&#227;o de exibi&#231;&#227;o';
+ $plugin_lang['strdbext'] = 'Extens&#227;o das bases de dados';
//Paginas
$plugin_lang['strdesclevel2'] = 'Este &#233; o n&#237;vel 2';
View
90 plugins/Example/plugin.php
@@ -59,7 +59,9 @@ function get_actions() {
'show_page',
'show_level_2',
'show_level_3',
- 'show_level_4'
+ 'show_level_4',
+ 'show_display_extension',
+ 'show_databases_extension'
);
return $actions;
}
@@ -166,18 +168,40 @@ function add_plugin_trail(&$plugin_functions_parameters) {
function add_plugin_navlinks(&$plugin_functions_parameters) {
global $misc;
- $href = "plugin.php?".$misc->href;
- $href.= "&plugin=".urlencode($this->name);
- $href.= "&subject=server";
- $href.= "&action=show_page";
+ $navlinks = array();
+ switch ($plugin_functions_parameters['place']) {
- $navlinks = array (
- 'attr'=> array ('href' => $href),
- 'content' => $this->lang['strdescription']
- );
+ case 'display-browse':
+ $href = "plugin.php?".$misc->href;
+ $href.= "&amp;plugin=".urlencode($this->name);
+ $href.= "&amp;subject=show_page";
+ $href.= "&amp;action=show_display_extension";
+ $href.= "&amp;database=".urlencode($_REQUEST['database']);
+ $href.= "&amp;table=".urlencode($_REQUEST['table']);
- //Add the link in the toplinks array
- $plugin_functions_parameters['navlinks'][] = $navlinks;
+ $navlinks[] = array (
+ 'attr'=> array ('href' => $href),
+ 'content' => $this->lang['strdisplayext']
+ );
+ break;
+
+ case 'all_db-databases':
+ $href = "plugin.php?".$misc->href;
+ $href.= "&amp;plugin=".urlencode($this->name);
+ $href.= "&amp;subject=show_page";
+ $href.= "&amp;action=show_databases_extension";
+
+ $navlinks[] = array (
+ 'attr'=> array ('href' => $href),
+ 'content' => $this->lang['strdbext']
+ );
+ break;
+ }
+
+ if (count($navlinks) > 0) {
+ //Merge the original navlinks array with Examples' navlinks
+ $plugin_functions_parameters['navlinks'] = array_merge($plugin_functions_parameters['navlinks'], $navlinks);
+ }
}
/**
@@ -311,5 +335,49 @@ function show_level_4() {
$misc->printFooter();
}
+
+ /**
+ * Simple example of how to put a hook in the display page.
+ */
+ function show_display_extension() {
+ global $lang, $misc;
+
+ $misc->printHeader($lang['strdatabase']);
+ $misc->printBody();
+ $misc->printTrail($_REQUEST['subject']);
+
+ echo "<div>{$this->lang['strdisplayext']}</div>\n";
+ echo "<br/>\n";
+
+ $back_link = "<a href=\"display.php?{$misc->href}";
+ $back_link.= "&amp;table=".urlencode($_REQUEST['table']);
+ $back_link.= "&amp;subject=table\">";
+ $back_link.= $lang['strback'];
+ $back_link.= "</a>\n";
+ echo $back_link;
+
+ $misc->printFooter();
+ }
+
+ /**
+ * Simple example of how to put a hook in the databases list page.
+ */
+ function show_databases_extension() {
+ global $lang, $misc;
+
+ $misc->printHeader($lang['strdatabase']);
+ $misc->printBody();
+ $misc->printTrail($_REQUEST['subject']);
+
+ echo "<div>{$this->lang['strdbext']}</div>\n";
+ echo "<br/>\n";
+
+ $back_link = "<a href=\"all_db.php?{$misc->href}\">";
+ $back_link.= $lang['strback'];
+ $back_link.= "</a>\n";
+ echo $back_link;
+
+ $misc->printFooter();
+ }
}
?>
View
2  privileges.php
@@ -277,7 +277,7 @@ function doDefault($msg = '') {
);
}
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'privileges-privileges');
}
$misc->printHeader($lang['strprivileges']);
View
2  reports.php
@@ -130,7 +130,7 @@ function doProperties($msg = '') {
'content' => $lang['stredit']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'reports-properties');
}
/**
View
7 roles.php
@@ -438,7 +438,7 @@ function doProperties($msg = '') {
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'roles-properties');
}
/**
@@ -493,7 +493,7 @@ function doAccount($msg = '') {
'content' => $lang['strchangepassword']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'roles-account');
}
/**
@@ -639,8 +639,7 @@ function renderRoleExpires($val) {
'content' => $lang['strcreaterole']
)
);
- $misc->printNavLinks($navlinks);
-
+ $misc->printNavLinks($navlinks, 'roles-roles');
}
$misc->printHeader($lang['strroles']);
View
2  rules.php
@@ -163,7 +163,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreaterule']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'rules-rules');
}
function doTree() {
View
2  schemas.php
@@ -79,7 +79,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreateschema']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'schemas-schemas');
}
/**
View
5 sequences.php
@@ -77,7 +77,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreatesequence']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'sequences-sequences');
}
/**
@@ -170,7 +170,7 @@ function doProperties($msg = '') {
'content' => $lang['strnextval']
)
);
- $misc->printNavLinks($navlinks);
+
if ($data->hasAlterSequenceStart()) {
$navlinks[] = array (
'attr'=> array ('href' => "sequences.php?action=restart&amp;{$misc->href}&amp;sequence=", urlencode($sequence->fields['seqname'])),
@@ -185,6 +185,7 @@ function doProperties($msg = '') {
'attr'=> array ('href' => "sequences.php?{$misc->href}"),
'content' => $lang['strshowallsequences']
);
+ $misc->printNavLinks($navlinks, 'sequences-properties');
}
else echo "<p>{$lang['strnodata']}</p>\n";
}
View
2  servers.php
@@ -95,7 +95,7 @@ function svPre(&$rowdata, $actions) {
'content' => htmlentities($grp['desc'])
);
}
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'servers-servers');
}
}
View
2  sql.php
@@ -231,7 +231,7 @@ function sqlCallback($query, $rs, $lineno) {
'content' => $lang['strdownload']
);
}
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'sql');
$misc->printFooter();
?>
View
2  tables.php
@@ -840,7 +840,7 @@ function doDefault($msg = '') {
);
}
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'tables-tables');
}
require('./admin.php');
View
3  tablespaces.php
@@ -262,8 +262,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreatetablespace']
)
);
- $misc->printNavLinks($navlinks);
-
+ $misc->printNavLinks($navlinks, 'tablespaces-tablespaces');
}
$misc->printHeader($lang['strtablespaces']);
View
2  tblproperties.php
@@ -591,7 +591,7 @@ function cstrRender($s, $p) {
'content' => $lang['stralter']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'tblproperties-tblproperties');
}
$misc->printHeader($lang['strtables'] . ' - ' . $_REQUEST['table']);
View
2  triggers.php
@@ -337,7 +337,7 @@ function tgPre(&$rowdata,$actions) {
'content' => $lang['strcreatetrigger']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'triggers-triggers');
}
function doTree() {
View
4 types.php
@@ -91,7 +91,7 @@ function attPre(&$rowdata) {
'content' => $lang['strshowalltypes']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'types-properties');
} else
doDefault($lang['strinvalidparam']);
}
@@ -597,7 +597,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreateenumtype']
);
}
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'types-types');
}
/**
View
5 users.php
@@ -53,7 +53,7 @@ function doAccount($msg = '') {
'content' => $lang['strchangepassword']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'users-account');
}
/**
@@ -342,8 +342,7 @@ function renderUseExpires($val) {
'content' => $lang['strcreateuser']
)
);
- $misc->printNavLinks($navlinks);
-
+ $misc->printNavLinks($navlinks, 'users-users');
}
$misc->printHeader($lang['strusers']);
View
4 viewproperties.php
@@ -156,7 +156,7 @@ function doDefinition($msg = '') {
'content' => $lang['stralter']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'viewproperties-definition');
}
/**
@@ -450,7 +450,7 @@ function attPre(&$rowdata) {
'content' => $lang['stralter']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'viewproperties-viewproperties');
}
$misc->printHeader($lang['strviews'] . ' - ' . $_REQUEST['view']);
View
2  views.php
@@ -628,7 +628,7 @@ function doDefault($msg = '') {
'content' => $lang['strcreateviewwiz']
)
);
- $misc->printNavLinks($navlinks);
+ $misc->printNavLinks($navlinks, 'views-views');
}
/**

No commit comments for this range

Something went wrong with that request. Please try again.