Index: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js	(revision 1907)
+++ MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js	(revision 1918)
@@ -81,5 +81,5 @@
 	//}
 	var x = "<div id='" + this.j + "' class='sc-j or_level' ><div id='" + this.listid + "' class='sc-wrapper focused' > " +
-	"<div class='search'><span class='index-search'><select class='index_select'/><input type='text' class='index-input-termset autocomplete-input' /><input type='text' class='index-input autocomplete-input' /></span>" + 
+	"<div class='search'><span class='cmd cmd_sc_autocomplete cmd_sca_explain'></span><span class='index-search'><select class='index_select'/><input type='text' class='index-input-termset autocomplete-input' /><input type='text' class='index-input autocomplete-input' /></span>" + 
 	//index_detail +
 	//"<select type='text' class='rel_input' />" +
@@ -212,5 +212,6 @@
 	
 	try{
-		this.initAutocomplete();
+		this.initAutocomplete(false);
+		this.initAutocomplete(true);
 	} catch (e){
 		notifyUser("autocomplete failed: " + e.message);
@@ -219,37 +220,74 @@
  };
  
- SearchClause.prototype.initAutocomplete = function(){
-	
-	if (element_autocomplete.length == 0) return;
-	 
-	$(this.GetIndexInputTermset()).autocomplete({
-			source: element_autocomplete,
-			autoFill:true,
-			width:150,
-			//onFindValue:findValueTermset,
-			//onItemSelect:selectItemTermset,
-			minLength: 0,
-			matchContains:true,
-			delay: 0,
-			select: function( event, ui ) {
-				$(this).data("item", ui.item);
-				selectItemTermset(ui.item);
-			}
-		}).data( "autocomplete" )._renderItem = function( ul, item ) { 
-			var t, re;
-			if (this.term == ""){
-				t = item.value;
-			} else {
-				re = new RegExp(this.term + "+") ; 
-			    t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" +  
-			            this.term +  
-			            "</span>"); 
-			}
-			
-		    return $( "<li></li>" ) 
-		        .data( "item.autocomplete", item ) 
-		        .append( "<a>" + t + "</a>" ) 
-		        .appendTo( ul ); 
-	}; 
+
+ SearchClause.prototype.initAutocomplete = function(is_explain){
+	
+	 if (is_explain){
+			if (element_autocomplete_explain.length == 0) return;
+			 
+			$(this.GetIndexInputTermset()).autocomplete({
+					source: element_autocomplete_explain,
+					autoFill:true,
+					width:150,
+					//onFindValue:findValueTermset,
+					//onItemSelect:selectItemTermset,
+					minLength: 0,
+					matchContains:true,
+					delay: 0,
+					select: function( event, ui ) {
+						$(this).data("item", ui.item);
+						selectItemTermsetExplain(ui.item);
+					}
+				}).data( "autocomplete" )._renderItem = function( ul, item ) { 
+					var t, re;
+					if (this.term == ""){
+						t = item.value;
+					} else {
+						re = new RegExp(this.term + "+") ; 
+					    t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" +  
+					            this.term +  
+					            "</span>"); 
+					}
+					
+				    return $( "<li></li>" ) 
+				        .data( "item.autocomplete", item ) 
+				        .append( "<a>" + t + "</a>" ) 
+				        .appendTo( ul ); 
+			}; 
+
+	 } else {
+			if (element_autocomplete.length == 0) return;
+			 
+			$(this.GetIndexInputTermset()).autocomplete({
+					source: element_autocomplete,
+					autoFill:true,
+					width:150,
+					//onFindValue:findValueTermset,
+					//onItemSelect:selectItemTermset,
+					minLength: 0,
+					matchContains:true,
+					delay: 0,
+					select: function( event, ui ) {
+						$(this).data("item", ui.item);
+						selectItemTermset(ui.item);
+					}
+				}).data( "autocomplete" )._renderItem = function( ul, item ) { 
+					var t, re;
+					if (this.term == ""){
+						t = item.value;
+					} else {
+						re = new RegExp(this.term + "+") ; 
+					    t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" +  
+					            this.term +  
+					            "</span>"); 
+					}
+					
+				    return $( "<li></li>" ) 
+				        .data( "item.autocomplete", item ) 
+				        .append( "<a>" + t + "</a>" ) 
+				        .appendTo( ul ); 
+			}; 
+
+	 }
 	$('body').find('.ac_results').css({'z-index' : '1000'});
 	 
@@ -619,10 +657,10 @@
 	},
 	
