public void doBuildTemplate(RunData data, Context context) {
    try {
      ParameterParser pp = data.getParameters();
      String lang = pp.getString("lang", "english");
      context.put("lang", lang);
      String LangFile = new String();
      String status = pp.getString("status", "");

      if (status.equals("UserResitration")) context.put("status", "UserResitration");
      else if (status.equals("CourseRegistration")) context.put("status", "CourseRegistration");
      List CourseList = ListManagement.getCourseList();
      context.put("courseList", CourseList);
    } catch (Exception e) {
      data.setMessage("Error in Online Registration !!" + e);
    }
  }
Example #2
0
 /**
  * Place all the data object in the context for use in the template.
  *
  * @param data RunData instance
  * @param context Context instance
  * @exception Exception, a generic exception
  */
 public void doBuildTemplate(RunData data, Context context) {
   try {
     ParameterParser pp = data.getParameters();
     String userName = pp.getString("username");
     String modetype = pp.getString("Process");
     String mode = pp.getString("mode");
     String stat = pp.getString("status");
     String counter = pp.getString("count", "");
     context.put("tdcolor", counter);
     int uid = UserUtil.getUID(userName);
     List userList = UserManagement.getUserDetail(Integer.toString(uid));
     context.put("udetail", userList);
     context.put("Process", modetype);
     context.put("mode", mode);
     context.put("status", stat);
   } catch (Exception e) {
     data.setMessage("The error in user id :- " + e);
   }
 }
