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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
ebe4a9b1
Commit
ebe4a9b1
authored
Apr 01, 2019
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Factorise code
Only use what is visible / checked
parent
67b6d207
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
68 deletions
+60
-68
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_global_js.js
...TemplateItem/web_page_module/rjs_gadget_erp5_global_js.js
+58
-66
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_global_js.xml
...emplateItem/web_page_module/rjs_gadget_erp5_global_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_global_js.js
View file @
ebe4a9b1
...
...
@@ -99,87 +99,79 @@
}
function
triggerListboxClipboardAction
(
argument_list
)
{
var
action_list
=
ensureArray
(
this
.
state
.
erp5_document
.
_links
.
action_object_list_action
||
[]),
var
gadget
=
this
,
action_list
=
ensureArray
(
gadget
.
state
.
erp5_document
.
_links
.
action_object_list_action
||
[]),
action_name
=
argument_list
[
0
],
checked_uid_list
=
argument_list
[
1
],
unchecked_uid_list
=
argument_list
[
2
],
gadget
=
this
,
extended_search
=
''
,
view
,
i
;
i
,
queue
;
if
(
action_name
===
'
copy_document_list
'
)
{
if
(
checked_uid_list
.
length
===
0
)
{
// If nothing is checked, use all unchecked values (same as xhtml style)
checked_uid_list
=
unchecked_uid_list
;
}
if
(
checked_uid_list
.
length
===
0
)
{
// XXX Queries do not correctly handle empty uid list
return
gadget
.
redirect
({
command
:
'
reload
'
});
}
return
gadget
.
setSetting
(
'
clipboard
'
,
checked_uid_list
)
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
"
message
"
:
"
Copied.
"
,
"
status
"
:
"
success
"
});
});
if
(
checked_uid_list
.
length
===
0
)
{
// If nothing is checked, use all unchecked values (same as xhtml style)
checked_uid_list
=
unchecked_uid_list
;
}
for
(
i
=
0
;
i
<
action_list
.
length
;
i
+=
1
)
{
if
(
action_name
===
action_list
[
i
].
name
)
{
view
=
action_list
[
i
].
href
;
if
(
action_name
!==
'
copy_document_list
'
)
{
// Copy action is only done on javascript side
for
(
i
=
0
;
i
<
action_list
.
length
;
i
+=
1
)
{
if
(
action_name
===
action_list
[
i
].
name
)
{
view
=
action_list
[
i
].
href
;
}
}
if
(
view
===
undefined
)
{
// Action was not found.
return
gadget
.
notifySubmitted
({
"
message
"
:
"
Action not handled.
"
});
}
}
if
(
checked_uid_list
.
length
!==
0
)
{
// If nothing is checked, use original query
extended_search
=
createSearchQuery
(
checked_uid_list
,
'
catalog.uid
'
);
}
if
(
view
===
undefined
)
{
// Action was not found.
// Reload
return
gadget
.
redirect
({
command
:
'
reload
'
});
}
if
(
action_name
===
'
paste_document_list
'
)
{
return
gadget
.
getSetting
(
'
clipboard
'
)
// Get the list of document uid from the internal clipboard
queue
=
gadget
.
getSetting
(
'
clipboard
'
)
.
push
(
function
(
uid_list
)
{
uid_list
=
uid_list
||
[];
if
(
uid_list
.
length
===
0
)
{
// Nothing to paste, go away
uid_list
=
[
'
XXX
'
];
}
return
gadget
.
redirect
({
command
:
'
display_dialog_with_history
'
,
options
:
{
"
jio_key
"
:
gadget
.
state
.
jio_key
,
"
view
"
:
view
,
"
extended_search
"
:
createSearchQuery
(
uid_list
,
'
catalog.uid
'
)
}
},
true
);
checked_uid_list
=
uid_list
||
[];
});
}
else
{
queue
=
new
RSVP
.
Queue
();
}
return
gadget
.
redirect
({
command
:
'
display_dialog_with_history
'
,
options
:
{
"
jio_key
"
:
gadget
.
state
.
jio_key
,
"
view
"
:
view
,
"
extended_search
"
:
extended_search
}
},
true
);
return
queue
.
push
(
function
()
{
if
(
checked_uid_list
.
length
===
0
)
{
// Do not trigger action if the listbox was empty
// Dialog listbox use catalog method, which may be different from the current select method
// and so, it is mandatory to propagate a list of uid, otherwise, the dialog may display
// an unexpected huge list of unrelated documents
return
gadget
.
notifySubmitted
({
"
message
"
:
"
Nothing selected.
"
});
}
if
(
action_name
===
'
copy_document_list
'
)
{
return
gadget
.
setSetting
(
'
clipboard
'
,
checked_uid_list
)
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
"
message
"
:
"
Copied.
"
,
"
status
"
:
"
success
"
});
});
}
return
gadget
.
redirect
({
command
:
'
display_dialog_with_history
'
,
options
:
{
"
jio_key
"
:
gadget
.
state
.
jio_key
,
"
view
"
:
view
,
"
extended_search
"
:
createSearchQuery
(
checked_uid_list
,
'
catalog.uid
'
)
}
},
true
);
});
}
window
.
triggerListboxClipboardAction
=
triggerListboxClipboardAction
;
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_global_js.xml
View file @
ebe4a9b1
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.4
4319.22564.50107
</string>
</value>
<value>
<string>
974.4
8315.28627.55534
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
155
3869431.11
</float>
<float>
155
4109242.58
</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