Browse Source

publish muk_web_preview_msoffice - 12.0

pull/115/head
MuK IT GmbH 5 years ago
parent
commit
e00b399400
  1. 4
      muk_web_preview_msoffice/__init__.py
  2. 2
      muk_web_preview_msoffice/__manifest__.py
  3. 20
      muk_web_preview_msoffice/controllers/__init__.py
  4. 63
      muk_web_preview_msoffice/controllers/main.py
  5. BIN
      muk_web_preview_msoffice/static/description/icon.png
  6. 1
      muk_web_preview_msoffice/static/description/icon.svg
  7. 119
      muk_web_preview_msoffice/static/description/index.html
  8. BIN
      muk_web_preview_msoffice/static/description/preview.png
  9. BIN
      muk_web_preview_msoffice/static/description/service_customization.png
  10. BIN
      muk_web_preview_msoffice/static/description/service_development.png
  11. BIN
      muk_web_preview_msoffice/static/description/service_implementation.png
  12. BIN
      muk_web_preview_msoffice/static/description/service_integration.png
  13. BIN
      muk_web_preview_msoffice/static/description/service_support.png
  14. 16
      muk_web_preview_msoffice/static/src/js/msoffice.js
  15. 13
      muk_web_preview_msoffice/static/src/scss/msoffice.scss

4
muk_web_preview_msoffice/__init__.py

@ -15,6 +15,4 @@
# 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/>.
#
###################################################################################
# from . import controllers
###################################################################################

2
muk_web_preview_msoffice/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Preview MS Office",
"summary": """MS Office Preview""",
"version": "12.0.2.0.2",
"version": "12.0.2.0.3",
"category": "Extra Tools",
"license": "AGPL-3",
"website": "http://www.mukit.at",

20
muk_web_preview_msoffice/controllers/__init__.py

@ -1,20 +0,0 @@
###################################################################################
#
# 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/>.
#
###################################################################################
from . import main

63
muk_web_preview_msoffice/controllers/main.py

@ -1,63 +0,0 @@
###################################################################################
#
# 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/>.
#
###################################################################################
import uuid
import logging
import mimetypes
import werkzeug
from odoo import _, http
from odoo.http import request
from odoo.addons.muk_utils.tools.http import get_response
from odoo.addons.muk_utils.tools.http import make_error_response
_logger = logging.getLogger(__name__)
MIMETPYES = [
'application/msword', 'application/ms-word', 'application/vnd.ms-word.document.macroEnabled.12',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.mspowerpoint',
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/vnd.ms-powerpoint.presentation.macroEnabled.12'
]
class MSOfficeParserController(http.Controller):
@http.route('/web/preview/msoffice', auth="user", type='http')
def preview_msoffice(self, url, **kw):
status, headers, content = get_response(url)
if status != 200:
return make_error_response(status, content or _("Unknown Error"))
elif headers['content-type'] not in MIMETPYES:
return werkzeug.exceptions.UnsupportedMediaType()
else:
try:
filename = "%s%s" % (uuid.uuid4(), mimetypes.guess_extension(headers['content-type']))
output = request.env['muk_converter.converter'].convert(filename, content)
return self._make_pdf_response(output, "%s.pdf" % filename)
except Exception:
_logger.exception("Error while convert the file.")
return werkzeug.exceptions.InternalServerError()
def _make_pdf_response(self, file, filename):
headers = [('Content-Type', 'application/pdf'),
('Content-Disposition', 'attachment; filename="{}";'.format(filename)),
('Content-Length', len(file))]
return request.make_response(file, headers)

BIN
muk_web_preview_msoffice/static/description/icon.png

Before

Width: 250  |  Height: 250  |  Size: 9.8 KiB

After

Width: 250  |  Height: 250  |  Size: 12 KiB

1
muk_web_preview_msoffice/static/description/icon.svg
File diff suppressed because it is too large
View File

119
muk_web_preview_msoffice/static/description/index.html