-	initAutocomplete: function() {
+	initAutocomplete: function(is_explain) {
 		notifyUser("init autocomplete",'debug');
 		
 		for (var i = this.searchclauses.length - 1; i > -1; i--){
 			for (var j = this.searchclauses[i].length - 1; j > -1; j--){
-					this.searchclauses[i][j].initAutocomplete();		
+					this.searchclauses[i][j].initAutocomplete(is_explain);		
 			}
 		}	
@@ -674,26 +712,4 @@
 
 //autocomplete
-// not used
-function handleTermsSelection(i,j,elem){
-			/*
-			var context = $('#' + 'sc' +  i + '-' + j).find('.index-context');
-			// fill context
-			//$(context).remove();
-			$(context).html(elements_hashtable[elem]);
-			$(context).show();
-			//notifyUser($('#' + 'sc' +  i + '-' + j).find('.index-input').val(), 'debug');
-			//$('#' + 'sc' +  i + '-' + j).find('.index-input').focus();
-			
-			$('#' + 'sc' +  i + '-' + j).find('.index-input').blur(function(){
-				$(context).hide();
-			});
-			$('#' + 'sc' +  i + '-' + j).find('.index-input').focusin(function(){
-				$(context).hide();
-			});
-			*/
-			//$('#' + 'sc' +  i + '-' + j).find('.index-input').hide();
-			//$('#' + 'sc' +  i + '-' + j).find('.index-input-termset').show();
-			
-};
 	
 function findValueValue(e) {
@@ -707,5 +723,4 @@
 	
 }
- 
 function selectItemValue(li) {
 	findValueValue(li);
@@ -754,61 +769,118 @@
 	
 };
+function initValueAutocompleteExplain(i,j,index, term_index){
+	
+	// reset the index value
+	$('#' + 'sc' +  i + '-' + j).find('.value-input').val("");
+	searchclauseset.searchclauses[i][j].value = "";
+	$('#' + 'sc' +  i + '-' + j).find('.value-input').show();
+	$('body').find('.ac_results').css({'z-index' : '1000'});
+	
+	
+	$('.focused','#searchclauselist').find('.value-input').focus();
+
+	
+};
 
 function findValueTerm(e) {
-			
-			//var sValue = e.selectValue;
-			
-			var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
-			var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
-			//alert(i+ ',' + j + sValue);
-			var termsetitem = $('#' + 'sc' +  i + '-' + j).find('.index-input-termset').data('item');
-			var termset = "";
-			if (termsetitem != null) termset = termsetitem.key;
-			var str = e.id;
-			str = str.substring(str.lastIndexOf('/')+1, str.length);
-			var termsetindex = termset + ":" +  str;
-			searchclauseset.searchclauses[i][j].index = termsetindex;
-			
-			//handleTermsSelection(i,j,sValue);	
-			//find element value
-		
-			var index;
-			$.each(element_autocomplete,function(i, item){
-				if (this.key == termset){
-					index = i;
-					return;
-				}
-			});
-			var term_index;
-			
-			$.each(element_autocomplete[index].data,function(i, item){
-				if (this.id == e.id){
-					term_index = i;
-					return;
-				}
-			});
-			if (element_autocomplete[index].data[term_index].values.length == 0){
-			jQuery.get(link('fcs','?operation=scan&scanClause=' + termsetindex + '&x-context=clarin.eu:mdrepo'),function(data){
-				$(data).find("sru\\:term").each(function(i){
-					element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('sru\\:value').text()};
-				});
-				initValueAutocomplete(i,j, index, term_index);
-				});
-			} else {
-				initValueAutocomplete(i,j, index, term_index);
-			}
-			
-			
+	
+	//var sValue = e.selectValue;
+	
+	var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
+	var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
+	//alert(i+ ',' + j + sValue);
+	var sClause = $('#' + 'sc' +  i + '-' + j);
+	var context = "";
+	var termsetitem = $(sClause).find('.index-input-termset').data('item');
+	var termset = "";
+	if (termsetitem != null) termset = termsetitem.key;
+	var str = e.id;
+	str = str.substring(str.lastIndexOf('/')+1, str.length);
+	var termsetindex = termset + ":" +  str;
+	searchclauseset.searchclauses[i][j].index = termsetindex;
+	
+	//handleTermsSelection(i,j,sValue);	
+	//find element value
+
+	var index;
+	$.each(element_autocomplete,function(i, item){
+		if (this.key == termset){
+			index = i;
+			return;
+		}
+	});
+	var term_index;
+	
+	$.each(element_autocomplete[index].data,function(i, item){
+		if (this.id == e.id){
+			term_index = i;
+			return;
+		}
+	});
+	if (element_autocomplete[index].data[term_index].values.length == 0){
+		jQuery.get(link('fcs','?operation=scan&scanClause' + termsetindex + '&x-context=' + getSelectedRepository()),function(data){
+		$(data).find("sru\\:term").each(function(i){
+			element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('sru\\:value').text()};
+		});
+		initValueAutocomplete(i,j, index, term_index);
+		});
+	} else {
+		initValueAutocomplete(i,j, index, term_index);
+	}	
 }
