javax.faces.event.ActionEvent Java Examples

The following examples show how to use javax.faces.event.ActionEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpdateAssessmentTotalPointsListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
 {
AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean");

AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization");
AuthorBean authorBean = (AuthorBean) ContextUtil.lookupBean("author");

if (!authzBean.isUserAllowedToEditAssessment(assessmentBean.getAssessmentId(), assessmentBean.getAssessment().getCreatedBy(),
		!authorBean.getIsEditPendingAssessmentFlow()))
{
	FacesContext context = FacesContext.getCurrentInstance();
	String err = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "denied_edit_assessment_error");
	context.addMessage(null, new FacesMessage(err));
	return;
}

assessmentBean.setQuestionSizeAndTotalScore();
 }
 
Example #2
Source File: EventLogPreviousPageListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae)
{
	log.debug("*****Log: inside EventLogPreviousPageListener =debugging ActionEvent: " + ae);

	EventLogBean eventLog = (EventLogBean) ContextUtil.lookupBean("eventLog");

	int pageNumber = eventLog.getPreviousPageNumber();
	eventLog.setPageNumber(pageNumber);
	Map pageDataMap = eventLog.getPageDataMap();
	List eventLogDataList = (List)pageDataMap.get(Integer.valueOf(pageNumber));
	eventLog.setEventLogDataList((ArrayList)eventLogDataList);
	
	if(pageNumber < 2) {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.FALSE);
	}
	else {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.TRUE);
	}
}
 
Example #3
Source File: StudentScoreUpdateListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("Student Score Update LISTENER.");
  StudentScoresBean bean = (StudentScoresBean) ContextUtil.lookupBean("studentScores");
  TotalScoresBean tbean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
  tbean.setAssessmentGradingHash(tbean.getPublishedAssessment().getPublishedAssessmentId());
  DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery");
  log.debug("Calling saveStudentScores.");
  try {
    if (!saveStudentScores(bean, tbean, delivery))
    {
      throw new RuntimeException("failed to call saveStudentScores.");
    }
  } catch (GradebookServiceException ge) {
     FacesContext context = FacesContext.getCurrentInstance();
     String err=(String)ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "gradebook_exception_error");
     context.addMessage(null, new FacesMessage(err));

  }

}
 
Example #4
Source File: TotalScoreUpdateListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("Total Score Update LISTENER.");
  TotalScoresBean bean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
  if ("4".equals(bean.getAllSubmissions()) && ae != null && ae.getComponent() != null && "applyScoreButton".equals(ae.getComponent().getId()))
  {
      // We're looking at average scores and we're applying a score to participants with no submission
      log.debug("Calling saveTotalScoresAverage.");
      if (!saveTotalScoresAverage(bean))
      {
          throw new RuntimeException("failed to call saveTotalScoresAverage.");
      }
  }
  else
  {
      log.debug("Calling saveTotalScores.");
      if (!saveTotalScores(bean))
      {
          throw new RuntimeException("failed to call saveTotalScores.");
      }
   }
 

}
 
Example #5
Source File: ConfirmRemoveMediaListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  String mediaId = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaId");
  String mediaUrl = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaUrl");
  String mediaFilename = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaFilename");
  String itemGradingId = (String) FacesContext.getCurrentInstance().
  	getExternalContext().getRequestParameterMap().get("itemGradingId");

  MediaBean mediaBean = (MediaBean) ContextUtil.lookupBean(
      "mediaBean");
  mediaBean.setMediaId(mediaId);
  mediaBean.setMediaUrl(mediaUrl);
  mediaBean.setFilename(mediaFilename);
  mediaBean.setItemGradingId(Long.valueOf(itemGradingId));

}
 
Example #6
Source File: EventLogNextPageListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae)
{
	log.debug("*****Log: inside EventLogNextPageListener =debugging ActionEvent: " + ae);

	EventLogBean eventLog = (EventLogBean) ContextUtil.lookupBean("eventLog");

	int pageNumber = eventLog.getNextPageNumber();
	eventLog.setPageNumber(pageNumber);
	Map pageDataMap = eventLog.getPageDataMap();
	List eventLogDataList = (List)pageDataMap.get(Integer.valueOf(pageNumber));
	eventLog.setEventLogDataList((ArrayList)eventLogDataList);
	
	if(pageNumber > (pageDataMap.size()-1)) {
		eventLog.setHasNextPage(Boolean.FALSE);
		eventLog.setHasPreviousPage(Boolean.TRUE);
	}
	else {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.TRUE);
	}	
}
 
