Пример #1
0
  /**
   * Return URL to identity consolidator GUI with optional ?target= param having current Perun GUI
   * URL.
   *
   * @param target TRUE if use ?target= param in identity consolidator URL / FALSE otherwise
   * @return URL to identity consolidator
   */
  public static String getIdentityConsolidatorLink(boolean target) {

    // always use URL of machine, where GUI runs
    String baseUrl = Window.Location.getProtocol() + "//" + Window.Location.getHost();

    // FIXME - production consolidator is still using old URL scheme
    final String URL_KRB = baseUrl + "/perun-identity-consolidator-krb/";
    final String URL_FED = baseUrl + "/perun-identity-consolidator-fed/";
    final String URL_CERT = baseUrl + "/perun-identity-consolidator-cert/";
    String rpc = "";
    String link = "";

    if (PerunWebSession.getInstance().getRpcServer() != null) {
      rpc = PerunWebSession.getInstance().getRpcServer();
    }

    if (rpc.equalsIgnoreCase("krb")) {
      link = URL_KRB;
    } else if (rpc.equalsIgnoreCase("fed")) {
      link = URL_FED;
    } else if (rpc.equalsIgnoreCase("cert")) {
      link = URL_CERT;
    } else {
      // KRB AS BACKUP - "default"
      link = URL_KRB;
    }

    if (target) {
      link += "?target=" + Window.Location.getHref();
    }

    return link;
  }
Пример #2
0
  @Override
  protected void onBind() {
    super.onBind();

    redirect =
        Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/oauthcallback.html";

    // Get the login url for Google
    _requestCache.getGoogleUrl(
        redirect,
        new AsyncCallback<String>() {
          @Override
          public void onSuccess(final String url) {
            getView().setGoogleLoginUrl(url);
          }

          @Override
          public void onFailure(final Throwable caught) {}
        });

    // Get the login url for Facebook
    _requestCache.getFacebookUrl(
        redirect,
        new AsyncCallback<String>() {
          @Override
          public void onSuccess(final String url) {
            getView().setFacebookLoginUrl(url);
          }

          @Override
          public void onFailure(final Throwable caught) {}
        });
  }
Пример #3
0
 public void createDeepLink() {
   if (tabContent instanceof IFrameTabPanel) {
     PromptDialogBox dialogBox =
         new PromptDialogBox(
             Messages.getString("deepLink"),
             Messages.getString("ok"),
             Messages.getString("cancel"),
             false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             true);
     String url =
         Window.Location.getProtocol()
             + "//"
             + Window.Location.getHostName()
             + ":"
             + Window.Location.getPort()
             + Window.Location.getPath() // $NON-NLS-1$ //$NON-NLS-2$
             + "?name="
             + textLabel.getText()
             + "&startup-url="; //$NON-NLS-1$ //$NON-NLS-2$
     String startup = ((IFrameTabPanel) tabContent).getUrl();
     TextBox urlbox = new TextBox();
     urlbox.setText(url + URL.encodeComponent(startup));
     urlbox.setVisibleLength(80);
     dialogBox.setContent(urlbox);
     dialogBox.center();
   }
 }
Пример #4
0
  /**
   * Return URL to Password change GUI for selected namespace
   *
   * @param namespace namespace where we want to reset password
   * @return URL to password reset GUI
   */
  public static String getPasswordResetLink(String namespace) {

    String value =
        PerunWebSession.getInstance().getConfiguration().getCustomProperty("getPasswordResetUrl");

    if (value != null && !value.isEmpty()) {

      // PWD-RESET URL IS CONFIGURED AS FIXED
      if (namespace != null && !namespace.isEmpty()) {
        return value + "?login-namespace=" + namespace;
      } else {
        return value;
      }

    } else {

      // USE RELATIVE PWD-RESET URL

      String baseUrl = Window.Location.getProtocol() + "//" + Window.Location.getHost();

      if (!Utils.isDevel()) {

        // VALID URL FOR PRODUCTION

        String rpc = "";
        if (PerunWebSession.getInstance().getRpcServer() != null) {
          rpc = PerunWebSession.getInstance().getRpcServer();
        }

        if (rpc.equalsIgnoreCase("krb")) {
          baseUrl += "/krb";
        } else if (rpc.equalsIgnoreCase("fed")) {
          baseUrl += "/fed";
        } else if (rpc.equalsIgnoreCase("forceAuthn-fed")) {
          baseUrl += "/fed-force";
        } else if (rpc.equalsIgnoreCase("cert")) {
          baseUrl += "/cert";
        } else if (rpc.equalsIgnoreCase("einfra")) {
          baseUrl += "/krb-einfra";
        } else {
          // KRB AS BACKUP - "default"
          baseUrl += "/krb";
        }

        baseUrl += "/pwd-reset/";

      } else {

        // VALID URL FOR DEVEL
        baseUrl += "/PasswordResetKrb.html";
      }

      if (namespace != null && !namespace.isEmpty()) {
        return baseUrl + "?login-namespace=" + namespace;
      } else {
        return baseUrl;
      }
    }
  }
