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
13
Issues
13
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
f106889c
Commit
f106889c
authored
Aug 15, 2014
by
igoshin
Committed by
Matija Obreza
Aug 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#13778 Add chart for species,code moved to crophub.js
parent
3b75c161
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
72 deletions
+125
-72
src/main/java/org/genesys2/server/model/genesys/Taxonomy2.java
...ain/java/org/genesys2/server/model/genesys/Taxonomy2.java
+5
-0
src/main/java/org/genesys2/spring/config/SpringServletConfig.java
.../java/org/genesys2/spring/config/SpringServletConfig.java
+14
-4
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
+4
-68
src/main/webapp/html/js/crophub.js
src/main/webapp/html/js/crophub.js
+102
-0
No files found.
src/main/java/org/genesys2/server/model/genesys/Taxonomy2.java
View file @
f106889c
...
@@ -28,7 +28,10 @@ import javax.persistence.PrePersist;
...
@@ -28,7 +28,10 @@ import javax.persistence.PrePersist;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
javax.persistence.UniqueConstraint
;
import
org.apache.commons.lang3.StringUtils
;
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.GlobalVersionedAuditedModel
;
import
org.genesys2.server.model.impl.CropTaxonomy
;
import
org.genesys2.server.model.impl.CropTaxonomy
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.annotations.Type
;
...
@@ -38,6 +41,7 @@ import org.hibernate.search.annotations.Indexed;
...
@@ -38,6 +41,7 @@ import org.hibernate.search.annotations.Indexed;
// Add index on all fields
// Add index on all fields
@Table
(
name
=
"taxonomy2"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
"genus"
,
"species"
,
"spAuthor"
,
"subtaxa"
,
"subtAuthor"
})
})
@Table
(
name
=
"taxonomy2"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
"genus"
,
"species"
,
"spAuthor"
,
"subtaxa"
,
"subtAuthor"
})
})
@Indexed
@Indexed
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
Taxonomy2
extends
GlobalVersionedAuditedModel
{
public
class
Taxonomy2
extends
GlobalVersionedAuditedModel
{
private
static
final
long
serialVersionUID
=
8881324404490162933L
;
private
static
final
long
serialVersionUID
=
8881324404490162933L
;
...
@@ -66,6 +70,7 @@ public class Taxonomy2 extends GlobalVersionedAuditedModel {
...
@@ -66,6 +70,7 @@ public class Taxonomy2 extends GlobalVersionedAuditedModel {
private
Long
taxSpecies
;
private
Long
taxSpecies
;
@JsonIgnore
@OneToMany
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
,
mappedBy
=
"taxonomy"
)
@OneToMany
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
,
mappedBy
=
"taxonomy"
)
private
List
<
CropTaxonomy
>
cropTaxonomies
;
private
List
<
CropTaxonomy
>
cropTaxonomies
;
...
...
src/main/java/org/genesys2/spring/config/SpringServletConfig.java
View file @
f106889c
...
@@ -16,10 +16,7 @@
...
@@ -16,10 +16,7 @@
package
org.genesys2.spring.config
;
package
org.genesys2.spring.config
;
import
java.util.HashSet
;
import
java.util.*
;
import
java.util.Locale
;
import
java.util.Properties
;
import
java.util.Set
;
import
org.genesys2.spring.AddStuffInterceptor
;
import
org.genesys2.spring.AddStuffInterceptor
;
import
org.genesys2.spring.BetterSessionLocaleResolver
;
import
org.genesys2.spring.BetterSessionLocaleResolver
;
...
@@ -33,6 +30,8 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
...
@@ -33,6 +30,8 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.context.support.ResourceBundleMessageSource
;
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.validation.Validator
;
import
org.springframework.web.servlet.ViewResolver
;
import
org.springframework.web.servlet.ViewResolver
;
import
org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer
;
import
org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer
;
...
@@ -64,6 +63,17 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
...
@@ -64,6 +63,17 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"/html/"
);
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
@Bean
public
ViewResolver
viewResolver
()
{
public
ViewResolver
viewResolver
()
{
final
org
.
springframework
.
web
.
servlet
.
view
.
InternalResourceViewResolver
resolver
=
new
org
.
springframework
.
web
.
servlet
.
view
.
InternalResourceViewResolver
();
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 @
f106889c
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
<div
class=
""
>
<div
class=
""
>
<security:authorize
access=
"hasRole('ADMINISTRATOR') or hasPermission(#faoInstitute, 'ADMINISTRATION')"
>
<security:authorize
access=
"hasRole('ADMINISTRATOR') or hasPermission(#faoInstitute, 'ADMINISTRATION')"
>
<
a
href=
"
<c:url
value=
"/acl/${faoInstitute.class.name}/${faoInstitute.id}/permissions"
><c:param
name=
"back"
>
/wiews/${faoInstitute.code}
</c:param></c:url>
"
class=
"close"
>
<spring:message
code=
"edit-acl"
/></a
>
<
%--<a href="<c:url value="/acl/${faoInstitute.class.name}/${faoInstitute.id}/permissions"><c:param name="back">/wiews/${faoInstitute.code}</c:param></c:url>" class="close"> <spring:message code="edit-acl" /></a>--%
>
<a
href=
"
<c:url
value=
"/wiews/${faoInstitute.code}/edit"
/>
"
class=
"close"
>
<a
href=
"
<c:url
value=
"/wiews/${faoInstitute.code}/edit"
/>
"
class=
"close"
>
<spring:message
code=
"edit"
/>
<spring:message
code=
"edit"
/>
</a>
</a>
...
@@ -181,73 +181,9 @@
...
@@ -181,73 +181,9 @@
_pageDim
=
{
institute
:
'
${faoInstitute.code}
'
};
_pageDim
=
{
institute
:
'
${faoInstitute.code}
'
};
</script>
</script>
<script>
<script>
jQuery
(
document
).
ready
(
function
()
{
jQuery
(
document
).
ready
(
function
()
{
GenesysChart
.
chart
(
"
#chartStatsByGenus
"
,
"
/wiews/${faoInstitute.code}/stat-genus
"
,
null
);
function
makeDataForFlot
(
data
){
GenesysChart
.
chart
(
"
#chartStatsBySpecies
"
,
"
/wiews/${faoInstitute.code}/stat-species
"
,
null
);
var
dataFlot
=
[];
var
other
=
0
;
$
.
each
(
data
,
function
(
idx
,
statistic
)
{
dataFlot
[
idx
]
=
{
label
:
statistic
[
0
],
data
:
statistic
[
1
]
}
});
return
dataFlot
;
}
$
.
ajax
(
"
/wiews/${faoInstitute.code}/stat-genus
"
,
{
success
:
function
(
data
)
{
var
placeholder
=
$
(
'
#chartStatsByGenus
'
);
$
(
"
<div id='tooltip'></div>
"
).
css
({
position
:
"
absolute
"
,
display
:
"
none
"
,
border
:
"
1px solid #929292
"
,
padding
:
"
2px
"
,
"
background-color
"
:
"
#929292
"
,
opacity
:
0.80
}).
appendTo
(
"
body
"
);
$
.
plot
(
placeholder
,
makeDataForFlot
(
data
),
{
series
:
{
pie
:
{
show
:
true
,
label
:
{
show
:
false
}
}
},
grid
:
{
hoverable
:
true
,
clickable
:
true
},
legend
:
{
show
:
false
}
});
placeholder
.
bind
(
"
plothover
"
,
function
(
event
,
pos
,
obj
)
{
if
(
obj
!=
null
)
{
var
str
=
obj
.
series
.
label
+
"
(
"
+
obj
.
datapoint
[
1
][
0
][
1
]
+
"
)
"
;
$
(
"
#hoverdata
"
).
text
(
str
);
$
(
"
#tooltip
"
).
html
(
str
)
.
css
({
top
:
pos
.
pageY
-
25
,
left
:
pos
.
pageX
+
5
})
.
show
();
}
else
{
$
(
"
#tooltip
"
).
hide
();
}
});
placeholder
.
bind
(
"
plotclick
"
,
function
(
event
,
pos
,
obj
)
{
if
(
obj
!=
null
)
{
window
.
location
.
replace
(
window
.
location
.
href
+
"
/t/
"
+
obj
.
series
.
label
);
}
});
},
error
:
function
(
error
)
{
console
.
log
(
error
);
}
});
});
});
</script>
</script>
</content>
</content>
...
...
src/main/webapp/html/js/crophub.js
View file @
f106889c
...
@@ -96,6 +96,108 @@ GenesysMaps.BoundingBox.prototype.getBounds = function() {
...
@@ -96,6 +96,108 @@ GenesysMaps.BoundingBox.prototype.getBounds = function() {
return
[[
this
.
west
,
this
.
south
],[
this
.
east
,
this
.
north
]];
return
[[
this
.
west
,
this
.
south
],[
this
.
east
,
this
.
north
]];
};
};
GenesysChart
=
{
chart
:
function
(
placeholder
,
url
,
options
)
{
var
defaultOptions
=
{
series
:
{
pie
:
{
show
:
true
,
label
:
{
show
:
false
}
}
},
grid
:
{
hoverable
:
true
,
clickable
:
true
},
legend
:
{
show
:
false
}
};
if
(
options
!=
null
){
defaultOptions
=
options
;
}
$
.
ajax
(
url
,
{
success
:
function
(
data
)
{
$
.
plot
(
$
(
placeholder
),
GenesysChart
.
makeDataForFlot
(
data
),
defaultOptions
);
$
(
"
<div class='tooltip-chart'></div>
"
).
css
({
position
:
"
absolute
"
,
display
:
"
none
"
,
border
:
"
1px solid #929292
"
,
padding
:
"
2px
"
,
"
background-color
"
:
"
#929292
"
,
opacity
:
0.80
}).
appendTo
(
placeholder
);
$
(
placeholder
).
bind
(
"
plothover
"
,
function
(
event
,
pos
,
obj
)
{
if
(
obj
!=
null
)
{
var
height
=
$
(
placeholder
).
height
();
var
width
=
$
(
placeholder
).
width
();
var
radius
=
obj
.
series
.
pie
.
label
.
radius
+
99
;
var
halfAngle
=
((
obj
.
series
.
startAngle
+
obj
.
series
.
angle
)
+
obj
.
series
.
startAngle
)
/
2
;
var
x
=
width
/
2
+
Math
.
round
(
Math
.
cos
(
halfAngle
)
*
radius
);
var
y
=
height
/
2
+
Math
.
round
(
Math
.
sin
(
halfAngle
)
*
radius
);
var
str
=
obj
.
series
.
label
+
"
(
"
+
obj
.
datapoint
[
1
][
0
][
1
]
+
"
)
"
;
$
(
$
(
this
).
find
(
"
.tooltip-chart
"
)).
html
(
str
)
.
css
({
top
:
y
,
left
:
x
})
.
show
();
}
else
{
$
(
$
(
this
).
find
(
"
.tooltip-chart
"
)).
hide
();
}
});
$
(
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
]);
}
}
});
},
error
:
function
(
error
)
{
console
.
log
(
error
);
}
});
},
makeDataForFlot
:
function
(
data
)
{
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
];
}
dataFlot
[
idx
]
=
{
label
:
label
,
data
:
statistic
[
1
]
}
});
return
dataFlot
;
}
};
GenesysFilter
=
{
GenesysFilter
=
{
normKey
:
function
(
key
)
{
normKey
:
function
(
key
)
{
return
key
.
replace
(
'
.
'
,
'
-
'
).
replace
(
'
:
'
,
'
_
'
);
return
key
.
replace
(
'
.
'
,
'
-
'
).
replace
(
'
:
'
,
'
_
'
);
...
...
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