diff --git a/core/modules/widgets/view.js b/core/modules/widgets/view.js index 55fb51f7e..517616e2b 100755 --- a/core/modules/widgets/view.js +++ b/core/modules/widgets/view.js @@ -57,6 +57,12 @@ ViewWidget.prototype.execute = function() { case "htmlencoded": this.text = this.getValueAsHtmlEncoded(); break; + case "urlencoded": + this.text = this.getValueAsUrlEncoded(); + break; + case "doubleurlencoded": + this.text = this.getValueAsDoubleUrlEncoded(); + break; case "date": this.text = this.getValueAsDate(this.viewTemplate); break; @@ -133,6 +139,14 @@ ViewWidget.prototype.getValueAsHtmlEncoded = function() { return $tw.utils.htmlEncode(this.getValueAsText()); }; +ViewWidget.prototype.getValueAsUrlEncoded = function() { + return encodeURIComponent(this.getValueAsText()); +}; + +ViewWidget.prototype.getValueAsDoubleUrlEncoded = function() { + return encodeURIComponent(encodeURIComponent(this.getValueAsText())); +}; + ViewWidget.prototype.getValueAsDate = function(format) { return $tw.utils.formatDateString(this.getValue(),format); };