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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Le Bouter
erp5
Commits
97fb5989
Commit
97fb5989
authored
Oct 09, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Handle redirection to a specific view
parent
fbac275e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
181 additions
and
148 deletions
+181
-148
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_form_js.js
...plateItem/web_page_module/rjs_gadget_erp5_page_form_js.js
+33
-16
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_form_js.xml
...lateItem/web_page_module/rjs_gadget_erp5_page_form_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
...Item/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
+25
-18
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
+108
-100
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_python_action_js.js
...b_page_module/rjs_gadget_erp5_pt_form_python_action_js.js
+6
-5
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_python_action_js.xml
..._page_module/rjs_gadget_erp5_pt_form_python_action_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
...b_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
+3
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
..._page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_form_js.js
View file @
97fb5989
...
...
@@ -361,13 +361,18 @@ and handling data send&receive.
var
gadget
=
this
,
jio_key
=
param_list
[
0
],
target_url
=
param_list
[
1
],
content_dict
=
param_list
[
2
];
content_dict
=
param_list
[
2
],
result
=
{
jio_key
:
undefined
,
view
:
undefined
};
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
jio_putAttachment
(
jio_key
,
target_url
,
content_dict
);
})
.
push
(
function
(
attachment
)
{
var
response
;
if
(
attachment
.
target
.
response
.
type
===
"
application/json
"
)
{
// successful form save returns simple redirect and an answer as JSON
...
...
@@ -379,7 +384,7 @@ and handling data send&receive.
]);
})
.
push
(
function
(
result_list
)
{
var
response
=
JSON
.
parse
(
result_list
[
0
].
target
.
result
);
response
=
JSON
.
parse
(
result_list
[
0
].
target
.
result
);
return
gadget
.
notifySubmitted
({
"
message
"
:
response
.
portal_status_message
||
result_list
[
1
],
...
...
@@ -389,11 +394,15 @@ and handling data send&receive.
.
push
(
function
()
{
// here we figure out where to go after form submit - indicated
// by X-Location HTTP header placed by Base_redirect script
var
redirect_jio_key
=
new
URI
(
var
uri
=
new
URI
(
attachment
.
target
.
getResponseHeader
(
"
X-Location
"
)
).
segment
(
2
);
return
redirect_jio_key
;
),
redirect_jio_key
=
uri
.
segment
(
2
);
result
.
jio_key
=
redirect_jio_key
;
if
(
response
.
_links
.
hasOwnProperty
(
'
location
'
))
{
result
.
view
=
response
.
_links
.
location
.
href
;
}
return
result
;
});
}
...
...
@@ -449,7 +458,7 @@ and handling data send&receive.
// Make sure to return nothing (previous render can return
// something) so the successfull handler does not receive
// anything which it could consider as redirect jio key.
return
;
return
result
;
});
});
}
...
...
@@ -468,7 +477,8 @@ and handling data send&receive.
});
})
.
push
(
function
()
{
return
jio_key
;
result
.
jio_key
=
jio_key
;
return
result
;
});
}
...
...
@@ -488,7 +498,8 @@ and handling data send&receive.
// in the old UI but it will be a change of behaviour
// Nicolas required this feature to be allowed
.
push
(
function
()
{
return
jio_key
;
result
.
jio_key
=
jio_key
;
return
result
;
});
})
...
...
@@ -511,7 +522,8 @@ and handling data send&receive.
});
})
.
push
(
function
()
{
return
;
// error was handled
// error was handled
return
result
;
});
}
...
...
@@ -572,11 +584,15 @@ and handling data send&receive.
erp5_document
.
_now
=
Date
.
now
();
return
gadget
.
changeState
({
erp5_document
:
JSON
.
stringify
(
erp5_document
),
is_refresh
:
true
});
})
.
push
(
function
()
{
return
result
;
});
}
})
.
push
(
function
()
{
return
;
// error was handled
// error was handled
return
result
;
});
}
...
...
@@ -593,7 +609,8 @@ and handling data send&receive.
});
})
.
push
(
function
()
{
return
;
// error was handled
// error was handled
return
result
;
});
});
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_form_js.xml
View file @
97fb5989
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
8.43862.35468.53555
</string>
</value>
<value>
<string>
97
9.200.9391.33553
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
15
69398056.45
</float>
<float>
15
70693140.76
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
View file @
97fb5989
...
...
@@ -71,25 +71,29 @@
data
);
})
.
push
(
function
(
jio_key
)
{
// success redirect handler
.
push
(
function
(
result
)
{
// success redirect handler
var
splitted_jio_key_list
,
splitted_current_jio_key_list
,
command
,
i
;
if
(
is_updating
||
!
jio_key
)
{
if
(
is_updating
||
!
result
.
jio_key
)
{
return
;
}
if
(
gadget
.
state
.
redirect_to_parent
)
{
return
gadget
.
redirect
({
command
:
'
history_previous
'
});
}
if
(
gadget
.
state
.
jio_key
===
jio_key
)
{
console
.
log
(
'
COSUCOUS
'
,
result
);
if
((
gadget
.
state
.
jio_key
===
result
.
jio_key
)
&&
(
!
result
.
view
))
{
// don't update navigation history when not really redirecting
return
gadget
.
redirect
({
command
:
'
cancel_dialog_with_history
'
});
}
}
else
if
(
gadget
.
state
.
jio_key
===
result
.
jio_key
)
{
command
=
'
display_with_history_and_cancel
'
;
}
else
{
// Check if the redirection goes to a same parent's subdocument.
// In this case, do not add current document to the history
// example: when cloning, do not keep the original document in history
splitted_jio_key_list
=
jio_key
.
split
(
'
/
'
);
splitted_jio_key_list
=
result
.
jio_key
.
split
(
'
/
'
);
splitted_current_jio_key_list
=
gadget
.
state
.
jio_key
.
split
(
'
/
'
);
command
=
'
display_with_history
'
;
if
(
splitted_jio_key_list
.
length
===
splitted_current_jio_key_list
.
length
)
{
...
...
@@ -101,12 +105,15 @@
}
else
{
command
=
'
push_history
'
;
}
}
console
.
log
(
'
lets redirect
'
,
command
,
result
.
jio_key
,
result
.
view
);
// forced document change thus we update history
return
gadget
.
redirect
({
command
:
command
,
options
:
{
"
jio_key
"
:
jio_key
"
jio_key
"
:
result
.
jio_key
,
"
view
"
:
result
.
view
// do not mingle with editable because it isn't necessary
}
});
...
...
@@ -255,7 +262,7 @@
]);
})
.
push
(
function
(
translated_title_list
)
{
var
action_confirm
=
form_gadget
.
element
.
querySelector
(
'
input.dialogconfirm
'
)
var
action_confirm
=
form_gadget
.
element
.
querySelector
(
'
input.dialogconfirm
'
)
;
if
(
form_gadget
.
state
.
action_title
)
{
action_confirm
.
value
=
form_gadget
.
state
.
action_title
;
}
else
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
View file @
97fb5989
...
...
@@ -142,11 +142,13 @@
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
...
...
@@ -190,16 +192,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
...
...
@@ -208,7 +214,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
valentin
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -222,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
978.13676.64074.1365
</string>
</value>
<value>
<string>
979.21958.43628.13243
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -240,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
1567589301.19
</float>
<float>
1571996930.73
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
@@ -249,7 +255,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_python_action_js.js
View file @
97fb5989
...
...
@@ -31,23 +31,23 @@
data
);
})
.
push
(
function
(
jio_key
)
{
// success redirect handler
.
push
(
function
(
result
)
{
// success redirect handler
var
splitted_jio_key_list
,
splitted_current_jio_key_list
,
command
,
i
;
if
(
!
jio_key
)
{
if
(
!
result
.
jio_key
)
{
return
;
}
if
(
gadget
.
state
.
jio_key
===
jio_key
)
{
if
(
gadget
.
state
.
jio_key
===
result
.
jio_key
)
{
// don't update navigation history when not really redirecting
return
gadget
.
redirect
({
command
:
'
cancel_dialog_with_history
'
});
}
// Check if the redirection goes to a same parent's subdocument.
// In this case, do not add current document to the history
// example: when cloning, do not keep the original document in history
splitted_jio_key_list
=
jio_key
.
split
(
'
/
'
);
splitted_jio_key_list
=
result
.
jio_key
.
split
(
'
/
'
);
splitted_current_jio_key_list
=
gadget
.
state
.
jio_key
.
split
(
'
/
'
);
command
=
'
display_with_history
'
;
if
(
splitted_jio_key_list
.
length
===
splitted_current_jio_key_list
.
length
)
{
...
...
@@ -64,7 +64,8 @@
return
gadget
.
redirect
({
command
:
command
,
options
:
{
"
jio_key
"
:
jio_key
"
jio_key
"
:
result
.
jio_key
,
"
view
"
:
result
.
view
// do not mingle with editable because it isn't necessary
}
});
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_python_action_js.xml
View file @
97fb5989
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
8.35224.37222.1554
7
</string>
</value>
<value>
<string>
97
9.197.9357.6261
7
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
15
68880648.91
</float>
<float>
15
70623795.93
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
View file @
97fb5989
...
...
@@ -163,7 +163,7 @@
})
.
push
(
function
(
content_dict
)
{
if
(
content_dict
===
null
)
{
return
;
return
{}
;
}
return
gadget
.
submitContent
(
gadget
.
state
.
jio_key
,
...
...
@@ -171,8 +171,8 @@
content_dict
);
})
.
push
(
function
(
jio_key
)
{
if
(
jio_key
)
{
.
push
(
function
(
result
)
{
if
(
result
.
jio_key
)
{
// success redirect callback receives jio_key
return
gadget
.
redirect
({
command
:
'
reload
'
});
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
View file @
97fb5989
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
4.48372.34584.55722
</string>
</value>
<value>
<string>
97
9.2796.18260.40345
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
15
54113074.6
8
</float>
<float>
15
70779670.
8
</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