public IForward doWorkitem(final ComponentParameter cp) {
   final ProcessBean process = WorkflowUtils.getProcessBean(cp);
   WorkitemBean workitem;
   if (process != null && (workitem = getOpenWorkitem(cp, process)) != null) {
     if (cp.getBoolParameter("monitor")) {
       return new JavascriptForward(
           JS.loc(uFactory.getUrl(cp, WorkflowMonitorPage.class, workitem), true));
     } else {
       return new JavascriptForward(JS.loc(uFactory.getUrl(cp, WorkflowFormPage.class, workitem)));
     }
   } else {
     return JavascriptForward.alert($m("MyProcessWorksTPage.7"));
   }
 }
コード例 #2
0
 @Override
 protected String toHtml(
     final PageParameter pp, final Map<String, Object> variables, final String currentVariable)
     throws IOException {
   final StringBuilder sb = new StringBuilder();
   sb.append(" <div class='logo' onclick=\"").append(JS.loc("/")).append("\"></div>");
   sb.append(" <div class='re'>").append(toActionsHTML(pp, this)).append("</div>");
   sb.append(BlockElement.CLEAR);
   return sb.toString();
 }
コード例 #3
0
    @Override
    protected Map<String, Object> getRowData(final ComponentParameter cp, final Object dataObject) {
      final NewsAttachment attachment = (NewsAttachment) dataObject;
      final KVMap kv = new KVMap();
      try {
        final AttachmentFile af =
            newsContext.getAttachmentService().createAttachmentFile(attachment);
        kv.put(
            "topic",
            new LinkElement(attachment.getTopic())
                .setOnclick(JS.loc(DownloadUtils.getDownloadHref(af), true))
                .setTitle(attachment.getDescription()));
      } catch (final IOException e) {
        kv.put("topic", attachment.getTopic());
      }
      kv.put("attachsize", FileUtils.toFileSize(attachment.getAttachsize()));

      final Class<? extends Enum<?>> eClass =
          ((NewsFormAttachPage) get(cp)).getAttachmentTypeClass();
      if (eClass != null) {
        kv.put("attachtype", eClass.getEnumConstants()[attachment.getAttachtype()]);
      }

      if (((INewsWebContext) newsContext).getLogRef() != null) {
        kv.put(
            "downloads",
            LinkElement.style2(attachment.getDownloads())
                .setOnclick(
                    "$Actions['NewsTabAttachPage_logWin']('beanId=" + attachment.getId() + "');"));
      } else {
        kv.put("downloads", attachment.getDownloads());
      }
      kv.put("userId", cp.getUser(attachment.getUserId()));
      kv.put("createDate", attachment.getCreateDate());

      kv.add(TablePagerColumn.OPE, toOpeHTML(cp, attachment));
      return kv;
    }
  @Override
  protected String toCategoryHTML(final PageParameter pp) {
    final StringBuilder sb = new StringBuilder();
    final Map<String, Map<String, List<ProcessModelBean>>> gmap2 = getProcessModelMap2(pp);
    final ProcessModelBean cur = WorkflowUtils.getProcessModel(pp);
    final String[] pgroups = getPgroups(pp);
    if (cur != null || (pgroups != null && pgroups.length == 2)) {
      List<ProcessModelBean> l = null;
      String key = null;
      String pgroup = null;
      Map<String, List<ProcessModelBean>> m2 = null;
      if (cur != null) {
        final String[] arr = StringUtils.split(cur.getModelText(), ".");
        key = arr.length > 1 ? arr[0] : CONST_OTHER;
        m2 = gmap2.get(key);
        pgroup = wfpmService.getProcessDocument(cur).getProcessNode().getPgroup();
        if (!StringUtils.hasText(pgroup)) {
          pgroup = CONST_OTHER;
        }
      } else {
        key = pgroups[0];
        m2 = gmap2.get(key);
        pgroup = pgroups[1];
      }
      if (m2 != null) {
        l = m2.get(pgroup);
      }

      final CategoryItems items = CategoryItems.of();
      if (l != null) {
        for (final ProcessModelBean pm : l) {
          final _CategoryItem item =
              (_CategoryItem)
                  new _CategoryItem(pm)
                      .setHref(
                          uFactory.getUrl(pp, MyProcessWorksTPage.class, "modelId=" + pm.getId()));
          if (cur != null) {
            item.setSelected(cur.getId().equals(pm.getId()));
          }
          items.add(item);
        }
      }

      if (cur != null && (l == null || !l.contains(cur))) {
        items.add(
            new _CategoryItem(cur)
                .setHref(uFactory.getUrl(pp, MyProcessWorksTPage.class, "modelId=" + cur.getId()))
                .setSelected(true));
      }

      sb.append("<div class='gtitle'>");
      sb.append(
          new LinkElement($m("MyProcessWorksTPage.9"))
              .setHref(uFactory.getUrl(pp, getOriginalClass())));

      AbstractElement<?> ele;
      if (cur != null) {
        ele =
            new LinkElement(pgroup)
                .setHref(
                    uFactory.getUrl(
                        pp,
                        MyProcessWorksTPage.class,
                        "pgroup="
                            + HttpUtils.encodeUrl(Base64.encodeToString(key + ";" + pgroup))));
      } else {
        ele = new SpanElement(pgroup);
      }
      sb.append(SpanElement.NAV(3)).append(ele);
      sb.append("</div>");
      sb.append(items);
      return sb.toString();
    }

    sb.append("<div class='gtitle'>").append($m("MyProcessWorksTPage.16")).append("</div>");
    sb.append("<div class='gtree'>");
    for (final Map.Entry<String, Map<String, List<ProcessModelBean>>> e : gmap2.entrySet()) {
      final String key = e.getKey();
      sb.append("<div class='gitem");
      if (cur != null && cur.getModelText().startsWith(key)) {
        sb.append(" cur");
      }
      sb.append("'>");
      sb.append(new SpanElement(key).setClassName("glbl"));
      // final int size = gmap.get(key).size();
      // if (size > 0) {
      // sb.append(new SupElement("(" + size + ")").addClassName("gsize"));
      // }
      sb.append(" <div class='psub'>");
      int i = 0;
      for (final Map.Entry<String, List<ProcessModelBean>> e2 : e.getValue().entrySet()) {
        sb.append("<div class='pgroup'");
        if (i++ == 0) {
          sb.append(" style='border-top: 0'");
        }

        sb.append(">")
            .append(
                new SpanElement(e2.getKey())
                    .setOnclick(
                        JS.loc(
                            uFactory.getUrl(
                                pp,
                                MyProcessWorksTPage.class,
                                "pgroup="
                                    + HttpUtils.encodeUrl(
                                        Base64.encodeToString(key + ";" + e2.getKey()))))));
        for (final ProcessModelBean pm : e2.getValue()) {
          sb.append("<div class='pitem'>");
          sb.append(
              new LinkElement(WorkflowUtils.getShortMtext(pm))
                  .setOnclick(
                      JS.loc(
                          uFactory.getUrl(
                              pp, MyProcessWorksTPage.class, "modelId=" + pm.getId()))));
          sb.append("</div>");
        }
        sb.append("</div>");
      }
      sb.append(" </div>");
      sb.append("</div>");
    }
    sb.append("</div>");
    return sb.toString();
  }