Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
45
Issues
45
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
a6d4b9b4
Commit
a6d4b9b4
authored
Aug 18, 2014
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates and reverts to charts
parent
f106889c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
46 deletions
+40
-46
src/main/java/org/genesys2/server/model/genesys/Taxonomy2.java
...ain/java/org/genesys2/server/model/genesys/Taxonomy2.java
+3
-3
src/main/java/org/genesys2/server/servlet/controller/WiewsController.java
...g/genesys2/server/servlet/controller/WiewsController.java
+4
-3
src/main/java/org/genesys2/spring/config/SpringServletConfig.java
.../java/org/genesys2/spring/config/SpringServletConfig.java
+4
-14
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
+14
-5
src/main/webapp/html/css/custom.css
src/main/webapp/html/css/custom.css
+3
-0
src/main/webapp/html/js/crophub.js
src/main/webapp/html/js/crophub.js
+12
-21
No files found.
src/main/java/org/genesys2/server/model/genesys/Taxonomy2.java
View file @
a6d4b9b4
...
...
@@ -28,15 +28,15 @@ import javax.persistence.PrePersist;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
org.apache.commons.lang3.StringUtils
;
import
org.codehaus.jackson.annotate.JsonIgnore
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.genesys2.server.model.GlobalVersionedAuditedModel
;
import
org.genesys2.server.model.impl.CropTaxonomy
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.search.annotations.Indexed
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
@Entity
// Add index on all fields
@Table
(
name
=
"taxonomy2"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
"genus"
,
"species"
,
"spAuthor"
,
"subtaxa"
,
"subtAuthor"
})
})
...
...
src/main/java/org/genesys2/server/servlet/controller/WiewsController.java
View file @
a6d4b9b4
...
...
@@ -19,6 +19,7 @@ package org.genesys2.server.servlet.controller;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -118,7 +119,7 @@ public class WiewsController extends BaseController {
@RequestMapping
(
value
=
"/{wiewsCode}/stat-genus"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@ResponseBody
public
Object
getGenusStats
(
@PathVariable
(
value
=
"wiewsCode"
)
String
wiewsCode
){
public
List
<
Object
[]>
getGenusStats
(
@PathVariable
(
value
=
"wiewsCode"
)
String
wiewsCode
){
final
FaoInstitute
faoInstitute
=
instituteService
.
getInstitute
(
wiewsCode
);
if
(
faoInstitute
==
null
)
{
throw
new
ResourceNotFoundException
();
...
...
@@ -128,12 +129,12 @@ public class WiewsController extends BaseController {
@RequestMapping
(
value
=
"/{wiewsCode}/stat-species"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@ResponseBody
public
Object
getSpeciesStats
(
@PathVariable
(
value
=
"wiewsCode"
)
String
wiewsCode
){
public
List
<
Object
[]>
getSpeciesStats
(
@PathVariable
(
value
=
"wiewsCode"
)
String
wiewsCode
){
final
FaoInstitute
faoInstitute
=
instituteService
.
getInstitute
(
wiewsCode
);
if
(
faoInstitute
==
null
)
{
throw
new
ResourceNotFoundException
();
}
return
genesysService
.
statisticsSpeciesByInstitute
(
faoInstitute
,
new
PageRequest
(
0
,
1
0
)).
getContent
();
return
genesysService
.
statisticsSpeciesByInstitute
(
faoInstitute
,
new
PageRequest
(
0
,
2
0
)).
getContent
();
}
@RequestMapping
(
"/{wiewsCode}/datasets"
)
...
...
src/main/java/org/genesys2/spring/config/SpringServletConfig.java
View file @
a6d4b9b4
...
...
@@ -16,7 +16,10 @@
package
org.genesys2.spring.config
;
import
java.util.*
;
import
java.util.HashSet
;
import
java.util.Locale
;
import
java.util.Properties
;
import
java.util.Set
;
import
org.genesys2.spring.AddStuffInterceptor
;
import
org.genesys2.spring.BetterSessionLocaleResolver
;
...
...
@@ -30,8 +33,6 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.context.support.ResourceBundleMessageSource
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
;
import
org.springframework.validation.Validator
;
import
org.springframework.web.servlet.ViewResolver
;
import
org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer
;
...
...
@@ -63,17 +64,6 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"/html/"
);
}
@Override
public
void
configureMessageConverters
(
List
<
HttpMessageConverter
<?>>
converters
)
{
converters
.
add
(
converter
());
}
@Bean
public
MappingJacksonHttpMessageConverter
converter
()
{
MappingJacksonHttpMessageConverter
converter
=
new
MappingJacksonHttpMessageConverter
();
return
converter
;
}
@Bean
public
ViewResolver
viewResolver
()
{
final
org
.
springframework
.
web
.
servlet
.
view
.
InternalResourceViewResolver
resolver
=
new
org
.
springframework
.
web
.
servlet
.
view
.
InternalResourceViewResolver
();
...
...
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
View file @
a6d4b9b4
...
...
@@ -128,7 +128,9 @@
<div
class=
"col-sm-6"
>
<h4><spring:message
code=
"faoInstitute.stat-by-genus"
arguments=
"
${
statisticsGenus
.
numberOfElements
}
"
/></h4>
<div
id=
"chartStatsByGenus"
style=
"height:300px"
></div>
<div
class=
"chart chart-pie"
>
<div
id=
"chartStatsByGenus"
style=
"height:300px;"
></div>
</div>
<ul
class=
"funny-list statistics"
>
<c:forEach
items=
"
${
statisticsGenus
.
content
}
"
var=
"stat"
varStatus=
"status"
>
...
...
@@ -140,7 +142,9 @@
<div
class=
"col-sm-6"
>
<h4><spring:message
code=
"faoInstitute.stat-by-species"
arguments=
"
${
statisticsTaxonomy
.
numberOfElements
}
"
/></h4>
<div
id=
"chartStatsBySpecies"
style=
"height:300px"
></div>
<div
class=
"chart chart-pie"
>
<div
id=
"chartStatsBySpecies"
style=
"height:300px"
></div>
</div>
<ul
class=
"funny-list statistics"
>
<c:forEach
items=
"
${
statisticsTaxonomy
.
content
}
"
var=
"stat"
varStatus=
"status"
>
...
...
@@ -171,7 +175,12 @@
minZoom
:
4
,
maxZoom
:
6
,
/* WIEWS does not provide enough detail */
center
:
new
GenesysMaps
.
LatLng
(
$
{
faoInstitute
.
latitude
},
$
{
faoInstitute
.
longitude
}),
markerTitle
:
"
<spring:escapeBody
javaScriptEscape=
"true"
>
${faoInstitute.fullName}
</spring:escapeBody>
"
markerTitle
:
"
<spring:escapeBody
javaScriptEscape=
"true"
>
${faoInstitute.fullName}
</spring:escapeBody>
"
,
scrollWheelZoom
:
false
,
touchZoom
:
false
,
dragging
:
false
,
doubleClickZoom
:
false
,
boxZoom
:
false
});
});
</script>
...
...
@@ -182,8 +191,8 @@
</script>
<script>
jQuery
(
document
).
ready
(
function
()
{
GenesysChart
.
chart
(
"
#chartStatsByGenus
"
,
"
/wiews/${faoInstitute.code}/stat-genus
"
,
null
);
GenesysChart
.
chart
(
"
#chartStatsBySpecies
"
,
"
/wiews/${faoInstitute.code}/stat-species
"
,
null
);
GenesysChart
.
chart
(
"
#chartStatsByGenus
"
,
"
/wiews/${faoInstitute.code}/stat-genus
"
,
null
,
null
,
function
(
genus
)
{
window
.
location
=
window
.
location
.
pathname
+
"
/t/
"
+
genus
;
}
);
GenesysChart
.
chart
(
"
#chartStatsBySpecies
"
,
"
/wiews/${faoInstitute.code}/stat-species
"
,
null
,
function
(
taxonomy
)
{
return
taxonomy
.
taxonName
;
},
function
(
taxonomy
)
{
window
.
location
=
window
.
location
.
pathname
+
"
/t/
"
+
taxonomy
.
genus
+
"
/
"
+
taxonomy
.
species
;
}
);
});
</script>
</content>
...
...
src/main/webapp/html/css/custom.css
View file @
a6d4b9b4
...
...
@@ -1959,3 +1959,6 @@ html[dir="rtl"] ul.statistics .stats-number {
padding
:
0px
8px
;
}
.chart.chart-pie
{
padding
:
10px
;
}
\ No newline at end of file
src/main/webapp/html/js/crophub.js
View file @
a6d4b9b4
...
...
@@ -97,7 +97,7 @@ GenesysMaps.BoundingBox.prototype.getBounds = function() {
};
GenesysChart
=
{
chart
:
function
(
placeholder
,
url
,
options
)
{
chart
:
function
(
placeholder
,
url
,
options
,
labelCallback
,
clickCallback
)
{
var
defaultOptions
=
{
series
:
{
...
...
@@ -117,14 +117,12 @@ GenesysChart = {
}
};
if
(
options
!=
null
){
defaultOptions
=
options
;
}
var
opts
=
$
.
extend
(
true
,
defaultOptions
,
options
);
$
.
ajax
(
url
,
{
success
:
function
(
data
)
{
$
.
plot
(
$
(
placeholder
),
GenesysChart
.
makeDataForFlot
(
data
),
defaultOption
s
);
$
.
plot
(
$
(
placeholder
),
GenesysChart
.
makeDataForFlot
(
data
,
labelCallback
),
opt
s
);
$
(
"
<div class='tooltip-chart'></div>
"
).
css
({
position
:
"
absolute
"
,
...
...
@@ -159,15 +157,8 @@ GenesysChart = {
});
$
(
placeholder
).
bind
(
"
plotclick
"
,
function
(
event
,
pos
,
obj
)
{
if
(
obj
!=
null
)
{
var
params
=
obj
.
series
.
label
.
split
(
"
"
);
if
(
typeof
params
[
1
]
!=
"
undefined
"
)
{
window
.
location
.
replace
(
window
.
location
.
href
+
"
/t/
"
+
params
[
0
]
+
"
/
"
+
params
[
1
]);
}
else
{
window
.
location
.
replace
(
window
.
location
.
href
+
"
/t/
"
+
params
[
0
]);
}
if
(
obj
!=
null
&&
obj
.
series
.
labelSource
!=
null
&&
clickCallback
!=
null
)
{
return
clickCallback
(
obj
.
series
.
labelSource
);
}
});
},
...
...
@@ -177,19 +168,19 @@ GenesysChart = {
});
},
makeDataForFlot
:
function
(
data
)
{
makeDataForFlot
:
function
(
data
,
labelCallback
)
{
var
dataFlot
=
[];
$
.
each
(
data
,
function
(
idx
,
statistic
)
{
var
label
;
if
(
typeof
statistic
[
0
]
==
"
object
"
){
label
=
statistic
[
0
][
"
taxonName
"
];
}
else
if
(
typeof
statistic
[
0
]
==
"
string
"
){
label
=
statistic
[
0
];
}
if
(
statistic
[
0
]
!=
null
&&
labelCallback
!=
null
)
{
label
=
labelCallback
(
statistic
[
0
]);
}
else
if
(
typeof
statistic
[
0
]
==
"
string
"
)
{
label
=
statistic
[
0
];
}
dataFlot
[
idx
]
=
{
labelSource
:
statistic
[
0
],
label
:
label
,
data
:
statistic
[
1
]
}
...
...
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