예제 #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();
  }