Browse Source

Documents 2.0

pull/64/head
Mathias Markl 6 years ago
parent
commit
b85cb8e950
  1. 2
      muk_web_preview/__manifest__.py
  2. 42
      muk_web_preview/static/src/js/preview_widgets.js
  3. 7
      muk_web_preview/static/src/less/preview_widgets.less
  4. 26
      muk_web_preview/static/src/xml/preview_widget.xml
  5. 4
      muk_web_utils/__init__.py
  6. 2
      muk_web_utils/__manifest__.py
  7. 20
      muk_web_utils/controllers/__init__.py
  8. 33
      muk_web_utils/controllers/backend.py
  9. 13
      muk_web_utils/static/lib/dropzone/LICENSE
  10. 388
      muk_web_utils/static/lib/dropzone/dropzone.css
  11. 3526
      muk_web_utils/static/lib/dropzone/dropzone.js
  12. 165
      muk_web_utils/static/lib/jquery-splitter/LICENSE
  13. 68
      muk_web_utils/static/lib/jquery-splitter/css/jquery.splitter.css
  14. 315
      muk_web_utils/static/lib/jquery-splitter/js/jquery.splitter.js
  15. 21
      muk_web_utils/static/lib/jsTree-grid/LICENSE
  16. 1360
      muk_web_utils/static/lib/jsTree-grid/jstreegrid.js
  17. 22
      muk_web_utils/static/lib/jsTree/LICENSE
  18. 8423
      muk_web_utils/static/lib/jsTree/jstree.js
  19. BIN
      muk_web_utils/static/lib/jsTree/themes/default/32px.png
  20. BIN
      muk_web_utils/static/lib/jsTree/themes/default/40px.png
  21. 1108
      muk_web_utils/static/lib/jsTree/themes/default/style.css
  22. BIN
      muk_web_utils/static/lib/jsTree/themes/default/throbber.gif
  23. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/30px.png
  24. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/32px.png
  25. 22
      muk_web_utils/static/lib/jsTree/themes/proton/LICENSE
  26. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.eot
  27. 2377
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.svg
  28. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.ttf
  29. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.woff
  30. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.eot
  31. 2410
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.svg
  32. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.ttf
  33. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.woff
  34. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.eot
  35. 2725
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.svg
  36. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.ttf
  37. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.woff
  38. 1125
      muk_web_utils/static/lib/jsTree/themes/proton/style.css
  39. BIN
      muk_web_utils/static/lib/jsTree/themes/proton/throbber.gif
  40. 9
      muk_web_utils/static/src/js/common.js
  41. 22
      muk_web_utils/static/src/js/files.js
  42. 40
      muk_web_utils/static/src/js/underscore.js
  43. 240
      muk_web_utils/static/src/js/widgets.js
  44. 39
      muk_web_utils/static/src/xml/widgets.xml
  45. 2
      muk_web_utils/template/assets.xml

2
muk_web_preview/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Preview",
"summary": """File Preview Dialog""",
"version": "11.0.2.1.0",
"version": "11.0.2.1.2",
"category": "Extra Tools",
"license": "AGPL-3",
"website": "http://www.mukit.at",

42
muk_web_preview/static/src/js/preview_widgets.js

@ -23,6 +23,9 @@ odoo.define('muk_preview.PreviewWidgets', function (require) {
var core = require('web.core');
var utils = require('web.utils');
var fields = require('web.basic_fields');
var registry = require('web.field_registry');
var AbstractField = require('web.AbstractField');
var PreviewHandler = require('muk_preview.PreviewHandler');
var PreviewGenerator = require('muk_preview.PreviewGenerator');
@ -63,4 +66,43 @@ fields.FieldBinaryFile.include({
},
});
var FieldPreviewBinary = fields.FieldBinaryFile.extend({
events: _.extend({}, AbstractField.prototype.events, {
'change .o_input_file': 'on_file_change',
'click .o_select_file_button': function () {
this.$('.o_input_file').click();
},
'click .o_clear_file_button': 'on_clear',
'click .o_input': function () {
this.$('.o_input_file').click();
},
}),
template: 'FieldPreviewBinary',
_renderReadonly: function () {
var self = this;
if(utils.is_bin_size(this.value)) {
var filename_fieldname = this.attrs.filename;
var filename = this.recordData[filename_fieldname] || null;
var download_url = '/web/content?' + $.param({
'model': self.model,
'id': self.res_id,
'field': self.name,
'filename_field': filename_fieldname,
'filename': filename,
'download': true,
});
PreviewGenerator.createPreview(this, download_url, false,
filename ? filename.split('.').pop() : false, filename).then(function($content) {
self.$el.html($content);
});
} else {
self.$el.html('<h2 class="text-center">No preview available!</h2>');
}
}
});
registry.add('preview_binary', FieldPreviewBinary);
return FieldPreviewBinary;
});

