Changeset 30736

Show
Ignore:
Timestamp:
22.08.2016 20:48:17 (3 years ago)
Author:
ak19
Message:

Several bugfixes noticed in the Images-GPS tutorial collection: 1. Dr Bainbridge fixed the huge location URL string by having it passed by POST instead of GET. 2. Dr Bainbridge corrected a check for the existence of an object returned with jQuery. Also applied the same correction in another location where this test is used. This helped withb expanding and collapsing book shelves using the plus icon. 3. The bookshelf nodes would expand upwards instead of downwards. Corrected this too. 4. The Scroll Through Places checkbox was not functioning, as it would keep scrolling even when unchecked. Now fixed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js

    r29277 r30736  
    3535        else 
    3636        { 
    37             $("#map_canvas").css({visibility:"hidden", height:"0px"}); 
     37            //$("#map_canvas").css({visibility:"hidden", height:"0px"}); 
     38            $("#map_canvas").css({visibility:"hidden"}); 
    3839        } 
    3940    } 
     
    4647        startStopCheckbox.click(function() 
    4748        { 
    48             if(startStopCheckbox.attr("checked")) 
    49             { 
     49            // http://stackoverflow.com/questions/901712/how-to-check-if-a-checkbox-is-checked-in-jquery 
     50            // http://stackoverflow.com/questions/5270689/attrchecked-checked-does-not-work 
     51         
     52            if($('#scrollCheckbox').is(':checked')) // OR: if(document.getElementById('scrollCheckbox').checked) 
     53            {            
    5054                if(_intervalHandle == null) 
    5155                { 
     
    171175    } 
    172176     
    173     var url = gs.xsltParams.library_name + "?a=q&s=RawQuery&rt=rd&c=" + gs.cgiParams.c + "&s1.rawquery=" + query + "&excerptid=jsonNodes"; 
    174      
    175     $.ajax(url) 
     177    //var url = gs.xsltParams.library_name + "?a=q&s=RawQuery&rt=rd&c=" + gs.cgiParams.c + "&s1.rawquery=" + query + "&excerptid=jsonNodes"; 
     178    var url = gs.xsltParams.library_name; 
     179    var data = "a=q&s=RawQuery&rt=rd&c=" + gs.cgiParams.c + "&s1.rawquery=" + query + "&excerptid=jsonNodes"; 
     180     
     181    $.ajax({type:"POST", url:url, data:data}) 
    176182    .success(function(responseText) 
    177183    { 
     184        //console.log("*** responseText (first 250) = " + responseText.substring(0,256)); 
     185         
    178186        if(responseText.search("id=\"jsonNodes") != -1) 
    179187        { 
     
    207215         
    208216        _searchRunning = false; 
     217    }).fail(function(responseText, textStatus, errorThrown) // fail() has replaced error(), http://api.jquery.com/jquery.ajax/ 
     218        { 
     219            console.log("In map-scripts.performSearchForMarkers(): Got an error in ajax call"); 
     220            _searchRunning = false; 
    209221    }); 
    210222} 
     
    631643        } 
    632644         
    633         if(section) 
    634         { 
     645        // Test if 'section' exists.   
     646        // ==> Because we're using jQuery to do this we need to test the length of the object returned 
     647        // http://stackoverflow.com/questions/920236/how-can-i-detect-if-a-selector-returns-null 
     648        if(section.length !== 0) 
     649        {            
    635650            if(isExpanded(sectionID)) 
    636651            { 
     
    638653                sectionToggle.attr("src", gs.imageURLs.expand); 
    639654                 
    640                 if(openClassifiers[sectionID] != undefined) 
     655                if(openClassifiers[sectionID].length !== 0) //if(openClassifiers[sectionID] != undefined) 
    641656                { 
    642657                    delete openClassifiers[sectionID]; 
     
    684699                var newDiv = $("<div>");                                         
    685700                var sibling = gs.jqGet("title" + sectionID); 
    686                 sibling.before(newDiv); 
     701                sibling.after(newDiv); 
    687702                 
    688703                newDiv.html(responseText);