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
0
Issues
0
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
Binh
erp5
Commits
12a395e1
Commit
12a395e1
authored
Feb 01, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: removing hardcoded json forms in discussion tool
- post list view gadget and details
parent
6f0f7764
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
90 deletions
+71
-90
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
+2
-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
+59
-76
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
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_html_post_view_js.js
.../web_page_module/gadget_officejs_jio_html_post_view_js.js
+4
-4
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_html_post_view_js.xml
...web_page_module/gadget_officejs_jio_html_post_view_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 @
12a395e1
...
...
@@ -22,16 +22,14 @@
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
),
gadget
.
getSetting
(
'
text_content
'
,
""
)
gadget
.
getSetting
(
'
parent_relative_url
'
)
]);
})
.
push
(
function
(
result
)
{
var
doc
=
{
title
:
"
Untitled Document
"
,
portal_type
:
result
[
0
],
parent_relative_url
:
result
[
1
],
text_content
:
result
[
2
]
parent_relative_url
:
result
[
1
]
};
return
gadget
.
jio_post
(
doc
);
})
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_ojs_add_post_js.xml
View file @
12a395e1
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
973.
13148.27135.54732
</string>
</value>
<value>
<string>
973.
25023.19197.63385
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
154
8335477.5
7
</float>
<float>
154
9038779.
7
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.js
View file @
12a395e1
...
...
@@ -10,47 +10,70 @@
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
"
jio_allDocs
"
,
function
(
param_list
)
{
var
gadget
=
this
;
return
gadget
.
jio_allDocs
(
param_list
[
0
])
.
push
(
function
(
result
)
{
var
i
,
date
,
len
=
result
.
data
.
total_rows
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
if
(
result
.
data
.
rows
[
i
].
value
.
hasOwnProperty
(
"
modification_date
"
))
{
date
=
new
Date
(
result
.
data
.
rows
[
i
].
value
.
modification_date
);
result
.
data
.
rows
[
i
].
value
.
modification_date
=
{
field_gadget_param
:
{
allow_empty_time
:
0
,
ampm_time_style
:
0
,
css_class
:
"
date_field
"
,
date_only
:
0
,
description
:
"
The Date
"
,
editable
:
0
,
hidden
:
0
,
hidden_day_is_last_day
:
0
,
"
default
"
:
date
.
toUTCString
(),
key
:
"
modification_date
"
,
required
:
0
,
timezone_style
:
0
,
title
:
"
Modification Date
"
,
type
:
"
DateTimeField
"
}
};
result
.
data
.
rows
[
i
].
value
[
"
listbox_uid:list
"
]
=
{
key
:
"
listbox_uid:list
"
,
value
:
2713
};
}
.
declareMethod
(
"
generateJsonRenderForm
"
,
function
(
gadget
)
{
//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
"
}
return
result
;
});
},
action
:
"
Base_edit
"
,
update_action
:
""
,
_links
:
{}
},
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
++
)
{
var
my_element
=
fields
[
j
][
0
],
element_id
;
if
(
my_element
.
startsWith
(
"
my_
"
))
{
element_id
=
my_element
.
replace
(
"
my_
"
,
""
);
}
var
field_info
=
form_definition
.
field_info_dict
[
my_element
];
if
(
gadget
.
state
.
hasOwnProperty
(
"
doc
"
)
&&
gadget
.
state
.
doc
.
hasOwnProperty
(
element_id
))
{
field_info
[
"
default
"
]
=
gadget
.
state
.
doc
[
element_id
];
}
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
field_info
;
}
}
return
form_json
;
})
.
allowPublicAcquisition
(
'
notifySubmit
'
,
function
()
{
...
...
@@ -72,56 +95,16 @@
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_list
'
),
gadget
.
ge
tSetting
(
"
portal_type
"
)
gadget
.
ge
nerateJsonRenderForm
(
gadget
)
]);
})
.
push
(
function
(
result
)
{
var
column_list
=
[
[
'
title
'
,
'
Title
'
],
[
'
modification_date
'
,
'
Modification Date
'
]
];
return
result
[
0
].
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
listbox
"
:
{
"
column_list
"
:
column_list
,
"
show_anchor
"
:
0
,
"
default_params
"
:
{},
"
editable
"
:
1
,
"
editable_column_list
"
:
[],
"
key
"
:
"
field_listbox
"
,
"
lines
"
:
30
,
"
list_method
"
:
"
portal_catalog
"
,
"
query
"
:
"
urn:jio:allDocs?query=portal_type%3A%22
"
+
result
[
1
]
+
"
%22
"
,
"
portal_type
"
:
[],
"
search_column_list
"
:
column_list
,
"
sort_column_list
"
:
column_list
,
"
sort
"
:
[[
'
modification_date
'
,
'
descending
'
]],
"
title
"
:
"
Posts
"
,
"
type
"
:
"
ListBox
"
}
}},
"
_links
"
:
{
"
type
"
:
{
// form_list display portal_type in header
name
:
""
}
}
},
form_definition
:
{
group_list
:
[[
"
bottom
"
,
[[
"
listbox
"
]]
]]
}
});
return
result
[
0
].
render
(
result
[
1
]);
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
"
page
"
:
"
ojs_add_post
"
}}),
gadget
.
getSetting
(
'
document_title_plural
'
),
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
"
page
"
:
"
ojs_upload_convert
"
}}),
gadget
.
getSetting
(
'
upload_dict
'
,
false
)
]);
})
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.xml
View file @
12a395e1
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
973.
12023.55154.25190
</string>
</value>
<value>
<string>
973.
25050.40927.26658
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
154
8320460.62
</float>
<float>
154
9040323.25
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_html_post_view_js.js
View file @
12a395e1
...
...
@@ -26,7 +26,7 @@
title
:
"
Post
"
,
group_list
:
[[
"
left
"
,
[[
"
my_title
"
,
{
meta_type
:
"
StringField
"
}]
,
[
"
my_reference
"
,
{
meta_type
:
"
StringField
"
}]
]
[[
"
my_title
"
,
{
meta_type
:
"
StringField
"
}]]
],
[
"
bottom
"
,
[[
"
my_text_content
"
,
{
meta_type
:
"
ProxyField
"
}]]
...
...
@@ -82,11 +82,11 @@
if
(
my_element
.
startsWith
(
"
my_
"
))
{
element_id
=
my_element
.
replace
(
"
my_
"
,
""
);
}
if
(
gadget
.
state
.
doc
.
hasOwnProperty
(
element_id
))
{
var
field_info
=
form_definition
.
field_info_dict
[
my_element
];
var
field_info
=
form_definition
.
field_info_dict
[
my_element
];
if
(
gadget
.
state
.
hasOwnProperty
(
"
doc
"
)
&&
gadget
.
state
.
doc
.
hasOwnProperty
(
element_id
))
{
field_info
[
"
default
"
]
=
gadget
.
state
.
doc
[
element_id
];
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
field_info
;
}
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
field_info
;
}
}
return
form_json
;
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_html_post_view_js.xml
View file @
12a395e1
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
973.2
0517.6195.2508
</string>
</value>
<value>
<string>
973.2
4979.41047.29781
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
154
8768313.55
</float>
<float>
154
9036257.66
</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