7
muk_web_preview/static/src/less/preview_widgets.less

@ -33,3 +33,10 @@
}
}
.o_form_preview {
height: 100%;
width: 100%;
min-height: 420px;
position: relative;
}

26
muk_web_preview/static/src/xml/preview_widget.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<templates>
<t t-name="FieldPreviewBinary" t-extend="FieldBinaryFile">
<t t-jquery="a.o_form_uri" t-operation="replace">
<div t-if="widget.mode === 'readonly'" class="o_form_preview" />
</t>
</t>
</templates>

4
muk_web_utils/__init__.py

@ -15,4 +15,6 @@
# 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_utils/__manifest__.py

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

20
muk_web_utils/controllers/__init__.py

@ -0,0 +1,20 @@
###################################################################################
#
# Copyright (C) 2018 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 backend

33
muk_web_utils/controllers/backend.py

@ -0,0 +1,33 @@
###################################################################################
#
# Copyright (C) 2018 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 logging
from odoo import _, http
from odoo.http import request
_logger = logging.getLogger(__name__)
class BackendController(http.Controller):
@http.route('/helper/fields/model', type='json', auth="user")
def get_model(self, id, **kw):
return {'model_name': request.env['ir.model'].sudo().browse(id).model}

13
muk_web_utils/static/lib/dropzone/LICENSE

@ -0,0 +1,13 @@
License
(The MIT License)
Copyright (c) 2012 Matias Meno <m@tias.me>
Logo & Website Design (c) 2015 "1910" www.weare1910.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
© 2018 GitHub, Inc.

388
muk_web_utils/static/lib/dropzone/dropzone.css

