use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class EPArtefactViewController method createLinkToArtefactSource.
private String createLinkToArtefactSource(UserRequest ureq, String businessPath) {
BusinessControlFactory bCF = BusinessControlFactory.getInstance();
List<ContextEntry> ceList = bCF.createCEListFromString(businessPath);
boolean valid = (ceList.size() > 0) && NewControllerFactory.getInstance().validateCEWithContextControllerCreator(ureq, getWindowControl(), ceList.get(0));
String busLink = bCF.getAsURIString(ceList, true);
if (valid && StringHelper.containsNonWhitespace(busLink)) {
return "<a href=\"" + busLink + "\">" + translate("artefact.open.source") + "</a>";
} else
return translate("artefact.no.source");
}
use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class OverviewAuthoringController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty()) {
if (currentCtrl == null) {
if (isGuestOnly) {
doOpenMyEntries(ureq);
segmentView.select(myEntriesLink);
} else {
boolean markEmpty = doOpenMark(ureq).isEmpty();
if (markEmpty) {
doOpenMyEntries(ureq);
segmentView.select(myEntriesLink);
} else {
segmentView.select(favoriteLink);
}
}
}
if (favoritDirty && markedCtrl != null) {
markedCtrl.reloadRows();
} else if (markedCtrl != null) {
markedCtrl.reloadDirtyRows();
}
if (myDirty && myEntriesCtrl != null) {
myEntriesCtrl.reloadRows();
} else if (myEntriesCtrl != null) {
myEntriesCtrl.reloadDirtyRows();
}
addToHistory(ureq, currentCtrl);
} else {
ContextEntry entry = entries.get(0);
String segment = entry.getOLATResourceable().getResourceableTypeName();
List<ContextEntry> subEntries = entries.subList(1, entries.size());
if ("Favorits".equals(segment)) {
if (isGuestOnly) {
doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(myEntriesLink);
} else {
doOpenMark(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(favoriteLink);
}
} else if ("My".equals(segment)) {
doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(myEntriesLink);
} else if ("Search".equals(segment)) {
doSearchEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(searchLink);
} else if ("Deleted".equals(segment)) {
doOpenDeletedEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(deletedLink);
} else {
doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(myEntriesLink);
}
}
}
use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class PaypalTransactionsController method addSearchToHistory.
protected void addSearchToHistory(UserRequest ureq) {
String transactionId = tableEl.getQuickSearchString();
StateMapped state = new StateMapped();
if (StringHelper.containsNonWhitespace(transactionId)) {
state.getDelegate().put("transactionId", transactionId);
}
ContextEntry currentEntry = getWindowControl().getBusinessControl().getCurrentContextEntry();
if (currentEntry != null) {
currentEntry.setTransientState(state);
}
addToHistory(ureq, getWindowControl());
}
use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class ValidatingVisitor method handleBusinessPath.
public Command handleBusinessPath(UserRequest ureq) {
HistoryPoint p = ureq.getUserSession().getLastHistoryPoint();
if (p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) {
StringBuilder sb = new StringBuilder();
List<ContextEntry> ces = p.getEntries();
String url = BusinessControlFactory.getInstance().getAsURIString(ces, true);
sb.append("try { o_info.businessPath='").append(url).append("';");
// Add analytics code
if (analyticsSPI != null) {
String serverUri = Settings.getServerContextPathURI();
if (url != null && url.startsWith(serverUri)) {
analyticsSPI.analyticsCountPageJavaScript(sb, getTitle(), url.substring(serverUri.length()));
}
}
sb.append(" } catch(e) { }");
return new JSCommand(sb.toString());
}
return null;
}
use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class AjaxController method appendBusinessPathInfos.
private void appendBusinessPathInfos(UserRequest ureq, Writer writer) throws IOException {
ChiefController ctrl = wboImpl.getChiefController();
String documentTitle = ctrl == null ? "" : ctrl.getWindow().getTitle();
writer.append(",\"documentTitle\":").append(JSONObject.quote(documentTitle));
StringBuilder bc = new StringBuilder(128);
HistoryPoint p = ureq.getUserSession().getLastHistoryPoint();
if (p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) {
List<ContextEntry> ces = p.getEntries();
String uriPrefix = wboImpl.getWindow().getUriPrefix();
bc.append(uriPrefix).append(BusinessControlFactory.getInstance().getAsRestPart(ces, true));
writer.append(",\"businessPath\":").append(JSONObject.quote(bc.toString()));
writer.append(",\"historyPointId\":").append(JSONObject.quote(p.getUuid()));
}
}
Aggregations