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
Léo-Paul Géneau
erp5
Commits
fe5b49f4
Commit
fe5b49f4
authored
Nov 22, 2019
by
Roque
Committed by
Roque
Nov 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: reduce calls to getSetting method
parent
2df7e77b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
72 deletions
+84
-72
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_util_js.js
...ateItem/web_page_module/gadget_officejs_common_util_js.js
+56
-59
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_util_js.xml
...teItem/web_page_module/gadget_officejs_common_util_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
...le/gadget_officejs_controller_page_local_controller_js.js
+10
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.xml
...e/gadget_officejs_controller_page_local_controller_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
...eb_page_module/gadget_officejs_page_action_officejs_js.js
+12
-4
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.xml
...b_page_module/gadget_officejs_page_action_officejs_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_util_js.js
View file @
fe5b49f4
...
...
@@ -128,70 +128,57 @@
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
getViewAndActionDict
"
,
function
(
portal_type
,
jio_key
)
{
.
declareMethod
(
"
getViewAndActionDict
"
,
function
(
portal_type
,
app_view
,
default_view
,
app_actions_string
,
jio_key
)
{
var
gadget
=
this
,
action_info_dict
=
{
view_list
:
{},
action_list
:
{}},
query
=
buildSearchQuery
(
portal_type
),
app_actions
,
app_view
,
default_view
;
return
gadget
.
getSettingList
([
'
app_view_reference
'
,
'
default_view_reference
'
,
'
app_actions
'
])
.
push
(
function
(
result_list
)
{
app_view
=
result_list
[
0
];
default_view
=
result_list
[
1
];
return
formatSettingList
(
result_list
[
2
],
portal_type
);
app_actions_result
=
formatSettingList
(
app_actions_string
,
portal_type
);
app_actions
=
app_actions_result
.
map
(
function
(
pair
)
{
return
pair
[
1
];
});
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
action_list
)
{
var
path_for_jio_get_list
=
[],
row
;
for
(
row
in
action_list
.
data
.
rows
)
{
if
(
action_list
.
data
.
rows
.
hasOwnProperty
(
row
))
{
path_for_jio_get_list
.
push
(
gadget
.
jio_get
(
action_list
.
data
.
rows
[
row
].
id
));
}
}
return
RSVP
.
all
(
path_for_jio_get_list
);
})
.
push
(
function
(
app_actions_result
)
{
app_actions
=
app_actions_result
.
map
(
function
(
pair
)
{
return
pair
[
1
];
});
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
action_list
)
{
var
path_for_jio_get_list
=
[],
row
;
for
(
row
in
action_list
.
data
.
rows
)
{
if
(
action_list
.
data
.
rows
.
hasOwnProperty
(
row
))
{
path_for_jio_get_list
.
push
(
gadget
.
jio_get
(
action_list
.
data
.
rows
[
row
]
.
id
));
.
push
(
function
(
action_document_list
)
{
var
action_key
,
action_doc
,
action_settings
;
for
(
action_key
in
action_document_list
)
{
if
(
action_document_list
.
hasOwnProperty
(
action_key
))
{
action_doc
=
action_document_list
[
action_key
];
if
(
app_actions
.
includes
(
action_doc
.
reference
))
{
action_settings
=
{
page
:
undefined
,
jio_key
:
jio_key
,
title
:
action_doc
.
title
,
action
:
action_doc
.
reference
,
reference
:
action_doc
.
reference
,
action_type
:
action_doc
.
action_type
,
parent_portal_type
:
portal_type
};
if
(
view_categorie_list
.
includes
(
action_settings
.
action_type
))
{
action_settings
.
page
=
"
ojs_local_controller
"
;
action_info_dict
.
view_list
[
action_settings
.
action
]
=
action_settings
;
}
else
{
action_settings
.
page
=
"
handle_action
"
;
action_info_dict
.
action_list
[
action_settings
.
action
]
=
action_settings
;
}
}
return
RSVP
.
all
(
path_for_jio_get_list
);
})
.
push
(
function
(
action_document_list
)
{
var
action_key
,
action_doc
,
action_settings
;
for
(
action_key
in
action_document_list
)
{
if
(
action_document_list
.
hasOwnProperty
(
action_key
))
{
action_doc
=
action_document_list
[
action_key
];
if
(
app_actions
.
includes
(
action_doc
.
reference
))
{
action_settings
=
{
page
:
undefined
,
jio_key
:
jio_key
,
title
:
action_doc
.
title
,
action
:
action_doc
.
reference
,
reference
:
action_doc
.
reference
,
action_type
:
action_doc
.
action_type
,
parent_portal_type
:
portal_type
};
if
(
view_categorie_list
.
includes
(
action_settings
.
action_type
))
{
action_settings
.
page
=
"
ojs_local_controller
"
;
action_info_dict
.
view_list
[
action_settings
.
action
]
=
action_settings
;
}
else
{
action_settings
.
page
=
"
handle_action
"
;
action_info_dict
.
action_list
[
action_settings
.
action
]
=
action_settings
;
}
}
}
}
action_info_dict
.
view_list
=
filterViewList
(
action_info_dict
.
view_list
,
app_view
,
default_view
);
return
action_info_dict
;
});
}
}
action_info_dict
.
view_list
=
filterViewList
(
action_info_dict
.
view_list
,
app_view
,
default_view
);
return
action_info_dict
;
});
})
...
...
@@ -234,13 +221,22 @@
form_definition
,
portal_skin_folder
,
app_allowed_sub_types
,
app_view
,
default_view
,
app_actions_string
,
form_info
,
error
;
return
gadget
.
getSettingList
([
portal_type_dict_setting
,
'
portal_skin_folder
'
,
'
app_allowed_sub_types
'
])
'
app_allowed_sub_types
'
,
'
app_view_reference
'
,
'
default_view_reference
'
,
'
app_actions
'
])
.
push
(
function
(
result_list
)
{
app_allowed_sub_types
=
result_list
[
2
];
app_view
=
result_list
[
3
];
default_view
=
result_list
[
4
];
app_actions_string
=
result_list
[
5
];
if
(
!
result_list
[
1
])
{
throw
new
Error
(
"
Missing site configuration 'portal_skin_folder'
"
);
}
...
...
@@ -312,7 +308,8 @@
.
new_content_dialog_form
;
form_definition
.
new_content_category
=
portal_type_dict
.
new_content_category
;
return
gadget
.
getViewAndActionDict
(
portal_type
);
return
gadget
.
getViewAndActionDict
(
portal_type
,
app_view
,
default_view
,
app_actions_string
);
})
.
push
(
function
(
action_view_dict
)
{
form_definition
.
portal_type_dict
.
has_more_views
=
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_util_js.xml
View file @
fe5b49f4
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
979.
7531.30512.4637
0
</string>
</value>
<value>
<string>
979.
63531.55269.925
0
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
157
1065275.72
</float>
<float>
157
4423791.17
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
View file @
fe5b49f4
...
...
@@ -27,6 +27,8 @@
jio_document
,
portal_type
,
parent_portal_type
,
default_view
,
app_action_list
,
form_definition
,
current_version
,
index
;
...
...
@@ -36,10 +38,14 @@
current_version
=
current_version
.
substr
(
index
);
return
gadget
.
getSettingList
([
"
migration_version
"
,
"
app_view_reference
"
,
"
parent_portal_type
"
])
"
parent_portal_type
"
,
'
default_view_reference
'
,
'
app_actions
'
])
.
push
(
function
(
setting_list
)
{
app_view
=
options
.
action
||
setting_list
[
1
];
parent_portal_type
=
setting_list
[
2
];
default_view
=
setting_list
[
3
];
app_action_list
=
setting_list
[
4
];
if
(
setting_list
[
0
]
!==
current_version
)
{
//if app version has changed, force storage selection
return
gadget
.
redirect
({
...
...
@@ -82,8 +88,9 @@
})
.
push
(
function
(
result
)
{
form_definition
=
result
;
return
gadget_util
.
getViewAndActionDict
(
portal_type
,
options
.
jio_key
);
return
gadget_util
.
getViewAndActionDict
(
portal_type
,
app_view
,
default_view
,
app_action_list
,
options
.
jio_key
);
})
.
push
(
function
(
view_action_dict
)
{
return
gadget
.
changeState
({
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.xml
View file @
fe5b49f4
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
979.
53364.49548.7526
</string>
</value>
<value>
<string>
979.
63498.47896.7901
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
157
3813846.58
</float>
<float>
157
4423725.43
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
View file @
fe5b49f4
...
...
@@ -75,6 +75,7 @@
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSettingList
"
,
"
getSettingList
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
@@ -83,7 +84,8 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
portal_type
,
document_title
;
document_title
,
gadget_utils
;
return
gadget
.
jio_get
(
options
.
jio_key
)
.
push
(
function
(
document
)
{
document_title
=
document
.
title
;
...
...
@@ -96,11 +98,17 @@
portal_type
=
result
;
return
gadget
.
declareGadget
(
"
gadget_officejs_common_util.html
"
);
})
.
push
(
function
(
gadget_utils
)
{
.
push
(
function
(
result
)
{
gadget_utils
=
result
;
return
gadget
.
getSettingList
([
'
app_view_reference
'
,
'
default_view_reference
'
,
'
app_actions
'
]);
})
.
push
(
function
(
setting_list
)
{
// TODO views are also listed here
// should views be handled in another gadget like "..tab_office.js" ?
return
gadget_utils
.
getViewAndActionDict
(
portal_type
,
options
.
jio_key
);
return
gadget_utils
.
getViewAndActionDict
(
portal_type
,
setting_list
[
0
],
setting_list
[
1
],
setting_list
[
2
],
options
.
jio_key
);
})
.
push
(
function
(
action_info_dict
)
{
return
RSVP
.
all
([
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.xml
View file @
fe5b49f4
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
6.41484.14260.5085
</string>
</value>
<value>
<string>
97
9.63524.32203.29269
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
15
61477231.0
</float>
<float>
15
74423701.42
</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