Updated Branches: refs/heads/4.1 0fa108f03 -> 74cb0e2b8
Adding disallowSpecialCharacters to some fields Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/74cb0e2b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/74cb0e2b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/74cb0e2b Branch: refs/heads/4.1 Commit: 74cb0e2b881995855e788be1620f10cd7f68d253 Parents: 0fa108f Author: Chip Childers <[email protected]> Authored: Tue Jul 23 14:59:41 2013 -0400 Committer: Chip Childers <[email protected]> Committed: Tue Jul 23 14:59:41 2013 -0400 ---------------------------------------------------------------------- client/WEB-INF/classes/resources/messages.properties | 1 + ui/dictionary.jsp | 1 + ui/index.jsp | 6 +++--- ui/scripts/ui-custom/zoneWizard.js | 2 +- ui/scripts/ui/widgets/detailView.js | 2 +- ui/scripts/ui/widgets/listView.js | 5 +++++ ui/scripts/ui/widgets/multiEdit.js | 2 ++ 7 files changed, 14 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74cb0e2b/client/WEB-INF/classes/resources/messages.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index a074639..f0fa18b 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -16,6 +16,7 @@ # under the License. #Stored by I18NEdit, may be edited! +message.validate.invalid.characters=Invalid characters found; please correct. ICMP.code=ICMP Code ICMP.type=ICMP Type changed.item.properties=Changed item properties http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74cb0e2b/ui/dictionary.jsp ---------------------------------------------------------------------- diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp index 5081356..4e31697 100644 --- a/ui/dictionary.jsp +++ b/ui/dictionary.jsp @@ -25,6 +25,7 @@ under the License. <% long now = System.currentTimeMillis(); %> <script language="javascript"> dictionary = { +'message.validate.invalid.characters': '<fmt:message key="message.validate.invalid.characters" />', 'label.enable.s3': '<fmt:message key="label.enable.s3"/>', 'confirm.enable.s3': '<fmt:message key="confirm.enable.s3"/>', 'message.after.enable.s3': '<fmt:message key="message.after.enable.s3"/>', http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74cb0e2b/ui/index.jsp ---------------------------------------------------------------------- diff --git a/ui/index.jsp b/ui/index.jsp index 5b43e62..dcb64bc 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -289,7 +289,7 @@ under the License. <div class="field name hide-if-unselected"> <div class="name"> <span class="field-required">*</span> <fmt:message key="label.name"/></div> <div class="value"> - <input type="text" class="required" name="new-network-name" /> + <input type="text" class="required disallowSpecialCharacters" name="new-network-name" /> </div> </div> @@ -339,7 +339,7 @@ under the License. <span><fmt:message key="label.name"/> (<fmt:message key="label.optional"/>)</span> </div> <div class="value"> - <input type="text" name="displayname" /> + <input type="text" name="displayname" class="disallowSpecialCharacters" /> </div> </div> <!-- Add to group --> @@ -348,7 +348,7 @@ under the License. <span><fmt:message key="label.add.to.group"/> (<fmt:message key="label.optional"/>)</span> </div> <div class="value"> - <input type="text" name="groupname" /> + <input type="text" name="groupname" class="disallowSpecialCharacters" /> </div> </div> <!-- Zone --> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74cb0e2b/ui/scripts/ui-custom/zoneWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/zoneWizard.js b/ui/scripts/ui-custom/zoneWizard.js index 0d4525f..fef59a7 100644 --- a/ui/scripts/ui-custom/zoneWizard.js +++ b/ui/scripts/ui-custom/zoneWizard.js @@ -576,7 +576,7 @@ $('<label>').html('Physical network name') ), $('<div>').addClass('value').append( - $('<input>').attr({ type: 'text' }).addClass('required') + $('<input>').attr({ type: 'text' }).addClass('required disallowSpecialCharacters') ) ); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74cb0e2b/ui/scripts/ui/widgets/detailView.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js index 4b4fbd5..2ca5849 100644 --- a/ui/scripts/ui/widgets/detailView.js +++ b/ui/scripts/ui/widgets/detailView.js @@ -541,7 +541,7 @@ name: name, type: 'text', value: data - }).data('original-value', data) + }).addClass('disallowSpecialCharacters').data('original-value', data) ); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74cb0e2b/ui/scripts/ui/widgets/listView.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js index 9e16ec2..25a8eb1 100644 --- a/ui/scripts/ui/widgets/listView.js +++ b/ui/scripts/ui/widgets/listView.js @@ -486,6 +486,11 @@ showEditField(); } else if ($editInput.val() != $label.html()) { //click Save button with changed value + if ($editInput.val().match(/<|>/)) { + cloudStack.dialog.notice({ message: 'message.validate.invalid.characters' }); + return false; + } + $edit.animate({ opacity: 0.5 }); var originalName = $label.html(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74cb0e2b/ui/scripts/ui/widgets/multiEdit.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js index fe6c145..bfaf5e7 100755 --- a/ui/scripts/ui/widgets/multiEdit.js +++ b/ui/scripts/ui/widgets/multiEdit.js @@ -790,6 +790,7 @@ $(field.range).each(function() { //e.g. field.range = ['privateport', 'privateendport']; var $input = $('<input>') + .addClass('disallowSpecialCharacters') .attr({ name: this, type: 'text' @@ -814,6 +815,7 @@ type: field.isPassword ? 'password' : 'text' }) .addClass(!field.isOptional ? 'required' : null) + .addClass('disallowSpecialCharacters') .attr('disabled', field.isDisabled ? 'disabled' : false) .appendTo($td);
