Removed dump_source_references() from NarrativeWeb, updating of WebCal still in place. Updates to stylesheet.

svn: r13239
This commit is contained in:
Rob G. Healey
2009-09-23 20:31:21 +00:00
parent 9530ee3599
commit c022ca4233
3 changed files with 363 additions and 387 deletions

View File

@@ -32,6 +32,7 @@ see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
Color Palette Color Palette
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
brown darkest #453619
brown dark #542 brown dark #542
brown light #C1B398 brown light #C1B398
gray #696969 gray #696969
@@ -49,10 +50,18 @@ Females Web_Gender_Female.png
# $Id$ # $Id$
NarrativeWeb Styles
--------------------------------------------------------------------------------------------
General Elements General Elements
----------------------------------------------------- */ ----------------------------------------------------- */
body {
body#NarrativeWeb {
color: #000;
margin: 0;
padding: 130px 0px 0px 54px;
background-color: #FFF; background-color: #FFF;
font-family: Arial, sans, sans-serif, Helvetica;
} }
div { div {
margin:0; margin:0;
@@ -127,7 +136,7 @@ h4 {
color: #FFF; color: #FFF;
margin-top: .3cm; margin-top: .3cm;
padding:.2em 0 .2em 20px; padding:.2em 0 .2em 20px;
background-color: #000; background-color: #453619;
border-bottom:solid 4px #5D835F; border-bottom:solid 4px #5D835F;
} }
h5, h6 { h5, h6 {
@@ -135,17 +144,6 @@ h5, h6 {
font-style:italic; font-style:italic;
margin:1.3em 0 .5em 1em; margin:1.3em 0 .5em 1em;
} }
a {
color: #542;
}
a:visited {
color: #542;
}
a:hover {
color: #000;
background-color: #C1B398;
text-decoration:underline;
}
p#description { p#description {
max-width:800px; max-width:800px;
margin:0; margin:0;
@@ -155,6 +153,10 @@ p#description:first-letter {
color: #228A22; color: #228A22;
font-size:xx-large; font-size:xx-large;
} }
p a {
color: #FFF;
text-decoration:underline;
}
sup { sup {
line-height:0; line-height:0;
} }
@@ -171,6 +173,17 @@ ol li a {
ol li a:hover { ol li a:hover {
text-decoration:underline; text-decoration:underline;
} }
a {
color: #542;
}
a:visited {
color: #542;
}
a:hover {
color: #000;
background-color: #C1B398;
text-decoration:underline;
}
span.preposition { span.preposition {
padding-left:1em; padding-left:1em;
padding-right:1em; padding-right:1em;
@@ -196,10 +209,9 @@ span.preposition {
#SiteTitle { #SiteTitle {
margin:0; margin:0;
padding:.5em 0 0.5em 10px; padding:.5em 0 0.5em 10px;
font-size: 36px; font-size: 40px;
font-weight: bold;
color: #FFF; color: #FFF;
font-style: italic; font-style:italic;
} }
p#user_header { p#user_header {
font-size:1.3em; font-size:1.3em;
@@ -263,39 +275,54 @@ p#user_header {
padding:0; padding:0;
} }
/* Alphabet Navigation
----------------------------------------------------- */
#alphabet {
position: fixed;
top: 136px;
left: 4px;
width: 50px;
height: 800px;
overflow: auto;
background-color :#6AF364;
border-width: 2px 4px 0px 4px;
border-style: solid;
border-color: #5D835F;
}
#alphabet ul {
display: inline;
list-style: none;
margin: 0;
}
#alphabet ul li:first-child {
margin-top: 10px;
}
#alphabet ul li {
font: bold 14px/100% sans;
color: #000;
padding: 6px 10px 6px 16px;
margin:0;
float: left;
border-bottom: solid 2px #000;
}
#alphabet ul li a {
text-decoration: none;
}
#alphabet ul li a:hover {
display: block;
background-color: #C1B398;
}
/* Navigation /* Navigation
----------------------------------------------------- */ ----------------------------------------------------- */
div#nnavigation, div#subnavigation { #navigation, #subnavigation {
width: 100%; width: 100%;
height: 32px;
} }
body#NarrativeWeb #navigation { body#NarrativeWeb #navigation {
position: fixed; position: fixed;
top: 104px; top: 104px;
left: 0px; left: 0px;
} }
body#WebCal #navigation {
position: fixed;
top: 140px;
left: 24px;
right: 20px;
}
body#fullyearlinked #navigation, body#OneDay #navigation {
position: fixed;
top: 140px;
left: 0px;
}
body#WebCal #subnavigation {
position: fixed;
top: 98px;
left: 24px;
right: 20px;
}
body#fullyearlinked #subnavigation, body#OneDay #subnavigation {
position: fixed;
top: 98px;
left: 0px;
}
#navigation ul, #subnavigation ul { #navigation ul, #subnavigation ul {
list-style:none; list-style:none;
min-width:770px; min-width:770px;
@@ -308,6 +335,9 @@ body#fullyearlinked #subnavigation, body#OneDay #subnavigation {
margin:0; margin:0;
float:left; float:left;
} }
body#WebCal div#navigation ul li a {
color: #FFF;
}
#navigation ul li a, #subnavigation ul li a { #navigation ul li a, #subnavigation ul li a {
padding: 6px 10px 8px 1px; padding: 6px 10px 8px 1px;
display:block; display:block;
@@ -317,13 +347,6 @@ body#fullyearlinked #subnavigation, body#OneDay #subnavigation {
text-decoration:none; text-decoration:none;
margin:0; margin:0;
} }
body#WebCal #navigation ul li a, body#fullyearlinked #navigation ul li a,
body#WebCal #subnavigation ul li a {
color: #FFF;
}
body#fullyearlinked #subnavigation ul li a {
color: #000;
}
#navigation ul li a:hover, #subnavigation ul li a:hover { #navigation ul li a:hover, #subnavigation ul li a:hover {
margin-top: -6px; margin-top: -6px;
padding: 11px 10px 12px 1px; padding: 11px 10px 12px 1px;
@@ -356,13 +379,12 @@ table.infolist {
font-size: 12px; font-size: 12px;
} }
table.infolist thead tr th { table.infolist thead tr th {
font:bold 1.1em/1.2em serif; font:normal 1.1em/1.2em serif;
text-transform: uppercase;
color: #000; color: #000;
margin:0; margin:0;
padding:.2em 10px; padding:.2em 10px;
background-color: #6AF364; background-color: #6AF364;
border: solid 1px #000; border: solid 1px #5D835F;
} }
table.infolist thead tr th a { table.infolist thead tr th a {
background-color: #6AF364; background-color: #6AF364;
@@ -382,7 +404,7 @@ table.infolist tr td a {
color: #000; color: #000;
} }
table.infolist tr.BeginLetter td, table.infolist tr.BeginSurname td { table.infolist tr.BeginLetter td, table.infolist tr.BeginSurname td {
border-top:solid 1px #000; border-top:solid 1px #453619;
} }
table.infolist tr td.ColumnLetter { table.infolist tr td.ColumnLetter {
width:3%; width:3%;
@@ -426,55 +448,6 @@ table.infolist tbody tr td.ColumnParents span.mother:before {
content:"+ "; content:"+ ";
} }
/*
NarrativeWeb
----------------------------------------------------- */
body#NarrativeWeb {
color: #000;
margin: 0;
padding: 160px 0px 0px 4px;
background-color: #FFF;
font-family: Arial, sans, sans-serif, Helvetica;
}
/* Alphabet Navigation
----------------------------------------------------- */
div#alphabet {
position: fixed;
top: 136px;
left: 4px;
width: 100%;
height: 32px;
overflow: auto;
border-width: 2px 4px 2px 4px;
border-style: solid;
border-color: #5D835F;
background-color: #6AF364;
}
div#alphabet ul {
display: block;
list-style: none;
margin: 0;
padding: 0px 0px 0px 20px;
}
div#alphabet ul li {
display: block;
padding: 6px 0px 6px 16px;
font: bold 16px/100% sans;
margin:0;
float: left;
}
div#alphabet ul li:before {
content: "| ";
}
div#alphabet ul li a {
text-decoration: none;
}
div#alphabet ul li a:hover {
padding: 20px 8px 10px 4px;
background-color: #C1B398;
}
/* Surnames /* Surnames
----------------------------------------------------- */ ----------------------------------------------------- */
#Surnames { } #Surnames { }
@@ -534,30 +507,30 @@ table.surnamelist tbody tr td.ColumnSurname:hover,
table.surname { table.surname {
border-bottom:solid 1px #000; border-bottom:solid 1px #000;
} }
table.surname tbody tr td {
border-bottom:dashed 1px #000;
}
table.surname thead tr th.ColumnName { table.surname thead tr th.ColumnName {
width:20%; width:20%;
padding-left:20px; padding-left:20px;
} }
table.surname tbody tr td {
border-bottom: dashed 1px #000;
background-color: #D8F3D6;
}
table.surname tbody tr td a {
display: block;
padding: .6em 10px .6em 20px;
background-color: #FFF;
}
table.surname tbody tr td a:hover {
background-color: #C1B398;
}
table.surname tbody tr td.ColumnName { table.surname tbody tr td.ColumnName {
background-color: #FFF;
width:20%; width:20%;
padding:0;
}
table.surname tbody tr td.ColumnName a {
display:block;
padding:.6em 10px .6em 20px;
} }
table.surname tbody tr td.ColumnName a span.grampsid { } table.surname tbody tr td.ColumnName a span.grampsid { }
table.surname tbody tr td.ColumnName:hover { table.surname tbody tr td.ColumnName:hover {
background-color: #C1B398; background-color: #C1B398;
} }
table.surname tbody tr td.ColumnPartner {
background-color: #FFF;
}
table.surname thead tr th.ColumnParents, table.surname thead tr th.ColumnParents,
table.surname tbody tr td.ColumnParents { table.surname tbody tr td.ColumnParents {
width:25%; width:25%;
@@ -568,19 +541,12 @@ table.surname tbody tr td.ColumnParents {
#Individuals { } #Individuals { }
#Individuals table.individuallist { #Individuals table.individuallist {
border-bottom:solid 1px #5D835F; border-bottom:solid 1px #453619;
} }
#Individuals table.individuallist tbody tr td { #Individuals table.individuallist tbody tr td {
border-bottom: dashed 1px #000; border-bottom:dashed 1px #453619;
background-color: #D8F3D6;
}
#Individuals table.individuallist tbody tr td a {
background-color: #FFF;
display: block;
padding: .6em 10px;
} }
#Individuals table.individuallist tbody tr td a:hover { #Individuals table.individuallist tbody tr td a:hover {
background-color: #C1B398;
text-decoration:none; text-decoration:none;
} }
table.individuallist tbody tr td.ColumnSurname a:hover, table.individuallist tbody tr td.ColumnSurname a:hover,
@@ -591,9 +557,25 @@ table.individuallist tbody tr td.ColumnSurname a:active {
} }
table.individuallist tbody tr td.ColumnName { table.individuallist tbody tr td.ColumnName {
padding:0; padding:0;
background-color: #FFF;
} }
table.individuallist tbody tr td.ColumnName a {
display:block;
padding:.6em 10px;
vertical-align:middle;
}
table.individuallist tbody tr td.ColumnName a:hover { }
table.individuallist tbody tr td.ColumnPartner { table.individuallist tbody tr td.ColumnPartner {
padding:0; padding:0;
background-color: #FFF;
}
table.individuallist tbody tr td.ColumnPartner a {
display:block;
padding:.6em 10px;
vertical-align:middle;
}
table.individuallist tbody tr td.ColumnPartner a:hover {
} }
#Individuals div table.infolist tr td p { #Individuals div table.infolist tr td p {
font:normal .9em/1.2em sans-serif; font:normal .9em/1.2em sans-serif;
@@ -603,6 +585,8 @@ table.individuallist tbody tr td.ColumnPartner {
display:inline; display:inline;
} }
/* IndividualDetail
------------------------------------------------------ */
#IndividualDetail { } #IndividualDetail { }
#IndividualDetail div table.infolist tr td { #IndividualDetail div table.infolist tr td {
@@ -649,39 +633,31 @@ table.eventlist tbody tr td {
background-color: #D8F3D6; background-color: #D8F3D6;
padding: 4px 0px 4px 0px; padding: 4px 0px 4px 0px;
} }
table.eventlist tbody tr td a {
display: block;
padding: .3em 30px .4em 0px;
}
table.eventlist tbody tr td a:hover {
background-color: #C1B398;
}
table.eventlist tbody tr td.ColumnType { table.eventlist tbody tr td.ColumnType {
background-color: #FFF;
border-top: solid 1px #5D835F; border-top: solid 1px #5D835F;
width: 20%; width: 20%;
} }
table.eventlist tbody tr td.ColumnType a {
background-color: #FFF;
}
table.eventlist tbody tr td.ColumnDate { table.eventlist tbody tr td.ColumnDate {
width: 16%; width: 16%;
} }
table.eventlist tbody tr td.ColumnPlace { table.eventlist tbody tr td.ColumnPlace {
background-color: #FFF;
width: 35%; width: 35%;
} }
table.eventlist tbody tr td.ColumnSources { table.eventlist tbody tr td.ColumnSources {
background-color: #FFF;
width: 12%; width: 12%;
} }
table.eventlist tbody tr td.ColumnSources sup {
margin-top: 1em;
}
table.eventlist tbody tr td.ColumnNotes { table.eventlist tbody tr td.ColumnNotes {
width: 25%; width: 25%;
} }
table.eventlist tbody tr td.ColumnPerson { table.eventlist tbody tr td.ColumnPerson {
background-color: #FFF;
width: 35%; width: 35%;
} }
table.eventlist tbody tr td.ColumnPartner { table.eventlist tbody tr td.ColumnPartner {
background-color: #FFF;
width: 35%; width: 35%;
} }
div#EventDetail h3 { div#EventDetail h3 {
@@ -730,7 +706,7 @@ div#EventDetail table.eventlist tbody tr td.ColumnType {
#GalleryNav a { #GalleryNav a {
font-weight:bold; font-weight:bold;
text-decoration:none; text-decoration:none;
border:solid 1px #5D835F; border:solid 1px #453619;
} }
#GalleryNav a:hover { } #GalleryNav a:hover { }
@@ -755,7 +731,7 @@ div#EventDetail table.eventlist tbody tr td.ColumnType {
position:relative; position:relative;
overflow:hidden; overflow:hidden;
text-align:center; text-align:center;
border:solid 1px #5D835F; border:solid 1px #453619;
} }
#GalleryDisplay img { #GalleryDisplay img {
margin:0 auto; margin:0 auto;
@@ -794,7 +770,7 @@ table.exiflist tr td.ColumnValue {
width:500px; width:500px;
margin:0 auto; margin:0 auto;
padding:3em; padding:3em;
border:double 4px #5D835F; border:double 4px #453619;
} }
#Contact #summaryarea img { #Contact #summaryarea img {
float:right; float:right;
@@ -987,16 +963,17 @@ div#events h4 {
padding-left:20px; padding-left:20px;
} }
#IndividualDetail div#events table.infolist tbody tr td { #IndividualDetail div#events table.infolist tbody tr td {
padding: .4em 0 .8em 0; padding-top:.4em;
padding-bottom:.8em;
} }
#IndividualDetail div#events table.infolist tbody tr td.ColumnAttribute { #IndividualDetail div#events table.infolist tbody tr td.ColumnAttribute {
border-bottom:solid 1px #5D835F; border-bottom:solid 1px #453619;
} }
#IndividualDetail div#events table.infolist tbody tr td.ColumnValue { #IndividualDetail div#events table.infolist tbody tr td.ColumnValue {
border-bottom:solid 1px #5D835F; border-bottom:solid 1px #000;
} }
table.infolist tbody tr td.ColumnValue p { table.infolist tbody tr td.ColumnValue p {
font-family: sans-serif; font-family:sans-serif;
color: #696969; color: #696969;
margin:.2em 0 0 2em; margin:.2em 0 0 2em;
} }
@@ -1313,7 +1290,7 @@ div#pedigree {
margin-top:-25px; margin-top:-25px;
margin-left:16px; margin-left:16px;
background-color: #FFF; background-color: #FFF;
border:solid 1px #5D835F; border:solid 1px #453619;
} }
#treeContainer div.boxbg a:hover { #treeContainer div.boxbg a:hover {
position:relative; position:relative;
@@ -1324,7 +1301,7 @@ div#pedigree {
width:190px; width:190px;
margin-left:-20px; margin-left:-20px;
padding:10px 25px 12px 25px; padding:10px 25px 12px 25px;
border:solid 2px #5D835F; border:solid 2px #453619;
} }
#treeContainer div.boxbg a:hover, #treeContainer div.boxbg a:hover,
#treeContainer div.AncCol3 a:hover, #treeContainer div.AncCol3 a:hover,
@@ -1388,7 +1365,7 @@ div#pedigree {
height:1px; height:1px;
margin:0 0 0 16px; margin:0 0 0 16px;
padding:0; padding:0;
background-color: #000; background-color: #453619;
} }
#tree div div.bhline { #tree div div.bhline {
position:absolute; position:absolute;
@@ -1396,7 +1373,7 @@ div#pedigree {
width:1px; width:1px;
margin:0 0 0 16px; margin:0 0 0 16px;
padding:0; padding:0;
background-color: #000; background-color: #453619;
} }
.ghline, .gvline { .ghline, .gvline {
display:none; display:none;
@@ -1406,7 +1383,7 @@ div#pedigree {
-------------------------------------------------------------------------------------------- */ -------------------------------------------------------------------------------------------- */
/* Calendar : General */ /* Calendar : General */
body#WebCal { body#WebCal {
padding: 170px 14px 0px 14px; padding: 98px 14px 0px 14px;
background-color: #542; background-color: #542;
} }
.calendar { .calendar {
@@ -1453,13 +1430,13 @@ body#WebCal {
font-style:italic; font-style:italic;
color: #000; color: #000;
background-color: #6AF364; background-color: #6AF364;
border:solid 2px #5D835F; border:solid 2px #453619;
} }
.calendar tfoot tr td { .calendar tfoot tr td {
padding:.7em 5% 1em 5%; padding:.7em 5% 1em 5%;
border-top:solid 2px #000; border-top:solid 2px #000;
vertical-align:middle; vertical-align:middle;
color: #000; color: #453619;
background-color: #D8F3D6; background-color: #D8F3D6;
} }
@@ -1484,7 +1461,7 @@ body#WebCal {
padding:0; padding:0;
border-width:1px 0 0 1px; border-width:1px 0 0 1px;
border-style:solid; border-style:solid;
border-color: #5D835F; border-color: #453619;
} }
.calendar tbody tr td.weekday { .calendar tbody tr td.weekday {
background-color: #FFF; background-color: #FFF;
@@ -1493,13 +1470,13 @@ body#WebCal {
background-color: #D8F3D6; background-color: #D8F3D6;
} }
.calendar tbody tr td.saturday { .calendar tbody tr td.saturday {
border-right:solid 1px #5D835F; border-right:solid 1px #453619;
} }
.calendar tbody tr td.sunday { .calendar tbody tr td.sunday {
border-left:solid 1px #5D835F; border-left:solid 1px #453619;
} }
.calendar tbody tr td:first-child { .calendar tbody tr td:first-child {
border-left:solid 1px #5D835F; border-left:solid 1px #453619;
} }
.calendar tbody tr:first-child td { .calendar tbody tr:first-child td {
border-top:none; border-top:none;
@@ -1518,7 +1495,7 @@ body#WebCal {
width:92%; width:92%;
margin:0 4%; margin:0 4%;
padding:.2em 0 .3em 0; padding:.2em 0 .3em 0;
border-top:dashed 1px #000; border-top:dashed 1px #453619;
} }
.calendar tbody tr td ul li:first-child { .calendar tbody tr td ul li:first-child {
border:none; border:none;
@@ -1530,7 +1507,7 @@ body#WebCal {
color: #0A65B5; color: #0A65B5;
} }
.calendar tbody tr td ul li span.yearsmarried em { .calendar tbody tr td ul li span.yearsmarried em {
color: #000; color: #453619;
} }
.calendar tbody tr td.highlight { } .calendar tbody tr td.highlight { }
@@ -1550,7 +1527,7 @@ body#WebCal {
/* Calendar : Full Year */ /* Calendar : Full Year */
body#fullyearlinked { body#fullyearlinked {
padding: 170px 0px 0px 0px; padding: 98px 0px 0px 0px;
} }
body#fullyearlinked div.content { body#fullyearlinked div.content {
width:963px; width:963px;
@@ -1561,18 +1538,25 @@ body#fullyearlinked table.calendar {
float:left; float:left;
width:320px; width:320px;
height:18em; height:18em;
border:solid 1px #5D835F; border:solid 1px #000;
} }
body#fullyearlinked table.calendar thead tr th { body#fullyearlinked table.calendar thead tr th {
height:2em; height:2em;
border-width: 1px 1px 0px 0px;
border-color: #000;
text-align: center;
} }
body#fullyearlinked table.calendar thead tr th.monthName { body#fullyearlinked table.calendar thead tr th.monthName {
font-size:1.2em; font-size:1.2em;
padding:2px 0; padding:2px 0;
border-bottom: solid 1px #000;
} }
body#fullyearlinked table.calendar tbody tr td { body#fullyearlinked table.calendar tbody tr td {
height:3em; height:3em;
} }
body#fullyearlinked table.calendar tbody tr td.emptyDays {
background-color: #FFF;
}
body#fullyearlinked table.calendar tbody tr td.saturday { body#fullyearlinked table.calendar tbody tr td.saturday {
border-right:solid 2px #000; border-right:solid 2px #000;
} }

