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
5df13c14
Commit
5df13c14
authored
Apr 09, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: add post gadget becomes generic
- wip: change name to add document
parent
a5397a63
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
48 deletions
+56
-48
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_ojs_add_post_js.js
..._page_module/gadget_officejs_erp5_page_ojs_add_post_js.js
+10
-4
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_ojs_add_post_js.xml
...page_module/gadget_officejs_erp5_page_ojs_add_post_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.js
...web_page_module/gadget_officejs_erp5_page_post_list_js.js
+42
-40
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.xml
...eb_page_module/gadget_officejs_erp5_page_post_list_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_ojs_add_post_js.js
View file @
5df13c14
...
...
@@ -16,7 +16,7 @@
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
()
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
doc_id
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
@@ -28,11 +28,17 @@
.
push
(
function
(
result
)
{
var
doc
=
{
title
:
"
Untitled Document
"
,
//TODO: this must be the parent thread reference (or 'base' post ref?)
source_reference
:
"
some-fake-thread-id
"
,
portal_type
:
result
[
0
],
parent_relative_url
:
result
[
1
]
};
},
key
,
doc_key
;
for
(
key
in
options
)
{
if
(
options
.
hasOwnProperty
(
key
))
{
if
(
key
.
startsWith
(
"
my_
"
))
{
doc_key
=
key
.
replace
(
"
my_
"
,
""
);
doc
[
doc_key
]
=
options
[
key
];
}
}
}
return
gadget
.
jio_post
(
doc
);
})
.
push
(
function
(
id
)
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_ojs_add_post_js.xml
View file @
5df13c14
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.
53018.33015.5589
3
</string>
</value>
<value>
<string>
974.
60313.36900.2104
3
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
1554
392914.44
</float>
<float>
1554
829075.96
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.js
View file @
5df13c14
...
...
@@ -18,48 +18,50 @@
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
generateJsonRenderForm
"
,
function
(
gadget
)
{
//this will be the id of the thread that contains this post list
var
fake_thread_uid
=
"
thread-
"
+
(
"
0000
"
+
((
Math
.
random
()
*
Math
.
pow
(
36
,
4
))
|
0
).
toString
(
36
)).
slice
(
-
4
),
//hardcoded form_definition (this should come from erp5 form)
var
form_definition
=
{
_debug
:
"
traverse
"
,
pt
:
"
form_view
"
,
title
:
"
Post
"
,
group_list
:
[[
"
bottom
"
,
[[
"
my_listbox
"
]]
]],
//this field_info is totally made up, but somewhere in the definition there must be
//information about the fields. So, foreach field: key->info
field_info_dict
:
{
"
my_listbox
"
:
{
"
column_list
"
:
[[
'
title
'
,
'
Title
'
],
[
'
modification_date
'
,
'
Modification Date
'
]],
"
show_anchor
"
:
0
,
"
default_params
"
:
{},
"
editable
"
:
1
,
"
editable_column_list
"
:
[],
"
key
"
:
"
field_listbox
"
,
"
lines
"
:
30
,
"
list_method
"
:
"
portal_catalog
"
,
// is this correct? the query should come from the form definition, right?
"
query
"
:
"
urn:jio:allDocs?query=portal_type%3A%22HTML Post%22
"
,
"
portal_type
"
:
[],
"
search_column_list
"
:
[[
'
title
'
,
'
Title
'
],
[
'
modification_date
'
,
'
Modification Date
'
]],
"
sort_column_list
"
:
[[
'
title
'
,
'
Title
'
],
[
'
modification_date
'
,
'
Modification Date
'
]],
"
sort
"
:
[[
'
modification_date
'
,
'
descending
'
]],
"
title
"
:
"
Posts
"
,
"
type
"
:
"
ListBox
"
}
},
action
:
"
Base_edit
"
,
update_action
:
""
,
_links
:
{
"
type
"
:
{
name
:
""
},
"
action_object_new_content_action
"
:
{
"
page
"
:
"
ojs_add_post
"
}
}
},
form_json
=
{
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{}},
"
_links
"
:
{}
form_definition
=
{
_debug
:
"
traverse
"
,
pt
:
"
form_view
"
,
title
:
"
Post
"
,
group_list
:
[[
"
bottom
"
,
[[
"
my_listbox
"
]]
]],
//this field_info is totally made up, but somewhere in the definition there must be
//information about the fields. So, foreach field: key->info
field_info_dict
:
{
"
my_listbox
"
:
{
"
column_list
"
:
[[
'
title
'
,
'
Title
'
],
[
'
modification_date
'
,
'
Modification Date
'
]],
"
show_anchor
"
:
0
,
"
default_params
"
:
{},
"
editable
"
:
1
,
"
editable_column_list
"
:
[],
"
key
"
:
"
field_listbox
"
,
"
lines
"
:
30
,
"
list_method
"
:
"
portal_catalog
"
,
// is this correct? the query should come from the form definition, right?
"
query
"
:
"
urn:jio:allDocs?query=portal_type%3A%22HTML Post%22
"
,
"
portal_type
"
:
[],
"
search_column_list
"
:
[[
'
title
'
,
'
Title
'
],
[
'
modification_date
'
,
'
Modification Date
'
]],
"
sort_column_list
"
:
[[
'
title
'
,
'
Title
'
],
[
'
modification_date
'
,
'
Modification Date
'
]],
"
sort
"
:
[[
'
modification_date
'
,
'
descending
'
]],
"
title
"
:
"
Posts
"
,
"
type
"
:
"
ListBox
"
}
},
action
:
"
Base_edit
"
,
update_action
:
""
,
_links
:
{
"
type
"
:
{
name
:
""
},
"
action_object_new_content_action
"
:
{
page
:
"
ojs_add_post
"
,
my_source_reference
:
fake_thread_uid
}
}
},
form_definition
:
form_definition
};
form_json
=
{
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{}},
"
_links
"
:
{}
},
form_definition
:
form_definition
};
for
(
var
i
=
0
;
i
<
form_definition
.
group_list
.
length
;
i
++
)
{
var
fields
=
form_definition
.
group_list
[
i
][
1
];
for
(
var
j
=
0
;
j
<
fields
.
length
;
j
++
)
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.xml
View file @
5df13c14
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.
59028.6381.42171
</string>
</value>
<value>
<string>
974.
60320.21280.62788
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
1554
752043.96
</float>
<float>
1554
829461.22
</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