You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.3 KiB

  1. /**********************************************************************************
  2. *
  3. * Copyright (C) 2017 MuK IT GmbH
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Affero General Public License as
  7. * published by the Free Software Foundation, either version 3 of the
  8. * License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Affero General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. **********************************************************************************/
  19. odoo.define('muk_preview_markdown.PreviewContentOpenDocument', function (require) {
  20. "use strict";
  21. var core = require('web.core');
  22. var ajax = require('web.ajax');
  23. var utils = require('web.utils');
  24. var session = require('web.session');
  25. var registry = require('muk_preview.registry');
  26. var AbstractPreviewContent = require('muk_preview.AbstractPreviewContent');
  27. var QWeb = core.qweb;
  28. var _t = core._t;
  29. var PreviewContentOpenDocument = AbstractPreviewContent.extend({
  30. template: "muk_preview.PreviewContentOpenDocument",
  31. init: function(parent, url, mimetype, filename) {
  32. this._super.apply(this, arguments);
  33. this.viewer_url = '/muk_web_preview_opendocument/static/lib/' +
  34. 'viewerjs/index.html#' + this.url; //encodeURIComponent(this.url);
  35. console.log(this.viewer_url)
  36. },
  37. downloadable: false,
  38. printable: false,
  39. });
  40. _.each([
  41. '.odt', '.odp', '.ods', '.fodt', '.ott',
  42. '.fodp', '.otp', '.fods', '.ots'
  43. ], function(extension) {
  44. registry.add(extension, PreviewContentOpenDocument);
  45. });
  46. _.each([
  47. 'odt', 'odp', 'ods', 'fodt', 'ott',
  48. 'fodp', 'otp', 'fods', 'ots'
  49. ], function(extension) {
  50. registry.add(extension, PreviewContentOpenDocument);
  51. });
  52. _.each([
  53. 'application/vnd.oasis.opendocument.text',
  54. 'application/vnd.oasis.opendocument.presentation',
  55. 'application/vnd.oasis.opendocument.spreadsheet'
  56. ], function(mimetype) {
  57. registry.add(mimetype, PreviewContentOpenDocument);
  58. });
  59. return PreviewContentOpenDocument;
  60. });