@ -0,0 +1,388 @@
/*
* The MIT License
* Copyright (c) 2012 Matias Meno <m@tias.me>
*/
@-webkit-keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); }
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px); } }
@-moz-keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); }
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px); } }
@keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); }
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px); } }
@-webkit-keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); } }
@-moz-keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); } }
@keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); } }
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); }
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1); }
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); } }
@-moz-keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); }
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1); }
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); } }
@keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); }
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1); }
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); } }
.dropzone, .dropzone * {
box-sizing: border-box; }
.dropzone {
min-height: 150px;
border: 2px solid rgba(0, 0, 0, 0.3);
background: white;
padding: 20px 20px; }
.dropzone.dz-clickable {
cursor: pointer; }
.dropzone.dz-clickable * {
cursor: default; }
.dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message * {
cursor: pointer; }
.dropzone.dz-started .dz-message {
display: none; }
.dropzone.dz-drag-hover {
border-style: solid; }
.dropzone.dz-drag-hover .dz-message {
opacity: 0.5; }
.dropzone .dz-message {
text-align: center;
margin: 2em 0; }
.dropzone .dz-preview {
position: relative;
display: inline-block;
vertical-align: top;
margin: 16px;
min-height: 100px; }
.dropzone .dz-preview:hover {
z-index: 1000; }
.dropzone .dz-preview:hover .dz-details {
opacity: 1; }
.dropzone .dz-preview.dz-file-preview .dz-image {
border-radius: 20px;
background: #999;
background: linear-gradient(to bottom, #eee, #ddd); }
.dropzone .dz-preview.dz-file-preview .dz-details {
opacity: 1; }
.dropzone .dz-preview.dz-image-preview {
background: white; }
.dropzone .dz-preview.dz-image-preview .dz-details {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-ms-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear; }
.dropzone .dz-preview .dz-remove {
font-size: 14px;
text-align: center;
display: block;
cursor: pointer;
border: none; }
.dropzone .dz-preview .dz-remove:hover {
text-decoration: underline; }
.dropzone .dz-preview:hover .dz-details {
opacity: 1; }
.dropzone .dz-preview .dz-details {
z-index: 20;
position: absolute;
top: 0;
left: 0;
opacity: 0;
font-size: 13px;
min-width: 100%;
max-width: 100%;
padding: 2em 1em;
text-align: center;
color: rgba(0, 0, 0, 0.9);
line-height: 150%; }
.dropzone .dz-preview .dz-details .dz-size {
margin-bottom: 1em;
font-size: 16px; }
.dropzone .dz-preview .dz-details .dz-filename {
white-space: nowrap; }
.dropzone .dz-preview .dz-details .dz-filename:hover span {
border: 1px solid rgba(200, 200, 200, 0.8);
background-color: rgba(255, 255, 255, 0.8); }
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) {
overflow: hidden;
text-overflow: ellipsis; }
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span {
border: 1px solid transparent; }
.dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span {
background-color: rgba(255, 255, 255, 0.4);
padding: 0 0.4em;
border-radius: 3px; }
.dropzone .dz-preview:hover .dz-image img {
-webkit-transform: scale(1.05, 1.05);
-moz-transform: scale(1.05, 1.05);
-ms-transform: scale(1.05, 1.05);
-o-transform: scale(1.05, 1.05);
transform: scale(1.05, 1.05);
-webkit-filter: blur(8px);
filter: blur(8px); }
.dropzone .dz-preview .dz-image {
border-radius: 20px;
overflow: hidden;
width: 120px;
height: 120px;
position: relative;
display: block;
z-index: 10; }
.dropzone .dz-preview .dz-image img {
display: block; }
.dropzone .dz-preview.dz-success .dz-success-mark {
-webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); }
.dropzone .dz-preview.dz-error .dz-error-mark {
opacity: 1;
-webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); }
.dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark {
pointer-events: none;
opacity: 0;
z-index: 500;
position: absolute;
display: block;
top: 50%;
left: 50%;
margin-left: -27px;
margin-top: -27px; }
.dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg {
display: block;
width: 54px;
height: 54px; }
.dropzone .dz-preview.dz-processing .dz-progress {
opacity: 1;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear; }
.dropzone .dz-preview.dz-complete .dz-progress {
opacity: 0;
-webkit-transition: opacity 0.4s ease-in;
-moz-transition: opacity 0.4s ease-in;
-ms-transition: opacity 0.4s ease-in;
-o-transition: opacity 0.4s ease-in;
transition: opacity 0.4s ease-in; }
.dropzone .dz-preview:not(.dz-processing) .dz-progress {
-webkit-animation: pulse 6s ease infinite;
-moz-animation: pulse 6s ease infinite;
-ms-animation: pulse 6s ease infinite;
-o-animation: pulse 6s ease infinite;
animation: pulse 6s ease infinite; }
.dropzone .dz-preview .dz-progress {
opacity: 1;
z-index: 1000;
pointer-events: none;
position: absolute;
height: 16px;
left: 50%;
top: 50%;
margin-top: -8px;
width: 80px;
margin-left: -40px;
background: rgba(255, 255, 255, 0.9);
-webkit-transform: scale(1);
border-radius: 8px;
overflow: hidden; }
.dropzone .dz-preview .dz-progress .dz-upload {
background: #333;
background: linear-gradient(to bottom, #666, #444);
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 0;
-webkit-transition: width 300ms ease-in-out;
-moz-transition: width 300ms ease-in-out;
-ms-transition: width 300ms ease-in-out;
-o-transition: width 300ms ease-in-out;
transition: width 300ms ease-in-out; }
.dropzone .dz-preview.dz-error .dz-error-message {
display: block; }
.dropzone .dz-preview.dz-error:hover .dz-error-message {
opacity: 1;
pointer-events: auto; }
.dropzone .dz-preview .dz-error-message {
pointer-events: none;
z-index: 1000;
position: absolute;
display: block;
display: none;
opacity: 0;
-webkit-transition: opacity 0.3s ease;
-moz-transition: opacity 0.3s ease;
-ms-transition: opacity 0.3s ease;
-o-transition: opacity 0.3s ease;
transition: opacity 0.3s ease;
border-radius: 8px;
font-size: 13px;
top: 130px;
left: -10px;
width: 140px;
background: #be2626;
background: linear-gradient(to bottom, #be2626, #a92222);
padding: 0.5em 1.2em;
color: white; }
.dropzone .dz-preview .dz-error-message:after {
content: '';
position: absolute;
top: -6px;
left: 64px;
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #be2626; }

3526
muk_web_utils/static/lib/dropzone/dropzone.js
File diff suppressed because it is too large
View File

165
muk_web_utils/static/lib/jquery-splitter/LICENSE

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

68
muk_web_utils/static/lib/jquery-splitter/css/jquery.splitter.css

@ -0,0 +1,68 @@
/*!
* StyleSheet for JQuery splitter Plugin
* Copyright (C) 2010 Jakub Jankiewicz <http://jcubic.pl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
.splitter_panel {
position: relative;
}
.splitter_panel .vsplitter {
background-color: grey;
cursor: col-resize;
z-index:900;
width: 7px;
}
.splitter_panel .hsplitter {
background-color: #5F5F5F;
cursor: row-resize;
z-index: 800;
height: 7px;
}
.splitter_panel .vsplitter.splitter-invisible,
.splitter_panel .hsplitter.splitter-invisible {
background: none;
}
.splitter_panel .vsplitter, .splitter_panel .left_panel, .splitter_panel .right_panel,
.splitter_panel .hsplitter, .splitter_panel .top_panel, .splitter_panel .bottom_panel {
position: absolute;
overflow: auto;
}
.splitter_panel .vsplitter, .splitter_panel .left_panel, .splitter_panel .right_panel {
height: 100%;
}
.splitter_panel .hsplitter, .splitter_panel .top_panel, .splitter_panel .bottom_panel {
width: 100%;
}
.splitter_panel .top_panel, .splitter_panel .left_panel, .splitter_panel .vsplitter {
top: 0;
}
.splitter_panel .top_panel, .splitter_panel .bottom_panel, .splitter_panel .left_panel, .splitter_panel .hsplitter {
left: 0;
}
.splitter_panel .bottom_panel {
bottom: 0;
}
.splitter_panel .right_panel {
right: 0;
}
.splitterMask {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 1000;
}

315
muk_web_utils/static/lib/jquery-splitter/js/jquery.splitter.js

@ -0,0 +1,315 @@
/*!
* JQuery Spliter Plugin version 0.24.0
* Copyright (C) 2010-2016 Jakub Jankiewicz <http://jcubic.pl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
(function($, undefined) {
var count = 0;
var splitter_id = null;
var splitters = [];
var current_splitter = null;
$.fn.split = function(options) {
var data = this.data('splitter');
if (data) {
return data;
}
var panel_1;
var panel_2;
var settings = $.extend({
limit: 100,
orientation: 'horizontal',
position: '50%',
invisible: false,
onDragStart: $.noop,
onDragEnd: $.noop,
onDrag: $.noop
}, options || {});
this.settings = settings;
var cls;
var children = this.children();
if (settings.orientation == 'vertical') {
panel_1 = children.first().addClass('left_panel');
panel_2 = panel_1.next().addClass('right_panel');
cls = 'vsplitter';
} else if (settings.orientation == 'horizontal') {
panel_1 = children.first().addClass('top_panel');
panel_2 = panel_1.next().addClass('bottom_panel');
cls = 'hsplitter';
}
if (settings.invisible) {
cls += ' splitter-invisible';
}
var width = this.width();
var height = this.height();
var id = count++;
this.addClass('splitter_panel');
var splitter = $('<div/>').addClass(cls).bind('mouseenter touchstart', function() {
splitter_id = id;
}).bind('mouseleave touchend', function() {
splitter_id = null;
}).insertAfter(panel_1);
var position;
function get_position(position) {
if (typeof position === 'number') {
return position;
} else if (typeof position === 'string') {
var match = position.match(/^([0-9\.]+)(px|%)$/);
if (match) {
if (match[2] == 'px') {
return +match[1];
} else {
if (settings.orientation == 'vertical') {
return (width * +match[1]) / 100;
} else if (settings.orientation == 'horizontal') {
return (height * +match[1]) / 100;
}
}
} else {
//throw position + ' is invalid value';
}
} else {
//throw 'position have invalid type';
}
}
var self = $.extend(this, {
refresh: function() {
var new_width = this.width();
var new_height = this.height();
if (width != new_width || height != new_height) {
width = this.width();
height = this.height();
self.position(position);
}
},
position: (function() {
if (settings.orientation == 'vertical') {
return function(n, silent) {
if (n === undefined) {
return position;
} else {
position = get_position(n);
var sw = splitter.width();
var sw2 = sw/2, pw;
if (settings.invisible) {
pw = panel_1.width(position).outerWidth();
panel_2.width(self.width()-pw);
splitter.css('left', pw-sw2);
} else {
pw = panel_1.width(position-sw2).outerWidth();
panel_2.width(self.width()-pw-sw);
splitter.css('left', pw);
}
panel_1.find('.splitter_panel').eq(0).height(self.height());
panel_2.find('.splitter_panel').eq(0).height(self.height());
}
if (!silent) {
self.trigger('splitter.resize');
self.find('.splitter_panel').trigger('splitter.resize');
}
return self;
};
} else if (settings.orientation == 'horizontal') {
return function(n, silent) {
if (n === undefined) {
return position;
} else {
position = get_position(n);
var sw = splitter.height();
var sw2 = sw/2, pw;
if (settings.invisible) {
pw = panel_1.height(position).outerHeight();
panel_2.height(self.height()-pw);
splitter.css('top', pw-sw2);
} else {
pw = panel_1.height(position-sw2).outerHeight();
panel_2.height(self.height()-pw-sw);
splitter.css('top', pw);
}
}
if (!silent) {
self.trigger('splitter.resize');
self.find('.splitter_panel').trigger('splitter.resize');
}
return self;
};
} else {
return $.noop;
}
})(),
orientation: settings.orientation,
limit: settings.limit,
isActive: function() {
return splitter_id === id;
},
destroy: function() {
self.removeClass('splitter_panel');
splitter.unbind('mouseenter');
splitter.unbind('mouseleave');
splitter.unbind('touchstart');
splitter.unbind('touchmove');
splitter.unbind('touchend');
splitter.unbind('touchleave');
splitter.unbind('touchcancel');
if (settings.orientation == 'vertical') {
panel_1.removeClass('left_panel');
panel_2.removeClass('right_panel');
} else if (settings.orientation == 'horizontal') {
panel_1.removeClass('top_panel');
panel_2.removeClass('bottom_panel');
}
self.unbind('splitter.resize');
self.trigger('splitter.resize');
self.find('.splitter_panel').trigger('splitter.resize');
splitters[id] = null;
count--;
splitter.remove();
self.removeData('splitter');
var not_null = false;
for (var i=splitters.length; i--;) {
if (splitters[i] !== null) {
not_null = true;
break;
}
}
//remove document events when no splitters
if (!not_null) {
$(document.documentElement).unbind('.splitter');
$(window).unbind('resize.splitter');
splitters = [];
count = 0;
}
}
});
self.bind('splitter.resize', function(e) {
var pos = self.position();
if (self.orientation == 'vertical' &&
pos > self.width()) {
pos = self.width() - self.limit-1;
} else if (self.orientation == 'horizontal' &&
pos > self.height()) {
pos = self.height() - self.limit-1;
}
if (pos < self.limit) {
pos = self.limit + 1;
}
e.stopPropagation();
self.position(pos, true);
});
//inital position of splitter
var pos;
if (settings.orientation == 'vertical') {
if (pos > width-settings.limit) {
pos = width-settings.limit;
} else {
pos = get_position(settings.position);
}
} else if (settings.orientation == 'horizontal') {
//position = height/2;
if (pos > height-settings.limit) {
pos = height-settings.limit;
} else {
pos = get_position(settings.position);
}
}
if (pos < settings.limit) {
pos = settings.limit;
}
self.position(pos, true);
var parent = this.closest('.splitter_panel');
if (parent.length) {
this.height(parent.height());
}
// bind events to document if no splitters
if (splitters.filter(Boolean).length === 0) {
$(window).bind('resize.splitter', function() {
$.each(splitters, function(i, splitter) {
if (splitter) {
splitter.refresh();
}
});
});
$(document.documentElement).on('mousedown.splitter touchstart.splitter', function(e) {
if (splitter_id !== null) {
e.preventDefault();
current_splitter = splitters[splitter_id];
setTimeout(function() {
$('<div class="splitterMask"></div>').
css('cursor', current_splitter.children().eq(1).css('cursor')).
insertAfter(current_splitter);
});
current_splitter.settings.onDragStart(e);
}
}).bind('mouseup.splitter touchend.splitter touchleave.splitter touchcancel.splitter', function(e) {
if (current_splitter) {
setTimeout(function() {
$('.splitterMask').remove();
});
current_splitter.settings.onDragEnd(e);
current_splitter = null;
}
}).bind('mousemove.splitter touchmove.splitter', function(e) {
if (current_splitter !== null) {
var limit = current_splitter.limit;
var offset = current_splitter.offset();
if (current_splitter.orientation == 'vertical') {
var pageX = e.pageX;
if(e.originalEvent && e.originalEvent.changedTouches){
pageX = e.originalEvent.changedTouches[0].pageX;
}
var x = pageX - offset.left;
if (x <= current_splitter.limit) {
x = current_splitter.limit + 1;
} else if (x >= current_splitter.width() - limit) {
x = current_splitter.width() - limit - 1;
}
if (x > current_splitter.limit &&
x < current_splitter.width()-limit) {
current_splitter.position(x, true);
current_splitter.trigger('splitter.resize');
current_splitter.find('.splitter_panel').
trigger('splitter.resize');
//e.preventDefault();
}
} else if (current_splitter.orientation == 'horizontal') {
var pageY = e.pageY;
if(e.originalEvent && e.originalEvent.changedTouches){
pageY = e.originalEvent.changedTouches[0].pageY;
}
var y = pageY-offset.top;
if (y <= current_splitter.limit) {
y = current_splitter.limit + 1;
} else if (y >= current_splitter.height() - limit) {
y = current_splitter.height() - limit - 1;
}
if (y > current_splitter.limit &&
y < current_splitter.height()-limit) {
current_splitter.position(y, true);
current_splitter.trigger('splitter.resize');
current_splitter.find('.splitter_panel').
trigger('splitter.resize');
//e.preventDefault();
}
}
current_splitter.settings.onDrag(e);
}
});//*/
}
splitters[id] = self;
self.data('splitter', self);
return self;
};
})(jQuery);

