From e207bc5b497bb41db3292e31177ae59f8fd0303a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 13 Mar 2011 14:37:26 +0100 Subject: [PATCH] fix pluginurl validation --- .../src/main/webapp/resources/js/sonia.config.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.config.js b/scm-webapp/src/main/webapp/resources/js/sonia.config.js index 4b87c16ad7..1530a35368 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.config.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.config.js @@ -85,6 +85,18 @@ Sonia.config.RepositoryConfig = Ext.extend(Sonia.config.ConfigPanel,{ Ext.reg("repositoryConfig", Sonia.config.RepositoryConfig); +// pluginurl validator +Ext.apply(Ext.form.VTypes, { + + pluginurl: function(val) { + return this.pluginurlRegex.test(val); + }, + + pluginurlRegex: /(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!\{\}]*)(\.\w{2,})?)*\/?)/i, + pluginurlText: 'This field should be a URL in the format \n\ + "http://plugins.scm-manager.org/scm-plugin-backend/api/{version}/plugins?os={os}&arch={arch}&snapshot=false"' +}); + Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{ titleText: 'General Settings', @@ -134,7 +146,7 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{ xtype: 'textfield', fieldLabel: this.pluginRepositoryText, name: 'plugin-url', - vtype: 'url', + vtype: 'pluginurl', allowBlank: false },{ xtype: 'checkbox',