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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
f337eb74
Commit
f337eb74
authored
Feb 27, 2020
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: Fix pagination
parent
4570c90d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
35 deletions
+49
-35
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.js
...ateItem/web_page_module/rjs_gadget_document_scanner_js.js
+47
-33
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.xml
...teItem/web_page_module/rjs_gadget_document_scanner_js.xml
+2
-2
No files found.
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.js
View file @
f337eb74
...
...
@@ -192,10 +192,10 @@
for
(
j
=
0
;
j
<
len
;
j
+=
1
)
{
device
=
info_list
[
j
];
if
(
device
.
kind
===
'
videoinput
'
)
{
if
(
(
!
current_device_id
)
||
if
(
!
current_device_id
||
(
camera_list
.
indexOf
(
device
.
deviceId
)
===
-
1
&&
(
force_new_device
&&
(
device
.
deviceId
!==
current_device_id
))
||
(
!
force_new_device
&&
(
device
.
deviceId
===
current_device_id
))))
{
(
(
force_new_device
&&
(
device
.
deviceId
!==
current_device_id
))
||
(
!
force_new_device
&&
(
device
.
deviceId
===
current_device_id
)
))))
{
return
device
.
deviceId
;
}
}
...
...
@@ -227,38 +227,39 @@
}
function
buildPreviousThumbnailDom
(
gadget
)
{
var
i
,
img_class
,
var
img_class
,
btn_class
=
""
,
len
=
gadget
.
state
.
page_count
,
thumbnail_dom_list
=
[];
return
gadget
.
getTranslationList
([
"
New Page
"
])
.
push
(
function
(
result_list
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
// XXX TODO display a loader when saving
if
(
gadget
.
state
[
'
blob_state_
'
+
i
]
!==
'
deleted
'
)
{
if
(
gadget
.
state
[
'
blob_state_
'
+
i
]
===
"
error
"
)
{
img_class
=
"
show-img upload-error
"
;
}
else
{
img_class
=
"
show-img
"
;
}
var
key
,
el
;
for
(
el
in
gadget
.
state
)
{
if
(
gadget
.
state
.
hasOwnProperty
(
el
)
&&
el
.
indexOf
(
"
blob_state_
"
)
!==
-
1
)
{
key
=
parseInt
(
el
.
replace
(
"
blob_state_
"
,
""
),
10
);
if
(
gadget
.
state
[
'
blob_state_
'
+
key
]
!==
'
deleted
'
)
{
if
(
gadget
.
state
[
'
blob_state_
'
+
key
]
===
"
error
"
)
{
img_class
=
"
show-img upload-error
"
;
}
else
{
img_class
=
"
show-img
"
;
}
if
(
gadget
.
state
[
'
blob_state_
'
+
i
]
===
"
saving
"
)
{
btn_class
=
"
btn-thumbnail ui-btn-icon-top ui-icon-spinner
"
;
}
else
{
btn_class
=
"
btn-thumbnail
"
;
if
(
gadget
.
state
[
'
blob_state_
'
+
key
]
===
"
saving
"
)
{
btn_class
=
"
btn-thumbnail ui-btn-icon-top ui-icon-spinner
"
;
}
else
{
btn_class
=
"
btn-thumbnail
"
;
}
thumbnail_dom_list
.
push
(
domsugar
(
'
button
'
,
{
type
:
"
button
"
,
"
class
"
:
btn_class
,
// Do not allow to show again the current image
// or do not allow to show saving image (to simplify button management)
disabled
:
(
key
===
gadget
.
state
.
page
)
||
(
gadget
.
state
[
'
blob_state_
'
+
key
]
===
'
saving
'
)
},
[
domsugar
(
"
img
"
,
{
"
class
"
:
img_class
,
'
data-page
'
:
key
,
src
:
gadget
.
state
[
'
blob_url_
'
+
key
]})]));
}
thumbnail_dom_list
.
push
(
domsugar
(
'
button
'
,
{
type
:
"
button
"
,
"
class
"
:
btn_class
,
// Do not allow to show again the current image
// or do not allow to show saving image (to simplify button management)
disabled
:
(
i
===
gadget
.
state
.
page
)
||
(
gadget
.
state
[
'
blob_state_
'
+
i
]
===
'
saving
'
)
},
[
domsugar
(
"
img
"
,
{
"
class
"
:
img_class
,
'
data-page
'
:
i
,
src
:
gadget
.
state
[
'
blob_url_
'
+
i
]})]));
}
}
thumbnail_dom_list
.
push
(
domsugar
(
'
button
'
,
{
type
:
'
button
'
,
...
...
@@ -368,9 +369,9 @@
.
push
(
function
(
result_list
)
{
var
bitmap
=
result_list
[
0
],
img
=
domsugar
(
"
img
"
,
{
"
src
"
:
result_list
[
1
].
target
.
result
}),
div
=
gadget
.
element
.
querySelector
(
"
.camera-input
"
),
canvas
=
domsugar
(
'
canvas
'
,
{
'
class
'
:
'
canvas
'
});
div
=
gadget
.
element
.
querySelector
(
"
.camera-input
"
);
gadget
.
detached_promise_dict
.
media_stream
.
cancel
(
'
Not needed anymore, as captured
'
);
div
.
replaceChild
(
img
,
div
.
firstElementChild
);
canvas
.
width
=
bitmap
.
width
;
...
...
@@ -587,7 +588,9 @@
.
onEvent
(
"
click
"
,
function
(
evt
)
{
// Only handle click on BUTTON and IMG element
var
gadget
=
this
,
var
el
,
key
,
gadget
=
this
,
tag_name
=
evt
.
target
.
tagName
,
state_dict
;
...
...
@@ -600,8 +603,7 @@
evt
.
preventDefault
();
// If user clicks on same image twice,
// we don't need to disable everything again if parent is already disabled
if
(
tag_name
===
'
BUTTON
'
||
(
tag_name
===
'
IMG
'
&&
!
evt
.
target
.
parentElement
.
disabled
))
{
if
(
tag_name
===
'
BUTTON
'
||
(
tag_name
===
'
IMG
'
&&
!
evt
.
target
.
parentElement
.
disabled
))
{
gadget
.
element
.
querySelectorAll
(
'
button
'
).
forEach
(
function
(
elt
)
{
elt
.
disabled
=
true
;
});
...
...
@@ -622,15 +624,25 @@
if
(
evt
.
target
.
className
.
indexOf
(
"
new-btn
"
)
!==
-
1
)
{
return
gadget
.
changeState
({
display_step
:
'
display_video
'
,
page
:
gadget
.
state
.
page
_count
+
1
page
:
gadget
.
state
.
page
+
1
});
}
if
(
evt
.
target
.
className
.
indexOf
(
"
delete-btn
"
)
!==
-
1
)
{
state_dict
=
{
display_step
:
'
display_video
'
,
page
:
gadget
.
state
.
page_count
+
1
page
:
0
};
for
(
el
in
gadget
.
state
)
{
if
(
gadget
.
state
.
hasOwnProperty
(
el
)
&&
el
.
indexOf
(
"
blob_state_
"
)
!==
-
1
)
{
key
=
el
.
replace
(
"
blob_state_
"
,
""
);
if
(
gadget
.
state
[
'
blob_state_
'
+
key
]
!==
'
deleted
'
)
{
state_dict
.
page
=
state_dict
.
page
+
1
;
}
}
}
state_dict
[
'
blob_state_
'
+
gadget
.
state
.
page
]
=
'
deleted
'
;
return
gadget
.
changeState
(
state_dict
);
}
...
...
@@ -657,6 +669,8 @@
// Keep image date, as user may need to display it again
state_dict
[
'
blob_url_
'
+
gadget
.
state
.
page_count
]
=
evt
.
target
.
result
;
state_dict
[
'
blob_state_
'
+
gadget
.
state
.
page_count
]
=
'
saving
'
;
state_dict
[
'
blob_uuid_
'
+
gadget
.
state
.
page_count
]
=
null
;
return
gadget
.
changeState
(
state_dict
);
})
.
push
(
function
()
{
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.xml
View file @
f337eb74
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
98
1.65265.9437.56217
</string>
</value>
<value>
<string>
98
2.7372.6060.34525
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
1582
308884.59
</float>
<float>
1582
764289.53
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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