";
return initHtml;
}
/**
* Report an error to the user
* @param text Basic error text
* @param exception Exception or null
* @param solution Text for solution or null
* @returns
*/
function reportErrorForUser(text, exception, solution, addStacktrace) {
var stacktrace = null;
if (addStacktrace) {
stacktrace = new Error();
}
setTimeout(function() {
var message = text;
var details = "";
if (exception != null) {
details += "\n\nSystem error message: \"" + exception + "\"";
}
if (solution != null) {
details += "\n\n" + solution;
}
if (stacktrace != null) {
details += "\n\nError details:\n" + stacktrace.stack;
}
if (typeof java != UNDEFINED) {
java.reportError(message, details);
} else {
console.log(message + details);
alert(message + details);
}
}, 0);
}
/**
* Inform user about failure to load content
*/
function reportLoadFailedForUser(text, exception, solution, addStacktrace) {
var stacktrace = null;
if (addStacktrace) {
stacktrace = new Error();
}
setTimeout(function() {
var stacktraceText = null;
if (stacktrace != null) {
stacktraceText = stacktrace.stack;
}
applyLoadFailedForUser(text, exception, solution, stacktraceText);
}, 0);
}
/**
* private
*
* Show information message to user
*/
function applyLoadFailedForUser(text, exception, solution, stacktraceText) {
var dialog = $(".appErrorInfoDialog");
if (dialog == null || dialog.length == 0) {
var html = "
";
// Title Bar
html += "
"+ L_ERROR_LOAD_CONTENT +"
";
// Infotext
html += "
"+ L_ERROR_LOAD_CONTENT_INFO +"
";
// Errormessage
html += "
";
// Options
html += "
";
// Reload Page
html += "";
html += "
";
// Main
html += "
";
$("body").append(html);
}
var errorText = L_ERROR + ": ";
if (text != null) {
errorText += text;
errorText += " | ";
}
if (exception != null) {
errorText += exception;
}
if (stacktraceText != null) {
errorText += " | Callstack: ";
errorText += stacktraceText;
}
var messageElem = $(".appErrorInfoDialogErrormessage");
messageElem.text(errorText);
}
/* ____ User Rights ____ */
var USER_WRITE_TYPE = true;
/* _______ JS-Variables ________ */
var PAGE_HEADER_VISIBLE = true;
var _DECIMAL_SEPARATOR = ".";
var _GROUPS_SEPARATOR = ",";
var _TIME_SEPARATOR = ":";
-->
/root/.innolist/tasks.apl
This is a Task List
";
// Infotext
html += "
";
html += "
"+ L_COPY_INFOTEXT +"";
showInfoDialogWithHtml(L_COPY_TITLE, html, 600);
}
/**
* Post content of form, using ajax
*/
function storeFormWithAjax(element, targetUrl, typeName, id, fieldName) {
// Store before save
var onclickStoreValues = "storeValues(" + attributeNamesForCall(fieldName) + "); ";
eval(onclickStoreValues);
var form = getParentElement(element, "form");
var contentUrl = SERVLET_PATH + "content?key=form_field_value&"+CONST_TYPE_NAME+"="+ typeName +"&"+CONST_ID_NAME+"="+id+"&attributes=" + fieldName;
var selector = ".details_value[name='"+fieldName+"']";
if (isRichClientRunning()) {
// JavaFx
var formData = getFormData(form);
java.storePostData(formData);
java.store(targetUrl);
} else {
// Browser
var formData = getFormData(form, true);
$.ajax({
type: "POST",
url: targetUrl,
async: false,
data: formData,
success: function(ajaxResponse){
// Only if async
},
error: function(request, textStatus, errorThrown){
reportErrorForUser("Failed to store value(s)\nUrl:" + targetUrl, errorThrown, null, true);
}
});
}
// Apply new content
applyXmlContent(contentUrl, selector, false);
}
/**
* Post content of some fields, using ajax
* (untested)
*/
function postFieldsUsingAjax(key, fieldnames) {
var valuesArr = new Array();
for(var i=0; i
0);
if (position == "top_right") {
left += width;
} else if (position == "top_behind") {
left += offsetLeft;
left += width;
top += height;
} else if (position == "center_right") {
left += width;
top += 8;
} else if (position == "bottom") {
top += height;
} else if (position == "bottom_left") {
top += height;
top += 3;
left -= floatWidth;
left -= 2;
left += width;
} else if (position == "bottom_center") {
top += height;
top += 3;
left -= (floatWidth / 2);
left += (width / 2);
}
left += offsetX;
top += offsetY;
// Respect scrolling of current scroll area (containing the element)
if (applyTopScrolling) {
top += parentScrolltop;
}
var visibleEndY = fullScroll.top + viewportHeight;
// log("");
// log("================");
// log("Frame: scrollHeight (div)= " + scrollHeight + ", viewportHeight (browser window content)= " + viewportHeight + ", parentScrolltop (div)= " + parentScrolltop);
// log(" Position in Page (Element clicked): positionTop=" + positionTop + "; positionLeft=" + positionLeft);
//
// log(" Float: floatHeight= " + floatHeight + ", id=" + floatId);
//
// log(" Element Offsets: offsetTop=" + offsetTop + ", offsetLeft=" + offsetLeft);
// log(" Offsets Configured: offsetY=" + offsetY);
//
// log(" Calculated 1: top=" + top + " left=" + left + ", floatHeight=" + floatHeight);
// log(" Scrolling Full: top=" + fullScroll.top + ", left=" + fullScroll.left);
var inContentFrame = (currentElement.closest("#content_frame").length > 0);
if (inContentFrame) {
// Handle Scrolling in Content Area
// Substract scrolling from top
top = (top - fullScrollTop);
visibleEndY = (visibleEndY - fullScrollTop);
//log(" Apply Scrolling: fullScrollTop=" + fullScrollTop);
}
//log(" Page: inContentFrame= " + inContentFrame);
var targetBottomY = (top + floatHeight);
var differenceTargetToVisible = (targetBottomY - visibleEndY);
//log(" Target: targetBottomY=" + targetBottomY + ", visibleEndY=" + visibleEndY);
//log(" Target: left=" + left);
if (left < 0) {
// Show in visible area
left = 10;
}
if (differenceTargetToVisible > 0) {
// Float not shown completely: Move float up
var topTargetPos = (top - differenceTargetToVisible);
// Move up
topTargetPos -= 35;
if (topTargetPos > 0) {
top = topTargetPos;
//log(" * Position corrected to make float visible: " + topTargetPos + ", differenceTargetToVisible= " + differenceTargetToVisible);
}
}
//log(" Show: useScrollCorrection=" + useScrollCorrection + ", fullScrollTop=" + fullScrollTop);
//log(" Show: top=" + top + ", left=" + left + "; floatId=" + floatId);
// top: distance to upper end of current scroll area
floatElem.css("top", top);
if (leftPositionNotAvailable) {
var floatLeftPos = -floatWidth;
floatLeftPos += width;
floatElem.css("left", floatLeftPos);
} else {
// left: distance to left end of current scroll area
floatElem.css("left", left);
}
floatElem.css("visibility", "visible");
}
function showContent(contentId) {
var content = $("#"+contentId);
content.css("display", "block");
}
function showFloat(current, floatId, offsetY, offsetX, position, keepOtherFloats) {
floatsShown[floatId] = false;
toggleFloat(current, floatId, offsetY, offsetX, position, keepOtherFloats);
}
/**
* Hide float by id
*/
function hideFloat(floatId) {
var floatElem = $("#" + floatId);
floatsShown[floatId] = false;
floatElem.css("visibility", "hidden");
floatElem.css("left", "-1000px");
}
/**
* Hide float element
* @param element The current element
* @param classname Class to reach the "control" (depends on context)
*/
function hideFloatElement(element, classname) {
var control = element.closest("." + classname);
var floatElem = control.find(C_FLOAT_SELECTOR);
var floatId = floatElem.attr("id");
floatsShown[floatId] = false;
floatElem.css("visibility", "hidden");
floatElem.css("left", "-1000px");
}
function hideAllFloats() {
for(var key in floatsShown) {
var shown = floatsShown[key];
if (shown != null && shown)
hideFloat(key);
}
}
/**
* Hide all floats of this classname
*/
function hideFloatsOfClass(classname) {
var found = $("." + classname);
for(var i=0; i -1)
return;
if (classStr != null && classStr.indexOf(DO_NOT_CLOSE_FLYOUT_ON_CLICK) > -1)
return;
parent = $(parent).parent();
if (parent == null || parent.length == 0)
break;
}
hideAllFloats();
});
/* ________________ Toolbar _________________ */
function toolbarUpdateSelection() {
var count = getSelectionRowCount(null);
var item = $("#_view_selection_item");
var textDiv = $(item.find("div")[0]);
textDiv.html(L_ITEMS_SELECTED + ": " + count + " " + L_OF + " " + NUMBER_OF_ITEMS);
}
/**
* Store flag to reopen the toolbar appearance options
*/
function toolbarStayOpened() {
setSessionValue("toolbarAppearance", "true");
}
/**
* Day/Time was selected for Calendar/Timeline
*/
function toolbarApplyDayAndTimeSelection(element) {
var selectionArea = element.closest(".icon_container_appearance_settings");
var applyTemplate = selectionArea.attr("apply_template");
var day = selectionArea.find("#_toolbar_appearance_calendar_day_attribute").val();
var time = selectionArea.find("#_toolbar_appearance_calendar_time_attribute").val();
applyTemplate = applyTemplate.replace("__DAY__", day);
applyTemplate = applyTemplate.replace("__TIME__", time);
eval(applyTemplate);
}
/**
* Variant was selected for Calendar
*/
function toolbarApplyCalendarVariantSelection(element) {
var buttonGroup = element.closest(".radio_button_group");
var inputValue = $(element).attr("value");
var command = buttonGroup.attr("command");
command = command.replace("__VARIANT__", inputValue);
newlocation(command);
}
$(".button_inverse").mouseenter(function() {
var button = $(this);
var inverseImage = button.attr("button_inverse");
var img = button.find("img");
if (img.length == 1) {
img.attr("src", inverseImage);
} else {
button.css("background-image", "url('" + inverseImage + "')");
}
});
$(".button_inverse").mouseleave(function() {
var button = $(this);
var defaultImage = button.attr("button_img");
var img = button.find("img");
if (img.length == 1) {
img.attr("src", defaultImage);
} else {
button.css("background-image", "url('" + defaultImage + "')");
}
});
-->