FastActions » History » Version 8
tsmr, 12/23/2011 10:11 AM
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 | 2 | tsmr | |Plugins|Action defined by plugin|Parameters defined by plugin| |
19 | 3 | tsmr | |
20 | 5 | tsmr | *Setup* : |
21 | 1 | tsmr | |
22 | 5 | tsmr | Add a system like fields unicity for select for each types which can use rapid actions the possibles actions (prefined dropdown) |
23 | 5 | tsmr | Goal : Define the classes & actions listed into the fast actions dropdown |
24 | 1 | tsmr | |
25 | 7 | moyo | MoYo : Why setup them ? Like Massive Action, fixed actions may be more simple ? |
26 | 7 | moyo | |
27 | 8 | tsmr | Tsmr : For Limit number of actions into dropdown : "too much actions, kills fast actions" :P |
28 | 8 | tsmr | |
29 | 5 | tsmr | *Initial Patch* : |
30 | 1 | tsmr | |
31 | 5 | tsmr | - 1 file ajax/dropdownHeaderActions.php calling Html::addDropdownActionsForHeader($_POST['action']); |
32 | 1 | tsmr | |
33 | 5 | tsmr | - Add an array into define.php : $CFG_GLPI["header_types"] = array('Ticket'); (and modification of plugin.class.php for using with plugins) |
34 | 1 | tsmr | |
35 | 5 | tsmr | - Add 3 functions into html.class.php : |
36 | 3 | tsmr | |
37 | 5 | tsmr | addCriteriaForHeader which define each classes which can use fast actions (with a hook $PLUGIN_HOOKS["header_entry"]) |
38 | 3 | tsmr | |
39 | 5 | tsmr | showActionFromHeader which list each classes into a dropdown |
40 | 5 | tsmr | |
41 | 5 | tsmr | addDropdownActionsForHeader which list actions for each classes. |
42 | 5 | tsmr | |
43 | 5 | tsmr | For plugins : |
44 | 3 | tsmr | |
45 | 3 | tsmr | Plugin::registerClass -> 'header_types' => true |
46 | 3 | tsmr | |
47 | 3 | tsmr | $PLUGIN_HOOKS['header_entry']['example'] = array('My fast action' =>'/plugins/example/front/example.form.php'); |
48 | 3 | tsmr | $PLUGIN_HOOKS['header_action']['example'] = 'plugin_example_header_action'; |
49 | 4 | tsmr | <pre> |
50 | 3 | tsmr | |
51 | 3 | tsmr | function plugin_example_header_action() { |
52 | 3 | tsmr | global $LANG; |
53 | 3 | tsmr | |
54 | 3 | tsmr | echo "<div class='center'><input type=\"submit\" class=\"submit\" value=\"" . $LANG['buttons'][2] . "\" ></div>"; |
55 | 3 | tsmr | } |
56 | 4 | tsmr | </pre> |