Changeset 31014


Ignore:
Timestamp:
2016-11-01T07:42:03+13:00 (7 years ago)
Author:
Georgiy Litvinov
Message:

Modified hierarchy js storage, added kjdon fixes.

File:
1 edited

Legend:

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

    r30464 r31014  
    1212{
    1313   
    14     var id = a.parentElement.id;
    15     //console.log("Try to set ID" + id)
     14    var id = a.getAttribute("title");
     15   
    1616// If ID defined and not null
    1717    if (id && (id != null))
     
    7272                {
    7373                    if(childExpr.test(key)){
    74                         levelItems[key]='<li id="'+key+'" ><button onclick="setHierarchyId(this)"  title='+ hierarchyData[key] +'>' + hierarchyData[key] + '</button></li>';
     74                        levelItems[key]='<li id="'+key+'" ><button onclick="setHierarchyId(this)"  title='+ hierarchyData[key][0] +'>' + hierarchyData[key][1] + '</button></li>';
    7575                        //console.log(levelItems[key]);
    7676                       
     
    137137              var StringData = [];
    138138                var hierarchyData = {};
    139                 var expr = /^([0-9]+(?:\.[0-9]+)*)\ ([0-9]+(?:\.[0-9]+)*)\ (.*)/m;
     139                //var expr = /^([0-9]+(?:\.[0-9]+)*)\ ([0-9]+(?:\.[0-9]+)*)\ (.*)/m;
     140                var expr = /^(\S*|\"[^\"]*\")\ +([0-9]+(?:\.[0-9]+)*)\ +(.*)/m;
    140141                StringData = hierarchyFile.split('\n');
    141142                for (var i = 0; i < StringData.length; i++)
     
    143144                    var result = StringData[i].match(expr);
    144145                    // If result not null
    145                     if (result != null && result[2] != null && result[3] != null)
     146                    if (result != null && result.length == 4)
    146147                        {
    147148                        // populate hierarchy object
    148                         hierarchyData[result[2]] = result[3];
     149                        hierarchyData[result[2]] = [result[1], result[3]];
    149150                        }
    150151
     
    242243        if (SuggestionsMenuExp.test(key))
    243244        {
    244             SuggestionsMenuItems[key]='<li class="hierarchySuggestionsMenu" id="'+key+'" ><button onclick="setHierarchyId(this)" >' + key.substring(String(input).length) + " "  + hierarchyData[key] + '</button></li>';
     245            SuggestionsMenuItems[key]='<li class="hierarchySuggestionsMenu" id="'+key+'" ><button title='+ hierarchyData[key][0] +' onclick="setHierarchyId(this)" >' + key.substring(String(input).length) + " " + hierarchyData[key][1] + '</button></li>';
    245246        }
    246247       
Note: See TracChangeset for help on using the changeset viewer.