Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
telecom
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
telecom
Commits
d07bb10c
Commit
d07bb10c
authored
Apr 13, 2017
by
Roque Porchetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New custom JIO gadget to allow local storage.
parent
387e3462
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
914 additions
and
7 deletions
+914
-7
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_custom_JIO_gadget.html.html
...plateItem/web_page_module/fif_custom_JIO_gadget.html.html
+21
-0
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_custom_JIO_gadget.html.xml
...mplateItem/web_page_module/fif_custom_JIO_gadget.html.xml
+322
-0
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_custom_JIO_gadget.js.js
...hTemplateItem/web_page_module/fif_custom_JIO_gadget.js.js
+243
-0
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_custom_JIO_gadget.js.xml
...TemplateItem/web_page_module/fif_custom_JIO_gadget.js.xml
+320
-0
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_gadget_erp5_page_list_js.js
...plateItem/web_page_module/fif_gadget_erp5_page_list_js.js
+3
-2
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_gadget_erp5_page_list_js.xml
...lateItem/web_page_module/fif_gadget_erp5_page_list_js.xml
+2
-2
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_site_module/fif_data_runner.xml
...m_UI/PathTemplateItem/web_site_module/fif_data_runner.xml
+3
-3
No files found.
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_custom_JIO_gadget.html.html
0 → 100644
View file @
d07bb10c
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
Jio Gadget
</title>
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"jiodev.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"gadget_erp5_custom_jio.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
data-gadget-url=
'gadget_jio.html'
data-gadget-scope=
'jio'
></div>
</body>
</html>
\ No newline at end of file
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_custom_JIO_gadget.html.xml
0 → 100644
View file @
d07bb10c
This diff is collapsed.
Click to expand it.
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_custom_JIO_gadget.js.js
0 → 100644
View file @
d07bb10c
/*global window, rJS, RSVP, UriTemplate, URI, Query, SimpleQuery, ComplexQuery, jIO */
/*jslint indent: 2, maxerr: 3, nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
UriTemplate
,
URI
,
Query
,
SimpleQuery
,
ComplexQuery
,
jIO
)
{
"
use strict
"
;
function
wrapJioCall
(
gadget
,
method_name
,
argument_list
)
{
var
storage
=
gadget
.
state_parameter_dict
.
jio_storage
,
regexp
=
/^X-Delegate uri="
(
http
[
s
]
*:
\/\/[\/\-\[\]
{}()*+:?.,
\\\^
$|#
\s\w
%
]
+
)
"$/
,
login_page
;
return
storage
[
method_name
].
apply
(
storage
,
argument_list
)
.
push
(
undefined
,
function
(
error
)
{
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
401
))
{
login_page
=
error
.
target
.
getResponseHeader
(
'
WWW-Authenticate
'
);
// Only connect to https to login
if
(
regexp
.
test
(
login_page
))
{
return
gadget
.
getUrlFor
({
command
:
'
login
'
,
absolute_url
:
true
})
.
push
(
function
(
came_from
)
{
return
gadget
.
redirect
({
command
:
'
raw
'
,
options
:
{
url
:
UriTemplate
.
parse
(
regexp
.
exec
(
login_page
)[
1
]).
expand
({
came_from
:
came_from
})
}
});
});
/*
window.location = UriTemplate.parse(
regexp.exec(login_page)[1]
).expand({came_from: window.location.href + "{&me}"});
return RSVP.timeout(5000);
*/
// Redirect to the login view
}
// return gadget.redirect({command: 'display', options: {page: 'login'}});
}
throw
error
;
});
}
function
isSingleLocalRoles
(
parsed_query
)
{
if
((
parsed_query
instanceof
SimpleQuery
)
&&
(
parsed_query
.
key
===
'
local_roles
'
))
{
// local_roles:"Assignee"
return
parsed_query
.
value
;
}
}
function
isMultipleLocalRoles
(
parsed_query
)
{
var
i
,
sub_query
,
is_multiple
=
true
,
local_role_list
=
[];
if
((
parsed_query
instanceof
ComplexQuery
)
&&
(
parsed_query
.
operator
===
'
OR
'
))
{
for
(
i
=
0
;
i
<
parsed_query
.
query_list
.
length
;
i
+=
1
)
{
sub_query
=
parsed_query
.
query_list
[
i
];
if
((
sub_query
instanceof
SimpleQuery
)
&&
(
sub_query
.
key
===
'
local_roles
'
))
{
local_role_list
.
push
(
sub_query
.
value
);
}
else
{
is_multiple
=
false
;
}
}
if
(
is_multiple
)
{
// local_roles:"Assignee" OR local_roles:"Assignor"
return
local_role_list
;
}
}
}
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
return
gadget
.
getDeclaredGadget
(
'
jio
'
)
.
push
(
function
(
jio_gadget
)
{
// Initialize the gadget local parameters
gadget
.
state_parameter_dict
=
{
jio_storage
:
jio_gadget
};
});
})
.
declareAcquiredMethod
(
'
getSetting
'
,
'
getSetting
'
)
.
declareAcquiredMethod
(
'
redirect
'
,
'
redirect
'
)
.
declareAcquiredMethod
(
'
getUrlFor
'
,
'
getUrlFor
'
)
.
declareMethod
(
'
createJio
'
,
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
'
hateoas_url
'
),
gadget
.
getSetting
(
'
default_view_reference
'
)
]);
})
.
push
(
function
(
setting_list
)
{
/*return gadget.state_parameter_dict.jio_storage.createJio({
type: "erp5",
url: setting_list[0],
default_view_reference: setting_list[1]
});*/
return
gadget
.
state_parameter_dict
.
jio_storage
.
createJio
({
type
:
"
replicate
"
,
local_sub_storage
:
{
type
:
"
query
"
,
"
sub_storage
"
:
{
type
:
"
indexeddb
"
,
database
:
"
telecom
"
}
},
remote_sub_storage
:
{
type
:
"
erp5
"
,
url
:
setting_list
[
0
],
default_view_reference
:
setting_list
[
1
]
},
query
:
{
query
:
'
portal_type:"Data Array"
'
,
limit
:
[
0
,
10000
]
}
});
})
.
push
(
function
()
{
return
gadget
.
state_parameter_dict
.
jio_storage
.
repair
();
});
})
.
declareMethod
(
'
allDocs
'
,
function
(
option_dict
)
{
// throw new Error('do not use all docs');
if
(
option_dict
.
list_method_template
===
undefined
)
{
return
wrapJioCall
(
this
,
'
allDocs
'
,
arguments
);
}
var
query
=
option_dict
.
query
,
i
,
parsed_query
,
sub_query
,
result_list
,
tmp_list
=
[],
local_roles
;
if
(
option_dict
.
query
)
{
parsed_query
=
jIO
.
QueryFactory
.
create
(
option_dict
.
query
);
result_list
=
isSingleLocalRoles
(
parsed_query
);
if
(
result_list
)
{
query
=
undefined
;
local_roles
=
result_list
;
}
else
{
result_list
=
isMultipleLocalRoles
(
parsed_query
);
if
(
result_list
)
{
query
=
undefined
;
local_roles
=
result_list
;
}
else
if
((
parsed_query
instanceof
ComplexQuery
)
&&
(
parsed_query
.
operator
===
'
AND
'
))
{
// portal_type:"Person" AND local_roles:"Assignee"
for
(
i
=
0
;
i
<
parsed_query
.
query_list
.
length
;
i
+=
1
)
{
sub_query
=
parsed_query
.
query_list
[
i
];
result_list
=
isSingleLocalRoles
(
sub_query
);
if
(
result_list
)
{
local_roles
=
result_list
;
parsed_query
.
query_list
.
splice
(
i
,
1
);
query
=
Query
.
objectToSearchText
(
parsed_query
);
i
=
parsed_query
.
query_list
.
length
;
}
else
{
result_list
=
isMultipleLocalRoles
(
sub_query
);
if
(
result_list
)
{
local_roles
=
result_list
;
parsed_query
.
query_list
.
splice
(
i
,
1
);
query
=
Query
.
objectToSearchText
(
parsed_query
);
i
=
parsed_query
.
query_list
.
length
;
}
}
}
}
}
option_dict
.
query
=
query
;
option_dict
.
local_roles
=
local_roles
;
}
if
(
option_dict
.
sort_on
)
{
for
(
i
=
0
;
i
<
option_dict
.
sort_on
.
length
;
i
+=
1
)
{
tmp_list
.
push
(
JSON
.
stringify
(
option_dict
.
sort_on
[
i
]));
}
option_dict
.
sort_on
=
tmp_list
;
}
return
wrapJioCall
(
this
,
'
getAttachment
'
,
[
// XXX Ugly hardcoded meaningless id...
"
erp5
"
,
new
UriTemplate
.
parse
(
option_dict
.
list_method_template
)
.
expand
(
option_dict
),
{
format
:
"
json
"
}
]
)
.
push
(
function
(
catalog_json
)
{
var
data
=
catalog_json
.
_embedded
.
contents
,
count
=
data
.
length
,
k
,
uri
,
item
,
result
=
[];
for
(
k
=
0
;
k
<
count
;
k
+=
1
)
{
item
=
data
[
k
];
uri
=
new
URI
(
item
.
_links
.
self
.
href
);
delete
item
.
_links
;
result
.
push
({
id
:
uri
.
segment
(
2
),
doc
:
{},
value
:
item
});
}
return
{
data
:
{
rows
:
result
,
total_rows
:
result
.
length
}
};
});
})
.
declareMethod
(
'
get
'
,
function
(
id
)
{
return
wrapJioCall
(
this
,
'
get
'
,
[
id
]);
})
.
declareMethod
(
'
getAttachment
'
,
function
(
id
,
name
)
{
return
wrapJioCall
(
this
,
'
getAttachment
'
,
[
id
,
name
,
{
format
:
"
json
"
}]);
})
.
declareMethod
(
'
putAttachment
'
,
function
(
id
,
name
,
json
)
{
return
wrapJioCall
(
this
,
'
putAttachment
'
,
[
id
,
name
,
JSON
.
stringify
(
json
)]);
})
.
declareMethod
(
'
put
'
,
function
(
key
,
doc
)
{
return
wrapJioCall
(
this
,
'
put
'
,
[
key
,
doc
]);
})
.
declareMethod
(
'
post
'
,
function
(
doc
)
{
return
wrapJioCall
(
this
,
'
post
'
,
[
doc
]);
});
}(
window
,
rJS
,
RSVP
,
UriTemplate
,
URI
,
Query
,
SimpleQuery
,
ComplexQuery
,
jIO
));
\ No newline at end of file
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_custom_JIO_gadget.js.xml
0 → 100644
View file @
d07bb10c
This diff is collapsed.
Click to expand it.
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_gadget_erp5_page_list_js.js
View file @
d07bb10c
...
...
@@ -73,9 +73,10 @@
"
editable
"
:
1
,
"
editable_column_list
"
:
[],
"
key
"
:
"
field_listbox
"
,
"
lines
"
:
3
,
"
lines
"
:
15
,
"
list_method
"
:
"
portal_catalog
"
,
"
query
"
:
"
urn:jio:allDocs?query=portal_type%3A%22Data+Array%22+AND+validation_state%3A%22validated%22
"
,
//"query": "urn:jio:allDocs?query=portal_type%3A%22Data+Array%22+AND+validation_state%3A%22validated%22",
"
query
"
:
"
urn:jio:allDocs?query=portal_type%3A%22Data+Array%22
"
,
/*
query: 'portal_type:"Data Array"' +
' AND validation_state:"validated"',
...
...
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_page_module/fif_gadget_erp5_page_list_js.xml
View file @
d07bb10c
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
958.4
1691.17449.16640
</string>
</value>
<value>
<string>
958.4
2869.59925.11741
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
14920
06762.01
</float>
<float>
14920
77486.56
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_wendelin_telecom_UI/PathTemplateItem/web_site_module/fif_data_runner.xml
View file @
d07bb10c
...
...
@@ -349,7 +349,7 @@
</item>
<item>
<key>
<string>
configuration_jio_gadget_url
</string>
</key>
<value>
<string>
gadget_erp5_jio.html
</string>
</value>
<value>
<string>
gadget_erp5_
custom_
jio.html
</string>
</value>
</item>
<item>
<key>
<string>
configuration_panel_gadget_url
</string>
</key>
...
...
@@ -602,7 +602,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
958.4
1308.14150.37444
</string>
</value>
<value>
<string>
958.4
2840.36773.38502
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -620,7 +620,7 @@
</tuple>
<state>
<tuple>
<float>
149
1983934.67
</float>
<float>
149
2075822.42
</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