Hi,
I wanted to have a button on account page that can open a modal with iframe.
Button was done.
Code for modal was done as well.
I created the following.
(Module)
Ext.define("Terrasoft.controls.UsrIntegrateERPIframeControl", { extend: "Terrasoft.Component", alternateClassName: "Terrasoft.UsrIntegrateERPIframeControl", tpl: [ '<iframe id="{id}" src="{src}" class="{wrapClass}"></iframe>' ], id: null, src: "https://academy.terrasoft.ru/", wrapClass: ["usr-iframe"], setIframeSrc: function(value) { value = value || ""; if (this.src !== value) { this.src = value; this.safeRerender(); } }, init: function() { this.callParent(arguments); var selectors = this.selectors = this.selectors || {}; selectors.wrapEl = selectors.wrapEl || "#" + this.id; }, LoadPageBySrc: function() { var iframe = this.getWrapEl(); iframe.dom.src = this.src; }, onAfterRender: function() { this.callParent(arguments); this.LoadPageBySrc(); }, onAfterReRender: function() { this.callParent(arguments); this.LoadPageBySrc(); }, getBindConfig: function() { var bindConfig = this.callParent(arguments); return Ext.apply(bindConfig, { src: { changeMethod: "setIframeSrc" } }); }, getTplData: function() { var tplData = this.callParent(arguments); return Ext.apply(tplData, { src: this.src, wrapClass: this.wrapClass }); } });
(Page View Model)
define("UsrERPModalPage", ["UsrIntegrateERPIframeControl", "css!UsrIntegrateERPIframeControl"], function() { return { attributes: { "TestText": { dataValueType: Terrasoft.DataValueType.TEXT, type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN } }, messages: { }, methods: { init: function(callback, scope) { this.callParent(arguments); }, getHeader: function() { return this.get("Resources.Strings.PageCaption"); }, onRender: function() { this.callParent(arguments); var moduleInfo = this.get("moduleInfo"); var boxSizes = moduleInfo.modalBoxSize; var width = boxSizes.width; var height = boxSizes.height; this.updateSize(width, height); } }, //Insert already existed Iframe diff: [ { "operation": "insert", "parentName": "CardContentContainer", "propertyName": "items", "name": "UsrERPModalPage", "values": { "generator": function() { return { "className": "Terrasoft.UsrIntegrateERPIframeControl" }; } } }, { "operation": "insert", "name": "MyContainer", "propertyName": "items", "values": { "itemType": Terrasoft.ViewItemType.CONTAINER, "items": [] } }, { "operation": "insert", "parentName": "MyContainer", "propertyName": "items", "name": "MyGridContainer", "values": { "itemType": Terrasoft.ViewItemType.GRID_LAYOUT, "items": [] } }, { "operation": "insert", "parentName": "MyGridContainer", "propertyName": "items", "name": "TestText", "values": { "bindTo": "TestText", "caption": "Test text", "layout": {"column": 0, "row": 0, "colSpan": 10} } } ] }; });
(Replacing View Model )
define("AccountPageV2", ["AccountPageV2Resources", "MaskHelper"], function(MaskHelper) { return { entitySchemaName: "Account", methods: { subscribeSandboxEvents: function() { this.callParent(arguments); this.sandbox.subscribe("GetModuleInfo", this.getGenerateQouteModalBoxConfig, this, [this.getGenerateQouteModalBoxId()]); }, getGenerateQouteModalBoxConfig: function() { return { "schemaName": "UsrERPModalPage", "modalBoxSize": { "width": "680px", "height": "400px" } }; }, getGenerateQouteModalBoxId: function() { return this.sandbox.id + "_GenerateQouteModalBox"; }, onGenerateQouteButtonClick: function() { this.sandbox.loadModule("ModalBoxSchemaModule", { id: this.getGenerateQouteModalBoxId() }); } }, diff: [ // Adding the button. { "operation": "insert", "parentName": "LeftContainer", "propertyName": "items", "name": "GenerateQouteSectionButton", "values": { itemType: Terrasoft.ViewItemType.BUTTON, caption: { bindTo: "Resources.Strings.OpenERPGenerateQouteButtonCaption" }, click: { bindTo: "onGenerateQouteButtonClick" }, style: Terrasoft.controls.ButtonEnums.style.BLUE } }, ] }; });
Then I compiled (my package) but I got this error.
{ message: "Message GetModuleInfo is not defined in CardModuleV2 (SectionModuleV2_AccountSectionV2_CardModuleV2) module" }
Then I log-out, flush Redis, login again, compile all but still received the same error.
References:
https://community.creatio.com/articles/add-iframe-modalbox
https://community.creatio.com/questions/open-iframe-floating-page
Best Regards,
Solem
Like
Hi Solem,
In the AccountPageV2 schema you do also need to create several messages were not mentioned in the original community post https://community.creatio.com/articles/add-iframe-modalbox since Excel report builder marketplace app was chosen as a page for an example where I think these messages are declared:
{ "GetMasterEntitySchema": { direction: Terrasoft.MessageDirectionType.SUBSCRIBE, mode: Terrasoft.MessageMode.PTP }, "UsrUploadFileClick": { direction: Terrasoft.MessageDirectionType.SUBSCRIBE, mode: Terrasoft.MessageMode.PTP }, "GetModuleInfo": { direction: Terrasoft.MessageDirectionType.SUBSCRIBE, mode: Terrasoft.MessageMode.PTP } },
As a result the button started to display the IFrame as needed:
Best regards,
Oscar
Hi Solem,
In the AccountPageV2 schema you do also need to create several messages were not mentioned in the original community post https://community.creatio.com/articles/add-iframe-modalbox since Excel report builder marketplace app was chosen as a page for an example where I think these messages are declared:
{ "GetMasterEntitySchema": { direction: Terrasoft.MessageDirectionType.SUBSCRIBE, mode: Terrasoft.MessageMode.PTP }, "UsrUploadFileClick": { direction: Terrasoft.MessageDirectionType.SUBSCRIBE, mode: Terrasoft.MessageMode.PTP }, "GetModuleInfo": { direction: Terrasoft.MessageDirectionType.SUBSCRIBE, mode: Terrasoft.MessageMode.PTP } },
As a result the button started to display the IFrame as needed:
Best regards,
Oscar