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
7de5f254
Commit
7de5f254
authored
Jul 22, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: review
parent
2863a960
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
152 additions
and
144 deletions
+152
-144
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
...teItem/web_page_module/gadget_officejs_common_utils_js.js
+88
-99
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
...le/gadget_officejs_controller_page_local_controller_js.js
+0
-7
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
...plateItem/web_page_module/gadget_officejs_form_view_js.js
+51
-29
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
...eb_page_module/gadget_officejs_page_action_officejs_js.js
+3
-6
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_create_document_js.js
...eb_page_module/gadget_officejs_page_create_document_js.js
+7
-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
+0
-1
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_text_editor_router_html.html
..._page_module/gadget_officejs_text_editor_router_html.html
+3
-0
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
View file @
7de5f254
...
@@ -4,9 +4,9 @@
...
@@ -4,9 +4,9 @@
"
use strict
"
;
"
use strict
"
;
// TODO: check if there are other categories that are 'views' and find a less hardcoded way to get this
// TODO: check if there are other categories that are 'views' and find a less hardcoded way to get this
var
view_categorie
s
=
[
"
object_view
"
,
"
object_jio_view
"
,
"
object_web_view
"
,
"
object_list
"
];
var
view_categorie
_list
=
[
"
object_view
"
,
"
object_jio_view
"
,
"
object_web_view
"
,
"
object_list
"
];
function
filterView
s
(
views_dict
,
app_view
,
default_view
)
{
function
filterView
List
(
views_dict
,
app_view
,
default_view
)
{
// there must be only one "View" action (title = "View")
// there must be only one "View" action (title = "View")
// this is for scenarios were the portal type has several "View" (like view, jio_view, custom_view)
// this is for scenarios were the portal type has several "View" (like view, jio_view, custom_view)
// priority: app_view ; default_view ; other
// priority: app_view ; default_view ; other
...
@@ -29,76 +29,81 @@
...
@@ -29,76 +29,81 @@
return
views_dict
;
return
views_dict
;
}
}
function
formatSettingList
(
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
(
pair
.
length
!==
2
)
{
throw
new
SyntaxError
();
}
if
(
!
portal_type
||
pair
[
0
]
===
portal_type
)
{
formatted_list
.
push
(
pair
);
}
}
}
catch
(
e
)
{
if
(
e
instanceof
SyntaxError
)
{
console
.
log
(
"
Error while parsing configuration settings. Format error maybe?
"
);
console
.
log
(
"
Please check site configuration 'app_allowed_sub_types'
"
);
console
.
log
(
e
);
formatted_list
=
[];
}
else
{
throw
e
;
}
}
return
formatted_list
;
}
function
buildSearchQuery
(
portal_type
,
action_reference
)
{
var
query_list
=
[];
query_list
.
push
(
new
SimpleQuery
({
key
:
"
portal_type
"
,
operator
:
""
,
type
:
"
simple
"
,
value
:
"
Action Information
"
}));
query_list
.
push
(
new
SimpleQuery
({
key
:
"
parent_relative_url
"
,
operator
:
""
,
type
:
"
simple
"
,
value
:
"
portal_types/
"
+
portal_type
}));
if
(
action_reference
)
{
query_list
.
push
(
new
SimpleQuery
({
key
:
"
reference
"
,
operator
:
""
,
type
:
"
simple
"
,
value
:
action_reference
}));
}
return
Query
.
objectToSearchText
(
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
query_list
,
type
:
"
complex
"
}));
}
rJS
(
window
)
rJS
(
window
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
isDesktopMedia
"
,
"
isDesktopMedia
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
formatSettingList
"
,
function
(
configuration_list_string
,
portal_type
)
{
.
declareMethod
(
"
getViewAndActionDict
"
,
function
(
portal_type
,
jio_key
)
{
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
)
{
var
gadget
=
this
,
var
gadget
=
this
,
action_info_dict
=
{
views
:
{},
actions
:
{}},
action_info_dict
=
{
view_list
:
{},
action_list
:
{}},
query_type
=
new
SimpleQuery
({
query
=
buildSearchQuery
(
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
;
...
@@ -106,13 +111,14 @@
...
@@ -106,13 +111,14 @@
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getSetting
(
'
app_view_reference
'
),
gadget
.
getSetting
(
'
app_view_reference
'
),
gadget
.
getSetting
(
'
default_view_reference
'
)
gadget
.
getSetting
(
'
default_view_reference
'
),
gadget
.
getSetting
(
'
app_actions
'
)
]);
]);
})
})
.
push
(
function
(
result_list
)
{
.
push
(
function
(
result_list
)
{
app_view
=
result_list
[
0
];
app_view
=
result_list
[
0
];
default_view
=
result_list
[
1
];
default_view
=
result_list
[
1
];
return
gadget
.
getAppActions
(
portal_type
);
return
formatSettingList
(
result_list
[
2
],
portal_type
);
})
})
.
push
(
function
(
app_actions_result
)
{
.
push
(
function
(
app_actions_result
)
{
app_actions
=
app_actions_result
.
map
(
function
(
pair
)
{
app_actions
=
app_actions_result
.
map
(
function
(
pair
)
{
...
@@ -143,17 +149,17 @@
...
@@ -143,17 +149,17 @@
action_type
:
action_doc
.
action_type
,
action_type
:
action_doc
.
action_type
,
parent_portal_type
:
portal_type
parent_portal_type
:
portal_type
};
};
if
(
view_categorie
s
.
includes
(
action_settings
.
action_type
))
{
if
(
view_categorie
_list
.
includes
(
action_settings
.
action_type
))
{
action_settings
.
page
=
"
ojs_local_controller
"
;
action_settings
.
page
=
"
ojs_local_controller
"
;
action_info_dict
.
view
s
[
action_settings
.
action
]
=
action_settings
;
action_info_dict
.
view
_list
[
action_settings
.
action
]
=
action_settings
;
}
else
{
}
else
{
action_settings
.
page
=
"
handle_action
"
;
action_settings
.
page
=
"
handle_action
"
;
action_info_dict
.
action
s
[
action_settings
.
action
]
=
action_settings
;
action_info_dict
.
action
_list
[
action_settings
.
action
]
=
action_settings
;
}
}
}
}
}
}
}
}
action_info_dict
.
view
s
=
filterViews
(
action_info_dict
.
views
,
app_view
,
default_view
);
action_info_dict
.
view
_list
=
filterViewList
(
action_info_dict
.
view_list
,
app_view
,
default_view
);
return
action_info_dict
;
return
action_info_dict
;
});
});
});
});
...
@@ -185,38 +191,21 @@
...
@@ -185,38 +191,21 @@
.
declareMethod
(
"
getFormDefinition
"
,
function
(
portal_type
,
action_reference
)
{
.
declareMethod
(
"
getFormDefinition
"
,
function
(
portal_type
,
action_reference
)
{
var
gadget
=
this
,
var
gadget
=
this
,
query
,
query
=
buildSearchQuery
(
portal_type
,
action_reference
)
,
action_type
,
action_type
,
action_title
,
action_title
,
form_definition
,
form_definition
,
query_type
,
portal_skin_folder
,
query_parent
,
query_reference
,
error
;
error
;
query_reference
=
new
SimpleQuery
({
return
gadget
.
getSetting
(
"
portal_skin_folder
"
)
key
:
"
reference
"
,
.
push
(
function
(
result
)
{
operator
:
""
,
if
(
!
result
)
{
type
:
"
simple
"
,
throw
new
Error
(
"
Missing site configuration 'portal_skin_folder'
"
);
value
:
action_reference
}
});
result
=
"
portal_skins/
"
+
result
;
query_type
=
new
SimpleQuery
({
portal_skin_folder
=
result
;
key
:
"
portal_type
"
,
return
gadget
.
jio_allDocs
({
query
:
query
});
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
,
query_reference
],
type
:
"
complex
"
}));
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
data
)
{
.
push
(
function
(
data
)
{
if
(
data
.
data
.
rows
.
length
===
0
)
{
if
(
data
.
data
.
rows
.
length
===
0
)
{
error
=
new
Error
(
"
Can not find action '
"
+
action_reference
+
"
' for portal type '
"
+
portal_type
+
"
'
"
);
error
=
new
Error
(
"
Can not find action '
"
+
action_reference
+
"
' for portal type '
"
+
portal_type
+
"
'
"
);
...
@@ -229,7 +218,7 @@
...
@@ -229,7 +218,7 @@
action_title
=
action_result
.
title
;
action_title
=
action_result
.
title
;
action_type
=
action_result
.
action_type
;
action_type
=
action_result
.
action_type
;
if
(
action_result
.
action
.
includes
(
"
string:${object_url}
"
))
{
if
(
action_result
.
action
.
includes
(
"
string:${object_url}
"
))
{
action_result
.
action
=
action_result
.
action
.
replace
(
"
string:${object_url}
"
,
"
portal_skins/erp5_web_officejs_ui
"
);
action_result
.
action
=
action_result
.
action
.
replace
(
"
string:${object_url}
"
,
portal_skin_folder
);
}
}
return
gadget
.
jio_get
(
action_result
.
action
);
return
gadget
.
jio_get
(
action_result
.
action
);
})
})
...
@@ -250,18 +239,18 @@
...
@@ -250,18 +239,18 @@
return
gadget
.
getSetting
(
"
app_allowed_sub_types
"
);
return
gadget
.
getSetting
(
"
app_allowed_sub_types
"
);
})
})
.
push
(
function
(
allowed_sub_types_setting
)
{
.
push
(
function
(
allowed_sub_types_setting
)
{
return
gadget
.
formatSettingList
(
allowed_sub_types_setting
,
portal_type
);
return
formatSettingList
(
allowed_sub_types_setting
,
portal_type
);
})
})
.
push
(
function
(
allowed_sub_types_pairs
)
{
.
push
(
function
(
allowed_sub_types_pairs
)
{
var
allowed_sub_types
=
allowed_sub_types_pairs
.
map
(
function
(
pair
)
{
var
allowed_sub_types
=
allowed_sub_types_pairs
.
map
(
function
(
pair
)
{
return
pair
[
1
];
return
pair
[
1
];
});
});
form_definition
.
allowed_sub_types_list
=
allowed_sub_types
;
form_definition
.
allowed_sub_types_list
=
allowed_sub_types
;
return
gadget
.
get
AllViewsAndActions
(
portal_type
);
return
gadget
.
get
ViewAndActionDict
(
portal_type
);
})
})
.
push
(
function
(
action
s_views
_dict
)
{
.
push
(
function
(
action
_view
_dict
)
{
form_definition
.
has_more_views
=
Object
.
keys
(
action
s_views_dict
.
views
).
length
>
1
;
form_definition
.
has_more_views
=
Object
.
keys
(
action
_view_dict
.
view_list
).
length
>
1
;
form_definition
.
has_more_actions
=
Object
.
keys
(
action
s_views_dict
.
actions
).
length
>
0
;
form_definition
.
has_more_actions
=
Object
.
keys
(
action
_view_dict
.
action_list
).
length
>
0
;
return
gadget
.
getSetting
(
'
hide_header_add_button
'
);
return
gadget
.
getSetting
(
'
hide_header_add_button
'
);
})
})
.
push
(
function
(
hide_add_button_setting
)
{
.
push
(
function
(
hide_add_button_setting
)
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
View file @
7de5f254
...
@@ -10,16 +10,9 @@
...
@@ -10,16 +10,9 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
isDesktopMedia
"
,
"
isDesktopMedia
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
'
getUrlParameter
'
,
'
getUrlParameter
'
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
View file @
7de5f254
/*global document, window, rJS, RSVP, ensureArray */
/*global document, window, rJS, RSVP, ensureArray */
/*jslint nomen: true, indent: 2, maxerr:
3
*/
/*jslint nomen: true, indent: 2, maxerr:
10, maxlen: 80
*/
(
function
(
document
,
window
,
rJS
,
RSVP
,
ensureArray
)
{
(
function
(
document
,
window
,
rJS
,
RSVP
,
ensureArray
)
{
"
use strict
"
;
"
use strict
"
;
function
renderField
(
field_id
,
field_definition
,
document
)
{
function
renderField
(
field_id
,
field_definition
,
context_
document
)
{
var
key
,
raw_value
,
override
,
final_value
,
item_list
,
result
=
{};
var
key
,
raw_value
,
override
,
final_value
,
item_list
,
result
=
{};
for
(
key
in
field_definition
.
values
)
{
for
(
key
in
field_definition
.
values
)
{
if
(
field_definition
.
values
.
hasOwnProperty
(
key
))
{
if
(
field_definition
.
values
.
hasOwnProperty
(
key
))
{
...
@@ -15,28 +15,31 @@
...
@@ -15,28 +15,31 @@
if
(
final_value
===
undefined
)
{
if
(
final_value
===
undefined
)
{
if
(
override
!==
undefined
&&
override
!==
null
&&
override
!==
''
)
{
if
(
override
!==
undefined
&&
override
!==
null
&&
override
!==
''
)
{
final_value
=
override
;
final_value
=
override
;
}
else
if
(
raw_value
!==
undefined
&&
raw_value
!==
null
&&
raw_value
!==
''
)
{
}
else
if
(
raw_value
!==
undefined
&&
raw_value
!==
null
&&
raw_value
!==
''
)
{
final_value
=
raw_value
;
final_value
=
raw_value
;
}
else
if
(
document
&&
document
.
hasOwnProperty
(
key
))
{
}
else
if
(
context_document
&&
context_
document
.
hasOwnProperty
(
key
))
{
final_value
=
document
[
key
];
final_value
=
context_
document
[
key
];
}
}
}
}
if
(
final_value
!==
undefined
&&
final_value
!==
null
&&
final_value
!==
''
)
{
if
(
final_value
!==
undefined
&&
final_value
!==
null
&&
final_value
!==
''
)
{
result
[
key
]
=
final_value
;
result
[
key
]
=
final_value
;
}
}
}
}
}
}
result
.
type
=
field_definition
.
type
;
result
.
type
=
field_definition
.
type
;
result
.
key
=
field_id
;
result
.
key
=
field_id
;
if
(
document
&&
document
.
hasOwnProperty
(
field_id
))
{
if
(
context_document
&&
context_
document
.
hasOwnProperty
(
field_id
))
{
if
(
field_definition
.
type
===
"
ListField
"
)
{
if
(
field_definition
.
type
===
"
ListField
"
)
{
item_list
=
ensureArray
(
document
[
field_id
]).
map
(
function
(
item
)
{
item_list
=
ensureArray
(
context_document
[
field_id
])
if
(
Array
.
isArray
(
item
))
{
return
item
;
}
.
map
(
function
(
item
)
{
return
[
item
,
item
];
if
(
Array
.
isArray
(
item
))
{
return
item
;
}
});
return
[
item
,
item
];
});
result
.
items
=
item_list
;
result
.
items
=
item_list
;
}
else
{
}
else
{
result
[
"
default
"
]
=
document
[
field_id
];
result
[
"
default
"
]
=
context_
document
[
field_id
];
}
}
}
}
return
result
;
return
result
;
...
@@ -50,14 +53,7 @@
...
@@ -50,14 +53,7 @@
.
declareAcquiredMethod
(
"
isDesktopMedia
"
,
"
isDesktopMedia
"
)
.
declareAcquiredMethod
(
"
isDesktopMedia
"
,
"
isDesktopMedia
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
// XXX Hardcoded for modification_date rendering
// XXX Hardcoded for modification_date rendering
.
allowPublicAcquisition
(
"
jio_allDocs
"
,
function
(
param_list
)
{
.
allowPublicAcquisition
(
"
jio_allDocs
"
,
function
(
param_list
)
{
...
@@ -100,7 +96,7 @@
...
@@ -100,7 +96,7 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
renderForm
"
,
function
(
form_definition
,
document
)
{
.
declareMethod
(
"
renderForm
"
,
function
(
form_definition
,
context_
document
)
{
var
i
,
j
,
fields
,
field_info
,
my_element
,
element_id
,
rendered_field
,
var
i
,
j
,
fields
,
field_info
,
my_element
,
element_id
,
rendered_field
,
raw_properties
=
form_definition
.
fields_raw_properties
,
raw_properties
=
form_definition
.
fields_raw_properties
,
form_json
=
{
form_json
=
{
...
@@ -123,12 +119,15 @@
...
@@ -123,12 +119,15 @@
}
}
if
(
element_id
&&
raw_properties
.
hasOwnProperty
(
my_element
))
{
if
(
element_id
&&
raw_properties
.
hasOwnProperty
(
my_element
))
{
field_info
=
raw_properties
[
my_element
];
field_info
=
raw_properties
[
my_element
];
rendered_field
=
renderField
(
element_id
,
field_info
,
document
);
rendered_field
=
renderField
(
element_id
,
field_info
,
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
rendered_field
;
context_document
);
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
rendered_field
;
}
}
}
}
}
}
form_json
.
erp5_document
.
_embedded
.
_view
.
_actions
=
form_definition
.
_actions
;
form_json
.
erp5_document
.
_embedded
.
_view
.
_actions
=
form_definition
.
_actions
;
form_json
.
erp5_document
.
_links
=
form_definition
.
_links
;
form_json
.
erp5_document
.
_links
=
form_definition
.
_links
;
return
form_json
;
return
form_json
;
})
})
...
@@ -141,20 +140,32 @@
...
@@ -141,20 +140,32 @@
})
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
state_dict
=
{
doc
:
options
.
doc
,
form_definition
:
options
.
form_definition
,
child_gadget_url
:
options
.
child_gadget_url
,
options
:
options
};
return
this
.
changeState
(
state_dict
);
})
.
onStateChange
(
function
onStateChange
()
{
var
fragment
=
document
.
createElement
(
'
div
'
),
var
fragment
=
document
.
createElement
(
'
div
'
),
gadget
=
this
,
gadget
=
this
,
form_json
;
form_json
;
return
gadget
.
renderForm
(
options
.
form_definition
,
options
.
doc
)
return
gadget
.
renderForm
(
gadget
.
state
.
form_definition
,
gadget
.
state
.
doc
)
.
push
(
function
(
json
)
{
.
push
(
function
(
json
)
{
form_json
=
json
;
form_json
=
json
;
while
(
gadget
.
element
.
firstChild
)
{
while
(
gadget
.
element
.
firstChild
)
{
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
}
}
gadget
.
element
.
appendChild
(
fragment
);
gadget
.
element
.
appendChild
(
fragment
);
return
gadget
.
declareGadget
(
options
.
child_gadget_url
,
{
element
:
fragment
,
scope
:
'
fg
'
});
return
gadget
.
declareGadget
(
gadget
.
state
.
child_gadget_url
,
{
element
:
fragment
,
scope
:
'
fg
'
});
})
})
.
push
(
function
(
form_gadget
)
{
.
push
(
function
(
form_gadget
)
{
return
gadget
.
renderSubGadget
(
options
,
form_gadget
,
form_json
);
return
gadget
.
renderSubGadget
(
gadget
.
state
.
options
,
form_gadget
,
form_json
);
});
});
})
})
...
@@ -175,7 +186,9 @@
...
@@ -175,7 +186,9 @@
.
push
(
function
()
{
.
push
(
function
()
{
var
url_for_parameter_list
=
[
var
url_for_parameter_list
=
[
{
command
:
'
change
'
,
options
:
{
page
:
"
tab
"
}},
{
command
:
'
change
'
,
options
:
{
page
:
"
tab
"
}},
{
command
:
'
change
'
,
options
:
{
page
:
"
action_officejs
"
,
jio_key
:
options
.
jio_key
,
portal_type
:
options
.
portal_type
}},
{
command
:
'
change
'
,
options
:
{
page
:
"
action_officejs
"
,
jio_key
:
options
.
jio_key
,
portal_type
:
options
.
portal_type
}},
{
command
:
'
history_previous
'
},
{
command
:
'
history_previous
'
},
{
command
:
'
selection_previous
'
},
{
command
:
'
selection_previous
'
},
{
command
:
'
selection_next
'
},
{
command
:
'
selection_next
'
},
...
@@ -189,7 +202,15 @@
...
@@ -189,7 +202,15 @@
if
(
form_json
.
form_definition
.
allowed_sub_types_list
&&
if
(
form_json
.
form_definition
.
allowed_sub_types_list
&&
form_json
.
form_definition
.
allowed_sub_types_list
.
length
>
0
&&
form_json
.
form_definition
.
allowed_sub_types_list
.
length
>
0
&&
!
form_json
.
form_definition
.
hide_add_button
)
{
!
form_json
.
form_definition
.
hide_add_button
)
{
url_for_parameter_list
.
push
({
command
:
'
change
'
,
options
:
{
page
:
"
create_document
"
,
jio_key
:
options
.
jio_key
,
portal_type
:
options
.
portal_type
,
allowed_sub_types_list
:
form_json
.
form_definition
.
allowed_sub_types_list
}});
url_for_parameter_list
.
push
({
command
:
'
change
'
,
options
:
{
page
:
"
create_document
"
,
jio_key
:
options
.
jio_key
,
portal_type
:
options
.
portal_type
,
allowed_sub_types_list
:
form_json
.
form_definition
.
allowed_sub_types_list
}});
add_url
=
true
;
add_url
=
true
;
}
}
return
RSVP
.
all
([
return
RSVP
.
all
([
...
@@ -236,7 +257,8 @@
...
@@ -236,7 +257,8 @@
header_dict
.
save_action
=
true
;
header_dict
.
save_action
=
true
;
}
}
}
}
if
(
options
.
form_definition
.
has_more_actions
||
options
.
form_definition
.
has_more_views
)
{
if
(
options
.
form_definition
.
has_more_actions
||
options
.
form_definition
.
has_more_views
)
{
header_dict
.
actions_url
=
url_list
[
1
];
header_dict
.
actions_url
=
url_list
[
1
];
}
}
if
(
add_url
)
{
if
(
add_url
)
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
View file @
7de5f254
...
@@ -41,13 +41,10 @@
...
@@ -41,13 +41,10 @@
// Acquired methods
// Acquired methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
...
@@ -101,12 +98,12 @@
...
@@ -101,12 +98,12 @@
.
push
(
function
(
gadget_utils
)
{
.
push
(
function
(
gadget_utils
)
{
// 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
.
get
AllViewsAndActions
(
portal_type
,
options
.
jio_key
);
return
gadget_utils
.
get
ViewAndActionDict
(
portal_type
,
options
.
jio_key
);
})
})
.
push
(
function
(
action_info_dict
)
{
.
push
(
function
(
action_info_dict
)
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getHTMLElementList
(
action_info_dict
.
view
s
),
gadget
.
getHTMLElementList
(
action_info_dict
.
view
_list
),
gadget
.
getHTMLElementList
(
action_info_dict
.
action
s
)
gadget
.
getHTMLElementList
(
action_info_dict
.
action
_list
)
]);
]);
})
})
// check other lists like clone or delete? NO. For now, they will be actions
// check other lists like clone or delete? NO. For now, they will be actions
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_create_document_js.js
View file @
7de5f254
...
@@ -58,8 +58,13 @@
...
@@ -58,8 +58,13 @@
})
})
.
push
(
function
(
portal_type_result
)
{
.
push
(
function
(
portal_type_result
)
{
portal_type
=
portal_type_result
;
portal_type
=
portal_type_result
;
// TODO: somehow (a generic action?) get the path string:${object_url}/Base_viewNewContentDialog
return
gadget
.
getSetting
(
"
new_content_action
"
);
return
gadget
.
jio_get
(
"
portal_skins/erp5_hal_json_style/Base_viewNewContentDialog
"
);
})
.
push
(
function
(
new_content_action
)
{
if
(
!
new_content_action
)
{
throw
new
Error
(
"
Missing site configuration 'new_content_action'
"
);
}
return
gadget
.
jio_get
(
new_content_action
);
})
})
.
push
(
function
(
form_result
)
{
.
push
(
function
(
form_result
)
{
form_definition
=
form_result
.
raw_dict
.
_embedded
.
_view
.
_embedded
.
form_definition
;
form_definition
=
form_result
.
raw_dict
.
_embedded
.
_view
.
_embedded
.
form_definition
;
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
View file @
7de5f254
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_text_editor_router_html.html
View file @
7de5f254
...
@@ -21,6 +21,9 @@
...
@@ -21,6 +21,9 @@
<script
data-renderjs-configuration=
"parent_relative_url"
type=
"text/x-renderjs-configuration"
>
web_page_module
</script>
<script
data-renderjs-configuration=
"parent_relative_url"
type=
"text/x-renderjs-configuration"
>
web_page_module
</script>
<script
data-renderjs-configuration=
"hide_listbox_buttons"
type=
"text/x-renderjs-configuration"
>
1
</script>
<script
data-renderjs-configuration=
"hide_listbox_buttons"
type=
"text/x-renderjs-configuration"
>
1
</script>
<script
data-renderjs-configuration=
"documents_editable"
type=
"text/x-renderjs-configuration"
>
1
</script>
<script
data-renderjs-configuration=
"documents_editable"
type=
"text/x-renderjs-configuration"
>
1
</script>
<script
data-renderjs-configuration=
"portal_skin_folder"
type=
"text/x-renderjs-configuration"
>
erp5_web_officejs_ui
</script>
<!-- TODO: somehow (a generic action?) get the path string:${object_url}/Base_viewNewContentDialog. For now it's in new_content_action -->
<script
data-renderjs-configuration=
"new_content_action"
type=
"text/x-renderjs-configuration"
>
portal_skins
/
erp5_hal_json_style
/
Base_viewNewContentDialog
</script>
<script
data-renderjs-configuration=
"erp5_attachment_synchro"
type=
"text/x-renderjs-configuration"
></script>
<script
data-renderjs-configuration=
"erp5_attachment_synchro"
type=
"text/x-renderjs-configuration"
></script>
<script
data-renderjs-configuration=
"dropbox_app_key"
type=
"text/x-renderjs-configuration"
>
n692ixxhyg9zhqs
</script>
<script
data-renderjs-configuration=
"dropbox_app_key"
type=
"text/x-renderjs-configuration"
>
n692ixxhyg9zhqs
</script>
<div
data-gadget-url=
"gadget_erp5_router.html"
data-gadget-scope=
"erp5_router"
></div>
<div
data-gadget-url=
"gadget_erp5_router.html"
data-gadget-scope=
"erp5_router"
></div>
...
...
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