Added function to Add Focusscript

This commit is contained in:
Andre Lorbach 2015-03-26 14:22:47 +01:00
parent 8927fdb890
commit fd3fccf008
4 changed files with 19 additions and 7 deletions

View File

@ -517,7 +517,7 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) )
// --- Check if Enable/Disable Button was clicked and add Autofocus code!
if ( isset($content['CHARTID']) && $content['CHARTID'] == $myChart['ID'] )
$content['EXTRA_JAVASCRIPT'] .= "<script>window.onload = function(){ document.getElementById('chartenablebutton" . $myChart['ID'] . "').focus(); };</script>";
AddWindowLoadFocus("chartenablebutton" . $myChart['ID']);
// ---
}
// ---

View File

@ -98,16 +98,16 @@ if ( isset($_GET['op']) && isset($_GET['value']) )
// Set UserOption
$USERCFG['UserOverwriteOptions'] = 1;
// Add some javascript to FOcus the enable/disable user button
$content['EXTRA_JAVASCRIPT'] .= "<script>window.onload = function(){ document.getElementById('buttonenableuseropt').focus(); };</script>";
// Focus the enable user button
AddWindowLoadFocus("buttonenableuseropt");
}
else
{
// Set UserOption
$USERCFG['UserOverwriteOptions'] = 0;
// Add some javascript to FOcus the enable/disable user button
$content['EXTRA_JAVASCRIPT'] .= "<script>window.onload = function(){ document.getElementById('buttondisableuseropt').focus(); };</script>";
// Focus the disable user button
AddWindowLoadFocus("buttondisableuseropt");
}

View File

@ -456,9 +456,9 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) )
$content['USERID'] == $content['USERS'][$i]['ID'] )
{
if ( $_GET['miniop'] == "setisadmin" )
$content['EXTRA_JAVASCRIPT'] .= "<script>window.onload = function(){ document.getElementById('userisadminbutton" . $content['USERS'][$i]['ID'] . "').focus(); };</script>";
AddWindowLoadFocus("userisadminbutton" . $content['USERS'][$i]['ID']);
else if ( $_GET['miniop'] == "setisreadonly" )
$content['EXTRA_JAVASCRIPT'] .= "<script>window.onload = function(){ document.getElementById('userisreadonlybutton" . $content['USERS'][$i]['ID'] . "').focus(); };</script>";
AddWindowLoadFocus("userisreadonlybutton" . $content['USERS'][$i]['ID']);
}
// ---

View File

@ -1529,6 +1529,18 @@ function AddContextLinks(&$sourceTxt)
$sourceTxt = preg_replace_callback( '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/i', "InsertLookupLinkIP", $sourceTxt );
}
/*
* AddContextLinks
*/
function AddWindowLoadFocus($szFieldID)
{
global $content;
// Add Javascript to Focus a specific element
$content['EXTRA_JAVASCRIPT'] .= "<script>window.onload = function(){ document.getElementById('" . $szFieldID . "').focus(); };</script>";
}
/*
* Helper to create a Lookup Link!
*/