Пример #5
0
 public void refreshWebDAVPassword() {
   Configuration conf = (Configuration) GWT.create(Configuration.class);
   String domain = Window.Location.getHostName();
   String path = Window.Location.getPath();
   String cookie = conf.webdavCookie();
   webDAVPassword = Cookies.getCookie(cookie);
   Cookies.setCookie(cookie, "", null, domain, path, false);
 }
Пример #6
0
  /** Finalizes the <tt>User</tt> Logout operation. */
  protected void onSuccessfullLogout() {

    Window.Location.replace(GWT.getModuleBaseURL() + "OpenXDataServerAdmin.html");

    loginView.clearPassword();
    Context.setAuthenticatedUser(null);

    Window.Location.reload();
  }
Пример #7
0
 /**
  * Update localization of whole GUI (reset the app)
  *
  * @param locale Locale to set. Structure is "code":"val", "nativeName":"val", "englishName":"val"
  */
 public void setLocale(Map<String, String> locale) {
   if (locale == null) {
     GWT.log("WARN: Locale is null");
     return;
   }
   UrlBuilder builder =
       Window.Location.createUrlBuilder().setParameter("locale", locale.get("code"));
   Window.Location.replace(builder.buildString());
 }
Пример #8
0
 /** Clear the cookie and redirect the user to the logout page. */
 void logout() {
   Configuration conf = (Configuration) GWT.create(Configuration.class);
   String cookie = conf.authCookie();
   String domain = Window.Location.getHostName();
   String path = Window.Location.getPath();
   Cookies.setCookie(cookie, "", null, domain, path, false);
   String baseUrl = GWT.getModuleBaseURL();
   String homeUrl = baseUrl.substring(0, baseUrl.indexOf(path));
   Window.Location.assign(homeUrl + conf.logoutUrl());
 }
  /**
   * redirect unauthorized calls to login
   *
   * <p>TODO method.getResponse() is not equal to response. unfortunately
   */
  @Override
  public RequestCallback filter(
      final Method method, final Response response, RequestCallback callback) {
    if (LogConfiguration.loggingIsEnabled()) {
      Logger.getLogger(FilterawareRetryingCallback.class.getName())
          .severe("Unauthorized: " + method.builder.getUrl());
    }
    Window.Location.assign(target + Window.Location.getQueryString());

    // useless return, anyway
    return callback;
  }
  private void setInitialSelection() {
    final String ontologyName = com.google.gwt.user.client.Window.Location.getParameter("ontology");
    if (ontologyName == null || !projectId.getId().equals(ontologyName)) {
      return;
    }

    final String tabNameToSelect = com.google.gwt.user.client.Window.Location.getParameter("tab");
    if (tabNameToSelect == null) {
      return;
    }

    selectTabWithName(tabNameToSelect);
  }
 /** Costructor */
 public CollectionSummaryTeacherView() {
   this.res = CollectionSummaryTeacherCBundle.INSTANCE;
   res.css().ensureInjected();
   setWidget(uiBinder.createAndBindUi(this));
   String urlDomain = Window.Location.getProtocol() + "//" + Window.Location.getHost();
   style =
       "<link rel='styleSheet' type='text/css' href='"
           + urlDomain
           + "/css/googleVisualization.css'><link href='"
           + urlDomain
           + "/css/printAnalytics.css' rel='stylesheet' type='text/css'>";
   setData();
   printWidget.setVisible(false);
   downloadFile.setVisible(false);
 }
