dev-openorgs: paginations, filtering, look and feel #23

Merged
michele.artini merged 19 commits from dev-openorgs into master 2024-12-02 10:15:22 +01:00
20 changed files with 10918 additions and 197 deletions

View File

@ -19,6 +19,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -228,12 +230,16 @@ public class OrganizationController extends AbstractDnetController {
@PathVariable final int size, @PathVariable final int size,
@RequestParam final String q, @RequestParam final String q,
@RequestParam(required = false, defaultValue = "") final String status, @RequestParam(required = false, defaultValue = "") final String status,
@RequestParam(required = false, defaultValue = "name") final String orderBy,
@RequestParam(required = false, defaultValue = "false") final boolean reverse,
final Authentication authentication) { final Authentication authentication) {
final PageRequest pageRequest = PageRequest.of(page, size, Sort.by(reverse ? Order.desc(orderBy) : Order.asc(orderBy)));
if (SPECIAL_STATUS_FOR_CANDIDATE_DUP.equals(status)) { if (SPECIAL_STATUS_FOR_CANDIDATE_DUP.equals(status)) {
return UserInfo.isSuperAdmin(authentication) return UserInfo.isSuperAdmin(authentication)
? organizationSimpleViewRepository.searchCandidateDuplicates(q, PageRequest.of(page, size)) ? organizationSimpleViewRepository.searchCandidateDuplicates(q, pageRequest)
: organizationSimpleViewRepository.searchCandidateDuplicatesForUser(q, UserInfo.getEmail(authentication), PageRequest.of(page, size)); : organizationSimpleViewRepository.searchCandidateDuplicatesForUser(q, UserInfo.getEmail(authentication), pageRequest);
} }
final List<String> statuses; final List<String> statuses;
if (StringUtils.isNotBlank(status)) { if (StringUtils.isNotBlank(status)) {
@ -245,8 +251,8 @@ public class OrganizationController extends AbstractDnetController {
} }
return UserInfo.isSuperAdmin(authentication) return UserInfo.isSuperAdmin(authentication)
? organizationSimpleViewRepository.search(q, statuses, PageRequest.of(page, size)) ? organizationSimpleViewRepository.search(q, statuses, pageRequest)
: organizationSimpleViewRepository.searchForUser(q, UserInfo.getEmail(authentication), statuses, PageRequest.of(page, size)); : organizationSimpleViewRepository.searchForUser(q, UserInfo.getEmail(authentication), statuses, pageRequest);
} }
@GetMapping("/byCountry/{status}/{code}/{page}/{size}") @GetMapping("/byCountry/{status}/{code}/{page}/{size}")
@ -254,12 +260,18 @@ public class OrganizationController extends AbstractDnetController {
@PathVariable final String code, @PathVariable final String code,
@PathVariable final int page, @PathVariable final int page,
@PathVariable final int size, @PathVariable final int size,
@RequestParam(required = false, defaultValue = "name") final String orderBy,
@RequestParam(required = false, defaultValue = "false") final boolean reverse,
final Authentication authentication) { final Authentication authentication) {
if (!UserInfo.isSuperAdmin(authentication) && !userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) { if (!UserInfo.isSuperAdmin(authentication) && !userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) {
throw new RuntimeException("User not authorized"); throw new RuntimeException("User not authorized");
} }
if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByCountryOrderByName(code, PageRequest.of(page, size)); }
return organizationSimpleViewRepository.findByCountryAndStatusOrderByName(code, status, PageRequest.of(page, size)); final PageRequest pageRequest = PageRequest.of(page, size, Sort.by(reverse ? Order.desc(orderBy) : Order.asc(orderBy)));
if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByCountry(code, pageRequest); }
return organizationSimpleViewRepository.findByCountryAndStatus(code, status, pageRequest);
} }
@GetMapping("/byCountry/{status}/{code}") @GetMapping("/byCountry/{status}/{code}")
@ -267,20 +279,30 @@ public class OrganizationController extends AbstractDnetController {
@PathVariable final String code, @PathVariable final String code,
@RequestParam(required = false, defaultValue = "0") final int page, @RequestParam(required = false, defaultValue = "0") final int page,
@RequestParam(required = false, defaultValue = "${openorgs.findOrgsByStatusAndCountry.limit.default}") final int size, @RequestParam(required = false, defaultValue = "${openorgs.findOrgsByStatusAndCountry.limit.default}") final int size,
@RequestParam(required = false, defaultValue = "name") final String orderBy,
@RequestParam(required = false, defaultValue = "false") final boolean reverse,
final Authentication authentication) { final Authentication authentication) {
if (!UserInfo.isSuperAdmin(authentication) && !userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) { if (!UserInfo.isSuperAdmin(authentication) && !userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) {
throw new RuntimeException("User not authorized"); throw new RuntimeException("User not authorized");
} }
if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByCountryOrderByName(code, PageRequest.of(page, size)).getContent(); }
return organizationSimpleViewRepository.findByCountryAndStatusOrderByName(code, status, PageRequest.of(page, size)).getContent(); final PageRequest pageRequest = PageRequest.of(page, size, Sort.by(reverse ? Order.desc(orderBy) : Order.asc(orderBy)));
if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByCountry(code, pageRequest).getContent(); }
return organizationSimpleViewRepository.findByCountryAndStatus(code, status, pageRequest).getContent();
} }
@GetMapping(value = "/byCountry/{status}/{code}/csv", produces = "text/csv") @GetMapping(value = "/byCountry/{status}/{code}/csv", produces = "text/csv")
public void findOrgsByStatusAndCountryCSV(@PathVariable final String status, public void findOrgsByStatusAndCountryCSV(@PathVariable final String status,
@PathVariable final String code, @PathVariable final String code,
@RequestParam(required = false, defaultValue = "name") final String orderBy,
@RequestParam(required = false, defaultValue = "false") final boolean reverse,
final HttpServletResponse res, final HttpServletResponse res,
final Authentication authentication) throws IOException { final Authentication authentication) throws IOException {
final Iterable<OrganizationSimpleView> list = findOrgsByStatusAndCountry(status, code, 0, Integer.MAX_VALUE, authentication);
final Iterable<OrganizationSimpleView> list = findOrgsByStatusAndCountry(status, code, 0, Integer.MAX_VALUE, orderBy, reverse, authentication);
CSVConverter.writeCSV(res CSVConverter.writeCSV(res
.getOutputStream(), list, OrganizationSimpleView.class, "id", "name", "type", "city", "country", "acronyms", "urls", "status", "nSimilarDups", "nSuggestedDups", "nDifferentDups"); .getOutputStream(), list, OrganizationSimpleView.class, "id", "name", "type", "city", "country", "acronyms", "urls", "status", "nSimilarDups", "nSuggestedDups", "nDifferentDups");
} }
@ -290,17 +312,21 @@ public class OrganizationController extends AbstractDnetController {
@PathVariable final String type, @PathVariable final String type,
@PathVariable final int page, @PathVariable final int page,
@PathVariable final int size, @PathVariable final int size,
@RequestParam(required = false, defaultValue = "name") final String orderBy,
@RequestParam(required = false, defaultValue = "false") final boolean reverse,
final Authentication authentication) { final Authentication authentication) {
final PageRequest pageRequest = PageRequest.of(page, size, Sort.by(reverse ? Order.desc(orderBy) : Order.asc(orderBy)));
if (UserInfo.isSuperAdmin(authentication)) { if (UserInfo.isSuperAdmin(authentication)) {
if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByTypeOrderByName(type, PageRequest.of(page, size)); } if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByType(type, pageRequest); }
return organizationSimpleViewRepository.findByTypeAndStatusOrderByName(type, status, PageRequest.of(page, size));
} return organizationSimpleViewRepository.findByTypeAndStatus(type, status, pageRequest);
if ("all".equalsIgnoreCase(status)) {
return organizationSimpleViewRepository.findByTypeForUser(type, UserInfo.getEmail(authentication), PageRequest.of(page, size));
} }
if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByTypeForUser(type, UserInfo.getEmail(authentication), pageRequest); }
return organizationSimpleViewRepository return organizationSimpleViewRepository
.findByTypeAndStatusForUser(type, status, UserInfo.getEmail(authentication), PageRequest.of(page, size)); .findByTypeAndStatusForUser(type, status, UserInfo.getEmail(authentication), pageRequest);
} }

