' +
'
' + '
' + '
';
$( sWaitingDialog ).appendTo( 'body' );
}
// Progress bar.
if( iPos < 100 ) {
var oSplash;
if( sMsg.length > 0 || global_IS_MOBILE ) {
// Message text.
if( sMsg && sMsg.length > 0 ) {
$( '#PROGRESS_MSG_FRAMEWORK' ).html( sMsg );
} else {
$( '#PROGRESS_MSG_FRAMEWORK' ).html( 'Bitte warten ...' );
}
// Cancel button.
if( bAbortPossible ) {
$( '#BTN_PROGRESS_BAR_CANCEL_FRAMEWORK' ).show();
} else {
$( '#BTN_PROGRESS_BAR_CANCEL_FRAMEWORK' ).hide();
}
oSplash = $( '#SPLASH_FRAMEWORK' );
if( oSplash.length == 0 || !oSplash.is( ':visible' ) ) {
if( bAllowClick ) {
hideProgressBackground( true );
} else if( bDisplayBackground && (iPos < 100) ) {
displayProgressBackground( false );
} else {
displayProgressBackground( true );
}
}
if( global_IS_MOBILE ) {
// Do nothing.
} else if( iPos < 1 ) {
$( '#DIV_PROGRESS_BAR_FRAMEWORK' )
.css( 'background-image', 'url(framework/img/pbar-ani.gif)' )
.progressbar( {value: -1} )
.show();
} else {
$( '#DIV_PROGRESS_BAR_FRAMEWORK' )
.css( 'background-image', '' )
.progressbar( {value: iPos} )
.show();
}
if( global_IS_MOBILE ) {
} else {
var oDialog = oEleProgress;
oDialog
.css( 'top', $( document ).scrollTop() + (($( window ).height() - $( oDialog ).height()) / 2) )
.css( 'left', $( document ).scrollLeft() + (($( window ).width() - $( oDialog ).width()) / 2) )
.zIndex( frameworkGetZIndexMax() + 2 )
.show();
}
} else {
oSplash = $( '#SPLASH_FRAMEWORK' );
if( oSplash.length == 0 || !oSplash.is( ':visible' ) ) {
if( bAllowClick ) {
hideProgressBackground( true );
} else if( bDisplayBackground && (iPos < 100) ) {
displayProgressBackground( false, true );
} else {
displayProgressBackground( true, true );
}
}
if( iPos < 1 ) {
$( '#PROGRESS_FRAMEWORK_HOURGLASS_BAR' )
.css( 'background-image', 'url(framework/img/pbar-ani.gif)' )
.progressbar( {value: -1} )
.show();
} else {
$( '#PROGRESS_FRAMEWORK_HOURGLASS_BAR' )
.css( 'background-image', '' )
.progressbar( {value: iPos} )
.show();
}
oEleHourglass.show();
}
} else {
frameworkHideWaitingScreenTimer = window.setTimeout( hideWaitingScreen, 100 );
}
}
function hideWaitingScreen()
{
// pmi, 03.03.2014: these elements are not present in every case ... (f. e. in display for mobile apps)
if( document.getElementById( 'PROGRESS_FRAMEWORK' ) ) {
$( '#PROGRESS_FRAMEWORK' ).hide();
hideProgressBackground( false );
}
if( document.getElementById( 'PROGRESS_FRAMEWORK_HOURGLASS' ) ) {
$( "#PROGRESS_FRAMEWORK_HOURGLASS" ).hide();
hideProgressBackground( false );
}
}
/**
* frameworkAddModuleID
* @description Adds a module to the module list.
* @created pmi, 26.09.2012:
* @modified thomas, 18.10.2012
*/
function frameworkAddModuleID( iModuleID, sModuleType )
{
//P( 'Add module ' + iModuleID + ' (type=' + sModuleType + ')', P_DEBUG, 'IMEDFramework', 'frameworkAddModuleID' );
for( var i = 0; i < oFrameworkNewModules_arr.length; i++ ) {
if( oFrameworkNewModules_arr[ i ].m_lModuleID == iModuleID ) {
// The module is already in the list.
return true;
}
}
var oModule = new frameworkModule();
oModule.m_lModuleID = iModuleID;
if( sModuleType != undefined ) {
oModule.m_sModuleType = sModuleType;
}
// Add the module to the list of new modules.
oFrameworkNewModules_arr.push( oModule );
return true;
}
/**
* @created pmi, 26.09.2012:
* @modified thomas, 18.10.2012
* */
function frameworkDelModuleID( iModuleID )
{
// thomas, 17.10.2012
frameworkModuleListRemoveModule( iModuleID );
// thomas, 12.04.2016
frameworkUnregisterKey( iModuleID );
// thomas, 11.12.2012: Close old module.
var funcName = 'AfterCloseModule_' + iModuleID;
eval( "if( typeof( " + funcName + " ) == 'function' ){" + funcName + "(); }" );
funcName = 'RemoveModuleFunctions_' + iModuleID;
eval( "if( typeof( " + funcName + " ) == 'function' ){" + funcName + "(); }" );
return true;
}
/**
* frameworkModuleListCreateArray
* @description Creates an array from module list to step through all modules in one loop.
* @param oModule (optional) frameworkModule
* @param lLevel (optional) Recursion level
* @created thomas, 18.10.2012
*/
function frameworkModuleListCreateArray( oModule, lLevel )
{
// Handles optional parameters.
if( oModule == undefined ) {
oModule = oFrameworkRootModule;
}
if( lLevel == undefined ) {
lLevel = 0;
}
var oReturn_arr = [];
for( var i = 0; i < oModule.m_oChildModules_arr.length; i++ ) {
// Adds the current module to the array.
oReturn_arr.push( oModule.m_oChildModules_arr[ i ].m_lModuleID );
if( lLevel < 100 ) {
// Adds all child modules recursively.
var oTmp_arr = frameworkModuleListCreateArray( oModule.m_oChildModules_arr[ i ] );
oReturn_arr = oReturn_arr.concat( oTmp_arr );
} else {
P( 'Maximal recursion reached.', P_ERROR, 'IMEDFramework', 'frameworkModuleListCreateArray' );
}
}
return oReturn_arr;
}
/**
* frameworkModuleListGetParentFromHtml
* @description Searches the parent module ID from HTML code.
* @param oModule
* @created thomas, 18.10.2012
*/
function frameworkModuleListGetParentFromHtml( oModule )
{
// Root parent ID.
var iParent = -1;
// Loads the module to search the parent from.
var oHtmlModule = $( '#DIV_MODULE_' + oModule.m_lModuleID );
// This counter is needed to prevent dead locks.
// Maximal 100 iterations are allowed.
var cnt = 0;
if( oHtmlModule.length > 0 ) {
iParent = 0;
do {
cnt++;
// Loads the parent HTML tag of the current one.
oHtmlModule = $( oHtmlModule ).parent();
if( oHtmlModule.length ) {
// Checks if the module has an ID.
var sId = $( oHtmlModule ).attr( 'id' );
if( sId ) {
// Checks if the ID is a valid module ID.
if( sId.indexOf( 'DIV_MODULE_' ) == 0 ) {
var sSplit_arr = sId.split( '_' );
// Parent found.
iParent = sSplit_arr[ sSplit_arr.length - 1 ];
}
}
}
} while( oHtmlModule.length && iParent == 0 && cnt < 100 );
if( cnt == 100 ) {
P( 'Maximal level of tags to scan reached.', P_ERROR, 'IMEDFramework', 'frameworkModuleListGetParentFromHtml' );
}
}
return iParent;
}
/**
* frameworkModuleListGetModule
* @description Searches the module structure of the module ID.
*
* !!! Call function frameworkModuleListUpdate() before to be sure that
* the module list is up to date. !!!
*
* @param iModuleID ID of the module.
* @param oModule (optional) Module to check.
* @param lLevel (optional) Recursion level.
* @created thomas, 17.10.2012
*/
function frameworkModuleListGetModule( iModuleID, oModule, lLevel )
{
// Handles optional parameters.
if( oModule == undefined ) {
oModule = oFrameworkRootModule;
}
if( lLevel == undefined ) {
lLevel = 0;
}
// Searches in all child modules to find the module with ID=iModuleID
for( var i = 0; i < oModule.m_oChildModules_arr.length; i++ ) {
if( oModule.m_oChildModules_arr[ i ].m_lModuleID == iModuleID ) {
// Module found.
return oModule.m_oChildModules_arr[ i ];
} else {
if( lLevel < 100 ) {
// Searches in all child modules recursively.
var oTmp = frameworkModuleListGetModule( iModuleID, oModule.m_oChildModules_arr[ i ], lLevel + 1 );
if( oTmp != false ) {
return oTmp;
}
} else {
P( 'Maximal recursion reached.', P_ERROR, 'IMEDFramework', 'frameworkModuleListGetModule' );
}
}
}
return false;
}
/**
* frameworkModuleListRemoveModule
* @description Removes a module from array.
* @param iModuleID ID of the module.
* @param oModule (optional) Module to check.
* @param lLevel (optional) Recursion level.
* @return Module object, false if it does not exist.
* @created thomas, 17.10.2012
*/
function frameworkModuleListRemoveModule( iModuleID, oModule, lLevel )
{
//niklas, 04.03.2015: Unregister Module from Push
frameworkPushUnregisterModule( iModuleID );
// Handles optional parameters.
if( oModule == undefined ) {
oModule = oFrameworkRootModule;
}
if( lLevel == undefined ) {
lLevel = 0;
}
// Searches the module to remove.
for( var i = 0; i < oModule.m_oChildModules_arr.length; i++ ) {
if( oModule.m_oChildModules_arr[ i ].m_lModuleID == iModuleID ) {
//P( 'Remove module ' + iModuleID, P_DEBUG, 'IMEDFramework', 'frameworkModuleListRemoveModule' );
// Removes the module from parent module.
var oChild = oModule.m_oChildModules_arr[ i ];
oModule.m_oChildModules_arr.splice( i, 1 );
// Returns the removed module.
return oChild;
} else {
if( lLevel < 100 ) {
// Searches in all child modules recursively.
var oTmp = frameworkModuleListRemoveModule( iModuleID, oModule.m_oChildModules_arr[ i ], lLevel + 1 );
if( oTmp != false ) {
// oTmp include the child module.
return oTmp;
}
} else {
P( 'Maximal recursion reached.', P_ERROR, 'IMEDFramework', 'frameworkModuleListRemoveModule' );
}
}
}
return false;
}
/**
* frameworkModuleListAddChild
* @description Adds a module as child to another module.
* @param oModule
* @param iParentID ID of the parent module.
* @created thomas, 17.10.2012
*/
function frameworkModuleListAddChild( oModule, iParentID )
{
var bReturn = false;
// Check if the modules is already in array.
var oChild = frameworkModuleListRemoveModule( oModule.m_lModuleID );
if( !oChild ) {
oChild = oModule;
}
if( iParentID == 0 ) {
//P( 'Add module ' + oModule.m_lModuleID + ' (' + oModule.m_sModuleType + ') as root module.', P_DEBUG, 'IMEDFramework', 'frameworkModuleListAddChild' );
// Checks if the module is already in array.
oFrameworkRootModule.m_oChildModules_arr.push( oChild );
bReturn = true;
} else {
// Load the parent module.
var oParent = frameworkModuleListGetModule( iParentID );
if( oParent != false ) {
//P( 'Add module ' + oModule.m_lModuleID + ' (' + oModule.m_sModuleType + ') to module ' + iParentID, P_DEBUG, 'IMEDFramework', 'frameworkModuleListAddChild' );
oParent.m_oChildModules_arr.push( oChild );
bReturn = true;
}
}
return bReturn;
}
/**
* frameworkModuleListGetParent
* @description Searches the parent of a module.
* @param iModuleID ID of the module.
* @param oModule (optional) Module to check.
* @param lLevel (optional) Recursion level.
* @created thomas, 18.10.2012
*/
function frameworkModuleListGetParent( iModuleID, oModule, lLevel )
{
// Handles optional parameters.
if( oModule == undefined ) {
oModule = oFrameworkRootModule;
}
if( lLevel == undefined ) {
lLevel = 0;
}
for( var i = 0; i < oModule.m_oChildModules_arr.length; i++ ) {
if( oModule.m_oChildModules_arr[ i ].m_lModuleID == iModuleID ) {
// Parent module found.
return oModule.m_oChildModules_arr[ i ];
} else {
if( lLevel < 100 ) {
// Search recursively in child modules.
var oTmp = frameworkModuleListGetParent( iModuleID, oModule.m_oChildModules_arr[ i ], lLevel );
if( oTmp ) {
return oTmp;
}
} else {
P( 'Maximal recursion reached.', P_ERROR, 'IMEDFramework', 'frameworkModuleListGetParent' );
}
}
}
return false;
}
/**
* frameworkModuleListUpdate
* @description Resorts the module in the module list to set the correct order
* of resizing modules.
* @created thomas, 11.10.2012
*/
function frameworkModuleListUpdate()
{
var i, iParent;
// thomas, 19.11.2012: Special update for modules below "Framework"
for( i = 0; i < oFrameworkRootModule.m_oChildModules_arr.length; i++ ) {
var oModule = oFrameworkRootModule.m_oChildModules_arr[ i ];
if( oModule.m_sModuleType == 'Framework' ) {
for( var j = 0; j < oModule.m_oChildModules_arr.length; j++ ) {
iParent = frameworkModuleListGetParentFromHtml( oModule.m_oChildModules_arr[ j ] );
if( iParent != oModule.m_lModuleID ) {
frameworkModuleListAddChild( oModule.m_oChildModules_arr[ j ], iParent );
}
}
}
}
if( oFrameworkNewModules_arr.length > 0 ) {
//P( 'Add ' + oFrameworkNewModules_arr.length + ' modules to sorted array.', P_DEBUG, 'IMEDFramework', 'frameworkModuleListUpdate' );
var lCnt = 0;
var lRound = 0;
// Steps through all new modules.
// If the parent of a module can not be found, it is handled in next step.
// The loop runs as long as at least one module can be added to its parent.
while( oFrameworkNewModules_arr.length > 0 && lCnt != oFrameworkNewModules_arr.length ) {
lRound++;
//P( 'There are ' + oFrameworkNewModules_arr.length + ' modules to sort.', P_DEBUG, 'IMEDFramework', 'frameworkModuleListUpdate' );
lCnt = oFrameworkNewModules_arr.length;
// Tries to add the modules to the array.
//PObj( 'Handle round ' + lRound, oFrameworkNewModules_arr, P_DEBUG, 'IMEDFramework', 'frameworkModuleListUpdate' );
for( i = 0; i < oFrameworkNewModules_arr.length; i++ ) {
if( $( "#DIV_MODULE_" + oFrameworkNewModules_arr[ i ].m_lModuleID ).length <= 0 ) {
continue;
}
// Adds the module to its parent.
iParent = frameworkModuleListGetParentFromHtml( oFrameworkNewModules_arr[ i ] );
if( iParent != -1 ) {
if( frameworkModuleListAddChild( oFrameworkNewModules_arr[ i ], iParent ) ) {
//P( 'Add module ' + oFrameworkNewModules_arr[ i ].m_lModuleID + ' to parent module ' + iParent, P_DEBUG, 'IMEDFramework', 'frameworkModuleListUpdate' );
oFrameworkNewModules_arr.splice( i, 1 );
i--;
}
} else {
oFrameworkNewModules_arr[ i ].m_lErrCnt++;
// Workaround: Removes lost modules.
if( oFrameworkNewModules_arr[ i ].m_lErrCnt >= 20 ) {
P( 'Remove orphaned module ' + oFrameworkNewModules_arr[ i ].m_lModuleID + ' (' + oFrameworkNewModules_arr[ i ].m_sModuleType + ')', P_WARNING, 'IMEDFramework', 'frameworkModuleListGetParentFromHtml' );
oFrameworkNewModules_arr.splice( i, 1 );
i--;
}
}
}
}
}
}
function frameworkOnResizeWindow()
{
frameworkOnResizeWindowNow();
}
function frameworkInit( sSID, bNoIncludes, bMobile )
{
// pmi, 03.03.2014: move ajaxx-init script to upper part of this function (mobile version doesnt need the rest ...)
if( !bNoIncludes ) {
addCSS( "framework/include/css/imed.css" );
addJavascript( "./include/lib/js/IMEDTableClass.js", "ImedTableJS?VER=" + global_VERSIONKEY, true, sSID );
addJavascript( "./include/lib/js/IMEDTree.js", "ImedTreeJS?VER=" + global_VERSIONKEY, true, sSID );
addJavascript( "./include/lib/js/IMEDDragNDrop.js", "ImedDragNDropJS?VER=" + global_VERSIONKEY, true, sSID );
}
if( 'undefined' == typeof xajax ) {
xajax = {};
xajax.config = {};
xajax.config.requestURI = "frameworkXajax.php?SID=" + sSID;
xajax.config.statusMessages = false;
xajax.config.waitCursor = false;
xajax.config.version = "xajax 0.5 rc2 Framework";
xajax.config.legacy = false;
xajax.config.defaultMode = "synchronous";
xajax.config.defaultMethod = "POST";
addJavascript( "./framework/include/lib/xajax0_5_rc2/xajax_js/xajax_core.js?VER=" + global_VERSIONKEY, "XAjaxCore", false, sSID );
if( global_DEBUG > 0 ) {
addJavascript( "./framework/include/lib/xajax0_5_rc2/xajax_js/xajax_debug.js?VER=" + global_VERSIONKEY, "XAjaxDebug", false, sSID );
xajax.debug.writeMessage = function ( text, prefix, cls )
{
/*if( 'undefined' == typeof prefix ) {
prefix = '';
}*/
if( 'undefined' == typeof cls ) {
cls = 'debugText';
}
if( 'undefined' == typeof text ) {
return;
}
if( cls == "errorText" ) {
frameworkXAjaxError_arr[ frameworkXAjaxError_arr.length ] = "
" + text + "";
for( var i = 0; i < frameworkXAjaxDebug_arr.length; ++i ) {
frameworkXAjaxError_arr[ frameworkXAjaxError_arr.length ] = frameworkXAjaxDebug_arr[ i ];
}
} else {
if( frameworkXAjaxDebug_arr.length > 1 ) {
frameworkXAjaxDebug_arr.shift();
}
frameworkXAjaxDebug_arr[ frameworkXAjaxError_arr.length ] = text;
}
}
}
}
jQuery.extend( jQuery.expr[ ":" ], {
reallyvisible: function ( a )
{
return !(jQuery( a ).is( ':hidden' ) || jQuery( a ).parents( ':hidden' ).length);
}
} );
$( window ).resize( function ()
{
frameworkOnResizeWindowNow();
} );
frameworkOnResizeWindowNow();
}
/**
* frameworkUpdateTimeout
* @description Updates the timer to show a message if autologout is fired.
* @created thomas, 03.01.2013
* @changed dz, 03.04.2014: use standard alert when mobile for compatibility reasons
*/
function frameworkUpdateTimeout( lMinutes, sVersionKey )
{
//P( 'Set timeout to ' + lMinutes + ' minutes.', P_DEBUG, 'IMEDFramework.tpl.js', 'frameworkUpdateTimeout' );
clearTimeout( frameworkTimeout );
// Call the timeout handler in 1 minute.
frameworkTimeoutEnd = ( new Date().getTime() ) + ( lMinutes * 60 * 1000 );
frameworkHandleTimeout();
if( sVersionKey != undefined ) {
if( frameworkTimeoutVersionKeyTmr == false && sVersionKey != global_VERSIONKEY ) {
frameworkTimeoutVersionKeyTmr = true;
window.setTimeout( "frameworkTimeoutVersionKeyTmr = false;", 1000 * 60 * 60 * 10 );
frameworkMsgConfirm( 0, '[i/med] Web wurde aktualisiert. Sie müssen sich abmelden und anschließend erneut anmelden.', '', ALERT_WARNING, 'frameworkTimeoutVersionKey', [], 'Jetzt abmelden', 'Später abmelden' );
}
}
}
function frameworkTimeoutVersionKey( lModuleID )
{
window.location = "?LOGOUT=1";
}
/**
* frameworkOnClickRefreshTimeout
* @description Refreshes the timeout.
* @created thomas, 03.01.2013
*/
function onClickRefreshTimeout( lModuleID )
{
clearTimeout( frameworkTimeoutKill );
displayWaitingScreen( 0 );
xajax_XCallback_TimeoutRefresh();
displayWaitingScreen( 100 );
}
/**
* frameworkHandleTimeout
* @description Handles the automatic timeout.
* @created thomas, 08.10.2014
*/
function frameworkHandleTimeout()
{
clearTimeout( frameworkTimeoutKill );
clearTimeout( frameworkTimeout );
var oTime = new Date();
var lNow = ( oTime.getTime() );
if( lNow >= frameworkTimeoutEnd ) {
frameworkTimeoutKill = window.setTimeout( frameworkKillTimeout, 1000 * 60 * 4 );
frameworkMsgAlert( 0, 'Sie waren seit längerer Zeit inaktiv. Daher läuft Ihre [i/med] Web Session in wenigen Minuten ab. Klicken Sie innerhalb dieser Zeit auf OK. Ansonsten werden Sie aus Sicherheitsgründen automatisch aus dem System ausgeloggt.', 'Informationen über aktuelle Sitzung:', ALERT_WARNING, 'onClickRefreshTimeout' );
} else {
//var lTmp = ( frameworkTimeoutEnd - lNow ) / ( 60 * 1000 );
//P( "Timeout in " + Math.ceil( lTmp ) + " minutes" );
frameworkTimeout = window.setTimeout( frameworkHandleTimeout, 1000 * 60 );
}
}
/**
* Closes the application.
* @created thomas, 30.06.2015
*/
function frameworkKillTimeout()
{
alert( "Ihre [i/med] Web Session ist abgelaufen. Sie wurden automatisch aus dem System ausgeloggt. Dieser Vorgang dient Ihrer eigenen Sicherheit und kann mehrere Ursachen haben. Bitte melden Sie sich erneut an ..." );
window.location = "?LOGOUT=1";
}
/**
* Adds a dialog.
* Call this function after jQuery.dialog(open).
* @created thomas, 27.06.2012
*/
function frameworkAddDialog( sId )
{
//P( 'Add "' + sId + ' to dialog array', P_DEBUG, 'IMEDFramework', 'frameworkAddDialog' );
var dialog = $( '#' + sId );
if( dialog.length > 0 ) {
if( dialog.length > 1 ) {
P( 'Multiple dialogs "' + sId + '"', P_ERROR, 'IMEDFramework', 'frameworkAddDialog' );
} else {
$( dialog ).addClass( 'dialoghandler_' + sId );
}
}
frameworkDialogs.push( sId );
}
/**
* Removes a single dialog.
* Set sId=false and sModuleID!=false to remove all dialogs of the module.
* Call this function before jQuery.dialog(open) to prevent duplicate instances with the same ID.
* @created thomas, 27.06.2012
* @modified thomas, 26.02.2013: Moved from LaborderHistory to IMEDFramework to use in all modules.
*/
function frameworkRemoveDialog( sId, sModuleID, bForce )
{
var i;
if( sId == undefined ) {
sId = false;
}
if( sModuleID == undefined ) {
sModuleID = false;
}
if( bForce == undefined ) {
bForce = false;
}
if( sId != false ) {
var element = $( '#' + sId );
if( element.length > 0 ) {
element = element[ 0 ];
var ele = $( element );
if( ele.hasClass( 'dialoghandler_' + sId ) ) {
ele.removeClass( 'dialoghandler_' + sId );
try {
ele.dialog( 'destroy' );
} catch( e ) {
}
}
ele.attr( 'id', 'FRAMEWORK_REMOVE_DIALOG' );
// Search duplicate DOM nodes.
var destroy = [];
do {
destroy = $( '#' + sId );
if( destroy.length > 0 ) {
//P( 'Duplicate dialog "' + sId + '" found.', P_ERROR, 'IMEDFramework', 'frameworkRemoveDialog' );
$( destroy[ 0 ] ).remove();
}
} while( destroy.length > 0 );
if( bForce ) {
ele.remove();
} else {
ele.attr( 'id', sId );
}
}
// Updates the dialog list.
for( i = 0; i < frameworkDialogs.length; i++ ) {
if( frameworkDialogs[ i ] == sId ) {
frameworkDialogs.splice( i, 1 );
i--;
}
}
} else if( sModuleID != false ) {
// If no ID is set, all dialogs of the module have to be removed.
var sTmp_arr = frameworkDialogs;
//PObj( 'Remove all dialogs of module "' + sModuleID + '"', frameworkDialogs, P_DEBUG, 'IMEDFramework', 'frameworkRemoveDialog' );
for( i = 0; i < sTmp_arr.length; i++ ) {
var sTmp = sTmp_arr[ i ].split( '_' );
if( sTmp[ sTmp.length - 1 ] == sModuleID ) {
//P( 'Remove dialog "' + sTmp_arr[ i ] + '" of module "' + sModuleID + '"', P_DEBUG, 'IMEDFramework', 'frameworkRemoveDialog' );
frameworkRemoveDialog( sTmp_arr[ i ], false, bForce );
}
}
}
}
/**
* Removes the title bar of a dialog.
* @param sId
*/
function frameworkRemoveDialogTitlebar( sId )
{
$( "#" + sId ).parent().find( ".ui-dialog-titlebar" ).hide();
}
/**
* frameworkGetZIndex
* @description Creates the z-index of an element.
* @created thomas, 05.04.2013
*/
function frameworkGetZIndex( lType )
{
P( "Function frameworkGetZIndex is deprecated. Do not modify z-index!", P_DEBUG );
return 0;
}
/**
* Shows a message at the top of the framework.
* @param sMsg
* @param lType
* @param lTimeout
* @param bAppend
* @param sImg
* @param sCallback
* @created thomas, 24.07.2013
* @modified thomas, 27.04.2017: Param sCallbackFunction added.
*/
function frameworkShowMessage( sMsg, lType, lTimeout, bAppend, sImg, sCallback )
{
if( lTimeout == undefined ) {
lTimeout = 5000;
}
if( bAppend == undefined ) {
bAppend = true;
}
if( sCallback == undefined ) {
sCallback = "";
}
// thomas, 15.02.2016: Extracts message type and message level from lType param.
var lMsgLevel = lType & PUSHMSG_MASK;
if( lMsgLevel == 0 ) {
if( lType == ALERT_ERROR || lType == ALERT_WARNING ) {
lMsgLevel = PUSHMSG_IMPORTANT;
} else {
lMsgLevel = PUSHMSG_ALL;
}
}
lType = lType & ALERT_MASK;
// thomas, 15.02.2016: Skip message because of user settings.
if( global_PUSHMSGLEVEL < lMsgLevel ) {
return;
}
if( sImg == undefined ) {
sImg = 'frameworkicon32 frameworkicon-32-alert-info';
if( lType == ALERT_OK ) {
sImg = 'frameworkicon32 frameworkicon-32-alert-ok';
} else if( lType == ALERT_WARNING ) {
sImg = 'frameworkicon32 frameworkicon-32-alert-warning';
} else if( lType == ALERT_ERROR ) {
sImg = 'frameworkicon32 frameworkicon-32-alert-error';
}
}
sMsg = sMsg.replace( /\n/g, "
" );
var sClass = '';
if( lType == ALERT_WARNING ) {
sClass = 'ui-state-highlight ui-corner-all';
} else if( lType == ALERT_ERROR ) {
sClass = 'ui-state-error ui-corner-all';
} else if( lType == ALERT_OK ) {
//sClass = 'ui-state-ok ui-corner-all';
sClass = 'ui-state-default ui-corner-all';
} else {
sClass = 'ui-state-default ui-corner-all';
}
if( frameworkMsg == false ) {
frameworkMsg = $( '
' )
.css( 'bottom', '0px' )
.css( 'float', 'left' )
.css( 'padding', '0' )
.css( 'position', 'absolute' )
.css( 'width', '300px' )
.css( 'font-weight', 'bold' )
.css( 'overflow-x', 'auto' )
.css( 'z-index', 999999 )
.appendTo( 'body' );
}
$( frameworkMsg )
.css( 'max-height', $( document ).height() )
.css( 'left', $( window ).width() - 320 );
if( !bAppend ) {
$( frameworkMsg ).html( '' );
}
// thomas, 15.02.2017: Creates the hash from message content to remove duplicate messages.
var sHash = sMsg + ":" + lType + ":";
if( sImg != undefined ) {
sHash += sImg;
}
sHash = "pushmsg" + getHashFromString( sHash );
frameworkMsgCnt++;
var sID = 'frameworkMsg_' + frameworkMsgCnt;
var sCode = '
';
if( sImg != undefined ) {
sCode += '';
if( sImg.indexOf( "imedicon" ) == 0 || sImg.indexOf( "frameworkicon" ) == 0 ) {
sCode += '';
} else {
sCode += '';
}
sCode += ' | ';
}
sCode += '' + sMsg + ' | |
';
if( sMsg != '' ) {
// thomas, 15.02.2017: Removes all messages with the same content.
$( frameworkMsg ).find( "." + sHash ).remove();
$( sCode )
.fadeIn( 250, function ()
{
} )
.click( function ( e )
{
if( sCallback != "" ) {
eval( sCallback );
}
$( 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 ) {
if( global_IS_MOBILE ) {
window.open( sUrl );
} else {
//$( "#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 title of a modal dialog.
* @param lModuleID
* @param sText
* @created thomas, 19.04.2017
*/
function frameworkModalUpdateTitleText( lModuleID, sText )
{
var oTitle = $( "#ui-id-" + lModuleID );
if( oTitle.length > 0 ) {
$( oTitle ).text( sText );
}
}
/**
* 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;
}
eval( "if( typeof( OnBeforeClose_" + lModuleID + " ) == 'function' ) { OnBeforeClose_" + lModuleID + "();} else {true;}" );
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 );
}
/**
* 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 sText Input text.
* @param sVariable Name of the variable.
* @param sParam List of params.
*/
function frameworkPromptVariable( lModuleID, sText, sVariable, sParam )
{
if( typeof( xajax_Framework_XCallback_OnPromptVariable ) == "function" ) {
displayWaitingScreen( 0 );
window.setTimeout( function ()
{
xajax_Framework_XCallback_OnPromptVariable( lModuleID, sVariable, sText, sParam );
displayWaitingScreen( 100 );
}, 0 );
}
}
/**
* 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
* @param sPlaceholder
* @modified thomas, 20.06.2017: Param sPlaceholder added.
*/
function frameworkMsgPromptMultiline( moduleid, message, title, value, callback, param, sLabelYes, sLabelNo, lMaxLength, lWidth, sPlaceholder )
{
$.promptmultiline( moduleid, message, title, value, callback, param, sLabelYes, sLabelNo, lMaxLength, lWidth, sPlaceholder );
}
/**
* 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_sPushID + ".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_sPushID + ".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" );
oEle.attr( "title", "" );
if( oEle.attr( "data-imederror" ) != undefined ) {
oEle.attr( "title", oEle.attr( "data-imederror" ) );
oEle.removeAttr( "data-imederror" );
}
if( oLabel != undefined ) {
oLabel.removeClass( "imedError" );
oLabel.attr( "title", "" );
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" );
eleF2.attr( "title", "" );
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" );
oRadioLabel.attr( "title", "" );
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_arr = $( "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 ] );
}
}
var oLabel2_arr = [];
for( var i = 0;i < oLabel_arr.length;i++ ) {
if( $( oLabel_arr[ i ] ).hasClass( "nofielderr" ) ) {
continue;
}
oLabel2_arr.push( oLabel_arr[ i ] );
}
frameworkSetFieldErrorFromElement( oEle, bSet, sMsg, bWithAlert, oLabel2_arr.length > 0 ? oLabel2_arr : 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 += '';
}
}
if( sCtx != "" ) {
frameworkShowGlobalCtxMenu( sCtx, lPageX, lPageY );
}
}
/**
* Shows the global context menu.
* @param sCtx
* @param lPageX
* @param lPageY
* @created thomas, 26.05.2016
*/
function frameworkShowGlobalCtxMenu( sCtx, lPageX, lPageY )
{
var bIsIESpecial = frameworkIsBrowser( BROWSER_IE7 ) | frameworkIsBrowser( BROWSER_IE8 );
frameworkCloseGlobalCtxMenu();
m_frameworkGlobalCtxMenu = $( '
' );
if( !bIsIESpecial
) {
m_frameworkGlobalCtxMenu.addClass( 'ui-widget' ).addClass( 'GlobalContext_ctx_main' ).css( 'top', lPageY ).css( 'left', lPageX ).css( 'z-index', 999999 );
}
var inner = $( '
' ).appendTo( m_frameworkGlobalCtxMenu );
if( !bIsIESpecial ) {
inner.addClass( 'ui-widget-content' ).addClass( 'ui-corner-all' );
}
$( sCtx ).appendTo( m_frameworkGlobalCtxMenu );
if( !bIsIESpecial ) {
$( m_frameworkGlobalCtxMenu ).appendTo( 'body' );
// Update the context menu position if it is out of range.
var width = m_frameworkGlobalCtxMenu.width();
var height = m_frameworkGlobalCtxMenu.height();
var window_width = $( window ).width();
var window_height = $( window ).height();
var diff_x = window_width - ( lPageX + width );
var diff_y = window_height - ( lPageY + height );
if( diff_x < 0 ) {
m_frameworkGlobalCtxMenu.css( 'left', lPageX - width - 15 );
}
if( diff_y < 0 ) {
var top = lPageY - height - 15;
if( top < 0 ) {
top = 0;
}
m_frameworkGlobalCtxMenu.css( 'top', top );
}
} else {
$( m_frameworkGlobalCtxMenu ).dialog( {
modal: true
} );
}
}
/**
* Sets the focus on a module.
* To use this function implement function OnFocusModule_TPL_MODULE_ID into the javascript code of the module.
* @param lModuleID
* @created thomas, 08.03.2017
*/
function frameworkSetFocusOnModule( lModuleID )
{
var bFunctionExist = false;
eval( "if( typeof( OnFocusModule_" + lModuleID + " ) == 'function' ) bFunctionExist = true;" );
if( bFunctionExist ) {
eval( "OnFocusModule_" + lModuleID + "();" );
return true;
} else {
var oDiv = $( "#DIV_MODULE_" + lModuleID );
var oFields_arr = oDiv.find( "textarea,input[type='text'],select" );
for( var i = 0;i < oFields_arr.length;i++ ) {
var bDisabled = $( oFields_arr[ i ] ).is( ":disabled" );
var bVisible = $( oFields_arr[ i ] ).is( ":visible" );
var bReadonly = ( $( oFields_arr[ i ] ).attr( "readonly" ) != undefined );
if( !bDisabled && bVisible && !bReadonly ) {
$( oFields_arr[ i ] ).focus();
return true;
}
}
}
return false;
}
/**
* Opens a dialog as button popup.
* @param sButtonID
* @param sDialogID
* @param lWidth
* @param lHeight
* @created thomas, 05.04.2017
*/
function frameworkOpenButtonPopup( sButtonID, sDialogID, lWidth, lHeight )
{
var oDialog = $( "#" + sDialogID );
var oButton = $( "#" + sButtonID );
var oParam = {
position: {
my: "center top",
at: "center bottom",
of: oButton,
collision: "flipfit"
},
close: function() {
oDialog.dialog( 'destroy' );
}
};
if( lWidth != undefined ) {
oParam[ "width" ] = lWidth;
}
if( lHeight != undefined ) {
oParam[ "height" ] = lHeight;
}
frameworkRemoveDialog( sDialogID );
oDialog.dialog( oParam );
frameworkRemoveDialogTitlebar( sDialogID );
frameworkAddDialog( sDialogID );
oButton.bind( "click", function( e ) {
e.stopPropagation();
});
oDialog.bind( "click", function( e ) {
e.stopPropagation();
});
$( "body" ).bind( "click", function () {
try {
oDialog.dialog( "close" );
} catch( e ) {
}
} );
}
/**
* Opens a URL in a new window with POST params.
* @param oParams
* @param sWindowName
* @param sUrl
* @created thomas, 05.04.2017
*/
function frameworkOpenWindowWithPostParams( oParams, sWindowName, sUrl )
{
if( oParams == undefined ) {
oParams = {};
}
if( sUrl == undefined ) {
sUrl = "framework.php?RELOAD=1";
}
var sKey = "tmppost";
var sForm = "
";
$( sForm ).appendTo( $( "body" ) );
var oForm = $( "#" + sKey );
window.open( "", sWindowName );
oForm.submit();
oForm.remove();
}
/**
* @param sUrl
* @param sCallbackFunc
* @param lModuleID
*/
function frameworkUpdateAsnycProgress( sUrl, sCallbackFunc, lModuleID )
{
$.ajax( {
url: sUrl + "?time=" + (new Date()).getTime()
}).done( function( sText ) {
var sSplit_arr = sText.split( "|" );
if( sSplit_arr.length >= 2 ) {
displayWaitingScreen( parseInt( sSplit_arr[ 0 ] ), sSplit_arr[ 1 ] );
}
if( lModuleID == undefined ) {
eval( sCallbackFunc + "();" );
} else {
eval( sCallbackFunc + "('" + lModuleID + "');" );
}
}).fail(function() {
displayWaitingScreen( 0, "Bitte warten ..." );
if( lModuleID == undefined ) {
eval( sCallbackFunc + "();" );
} else {
eval( sCallbackFunc + "('" + lModuleID + "');" );
}
});
}
}