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
138
Merge Requests
138
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
9821abea
Commit
9821abea
authored
Sep 25, 2019
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: Improve gadget to store images captured in Active Process
parent
ecb90eb6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
201 additions
and
14 deletions
+201
-14
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_storeDocumentFromCameraInActiveProcess.py
...nt_scanner/Base_storeDocumentFromCameraInActiveProcess.py
+17
-0
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_storeDocumentFromCameraInActiveProcess.xml
...t_scanner/Base_storeDocumentFromCameraInActiveProcess.xml
+62
-0
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_viewUploadDocumentFromCameraDialog.xml
...ument_scanner/Base_viewUploadDocumentFromCameraDialog.xml
+4
-3
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_viewUploadDocumentFromCameraDialog/your_active_process_url.xml
...ploadDocumentFromCameraDialog/your_active_process_url.xml
+96
-0
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/gadget_document_scanner.css.css
...ins/erp5_document_scanner/gadget_document_scanner.css.css
+10
-3
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/gadget_document_scanner.html.html
...s/erp5_document_scanner/gadget_document_scanner.html.html
+3
-3
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/gadget_document_scanner.js.js
...skins/erp5_document_scanner/gadget_document_scanner.js.js
+9
-5
No files found.
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_storeDocumentFromCameraInActiveProcess.py
0 → 100644
View file @
9821abea
from
base64
import
decodestring
from
Products.CMFActivity.ActiveResult
import
ActiveResult
portal
=
context
.
getPortalObject
()
active_result
=
ActiveResult
(
detail
=
decodestring
(
document_scanner_gadget
)
)
if
not
active_process_url
:
active_process
=
portal
.
portal_activities
.
newActiveProcess
()
context
.
REQUEST
.
form
[
"your_active_process_url"
]
=
active_process
.
getRelativeUrl
()
else
:
active_process
=
portal
.
restrictedTraverse
(
active_process_url
)
active_process
.
postResult
(
active_result
)
return
context
.
Base_renderForm
(
'Base_viewUploadDocumentFromCameraDialog'
,
message
=
'Captured'
)
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_storeDocumentFromCameraInActiveProcess.xml
0 → 100644
View file @
9821abea
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
portal_type=None, classification=None, synchronous_metadata_discovery=None, cancel_url=None, batch_mode=False, editable_mode=1, group=None, publication_section=None, document_scanner_gadget=None, active_process_url=None, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_storeDocumentFromCameraInActiveProcess
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_viewUploadDocumentFromCameraDialog.xml
View file @
9821abea
...
@@ -103,6 +103,7 @@
...
@@ -103,6 +103,7 @@
<string>
your_language
</string>
<string>
your_language
</string>
<string>
your_version
</string>
<string>
your_version
</string>
<string>
stringfield_validator
</string>
<string>
stringfield_validator
</string>
<string>
your_active_process_url
</string>
</list>
</list>
</value>
</value>
</item>
</item>
...
@@ -145,7 +146,7 @@
...
@@ -145,7 +146,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string>
Attach Document
</string>
</value>
<value>
<string>
Finish
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<key>
<string>
unicode_mode
</string>
</key>
...
@@ -153,11 +154,11 @@
...
@@ -153,11 +154,11 @@
</item>
</item>
<item>
<item>
<key>
<string>
update_action
</string>
</key>
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
Base_storeDocumentFromCameraInActiveProcess
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
Attach Image
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_viewUploadDocumentFromCameraDialog/your_active_process_url.xml
0 → 100644
View file @
9821abea
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
hidden
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_active_process_url
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_string_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/gadget_document_scanner.css.css
View file @
9821abea
...
@@ -4,9 +4,10 @@
...
@@ -4,9 +4,10 @@
}
}
.video
,
.photo
,
.camera-output
{
.video
,
.photo
,
.camera-output
{
width
:
auto
!important
;
width
:
100%
;
height
:
360px
;
height
:
360px
;
filter
:
brightness
(
1
);
filter
:
brightness
(
1
);
text-align
:
center
;
}
}
.canvas
{
.canvas
{
...
@@ -24,10 +25,9 @@
...
@@ -24,10 +25,9 @@
.camera
{
.camera
{
display
:
inline-block
;
display
:
inline-block
;
padding-top
:
2em
;
}
}
.startbutton
,
.c
rop
-button
{
.startbutton
,
.c
apture
-button
{
display
:
block
;
display
:
block
;
position
:
relative
;
position
:
relative
;
margin
:
0
auto
;
margin
:
0
auto
;
...
@@ -45,3 +45,10 @@
...
@@ -45,3 +45,10 @@
font-family
:
"Lucida Grande"
,
"Arial"
,
sans-serif
;
font-family
:
"Lucida Grande"
,
"Arial"
,
sans-serif
;
width
:
760px
;
width
:
760px
;
}
}
@media
screen
and
(
min-device-width
:
600px
)
{
.camera
{
margin-top
:
1em
;
}
}
\ No newline at end of file
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/gadget_document_scanner.html.html
View file @
9821abea
...
@@ -17,15 +17,15 @@
...
@@ -17,15 +17,15 @@
</select>
</select>
</div>
</div>
<div
class=
"camera"
>
<div
class=
"camera"
>
<div
class=
"camera-input"
>
<div
class=
"camera-input"
style=
"display:none"
>
<video
class=
"video"
>
Webcam is not available
</video>
<video
class=
"video"
>
Webcam is not available
</video>
<button
type=
"button"
class=
"startbutton"
>
Take a picture!
</button>
<button
type=
"button"
class=
"startbutton"
>
Take a picture!
</button>
</div>
</div>
<canvas
class=
"canvas"
></canvas>
<canvas
class=
"canvas"
></canvas>
<div
class=
"camera-output"
style=
"display:none"
>
<div
class=
"camera-output"
style=
"display:none"
>
<img
class=
"photo"
alt=
"Photo"
>
<img
class=
"photo"
alt=
"Photo"
>
<input
class=
"photoInput"
type=
"hidden"
>
<input
class=
"photoInput"
type=
"hidden"
>
<button
class=
"c
rop-button"
>
Crop
</button>
<button
class=
"c
apture-button"
>
Capture
</button>
</div>
</div>
</div>
</div>
</body>
</body>
...
...
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/gadget_document_scanner.js.js
View file @
9821abea
...
@@ -188,6 +188,7 @@
...
@@ -188,6 +188,7 @@
if
(
video
)
{
if
(
video
)
{
video
.
pause
();
video
.
pause
();
}
}
root
.
querySelector
(
"
.camera-input
"
).
style
.
display
=
""
;
if
(
evt
.
target
.
value
)
{
if
(
evt
.
target
.
value
)
{
return
startup
(
root
,
evt
.
target
.
value
);
return
startup
(
root
,
evt
.
target
.
value
);
}
}
...
@@ -196,18 +197,20 @@
...
@@ -196,18 +197,20 @@
},
false
,
true
)
},
false
,
true
)
.
onEvent
(
"
click
"
,
function
(
evt
)
{
.
onEvent
(
"
click
"
,
function
(
evt
)
{
var
canvasData
;
var
gadget
,
canvasData
;
if
(
evt
.
target
.
className
==
"
startbutton
"
)
{
if
(
evt
.
target
.
className
==
"
startbutton
"
)
{
return
this
.
getElement
()
return
this
.
getElement
()
.
push
(
function
(
gadget
)
{
.
push
(
function
(
el
)
{
return
takePicture
(
gadget
);
el
.
querySelector
(
"
.camera-input
"
).
style
.
display
=
"
none
"
;
return
takePicture
(
el
);
});
});
}
}
if
(
evt
.
target
.
className
==
"
capture-button
"
)
{
if
(
evt
.
target
.
className
==
"
capture-button
"
)
{
canvasData
=
cropper
.
getCanvasData
();
canvasData
=
cropper
.
getCanvasData
();
storage
.
put
(
"
settings
"
,
cropper
.
getData
());
storage
.
put
(
"
settings
"
,
cropper
.
getData
());
return
RSVP
.
Queue
()
return
this
.
getElement
()
.
push
(
function
()
{
.
push
(
function
(
el
)
{
gadget
=
el
;
return
cropper
.
getCroppedCanvas
();
return
cropper
.
getCroppedCanvas
();
})
})
.
push
(
function
(
canvas
)
{
.
push
(
function
(
canvas
)
{
...
@@ -230,6 +233,7 @@
...
@@ -230,6 +233,7 @@
photo
.
src
=
base64data
;
photo
.
src
=
base64data
;
photoInput
.
value
=
realData
;
photoInput
.
value
=
realData
;
gadget
.
querySelector
(
"
.capture-button
"
).
style
.
display
=
"
none
"
;
cropper
.
destroy
();
cropper
.
destroy
();
});
});
}
}
...
...
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