View File

@ -15,12 +15,12 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository<Org
// SEARCH // SEARCH
@Query(value = "SELECT \n" @Query(value = "SELECT \n"
+ " org.id,\n" + " org.id AS id,\n"
+ " org.name,\n" + " org.name AS name,\n"
+ " org.type,\n" + " org.type AS type,\n"
+ " org.city,\n" + " org.city AS city,\n"
+ " org.country,\n" + " org.country AS country,\n"
+ " org.status,\n" + " org.status AS status,\n"
+ " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n" + " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n"
+ " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n" + " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n"
+ " count(DISTINCT d1.oa_original_id) FILTER (WHERE d1.reltype = 'is_similar') AS n_similar_dups,\n" + " count(DISTINCT d1.oa_original_id) FILTER (WHERE d1.reltype = 'is_similar') AS n_similar_dups,\n"
@ -32,18 +32,17 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository<Org
+ " LEFT OUTER JOIN urls u ON org.id = u.id\n" + " LEFT OUTER JOIN urls u ON org.id = u.id\n"
+ " LEFT OUTER JOIN oa_duplicates d1 ON org.id = d1.local_id\n" + " LEFT OUTER JOIN oa_duplicates d1 ON org.id = d1.local_id\n"
+ "WHERE org.status in :statuses AND (org.name ilike '%'||:text||'%' OR idx.txt @@ plainto_tsquery(:text))\n" + "WHERE org.status in :statuses AND (org.name ilike '%'||:text||'%' OR idx.txt @@ plainto_tsquery(:text))\n"
+ "GROUP BY org.id, org.name, org.type, org.city, org.country, org.status\n" + "GROUP BY org.id, org.name, org.type, org.city, org.country, org.status", nativeQuery = true)
+ "ORDER BY org.name", nativeQuery = true)
Page<OrganizationSimpleView> search(@Param("text") String text, @Param("statuses") List<String> statuses, Pageable pageable); Page<OrganizationSimpleView> search(@Param("text") String text, @Param("statuses") List<String> statuses, Pageable pageable);
// SEARCH FOR USER // SEARCH FOR USER
@Query(value = "SELECT\n" @Query(value = "SELECT\n"
+ " org.id,\n" + " org.id AS id,\n"
+ " org.name,\n" + " org.name AS name,\n"
+ " org.type,\n" + " org.type AS type,\n"
+ " org.city,\n" + " org.city AS city,\n"
+ " org.country,\n" + " org.country AS country,\n"
+ " org.status,\n" + " org.status AS status,\n"
+ " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n" + " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n"
+ " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n" + " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n"
+ " count(DISTINCT d1.oa_original_id) FILTER (WHERE d1.reltype = 'is_similar' ) AS n_similar_dups,\n" + " count(DISTINCT d1.oa_original_id) FILTER (WHERE d1.reltype = 'is_similar' ) AS n_similar_dups,\n"
@ -56,35 +55,34 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository<Org
+ " LEFT OUTER JOIN oa_duplicates d1 ON (org.id = d1.local_id)\n" + " LEFT OUTER JOIN oa_duplicates d1 ON (org.id = d1.local_id)\n"
+ " LEFT OUTER JOIN user_countries uc ON (uc.country = org.country) \n" + " LEFT OUTER JOIN user_countries uc ON (uc.country = org.country) \n"
+ "WHERE uc.email = :email AND org.status IN :statuses AND (org.name ilike '%'||:text||'%' OR idx.txt @@ plainto_tsquery(:text))\n" + "WHERE uc.email = :email AND org.status IN :statuses AND (org.name ilike '%'||:text||'%' OR idx.txt @@ plainto_tsquery(:text))\n"
+ "GROUP BY org.id, org.name, org.type, org.city, org.country, org.status\n" + "GROUP BY org.id, org.name, org.type, org.city, org.country, org.status", nativeQuery = true)
+ "ORDER BY org.name", nativeQuery = true)
Page<OrganizationSimpleView> searchForUser(@Param("text") String text, Page<OrganizationSimpleView> searchForUser(@Param("text") String text,
@Param("email") String email, @Param("email") String email,
@Param("statuses") List<String> statuses, @Param("statuses") List<String> statuses,
Pageable pageable); Pageable pageable);
Page<OrganizationSimpleView> findByCountryOrderByName(String country, Pageable pageable); Page<OrganizationSimpleView> findByCountry(String country, Pageable pageable);
Page<OrganizationSimpleView> findByCountryAndStatusOrderByName(String code, String status, Pageable pageable); Page<OrganizationSimpleView> findByCountryAndStatus(String code, String status, Pageable pageable);
Page<OrganizationSimpleView> findByTypeOrderByName(String type, Pageable pageable); Page<OrganizationSimpleView> findByType(String type, Pageable pageable);
Page<OrganizationSimpleView> findByTypeAndStatusOrderByName(String type, String status, Pageable pageable); Page<OrganizationSimpleView> findByTypeAndStatus(String type, String status, Pageable pageable);
@Query(value = "select o.* from organizations_simple_view o left outer join user_countries uc on (uc.country = o.country) where uc.email = ?2 and o.type = ?1 order by o.name", nativeQuery = true) @Query(value = "select o.* from organizations_simple_view o left outer join user_countries uc on (uc.country = o.country) where uc.email = ?2 and o.type = ?1", nativeQuery = true)
Page<OrganizationSimpleView> findByTypeForUser(String type, String name, Pageable pageable); Page<OrganizationSimpleView> findByTypeForUser(String type, String name, Pageable pageable);
@Query(value = "select o.* from organizations_simple_view o left outer join user_countries uc on (uc.country = o.country) where o.type = ?1 and o.status = ?2 and uc.email = ?3 order by o.name", nativeQuery = true) @Query(value = "select o.* from organizations_simple_view o left outer join user_countries uc on (uc.country = o.country) where o.type = ?1 and o.status = ?2 and uc.email = ?3", nativeQuery = true)
Page<OrganizationSimpleView> findByTypeAndStatusForUser(String type, String status, String name, Pageable pageable); Page<OrganizationSimpleView> findByTypeAndStatusForUser(String type, String status, String name, Pageable pageable);
// SEARCH FOR VALID DUPLICATE CANDIDATES // SEARCH FOR VALID DUPLICATE CANDIDATES
@Query(value = "SELECT\n" @Query(value = "SELECT\n"
+ " org.id,\n" + " org.id AS id,\n"
+ " org.name,\n" + " org.name AS name,\n"
+ " org.type,\n" + " org.type AS type,\n"
+ " org.city,\n" + " org.city AS city,\n"
+ " org.country,\n" + " org.country AS country,\n"
+ " org.status,\n" + " org.status AS status,\n"
+ " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n" + " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n"
+ " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n" + " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n"
+ " NULL AS n_similar_dups,\n" + " NULL AS n_similar_dups,\n"
@ -97,18 +95,17 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository<Org
+ " LEFT OUTER JOIN oa_duplicates d2 ON (org.id = d2.oa_original_id)\n" + " LEFT OUTER JOIN oa_duplicates d2 ON (org.id = d2.oa_original_id)\n"
+ "WHERE org.status = 'raw' AND (org.name ilike '%'||:text||'%' OR idx.txt @@ plainto_tsquery(:text))\n" + "WHERE org.status = 'raw' AND (org.name ilike '%'||:text||'%' OR idx.txt @@ plainto_tsquery(:text))\n"
+ "GROUP BY org.id, org.name, org.type, org.city, org.country, org.status\n" + "GROUP BY org.id, org.name, org.type, org.city, org.country, org.status\n"
+ "HAVING not('is_similar' = ANY(array_agg(d2.reltype)))\n" + "HAVING not('is_similar' = ANY(array_agg(d2.reltype)))", nativeQuery = true)
+ "ORDER BY org.name", nativeQuery = true)
Page<OrganizationSimpleView> searchCandidateDuplicates(@Param("text") String text, Pageable pageable); Page<OrganizationSimpleView> searchCandidateDuplicates(@Param("text") String text, Pageable pageable);
// SEARCH FOR VALID DUPLICATE CANDIDATES FOR USER // SEARCH FOR VALID DUPLICATE CANDIDATES FOR USER
@Query(value = "SELECT\n" @Query(value = "SELECT\n"
+ " org.id,\n" + " org.id AS id,\n"
+ " org.name,\n" + " org.name AS name,\n"
+ " org.type,\n" + " org.type AS type,\n"
+ " org.city,\n" + " org.city AS city,\n"
+ " org.country,\n" + " org.country AS country,\n"
+ " org.status,\n" + " org.status AS status,\n"
+ " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n" + " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n"
+ " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n" + " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n"
+ " NULL AS n_similar_dups,\n" + " NULL AS n_similar_dups,\n"
@ -122,8 +119,7 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository<Org
+ " LEFT OUTER JOIN user_countries uc ON (uc.country = org.country)\n" + " LEFT OUTER JOIN user_countries uc ON (uc.country = org.country)\n"
+ "WHERE org.status = 'raw' AND uc.email = :email AND (org.name ilike '%'||:text||'%' OR idx.txt @@ plainto_tsquery(:text))\n" + "WHERE org.status = 'raw' AND uc.email = :email AND (org.name ilike '%'||:text||'%' OR idx.txt @@ plainto_tsquery(:text))\n"
+ "GROUP BY org.id, org.name, org.type, org.city, org.country, org.status\n" + "GROUP BY org.id, org.name, org.type, org.city, org.country, org.status\n"
+ "HAVING not('is_similar' = ANY(array_agg(d2.reltype)))\n" + "HAVING not('is_similar' = ANY(array_agg(d2.reltype)))", nativeQuery = true)
+ "ORDER BY org.name", nativeQuery = true)
Page<OrganizationSimpleView> searchCandidateDuplicatesForUser(@Param("text") String text, @Param("email") String email, Pageable pageable); Page<OrganizationSimpleView> searchCandidateDuplicatesForUser(@Param("text") String text, @Param("email") String email, Pageable pageable);
} }

