Ignore:
Timestamp:
2019-06-06T20:53:13+12:00 (5 years ago)
Author:
wy59
Message:

Improvements to Coordinate support AND bugfixes. BUT not all the fixes may be ideal, many marked with TODO. 1. Now we support an Array of coordinates. At present these are only displayed as Markers, but in future shapes should appear as shapes. 2. Bugfixes include: (a) expanding sections wasn't working when we had hierarchical docs with Coordinate data, because map-scripts 'overrode' the toggleSection function but no longer did any of the doc expanding behaviour that document_scripts.js used to do. This was not a problem with the ImagesGPS collection, simply because that did not have hierarchical/sectionalised documents. (b) Perl: A previous commit output duplicate Coordinates into the index. Now this doesn't happen. Fix works but may not be ideal. 3. Perl: (a) Reserved index names CD, CS for Coordinate and CoordShort. Note however that LAT and LNG were never added to reserve list for index names. (b) Now doc.pm::processCoord() takes a section parameter and works out the section-ptr from that.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js

    r33016 r33128  
    11/** Javascript file for viewing documents */
     2
     3//-------TODO--------//
     4// map-scripts.js needs these, but non-map viewing does not. Yet if we add these to map_scripts,
     5// then in classifier mode, map_scripts will use classifier_scripts.js which already has these
     6// So for now, we add them into this file for when map_scripts is in doc view mode and includes document_scripts.js.
     7// It seems suboptimal, as these variables and function will be wasted when in regular non-map mode.
     8// But unable to think of any other solution at present.
     9var inProgress = new Array();
     10var openClassifiers = new Array();
     11var busy = false;
     12
     13
     14
     15function updateOpenClassifiers()
     16{
     17    var oc = "";
     18    var first = true;
     19    for(var key in openClassifiers)
     20    {
     21        if(first)
     22        {
     23            first = false;
     24        }
     25        else
     26        {
     27            oc += ",";
     28        }
     29       
     30        oc += key;
     31    }
     32   
     33    if(oc != undefined)
     34    {
     35        window.location.hash = oc;
     36    }
     37}
     38
     39//---------------//
    240
    341/** NOTE, this file uses inline templates which look for httpPath, assocfilepath, Source, Thumb, Title metadata. These need to be added into any xsl file that uses this javascript (using <gsf:metadata name="xx" hidden="true"/> if they are not already being collected. */
     
    66104    url += "&ck=" + gs.cgiParams.ck;
    67105    }
    68      
    69    
     106   
     107   
    70108   
    71109    $.ajax(url)
     
    82120            }
    83121           
    84             var text = response.substring(textStart, textEnd);
     122            var text = response.substring(textStart, textEnd);         
    85123            callback(text);
    86124        }
     
    133171                return;
    134172            }
    135            
    136             var sections = response.substring(sectionsStart, sectionsEnd);
    137             callback(sections);
     173            else {
     174                var sections = response.substring(sectionsStart, sectionsEnd);
     175                callback(sections);
     176            }
    138177        }
    139178        else
     
    145184    {
    146185        callback(null);
    147     });
    148 }
    149 
     186    });             
     187}
     188
     189// TODO:
     190// DO NOT "MERGE" _basicToggleSection into toggleSection!
     191// map_scripts.js calls _basicToggleSection as it redefines toggleSection() to do (more) stuff.
    150192function toggleSection(sectionID, callback, tocDisabled)
     193{
     194    _basicToggleSection(sectionID, callback, tocDisabled); 
     195}
     196function _basicToggleSection(sectionID, callback, tocDisabled)
    151197{
    152198    var docElem = gs.jqGet("doc" + sectionID);
     
    173219            {
    174220                if(text)
    175                 {   
     221                {                  
    176222                    var nodeID = sectionID.replace(/\./g, "_");
    177223                    if(text.search("wrap" + nodeID) != -1)
     
    193239                            if(callback)
    194240                            {
    195                                 callback(true);
     241                                callback(true);                             
    196242                            }
    197243                           
     
    219265                    }
    220266                }
    221             });
    222        
    223             docToggleElem.attr("src", gs.imageURLs.loading);
     267            });     
     268           
     269            docToggleElem.attr("src", gs.imageURLs.loading);           
    224270        }
    225271        else
     
    310356{
    311357    expandAndExecute(sectionID, level, tocDisabled, function()
    312             {
     358            {               
    313359                var topVal = $(document.getElementById("doc" + sectionID)).offset().top - 50;
    314360                $('html, body').stop().animate({scrollTop: topVal}, 1000);
     
    332378    if(!level)
    333379    {
    334         level = 0;
     380        level = 0;     
    335381    }
    336382    var parts = sectionID.split(".");
     
    360406        toggleSection(idToExpand, function(success)
    361407        {
    362             if(success)
    363             {
    364                 expandAndExecute(sectionID, level + 1, tocDisabled, executeAfter);
    365             }
    366         }, tocDisabled);
     408                if(success)
     409                {
     410                    expandAndExecute(sectionID, level + 1, tocDisabled, executeAfter);
     411                }           
     412            }, tocDisabled);       
    367413    }
    368414    else
     
    534580{
    535581    var docElem = gs.jqGet("doc" + sectionID);
    536     if(docElem.css("display") == "block")
     582   
     583    if(docElem.css("display") === "block")
    537584    {
    538585        return true;
Note: See TracChangeset for help on using the changeset viewer.