Пример #1
0
  // public PresentationObject getVisitForm(IWContext iwc, User userVK) throws
  // java.rmi.RemoteException {
  public UIComponent getDoctorForm() {
    IWResourceBundle iwrb = this.getResourceBundle(_iwc);
    Form myForm = new Form();
    myForm.setName(prmForm);

    Table table = new Table(3, 3);
    table.setCellpadding(0);
    table.setCellspacing(0);
    table.setBorder(0);
    table.setVerticalAlignment(1, 1, Table.VERTICAL_ALIGN_TOP);
    table.setVerticalAlignment(3, 1, Table.VERTICAL_ALIGN_TOP);
    table.setVerticalAlignment(1, 2, Table.VERTICAL_ALIGN_BOTTOM);
    table.setVerticalAlignment(1, 3, Table.VERTICAL_ALIGN_BOTTOM);

    table.setWidth(400);
    table.setWidth(2, 1, 15);
    table.setWidth(1, 1, 73);

    myForm.add(table);

    Age age = null;
    String doctorInfo = null;

    if (user != null && user.getDateOfBirth() != null) age = new Age(user.getDateOfBirth());
    else if (user != null && user.getPersonalID() != null)
      age = new Age(PIDChecker.getInstance().getDateFromPersonalID(user.getPersonalID()));

    int userIDDr = 45;

    if (age != null && age.getYears() >= 70) {
      userIDDr = 46; // 45   41047
    }

    PresentationObject picture = null;
    User doctor = null;

    int userImageID = -1;
    try {
      doctor =
          ((UserBusiness) IBOLookup.getServiceInstance(_iwc, UserBusiness.class)).getUser(userIDDr);
    } catch (Exception fe) {
      log(fe);
    }

    if (doctor != null) userImageID = doctor.getSystemImageID();

    if (userImageID == -1) {
      Table fakeImageTable = new Table(1, 1);
      fakeImageTable.setAlignment(1, 1, Table.HORIZONTAL_ALIGN_CENTER);
      fakeImageTable.setBorder(4);
      fakeImageTable.setHeight(140);
      fakeImageTable.setWidth(100);
      String fakeImageColor = "#CCCCCC";
      Text photoText = new Text(iwrb.getLocalizedString("managerview.photo_text", "Photo"));
      photoText.setBold();
      photoText.setFontColor(fakeImageColor);
      photoText.setFontSize(Text.FONT_SIZE_12_STYLE_TAG);
      fakeImageTable.add(photoText, 1, 1);
      fakeImageTable.setBorderColor(fakeImageColor);
      picture = fakeImageTable;
    } else {
      Image image = new Image();
      image.setImageID(userImageID);
      image.setWidth(73);

      picture = image;
    }
    table.add(picture, 1, 1);

    if (age != null && age.getYears() >= 70) {
      doctorInfo =
          "<b>Dr. Inga Pren</b><br>Allmänläkare<br>Telefon:<br>018-987624<br>Telefontid: Mån-ons, kl 08:30-10.00<br>Webbsida: <a href='http://www.flogsta.se' target='_new'>www.flogsta.se</a>";
    } else {
      doctorInfo =
          "<b>Dr. Magne Syhl</b><br>Allmänläkare<br>Telefon:<br>018-987654<br>Telefontid: Mån-ons, kl 08-10.00<br>Webbsida: <a href='http://www.gimovc.se' target='_new'>www.gimovc.se</a>";
    }

    table.add(doctorInfo, 3, 1);
    GenericButton message =
        getButton(new GenericButton("send_message", localize(prmSendMessage, "Send message")));
    if (_messagePage != null) message.setPageToOpen(_messagePage);

    table.add(message, 3, 2);
    table.setHeight(3, 2, "25");

    GenericButton visitbooking =
        getButton(new GenericButton("visit", localize(prmVisitBooking, "Book an appointment")));
    if (_appointmentPage != null) visitbooking.setPageToOpen(_appointmentPage);

    SubmitButton smb = new SubmitButton();
    smb.setStyleClass("ehealth_InterfaceButton");
    smb.setValue("Skicka meddelande >");
    smb.setPageToOpen(132);

    table.add(visitbooking, 3, 3);

    return myForm;
  }
  public UIComponent getOverviewForm() {
    Form myForm = new Form();
    myForm.setName(prmForm);
    Table T = new Table(3, 3);
    T.setCellpadding(0);
    T.setCellspacing(0);
    T.setBorder(0);
    T.setBorderColor("#000000");
    T.setVerticalAlignment(1, 1, Table.VERTICAL_ALIGN_TOP);
    T.setVerticalAlignment(3, 1, Table.VERTICAL_ALIGN_TOP);
    // T.setVerticalAlignment(1, 4, Table.VERTICAL_ALIGN_BOTTOM);
    // T.add(getNavigationTree(iwc), 1, 1);
    T.add(getNavigationTree(), 1, 1);
    //	T.add(getInfoLayer(), 2, 1);

    T.add(new Break(3), 3, 1);
    //		T.setHeight(1, 3, "130");
    // T.setHeight(1, 4, "90");
    T.setWidth(2, 1, "40");
    myForm.add(T);

    Page pVisit = this.getParentPage();
    if (pVisit != null) {
      Script S = pVisit.getAssociatedScript();
      // pVisit.setOnLoad("setRowColor(document.getElementById('inf1_1'));");

      S.addFunction("setRowColor(obj)", setRowColorScript());
      S.addFunction("showHideLayer(obj)", showHideLayerScript());
      Script timeScript = myForm.getAssociatedFormScript();
      if (timeScript == null) {
        timeScript = new Script();
        myForm.setAssociatedFormScript(timeScript);
      }
    }

    ArrayList texts1 = new ArrayList();
    ArrayList texts2 = new ArrayList();

    if (age != null && age.getYears() >= 70) {
      texts1.add(localize(keySet1Text1U1, "Texten"));
      texts1.add(localize(keySet1Text2U1, "Texten"));
      texts1.add(localize(keySet1Text3U1, "Texten"));
      texts1.add(localize(keySet1Text4U1, "Texten"));
      texts1.add(localize(keySet1Text5U1, "Texten"));

      texts2.add(localize(keySet2Text1U1, "Texten"));
      texts2.add(localize(keySet2Text2U1, "Texten"));
      texts2.add(localize(keySet2Text3U1, "Texten"));
      texts2.add(localize(keySet2Text4U1, "Texten"));
      texts2.add(localize(keySet2Text5U1, "Texten"));

    } else {
      texts1.add(localize(keySet1Text1U2, "Texten"));
      texts1.add(localize(keySet1Text2U2, "Texten"));
      texts1.add(localize(keySet1Text3U2, "Texten"));
      texts1.add(localize(keySet1Text4U2, "Texten"));
      texts1.add(localize(keySet1Text5U2, "Texten"));

      texts2.add(localize(keySet2Text1U2, "Texten"));
      texts2.add(localize(keySet2Text2U2, "Texten"));
      texts2.add(localize(keySet2Text3U2, "Texten"));
      texts2.add(localize(keySet2Text4U2, "Texten"));
      texts2.add(localize(keySet2Text5U2, "Texten"));
    }

    Layer layerOut = new Layer(Layer.DIV);
    layerOut.setVisibility("visible");
    layerOut.setOverflow("scroll");
    layerOut.setPositionType("absolute");
    layerOut.setWidth("280");
    layerOut.setHeight("170");
    layerOut.setMarkupAttribute("class", "ehealth_div");

    Layer layer = new Layer(Layer.DIV);
    layer.setVisibility("hidden");
    layer.setOverflow("hidden");
    layer.setPositionType("absolute");
    layer.setWidth("250");
    layer.setHeight("145");
    layer.setMarkupAttribute("class", "ehealth_div_no_border");

    int theRow = 1;
    int i = 1;

    Iterator iter1 = texts1.iterator();
    Iterator iter2 = texts2.iterator();

    while (iter1.hasNext()) {
      Layer layers = (Layer) layer.clone();
      layers.setID("info" + i + "_" + theRow);
      String text = (String) iter1.next();
      layers.add(text);
      layerOut.add(layers);

      theRow++;
    }
    i++;
    theRow = 1;
    while (iter2.hasNext()) {
      Layer layers = (Layer) layer.clone();
      layers.setID("info" + i + "_" + theRow);
      String text = (String) iter2.next();
      layers.add(text);
      layerOut.add(layers);

      theRow++;
    }

    T.add(layerOut, 3, 1);
    return myForm;
  }