View File

@ -44,5 +44,5 @@
<resolve-conflicts-modal modal-id="resolveConflictsModal" orgs="orgs" selected-orgs="selectedOrgs"></resolve-conflicts-modal> <resolve-conflicts-modal modal-id="resolveConflictsModal" orgs="orgs" selected-orgs="selectedOrgs"></resolve-conflicts-modal>
<select-org-modal modal-id="addNewConflictModal" selected-org="newConflict" filter-status="approved" on-select="addConflict()"></select-org-modal> <select-org-modal modal-id="addNewConflictModal" selected-org="newConflict" filter-status="approved" on-select="addConflict()" multiple="true"></select-org-modal>

View File

@ -23,19 +23,19 @@
<tr ng-repeat="e in entries | filter: browseFilter"> <tr ng-repeat="e in entries | filter: browseFilter">
<th>{{e.name}} <span ng-if="e.code != e.name"> ({{e.code}})</span></th> <th>{{e.name}} <span ng-if="e.code != e.name"> ({{e.code}})</span></th>
<td class="text-right"> <td class="text-right">
<a href="#!{{resultsBasePath}}/0/50/approved/{{e.code}}" ng-if="e.values.approved && e.values.approved > 0">{{e.values.approved}}</a> <a href="#!{{resultsBasePath}}/approved/{{e.code}}" ng-if="e.values.approved && e.values.approved > 0">{{e.values.approved}}</a>
<span ng-if="!e.values.approved || e.values.approved == 0">-</span> <span ng-if="!e.values.approved || e.values.approved == 0">-</span>
</td> </td>
<td class="text-right" ng-if="mode == 1"> <td class="text-right" ng-if="mode == 1">
<a href="#!{{resultsBasePath}}/0/50/suggested/{{e.code}}" ng-if="e.values.suggested && e.values.suggested > 0">{{e.values.suggested}}</a> <a href="#!{{resultsBasePath}}/suggested/{{e.code}}" ng-if="e.values.suggested && e.values.suggested > 0">{{e.values.suggested}}</a>
<span ng-if="!e.values.suggested || e.values.suggested == 0">-</span> <span ng-if="!e.values.suggested || e.values.suggested == 0">-</span>
</td> </td>
<td class="text-right" ng-if="mode == 1"> <td class="text-right" ng-if="mode == 1">
<a href="#!{{resultsBasePath}}/0/50/raw/{{e.code}}" ng-if="e.values.raw && e.values.raw > 0">{{e.values.raw}}</a> <a href="#!{{resultsBasePath}}/raw/{{e.code}}" ng-if="e.values.raw && e.values.raw > 0">{{e.values.raw}}</a>
<span ng-if="!e.values.raw || e.values.raw == 0">-</span> <span ng-if="!e.values.raw || e.values.raw == 0">-</span>
</td> </td>
<td class="text-right" ng-if="mode == 1"> <td class="text-right" ng-if="mode == 1">
<a href="#!{{resultsBasePath}}/0/50/hidden/{{e.code}}" ng-if="e.values.hidden && e.values.hidden > 0">{{e.values.hidden}}</a> <a href="#!{{resultsBasePath}}/hidden/{{e.code}}" ng-if="e.values.hidden && e.values.hidden > 0">{{e.values.hidden}}</a>
<span ng-if="!e.values.hidden || e.values.hidden == 0">-</span> <span ng-if="!e.values.hidden || e.values.hidden == 0">-</span>
</td> </td>
</tr> </tr>

View File

@ -1,6 +1,5 @@
<org-results-page search-message="Searching for country: {{fieldValue}}" <org-results-page search-message="Searching for country: {{fieldValue}}"
orgs="orgs" orgs="orgs"
prev-function="prev()" page-function="pageByCountry()"
next-function="next()"
show-status="1" show-status="1"
show-n-dups="1"></org-results-page> show-n-dups="1"></org-results-page>

View File

@ -1,6 +1,5 @@
<org-results-page search-message="Searching for type: {{fieldValue}}" <org-results-page search-message="Searching for type: {{fieldValue}}"
orgs="orgs" orgs="orgs"
prev-function="prev()" page-function="pageByType()"
next-function="next()"
show-status="1" show-status="1"
show-n-dups="1"></org-results-page> show-n-dups="1"></org-results-page>

