def contents_html_template(self): html_template = HtmlTemplate() html_template.title = "%s %s" % (self.type_element.ToString("f"), self.text()) html_template.h1 = "%s %s" % (self.type_element.ToString("s"), self.text()) html_template.main = fmt_non_empty( self.widget_member_filter(show_inherited = not isinstance(self, ConstructorsNode)) + "%s", self.main_html_table()) return html_template
def contents_html_template(self): html_template = HtmlTemplate() html_template.title = "%s Class Diagram" % self.namespace_element.Namespace # ignore static types # take types with no base class or base class outside the documentation scope root_types = [ t for t in self.namespace_element.Types if not t.IsStatic and (not t.BaseType or not t.BaseType.IsLocalType) ] html_template.main = self.__ul(root_types) return html_template
def contents_html_template(self): html_template = HtmlTemplate() html_template.title = "%s %s" % (self.constructor_element.OwnerType.ToString("f"), "Constructor") html_template.h1 = "%s %s" % (self.constructor_element.OwnerType.ToString("s"), "Constructor") html_template.main = self.__summary_section() + \ self.__syntax_section() + \ self.__exceptions_section() + \ self.__remarks_section() + \ self.__example_section() + \ self.__see_also_section() return html_template
def contents_html_template(self): print "Generating page for namespace %s" % self.namespace_element.Namespace html_template = HtmlTemplate() html_template.title = self.text() html_template.main = "\n".join([ self.__table("Classes", [t for t in self.namespace_element.Types if t.IsClass]), self.__table("Interfaces", [t for t in self.namespace_element.Types if t.IsInterface]), self.__table("Enumerations", [t for t in self.namespace_element.Types if t.IsEnum]) ]) # TODO: delegates return html_template
def contents_html_template(self): method_name = self.method_element.Name html_template = HtmlTemplate() html_template.title = "%s %s" % (method_name, "Method") html_template.h1 = "%s.%s %s" % (self.method_element.OwnerType.ToString("s"), method_name, "Method") html_template.main = self.__summary_section() + \ self.__syntax_section() + \ self.__exceptions_section() + \ self.__remarks_section() + \ self.__example_section() + \ self.__see_also_section() return html_template
def get(self): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "http://quickui.org/release/quickui.catalog.js", "/static/js/G.js", "/static/js/controls/submitButton.js", "/static/js/controls/textField.js", "/static/js/controls/select.js", "/static/js/controls/form.js", "/static/js/pages/addbusiness.js" ]) email = self.request.get('email') name = self.request.get('name') offer = self.request.get('offer') url = self.request.get('url') kioware_passcode = self.request.get('kioware_passcode') involvementOptions = self.request.get('involvementOptions') with_public_sharing_checkbox = self.request.get( 'with_public_sharing_checkbox') if name: biz = Business( name=name, url=url, offer=offer, email=email, involvement_options=involvementOptions, kioware_passcode=kioware_passcode, with_public_sharing_checkbox=with_public_sharing_checkbox == 'Yes', active=True) biz.save() response = simplejson.dumps({"message": 'Successful'}, sort_keys=True) self.response.out.write(response) else: script = """ $(document).ready(function() { $("#root").append( G.controls.AddBiz.create() ) }); """ self.response.out.write(myTemplate.addScript(script).buildPage())
def get(self): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "http://quickui.org/release/quickui.catalog.js", "/static/js/G.js", "/static/js/controls/submitButton.js", "/static/js/controls/textField.js", "/static/js/controls/select.js", "/static/js/controls/form.js", "/static/js/pages/addbusiness.js" ]) email = self.request.get('email') name = self.request.get('name') offer = self.request.get('offer') url = self.request.get('url') kioware_passcode = self.request.get('kioware_passcode') involvementOptions = self.request.get('involvementOptions') with_public_sharing_checkbox = self.request.get('with_public_sharing_checkbox') if name: biz = Business( name=name, url=url, offer=offer, email=email, involvement_options=involvementOptions, kioware_passcode=kioware_passcode, with_public_sharing_checkbox= with_public_sharing_checkbox == 'Yes', active=True ) biz.save() response = simplejson.dumps({"message":'Successful'}, sort_keys=True) self.response.out.write(response) else: script = """ $(document).ready(function() { $("#root").append( G.controls.AddBiz.create() ) }); """ self.response.out.write(myTemplate.addScript(script).buildPage())
def contents_html_template(self): property_name = self.property_element.Name html_template = HtmlTemplate() html_template.title = "%s %s" % (property_name, "Property") html_template.h1 = "%s.%s %s" % (self.property_element.OwnerType.ToString("s"), property_name, "Property") html_template.main = fmt_non_empty(""" <h2>Summary</h2> <p>%s</p> """, self.property_element.XmlComment.Summary()) + \ """ <h2>Syntax</h2> <code class="syntax"> %s </code> """ % self.property_element.ToSyntax() return html_template
def getTemplate(self, htmlPage, title, pageSpecificHeaders=[]): myTemplate = HtmlTemplate() myTemplate.addBody(open(htmlPage).read()).addTitle(title) myTemplate.addHeaders([ "https://cert01.securepaypage.litle.com/LitlePayPage/litle-api.js", "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "/static/js/jquery.colorbox.js", "/static/js/enhanceselect.js", "/static/js/score1.js", "/static/js/score2.js", "/static/js/currencyFormat.js", "/static/js/G.js", "/static/js/controls/textField.js", "/static/js/controls/submitButton.js", "/static/js/controls/stardisplay.js", "/static/js/controls/reviewrow.js", "/static/js/controls/dealershipResultRow.js", "/static/js/controls/rankresult.js", "/static/js/controls/rankresult2.js", "/static/js/controls/locationentry.js", "/static/js/pages/storepage.js", "/static/js/pages/buypage.js", "/static/js/pages/finddealershippage.js", "/static/js/pages/homepage.js", "/static/js/pages/publicrankingpage.js" ]); myTemplate.addHeaders(pageSpecificHeaders) self.template = myTemplate
def contents_html_template(self): print "Generating page for enum %s" % self.type_element.ToString("f") type_kind = self.type_element.TypeKind has_flags = self.type_element.HasAttribute("System.FlagsAttribute") html_template = HtmlTemplate() html_template.title = "%s %s" % (self.type_element.ToString("f"), type_kind) html_template.h1 = "%s %s" % (self.type_element.ToString("s"), type_kind) html_template.main = fmt_non_empty(""" <h2>Summary</h2> <p>%s</p>""", self.type_element.XmlComment.Summary()) if has_flags: html_template.main += """ <p class="info">This is a flags enum; its members can be combined with bitwise operators.</p>""" html_template.main += self.__members_section() return html_template
def contents_html_template(self): html_template = HtmlTemplate() html_template.title = "%s Extension Methods" % self.namespace_element.Namespace extension_methods = self.__get_extension_methods() methods_by_extended_type = { } for m in extension_methods: extended_type = m.GetParameters()[0].ParameterType lst = methods_by_extended_type.get(extended_type) if lst == None: lst = [] methods_by_extended_type[extended_type] = lst lst.append(m) html_template.main = "" for extended_type in list(methods_by_extended_type): html_template.main += "<h2>Extension methods for %s</h2>" % extended_type.ToHtml() html_template.main += self.methods_table(methods_by_extended_type[extended_type]) return html_template
def get(self): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://code.jquery.com/jquery-1.7.2.min.js", "/static/Archive/rating_screen_v1/css/styles.css" ]) script = """ $(document).ready(function() { $("#root").append( $("<center>").append( $("<div>").css({ 'padding': '100px', 'color': 'white', 'font-size': '40px' }).append('Not a valid Url') ) ) }); """ self.response.out.write(myTemplate.addScript(script).buildPage())
def contents_html_template(self): print "Generating page for type %s" % self.type_element.ToString("f") type_kind = self.type_element.TypeKind html_template = HtmlTemplate() html_template.title = "%s %s" % (self.type_element.ToString("f"), type_kind) html_template.h1 = "%s %s" % (self.type_element.ToString("s"), type_kind) html_template.main = "\n".join([ fmt_non_empty(""" <h2>Summary</h2> <p>%s</p>""", self.type_element.XmlComment.Summary()), self.__base_type_section(), self.__interfaces_section(), self.__derived_types_section(), self.__syntax_section(), self.__constructors_section(), self.__properties_section(), self.__methods_section(), self.__extension_methods_section() ]) # TODO: operators # TODO: separate attribute template? return html_template
def get(self): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "http://quickui.org/release/quickui.catalog.js", "/static/js/G.js", "/static/js/pages/dashboard.js" ]) biz_query = db.Query(Business).filter("active =", True).fetch(1000000) def getBizStats(days_back=0): bizs = {} for biz in biz_query: bizs[str(biz.key())] = { 'name': biz.name, 'url': biz.url, 'starSum': 0, 'rvrCount': 0, 'starAvg': 0, 'kioPass': biz.kioware_passcode } if days_back: n_days_ago = datetime.datetime.now() - datetime.timedelta(days = days_back) rvrs = db.Query(Review).filter("add_dt >", n_days_ago).fetch(1000000) else: rvrs = db.Query(Review).fetch(1000000) rvrsList = [rvr for rvr in rvrs] while rvrsList: rvr = rvrsList.pop() if rvr.business.active: biz = bizs[str(rvr.business.key())] biz['starSum'] += rvr.star_rating biz['rvrCount'] += 1 biz['starAvg'] = round(biz['starSum'] / biz['rvrCount'], 2) return bizs stats = simplejson.dumps({"stats":getBizStats()}, sort_keys=True) statsPastDay = simplejson.dumps({"stats":getBizStats(1)}, sort_keys=True) script = """ $(document).ready(function() { $("#root").append( $("<div>").css({ 'font-size': '50px', 'padding': '25px', 'padding-left': '0px', 'text-align': 'left', 'font-family': 'arial' }).append( 'Review Data' ), G.controls.Dashboard.create() .statsTable(%s) .title('All Time'), G.controls.Dashboard.create() .statsTable(%s) .title('Past Day') ) }); """ % (stats, statsPastDay) self.response.out.write(myTemplate.addScript(script).buildPage())
def get(self): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "http://quickui.org/release/quickui.catalog.js", "/static/js/G.js", "/static/js/pages/reviews.js" ]) biz_query = db.Query(Business).filter("active =", True).fetch(1000000) rvr_query = db.Query(Review).order('-add_dt').fetch(1000000) rvrer_query = db.Query(Reviewer).fetch(1000000) rows_by_review = [] biz_map = {} rvrer_map = {} for biz in biz_query: biz_map[str(biz.key())] = { 'name': biz.name } for rvrer in rvrer_query: rvrer_map[str(rvrer.key())] = { 'email': rvrer.email, 'agree_public_share': str(rvrer.agree_public_share), 'business_involvement': rvrer.business_involvement } for rvr in rvr_query: try: rvr.reviewer if rvr.business.active: if biz_map[str(rvr.business.key())]['name'] != 'test': rows_by_review.append( { 'business_name': biz_map[str(rvr.business.key())]['name'], 'date': str(rvr.add_dt), 'star_rating': rvr.star_rating, 'reviewer_email': rvrer_map[str(rvr.reviewer.key())]['email'], 'agree_public_share': rvrer_map[str(rvr.reviewer.key())]['agree_public_share'], 'business_involvement': rvrer_map[str(rvr.reviewer.key())]['business_involvement'], 'feedback': rvr.feedback } ) except datastore_errors.ReferencePropertyResolveError: logging.error('ReferenceProperty error') data = simplejson.dumps({"rows": rows_by_review}, sort_keys=True) script = """ $(document).ready(function() { $("#root").append( G.controls.Reviews.create() .dataTable(%s) .title('Reviews') ) }); """ % data self.response.out.write(myTemplate.addScript(script).buildPage())
def get(self, resource): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "/static/quickuicatalog.js", "/static/starrating/jquery.MetaData.js", "/static/starrating/jquery.rating.js", "/static/starrating/jquery.rating.css", "/static/Archive/rating_screen_v1/js/jquery.rateit.js", "/static/Archive/rating_screen_v1/css/rateit.css", "/static/Archive/rating_screen_v1/css/styles.css", "/static/Archive/rating_screen_v1/css/bigstars.css", "/static/Archive/rating_screen_v1/css/antenna.css", "/static/Archive/rating_screen_v1/css/shCore.css", "/static/Archive/rating_screen_v1/css/shCoreDefault.css", "/static/js/G.js", "/static/js/controls/starrating.js", "/static/js/controls/starRatingLarge.js", "/static/js/controls/checkbox.js", "/static/js/controls/submitButton.js", "/static/js/controls/textField.js", "/static/js/controls/emailTextField.js", "/static/js/controls/TextArea.js", "/static/js/controls/reviewSectionHeader.js", "/static/js/controls/reviewStep.js", "/static/js/controls/reviewStepsMobile.js", "/static/js/controls/reviewStepsNexus.js", "/static/js/controls/sitelink.js", "/static/js/controls/reviewtextbox.js", "/static/js/pages/home.js" ]) path = self.request.url.split('/')[3] displayDevice = 'tablet' if path == 't' else 'monitor' biz = Business.all().filter("url = ", resource).get() if biz: uastring = self.request.headers.get('user_agent') user_on_iphone = "Mobile" in uastring user_on_nexus = "Nexus 7" in uastring user_on_nexus = True pageData = simplejson.dumps({'involvementOptions': biz.involvement_options.split('|') if biz.involvement_options else False, 'businessName': biz.name, 'withPublicSharingCheckbox': biz.with_public_sharing_checkbox, 'user_on_iphone': user_on_iphone, 'user_on_nexus': user_on_nexus, 'business_code': resource, 'displayDevice': displayDevice}, sort_keys=True) script = """ $(document).ready(function() { $("#root").append( G.controls.Home.create() .pageData(%s) ) }); """ % pageData self.response.out.write(myTemplate.addScript(script).buildPage()) else: self.redirect('/notfound')
def get(self): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "http://quickui.org/release/quickui.catalog.js", "/static/js/G.js", "/static/js/pages/dashboard.js" ]) biz_query = db.Query(Business).filter("active =", True).fetch(1000000) def getBizStats(days_back=0): bizs = {} for biz in biz_query: bizs[str(biz.key())] = { 'name': biz.name, 'url': biz.url, 'starSum': 0, 'rvrCount': 0, 'starAvg': 0, 'kioPass': biz.kioware_passcode } if days_back: n_days_ago = datetime.datetime.now() - datetime.timedelta( days=days_back) rvrs = db.Query(Review).filter("add_dt >", n_days_ago).fetch(1000000) else: rvrs = db.Query(Review).fetch(1000000) rvrsList = [rvr for rvr in rvrs] while rvrsList: rvr = rvrsList.pop() if rvr.business.active: biz = bizs[str(rvr.business.key())] biz['starSum'] += rvr.star_rating biz['rvrCount'] += 1 biz['starAvg'] = round(biz['starSum'] / biz['rvrCount'], 2) return bizs stats = simplejson.dumps({"stats": getBizStats()}, sort_keys=True) statsPastDay = simplejson.dumps({"stats": getBizStats(1)}, sort_keys=True) script = """ $(document).ready(function() { $("#root").append( $("<div>").css({ 'font-size': '50px', 'padding': '25px', 'padding-left': '0px', 'text-align': 'left', 'font-family': 'arial' }).append( 'Review Data' ), G.controls.Dashboard.create() .statsTable(%s) .title('All Time'), G.controls.Dashboard.create() .statsTable(%s) .title('Past Day') ) }); """ % (stats, statsPastDay) self.response.out.write(myTemplate.addScript(script).buildPage())
def get(self): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "http://quickui.org/release/quickui.catalog.js", "/static/js/G.js", "/static/js/pages/reviews.js" ]) biz_query = db.Query(Business).filter("active =", True).fetch(1000000) rvr_query = db.Query(Review).order('-add_dt').fetch(1000000) rvrer_query = db.Query(Reviewer).fetch(1000000) rows_by_review = [] biz_map = {} rvrer_map = {} for biz in biz_query: biz_map[str(biz.key())] = {'name': biz.name} for rvrer in rvrer_query: rvrer_map[str(rvrer.key())] = { 'email': rvrer.email, 'agree_public_share': str(rvrer.agree_public_share), 'business_involvement': rvrer.business_involvement } for rvr in rvr_query: try: rvr.reviewer if rvr.business.active: if biz_map[str(rvr.business.key())]['name'] != 'test': rows_by_review.append({ 'business_name': biz_map[str(rvr.business.key())]['name'], 'date': str(rvr.add_dt), 'star_rating': rvr.star_rating, 'reviewer_email': rvrer_map[str(rvr.reviewer.key())]['email'], 'agree_public_share': rvrer_map[str( rvr.reviewer.key())]['agree_public_share'], 'business_involvement': rvrer_map[str( rvr.reviewer.key())]['business_involvement'], 'feedback': rvr.feedback }) except datastore_errors.ReferencePropertyResolveError: logging.error('ReferenceProperty error') data = simplejson.dumps({"rows": rows_by_review}, sort_keys=True) script = """ $(document).ready(function() { $("#root").append( G.controls.Reviews.create() .dataTable(%s) .title('Reviews') ) }); """ % data self.response.out.write(myTemplate.addScript(script).buildPage())
def get(self, resource): myTemplate = HtmlTemplate() myTemplate.addHeaders([ "http://quickui.org/release/quickui.catalog.css", "http://code.jquery.com/jquery-1.7.2.min.js", "http://quickui.org/release/quickui.js", "/static/quickuicatalog.js", "/static/starrating/jquery.MetaData.js", "/static/starrating/jquery.rating.js", "/static/starrating/jquery.rating.css", "/static/Archive/rating_screen_v1/js/jquery.rateit.js", "/static/Archive/rating_screen_v1/css/rateit.css", "/static/Archive/rating_screen_v1/css/styles.css", "/static/Archive/rating_screen_v1/css/bigstars.css", "/static/Archive/rating_screen_v1/css/antenna.css", "/static/Archive/rating_screen_v1/css/shCore.css", "/static/Archive/rating_screen_v1/css/shCoreDefault.css", "/static/js/G.js", "/static/js/controls/starrating.js", "/static/js/controls/starRatingLarge.js", "/static/js/controls/checkbox.js", "/static/js/controls/submitButton.js", "/static/js/controls/textField.js", "/static/js/controls/emailTextField.js", "/static/js/controls/TextArea.js", "/static/js/controls/reviewSectionHeader.js", "/static/js/controls/reviewStep.js", "/static/js/controls/reviewStepsMobile.js", "/static/js/controls/reviewStepsNexus.js", "/static/js/controls/sitelink.js", "/static/js/controls/reviewtextbox.js", "/static/js/pages/home.js" ]) path = self.request.url.split('/')[3] displayDevice = 'tablet' if path == 't' else 'monitor' biz = Business.all().filter("url = ", resource).get() if biz: uastring = self.request.headers.get('user_agent') user_on_iphone = "Mobile" in uastring user_on_nexus = "Nexus 7" in uastring user_on_nexus = True pageData = simplejson.dumps( { 'involvementOptions': biz.involvement_options.split('|') if biz.involvement_options else False, 'businessName': biz.name, 'withPublicSharingCheckbox': biz.with_public_sharing_checkbox, 'user_on_iphone': user_on_iphone, 'user_on_nexus': user_on_nexus, 'business_code': resource, 'displayDevice': displayDevice }, sort_keys=True) script = """ $(document).ready(function() { $("#root").append( G.controls.Home.create() .pageData(%s) ) }); """ % pageData self.response.out.write(myTemplate.addScript(script).buildPage()) else: self.redirect('/notfound')