Пример #12
0
 private void showPopUp() {
   String authUrl =
       baseUrl
           + "/oauth/authenticate?oauth_provider=github"
           + "&scope=user,repo,write:public_key&userId="
           + userId
           + "&redirect_after_login="******"//"
           + Window.Location.getHost()
           + "/ws/"
           + Config.getWorkspaceName();
   JsOAuthWindow authWindow = new JsOAuthWindow(authUrl, "error.url", 500, 980, this);
   authWindow.loginWithOAuth();
 }
  /** Reads the configuration values defined by the bootstrap javascript. */
  private void loadFromDOM() {
    JsoConfiguration jsoConfiguration = getJsoConfiguration(id);
    serviceUrl = jsoConfiguration.getConfigString(ApplicationConstants.SERVICE_URL);
    if (serviceUrl == null || "".equals(serviceUrl)) {
      /*
       * Use the current url without query parameters and fragment as the
       * default value.
       */
      serviceUrl = Window.Location.getHref().replaceFirst("[?#].*", "");
    } else {
      /*
       * Resolve potentially relative URLs to ensure they point to the
       * desired locations even if the base URL of the page changes later
       * (e.g. with pushState)
       */
      serviceUrl = Util.getAbsoluteUrl(serviceUrl);
    }
    // Ensure there's an ending slash (to make appending e.g. UIDL work)
    if (!useServiceUrlPathParam() && !serviceUrl.endsWith("/")) {
      serviceUrl += '/';
    }

    vaadinDirUrl =
        Util.getAbsoluteUrl(jsoConfiguration.getConfigString(ApplicationConstants.VAADIN_DIR_URL));
    uiId = jsoConfiguration.getConfigInteger(UIConstants.UI_ID_PARAMETER).intValue();

    // null -> false
    standalone = jsoConfiguration.getConfigBoolean("standalone") == Boolean.TRUE;

    heartbeatInterval = jsoConfiguration.getConfigInteger("heartbeatInterval");

    communicationError = jsoConfiguration.getConfigError("comErrMsg");
    authorizationError = jsoConfiguration.getConfigError("authErrMsg");
    sessionExpiredError = jsoConfiguration.getConfigError("sessExpMsg");
  }
Пример #14
0
  public void save() {

    String frequency = month.getSelectedIndex() + "";
    String stat = statusButton.getValue() + "";
    String url = /*Window.Location.getUrl();*/ Window.Location.getHref().split("#", 2)[0];
    String day =
        DateTimeFormat.getFormat("yyyy-MM-dd").format(date.getValue())
            + " "
            + DateTimeFormat.getFormat("HH:mm:ss").format(time.getValue());
    //		Window.alert(frequency + " " + stat + " " + url + " " + day);
    mailingService.setMailing(
        stat,
        frequency,
        day,
        url,
        new AsyncCallback<Boolean>() {

          @Override
          public void onFailure(Throwable caught) {
            com.google.gwt.user.client.Window.alert("Error :" + caught.getMessage());
            save.setIcon(null);
            save.setEnabled(true);
          }

          @Override
          public void onSuccess(Boolean result) {
            com.google.gwt.user.client.Window.alert(result ? "Success!" : "Error!");
            save.setIcon(null);
            save.setEnabled(true);
          }
        });
  }
Пример #15
0
  @Override
  public void start(AcceptsOneWidget panel, EventBus eventBus) {
    panel.setWidget(view);

    GaeUserRequest request = rf.loginRequest();
    request
        .getCurrentUser()
        .to(
            new Receiver<GaeUserProxy>() {
              @Override
              public void onSuccess(GaeUserProxy user) {
                view.setNickname(user.getNickname());
              }
            });
    request
        .createLogoutURL(Window.Location.getHref())
        .to(
            new Receiver<String>() {
              @Override
              public void onSuccess(String url) {
                view.setLogoutURL(url);
              }
            });
    request.fire();
  }
  /**
   * 非同期メッセージ送信メソッド
   *
   * @param message
   */
  public void sendAsyncMessage(JSONObject message) {

    String href = Window.Location.getHref();
    postMessage(message.toString(), href);

    addSendLog(message);
  }
  public SinglePageLayout(Djvu_html5 app) {
    this.app = app;
    this.tileCache = app.getTileCache();
    this.pageCache = app.getPageCache();

    pageCache.addFullDecodeListener(this);
    tileCache.addTileCacheListener(this);

    this.canvas = app.getCanvas();

    this.background = app.getBackground();
    this.pageMargin = app.getPageMargin();

    new PanController();

    boolean pageParam = false;
    try {
      page = Integer.parseInt(Window.Location.getParameter("p")) - 1;
      pageParam = true;
    } catch (Exception e) {
      page = 0;
    }
    locationUpdateEnabled = pageParam || app.getLocationUpdateEnabled();
    pageCache.fetchPage(page);
  }
