Search in sources :

Example 66 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class BCCourseNode method isConfigValid.

/**
 * @see org.olat.course.nodes.CourseNode#isConfigValid()
 */
@Override
public StatusDescription isConfigValid() {
    updateModuleConfigDefaults(false);
    StatusDescription sd = StatusDescription.NOERROR;
    if (!getModuleConfiguration().getBooleanSafe(BCCourseNodeEditController.CONFIG_AUTO_FOLDER)) {
        String subpath = getModuleConfiguration().getStringValue(BCCourseNodeEditController.CONFIG_SUBPATH, "");
        if (!StringHelper.containsNonWhitespace(subpath)) {
            String shortKey = "error.missingfolder.short";
            String longKey = "error.missingfolder.long";
            String[] params = new String[] { this.getShortTitle() };
            String translPackage = Util.getPackageName(BCCourseNodeEditController.class);
            sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
            sd.setDescriptionForUnit(getIdent());
            // set which pane is affected by error
            sd.setActivateableViewIdentifier(BCCourseNodeEditController.PANE_TAB_FOLDER);
        }
    }
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    return sd;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription)

Example 67 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class BasicLTICourseNode method isConfigValid.

/**
 * @see org.olat.course.nodes.CourseNode#isConfigValid()
 */
@Override
public StatusDescription isConfigValid() {
    /*
		 * first check the one click cache
		 */
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    String host = (String) getModuleConfiguration().get(LTIConfigForm.CONFIGKEY_HOST);
    boolean isValid = host != null;
    StatusDescription sd = StatusDescription.NOERROR;
    if (!isValid) {
        // FIXME: refine statusdescriptions
        String[] params = new String[] { this.getShortTitle() };
        sd = new StatusDescription(StatusDescription.ERROR, NLS_ERROR_HOSTMISSING_SHORT, NLS_ERROR_HOSTMISSING_LONG, params, translatorPackage);
        sd.setDescriptionForUnit(getIdent());
        // set which pane is affected by error
        sd.setActivateableViewIdentifier(LTIEditController.PANE_TAB_LTCONFIG);
    }
    return sd;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription)

Example 68 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class COCourseNode method isConfigValid.

/**
 * @see org.olat.course.nodes.CourseNode#isConfigValid()
 */
@Override
public StatusDescription isConfigValid() {
    updateModuleConfigDefaults(false);
    /*
         * first check the one click cache
         */
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    /**
     * configuration is valid if the provided e-mail container result in at list
     * one recipient e-mail adress. Hence we have always to perform the very
     * expensive operation to fetch the e-mail adresses for tutors,
     * participants, group and area members. simple config here!
     */
    @SuppressWarnings("unchecked") List<String> emailList = (List<String>) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOADRESSES);
    boolean isValid = (emailList != null && emailList.size() > 0);
    Boolean email2owners = getModuleConfiguration().getBooleanEntry(COEditController.CONFIG_KEY_EMAILTOOWNERS);
    isValid = isValid || (email2owners != null && email2owners.booleanValue());
    String email2AreaCoaches = (String) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA);
    isValid = isValid || (StringHelper.containsNonWhitespace(email2AreaCoaches));
    String email2GroupCoaches = (String) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP);
    isValid = isValid || (StringHelper.containsNonWhitespace(email2GroupCoaches));
    isValid = isValid || getModuleConfiguration().getBooleanSafe(COEditController.CONFIG_KEY_EMAILTOCOACHES_ALL, false);
    isValid = isValid || getModuleConfiguration().getBooleanSafe(COEditController.CONFIG_KEY_EMAILTOCOACHES_COURSE, false);
    String email2AreaParticipants = (String) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_AREA);
    isValid = isValid || (StringHelper.containsNonWhitespace(email2AreaParticipants));
    String email2GroupParticipants = (String) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP);
    isValid = isValid || (StringHelper.containsNonWhitespace(email2GroupParticipants));
    isValid = isValid || getModuleConfiguration().getBooleanSafe(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_ALL, false);
    isValid = isValid || getModuleConfiguration().getBooleanSafe(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_COURSE, false);
    StatusDescription sd = StatusDescription.NOERROR;
    if (!isValid) {
        String shortKey = "error.norecipients.short";
        String longKey = "error.norecipients.long";
        String[] params = new String[] { this.getShortTitle() };
        String translPackage = Util.getPackageName(COEditController.class);
        sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
        sd.setDescriptionForUnit(getIdent());
        // set which pane is affected by error
        sd.setActivateableViewIdentifier(COEditController.PANE_TAB_COCONFIG);
    }
    return sd;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription) ArrayList(java.util.ArrayList) List(java.util.List)

