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

OO-1645: the internal links must close the callout window after being clicked,...

OO-1645: the internal links must close the callout window after being clicked, fix order for the CalendarKey
parent b8914522
No related branches found
No related tags found
No related merge requests found
......@@ -43,8 +43,10 @@ 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.media.RedirectMediaResource;
import org.olat.core.gui.util.CSSHelper;
import org.olat.core.helpers.Settings;
import org.olat.core.util.CodeHelper;
import org.olat.core.util.StringHelper;
import org.olat.core.util.Util;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -61,6 +63,7 @@ public class CalendarDetailsController extends BasicController {
private final KalendarRenderWrapper calendar;
private Link editButton;
private final VelocityContainer mainVC;
private final boolean isGuestOnly;
......@@ -73,7 +76,7 @@ public class CalendarDetailsController extends BasicController {
this.calEvent = event;
this.calendar = calendar;
isGuestOnly = ureq.getUserSession().getRoles().isGuestOnly();
VelocityContainer mainVC = createVelocityContainer("event_details");
mainVC = createVelocityContainer("event_details");
if(!isGuestOnly
&& !(calendarModule.isManagedCalendars() && CalendarManagedFlag.isManaged(event, CalendarManagedFlag.all))
......@@ -149,7 +152,16 @@ public class CalendarDetailsController extends BasicController {
wrapper.setIntern(false);
} else {
wrapper.setIntern(true);
}
}
if(wrapper.isIntern()) {
Link ooLink = LinkFactory.createLink("link-intern-" + CodeHelper.getRAMUniqueID(), "intern.link", getTranslator(), mainVC, this, Link.NONTRANSLATED);
ooLink.setCustomDisplayText(StringHelper.escapeHtml(link.getDisplayName()));
ooLink.setUserObject(wrapper);
if(StringHelper.containsNonWhitespace(wrapper.getCssClass())) {
ooLink.setIconLeftCSS("o_icon ".concat(wrapper.getCssClass()));
}
wrapper.setLink(ooLink);
}
linkWrappers.add(wrapper);
}
}
......@@ -167,6 +179,14 @@ public class CalendarDetailsController extends BasicController {
if(!isGuestOnly) {
fireEvent(ureq, new CalendarGUIEditEvent(calEvent, calendar));
}
} else if(source instanceof Link) {
Link internalLink = (Link)source;
if(internalLink.getUserObject() instanceof LinkWrapper) {
fireEvent(ureq, Event.DONE_EVENT);
LinkWrapper wrapper = (LinkWrapper)internalLink.getUserObject();
ureq.getDispatchResult()
.setResultingMediaResource(new RedirectMediaResource(wrapper.getUri()));
}
}
}
......@@ -177,6 +197,7 @@ public class CalendarDetailsController extends BasicController {
private String title;
private String cssClass;
private String displayName;
private Link link;
public boolean isIntern() {
return intern;
......@@ -217,5 +238,13 @@ public class CalendarDetailsController extends BasicController {
public void setCssClass(String cssClass) {
this.cssClass = cssClass;
}
public Link getLink() {
return link;
}
public void setLink(Link link) {
this.link = link;
}
}
}
\ No newline at end of file
......@@ -354,6 +354,8 @@ public class WeeklyCalendarController extends FormBasicController implements Act
CalendarGUIEditEvent editEvent = (CalendarGUIEditEvent)event;
pushEditEventController(ureq, editEvent.getKalendarEvent(), editEvent.getKalendarRenderWrapper());
} else if(event == Event.DONE_EVENT) {
eventCalloutCtr.deactivate();
}
} else if(source == printCtrl) {
if (event instanceof CalendarGUIPrintEvent) {
......
......@@ -14,7 +14,7 @@
<div class="o_cal_links">
#foreach($link in $links)
#if($link.intern)
<a href="javascript:top.o_openUriInMainWindow('$link.uri')" title="$link.title"><i class="o_icon $link.cssClass"> </i> $r.escapeHtml($link.displayName)</a>
$r.render(${link.getLink().getComponentName()})
#else
<a href="$link.uri" title="$link.title" class="$link.cssClass" target="_blank">$r.escapeHtml($link.displayName)</a>
#end
......
......@@ -93,7 +93,7 @@ public class HomeCalendarManager implements PersonalCalendarManager {
Map<CalendarKey,CalendarUserConfiguration> configMap = calendarManager.getCalendarUserConfigurationsMap(identity);
//personal calendar
CalendarKey personalCalendarKey = new CalendarKey(CalendarManager.TYPE_USER, identity.getName());
CalendarKey personalCalendarKey = new CalendarKey(identity.getName(), CalendarManager.TYPE_USER);
CalendarUserConfiguration personalCalendarConfig = configMap.get(personalCalendarKey);
if(calendarModule.isEnablePersonalCalendar()
&& (personalCalendarConfig == null || personalCalendarConfig.isInAggregatedFeed())) {
......@@ -114,7 +114,7 @@ public class HomeCalendarManager implements PersonalCalendarManager {
List<BusinessGroup> groups = businessGroupService.findBusinessGroups(groupParams, null, 0, -1);
for(BusinessGroup group:groups) {
String calendarId = group.getKey().toString();
CalendarKey key = new CalendarKey(CalendarManager.TYPE_GROUP, calendarId);
CalendarKey key = new CalendarKey(calendarId, CalendarManager.TYPE_GROUP);
CalendarUserConfiguration calendarConfig = configMap.get(key);
if(calendarConfig == null || calendarConfig.isInAggregatedFeed()) {
File iCalFile = calendarManager.getCalendarICalFile(CalendarManager.TYPE_GROUP, calendarId);
......@@ -130,7 +130,7 @@ public class HomeCalendarManager implements PersonalCalendarManager {
for(Object[] resource:resources) {
RepositoryEntry courseEntry = (RepositoryEntry)resource[0];
String calendarId = courseEntry.getOlatResource().getResourceableId().toString();
CalendarKey key = new CalendarKey(CalendarManager.TYPE_COURSE, calendarId);
CalendarKey key = new CalendarKey(calendarId, CalendarManager.TYPE_COURSE);
CalendarUserConfiguration calendarConfig = configMap.get(key);
if(calendarConfig == null || calendarConfig.isInAggregatedFeed()) {
File iCalFile = calendarManager.getCalendarICalFile(CalendarManager.TYPE_COURSE, calendarId);
......
......@@ -818,20 +818,6 @@ function gotonode(nodeid) {
}
}
function o_openUriInMainWindow(uri) {
if(!o2cl()) return false;
// get the "olatmain" window
try {
var w = o_getMainWin();
w.focus();
w.location.replace(uri);
} catch (e) {
showMessageBox("error", "Error", "Can not find main OpenOLAT window to open URL.");
}
}
function o_viewportHeight() {
// based on prototype library
var prototypeViewPortHeight = jQuery(document).height()
......@@ -1759,7 +1745,7 @@ function b_hideExtMessageBox() {
var BDebugger = {
_lastDOMCount : 0,
_lastObjCount : 0,
_knownGlobalOLATObjects : ["o_afterserver","o_onc","o_getMainWin","o_ainvoke","o_info","o_beforeserver","o_ffEvent","o_openPopUp","o_debu_show","o_logwarn","o_dbg_unmark","o_ffRegisterSubmit","o_clearConsole","o_init","o_log","o_allowNextClick","o_dbg_mark","o_debu_hide","o_logerr","o_debu_oldcn","o_debu_oldtt","o_openUriInMainWindow","o_debug_trid","o_log_all"],
_knownGlobalOLATObjects : ["o_afterserver","o_onc","o_getMainWin","o_ainvoke","o_info","o_beforeserver","o_ffEvent","o_openPopUp","o_debu_show","o_logwarn","o_dbg_unmark","o_ffRegisterSubmit","o_clearConsole","o_init","o_log","o_allowNextClick","o_dbg_mark","o_debu_hide","o_logerr","o_debu_oldcn","o_debu_oldtt","o_debug_trid","o_log_all"],
_countDOMElements : function() {
return document.getElementsByTagName('*').length;
......
This diff is collapsed.
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