Public Member Functions | Public Attributes | Static Public Attributes | List of all members
generic.views.Pages.ValidationPageIndex Class Reference
Inheritance diagram for generic.views.Pages.ValidationPageIndex:
generic.views.Pages.BasePage object

Public Member Functions

def AddContent (self, validation_name, dataset_dirs, comparison_dirs)
 
def AddHTML (self, pattern, replacement, destructive=False)
 
def GetHTML (self)
 
def GetURLTrail (self)
 
def AddBreadcrumb (self)
 
def AddContent (self)
 
def AddStaticContentLinks (self, additional_css=[], additional_js=[], insert_plot_js=False)
 
def AddNavbarHook (self)
 
def AddNavbarDropdowns (self, info, dropdowns)
 
def AddSidebarHook (self)
 
def AddSidebarSection (self, category)
 
def AddTitle (self)
 

Public Attributes

 top_url
 
 base_url
 
 static_url
 
 html
 
 sidebar_index
 
short int type
 
short int number
 
char name [SIZE_OF_OBJ_NAME]
 
cat_entry star
 

Static Public Attributes

 TEMPLATE_PAGE = os.path.join(os.path.dirname(__file__), "template.html")
 

Detailed Description

Definition at line 195 of file Pages.py.

Member Function Documentation

def generic.views.Pages.BasePage.AddBreadcrumb (   self)
inherited

Definition at line 57 of file Pages.py.

References generic.views.Pages.BasePage.AddHTML(), generic.views.Pages.BasePage.GetURLTrail(), and generic.views.Pages.BasePage.top_url.

Referenced by generic.views.Pages.FrontPage.AddContent(), generic.views.Pages.ValidationPageIndex.AddContent(), generic.views.Pages.PlotPage.AddContent(), and generic.views.Pages.ComparisonTablePage.AddContent().

57  def AddBreadcrumb(self):
58  url_trail = self.GetURLTrail()
59 
60  breadcrumb_html = \
61  """
62  <li><a href="%s/index.html">Validation</a></li>
63  """ % self.top_url
64 
65  breadcrumb = self.top_url
66  for url_bit in url_trail:
67  if url_bit == "":
68  continue
69  breadcrumb = "/".join( (breadcrumb, url_bit) )
70  breadcrumb_html += '<li>'
71  # note that there's no index page in the DATASET_COMPARISON_DIRNAME itself
72  if url_bit != url_trail[-1] and url_bit != PathTools.DATASET_COMPARISON_DIRNAME:
73  breadcrumb_html += '<a href="%s">' % breadcrumb
74  breadcrumb_html += url_bit
75  if not url_bit == url_trail[-1]:
76  breadcrumb_html += '</a>'
77  breadcrumb_html += '</li>\n'
78 
79  self.AddHTML("<!--BREADCRUMB_HOOK-->", breadcrumb_html)
80 
81 
def AddHTML(self, pattern, replacement, destructive=False)
Definition: Pages.py:43
def generic.views.Pages.BasePage.AddContent (   self)
inherited
Hook for child classes to add their custom content.  Override as desired. 

Definition at line 82 of file Pages.py.

82  def AddContent(self):
83  """ Hook for child classes to add their custom content. Override as desired. """
84  pass
85 
def generic.views.Pages.ValidationPageIndex.AddContent (   self,
  validation_name,
  dataset_dirs,
  comparison_dirs 
)

Definition at line 196 of file Pages.py.

References generic.views.Pages.BasePage.AddBreadcrumb(), generic.views.Pages.BasePage.AddHTML(), generic.views.Pages.BasePage.AddStaticContentLinks(), generic.views.Pages.BasePage.AddTitle(), generic.controllers.MakePages.PageMaker.base_url, and generic.views.Pages.BasePage.base_url.