21
muk_web_utils/static/lib/jsTree-grid/LICENSE

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Avi Deitcher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1360
muk_web_utils/static/lib/jsTree-grid/jstreegrid.js
File diff suppressed because it is too large
View File

22
muk_web_utils/static/lib/jsTree/LICENSE

@ -0,0 +1,22 @@
Copyright (c) 2014 Ivan Bozhanov
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

8423
muk_web_utils/static/lib/jsTree/jstree.js
File diff suppressed because it is too large
View File

BIN
muk_web_utils/static/lib/jsTree/themes/default/32px.png

After

Width: 320  |  Height: 96  |  Size: 3.0 KiB

BIN
muk_web_utils/static/lib/jsTree/themes/default/40px.png

After

Width: 240  |  Height: 480  |  Size: 1.8 KiB

1108
muk_web_utils/static/lib/jsTree/themes/default/style.css
File diff suppressed because it is too large
View File

BIN
muk_web_utils/static/lib/jsTree/themes/default/throbber.gif

After

Width: 16  |  Height: 16  |  Size: 1.7 KiB

BIN
muk_web_utils/static/lib/jsTree/themes/proton/30px.png

After

Width: 360  |  Height: 720  |  Size: 6.3 KiB

BIN
muk_web_utils/static/lib/jsTree/themes/proton/32px.png

