Improving the Dialog API

This pull request addresses the following issues in the Dialogs API:

* #258: Now the templates that don't use a template are templatized. This is done by using a generic template for all, a JSON object to define the variables for the default dialogs and a title and message parameters that replace the template variables if defined. The template is rendered and then the dialog is generated. This also adds a new function to create a new Dialog by passing an object instead of using the pre-defined ones.

* #3077: All the show dialog functions now return a new Dialog instance, which has the promise the dialog element and a close method. These can then be easily expanded to add more methods.

* #1089: By just changing the styles for window i was able to reverse the order of the Save/Cancel buttons.

I can split the request if needed, but since all are related to the dialogs I thought it was better to address them all together.