FastActions » History » Version 3
« Previous -
Version 3/10
(diff) -
Next » -
Current version
tsmr, 12/23/2011 09:26 AM
FastActions¶
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 |
Patch envoyé :
- 1 fichier ajax/dropdownHeaderActions.php appelant Html::addDropdownActionsForHeader($_POST['action']);
- Ajout dans define.php d'un tableau : $CFG_GLPI["header_types"] = array('Ticket'); (et modification de plugin.class.php pour la prise en charge des plugins)
- Ajout de 3 fonctions dans html.class.php :
addCriteriaForHeader qui retourne les classes ayant le droit de faire des actions rapides (avec un hook $PLUGIN_HOOKS["header_entry"])
showActionFromHeader qui liste ces classes dans une liste déroulante
addDropdownActionsForHeader qui liste les actions pour chaque classe.
Coté plugin :
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>";
}