View File

@ -1,6 +1,5 @@
<org-results-page search-message="Searching for: {{searchText}}" <org-results-page search-message="Searching for: {{searchText}}"
orgs="orgs" orgs="orgs"
prev-function="prev()" page-function="pageSearch()"
next-function="next()"
show-status="1" show-status="1"
show-n-dups="1"></org-results-page> show-n-dups="1"></org-results-page>

View File

@ -32,4 +32,4 @@
<resolve-conflicts-modal modal-id="resolveConflictsModal" orgs="candidateConflicts" selected-orgs="selectedConflicts" open-new-org="1"></resolve-conflicts-modal> <resolve-conflicts-modal modal-id="resolveConflictsModal" orgs="candidateConflicts" selected-orgs="selectedConflicts" open-new-org="1"></resolve-conflicts-modal>
<select-org-modal modal-id="addConflictModal" selected-org="newConflict" filter-status="approved" on-select="addConflict()"></select-org-modal> <select-org-modal modal-id="addConflictModal" selected-org="newConflict" filter-status="approved" on-select="addConflict()" multiple="true"></select-org-modal>

View File

@ -69,4 +69,4 @@
</div> </div>
<select-org-modal modal-id="addDuplicateModal" selected-org="newDuplicate" filter-status="candidate_dup" on-select="addDuplicate()"></select-org-modal> <select-org-modal modal-id="addDuplicateModal" selected-org="newDuplicate" filter-status="candidate_dup" on-select="addDuplicate()" multiple="true"></select-org-modal>

View File

@ -36,7 +36,7 @@
</select> </select>
<div class="input-group-append"> <div class="input-group-append">
<a href="javascript:void(0)" class="btn btn-sm bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized'}" data-toggle="modal" data-target="#ecFlagsModal">EC flags</a> <a href="javascript:void(0)" class="btn btn-sm bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', 'bg-warning' : mode == 'approve'}" data-toggle="modal" data-target="#ecFlagsModal">EC flags</a>
</div> </div>
</div> </div>
</div> </div>
@ -271,25 +271,22 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td class="text-right" style="width: 120px; vertical-align: middle;">This organization</td> <td colspan="4" class="text-right">
<td style="width: 140px;"> <button type="button" class="btn btn-sm btn-outline-success"
<select class="custom-select custom-select-sm" ng-model="newRelType"> ng-click="setRelationType('IsChildOf')"
<option disabled="disabled" value=''>rel type...</option> data-toggle="modal"
<!-- NB: The showed value MUST be the inverse --> data-target="#selectRelatedOrgModal"
<option value="IsChildOf">is child of</option> ng-hide="mode == 'readonly'">
<option value="IsParentOf">is parent of</option> <i class="fa fa-plus"></i> add parents
</select> </button>
</td>
<td> <button type="button" class="btn btn-sm btn-outline-success"
<input type="text" placeholder="related organization..." readonly="readonly" ng-click="setRelationType('IsParentOf')"
class="form-control form-control-sm" style="background-color: white; color: #007bff;" data-toggle="modal"
ng-model="newRelation.name" ng-click="resetSelectedRelation()" data-target="#selectRelatedOrgModal"
data-toggle="modal" data-target="#selectRelatedOrgModal" ng-hide="mode == 'readonly'"/> ng-hide="mode == 'readonly'">
<input type="text" placeholder="related organization..." disabled="disabled" <i class="fa fa-plus"></i> add children
class="form-control form-control-sm" ng-model="newRelation.name" ng-show="mode == 'readonly'"/> </button>
</td>
<td class="text-right">
<button type="button" class="btn btn-sm btn-outline-success" ng-disabled="!newRelType || !newRelation.id" ng-click="addNewRelation()"><i class="fa fa-plus"></i></button>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
@ -306,7 +303,7 @@
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Save</button> <button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Save</button>
</fieldset> </fieldset>
<fieldset ng-if="mode == 'approve'"> <fieldset ng-if="mode == 'approve'">
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Approve as new Organization</button> <button type="submit" class="btn btn-warning" ng-click="save()" ng-disabled="organizationForm.$invalid">Approve as new Organization</button>
</fieldset> </fieldset>
<fieldset ng-if="mode == 'insert_full'"> <fieldset ng-if="mode == 'insert_full'">
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Register a new Organization</button> <button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Register a new Organization</button>
@ -340,5 +337,5 @@
</div> </div>
</div> </div>
<select-org-modal modal-id="selectRelatedOrgModal" selected-org="newRelation" filter-status="approved" on-select="addRelation()" multiple="true"></select-org-modal>
<select-org-modal modal-id="selectRelatedOrgModal" selected-org="newRelation" filter-status="approved"></select-org-modal>

View File

