def post(self): LTI_Launch.USE_COOKIE = True launch = LTI_Launch(self) if launch.complete: return if launch.new and launch.fromcookie is False: launch.cookieRedirect() if launch.complete: return if launch.loaded: self.response.out.write('<p>Done:' + launch.getUserName() + '</p>') if launch.fromcookie: self.response.out.write('<p>(Cookie is Working) ') self.response.out.write('<a href="' + self.request.url + '" target="_new">Open</a></p>') else: self.response.out.write('<p>(Cookie are off) ') self.response.out.write('<a href="' + launch.getUrl() + '" target="_new">Open</a></p>') val = launch.get('val', 0) self.response.out.write('<p>Val ' + str(val) + '</p>') launch['val'] = val + 1 else: self.response.out.write( '<p>This tool must be launched using IMS Basic LTI.</p>') self.response.out.write('\n' + launch.dump() + '\n')
def signon(self): launch = LTI_Launch(self) if launch.complete: return None if not launch.loaded: self.response.out.write( '<p>This tool must be launched using IMS Basic LTI.</p>') return None return launch
def post(self): launch = LTI_Launch(self) if launch.complete: return if launch.loaded: self.response.out.write('<p>Done:' + launch.getUserName()) self.response.out.write(' <a href="' + launch.getUrl() + '" target="_new">Open</a></p>') val = launch.get('val', 0) self.response.out.write('<p>Val ' + str(val) + '</p>') launch['val'] = val + 1 else: self.response.out.write( '<p>This tool must be launched using IMS Basic LTI.</p>') self.response.out.write('\n' + launch.dump() + '\n')
def post(self): launch = LTI_Launch(self) if launch.complete: return if launch.loaded is False: self.response.out.write( '<p>This tool must be launched using IMS Basic LTI.</p>') return wiskey = 'WisCrowd-' + str(launch.getCourseKey()) data = self.getmodel(wiskey) logging.info('WisHandler Loading Wis Key=' + wiskey) name = self.request.get('name') if len(name) < 1: name = launch.getUserName() if name is None or len(name) < 1: self.display(launch, data, 'You must enter a user name') return guess = self.request.get('guess') try: guess = int(guess) except: guess = -1 msg = '' if guess < 1: msg = 'Please enter a valid, numeric guess' elif len(name) < 1: msg = 'No Name Found' elif name in data: msg = 'You already have answered this' elif len(data) > 1000: msg = 'Game only supports 1000 players.' else: data[name] = guess memcache.set(wiskey, data, 3600) logging.info('Storing Wis Key=' + wiskey) # Retrieve and check to see if it was stored data = self.getmodel(wiskey) if data.get(name, None) == guess: msg = 'Thank you for your guess' else: msg = 'Unable to store your guess please re-submit' logging.warning('Failed to Store Wis Key=' + wiskey) self.display(launch, data, msg)
def get(self): launch = LTI_Launch(self) if launch.complete: return if launch.loaded is False: self.response.out.write('<p>This tool must be launched using IMS Basic LTI.</p>') return msg = None wiskey = 'WisCrowd-'+str(launch.getCourseKey()) logging.info('WisHandler.render Loading Wis Key='+wiskey) self.action = self.request.get('action') if launch.isInstructor() and self.action == 'reset': data = dict() logging.info('Resetting Wis Key='+wiskey) memcache.set(wiskey, data, 3600) msg = 'Data reset' else: data = self.getmodel(wiskey) self.display(launch, data, msg)