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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
c9e807eb
Commit
c9e807eb
authored
May 29, 2017
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_afs_directory: add publisher and statistics gadgets
parent
b8032709
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1496 additions
and
0 deletions
+1496
-0
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_statistic_html.html
...module/gadget_erp5_page_afs_publisher_statistic_html.html
+23
-0
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_statistic_html.xml
..._module/gadget_erp5_page_afs_publisher_statistic_html.xml
+322
-0
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_statistic_js.js
...age_module/gadget_erp5_page_afs_publisher_statistic_js.js
+93
-0
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_statistic_js.xml
...ge_module/gadget_erp5_page_afs_publisher_statistic_js.xml
+318
-0
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_unsplash_html.html
...m/web_page_module/gadget_erp5_page_afs_unsplash_html.html
+31
-0
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_unsplash_html.xml
...em/web_page_module/gadget_erp5_page_afs_unsplash_html.xml
+322
-0
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_unsplash_js.js
...eItem/web_page_module/gadget_erp5_page_afs_unsplash_js.js
+69
-0
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_unsplash_js.xml
...Item/web_page_module/gadget_erp5_page_afs_unsplash_js.xml
+318
-0
No files found.
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_statistic_html.html
0 → 100644
View file @
c9e807eb
<!Doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Free Software Publisher Statistics
</title>
<link
rel=
"stylesheet"
href=
"gadget_erp5_afs.css"
/>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_global.js"
></script>
<script
src=
"gadget_erp5_page_afs_publisher_statistic.js"
></script>
</head>
<body>
<div
data-gadget-url=
"gadget_erp5_pt_form_list.html"
data-gadget-scope=
"form_list"
data-gadget-sandbox=
"public"
>
</div>
</body>
</html>
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_statistic_html.xml
0 → 100644
View file @
c9e807eb
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_statistic_js.js
0 → 100644
View file @
c9e807eb
/*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
,
RSVP
,
rJS
)
{
"
use strict
"
;
var
SORT_STRING
=
'
field_listbox_sort_list:json
'
;
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
.
declareAcquiredMethod
(
"
translate
"
,
"
translate
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
allowPublicAcquisition
(
'
updateHeader
'
,
function
()
{
return
;
})
.
allowPublicAcquisition
(
'
getUrlParameter
'
,
function
(
argument_list
)
{
return
this
.
getUrlParameter
(
argument_list
)
.
push
(
function
(
result
)
{
if
((
result
===
undefined
)
&&
(
argument_list
[
0
]
===
SORT_STRING
))
{
return
[[
'
lines
'
,
'
descending
'
]];
}
return
result
;
});
})
.
declareMethod
(
"
render
"
,
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
updateHeader
({
page_title
:
"
Statistics
"
});
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
"
form_list
"
);
})
.
push
(
function
(
form_gadget
)
{
var
column_list
=
[
[
'
title
'
,
'
Title
'
],
[
'
country
'
,
'
Country
'
],
[
'
lines
'
,
'
Total Lines of Code
'
]
],
sort_column_list
=
[
[
'
lines
'
,
'
Total Lines of Code
'
]
];
return
form_gadget
.
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
listbox
"
:
{
"
column_list
"
:
column_list
,
"
show_anchor
"
:
0
,
"
default_params
"
:
{},
"
editable
"
:
0
,
"
key
"
:
"
field_listbox
"
,
"
lines
"
:
20
,
"
list_method
"
:
"
portal_catalog
"
,
"
query
"
:
'
urn:jio:allDocs?query=
'
+
'
portal_type:"publisher"
'
,
"
portal_type
"
:
[],
"
search_column_list
"
:
column_list
,
"
sort_column_list
"
:
sort_column_list
,
"
sort_on
"
:
[
"
lines
"
,
"
descending
"
],
"
title
"
:
"
Documents
"
,
"
type
"
:
"
ListBox
"
}
}},
"
_links
"
:
{
"
type
"
:
{
// form_list display portal_type in header
name
:
""
}
}
},
form_definition
:
{
group_list
:
[
[
"
bottom
"
,
[[
"
listbox
"
]]],
[
"
hidden
"
,
[
"
listbox_modification_date
"
]]
]
}
});
});
});
}(
window
,
RSVP
,
rJS
));
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_statistic_js.xml
0 → 100644
View file @
c9e807eb
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_unsplash_html.html
0 → 100644
View file @
c9e807eb
<!Doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Unsplash Banner Image
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"handlebars.js"
></script>
<script
src=
"jiodev.js"
></script>
<script
src=
"gadget_erp5_page_afs_unsplash.js"
></script>
<!-- templates -->
<script
id=
"banner-template"
type=
"text/x-handlebars-template"
>
<
section
class
=
"
ui-banner-section
"
>
<
h1
>
{{
message
}}
<
/h1
>
<
img
src
=
"
{{src}}
"
alt
=
"
{{alt}}
"
/>
<
span
>
Photo
by
<
a
target
=
"
_blank
"
href
=
"
{{source_url}}
"
>
{{
source_title
}}
<
/a
>
&
nbsp
;
/ 
;
<
a
target
=
"
_blank
"
href
=
"
{{unsplash_url}}
"
>
Unsplash
<
/a
>
<
/span
>
<
/section
>
</script>
</head>
<body></body>
</html>
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_unsplash_html.xml
0 → 100644
View file @
c9e807eb
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_unsplash_js.js
0 → 100644
View file @
c9e807eb
/*globals window, RSVP, rJS, Handlebars, jIO*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
,
RSVP
,
rJS
,
Handlebars
,
jIO
)
{
"
use strict
"
;
// UNSPLASH API
// API: https://unsplash.com/documentation#creating-a-developer-account
var
CID
=
"
3196c4c1a2915c32bd9ca6ba5a88cec7555e06eb7e580546018f079394e9954f
"
,
TOKEN
=
"
&client_id=
"
+
CID
,
// UNSPLAH GUIDELINE
// https://community.unsplash.com/developersblog/unsplash-api-guidelines
UTM
=
"
?utm_source=AFS&utm_medium=referral&utm_campaign=api-credit
"
,
gadget_klass
=
rJS
(
window
),
templater
=
gadget_klass
.
__template_element
,
source
=
templater
.
getElementById
(
"
banner-template
"
).
innerHTML
,
template
=
Handlebars
.
compile
(
source
);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
.
ready
(
function
(
my_gadget
)
{
my_gadget
.
property_dict
=
{};
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
()
{
// not much to do, but unsplash would also allow to query for
// random images, so just search for free + software and
// display first result
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
({
type
:
"
GET
"
,
headers
:
{
"
Accept-Version
"
:
"
v1
"
},
url
:
"
https://api.unsplash.com/photos/MTJxRri1UiI
"
+
UTM
+
TOKEN
});
})
.
push
(
function
(
my_response
)
{
var
is_response
=
my_response
.
target
.
response
||
my_response
.
target
.
responseText
,
image_dict
;
if
(
is_response
)
{
image_dict
=
JSON
.
parse
(
is_response
);
//gadget.element.innerHTML =
// I don't need the gadget hooray, just the container, so sorry.
return
template
({
"
message
"
:
"
What can Free Software do for you?
"
,
"
src
"
:
image_dict
.
urls
.
full
+
UTM
,
"
alt
"
:
"
Free Software
"
,
"
source_url
"
:
image_dict
.
user
.
links
.
html
+
UTM
,
"
source_title
"
:
image_dict
.
user
.
name
,
"
unsplash_url
"
:
"
https://unsplash.com/
"
+
UTM
});
}
});
});
}(
window
,
RSVP
,
rJS
,
Handlebars
,
jIO
));
bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_unsplash_js.xml
0 → 100644
View file @
c9e807eb
This diff is collapsed.
Click to expand it.
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