Example #7
Source File: SchedulerTool.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void editTriggersListener(ActionEvent e)
{
  FacesContext context = FacesContext.getCurrentInstance();
  Map requestParams = context.getExternalContext().getRequestParameterMap();
  String jobName = (String) requestParams.get("jobName");

  //loop through jobDetailWrapperList finding the one selected by user.
  for (Iterator i = jobDetailWrapperList.iterator(); i.hasNext();)
  {
    JobDetailWrapper jobDetailWrapper = (JobDetailWrapper) i.next();
    if (jobDetailWrapper.getJobDetail().getKey().getName().equals(jobName))
    {
      selectedJobDetailWrapper = jobDetailWrapper;
      break;
    }
  }
}
 
Example #8
Source File: RetakeAssessmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException {
	RetakeAssessmentBean retakeAssessment = (RetakeAssessmentBean) ContextUtil.lookupBean("retakeAssessment");
	GradingService gradingService = new GradingService();
	StudentGradingSummaryData studentGradingSummaryData = (StudentGradingSummaryData) retakeAssessment.getStudentGradingSummaryDataMap().get(retakeAssessment.getAgentId());
	if (studentGradingSummaryData == null) {
		studentGradingSummaryData = new StudentGradingSummaryData();
		studentGradingSummaryData.setPublishedAssessmentId(retakeAssessment.getPublishedAssessmentId());
		studentGradingSummaryData.setAgentId(retakeAssessment.getAgentId());
		studentGradingSummaryData.setNumberRetake(Integer.valueOf(1));
	    studentGradingSummaryData.setCreatedBy(AgentFacade.getAgentString());
		studentGradingSummaryData.setCreatedDate(new Date());
		studentGradingSummaryData.setLastModifiedBy(AgentFacade.getAgentString());
		studentGradingSummaryData.setLastModifiedDate(new Date());
	}
	else {
		int updatedNumberRetake = studentGradingSummaryData.getNumberRetake().intValue() + 1;
		studentGradingSummaryData.setNumberRetake(Integer.valueOf(updatedNumberRetake));
		studentGradingSummaryData.setLastModifiedBy(AgentFacade.getAgentString());
		studentGradingSummaryData.setLastModifiedDate(new Date());
	}
	
	gradingService.saveStudentGradingSummaryData(studentGradingSummaryData);
}
 
Example #9
Source File: StudentScoreListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("StudentScore LISTENER.");
  StudentScoresBean bean = (StudentScoresBean) ContextUtil.lookupBean("studentScores");

  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedIdd");
  
  log.debug("Calling studentScores.");
  if (!studentScores(publishedId, bean, false))
  {
    throw new RuntimeException("failed to call studentScores.");
  }

}
 
Example #10
Source File: SubmissionStatusListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  SubmissionStatusBean bean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus");
  TotalScoresBean totalScoresBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");

  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedId");

  // Reset the search field
  String defaultSearchString = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.EvaluationMessages", "search_default_student_search_string");
  bean.setSearchString(defaultSearchString);
  
  if (!submissionStatus(publishedId, bean, totalScoresBean, false))
  {
    throw new RuntimeException("failed to call submissionStatus.");
  }
}
 
Example #11
Source File: FakeBeginDeliveryActionListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * ACTION.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  // get service
  PublishedAssessmentService publishedAssessmentService = new
    PublishedAssessmentService();
  // get managed bean
  DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery");
  // get assessment
  PublishedAssessmentFacade pub = null;
  pub = lookupPublishedAssessment(ID_TO_TEST, publishedAssessmentService);
  log.info("** FakeBeginDeliveryActionListener, pub = "+pub);
  log.info("** FakeBeginDeliveryActionListener, pub title = "+pub.getTitle());

  // populate backing bean from published assessment
  populateBeanFromPub(delivery, pub);

  // add in course management system info
  CourseManagementBean course = (CourseManagementBean) ContextUtil.lookupBean("course");
  populateBeanFromCourse(delivery, course);
}
 
Example #12
Source File: ConfirmRemoveMediaListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  String mediaId = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaId");
  String mediaUrl = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaUrl");
  String mediaFilename = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaFilename");
  String itemGradingId = (String) FacesContext.getCurrentInstance().
  	getExternalContext().getRequestParameterMap().get("itemGradingId");

  MediaBean mediaBean = (MediaBean) ContextUtil.lookupBean(
      "mediaBean");
  mediaBean.setMediaId(mediaId);
  mediaBean.setMediaUrl(mediaUrl);
  mediaBean.setFilename(mediaFilename);
  mediaBean.setItemGradingId(Long.valueOf(itemGradingId));

}
 
