Mathias Markl 7 years ago
parent
commit
6ea7ba4949
  1. 81
      muk_web_preview/README.md
  2. 2
      muk_web_preview/__init__.py
  3. 13
      muk_web_preview/__manifest__.py
  4. 22
      muk_web_preview/demo/preview_demo.xml
  5. 7
      muk_web_preview/doc/changelog.rst
  6. 126
      muk_web_preview/doc/index.rst
  7. 36
      muk_web_preview/static/description/index.html
  8. 2
      muk_web_preview/static/src/js/preview_dialog.js
  9. 6
      muk_web_preview/static/src/js/preview_handler.js
  10. 1
      muk_web_preview/static/src/less/preview_content.less
  11. 17
      muk_web_preview/static/test/tour.js
  12. 2
      muk_web_preview/template/assets.xml
  13. 3
      muk_web_preview/tests/__init__.py
  14. 11
      muk_web_preview/tests/test_preview.py
  15. 2
      muk_web_utils/__manifest__.py
  16. 0
      muk_web_utils/static/lib/PDFjs/LICENSE
  17. 0
      muk_web_utils/static/lib/PDFjs/build/pdf.js
  18. 0
      muk_web_utils/static/lib/PDFjs/build/pdf.worker.js
  19. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/78-EUC-H.bcmap
  20. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/78-EUC-V.bcmap
  21. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/78-H.bcmap
  22. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/78-RKSJ-H.bcmap
  23. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/78-RKSJ-V.bcmap
  24. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/78-V.bcmap
  25. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/78ms-RKSJ-H.bcmap
  26. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/78ms-RKSJ-V.bcmap
  27. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/83pv-RKSJ-H.bcmap
  28. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/90ms-RKSJ-H.bcmap
  29. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/90ms-RKSJ-V.bcmap
  30. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/90msp-RKSJ-H.bcmap
  31. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/90msp-RKSJ-V.bcmap
  32. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/90pv-RKSJ-H.bcmap
  33. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/90pv-RKSJ-V.bcmap
  34. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Add-H.bcmap
  35. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Add-RKSJ-H.bcmap
  36. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Add-RKSJ-V.bcmap
  37. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Add-V.bcmap
  38. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-0.bcmap
  39. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-1.bcmap
  40. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-2.bcmap
  41. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-3.bcmap
  42. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-4.bcmap
  43. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-5.bcmap
  44. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-6.bcmap
  45. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-UCS2.bcmap
  46. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-0.bcmap
  47. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-1.bcmap
  48. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-2.bcmap
  49. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-3.bcmap
  50. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-4.bcmap
  51. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-5.bcmap
  52. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-UCS2.bcmap
  53. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-0.bcmap
  54. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-1.bcmap
  55. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-2.bcmap
  56. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-3.bcmap
  57. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-4.bcmap
  58. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-5.bcmap
  59. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-6.bcmap
  60. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-UCS2.bcmap
  61. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Korea1-0.bcmap
  62. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Korea1-1.bcmap
  63. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Korea1-2.bcmap
  64. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Korea1-UCS2.bcmap
  65. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/B5-H.bcmap
  66. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/B5-V.bcmap
  67. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/B5pc-H.bcmap
  68. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/B5pc-V.bcmap
  69. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/CNS-EUC-H.bcmap
  70. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/CNS-EUC-V.bcmap
  71. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/CNS1-H.bcmap
  72. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/CNS1-V.bcmap
  73. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/CNS2-H.bcmap
  74. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/CNS2-V.bcmap
  75. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/ETHK-B5-H.bcmap
  76. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/ETHK-B5-V.bcmap
  77. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/ETen-B5-H.bcmap
  78. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/ETen-B5-V.bcmap
  79. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/ETenms-B5-H.bcmap
  80. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/ETenms-B5-V.bcmap
  81. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/EUC-H.bcmap
  82. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/EUC-V.bcmap
  83. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Ext-H.bcmap
  84. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Ext-RKSJ-H.bcmap
  85. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Ext-RKSJ-V.bcmap
  86. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/Ext-V.bcmap
  87. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GB-EUC-H.bcmap
  88. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GB-EUC-V.bcmap
  89. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GB-H.bcmap
  90. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GB-V.bcmap
  91. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBK-EUC-H.bcmap
  92. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBK-EUC-V.bcmap
  93. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBK2K-H.bcmap
  94. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBK2K-V.bcmap
  95. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBKp-EUC-H.bcmap
  96. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBKp-EUC-V.bcmap
  97. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBT-EUC-H.bcmap
  98. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBT-EUC-V.bcmap
  99. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBT-H.bcmap
  100. 0
      muk_web_utils/static/lib/PDFjs/web/cmaps/GBT-V.bcmap

