<commit_before>/*jshint undef: true, browser:true, nomen: true */
/*jslint browser:true, nomen: true */
/*global mx, define, require, console, google */
/*
    GeoLocationWidget
    ========================

    @file      : GeoLocationWidget.js
    @version   : 1.0
    @author    : <NAME>
    @date      : Sun, 11 Oct 2015 07:05:38 GMT
    @copyright : 
    @license   : Apache 2

    Documentation
    ========================
    Use Google client library to get current location. The Google client library takes WiFi access points into account to determine the location.
    This widget depends on the original GoogleMaps widget for the AMD loader. 
*/

// Required module list. Remove unnecessary modules, you can always get them back from the boilerplate.
define([
    "dojo/_base/declare",
    "mxui/widget/_WidgetBase",
    "dojo/dom-class",
    "dojo/dom-style",
    "dojo/_base/lang",
    "dojo/html",
    "dojo/_base/event",
    "//www.google.com/jsapi"
], function (declare, _WidgetBase, dojoClass, dojoStyle, dojoLang, dojoHtml, dojoEvent) {
    "use strict";

    // Declare widget's prototype.
    return declare("GeoLocationWidget.widget.GeoLocationWidget", [ _WidgetBase ], {

        // DOM elements

        // Parameters configured in the Modeler.
        buttonLabel: "",
        buttonClass: "",
        latAttr: "",
        longAttr: "",
        onChangeMF: "",
        doReverseGeocoding: true,
        reverseGeocodingResultJson: "",
        apiKey: "",

        // Internal variables. Non-primitives created in the prototype are shared between all widget instances.
        _handles: null,
        _contextObj: null,
        _result: null,
        _button: null,
        _mapContainer: null,
        _googleMap: null,
        _marker: null,

        // dojo.declare.constructor is called to construct the widget instance. Implement to initialize non-primitive properties.
        constructor: function () {
            this._handles = [];
        },
        
        // dijit._WidgetBase.postCreate is called after constructing the widget. Implement to do extra setup work.
        postCreate: function () {
            //console.log(this.id + ".postCreate");

            if (google && !google.maps) {
                var params = "sensor=true";
                if (this.apiKey !== "") {
                    params += "&key=" + this.apiKey;
                }
                google.load("maps", 3, {
                    other_params: params,
                    callback: dojoLang.hitch(this, this.setupWidget)
                });
            } else if (google && google.maps) {
                dojoLang.hitch(this, this.setupWidget);
            }
        },
        
        setupWidget: function () {
            
            // Placeholder container
            this._mapContainer = document.createElement("div");
            if (this.mapClass) {
                dojoClass.add(this._mapContainer, this.mapClass);
            } else {
                dojoStyle.set(this._mapContainer, {
                    height: "350px",
                    width: "100%"
                });
            }
            // Add to widget node
            this.domNode.appendChild(this._mapContainer);

            // Button
            this._button = document.createElement("div");
            dojoClass.add(this._button, "btn");<commit_msg>Correct the api access key property<commit_after>/*jshint undef: true, browser:true, nomen: true */
/*jslint browser:true, nomen: true */
/*global mx, define, require, console, google */
/*
    GeoLocationWidget
    ========================

    @file      : GeoLocationWidget.js
    @version   : 1.0
    @author    : <NAME>
    @date      : Sun, 11 Oct 2015 07:05:38 GMT
    @copyright : 
    @license   : Apache 2

    Documentation
    ========================
    Use Google client library to get current location. The Google client library takes WiFi access points into account to determine the location.
    This widget depends on the original GoogleMaps widget for the AMD loader. 
*/

// Required module list. Remove unnecessary modules, you can always get them back from the boilerplate.
define([
    "dojo/_base/declare",
    "mxui/widget/_WidgetBase",
    "dojo/dom-class",
    "dojo/dom-style",
    "dojo/_base/lang",
    "dojo/html",
    "dojo/_base/event",
    "//www.google.com/jsapi"
], function (declare, _WidgetBase, dojoClass, dojoStyle, dojoLang, dojoHtml, dojoEvent) {
    "use strict";

    // Declare widget's prototype.
    return declare("GeoLocationWidget.widget.GeoLocationWidget", [ _WidgetBase ], {

        // DOM elements

        // Parameters configured in the Modeler.
        buttonLabel: "",
        buttonClass: "",
        latAttr: "",
        longAttr: "",
        onChangeMF: "",
        doReverseGeocoding: true,
        reverseGeocodingResultJson: "",
        apiAccessKey: "",

        // Internal variables. Non-primitives created in the prototype are shared between all widget instances.
        _handles: null,
        _contextObj: null,
        _result: null,
        _button: null,
        _mapContainer: null,
        _googleMap: null,
        _marker: null,

        // dojo.declare.constructor is called to construct the widget instance. Implement to initialize non-primitive properties.
        constructor: function () {
            this._handles = [];
        },
        
        // dijit._WidgetBase.postCreate is called after constructing the widget. Implement to do extra setup work.
        postCreate: function () {
            //console.log(this.id + ".postCreate");

            if (google && !google.maps) {
                var params = "sensor=true";
                if (this.apiAccessKey !== "") {
                    params += "&key=" + this.apiAccessKey;
                }
                google.load("maps", 3, {
                    other_params: params,
                    callback: dojoLang.hitch(this, this.setupWidget)
                });
            } else if (google && google.maps) {
                dojoLang.hitch(this, this.setupWidget);
            }
        },
        
        setupWidget: function () {
            
            // Placeholder container
            this._mapContainer = document.createElement("div");
            if (this.mapClass) {
                dojoClass.add(this._mapContainer, this.mapClass);
            } else {
                dojoStyle.set(this._mapContainer, {
                    height: "350px",
                    width: "100%"
                });
            }
            // Add to widget node
            this.domNode.appendChild(this._mapContainer);

            // Button
            this._button = document.createElement("div");
            dojoClass.add(this._button, "btn");
{'fraction_non_alphanumeric': 0.12, 'fraction_numerical': 0.006518518518518518, 'mean_word_length': 1.8581710414902626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5929795', 'n_tokens_mistral': 1868, 'n_tokens_neox': 1752, 'n_words': 474}