diff --git a/muk_web_preview_msoffice/__init__.py b/muk_web_preview_msoffice/__init__.py index d8062b1..fd42c44 100644 --- a/muk_web_preview_msoffice/__init__.py +++ b/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 . # -################################################################################### - -# from . import controllers \ No newline at end of file +################################################################################### \ No newline at end of file diff --git a/muk_web_preview_msoffice/__manifest__.py b/muk_web_preview_msoffice/__manifest__.py index 3ef7453..636bb8f 100644 --- a/muk_web_preview_msoffice/__manifest__.py +++ b/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", diff --git a/muk_web_preview_msoffice/controllers/__init__.py b/muk_web_preview_msoffice/controllers/__init__.py deleted file mode 100644 index 4b71c01..0000000 --- a/muk_web_preview_msoffice/controllers/__init__.py +++ /dev/null @@ -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 . -# -################################################################################### - -from . import main \ No newline at end of file diff --git a/muk_web_preview_msoffice/controllers/main.py b/muk_web_preview_msoffice/controllers/main.py deleted file mode 100644 index 32ed554..0000000 --- a/muk_web_preview_msoffice/controllers/main.py +++ /dev/null @@ -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 . -# -################################################################################### - -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) \ No newline at end of file diff --git a/muk_web_preview_msoffice/static/description/icon.png b/muk_web_preview_msoffice/static/description/icon.png index 9b4231d..34ab7af 100644 Binary files a/muk_web_preview_msoffice/static/description/icon.png and b/muk_web_preview_msoffice/static/description/icon.png differ diff --git a/muk_web_preview_msoffice/static/description/icon.svg b/muk_web_preview_msoffice/static/description/icon.svg new file mode 100644 index 0000000..d18e7ee --- /dev/null +++ b/muk_web_preview_msoffice/static/description/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/muk_web_preview_msoffice/static/description/index.html b/muk_web_preview_msoffice/static/description/index.html index 5c3105c..318f310 100644 --- a/muk_web_preview_msoffice/static/description/index.html +++ b/muk_web_preview_msoffice/static/description/index.html @@ -26,30 +26,88 @@ -
-

Demo

-
-
-
User:
-
-
-
apps
-
-
-
Password:
-
-
\ No newline at end of file diff --git a/muk_web_preview_msoffice/static/description/preview.png b/muk_web_preview_msoffice/static/description/preview.png new file mode 100644 index 0000000..1deb1cc Binary files /dev/null and b/muk_web_preview_msoffice/static/description/preview.png differ diff --git a/muk_web_preview_msoffice/static/description/service_customization.png b/muk_web_preview_msoffice/static/description/service_customization.png new file mode 100644 index 0000000..3eac664 Binary files /dev/null and b/muk_web_preview_msoffice/static/description/service_customization.png differ diff --git a/muk_web_preview_msoffice/static/description/service_development.png b/muk_web_preview_msoffice/static/description/service_development.png new file mode 100644 index 0000000..580d460 Binary files /dev/null and b/muk_web_preview_msoffice/static/description/service_development.png differ diff --git a/muk_web_preview_msoffice/static/description/service_implementation.png b/muk_web_preview_msoffice/static/description/service_implementation.png new file mode 100644 index 0000000..d64b66b Binary files /dev/null and b/muk_web_preview_msoffice/static/description/service_implementation.png differ diff --git a/muk_web_preview_msoffice/static/description/service_integration.png b/muk_web_preview_msoffice/static/description/service_integration.png new file mode 100644 index 0000000..76c5e80 Binary files /dev/null and b/muk_web_preview_msoffice/static/description/service_integration.png differ diff --git a/muk_web_preview_msoffice/static/description/service_support.png b/muk_web_preview_msoffice/static/description/service_support.png new file mode 100644 index 0000000..4c530fa Binary files /dev/null and b/muk_web_preview_msoffice/static/description/service_support.png differ diff --git a/muk_web_preview_msoffice/static/src/js/msoffice.js b/muk_web_preview_msoffice/static/src/js/msoffice.js index 6ec3935..8124062 100644 --- a/muk_web_preview_msoffice/static/src/js/msoffice.js +++ b/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({ diff --git a/muk_web_preview_msoffice/static/src/scss/msoffice.scss b/muk_web_preview_msoffice/static/src/scss/msoffice.scss index 0b30fff..c789a0b 100644 --- a/muk_web_preview_msoffice/static/src/scss/msoffice.scss +++ b/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%; }