"""Embed widgets from MKWS, the MasterKey Widget Set"""
import pkg_resources
+import random
from xblock.core import XBlock
from xblock.fields import Integer, Scope, String, Any, Boolean, Dict
default="water",
scope=Scope.content
)
+ display_name = String(
+ default="MKWS Widget",
+ scope=Scope.settings
+ )
def resource_string(self, path):
"""Helper for accessing resources."""
def student_view(self, context=None):
"""The primary view of the MKWS XBlock, shown to students when viewing courses."""
html = self.resource_string("static/html/mkwsxb.html")
- frag = Fragment(html.format(query=self.query))
+ frag = Fragment(html.format(query=self.query, team=random.randint(0, 100000)))
frag.add_javascript_url("//mkws.indexdata.com/mkws-complete.js")
frag.add_javascript_url("//example.indexdata.com/mkws-widget-ru.js")
frag.add_css(self.resource_string("static/css/mkws-widget-ru.css"))