Changeset 31951 for main/trunk
- Timestamp:
- 2017-09-07T17:57:31+12:00 (7 years ago)
- Location:
- main/trunk/greenstone2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/macros/deposit.dm
r29403 r31951 194 194 \} 195 195 196 var inputObj; 196 var inputObj; 197 197 if (metadataField.type=="text") \{ 198 198 inputObj = document.createElement("input"); … … 221 221 222 222 function check\_submit (gotopage) \{ 223 224 // escape any commas in the metadata fields in order to preserve them 225 // preserve any commas in the metadata fields by escaping them here 226 // so that meta values containing commas don't end up split at comma by depositoraction.cpp 227 228 // Get just the part of form containing metadata input elements 229 // as we don't want to modify any other part of the form 230 var formContainer = document.getElementById('formcontainer'); 231 // https://stackoverflow.com/questions/25302684/getting-all-child-input-elements-within-a-div 232 var inputNodes = formContainer.getElementsByTagName('input'); 233 for(var i = 0; i < inputNodes.length; i++) \{ 234 var inputNode = inputNodes[i]; 235 if(inputNode.type == 'text') \{ 236 if(inputNode.value) \{ 237 var val = inputNode.value; 238 // To replace all occurrences in a string, and not just the 1st, need to do a global 239 // substitution. See https://www.w3schools.com/jsref/jsref_replace.asp 240 inputNode.value = val.replace(/,/g, "%2C"); 241 \} 242 \} 243 \} 244 245 // Proceed as usual from here on to submit the modified form 246 223 247 var form = document.depositorform; 224 248 form.p.value = gotopage; -
main/trunk/greenstone2/runtime-src/src/recpt/depositoraction.cpp
r31687 r31951 833 833 cerr << "args val = "<<args_val<<endl; 834 834 decode_cgi_arg(args_val); 835 cerr << "decoded " << args_val<<endl;835 cerr << "decoded = " << args_val<<endl; 836 836 text_t args_suffix = substr(args_name.begin()+prefix_len+3,args_name.end()); 837 837 … … 846 846 metadata_file += args_suffix; 847 847 metadata_file += "\">"; 848 metadata_file += xml_safe(mdvalues[i]); 848 // originally literal commas entered for metadata like dc.Subject 849 // come in (extra) URL encoded, as %2C at this point in the code 850 // Decode any commas now before writing them into metadata.xml 851 metadata_file += xml_safe(decode_commas(mdvalues[i])); 849 852 metadata_file += "</Metadata>\n"; 850 853
Note:
See TracChangeset
for help on using the changeset viewer.