Skip to content
Snippets Groups Projects
Commit d5a4704a authored by uhensler's avatar uhensler
Browse files

OO-2699: new course element "card2brain"

parent 2c05bdb5
No related branches found
No related tags found
No related merge requests found
Showing
with 1166 additions and 1 deletion
...@@ -43,6 +43,7 @@ import org.olat.course.nodes.BlogCourseNode; ...@@ -43,6 +43,7 @@ import org.olat.course.nodes.BlogCourseNode;
import org.olat.course.nodes.COCourseNode; import org.olat.course.nodes.COCourseNode;
import org.olat.course.nodes.CPCourseNode; import org.olat.course.nodes.CPCourseNode;
import org.olat.course.nodes.CalCourseNode; import org.olat.course.nodes.CalCourseNode;
import org.olat.course.nodes.Card2BrainCourseNode;
import org.olat.course.nodes.CourseNode; import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.DialogCourseNode; import org.olat.course.nodes.DialogCourseNode;
import org.olat.course.nodes.ENCourseNode; import org.olat.course.nodes.ENCourseNode;
...@@ -107,6 +108,7 @@ public class CourseXStreamAliases { ...@@ -107,6 +108,7 @@ public class CourseXStreamAliases {
readXstream.alias("BCCourseNode", BCCourseNode.class); readXstream.alias("BCCourseNode", BCCourseNode.class);
readXstream.alias("BlogCourseNode", BlogCourseNode.class); readXstream.alias("BlogCourseNode", BlogCourseNode.class);
readXstream.alias("CalCourseNode", CalCourseNode.class); readXstream.alias("CalCourseNode", CalCourseNode.class);
readXstream.alias("Card2BrainCourseNode", Card2BrainCourseNode.class);
readXstream.alias("COCourseNode", COCourseNode.class); readXstream.alias("COCourseNode", COCourseNode.class);
readXstream.alias("CourseNode", CourseNode.class); readXstream.alias("CourseNode", CourseNode.class);
readXstream.alias("CPCourseNode", CPCourseNode.class); readXstream.alias("CPCourseNode", CPCourseNode.class);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<import resource="classpath:/org/olat/course/db/_spring/coursedbContext.xml"/> <import resource="classpath:/org/olat/course/db/_spring/coursedbContext.xml"/>
<import resource="classpath:/org/olat/course/nodes/_spring/buildingblockContext.xml"/> <import resource="classpath:/org/olat/course/nodes/_spring/buildingblockContext.xml"/>
<import resource="classpath:/org/olat/course/nodes/basiclti/_spring/basicLtiContext.xml"/> <import resource="classpath:/org/olat/course/nodes/basiclti/_spring/basicLtiContext.xml"/>
<import resource="classpath:/org/olat/course/nodes/card2brain/_spring/card2brainContext.xml"/>
<import resource="classpath:/org/olat/course/nodes/info/_spring/infoMessageContext.xml"/> <import resource="classpath:/org/olat/course/nodes/info/_spring/infoMessageContext.xml"/>
<import resource="classpath:/org/olat/course/nodes/gotomeeting/_spring/buildingblockContext.xml"/> <import resource="classpath:/org/olat/course/nodes/gotomeeting/_spring/buildingblockContext.xml"/>
<import resource="classpath:/org/olat/course/nodes/openmeetings/_spring/buildingblockContext.xml"/> <import resource="classpath:/org/olat/course/nodes/openmeetings/_spring/buildingblockContext.xml"/>
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes;
import java.util.List;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.stack.BreadcrumbPanel;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.messages.MessageUIFactory;
import org.olat.core.gui.control.generic.tabbable.TabbableController;
import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util;
import org.olat.course.ICourse;
import org.olat.course.condition.ConditionEditController;
import org.olat.course.editor.CourseEditorEnv;
import org.olat.course.editor.NodeEditController;
import org.olat.course.editor.StatusDescription;
import org.olat.course.nodes.card2brain.Card2BrainEditController;
import org.olat.course.nodes.card2brain.Card2BrainPeekViewController;
import org.olat.course.nodes.card2brain.Card2BrainRunController;
import org.olat.course.run.navigation.NodeRunConstructionResult;
import org.olat.course.run.userview.NodeEvaluation;
import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.modules.card2brain.Card2BrainModule;
import org.olat.repository.RepositoryEntry;
/**
*
* Initial date: 10.04.2017<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class Card2BrainCourseNode extends AbstractAccessableCourseNode {
private static final long serialVersionUID = -7338962050297071079L;
private static final String TYPE = "card2brain";
public static final String CONFIG_FLASHCARD_ALIAS = "flashcardAlias";
public static final String CONFIG_ENABLE_PRIVATE_LOGIN = "enablePrivateLogin";
public static final String CONFIG_PRIVATE_KEY = "privateKey";
public static final String CONFIG_PRIVATE_SECRET = "privateSecret";
public Card2BrainCourseNode() {
super(TYPE);
}
@Override
public TabbableController createEditController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel,
ICourse course, UserCourseEnvironment euce) {
updateModuleConfigDefaults(false);
Card2BrainEditController childTabCntrllr = new Card2BrainEditController(ureq, wControl, this, course, euce);
CourseNode chosenNode = course.getEditorTreeModel().getCourseNode(euce.getCourseEditorEnv().getCurrentCourseNodeId());
return new NodeEditController(ureq, wControl, course.getEditorTreeModel(), course, chosenNode, euce, childTabCntrllr);
}
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl,
UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
updateModuleConfigDefaults(false);
Controller runCtrl;
if(userCourseEnv.isCourseReadOnly()) {
Translator trans = Util.createPackageTranslator(Card2BrainCourseNode.class, ureq.getLocale());
String title = trans.translate("freezenoaccess.title");
String message = trans.translate("freezenoaccess.message");
runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
} else if (userCourseEnv.getIdentityEnvironment().getRoles().isGuestOnly()) {
Translator trans = Util.createPackageTranslator(Card2BrainCourseNode.class, ureq.getLocale());
String title = trans.translate("guestnoaccess.title");
String message = trans.translate("guestnoaccess.message");
runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
} else {
runCtrl = new Card2BrainRunController(ureq, wControl, userCourseEnv, this);
}
Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, runCtrl, this, "o_card2brain_icon");
return new NodeRunConstructionResult(ctrl);
}
@Override
public Controller createPreviewController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
return createNodeRunConstructionResult(ureq, wControl, userCourseEnv, ne, null).getRunController();
}
@Override
public Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
return new Card2BrainPeekViewController(ureq, wControl,
userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry().getKey(),
getIdent(),
this.getModuleConfiguration().getStringValue(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS));
}
@SuppressWarnings("deprecation")
@Override
public StatusDescription[] isConfigValid(CourseEditorEnv cev) {
String translatorStr = Util.getPackageName(ConditionEditController.class);
List<StatusDescription> statusDescs = isConfigValidWithTranslator(cev, translatorStr, getConditionExpressions());
return StatusDescriptionHelper.sort(statusDescs);
}
@SuppressWarnings("deprecation")
@Override
public StatusDescription isConfigValid() {
if(oneClickStatusCache!=null) {
return oneClickStatusCache[0];
}
StatusDescription sd = StatusDescription.NOERROR;
Card2BrainModule card2BrainModule = CoreSpringFactory.getImpl(Card2BrainModule.class);
boolean isEnterpriseLogin = !getModuleConfiguration().getBooleanSafe(CONFIG_ENABLE_PRIVATE_LOGIN);
boolean isValid = card2BrainModule.isLoginSafe(isEnterpriseLogin);
if (!isValid) {
String shortKey = "edit.warning.enterpriseLoginDisabled.short";
String longKey = "edit.warning.enterpriseLoginDisabled";
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(Card2BrainEditController.class);
sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(Card2BrainEditController.PANE_TAB_VCCONFIG);
}
return sd;
}
@Override
public boolean needsReferenceToARepositoryEntry() {
return false;
}
@Override
public RepositoryEntry getReferencedRepositoryEntry() {
return null;
}
}
...@@ -52,6 +52,7 @@ import org.olat.core.logging.OLATRuntimeException; ...@@ -52,6 +52,7 @@ import org.olat.core.logging.OLATRuntimeException;
import org.olat.core.util.CodeHelper; import org.olat.core.util.CodeHelper;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.course.nodes.BasicLTICourseNode; import org.olat.course.nodes.BasicLTICourseNode;
import org.olat.ims.lti.LTIDisplayOptions;
import org.olat.ims.lti.LTIManager; import org.olat.ims.lti.LTIManager;
import org.olat.modules.ModuleConfiguration; import org.olat.modules.ModuleConfiguration;
import org.olat.user.UserManager; import org.olat.user.UserManager;
......
...@@ -63,6 +63,7 @@ import org.olat.course.run.environment.CourseEnvironment; ...@@ -63,6 +63,7 @@ import org.olat.course.run.environment.CourseEnvironment;
import org.olat.course.run.scoring.ScoreEvaluation; import org.olat.course.run.scoring.ScoreEvaluation;
import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.ims.lti.LTIContext; import org.olat.ims.lti.LTIContext;
import org.olat.ims.lti.LTIDisplayOptions;
import org.olat.ims.lti.LTIManager; import org.olat.ims.lti.LTIManager;
import org.olat.ims.lti.ui.PostDataMapper; import org.olat.ims.lti.ui.PostDataMapper;
import org.olat.ims.lti.ui.TalkBackMapper; import org.olat.ims.lti.ui.TalkBackMapper;
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.card2brain;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement;
import org.olat.core.gui.components.form.flexible.elements.TextElement;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.util.StringHelper;
import org.olat.course.nodes.Card2BrainCourseNode;
import org.olat.modules.ModuleConfiguration;
import org.olat.modules.card2brain.Card2BrainModule;
import org.olat.modules.card2brain.manager.Card2BrainManager;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* Initial date: 11.04.2017<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class Card2BrainConfigController extends FormBasicController {
private static final String[] enabledKeys = new String[]{"on"};
private static final String FORM_MISSING_MANDATORY = "form.legende.mandatory";
private TextElement flashcardAliasEl;
private MultipleSelectionElement enablePrivateLoginEl;
private TextElement privateKeyEl;
private TextElement privateSecretEl;
private final ModuleConfiguration config;
@Autowired
private Card2BrainModule card2BrainModule;
@Autowired
private Card2BrainManager card2BrainManager;
public Card2BrainConfigController(UserRequest ureq, WindowControl wControl, Card2BrainCourseNode card2BrainCourseNode) {
super(ureq, wControl);
this.config = card2BrainCourseNode.getModuleConfiguration();
initForm(ureq);
}
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("edit.title");
setFormContextHelp("KnowledgeTransfer#_card2brain");
String falshcardAlias = config.getStringValue(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS);
flashcardAliasEl = uifactory.addTextElement("edit.flashcard.alias", "edit.flashcard.alias", 128, falshcardAlias, formLayout);
flashcardAliasEl.setMandatory(true);
flashcardAliasEl.setHelpTextKey("edit.FlashcardHelpText", null);
uifactory.addSpacerElement("Spacer", formLayout, false);
boolean enablePrivateLogin = config.getBooleanSafe(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN);
String[] enableValues = new String[]{ translate("on") };
enablePrivateLoginEl = uifactory.addCheckboxesHorizontal("edit.access.enablePrivateLogin", formLayout, enabledKeys, enableValues);
enablePrivateLoginEl.select(enabledKeys[0], enablePrivateLogin);
enablePrivateLoginEl.addActionListener(FormEvent.ONCHANGE);
String privateKey = config.getStringValue(Card2BrainCourseNode.CONFIG_PRIVATE_KEY);
privateKeyEl = uifactory.addTextElement("edit.access.privateKey", "edit.access.privateKey", 128, privateKey, formLayout);
privateKeyEl.setMandatory(true);
privateKeyEl.setHelpTextKey("edit.KeyHelpText", null);
String privateSecret = config.getStringValue(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET);
privateSecretEl = uifactory.addPasswordElement("edit.access.privateSecret", "edit.access.privateSecret", 128, privateSecret, formLayout);
privateSecretEl.setMandatory(true);
privateSecretEl.setHelpTextKey("edit.SecretHelpText", null);
uifactory.addFormSubmitButton("save", formLayout);
showHidePrivateLoginFields();
}
/**
* The checkbox of the private login is only visible if the enterprise login is enabled. Otherwise it is always a private login.
* The fields for the private login are only shown if the user has to fill in a private login.
* If the course node is stored with enterprise login but the enterprise login is disabled, show a message to the user and allow to register the private login.
*/
private void showHidePrivateLoginFields() {
enablePrivateLoginEl.setVisible(card2BrainModule.isEnterpriseLoginEnabled());
privateKeyEl.setVisible(isPrivateLoginEnabled());
privateSecretEl.setVisible(isPrivateLoginEnabled());
boolean isEnterpriseLogin = !config.getBooleanSafe(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN);
if (!card2BrainModule.isLoginSafe(isEnterpriseLogin)) {
setFormWarning("edit.warning.enterpriseLoginDisabled");
} else {
setFormWarning(null);
}
}
@Override
protected boolean validateFormLogic(UserRequest ureq) {
boolean allOk = super.validateFormLogic(ureq);
allOk &= validateFlashcardAlias(parseAlias(flashcardAliasEl.getValue()));
allOk &= validateLogin();
return allOk;
}
private boolean validateFlashcardAlias(String alias) {
boolean allOk = true;
if (!StringHelper.containsNonWhitespace(alias)) {
flashcardAliasEl.setErrorKey(FORM_MISSING_MANDATORY, null);
allOk &= false;
}
if (!card2BrainManager.checkSetOfFlashcards(alias)) {
flashcardAliasEl.setErrorKey("edit.warning.aliasCheckFailed", null);
allOk &= false;
}
return allOk;
}
private boolean validateLogin() {
boolean allOk = true;
if (isPrivateLoginEnabled()) {
if (!StringHelper.containsNonWhitespace(privateKeyEl.getValue())) {
privateKeyEl.setErrorKey(FORM_MISSING_MANDATORY, null);
allOk &= false;
}
if (!StringHelper.containsNonWhitespace(privateSecretEl.getValue())) {
privateSecretEl.setErrorKey(FORM_MISSING_MANDATORY, null);
allOk &= false;
}
}
return allOk;
}
@Override
protected void formOK(UserRequest ureq) {
setFormWarning(null);
fireEvent (ureq, Event.DONE_EVENT);
}
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (enablePrivateLoginEl == source) {
showHidePrivateLoginFields();
}
super.formInnerEvent(ureq, source, event);
}
protected ModuleConfiguration getUpdatedConfig() {
config.set(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS, parseAlias(flashcardAliasEl.getValue()));
if (isPrivateLoginEnabled()) {
config.set(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN, Boolean.toString(true));
config.set(Card2BrainCourseNode.CONFIG_PRIVATE_KEY, privateKeyEl.getValue());
config.set(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET, privateSecretEl.getValue());
} else {
config.set(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN, Boolean.toString(false));
config.set(Card2BrainCourseNode.CONFIG_PRIVATE_KEY, null);
config.set(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET, null);
}
return config;
}
@Override
protected void doDispose() {
//
}
/**
* Is a private login or a enterprise login enabled?
* 1. It is always a private login if the enterprise login is disabled in the configuration of the module.<br>
* 2. It is a private login if the user has clicked the private login checkbox.
*
* @return whether it is a private login or not (enterprise login).
*/
private boolean isPrivateLoginEnabled() {
boolean isPrivateLoginEnabled = false;
if (!card2BrainModule.isEnterpriseLoginEnabled() || enablePrivateLoginEl.isAtLeastSelected(1)) {
isPrivateLoginEnabled = true;
}
return isPrivateLoginEnabled;
}
/**
* Parse the alias of the set of flashcards.<br>
* Remove the unnecessary part if someone inserts the whole weblink from the card2brain website e.g. https://card2brain.ch/box/20170420_02_chemie_und_werkstoffe.
* @param alias the original alias value
* @return the parsed String
*/
private String parseAlias(String alias) {
return alias.replace("https://card2brain.ch/box/", "");
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.card2brain;
import org.olat.core.id.Identity;
import org.olat.course.nodes.CourseNode;
import org.olat.course.run.environment.CourseEnvironment;
import org.olat.ims.lti.LTIContext;
import org.olat.ims.lti.LTIDisplayOptions;
/**
*
* Initial date: 11.04.2017<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class Card2BrainContext implements LTIContext {
private static final String LTI_ROLE = "Learner";
private static final String HEIGTH = "auto";
private static final String WIDTH = "auto";
private static final LTIDisplayOptions TARGET = LTIDisplayOptions.iframe;
private final String sourcedId;
private final String backMapperUri;
private final String outcomeMapperUri;
private final CourseNode courseNode;
private final CourseEnvironment courseEnv;
public Card2BrainContext(CourseEnvironment courseEnv, CourseNode courseNode,
String sourcedId, String backMapperUri, String outcomeMapperUri) {
this.sourcedId = sourcedId;
this.courseEnv = courseEnv;
this.courseNode = courseNode;
this.backMapperUri = backMapperUri;
this.outcomeMapperUri = outcomeMapperUri;
}
@Override
public String getSourcedId() {
return sourcedId;
}
@Override
public String getTalkBackMapperUri() {
return backMapperUri;
}
@Override
public String getOutcomeMapperUri() {
return outcomeMapperUri;
}
@Override
public String getResourceId() {
return courseNode.getIdent();
}
@Override
public String getResourceTitle() {
return courseNode.getShortTitle();
}
@Override
public String getResourceDescription() {
return courseNode.getLongTitle();
}
@Override
public String getContextId() {
return courseEnv.getCourseResourceableId().toString();
}
@Override
public String getContextTitle() {
return courseEnv.getCourseTitle();
}
@Override
public String getRoles(Identity identity) {
return LTI_ROLE;
}
@Override
public String getCustomProperties() {
return null;
}
@Override
public String getTarget() {
return TARGET.toString();
}
@Override
public String getPreferredWidth() {
return WIDTH;
}
@Override
public String getPreferredHeight() {
return HEIGTH;
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.card2brain;
import java.util.Locale;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util;
import org.olat.course.nodes.AbstractCourseNodeConfiguration;
import org.olat.course.nodes.Card2BrainCourseNode;
import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.CourseNodeConfiguration;
import org.olat.course.nodes.CourseNodeGroup;
import org.olat.modules.card2brain.Card2BrainModule;
/**
*
* Initial date: 10.04.2017<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class Card2BrainCourseNodeConfiguration extends AbstractCourseNodeConfiguration {
@Override
public String getAlias() {
return "card2brain";
}
@Override
public String getGroup() {
return CourseNodeGroup.content.name();
}
@Override
public CourseNode getInstance() {
return new Card2BrainCourseNode();
}
@Override
public String getLinkText(Locale locale) {
Translator fallback = Util.createPackageTranslator(CourseNodeConfiguration.class, locale);
Translator translator = Util.createPackageTranslator(this.getClass(), locale, fallback);
return translator.translate("link.text");
}
@Override
public String getIconCSSClass() {
return "o_card2brain_icon";
}
@Override
public boolean isEnabled() {
Card2BrainModule module = CoreSpringFactory.getImpl(Card2BrainModule.class);
return module.isEnabled();
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.card2brain;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.tabbedpane.TabbedPane;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.ControllerEventListener;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.tabbable.ActivateableTabbableDefaultController;
import org.olat.course.ICourse;
import org.olat.course.assessment.AssessmentHelper;
import org.olat.course.condition.Condition;
import org.olat.course.condition.ConditionEditController;
import org.olat.course.editor.NodeEditController;
import org.olat.course.nodes.Card2BrainCourseNode;
import org.olat.course.run.userview.UserCourseEnvironment;
/**
*
* Initial date: 11.04.2017<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class Card2BrainEditController extends ActivateableTabbableDefaultController implements ControllerEventListener {
private static final String PANE_TAB_ACCESSIBILITY = "pane.tab.accessibility";
public static final String PANE_TAB_VCCONFIG = "pane.tab.vcconfig";
final static String[] paneKeys = { PANE_TAB_VCCONFIG, PANE_TAB_ACCESSIBILITY };
private VelocityContainer editVc;
private Card2BrainConfigController card2BrainConfigController;
private ConditionEditController accessibilityCondContr;
private TabbedPane tabPane;
public Card2BrainEditController(UserRequest ureq, WindowControl wControl, Card2BrainCourseNode card2BrainCourseNode,
ICourse course, UserCourseEnvironment userCourseEnv) {
super(ureq, wControl);
card2BrainConfigController = new Card2BrainConfigController(ureq, wControl, card2BrainCourseNode);
listenTo(card2BrainConfigController);
Condition accessCondition = card2BrainCourseNode.getPreConditionAccess();
accessibilityCondContr = new ConditionEditController(ureq, wControl, userCourseEnv,
accessCondition, AssessmentHelper.getAssessableNodes(course.getEditorTreeModel(), card2BrainCourseNode));
listenTo(accessibilityCondContr);
editVc = createVelocityContainer("edit");
editVc.put("configForm", card2BrainConfigController.getInitialComponent());
}
@Override
public void addTabs(TabbedPane tabbedPane) {
tabPane = tabbedPane;
tabbedPane.addTab(translate(PANE_TAB_ACCESSIBILITY),
accessibilityCondContr.getWrappedDefaultAccessConditionVC(translate("condition.accessibility.title")));
tabbedPane.addTab(translate(PANE_TAB_VCCONFIG), editVc);
}
@Override
public String[] getPaneKeys() {
return paneKeys;
}
@Override
public TabbedPane getTabbedPane() {
return tabPane;
}
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == card2BrainConfigController && event.equals(Event.DONE_EVENT)) {
card2BrainConfigController.getUpdatedConfig();
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
}
@Override
protected void event(UserRequest ureq, Component source, Event event) {
//
}
@Override
protected void doDispose() {
//
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.card2brain;
import org.olat.NewControllerFactory;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.panel.Panel;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController;
import org.olat.course.nodes.Card2BrainCourseNode;
import org.olat.modules.ModuleConfiguration;
import org.olat.modules.card2brain.Card2BrainModule;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* Initial date: 12.04.2017<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class Card2BrainPeekViewController extends BasicController {
private final static String EVENT_RUN = "run";
private Panel main;
private VelocityContainer container;
private final Long repositoryEntryKey;
private final String nodeId;
private final String flashcardAlias;
@Autowired
private Card2BrainModule card2BrainModule;
public Card2BrainPeekViewController(UserRequest ureq, WindowControl wControl, Long repositoryEntryKey, String nodeId, String flashcardAlias) {
super(ureq, wControl);
this.flashcardAlias = flashcardAlias;
this.repositoryEntryKey = repositoryEntryKey;
this.nodeId = nodeId;
main = new Panel("card2brainPanel");
runPeekview();
putInitialPanel(main);
}
private void runPeekview() {
container = createVelocityContainer("peekview");
String src = String.format(card2BrainModule.getPeekViewUrl(), flashcardAlias);
container.contextPut("src", src);
container.contextPut("run", EVENT_RUN);
main.setContent(container);
}
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == container && EVENT_RUN.equals(event.getCommand())) {
String businessPath = "[RepositoryEntry:" + repositoryEntryKey + "][CourseNode:" + nodeId + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
}
@Override
protected void doDispose() {
//
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.card2brain;
import java.util.Map;
import org.olat.core.CoreSpringFactory;
import org.olat.core.dispatcher.mapper.Mapper;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.panel.Panel;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.helpers.Settings;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.course.nodes.Card2BrainCourseNode;
import org.olat.course.nodes.CourseNode;
import org.olat.course.run.environment.CourseEnvironment;
import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.ims.lti.LTIContext;
import org.olat.ims.lti.LTIManager;
import org.olat.ims.lti.ui.PostDataMapper;
import org.olat.ims.lti.ui.TalkBackMapper;
import org.olat.modules.ModuleConfiguration;
import org.olat.modules.card2brain.Card2BrainModule;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* Initial date: 11.04.2017<br>
*
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class Card2BrainRunController extends BasicController {
private Panel main;
private CourseNode courseNode;
private final ModuleConfiguration config;
private final CourseEnvironment courseEnv;
private final LTIManager ltiManager;
@Autowired
private Card2BrainModule card2BrainModule;
public Card2BrainRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv,
Card2BrainCourseNode card2BrainCourseNode) {
super(ureq, wControl);
this.courseNode = card2BrainCourseNode;
this.config = card2BrainCourseNode.getModuleConfiguration();
this.courseEnv = userCourseEnv.getCourseEnvironment();
ltiManager = CoreSpringFactory.getImpl(LTIManager.class);
main = new Panel("card2brainPanel");
runCard2Brain(ureq);
putInitialPanel(main);
}
private void runCard2Brain(UserRequest ureq) {
VelocityContainer container = createVelocityContainer("run");
String url = String.format(card2BrainModule.getBaseUrl(),
config.getStringValue(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS));
String oauth_consumer_key;
String oauth_secret;
if (config.getBooleanSafe(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN)) {
oauth_consumer_key = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_KEY);
oauth_secret = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET);
} else {
oauth_consumer_key = card2BrainModule.getEnterpriseKey();
oauth_secret = card2BrainModule.getEnterpriseSecret();
}
String serverUri = Settings.createServerURI();
String sourcedId = courseEnv.getCourseResourceableId() + "_" + courseNode.getIdent() + "_"
+ getIdentity().getKey();
container.contextPut("sourcedId", sourcedId);
Mapper talkbackMapper = new TalkBackMapper(getLocale(),
getWindowControl().getWindowBackOffice().getWindow().getGuiTheme().getBaseURI());
String backMapperUrl = registerCacheableMapper(ureq, sourcedId + "_talkback", talkbackMapper);
String backMapperUri = serverUri + backMapperUrl + "/";
String outcomeMapperUri = null;
LTIContext context = new Card2BrainContext(courseEnv, courseNode, sourcedId, backMapperUri, outcomeMapperUri);
Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, true,
true);
Mapper contentMapper = new PostDataMapper(unsignedProps, url, oauth_consumer_key, oauth_secret, false);
String mapperUri = registerMapper(ureq, contentMapper);
container.contextPut("mapperUri", mapperUri + "/");
main.setContent(container);
}
@Override
protected void event(UserRequest ureq, Component source, Event event) {
// TODO Auto-generated method stub
}
@Override
protected void doDispose() {
//
}
}
$r.render("configForm")
\ No newline at end of file
<div class="o_c2b_peekview">
<div class="o_c2b_cover" onClick="$r.javaScriptCommand(${run});""></div>
<iframe class="o_c2b_irame" src="${src}" frameborder="0" scrolling="no"></iframe>
</div>
<div class="o_iframedisplay">
<iframe id="Card2BrainIFrame" src="${mapperUri}?$r.uuid" marginwidth="0" marginheight="0" frameborder="0" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
</div>
<script type="text/javascript">
/* <![CDATA[ */
## no window.onresize due to IE bug which triggers recurstion: http://snook.ca/archives/javascript/ie6_fires_onresize/
jQuery(function() {b_resizeIframeToMainMaxHeight("Card2BrainIFrame");});
jQuery( window ).resize(function() {
b_resizeIframeToMainMaxHeight("Card2BrainIFrame");
});
/* ]]> */
</script>
\ No newline at end of file
#Thu Apr 20 14:14:09 CEST 2017
condition.accessibility.title=Zugang
edit.FlashcardHelpText=Das Alias ist in den Details der Kartenkartei auf card2brain zu finden. Das Alias ist der letzte Abschnitt des Weblinks, z.B. 20170419_das_kleine_garten_abc
edit.KeyHelpText=Der Schl\u00FCssel ist in den Einstellungen auf der Webseite von card2brain zu finden.
edit.SecretHelpText=Das Passwort ist in den Einstellungen auf der Webseite von card2brain zu finden.
edit.access.enablePrivateLogin=Privates Login verwenden
edit.access.privateKey=Schl\u00FCssel
edit.access.privateSecret=Passwort
edit.flashcard.alias=Alias der Lernkartei
edit.title=Lernkartei konfigurieren
edit.warning.aliasCheckFailed=Das Alias konnte nicht verifiziert werden. Existiert eine Kartenkartei mit diesem Alias?
edit.warning.enterpriseLoginDisabled=Dieser Kartenstapel wurde mit einem Enterprise Login konfiguriert. Das Enterprise Login wurde in der Zwischenzeit durch den Administrator deaktiviert. Geben Sie bitte die Angaben zum privaten Login ein.
edit.warning.enterpriseLoginDisabled.short=Das Enterprise Login ist deaktiviert.
link.text=card2brain Lernkarten
pane.tab.accessibility=Zugang
pane.tab.vcconfig=Lernkartei
#Thu Apr 20 14:16:23 CEST 2017
condition.accessibility.title=Access
edit.FlashcardHelpText=The alias is available in the details of the set of flashcards on the card2brain website. The alias is the last part of the weblink, e.g. 20170419_das_kleine_garten_abc
edit.KeyHelpText=The key is available in the preferences of the card2brain website.
edit.SecretHelpText=The password is available in the preferences of the card2brain website.
edit.access.enablePrivateLogin=Use private login
edit.access.privateKey=Key
edit.access.privateSecret=Password
edit.flashcard.alias=Alias of flashcards
edit.title=Flashcard Configuration
edit.warning.aliasCheckFailed=The alias could not be verified. Does a set of flashcard with that alias exist?
edit.warning.enterpriseLoginDisabled=That set of flashcard was configured with a enterprise login. The enterprise login was disabled by the administrator in the meantime. Please fill in a private login.
edit.warning.enterpriseLoginDisabled.short=The enterprise login is disabled.
link.text=card2brain flashcards
pane.tab.accessibility=Access
pane.tab.vcconfig=Set of flashcards
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="card2brain" class="org.olat.course.nodes.card2brain.Card2BrainCourseNodeConfiguration" scope="prototype">
<property name="order" value="250" />
</bean>
</beans>
\ No newline at end of file
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* frentix GmbH, http://www.frentix.com * frentix GmbH, http://www.frentix.com
* <p> * <p>
*/ */
package org.olat.course.nodes.basiclti; package org.olat.ims.lti;
/** /**
* *
......
...@@ -42,6 +42,26 @@ ...@@ -42,6 +42,26 @@
</property> </property>
</bean> </bean>
<!-- card2brain admin. panel -->
<bean class="org.olat.core.extensions.action.GenericActionExtension" init-method="initExtensionPoints">
<property name="order" value="8248" />
<property name="actionController">
<bean class="org.olat.core.gui.control.creator.AutoCreator" scope="prototype">
<property name="className" value="org.olat.modules.card2brain.ui.Card2BrainAdminController"/>
</bean>
</property>
<property name="navigationKey" value="gotomeeting" />
<property name="i18nActionKey" value="admin.menu.title"/>
<property name="i18nDescriptionKey" value="admin.menu.title.alt"/>
<property name="translationPackage" value="org.olat.modules.card2brain.ui"/>
<property name="parentTreeNodeIdentifier" value="externalToolsParent" />
<property name="extensionPoints">
<list>
<value>org.olat.admin.SystemAdminMainController</value>
</list>
</property>
</bean>
<!-- Goto admin. panel --> <!-- Goto admin. panel -->
<bean class="org.olat.core.extensions.action.GenericActionExtension" init-method="initExtensionPoints"> <bean class="org.olat.core.extensions.action.GenericActionExtension" init-method="initExtensionPoints">
<property name="order" value="8218" /> <property name="order" value="8218" />
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.card2brain;
import org.olat.core.configuration.AbstractSpringModule;
import org.olat.core.configuration.ConfigOnOff;
import org.olat.core.util.StringHelper;
import org.olat.core.util.coordinate.CoordinatorManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
*
* Initial date: 07.04.2017<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
@Service
public class Card2BrainModule extends AbstractSpringModule implements ConfigOnOff {
public static final String CARD2BRAIN_ENABLED = "card2brain.enabled";
public static final String CARD2BRAIN_ENTERPRISE_LOGIN_ENABLED = "card2brain.enterpriseLoginEnabled";
public static final String CARD2BRAIN_ENTERPRISE_KEY = "card2brain.enterpriseKey";
public static final String CARD2BRAIN_ENTERPRISE_SECRET= "card2brain.enterpriseSecret";
public static final String CARD2BRAIN_BASE_URL = "card2brain.baseUrl";
public static final String CARD2BRAIN_PEEK_VIEW_URL = "card2brain.peekViewUrl";
@Value("${card2brain.enabled:false}")
private boolean enabled;
@Value("${card2brain.enterpriseLoginEnalbled:false}")
private boolean enterpriseLoginEnabled;
private String enterpriseKey;
private String enterpriseSecret;
@Value("${card2brain.baseUrl:null}")
private String baseUrl;
@Value("${card2brain.peekViewUrl:null}")
private String peekViewUrl;
@Autowired
public Card2BrainModule(CoordinatorManager coordinatorManager) {
super(coordinatorManager);
}
@Override
public void init() {
String enabledObj = getStringPropertyValue(CARD2BRAIN_ENABLED, true);
if(StringHelper.containsNonWhitespace(enabledObj)) {
enabled = "true".equals(enabledObj);
}
String enterpriseLoginEnabledObj = getStringPropertyValue(CARD2BRAIN_ENTERPRISE_LOGIN_ENABLED, true);
if(StringHelper.containsNonWhitespace(enterpriseLoginEnabledObj)) {
enterpriseLoginEnabled = "true".equals(enterpriseLoginEnabledObj);
}
String enterpriseKeyObj = getStringPropertyValue(CARD2BRAIN_ENTERPRISE_KEY, true);
if(StringHelper.containsNonWhitespace(enterpriseKeyObj)) {
enterpriseKey = enterpriseKeyObj;
}
String enterpriseSecretObj = getStringPropertyValue(CARD2BRAIN_ENTERPRISE_SECRET, true);
if(StringHelper.containsNonWhitespace(enterpriseSecretObj)) {
enterpriseSecret = enterpriseSecretObj;
}
String baseUrlObj = getStringPropertyValue(CARD2BRAIN_BASE_URL, true);
if(StringHelper.containsNonWhitespace(baseUrlObj)) {
baseUrl = baseUrlObj;
}
String peekViewUrlObj = getStringPropertyValue(CARD2BRAIN_PEEK_VIEW_URL, true);
if(StringHelper.containsNonWhitespace(peekViewUrlObj)) {
peekViewUrl = peekViewUrlObj;
}
}
@Override
protected void initFromChangedProperties() {
init();
}
@Override
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
setStringProperty(CARD2BRAIN_ENABLED, Boolean.toString(enabled), true);
}
public boolean isEnterpriseLoginEnabled() {
return enterpriseLoginEnabled;
}
public void setEnterpriseLoginEnabled(boolean enterpriseLoginEnalbled) {
this.enterpriseLoginEnabled = enterpriseLoginEnalbled;
setStringProperty(CARD2BRAIN_ENTERPRISE_LOGIN_ENABLED, Boolean.toString(enterpriseLoginEnalbled), true);
}
public String getEnterpriseKey() {
return enterpriseKey;
}
public void setEnterpriseKey(String enterpriseKey) {
this.enterpriseKey = enterpriseKey;
setStringProperty(CARD2BRAIN_ENTERPRISE_KEY, enterpriseKey, true);
}
public String getEnterpriseSecret() {
return enterpriseSecret;
}
public void setEnterpriseSecret(String enterpriseSecret) {
this.enterpriseSecret = enterpriseSecret;
setStringProperty(CARD2BRAIN_ENTERPRISE_SECRET, enterpriseSecret, true);
}
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
setStringProperty(CARD2BRAIN_BASE_URL, baseUrl, true);
}
public String getPeekViewUrl() {
return peekViewUrl;
}
public void setPeekViewUrl(String peekViewUrl) {
this.peekViewUrl = peekViewUrl;
setStringProperty(CARD2BRAIN_PEEK_VIEW_URL, peekViewUrl, true);
}
/**
* Check if the use of a certain login is safe.<br>
* - If the enterprise login is enable, it is safe to use a enterprise login.<br>
* - If the enterprise login is not enabled, it is only safe to not use a enterprise login.
*
* @param enterpriseLogin true to check a enterprise login
* @return whether the enterprise can be used safe
*/
public boolean isLoginSafe(boolean enterpriseLogin) {
return this.isEnterpriseLoginEnabled() || !enterpriseLogin;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment