Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
139
Merge Requests
139
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
e98efa7e
Commit
e98efa7e
authored
Aug 21, 2020
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: Web share target API applying to smart assistant
parent
52e51c21
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
898 additions
and
38 deletions
+898
-38
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.js
...age_module/gadget_officejs_bootloader_serviceworker_js.js
+41
-4
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.xml
...ge_module/gadget_officejs_bootloader_serviceworker_js.xml
+3
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_home_html.html
.../gadget_officejs_erp5_page_smart_assistant_home_html.html
+1
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_home_html.xml
...e/gadget_officejs_erp5_page_smart_assistant_home_html.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_home_js.js
...dule/gadget_officejs_erp5_page_smart_assistant_home_js.js
+21
-13
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_home_js.xml
...ule/gadget_officejs_erp5_page_smart_assistant_home_js.xml
+3
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_upload_shared_file_html.html
...js_erp5_page_smart_assistant_upload_shared_file_html.html
+23
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_upload_shared_file_html.xml
...ejs_erp5_page_smart_assistant_upload_shared_file_html.xml
+370
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_upload_shared_file_js.js
...ficejs_erp5_page_smart_assistant_upload_shared_file_js.js
+70
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_upload_shared_file_js.xml
...icejs_erp5_page_smart_assistant_upload_shared_file_js.xml
+329
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_json_manifest_smart_assistant_json.json
...e/gadget_officejs_json_manifest_smart_assistant_json.json
+26
-10
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_json_manifest_smart_assistant_json.xml
...le/gadget_officejs_json_manifest_smart_assistant_json.xml
+2
-2
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_smart_assistant/WebSection_getSmartAssistantPrecacheManifestList.py
...stant/WebSection_getSmartAssistantPrecacheManifestList.py
+7
-1
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.js
View file @
e98efa7e
/*jslint indent: 2*/
/*global self, fetch, Request, Response */
/*global self, fetch, Request, Response
, URL, Blob
*/
var
global
=
self
,
window
=
self
;
(
function
(
self
,
fetch
,
Re
quest
,
Response
)
{
(
function
(
self
,
fetch
,
Re
sponse
,
Blob
)
{
"
use strict
"
;
self
.
DOMParser
=
{};
...
...
@@ -52,7 +52,8 @@ var global = self, window = self;
self
.
addEventListener
(
"
fetch
"
,
function
(
event
)
{
var
relative_url
=
'
./
'
+
event
.
request
.
url
.
split
(
"
#
"
)[
0
]
.
replace
(
self
.
registration
.
scope
,
""
)
.
replace
(
self
.
version_url
,
""
);
.
replace
(
self
.
version_url
,
""
),
tmp
;
if
(
relative_url
===
'
./no-cache
'
)
{
event
.
respondWith
(
new
Response
(
self
.
cache_list
));
return
;
...
...
@@ -80,6 +81,42 @@ var global = self, window = self;
return
new
Response
(
error
,
{
"
statusText
"
:
error
.
message
,
"
status
"
:
500
});
})
);
}
else
if
(
// postData from manifest.json
event
.
request
.
method
===
'
POST
'
&&
relative_url
.
split
(
'
?
'
)[
0
].
endsWith
(
'
postData
'
)
)
{
self
.
request
=
event
.
request
;
event
.
respondWith
(
Response
.
redirect
(
'
.
'
));
}
else
if
(
// Determine if it hasSharedData
event
.
request
.
url
.
endsWith
(
'
hasSharedData
'
)
)
{
event
.
respondWith
(
new
Response
(
self
.
request
?
"
true
"
:
"
false
"
));
}
else
if
(
// getSharedData from upload_shared_file page
// upload_shared_file page processes the data
event
.
request
.
url
.
endsWith
(
'
getSharedData
'
)
&&
event
.
request
.
method
===
'
GET
'
)
{
if
(
!
self
.
request
)
{
event
.
respondWith
(
new
Response
(
''
));
}
else
{
tmp
=
self
.
request
;
delete
self
.
request
;
event
.
respondWith
(
new
self
.
RSVP
.
Queue
()
.
push
(
function
()
{
return
tmp
.
formData
();
})
.
push
(
function
(
data
)
{
return
data
.
get
(
'
file
'
);
})
.
push
(
function
(
file
)
{
return
new
Response
(
new
Blob
([
file
],
{
type
:
file
.
type
}));
})
);
}
}
else
{
event
.
respondWith
(
new
self
.
RSVP
.
Queue
()
...
...
@@ -101,4 +138,4 @@ var global = self, window = self;
}
});
}(
self
,
fetch
,
Request
,
Response
));
\ No newline at end of file
}(
self
,
fetch
,
Response
,
Blob
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.xml
View file @
e98efa7e
...
...
@@ -223,7 +223,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
P0
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -237,7 +237,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
69.27647.29835.22169
</string>
</value>
<value>
<string>
9
86.49641.0.58982
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -255,7 +255,7 @@
</tuple>
<state>
<tuple>
<float>
1
533640296
.2
</float>
<float>
1
600683471
.2
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_home_html.html
View file @
e98efa7e
...
...
@@ -5,6 +5,7 @@
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"gadget_officejs_smart_assistant.css"
>
<link
rel=
"manifest"
href=
"gadget_officejs_json_manifest_smart_assistant.json"
>
<title>
OfficeJS Smart Assistant Home
</title>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_home_html.xml
View file @
e98efa7e
...
...
@@ -278,7 +278,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
79.64140.28065.34372
</string>
</value>
<value>
<string>
9
81.3464.44902.45755
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -296,7 +296,7 @@
</tuple>
<state>
<tuple>
<float>
157
4460415.05
</float>
<float>
157
8607727.59
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_home_js.js
View file @
e98efa7e
/*global window, rJS, jIO, Handlebars, RSVP, Blob, SimpleQuery, ComplexQuery, Query*/
/*global window, rJS, jIO,
navigator,
Handlebars, RSVP, Blob, SimpleQuery, ComplexQuery, Query*/
/*jslint indent:2, maxlen: 80, nomen: true */
(
function
(
window
,
rJS
,
jIO
,
RSVP
,
SimpleQuery
,
ComplexQuery
,
Query
)
{
(
function
(
window
,
rJS
,
jIO
,
navigator
,
RSVP
,
SimpleQuery
,
ComplexQuery
,
Query
)
{
"
use strict
"
;
rJS
(
window
)
...
...
@@ -46,10 +47,6 @@
type
:
"
DateTimeField
"
}
};
result
.
data
.
rows
[
i
].
value
[
"
listbox_uid:list
"
]
=
{
key
:
"
listbox_uid:list
"
,
value
:
2713
};
}
}
return
result
;
...
...
@@ -67,7 +64,7 @@
portal_type
=
gadget
.
props
.
portal_type
,
parent_relative_url
=
gadget
.
props
.
parent_relative_url
;
return
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
scope
);
})
...
...
@@ -126,7 +123,7 @@
// declared methods
/////////////////////////////////////////////////////////////////
.
ready
(
function
(
g
)
{
return
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
g
.
getSetting
(
'
portal_type
'
),
...
...
@@ -140,10 +137,8 @@
};
});
})
.
declareMethod
(
"
render
"
,
function
()
{
var
gadget
=
this
;
this
.
getDeclaredGadget
(
'
form_list
'
);
return
gadget
.
getSetting
(
'
jio_storage_name
'
)
.
push
(
function
(
result
)
{
...
...
@@ -151,8 +146,22 @@
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
page
:
'
ojs_configurator
'
}});
}
if
(
'
serviceWorker
'
in
navigator
)
{
if
(
navigator
.
serviceWorker
.
controller
)
{
return
jIO
.
util
.
ajax
({
url
:
'
hasSharedData
'
});
}
}
})
.
push
(
function
()
{
.
push
(
function
(
result
)
{
if
(
result
)
{
if
(
result
.
target
.
response
===
'
true
'
)
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
page
:
'
ojs_smart_assistant_upload_shared_file
'
}});
}
}
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_view_upload_audio
'
),
gadget
.
getDeclaredGadget
(
'
form_view_image_text
'
),
...
...
@@ -328,7 +337,6 @@
page_icon
:
"
exchange
"
});
});
});
}(
window
,
rJS
,
jIO
,
RSVP
,
SimpleQuery
,
ComplexQuery
,
Query
));
\ No newline at end of file
}(
window
,
rJS
,
jIO
,
navigator
,
RSVP
,
SimpleQuery
,
ComplexQuery
,
Query
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_home_js.xml
View file @
e98efa7e
...
...
@@ -184,7 +184,7 @@
</tuple>
<state>
<tuple>
<float>
15
62159205.06
</float>
<float>
15
97277315.11
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
@@ -233,7 +233,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
98
0.55662.21812.79
87
</string>
</value>
<value>
<string>
98
6.52650.40049.328
87
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -251,7 +251,7 @@
</tuple>
<state>
<tuple>
<float>
1
577797510.26
</float>
<float>
1
600864455.71
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_upload_shared_file_html.html
0 → 100644
View file @
e98efa7e
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"gadget_officejs_smart_assistant.css"
>
<link
rel=
"manifest"
href=
"gadget_officejs_json_manifest_smart_assistant.json"
>
<title>
OfficeJS Smart Assistant Upload Shared File
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"jiodev.js"
></script>
<script
src=
"gadget_erp5_page_ojs_smart_assistant_upload_shared_file.js"
></script>
</head>
<body>
<h1>
Your file is uploading to Smart Assistant...
</h1>
</body>
</html>
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_upload_shared_file_html.xml
0 → 100644
View file @
e98efa7e
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_upload_shared_file_js.js
0 → 100644
View file @
e98efa7e
/*global window, rJS, jIO, Handlebars, RSVP, Blob*/
/*jslint indent:2, maxlen: 80, nomen: true */
(
function
(
window
,
rJS
,
jIO
,
RSVP
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
"
notifySubmitted
"
)
.
declareService
(
function
handleWebShareFile
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
({
type
:
'
GET
'
,
url
:
'
getSharedData
'
,
dataType
:
"
blob
"
});
})
.
push
(
function
(
resx
)
{
// Condition: when there's uploaded data
if
(
resx
.
target
.
response
.
size
)
{
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
jio_post
({
"
title
"
:
Date
(),
//get date as title
portal_type
:
"
Smart Assistant File
"
,
parent_relative_url
:
"
smart_assistant_file_module
"
,
validation_state
:
'
draft
'
});
})
.
push
(
function
(
id
)
{
return
gadget
.
jio_putAttachment
(
id
,
'
data
'
,
resx
.
target
.
response
);
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
"
message
"
:
"
Data created
"
,
"
status
"
:
"
success
"
});
})
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_smart_assistant_document_list
"
}
});
});
}
// Condition: if there's no data
return
gadget
.
notifySubmitted
({
"
message
"
:
"
No data found
"
,
"
status
"
:
"
failed
"
})
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_smart_assistant_home
"
}
});
});
});
});
}(
window
,
rJS
,
jIO
,
RSVP
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_smart_assistant_upload_shared_file_js.xml
0 → 100644
View file @
e98efa7e
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_json_manifest_smart_assistant_json.json
View file @
e98efa7e
//
Update
web
app
manifest
so
that
it
can
be
installable
{
"short_name"
:
"Smart Assistant"
,
"name"
:
"OfficeJS Smart Assistant"
,
"description"
:
"Assist you with using an ERP"
,
"icons"
:
[{
"src"
:
"officejs_smart_assistant_icon.png"
,
"sizes"
:
"any"
,
"type"
:
"image/png"
}],
"start_url"
:
"../../"
,
"display"
:
"standalone"
"short_name"
:
"Smart Assistant"
,
"name"
:
"OfficeJS Smart Assistant"
,
"description"
:
"Assist you with using an ERP"
,
"icons"
:
[{
"src"
:
"officejs_smart_assistant_icon.png"
,
"sizes"
:
"any"
,
"type"
:
"image/png"
}],
"start_url"
:
"../"
,
"theme_color"
:
"#333"
,
"background_color"
:
"#333"
,
"display"
:
"standalone"
,
"scope"
:
"../"
,
//
web
share
target
API
"share_target"
:
{
"action"
:
"./postData"
,
"method"
:
"POST"
,
"enctype"
:
"multipart/form-data"
,
"params"
:
{
"files"
:
[{
"name"
:
"file"
,
"accept"
:
[
"*/*"
]
}]
}
}
}
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_json_manifest_smart_assistant_json.xml
View file @
e98efa7e
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
70.32880.35131.1459
2
</string>
</value>
<value>
<string>
9
86.3906.17858.1121
2
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
15
37948707.94
</float>
<float>
15
98012587.45
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_smart_assistant/WebSection_getSmartAssistantPrecacheManifestList.py
View file @
e98efa7e
...
...
@@ -128,7 +128,13 @@ url_list = [
"gadget_officejs_jio_smart_assistant_text_view.js"
,
"gadget_officejs_jio_smart_assistant_text_view.html"
,
"gadget_erp5_page_ojs_smart_assistant_home.html"
,
"gadget_erp5_page_ojs_smart_assistant_home.js"
"gadget_erp5_page_ojs_smart_assistant_home.js"
,
"gadget_erp5_page_ojs_smart_assistant_upload_shared_file.html"
,
"gadget_erp5_page_ojs_smart_assistant_upload_shared_file.js"
,
"gadget_erp5_page_ojs_smart_assistant_worklist.html"
,
"gadget_erp5_page_ojs_smart_assistant_worklist.js"
,
"gadget_officejs_jio_query_view.html"
,
"gadget_officejs_jio_smart_assistant_query_view.js"
]
return
url_list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment