Package org.cast.isi.data

Examples of org.cast.isi.data.ContentLoc


      return getPrompt(elt, PromptType.RESPONSEAREA);
    throw new IllegalArgumentException("Unknown prompt type " + type + " requested");
  }
 
  protected IModel<Prompt> getPrompt(Element elt, PromptType type) {
    ContentLoc loc = new ContentLoc(getModel().getObject());
    String responseGroupId = elt.getAttribute("rgid");
    String collectionName = elt.getAttribute("group").trim();
    return responseService.getOrCreatePrompt(type, loc, responseGroupId, collectionName);
  }
View Full Code Here


                    if (stat != null && stat.getUnreadStudentMessages() > 0 && (s = responseService.locationOfFirstUnreadMessage(student, sec)) != null) {
                      param.put("loc", s);
                    } else if (stat != null && stat.getCompleted() && !stat.getReviewed()){
                      ISIXmlSection section = targetSection.getSectionAncestor().firstPageWithResponseGroup();
                      if (section != null)
                        param.put("loc", (new ContentLoc(section).getLocation()));
                      else
                        throw new IllegalStateException("Section without response areas marked Ready For Review - should automatically be reviewed.");
                    } else {
                      param.put("loc", (new ContentLoc(targetSection)).getLocation());
                    }
                    setResponsePage(pageType, param);                   
                  }
                };
View Full Code Here

      }     
    };
  }

  protected SectionStatus getUserSectionStatus(User student, ISIXmlSection section) {
    SectionStatus status = mStatusMap.getObject().get(student.getId())!=null ? mStatusMap.getObject().get(student.getId()).get(new ContentLoc(section).getLocation()) : null;
    return status;
  }
View Full Code Here

 
  protected void setLoc(PageParameters parameters) {
    // setup the loc of this reading page, check the parameters, then
    // the bookmark and then finally the first page   
    if (parameters.containsKey("loc")) {
      loc = new ContentLoc(parameters.getString("loc"));
    } else if (parameters.containsKey("pageNum")) {
      loc = new ContentLoc(ISIApplication.get().getPageNum(parameters.getInt("pageNum")));
    } else {
      loc = new ContentLoc(ISIApplication.get().getBookmarkLoc().getLocation());
    }
    if (loc == null || loc.getSection() == null) {
      loc = new ContentLoc(ISIApplication.get().getPageNum(1));
    }
       
      ISIXmlSection section = loc.getSection();
      if (section != null) {
        ISISession.get().setBookmark(loc);       
View Full Code Here

   * @return
   */
  private boolean validAnswers(IModel<Prompt> mPrompt) {
    ISIPrompt prompt = ((ISIPrompt)mPrompt.getObject());
    if (prompt.getType().equals(PromptType.SINGLE_SELECT)) {
      ContentLoc promptLoc = prompt.getContentLoc();
      String xmlId = prompt.getContentElement().getXmlId();
      Element xmlElement = promptLoc.getSection().getElement().getOwnerDocument().getElementById(xmlId);
      NodeList items = xmlElement.getElementsByTagName("item");
       for(int i=0; i < items.getLength(); i++){
         Node node = (Node) items.item(i);
         Element itemElement =  (Element) node;
         if (itemElement.getAttributeNS(null, "correct").equals("true")) {
View Full Code Here

  }

  protected void addDetailsPanel(IModel<Prompt> mPrompt) {   
    ISIPrompt prompt = ((ISIPrompt)mPrompt.getObject());
    if (prompt.getType().equals(PromptType.SINGLE_SELECT)) {
      ContentLoc location = prompt.getContentElement().getContentLocObject();
      ISIXmlSection section = location.getSection();
      String xmlId = prompt.getContentElement().getXmlId();
      ISIXmlComponent xml = new ISIXmlComponent("details", new XmlSectionModel(section), "compare-responses");
      xml.setTransformParameter(FilterElements.XPATH, String.format("//dtb:responsegroup[@id='%s']", xmlId));
      xml.setOutputMarkupId(true);
      add (xml);
View Full Code Here

      return false;
    return ((ISIXmlSection) parent).isLockResponse();
  }
 
  public ContentLoc getContentLoc() {
    return new ContentLoc(this);
  }
View Full Code Here

  private List<Response> getResponses(IModel<Prompt> mPrompt) {
    return responseService.getResponsesForPeriod(mPrompt, CwmSession.get().getCurrentPeriodModel()).getObject();
  }

  private IModel<Prompt> findPrompt(XmlSectionModel model, String responseGroupId, String collectionName) {
    return responseService.getOrCreatePrompt(PromptType.SINGLE_SELECT, new ContentLoc(model.getObject()), responseGroupId, collectionName);
  }
View Full Code Here

   * Return the ContentLoc of the most recent page the user visited.
   * @return the ContentLoc, or null if it can't be determined.
   */
  public ContentLoc getBookmarkLoc() {
    ISISession session = ISISession.get();
    ContentLoc bookmark = session.getBookmark();
    if (bookmark!= null)
      return bookmark;
   
    // Not in session, need to do query.
    ISIEvent e = ISIResponseService.get().findLatestMatchingEvent(ISISession.get().getUser(), "pageview:reading");
    if (e != null && e.getPage() != null) {
      bookmark = new ContentLoc(e.getPage());
      session.setBookmark(bookmark);
      return bookmark;
    }

    // User has never visited a page before.  Set bookmark to first page.
    ISIXmlSection section = getPageNum(1);
    if (section != null)
      bookmark = new ContentLoc(section);
    session.setBookmark(bookmark);
    return bookmark;
  }
View Full Code Here

   * or the bookmark set for this user.
   */
  protected void getInitChapter(PageParameters parameters) {
    // check if there is a location passed in otherwise default to the current bookmarked location
    if (parameters.containsKey("loc")) {
      currentLoc = new ContentLoc(parameters.getString("loc"));
    } else {
      currentLoc = ISIApplication.get().getBookmarkLoc();
    }

    // Determine which chapter is the current chapter
    for (XmlSection chapter : mChapterList.getObject()) {
      if (chapter.isAncestorOf(currentLoc.getSection())) {
        currentChapterLoc = new ContentLoc(chapter);
      } else if (chapter.equals(currentLoc.getSection())) {
        currentChapterLoc = currentLoc;
      }          
    }

    // if for some reason you can't find the chapter, then load the first chapter
    if (currentChapterLoc == null) {
      currentChapterLoc = new ContentLoc(mChapterList.getObject().get(0));
    }
  }
View Full Code Here

TOP

Related Classes of org.cast.isi.data.ContentLoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.