├── js ├── lib │ └── raphael-plugins.js └── gedcom │ ├── const.js │ ├── ihm.js │ ├── toolbox.js │ ├── entities.js │ ├── parser.js │ ├── lang.js │ ├── viewer.js │ └── plugins.js ├── ged └── demo │ ├── Document.tex │ ├── top.mpg │ ├── TGC551.ged │ ├── TGC55C.ged │ ├── force.wav │ ├── suntun.mov │ ├── Document.DOC │ ├── Document.pdf │ ├── ImgFile.BMP │ ├── ImgFile.GIF │ ├── ImgFile.JPG │ ├── ImgFile.MAC │ ├── ImgFile.PCX │ ├── ImgFile.PIC │ ├── ImgFile.PNG │ ├── ImgFile.PSD │ ├── ImgFile.TGA │ ├── ImgFile.TIF │ ├── TGC551LF.ged │ ├── TGC55CLF.ged │ ├── enthist.aif │ ├── Document.RTF │ └── README.txt ├── resources ├── male.png ├── childs.png ├── female.png ├── parent.png ├── unknown.png └── css.css ├── LICENSE ├── README.md ├── index.html └── .gitignore /js/lib/raphael-plugins.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ged/demo/Document.tex: -------------------------------------------------------------------------------- 1 | A simple plain TEXT document. -------------------------------------------------------------------------------- /ged/demo/top.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/top.mpg -------------------------------------------------------------------------------- /ged/demo/TGC551.ged: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/TGC551.ged -------------------------------------------------------------------------------- /ged/demo/TGC55C.ged: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/TGC55C.ged -------------------------------------------------------------------------------- /ged/demo/force.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/force.wav -------------------------------------------------------------------------------- /ged/demo/suntun.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/suntun.mov -------------------------------------------------------------------------------- /resources/male.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/resources/male.png -------------------------------------------------------------------------------- /ged/demo/Document.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/Document.DOC -------------------------------------------------------------------------------- /ged/demo/Document.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/Document.pdf -------------------------------------------------------------------------------- /ged/demo/ImgFile.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.BMP -------------------------------------------------------------------------------- /ged/demo/ImgFile.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.GIF -------------------------------------------------------------------------------- /ged/demo/ImgFile.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.JPG -------------------------------------------------------------------------------- /ged/demo/ImgFile.MAC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.MAC -------------------------------------------------------------------------------- /ged/demo/ImgFile.PCX: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.PCX -------------------------------------------------------------------------------- /ged/demo/ImgFile.PIC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.PIC -------------------------------------------------------------------------------- /ged/demo/ImgFile.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.PNG -------------------------------------------------------------------------------- /ged/demo/ImgFile.PSD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.PSD -------------------------------------------------------------------------------- /ged/demo/ImgFile.TGA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.TGA -------------------------------------------------------------------------------- /ged/demo/ImgFile.TIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/ImgFile.TIF -------------------------------------------------------------------------------- /ged/demo/TGC551LF.ged: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/TGC551LF.ged -------------------------------------------------------------------------------- /ged/demo/TGC55CLF.ged: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/TGC55CLF.ged -------------------------------------------------------------------------------- /ged/demo/enthist.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/ged/demo/enthist.aif -------------------------------------------------------------------------------- /resources/childs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/resources/childs.png -------------------------------------------------------------------------------- /resources/female.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/resources/female.png -------------------------------------------------------------------------------- /resources/parent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/resources/parent.png -------------------------------------------------------------------------------- /resources/unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jswale/gedcom-js-viewer/HEAD/resources/unknown.png -------------------------------------------------------------------------------- /js/gedcom/const.js: -------------------------------------------------------------------------------- 1 | var GedcomConst = { 2 | VERSION : "1.0.1", 3 | 4 | path : { 5 | RESSOURCE_PATH : "ged/demo/", 6 | GED_PATH : "ged/demo/TGC55C.ged" 7 | }, 8 | 9 | id : { 10 | CANVAS_ID : "canvas", 11 | HISTORY_ID : "history", 12 | DETAIL_ID : "detail", 13 | CONTENT_ID : "content", 14 | LOG_ID : "log", 15 | QUICK_SELECT_ID : "quickSelect", 16 | CLOSE_DETAIL_ID : "closeDetail", 17 | DOWNLOAD_ID : "download" 18 | }, 19 | 20 | QUERY_PARAM : "root", 21 | 22 | LANGUAGE : "fr", 23 | 24 | SHOW_DOWNLOAD : false, 25 | SHOW_LOG : false, 26 | SHOW_PRIVATE_RECORD : false, 27 | 28 | SHOW_GEOLOC : true, 29 | 30 | indicator : { 31 | personne : "INDI", 32 | famille : "FAM", 33 | source : "SOUR", 34 | note : "NOTE", 35 | newLine : "CONT", 36 | append : "CONC" 37 | 38 | }, 39 | 40 | logLevels : { 41 | DEBUG : 0, 42 | INFO : 1, 43 | WARN : 2, 44 | ERROR : 3 45 | }, 46 | 47 | logLevel : 3 48 | 49 | }; 50 | -------------------------------------------------------------------------------- /js/gedcom/ihm.js: -------------------------------------------------------------------------------- 1 | /* Required : GedcomConst */ 2 | /* Required : GedcomLang */ 3 | var GedcomIHM = { 4 | init : function() { 5 | $(GedcomConst.id.DETAIL_ID).hide(); 6 | 7 | if (!GedcomConst.SHOW_LOG) { 8 | $(GedcomConst.id.LOG_ID).hide(); 9 | } 10 | 11 | if (!GedcomConst.SHOW_DOWNLOAD) { 12 | $(GedcomConst.id.DOWNLOAD_ID).hide(); 13 | } 14 | 15 | $(GedcomConst.id.CLOSE_DETAIL_ID).update(GedcomLang.$.index.close); 16 | $(GedcomConst.id.HISTORY_ID).firstDescendant().update(GedcomLang.$.index.history); 17 | $(GedcomConst.id.LOG_ID).firstDescendant().update(GedcomLang.$.index.log); 18 | }, 19 | 20 | fillQuickValues : function(options) { 21 | var select = $(GedcomConst.id.QUICK_SELECT_ID); 22 | 23 | options = [{ 24 | text : "--- " + GedcomLang.$.index.quickSelect + " ---", 25 | value : "" 26 | }].concat(options); 27 | 28 | options.each(function(option) { 29 | select.appendChild(new Element("option").update(option.text).writeAttribute("value", option.value)); 30 | }, this); 31 | 32 | } 33 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2014 Jonathan Swale 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------- 2 | Note de version pour Gedcom Viewer 1.0.1 (15/03/2012) 3 | ---------------------------------------------------- 4 | Améliorations : 5 | - Support multilangue (fr, en) 6 | - Affichage de la géolocalisation des adresses 7 | - Personnalisation du texte des boites dans l'arbre (entities::Personne::getBoxText) 8 | - Accès rapide aux personnes de l'arbre 9 | 10 | Correctifs : 11 | - Affichage du sexe des personnes de gende inconnu 12 | 13 | ---------------------------------------------------- 14 | Note de version pour Gedcom Viewer 1.0.0 (8/03/2012) 15 | ---------------------------------------------------- 16 | Améliorations : 17 | - Affichage de l'arbre autour d'une personne (parents, conjoint, enfants) 18 | - Détail des individus 19 | - Gestion des ressources (fichiers annexes cités dans le fichier) 20 | - Gestion du caractère privé des enregistrement 21 | - Gestion des données d'un individu via un système de plugins qui peuvent être désactivés ou ajoutés : 22 | - 56 plugins existants 23 | - 7 plugins obligatoires 24 | - Système de log d'exécution 25 | - Affichage de l'historique de consultation 26 | - Gestion des familles mono parentale 27 | - Gestion des sources 28 | - Gestion des notes -------------------------------------------------------------------------------- /ged/demo/Document.RTF: -------------------------------------------------------------------------------- 1 | {\rtf1\mac\ansicpg10000\uc1 \deff0\deflang1033\deflangfe1033{\upr{\fonttbl{\f0\fnil\fcharset256\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f4\fnil\fcharset256\fprq2{\*\panose 02000500000000000000}Times;} }{\*\ud{\fonttbl{\f0\fnil\fcharset256\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f4\fnil\fcharset256\fprq2{\*\panose 02000500000000000000}Times;}}}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255; \red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0; \red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \f4\cgrid \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title A simple plain TEXT document}{\author John A. Nairn}{\operator John A. Nairn} {\creatim\yr2000\mo6\dy8\hr14\min22}{\revtim\yr2000\mo6\dy8\hr14\min22}{\version2}{\edmins1}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company University of Utah}{\nofcharsws0}{\vern115}} \widowctrl\ftnbj\aenddoc\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}} {\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (} {\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \widctlpar\adjustright \f4\cgrid {A simple }{\b Microsoft Word}{ document with }{\i\cf6 style}{ information but saved as a Rich Text Format (RTF) document. \par }} -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Arbre généalogique 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | Télécharger GEDCOM Viewer v1.0 40 |
41 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /resources/css.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | margin-top: 5px; 4 | text-align: center; 5 | background-color: #2C2C29; 6 | color: #2C2C29; 7 | font-family: Tahoma; 8 | font-size: 11px; 9 | } 10 | 11 | #detail { 12 | margin-top: 10px; 13 | margin-left: auto; 14 | margin-right: auto; 15 | width: 800px; 16 | border: 1px solid black; 17 | border-radius: 8px 8px 8px 8px; 18 | background-color: #EEEEEE; 19 | font-size: 12px; 20 | text-align: left; 21 | box-shadow: 0 0 8px #FFFFFF; 22 | position: relative; 23 | padding: 5px; 24 | } 25 | 26 | ul { 27 | margin: 0px; 28 | padding-left: 20px; 29 | } 30 | 31 | #history,#log { 32 | text-align: left; 33 | color: #FEFEFE; 34 | width: 400px; 35 | margin-top: 10px; 36 | margin-left: auto; 37 | margin-right: auto; 38 | padding-bottom: 30px; 39 | } 40 | 41 | #quick { 42 | text-align: center; 43 | color: #FEFEFE; 44 | padding-bottom: 10px; 45 | width: 400px; 46 | margin-top: 10px; 47 | margin-left: auto; 48 | margin-right: auto; 49 | } 50 | 51 | #download { 52 | color: #FEFEFE; 53 | width: 400px; 54 | margin-top: 10px; 55 | margin-left: auto; 56 | margin-right: auto; 57 | padding-bottom: 30px; 58 | } 59 | 60 | #download a { 61 | color: #E0E0E0; 62 | } 63 | 64 | #log { 65 | width: 600px; 66 | } 67 | 68 | #log .DEBUG { 69 | color: green; 70 | } 71 | 72 | #log .INFO { 73 | color: #FEFEFE; 74 | } 75 | 76 | #log .WARN { 77 | color: yellow; 78 | } 79 | 80 | #log .ERROR { 81 | color: red; 82 | } 83 | 84 | #history div.title,#log div.title { 85 | text-align: center; 86 | border-bottom: 1px solid #FFF; 87 | margin-bottom: 5px; 88 | } 89 | 90 | #history a,#log a { 91 | color: #E0E0E0; 92 | } 93 | 94 | .close { 95 | position: absolute; 96 | top: -1px; 97 | right: -1px; 98 | margin: 0px; 99 | padding: 5px; 100 | font-weight: bold; 101 | border-radius: 0px 8px 0px 8px; 102 | background-color: #2C2C29; 103 | box-shadow: -2px 2px 3px #2C2C29; 104 | color: #FEFEFE; 105 | } 106 | 107 | #detail th { 108 | width: 150px; 109 | text-align: right; 110 | vertical-align: top; 111 | text-decoration: underline; 112 | white-space: nowrap; 113 | } 114 | 115 | th,td { 116 | padding-bottom: 5px; 117 | vertical-align: top; 118 | } 119 | 120 | .childs { 121 | margin-left: 20px; 122 | } 123 | 124 | #detail a { 125 | color: #404040; 126 | } 127 | 128 | #detail li { 129 | margin-bottom: 5px; 130 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | *_i.c 48 | *_p.c 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.vspscc 63 | .builds 64 | *.dotCover 65 | 66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 67 | #packages/ 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | 80 | # ReSharper is a .NET coding add-in 81 | _ReSharper* 82 | 83 | # Installshield output folder 84 | [Ee]xpress 85 | 86 | # DocProject is a documentation generator add-in 87 | DocProject/buildhelp/ 88 | DocProject/Help/*.HxT 89 | DocProject/Help/*.HxC 90 | DocProject/Help/*.hhc 91 | DocProject/Help/*.hhk 92 | DocProject/Help/*.hhp 93 | DocProject/Help/Html2 94 | DocProject/Help/html 95 | 96 | # Click-Once directory 97 | publish 98 | 99 | # Others 100 | [Bb]in 101 | [Oo]bj 102 | sql 103 | TestResults 104 | *.Cache 105 | ClientBin 106 | stylecop.* 107 | ~$* 108 | *.dbmdl 109 | Generated_Code #added for RIA/Silverlight projects 110 | 111 | # Backup & report files from converting an old project file to a newer 112 | # Visual Studio version. Backup files are not needed, because we have git ;-) 113 | _UpgradeReport_Files/ 114 | Backup*/ 115 | UpgradeLog*.XML 116 | 117 | 118 | 119 | ############ 120 | ## Windows 121 | ############ 122 | 123 | # Windows image file caches 124 | Thumbs.db 125 | 126 | # Folder config file 127 | Desktop.ini 128 | 129 | 130 | ############# 131 | ## Python 132 | ############# 133 | 134 | *.py[co] 135 | 136 | # Packages 137 | *.egg 138 | *.egg-info 139 | dist 140 | build 141 | eggs 142 | parts 143 | bin 144 | var 145 | sdist 146 | develop-eggs 147 | .installed.cfg 148 | 149 | # Installer logs 150 | pip-log.txt 151 | 152 | # Unit test / coverage reports 153 | .coverage 154 | .tox 155 | 156 | #Translations 157 | *.mo 158 | 159 | #Mr Developer 160 | .mr.developer.cfg 161 | 162 | # Mac crap 163 | .DS_Store 164 | -------------------------------------------------------------------------------- /js/gedcom/toolbox.js: -------------------------------------------------------------------------------- 1 | /* Required : GedcomConst */ 2 | /* Required : GedcomLang */ 3 | var GedcomToolbox = { 4 | 5 | idSeed : 100, 6 | 7 | id : function(prefix) { 8 | return (prefix || "") + ++this.idSeed; 9 | }, 10 | 11 | getSexeImage : function(s) { 12 | switch (s) { 13 | case "M" : 14 | return "male.png"; 15 | case "F" : 16 | return "female.png"; 17 | default : 18 | return "unknown.png"; 19 | } 20 | }, 21 | 22 | getQueryParameter : function(parameterName) { 23 | var queryString = window.top.location.search.substring(1); 24 | var parameterName = parameterName + "="; 25 | if (queryString.length > 0) { 26 | begin = queryString.indexOf(parameterName); 27 | if (begin != -1) { 28 | begin += parameterName.length; 29 | end = queryString.indexOf("&", begin); 30 | if (end == -1) { 31 | end = queryString.length; 32 | } 33 | return unescape(queryString.substring(begin, end)); 34 | } 35 | } 36 | return null; 37 | }, 38 | 39 | displayAddress : function(id) { 40 | var o = $("map" + id); 41 | if (o.visible()) { 42 | o.hide(); 43 | $("mapLink" + id).update(GedcomLang.$.plugins.helper.dateAndPlace.displayMap); 44 | } else { 45 | if (o.src == "") { 46 | var q = $(id).innerHTML.replace(new RegExp("", "g"), " "); 47 | o.src = "http://maps.google.fr/maps?&q=" + q + "&output=embed"; 48 | } 49 | o.show(); 50 | $("mapLink" + id).update(GedcomLang.$.plugins.helper.dateAndPlace.hideMap); 51 | } 52 | }, 53 | 54 | show : function(id) { 55 | var query = id || GedcomToolbox.getQueryParameter(GedcomConst.QUERY_PARAM) 56 | || parser.DATAS.find(function(d) { 57 | return d.value.type == GedcomConst.indicator.famille; 58 | })[0]; 59 | 60 | var p = parser.getData(query); 61 | if (!p) { 62 | return; 63 | } 64 | viewer.setRoot(p); 65 | 66 | switch (p.type) { 67 | case GedcomConst.indicator.personne : 68 | viewer.openDetail(p); 69 | break; 70 | 71 | case GedcomConst.indicator.famille : 72 | $(GedcomConst.id.DETAIL_ID).hide(); 73 | break; 74 | } 75 | } 76 | 77 | }; 78 | 79 | var log = { 80 | 81 | debug : function(t) { 82 | if (GedcomConst.logLevel <= GedcomConst.logLevels.DEBUG) { 83 | this.display(GedcomConst.logLevels.DEBUG, t); 84 | } 85 | }, 86 | info : function(t) { 87 | if (GedcomConst.logLevel <= GedcomConst.logLevels.INFO) { 88 | this.display(GedcomConst.logLevels.INFO, t); 89 | } 90 | }, 91 | warn : function(t) { 92 | if (GedcomConst.logLevel <= GedcomConst.logLevels.WARN) { 93 | this.display(GedcomConst.logLevels.WARN, t); 94 | } 95 | }, 96 | error : function(t, error) { 97 | if (GedcomConst.logLevel <= GedcomConst.logLevels.ERROR) { 98 | this.display(GedcomConst.logLevels.ERROR, t); 99 | } 100 | console.log(error); 101 | }, 102 | 103 | display : function log(level, t) { 104 | if(!GedcomConst.SHOW_LOG) { 105 | return; 106 | } 107 | 108 | var c = " "; 109 | if (null != t) { 110 | 111 | // Calcul de la date; 112 | var d = new Date(); 113 | var dts = [2, 2, 2, 3]; 114 | var dt = [d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()].collect(function(v, i) { 115 | v = v.toString(); 116 | return $R(v.length, dts[i], true).collect(function() { 117 | return "0"; 118 | }).join("") + v; 119 | }, this).join(":"); 120 | 121 | var lt; 122 | switch (level) { 123 | case GedcomConst.logLevels.DEBUG : 124 | lt = "DEBUG"; 125 | break; 126 | case GedcomConst.logLevels.INFO : 127 | lt = "INFO"; 128 | break; 129 | case GedcomConst.logLevels.WARN : 130 | lt = "WARN"; 131 | break; 132 | case GedcomConst.logLevels.ERROR : 133 | lt = "ERROR"; 134 | break; 135 | } 136 | 137 | // 138 | c = "[" + dt + "] [" + lt + "] " + t; 139 | } 140 | $(GedcomConst.id.LOG_ID).appendChild(new Element("div").addClassName(lt).update(c)); 141 | } 142 | }; -------------------------------------------------------------------------------- /js/gedcom/entities.js: -------------------------------------------------------------------------------- 1 | /* Required : GedcomConst */ 2 | /* Required : GedcomLang */ 3 | /* Required : GedcomPlugins */ 4 | /* Required : GedcomParser */ 5 | 6 | GedcomPlugins.setRequired("deat"); 7 | GedcomPlugins.setRequired("privacy"); 8 | GedcomPlugins.setRequired("sexe"); 9 | GedcomPlugins.setRequired("name"); 10 | GedcomPlugins.setRequired("birt"); 11 | 12 | // /////////// 13 | // PERSONNE // 14 | // /////////// 15 | var Personne = Class.create(); 16 | Personne.prototype = { 17 | type : GedcomConst.indicator.personne, 18 | data : null, 19 | id : null, 20 | plugin : null, 21 | 22 | pluginsLoaded : false, 23 | 24 | getValue : function(key) { 25 | return this.plugin[key]; 26 | }, 27 | 28 | inject : function(parser) { 29 | GedcomPlugins.getPlugins(true).each(function(plugin) { 30 | if (Object.isFunction(plugin.inject)) { 31 | plugin.inject(this, parser); 32 | } 33 | }, this); 34 | }, 35 | 36 | initialize : function(data) { 37 | this.plugin = {}; 38 | this.id = data.type; 39 | this.data = data; 40 | try { 41 | this.loadPlugins(data, true); 42 | } catch (e) { 43 | log.error("Parser::Personne::initialize -> id:" + this.id, e); 44 | } 45 | }, 46 | 47 | loadPlugins : function(data, required) { 48 | if (!this.pluginsLoaded) { 49 | GedcomPlugins.getPlugins(required).each(function(plugin) { 50 | plugin.parser(this, data); 51 | }, this); 52 | if (!required) { 53 | this.pluginsLoaded = true; 54 | } 55 | } 56 | }, 57 | 58 | isDead : function() { 59 | return !!this.getValue("deat"); 60 | }, 61 | 62 | isPublic : function() { 63 | if (GedcomConst.SHOW_PRIVATE_RECORD) { 64 | return true; 65 | } 66 | return ("privacy" != this.getValue("privacy")); 67 | }, 68 | 69 | getBoxText : function(defaultTxtAttr, navigation) { 70 | var lines = []; 71 | lines.push({ 72 | key : "name", 73 | txt : this.getDisplayName("\n"), 74 | attrs : Object.extend({ 75 | "font-weight" : "bold" 76 | }, defaultTxtAttr) 77 | }); 78 | lines.push({ 79 | key : "dates", 80 | txt : this.getDisplayDate(), 81 | attrs : defaultTxtAttr 82 | }); 83 | return lines; 84 | }, 85 | 86 | getDisplayName : function(nameJoiner) { 87 | try { 88 | var txt = []; 89 | if (this.isPublic()) { 90 | if (this.getValue("sexe")) { 91 | switch (this.getValue("sexe")) { 92 | case "M" : 93 | txt.push(GedcomLang.$.personne.sexe.M); 94 | break; 95 | 96 | case "F" : 97 | txt.push(GedcomLang.$.personne.sexe.F); 98 | break; 99 | } 100 | } 101 | if (this.getValue("name").length > 0) { 102 | txt.push(this.getValue("name").join(nameJoiner)); 103 | } 104 | } else { 105 | txt.push("- " + GedcomLang.$.personne.privacy + " -"); 106 | } 107 | return txt.join(" "); 108 | } catch (e) { 109 | log.error("Parser::getDisplayName", e); 110 | } 111 | }, 112 | 113 | getDisplayDate : function() { 114 | try { 115 | if (!this.isPublic()) { 116 | return null; 117 | } 118 | 119 | if (!this.getValue("birt") && !this.getValue("deat")) { 120 | return null; 121 | } 122 | 123 | return [this.getValue("birt") && this.getValue("birt").date || "", 124 | this.getValue("deat") && this.getValue("deat").date || ""].join(" - "); 125 | 126 | } catch (e) { 127 | log.error("Parser::getDisplayDate", e); 128 | } 129 | } 130 | }; 131 | 132 | // ////////// 133 | // FAMILLE // 134 | // ////////// 135 | var Famille = Class.create(); 136 | Famille.prototype = { 137 | type : GedcomConst.indicator.famille, 138 | id : null, 139 | husb : null, 140 | wife : null, 141 | marr : null, 142 | childs : null, 143 | 144 | initialize : function(data) { 145 | try { 146 | // Extraction des données 147 | { 148 | this.id = data.type; 149 | 150 | // Mari 151 | this.husb = GedcomParser.getChild(data, "HUSB", true); 152 | 153 | // Femme 154 | this.wife = GedcomParser.getChild(data, "WIFE", true); 155 | 156 | // Informations du mariage 157 | this.marr = GedcomParser.extractDateAndPlace(GedcomParser.getChild(data, "MARR")); 158 | 159 | // Enfants 160 | this.childs = GedcomParser.getChilds(data, "CHIL", true); 161 | 162 | } 163 | 164 | } catch (e) { 165 | log.error("Parser::Famille::initialize -> id:" + this.id, e); 166 | } 167 | }, 168 | 169 | inject : function(parser) { 170 | if (this.husb) { 171 | this.husb = parser.getData(this.husb); 172 | } 173 | if (this.wife) { 174 | this.wife = parser.getData(this.wife); 175 | } 176 | this.childs = this.childs.collect(function(child) { 177 | return parser.getData(child); 178 | }, this); 179 | } 180 | 181 | }; 182 | 183 | // ///////// 184 | // SOURCE // 185 | // ///////// 186 | var Source = Class.create(); 187 | Source.prototype = { 188 | type : GedcomConst.indicator.source, 189 | id : null, 190 | 191 | title : null, 192 | abbr : null, 193 | auth : null, 194 | publ : null, 195 | text : null, 196 | notes : null, 197 | 198 | initialize : function(data) { 199 | try { 200 | // Extraction des données 201 | { 202 | this.id = data.type; 203 | 204 | this.title = GedcomParser.getChild(data, "TITL", true); 205 | this.abbr = GedcomParser.getChild(data, "ABBR", true); 206 | this.auth = GedcomParser.getChild(data, "AUTH", true); 207 | this.publ = GedcomParser.getChild(data, "PUBL", true); 208 | this.text = GedcomParser.getChild(data, "TEXT", true); 209 | this.notes = GedcomParser.getChilds(data, "NOTE", true); 210 | } 211 | 212 | } catch (e) { 213 | log.error("Parser::Source::initialize -> id:" + this.id, e); 214 | } 215 | } 216 | }; 217 | 218 | // /////// 219 | // NOTE // 220 | // /////// 221 | var Note = Class.create(); 222 | Note.prototype = { 223 | type : GedcomConst.indicator.note, 224 | id : null, 225 | text : null, 226 | 227 | initialize : function(data) { 228 | try { 229 | // Extraction des données 230 | { 231 | this.id = data.type; 232 | 233 | // Text 234 | this.text = data.text; 235 | } 236 | 237 | } catch (e) { 238 | log.error("Parser::Note::initialize -> id:" + this.id, e); 239 | } 240 | } 241 | }; -------------------------------------------------------------------------------- /js/gedcom/parser.js: -------------------------------------------------------------------------------- 1 | /* Required : GedcomToolbox */ 2 | /* Required : GedcomConst */ 3 | /* Required : GedcomLang */ 4 | var GedcomParser = Class.create(); 5 | GedcomParser.prototype = { 6 | 7 | // Variables privées 8 | DATAS : null, 9 | 10 | initialize : function() { 11 | }, 12 | 13 | load : function(file) { 14 | log.info(); 15 | log.info("Parser::Loading " + file); 16 | new Ajax.Request(file, { 17 | method: 'GET', 18 | onSuccess : function(response) { 19 | log.debug("loading ok"); 20 | this.parse(response.responseText); 21 | }.bind(this) 22 | }); 23 | }, 24 | 25 | node : function(type, value, level) { 26 | return { 27 | value : value, 28 | type : type, 29 | level : level, 30 | childs : [] 31 | }; 32 | }, 33 | 34 | parse : function(gedcom) { 35 | var lines = gedcom.match(/[^\r\n]+/g); 36 | log.debug(lines.length + " lines extracted"); 37 | 38 | // Create root node 39 | var data = this.node(null, null); 40 | 41 | // Initialise parents 42 | var parents = [data]; 43 | 44 | // Previous node level 45 | var _level = null; 46 | 47 | $A(lines).each(function(line, i) { 48 | var current = this.extract(line, i); 49 | 50 | // Erreur de traitement de la ligne 51 | if (null == current) { 52 | return; 53 | } 54 | 55 | // Réduction de la liste des parents 56 | if (null != _level && current.level <= _level) { 57 | $R(current.level, _level).each(function() { 58 | parents.pop(); 59 | }, this); 60 | } 61 | 62 | // Recherche du dernier parent 63 | parent = parents[parents.length - 1]; 64 | 65 | if (current.ident == GedcomConst.indicator.append || current.ident == GedcomConst.indicator.newLine) { 66 | node = parent; 67 | var key = (node.level == 0) ? "text" : "value"; 68 | 69 | var v = current.value || ""; 70 | if (Object.isUndefined(node[key])) { 71 | node[key] = v; 72 | } else { 73 | node[key] += (current.ident == GedcomConst.indicator.newLine ? "
" : "") + v; 74 | } 75 | 76 | } else { 77 | // Nouveau noeud 78 | var node = this.node(current.ident, current.value, current.level); 79 | 80 | // Ajout du nouveau noeud au parent 81 | parent.childs.push(node); 82 | } 83 | 84 | // Ajout du dernier noeud en tant que parent 85 | parents.push(node); 86 | 87 | // Mémorisation du niveau du noeud 88 | _level = current.level; 89 | }, this); 90 | 91 | // analyze 92 | this.analyze(data); 93 | }, 94 | 95 | extract : function(line, i) { 96 | var result = line.trim().match(/(\d) ([^ ]*) ?(.*)?/); 97 | // Ligne non conforme 98 | if (null == result) { 99 | return null; 100 | } 101 | result.shift(); 102 | 103 | result = result.compact(); 104 | return { 105 | level : result[0], 106 | ident : result[1], 107 | value : result[2] 108 | }; 109 | }, 110 | 111 | getData : function(id) { 112 | return this.DATAS.get(id); 113 | }, 114 | 115 | analyze : function(data) { 116 | log.info(); 117 | log.info("Parser::Extraction :"); 118 | 119 | this.DATAS = $H(); 120 | (data.childs || []).each(function(child, i) { 121 | try { 122 | 123 | var data = null; 124 | 125 | if (GedcomConst.indicator.personne == child.value) { 126 | data = new Personne(child); 127 | } else if (GedcomConst.indicator.famille == child.value) { 128 | data = new Famille(child); 129 | } else if (GedcomConst.indicator.source == child.value) { 130 | data = new Source(child); 131 | } else if (GedcomConst.indicator.note == child.value) { 132 | data = new Note(child); 133 | } else { 134 | log.warn("Parser::analyze -> unknow -> " + child.type 135 | + (child.value ? ' (' + child.value + ')' : '')); 136 | } 137 | 138 | if (data) { 139 | this.DATAS.set(child.type, data); 140 | } 141 | 142 | } catch (e) { 143 | log.error("Parser::analyze -> each", e); 144 | } 145 | }, this); 146 | 147 | log.debug(this.DATAS.size() + " bloc chargés"); 148 | 149 | // Post traitement 150 | var options = []; 151 | [GedcomConst.indicator.personne, GedcomConst.indicator.famille].each(function(type) { 152 | try { 153 | log.debug("Parser::analyze -> inject for " + type); 154 | this.DATAS.each(function(pair) { 155 | if (pair.value.type != type) { 156 | return; 157 | } 158 | try { 159 | if (Object.isFunction(pair.value.inject)) { 160 | pair.value.inject(this); 161 | } 162 | if (pair.value.type == GedcomConst.indicator.personne && pair.value.isPublic()) { 163 | options.push({ 164 | text : pair.value.getDisplayName(GedcomLang.$.viewer.multipleNameSeparator), 165 | value : pair.value.id 166 | }); 167 | } 168 | } catch (e) { 169 | log.error("Parser::analyze -> inject", e); 170 | } 171 | }, this); 172 | } catch (e) { 173 | log.error("Parser::inject -> each", e); 174 | } 175 | }, this); 176 | 177 | GedcomIHM.fillQuickValues(options); 178 | 179 | GedcomToolbox.show(); 180 | 181 | } 182 | }; 183 | 184 | GedcomParser.getChild = function(n, type, value) { 185 | if (null == n) { 186 | return null; 187 | } 188 | var v = (n.childs || []).find(function(c) { 189 | return c.type == type; 190 | }); 191 | if (v && value) { 192 | v = v.value; 193 | } 194 | return v; 195 | }; 196 | 197 | GedcomParser.getChilds = function(n, type, value) { 198 | var res = []; 199 | (n.childs || []).each(function(c) { 200 | if (c.type == type) { 201 | if (value) { 202 | res.push(c.value); 203 | } else { 204 | res.push(c); 205 | } 206 | } 207 | }); 208 | return res; 209 | }; 210 | 211 | GedcomParser.extractDateAndPlace = function(n) { 212 | if (null == n) { 213 | return null; 214 | } 215 | return { 216 | value : n.value, 217 | date : this.getChild(n, "DATE", true), 218 | place : this.getChild(n, "PLAC", true), 219 | address : this.getChild(n, "ADDR", true), 220 | age : this.getChild(n, "AGE", true), 221 | source : this.getChild(n, "SOUR", true), 222 | notes : this.getChilds(n, "NOTE", true) 223 | }; 224 | }; -------------------------------------------------------------------------------- /ged/demo/README.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------- CONTENTS OF TEST GEDCOM ARCHIVE-------------------------------------------------------------------The four 100%-valid GEDCOM files in this packet are:1. TGC55.ged2. TGC55LF.ged3. TGC551.ged4. TGC551LF.gedThe first two files are identical except the first one ends lines in a single carriage return while the second one ends lines in a carriage return and a line feed. Both formats are allowed by GEDCOM, but some genealogy applications require the line feeds.The second two files are identical to the first two except that the "Joseph Tag Torture" record has only one NAME structure (hence the "1" in the names). According to GEDCOM, multiple name structures are allowed in individual records, but very few programs will recognize the second name. The extra files are provided because some programs actually get corrupted results (sometimes including crashes) when a second name structure occurs. You can try these files instead if you have unexpected problems with the first two files.The remaining files are multimedia files and various other types of files. All of these files are linked to one or more records in the GEDCOM files using GEDCOM OBJE file links. The files are here to see if genealogy applications preserve such file links.------------------------------------------------------------------- NOTES ON THE TEST FILE-------------------------------------------------------------------The following notes can be found in the header record (HEAD) of each file. You can read the notes in there. Unfortunately, very few genealogy applications actually import the header and thus most will simply discard all these notes. You can read them here if the software does not import header data.------------------------------------------------------------------- HEADER RECORD NOTES-------------------------------------------------------------------This file demonstrates all tags that are allowed in GEDCOM 5.5. Here are some comments about the HEADER record and comments about where to look for information on the other 9 types of GEDCOM records. Most other records will have their own notes that describe what to look for in that record and what to hope the importing software will find.Many applications will fail to import these notes. The notes are therefore also provided with the files as a plain-text "Read-Me" file.--------------------------The HEADER Record: This record has all possible tags for a HEADER record. In uses one custom tag ("_HME") to see what the software will say about custom tags.--------------------------INDIVIDUAL Records: This file has a small number of INDIVIDUAL records. The record named "Joseph Tag Torture" has all possible tags for an INDIVIDUAL record. All remaining individuals have less tags. Some test specific features; for example: Name: Standard GEDCOM Filelinks Name: Nonstandard Multimedia Filelinks Name: General Custom Filelinks Name: Extra URL Filelinks These records link to multimedia files mentioned by the GEDCOM standard and to a variety of other types of multimedia files, general files, or URL names. Name: Chris Locked Torture Has a "locked" restriction (RESN) tag - should not be able to edit this record it. This record has one set of notes that is used to test line breaking in notes and a few other text-parsing features of the GEDCOM software. Read those notes to see what they are testing. Name: Sandy Privacy Torture Has a "privacy" restriction (RESN) tag. Is the tag recognized and how is the record displayed and/or printed? Name: Chris Locked Torture Name: Sandy Privacy Torture Name: Pat Smith Torture The three children in this file have unknown sex (no SEX tag). An ancestor tree from each should give five generations of ancestors. Name: Charlie Accented ANSEL Name: Lucy Special ANSEL The notes in these records use all possible special characters in the ANSEL character set. The header of this file denotes this file as using the ANSEL character set. The importing software should handle these special characters in a reasonable way. Name: Torture GEDCOM Matriarch All individuals in this file are related and all are descendants (or spouses of descendants) of Torture GEDCOM Matriarch. A descendant tree or report from this individual should show five generations of descendants.--------------------------FAMILY Records: The FAMILY record for "Joseph Tag Torture" (husband) and "Mary First Jones" (wife) has all tags allowed in family records. All other family records use only a few tags and are used to provide records for extra family links in other records.--------------------------SOURCE Records: There are two SOURCE records in this file. The "Everything You Every Wanted to Know about GEDCOM Tags" source has all possible GEDCOM tags for a SOURCE record. The other source only has only a few tags.--------------------------REPOSITORY Record: There is just one REPOSITORY record and it uses all possible tags for such a record.--------------------------SUBMITTER Records: This file has three SUBMITTER records. The "John A. Nairn" record has all tags allowed in such records. The second and third submitter are to test how programs input files with multiple submitters. The GEDCOM standard does not allow for notes in SUBMITTER records. Look in the "Main Submitter" to verify all address data comes through, that all three phone numbers appear, and that the multimedia file link is preserved.--------------------------MULTIMEDIA OBJECT Record: The one MULTIMEDIA record has all possible tags and even has encoded data for a small image of a flower. There are no known GEDCOM programs that can read or write such records. The record is included here to test how programs might respond to finding multimedia records present. There are possible plans to eliminate encoded multimedia objects in the next version of GEDCOM. In the future all multimedia will be included by links to other files. To test current file links and extended file links, see the "Filelinks" family records described above.--------------------------SUBMISSION Record: The one (maximum allowed) SUBMISSION record in this file has all possible tags for such a record.--------------------------NOTE Records: This file has many NOTE records. These are all linked to other records.--------------------------TRLR Records: This file ends in the standard TRLR record.--------------------------ADDITIONAL NOTES This file was originally created by H. Eichmann at and posted on the Internet.(NOTE: email addresses are listed here with double "at" signs. A rule of GEDCOM parsing is that these should be converted to single "at" at signs, but not many programs follow that rule. In addition, that rule is not needed and may be abandoned in a future version of GEDCOM).This original file was extensively modified by J. A. Nairn using GEDitCOM 2.9.4 (1999-2001) at and posted on the Internet at . Some changes included many more notes, the use or more tags, extensive testing of multimedia file links, and some notes to test all special ANSEL characters.Feel free to copy and use this GEDCOM file for any non-commercial purpose.For selecting the allowed tags, the GEDCOM standard Release 5.5 (2 JAN 1996) was used. Copyright: The Church of Jesus Christ of Latter-Day Saints, .You can download the GEDCOM 5.5 specs from: . You can read the GEDCOM 5.5 specs on the Internet at . -------------------------------------------------------------------------------- /js/gedcom/lang.js: -------------------------------------------------------------------------------- 1 | /* Required : GedcomConst */ 2 | var GedcomLang = { 3 | 4 | language : null, 5 | 6 | $ : null, 7 | 8 | defs : { 9 | 'fr' : { 10 | 'common' : { 11 | 'yes' : "Oui", 12 | 'no' : "Non", 13 | 'when' : "le", 14 | 'where' : "à" 15 | }, 16 | 'index' : { 17 | 'close' : "Fermer", 18 | 'history' : "Historique", 19 | 'log' : "Informations", 20 | 'quickSelect' : "Choix de la personne à afficher" 21 | }, 22 | 'personne' : { 23 | 'privacy' : "Donnée privée", 24 | 'sexe' : { 25 | 'M' : 'M.', 26 | 'F' : 'Mme' 27 | } 28 | }, 29 | 'viewer' : { 30 | 'clicknavigate' : "Cliquez pour centrer sur cette personne", 31 | 'dbclicknavigate' : "Double-cliquez pour centrer sur cette personne", 32 | 'clickopen' : "Cliquez pour ouvrir le détail de cette personne", 33 | 'multipleNameSeparator' : " ou " 34 | }, 35 | 'plugins' : { 36 | 'helper' : { 37 | 'source' : { 38 | 'title' : "Titre", 39 | 'titleAbbr' : "Titre abrégé", 40 | 'author' : "Auteur", 41 | 'dateAndPlace' : "Date et lieu de publication", 42 | 'text' : "Texte", 43 | 'notes' : "Notes" 44 | }, 45 | 'dateAndPlace' : { 46 | 'address' : "Adresse", 47 | 'age' : "âge", 48 | 'source' : "Source", 49 | 'notes' : "Notes", 50 | 'displayMap' : "[Afficher sur une carte]", 51 | 'hideMap' : "[Cacher la carte]" 52 | } 53 | }, 54 | 'privacy' : { 55 | 'title' : "Restriction" 56 | }, 57 | 'sexe' : { 58 | 'title' : "Sexe", 59 | 'M' : "Homme", 60 | 'F' : "Femme", 61 | 'U' : "Inconnu" 62 | }, 63 | 'name' : { 64 | 'title' : "Nom" 65 | }, 66 | 'prenom' : { 67 | 'title' : "Prénom" 68 | }, 69 | 'surn_prefix' : { 70 | 'title' : "Nom de famille (préfix)" 71 | }, 72 | 'nomjf' : { 73 | 'title' : "Nom de famille" 74 | }, 75 | 'name_suffix' : { 76 | 'title' : "Nom de famille (suffix)" 77 | }, 78 | 'nom' : { 79 | 'title' : "Nom d'usage" 80 | }, 81 | 'nickname' : { 82 | 'title' : "Surnom" 83 | }, 84 | 'birt' : { 85 | 'title' : "Naissance" 86 | }, 87 | 'deat' : { 88 | 'title' : "Décès" 89 | }, 90 | 'burri' : { 91 | 'title' : "Sépulture" 92 | }, 93 | 'crem' : { 94 | 'title' : "Crémation" 95 | }, 96 | 'prob' : { 97 | 'title' : "Validation d'un testament" 98 | }, 99 | 'will' : { 100 | 'title' : "Testament" 101 | }, 102 | 'familleParent' : { 103 | 'title' : "Parents" 104 | }, 105 | 'adop' : { 106 | 'title' : "Adoption" 107 | }, 108 | 'nmr' : { 109 | 'title' : "Nombre de mariages" 110 | }, 111 | 'familles' : { 112 | 'title' : "Coinjoint(e)(s)", 113 | 'marriage' : "Mariage", 114 | 'children' : "enfants" 115 | }, 116 | 'familleParentChilds' : { 117 | 'title' : "Frères et soeurs" 118 | }, 119 | 'nchi' : { 120 | 'title' : "Nombre d'enfants du parent" 121 | }, 122 | 'even' : { 123 | 'title' : "Evénements" 124 | }, 125 | 'dscr' : { 126 | 'title' : "Description" 127 | }, 128 | 'cens' : { 129 | 'title' : "Recencement" 130 | }, 131 | 'ssn' : { 132 | 'title' : "N° de sécurité sociale" 133 | }, 134 | 'resi' : { 135 | 'title' : "Lieux de résidences" 136 | }, 137 | 'prop' : { 138 | 'title' : "Biens et possessions" 139 | }, 140 | 'grad' : { 141 | 'title' : "Diplômes" 142 | }, 143 | 'educ' : { 144 | 'title' : "Niveau d'étude" 145 | }, 146 | 'occu' : { 147 | 'title' : "Professions" 148 | }, 149 | 'reti' : { 150 | 'title' : "Retraite" 151 | }, 152 | 'nati' : { 153 | 'title' : "Nationalité" 154 | }, 155 | 'emig' : { 156 | 'title' : "Emigration" 157 | }, 158 | 'immi' : { 159 | 'title' : "Immigration" 160 | }, 161 | 'natu' : { 162 | 'title' : "Naturalisation" 163 | }, 164 | 'reli' : { 165 | 'title' : "Religion" 166 | }, 167 | 'fcom' : { 168 | 'title' : "Première communion" 169 | }, 170 | 'chr' : { 171 | 'title' : "Baptême religieux (enfant)" 172 | }, 173 | 'chra' : { 174 | 'title' : "Baptême religieux (adulte)" 175 | }, 176 | 'bapt' : { 177 | 'title' : "Baptême" 178 | }, 179 | 'conf' : { 180 | 'title' : "Confirmation" 181 | }, 182 | 'bless' : { 183 | 'title' : "Bénédiction religieuse" 184 | }, 185 | 'ordi' : { 186 | 'title' : "Sacrement religieux" 187 | }, 188 | 'ordn' : { 189 | 'title' : "Ordination religieuse" 190 | }, 191 | 'barm' : { 192 | 'title' : "Bar mitzvah" 193 | }, 194 | 'bars' : { 195 | 'title' : "Bas mitzvah" 196 | }, 197 | 'bapl' : { 198 | 'title' : "Baptême
(Eglise des Mormons)" 199 | }, 200 | 'conl' : { 201 | 'title' : "Confirmation
(Eglise des Mormons)" 202 | }, 203 | 'endl' : { 204 | 'title' : "Dotation
(Eglise des Mormons)" 205 | }, 206 | 'slgc' : { 207 | 'title' : "Scellement d'un enfant à ses parents
(Eglise des Mormons)" 208 | }, 209 | 'slgs' : { 210 | 'title' : "Scellement d'un mari et d'une femme
(Eglise des Mormons)" 211 | }, 212 | 'cast' : { 213 | 'title' : "Rang ou statut" 214 | }, 215 | 'titl' : { 216 | 'title' : "Titre de noblesse ou honorifique" 217 | }, 218 | 'sources' : { 219 | 'title' : "Sources" 220 | }, 221 | 'notes' : { 222 | 'title' : "Notes" 223 | }, 224 | 'obje' : { 225 | 'title' : "Documents" 226 | } 227 | } 228 | }, 229 | 'en' : { 230 | 'common' : { 231 | 'yes' : "Yes", 232 | 'no' : "No", 233 | 'when' : "the", 234 | 'where' : "at" 235 | }, 236 | 'index' : { 237 | 'close' : "Close", 238 | 'history' : "History", 239 | 'log' : "Log", 240 | 'quickSelect' : "Choose the person to display" 241 | }, 242 | 'personne' : { 243 | 'privacy' : "Private data", 244 | 'sexe' : { 245 | 'M' : '', 246 | 'F' : '' 247 | } 248 | }, 249 | 'viewer' : { 250 | 'clicknavigate' : "Click to focus on this person", 251 | 'dbclicknavigate' : "Double-click to focus on this person", 252 | 'clickopen' : "Click to open the person's detail", 253 | 'multipleNameSeparator' : " or " 254 | }, 255 | 'plugins' : { 256 | 'helper' : { 257 | 'source' : { 258 | 'title' : "Title", 259 | 'titleAbbr' : "Short title", 260 | 'author' : "Author", 261 | 'dateAndPlace' : "Date and place of publication", 262 | 'text' : "Text", 263 | 'notes' : "Notes" 264 | }, 265 | 'dateAndPlace' : { 266 | 'address' : "Address", 267 | 'age' : "age", 268 | 'source' : "Source", 269 | 'notes' : "Notes", 270 | 'displayMap' : "[Display on the map]", 271 | 'hideMap' : "[Hide the map]" 272 | } 273 | }, 274 | 'privacy' : { 275 | 'title' : "Restriction" 276 | }, 277 | 'sexe' : { 278 | 'title' : "Sex", 279 | 'M' : "Man", 280 | 'F' : "Woman", 281 | 'U' : "Unknown" 282 | }, 283 | 'name' : { 284 | 'title' : "Name" 285 | }, 286 | 'prenom' : { 287 | 'title' : "First name" 288 | }, 289 | 'surn_prefix' : { 290 | 'title' : "Last name (prefix)" 291 | }, 292 | 'nomjf' : { 293 | 'title' : "Last name" 294 | }, 295 | 'name_suffix' : { 296 | 'title' : "Last name (suffix)" 297 | }, 298 | 'nom' : { 299 | 'title' : "Common name" 300 | }, 301 | 'nickname' : { 302 | 'title' : "Nickname" 303 | }, 304 | 'birt' : { 305 | 'title' : "Birthday" 306 | }, 307 | 'deat' : { 308 | 'title' : "Death" 309 | }, 310 | 'burri' : { 311 | 'title' : "Burrial" 312 | }, 313 | 'crem' : { 314 | 'title' : "Cremation" 315 | }, 316 | 'prob' : { 317 | 'title' : "Validation of a will" 318 | }, 319 | 'will' : { 320 | 'title' : "Will" 321 | }, 322 | 'familleParent' : { 323 | 'title' : "Parents" 324 | }, 325 | 'adop' : { 326 | 'title' : "Adoption" 327 | }, 328 | 'nmr' : { 329 | 'title' : "Wedding count" 330 | }, 331 | 'familles' : { 332 | 'title' : "Famillies", 333 | 'children' : "Child(ren)", 334 | 'marriage' : "Wedding" 335 | }, 336 | 'familleParentChilds' : { 337 | 'title' : "Brothers and Sisters" 338 | }, 339 | 'nchi' : { 340 | 'title' : "Children count" 341 | }, 342 | 'even' : { 343 | 'title' : "Events" 344 | }, 345 | 'dscr' : { 346 | 'title' : "Description" 347 | }, 348 | 'cens' : { 349 | 'title' : "Census" 350 | }, 351 | 'ssn' : { 352 | 'title' : "Social Security Number" 353 | }, 354 | 'resi' : { 355 | 'title' : "Places of residence" 356 | }, 357 | 'prop' : { 358 | 'title' : "Property and possessions" 359 | }, 360 | 'grad' : { 361 | 'title' : "Graduates" 362 | }, 363 | 'educ' : { 364 | 'title' : "Level of study" 365 | }, 366 | 'occu' : { 367 | 'title' : "Occupations" 368 | }, 369 | 'reti' : { 370 | 'title' : "Retreat" 371 | }, 372 | 'nati' : { 373 | 'title' : "Nationality" 374 | }, 375 | 'emig' : { 376 | 'title' : "Emigration" 377 | }, 378 | 'immi' : { 379 | 'title' : "Immigration" 380 | }, 381 | 'natu' : { 382 | 'title' : "Naturalization" 383 | }, 384 | 'reli' : { 385 | 'title' : "Religion" 386 | }, 387 | 'fcom' : { 388 | 'title' : "First Communion" 389 | }, 390 | 'chr' : { 391 | 'title' : "Christening (child)" 392 | }, 393 | 'chra' : { 394 | 'title' : "Christening (adult)" 395 | }, 396 | 'bapt' : { 397 | 'title' : "Baptism" 398 | }, 399 | 'conf' : { 400 | 'title' : "Confirmation" 401 | }, 402 | 'bless' : { 403 | 'title' : "Religious blessing" 404 | }, 405 | 'ordi' : { 406 | 'title' : "Religious sacrament" 407 | }, 408 | 'ordn' : { 409 | 'title' : "Religious ordination" 410 | }, 411 | 'barm' : { 412 | 'title' : "Bar mitzvah" 413 | }, 414 | 'bars' : { 415 | 'title' : "Bas mitzvah" 416 | }, 417 | 'bapl' : { 418 | 'title' : "Baptism
(Mormon church)" 419 | }, 420 | 'conl' : { 421 | 'title' : "Confirmation
(Mormon church)" 422 | }, 423 | 'endl' : { 424 | 'title' : "Dotation
(Mormon church)" 425 | }, 426 | 'slgc' : { 427 | 'title' : "Sealing of a child to his parents
(Mormon church)" 428 | }, 429 | 'slgs' : { 430 | 'title' : "Sealing of a husband and wife
(Mormon church)" 431 | }, 432 | 'cast' : { 433 | 'title' : "Cast or status" 434 | }, 435 | 'titl' : { 436 | 'title' : "Title of nobility or honor" 437 | }, 438 | 'sources' : { 439 | 'title' : "Sources" 440 | }, 441 | 'notes' : { 442 | 'title' : "Notes" 443 | }, 444 | 'obje' : { 445 | 'title' : "Documents" 446 | } 447 | } 448 | }, 449 | 'de' : { 450 | 'common' : { 451 | 'yes' : "Ja", 452 | 'no' : "Nein", 453 | 'when' : "am", 454 | 'where' : "in" 455 | }, 456 | 'index' : { 457 | 'close' : "Schließen", 458 | 'history' : "Historie", 459 | 'log' : "Log", 460 | 'quickSelect' : "Wähle die Person um die die Ansicht zentriert werden soll" 461 | }, 462 | 'personne' : { 463 | 'privacy' : "Vertrauliche Daten", 464 | 'sexe' : { 465 | 'M' : 'M', 466 | 'F' : 'W' 467 | } 468 | }, 469 | 'viewer' : { 470 | 'clicknavigate' : "Klicken, um auf diese Person zu zentrieren", 471 | 'dbclicknavigate' : "Klicken, um auf diese Person zu zentrieren", 472 | 'clickopen' : "Klicken, um die Details der Person anzuzeigen", 473 | 'multipleNameSeparator' : " oder " 474 | }, 475 | 'plugins' : { 476 | 'helper' : { 477 | 'source' : { 478 | 'title' : "Titel", 479 | 'titleAbbr' : "Kurztitel", 480 | 'author' : "Autor", 481 | 'dateAndPlace' : "Datum und ort der Publikation", 482 | 'text' : "Text", 483 | 'notes' : "Notizen" 484 | }, 485 | 'dateAndPlace' : { 486 | 'address' : "Adresse", 487 | 'age' : "Alter", 488 | 'source' : "Quelle", 489 | 'notes' : "Notizen", 490 | 'displayMap' : "[Auf der Karte anzeigen]", 491 | 'hideMap' : "[Karte verbergen]" 492 | } 493 | }, 494 | 'privacy' : { 495 | 'title' : "Beschränkungen" 496 | }, 497 | 'sexe' : { 498 | 'title' : "Geschlecht", 499 | 'M' : "Männlich", 500 | 'F' : "Weiblich", 501 | 'U' : "Unbekannt" 502 | }, 503 | 'name' : { 504 | 'title' : "Name" 505 | }, 506 | 'prenom' : { 507 | 'title' : "Vorname" 508 | }, 509 | 'surn_prefix' : { 510 | 'title' : "Nachname (Prefix)" 511 | }, 512 | 'nomjf' : { 513 | 'title' : "Nachname" 514 | }, 515 | 'name_suffix' : { 516 | 'title' : "Nachname (Suffix)" 517 | }, 518 | 'nom' : { 519 | 'title' : "Rufname" 520 | }, 521 | 'nickname' : { 522 | 'title' : "Spitzname" 523 | }, 524 | 'birt' : { 525 | 'title' : "Geboren" 526 | }, 527 | 'deat' : { 528 | 'title' : "Gestorben" 529 | }, 530 | 'burri' : { 531 | 'title' : "Beerdigung" 532 | }, 533 | 'crem' : { 534 | 'title' : "Feuerbestattung" 535 | }, 536 | 'prob' : { 537 | 'title' : "Testamentsvollstreckung" 538 | }, 539 | 'will' : { 540 | 'title' : "Testament" 541 | }, 542 | 'familleParent' : { 543 | 'title' : "Eltern" 544 | }, 545 | 'adop' : { 546 | 'title' : "Adoption" 547 | }, 548 | 'nmr' : { 549 | 'title' : "Anzahl Ehen" 550 | }, 551 | 'familles' : { 552 | 'title' : "Familien", 553 | 'marriage' : "Hochzeit", 554 | 'children' : "Kind(er)" 555 | }, 556 | 'familleParentChilds' : { 557 | 'title' : "Geschwister" 558 | }, 559 | 'nchi' : { 560 | 'title' : "Anzahl Kinder" 561 | }, 562 | 'even' : { 563 | 'title' : "Ereignisse" 564 | }, 565 | 'dscr' : { 566 | 'title' : "Beschreibung" 567 | }, 568 | 'cens' : { 569 | 'title' : "Zensus" 570 | }, 571 | 'ssn' : { 572 | 'title' : "Sozialversicherungsnummer" 573 | }, 574 | 'resi' : { 575 | 'title' : "Wohnorte" 576 | }, 577 | 'prop' : { 578 | 'title' : "Gut und Habe" 579 | }, 580 | 'grad' : { 581 | 'title' : "Abschlüsse" 582 | }, 583 | 'educ' : { 584 | 'title' : "Höchster Abschluss" 585 | }, 586 | 'occu' : { 587 | 'title' : "Berufe" 588 | }, 589 | 'reti' : { 590 | 'title' : "Rente" 591 | }, 592 | 'nati' : { 593 | 'title' : "Nationalität" 594 | }, 595 | 'emig' : { 596 | 'title' : "Auswanderung" 597 | }, 598 | 'immi' : { 599 | 'title' : "Einwanderung" 600 | }, 601 | 'natu' : { 602 | 'title' : "Einbürgerung" 603 | }, 604 | 'reli' : { 605 | 'title' : "Religion" 606 | }, 607 | 'fcom' : { 608 | 'title' : "Erstkommunion" 609 | }, 610 | 'chr' : { 611 | 'title' : "Kindtaufe" 612 | }, 613 | 'chra' : { 614 | 'title' : "Erwachsenentaufe" 615 | }, 616 | 'bapt' : { 617 | 'title' : "Taufe" 618 | }, 619 | 'conf' : { 620 | 'title' : "Konfirmation" 621 | }, 622 | 'bless' : { 623 | 'title' : "Segen" 624 | }, 625 | 'ordi' : { 626 | 'title' : "Kommunion" 627 | }, 628 | 'ordn' : { 629 | 'title' : "Ordination" 630 | }, 631 | 'barm' : { 632 | 'title' : "Bar-Mizwa" 633 | }, 634 | 'bars' : { 635 | 'title' : "Bat-Mizwa" 636 | }, 637 | 'bapl' : { 638 | 'title' : "Baptism
(Mormon church)" 639 | }, 640 | 'conl' : { 641 | 'title' : "Confirmation
(Mormon church)" 642 | }, 643 | 'endl' : { 644 | 'title' : "Dotation
(Mormon church)" 645 | }, 646 | 'slgc' : { 647 | 'title' : "Sealing of a child to his parents
(Mormon church)" 648 | }, 649 | 'slgs' : { 650 | 'title' : "Sealing of a husband and wife
(Mormon church)" 651 | }, 652 | 'cast' : { 653 | 'title' : "Kaste" 654 | }, 655 | 'titl' : { 656 | 'title' : "Adels- und Ehrentitel" 657 | }, 658 | 'sources' : { 659 | 'title' : "Quellen" 660 | }, 661 | 'notes' : { 662 | 'title' : "Notizen" 663 | }, 664 | 'obje' : { 665 | 'title' : "Dokumente" 666 | } 667 | } 668 | } 669 | }, 670 | 671 | setLanguage : function(language) { 672 | this.language = language; 673 | this.$ = this.defs[language]; 674 | } 675 | 676 | }; 677 | 678 | GedcomLang.setLanguage(GedcomConst.LANGUAGE); 679 | -------------------------------------------------------------------------------- /js/gedcom/viewer.js: -------------------------------------------------------------------------------- 1 | /* Required : GedcomConst */ 2 | /* Required : GedcomLang */ 3 | /* Required : GedcomToolbox */ 4 | /* Required : GedcomPlugins */ 5 | var GedcomViewer = Class.create(); 6 | GedcomViewer.prototype = { 7 | 8 | // Constantes 9 | boxSpacerWidth : 20, 10 | boxSpacerHeight : 40, 11 | boxRadius : 10, 12 | boxBorderWidth : 2, 13 | boxMinWidth : 100, 14 | boxMinHeight : 20, 15 | 16 | sandBoxX : -500, 17 | sandBoxY : -500, 18 | 19 | margin : 10, 20 | textMargin : 5, 21 | 22 | arrow : true, 23 | 24 | font : "Arial", 25 | 26 | linkColor : "#EEEEEE", 27 | 28 | // Variables privées 29 | /** @private * */ 30 | familleParentDim : null, 31 | /** @private * */ 32 | parentDim : null, 33 | /** @private * */ 34 | childsDim : null, 35 | /** @private * */ 36 | canvas : null, 37 | /** @private * */ 38 | history : null, 39 | /** @private * */ 40 | detail : null, 41 | /** @private * */ 42 | content : null, 43 | /** @private * */ 44 | r : null, 45 | /** @private * */ 46 | root : null, 47 | /** @private * */ 48 | textSandbox : null, 49 | 50 | /** 51 | * Constructeur 52 | * 53 | * @param id 54 | * identifier de l'element HTML où effectuer le rendu 55 | */ 56 | initialize : function() { 57 | this.canvas = $(GedcomConst.id.CANVAS_ID); 58 | this.history = $(GedcomConst.id.HISTORY_ID); 59 | this.detail = $(GedcomConst.id.DETAIL_ID); 60 | this.content = $(GedcomConst.id.CONTENT_ID); 61 | this.history.hide(); 62 | this.detail.hide(); 63 | 64 | GedcomPlugins.setRequired("familles"); 65 | GedcomPlugins.setRequired("familleParent"); 66 | GedcomPlugins.setRequired("sexe"); 67 | }, 68 | 69 | /** 70 | * Positionne le noeud racide de l'arbre à afficher. 71 | * 72 | * @param {Personne / 73 | * Famille} : racine de type 'Personne' ou 'Famille'. 74 | */ 75 | setRoot : function(root) { 76 | log.info(); 77 | log.info("View::Définition de la racine"); 78 | 79 | var newRoot = root; 80 | 81 | // Recherche de la famille à afficher 82 | if (GedcomConst.indicator.personne == root.type) { 83 | if (root.getValue("familles").length > 0) { 84 | newRoot = root.getValue("familles")[0]; 85 | } else if (root.getValue("familleParent")) { 86 | newRoot = root.getValue("familleParent"); 87 | } 88 | this.history.appendChild(new Element("div").update(this.createHtmlLink(root))); 89 | this.history.show(); 90 | } 91 | 92 | // Mise à jour de la racine 93 | if (this.root && (this.root.id == newRoot.id)) { 94 | return; 95 | } else { 96 | this.root = newRoot; 97 | location.hash = this.root.id; 98 | } 99 | 100 | // Clean 101 | if (this.canvas.hasChildNodes()) { 102 | while (this.canvas.childNodes.length >= 1) { 103 | this.canvas.removeChild(this.canvas.firstChild); 104 | } 105 | } 106 | 107 | // Création du canvas 108 | this.r = Raphael(this.canvas, this.width, this.height); 109 | this.textSandbox = this.r.text(this.sandBoxX, this.sandBoxY); 110 | 111 | // Début du traitement 112 | try { 113 | this.analyze(); 114 | this.display(); 115 | // this.addBorder(); 116 | } catch (e) { 117 | log.error("Viewer::setRoot", e); 118 | } 119 | log.info("View::Fin d'affichage"); 120 | }, 121 | 122 | /** 123 | * Analyse les données. 124 | */ 125 | analyze : function() { 126 | log.info("View::Analyse du noeud racine"); 127 | 128 | var familleParent = []; 129 | var parents = []; 130 | var childs = []; 131 | 132 | var familleParentDimOffset = 0; 133 | 134 | // Si le Père existe 135 | if (this.root.husb) { 136 | // Création de la boite pour le père 137 | parents.push(this.addBox(this.root.husb, "P")); 138 | 139 | if (null != this.root.husb.getValue("familleParent")) { 140 | var gp = this.root.husb.getValue("familleParent").husb; 141 | if (gp) { 142 | familleParent.push(this.addBox(gp, "GP")); 143 | } 144 | 145 | var gm = this.root.husb.getValue("familleParent").wife; 146 | if (gm) { 147 | familleParent.push(this.addBox(gm, "GP")); 148 | } 149 | } else { 150 | familleParentDimOffset += this.getBlocDimensions(this.root.husb).width + this.boxSpacerWidth; 151 | } 152 | } 153 | 154 | if (this.root.wife) { 155 | parents.push(this.addBox(this.root.wife, "P")); 156 | 157 | if (null != this.root.wife.getValue("familleParent")) { 158 | var gp = this.root.wife.getValue("familleParent").husb; 159 | if (gp) { 160 | familleParent.push(this.addBox(gp, "GP")); 161 | } 162 | 163 | var gm = this.root.wife.getValue("familleParent").wife; 164 | if (gm) { 165 | familleParent.push(this.addBox(gm, "GP")); 166 | } 167 | } 168 | } 169 | 170 | for (var ic = 0; ic < this.root.childs.length; ic++) { 171 | childs.push(this.addBox(this.root.childs[ic], "C")); 172 | } 173 | 174 | // Calcul des Largeur / Hauteur 175 | { 176 | this.parentDim = this.getBlocDimensions(parents); 177 | this.parentDim.width += (parents.length - 1) * this.boxSpacerWidth; 178 | 179 | this.familleParentDim = this.getBlocDimensions(familleParent); 180 | this.familleParentDim.width += familleParentDimOffset + (familleParent.length - 1) 181 | * this.boxSpacerWidth; 182 | 183 | this.childsDim = this.getBlocDimensions(childs); 184 | this.childsDim.width += (childs.length - 1) * this.boxSpacerWidth; 185 | } 186 | // FIN ------ 187 | 188 | log.debug("View::Détail de la racine :"); 189 | log.debug(" > " + familleParent.length + " grand parents"); 190 | log.debug(" > " + parents.length + " parents"); 191 | log.debug(" > " + childs.length + " enfants"); 192 | 193 | var height = this.familleParentDim.height + this.boxSpacerHeight + this.parentDim.height 194 | + this.boxSpacerHeight + this.childsDim.height; 195 | var width = Math.max(this.familleParentDim.width, this.parentDim.width, this.childsDim.width); 196 | this.r.setSize(this.margin * 2 + width, this.margin * 2 + height); 197 | }, 198 | 199 | /** 200 | * Créé une boîte pour une personne dans la sandbox 201 | * 202 | * @param {Personne} : 203 | * la personne à afficher 204 | * @return {Personne} personne 205 | */ 206 | addBox : function(p, level) { 207 | log.debug("Création de (" + level + ") " + this.createHtmlLink(p), 1); 208 | p.box = {}; 209 | 210 | var attrs = { 211 | open : { 212 | "img" : GedcomToolbox.getSexeImage(p.getValue("sexe")), 213 | "width" : 16, 214 | "height" : 16, 215 | "title" : GedcomLang.$.viewer.clickopen 216 | }, 217 | tree : { 218 | "img" : null, 219 | "width" : 16, 220 | "height" : 16, 221 | "cursor" : "pointer", 222 | "title" : GedcomLang.$.viewer.clicknavigate 223 | }, 224 | rect : { 225 | "stroke" : "#404040", 226 | "stroke-width" : this.boxBorderWidth, 227 | "stroke-opacity" : 0.75, 228 | "fill" : "#CECECE", 229 | "fill-opacity" : 0.75, 230 | "cursor" : "pointer", 231 | "title" : GedcomLang.$.viewer.dbclicknavigate 232 | } 233 | }; 234 | 235 | switch (p.getValue("sexe")) { 236 | case "M" : 237 | attrs.rect.stroke = "#001E4C"; 238 | attrs.rect.fill = "270-#B1C9ED-#698CB9"; 239 | break; 240 | 241 | case "F" : 242 | attrs.rect.stroke = "#BF0000"; 243 | attrs.rect.fill = "270-#F8C2E3-#EDB1B1"; 244 | break; 245 | } 246 | 247 | if (p.isDead()) { 248 | attrs.rect['stroke'] = '#A0A0A0'; 249 | } 250 | 251 | if ("GP" == level) { 252 | attrs.tree.img = "parent.png"; 253 | } 254 | 255 | if ("C" == level && p.getValue("familles") && p.getValue("familles").length > 0) { 256 | attrs.tree.img = "childs.png"; 257 | } 258 | 259 | var navigation = true; 260 | if (null == attrs.tree.img) { 261 | attrs.tree.height = 0; 262 | attrs.tree.width = 0; 263 | navigation = false; 264 | } 265 | 266 | if (!navigation) { 267 | delete attrs.rect.cursor; 268 | delete attrs.rect.title; 269 | } 270 | 271 | if (!p.isPublic()) { 272 | attrs.open.height = 0; 273 | attrs.open.width = 0; 274 | attrs.open.img = null; 275 | } 276 | 277 | var defaultTxtAttr = { 278 | "fill" : "#000", 279 | "font-size" : 14, 280 | "stroke-opacity" : 1, 281 | "text-anchor" : "middle", 282 | "cursor" : (navigation ? "pointer" : null), 283 | "title" : (navigation ? GedcomLang.$.viewer.dbclicknavigate : null) 284 | }; 285 | 286 | var texts = p.getBoxText(defaultTxtAttr, navigation); 287 | var d = { 288 | width : 0, 289 | height : 0 290 | }; 291 | texts.each(function(t) { 292 | if (t.txt) { 293 | var dim = this.getTextDimensions(t.txt, t.attrs); 294 | d.width = Math.max(d.width, dim.width); 295 | d.height += dim.height + this.textMargin; 296 | } 297 | }, this); 298 | if (d.height > 0) { 299 | d.height -= this.textMargin; 300 | } 301 | 302 | var w = Math.max(this.boxMinWidth, d.width); 303 | var h = Math.max(this.boxMinHeight, d.height); 304 | 305 | var imgs = ["open", "tree"]; 306 | var imgH = 0; 307 | var imgW = 0; 308 | imgs.each(function(img) { 309 | var imgh = attrs[img].height; 310 | imgH += imgh + (imgh > 0 ? 2 : 0); 311 | imgW = Math.max(imgW, attrs[img].width); 312 | }, this); 313 | 314 | var x0 = this.sandBoxX; 315 | var y0 = this.sandBoxY; 316 | var W = w + this.textMargin * 2 + imgW; 317 | var H = Math.max(imgH, h) + this.textMargin * 2; 318 | 319 | p.box.rect = this.r.rect(x0, y0, W, H, this.boxRadius).attr(attrs.rect); 320 | 321 | var imgOffsetY = 4; 322 | if (null != attrs.open.img) { 323 | p.box.open = this.r.image("resources/" + attrs.open.img, x0 + W - imgW - 2, y0 + imgOffsetY, 324 | attrs.open.width, attrs.open.height).attr({ 325 | "title" : attrs.open.title, 326 | "cursor" : "pointer" 327 | }); 328 | p.box.open.node.onclick = function() { 329 | this.openDetail(p); 330 | }.bind(this); 331 | } 332 | 333 | imgOffsetY += 2 + attrs.open.height; 334 | 335 | if (attrs.tree.height > 0) { 336 | p.box.tree = this.r.image("resources/" + attrs.tree.img, x0 + W - imgW - 2, y0 + imgOffsetY, 337 | attrs.tree.width, attrs.tree.height).attr(attrs.tree); 338 | 339 | p.box.tree.node.onclick = function() { 340 | this.setRoot(p); 341 | }.bind(this); 342 | 343 | } 344 | 345 | var textOffsetX = w / 2; 346 | var textOffsetY = 0; 347 | 348 | texts.each(function(t) { 349 | var dim = this.getTextDimensions(t.txt, t.attrs); 350 | if (t.txt) { 351 | p.box["txt_" + t.key] = this.r.text(textOffsetX + this.textMargin + x0, 352 | this.textMargin + y0 + dim.height / 2 + textOffsetY, t.txt, this.r.getFont(this.font)) 353 | .attr(t.attrs); 354 | textOffsetY += dim.height + this.textMargin; 355 | } 356 | }, this); 357 | 358 | // Navigation 359 | if (navigation) { 360 | [p.box.rect].compact().each(function(o) { 361 | o.node.ondblclick = function() { 362 | this.setRoot(p); 363 | }.bind(this); 364 | }, this); 365 | } 366 | 367 | return p; 368 | }, 369 | 370 | /** 371 | * Affiche l'arbre 372 | */ 373 | display : function() { 374 | log.info("View::Affichage de l'arbre"); 375 | try { 376 | 377 | var yOffset = 0; 378 | // Cas des parents avec parents 379 | { 380 | var xOffsetFamilleParent = (this.r.width - this.familleParentDim.width) / 2; 381 | var yOffsetFamilleParent = 0; 382 | var yOffsetParent = 0; 383 | [this.root.husb, this.root.wife].each(function(p) { 384 | if (p) { 385 | if (null != p.getValue("familleParent")) { 386 | 387 | // Positionnement du GP 388 | var gp; 389 | var o = p.getValue("familleParent").husb; 390 | if (o) { 391 | gp = this.placeBox(o, xOffsetFamilleParent, 0); 392 | xOffsetFamilleParent += this.getBlocDimensions(gp).width + this.boxSpacerWidth; 393 | yOffsetFamilleParent = Math.max(yOffsetFamilleParent, this.getBlocDimensions(gp).height); 394 | } 395 | 396 | // Positionnement de la GM 397 | var gm; 398 | var o = p.getValue("familleParent").wife; 399 | if (o) { 400 | gm = this.placeBox(o, xOffsetFamilleParent, 0); 401 | xOffsetFamilleParent += this.getBlocDimensions(gm).width + this.boxSpacerWidth; 402 | yOffsetFamilleParent = Math.max(yOffsetFamilleParent, this.getBlocDimensions(gm).height); 403 | } 404 | 405 | // Positionnement du Fils 406 | this.placeBox(p, this.getParentX(p), this.boxSpacerHeight + this.familleParentDim.height); 407 | yOffsetParent = Math.max(yOffsetParent, this.getBlocDimensions(p).height); 408 | 409 | if (gp) { 410 | this.link(gp, p); 411 | } 412 | if (gm) { 413 | this.link(gm, p); 414 | } 415 | } else { 416 | xOffsetFamilleParent += this.getBlocDimensions(p).width + this.boxSpacerWidth; 417 | } 418 | } 419 | }, this); 420 | if (yOffsetFamilleParent > 0) { 421 | yOffsetFamilleParent += this.boxSpacerHeight; 422 | } 423 | yOffset += yOffsetFamilleParent; 424 | } 425 | 426 | // Cas des parents sans parents 427 | { 428 | if ((this.root.wife && null == this.root.wife.getValue("familleParent")) 429 | && (this.root.husb && null == this.root.husb.getValue("familleParent"))) { 430 | 431 | var xOffsetParent = this.margin; 432 | 433 | var p = this.placeBox(this.root.husb, xOffsetParent, yOffset); 434 | xOffsetParent += this.getBlocDimensions(p).width + this.boxSpacerWidth; 435 | yOffsetParent = Math.max(yOffsetParent, this.getBlocDimensions(p).height); 436 | 437 | var m = this.placeBox(this.root.wife, xOffsetParent, yOffset); 438 | yOffsetParent = Math.max(yOffsetParent, this.getBlocDimensions(m).height); 439 | } 440 | } 441 | 442 | // Cas du mari sans parents 443 | { 444 | if ((this.root.husb && null == this.root.husb.getValue("familleParent")) 445 | && (this.root.wife && null != this.root.wife.getValue("familleParent"))) { 446 | var offset = this.getBlocPosition(this.root.wife).x - this.boxSpacerWidth 447 | - this.getBlocDimensions(this.root.husb).width; 448 | 449 | this.placeBox(this.root.husb, offset, this.getBlocPosition(this.root.wife).y - this.margin); 450 | } 451 | } 452 | 453 | // Cas de la femme sans parents 454 | { 455 | if ((this.root.husb && null != this.root.husb.getValue("familleParent")) 456 | && (this.root.wife && null == this.root.wife.getValue("familleParent"))) { 457 | 458 | var offset = this.getBlocPosition(this.root.husb).x + this.getBlocDimensions(this.root.husb).width 459 | + this.boxSpacerWidth; 460 | 461 | this.placeBox(this.root.wife, offset, this.getBlocPosition(this.root.husb).y - this.margin); 462 | } 463 | } 464 | 465 | // Affichage du lien entre parents 466 | if (this.root.husb && this.root.wife) { 467 | this.link(this.root.husb, this.root.wife); 468 | } 469 | 470 | if (yOffsetParent > 0) { 471 | yOffsetParent += this.boxSpacerHeight; 472 | } 473 | yOffset += yOffsetParent; 474 | 475 | // Affichage des enfants 476 | if (this.root.childs.length > 0) { 477 | 478 | // Positionnement des enfants 479 | var xOffsetChilds = this.margin; 480 | for (var ic = 0; ic < this.root.childs.length; ic++) { 481 | var o = this.placeBox(this.root.childs[ic], xOffsetChilds, yOffset); 482 | xOffsetChilds += this.getBlocDimensions(o).width 483 | + (ic < (this.root.childs.length - 1) ? this.boxSpacerWidth : 0); 484 | } 485 | 486 | // Alignement avec les parents 487 | var px; 488 | if (this.root.husb && this.root.wife) { 489 | px = (this.getBlocPosition(this.root.husb).x + this.getBlocPosition(this.root.wife).x + this 490 | .getBlocDimensions(this.root.husb).width) 491 | / 2; 492 | } else if (this.root.husb) { 493 | px = (this.getBlocPosition(this.root.husb).x + this.getBlocDimensions(this.root.husb).width) / 2; 494 | } else if (this.root.husb) { 495 | px = (this.getBlocPosition(this.root.wife).x + this.getBlocDimensions(this.root.wife).width) / 2; 496 | } 497 | 498 | var xTranslate = Math.max(0, (px - (this.margin + xOffsetChilds) / 2)); 499 | for (var ic = 0; ic < this.root.childs.length; ic++) { 500 | $H(this.root.childs[ic].box).each(function(pair) { 501 | pair.value.translate(xTranslate, 0); 502 | }, this); 503 | } 504 | 505 | // Ajout des lients 506 | for (var ic = 0; ic < this.root.childs.length; ic++) { 507 | this.link(this.root.childs[ic], [this.root.wife, this.root.husb]); 508 | } 509 | } 510 | 511 | // Vérification de la largeur 512 | var maxX = 0; 513 | var maxY = 0; 514 | if (this.root.husb && this.root.husb.getValue("familleParent")) { 515 | [this.root.husb.getValue("familleParent").husb, this.root.husb.getValue("familleParent").wife].each( 516 | function(o) { 517 | if (o) { 518 | maxX = Math.max(maxX, this.getBlocPosition(o).x + this.getBlocDimensions(o).width); 519 | maxY = Math.max(maxY, this.getBlocPosition(o).y + this.getBlocDimensions(o).height); 520 | } 521 | }, this); 522 | } 523 | 524 | if (this.root.wife && this.root.wife.getValue("familleParent")) { 525 | [this.root.wife.getValue("familleParent").husb, this.root.wife.getValue("familleParent").wife].each( 526 | function(o) { 527 | if (o) { 528 | maxX = Math.max(maxX, this.getBlocPosition(o).x + this.getBlocDimensions(o).width); 529 | maxY = Math.max(maxY, this.getBlocPosition(o).y + this.getBlocDimensions(o).height); 530 | } 531 | }, this); 532 | } 533 | 534 | if (this.root.husb) { 535 | maxX = Math.max(maxX, this.getBlocPosition(this.root.husb).x 536 | + this.getBlocDimensions(this.root.husb).width); 537 | maxY = Math.max(maxY, this.getBlocPosition(this.root.husb).y 538 | + this.getBlocDimensions(this.root.husb).height); 539 | } 540 | 541 | if (this.root.wife) { 542 | maxX = Math.max(maxX, this.getBlocPosition(this.root.wife).x 543 | + this.getBlocDimensions(this.root.wife).width); 544 | maxY = Math.max(maxY, this.getBlocPosition(this.root.wife).y 545 | + this.getBlocDimensions(this.root.wife).height); 546 | } 547 | 548 | if (this.root.childs.length > 0) { 549 | maxX = Math.max(maxX, this.getBlocPosition(this.root.childs[this.root.childs.length - 1]).x 550 | + this.getBlocDimensions(this.root.childs[this.root.childs.length - 1]).width); 551 | $A(this.root.childs).each(function(c) { 552 | maxY = Math.max(maxY, this.getBlocPosition(c).y + this.getBlocDimensions(c).height); 553 | }, this); 554 | } 555 | maxX += this.margin; 556 | maxY += this.margin; 557 | 558 | this.r.setSize(maxX, maxY); 559 | } catch (e) { 560 | log.error("Viewer::display", e); 561 | } 562 | }, 563 | 564 | /** 565 | * Positionne le bloc d'une personne 566 | * 567 | * @param {Personne} : 568 | * personne à positionner 569 | * @param {Long} : 570 | * offset en X par rapport à l'origine 571 | * @param {Long} : 572 | * offset en Y par rapport à l'origine 573 | * @return {Personne} p 574 | */ 575 | placeBox : function(p, oX, oY) { 576 | log.debug(" > Positionnement de " + this.createHtmlLink(p)); 577 | var hiddenOffsetX = -this.sandBoxX; 578 | var hiddenOffsetY = -this.sandBoxY; 579 | 580 | $H(p.box).each(function(pair) { 581 | pair.value.translate(hiddenOffsetX + oX, this.margin + hiddenOffsetY + oY); 582 | }, this); 583 | 584 | return p; 585 | }, 586 | 587 | /** 588 | * Affiche le lien entre deux personnes 589 | * 590 | * @param {Personne} : 591 | * personne source 592 | * @param {Personne,Personne[]} : 593 | * personne(s) destination. 594 | * @return {Element} ligne tracée 595 | */ 596 | link : function(s, d) { 597 | log.debug(" > Création d'un lien depuis " + this.createHtmlLink(s)); 598 | var p = []; 599 | 600 | var attrs = { 601 | stroke : this.linkColor, 602 | "stroke-width" : 2, 603 | "stroke-opacity" : 1, 604 | "arrow-end" : this.arrow ? "classic" : "none", 605 | "arrow-start" : this.arrow ? "classic" : "none" 606 | }; 607 | 608 | if (Object.isArray(d)) { 609 | d = d.compact(); 610 | if (1 == d.length) { 611 | d = d[0]; 612 | } 613 | } 614 | 615 | if (!Object.isArray(d)) { 616 | // Same level 617 | if (this.getBlocPosition(s).y == this.getBlocPosition(d).y) { 618 | if (this.getBlocPosition(s).x > this.getBlocPosition(d).x) { 619 | var t = s; 620 | s = d; 621 | d = t; 622 | } 623 | 624 | // Recherche d 625 | 626 | attrs["stroke-width"] = 1; 627 | 628 | var ys = [0]; 629 | if (this.root.marr) { 630 | ys.push(-(attrs['stroke-width'] + 2)); 631 | } 632 | 633 | ys.each(function(offsetY) { 634 | p.push("M" + this.getBlocPosition(s).x + "," + (this.getBlocPosition(s).y + offsetY)); 635 | p.push("m" + (this.boxBorderWidth / 2) + ",0"); 636 | p.push("m" + this.getBlocDimensions(s).width + "," 637 | + (Math.min(this.getBlocDimensions(s).height, this.getBlocDimensions(d).height) / 2)); 638 | p 639 | .push("l" 640 | + (this.getBlocPosition(d).x - this.getBlocPosition(s).x - this.getBlocDimensions(s).width - this.boxBorderWidth) 641 | + ",0"); 642 | }, this); 643 | 644 | delete attrs['arrow-end']; 645 | delete attrs['arrow-start']; 646 | 647 | // Père fils 648 | } else { 649 | if (this.getBlocPosition(s).y > this.getBlocPosition(d).y) { 650 | var t = s; 651 | s = d; 652 | d = t; 653 | } 654 | p.push("M" + this.getBlocPosition(s).x + "," + this.getBlocPosition(s).y); 655 | p.push("m" + (this.getBlocDimensions(s).width / 2) + "," + this.getBlocDimensions(s).height); 656 | p.push("m0," + (this.boxBorderWidth / 2)); 657 | p.push("l0," + (this.boxSpacerHeight / 2)); 658 | p 659 | .push("l0," 660 | + (this.getBlocPosition(d).y - this.getBlocPosition(s).y - this.getBlocDimensions(s).height - this.boxSpacerHeight)); 661 | p.push("L" + ((this.getBlocPosition(d).x + this.getBlocDimensions(d).width / 2)) + "," 662 | + (this.getBlocPosition(d).y - this.boxSpacerHeight / 2 + (this.boxBorderWidth / 2))); 663 | p.push("l0," + (this.boxSpacerHeight / 2 - this.boxBorderWidth / 2)); 664 | 665 | delete attrs['arrow-start']; 666 | } 667 | } else { 668 | // Cas des parents 669 | if (this.getBlocPosition(d[0]).x > this.getBlocPosition(d[1]).x) { 670 | d.reverse(); 671 | } 672 | var midx = this.getBlocPosition(d[1]).x 673 | - (this.getBlocPosition(d[1]).x - this.getBlocPosition(d[0]).x - this.getBlocDimensions(d[0]).width) 674 | / 2; 675 | var midy = this.getBlocPosition(d[0]).y 676 | + Math.min(this.getBlocDimensions(d[0]).height, this.getBlocDimensions(d[1]).height) / 2; 677 | 678 | p.push("M" + this.getBlocPosition(s).x + "," + this.getBlocPosition(s).y); 679 | p.push("m0,-" + (this.boxBorderWidth / 2)); 680 | p.push("m" + (this.getBlocDimensions(s).width / 2) + ",0"); 681 | p.push("l0,-" + (this.boxSpacerHeight / 2)); 682 | p.push("L" + midx + "," 683 | + (this.getBlocPosition(s).y - (this.boxSpacerHeight / 2) - (this.boxBorderWidth / 2))); 684 | p.push("L" + midx + "," + midy); 685 | 686 | delete attrs['arrow-end']; 687 | } 688 | 689 | if (0 == p.length) { 690 | return null; 691 | } 692 | 693 | return this.r.path(p.join("")).attr(attrs); 694 | }, 695 | 696 | /** 697 | * Ajoute une bordure à l'arbre 698 | */ 699 | addBorder : function() { 700 | log.debug("View::Ajout du cadre"); 701 | if (false) { 702 | var step = 50; 703 | for (var i = step; i < this.r.width; i = i + step) { 704 | this.r.path(["M" + i + ",0", "l0," + this.r.height].join("")).attr({ 705 | stroke : "#CECECE", 706 | "stroke-width" : 1, 707 | "stroke-opacity" : 0.5 708 | }); 709 | this.r.text(i, 5, i, this.r.getFont("Museo")); 710 | } 711 | for (var i = step; i < this.r.height; i = i + step) { 712 | this.r.path(["M0," + i, "l" + this.r.width + ",0"].join("")).attr({ 713 | stroke : "#CECECE", 714 | "stroke-width" : 1, 715 | "stroke-opacity" : 0.5 716 | }); 717 | this.r.text(10, i, i, this.r.getFont("Museo")); 718 | } 719 | } 720 | 721 | this.r.rect(1, 1, this.r.width - 1, this.r.height - 1, 0).attr({ 722 | stroke : "#000000", 723 | "stroke-width" : 1, 724 | "stroke-opacity" : 1 725 | }); 726 | }, 727 | 728 | /** 729 | * Retourne les dimensions en largeur et hauteur d'un texte 730 | * 731 | * @param {String} : 732 | * texte à écrire 733 | * @return {width:'', height:''} 734 | */ 735 | getTextDimensions : function(text, attr) { 736 | if (null == text) { 737 | return { 738 | width : 0, 739 | height : 0 740 | }; 741 | } 742 | this.textSandbox.attr(Object.extend({ 743 | 'text-anchor' : 'start', 744 | 'text' : text 745 | }, (attr || {}))); 746 | return { 747 | width : this.textSandbox.getBBox().width, 748 | height : this.textSandbox.getBBox().height 749 | }; 750 | }, 751 | 752 | /** 753 | * Calcule la place occupée par pour un groupe de personnes. 754 | * 755 | * @param {Personne / 756 | * Personne[]} : personne ou tableau de personne 757 | * @return { width : '', height : ''} 758 | */ 759 | getBlocDimensions : function(a) { 760 | a = Object.isArray(a) ? a : [a]; 761 | return { 762 | width : $A(a).sum(function(p) { 763 | return p.box.rect.getBBox().width; 764 | }, this), 765 | 766 | height : $A(a).max(function(p) { 767 | return p.box.rect.getBBox().height; 768 | }) 769 | }; 770 | }, 771 | 772 | /** 773 | * Retour la position d'une personne 774 | * 775 | * @param {Personne} : 776 | * personne 777 | * @return {x:'', y:''} 778 | */ 779 | getBlocPosition : function(p) { 780 | return { 781 | x : p.box.rect.getBBox().x, 782 | y : p.box.rect.getBBox().y 783 | }; 784 | }, 785 | 786 | /** 787 | * Calcule la position en X d'une personne par rapport à ses deux parents 788 | * 789 | * @param {Personne} : 790 | * personne 791 | * @return {Long} position en x 792 | */ 793 | getParentX : function(p) { 794 | var gp = p.getValue("familleParent").husb; 795 | var gm = p.getValue("familleParent").wife; 796 | 797 | if (gp && gm) { 798 | // Aligment sur le milieu de l'espace entre les des deux parents 799 | return (this.getBlocPosition(gp).x + this.getBlocPosition(gm).x + this.getBlocDimensions(gp).width - this 800 | .getBlocDimensions(p).width) 801 | / 2; 802 | } else if (gp) { 803 | // Alignement sur le grand père 804 | return (this.getBlocPosition(gp).x + (this.getBlocDimensions(gp).width - this.getBlocDimensions(p).width) 805 | / 2); 806 | } else { 807 | // Alignement sur la grand mère 808 | return (this.getBlocPosition(gm).x + (this.getBlocDimensions(gm).width - this.getBlocDimensions(p).width) 809 | / 2); 810 | } 811 | 812 | // Aligment sur le milieu de la largeur des deux parents 813 | return (this.getBlocPosition(gm).x + this.getBlocDimensions(gm).width - this.getBlocPosition(gp).x - this 814 | .getBlocDimensions(p).width) 815 | / 2 + this.getBlocPosition(gp).x; 816 | }, 817 | 818 | openDetail : function(p) { 819 | if (!p.isPublic()) { 820 | return; 821 | } 822 | 823 | log.debug("Affichage de " + this.createHtmlLink(p)); 824 | 825 | p.loadPlugins(p.data, false); 826 | 827 | this.content.update("" + GedcomPlugins.getPlugins().collect(function(plugin) { 828 | var v = plugin.writer(p, this); 829 | if (v) { 830 | return ""; 831 | } else { 832 | return ""; 833 | } 834 | }, this).join("") + "
" + plugin.name + "" + v + "
"); 835 | 836 | this.detail.show(); 837 | }, 838 | 839 | createHtmlLink : function(p, f) { 840 | if (null == p) { 841 | return null; 842 | } 843 | return '' 844 | + "" + " " 845 | + p.getDisplayName(GedcomLang.$.viewer.multipleNameSeparator) + ''; 846 | } 847 | 848 | }; -------------------------------------------------------------------------------- /js/gedcom/plugins.js: -------------------------------------------------------------------------------- 1 | /* Required : GedcomConst */ 2 | /* Required : GedcomLang */ 3 | /* Required : GedcomParser */ 4 | /* Required : GedcomToolbox */ 5 | var GedcomPlugins = { 6 | 7 | plugins : [], 8 | 9 | pluginsLoaded : $H(), 10 | 11 | pluginsRequired : $H(), 12 | 13 | setRequired : function(key) { 14 | this.pluginsRequired.set(key, true); 15 | }, 16 | 17 | addPlugin : function(plugin) { 18 | if (this.pluginsLoaded.get(plugin.key)) { 19 | console.log("Plugins:: Plugin [" + plugin.key + "]" + plugin.name + " already loaded"); 20 | return; 21 | } 22 | 23 | if (plugin.active) { 24 | this.plugins.push(plugin); 25 | this.pluginsLoaded.set(plugin.key, true); 26 | } 27 | }, 28 | 29 | getPlugins : function(required) { 30 | return this.plugins.filter(function(plugin) { 31 | return (Object.isUndefined(required) || (required && this.pluginsRequired.get(plugin.key)) || (!required && !this.pluginsRequired 32 | .get(plugin.key))); 33 | }, this); 34 | }, 35 | 36 | sort : function() { 37 | log.info("Plugins:: Tri des plugins"); 38 | this.plugins = this.plugins.sortBy(function(plugin) { 39 | return plugin.order; 40 | }); 41 | }, 42 | 43 | checkRequired : function() { 44 | log.info("Plugins:: Vérification des plugins requis"); 45 | var error = false; 46 | this.pluginsRequired.keys().each(function(plugin) { 47 | if (!this.pluginsLoaded.get(plugin)) { 48 | log.error("Plugin::checkRequired => plugin " + plugin + " missing"); 49 | error = true; 50 | } 51 | }, this); 52 | if (error) { 53 | throw "Plugins manquant"; 54 | } 55 | }, 56 | 57 | doParserDateAndPlaceGroupHelper : function(key, me, data) { 58 | this.plugin[me.key] = GedcomParser.getChilds(data, key).collect(function(o) { 59 | return GedcomParser.extractDateAndPlace(o); 60 | }, this); 61 | }, 62 | 63 | doWriterDateAndPlaceGroupHelper : function(data, scope) { 64 | var d = data.plugin[this.key]; 65 | return d && d.length > 0 66 | ? GedcomPlugins.displayData(d, GedcomPlugins.displayDateAndPlace.bind(scope)) 67 | : null; 68 | }, 69 | 70 | doParserDateAndPlaceHelper : function(key, me, data) { 71 | this.plugin[me.key] = GedcomParser.extractDateAndPlace(GedcomParser.getChild(data, key)); 72 | }, 73 | 74 | doWriterDateAndPlaceHelper : function(data, scope) { 75 | return GedcomPlugins.displayDateAndPlace(data.plugin[this.key]); 76 | }, 77 | 78 | doWriterGroupHelper : function(data, scope) { 79 | var d = data.plugin[this.key]; 80 | return d && d.length > 0 ? GedcomPlugins.displayData(d) : null; 81 | }, 82 | 83 | displayNotes : function(notes) { 84 | return GedcomPlugins.displayData(notes, function(n) { 85 | if (n.match(new RegExp("@N[0-9]+@"))) { 86 | return parser.getData(n).text.replace(new RegExp("\n", "g"), "
"); 87 | } else { 88 | return n; 89 | } 90 | }); 91 | }, 92 | 93 | displaySources : function(notes) { 94 | return GedcomPlugins.displayData(notes, function(n) { 95 | 96 | if (n.match(new RegExp("@.+@"))) { 97 | var o = parser.getData(n); 98 | var s = []; 99 | if (o.title) { 100 | s.push("" + GedcomLang.$.plugins.helper.source.title + " : " + o.title); 101 | } 102 | if (o.abbr) { 103 | s.push("" + GedcomLang.$.plugins.helper.source.titleAbbr + " : " + o.abbr); 104 | } 105 | if (o.auth) { 106 | s.push("" + GedcomLang.$.plugins.helper.source.author + " : " + o.auth); 107 | } 108 | if (o.publ) { 109 | s.push("" + GedcomLang.$.plugins.helper.source.dateAndPlace + " : " + o.publ); 110 | } 111 | if (o.text) { 112 | s.push("" + GedcomLang.$.plugins.helper.source.text + " : " + o.text); 113 | } 114 | if (o.notes && o.notes.length > 0) { 115 | s.push("" + GedcomLang.$.plugins.helper.source.notes + " : " 116 | + GedcomPlugins.displayNotes(o.notes) + ""); 117 | } 118 | return s.join("
"); 119 | } else { 120 | return n; 121 | } 122 | 123 | }); 124 | }, 125 | 126 | displayDateAndPlace : function(n) { 127 | if (null == n) { 128 | return null; 129 | } 130 | 131 | var fn = function(n) { 132 | var shtml = []; 133 | if (n.value) { 134 | switch (n.value) { 135 | case "Y" : 136 | shtml.push(GedcomLang.$.common.yes); 137 | break; 138 | 139 | case "N" : 140 | shtml.push(GedcomLang.$.common.no); 141 | break; 142 | 143 | default : 144 | shtml.push(n.value); 145 | } 146 | shtml.push("
"); 147 | } 148 | if (n.date) { 149 | shtml.push(GedcomLang.$.common.when + " " + n.date); 150 | } 151 | if (n.age) { 152 | shtml.push("(" + GedcomLang.$.plugins.helper.dateAndPlace.age + " " + n.age + ")"); 153 | } 154 | if (n.place) { 155 | shtml.push(GedcomLang.$.common.where + " " + GedcomPlugins.displayLocation(n.place, true)); 156 | } 157 | if (n.address) { 158 | shtml.push("
" + GedcomLang.$.plugins.helper.dateAndPlace.address 159 | + " :
" + GedcomPlugins.displayLocation(n.address, false)) 160 | + "
"; 161 | } 162 | if (n.source) { 163 | shtml.push("
" + GedcomLang.$.plugins.helper.dateAndPlace.source 164 | + " :" + parser.getData(n.source).text) 165 | + "
"; 166 | } 167 | if (n.notes && n.notes.length > 0) { 168 | shtml.push("
" + GedcomLang.$.plugins.helper.dateAndPlace.notes 169 | + " :
" + GedcomPlugins.displayNotes(n.notes) + "
" + "
"); 170 | } 171 | return shtml.join(" "); 172 | }.bind(this); 173 | 174 | return GedcomPlugins.displayData(n, fn); 175 | }, 176 | 177 | displayLocation : function(s, linkInline) { 178 | var id = GedcomToolbox.id("address"); 179 | var html = []; 180 | html.push("" + s + ""); 181 | if (GedcomConst.SHOW_GEOLOC) { 182 | html.push(linkInline ? " " : "
"); 183 | html.push('' + GedcomLang.$.plugins.helper.dateAndPlace.displayMap + ''); 185 | html.push(''); 186 | html.push(linkInline ? " " : "
"); 187 | } 188 | return html.join(""); 189 | }, 190 | 191 | displayData : function(n, fn) { 192 | fn = fn ? fn : function(o) { 193 | return o; 194 | }; 195 | if (Object.isArray(n)) { 196 | if (0 == n.length) { 197 | return null; 198 | } 199 | n = n.compact(); 200 | if (n.length > 1) { 201 | return "
    " + $A(n).collect(function(o) { 202 | return "
  • " + fn(o) + "
  • "; 203 | }, this).join("") + "
"; 204 | } else { 205 | return fn(n[0]); 206 | } 207 | } else { 208 | return fn(n); 209 | } 210 | } 211 | }; 212 | 213 | var Plugin = Class.create(); 214 | Plugin.prototype = { 215 | key : null, 216 | name : null, 217 | order : 5000, 218 | active : true, 219 | 220 | initialize : function(data) { 221 | try { 222 | // Initialisation des données 223 | Object.extend(this, data); 224 | this.name = GedcomLang.$.plugins[this.key] && GedcomLang.$.plugins[this.key].title || this.key; 225 | GedcomPlugins.addPlugin(this); 226 | } catch (e) { 227 | log.error("Plugin::initialize", e); 228 | } 229 | }, 230 | 231 | parser : function(p, data) { 232 | try { 233 | if (Object.isFunction(this.doParser)) { 234 | this.doParser.call(p, this, data); 235 | } 236 | } catch (e) { 237 | log.error("Plugin::" + this.key + "::parser", e); 238 | } 239 | }, 240 | 241 | writer : function(data, scope) { 242 | try { 243 | if (Object.isFunction(this.doWriter)) { 244 | return this.doWriter.call(this, data, scope); 245 | } else { 246 | return data.plugin[this.key]; 247 | } 248 | } catch (e) { 249 | log.error("Plugin::" + this.key + "::writer", e); 250 | } 251 | }, 252 | 253 | inject : function(p, parser) { 254 | try { 255 | if (Object.isFunction(this.doInject)) { 256 | this.doInject.call(p, this, parser); 257 | } 258 | } catch (e) { 259 | log.error("Plugin::" + this.key + "::inject", e); 260 | } 261 | } 262 | 263 | }; 264 | 265 | new Plugin({ 266 | order : 50, 267 | key : "privacy", 268 | doParser : function(me, data) { 269 | this.plugin[me.key] = GedcomParser.getChild(data, "RESN", true); 270 | } 271 | }); 272 | 273 | new Plugin({ 274 | order : 1000, 275 | key : "sexe", 276 | doParser : function(me, data) { 277 | this.plugin[me.key] = GedcomParser.getChild(data, "SEX", true); 278 | }, 279 | doWriter : function(data, scope) { 280 | var s = data.plugin[this.key]; 281 | var r = [""]; 282 | switch (s) { 283 | case "M" : 284 | r.push(GedcomLang.$.plugins.sexe.M); 285 | break; 286 | 287 | case "F" : 288 | r.push(GedcomLang.$.plugins.sexe.F); 289 | break; 290 | 291 | case "U" : 292 | default : 293 | r.push(GedcomLang.$.plugins.sexe.U); 294 | } 295 | return r.join(" "); 296 | } 297 | }); 298 | 299 | new Plugin({ 300 | order : 1050, 301 | key : "name", 302 | doParser : function(me, data) { 303 | this.plugin[me.key] = GedcomParser.getChilds(data, "NAME", true); 304 | }, 305 | doWriter : GedcomPlugins.doWriterGroupHelper 306 | }); 307 | 308 | new Plugin({ 309 | order : 1100, 310 | key : "prenom", 311 | doParser : function(me, data) { 312 | this.plugin[me.key] = GedcomParser.getChild(GedcomParser.getChild(data, "NAME"), "GIVN", true); 313 | } 314 | }); 315 | 316 | new Plugin({ 317 | order : 1150, 318 | key : "surn_prefix", 319 | doParser : function(me, data) { 320 | this.plugin[me.key] = GedcomParser.getChild(GedcomParser.getChild(data, "NAME"), "SPFX", true); 321 | } 322 | }); 323 | 324 | new Plugin({ 325 | order : 1200, 326 | key : "nomjf", 327 | doParser : function(me, data) { 328 | this.plugin[me.key] = GedcomParser.getChild(GedcomParser.getChild(data, "NAME"), "SURN", true); 329 | } 330 | }); 331 | 332 | new Plugin({ 333 | order : 1250, 334 | key : "name_suffix", 335 | doParser : function(me, data) { 336 | this.plugin[me.key] = GedcomParser.getChild(GedcomParser.getChild(data, "NAME"), "NSFX", true); 337 | } 338 | }); 339 | 340 | new Plugin({ 341 | order : 1300, 342 | key : "nom", 343 | doParser : function(me, data) { 344 | this.plugin[me.key] = GedcomParser.getChild(GedcomParser.getChild(data, "NAME"), "_MARNM", true); 345 | } 346 | }); 347 | 348 | new Plugin({ 349 | order : 1350, 350 | key : "nickname", 351 | doParser : function(me, data) { 352 | this.plugin[me.key] = GedcomParser.getChild(GedcomParser.getChild(data, "NAME"), "NICK", true); 353 | } 354 | }); 355 | 356 | new Plugin({ 357 | order : 1400, 358 | key : "birt", 359 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("BIRT"), 360 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 361 | }); 362 | 363 | new Plugin({ 364 | order : 1450, 365 | key : "deat", 366 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("DEAT"), 367 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 368 | }); 369 | 370 | new Plugin({ 371 | order : 1500, 372 | key : "burri", 373 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("BURRI"), 374 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 375 | }); 376 | 377 | new Plugin({ 378 | order : 1550, 379 | key : "crem", 380 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("CREM"), 381 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 382 | }); 383 | 384 | new Plugin({ 385 | order : 1600, 386 | key : "prob", 387 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("PROB"), 388 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 389 | }); 390 | 391 | new Plugin({ 392 | order : 1650, 393 | key : "will", 394 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("WILL"), 395 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 396 | }); 397 | 398 | new Plugin({ 399 | order : 2000, 400 | key : "familleParent", 401 | doParser : function(me, data) { 402 | this.plugin[me.key] = GedcomParser.getChild(data, "FAMC", true); 403 | }, 404 | doInject : function(me, parser) { 405 | if (this.plugin[me.key]) { 406 | this.plugin[me.key] = parser.getData(this.plugin[me.key]); 407 | } 408 | }, 409 | doWriter : function(data, scope) { 410 | var d = data.plugin[this.key]; 411 | return null == d ? null : GedcomPlugins.displayData([d.husb, d.wife], scope.createHtmlLink 412 | .bind(scope)); 413 | } 414 | }); 415 | 416 | new Plugin({ 417 | order : 2050, 418 | key : "adop", 419 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("ADOP"), 420 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 421 | }); 422 | 423 | new Plugin({ 424 | order : 2100, 425 | key : "nmr", 426 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("NMR"), 427 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 428 | }); 429 | 430 | new Plugin({ 431 | order : 2150, 432 | key : "familles", 433 | doParser : function(me, data) { 434 | this.plugin[me.key] = GedcomParser.getChilds(data, "FAMS", true); 435 | }, 436 | doInject : function(me, parser) { 437 | if (this.plugin[me.key]) { 438 | this.plugin[me.key] = this.plugin[me.key].collect(function(famille) { 439 | return parser.getData(famille); 440 | }, this); 441 | } 442 | }, 443 | doWriter : function(data, scope) { 444 | return GedcomPlugins.displayData(data.plugin[this.key], function(f) { 445 | var s = []; 446 | 447 | if (f.husb && f.husb.id != data.id) { 448 | s.push(scope.createHtmlLink(f.husb, f)); 449 | } 450 | 451 | if (f.wife && f.wife.id != data.id) { 452 | s.push(scope.createHtmlLink(f.wife, f)); 453 | } 454 | 455 | if (f.childs.length > 0) { 456 | s.push("
"); 457 | { 458 | if (f.marr) { 459 | s.push("" + GedcomLang.$.plugins.familles.marriage + " : " 460 | + GedcomPlugins.displayDateAndPlace(f.marr) + "
"); 461 | } 462 | s.push("" + f.childs.length + " " + GedcomLang.$.plugins.familles.children + " :"); 463 | { 464 | s.push("
"); 465 | s.push(GedcomPlugins.displayData(f.childs, function(c) { 466 | return scope.createHtmlLink(c); 467 | })); 468 | s.push("
"); 469 | } 470 | } 471 | s.push("
"); 472 | } 473 | return s.join(" "); 474 | }.bind(this)); 475 | } 476 | }); 477 | 478 | new Plugin({ 479 | order : 2200, 480 | key : "familleParentChilds", 481 | doWriter : function(data, scope) { 482 | var p = data.getValue("familleParent"); 483 | return p && p.childs.length > 0 ? GedcomPlugins.displayData(p.childs.filter(function(c) { 484 | return c.id != data.id; 485 | }, this), function(c) { 486 | return this.createHtmlLink(c); 487 | }.bind(scope)) : null; 488 | } 489 | }); 490 | 491 | new Plugin({ 492 | order : 2250, 493 | key : "nchi", 494 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("NCHI"), 495 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 496 | }); 497 | 498 | new Plugin({ 499 | order : 3000, 500 | key : "even", 501 | doParser : function(me, data) { 502 | var d = []; 503 | GedcomParser.getChilds(data, "EVEN").each(function(event) { 504 | var t = GedcomParser.extractDateAndPlace(event); 505 | if (t) { 506 | t.type = GedcomParser.getChild(event, "TYPE", true); 507 | d.push(t); 508 | }; 509 | }, this); 510 | this.plugin[me.key] = d; 511 | }, 512 | doWriter : function(data, scope) { 513 | var d = data.plugin[this.key]; 514 | return d && d.length > 0 ? GedcomPlugins.displayData(d, function(event) { 515 | var s = []; 516 | s.push(event.type); 517 | s.push(GedcomPlugins.displayDateAndPlace(event)); 518 | return s.compact().join(" "); 519 | }.bind(scope)) : null; 520 | } 521 | }); 522 | 523 | new Plugin({ 524 | order : 3050, 525 | key : "dscr", 526 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("DSCR"), 527 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 528 | }); 529 | 530 | new Plugin({ 531 | order : 3100, 532 | key : "cens", 533 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("CENS"), 534 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 535 | }); 536 | 537 | new Plugin({ 538 | order : 4000, 539 | key : "ssn", 540 | doParser : function(me, data) { 541 | this.plugin[me.key] = GedcomParser.getChilds(data, "SSN", true); 542 | }, 543 | doWriter : GedcomPlugins.doWriterGroupHelper 544 | }); 545 | 546 | new Plugin({ 547 | order : 4050, 548 | key : "resi", 549 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("RESI"), 550 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 551 | }); 552 | 553 | new Plugin({ 554 | order : 4100, 555 | key : "prop", 556 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("PROP"), 557 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 558 | }); 559 | 560 | new Plugin({ 561 | order : 5000, 562 | key : "grad", 563 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("GRAD"), 564 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 565 | }); 566 | 567 | new Plugin({ 568 | order : 5050, 569 | key : "educ", 570 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("EDUC"), 571 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 572 | }); 573 | 574 | new Plugin({ 575 | order : 5100, 576 | key : "occu", 577 | doParser : function(me, data) { 578 | var d = []; 579 | GedcomParser.getChilds(data, "OCCU").each(function(occu) { 580 | var t = GedcomParser.extractDateAndPlace(occu); 581 | if (t) { 582 | t.type = occu.value; 583 | d.push(t); 584 | }; 585 | }, this); 586 | this.plugin[me.key] = d; 587 | }, 588 | doWriter : function(data, scope) { 589 | var d = data.plugin[this.key]; 590 | return d && d.length > 0 ? GedcomPlugins.displayData(d, function(event) { 591 | var s = []; 592 | s.push(event.type); 593 | s.push(GedcomPlugins.displayDateAndPlace(event)); 594 | return s.compact().join(" "); 595 | }.bind(scope)) : null; 596 | } 597 | }); 598 | 599 | new Plugin({ 600 | order : 5150, 601 | key : "reti", 602 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("RETI"), 603 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 604 | }); 605 | 606 | new Plugin({ 607 | order : 6000, 608 | key : "nati", 609 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("NATI"), 610 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 611 | }); 612 | 613 | new Plugin({ 614 | order : 6050, 615 | key : "emig", 616 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("EMIG"), 617 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 618 | }); 619 | 620 | new Plugin({ 621 | order : 6100, 622 | key : "immi", 623 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("IMMI"), 624 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 625 | }); 626 | 627 | new Plugin({ 628 | order : 6150, 629 | key : "natu", 630 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("NATU"), 631 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 632 | }); 633 | 634 | new Plugin({ 635 | order : 7000, 636 | key : "reli", 637 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("RELI"), 638 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 639 | }); 640 | 641 | new Plugin({ 642 | order : 7050, 643 | key : "fcom", 644 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("FCOM"), 645 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 646 | }); 647 | 648 | new Plugin({ 649 | order : 7100, 650 | key : "chr", 651 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("CHR"), 652 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 653 | }); 654 | 655 | new Plugin({ 656 | order : 7150, 657 | key : "chra", 658 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("CHRA"), 659 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 660 | }); 661 | 662 | new Plugin({ 663 | order : 7200, 664 | key : "bapt", 665 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("BAPT"), 666 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 667 | }); 668 | 669 | new Plugin({ 670 | order : 7250, 671 | key : "conf", 672 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("CONF"), 673 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 674 | }); 675 | 676 | new Plugin({ 677 | order : 7300, 678 | key : "bles", 679 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("BLES"), 680 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 681 | }); 682 | 683 | new Plugin({ 684 | order : 7350, 685 | key : "ordi", 686 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("ORDI"), 687 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 688 | }); 689 | 690 | new Plugin({ 691 | order : 7400, 692 | key : "ordn", 693 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("ORDN"), 694 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 695 | }); 696 | 697 | new Plugin({ 698 | order : 8000, 699 | key : "barm", 700 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("BARM"), 701 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 702 | }); 703 | 704 | new Plugin({ 705 | order : 8050, 706 | key : "bars", 707 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("BASM"), 708 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 709 | }); 710 | 711 | new Plugin({ 712 | order : 9000, 713 | key : "bapl", 714 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("BAPL"), 715 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 716 | }); 717 | 718 | new Plugin({ 719 | order : 9050, 720 | key : "conl", 721 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("CONL"), 722 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 723 | }); 724 | 725 | new Plugin({ 726 | order : 9100, 727 | key : "endl", 728 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("ENDL"), 729 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 730 | }); 731 | 732 | new Plugin({ 733 | order : 9150, 734 | key : "slgc", 735 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("SLGC"), 736 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 737 | }); 738 | 739 | new Plugin({ 740 | order : 9200, 741 | key : "slgs", 742 | doParser : GedcomPlugins.doParserDateAndPlaceGroupHelper.curry("SLGS"), 743 | doWriter : GedcomPlugins.doWriterDateAndPlaceGroupHelper 744 | }); 745 | 746 | new Plugin({ 747 | order : 10000, 748 | key : "cast", 749 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("CAST"), 750 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 751 | }); 752 | 753 | new Plugin({ 754 | order : 10050, 755 | key : "titl", 756 | doParser : GedcomPlugins.doParserDateAndPlaceHelper.curry("TITL"), 757 | doWriter : GedcomPlugins.doWriterDateAndPlaceHelper 758 | }); 759 | 760 | new Plugin({ 761 | order : 20000, 762 | key : "sources", 763 | doParser : function(me, data) { 764 | this.plugin[me.key] = GedcomParser.getChilds(data, "SOUR", true); 765 | }, 766 | doWriter : function(data, scope) { 767 | var d = data.plugin[this.key]; 768 | return d && d.length > 0 ? GedcomPlugins.displaySources(d) : null; 769 | } 770 | }); 771 | 772 | new Plugin({ 773 | order : 20050, 774 | key : "notes", 775 | doParser : function(me, data) { 776 | this.plugin[me.key] = GedcomParser.getChilds(data, "NOTE", true); 777 | }, 778 | doWriter : function(data, scope) { 779 | var d = data.plugin[this.key]; 780 | return d && d.length > 0 ? GedcomPlugins.displayNotes(d) : null; 781 | } 782 | }); 783 | 784 | new Plugin({ 785 | order : 20100, 786 | key : "obje", 787 | doParser : function(me, data) { 788 | var d = []; 789 | GedcomParser.getChilds(data, "OBJE").each(function(n) { 790 | // On ignore les objets avec une référence 791 | if (n.value) { 792 | return; 793 | } 794 | d.push({ 795 | form : GedcomParser.getChild(n, "FORM", true), 796 | title : GedcomParser.getChild(n, "TITL", true), 797 | file : GedcomParser.getChild(n, "FILE", true) 798 | }); 799 | }, this); 800 | 801 | this.plugin[me.key] = d; 802 | }, 803 | doWriter : function(data, scope) { 804 | var d = data.plugin[this.key]; 805 | return d && d.length > 0 ? GedcomPlugins.displayData(d, function(n) { 806 | switch (n.form.toLowerCase()) { 807 | case "url" : 808 | return "" + n.title + ""; 809 | break; 810 | 811 | case "bmp" : 812 | case "gif" : 813 | case "jpeg" : 814 | return ""; 815 | break; 816 | 817 | default : 818 | return "" + n.title 819 | + ""; 820 | break; 821 | 822 | } 823 | }) : null; 824 | } 825 | }); 826 | 827 | // LISTE DES PLUGINS POSSIBLES 828 | // ABBR {abbreviation} : titre abrégé, description abrégée ou nom abrégé. 829 | // ADDR {address} : adresse postale d'un individu, de l'auteur d'un fichier, d'une entreprise, d'une école, 830 | // etc 831 | // ADR1 {address1} : première ligne d'une adresse 832 | // ADR2 {address2} : deuxième ligne d'une adresse 833 | // ADOP {adoption} : création du lien enfant-parent quand il n'existe pas de lien biologique. 834 | // AFN {AFN} : numéro unique et permanent du fichier Ancestral File qui contient les informations relatives à 835 | // l'individu 836 | // AGE {age} : âge de l'individu au moment de l'événement ou âge qui figure dans le document. 837 | // AGNC {agency} : institution ou individu responsable ou décisionnaire 838 | // ALIA {alias} : indicateur qui associe des informations différentes sur une personne. 839 | // ANCE {ancestors} : ancêtres d'un individu 840 | // ANCI {ances_interest} : indique un intérêt à rechercher des informations complémentaires sur les ancêtres 841 | // d'un individu (voir DESI) 842 | // ANUL {annulment} : déclaration de nullité d'un mariage (comme s'il n'avait pas eu lieu) 843 | // ASSO {associates} : indicateur qui relie des amis, des voisins, des parents ou d'autres personnes à un 844 | // individu 845 | // AUTH {author} : nom de la personne qui a relevé les informations ou qui a constitué le fichier 846 | // BAPL {baptism-LDS} : baptême de l'Eglise des Mormons (à partir de l'âge de huit ans) 847 | // BAPM {baptism}: baptême (non Mormon, voir aussi BAPL et CHR) 848 | // BARM {bar_mitzvah} : cérémonie juive qui a lieu pour les garçons à l'âge de 13 ans 849 | // BASM {bas_mitzvah}: cérémonie juive qui a lieu pour les filles à l'âge de 13 ans, aussi appelée "Bat 850 | // Mitzvah." 851 | // BIRT {birth} : naissance 852 | // BLES {blessing} : bénédiction religieuse 853 | // BLOB {binary_object} : ensemble de données utilisé par un système multimédia qui gére des données binaires 854 | // qui représentent des images, du son et de la vidéo. 855 | // BURI {burial} : sépulture 856 | // CALN {call_number} : numéro dans un répertoire qui sert à identifier une pièce dans une collection. 857 | // CAST {caste} : rang ou statut d'un individu dans une société, selon des critères raciaux ou religieux, des 858 | // critères de richesse ou autres 859 | // CAUS {cause} : description de la cause de l'événement ou du fait associé, cause du décès par exemple. 860 | // CENS {census} : recensement de population 861 | // CHAN {change} : correction ou modification; en relation avec une DATE qui indique quand le changement est 862 | // survenu. 863 | // CHAR {character} : indique le jeu de caractères utilisé pour l'écriture des informations dans le fichier. 864 | // CHIL {child} : enfant naturel ou adopté 865 | // CHR {christening} : baptême religieux (non Mormon) d'un enfant. 866 | // CHRA {adult_christening} : baptême religieux (non Mormon) d'une personne adulte. 867 | // CITY {city} : ville ou village 868 | // CONC {concatenation} : indicateur de continuation des informations qui précédent. Ces informations doivent 869 | // être mises à la suite de celles qui précédent sans espace ni retour au début de ligne. La coupure avec les 870 | // informations précédentes doit être faite au milieu d'un champ et non pas sur un espace (l'espace est un 871 | // délimiteur GEDCOM). 872 | // CONF {confirmation} : confirmation - cérémonie religieuse (non Mormon) par laquelle un individu acquiert la 873 | // qualité de membre à part entière de son Eglise. 874 | // CONL {confirmation_l} : confirmation (cérémonie religieuse par laquelle un individu devient membre de 875 | // l'Eglise des Mormons) 876 | // CONT {continued} : indicateur de continuation des informations qui précédent, après un retour à la ligne. 877 | // COPR {copyright} : protection des informations contre la reproduction et la diffusion. 878 | // CORP {corporate} : nom d'une entreprise, d'une institution ou autre. 879 | // CREM {cremation} : incinération du corps d'un individu décédé. 880 | // CTRY {country} : nom ou code du pays 881 | // DATA {data} : informations stockées automatiquement. 882 | // DATE {date} : date d'un événement au format prévu pour les dates 883 | // DEAT {death} : décès 884 | // DESC {descendants} : descendance d'un individu 885 | // DESI {descendant_int} : indique un intérêt à rechercher des descendants de l'individu (voir aussi ANCI) 886 | // DEST {destination} : système ou programme destinataire des données. 887 | // DIV {divorce} : dissolution du mariage 888 | // DIVF {divorce_filed} : dossier de divorce d'un époux 889 | // DSCR {phy_description} : caractères physiques de description d'une personne, d'un lieu ou d'une chose 890 | // EDUC {education} : niveau d'instruction 891 | // EMIG {emigration} : départ de son pays avec l'intention de résider ailleurs. 892 | // ENDL {endowment} : dotation (sacrement de l'Eglise des Mormons reçu par un individu dans un temple). 893 | // ENGA {engagement} : fiancailles 894 | // EVEN {event} : événement intéressant à propos d'un individu, d'un groupe ou d'une organisation 895 | // FAM {family} : association d'un homme, d'une femme et de leurs enfants selon la loi ou les coutumes, ou 896 | // famille créée par la naissance d'un enfant d'un père et d'une mère biologiques. 897 | // FAMC {family_child} : indique la famille à laquelle un enfant appartient 898 | // FAMF {family_file} : nom d'un fichier de familles de l'Eglise des Mormons 899 | // FAMS {family_spouse} : indique la famille dans laquelle l'individu est l'un des conjoints 900 | // FCOM {first_communion} : cérémonie religieuse de première communion 901 | // FILE {file} : unité de conservation d'informations classées pouvant être référencées. 902 | // FORM {format} : nom donné à un format dans lequel des informations peuvent être transcrites 903 | // GEDC {gedcom} : information sur l'utilisation de la norme GEDCOM dans un fichier. 904 | // GIVN {given_name} : prénom 905 | // GRAD {graduation} : diplôme ou certificat 906 | // HEAD {header} : identification des informations du fichier GEDCOM 907 | // HUSB {husband} : individu marié ou père 908 | // IDNO {ident_number} : numéro d'identification d'une personne dans un fichier, une source ou un système 909 | // externe 910 | // IMMI {immigration} : arrivée dans un nouveau lieu avec intention d'y résider 911 | // INDI {individual} : une personne 912 | // LANG {language} : langage utilisé dans le fichier 913 | // LEGA {legatee} : légataire 914 | // MARB {marriage_bann} : publication des bans de mariage 915 | // MARC {marr_contract} : contrat de mariage 916 | // MARL {marr_license} : autorisation légale de mariage 917 | // MARR {marriage} : création d'une famille 918 | // MARS {marr_settlement} : convention, contrat avant mariage 919 | // MEDI {media} : information sur le support des données stockées 920 | // NAME {name} : mot ou ensemble de mots utilisés pour l'identification d'un individu, d'un titre, etc. Il 921 | // faut utiliser plusieurs lignes NAME pour les personnes qui ont des noms multiples. 922 | // NATI {nationality} : nationalité d'une personne 923 | // NATU {naturalization} : obtention de la nationalité 924 | // NCHI {children_count} : nombre d'enfants du parent (tous mariages confondus) s'il s'agit d'un individu ou 925 | // de la famille s'il s'agit d'une famille. 926 | // NICK {nickname} : surnom 927 | // NMR {marriage_count} : nombre de mariages de la personne 928 | // NOTE {note} : informations complémentaires ajoutées pour la compréhension des données 929 | // NPFX {name_prefix} : texte ou titre qui apparait avant le nom d'une personne (Docteur, Général, 930 | // Monseigneur...) 931 | // NSFX {name_suffix} : texte qui apparait après le nom (Junior ou fils, par exemple) 932 | // OBJE {object} : référence aux données utilisées comme description (généralement un enregistrement audio, 933 | // une photo ou une vidéo) 934 | // OCCU {occupation} : profession 935 | // ORDI {ordinance} : sacrement religieux en général 936 | // ORDN {ordination} : ordination religieuse 937 | // PAGE {page} : numéro ou description de l'endroit où l'information se trouve dans un ouvrage référencé 938 | // PEDI {pedigree} : Information relative à l'individu dans un tableau d'ascendance. 939 | // PHON {phone} : numéro de téléphone 940 | // PLAC {place} : lieu de l'événement 941 | // POST {postal_code} : code postal 942 | // PROB {probate} : validation d'un testament 943 | // PROP {property} : biens et possessions 944 | // PUBL {publication} : date et lieu de publication d'un ouvrage 945 | // QUAY {quality_of-data} : degré de confiance à accorder à une information 946 | // REFN {reference} : description ou numéro d'identification d'un fichier ou de tout autre objet pouvant être 947 | // référencé 948 | // RELA {relationship} : valeur du lien dans le contexte 949 | // RELI {religion} : religion 950 | // REPO {repository} : établissement ou personne dépositaire de l'information 951 | // RESI {residence} : domicile 952 | // RESN {restriction} : indicateur d'accès restreint ou interdit à une information 953 | // RETI {retirement} : retraite 954 | // RFN {rec_file_number} : numéro permanent affecté à un enregistrement pour l'identifier de manière unique 955 | // dans un fichier 956 | // RIN {rec_id_number} : numéro affecté à un enregistrement automatiquement par un système émetteur qui est 957 | // utilisé pour identifier cet enregistrement dans les résultats produits par un système récepteur 958 | // ROLE {role} : rôle joué par un individu dans un événement 959 | // SEX {sex} : sexe 960 | // SLGC {sealing_child} : scellement d'un enfant à ses parents (cérémonie de l'Eglise des Mormons) 961 | // SLGS {sealing_spouse} : scellement d'un mari et d'une femme (cérémonie de l'Eglise des Mormons) 962 | // SOUR {source} : document d'origine ou source initiale de l'information 963 | // SPFX {surn_prefix} : partie d'un nom de famille qui n'est pas indexée 964 | // SSN {soc_sec_number} : numéro de sécurité sociale 965 | // STAE {state} : état (division géographique ou juridictionnelle) 966 | // STAT {status} : état (condition) 967 | // SUBM {submitter} : individu ou organisation qui fournit les données généalogiques 968 | // SUBN {submission} : ensemble de données à traiter 969 | // SURN {surname} : nom de famille 970 | // TEMP {temple} : nom ou code d'identification d'un temple de l'Eglise des Mormons 971 | // TEXT {text} : texte exact provenant d'un document original 972 | // TIME {time} : heures (entre 0 et 24), minutes et secondes séparées par les deux points (:). Secondes et 973 | // centièmes de secondes sont optionnels. 974 | // TITL {title} : description d'un ouvrage, comme le titre d'un livre; titre de noblesse ou titre honorifique 975 | // pour un individu 976 | // TRLR {trailer} : marque de fin d'un fichier GEDCOM 977 | // TYPE {type} : définition complémentaire de l'identificateur précédent. 978 | // VERS {version} : indique la version d'un produit, d'un composant ou d'un ouvrage utilisé ou référencé 979 | // WIFE {wife} : épouse 980 | // WILL {will} : testament (voir aussi PROB) 981 | 982 | // FIN DE LA LISTE 983 | --------------------------------------------------------------------------------