2014-04-03 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php, include/ajax/module.php, include/functions_html.php: fixed the relationship between modules. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9714 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
5ac2b3fe10
commit
fa9811e4f8
|
@ -1,3 +1,10 @@
|
|||
2014-04-03 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/agentes/module_manager_editor.php,
|
||||
godmode/agentes/module_manager_editor_common.php,
|
||||
include/ajax/module.php, include/functions_html.php: fixed the
|
||||
relationship between modules.
|
||||
|
||||
2014-04-03 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* images/os_icons/so_router.png,
|
||||
|
|
|
@ -322,7 +322,7 @@ if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
|
|||
$policy_info = policies_info_module_policy($id_agent_module);
|
||||
$policy_id = $policy_info['id_policy'];
|
||||
|
||||
if($relink_policy && policies_get_policy_queue_status ($policy_id) == STATUS_IN_QUEUE_APPLYING) {
|
||||
if ($relink_policy && policies_get_policy_queue_status ($policy_id) == STATUS_IN_QUEUE_APPLYING) {
|
||||
ui_print_error_message(__('This policy is applying and cannot be modified'));
|
||||
}
|
||||
else {
|
||||
|
@ -428,18 +428,22 @@ echo '<h3 id="message" class="error invisible"></h3>';
|
|||
echo '<form method="post" id="module_form">';
|
||||
html_print_table ($table_simple);
|
||||
|
||||
ui_toggle(html_print_table ($table_advanced, true), __('Advanced options'));
|
||||
ui_toggle(html_print_table ($table_macros, true), __('Module macros') . ui_print_help_icon ('module_macros', true));
|
||||
ui_toggle(html_print_table ($table_new_relations, true) . html_print_table ($table_relations, true), __('Module relations'));
|
||||
ui_toggle(html_print_table ($table_advanced, true),
|
||||
__('Advanced options'));
|
||||
ui_toggle(html_print_table ($table_macros, true),
|
||||
__('Module macros') . ui_print_help_icon ('module_macros', true));
|
||||
ui_toggle(html_print_table ($table_new_relations, true) .
|
||||
html_print_table ($table_relations, true), __('Module relations'));
|
||||
|
||||
|
||||
// Submit
|
||||
echo '<div class="action-buttons" style="width: '.$table_simple->width.'">';
|
||||
if ($id_agent_module) {
|
||||
html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
|
||||
html_print_input_hidden ('update_module', 1);
|
||||
html_print_input_hidden ('id_agent_module', $id_agent_module);
|
||||
html_print_input_hidden ('id_module_type', $id_module_type);
|
||||
html_print_submit_button(__('Update'), 'updbutton', false,
|
||||
'class="sub upd"');
|
||||
html_print_input_hidden('update_module', 1);
|
||||
html_print_input_hidden('id_agent_module', $id_agent_module);
|
||||
html_print_input_hidden('id_module_type', $id_module_type);
|
||||
|
||||
if ($config['enterprise_installed'] && $remote_conf) {
|
||||
?>
|
||||
|
@ -450,7 +454,8 @@ if ($id_agent_module) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
|
||||
html_print_submit_button (__('Create'), 'crtbutton', false,
|
||||
'class="sub wand"');
|
||||
html_print_input_hidden ('id_module', $moduletype);
|
||||
html_print_input_hidden ('create_module', 1);
|
||||
|
||||
|
|
|
@ -583,7 +583,8 @@ foreach ($module_relations as $key => $module_relation) {
|
|||
if ($module_relation['module_a'] == $id_agent_module) {
|
||||
$module_id = $module_relation['module_b'];
|
||||
$agent_id = modules_give_agent_id_from_module_id ($module_relation['module_b']);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$module_id = $module_relation['module_a'];
|
||||
$agent_id = modules_give_agent_id_from_module_id ($module_relation['module_a']);
|
||||
}
|
||||
|
@ -597,23 +598,27 @@ foreach ($module_relations as $key => $module_relation) {
|
|||
|
||||
if ($module_relation['disable_update']) {
|
||||
$disabled_update_class = "";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$disabled_update_class = "transparent";
|
||||
}
|
||||
|
||||
// Agent name
|
||||
$table_relations->data[$relations_count][0] = $agent_name;
|
||||
// Module name
|
||||
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=" . $agent_id .
|
||||
$table_relations->data[$relations_count][1] =
|
||||
"<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=" . $agent_id .
|
||||
"&tab=module&edit_module=1&id_agent_module=" . $module_id . "'>" .
|
||||
ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[…]') . "</a>";
|
||||
// Lock relationship updates
|
||||
$table_relations->data[$relations_count][2] = '<a id="disable_updates_button" class="' . $disabled_update_class . '"
|
||||
href="javascript: change_lock_relation(' . $relations_count . ', ' . $module_relation['id'] . ');">'
|
||||
. html_print_image('images/lock.png', true) . '</a>';
|
||||
$table_relations->data[$relations_count][2] =
|
||||
'<a id="disable_updates_button" class="' . $disabled_update_class .
|
||||
'"href="javascript: change_lock_relation(' . $relations_count . ', ' . $module_relation['id'] . ');">' .
|
||||
html_print_image('images/lock.png', true) . '</a>';
|
||||
// Delete relationship
|
||||
$table_relations->data[$relations_count][3] = '<a id="delete_relation_button" href="javascript: delete_relation(' . $relations_count . ', ' . $module_relation['id'] . ');">'
|
||||
. html_print_image('images/cross.png', true) . '</a>';
|
||||
$table_relations->data[$relations_count][3] =
|
||||
'<a id="delete_relation_button" href="javascript: delete_relation(' . $relations_count . ', ' . $module_relation['id'] . ');">' .
|
||||
html_print_image('images/cross.png', true) . '</a>';
|
||||
$relations_count++;
|
||||
}
|
||||
|
||||
|
@ -640,6 +645,7 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#left").click (function () {
|
||||
jQuery.each($("select[name='id_tag_selected[]'] option:selected"), function (key, value) {
|
||||
tag_name = $(value).html();
|
||||
|
@ -654,6 +660,7 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-updbutton").click(function () {
|
||||
$('#id_tag_selected option').map(function(){
|
||||
$(this).attr('selected','selected');
|
||||
|
@ -772,6 +779,7 @@ function change_modules_autocomplete_input () {
|
|||
// Add a new relation
|
||||
function add_new_relation () {
|
||||
var module_a_id = parseInt($("#hidden-id_agent_module").val());
|
||||
var module_b_id = parseInt($("#hidden-autocomplete_module_name_hidden").val());
|
||||
var module_b_name = $("#text-autocomplete_module_name").val();
|
||||
var agent_b_name = $("#text-autocomplete_agent_name").val();
|
||||
var hiddenRow = $("#module_relations--1");
|
||||
|
@ -781,6 +789,7 @@ function add_new_relation () {
|
|||
var suc_icon = '<?php html_print_image ("images/ok.png", false, array("style"=>"vertical-align:middle;")) ?>';
|
||||
var error_icon = '<?php html_print_image ("images/error_red.png", false, array("style"=>"vertical-align:middle;")) ?>';
|
||||
|
||||
|
||||
if (!button.hasClass('working')) {
|
||||
button.addClass('working');
|
||||
iconPlaceholder.html(load_icon);
|
||||
|
@ -793,6 +802,7 @@ function add_new_relation () {
|
|||
page: "include/ajax/module",
|
||||
add_module_relation: true,
|
||||
id_module_a: module_a_id,
|
||||
id_module_b: module_b_id,
|
||||
name_module_b: module_b_name
|
||||
},
|
||||
success: function (data) {
|
||||
|
@ -800,7 +810,8 @@ function add_new_relation () {
|
|||
if (data === false) {
|
||||
iconPlaceholder.html(error_icon);
|
||||
setTimeout( function() { iconPlaceholder.html(''); }, 2000);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
iconPlaceholder.html(suc_icon);
|
||||
setTimeout( function() { iconPlaceholder.html(''); }, 2000);
|
||||
|
||||
|
|
|
@ -344,7 +344,8 @@ if ($get_module_autocomplete_input) {
|
|||
|
||||
ob_clean();
|
||||
if ($id_agent > 0) {
|
||||
html_print_autocomplete_modules('autocomplete_module_name', '', array($id_agent));
|
||||
html_print_autocomplete_modules(
|
||||
'autocomplete_module_name', '', array($id_agent));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
@ -360,7 +361,8 @@ if ($add_module_relation) {
|
|||
$name_module_a = get_parameter("name_module_a", "");
|
||||
if ($name_module_a) {
|
||||
$id_module_a = (int) db_get_value('id_agente_modulo', 'tagente_modulo', 'nombre', $name_module_a);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
@ -369,7 +371,8 @@ if ($add_module_relation) {
|
|||
$name_module_b = get_parameter("name_module_b", "");
|
||||
if ($name_module_b) {
|
||||
$id_module_b = (int) db_get_value('id_agente_modulo', 'tagente_modulo', 'nombre', $name_module_b);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
@ -377,6 +380,7 @@ if ($add_module_relation) {
|
|||
if ($id_module_a > 0 && $id_module_b > 0) {
|
||||
$result = modules_add_relation($id_module_a, $id_module_b);
|
||||
}
|
||||
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
@ -387,6 +391,7 @@ if ($remove_module_relation) {
|
|||
if ($id_relation > 0) {
|
||||
$result = (bool) modules_delete_relation($id_relation);
|
||||
}
|
||||
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1895,7 +1895,10 @@ function html_html2rgb($htmlcolor)
|
|||
*
|
||||
* @return mixed If the $return is true, return the output as string.
|
||||
*/
|
||||
function html_print_autocomplete_modules($name = 'module', $default = '', $id_agents = false, $ACL = true, $scriptResult = '', $filter = array(), $return = false) {
|
||||
function html_print_autocomplete_modules($name = 'module',
|
||||
$default = '', $id_agents = false, $ACL = true, $scriptResult = '',
|
||||
$filter = array(), $return = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
if ($id_agents === false) {
|
||||
|
@ -1904,10 +1907,13 @@ function html_print_autocomplete_modules($name = 'module', $default = '', $id_ag
|
|||
$groups = users_get_groups($config['id_user'], "AW", false);
|
||||
$groups = array_keys($groups);
|
||||
|
||||
$agents = db_get_all_rows_sql('SELECT id_agente FROM tagente WHERE id_grupo IN (' . implode(',', $groups) . ')');
|
||||
$agents = db_get_all_rows_sql('SELECT id_agente
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (' . implode(',', $groups) . ')');
|
||||
}
|
||||
else {
|
||||
$agents = db_get_all_rows_sql('SELECT id_agente FROM tagente');
|
||||
$agents = db_get_all_rows_sql('SELECT id_agente
|
||||
FROM tagente');
|
||||
}
|
||||
|
||||
if ($agents === false) $agents = array();
|
||||
|
@ -1941,6 +1947,7 @@ function html_print_autocomplete_modules($name = 'module', $default = '', $id_ag
|
|||
|
||||
html_print_input_text_extended ($name, $default, 'text-' . $name, '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/input_module.png) no-repeat right;'));
|
||||
html_print_input_hidden($name . "_hidden", 0);
|
||||
ui_print_help_tip(__('Type at least two characters to search the module.'), false);
|
||||
|
||||
$javascript_ajax_page =
|
||||
|
@ -1977,9 +1984,23 @@ function html_print_autocomplete_modules($name = 'module', $default = '', $id_ag
|
|||
timeout: 10000,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
response(data);
|
||||
temp = [];
|
||||
$.each(data, function (id, module) {
|
||||
temp.push({
|
||||
'value' : id,
|
||||
'label' : module});
|
||||
});
|
||||
|
||||
response(temp);
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
$("input[name='<?php echo $name; ?>_hidden']")
|
||||
.val(ui.item.value);
|
||||
|
||||
$("#text-<?php echo $name; ?>").val( ui.item.label );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue