Changeset 32770


Ignore:
Timestamp:
2019-02-12T13:36:44+13:00 (5 years ago)
Author:
ak19
Message:

Edit Map GPS and Hide Map GPS buttons

Location:
main/trunk/greenstone3/web/interfaces/default/js
Files:
2 edited

Legend:

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

    r32471 r32770  
    3737var multiValuedMetadata = new Array(); // eg ["xx.Person", "xx.Location"];
    3838var mvm_delimiter = ";";
    39 
     39var mapsIdsArray = []; //An array for the IDs of all the maps created
    4040/************************
    4141* METADATA EDIT SCRIPTS *
     
    4747    var id = cell.attr("id").substring(6);
    4848    var metaTable = gs.jqGet("meta" + id);
    49     var row = cell.parent();
     49    var row = cell.parent();   
    5050    var newCell = $("<td>", {"style": "font-size:0.7em; padding:0px 10px", "class": "editMetadataButton"});
    5151    var linkSpan = $("<span>", {"class": "ui-state-default ui-corner-all", "style": "padding: 2px; float:left;"});
    5252   
    53         var linkLabel = $("<span>"+gs.text.de.edit_metadata+"</span>");
     53    var linkLabel = $("<span>"+gs.text.de.edit_metadata+"</span>");     
    5454    var linkIcon = $("<span>", {"class": "ui-icon ui-icon-folder-collapsed"});
    5555    newCell.linkIcon = linkIcon;
     
    6868    newLink.click(function()
    6969    {
     70        console.log(metaTable.metaNameField);
    7071        if(metaTable.css("display") == "none")
    7172        {
     
    7677            metaTable.addRowButton.css("display", "inline");
    7778            if (enable_add_all_metadata_button == true) {
    78             metaTable.addAllButton.css("display", "inline");
     79                metaTable.addAllButton.css("display", "inline");
    7980            }
    8081        }
    8182        else
    8283        {
    83             linkLabel.html(gs.text.de.edit_metadata);
     84            linkLabel.html(gs.text.de.edit_metadata);           
    8485            linkIcon.attr("class", "ui-icon ui-icon-folder-collapsed");
    8586            metaTable.css("display", "none");
     
    8788            metaTable.addRowButton.css("display", "none");
    8889            if (enable_add_all_metadata_button == true) {
    89             metaTable.addAllButton.css("display", "none");
     90                metaTable.addAllButton.css("display", "none");
    9091            }
    9192        }
     
    105106}
    106107
     108
     109function addEditMapGPSLink(cell)
     110{
     111    cell = $(cell);
     112    var id = cell.attr("id").substring(6);
     113    //console.log(id);
     114    var mapGPScontainer = gs.jqGet("map-and-controls-" + id);
     115    console.log(mapGPScontainer);
     116    var row = cell.parent();
     117    var newCell = $("<td>", {"style": "font-size:0.7em; padding:0px 10px", "class": "editMapGPSButton"});
     118    var linkSpan = $("<span>", {"class": "ui-state-default ui-corner-all", "style": "padding: 2px; float:left;"});
     119   
     120    var linkLabel = $("<span>"+gs.text.de.edit_map_gps+"</span>");     
     121    var linkIcon = $("<span>", {"class": "ui-icon ui-icon-folder-collapsed"});
     122    newCell.linkIcon = linkIcon;
     123    newCell.linkLabel = linkLabel;
     124   
     125    var uList = $("<ul>", {"style": "outline: 0 none; margin:0px; padding:0px;"});
     126    var labelItem = $("<li>", {"style": "float:left; list-style:none outside none;"});
     127    var iconItem = $("<li>", {"style": "float:left; list-style:none outside none;"});
     128
     129    uList.append(iconItem);
     130    uList.append(labelItem);
     131    labelItem.append(linkLabel);
     132    iconItem.append(linkIcon);
     133   
     134    var newLink = $("<a>", {"href": "javascript:;"});
     135    newLink.click(function()
     136    {
     137        console.log("Show/Hide Map Editor");
     138       
     139        // Only if this 'id' element hasn't been initialied, then do the following 2 lines
     140        if(map !== null){
     141            console.log(map.mapId);
     142            console.log(mapsIdsArray.includes(id));
     143        }
     144       
     145       
     146        if(map == null){
     147            console.log(id);
     148            initMapEditorControls(id);
     149            initMapEditor(id);
     150            mapsIdsArray.push(map.mapId)
     151        } else if(mapsIdsArray.includes(id) == false){
     152            initMapEditorControls(id);
     153            initMapEditor(id);
     154            mapsIdsArray.push(map.mapId)
     155        }
     156
     157       
     158       
     159        if(mapGPScontainer.css("display") == "none")
     160        {
     161           
     162            linkLabel.html(gs.text.de.hide_map_gps);
     163            linkIcon.attr("class", "ui-icon ui-icon-folder-open");
     164            mapGPScontainer.css("display", "block");
     165
     166           
     167        }
     168        else
     169        {
     170            linkLabel.html(gs.text.de.edit_map_gps);
     171           
     172            linkIcon.attr("class", "ui-icon ui-icon-folder-collapsed");
     173            mapGPScontainer.css("display", "none");
     174   
     175           
     176        }
     177    });
     178
     179    newLink.append(uList); 
     180    linkSpan.append(newLink);
     181    newCell.append(linkSpan);
     182    row.append(newCell);
     183   
     184    mapGPScontainer.css("display","none");
     185   
     186   
     187    addFunctionalityToTable(mapGPScontainer);
     188    mapGPScontainer.metaNameField.css("display", "none");
     189    mapGPScontainer.addRowButton.css("display", "none");
     190    if (enable_add_all_metadata_button == true) {
     191      mapGPScontainer.addAllButton.css("display", "none");
     192    }
     193   
     194}
     195
    107196function setEditingFeaturesVisible(visible)
    108197{
     
    122211    $("#metadataListLabel, #metadataSetList").css("display", visibility);
    123212    }
     213   
    124214    $(".editMetadataButton").each(function()
    125215    {
     
    127217        $(this.linkLabel).html(gs.text.de.edit_metadata);
    128218        $(this.linkIcon).attr("class", "ui-icon ui-icon-folder-collapsed");
     219    });
     220    /*
     221    $(".editMapGPS").each(function()
     222    {
     223        $(this).css("display", visibility);
     224        $(this.linkLabel).html(gs.text.de.edit_map_gps);       
     225        $(this.linkIcon).attr("class", "ui-icon ui-icon-folder-collapsed");
    129226    });
     227    */
    130228   
    131229    $("table").each(function()
     
    219317    {
    220318        addEditMetadataLink(titleDivs[i]);
     319        addEditMapGPSLink(titleDivs[i]);
    221320    }
    222321   
  • main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts_util.js

    r32471 r32770  
    929929}
    930930
    931 
     931function addFunctionalityToMapGPS(mapGPScontainer)
     932{
     933   
     934}
    932935
    933936function addFunctionalityToTable(table)
Note: See TracChangeset for help on using the changeset viewer.