<commit_before>/**
 * Shopware 4
 * Copyright © shopware AG
 *
 * According to our dual licensing model, this program can be used either
 * under the terms of the GNU Affero General Public License, version 3,
 * or under a proprietary license.
 *
 * The texts of the GNU Affero General Public License with an additional
 * permission and of our proprietary license can be found at and
 * in the LICENSE file you have received along with this program.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Shopware" is a registered trademark of shopware AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
/**
 * Shopware SwagConnect Plugin
 *
 * @category Shopware
 * @package Shopware\Plugins\SwagConnect
 * @copyright Copyright (c) shopware AG (http://www.shopware.de)
 */
//{namespace name=backend/connect/view/main}
//{block name="backend/connect/view/config/export/form"}
Ext.define('Shopware.apps.Connect.view.config.export.Form', {
    extend: 'Ext.form.Panel',
    alias: 'widget.connect-config-export-form',

    border: false,
    layout: 'anchor',
    autoScroll: true,
    region: 'center',
    bodyPadding: 10,

    /**
     * Contains the field set defaults.
     */
    defaults: {
        labelWidth: 200,
        anchor: '100%'
    },

    snippets: {
        save: '{s name=config/save}Save{/s}',
        cancel: '{s name=config/cancel}Cancel{/s}',
        productDescriptionLegend: '{s name=config/export/product_description_legend}Product description{/s}',
        productDescriptionFieldLabel: '{s name=config/export/product_description_field_label}Product description field{/s}',
        productDescriptionFieldHelp: Ext.String.format('{s name=config/export/product_description_field_help}Wählen Sie aus, welches Textfeld als Produkt-Beschreibung zu [0] exportiert werden soll und anderen Händlern zur Verfügung gestellt wird.{/s}',marketplaceName),
        autoProductSync: '{s name=config/export/auto_product_sync_label}Geänderte Produkte automatisch synchronisieren{/s}',
        autoPlayedChanges: Ext.String.format('{s name=config/export/changes_auto_played_label}Änderungen automatisch mit [0] synchronsieren{/s}', marketplaceName),
        emptyText: '{s name=config/export/empty_text_combo}Please choose{/s}',
        priceConfiguration: '{s name=config/export/priceConfiguration}Preiskonfiguration{/s}',
        priceConfigurationDescription: Ext.String.format('{s name=config/export/label/export_price_description}Hier bestimmen Sie die Preise, die Sie zu [0] exportieren möchten. Alle Preise werden netto exportiert und können individuell mit Auf-und Abschlägen bearbeitet werden.

{/s}', marketplaceName),
        priceMode: '{s name=config/config/price/priceMode}Endkunden-VK{/s}',
        priceModeDescription: Ext.String.format('{s name=config/export/label/price_mode_description}Preiskalkulation auf [0]:

Exportieren Sie zum Beispiel nur einen Endkunden VK, können Sie über einen Abschlag einen Händlereinkaufspreis bestimmen.

Exportieren Sie einen Listenverkaufspreis, können Sie mit auf oder Abschlägen einen Händlereinkaufspreis definieren und optional eine unverbindliche Preisempfehlung für den Verkaufspreis definieren.

Exportieren Sie einen Endkunden Verkaufspreis und einen Listenverkaufspreis, können Sie optional Preise auf [0] bearbeiten.

{/s}', marketplaceName),
        purchasePriceMode: '{s name=config/price/purchasePriceMode}Listenverkaufspreis-VK{/s}',
        exportLanguagesTitle: '{s name=config/export/exportLanguagesTitle}Sprachen{/s}',
        exportLanguagesLabel: '{s name=config/export/exportLanguagesLabel}Sprachauswahl{/s}',
        exportLanguagesHelpText: Ext.String.format('{s name=config/export/exportLanguagesHelpText}Hier legen Sie fest, welche Sprachen für Ihren Export zu [0] verwendet werden sollen. Wenn Sie die Produkte inkl. Übersetzung exportieren möchten, können Sie mehrere Sprachen auswählen. Wenn Sie dieses Feld leer lassen, wird automatisch die standard- Sprache Ihres Shops verwendet.{/s}', marketplaceName),
        price: '{s name=export/price/price}Price{/s}',
        pseudoPrice: '{s name=export/price/pseudo_price}Pseudo price{/s}',
        purchasePrice: '{s name=export/price/purchase_price}Purchase price{/s}',
        yes: '{s name=connect/yes}Ja{/s}',
        no: '{s name=connect/no}Nein{/s}',
        edit: '{s name=connect/edit}Edit{/s}'
    },

    initComponent: function () {
        var me = this;

        me.items = me.createElements();
        me.dockedItems = [
            {
                xtype: 'toolbar',
                dock: 'bottom',
                ui: 'shopware-ui',
                cls: 'shopware-toolbar',
                items: me.getFormButtons()
            }
        ];

        me.exportConfigStore = Ext.create('Shopware.apps.Connect.store.config.Export').load({
            callback: function() {
                me.populateForm();
            }
        });

        me.loadPriceStores();

        me.callParent(arguments);
    },

    registerEvents: function() {
        this.addEvents('rejectPriceConfigChanges', 'collectPriceParams');
    },

    /**
     * Returns form buttons, save and cancel
     * @returns Array
     */
    getFormButtons: function () {
        var me = this,
            buttons = ['->'];

        var saveButton = Ext.create('Ext.button.Button', {
            text: me.snippets.save,
            action: 'save-export-config',
            handler: function (btn) {
                var form = btn.up('form');
                var model = form.getRecord();

                form.getForm().updateRecord(model);
                model.data.exportPriceMode = [];
                if (purchasePriceInDetail == false) {
                    me.fireEvent('collectPriceParams', me.purchasePriceTabPanel, 'purchasePrice', model.data);
                } else if (purchasePriceInDetail == true && me.purchasePriceTabPanel.getValue()) {
                    model.data.exportPriceMode.push('purchasePrice');
                }

                me.fireEvent('collectPriceParams', me.priceTabPanel, 'price', model.data);
                me.fireEvent('saveExportSettings', model.data, btn);
            },
            cls: 'primary'
        });

        var cancelButton = Ext.create('Ext.button.Button', {
            text: me.snippets.cancel,
            handler: function (btn) {
                btn.up('window').close();
            }
        });

        buttons.push(cancelButton);
        buttons.push(saveButton);

        return buttons;
    },

    createPriceContainer: function (item, title) {
        return Ext.create('Ext.form.FieldSet', {
            columnWidth: 1,
            title: title,
            layout: 'anchor',
            width: '90%',
            items: [
                item
            ]
        });
    },

    /**
     * Creates the elements for the description field set.
     * @return array Contains all Ext.form.Fields for the description field set
     */
    createPriceTab: function () {
        var me = this, tabs = [];

        me.customerGroupStore.each(function (customerGroup) {
            if (customerGroup.get('mode') === false) {
                var tab = me.createPriceGrid(customerGroup);
                tabs.push(tab);
            }
        });

        return Ext.create('Ext.tab.Panel', {
            activeTab: 0,
            layout: 'card',
            items: tabs
        });
    },

    /**
     * Creates a grid
     *
     * @param customerGroup
     * @return Ext.grid.Panel
     */
    createPriceGrid: function (customerGroup) {
        var me = this;

        return Ext.create('Ext.grid.Panel', {
            height: 100,
            sortableColumns: false,
            defaults: {
                align: 'right',
                flex: 2
            },
            plugins: [{
                ptype: 'cellediting',
                clicksToEdit: 1
            }],
            title: customerGroup.get('name'),
            store: Ext.create('Shopware.apps.Connect.store.config.PriceGroup'),
            customerGroup: customerGroup,
            columns: me.createGridColumns()
        });
    },

    createGridColumns: function() {
        var me = this;
        var columns = [
            {
                header: '',
                flex: 1
            }, {
                header: me.snippets.price,
                dataIndex: 'price',
                columnType: 'price',
                xtype: 'checkboxcolumn',
                listeners: {
                    beforecheckchange: function(column, view, cell, recordIndex, cellIndex){
                        me.fireEvent('rejectPriceConfigChanges', column, view, cell, recordIndex, cellIndex);
                    }
                }
            }, {
                header: me.snippets.pseudoPrice,
                dataIndex: 'pseudoPrice',
                columnType: 'pseudoPrice',
                xtype: 'checkboxcolumn',
                listeners: {
                    beforecheckchange: function(column, view, cell, recordIndex, cellIndex){
                        me.fireEvent('rejectPriceConfigChanges', column, view, cell, recordIndex, cellIndex);
                    }
                }
            }
        ];

        if (purchasePriceInDetail == false) {
            var basePrice = {
                header: me.snippets.purchasePrice,
                dataIndex: 'basePrice',
                columnType: 'basePrice',
                xtype: 'checkboxcolumn',
                listeners: {
                    beforecheckchange: function(column, view, cell, recordIndex, cellIndex){
                        me.fireEvent('rejectPriceConfigChanges', column, view, cell, recordIndex, cellIndex);
                    }
                }
            };

            columns.push(basePrice);
        }

        return columns;
    },

    loadPriceStores: function() {
        var me = this;

        if (purchasePriceInDetail == false) {
            me.purchasePriceTabPanel.items.each(function(tab){
                tab.getStore().load({
                    params: {
                        'customerGroup': tab.customerGroup.get('key'),
                        'priceExportMode': 'purchasePrice'
                    }
                });
            });
        }

        me.priceTabPanel.items.each(function(tab){
            tab.getStore().load({
                params: {
                    'customerGroup': tab.customerGroup.get('key'),
                    'priceExportMode': 'price'
                }
            });
        });
    },

    /**
     * Creates the field set items
     * @return Array
     */
    createElements: function () {
        var me = this;
        var container = me.createProductContainer();

        if (purchasePriceInDetail == false) {
            me.purchasePriceTabPanel = me.createPriceTab();
        } else {
            me.purchasePriceTabPanel = Ext.create('Ext.form.field.Checkbox', {
                boxLabel: me.snippets.purchasePrice,
                name: 'exportPriceMode',
                inputValue: 'purchasePrice'
            });
        }

        me.priceTabPanel = me.createPriceTab();

        me.languagesExportFieldset = Ext.create('Ext.form.FieldSet', {
            title: me.snippets.exportLanguagesTitle,
            items: [
                {
                    xtype: 'label',
                    html: me.snippets.exportLanguagesHelpText
                },
                me.createLanguagesCombo()
            ]
        });

        Ext.getStore('export.List').load();

        return [
            me.createPriceContainer(me.purchasePriceTabPanel, me.snippets.purchasePriceMode),
            me.createPriceContainer(me.priceTabPanel, me.snippets.priceMode),
            container,
            me.languagesExportFieldset
        ];
    },

    createLanguagesCombo: function() {
        var me = this;

        me.shopStore = Ext.create('Shopware.apps.Base.store.ShopLanguage').load({
            filters: [{
                property: 'default',
                value: false
            }]
        });

        return Ext.create('Ext.form.field.ComboBox', {
            multiSelect: true,
            displayField: 'name',
            valueField: 'id',
            name: 'exportLanguages',
            allowBlank: true,
            fieldLabel: me.snippets.exportLanguagesLabel,
            width: 435,
            store: me.shopStore,
            queryMode: 'local'
        });
    },

    /**
     * Returns a new progress bar for a detailed view of the exporting progress status
     *
     * @param name
     * @param text
     * @returns [object]
     */
    createProgressBar: function(name, text, value) {
        var me = this;

        me.progressBar = Ext.create('Ext.ProgressBar', {
            animate: true,
            name: 'progress-name',
            text: '{s name=config/message/done}Done{/s}',
            margin: '0 0 15',
            border: 1,
            style: 'border-width: 1px !important;',
            cls: 'left-align',
            value: 25
        });
        me.fireEvent('calculateFinishTime', me.progressBar);

        return me.progressBar;
    },

    /**
     * Populate export config form
     */
    populateForm: function () {
        var me = this,
            record = me.getRecord(),
            exportPriceMode = record.get('exportPriceMode');

        if (purchasePriceInDetail == true
            && typeof(exportPriceMode) !== 'undefined'
            && exportPriceMode.length > 0) {

            me.purchasePriceTabPanel.setDisabled(true);
        }

        me.loadRecord(record);
    },

    getRecord: function () {
        var me = this,
            record = me.exportConfigStore.getAt(0);

        if (!record) {
            record = Ext.create('Shopware.apps.Connect.model.config.Export');
        }

        return record;
    },

    createProductContainer: function () {
        var me = this;

        return Ext.create('Ext.form.FieldSet', {
            columnWidth: 1,
            title: me.snippets.productDescriptionLegend,
            defaultType: 'textfield',
            layout: 'anchor',
            items: [
                {
                    xtype: 'combobox',
                    fieldLabel: me.snippets.productDescriptionFieldLabel,
                    emptyText: me.snippets.emptyText,
                    helpText: me.snippets.productDescriptionFieldHelp,
                    name: 'alternateDescriptionField',
                    store: new Ext.data.SimpleStore({
                        fields: [ 'value', 'text' ],
                        data: [
                            ['attribute.connectProductDescription', 'attribute.connectProductDescription'],
                            ['a.description', 'Artikel-Kurzbeschreibung'],
                            ['a.descriptionLong', 'Artikel-Langbeschreibung']
                        ]
                    }),
                    queryMode: 'local',
                    displayField: 'text',
                    valueField: 'value',
                    editable: false,
                    labelWidth: me.defaults.labelWidth
                }, {
                    xtype: 'fieldcontainer',
                    fieldLabel: me.snippets.autoProductSync,
                    defaultType: 'combo',
                    labelWidth: me.defaults.labelWidth,
                    items: [
                        {
                            xtype:'combo',
                            name:'autoUpdateProducts',
                            queryMode:'local',
                            store: Ext.create('Ext.data.Store', {
                                fields: ['value', 'display'],
                                data: [
                                    {
                                        "display": me.snippets.yes,
                                        "value": 1
                                    },
                                    {
                                        "display": "Cronjob",
                                        "value": 2
                                    },
                                    {
                                        "display": me.snippets.no,
                                        "value": 0
                                    }
                                ]
                            }),
                            displayField:'display',
                            valueField: 'value'
                        }
                    ]
                }
            ]
        });
    }
});
//{/block}

<commit_msg>CON-3395 Fixed save export settings<commit_after>/**
 * Shopware 4
 * Copyright © shopware AG
 *
 * According to our dual licensing model, this program can be used either
 * under the terms of the GNU Affero General Public License, version 3,
 * or under a proprietary license.
 *
 * The texts of the GNU Affero General Public License with an additional
 * permission and of our proprietary license can be found at and
 * in the LICENSE file you have received along with this program.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Shopware" is a registered trademark of shopware AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
/**
 * Shopware SwagConnect Plugin
 *
 * @category Shopware
 * @package Shopware\Plugins\SwagConnect
 * @copyright Copyright (c) shopware AG (http://www.shopware.de)
 */
//{namespace name=backend/connect/view/main}
//{block name="backend/connect/view/config/export/form"}
Ext.define('Shopware.apps.Connect.view.config.export.Form', {
    extend: 'Ext.form.Panel',
    alias: 'widget.connect-config-export-form',

    border: false,
    layout: 'anchor',
    autoScroll: true,
    region: 'center',
    bodyPadding: 10,

    /**
     * Contains the field set defaults.
     */
    defaults: {
        labelWidth: 200,
        anchor: '100%'
    },

    isExported: false,

    snippets: {
        save: '{s name=config/save}Save{/s}',
        cancel: '{s name=config/cancel}Cancel{/s}',
        productDescriptionLegend: '{s name=config/export/product_description_legend}Product description{/s}',
        productDescriptionFieldLabel: '{s name=config/export/product_description_field_label}Product description field{/s}',
        productDescriptionFieldHelp: Ext.String.format('{s name=config/export/product_description_field_help}Wählen Sie aus, welches Textfeld als Produkt-Beschreibung zu [0] exportiert werden soll und anderen Händlern zur Verfügung gestellt wird.{/s}',marketplaceName),
        autoProductSync: '{s name=config/export/auto_product_sync_label}Geänderte Produkte automatisch synchronisieren{/s}',
        autoPlayedChanges: Ext.String.format('{s name=config/export/changes_auto_played_label}Änderungen automatisch mit [0] synchronsieren{/s}', marketplaceName),
        emptyText: '{s name=config/export/empty_text_combo}Please choose{/s}',
        priceConfiguration: '{s name=config/export/priceConfiguration}Preiskonfiguration{/s}',
        priceConfigurationDescription: Ext.String.format('{s name=config/export/label/export_price_description}Hier bestimmen Sie die Preise, die Sie zu [0] exportieren möchten. Alle Preise werden netto exportiert und können individuell mit Auf-und Abschlägen bearbeitet werden.

{/s}', marketplaceName),
        priceMode: '{s name=config/config/price/priceMode}Endkunden-VK{/s}',
        priceModeDescription: Ext.String.format('{s name=config/export/label/price_mode_description}Preiskalkulation auf [0]:

Exportieren Sie zum Beispiel nur einen Endkunden VK, können Sie über einen Abschlag einen Händlereinkaufspreis bestimmen.

Exportieren Sie einen Listenverkaufspreis, können Sie mit auf oder Abschlägen einen Händlereinkaufspreis definieren und optional eine unverbindliche Preisempfehlung für den Verkaufspreis definieren.

Exportieren Sie einen Endkunden Verkaufspreis und einen Listenverkaufspreis, können Sie optional Preise auf [0] bearbeiten.

{/s}', marketplaceName),
        purchasePriceMode: '{s name=config/price/purchasePriceMode}Listenverkaufspreis-VK{/s}',
        exportLanguagesTitle: '{s name=config/export/exportLanguagesTitle}Sprachen{/s}',
        exportLanguagesLabel: '{s name=config/export/exportLanguagesLabel}Sprachauswahl{/s}',
        exportLanguagesHelpText: Ext.String.format('{s name=config/export/exportLanguagesHelpText}Hier legen Sie fest, welche Sprachen für Ihren Export zu [0] verwendet werden sollen. Wenn Sie die Produkte inkl. Übersetzung exportieren möchten, können Sie mehrere Sprachen auswählen. Wenn Sie dieses Feld leer lassen, wird automatisch die standard- Sprache Ihres Shops verwendet.{/s}', marketplaceName),
        price: '{s name=export/price/price}Price{/s}',
        pseudoPrice: '{s name=export/price/pseudo_price}Pseudo price{/s}',
        purchasePrice: '{s name=export/price/purchase_price}Purchase price{/s}',
        yes: '{s name=connect/yes}Ja{/s}',
        no: '{s name=connect/no}Nein{/s}',
        edit: '{s name=connect/edit}Edit{/s}'
    },

    initComponent: function () {
        var me = this;

        me.items = me.createElements();
        me.dockedItems = [
            {
                xtype: 'toolbar',
                dock: 'bottom',
                ui: 'shopware-ui',
                cls: 'shopware-toolbar',
                items: me.getFormButtons()
            }
        ];

        me.exportConfigStore = Ext.create('Shopware.apps.Connect.store.config.Export').load({
            callback: function() {
                me.populateForm();
            }
        });

        me.loadPriceStores();

        me.callParent(arguments);
    },

    registerEvents: function() {
        this.addEvents('rejectPriceConfigChanges', 'collectPriceParams');
    },

    /**
     * Returns form buttons, save and cancel
     * @returns Array
     */
    getFormButtons: function () {
        var me = this,
            buttons = ['->'];

        var saveButton = Ext.create('Ext.button.Button', {
            text: me.snippets.save,
            action: 'save-export-config',
            handler: function (btn) {
                var form = btn.up('form');
                var model = form.getRecord();

                form.getForm().updateRecord(model);

                if (me.isExported == false) {
                    model.data.exportPriceMode = [];
                    if (purchasePriceInDetail == false) {
                        me.fireEvent('collectPriceParams', me.purchasePriceTabPanel, 'purchasePrice', model.data);
                    } else if (purchasePriceInDetail == true && me.purchasePriceTabPanel.getValue()) {
                        model.data.exportPriceMode.push('purchasePrice');
                    }

                    me.fireEvent('collectPriceParams', me.priceTabPanel, 'price', model.data);
                }

                me.fireEvent('saveExportSettings', model.data, btn);
            },
            cls: 'primary'
        });

        var cancelButton = Ext.create('Ext.button.Button', {
            text: me.snippets.cancel,
            handler: function (btn) {
                btn.up('window').close();
            }
        });

        buttons.push(cancelButton);
        buttons.push(saveButton);

        return buttons;
    },

    createPriceContainer: function (item, title) {
        return Ext.create('Ext.form.FieldSet', {
            columnWidth: 1,
            title: title,
            layout: 'anchor',
            width: '90%',
            items: [
                item
            ]
        });
    },

    /**
     * Creates the elements for the description field set.
     * @return array Contains all Ext.form.Fields for the description field set
     */
    createPriceTab: function () {
        var me = this, tabs = [];

        me.customerGroupStore.each(function (customerGroup) {
            if (customerGroup.get('mode') === false) {
                var tab = me.createPriceGrid(customerGroup);
                tabs.push(tab);
            }
        });

        return Ext.create('Ext.tab.Panel', {
            activeTab: 0,
            layout: 'card',
            items: tabs
        });
    },

    /**
     * Creates a grid
     *
     * @param customerGroup
     * @return Ext.grid.Panel
     */
    createPriceGrid: function (customerGroup) {
        var me = this;

        return Ext.create('Ext.grid.Panel', {
            height: 100,
            sortableColumns: false,
            defaults: {
                align: 'right',
                flex: 2
            },
            plugins: [{
                ptype: 'cellediting',
                clicksToEdit: 1
            }],
            title: customerGroup.get('name'),
            store: Ext.create('Shopware.apps.Connect.store.config.PriceGroup'),
            customerGroup: customerGroup,
            columns: me.createGridColumns()
        });
    },

    createGridColumns: function() {
        var me = this;
        var columns = [
            {
                header: '',
                flex: 1
            }, {
                header: me.snippets.price,
                dataIndex: 'price',
                columnType: 'price',
                xtype: 'checkboxcolumn',
                listeners: {
                    beforecheckchange: function(column, view, cell, recordIndex, cellIndex){
                        me.fireEvent('rejectPriceConfigChanges', column, view, cell, recordIndex, cellIndex);
                    }
                }
            }, {
                header: me.snippets.pseudoPrice,
                dataIndex: 'pseudoPrice',
                columnType: 'pseudoPrice',
                xtype: 'checkboxcolumn',
                listeners: {
                    beforecheckchange: function(column, view, cell, recordIndex, cellIndex){
                        me.fireEvent('rejectPriceConfigChanges', column, view, cell, recordIndex, cellIndex);
                    }
                }
            }
        ];

        if (purchasePriceInDetail == false) {
            var basePrice = {
                header: me.snippets.purchasePrice,
                dataIndex: 'basePrice',
                columnType: 'basePrice',
                xtype: 'checkboxcolumn',
                listeners: {
                    beforecheckchange: function(column, view, cell, recordIndex, cellIndex){
                        me.fireEvent('rejectPriceConfigChanges', column, view, cell, recordIndex, cellIndex);
                    }
                }
            };

            columns.push(basePrice);
        }

        return columns;
    },

    loadPriceStores: function() {
        var me = this;

        if (purchasePriceInDetail == false) {
            me.purchasePriceTabPanel.items.each(function(tab){
                tab.getStore().load({
                    params: {
                        'customerGroup': tab.customerGroup.get('key'),
                        'priceExportMode': 'purchasePrice'
                    }
                });
            });
        }

        me.priceTabPanel.items.each(function(tab){
            tab.getStore().load({
                params: {
                    'customerGroup': tab.customerGroup.get('key'),
                    'priceExportMode': 'price'
                }
            });
        });
    },

    /**
     * Creates the field set items
     * @return Array
     */
    createElements: function () {
        var me = this;
        var container = me.createProductContainer();

        if (purchasePriceInDetail == false) {
            me.purchasePriceTabPanel = me.createPriceTab();
        } else {
            me.purchasePriceTabPanel = Ext.create('Ext.form.field.Checkbox', {
                boxLabel: me.snippets.purchasePrice,
                name: 'exportPriceMode',
                inputValue: 'purchasePrice'
            });
        }

        me.priceTabPanel = me.createPriceTab();

        me.languagesExportFieldset = Ext.create('Ext.form.FieldSet', {
            title: me.snippets.exportLanguagesTitle,
            items: [
                {
                    xtype: 'label',
                    html: me.snippets.exportLanguagesHelpText
                },
                me.createLanguagesCombo()
            ]
        });

        Ext.getStore('export.List').load();

        return [
            me.createPriceContainer(me.purchasePriceTabPanel, me.snippets.purchasePriceMode),
            me.createPriceContainer(me.priceTabPanel, me.snippets.priceMode),
            container,
            me.languagesExportFieldset
        ];
    },

    createLanguagesCombo: function() {
        var me = this;

        me.shopStore = Ext.create('Shopware.apps.Base.store.ShopLanguage').load({
            filters: [{
                property: 'default',
                value: false
            }]
        });

        return Ext.create('Ext.form.field.ComboBox', {
            multiSelect: true,
            displayField: 'name',
            valueField: 'id',
            name: 'exportLanguages',
            allowBlank: true,
            fieldLabel: me.snippets.exportLanguagesLabel,
            width: 435,
            store: me.shopStore,
            queryMode: 'local'
        });
    },

    /**
     * Returns a new progress bar for a detailed view of the exporting progress status
     *
     * @param name
     * @param text
     * @returns [object]
     */
    createProgressBar: function(name, text, value) {
        var me = this;

        me.progressBar = Ext.create('Ext.ProgressBar', {
            animate: true,
            name: 'progress-name',
            text: '{s name=config/message/done}Done{/s}',
            margin: '0 0 15',
            border: 1,
            style: 'border-width: 1px !important;',
            cls: 'left-align',
            value: 25
        });
        me.fireEvent('calculateFinishTime', me.progressBar);

        return me.progressBar;
    },

    /**
     * Populate export config form
     */
    populateForm: function () {
        var me = this,
            record = me.getRecord(),
            exportPriceMode = record.get('exportPriceMode');

        if (purchasePriceInDetail == true
            && typeof(exportPriceMode) !== 'undefined'
            && exportPriceMode.length > 0) {

            me.isExported = true;
            me.purchasePriceTabPanel.setDisabled(true);
        }

        me.loadRecord(record);
    },

    getRecord: function () {
        var me = this,
            record = me.exportConfigStore.getAt(0);

        if (!record) {
            record = Ext.create('Shopware.apps.Connect.model.config.Export');
        }

        return record;
    },

    createProductContainer: function () {
        var me = this;

        return Ext.create('Ext.form.FieldSet', {
            columnWidth: 1,
            title: me.snippets.productDescriptionLegend,
            defaultType: 'textfield',
            layout: 'anchor',
            items: [
                {
                    xtype: 'combobox',
                    fieldLabel: me.snippets.productDescriptionFieldLabel,
                    emptyText: me.snippets.emptyText,
                    helpText: me.snippets.productDescriptionFieldHelp,
                    name: 'alternateDescriptionField',
                    store: new Ext.data.SimpleStore({
                        fields: [ 'value', 'text' ],
                        data: [
                            ['attribute.connectProductDescription', 'attribute.connectProductDescription'],
                            ['a.description', 'Artikel-Kurzbeschreibung'],
                            ['a.descriptionLong', 'Artikel-Langbeschreibung']
                        ]
                    }),
                    queryMode: 'local',
                    displayField: 'text',
                    valueField: 'value',
                    editable: false,
                    labelWidth: me.defaults.labelWidth
                }, {
                    xtype: 'fieldcontainer',
                    fieldLabel: me.snippets.autoProductSync,
                    defaultType: 'combo',
                    labelWidth: me.defaults.labelWidth,
                    items: [
                        {
                            xtype:'combo',
                            name:'autoUpdateProducts',
                            queryMode:'local',
                            store: Ext.create('Ext.data.Store', {
                                fields: ['value', 'display'],
                                data: [
                                    {
                                        "display": me.snippets.yes,
                                        "value": 1
                                    },
                                    {
                                        "display": "Cronjob",
                                        "value": 2
                                    },
                                    {
                                        "display": me.snippets.no,
                                        "value": 0
                                    }
                                ]
                            }),
                            displayField:'display',
                            valueField: 'value'
                        }
                    ]
                }
            ]
        });
    }
});
//{/block}

<|endoftext|>


<commit_before>//debug page chrome-extension://eomljbidagegcimpgnpmmejnjbcfpdgo/popup/popup.html

(function () {
    'use strict';

    angular.module('ReFigure', ['ngRoute']);

})();
<commit_msg>+ whitelist chrome extension URL usage<commit_after>//debug page chrome-extension://eomljbidagegcimpgnpmmejnjbcfpdgo/popup/popup.html

(function () {
    'use strict';

    angular.module('ReFigure', ['ngRoute'])
        .config( [
            '$compileProvider',
            function ($compileProvider) {
                $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
            }
        ]);

})();
<|endoftext|>


<commit_before>import React from 'react';
import { injectIntl, defineMessages } from 'react-intl';
import { AgGridReact } from 'ag-grid-react';
import 'ag-grid-community/dist/styles/ag-grid.css';
import 'ag-grid-community/dist/styles/ag-theme-material.css';
import styled from 'styled-components';
import MediaCell from '../media/MediaCell';
import MediaUtil from '../media/MediaUtil';
import { units } from '../../styles/js/shared';
import { getStatus } from '../../helpers';
import { mediaStatuses } from '../../customHelpers';

const StyledGridContainer = styled.div`
  width: 100%;
  height: calc(100vh - ${units(30)});
  .ag-cell-value {
    line-height: ${units(12)} !important;
  }
  .ag-header-cell-text {
    text-transform: uppercase;
  }
`;

const messages = defineMessages({
  item: {
    id: 'list.Item',
    defaultMessage: 'Item',
  },
  demand: {
    id: 'list.Demand',
    defaultMessage: 'Requests',
  },
  linked_items_count: {
    id: 'list.LinkedItems',
    defaultMessage: 'Related',
  },
  type: {
    id: 'list.Type',
    defaultMessage: 'Type',
  },
  status: {
    id: 'list.Status',
    defaultMessage: 'Status',
  },
  first_seen: {
    id: 'list.FirstSeen',
    defaultMessage: 'First seen',
  },
  last_seen: {
    id: 'list.LastSeen',
    defaultMessage: 'Last seen',
  },
});

class List extends React.Component {
  constructor(props) {
    super(props);
    const fmtMsg = props.intl.formatMessage;
    this.state = {
      columnDefs: [
        {
          headerName: fmtMsg(messages.item),
          field: 'title',
          checkboxSelection: true,
          headerCheckboxSelection: true,
          cellRenderer: 'mediaCellRenderer',
        },
        { headerName: fmtMsg(messages.demand), field: 'demand', width: 48 },
        { headerName: fmtMsg(messages.linked_items_count), field: 'linked_items_count', width: 48 },
        { headerName: fmtMsg(messages.type), field: 'type', width: 64 },
        { headerName: fmtMsg(messages.status), field: 'status', width: 64 },
        { headerName: fmtMsg(messages.first_seen), field: 'first_seen', width: 64 },
        { headerName: fmtMsg(messages.last_seen), field: 'last_seen', width: 64 }],
    };
  }

  getRowData() {
    return this.props.searchResults.map((i) => {
      const media = i.node;
      const {
        id,
        dbid,
        picture,
        title,
        description,
        demand,
        linked_items_count,
        type,
        status,
        first_seen,
        last_seen,
      } = media;

      const statusObj = getStatus(mediaStatuses(media), status);

      const formatted_first_seen = this.props.intl.formatRelative(MediaUtil.createdAt({
        published: first_seen,
      }));

      const formatted_last_seen = this.props.intl.formatRelative(MediaUtil.createdAt({
        published: last_seen,
      }));

      return {
        id,
        dbid,
        picture,
        title,
        description,
        type: MediaUtil.mediaTypeLabel(type, this.props.intl),
        demand,
        linked_items_count,
        status: statusObj.label,
        first_seen: formatted_first_seen,
        last_seen: formatted_last_seen,
        media,
        query: i.itemQuery,
      };
    });
  }

  handleClickRow = (wrapper) => {
    if (this.props.onClick) {
      this.props.onClick(wrapper.rowIndex);
    }
  };

  handleGridReady = (params) => {
    this.gridApi = params.api;
    this.gridApi.sizeColumnsToFit();
  };

  handleChange = (params) => {
    const rows = params.api.getSelectedRows();
    if (this.props.onSelect) {
      this.props.onSelect(rows.map(r => r.id));
    }
  };

  render() {
    return (
      <StyledGridContainer className="ag-theme-material">
        <AgGridReact
          columnDefs={this.state.columnDefs}
          frameworkComponents={{ mediaCellRenderer: MediaCell }}
          rowData={this.getRowData()}
          onGridReady={this.handleGridReady}
          onRowClicked={this.handleClickRow}
          onSelectionChanged={this.handleChange}
          rowClass="medias__item"
          rowStyle={{ cursor: 'pointer' }}
          rowHeight="96"
          rowSelection="multiple"
          suppressCellSelection
          suppressRowClickSelection
        />
      </StyledGridContainer>
    );
  }
}

export default injectIntl(List);
<commit_msg>#7861 #7913 Column min width; Watch window resize event<commit_after>import React from 'react';
import { injectIntl, defineMessages } from 'react-intl';
import { AgGridReact } from 'ag-grid-react';
import 'ag-grid-community/dist/styles/ag-grid.css';
import 'ag-grid-community/dist/styles/ag-theme-material.css';
import styled from 'styled-components';
import MediaCell from '../media/MediaCell';
import MediaUtil from '../media/MediaUtil';
import { units } from '../../styles/js/shared';
import { getStatus } from '../../helpers';
import { mediaStatuses } from '../../customHelpers';

const StyledGridContainer = styled.div`
  width: 100%;
  height: calc(100vh - ${units(30)});
  .ag-cell-value {
    line-height: ${units(12)} !important;
  }
  .ag-header-cell-text {
    text-transform: uppercase;
  }
  div.ag-cell {
    padding: 0 ${units(1)};
  }
  div.ag-header-cell {
    padding: 0 ${units(1)};
  }
`;

const messages = defineMessages({
  item: {
    id: 'list.Item',
    defaultMessage: 'Item',
  },
  demand: {
    id: 'list.Demand',
    defaultMessage: 'Requests',
  },
  linked_items_count: {
    id: 'list.LinkedItems',
    defaultMessage: 'Related',
  },
  type: {
    id: 'list.Type',
    defaultMessage: 'Type',
  },
  status: {
    id: 'list.Status',
    defaultMessage: 'Status',
  },
  first_seen: {
    id: 'list.FirstSeen',
    defaultMessage: 'First seen',
  },
  last_seen: {
    id: 'list.LastSeen',
    defaultMessage: 'Last seen',
  },
});

class List extends React.Component {
  constructor(props) {
    super(props);
    const fmtMsg = props.intl.formatMessage;
    this.state = {
      columnDefs: [
        {
          headerName: fmtMsg(messages.item),
          field: 'title',
          checkboxSelection: true,
          headerCheckboxSelection: true,
          cellRenderer: 'mediaCellRenderer',
          minWidth: 288,
        },
        { headerName: fmtMsg(messages.demand), field: 'demand', minWidth: 96 },
        { headerName: fmtMsg(messages.linked_items_count), field: 'linked_items_count', minWidth: 96 },
        { headerName: fmtMsg(messages.type), field: 'type', minWidth: 96 },
        { headerName: fmtMsg(messages.status), field: 'status', minWidth: 96 },
        { headerName: fmtMsg(messages.first_seen), field: 'first_seen', minWidth: 96 },
        { headerName: fmtMsg(messages.last_seen), field: 'last_seen', minWidth: 96 }],
    };
  }

  componentDidMount() {
    window.addEventListener('resize', this.handleWindowResize);
  }

  componentWillUnmount() {
    window.removeEventListener('resize', this.handleWindowResize);
  }

  getRowData() {
    return this.props.searchResults.map((i) => {
      const media = i.node;
      const {
        id,
        dbid,
        picture,
        title,
        description,
        demand,
        linked_items_count,
        type,
        status,
        first_seen,
        last_seen,
      } = media;

      const statusObj = getStatus(mediaStatuses(media), status);

      const formatted_first_seen = this.props.intl.formatRelative(MediaUtil.createdAt({
        published: first_seen,
      }));

      const formatted_last_seen = this.props.intl.formatRelative(MediaUtil.createdAt({
        published: last_seen,
      }));

      const row = {
        id,
        dbid,
        picture,
        title,
        description,
        type: MediaUtil.mediaTypeLabel(type, this.props.intl),
        demand,
        linked_items_count,
        status: statusObj.label,
        first_seen: formatted_first_seen,
        last_seen: formatted_last_seen,
        media,
        query: i.itemQuery,
      };

      return row;
    });
  }

  handleClickRow = (wrapper) => {
    if (this.props.onClick) {
      this.props.onClick(wrapper.rowIndex);
    }
  };

  handleGridReady = (params) => {
    this.gridApi = params.api;
    this.handleWindowResize();
  };

  handleChange = (params) => {
    const rows = params.api.getSelectedRows();
    if (this.props.onSelect) {
      this.props.onSelect(rows.map(r => r.id));
    }
  };

  handleWindowResize = () => {
    this.gridApi.sizeColumnsToFit(1366);
  }

  render() {
    return (
      <StyledGridContainer className="ag-theme-material">
        <AgGridReact
          columnDefs={this.state.columnDefs}
          frameworkComponents={{ mediaCellRenderer: MediaCell }}
          rowData={this.getRowData()}
          onGridReady={this.handleGridReady}
          onRowClicked={this.handleClickRow}
          onSelectionChanged={this.handleChange}
          rowClass="medias__item"
          rowStyle={{ cursor: 'pointer' }}
          rowHeight="96"
          rowSelection="multiple"
          suppressCellSelection
          suppressRowClickSelection
        />
      </StyledGridContainer>
    );
  }
}

export default injectIntl(List);
<|endoftext|>


<commit_before>#words(внимательно рассмотри человека на прилагающейся фотографии) |
#words(карл) |
#words(назвал бытю лысым) |
#words(пасскод) |
#words(спасибо абу) |
#words(▲) |
#exp(/[^a-zа-я](?:re|ре)?(?:roll|ролл)/i) |
#exp(/^(?:bump|up|бамп|вверх)$/i) |
#wipe(samewords,longwords,symbols,numbers,whitespace) |
#ihash(168198000) |
#ihash(188568671) |
#ihash(196826207) |
#img(=129@501x485) | (
    (#op) &
    #words(11 −) |
    #words(boinc) |
    #words(burger king) |
    #words(butthurt) |
    #words(cубкот) |
    #words(dark souls) |
    #words(download/windows10) |
    #words(dps-fm) |
    #words(erfa) |
    #words(existor.com) |
    #words(facegenetic) |
    #words(fallout) |
    #words(forsvarsmakten) |
    #words(haxball) |
    #words(heroeswm) |
    #words(igame) |
    #words(innawoods) |
    #words(last.fm) |
    #words(loveboro) |
    #words(miss.jen) |
    #words(pашк) |
    #words(s.t.a.l.k.e.r) |
    #words(springbell) |
    #words(step.la) |
    #words(telegram) |
    #words(terraria) |
    #words(testyourvocab.com) |
    #words(topface) |
    #words(unreal tournament) |
    #words(ustream.tv/channel/level-cinema-b) |
    #words(vocaro) |
    #words(wall171276007_5065) |
    #words(yoba-gaming) |
    #words(авито) |
    #words(алко) |
    #words(анимублядский) |
    #words(арми) |
    #words(ачивк) |
    #words(ачивок) |
    #words(баба) |
    #words(богин) |
    #words(в качалк) |
    #words(в слове войн) |
    #words(вуз) |
    #words(вытиран) |
    #words(геем) |
    #words(геи) |
    #words(гей) |
    #words(гербов тред) |
    #words(гороскоп) |
    #words(грустной музыки тред) |
    #words(грустнотред) |
    #words(девиа) |
    #words(десктоп) |
    #words(для аутист) |
    #words(добропочт) |
    #words(дудос) |
    #words(егэ) |
    #words(зайчишки-шалунишки) |
    #words(заработок без) |
    #words(засмеялся) |
    #words(захвати европу) |
    #words(зодиак) |
    #words(иисус) |
    #words(имён) |
    #words(как съебать в ) |
    #words(камвхор) |
    #words(карасик) |
    #words(карлан) |
    #words(крипи) |
    #words(крым) |
    #words(кубач) |
    #words(курени) |
    #words(лонгборд) |
    #words(милфотред) |
    #words(мост в терабитию) |
    #words(музыкальный тред) |
    #words(музыкальных) |
    #words(нарк) |
    #words(наськ) |
    #words(нацист) |
    #words(никогда не будет с) |
    #words(но слушаю тред) |
    #words(новое видео) |
    #words(новоросси) |
    #words(ньюфаги не знают) |
    #words(обзор) |
    #words(общение) |
    #words(олень) |
    #words(оцени) |
    #words(перепись) |
    #words(петух кукарекает) |
    #words(пикап) |
    #words(питурд) |
    #words(поговори со мной) |
    #words(поезд) |
    #words(понитред) |
    #words(посоветуй тред) |
    #words(похмель) |
    #words(припук) |
    #words(пропук) |
    #words(пухлоняш) |
    #words(развеиваем мифы о) |
    #words(рашк) |
    #words(рейтим) |
    #words(реквесты) |
    #words(рентв) |
    #words(рипл определит как) |
    #words(рисовач) |
    #words(роском) |
    #words(рулетка) |
    #words(русня) |
    #words(сап двач. я тян) |
    #words(сборн) |
    #words(сидят на шее у мам) |
    #words(скриним свой) |
    #words(соус) |
    #words(субкота) |
    #words(считаем до) |
    #words(сычевальни анона) |
    #words(топфейс) |
    #words(тред травли) |
    #words(у меня день рождения) |
    #words(у меня хер) |
    #words(угадай ) |
    #words(украин) |
    #words(улиточка) |
    #words(фемдом) |
    #words(фото с телеф) |
    #words(фотошоп) |
    #words(футбол) |
    #words(хаксбол) |
    #words(хиддач) |
    #words(хотели ли бы вы) |
    #words(хохл) |
    #words(хохол) |
    #words(хуетред) |
    #words(цветочки-розочки) |
    #words(цуиь) |
    #words(шерлок) |
    #words(шишку) |
    #words(эбол) |
    #words(я джва года мечтаю о такой игре)
)
<commit_msg>weekly update<commit_after>#words(хочу как пикрил) |
#words(/gg/) |
#words(внимательно рассмотри человека на прилагающейся фотографии) |
#words(дабл думаю) |
#words(карл) |
#words(назвал бытю лысым) |
#words(пасскод) |
#words(раздаю биткоин) |
#words(спасибо абу) |
#words(тредшот) |
#words(▲) |
#exp(/[^a-zа-я](?:re|ре)?(?:roll|ролл)/i) |
#exp(/^(?:bump|up|бамп|вверх|выше)$/i) |
#wipe(samewords,longwords,symbols,numbers,whitespace) |
#ihash(168198000) |
#ihash(188568671) |
#ihash(196826207) |
#img(=129@501x485) | (
    (#op) &
    #words(11 −) |
    #words(boinc) |
    #words(burger king) |
    #words(butthurt) |
    #words(cубкот) |
    #words(dark souls) |
    #words(download/windows10) |
    #words(dps-fm) |
    #words(erfa) |
    #words(existor.com) |
    #words(facegenetic) |
    #words(fallout) |
    #words(forsvarsmakten) |
    #words(haxball) |
    #words(heroeswm) |
    #words(igame) |
    #words(innawoods) |
    #words(last.fm) |
    #words(loveboro) |
    #words(miss.jen) |
    #words(pашк) |
    #words(s.t.a.l.k.e.r) |
    #words(springbell) |
    #words(step.la) |
    #words(telegram) |
    #words(terraria) |
    #words(testyourvocab.com) |
    #words(topface) |
    #words(unreal tournament) |
    #words(ustream.tv/channel/level-cinema-b) |
    #words(vocaro) |
    #words(wall171276007_5065) |
    #words(yoba-gaming) |
    #words(авито) |
    #words(алко) |
    #words(анимублядский) |
    #words(антивирус) |
    #words(арми) |
    #words(ачивк) |
    #words(ачивок) |
    #words(баба) |
    #words(богин) |
    #words(быдлотред) |
    #words(в качалк) |
    #words(в слове войн) |
    #words(вуз) |
    #words(вытиран) |
    #words(геем) |
    #words(геи) |
    #words(гей) |
    #words(гербов тред) |
    #words(гороскоп) |
    #words(грустной музыки тред) |
    #words(грустнотред) |
    #words(дабл - думаю) |
    #words(девиа) |
    #words(десктоп) |
    #words(для аутист) |
    #words(добропочт) |
    #words(дудос) |
    #words(егэ) |
    #words(зайчишки-шалунишки) |
    #words(заработок без) |
    #words(засмеялся) |
    #words(захвати европу) |
    #words(зодиак) |
    #words(иисус) |
    #words(имён) |
    #words(как съебать в ) |
    #words(камвхор) |
    #words(карасик) |
    #words(карлан) |
    #words(космоса тред) |
    #words(крипи) |
    #words(крым) |
    #words(кубач) |
    #words(курени) |
    #words(лонгборд) |
    #words(милфотред) |
    #words(мост в терабитию) |
    #words(музыкальный тред) |
    #words(музыкальных) |
    #words(нарк) |
    #words(наськ) |
    #words(нацист) |
    #words(нёх тред) |
    #words(никогда не будет с) |
    #words(но слушаю тред) |
    #words(новое видео) |
    #words(новоросси) |
    #words(ньюфаги не знают) |
    #words(обзор) |
    #words(общение) |
    #words(олень) |
    #words(оцени) |
    #words(перепись) |
    #words(петух кукарекает) |
    #words(пикап) |
    #words(питурд) |
    #words(поговори со мной) |
    #words(поезд) |
    #words(понитред) |
    #words(посоветуй тред) |
    #words(похмель) |
    #words(припук) |
    #words(пропук) |
    #words(пухлоняш) |
    #words(развеиваем мифы о) |
    #words(рашк) |
    #words(рейтим) |
    #words(реквесты) |
    #words(рентв) |
    #words(рипл определит как) |
    #words(рисовач) |
    #words(роском) |
    #words(рулетка) |
    #words(русня) |
    #words(сборн) |
    #words(сидят на шее у мам) |
    #words(скайрим) |
    #words(скриним свой) |
    #words(соус) |
    #words(субкота) |
    #words(считаем до) |
    #words(сычевальни анона) |
    #words(топфейс) |
    #words(тред травли) |
    #words(тред тян 10 из) |
    #words(у меня день рождения) |
    #words(у меня хер) |
    #words(угадай ) |
    #words(украин) |
    #words(улиточка) |
    #words(фемдом) |
    #words(фото с телеф) |
    #words(фотошоп) |
    #words(футбол) |
    #words(хаксбол) |
    #words(хиддач) |
    #words(хотели ли бы вы) |
    #words(хохл) |
    #words(хохол) |
    #words(хуетред) |
    #words(цветочки-розочки) |
    #words(цуиь) |
    #words(шерлок) |
    #words(шишку) |
    #words(эбол) |
    #words(я джва года мечтаю о такой игре)
)
<|endoftext|>


<commit_before>//
// Copyright (c) 2017 DrSmugleaf
//

"use strict"

module.exports = class Song {
  constructor(msg, args, video) {
    this.channel = msg.channel,
    this.guild = msg.guild,
    this.member = msg.member,

    this.url = args.url,
    this.repeat = args.repeat,
    this.repeated = false

    this.video = video
  }
}
<commit_msg>Added message to song properties<commit_after>//
// Copyright (c) 2017 DrSmugleaf
//

"use strict"

module.exports = class Song {
  constructor(msg, args, video) {
    this.channel = msg.channel,
    this.guild = msg.guild,
    this.member = msg.member,
    this.message = msg

    this.url = args.url,
    this.repeat = args.repeat,
    this.repeated = false

    this.video = video
  }
}
<|endoftext|>


<commit_before>module.exports = {

//---------------------------------------------------------------------
// Action Name
//
// This is the name of the action displayed in the editor.
//---------------------------------------------------------------------

name: "Store Channel Info Things",

//---------------------------------------------------------------------
// Action Section
//
// This is the section the action will fall into.
//---------------------------------------------------------------------

section: "Channel Control",

//---------------------------------------------------------------------
// Action Subtitle
//
// This function generates the subtitle displayed next to the name.
//---------------------------------------------------------------------

subtitle: function(data) {
	const channels = ['Same Channel', 'Mentioned Channel', '1st Server Channel', 'Temp Variable', 'Server Variable', 'Global Variable'];
	const info = ['Channel Creation Date', 'On which Server is Channel?', 'Channel Is Deleteable?'];
	return `${channels[parseInt(data.channel)]} - ${info[parseInt(data.info)]}`;
},

//---------------------------------------------------------------------
	 // DBM Mods Manager Variables (Optional but nice to have!)
	 //
	 // These are variables that DBM Mods Manager uses to show information
	 // about the mods for people to see in the list.
	 //---------------------------------------------------------------------

	 // Who made the mod (If not set, defaults to "DBM Mods")
	 author: "EliteArtz",

	 // The version of the mod (Defaults to 1.0.0)
	 version: "1.8.2",

	 // A short description to show on the mod line for this mod (Must be on a single line)
	 short_description: "Stores Channels Information",

	 // If it depends on any other mods by name, ex: WrexMODS if the mod uses something from WrexMods

	 //---------------------------------------------------------------------

//---------------------------------------------------------------------
// Action Storage Function
//
// Stores the relevant variable info for the editor.
//---------------------------------------------------------------------

variableStorage: function(data, varType) {
	const type = parseInt(data.storage);
	if(type !== varType) return;
	const info = parseInt(data.info);
	let dataType = 'Unknown Type';
	switch(info) {
		case 0:
			dataType = "Date";
			break;
		case 1:
			dataType = "Guild";
			break;
		case 2:
			dataType = "Boolean";
			break;
	}
	return ([data.varName2, dataType]);
},

//---------------------------------------------------------------------
// Action Fields
//
// These are the fields for the action. These fields are customized
// by creating elements with corresponding IDs in the HTML. These
// are also the names of the fields stored in the action's JSON data.
//---------------------------------------------------------------------

fields: ["channel", "varName", "info", "storage", "varName2"],

//---------------------------------------------------------------------
// Command HTML
//
// This function returns a string containing the HTML used for
// editting actions.
//
// The "isEvent" parameter will be true if this action is being used
// for an event. Due to their nature, events lack certain information,
// so edit the HTML to reflect this.
//
// The "data" parameter stores constants for select elements to use.
// Each is an array: index 0 for commands, index 1 for events.
// The names are: sendTargets, members, roles, channels,
//                messages, servers, variables
//---------------------------------------------------------------------

html: function(isEvent, data) {
	return `

			Mod Info:

			Created by EliteArtz!

		Source Channel:

		<select id="channel" class="round" onchange="glob.channelChange(this, 'varNameContainer')">
			${data.channels[isEvent ? 1 : 0]}
		</select>

		Variable Name:

		<input id="varName" class="round" type="text" list="variableList">

		Source Info:

		<select id="info" class="round">
			<option value="0" selected>Channel Creation Date</option>
			<option value="1">On which Server is Channel?</option>
			<option value="2">Channel Is Deleteable?</option>
		</select>

		Store In:

		<select id="storage" class="round">
			${data.variables[1]}
		</select>

		Variable Name:

		<input id="varName2" class="round" type="text">

`
},

//---------------------------------------------------------------------
// Action Editor Init Code
//
// When the HTML is first applied to the action editor, this code
// is also run. This helps add modifications or setup reactionary
// functions for the DOM elements.
//---------------------------------------------------------------------

init: function() {
	const {glob, document} = this;

	glob.channelChange(document.getElementById('channel'), 'varNameContainer');
},

//---------------------------------------------------------------------
// Action Bot Function
//
// This is the function for the action within the Bot's Action class.
// Keep in mind event calls won't have access to the "msg" parameter,
// so be sure to provide checks for variable existance.
//---------------------------------------------------------------------

action: function(cache) {
	const data = cache.actions[cache.index];
	const channel = parseInt(data.channel);
	const varName = this.evalMessage(data.varName, cache);
	const info = parseInt(data.info);
	const targetChannel = this.getChannel(channel, varName, cache);
	if(!targetChannel) {
		this.callNextAction(cache);
		return;
	}
	let result;
	switch(info) {
		case 0:
			result = targetChannel.createdAt;
			break;
		case 1:
			result = targetChannel.guild;
			break;
		case 2:
			result = targetChannel.deletable;
			break;
		default:
			break;
	}
	if(result !== undefined) {
		const storage = parseInt(data.storage);
		const varName2 = this.evalMessage(data.varName2, cache);
		this.storeValue(result, storage, varName2, cache);
	}
	this.callNextAction(cache);
},

//---------------------------------------------------------------------
// Action Bot Mod
//
// Upon initialization of the bot, this code is run. Using the bot's
// DBM namespace, one can add/modify existing functions if necessary.
// In order to reduce conflictions between mods, be sure to alias
// functions you wish to overwrite.
//---------------------------------------------------------------------

mod: function(DBM) {
}

}; // End of module
<commit_msg>Store parent/category from a channel<commit_after>module.exports = {

//---------------------------------------------------------------------
// Action Name
//
// This is the name of the action displayed in the editor.
//---------------------------------------------------------------------

name: "Store Channel Info Things",

//---------------------------------------------------------------------
// Action Section
//
// This is the section the action will fall into.
//---------------------------------------------------------------------

section: "Channel Control",

//---------------------------------------------------------------------
// Action Subtitle
//
// This function generates the subtitle displayed next to the name.
//---------------------------------------------------------------------

subtitle: function(data) {
	const channels = ['Same Channel', 'Mentioned Channel', '1st Server Channel', 'Temp Variable', 'Server Variable', 'Global Variable'];
	const info = ['Channel Creation Date', 'On which Server is Channel?', 'Channel Is Deleteable?', 'Channel Category'];
	return `${channels[parseInt(data.channel)]} - ${info[parseInt(data.info)]}`;
},

//---------------------------------------------------------------------
	 // DBM Mods Manager Variables (Optional but nice to have!)
	 //
	 // These are variables that DBM Mods Manager uses to show information
	 // about the mods for people to see in the list.
	 //---------------------------------------------------------------------

	 // Who made the mod (If not set, defaults to "DBM Mods")
	 author: "EliteArtz",

	 // The version of the mod (Defaults to 1.0.0)
	 version: "1.8.3",

	 // A short description to show on the mod line for this mod (Must be on a single line)
	 short_description: "Stores Channels Information",

	 // If it depends on any other mods by name, ex: WrexMODS if the mod uses something from WrexMods

	 //---------------------------------------------------------------------

//---------------------------------------------------------------------
// Action Storage Function
//
// Stores the relevant variable info for the editor.
//---------------------------------------------------------------------

variableStorage: function(data, varType) {
	const type = parseInt(data.storage);
	if(type !== varType) return;
	const info = parseInt(data.info);
	let dataType = 'Unknown Type';
	switch(info) {
		case 0:
			dataType = "Date";
			break;
		case 1:
			dataType = "Guild";
			break;
		case 2:
			dataType = "Boolean";
			break;
		case 3:
			dataType = "Category";
			break;
	}
	return ([data.varName2, dataType]);
},

//---------------------------------------------------------------------
// Action Fields
//
// These are the fields for the action. These fields are customized
// by creating elements with corresponding IDs in the HTML. These
// are also the names of the fields stored in the action's JSON data.
//---------------------------------------------------------------------

fields: ["channel", "varName", "info", "storage", "varName2"],

//---------------------------------------------------------------------
// Command HTML
//
// This function returns a string containing the HTML used for
// editting actions.
//
// The "isEvent" parameter will be true if this action is being used
// for an event. Due to their nature, events lack certain information,
// so edit the HTML to reflect this.
//
// The "data" parameter stores constants for select elements to use.
// Each is an array: index 0 for commands, index 1 for events.
// The names are: sendTargets, members, roles, channels,
//                messages, servers, variables
//---------------------------------------------------------------------

html: function(isEvent, data) {
	return `

			Mod Info:

			Created by EliteArtz and Lasse!

		Source Channel:

		<select id="channel" class="round" onchange="glob.channelChange(this, 'varNameContainer')">
			${data.channels[isEvent ? 1 : 0]}
		</select>

		Variable Name:

		<input id="varName" class="round" type="text" list="variableList">

		Source Info:

		<select id="info" class="round">
			<option value="0" selected>Channel Creation Date</option>
			<option value="1">On which Server is Channel?</option>
			<option value="2">Channel Is Deleteable?</option>
			<option value="3">Channel Category</option>
		</select>

		Store In:

		<select id="storage" class="round">
			${data.variables[1]}
		</select>

		Variable Name:

		<input id="varName2" class="round" type="text">

`
},

//---------------------------------------------------------------------
// Action Editor Init Code
//
// When the HTML is first applied to the action editor, this code
// is also run. This helps add modifications or setup reactionary
// functions for the DOM elements.
//---------------------------------------------------------------------

init: function() {
	const {glob, document} = this;

	glob.channelChange(document.getElementById('channel'), 'varNameContainer');
},

//---------------------------------------------------------------------
// Action Bot Function
//
// This is the function for the action within the Bot's Action class.
// Keep in mind event calls won't have access to the "msg" parameter,
// so be sure to provide checks for variable existance.
//---------------------------------------------------------------------

action: function(cache) {
	const data = cache.actions[cache.index];
	const channel = parseInt(data.channel);
	const varName = this.evalMessage(data.varName, cache);
	const info = parseInt(data.info);
	const targetChannel = this.getChannel(channel, varName, cache);
	if(!targetChannel) {
		this.callNextAction(cache);
		return;
	}
	let result;
	switch(info) {
		case 0:
			result = targetChannel.createdAt;
			break;
		case 1:
			result = targetChannel.guild;
			break;
		case 2:
			result = targetChannel.deletable;
			break;
		case 3:
			result = targetChannel.parent;
			break;
		default:
			break;
	}
	if(result !== undefined) {
		const storage = parseInt(data.storage);
		const varName2 = this.evalMessage(data.varName2, cache);
		this.storeValue(result, storage, varName2, cache);
	}
	this.callNextAction(cache);
},

//---------------------------------------------------------------------
// Action Bot Mod
//
// Upon initialization of the bot, this code is run. Using the bot's
// DBM namespace, one can add/modify existing functions if necessary.
// In order to reduce conflictions between mods, be sure to alias
// functions you wish to overwrite.
//---------------------------------------------------------------------

mod: function(DBM) {
}

}; // End of module
<|endoftext|>


<commit_before>browser.tabs.onCreated.addListener(tab => {
  if (tab.incognito) {
    disableAddon(tab.id);
  }
});

browser.tabs.query({}).then(tabs => {
  for (let tab of tabs) { // eslint-disable-line prefer-const
    if (tab.incognito) {
      disableAddon(tab.id);
    }
  }
}).catch(() => {});

function disableAddon(tabId) {
 browser.browserAction.disable(tabId);
 browser.browserAction.setTitle({ tabId, title: "Containers disabled in Private Browsing Mode" });
}
<commit_msg>Fix ESLint indent errors<commit_after>browser.tabs.onCreated.addListener(tab => {
  if (tab.incognito) {
    disableAddon(tab.id);
  }
});

browser.tabs.query({}).then(tabs => {
  for (let tab of tabs) { // eslint-disable-line prefer-const
    if (tab.incognito) {
      disableAddon(tab.id);
    }
  }
}).catch(() => {});

function disableAddon(tabId) {
  browser.browserAction.disable(tabId);
  browser.browserAction.setTitle({ tabId, title: "Containers disabled in Private Browsing Mode" });
}
<|endoftext|>


<commit_before>// @flow
// @jsx glam
import glam from 'glam';
import React, { Component } from 'react';

import Carousel, { Modal, ModalGateway } from '../../src/components';

const flow = (

    flow

);
const features = [
  { icon: '🛠', text: Comprehensively typed ({flow}) },
  { icon: '📱', text: 'Support for touch devices' },
  { icon: '📺', text: 'Fullscreen support on desktop devices' },
  { icon: '🖼', text: 'Carousel without modal dialog' },
  { icon: '🏖', text: 'No restrictions on data shape' },
  { icon: '🚀', text: 'Replaceable component architecture' },
];

const List = ({ items }) => (

    {items.map(({ icon, text }, j) => (

          {icon}

        {text}

    ))}

);
const Gallery = props => (

);
const Image = props => (

);

type Props = {
  images: Array<{
    description: string,
    photographer: string,
    urls: {
      regular: string,
      thumb: string,
    },
  }>,
  isLoading: boolean,
};
type State = {
  currentView?: number,
  lightboxIsOpen: boolean,
};

export default class Home extends Component<Props, State> {
  state = {
    currentView: undefined,
    lightboxIsOpen: false,
  };
  toggleLightbox = (currentView: number) => {
    this.setState(state => ({
      lightboxIsOpen: !state.lightboxIsOpen,
      currentView,
    }));
  };
  render() {
    const { images, isLoading } = this.props;
    const { currentView, lightboxIsOpen } = this.state;

    return (

          React Images v1{' '}
          (alpha)

          A simple, responsive Lightbox component for ReactJS to display an
          array of images.

          Images courtesy of{' '}

              Unsplash

          .

        <Gallery>
          {images.map((data, j) => {
            return (
              <Image key={data.username}>
                 this.toggleLightbox(j)}
                  src={data.urls.thumb}
                  alt={data.description}
                  css={{
                    cursor: 'pointer',
                    position: 'absolute',
                    maxWidth: '100%',
                  }}
                />
              </Image>
            );
          })}
        </Gallery>

Features and updates:

        <List items={features} />
        {/* {images.length && (
          <Carousel
            frameProps={{ autoSize: 'height' }}
            trackProps={{ infinite: true }}
            views={images}
            components={{ Header: null }}
          />
        )}
        <Lorem count={1} /> */}

        <ModalGateway>
          {lightboxIsOpen && !isLoading ? (
            <Modal onClose={this.toggleLightbox}>
              <Carousel
                frameProps={{ autoSize: 'height' }}
                trackProps={{ currentView }}
                views={images}
              />
            </Modal>
          ) : null}
        </ModalGateway>

    );
  }
}
<commit_msg>bump to test netlify<commit_after>// @flow
// @jsx glam
import glam from 'glam';
import React, { Component } from 'react';

import Carousel, { Modal, ModalGateway } from '../../src/components';

const flow = (

    flow

);
const features = [
  { icon: '🛠', text: Comprehensively typed ({flow}) },
  { icon: '📱', text: 'Support for touch devices' },
  { icon: '📺', text: 'Fullscreen support on desktop devices' },
  { icon: '🖼', text: 'Carousel without modal dialog' },
  { icon: '🏖', text: 'No restrictions on data shape' },
  { icon: '🚀', text: 'Replaceable component architecture' },
];

const List = ({ items }) => (

    {items.map(({ icon, text }, j) => (

          {icon}

        {text}

    ))}

);
const Gallery = props => (

);
const Image = props => (

);

type Props = {
  images: Array<{
    description: string,
    photographer: string,
    urls: {
      regular: string,
      thumb: string,
    },
  }>,
  isLoading: boolean,
};
type State = {
  currentView?: number,
  lightboxIsOpen: boolean,
};

export default class Home extends Component<Props, State> {
  state = {
    currentView: undefined,
    lightboxIsOpen: false,
  };
  toggleLightbox = (currentView: number) => {
    this.setState(state => ({
      lightboxIsOpen: !state.lightboxIsOpen,
      currentView,
    }));
  };
  render() {
    const { images, isLoading } = this.props;
    const { currentView, lightboxIsOpen } = this.state;

    return (

          React Images v1{' '}
          (alpha)

          A simple, responsive Lightbox component for ReactJS to display an
          array of images.

          Images courtesy of{' '}

            Unsplash

        <Gallery>
          {images.map((data, j) => {
            return (
              <Image key={data.username}>
                 this.toggleLightbox(j)}
                  src={data.urls.thumb}
                  alt={data.description}
                  css={{
                    cursor: 'pointer',
                    position: 'absolute',
                    maxWidth: '100%',
                  }}
                />
              </Image>
            );
          })}
        </Gallery>

Features and updates:

        <List items={features} />
        {/* {images.length && (
          <Carousel
            frameProps={{ autoSize: 'height' }}
            trackProps={{ infinite: true }}
            views={images}
            components={{ Header: null }}
          />
        )}
        <Lorem count={1} /> */}

        <ModalGateway>
          {lightboxIsOpen && !isLoading ? (
            <Modal onClose={this.toggleLightbox}>
              <Carousel
                frameProps={{ autoSize: 'height' }}
                trackProps={{ currentView }}
                views={images}
              />
            </Modal>
          ) : null}
        </ModalGateway>

    );
  }
}
<|endoftext|>