if (info(3, 6) = "5") then
bui! = BBjAPI().getBuiManager()
url! = bui!.getUrl().replaceAll("apps", "webapp")
action! = bui!.urlAction(url!)
bui!.setEndAction(action!)
release
endif
web! = BBjAPI().getWebManager()
web!.injectStyleUrl("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.20.1/cdn/themes/light.css")
web!.injectScriptUrl("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.20.1/cdn/shoelace.js", 1, "type=module")
window! = BBjAPI().openSysGui("X0").addWindow("Shoelace Rating", $01101083$)
window!.setPanelStyle("display", "flex")
window!.setPanelStyle("flex-direction", "column")
window!.setPanelStyle("gap", "var(--dwc-space-l)")
window!.setPanelStyle("padding", "var(--dwc-space-xl)")
window!.setCallback(BBjAPI.ON_CLOSE, "onExit")
question! = window!.addStaticText("How do you like this course?")
rating! = window!.addWebComponent("sl-rating")
rating!.setAttribute("label", "Rate this course")
rating!.setAttribute("max", "5")
result! = window!.addStaticText("You have not rated the course yet.")
options! = rating!.newEventOptions()
options!.addItem("value", "String(event.target.value)")
rating!.setCallback("sl-change", "onRatingChange", options!)
window!.setVisible(1)
process_events
onRatingChange:
event! = BBjAPI().getSysGui().getLastEvent()
value$ = str(event!.getEventMap().get("value"))
result!.setText("You rated the course " + value$ + " of 5 stars.")
return
onExit:
release
declare auto BBjTopLevelWindow window!
declare auto BBjStaticText question!
declare auto BBjWebComponent rating!
declare auto BBjWebEventOptions options!
declare auto BBjStaticText result!
declare auto BBjWebEvent event!