Skip to content
Snippets Groups Projects
Commit d2a7a29d authored by srosse's avatar srosse
Browse files

OO-1264: disable mail tool with the mail module

parent 15a5efaf
No related branches found
No related tags found
No related merge requests found
......@@ -21,16 +21,11 @@ package org.olat.core.util.mail;
import java.io.File;
import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.modules.bc.FolderConfig;
import org.olat.core.configuration.AbstractOLATModule;
import org.olat.core.configuration.PersistedProperties;
import org.olat.core.extensions.action.GenericActionExtension;
import org.olat.core.gui.control.Event;
import org.olat.core.util.StringHelper;
import org.olat.core.util.WebappHelper;
import org.olat.core.util.event.FrameworkStartedEvent;
import org.olat.core.util.event.FrameworkStartupEventChannel;
import org.olat.core.util.vfs.LocalFolderImpl;
import org.olat.core.util.vfs.VFSContainer;
......@@ -59,7 +54,6 @@ public class MailModule extends AbstractOLATModule {
public MailModule() {
//make Spring happy
FrameworkStartupEventChannel.registerForStartupEvent(this);
}
/**
......@@ -116,29 +110,9 @@ public class MailModule extends AbstractOLATModule {
*/
public void setInterSystem(boolean internSystem) {
String internSystemStr = internSystem ? "true" : "false";
enableExtensions(internSystem);
setStringProperty(INTERN_MAIL_SYSTEM, internSystemStr, true);
}
private void enableExtensions(boolean enabled){
try {
((GenericActionExtension)CoreSpringFactory.getBean("mailAEparent")).setEnabled(enabled);
((GenericActionExtension)CoreSpringFactory.getBean("mailAEinbox")).setEnabled(enabled);
((GenericActionExtension)CoreSpringFactory.getBean("mailAEoutbox")).setEnabled(enabled);
} catch (Exception e) {
// do nothing when extension don't exist.
}
}
@Override
public void event(Event event) {
if(event instanceof FrameworkStartedEvent) {
enableExtensions(isInternSystem());
} else {
super.event(event);
}
}
/**
* Users can receive real e-mail too. This setting is the default for
* users. They can change it in Preferences Panel.
......
/**
* <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.core.util.mail;
import org.olat.core.extensions.action.GenericActionExtension;
/**
*
* Initial date: 20.10.2014<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
public class MailToolExtension extends GenericActionExtension {
private MailModule module;
/**
* [used by Spring]
* @param module
*/
public void setMailModule(MailModule module) {
this.module = module;
}
@Override
public boolean isEnabled() {
return module.isInternSystem() && super.isEnabled();
}
}
......@@ -72,8 +72,9 @@
</bean>
<!-- the email-parent-menu -->
<bean class="org.olat.core.extensions.action.GenericActionExtension" name="mailBox" init-method="initExtensionPoints" >
<bean class="org.olat.core.util.mail.MailToolExtension" name="mailBox" init-method="initExtensionPoints" >
<property name="order" value="404" />
<property name="mailModule" ref="mailModule" />
<property name="navigationKey" value="Mail" />
<property name="alternativeNavigationKeys" value="Inbox,Outbox" />
<property name="iconCssClass" value="o_icon o_icon-fw o_icon_mail" />
......
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