public void _jspService(
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {
    javax.servlet.http.HttpSession session = request.getSession(true);
    com.caucho.server.webapp.WebApp _jsp_application = _caucho_getApplication();
    com.caucho.jsp.PageContextImpl pageContext =
        _jsp_pageManager.allocatePageContext(
            this, _jsp_application, request, response, null, session, 8192, true, false);

    TagState _jsp_state = null;

    try {
      _jspService(request, response, pageContext, _jsp_application, session, _jsp_state);
    } catch (java.lang.Throwable _jsp_e) {
      pageContext.handlePageException(_jsp_e);
    } finally {
      _jsp_pageManager.freePageContext(pageContext);
    }
  }
  private void _jspService(
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response,
      com.caucho.jsp.PageContextImpl pageContext,
      javax.servlet.ServletContext application,
      javax.servlet.http.HttpSession session,
      TagState _jsp_state)
      throws Throwable {
    javax.servlet.jsp.JspWriter out = pageContext.getOut();
    final javax.el.ELContext _jsp_env = pageContext.getELContext();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    javax.servlet.jsp.tagext.JspTag _jsp_parent_tag = null;
    com.caucho.jsp.PageContextImpl _jsp_parentContext = pageContext;
    response.setContentType("text/html");
    response.setCharacterEncoding("utf-8");

    out.write(_jsp_string0, 0, _jsp_string0.length);
    CP_Classes.EthnicGroup ethnic;
    synchronized (pageContext.getSession()) {
      ethnic = (CP_Classes.EthnicGroup) pageContext.getSession().getAttribute("ethnic");
      if (ethnic == null) {
        ethnic = new CP_Classes.EthnicGroup();
        pageContext.getSession().setAttribute("ethnic", ethnic);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    CP_Classes.Login logchk;
    synchronized (pageContext.getSession()) {
      logchk = (CP_Classes.Login) pageContext.getSession().getAttribute("logchk");
      if (logchk == null) {
        logchk = new CP_Classes.Login();
        pageContext.getSession().setAttribute("logchk", logchk);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    CP_Classes.Translate trans;
    synchronized (pageContext.getSession()) {
      trans = (CP_Classes.Translate) pageContext.getSession().getAttribute("trans");
      if (trans == null) {
        trans = new CP_Classes.Translate();
        pageContext.getSession().setAttribute("trans", trans);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    // added to check whether organisation is a consulting company
    // Mark Oei 09 Mar 2010
    out.write(_jsp_string1, 0, _jsp_string1.length);
    CP_Classes.Organization Org;
    synchronized (pageContext.getSession()) {
      Org = (CP_Classes.Organization) pageContext.getSession().getAttribute("Org");
      if (Org == null) {
        Org = new CP_Classes.Organization();
        pageContext.getSession().setAttribute("Org", Org);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    CP_Classes.Create_Edit_Survey CE_Survey;
    synchronized (pageContext.getSession()) {
      CE_Survey =
          (CP_Classes.Create_Edit_Survey) pageContext.getSession().getAttribute("CE_Survey");
      if (CE_Survey == null) {
        CE_Survey = new CP_Classes.Create_Edit_Survey();
        pageContext.getSession().setAttribute("CE_Survey", CE_Survey);
      }
    }
    out.write(_jsp_string2, 0, _jsp_string2.length);
    // by lydia Date 05/09/2008 Fix jsp file to support Thai language
    out.write(_jsp_string3, 0, _jsp_string3.length);
    out.print((trans.tslt("Delete Ethnic Group")));
    out.write(_jsp_string4, 0, _jsp_string4.length);
    out.print((trans.tslt("Edit Ethnic Group")));
    out.write(_jsp_string5, 0, _jsp_string5.length);
    out.print((trans.tslt("Please enter Ethnic Group")));
    out.write(_jsp_string6, 0, _jsp_string6.length);
    out.print((trans.tslt("Add Ethnic Group")));
    out.write(_jsp_string7, 0, _jsp_string7.length);
    out.print((trans.tslt("Please enter Ethnic Group")));
    out.write(_jsp_string8, 0, _jsp_string8.length);

    String username = (String) session.getAttribute("username");

    if (!logchk.isUsable(username)) {
      out.write(_jsp_string9, 0, _jsp_string9.length);
    } else {

      if (request.getParameter("proceed") != null) {
        int PKOrg = new Integer(request.getParameter("proceed")).intValue();
        logchk.setOrg(PKOrg);
      }

      if (request.getParameter("Delete") != null) {

        int Ethnic_ID = new Integer(request.getParameter("ethnic_ID")).intValue();
        boolean bIsDeleted = ethnic.deleteRecord(Ethnic_ID, logchk.getPKUser());

        if (bIsDeleted) {

          out.write(_jsp_string10, 0, _jsp_string10.length);
        }
      }

      if (request.getParameter("Edit") != null) {
        int Ethnic_ID = new Integer(request.getParameter("ethnic_ID")).intValue();

        String txtEthnic = request.getParameter("txtEthnic");
        boolean bIsEdited =
            ethnic.editRecord(Ethnic_ID, txtEthnic, logchk.getOrg(), logchk.getPKUser());

        if (bIsEdited) {

          out.write(_jsp_string11, 0, _jsp_string11.length);

        } else {

          out.write(_jsp_string12, 0, _jsp_string12.length);
        }
      }

      if (request.getParameter("Add") != null) {

        String txtEthnic = request.getParameter("txtEthnic");

        boolean bExist = ethnic.existRecord(txtEthnic, logchk.getOrg());

        if (!bExist) {
          boolean bIsAdded = ethnic.addRecord(txtEthnic, logchk.getOrg(), logchk.getPKUser());

          if (bIsAdded) {

            out.write(_jsp_string13, 0, _jsp_string13.length);
          }
        } else {

          out.write(_jsp_string14, 0, _jsp_string14.length);
        }
      }

      out.write(_jsp_string15, 0, _jsp_string15.length);
      out.print((trans.tslt("Ethnic Group")));
      out.write(_jsp_string16, 0, _jsp_string16.length);
      out.print((trans.tslt("To Add, click on the Add button")));
      out.write(_jsp_string17, 0, _jsp_string17.length);
      out.print(
          (trans.tslt("To Edit, click on the relevant radio button and click on the Edit button")));
      out.write(_jsp_string17, 0, _jsp_string17.length);
      out.print(
          (trans.tslt(
              "To Delete, click on the relevant radio button and click on the Delete button")));
      out.write(_jsp_string18, 0, _jsp_string18.length);
      out.print((trans.tslt("Organisation")));
      out.write(_jsp_string19, 0, _jsp_string19.length);

      // Added to check whether organisation is also a consulting company
      // if yes, will display a dropdown list of organisation managed by this company
      // else, it will display the current organisation only
      // Mark Oei 09 Mar 2010
      String[] UserDetail = new String[14];
      UserDetail = CE_Survey.getUserDetail(logchk.getPKUser());
      boolean isConsulting = true;
      isConsulting =
          Org.isConsulting(UserDetail[10]); // check whether organisation is a consulting company
      if (isConsulting) {
        Vector vOrg = logchk.getOrgList(logchk.getCompany());

        for (int i = 0; i < vOrg.size(); i++) {
          votblOrganization vo = (votblOrganization) vOrg.elementAt(i);
          int PKOrg = vo.getPKOrganization();
          String OrgName = vo.getOrganizationName();

          if (logchk.getOrg() == PKOrg) {
            out.write(_jsp_string20, 0, _jsp_string20.length);
            out.print((PKOrg));
            out.write(_jsp_string21, 0, _jsp_string21.length);
            out.print((OrgName));
            out.write(_jsp_string22, 0, _jsp_string22.length);
          } else {
            out.write(_jsp_string20, 0, _jsp_string20.length);
            out.print((PKOrg));
            out.write('>');
            out.print((OrgName));
            out.write(_jsp_string22, 0, _jsp_string22.length);
          }
        }
      } else {
        out.write(_jsp_string23, 0, _jsp_string23.length);
        out.print((logchk.getSelfOrg()));
        out.write('>');
        out.print((UserDetail[10]));
        out.write(_jsp_string24, 0, _jsp_string24.length);
      } // End of isConsulting
      out.write(_jsp_string25, 0, _jsp_string25.length);
      out.print((trans.tslt("Ethnic Group")));
      out.write(_jsp_string26, 0, _jsp_string26.length);

      /** ****************** Edited by James 17 Oct 2007 ********************** */
      Vector v = ethnic.getAllEthnics(logchk.getOrg());

      for (int i = 0; i < v.size(); i++) {
        voEthnic vo = (voEthnic) v.elementAt(i);

        int ethnic_ID = vo.getPKEthnic();
        String ethnic_Desc = vo.getEthnicDesc();

        out.write(_jsp_string27, 0, _jsp_string27.length);
        out.print((ethnic_ID));
        out.write(_jsp_string28, 0, _jsp_string28.length);
        out.print((ethnic_Desc));
        out.write(_jsp_string29, 0, _jsp_string29.length);
        out.print((ethnic_Desc));
        out.write(_jsp_string30, 0, _jsp_string30.length);
      }

      out.write(_jsp_string31, 0, _jsp_string31.length);
      out.print((trans.tslt("Ethnic Group")));
      out.write(_jsp_string32, 0, _jsp_string32.length);
      out.print((trans.tslt("Add")));
      out.write(_jsp_string33, 0, _jsp_string33.length);
      out.print((trans.tslt("Edit")));
      out.write(_jsp_string34, 0, _jsp_string34.length);
      out.print((trans.tslt("Delete")));
      out.write(_jsp_string35, 0, _jsp_string35.length);
    }
    out.write(_jsp_string36, 0, _jsp_string36.length);
    // by lydia Date 05/09/2008 Fix jsp file to support Thai language
    out.write(_jsp_string37, 0, _jsp_string37.length);

    Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);

    out.write(_jsp_string38, 0, _jsp_string38.length);
    // Denise 05/01/2010 update new email address
    out.write(_jsp_string39, 0, _jsp_string39.length);
    out.print((year));
    out.write(_jsp_string40, 0, _jsp_string40.length);
  }
Пример #3
0
  public void _jspService(
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {
    javax.servlet.http.HttpSession session = request.getSession(true);
    com.caucho.server.webapp.Application _jsp_application = _caucho_getApplication();
    javax.servlet.ServletContext application = _jsp_application;
    com.caucho.jsp.PageContextImpl pageContext =
        com.caucho.jsp.QJspFactory.allocatePageContext(
            this, _jsp_application, request, response, "/error.jsp", session, 8192, true);
    javax.servlet.jsp.JspWriter out = pageContext.getOut();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    response.setContentType("text/html");
    try {
      out.write(_jsp_string0, 0, _jsp_string0.length);
      out.print(((String) session.getAttribute("user")));
      out.write(_jsp_string1, 0, _jsp_string1.length);
      out.print(((String) session.getAttribute("db")));
      out.write(_jsp_string2, 0, _jsp_string2.length);

      // get all tables in the database
      ConDB dbcon = (ConDB) session.getAttribute("dbcon");
      Connection conn = dbcon.get();
      int total_rec = 0;
      int total_table = 0;
      String sql = "show tables";
      PreparedStatement pstm = null;
      ResultSet rs = null;
      try {
        pstm = conn.prepareStatement(sql);
        rs = pstm.executeQuery();
      } catch (SQLException e) {
        out.println(e);
      }

      // count the records of each table
      while (rs.next()) {
        String curr_tb = rs.getString(1);
        int curr_rec = 0;
        PreparedStatement pstm_rec = null;
        ResultSet rs_rec = null;
        sql = "select count(*) from " + curr_tb;

        try {
          pstm_rec = conn.prepareStatement(sql);
          rs_rec = pstm_rec.executeQuery();
        } catch (SQLException e) {
          out.println(e);
        }

        try {
          if (rs_rec.next()) {
            curr_rec = rs_rec.getInt(1);
            total_rec += curr_rec;
          }
        } catch (SQLException e) {
          out.println(e.getErrorCode() + "---" + e.getSQLState());
        }

        total_table++;

        out.write(_jsp_string3, 0, _jsp_string3.length);
        out.print((total_table & 1));
        out.write(_jsp_string4, 0, _jsp_string4.length);
        out.print((curr_tb));
        out.write(_jsp_string5, 0, _jsp_string5.length);
        out.print((curr_tb));
        out.write(_jsp_string6, 0, _jsp_string6.length);
        out.print((curr_tb));
        out.write(_jsp_string7, 0, _jsp_string7.length);
        out.print((curr_tb));
        out.write(_jsp_string8, 0, _jsp_string8.length);
        out.print((curr_tb));
        out.write(_jsp_string9, 0, _jsp_string9.length);
        out.print((curr_rec));
        out.write(_jsp_string10, 0, _jsp_string10.length);
      }

      out.write(_jsp_string11, 0, _jsp_string11.length);
      out.print((total_table));
      out.write(_jsp_string12, 0, _jsp_string12.length);
      out.print((total_rec));
      out.write(_jsp_string13, 0, _jsp_string13.length);
      out.print((session.getAttribute("db")));
      out.write(_jsp_string14, 0, _jsp_string14.length);
    } catch (java.lang.Throwable _jsp_e) {
      pageContext.handlePageException(_jsp_e);
    } finally {
      com.caucho.jsp.QJspFactory.freePageContext(pageContext);
    }
  }
  private void _jspService(
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response,
      com.caucho.jsp.PageContextImpl pageContext,
      javax.servlet.ServletContext application,
      javax.servlet.http.HttpSession session,
      TagState _jsp_state)
      throws Throwable {
    javax.servlet.jsp.JspWriter out = pageContext.getOut();
    final javax.el.ELContext _jsp_env = pageContext.getELContext();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    javax.servlet.jsp.tagext.JspTag _jsp_parent_tag = null;
    com.caucho.jsp.PageContextImpl _jsp_parentContext = pageContext;
    response.setContentType("text/html");
    response.setCharacterEncoding("utf-8");

    out.write(_jsp_string0, 0, _jsp_string0.length);
    CP_Classes.Login logchk;
    synchronized (pageContext.getSession()) {
      logchk = (CP_Classes.Login) pageContext.getSession().getAttribute("logchk");
      if (logchk == null) {
        logchk = new CP_Classes.Login();
        pageContext.getSession().setAttribute("logchk", logchk);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    CP_Classes.Create_Edit_Survey CE_Survey;
    synchronized (pageContext.getSession()) {
      CE_Survey =
          (CP_Classes.Create_Edit_Survey) pageContext.getSession().getAttribute("CE_Survey");
      if (CE_Survey == null) {
        CE_Survey = new CP_Classes.Create_Edit_Survey();
        pageContext.getSession().setAttribute("CE_Survey", CE_Survey);
      }
    }
    out.write(_jsp_string2, 0, _jsp_string2.length);
    CP_Classes.Translate trans;
    synchronized (pageContext.getSession()) {
      trans = (CP_Classes.Translate) pageContext.getSession().getAttribute("trans");
      if (trans == null) {
        trans = new CP_Classes.Translate();
        pageContext.getSession().setAttribute("trans", trans);
      }
    }
    out.write(_jsp_string2, 0, _jsp_string2.length);
    CP_Classes.RatingTask RT;
    synchronized (pageContext.getSession()) {
      RT = (CP_Classes.RatingTask) pageContext.getSession().getAttribute("RT");
      if (RT == null) {
        RT = new CP_Classes.RatingTask();
        pageContext.getSession().setAttribute("RT", RT);
      }
    }
    out.write(_jsp_string2, 0, _jsp_string2.length);
    CP_Classes.RatingScale RS;
    synchronized (pageContext.getSession()) {
      RS = (CP_Classes.RatingScale) pageContext.getSession().getAttribute("RS");
      if (RS == null) {
        RS = new CP_Classes.RatingScale();
        pageContext.getSession().setAttribute("RS", RS);
      }
    }
    out.write(_jsp_string2, 0, _jsp_string2.length);
    CP_Classes.Purpose PRP;
    synchronized (pageContext.getSession()) {
      PRP = (CP_Classes.Purpose) pageContext.getSession().getAttribute("PRP");
      if (PRP == null) {
        PRP = new CP_Classes.Purpose();
        pageContext.getSession().setAttribute("PRP", PRP);
      }
    }
    out.write(_jsp_string2, 0, _jsp_string2.length);
    CP_Classes.SurveyRating SVR;
    synchronized (pageContext.getSession()) {
      SVR = (CP_Classes.SurveyRating) pageContext.getSession().getAttribute("SVR");
      if (SVR == null) {
        SVR = new CP_Classes.SurveyRating();
        pageContext.getSession().setAttribute("SVR", SVR);
      }
    }
    out.write(_jsp_string3, 0, _jsp_string3.length);
    // by lydia Date 05/09/2008 Fix jsp file to support Thai language
    out.write(_jsp_string4, 0, _jsp_string4.length);
    out.print((trans.tslt("Please choose a rating task")));
    out.write(_jsp_string5, 0, _jsp_string5.length);

    response.setHeader("Pragma", "no-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("expires", 0);

    String username = (String) session.getAttribute("username");
    if (!logchk.isUsable(username)) {
      out.write(_jsp_string6, 0, _jsp_string6.length);
    } else {

      if (request.getParameter("purpose") != null) {
        int var1 = new Integer(request.getParameter("purpose")).intValue();
        CE_Survey.setPurpose(var1);

        System.out.println("Purpose ID" + var1);
      } else {
        // Edited by Eric Lu 22/5/08
        // Resets purpose if first time accessing this page
        CE_Survey.setPurpose(0);
      }
      if (request.getParameter("add") != null) {
        String rating = "";
        String scale = "";
        boolean RequiredChosen = false;
        String[] chkSelect = new String[10];
        String[] ScaleDesc = new String[10];
        String[] radioSelect = new String[10];

        int SurveyID = CE_Survey.getSurvey_ID();
        ScaleDesc = request.getParameterValues("selScaleDesc");
        chkSelect = request.getParameterValues("chkRat");
        radioSelect = request.getParameterValues("radioRat");
        int count = 0; // count shifted, Mark Oei 16 April 2010

        /*------------------------------------------------- for checkbox ------------------------------------------------*/

        // Changed by Ha 28/05/09 to pop out message when action is done successfully
        if (chkSelect != null) {
          boolean added = false;
          count = 0; // change to declare variable outside if statement, Mark Oei 16 April 2010
          for (int i = 0; i < chkSelect.length; i++) {
            rating = chkSelect[i];

            if (rating != null) {

              String RatName = " ";
              RatName = RT.getRatingTask(Integer.parseInt(rating));

              ScaleDesc = new String[10];
              ScaleDesc = request.getParameterValues("selScaleDesc" + rating);
              for (int j = 0; j < ScaleDesc.length; j++) {
                scale = ScaleDesc[j];
                CE_Survey.editPurpose(SurveyID, CE_Survey.getPurpose());
                added = CE_Survey.addRating(SurveyID, scale, rating, RatName);
                if (added) count++;
              }
            }
          }
          // Added to insert default values into database when rating tasks are added
          // Mark Oei 16 April 2010
          int lLimit = 0;
          int uLimit = 0;
          int scaleRange = CE_Survey.getRatScale();

          int taskCount = (Integer) session.getAttribute("taskCount") + count;

          if ((taskCount == 1 && Integer.parseInt(rating) == 1)) {
            lLimit = scaleRange / 2 - 1;
            uLimit = scaleRange / 2 + 1;
          } else {
            lLimit = -1;
            uLimit = 1;
          }
          boolean isSuccessful = CE_Survey.setMinPassScore(SurveyID, lLimit, uLimit);
          if (isSuccessful) {
            System.out.println(
                "Default Limits " + lLimit + ", " + uLimit + " has been inserted successfully");
          }
          if (count == chkSelect.length) {
            out.write(_jsp_string7, 0, _jsp_string7.length);
          }
        }

        /*-------------------------------------------------------- for radiobox ----------------------------------------------*/

        rating = "";

        if (radioSelect != null) {
          for (int i = 0; i < radioSelect.length; i++) {
            rating = radioSelect[i];

            if (rating != null) {

              String RatName = RT.getRatingTask(Integer.parseInt(rating));

              ScaleDesc = new String[10];
              ScaleDesc = request.getParameterValues("selScaleDesc" + rating);
              for (int j = 0; j < ScaleDesc.length; j++) {
                scale = ScaleDesc[j];
                CE_Survey.addRating(SurveyID, scale, rating, RatName);
              }
            }
          }
        }

        out.write(_jsp_string8, 0, _jsp_string8.length);
      }

      out.write(_jsp_string9, 0, _jsp_string9.length);
      out.print((trans.tslt("To Select Rating Task, checked on the provided boxes under Select")));
      out.write(_jsp_string10, 0, _jsp_string10.length);
      out.print((trans.tslt("Purpose of Survey")));
      out.write(_jsp_string11, 0, _jsp_string11.length);
      out.print((trans.tslt("Choose one")));
      out.write(_jsp_string12, 0, _jsp_string12.length);

      Vector v = PRP.getAllPurpose();

      for (int i = 0; i < v.size(); i++) {
        votblPurpose vo = (votblPurpose) v.elementAt(i);
        int PurposeID = vo.getPurposeID();
        String PurposeName = vo.getPurposeName();

        if (CE_Survey.getPurpose() == PurposeID) {

          out.write(_jsp_string13, 0, _jsp_string13.length);
          out.print((PurposeID));
          out.write(_jsp_string14, 0, _jsp_string14.length);
          out.print((PurposeName));
          out.write(_jsp_string12, 0, _jsp_string12.length);
        } else {

          out.write(_jsp_string15, 0, _jsp_string15.length);
          out.print((PurposeID));
          out.write('>');
          out.print((PurposeName));
          out.write(_jsp_string12, 0, _jsp_string12.length);
        }
      }
      out.write(_jsp_string16, 0, _jsp_string16.length);
      out.print((trans.tslt("Scale Range Chosen")));
      out.write(_jsp_string17, 0, _jsp_string17.length);
      out.print((CE_Survey.getRatScale()));
      out.write(_jsp_string18, 0, _jsp_string18.length);
      out.print((trans.tslt("Rating Task")));
      out.write(_jsp_string19, 0, _jsp_string19.length);
      out.print((trans.tslt("Select")));
      out.write(_jsp_string20, 0, _jsp_string20.length);
      out.print((trans.tslt("Rating Task")));
      out.write(_jsp_string21, 0, _jsp_string21.length);
      out.print((trans.tslt("Scale Description")));
      out.write(_jsp_string22, 0, _jsp_string22.length);

      String query2 = "";
      boolean dunAddPR = false;

      int iRatingTaskID = SVR.getRatingTaskID(CE_Survey.getSurvey_ID());
      if (iRatingTaskID != 0) dunAddPR = true;

      boolean anyRecord = false;
      boolean anyscale = false;

      Vector vRT = RT.getRatingTask(CE_Survey.getSurvey_ID(), dunAddPR, CE_Survey.getPurpose());

      for (int i = 0; i < vRT.size(); i++) {
        anyRecord = true;
        votblRatingTask vo = (votblRatingTask) vRT.elementAt(i);
        int RatID = vo.getRatingTaskID();
        String RatName = vo.getRatingTask();
        String ScaleType = vo.getScaleType();

        out.write(_jsp_string23, 0, _jsp_string23.length);
        if (CE_Survey.getPurpose() != 9) {
          out.write(_jsp_string24, 0, _jsp_string24.length);
          out.print((RatID));
          out.write(_jsp_string25, 0, _jsp_string25.length);
        } else {
          if (RatID != 2 && RatID != 3) {
            out.write(_jsp_string26, 0, _jsp_string26.length);
            out.print((RatID));
            out.write(_jsp_string27, 0, _jsp_string27.length);
          } else {
            out.write(_jsp_string28, 0, _jsp_string28.length);
            out.print((RatID));
            out.write(_jsp_string29, 0, _jsp_string29.length);
          }
        }
        out.write(_jsp_string30, 0, _jsp_string30.length);
        out.print((RatName));
        out.write(_jsp_string31, 0, _jsp_string31.length);
        out.print(("selScaleDesc" + RatID));
        out.write(_jsp_string32, 0, _jsp_string32.length);

        Vector vScale =
            RS.getRatingScale(CE_Survey.getRatScale(), ScaleType, CE_Survey.get_survOrg());

        for (int j = 0; j < vScale.size(); j++) {
          votblScale voS = (votblScale) vScale.elementAt(j);
          anyscale = true;
          int ScaleID = voS.getScaleID();
          String ScaleDesc = voS.getScaleDescription();

          out.write(_jsp_string33, 0, _jsp_string33.length);
          out.print((ScaleID));
          out.write('>');
          out.print((ScaleDesc));
          out.write(_jsp_string34, 0, _jsp_string34.length);
        }
        out.write(_jsp_string35, 0, _jsp_string35.length);
      }

      if (anyRecord == false && CE_Survey.getPurpose() != 0) {

        out.write(_jsp_string36, 0, _jsp_string36.length);
        out.print(
            (trans.tslt("All the rating tasks under this purpose of survey have been added")));
        out.write(_jsp_string37, 0, _jsp_string37.length);
      }
      out.write(_jsp_string38, 0, _jsp_string38.length);
      if (anyRecord && anyscale) {

        out.write(_jsp_string39, 0, _jsp_string39.length);
        out.print((trans.tslt("Add")));
        out.write(_jsp_string40, 0, _jsp_string40.length);
      }
      out.write(_jsp_string41, 0, _jsp_string41.length);
      out.print((trans.tslt("Close")));
      out.write(_jsp_string42, 0, _jsp_string42.length);
    }
    out.write(_jsp_string43, 0, _jsp_string43.length);
  }
Пример #5
0
  private void _jspService(
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response,
      com.caucho.jsp.PageContextImpl pageContext,
      javax.servlet.ServletContext application,
      javax.servlet.http.HttpSession session,
      TagState _jsp_state)
      throws Throwable {
    javax.servlet.jsp.JspWriter out = pageContext.getOut();
    final javax.el.ELContext _jsp_env = pageContext.getELContext();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    javax.servlet.jsp.tagext.JspTag _jsp_parent_tag = null;
    com.caucho.jsp.PageContextImpl _jsp_parentContext = pageContext;
    response.setContentType("text/html");
    response.setCharacterEncoding("utf-8");

    // Author: Dai Yong in June 2013
    out.write(_jsp_string0, 0, _jsp_string0.length);
    CP_Classes.Database Database;
    synchronized (pageContext.getSession()) {
      Database = (CP_Classes.Database) pageContext.getSession().getAttribute("Database");
      if (Database == null) {
        Database = new CP_Classes.Database();
        pageContext.getSession().setAttribute("Database", Database);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    CP_Classes.Login logchk;
    synchronized (pageContext.getSession()) {
      logchk = (CP_Classes.Login) pageContext.getSession().getAttribute("logchk");
      if (logchk == null) {
        logchk = new CP_Classes.Login();
        pageContext.getSession().setAttribute("logchk", logchk);
      }
    }
    out.write(_jsp_string2, 0, _jsp_string2.length);
    Coach.LoginStatus LoginStatus;
    synchronized (pageContext.getSession()) {
      LoginStatus = (Coach.LoginStatus) pageContext.getSession().getAttribute("LoginStatus");
      if (LoginStatus == null) {
        LoginStatus = new Coach.LoginStatus();
        pageContext.getSession().setAttribute("LoginStatus", LoginStatus);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    Coach.Coach Coach;
    synchronized (pageContext.getSession()) {
      Coach = (Coach.Coach) pageContext.getSession().getAttribute("Coach");
      if (Coach == null) {
        Coach = new Coach.Coach();
        pageContext.getSession().setAttribute("Coach", Coach);
      }
    }
    out.write(_jsp_string3, 0, _jsp_string3.length);

    String username = (String) session.getAttribute("username");

    if (!logchk.isUsable(username)) {

      out.write(_jsp_string4, 0, _jsp_string4.length);
    } else {

      if (request.getParameter("add") != null) {
        if (request.getParameter("Name") != null) {
          String name = request.getParameter("Name");
          String link = "";
          if (request.getParameter("Link") != "") {
            link = request.getParameter("Link");
          }

          // check whether SlotGroup name already exists in database
          Boolean Exist = false;

          Vector v = Coach.getAllCoach();
          for (int i = 0; i < v.size(); i++) {
            voCoach vo = (voCoach) v.elementAt(i);

            String coachName = vo.getCoachName();
            // System.out.println("Existing Schedule Name:"+slotGroupName);
            if (name.trim().equalsIgnoreCase((coachName.trim()))) {
              Exist = true;
              System.out.println("Same Coach Name");
            }
          }

          if (!Exist) {
            try {
              boolean add = Coach.addCoach(name, link);

              if (add) {

                out.write(_jsp_string5, 0, _jsp_string5.length);

              } else {

              }
            } catch (Exception SE) {
              System.out.println(SE);
            }
          } else {

            out.write(_jsp_string6, 0, _jsp_string6.length);
          }
        }
      }

      out.write(_jsp_string7, 0, _jsp_string7.length);
    }
    out.write(_jsp_string8, 0, _jsp_string8.length);
  }
  public void _jspService(
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {
    javax.servlet.http.HttpSession session = request.getSession(true);
    com.caucho.server.webapp.Application _jsp_application = _caucho_getApplication();
    javax.servlet.ServletContext application = _jsp_application;
    com.caucho.jsp.PageContextImpl pageContext =
        com.caucho.jsp.QJspFactory.allocatePageContext(
            this, _jsp_application, request, response, null, session, 8192, true, false);
    javax.servlet.jsp.JspWriter out = pageContext.getOut();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    response.setContentType("text/html");
    try {
      uk.ac.dundee.computing.stewarttaylor.UserBean userBean;
      synchronized (session) {
        userBean = (uk.ac.dundee.computing.stewarttaylor.UserBean) session.getAttribute("userBean");
        if (userBean == null) {
          userBean = new uk.ac.dundee.computing.stewarttaylor.UserBean();
          session.setAttribute("userBean", userBean);
        }
      }
      out.write(_jsp_string0, 0, _jsp_string0.length);
      uk.ac.dundee.computing.stewarttaylor.UserBean userBean2;
      synchronized (session) {
        userBean2 =
            (uk.ac.dundee.computing.stewarttaylor.UserBean) session.getAttribute("userBean2");
        if (userBean2 == null) {
          userBean2 = new uk.ac.dundee.computing.stewarttaylor.UserBean();
          session.setAttribute("userBean2", userBean2);
        }
      }
      out.write(_jsp_string1, 0, _jsp_string1.length);

      uk.ac.dundee.computing.stewarttaylor.UserBean uBean2 =
          (uk.ac.dundee.computing.stewarttaylor.UserBean) session.getAttribute("userBean");
      String sName = uBean2.getUsername();

      out.write(_jsp_string2, 0, _jsp_string2.length);
      out.print(sName);
      out.write(_jsp_string3, 0, _jsp_string3.length);
      out.print(sName);
      out.write(_jsp_string4, 0, _jsp_string4.length);
      uk.ac.dundee.computing.stewarttaylor.MessageBean msgBean;
      synchronized (session) {
        msgBean =
            (uk.ac.dundee.computing.stewarttaylor.MessageBean) session.getAttribute("msgBean");
        if (msgBean == null) {
          msgBean = new uk.ac.dundee.computing.stewarttaylor.MessageBean();
          session.setAttribute("msgBean", msgBean);
        }
      }
      out.write(_jsp_string5, 0, _jsp_string5.length);

      try {

        String[] names = msgBean.getUsername();
        String[] dates = msgBean.getDate();
        String[] messages = msgBean.getMessage();
        String[] images = msgBean.getImage();
        boolean[] canDelete = msgBean.getCanDelete();
        int[] id = msgBean.getID();

        for (int i = 0; i < names.length; i++) {

          out.write(_jsp_string6, 0, _jsp_string6.length);
          out.println(names[i]);
          out.write(_jsp_string3, 0, _jsp_string3.length);
          out.println(names[i]);
          out.write(_jsp_string7, 0, _jsp_string7.length);

          if (canDelete[i] == true) {

            out.write(_jsp_string8, 0, _jsp_string8.length);
            out.println(id[i]);
            out.write(_jsp_string9, 0, _jsp_string9.length);
          }

          out.write(_jsp_string10, 0, _jsp_string10.length);
          out.println(images[i]);
          out.write(_jsp_string11, 0, _jsp_string11.length);
          out.println(dates[i]);
          out.write(_jsp_string12, 0, _jsp_string12.length);
          out.println(messages[i]);
          out.write(_jsp_string13, 0, _jsp_string13.length);
        }
      } catch (Exception E) {
        out.println("<h3> No Posts Retrieved</h3>");
      }

      out.write(_jsp_string14, 0, _jsp_string14.length);
    } catch (java.lang.Throwable _jsp_e) {
      pageContext.handlePageException(_jsp_e);
    } finally {
      com.caucho.jsp.QJspFactory.freePageContext(pageContext);
    }
  }