Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Ratings/ratings_nologic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@
<attributeType name="Integer"/>
</attributeTypes>
</property>
<property key="onChangeMicroflow" type="microflow" required="false">
<caption>On change microflow</caption>
<category>Behavior</category>
<description>Microflow to be executed when the rate is changed</description>
<returnType type="Void"/>
</property>
</properties>
</widget>
22 changes: 20 additions & 2 deletions src/Ratings/widget/ratings_nologic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ define([

return declare("Ratings.widget.ratings_nologic", [ _WidgetBase, _TemplatedMixin ], {
templateString : widgetTemplate,
name : "",

// Modeler properties
voteEnabled : false,
standardImage : "",
mouseoverImage : "",
name : "",
onChangeMicroflow: "",

// Internal properties
divNode : "",
mouseoverArray : null,
root : window.mx.appUrl,
Expand All @@ -39,7 +43,7 @@ define([
logger.debug(this.id + "._setValueAttr");
this.oldvalue = parseInt(value, 10);
this.newvalue = parseInt(value, 10);
if (this.newvalue > 0) {
if (this.newvalue >= 0) {
this.setRating(this.newvalue);
} else if (this.mxcontext.getTrackObject()) {
domClass.remove(this.domNode, "hidden");
Expand Down Expand Up @@ -109,6 +113,7 @@ define([
this.newvalue = count;
if (this.newvalue !== this.oldvalue) {
this.onChange();
this._callMicroflow(this.onChangeMicroflow);
}

this.displayImages(count);
Expand All @@ -131,6 +136,19 @@ define([
this.setMouseOver(showVote - 1);
},

_callMicroflow: function(microflowName) {
if (microflowName) {
window.mx.ui.action(microflowName, {
context: this.mxcontext,
origin: this.mxform,
callback: function() { },
error: function(error) {
window.mx.ui.error("Error executing microflow: " + microflowName + " " + error.message);
}
});
}
},

uninitialize : function(){
logger.debug(this.id + ".uninitialize");
for (var i = 0; i < this.mouseoverArray.length; i++){
Expand Down