NameGEDCOMImporterPlugin
DescriptionImports gedcom files into tiddlywiki
Version0.2.1
RequiresJRGgedcom.js
AuthorJon Robson
LicenseBSD
(function($) {
var macro = config.macros.gedcomImport = {
	locale: {
		describe: "Please paste the text of your gedcom file into the box below to import it into this TiddlyWiki"
	},
	handler: function(place) {
		var container = $("<div />").appendTo(place)[0];
		$("<div/>").text(macro.locale.describe).appendTo(container);
		$("<textarea />").appendTo(container);
		$("<button />").appendTo(container).text("import gedcom").click(function(ev) {
			var text = $("textarea", container).val();
			$("textarea", container).val("");
			var tiddlers = gedcom.import(text);
			$(ev.target).attr("disabled", true);
			var save = [];
			for(var i = 0; i < tiddlers.length; i++) {
				var tid = tiddlers[i];
				var tiddler = new Tiddler(tid.title);
				tiddler.text = tid.text || "";
				tiddler.fields = tid.fields;
				if(tid.fields.spouses) {
					tiddler.fields.spouse = String.encodeTiddlyLinkList(tid.fields.spouses);
					delete tiddler.fields.spouses;
				}
				tiddler.tags = tid.tags || [];
				merge(tiddler.fields, config.defaultCustomFields);
				tiddler = store.saveTiddler(tiddler);
				save.push(tiddler);
			}
			autoSaveChanges(null, save)
			refreshAll();
			$(ev.target).attr("disabled", false);
		})
	}
};

})(jQuery);
bag
familytree_public
created
Mon, 17 Oct 2011 13:18:56 GMT
creator
jon
modified
Mon, 17 Oct 2011 13:46:51 GMT
modifier
jon
tags
excludeLists
excludeSearch
systemConfig