[PATCH] Use help-url provided by ServerInfoService (fix for #1197)
Wald Commits
scm-commit at wald.intevation.org
Thu Jun 27 17:36:54 CEST 2013
# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1372347411 -7200
# Node ID ac6c41fcae55e390619ed6cb6e302c7d9ac02473
# Parent 6e54f72b4caf93d15b570518f25b12744d9629dd
Use help-url provided by ServerInfoService (fix for #1197).
Required some changes in FLYS.onModuleLoad(), should be reviewed by someone.
diff -r 6e54f72b4caf -r ac6c41fcae55 gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java Thu Jun 27 17:25:12 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java Thu Jun 27 17:36:51 2013 +0200
@@ -29,6 +29,7 @@
/** The xml document that contains the configuration options. */
protected Document config;
+ protected String helpUrl;
/**
* Get an instance by using {@link getInstance(Document)} or {@link
@@ -85,8 +86,11 @@
* @return wiki base URL
*/
public String getWikiUrl() {
- Node server = config.getElementsByTagName("wiki").item(0);
- return server.getFirstChild().getNodeValue();
+ return this.helpUrl;
+ }
+
+ public void setWikiUrl(String url) {
+ this.helpUrl = url;
}
diff -r 6e54f72b4caf -r ac6c41fcae55 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java Thu Jun 27 17:25:12 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java Thu Jun 27 17:36:51 2013 +0200
@@ -154,7 +154,7 @@
vertical.draw();
Config config = Config.getInstance();
- String locale = config.getLocale();
+ final String locale = config.getLocale();
serverInfoService.getConfig(locale, new AsyncCallback<Map<String,String>>() {
@@ -162,36 +162,39 @@
public void onSuccess(Map<String, String> result) {
GWT.log("serverInfoService.callBack.onSuccess");
GWT.log("help-url=" + result.get("help-url"));
+ Config.getInstance().setWikiUrl(result.get("help-url"));
+
+ // Start user service; somewhat nested here...
+ userService.getCurrentUser(locale, new AsyncCallback<User>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ GWT.log("Could not find a logged in user.");
+ String msg = getExceptionString(MSG, caught);
+ SC.warn(msg);
+ }
+
+ @Override
+ public void onSuccess(User user) {
+ GWT.log("Found a user. Set '"+ user.getName() + "'");
+ setCurrentUser(user);
+
+ header.setCurrentUser(user);
+
+ projectList = new ProjectList(FLYS.this, user);
+ workspace = new FLYSWorkspace(FLYS.this);
+ view.setProjectList(projectList);
+ view.setFLYSWorkspace(workspace);
+
+ readRivers();
+ }
+ });
}
@Override
public void onFailure(Throwable caught) {
- GWT.log("serverInfoService.callBack.onFailure");
-
- }
- });
-
- userService.getCurrentUser(locale, new AsyncCallback<User>() {
- @Override
- public void onFailure(Throwable caught) {
- GWT.log("Could not find a logged in user.");
- String msg = getExceptionString(MSG, caught);
- SC.warn(msg);
- }
-
- @Override
- public void onSuccess(User user) {
- GWT.log("Found a user. Set '"+ user.getName() + "'");
- setCurrentUser(user);
-
- header.setCurrentUser(user);
-
- projectList = new ProjectList(FLYS.this, user);
- workspace = new FLYSWorkspace(FLYS.this);
- view.setProjectList(projectList);
- view.setFLYSWorkspace(workspace);
-
- readRivers();
+ GWT.log("Could not read server information.");
+ String msg = getExceptionString(MSG, caught);
+ SC.warn(msg);
}
});
}
More information about the Dive4elements-commits
mailing list