Пример #18
0
 public static String formHrefWithWindowLocationPath(String strToAppend) {
   String noUrlParams = Window.Location.getPath();
   // Append '/' if necessary.
   if (!strToAppend.isEmpty() && !StringUtil.match(noUrlParams, "\\/$")) {
     noUrlParams += "/";
   }
   return noUrlParams + strToAppend;
 }
Пример #19
0
  private boolean canShowTitle() {
    String parameter = Window.Location.getParameter("nochrome");

    if (parameter == null) {
      return true;
    } else {
      return parameter.equals("true");
    }
  }
Пример #20
0
 private void handleNarrativeOverride(MonsterGame.Config gameConf) {
   if (Window.Location.getParameter("override") != null) {
     String json = popupNarrativeOverride();
     try {
       gameConf.narrativeOverride = new NarrativeParser(plat.json()).parse(json);
     } catch (JsonParserException parseException) {
       popupParseException();
     }
   }
 }
  /** 同期メッセージング(試作) */
  private void sendSyncMessage(JSONObject message) {
    debug.timeAssert("11/07/23 8:40:07", 0, "yieldが正式に全ブラウザに実装されるまでは使えない。");

    String href = Window.Location.getHref();
    postMessage(message.toString(), href);

    // この辺にyieldでメッセージ受信の受付を行えば良い

    addSendLog(message);
  }
Пример #22
0
  @Override
  public void onValueChange(ValueChangeEvent<String> event) {
    String hash = event.getValue();

    recordAnalyticsHit(Window.Location.getPath() + Window.Location.getHash());

    String[] parts = hash.split(",");

    if (parts.length == 12) {
      String code = parts[0];
      Integer year = Integer.decode(parts[1]);
      try {
        Integer timeLineDataType = Integer.decode(parts[2]);
        Integer timeLineChartSelect0 = Integer.decode(parts[3]);
        Integer timeLineChartSelect1 = Integer.decode(parts[4]);
        Integer timeLineChartSelect2 = Integer.decode(parts[5]);
        Integer timeLineChartSelect3 = Integer.decode(parts[6]);
        Integer timeLineChartSelect4 = Integer.decode(parts[7]);
        Integer timeLineChartSelect5 = Integer.decode(parts[8]);
        Integer pieChartDataType = Integer.decode(parts[9]);
        Integer pieChartNet = Integer.decode(parts[10]);
        Integer resultsGridNet = Integer.decode(parts[11]);
        selectBudgetCode(code, year);
        mTimeLineCharter.setState(
            timeLineDataType,
            timeLineChartSelect0,
            timeLineChartSelect1,
            timeLineChartSelect2,
            timeLineChartSelect3,
            timeLineChartSelect4,
            timeLineChartSelect5);
        mPieCharter.setState(pieChartDataType, pieChartNet);
        mResultsGrid.setState(resultsGridNet);
      } catch (Exception e) {
        Log.error("Application::onValueChange: Error while parsing url", e);
        newCodeAndYear("00", 2012);
      }
    } else {
      Log.error("Application::onValueChange: Error while parsing url");
      newCodeAndYear("00", 2012);
    }
  }
 private String getPath() {
   String mypath = Window.Location.getPath();
   if (!mypath.endsWith("/")) { // $NON-NLS-1$
     mypath = mypath.substring(0, mypath.lastIndexOf("/") + 1); // $NON-NLS-1$
   }
   mypath = mypath.replaceAll("/mantle/", "/"); // $NON-NLS-1$ //$NON-NLS-2$
   if (!mypath.endsWith("/")) { // $NON-NLS-1$
     mypath = "/" + mypath; // $NON-NLS-1$
   }
   return mypath;
 }
