FastActions » History » Version 10

tsmr, 01/06/2012 12:30 PM

1 1 tsmr
h1. FastActions
2 1 tsmr
3 1 tsmr
*Goal* : Add a system to display fast actions on GLPI header
4 1 tsmr
5 6 tsmr
*GLPI version* : 0.84
6 6 tsmr
7 6 tsmr
*Developer* : Tsmr..
8 6 tsmr
9 1 tsmr
*Concerned objects* : All objects which have an interest to be launch quickly
10 1 tsmr
11 5 tsmr
*Detail* :
12 1 tsmr
13 1 tsmr
Example : for a Call Center which need to generate tickets on the fly :
14 1 tsmr
15 1 tsmr
|Class|Action|Parameter|
16 1 tsmr
|Ticket|New Ticket|Specify requester|
17 1 tsmr
|Problem|New Problem|Specify requester|
18 10 tsmr
|External Link|Launch this command|Specify IP / NAME|
19 2 tsmr
|Plugins|Action defined by plugin|Parameters defined by plugin|
20 3 tsmr
21 5 tsmr
*Setup* :
22 1 tsmr
23 5 tsmr
Add a system like fields unicity for select for each types which can use rapid actions the possibles actions (prefined dropdown)
24 5 tsmr
Goal : Define the classes & actions listed into the fast actions dropdown
25 1 tsmr
26 7 moyo
MoYo : Why setup them ? Like Massive Action, fixed actions may be more simple ?
27 7 moyo
28 9 tsmr
Tsmr : For permit custom configuration of fast actions for each user
29 8 tsmr
30 5 tsmr
*Initial Patch* : 
31 1 tsmr
32 5 tsmr
- 1 file ajax/dropdownHeaderActions.php calling Html::addDropdownActionsForHeader($_POST['action']);
33 1 tsmr
34 5 tsmr
- Add an array into define.php : $CFG_GLPI["header_types"] = array('Ticket'); (and modification of plugin.class.php for using with plugins)
35 1 tsmr
36 5 tsmr
- Add 3 functions into html.class.php :
37 3 tsmr
38 5 tsmr
addCriteriaForHeader which define each classes which can use fast actions (with a hook $PLUGIN_HOOKS["header_entry"])
39 3 tsmr
40 5 tsmr
showActionFromHeader which list each classes into a dropdown
41 5 tsmr
42 5 tsmr
addDropdownActionsForHeader which list actions for each classes.
43 5 tsmr
44 5 tsmr
For plugins :
45 3 tsmr
46 3 tsmr
Plugin::registerClass -> 'header_types' => true
47 3 tsmr
48 3 tsmr
$PLUGIN_HOOKS['header_entry']['example'] = array('My fast action' =>'/plugins/example/front/example.form.php');
49 3 tsmr
$PLUGIN_HOOKS['header_action']['example'] = 'plugin_example_header_action';
50 4 tsmr
<pre>
51 3 tsmr
52 3 tsmr
function plugin_example_header_action() {
53 3 tsmr
   global $LANG;
54 3 tsmr
   
55 3 tsmr
   echo "<div class='center'><input type=\"submit\" class=\"submit\" value=\"" . $LANG['buttons'][2] . "\" ></div>";
56 3 tsmr
}
57 4 tsmr
</pre>