Skip to content

Commit d28b2d4

Browse files
authored
Create script.js
1 parent a4711e5 commit d28b2d4

File tree

1 file changed

+16
-0
lines changed
  • Specialized Areas/Regular Expressions/Avoid Direct String in Widget HTML Templates -HealthScan Finding

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(function executeRule(current, previous /*null when async*/ ) {
2+
/*
3+
table: sp_widget
4+
when: Before
5+
operation: insert & update
6+
condition : Body HTML Template Changes.
7+
This BR will check if standard internationalisation is not followed, this is required for multi lingual portals and is flagged in health scan.
8+
*/
9+
var reg = />([a-zA-Z].*)<\//; // regex to check if strings are directly added in HTML Template
10+
var regex = new RegExp(reg);
11+
if (regex.test(current.getValue('template'))) {
12+
gs.addInfoMessage("Please use standard inernationalisation methods for strings like ${string} or define the string in server using gs.getMessage('string')");
13+
current.setAbortAction(true);
14+
}
15+
16+
})(current, previous);

0 commit comments

Comments
 (0)