@ -1,42 +1,91 @@
<p ng-if="mode != 'select-modal'"> <p ng-if="mode != 'select-modal' && mode != 'multi-select-modal'">
<span ng-if="orgs.totalElements > 0"> <span ng-if="orgs.totalElements > 0">
Page: {{orgs.number + 1}} / {{orgs.totalPages}}<br />
Total elements: {{orgs.totalElements}}<br /> Total elements: {{orgs.totalElements}}<br />
{{searchMessage}} {{searchMessage}}
</span> </span>
<span ng-if="orgs.totalElements == 0"> <span ng-if="orgs.totalElements == 0">
Page: -<br />
Total elements: 0<br /> Total elements: 0<br />
{{searchMessage}} {{searchMessage}}
</span> </span>
<span ng-if="!(orgs.totalElements || orgs.totalElements === 0)"> <span ng-if="!(orgs.totalElements || orgs.totalElements === 0)">
Page:<br /> Total elements:<br />fr
Total elements:<br />
{{searchMessage}} {{searchMessage}}
</span> </span>
</p> </p>
<p ng-if="mode == 'select-modal'" class="text-right"> <p ng-if="mode == 'select-modal' || mode == 'multi-select-modal'" class="text-right">
<span ng-if="orgs.totalElements > 0"><b>Page:</b> {{orgs.number + 1}} / {{orgs.totalPages}} <b>- Total elements:</b> {{orgs.totalElements}}</span> <span ng-if="orgs.totalElements > 0"><b>Total elements:</b> {{orgs.totalElements}}</span>
<span ng-if="orgs.totalElements == 0"><b>Total elements:</b> 0</span> <span ng-if="orgs.totalElements == 0"><b>Total elements:</b> 0</span>
</p> </p>
<h4 ng-if="orgs.totalElements == 0" class="text-center">No results</h4> <h4 ng-if="orgs.totalElements == 0" class="text-center">No results</h4>
<div ng-if="orgs.totalElements > 0"> <div ng-if="orgs.totalElements > 0">
<div class="row mb-4">
<div class="col-sm">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" data-toggle="dropdown">
Sort by
<i ng-if="orderBy == 'name'">Name</i>
<i ng-if="orderBy == 'country'">Country</i>
<i ng-if="orderBy == 'type'">Type</i>
<i ng-if="orderBy == 'status'">Status</i>
<i ng-if="orderBy == 'n_similar_dups'"># accepted dups</i>
<i ng-if="orderBy == 'n_suggested_dups'"># suggested dups</i>
<i ng-if="orderBy == 'n_different_dups'"># rejected dups</i>
</button>
<div class="dropdown-menu">
<small>
<a class="dropdown-item" href="javascript:void(0)" ng-click="changeSortField('name')" ng-class="{'disabled': orderBy == 'name'}"><b>name</b></a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="changeSortField('country')" ng-class="{'disabled': orderBy == 'country'}"><b>country</b></a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="changeSortField('type')" ng-class="{'disabled': orderBy == 'type'}"><b>type</b></a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="changeSortField('status')" ng-class="{'disabled': orderBy == 'status'}" ng-if="showStatus == 1"><b>status</b></a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="changeSortField('n_similar_dups')" ng-class="{'disabled': orderBy == 'n_similar_dups'}" ng-if="showNDups == 1"><b># accepted dups</b></a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="changeSortField('n_suggested_dups')" ng-class="{'disabled': orderBy == 'n_suggested_dups'}" ng-if="showNDups == 1"><b># suggested dups</b></a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="changeSortField('n_different_dups')" ng-class="{'disabled': orderBy == 'n_different_dups'}" ng-if="showNDups == 1"><b># rejected dups</b></a>
</small>
</div>
</div>
<div class="input-group-append">
<div class="input-group-text">
<input class="input-sm mr-2" type="checkbox" ng-click="changeSortOrder()" ng-checked="orderType == 'desc'" /> descending
</div>
</div>
</div>
</div>
<nav> <div class="col-sm text-center">
<ul class="pagination justify-content-center"> <div class="btn-group">
<li class="page-item" ng-class="{'disabled' : orgs.first }"> <button class="btn btn-sm btn-outline-primary" ng-click="gotoPage(orgs.number - 1, orgs.size)" ng-disabled="orgs.first">&laquo;</button>
<a class="page-link" href="javascript:void(0)" ng-click="prevFunction()">&laquo; Previous</a> <div class="dropdown">
</li> <button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" data-toggle="dropdown">Page {{orgs.number + 1}} of {{orgs.totalPages}}</button>
<li class="page-item" ng-class="{'disabled' : orgs.last }"> <div class="dropdown-menu">
<a class="page-link" href="javascript:void(0)" ng-click="nextFunction()">Next &raquo;</a> <a class="dropdown-item" href="javascript:void(0)" ng-click="gotoPage(i, orgs.size)" ng-repeat="i in availablePages()">Page {{i + 1}}</a>
</li> </div>
</ul> </div>
</nav> <div class="dropdown">
<button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" data-toggle="dropdown">Size {{orgs.size}}</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="javascript:void(0)" ng-click="gotoPage(0, 10)">Size 10</a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="gotoPage(0, 25)">Size 25</a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="gotoPage(0, 50)">Size 50</a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="gotoPage(0, 100)">Size 100</a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="gotoPage(0, 200)">Size 200</a>
<a class="dropdown-item" href="javascript:void(0)" ng-click="gotoPage(0, 500)">Size 500</a>
</div>
</div>
<button class="btn btn-sm btn-outline-primary" ng-click="gotoPage(orgs.number + 1, orgs.size)" ng-disabled="orgs.last">&raquo;</button>
</div>
</div>
<p ng-if="mode == 'select-modal'">Click the <b>organization name</b> to add the organization (multiple selection is allowed)</p> <div class="col-sm">
<input type="text" class="form-control float-right" style="max-width: 250px;" ng-model="orgsFilter" placeholder="Filter in current page..." />
</div>
</div>
<p ng-if="mode == 'select-modal'">Click the <b>organization name</b> to select the organization</p>
<p ng-if="mode == 'multi-select-modal'">Click the <b>organization name</b> to add the organization (multiple selection is allowed)</p>
<table class="table table-sm table-hover" ng-if="orgs.content.length > 0"> <table class="table table-sm table-hover" ng-if="orgs.content.length > 0">
<thead class="thead-light"> <thead class="thead-light">
@ -49,13 +98,18 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="o in orgs.content" class="d-flex" ng-class="{'table-warning' : showStatus && o.status != 'approved'}"> <tr ng-repeat="o in orgs.content | filter:orgsFilter" class="d-flex">
<td class="col-6"> <td class="col-6">
<a ng-if="(mode == 'select-modal') && !o.selected" href="javascript:void(0)" title="{{o.id}}" ng-click="selectOrg(o)">{{o.name}}</a>
<span ng-if="(mode == 'select-modal') && o.selected" title="{{o.id}}" class="text-muted">{{o.name}} <b>(SELECTED)</b></span>
<a ng-if="mode != 'select-modal'" href="#!/edit/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a>
<span class="badge badge-warning" ng-if="showStatus && o.status != 'approved'">{{o.status}}</span> <span class="badge badge-warning" ng-if="showStatus && o.status != 'approved'">{{o.status}}</span>
<span ng-if="mode == 'select-modal'" class="small" ng-repeat="ourl in o.urls"><br /><b>URL: </b><a href="{{ourl}}" target="_blank" ng-if="ourl">{{ourl}}</a></span>
<a ng-if="(mode == 'multi-select-modal') && !o.selected" href="javascript:void(0)" title="{{o.id}}" ng-click="selectOrg(o)">{{o.name}}</a>
<span ng-if="(mode == 'multi-select-modal') && o.selected" title="{{o.id}}" class="text-muted">{{o.name}} <b>(SELECTED)</b></span>
<a ng-if="mode == 'select-modal'" href="javascript:void(0)" title="{{o.id}}" ng-click="selectOrg(o)" data-dismiss="modal">{{o.name}}</a>
<a ng-if="mode != 'select-modal' && mode != 'multi-select-modal'" href="#!/edit/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a>
<span ng-if="mode == 'select-modal' || mode == 'multi-select-modal'" class="small" ng-repeat="ourl in o.urls"><br /><b>URL: </b><a href="{{ourl}}" target="_blank" ng-if="ourl">{{ourl}}</a></span>
</td> </td>
<td ng-class="{'col-3' : showNDups, 'col-4' : !showNDups }"><img ng-src="resources/images/flags/{{o.country}}.gif" /> {{o.city || '-'}}, {{o.country}}</td> <td ng-class="{'col-3' : showNDups, 'col-4' : !showNDups }"><img ng-src="resources/images/flags/{{o.country}}.gif" /> {{o.city || '-'}}, {{o.country}}</td>
<td class="col-1 text-center">{{o.acronyms.join()}}</td> <td class="col-1 text-center">{{o.acronyms.join()}}</td>

View File

