[Movecommons-commits] r629 - trunk/src

Mario Gallegos mgallegos at ourproject.org
Fri Jun 28 20:01:51 CEST 2013


Author: mgallegos
Date: 2013-06-28 20:01:51 +0200 (Fri, 28 Jun 2013)
New Revision: 629

Modified:
   trunk/src/mc-dia-form2.js
Log:
Feedback - Enhancement #460: Generate icons and semantic code

Modified: trunk/src/mc-dia-form2.js
===================================================================
--- trunk/src/mc-dia-form2.js	2013-05-28 23:03:10 UTC (rev 628)
+++ trunk/src/mc-dia-form2.js	2013-06-28 18:01:51 UTC (rev 629)
@@ -385,7 +385,7 @@
 			case '#sixth_step':
 				$j('#progress_text').html('100% Complete');
 		        $j('#progress').css('width','339px');
-		        createInitiativeXml();
+		        createInitiativeXml(true);
 				break;	
 			default:
 				break;
@@ -534,8 +534,52 @@
 		str = str.replace(/,/g,'|');
 		return str; 
 	}
+	
+	function commasToKeywords(string){
+		var keywords = string.split(',');
+		var code='';
+		$j.each(keywords, function() {
+			code+='<div about="#'+this+'" typeof="skos:Concept"></div>';
+		});
+		return code;
+		//<div about="#bienes comunes" typeof="skos:Concept"></div>
+	}
+	
+	function commasToLanguages(string){
+		var languages = string.split(',');
+		var code='';
+		$j.each(languages, function() {
+			code+='<div rel="mc:language" resource="'+this+'"></div>';
+		});
+		return code;
+		//<div rel="mc:language" resource="es"></div>
+	}
+	
+	function submit_fifth(){
+		if(validations_step5())
+			return;		    	    	    	    	    	    			
 		
-	function createInitiativeXml(){
+		current_step='#sixth_step';
+		    	
+		if(!step_six_reached){
+			$j('#step1_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
+			$j('#step2_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
+			$j('#step3_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
+			$j('#step4_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
+			$j('#step5_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
+			imageMapUnBind();
+	    	imageMapInit();
+	    	step_six_reached=true;        		
+		}
+		
+	    $j('#progress_text').html('100% Complete');
+	    $j('#progress').css('width','339px');
+		
+		$j('#fifth_step').slideUp();
+	    $j('#sixth_step').slideDown();
+	}
+		
+	function createInitiativeXml(step6ImageClick){
 		if($j('#np-checkbox').val()=='S'){
 			nonProfitXml="<INITIATIVE_NON_PROFIT>YES</INITIATIVE_NON_PROFIT>";
 			if($j("#registered-non-profit").attr("checked"))
@@ -543,7 +587,9 @@
 			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>";		
+				nonProfitXml+="<WE_HAVE_A_WEBPAGE_TO_RECEIVE_ONLINE_DONATIONS>"+xmlReplaceInvalidCharacters($j("#donation-website").val())+"</WE_HAVE_A_WEBPAGE_TO_RECEIVE_ONLINE_DONATIONS>";	
+			if($j("#how-to-help").attr("checked"))// FALTA INCLUIR ARCHIVO DE TEXTO
+				nonProfitXml+="<WE_HAVE_A_HOW_TO_HELP_WEBPAGE>"+xmlReplaceInvalidCharacters($j("#how-to-help-website").val())+"</WE_HAVE_A_HOW_TO_HELP_WEBPAGE>";
 		}else{
 			nonProfitXml="<INITIATIVE_NON_PROFIT>NO</INITIATIVE_NON_PROFIT>";
 		}
@@ -556,7 +602,7 @@
 				reproducibleXml+="<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"))
 				reproducibleXml+="<OTHER_LICENSE_FOR_SHARING_OUR_CONTENT>"+xmlReplaceInvalidCharacters($j("#other-license-website").val())+"</OTHER_LICENSE_FOR_SHARING_OUR_CONTENT>";		
-			if($j("#organization-structure").attr("checked"))
+			if($j("#organization-structure").attr("checked")) //MODIFICAR
 				reproducibleXml+="<OUR_ORGANIZATION>YES</OUR_ORGANIZATION>";	
 			else
 				reproducibleXml+="<OUR_ORGANIZATION>NO</OUR_ORGANIZATION>";
@@ -571,18 +617,7 @@
 			if($j("#funding-sources").attr("checked"))
 				reproducibleXml+="<OUR_FUNDING_SOURCES>YES</OUR_FUNDING_SOURCES>";
 			else
-				reproducibleXml+="<OUR_FUNDING_SOURCES>NO</OUR_FUNDING_SOURCES>";
-			/*reproducibleXml+="<WE_PROVIDE_PUBLIC_DOCUMENTATION_ABOUT>";
-			if($j("#organization-structure").attr("checked"))
-				reproducibleXml+="<PUBLIC_DOCUMENTATION>OUR_ORGANIZATION</PUBLIC_DOCUMENTATION>";			
-			if($j("#internal-procedures").attr("checked"))
-				reproducibleXml+="<PUBLIC_DOCUMENTATION>OUR_INTERNAL_PROCEDURES</PUBLIC_DOCUMENTATION>";			
-			if($j("#list-members").attr("checked"))
-				reproducibleXml+="<PUBLIC_DOCUMENTATION>OUR_LIST_OF_MEMBERS</PUBLIC_DOCUMENTATION>";			
-			if($j("#funding-sources").attr("checked"))
-				reproducibleXml+="<PUBLIC_DOCUMENTATION>OUR_FUNDING_SOURCES</PUBLIC_DOCUMENTATION>";			
-			reproducibleXml+="</WE_PROVIDE_PUBLIC_DOCUMENTATION_ABOUT>";
-			*/			
+				reproducibleXml+="<OUR_FUNDING_SOURCES>NO</OUR_FUNDING_SOURCES>";			
 		}else{
 			reproducibleXml="<INITIATIVE_REPRODUCIBLE>NO</INITIATIVE_REPRODUCIBLE>";
 		}
@@ -644,6 +679,8 @@
 			data: $j.createXML(xmlDoc),			
 			success: function(xmlData) {				
 				$('#loader').hide();
+				if(!step6ImageClick)
+					submit_fifth();
 				alert("Dev msg: Your data has been successfully saved!!");				
 			}
 		});
@@ -651,7 +688,92 @@
 	}
 	
 	function generate_sematic_code(){
-		$j('#semantic_code').val("");
+		
+		var code='<div id="move-commons-badge"><div xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:mc="http://movecommons.org/ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" about="http://comunes.org" typeof="mc:Collective"></div>';
+		var pText='Move Commons',comma='';
+		code+='<div property="foaf:name" content="'+$j("#ininame").val()+'"></div>';//name
+		code+='<div rel="foaf:homepage" href="'+$j("#url").val()+'"></div>';//web address
+		code+=commasToLanguages($j("#languages").val());
+		code+='<div rel="mc:locationActivity" resource="'+$j("#location").val()+'"></div>';
+		
+		nonProfitcode=''; 
+		if($j('#np-checkbox').val()=='S'){
+			pText+=comma+' Non-Profit';
+			comma=',';
+			code+='<div rel="mc:moveCommonsType" resource="[mc:NonProfit]"></div>';
+			if($j("#registered-non-profit").attr("checked"))
+				nonProfitCode='<div rel="mc:officiallyRegisteredPage" href="'+$j("#non-profit-website").val()+'"></div>';
+			if($j("#open-accounting").attr("checked"))
+				nonProfitCode='<div rel="mc:openAccountingPage" href="'+$j("#open-accounting-website").val()+'"></div>';
+			if($j("#accept-donations").attr("checked"))
+				nonProfitCode='<div rel="mc:donationPage" href="'+$j("#donation-website").val()+'"></div>';
+			if($j("#how-to-help").attr("checked"))
+				nonProfitCode='<div rel="mc:howToHelpPage" href="'+$j("#how-to-help-website").val()+'"></div>';
+		}
+		
+		//<div rel="mc:howToHelpPage" href="http://comunes.org/join"></div>
+		
+		reproduciblecode='';
+		if($j('#rp-checkbox').val()=='S'){			
+			pText+=comma+' Reproducible';
+			comma=',';
+			code+='<div rel="mc:moveCommonsType" resource="[mc:Reproducible]"></div>';
+			if($j("#terms-of-use").attr("checked"))
+				reproducibleCode+='<div rel="mc:tosPage" href="'+$j("#terms-of-use-website").val()+'"></div>'; 
+			if($j("#creative-commons").attr("checked")) 
+				reproducibleCode+='<div rel="license" href="'+$j("#creative-commons-website").val()+'"></div>';
+			if($j("#other-license").attr("checked"))
+				reproducibleCode+='<div rel="license" href="'+$j("#other-license-website").val()+'"></div>';	
+			
+			//<div rel="mc:sharesFundingSource" href="http://comunes.org/XXXXXXX"></div>
+			//<div rel="mc:sharesInternalOrganization" href="http://comunes.org/XXXXXXX"></div>
+			//<div rel="mc:sharesMemberList" href="http://comunes.org/about"></div>
+			//<div rel="mc:sharesInternalProcedures" href="http://comunes.org/XXXXXXX"></div>
+			
+			if($j("#organization-structure").attr("checked"))
+				reproducibleCode+="<OUR_ORGANIZATION>YES</OUR_ORGANIZATION>";	
+			if($j("#internal-procedures").attr("checked"))
+				reproducibleCode+="<OUR_INTERNAL_PROCEDURES>YES</OUR_INTERNAL_PROCEDURES>";	
+			if($j("#list-members").attr("checked"))
+				reproducibleCode+="<OUR_LIST_OF_MEMBERS>YES</OUR_LIST_OF_MEMBERS>";
+			if($j("#funding-sources").attr("checked"))
+				reproducibleCode+="<OUR_FUNDING_SOURCES>YES</OUR_FUNDING_SOURCES>";			
+		}
+		
+		grassrootsCode='';
+		if($j('#gr-checkbox').val()=='S'){
+			pText+=comma+' Representative';
+			comma=',';
+			code+='<div rel="mc:moveCommonsType" resource="[mc:Representative]"></div>';
+			if($j("#decisions-general-assemblies").attr("checked"))
+				grassrootsCode+='<div rel="mc:hasFormOrg" resource="[mc:Consensus]"></div>';
+			if($j("#representatives-democratically").attr("checked"))
+				grassrootsCode+='<div rel="mc:hasFormOrg" resource="[mc:Assembly]"></div>';			
+			if($j("#decisions-voting").attr("checked"))
+				grassrootsCode+='<div rel="mc:focusesIn" resource="[mc:Digital]"></div>';	
+		}
+		
+		if($j('#rc-checkbox').val()=='S'){			
+			if($j('#mc-form-icon-rc').attr('src')=='/mc/0.1/images/rcec60.png'){
+				code+='<div rel="mc:moveCommonsType" resource="[mc:ReinforcesCommons]"></div>';//nature commons
+				pText+=comma+' Reinforcing the Ecology Commons';
+			}else if($j('#mc-form-icon-rc').attr('src')=='/mc/0.1/images/rcbo60.png'){
+				code+='<div rel="mc:moveCommonsType" resource="[mc:ReinforcesCommons]"></div>';//BODY/HEALTH COMMONS
+				pText+=comma+' Reinforcing the Ecology Commons';
+			}else if($j('#mc-form-icon-rc').attr('src')=='/mc/0.1/images/rcto60.png'){
+				code+='<div rel="mc:moveCommonsType" resource="[mc:ReinforcesCommons]"></div>';//TOWN/COMMUNITY/SOCIETY COMMONS
+				pText+=comma+' Reinforcing the Ecology Commons';
+			}else{
+				code+='<div rel="mc:moveCommonsType" resource="[mc:ReinforcesCommons]"></div>';//DIGITAL COMMONS
+				pText+=comma+' Reinforcing the Ecology Commons';
+			}	
+		}
+		
+		code=code+nonProfitcode+reproduciblecode+grassrootsCode;
+		code+=commasToKeywords($j("#keywords").val());
+		code+='<a href="http://movecommons.org/en/np-rp-rc.ec-rs/0.1<img src="http://movecommons.org/mc/0.1/images/" alt="'+pText+'" /></a><p>'+pText+'</p>'
+		
+		$j('#semantic_code').val(code);
 	}
 	
 	    
@@ -865,30 +987,8 @@
 	
 	$j('#submit_fifth').click(function(){
 		
-		if(validations_step5())
-			return;		    	    	    	    	    	    			
-		
-		current_step='#sixth_step';
-		    	
-		if(!step_six_reached){
-			$j('#step1_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
-			$j('#step2_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
-			$j('#step3_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
-			$j('#step4_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
-			$j('#step5_image_map').append('<area href="#" step="#sixth_step" shape="circle" coords="490,12,12"><!--6-->');
-			imageMapUnBind();
-	    	imageMapInit();
-	    	step_six_reached=true;        		
-		}
-		
-	    $j('#progress_text').html('100% Complete');
-	    $j('#progress').css('width','339px');
-		
-		$j('#fifth_step').slideUp();
-	    $j('#sixth_step').slideDown();		  
+		createInitiativeXml(false);
 	    
-	    createInitiativeXml();
-	    
 	});
 		
 	




More information about the Movecommons-commits mailing list