Kürzel: g = Gestern h = Heute m = Morgen j = Jetzt: Wenn ein Zeitfeld verknüpft ist, wird dieses ebenfalls aktualisiert. u = Unbekannt: Fügt das in der Konfiguration hinterlegte Datum ein
ZAHL+/-=Heute +/- Anzahl Tage Shift+ZAHL+/-=Heute +/- Anzahl Monate Shift+Alt+ZAHL+/-=Heute +/- Anzahl Jahre
Pfeiltaste oben/unten=+/- 1 Tag Shift+Pfeiltaste oben/unten=+/- 1 Monat Shift+Alt+Pfeiltaste oben/unten=+/- 1 Jahr'.replace( / /g, '
' ).replace( / /g, '
' ).replace( / /g, '
' ) + '" ' + 'style="vertical-align: middle;margin-left: 4px;" ' + 'onclick="var oEleDate = $(\'#' + sID + '\');if(oEleDate.attr(\'disabled\') == undefined && oEleDate.attr(\'readonly\') == undefined){oEleDate.datepicker(\'show\');}" >';
$( sCalenderPicture ).insertAfter( ele );
var lMinWidth = ele.css( "min-width" );
if( lMinWidth == undefined || !lMinWidth || lMinWidth == "0px" ) {
ele.css( "min-width", 65 );
}
ele.width( ele.width() - 20 ).attr( "data-pickericon", "1" );
}
// thomas, 25.09.2014: Check for valid date.
ele.blur( function ()
{
validateDate( this );
} )
.change( function ()
{
validateDate( this );
} );
}
/**
* Use a central function to convert an edit field to time picker field.
* @param ele Text element to convert.
* @created thomas, 12.01.2017
*/
function frameworkTimePickerAddSymbol( ele )
{
ele = $( ele );
var sID = ele.attr( "id" );
if( ele.attr( "data-pickericon" ) == undefined ) {
// Adds a placeholder to the field.
/*if( ele.attr( "placeholder" ) == undefined ) {
ele.attr( "placeholder", "SS:MM" );
}*/
// Prevent line wrap after field before icon.
ele.wrap( '' );
//mvr,28.06.2016 Add Calendar Picture
var sPictureID = "tppic_" + sID;
var sCalenderPicture = ' Erlaubte Eingaben: SS SMM SSMM :MM S:M S:MM SS:MM S=Stunden, M=Minuten
";
}
if( sButtons != "" ) {
// Only create output if there is at least one button.
sButtons = "
" + sButtons + "
";
if( sContent != "" ) {
sContent += "";
}
sContent += sButtons;
}
}
if( sContent != "" ) {
// Only creates a dialog if there is at least one button.
frameworkRemoveDialog( "framework_menucontext" );
$( "
" )
.attr( "id", "framework_menucontext" )
.html( sContent )
.dialog({
width: 600,
height: 600,
modal: true,
buttons: {
"Schließen": function() {
$( this ).dialog( "close" );
}
},
close: function() { $( this ).dialog( "destroy" ); }
});
frameworkAddDialog( "framework_menucontext" );
}
}
/**
* Closes the menu context menu.
* @created thomas, 27.04.2016
*/
function frameworkMenuContextClose()
{
try {
$( "#framework_menucontext" ).dialog( "close" );
} catch( e ) {}
}
/**
* Handles a global key event (e.g. saving or printing the current module.
* @param sShortcut
* @returns
* @created thomas, 11.04.2016
*/
function frameworkHandleGlobalKeyEvent( sShortcut )
{
if( m_oFrameworkShortcutDialog != undefined && m_oFrameworkShortcutDialog.is( ":visible" ) ) {
// Currently the dialog to choose a module from previous key event is open. Close the dialog
// before calling the next event.
return false;
}
// If an element is focused the function searches the parent module to call its shortcut event handler.
var oFocused = $( document.activeElement );
var lModuleID, sModuleID_arr, bCallNextModule, sCode, i, j;
// Stop at body tag with grapping for the handler module.
while( oFocused.prop( "tagName" ).toLowerCase() != "body" ) {
// Search a module div.
if( oFocused.hasClass( "classIModuleDiv" ) || oFocused.hasClass( "classIModuleDivModal" ) ) {
sModuleID_arr = oFocused.attr( "id" ).split( "_" );
lModuleID = sModuleID_arr[ sModuleID_arr.length - 1 ];
// Module found. Check shortcut configuration.
bCallNextModule = true;
if( frameworkFunctionExists( "onHandleFrameworkShortcut" + sShortcut + "_" + lModuleID ) ) {
frameworkCallFunction( "onHandleFrameworkShortcut" + sShortcut + "_" + lModuleID );
// Shortcut handler executed.
return false;
}
// If the module is a dialog, stop here to prevent saving modules behind the dialog.
if( oFocused.attr( "id" ) == "modalDiv_" + lModuleID ) {
return true;
}
}
oFocused = oFocused.parent();
}
// No focus or handler routine found, so search in DOM tree.
frameworkModuleListUpdate();
// Search modal dialogs.
var lZIndex = 0;
var oDialogZIndex = false;
for( i = 1; i < oFrameworkRootModule.m_oChildModules_arr.length; i++ ) {
// Steps through all dialog modules to find a modal dialog.
lModuleID = oFrameworkRootModule.m_oChildModules_arr[ i ].m_lModuleID;
var oDialog = $( "#modalDiv_" + lModuleID );
// Do not handle hidden dialogs.
if( oDialog.is( ":visible" ) ) {
if( oDialog.dialog( "option", "modal" ) ) {
if( oDialog.zIndex() > lZIndex ) {
// The current dialog is in front of the other ones. So remember this one.
lZIndex = oDialog.zIndex();
oDialogZIndex = oFrameworkRootModule.m_oChildModules_arr[ i ];
}
}
}
}
var lTmp_arr;
var lNodes_arr = [];
if( oDialogZIndex !== false ) {
// Modal dialog found, so search modules to save inside the modal dialog.
if( frameworkFunctionExists( "onHandleFrameworkShortcut" + sShortcut + "_" + oDialogZIndex.m_lModuleID ) ) {
// The modal dialog has an own shortcut handler.
lNodes_arr.push( oDialogZIndex.m_lModuleID );
} else {
// Search shortcut handler functions in sub nodes.
for( i = 0; i < oDialogZIndex.m_oChildModules_arr.length; i++ ) {
lTmp_arr = frameworkSearchNodesForHandleGlobalKeyEvent( oDialogZIndex.m_oChildModules_arr[ i ], sShortcut );
for( j = 0; j < lTmp_arr.length; j++ ) {
lNodes_arr.push( lTmp_arr[ j ] );
}
}
}
} else {
// Search shortcut handler functions in sub nodes.
for( i = 0; i < oFrameworkRootModule.m_oChildModules_arr.length; i++ ) {
var lModuleID = oFrameworkRootModule.m_oChildModules_arr[ i ].m_lModuleID;
var oElement = $( "#DIV_MODULE_" + lModuleID );
if( oElement.is( ":visible" ) ) {
if( frameworkFunctionExists( "onHandleFrameworkShortcut" + sShortcut + "_" + lModuleID ) ) {
lNodes_arr.push( lModuleID );
} else {
lTmp_arr = frameworkSearchNodesForHandleGlobalKeyEvent( oFrameworkRootModule.m_oChildModules_arr[ i ], sShortcut );
for( j = 0; j < lTmp_arr.length; j++ ) {
lNodes_arr.push( lTmp_arr[ j ] );
}
}
}
}
}
if( lNodes_arr.length == 0 ) {
// Do nothing, use browser function.
return true;
} else if( lNodes_arr.length == 1 ) {
return frameworkExecHandleGlobalKeyEvent( lNodes_arr[ 0 ], sShortcut );
} else {
return frameworkShowDialogToHandleGlobalKeyEvent( lNodes_arr, sShortcut );
}
}
var m_oFrameworkShortcutDialog;
/**
* Opens a dialog to choose a module to call its shortcut handler.
* This function is called if there are several parallel modules which include a shortcut handler.
* @param lNodes_arr
* @param sShortcut
* @created thomas, 11.04.2016
*/
function frameworkShowDialogToHandleGlobalKeyEvent( lNodes_arr, sShortcut )
{
m_oFrameworkShortcutDialog = $( '' ).appendTo( $( "body" ) );
var sContent = '
Es wurden mehrere Module gefunden, für die die Tastenkombination registriert wurde. Wählen Sie das gewünschte Modul aus.
';
for( var i = 0;i < lNodes_arr.length;i++ ) {
var sTitle = $( "#DIV_MODULE_" + lNodes_arr[ i ] ).attr( 'data-imed-title' );
if( sTitle == undefined ) {
var oTitle_arr = $( "[aria-describedby='modalDiv_" + lNodes_arr[ i ] + "']" ).find( ".ui-dialog-title" );
if( oTitle_arr.length > 0 ) {
sTitle = $( oTitle_arr[ 0 ] ).text();
}
}
sContent += '
' + sTitle + '
';
}
sContent += "
";
m_oFrameworkShortcutDialog.html( sContent );
m_oFrameworkShortcutDialog.dialog({
modal: true,
buttons: {
"Abbrechen": function() {
$( this ).dialog( "close" );
}
},
close: function ()
{
$( this ).dialog( 'destroy' );
m_oFrameworkShortcutDialog.hide();
}
});
}
/**
* Executes the shortcut handler of a module.
* @param lModuleID
* @param sShortcut
* @returns
* @created thomas, 11.04.2016
*/
function frameworkExecHandleGlobalKeyEvent( lModuleID, sShortcut )
{
if( m_oFrameworkShortcutDialog != undefined && m_oFrameworkShortcutDialog.is( ":visible" ) ) {
m_oFrameworkShortcutDialog.dialog( "close" );
}
frameworkCallFunction( "onHandleFrameworkShortcut" + sShortcut + "_" + lModuleID );
return false;
}
/**
* Highlights a module from shortcut handler dialog.
* @param lModuleID
* @created thomas, 11.04.2016
*/
function frameworkShowModuleToHandleGlobalKeyEvent( lModuleID )
{
if( lModuleID == undefined ) {
$( ".shortcuthandler" ).removeClass( "shortcuthandler" );
} else {
$( "#DIV_MODULE_" + lModuleID ).addClass( "shortcuthandler" );
}
}
/**
* Searches shortcut handler functions inside DOM tree.
* @param oNode
* @param sShortcut
* @returns
* @created thomas, 11.04.2016
*/
function frameworkSearchNodesForHandleGlobalKeyEvent( oNode, sShortcut ) {
var lNodes_arr = [];
for( var i = 0; i < oNode.m_oChildModules_arr.length; i++ ) {
var lModuleID = oNode.m_oChildModules_arr[ i ].m_lModuleID;
var oElement = $( "#DIV_MODULE_" + lModuleID );
if( oElement.is( ":visible" ) ) {
if( frameworkFunctionExists( "onHandleFrameworkShortcut" + sShortcut + "_" + lModuleID ) ) {
lNodes_arr.push( lModuleID );
} else {
var lTmp_arr = frameworkSearchNodesForHandleGlobalKeyEvent( oNode.m_oChildModules_arr[ i ], sShortcut );
for( var j = 0;j < lTmp_arr.length;j++ ) {
lNodes_arr.push( lTmp_arr[ j ] );
}
}
}
}
return lNodes_arr;
}
/**
* Checks if a javascript function exists.
* @param sFunctionName
* @returns
* @created thomas, 15.04.2016
*/
function frameworkFunctionExists( sFunctionName )
{
return ( typeof window[sFunctionName] == "function" );
}
/**
* Executes a javascript function.
* @param sFunctionName
* @return
* @created thomas, maxime, 15.04.2016
*/
function frameworkCallFunction( sFunctionName )
{
window.setTimeout( function() {
(new Function( sFunctionName + "();" ))();
}, 0 );
}
function frameworkRestartPage()
{
var sUrl = window.location.href;
var sReload = "";
if( sUrl.indexOf( "?" ) == -1 ) {
sReload = "?RELOAD=1";
}
//NK, 27.04.2015: Es kann sein, dass bereits ein ? enthalten ist, dann sollte auf RELOAD=1 gecheckt werden
if( sUrl.indexOf( "RELOAD=1" ) == -1 && sReload == "" ) {
sReload = "&RELOAD=1";
}
var index = sUrl.indexOf( "#" );
if( index != -1 ) {
sUrl = sUrl.replace( "#", sReload + "#" );
}
else {
sUrl += sReload;
}
var oForm = $( "" )
.css( "display", "none" )
.attr( "method", "post" )
.attr( "action", sUrl )
.appendTo( "body" );
if( sUrl.indexOf( "SID=" + frameworkGetSID() ) == -1 && sUrl.indexOf( "USERNAME" ) == -1 ) {
$( "" )
.attr( "type", "text" )
.attr( "name", "SID" )
.val( frameworkGetSID() )
.appendTo( oForm );
}
oForm.submit();
}
function addJavascript( sJSFile, sModuleName, bAsync, sSID )
{
//var iModuleID = parseInt( sJSFile.slice( sJSFile.search( /JSINCLUDE=/ ) + 10 ) );
var successflag = false;
if( !bAsync ) {
bAsync = false;
}
jQuery.ajax( {
async: bAsync,
type: "GET",
url: sJSFile,
cache: true,
data: null,
dataType: 'script',
success: function ()
{
successflag = true;
if( global_DEBUG > 0 ) {
showFrameworkError( sModuleName );
}
},
error: function ( xhr, ajaxOptions, thrownError )
{
if( global_DEBUG > 0 ) {
alert( xhr.status + thrownError );
}
}
} );
return ( successflag );
}
function addVBscript( sVBFile, sModuleName, sSID )
{
//var iModuleID = parseInt( sVBFile.slice( sVBFile.search( /VBINCLUDE=/ ) + 10 ), 10 );
var successflag = false;
if( !successflag ) {
jQuery.ajax( {
async: false, type: "POST", url: sVBFile, data: null, success: function ()
{
successflag = true;
var fileref = document.createElement( 'script' );
fileref.setAttribute( "type", "text/VBScript" );
fileref.setAttribute( "src", sVBFile );
document.getElementsByTagName( "head" )[ 0 ].appendChild( fileref );
if( global_DEBUG > 0 ) {
showFrameworkError( sModuleName );
}
}, dataType: 'script'
} );
}
return ( successflag );
}
/**
* frameworkUpdateDataFromModule
* @description Updates the module on the screen.
* @param iModuleID ID of the module.
* @param bForceReload Update the module whatever the modified flag is set or not.
* @param bNoWaitScreen Set true to hide the waiting screen. Use this flag to update
* a module in the background.
*/
function frameworkUpdateDataFromModule( iModuleID, bForceReload, bNoWaitScreen )
{
if( bNoWaitScreen == undefined ) {
bNoWaitScreen = false;
}
var oModuleDivID = "DIV_MODULE_" + iModuleID;
var oModuleDiv = document.getElementById( oModuleDivID );
if( !oModuleDiv ) {
return false;
}
if( frameworkUpdateModule_arr.length > 0 ) {
window.clearTimeout( frameworkUpdateModuleTimer );
}
if( !bNoWaitScreen ) {
displayWaitingScreen( 0 );
}
var bReload = 0;
if( bForceReload ) {
bReload = 1;
}
//P( 'Add module ' + iModuleID + ' to update list', P_DEBUG, 'IMEDFramework', 'frameworkUpdateDataFromModule' );
frameworkUpdateModule_arr[ frameworkUpdateModule_arr.length ] = iModuleID;
frameworkUpdateModuleReload_arr[ frameworkUpdateModuleReload_arr.length ] = bReload;
window.setTimeout( frameworkTimeoutUpdateDataFromModule, 100 );
return true;
}
function frameworkTimeoutUpdateDataFromModule()
{
window.clearTimeout( frameworkUpdateModuleTimer );
frameworkUpdateModuleTimer = null;
var sModuleIDs = "";
var sForceReload = "";
for( var i = 0; i < frameworkUpdateModule_arr.length; ++i ) {
if( i > 0 ) {
sModuleIDs += '|';
sForceReload += '|';
}
sModuleIDs += frameworkUpdateModule_arr[ i ];
sForceReload += frameworkUpdateModuleReload_arr[ i ];
}
frameworkUpdateModule_arr = [];
frameworkUpdateModuleReload_arr = [];
// thomas, 27.05.2013: Already set in frameworkUpdateDataFromModule()
//displayWaitingScreen( 0 );
if( sModuleIDs.length > 0 ) {
//PObj( 'Update data', sModuleIDs, P_DEBUG, 'IMEDFramework', 'frameworkTimeoutUpdateDataFromModule' );
xajax_XCallback_UpdateDataFromModuleList( sModuleIDs, sForceReload );
}
displayWaitingScreen( 100 );
}
/**
* frameworkResizeAfterModuleInit
* @description Use this function to resize the module at initialization.
* @created thomas, 05.08.2014
*/
function frameworkResizeAfterModuleInit( lModuleID, bResizeNow )
{
//P( "Deprecated function frameworkResizeAfterModuleInit with MODULEID=" + lModuleID + " called" );
if( bResizeNow ) {
frameworkResizeSingleModule( lModuleID, 0 );
} else {
frameworkResizeSingleModule( lModuleID );
}
}
/**
* frameworkAfterResizeGrid
* @description Handles the resize event of a module grid.
* @created thomas, 14.11.2013
*/
function frameworkAfterResizeGrid( lModuleID )
{
}
/**
* Starts a timeout to resize a single module.
* @param lModuleID ID of the module to resize.
* @param lTimeout Time to wait before resize.
*/
function frameworkResizeSingleModule( lModuleID, lTimeout )
{
frameworkModuleListUpdate();
if( lTimeout == undefined ) {
lTimeout = 200;
}
var oModule = frameworkModuleListGetModule( lModuleID );
if( oModule ) {
if( oModule.m_lResizeTmr !== -1 ) {
// Marks the chhild module timers as blocked.
frameworkResizeResetTmr( oModule, -1 );
if( lTimeout > 0 ) {
oModule.m_lResizeTmr = window.setTimeout( "callResizeSingleModule(" + lModuleID + ");", lTimeout );
} else {
callResizeSingleModule( lModuleID );
}
}
}
}
/**
* Resets a resize timer.
* @param oModule Module object.
* @param lReset -1 = Block the module: A parent module is already waiting for resize.
* 0 = Stop resizing.
*/
function frameworkResizeResetTmr( oModule, lReset )
{
if( lReset == undefined ) {
lReset = 0;
}
window.clearTimeout( oModule.m_lResizeTmr );
oModule.m_lResizeTmr = lReset;
if( oModule.m_oChildModules_arr != undefined ) {
for( var i = 0; i < oModule.m_oChildModules_arr.length; i++ ) {
frameworkResizeResetTmr( oModule.m_oChildModules_arr[ i ], lReset );
}
}
}
/**
* callResizeSingleModule
* @description Resizes a single module with all submodules.
* @created thomas, 16.11.2012
*/
function callResizeSingleModule( lModuleID, lLevel )
{
// No module defined, so resize the root module.
var oModule;
if( lModuleID == undefined || lModuleID == 0 ) {
frameworkModuleListUpdate();
oModule = oFrameworkRootModule;
} else {
oModule = frameworkModuleListGetModule( lModuleID );
}
frameworkResizeResetTmr( oModule, 0 );
// Prevent dead locks.
if( lLevel == undefined ) {
lLevel = 0;
}
if( lLevel > 100 ) {
P( 'Maximal recursion reached.', P_ERROR, 'IMEDFramework', 'callResizeSingleModule' );
return;
}
// Loads the root node of the module in DOM tree.
var oElement = $( '#DIV_MODULE_' + oModule.m_lModuleID );
var bUpdate = true;
if( oElement.length > 0 ) {
var oModalElement = $( '#modalDiv_' + oModule.m_lModuleID );
if( oModalElement.length > 0 ) {
var sCssModal = oModalElement.css( "overflow" );
if( sCssModal == "visible" ) {
sCssModal = "auto";
}
var sCss = oElement.css( "overflow" );
oModalElement.css( "overflow", "hidden" );
if( sCss == "visible" ) {
sCss = "auto";
}
oElement.css( "overflow", "hidden" );
oElement
.width( oModalElement.width() )
.height( oModalElement.height() );
oElement.css( "overflow", sCss );
oModalElement.css( "overflow", sCssModal );
}
// Element found so check if it is visible. Do not resize hidden modules.
bUpdate = false;
if( oElement.is( ':visible' ) ) {
// Possibly the module includes a grid so do not forget to resize it.
bUpdate = true;
var sCode = "if(typeof(AfterResizeWindow_" + lModuleID + ") == 'function') { " + "AfterResizeWindow_" + lModuleID + "();" + "frameworkAfterResizeGrid('" + oModule.m_lModuleID + "');" + "}";
eval( sCode );
}
if( oModalElement.length > 0 ) {
$( "#notmodalbutton_" + lModuleID ).hide();
} else {
$( "#notmodalbutton_" + lModuleID ).show();
bUpdate = true;
}
}
if( bUpdate && oModule != undefined && oModule.m_oChildModules_arr != undefined ) {
for( var i = 0; i < oModule.m_oChildModules_arr.length; i++ ) {
callResizeSingleModule( oModule.m_oChildModules_arr[ i ].m_lModuleID, lLevel + 1 );
}
}
}
function frameworkResizeImedModuleAreas( lModuleID )
{
var oModule = $( '#DIV_MODULE_' + lModuleID );
var oHeader = oModule.children( '.imedModuleHeader' ).first();
var oContent = oModule.children( '.imedModuleContent' ).first();
if( oHeader.length == 0 || oContent.length == 0 ) {
oHeader = oModule.children( 'div' ).first().children( '.imedModuleHeader' ).first();
oContent = oModule.children( 'div' ).first().children( '.imedModuleContent' ).first();
}
var lMaxHeight = frameworkGetModuleHeight( lModuleID );
if( !lMaxHeight ) {
return oModule.height();
}
if( oHeader.length == 0 || oContent.length == 0 ) {
return lMaxHeight;
}
lMaxHeight = lMaxHeight - parseInt( oHeader.height() );
oContent.height( lMaxHeight - 5 + 'px' );
oContent.css( 'overflow', 'auto' );
//oHeader.width( '100%' );
return lMaxHeight;
}
/**
* frameworkOnResizeWindowNow
* @description Call this function after resizing the browser window.
*/
function frameworkOnResizeWindowNow()
{
if( !document.body ) {
return false;
}
if( (iFrameworkLastOffsetHeight != document.body.offsetHeight) || (iFrameworkLastOffsetWidth != document.body.offsetWidth) ) {
iFrameworkLastOffsetHeight = document.body.offsetHeight;
iFrameworkLastOffsetWidth = document.body.offsetWidth;
} else {
// window size has not changed ...
return;
}
for( var i = 0; i < oFrameworkRootModule.m_oChildModules_arr.length; i++ ) {
//P( "Deprecated function frameworkOnResizeWindow with MODULEID=" + oFrameworkRootModule.m_oChildModules_arr[ i ].m_lModuleID + " called" );
frameworkResizeSingleModule( oFrameworkRootModule.m_oChildModules_arr[ i ].m_lModuleID, 500 );
}
frameworkWaitingScreenResize();
}
function frameworkGetIEVersion()
{
var version;
if( navigator.appName == 'Microsoft Internet Explorer' ) {
version = parseFloat( (new RegExp( "MSIE ([0-9]{1,}[.0-9]{0,})" )).exec( navigator.userAgent )[ 1 ] )
} else {
version = 1000;
}
return version;
}
//NK, 21.20.2015: New Function for input numberfields
function frameworkConvertEditToSpinner( identifier, min, max, step )
{
if( $( identifier ).length == 0 ) {
if( $( "#" + identifier ).length > 0 ) {
identifier = "#" + identifier;
}
}
if( min == undefined ) {
min = null;
}
if( max == undefined ) {
max = null;
}
if( step == undefined ) {
step = 1;
}
$( identifier ).prop( 'type', 'text' ).spinner( {
min: min, max: max, step: step
} );
}
//NK, 21.20.2015: New Function for input numberfields as a slider or a range
function frameworkConvertEditToSlider( identifier, min, max, step, bRange, bShowValue )
{
if( $( identifier ).length == 0 ) {
if( $( "#" + identifier ).length > 0 ) {
identifier = "#" + identifier;
}
}
if( min == undefined ) {
min = null;
}
if( max == undefined ) {
max = null;
}
if( step == undefined ) {
step = 1;
}
if( bRange == undefined ) {
bRange = false;
}
if( bShowValue == undefined ) {
bShowValue = true;
}
var element = $( identifier );
var container = $( '
';
if( sMsg != '' ) {
$( sCode )
.fadeIn( 250, function ()
{
} )
.click( function ()
{
$( this ).fadeOut( 250, function ()
{
frameworkHideMsg( 'frameworkmsg_' + sID );
} );
} )
.appendTo( frameworkMsg );
}
if( lTimeout > 0 ) {
window.setTimeout( "frameworkHideMsg('" + sID + "');", lTimeout );
}
return sID;
}
/**
* frameworkHideMsg
* @description Closes the message box.
* @created thomas, 24.07.2013
*/
function frameworkHideMsg( sID )
{
$( '#' + sID ).fadeOut( 250, function ()
{
$( this ).remove();
} );
if( $( frameworkMsg ).children().length == 0 ) {
$( frameworkMsg ).remove();
frameworkMsg = false;
}
}
/**
* isBrowser
* @description Checks if the browser is from special type.
* Use the defines BROWSER_x from above.
* @created thomas, 14.11.2013
*/
function frameworkIsBrowser( lType )
{
var bReturn = false;
switch( lType ) {
case BROWSER_IE7:
if( navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.indexOf( 'MSIE 7' ) != -1 ) {
bReturn = true;
}
break;
case BROWSER_IE8:
if( navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.indexOf( 'MSIE 8' ) != -1 ) {
bReturn = true;
}
break;
default:
break;
}
return bReturn;
}
/**
* Checks if the browser version is compatible to the current i/med-Web version.
* If the browser version is incompatible, it shows the HTML element with ID sTag.
* @param sTag
*/
function frameworkCheckBrowserCompatibility( sTag )
{
// Skip browser check.
if( global_SKIP_BROWSER_CHECK ) {
return true;
}
var version = 1000;
if( navigator.appName == 'Microsoft Internet Explorer' ) {
version = parseFloat( (new RegExp( "MSIE ([0-9]{1,}[.0-9]{0,})" )).exec( navigator.userAgent )[ 1 ] )
}
if( version < 8 && sTag != undefined ) {
$( "#" + sTag ).show();
}
return ( version >= 8 );
}
/**
* Shows further details if the browser is not compatible to the current i/med-Web version.
*/
function frameworkShowCompatibilityDetails()
{
frameworkMsgAlert( "TPL_MODULE_ID", "Ihre Browserversion ist mit [i/med] Web möglicherweise nicht kompatibel.
" + navigator.userAgent, "Browserversion inkompatibel!", ALERT_WARNING );
}
/**
* frameworkDownload
* @description Starts a file download.
* @created thomas, 28.07.2014
*/
function frameworkDownload( sUrl, sText, sIcon )
{
if( sText == undefined ) {
sText = "URL wird geöffnet:";
}
if( sUrl ) {
//$( "#download" ).empty();
var iframe = $( "" )
.appendTo( $( "#download" ) );
$( iframe )
.attr( "src", sUrl );
frameworkShowMessage( sText + "\n" + sUrl + "", ALERT_DEFAULT + PUSHMSG_IMPORTANT, undefined, undefined, sIcon );
}
}
/**
* frameworkOnClickDirect
* @description Central function to open URLs from other modules.
* This function replaces onClickDirect from other modules.
* @created thomas, 03.06.2014
*/
function frameworkOnClickDirect( sUrl, bNewWindow, sWindowName )
{
if( bNewWindow == undefined ) {
bNewWindow = false;
}
if( sWindowName == undefined ) {
sWindowName = false;
}
if( bNewWindow ) {
window.open( sUrl, sWindowName );
frameworkShowMessage( "Eine externe Anwendung wird geöffnet:\n" + sUrl + "", ALERT_DEFAULT + PUSHMSG_IMPORTANT );
} else {
frameworkDownload( sUrl );
}
}
// These functions are moved from IModule as central functions ====>
/**
* @deprecated thomas, 15.09.2015 Use frameworkCloseModal instead.
* @param lModuleID
*/
function frameworkUndoModal( lModuleID )
{
var oModuleDiv = document.getElementById( 'modalDiv_' + lModuleID );
if( oModuleDiv ) {
$( '#modalDiv_' + lModuleID ).dialog( 'destroy' );
document.body.removeChild( oModuleDiv );
}
}
function frameworkDelModuleByID( lModuleID )
{
xajax_XCallback_frameworkDelModuleByID( lModuleID );
}
function frameworkGetModalDlgHeight( lModuleID )
{
var oModuleDiv = document.getElementById( 'modalDiv_' + lModuleID );
if( oModuleDiv ) {
return $( '#modalDiv_' + lModuleID ).dialog( 'option', 'height' );
}
return $( '#DIV_MODULE_' + lModuleID ).height();
}
function frameworkGetModalDlgWidth( lModuleID )
{
var oModuleDiv = document.getElementById( 'modalDiv_' + lModuleID );
if( oModuleDiv ) {
return $( '#modalDiv_' + lModuleID ).dialog( 'option', 'width' );
}
return $( '#DIV_MODULE_' + lModuleID ).width();
}
/**
* Updates the position of the title buttons of a modal dialog.
* @modify NK CHB, 17.06.2015: Funktion ersetzt, einheitliche Positionen des minimieren/maximieren Buttons
*/
function frameworkModalUpdateTitleButtons( oElement, sAction )
{
$( '.ui-dialog-titlebar-close' ).attr( 'class', 'ui-dialog-titlebar-close' ).css( {'border': 'none'} );
$( '.ui-dialog-titlebar-close span' ).text( '' ).css( 'margin', '0' );
if( sAction == undefined ) {
sAction = 'maximize';
}
var offset_close = 0;
var offset_min = 52;
var offset_restore = 26;
var offset_maximize = 0;
if( sAction == 'restore' || sAction == 'load' ) {
offset_restore = 0;
offset_maximize = 26;
} else if( sAction == 'collapse' || sAction == 'minimize' ) {
offset_restore = 52;
offset_maximize = 26;
offset_min = 0;
}
var oNE = $( oElement ).parent().find( '.ui-dialog-titlebar-buttonpane' );
oNE.css( 'top', '24px' );
oNE.find( 'a, button' ).each( function ( e )
{
var innerEle = $( this );
innerEle.css( 'display', 'inline-block' ).css( 'position', 'absolute' ).removeClass( 'ui-state-default' );
if( innerEle.hasClass( 'ui-dialog-titlebar-minimize' ) ) {
innerEle.css( "right", offset_min + "px" );
if( offset_min == 0 ) {
innerEle.css( "display", 'none' );
}
} else if( innerEle.hasClass( 'ui-dialog-titlebar-restore' ) ) {
innerEle.css( "right", offset_restore + "px" );
if( offset_restore == 0 ) {
innerEle.css( "display", 'none' );
}
} else if( innerEle.hasClass( 'ui-dialog-titlebar-maximize' ) ) {
innerEle.css( "right", offset_maximize + "px" );
if( offset_maximize == 0 ) {
innerEle.css( "display", 'none' );
}
} else if( innerEle.hasClass( 'ui-dialog-titlebar-close' ) ) {
innerEle.css( "right", offset_close + "px" );
} else if( innerEle.hasClass( 'ui-dialog-titlebar-collapse' ) ) {
innerEle.css( "display", 'none' );
}
} );
}
/**
* Updates the button of a dialog.
* @param lModuleID ID of the module.
* @param lIndex Index of the button.
* @param bEnable Set true to enable the button or false to disable.
* @param sLabel Label of the button. Set "" to skip changing the label.
* @created thomas, 20.04.2016
*/
function frameworkUpdateDialogButton( lModuleID, lIndex, bEnable, sLabel )
{
var oModalDiv = $( "#modalDiv_" + lModuleID );
var oButtons_arr = [];
if( oModalDiv != undefined && oModalDiv.length > 0 ) {
oButtons_arr = oModalDiv.parent().find( ".ui-dialog-buttonset" ).find( ".ui-button" );
} else {
oButtons_arr = $( "#notmodalbutton_" + lModuleID ).find( ".ui-button" );
}
if( lIndex < oButtons_arr.length ) {
var ele = $( oButtons_arr[ lIndex ] );
if( bEnable ) {
ele.button( "enable" );
} else {
ele.button( "disable" );
}
if( sLabel != undefined && sLabel != "" ) {
ele.button( "option", "label", sLabel );
}
}
}
// pmi, 02.04.2013: added bOnlyDisplay
// thomas, 18.04.2016: sClose added
function frameworkDoModal( lModuleID, sModuleType, bBlocking, bOnlyDisplay, iWidth, iWidthDelta, iHeight, iHeightDelta, sPos, sTitle, oButtons, bHideTitle, bSaveSize, sClose )
{
if( sClose == undefined ) {
sClose = "";
}
//set some defaults
if( bBlocking == undefined ) bBlocking = false;
if( bOnlyDisplay == undefined ) bOnlyDisplay = false;
if( bHideTitle == undefined ) bHideTitle = false;
if( bSaveSize == undefined ) bSaveSize = false;
eval( 'includeChildModulesJS_' + lModuleID + '();' );
frameworkCloseModal( lModuleID );
var modalDiv = document.createElement( 'div' );
modalDiv.id = 'modalDiv_' + lModuleID;
document.body.appendChild( modalDiv );
var oEleModalDiv = $( '#modalDiv_' + lModuleID )
.attr( "data-onclose", sClose )
.addClass( 'classIModuleDivModal' )
.dialog( {
width: iWidth, height: iHeight, position: sPos, //minWidth: iWidth,
//minHeight: iHeight,
close: function ( event, ui )
{
//NK, 10.02.2016: Nur ein event behandeln
event.stopPropagation();
eval( "if( typeof( OnClose_" + lModuleID + " ) == 'function' ) OnClose_" + lModuleID + "();" );
xajax_XCallback_OnCloseModal( lModuleID );
}, beforeClose: function ( event, ui )
{
var sClose = $( this ).attr( "data-onclose" );
if( sClose != undefined ) {
if( sClose != "" ) {
eval( sClose );
return false;
}
}
//NK, 03.11.2014: BeforeClose Funktion ggf. aufrufen
return eval( "if( typeof( OnBeforeClose_" + lModuleID + " ) == 'function' ) { OnBeforeClose_" + lModuleID + "();} else {true;}" );
}, resizeStop: function ( event, ui )
{
frameworkResizeSingleModule( lModuleID );
if(bSaveSize)
{
var iModalHeight = parseInt(frameworkGetModalDlgHeight(lModuleID));
var iModalWidth = parseInt(frameworkGetModalDlgWidth(lModuleID));
var sVal = "MODULE_SIZE_"+lModuleID;
window[sVal] = [iModalHeight,iModalWidth];
xajax_XCallback_OnSaveSize( lModuleID, iModalHeight, iModalWidth );
}
}, autoOpen: true, title: sTitle, modal: bBlocking
} )
.dialogExtend( {
close: true, dblclick: 'collapse', icons: {
close: 'ui-icon-closethick',
maximize: 'ui-icon-circle-plus',
minimize: 'ui-icon-circle-minus',
restore: 'ui-icon-bullet'
}, //events: {
//load: function(evt, dlg){ alert(evt.type+'.'+evt.handleObj.namespace); },
//beforeCollapse: function(evt, dlg){ alert(evt.type+'.'+evt.handleObj.namespace); },
//beforeMaximize: function(evt, dlg){ alert(evt.type+'.'+evt.handleObj.namespace); },
//beforeMinimize: function(evt, dlg){ alert(evt.type+'.'+evt.handleObj.namespace); },
//beforeRestore: function(evt, dlg){ alert(evt.type+'.'+evt.handleObj.namespace); },
//collapse: function(evt, dlg){ alert(evt.type+'.'+evt.handleObj.namespace); },
//maximize: function(evt, dlg){ alert(evt.type+'.'+evt.handleObj.namespace); },
//minimize: function(evt, dlg){ alert(evt.type+'.'+evt.handleObj.namespace); },
load: function ( evt, dlg )
{
//NK CHB, 17.06.2015
frameworkModalUpdateTitleButtons( this, 'load' );
if( bBlocking ) {
$( this ).parent().find( '.ui-dialog-titlebar-minimize' ).remove();
}
}, collapse: function ( evt, dlg )
{
//NK CHB, 17.06.2015
frameworkModalUpdateTitleButtons( this, 'collapse' );
}, beforeMinimize: function ( evt, dlg )
{
$( this ).find( '[istiny]' ).each( function ( e )
{
tinyMCE.execCommand( 'mceRemoveControl', false, $( this ).attr( 'id' ) );
} );
}, minimize: function ( evt, dlg )
{
//NK CHB, 17.06.2015
frameworkModalUpdateTitleButtons( this, 'minimize' );
var oChildren_arr = $( "#dialog-extend-fixed-container" ).find( ".ui-dialog-titlebar" );
for( var i = 0; i < oChildren_arr.length; i++ ) {
frameworkModalUpdateTitleButtons( oChildren_arr[ i ], 'minimize' );
}
}, maximize: function ( evt, dlg )
{
//NK CHB, 17.06.2015
frameworkModalUpdateTitleButtons( this, 'maximize' );
$( this ).find( '[istiny]' ).each( function ( e )
{
tinyMCE.execCommand( 'mceAddControl', false, $( this ).attr( 'id' ) );
} );
frameworkResizeSingleModule( lModuleID );
}, restore: function ( evt, dlg )
{
//NK CHB, 17.06.2015
frameworkModalUpdateTitleButtons( this, 'restore' );
$( this ).find( '[istiny]' ).each( function ( e )
{
tinyMCE.execCommand( 'mceAddControl', false, $( this ).attr( 'id' ) );
} );
frameworkResizeSingleModule( lModuleID );
}
//}
} );
var divParentEle = oEleModalDiv.parent();
divParentEle.find( '.ui-dialog-titlebar-close' ).attr( 'title', 'Schließen' );
divParentEle.find( '.ui-dialog-titlebar-maximize' ).attr( 'title', 'Maximieren' );
divParentEle.find( '.ui-dialog-titlebar-minimize' ).attr( 'title', 'Minimieren' );
divParentEle.find( '.ui-dialog-titlebar-restore' ).attr( 'title', 'Verkleinern' );
if( bHideTitle ) {
divParentEle.find( '.ui-widget-header' ).hide();
}
if( oButtons != undefined ) {
eval( "$( '#modalDiv_" + lModuleID + "' ).dialog({ " + oButtons + " });" );
}
$( "" )
.attr( "id", "DIV_MODULE_" + lModuleID )
.addClass( sModuleType )
.css( "display", "block" )
.css( "height", ( parseInt( document.getElementById( "modalDiv_" + lModuleID ).offsetHeight ) - iHeightDelta ) + "px" )
.css( "width", ( parseInt( document.getElementById( "modalDiv_" + lModuleID ).offsetWidth ) - iWidthDelta ) + "px" )
.appendTo( modalDiv );
if( !bOnlyDisplay ) frameworkUpdateDataFromModule( lModuleID, true );
eval( "if( typeof( window.Module_Init_Modal_" + lModuleID + " ) == 'function' ) Module_Init_Modal_" + lModuleID + "();" );
eval( "if( typeof( window.initModuleGrid_" + lModuleID + " ) == 'function' ) initModuleGrid_" + lModuleID + "();" );
var dialogParent = modalDiv.parentNode;
var oDialogParent = $( dialogParent );
//NK, 30.06.2015: window not document!
var iCenterW = Math.floor( $( window ).width() / 2 );
var iLeft = Math.floor( oDialogParent.width() / 2 );
var iCenterH = Math.floor( $( window ).height() / 2 );
var iTop = Math.floor( oDialogParent.height() / 2 );
// thomas, 21.09.2016: Open dialogs with same start position sihifted.
iLeft = (iCenterW - iLeft);
iTop = (iCenterH - iTop);
var oDialog_arr = $( ".ui-dialog" );
var lCntDone = 0;
var bDone = false;
var iOffset = 0;
while( !bDone && lCntDone < ( oDialog_arr.length + 1 ) ) {
lCntDone++;
bDone = true;
for( var i = 0; i < oDialog_arr.length; i++ ) {
if( $( oDialog_arr[ i ] ).is( ":visible" ) ) {
var iLeftTmp = parseInt( $( oDialog_arr[ i ] ).css( "left" ).replace( "px", "" ) );
var iTopTmp = parseInt( $( oDialog_arr[ i ] ).css( "top" ).replace( "px", "" ) );
if( iLeftTmp == iLeft && iTopTmp == iTop ) {
iLeft += 30;
iTop += 30;
if(
( iLeft + oDialogParent.width() + 30 ) > $( window ).width() ||
( iTop + oDialogParent.height() + 30 ) > $( window ).height()
) {
iLeft = iOffset + 15;
iTop = iOffset + 15;
iOffset += 15;
}
i = oDialog_arr.length;
bDone = false;
}
}
}
}
modalDiv.parentNode.style.left = iLeft + 'px';
modalDiv.parentNode.style.top = iTop + 'px';
modalDiv.parentNode.style.display = '';
}
function frameworkCloseModal( lModuleID )
{
var oModalDiv = $( "#modalDiv_" + lModuleID );
if( oModalDiv.length <= 0 ) {
return false;
}
oModalDiv.dialog( "destroy" );
oModalDiv.remove();
}
function frameworkResizeChildModules( lModuleID, lLevel )
{
var oModule = false;
if( lModuleID == undefined || lModuleID == 0 ) {
frameworkModuleListUpdate();
oModule = oFrameworkRootModule;
} else {
oModule = frameworkModuleListGetModule( lModuleID );
}
if( lLevel == undefined ) {
lLevel = 0;
}
if( oModule ) {
for( var i = 0; i < oModule.m_oChildModules_arr.length; i++ ) {
callResizeSingleModule( oModule.m_oChildModules_arr[ i ].m_lModuleID, lLevel + 1 );
}
}
}
function frameworkCheckUpdateModule( lModuleID, bModal, bForceReload )
{
// pmi, 03.12.2012:
var oModuleDivID = "DIV_MODULE_" + lModuleID;
var oModuleDiv = document.getElementById( oModuleDivID );
if( !oModuleDiv ) {
return false;
}
var sScript = "bSkipUpdateModule = false;";
sScript += "if( bEnableCheckUpdateModule_" + lModuleID + " ){ ";
sScript += " if( bEnableCheckUpdateModule_" + lModuleID + " && $('#DIV_MODULE_" + lModuleID + "').length > 0 ){ ";
sScript += " if( !xajax_XCallback_UpdateDataFromModule( " + lModuleID + "," + (bModal ? "true" : "false") + "," + (bForceReload ? "true" : "false") + " ) ){ ";
sScript += " displayWaitingScreen( 100 ); ";
sScript += " bSkipUpdateModule = true;";
sScript += " } ";
sScript += " } ";
sScript += " if( bSkipUpdateModule == false ) {";
sScript += " displayWaitingScreen( 100 ); ";
sScript += " bEnableCheckUpdateModule_" + lModuleID + " = true; ";
sScript += " }";
sScript += "}";
eval( sScript );
}
function frameworkXAjaxWrapper( sFunctionName, sModuleType, arguments )
{
var requestURIBefore = xajax.config.requestURI;
var sID = frameworkGetSID();
xajax.config.requestURI = "frameworkXajax.php?SID=" + sID;
xajax.config.defaultMode = "synchronous";
var retValue = xajax.request( {xjxfun: sFunctionName}, {parameters: arguments} );
xajax.config.requestURI = requestURIBefore;
// pmi, 18.03.2013: added typeof
if( parseInt( global_DEBUG ) > 0 && typeof( showFrameworkError ) == 'function' ) showFrameworkError( sModuleType );
return retValue;
}
/**
* frameworkGetSID
* @description Reads the SID from cookie.
* @created thomas, 23.07.2014
*/
function frameworkGetSID()
{
// Prefer the cookie of URL.
var sUrlParam = location.search.substr( 1 );
var sSplit_arr = sUrlParam.split( "&" );
for( var i = 0; i < sSplit_arr.length; i++ ) {
var sKeyVal_arr = sSplit_arr[ i ].split( "=" );
if( $.trim( sKeyVal_arr[ 0 ] ) == "SID" ) {
return $.trim( sKeyVal_arr[ 1 ] );
}
}
// No SID found so try to get from global variable
if( global_sSID ) {
return global_sSID;
}
// No SID found.
return '0';
}
/**
* Reads the chosen language.
* @returns string
*/
function frameworkGetLanguage()
{
return global_sLan;
}
/**
* Shows an alert box.
* @param moduleid ID of the calling module.
* @param message Message to show.
* @param title Title of the dialog.
* @param type Type of the dialog (ALERT_OK, ALERT_WARNING, ALERT_ERROR)
* @param callback Function to call after the click to the OK button.
* @param param Parameters to add to the callback function.
* @param sLabelBtn
*/
function frameworkMsgAlert( moduleid, message, title, type, callback, param, sLabelBtn, lWidth, sDetails )
{
$.alert( moduleid, message, title, type, callback, param, sLabelBtn, lWidth, sDetails );
}
/**
* Shows a confirm box.
* @param moduleid ID of the calling module.
* @param message Message to show.
* @param title Title of the dialog.
* @param type Type of the dialog (ALERT_OK, ALERT_WARNING, ALERT_ERROR)
* @param callback Function to call after the click to the OK button.
* @param param Parameters to add to the callback function.
* @param sLabelYes
* @param sLabelNo
* @param callbackFail
* @param paramFail
*/
function frameworkMsgConfirm( moduleid, message, title, type, callback, param, sLabelYes, sLabelNo, callbackFail, paramFail, lWidth, sDetails )
{
$.confirm( moduleid, message, title, type, callback, param, sLabelYes, sLabelNo, callbackFail, paramFail, lWidth, sDetails );
}
/**
* Special confirmation response handler to execute variables after positive confirmation.
* Call VariablesClass::confirmMsg to use this handler.
* @param lModuleID ID of the calling module.
* @param sVariable Name of the variable.
* @param sParam List of params.
*/
function frameworkConfirmVariable( lModuleID, sVariable, sParam )
{
if( typeof( xajax_Framework_XCallback_OnConfirmVariable ) == "function" ) {
displayWaitingScreen( 0 );
window.setTimeout( function ()
{
xajax_Framework_XCallback_OnConfirmVariable( lModuleID, sVariable, sParam );
displayWaitingScreen( 100 );
}, 0 );
}
}
/**
* Shows a prompt box.
* @param moduleid ID of the calling module.
* @param message Message to show.
* @param title Title of the dialog.
* @param value
* @param callback Function to call after the click to the OK button.
* @param param Parameters to add to the callback function.
* @param sLabelYes
* @param sLabelNo
* @param lMaxLength
* @param lWidth
*/
function frameworkMsgPrompt( moduleid, message, title, value, callback, param, sLabelYes, sLabelNo, lMaxLength, lWidth, sFieldType )
{
$.prompt( moduleid, message, title, value, callback, param, sLabelYes, sLabelNo, lMaxLength, lWidth, sFieldType );
}
/**
* Shows a prompt box with multiline input field.
* @param moduleid ID of the calling module.
* @param message Message to show.
* @param title Title of the dialog.
* @param value
* @param callback Function to call after the click to the OK button.
* @param param Parameters to add to the callback function.
* @param sLabelYes
* @param sLabelNo
* @param lMaxLength
* @param lWidth
*/
function frameworkMsgPromptMultiline( moduleid, message, title, value, callback, param, sLabelYes, sLabelNo, lMaxLength, lWidth )
{
$.promptmultiline( moduleid, message, title, value, callback, param, sLabelYes, sLabelNo, lMaxLength, lWidth );
}
/**
* Shows a prompt box with a select input field.
* @param moduleid ID of the calling module.
* @param message Message to show.
* @param title Title of the dialog.
* @param context Autocomplete context string.
* @param key Key of the selected value
* @param value Text of the selected value
* @param callback Function to call after the click to the OK button.
* @param param Parameters to add to the callback function.
* @param sLabelYes
* @param sLabelNo
*/
function frameworkMsgPromptSelect( moduleid, message, title, context, key, value, callback, param, sLabelYes, sLabelNo )
{
$.promptselect( moduleid, message, title, context, key, value, callback, param, sLabelYes, sLabelNo );
}
/**
* Shows a prompt box.
* @param moduleid ID of the calling module.
* @param message Message to show.
* @param title Title of the dialog.
* @param html
* @param callback Function to call after the click to the OK button.
* @param param Parameters to add to the callback function.
* @param sLabelYes
* @param sLabelNo
*/
function frameworkMsgHtmlPrompt( moduleid, message, title, html, callback, param, sLabelYes, sLabelNo )
{
$.htmlprompt( moduleid, message, title, html, callback, param, sLabelYes, sLabelNo );
}
/**
* Key event memory.
* @param lModuleID ID of the module.
* @param sKey Key to register.
* @param bWithShift Set true if SHIFT+sKey has to be detected.
* @param bWithCtrl Set true if CTRL+sKey has to be detected.
* @param sCallback Function to call after key detection.
* @param sParam_arr Parameters to add to the callback function call.
* @param bWithAlt
* @param sDescription
*/
function KeyEventHandler( lModuleID, sKey, bWithShift, bWithCtrl, bWithAlt, sDescription, sCallback, sParam_arr )
{
this.m_lModuleID = lModuleID;
this.m_sKey = sKey;
this.m_bWithShift = bWithShift;
this.m_bWithCtrl = bWithCtrl;
this.m_bWithAlt = bWithAlt;
this.m_sDescription = sDescription;
this.m_sCallback = sCallback;
this.m_sParam_arr = sParam_arr;
}
/**
* Registers a key.
* @param lModuleID ID of the module.
* @param sKeyCode Key to register.
* @param bWithShift Set true if SHIFT+sKey has to be detected.
* @param bWithCtrl Set true if CTRL+sKey has to be detected.
* @param bWithAlt Set true if ALT+sKey has to be detected
* @param sDescription Enter a description of the shortcut to display in shortcut overview.
* @param sCallback Function to call after key detection.
* @param sParam_arr Parameters to add to the callback function call.
*/
function frameworkRegisterKey( lModuleID, sKeyCode, bWithShift, bWithCtrl, bWithAlt, sDescription, sCallback, sParam_arr )
{
if( sParam_arr == undefined ) {
sParam_arr = [];
}
for( var i = 0; i < m_frameworkKeyEventHandler_arr.length; i++ ) {
if( m_frameworkKeyEventHandler_arr[ i ].m_lModuleID == lModuleID && m_frameworkKeyEventHandler_arr[ i ].m_sKey == sKeyCode && m_frameworkKeyEventHandler_arr[ i ].m_bWithShift == bWithShift && m_frameworkKeyEventHandler_arr[ i ].m_bWithCtrl == bWithCtrl && m_frameworkKeyEventHandler_arr[ i ].m_bWithAlt == bWithAlt ) {
// The key is already registered.
return true;
}
}
m_frameworkKeyEventHandler_arr.push( new KeyEventHandler( lModuleID, sKeyCode, bWithShift, bWithCtrl, bWithAlt, sDescription, sCallback, sParam_arr ) );
}
/**
* Removes all key events of a module.
* @param lModuleID ID of the module.
*/
function frameworkUnregisterKey( lModuleID )
{
for( var i = 0; i < m_frameworkKeyEventHandler_arr.length; i++ ) {
m_frameworkKeyEventHandler_arr.splice( i, 1 );
i--;
}
}
/**
* Converts a key code into readable character.
* @param lKeyCode Key code to convert.
* @param bAsChar Handle numberpad numbers equal to default numbners.
* @returns {*}
*/
function frameworkGetKeyCodeUppers( lKeyCode, bAsChar )
{
if( bAsChar == undefined ) {
bAsChar = false;
}
var sKeyCodeTable_arr = {};
sKeyCodeTable_arr[ "48" ] = "0";
sKeyCodeTable_arr[ "49" ] = "1";
sKeyCodeTable_arr[ "50" ] = "2";
sKeyCodeTable_arr[ "51" ] = "3";
sKeyCodeTable_arr[ "52" ] = "4";
sKeyCodeTable_arr[ "53" ] = "5";
sKeyCodeTable_arr[ "54" ] = "6";
sKeyCodeTable_arr[ "55" ] = "7";
sKeyCodeTable_arr[ "56" ] = "8";
sKeyCodeTable_arr[ "57" ] = "9";
sKeyCodeTable_arr[ "65" ] = "A";
sKeyCodeTable_arr[ "66" ] = "B";
sKeyCodeTable_arr[ "67" ] = "C";
sKeyCodeTable_arr[ "68" ] = "D";
sKeyCodeTable_arr[ "69" ] = "E";
sKeyCodeTable_arr[ "70" ] = "F";
sKeyCodeTable_arr[ "71" ] = "G";
sKeyCodeTable_arr[ "72" ] = "H";
sKeyCodeTable_arr[ "73" ] = "I";
sKeyCodeTable_arr[ "74" ] = "J";
sKeyCodeTable_arr[ "75" ] = "K";
sKeyCodeTable_arr[ "76" ] = "L";
sKeyCodeTable_arr[ "77" ] = "M";
sKeyCodeTable_arr[ "78" ] = "N";
sKeyCodeTable_arr[ "79" ] = "O";
sKeyCodeTable_arr[ "80" ] = "P";
sKeyCodeTable_arr[ "81" ] = "Q";
sKeyCodeTable_arr[ "82" ] = "R";
sKeyCodeTable_arr[ "83" ] = "S";
sKeyCodeTable_arr[ "84" ] = "T";
sKeyCodeTable_arr[ "85" ] = "U";
sKeyCodeTable_arr[ "86" ] = "V";
sKeyCodeTable_arr[ "87" ] = "W";
sKeyCodeTable_arr[ "88" ] = "X";
sKeyCodeTable_arr[ "89" ] = "Y";
sKeyCodeTable_arr[ "90" ] = "Z";
var sPrefix = "";
if( !bAsChar ) {
sPrefix = "NUMPAD ";
}
sKeyCodeTable_arr[ "96" ] = sPrefix + "0";
sKeyCodeTable_arr[ "97" ] = sPrefix + "1";
sKeyCodeTable_arr[ "98" ] = sPrefix + "2";
sKeyCodeTable_arr[ "99" ] = sPrefix + "3";
sKeyCodeTable_arr[ "100" ] = sPrefix + "4";
sKeyCodeTable_arr[ "101" ] = sPrefix + "5";
sKeyCodeTable_arr[ "102" ] = sPrefix + "6";
sKeyCodeTable_arr[ "103" ] = sPrefix + "7";
sKeyCodeTable_arr[ "104" ] = sPrefix + "8";
sKeyCodeTable_arr[ "105" ] = sPrefix + "9";
return sKeyCodeTable_arr[ lKeyCode ];
}
/**
* Converts special character key codes in readable strings.
* @param lKeyCode Key code to convert.
* @returns {*}
*/
function frameworkGetKeyCodeSpecial( lKeyCode )
{
var sKeyCodeTable_arr = {};
sKeyCodeTable_arr[ "8" ] = "BACKSPACE";
sKeyCodeTable_arr[ "9" ] = "TAB";
sKeyCodeTable_arr[ "13" ] = "ENTER";
//sKeyCodeTable_arr[ "16" ] = "SHIFT";
//sKeyCodeTable_arr[ "17" ] = "CTRL";
//sKeyCodeTable_arr[ "18" ] = "ALT";
sKeyCodeTable_arr[ "19" ] = "PAUSE/BREAK";
sKeyCodeTable_arr[ "20" ] = "CAPS LOCK";
sKeyCodeTable_arr[ "27" ] = "ESCAPE";
sKeyCodeTable_arr[ "33" ] = "PAGEUP";
sKeyCodeTable_arr[ "34" ] = "PAGEDOWN";
sKeyCodeTable_arr[ "35" ] = "END";
sKeyCodeTable_arr[ "36" ] = "HOME";
sKeyCodeTable_arr[ "37" ] = "LEFT";
sKeyCodeTable_arr[ "38" ] = "UP";
sKeyCodeTable_arr[ "39" ] = "RIGHT";
sKeyCodeTable_arr[ "40" ] = "DOWN";
sKeyCodeTable_arr[ "45" ] = "INSERT";
sKeyCodeTable_arr[ "46" ] = "DELETE";
sKeyCodeTable_arr[ "91" ] = "WINDOWS LEFT";
sKeyCodeTable_arr[ "92" ] = "WINDOWS RIGHT";
sKeyCodeTable_arr[ "93" ] = "SELECT";
sKeyCodeTable_arr[ "112" ] = "F1";
sKeyCodeTable_arr[ "113" ] = "F2";
sKeyCodeTable_arr[ "114" ] = "F3";
sKeyCodeTable_arr[ "115" ] = "F4";
sKeyCodeTable_arr[ "116" ] = "F5";
sKeyCodeTable_arr[ "117" ] = "F6";
sKeyCodeTable_arr[ "118" ] = "F7";
sKeyCodeTable_arr[ "119" ] = "F8";
sKeyCodeTable_arr[ "120" ] = "F9";
sKeyCodeTable_arr[ "121" ] = "F10";
sKeyCodeTable_arr[ "122" ] = "F11";
sKeyCodeTable_arr[ "123" ] = "F12";
return sKeyCodeTable_arr[ lKeyCode ];
}
/**
* Register a Module for Push Events
* @creator niklas, 04.03.2015
* @param lModuleId ModuleID to add
* @param lTime
* @param sModuleType
* @returns {*}
*/
function frameworkPushRegisterModule( lModuleId, lTime, sModuleType )
{
var sNewModule;
lModuleId = parseInt( lModuleId, 10 );
lTime = parseInt( lTime, 10 );
if( sModuleType != undefined ) {
sNewModule = lModuleId + '_' + sModuleType;
} else {
var oTmpModule = frameworkModuleListGetModule( lModuleId );
sNewModule = oTmpModule.m_lModuleID + '_' + oTmpModule.m_sModuleType;
}
// Modul hinzufuegen
if( !$.in_array( sNewModule, m_frameworkPushModule_arr ) ) {
m_frameworkPushModule_arr.push( sNewModule );
m_frameworkPushLastTimestamp_arr[ sNewModule ] = lTime;
}
// Handler starten
if( m_frameworkPushIntervalHandleId == null ) {
setTimeout( frameworkPushDoRequest, global_pushDelayInSec * 1000 );
}
}
/**
* Unregister a Module from Push Events
* @creator niklas, 04.03.2015
* @param lModuleId ModuleID to remove
* @returns {*}
*/
function frameworkPushUnregisterModule( lModuleId )
{
var oTmpModule = frameworkModuleListGetModule( lModuleId );
var sOldModule = oTmpModule.m_lModuleID + '_' + oTmpModule.m_sModuleType;
var lPos = $.array_search( sOldModule, m_frameworkPushModule_arr );
if( lPos != -1 ) {
m_frameworkPushModule_arr.splice( lPos, 1 );
}
if( m_frameworkPushModule_arr.length == 0 ) {
clearInterval( m_frameworkPushIntervalHandleId );
m_frameworkPushIntervalHandleId = null;
}
}
/**
* Performe the PushRequest and Call the ModuleFunction
* @creator niklas, 04.03.2015
* @returns {*}
*/
function frameworkPushDoRequest()
{
clearInterval( m_frameworkPushIntervalHandleId );
$.ajax( {
url: "tmp/pushfeed/" + global_sSID + ".txt?time=" + ( new Date() ).getTime(),
type: "GET",
async: false,
ifModified: true,
success: function ( data )
{ // Wird nur aufgerufen, wenn die Datei sich geaendert hat. Complete kommt trotzdem!
if (typeof data !== "undefined" && data !== null && data.length > 3 ) {
var odata = JSON.parse( data );
for( var key in m_frameworkPushModule_arr ) {
var sModuleName = m_frameworkPushModule_arr[ key ];
var lLocalTime = m_frameworkPushLastTimestamp_arr[ sModuleName ];
var lRemoteTime = -1;
if( odata[ sModuleName ] == undefined ) {
continue;
}
lRemoteTime = odata[ sModuleName ];
if( lRemoteTime < 10 ) {
continue;
}
if( lRemoteTime > lLocalTime ) {
m_frameworkPushLastTimestamp_arr[ sModuleName ] = lRemoteTime;
var sTeile_arr = sModuleName.split( "_", 1 );
try {
eval( 'if (typeof(handleNewPushEvent_' + sTeile_arr[ 0 ] + ') == "function"){handleNewPushEvent_' + sTeile_arr[ 0 ] + '(' + lRemoteTime + ');}' );
} catch( f ) {
}
}
}
}
},
complete: function ( a, b )
{ // Wird immer nach success aufgerufen (auch wenn nicht modifiziert)
clearInterval( m_frameworkPushIntervalHandleId );
if( m_frameworkPushModule_arr.length > 0 ) {
m_frameworkPushIntervalHandleId = setInterval( frameworkPushDoRequest, global_pushDelayInSec * 1000 );
}
}
} );
}
function frameworkGetAddPushData( lModuleID, sModuleType )
{
var sRet = false;
$.ajax( {
url: "tmp/pushfeed/" + global_sSID + ".txtx?time=" + ( new Date() ).getTime(),
type: "GET",
async: false,
ifModified: false,
success: function ( data )
{ // Wird nur aufgerufen, wenn die Datei sich geaendert hat. Complete kommt trotzdem!
if (typeof data !== "undefined" && data !== null && data.length > 3 ) {
var odata = JSON.parse( data );
var sModuleName = lModuleID + '_' + sModuleType;
if( typeof( odata[ sModuleName ] ) == "undefined" ) {
sRet = false;
} else {
sRet = odata[ sModuleName ];
}
}
}
} );
return sRet;
}
function frameworkOnClickVersionNumber()
{
if( typeof( xajax_Framework_XCallback_OnClickDebug ) == "function" ) {
displayWaitingScreen( 0, "Bitte warten ..." );
xajax_Framework_XCallback_OnClickDebug();
displayWaitingScreen( 100 );
}
}
if( typeof( dragInit ) == 'function' ) dragInit();
if( document.getElementsByClassName == undefined ) {
document.getElementsByClassName = function ( className )
{
var hasClassName = new RegExp( "(?:^|\\s)" + className + "(?:$|\\s)" );
var allElements = document.getElementsByTagName( "*" );
var results = [];
var element;
for( var i = 0; (element = allElements[ i ]) != null; i++ ) {
var elementClass = element.className;
if( elementClass && elementClass.indexOf( className ) != -1 && hasClassName.test( elementClass ) )
results.push( element );
}
return results;
}
}
/**
* Copies data to clipboard.
* @param sText Text to copy to clipboard.
* @param bShowAsDialogOnFailure Set true if the text has to be shown as dialog if copying to clipboard failed.
* @created thomas, 03.09.2015
*/
function frameworkCopyToClipboard( sText, bShowAsDialogOnFailure )
{
if( bShowAsDialogOnFailure == undefined ) {
bShowAsDialogOnFailure = false;
}
var bSuccess = false;
if( typeof( window.clipboardData ) != "undefined" ) {
window.clipboardData.setData( "Text", sText );
bSuccess = true;
} else if( typeof( clipboardData ) != "undefined" ) {
clipboardData.setData( "Text", sText );
bSuccess = true;
} else if( typeof( copy ) != "undefined" ) {
copy( sText );
bSuccess = true;
} else if( 1 == 2 ) {
// TODO Add command for DORNER browser.
}
if( bSuccess ) {
frameworkShowMessage( "Der Text wurde in die Zwischenablage kopiert. Fügen Sie ihn an der gewünschten Stelle ein.", ALERT_OK + PUSHMSG_IMPORTANT );
} else {
if( bShowAsDialogOnFailure ) {
var oClipboardDialog = $( "" )
.attr( "title", "Zwischenablage" )
.html( "
Ihr Browser unterstützt das automatische Kopieren in die Zwischenablage nicht. Markieren Sie den Text und kopieren Sie ihn manuell in die Zwischenablage.
" + sText + "
" )
.appendTo( "body" );
$( oClipboardDialog ).dialog( {
height: 500, width: 500, modal: true, resizable: true, buttons: {
'Schließen': function ()
{
$( this ).dialog( 'destroy' );
}
}
} );
} else {
frameworkMsgAlert( 0, "Der Text kann nicht in die Zwischenablage kopiert werden. Möglicherweise unterstützt Ihr Browser diese Funktion nicht.", "Fehler", ALERT_ERROR );
}
}
}
/**
* Marks a field with an error.
* @param oEle Element to mark
* @param bSet Set true to mark the field as invalid or set false to remove the error mark.
* @param sMsg Error message.
* @param bWithAlert Set true to show the message in alert box.
* @param oLabel
* @param oRadio_arr
*/
function frameworkSetFieldErrorFromElement( oEle, bSet, sMsg, bWithAlert, oLabel, oRadio_arr )
{
var i, oRadioLabel;
try {
if( bSet == undefined ) {
bSet = true;
}
if( sMsg == undefined ) {
sMsg = "";
}
if( bWithAlert == undefined ) {
bWithAlert = false;
}
oEle = $( oEle );
if( oLabel != undefined ) {
oLabel = $( oLabel );
}
if( oEle.hasClass( "ui-select-to-combobox" ) ) {
oEle = oEle.combobox( "getInput" );
}
oEle.removeAttr( "data-imederror" );
if( bSet ) {
oEle.addClass( "imedError" );
if( oLabel != undefined ) {
oLabel.addClass( "imedError" );
}
if( sMsg != "" ) {
if( oEle.attr( "data-imederror" ) == undefined ) {
oEle.attr( "data-imederror", oEle.attr( "title" ) );
}
oEle.attr( "title", sMsg );
if( oLabel != undefined ) {
if( oLabel.attr( "data-imederror" ) == undefined ) {
oLabel.attr( "data-imederror", oLabel.attr( "title" ) );
}
oLabel.attr( "title", sMsg );
}
if( oRadio_arr != undefined ) {
for( i = 0; i < oRadio_arr.length; i++ ) {
var eleF1 = $( oRadio_arr[ i ] );
if( eleF1.attr( "data-imederror" ) == undefined ) {
eleF1.attr( "data-imederror", eleF1.attr( "title" ) );
}
eleF1.addClass( "imedError" ).attr( "title", sMsg );
oRadioLabel = $( "label[for='" + eleF1.attr( "id" ) + "']" );
if( oRadioLabel ) {
oRadioLabel.addClass( "imedError" );
if( oRadioLabel.attr( "data-imederror" ) == undefined ) {
oRadioLabel.attr( "data-imederror", oRadioLabel.attr( "title" ) );
}
oRadioLabel.attr( "title", sMsg );
}
}
}
}
} else {
oEle.removeClass( "imedError" );
if( oEle.attr( "data-imederror" ) != undefined ) {
oEle.attr( "title", oEle.attr( "data-imederror" ) );
oEle.removeAttr( "data-imederror" );
}
if( oLabel != undefined ) {
oLabel.removeClass( "imedError" );
if( oLabel.attr( "data-imederror" ) != undefined ) {
oLabel.attr( "title", oLabel.attr( "data-imederror" ) );
oLabel.removeAttr( "data-imederror" );
}
}
if( oRadio_arr != undefined ) {
for( i = 0; i < oRadio_arr.length; i++ ) {
var eleF2 = $( oRadio_arr[ i ] );
eleF2.removeClass( "imedError" );
if( eleF2.attr( "data-imederror" ) != undefined ) {
eleF2.attr( "title", $( oRadio_arr[ i ] ).attr( "data-imederror" ) );
eleF2.removeAttr( "data-imederror" );
}
oRadioLabel = $( "label[for='" + eleF2.attr( "id" ) + "']" );
if( oRadioLabel ) {
oRadioLabel.removeClass( "imedError" );
if( oRadioLabel.attr( "data-imederror" ) != undefined ) {
oRadioLabel.attr( "title", oRadioLabel.attr( "data-imederror" ) );
oRadioLabel.removeAttr( "data-imederror" );
}
}
}
}
}
if( bSet && sMsg != "" ) {
if( bWithAlert ) {
frameworkMsgAlert( 0, sMsg, "Fehler", ALERT_ERROR );
} else {
if( oLabel != undefined && $.trim( oLabel.text() ) != "" ) {
sMsg = $.trim( oLabel.text() ) + ": " + sMsg;
}
m_frameworkFieldErrors_arr.push( sMsg );
}
}
} catch( e ) {
}
}
/**
* Resets all field error messages.
* @created thomas, 24.06.2016
*/
function frameworkResetFieldErrors()
{
m_frameworkFieldErrors_arr = [];
}
/**
* Adds a single field error message without field.
* Use this function to show messages e.g. to show problems on interfaces.
* @param sMsg
* @created thomas, 05.07.2016
*/
function frameworkSetFieldErrorMessageWithoutField( sMsg )
{
m_frameworkFieldErrors_arr.push( $.trim( sMsg ) );
}
/**
* Marks a field with an error.
* @param sEleID ID of the element.
* @param bSet Set true to mark the field as invalid or set false to remove the error mark.
* @param sMsg Error message.
* @param bWithAlert Set true to show the message in alert box.
*/
function frameworkSetFieldError( sEleID, bSet, sMsg, bWithAlert )
{
var oEle = $( "#" + sEleID );
var oLabel = $( "label[for='" + sEleID + "']" );
var oRadio_arr = $( "input[name='" + sEleID + "']" );
var oRadio = [];
for( var i = 0; i < oRadio_arr.length; i++ ) {
if( $( oRadio_arr[ i ] ).attr( "type" ) == "radio" ) {
oRadio.push( oRadio_arr[ i ] );
}
}
frameworkSetFieldErrorFromElement( oEle, bSet, sMsg, bWithAlert, oLabel.length > 0 ? oLabel : undefined, oRadio.length > 0 ? oRadio : undefined );
}
/**
* Creates a message with all field errors since last frameworkResetFieldErrors call.
* @param sMsg
* @param lType
* @param bShowNotification
* @created thomas, 24.06.2016
*/
function frameworkShowFieldErrorMsg( sMsg, lType, bShowNotification )
{
if( sMsg == undefined ) {
sMsg = "";
} else {
sMsg += " ";
}
if( lType == undefined ) {
lType = ALERT_ERROR;
}
if( bShowNotification == undefined ) {
bShowNotification = false;
}
for( var i = 0;i < m_frameworkFieldErrors_arr.length;i++ ) {
sMsg += " " + m_frameworkFieldErrors_arr[ i ];
}
if( !bShowNotification ) {
frameworkMsgAlert( 0, sMsg, "", lType );
} else {
frameworkShowMessage( sMsg, lType );
}
}
/**
* Check if touch handling inside the browser is available.
* @returns
* @created thomas, 13.02.2016
*/
function frameworkTouchAvailable() {
return 'ontouchstart' in window; // works on most browsers
}
/**
* @param lModuleID
* @param sDivClass
* @param sBtnClass
* @param sOnClickAttr
* @created thomas, 23.05.2016
*/
function frameworkRegisterGlobalCtxMenu( lModuleID, sDivClass, sBtnClass, sOnClickAttr )
{
if( sOnClickAttr == undefined ) {
sOnClickAttr = "onclick";
}
$( "#DIV_MODULE_" + lModuleID )
.undelegate( "." + sDivClass, "contextmenu" )
.delegate( "." + sDivClass, "contextmenu", function ( e )
{
frameworkOpenGlobalCtxMenu( e.currentTarget, e.pageX, e.pageY, sDivClass, sBtnClass, sOnClickAttr )
} );
}
/**
* Closes the context menu.
* @created thomas, 23.05.2016
**/
function frameworkCloseGlobalCtxMenu()
{
if( m_frameworkGlobalCtxMenu != false ) {
$( m_frameworkGlobalCtxMenu ).remove();
m_frameworkGlobalCtxMenu = false;
}
}
/**
* Opens the context menu of action buttons.
* @param oElement
* @param lPageX
* @param lPageY
* @param sCtxClass
* @param sBtnClass
* @param sOnClickAttr
* @created thomas, 23.05.2016
*/
function frameworkOpenGlobalCtxMenu( oElement, lPageX, lPageY, sCtxClass, sBtnClass, sOnClickAttr )
{
oElement = $( oElement );
while( !oElement.hasClass( sCtxClass ) && oElement.prop( "tagName" ).toLowerCase() != "body" ) {
oElement = $( oElement ).parent();
}
if( !oElement.hasClass( sCtxClass ) ) {
return;
}
var sCtx = "";
var oButtons_arr = $( oElement ).find( "." + sBtnClass );
for( var i = 0;i < oButtons_arr.length;i++ ) {
var oButton = $( oButtons_arr[ i ] );
if( oButton.is( ":visible" ) ) {
sCtx += '