CMDBuild Forum

Context Menu Custom Component for Mass edit

Hello,
i would really like to have a context menu for mass editing cards, like in the User Manual:
image

For that, I would have to create a custom component as a context menu, but I don’t seem to find any ressources on how this .zip should look like. I also tried to reuse a custom component from the demo application, but there are none.

Is there a possibilty to have this custom component from the user manual?

Thanks for your help in advance and regards,
Martin

Search in others sample DB like R2U or OPM

SELECT * FROM public."_ContextMenu"
where "Status"='A'
ORDER BY "Id" ASC;

There are 4 or 5 samples. “Generate calendar entries”:

var total = records.length;
var counter = 0, created = 0;
function OnCalenderaCreated(success) {
    counter++;
    if (success) {
        created++;
    }
    if (counter === total) {
        records.length === 1 ? CMDBuildUI.util.Notifier.showSuccessMessage("Operation performed on " + created + " element") :
                               CMDBuildUI.util.Notifier.showSuccessMessage("Operazione performed on " + created + " elements");
        api.refreshGrid();
        popup.close();
    }
}

var popup = CMDBuildUI.util.Utilities.openPopup(
    null,
    "Generate calendar entries",
    {
        xtype: 'form',
        bodyPadding: CMDBuildUI.util.helper.FormHelper.properties.padding,
        fieldDefaults: CMDBuildUI.util.helper.FormHelper.fieldDefaults,
        viewModel: {
            data: {
                fromDate: new Date(),
                toDate: null
            }
        },
        items: [{
            xtype: 'datefield',
            fieldLabel: 'From:',
            allowBlank: false,
            format: 'd/m/Y',
            bind: {
                value: '{fromDate}'
            }
        }, {
            xtype: 'datefield',
            fieldLabel: 'To:',
            allowBlank: false,
            format: 'd/m/Y',
            bind: {
                value: '{toDate}'
            }
        }],
        buttons: [{
            text: 'Ok',
            ui: 'management-action',
            formBind: true,
            handler: function (btn, eOpts) {
                records.forEach(function (elem) {
                    Ext.Ajax.request({
                        url: CMDBuildUI.util.Config.baseUrl + CMDBuildUI.util.api.Functions.getFunctionOutputsByNameUrl('ctx_maintcal_gen'),
                        method: "GET",
                        params: {
                            parameters: Ext.JSON.encode({
                                prevmaintconfig_id: elem.data._id,
                                start_period: btn.up("form").getViewModel().get("fromDate"),
                                stop_period: btn.up("form").getViewModel().get("toDate"),
                                update_policy: null
                            })
                        },
                        callback: function (fopitons, fsuccess, fresponse) {
                            if (fresponse.status < 400) { // has no errors
                                var fresponseJson = Ext.JSON.decode(fresponse.responseText, true);
                                if (fresponseJson['data'][0]['success']) {
                                    OnCalenderaCreated(true);
                                } else {
                                    OnCalenderaCreated(false);
                                }
                            } else {
                                OnCalenderaCreated(false);
                            }
                        }
                    });
                })
            }
        }, {
            text: 'Annulla',
            ui: 'secondary-action',
            handler: function () {
                popup.close();
            }
        }]
    }, null, {
        width: 300,
        height: 210
    }
);