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
1
Issues
1
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
Roque
erp5
Commits
b800a43e
Commit
b800a43e
authored
Apr 25, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: remove global variables in handle action and controller gadgets
parent
74e549c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
51 deletions
+77
-51
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
...e_module/gadget_officejs_controller_page_controller_js.js
+4
-6
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
..._module/gadget_officejs_controller_page_controller_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
.../web_page_module/gadget_officejs_page_handle_action_js.js
+69
-41
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_controller_page_controller_js.js
View file @
b800a43e
...
...
@@ -3,11 +3,6 @@
(
function
(
window
,
rJS
)
{
"
use strict
"
;
var
default_view
=
"
jio_view
"
,
common_utils_gadget_url
=
"
gadget_officejs_common_utils.html
"
,
form_view_gadget_url
=
"
gadget_officejs_form_view.html
"
,
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
...
...
@@ -32,6 +27,9 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
default_view
=
"
jio_view
"
,
common_utils_gadget_url
=
"
gadget_officejs_common_utils.html
"
,
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
,
gadget_utils
,
jio_document
;
return
gadget
.
declareGadget
(
common_utils_gadget_url
)
...
...
@@ -64,7 +62,7 @@
.
onStateChange
(
function
()
{
var
gadget
=
this
;
return
gadget
.
declareGadget
(
form_view_gadget_url
)
return
gadget
.
declareGadget
(
"
gadget_officejs_form_view.html
"
)
.
push
(
function
(
form_view_gadget
)
{
return
form_view_gadget
.
renderGadget
(
gadget
);
});
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
View file @
b800a43e
...
...
@@ -225,7 +225,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.1
6237.58964.50022
</string>
</value>
<value>
<string>
975.1
7968.931.9949
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -243,7 +243,7 @@
</tuple>
<state>
<tuple>
<float>
1556
122084.05
</float>
<float>
1556
220490.79
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
View file @
b800a43e
/*global window, document, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint evil: true */
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
"
use strict
"
;
var
common_utils_gadget_url
=
"
gadget_officejs_common_utils.html
"
,
gadget_utils
,
action_reference
,
action_type
,
action_gadget
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
...
...
@@ -27,49 +20,69 @@
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
parent_portal_type
,
action_gadget_url
;
.
declareMethod
(
"
getActionFormDefinition
"
,
function
(
action_reference
)
{
var
gadget
=
this
,
parent_portal_type
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlParameter
(
"
action
"
),
gadget
.
getUrlParameter
(
"
parent_portal_type
"
),
gadget
.
getSetting
(
'
parent_portal_type
'
),
gadget
.
declareGadget
(
common_utils_gadget_url
)
gadget
.
declareGadget
(
"
gadget_officejs_common_utils.html
"
)
]);
})
.
push
(
function
(
result
)
{
action_reference
=
result
[
0
];
parent_portal_type
=
result
[
1
]
||
result
[
2
];
gadget_utils
=
result
[
3
];
return
gadget_utils
.
getFormDefinition
(
parent_portal_type
,
action_reference
)
.
push
(
function
(
form_definition
)
{
action_type
=
form_definition
.
action_type
;
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
action_gadget_url
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
gadget_url
;
var
fragment
=
document
.
createElement
(
'
div
'
);
gadget
.
element
.
appendChild
(
fragment
);
return
gadget
.
declareGadget
(
action_gadget_url
,
{
scope
:
"
action_field
"
,
element
:
fragment
})
.
push
(
function
(
declared_gadget
)
{
action_gadget
=
declared_gadget
;
return
action_gadget
.
handleRender
(
gadget
,
options
,
action_reference
,
form_definition
);
});
}
else
{
throw
"
Field 'gadget_field_action_js_script' missing in action form. Please check '
"
+
action_reference
+
"
' action configuration.
"
;
}
}
else
{
throw
"
Action type must be 'object_jio_js_script'. Please check '
"
+
action_reference
+
"
' action configuration.
"
;
}
});
parent_portal_type
=
result
[
0
]
||
result
[
1
];
return
result
[
2
].
getFormDefinition
(
parent_portal_type
,
action_reference
);
});
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
action_reference
;
return
gadget
.
getUrlParameter
(
"
action
"
)
.
push
(
function
(
action_parameter
)
{
action_reference
=
action_parameter
;
return
gadget
.
getActionFormDefinition
(
action_reference
);
})
.
push
(
function
(
form_definition
)
{
if
(
form_definition
.
action_type
===
"
object_jio_js_script
"
)
{
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
.
handleRender
(
gadget
,
options
,
action_reference
,
form_definition
);
});
}
}
// avoid crash if form doesn't have gadget_field_action_js_script or object_jio_js_script action
// render form without submit (and warn/inform user?)
});
})
.
onStateChange
(
function
()
{
return
action_gadget
.
render
(
this
);
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
})
.
push
(
function
(
action_gadget
)
{
return
action_gadget
.
render
(
gadget
);
});
}
});
})
.
allowPublicAcquisition
(
'
notifySubmit
'
,
function
()
{
...
...
@@ -87,8 +100,23 @@
jio_key
=
options
[
0
],
//target_url = options[1],
content_dict
=
options
[
2
];
if
(
action_type
===
"
object_jio_js_script
"
)
{
action_gadget
.
handleSubmit
(
gadget
,
jio_key
,
content_dict
);
}
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 @
b800a43e
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.17
664.59173.20292
</string>
</value>
<value>
<string>
975.17
966.28995.38997
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
15562
02915.67
</float>
<float>
15562
20394.2
</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