22 "dojo/_base/declare" ,
33 "mxui/widget/_WidgetBase" ,
44 "dijit/_TemplatedMixin" ,
5+ "mxui/dom" ,
56 "dojo/query" ,
67 "dojo/dom-class" ,
78 "dojo/dom-construct" ,
@@ -10,7 +11,7 @@ define([
1011 "dojo/_base/event" ,
1112 "dojo/text!DropdownDivConverter/widget/template/DropdownDivConverter.html" ,
1213 "dojo/NodeList-traverse"
13- ] , function ( declare , _WidgetBase , _TemplatedMixin , domQuery , domClass , domConstruct , dojoArray , lang , event , widgetTemplate ) {
14+ ] , function ( declare , _WidgetBase , _TemplatedMixin , dom , domQuery , domClass , domConstruct , dojoArray , lang , event , widgetTemplate ) {
1415 "use strict" ;
1516
1617 /*
@@ -61,6 +62,7 @@ define([
6162 this . _isOpen = false ;
6263 } ,
6364
65+ // mxui.widget._WidgetBase.update is called when context is changed or initialized. Implement to re-render and / or fetch data.
6466 update : function ( obj , callback ) {
6567 this . _contextObj = obj ;
6668
@@ -81,13 +83,13 @@ define([
8183 domConstruct . place ( entry , this . dropdownMenu , "last" ) ;
8284 } ) ) ;
8385
84- this . _renderInterface ( this . startOpen , callback ) ;
86+ this . _renderInterface ( this . startOpen , callback ) ;
8587 } ,
8688
8789 // Really render the interface, if renderAsOpen is true: render the menu in open state
8890 _renderInterface : function ( renderAsOpen , callback ) {
8991 this . _updateButtonTitle ( ) ;
90- this . dropdownButton . innerHTML = this . _buttonLabel + "<span class=\" caret\" ></span>" ;
92+ this . dropdownButton . innerHTML = dom . escapeString ( this . _buttonLabel ) + "<span class=' caret' ></span>" ;
9193 // if a glyphicon icon was requested and the splitButton is not wanted: add the glyphicon to the button.
9294 if ( this . buttonGlyphicon !== "" && ! this . splitButtonActive ) {
9395 this . _addGlyphicon ( this . dropdownButton ) ;
@@ -196,6 +198,12 @@ define([
196198 params : {
197199 applyto : "selection" ,
198200 guids : [ id ]
201+ } ,
202+ callback : function ( success ) {
203+ // if success was true, the microflow was indeed followed through
204+ } ,
205+ error : function ( error ) {
206+ // if there was an error
199207 }
200208 } , this ) ;
201209 } else if ( this . simpleSplitButtonClicked !== "" ) {
@@ -225,20 +233,20 @@ define([
225233 // Set button types: size and type
226234 _setButtonTypes : function ( button ) {
227235 // first set the button type
228- var typeClassName = "btn-" + this . buttonType ;
236+ var typeClassName = "btn-" + this . buttonType ,
237+ sizeClassName ;
229238
230239 if ( ! domClass . contains ( button , typeClassName ) ) {
231240 domClass . add ( button , typeClassName ) ;
232241 }
233242
234243 if ( this . buttonSize === "default" ) {
235- // default buttonsize is allready implemented
236- return ;
244+ return ;
237245 }
238246
239- var sizeClassName = "btn-" + this . buttonSize ;
240- if ( ! domClass . contains ( button , sizeClassName ) ) {
241- domClass . add ( button , sizeClassName ) ;
247+ sizeClassName = "btn-" + this . buttonSize ;
248+ if ( ! domClass . contains ( button , sizeClassName ) ) {
249+ domClass . add ( button , sizeClassName ) ;
242250 }
243251 } ,
244252
@@ -252,7 +260,7 @@ define([
252260 // Create a split button group
253261 _createSplitButton : function ( ) {
254262 // create the new split button label
255- this . splitButton . innerHTML = this . _buttonLabel ;
263+ this . splitButton . innerHTML = dom . escapeString ( this . _buttonLabel ) ;
256264 // if a glyphicon icon was requested: add the glyphicon to the button.
257265 if ( this . buttonGlyphicon !== "" ) {
258266 this . _addGlyphicon ( this . splitButton ) ;
@@ -273,7 +281,7 @@ define([
273281
274282 // Add a glyphicon to a button
275283 _addGlyphicon : function ( buttonObject ) {
276- buttonObject . innerHTML = "<span class=\" glyphicon " + this . buttonGlyphicon + "\" ></span>" + buttonObject . innerHTML ;
284+ buttonObject . innerHTML = "<span class=' glyphicon " + dom . escapeString ( this . buttonGlyphicon ) + "' ></span>" + buttonObject . innerHTML ;
277285 } ,
278286
279287 // Reset subscriptions.
0 commit comments