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
Labels
Merge Requests
139
Merge Requests
139
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
783a5a4a
Commit
783a5a4a
authored
Jun 18, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: refactoring; using new layout configuration fields
parent
4a5cd2a1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
73 deletions
+98
-73
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
...teItem/web_page_module/gadget_officejs_common_utils_js.js
+43
-23
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
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
...eb_page_module/gadget_officejs_page_action_officejs_js.js
+51
-46
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_utils_js.js
View file @
783a5a4a
/*global window, rJS, Query, SimpleQuery, ComplexQuery */
/*global window, rJS, Query, SimpleQuery, ComplexQuery
, console
*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
Query
,
SimpleQuery
,
ComplexQuery
)
{
(
function
(
window
,
rJS
,
Query
,
SimpleQuery
,
ComplexQuery
,
console
)
{
"
use strict
"
;
// TODO: check if there are other categories that are 'views' and find a less hardcoded way to get this
...
...
@@ -51,7 +51,7 @@
return
[
form_type
,
child_gadget_url
];
})
.
declareMethod
(
"
check
More
Actions
"
,
function
(
portal_type
,
action_category
)
{
.
declareMethod
(
"
check
ViewsAnd
Actions
"
,
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
:
{}},
...
...
@@ -89,19 +89,44 @@
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
)
{
var
gadget
=
this
,
all_allowed_sub_types_list
=
[],
allowed_sub_types_list
=
[],
i
=
0
,
query
,
action_type
,
action_title
,
form_definition
,
query_type
,
query_parent
,
query_reference
,
pair
;
query_reference
;
query_reference
=
new
SimpleQuery
({
key
:
"
reference
"
,
operator
:
""
,
...
...
@@ -143,20 +168,15 @@
form_definition
.
title
=
action_title
;
return
gadget
.
getSetting
(
"
app_allowed_sub_types
"
);
})
.
push
(
function
(
allowed_sub_types
)
{
allowed_sub_types
=
allowed_sub_types
.
replace
(
/
\(
/g
,
'
[
'
)
.
replace
(
/
\)
/g
,
'
]
'
)
.
replace
(
/,
\]
/g
,
'
]
'
)
.
replace
(
/
\'
/g
,
'
"
'
);
all_allowed_sub_types_list
=
JSON
.
parse
(
allowed_sub_types
);
for
(
i
=
0
;
i
<
all_allowed_sub_types_list
.
length
;
i
++
)
{
pair
=
all_allowed_sub_types_list
[
i
].
split
(
"
|
"
);
if
(
pair
[
0
]
===
portal_type
)
{
allowed_sub_types_list
.
push
(
pair
[
1
]);
}
}
form_definition
.
allowed_sub_types_list
=
allowed_sub_types_list
;
return
gadget
.
checkMoreActions
(
portal_type
,
action_type
);
.
push
(
function
(
allowed_sub_types_setting
)
{
return
gadget
.
formatSettingList
(
allowed_sub_types_setting
,
portal_type
);
})
.
push
(
function
(
allowed_sub_types_pairs
)
{
var
allowed_sub_types
=
allowed_sub_types_pairs
.
map
(
function
(
pair
)
{
return
pair
[
1
];
});
form_definition
.
allowed_sub_types_list
=
allowed_sub_types
;
return
gadget
.
checkViewsAndActions
(
portal_type
,
action_type
);
})
.
push
(
function
(
has_more_dict
)
{
//view and actions are managed by same actions-gadget-page
...
...
@@ -166,4 +186,4 @@
});
});
}(
window
,
rJS
,
Query
,
SimpleQuery
,
ComplexQuery
));
}(
window
,
rJS
,
Query
,
SimpleQuery
,
ComplexQuery
,
console
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.xml
View file @
783a5a4a
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
976.
29977.52189.65245
</string>
</value>
<value>
<string>
976.
31037.9424.21862
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
1560
786832.33
</float>
<float>
1560
850400.9
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
View file @
783a5a4a
...
...
@@ -84,11 +84,25 @@
});
})
.
declareMethod
(
"
getAllActions
"
,
function
(
portal_type
,
options
)
{
.
declareMethod
(
"
getAll
ViewsAnd
Actions
"
,
function
(
portal_type
,
options
)
{
//TODO for now this takes also views. Views should be handle in another gadget like "..tab_office.js"
var
gadget
=
this
,
action_info_dict
=
{
views
:
{},
actions
:
{}},
query
=
'
portal_type: "Action Information" AND parent_relative_url: "portal_types/
'
+
portal_type
+
'
"
'
;
//TODO use Query to avoid strings
query
=
'
portal_type: "Action Information" AND parent_relative_url: "portal_types/
'
+
portal_type
+
'
"
'
,
app_actions
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
declareGadget
(
"
gadget_officejs_common_utils.html
"
),
gadget
.
getSetting
(
'
default_view_reference
'
)
]);
})
.
push
(
function
(
result_list
)
{
return
result_list
[
0
].
getAppActions
(
portal_type
);
})
.
push
(
function
(
app_actions_result
)
{
app_actions
=
app_actions_result
;
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
action_list
)
{
var
path_for_jio_get_list
=
[],
row
;
...
...
@@ -106,36 +120,27 @@
//there must be one "View" action. If not, use default view (like jio_view in getsettings)
if
(
action_document_list
.
hasOwnProperty
(
action_key
))
{
action_doc
=
action_document_list
[
action_key
];
page
=
"
handle_action
"
;
if
(
view_categories
.
includes
(
action_doc
.
action_type
))
{
page
=
"
ojs_local_controller
"
;
}
action_settings_list
.
push
({
page
:
page
,
action_settings
=
{
page
:
undefined
,
jio_key
:
options
.
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
});
}
}
for
(
key
in
action_settings_list
)
{
if
(
action_settings_list
.
hasOwnProperty
(
key
))
{
action_settings
=
action_settings_list
[
key
];
};
if
(
view_categories
.
includes
(
action_settings
.
action_type
))
{
action_settings
.
page
=
"
ojs_local_controller
"
;
action_info_dict
.
views
[
action_settings
.
action
]
=
action_settings
;
}
else
{
action_settings
.
page
=
"
handle_action
"
;
action_info_dict
.
actions
[
action_settings
.
action
]
=
action_settings
;
}
}
}
if
(
action_info_dict
.
views
.
hasOwnProperty
(
"
view
"
)
&&
action_info_dict
.
views
.
hasOwnProperty
(
"
jio_view
"
))
{
delete
action_info_dict
.
views
.
view
;
}
return
action_info_dict
;
});
});
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
...
...
@@ -150,7 +155,7 @@
return
options
.
portal_type
;
})
.
push
(
function
(
portal_type
)
{
return
gadget
.
getAllActions
(
portal_type
,
options
);
return
gadget
.
getAll
ViewsAnd
Actions
(
portal_type
,
options
);
})
.
push
(
function
(
action_info_dict
)
{
return
RSVP
.
all
([
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.xml
View file @
783a5a4a
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
976.
29913.52.476
1
</string>
</value>
<value>
<string>
976.
31000.44303.959
1
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
1560
785127.88
</float>
<float>
1560
848207.92
</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