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;
}
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;
}
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;
}
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);
}
}
}
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;
}
Aggregations