Personal wiki notebook (not under development)

Upgrade_page.py 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. from Product_page import Product_page
  2. from Tags import Div, H1, Img, A, P, Table, Th, Tr, Td, Li, Span, I, Br, Ul, Li, Script, H4, B, Script
  3. from config.Version import VERSION
  4. class Upgrade_page( Product_page ):
  5. FOCUSED_PLAN = 2
  6. def __init__( self, user, notebooks, first_notebook, login_url, logout_url, rate_plan, groups, rate_plans, unsubscribe_button ):
  7. MEGABYTE = 1024 * 1024
  8. rate_plans = list( rate_plans )[ 0:1 ] # only the free rate plan is shown
  9. Product_page.__init__(
  10. self,
  11. user,
  12. first_notebook,
  13. login_url,
  14. logout_url,
  15. u"pricing", # note title
  16. Script( type = u"text/javascript", src = u"/static/js/MochiKit.js?%s" % VERSION ),
  17. Div(
  18. Div(
  19. user and user.username not in ( None, u"anonymous" ) and H1(
  20. Img(
  21. src = u"/static/images/upgrade.png",
  22. width = u"152", height = u"51",
  23. alt = u"upgrade",
  24. ),
  25. ) or H1(
  26. Img(
  27. src = u"/static/images/sign_up.png",
  28. width = u"138", height = u"51",
  29. alt = u"sign up",
  30. ),
  31. ),
  32. P(
  33. Table(
  34. self.fee_row( rate_plans, user ),
  35. self.spacer_row( rate_plans ),
  36. Tr(
  37. [ Td(
  38. ( plan[ u"included_users" ] == 1 ) and
  39. Span( Span( u"Single", class_ = u"highlight" ), u"user", title = u"This plan includes one user account, so it's ideal for individuals." ) or
  40. Span( u"Up to", Span( "%s" % plan[ u"included_users" ], class_ = u"highlight" ), u"users", title = "This plan includes multiple accounts, including an admin area where you can create and manage users for your organization." ),
  41. class_ = u"feature_value" + ( index == self.FOCUSED_PLAN and u" focused_feature_value" or u"" ),
  42. ) for ( index, plan ) in enumerate( rate_plans ) ],
  43. ),
  44. Tr(
  45. [ Td(
  46. plan[ u"storage_quota_bytes" ] and
  47. Span( "%s MB" % ( plan[ u"storage_quota_bytes" ] // MEGABYTE ), class_ = u"highlight" ) or
  48. Span( u"unlimited", class_ = u"highlight" ),
  49. u"storage",
  50. title = u"Storage space for your notes, documents, and files.",
  51. class_ = u"feature_value" + ( index == self.FOCUSED_PLAN and u" focused_feature_value" or u"" ),
  52. ) for ( index, plan ) in enumerate( rate_plans ) ],
  53. ),
  54. plan[ u"notebook_sharing"] and Tr(
  55. [ Td(
  56. plan[ u"notebook_collaboration" ] and
  57. Span( u"Invite", Span( u"editors", class_ = u"highlight" ), title = u"Invite people to collaborate on your wiki. Share only the notebooks you want. Keep the others private." ) or
  58. Span( u"Invite", Span( u"viewers", class_ = u"highlight" ), title = u"Invite people to view your wiki. Share only the notebooks you want. Keep the others private." ),
  59. class_ = u"feature_value" + ( index == self.FOCUSED_PLAN and u" focused_feature_value" or u"" ),
  60. ) for ( index, plan ) in enumerate( rate_plans ) ],
  61. ) or None,
  62. self.button_row( rate_plans, user ),
  63. self.spacer_row( rate_plans, bottom = True ),
  64. border = u"1",
  65. id = u"upgrade_table",
  66. ),
  67. class_ = u"upgrade_table_area",
  68. ),
  69. Div(
  70. u"Don't want to take notes online? ",
  71. A( u"Download Luminotes Desktop", href = u"/download" ),
  72. u".",
  73. class_ = u"small_text",
  74. separator = u"",
  75. ),
  76. class_ = u"upgrade_area",
  77. ),
  78. Div(
  79. Div(
  80. H4( u"Do you have a desktop version I can download?", class_ = u"upgrade_question" ),
  81. P(
  82. u"""
  83. Yes! If you want to download Luminotes and take notes locally instead of on the web,
  84. check out
  85. """,
  86. A( u"Luminotes Desktop", href = "/download" ), ".",
  87. separator = u"",
  88. class_ = u"upgrade_text",
  89. ),
  90. H4( u"Is my wiki private?", class_ = u"upgrade_question" ),
  91. P(
  92. u"""
  93. Absolutely. Your personal wiki is protected by industry-standard SSL encryption, and
  94. your wiki is never shared with anyone unless you explicitly invite them to view or
  95. edit it. There is a complete
  96. """,
  97. A( u"Luminotes privacy policy", href = "/privacy" ),
  98. u"""
  99. on the subject, so please check that out if you're interested in how Luminotes
  100. protects your privacy.
  101. """,
  102. class_ = u"upgrade_text",
  103. ),
  104. H4( u"Do you backup my wiki?", class_ = u"upgrade_question" ),
  105. P(
  106. """
  107. Your wiki is fully backed up every day, and you can even download the entire contents
  108. of your wiki as a stand-alone web page or a CSV spreadsheet — anytime you like.
  109. """,
  110. class_ = u"upgrade_text",
  111. ),
  112. H4( u"What happens to my wiki if I stop using Luminotes?", class_ = u"upgrade_question" ),
  113. P(
  114. """
  115. There is no lock-in with Luminotes. You can export your entire wiki to a stand-alone web page or a CSV spreadsheet — anytime you like.
  116. """,
  117. class_ = u"upgrade_text",
  118. ),
  119. class_= u"wide_center_area",
  120. ),
  121. Div(
  122. P(
  123. Span( u"Have a question before you sign up?", class_ = u"hook_action_question" ), Br(),
  124. A( u"Contact support", href = u"/contact_info", class_ = u"hook_action" ),
  125. class_ = u"hook_action_area",
  126. separator = u"",
  127. ),
  128. class_ = u"center_area",
  129. ),
  130. class_ = u"wide_center_area",
  131. ),
  132. ),
  133. )
  134. def fee_row( self, rate_plans, user, yearly = False ):
  135. def make_fee_area( plan, index ):
  136. fee_area = (
  137. Span( plan[ u"name" ].capitalize(), class_ = u"plan_name" ),
  138. plan[ u"fee" ] and Div(
  139. yearly and Span(
  140. u"$%s" % plan[ u"yearly_fee" ],
  141. Span( u"/year", class_ = u"month_text" ),
  142. class_ = u"price_text",
  143. separator = u"",
  144. ) or Div(
  145. u"$%s" % plan[ u"fee" ],
  146. Span( u"/month", class_ = u"month_text" ),
  147. class_ = u"price_text",
  148. separator = u"",
  149. ),
  150. ) or Div( Div( u"No fee", class_ = u"price_text" ) ),
  151. Div(
  152. plan[ u"designed_for"] and u"For" or " ", plan[ u"designed_for" ],
  153. class_ = u"small_text",
  154. ),
  155. ( index == self.FOCUSED_PLAN ) and Div( u"Best value", class_ = u"focused_text highlight" ) or None,
  156. )
  157. # if this is a demo/guest user, then make the fee area a big link to the sign up page
  158. if not user or user.username in ( u"anonymous", None ):
  159. fee_area = A( href = u"/sign_up?plan=%s&yearly=%s" % ( index, yearly ), *fee_area )
  160. else:
  161. fee_area = Span( *fee_area )
  162. return fee_area
  163. return Tr(
  164. [ Th(
  165. make_fee_area( plan, index ),
  166. class_ = u"plan_name_area plan_width" + ( index == self.FOCUSED_PLAN and u" focused_plan_name_area" or u"" ),
  167. ) for ( index, plan ) in enumerate( rate_plans ) ],
  168. )
  169. def button_row( self, rate_plans, user, yearly = False ):
  170. return Tr(
  171. [ Td(
  172. Div(
  173. # 1 = modifying an existing subscription, 0 = new subscription
  174. user and user.username not in ( u"anonymous", None ) and user.rate_plan != index \
  175. and ( yearly and ( plan.get( u"yearly_button" ) and plan.get( u"yearly_button" ).strip() and
  176. plan.get( u"yearly_button" ) % ( user.object_id, user.rate_plan and 1 or 0 ) or None ) or \
  177. ( plan.get( u"button" ) and plan.get( u"button" ).strip() and
  178. plan.get( u"button" ) % ( user.object_id, user.rate_plan and 1 or 0 ) or None ) ) or None,
  179. ( not user or user.username in ( u"anonymous", None ) ) and A(
  180. Img( src = u"/static/images/sign_up_button.png", width = "76", height = "23" ),
  181. href = u"/sign_up?plan=%s&yearly=%s" % ( index, yearly ),
  182. ) or None,
  183. class_ = u"subscribe_button_area",
  184. ),
  185. ( user.rate_plan == 0 ) and Div( ( index > 0 ) and "30-day free trial" or " ", class_ = u"small_text" ) or None,
  186. class_ = ( index == self.FOCUSED_PLAN and u"focused_feature_value" or u"" ),
  187. ) for ( index, plan ) in enumerate( rate_plans ) ],
  188. )
  189. def spacer_row( self, rate_plans, bottom = False ):
  190. border_bottom = bottom and " focused_border_bottom" or ""
  191. return Tr( [ Td( class_ = ( i == self.FOCUSED_PLAN and u"focused_feature_value" + border_bottom or u"spacer_row" ) ) for i in range( len( rate_plans ) ) ], class_ = u"spacer_row" )