196  def AddContent(self, validation_name, dataset_dirs, comparison_dirs):
197  self.AddStaticContentLinks()
198  self.AddTitle()
199  self.AddBreadcrumb()
200 
201  html = \
202  """
203  <div class="col-lg-12">
204  <h1 class="page-header">Validation: %(name)s</h1>
205  """ % {"name": validation_name}
206 
207  # Make the individual dataset links
208  html += \
209  """
210  <div class="page-header"><h2>Plots sorted by dataset</h2></div>
211  <div>
212  <ul>
213  """
214  for dataset_info in dataset_dirs:
215  line = """<li><a href="%(base_url)s/%(dataset)s">%(dataset)s</a></li>""" % { "base_url": self.base_url, "dataset": dataset_info.name}
216 
217  html += line
218 
219  html += \
220  """
221  </ul>
222  </div>
223  """
224 
225  # and now the comparisons
226  html += \
227  """
228  <div class="page-header"><h2>Dataset comparisons</h2></div>
229  <ul>
230  """
231  for comparison_dir_info in comparison_dirs:
232  comparison_datasets = sorted(comparison_dir_info.name.split("|")) # yep, that's a pipe character.
233 
234  links = \
235  """
236  <li><a href="%(base_url)s/%(comp_topdir)s/%(comp_subdir)s">%(comp_datasets)s</a>
237  """
238  if len(comparison_datasets) == 2:
239  links += """ (<a href="%(base_url)s/%(comp_topdir)s/%(comp_subdir)s/%(stat_pagename)s.html">comparisons statistics</a>)"""
240 
241  links += "</li>"
242 
243  links %= {
244  "base_url": self.base_url,
245  "comp_topdir": PathTools.DATASET_COMPARISON_DIRNAME,
246  "comp_subdir": comparison_dir_info.name,
247  "comp_datasets": ", ".join(comparison_datasets),
248  "stat_pagename": PathTools.STAT_PAGE_NAME,
249  }
250  html += links
251  html += \
252  """
253  </ul>
254  """
255 
256 
257  self.AddHTML("<!--BODY_HOOK-->",html)
258 
def AddContent(self, validation_name, dataset_dirs, comparison_dirs)
Definition: Pages.py:196
def AddStaticContentLinks(self, additional_css=[], additional_js=[], insert_plot_js=False)
Definition: Pages.py:86
def AddHTML(self, pattern, replacement, destructive=False)
Definition: Pages.py:43
def generic.views.Pages.BasePage.AddHTML (   self,
  pattern,
  replacement,
  destructive = False 
)
inherited
def generic.views.Pages.BasePage.AddNavbarDropdowns (   self,
  info,
  dropdowns 
)
inherited

Definition at line 130 of file Pages.py.

References generic.views.Pages.BasePage.AddHTML(), and HTMLView.HTMLView.url_base.

130  def AddNavbarDropdowns(self, info, dropdowns):
131  plot_groups = dropdowns[info[0]]
132  plot_groups.sort()
133  for plot_group in plot_groups:
134  if plot_group == info[1]:
135  suffix = ' class="active"'
136  else:
137  suffix = ''
138  html = '<li%s><a href="%s/%s/%s">%s</a></li>'%(suffix, self.url_base, info[0], plot_group.replace(" ","_")+".html", plot_group)
139  self.AddHTML("<!--NAVBAR_DATASET_HOOK-->", html)
140 
def AddHTML(self, pattern, replacement, destructive=False)
Definition: Pages.py:43
def AddNavbarDropdowns(self, info, dropdowns)
Definition: Pages.py:130
def generic.views.Pages.BasePage.AddNavbarHook (   self)
inherited

Definition at line 116 of file Pages.py.

References generic.views.Pages.BasePage.AddHTML().

116  def AddNavbarHook(self):
117  html = \
118  """
119  <ul class="nav navbar-nav navbar-right">
120  <li class="dropdown">
121  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Datasets <span class="caret"></span></a>
122  <ul class="dropdown-menu" role="menu">
123  <!--NAVBAR_DATASET_HOOK-->
124  </ul>
125  </li>
126  </ul>
127  """
128  self.AddHTML("<!--NAVBAR_HOOK-->", html)
129 
def AddHTML(self, pattern, replacement, destructive=False)
Definition: Pages.py:43
def generic.views.Pages.BasePage.AddSidebarHook (   self)
inherited

Definition at line 141 of file Pages.py.

References generic.views.Pages.BasePage.AddHTML().

Referenced by generic.views.Pages.PlotPage.AddContent().

141  def AddSidebarHook(self):
142  self.AddHTML("<!--FOOTER_HOOK-->", "", destructive=True)
143  html = \
144  """
145  <div class="col-sm-3 col-md-2 sidebar">
146  <!--SIDEBAR_HOOK-->
147  </div> <!-- end of side bar -->
148  <div class="col-sm-offset-3 col-md-10 col-md-offset-2 main">
149  <!--MODAL_HOOK-->
150  <!--BODY_HOOK-->
151  </div> <!-- end of main body -->
152  """
153  self.AddHTML("<!--BODY_HOOK-->", html, destructive=True)
154 
def AddHTML(self, pattern, replacement, destructive=False)
Definition: Pages.py:43
def generic.views.Pages.BasePage.AddSidebarSection (   self,
  category 
)
inherited

Definition at line 155 of file Pages.py.

References generic.views.Pages.BasePage.AddHTML(), generic.views.Pages.BasePage.sidebar_index, and HTMLView.HTMLView.sidebar_index.

Referenced by generic.views.Pages.PlotPage.AddContent().