-		 
+function findValueTermExplain(e) {
+	
+	//var sValue = e.selectValue;
+	
+	var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
+	var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
+	//alert(i+ ',' + j + sValue);
+	var sClause = $('#' + 'sc' +  i + '-' + j);
+	var context = "";
+	var termsetitem = $(sClause).find('.index-input-termset').data('item');
+	var termset = "";
+	if (termsetitem != null) termset = termsetitem.key;
+	var str = e.id;
+	str = str.substring(str.lastIndexOf('/')+1, str.length);
+	var termsetindex = termset + ":" +  str;
+	searchclauseset.searchclauses[i][j].index = termsetindex;
+	
+	//find element value
+
+	var index;
+	$.each(element_autocomplete_explain,function(i, item){
+		if (this.key == termset){
+			index = i;
+			return;
+		}
+	});
+	var term_index;
+	
+	$.each(element_autocomplete_explain[index].data,function(i, item){
+		if (this.id == e.id){
+			term_index = i;
+			return;
+		}
+	});
+	if (element_autocomplete_explain[index].data[term_index].values.length == 0){
+		jQuery.get(link('fcs','?operation=scan&scanClause' + termsetindex + '&x-context=' + getSelectedRepository()),function(data){
+		$(data).find("sru\\:term").each(function(i){
+			element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('sru\\:value').text()};
+		});
+		initValueAutocompleteExplain(i,j, index, term_index);
+		});
+	} else {
+		initValueAutocompleteExplain(i,j, index, term_index);
+	}	
+}
+ 
 function selectItemTerm(li) {
-			findValueTerm(li);
-		}
+	findValueTerm(li);
+}
+function selectItemTermExplain(li) {
+	findValueTermExplain(li);
+}
 
 function initTermsetAutocomplete(i,j,index){
-	//$('#' + 'sc' +  i + '-' + j).find('.index-input').hide();
-	
-	// not working
-	//searchclauseset.searchclauses[i][j].initAutocompleteTerms(elem);
 
 	$('#' + 'sc' +  i + '-' + j).find('.index-input').autocomplete({
@@ -816,6 +888,4 @@
 		autoFill:true,
 		width:150,
-		//onFindValue:findValueTerm,
-		//onItemSelect:selectItemTerm,
 		minLength: 0,
 		matchContains:true,
@@ -824,5 +894,5 @@
 			$(this).data("item", ui.item);
 			selectItemTerm(ui.item);
-		}
+			}
 	}).data( "autocomplete" )._renderItem = function( ul, item ) { 
 		var t, re;
@@ -835,15 +905,17 @@
 		            "</span>"); 
 		}
-		
-	    return $( "<li></li>" ) 
-	        .data( "item.autocomplete", item ) 
-	        .append( "<a>" + t + "</a>" ) 
-	        .appendTo( ul ); 
+	
+		return $( "<li></li>" ) 
+		    .data( "item.autocomplete", item ) 
+		    .append( "<a>" + t + "</a>" ) 
+		    .appendTo( ul ); 
 	};
-
-	
-	// reset the index value
+	
+	
+		// reset the index value
 	$('#' + 'sc' +  i + '-' + j).find('.index-input').val("");
 	searchclauseset.searchclauses[i][j].index = "";
+	$('#' + 'sc' +  i + '-' + j).find('.value-input').val("");
+	searchclauseset.searchclauses[i][j].value = "";
 	$('#' + 'sc' +  i + '-' + j).find('.index-input').show();
 	$('body').find('.ac_results').css({'z-index' : '1000'});
@@ -851,34 +923,56 @@
 	
 	$('.focused','#searchclauselist').find('.index-input').focus();
-
-	
-};
-/*
-function handleTermsetSelection(i,j,elem){
-	
-	// create apropriate array, than initialize autocomplete
-	if ($('#elements_hashtable_'+elem).children().length == 0) {
-		$('#elements_hashtable_'+elem).load(link('smc','list/?context='+elem),function(){
-			//var e = $(this).attr("id");
-			$(this).find('Term').each(function(index){
-				elements_hashtable[elem][index] = $(this).text();
-			});
-			initTermsetAutocomplete(i,j,elem);
-		});
-	} else {
-		initTermsetAutocomplete(i,j,elem);
-	}	
-};
-*/
+};
+function initTermsetAutocompleteExplain(i,j,index){
+
+	$('#' + 'sc' +  i + '-' + j).find('.index-input').autocomplete({
+		source: element_autocomplete_explain[index].data,
+		autoFill:true,
+		width:150,
+		minLength: 0,
+		matchContains:true,
+		delay: 0,
+		select: function( event, ui ) {
+			$(this).data("item", ui.item);
+			selectItemTermExplain(ui.item);
+			}
+	}).data( "autocomplete" )._renderItem = function( ul, item ) { 
+		var t, re;
+		if (this.term == ""){
+			t = item.value;
+		} else {
+			re = new RegExp(this.term + "+") ; 
+		    t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" +  
+		            this.term +  
+		            "</span>"); 
+		}
+	
+		return $( "<li></li>" ) 
+		    .data( "item.autocomplete", item ) 
+		    .append( "<a>" + t + "</a>" ) 
+		    .appendTo( ul ); 
+	};
+	
+	
+		// reset the index value
+		$('#' + 'sc' +  i + '-' + j).find('.index-input').val("");
+		searchclauseset.searchclauses[i][j].index = "";
+		$('#' + 'sc' +  i + '-' + j).find('.index-input').show();
+		$('body').find('.ac_results').css({'z-index' : '1000'});
+	
+	
+		$('.focused','#searchclauselist').find('.index-input').focus();
+};
+
 
 function findValueTermset(elem) {
 	//var sValue = e.selectValue;
-	
+
 	var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
 	var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
-	
+
 	//searchclauseset.searchclauses[i][j].index = sValue;	
 	//handleTermsetSelection(i,j,sValue);		
-	
+
 	//find element
 	var index;
@@ -889,5 +983,5 @@
 		}
 	});
