コード例 #1
0
 /** @todo reimplement */
 public boolean isOwnerOfProject(IWContext iwc) {
   Page p = this.getParentPage();
   if (p != null) {
     try {
       return iwc.getAccessController().isOwner(p, iwc);
     } catch (Exception ex) {
       System.err.println(ex.getMessage());
       return false;
     }
   } else {
     return false;
   }
 }
コード例 #2
0
  public PresentationObject getObjectToAddToColumn(
      int colIndex, int rowIndex, Object item, IWContext iwc, boolean beforeEntities)
      throws Exception {
    if (item == null) {
      if (beforeEntities && (rowIndex == 1)) {
        Text text = new Text();
        text.setFontFace(Text.FONT_FACE_ARIAL);
        text.setFontColor("#FFFFFF");
        text.setFontSize(Text.FONT_SIZE_7_HTML_1);
        text.setBold();

        switch (colIndex) {
          case 2:
            text.setText("Name");
            break;
          case 4:
            text.setText("Title");
            break;
          case 6:
            text.setText("Phone");
            break;
          case 8:
            text.setText("e-mail");
            break;
          default:
            return null;
        }
        return text;
      }
    } else {
      Text text = new Text("");

      StaffHolder staffHolder = (StaffHolder) item;

      switch (colIndex) {
        case 2:
          /** @todo change accesscontrol */
          boolean staffHolderIsSuperAdmin =
              iwc.getAccessController().getAdministratorUser().getID() == staffHolder.getUserID();
          if (iwc.isSuperAdmin() && !staffHolderIsSuperAdmin) { // tmp
            text = new Link(staffHolder.getName());
            //              ((Link)text).setWindowToOpen(StaffEditor.class);
            //
            // ((Link)text).addParameter(StaffBusiness.PARAMETER_USER_ID,staffHolder.getUserID());
            ((Link) text).setWindowToOpen(StaffPropertyWindow.class);
            ((Link) text)
                .addParameter(StaffPropertyWindow.PARAMETERSTRING_USER_ID, staffHolder.getUserID());
          } else {
            text.setText(staffHolder.getName());
          }
          break;
        case 4:
          if (staffHolder.getTitle() != null) {
            text.setText(staffHolder.getTitle());
          }
          break;
        case 6:
          if (staffHolder.getWorkPhone() != null) {
            text.setText(staffHolder.getWorkPhone());
          }
          break;
        case 8:
          if (staffHolder.getEmail() != null) {
            text.setText(staffHolder.getEmail());
          }
          break;
        default:
          return null;
      }
      text.setFontSize(Text.FONT_SIZE_7_HTML_1);
      text.setFontFace(Text.FONT_FACE_ARIAL);
      return text;
    }
    return null;
  }