<commit_before>Ext.define ("viewer.components.rotercera.RoComment",{
    extend: "viewer.components.Edit",
    
    window: null,
    planId: null,
    config: {
        planIdAttributeName : "bestemmingsplangebiedid"
    },
    constructor: function(conf){
        conf.isPopup=true;
        viewer.components.Edit.superclass.constructor.call(this, conf);        
        var div = this.getContentDiv();        
        this.loadWindow();
    },
    createLayerSelector: function(){
        var me = this;
        //dummy layer selector
        this.layerSelector= {
            initLayers: function(){                
            },getValue: function(){
                return me.viewerController.getAppLayerById(me.layers[0]);
            },combobox: {
                select: function(){}
            },getSelectedAppLayer: function(){
                return me.viewerController.getAppLayerById(me.layers[0]);
            }
        };
    },
    startComment: function(planId){
        this.planId=planId;
        if (this.vectorLayer==null){
            this.createVectorLayer();
            this.viewerController.mapComponent.getMap().addLayer(this.vectorLayer);
        }
        if (this.window==null){
            this.createInputWindow();
        }
        this.layerChanged(this.layerSelector.getValue());
        this.window.show();
    },
            
    initAttributeInputs: function(){
        this.callParent(arguments);
        this.createNew();
    },
    createNew : function(){
        this.vectorLayer.removeAllFeatures();
        this.viewerController.mapComponent.getMap().removeMarker("edit");
        this.mode = "new";
        if(this.newGeomType != null && this.geometryEditable){
            this.vectorLayer.drawFeature(this.newGeomType);
        }
    },
            
    createInputWindow: function(){
        var me = this;
        this.inputContainer = Ext.create("Ext.form.Panel",{             
            id: this.name + 'InputPanel',
            border: 0,
            autoScroll: true,
            width: '100%',
            height: 200
        });
        this.window = Ext.create("Ext.window.Window",{
            title: "Ro-Commentaar",
            height: 600,
            width: 400,            
            closeAction: 'hide',
            items: [
                this.inputContainer,
                {
                    id: this.name + 'savePanel',
                    xtype: "container",
                    width: '100%',
                    height: MobileManager.isMobile() ? 45 : 30,
                    layout: {
                        type: 'hbox',
                        pack: 'end'
                    },
                    defaults: {
                        xtype: 'button',
                        componentCls: 'mobileLarge'
                    },
                    items:[
                    {
                        id : this.name + "cancelButton",
                        tooltip: "Annuleren",
                        text: "Annuleren",
                        listeners: {
                            click:{
                                scope: me,
                                fn: me.cancel
                            }
                        }
                    },
                    {
                        id : this.name + "saveButton",
                        tooltip: "Opslaan",
                        text: "Opslaan",
                        listeners: {
                            click:{
                                scope: me,
                                fn: me.save
                            }
                        }
                    }
                    ]
                }
            ] 
        });
    },
    changeFeatureBeforeSave: function(feature){
        if (this.planId ==null || this.planId == undefined){
            throw "Geen plan geselecteerd";
        }
        /*if (this.user==null){
            throw "Er is niet ingelogd. Er kan geen commentaar worden aangemaakt";
        }*/
        feature[this.planIdAttributeName]=this.planId;
        //add user
        feature.eigenaar=user;
        return feature;
    }
});<commit_msg>implemented cancel action for comment module<commit_after>Ext.define ("viewer.components.rotercera.RoComment",{
    extend: "viewer.components.Edit",
    
    window: null,
    planId: null,
    config: {
        planIdAttributeName : "bestemmingsplangebiedid"
    },
    constructor: function(conf){
        conf.isPopup=true;
        viewer.components.Edit.superclass.constructor.call(this, conf);        
        var div = this.getContentDiv();        
        this.loadWindow();
    },
    createLayerSelector: function(){
        var me = this;
        //dummy layer selector
        this.layerSelector= {
            initLayers: function(){                
            },getValue: function(){
                return me.viewerController.getAppLayerById(me.layers[0]);
            },combobox: {
                select: function(){}
            },getSelectedAppLayer: function(){
                return me.viewerController.getAppLayerById(me.layers[0]);
            }
        };
    },
    startComment: function(planId){
        this.planId=planId;
        if (this.vectorLayer==null){
            this.createVectorLayer();
            this.viewerController.mapComponent.getMap().addLayer(this.vectorLayer);
        }
        if (this.window==null){
            this.createInputWindow();
        }
        this.layerChanged(this.layerSelector.getValue());
        this.window.show();
    },
            
    initAttributeInputs: function(){
        this.callParent(arguments);
        this.createNew();
    },
    createNew : function(){
        this.vectorLayer.removeAllFeatures();
        this.viewerController.mapComponent.getMap().removeMarker("edit");
        this.mode = "new";
        if(this.newGeomType != null && this.geometryEditable){
            this.vectorLayer.drawFeature(this.newGeomType);
        }
    },
    
    createInputWindow: function(){
        var me = this;
        this.inputContainer = Ext.create("Ext.form.Panel",{             
            id: this.name + 'InputPanel',
            border: 0,
            autoScroll: true,
            width: '100%',
            height: 300
        });
        this.window = Ext.create("Ext.window.Window",{
            title: "Ro-Commentaar",
            height: 600,
            width: 400,            
            closeAction: 'hide',
            items: [
                this.inputContainer,
                {
                    id: this.name + 'savePanel',
                    xtype: "container",
                    width: '100%',
                    height: MobileManager.isMobile() ? 45 : 30,
                    layout: {
                        type: 'hbox',
                        pack: 'end'
                    },
                    defaults: {
                        xtype: 'button',
                        componentCls: 'mobileLarge'
                    },
                    items:[
                    {
                        id : this.name + "cancelButton",
                        tooltip: "Annuleren",
                        text: "Annuleren",
                        listeners: {
                            click:{
                                scope: me,
                                fn: me.cancel
                            }
                        }
                    },
                    {
                        id : this.name + "saveButton",
                        tooltip: "Opslaan",
                        text: "Opslaan",
                        listeners: {
                            click:{
                                scope: me,
                                fn: me.save
                            }
                        }
                    }
                    ]
                }
            ] 
        });
    },
            
    cancel: function (){
        this.callParent(arguments);
        this.window.hide();
        this.vectorLayer.stopDrawing();
    },
    changeFeatureBeforeSave: function(feature){
        if (this.planId ==null || this.planId == undefined){
            throw "Geen plan geselecteerd";
        }
        /*if (this.user==null){
            throw "Er is niet ingelogd. Er kan geen commentaar worden aangemaakt";
        }*/
        feature[this.planIdAttributeName]=this.planId;
        //add user
        feature.eigenaar=user;
        return feature;
    }
});
{'fraction_non_alphanumeric': 0.10684867027535891, 'fraction_numerical': 0.0051776888679689334, 'mean_word_length': 1.1126025354213274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '106801', 'n_tokens_mistral': 2166, 'n_tokens_neox': 2047, 'n_words': 362}