Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
ad052e8e
Commit
ad052e8e
authored
Jan 28, 2014
by
Matija Obreza
Browse files
Mark picked accessions with JS
parent
581d0ae3
Changes
17
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/servlet/controller/AccessionController.java
View file @
ad052e8e
...
...
@@ -28,7 +28,6 @@ import org.genesys2.server.service.InstituteService;
import
org.genesys2.server.service.TaxonomyService
;
import
org.genesys2.spring.ResourceNotFoundException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -39,13 +38,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
@Controller
@Scope
(
"request"
)
@RequestMapping
(
"/acn"
)
public
class
AccessionController
extends
BaseController
{
@Autowired
private
SelectionBean
selectionBean
;
@Autowired
private
InstituteService
instituteService
;
...
...
@@ -81,8 +76,6 @@ public class AccessionController extends BaseController {
model
.
addAttribute
(
"crops"
,
cropService
.
getCrops
(
accession
.
getTaxonomy
()));
model
.
addAttribute
(
"selection"
,
selectionBean
);
return
"/accession/details"
;
}
...
...
@@ -137,7 +130,6 @@ public class AccessionController extends BaseController {
Page
<
Accession
>
accessions
=
genesysService
.
listAccessions
(
new
PageRequest
(
page
-
1
,
50
,
new
Sort
(
"accessionName"
)));
_logger
.
info
(
"Got: "
+
accessions
);
model
.
addAttribute
(
"pagedData"
,
accessions
);
model
.
addAttribute
(
"selection"
,
selectionBean
);
return
"/accession/data"
;
}
...
...
@@ -164,7 +156,6 @@ public class AccessionController extends BaseController {
_logger
.
info
(
"Got: "
+
accessions
);
model
.
addAttribute
(
"pagedData"
,
accessions
);
model
.
addAttribute
(
"selection"
,
selectionBean
);
return
"/accession/data"
;
}
...
...
@@ -196,7 +187,6 @@ public class AccessionController extends BaseController {
_logger
.
info
(
"Got: "
+
accessions
);
model
.
addAttribute
(
"pagedData"
,
accessions
);
model
.
addAttribute
(
"selection"
,
selectionBean
);
if
(
taxonomy
!=
null
)
{
model
.
addAttribute
(
"jsonFilter"
,
"{\"taxon\":[\""
+
taxonomy
.
getTaxonName
()
+
"\"]}"
);
...
...
src/main/java/org/genesys2/server/servlet/controller/CountryController.java
View file @
ad052e8e
...
...
@@ -27,7 +27,6 @@ import org.genesys2.server.service.GeoService;
import
org.genesys2.server.service.InstituteService
;
import
org.genesys2.spring.ResourceNotFoundException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -38,13 +37,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
@Controller
@Scope
(
"request"
)
@RequestMapping
(
"/geo"
)
public
class
CountryController
extends
BaseController
{
@Autowired
private
SelectionBean
selectionBean
;
@Autowired
private
GeoService
geoService
;
...
...
@@ -129,8 +124,6 @@ public class CountryController extends BaseController {
}
model
.
addAttribute
(
"pagedData"
,
genesysService
.
listAccessionsByOrigin
(
country
,
new
PageRequest
(
page
-
1
,
50
,
new
Sort
(
"accessionName"
))));
model
.
addAttribute
(
"selection"
,
selectionBean
);
HashMap
<
Object
,
Object
>
filters
=
new
HashMap
<
Object
,
Object
>();
filters
.
put
(
"filter.countryOfOrigin"
,
country
);
...
...
src/main/java/org/genesys2/server/servlet/controller/CropController.java
View file @
ad052e8e
...
...
@@ -31,7 +31,6 @@ import org.genesys2.server.service.GenesysService;
import
org.genesys2.server.service.TraitService
;
import
org.genesys2.spring.ResourceNotFoundException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -43,13 +42,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
@Controller
@Scope
(
"request"
)
@RequestMapping
(
"/c"
)
public
class
CropController
extends
BaseController
{
@Autowired
private
SelectionBean
selectionBean
;
@Autowired
private
CropService
cropService
;
...
...
@@ -116,7 +111,6 @@ public class CropController extends BaseController {
_logger
.
info
(
"Got: "
+
accessions
);
model
.
addAttribute
(
"pagedData"
,
accessions
);
model
.
addAttribute
(
"selection"
,
selectionBean
);
model
.
addAttribute
(
"jsonFilter"
,
"{\"crop\":[\""
+
crop
.
getShortName
()
+
"\"]}"
);
return
"/accession/data"
;
...
...
src/main/java/org/genesys2/server/servlet/controller/DatasetController.java
View file @
ad052e8e
...
...
@@ -29,7 +29,6 @@ import org.genesys2.server.service.GenesysService;
import
org.genesys2.server.service.InstituteService
;
import
org.genesys2.spring.ResourceNotFoundException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -44,13 +43,9 @@ import org.springframework.web.bind.annotation.RequestParam;
* Controller which simply handles *.html requests
*/
@Controller
@Scope
(
"request"
)
@RequestMapping
(
"/data"
)
public
class
DatasetController
extends
BaseController
{
@Autowired
private
SelectionBean
selectionBean
;
@Autowired
private
GenesysService
genesysService
;
...
...
@@ -89,8 +84,6 @@ public class DatasetController extends BaseController {
// Map[accession.id][method.id]
model
.
addAttribute
(
"accessionMethods"
,
genesysService
.
getMetadataTraitValues
(
metadata
,
accessions
.
getContent
()));
model
.
addAttribute
(
"selection"
,
selectionBean
);
return
"/metadata/view"
;
}
...
...
src/main/java/org/genesys2/server/servlet/controller/FilterController.java
View file @
ad052e8e
...
...
@@ -26,7 +26,6 @@ import org.genesys2.server.service.GenesysService;
import
org.genesys2.server.service.InstituteService
;
import
org.genesys2.server.service.TaxonomyService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -39,13 +38,9 @@ import com.fasterxml.jackson.databind.JsonNode;
import
com.fasterxml.jackson.databind.ObjectMapper
;
@Controller
@Scope
(
"request"
)
@RequestMapping
(
"/acn"
)
public
class
FilterController
extends
BaseController
{
@Autowired
private
SelectionBean
selectionBean
;
@Autowired
private
InstituteService
instituteService
;
...
...
@@ -119,7 +114,6 @@ public class FilterController extends BaseController {
_logger
.
info
(
"Got: "
+
accessions
);
model
.
addAttribute
(
"pagedData"
,
accessions
);
model
.
addAttribute
(
"selection"
,
selectionBean
);
return
"/accession/data"
;
}
...
...
src/main/java/org/genesys2/server/servlet/controller/OrganizationController.java
View file @
ad052e8e
...
...
@@ -32,7 +32,6 @@ import org.genesys2.server.service.OrganizationService;
import
org.genesys2.server.service.TaxonomyService
;
import
org.genesys2.spring.ResourceNotFoundException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -44,13 +43,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
@Controller
@Scope
(
"request"
)
@RequestMapping
(
"/org"
)
public
class
OrganizationController
extends
BaseController
{
@Autowired
private
SelectionBean
selectionBean
;
@Autowired
private
OrganizationService
organizationService
;
...
...
@@ -166,7 +161,6 @@ public class OrganizationController extends BaseController {
_logger
.
info
(
"Got: "
+
accessions
);
model
.
addAttribute
(
"pagedData"
,
accessions
);
model
.
addAttribute
(
"selection"
,
selectionBean
);
HashMap
<
Object
,
Object
>
filters
=
new
HashMap
<
Object
,
Object
>();
filters
.
put
(
"filter.organization"
,
organization
);
...
...
src/main/java/org/genesys2/server/servlet/controller/SearchController.java
View file @
ad052e8e
...
...
@@ -36,9 +36,6 @@ import org.springframework.web.bind.annotation.RequestParam;
public
class
SearchController
{
public
static
final
Log
LOG
=
LogFactory
.
getLog
(
SearchController
.
class
);
@Autowired
private
SelectionBean
selectionBean
;
@Autowired
SearchService
searchService
;
...
...
@@ -66,7 +63,6 @@ public class SearchController {
AccessionAlias
.
class
);
model
.
addAttribute
(
"pagedData"
,
x
);
}
model
.
addAttribute
(
"selection"
,
selectionBean
);
return
"/search/accessions"
;
}
...
...
src/main/java/org/genesys2/server/servlet/controller/SelectionController.java
View file @
ad052e8e
...
...
@@ -18,6 +18,7 @@ package org.genesys2.server.servlet.controller;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
org.genesys2.server.model.genesys.Accession
;
import
org.genesys2.server.model.genesys.AccessionGeo
;
...
...
@@ -103,6 +104,20 @@ public class SelectionController extends BaseController {
return
"redirect:/sel/"
;
}
// TODO REMOVE
@RequestMapping
(
value
=
"/json/count"
,
method
=
RequestMethod
.
GET
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@ResponseBody
public
Long
selectionCount
()
{
return
(
long
)
selectionBean
.
size
();
}
@RequestMapping
(
value
=
"/json/selection"
,
method
=
RequestMethod
.
GET
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@ResponseBody
public
Set
<
Long
>
selection
()
{
return
selectionBean
.
copy
();
}
@RequestMapping
(
value
=
"/json/geo"
,
method
=
RequestMethod
.
GET
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@ResponseBody
public
List
<
AccessionGeoJson
>
selectionGeo
()
{
...
...
src/main/java/org/genesys2/server/servlet/controller/WiewsController.java
View file @
ad052e8e
...
...
@@ -48,9 +48,6 @@ import org.springframework.web.bind.annotation.RequestParam;
@RequestMapping
(
"/wiews"
)
public
class
WiewsController
extends
BaseController
{
@Autowired
private
SelectionBean
selectionBean
;
@Autowired
private
InstituteService
instituteService
;
...
...
@@ -159,7 +156,6 @@ public class WiewsController extends BaseController {
_logger
.
info
(
"Got: "
+
accessions
);
model
.
addAttribute
(
"pagedData"
,
accessions
);
model
.
addAttribute
(
"selection"
,
selectionBean
);
HashMap
<
Object
,
Object
>
filters
=
new
HashMap
<
Object
,
Object
>();
filters
.
put
(
"filter.holdingInstitute"
,
faoInstitute
);
...
...
@@ -189,8 +185,6 @@ public class WiewsController extends BaseController {
_logger
.
info
(
"Got: "
+
accessions
);
model
.
addAttribute
(
"pagedData"
,
accessions
);
model
.
addAttribute
(
"selection"
,
selectionBean
);
HashMap
<
Object
,
Object
>
filters
=
new
HashMap
<
Object
,
Object
>();
filters
.
put
(
"filter.taxonomy"
,
taxonomy
);
filters
.
put
(
"filter.holdingInstitute"
,
faoInstitute
);
...
...
src/main/webapp/WEB-INF/decorator/menu.jsp
View file @
ad052e8e
...
...
@@ -11,7 +11,7 @@
<li><a
href=
"
<c:url
value=
"/geo/"
/>
"
><spring:message
code=
"menu.countries"
/></a></li>
<li><a
href=
"
<c:url
value=
"/wiews/active"
/>
"
><spring:message
code=
"menu.institutes"
/></a></li>
<li><a
href=
"
<c:url
value=
"/sel/"
/>
"
><spring:message
code=
"menu.my-list"
/>
<span
class=
"badge"
id=
"selcounter"
>
${selection.size() gt 0 ? selection.size() : ''}
</span></a></li>
<span
class=
"badge"
x-size=
"${selection.size() gt 0 ? selection.size() : '0'}"
id=
"selcounter"
>
${selection.size() gt 0 ? selection.size() : '
0
'}
</span></a></li>
</ul>
</div>
</div>
...
...
src/main/webapp/WEB-INF/jsp/accession/data.jsp
View file @
ad052e8e
...
...
@@ -67,9 +67,7 @@
<thead>
<tr>
<td
class=
"idx-col"
></td>
<c:if
test=
"
${
selection
ne
null
}
"
>
<td
/>
</c:if>
<td
/>
<td><spring:message
code=
"accession.accessionName"
/></td>
<td><spring:message
code=
"accession.taxonomy"
/></td>
<td
class=
"notimportant"
><spring:message
code=
"accession.origin"
/></td>
...
...
@@ -83,9 +81,7 @@
<c:forEach
items=
"
${
pagedData
.
content
}
"
var=
"accession"
varStatus=
"status"
>
<tr
class=
"acn ${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<td
class=
"idx-col"
>
${status.count + pagedData.size * pagedData.number}
</td>
<c:if
test=
"
${
selection
ne
null
}
"
>
<td
class=
"sel ${selection.containsId(accession.id) ? 'picked' : ''}"
x-aid=
"${accession.id}"
></td>
</c:if>
<td
class=
"sel"
x-aid=
"${accession.id}"
></td>
<td><a
href=
"
<c:url
value=
"/acn/id/${accession.id}"
/>
"
><b><c:out
value=
"
${
accession
.
accessionName
}
"
/></b></a></td>
<%-- <td><a href="<c:url value="/acn/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><c:out value="${accession.taxonomy.taxonName}" /></a></td> --%>
<td><c:out
value=
"
${
accession
.
taxonomy
.
taxonName
}
"
/></td>
...
...
src/main/webapp/WEB-INF/jsp/accession/details.jsp
View file @
ad052e8e
...
...
@@ -13,7 +13,7 @@
</h1>
<div
class=
"main-col-header acn"
>
<div
class=
"sel
${selection.containsId(accession.id) ? 'picked' : ''}
"
x-aid=
"${accession.id}"
>
<div
class=
"sel"
x-aid=
"${accession.id}"
>
<a
class=
"add"
href=
"
<c:url
value=
"/sel/add/${accession.id}"
/>
"
><spring:message
code=
"selection.add"
arguments=
"
${
accession
.
accessionName
}
"
/></a>
<a
class=
"remove"
href=
"
<c:url
value=
"/sel/remove/${accession.id}"
/>
"
><spring:message
code=
"selection.remove"
arguments=
"
${
accession
.
accessionName
}
"
/></a>
</div>
...
...
src/main/webapp/WEB-INF/jsp/metadata/view.jsp
View file @
ad052e8e
...
...
@@ -80,9 +80,7 @@
<thead>
<tr>
<td
class=
"idx-col"
></td>
<c:if
test=
"
${
selection
ne
null
}
"
>
<td
/>
</c:if>
<td
/>
<td><spring:message
code=
"accession.accessionName"
/></td>
<%-- <td><spring:message code="accession.origin" /></td>
--%>
...
...
@@ -102,9 +100,7 @@
<c:forEach
items=
"
${
pagedData
.
content
}
"
var=
"accession"
varStatus=
"status"
>
<tr
class=
"acn ${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<td
class=
"idx-col"
>
${status.count + pagedData.size * pagedData.number}
</td>
<c:if
test=
"
${
selection
ne
null
}
"
>
<td
class=
"sel ${selection.containsId(accession.id) ? 'picked' : ''}"
x-aid=
"${accession.id}"
></td>
</c:if>
<td
class=
"sel"
x-aid=
"${accession.id}"
></td>
<td><a
href=
"
<c:url
value=
"/acn/id/${accession.id}"
/>
"
><b><c:out
value=
"
${
accession
.
accessionName
}
"
/></b></a></td>
<%-- <td><a href="<c:url value="/geo/${accession.origin.toLowerCase()}" />"><c:out value="${accession.countryOfOrigin.getName(pageContext.response.locale)}" /></a></td>
--%>
...
...
src/main/webapp/WEB-INF/jsp/search/accessions.jsp
View file @
ad052e8e
...
...
@@ -34,9 +34,7 @@
<thead>
<tr>
<td
class=
"idx-col"
></td>
<c:if
test=
"
${
selection
ne
null
}
"
>
<td
/>
</c:if>
<td
/>
<td><spring:message
code=
"accession.accessionName"
/></td>
<td><spring:message
code=
"accession.otherNames"
/></td>
<td><spring:message
code=
"accession.taxonomy"
/></td>
...
...
@@ -68,9 +66,7 @@
<tr
class=
"acn"
>
<td
class=
"idx-col"
>
${status.count + pagedData.size * pagedData.number}
</td>
<c:if
test=
"
${
selection
ne
null
}
"
>
<td
class=
"sel ${selection.containsId(accession.id) ? 'picked' : ''}"
x-aid=
"${accession.id}"
></td>
</c:if>
<td
class=
"sel"
x-aid=
"${accession.id}"
></td>
<td><a
href=
"
<c:url
value=
"/acn/id/${accession.id}"
/>
"
><b>
<c:out
value=
"
${
accession
.
accessionName
}
"
/>
</b></a></td>
...
...
src/main/webapp/WEB-INF/jsp/selection/index.jsp
View file @
ad052e8e
...
...
@@ -34,9 +34,7 @@
<thead>
<tr>
<td
class=
"idx-col"
></td>
<c:if
test=
"
${
selection
ne
null
}
"
>
<td
/>
</c:if>
<td
/>
<td><spring:message
code=
"accession.accessionName"
/></td>
<td><spring:message
code=
"accession.taxonomy"
/></td>
<td
class=
"notimportant"
><spring:message
code=
"accession.origin"
/></td>
...
...
@@ -48,9 +46,7 @@
<c:forEach
items=
"
${
pagedData
.
content
}
"
var=
"accession"
varStatus=
"status"
>
<tr
id=
"a${accession.id}"
class=
"acn targeted ${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<td
class=
"idx-col"
>
${status.count + pagedData.size * pagedData.number}
</td>
<c:if
test=
"
${
selection
ne
null
}
"
>
<td
class=
"sel ${selection.containsId(accession.id) ? 'picked' : ''}"
x-aid=
"${accession.id}"
></td>
</c:if>
<td
class=
"sel ${selection.containsId(accession.id) ? 'picked' : ''}"
x-aid=
"${accession.id}"
></td>
<td><a
href=
"
<c:url
value=
"/acn/id/${accession.id}"
/>
"
><b><c:out
value=
"
${
accession
.
accessionName
}
"
/></b></a></td>
<td><c:out
value=
"
${
accession
.
taxonomy
.
taxonName
}
"
/></td>
<td
class=
"notimportant"
><c:out
value=
"
${
accession
.
countryOfOrigin
.
getName
(
pageContext
.
response
.
locale
)
}
"
/></td>
...
...
src/main/webapp/html/css/custom.css
View file @
ad052e8e
...
...
@@ -1836,4 +1836,4 @@ html[dir="rtl"] ul.statistics .stats-number {
font-size
:
110%
;
background-color
:
#FFF
;
margin-bottom
:
1em
;
}
\ No newline at end of file
}
src/main/webapp/html/js/crophub.js
View file @
ad052e8e
...
...
@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
GoogleMaps
=
{
LatLng
:
function
(
lat
,
lng
)
{
this
.
lat
=
lat
;
...
...
@@ -106,8 +108,23 @@ GoogleMaps = {
jQuery
(
document
).
ready
(
function
()
{
var
sc
=
$
(
"
#selcounter
"
);
$
.
ajax
({
url
:
"
/sel/json/selection
"
,
type
:
"
GET
"
,
success
:
function
(
data
)
{
sc
.
html
(
data
.
length
);
sc
.
attr
(
"
x-size
"
,
data
.
length
);
if
(
data
.
length
>
0
)
{
for
(
var
i
=
data
.
length
-
1
;
i
>=
0
;
i
--
)
{
$
(
"
.sel[x-aid=
"
+
data
[
i
]
+
"
]
"
).
addClass
(
'
picked
'
);
}
}
}
});
$
(
"
body
"
).
on
(
"
click
"
,
"
.acn
.sel[x-aid]
"
,
function
(
event
)
{
$
(
"
body
"
).
on
(
"
click
"
,
"
.sel[x-aid]
"
,
function
(
event
)
{
event
.
preventDefault
();
var
foo
=
$
(
this
);
var
aid
=
foo
.
attr
(
'
x-aid
'
);
...
...
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