upload post actions only for active modules

This commit is contained in:
Roland Gruber 2010-02-16 17:32:48 +00:00
parent 915bef996e
commit 84e5b750cb
3 changed files with 10 additions and 4 deletions

View File

@ -479,6 +479,7 @@ function buildUploadAccounts($scope, $data, $ids, $selectedModules) {
* @param array $data array containing one account in each element
* @param array $ids array(<column_name> => <column number>)
* @param array $failed list of accounts which were not created successfully
* @param array $selectedModules list of selected account modules
* @return array current status
* <br> array (
* <br> 'status' => 'finished' | 'inProgress'
@ -487,11 +488,11 @@ function buildUploadAccounts($scope, $data, $ids, $selectedModules) {
* <br> 'errors' => array (<array of parameters for StatusMessage>)
* <br> )
*/
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];

View File

@ -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 "<h1 align=\"center\">" . _("LAM has checked your input and is now ready to create the accounts.") . "</h1>\n";
echo "<p>&nbsp;</p>\n";
@ -206,6 +207,10 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
}
}
}
else {
StatusMessage('ERROR', _('Please provide a file to upload.'));
echo '<br><a href="masscreate.php">' . _('Back') . '</a>';
}
echo "</body>\n";
echo "</html>\n";

View File

@ -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 "</table>";
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;
}