diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index ae19744eb..48aa8e7d4 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2005-07-20 Don Allingham + * src/plugins/NavWebPage.py: Add support for multiple directory levels to + try to keep the number of files per directory under 254 for optimal ext3 + file performance, add support for copyright. + 2005-07-20 Julio Sanchez * src/plugins/DetDescendantReport.py: Names, events and sources. * src/plugins/DetAncestralReport.py (add_user_options): Names, events and sources. diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index 2db75137f..d735c3cbe 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -97,15 +97,24 @@ _character_sets = [ ['koi8_r', 'koi8_r', ], ] +_cc = [ + 'Creative Commons License', + 'Creative Commons License', + 'Creative Commons License', + 'Creative Commons License', + 'Creative Commons License', + 'Creative Commons License', + ] + class BasePage: - def __init__(self, title, options, archive, photo_list): + def __init__(self, title, options, archive, photo_list, levels): self.title_str = title self.inc_download = options.handler.options_dict['NWEBdownload'] self.html_dir = options.handler.options_dict['NWEBod'] + self.copyright = options.handler.options_dict['NWEBcopyright'] self.options = options self.archive = archive - self.image_dir = options.handler.options_dict['NWEBimagedir'].strip() self.ext = options.handler.options_dict['NWEBext'] self.encoding = options.handler.options_dict['NWEBencoding'] self.css = options.handler.options_dict['NWEBcss'] @@ -114,13 +123,14 @@ class BasePage: self.use_contact = options.handler.options_dict['NWEBcontact'] != u"" self.photo_list = photo_list self.private = not options.handler.options_dict['NWEBincpriv'] + self.copyright = options.handler.options_dict['NWEBcopyright'] + self.levels = levels def copy_media(self,photo): if photo.get_handle() != self.photo_list and photo.get_handle() not in self.photo_list: self.photo_list.append(photo.get_handle()) newpath = photo.gramps_id + os.path.splitext(photo.get_path())[1] - if self.image_dir: - newpath = os.path.join(self.image_dir,newpath) + newpath = os.path.join('images',newpath) return newpath def create_file(self,name): @@ -133,6 +143,25 @@ class BasePage: of = codecs.EncodedFile(open(page_name, "w"),'utf-8',self.encoding) return of + def create_link_file(self,name,path): + if self.archive: + self.string_io = StringIO() + of = codecs.EncodedFile(self.string_io,'utf-8',self.encoding) + if self.levels == 1: + self.cur_name = os.path.join(path,name[0],name + "." + self.ext) + else: + self.cur_name = os.path.join(path,name[0],name[1],name + "." + self.ext) + else: + if self.levels == 1: + dirname = os.path.join(self.html_dir,path,name[0]) + else: + dirname = os.path.join(self.html_dir,path,name[0],name[1]) + if not os.path.isdir(dirname): + os.makedirs(dirname) + page_name = os.path.join(dirname,name + "." + self.ext) + of = codecs.EncodedFile(open(page_name, "w"),'utf-8',self.encoding) + return of + def close_file(self,of): if self.archive: self.archive.add_file(self.cur_name,time.time(),self.string_io) @@ -145,62 +174,81 @@ class BasePage: def display_footer(self,of): - format = locale.nl_langinfo(locale.D_FMT) - value = time.strftime(format,time.localtime(time.time())) - - msg = _('Generated by ' - 'GRAMPS on %(date)s' % { 'date' : value }) - of.write('\n') - of.write('\n' % msg) - of.write('


\n') + of.write('



\n') of.write('\n') of.write('\n') - def display_header(self,of,title,author=""): - - if author: - author = author.replace(',,,','') - year = time.localtime(time.time())[0] - cright = _('Copyright © %(person)s %(year)d') % { - 'person' : author, - 'year' : year } - + def display_header(self,of,title,author="",up=False): + if up: + if self.levels == 1: + path = "../.." + else: + path = "../../.." + else: + path = "" + + self.author = author of.write('\n') of.write('\n\n') of.write('%s - %s\n' % (self.title_str, title)) of.write('\n' % self.encoding) - of.write('\n') of.write('\n') of.write('') of.write('\n') of.write('\n') of.write('\n') of.write('
\n') - def show_link(self,of,lpath,title): - of.write('%s  ' % (lpath,self.ext,title)) + def show_link(self,of,lpath,title,path): + if path: + of.write('%s  ' % (path,lpath,self.ext,title)) + else: + of.write('%s  ' % (lpath,self.ext,title)) def display_first_image_as_thumbnail( self, of, db, photolist=None): if not photolist: @@ -213,9 +261,8 @@ class BasePage: try: newpath = self.copy_media(photo) of.write('
\n') - of.write('' % (photo_handle,self.ext)) - of.write('%s' % photo.get_description()) + self.media_link(of,photo_handle,newpath, + photo.get_description(),up=True) of.write('
\n') except (IOError,OSError),msg: ErrorDialog(str(msg)) @@ -235,12 +282,8 @@ class BasePage: if photo.get_mime_type(): try: newpath = self.copy_media(photo) - of.write('
\n') - of.write('' % (photo_handle,self.ext)) - of.write('%s' % photo.get_description()) - of.write('
%s
' % photo.get_description()) - of.write('
\n') + self.media_link(of,photo_handle,newpath, + photo.get_description(),up=True) except (IOError,OSError),msg: ErrorDialog(str(msg)) of.write('') @@ -304,12 +347,74 @@ class BasePage: for handle in handlelist: person = db.get_person_from_handle(handle) of.write('%d. ' % index) - of.write('%s' % (handle,self.ext, - nameof(person,self.private))) + self.person_link(of,handle,nameof(person,self.private), + person.gramps_id,True) of.write('\n') index = index + 1 of.write('\n') + def build_path(self,handle,dirroot,up): + if up: + if self.levels == 1: + return '../../%s/%s/' % (dirroot,handle[0]) + else: + return '../../../%s/%s/%s' % (dirroot,handle[0],handle[1]) + else: + if self.levels == 1: + return "%s/%s" % (dirroot,handle[0]) + else: + return "%s/%s/%s" % (dirroot,handle[0],handle[1]) + + def person_link(self,of,handle,name,gid="",up=False): + dirpath = self.build_path(handle,'ppl',up) + + of.write('%s' % (dirpath,handle,self.ext,name)) + if not self.noid and gid != "": + of.write(' [%s]' % gid) + of.write('') + + def media_ref_link(self,of,handle,name,up=False): + dirpath = self.build_path(handle,'img',up) + of.write('%s' % ( + dirpath,handle,self.ext,name)) + + def media_link(self,of,handle,path,name,up,usedescr=True): + dirpath = self.build_path(handle,'img',up) + of.write('' % ( + dirpath,handle,self.ext)) + if self.levels == 1: + of.write('%s' % name) + if usedescr: + of.write('
%s
' % name) + of.write('') + + def source_link(self,of,handle,name,gid="",up=False): + dirpath = self.build_path(handle,'src',up) + of.write('%s' % ( + dirpath,handle,self.ext,name)) + if not self.noid and gid != "": + of.write(' [%s]' % gid) + of.write('') + + def place_link(self,of,handle,name,gid="",up=False): + dirpath = self.build_path(handle,'plc',up) + of.write('%s' % ( + dirpath,handle,self.ext,name)) + if not self.noid and gid != "": + of.write(' [%s]' % gid) + of.write('') + + def place_link_str(self,handle,name,gid="",up=False): + dirpath = self.build_path(handle,'plc',up) + retval = '%s' % ( + dirpath,handle,self.ext,name) + if not self.noid and gid != "": + retval = retval + ' [%s]' % gid + return retval + '' + #------------------------------------------------------------------------ # # @@ -317,8 +422,8 @@ class BasePage: #------------------------------------------------------------------------ class IndividualListPage(BasePage): - def __init__(self, db, title, person_handle_list, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, person_handle_list, options, archive, media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) of = self.create_file("individuals") self.display_header(of,_('Individuals'), @@ -352,11 +457,10 @@ class IndividualListPage(BasePage): else: of.write(' ') of.write('') - of.write(' ' % (person.handle,self.ext)) - of.write(person.get_primary_name().get_first_name()) - if not self.noid: - of.write(u' [%s]' % person.gramps_id) - of.write('\n') + self.person_link(of,person.handle, + person.get_primary_name().get_first_name(), + person.gramps_id) + of.write('\n') first = False of.write('\n\n') @@ -370,8 +474,9 @@ class IndividualListPage(BasePage): #------------------------------------------------------------------------ class PlaceListPage(BasePage): - def __init__(self, db, title, place_handles, src_list, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, place_handles, src_list, options, archive, + media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) of = self.create_file("places") self.display_header(of,_('Places'), get_researcher().get_name()) @@ -410,20 +515,14 @@ class PlaceListPage(BasePage): of.write(' \n') of.write('%s' % last_letter) of.write('') - of.write('' % (place.handle,self.ext)) - of.write(n) - if not self.noid: - of.write(' [%s]' % place.gramps_id) - of.write('') + self.place_link(of,place.handle,n,place.gramps_id) + of.write('') last_surname = n elif n != last_surname: of.write(' ') of.write('') - of.write('' % (place.handle,self.ext)) - of.write(n) - if not self.noid: - of.write(' [%s]' % place.gramps_id) - of.write('') + self.place_link(of,place.handle,n,place.gramps_id) + of.write('') last_surname = n of.write('\n\n') @@ -437,13 +536,14 @@ class PlaceListPage(BasePage): #------------------------------------------------------------------------ class PlacePage(BasePage): - def __init__(self, db, title, place_handle, src_list, place_list, options, archive, media_list): + def __init__(self, db, title, place_handle, src_list, place_list, options, + archive, media_list, levels): place = db.get_place_from_handle( place_handle) - BasePage.__init__(self, title, options, archive, media_list) - of = self.create_file(place.get_handle()) + BasePage.__init__(self, title, options, archive, media_list, levels) + of = self.create_link_file(place.get_handle(),"plc") place_name = ReportUtils.place_name(db,place_handle) self.display_header(of,"%s - %s" % (_('Places'), place_name), - get_researcher().get_name()) + get_researcher().get_name(),up=True) self.display_first_image_as_thumbnail(of, db, place.get_media_list()) @@ -497,16 +597,15 @@ class PlacePage(BasePage): class MediaPage(BasePage): def __init__(self, db, title, handle, src_list, options, archive, media_list, - info): + info, levels): (prev, next, page_number, total_pages) = info photo = db.get_object_from_handle(handle) - BasePage.__init__(self, title, options, archive, media_list) - of = self.create_file(handle) + BasePage.__init__(self, title, options, archive, media_list, levels) + of = self.create_link_file(handle,"img") newpath = photo.gramps_id + os.path.splitext(photo.get_path())[1] - if self.image_dir: - newpath = os.path.join(self.image_dir,newpath) + newpath = os.path.join('images',newpath) if self.archive: imagefile = open(photo.get_path(),"r") self.archive.add_file(newpath,time.time(),imagefile) @@ -516,7 +615,8 @@ class MediaPage(BasePage): os.path.join(self.html_dir,newpath)) title = photo.get_description() - self.display_header(of, "%s - %s" % (_('Gallery'), title), get_researcher().get_name()) + self.display_header(of, "%s - %s" % (_('Gallery'), title), + get_researcher().get_name(),up=True) of.write('
\n') of.write('

%s

\n' % title) @@ -524,12 +624,13 @@ class MediaPage(BasePage): # gallery navigation of.write('
') if prev: - of.write('%s' % (prev,self.ext,_('Previous'))) + self.media_ref_link(of,prev,_('Previous'),True) data = _('%(page_number)d of %(total_pages)d' % { 'page_number' : page_number, 'total_pages' : total_pages }) of.write('  %s  ' % data) if next: - of.write('%s' % (next,self.ext,_('Next'))) + self.media_ref_link(of,next,_('Next'),True) + of.write('

\n') mime_type = photo.get_mime_type() @@ -537,7 +638,7 @@ class MediaPage(BasePage): try: of.write('
\n') of.write('%s' % (newpath, title)) + of.write('src="../../%s" alt="%s"/>' % (newpath, title)) of.write('
\n') except (IOError,OSError),msg: ErrorDialog(str(msg)) @@ -568,8 +669,9 @@ class MediaPage(BasePage): #------------------------------------------------------------------------ class SurnameListPage(BasePage): - def __init__(self, db, title, person_handle_list, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, person_handle_list, options, archive, + media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) of = self.create_file("surnames") self.display_header(of,_('Surnames'), get_researcher().get_name()) @@ -625,8 +727,8 @@ class SurnameListPage(BasePage): #------------------------------------------------------------------------ class IntroductionPage(BasePage): - def __init__(self, db, title, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, options, archive, media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) note_id = options.handler.options_dict['NWEBintronote'] of = self.create_file("introduction") @@ -670,8 +772,8 @@ class IntroductionPage(BasePage): #------------------------------------------------------------------------ class HomePage(BasePage): - def __init__(self, db, title, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, options, archive, media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) note_id = options.handler.options_dict['NWEBhomenote'] of = self.create_file("index") @@ -715,8 +817,9 @@ class HomePage(BasePage): #------------------------------------------------------------------------ class SourcesPage(BasePage): - def __init__(self, db, title, handle_set, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, handle_set, options, archive, media_list, + levels): + BasePage.__init__(self, title, options, archive, media_list, levels) of = self.create_file("sources") self.display_header(of,_('Sources'), @@ -737,9 +840,8 @@ class SourcesPage(BasePage): source = db.get_source_from_handle(handle) of.write('%d.\n' % index) of.write('') - of.write('' % (handle,self.ext)) - of.write('%s [%s]' % (source.get_title(),source.gramps_id)) - of.write('\n') + self.source_link(of,handle,source.get_title(),source.gramps_id) + of.write('\n') index += 1 of.write('\n\n') @@ -754,12 +856,14 @@ class SourcesPage(BasePage): #------------------------------------------------------------------------ class SourcePage(BasePage): - def __init__(self, db, title, handle, src_list, options, archive, media_list): + def __init__(self, db, title, handle, src_list, options, archive, + media_list, levels): source = db.get_source_from_handle( handle) - BasePage.__init__(self, title, options, archive, media_list) - of = self.create_file(source.get_handle()) + BasePage.__init__(self, title, options, archive, media_list, levels) + of = self.create_link_file(source.get_handle(),"src") source_name = source.get_title() - self.display_header(of,"%s - %s" % (_('Sources'), source_name),get_researcher().get_name()) + self.display_header(of,"%s - %s" % (_('Sources'), source_name), + get_researcher().get_name(),up=True) self.display_first_image_as_thumbnail(of, db, source.get_media_list()) @@ -795,8 +899,8 @@ class SourcePage(BasePage): #------------------------------------------------------------------------ class GalleryPage(BasePage): - def __init__(self, db, title, handle_set, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, handle_set, options, archive, media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) of = self.create_file("gallery") self.display_header(of, _('Gallery'), get_researcher().get_name()) @@ -816,9 +920,7 @@ class GalleryPage(BasePage): media = db.get_object_from_handle(handle) of.write('%d.\n' % index) of.write('') - of.write('' % (handle,self.ext)) - of.write(media.get_description()) - of.write('\n') + self.media_ref_link(of,handle,media.get_description()) of.write('\n') index += 1 @@ -843,8 +945,8 @@ class GalleryPage(BasePage): #------------------------------------------------------------------------ class DownloadPage(BasePage): - def __init__(self, db, title, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, options, archive, media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) of = self.create_file("download") self.display_header(of,_('Download'), @@ -862,8 +964,8 @@ class DownloadPage(BasePage): #------------------------------------------------------------------------ class ContactPage(BasePage): - def __init__(self, db, title, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, title, options, archive, media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) of = self.create_file("contact") self.display_header(of,_('Contact'), @@ -934,9 +1036,9 @@ class IndividualPage(BasePage): RelLib.Person.UNKNOWN : const.unknown, } - def __init__(self, db, person, title, ind_list, - place_list, src_list, options, archive, media_list): - BasePage.__init__(self, title, options, archive, media_list) + def __init__(self, db, person, title, ind_list, place_list, src_list, + options, archive, media_list, levels): + BasePage.__init__(self, title, options, archive, media_list, levels) self.person = person self.db = db self.ind_list = ind_list @@ -946,9 +1048,9 @@ class IndividualPage(BasePage): self.sort_name = sort_nameof(self.person,self.private) self.name = sort_nameof(self.person,self.private) - of = self.create_file(person.handle) + of = self.create_link_file(person.handle,"ppl") self.display_header(of, self.sort_name, - get_researcher().get_name()) + get_researcher().get_name(),up=True) self.display_ind_general(of) self.display_ind_events(of) self.display_attr_list(of, self.person.get_attribute_list()) @@ -975,7 +1077,7 @@ class IndividualPage(BasePage): sreflist = self.src_refs + self.person.get_source_references() if not sreflist: return - of.write('

%s

\n' % _('Source Referencess')) + of.write('

%s

\n' % _('Source References')) of.write('
\n') of.write('\n') @@ -992,8 +1094,8 @@ class IndividualPage(BasePage): source = self.db.get_source_from_handle(shandle) title = source.get_title() of.write('' % (index,index)) - of.write('\n') @@ -1258,13 +1356,10 @@ class IndividualPage(BasePage): use_link = spouse_id in self.ind_list gid = spouse.get_gramps_id() if use_link: - of.write('' % (spouse.handle,self.ext)) - of.write(name) - if not self.noid: - of.write(' [%s]' % (gid)) - if use_link: - of.write('') - + self.person_link(of,spouse.handle,nameof(spouse,self.private), + gid,True) + else: + of.write(name) of.write('\n\n') for event_id in family.get_event_list(): @@ -1299,10 +1394,10 @@ class IndividualPage(BasePage): person_link = person.handle in self.ind_list of.write('%s ' % bullet) if person_link: - of.write('' % (person.handle,self.ext)) - of.write(nameof(person,self.private)) - if person_link: - of.write('') + self.person_link(of,person.handle,nameof(person,self.private), + up=True) + else: + of.write(nameof(person,self.private)) of.write('
\n') def pedigree_family(self,of): @@ -1342,7 +1437,9 @@ class IndividualPage(BasePage): else: self.place_list[place_handle] = [self.person.handle] - place = '%s' % (place_handle,self.ext,ReportUtils.place_name(self.db,place_handle)) + place = self.place_link_str(place_handle, + ReportUtils.place_name(self.db,place_handle), + up=True) else: place = u"" @@ -1401,7 +1498,6 @@ class WebReport(Report.Report): NWEBplaceidx NWEBshorttree NWEBidxcol - NWEBimagedir NWEBincid NWEBidurl NWEBlinktidx @@ -1425,6 +1521,7 @@ class WebReport(Report.Report): self.filter = filters[filter_num] self.target_path = options_class.handler.options_dict['NWEBod'] + self.copyright = options_class.handler.options_dict['NWEBcopyright'] self.ext = options_class.handler.options_dict['NWEBext'] self.encoding = options_class.handler.options_dict['NWEBencoding'] self.css = options_class.handler.options_dict['NWEBcss'] @@ -1434,7 +1531,6 @@ class WebReport(Report.Report): self.private = options_class.handler.options_dict['NWEBincpriv'] self.noid = options_class.handler.options_dict['NWEBnoid'] self.srccomments = options_class.handler.options_dict['NWEBcmtxtsi'] - self.image_dir = options_class.handler.options_dict['NWEBimagedir'] self.title = options_class.handler.options_dict['NWEBtitle'] self.separate_alpha = options_class.handler.options_dict['NWEBsplita'] self.depth = options_class.handler.options_dict['NWEBtreed'] @@ -1472,10 +1568,7 @@ class WebReport(Report.Report): dir_name) return - if self.image_dir: - image_dir_name = os.path.join(dir_name, self.image_dir) - else: - image_dir_name = dir_name + image_dir_name = os.path.join(dir_name, 'images') if not os.path.isdir(image_dir_name) and self.photos != 0: try: os.mkdir(image_dir_name) @@ -1513,18 +1606,24 @@ class WebReport(Report.Report): self.write_css(archive,self.target_path,self.css) photo_list = [] + + if len(ind_list) > 9000: + levels = 2 + else: + levels = 1 - HomePage(self.database, self.title, self.options_class, archive, photo_list) + HomePage(self.database, self.title, self.options_class, archive, + photo_list, levels) if self.inc_contact: ContactPage(self.database, self.title, self.options_class, - archive, photo_list) + archive, photo_list, levels) if self.inc_download: DownloadPage(self.database, self.title, self.options_class, - archive, photo_list) + archive, photo_list, levels) if self.use_intro: IntroductionPage(self.database, self.title, self.options_class, - archive, photo_list) + archive, photo_list, levels) place_list = {} source_list = {} @@ -1536,36 +1635,40 @@ class WebReport(Report.Report): idoc = IndividualPage(self.database, person, self.title, ind_list, place_list, source_list, - self.options_class, archive, photo_list) + self.options_class, archive, + photo_list, levels) self.progress_bar_step() while gtk.events_pending(): gtk.main_iteration() if len(ind_list) > 1: IndividualListPage(self.database, self.title, ind_list, - self.options_class, archive, photo_list) + self.options_class, archive, photo_list, + levels) SurnameListPage(self.database, self.title, ind_list, - self.options_class, archive, photo_list) + self.options_class, archive, photo_list, + levels) self.progress_bar_step() while gtk.events_pending(): gtk.main_iteration() PlaceListPage(self.database, self.title, place_list, - source_list,self.options_class, archive, photo_list) + source_list,self.options_class, archive, + photo_list, levels) for place in place_list.keys(): PlacePage(self.database, self.title, place, source_list, place_list, - self.options_class, archive, photo_list) + self.options_class, archive, photo_list, levels) SourcesPage(self.database,self.title, source_list.keys(), self.options_class, - archive, photo_list) + archive, photo_list, levels) for key in list(source_list): SourcePage(self.database,self.title, key, source_list, self.options_class, - archive, photo_list) + archive, photo_list, levels) GalleryPage(self.database, self.title, source_list, self.options_class, - archive, photo_list) + archive, photo_list, levels) prev = None total = len(photo_list) @@ -1577,7 +1680,7 @@ class WebReport(Report.Report): next = photo_list[index] MediaPage(self.database, self.title, photo_handle, source_list, self.options_class, archive, photo_list, - (prev, next, index, total)) + (prev, next, index, total), levels) prev = photo_handle index += 1 @@ -1617,6 +1720,7 @@ class WebReportOptions(ReportOptions.ReportOptions): self.options_dict = { 'NWEBarchive' : 0, 'NWEBod' : './', + 'NWEBcopyright' : 0, 'NWEBimg' : 2, 'NWEBrestrictinfo' : 0, 'NWEBincpriv' : 0, @@ -1627,7 +1731,6 @@ class WebReportOptions(ReportOptions.ReportOptions): 'NWEBcontact' : '', 'NWEBdownload' : 0, 'NWEBshorttree' : 1, - 'NWEBimagedir' : 'images', 'NWEBtitle' : _('My Family Tree'), 'NWEBincid' : 0, 'NWEBidurl' : '', @@ -1725,9 +1828,6 @@ class WebReportOptions(ReportOptions.ReportOptions): self.no_comments = gtk.CheckButton(no_com_msg) self.no_comments.set_active(not self.options_dict['NWEBcmtxtsi']) - self.imgdir = gtk.Entry() - self.imgdir.set_text(self.options_dict['NWEBimagedir']) - self.intro_note = gtk.Entry() self.intro_note.set_text(self.options_dict['NWEBintronote']) @@ -1743,9 +1843,26 @@ class WebReportOptions(ReportOptions.ReportOptions): for text in self.ext_options: self.ext.append_text(text) + self.copy = gtk.combo_box_new_text() + self.copy_options = [ + _('Standard copyright'), + _('Creative Commons - By attribution'), + _('Creative Commons - By attribution, No derivations'), + _('Creative Commons - By attribution, Share-alike'), + _('Creative Commons - By attribution, Non-commercial'), + _('Creative Commons - By attribution, Non-commercial, No derivations'), + _('Creative Commons - By attribution, Non-commerical, Share-alike'), + _('No copyright notice'), + ] + for text in self.copy_options: + self.copy.append_text(text) + def_ext = "." + self.options_dict['NWEBext'] self.ext.set_active(self.ext_options.index(def_ext)) + index = self.options_dict['NWEBcopyright'] + self.copy.set_active(index) + cset_node = None cset = self.options_dict['NWEBencoding'] @@ -1768,10 +1885,10 @@ class WebReportOptions(ReportOptions.ReportOptions): self.css = GrampsNoteComboBox(store,cset_node) dialog.add_option(title_msg,self.title) - dialog.add_option(imgdir_msg,self.imgdir) dialog.add_option(ext_msg,self.ext) dialog.add_option(_('Character set encoding'),self.encoding) dialog.add_option(_('Stylesheet'),self.css) + dialog.add_option(_('Copyright'),self.copy) title = _("Page Generation") @@ -1805,6 +1922,7 @@ class WebReportOptions(ReportOptions.ReportOptions): dialog.add_frame_option(title,None,self.no_comments) self.no_images.connect('toggled',self.on_nophotos_toggled) + def parse_user_options(self,dialog): """Parse the privacy options frame of the dialog. Save the user selected choices for later use.""" @@ -1814,7 +1932,6 @@ class WebReportOptions(ReportOptions.ReportOptions): self.options_dict['NWEBnoid'] = int(self.noid.get_active()) self.options_dict['NWEBcontact'] = unicode(self.contact.get_handle()) self.options_dict['NWEBdownload'] = int(self.inc_download.get_active()) - self.options_dict['NWEBimagedir'] = unicode(self.imgdir.get_text()) self.options_dict['NWEBtitle'] = unicode(self.title.get_text()) self.options_dict['NWEBintronote'] = unicode(self.intro_note.get_handle()) self.options_dict['NWEBhomenote'] = unicode(self.home_note.get_handle()) @@ -1841,6 +1958,7 @@ class WebReportOptions(ReportOptions.ReportOptions): photos = 2 self.options_dict['NWEBimg'] = photos self.options_dict['NWEBod'] = dialog.target_path + self.options_dict['NWEBcopyright'] = self.copy.get_active() #------------------------------------------------------------------------ #
%d.' % (source.handle,self.ext)) - of.write('%s [%s]' %(title,source.gramps_id)) + of.write('') + self.source_link(of,source.handle,title,source.gramps_id,True) of.write('') tmp = [] for (label,data) in [(_('Page'),sref.page), @@ -1135,12 +1237,10 @@ class IndividualPage(BasePage): child = self.db.get_person_from_handle(child_handle) gid = child.get_gramps_id() if use_link: - of.write('' % (child.handle,self.ext)) - of.write(nameof(child,self.private)) - if not self.noid: - of.write(' [%s]' % gid) - if use_link: - of.write('\n') + self.person_link(of,child_handle,nameof(child,self.private), + gid,True) + else: + of.write(nameof(child,self.private)) of.write(u"
\n") def display_parent(self, of, handle, title, rel): @@ -1150,12 +1250,10 @@ class IndividualPage(BasePage): of.write('
') val = person.gramps_id if use_link: - of.write('' % (person.handle,self.ext)) - of.write(nameof(person,self.private)) - if not self.noid: - of.write(' [%s]' % (val)) - if use_link: - of.write('') + self.person_link(of,handle,nameof(person,self.private), + val,up=True) + else: + of.write(nameof(person,self.private)) if rel != RelLib.Person.CHILD_REL_BIRTH: of.write('   (%s)' % const.child_rel_list[rel]) of.write('