Changeset 1918


Ignore:
Timestamp:
04/28/12 22:48:55 (12 years ago)
Author:
gaba
Message:

autocomplete - explain.xml

Location:
MDService2/branches/MDService_simple3
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js

    r1874 r1918  
    8181        //}
    8282        var x = "<div id='" + this.j + "' class='sc-j or_level' ><div id='" + this.listid + "' class='sc-wrapper focused' > " +
    83         "<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>" +
     83        "<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>" +
    8484        //index_detail +
    8585        //"<select type='text' class='rel_input' />" +
     
    212212       
    213213        try{
    214                 this.initAutocomplete();
     214                this.initAutocomplete(false);
     215                this.initAutocomplete(true);
    215216        } catch (e){
    216217                notifyUser("autocomplete failed: " + e.message);
     
    219220 };
    220221 
    221  SearchClause.prototype.initAutocomplete = function(){
    222        
    223         if (element_autocomplete.length == 0) return;
    224          
    225         $(this.GetIndexInputTermset()).autocomplete({
    226                         source: element_autocomplete,
    227                         autoFill:true,
    228                         width:150,
    229                         //onFindValue:findValueTermset,
    230                         //onItemSelect:selectItemTermset,
    231                         minLength: 0,
    232                         matchContains:true,
    233                         delay: 0,
    234                         select: function( event, ui ) {
    235                                 $(this).data("item", ui.item);
    236                                 selectItemTermset(ui.item);
    237                         }
    238                 }).data( "autocomplete" )._renderItem = function( ul, item ) {
    239                         var t, re;
    240                         if (this.term == ""){
    241                                 t = item.value;
    242                         } else {
    243                                 re = new RegExp(this.term + "+") ;
    244                             t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" + 
    245                                     this.term + 
    246                                     "</span>");
    247                         }
    248                        
    249                     return $( "<li></li>" )
    250                         .data( "item.autocomplete", item )
    251                         .append( "<a>" + t + "</a>" )
    252                         .appendTo( ul );
    253         };
     222
     223 SearchClause.prototype.initAutocomplete = function(is_explain){
     224       
     225         if (is_explain){
     226                        if (element_autocomplete_explain.length == 0) return;
     227                         
     228                        $(this.GetIndexInputTermset()).autocomplete({
     229                                        source: element_autocomplete_explain,
     230                                        autoFill:true,
     231                                        width:150,
     232                                        //onFindValue:findValueTermset,
     233                                        //onItemSelect:selectItemTermset,
     234                                        minLength: 0,
     235                                        matchContains:true,
     236                                        delay: 0,
     237                                        select: function( event, ui ) {
     238                                                $(this).data("item", ui.item);
     239                                                selectItemTermsetExplain(ui.item);
     240                                        }
     241                                }).data( "autocomplete" )._renderItem = function( ul, item ) {
     242                                        var t, re;
     243                                        if (this.term == ""){
     244                                                t = item.value;
     245                                        } else {
     246                                                re = new RegExp(this.term + "+") ;
     247                                            t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" + 
     248                                                    this.term + 
     249                                                    "</span>");
     250                                        }
     251                                       
     252                                    return $( "<li></li>" )
     253                                        .data( "item.autocomplete", item )
     254                                        .append( "<a>" + t + "</a>" )
     255                                        .appendTo( ul );
     256                        };
     257
     258         } else {
     259                        if (element_autocomplete.length == 0) return;
     260                         
     261                        $(this.GetIndexInputTermset()).autocomplete({
     262                                        source: element_autocomplete,
     263                                        autoFill:true,
     264                                        width:150,
     265                                        //onFindValue:findValueTermset,
     266                                        //onItemSelect:selectItemTermset,
     267                                        minLength: 0,
     268                                        matchContains:true,
     269                                        delay: 0,
     270                                        select: function( event, ui ) {
     271                                                $(this).data("item", ui.item);
     272                                                selectItemTermset(ui.item);
     273                                        }
     274                                }).data( "autocomplete" )._renderItem = function( ul, item ) {
     275                                        var t, re;
     276                                        if (this.term == ""){
     277                                                t = item.value;
     278                                        } else {
     279                                                re = new RegExp(this.term + "+") ;
     280                                            t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" + 
     281                                                    this.term + 
     282                                                    "</span>");
     283                                        }
     284                                       
     285                                    return $( "<li></li>" )
     286                                        .data( "item.autocomplete", item )
     287                                        .append( "<a>" + t + "</a>" )
     288                                        .appendTo( ul );
     289                        };
     290
     291         }
    254292        $('body').find('.ac_results').css({'z-index' : '1000'});
    255293         
     
    619657        },
    620658       
    621         initAutocomplete: function() {
     659        initAutocomplete: function(is_explain) {
    622660                notifyUser("init autocomplete",'debug');
    623661               
    624662                for (var i = this.searchclauses.length - 1; i > -1; i--){
    625663                        for (var j = this.searchclauses[i].length - 1; j > -1; j--){
    626                                         this.searchclauses[i][j].initAutocomplete();           
     664                                        this.searchclauses[i][j].initAutocomplete(is_explain);         
    627665                        }
    628666                }       
     
    674712
    675713//autocomplete
    676 // not used
    677 function handleTermsSelection(i,j,elem){
    678                         /*
    679                         var context = $('#' + 'sc' +  i + '-' + j).find('.index-context');
    680                         // fill context
    681                         //$(context).remove();
    682                         $(context).html(elements_hashtable[elem]);
    683                         $(context).show();
    684                         //notifyUser($('#' + 'sc' +  i + '-' + j).find('.index-input').val(), 'debug');
    685                         //$('#' + 'sc' +  i + '-' + j).find('.index-input').focus();
    686                        
    687                         $('#' + 'sc' +  i + '-' + j).find('.index-input').blur(function(){
    688                                 $(context).hide();
    689                         });
    690                         $('#' + 'sc' +  i + '-' + j).find('.index-input').focusin(function(){
    691                                 $(context).hide();
    692                         });
    693                         */
    694                         //$('#' + 'sc' +  i + '-' + j).find('.index-input').hide();
    695                         //$('#' + 'sc' +  i + '-' + j).find('.index-input-termset').show();
    696                        
    697 };
    698714       
    699715function findValueValue(e) {
     
    707723       
    708724}
    709  
    710725function selectItemValue(li) {
    711726        findValueValue(li);
     
    754769       
    755770};
     771function initValueAutocompleteExplain(i,j,index, term_index){
     772       
     773        // reset the index value
     774        $('#' + 'sc' +  i + '-' + j).find('.value-input').val("");
     775        searchclauseset.searchclauses[i][j].value = "";
     776        $('#' + 'sc' +  i + '-' + j).find('.value-input').show();
     777        $('body').find('.ac_results').css({'z-index' : '1000'});
     778       
     779       
     780        $('.focused','#searchclauselist').find('.value-input').focus();
     781
     782       
     783};
    756784
    757785function findValueTerm(e) {
    758                        
    759                         //var sValue = e.selectValue;
    760                        
    761                         var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
    762                         var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
    763                         //alert(i+ ',' + j + sValue);
    764                         var termsetitem = $('#' + 'sc' +  i + '-' + j).find('.index-input-termset').data('item');
    765                         var termset = "";
    766                         if (termsetitem != null) termset = termsetitem.key;
    767                         var str = e.id;
    768                         str = str.substring(str.lastIndexOf('/')+1, str.length);
    769                         var termsetindex = termset + ":" +  str;
    770                         searchclauseset.searchclauses[i][j].index = termsetindex;
    771                        
    772                         //handleTermsSelection(i,j,sValue);     
    773                         //find element value
    774                
    775                         var index;
    776                         $.each(element_autocomplete,function(i, item){
    777                                 if (this.key == termset){
    778                                         index = i;
    779                                         return;
    780                                 }
    781                         });
    782                         var term_index;
    783                        
    784                         $.each(element_autocomplete[index].data,function(i, item){
    785                                 if (this.id == e.id){
    786                                         term_index = i;
    787                                         return;
    788                                 }
    789                         });
    790                         if (element_autocomplete[index].data[term_index].values.length == 0){
    791                         jQuery.get(link('fcs','?operation=scan&scanClause=' + termsetindex + '&x-context=clarin.eu:mdrepo'),function(data){
    792                                 $(data).find("sru\\:term").each(function(i){
    793                                         element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('sru\\:value').text()};
    794                                 });
    795                                 initValueAutocomplete(i,j, index, term_index);
    796                                 });
    797                         } else {
    798                                 initValueAutocomplete(i,j, index, term_index);
    799                         }
    800                        
    801                        
     786       
     787        //var sValue = e.selectValue;
     788       
     789        var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
     790        var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
     791        //alert(i+ ',' + j + sValue);
     792        var sClause = $('#' + 'sc' +  i + '-' + j);
     793        var context = "";
     794        var termsetitem = $(sClause).find('.index-input-termset').data('item');
     795        var termset = "";
     796        if (termsetitem != null) termset = termsetitem.key;
     797        var str = e.id;
     798        str = str.substring(str.lastIndexOf('/')+1, str.length);
     799        var termsetindex = termset + ":" +  str;
     800        searchclauseset.searchclauses[i][j].index = termsetindex;
     801       
     802        //handleTermsSelection(i,j,sValue);     
     803        //find element value
     804
     805        var index;
     806        $.each(element_autocomplete,function(i, item){
     807                if (this.key == termset){
     808                        index = i;
     809                        return;
     810                }
     811        });
     812        var term_index;
     813       
     814        $.each(element_autocomplete[index].data,function(i, item){
     815                if (this.id == e.id){
     816                        term_index = i;
     817                        return;
     818                }
     819        });
     820        if (element_autocomplete[index].data[term_index].values.length == 0){
     821                jQuery.get(link('fcs','?operation=scan&scanClause' + termsetindex + '&x-context=' + getSelectedRepository()),function(data){
     822                $(data).find("sru\\:term").each(function(i){
     823                        element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('sru\\:value').text()};
     824                });
     825                initValueAutocomplete(i,j, index, term_index);
     826                });
     827        } else {
     828                initValueAutocomplete(i,j, index, term_index);
     829        }       
    802830}
    803                  
     831function findValueTermExplain(e) {
     832       
     833        //var sValue = e.selectValue;
     834       
     835        var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
     836        var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
     837        //alert(i+ ',' + j + sValue);
     838        var sClause = $('#' + 'sc' +  i + '-' + j);
     839        var context = "";
     840        var termsetitem = $(sClause).find('.index-input-termset').data('item');
     841        var termset = "";
     842        if (termsetitem != null) termset = termsetitem.key;
     843        var str = e.id;
     844        str = str.substring(str.lastIndexOf('/')+1, str.length);
     845        var termsetindex = termset + ":" +  str;
     846        searchclauseset.searchclauses[i][j].index = termsetindex;
     847       
     848        //find element value
     849
     850        var index;
     851        $.each(element_autocomplete_explain,function(i, item){
     852                if (this.key == termset){
     853                        index = i;
     854                        return;
     855                }
     856        });
     857        var term_index;
     858       
     859        $.each(element_autocomplete_explain[index].data,function(i, item){
     860                if (this.id == e.id){
     861                        term_index = i;
     862                        return;
     863                }
     864        });
     865        if (element_autocomplete_explain[index].data[term_index].values.length == 0){
     866                jQuery.get(link('fcs','?operation=scan&scanClause' + termsetindex + '&x-context=' + getSelectedRepository()),function(data){
     867                $(data).find("sru\\:term").each(function(i){
     868                        element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('sru\\:value').text()};
     869                });
     870                initValueAutocompleteExplain(i,j, index, term_index);
     871                });
     872        } else {
     873                initValueAutocompleteExplain(i,j, index, term_index);
     874        }       
     875}
     876 
    804877function selectItemTerm(li) {
    805                         findValueTerm(li);
    806                 }
     878        findValueTerm(li);
     879}
     880function selectItemTermExplain(li) {
     881        findValueTermExplain(li);
     882}
    807883
    808884function initTermsetAutocomplete(i,j,index){
    809         //$('#' + 'sc' +  i + '-' + j).find('.index-input').hide();
    810        
    811         // not working
    812         //searchclauseset.searchclauses[i][j].initAutocompleteTerms(elem);
    813885
    814886        $('#' + 'sc' +  i + '-' + j).find('.index-input').autocomplete({
     
    816888                autoFill:true,
    817889                width:150,
    818                 //onFindValue:findValueTerm,
    819                 //onItemSelect:selectItemTerm,
    820890                minLength: 0,
    821891                matchContains:true,
     
    824894                        $(this).data("item", ui.item);
    825895                        selectItemTerm(ui.item);
    826                 }
     896                        }
    827897        }).data( "autocomplete" )._renderItem = function( ul, item ) {
    828898                var t, re;
     
    835905                            "</span>");
    836906                }
    837                
    838             return $( "<li></li>" )
    839                 .data( "item.autocomplete", item )
    840                 .append( "<a>" + t + "</a>" )
    841                 .appendTo( ul );
     907       
     908                return $( "<li></li>" )
     909                    .data( "item.autocomplete", item )
     910                    .append( "<a>" + t + "</a>" )
     911                    .appendTo( ul );
    842912        };
    843 
    844        
    845         // reset the index value
     913       
     914       
     915                // reset the index value
    846916        $('#' + 'sc' +  i + '-' + j).find('.index-input').val("");
    847917        searchclauseset.searchclauses[i][j].index = "";
     918        $('#' + 'sc' +  i + '-' + j).find('.value-input').val("");
     919        searchclauseset.searchclauses[i][j].value = "";
    848920        $('#' + 'sc' +  i + '-' + j).find('.index-input').show();
    849921        $('body').find('.ac_results').css({'z-index' : '1000'});
     
    851923       
    852924        $('.focused','#searchclauselist').find('.index-input').focus();
    853 
    854        
    855 };
    856 /*
    857 function handleTermsetSelection(i,j,elem){
    858        
    859         // create apropriate array, than initialize autocomplete
    860         if ($('#elements_hashtable_'+elem).children().length == 0) {
    861                 $('#elements_hashtable_'+elem).load(link('smc','list/?context='+elem),function(){
    862                         //var e = $(this).attr("id");
    863                         $(this).find('Term').each(function(index){
    864                                 elements_hashtable[elem][index] = $(this).text();
    865                         });
    866                         initTermsetAutocomplete(i,j,elem);
    867                 });
    868         } else {
    869                 initTermsetAutocomplete(i,j,elem);
    870         }       
    871 };
    872 */
     925};
     926function initTermsetAutocompleteExplain(i,j,index){
     927
     928        $('#' + 'sc' +  i + '-' + j).find('.index-input').autocomplete({
     929                source: element_autocomplete_explain[index].data,
     930                autoFill:true,
     931                width:150,
     932                minLength: 0,
     933                matchContains:true,
     934                delay: 0,
     935                select: function( event, ui ) {
     936                        $(this).data("item", ui.item);
     937                        selectItemTermExplain(ui.item);
     938                        }
     939        }).data( "autocomplete" )._renderItem = function( ul, item ) {
     940                var t, re;
     941                if (this.term == ""){
     942                        t = item.value;
     943                } else {
     944                        re = new RegExp(this.term + "+") ;
     945                    t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" + 
     946                            this.term + 
     947                            "</span>");
     948                }
     949       
     950                return $( "<li></li>" )
     951                    .data( "item.autocomplete", item )
     952                    .append( "<a>" + t + "</a>" )
     953                    .appendTo( ul );
     954        };
     955       
     956       
     957                // reset the index value
     958                $('#' + 'sc' +  i + '-' + j).find('.index-input').val("");
     959                searchclauseset.searchclauses[i][j].index = "";
     960                $('#' + 'sc' +  i + '-' + j).find('.index-input').show();
     961                $('body').find('.ac_results').css({'z-index' : '1000'});
     962       
     963       
     964                $('.focused','#searchclauselist').find('.index-input').focus();
     965};
     966
    873967
    874968function findValueTermset(elem) {
    875969        //var sValue = e.selectValue;
    876        
     970
    877971        var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
    878972        var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
    879        
     973
    880974        //searchclauseset.searchclauses[i][j].index = sValue;   
    881975        //handleTermsetSelection(i,j,sValue);           
    882        
     976
    883977        //find element
    884978        var index;
     
    889983                }
    890984        });
    891        
     985
    892986        if (element_autocomplete[index].data.length == 0){
    893987                jQuery.get(link('smc','list/?context=' + element_autocomplete[index].key),function(data){
     
    900994                initTermsetAutocomplete(i,j, index);
    901995        }
    902        
    903996}
    904  
     997function findValueTermsetExplain(elem) {
     998       
     999        var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
     1000        var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
     1001
     1002                //find element
     1003        var index;
     1004        $.each(element_autocomplete_explain,function(i, item){
     1005                if (this.key == elem.key){
     1006                        index = i;
     1007                        return;
     1008                }
     1009        });
     1010
     1011        if (element_autocomplete_explain[index].data.length == 0){
     1012                jQuery.get(link('fcs','?operation=explain&x-context=' + getSelectedRepository()),function(data){
     1013                        $(data).find('indexInfo').children('index').children('map').children('name[set='+ element_autocomplete_explain[index].key +']').each(function(i){
     1014                                element_autocomplete_explain[index].data[i] = {label:$(this).text(), value:$(this).text(), id:$(this).text(),values:[] };
     1015                        });
     1016                        initTermsetAutocompleteExplain(i,j, index);
     1017                });
     1018        } else {
     1019                initTermsetAutocompleteExplain(i,j, index);
     1020        }
     1021
     1022}
     1023
     1024
    9051025function selectItemTermset(li) {
    9061026        findValueTermset(li);
    907 }
    908 
     1027        }
     1028function selectItemTermsetExplain(li) {
     1029        findValueTermsetExplain(li);
     1030        }
     1031
  • MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js

    r1588 r1918  
    6969
    7070function getSelectedRepository(){
    71         return $('#repositories_select').find("option:selected").text();
     71        return $('select[name="x-context"]').find("option:selected").val();
    7272}
    7373
     
    8484 */
    8585function addFunctionality(){
     86       
     87        //change context_selects
     88        $('select[name=x-context]').live('click', function(){
     89                //delete the autocomplete arrays, reset the index input values
     90                //element_autocomplete.splice(0, element_autocomplete.length);
     91                element_autocomplete_explain.splice(0, element_autocomplete_explain.length );
     92                searchclauseset.clear();
     93                //load new
     94                loadTermsAutocompleteExplain();
     95        });
    8696       
    8797        //switch the input simple query vs complex query
     
    205215       
    206216       
     217       
     218        $('.cmd_sc_autocomplete').live('click',  function(event) {
     219                var i = $(this).closest('.sc-i').attr('id');
     220                var j = $(this).closest('.sc-j').attr('id');
     221                searchclauseset.searchclauses[i][j].initAutocomplete($(this).hasClass('cmd_sca_explain'));
     222                $(this).toggleClass('cmd_sca_explain cmd_sca_smc');                                     
     223        });
    207224       
    208225        // cmd_up cmd_down
  • MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_load.js

    r1852 r1918  
    1919        //loadComponentsRegistry();     
    2020        //loadDCR();
    21 
    2221}
    2322
     
    240239}
    241240
     241function loadTermAutocompleteExplain(){
     242        $('#termset_autocomplete_explain').children().remove();
     243        $('#termset_autocomplete_explain').css('display','none');
     244        $('#terms_autocomplete_explain').children().remove();
     245        $('#terms_autocomplete_explain').css('display','none');
     246
     247        $('#termset_autocomplete_explain').load(link('fcs','?operation=explain&x-context=' + getSelectedRepository()),function(){
     248                $(this).find("indexInfo").children("set").each(function(index){
     249                        //element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('index').children('title').text()};
     250                        var _key, _name, _id, _parent, _isleaf = 0;
     251                        _key = $(this).attr("name");
     252                        _name = $(this).children("title").text();
     253                        _parent = $(this).parents('indexInfo');
     254                        _id = $(this).attr("identifier");
     255                        _isleaf = 1;//TODO
     256                       
     257                        element_autocomplete_explain[index] = { label:_name, value:_name, key:_key, id:_id, parent:_parent, isleaf:_isleaf, data:[]};   
     258                });
     259                // add autocomplete 's
     260                //searchclauseset.initAutocomplete(true);
     261                //columns_widget.initAutocomplete(element_autocomplete_explain, true);
     262        });
     263
     264};
     265
    242266function loadTermsAutocomplete(){
    243267       
    244         var elem;
     268        //var elem;
    245269        $('#termset_autocomplete').children().remove();
    246270        $('#termset_autocomplete').css('display','none');
    247271        $('#terms_autocomplete').children().remove();
    248272        $('#terms_autocomplete').css('display','none');
     273       
     274
     275        //$.get(link('smc','list/?context=*'),function(){
    249276        $('#termset_autocomplete').load(link('smc','list/?context=*'),function(){
    250277                $(this).find('Termset').each(function(index){
     
    265292                });
    266293                // add autocomplete 's
    267                 searchclauseset.initAutocomplete();
    268                 columns_widget.initAutocomplete(element_autocomplete);
    269         });
     294                searchclauseset.initAutocomplete(false);
     295                //columns_widget.initAutocomplete(element_autocomplete);
     296                //load explain autocomplete array
     297                loadTermAutocompleteExplain();
     298        });
     299       
     300       
    270301};
    271302
  • MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_settings.js

    r1874 r1918  
    1919
    2020var  element_autocomplete = new Array();
     21var  element_autocomplete_explain = new Array();
    2122var  elements_hashtable =  {};
    2223
  • MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/GenericAction.java

    r1907 r1918  
    2424import eu.clarin.cmdi.mdservice.model.Diagnostic;
    2525import eu.clarin.cmdi.mdservice.model.Diagnostics;
     26import eu.clarin.cmdi.mdservice.model.Repositories;
    2627import eu.clarin.cmdi.mdservice.model.WorkspaceProfile;
    2728import eu.clarin.cmdi.mdservice.proxy.ProxyInterface;
     
    208209       
    209210        public String getMaxdepth() {
    210                  return getParam("maxdepth");
     211                 return getParam("x-maximumDepth");
    211212        }
    212213         
     
    377378               
    378379                if ( params.get("x-cmd-maxdepth") == null){
    379                         if (params.get("maxdepth") == null){
    380                                 addParam("maxdepth","2");
     380                        if (params.get("x-maximumDepth") == null){
     381                                addParam("x-maximumDepth","2");
    381382                        }
    382383                } else {
    383                         addParam("maxdepth",params.get("x-cmd-maxdepth")[0]);
     384                        addParam("x-maximumDepth",params.get("x-cmd-maxdepth")[0]);
    384385                }
    385386                /*
     
    401402                        addParam("x-context",params.get("x-cmd-repository")[0]);
    402403                }
    403                
     404                if (params.get("x-context") == null){
     405                        addParam("x-context",Repositories.getRepositories().getRepositoryByIndex(0));
     406                }
    404407                if ( params.get("x-cmd-cache") == null){
    405408                        if (params.get("cache") == null){
     
    433436
    434437                addParam("fullformat",getFullFormat());
     438               
     439                if (params.get("base_url") == null){
     440                        addParam("base_url",Utils.getConfig("base.uri"));
     441                }
     442               
     443                if (params.get("scripts_url") == null){
     444                        addParam("scripts_url",Utils.getConfig("webscripts.uri"));
     445                }
     446               
    435447        }
    436448        /**
  • MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/RepoAction.java

    r1832 r1918  
    132132                       
    133133                        if (!Repositories.getRepositories().repositoryExists(getRepository())){
    134                                 getDiagnostics().Add(Diagnostic.UNSUPPORTED_PARAMETERVALUE, "repository", "repository=" + getRepository() );
     134                                getDiagnostics().Add(Diagnostic.UNSUPPORTED_PARAMETERVALUE, "repository", "repository=" + getRepository() );                                   
    135135                                return;
    136136                        }
  • MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/model/Query.java

    r1907 r1918  
    7979                sarr = new String[1];
    8080                sarr[0] = "1";
    81                 put("maxdepth", sarr);
     81                put("x_maximumDepth", sarr);
    8282               
    8383        }};
     
    410410                if (type.equals(MODEL)) {
    411411                        //targetRequest = fromCMDIndex2Xpath() + "&maxdepth=" + getMaxdepth()  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
    412                         targetRequest = fromCMDIndex2Xpath() + "&maxdepth=" + getParam("maxdepth")  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
     412                        targetRequest = fromCMDIndex2Xpath() + "&maxdepth=" + getParam("x-maximumDepth")  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
    413413                }
    414414                else if (type.equals(COLLECTION)) {
    415                         targetRequest = getParam("collection") + "&maxdepth=" + getParam("maxdepth")  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
     415                        targetRequest = getParam("collection") + "&maxdepth=" + getParam("x-maximumDepth")  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
    416416
    417417                } else if (type.equals(SRUEXTERN)) {
  • MDService2/branches/MDService_simple3/src/mdservice.properties

    r1879 r1918  
    55terms.file=terms_setup.xml
    66webscripts.uri = /MDService2
    7 base.uri = /MDService2
     7//base.uri = /MDService2
     8base.uri =http://localhost:8080/MDService2/fcs
    89virtualcollection.uri = http://clarin.ids-mannheim.de/vcr/service/virtualcollection
    910
  • MDService2/branches/MDService_simple3/src/xsl/fcs/commons_v1.xsl

    r1814 r1918  
    2121    <xsl:template match="/">
    2222                <!--<xsl:message>root_document-uri:<xsl:value-of select="$root_uri"/>
    23                         </xsl:message>
    24                         <xsl:message>format:<xsl:value-of select="$format"/>
    2523                        </xsl:message>-->
    2624        <xsl:choose>
  • MDService2/branches/MDService_simple3/src/xsl/fcs/html_snippets.xsl

    r1907 r1918  
    2222            <link href="{$base_dir}/style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet"/>       
    2323            </xsl:if>-->
     24           
     25           
     26            <xsl:if test="contains($format,'htmljspage')">
     27                <link href="{$scripts_url}/style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet" />
     28                <link href="{$scripts_url}/style/jquery/treetable/jquery.treeTable.css" rel="stylesheet" ></link>
     29                <link href="{$scripts_url}/style/jquery/jquery-autocomplete/jquery-ui.css" rel="stylesheet" type="text/css"></link>
     30       
     31                <script src="{$scripts_url}/scripts/jquery/js/jquery.min.js" type="text/javascript"></script>
     32                <script src="{$scripts_url}/scripts/jquery/js/jquery-ui.min.js" type="text/javascript"></script>
     33               
     34                <script src="{$scripts_url}/scripts/jquery/jquery-treeview/jquery.treeview.js" type="text/javascript"></script>
     35                <script src="{$scripts_url}/scripts/jquery/jquery-treeTable/jquery.treeTable.js" type="text/javascript"></script>
     36                <script src="{$scripts_url}/scripts/jquery/jsTree.v.1.0rc2/jquery.jstree.js" type="text/javascript"></script>
     37               
     38                <script src="{$scripts_url}/scripts/mdservice_helpers.js" type="text/javascript"></script>
     39                <script src="{$scripts_url}/scripts/jquery/jquery-layout/jquery.layout-1.3.0.rc29.12.js" type="text/javascript"></script>
     40               
     41                <script src="{$scripts_url}/scripts/mdservice_ui_settings.js" type="text/javascript"></script>
     42                <script src="{$scripts_url}/scripts/mdservice_helpers.js" type="text/javascript"></script>
     43                <script src="{$scripts_url}/scripts/mdservice_ui_helpers.js" type="text/javascript"></script>
     44                <script src="{$scripts_url}/scripts/mdservice_widgets.js" type="text/javascript"></script>
     45               
     46                <script src="{$scripts_url}/scripts/mdservice_searchclause.js" type="text/javascript"></script>
     47                <script src="{$scripts_url}/scripts/mdservice_model.js" type="text/javascript"></script>
     48                <script src="{$scripts_url}/scripts/mdservice_pz2.js" type="text/javascript"></script>
     49                <script src="{$scripts_url}/scripts/mdservice_ui_detail.js" type="text/javascript"></script>
     50                <script src="{$scripts_url}/scripts/mdservice_ui_load.js" type="text/javascript"></script>
     51               
     52                <script src="{$scripts_url}/scripts/mdservice_ui.js" type="text/javascript"></script>
     53                               
     54        </xsl:if>
    2455    </xsl:template>
    2556    <xsl:template name="page-header">
     
    156187                </form>
    157188            </div>
     189            <!-- gs -->
     190            <div id="termset_autocomplete" />
     191            <div id="termset_autocomplete_explain" />
     192                        <div id="terms_autocomplete" />
    158193        </div>
    159194    </xsl:template>
     
    232267            </span>
    233268        </a>
     269       
    234270    </xsl:template>
    235271    <xsl:template name="query-list">
  • MDService2/branches/MDService_simple3/src/xsl/fcs/params.xsl

    r1907 r1918  
    2424   
    2525    <!-- gs -->
     26    <xsl:param name="x_maximumDepth" select="0" />
     27    <xsl:param name="autocolumns_limit" select="6" />
    2628    <xsl:param name="name_element" select="('title', 'name', 'resourcename', 'md-title')"  />
    2729       
  • MDService2/branches/MDService_simple3/src/xsl/fcs/result2view_v1.xsl

    r1812 r1918  
    2525                    <xsl:call-template name="header"/>
    2626                </xsl:if>
    27                 <xsl:apply-templates select="sru:records" mode="list"/>
    28     <!-- switch mode depending on the $format-parameter -->       
     27                                <xsl:apply-templates select="sru:records" mode="list"/>   
     28                                <!-- switch mode depending on the $format-parameter -->       
    2929                <!--<xsl:choose>
    3030                    <xsl:when test="contains($format,'htmltable')">
  • MDService2/branches/MDService_simple3/src/xsl/mdset2view.xsl

    r1907 r1918  
    1919<xsl:import href="model2matrix.xsl"/>
    2020<xsl:import href="terms2view.xsl"/>
     21<xsl:import href="cmd_functions.xsl"/>
    2122
    2223<!--  method="xhtml" is saxon-specific! prevents  collapsing empty <script> tags, that makes browsers choke -->
     
    3031  -->
    3132
    32 <xsl:include href="cmd_commons.xsl"/>
     33<!-- <xsl:include href="cmd_commons.xsl"/> -->
    3334
    3435<!-- <xsl:param name="format" select="'table'" /> table|list|detail -->
     
    8687                <xsl:call-template name="header" />
    8788        </xsl:if>
    88         <xsl:if test="contains($format, 'page')">
     89        <xsl:if test="contains($format, 'htmlpage')">
    8990                <xsl:call-template name="query-input" />
    9091        </xsl:if>
    9192       
    92        
    9393        <xsl:choose>
    9494                                <xsl:when test="contains($format,'htmltable')">
     
    193193                        </xsl:choose>
    194194                </xsl:variable>
     195                 
    195196                <a class="internal prev" href="{my:formsearchURL($prev_startRecord,$maximumRecords)}">
    196197                        <span> 
     
    205206                        </span>
    206207                </a>
     208                 
    207209                <a class="internal next" href="{my:formsearchURL($next_startRecord,$maximumRecords)}">
     210               
    208211                        <span class="cmd cmd_next">     
    209212                        <xsl:choose>
     
    447450                </td>           
    448451                <td colspan="{count($cols/*)}" >
    449                                 <xsl:call-template name="getContext" />
    450                         <div class="title" ><xsl:call-template name="getName" /></div>                 
     452                                <!-- <xsl:call-template name="getContext" /> -->
     453                        <!--  <div class="title" ><xsl:call-template name="getName" /></div>-->                 
    451454                </td>
    452455                </tr>
  • MDService2/branches/MDService_simple3/src/xsl/model2matrix.xsl

    r1907 r1918  
    1616</history>
    1717-->
    18 <xsl:import href="cmd_commons.xsl"/>
     18<xsl:include href="./fcs/commons.xsl"/>
     19<!-- <xsl:include href="cmd_commons.xsl"/> -->
    1920
    2021<xsl:output method="xml" indent="yes" > </xsl:output>
     
    6263                                        <!--  else get the full summary for given termset -->
    6364                                        <xsl:otherwise>
    64                                         <xsl:variable name="resolved_termset_uri" select="concat($model_matrix_uri,$termset_name,'&amp;maxdepth=8&amp;x-context=',$x-context)" />
     65                                        <!-- <xsl:variable name="resolved_termset_uri" select="concat($model_matrix_uri,$termset_name,'&amp;maxdepth=8&amp;x-context=',$x-context)" /> -->
     66                                        <xsl:variable name="resolved_termset_uri" select="concat('',$termset_name,'&amp;maxdepth=8&amp;x-context=',$x-context)" />
    6567                                                <xsl:message>processing model-term($resolved_termset_uri): <xsl:value-of select="$resolved_termset_uri" /> </xsl:message>                       
    6668                                                <xsl:copy-of select="document($resolved_termset_uri)" />
     
    8890        </xsl:when>
    8991        <xsl:otherwise>
    90                 <xsl:variable name="termset_name" select="Term/@name" />
     92<!--            <xsl:variable name="termset_name" select="Term/@name" />
    9193                <xsl:variable name="profile" select="my:profilematrix($termset_name)" />
     94               
    9295                <xsl:message>corresponding profile: <xsl:value-of select="concat($profile/@name, '#', $profile/@id)"/>  </xsl:message>
    93                 <!--  <xsl:copy-of select="$profile"  /> -->
    94 
    95                 <xsl:variable name="setup_entry" select="$terms_setup//Termset[@name=$termset_name]" />
     96                <xsl:variable name="setup_entry" select="Termset[@name=$termset_name]" />
    9697                <xsl:message>corresponding terms_setup-entry: <xsl:value-of select="$setup_entry/concat(@name, '#', @id)"/>  </xsl:message>
    9798
     
    114115                                        <xsl:with-param name="matrix" select="$prematrix"></xsl:with-param>
    115116                                </xsl:apply-templates>
    116                                         <!--   
    117                                 <xsl:copy>
    118                                 <xsl:copy-of select="@*"></xsl:copy-of>
    119                                         <xsl:attribute name="path" select="$path" />
    120                                 </xsl:copy>
    121                                 -->
    122117                        </xsl:for-each>
    123118                        </Termset>
     
    125120               
    126121                <xsl:copy-of select="$matrix" />       
    127                
     122         -->   
    128123        </xsl:otherwise>       
    129124        </xsl:choose>
     
    134129<xsl:template name="full-matrix" >
    135130<!--  collect all model termMatrix -->
     131<!--
    136132                <xsl:variable name="model_termsets_uri" select="concat($model_matrix_uri,'Components', '&amp;maxdepth=1&amp;x-context=',$x-context)" />
    137133        <xsl:message>full-matrix.model_termsets_uri: <xsl:value-of select="$model_termsets_uri"/>  </xsl:message>                               
     
    139135
    140136
    141                 <!--  collect all datcat terms -->
     137
     138
     139                <!-  collect all datcat terms
    142140                <xsl:variable name="datcats_uri" select="$datcats_terms_uri" />
    143141                <xsl:variable name="datcat_termsets" select="document($datcats_uri)" />
    144142
    145                 <!--  resolve/invert datcat->Terms -->         
     143                <!-  resolve/invert datcat->Terms              
    146144                <xsl:variable name="datcat_termsets_resolved" >
    147145                                <xsl:apply-templates select="$datcat_termsets//Termset[@type='dcr']" mode="resolve-datcat" >
     
    150148                </xsl:variable>
    151149               
    152                 <!-- +  resolve RR: rels(datcat,datcat) -->             
     150                <!- +  resolve RR: rels(datcat,datcat)          
    153151                <xsl:variable name="relcat_termsets_resolved" >
    154152                                <xsl:apply-templates select="$datcat_termsets//Termset[@type='rr']" mode="resolve-relcat" >
     
    163161        </Termsets>
    164162       
    165                
     163                -->
    166164</xsl:template>
    167165
     
    401399        <xsl:param name="profile" />
    402400
    403                         <xsl:variable name="context" select="my:context(.)" >
     401                        <!-- <xsl:variable name="context" select="my:context(.)" > -->
     402                        <xsl:variable name="context" select="''" >
    404403                                                        <!--  <xsl:for-each select="ancestor::CMD_Component" >
    405404                                                                <xsl:value-of select="@name" />.</xsl:for-each>-->
  • MDService2/branches/MDService_simple3/src/xsl/static2view.xsl

    r1907 r1918  
    1414</history>
    1515-->
    16 
    17 <xsl:include href="cmd_commons.xsl"/>
     16<xsl:include href="./fcs/commons.xsl"/>
     17<!-- <xsl:include href="cmd_commons.xsl"/> -->
    1818
    1919<!--<xsl:param name="title" select="if (//div[1][@class='title']) then concat('CMDRSB: ', //div[1][@class='title']) else 'CMDRSB docs'" />-->
  • MDService2/branches/MDService_simple3/src/xsl/terms2view.xsl

    r1574 r1918  
    1313</history>
    1414-->
    15 <xsl:import href="cmd_commons.xsl"/>
     15<!-- <xsl:import href="cmd_commons.xsl"/> -->
     16<xsl:import href="./fcs/commons_v1.xsl"/>
     17<xsl:import href="cmd_functions.xsl"/>
    1618
    1719<!--  <xsl:output method="xml" />  --> 
     
    6466                                                        <xsl:apply-templates select=".//Termset" mode="select"/>                                                       
    6567                                        </select>
    66                                         <a href="{my:formURL('terms','htmlpage','all')}">overview</a>                                                           
     68                                        <a href="{my:formURL('terms','htmlpage','all')}">overview</a>
    6769                        </xsl:when>
    6870                <xsl:otherwise>
     
    117119        <div class="terms">     
    118120                <span class="detail-caller"><xsl:value-of select="@name"/></span>
    119                 <xsl:call-template name="attr-detail-div" />
     121                <!-- <xsl:call-template name="attr-detail-div" /> -->
    120122                <!--  format:<xsl:value-of select="$format" /> -->
    121123                <!--<xsl:variable name="translated_term" select="translate(replace(/*/Term[1]/@path,'//',''),'/','.')" />
     
    140142                                        <span class="cmd cmd_detail" ><xsl:text> </xsl:text></span>
    141143                                        <span class="cmd cmd_columns" ><xsl:text> </xsl:text></span>
    142                                         <xsl:call-template name="attr-detail-div" />
     144                                        <!-- <xsl:call-template name="attr-detail-div" /> -->
    143145                                                <!--  <div class="detail">
    144146                                                        <xsl:for-each select="@*" >
     
    229231                  <xsl:choose>
    230232                          <xsl:when test="@corresponding_component" >
    231                                         <a target="_blank" href="{concat($components_viewer_uri, @corresponding_component)}" ><xsl:value-of select="@path" /></a>
     233                                        <!-- <a target="_blank" href="{concat($components_viewer_uri, @corresponding_component)}" ><xsl:value-of select="@path" /></a> -->
     234                                        <a target="_blank" href="{concat('', @corresponding_component)}" ><xsl:value-of select="@path" /></a>
    232235                          </xsl:when>
    233236                          <xsl:otherwise>
     
    240243                <td class="treecol"  ><span class="cmd cmd_query" ></span><span class="cmd cmd_columns" ></span>
    241244                                <span class="column-elem"><xsl:copy-of select="$path_anchored" /></span><span class="cmd cmd_info" ></span>
    242                         <xsl:if test="@datcat!=''" >[<a target="_blank" href="{@datcat}" ><xsl:value-of select="my:shortURL(@datcat)" /></a>]</xsl:if>
     245                        <xsl:if test="@datcat!=''" >[<a target="_blank" href="{@datcat}" >
     246                        <!-- <xsl:value-of select="my:shortURL(@datcat)" /> -->
     247                        <xsl:value-of select="''" />
     248                        </a>]</xsl:if>
    243249                </td>
    244250                <!-- <td><xsl:value-of select="@path" />,<xsl:value-of select="@context" /></td>-->                     
     
    255261                       
    256262                <td class="number">     
    257                         <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>
    258                         <xsl:message><xsl:value-of select="concat('formURL: ',my:formURL('values', 'htmllist', concat(@path,'&amp;sort=size')))"></xsl:value-of></xsl:message>
    259                         </xsl:if>
     263                        <!-- <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>
     264                          <xsl:message><xsl:value-of select="concat('formURL: ',my:formURL('values', 'htmllist', concat(@path,'&amp;sort=size')))"></xsl:value-of></xsl:message>
     265                        </xsl:if>-->
    260266                        <xsl:if test="Term"><xsl:value-of select="format-number(sum(descendant::Term/@count_distinct_text),'#.##0','european')" /></xsl:if>
    261267                </td>
     
    270276                 
    271277     </tr>
    272                 <xsl:if test="Term and ($lv&lt;$max_depth or $max_depth=0)">
     278                <xsl:if test="Term and ($lv&lt;$x_maximumDepth or $x_maximumDepth=0)">
    273279                       
    274280                                <xsl:choose>
     
    329335                                </span>
    330336                                       
    331                 <xsl:call-template name="attr-detail-div" />
     337                <!-- <xsl:call-template name="attr-detail-div" /> -->
    332338                <ul>
    333339                        <xsl:apply-templates select="context" mode="autocomplete" />
     
    389395                                        <xsl:sort select="lower-case(@datcat)" order="ascending"/>                                     
    390396                                                <tr>
     397                                                <!--
    391398                                                <td valign="top"><xsl:value-of select="my:shortURL(@datcat)"/></td>
    392399                                                <td valign="top"><xsl:value-of select="my:rewriteURL(@datcat)"/></td>
     400                                               
    393401                                                <td valign="top" align="right">
    394402                                                        <span class="detail-caller" ><xsl:value-of select="count(distinct-values(current-group()/@name))"/></span>
     
    426434                                                                        <xsl:value-of select="."/>,
    427435                                                                </xsl:for-each>
    428                                                 </td>                                                                                           
     436                                                </td>
     437                                                -->                                                                                             
    429438                                                </tr>                                   
    430439                                </xsl:for-each-group>
Note: See TracChangeset for help on using the changeset viewer.