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
  • 8 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 16, 2011
@asleonardo Action buttons hook
-Created hook in Misc->printTable with some refactor.
-Created Example->add_plugin_actionbuttons.
126ef0d
@asleonardo Action buttons hook 2
-Refactored Example->add_plugin_actionbuttons.
-Registered hook for actionbuttons.
-Created entry in Example's lang.
-Updated call to printTable in all_db.php.
06ee56e
@asleonardo Small changes in Example->add_plugin_actionbuttons ebd7b1c
View
2  all_db.php
@@ -425,7 +425,7 @@ function doDefault($msg = '') {
if (!$data->hasDatabaseCollation()) unset($columns['lc_collate'], $columns['lc_ctype']);
if (!isset($data->privlist['database'])) unset($actions['privileges']);
- $misc->printTable($databases, $columns, $actions, $lang['strnodatabases']);
+ $misc->printTable($databases, $columns, $actions, $lang['strnodatabases'], null, 'all_db-databases');
$navlinks = array (
array (
View
15 classes/Misc.php
@@ -1678,9 +1678,20 @@ function printUrlVars(&$vars, &$fields) {
* (see tblproperties.php and constraints.php for examples)
* The function must not must not store urls because
* they are relative and won't work out of context.
+ * @param $place - Place where the $actions are displayed. Like 'display-browse', where 'display' is the file (display.php)
+ * and 'browse' is the place inside that code (doBrowse).
*/
- function printTable(&$tabledata, &$columns, &$actions, $nodata = null, $pre_fn = null) {
- global $data, $conf, $misc, $lang;
+ function printTable(&$tabledata, &$columns, &$actions, $nodata = null, $pre_fn = null, $place = null) {
+ global $data, $conf, $misc, $lang, $plugin_manager;
+
+ if (strlen($place) > 0) {
+ // Action buttons hook's place
+ $plugin_functions_parameters = array(
+ 'actionbuttons' => &$actions,
+ 'place' => $place
+ );
+ $plugin_manager->do_hook('actionbuttons', $plugin_functions_parameters);
+ }
if ($has_ma = isset($actions['multiactions']))
$ma = $actions['multiactions'];
View
2  classes/PluginManager.php
@@ -10,7 +10,7 @@ class PluginManager {
* Attributes
*/
private $plugins_list = array();
- private $available_hooks = array('toplinks', 'tabs', 'trail', 'navlinks');
+ private $available_hooks = array('toplinks', 'tabs', 'trail', 'navlinks', 'actionbuttons');
private $actions = array();
private $hooks = array();
View
1  plugins/Example/lang/english.php
@@ -18,6 +18,7 @@
$plugin_lang['strlinklevel4'] = 'Level 4';
$plugin_lang['strdisplayext'] = 'Display extension';
$plugin_lang['strdbext'] = 'Databases extension';
+ $plugin_lang['strextraaction'] = 'Extra action';
//Pages
$plugin_lang['strdesclevel2'] = 'This is the level 2';
View
1  plugins/Example/lang/portuguese-br.php
@@ -18,6 +18,7 @@
$plugin_lang['strlinklevel4'] = 'Nível 4';
$plugin_lang['strdisplayext'] = 'Extensão de exibição';
$plugin_lang['strdbext'] = 'Extensão das bases de dados';
+ $plugin_lang['strextraaction'] = 'Ação extra';
//Paginas
$plugin_lang['strdesclevel2'] = 'Este é o nível 2';
View
1  plugins/Example/lang/recoded/english.php
@@ -18,6 +18,7 @@
$plugin_lang['strlinklevel4'] = 'Level 4';
$plugin_lang['strdisplayext'] = 'Display extension';
$plugin_lang['strdbext'] = 'Databases extension';
+ $plugin_lang['strextraaction'] = 'Extra action';
//Pages
$plugin_lang['strdesclevel2'] = 'This is the level 2';
View
1  plugins/Example/lang/recoded/portuguese-br.php
@@ -18,6 +18,7 @@
$plugin_lang['strlinklevel4'] = 'Nível 4';
$plugin_lang['strdisplayext'] = 'Extensão de exibição';
$plugin_lang['strdbext'] = 'Extensão das bases de dados';
+ $plugin_lang['strextraaction'] = 'Ação extra';
//Paginas
$plugin_lang['strdesclevel2'] = 'Este é o nível 2';
View
31 plugins/Example/plugin.php
@@ -39,6 +39,7 @@ function get_hooks() {
'tabs' => array('add_plugin_tabs'),
'trail' => array('add_plugin_trail'),
'navlinks' => array('add_plugin_navlinks'),
+ 'actionbuttons' => array('add_plugin_actionbuttons')
);
return $hooks;
}
@@ -205,6 +206,36 @@ function add_plugin_navlinks(&$plugin_functions_parameters) {
}
/**
+ * Add plugin in the actionbuttons
+ * @param $plugin_functions_parameters
+ */
+ function add_plugin_actionbuttons(&$plugin_functions_parameters) {
+ global $misc;
+
+ $actionbuttons = array();
+ switch ($plugin_functions_parameters['place']) {
+
+ case 'all_db-databases':
+ $href = "plugin.php?".$misc->href;
+ $href.= "&plugin=".urlencode($this->name);
+ $href.= "&subject=show_page";
+ $href.= "&action=show_databases_extension&";
+
+ $actionbuttons['extraaction'] = array (
+ 'title' => $this->lang['strextraaction'],
+ 'url' => $href,
+ 'vars' => array('database' => 'datname')
+ );
+ break;
+ }
+
+ if (count($actionbuttons) > 0) {
+ //Merge the original actionbuttons array with Examples' actionbuttons
+ $plugin_functions_parameters['actionbuttons'] = array_merge($plugin_functions_parameters['actionbuttons'], $actionbuttons);
+ }
+ }
+
+ /**
* Show a simple page
* This function will be used as an action
*

No commit comments for this range

Something went wrong with that request. Please try again.