blob: 82379354cd4ef0991968669d201b8c38bcc08fa5 [file] [log] [blame]
Akrond4b000b2018-01-28 18:33:14 +01001define(['util'], function () {
2
3 /*
Akron30ee5142015-06-26 01:50:14 +02004 author, editor title, subTitle textSigle
5 in corpusAuthor (corpusEditor), corpusTitle, corpusSubTitle, corpusSigle
6 in docAuthor (docEditor), docTitle, docSubTitle, docSigle
7 publisher
8 reference
9 creationDate
10 foundries
11 keywords
12 textClass
13 textColumn
14 textDomain
15 textType
16 textTypeArt
17 textTypeRef
18 language
19 license
20 pages
21 pubDate
22 layerInfo
23 tokenSource
24 biblEditionStatement
25 fileEditionStatement
26*/
Akronbd342982018-01-25 18:01:46 +010027
28 // Localization values
Akron0b489ad2018-02-02 16:49:32 +010029 const loc = KorAP.Locale;
Akronbd342982018-01-25 18:01:46 +010030 loc.METADATA = loc.METADATA || 'Metadata';
31
Akron24866cf2018-01-23 20:22:01 +010032 return {
33
34 /**
35 * Create new match object
36 */
37 create : function (match) {
38 return Object.create(this)._init(match);
39 },
40
41 /**
42 * Initialize object
43 */
44 _init : function (match) {
45 this._match = match;
46 this.opened = false;
47 return this;
48 },
49
50 /**
51 * Get match object
52 */
53 match : function () {
54 return this._match;
55 },
56
57 /**
58 * Create match reference view.
59 */
60 element : function (metaInfo) {
61 if (this._element !== undefined)
62 return this._element;
63
Akron8b592d42018-01-26 18:33:06 +010064 /*
Akronbd342982018-01-25 18:01:46 +010065 var header = metaTable.appendChild(
66 document.createElement('h6')
67 );
68
69 header.appendChild(
70 document.createElement('div')
71 ).appendChild(
72 document.createTextNode(loc.METADATA)
73 );
Akron8b592d42018-01-26 18:33:06 +010074 */
Akronbd342982018-01-25 18:01:46 +010075
Akronaeceda72018-02-02 20:44:06 +010076 var metaDL = document.createElement('dl');
Akronbd342982018-01-25 18:01:46 +010077
Akronaeceda72018-02-02 20:44:06 +010078 this._element = metaDL;
Akron24866cf2018-01-23 20:22:01 +010079
80 // TODO: Meta fields should be separated
81 var keys = Object.keys(metaInfo);
82 for (var i in keys.sort()) {
83 var k = keys[i];
84 if (k !== "UID" &&
85 k !== "corpusID" &&
86 k !== "docID" &&
87 k !== "textID" &&
Akron8b592d42018-01-26 18:33:06 +010088 /*
Akron24866cf2018-01-23 20:22:01 +010089 k !== "corpusSigle" &&
90 k !== "docSigle" &&
Akron8b592d42018-01-26 18:33:06 +010091 */
Akron24866cf2018-01-23 20:22:01 +010092 k !== "layerInfos") {
93
94 var metaL = document.createElement('div');
Akron0b489ad2018-02-02 16:49:32 +010095 metaL.addE('dt').addT(k);
96 metaL.addE('dd').addT(metaInfo[k]);
Akron24866cf2018-01-23 20:22:01 +010097
Akronbd342982018-01-25 18:01:46 +010098 metaDL.appendChild(metaL);
Akron24866cf2018-01-23 20:22:01 +010099 };
100 };
Akron24866cf2018-01-23 20:22:01 +0100101 return this._element;
Akronaeceda72018-02-02 20:44:06 +0100102 }
Akron24866cf2018-01-23 20:22:01 +0100103 };
Akron30ee5142015-06-26 01:50:14 +0200104});