amalgame/commit

FIXED: enabling/disabling controls

authorJacco van Ossenbruggen
Tue Sep 9 18:55:54 2014 +0200
committerJacco van Ossenbruggen
Tue Sep 9 18:55:54 2014 +0200
commit44a800be32ffc9dab9fc11e0eb0cc444a2f3870a
treed2d16e64c483e8934a80185611bd85872b992939
parent0807b02551d493ed67ca2d7e97120126ce52ac5f
Diff style: patch stat
diff --git a/components/amalgame/controls.pl b/components/amalgame/controls.pl
index 240264e..d3f3439 100644
--- a/components/amalgame/controls.pl
+++ b/components/amalgame/controls.pl
@@ -228,13 +228,13 @@ html_accordion_item(Class, Header, Body) -->
 %	InpuType defines for which type of input the module can be
 %	used.
 
-module_input_type(M, mapping) :-
+module_input_type(M, 'mapping input') :-
 	rdfs_subclass_of(M, amalgame:'MappingPartitioner'),
 	!.
-module_input_type(M, vocab) :-
+module_input_type(M, 'vocab source_target') :-
 	rdfs_subclass_of(M, amalgame:'CandidateGenerator'),
 	!.
-module_input_type(M, vocab) :-
+module_input_type(M,  'vocab input') :-
 	rdfs_subclass_of(M, amalgame:'VocabPartitioner'),
 	!.
 module_input_type(_, 'always_active').
diff --git a/web/js/controls.js b/web/js/controls.js
index ca75b40..a5d2465 100644
--- a/web/js/controls.js
+++ b/web/js/controls.js
@@ -70,8 +70,6 @@ YUI.add('controls', function(Y) {
 		},
 
 		currentConceptChange : function(ev) {
-			Y.log('currentConceptChange');
-			Y.log(ev);
 			var targets = null;
 			var c = this.get('currentConcept');
 			if (ev.type == "controls:currentConceptChange")
@@ -79,7 +77,7 @@ YUI.add('controls', function(Y) {
 			else
 				targets = new Y.NodeList(ev.currentTarget);
 			if (c)
-				targets.each(function(n) { Y.log(c); n.set("value", c.id); });
+				targets.each(function(n) { n.set("value", c.id); });
 			else
 				targets.each(function(n) { n.set("value",
 					"Enter URI of the parent concept  manually or select the concept in the vocabulary browser");
@@ -98,7 +96,7 @@ YUI.add('controls', function(Y) {
 
 			// The input is selected based on the type of the control
 			// which is stored as a CSS class
-			if( node.hasClass("vocab") ||
+			if( node.hasClass("source_target") ||
 			    node.hasClass("preloaded") ) {
 				data.source = source;
 				data.target = target;
@@ -197,14 +195,14 @@ YUI.add('controls', function(Y) {
 				  // auto set target if only one other vocab exists:
 				  this._valueSet(target, "target");
 				}
-			} else if(type=="mapping") {
+			}
+			if(type=="mapping" || type=="vocab" ) { 
 				 NODE_INPUT_BTN.removeAttribute("disabled");
 				 this._valueSet(selected, "input");
 			}
 
 			var preloadedSelecter = Y.one(".preloaded select option")
 			if(!preloadedSelecter) {
-			  //Y.log("Disabling components requiring preloaded input mappings");
 			  Y.all(".preloaded").addClass("disabled");
 			}
 			// enable generator submit when both source and target have a value
@@ -271,15 +269,6 @@ YUI.add('controls', function(Y) {
 				Y.one("#"+which+'Label').set("value", selected.label);
 				Y.one("#"+which).set("value", selected.uri);
 			}
-			if(which=="input") {
-				Y.one("#sourceLabel").set("value", "");
-				Y.one("#source").set("value", "");
-				Y.one("#targetLabel").set("value", "");
-				Y.one("#target").set("value", "");
-			} else {
-				Y.one("#inputLabel").set("value", "");
-				Y.one("#input").set("value", "");
-			}
 		}
 
 	});