Пример #24
0
 private void logAtomicOperation(ModelNode operation) {
   if (operation.get(OP).asString().equals(COMPOSITE)) // nested composite ops?
   {
     Log.error("Failed to to log resources access", operation.toString());
   } else if (operation.hasDefined(CHILD_TYPE)) {
     // ModelNode address = operation.get(ADDRESS).clone();
     // address.add(operation.get(CHILD_TYPE).toString(), "*");
     resourceLog.log(
         Window.Location.getHash(),
         operation.get(ADDRESS).toString()
             + " : "
             + operation.get(OP).asString()
             + "(child-type="
             + operation.get(CHILD_TYPE)
             + ")");
   } else {
     resourceLog.log(
         Window.Location.getHash(),
         operation.get(ADDRESS).toString() + " : " + operation.get(OP).asString());
   }
 }
Пример #25
0
  private void applyLogin(String name, JSONObject json) {
    JSONObject jsonObj = JSONHelper.getObject(json, "data");
    boolean found = JSONHelper.getPrimitiveBoolean(jsonObj, "found", false);
    if (!found) {
      Window.alert("Пользователь " + GWTUtils.safeString(name) + " не найден!");
    } else {
      elName.setValue("");
      setCurrentUser(name);

      Window.Location.reload();
    }
  }
  private void popoutTreeVisTab(TreeVisPlace place, int id) {
    // FIXME: this needs to be injected...
    AppPlaceHistoryMapper historyMapper = Entry.getPlaceHistoryMapper();

    String token = historyMapper.getToken(place);
    String url = Window.Location.createUrlBuilder().setHash(token).buildString();
    int width = Window.getClientWidth() / 2;
    int height = Window.getClientHeight() / 2;
    String features =
        "width=" + width + ",height=" + height + ",menubar=0,location=0,toolbar=0,status=0";

    TreeVisActivity.openPanel(this, url, "_blank", features, Integer.toString(id));
  }
  public static String getGeodeskId() {

    String geodeskId = Window.Location.getHref();
    if (!geodeskId.contains(GdmLayout.geodeskPrefix)) {
      return null;
    }
    geodeskId =
        geodeskId.substring(
            geodeskId.indexOf(GdmLayout.geodeskPrefix) + GdmLayout.geodeskPrefix.length());
    geodeskId = geodeskId.substring(0, geodeskId.indexOf('/'));

    return geodeskId;
  }
  /** @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#execute() */
  public void execute() {

    String sitePath = getHoverbar().getSitePath();
    if (!sitePath.endsWith("/")) {
      sitePath += "/";
    }
    CmsSitemapController controller = getHoverbar().getController();
    String uri = CmsCoreProvider.get().getUri() + "?path=" + sitePath;
    final String returnCode = Window.Location.getParameter(CmsCoreProvider.PARAM_RETURNCODE);
    if ((returnCode != null) && (returnCode.length() != 0)) {
      uri += "&returncode=" + returnCode;
    }
    controller.leaveEditor(uri);
  }
Пример #29
0
  private void addAdminMenu() {
    Button button = new Button("Admin");
    Menu menu = new Menu();
    menu.add(
        urlMenuItem(
            "Run System Maintenance Service",
            AbstractImagePrototype.create(Icons.INSTANCE.expand()),
            "http://"
                + com.google.gwt.user.client.Window.Location.getHostName()
                + "/cron/SystemMaint"));

    button.setMenu(menu);
    add(button);
  }
Пример #30
0
  /**
   * Creates the main view of Guvnor. The path used to invoke guvnor is used to identify the view to
   * show: If the path contains "StandaloneEditor.html" then the StandaloneGuidedEditorManager is
   * used to render the view. If not, the default view is shown.
   */
  private void createMain() {
    EventBus eventBus = new SimpleEventBus();
    SuggestionCompletionCache.getInstance().setEventBus(eventBus);
    ClientFactory clientFactory = new ClientFactoryImpl(eventBus);
    appController = new AppController(clientFactory, eventBus);

    if (Window.Location.getPath().contains("StandaloneEditor.html")) {
      RootLayoutPanel.get()
          .add(new StandaloneEditorManager(clientFactory, eventBus).getBaseLayout());
    } else {

      RootLayoutPanel.get().add(appController.getMainPanel());
    }
  }