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
Expand all
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
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
View file @
7de5f254
...
...
@@ -10,16 +10,9 @@
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
isDesktopMedia
"
,
"
isDesktopMedia
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
'
getUrlParameter
'
,
'
getUrlParameter
'
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
View file @
7de5f254
/*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
)
{
"
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
=
{};
for
(
key
in
field_definition
.
values
)
{
if
(
field_definition
.
values
.
hasOwnProperty
(
key
))
{
...
...
@@ -15,28 +15,31 @@
if
(
final_value
===
undefined
)
{
if
(
override
!==
undefined
&&
override
!==
null
&&
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
;
}
else
if
(
document
&&
document
.
hasOwnProperty
(
key
))
{
final_value
=
document
[
key
];
}
else
if
(
context_document
&&
context_
document
.
hasOwnProperty
(
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
.
type
=
field_definition
.
type
;
result
.
key
=
field_id
;
if
(
document
&&
document
.
hasOwnProperty
(
field_id
))
{
if
(
context_document
&&
context_
document
.
hasOwnProperty
(
field_id
))
{
if
(
field_definition
.
type
===
"
ListField
"
)
{
item_list
=
ensureArray
(
document
[
field_id
]).
map
(
function
(
item
)
{
if
(
Array
.
isArray
(
item
))
{
return
item
;
}
return
[
item
,
item
];
});
item_list
=
ensureArray
(
context_document
[
field_id
])
.
map
(
function
(
item
)
{
if
(
Array
.
isArray
(
item
))
{
return
item
;
}
return
[
item
,
item
];
});
result
.
items
=
item_list
;
}
else
{
result
[
"
default
"
]
=
document
[
field_id
];
result
[
"
default
"
]
=
context_
document
[
field_id
];
}
}
return
result
;
...
...
@@ -50,14 +53,7 @@
.
declareAcquiredMethod
(
"
isDesktopMedia
"
,
"
isDesktopMedia
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
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
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
// XXX Hardcoded for modification_date rendering
.
allowPublicAcquisition
(
"
jio_allDocs
"
,
function
(
param_list
)
{
...
...
@@ -100,7 +96,7 @@
// 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
,
raw_properties
=
form_definition
.
fields_raw_properties
,
form_json
=
{
...
...
@@ -123,12 +119,15 @@
}
if
(
element_id
&&
raw_properties
.
hasOwnProperty
(
my_element
))
{
field_info
=
raw_properties
[
my_element
];
rendered_field
=
renderField
(
element_id
,
field_info
,
document
);
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
rendered_field
;
rendered_field
=
renderField
(
element_id
,
field_info
,
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
;
return
form_json
;
})
...
...
@@ -141,20 +140,32 @@
})
.
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
'
),
gadget
=
this
,
form_json
;
return
gadget
.
renderForm
(
options
.
form_definition
,
options
.
doc
)
return
gadget
.
renderForm
(
gadget
.
state
.
form_definition
,
gadget
.
state
.
doc
)
.
push
(
function
(
json
)
{
form_json
=
json
;
while
(
gadget
.
element
.
firstChild
)
{
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
}
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
)
{
return
gadget
.
renderSubGadget
(
options
,
form_gadget
,
form_json
);
return
gadget
.
renderSubGadget
(
gadget
.
state
.
options
,
form_gadget
,
form_json
);
});
})
...
...
@@ -175,7 +186,9 @@
.
push
(
function
()
{
var
url_for_parameter_list
=
[
{
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
:
'
selection_previous
'
},
{
command
:
'
selection_next
'
},
...
...
@@ -189,7 +202,15 @@
if
(
form_json
.
form_definition
.
allowed_sub_types_list
&&
form_json
.
form_definition
.
allowed_sub_types_list
.
length
>
0
&&
!
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
;
}
return
RSVP
.
all
([
...
...
@@ -236,7 +257,8 @@
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
];
}
if
(
add_url
)
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
View file @
7de5f254
...
...
@@ -41,13 +41,10 @@
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
@@ -101,12 +98,12 @@
.
push
(
function
(
gadget_utils
)
{
// TODO views are also listed here
// 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
)
{
return
RSVP
.
all
([
gadget
.
getHTMLElementList
(
action_info_dict
.
view
s
),
gadget
.
getHTMLElementList
(
action_info_dict
.
action
s
)
gadget
.
getHTMLElementList
(
action_info_dict
.
view
_list
),
gadget
.
getHTMLElementList
(
action_info_dict
.
action
_list
)
]);
})
// 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 @@
})
.
push
(
function
(
portal_type_result
)
{
portal_type
=
portal_type_result
;
// TODO: somehow (a generic action?) get the path string:${object_url}/Base_viewNewContentDialog
return
gadget
.
jio_get
(
"
portal_skins/erp5_hal_json_style/Base_viewNewContentDialog
"
);
return
gadget
.
getSetting
(
"
new_content_action
"
);
})
.
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
)
{
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 @@
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_text_editor_router_html.html
View file @
7de5f254
...
...
@@ -21,6 +21,9 @@
<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=
"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=
"dropbox_app_key"
type=
"text/x-renderjs-configuration"
>
n692ixxhyg9zhqs
</script>
<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