Skip to content
Permalink
Browse files

Fixing merge conflicts of homolog and USP master derived branch

  • Loading branch information...
carlosbpf committed Sep 16, 2019
2 parents 8f79fa8 + 273ac27 commit c56a11abc179a4726ef12c53a69c622f7bf06db0
Showing with 692 additions and 8 deletions.
  1. +34 −0 sql/starter/new-futures-colab-data.sql
  2. +3 −0 sql/starter/xcolab-data.sql
  3. +3 −1 util/xcolab-utils/src/main/java/org/xcolab/util/enums/theme/ColabTheme.java
  4. +136 −0 view/src/main/java/org/xcolab/view/pages/content/UserGeneratedContentController.java
  5. +2 −1 view/src/main/java/org/xcolab/view/pages/loginregister/LoginRegisterService.java
  6. +5 −2 view/src/main/java/org/xcolab/view/pages/proposals/judging/ProposalReviewCsvExporter.java
  7. +4 −4 view/src/main/resources/i18n/homepage.properties
  8. +16 −0 view/src/main/resources/static/sass/themes/compassColab.scss
  9. +5 −0 view/src/main/resources/static/sass/themes/trustColab.scss
  10. +214 −0 view/src/main/resources/static/sass/variables/_t-compassColab.scss
  11. +212 −0 view/src/main/resources/static/sass/variables/_t-trustColab.scss
  12. BIN view/src/main/resources/static/themes/compassColab/images/CompassCoLab-logo-full.png
  13. BIN view/src/main/resources/static/themes/compassColab/images/compassColab-logo-big.png
  14. BIN view/src/main/resources/static/themes/compassColab/images/compassColab-logo.png
  15. BIN view/src/main/resources/static/themes/compassColab/images/compassColab-logo@2x.png
  16. BIN view/src/main/resources/static/themes/compassColab/images/compassColab-logo@3x.png
  17. BIN view/src/main/resources/static/themes/compassColab/images/favicon/android-chrome-192x192.png
  18. BIN view/src/main/resources/static/themes/compassColab/images/favicon/android-chrome-256x256.png
  19. BIN view/src/main/resources/static/themes/compassColab/images/favicon/apple-touch-icon.png
  20. +9 −0 view/src/main/resources/static/themes/compassColab/images/favicon/browserconfig.xml
  21. BIN view/src/main/resources/static/themes/compassColab/images/favicon/favicon-16x16.png
  22. BIN view/src/main/resources/static/themes/compassColab/images/favicon/favicon-32x32.png
  23. BIN view/src/main/resources/static/themes/compassColab/images/favicon/favicon.ico
  24. BIN view/src/main/resources/static/themes/compassColab/images/favicon/mstile-150x150.png
  25. +1 −0 view/src/main/resources/static/themes/compassColab/images/favicon/safari-pinned-tab.svg
  26. +19 −0 view/src/main/resources/static/themes/compassColab/images/favicon/site.webmanifest
  27. BIN view/src/main/resources/static/themes/compassColab/images/futureearth-logo.png
  28. BIN view/src/main/resources/static/themes/compassColab/images/homespot/background.png
  29. BIN view/src/main/resources/static/themes/compassColab/images/icon_mem-expert.png
  30. BIN view/src/main/resources/static/themes/compassColab/images/icon_mem-fellow.png
  31. BIN view/src/main/resources/static/themes/compassColab/images/icon_mem-judges.png
  32. BIN view/src/main/resources/static/themes/compassColab/images/icon_mem-member.png
  33. BIN view/src/main/resources/static/themes/compassColab/images/icon_mem-staff.png
  34. BIN view/src/main/resources/static/themes/compassColab/images/logo_mit_themed.png
  35. BIN view/src/main/resources/static/themes/compassColab/images/proposal_default.png
  36. BIN view/src/main/resources/static/themes/trustColab/images/FuturesCoLab-logo-full.png
  37. BIN view/src/main/resources/static/themes/trustColab/images/favicon/android-chrome-192x192.png
  38. BIN view/src/main/resources/static/themes/trustColab/images/favicon/android-chrome-256x256.png
  39. BIN view/src/main/resources/static/themes/trustColab/images/favicon/apple-touch-icon.png
  40. +9 −0 view/src/main/resources/static/themes/trustColab/images/favicon/browserconfig.xml
  41. BIN view/src/main/resources/static/themes/trustColab/images/favicon/favicon-16x16.png
  42. BIN view/src/main/resources/static/themes/trustColab/images/favicon/favicon-32x32.png
  43. BIN view/src/main/resources/static/themes/trustColab/images/favicon/favicon.ico
  44. BIN view/src/main/resources/static/themes/trustColab/images/favicon/mstile-150x150.png
  45. +1 −0 view/src/main/resources/static/themes/trustColab/images/favicon/safari-pinned-tab.svg
  46. +19 −0 view/src/main/resources/static/themes/trustColab/images/favicon/site.webmanifest
  47. BIN view/src/main/resources/static/themes/trustColab/images/futureearth-logo.png
  48. BIN view/src/main/resources/static/themes/trustColab/images/futuresColab-logo@2x.png
  49. BIN view/src/main/resources/static/themes/trustColab/images/futuresColab-logo@3x.png
  50. BIN view/src/main/resources/static/themes/trustColab/images/homespot/2nd-pg_header-art.png
  51. BIN view/src/main/resources/static/themes/trustColab/images/homespot/background.png
  52. BIN view/src/main/resources/static/themes/trustColab/images/homespot/footer_logo-usp.png
  53. BIN view/src/main/resources/static/themes/trustColab/images/homespot/header-art.png
  54. BIN view/src/main/resources/static/themes/trustColab/images/homespot/participate_background-people.jpg
  55. BIN view/src/main/resources/static/themes/trustColab/images/homespot/top-nav_logo-trustco.png
  56. BIN view/src/main/resources/static/themes/trustColab/images/icon_mem-expert.png
  57. BIN view/src/main/resources/static/themes/trustColab/images/icon_mem-fellow.png
  58. BIN view/src/main/resources/static/themes/trustColab/images/icon_mem-judges.png
  59. BIN view/src/main/resources/static/themes/trustColab/images/icon_mem-member.png
  60. BIN view/src/main/resources/static/themes/trustColab/images/icon_mem-staff.png
  61. BIN view/src/main/resources/static/themes/trustColab/images/logo_mit_themed.png
  62. BIN view/src/main/resources/static/themes/trustColab/images/proposal_default.png
  63. BIN view/src/main/resources/static/themes/trustColab/images/trustColab-logo-big.png
  64. BIN view/src/main/resources/static/themes/trustColab/images/trustColab-logo.png
  65. BIN view/src/main/resources/static/themes/trustColab/images/trustColab-logo@2x.png
  66. BIN view/src/main/resources/static/themes/trustColab/images/trustColab-logo@3x.png
