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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
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 @@
...
@@ -128,70 +128,57 @@
// declared methods
// 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
,
var
gadget
=
this
,
action_info_dict
=
{
view_list
:
{},
action_list
:
{}},
action_info_dict
=
{
view_list
:
{},
action_list
:
{}},
query
=
buildSearchQuery
(
portal_type
),
query
=
buildSearchQuery
(
portal_type
),
app_actions
,
app_actions
,
app_view
,
app_actions_result
=
formatSettingList
(
app_actions_string
,
portal_type
);
default_view
;
app_actions
=
app_actions_result
.
map
(
function
(
pair
)
{
return
gadget
.
getSettingList
([
'
app_view_reference
'
,
return
pair
[
1
];
'
default_view_reference
'
,
});
'
app_actions
'
])
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
result_list
)
{
.
push
(
function
(
action_list
)
{
app_view
=
result_list
[
0
];
var
path_for_jio_get_list
=
[],
row
;
default_view
=
result_list
[
1
];
for
(
row
in
action_list
.
data
.
rows
)
{
return
formatSettingList
(
result_list
[
2
],
portal_type
);
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
)
{
.
push
(
function
(
action_document_list
)
{
app_actions
=
app_actions_result
.
map
(
function
(
pair
)
{
var
action_key
,
action_doc
,
action_settings
;
return
pair
[
1
];
for
(
action_key
in
action_document_list
)
{
});
if
(
action_document_list
.
hasOwnProperty
(
action_key
))
{
return
gadget
.
jio_allDocs
({
query
:
query
})
action_doc
=
action_document_list
[
action_key
];
.
push
(
function
(
action_list
)
{
if
(
app_actions
.
includes
(
action_doc
.
reference
))
{
var
path_for_jio_get_list
=
[],
row
;
action_settings
=
{
for
(
row
in
action_list
.
data
.
rows
)
{
page
:
undefined
,
if
(
action_list
.
data
.
rows
.
hasOwnProperty
(
row
))
{
jio_key
:
jio_key
,
path_for_jio_get_list
.
push
(
gadget
.
jio_get
(
action_list
title
:
action_doc
.
title
,
.
data
.
rows
[
row
]
action
:
action_doc
.
reference
,
.
id
));
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
)
{
action_info_dict
.
view_list
=
var
action_key
,
action_doc
,
action_settings
;
filterViewList
(
action_info_dict
.
view_list
,
app_view
,
default_view
);
for
(
action_key
in
action_document_list
)
{
return
action_info_dict
;
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
;
});
});
});
})
})
...
@@ -234,13 +221,22 @@
...
@@ -234,13 +221,22 @@
form_definition
,
form_definition
,
portal_skin_folder
,
portal_skin_folder
,
app_allowed_sub_types
,
app_allowed_sub_types
,
app_view
,
default_view
,
app_actions_string
,
form_info
,
form_info
,
error
;
error
;
return
gadget
.
getSettingList
([
portal_type_dict_setting
,
return
gadget
.
getSettingList
([
portal_type_dict_setting
,
'
portal_skin_folder
'
,
'
portal_skin_folder
'
,
'
app_allowed_sub_types
'
])
'
app_allowed_sub_types
'
,
'
app_view_reference
'
,
'
default_view_reference
'
,
'
app_actions
'
])
.
push
(
function
(
result_list
)
{
.
push
(
function
(
result_list
)
{
app_allowed_sub_types
=
result_list
[
2
];
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
])
{
if
(
!
result_list
[
1
])
{
throw
new
Error
(
"
Missing site configuration 'portal_skin_folder'
"
);
throw
new
Error
(
"
Missing site configuration 'portal_skin_folder'
"
);
}
}
...
@@ -312,7 +308,8 @@
...
@@ -312,7 +308,8 @@
.
new_content_dialog_form
;
.
new_content_dialog_form
;
form_definition
.
new_content_category
=
portal_type_dict
form_definition
.
new_content_category
=
portal_type_dict
.
new_content_category
;
.
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
)
{
.
push
(
function
(
action_view_dict
)
{
form_definition
.
portal_type_dict
.
has_more_views
=
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 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
157
1065275.72
</float>
<float>
157
4423791.17
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
View file @
fe5b49f4
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
jio_document
,
jio_document
,
portal_type
,
portal_type
,
parent_portal_type
,
parent_portal_type
,
default_view
,
app_action_list
,
form_definition
,
form_definition
,
current_version
,
current_version
,
index
;
index
;
...
@@ -36,10 +38,14 @@
...
@@ -36,10 +38,14 @@
current_version
=
current_version
.
substr
(
index
);
current_version
=
current_version
.
substr
(
index
);
return
gadget
.
getSettingList
([
"
migration_version
"
,
return
gadget
.
getSettingList
([
"
migration_version
"
,
"
app_view_reference
"
,
"
app_view_reference
"
,
"
parent_portal_type
"
])
"
parent_portal_type
"
,
'
default_view_reference
'
,
'
app_actions
'
])
.
push
(
function
(
setting_list
)
{
.
push
(
function
(
setting_list
)
{
app_view
=
options
.
action
||
setting_list
[
1
];
app_view
=
options
.
action
||
setting_list
[
1
];
parent_portal_type
=
setting_list
[
2
];
parent_portal_type
=
setting_list
[
2
];
default_view
=
setting_list
[
3
];
app_action_list
=
setting_list
[
4
];
if
(
setting_list
[
0
]
!==
current_version
)
{
if
(
setting_list
[
0
]
!==
current_version
)
{
//if app version has changed, force storage selection
//if app version has changed, force storage selection
return
gadget
.
redirect
({
return
gadget
.
redirect
({
...
@@ -82,8 +88,9 @@
...
@@ -82,8 +88,9 @@
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
form_definition
=
result
;
form_definition
=
result
;
return
gadget_util
.
getViewAndActionDict
(
portal_type
,
return
gadget_util
.
getViewAndActionDict
(
portal_type
,
app_view
,
options
.
jio_key
);
default_view
,
app_action_list
,
options
.
jio_key
);
})
})
.
push
(
function
(
view_action_dict
)
{
.
push
(
function
(
view_action_dict
)
{
return
gadget
.
changeState
({
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 @@
...
@@ -228,7 +228,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
979.
53364.49548.7526
</string>
</value>
<value>
<string>
979.
63498.47896.7901
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
157
3813846.58
</float>
<float>
157
4423725.43
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
View file @
fe5b49f4
...
@@ -75,6 +75,7 @@
...
@@ -75,6 +75,7 @@
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSettingList
"
,
"
getSettingList
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
...
@@ -83,7 +84,8 @@
...
@@ -83,7 +84,8 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
var
gadget
=
this
,
portal_type
,
portal_type
,
document_title
;
document_title
,
gadget_utils
;
return
gadget
.
jio_get
(
options
.
jio_key
)
return
gadget
.
jio_get
(
options
.
jio_key
)
.
push
(
function
(
document
)
{
.
push
(
function
(
document
)
{
document_title
=
document
.
title
;
document_title
=
document
.
title
;
...
@@ -96,11 +98,17 @@
...
@@ -96,11 +98,17 @@
portal_type
=
result
;
portal_type
=
result
;
return
gadget
.
declareGadget
(
"
gadget_officejs_common_util.html
"
);
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
// TODO views are also listed here
// should views be handled in another gadget like "..tab_office.js" ?
// should views be handled in another gadget like "..tab_office.js" ?
return
gadget_utils
.
getViewAndActionDict
(
portal_type
,
return
gadget_utils
.
getViewAndActionDict
(
portal_type
,
setting_list
[
0
],
options
.
jio_key
);
setting_list
[
1
],
setting_list
[
2
],
options
.
jio_key
);
})
})
.
push
(
function
(
action_info_dict
)
{
.
push
(
function
(
action_info_dict
)
{
return
RSVP
.
all
([
return
RSVP
.
all
([
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.xml
View file @
fe5b49f4
...
@@ -228,7 +228,7 @@
...
@@ -228,7 +228,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
61477231.0
</float>
<float>
15
74423701.42
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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