<commit_before>/*global Ext:false */
/*global $:false */
/*global OpenLayers:false */
/*global GeoExt:false */
/*global mygeocloud_ol:false */
/*global schema:false */
/*global screenName:false */
/*global attributeForm:false */
/*global geocloud:false */
Ext.BLANK_IMAGE_URL = "/js/ext/resources/images/default/s.gif";
var App = new Ext.App({}), cloud, layer, grid, store, map, wfsTools, viewport, drawControl, gridPanel, modifyControl, tree, viewerSettings, loadTree, reLoadTree, layerBeingEditing, saveStrategy, getMetaData;
function startWfsEdition(layerName, geomField, wfsFilter, single) {
    'use strict';
    var fieldsForStore, columnsForGrid, type, multi, handlerType, editable = true, sm, south = Ext.getCmp("attrtable");
    layerBeingEditing = layerName;
    try {
        drawControl.deactivate();
        layer.removeAllFeatures();
        map.removeLayer(layer);
    } catch (e) {
    }
    south.remove(grid);
    $.ajax({
        url: '/controllers/table/columns/' + layerName,
        async: false,
        dataType: 'json',
        type: 'GET',
        success: function (data, textStatus, http) {
            if (http.readyState === 4) {
                if (http.status === 200) {
                    var response = data;
                    // JSON
                    fieldsForStore = response.forStore;
                    columnsForGrid = response.forGrid;
                    type = response.type;
                    multi = response.multi;
                    // We add an editor to the fields
                    for (var i in columnsForGrid) {
                        columnsForGrid[i].editable = editable;
                        if (columnsForGrid[i].typeObj !== undefined) {
                            if (columnsForGrid[i].typeObj.type === "int") {
                                columnsForGrid[i].editor = new Ext.form.NumberField({
                                    decimalPrecision: 0,
                                    decimalSeparator: '¤'// Some strange char nobody is using
                                });
                            } else if (columnsForGrid[i].typeObj.type === "decimal") {
                                columnsForGrid[i].editor = new Ext.form.NumberField({
                                    decimalPrecision: columnsForGrid[i].typeObj.scale,
                                    decimalSeparator: '.'
                                });
                            } else if (columnsForGrid[i].typeObj.type === "string") {
                                columnsForGrid[i].editor = new Ext.form.TextField();
                            } else if (columnsForGrid[i].typeObj.type === "text") {
                                columnsForGrid[i].editor = new Ext.form.TextArea();
                            }
                        }
                    }
                }
            }
        }
    });
    if (type === "Point") {
        handlerType = OpenLayers.Handler.Point;
    }
    else if (type === "Polygon") {
        handlerType = OpenLayers.Handler.Polygon;
    }
    else if (type === "Path") {
        handlerType = OpenLayers.Handler.Path;
    }
    south.expand(true);
    var styleMap = new OpenLayers.StyleMap({

        default: new OpenLayers.Style({
                fillColor: "#000000",
                fillOpacity: 0.0,
                pointRadius: 5,
                strokeColor: "#00FF00",
                strokeWidth: 3,
                strokeOpacity: 0.7,
                graphicZIndex: 3
            }
        ),
        temporary: new OpenLayers.Style({
                fillColor: "#0000FF",
                fillOpacity: 0.0,
                pointRadius: 5,
                strokeColor: "#0000FF",
                strokeWidth: 2,
                strokeOpacity: 0.7,
                graphicZIndex: 3
            }
        ),
        select: new OpenLayers.Style({
                fillColor: "#000000",
                fillOpacity: 0.2,
                pointRadius: 6,
                strokeColor: "#0000FF",
                strokeWidth: 3,
                strokeOpacity: 1,
                graphicZIndex: 3
            }
        )
    });
    layer = new OpenLayers.Layer.Vector("vector", {
        strategies: [new OpenLayers.Strategy.Fixed(), saveStrategy],
        protocol: new OpenLayers.Protocol.WFS.v1_0_0({
            url: "/wfs/" + screenName + "/" + schema + "/900913?",
            version: "1.0.0",
            featureType: layerName,
            featureNS: "http://twitter/" + screenName,
            srsName: "EPSG:900913",
            geometryName: geomField, // must be dynamamic
            defaultFilter: wfsFilter
        }),
        styleMap: styleMap
    });
    map.addLayers([layer]);
    layer.events.register("loadend", layer, function () {
        var count = layer.features.length;
        window.parent.App.setAlert(App.STATUS_NOTICE, count + " features loaded");
        map.zoomToExtent(layer.getDataExtent());
        if (single) {

            map.controls[map.controls.length - 1].selectControl.select(layer.features[0]);
        }
    });
    layer.events.register("loadstart", layer, function () {
        //App.setAlert(App.STATUS_OK, "Start loading...");
    });


    drawControl = new OpenLayers.Control.DrawFeature(layer, handlerType, {
        featureAdded: onInsert,<commit_msg>Color and zoom<commit_after>/*global Ext:false */
/*global $:false */
/*global OpenLayers:false */
/*global GeoExt:false */
/*global mygeocloud_ol:false */
/*global schema:false */
/*global screenName:false */
/*global attributeForm:false */
/*global geocloud:false */
Ext.BLANK_IMAGE_URL = "/js/ext/resources/images/default/s.gif";
var App = new Ext.App({}), cloud, layer, grid, store, map, wfsTools, viewport, drawControl, gridPanel, modifyControl, tree, viewerSettings, loadTree, reLoadTree, layerBeingEditing, saveStrategy, getMetaData;
function startWfsEdition(layerName, geomField, wfsFilter, single) {
    'use strict';
    var fieldsForStore, columnsForGrid, type, multi, handlerType, editable = true, sm, south = Ext.getCmp("attrtable"), singleEditing = single;
    layerBeingEditing = layerName;
    try {
        drawControl.deactivate();
        layer.removeAllFeatures();
        map.removeLayer(layer);
    } catch (e) {
    }
    south.remove(grid);
    $.ajax({
        url: '/controllers/table/columns/' + layerName,
        async: false,
        dataType: 'json',
        type: 'GET',
        success: function (data, textStatus, http) {
            if (http.readyState === 4) {
                if (http.status === 200) {
                    var response = data;
                    // JSON
                    fieldsForStore = response.forStore;
                    columnsForGrid = response.forGrid;
                    type = response.type;
                    multi = response.multi;
                    // We add an editor to the fields
                    for (var i in columnsForGrid) {
                        columnsForGrid[i].editable = editable;
                        if (columnsForGrid[i].typeObj !== undefined) {
                            if (columnsForGrid[i].typeObj.type === "int") {
                                columnsForGrid[i].editor = new Ext.form.NumberField({
                                    decimalPrecision: 0,
                                    decimalSeparator: '¤'// Some strange char nobody is using
                                });
                            } else if (columnsForGrid[i].typeObj.type === "decimal") {
                                columnsForGrid[i].editor = new Ext.form.NumberField({
                                    decimalPrecision: columnsForGrid[i].typeObj.scale,
                                    decimalSeparator: '.'
                                });
                            } else if (columnsForGrid[i].typeObj.type === "string") {
                                columnsForGrid[i].editor = new Ext.form.TextField();
                            } else if (columnsForGrid[i].typeObj.type === "text") {
                                columnsForGrid[i].editor = new Ext.form.TextArea();
                            }
                        }
                    }
                }
            }
        }
    });
    if (type === "Point") {
        handlerType = OpenLayers.Handler.Point;
    }
    else if (type === "Polygon") {
        handlerType = OpenLayers.Handler.Polygon;
    }
    else if (type === "Path") {
        handlerType = OpenLayers.Handler.Path;
    }
    south.expand(true);
    var styleMap = new OpenLayers.StyleMap({

        default: new OpenLayers.Style({
                fillColor: "#000000",
                fillOpacity: 0.0,
                pointRadius: 5,
                strokeColor: "#0000FF",
                strokeWidth: 3,
                strokeOpacity: 0.7,
                graphicZIndex: 3
            }
        ),
        temporary: new OpenLayers.Style({
                fillColor: "#FFFFFF",
                fillOpacity: 0.7,
                pointRadius: 5,
                strokeColor: "#0000FF",
                strokeWidth: 1,
                strokeOpacity: 0.7,
                graphicZIndex: 1
            }
        ),
        select: new OpenLayers.Style({
                fillColor: "#000000",
                fillOpacity: 0.2,
                pointRadius: 6,
                strokeColor: "#0000FF",
                strokeWidth: 3,
                strokeOpacity: 1,
                graphicZIndex: 3
            }
        )
    });
    layer = new OpenLayers.Layer.Vector("vector", {
        strategies: [new OpenLayers.Strategy.Fixed(), saveStrategy],
        protocol: new OpenLayers.Protocol.WFS.v1_0_0({
            url: "/wfs/" + screenName + "/" + schema + "/900913?",
            version: "1.0.0",
            featureType: layerName,
            featureNS: "http://twitter/" + screenName,
            srsName: "EPSG:900913",
            geometryName: geomField, // must be dynamamic
            defaultFilter: wfsFilter
        }),
        styleMap: styleMap
    });
    map.addLayers([layer]);
    layer.events.register("loadend", layer, function () {
        var count = layer.features.length;
        window.parent.App.setAlert(App.STATUS_NOTICE, count + " features loaded");
        if (layer.features.length > 0) {
            map.zoomToExtent(layer.getDataExtent());
        }
        if (singleEditing) {
            map.controls[map.controls.length - 1].selectControl.select(layer.features[0]);
            singleEditing = false;
        }
    });
    layer.events.register("loadstart", layer, function () {
        //App.setAlert(App.STATUS_OK, "Start loading...");
    });


    drawControl = new OpenLayers.Control.DrawFeature(layer, handlerType, {
        featureAdded: onInsert,
{'fraction_non_alphanumeric': 0.11781635874106397, 'fraction_numerical': 0.013276390307306657, 'mean_word_length': 1.5051162790697674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4001043', 'n_tokens_mistral': 3034, 'n_tokens_neox': 2823, 'n_words': 592}