FastActions » History » Version 5

« Previous - Version 5/10 (diff) - Next » - Current version
tsmr, 12/23/2011 09:44 AM


Goal : Add a system to display fast actions on GLPI header

Concerned objects : All objects which have an interest to be launch quickly

Detail :

Example : for a Call Center which need to generate tickets on the fly :

Class Action Parameter
Ticket New Ticket Specify requester
Problem New Problem Specify requester
Plugins Action defined by plugin Parameters defined by plugin

Setup :

Add a system like fields unicity for select for each types which can use rapid actions the possibles actions (prefined dropdown)
Goal : Define the classes & actions listed into the fast actions dropdown

Initial Patch :

- 1 file ajax/dropdownHeaderActions.php calling Html::addDropdownActionsForHeader($_POST['action']);

- Add an array into define.php : $CFG_GLPI["header_types"] = array('Ticket'); (and modification of plugin.class.php for using with plugins)

- Add 3 functions into html.class.php :

addCriteriaForHeader which define each classes which can use fast actions (with a hook $PLUGIN_HOOKS["header_entry"])

showActionFromHeader which list each classes into a dropdown

addDropdownActionsForHeader which list actions for each classes.

For plugins :

Plugin::registerClass -> 'header_types' => true

$PLUGIN_HOOKS['header_entry']['example'] = array('My fast action' =>'/plugins/example/front/example.form.php');
$PLUGIN_HOOKS['header_action']['example'] = 'plugin_example_header_action';

function plugin_example_header_action() {
   global $LANG;

   echo "<div class='center'><input type=\"submit\" class=\"submit\" value=\"" . $LANG['buttons'][2] . "\" ></div>";