[Movecommons-commits] r611 - trunk/src

Mario Gallegos mgallegos at ourproject.org
Fri Mar 15 23:27:22 CET 2013


Author: mgallegos
Date: 2013-03-15 23:27:21 +0100 (Fri, 15 Mar 2013)
New Revision: 611

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-03-15 17:16:49 UTC (rev 610)
+++ trunk/src/mc-dia-form2.js	2013-03-15 22:27:21 UTC (rev 611)
@@ -327,6 +327,7 @@
 			case '#sixth_step':
 				$j('#progress_text').html('100% Complete');
 		        $j('#progress').css('width','339px');
+		        createInitiativeXml();
 				break;	
 			default:
 				break;
@@ -461,6 +462,14 @@
 		return str;
 	}
 	
+	function xmlDynamicTags(tag,string){
+		var array = string.split(','),xml='';		
+		$.each(array, function(index, value) {
+			xml+="<"+tag+">"+xmlReplaceInvalidCharacters(value)+"</"+tag+">\n";
+		});
+		return xml;
+	}
+		
 	function createInitiativeXml(){
 		if($j('#np-checkbox').val()=='S'){
 			nonProfitXml="<INITIATIVE_NON_PROFIT>YES</INITIATIVE_NON_PROFIT>\n";
@@ -484,21 +493,13 @@
 				reproducibleXml+="<OTHER_LICENSE_FOR_SHARING_OUR_CONTENT>"+xmlReplaceInvalidCharacters($j("#other-license-website").val())+"</OTHER_LICENSE_FOR_SHARING_OUR_CONTENT>\n";		
 			reproducibleXml+="<WE_PROVIDE_PUBLIC_DOCUMENTATION_ABOUT>\n";
 			if($j("#organization-structure").attr("checked"))
-				reproducibleXml+="<OUR_ORGANIZATION>YES</OUR_ORGANIZATION>\n";
-			else
-				reproducibleXml+="<OUR_ORGANIZATION>NO</OUR_ORGANIZATION>\n";
+				reproducibleXml+="<PUBLIC_DOCUMENTATION>OUR_ORGANIZATION</PUBLIC_DOCUMENTATION>\n";			
 			if($j("#internal-procedures").attr("checked"))
-				reproducibleXml+="<OUR_INTERNAL_PROCEDURES>YES</OUR_INTERNAL_PROCEDURES>\n";
-			else
-				reproducibleXml+="<OUR_INTERNAL_PROCEDURES>NO</OUR_INTERNAL_PROCEDURES>\n";
+				reproducibleXml+="<PUBLIC_DOCUMENTATION>OUR_INTERNAL_PROCEDURES</PUBLIC_DOCUMENTATION>\n";			
 			if($j("#list-members").attr("checked"))
-				reproducibleXml+="<OUR_LIST_OF_MEMBERS>YES</OUR_LIST_OF_MEMBERS>\n";
-			else
-				reproducibleXml+="<OUR_LIST_OF_MEMBERS>NO</OUR_LIST_OF_MEMBERS>\n";
+				reproducibleXml+="<PUBLIC_DOCUMENTATION>OUR_LIST_OF_MEMBERS</PUBLIC_DOCUMENTATION>\n";			
 			if($j("#funding-sources").attr("checked"))
-				reproducibleXml+="<OUR_FUNDING_SOURCES>YES</OUR_FUNDING_SOURCES>\n";
-			else
-				reproducibleXml+="<OUR_FUNDING_SOURCES>NO</OUR_FUNDING_SOURCES>\n";
+				reproducibleXml+="<PUBLIC_DOCUMENTATION>OUR_FUNDING_SOURCES</PUBLIC_DOCUMENTATION>\n";			
 			reproducibleXml+="</WE_PROVIDE_PUBLIC_DOCUMENTATION_ABOUT>\n";
 		}else{
 			reproducibleXml="<INITIATIVE_REPRODUCIBLE>NO</INITIATIVE_REPRODUCIBLE>\n";
@@ -533,19 +534,19 @@
 			else
 				reinforceCommonsXml+="<MAIN_FOCUS_OF_THE_INITIATIVE>DIGITAL_COMMONS</MAIN_FOCUS_OF_THE_INITIATIVE>\n";
 		}else{
-			reinforceCommonsXml="<INITIATIVE_REINFORCE_THE_COMMONS>YES</INITIATIVE_REINFORCE_THE_COMMONS>\n";
+			reinforceCommonsXml="<INITIATIVE_REINFORCE_THE_COMMONS>NO</INITIATIVE_REINFORCE_THE_COMMONS>\n";
 		}
 		
 		xmlDoc = "<INITIATIVE>\n" 
 					+"<NAME>"+xmlReplaceInvalidCharacters($j("#ininame").val())+"</NAME>\n"+
 					"<WEB_ADDRESS>"+xmlReplaceInvalidCharacters($j("#url").val())+"</WEB_ADDRESS>\n"+
-					"<LANGUAGES>"+xmlReplaceInvalidCharacters($j("#languages").val())+"</LANGUAGES>\n"+
-					"<KEYWORDS>"+xmlReplaceInvalidCharacters($j("#keywords").val())+"</KEYWORDS>\n"+
+					"<LANGUAGES>\n"+xmlDynamicTags('LANGUAGE',$j("#languages").val())+"</LANGUAGES>\n"+
+					"<KEYWORDS>\n"+xmlDynamicTags('KEYWORD',$j("#keywords").val())+"</KEYWORDS>\n"+
 					"<LOCATIONS>"+xmlReplaceInvalidCharacters($j("#location").val())+"</LOCATIONS>\n"+
-					nonProfitXml+"\n"+
-					reproducibleXml+"\n"+
-					grassrootsXml+"\n"+
-					reinforceCommonsXml+"\n"+
+					nonProfitXml+
+					reproducibleXml+
+					grassrootsXml+
+					reinforceCommonsXml+
 				"</INITIATIVE>";		
 		alert(xmlDoc);
 	}




More information about the Movecommons-commits mailing list