function node_import_view_form in Node import 6
View a task and its progress.
1 string reference to 'node_import_view_form'
- node_import_menu in ./
node_import.module - Implementation of hook_menu().
File
- ./
node_import.admin.inc, line 835
Code
function node_import_view_form(&$form_state, $task) {
drupal_set_title(t('Importing %name', array(
'%name' => $task['name'],
)));
$form = array();
$form['#task'] = $task;
$form['status'] = array(
'#type' => 'item',
'#title' => t('Status'),
'#value' => $task['status'] == NODE_IMPORT_STATUS_DONE ? t('Completed') : t('In progress'),
);
if ($task['status'] == NODE_IMPORT_STATUS_DONE) {
$form['row_done'] = array(
'#type' => 'item',
'#title' => t('Rows imported'),
'#prefix' => '<div id="node_import-row_done">',
'#suffix' => '</div>',
'#value' => format_plural($task['row_done'], t('1 row'), t('@count rows')),
);
$form['row_error'] = array(
'#type' => 'item',
'#title' => t('Rows with errors'),
'#prefix' => '<div id="node_import-row_error">',
'#suffix' => '</div>',
'#value' => format_plural($task['row_error'], t('1 row'), t('@count rows')),
);
$form['download'] = array(
'#type' => 'fieldset',
'#title' => t('Download rows'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
);
$form['download']['what_rows'] = array(
'#type' => 'radios',
'#title' => t('Rows to download'),
'#options' => array(
'all' => t('All rows'),
'error' => t('Rows with errors'),
'done' => t('Rows without errors'),
),
'#default_value' => 'error',
);
$form['download']['what_cols'] = array(
'#type' => 'checkboxes',
'#title' => t('Extra columns'),
'#options' => array(
'objid' => t('Object identifier'),
'errors' => t('Errors'),
),
'#default_value' => array(
'objid',
'errors',
),
);
$form['download']['download_button'] = array(
'#type' => 'submit',
'#value' => t('Download'),
'#submit' => array(
'node_import_view_form_submit_download',
),
);
}
else {
$form['progress'] = array(
'#value' => '<div id="node_import-progress">' . t('You need to have Javascript enabled to see the progress of this import.') . '</div>',
);
drupal_add_js('misc/progress.js', 'core');
$js_settings = array(
'nodeImport' => array(
'uri' => url('admin/content/node_import/' . $task['taskid']),
),
);
drupal_add_js($js_settings, 'setting');
drupal_add_js(drupal_get_path('module', 'node_import') . '/node_import.js', 'module');
}
$form['details'] = array_merge(array(
'#type' => 'fieldset',
'#title' => t('Task details'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
), node_import_task_details($task));
$form['buttons'] = array(
'delete_task_button' => array(
'#type' => 'submit',
'#value' => t('Delete'),
'#disabled' => $task['status'] != NODE_IMPORT_STATUS_DONE,
'#submit' => array(
'node_import_view_form_submit_delete',
),
),
'add_task_button' => array(
'#type' => 'markup',
'#value' => l(t('New import'), 'admin/content/node_import/add'),
),
);
if (variable_get('node_import:annoy', 1)) {
$form['report'] = array(
'#type' => 'markup',
'#value' => '<div class="warning">' . t('When you <a href="http://drupal.org/node/add/project-issue/node_import" title="Report an issue with the Node import module">report a bug</a> for the <em>Node import</em> module, it helps the developers a lot if you attach <a href="!node_import-debug" title="Node import debug report">a <em>Node import</em> debug report</a> to the issue. This report contains - in plain text - <ul><li>the Drupal and PHP version,</li><li>the enabled modules and their versions,</li><li>the permissions of the user,</li><li>the task and content fields details,</li><li>the error messages and data of @count non-imported rows.</li></ul><strong>You should not submit this data if you are concerned about the content of the file you try to import</strong>, for example if the file contains e-mail addresses or passwords. You could create another task with the same parameters but with a file with content that can be publically viewed in this case or e-mail the author directly. Thanks!', array(
'!node_import-debug' => url('admin/content/node_import/' . $task['taskid'] . '/debug'),
'@count' => variable_get('node_import:debug:row_count', 5),
)) . '</div>',
);
}
return $form;
}