Changeset 1493


Ignore:
Timestamp:
08/22/11 20:19:26 (13 years ago)
Author:
gaba
Message:

pazpar timeout clientside

Location:
MDService2/trunk/MDService2/WebContent/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice_model.js

    r1487 r1493  
    117117        return reptype;
    118118};
     119
     120Workspace.prototype.getOption = function(opt_key){
     121        var value = "";
     122       
     123        value = workspace.server_json["WorkspaceProfile"]["Options"][opt_key];
     124       
     125        return value;
     126}
    119127
    120128Workspace.prototype.removeelement = function(type, id1, id2){
     
    237245        } );
    238246};
    239 Query.prototype.pazpar2show = function(data){
     247Query.prototype.pazpar2show = function(data, activeClients){
    240248        //this.container.find('.result').html(data);
    241249       
     
    261269       
    262270       
    263         if (Number( $(data).find(".activeclients").text() ) == 0) {
    264         //if (data.activeclients == 0){
     271        //if (Number( $(data).find(".activeclients").text() ) == 0) {
     272        if (activeClients == 0){
    265273                // update link-hrefs
    266274                var qid = $(res).closest('.query_wrapper').attr("id");
     
    831839                var reptype = workspace.getRepositoryType(this.repository);
    832840               
     841                // USE CLIENT PAZPAR
    833842                if (reptype=="pazpar"){
    834843                        //pazpar handling this
     
    843852                                uri = link('sru', this.format, this.sruquery_uri());
    844853                        } else {
    845                                
     854                                // USE SERVER PAZPAR
    846855                                //if (reptype=="pazpar"){
    847856                                //      uri = link('pazpar', this.format, this.query_uri());
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice_pz2.js

    r1486 r1493  
    9595    this.recordCounter = 0;
    9696
     97    this.showStartTime = 0;
     98    this.showTimeout = workspace.getOption("pazpartimeout");
    9799    // active clients, updated by stat and show
    98100    // might be an issue since bytarget will poll accordingly
     
    237239                                                     context.searchStatusOK = true;
    238240                                                     //piggyback search
     241                                                             var d = new Date();
     242                                                     context.showStartTime = d.getTime();
    239243                                                     context.show(start, num, sort);
    240244                                                     if ( context.statCallback )
     
    336340                   
    337341                    context.showCounter++;
    338                     var delay = context.showTime;
    339                     if (context.showCounter > context.showFastCount)
     342                    var delay = context.showTime;
     343                    var d = new Date();
     344                    var currentTime = d.getTime();
     345                    if (context.showCounter > context.showFastCount)
    340346                            delay += context.showCounter * context.dumpFactor;
    341                     if ( activeClients > 0 ){
    342                         context.showTimer = setTimeout(
    343                             function () {
    344                                 context.show();
    345                             },
    346                             delay);
    347                     }
     347                   
     348                                if ((currentTime - context.showStartTime)/1000 > context.showTimeout){
     349                                        //$(tempdata).find(".activeclients").html('0');
     350                                        //$(tempdata).find(".activeclients")[0].textContent = '0';
     351                                        activeClients = 0;
     352                                }
     353                        if ( activeClients > 0 ){
     354                                context.showTimer = setTimeout(
     355                                    function () {
     356                                        context.show();
     357                                    },
     358                                    delay);
     359                            }
    348360                    global_show = $(data);//show;
    349                     context.showCallback($(data));
     361                    context.showCallback($(data), activeClients);
    350362                }
    351363                else
Note: See TracChangeset for help on using the changeset viewer.