155  def AddSidebarSection(self, category):
156  self.sidebar_index += 1
157  title = \
158  """
159  <h4>%s</h4>
160  <!--SIDEBAR_SECTION_%i_HOOK-->
161  <hr>
162  """%(category, self.sidebar_index)
163  self.AddHTML("<!--SIDEBAR_HOOK-->",title)
164 
def AddSidebarSection(self, category)
Definition: Pages.py:155
def AddHTML(self, pattern, replacement, destructive=False)
Definition: Pages.py:43
def generic.views.Pages.BasePage.AddStaticContentLinks (   self,
  additional_css = [],
  additional_js = [],
  insert_plot_js = False 
)
inherited

Definition at line 86 of file Pages.py.

References generic.views.Pages.BasePage.AddHTML(), generic.controllers.MakePages.PageMaker.static_url, and generic.views.Pages.BasePage.static_url.

Referenced by generic.views.Pages.FrontPage.AddContent(), generic.views.Pages.ValidationPageIndex.AddContent(), generic.views.Pages.PlotPage.AddContent(), and generic.views.Pages.ComparisonTablePage.AddContent().

86  def AddStaticContentLinks(self, additional_css=[], additional_js=[], insert_plot_js=False):
87  css_links = ["%(static_url)s/bootstrap.css", "%(static_url)s/dashboard.css",]
88  css_links += additional_css
89  for css_link in css_links:
90  css_link %= {"static_url": self.static_url}
91  self.AddHTML("<!--CSS_HOOK-->", """<link href="%(link)s" rel="stylesheet"> \n""" % {"link" : css_link} )
92 
93  html = ""
94  if insert_plot_js:
95  html += \
96  """
97  <script>
98  var VIEW = {};
99  VIEW.plot_selections = {};
100  var DATA = {}
101  DATA.statistics = {};
102  DATA.comparison_statistics = {};
103  // JS_HOOK
104 
105  </script>
106  <script src="http://nusoft.fnal.gov/nova/production/static/d3.v3.min.js"></script>
107  <script src="%(static_url)s/plot_page.js"></script>
108  """ % {"static_url": self.static_url}
109 
110  for js_link in additional_js:
111  js_link %= {"static_url": self.static_url}
112  html += '<script src="%(link)s"></script>\n' % {"link": js_link}
113 
114  self.AddHTML("<!--JS_HOOK-->", html)
115 
def AddStaticContentLinks(self, additional_css=[], additional_js=[], insert_plot_js=False)
Definition: Pages.py:86
def AddHTML(self, pattern, replacement, destructive=False)
Definition: Pages.py:43
def generic.views.Pages.BasePage.AddTitle (   self)
inherited

Definition at line 165 of file Pages.py.

References generic.views.Pages.BasePage.AddHTML(), and generic.views.Pages.BasePage.GetURLTrail().

Referenced by generic.views.Pages.FrontPage.AddContent(), generic.views.Pages.ValidationPageIndex.AddContent(), generic.views.Pages.PlotPage.AddContent(), and generic.views.Pages.ComparisonTablePage.AddContent().

165  def AddTitle(self):
166  url_trail = self.GetURLTrail()
167 
168  self.AddHTML("<!--TITLE_HOOK -->", " | ".join(reversed(url_trail)), destructive=True)
169 
def AddHTML(self, pattern, replacement, destructive=False)
Definition: Pages.py:43
def generic.views.Pages.BasePage.GetHTML (   self)
inherited

Definition at line 47 of file Pages.py.

References generic.views.Pages.BasePage.html.

47  def GetHTML(self):
48  return self.html
49 
50 
def generic.views.Pages.BasePage.GetURLTrail (   self)
inherited

Definition at line 53 of file Pages.py.

References split(), and generic.views.Pages.BasePage.top_url.

Referenced by generic.views.Pages.BasePage.AddBreadcrumb(), and generic.views.Pages.BasePage.AddTitle().

53  def GetURLTrail(self):
54  url = self.base_url.replace(self.top_url, "")
55  return url.strip("/").split("/")
56 
void split(double tt, double *fr)

Member Data Documentation

generic.views.Pages.BasePage.base_url
inherited
generic.views.Pages.BasePage.html
inherited
char object::name
inherited
short int object::number
inherited

Definition at line 115 of file novas.h.

generic.views.Pages.BasePage.sidebar_index
inherited
cat_entry object::star
inherited

Definition at line 117 of file novas.h.

generic.views.Pages.BasePage.static_url
inherited

Definition at line 35 of file Pages.py.

Referenced by generic.views.Pages.BasePage.AddStaticContentLinks().

generic.views.Pages.BasePage.TEMPLATE_PAGE = os.path.join(os.path.dirname(__file__), "template.html")
staticinherited

Definition at line 30 of file Pages.py.

generic.views.Pages.BasePage.top_url
inherited
short int object::type
inherited

Definition at line 114 of file novas.h.


The documentation for this class was generated from the following file: