Changeset 1866


Ignore:
Timestamp:
04/06/12 20:36:22 (12 years ago)
Author:
gaba
Message:

explain.xml in fcs

Location:
MDService2/branches/MDService_simple3
Files:
2 edited

Legend:

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

    r1800 r1866  
    696696                       
    697697};
    698                
     698       
     699function findValueValue(e) {
     700        var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
     701        var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
     702        //alert(i+ ',' + j + sValue);
     703        var termsetitem = $('#' + 'sc' +  i + '-' + j).find('.value-input').data('item');
     704        var termset = "";
     705        if (termsetitem != null) termset = termsetitem.key;
     706        searchclauseset.searchclauses[i][j].value = e.value;
     707       
     708}
     709 
     710function selectItemValue(li) {
     711        findValueValue(li);
     712}
     713
     714function initValueAutocomplete(i,j,index, term_index){
     715       
     716        $('#' + 'sc' +  i + '-' + j).find('.value-input').autocomplete({
     717                source: element_autocomplete[index].data[term_index].values,
     718                autoFill:true,
     719                width:150,
     720                minLength: 0,
     721                matchContains:true,
     722                delay: 0,
     723                select: function( event, ui ) {
     724                        $(this).data("item", ui.item);
     725                        selectItemValue(ui.item);
     726                }
     727        }).data( "autocomplete" )._renderItem = function( ul, item ) {
     728                var t, re;
     729                if (this.term == ""){
     730                        t = item.value;
     731                } else {
     732                        re = new RegExp(this.term + "+") ;
     733                    t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" + 
     734                            this.term + 
     735                            "</span>");
     736                }
     737               
     738            return $( "<li></li>" )
     739                .data( "item.autocomplete", item )
     740                .append( "<a>" + t + "</a>" )
     741                .appendTo( ul );
     742        };
     743
     744       
     745        // reset the index value
     746        $('#' + 'sc' +  i + '-' + j).find('.value-input').val("");
     747        searchclauseset.searchclauses[i][j].value = "";
     748        $('#' + 'sc' +  i + '-' + j).find('.value-input').show();
     749        $('body').find('.ac_results').css({'z-index' : '1000'});
     750       
     751       
     752        $('.focused','#searchclauselist').find('.value-input').focus();
     753
     754       
     755};
     756
    699757function findValueTerm(e) {
    700758                       
     
    709767                        searchclauseset.searchclauses[i][j].index = termset + ":" +  e.value;
    710768                       
    711                         //handleTermsSelection(i,j,sValue);             
     769                        //handleTermsSelection(i,j,sValue);     
     770                        //find element value
     771                        var index;
     772                        $.each(element_autocomplete,function(i, item){
     773                                if (this.key == elem.key){
     774                                        index = i;
     775                                        return;
     776                                }
     777                        });
     778                        var term_index;
     779                        $.each(element_autocomplete[index],function(i, item){
     780                                if (this.key == e.key){
     781                                        term_index = i;
     782                                        return;
     783                                }
     784                        });
     785                        if (element_autocomplete[index].data[term_index].values.length == 0){
     786                        jQuery.get(link('fcs','?operation=scan&scanClause=' + e.value),function(data){
     787                                $(data).find('sru:term').each(function(i){
     788                                        element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('sru:value').text()};
     789                                });
     790                                initValueAutocomplete(i,j, index, term_index);
     791                                });
     792                        } else {
     793                                initValueAutocomplete(i,j, index, term_index);
     794                        }
     795                       
    712796                       
    713797}
     
    716800                        findValueTerm(li);
    717801                }
    718 
    719802
    720803function initTermsetAutocomplete(i,j,index){
     
    752835                .append( "<a>" + t + "</a>" )
    753836                .appendTo( ul );
    754 };
     837        };
    755838
    756839       
     
    805888                jQuery.get(link('smc','list/?context=' + element_autocomplete[index].key),function(data){
    806889                        $(data).find('Term').each(function(i){
    807                                 element_autocomplete[index].data[i] = {label:$(this).text(), value:$(this).text(), id:$(this).attr("concept-id") };
     890                                element_autocomplete[index].data[i] = {label:$(this).text(), value:$(this).text(), id:$(this).attr("concept-id"),values:[] };
    808891                        });
    809892                        initTermsetAutocomplete(i,j, index);
  • MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/FCSAction.java

    r1852 r1866  
    3535import eu.clarin.cmdi.mdservice.model.WorkspaceProfile;
    3636import eu.clarin.cmdi.mdservice.proxy.FCSProxy;
     37import eu.clarin.cmdi.mdservice.proxy.LocalProxy;
    3738import eu.clarin.cmdi.mdservice.proxy.MDRepoProxy;
    3839import eu.clarin.cmdi.mdservice.proxy.Pz2Proxy;
     
    9394
    9495        @Override
    95         public String getFullFormat() {         
     96        public String getFullFormat() {
     97                //TODO how to get around ??
     98                if (getActionkey().equals("static")){
     99                        return getActionkey() +  "2" + getFormat();
     100                }
    96101                return getActionkey() + getOperation() + "2" + getFormat();
    97102        }
     
    142147                // set defaults
    143148               
     149                if ((getParam("operation").equals("")) && (getParam("query").equals(""))){
     150                        addParam("operation","explain");
     151                }
     152                if ( (getParam("operation").equals("explain")) && (getParam("query").equals(""))){
     153                        addParam("q", "explain");
     154                        //TODO how to get around ?
     155                        this.setActionkey("static");
     156                }
    144157                        if (params.get("x-context") != null){
    145158                               
     
    195208                //TODO case scan,explain
    196209               
    197                 if ((getRepository().equals("")) && (getParam("operation").equals("scan"))){
    198                         setTargetProxy(new WorkspaceProxy());
    199                 return;
     210                if (getRepository().equals("")){
     211                        if ((getParam("operation").equals("scan")) && (getParam("scanClause").equals("fcs.resource"))){
     212                                setTargetProxy(new WorkspaceProxy());
     213                        return;
     214                        }
     215                        if (getParam("operation").equals("explain")){
     216                                setTargetProxy(new LocalProxy());
     217                        return;
     218                        }
     219               
    200220                }
    201221               
Note: See TracChangeset for help on using the changeset viewer.