Jump to content

andyhill

uniGUI Subscriber
  • Posts

    1266
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by andyhill

  1. I have no problems with SSL, all my SSL code works when the user types https://domainname.com What I want to do if the user types http://domainname.com then reroute them to https://domainname.com automatically.
  2. I want to make every user use our digital certificate (https), my code below has no effect - please advise - thanks. if UniSession.SSL = False then begin if DB.WantHTTPS = True then begin s:= UniSession.UrlReferer; s:= StringReplace(s, 'http', 'https', [rfReplaceAll]); UniSession.UrlRedirect(s); Close; end; end;
  3. Please show me how to implement :- // ' ajaxRequest(GPSmForm, ''_LatLong'', [myLatLng]); '+ or // ' ajaxRequest(GPSmForm.UnimHTMLFrame1, ''_LatLong'', [myLatLng]); '+ I need to get Lat/Lng when clicked (not as alert but as unigui event.
  4. The zoom failed, I tried many things before I asked you. As for the callback from Google Maps to my UniGUI Form I need help, please advise - thanks. ' google.maps.event.addListener '+ ' ( '+ ' gm, "dblclick", function(event) '+ ' { ' + ' var latitude = event.latLng.lat(); '+ ' var longitude = event.latLng.lng(); '+ ' ajaxRequest(GPSmForm, ''_LatLong'', ["lat=" latitude, "lng=" longitude]); '+
  5. Thank You. Now that I have all the info I need, how do I get it from Google (JS) back to UniGUI for storing ? I would have thought that I need some kind of GPSmForm Listener where JS passes the lat, lng and zoom variables. Would you kindly show me how to pass these variables - thanks.
  6. Fantastic. If I wanted the current zoom factor as well ? Once I have lat, lng and zoom then I need to collect this info in a unigui handler so I can store it in a table - any suggestions would be great.
  7. Farshad, I want to apologize for causing you any grief over this map issue. I have just found out Google was intermittently blocking my map requests demanding that I update my API Key (by throwing random errors) - now done - now working. If you could be so kind as to show me how to add a UniGUI Google Maps 'click' Listener and corresponding 'click' Handler so I can reverse geocode the Lat / Long where ever I click on the map - thanks
  8. I will need to use my API_KEY, please show me how to add the Api_Key (https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap) to the following code below (thanks):- UniSession.AddJS('var gm = googleMap; '+ 'if (typeof gm == "object") '+ '{ '+ ' gm.setCenter(new google.maps.LatLng('+LatStr+','+LongStr+')); '+ ' gm.setZoom('+ZoomStr+'); '+ ' var myLatLng = {lat: '+LatStr+', lng: '+LongStr+'}; '+ ' var circle = new google.maps.Circle '+ ' ( '+ ' { '+ ' strokeColor: ''#FF0000'', '+ ' strokeOpacity: 0.8, '+ ' strokeWeight: 2, '+ ' fillColor: ''#FF0000'', '+ ' fillOpacity: 0.02, '+ ' map: gm, '+ ' center: myLatLng, '+ ' radius: 300 '+ ' } '+ ' ); '+ '} ' );
  9. While I await for a work around for iPhone (VERY URGENT) I can continue to develop for Desktop. Can you be so kind as to show me how to add a UniGUI Google Maps 'click' Listener and corresponding 'click' Handler so I can reverse geocode the Lat / Long where ever I click on the map - thanks. UniSession.AddJS('var gm = googleMap; '+ 'if (typeof gm == "object") '+ '{ '+ Google Maps 'click' Listener for reverse geocode goes here ... procedure ... begin if SameText(EventName, 'click') then begin lat:= Params.Values['lat'] lng:= Params.Values['lng'] ...
  10. Farshad, your very own example FAILS on iOS, just run your example on iOS (I have tested it on iPhoneX, iPhone7, iPad and they all fail).
  11. Two things:- 1) Is there an easy way to determine if https ? 2) Google Maps works on Desktop but fails on iPhone with ajax error "Can't find variable: google" ? Any ideas ?
  12. No Go. I abandoned all my code and went back to your code only to find out that I did not have uniGUIVars in my uses clause - Can you advise how to place Pin - thanks
  13. I have in the URLFrame ExtEvents:- function afterupdatehtml(sender, eOpts) { var latlng = new google.maps.LatLng(0.0, 0.0); var myOptions = { zoom: 1, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var umap = document.getElementById("uni_map_canvas"); var map = new google.maps.Map(umap, myOptions); googleMap = map; ajaxRequest(GPSmForm.URLFrame, 'loaded', []); // Tried here as well google.maps.event.addListener(map, 'zoom_changed', function() { GPSmForm.Zoom.setValue(this.getZoom()); } ); google.maps.event.addListener(map, 'tilesloaded', function(e) { ajaxRequest(GPSmForm.URLFrame, 'loaded', []); // Never fired } ); } ... // 'loaded' Never Fired ? procedure TGPSmForm.URLFrameAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var LatStr, LongStr, s: String; begin if SameText(EventName, 'loaded') then begin if LoadedFlag = False then begin LoadedFlag:= True; LatStr:= Format('%2.4f', [uniMainModule.GpsLat]); LatStr:= StringReplace(LatStr, ',', '.', [rfReplaceAll]); LongStr:= Format('%2.4f', [uniMainModule.GpsLng]); LongStr:= StringReplace(LongStr, ',', '.', [rfReplaceAll]); // UniSession.AddJS('var gm=googleMap; '+ 'if (typeof gm=="object") '+ '{ '+ ' gm.setCenter(new google.maps.LatLng('+LatStr+','+LongStr+')); '+ ' gm.setZoom(17);'+ '}'); end; end; ...
  14. Tried all that, on https I still get Access Denied with URL frame. I logged all the errors above, please advise - thanks
  15. I changed the mobile HTMLFrame to a URLFrame and get the following error "Access Denied" error on http so will try on https and advise.
  16. Firstly I would like to pass a comment to the UniGUI team, the more I work with UniGUI the more I love it - thank you. It is a interesting learning curve from Delphi to UniGUI - again thanks for your patience. Now the question at hand:- I have some JS below that will interrogate the mobile GeoLocation services (under https) and return the Lat/Long if available - all good. What I have done instead of the Alert(Lat/Long), I am sending an ajax request with the Lat/Long data so I can listen for the ajax event (via PDFmForm.PDFFrame) and then call Google Maps via GPSmForm - please advise how to format the URL with ALL the positional data - thanks. // Get Lat/Long procedure TPDFmForm.UnimFormTitleButtonClick(Sender: TUnimTitleButton); begin case Sender.ButtonId of 0 : begin // Seperator end; 1 : begin UniSession.AddJS( 'navigator.geolocation.getCurrentPosition'+ '( '+ 'function(position)'+ '{ '+ // ' alert("Your latitude: " + [position.coords.latitude] + ", longitude: " + [position.coords.longitude]); '+ // removed alert and sent an ajax request with Lat/Long instead ' ajaxRequest(PDFmForm.PDFFrame, "_GeoLocation" ,' + ' ["lat=" + position.coords.latitude, ' + ' "lng=" + position.coords.longitude, ' + ' "acc=" + position.coords.accuracy, ' + ' "alt=" + position.coords.altitude, ' + ' "altacc=" + position.coords.altitudeAccuracy, ' + ' "head=" + position.coords.heading, ' + ' "ts=" + position.coords.timestamp ' + ' ]);' + '} '+ ', '+ 'function(error)'+ '{ '+ ' switch(error.code) '+ ' { '+ ' case 0: '+ // UnKown ' alert(error.message); '+ ' break; '+ ' case 1: '+ // Denied ' alert(error.message); '+ ' break; '+ ' case 2: '+ // UnAvailable ' alert(error.message); '+ ' break; '+ ' case 3: '+ // TimeOut ' alert(error.message); '+ ' break; '+ ' } '+ '} '+ ') ' ); ... // Listen for Lat/Long Request procedure TPDFmForm.PDFFrameAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if SameText(EventName, '_GeoLocation') then begin // Make available to GPSmForm UniMainModule.GpsLat:= StrToFloat(Params.Values['lat']); UniMainModule.GpsLng:= StrToFloat(Params.Values['lng']); // GPSmForm.ShowModal; end; end; ... // Call Google Maps procedure TGPSmForm.UnimFormShow(Sender: TObject); var LatStr, LongStr, s: String; begin LatStr:= Format('%2.4f', [uniMainModule.GpsLat]); LatStr:= StringReplace(LatStr, ',', '.', [rfReplaceAll]); LongStr:= Format('%2.4f', [uniMainModule.GpsLng]); LongStr:= StringReplace(LongStr, ',', '.', [rfReplaceAll]); // HTMLFrame.HTML.Clear; s:= 'https://www.google.com.au/maps/@'+LatStr+','+LongStr+',10z'; HTMLFrame.HTML.Add(s); // I need formatted URL for Google Maps with all of the Lat/Long info from position ERROR Desktop: "Cannot Read Property 'First Child' Of Null" ERROR Mobile: "Cannot find variable google" - is this in addition to above a UniServerModule Custom Files issue "http://maps.googleapis.com/maps/api/js?sensor=false"?
  17. andyhill

    SSL Issue

    This is what I learned. 1) GoDaddy defaults Certificate Length to 2yrs so requesting 365 days failed for me. 2) GoDaddy rsa must be 2048, 1024 failed for me. 3) openssl.exe req -new -newkey rsa:2048 -nodes -keyout key.pem -out req.csr Once processed and granted. if SSLFlag = True then begin if FileExists(UniServerModule.StartPath + 'Root.crt') = True then begin if FileExists(UniServerModule.StartPath + 'Cert.crt') = True then begin if FileExists(UniServerModule.StartPath + 'Key.pem') = True then begin SSL.SSLOptions.RootCertFile:= UniServerModule.StartPath + 'Root.crt'; SSL.SSLOptions.CertFile:= UniServerModule.StartPath + 'Cert.crt'; SSL.SSLOptions.KeyFile:= UniServerModule.StartPath + 'Key.pem'; // Possible UniGUI Bug - file must have .pem extension - same file contents with .crt extension fails if Trim(SSLPassword) <> '' then begin SSL.SSLPassword:= SSLPassword; end; SSL.SSLPort:= SSLPort; SSL.Enabled:= True; end; end; end; end;
  18. andyhill

    SSL Issue

    Yes, my ISP did the cert request for me with the info you suggested in the UniGUI docs. I have asked him to confirm if he did everything required, this is what I sent him (xxxxxxxxx is the domain name):- openssl.exe req -days 365 -nodes -newkey rsa:1024 -keyout xxxxxxxxx-key.pem -out xxxxxxxxx-cert.pem Waiting for his reply ...
  19. andyhill

    SSL Issue

    I have purchased a Digital Certificate from GoDaddy but cannot get it to work. Request: openssl.exe req -new -key nnnnn.nnn.key -out nnnnn.csr Files Validated (all in text format): Root Cert Key https://nnnnn.nnnlocks up and fails to work ? Please advise how to resolve - thanks.
  20. Is it possible that a Zoom event is interrupted by a Pan event (or visa versa), in other words there is no logic to prevent re-entry while executing ?
  21. I believe it relates to Flex. Assume we have 10 lines of text. Memo Component Canvas size and Memo Lines Displayed are not the same and if the text exceeds the Line Display area then text is cut off half way through the text. On Desktop a small vertical scrollbar is shown (not so with mobile). Either way I want to specify the number of Lines to Display -or- have display text lines fill the canvas area if applicable. --------------------------------------------- - text - - text - - text - - - - - - - - - - - - - - - - - ---------------------------------------------
  22. On iPhone it happens without rotating but is related to zooming and panning.
×
×
  • Create New...