@@ -0,0 +1,34 @@
-- Starter SQL statements for the New Futures CoLab

REPLACE INTO admin__configuration_attribute (name, additional_id, numeric_value, string_value, real_value) VALUES ('COLAB_NAME', 0, 1, 'Futures CoLab', 0);
REPLACE INTO admin__configuration_attribute (name, additional_id, numeric_value, string_value, real_value) VALUES ('ACTIVE_THEME', 0, 1, 'FUTURES_COLAB', 0);
-- REPLACE INTO admin__configuration_attribute (name, additional_id, numeric_value, string_value, real_value) VALUES ('PROPOSALS_COMMENTS_IN_SEPARATE_TAB', 0, 0, '', 0);
-- REPLACE INTO admin__configuration_attribute (name, additional_id, numeric_value, string_value, real_value) VALUES ('IS_I18N_ACTIVE', 0, 1, '', 0);
-- REPLACE INTO admin__configuration_attribute (name, additional_id, numeric_value, string_value, real_value) VALUES ('PROPOSALS_PHASE_CLOSED_SORT_ORDER', 0, 1, 'PROPOSAL_ID', 0);
-- REPLACE INTO admin__configuration_attribute (name, additional_id, numeric_value, string_value, real_value) VALUES ('PROPOSALS_PHASE_VOTING_SORT_ORDER', 0, 1, 'PROPOSAL_ID', 0);
REPLACE INTO admin__configuration_attribute (name, additional_id, numeric_value, string_value, real_value) VALUES ('FOOTER_CONTENT_ARTICLE_ID', 0, 8, '', 8);