Example #13
Source File: TemplateLoadListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Normal listener method.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  FacesContext context = FacesContext.getCurrentInstance();

  TemplateBean templateBean = lookupTemplateBean(context);
  String templateId = cu.lookupParam("templateId");

  AssessmentService assessmentService = new AssessmentService();
  AssessmentTemplateFacade template = assessmentService.getAssessmentTemplate(templateId);
  String author = template.getCreatedBy();
  if (!(author != null && author.equals(UserDirectoryService.getCurrentUser().getId())) && !template.getTypeId().equals(TypeIfc.TEMPLATE_SYSTEM_DEFINED)) {
      log.error("User attempted to load template owned by another author " + author + " " + UserDirectoryService.getCurrentUser().getId());
      throw new AbortProcessingException("Attempted to load template owned by another author " + author + " " + UserDirectoryService.getCurrentUser().getId());
   }

  loadAssessment(templateBean, templateId);
}
 
Example #14
Source File: AssessmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) {
	SamLiteBean samLiteBean = (SamLiteBean) ContextUtil.lookupBean("samLiteBean");
	
	Document doc = samLiteBean.createDocument();

	AssessmentFacade assessment = createImportedAssessment(doc, QTIVersion.VERSION_1_2, samLiteBean.getAssessmentTemplateId());
	
	String templateId = samLiteBean.getAssessmentTemplateId();
	if (null != templateId && !"".equals(templateId)) {
		try {
			assessment.setAssessmentTemplateId(Long.valueOf(templateId));
		} catch (NumberFormatException nfe) {
			// Don't worry about it.
			log.warn("Unable to set the assessment template id ", nfe);
		}
	}
	
	samLiteBean.createAssessment(assessment);
	samLiteBean.setData("");
	EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_CREATE, "siteId=" + AgentFacade.getCurrentSiteId() + ", assessmentId=" + assessment.getAssessmentId(), true));
}
 
Example #15
Source File: SubmissionStatusListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  SubmissionStatusBean bean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus");
  TotalScoresBean totalScoresBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");

  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedId");

  // Reset the search field
  String defaultSearchString = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.EvaluationMessages", "search_default_student_search_string");
  bean.setSearchString(defaultSearchString);
  
  if (!submissionStatus(publishedId, bean, totalScoresBean, false))
  {
    throw new RuntimeException("failed to call submissionStatus.");
  }
}
 
Example #16
Source File: RemoveAttachmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  AttachmentBean attachmentBean = (AttachmentBean) ContextUtil.lookupBean(
      "attachmentBean");
  AssessmentService assessmentService = new AssessmentService();

  // #1. get all the info need from bean
  String attachmentId = attachmentBean.getAttachmentId().toString();
  Long attachmentType = attachmentBean.getAttachmentType();
  if ((AttachmentIfc.ITEM_ATTACHMENT).equals(attachmentType))
    throw new UnsupportedOperationException();
  else if ((AttachmentIfc.SECTION_ATTACHMENT).equals(attachmentType))
    assessmentService.removeSectionAttachment(attachmentId);
  else if ((AttachmentIfc.ASSESSMENT_ATTACHMENT).equals(attachmentType))
    assessmentService.removeAssessmentAttachment(attachmentId);
}
 
Example #17
Source File: EventLogPreviousPageListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae)
{
	log.debug("*****Log: inside EventLogPreviousPageListener =debugging ActionEvent: " + ae);

	EventLogBean eventLog = (EventLogBean) ContextUtil.lookupBean("eventLog");

	int pageNumber = eventLog.getPreviousPageNumber();
	eventLog.setPageNumber(pageNumber);
	Map pageDataMap = eventLog.getPageDataMap();
	List eventLogDataList = (List)pageDataMap.get(Integer.valueOf(pageNumber));
	eventLog.setEventLogDataList((ArrayList)eventLogDataList);
	
	if(pageNumber < 2) {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.FALSE);
	}
	else {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.TRUE);
	}
}
 
Example #18
Source File: EditStudentSectionsBean.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processDrop(ActionEvent event) {
	String sectionUuid = (String)FacesContext.getCurrentInstance().getExternalContext()
	.getRequestParameterMap().get("sectionUuid");
	CourseSection section = getSectionManager().getSection(sectionUuid);
	
	// The section might have been deleted
	if(section == null) {
		JsfUtil.addErrorMessage(JsfUtil.getLocalizedMessage("error_section_deleted"));
		return;
	}

	getSectionManager().dropSectionMembership(studentUid, sectionUuid);

	// Don't focus on this component, since it won't be there any more.  Focus on the join component
	String componentId = event.getComponent().getClientId(FacesContext.getCurrentInstance());
	elementToFocus = componentId.replaceAll(":unjoin", ":join");
}
 