-	
+
 	if (element_autocomplete[index].data.length == 0){
 		jQuery.get(link('smc','list/?context=' + element_autocomplete[index].key),function(data){
@@ -900,9 +994,38 @@
 		initTermsetAutocomplete(i,j, index);
 	}
-	
 }
- 
+function findValueTermsetExplain(elem) {
+	
+	var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
+	var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
+
+		//find element
+	var index;
+	$.each(element_autocomplete_explain,function(i, item){
+		if (this.key == elem.key){
+			index = i;
+			return;
+		}
+	});
+
+	if (element_autocomplete_explain[index].data.length == 0){
+		jQuery.get(link('fcs','?operation=explain&x-context=' + getSelectedRepository()),function(data){
+			$(data).find('indexInfo').children('index').children('map').children('name[set='+ element_autocomplete_explain[index].key +']').each(function(i){
+				element_autocomplete_explain[index].data[i] = {label:$(this).text(), value:$(this).text(), id:$(this).text(),values:[] };
+			});
+			initTermsetAutocompleteExplain(i,j, index);
+		});
+	} else {
+		initTermsetAutocompleteExplain(i,j, index);
+	}
+
+}
+
+
 function selectItemTermset(li) {
 	findValueTermset(li);
-}
-
+	}
+function selectItemTermsetExplain(li) {
+	findValueTermsetExplain(li);
+	}
+
Index: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js	(revision 1907)
+++ MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js	(revision 1918)
@@ -69,5 +69,5 @@
 
 function getSelectedRepository(){
-	return $('#repositories_select').find("option:selected").text();
+	return $('select[name="x-context"]').find("option:selected").val();
 }
 
@@ -84,4 +84,14 @@
  */
 function addFunctionality(){
+	
+	//change context_selects
+	$('select[name=x-context]').live('click', function(){
+		//delete the autocomplete arrays, reset the index input values
+		//element_autocomplete.splice(0, element_autocomplete.length);
+		element_autocomplete_explain.splice(0, element_autocomplete_explain.length );
+		searchclauseset.clear();
+		//load new
+		loadTermsAutocompleteExplain();
+	});
 	
 	//switch the input simple query vs complex query
@@ -205,4 +215,11 @@
 	
 	
+	
+	$('.cmd_sc_autocomplete').live('click',  function(event) {
+		var i = $(this).closest('.sc-i').attr('id');
+		var j = $(this).closest('.sc-j').attr('id');
+		searchclauseset.searchclauses[i][j].initAutocomplete($(this).hasClass('cmd_sca_explain'));
+		$(this).toggleClass('cmd_sca_explain cmd_sca_smc');					
+	});
 	
 	// cmd_up cmd_down
Index: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_load.js
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_load.js	(revision 1907)
+++ MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_load.js	(revision 1918)
@@ -19,5 +19,4 @@
 	//loadComponentsRegistry();	
 	//loadDCR();
-
 }
 
@@ -240,11 +239,39 @@
 }
 
+function loadTermAutocompleteExplain(){
+	$('#termset_autocomplete_explain').children().remove();
+	$('#termset_autocomplete_explain').css('display','none');
+	$('#terms_autocomplete_explain').children().remove();
+	$('#terms_autocomplete_explain').css('display','none');
+
+	$('#termset_autocomplete_explain').load(link('fcs','?operation=explain&x-context=' + getSelectedRepository()),function(){
+		$(this).find("indexInfo").children("set").each(function(index){
+			//element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('index').children('title').text()};
+			var _key, _name, _id, _parent, _isleaf = 0; 
+			_key = $(this).attr("name");
+			_name = $(this).children("title").text();
+			_parent = $(this).parents('indexInfo');
+			_id = $(this).attr("identifier");
+			_isleaf = 1;//TODO
+			
+			element_autocomplete_explain[index] = { label:_name, value:_name, key:_key, id:_id, parent:_parent, isleaf:_isleaf, data:[]};	
+		});
+		// add autocomplete 's
+		//searchclauseset.initAutocomplete(true);
+		//columns_widget.initAutocomplete(element_autocomplete_explain, true);
+	});
+
+};
+
 function loadTermsAutocomplete(){
 	
-	var elem;
+	//var elem;
 	$('#termset_autocomplete').children().remove();
 	$('#termset_autocomplete').css('display','none');
 	$('#terms_autocomplete').children().remove();
 	$('#terms_autocomplete').css('display','none');
+	
+
+	//$.get(link('smc','list/?context=*'),function(){
 	$('#termset_autocomplete').load(link('smc','list/?context=*'),function(){
 		$(this).find('Termset').each(function(index){
@@ -265,7 +292,11 @@
 		});
 		// add autocomplete 's
-		searchclauseset.initAutocomplete();
-		columns_widget.initAutocomplete(element_autocomplete);
-	});
+		searchclauseset.initAutocomplete(false);
+		//columns_widget.initAutocomplete(element_autocomplete);
+		//load explain autocomplete array
+		loadTermAutocompleteExplain();
+	});
+	
+	
 };
 
Index: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_settings.js
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_settings.js	(revision 1907)
+++ MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_settings.js	(revision 1918)
@@ -19,4 +19,5 @@
 
 var  element_autocomplete = new Array();
+var  element_autocomplete_explain = new Array();
 var  elements_hashtable =  {};
 
Index: MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/GenericAction.java
===================================================================
--- MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/GenericAction.java	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/GenericAction.java	(revision 1918)
@@ -24,4 +24,5 @@
 import eu.clarin.cmdi.mdservice.model.Diagnostic;
 import eu.clarin.cmdi.mdservice.model.Diagnostics;