81
muk_web_preview/README.md

@ -1,81 +0,0 @@
# MuK Preview
MuK Preview enables support to preview binary files directly in Odoo. It adds
a button to the binary field, which opens a file preview dialog. The preview can be
easily extended by adding new Handlers to the Preview Generator.
## Extend MuK Preview
To extend the preview a new "PreviewHandler" has to be created and subsequently added to the "PreviewGenerator".
In the following steps show the implementation of the image preview.
### PreviewHandler
```javascript
odoo.define('muk_preview_image.PreviewHandler', function (require) {
"use strict";
var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler');
var QWeb = core.qweb;
var _t = core._t;
var ImageHandler = PreviewHandler.BaseHandler.extend({
checkExtension: function(extension) {
return ['.cod', '.ras', '.fif', '.gif', '.ief', '.jpeg', '.jpg', '.jpe', '.png', '.tiff',
'.tif', '.mcf', '.wbmp', '.fh4', '.fh5', '.fhc', '.ico', '.pnm', '.pbm', '.pgm',
'.ppm', '.rgb', '.xwd', '.xbm', '.xpm', 'cod', 'ras', 'fif', 'gif', 'ief', 'jpeg',
'jpg', 'jpe', 'png', 'tiff', '.tif', 'mcf', 'wbmp', 'fh4', 'fh5', 'fhc', 'ico',
'pnm', 'pbm', 'pgm', '.ppm', 'rgb', 'xwd', 'xbm', 'xpm'].includes(extension);
},
checkType: function(mimetype) {
return ['image/cis-cod', 'image/cmu-raster', 'image/fif', 'image/gif', 'image/ief', 'image/jpeg',
'image/png', 'image/tiff', 'image/vasa', 'image/vnd.wap.wbmp', 'image/x-freehand', 'image/x-icon',
'image/x-portable-anymap', 'image/x-portable-bitmap', 'image/x-portable-graymap', 'image/x-portable-pixmap',
'image/x-rgb', 'image/x-windowdump', 'image/x-xbitmap', 'image/x-xpixmap'].includes(mimetype);
},
createHtml: function(url, mimetype, extension, title) {
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);
},
});
return {
ImageHandler: ImageHandler,
}
});
```
### PreviewGenerator
```javascript
odoo.define('muk_preview_image.PreviewGenerator', function (require) {
"use strict";
var core = require('web.core');
var PreviewGenerator = require('muk_preview.PreviewGenerator');
var PreviewHandler = require('muk_preview_image.PreviewHandler');
var QWeb = core.qweb;
var _t = core._t;
PreviewGenerator.include({
init: function(widget, additional_handler) {
this._super(widget, additional_handler);
this.handler = _.extend(this.handler, {
"ImageHandler": new PreviewHandler.ImageHandler(widget),
});
},
});
});
```

2
muk_web_preview/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH

13
muk_web_preview/__manifest__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -22,17 +20,11 @@
{ {
"name": "MuK Preview", "name": "MuK Preview",
"summary": """File Preview Dialog""", "summary": """File Preview Dialog""",
"description": """
Adds a button to the FieldBinaryFile form widget to
preview the file content directly in the browser.
Currently the following file extensions are supported:
- Portable Document Format (.pdf)
- Open Document (.odt, .odp, .ods, .otp)
""",
"version": "11.0.1.1.0",
"version": "11.0.2.0.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",
"live_test_url": "https://demo.mukit.at/web/login",
"author": "MuK IT", "author": "MuK IT",
"contributors": [ "contributors": [
"Mathias Markl <mathias.markl@mukit.at>", "Mathias Markl <mathias.markl@mukit.at>",
@ -40,6 +32,7 @@
"depends": [ "depends": [
"base", "base",
"web", "web",
"muk_web_utils",
], ],
"data": [ "data": [
"template/assets.xml", "template/assets.xml",

22
muk_web_preview/demo/preview_demo.xml

@ -1,6 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!--
Copyright (C) 2017 MuK IT GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<odoo noupdate="1">
<record id="pdf_attachment_demo" model="ir.attachment"> <record id="pdf_attachment_demo" model="ir.attachment">
<field name="name">sample.pdf</field> <field name="name">sample.pdf</field>
@ -8,5 +25,4 @@
<field name="datas" type="base64" file="muk_web_preview/demo/data/sample.pdf"/> <field name="datas" type="base64" file="muk_web_preview/demo/data/sample.pdf"/>
</record> </record>
</data>
</odoo> </odoo>

7
muk_web_preview/doc/changelog.rst

@ -1,9 +1,14 @@
`2.0.0`
-------
- Migrated to Python 3
- Moved libraries to Web Utils
`1.1.0` `1.1.0`
------- -------
- Lazy load javascript - Lazy load javascript
`1.0.0` `1.0.0`
------- -------

126
muk_web_preview/doc/index.rst

@ -0,0 +1,126 @@
===========
MuK Preview
===========
MuK Preview enables support to preview binary files directly in Odoo. It adds a
button to the binary field, which opens a file preview dialog. The preview can
be easily extended by adding new Handlers to the Preview Generator.
Installation
============
To install this module, you need to:
Download the module and add it to your Odoo addons folder. Afterward, log on to
your Odoo server and go to the Apps menu. Trigger the debug modus and update the
list by clicking on the "Update Apps List" link. Now install the module by
clicking on the install button.
Configuration
=============
No additional configuration is needed to use this module.
Usage
=============
To each Binary Field Widget a button is added, which opens the Preview Dialog.
Framework
=============
To extend the preview a new "PreviewHandler" has to be created and subsequently added to the "PreviewGenerator".
In the following steps show the implementation of the image preview.
PreviewHandler
--------------
.. code-block:: javascript
odoo.define('muk_preview_image.PreviewHandler', function (require) {
"use strict";
var core = require('web.core');
var PreviewHandler = require('muk_preview.PreviewHandler');
var QWeb = core.qweb;
var _t = core._t;
var ImageHandler = PreviewHandler.BaseHandler.extend({
checkExtension: function(extension) {
return ['.cod', '.ras', '.fif', '.gif', '.ief', '.jpeg', '.jpg', '.jpe', '.png', '.tiff',
'.tif', '.mcf', '.wbmp', '.fh4', '.fh5', '.fhc', '.ico', '.pnm', '.pbm', '.pgm',
'.ppm', '.rgb', '.xwd', '.xbm', '.xpm', 'cod', 'ras', 'fif', 'gif', 'ief', 'jpeg',
'jpg', 'jpe', 'png', 'tiff', '.tif', 'mcf', 'wbmp', 'fh4', 'fh5', 'fhc', 'ico',
'pnm', 'pbm', 'pgm', '.ppm', 'rgb', 'xwd', 'xbm', 'xpm'].includes(extension);
},
checkType: function(mimetype) {
return ['image/cis-cod', 'image/cmu-raster', 'image/fif', 'image/gif', 'image/ief', 'image/jpeg',
'image/png', 'image/tiff', 'image/vasa', 'image/vnd.wap.wbmp', 'image/x-freehand', 'image/x-icon',
'image/x-portable-anymap', 'image/x-portable-bitmap', 'image/x-portable-graymap', 'image/x-portable-pixmap',
'image/x-rgb', 'image/x-windowdump', 'image/x-xbitmap', 'image/x-xpixmap'].includes(mimetype);
},
createHtml: function(url, mimetype, extension, title) {
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);
},
});
return {
ImageHandler: ImageHandler,
}
});
PreviewGenerator
----------------
.. code-block:: javascript
odoo.define('muk_preview_image.PreviewGenerator', function (require) {
"use strict";
var core = require('web.core');
var PreviewGenerator = require('muk_preview.PreviewGenerator');
var PreviewHandler = require('muk_preview_image.PreviewHandler');
var QWeb = core.qweb;
var _t = core._t;
PreviewGenerator.include({
init: function(widget, additional_handler) {
this._super(widget, additional_handler);
this.handler = _.extend(this.handler, {
"ImageHandler": new PreviewHandler.ImageHandler(widget),
});
},
});
});
Credits
=======
Contributors
------------
* Mathias Markl <mathias.markl@mukit.at>
Author & Maintainer
-------------------
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_.
MuK IT is an Austrian company specialized in customizing and extending Odoo.
We develop custom solutions for your individual needs to help you focus on
your strength and expertise to grow your business.
If you want to get in touch please contact us via mail
(sale@mukit.at) or visit our website (https://mukit.at).

36
muk_web_preview/static/description/index.html

@ -4,7 +4,7 @@
<h3 class="oe_slogan">Preview your files directly in Odoo.</h3> <h3 class="oe_slogan">Preview your files directly in Odoo.</h3>
<h4 class="oe_slogan" style="font-size: 23px;">MuK IT GmbH - <h4 class="oe_slogan" style="font-size: 23px;">MuK IT GmbH -
www.mukit.at</h4> www.mukit.at</h4>
<div class="oe_demo oe_screenshot">
<div class="oe_demo oe_screenshot" style="max-width: 84%; margin: 16px 8%;">
<img src="screenshot.png"> <img src="screenshot.png">
</div> </div>
</div> </div>
@ -12,7 +12,7 @@
<section class="oe_container" style="padding-top: 25px;"> <section class="oe_container" style="padding-top: 25px;">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_picture">
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Overview</h3> <h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32 text-justify">MuK Preview enables support to <p class="oe_mt32 text-justify">MuK Preview enables support to
preview binary files directly in Odoo. It adds a button to the preview binary files directly in Odoo. It adds a button to the
@ -232,14 +232,46 @@
</div> </div>
</section> </section>
<section class="oe_container oe_dark"
style="margin-bottom: 20px; border-top: 5px solid #797979; border-bottom: 5px solid #797979;">
<h3 class="oe_slogan" style="margin-bottom: 10px;">Demo</h3>
<div class="row" style="margin: auto; max-width: 200px;">
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">User:</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">apps</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">Password:</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">demo</h5>
</div>
</div>
<div class="oe_slogan" style="margin-top: 5px;">
<a class="btn btn-primary btn-lg mt8"
href="https://demo.mukit.at/web/login"
style="position: relative; overflow: hidden;"><span
class="o_ripple"
style="height: 138px; width: 138px; top: -35.2969px; left: -8.17188px;"></span>
<i class="fa fa-video-camera"></i> Live Preview </a>
</div>
</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>
<h5 class="oe_slogan" style="font-size: 20px;">Feel free to
contact us, if you need any help with your Odoo integration or
addiontal features.</h5>
<div class="oe_slogan"> <div class="oe_slogan">
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at"> <a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Email <i class="fa fa-envelope"></i> Email
</a> <a class="btn btn-primary btn-lg mt8" </a> <a class="btn btn-primary btn-lg mt8"
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i> href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i>
Contact Contact
</a> <a class="btn btn-primary btn-lg mt8" href="mailto:support@mukit.at">
<i class="fa fa-life-ring"></i> Support
</a> </a>
</div> </div>
<img src="logo.png" style="width: 200px; margin-bottom: 20px;" <img src="logo.png" style="width: 200px; margin-bottom: 20px;"

2
muk_web_preview/static/src/js/preview_dialog.js

@ -36,7 +36,7 @@ var PreviewDialog = Widget.extend({
cssLibs: [ cssLibs: [
], ],
jsLibs: [ jsLibs: [
'/muk_web_preview/static/lib/printThis/printThis.js',
'/muk_web_utils/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);

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

@ -49,7 +49,7 @@ var PDFHandler = BaseHandler.extend({
}, },
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
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_utils/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 result; return result;
}, },
@ -66,7 +66,7 @@ var OpenOfficeHandler = BaseHandler.extend({
}, },
createHtml: function(url, mimetype, extension, title) { createHtml: function(url, mimetype, extension, title) {
var result = $.Deferred(); var result = $.Deferred();
var viewerUrlTempalte = _.template('/muk_web_preview/static/lib/ViewerJS/index.html#<%= url %>');
var viewerUrlTempalte = _.template('/muk_web_utils/static/lib/ViewerJS/index.html#<%= url %>');
result.resolve($(QWeb.render('ViewerJSFrame', {url: viewerUrlTempalte({url})}))); result.resolve($(QWeb.render('ViewerJSFrame', {url: viewerUrlTempalte({url})})));
return result; return result;
}, },
@ -76,6 +76,6 @@ return {
BaseHandler: BaseHandler, BaseHandler: BaseHandler,
PDFHandler: PDFHandler, PDFHandler: PDFHandler,
OpenOfficeHandler: OpenOfficeHandler, OpenOfficeHandler: OpenOfficeHandler,
}
};
}); });

1
muk_web_preview/static/src/less/preview_content.less

@ -67,7 +67,6 @@
} }
} }
/* Based on a CodePen Snippet by Dave McCarthy */
.loader { .loader {
height: 20px; height: 20px;
width: 250px; width: 250px;

17
muk_web_preview/static/test/test.js → muk_web_preview/static/test/tour.js

@ -11,22 +11,22 @@ var name = 'preview';
var options = { var options = {
test: true, test: true,
url: '/web',
url: '/web?debug=',
wait_for: base.ready() wait_for: base.ready()
}
};
var setps = [ var setps = [
{ {
content: 'open menu_administration', content: 'open menu_administration',
trigger: 'a.oe_menu_toggler[data-menu-xmlid="base.menu_administration"]',
trigger: 'a[data-menu-xmlid="base.menu_administration"]',
run: 'click', run: 'click',
},{ },{
content: 'open next_id_9',
trigger: 'a.oe_menu_toggler[data-menu-xmlid="base.next_id_9"]',
content: 'open menu_custom',
trigger: 'a[data-menu-xmlid="base.menu_custom"]',
run: 'click', run: 'click',
},{ },{
content: 'open menu_action_attachment', content: 'open menu_action_attachment',
trigger: 'a.oe_menu_leaf[data-menu-xmlid="base.menu_action_attachment"]',
trigger: 'a[data-menu-xmlid="base.menu_action_attachment"]',
run: 'click', run: 'click',
},{ },{
content: 'search sample.pdf', content: 'search sample.pdf',
@ -38,6 +38,11 @@ var setps = [
trigger: 'ul.o_searchview_autocomplete li a', trigger: 'ul.o_searchview_autocomplete li a',
extra_trigger: 'div.o_main_content > div.o_control_panel li.active:contains("Attachment")', extra_trigger: 'div.o_main_content > div.o_control_panel li.active:contains("Attachment")',
run: 'click', run: 'click',
},{
content: 'switch to list view',
trigger: '.o_cp_switch_list',
extra_trigger: 'div.o_main_content > div.o_control_panel li.active:contains("Attachment")',
run: 'click',
},{ },{
content: 'open form view', content: 'open form view',
trigger: 'td.o_data_cell:contains("sample.pdf")', trigger: 'td.o_data_cell:contains("sample.pdf")',

2
muk_web_preview/template/assets.xml

@ -29,7 +29,7 @@
<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"/>
<script type="text/javascript" src="/muk_web_preview/static/test/test.js"/>
<script type="text/javascript" src="/muk_web_preview/static/test/tour.js"/>
</xpath> </xpath>
</template> </template>
</odoo> </odoo>

3
muk_web_preview/tests/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -20,4 +18,3 @@
################################################################################### ###################################################################################
from . import test_preview from . import test_preview

11
muk_web_preview/tests/test_preview.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -20,13 +18,13 @@
################################################################################### ###################################################################################
import os import os
import base64
import logging import logging
import unittest
from odoo import _
from odoo.tests import common from odoo.tests import common
_path = os.path.dirname(os.path.dirname(__file__))
_logger = logging.getLogger(__name__)
class PreviewTestCase(common.HttpCase): class PreviewTestCase(common.HttpCase):
at_install = False at_install = False
@ -38,9 +36,8 @@ class PreviewTestCase(common.HttpCase):
def tearDown(self): def tearDown(self):
super(PreviewTestCase, self).tearDown() super(PreviewTestCase, self).tearDown()
@unittest.skip("skip")
def test_preview(self): def test_preview(self):
self.phantom_js("/web",
self.phantom_js("/web?debug=",
"odoo.__DEBUG__.services['web_tour.tour'].run('preview')", "odoo.__DEBUG__.services['web_tour.tour'].run('preview')",
"odoo.__DEBUG__.services['web_tour.tour'].tours.preview.ready", "odoo.__DEBUG__.services['web_tour.tour'].tours.preview.ready",
login="admin") login="admin")

2
muk_web_utils/__manifest__.py

@ -20,7 +20,7 @@
{ {
"name": "MuK Web Utils", "name": "MuK Web Utils",
"summary": """Utility Features""", "summary": """Utility Features""",
"version": "11.0.2.0.0",
"version": "11.0.2.0.1",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

0
muk_web_preview/static/lib/PDFjs/LICENSE → muk_web_utils/static/lib/PDFjs/LICENSE

0
muk_web_preview/static/lib/PDFjs/build/pdf.js → muk_web_utils/static/lib/PDFjs/build/pdf.js

0
muk_web_preview/static/lib/PDFjs/build/pdf.worker.js → muk_web_utils/static/lib/PDFjs/build/pdf.worker.js

0
muk_web_preview/static/lib/PDFjs/web/cmaps/78-EUC-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/78-EUC-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/78-EUC-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/78-EUC-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/78-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/78-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/78-RKSJ-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/78-RKSJ-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/78-RKSJ-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/78-RKSJ-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/78-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/78-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/78ms-RKSJ-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/78ms-RKSJ-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/78ms-RKSJ-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/78ms-RKSJ-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/83pv-RKSJ-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/83pv-RKSJ-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/90ms-RKSJ-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/90ms-RKSJ-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/90ms-RKSJ-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/90ms-RKSJ-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/90msp-RKSJ-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/90msp-RKSJ-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/90msp-RKSJ-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/90msp-RKSJ-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/90pv-RKSJ-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/90pv-RKSJ-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/90pv-RKSJ-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/90pv-RKSJ-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Add-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Add-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Add-RKSJ-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Add-RKSJ-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Add-RKSJ-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Add-RKSJ-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Add-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Add-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-CNS1-0.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-0.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-CNS1-1.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-1.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-CNS1-2.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-2.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-CNS1-3.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-3.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-CNS1-4.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-4.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-CNS1-5.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-5.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-CNS1-6.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-6.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-CNS1-UCS2.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-CNS1-UCS2.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-GB1-0.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-0.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-GB1-1.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-1.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-GB1-2.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-2.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-GB1-3.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-3.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-GB1-4.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-4.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-GB1-5.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-5.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-GB1-UCS2.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-GB1-UCS2.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Japan1-0.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-0.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Japan1-1.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-1.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Japan1-2.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-2.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Japan1-3.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-3.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Japan1-4.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-4.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Japan1-5.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-5.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Japan1-6.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-6.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Japan1-UCS2.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Japan1-UCS2.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Korea1-0.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Korea1-0.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Korea1-1.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Korea1-1.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Korea1-2.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Korea1-2.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Adobe-Korea1-UCS2.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Adobe-Korea1-UCS2.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/B5-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/B5-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/B5-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/B5-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/B5pc-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/B5pc-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/B5pc-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/B5pc-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/CNS-EUC-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/CNS-EUC-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/CNS-EUC-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/CNS-EUC-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/CNS1-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/CNS1-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/CNS1-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/CNS1-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/CNS2-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/CNS2-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/CNS2-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/CNS2-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/ETHK-B5-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/ETHK-B5-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/ETHK-B5-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/ETHK-B5-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/ETen-B5-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/ETen-B5-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/ETen-B5-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/ETen-B5-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/ETenms-B5-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/ETenms-B5-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/ETenms-B5-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/ETenms-B5-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/EUC-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/EUC-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/EUC-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/EUC-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Ext-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Ext-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Ext-RKSJ-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Ext-RKSJ-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Ext-RKSJ-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Ext-RKSJ-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/Ext-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/Ext-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GB-EUC-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GB-EUC-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GB-EUC-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GB-EUC-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GB-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GB-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GB-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GB-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBK-EUC-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBK-EUC-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBK-EUC-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBK-EUC-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBK2K-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBK2K-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBK2K-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBK2K-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBKp-EUC-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBKp-EUC-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBKp-EUC-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBKp-EUC-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBT-EUC-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBT-EUC-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBT-EUC-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBT-EUC-V.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBT-H.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBT-H.bcmap

0
muk_web_preview/static/lib/PDFjs/web/cmaps/GBT-V.bcmap → muk_web_utils/static/lib/PDFjs/web/cmaps/GBT-V.bcmap

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save