@ -10,22 +10,20 @@
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" class="form-control" ng-model="searchText" /> <input type="text" class="form-control" ng-model="searchText" />
<div class="input-group-append"> <div class="input-group-append">
<button type="submit" class="btn btn-outline-primary" ng-click="search(searchText, 0, 25)">Search</button> <button type="submit" class="btn btn-outline-primary" ng-click="search(searchText)">Search</button>
</div> </div>
</div> </div>
</form> </form>
<div ng-show="searchValue"> <div ng-show="searchValue">
<org-results-page orgs="searchOrgs" <org-results-page orgs="searchOrgs"
prev-function="search(searchValue, searchOrgs.number - 1, searchOrgs.size)" page-function="searchPage()"
next-function="search(searchValue, searchOrgs.number + 1, searchOrgs.size)"
on-select="selectOrg()" on-select="selectOrg()"
selected-org="selectedOrg" selected-org="selectedOrg"
mode="select-modal"></org-results-page> mode="{{resultsPageMode}}"></org-results-page>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div> </div>
</div> </div>
</div> </div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -38,14 +38,15 @@ orgsModule.controller('menuCtrl', function ($scope, suggestionInfo) {
suggestionInfo.updateInfo(null); suggestionInfo.updateInfo(null);
}); });
orgsModule.directive('selectOrgModal', function($http, $timeout) { orgsModule.directive('selectOrgModal', function($http) {
return { return {
restrict: 'E', restrict: 'E',
scope: { scope: {
'modalId' : '@', 'modalId' : '@',
'filterStatus' : '@', 'filterStatus' : '@',
'selectedOrg' : '=', 'selectedOrg' : '=',
'onSelect' : '&' 'onSelect' : '&',
'multiple' : '@'
}, },
templateUrl: 'resources/html/parts/select_org.modal.html', templateUrl: 'resources/html/parts/select_org.modal.html',
link: function(scope, element, attrs, ctrl) { link: function(scope, element, attrs, ctrl) {
@ -53,15 +54,27 @@ orgsModule.directive('selectOrgModal', function($http, $timeout) {
scope.searchText = ''; scope.searchText = '';
scope.searchValue = ''; scope.searchValue = '';
scope.search = function(text, page, size) { if (scope.multiple == 'true') {
scope.resultsPageMode = 'multi-select-modal';
} else {
scope.resultsPageMode = 'select-modal';
}
scope.search = function(text) {
scope.searchOrgs = {}; scope.searchOrgs = {};
call_http_get($http, 'api/organizations/search/' + page + '/' + size + '?status='+ scope.filterStatus + '&q=' + text, function(res) { var url = 'api/organizations/search/0/50?orderBy=name&status='+ scope.filterStatus + '&q=' + text;
call_http_get($http, url, function(res) {
scope.searchValue = text; scope.searchValue = text;
scope.searchOrgs = res.data; scope.searchOrgs = res.data;
}); });
} }
scope.searchPage = function() {
return 'api/organizations/search/__PAGE__/__SIZE__?status='+ scope.filterStatus + '&q=' + scope.searchValue;
}
scope.selectOrg = function() { scope.selectOrg = function() {
if (scope.onSelect) { if (scope.onSelect) {
scope.onSelect(); scope.onSelect();
@ -159,21 +172,27 @@ orgsModule.directive('orgFormMetadata', function($http, $location, $route, $rout
}, },
templateUrl: 'resources/html/parts/org_metadata.form.html', templateUrl: 'resources/html/parts/org_metadata.form.html',
link: function(scope, element, attrs, ctrl) { link: function(scope, element, attrs, ctrl) {
scope.newRelation = {};
scope.newRelType = ''; scope.newRelType = '';
scope.newRelation = {};
scope.resetSelectedRelation = function() { scope.addRelation = function() {
scope.newRelation = {};
} for (var i = 0; i < scope.org.relations.length; i++) {
if (scope.org.relations[i].relatedOrgId == scope.newRelation.id) {
alert("The selected organization has been already added !!!");
return;
}
}
scope.addNewRelation = function() {
scope.org.relations.push({ scope.org.relations.push({
'relatedOrgId' : scope.newRelation.id, 'relatedOrgId' : scope.newRelation.id,
'relatedOrgName' : scope.newRelation.name, 'relatedOrgName' : scope.newRelation.name,
'type' : scope.newRelType 'type' : scope.newRelType
}); });
scope.newRelation = {}; }
scope.newRelType = '';
scope.setRelationType = function(relType) {
scope.newRelType = relType;
} }
scope.save = function() { scope.save = function() {
@ -201,14 +220,13 @@ orgsModule.directive('orgDetails', function($http, $location, $route) {
} }
}); });
orgsModule.directive('orgResultsPage', function($http, $location, $route) { orgsModule.directive('orgResultsPage', function($http, $location, $route, $routeParams) {
return { return {
restrict: 'E', restrict: 'E',
scope: { scope: {
'searchMessage' : '@', 'searchMessage' : '@',
'orgs' : '=', 'orgs' : '=',
'nextFunction' : '&', 'pageFunction' : '&',
'prevFunction' : '&',
'onSelect' : '&', 'onSelect' : '&',
'selectedOrg' : '=', 'selectedOrg' : '=',
'mode' : '@', 'mode' : '@',
@ -217,6 +235,11 @@ orgsModule.directive('orgResultsPage', function($http, $location, $route) {
}, },
templateUrl: 'resources/html/parts/org_results_page.html', templateUrl: 'resources/html/parts/org_results_page.html',
link: function(scope, element, attrs, ctrl) { link: function(scope, element, attrs, ctrl) {
scope.orderBy = $routeParams.orderBy ? $routeParams.orderBy : 'name';
scope.orderType = $routeParams.orderType ? $routeParams.orderType : 'asc';
scope.size = $routeParams.size ? $routeParams.size : 50;
scope.selectOrg = function(o) { scope.selectOrg = function(o) {
o.selected = true; o.selected = true;
@ -234,7 +257,49 @@ orgsModule.directive('orgResultsPage', function($http, $location, $route) {
} }
} }
scope.availablePages = function() {
var input = [];
for (var i = 0; i < scope.orgs.totalPages; i++) input.push(i);
return input;
}
scope.gotoPage = function(page, pageSize) {
var url = scope.pageFunction()
.replace(/__PAGE__/, page)
.replace(/__SIZE__/, pageSize)
.replace(/__ORDER_BY__/, scope.orderBy)
.replace(/__ORDER_TYPE__/, scope.orderType);
if (scope.mode == 'select-modal' || scope.mode == 'multi-select-modal') {
url += '&orderBy=' + scope.orderBy;
if (scope.orderType == 'desc') {
url += '&reverse=true';
}
scope.orgs = {};
call_http_get($http, url, function(res) {
scope.orgs = res.data;
scope.size = res.data.size;
});
} else {
$location.url(url);
}
}
scope.changeSortField = function(orderBy) {
scope.orderBy = orderBy;
scope.gotoPage(0, scope.size);
}
scope.changeSortOrder = function() {
if (scope.orderType == 'desc') { scope.orderType = 'asc'; }
else { scope.orderType = 'desc'; }
scope.gotoPage(0, scope.size);
}
} }
} }
}); });
@ -372,25 +437,24 @@ orgsModule.directive('orgJournal', function($http) {
} }
}); });
orgsModule.config(function($routeProvider) { orgsModule.config(function($routeProvider) {
$routeProvider $routeProvider
.when('/search', { templateUrl: 'resources/html/pages/search/search.html', controller: 'searchCtrl' }) .when('/search', { templateUrl: 'resources/html/pages/search/search.html', controller: 'searchCtrl' })
.when('/searchResults/:page/:size/:text*', { templateUrl: 'resources/html/pages/search/searchResults.html', controller: 'searchResultsCtrl' }) .when('/page/:page/:size/sortBy/:orderBy/:orderType/search/:text*', { templateUrl: 'resources/html/pages/search/searchResults.html', controller: 'searchResultsCtrl' })
.when('/countries/:mode', { templateUrl: 'resources/html/pages/search/browse.html', controller: 'countriesCtrl' }) .when('/countries/:mode', { templateUrl: 'resources/html/pages/search/browse.html', controller: 'countriesCtrl' })
.when('/byCountry/:page/:size/:status/:code*', { templateUrl: 'resources/html/pages/search/resultsByCountry.html', controller: 'byCountryCtrl' }) .when('/page/:page/:size/sortBy/:orderBy/:orderType/byCountry/:status/:code*', { templateUrl: 'resources/html/pages/search/resultsByCountry.html', controller: 'byCountryCtrl' })
.when('/types/:mode', { templateUrl: 'resources/html/pages/search/browse.html', controller: 'typesCtrl' }) .when('/types/:mode', { templateUrl: 'resources/html/pages/search/browse.html', controller: 'typesCtrl' })
.when('/byType/:page/:size/:status/:type*', { templateUrl: 'resources/html/pages/search/resultsByType.html', controller: 'byTypeCtrl' }) .when('/page/:page/:size/sortBy/:orderBy/:orderType/byType/:status/:type*', { templateUrl: 'resources/html/pages/search/resultsByType.html', controller: 'byTypeCtrl' })
.when('/edit/:msg/:id*', { templateUrl: 'resources/html/pages/edit/edit.html', controller: 'showEditCtrl' }) .when('/edit/:msg/:id*', { templateUrl: 'resources/html/pages/edit/edit.html', controller: 'showEditCtrl' })
.when('/new', { templateUrl: 'resources/html/pages/advanced/new.html', controller: 'newOrgCtrl' }) .when('/new', { templateUrl: 'resources/html/pages/advanced/new.html', controller: 'newOrgCtrl' })
.when('/pendings/:country', { templateUrl: 'resources/html/pages/advanced/pendingOrgs.html', controller: 'pendingOrgsCtrl' }) .when('/pendings/:country', { templateUrl: 'resources/html/pages/advanced/pendingOrgs.html', controller: 'pendingOrgsCtrl' })
.when('/duplicates/:country', { templateUrl: 'resources/html/pages/advanced/duplicates.html', controller: 'duplicatesCtrl' }) .when('/duplicates/:country', { templateUrl: 'resources/html/pages/advanced/duplicates.html', controller: 'duplicatesCtrl' })
.when('/conflicts/:country', { templateUrl: 'resources/html/pages/advanced/conflicts.html', controller: 'conflictsCtrl' }) .when('/conflicts/:country', { templateUrl: 'resources/html/pages/advanced/conflicts.html', controller: 'conflictsCtrl' })
.when('/users', { templateUrl: 'resources/html/pages/admin/users.html', controller: 'usersCtrl' }) .when('/users', { templateUrl: 'resources/html/pages/admin/users.html', controller: 'usersCtrl' })
.when('/sysconf', { templateUrl: 'resources/html/pages/admin/sysConf.html', controller: 'sysConfCtrl' }) .when('/sysconf', { templateUrl: 'resources/html/pages/admin/sysConf.html', controller: 'sysConfCtrl' })
.when('/utils', { templateUrl: 'resources/html/pages/admin/utils.html', controller: 'utilsCtrl' }) .when('/utils', { templateUrl: 'resources/html/pages/admin/utils.html', controller: 'utilsCtrl' })
.when('/lastImport', { templateUrl: 'resources/html/pages/admin/lastImport.html', controller: 'lastImportCtrl' }) .when('/lastImport', { templateUrl: 'resources/html/pages/admin/lastImport.html', controller: 'lastImportCtrl' })
.when('/persistentOrgs', { templateUrl: 'resources/html/pages/admin/persistentOrgs.html', controller: 'persistentOrgsCtrl' }) .when('/persistentOrgs', { templateUrl: 'resources/html/pages/admin/persistentOrgs.html', controller: 'persistentOrgsCtrl' })
.otherwise({ redirectTo: '/search' }); .otherwise({ redirectTo: '/search' });
}); });
@ -432,9 +496,9 @@ orgsModule.controller('searchCtrl', function ($scope, $location) {
$scope.searchText = ''; $scope.searchText = '';
$scope.search = function() { $scope.search = function() {
if ($scope.searchText) { if ($scope.searchText) {
$location.url('/searchResults/0/50/' + encodeURIComponent(encodeURIComponent($scope.searchText))); $location.url('/page/0/50/sortBy/name/asc/search/' + encodeURIComponent(encodeURIComponent($scope.searchText)));
} else { } else {
$location.url('/searchResults/0/50/_'); $location.url('/page/0/50/sortBy/name/asc/search/_');
} }
} }
}); });
@ -446,30 +510,37 @@ orgsModule.controller('searchResultsCtrl', function ($scope, $http, $routeParams
} }
$scope.orgs = {}; $scope.orgs = {};
call_http_get($http, 'api/organizations/search/' + $routeParams.page + '/' + $routeParams.size + '?q=' + $scope.searchText, function(res) { $scope.orgs = res.data; });
$scope.prev = function() { var url = 'api/organizations/search/'
+ $routeParams.page
+ '/'
+ $routeParams.size
+ '?q='
+ $scope.searchText
+ '&orderBy='
+ encodeURIComponent($routeParams.orderBy);
if ($routeParams.orderType == 'desc') {
url += "&reverse=true";
}
call_http_get($http, url, function(res) { $scope.orgs = res.data; });
$scope.pageSearch = function() {
if ($scope.searchText) { if ($scope.searchText) {
$location.url('/searchResults/' + ($scope.orgs.number - 1) + '/' + $scope.orgs.size + '/' + encodeURIComponent($scope.searchText)); return '/page/__PAGE__/__SIZE__/sortBy/__ORDER_BY__/__ORDER_TYPE__/search/' + encodeURIComponent($scope.searchText);
} else { } else {
$location.url('/searchResults/' + ($scope.orgs.number - 1) + '/' + $scope.orgs.size + '/_'); return '/page/__PAGE__/__SIZE__/sortBy/__ORDER_BY__/__ORDER_TYPE__/search/_';
} }
} }
$scope.next = function() {
if ($scope.searchText) {
$location.url('/searchResults/' + ($scope.orgs.number + 1) + '/' + $scope.orgs.size + '/' + encodeURIComponent($scope.searchText));
} else {
$location.url('/searchResults/' + ($scope.orgs.number + 1) + '/' + $scope.orgs.size + '/_');
}
}
}); });
orgsModule.controller('countriesCtrl', function ($scope, $http, $routeParams) { orgsModule.controller('countriesCtrl', function ($scope, $http, $routeParams) {
$scope.title = 'Countries'; $scope.title = 'Countries';
$scope.field = 'Country'; $scope.field = 'Country';
$scope.resultsBasePath = '/byCountry' $scope.resultsBasePath = '/page/0/50/sortBy/name/asc/byCountry';
$scope.entries = []; $scope.entries = [];
$scope.mode = $routeParams.mode; $scope.mode = $routeParams.mode;
@ -481,14 +552,29 @@ orgsModule.controller('byCountryCtrl', function ($scope, $http, $routeParams, $l
$scope.fieldValue = decodeURIComponent($routeParams.code); $scope.fieldValue = decodeURIComponent($routeParams.code);
$scope.orgs = {}; $scope.orgs = {};
call_http_get($http, 'api/organizations/byCountry/' + $routeParams.status + '/' + $routeParams.code + '/' + $routeParams.page + '/' + $routeParams.size, function(res) { $scope.orgs = res.data; }); var url = 'api/organizations/byCountry/'
+ $routeParams.status
+ '/'
+ $routeParams.code
+ '/'
+ $routeParams.page
+ '/'
+ $routeParams.size
+ '?orderBy='
+ encodeURIComponent($routeParams.orderBy)
$scope.prev = function() { if ($routeParams.orderType == 'desc') {
$location.url('/byCountry/' + ($scope.orgs.number - 1) + '/' + $scope.orgs.size + '/' + $routeParams.status + '/' + encodeURIComponent($scope.fieldValue)); url += "&reverse=true";
} }
$scope.next = function() {
$location.url('/byCountry/' + ($scope.orgs.number + 1) + '/' + $scope.orgs.size + '/' + $routeParams.status + '/' + encodeURIComponent($scope.fieldValue)); call_http_get($http, url, function(res) { $scope.orgs = res.data; });
$scope.pageByCountry = function() {
return '/page/__PAGE__/__SIZE__/sortBy/__ORDER_BY__/__ORDER_TYPE__/byCountry/'
+ $routeParams.status
+ '/'
+ encodeURIComponent($scope.fieldValue);
} }
}); });
@ -496,7 +582,7 @@ orgsModule.controller('byCountryCtrl', function ($scope, $http, $routeParams, $l
orgsModule.controller('typesCtrl', function ($scope, $http, $routeParams) { orgsModule.controller('typesCtrl', function ($scope, $http, $routeParams) {
$scope.title = 'Organization types'; $scope.title = 'Organization types';
$scope.field = 'Organization type'; $scope.field = 'Organization type';
$scope.resultsBasePath = '/byType' $scope.resultsBasePath = '/page/0/50/sortBy/name/asc/byType';
$scope.entries = []; $scope.entries = [];
$scope.mode = $routeParams.mode; $scope.mode = $routeParams.mode;
@ -509,15 +595,31 @@ orgsModule.controller('byTypeCtrl', function ($scope, $http, $routeParams, $loca
$scope.orgs = {}; $scope.orgs = {};
call_http_get($http, 'api/organizations/byType/' + $routeParams.status + '/' + $routeParams.type + '/' + $routeParams.page + '/' + $routeParams.size, function(res) { $scope.orgs = res.data; }); var url = 'api/organizations/byType/'
+ $routeParams.status
+ '/'
+ $routeParams.type
+ '/'
+ $routeParams.page
+ '/'
+ $routeParams.size
+ '?orderBy='
+ encodeURIComponent($routeParams.orderBy)
$scope.prev = function() { if ($routeParams.orderType == 'desc') {
$location.url('/byType/' + ($scope.orgs.number - 1) + '/' + $scope.orgs.size + '/' + $routeParams.status + '/' + encodeURIComponent($scope.fieldValue)); url += "&reverse=true";
} }
$scope.next = function() {
$location.url('/byType/' + ($scope.orgs.number + 1) + '/' + $scope.orgs.size + '/' + $routeParams.status + '/' + encodeURIComponent($scope.fieldValue)); call_http_get($http, url, function(res) { $scope.orgs = res.data; });
$scope.pageByType = function() {
return '/page/__PAGE__/__SIZE__/sortBy/__ORDER_BY__/__ORDER_TYPE__/byType/'
+ $routeParams.status
+ '/'
+ encodeURIComponent($scope.fieldValue);
} }
}); });

View File

@ -9,7 +9,7 @@
<meta http-equiv="Expires" content="0"> <meta http-equiv="Expires" content="0">
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link rel="stylesheet" href="common/css/bootstrap.cerulean.min.css" /> <link rel="stylesheet" href="resources/css/bootstrap.openorgs.css" />
<!-- Icons CSS --> <!-- Icons CSS -->
<link rel="stylesheet" href="common/css/fontawesome-all.min.css"> <link rel="stylesheet" href="common/css/fontawesome-all.min.css">
@ -19,8 +19,11 @@
<body> <body>
<div class="container"> <div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="#"><img src="resources/images/openaire_logo_small.png" width="30" height="30" alt="OpenAIRE logo"><span th:text="${sysconf.title}"></span></a> <a class="navbar-brand" href="#">
<img src="resources/images/openorgs_logo.png" />
<span th:text="${sysconf.title}"></span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button>

View File

@ -9,7 +9,7 @@
<meta http-equiv="Expires" content="0"> <meta http-equiv="Expires" content="0">
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link rel="stylesheet" href="common/css/bootstrap.cerulean.min.css" /> <link rel="stylesheet" href="resources/css/bootstrap.openorgs.css" />
<!-- Icons CSS --> <!-- Icons CSS -->
<link rel="stylesheet" href="common/css/fontawesome-all.min.css"> <link rel="stylesheet" href="common/css/fontawesome-all.min.css">
@ -19,8 +19,11 @@
<body ng-app="authReqApp" ng-controller="authReqCtrl"> <body ng-app="authReqApp" ng-controller="authReqCtrl">
<div class="container"> <div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="#"><img src="resources/images/openaire_logo_small.png" width="30" height="30" alt="OpenAIRE logo"><span th:text="${sysconf.title}"></span></a> <a class="navbar-brand" href="#">
<img src="resources/images/openorgs_logo.png" />
<span th:text="${sysconf.title}"></span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button>

View File

@ -13,7 +13,7 @@
<meta http-equiv="Expires" content="0"> <meta http-equiv="Expires" content="0">
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link rel="stylesheet" href="common/css/bootstrap.cerulean.min.css" /> <link rel="stylesheet" href="resources/css/bootstrap.openorgs.css" />
<title th:text="${sysconf.title} + ': login'"></title> <title th:text="${sysconf.title} + ': login'"></title>
</head> </head>
@ -21,8 +21,11 @@
<body> <body>
<div> <div>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="#"><img src="resources/images/openaire_logo_small.png" width="30" height="30" alt="OpenAIRE logo"><span th:text="${sysconf.title}"></span></a> <a class="navbar-brand" href="#">
<img src="resources/images/openorgs_logo.png" />
<span th:text="${sysconf.title}"></span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button>

View File

@ -13,7 +13,7 @@
<meta http-equiv="Expires" content="0"> <meta http-equiv="Expires" content="0">
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link rel="stylesheet" href="common/css/bootstrap.cerulean.min.css" /> <link rel="stylesheet" href="resources/css/bootstrap.openorgs.css" />
<title th:text="${sysconf.title} + ': login'"></title> <title th:text="${sysconf.title} + ': login'"></title>
</head> </head>
@ -21,8 +21,11 @@
<body> <body>
<div> <div>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="#"><img src="resources/images/openaire_logo_small.png" width="30" height="30" alt="OpenAIRE logo"><span th:text="${sysconf.title}"></span></a> <a class="navbar-brand" href="#">
<img src="resources/images/openorgs_logo.png" />
<span th:text="${sysconf.title}"></span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button>

View File

@ -10,7 +10,7 @@
<meta http-equiv="Expires" content="0"> <meta http-equiv="Expires" content="0">
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link rel="stylesheet" href="common/css/bootstrap.cerulean.min.css" /> <link rel="stylesheet" href="resources/css/bootstrap.openorgs.css" />
<!-- Icons CSS --> <!-- Icons CSS -->
<link rel="stylesheet" href="common/css/fontawesome-all.min.css"> <link rel="stylesheet" href="common/css/fontawesome-all.min.css">
@ -64,12 +64,16 @@ fieldset > legend { font-size : 1.2rem !important; }
<span class="grayRectangle"><!--The spinner is added on loading here--></span> <span class="grayRectangle"><!--The spinner is added on loading here--></span>
</div> </div>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary" ng-controller="menuCtrl"> <nav class="navbar navbar-expand-lg" ng-controller="menuCtrl">
<a class="navbar-brand" href="#"><img src="resources/images/openaire_logo_small.png" width="30" height="30" alt="OpenAIRE logo"><span th:text="${sysconf.title}"></span></a> <a class="navbar-brand" href="#">
<img src="resources/images/openorgs_logo.png" />
<span th:text="${sysconf.title}"></span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse w-100 order-1" id="navbarSupportedContent"> <div class="collapse navbar-collapse w-100 order-1" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Search</a> <a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Search</a>