Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
agallavardin
fusiondirectory-plugins
Commits
47b0812f
Commit
47b0812f
authored
Aug 11, 2016
by
Côme Chilliet
Browse files
Fixes #5056 Allowing plugins to easily add argonaut actions to the menu
Conflicts: systems/admin/systems/class_systemManagement.inc
parent
20ef1e77
Changes
8
Hide whitespace changes
Inline
Side-by-side
argonaut/addons/argonaut/class_argonautAction.inc
View file @
47b0812f
...
...
@@ -220,52 +220,5 @@ class argonautAction extends simplePlugin
return
$ret
;
}
/*! \brief Returns event information, like menu strings, images ...
@return Array Event informations.
*/
static
public
function
get_event_info
(
$action
)
{
$events
=
self
::
get_event_types
();
if
(
isset
(
$events
[
$action
]))
{
$infos
=
$events
[
$action
];
$infos
[
'menuimg'
]
=
'<img src="'
.
$infos
[
'img'
]
.
'" alt="'
.
$infos
[
'name'
]
.
'" class="center"/>'
;
$infos
[
'listimg'
]
=
'<img src="'
.
$infos
[
'img'
]
.
'" title="'
.
$infos
[
'name'
]
.
'"alt="'
.
$infos
[
'name'
]
.
'" class="center"/>'
;
return
$infos
;
}
else
{
return
FALSE
;
}
}
/*! \brief Returns a complete list of all available events.
@return Array Containing info for all available events.
*/
static
public
function
get_event_types
()
{
return
array
(
'System.halt'
=>
array
(
'name'
=>
_
(
'Switch off'
),
'img'
=>
'geticon.php?context=actions&icon=system-shutdown&size=16'
),
'Deployment.reboot'
=>
array
(
'name'
=>
_
(
'Reboot'
),
'img'
=>
'geticon.php?context=actions&icon=system-reboot&size=16'
),
'Deployment.wake'
=>
array
(
'name'
=>
_
(
'Wake up'
),
'img'
=>
'geticon.php?context=status&icon=task-running&size=16'
),
'Deployment.update'
=>
array
(
'name'
=>
_
(
'Software update'
),
'img'
=>
'geticon.php?context=actions&icon=system-update&size=16'
),
'Deployment.reinstall'
=>
array
(
'name'
=>
_
(
'(Re)Install'
),
'img'
=>
'geticon.php?context=actions&icon=system-reinstall&size=16'
),
);
}
}
?>
argonaut/addons/argonaut/class_argonautEventTypes.inc
0 → 100644
View file @
47b0812f
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2015-2016 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class
argonautEventTypes
{
static
protected
function
get_event_types_list
()
{
die
(
'get_event_types_list needs to be implemented in all subclass of argonautEventTypes'
);
}
/*! \brief Returns a complete list of all available events.
@return Array Containing info for all available events.
*/
static
public
function
get_event_types
()
{
global
$class_mapping
;
if
(
session
::
is_set
(
'argonautEventTypes::get_event_types'
))
{
return
session
::
get
(
'argonautEventTypes::get_event_types'
);
}
else
{
$ret
=
array
();
foreach
(
array_keys
(
$class_mapping
)
as
$class
)
{
if
(
is_subclass_of
(
$class
,
'argonautEventTypes'
))
{
$ret
=
array_merge
(
$ret
,
$class
::
get_event_types_list
());
}
}
session
::
set
(
'argonautEventTypes::get_event_types'
,
$ret
);
return
$ret
;
}
}
/*! \brief Returns event information, like menu strings, images ...
@return Array Event informations.
*/
static
public
function
get_event_info
(
$action
)
{
$events
=
self
::
get_event_types
();
if
(
isset
(
$events
[
$action
]))
{
$infos
=
$events
[
$action
];
$infos
[
'listimg'
]
=
'<img src="'
.
$infos
[
'img'
]
.
'" title="'
.
$infos
[
'name'
]
.
'"alt="'
.
$infos
[
'name'
]
.
'" class="center"/>'
;
return
$infos
;
}
else
{
return
FALSE
;
}
}
}
class
argonautEventSystem
extends
argonautEventTypes
{
static
protected
function
get_event_types_list
()
{
return
array
(
'System.halt'
=>
array
(
'name'
=>
_
(
'Switch off'
),
'img'
=>
'geticon.php?context=actions&icon=system-shutdown&size=16'
)
);
}
}
class
argonautEventDeployment
extends
argonautEventTypes
{
static
protected
function
get_event_types_list
()
{
return
array
(
'Deployment.reboot'
=>
array
(
'name'
=>
_
(
'Reboot'
),
'img'
=>
'geticon.php?context=actions&icon=system-reboot&size=16'
),
'Deployment.wake'
=>
array
(
'name'
=>
_
(
'Wake up'
),
'img'
=>
'geticon.php?context=status&icon=task-running&size=16'
),
'Deployment.update'
=>
array
(
'name'
=>
_
(
'Software update'
),
'img'
=>
'geticon.php?context=actions&icon=system-update&size=16'
),
'Deployment.reinstall'
=>
array
(
'name'
=>
_
(
'(Re)Install'
),
'img'
=>
'geticon.php?context=actions&icon=system-reinstall&size=16'
),
);
}
}
argonaut/addons/argonaut/class_argonautImportFile.inc
View file @
47b0812f
...
...
@@ -84,7 +84,7 @@ class argonautImportFile extends simplePlugin
$this
->
attributesAccess
[
'import'
]
->
setLinearRendering
(
TRUE
);
$this
->
events
=
array
();
$this
->
daemon_events
=
argonaut
Action
::
get_event_types
();
$this
->
daemon_events
=
argonaut
EventTypes
::
get_event_types
();
}
function
execute
()
...
...
argonaut/addons/argonaut/class_argonautQueue.inc
View file @
47b0812f
...
...
@@ -103,7 +103,7 @@ class argonautQueue extends simpleManagement
$task
=
$tmp
[
'EVENT'
];
/* Create a printable job name/description */
$infos
=
argonaut
Action
::
get_event_info
(
$task
[
'HEADERTAG'
]);
$infos
=
argonaut
EventTypes
::
get_event_info
(
$task
[
'HEADERTAG'
]);
if
(
$infos
)
{
$j_name
=
$task
[
'ID'
]
.
" - "
.
$infos
[
'name'
]
.
" "
.
$task
[
'MACADDRESS'
];
}
else
{
...
...
@@ -130,7 +130,7 @@ class argonautQueue extends simpleManagement
foreach
(
$this
->
dns
as
$dn
)
{
$tmp
=
$this
->
headpage
->
getEntry
(
$dn
);
$task
=
$tmp
[
'EVENT'
];
$infos
=
argonaut
Action
::
get_event_info
(
$task
[
'HEADERTAG'
]);
$infos
=
argonaut
EventTypes
::
get_event_info
(
$task
[
'HEADERTAG'
]);
if
(
$infos
)
{
$objects
[]
=
array
(
'name'
=>
$infos
[
'name'
],
...
...
@@ -290,7 +290,7 @@ class argonautQueue extends simpleManagement
/* Check if this event exists as Daemon class
* In this case, display a more accurate entry.
*/
$infos
=
argonaut
Action
::
get_event_info
(
$tag
);
$infos
=
argonaut
EventTypes
::
get_event_info
(
$tag
);
if
(
$infos
)
{
$str
=
$infos
[
'name'
];
...
...
argonaut/addons/argonaut/class_filterArgonautEvents.inc
View file @
47b0812f
...
...
@@ -26,7 +26,7 @@ class filterArgonautEvents extends filterLDAP
global
$config
;
$o_queue
=
new
supportDaemon
();
$events
=
argonaut
Action
::
get_event_types
();
$events
=
argonaut
EventTypes
::
get_event_types
();
/* Get tags that will be used in queue searches */
$event_tags
=
array
(
"none"
);
...
...
systems/admin/ogroups/goto/class_termgroup.inc
View file @
47b0812f
...
...
@@ -174,7 +174,7 @@ class termgroup extends plugin
$action
=
$this
->
mapActions
[
$_POST
[
'saction'
]];
if
(
class_available
(
'argonautAction'
))
{
$events
=
argonaut
Action
::
get_event_types
();
$events
=
argonaut
EventTypes
::
get_event_types
();
$macaddresses
=
array
();
foreach
(
$this
->
members
as
$cn
=>
$macAddress
){
$macaddresses
[]
=
$macAddress
;
...
...
systems/admin/systems/class_systemManagement.inc
View file @
47b0812f
...
...
@@ -62,7 +62,7 @@ class systemManagement extends management
if
(
class_available
(
'argonautAction'
)
&&
class_available
(
'supportDaemon'
))
{
$this
->
headpage
->
xmlData
[
'actionmenu'
][
'action'
][
2
][
'action'
]
=
array
();
$this
->
headpage
->
xmlData
[
'actionmenu'
][
'action'
][
3
][
'action'
]
=
array
();
$events
=
argonaut
Action
::
get_event_types
();
$events
=
argonaut
EventTypes
::
get_event_types
();
foreach
(
$events
as
$name
=>
$data
)
{
$this
->
registerAction
(
"T_"
.
$name
,
"handleEvent"
);
$headpage
->
xmlData
[
'actionmenu'
][
'action'
][
2
][
'action'
][]
=
array
(
...
...
@@ -142,7 +142,7 @@ class systemManagement extends management
$mac
=
array
();
// Collect target mac addresses
$events
=
argonaut
Action
::
get_event_types
();
$events
=
argonaut
EventTypes
::
get_event_types
();
$o_queue
=
new
supportDaemon
();
foreach
(
$target
as
$dn
)
{
$obj
=
$headpage
->
getEntry
(
$dn
);
...
...
systems/admin/systems/class_workstationGeneric.inc
View file @
47b0812f
...
...
@@ -267,7 +267,7 @@ class workstationGeneric extends systemSimplePluginGlue
if
(
$activate
&&
class_available
(
'supportDaemon'
))
{
/* Send installation activation */
$events
=
argonaut
Action
::
get_event_types
();
$events
=
argonaut
EventTypes
::
get_event_types
();
if
(
isset
(
$events
[
'installation_activation'
]))
{
$o_queue
=
new
supportDaemon
();
$o_queue
->
append_call
(
'installation_activation'
,
array
(
$this
->
netConfigDNS
->
macAddress
),
array
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment