Browse Source

update lazy load web_preview

8.0
Mathias Markl 7 years ago
parent
commit
9a0322df8c
  1. 2
      muk_web_preview/__manifest__.py
  2. 10
      muk_web_preview/doc/changelog.rst
  3. 94
      muk_web_preview/i18n/muk_web_preview.pot
  4. 73
      muk_web_preview/static/src/js/preview_dialog.js
  5. 9
      muk_web_preview/static/src/js/preview_generator.js
  6. 6
      muk_web_preview/static/src/js/preview_handler.js
  7. 2
      muk_web_preview/static/src/less/preview_content.less
  8. 5
      muk_web_preview/static/src/less/preview_dialog.less
  9. 4
      muk_web_preview/static/src/xml/preview_dialog.xml
  10. 10
      muk_web_preview/template/assets.xml
  11. 2
      muk_web_preview_attachment/__manifest__.py
  12. 4
      muk_web_preview_attachment/doc/changelog.rst
  13. 35
      muk_web_preview_attachment/i18n/de.po
  14. 34
      muk_web_preview_attachment/i18n/muk_web_preview_attachment.pot
  15. 1
      muk_web_preview_attachment/static/description/index.html
  16. 9
      muk_web_preview_attachment/template/assets.xml
  17. 4
      muk_web_preview_attachment/views/ir_attachment_view.xml
  18. 2
      muk_web_preview_audio/__manifest__.py
  19. 10
      muk_web_preview_audio/doc/changelog.rst
  20. 25
      muk_web_preview_audio/i18n/de.po
  21. 24
      muk_web_preview_audio/i18n/muk_web_preview_audio.pot
  22. 31
      muk_web_preview_audio/static/src/js/preview_handler.js
  23. 10
      muk_web_preview_audio/template/assets.xml
  24. 2
      muk_web_preview_csv/__manifest__.py
  25. 10
      muk_web_preview_csv/doc/changelog.rst
  26. 16
      muk_web_preview_csv/i18n/de.po
  27. 16
      muk_web_preview_csv/i18n/muk_web_preview_csv.pot
  28. 49
      muk_web_preview_csv/static/src/js/preview_handler.js
  29. 14
      muk_web_preview_csv/template/assets.xml
  30. 2
      muk_web_preview_image/__manifest__.py
  31. 10
      muk_web_preview_image/doc/changelog.rst
  32. 16
      muk_web_preview_image/i18n/de.po
  33. 16
      muk_web_preview_image/i18n/muk_web_preview_image.pot
  34. 21
      muk_web_preview_image/static/src/js/preview_handler.js
  35. 11
      muk_web_preview_image/template/assets.xml
  36. 2
      muk_web_preview_mail/__manifest__.py
  37. 10
      muk_web_preview_mail/doc/changelog.rst
  38. 95
      muk_web_preview_mail/i18n/de.po
  39. 94
      muk_web_preview_mail/i18n/muk_web_preview_mail.pot
  40. 3
      muk_web_preview_mail/static/src/js/preview_handler.js
  41. 8
      muk_web_preview_mail/template/assets.xml
  42. 2
      muk_web_preview_markdown/__manifest__.py
  43. 10
      muk_web_preview_markdown/doc/changelog.rst
  44. 16
      muk_web_preview_markdown/i18n/de.po
  45. 16
      muk_web_preview_markdown/i18n/muk_web_preview_markdown.pot
  46. 33
      muk_web_preview_markdown/static/src/js/preview_handler.js
  47. 10
      muk_web_preview_markdown/template/assets.xml
  48. 2
      muk_web_preview_msoffice/__manifest__.py
  49. 10
      muk_web_preview_msoffice/doc/changelog.rst
  50. 37
      muk_web_preview_msoffice/i18n/de.po
  51. 36
      muk_web_preview_msoffice/i18n/muk_web_preview_msoffice.pot
  52. 129
      muk_web_preview_msoffice/static/src/js/preview_handler.js
  53. 14
      muk_web_preview_msoffice/template/assets.xml
  54. 2
      muk_web_preview_text/__manifest__.py
  55. 10
      muk_web_preview_text/doc/changelog.rst
  56. 1053
      muk_web_preview_text/i18n/de.po
  57. 1053
      muk_web_preview_text/i18n/muk_web_preview_text.pot
  58. 84
      muk_web_preview_text/static/src/js/preview_handler.js
  59. 12
      muk_web_preview_text/template/assets.xml
  60. 2
      muk_web_preview_vector/__manifest__.py
  61. 10
      muk_web_preview_vector/doc/changelog.rst
  62. 16
      muk_web_preview_vector/i18n/de.po
  63. 16
      muk_web_preview_vector/i18n/muk_web_preview_vector.pot
  64. 72
      muk_web_preview_vector/static/src/js/preview_handler.js
  65. 10
      muk_web_preview_vector/template/assets.xml
  66. 2
      muk_web_preview_video/__manifest__.py
  67. 10
      muk_web_preview_video/doc/changelog.rst
  68. 25
      muk_web_preview_video/i18n/de.po
  69. 24
      muk_web_preview_video/i18n/muk_web_preview_video.pot
  70. 8
      muk_web_preview_video/template/assets.xml

2
muk_web_preview/__manifest__.py

@ -29,7 +29,7 @@
- Portable Document Format (.pdf) - Portable Document Format (.pdf)
- Open Document (.odt, .odp, .ods, .otp) - Open Document (.odt, .odp, .ods, .otp)
""", """,
"version": "11.0.1.0.5",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

94
muk_web_preview/i18n/muk_web_preview.pot

@ -0,0 +1,94 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-18 23:26+0000\n"
"PO-Revision-Date: 2018-01-18 23:26+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_content.xml:69
#, python-format
msgid "Download"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_content.xml:62
#, python-format
msgid "Extension:"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_content.xml:54
#, python-format
msgid "Filename:"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_content.xml:43
#, python-format
msgid "Odoo App Store"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_dialog.xml:35
#, python-format
msgid "Ok"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/js/preview_dialog.js:44
#, python-format
msgid "Preview"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_content.xml:41
#, python-format
msgid "This file type is currently not supported. By installing further extension via the"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_content.xml:58
#, python-format
msgid "Type:"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/js/preview_generator.js:51
#, python-format
msgid "Unknown"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_content.xml:37
#, python-format
msgid "Unsupported File Extension"
msgstr ""
#. module: muk_web_preview
#. openerp-web
#: code:addons/muk_web_preview/static/src/xml/preview_content.xml:43
#, python-format
msgid "it is possible to improve the Preview."
msgstr ""

73
muk_web_preview/static/src/js/preview_dialog.js

@ -20,8 +20,10 @@
odoo.define('muk_preview.PreviewDialog', function (require) { odoo.define('muk_preview.PreviewDialog', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var framework = require('web.framework'); var framework = require('web.framework');
var Widget = require('web.Widget'); var Widget = require('web.Widget');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -31,6 +33,11 @@ var QWeb = core.qweb;
var _t = core._t; var _t = core._t;
var PreviewDialog = Widget.extend({ var PreviewDialog = Widget.extend({
cssLibs: [
],
jsLibs: [
'/muk_web_preview/static/lib/printThis/printThis.js',
],
init: function(parent, generator, url, mimetype, extension, title) { init: function(parent, generator, url, mimetype, extension, title) {
this._super(parent); this._super(parent);
this._opened = $.Deferred(); this._opened = $.Deferred();
@ -38,26 +45,39 @@ var PreviewDialog = Widget.extend({
this.url = url; this.url = url;
this.mimetype = mimetype; this.mimetype = mimetype;
this.extension = extension; this.extension = extension;
this.$modal = $(QWeb.render('PreviewDialog', {title: this.title, url: this.url}));
this.$modal.on('hidden.bs.modal', _.bind(this.destroy, this));
this.$modal.find('.preview-maximize').on('click', _.bind(this.maximize, this));
this.$modal.find('.preview-minimize').on('click', _.bind(this.minimize, this));
this.$modal.find('.preview-print').on('click', _.bind(this.print, this));
this.generator = generator; this.generator = generator;
this.generator.widget = this; this.generator.widget = this;
}, },
willStart: function() {
var self = this;
return $.when(ajax.loadLibs(this), this._super()).then(function() {
self.$modal = $(QWeb.render('PreviewDialog', {title: self.title, url: self.url}));
});
},
start: function() {
var self = this;
return this._super().then(function() {
self.$modal.on('hidden.bs.modal', _.bind(self.destroy, self));
self.$modal.find('.preview-maximize').on('click', _.bind(self.maximize, self));
self.$modal.find('.preview-minimize').on('click', _.bind(self.minimize, self));
self.$modal.find('.preview-print').on('click', _.bind(self.print, self));
});
},
renderElement: function() { renderElement: function() {
this._super(); this._super();
var self = this; var self = this;
this.generator.createPreview(this.url, this.mimetype, this.extension, this.title).then(function($content) {
self.setElement($("<div/>").addClass("modal-body preview-body").append($content));
self.$modal.find('.preview-print').toggle($content.hasClass('printable'));
this.generator.createPreview(this.url, this.mimetype,
this.extension, this.title).then(function($content) {
self.$el.replaceWith($content);
self.setElement($content);
self.$modal.find('.preview-print').toggle($content.hasClass('printable'));
}); });
}, },
open: function() { open: function() {
var self = this; var self = this;
$('.tooltip').remove(); $('.tooltip').remove();
this.replace(this.$modal.find(".modal-body")).then(function() {
this.appendTo($('<div/>')).then(function() {
self.$modal.find(".modal-body").append(self.$el);
self.$modal.modal('show'); self.$modal.modal('show');
self._opened.resolve(); self._opened.resolve();
}); });
@ -96,25 +116,32 @@ var PreviewDialog = Widget.extend({
}); });
} }
}, },
opened: function (handler) {
return (handler)? this._opened.then(handler) : this._opened;
},
close: function() { close: function() {
this.$modal.modal('hide');
this.destroy();
}, },
destroy: function(reason) {
$('.tooltip').remove();
if(this.isDestroyed()) {
destroy: function (reason) {
if (!this.__closed) {
this.__closed = true;
this.trigger("closed", reason);
}
if (this.isDestroyed()) {
return; return;
} }
this.trigger("closed", reason);
this._super(); this._super();
this.$modal.modal('hide');
this.$modal.remove();
setTimeout(function () {
var modals = $('body > .modal').filter(':visible');
if(modals.length) {
modals.last().focus();
$('body').addClass('modal-open');
}
}, 0);
$('.tooltip').remove();
if (this.$modal) {
this.$modal.modal('hide');
this.$modal.remove();
}
var modals = $('body > .modal').filter(':visible');
if (modals.length) {
modals.last().focus();
$('body').addClass('modal-open');
}
} }
}); });

9
muk_web_preview/static/src/js/preview_generator.js

@ -47,8 +47,13 @@ var PreviewGenerator = core.Class.extend({
if(matchedHandler) { if(matchedHandler) {
return matchedHandler.createHtml(url, mimetype, extension, title); return matchedHandler.createHtml(url, mimetype, extension, title);
} else { } else {
return $.when($.Deferred().resolve($(QWeb.render('UnsupportedContent',
{url: url, mimetype: mimetype || _t('Unknown'), extension: extension || _t('Unknown'), title: title || _t('Unknown')}))));
var $content = $.Deferred();
$content.resolve($(QWeb.render('UnsupportedContent', {
url: url, mimetype: mimetype || _t('Unknown'),
extension: extension || _t('Unknown'),
title: title || _t('Unknown')
})));
return $content;
} }
} }
}); });

6
muk_web_preview/static/src/js/preview_handler.js

@ -36,7 +36,7 @@ var BaseHandler = core.Class.extend({
return false; return false;
}, },
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
$.when();
return $.when();
}, },
}); });
@ -51,7 +51,7 @@ var PDFHandler = BaseHandler.extend({
var result = $.Deferred(); var result = $.Deferred();
var viewerUrlTempalte = _.template('/muk_web_preview/static/lib/PDFjs/web/viewer.html?file=<%= url %>'); var viewerUrlTempalte = _.template('/muk_web_preview/static/lib/PDFjs/web/viewer.html?file=<%= url %>');
result.resolve($(QWeb.render('ViewerJSFrame', {url: viewerUrlTempalte({url})}))); result.resolve($(QWeb.render('ViewerJSFrame', {url: viewerUrlTempalte({url})})));
return $.when(result);
return result;
}, },
}); });
@ -68,7 +68,7 @@ var OpenOfficeHandler = BaseHandler.extend({
var result = $.Deferred(); var result = $.Deferred();
var viewerUrlTempalte = _.template('/muk_web_preview/static/lib/ViewerJS/index.html#<%= url %>'); var viewerUrlTempalte = _.template('/muk_web_preview/static/lib/ViewerJS/index.html#<%= url %>');
result.resolve($(QWeb.render('ViewerJSFrame', {url: viewerUrlTempalte({url})}))); result.resolve($(QWeb.render('ViewerJSFrame', {url: viewerUrlTempalte({url})})));
return $.when(result);
return result;
}, },
}); });

2
muk_web_preview/static/src/less/preview_content.less