Example #19
Source File: UpdateAssessmentQuestionsOrder.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException {

		FacesContext context = FacesContext.getCurrentInstance();
		AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");
		assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean");

		boolean isEditPendingAssessmentFlow = author.getIsEditPendingAssessmentFlow();

		if (isEditPendingAssessmentFlow) {
			assessmentService = new AssessmentService();
			itemService = new ItemService();
		} else {
			assessmentService = new PublishedAssessmentService();
			itemService = new PublishedItemService();
		}

		if(reorderItems()){
			String err = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "edit_order_warning");
			context.addMessage(null, new FacesMessage(err));
		}

		assessmentBean.setAssessment(assessmentService.getAssessment(Long.valueOf(assessmentBean.getAssessmentId())));
	}
 
Example #20
Source File: StudentScoreListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("StudentScore LISTENER.");
  StudentScoresBean bean = (StudentScoresBean) ContextUtil.lookupBean("studentScores");

  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedIdd");
  
  log.debug("Calling studentScores.");
  if (!studentScores(publishedId, bean, false))
  {
    throw new RuntimeException("failed to call studentScores.");
  }

}
 
Example #21
Source File: TemplateLoadListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Normal listener method.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  FacesContext context = FacesContext.getCurrentInstance();

  TemplateBean templateBean = lookupTemplateBean(context);
  String templateId = cu.lookupParam("templateId");

  AssessmentService assessmentService = new AssessmentService();
  AssessmentTemplateFacade template = assessmentService.getAssessmentTemplate(templateId);
  String author = template.getCreatedBy();
  if (!(author != null && author.equals(UserDirectoryService.getCurrentUser().getId())) && !template.getTypeId().equals(TypeIfc.TEMPLATE_SYSTEM_DEFINED)) {
      log.error("User attempted to load template owned by another author " + author + " " + UserDirectoryService.getCurrentUser().getId());
      throw new AbortProcessingException("Attempted to load template owned by another author " + author + " " + UserDirectoryService.getCurrentUser().getId());
   }

  loadAssessment(templateBean, templateId);
}
 
Example #22
Source File: ConfirmDeleteTemplateListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  FacesContext context = FacesContext.getCurrentInstance();
  //Map reqMap = context.getExternalContext().getRequestMap();
  //Map requestParams = context.getExternalContext().getRequestParameterMap();

  String templateId = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("templateId");
  AssessmentService assessmentService = new AssessmentService();
  AssessmentTemplateFacade template = assessmentService.getAssessmentTemplate(templateId);

  TemplateBean templateBean = lookupTemplateBean(context);

  String author =  (String)template.getCreatedBy();
  if (author == null || !author.equals(UserDirectoryService.getCurrentUser().getId())) {
      throw new AbortProcessingException("Attempted to delete template owned by another " + author + " " + UserDirectoryService.getCurrentUser().getId());
  }

  templateBean.setIdString(templateId);
  templateBean.setTemplateName(template.getTitle());
}
 
Example #23
Source File: ConfirmCopyAssessmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException {
	FacesContext context = FacesContext.getCurrentInstance();

	// #1 - read the assessmentId from the form
	String assessmentId = (String) FacesContext.getCurrentInstance()
			.getExternalContext().getRequestParameterMap().get("assessmentId");

	// #2 -  and use it to set author bean, goto removeAssessment.jsp
	AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean");
	AssessmentService assessmentService = new AssessmentService();
	AssessmentFacade assessment = assessmentService.getBasicInfoOfAnAssessment(assessmentId);

	// #3 - permission checking before proceeding - daisyf
	AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");
	author.setOutcome("confirmCopyAssessment");

	AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization");
	if (!authzBean.isUserAllowedToEditAssessment(assessmentId, assessment.getCreatedBy(), false)) {
		author.setOutcome("author");
		return;
	}

	assessmentBean.setAssessmentId(assessment.getAssessmentBaseId().toString());
	assessmentBean.setTitle(ComponentManager.get(FormattedText.class).convertFormattedTextToPlaintext(assessment.getTitle()));
}
 
