Can I run a microflow from index.html?

3
I have a small chat application that allows users to communicate with each other in real time. It uses the microflow timer widget from the app store to refresh the messages sent while the Chat Session form is open. That works fine. The issue I have is in starting the Chat. You invite someone to join your session (it creates an link between the user and the chat session. I need a second microflow timer to check for any requests to join a chat. If I place this on the Home form, this works fine. However, users will not always be on the home form, so to make this work I would need the microflow timer widget added to every form that can be opened In Content. Clearly I want to avoid that. Ideally I want to be able to load the microflow timer in the index.html form so that it is always running. Is this possible? I have looked at this question, but it doesn't work for me. This gives a link to load my form/timer in the main content area which I do not want. So, is there a way to load a dummy form with the microflow timer widget into a separate div in the index.html page, or is there a different way to achieve this? Thanks Edit: Thanks for the example code Robert. Unfortunately, the microflow timer widget does need to be placed in a data view or template grid, so I need to load a form I think. I've been playing with trying to get a form to load. Can dojotype="templatesystem.widget.ConditionalLoader" id="Timer_0" contenturl="Chat/timer.mxf" ... or something like that be used? (Where the module is Chat and the form with the widget is called timer)
asked
2 answers
3

You can use Firebug to look at how your Microflow Timer is currently loaded into a form and copy that DOM element into your index.html. It should a link because in that case you were loading in a LinkContainer and the link text was the text that should become the link. In this case you want something like a MicroflowTimer type.

<div zoomdefault="fill" viewerwidth="1100" viewerheight="300" 
usecookie="true" tabindex="0" mxid="8329" minzoomlevel="-5" 
maxzoomlevel="10" dojotype="ImageViewer.widget.ImageViewer" 
cookieexpire="0" focusindex="0" id="ImageViewer_widget_ImageViewer_0" 
widgetid="ImageViewer_widget_ImageViewer_0" class=""></div>

Here I'm loading the ImageViewer.widget.ImageViewer and most of the other settings are the input arguments you usually define in the Modeler. Make sure you strip out the mxid="8329" and the widgetid="ImageViewer.widget.ImageViewer" part.

This should get you pretty far along. Do note that this won't work with a widget that needs to be in a dataview, as it won't have an object when in the index.html.

answered
2

You could try to edit the widget (or file a feature request). It is possible for the widget to insert a new element somewhere in the DOM outside of the contentpane (in which mendix loads its forms) so that once the widget has been opened (just put it on your start page) it stays there (unless the page is manually refreshed in the browser, in which case it should return to the start page again!:).

Besides that, you might also want to look at an option with XMPP if you want to do chat. Polling and creating objects is not very optimal, especially if you have a lot of people doing it.

answered