コード例 #1
0
ファイル: PhonePage.java プロジェクト: davidcai/vel
  private void renderEnterPhone() throws Exception {
    RequestContext ctx = getContext();
    User user = UserStore.getInstance().load(ctx.getUserID());
    Server fed = ServerStore.getInstance().loadFederation();

    writeFormOpen();

    TwoColFormControl twoCol = new TwoColFormControl(this);

    twoCol.writeTextRow(getString("profile:Phone.EnterHelp"));
    twoCol.writeSpaceRow();

    twoCol.writeRow(getString("profile:Phone.Number"));
    new PhoneInputControl(twoCol, "number")
        .limitCountries(fed.getVoiceCountries())
        .setInitialValue(user.getPhone())
        .render();

    twoCol.render();

    write("<br>");
    writeButton("enter", getString("controls:Button.Next"));
    write(" ");
    if (ctx.getCommand(1).equals(UrlGenerator.COMMAND_SETUP)) {
      new ButtonInputControl(this, "clear")
          .setSubdued(true)
          .setValue(getString("profile:Phone.Skip"))
          .render();
    } else if (!Util.isEmpty(user.getPhone())) {
      new ButtonInputControl(this, "clear")
          .setStrong(true)
          .setValue(getString("profile:Phone.Clear"))
          .render();
    }

    writeFormClose();
  }
コード例 #2
0
ファイル: PhonePage.java プロジェクト: davidcai/vel
  private void renderEnterCode() throws Exception {
    writeFormOpen();

    TwoColFormControl twoCol = new TwoColFormControl(this);

    twoCol.writeTextRow(getString("profile:Phone.CodeHelp", CODE_LEN));
    twoCol.writeSpaceRow();

    twoCol.writeRow(getString("profile:Phone.Number"));
    twoCol.writeEncode(Util.stripCountryCodeFromPhoneNumber(getParameterString("fullnumber")));

    twoCol.writeRow(getString("profile:Phone.Code", CODE_LEN));
    twoCol.writeTextInput("code", null, CODE_LEN, CODE_LEN);

    twoCol.render();

    write("<br>");
    writeButton("verify", getString("profile:Phone.Verify"));

    // Post back the number
    writeHiddenInput("fullnumber", null);

    writeFormClose();
  }
コード例 #3
0
ファイル: AdHocMessagePage.java プロジェクト: davidcai/vel
  @Override
  public void renderHTML() throws Exception {
    if (this.messageCount != null && this.messageCount.size() > 0) {
      for (String channel : this.messageCount.keySet()) {
        writeEncode(
            getString(
                "admin:AdHocMessage.MessagesSent",
                this.messageCount.get(channel),
                Channel.getDescription(channel, getLocale())));
        write("<br>");
      }
      return;
    }

    writeFormOpen();

    TwoColFormControl twoCol = new TwoColFormControl(this);

    // Users
    twoCol.writeRow(getString("admin:AdHocMessage.Users"));
    new ControlArray<Object>(twoCol, "users", null) {
      @Override
      public void renderRow(int rowNum, Object nothing) {
        writeTypeAheadInput(
            "user_" + rowNum,
            null,
            null,
            40,
            User.MAXSIZE_LOGINNAME,
            getPageURL(UserTypeAhead.COMMAND));
      }
    }.render();

    twoCol.writeSpaceRow();

    // Groups
    twoCol.writeRow(getString("admin:AdHocMessage.Groups"));
    new ControlArray<Object>(twoCol, "groups", null) {
      @Override
      public void renderRow(int rowNum, Object nothing) {
        writeTypeAheadInput(
            "group_" + rowNum,
            null,
            null,
            40,
            UserGroup.MAXSIZE_NAME,
            getPageURL(UserGroupTypeAhead.COMMAND));
      }
    }.render();

    twoCol.writeSpaceRow();

    // Channels
    Server fed = ServerStore.getInstance().loadFederation();

    twoCol.writeRow(getString("admin:AdHocMessage.Channels"));
    for (String channel : Channel.getPush()) {
      if (fed.isChannelEnabled(channel) == true) {
        twoCol.writeCheckbox(channel, Channel.getDescription(channel, getLocale()), false);
        twoCol.write(" ");
      }
    }

    twoCol.writeSpaceRow();

    // Subject
    twoCol.writeRow(getString("admin:AdHocMessage.Subject"));
    twoCol.writeTextInput("subject", null, 80, 128);

    // Body
    twoCol.writeRow(getString("admin:AdHocMessage.Body"));
    twoCol.writeRichEditField("body", null, 80, 10);

    twoCol.writeSpaceRow();

    // Schedule
    twoCol.writeRow(getString("admin:AdHocMessage.Schedule"));
    twoCol.writeDateTimeInput("date", new Date());

    twoCol.render();

    write("<br>");
    writeButton("send", getString("admin:AdHocMessage.Send"));

    writeFormClose();
  }