Exemple #1
0
  /**
   * @param rundata
   * @param context
   * @throws Exception
   */
  @Override
  protected void doOutput(RunData rundata, Context context) throws Exception {

    try {
      String portletId = ActivityUtils.getGlobalPortletId(rundata);
      context.put("portletId", ActivityUtils.getGlobalPortletId(rundata));
      Portlet portlet = ALEipUtils.getPortlet(rundata, portletId);
      String desktopNotificationParam =
          portlet.getPortletConfig().getInitParameter("desktopNotification");
      context.put("desktopNotification", "T".equals(desktopNotificationParam));
      String support = rundata.getParameters().getString("s");
      context.put("notifySupport", "1".equals(support));
      String permission = rundata.getParameters().getString("p");
      context.put("notifyPermission", "0".equals(permission) || "granted".equals(permission));

      ActivitySelectData listData = new ActivitySelectData();
      listData.initField();
      listData.setRowsNum(5);
      listData.doViewList(this, rundata, context);
      String layout_template = "portlets/html/ja/ajax-activity-list.vm";
      setTemplate(rundata, context, layout_template);
    } catch (Exception ex) {
      logger.error("ActivityListScreen.doOutput", ex);
      ALEipUtils.redirectDBError(rundata);
    }
  }
  /**
   * @param action
   * @param rundata
   * @param context
   * @throws ALPageNotFoundException
   * @throws ALDBErrorException
   */
  @Override
  public void init(ALAction action, RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {

    String sort = ALEipUtils.getTemp(rundata, context, LIST_SORT_STR);
    if (sort == null || sort.equals("")) {
      ALEipUtils.setTemp(
          rundata,
          context,
          LIST_SORT_STR,
          ALEipUtils.getPortlet(rundata, context).getPortletConfig().getInitParameter("p2a-sort"));
      logger.debug(
          "Init Parameter (Note) : "
              + ALEipUtils.getPortlet(rundata, context)
                  .getPortletConfig()
                  .getInitParameter("p2a-sort"));
    }

    super.init(action, rundata, context);
  }
 public void doActivity_list(RunData rundata, Context context) throws Exception {
   ActivityAllSelectData listData = new ActivityAllSelectData();
   listData.initField();
   // PSMLからパラメータをロードする
   // 最大表示件数(最大化時)
   listData.setRowsNum(
       Integer.parseInt(
           ALEipUtils.getPortlet(rundata, context)
               .getPortletConfig()
               .getInitParameter("p1b-rows")));
   listData.doViewList(this, rundata, context);
   setTemplate(rundata, "activity-list");
 }
Exemple #4
0
  /**
   * @param rundata
   * @param context
   * @throws Exception
   */
  @Override
  protected void doOutput(RunData rundata, Context context) throws Exception {

    // VelocityPortlet portlet = ALEipUtils.getPortlet(rundata, context);
    // String mode = rundata.getParameters().getString(ALEipConstants.MODE);
    try {
      int rows = 20;
      int scrollTop = 0;
      if (rundata.getParameters().containsKey("rows")) {
        rows = rundata.getParameters().getInt("rows");
      }
      if (rundata.getParameters().containsKey("scrollTop")) {
        scrollTop = rundata.getParameters().getInt("scrollTop");
      }
      if (rundata.getUserAgent().trim().indexOf("Mac") != -1) {
        context.put("isMacOS", "true");
      }

      ParameterParser parser = rundata.getParameters();

      ALEipUtils.passPSML(
          rundata, context, "p3a-group", parser.getString(TimelineUtils.TARGET_GROUP_NAME));
      ALEipUtils.passPSML(
          rundata, context, "p4a-group", parser.getString(TimelineUtils.TARGET_DISPLAY_NAME));

      TimelineSelectData listData = new TimelineSelectData();
      listData.initField();
      listData.setContentHeightMax(
          Integer.parseInt(
              ALEipUtils.getPortlet(rundata, context)
                  .getPortletConfig()
                  .getInitParameter("p1a-rows", "0")));
      listData.setRowsNum(rows);
      listData.setScrollTop(scrollTop);
      listData.doViewList(this, rundata, context);

      String layout_template = "portlets/html/ajax-timeline.vm";
      setTemplate(rundata, context, layout_template);

    } catch (Exception ex) {
      logger.error("[TimelineScreen] Exception.", ex);
      ALEipUtils.redirectDBError(rundata);
    }
  }
  /**
   * @param portlet
   * @param context
   * @param rundata
   * @throws Exception
   */
  @Override
  protected void buildNormalContext(VelocityPortlet portlet, Context context, RunData rundata)
      throws Exception {

    // セッション情報のクリア
    clearActivitySession(rundata, context);
    ActivityUtils.resetFilter(rundata, context, ActivityAllSelectData.class.getName());

    ActivityAllSelectData listData = new ActivityAllSelectData();
    listData.initField();
    // PSMLからパラメータをロードする
    // 最大表示件数(最大化時)
    listData.setRowsNum(
        Integer.parseInt(
            ALEipUtils.getPortlet(rundata, context)
                .getPortletConfig()
                .getInitParameter("p1a-rows")));
    listData.doViewList(this, rundata, context);
    setTemplate(rundata, "activity");
  }
  protected List<VEipTScheduleList> getScheduleList(RunData rundata, Context context) {

    Calendar cal = Calendar.getInstance();
    cal.setTime(getViewDate().getValue());
    cal.add(Calendar.DATE, 1);
    cal.add(Calendar.MILLISECOND, -1);
    ALDateTimeField field = new ALDateTimeField();
    field.setValue(cal.getTime());

    String filter = ALEipUtils.getTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE);
    String filter_type = ALEipUtils.getTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE_TYPE);

    if ("all".equals(filter)) {
      filter = filter_type = null;
      ALEipUtils.removeTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE);
      ALEipUtils.removeTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE_TYPE);
    }

    if (filter == null || filter_type == null || filter.equals("") || tmpViewDate2 != null) {

      members = new ArrayList<ALEipUser>();
      members.add(ALEipUtils.getALEipUser(rundata));
      ScheduleOnedayContainer con = new ScheduleOnedayContainer();
      con.initField();
      con.initHour(startHour, endHour);
      Integer uid = Integer.valueOf(ALEipUtils.getUserId(rundata));
      this.termmap.put(uid, new ArrayList<ScheduleOnedayResultData>());
      this.map.put(uid, con);
      this.todomap.put(uid, new ArrayList<ScheduleToDoResultData>());
      return ScheduleUtils.getScheduleList(
          userid, getViewDate().getValue(), field.getValue(), Arrays.asList(userid), null);
    }

    // グループ名からユーザを取得
    List<Integer> ulist = ALEipUtils.getUserIds(filter);

    // グループにユーザが存在しない場合はダミーユーザを設定し、検索します。(0件ヒット)
    // ダミーユーザーID = -1
    int size = ulist.size();
    if (size == 0) {
      ulist.add(Integer.valueOf(-1));
    } else {
      for (int i = 0; i < size; i++) {
        Integer id = ulist.get(i);
        ScheduleOnedayContainer con = new ScheduleOnedayContainer();
        con.initField();
        con.initHour(startHour, endHour);
        this.termmap.put(id, new ArrayList<ScheduleOnedayResultData>());
        this.map.put(id, con);
        this.todomap.put(id, new ArrayList<ScheduleToDoResultData>());
      }
    }

    // List facilityIds = FacilitiesUtils.getFacilityIds(filter);
    List<Integer> facilityIds = null;
    String[] filteres = filter.split(";");
    if ("Facility".equals(filter)) {
      facilityIds = getFacilityIdAllList();
    } else if (("group".equals(filter_type)) && !("f".equals(filteres[0]))) {
      facilityIds = FacilitiesUtils.getFacilityIds(filteres[0]);
    } else {
      if ("f".equals(filteres[0])) {
        facilityIds = FacilitiesUtils.getFacilityGroupIds(Integer.valueOf(filteres[1]));
      } else {
        if (ScheduleUtils.isNumberValue(filter)) {
          facilityIds = FacilitiesUtils.getFacilityGroupIds(Integer.valueOf(filter));
        } else {
          facilityIds = new ArrayList<Integer>();
          String[] split = filter.split(",");
          if (split.length == 2) {
            // URLパラメータにfilterが含まれてしまっていた場合
            // デフォルト値のセットしなおし
            // facilityIds初期化
            VelocityPortlet portlet = ALEipUtils.getPortlet(rundata, context);
            String groupName = portlet.getPortletConfig().getInitParameter("p3a-group");
            if (groupName != null) {
              ALEipUtils.setTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE, groupName);
              ALEipUtils.setTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE_TYPE, "group");
            }
          }
        }
      }
    }

    int f_size = facilityIds.size();
    if (f_size == 0) {
      facilityIds.add(Integer.valueOf(-1));
    } else {
      for (int i = 0; i < f_size; i++) {
        Integer id = facilityIds.get(i);
        ScheduleOnedayContainer con = new ScheduleOnedayContainer();
        con.initField();
        con.initHour(startHour, endHour);
        this.facilitymap.put(id, con);
      }
    }

    members = ALEipUtils.getUsers(filter);

    String flag_changeturn =
        ALEipUtils.getTemp(rundata, context, ScheduleUtils.FLAG_CHANGE_TURN_STR);
    if ("0".equals(flag_changeturn)) {
      // ログインユーザの行けジュールを一番上に表示させるため,
      // メンバリストの初めの要素にログインユーザを配置する.
      ALEipUser eipUser = null;
      int memberSize = members.size();
      for (int i = 0; i < memberSize; i++) {
        eipUser = members.get(i);
        if (eipUser.getUserId().getValue() == userid) {
          members.remove(i);
          members.add(0, eipUser);
        }
      }
    }
    if ("Facility".equals(filter)) {
      facilityList = FacilitiesUtils.getFacilityList(filter);
    } else if ("facilitygroup".equals(filter_type) || "f".equals(filteres[0])) {
      if ("f".equals(filteres[0])) {
        facilityList = FacilitiesUtils.getFacilityGroupList(Integer.valueOf(filteres[1]));

      } else {

        if (ScheduleUtils.isNumberValue(filter)) {
          facilityList = FacilitiesUtils.getFacilityGroupList(Integer.valueOf(filter));
        }
      }
    } else {
      facilityList = FacilitiesUtils.getFacilityList(filter);
    }
    if (!("f".equals(filteres[0]))) {
      current_filter = filter;
    } else {
      current_filter = filteres[1];
    }
    current_filter_type = filter_type;
    return ScheduleUtils.getScheduleList(
        userid, getViewDate().getValue(), field.getValue(), ulist, facilityIds);
  }
  /**
   * @param action
   * @param rundata
   * @param context
   * @throws ALPageNotFoundException
   * @throws ALDBErrorException
   */
  @Override
  public void init(ALAction action, RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {
    super.init(action, rundata, context);

    if (rundata.getParameters().containsKey(ALEipConstants.LIST_FILTER)) {
      ALEipUtils.setTemp(
          rundata,
          context,
          ScheduleUtils.FILTER_NAMESPACE,
          rundata.getParameters().getString(ALEipConstants.LIST_FILTER));
    }
    if (rundata.getParameters().containsKey(ALEipConstants.LIST_FILTER_TYPE)) {
      ALEipUtils.setTemp(
          rundata,
          context,
          ScheduleUtils.FILTER_NAMESPACE_TYPE,
          rundata.getParameters().getString(ALEipConstants.LIST_FILTER_TYPE));
    }

    viewtype = "oneday-group";
    try {
      termmap = new LinkedHashMap<Integer, List<ScheduleOnedayResultData>>();
      map = new LinkedHashMap<Integer, ScheduleOnedayContainer>();
      todomap = new LinkedHashMap<Integer, List<ScheduleToDoResultData>>();
      facilitymap = new LinkedHashMap<Integer, ScheduleOnedayContainer>();

      groups = ALEipUtils.getMyGroups(rundata);
      facilitiyGroups = ALEipUtils.getALEipGroups();
      userid = ALEipUtils.getUserId(rundata);
      rows = new int[(endHour - startHour) * 12 + 1];
      int size = rows.length;
      for (int i = 0; i < size; i++) {
        rows[i] = 1;
      }
      String filter = ALEipUtils.getTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE);

      target_group_name = getGroup(filter);

      if (filter == null) {
        VelocityPortlet portlet = ALEipUtils.getPortlet(rundata, context);
        String groupName = portlet.getPortletConfig().getInitParameter("p3a-group");
        if (groupName != null) {
          ALEipUtils.setTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE, groupName);
          ALEipUtils.setTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE_TYPE, "group");
        }
      }

      // ポートレット MyGroup のへのリンクを取得する.
      myGroupURI = ScheduleUtils.getPortletURIinPersonalConfigPane(rundata, "MyGroup");

      // アクセス権限
      ALAccessControlFactoryService aclservice =
          (ALAccessControlFactoryService)
              ((TurbineServices) TurbineServices.getInstance())
                  .getService(ALAccessControlFactoryService.SERVICE_NAME);
      ALAccessControlHandler aclhandler = aclservice.getAccessControlHandler();

      hasAclviewOther =
          aclhandler.hasAuthority(
              userid,
              ALAccessControlConstants.POERTLET_FEATURE_SCHEDULE_OTHER,
              ALAccessControlConstants.VALUE_ACL_LIST);

      hasAuthoritySelfInsert =
          aclhandler.hasAuthority(
              userid,
              ALAccessControlConstants.POERTLET_FEATURE_SCHEDULE_SELF,
              ALAccessControlConstants.VALUE_ACL_INSERT);

      hasAuthorityFacilityInsert =
          aclhandler.hasAuthority(
              userid,
              ALAccessControlConstants.POERTLET_FEATURE_SCHEDULE_FACILITY,
              ALAccessControlConstants.VALUE_ACL_INSERT);

    } catch (Exception ex) {
      logger.error("[ScheduleOnedayGroupSelectData]", ex);
    }
  }