Merge branch '1865-Selección-de-grupos-vista-de-agente/módulos-dev' into 'develop'

1865 selección de grupos vista de agente/módulos dev

See merge request artica/pandorafms!1309
This commit is contained in:
vgilc 2018-02-26 10:18:38 +01:00
commit e129ebed37
1 changed files with 238 additions and 240 deletions

View File

@ -585,7 +585,14 @@ function mainAgentsModules() {
else{
$pure_var = 0;
}
echo "
}
extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png', "v1r1","view");
extensions_add_main_function('mainAgentsModules');
$ignored_params['refresh']='';
?>
<style type='text/css'>
.rotate_text_module {
-ms-transform: rotate(270deg);
@ -604,7 +611,7 @@ function mainAgentsModules() {
$.each($('.th_class_module_r'), function (i, elem) {
id = $(elem).attr('id').replace('th_module_r_', '');
width = $(\"#div_module_r_\" + id).width();
width = $("#div_module_r_" + id).width();
if (max_width < width) {
max_width = width;
@ -613,11 +620,11 @@ function mainAgentsModules() {
$.each($('.th_class_module_r'), function (i, elem) {
id = $(elem).attr('id').replace('th_module_r_', '');
$(\"#th_module_r_\" + id).height(($(\"#div_module_r_\" + id).width() + 10) + 'px');
$("#th_module_r_" + id).height(($("#div_module_r_" + id).width() + 10) + 'px');
//$(\"#div_module_r_\" + id).css('margin-top', (max_width - $(\"#div_module_r_\" + id).width()) + 'px');
$(\"#div_module_r_\" + id).css('margin-top', (max_width - 20) + 'px');
$(\"#div_module_r_\" + id).show();
//$("#div_module_r_" + id).css('margin-top', (max_width - $("#div_module_r_" + id).width()) + 'px');
$("#div_module_r_" + id).css('margin-top', (max_width - 20) + 'px');
$("#div_module_r_" + id).show();
});
var refr =" . $refr . ";
@ -633,12 +640,12 @@ function mainAgentsModules() {
$('div.vc-countdown').countdown({
until: t,
format: 'MS',
layout: '(%M%nn%M:%S%nn%S" . __('Until refresh') . ") ',
layout: '(%M%nn%M:%S%nn%S Until refresh)',
alwaysExpire: true,
onExpiry: function () {
$('div.vc-countdown').countdown('destroy');
url = js_html_entity_decode( href ) + duration;
$(document).attr (\"location\", url);
$(document).attr ("location", url);
}
});
}
@ -654,12 +661,12 @@ function mainAgentsModules() {
}
else {
var agentes_id = $(\"#id_agents2\").val();
var id_agentes = $.get(\"full_agents_id\");
var agentes_id = $("#id_agents2").val();
var id_agentes = $.get("full_agents_id");
if (agentes_id === null && id_agentes !== null) {
id_agentes = id_agentes.split(\";\")
id_agentes = id_agentes.split(";")
id_agentes.forEach(function(element) {
$(\"#id_agents2 option[value=\"+ element +\"]\").attr(\"selected\",true);
$("#id_agents2 option[value="+ element +"]").attr("selected",true);
});
selection_agent_module();
@ -670,148 +677,147 @@ function mainAgentsModules() {
});
}
$(\"#group_id\").change (function () {
jQuery.post (\"ajax.php\",
{\"page\" : \"operation/agentes/ver_agente\",
\"get_agents_group_json\" : 1,
\"id_group\" : this.value,
\"privilege\" : \"AW\",
\"keys_prefix\" : \"_\",
\"recursion\" : $('#checkbox-recursion').is(':checked')
$("#group_id").change (function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
"id_group" : this.value,
"privilege" : "AW",
"keys_prefix" : "_",
"recursion" : $('#checkbox-recursion').is(':checked')
},
function (data, status) {
$(\"#id_agents2\").html('');
$(\"#module\").html('');
$("#id_agents2").html('');
$("#module").html('');
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
option = $(\"<option></option>\")
.attr (\"value\", value[\"id_agente\"])
.html (value[\"alias\"]);
$(\"#id_agents\").append (option);
$(\"#id_agents2\").append (option);
option = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["alias"]);
$("#id_agents").append (option);
$("#id_agents2").append (option);
});
},
\"json\"
"json"
);
});
$(\"#checkbox-recursion\").change (function () {
jQuery.post (\"ajax.php\",
{\"page\" : \"operation/agentes/ver_agente\",
\"get_agents_group_json\" : 1,
\"id_group\" : $(\"#group_id\").val(),
\"privilege\" : \"AW\",
\"keys_prefix\" : \"_\",
\"recursion\" : $('#checkbox-recursion').is(':checked')
$("#checkbox-recursion").change (function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
"id_group" : $("#group_id").val(),
"privilege" : "AW",
"keys_prefix" : "_",
"recursion" : $('#checkbox-recursion').is(':checked')
},
function (data, status) {
$(\"#id_agents2\").html('');
$(\"#module\").html('');
$("#id_agents2").html('');
$("#module").html('');
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
option = $(\"<option></option>\")
.attr (\"value\", value[\"id_agente\"])
.html (value[\"alias\"]);
$(\"#id_agents\").append (option);
$(\"#id_agents2\").append (option);
option = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["alias"]);
$("#id_agents").append (option);
$("#id_agents2").append (option);
});
},
\"json\"
"json"
);
});
$(\"#modulegroup\").change (function () {
jQuery.post (\"ajax.php\",
{\"page\" : \"operation/agentes/ver_agente\",
\"get_modules_group_json\" : 1,
\"id_module_group\" : this.value,
\"id_agents\" : $(\"#id_agents2\").val(),
\"selection\" : $(\"#selection_agent_module\").val()
$("#modulegroup").change (function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_modules_group_json" : 1,
"id_module_group" : this.value,
"id_agents" : $("#id_agents2").val(),
"selection" : $("#selection_agent_module").val()
},
function (data, status) {
$(\"#module\").html('');
$("#module").html('');
if(data){
jQuery.each (data, function (id, value) {
option = $(\"<option></option>\")
.attr (\"value\", value[\"id_agente_modulo\"])
.html (value[\"nombre\"]);
$(\"#module\").append (option);
option = $("<option></option>")
.attr ("value", value["id_agente_modulo"])
.html (value["nombre"]);
$("#module").append (option);
});
}
},
\"json\"
"json"
);
});
$(\"#id_agents2\").click (function(){
$("#id_agents2").click (function(){
selection_agent_module();
});
$(\"#selection_agent_module\").change(function() {
jQuery.post (\"ajax.php\",
{\"page\" : \"operation/agentes/ver_agente\",
\"get_modules_group_json\" : 1,
\"id_module_group\" : $(\"#modulegroup\").val(),
\"id_agents\" : $(\"#id_agents2\").val(),
\"selection\" : $(\"#selection_agent_module\").val()
$("#selection_agent_module").change(function() {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_modules_group_json" : 1,
"id_module_group" : $("#modulegroup").val(),
"id_agents" : $("#id_agents2").val(),
"selection" : $("#selection_agent_module").val()
},
function (data, status) {
$(\"#module\").html('');
$("#module").html('');
if(data){
jQuery.each (data, function (id, value) {
option = $(\"<option></option>\")
.attr (\"value\", value[\"id_agente_modulo\"])
.html (value[\"nombre\"]);
$(\"#module\").append (option);
option = $("<option></option>")
.attr ("value", value["id_agente_modulo"])
.html (value["nombre"]);
$("#module").append (option);
});
}
},
\"json\"
"json"
);
});
});
function selection_agent_module() {
jQuery.post (\"ajax.php\",
{\"page\" : \"operation/agentes/ver_agente\",
\"get_modules_group_json\" : 1,
\"id_module_group\" : $(\"#modulegroup\").val(),
\"id_agents\" : $(\"#id_agents2\").val(),
\"selection\" : $(\"#selection_agent_module\").val()
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_modules_group_json" : 1,
"id_module_group" : $("#modulegroup").val(),
"id_agents" : $("#id_agents2").val(),
"selection" : $("#selection_agent_module").val()
},
function (data, status) {
$(\"#module\").html('');
$("#module").html('');
if(data){
jQuery.each (data, function (id, value) {
option = $(\"<option></option>\")
.attr (\"value\", value[\"id_agente_modulo\"])
.html (value[\"nombre\"]);
$(\"#module\").append (option);
option = $("<option></option>")
.attr ("value", value["id_agente_modulo"])
.html (value["nombre"]);
$("#module").append (option);
});
var id_modules = $.get(\"full_modules_selected\");
var id_modules = $.get("full_modules_selected");
if(id_modules !== null) {
id_modules = id_modules.split(\";\");
id_modules = id_modules.split(";");
id_modules.forEach(function(element) {
$(\"#module option[value=\"+ element +\"]\").attr(\"selected\",true);
$("#module option[value="+ element +"]").attr("selected",true);
});
}
}
},
\"json\"
"json"
);
}
(function($) {
$.get = function(key) {
key = key.replace(/[\[]/, '\\[');
key = key.replace(/[\]]/, '\\]');
var pattern = \"[\\?&]\" + key + \"=([^&#]*)\";
key = key.replace(/[[]/, '[');
key = key.replace(/[]]/, ']');
var pattern = "[?&]" + key + "=([^&#]*)";
var regex = new RegExp(pattern);
var url = unescape(window.location.href);
var results = regex.exec(url);
@ -822,13 +828,5 @@ function mainAgentsModules() {
}
}
})(jQuery);
</script>
";
}
extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png', "v1r1","view");
extensions_add_main_function('mainAgentsModules');
$ignored_params['refresh']='';
?>