After

Width: 640  |  Height: 192  |  Size: 3.3 KiB

22
muk_web_utils/static/lib/jsTree/themes/proton/LICENSE

@ -0,0 +1,22 @@
Copyright (c) 2014 Orange Hill Development
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.eot

2377
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.svg
File diff suppressed because it is too large
View File

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.ttf

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.woff

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.eot

2410
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.svg
File diff suppressed because it is too large
View File

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.ttf

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.woff

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.eot

2725
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.svg
File diff suppressed because it is too large
View File

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.ttf

BIN
muk_web_utils/static/lib/jsTree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.woff

1125
muk_web_utils/static/lib/jsTree/themes/proton/style.css
File diff suppressed because it is too large
View File

BIN
muk_web_utils/static/lib/jsTree/themes/proton/throbber.gif

After

Width: 16  |  Height: 16  |  Size: 1.7 KiB

9
muk_web_utils/static/src/js/common.js

@ -27,14 +27,6 @@ var utils = require('web.utils');
var QWeb = core.qweb;
var _t = core._t;
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
function format_number(value) {
if (value === false || typeof value !== "number") {
return "";
@ -81,7 +73,6 @@ function unique_id(prefix) {
}
return {
delay: delay,
format_number: format_number,
format_size: format_size,
unique_string: unique_string,

22
muk_web_utils/static/src/js/files.js

@ -52,7 +52,9 @@ var traverse_items = function(items, structure) {
files.push({
name: item.name,
fullPath: item.fullPath,
files: result
files: result,
isDirectory: true,
isFile: false,
});
} else {
files = _.union(files, result);
@ -62,7 +64,10 @@ var traverse_items = function(items, structure) {
});
}
} else if (file) {
files.push(file);
if(file.size) {
file.isFileItem = !!file.size;
files.push(file);
}
$get.resolve();
} else {
console.warn("Your browser doesn't support Drag and Drop!");
@ -78,6 +83,18 @@ var traverse_items = function(items, structure) {
return $result;
};
var count_files_in_structure = function(structure) {
var counter = 0;
_.each(structure, function(item, index, structure) {
if(item.isFile || item.isFileItem) {
counter++;
} else if(item.isDirectory) {
counter += count_files_in_structure(item.files);
}
});
return counter;
}
var get_file_list = function(items) {
return traverse_items(items, false);
};
@ -104,6 +121,7 @@ var read_file = function(file, callback) {
return {
traverse_items: traverse_items,
count_files_in_structure: count_files_in_structure,
get_file_list: get_file_list,
get_file_structure: get_file_structure,
load_file: load_file,

40
muk_web_utils/static/src/js/underscore.js

@ -0,0 +1,40 @@
/**********************************************************************************
*
* Copyright (C) 2018 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/>.
*
**********************************************************************************/
_.mixin({
memoizeDebounce: function(func, wait=0, options={}) {
var mem = _.memoize(function() {
return _.debounce(func, wait, options)
}, options.resolver);
return function() {
mem.apply(this, arguments).apply(this, arguments)
}
}
});
_.mixin({
memoizeThrottle: function(func, wait=0, options={}) {
var mem = _.memoize(function() {
return _.throttle(func, wait, options)
}, options.resolver);
return function() {
mem.apply(this, arguments).apply(this, arguments)
}
}
});

240
muk_web_utils/static/src/js/widgets.js

@ -0,0 +1,240 @@
/**********************************************************************************
*
* Copyright (C) 2018 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.define('muk_web_utils.widgets', function (require) {
"use strict";
var ajax = require('web.ajax');
var core = require('web.core');
var utils = require('web.utils');
var dialogs = require('web.view_dialogs');
var concurrency = require('web.concurrency');
var registry = require('web.field_registry');
var fields = require('web.basic_fields');
var AbstractField = require('web.AbstractField');
var QWeb = core.qweb;
var _t = core._t;
var IDSelectorField = fields.InputField.extend({
AUTOCOMPLETE_DELAY: 200,
supportedFieldTypes: ['integer'],
template: 'FieldIDSelector',
resetOnAnyFieldChange: true,
events: _.extend({}, fields.InputField.prototype.events, {
'click input': '_onInputClick',
}),
init: function () {
this._super.apply(this, arguments);
this.limit = 7;
this.isDirty = false;
this.lastChangeEvent = undefined;
this.relation_field = this.attrs.model;
this.orderer = new concurrency.DropMisordered();
this.recordParams = {fieldName: this.name, viewType: this.viewType};
if (this.field.type !== 'integer' || !this.relation_field) {
var msg = _t("The type of the field '%s' must be a integer field with a model attribute.");
throw _.str.sprintf(msg, this.field.string);
}
},
start: function () {
this.$input = this.$('input');
return this._super.apply(this, arguments);
},
getFocusableElement: function () {
return this.mode === 'edit' && this.$input || this.$el;
},
_bindAutoComplete: function () {
var self = this;
this.$input.autocomplete({
source: function (req, resp) {
self._search(req.term).then(function (result) {
resp(result);
});
},
select: function (event, ui) {
event.stopImmediatePropagation();
event.preventDefault();
if (ui.item.id) {
self.isDirty = true;
self.$input.val(ui.item.id);
self._doDebouncedAction();
} else if (ui.item.action) {
ui.item.action();
}
return false;
},
focus: function (event) {
event.preventDefault();
},
close: function (event) {
if (event.which === $.ui.keyCode.ESCAPE) {
event.stopPropagation();
}
},
autoFocus: true,
html: true,
minLength: 0,
delay: this.AUTOCOMPLETE_DELAY,
});
this.$input.autocomplete("option", "position", { my : "left top", at: "left bottom" });
this.autocomplete_bound = true;
},
_renderEdit: function () {
this.$input.val(this._formatValue(this.value));
if (!this.autocomplete_bound) {
this._bindAutoComplete();
}
},
_renderReadonly: function () {
this.$el.html(this._formatValue(this.value));
if (!this.nodeOptions.no_open) {
this.$el.attr('href', '#');
this.$el.addClass('o_form_uri');
}
},
_search: function (search_val) {
var self = this;
var def = $.Deferred();
this.orderer.add(def);
if(this.recordData[this.relation_field]) {
this._rpc({
route: '/helper/fields/model',
params: {
id: this.recordData[this.relation_field].data.id,
},
}).then(function(helper) {
var context = self.record.getContext(this.recordParams);
var domain = self.record.getDomain(this.recordParams);
self._rpc({
model: helper.model_name,
method: "name_search",
kwargs: {
name: search_val,
args: domain,
operator: "ilike",
limit: this.limit + 1,
context: context,
}}).then(function (result) {
var values = _.map(result, function (x) {
return {
label: _.str.escapeHTML(x[1].split('\n')[0].trim()) || data.noDisplayContent,
value: x[1],
id: x[0],
};
});
if (values.length > self.limit) {
values = values.slice(0, self.limit);
values.push({
label: _t("Search More..."),
action: function () {
self._rpc({
model: helper.model_name,
method: 'name_search',
kwargs: {
name: search_val,
args: domain,
operator: "ilike",
limit: 160,
context: context,
},
})
.then(self._searchCreatePopup.bind(self, "search", helper.model_name));
},
classname: 'o_m2o_dropdown_option',
});
}
def.resolve(values);
});
});
} else {
this.do_warn(_t("A model have to be set before searching!"));
def.resolve([]);
}
return def;
},
_searchCreatePopup: function (view, model_name, ids, context) {
var self = this;
return new dialogs.SelectCreateDialog(this, _.extend({}, this.nodeOptions, {
res_model: model_name,
domain: this.record.getDomain(this.recordParams),
context: _.extend({}, this.record.getContext(this.recordParams), context || {}),
title: _t("Search: ") + this.recordData[this.relation_field].data.display_name,
initial_ids: ids ? _.map(ids, function (x) { return x[0]; }) : undefined,
initial_view: view,
disable_multiple_selection: true,
on_selected: function (records) {
self.isDirty = true;
self.$input.val(records[0].id);
self._doDebouncedAction();
self.activate();
}
})).open();
},
_onClick: function (event) {
var self = this;
if (this.mode === 'readonly' && !this.nodeOptions.no_open) {
event.preventDefault();
event.stopPropagation();
this._rpc({
route: '/helper/fields/model',
params: {
id: this.recordData[this.relation_field].data.id,
},
}).then(function(helper) {
self._rpc({
model: helper.model_name,
method: 'get_formview_action',
args: [[self.value]],
context: self.record.getContext(self.recordParams),
})
.then(function (action) {
self.trigger_up('do_action', {action: action});
});
});
}
},
_onInput: function (event) {
if(parseInt(this.$input.val())) {
event.stopPropagation();
event.preventDefault();
this._doDebouncedAction();
}
},
_onInputClick: function () {
if (this.$input.autocomplete("widget").is(":visible")) {
this.$input.autocomplete("close");
} else if (parseInt(this.$input.val()) === 0) {
this.$input.autocomplete("search", '');
} else {
this.$input.autocomplete("search");
}
},
});
registry.add('selector_id', IDSelectorField);
return {
IDSelectorField: IDSelectorField
};
});

39
muk_web_utils/static/src/xml/widgets.xml

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2018 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/>.
-->
<templates xml:space="preserve">
<t t-name="FieldIDSelector">
<t t-if="widget.mode === 'readonly'">
<a t-if="!widget.nodeOptions.no_open" class="o_form_uri" href="#"/>
<span t-if="widget.nodeOptions.no_open"/>
</t>
<div t-if="widget.mode === 'edit'" class="o_field_widget o_field_selector">
<div class="o_input_dropdown">
<input type="text" class="o_input"
t-att-tabindex="widget.attrs.tabindex"
t-att-autofocus="widget.attrs.autofocus"
t-att-placeholder="widget.attrs.placeholder"
t-att-id="widget.idForLabel"/>
<span class="o_dropdown_button" draggable="false"/>
</div>
</div>
</t>
</templates>

2
muk_web_utils/template/assets.xml

@ -26,6 +26,7 @@
<script type="text/javascript" src="/muk_web_utils/static/lib/spectrum/js/spectrum.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/common.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/jquery.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/underscore.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/files.js"/>
</xpath>
</template>
@ -48,6 +49,7 @@
<script type="text/javascript" src="/muk_web_utils/static/lib/bootstrap-notify/bootstrap-notify.js"/>
<script type="text/javascript" src="/muk_web_utils/static/lib/bootbox/bootbox.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/mimetype.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/widgets.js"/>
</xpath>
</template>

Loading…
Cancel
Save