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

FXOLAT-358: backport impressum

parent bb1a0bb4
No related branches found
No related tags found
No related merge requests found
Showing
with 760 additions and 84 deletions
/**
* <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.commons.controllers.impressum;
import org.olat.core.configuration.PersistedProperties;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
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.logging.OLATRuntimeException;
import org.olat.core.util.StringHelper;
import org.olat.core.util.WebappHelper;
import org.olat.core.util.event.GenericEventListener;
import org.olat.core.util.mail.ContactList;
import org.olat.core.util.mail.ContactMessage;
import org.olat.modules.co.ContactFormController;
/**
* <h3>Description:</h3> This controller shows a contact form and has a
* user-configurable destination e-mail address which it reads from the file
* <code>olatdata/system/configuration/contact.properties</code>
*
* Initial Date: Aug 10, 2009 <br>
*
* @author twuersch, frentix GmbH, http://www.frentix.com
*/
public class ContactController extends BasicController implements GenericEventListener {
private final VelocityContainer content;
private ContactFormController contactForm;
private static String contactEmail = null;
/**
* Creates this controller.
*
* @param ureq The user request.
* @param control The window control.
*/
public ContactController(UserRequest ureq, WindowControl control) {
super(ureq, control);
this.content = createVelocityContainer("contact");
// load configuration only once
if (contactEmail == null) {
// Read the destination e-mail address from the configuration file.
PersistedProperties contactConfiguration = new PersistedProperties(this);
contactConfiguration.init();
contactEmail = contactConfiguration.getStringPropertyValue("contact.to.address", true);
if (!StringHelper.containsNonWhitespace(contactEmail)) {
// fallback to standard email
contactEmail = WebappHelper.getMailConfig("mailSupport");
if (!StringHelper.containsNonWhitespace(contactEmail)) {
throw new OLATRuntimeException(
"could not find valid contact email address, configure property 'contact.to.address' in olatdata/system/configuration/"
+ this.getClass().getName() + ".properties", null);
} else {
logInfo("Initialize impressum email with standard support address::" + contactEmail
+ " You can configure a specific impressum email in the property 'contact.to.address' in olatdata/system/configuration/"
+ this.getClass().getName() + ".properties", null);
}
} else {
logInfo("Initialize impressum email with address::" + contactEmail, null);
}
}
// Initialize a few contact list management objects.
ContactMessage contactMessage = new ContactMessage(ureq.getIdentity());
ContactList contactList = new ContactList(translate("contact.to"));
contactList.add(contactEmail);
contactMessage.addEmailTo(contactList);
// Show GUI
this.contactForm = new ContactFormController(ureq, getWindowControl(), false, false, false, false, contactMessage);
listenTo(this.contactForm);
this.content.put("contactForm", this.contactForm.getInitialComponent());
putInitialPanel(content);
}
/**
* @see org.olat.core.gui.control.DefaultController#doDispose()
*/
@Override
protected void doDispose() {
// autodispose by basic controller
}
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
// Do nothing.
}
/**
* @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
*/
public void event(Event event) {
// nothing to do, the persisted properties used in this controller are
// read-only, no GUI to modify the properties yet
}
}
/**
* <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.commons.controllers.impressum;
import java.io.File;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
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.gui.control.generic.iframe.IFrameDisplayController;
import org.olat.core.util.WebappHelper;
/**
* <h3>Description:</h3> This controller displays an impressum which it reads
* from an external HTML file in the <code>olatdata</code> directory.
*
*
* Initial Date: Aug 10, 2009 <br>
*
* @author twuersch, frentix GmbH, http://www.frentix.com
*/
public class ImpressumController extends BasicController {
public static final String IMPRESSUM_HTML_FOLDER = "/customizing/impressum/";
private VelocityContainer content;
private IFrameDisplayController impressumIframe;
/**
* @param ureq
* @param control
*/
public ImpressumController(UserRequest ureq, WindowControl control) {
super(ureq, control);
this.content = createVelocityContainer("impressum");
File baseFolder = new File(WebappHelper.getUserDataRoot(), IMPRESSUM_HTML_FOLDER);
this.impressumIframe = new IFrameDisplayController(ureq, getWindowControl(), baseFolder);
String langCode = ureq.getLocale().getLanguage();
String fileName = "index_" + langCode + ".html";
File termsFileInLang = new File (baseFolder, fileName);
if (termsFileInLang.exists()){
this.impressumIframe.setCurrentURI(fileName);
} else {
//default is german
this.impressumIframe.setCurrentURI("index_de.html");
}
this.content.put("impressumIFrame", this.impressumIframe.getInitialComponent());
putInitialPanel(content);
}
/*
* (non-Javadoc)
*
* @see org.olat.core.gui.control.DefaultController#doDispose()
*/
@Override
protected void doDispose() {
this.impressumIframe.dispose();
this.impressumIframe = null;
}
/*
* (non-Javadoc)
*
* @seeorg.olat.core.gui.control.DefaultController#event(org.olat.core.gui.
* UserRequest, org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
// Do nothing.
}
}
/**
* <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.commons.controllers.impressum;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.layout.GenericMainController;
/**
* <h3>Description:</h3>
*
* This controller displays the impressum and related controllers in a 3-column
* layout. Since this uses a {@link GenericMainController}, it is configured
* automatically, so see the file webapp/WEB-INF/olat_extensions.xml to
* configure this.
*
* Initial Date: Aug 7, 2009 <br>
*
* @author twuersch, frentix GmbH, http://www.frentix.com
*/
public class ImpressumDmzMainController extends GenericMainController {
public ImpressumDmzMainController(UserRequest ureq, WindowControl wControl) {
super(ureq, wControl);
init(ureq);
}
/*
* (non-Javadoc)
*
* @seeorg.olat.core.gui.control.generic.layout.GenericMainController#
* handleOwnMenuTreeEvent(java.lang.Object, org.olat.core.gui.UserRequest)
*/
@Override
protected Controller handleOwnMenuTreeEvent(Object uobject, UserRequest ureq) {
// No own menu tree events defined, so don't do anything here.
return null;
}
}
/**
* <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.commons.controllers.impressum;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.layout.GenericMainController;
/**
* <h3>Description:</h3>
*
* This controller displays the impressum and related controllers in a 3-column
* layout. Since this uses a {@link GenericMainController}, it is configured
* automatically, so see the file webapp/WEB-INF/olat_extensions.xml to
* configure this.
*
* Initial Date: Aug 7, 2009 <br>
*
* @author twuersch, frentix GmbH, http://www.frentix.com
*/
public class ImpressumMainController extends GenericMainController {
public ImpressumMainController(UserRequest ureq, WindowControl wControl) {
super(ureq, wControl);
init(ureq);
}
/*
* (non-Javadoc)
*
* @seeorg.olat.core.gui.control.generic.layout.GenericMainController#
* handleOwnMenuTreeEvent(java.lang.Object, org.olat.core.gui.UserRequest)
*/
@Override
protected Controller handleOwnMenuTreeEvent(Object uobject, UserRequest ureq) {
// No own menu tree events defined, so don't do anything here.
return null;
}
}
/**
* <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.commons.controllers.impressum;
import java.io.File;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
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.gui.control.generic.iframe.IFrameDisplayController;
import org.olat.core.util.WebappHelper;
/**
* <h3>Description:</h3> This controller displays terms of use which it reads
* from an external HTML file in the <code>olatdata</code> directory.
*
*
* Initial Date: Aug 10, 2009 <br>
*
* @author twuersch, frentix GmbH, http://www.frentix.com
*/
public class TermsOfUseController extends BasicController {
public static final String TERMS_OF_USE_HTML_FOLDER = "/customizing/terms_of_use/";
private VelocityContainer content;
private IFrameDisplayController termsOfUseIframe;
/**
* @param ureq
* @param control
*/
public TermsOfUseController(UserRequest ureq, WindowControl control) {
super(ureq, control);
this.content = createVelocityContainer("terms_of_use");
File baseFolder = new File(WebappHelper.getUserDataRoot(), TERMS_OF_USE_HTML_FOLDER);
this.termsOfUseIframe = new IFrameDisplayController(ureq, getWindowControl(), baseFolder);
String langCode = ureq.getLocale().getLanguage();
String fileName = "index_" + langCode + ".html";
File termsFileInLang = new File (baseFolder, fileName);
if (termsFileInLang.exists()){
this.termsOfUseIframe.setCurrentURI(fileName);
} else {
//default is german
this.termsOfUseIframe.setCurrentURI("index_de.html");
}
this.content.put("termsOfUseIFrame", this.termsOfUseIframe.getInitialComponent());
putInitialPanel(content);
}
/* (non-Javadoc)
* @see org.olat.core.gui.control.DefaultController#doDispose()
*/
@Override
protected void doDispose() {
this.termsOfUseIframe.dispose();
this.termsOfUseIframe = null;
}
/* (non-Javadoc)
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
// Do nothing.
}
}
<h3>$r.translate("contactform.title")</h3>
<p class="b_info">$r.translate("contactform.intro")</p>
$r.render("contactForm")
$r.render("impressumIFrame")
$r.render("termsOfUseIFrame")
contactform.title=Kontakt
contactform.intro=Kontaktformular fr allgemeine Anfragen.
main.menu.title=Impressum
main.menu.title.alt=Impressum
ImpressumController.menu.title=Impressum
ImpressumController.menu.title.alt=Impressum
contact.to=Sekretariat
ContactController.menu.title=Kontakt
ContactController.menu.title.alt=Kontakt
TermsOfUseController.menu.title=Nutzungsbedingungen
TermsOfUseController.menu.title.alt=Nutzungsbedingungen
#Thu May 26 14:17:17 CEST 2011
ContactController.menu.title=Contact
ContactController.menu.title.alt=Contact
ImpressumController.menu.title=Mentions légales
ImpressumController.menu.title.alt=Mentions légales
TermsOfUseController.menu.title=Usage terms
TermsOfUseController.menu.title.alt=Terms of use
contact.to=Secrétariat
contactform.intro=Contact form for general requests.
contactform.title=Contact
main.menu.title=Mentions légales
main.menu.title.alt=Mentions légales
#Thu May 26 14:17:17 CEST 2011
ContactController.menu.title=Contact
ContactController.menu.title.alt=Contact
ImpressumController.menu.title=Imprint
ImpressumController.menu.title.alt=Imprint
TermsOfUseController.menu.title=Usage terms
TermsOfUseController.menu.title.alt=Terms of use
contact.to=Secretary
contactform.intro=Contact form for general requests.
contactform.title=Contact
main.menu.title=Imprint
main.menu.title.alt=Imprint
<?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-3.0.xsd ">
<bean class="org.olat.core.extensions.action.GenericActionExtension" init-method="initExtensionPoints">
<property name="actionController">
<bean class="org.olat.core.gui.control.creator.AutoCreator" scope="prototype">
<property name="className" value="org.olat.core.commons.controllers.impressum.ImpressumController"/>
</bean>
</property>
<property name="extensionPoints">
<list>
<value>org.olat.core.commons.controllers.impressum.ImpressumMainController</value>
<value>org.olat.core.commons.controllers.impressum.ImpressumDmzMainController</value>
</list>
</property>
<property name="order" value="701"/>
</bean>
<bean class="org.olat.core.extensions.action.GenericActionExtension" init-method="initExtensionPoints">
<property name="actionController">
<bean class="org.olat.core.gui.control.creator.AutoCreator" scope="prototype">
<property name="className" value="org.olat.core.commons.controllers.impressum.TermsOfUseController"/>
</bean>
</property>
<property name="extensionPoints">
<list>
<value>org.olat.core.commons.controllers.impressum.ImpressumMainController</value>
<value>org.olat.core.commons.controllers.impressum.ImpressumDmzMainController</value>
</list>
</property>
<property name="order" value="702"/>
</bean>
<bean class="org.olat.core.extensions.action.GenericActionExtension" init-method="initExtensionPoints">
<property name="actionController">
<bean class="org.olat.core.gui.control.creator.AutoCreator" scope="prototype">
<property name="className" value="org.olat.core.commons.controllers.impressum.ContactController"/>
</bean>
</property>
<property name="extensionPoints">
<list>
<value>org.olat.core.commons.controllers.impressum.ImpressumMainController</value>
</list>
</property>
<property name="order" value="703"/>
</bean>
</beans>
\ No newline at end of file
#if($guiMessage.hasInfo())
<script type="text/javascript">
//needs to be delayed otherwise IE6 will crash in non ajax mode
setTimeout(function(){ showMessageBox('info', '$r.translate("info.header")', '$r.get("guiMessage").renderInfo()'); }, 100);
</script>
#end
#if($guiMessage.hasWarn())
<script type="text/javascript">
//needs to be delayed otherwise IE6 will crash in non ajax mode
setTimeout(function(){ showMessageBox('warn', '$r.translate("warn.header")', '$r.get("guiMessage").renderWarn()'); }, 100);
##auto hide box
setTimeout(function(){ Ext.MessageBox.hide(); }, 8000);
</script>
#end
#if($guiMessage.hasError())
<script type="text/javascript">
//needs to be delayed otherwise IE6 will crash in non ajax mode
setTimeout(function(){ showMessageBox('error', '$r.translate("error.header")', '$r.get("guiMessage").renderError()'); }, 100);
</script>
#end
/**
* <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.gui.control;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.creator.AutoCreator;
/**
*
* <h3>Description:</h3>
* <p>
* Initial Date: 30 nov. 2010 <br>
* @author srosse, srosse@frentix.com, www.frentix.com
*/
public class DmzTopNavCreator extends AutoCreator {
private boolean impressum;
@Override
public Controller createController(UserRequest ureq, WindowControl wControl) {
return new OlatDmzTopNavController(ureq, wControl, impressum);
}
public boolean isImpressum() {
return impressum;
}
public void setImpressum(boolean impressum) {
this.impressum = impressum;
}
}
/**
* <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.gui.control;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.creator.AutoCreator;
/**
*
* <h3>Description:</h3>
* <p>
* Initial Date: 30 nov. 2010 <br>
* @author srosse, srosse@frentix.com, www.frentix.com
*/
public class GuestTopNavCreator extends AutoCreator {
private boolean impressum;
@Override
public Controller createController(UserRequest ureq, WindowControl wControl) {
return new OlatGuestTopNavController(ureq, wControl, impressum);
}
public boolean isImpressum() {
return impressum;
}
public void setImpressum(boolean impressum) {
this.impressum = impressum;
}
}
...@@ -25,23 +25,42 @@ ...@@ -25,23 +25,42 @@
package org.olat.gui.control; package org.olat.gui.control;
import org.olat.core.commons.chiefcontrollers.LanguageChooserController; import org.olat.core.commons.chiefcontrollers.LanguageChooserController;
import org.olat.core.commons.controllers.impressum.ImpressumDmzMainController;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.Windows;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event; import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController; import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.creator.ControllerCreator;
import org.olat.core.gui.control.generic.popup.PopupBrowserWindow;
public class OlatDmzTopNavController extends BasicController{ public class OlatDmzTopNavController extends BasicController{
private Link impressumLink;
private VelocityContainer topNavVC; private VelocityContainer topNavVC;
private LanguageChooserController languageChooserC; private LanguageChooserController languageChooserC;
public OlatDmzTopNavController(UserRequest ureq, WindowControl wControl) { public OlatDmzTopNavController(UserRequest ureq, WindowControl wControl) {
this(ureq, wControl, false);
}
public OlatDmzTopNavController(UserRequest ureq, WindowControl wControl, boolean impressum) {
super(ureq, wControl); super(ureq, wControl);
topNavVC = createVelocityContainer("dmztopnav"); topNavVC = createVelocityContainer("dmztopnav");
// impressum
if(impressum) {
impressumLink = LinkFactory.createLink("topnav.impressum", topNavVC, this);
impressumLink.setTooltip("topnav.impressum.alt", false);
impressumLink.setAjaxEnabled(false);
impressumLink.setTarget("_blank");
}
//choosing language //choosing language
languageChooserC = new LanguageChooserController(getWindowControl(), ureq); languageChooserC = new LanguageChooserController(getWindowControl(), ureq);
...@@ -54,14 +73,17 @@ public class OlatDmzTopNavController extends BasicController{ ...@@ -54,14 +73,17 @@ public class OlatDmzTopNavController extends BasicController{
putInitialPanel(topNavVC); putInitialPanel(topNavVC);
} }
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
//
}
public void event(UserRequest ureq, Component source, Event event) { public void event(UserRequest ureq, Component source, Event event) {
//no events yet if (source == impressumLink) {
ControllerCreator impressumControllerCreator = new ControllerCreator() {
public Controller createController(UserRequest lureq, WindowControl lwControl) {
return new ImpressumDmzMainController(lureq, lwControl);
}
};
PopupBrowserWindow popupBrowserWindow = Windows.getWindows(ureq).getWindowManager().createNewUnauthenticatedPopupWindowFor(ureq, impressumControllerCreator);
popupBrowserWindow.open(ureq);
}
} }
protected void doDispose() { protected void doDispose() {
......
...@@ -26,8 +26,10 @@ ...@@ -26,8 +26,10 @@
package org.olat.gui.control; package org.olat.gui.control;
import org.olat.basesecurity.AuthHelper; import org.olat.basesecurity.AuthHelper;
import org.olat.core.commons.controllers.impressum.ImpressumMainController;
import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory; import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.Windows;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory; import org.olat.core.gui.components.link.LinkFactory;
...@@ -52,12 +54,25 @@ public class OlatGuestTopNavController extends BasicController { ...@@ -52,12 +54,25 @@ public class OlatGuestTopNavController extends BasicController {
private VelocityContainer topNavVC; private VelocityContainer topNavVC;
private Link helpLink; private Link helpLink;
private Link loginLink; private Link loginLink;
private Link impressumLink;
public OlatGuestTopNavController(UserRequest ureq, WindowControl wControl) { public OlatGuestTopNavController(UserRequest ureq, WindowControl wControl) {
this(ureq, wControl, false);
}
public OlatGuestTopNavController(UserRequest ureq, WindowControl wControl, boolean impressum) {
super(ureq, wControl); super(ureq, wControl);
topNavVC = createVelocityContainer("guesttopnav"); topNavVC = createVelocityContainer("guesttopnav");
// impressum
if(impressum) {
impressumLink = LinkFactory.createLink("topnav.impressum", topNavVC, this);
impressumLink.setTooltip("topnav.impressum.alt", false);
impressumLink.setAjaxEnabled(false);
impressumLink.setTarget("_blank");
}
// the help link // the help link
helpLink = LinkFactory.createLink("topnav.help", topNavVC, this); helpLink = LinkFactory.createLink("topnav.help", topNavVC, this);
helpLink.setTooltip("topnav.help.alt", false); helpLink.setTooltip("topnav.help.alt", false);
...@@ -77,7 +92,7 @@ public class OlatGuestTopNavController extends BasicController { ...@@ -77,7 +92,7 @@ public class OlatGuestTopNavController extends BasicController {
public void event(UserRequest ureq, Component source, Event event) { public void event(UserRequest ureq, Component source, Event event) {
if (source == loginLink) { if (source == loginLink) {
AuthHelper.doLogout(ureq); AuthHelper.doLogout(ureq);
}else if (source == helpLink) { } else if (source == helpLink) {
ControllerCreator ctrlCreator = new ControllerCreator() { ControllerCreator ctrlCreator = new ControllerCreator() {
public Controller createController(UserRequest lureq, WindowControl lwControl) { public Controller createController(UserRequest lureq, WindowControl lwControl) {
return CourseFactory.createHelpCourseLaunchController(lureq, lwControl); return CourseFactory.createHelpCourseLaunchController(lureq, lwControl);
...@@ -89,6 +104,14 @@ public class OlatGuestTopNavController extends BasicController { ...@@ -89,6 +104,14 @@ public class OlatGuestTopNavController extends BasicController {
PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr); PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
pbw.open(ureq); pbw.open(ureq);
// //
} else if (source == impressumLink) {
ControllerCreator impressumControllerCreator = new ControllerCreator() {
public Controller createController(UserRequest lureq, WindowControl lwControl) {
return new ImpressumMainController(lureq, lwControl);
}
};
PopupBrowserWindow popupBrowserWindow = Windows.getWindows(ureq).getWindowManager().createNewPopupBrowserWindowFor(ureq, impressumControllerCreator);
popupBrowserWindow.open(ureq);
} }
} }
......
...@@ -27,12 +27,14 @@ package org.olat.gui.control; ...@@ -27,12 +27,14 @@ package org.olat.gui.control;
import org.olat.basesecurity.AuthHelper; import org.olat.basesecurity.AuthHelper;
import org.olat.core.CoreSpringFactory; import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.controllers.impressum.ImpressumMainController;
import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory; import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory;
import org.olat.core.commons.services.search.ui.SearchController; import org.olat.core.commons.services.search.ui.SearchController;
import org.olat.core.commons.services.search.ui.SearchServiceUIFactory; import org.olat.core.commons.services.search.ui.SearchServiceUIFactory;
import org.olat.core.commons.services.search.ui.SearchServiceUIFactory.DisplayOption; import org.olat.core.commons.services.search.ui.SearchServiceUIFactory.DisplayOption;
import org.olat.core.dispatcher.DispatcherAction; import org.olat.core.dispatcher.DispatcherAction;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.Windows;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory; import org.olat.core.gui.components.link.LinkFactory;
...@@ -42,6 +44,7 @@ import org.olat.core.gui.control.Event; ...@@ -42,6 +44,7 @@ import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController; import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.creator.ControllerCreator; import org.olat.core.gui.control.creator.ControllerCreator;
import org.olat.core.gui.control.generic.popup.PopupBrowserWindow;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.util.event.EventBus; import org.olat.core.util.event.EventBus;
import org.olat.core.util.event.GenericEventListener; import org.olat.core.util.event.GenericEventListener;
...@@ -60,20 +63,24 @@ import org.olat.instantMessaging.groupchat.GroupChatManagerController; ...@@ -60,20 +63,24 @@ import org.olat.instantMessaging.groupchat.GroupChatManagerController;
* *
* @author patrickb * @author patrickb
*/ */
public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 implements GenericEventListener*/ implements GenericEventListener{ public class OlatTopNavController extends BasicController implements GenericEventListener {
private static final String ACTION_LOGOUT = "logout"; private static final String ACTION_LOGOUT = "logout";
private VelocityContainer topNavVC; private VelocityContainer topNavVC;
private Controller imController; private Controller imController;
private GroupChatManagerController groupChatController; private GroupChatManagerController groupChatController;
private SearchController searchC; private SearchController searchC;
private Link helpLink, loginLink; private Link helpLink, loginLink, impressumLink;
//TODO:PB:OLAT-4047 private Link permLink;
//TODO:PB:OLAT-4047 private VelocityContainer permsharp;
private EventBus singleUserEventCenter; private EventBus singleUserEventCenter;
private OLATResourceable ass; private OLATResourceable ass;
public OlatTopNavController(UserRequest ureq, WindowControl wControl) { public OlatTopNavController(UserRequest ureq, WindowControl wControl) {
this(ureq, wControl, false, true);
}
public OlatTopNavController(UserRequest ureq, WindowControl wControl, boolean impressum, boolean search) {
super(ureq, wControl); super(ureq, wControl);
topNavVC = createVelocityContainer("topnav"); topNavVC = createVelocityContainer("topnav");
...@@ -97,21 +104,20 @@ public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 im ...@@ -97,21 +104,20 @@ public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 im
topNavVC.contextPut("isGuest", Boolean.TRUE); topNavVC.contextPut("isGuest", Boolean.TRUE);
loginLink = LinkFactory.createLink("topnav.login", topNavVC, this); loginLink = LinkFactory.createLink("topnav.login", topNavVC, this);
loginLink.setTooltip("topnav.login.alt", false); loginLink.setTooltip("topnav.login.alt", false);
} }
if(impressum) {
impressumLink = LinkFactory.createLink("topnav.impressum", topNavVC, this);
impressumLink.setTooltip("topnav.impressum.alt", false);
impressumLink.setAjaxEnabled(false);
impressumLink.setTarget("_blank");
}
SearchServiceUIFactory searchUIFactory = (SearchServiceUIFactory)CoreSpringFactory.getBean(SearchServiceUIFactory.class); SearchServiceUIFactory searchUIFactory = (SearchServiceUIFactory)CoreSpringFactory.getBean(SearchServiceUIFactory.class);
searchC = searchUIFactory.createInputController(ureq, wControl, DisplayOption.STANDARD, null); searchC = searchUIFactory.createInputController(ureq, wControl, DisplayOption.STANDARD, null);
searchC.setResourceContextEnable(false); searchC.setResourceContextEnable(false);
topNavVC.put("search_input", searchC.getInitialComponent()); topNavVC.put("search_input", searchC.getInitialComponent());
//TODO:PB:OLAT-4047 permLink = LinkFactory.createLink("topnav.permlink", topNavVC, this);
//TODO:PB:OLAT-4047 permLink.setTarget("_permlink");
//TODO:PB:OLAT-4047 permsharp = createVelocityContainer("permsharp");
//TODO:PB:OLAT-4047 Panel p = new Panel("refreshpermlink");
//TODO:PB:OLAT-4047 p.setContent(permsharp);
//TODO:PB:OLAT-4047 topNavVC.put("refreshpermlink",p);
//TODO:PB:OLAT-4047 getWindowControl().getWindowBackOffice().addCycleListener(this);//receive events to adjust URL
if (ureq.getIdentity() != null) { if (ureq.getIdentity() != null) {
ass = OresHelper.createOLATResourceableType(AssessmentEvent.class); ass = OresHelper.createOLATResourceableType(AssessmentEvent.class);
...@@ -122,17 +128,6 @@ public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 im ...@@ -122,17 +128,6 @@ public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 im
putInitialPanel(topNavVC); putInitialPanel(topNavVC);
} }
/**
*
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == topNavVC) {
//System.out.println(event.getCommand());
}
}
/** /**
* *
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
...@@ -153,20 +148,18 @@ public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 im ...@@ -153,20 +148,18 @@ public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 im
// //
} else if (source == loginLink) { } else if (source == loginLink) {
DispatcherAction.redirectToDefaultDispatcher(ureq.getHttpResp()); DispatcherAction.redirectToDefaultDispatcher(ureq.getHttpResp());
} /* //TODO:PB:OLAT-4047 else if (source == permLink){ } else if (source == topNavVC) {
WindowControl current = (WindowControl)getWindowControl().getWindowBackOffice().getWindow().getAttribute("BUSPATH");
String buspath = current != null ? JumpInManager.getRestJumpInUri(current.getBusinessControl()) : "NONE";
String postUrl = Settings.getServerContextPathURI()+"/url/"+buspath;
String deliciousPost = "http://del.icio.us/post?url="+postUrl;
ControllerCreator ctrl = BaseFullWebappPopupLayoutFactory.createRedirectingPopup(ureq, deliciousPost);
openInNewBrowserWindow(ureq, ctrl);
return;
}*/
if (source == topNavVC) {
if (command.equals(ACTION_LOGOUT)) { if (command.equals(ACTION_LOGOUT)) {
AuthHelper.doLogout(ureq); AuthHelper.doLogout(ureq);
} }
} else if (source == impressumLink) {
ControllerCreator impressumControllerCreator = new ControllerCreator() {
public Controller createController(UserRequest lureq, WindowControl lwControl) {
return new ImpressumMainController(lureq, lwControl);
}
};
PopupBrowserWindow popupBrowserWindow = Windows.getWindows(ureq).getWindowManager().createNewPopupBrowserWindowFor(ureq, impressumControllerCreator);
popupBrowserWindow.open(ureq);
} }
} }
...@@ -199,19 +192,4 @@ public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 im ...@@ -199,19 +192,4 @@ public class OlatTopNavController extends BasicController /*TODO:PB:OLAT-4047 im
} }
} }
} }
/* TODO:PB:OLAT-4047
public void event(Event event) {
if (event == Window.BEFORE_INLINE_RENDERING) {
// create jump in path from the active main content WindowControl
WindowControl tmp = (WindowControl)getWindowControl().getWindowBackOffice().getWindow().getAttribute("BUSPATH");
String buspath = tmp != null ? JumpInManager.getRestJumpInUri(tmp.getBusinessControl()) : "NONE";
buspath = "/url/"+buspath;
String postUrl = Settings.getServerContextPathURI()+buspath;//TODO:PB:2009-06-02: move /url/ String to Spring config
//udpate URL for the addthis javascript box in the topnav velocity
permsharp.contextPut("myURL", postUrl);
permsharp.contextPut("buspath", buspath);
}
}*/
} }
/**
* <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.gui.control;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.creator.AutoCreator;
/**
*
* <h3>Description:</h3>
* AutoCreator for the FrentixTopNavController which allow to configure
* an impressum or not, annd the search or not
*
* <p>
* Initial Date: 25 nov. 2010 <br>
* @author srosse, srosse@frentix.com, www.frentix.com
*/
public class TopNavCreator extends AutoCreator {
private boolean impressum;
private boolean search;
@Override
public Controller createController(UserRequest ureq, WindowControl wControl) {
return new OlatTopNavController(ureq, wControl, impressum, search);
}
public boolean isImpressum() {
return impressum;
}
public void setImpressum(boolean impressum) {
this.impressum = impressum;
}
public boolean isSearch() {
return search;
}
public void setSearch(boolean search) {
this.search = search;
}
}
<ul> <ul>
#if($r.available("topnav.impressum"))
<li>
$r.render("topnav.impressum")
</li>
#end
<li id="o_topnav_langchooser"> <li id="o_topnav_langchooser">
$r.render("languageChooser") $r.render("languageChooser")
</li> </li>
......
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