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
ae55033e
Commit
ae55033e
authored
May 24, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: code cleanup and minor fixes
parent
36f83e78
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
60 deletions
+57
-60
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_js.js
...athTemplateItem/web_page_module/gadget_officejs_jio_js.js
+36
-40
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_js.xml
...thTemplateItem/web_page_module/gadget_officejs_jio_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
...eb_page_module/gadget_officejs_page_action_officejs_js.js
+17
-16
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.xml
...b_page_module/gadget_officejs_page_action_officejs_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_js.js
View file @
ae55033e
/*global window,
rJS, jIO, FormData, UriTemplat
e */
/*global window,
window, rJS, jIO, RSVP, document, URLSearchParams, UriTemplate, consol
e */
/*jslint indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
jIO
,
RSVP
,
document
,
URLSearchParams
,
console
)
{
(
function
(
window
,
rJS
,
jIO
,
RSVP
,
document
,
URLSearchParams
,
UriTemplate
,
console
)
{
"
use strict
"
;
// jIO call wrapper for redirection to authentication page if needed
...
...
@@ -63,8 +63,8 @@
function
processHateoasDict
(
raw_dict
)
{
var
raw_fields
,
type
,
parent
,
field_key
,
field_id
,
return_dict
=
{};
return_dict
.
raw_dict
=
raw_dict
;
if
(
"
_embedded
"
in
raw_dict
&&
"
_view
"
in
raw_dict
.
_embedded
)
{
/*jslint nomen: true*/
/*jslint nomen: true*/
if
(
raw_dict
.
hasOwnProperty
(
"
_embedded
"
)
&&
raw_dict
.
_embedded
.
hasOwnProperty
(
"
_view
"
))
{
raw_fields
=
raw_dict
.
_embedded
.
_view
;
type
=
raw_dict
.
_links
.
type
.
name
;
parent
=
raw_dict
.
_links
.
parent
.
name
;
...
...
@@ -158,7 +158,6 @@
if
(
jio_storage_name
===
undefined
)
{
return
;
}
appcache_storage
=
jIO
.
createJIO
(
jio_appchache_options
);
// verify if appcache-local sync needs to be done
// TODO: find a better flag for this?
return
appcache_storage
.
get
(
sync_flag
)
.
push
(
undefined
,
function
(
error
)
{
if
(
error
&&
String
(
error
.
status_code
)
!==
"
404
"
)
{
...
...
@@ -168,41 +167,38 @@
.
push
(
function
()
{
return
appcache_storage
.
allAttachments
(
origin_url
)
.
push
(
function
(
attachment_dict
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
var
id
,
promise_list
=
[],
i
=
0
;
for
(
id
in
attachment_dict
)
{
if
(
attachment_dict
.
hasOwnProperty
(
id
))
{
if
(
id
.
indexOf
(
hateoas_script
)
===
-
1
)
{
promise_list
.
push
(
appcache_storage
.
getAttachment
(
origin_url
,
id
));
}
else
{
promise_list
.
push
(
appcache_storage
.
getAttachment
(
origin_url
,
id
,
{
"
format
"
:
"
json
"
}));
}
configuration_ids_list
[
i
]
=
id
;
i
+=
1
;
}
var
id
,
promise_list
=
[],
i
=
0
;
for
(
id
in
attachment_dict
)
{
if
(
attachment_dict
.
hasOwnProperty
(
id
))
{
if
(
id
.
indexOf
(
hateoas_script
)
===
-
1
)
{
promise_list
.
push
(
appcache_storage
.
getAttachment
(
origin_url
,
id
));
}
else
{
promise_list
.
push
(
appcache_storage
.
getAttachment
(
origin_url
,
id
,
{
"
format
"
:
"
json
"
}));
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
content_list
)
{
var
i
,
id
,
parser
,
urlParams
,
content
,
promise_list
=
[];
for
(
i
=
0
;
i
<
content_list
.
length
;
i
+=
1
)
{
id
=
configuration_ids_list
[
i
];
parser
=
document
.
createElement
(
'
a
'
);
parser
.
href
=
id
;
urlParams
=
new
URLSearchParams
(
parser
.
search
);
id
=
urlParams
.
get
(
"
relative_url
"
);
if
(
id
!==
null
)
{
// ignore non configuration elements
content
=
processHateoasDict
(
content_list
[
i
]);
promise_list
.
push
(
appcache_storage
.
put
(
id
,
content
));
}
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
()
{
return
appcache_storage
.
put
(
sync_flag
,
{})
.
push
(
undefined
);
});
configuration_ids_list
[
i
]
=
id
;
i
+=
1
;
}
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
content_list
)
{
var
i
,
id
,
parser
,
urlParams
,
content
,
promise_list
=
[];
for
(
i
=
0
;
i
<
content_list
.
length
;
i
+=
1
)
{
id
=
configuration_ids_list
[
i
];
parser
=
document
.
createElement
(
'
a
'
);
parser
.
href
=
id
;
urlParams
=
new
URLSearchParams
(
parser
.
search
);
id
=
urlParams
.
get
(
"
relative_url
"
);
if
(
id
!==
null
)
{
// ignore non configuration elements
content
=
processHateoasDict
(
content_list
[
i
]);
promise_list
.
push
(
appcache_storage
.
put
(
id
,
content
));
}
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
()
{
return
appcache_storage
.
put
(
sync_flag
,
{})
.
push
(
undefined
);
});
},
function
(
error
)
{
console
.
log
(
"
Error while appcache-local storage synchronization
"
);
...
...
@@ -246,4 +242,4 @@
return
wrapJioCall
(
this
,
'
repair
'
,
arguments
);
});
}(
window
,
rJS
,
jIO
,
RSVP
,
document
,
URLSearchParams
,
console
));
\ No newline at end of file
}(
window
,
rJS
,
jIO
,
RSVP
,
document
,
URLSearchParams
,
UriTemplate
,
console
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_js.xml
View file @
ae55033e
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.608
70.58404.40738
</string>
</value>
<value>
<string>
975.608
97.16999.55244
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
155870
8599.95
</float>
<float>
155870
9867.09
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.js
View file @
ae55033e
...
...
@@ -55,13 +55,14 @@
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
getHTMLElement
s
"
,
function
(
element_list
)
{
.
declareMethod
(
"
getHTMLElement
List
"
,
function
(
element_list
)
{
var
gadget
=
this
,
i
=
0
,
element_info_list
=
[],
url_for_parameter_list
=
[],
element_info
;
for
(
var
key
in
element_list
)
{
element_info
,
key
;
for
(
key
in
element_list
)
{
if
(
element_list
.
hasOwnProperty
(
key
))
{
element_info
=
element_list
[
key
];
url_for_parameter_list
.
push
({
command
:
'
change
'
,
options
:
element_info
});
...
...
@@ -71,19 +72,19 @@
}
return
gadget
.
getUrlForList
(
url_for_parameter_list
)
.
push
(
function
(
url_list
)
{
var
html_element_list
=
[],
i
,
element
;
for
(
i
=
0
;
i
<
url_list
.
length
;
i
+=
1
)
{
element
=
{
href
:
url_list
[
i
],
var
html_element_list
=
[],
j
,
element
;
for
(
j
=
0
;
j
<
url_list
.
length
;
j
+=
1
)
{
element
=
{
href
:
url_list
[
j
],
icon
:
null
,
name
:
element_info_list
[
i
].
reference
,
title
:
element_info_list
[
i
].
title
};
name
:
element_info_list
[
j
].
reference
,
title
:
element_info_list
[
j
].
title
};
html_element_list
.
push
(
element
);
}
return
html_element_list
;
});
})
.
declareMethod
(
"
getAllActions
"
,
function
(
portal_type
,
action_category
,
options
)
{
.
declareMethod
(
"
getAllActions
"
,
function
(
portal_type
,
options
)
{
var
gadget
=
this
,
action_info_dict
=
{
views
:
{},
actions
:
{}},
query
=
'
portal_type: "Action Information" AND parent_relative_url: "portal_types/
'
+
portal_type
+
'
"
'
;
...
...
@@ -98,7 +99,7 @@
return
RSVP
.
all
(
path_for_jio_get_list
);
})
.
push
(
function
(
action_document_list
)
{
var
action_settings_list
=
[],
page
,
action_key
,
action_doc
;
var
action_settings_list
=
[],
page
,
action_key
,
action_doc
,
key
,
action_settings
;
for
(
action_key
in
action_document_list
)
{
if
(
action_document_list
.
hasOwnProperty
(
action_key
))
{
action_doc
=
action_document_list
[
action_key
];
...
...
@@ -117,9 +118,9 @@
});
}
}
for
(
var
key
in
action_settings_list
)
{
for
(
key
in
action_settings_list
)
{
if
(
action_settings_list
.
hasOwnProperty
(
key
))
{
var
action_settings
=
action_settings_list
[
key
];
action_settings
=
action_settings_list
[
key
];
if
(
view_categories
.
includes
(
action_settings
.
action_type
))
{
action_info_dict
.
views
[
action_settings
.
action
]
=
action_settings
;
}
else
{
...
...
@@ -144,17 +145,17 @@
.
push
(
function
(
document
)
{
document_title
=
document
.
title
;
return
document
.
portal_type
;
},
function
(
error
)
{
},
function
()
{
document_title
=
options
.
portal_type
;
return
options
.
portal_type
;
})
.
push
(
function
(
portal_type
)
{
return
gadget
.
getAllActions
(
portal_type
,
view_categories
[
0
],
options
);
return
gadget
.
getAllActions
(
portal_type
,
options
);
})
.
push
(
function
(
action_info_dict
)
{
return
RSVP
.
all
([
gadget
.
getHTMLElement
s
(
action_info_dict
.
views
),
gadget
.
getHTMLElement
s
(
action_info_dict
.
actions
)
gadget
.
getHTMLElement
List
(
action_info_dict
.
views
),
gadget
.
getHTMLElement
List
(
action_info_dict
.
actions
)
]);
})
// TODO: check other lists like clone or delete?
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_officejs_js.xml
View file @
ae55033e
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.
40561.441.8482
</string>
</value>
<value>
<string>
975.
60908.18646.37734
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
155
7499265.0
</float>
<float>
155
8710504.54
</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