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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Georgios Dagkakis
erp5
Commits
1622517c
Commit
1622517c
authored
Oct 05, 2016
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_afs_directory: switch from local JSON to fetching remotely from Github
parent
e92290e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
63 deletions
+51
-63
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_afs_storage_js.js
...emplateItem/web_page_module/gadget_erp5_afs_storage_js.js
+48
-60
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_site_module/afs.xml
...js_afs_directory/PathTemplateItem/web_site_module/afs.xml
+3
-3
No files found.
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_afs_storage_js.js
View file @
1622517c
/*
* Copyright 2016, Nexedi SA
* Released under the LGPL license.
* http://www.gnu.org/licenses/lgpl.html
*/
/*jslint nomen: true*/
/*jslint nomen: true*/
/*global jIO, RSVP, DOMParser, Blob */
/*global jIO, RSVP, JSON */
(
function
(
jIO
,
RSVP
,
JSON
)
{
(
function
(
jIO
,
RSVP
,
JSON
,
UriTemplate
)
{
"
use strict
"
;
"
use strict
"
;
var
DOCUMENT_URL
=
"
{document_id}
"
,
document_url_template
=
UriTemplate
.
parse
(
DOCUMENT_URL
);
function
ajax
(
storage
,
options
)
{
if
(
options
===
undefined
)
{
options
=
{};
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
(
options
);
});
}
function
PublisherStorage
(
spec
)
{
function
PublisherStorage
(
spec
)
{
// NOTE: requires Website Layout Configuration CSP modification
// => connect-src 'self' https://raw.githubusercontent.com https://api.github.com data:;
//https://api.github.com/repos/Nexedi/awesome-free-software
//https://api.github.com/repos/Nexedi/awesome-free-software/contents/?ref=master
//https://api.github.com/repos/Nexedi/awesome-free-software/contents/alfresco.json
//https://raw.githubusercontent.com/Nexedi/awesome-free-software/master/alfresco.json
this
.
_href
=
spec
.
href
||
'
https://api.github.com/repos/
'
;
this
.
_user
=
spec
.
user
||
'
Nexedi
'
;
this
.
_repo
=
spec
.
repo
||
'
awesome-free-software
'
;
}
}
PublisherStorage
.
prototype
.
get
=
function
(
id
)
{
PublisherStorage
.
prototype
.
get
=
function
(
id
)
{
var
context
=
this
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
ajax
(
context
,
{
return
jIO
.
util
.
ajax
({
type
:
"
GET
"
,
url
:
id
,
dataType
:
"
text
"
});
type
:
"
GET
"
,
url
:
document_url_template
.
expand
({
document_id
:
id
}),
dataType
:
"
text
"
,
});
})
})
.
push
(
function
(
response
)
{
.
push
(
return
JSON
.
parse
(
response
.
target
.
response
||
response
.
target
.
responseText
);
function
(
response
)
{
},
function
(
error
)
{
return
JSON
.
parse
(
response
.
target
.
response
||
response
.
target
.
responseText
);
if
((
error
.
target
!==
undefined
)
&&
},
(
error
.
target
.
status
===
404
))
{
function
(
error
)
{
throw
new
jIO
.
util
.
jIOError
(
"
Cannot find document
"
,
404
);
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
404
))
{
throw
new
jIO
.
util
.
jIOError
(
"
Cannot find document
"
,
404
);
}
throw
error
;
}
}
throw
error
;
);
});
};
};
PublisherStorage
.
prototype
.
hasCapacity
=
function
(
name
)
{
PublisherStorage
.
prototype
.
hasCapacity
=
function
(
name
)
{
...
@@ -54,32 +42,32 @@
...
@@ -54,32 +42,32 @@
};
};
PublisherStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
PublisherStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
var
context
=
this
,
var
url
=
this
.
_href
+
this
.
_user
+
'
/
'
+
this
.
_repo
+
'
/contents/?ref=master
'
;
rows
=
[];
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
ajax
(
context
,
{
return
jIO
.
util
.
ajax
({
"
type
"
:
"
GET
"
,
"
url
"
:
url
});
type
:
"
GET
"
,
})
url
:
document_url_template
.
expand
({
document_id
:
'
publisher_list.txt
'
})
.
push
(
function
(
data
)
{
});
var
data_list
=
JSON
.
parse
(
data
.
target
.
response
||
data
.
target
.
responseText
),
})
result_list
=
[],
.
push
(
function
(
response
)
{
data_entry
,
var
response_list
=
(
response
.
target
.
response
||
response
.
target
.
responseText
).
split
(
'
\n
'
);
len
,
i
;
for
(
var
entry
in
response_list
)
{
if
(
response_list
[
entry
]
!==
""
)
{
for
(
i
=
0
,
len
=
data_list
.
length
;
i
<
len
;
i
+=
1
)
{
rows
.
push
({
data_entry
=
data_list
[
i
];
id
:
response_list
[
entry
],
if
(
data_entry
.
path
!==
"
README.md
"
)
{
value
:
{}
result_list
.
push
({
});
id
:
data_entry
.
download_url
,
value
:
{}
});
}
}
}
}
return
result_list
;
});
return
rows
;
});
};
};
jIO
.
addStorage
(
'
publisher_storage
'
,
PublisherStorage
);
jIO
.
addStorage
(
'
publisher_storage
'
,
PublisherStorage
);
}(
jIO
,
RSVP
,
JSON
,
UriTemplate
));
}(
jIO
,
RSVP
,
JSON
));
\ No newline at end of file
\ No newline at end of file
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_site_module/afs.xml
View file @
1622517c
...
@@ -337,7 +337,7 @@
...
@@ -337,7 +337,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
configuration_content_security_policy
</string>
</key>
<key>
<string>
configuration_content_security_policy
</string>
</key>
<value>
<string>
default-src \'self\'; img-src \'self\' * data:; media-src \'self\' blob:; connect-src \'self\' data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' data:; frame-src \'self\' data:
</string>
</value>
<value>
<string>
default-src \'self\'; img-src \'self\' * data:; media-src \'self\' blob:; connect-src \'self\'
https://raw.githubusercontent.com https://api.github.com
data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' data:; frame-src \'self\' data:
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
configuration_default_view_action_reference
</string>
</key>
<key>
<string>
configuration_default_view_action_reference
</string>
</key>
...
@@ -614,7 +614,7 @@
...
@@ -614,7 +614,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
3.59466.37233.9915
</string>
</value>
<value>
<string>
95
4.25873.23492.36983
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -632,7 +632,7 @@
...
@@ -632,7 +632,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
3847779.13
</float>
<float>
147
5681337.69
</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