def printProfileList(profile, solo): defaultHighlight = "" if profile.default: defaultHighlight = " defaultThumbnail" sites = "" siteFunction = rs.generateProfileScript(profile) for site in profile.sites: sites+= "<a href='" + site.site + "' target='_blank'>" + site.site + "</a><br/>" soloClasses = "col-sm-6 col-md-4 " if solo: soloClasses = "col-sm-12 col-md-12 col-sm-offset-0 col-md-offset-0" contents = """<div class='""" + soloClasses + """'><div class='thumbnail """ + defaultHighlight + """'> <button class="btn btn-primary" onclick=" """ + siteFunction + """ ">Run Profile</button> <a href="/settings/profiles.html"><button class="btn btn-default">Edit Profile</button></a> <br/><br/> <b><em>Name: </em> """ + profile.name + """</b><br/> <b><em>Type: </em></b> """ + profile.type + """<br/> <b><em>Sites: </em></b> """ + sites + """ <b><em>Playlist: </em></b> """ + profile.playlist + """<br/> <b><em>Default: </em></b> """ + str(profile.default) + """ </div></div> """ return contents
def generatePage(account, gps): pageContents = p.getRow(p.getGPSBox(gps)) error = 0 if gps != "Not available.": profile = ndb.getGPSProfile(account.email, gps) error = 2 else: profile = ndb.getDefaultProfile(account.email) error = 1 if profile: pageContents += "<script>" + rs.generateProfileScript(profile) + "</script>" pageContents += "<br/><div class='text-center'><h4>Profile <em>" + profile.name + "</em> has been executed!</h4></div>" pageContents += p.getRow(ndb.printProfileList(profile, True)) else: pageContents += ndb.noProfiles(error) return pageContents;