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

OO-1068: fix callout

parent 6b8125cf
No related branches found
No related tags found
No related merge requests found
Showing
with 88 additions and 159 deletions
......@@ -213,16 +213,16 @@ public class FolderComponentRenderer extends DefaultComponentRenderer {
if (canWrite || canDelete || canMail) {
target.append("<div class=\"b_togglecheck\">");
target.append("<a href=\"#\" onclick=\"javascript:b_briefcase_toggleCheck('").append(formName).append("', true)\">");
target.append("<div class=\"o_table_checkall input-sm\">");
target.append("<label class='checkbox-inline'><a href=\"#\" onclick=\"javascript:b_briefcase_toggleCheck('").append(formName).append("', true)\">");
target.append("<input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\" />");
target.append(translator.translate("checkall"));
target.append("</a> <a href=\"#\" onclick=\"javascript:b_briefcase_toggleCheck('").append(formName).append("', false)\">");
target.append("</a></label> <label class='checkbox-inline'><a href=\"#\" onclick=\"javascript:b_briefcase_toggleCheck('").append(formName).append("', false)\">");
target.append("<input type=\"checkbox\" disabled=\"disabled\" />");
target.append(translator.translate("uncheckall"));
target.append("</a></div>");
target.append("</a></label></div>");
target.append("<div class=\"b_briefcase_commandbuttons btn-group\">");
target.append("<div class='o_table_buttons'>");
if(canMail) {
target.append("<input type=\"submit\" class='btn btn-default' name=\"");
......
......@@ -88,7 +88,7 @@ public class CSSIconFlexiCellRenderer implements FlexiCellRenderer {
@Override
public void render(StringOutput target, Object cellValue, int row, FlexiTableComponent source,
URLBuilder ubu, Translator translator) {
target.append("<span class=\"b_small_icon ");
target.append("<span class=\"o_icon ");
target.append(getCssClass(cellValue));
String hoverText = getHoverText(cellValue, translator);
if (StringHelper.containsNonWhitespace(hoverText)) {
......
......@@ -30,8 +30,6 @@ 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.gui.control.controller.BasicController;
import org.olat.core.gui.control.winmgr.Command;
import org.olat.core.gui.control.winmgr.JSCommand;
import org.olat.core.logging.OLATRuntimeException;
/**
......@@ -56,12 +54,10 @@ import org.olat.core.logging.OLATRuntimeException;
* @author gnaegi
*/
public class CloseableCalloutWindowController extends BasicController {
public static final Event CLOSE_WINDOW_EVENT = new Event(
"CLOSE_WINDOW_EVENT");
public static final Event CLOSE_WINDOW_EVENT = new Event("CLOSE_WINDOW_EVENT");
private VelocityContainer calloutVC;
private CloseableModalController cmc;
private boolean requiresJSCleanup = false;
/**
* Constructor for a closable callout window controller. After calling the
......@@ -106,7 +102,6 @@ public class CloseableCalloutWindowController extends BasicController {
String escapedTitle = StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(title));
calloutVC.contextPut("title", escapedTitle);
}
putInitialPanel(calloutVC);
} else {
// Fallback to old-school modal dialog
......@@ -235,9 +230,6 @@ public class CloseableCalloutWindowController extends BasicController {
cmc.dispose();
cmc = null;
}
if (requiresJSCleanup) {
cleanupJSCode();
}
}
/**
......@@ -274,7 +266,6 @@ public class CloseableCalloutWindowController extends BasicController {
} else {
// push to modal stack
getWindowControl().pushAsCallout(calloutVC, getDOMTarget());
requiresJSCleanup = true;
}
}
......@@ -287,24 +278,8 @@ public class CloseableCalloutWindowController extends BasicController {
// Delegate if in non-ajax mode to modal window
cmc.deactivate();
} else {
cleanupJSCode();
// Remove component from stack
getWindowControl().pop();
}
}
/**
* Cleanup the window and JS code on the browser side
*/
private void cleanupJSCode() {
// Cleanup any resources on the browser/DOM side
StringBuilder sb = new StringBuilder();
sb.append("jQuery(jQuery('#").append(getDOMTarget()).append("').each(function(index, el) {")
.append(" try { jQuery(el).tooltip('destroy'); } catch(e) {}")
.append("}));");
// JS command is sent via OLAT AJAX channel
Command command = new JSCommand(sb.toString());
getWindowControl().getWindowBackOffice().sendCommandTo(command);
requiresJSCleanup = false;
}
}
\ No newline at end of file
<div id="callout_layer_$r.getCId()" class="b_callout_content">
<div id="callout_layer_$r.getCId()" class="o_callout_content">
<div id="callout_layer_content_$r.getCId()">
$r.render("calloutWindowContent")
</div>
......@@ -8,7 +8,7 @@
/* <![CDATA[ */
jQuery(function() {
jQuery('#callout_layer_$r.getCId()').each(function(index, el) {
jQuery(el).parents('div.b_callout_area').next('div.b_callout_overlay').each(function(index2, el2) {
jQuery(el).parents('div.popover').next('div.o_callout_overlay').each(function(index2, el2) {
jQuery(el2).click(function() {if (o2cl()) {
$r.javaScriptBgCommand('close');
}});
......
......@@ -4,20 +4,17 @@
<iframe class="b_modal_iebug" src="$r.staticLink("empty.html")" style="position:absolute; left:0; top:0; width:100%; height:100%; border:none; z-index: $zindexshim; opacity:0; filter: alpha(opacity:0);" ></iframe>
<![endif]-->
## 2)
<div id="b_callout_$r.getCId()" class="popover in bottom" style="z-index:$zindexarea;">
<div id="callout_$r.getCId()" class="popover in bottom" style="z-index:$zindexarea;">
<div class="arrow"></div>
<div class="popover-content">
$r.render("guimsgplace")
$r.render("cont")
</div>
<div class="popover-content">$r.render("cont")</div>
</div>
## 3)
<div id="b_callout_overlay_$r.getCId()" class="b_callout_overlay" style="z-index:$zindexoverlay;"></div>
<div id="callout_overlay_$r.getCId()" class="o_callout_overlay" style="z-index:$zindexoverlay;"></div>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(function() {
jQuery('#b_callout_$r.getCId()').each(function(index, el) {
var targetEl = jQuery('#o_c$guimsgtarget');
jQuery('#callout_$r.getCId()').each(function(index, el) {
var targetEl = jQuery('#$guimsgtarget,#o_c$guimsgtarget');
var targetOffset = targetEl.offset();
if(targetOffset) {
var callout = jQuery(el);
......@@ -26,17 +23,11 @@ jQuery(function() {
top: (targetOffset.top + targetEl.height() + 15) ,
left: (targetOffset.left)
});
/*jQuery('.b_callout', el).each(function(indexb, elb) {
jQuery(elb).prepend("<div class='b_callout_top_left_arrow'></div><div class='b_callout_top_left_arrow-border'></div>");
});*/
} else {
callout.offset({
top: (targetOffset.top + targetEl.height() + 15) ,
left: (targetOffset.left + targetEl.width()) - callout.width()
});
/*jQuery('.b_callout', el).each(function(indexb, elb) {
jQuery(elb).prepend("<div class='b_callout_top_right_arrow'></div><div class='b_callout_top_right_arrow-border'></div>");
});*/
}
callout.css('display','block').css('zindex', o_info.zseed + 5);
}
......
......@@ -31,6 +31,7 @@ import java.util.Map;
import java.util.Set;
import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.services.mark.Mark;
import org.olat.core.gui.ShortName;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
......@@ -155,10 +156,10 @@ public class MailListController extends BasicController implements Activateable2
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor(Columns.sendDate.i18nKey(), Columns.sendDate.ordinal(), null, getLocale()));
} else {
//read / marked / context / from / subject / receivedDate
CustomCellRenderer readRenderer = new BooleanCSSCellRenderer(getTranslator(), "b_mail_read", "b_mail_unread", "mail.read", "mail.unread");
CustomCellRenderer readRenderer = new BooleanCSSCellRenderer(getTranslator(), "o_icon o_icon_read", "o_icon o_icon_to_read", "mail.read", "mail.unread");
tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor(Columns.read.i18nKey(), Columns.read.ordinal(), CMD_READ_TOGGLE,
getLocale(), ColumnDescriptor.ALIGNMENT_CENTER, readRenderer));
CustomCellRenderer markRenderer = new BooleanCSSCellRenderer(getTranslator(), "b_mail_marked", "b_mail_unmarked", "mail.marked", "mail.unmarked");
CustomCellRenderer markRenderer = new BooleanCSSCellRenderer(getTranslator(), Mark.MARK_CSS_LARGE, Mark.MARK_ADD_CSS_LARGE, "mail.marked", "mail.unmarked");
tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor(Columns.marked.i18nKey(), Columns.marked.ordinal(), CMD_MARK_TOGGLE,
getLocale(), ColumnDescriptor.ALIGNMENT_CENTER, markRenderer));
tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor(Columns.context.i18nKey(), Columns.context.ordinal(), null,
......
<br/>
<div class="b_clearfix">
<div class="b_c40l">
<div class="col-md-6">
<div class="b_subcl">
$r.render("left_1")
$r.render("button_layout")
</div>
</div>
<div class="b_c60r b_labels_minified">
<div class="col-md-6 b_labels_minified">
<div class="b_subcr">
$r.render("right_1")
</div>
......
<div class="b_clearfix">
<div class="b_c40l">
<div class="col-md-6">
<div class="b_subcl">
$r.render("left_1")
$r.render("button_layout")
</div>
</div>
<div class="b_c60r">
<div class="col-md-6">
<div class="b_subcr">
$r.render("right_1")
</div>
......
......@@ -112,8 +112,8 @@ public abstract class AbstractItemListController extends FormBasicController
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.editable.i18nKey(), Cols.editable.ordinal(),
false, null, FlexiColumnModel.ALIGNMENT_LEFT,
new BooleanCellRenderer(
new CSSIconFlexiCellRenderer("o_readwrite"),
new CSSIconFlexiCellRenderer("o_readonly"))
new CSSIconFlexiCellRenderer("o_icon_readwrite"),
new CSSIconFlexiCellRenderer("o_icon_readonly"))
));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.key.i18nKey(), Cols.key.ordinal(), true, "key"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.identifier.i18nKey(), Cols.identifier.ordinal(), true, "identifier"));
......
......@@ -104,10 +104,12 @@ public class EPMultiplePageController extends BasicController implements Activat
// create toc link
tocLink = LinkFactory.createLink("toc", vC, this);
tocLink.setDomReplacementWrapperRequired(false);
tocLink.setUserObject(PAGENUM_TOC);
// create changelog link
changelogLink = LinkFactory.createLink("changelog", vC, this);
changelogLink.setDomReplacementWrapperRequired(false);
changelogLink.setUserObject(PAGENUM_CL);
int i = 1;
......@@ -118,6 +120,7 @@ public class EPMultiplePageController extends BasicController implements Activat
String shortPageTitle = Formatter.truncate(pageTitle, 20);
Link pageLink = LinkFactory
.createCustomLink("pageLink" + i, "pageLink" + i, shortPageTitle, Link.LINK + Link.NONTRANSLATED, vC, this);
pageLink.setDomReplacementWrapperRequired(false);
pageLink.setUserObject(i - 1);
pageLink.setTooltip(pageTitle);
pageLinkList.add(pageLink);
......@@ -177,15 +180,6 @@ public class EPMultiplePageController extends BasicController implements Activat
private void setCurrentPageAfterInit(int pageNum) {
vC.put("pageCtrl", currentActivePageCtrl.getInitialComponent());
vC.contextPut("actualPage", pageNum + 1);
// disable actual page itself
Link actLink = (Link) vC.getComponent("pageLink" + String.valueOf((pageNum + 1)));
if (actLink != null)
actLink.setEnabled(false);
// enable previous page
Link prevLink = (Link) vC.getComponent("pageLink" + String.valueOf((previousPage)));
if (prevLink != null)
prevLink.setEnabled(true);
previousPage = pageNum + 1;
}
......@@ -203,10 +197,9 @@ public class EPMultiplePageController extends BasicController implements Activat
} else {
tocPageCtrl.refreshTOC(ureq);
}
currentActivePageCtrl = tocPageCtrl;
// disable toc-link
disableLink_TOC(true);
disableLINK_LC(false);
disableLink_TOC(true);
currentActivePageCtrl = tocPageCtrl;
addToHistory(ureq, OresHelper.createOLATResourceableType("TOC"), null);
}
......@@ -257,13 +250,11 @@ public class EPMultiplePageController extends BasicController implements Activat
}
private void disableLink_TOC(boolean disable) {
tocLink.setEnabled(!disable);
vC.contextPut("toc_disabled", disable);
vC.contextPut("toc_enabled", disable);
}
private void disableLINK_LC(boolean disable) {
changelogLink.setEnabled(!disable);
vC.contextPut("changelog_disabled", disable);
vC.contextPut("changelog_enabled", disable);
}
@Override
......
<div class="b_pagination" >
<ul>
<li class="b_toc #if ($toc_disabled) b_disabled #end">$r.render("toc")</li>
#if ($pageLinkList)
<ul class="nav nav-tabs">
<li class="#if($toc_enabled) active #end">$r.render("toc")</li>
#if($pageLinkList)
#foreach($pageLink in $pageLinkList)
#set($viewLink = "pageLink$velocityCount")
#if ($velocityCount != $actualPage)<li>
#else <li class="b_disabled">
#end
$r.render($viewLink)</li>
<li class="#if ($velocityCount == $actualPage) active #end">$r.render($viewLink)</li>
#end
#end
<li class="b_changelog #if ($changelog_disabled) b_disabled #end">$r.render("changelog")</li>
</ul>
</div>
<div class="b_ep_actualpage">
$r.render("pageCtrl")
</div>
<div style="clear: both;"></div>
\ No newline at end of file
<li class="#if($changelog_enabled) active #end">$r.render("changelog")</li>
</ul>
<div class="b_ep_actualpage">$r.render("pageCtrl")</div>
<div class="clearfix"></div>
\ No newline at end of file
......@@ -8,13 +8,12 @@
$r.render("map.style") <br/>
<div class="b_subcolumns">
<div class="b_c33l o_ep_toc_editor"><div class="b_subcl">
<div class="col-md-4 o_ep_toc_editor"><div class="b_subcl">
$r.render("tocCtrl")
</div></div>
<div class="b_c66r o_ep_struct_editor"><div class="b_subcr">
<div class="col-md-8 o_ep_struct_editor"><div class="b_subcr">
$r.render("editCtrl")
</div></div>
</div>
</div>
\ No newline at end of file
......@@ -38,12 +38,9 @@ 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.components.form.flexible.impl.FormLayoutContainer;
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.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController;
import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController;
import org.olat.core.util.StringHelper;
import org.olat.resource.OLATResource;
......@@ -67,16 +64,14 @@ import org.olat.resource.accesscontrol.model.OfferImpl;
*/
public class AccessConfigurationController extends FormBasicController {
private List<Link> addMethods = new ArrayList<Link>();
private List<FormLink> addMethods = new ArrayList<FormLink>();
private final String displayName;
private final OLATResource resource;
private final AccessControlModule acModule;
private final ACService acService;
private FormLink createLink;
private FormLayoutContainer confControllerContainer;
private CloseableCalloutWindowController createCalloutCtrl;
private CloseableModalController cmc;
private FormLayoutContainer confControllerContainer;
private AbstractConfigurationMethodController newMethodCtrl;
private final List<AccessInfo> confControllers = new ArrayList<AccessInfo>();
......@@ -129,8 +124,21 @@ public class AccessConfigurationController extends FormBasicController {
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if(editable) {
createLink = uifactory.addFormLink("add.accesscontrol", formLayout, Link.BUTTON);
createLink.setElementCssClass("o_sel_accesscontrol_create");
List<AccessMethod> methods = acService.getAvailableMethods(getIdentity(), ureq.getUserSession().getRoles());
for(AccessMethod method:methods) {
AccessMethodHandler handler = acModule.getAccessMethodHandler(method.getType());
if(handler.isPaymentMethod() && !allowPaymentMethod) {
continue;
}
String title = handler.getMethodName(getLocale());
FormLink add = uifactory.addFormLink("create." + handler.getType(), title, null, formLayout, Link.LINK | Link.NONTRANSLATED);
add.setUserObject(method);
add.setCustomEnabledLinkCSS(("b_with_small_icon_left " + method.getMethodCssClass() + "_icon").intern());
addMethods.add(add);
formLayout.add(add.getName(), add);
}
((FormLayoutContainer)formLayout).contextPut("methods", addMethods);
}
String confPage = velocity_root + "/configuration_list.html";
......@@ -216,8 +224,6 @@ public class AccessConfigurationController extends FormBasicController {
if(addMethods.contains(source)) {
AccessMethod method = (AccessMethod)source.getUserObject();
addMethod(ureq, method);
} else if (source == createLink) {
popupCallout(ureq);
} else if (source.getName().startsWith("del_")) {
AccessInfo infos = (AccessInfo)source.getUserObject();
acService.deleteOffer(infos.getLink().getOffer());
......@@ -251,34 +257,6 @@ public class AccessConfigurationController extends FormBasicController {
acService.saveOfferAccess(links);
}
protected void popupCallout(UserRequest ureq) {
addMethods.clear();
VelocityContainer mapCreateVC = createVelocityContainer("createAccessCallout");
List<AccessMethod> methods = acService.getAvailableMethods(getIdentity(), ureq.getUserSession().getRoles());
for(AccessMethod method:methods) {
AccessMethodHandler handler = acModule.getAccessMethodHandler(method.getType());
if(handler.isPaymentMethod() && !allowPaymentMethod) {
continue;
}
Link add = LinkFactory.createLink("create." + handler.getType(), mapCreateVC, this);
add.setCustomDisplayText(handler.getMethodName(getLocale()));
add.setUserObject(method);
add.setCustomEnabledLinkCSS(("b_with_small_icon_left " + method.getMethodCssClass() + "_icon").intern());
addMethods.add(add);
mapCreateVC.put(add.getComponentName(), add);
}
mapCreateVC.contextPut("methods", addMethods);
String title = translate("add.accesscontrol");
removeAsListenerAndDispose(createCalloutCtrl);
createCalloutCtrl = new CloseableCalloutWindowController(ureq, getWindowControl(), mapCreateVC, createLink, title, true, null);
listenTo(createCalloutCtrl);
createCalloutCtrl.activate();
mainForm.setDirtyMarking(false);
}
protected void loadConfigurations() {
List<Offer> offers = acService.findOfferByResource(resource, true, null);
for(Offer offer:offers) {
......@@ -315,8 +293,6 @@ public class AccessConfigurationController extends FormBasicController {
}
protected void addMethod(UserRequest ureq, AccessMethod method) {
createCalloutCtrl.deactivate();
Offer offer = acService.createOffer(resource, displayName);
OfferAccess link = acService.createOfferAccess(offer, method);
......
<div class="b_form b_clearfix">
#if ($off_title) <fieldset><legend>$off_title</legend> #end
<fieldset class="o_form form-horizontal" role="form">
#if ($off_title) <legend>$off_title</legend> #end
#if ($off_chelp_package) $r.contextHelpWithWrapper("$off_chelp_package","$off_chelp_page","$off_chelp_hover") #end
#if ($off_desc) <div class="b_form_desc">$off_desc</div> #end
#if ($off_warn) <div class="b_warning">$off_warn</div> #end
#if ($off_info) <div class="b_info">$off_info</div> #end
<div class="row">
#if ($off_desc) <div class="o_desc">$off_desc</div> #end
#if ($off_warn) <div class="o_warning">$off_warn</div> #end
#if ($off_info) <div class="o_info">$off_info</div> #end
</div>
#if($r.available("add.accesscontrol"))
<div class="b_clearfix">
<div class="b_float_right">
$r.render("add.accesscontrol")
#if($methods)
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle o_sel_accesscontrol_create" data-toggle="dropdown">$r.translate("add.accesscontrol")<span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
#foreach($method in $methods)
<li>$r.render($method.component.componentName)</li>
#end
</ul>
</div>
</div>
#end
<div class="b_clearfix">
#end
<div class="clearfix">
$r.render("conf-controllers")
</div>
#if($r.available("buttonLayout"))
......@@ -22,6 +27,4 @@
</div>
</div>
#end
#if ($off_title) </fieldset> #end
</div>
\ No newline at end of file
</fieldset>
\ No newline at end of file
#if ($confControllers.size() > 0)
<table class="b_access_method">
<table class="o_table table">
<thead>
<tr>
<th>$r.translate("accesscontrol.table.method")</th>
......@@ -30,11 +30,11 @@
</table>
#else
#if ($emptyConfigGrantsFullAccess)
<div class="b_warning">
<div class="o_warning">
$r.translate("accesscontrol.no.methods.full.access")
</div>
#else
<div class="b_important">
<div class="o_important">
$r.translate("accesscontrol.no.methods.no.access")
</div>
#end
......
<div class="b_access_create">
<p>$r.translate("add.accesscontrol.intro")</p>
<ul>
#foreach($method in $methods)
<li>$r.render($method.componentName)</li>
#end
</ul>
</div>
......@@ -20,6 +20,7 @@
@import "modules/layout";
@import "modules/navbar";
@import "modules/main";
@import "modules/dialog";
@import "modules/footer";
@import "modules/tree";
......
div.o_callout_overlay {
position: fixed; top: 0; left: 0; width:100%; height:100%; zoom:1; background: #000; @include o-opacity(1);
}
\ No newline at end of file
......@@ -34,6 +34,9 @@ $fa-css-prefix: "o_icon" !default;
.o_icon_open_tree {@extend .o_icon-caret-right;}
.o_icon_preview {@extend .o_icon-eye;}
.o_icon_print {@extend .o_icon-print;}
.o_icon_read { @extend .o_icon-fighter-jet; color:green;}
.o_icon_readonly { @extend .o_icon-edit; color:red;}
.o_icon_readwrite { @extend .o_icon-edit; }
.o_icon_refresh { @extend .o_icon-refresh; }
.o_icon_search {@extend .o_icon-search;}
.o_icon_status_available { @extend .o_icon-circle; color: #006633; }
......@@ -41,6 +44,7 @@ $fa-css-prefix: "o_icon" !default;
.o_icon_status_dnd { @extend .o_icon-dot-circle-o; color: #CCCC33; }
.o_icon_status_unavailable { @extend .o_icon-times-circle-o; color: #996633; }
.o_icon_table {@extend .o_icon-table; }
.o_icon_to_read { @extend .o_icon-fighter-jet; color:blue;}
.o_icon_upload {@extend .o_icon-upload; }
......
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