+import eu.clarin.cmdi.mdservice.model.Repositories;
 import eu.clarin.cmdi.mdservice.model.WorkspaceProfile;
 import eu.clarin.cmdi.mdservice.proxy.ProxyInterface;
@@ -208,5 +209,5 @@
 	
 	public String getMaxdepth() {
-		 return getParam("maxdepth");
+		 return getParam("x-maximumDepth");
 	}
 	 
@@ -377,9 +378,9 @@
 		
 		if ( params.get("x-cmd-maxdepth") == null){
-			if (params.get("maxdepth") == null){
-				addParam("maxdepth","2");
+			if (params.get("x-maximumDepth") == null){
+				addParam("x-maximumDepth","2");
 			} 
 		} else {
-			addParam("maxdepth",params.get("x-cmd-maxdepth")[0]);
+			addParam("x-maximumDepth",params.get("x-cmd-maxdepth")[0]);
 		}
 		/*
@@ -401,5 +402,7 @@
 			addParam("x-context",params.get("x-cmd-repository")[0]);
 		}
-		
+		if (params.get("x-context") == null){
+			addParam("x-context",Repositories.getRepositories().getRepositoryByIndex(0));
+		}
 		if ( params.get("x-cmd-cache") == null){
 			if (params.get("cache") == null){
@@ -433,4 +436,13 @@
 
 		addParam("fullformat",getFullFormat());
+		
+		if (params.get("base_url") == null){
+			addParam("base_url",Utils.getConfig("base.uri"));
+		}
+		
+		if (params.get("scripts_url") == null){
+			addParam("scripts_url",Utils.getConfig("webscripts.uri"));
+		}
+		
 	}
 	/**
Index: MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/RepoAction.java
===================================================================
--- MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/RepoAction.java	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/RepoAction.java	(revision 1918)
@@ -132,5 +132,5 @@
 			
 			if (!Repositories.getRepositories().repositoryExists(getRepository())){
-				getDiagnostics().Add(Diagnostic.UNSUPPORTED_PARAMETERVALUE, "repository", "repository=" + getRepository() );
+				getDiagnostics().Add(Diagnostic.UNSUPPORTED_PARAMETERVALUE, "repository", "repository=" + getRepository() );					
 				return;
 			}
Index: MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/model/Query.java
===================================================================
--- MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/model/Query.java	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/model/Query.java	(revision 1918)
@@ -79,5 +79,5 @@
 		sarr = new String[1];
 		sarr[0] = "1";
-		put("maxdepth", sarr);
+		put("x_maximumDepth", sarr);
 		
 	}};
@@ -410,8 +410,8 @@
 		if (type.equals(MODEL)) {
 			//targetRequest = fromCMDIndex2Xpath() + "&maxdepth=" + getMaxdepth()  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
-			targetRequest = fromCMDIndex2Xpath() + "&maxdepth=" + getParam("maxdepth")  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
+			targetRequest = fromCMDIndex2Xpath() + "&maxdepth=" + getParam("x-maximumDepth")  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
 		} 
 		else if (type.equals(COLLECTION)) {
-			targetRequest = getParam("collection") + "&maxdepth=" + getParam("maxdepth")  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
+			targetRequest = getParam("collection") + "&maxdepth=" + getParam("x-maximumDepth")  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
 
 		} else if (type.equals(SRUEXTERN)) {
Index: MDService2/branches/MDService_simple3/src/mdservice.properties
===================================================================
--- MDService2/branches/MDService_simple3/src/mdservice.properties	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/mdservice.properties	(revision 1918)
@@ -5,5 +5,6 @@
 terms.file=terms_setup.xml
 webscripts.uri = /MDService2
-base.uri = /MDService2
+//base.uri = /MDService2
+base.uri =http://localhost:8080/MDService2/fcs
 virtualcollection.uri = http://clarin.ids-mannheim.de/vcr/service/virtualcollection
 
Index: MDService2/branches/MDService_simple3/src/xsl/fcs/commons_v1.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/fcs/commons_v1.xsl	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/xsl/fcs/commons_v1.xsl	(revision 1918)
@@ -21,6 +21,4 @@
     <xsl:template match="/">
 		<!--<xsl:message>root_document-uri:<xsl:value-of select="$root_uri"/>
-			</xsl:message>
-			<xsl:message>format:<xsl:value-of select="$format"/>
 			</xsl:message>-->
         <xsl:choose>
Index: MDService2/branches/MDService_simple3/src/xsl/fcs/html_snippets.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/fcs/html_snippets.xsl	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/xsl/fcs/html_snippets.xsl	(revision 1918)
@@ -22,4 +22,35 @@
             <link href="{$base_dir}/style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet"/>        
             </xsl:if>-->
+            
+            
+            <xsl:if test="contains($format,'htmljspage')">
+		<link href="{$scripts_url}/style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet" />
+		<link href="{$scripts_url}/style/jquery/treetable/jquery.treeTable.css" rel="stylesheet" ></link>
+		<link href="{$scripts_url}/style/jquery/jquery-autocomplete/jquery-ui.css" rel="stylesheet" type="text/css"></link>
+	
+		<script src="{$scripts_url}/scripts/jquery/js/jquery.min.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/jquery/js/jquery-ui.min.js" type="text/javascript"></script>
+		
+		<script src="{$scripts_url}/scripts/jquery/jquery-treeview/jquery.treeview.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/jquery/jquery-treeTable/jquery.treeTable.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/jquery/jsTree.v.1.0rc2/jquery.jstree.js" type="text/javascript"></script>
+		
+		<script src="{$scripts_url}/scripts/mdservice_helpers.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/jquery/jquery-layout/jquery.layout-1.3.0.rc29.12.js" type="text/javascript"></script>
+		
+		<script src="{$scripts_url}/scripts/mdservice_ui_settings.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/mdservice_helpers.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/mdservice_ui_helpers.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/mdservice_widgets.js" type="text/javascript"></script>
+		
+		<script src="{$scripts_url}/scripts/mdservice_searchclause.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/mdservice_model.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/mdservice_pz2.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/mdservice_ui_detail.js" type="text/javascript"></script>
+		<script src="{$scripts_url}/scripts/mdservice_ui_load.js" type="text/javascript"></script>
+		
+		<script src="{$scripts_url}/scripts/mdservice_ui.js" type="text/javascript"></script>
+				
+	</xsl:if>
     </xsl:template>
     <xsl:template name="page-header">
@@ -156,4 +187,8 @@
                 </form>
             </div>
+            <!-- gs -->
+            <div id="termset_autocomplete" />
+            <div id="termset_autocomplete_explain" />
+			<div id="terms_autocomplete" />
         </div>
     </xsl:template>
@@ -232,4 +267,5 @@
             </span>
         </a>
+        
     </xsl:template>
     <xsl:template name="query-list">
Index: MDService2/branches/MDService_simple3/src/xsl/fcs/params.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/fcs/params.xsl	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/xsl/fcs/params.xsl	(revision 1918)
@@ -24,4 +24,6 @@
     
     <!-- gs -->
+    <xsl:param name="x_maximumDepth" select="0" />
+    <xsl:param name="autocolumns_limit" select="6" />
     <xsl:param name="name_element" select="('title', 'name', 'resourcename', 'md-title')"  />
 	
Index: MDService2/branches/MDService_simple3/src/xsl/fcs/result2view_v1.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/fcs/result2view_v1.xsl	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/xsl/fcs/result2view_v1.xsl	(revision 1918)
@@ -25,6 +25,6 @@
                     <xsl:call-template name="header"/>
                 </xsl:if>
-                <xsl:apply-templates select="sru:records" mode="list"/>
-    <!-- switch mode depending on the $format-parameter -->        
+				<xsl:apply-templates select="sru:records" mode="list"/>    
+				<!-- switch mode depending on the $format-parameter -->        
                 <!--<xsl:choose> 
                     <xsl:when test="contains($format,'htmltable')">
Index: MDService2/branches/MDService_simple3/src/xsl/mdset2view.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/mdset2view.xsl	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/xsl/mdset2view.xsl	(revision 1918)
@@ -19,4 +19,5 @@
 <xsl:import href="model2matrix.xsl"/>
 <xsl:import href="terms2view.xsl"/>
+<xsl:import href="cmd_functions.xsl"/>
 
 <!--  method="xhtml" is saxon-specific! prevents  collapsing empty <script> tags, that makes browsers choke -->
@@ -30,5 +31,5 @@
   --> 
 
-<xsl:include href="cmd_commons.xsl"/>
+<!-- <xsl:include href="cmd_commons.xsl"/> -->
 
 <!-- <xsl:param name="format" select="'table'" /> table|list|detail -->
@@ -86,9 +87,8 @@
 		<xsl:call-template name="header" />
 	</xsl:if>
-	<xsl:if test="contains($format, 'page')">
+	<xsl:if test="contains($format, 'htmlpage')">
 		<xsl:call-template name="query-input" />
 	</xsl:if>
  	
-	
 	<xsl:choose>
 				<xsl:when test="contains($format,'htmltable')">
@@ -193,4 +193,5 @@
 	 		</xsl:choose>
 	 	</xsl:variable>
+	 	 
 	 	<a class="internal prev" href="{my:formsearchURL($prev_startRecord,$maximumRecords)}">
 			<span>	
@@ -205,5 +206,7 @@
 			</span>
 		</a>
+		 
 		<a class="internal next" href="{my:formsearchURL($next_startRecord,$maximumRecords)}">
+		
 			<span class="cmd cmd_next">	
 			<xsl:choose>
@@ -447,6 +450,6 @@
 		</td>		
 		<td colspan="{count($cols/*)}" >
-				<xsl:call-template name="getContext" />
-			<div class="title" ><xsl:call-template name="getName" /></div>			
+				<!-- <xsl:call-template name="getContext" /> -->
+			<!--  <div class="title" ><xsl:call-template name="getName" /></div>-->			
 		</td>
 		</tr>
Index: MDService2/branches/MDService_simple3/src/xsl/model2matrix.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/model2matrix.xsl	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/xsl/model2matrix.xsl	(revision 1918)
@@ -16,5 +16,6 @@
 </history>
 -->
-<xsl:import href="cmd_commons.xsl"/>
+<xsl:include href="./fcs/commons.xsl"/>
+<!-- <xsl:include href="cmd_commons.xsl"/> --> 
 
 <xsl:output method="xml" indent="yes" > </xsl:output>
@@ -62,5 +63,6 @@
 					<!--  else get the full summary for given termset -->
 					<xsl:otherwise>
-					<xsl:variable name="resolved_termset_uri" select="concat($model_matrix_uri,$termset_name,'&amp;maxdepth=8&amp;x-context=',$x-context)" />
+					<!-- <xsl:variable name="resolved_termset_uri" select="concat($model_matrix_uri,$termset_name,'&amp;maxdepth=8&amp;x-context=',$x-context)" /> -->
+					<xsl:variable name="resolved_termset_uri" select="concat('',$termset_name,'&amp;maxdepth=8&amp;x-context=',$x-context)" />
 						<xsl:message>processing model-term($resolved_termset_uri): <xsl:value-of select="$resolved_termset_uri" /> </xsl:message>			
 						<xsl:copy-of select="document($resolved_termset_uri)" /> 
@@ -88,10 +90,9 @@
 	</xsl:when>
 	<xsl:otherwise>
-		<xsl:variable name="termset_name" select="Term/@name" />
+<!-- 		<xsl:variable name="termset_name" select="Term/@name" />
 		<xsl:variable name="profile" select="my:profilematrix($termset_name)" />
+		
 		<xsl:message>corresponding profile: <xsl:value-of select="concat($profile/@name, '#', $profile/@id)"/>  </xsl:message>
-		<!--  <xsl:copy-of select="$profile"  /> -->
-
-		<xsl:variable name="setup_entry" select="$terms_setup//Termset[@name=$termset_name]" />
+		<xsl:variable name="setup_entry" select="Termset[@name=$termset_name]" />
 		<xsl:message>corresponding terms_setup-entry: <xsl:value-of select="$setup_entry/concat(@name, '#', @id)"/>  </xsl:message>
 
@@ -114,10 +115,4 @@
 					<xsl:with-param name="matrix" select="$prematrix"></xsl:with-param>
 				</xsl:apply-templates>
-					<!-- 	
-				<xsl:copy>
-				<xsl:copy-of select="@*"></xsl:copy-of>
-					<xsl:attribute name="path" select="$path" />
-				</xsl:copy>
-				-->
 			</xsl:for-each> 
 			</Termset>
@@ -125,5 +120,5 @@
 		
 		<xsl:copy-of select="$matrix" />	
-		
+	 -->	
 	</xsl:otherwise>	
 	</xsl:choose>
@@ -134,4 +129,5 @@
 <xsl:template name="full-matrix" >
 <!--  collect all model termMatrix -->
+<!-- 
 		<xsl:variable name="model_termsets_uri" select="concat($model_matrix_uri,'Components', '&amp;maxdepth=1&amp;x-context=',$x-context)" />
 	<xsl:message>full-matrix.model_termsets_uri: <xsl:value-of select="$model_termsets_uri"/>  </xsl:message>				
@@ -139,9 +135,11 @@
 
 
-		<!--  collect all datcat terms -->
+
+
+		<!-  collect all datcat terms 
 		<xsl:variable name="datcats_uri" select="$datcats_terms_uri" />	
 		<xsl:variable name="datcat_termsets" select="document($datcats_uri)" />
 
-		<!--  resolve/invert datcat->Terms -->		
+		<!-  resolve/invert datcat->Terms 		
 		<xsl:variable name="datcat_termsets_resolved" >
 				<xsl:apply-templates select="$datcat_termsets//Termset[@type='dcr']" mode="resolve-datcat" >
@@ -150,5 +148,5 @@
 		</xsl:variable>
 		
-		<!-- +  resolve RR: rels(datcat,datcat) -->		
+		<!- +  resolve RR: rels(datcat,datcat) 		
 		<xsl:variable name="relcat_termsets_resolved" >
 				<xsl:apply-templates select="$datcat_termsets//Termset[@type='rr']" mode="resolve-relcat" >
@@ -163,5 +161,5 @@
 	</Termsets>
 	
-		
+		-->
 </xsl:template>
 
@@ -401,5 +399,6 @@
 	<xsl:param name="profile" />
 
-			<xsl:variable name="context" select="my:context(.)" >
+			<!-- <xsl:variable name="context" select="my:context(.)" > -->
+			<xsl:variable name="context" select="''" >
 							<!--  <xsl:for-each select="ancestor::CMD_Component" >
 								<xsl:value-of select="@name" />.</xsl:for-each>-->
Index: MDService2/branches/MDService_simple3/src/xsl/static2view.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/static2view.xsl	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/xsl/static2view.xsl	(revision 1918)
@@ -14,6 +14,6 @@
 </history>
 -->
-
-<xsl:include href="cmd_commons.xsl"/> 
+<xsl:include href="./fcs/commons.xsl"/>
+<!-- <xsl:include href="cmd_commons.xsl"/> --> 
 
 <!--<xsl:param name="title" select="if (//div[1][@class='title']) then concat('CMDRSB: ', //div[1][@class='title']) else 'CMDRSB docs'" />-->
Index: MDService2/branches/MDService_simple3/src/xsl/terms2view.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/terms2view.xsl	(revision 1907)
+++ MDService2/branches/MDService_simple3/src/xsl/terms2view.xsl	(revision 1918)
@@ -13,5 +13,7 @@
 </history>
 -->
-<xsl:import href="cmd_commons.xsl"/>
+<!-- <xsl:import href="cmd_commons.xsl"/> -->
+<xsl:import href="./fcs/commons_v1.xsl"/>
+<xsl:import href="cmd_functions.xsl"/>
 
 <!--  <xsl:output method="xml" />  -->  
@@ -64,5 +66,5 @@
 		    	 				<xsl:apply-templates select=".//Termset" mode="select"/>		    	 				
 		    			</select>
-		    			<a href="{my:formURL('terms','htmlpage','all')}">overview</a>	    	 				    		
+		    			<a href="{my:formURL('terms','htmlpage','all')}">overview</a>
 	    	 	</xsl:when>
     	 	<xsl:otherwise>
@@ -117,5 +119,5 @@
 	<div class="terms">	
 		<span class="detail-caller"><xsl:value-of select="@name"/></span>
-		<xsl:call-template name="attr-detail-div" />
+		<!-- <xsl:call-template name="attr-detail-div" /> -->
 		<!--  format:<xsl:value-of select="$format" /> -->
 		<!--<xsl:variable name="translated_term" select="translate(replace(/*/Term[1]/@path,'//',''),'/','.')" />
