Changeset 31023


Ignore:
Timestamp:
2016-11-01T23:46:25+13:00 (6 years ago)
Author:
Georgiy Litvinov
Message:

More modifications to hierarchy webeditor

File:
1 edited

Legend:

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

    r31014 r31023  
    1212{
    1313   
    14     var id = a.getAttribute("title");
     14    var metaValue = a.getAttribute("metavalue");
     15    var metaTitle = a.getAttribute("metatitle");
    1516   
    1617// If ID defined and not null
    17     if (id && (id != null))
     18    if (metaValue && (metaValue != null))
    1819    {
    1920        //find TR Ancestor to get TEXTAREA
    2021        var tr = findAncestorByTagName(a,"TR");
    2122        //Set value to id of clicked element
    22         $(tr.getElementsByTagName("TEXTAREA")).val(id);
     23        $(tr.getElementsByTagName("TEXTAREA")).val(metaValue);
    2324        //  Set button name
    24         removeSuggestionsMenu(tr, $(a).text());
     25        removeSuggestionsMenu(tr, metaTitle);
    2526        //Hide menu after click
    2627        $(tr).find(".metaDataHierarchyMenu").find("ul li ul li").hide();
     
    7273                {
    7374                    if(childExpr.test(key)){
    74                         levelItems[key]='<li id="'+key+'" ><button onclick="setHierarchyId(this)"  title='+ hierarchyData[key][0] +'>' + hierarchyData[key][1] + '</button></li>';
     75                        levelItems[key]='<li id="'+key+'" ><button onclick="setHierarchyId(this)"  metavalue='+ hierarchyData[key][0] +' metatitle='+ hierarchyData[key][1] +'>' + hierarchyData[key][1] + '</button></li>';
    7576                        //console.log(levelItems[key]);
    7677                       
     
    164165    $(father).find(className).hover(function()
    165166    {
    166     //  console.log("HOVER ENTERED")
    167167        openHierarchyMenuLevel(this);
    168168    }, function() {
    169     //  console.log("HOVER EXITED")
    170169        closeHierarchyMenuLevel(this);
    171170    });
     
    174173function createHierarchyMenuButton(row)
    175174{
    176     //console.log(row)
    177     //console.log(metaName)
    178175        //get current MetaDataName
    179176        var metaName = $(row.getElementsByClassName("metaTableCellName")[0]).text();
     
    186183        var hierarchyData = hierarchyStorage[metaName];
    187184       
    188         if (hierarchyData[textAreaValue])
     185        if (hierarchyData[textAreaValue] && (hierarchyData[textAreaValue] != null))
    189186        {               
    190             hierarchyMenuName = hierarchyData[textAreaValue];
     187            hierarchyMenuName = hierarchyData[textAreaValue][1];
     188           
    191189        }
     190       
    192191        //Menu element
    193192        var mainmenu = '<td class="metaDataHierarchyMenu" style="display: none;"><ul><li id="hierarchyLevel"><button class="hierarchyMenuButton"  title="Menu">' + hierarchyMenuName + '</button></li></ul></td>'
     
    243242        if (SuggestionsMenuExp.test(key))
    244243        {
    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>';
     244            SuggestionsMenuItems[key]='<li class="hierarchySuggestionsMenu" id="'+key+'" ><button metavalue='+ hierarchyData[key][0] +' metatitle='+ hierarchyData[key][1] +' onclick="setHierarchyId(this)" >' + key.substring(String(input).length) + " " + hierarchyData[key][1] + '</button></li>';
    246245        }
    247246       
Note: See TracChangeset for help on using the changeset viewer.