REPLACE INTO content__content_article (id, author_user_id, created_at, max_version_id, folder_id, edit_role_group_id, view_role_group_id, visible) VALUES (8, 10144, '2016-05-11 09:21:08', 7, 2, null, null, 1);
REPLACE INTO content__content_article_version (id, article_id, folder_id, author_user_id, created_at, title, content) VALUES (8, 8, 2, 10144, '2016-07-19 12:38:47', 'Footer', '<div class="row py-3">
<div class="col-md-6 my-2"><a href="https://cci.mit.edu/" target="_blank"><img alt="MIT CCI" height="54" src="/images/logos/mit-cci.png" /> </a></div>
<div class="col-md-6 my-2">
<div class="media">
<div class="media-body c-Footer__text">Your use of the Ley del Cancer CoLab is subject to our <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons License</a>, <a href="/wiki/Privacy+policy">Privacy Statement</a>, and other <a href="/wiki/Terms+of+use">Terms of Use</a>.</div>
<img alt="CC BY NC SA" class="align-self-center ml-2" height="31" src="/images/logos/cc-by-nc-sa.svg" width="88" /></div>
</div>
</div>
<script> $(function() {
// link navbar button to contest directly
$($(".nav-item a")[1]).attr("href","/contests/2019/inteligencia-colectiva-para-la-ley-nacional-del-cancer");
// remove the slash from the proposals table
$(".c-TableGrid__header .col-12").contents().filter(function() {return this.nodeType == 3;}).remove();
$(".propname-authors").contents().filter(function() {return this.nodeType == 3;}).remove();
// increase the assigned area for the proposal name in the proposal table
$(".c-TableGrid__header .col-xl-6").addClass("col-xl-8").removeClass("col-xl-6");
$(".c-TableGrid__row--continued .col-xl-6").addClass("col-xl-8").removeClass("col-xl-6");
console.log("done");
}) </script>');
@@ -125,6 +125,9 @@ REPLACE INTO contest__contest_phase_ribbon_type (id, ribbon, title, hover_text,
REPLACE INTO contest__contest_phase_ribbon_type (id, ribbon, title, hover_text, show_text, description, copy_on_promote, sort_order) VALUES (4, 1, 'Winner', 'Judges'' Choice', 1, '', 0, 3);
REPLACE INTO contest__contest_phase_ribbon_type (id, ribbon, title, hover_text, show_text, description, copy_on_promote, sort_order) VALUES (5, 1, 'Winner', 'Judges'' & Popular Choice', 1, '', 0, 2);

REPLACE INTO contest__contest_phase (id, contest_id, contest_phase_type_id, contest_schedule_id, contest_phase_autopromote, phase_start_date, phase_end_date, created_at, updated_at) VALUES (1, 0, 1, 1, 'DEFAULT', '2017-03-23 02:33:06', null, '2017-03-23 02:33:06', '2017-03-23 02:33:06');
REPLACE INTO contest__contest_schedule (id, name, description, status, base_schedule_id) VALUES (1, '[DEFAULT] Contest Schedule', null, null, null);

REPLACE INTO contest__contest_phase_type (id, name, description, status, fellow_screening_active_default, contest_phase_autopromote_default, invisible, points_accessible, default_promotion_type, default_flag_text, is_deprecated) VALUES (1, 'Proposal creation', '<p>CoLab members create proposals</p>', 'OPEN_FOR_SUBMISSION', 0, '', 0, 2, 'PROMOTE', 'Open for proposals', 0);
REPLACE INTO contest__contest_phase_type (id, name, description, status, fellow_screening_active_default, contest_phase_autopromote_default, invisible, points_accessible, default_promotion_type, default_flag_text, is_deprecated) VALUES (11, 'Finalist selection', 'Expert judges select finalists<br/><br/>', 'CLOSED', 1, '', 0, 2, 'PROMOTE_JUDGED', null, 0);
REPLACE INTO contest__contest_phase_type (id, name, description, status, fellow_screening_active_default, contest_phase_autopromote_default, invisible, points_accessible, default_promotion_type, default_flag_text, is_deprecated) VALUES (14, 'Completed', 'Winners are awarded<br/><br/>', 'COMPLETED', 0, '', 0, 1, '', 'Winners announced', 0);
@@ -8,7 +8,9 @@
CROWDSENSOR("d71a11", 109, true),
RESILIENCE_DIALOGUES("30a3fb", 136),
CLIMATE_RISKS_COLAB("aa2029", 145, true),
FUTURES_COLAB("30a3fb", 145, true);
FUTURES_COLAB("30a3fb", 145, true),
TRUST_COLAB("30a3fb", 145, true),
COMPASS_COLAB("30a3fb", 145, true);

private final String themeName;
private final int logoWidth;
@@ -0,0 +1,136 @@
package org.xcolab.view.pages.content;

import au.com.bytecode.opencsv.CSVWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import org.xcolab.client.content.IContentClient;
import org.xcolab.client.content.exceptions.ContentNotFoundException;
import org.xcolab.client.content.pojo.IContentArticle;
import org.xcolab.client.content.pojo.IContentArticleVersion;

import org.xcolab.client.content.pojo.tables.pojos.ContentArticleVersion;
import org.xcolab.commons.exceptions.InternalException;
import org.xcolab.util.i18n.I18nUtils;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class UserGeneratedContentController {


private static final Long CONTENT_ARTICLE_ID = 27l;

@Autowired
private IContentClient contentClient;


@PostMapping("/content/usergenerated/create")
public void createUserGeneratedContent(HttpServletRequest request, HttpServletResponse response)
throws IOException {

String pattern = "MM/dd/yyyy HH:mm:sss";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);

StringBuffer csvString = new StringBuffer();
StringBuffer header = new StringBuffer();
header.append("create_at" + CSVWriter.DEFAULT_SEPARATOR);
csvString.append(simpleDateFormat.format(new Date()) + CSVWriter.DEFAULT_SEPARATOR);

Enumeration<String> parameters = request.getParameterNames();
while (parameters.hasMoreElements()) {
String aux = parameters.nextElement();

header.append(cleanupString(aux) + CSVWriter.DEFAULT_SEPARATOR);
csvString
.append(cleanupString(request.getParameter(aux)) + CSVWriter.DEFAULT_SEPARATOR);
}

try {
final IContentArticle contentArticle = contentClient.getContentArticle(CONTENT_ARTICLE_ID);
Locale locale = LocaleContextHolder.getLocale();
String localeString = "en";
if (locale.getLanguage() != null) {
localeString = locale.getLanguage();
}
String currentContent = "";

IContentArticleVersion oldContentArticleVersion = contentClient
.getLatestVersionByArticleIdAndLanguage(
contentArticle.getId(), localeString);
if (oldContentArticleVersion == null) {
oldContentArticleVersion = contentClient.getLatestVersionByArticleIdAndLanguage(
contentArticle.getId(),
I18nUtils.DEFAULT_LOCALE.getLanguage());
}


if (oldContentArticleVersion != null) {
currentContent = oldContentArticleVersion.getContent();
}

IContentArticleVersion contentArticleVersion = new ContentArticleVersion();

contentArticleVersion.setArticleId(oldContentArticleVersion.getArticleId());
contentArticleVersion.setLang(oldContentArticleVersion.getLang());

contentArticleVersion.setAuthorUserId(oldContentArticleVersion.getAuthorUserId());
contentArticleVersion.setFolderId((oldContentArticleVersion.getFolderId()));
contentArticleVersion.setTitle(oldContentArticleVersion.getTitle());
if (currentContent.isEmpty()) {
currentContent = header.toString() + "<br/>";
}
currentContent += csvString.toString() + "<br/>";

contentArticleVersion.setContent(currentContent);
contentClient.createContentArticleVersion(contentArticleVersion);

response.getOutputStream().write("{success: true}".getBytes());
} catch (ContentNotFoundException cnfe) {

}
}

private String cleanupString(String original) {
return original;
}

@GetMapping({"/content/usergenerated/retrievecontent"})
public void getJudgingCsv(HttpServletRequest request, HttpServletResponse response) {

try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

String csvPayload = "";

String separatorIndicationForExcel =
"sep=" + CSVWriter.DEFAULT_SEPARATOR + CSVWriter.DEFAULT_LINE_END;
csvPayload = separatorIndicationForExcel + csvPayload;
outputStream.write(csvPayload.getBytes());
response.setContentType("application/csv");
response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=export.csv");

response.setContentLength(outputStream.size());
OutputStream out = response.getOutputStream();
outputStream.writeTo(out);
out.flush();
out.close();
} catch (IOException e) {
throw new InternalException(e);
}
}
}
@@ -33,6 +33,7 @@
import java.sql.Timestamp;
import java.util.Date;
import java.util.Optional;
import java.util.UUID;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -155,7 +156,7 @@ public void updatePassword(String forgotPasswordToken, String newPassword)
}

