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
f97a7d4b
Commit
f97a7d4b
authored
Jun 19, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: form definitions indicate header links based on portal_type views and actions
parent
51333e0a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
78 deletions
+53
-78
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
...teItem/web_page_module/gadget_officejs_common_utils_js.js
+51
-76
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.xml
...eItem/web_page_module/gadget_officejs_common_utils_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
View file @
f97a7d4b
...
@@ -50,11 +50,55 @@
...
@@ -50,11 +50,55 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
formatSettingList
"
,
function
(
configuration_list_string
,
portal_type
)
{
var
i
=
0
,
formatted_list
=
[],
configuration_list
,
pair
;
try
{
configuration_list_string
=
configuration_list_string
.
replace
(
/
\(
/g
,
'
[
'
)
.
replace
(
/
\)
/g
,
'
]
'
)
.
replace
(
/,
\]
/g
,
'
]
'
)
.
replace
(
/
\'
/g
,
'
"
'
);
configuration_list
=
JSON
.
parse
(
configuration_list_string
);
for
(
i
=
0
;
i
<
configuration_list
.
length
;
i
+=
1
)
{
pair
=
configuration_list
[
i
].
split
(
"
|
"
);
if
(
!
portal_type
||
pair
[
0
]
===
portal_type
)
{
formatted_list
.
push
(
pair
);
}
}
}
catch
(
e
)
{
console
.
log
(
"
Error while parsing configuration settings. Format error maybe?
"
);
console
.
log
(
e
);
}
return
formatted_list
;
})
.
declareMethod
(
"
getAppActions
"
,
function
(
portal_type
)
{
var
gadget
=
this
;
return
gadget
.
getSetting
(
'
app_actions
'
)
.
push
(
function
(
app_actions_setting
)
{
return
gadget
.
formatSettingList
(
app_actions_setting
,
portal_type
);
});
})
.
declareMethod
(
"
getAllViewsAndActions
"
,
function
(
portal_type
,
jio_key
)
{
.
declareMethod
(
"
getAllViewsAndActions
"
,
function
(
portal_type
,
jio_key
)
{
var
gadget
=
this
,
var
gadget
=
this
,
action_info_dict
=
{
views
:
{},
actions
:
{}},
action_info_dict
=
{
views
:
{},
actions
:
{}},
//TODO use Query to avoid strings
query_type
=
new
SimpleQuery
({
query
=
'
portal_type: "Action Information" AND parent_relative_url: "portal_types/
'
+
portal_type
+
'
"
'
,
key
:
"
portal_type
"
,
operator
:
""
,
type
:
"
simple
"
,
value
:
"
Action Information
"
}),
query_parent
=
new
SimpleQuery
({
key
:
"
parent_relative_url
"
,
operator
:
""
,
type
:
"
simple
"
,
value
:
"
portal_types/
"
+
portal_type
}),
query
=
Query
.
objectToSearchText
(
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
[
query_type
,
query_parent
],
type
:
"
complex
"
})),
app_actions
,
app_actions
,
app_view
,
app_view
,
default_view
;
default_view
;
...
@@ -85,7 +129,7 @@
...
@@ -85,7 +129,7 @@
return
RSVP
.
all
(
path_for_jio_get_list
);
return
RSVP
.
all
(
path_for_jio_get_list
);
})
})
.
push
(
function
(
action_document_list
)
{
.
push
(
function
(
action_document_list
)
{
var
page
,
action_key
,
action_doc
,
key
,
action_settings
;
var
action_key
,
action_doc
,
action_settings
;
for
(
action_key
in
action_document_list
)
{
for
(
action_key
in
action_document_list
)
{
if
(
action_document_list
.
hasOwnProperty
(
action_key
))
{
if
(
action_document_list
.
hasOwnProperty
(
action_key
))
{
action_doc
=
action_document_list
[
action_key
];
action_doc
=
action_document_list
[
action_key
];
...
@@ -139,73 +183,6 @@
...
@@ -139,73 +183,6 @@
return
[
form_type
,
child_gadget_url
];
return
[
form_type
,
child_gadget_url
];
})
})
.
declareMethod
(
"
checkViewsAndActions
"
,
function
(
portal_type
,
action_category
)
{
var
gadget
=
this
,
//for now, views and actions are handle together via handle_action gadget
has_more_dict
=
{
views
:
{},
actions
:
{}},
query
,
query_type
,
query_parent
;
// get all actions/views for the portal_type, if target action is a type of view
// (exclude custom scripts and dialogs)
if
(
view_categories
.
includes
(
action_category
))
{
query_type
=
new
SimpleQuery
({
key
:
"
portal_type
"
,
operator
:
""
,
type
:
"
simple
"
,
value
:
"
Action Information
"
});
query_parent
=
new
SimpleQuery
({
key
:
"
parent_relative_url
"
,
operator
:
""
,
type
:
"
simple
"
,
value
:
"
portal_types/
"
+
portal_type
});
query
=
Query
.
objectToSearchText
(
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
[
query_type
,
query_parent
],
type
:
"
complex
"
}));
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
action_list
)
{
if
(
action_list
.
data
.
rows
.
length
>
0
)
{
has_more_dict
.
has_more_actions
=
true
;
}
return
has_more_dict
;
});
}
return
has_more_dict
;
})
.
declareMethod
(
"
formatSettingList
"
,
function
(
configuration_list_string
,
portal_type
)
{
var
i
=
0
,
formatted_list
=
[],
configuration_list
,
pair
;
try
{
configuration_list_string
=
configuration_list_string
.
replace
(
/
\(
/g
,
'
[
'
)
.
replace
(
/
\)
/g
,
'
]
'
)
.
replace
(
/,
\]
/g
,
'
]
'
)
.
replace
(
/
\'
/g
,
'
"
'
);
configuration_list
=
JSON
.
parse
(
configuration_list_string
);
for
(
i
=
0
;
i
<
configuration_list
.
length
;
i
+=
1
)
{
pair
=
configuration_list
[
i
].
split
(
"
|
"
);
if
(
!
portal_type
||
pair
[
0
]
===
portal_type
)
{
formatted_list
.
push
(
pair
);
}
}
}
catch
(
e
)
{
console
.
log
(
"
Error while parsing configuration settings. Format error maybe?
"
);
console
.
log
(
e
);
}
return
formatted_list
;
})
.
declareMethod
(
"
getAppActions
"
,
function
(
portal_type
)
{
var
gadget
=
this
;
return
gadget
.
getSetting
(
'
app_actions
'
)
.
push
(
function
(
app_actions_setting
)
{
return
gadget
.
formatSettingList
(
app_actions_setting
,
portal_type
);
});
})
.
declareMethod
(
"
getFormDefinition
"
,
function
(
portal_type
,
action_reference
)
{
.
declareMethod
(
"
getFormDefinition
"
,
function
(
portal_type
,
action_reference
)
{
var
gadget
=
this
,
var
gadget
=
this
,
query
,
query
,
...
@@ -264,13 +241,11 @@
...
@@ -264,13 +241,11 @@
return
pair
[
1
];
return
pair
[
1
];
});
});
form_definition
.
allowed_sub_types_list
=
allowed_sub_types
;
form_definition
.
allowed_sub_types_list
=
allowed_sub_types
;
//TODO get rid of checkViewsAndActions and use getAllViewsAndActions result instead
return
gadget
.
getAllViewsAndActions
(
portal_type
);
return
gadget
.
checkViewsAndActions
(
portal_type
,
action_type
);
})
})
.
push
(
function
(
has_more_dict
)
{
.
push
(
function
(
actions_views_dict
)
{
//view and actions are managed by same actions-gadget-page
form_definition
.
has_more_views
=
Object
.
keys
(
actions_views_dict
.
views
).
length
>
1
;
form_definition
.
has_more_views
=
false
;
form_definition
.
has_more_actions
=
Object
.
keys
(
actions_views_dict
.
actions
).
length
>
0
;
form_definition
.
has_more_actions
=
has_more_dict
.
has_more_actions
;
return
form_definition
;
return
form_definition
;
});
});
});
});
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.xml
View file @
f97a7d4b
...
@@ -269,7 +269,7 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
976.32
545.23324.47257
</string>
</value>
<value>
<string>
976.32
757.54510.63163
</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>
15609
44910.22
</float>
<float>
15609
53642.79
</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