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