public UserWrapper autoRegister(String emailAddress, String firstName, String lastName) {
return register(null, null, emailAddress, firstName, lastName,
return register(null,UUID.randomUUID().toString(), emailAddress, firstName, lastName,
"", null, null, true, null);
}

@@ -42,6 +42,7 @@ public ProposalReviewCsvExporter(ContestWrapper contest,
this.ratingTypes = ratingTypes;
}


public String getCsvString() {
if (proposalToProposalReviewsMap.isEmpty()) {
return "";
@@ -55,11 +56,13 @@ public String getCsvString() {
.getProposalAttribute(proposal.getId(),
ProposalAttributeKeys.NAME, 0L).getStringValue();



for (ProposalReview proposalReview : proposalReviews) {
for (UserWrapper reviewer : proposalReview.getReviewers()) {

tableBody.append(getRowHeader(proposalName, proposalReview));
tableBody.append(String.format("\"%s %s\"", reviewer.getFirstName(), reviewer.getLastName()));
tableBody.append(String.format("\"%s %s\"", (reviewer.getFirstName()), (reviewer.getLastName())));

StringBuilder commentString = new StringBuilder();

@@ -207,7 +210,7 @@ private String replaceNonAsciiCharacters(String str) {

private String escapeQuote(String input) {
//replace double quotes with single quotes (safer than 3 quotes)
input = StringUtils.replace(input, "\"", "'");
input = StringUtils.replace(input, "\\\"", "'");
//delete new lines
input = StringUtils.replace(input, "\r\n", " ");
input = StringUtils.replace(input, "\n", " ");
@@ -6,7 +6,7 @@ homepage.menu.donate=Donate
homepage.search.button=Search

homepage.menu.visitor.register=Register
homepage.menu.visitor.login=Login
homepage.menu.visitor.login=Log in
homepage.menu.visitor.language=Language
homepage.menu.help=Help

@@ -19,8 +19,8 @@ homepage.bottom.menu.contact=Contact
homepage.bottom.menu.help=Help
homepage.bottom.menu.register=Register
homepage.bottom.menu.myprofile=My Profile
homepage.bottom.menu.signin=Sign In
homepage.bottom.menu.signout=Sign Out
homepage.bottom.menu.signin=Log In
homepage.bottom.menu.signout=Log Out


homepage.login.or=OR
@@ -39,7 +39,7 @@ homepage.modals.sso.message.disclaimer=<colab-name/> will receive your <partner-
homepage.modals.sso.message.error=Authentication failed, please check your username and password.
homepage.modals.sso.field.username=Username:
homepage.modals.sso.field.password=Password:
homepage.modals.sso.button.login=LOGIN
homepage.modals.sso.button.login=LOG IN
colab.default.image.button.upload=UPLOAD image
@@ -0,0 +1,16 @@
// Override variables with theme specific variables
@import "../variables/t-compassColab";

// Import base theme
@import "../main";


.cb-navbar-background{
border-bottom: 1px solid #bababa;
background: url(https://sustainabledevelopment.un.org/content/images/sdgbg.jpg);
background-repeat: repeat-x;
background-position: bottom;
background-size: 160px 4px;
padding-bottom: 5px;
box-shadow: none;
}
@@ -0,0 +1,5 @@
// Override variables with theme specific variables
@import "../variables/t-trustColab";

// Import base theme
@import "../main";

0 comments on commit c56a11a

Please sign in to comment.
You can’t perform that action at this time.