From d579d8543a5660d9209ab28be9d52bcbc18f74b4 Mon Sep 17 00:00:00 2001 From: Kees Bakker Date: Thu, 20 Mar 2008 22:24:36 +0000 Subject: [PATCH] Moving many functions from BasePage to NavWebReport. Introducing new functions to deal with disk file and functions that deal with URLs. Changed to selection of the extra two subdirectories so that the ppl tree is much better balanced (not all files in one directory). * src/plugins/NarrativeWeb.py svn: r10357 --- src/plugins/NarrativeWeb.py | 575 ++++++++++++++++++------------------ 1 file changed, 293 insertions(+), 282 deletions(-) diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index f2afcb9fb..16469e852 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -242,50 +242,11 @@ class BasePage: # are still required. options = report.options self.html_dir = options['target'] - self.copyright = options['cright'] self.ext = options['ext'] - self.encoding = options['encoding'] self.noid = options['nogid'] self.linkhome = options['linkhome'] - self.showbirth = options['showbirth'] - self.showdeath = options['showdeath'] - self.showspouse = options['showspouse'] - self.showparents = options['showparents'] - self.showhalfsiblings = options['showhalfsiblings'] self.use_gallery = options['gallery'] - def copy_media(self, photo, store_ref=True): - handle = photo.get_handle() - if store_ref: - lnk = (self.report.cur_fname, self.page_title, self.gid) - # FIXME. Is it OK to add to the photo_list of report? - photo_list = self.report.photo_list - if handle in photo_list: - if lnk not in photo_list[handle]: - photo_list[handle].append(lnk) - else: - photo_list[handle] = [lnk] - - ext = os.path.splitext(photo.get_path())[1] - real_path = "%s/%s" % (self.build_path('images', handle), handle+ext) - thumb_path = "%s/%s.png" % (self.build_path('thumb', handle), handle) - return (real_path, thumb_path) - - def build_path(self, dirroot, name, up=False): - path = '%s/%s/%s' % (dirroot, name[0].lower(), name[1].lower()) - if up: - path = '../../../' + path - return path - - def build_path_fname(self, path, name, up=False): - """ - Create a filename in a directory tree using the first to characters - for the first two directory levels. For example - 0/2/02c0d8f888f566ae95ffbdca64274b51 - """ - path = self.build_path(path, name, up) - return path + '/' + name + self.ext - def lnkfmt(self, text): """This creates an MD5 hex string to be used as filename.""" return md5.new(text).hexdigest() @@ -303,7 +264,8 @@ class BasePage: of.write('

\n') of.write('\t\n') - if self.copyright == 0: + copyright = self.report.copyright + if copyright == 0: of.write('\t\n') - elif self.copyright <= 6: + elif copyright <= 6: of.write('\t