@@ -140,5 +142,5 @@
 					<span class="cmd cmd_detail" ><xsl:text> </xsl:text></span>
 					<span class="cmd cmd_columns" ><xsl:text> </xsl:text></span>
-					<xsl:call-template name="attr-detail-div" />
+					<!-- <xsl:call-template name="attr-detail-div" /> -->
 						<!--  <div class="detail">
 							<xsl:for-each select="@*" >
@@ -229,5 +231,6 @@
 		  <xsl:choose>
 			  <xsl:when test="@corresponding_component" >
-			  		<a target="_blank" href="{concat($components_viewer_uri, @corresponding_component)}" ><xsl:value-of select="@path" /></a>
+			  		<!-- <a target="_blank" href="{concat($components_viewer_uri, @corresponding_component)}" ><xsl:value-of select="@path" /></a> -->
+			  		<a target="_blank" href="{concat('', @corresponding_component)}" ><xsl:value-of select="@path" /></a>
 			  </xsl:when>
 			  <xsl:otherwise>
@@ -240,5 +243,8 @@
 		<td class="treecol"  ><span class="cmd cmd_query" ></span><span class="cmd cmd_columns" ></span>
 				<span class="column-elem"><xsl:copy-of select="$path_anchored" /></span><span class="cmd cmd_info" ></span>
