2010-10-14 Sergio Martin <sergio.martin@artica.es>
* include/functions_modules.php godmode/agentes/module_manager.php godmode/agentes/configurar_agente.php: Added clone module into an agent to the manage modules view git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3404 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c802715dc3
commit
12a12d5959
|
@ -1,3 +1,10 @@
|
|||
2010-10-14 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_modules.php
|
||||
godmode/agentes/module_manager.php
|
||||
godmode/agentes/configurar_agente.php: Added clone module
|
||||
into an agent to the manage modules view
|
||||
|
||||
2010-10-14 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* operation/agentes/exportdata.php: Safe output the autocomplete
|
||||
|
|
|
@ -276,7 +276,7 @@ if ($id_agente) {
|
|||
|
||||
$onheader = array('view' => $viewtab, 'separator' => "", 'main' => $maintab, 'module' => $moduletab, 'alert' => $alerttab, 'template' => $templatetab, 'inventory' => $inventorytab, 'collection'=> $collectiontab, 'group' => $grouptab, 'gis' => $gistab);
|
||||
|
||||
print_page_header (__('Agent configuration').' - '.mb_substr(get_agent_name ($id_agente), 0, 21), "images/setup.png", false, "", true, $onheader);
|
||||
print_page_header (__('Agent configuration').' - '.printTruncateText(get_agent_name ($id_agente)), "images/setup.png", false, "", true, $onheader);
|
||||
|
||||
}
|
||||
// Create agent
|
||||
|
@ -477,6 +477,7 @@ if ($id_agente) {
|
|||
$update_module = (bool) get_parameter ('update_module');
|
||||
$create_module = (bool) get_parameter ('create_module');
|
||||
$delete_module = (bool) get_parameter ('delete_module');
|
||||
$duplicate_module = (bool) get_parameter ('duplicate_module');
|
||||
$edit_module = (bool) get_parameter ('edit_module');
|
||||
|
||||
// GET DATA for MODULE UPDATE OR MODULE INSERT
|
||||
|
@ -746,6 +747,16 @@ if ($delete_module){ // DELETE agent module !
|
|||
}
|
||||
}
|
||||
|
||||
// MODULE DUPLICATION
|
||||
// =================
|
||||
if ($duplicate_module){ // DUPLICATE agent module !
|
||||
$id_duplicate_module = (int) get_parameter_get ("duplicate_module",0);
|
||||
$result = copy_agent_module_to_agent ($id_duplicate_module,
|
||||
get_agentmodule_agent($id_duplicate_module),
|
||||
__('copy of').' '.get_agentmodule_name($id_duplicate_module));
|
||||
debugPrint(var_dump($result));
|
||||
}
|
||||
|
||||
// UPDATE GIS
|
||||
// ==========
|
||||
$updateGIS = get_parameter('update_gis', 0);
|
||||
|
|
|
@ -67,7 +67,7 @@ if (! isset ($id_agente))
|
|||
return;
|
||||
|
||||
|
||||
$multiple_delete = get_parameter('multiple_delete');
|
||||
$multiple_delete = (bool) get_parameter('multiple_delete');
|
||||
|
||||
if ($multiple_delete) {
|
||||
$id_agent_modules_delete = (array)get_parameter('id_delete');
|
||||
|
@ -240,7 +240,7 @@ $table->style = array ();
|
|||
$table->style[0] = 'font-weight: bold';
|
||||
$table->size = array ();
|
||||
$table->size[2] = '55px';
|
||||
$table->size[7] = '65px';
|
||||
$table->size[7] = '90px';
|
||||
$table->align = array ();
|
||||
$table->align[2] = 'center';
|
||||
$table->align[7] = 'left';
|
||||
|
@ -366,6 +366,11 @@ foreach ($modules as $module) {
|
|||
$data[7] .= print_image ('images/cross.png', true,
|
||||
array ('title' => __('Delete')));
|
||||
$data[7] .= '</a> ';
|
||||
$data[7] .= '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&duplicate_module='.$module['id_agente_modulo'].'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[7] .= print_image ('images/copy.png', true,
|
||||
array ('title' => __('Duplicate')));
|
||||
$data[7] .= '</a> ';
|
||||
|
||||
// Make a data normalization
|
||||
|
||||
|
|
|
@ -26,15 +26,19 @@
|
|||
*
|
||||
* @param int Source agent module id.
|
||||
* @param int Detiny agent id.
|
||||
* @param string Forced name to the new module.
|
||||
*
|
||||
* @return New agent module id on success. Existing module id if it already exists.
|
||||
* False on error.
|
||||
*/
|
||||
function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent) {
|
||||
function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $forced_name = false) {
|
||||
$module = get_agentmodule ($id_agent_module);
|
||||
if ($module === false)
|
||||
return false;
|
||||
|
||||
if($forced_name !== false)
|
||||
$module['nombre'] = $forced_name;
|
||||
|
||||
$modules = get_agent_modules ($id_destiny_agent, false,
|
||||
array ('nombre' => $module['nombre'], 'disabled' => false));
|
||||
|
||||
|
|
Loading…
Reference in New Issue