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
0e88bea9
Commit
0e88bea9
authored
Apr 29, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: action gadgets handle submit
parent
b800a43e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
66 deletions
+24
-66
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
.../web_page_module/gadget_officejs_page_handle_action_js.js
+22
-64
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_page_handle_action_js.js
View file @
0e88bea9
...
...
@@ -9,12 +9,7 @@
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
@@ -38,9 +33,20 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
action_reference
;
return
gadget
.
getUrlParameter
(
"
action
"
)
.
push
(
function
(
action_parameter
)
{
action_reference
=
action_parameter
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlParameter
(
'
portal_type
'
),
gadget
.
getUrlParameter
(
'
parent_relative_url
'
),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
),
gadget
.
getUrlParameter
(
"
action
"
)
]);
})
.
push
(
function
(
result
)
{
action_reference
=
result
[
4
];
if
(
result
[
0
]
!==
undefined
)
{
options
.
portal_type
=
result
[
0
];
}
else
{
options
.
portal_type
=
result
[
2
];
}
if
(
result
[
1
]
!==
undefined
)
{
options
.
parent_relative_url
=
result
[
1
];
}
else
{
options
.
parent_relative_url
=
result
[
3
];
}
return
gadget
.
getActionFormDefinition
(
action_reference
);
})
.
push
(
function
(
form_definition
)
{
...
...
@@ -54,7 +60,7 @@
element
:
fragment
})
.
push
(
function
(
action_gadget
)
{
return
action_gadget
.
handleRender
(
gadget
,
options
,
action_reference
,
form_definition
);
return
action_gadget
.
render
(
options
,
action_reference
,
form_definition
);
});
}
}
...
...
@@ -63,60 +69,12 @@
});
})
.
onStateChange
(
function
()
{
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
var
gadget
=
this
;
return
gadget
.
getUrlParameter
(
"
action
"
)
.
push
(
function
(
action_reference
)
{
return
gadget
.
getActionFormDefinition
(
action_reference
);
})
.
push
(
function
(
form_definition
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
var
fragment
=
document
.
createElement
(
'
div
'
),
action_gadget_url
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
gadget_url
;
gadget
.
element
.
appendChild
(
fragment
);
return
gadget
.
declareGadget
(
action_gadget_url
,
{
scope
:
"
action_field
"
,
element
:
fragment
})
return
gadget
.
getDeclaredGadget
(
'
action_field
'
)
.
push
(
function
(
action_gadget
)
{
return
action_gadget
.
render
(
gadget
);
return
action_gadget
.
triggerSubmit
(
);
});
}
});
})
.
allowPublicAcquisition
(
'
notifySubmit
'
,
function
()
{
return
this
.
triggerSubmit
();
})
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
return
this
.
getDeclaredGadget
(
'
fg
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
triggerSubmit
();
});
})
.
allowPublicAcquisition
(
'
submitContent
'
,
function
(
options
)
{
var
gadget
=
this
,
jio_key
=
options
[
0
],
//target_url = options[1],
content_dict
=
options
[
2
];
return
gadget
.
getUrlParameter
(
"
action
"
)
.
push
(
function
(
action_reference
)
{
return
gadget
.
getActionFormDefinition
(
action_reference
);
})
.
push
(
function
(
form_definition
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
var
fragment
=
document
.
createElement
(
'
div
'
),
action_gadget_url
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
gadget_url
;
gadget
.
element
.
appendChild
(
fragment
);
return
gadget
.
declareGadget
(
action_gadget_url
,
{
scope
:
"
action_field
"
,
element
:
fragment
})
.
push
(
function
(
action_gadget
)
{
return
action_gadget
.
handleSubmit
(
gadget
,
jio_key
,
content_dict
);
});
}
});
});
}(
window
,
document
,
rJS
,
RSVP
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
View file @
0e88bea9
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.
17966.28995.38997
</string>
</value>
<value>
<string>
975.
23581.9849.38673
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
1556
220394.2
</float>
<float>
1556
559118.24
</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