-			<xsl:if test="@datcat!=''" >[<a target="_blank" href="{@datcat}" ><xsl:value-of select="my:shortURL(@datcat)" /></a>]</xsl:if>
+			<xsl:if test="@datcat!=''" >[<a target="_blank" href="{@datcat}" >
+			<!-- <xsl:value-of select="my:shortURL(@datcat)" /> -->
+			<xsl:value-of select="''" />
+			</a>]</xsl:if>
 		</td>
 		<!-- <td><xsl:value-of select="@path" />,<xsl:value-of select="@context" /></td>-->			
@@ -255,7 +261,7 @@
 			
 		<td class="number">	
-			<xsl:if test="not(Term)"><a class="value-caller" href="{my:formURL('values', 'htmllist', concat(@path,'&amp;sort=size'))}" ><xsl:value-of select="format-number(@count_distinct_text,'#.##0','european')" /></a>
-			<xsl:message><xsl:value-of select="concat('formURL: ',my:formURL('values', 'htmllist', concat(@path,'&amp;sort=size')))"></xsl:value-of></xsl:message>
-			</xsl:if>
+			<!-- <xsl:if test="not(Term)"><a class="value-caller" href="{my:formURL('values', 'htmllist', concat(@path,'&amp;sort=size'))}" ><xsl:value-of select="format-number(@count_distinct_text,'#.##0','european')" /></a>
+			  <xsl:message><xsl:value-of select="concat('formURL: ',my:formURL('values', 'htmllist', concat(@path,'&amp;sort=size')))"></xsl:value-of></xsl:message>
+			</xsl:if>-->
 			<xsl:if test="Term"><xsl:value-of select="format-number(sum(descendant::Term/@count_distinct_text),'#.##0','european')" /></xsl:if>
 		</td>
