diffViewer: selecting tab with the latest requested diff
[fnpeditor.git] / modules / metadataEditor / transformations.js
1 define(['libs/jquery-1.9.1.min'], function($) {\r
2 \r
3     'use strict';\r
4 \r
5     return {\r
6         getMetadata: function(xml) {\r
7             var toret = {};\r
8             $(xml).find('metadata').children().each(function() {\r
9                 var node = $(this);\r
10                 toret[this.nodeName.split(':')[1].toLowerCase()] = node.text();\r
11             })\r
12             return toret;\r
13         },\r
14         getXML: function(metadata) {\r
15             var meta = $('<metadata></metadata>\n');\r
16             _.each(_.keys(metadata), function(key) {\r
17                 meta.append('\n\t<dc:'+key+'>' + metadata[key] + '</dc:'+key+'>');\r
18             });\r
19             meta.append('\n');\r
20             return vkbeautify.xml(meta.html());\r
21         }\r
22     }\r
23 \r
24 });