@ -20,6 +20,7 @@
.o_preview_viewerjs, .o_preview_viewerjs,
.o_preview_viewerjs iframe { .o_preview_viewerjs iframe {
position: absolute; position: absolute;
display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
@ -27,6 +28,7 @@
.o_preview_pdfjs, .o_preview_pdfjs,
.o_preview_pdfjs iframe { .o_preview_pdfjs iframe {
position: absolute; position: absolute;
display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }

5
muk_web_preview/static/src/less/preview_dialog.less

@ -79,9 +79,14 @@ button.preview-minimize {
.preview-body { .preview-body {
padding: 0; padding: 0;
position: relative;
min-height: 420px; min-height: 420px;
} }
.preview-footer {
padding: 10px;
}
.modal.modal-fullscreen { .modal.modal-fullscreen {
position: fixed; position: fixed;

4
muk_web_preview/static/src/xml/preview_dialog.xml

@ -29,9 +29,9 @@
<button type="button" class="preview-dialog-btn preview-print" aria-hidden="true"><i class="fa fa-print"></i></button> <button type="button" class="preview-dialog-btn preview-print" aria-hidden="true"><i class="fa fa-print"></i></button>
<h4 class="modal-title preview-title"><t t-raw="title"/></h4> <h4 class="modal-title preview-title"><t t-raw="title"/></h4>
</div> </div>
<div class="modal-body">
<div class="modal-body preview-body">
</div> </div>
<div class="modal-footer">
<div class="modal-footer preview-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Ok</button> <button type="button" class="btn btn-primary" data-dismiss="modal">Ok</button>
</div> </div>
</div> </div>

10
muk_web_preview/template/assets.xml

@ -19,16 +19,16 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<script type="text/javascript" src="/muk_web_preview/static/lib/printThis/printThis.js"/>
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview/static/src/less/preview_widgets.less" /> <link rel="stylesheet" href="/muk_web_preview/static/src/less/preview_widgets.less" />
<link rel="stylesheet" href="/muk_web_preview/static/src/less/preview_dialog.less" /> <link rel="stylesheet" href="/muk_web_preview/static/src/less/preview_dialog.less" />
<link rel="stylesheet" href="/muk_web_preview/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview/static/src/js/preview_generator.js"/>
<script type="text/javascript" src="/muk_web_preview/static/src/js/preview_widgets.js"/> <script type="text/javascript" src="/muk_web_preview/static/src/js/preview_widgets.js"/>
<script type="text/javascript" src="/muk_web_preview/static/src/js/preview_dialog.js"/> <script type="text/javascript" src="/muk_web_preview/static/src/js/preview_dialog.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

2
muk_web_preview_attachment/__manifest__.py

@ -28,7 +28,7 @@
The module also enables the possibility to The module also enables the possibility to
preview attachment in the Odoo Chat Widgets. preview attachment in the Odoo Chat Widgets.
""", """,
"version": "11.0.1.0.5",
"version": "11.0.1.0.6",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

4
muk_web_preview_attachment/doc/changelog.rst

@ -0,0 +1,4 @@
`1.0.0`
-------
- Init version

35
muk_web_preview_attachment/i18n/de.po

@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_attachment
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-18 23:34+0000\n"
"PO-Revision-Date: 2018-01-19 00:35+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: de\n"
"X-Generator: Poedit 2.0.5\n"
#. module: muk_web_preview_attachment
#: model:ir.model.fields,field_description:muk_web_preview_attachment.field_ir_attachment_extension
msgid "File Extension"
msgstr "Dateierweiterung"
#. module: muk_web_preview_attachment
#. openerp-web
#: code:addons/muk_web_preview_attachment/static/src/xml/sidebar_preview.xml:25
#, python-format
msgid "Preview this attachment"
msgstr "Vorschau anzeigen"
#. module: muk_web_preview_attachment
#: model:ir.model,name:muk_web_preview_attachment.model_ir_attachment
msgid "ir.attachment"
msgstr "ir.attachment"

34
muk_web_preview_attachment/i18n/muk_web_preview_attachment.pot

@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_attachment
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-18 23:32+0000\n"
"PO-Revision-Date: 2018-01-18 23:32+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: muk_web_preview_attachment
#: model:ir.model.fields,field_description:muk_web_preview_attachment.field_ir_attachment_extension
msgid "File Extension"
msgstr ""
#. module: muk_web_preview_attachment
#. openerp-web
#: code:addons/muk_web_preview_attachment/static/src/xml/sidebar_preview.xml:25
#, python-format
msgid "Preview this attachment"
msgstr ""
#. module: muk_web_preview_attachment
#: model:ir.model,name:muk_web_preview_attachment.model_ir_attachment
msgid "ir.attachment"
msgstr ""

1
muk_web_preview_attachment/static/description/index.html

@ -49,7 +49,6 @@
</div> </div>
</section> </section>
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<h3 class="oe_slogan">Help and Support</h3> <h3 class="oe_slogan">Help and Support</h3>
<div class="oe_slogan"> <div class="oe_slogan">

9
muk_web_preview_attachment/template/assets.xml

@ -19,14 +19,15 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_attachment/static/src/less/attachment_preview.less" /> <link rel="stylesheet" href="/muk_web_preview_attachment/static/src/less/attachment_preview.less" />
<link rel="stylesheet" href="/muk_web_preview_attachment/static/src/less/sidebar_preview.less" /> <link rel="stylesheet" href="/muk_web_preview_attachment/static/src/less/sidebar_preview.less" />
<script type="text/javascript" src="/muk_web_preview_attachment/static/src/js/preview_helper.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_attachment/static/src/js/preview_helper.js"/>
<script type="text/javascript" src="/muk_web_preview_attachment/static/src/js/attachment_preview.js"/> <script type="text/javascript" src="/muk_web_preview_attachment/static/src/js/attachment_preview.js"/>
<script type="text/javascript" src="/muk_web_preview_attachment/static/src/js/chatter_preview.js"/> <script type="text/javascript" src="/muk_web_preview_attachment/static/src/js/chatter_preview.js"/>
<script type="text/javascript" src="/muk_web_preview_attachment/static/src/js/sidebar_preview.js"/> <script type="text/javascript" src="/muk_web_preview_attachment/static/src/js/sidebar_preview.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

4
muk_web_preview_attachment/views/ir_attachment_view.xml

@ -36,11 +36,9 @@
<field name="inherit_id" ref="mail.view_document_file_kanban"/> <field name="inherit_id" ref="mail.view_document_file_kanban"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//div[@class='o_image']" position="attributes"> <xpath expr="//div[@class='o_image']" position="attributes">
<attribute name="t-att-data-id">record.id.value</attribute>
<attribute name="t-att-data-id">record.id.raw_value</attribute>
</xpath> </xpath>
</field> </field>
</record> </record>
</odoo> </odoo>

2
muk_web_preview_audio/__manifest__.py

@ -29,7 +29,7 @@
- Ogg Theora Vorbis (*.ogg, audio/ogg) - Ogg Theora Vorbis (*.ogg, audio/ogg)
- MP3 (*.mp3, audio/mpeg) - MP3 (*.mp3, audio/mpeg)
""", """,
"version": "11.0.1.0.2",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_audio/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

25
muk_web_preview_audio/i18n/de.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_audio
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 00:57+0000\n"
"PO-Revision-Date: 2018-01-19 01:58+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: de\n"
"X-Generator: Poedit 2.0.5\n"
#. module: muk_web_preview_audio
#. openerp-web
#: code:addons/muk_web_preview_audio/static/src/xml/preview_content.xml:27
#, python-format
msgid "Your browser does not support the audio element."
msgstr "Die Audiodatei wird von Ihrem Browser nicht unterstützt."

24
muk_web_preview_audio/i18n/muk_web_preview_audio.pot

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_audio
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 00:56+0000\n"
"PO-Revision-Date: 2018-01-19 00:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: muk_web_preview_audio
#. openerp-web
#: code:addons/muk_web_preview_audio/static/src/xml/preview_content.xml:27
#, python-format
msgid "Your browser does not support the audio element."
msgstr ""

31
muk_web_preview_audio/static/src/js/preview_handler.js

@ -20,6 +20,7 @@
odoo.define('muk_preview_audio.PreviewHandler', function (require) { odoo.define('muk_preview_audio.PreviewHandler', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -28,13 +29,14 @@ var QWeb = core.qweb;
var _t = core._t; var _t = core._t;
var AudioHandler = PreviewHandler.BaseHandler.extend({ var AudioHandler = PreviewHandler.BaseHandler.extend({
cssLibs: [
],
jsLibs: [
'/muk_web_preview_audio/static/lib/visualizer/visualizer.js',
],
mimetypeMap: { mimetypeMap: {
'.wav': 'audio/wav',
'.ogg': 'audio/ogg',
'.mp3': 'audio/mpeg',
'wav': 'audio/wav',
'ogg': 'audio/ogg',
'mp3': 'audio/mpeg',
'.wav': 'audio/wav', '.ogg': 'audio/ogg', '.mp3': 'audio/mpeg',
'wav': 'audio/wav', 'ogg': 'audio/ogg', 'mp3': 'audio/mpeg',
}, },
checkExtension: function(extension) { checkExtension: function(extension) {
return ['.wav', '.ogg', '.mp3', 'wav', 'ogg', 'mp3'].includes(extension); return ['.wav', '.ogg', '.mp3', 'wav', 'ogg', 'mp3'].includes(extension);
@ -43,14 +45,17 @@ var AudioHandler = PreviewHandler.BaseHandler.extend({
return ['audio/wav', ' audio/ogg', 'audio/mpeg'].includes(mimetype); return ['audio/wav', ' audio/ogg', 'audio/mpeg'].includes(mimetype);
}, },
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
var self = this;
var result = $.Deferred(); var result = $.Deferred();
if(!mimetype || mimetype === 'application/octet-stream') {
mimetype = this.mimetypeMap[extension];
}
var $content = $(QWeb.render('AudioHTMLContent', {url: url, type: mimetype, title: title}));
var visualizer = new Visualizer($content.find('audio'), $content.find('.visualizer'), $content.find('canvas'));
result.resolve($content);
return $.when(result);
ajax.loadLibs(this).then(function() {
if(!mimetype || mimetype === 'application/octet-stream') {
mimetype = self.mimetypeMap[extension];
}
var $content = $(QWeb.render('AudioHTMLContent', {url: url, type: mimetype, title: title}));
var visualizer = new Visualizer($content.find('audio'), $content.find('.visualizer'), $content.find('canvas'));
result.resolve($content);
});
return result;
}, },
}); });

10
muk_web_preview_audio/template/assets.xml

@ -19,12 +19,12 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<script type="text/javascript" src="/muk_web_preview_audio/static/lib/visualizer/visualizer.js"/>
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_audio/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_audio/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_audio/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_audio/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_audio/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_audio/static/src/js/preview_generator.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

2
muk_web_preview_csv/__manifest__.py

@ -27,7 +27,7 @@
Currently the following extensions are supported: Currently the following extensions are supported:
- CSV (*.csv, text/csv) - CSV (*.csv, text/csv)
""", """,
"version": "11.0.1.0.1",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_csv/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

16
muk_web_preview_csv/i18n/de.po

@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 01:02+0000\n"
"PO-Revision-Date: 2018-01-19 01:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

16
muk_web_preview_csv/i18n/muk_web_preview_csv.pot

@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 01:02+0000\n"
"PO-Revision-Date: 2018-01-19 01:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

49
muk_web_preview_csv/static/src/js/preview_handler.js

@ -20,6 +20,7 @@
odoo.define('muk_preview_csv.PreviewHandler', function (require) { odoo.define('muk_preview_csv.PreviewHandler', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -28,6 +29,16 @@ var QWeb = core.qweb;
var _t = core._t; var _t = core._t;
var CSVHandler = PreviewHandler.BaseHandler.extend({ var CSVHandler = PreviewHandler.BaseHandler.extend({
cssLibs: [
'/muk_web_preview_csv/static/lib/pikaday/pikaday.css',
'/muk_web_preview_csv/static/lib/handsontable/handsontable.css',
],
jsLibs: [
'/muk_web_preview_csv/static/lib/PapaParse/papaparse.js',
'/muk_web_preview_csv/static/lib/numbro/numbro.js',
'/muk_web_preview_csv/static/lib/pikaday/pikaday.js',
'/muk_web_preview_csv/static/lib/handsontable/handsontable.js',
],
checkExtension: function(extension) { checkExtension: function(extension) {
return ['.csv', 'csv'].includes(extension); return ['.csv', 'csv'].includes(extension);
}, },
@ -37,25 +48,27 @@ var CSVHandler = PreviewHandler.BaseHandler.extend({
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
var result = $.Deferred(); var result = $.Deferred();
var $content = $(QWeb.render('CSVHTMLContent')); var $content = $(QWeb.render('CSVHTMLContent'));
Papa.parse(url, {
download: true,
dynamicTyping: true,
complete: function(results) {
$content.find('.csv-loader').hide();
$content.find('.csv-container').show();
$content.find('.csv-container').handsontable({
data: results.data,
rowHeaders: true,
colHeaders: true,
stretchH: 'all',
readOnly: true,
columnSorting: true,
autoColumnSize: true,
});
}
});
ajax.loadLibs(this).then(function() {
Papa.parse(url, {
download: true,
dynamicTyping: true,
complete: function(results) {
$content.find('.csv-loader').hide();
$content.find('.csv-container').show();
$content.find('.csv-container').handsontable({
data: results.data,
rowHeaders: true,
colHeaders: true,
stretchH: 'all',
readOnly: true,
columnSorting: true,
autoColumnSize: true,
});
}
});
});
result.resolve($content); result.resolve($content);
return $.when(result);
return result;
}, },
}); });

14
muk_web_preview_csv/template/assets.xml

@ -19,17 +19,11 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<script type="text/javascript" src="/muk_web_preview_csv/static/lib/PapaParse/papaparse.js"/>
<script type="text/javascript" src="/muk_web_preview_csv/static/lib/numbro/numbro.js"/>
<link rel="stylesheet" href="/muk_web_preview_csv/static/lib/pikaday/pikaday.css" />
<script type="text/javascript" src="/muk_web_preview_csv/static/lib/pikaday/pikaday.js"/>
<link rel="stylesheet" href="/muk_web_preview_csv/static/lib/handsontable/handsontable.css" />
<script type="text/javascript" src="/muk_web_preview_csv/static/lib/handsontable/handsontable.js"/>
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_csv/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_csv/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_csv/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_csv/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_csv/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_csv/static/src/js/preview_generator.js"/>
</xpath> </xpath>
</template> </template>

2
muk_web_preview_image/__manifest__.py

@ -46,7 +46,7 @@
- XBM-Dateien (*.xbm, image/x-xbitmap) - XBM-Dateien (*.xbm, image/x-xbitmap)
- XPM-Dateien (*.xpm, image/x-xpixmap) - XPM-Dateien (*.xpm, image/x-xpixmap)
""", """,
"version": "11.0.1.0.2",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_image/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

16
muk_web_preview_image/i18n/de.po

@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 00:35+0000\n"
"PO-Revision-Date: 2018-01-19 00:35+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

16
muk_web_preview_image/i18n/muk_web_preview_image.pot

@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 00:35+0000\n"
"PO-Revision-Date: 2018-01-19 00:35+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

21
muk_web_preview_image/static/src/js/preview_handler.js

@ -20,6 +20,7 @@
odoo.define('muk_preview_image.PreviewHandler', function (require) { odoo.define('muk_preview_image.PreviewHandler', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -28,6 +29,12 @@ var QWeb = core.qweb;
var _t = core._t; var _t = core._t;
var ImageHandler = PreviewHandler.BaseHandler.extend({ var ImageHandler = PreviewHandler.BaseHandler.extend({
cssLibs: [
'/muk_web_preview_image/static/lib/imageviewer/imageviewer.css',
],
jsLibs: [
'/muk_web_preview_image/static/lib/imageviewer/imageviewer.js',
],
checkExtension: function(extension) { checkExtension: function(extension) {
return ['.cod', '.ras', '.fif', '.gif', '.ief', '.jpeg', '.jpg', '.jpe', '.png', '.tiff', return ['.cod', '.ras', '.fif', '.gif', '.ief', '.jpeg', '.jpg', '.jpe', '.png', '.tiff',
'.tif', '.mcf', '.wbmp', '.fh4', '.fh5', '.fhc', '.ico', '.pnm', '.pbm', '.pgm', '.tif', '.mcf', '.wbmp', '.fh4', '.fh5', '.fhc', '.ico', '.pnm', '.pbm', '.pgm',
@ -43,12 +50,14 @@ var ImageHandler = PreviewHandler.BaseHandler.extend({
}, },
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
var result = $.Deferred(); var result = $.Deferred();
var $content = $(QWeb.render('ImageHTMLContent', {url: url, alt: title}));
$content.find('img').click(function (e) {
ImageViewer().show(this.src, this.src);
});
result.resolve($content);
return $.when(result);
ajax.loadLibs(this).then(function() {
var $content = $(QWeb.render('ImageHTMLContent', {url: url, alt: title}));
$content.find('img').click(function (e) {
ImageViewer().show(this.src, this.src);
});
result.resolve($content);
});
return result
}, },
}); });

11
muk_web_preview_image/template/assets.xml

@ -19,13 +19,12 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<link rel="stylesheet" href="/muk_web_preview_image/static/lib/imageviewer/imageviewer.css" />
<script type="text/javascript" src="/muk_web_preview_image/static/lib/imageviewer/imageviewer.js"/>
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_image/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_image/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_image/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_image/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_image/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_image/static/src/js/preview_generator.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

2
muk_web_preview_mail/__manifest__.py

@ -27,7 +27,7 @@
Currently the following mail extensions are supported: Currently the following mail extensions are supported:
- Microsoft Outlook Express Mail Message (*.eml, message/rfc822) - Microsoft Outlook Express Mail Message (*.eml, message/rfc822)
""", """,
"version": "11.0.1.0.3",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_mail/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

95
muk_web_preview_mail/i18n/de.po

@ -0,0 +1,95 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_mail
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 01:19+0000\n"
"PO-Revision-Date: 2018-01-19 02:21+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: de\n"
"X-Generator: Poedit 2.0.5\n"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:43
#, python-format
msgid "Cc:"
msgstr "CC:"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:51
#, python-format
msgid "Date:"
msgstr "Datum:"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/js/preview_handler.js:83
#, python-format
msgid "Download!"
msgstr "Herunterladen!"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:47
#, python-format
msgid "From:"
msgstr "Vom:"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:66
#, python-format
msgid "Messages"
msgstr "Nachrichten"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/js/preview_handler.js:58
#, python-format
msgid "Re: "
msgstr "AW: "
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:34
#, python-format
msgid "Reply"
msgstr "Antworten"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:55
#, python-format
msgid "Subject:"
msgstr "Betreff:"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:39
#, python-format
msgid "To:"
msgstr "AN:"
#. module: muk_web_preview_mail
#: code:addons/muk_web_preview_mail/controllers/main.py:76
#: code:addons/muk_web_preview_mail/controllers/main.py:90
#, python-format
msgid "Unknown Error"
msgstr "Unbekannter Fehler"
#. module: muk_web_preview_mail
#: code:addons/muk_web_preview_mail/controllers/main.py:81
#: code:addons/muk_web_preview_mail/controllers/main.py:88
#, python-format
msgid "Unparsable message! The file has to be of type: message/rfc822"
msgstr "Die Nachricht konnte nicht verarbeitet werden. Die Datei muss vom Typ `message/rfc822` sein."

94
muk_web_preview_mail/i18n/muk_web_preview_mail.pot

@ -0,0 +1,94 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_mail
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 01:19+0000\n"
"PO-Revision-Date: 2018-01-19 01:19+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:43
#, python-format
msgid "Cc:"
msgstr ""
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:51
#, python-format
msgid "Date:"
msgstr ""
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/js/preview_handler.js:83
#, python-format
msgid "Download!"
msgstr ""
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:47
#, python-format
msgid "From:"
msgstr ""
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:66
#, python-format
msgid "Messages"
msgstr ""
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/js/preview_handler.js:58
#, python-format
msgid "Re: "
msgstr ""
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:34
#, python-format
msgid "Reply"
msgstr ""
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:55
#, python-format
msgid "Subject:"
msgstr ""
#. module: muk_web_preview_mail
#. openerp-web
#: code:addons/muk_web_preview_mail/static/src/xml/preview_content.xml:39
#, python-format
msgid "To:"
msgstr ""
#. module: muk_web_preview_mail
#: code:addons/muk_web_preview_mail/controllers/main.py:76
#: code:addons/muk_web_preview_mail/controllers/main.py:90
#, python-format
msgid "Unknown Error"
msgstr ""
#. module: muk_web_preview_mail
#: code:addons/muk_web_preview_mail/controllers/main.py:81
#: code:addons/muk_web_preview_mail/controllers/main.py:88
#, python-format
msgid "Unparsable message! The file has to be of type: message/rfc822"
msgstr ""

3
muk_web_preview_mail/static/src/js/preview_handler.js

@ -20,6 +20,7 @@
odoo.define('muk_preview_mail.PreviewHandler', function (require) { odoo.define('muk_preview_mail.PreviewHandler', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -120,7 +121,7 @@ var MailHandler = PreviewHandler.BaseHandler.extend({
} }
}); });
result.resolve($content); result.resolve($content);
return $.when(result);
return result;
}, },
}); });

8
muk_web_preview_mail/template/assets.xml

@ -19,10 +19,12 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_mail/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_mail/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_mail/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_mail/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_mail/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_mail/static/src/js/preview_generator.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

2
muk_web_preview_markdown/__manifest__.py

@ -27,7 +27,7 @@
Currently the following Markdown file extensions are supported: Currently the following Markdown file extensions are supported:
- Markdown (*.md, text/markdown) - Markdown (*.md, text/markdown)
""", """,
"version": "11.0.1.0.0",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_markdown/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

16
muk_web_preview_markdown/i18n/de.po

@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 10:10+0000\n"
"PO-Revision-Date: 2018-01-19 10:10+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

16
muk_web_preview_markdown/i18n/muk_web_preview_markdown.pot

@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 10:10+0000\n"
"PO-Revision-Date: 2018-01-19 10:10+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

33
muk_web_preview_markdown/static/src/js/preview_handler.js

@ -20,6 +20,7 @@
odoo.define('muk_preview_markdown.PreviewHandler', function (require) { odoo.define('muk_preview_markdown.PreviewHandler', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -28,6 +29,11 @@ var QWeb = core.qweb;
var _t = core._t; var _t = core._t;
var MarkdownHandler = PreviewHandler.BaseHandler.extend({ var MarkdownHandler = PreviewHandler.BaseHandler.extend({
cssLibs: [
],
jsLibs: [
'/muk_web_preview_markdown/static/lib/showdown/showdown.js',
],
checkExtension: function(extension) { checkExtension: function(extension) {
return ['.md', 'md'].includes(extension); return ['.md', 'md'].includes(extension);
}, },
@ -37,19 +43,22 @@ var MarkdownHandler = PreviewHandler.BaseHandler.extend({
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
var result = $.Deferred(); var result = $.Deferred();
var $content = $(QWeb.render('MarkdownHTMLContent')); var $content = $(QWeb.render('MarkdownHTMLContent'));
$.ajax(url, {
dataType: "text",
success: function(text) {
$content.find('.markdown-loader').hide();
$content.find('.markdown-container').show();
$content.find('.markdown-container').html(new showdown.Converter().makeHtml(text));
},
error: function(request, status, error) {
console.error(request.responseText);
}
});
ajax.loadLibs(this).then(function() {
$.ajax(url, {
dataType: "text",
success: function(text) {
$content.find('.markdown-loader').hide();
$content.find('.markdown-container').show();
$content.find('.markdown-container').html(
new showdown.Converter().makeHtml(text));
},
error: function(request, status, error) {
console.error(request.responseText);
}
});
});
result.resolve($content); result.resolve($content);
return $.when(result);
return result;
}, },
}); });

10
muk_web_preview_markdown/template/assets.xml

@ -19,12 +19,12 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<script type="text/javascript" src="/muk_web_preview_markdown/static/lib/showdown/showdown.js"/>
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_markdown/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_markdown/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_markdown/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_markdown/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_markdown/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_markdown/static/src/js/preview_generator.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

2
muk_web_preview_msoffice/__manifest__.py

@ -29,7 +29,7 @@
- Excel (*.xls | *.xlsx, application/msexcel) - Excel (*.xls | *.xlsx, application/msexcel)
- PowerPoint (*.ppt | *.pptx, application/mspowerpoint) - PowerPoint (*.ppt | *.pptx, application/mspowerpoint)
""", """,
"version": "11.0.1.0.3",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_msoffice/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

37
muk_web_preview_msoffice/i18n/de.po

@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_msoffice
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 10:22+0000\n"
"PO-Revision-Date: 2018-01-19 11:23+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: de\n"
"X-Generator: Poedit 2.0.5\n"
#. module: muk_web_preview_msoffice
#: code:addons/muk_web_preview_msoffice/controllers/main.py:98
#, python-format
msgid "An error occurred during the process. Please contact your system administrator."
msgstr "Während der Anfrage ist ein Fehler aufgetreten. Bitte kontaktieren Sie Ihren Systemadministrator."
#. module: muk_web_preview_msoffice
#: code:addons/muk_web_preview_msoffice/controllers/main.py:95
#, python-format
msgid "The file couldn't be converted. Unsupported mine type."
msgstr "Die Datei konnte nicht konvertiert werden. Das Dateiformat wird nicht unterstützt."
#. module: muk_web_preview_msoffice
#: code:addons/muk_web_preview_msoffice/controllers/main.py:79
#: code:addons/muk_web_preview_msoffice/controllers/main.py:89
#, python-format
msgid "Unknown Error"
msgstr "Unbekannter Fehler"

36
muk_web_preview_msoffice/i18n/muk_web_preview_msoffice.pot

@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_msoffice
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 10:21+0000\n"
"PO-Revision-Date: 2018-01-19 10:21+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: muk_web_preview_msoffice
#: code:addons/muk_web_preview_msoffice/controllers/main.py:98
#, python-format
msgid "An error occurred during the process. Please contact your system administrator."
msgstr ""
#. module: muk_web_preview_msoffice
#: code:addons/muk_web_preview_msoffice/controllers/main.py:95
#, python-format
msgid "The file couldn't be converted. Unsupported mine type."
msgstr ""
#. module: muk_web_preview_msoffice
#: code:addons/muk_web_preview_msoffice/controllers/main.py:79
#: code:addons/muk_web_preview_msoffice/controllers/main.py:89
#, python-format
msgid "Unknown Error"
msgstr ""

129
muk_web_preview_msoffice/static/src/js/preview_handler.js

@ -20,6 +20,7 @@
odoo.define('muk_preview_msoffice.PreviewHandler', function (require) { odoo.define('muk_preview_msoffice.PreviewHandler', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -57,6 +58,14 @@ var PowerPointHandler = PreviewHandler.PDFHandler.extend({
}); });
var ExcelHandler = PreviewHandler.BaseHandler.extend({ var ExcelHandler = PreviewHandler.BaseHandler.extend({
cssLibs: [
'/muk_web_preview_msoffice/static/lib/handsontable/handsontable.css',
],
jsLibs: [
'/muk_web_preview_msoffice/static/lib/jQueryBinaryTransport/jquery-binarytransport.js',
'/muk_web_preview_msoffice/static/lib/SheetJS/xlsx.js',
'/muk_web_preview_msoffice/static/lib/handsontable/handsontable.js'
],
checkExtension: function(extension) { checkExtension: function(extension) {
return ['.xls', '.xlsx', '.xlsm', '.xlsb', 'xls', 'xlsx', 'xlsm', 'xlsb'].includes(extension); return ['.xls', '.xlsx', '.xlsm', '.xlsb', 'xls', 'xlsx', 'xlsm', 'xlsb'].includes(extension);
}, },
@ -67,66 +76,70 @@ var ExcelHandler = PreviewHandler.BaseHandler.extend({
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
var result = $.Deferred(); var result = $.Deferred();
var $content = $(QWeb.render('ExcelHTMLContent')); var $content = $(QWeb.render('ExcelHTMLContent'));
$.ajax(url, {
type: "GET",
dataType: "binary",
responseType:'arraybuffer',
processData: false,
success: function(arraybuffer) {
var data = new Uint8Array(arraybuffer);
var arr = new Array();
for(var i = 0; i != data.length; ++i) {
arr[i] = String.fromCharCode(data[i]);
}
var workbook = XLSX.read(arr.join(""), {
type:"binary",
cellDates:true,
cellStyles:true,
cellNF:true
});
var jsonWorkbook = {};
_.each(workbook.SheetNames, function(sheet, index, list) {
var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[sheet], {header:1});
if(jsonData.length > 0) {
jsonWorkbook[sheet] = jsonData;
ajax.loadLibs(this).then(function() {
$.ajax(url, {
type: "GET",
dataType: "binary",
responseType:'arraybuffer',
processData: false,
success: function(arraybuffer) {
var data = new Uint8Array(arraybuffer);
var arr = new Array();
for(var i = 0; i != data.length; ++i) {
arr[i] = String.fromCharCode(data[i]);
} }
var worksheet = workbook.Sheets[sheet];
});
$content.find('.excel-loader').hide();
$content.find('.excel-container').show();
var index = 0;
_.each(jsonWorkbook, function(sheet, sheetname, list) {
var $tab = $('<a/>');
$tab.attr('href', '#sheet-' + index);
$tab.attr('aria-controls', 'sheet-' + index);
$tab.attr('role', 'tab');
$tab.attr('data-toggle', 'tab');
$tab.append('<i class="fa fa-table" aria-hidden="true"></i>');
$tab.append($('<span/>').text(sheetname));
$content.find('.nav-tabs').append($('<li/>').append($tab));
var $pane = $('<div/>');
$pane.addClass('tab-pane table-container');
$pane.attr('id', 'sheet-' + index);
$pane.handsontable({
data: sheet,
rowHeaders: true,
colHeaders: true,
stretchH: 'all',
readOnly: true,
columnSorting: true,
autoColumnSize: true,
});
$content.find('.tab-content').append($pane);
index++;
});
$content.find('.tab-line a:first').tab('show')
},
error: function(request, status, error) {
console.error(request.responseText);
},
});
var workbook = XLSX.read(arr.join(""), {
type:"binary",
cellDates:true,
cellStyles:true,
cellNF:true
});
var jsonWorkbook = {};
_.each(workbook.SheetNames, function(sheet, index, list) {
var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[sheet], {header:1});
if(jsonData.length > 0) {
jsonWorkbook[sheet] = jsonData;
}
var worksheet = workbook.Sheets[sheet];
});
$content.find('.excel-loader').hide();
$content.find('.excel-container').show();
var index = 0;
_.each(jsonWorkbook, function(sheet, sheetname, list) {
var $tab = $('<a/>');
$tab.attr('href', '#sheet-' + index);
$tab.attr('aria-controls', 'sheet-' + index);
$tab.attr('role', 'tab');
$tab.attr('data-toggle', 'tab');
$tab.append('<i class="fa fa-table" aria-hidden="true"></i>');
$tab.append($('<span/>').text(sheetname));
$content.find('.nav-tabs').append($('<li/>').append($tab));
var $pane = $('<div/>');
$pane.addClass('tab-pane table-container');
$pane.attr('id', 'sheet-' + index);
$pane.handsontable({
data: sheet,
rowHeaders: true,
colHeaders: true,
stretchH: 'all',
readOnly: true,
columnSorting: true,
autoColumnSize: true,
});
$content.find('.tab-content').append($pane);
if(index == 0) {
$tab.tab('show');
}
index++;
});
},
error: function(request, status, error) {
console.error(request.responseText);
},
});
});
result.resolve($content); result.resolve($content);
return $.when(result);
return result;
}, },
}); });

14
muk_web_preview_msoffice/template/assets.xml

@ -19,16 +19,12 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<script type="text/javascript" src="/muk_web_preview_msoffice/static/lib/jQueryBinaryTransport/jquery-binarytransport.js"/>
<script type="text/javascript" src="/muk_web_preview_msoffice/static/lib/SheetJS/xlsx.js"/>
<link rel="stylesheet" href="/muk_web_preview_msoffice/static/lib/handsontable/handsontable.css" />
<script type="text/javascript" src="/muk_web_preview_msoffice/static/lib/handsontable/handsontable.js"/>
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_msoffice/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_msoffice/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_msoffice/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_msoffice/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_msoffice/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_msoffice/static/src/js/preview_generator.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

2
muk_web_preview_text/__manifest__.py

@ -26,7 +26,7 @@
Extendes the Preview Dialog to support text files. Extendes the Preview Dialog to support text files.
It supports most of the common text file extensions. It supports most of the common text file extensions.
""", """,
"version": "11.0.1.0.3",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_text/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

1053
muk_web_preview_text/i18n/de.po
File diff suppressed because it is too large
View File

1053
muk_web_preview_text/i18n/muk_web_preview_text.pot
File diff suppressed because it is too large
View File

84
muk_web_preview_text/static/src/js/preview_handler.js

@ -20,6 +20,7 @@
odoo.define('muk_preview_text.PreviewHandler', function (require) { odoo.define('muk_preview_text.PreviewHandler', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -28,6 +29,13 @@ var QWeb = core.qweb;
var _t = core._t; var _t = core._t;
var TextHandler = PreviewHandler.BaseHandler.extend({ var TextHandler = PreviewHandler.BaseHandler.extend({
cssLibs: [
'/muk_web_preview_text/static/lib/highlight/styles/default.css',
],
jsLibs: [
'/muk_web_preview_text/static/lib/highlight/highlight.pack.js',
'/muk_web_preview_text/static/lib/highlight_line_numbers/highlight_line_numbers.js',
],
checkExtension: function(extension) { checkExtension: function(extension) {
return ['.abc', '.acgi', '.aip', '.asm', '.asp', '.c', '.c', '.c++', '.cc', '.cc', '.com', '.conf', return ['.abc', '.acgi', '.aip', '.asm', '.asp', '.c', '.c', '.c++', '.cc', '.cc', '.com', '.conf',
'.cpp', '.csh', '.css', '.cxx', '.def', '.el', '.etx', '.f', '.f', '.f77', '.f90', '.f90', '.cpp', '.csh', '.css', '.cxx', '.def', '.el', '.etx', '.f', '.f', '.f77', '.f90', '.f90',
@ -64,44 +72,46 @@ var TextHandler = PreviewHandler.BaseHandler.extend({
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
var result = $.Deferred(); var result = $.Deferred();
var $content = $(QWeb.render('TextHTMLContent')); var $content = $(QWeb.render('TextHTMLContent'));
$.ajax(url, {
dataType: "text",
success: function(text) {
$content.find('.code-loader').hide();
$content.find('.code-container').show();
var $codeBlock = $content.find('.code-view');
var $codeLang = $content.find(".code-lang");
function setText(language) {
$codeBlock.removeClass();
$codeBlock.addClass('code-view');
if(language) {
$codeBlock.addClass(language);
}
$codeBlock.text(text);
hljs.highlightBlock($codeBlock[0]);
hljs.lineNumbersBlock($codeBlock[0]);
}
setText();
$codeLang.select2();
$codeLang.on("change", function(e) {
if(e.val === 'default') {
setText();
} else {
setText(e.val);
}
});
$.each($codeBlock.attr('class').split(" "), function (i, cls) {
if($content.find(".code-lang option[value='" + cls + "']").val()) {
$codeLang.val(cls).trigger("change");
}
});
},
error: function(request, status, error) {
console.error(request.responseText);
}
});
ajax.loadLibs(this).then(function() {
$.ajax(url, {
dataType: "text",
success: function(text) {
$content.find('.code-loader').hide();
$content.find('.code-container').show();
var $codeBlock = $content.find('.code-view');
var $codeLang = $content.find(".code-lang");
function setText(language) {
$codeBlock.removeClass();
$codeBlock.addClass('code-view');
if(language) {
$codeBlock.addClass(language);
}
$codeBlock.text(text);
hljs.highlightBlock($codeBlock[0]);
hljs.lineNumbersBlock($codeBlock[0]);
}
setText();
$codeLang.select2();
$codeLang.on("change", function(e) {
if(e.val === 'default') {
setText();
} else {
setText(e.val);
}
});
$.each($codeBlock.attr('class').split(" "), function (i, cls) {
if($content.find(".code-lang option[value='" + cls + "']").val()) {
$codeLang.val(cls).trigger("change");
}
});
},
error: function(request, status, error) {
console.error(request.responseText);
}
});
});
result.resolve($content); result.resolve($content);
return $.when(result);
return result;
}, },
}); });

12
muk_web_preview_text/template/assets.xml

@ -19,14 +19,12 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<link rel="stylesheet" href="/muk_web_preview_text/static/lib/highlight/styles/default.css" />
<script type="text/javascript" src="/muk_web_preview_text/static/lib/highlight/highlight.pack.js"/>
<script type="text/javascript" src="/muk_web_preview_text/static/lib/highlight_line_numbers/highlight_line_numbers.js"/>
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_text/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_text/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_text/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_text/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_text/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_text/static/src/js/preview_generator.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

2
muk_web_preview_vector/__manifest__.py

@ -27,7 +27,7 @@
Currently the following vector graphic extensions are supported: Currently the following vector graphic extensions are supported:
- Scalable Vector Graphics (*.svg, image/svg+xml) - Scalable Vector Graphics (*.svg, image/svg+xml)
""", """,
"version": "11.0.1.0.1",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_vector/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

16
muk_web_preview_vector/i18n/de.po

@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 11:57+0000\n"
"PO-Revision-Date: 2018-01-19 11:57+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

16
muk_web_preview_vector/i18n/muk_web_preview_vector.pot

@ -0,0 +1,16 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 11:57+0000\n"
"PO-Revision-Date: 2018-01-19 11:57+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

72
muk_web_preview_vector/static/src/js/preview_handler.js

@ -20,6 +20,7 @@
odoo.define('muk_preview_vector.PreviewHandler', function (require) { odoo.define('muk_preview_vector.PreviewHandler', function (require) {
"use strict"; "use strict";
var ajax = require('web.ajax');
var core = require('web.core'); var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler'); var PreviewHandler = require('muk_preview.PreviewHandler');
@ -28,6 +29,11 @@ var QWeb = core.qweb;
var _t = core._t; var _t = core._t;
var VectorHandler = PreviewHandler.BaseHandler.extend({ var VectorHandler = PreviewHandler.BaseHandler.extend({
cssLibs: [
],
jsLibs: [
'/muk_web_preview_vector/static/lib/svg-pan-zoom/svg-pan-zoom.js',
],
checkExtension: function(extension) { checkExtension: function(extension) {
return ['.svg', 'svg'].includes(extension); return ['.svg', 'svg'].includes(extension);
}, },
@ -37,40 +43,42 @@ var VectorHandler = PreviewHandler.BaseHandler.extend({
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
var result = $.Deferred(); var result = $.Deferred();
var $content = $(QWeb.render('VectorHTMLContent', {url: url})); var $content = $(QWeb.render('VectorHTMLContent', {url: url}));
$.ajax(url, {
dataType: "text",
success: function(vector) {
$content.find('.vector-loader').hide();
$content.find('.vector-container').show();
$content.find('.vector-content').html(vector);
var svgPanZoom = $("svg").svgPanZoom({
events: {
mouseWheel: true,
doubleClick: true,
drag: true,
dragCursor: "move",
},
animationTime: 300,
zoomFactor: 0.1,
maxZoom: 5,
panFactor: 100,
});
$content.find('.zoom-plus').click(function(){
svgPanZoom.zoomIn()
});
$content.find('.zoom-minus').click(function(){
svgPanZoom.zoomOut()
});
$content.find('.zoom-reset').click(function(){
svgPanZoom.reset()
});
},
error: function(request, status, error) {
console.error(request.responseText);
}
ajax.loadLibs(this).then(function() {
$.ajax(url, {
dataType: "text",
success: function(vector) {
$content.find('.vector-loader').hide();
$content.find('.vector-container').show();
$content.find('.vector-content').html(vector);
var svgPanZoom = $("svg").svgPanZoom({
events: {
mouseWheel: true,
doubleClick: true,
drag: true,
dragCursor: "move",
},
animationTime: 300,
zoomFactor: 0.1,
maxZoom: 5,
panFactor: 100,
});
$content.find('.zoom-plus').click(function(){
svgPanZoom.zoomIn()
});
$content.find('.zoom-minus').click(function(){
svgPanZoom.zoomOut()
});
$content.find('.zoom-reset').click(function(){
svgPanZoom.reset()
});
},
error: function(request, status, error) {
console.error(request.responseText);
}
});
}); });
result.resolve($content); result.resolve($content);
return $.when(result);
return result;
}, },
}); });

10
muk_web_preview_vector/template/assets.xml

@ -19,12 +19,12 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<script type="text/javascript" src="/muk_web_preview_vector/static/lib/svg-pan-zoom/svg-pan-zoom.js"/>
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_vector/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_vector/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_vector/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_vector/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_vector/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_vector/static/src/js/preview_generator.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>

2
muk_web_preview_video/__manifest__.py

@ -29,7 +29,7 @@
- Ogg Theora Vorbis (*.ogg, video/ogg) - Ogg Theora Vorbis (*.ogg, video/ogg)
- MP4 (*.mp4, video/mp4) - MP4 (*.mp4, video/mp4)
""", """,
"version": "11.0.1.0.2",
"version": "11.0.1.1.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

10
muk_web_preview_video/doc/changelog.rst

@ -0,0 +1,10 @@
`1.1.0`
-------
- Lazy load javascript
`1.0.0`
-------
- Init version

25
muk_web_preview_video/i18n/de.po

@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_video
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 12:01+0000\n"
"PO-Revision-Date: 2018-01-19 13:02+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: de\n"
"X-Generator: Poedit 2.0.5\n"
#. module: muk_web_preview_video
#. openerp-web
#: code:addons/muk_web_preview_video/static/src/xml/preview_content.xml:23
#, python-format
msgid "Your browser does not support the video tag."
msgstr "Dieser Videotyp wird von Ihrem Browser nicht unterstützt."

24
muk_web_preview_video/i18n/muk_web_preview_video.pot

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_web_preview_video
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 12:00+0000\n"
"PO-Revision-Date: 2018-01-19 12:00+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: muk_web_preview_video
#. openerp-web
#: code:addons/muk_web_preview_video/static/src/xml/preview_content.xml:23
#, python-format
msgid "Your browser does not support the video tag."
msgstr ""

8
muk_web_preview_video/template/assets.xml

@ -19,10 +19,12 @@
<odoo> <odoo>
<template id="assets_backend" inherit_id="web.assets_backend"> <template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" href="/muk_web_preview_video/static/src/less/preview_content.less" /> <link rel="stylesheet" href="/muk_web_preview_video/static/src/less/preview_content.less" />
<script type="text/javascript" src="/muk_web_preview_video/static/src/js/preview_handler.js"/>
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_preview_video/static/src/js/preview_handler.js"/>
<script type="text/javascript" src="/muk_web_preview_video/static/src/js/preview_generator.js"/> <script type="text/javascript" src="/muk_web_preview_video/static/src/js/preview_generator.js"/>
</xpath>
</xpath>
</template> </template>
</odoo> </odoo>
Loading…
Cancel
Save