1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

Feature #600: Auto-escape double quotes in ranks and requirements.

This patch auto-escapes the double quotes of the requirements and rank fields at the time of submitting the new template form. If the quotes were escaped already then they are ignored.
This commit is contained in:
Hector Sanjuan 2011-05-11 16:35:28 +02:00 committed by Daniel Molina
parent 2c0652ed6b
commit dd180620dd
2 changed files with 15 additions and 3 deletions

View File

@ -1749,9 +1749,15 @@ function setupCreateTemplateDialog(){
vm_json["CONTEXT"][name]=value;
});
//placement -> fetch with value
scope = section_placement;
addSectionJSON(vm_json,scope);
//placement -> fetch with value, escape double quotes
scope = section_placement;
var requirements = $('input#REQUIREMENTS',scope).val();
requirements = escapeDoubleQuotes(requirements);
$('input#REQUIREMENTS',scope).val(requirements);
var rank = $('input#RANK',scope).val();
rank = escapeDoubleQuotes(rank);
$('input#RANK',scope).val(rank);
addSectionJSON(vm_json,scope);
//raw -> if value set type to driver and fetch
scope = section_raw;

View File

@ -405,6 +405,12 @@ function makeSelectOptions(dataTable,
return select;
}
//Escape " in a string and return it
function escapeDoubleQuotes(string){
string = string.replace(/\\"/g,'"');
return string.replace(/"/g,'\\"');
}
//functions that used as true and false conditions for testing mainly
function True(){
return true;