/** 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) { } }
/** * This class is use for viewing activity set by group administrator Place all the data object in * the context for use in the template. */ public void doBuildTemplate(RunData data, Context context) { try { ParameterParser pp = data.getParameters(); /** * Get courseid,username and coursename for the user currently logged in Put it in the context * for Using in templates * * @see UserUtil in Util. */ User user = data.getUser(); String username = user.getName(); context.put("username", username); context.put("coursename", (String) user.getTemp("course_name")); String courseid = (String) user.getTemp("course_id"); context.put("courseid", courseid); // Get the path where the GroupList and groupname xml are there. String groupPath = data.getServletContext().getRealPath("/Courses" + "/" + courseid + "/GroupManagement"); File f = new File(groupPath + "/GroupList__des.xml"); TopicMetaDataXmlReader topicmetadata = null; Vector uName = new Vector(); String uname = "", grpname = "", groupdesc = ""; if (f.exists()) { // if1 /** * Reading the GroupList xml for getting the details groups (grouplist,groupname,grouptype) * and Mode Put in the contexts for use in template * * @see TopicMetaDataXmlReader in Utils. */ topicmetadata = new TopicMetaDataXmlReader(groupPath + "/GroupList__des.xml"); Vector grplist = topicmetadata.getGroupDetails(); for (int i = 0; i < grplist.size(); i++) { // for1 grpname = ((FileEntry) grplist.elementAt(i)).getName(); String type = ((FileEntry) grplist.elementAt(i)).gettype(); topicmetadata = new TopicMetaDataXmlReader(groupPath + "/" + grpname + "__des.xml"); groupdesc = topicmetadata.getActivity(); Vector list = topicmetadata.getGroupDetails(); if (list != null) { // if2 for (int j = 0; j < list.size(); j++) { // for2 String gnam = new String(); uname = ((FileEntry) list.elementAt(j)).getUserName(); uName.addElement(uname); if (username.equals(uname)) { // if3 context.put("type", type); context.put("grpname", grpname); if (groupdesc != null) { /** Get the groupActivity and set the vm according to the activity. */ StringTokenizer st = new StringTokenizer(groupdesc, ","); for (int kk = 0; st.hasMoreTokens(); kk++) { // first 'for' loop String msg_idd = st.nextToken(); if (msg_idd.equals("Discussion Board")) context.put("act0", msg_idd); if (msg_idd.equals("Notice")) context.put("act1", msg_idd); if (msg_idd.equals("Chat")) context.put("act2", msg_idd); if (msg_idd.equals("Local Mail")) context.put("act3", msg_idd); if (msg_idd.equals("Assignment")) context.put("act4", msg_idd); } // for } // if gnam = grpname; if (gnam.equals(grpname)) context.put("mblist", uName); context.put("Mode", "noempty"); context.put("groupdesc", groupdesc); } // if3 } // for2 uName = new Vector(); } // if2 } // for1 } // if1 } // try catch (Exception e) { ErrorDumpUtil.ErrorLog("Error in Screen:ViewActivity !!" + e); data.setMessage("See ExceptionLog !! "); } } // method
/** * 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