Skip to content

Commit

Permalink
Fixed issue #13873: When using the short free text with map, the sear…
Browse files Browse the repository at this point in the history
…ch box doesn't show for users

Dev: thank to geoname , even free account work in secure
  • Loading branch information
Shnoulle committed Apr 1, 2019
1 parent 97d2f8e commit 1930029
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 42 deletions.
11 changes: 6 additions & 5 deletions application/helpers/qanda_helper.php
Expand Up @@ -3118,14 +3118,15 @@ function do_shortfreetext($ia)

Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."map.js", LSYii_ClientScript::POS_END);
if ($aQuestionAttributes['location_mapservice'] == 1 && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
Yii::app()->getClientScript()->registerScriptFile("https://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey", LSYii_ClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScriptFile("https://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey", LSYii_ClientScript::POS_BEGIN);
} else if ($aQuestionAttributes['location_mapservice'] == 1) {
Yii::app()->getClientScript()->registerScriptFile("http://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey", LSYii_ClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScriptFile("http://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey", LSYii_ClientScript::POS_BEGIN);
} elseif ($aQuestionAttributes['location_mapservice'] == 2) {
Yii::app()->getClientScript()->registerScriptFile("http://www.openlayers.org/api/OpenLayers.js", LSYii_ClientScript::POS_BEGIN);
}
/* 2019-04-01 : openlayers auto redirect to https (on firefox) , but always good to use automatic protocol */
Yii::app()->getClientScript()->registerScriptFile("//www.openlayers.org/api/OpenLayers.js", LSYii_ClientScript::POS_BEGIN);
}

$questionHelp = false;
$questionHelp = false;
if (isset($aQuestionAttributes['hide_tip']) && $aQuestionAttributes['hide_tip'] == 0) {
$questionHelp = true;
$sQuestionHelpText = gT('Drag and drop the pin to the desired location. You may also right click on the map to move the pin.');
Expand Down
30 changes: 5 additions & 25 deletions assets/scripts/map.js
Expand Up @@ -154,26 +154,6 @@ function OSGeoInitialize(question,latLng){
}
)

// Zoom to 11 when switching to Aerial or Hybrid views - bug 10589 / @deprectaed : layer was updated
//~ var layer2Name, layer3Name, layerIndex = 0;
//~ for (var key in baseLayers) {
//~ if (!baseLayers.hasOwnProperty(key)) {
//~ continue;
//~ }
//~ if(layerIndex == 1) {
//~ layer2Name = key;
//~ }
//~ else if(layerIndex == 2) {
//~ layer3Name = key;
//~ }
//~ layerIndex++;
//~ }
//~ map.on('baselayerchange', function(e) {
//~ if(e.name == layer2Name || e.name == layer3Name) {
//~ map.setZoom(MapOption.zoomLevel);
//~ }
//~ });

marker.on('dragend', function(e){
var marker = e.target;
var position = marker.getLatLng();
Expand Down Expand Up @@ -220,14 +200,14 @@ function OSGeoInitialize(question,latLng){
}
$(this).data('prevvalue',$(this).val());
});
console.ls.log(window.location.protocol);
var geonamesApiUrl = "api.geonames.org";
if(window.location.protocol=='https:'){
// Currently api.geonames.org are unsecure (ssl for api.geonames.net)
$("#searchbox_"+name).parent().remove();
/* Checked : work on 2019-03 , see #13873 */
geonamesApiUrl = "secure.geonames.org";
}
$("#searchbox_"+name).autocomplete({
serviceUrl : "//api.geonames.org/searchJSON",
dataType: "jsonp",
serviceUrl : "//"+geonamesApiUrl+"/searchJSON",
dataType: "json",
paramName: 'name_startsWith',
deferRequestBy: 500,
params:{
Expand Down
4 changes: 0 additions & 4 deletions themes/survey/bootswatch/css/theme.css
Expand Up @@ -634,10 +634,6 @@ only screen and (max-width: 760px),
margin-right: 5px;
}

.geoloc-item .search-icon, .geoloc-item .checkbox {
padding-top: 10px;
}

.geoname_search {
margin-bottom: 10px;
}
Expand Down
4 changes: 0 additions & 4 deletions themes/survey/fruity/css/theme.css
Expand Up @@ -649,10 +649,6 @@ only screen and (max-width: 760px),
margin-right: 5px;
}

.geoloc-item .search-icon, .geoloc-item .checkbox {
padding-top: 10px;
}

.geoname_search {
margin-bottom: 10px;
}
Expand Down
4 changes: 0 additions & 4 deletions themes/survey/vanilla/css/theme.css
Expand Up @@ -622,10 +622,6 @@ only screen and (max-width: 760px),
margin-right: 5px;
}

.geoloc-item .search-icon, .geoloc-item .checkbox {
padding-top: 10px;
}

.geoname_search {
margin-bottom: 10px;
}
Expand Down

0 comments on commit 1930029

Please sign in to comment.