- Timestamp:
- 2019-06-11T19:11:35+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js
r33143 r33145 346 346 doc.marker.setVisible(true); 347 347 } 348 markersOnMap++; // TODO: what do we do with this when we have shapes. This variable may be connected with centring the map?348 markersOnMap++; 349 349 } 350 350 … … 364 364 if(markersOnMap > 1) 365 365 { 366 //alert("@@@@ fitting bounds, current zoom is: " + _map.getZoom());367 366 _map.fitBounds(bounds); 368 367 } else if (markersOnMap == 1) { … … 404 403 for(var i = 0; i < _docList.ids.length; i++) 405 404 { 406 405 var doc = _docList.getDocByIndex(i); 407 406 if(doc.marker.getVisible()) 408 407 { … … 439 438 } 440 439 441 // Unused at present, called by draggableCreateMarker442 // Map used to have editable markers. Now editable markers are restricted to the map-editor.443 function attachDraggableClickHandler(marker, nodeID)444 {445 google.maps.event.addListener(marker, 'click', function()446 {447 document.location.href = gs.xsltParams.library_name + "?a=d&ed=1&c=" + gs.cgiParams.c + "&d=" + nodeID + "&dt=hierarchy&p.a=b&p.sa=&p.s=ClassifierBrowse";448 449 });450 451 if (("docEdit" in gs.cgiParams) && (gs.cgiParams['docEdit'])) {452 google.maps.event.addListener(marker, 'mouseup', function()453 {454 var lat = marker.getPosition().lat();455 var lng = marker.getPosition().lng();456 var collection = gs.cgiParams.c;457 var site_name = gs.xsltParams.site_name;458 459 if (nodeID == "") {460 nodeID = gs.cgiParams.d;461 }462 console.log("GPS Click handler in collection:" + collection + " in site: " + site_name + " for Doc: " + nodeID + "(" + lat + "," + lng + ")");463 464 var callbackFunction = function(){console.log("Completed saving metadata changes. You must rebuild the collection for the changes to take effect.");};465 466 // set 5th parameter, metapos (metadata position) or 7th param prevMetaValue (previous metadata value) to non-null if you want metamode=override to work467 // if neither of these 2 are set, then metamode is changed to 'accumulate' instead.468 gs.functions.setArchivesMetadata(collection, site_name, nodeID, "Latitude", null, lat, null, "override", function(){callbackFunction();});469 gs.functions.setArchivesMetadata(collection, site_name, nodeID, "Longitude", null, lng, null, "override", function(){callbackFunction();});470 gs.functions.setArchivesMetadata(collection, site_name, nodeID, "Coordinate", null, lat + " " + lng, null, "override", function(){callbackFunction();});471 console.log("NodeID: " + nodeID);472 console.log("GPS Click handler in collection:" + collection + " in site: " + site_name + " for Doc: " + nodeID + "(" + lat + "," + lng + ")");473 });474 }475 }476 440 477 441 function focusDocument(id) … … 673 637 document.location.href = gs.xsltParams.library_name + "?a=d&ed=1&c=" + gs.cgiParams.c + "&d=" + nodeID + "&dt=hierarchy&p.a=b&p.sa=&p.s=ClassifierBrowse"; 674 638 }); 675 }676 677 // TODO:678 // Version of createMarker function containing Zeddy's modifications (pre-mapeditor?) to make markers679 // on the public *map* (not on map-editor) draggable/editable and to save these edits/rebuild with them.680 // Do we want to continue supporting editing on the main map? I thought we weren't going to and that editing681 // was exclusive to the map-editor, with the public map only displaying the saved features?682 function draggableCreateMarker(doc, pos, mainMarker)683 {684 var docEdit = (("docEdit" in gs.cgiParams) && (gs.cgiParams['docEdit']));685 //var draggable_val = (docEdit) ? true : false;686 687 // When user logs out, the very first page they're returned to has logout set688 // If the user logged out when leaving docEdit on, then the very first page has docEdit=1 AND logout.689 // In that case, don't allow editing. Subsequent pages in logged out mode have neither logout nor docEdit=1 set.690 var loggedOutVar = ("logout" in gs.cgiParams);691 692 // Don't allow dragging if either 1. docEdit not on OR 2. logout is in the cgiParams693 var draggable_val = (!docEdit || loggedOutVar) ? false : true;694 695 var marker;696 if(mainMarker)697 {698 marker = new google.maps.Marker699 ({700 position: pos,701 title:doc.title,702 map:_map,703 draggable: draggable_val704 });705 }706 else707 {708 marker = new google.maps.Marker709 ({710 position: pos,711 title:doc.title,712 map:_map,713 icon:"interfaces/" + gs.xsltParams.interface_name + "/images/bluemarker.png",714 draggable: draggable_val715 });716 }717 718 var docElement = gs.jqGet("div" + doc.nodeID);719 var parent;720 if(docElement)721 {722 parent = docElement.parentNode;723 }724 725 while(parent && parent.nodeName != "BODY")726 {727 if($(parent).attr("id") && $(parent).attr("id").search("divCL") != -1)728 {729 doc.parentCL = parent;730 break;731 }732 733 parent = parent.parentNode;734 }735 736 var info = new google.maps.InfoWindow({content:doc.title});737 marker.markerInfo = info;738 doc.marker = marker;739 attachDraggableClickHandler(marker, doc.nodeID);740 741 ////////////////////////////////////////////////////// TEST742 743 newLat = marker.getPosition().lat();744 newLng = marker.getPosition().lng();745 //console.log("Latitude " + newLat);746 //console.log("Longitude " + newLng);747 //NewLatLng(newLat, newLng);748 749 // // Define the LatLng coordinates for the polygon's path.750 // var triangleCoords = [751 // {lat: 18.774, lng: -80.190},752 // {lat: 18.466, lng: -64.600},753 // {lat: 32.321, lng: -64.757},754 // {lat: 32.300, lng: -80.190},755 // {lat: 28.300, lng: -90.190}756 // ];757 //758 // // Construct the polygon.759 // var bermudaTriangle = new google.maps.Polygon({760 // paths: triangleCoords,761 // strokeColor: '#FF0000',762 // strokeOpacity: 0.8,763 // strokeWeight: 2,764 // fillColor: '#FF0000',765 // fillOpacity: 0.35766 // });767 // bermudaTriangle.setMap(map);768 639 } 769 640 … … 1006 877 } 1007 878 879 // This function "overrides" (or rather, redefines) toggleSection in both classifier_scripts.js and document_scripts.js 880 // However, classifier_scripts.js::toggleSection() only took one parameter, sectionID, whereas 881 // document_scripts.js::toggleSection() took 3 params (sectionID, callback, tocDisabled). 882 // So to be compatible with both, need map-scripts::toggleSection() here to support all 3 in that order. 1008 883 function modifyFunctions() 1009 { 1010 // This function "overrides" toggleSection in both classifier_scripts.js and document_scripts.js 1011 // However, classifier_scripts.js::toggleSection() only took one parameter, sectionID, whereas 1012 // document_scripts.js::toggleSection() took 3 params (sectionID, callback, tocDisabled). 1013 // So to be compatible with both, need map-scripts::toggleSection() here to support all 3 in that order. 884 { 1014 885 toggleSection = function(sectionID, callback, tocDisabled) 1015 886 { … … 1024 895 } 1025 896 897 //If the div exists 1026 898 // Test if 'section' exists. 1027 899 // ==> Because we're using jQuery to do this we need to test the length of the object returned … … 1091 963 checkout(); 1092 964 } 1093 /*else if(gs.cgiParams.documentbasket == "on") // TODO: copied from classifier_scripts.js - should this else block be included here (and happen when mapEnabled) or not?965 else if(gs.cgiParams.documentbasket == "on") 1094 966 { 1095 967 dmcheckout(); 1096 } */968 } 1097 969 updateOpenClassifiers(); 1098 970 getSubClassifier(sectionID);
Note:
See TracChangeset
for help on using the changeset viewer.