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
Amer
erp5
Commits
c340bb96
Commit
c340bb96
authored
Apr 17, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: handle action uses action code from configuration side
parent
b31889dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
103 deletions
+35
-103
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_discussion_tool_appcache.xml
..._page_module/gadget_officejs_discussion_tool_appcache.xml
+4
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_discussion_tool_configuration.xml
..._module/gadget_officejs_discussion_tool_configuration.xml
+4
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
.../web_page_module/gadget_officejs_page_handle_action_js.js
+25
-95
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
...web_page_module/gadget_officejs_page_handle_action_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_discussion_tool_appcache.xml
View file @
c340bb96
...
...
@@ -251,10 +251,11 @@ jio_appcachestorage.js\n
#configuration resources\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewReplyDialog&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_post%2FPostModule_newHTMLPost&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F1&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F2&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F3&view=view&appcache=1\n
#
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FPost%20Module%2F2&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FPost%20Module%2F2&view=view&appcache=1\n
\n
gadget_erp5_field_listbox.html\n
gadget_erp5_field_listbox.js\n
...
...
@@ -741,7 +742,7 @@ NETWORK:\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.
4607.38713.16742
</string>
</value>
<value>
<string>
975.
6482.16884.1314
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -759,7 +760,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>
1555
421020.18
</float>
<float>
1555
531972.2
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_discussion_tool_configuration.xml
View file @
c340bb96
...
...
@@ -118,10 +118,11 @@ CACHE:\n
#discussion tool\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewReplyDialog&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_post%2FPostModule_newHTMLPost&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F1&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F2&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F3&view=view&appcache=1\n
#
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FPost%20Module%2F2&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FPost%20Module%2F2&view=view&appcache=1\n
\n
NETWORK:\n
*
...
...
@@ -267,7 +268,7 @@ NETWORK:\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
4.64630.63649.43178
</string>
</value>
<value>
<string>
97
5.6474.59109.37017
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -285,7 +286,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>
1555
418535.58
</float>
<float>
1555
531977.23
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
View file @
c340bb96
...
...
@@ -24,80 +24,42 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
,
portal_type
,
parent_portal_type
,
parent_relative_url
,
form_definition
,
action_code
;
parent_portal_type
,
action_code
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlParameter
(
"
action
"
),
gadget
.
getUrlParameter
(
"
action_type
"
),
gadget
.
getUrlParameter
(
"
portal_type
"
),
gadget
.
getUrlParameter
(
"
parent_portal_type
"
),
gadget
.
getUrlParameter
(
"
parent_relative_url
"
),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
parent_portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
),
gadget
.
declareGadget
(
"
gadget_officejs_common_utils.html
"
)
]);
})
.
push
(
function
(
result
)
{
action_reference
=
result
[
0
];
action_type
=
result
[
1
];
portal_type
=
result
[
2
]
||
result
[
5
];
parent_portal_type
=
result
[
3
]
||
result
[
6
];
parent_relative_url
=
result
[
4
]
||
result
[
7
];
gadget_utils
=
result
[
8
];
// This is the custom code to handle each specific action
if
(
action_reference
===
"
new
"
)
{
options
.
portal_type
=
portal_type
;
options
.
parent_relative_url
=
parent_relative_url
;
// Temporarily hardcoded until new action in post module is fixed
return
gadget_utils
.
getFormDefinition
(
"
HTML Post
"
,
"
jio_view
"
)
//parent_portal_type, action_reference)
.
push
(
function
(
result
)
{
form_definition
=
result
;
// custom code will come from configuration side (action form)
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
action_code
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
renderjs_extra
[
0
];
eval
(
action_code
[
0
]);
}
parent_portal_type
=
result
[
2
]
||
result
[
3
];
gadget_utils
=
result
[
4
];
return
gadget_utils
.
getFormDefinition
(
parent_portal_type
,
action_reference
)
.
push
(
function
(
form_definition
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
action_code
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
renderjs_extra
[
0
];
return
window
.
eval
.
call
(
window
,
'
(function (gadget, gadget_utils, options,
\
action_reference, parent_portal_type,
\
form_definition, child_gadget_url, submit_code)
\
{
'
+
action_code
[
0
]
+
'
})
'
)
(
gadget
,
gadget_utils
,
options
,
action_reference
,
parent_portal_type
,
form_definition
,
child_gadget_url
,
action_code
[
1
]);
}
return
gadget_utils
.
createDocument
(
options
);
})
.
push
(
function
(
jio_key
)
{
return
gadget
.
jio_get
(
jio_key
)
.
push
(
function
(
new_document
)
{
return
gadget
.
changeState
({
jio_key
:
jio_key
,
doc
:
new_document
,
child_gadget_url
:
child_gadget_url
,
form_definition
:
form_definition
,
view
:
action_reference
,
//HARDCODED: following fields should be indicated by the configuration
editable
:
true
,
has_more_views
:
false
,
has_more_actions
:
true
,
is_form_list
:
false
});
});
});
}
if
(
action_reference
===
"
reply
"
)
{
return
gadget_utils
.
getFormDefinition
(
parent_portal_type
,
action_reference
)
.
push
(
function
(
result
)
{
form_definition
=
result
;
// custom code will come from configuration side (action form)
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
action_code
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
renderjs_extra
[
0
];
return
window
.
eval
.
call
(
window
,
'
(function (gadget, options, action_reference, form_definition, child_gadget_url, submit_code)
\
{
'
+
action_code
[
0
]
+
'
})
'
)
(
gadget
,
options
,
action_reference
,
form_definition
,
child_gadget_url
,
action_code
[
1
]);
}
else
{
throw
"
Field 'gadget_field_action_js_script' missing in action
\
form. Please check '
"
+
action_reference
+
"
' action configuration.
"
;
}
});
}
throw
"
Action
"
+
action_reference
+
"
not implemented yet
"
;
}
else
{
throw
"
Action type must be 'object_jio_js_script'. Please check
\
'
"
+
action_reference
+
"
' action configuration.
"
;
}
});
});
})
...
...
@@ -119,42 +81,10 @@
jio_key
=
options
[
0
],
//target_url = options[1],
content_dict
=
options
[
2
],
property
;
// This is the custom code to handle each specific action
if
(
action_reference
===
"
reply
"
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
var
submit_code
=
gadget
.
state
.
submit_code
;
return
window
.
eval
.
call
(
window
,
'
(function (gadget, gadget_utils, content_dict)
\
{
'
+
submit_code
+
'
})
'
)(
gadget
,
gadget_utils
,
content_dict
);
}
}
if
(
action_reference
===
"
new
"
)
{
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
// this should be jio_getattachment (using target_url)
return
gadget
.
jio_get
(
jio_key
);
})
.
push
(
function
(
document
)
{
var
property
;
for
(
property
in
content_dict
)
{
if
(
content_dict
.
hasOwnProperty
(
property
))
{
document
[
property
]
=
content_dict
[
property
];
}
}
return
gadget
.
jio_put
(
jio_key
,
document
);
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
})
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
jio_key
:
jio_key
,
editable
:
true
}
});
});
submit_code
=
gadget
.
state
.
submit_code
;
if
(
action_type
===
"
object_jio_js_script
"
)
{
return
window
.
eval
.
call
(
window
,
'
(function (gadget, gadget_utils, jio_key, content_dict)
\
{
'
+
submit_code
+
'
})
'
)(
gadget
,
gadget_utils
,
jio_key
,
content_dict
);
}
});
}(
document
,
window
,
rJS
,
RSVP
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
View file @
c340bb96
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.6
084.56587.64580
</string>
</value>
<value>
<string>
975.6
480.52801.55961
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
15555
07949.3
3
</float>
<float>
15555
31274.7
3
</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