From: Rajat Gupta <
rajat....@gmail.com>
1) Added i18n string for JS.
2) Added hidden input to have English value of rule type which is passed to API.
3) Modified JS to show translated value of rule type in listing and edit rule panel.
Signed-off-by: Rajat Gupta <
rajat....@gmail.com>
---
ui/js/host-admin-editrule.js | 7 +++++--
ui/js/host-admin.js | 16 +++++++++++++++-
ui/pages/host-admin-EditAuditRule.html.tmpl | 3 ++-
ui/pages/host-admin-editControlRule.html.tmpl | 3 ++-
ui/pages/host-admin-editSystemRule.html.tmpl | 3 ++-
ui/pages/i18n.json.tmpl | 3 +++
6 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/ui/js/host-admin-editrule.js b/ui/js/host-admin-editrule.js
index a0f6940..f242040 100644
--- a/ui/js/host-admin-editrule.js
+++ b/ui/js/host-admin-editrule.js
@@ -74,10 +74,11 @@ ginger.loadRuleValues = function() {
});
EditRule = $('#AuditEdit');
Ruletype = $('#rule-type', EditRule);
+ TRuletype = $('#t-rule-type', EditRule);
Permission = $('#permissionID', EditRule);
File = $('#filetowatch', EditRule);
Key = $('#keyedit', EditRule);
- Ruletype.val(Rtype);
+ TRuletype.val(i18n['GINAUDIT0080M']);
var per = (JSON.parse(selectedRows)['permissions']);
for (var i = 0; i < per.length; i++) {
if (per[i] == "r") {
@@ -165,6 +166,7 @@ ginger.loadControlRuleValues = function() {
}
EditRule = $('#AuditControl');
Ruletype = $('#rule-type', EditRule);
+ TRuletype = $('#t-rule-type', EditRule);
option = $('#optionid', EditRule);
var picker = $('.selectpicker');
if (controloption == "-b") {
@@ -184,7 +186,7 @@ ginger.loadControlRuleValues = function() {
$('.selectpicker').selectpicker('refresh');
$('#rvaluedata').val(controlvalue.trim());
}
- Ruletype.val(Rtype);
+ TRuletype.val(i18n['GINAUDIT0079M']);
$('.selectpicker').selectpicker('refresh');
return ruleName;
}
@@ -310,6 +312,7 @@ ginger.loadSystemcallRuleValues = function() {
}
}
$('#rule-type').val("System Call Rule");
+ $('#t-rule-type').val(i18n['GINAUDIT0078M']);
$('#sysaction').selectpicker("val", rulearray['action'].trim());
$('#sysfilter').selectpicker("val", rulearray['filter'].trim());
var selectrule = [];
diff --git a/ui/js/host-admin.js b/ui/js/host-admin.js
index 931eee7..cccb54b 100644
--- a/ui/js/host-admin.js
+++ b/ui/js/host-admin.js
@@ -939,7 +939,14 @@ ginger.loadAuditRulesData = function(){
var rows = "";
$.each(result, function(index, rule){
rows += "<tr><td>" + (index+1) + "</td>";
- rows += "<td>" + rule.type + "</td>";
+ if(rule.type=="System Call Rule"){
+ type = i18n['GINAUDIT0078M'];
+ }else if(rule.type=="Control Rule"){
+ type = i18n['GINAUDIT0079M'];
+ }else if(rule.type=="File System Rule"){
+ type = i18n['GINAUDIT0080M'];
+ }
+ rows += "<td>" + type + "</td>";
var ruleDetails = rule.rule;
var titleValue = "";
var syscallStartIndex = ruleDetails.indexOf("-S");
@@ -1090,6 +1097,13 @@ $('#Audit-Rule-Edit-btn').click(function() {
};
wok.confirm(settings, function() {}, function() {});
} else {
+ if(ruleName==i18n['GINAUDIT0078M']){
+ ruleName = "System Call Rule";
+ }else if(ruleName==i18n['GINAUDIT0079M']){
+ ruleName = "Control Rule";
+ }else if(ruleName==i18n['GINAUDIT0080M']){
+ ruleName = "File System Rule";
+ }
if (ruleName == "File System Rule") {
wok.window.open('plugins/ginger/host-admin-EditAuditRule.html');
} else if (ruleName == "Control Rule") {
diff --git a/ui/pages/host-admin-EditAuditRule.html.tmpl b/ui/pages/host-admin-EditAuditRule.html.tmpl
index 5efdce1..c78d70e 100644
--- a/ui/pages/host-admin-EditAuditRule.html.tmpl
+++ b/ui/pages/host-admin-EditAuditRule.html.tmpl
@@ -43,7 +43,8 @@
<div class="form-group">
<label class="col-sm-4" for="rule-type">$_("Rule Type")</label>
<div class="col-sm-8 col-xs-3">
- <input id="rule-type" class="form-control" name="ruletype" type="text" disabled/>
+ <input id="rule-type" class="form-control" name="ruletype" type="text" disabled style="display: none;" value="File System Rule"/>
+ <input id="t-rule-type" class="form-control" name="truletype" type="text" disabled/>
</div>
</div>
<div class="form-group">
diff --git a/ui/pages/host-admin-editControlRule.html.tmpl b/ui/pages/host-admin-editControlRule.html.tmpl
index 319f61e..6656f69 100644
--- a/ui/pages/host-admin-editControlRule.html.tmpl
+++ b/ui/pages/host-admin-editControlRule.html.tmpl
@@ -43,7 +43,8 @@
<div class="form-group">
<label class="col-sm-4" for="rule-type">$_("Rule Type")</label>
<div class="col-sm-8 col-xs-3">
- <input id="rule-type" class="form-control" name="ruletype" type="text" disabled/>
+ <input id="rule-type" class="form-control" name="ruletype" type="text" disabled style="display: none;" value="Control Rule"/>
+ <input id="t-rule-type" class="form-control" name="truletype" type="text" disabled />
</div>
</div>
<div class="form-group">
diff --git a/ui/pages/host-admin-editSystemRule.html.tmpl b/ui/pages/host-admin-editSystemRule.html.tmpl
index e0a13b2..dc3fb9f 100644
--- a/ui/pages/host-admin-editSystemRule.html.tmpl
+++ b/ui/pages/host-admin-editSystemRule.html.tmpl
@@ -43,7 +43,8 @@
<div class="form-group">
<label class="col-md-5 col-lg-5">$_("Type")</label>
<div class="col-md-7 col-lg-7">
- <input id="rule-type" class="form-control " name="ruletype" type="text" disabled/></div>
+ <input id="rule-type" class="form-control " name="ruletype" type="text" disabled style="display: none;" value="System Call Rule"/>
+ <input id="t-rule-type" class="form-control " name="truletype" type="text" disabled/></div>
</div>
<div class="form-group">
<label class="col-md-5 col-lg-5">$_("Action")</label>
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index 264dc9a..d00a0bf 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -434,6 +434,9 @@
"GINAUDIT0075M": "$_("Please enter Path to File.")",
"GINAUDIT0076M": "$_("Please enter the permissions")",
"GINAUDIT0077M": "$_("Please provide value for the selected option.")",
+ "GINAUDIT0078M": "$_("System Call Rule")",
+ "GINAUDIT0079M": "$_("Control Rule")",
+ "GINAUDIT0080M": "$_("File System Rule")",
"GINAUDIFILTER0001M":"$_("Audit Event ID")",
"GINAUDIFILTER0002M":"$_("Architecture [b32 | b64]")",
"GINAUDIFILTER0003M":"$_("Command")",
--
2.1.0