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
Xavier Thompson
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
Show 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 @@
...
@@ -22,16 +22,14 @@
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
)
gadget
.
getSetting
(
'
text_content
'
,
""
)
]);
]);
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
var
doc
=
{
var
doc
=
{
title
:
"
Untitled Document
"
,
title
:
"
Untitled Document
"
,
portal_type
:
result
[
0
],
portal_type
:
result
[
0
],
parent_relative_url
:
result
[
1
],
parent_relative_url
:
result
[
1
]
text_content
:
result
[
2
]
};
};
return
gadget
.
jio_post
(
doc
);
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 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
973.
13148.27135.54732
</string>
</value>
<value>
<string>
973.
25023.19197.63385
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
154
8335477.5
7
</float>
<float>
154
9038779.
7
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_post_list_js.js
View file @
12a395e1
...
@@ -10,47 +10,70 @@
...
@@ -10,47 +10,70 @@
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
"
jio_allDocs
"
,
function
(
param_list
)
{
.
declareMethod
(
"
generateJsonRenderForm
"
,
function
(
gadget
)
{
var
gadget
=
this
;
//hardcoded form_definition (this should come from erp5 form)
return
gadget
.
jio_allDocs
(
param_list
[
0
])
var
form_definition
=
{
.
push
(
function
(
result
)
{
_debug
:
"
traverse
"
,
var
i
,
date
,
len
=
result
.
data
.
total_rows
;
pt
:
"
form_view
"
,
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
title
:
"
Post
"
,
if
(
result
.
data
.
rows
[
i
].
value
.
hasOwnProperty
(
"
modification_date
"
))
{
group_list
:
[[
date
=
new
Date
(
result
.
data
.
rows
[
i
].
value
.
modification_date
);
"
bottom
"
,
result
.
data
.
rows
[
i
].
value
.
modification_date
=
{
[[
"
my_listbox
"
]]
field_gadget_param
:
{
]],
allow_empty_time
:
0
,
//this field_info is totally made up, but somewhere in the definition there must be
ampm_time_style
:
0
,
//information about the fields. So, foreach field: key->info
css_class
:
"
date_field
"
,
field_info_dict
:
{
date_only
:
0
,
"
my_listbox
"
:
{
description
:
"
The Date
"
,
"
column_list
"
:
[[
'
title
'
,
'
Title
'
],
[
'
modification_date
'
,
'
Modification Date
'
]],
editable
:
0
,
"
show_anchor
"
:
0
,
hidden
:
0
,
"
default_params
"
:
{},
hidden_day_is_last_day
:
0
,
"
editable
"
:
1
,
"
default
"
:
date
.
toUTCString
(),
"
editable_column_list
"
:
[],
key
:
"
modification_date
"
,
"
key
"
:
"
field_listbox
"
,
required
:
0
,
"
lines
"
:
30
,
timezone_style
:
0
,
"
list_method
"
:
"
portal_catalog
"
,
title
:
"
Modification Date
"
,
// is this correct? the query should come from the form definition, right?
type
:
"
DateTimeField
"
"
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
:
{}
},
form_json
=
{
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{}},
"
_links
"
:
{}
},
form_definition
:
form_definition
};
};
result
.
data
.
rows
[
i
].
value
[
"
listbox_uid:list
"
]
=
{
for
(
var
i
=
0
;
i
<
form_definition
.
group_list
.
length
;
i
++
)
{
key
:
"
listbox_uid:list
"
,
var
fields
=
form_definition
.
group_list
[
i
][
1
];
value
:
2713
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
];
}
}
return
result
;
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
field_info
;
});
}
}
return
form_json
;
})
})
.
allowPublicAcquisition
(
'
notifySubmit
'
,
function
()
{
.
allowPublicAcquisition
(
'
notifySubmit
'
,
function
()
{
...
@@ -72,56 +95,16 @@
...
@@ -72,56 +95,16 @@
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_list
'
),
gadget
.
getDeclaredGadget
(
'
form_list
'
),
gadget
.
ge
tSetting
(
"
portal_type
"
)
gadget
.
ge
nerateJsonRenderForm
(
gadget
)
]);
]);
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
var
column_list
=
[
return
result
[
0
].
render
(
result
[
1
]);
[
'
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
"
]]
]]
}
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
"
page
"
:
"
ojs_add_post
"
}}),
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
"
page
"
:
"
ojs_add_post
"
}}),
gadget
.
getSetting
(
'
document_title_plural
'
),
gadget
.
getSetting
(
'
document_title_plural
'
),
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
"
page
"
:
"
ojs_upload_convert
"
}}),
gadget
.
getSetting
(
'
upload_dict
'
,
false
)
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 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
973.
12023.55154.25190
</string>
</value>
<value>
<string>
973.
25050.40927.26658
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
154
8320460.62
</float>
<float>
154
9040323.25
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_html_post_view_js.js
View file @
12a395e1
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
title
:
"
Post
"
,
title
:
"
Post
"
,
group_list
:
[[
group_list
:
[[
"
left
"
,
"
left
"
,
[[
"
my_title
"
,
{
meta_type
:
"
StringField
"
}]
,
[
"
my_reference
"
,
{
meta_type
:
"
StringField
"
}]
]
[[
"
my_title
"
,
{
meta_type
:
"
StringField
"
}]]
],
[
],
[
"
bottom
"
,
"
bottom
"
,
[[
"
my_text_content
"
,
{
meta_type
:
"
ProxyField
"
}]]
[[
"
my_text_content
"
,
{
meta_type
:
"
ProxyField
"
}]]
...
@@ -82,11 +82,11 @@
...
@@ -82,11 +82,11 @@
if
(
my_element
.
startsWith
(
"
my_
"
))
{
if
(
my_element
.
startsWith
(
"
my_
"
))
{
element_id
=
my_element
.
replace
(
"
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
];
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
;
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 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
154
8768313.55
</float>
<float>
154
9036257.66
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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