diff --git a/src/plugins/webreport/WebCal.py b/src/plugins/webreport/WebCal.py index 687a4b61d..48ec8768c 100644 --- a/src/plugins/webreport/WebCal.py +++ b/src/plugins/webreport/WebCal.py @@ -319,8 +319,13 @@ class WebCalReport(Report): # copy Navigation Menu Layout if Blue or Visually is being used if CSS[self.css]["navigation"]: - fname = CSS["Horizontal-Menus"]["filename"] - self.copy_file(fname, "narrative-menus.css", "styles") + + # if there are multiple years, add Horizontal else add Fade... + if self.multiyear: + fname = CSS["Horizontal-Menus"]["filename"] + else: + fname = CSS["Fade-Menus"]["filename"] + self.copy_file(fname, "calendar-menus.css", "styles") # copy print stylesheet fname = CSS["Print-Default"]["filename"] @@ -385,11 +390,23 @@ class WebCalReport(Report): # Header contants xmllang = xml_lang() - _META1 = 'name="generator" content="%s %s %s"' % \ - (const.PROGRAM_NAME, const.VERSION, const.URL_HOMEPAGE) - _META2 = 'name="author" content="%s"' % self.author + _META1 = 'name ="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1"' + _META2 = 'name ="apple-mobile-web-app-capable" content="yes"' + _META3 = 'name="generator" content="%s %s %s"' % ( + const.PROGRAM_NAME, const.VERSION, const.URL_HOMEPAGE) + _META4 = 'name="author" content="%s"' % self.author - page, head, body = Html.page(title, self.encoding, xmllang) + # create additional meta tags + meta = Html("meta", attr = _META1) + ( + Html("meta", attr = _META2, indent = False), + Html("meta", attr = _META3, indent =False), + Html("meta", attr = _META4, indent = False) + ) + + # begin each html page... + page, head, body = Html.page(title, + self.encoding, + xmllang) # add body id tag if not None if body_id is not None: @@ -401,54 +418,45 @@ class WebCalReport(Report): # _CALENDARSCREEN stylesheet fname2 = "/".join(subdirs + ["styles", _CALENDARSCREEN]) - # create additional meta tags - meta = Html("meta", attr = _META1) + ( - Html("meta", attr = _META2, indent = False) - ) - # links for GRAMPS favicon and stylesheets links = Html("link", rel = 'shortcut icon', href = fname1, type = "image/x-icon") + ( - Html("link",rel = "stylesheet", href = fname2, type = "text/css", media = "screen", indent = False) + Html("link",href = fname2, type = "text/css", media = "screen", rel = "stylesheet", indent = False) + ) + + # add horizontal menu if css == Blue or Visually because there is no menus? + if CSS[self.css]["navigation"]: + fname = "/".join(subdirs + ["styles", "calendar-menus.css"]) + links.extend( + Html("link", href = fname, type = "text/css", media = "screen", rel = "stylesheet", indent = False) ) # add printer stylesheet to webcalendar() and one_day() only if add_print: fname = "/".join(subdirs + ["styles", _CALENDARPRINT]) - links += Html("link",rel = "stylesheet", href = fname,type = "text/css", media = "print", indent = False) - - # add horizontal menu if css == Blue or Visually because there is no menus? - if CSS[self.css]["navigation"]: - - # Link to Navigation Menus stylesheet - fname = "/".join(subdirs + ["styles", "narrative-menus.css"]) - links.extend( - Html("link", href =fname, type ="text/css", media ="screen", rel ="stylesheet") + links.extend( + Html("link",href = fname,type = "text/css", media = "print", rel = "stylesheet", indent = False) ) # add meta tags and links to head section head += (meta, links) - # start header division section - header = Html("div", id = "header") + ( + # start header section and page title... + with Html("div", id = "header", role = "Title-n-Navigation") as header: + header += Html("h1", title, id = "SiteTitle", inline = True) - # page title - Html("h1", title, id = "SiteTitle", inline = True) - ) - body += header + # Created for ? + msg = None + if self.author and self.email: + msg = _('Created for %(author)s') % {'email' : self.email, + 'author' : self.author} + elif self.author: + msg = _('Created for %(author)s') % {'author' : self.author} - # Created for ? - msg = None - if self.author and self.email: - msg = _('Created for %(author)s') % {'email' : self.email, - 'author' : self.author} - elif self.author: - msg = _('Created for %(author)s') % {'author' : self.author} + if msg: + header += Html("p", msg, id = "CreatorInfo") - if msg is not None: - header += Html("p", msg, id = "CreatorInfo") - - # return to its callers; either webcalendar(), year_glance(), or one_day() + body += header return page, body def year_navigation(self, nr_up, currentsection): @@ -518,50 +526,55 @@ class WebCalReport(Report): # Add a link for year_glance() if requested navs.append(('fullyearlinked', _('Year Glance'), self.fullyear)) + # remove menu items if they are not True + navs = [(u, n) for u, n, c in navs if c] + # begin month subnavigation with Html("div", class_ = "wrapper", id = "nav", role = "navigation") as navigation: - unordered = Html("ul") + with Html("div", class_ = "container") as container: - navs = [(u, n) for u, n, c in navs if c] - for url_fname, nav_text in navs: + unordered = Html("ul", class_ = "menu") - # Note. We use '/' here because it is a URL, not a OS dependent pathname - # need to leave home link alone, so look for it ... - url = url_fname - add_subdirs = True - if not (url.startswith('http:') or url.startswith('/')): - add_subdirs = not any(url.endswith(ext) - for ext in _WEB_EXT) + for url_fname, nav_text in navs: + + # Note. We use '/' here because it is a URL, not a OS dependent pathname + # need to leave home link alone, so look for it ... + url = url_fname + add_subdirs = True + if not (url.startswith('http:') or url.startswith('/')): + add_subdirs = not any(url.endswith(ext) + for ext in _WEB_EXT) - # whether to add subdirs or not??? - if add_subdirs: - subdirs = ['..'] * nr_up - subdirs.append(str(year)) - url = '/'.join(subdirs + [url_fname]) + # whether to add subdirs or not??? + if add_subdirs: + subdirs = ['..'] * nr_up + subdirs.append(str(year)) + url = '/'.join(subdirs + [url_fname]) - if not _has_webpage_extension(url): - url += self.ext + if not _has_webpage_extension(url): + url += self.ext - # Figure out if we need