Example #3
0
  /** Place all the data object in the context for use in the template. */
  public void doBuildTemplate(RunData data, Context context) {

    try {
      User user = data.getUser();
      ParameterParser pp = data.getParameters();
      String course_id = (String) user.getTemp("course_id");
      context.put("courseid", course_id);
      String role = (String) user.getTemp("role");
      context.put("user_role", role);

      /** Get UserName, Passwd, CourseId, serverName and Base Path */
      String uname = data.getUser().getName();
      String pword = data.getUser().getPassword();
      String cid = data.getUser().getTemp("course_id").toString();
      String hostIP = data.getServerName();
      String codeBase =
          data.getServerScheme()
              + "://"
              + hostIP
              + ":"
              + data.getServerPort()
              + data.getContextPath()
              + "/scorm/";
      context.put("serverName", hostIP);
      context.put("codeBase", codeBase);
      context.put("password", pword);
      context.put("username", uname);
      context.put("course", data.getUser().getTemp("course_name").toString());
      String topic = pp.getString("package", "");
      context.put("package", topic);
      File scormDir1 =
          new File(TurbineServlet.getRealPath("/Courses") + "/" + cid + "/Scormpackage/" + topic);
      context.put("scormDir1", scormDir1);
      Vector Allvalue = new Vector();
      Vector report = new Vector();
      String level = "", id = "", start_page = "", lesson_title = "";
      String scormDir =
          (TurbineServlet.getRealPath("/Courses")
              + "/"
              + cid
              + "/Scormpackage"
              + "/"
              + topic
              + "/"
              + "imsmanifest.xml");
      Allvalue = ManifestParser.parse(scormDir);
      Vector v = (Vector) Allvalue.elementAt(0);
      for (int i = 0; i < v.size(); i++) {
        StringTokenizer st = new StringTokenizer((String) v.elementAt(i), "|");
        level = (String) st.nextToken(); // level
        id = (String) st.nextToken(); // id
        start_page = (String) st.nextToken(); // this sco start page
        lesson_title = (String) st.nextToken(); // lesson title
        Hashtable item = new Hashtable();
        item.put("id", id);
        item.put("lesson_title", lesson_title);
        item.put("start_page", start_page);
        report.add(item);
      }
      context.put("report", report);
    } catch (Exception ex) {
      data.setMessage("The error in Launchcontent screen !!" + ex);
    }
  }
  /**
   * @param data RunData
   * @param context Context
   */
  public void doBuildTemplate(RunData data, Context context) {
    String LangFile = data.getUser().getTemp("LangFile").toString();
    String etopic = Mutil.ConvertedString("personal_etopic", LangFile);
    String ncontent = Mutil.ConvertedString("Repo_topic", LangFile);

    try {
      /** Get the UserName and put it in the context for template use */
      User user = data.getUser();
      String authorname = user.getName();
      context.put("authorname", authorname);

      /** Retrieve the Parameters by using the Parameter Parser */
      ParameterParser pp = data.getParameters();
      String status = new String();
      Vector v = new Vector();
      Vector Read = new Vector();

      String stat = pp.getString("status", "");
      context.put("status", stat);
      String content1 = pp.getString("name", "");
      context.put("contentlist", content1);
      String topic = pp.getString("topic", "");
      context.put("topic", topic);
      String Files = pp.getString("FileName", "");
      context.put("filename", Files);
      String seqno = pp.getString("seq", "");
      context.put("seq", seqno);
      String mode1 = pp.getString("mode1", "");
      context.put("mode1", mode1);
      String UserPath = data.getServletContext().getRealPath("/Repository");

      if (stat.equals("fromDirectory")
          || stat.equals("fromSubDirectory")
          || mode1.equals("Move")) { // main if
        /** Get the list of author topic put in the context for use in templets */
        File topicDir = new File(UserPath + "/" + content1);
        Vector y = new Vector();
        String filter[] = {"__des.xml"};
        NotInclude exclude = new NotInclude(filter);
        String ContentList[] = topicDir.list(exclude);
        for (int j = 0; j < ContentList.length; j++) {
          y.add(ContentList[j]);
        }
        if (y.size() == 0) {
          data.setMessage(ncontent);
        } else {
          context.put("contentvalue", y);
        }
        /** Get the Files list of Particular topic put in the context for use in templates */
        if (stat.equals("fromSubDirectory")) { // if2
          String filetopic = UserPath + "/" + content1 + "/" + topic;
          TopicMetaDataXmlReader topicMetaData =
              new TopicMetaDataXmlReader(filetopic + "/" + topic + "__des.xml");
          Vector h = topicMetaData.getFileDetails();
          if (h == null) {
            data.setMessage(etopic);
          } else {
            context.put("FFfiles", h);
          }
        } // if2
        /** Get the topic list of particular author and put in the context for use in templates */
        if (mode1.equals("Move")) { // if3
          File topicDir1 = new File(UserPath + "/" + content1);
          Vector k = new Vector();
          String filter1[] = {"__des.xml"};
          NotInclude exclude1 = new NotInclude(filter1);
          String ContentList1[] = topicDir1.list(exclude1);
          for (int m = 0; m < ContentList1.length; m++) {
            if (!(ContentList1[m]).equals(topic)) {

              k.add(ContentList1[m]);
            }
          } // for
          context.put("contentvalue1", k);
        } // if3
      } // main if

    } // try
    catch (Exception e) {
    }
  }
  /**
   * Place all the data object in the context for use in the template.
   *
   * @param data RunData
   * @param context Context
   */
  public void doBuildTemplate(RunData data, Context context) {
    try {

      User user = data.getUser();
      ParameterParser pp = data.getParameters();
      context.put("lang", pp.getString("lang", "english"));
      String status = pp.getString("status", "");
      String lang = pp.getString("lang", "english");
      context.put("lang", lang);
      String counter = pp.getString("count", "");
      context.put("tdcolor", counter);
      if (status.equals("UserResitration")) {
        context.put("status", "UserResitration");
        String path = TurbineServlet.getRealPath("/OnlineUsers");
        Vector entry = new Vector();
        File xmlfile = new File(path + "/OnlineUser.xml");
        if (xmlfile.exists()) {
          TopicMetaDataXmlReader topicmetadata = null;
          Vector list = new Vector();
          topicmetadata = new TopicMetaDataXmlReader(path + "/OnlineUser.xml");
          list = topicmetadata.getOnlineUserDetails();
          if (list != null) {
            for (int i = 0; i < list.size(); i++) {
              String uname = ((CourseUserDetail) list.elementAt(i)).getLoginName();
              String passwd = ((CourseUserDetail) list.elementAt(i)).getActive();
              String email = ((CourseUserDetail) list.elementAt(i)).getEmail();
              String fname = ((CourseUserDetail) list.elementAt(i)).getInstructorName();
              String lname = ((CourseUserDetail) list.elementAt(i)).getUserName();
              String orgtn = ((CourseUserDetail) list.elementAt(i)).getDept();
              String gname = ((CourseUserDetail) list.elementAt(i)).getGroupName();
              String roleName = ((CourseUserDetail) list.elementAt(i)).getRoleName();
              DbDetail dbDetail = new DbDetail();
              dbDetail.setSender(uname);
              dbDetail.setPDate(passwd);
              dbDetail.setMSubject(email);
              dbDetail.setExpiryDate(fname);
              dbDetail.setPermission(lname);
              dbDetail.setGrpmgmtType(orgtn);
              dbDetail.setStatus(gname);
              dbDetail.setMsgID(roleName);
              entry.addElement(dbDetail);
            }
          } else {
            xmlfile.delete();
          }
        } else {

          data.setMessage(
              MultilingualUtil.ConvertedString("online_msg8", user.getTemp("LangFile").toString()));
          // "Sorry, No User Registration till now !!");
        }
        context.put("entry", entry);
      } else if (status.equals("CourseRegistration")) {

        context.put("status", "CourseRegistration");
        String path = TurbineServlet.getRealPath("/OnlineUsers");
        Vector entry = new Vector();
        File xmlfile = new File(path + "/courses.xml");
        if (xmlfile.exists()) {
          TopicMetaDataXmlReader topicmetadata = null;
          Vector list = new Vector();
          topicmetadata = new TopicMetaDataXmlReader(path + "/courses.xml");
          list = topicmetadata.getOnlineCourseDetails();

          if (list != null) {
            for (int i = 0; i < list.size(); i++) {
              String gname = ((CourseUserDetail) list.elementAt(i)).getGroupName();
              String cname = ((CourseUserDetail) list.elementAt(i)).getCourseName();
              String uname = ((CourseUserDetail) list.elementAt(i)).getLoginName();
              String orgtn = ((CourseUserDetail) list.elementAt(i)).getDept();
              String email = ((CourseUserDetail) list.elementAt(i)).getEmail();
              String fname = ((CourseUserDetail) list.elementAt(i)).getInstructorName();
              String lname = ((CourseUserDetail) list.elementAt(i)).getUserName();
              DbDetail dbDetail = new DbDetail();
              dbDetail.setSender(gname);
              dbDetail.setPDate(cname);
              dbDetail.setMSubject(uname);
              dbDetail.setGrpmgmtType(orgtn);
              dbDetail.setStatus(email);
              dbDetail.setMsgID(fname);
              dbDetail.setPermission(lname);
              entry.addElement(dbDetail);
            }
          } else {
            xmlfile.delete();
          }

        } else {
          data.setMessage(
              MultilingualUtil.ConvertedString("online_msg7", user.getTemp("LangFile").toString()));
        }
        context.put("entry", entry);
      }
    } // try end
    catch (Exception e) {
      ErrorDumpUtil.ErrorLog("The error in Online registartion reading file" + e);
      data.setMessage("Please see Error log or Contact to administrator");
    }
  } // end method
