From 84e5b750cba462a7ac04cf523c51d046340bd7b8 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 16 Feb 2010 17:32:48 +0000 Subject: [PATCH] upload post actions only for active modules --- lam/lib/modules.inc | 5 +++-- lam/templates/massBuildAccounts.php | 5 +++++ lam/templates/massDoUpload.php | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 7ee89b5c..d63a2e49 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -479,6 +479,7 @@ function buildUploadAccounts($scope, $data, $ids, $selectedModules) { * @param array $data array containing one account in each element * @param array $ids array( => ) * @param array $failed list of accounts which were not created successfully +* @param array $selectedModules list of selected account modules * @return array current status *
array ( *
'status' => 'finished' | 'inProgress' @@ -487,11 +488,11 @@ function buildUploadAccounts($scope, $data, $ids, $selectedModules) { *
'errors' => array () *
) */ -function doUploadPostActions($scope, $data, $ids, $failed) { +function doUploadPostActions($scope, $data, $ids, $failed, $selectedModules) { // check if function is called the first time if (! isset($_SESSION['mass_postActions']['remainingModules'])) { // make list of remaining modules - $moduleList = $_SESSION['config']->get_AccountModules($scope); + $moduleList = $selectedModules; $_SESSION['mass_postActions']['remainingModules'] = $moduleList; } $activeModule = $_SESSION['mass_postActions']['remainingModules'][0]; diff --git a/lam/templates/massBuildAccounts.php b/lam/templates/massBuildAccounts.php index 53ff9617..95563cb4 100644 --- a/lam/templates/massBuildAccounts.php +++ b/lam/templates/massBuildAccounts.php @@ -189,6 +189,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { $_SESSION['mass_data'] = $_SESSION['ldap']->encrypt(serialize($data)); $_SESSION['mass_ids'] = $ids; $_SESSION['mass_scope'] = $_POST['scope']; + $_SESSION['mass_selectedModules'] = $selectedModules; // show links for upload and LDIF export echo "

" . _("LAM has checked your input and is now ready to create the accounts.") . "

\n"; echo "

 

\n"; @@ -206,6 +207,10 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { } } } +else { + StatusMessage('ERROR', _('Please provide a file to upload.')); + echo '
' . _('Back') . ''; +} echo "\n"; echo "\n"; diff --git a/lam/templates/massDoUpload.php b/lam/templates/massDoUpload.php index a7fe19c0..b7215c49 100644 --- a/lam/templates/massDoUpload.php +++ b/lam/templates/massDoUpload.php @@ -94,7 +94,7 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po // do post upload actions if ($_SESSION['mass_counter'] >= sizeof($accounts)) { $data = unserialize($_SESSION['ldap']->decrypt($_SESSION['mass_data'])); - $return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed']); + $return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules']); if ($return['status'] == 'finished') { $_SESSION['mass_postActions']['finished'] = true; } @@ -106,7 +106,7 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po echo ""; flush(); while (!isset($_SESSION['mass_postActions']['finished']) && (($startTime + $maxTime) > time())) { - $return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed']); + $return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules']); if ($return['status'] == 'finished') { $_SESSION['mass_postActions']['finished'] = true; }