diff --git a/lam/docs/devel/upgrade.htm b/lam/docs/devel/upgrade.htm index 73c0a15d..622888b9 100644 --- a/lam/docs/devel/upgrade.htm +++ b/lam/docs/devel/upgrade.htm @@ -7,6 +7,7 @@ + Upgrade notes @@ -32,10 +33,12 @@ This is a list of API changes for all LAM releases. new function supportsForcePasswordChange() and changed function passwordChangeRequested() to support password change at next login
-
  • getSelfServiceOptions()/checkSelfServiceOptions(): added parameter to specify if only password changes are allowed
    +
  • getSelfServiceOptions()/checkSelfServiceOptions(): added parameter to specify if only password changes are allowed
  • +
  • handleAjaxRequest(): This new function allows AJAX requests to be answered by modules
  • +
    diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index d579a631..0186f17c 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -1400,6 +1400,14 @@ abstract class baseModule { return null; } + /** + * Manages AJAX requests. + * This function may be called with or without an account container. + */ + public function handleAjaxRequest() { + // modules that use AJAX need to implement this function + } + // helper functions diff --git a/lam/templates/misc/ajax.php b/lam/templates/misc/ajax.php index c8edea25..8d559ecc 100644 --- a/lam/templates/misc/ajax.php +++ b/lam/templates/misc/ajax.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2011 Roland Gruber + Copyright (C) 2011 - 2012 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,6 +47,17 @@ class lamAjax { * Manages an AJAX request. */ public static function handleRequest() { + if (isset($_GET['module']) && isset($_GET['scope']) && in_array($_GET['module'], getAvailableModules($_GET['scope']))) { + if (isset($_GET['useContainer']) && ($_GET['useContainer'] == '1')) { + if (!isset($_SESSION['account'])) die(); + $module = $_SESSION['account']->getAccountModule($_GET['module']); + $module->handleAjaxRequest(); + } + else { + $module = new $_GET['module']($_GET['scope']); + $module->handleAjaxRequest(); + } + } if (!isset($_GET['function'])) { die(); }