Example #6
0
  public void doRegister(RunData data, Context context) throws Exception {
    try {
      MultilingualUtil m_u = new MultilingualUtil();
      ParameterParser pp = data.getParameters();
      String serverName = data.getServerName();
      int srvrPort = data.getServerPort();
      String serverPort = Integer.toString(srvrPort);

      String roleName = pp.getString("role", "");

      /**
       * Getting the value of file from temporary variable According to selection of Language. and
       * replacing the String from property file.
       *
       * @see MultilingualUtil in utils
       */
      LangFile = (String) data.getUser().getTemp("LangFile");

      /** Retreiving details entered by the user */
      String gname = new String();
      // String roleName=new String();
      gname = pp.getString("group", "");
      // roleName=pp.getString("role","");
      if (gname.equals("")) {
        gname = new String();
        gname = pp.getString("group_author");
      }
      if (roleName.equals("")) {
        roleName = new String();
        roleName = pp.getString("role_author");
      }
      String uname = pp.getString("UNAME");
      String passwd = pp.getString("PASSWD");
      if (passwd.equals("")) passwd = uname;
      String fname = pp.getString("FNAME");
      String lname = pp.getString("LNAME");
      String email = pp.getString("EMAIL");
      email = UserManagement.ChkMailId(email);
      /**
       * Passing the value of file from temporary variable According to selection of Language. Adds
       * the new user in the database.
       *
       * @see UserManagement in utils
       */
      String msg =
          UserManagement.CreateUserProfile(
              uname,
              passwd,
              fname,
              lname,
              email,
              gname,
              roleName,
              serverName,
              serverPort,
              LangFile);

      data.setMessage(msg);
    } catch (Exception ex) {
      data.setMessage("The Error in AddUser Action");
    }
  }