Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1#!/usr/local/bin/python 

2# encoding: utf-8 

3""" 

4*stats_sidebar for the PESSTO Marshall* 

5 

6:Author: 

7 David Young 

8""" 

9import sys 

10import os 

11import khufu 

12 

13def stats_sidebar( 

14 log, 

15 request, 

16 thisPageName 

17): 

18 """Get the left navigation bar for the pessto marshall 

19 

20 **Key Arguments** 

21 

22 - ``log`` -- logger 

23 - ``request`` -- the pyramid request 

24 - ``thisPageName`` -- the name of the page currently displayed 

25  

26 

27 **Return** 

28 

29 - ``leftNavBar`` -- the left navigation bar for the pessto marshall 

30  

31 """ 

32 import khufu 

33 

34 log.debug('starting the ``stats_sidebar`` function') 

35 

36 leftColumnContent = "" 

37 

38 header = _stats_sidebar_header( 

39 log=log, 

40 request=request 

41 ) 

42 

43 esoPhaseIIILinks = _get_esoPhaseIII_links( 

44 log, 

45 request=request, 

46 thisPageName=thisPageName 

47 ) 

48 

49 stats_sidebar = """ 

50%(header)s 

51%(esoPhaseIIILinks)s <br> 

52""" % locals() 

53 

54 log.debug('completed the ``stats_sidebar`` function') 

55 return stats_sidebar 

56 

57def _stats_sidebar_header( 

58 log, 

59 request): 

60 """Generate the left navigation bar header content 

61 

62 **Key Arguments** 

63 

64 - ``log`` -- logger 

65 - ``request`` -- the pyramid request 

66  

67 

68 **Return** 

69 

70 - ``content`` -- the left nav bar header content 

71  

72 """ 

73 import khufu 

74 

75 log.debug('starting the ``_stats_sidebar_header`` function') 

76 ## VARIABLES ## 

77 

78 pesstoIcon = khufu.image( 

79 src=request.static_path( 

80 'marshall_webapp:static/images/pessto_icon.png'), 

81 href=request.route_path('transients'), 

82 display=False, # [ rounded | circle | polaroid ] 

83 pull=False, # [ "left" | "right" | "center" ] 

84 htmlClass=False, 

85 thumbnail=False, 

86 # width=25, 

87 onPhone=True, 

88 onTablet=True, 

89 onDesktop=True, 

90 htmlId="stats_sideBarPesstoIcon" 

91 ) 

92 

93 padding = khufu.grid_column( 

94 span=1, # 1-12 

95 offset=0, # 1-12 

96 content="", 

97 htmlId=False, 

98 htmlClass=False, 

99 onPhone=True, 

100 onTablet=True, 

101 onDesktop=True, 

102 ) 

103 

104 pesstoIcon = khufu.grid_column( 

105 span=4, # 1-12 

106 offset=8, # 1-12 

107 content=pesstoIcon, 

108 htmlId=False, 

109 htmlClass=False, 

110 onPhone=True, 

111 onTablet=True, 

112 onDesktop=True, 

113 ) 

114 

115 pesstoIcon = khufu.grid_row( 

116 responsive=True, 

117 columns=pesstoIcon, 

118 htmlId="stats_sideBarPesstoIconRow", 

119 htmlClass=False, 

120 onPhone=True, 

121 onTablet=True, 

122 onDesktop=True 

123 ) 

124 

125 log.debug('completed the ``_stats_sidebar_header`` function') 

126 # return "%(pesstoIcon)s %(createNewButton)s" % locals() 

127 return "%(pesstoIcon)s" % locals() 

128 

129def _get_esoPhaseIII_links( 

130 log, 

131 request, 

132 thisPageName): 

133 """get development links 

134 

135 **Key Arguments** 

136 

137 - ``log`` -- logger 

138 - ``thisPageName`` -- the name of the current page 

139  

140 

141 **Return** 

142 

143 - ``developmentLinks`` -- the development queue - a list of links 

144  

145 """ 

146 import os 

147 import khufu 

148 

149 log.debug('starting the ``_get_development_links`` function') 

150 ## VARIABLES ## 

151 

152 title = khufu.li( 

153 content="ESO Phase III", 

154 # if a subMenu for dropdown this should be <ul> 

155 span=False, # [ False | 1-12 ] 

156 disabled=False, 

157 submenuTitle=False, 

158 divider=False, 

159 navStyle="header", # [ active | header ] 

160 navDropDown=False, 

161 pager=False # [ False | "previous" | "next" ] 

162 ) 

163 

164 releaseLinks = [] 

165 releaseVersions = ["SSDR1", "SSDR2", "SSDR3"] 

166 for releaseVersion in releaseVersions: 

167 SSDRLink = khufu.a( 

168 content=releaseVersion, 

169 href=request.route_path('stats_element', elementId=releaseVersion), 

170 tableIndex=False, 

171 triggerStyle=False 

172 ) 

173 SSDRLink = khufu.li( 

174 content=SSDRLink, 

175 ) 

176 releaseLinks.append(SSDRLink) 

177 

178 releaseLinks.insert(0, title) 

179 

180 linkList = khufu.ul( 

181 itemList=releaseLinks, # e.g a list links 

182 unstyled=False, 

183 inline=False, 

184 dropDownMenu=False, # [ false | true ] 

185 navStyle="list", # [ nav | tabs | pills | list ] 

186 navPull="right", # [ false | left | right ] 

187 navDirection=False, # [ 'default' | 'stacked' | 'horizontal' ] 

188 breadcrumb=False, # [ False | True ] 

189 pager=False, 

190 thumbnails=False, 

191 mediaList=False 

192 ) 

193 

194 column = khufu.grid_column( 

195 span=12, # 1-12 

196 offset=0, # 1-12 

197 content=linkList, 

198 htmlId=False, 

199 htmlClass=False, 

200 onPhone=True, 

201 onTablet=True, 

202 onDesktop=True 

203 ) 

204 

205 developmentLinks = khufu.grid_row( 

206 responsive=True, 

207 columns=column, 

208 htmlId=False, 

209 htmlClass=False, 

210 onPhone=True, 

211 onTablet=True, 

212 onDesktop=True 

213 ) 

214 

215 log.debug('completed the ``_get_development_links`` function') 

216 return developmentLinks