Remove UI support

main
Paulo Gustavo Veiga 2024-02-16 22:17:38 -08:00
parent eaf03ea28d
commit b13748d47d
13 changed files with 3 additions and 601 deletions

View File

@ -86,7 +86,7 @@ final public class NotificationService {
mailerService.sendEmail(formMail, collabEmail, subject, model, "newCollaboration.vm");
} catch (Exception e) {
handleException(e);
logger.info(e.getMessage(), e);
}
}
@ -141,16 +141,10 @@ final public class NotificationService {
logger.debug("Email properties->" + model);
mailerService.sendEmail(mailerService.getServerSenderEmail(), user.getEmail(), mailSubject, model, "baseLayout.vm");
} catch (Exception e) {
handleException(e);
logger.info(e.getMessage(), e);
}
}
private void handleException(Exception e) {
System.err.println("An expected error has occurred trying to send an email notification. Usually, the main reason for this is that the SMTP server properties has not been configured properly. Edit the WEB-INF/app.properties file and verify the SMTP server configuration properties.");
System.err.println("Cause:" + e.getMessage());
}
public void setMailer(MailerService mailerService) {
this.mailerService = mailerService;
}

View File

@ -1,41 +0,0 @@
/*
* Copyright [2022] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.view;
public class ChangePasswordBean {
private String password;
private String retryPassword;
public String getPassword() {
return password;
}
public void setPassword(String e) {
this.password = e;
}
public String getRetryPassword() {
return retryPassword;
}
public void setRetryPassword(String e) {
this.retryPassword = e;
}
}

View File

@ -1,42 +0,0 @@
/*
* Copyright [2022] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.webmvc;
import org.jetbrains.annotations.NotNull;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourcePropertySource;
import org.springframework.web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.support.ServletContextResource;
import java.io.IOException;
import java.util.Objects;
public class ApplicationContextInitializer implements org.springframework.context.ApplicationContextInitializer<ConfigurableWebApplicationContext> {
public void initialize(@NotNull ConfigurableWebApplicationContext ctx) {
try {
final Resource resource = new ServletContextResource(Objects.requireNonNull(ctx.getServletContext()), "/WEB-INF/app.properties");
final ResourcePropertySource resourcePropertySource = new ResourcePropertySource(resource);
ctx.getEnvironment().getPropertySources().addFirst(resourcePropertySource);
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
}

View File

@ -1,167 +0,0 @@
/*
* Copyright [2022] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.webmvc;
import com.wisemapping.exceptions.AccessDeniedSecurityException;
import com.wisemapping.exceptions.MapCouldNotFoundException;
import com.wisemapping.exceptions.MapNotPublicSecurityException;
import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.model.CollaborationRole;
import com.wisemapping.model.Mindmap;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.service.LockManager;
import com.wisemapping.service.MindmapService;
import com.wisemapping.view.MindMapBean;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.Locale;
@Controller
@Transactional(propagation = Propagation.REQUIRED)
public class MvcMindmapController {
@Qualifier("mindmapService")
@Autowired
private MindmapService mindmapService;
@RequestMapping(value = "c/maps/{id}/print")
public String showPrintPage(@PathVariable int id, @NotNull Model model) throws MapCouldNotFoundException, AccessDeniedSecurityException {
final MindMapBean mindmap = findMindmapBean(id);
model.addAttribute("principal", Utils.getUser());
model.addAttribute("mindmap", mindmap);
model.addAttribute("creatorFullName", mindmap.getCreator().getFullName());
final Locale locale = LocaleContextHolder.getLocale();
model.addAttribute("locale", locale.toString().toLowerCase());
return "mindmapViewonly";
}
@RequestMapping(value = "c/maps/")
public String showListPage(@NotNull Model model) {
return "reactInclude";
}
@RequestMapping(value = "c/maps/{id}/edit", method = RequestMethod.GET)
public String showMindmapEditorPage(@PathVariable int id, @NotNull Model model) throws WiseMappingException {
return showEditorPage(id, model, true);
}
private String showEditorPage(int id, @NotNull final Model model, boolean requiresLock) throws WiseMappingException {
final MindMapBean mindmapBean = findMindmapBean(id);
final Mindmap mindmap = mindmapBean.getDelegated();
final User user = Utils.getUser();
final Locale locale = LocaleContextHolder.getLocale();
// Is the mindmap locked ?.
boolean isLocked = false;
boolean readOnlyMode = !requiresLock || !mindmap.hasPermissions(user, CollaborationRole.EDITOR);
if (!readOnlyMode) {
final LockManager lockManager = this.mindmapService.getLockManager();
if (lockManager.isLocked(mindmap) && !lockManager.isLockedBy(mindmap, user)) {
isLocked = true;
}
model.addAttribute("lockInfo", lockManager.getLockInfo(mindmap));
}
// Set render attributes ...
model.addAttribute("mindmap", mindmapBean);
// Configure default locale for the editor ...
model.addAttribute("locale", locale.toString().toLowerCase());
model.addAttribute("principal", user);
model.addAttribute("mindmapLocked", isLocked);
return "mindmapEditor";
}
@RequestMapping(value = "c/maps/{id}/view", method = RequestMethod.GET)
public String showMindmapViewerPage(@PathVariable int id, @NotNull Model model) throws WiseMappingException {
final String result = showPrintPage(id, model);
return result;
}
@RequestMapping(value = "c/maps/{id}/try", method = RequestMethod.GET)
@PreAuthorize("permitAll()")
public String showMindmapTryPage(@PathVariable int id, @NotNull Model model) throws WiseMappingException {
return showEditorPage(id, model, false);
}
@RequestMapping(value = "c/maps/{id}/{hid}/view", method = RequestMethod.GET)
public String showMindmapViewerRevPage(@PathVariable int id, @PathVariable int hid, @NotNull Model model) throws WiseMappingException {
final String result = showPrintPage(id, model);
model.addAttribute("hid", String.valueOf(hid));
return result;
}
@RequestMapping(value = "c/maps/{id}/embed")
@PreAuthorize("permitAll()")
public ModelAndView showEmbeddedPage(@PathVariable int id, @RequestParam(required = false) Float zoom) throws MapCouldNotFoundException, MapNotPublicSecurityException, AccessDeniedSecurityException {
if (!mindmapService.isMindmapPublic(id)) {
throw new MapNotPublicSecurityException("Map " + id + " is not public.");
}
final MindMapBean mindmap = findMindmapBean(id);
final ModelAndView view = new ModelAndView("mindmapViewonly", "mindmap", mindmap);
view.addObject("zoom", zoom == null ? 1 : zoom);
final Locale locale = LocaleContextHolder.getLocale();
view.addObject("locale", locale.toString().toLowerCase());
return view;
}
@RequestMapping(value = "c/maps/{id}/public", method = RequestMethod.GET)
@PreAuthorize("permitAll()")
public String showPublicViewPage(@PathVariable int id, @NotNull Model model) throws WiseMappingException {
if (!mindmapService.isMindmapPublic(id)) {
throw new MapNotPublicSecurityException("Map " + id + " is not public.");
}
return this.showPrintPage(id, model);
}
@NotNull
private Mindmap findMindmap(int mapId) throws MapCouldNotFoundException {
final Mindmap result = mindmapService.findMindmapById(mapId);
if (result == null) {
throw new MapCouldNotFoundException("Map could not be found " + mapId);
}
return result;
}
@NotNull
private MindMapBean findMindmapBean(int mapId) throws MapCouldNotFoundException, AccessDeniedSecurityException {
final User user = Utils.getUser();
if (!mindmapService.hasPermissions(user, mapId, CollaborationRole.VIEWER)) {
throw new AccessDeniedSecurityException(mapId, user);
}
final Mindmap mindmap = findMindmap(mapId);
return new MindMapBean(mindmap, Utils.getUser());
}
}

View File

@ -1,68 +0,0 @@
/*
* Copyright [2022] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.webmvc;
import com.wisemapping.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class MvcUsersController {
@Qualifier("userService")
@Autowired
private UserService userService;
@RequestMapping(value = "c/forgot-password", method = RequestMethod.GET)
@PreAuthorize("permitAll()")
public ModelAndView showResetPasswordPage() {
return new ModelAndView("reactInclude");
}
@RequestMapping(value = "c/registration-google", method = RequestMethod.GET)
@PreAuthorize("permitAll()")
public ModelAndView processGoogleCallback() {
return new ModelAndView("reactInclude");
}
@RequestMapping(value = "c/registration", method = RequestMethod.GET)
@PreAuthorize("permitAll()")
public ModelAndView showRegistrationPage() {
return new ModelAndView("reactInclude");
}
@RequestMapping(value = "c/registration-success", method = RequestMethod.GET)
@PreAuthorize("permitAll()")
public ModelAndView showRegistrationSuccess() {
return new ModelAndView("reactInclude");
}
@RequestMapping(value = "c/forgot-password-success", method = RequestMethod.GET)
@PreAuthorize("permitAll()")
public ModelAndView showResetPasswordSuccess() {
return new ModelAndView("reactInclude");
}
}

View File

@ -46,7 +46,7 @@ logging:
org:
apache:
tomcat: INFO
root: TRACE
root: INFO
# Application Configuration.
app:

View File

@ -1 +0,0 @@
google.com, pub-4996113942657337, DIRECT, f08c47fec0942fa0

View File

@ -1,9 +0,0 @@
Sitemap: https://www.wisemapping.com/sitemap.xml
User-agent: *
Allow: /
Disallow: /c/restful/maps/*/document/xml-pub
Disallow: /c/maps/*/edit
Disallow: /c/maps/*/public
Disallow: /c/maps/*/try

View File

@ -1,7 +0,0 @@
<%@taglib uri="jakarta.tags.functions" prefix="fn" %>
<%@taglib uri="jakarta.tags.core" prefix="c"%>
<%
request.setAttribute("principal", com.wisemapping.security.Utils.getUser());
%>

View File

@ -1,53 +0,0 @@
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ include file="init.jsp" %>
<%--@elvariable id="mindmap" type="com.wisemapping.model.Mindmap"--%>
<%--@elvariable id="editorTryMode" type="java.lang.Boolean"--%>
<%--@elvariable id="editorTryMode" type="java.lang.String"--%>
<%--@elvariable id="lockInfo" type="com.wisemapping.service.LockInfo"--%>
<c:set var="baseUrl" value="${requestScope['site.baseurl']}" scope="request" />
<c:set var="baseJsUrl" value="${requestScope['site.static.js.url']}" scope="request" />
<!DOCTYPE html>
<html lang="${fn:substring(locale,0,2)}">
<head>
<base href="${baseUrl}/static/webapp/" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="utf-8" />
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'" crossorigin>
<%@ include file="pageHeaders.jsf" %>
<title>Loading ... | WiseMapping</title>
<script>
window.serverconfig = {
apiBaseUrl: '${requestScope['site.baseurl']}',
analyticsAccount: '${requestScope['google.analytics.account']}',
clientType: 'rest',
recaptcha2Enabled: ${requestScope['google.recaptcha2.enabled']},
recaptcha2SiteKey: '${requestScope['google.recaptcha2.siteKey']}'
};
</script>
<script type="text/javascript">
var mapId = '${mindmap.id}';
var mindmapLocked = ${mindmapLocked};
var mindmapLockedMsg = '<spring:message code="MINDMAP_LOCKED" arguments="${lockInfo.user.fullName},${lockInfo.user.email}"/>';
var userOptions = ${mindmap.properties};
var accountName = '${fn:replace(principal.fullName,'\'','\\\'')}';
var accountEmail = '${principal.email}';
var mapTitle = '${fn:replace(mindmap.title,'\'','\\\'')}';
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root" class="mindplot-div-container"></div>
<script type="text/javascript" src="${baseJsUrl}/webapp/vendors.bundle.js" crossorigin="anonymous" defer></script>
<script type="text/javascript" src="${baseJsUrl}/webapp/app.bundle.js" crossorigin="anonymous" defer></script>
</body>
</html>

View File

@ -1,120 +0,0 @@
<%@page pageEncoding="UTF-8" %>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@include file="init.jsp" %>
<c:set var="baseUrl" value="${requestScope['site.baseurl']}" scope="request" />
<c:set var="baseJsUrl" value="${requestScope['site.static.js.url']}" scope="request" />
<%--@elvariable id="mindmap" type="com.wisemapping.model.Mindmap"--%>
<!DOCTYPE HTML>
<html lang="${fn:substring(locale,0,2)}">
<head>
<base href="${baseUrl}/static/mindplot/" />
<meta name="viewport" content="initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'" crossorigin>
<link rel="preload" href="../../css/viewonly.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<title>${mindmap.title} | <spring:message code="SITE.TITLE"/></title>
<%@ include file="pageHeaders.jsf" %>
<script type="text/javascript">
var mapId = '${mindmap.id}';
var historyId = '${hid}';
var userOptions = ${mindmap.properties};
var locale = '${locale}';
var isAuth = ${principal != null};
</script>
<c:if test="${requestScope['google.analytics.enabled']}">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=${requestScope['google.analytics.account']}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${requestScope['google.analytics.account']}',
{
'page_title' : 'Public View'
});
</script>
</c:if>
<style>
body {
height: 100vh;
width: 100vw;
min-width: 100vw;
min-height: 100vh;
margin: 0px;
}
.mindplot-div-container {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="root" class="mindplot-div-container">
<mindplot-component id="mindmap-comp"/>
</div>
<div id="mindplot-tooltips" className="wise-editor"></div>
<a href="${requestScope['site.homepage']}" target="new" aria-label="WiseMapping Homepage">
<div id="footerLogo"></div>
</a>
<div id="mapDetails">
<span class="title"><spring:message code="CREATOR"/>:</span><span>${creatorFullName}</span>
<span class="title"><spring:message code="DESCRIPTION"/>:</span><span>${mindmap.title}</span>
</div>
<script type="text/javascript" src="${baseJsUrl}/mindplot/loader.js" crossorigin="anonymous" defer></script>
<div id="floating-panel">
<div id="zoom-button">
<button id="zoom-plus" title="<spring:message code="ZOOM_IN"/>" alt="<spring:message code="ZOOM_IN"/>">
<img src="../../images/add.svg" width="24" height="24" alt="<spring:message code="ZOOM_IN"/>"/>
</button>
<button id="zoom-minus" title="<spring:message code="ZOOM_OUT"/>" alt="<spring:message code="ZOOM_OUT"/>">
<img src="../../images/minus.svg" width="24" height="24" alt="<spring:message code="ZOOM_OUT"/>"/>
</button>
<div id="position">
<button id="position-button" title="<spring:message code="ZOOM_TO_FIT"/>" alt="<spring:message code="ZOOM_TO_FIT"/>">
<img src="../../images/center_focus.svg" width="24" height="24" alt="<spring:message code="ZOOM_TO_FIT"/>"/>
</button>
</div>
</div>
</div>
<script type="text/javascript">
// Hook zoom events ...
const zoomInButton = document.getElementById('zoom-plus');
if (zoomInButton) {
zoomInButton.addEventListener('click', () => {
designer.zoomIn();
});
}
const zoomOutButton = document.getElementById('zoom-minus');
if (zoomOutButton) {
zoomOutButton.addEventListener('click', () => {
designer.zoomOut();
});
}
const position = document.getElementById('position');
if (position) {
position.addEventListener('click', () => {
designer.zoomToFit();
});
}
</script>
</body>
</html>

View File

@ -1,24 +0,0 @@
<%@taglib uri="jakarta.tags.core" prefix="c"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#000000" />
<meta name="author" content="wisemapping">
<meta name="publisher" content="wisemapping">
<meta name="keywords"
content="mindmap,mind map,mind maps,mindmaps,ideas,brainstorming,organize,thoughts,structure,collaboration,free,fast,simple,online,tool,knowledge,share,sharing,publish">
<meta name="description"
content="wisemapping is a free, fast and simple online mind mapping editor for individuals and business. sign up to start organizing and sharing your ideas and thoughts.">
<meta property="og:title" content="wisemapping"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.wisemapping.com"/>
<meta property="og:image" content="http://www.wisemapping.com/images/logo.png"/>
<meta property="og:site_name" content="wisemapping.com"/>
<link rel="icon" href="../../favicon.ico" type="image/x-icon"/>
<link rel="apple-touch-icon" href="../../favicon.png" />
<link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon"/>
<sec:csrfMetaTags />

View File

@ -1,60 +0,0 @@
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@taglib uri="jakarta.tags.functions" prefix="fn" %>
<%@taglib uri="jakarta.tags.core" prefix="c"%>
<c:set var="baseUrl" value="${requestScope['site.baseurl']}" scope="request" />
<c:set var="baseJsUrl" value="${requestScope['site.static.js.url']}" scope="request" />
<!DOCTYPE html>
<html lang="${fn:substring(locale,0,2)}">
<head>
<base href="${baseUrl}/static/webapp/" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="utf-8" />
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'" crossorigin>
<%@ include file="pageHeaders.jsf" %>
<script>
window.serverconfig = {
apiBaseUrl: '${requestScope['site.baseurl']}',
analyticsAccount: '${requestScope['google.analytics.account']}',
clientType: 'rest',
recaptcha2Enabled: ${requestScope['google.recaptcha2.enabled']},
recaptcha2SiteKey: '${requestScope['google.recaptcha2.siteKey']}',
googleOauth2Url: '${requestScope['security.oauth2.google.url']}'
};
<%-- Hack to force view selection on react to move all the UI to react --%>
window.errorMvcView = '${requestScope['exception']!=null?(fn:indexOf(requestScope['exception'],'SecurityException') gt 1?'securityError':'unexpectedError'):''}';
/*
${requestScope['exception']}
*/
</script>
<c:if test="${requestScope['google.analytics.enabled']}">
<%-- Google Ads Sense Config. Lazy loading optimization --%>
<script type="text/javascript">
function downloadJsAtOnload() {
setTimeout(function downloadJs() {
var element = document.createElement("script");
element.setAttribute("data-ad-client", "ca-pub-4996113942657337");
element.async = true;
element.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
document.body.appendChild(element);
}, 50);
};
window.addEventListener("load", downloadJsAtOnload, false);
</script>
</c:if>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="text/javascript" src="${baseJsUrl}/webapp/vendors.bundle.js" crossorigin="anonymous" async></script>
<script type="text/javascript" src="${baseJsUrl}/webapp/app.bundle.js" crossorigin="anonymous" async></script>
</body>
</html>