@ -26,30 +26,88 @@
</div>
</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>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Our Services</h3>
<div
style="display: flex; padding-top: 20px; justify-content: space-between;">
<div style="flex-basis: 18%;">
<a href="https://mukit.at/r/MQ5" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_implementation.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Implementation
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href="https://mukit.at/r/u7c" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_integration.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Integration
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href="https://mukit.at/r/xDJ" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_customization.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Customization
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href=" https://mukit.at/r/J3A" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_development.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Development
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href=" https://mukit.at/r/R1v" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_support.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Support
</h3>
</a>
</div>
</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>
</section>
<section class="oe_container" style="padding: 32px 0;">
<div class="oe_row oe_spaced" style="margin: auto;">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://mukit.at/r/SgN" target="_blank"> <img
src="preview.png">
</a>
</div>
</div>
</section>
@ -59,15 +117,16 @@
contact us, if you need any help with your Odoo integration or
addiontal features.</h5>
<div class="oe_slogan">
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Email
<a class="btn btn-primary btn-lg mt8" href="https://mukit.at"
target="_blank"> <i class="fa fa-globe"></i> Website
</a> <a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Contact Us
</a> <a class="btn btn-primary btn-lg mt8"
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i>
Contact
</a> <a class="btn btn-primary btn-lg mt8" href="mailto:support@mukit.at">
<i class="fa fa-life-ring"></i> Support
href="https://github.com/muk-it" target="_blank"> <i
class="fa fa-github"></i> Issues
</a>
</div>
<img src="logo.png" style="width: 200px; margin-bottom: 20px;"
class="center-block">
<img src="logo.png"
style="width: 200px; margin-bottom: 20px; display: block;"
class="mx-auto center-block">
</section>

BIN
muk_web_preview_msoffice/static/description/preview.png

After

Width: 1000  |  Height: 200  |  Size: 32 KiB

BIN
muk_web_preview_msoffice/static/description/service_customization.png

After

Width: 250  |  Height: 250  |  Size: 27 KiB

BIN
muk_web_preview_msoffice/static/description/service_development.png

After

Width: 250  |  Height: 250  |  Size: 28 KiB

BIN
muk_web_preview_msoffice/static/description/service_implementation.png

After

Width: 250  |  Height: 250  |  Size: 26 KiB

BIN
muk_web_preview_msoffice/static/description/service_integration.png

After

Width: 250  |  Height: 250  |  Size: 24 KiB

BIN
muk_web_preview_msoffice/static/description/service_support.png

After

Width: 250  |  Height: 250  |  Size: 24 KiB

16
muk_web_preview_msoffice/static/src/js/msoffice.js

@ -47,7 +47,20 @@ var PreviewContentMSOffice = AbstractPreviewContent.extend({
renderPreviewContent: function() {
var viewer = 'https://view.officeapps.live.com/op/embed.aspx?src=';
this.$('iframe').attr('src', viewer + encodeURIComponent(this.attachment.url));
return this._super.apply(this, arguments);
return this._super.apply(this, arguments);
},
destroy: function () {
if (this.attachment) {
this._rpc({
model: 'ir.attachment',
method: 'unlink',
args: [this.attachment.id],
context: session.user_context,
}, {
shadow: true,
});
}
return this._super.apply(this, arguments);
},
_downloadFile: function() {
return $.ajax({
@ -59,6 +72,7 @@ var PreviewContentMSOffice = AbstractPreviewContent.extend({
},
_createAttachment: function(file) {
var form = new FormData();
form.append('temporary', true);
form.append('ufile', file, this.filename);
form.append('csrf_token', core.csrf_token);
return $.ajax({

13
muk_web_preview_msoffice/static/src/scss/msoffice.scss

@ -18,12 +18,13 @@
**********************************************************************************/
.mk_preview_msoffice {
overflow: auto;
width: 100%;
overflow: hidden;
height: 100%;
iframe {
width: 100%;
height: 100%;
}
width: 100%;
}
.mk_preview_msoffice iframe {
height: 100%;
width: 100%;
}
Loading…
Cancel
Save