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
4a188c92
Commit
4a188c92
authored
Mar 25, 2024
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] [HARDCODED] erp5_officejs: acquire jio_alldocs in form view
parent
0548d23d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
136 additions
and
3 deletions
+136
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
...plateItem/web_page_module/gadget_officejs_form_view_js.js
+134
-1
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.xml
...lateItem/web_page_module/gadget_officejs_form_view_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
View file @
4a188c92
...
...
@@ -145,6 +145,7 @@
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
...
...
@@ -152,7 +153,137 @@
// XXX fix date rendering
.
allowPublicAcquisition
(
"
jio_allDocs
"
,
function
(
param_list
)
{
var
gadget
=
this
;
var
gadget
=
this
,
jio_gadget
;
console
.
log
(
"
jio_allDocs params
"
,
param_list
[
0
]);
if
(
param_list
[
0
].
query
.
indexOf
(
'
portal_type:"Promise"
'
)
!==
-
1
&&
gadget
.
state
.
doc
&&
gadget
.
state
.
doc
.
source
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
declareGadget
(
'
gadget_officejs_monitoring_jio.html
'
);
})
.
push
(
function
(
result
)
{
jio_gadget
=
result
;
console
.
log
(
"
jio_alldocs for a promise!
"
);
console
.
log
(
"
gadget.state.doc:
"
,
gadget
.
state
.
doc
);
console
.
log
(
"
creating webhttp jio with url:
"
,
gadget
.
state
.
doc
.
source_url
);
return
jio_gadget
.
createJio
({
type
:
"
webhttp
"
,
// XXX fix of url
url
:
gadget
.
state
.
doc
.
source_url
.
replace
(
"
jio_public
"
,
"
public
"
)
});
})
.
push
(
function
()
{
console
.
log
(
"
jio created
"
);
console
.
log
(
"
get id:
"
,
gadget
.
state
.
doc
.
source
+
"
.history
"
);
// get history file on live
return
jio_gadget
.
get
(
gadget
.
state
.
doc
.
source
+
"
.history
"
)
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
"
error, no status_history
"
);
if
(
error
.
name
===
"
cancel
"
)
{
return
undefined
;
}
return
gadget
.
notifySubmitted
({
status
:
"
error
"
,
message
:
"
Failed to get promise history content!
\n
"
+
error
.
message
||
''
})
.
push
(
function
()
{
return
undefined
;
});
})
.
push
(
function
(
status_history
)
{
var
i
,
len
,
start
,
result
=
{};
result
.
data
=
{
rows
:
[],
total_rows
:
0
};
function
addUTCTimezone
(
date_string
)
{
if
(
new
RegExp
(
/
[
+-
][\d]{2}\:?[\d]{2}
$/
).
test
(
date_string
))
{
return
date_string
;
}
return
date_string
+
"
+0000
"
;
}
if
(
status_history
&&
status_history
.
hasOwnProperty
(
'
data
'
))
{
// the status history list is reversed ([old, ...., newest])
len
=
status_history
.
data
.
length
;
start
=
len
-
param_list
[
0
].
limit
[
0
]
-
1
;
//lines = param_list[0].limit[1] - param_list[0].limit[0];
if
(
start
<
0
)
{
start
=
len
-
1
;
}
//if (lines > len) {
// lines = len - start;
//}
for
(
i
=
start
;
i
>=
0
;
i
-=
1
)
{
result
.
data
.
total_rows
+=
1
;
result
.
data
.
rows
.
push
({
value
:
{
status
:
{
field_gadget_param
:
{
css_class
:
""
,
description
:
"
The Status
"
,
hidden
:
0
,
"
default
"
:
status_history
.
data
[
i
].
status
,
key
:
"
status
"
,
url
:
"
gadget_erp5_field_status.html
"
,
title
:
"
Status
"
,
type
:
"
GadgetField
"
}
},
start_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
"
:
addUTCTimezone
(
status_history
.
data
[
i
].
date
||
status_history
.
data
[
i
][
'
start-date
'
]),
key
:
"
start_date
"
,
required
:
0
,
timezone_style
:
1
,
title
:
"
Date
"
,
type
:
"
DateTimeField
"
}
},
change_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
"
:
addUTCTimezone
(
status_history
.
data
[
i
][
'
change-date
'
]
||
new
Date
(
status_history
.
data
[
i
][
'
change-time
'
]
*
1000
)
.
toUTCString
()),
key
:
"
change_date
"
,
required
:
0
,
timezone_style
:
1
,
title
:
"
Status Date
"
,
type
:
"
DateTimeField
"
}
},
message
:
status_history
.
data
[
i
].
message
,
"
listbox_uid:list
"
:
{
key
:
"
listbox_uid:list
"
,
value
:
2713
}
}
});
}
}
console
.
log
(
"
result:
"
,
result
);
return
result
;
});
});
}
return
gadget
.
jio_allDocs
(
param_list
[
0
])
.
push
(
function
(
result
)
{
var
i
,
date
,
len
=
result
.
data
.
total_rows
,
date_key_array
,
...
...
@@ -188,7 +319,9 @@
};
}
});
console
.
log
(
"
jio_allDocs result data row
"
,
result
.
data
.
rows
[
i
].
value
);
//TODO make it customizable from config
//use global var set from config style_columns
status_key_array
.
forEach
((
status_key
)
=>
{
if
(
result
.
data
.
rows
[
i
].
value
.
hasOwnProperty
(
status_key
))
{
status
=
result
.
data
.
rows
[
i
].
value
[
status_key
];
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.xml
View file @
4a188c92
...
...
@@ -258,7 +258,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1015.
24557.22502.33262
</string>
</value>
<value>
<string>
1015.
30241.64537.63761
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -278,7 +278,7 @@
</tuple>
<state>
<tuple>
<float>
1711
051105.18
</float>
<float>
1711
392147.81
</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