示例#1
0
  public void execute() throws IOException, ServletException {
    String aicc_data = req.getParameter("aicc_data");

    if (aicc_data != null) {
      logger.info("get Param :" + aicc_data);
    }

    NewScorm scorm = (NewScorm) req.getSession().getAttribute("SCORM");
    int nodeID = StringUtil.parseInt((String) req.getSession().getAttribute("NODEID"));
    int userID =
        StringUtil.parseInt((String) req.getSession().getAttribute(LMSConstants.USERID_KEY));
    String identifier =
        StringUtils.trimToEmpty((String) req.getSession().getAttribute("IDENTIFER"));
    NewScormScoes current_sco = (NewScormScoes) req.getSession().getAttribute("CURRENT_SCO");

    SCODataManager scoDate =
        NewScormHelper.getSCOData(
            new Integer(userID), scorm.getId(), current_sco.getId(), req.getSession());

    CMICore cmiCore = scoDate.getCore();

    StringBuffer responseResult = new StringBuffer();
    responseResult.append("\n[Core]\n");
    responseResult.append("Student_ID=" + cmiCore.getStudentId().getValue() + "\n");
    responseResult.append("Student_Name=" + cmiCore.getStudentName().getValue() + "\n");
    responseResult.append("Lesson_Location=" + cmiCore.getLessonLocation().getValue() + "\n");
    responseResult.append("Credit=" + cmiCore.getCredit().getValue() + "\n");
    responseResult.append("Lesson_Status=" + cmiCore.getLessonStatus().getValue() + "\n");
    responseResult.append("Score=" + cmiCore.getScore().getRaw().getValue() + "\n");
    responseResult.append("Time=" + cmiCore.getTotalTime().getValue() + "\n");
    responseResult.append("Lesson_Mode=" + cmiCore.getLessonMode().getValue() + "\n");

    // todo:Suspend Data
    responseResult.append("[Core_Lesson]\n");

    // todo:Launch Data
    responseResult.append("[[Core Vendor]]\n");

    logger.info("responseResult = " + responseResult);
    HacpResponse.sendResult(req, resp, 0, responseResult.toString());
  }
  protected void render(JspWriter out, TreeControlNode node, int level, int width, boolean last)
      throws IOException {
    HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();

    // if the node is root node and the label value is
    // null, then do not render root node in the tree.
    if ("ROOT-NODE".equalsIgnoreCase(node.getName()) && (node.getLabel() == null)) {
      // Render the children of this node
      TreeControlNode[] children = node.findChildren();
      int lastIndex = children.length - 1;
      int newLevel = level + 1;

      for (int i = 0; i < children.length; i++) {
        render(out, children[i], newLevel, width, i == lastIndex);
      }

      return;
    }

    //  trStyle = (trStyle.equals(StyleConstants.TR_STYLE2) ? StyleConstants.TR_STYLE1 :
    // StyleConstants.TR_STYLE2);

    // Render the beginning of this node
    // out.println(intervalTR);
    trStyle =
        (trStyle.equals(StyleConstants.TR_STYLE2)
            ? StyleConstants.TR_STYLE1
            : StyleConstants.TR_STYLE2);
    out.println("<tr class=" + trStyle + ">");
    out.println("<td align='left'>");

    // Create the appropriate number of indents
    for (int i = 0; i < (level - 1); i++) {
      out.print("&nbsp;&nbsp;&nbsp;");
    }

    // Render the tree state image for this node
    // HACK to take into account special characters like = and &
    // in the node name, could remove this code if encode URL
    // and later request.getParameter() could deal with = and &
    // character in parameter values.
    String encodedNodeName = URLEncoder.encode(node.getName());
    String action = replace(getAction(), "${name}", encodedNodeName);

    String updateTreeAction = replace(getAction(), "tree=${name}", "select=" + encodedNodeName);

    updateTreeAction =
        ((HttpServletResponse) pageContext.getResponse()).encodeURL(updateTreeAction);

    String[] tempArray = null;
    String nameTempString = node.getName();
    boolean isCatalog = false;

    // create node's image
    String hyperlink = null;
    OrganForm of = null;

    if (nameTempString.indexOf("/") > 0) {
      tempArray = StringUtil.splitString(nameTempString, "/");

      if (tempArray != null) {
        String organ0ID = tempArray[1];
        of = OrganHelper.getOrgan(Integer.parseInt(organ0ID));
      }

      if (para1.equals("-1")) {
        out.print("<input type=\"radio\"");
      } else {
        out.print("<input type=\"checkbox\"");
      }

      out.println(" name=\"orgID\" value=\"" + tempArray[1] + "\">");
    }

    printNameString(out, node, isCatalog, updateTreeAction, response, hyperlink, action);

    out.println("</td>");

    String orgNo = "";
    int total = 0;

    if (tempArray != null) {
      String organ0ID = tempArray[1];

      if (!para1.equals("-1")) {
        int colSignDetailID = Integer.parseInt(para1);
        total =
            ColStudentHelper.getStudentNumber(
                Integer.parseInt(organ0ID),
                colSignDetailID,
                SecurityConstants.USER_DEFAULT_RELATION);
      } else {
        total = ColSignHelper.totalNumInOrg(Integer.parseInt(organ0ID), 1);
      }

      of = OrganHelper.getOrgan(Integer.parseInt(organ0ID));

      if (of != null) {
        orgNo = of.getOrgNO();
      }
    }

    out.println("<td  align=\"center\">");
    out.println("&nbsp;" + orgNo);
    out.println("</td>");
    out.println("<td align=\"center\">");
    out.println("&nbsp;" + total);
    out.println("</td>");
    // Render the end of this node
    out.println("</tr>");

    // Render the children of this node
    if (node.isExpanded()) {
      TreeControlNode[] children = node.findChildren();
      int lastIndex = children.length - 1;
      int newLevel = level + 1;

      for (int i = 0; i < children.length; i++) {
        render(out, children[i], newLevel, width, i == lastIndex);
      }
    }
  }