Example #24
Source File: ImportQuestionsToAuthoringFromSearch.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  SearchQuestionBean  searchQuestionBean= (SearchQuestionBean) ContextUtil.lookupBean("searchQuestionBean");
  if (!importItems(searchQuestionBean))
  {
    throw new RuntimeException("failed to populateItemBean.");
  }
  searchQuestionBean.setLastSearchType("");
}
 
Example #25
Source File: CalendarBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void backToEventList(ActionEvent e) {
	try{
		selectedEventRef = null;
		updateEventList = true;
	}catch(Exception ex){
		log.error("Error in backToEventList: {}", ex.toString());
	}
}
 
Example #26
Source File: ResetTotalScoreListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * ACTION.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  TotalScoresBean bean = (TotalScoresBean) cu.lookupBean("totalScores");
  bean.setAssessmentGradingList(new ArrayList());
}
 
Example #27
Source File: SaveAssessmentAttachmentListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException {
 AssessmentService assessmentService = null;
 AssessmentIfc assessment = null;
 List attachmentList = new ArrayList();
 if (isForAuthorSettings) {
  assessmentService = new AssessmentService();
  AssessmentSettingsBean assessmentSettingsBean = (AssessmentSettingsBean) ContextUtil.lookupBean("assessmentSettings");
  if (assessmentSettingsBean.getAssessment() != null){
	  assessment = assessmentSettingsBean.getAssessment();
	  // attach item attachemnt to assessmentBean
	  attachmentList = prepareAssessmentAttachment(assessment, assessmentService);
	  
  }
  assessmentSettingsBean.setAttachmentList(attachmentList);
 }
 else {
  assessmentService = new PublishedAssessmentService();
  PublishedAssessmentSettingsBean publishedAssessmentSettingsBean = (PublishedAssessmentSettingsBean) ContextUtil.lookupBean(
  "publishedSettings");
  if (publishedAssessmentSettingsBean.getAssessment() != null){
	  assessment = publishedAssessmentSettingsBean.getAssessment();
      // attach item attachemnt to assessmentBean
	  attachmentList = prepareAssessmentAttachment(assessment, assessmentService);
  }
  publishedAssessmentSettingsBean.setAttachmentList(attachmentList);
 }  
}
 
Example #28
Source File: ImportAssessmentListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processAction(ActionEvent ae) throws
    AbortProcessingException
  {
    //Get the beans
    AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");
    AssessmentBean assessmentBean =
      (AssessmentBean) ContextUtil.lookupBean("assessmentBean");
    ItemAuthorBean itemauthorBean = (ItemAuthorBean) ContextUtil.lookupBean(
      "itemauthor");
    itemauthorBean.setTarget(ItemAuthorBean.FROM_ASSESSMENT); // save to assessment
    //XMLImportBean xmlImport = (XMLImportBean) ContextUtil.lookupBean("xmlImport");

    // Get the file name
//    String fileName = xmlImport.getUploadFileName();
    String fileName = testFileName;

    // Create an assessment based on the uploaded file
      AssessmentFacade assessment = createImportedAssessment(fileName);
    

    if (assessment!=null) {
    // import successful
    // Go to editAssessment.jsp, so prepare assessmentBean
      assessmentBean.setAssessment(assessment);
    // reset in case anything hanging around
      author.setAssessTitle("");
      author.setAssessmentDescription("");
      author.setAssessmentTypeId("");
      author.setAssessmentTemplateId(AssessmentTemplateFacade.
        DEFAULTTEMPLATE.toString());

    // update core AssessmentList: get the managed bean, author and set the list
      AssessmentService assessmentService = new AssessmentService();
      List list = assessmentService.getBasicInfoOfAllActiveAssessments(
                     AssessmentFacadeQueries.TITLE,true);
    //
      author.setAssessments(list);
    }
  }
 
Example #29
Source File: CancelSearchQuestion.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * Simply cancel and return
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws AbortProcessingException
{
    SearchQuestionBean  searchQuestionBean= (SearchQuestionBean) ContextUtil.lookupBean("searchQuestionBean");
    if (!(searchQuestionBean.isComesFromPool())) {
        ItemAuthorBean itemauthorbean = (ItemAuthorBean) ContextUtil.lookupBean("itemauthor");
        itemauthorbean.setItemTypeString("");
    }
    searchQuestionBean.setLastSearchType("");
}
 
Example #30
Source File: CalendarBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void next(ActionEvent e) {
	updateEventList = true;
	if(viewMode.equals(MODE_WEEKVIEW)){
		// week view
		nextWeek(e);
	}else{
		// month view
		nextMonth(e);
	}
}