view app.js @ 497:7c0653e8d9f7

Fixed some js related issues (unused vars, arrays, etc.) and code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 06 Nov 2014 10:38:17 +0100
parents d07e5086a64b
children 8b4ec61c5752
line wrap: on
line source
/**
 * Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out
 * the documentation coming with IMIS-Labordaten-Application for details.
 */
Ext.Loader.setConfig({
    enabled: true,
    paths: {
        'Ext.ux.form.DateTimeField': 'resources/datetime/UX_DateTimeField.js',
        'Ext.ux.DateTimeMenu': 'resources/datetime/UX_DateTimeMenu.js',
        'Ext.ux.DateTimePicker': 'resources/datetime/UX_DateTimePicker.js',
        'Ext.ux.form.TimePickerField': 'resources/datetime/UX_TimePickerField.js'
    }
});

Ext.application({

    // Name of the application. Do not change as this name is used in
    // references!
    name: 'Lada',

    // Setting up translations. This is done using a ext-plgin which can be
    // found on https://github.com/elmasse/Ext.i18n.Bundle
    requires: [
        'Ext.i18n.Bundle',
        'Lada.lib.Helpers',
        'Ext.layout.container.Column',
        'Lada.store.StaDatenbasen',
        'Lada.store.StaMesseinheiten',
        'Lada.store.StaMessgroessen',
        'Lada.store.StaMessmethoden',
        'Lada.store.StaMessstellen',
        'Lada.store.StaNetzbetreiber',
        'Lada.store.StaOrte',
        'Lada.store.StaPflichtmessgroessen',
        'Lada.store.StaProbenarten',
        'Lada.store.StaProbenzusaetze',
        'Lada.store.StaStaaten',
        'Lada.store.StaUmwelt',
        'Lada.store.StaVerwaltungseinheiten'
    ],
    bundle: {
        bundle: 'Lada',
        lang: 'de-DE',
        path: 'resources',
        noCache: true
    },

    // Setting this variable to true triggers loading the Viewport.js
    // file which sets ob the viewport.
    autoCreateViewport: true,

    // Start the application.
    launch: function() {
        console.log('Launching the application');
        Ext.create('Lada.store.StaDatenbasen', {
            storeId: 'staDatenbasen'
        });
        Ext.create('Lada.store.StaMesseinheiten', {
            storeId: 'staMesseinheiten'
        });
        Ext.create('Lada.store.StaMessgroessen', {
            storeId: 'staMessgroessen'
        });
        Ext.create('Lada.store.StaMessmethoden', {
            storeId: 'staMessmethoden'
        });
        Ext.create('Lada.store.StaMessstellen', {
            storeId: 'staMessstellen'
        });
        Ext.create('Lada.store.StaNetzbetreiber', {
            storeId: 'staNetzbetreiber'
        });
        Ext.create('Lada.store.StaOrte', {
            storeId: 'staOrte'
        });
        Ext.create('Lada.store.StaPflichtmessgroessen', {
            storeId: 'staPflichtmessgroessen'
        });
        Ext.create('Lada.store.StaProbenarten', {
            storeId: 'staProbenarten'
        });
        Ext.create('Lada.store.StaProbenzusaetze', {
            storeId: 'staProbenzusaetze'
        });
        Ext.create('Lada.store.StaStaaten', {
            storeId: 'staStaaten'
        });
        Ext.create('Lada.store.StaUmwelt', {
            storeId: 'staUmwelt'
        });
        Ext.create('Lada.store.StaVerwaltungseinheiten', {
            storeId: 'staVerwaltungseinheiten'
        });
    },

    // Define the controllers of the application. They will be initialized
    // first before the application "launch" function is called.
    controllers: [
        'Sql',
        'Proben',
        'Zusatzwerte',
        'Kommentare',
        'MKommentare',
        'Orte',
        'Messungen',
        'Messwert',
        'Status'
    ]
});

Ext.data.writer.Json.override({
    getRecordData: function(record) {
        if (this.writeEverything || record.writeEverything) {
            console.log('getRecordData', arguments);
            return record.getAllData();
        }
        return this.callOverridden(arguments);
    }
});

Ext.data.Model.addMembers({
    getAllData: function() {
        var data1 = this.getData();
        var data2 = this.getAssociatedData();
        var dataMerged = Ext.Object.merge(data1, data2);
        return dataMerged;
    },
    getEidi: function() {
        return '/' + this.getId();
    }
});

http://lada.wald.intevation.org