@@ -270,5 +276,5 @@
 		 
      </tr> 
-		<xsl:if test="Term and ($lv&lt;$max_depth or $max_depth=0)">
+		<xsl:if test="Term and ($lv&lt;$x_maximumDepth or $x_maximumDepth=0)">
 			
 				<xsl:choose>
@@ -329,5 +335,5 @@
 				</span>
 					
-		<xsl:call-template name="attr-detail-div" />
+		<!-- <xsl:call-template name="attr-detail-div" /> -->
 		<ul>
 			<xsl:apply-templates select="context" mode="autocomplete" />
@@ -389,6 +395,8 @@
 					<xsl:sort select="lower-case(@datcat)" order="ascending"/>					
 						<tr>
+						<!--
 						<td valign="top"><xsl:value-of select="my:shortURL(@datcat)"/></td>
 						<td valign="top"><xsl:value-of select="my:rewriteURL(@datcat)"/></td>
+						
 						<td valign="top" align="right">
 							<span class="detail-caller" ><xsl:value-of select="count(distinct-values(current-group()/@name))"/></span>
@@ -426,5 +434,6 @@
 									<xsl:value-of select="."/>,
 								</xsl:for-each>
-						</td>												
+						</td>
+						-->												
 						</tr>					
 				</xsl:for-each-group>