View File

@@ -630,33 +630,6 @@ class BasePage(object):
# return hyperlink to its callers # return hyperlink to its callers
return hyper return hyper
def dump_source_references(self, db, sourcelist):
""" Dump a list of source references """
ordered = Html('ol')
list = Html('li')
ordered += list
source_dict = {}
# Sort the sources
for handle in sourcelist:
# if source is not None, then add it?
source = db.get_source_from_handle(handle)
if source is not None:
key = source.get_title() + str(source.get_gramps_id())
source_dict[key] = (source, handle)
keys = sorted(source_dict, key=locale.strxfrm)
for cindex, key in enumerate(keys):
(source, handle) = source_dict[key]
source_title = source.get_title()
list += self.source_link(handle, title, cindex+1, source.gramps_id, True)
# return ordered list to its callers
return ordered
def dump_addresses(self, addrobj, showsrc=True): def dump_addresses(self, addrobj, showsrc=True):
""" """
will display an object's addresses, url list, note list, will display an object's addresses, url list, note list,
@@ -3255,7 +3228,6 @@ class IndividualPage(BasePage):
""" """
This class is used to write HTML for an individual. This class is used to write HTML for an individual.
""" """
gender_map = { gender_map = {
Person.MALE : _('male'), Person.MALE : _('male'),
Person.FEMALE : _('female'), Person.FEMALE : _('female'),
@@ -5093,7 +5065,6 @@ class NavWebReport(Report):
subdirs = ['..']*3 + subdirs subdirs = ['..']*3 + subdirs
return subdirs return subdirs
def build_path(self, subdir, fname, up=False): def build_path(self, subdir, fname, up=False):
""" """
Return the name of the subdirectory. Return the name of the subdirectory.

View File

@@ -34,7 +34,7 @@ Refactoring. This is an ongoing job until this plugin is in a better shape.
# python modules # python modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import os, codecs, shutil import os, codecs, shutil, re
import datetime, calendar import datetime, calendar
from gettext import gettext as _ from gettext import gettext as _
from gettext import ngettext from gettext import ngettext
@@ -59,7 +59,7 @@ from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_WEB, \
CSS_FILES CSS_FILES
from gen.plug.menu import BooleanOption, NumberOption, StringOption, \ from gen.plug.menu import BooleanOption, NumberOption, StringOption, \
EnumeratedListOption, FilterOption, PersonOption, \ EnumeratedListOption, FilterOption, PersonOption, \
DestinationOption DestinationOption, NoteOption
import GrampsLocale import GrampsLocale
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
from Utils import probably_alive, xml_lang, get_researcher from Utils import probably_alive, xml_lang, get_researcher
@@ -72,6 +72,9 @@ import libholiday
from libhtml import Html from libhtml import Html
from libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS from libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS
# import styled notes from
# src/plugins/lib/libhtmlbackend.py
from libhtmlbackend import HtmlBackend
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# constants # constants
@@ -100,6 +103,9 @@ class WebCalReport(Report):
Report.__init__(self, database, options) Report.__init__(self, database, options)
mgobn = lambda name:options.menu.get_option_by_name(name).get_value() mgobn = lambda name:options.menu.get_option_by_name(name).get_value()
# class to do conversion of styled notes to html markup
self._backend = HtmlBackend()
self.database = database self.database = database
self.options = options self.options = options
@@ -155,11 +161,68 @@ class WebCalReport(Report):
calendar.setfirstweekday(dow_gramps2iso[self.start_dow]) calendar.setfirstweekday(dow_gramps2iso[self.start_dow])
# --------------------------------------------------------------------------------------- def get_note_format(self, note):
# """
# Copy files to their destination will get the note from the database, and will return either the
# styled text or plain note
# --------------------------------------------------------------------------------------- """
# retrieve the body of the note
note_text = note.get()
# styled notes
htmlnotetext = self.styled_note(note.get_styledtext(),
note.get_format())
if htmlnotetext:
text = htmlnotetext
else:
text = Html('p', note_text)
# return text of the note to its callers
return text
#################################################
#
# Will produce styled notes for NarrativeWeb by using:
# src/plugins/lib/libhtmlbackend.py
#
#################################################
def styled_note(self, styledtext, format):
"""
styledtext : assumed a StyledText object to write
format : = 0 : Flowed, = 1 : Preformatted
style_name : name of the style to use for default presentation
"""
text = str(styledtext)
if not text:
return ''
s_tags = styledtext.get_tags()
#FIXME: following split should be regex to match \n\s*\n instead?
markuptext = self._backend.add_markup_from_styled(text, s_tags,
split='\n\n')
htmllist = Html("div", id="grampsstylednote")
if format == 1:
#preformatted, retain whitespace.
#so use \n\n for paragraph detection
#FIXME: following split should be regex to match \n\s*\n instead?
htmllist += Html('pre', indent=None, inline = True)
for line in markuptext.split('\n\n'):
htmllist += Html('p')
for realline in line.split('\n'):
htmllist += realline
htmllist += Html('br')
elif format == 0:
#flowed
#FIXME: following split should be regex to match \n\s*\n instead?
for line in markuptext.split('\n\n'):
htmllist += Html('p')
htmllist += line
return htmllist
def copy_file(self, from_fname, to_fname, to_dir=''): def copy_file(self, from_fname, to_fname, to_dir=''):
""" """
@@ -375,6 +438,7 @@ class WebCalReport(Report):
meta = Html("meta", attr = _META1) + ( meta = Html("meta", attr = _META1) + (
Html("meta", attr = _META2, indent=False) Html("meta", attr = _META2, indent=False)
) )
head += meta
# links for GRAMPS favicon and stylesheets # links for GRAMPS favicon and stylesheets
links = Html("link", rel='shortcut icon', href=fname1, links = Html("link", rel='shortcut icon', href=fname1,
@@ -382,97 +446,82 @@ class WebCalReport(Report):
Html("link",rel="stylesheet", href=fname2, type="text/css", media= "screen", Html("link",rel="stylesheet", href=fname2, type="text/css", media= "screen",
indent = False) indent = False)
) )
head += links
# add printer stylesheet to webcalendar() and one_day() only # add printer stylesheet to webcalendar() and one_day() only
if add_print: if add_print:
fname = os.path.join(subdirs, "styles", _CALENDARPRINT) fname = os.path.join(subdirs, "styles", _CALENDARPRINT)
links += Html("link",rel="stylesheet", href=fname,type="text/css", links += Html("link",rel="stylesheet", href=fname,type="text/css", media="print",
media="print",indent = False) indent = False)
# add additional meta tags and stylesheet links to head section
head += (meta, links)
# replace standard body element with custom one # replace standard body element with custom one
body.attr = 'id="%s"' % body_id body.attr = 'id="%s"' % body_id
# start header division section # start header division section
headerdiv = Html("div", id="header") + ( header = Html("div", id="header") + (
# page title # page title
Html("h1", title, id = "SiteTitle", inline = True) Html("h1", title, id = "SiteTitle", inline = True)
) )
body += header
# Created for ? # Created for ?
if self.author: msg = None
if self.email: if self.author and self.email:
msg = _('Created for <a href="mailto:%(email)s?' msg = _('Created for <a href="mailto:%(email)s?'
'subject=WebCal">%(author)s</a>') % {'email' : self.email, 'subject=WebCal">%(author)s</a>') % {'email' : self.email,
'author' : self.author} 'author' : self.author}
else: elif self.author:
msg = _('Created for %(author)s') % {'author' : self.author} msg = _('Created for %(author)s') % {'author' : self.author}
headerdiv += Html("p", msg, id="CreatorInfo")
# add header division to body if msg is not None:
body += headerdiv header += Html("p", msg, id="CreatorInfo")
# return to its caller; either webcalendar(), year_glance(), or one_day() # return to its caller; either webcalendar(), year_glance(), or one_day()
return page, body return page, body
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
#
# Creates year navigation, if multiyear # Creates year navigation, if multiyear
#
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
def year_navigation(self, nr_up, currentsection): def year_navigation(self, nr_up, currentsection):
""" """
This will create the year navigation menu bar This will create the year navigation menu bar for a total of seventeen (17) years
nr_up = number of directories up to reach root directory nr_up = number of directories up to reach root directory
currentsection = proper styling of this navigation bar currentsection = proper styling of this navigation bar
""" """
num_years = (self.end_year - self.start_year) # limit number of years to eighteen (18) years and only one row of years
cal_year = self.start_year nyears = ((self.end_year - self.start_year) + 1)
num_years = nyears if 0 < nyears < 19 else 18
# stylesheets other than "Web_Visually.css" will hold 22 years in a row # begin year division and begin unordered list
# otherwise, 18 years in a row with Html("div", id = "subnavigation") as section:
years_in_row = 22 if self.css is not 'Web_Visually.css' else 18 unordered = Html("ul")
section += unordered
# begin year division for cal_year in xrange(self.start_year, (self.start_year + num_years)):
with Html("div", id = "navigation") as section: url = ''
for row in xrange((num_years // years_in_row) + 1): # begin subdir level
subdirs = ['..'] * nr_up
subdirs.append(str(cal_year))
unordered = Html("ul") # each year will link to current month.
section += unordered # this will always need an extension added
full_month_name = get_full_month_name(self.today.get_month())
cols = 1 # Note. We use '/' here because it is a URL, not a OS dependent
while (cols <= years_in_row and cal_year <= self.end_year): # pathname.
url = '' url = '/'.join(subdirs + [full_month_name]) + self.ext
# begin subdir level # Figure out if we need <li class="CurrentSection"> or just plain <li>
subdirs = ['..'] * nr_up cs = str(cal_year) == currentsection and 'class="CurrentSection"' or ''
subdirs.append(str(cal_year)) unordered += Html("li", attr=cs, inline = True) + (
# each year will link to current month. # create hyperlink
# this will always need an extension added Html("a", str(cal_year), href = url, title = "Year %04d" % cal_year, inline = True)
full_month_name = get_full_month_name(self.today.get_month()) )
# Note. We use '/' here because it is a URL, not a OS dependent
# pathname.
url = '/'.join(subdirs + [full_month_name]) + self.ext
# Figure out if we need <li class="CurrentSection"> or just plain <li>
cs = str(cal_year) == currentsection and 'class="CurrentSection"' or ''
unordered += Html("li", attr=cs , inline = True) + (
# create hyperlink
Html("a", str(cal_year), href = url, title=str(cal_year), inline = True)
)
cols += 1
cal_year += 1
# return yearnav to its caller # return yearnav to its caller
return section return section
@@ -507,7 +556,7 @@ class WebCalReport(Report):
navs.append(('fullyearlinked', _('Year Glance'), self.fullyear)) navs.append(('fullyearlinked', _('Year Glance'), self.fullyear))
# begin month subnavigation # begin month subnavigation
with Html("div", id = "subnavigation") as section: with Html("div", id = "navigation") as section:
unordered = Html("ul") unordered = Html("ul")
section += unordered section += unordered
@@ -590,6 +639,33 @@ class WebCalReport(Report):
# We slice out the first empty element. # We slice out the first empty element.
day_names = GrampsLocale.long_days day_names = GrampsLocale.long_days
def __get_previous_month_day(year, month, day_col):
if month == 1:
prevmonth = calendar.monthcalendar(year - 1, 12)
else:
prevmonth = calendar.monthcalendar(year, month-1)
num_weeks = len(prevmonth)
lastweek_prevmonth = prevmonth[num_weeks - 1]
previous_month_day = lastweek_prevmonth[day_col]
# return previous month day number based on day_col
# day_col is based on range(0 - 6)
return previous_month_day
def __get_next_month_day(year, month, day_col):
if month == 12:
nextmonth = calendar.monthcalendar(year + 1, 1)
else:
nextmonth = calendar.monthcalendar(year, month + 1)
firstweek_nextmonth = nextmonth[0]
next_month_day = firstweek_nextmonth[day_col]
# return next month day number based on day_col
# day_col is based on range(0 - 6)
return next_month_day
# Begin calendar head. We'll use the capitalized name, because here it # Begin calendar head. We'll use the capitalized name, because here it
# seems appropriate for most countries. # seems appropriate for most countries.
month_name = full_month_name.capitalize() month_name = full_month_name.capitalize()
@@ -598,35 +674,30 @@ class WebCalReport(Report):
if not self.multiyear: if not self.multiyear:
th_txt = '%s %d' % (month_name, year) th_txt = '%s %d' % (month_name, year)
# begin calendar table # begin calendar table and table head
cal_table = Html("table", class_ = "calendar", id = month_name) cal_table = Html("table", class_ = "calendar", id = month_name)
# begin table head, <thead>
thead = Html("thead") thead = Html("thead")
tr = Html("tr") cal_table += thead
th = Html('th', th_txt, class_ ='monthName', colspan=7, inline = True)
# add them together now trow = Html("tr") + (
tr += th Html('th', th_txt, class_ ='monthName', colspan=7, inline = True)
thead += tr )
thead += trow
# Calendar weekday names header # Calendar weekday names header
weekday_names = Html("tr") trow = Html("trow")
thead += trow
for day_col in range(7): for day_col in range(7):
dayclass = get_class_for_daycol(day_col) dayclass = get_class_for_daycol(day_col)
dayname = get_name_for_daycol(day_col) dayname = get_name_for_daycol(day_col)
th = Html('th', class_ =dayclass, inline = True) + ( trow += Html('th', class_ =dayclass, inline = True) + (
Html('abbr', dayname[0], title=dayname) Html('abbr', dayname[0], title=dayname)
) )
# now add it all together
weekday_names += th
# add weekdays names to table body
thead += weekday_names
# begin table body # begin table body
tbody = Html("tbody") tbody = Html("tbody")
cal_table += tbody
# get first of the month and month information # get first of the month and month information
current_date, current_ord, monthinfo = get_first_day_of_month(year, month) current_date, current_ord, monthinfo = get_first_day_of_month(year, month)
@@ -637,7 +708,8 @@ class WebCalReport(Report):
week = monthinfo[week_row] week = monthinfo[week_row]
# if you look this up in wikipedia, the first week is called week0 # if you look this up in wikipedia, the first week is called week0
tr = Html("tr", class_ = "week%d" % week_row) trow = Html("tr", class_ = "week%02d" % week_row)
tbody += trow
# begin calendar day column # begin calendar day column
for day_col in range(0, 7): for day_col in range(0, 7):
@@ -647,7 +719,7 @@ class WebCalReport(Report):
day = week[day_col] day = week[day_col]
# start the beginning variable for <td>, table cell # start the beginning variable for <td>, table cell
tdid = "%s%02d" % (abbr_month_name, day) tcell_id = "%s%02d" % (abbr_month_name, day)
# add calendar date division # add calendar date division
datediv = Html("div", day, class_ = "date", inline = True) datediv = Html("div", day, class_ = "date", inline = True)
@@ -657,23 +729,21 @@ class WebCalReport(Report):
# day in previous month # day in previous month
if week_row == 0: if week_row == 0:
specday = get_previous_day(year, month, day_col) specday = __get_previous_month_day(year, month, day_col)
specclass = "previous " + dayclass specclass = "previous " + dayclass
# a day in the next month # a day in the next month
elif week_row == (nweeks-1): elif week_row == (nweeks-1):
specday = get_next_day(year, month, day_col) specday = __get_next_month_day(year, month, day_col)
specclass = "next " + dayclass specclass = "next " + dayclass
# continue table cell, <td>, without id tag # continue table cell, <td>, without id tag
td = Html('td', class_ = specclass, inline = True) + ( tcell = Html('td', class_ = specclass, inline = True) + (
# adds date for previous and next month days # adds date for previous and next month days
Html("div", specday, class_ = "date", inline = True) Html("div", specday, class_ = "date", inline = True)
) )
trow += tcell
# add table cell, <td>, to table row, <tr>
tr += td
# normal day number in current month # normal day number in current month
else: else:
@@ -695,7 +765,7 @@ class WebCalReport(Report):
if day_list: if day_list:
hilightday = 'highlight ' + dayclass hilightday = 'highlight ' + dayclass
td = Html('td', id=tdid, class_ = hilightday) tcell = Html('td', id = tcell_id, class_ = hilightday)
# Year at a Glance # Year at a Glance
if cal == "yg": if cal == "yg":
@@ -709,10 +779,8 @@ class WebCalReport(Report):
# create hyperlink to one_day() # create hyperlink to one_day()
fname_date = full_month_name + '/' + fname_date fname_date = full_month_name + '/' + fname_date
ahref = Html("a", datediv, href=fname_date, inline = True) hyper = Html("a", datediv, href=fname_date, inline = True)
tcell += hyper
# add hyperlink to table cell, <td>
td += ahref
# only year_glance() needs this to create the one_day() pages # only year_glance() needs this to create the one_day() pages
self.one_day(event_date, fname_date, day_list) self.one_day(event_date, fname_date, day_list)
@@ -721,7 +789,7 @@ class WebCalReport(Report):
else: else:
# continue table cell, <td>, without id tag # continue table cell, <td>, without id tag
td = Html('td', class_ = hilightday, inline = True) + ( tcell = Html('td', class_ = hilightday, inline = True) + (
# adds date division # adds date division
Html("div", day, class_ = "date", inline = True) Html("div", day, class_ = "date", inline = True)
@@ -730,23 +798,22 @@ class WebCalReport(Report):
# WebCal # WebCal
else: else:
# add date to table cell, <td> # add date to table cell
td += datediv tcell += datediv
# list the events # list the events
ul = Html("ul") unordered = Html("ul")
for nyears, date, text, event in day_list: tcell += unordered
ul += Html("li", text, inline=False if event == 'Anniversary'
else True)
# add events to table cell, <td> for nyears, date, text, event in day_list:
td += ul unordered += Html("li", text, inline=False if event == 'Anniversary'
else True)
# no events for this day # no events for this day
else: else:
# create empty day with date # create empty day with date
td = Html('td', class_ = dayclass, inline = True) + ( tcell = Html('td', class_ = dayclass, inline = True) + (
# adds date division # adds date division
Html("div", day, class_ = "date", inline = True) Html("div", day, class_ = "date", inline = True)
@@ -754,37 +821,31 @@ class WebCalReport(Report):
# nothing for this month # nothing for this month
else: else:
td = Html('td', class_ = dayclass) + ( tcell = Html('td', class_ = dayclass) + (
# adds date division # adds date division
Html("div", day, class_ = "date", inline = True) Html("div", day, class_ = "date", inline = True)
) )
# add table cell, <td>, to table row, <tr> # attach table cell to table row
# close the day column # close the day column
tr += td trow += tcell
# change day number # change day number
current_ord += 1 current_ord += 1
# add table row, <tr>, to table body, <tbody>
# close the week
tbody += tr
if cal == "yg": if cal == "yg":
# Fill up till we have 6 rows, so that the months align properly # Fill up till we have 6 rows, so that the months align properly
for i in range(nweeks, 6): for weeks in xrange(nweeks, 6):
six_weeks = Html("tr", class_ = "week%d" % (i + 1)) + ( six_weeks = Html("tr", class_ = "week%02d" % (weeks + 1))
# create table cell, <td>
Html('td', colspan=7, inline = True)
)
# add extra weeks to tbody if needed
tbody += six_weeks tbody += six_weeks
# bring table head and table body back together for emptydays in xrange(6):
cal_table += (thead, tbody) six_weeks += Html("td", class_ = "emptyDays", inline = True)
# create table cell
for col in xrange(6):
six_weeks += Html("td", class_ = "EmptyDays", inline = True)
# return calendar table to its caller # return calendar table to its caller
return cal_table return cal_table
@@ -823,7 +884,7 @@ class WebCalReport(Report):
webcal, body = self.write_header(nr_up, 'WebCal', self.title_text) webcal, body = self.write_header(nr_up, 'WebCal', self.title_text)
# create Year Navigation menu # create Year Navigation menu
if self.multiyear: if (self.multiyear and ((self.end_year - self.start_year) > 0)):
body += self.year_navigation(nr_up, str(year)) body += self.year_navigation(nr_up, str(year))
# Create Month Navigation Menu # Create Month Navigation Menu
@@ -833,26 +894,22 @@ class WebCalReport(Report):
# build the calendar # build the calendar
monthly_calendar = self.calendar_build("wc", year, month) monthly_calendar = self.calendar_build("wc", year, month)
body += monthly_calendar
# create note section for webcalendar() # create note section for webcalendar()
note = self.month_notes[month-1].strip() note = self.month_notes[month-1].strip()
note = note or "&nbsp;" if note:
note = self.database.get_note_from_gramps_id(note)
note = self.get_note_format(note)
# table foot section # table foot section
cal_note = Html("tfoot") cal_foot = Html("tfoot")
tr = Html("tr") monthly_calendar += cal_foot
td = Html('td', note, colspan=7, inline = True)
# add table cell to table row trow = Html("tr") + (
# add table row to table foot section Html('td', note, colspan=7, inline = True)
tr += td )
cal_note += tr cal_foot += trow
# add calendar note to calendar
monthly_calendar += cal_note
# add calendar to body
body += monthly_calendar
# create blank line for stylesheets # create blank line for stylesheets
# create footer division section # create footer division section
@@ -869,11 +926,8 @@ class WebCalReport(Report):
self.progress.step() self.progress.step()
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
#
# Creates Year At A Glance Calendar # Creates Year At A Glance Calendar
#
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
def year_glance(self, year): def year_glance(self, year):
""" """
This method will create the Full Year At A Glance Page... This method will create the Full Year At A Glance Page...
@@ -892,16 +946,16 @@ class WebCalReport(Report):
title = _("%(year)d, At A Glance") % {'year' : year} title = _("%(year)d, At A Glance") % {'year' : year}
# Create page header # Create page header
# body has already been added to yearglance already once # body has already been added to yearglance already once
yearglance, body = self.write_header(nr_up, 'fullyearlinked', title, False) yearglance, body = self.write_header(nr_up, 'fullyearlinked', title, False)
# create Year Navigation menu # create Year Navigation menu
if self.multiyear: if (self.multiyear and ((self.end_year - self.start_year) > 0)):
body += self.year_navigation(nr_up, str(year)) body += self.year_navigation(nr_up, str(year))
# Create Month Navigation Menu # Create Month Navigation Menu
# identify currentsection for proper highlighting # identify currentsection for proper highlighting
body += self.month_navigation(nr_up, year, 'fullyearlinked', False) body += self.month_navigation(nr_up, year, "fullyearlinked", True)
msg = (_('This calendar is meant to give you access ' msg = (_('This calendar is meant to give you access '
'to all your data at a glance compressed into one page. Clicking ' 'to all your data at a glance compressed into one page. Clicking '
@@ -909,21 +963,16 @@ class WebCalReport(Report):
'that date, if there are any!\n')) 'that date, if there are any!\n'))
# page description # page description
descriptdiv = Html("div", class_ = "content") + ( body += Html("div", class_ = "content") + (
# message line # message line
Html('p', msg, id='description') Html('p', msg, id='description')
) )
# add description to body
body += descriptdiv
for month in range(1, 13): for month in range(1, 13):
# build the calendar # build the calendar
monthly_calendar = self.calendar_build("yg", year, month) monthly_calendar = self.calendar_build("yg", year, month)
# add calendar to body
body += monthly_calendar body += monthly_calendar
# increase progress bar # increase progress bar
@@ -961,8 +1010,9 @@ class WebCalReport(Report):
nr_up = 2 # number of directory levels up to get to root nr_up = 2 # number of directory levels up to get to root
# get year from event_date for use in this section # get year and month from event_date for use in this section
year = event_date.get_year() year = event_date.get_year()
month = event_date.get_month()
# Name the file, and crate it (see code in calendar_build) # Name the file, and crate it (see code in calendar_build)
# chose 'od' as I will be opening and closing more than one file # chose 'od' as I will be opening and closing more than one file
@@ -977,27 +1027,25 @@ class WebCalReport(Report):
oneday, body = self.write_header(nr_up, 'OneDay', title) oneday, body = self.write_header(nr_up, 'OneDay', title)
# create Year Navigation menu # create Year Navigation menu
if self.multiyear: if (self.multiyear and ((self.end_year - self.start_year) > 0)):
body += self.year_navigation(nr_up, str(year)) body += self.year_navigation(nr_up, str(year))
# Create Month Navigation Menu # Create Month Navigation Menu
# identify currentsection for proper highlighting # identify currentsection for proper highlighting
# connect it back to year_glance() calendar currentsection = get_full_month_name(month)
body += self.month_navigation(nr_up, year, 'fullyearlinked', False) body += self.month_navigation(nr_up, year, currentsection, True)
# set date display as in user prevferences # set date display as in user prevferences
pg_date = _dd.display(event_date) pg_date = _dd.display(event_date)
body += Html('h3', pg_date, inline = True) body += Html('h3', pg_date, inline = True)
# list the events # list the events
ol = Html('ol') ordered = Html('ol')
body += ordered
for nyears, date, text, event in day_list: for nyears, date, text, event in day_list:
ol += Html("li", text, inline=False if event == 'Anniversary' ordered += Html("li", text, inline=False if event == 'Anniversary'
else True) else True)
# add ordered list to body section
body += ol
# create blank line for stylesheets # create blank line for stylesheets
# write footer section # write footer section
footer = self.write_footer(nr_up) footer = self.write_footer(nr_up)
@@ -1044,11 +1092,8 @@ class WebCalReport(Report):
return _nd.display_name(name) return _nd.display_name(name)
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
#
# The database slave; Gathers information for calendars # The database slave; Gathers information for calendars
#
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
def collect_data(self, this_year): def collect_data(self, this_year):
""" """
This method runs through the data, and collects the relevant dates This method runs through the data, and collects the relevant dates
@@ -1061,6 +1106,7 @@ class WebCalReport(Report):
self.progress.set_pass(_("Reading database..."), len(people)) self.progress.set_pass(_("Reading database..."), len(people))
for person_handle in people: for person_handle in people:
self.progress.step() self.progress.step()
person = self.database.get_person_from_handle(person_handle) person = self.database.get_person_from_handle(person_handle)
family_list = person.get_family_handle_list() family_list = person.get_family_handle_list()
birth_ref = person.get_birth_ref() birth_ref = person.get_birth_ref()
@@ -1189,11 +1235,8 @@ class WebCalReport(Report):
return footer return footer
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
#
# The work horse of this plugin; stages everything # The work horse of this plugin; stages everything
#
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
def write_report(self): def write_report(self):
""" """
The short method that runs through each month and creates a page. The short method that runs through each month and creates a page.
@@ -1209,7 +1252,12 @@ class WebCalReport(Report):
self.copy_calendar_files() self.copy_calendar_files()
if self.multiyear: if self.multiyear:
for cal_year in range(self.start_year, (self.end_year + 1)):
# limit number of years to eighteen (18) years and only one row of years
nyears = ((self.end_year - self.start_year) + 1)
num_years = nyears if 0 < nyears < 19 else 18
for cal_year in xrange(self.start_year, (self.start_year + num_years)):
# initialize the holidays dict to fill: # initialize the holidays dict to fill:
self.holidays = {} self.holidays = {}
@@ -1403,53 +1451,53 @@ class WebCalOptions(MenuReportOptions):
""" """
category_name = _("Jan - Jun Notes") category_name = _("Jan - Jun Notes")
note_jan = StringOption(_('Jan Note'), _('This prints in January')) note_jan = NoteOption(_('January Note'))
note_jan.set_help(_("The note for the month of January")) note_jan.set_help(_("The note for the month of January"))
menu.add_option(category_name, "note_jan", note_jan) menu.add_option(category_name, "note_jan", note_jan)
note_feb = StringOption(_('Feb Note'), _('This prints in February')) note_feb = NoteOption(_('February Note'))
note_feb.set_help(_("The note for the month of February")) note_feb.set_help(_("The note for the month of February"))
menu.add_option(category_name, "note_feb", note_feb) menu.add_option(category_name, "note_feb", note_feb)
note_mar = StringOption(_('Mar Note'), _('This prints in March')) note_mar = NoteOption(_('March Note'))
note_mar.set_help(_("The note for the month of March")) note_mar.set_help(_("The note for the month of March"))
menu.add_option(category_name, "note_mar", note_mar) menu.add_option(category_name, "note_mar", note_mar)
note_apr = StringOption(_('Apr Note'), _('This prints in April')) note_apr = NoteOption(_('April Note'))
note_apr.set_help(_("The note for the month of April")) note_apr.set_help(_("The note for the month of April"))
menu.add_option(category_name, "note_apr", note_apr) menu.add_option(category_name, "note_apr", note_apr)
note_may = StringOption(_('May Note'), _('This prints in May')) note_may = NoteOption(_('May Note'))
note_may.set_help(_("The note for the month of May")) note_may.set_help(_("The note for the month of May"))
menu.add_option(category_name, "note_may", note_may) menu.add_option(category_name, "note_may", note_may)
note_jun = StringOption(_('Jun Note'), _('This prints in June')) note_jun = NoteOption(_('June Note'))
note_jun.set_help(_("The note for the month of June")) note_jun.set_help(_("The note for the month of June"))
menu.add_option(category_name, "note_jun", note_jun) menu.add_option(category_name, "note_jun", note_jun)
category_name = _("Jul - Dec Notes") category_name = _("Jul - Dec Notes")
note_jul = StringOption(_('Jul Note'), _('This prints in July')) note_jul = NoteOption(_('July Note'))
note_jul.set_help(_("The note for the month of July")) note_jul.set_help(_("The note for the month of July"))
menu.add_option(category_name, "note_jul", note_jul) menu.add_option(category_name, "note_jul", note_jul)
note_aug = StringOption(_('Aug Note'), _('This prints in August')) note_aug = NoteOption(_('August Note'))
note_aug.set_help(_("The note for the month of August")) note_aug.set_help(_("The note for the month of August"))
menu.add_option(category_name, "note_aug", note_aug) menu.add_option(category_name, "note_aug", note_aug)
note_sep = StringOption(_('Sep Note'), _('This prints in September')) note_sep = NoteOption(_('September Note'))
note_sep.set_help(_("The note for the month of September")) note_sep.set_help(_("The note for the month of September"))
menu.add_option(category_name, "note_sep", note_sep) menu.add_option(category_name, "note_sep", note_sep)
note_oct = StringOption(_('Oct Note'), _('This prints in October')) note_oct = NoteOption(_('October Note'))
note_oct.set_help(_("The note for the month of October")) note_oct.set_help(_("The note for the month of October"))
menu.add_option(category_name, "note_oct", note_oct) menu.add_option(category_name, "note_oct", note_oct)
note_nov = StringOption(_('Nov Note'), _('This prints in November')) note_nov = NoteOption(_('November Note'))
note_nov.set_help(_("The note for the month of November")) note_nov.set_help(_("The note for the month of November"))
menu.add_option(category_name, "note_nov", note_nov) menu.add_option(category_name, "note_nov", note_nov)
note_dec = StringOption(_('Dec Note'), _('This prints in December')) note_dec = NoteOption(_('December Note'))
note_dec.set_help(_("The note for the month of December")) note_dec.set_help(_("The note for the month of December"))
menu.add_option(category_name, "note_dec", note_dec) menu.add_option(category_name, "note_dec", note_dec)
@@ -1601,33 +1649,6 @@ def get_first_day_of_month(year, month):
current_ord = current_date.toordinal() - monthinfo[0].count(0) current_ord = current_date.toordinal() - monthinfo[0].count(0)
return current_date, current_ord, monthinfo return current_date, current_ord, monthinfo
def get_previous_day(year, month, day_col):
"""
get last month's last week for previous days in the month
"""
if month == 1:
prevmonth = calendar.monthcalendar(year - 1, 12)
else:
prevmonth = calendar.monthcalendar(year, month-1)
num_weeks = len(prevmonth)
lastweek_prevmonth = prevmonth[num_weeks - 1]
previous_month_day = lastweek_prevmonth[day_col]
return previous_month_day
def get_next_day(year, month, day_col):
"""
get next month's first week for next days in the month
"""
if month == 12:
nextmonth = calendar.monthcalendar(year + 1, 1)
else:
nextmonth = calendar.monthcalendar(year, month + 1)
firstweek_nextmonth = nextmonth[0]
next_month_day = firstweek_nextmonth[day_col]
return next_month_day
def _has_webpage_extension(url): def _has_webpage_extension(url):
""" """
determine if a filename has an extension or not... determine if a filename has an extension or not...