[Movecommons-commits] r604 - trunk/src
Mario Gallegos
mgallegos at ourproject.org
Thu Mar 14 06:29:19 CET 2013
Author: mgallegos
Date: 2013-03-14 06:29:19 +0100 (Thu, 14 Mar 2013)
New Revision: 604
Modified:
trunk/src/mc-dia-form2.js
Log:
IN PROGRESS - Enhancement #488:Save registrations in CSV or similar
Modified: trunk/src/mc-dia-form2.js
===================================================================
--- trunk/src/mc-dia-form2.js 2013-02-04 23:45:04 UTC (rev 603)
+++ trunk/src/mc-dia-form2.js 2013-03-14 05:29:19 UTC (rev 604)
@@ -435,6 +435,84 @@
});
}
+
+ $j.createXML = function( s ) {
+ var browserName = navigator.appName;
+ var xmlDoc;
+ if ( browserName == "Microsoft Internet Explorer" ) {
+ xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
+ xmlDoc.async = "false";
+ xmlDoc.loadXML( s );
+ } else {
+ xmlDoc = ( new DOMParser() ).parseFromString( s, "text/xml" );
+ }
+ return xmlDoc;
+ };
+
+ function xmlReplaceInvalidCharacters(string){
+ if(string=='') return string;
+ var str = string;
+ str = str.replace(/&/g,'&');
+ str = str.replace(/</g,'<');
+ str = str.replace(/>/g,'>');
+ str = str.replace(/"/g,'"');
+ str = str.replace(/'/g,''');
+ return str;
+ }
+
+ function createInitiativeXml(){
+ if($j('#np-checkbox').val()=='S'){
+ nonProfitXml="<NON_PROFIT>YES</NON_PROFIT>";
+ if($j("#registered-non-profit").attr("checked"))
+ nonProfitXml+="<WE_ARE_OFFICIALLY_REGISTERED>"+xmlReplaceInvalidCharacters($j("#non-profit-website").val())+"</WE_ARE_OFFICIALLY_REGISTERED>";
+ if($j("#open-accounting").attr("checked"))
+ nonProfitXml+="<WE_HAVE_WEBPAGE_WHERE_OUR_ACCOUNTING_IS_PUBLIC>"+xmlReplaceInvalidCharacters($j("#open-accounting-website").val())+"</WE_HAVE_WEBPAGE_WHERE_OUR_ACCOUNTING_IS_PUBLIC>";
+ if($j("#accept-donations").attr("checked"))
+ nonProfitXml+="<WE_HAVE_A_WEBPAGE_TO_RECEIVE_ONLINE_DONATIONS>"+xmlReplaceInvalidCharacters($j("#donation-website").val())+"</WE_HAVE_A_WEBPAGE_TO_RECEIVE_ONLINE_DONATIONS>";
+ }else{
+ nonProfitXml="<NON_PROFIT>NO</NON_PROFIT>";
+ }
+
+ if($j('#rp-checkbox').val()=='S'){
+ initiativeReproducibleXml="<INITIATIVE_REPRODUCIBLE>YES</INITIATIVE_REPRODUCIBLE>";
+ if($j("#terms-of-use").attr("checked"))
+ initiativeReproducibleXml+="<WE_HAVE_TERMS_OF_USE_OF_OUR_CONTENTS>"+xmlReplaceInvalidCharacters($j("#terms-of-use-website").val())+"</WE_HAVE_TERMS_OF_USE_OF_OUR_CONTENTS>";
+ if($j("#creative-commons").attr("checked"))
+ initiativeReproducibleXml+="<CREATIVE_COMMONS_LICENSE_FOR_SHARING_OUR_CONTENT>"+xmlReplaceInvalidCharacters($j("#creative-commons-website").val())+"</CREATIVE_COMMONS_LICENSE_FOR_SHARING_OUR_CONTENT>";
+ if($j("#other-license").attr("checked"))
+ initiativeReproducibleXml+="<OTHER_LICENSE_FOR_SHARING_OUR_CONTENT>"+xmlReplaceInvalidCharacters($j("#other-license-website").val())+"</OTHER_LICENSE_FOR_SHARING_OUR_CONTENT>";
+ initiativeReproducibleXml+="<WE_PROVIDE_PUBLIC_DOCUMENTATION_ABOUT>";
+ if($j("#organization-structure").attr("checked"))
+ initiativeReproducibleXml+="<OUR_ORGANIZATION>YES</OUR_ORGANIZATION>";
+ else
+ initiativeReproducibleXml+="<OUR_ORGANIZATION>NO</OUR_ORGANIZATION>";
+ if($j("#internal-procedures").attr("checked"))
+ initiativeReproducibleXml+="<OUR_INTERNAL_PROCEDURES>YES</OUR_INTERNAL_PROCEDURES>";
+ else
+ initiativeReproducibleXml+="<OUR_INTERNAL_PROCEDURES>NO</OUR_INTERNAL_PROCEDURES>";
+ if($j("#list-members").attr("checked"))
+ initiativeReproducibleXml+="<OUR_LIST_OF_MEMBERS>YES</OUR_LIST_OF_MEMBERS>";
+ else
+ initiativeReproducibleXml+="<OUR_LIST_OF_MEMBERS>NO</OUR_LIST_OF_MEMBERS>";
+ if($j("#funding-sources").attr("checked"))
+ initiativeReproducibleXml+="<OUR_FUNDING_SOURCES>YES</OUR_FUNDING_SOURCES>";
+ else
+ initiativeReproducibleXml+="<OUR_FUNDING_SOURCES>NO</OUR_FUNDING_SOURCES>";
+ initiativeReproducibleXml+="</WE_PROVIDE_PUBLIC_DOCUMENTATION_ABOUT>";
+ }else{
+ nonProfitXml="<INITIATIVE_REPRODUCIBLE>NO</INITIATIVE_REPRODUCIBLE>";
+ }
+
+ xmlDoc = "<INITIATIVE>"
+ +"<NAME>"+xmlReplaceInvalidCharacters($j("#ininame").val())+"</NAME>"+
+ +"<WEB_ADDRESS>"+xmlReplaceInvalidCharacters($j("#url").val())+"</WEB_ADDRESS>"+
+ +"<LANGUAGES>"+xmlReplaceInvalidCharacters($j("#languages").val())+"</LANGUAGES>"+
+ +"<KEYWORDS>"+xmlReplaceInvalidCharacters($j("#keywords").val())+"</KEYWORDS>"+
+ +"<LOCATIONS>"+xmlReplaceInvalidCharacters($j("#locations").val())+"</LOCATIONS>"+
+ +nonProfitXml+
+ +initiativeReproducibleXml+
+ "</INITIATIVE>";
+ }
$j('#submit_first').click(function(){
More information about the Movecommons-commits
mailing list