Example 69 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class ModifyCourseEvent method publishCourse.

/**
 * Publish the course with some standard options
 * @param course
 * @param locale
 * @param identity
 */
public static void publishCourse(ICourse course, int access, boolean membersOnly, Identity identity, Locale locale) {
    CourseEditorTreeModel cetm = course.getEditorTreeModel();
    PublishProcess publishProcess = PublishProcess.getInstance(course, cetm, locale);
    PublishTreeModel publishTreeModel = publishProcess.getPublishTreeModel();
    int newAccess = (access < RepositoryEntry.ACC_OWNERS || access > RepositoryEntry.ACC_USERS_GUESTS) ? RepositoryEntry.ACC_USERS : access;
    // access rule -> all users can the see course
    // RepositoryEntry.ACC_OWNERS
    // only owners can the see course
    // RepositoryEntry.ACC_OWNERS_AUTHORS //only owners and authors can the see course
    // RepositoryEntry.ACC_USERS_GUESTS // users and guests can see the course
    // fxdiff VCRP-1,2: access control of resources
    publishProcess.changeGeneralAccess(identity, newAccess, membersOnly);
    if (publishTreeModel.hasPublishableChanges()) {
        List<String> nodeToPublish = new ArrayList<String>();
        visitPublishModel(publishTreeModel.getRootNode(), publishTreeModel, nodeToPublish);
        publishProcess.createPublishSetFor(nodeToPublish);
        PublishSetInformations set = publishProcess.testPublishSet(locale);
        StatusDescription[] status = set.getWarnings();
        // publish not possible when there are errors
        for (int i = 0; i < status.length; i++) {
            if (status[i].isError()) {
                log.error("Status error by publish: " + status[i].getLongDescription(locale));
                return;
            }
        }
        try {
            course = CourseFactory.openCourseEditSession(course.getResourceableId());
            publishProcess.applyPublishSet(identity, locale, false);
        } catch (Exception e) {
            log.error("", e);
        } finally {
            closeCourseEditSession(course.getResourceableId(), true);
        }
    }
}
Also used : CourseEditorTreeModel(org.olat.course.tree.CourseEditorTreeModel) StatusDescription(org.olat.course.editor.StatusDescription) PublishTreeModel(org.olat.course.tree.PublishTreeModel) ArrayList(java.util.ArrayList) PublishProcess(org.olat.course.editor.PublishProcess) PublishSetInformations(org.olat.course.editor.PublishSetInformations) AssertException(org.olat.core.logging.AssertException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Example 70 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class ScormCourseNode method isConfigValid.

/**
 * @see org.olat.course.nodes.CourseNode#isConfigValid()
 */
@Override
public StatusDescription isConfigValid() {
    /*
		 * first check the one click cache
		 */
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    StatusDescription sd = StatusDescription.NOERROR;
    boolean isValid = ScormEditController.isModuleConfigValid(getModuleConfiguration());
    if (!isValid) {
        String shortKey = "error.noreference.short";
        String longKey = "error.noreference.long";
        String[] params = new String[] { this.getShortTitle() };
        String translPackage = Util.getPackageName(ScormEditController.class);
        sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
        sd.setDescriptionForUnit(getIdent());
        // set which pane is affected by error
        sd.setActivateableViewIdentifier(ScormEditController.PANE_TAB_CPCONFIG);
    }
    return sd;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription)

Aggregations

StatusDescription (org.olat.course.editor.StatusDescription)82 ArrayList (java.util.ArrayList)20 ModuleConfiguration (org.olat.modules.ModuleConfiguration)10 List (java.util.List)4 Condition (org.olat.course.condition.Condition)4 PublishProcess (org.olat.course.editor.PublishProcess)4 PublishSetInformations (org.olat.course.editor.PublishSetInformations)4 CourseNode (org.olat.course.nodes.CourseNode)4 CourseEditorTreeModel (org.olat.course.tree.CourseEditorTreeModel)4 BusinessGroupService (org.olat.group.BusinessGroupService)4 ChecklistEditController (de.bps.course.nodes.cl.ChecklistEditController)2 VCEditController (de.bps.course.nodes.vc.VCEditController)2 VCProvider (de.bps.course.nodes.vc.provider.VCProvider)2 Checklist (de.bps.olat.modules.cl.Checklist)2 Checkpoint (de.bps.olat.modules.cl.Checkpoint)2 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 IdentityRef (org.olat.basesecurity.IdentityRef)2 CollaborationTools (org.olat.collaboration.CollaborationTools)2