function caExportAddDownloadLink($po_request)
{
    print "<script type='text/javascript'>";
    print "jQuery('#exportDownloadLink').html(\"" . caNavLink($po_request, _t("Set up export download"), null, 'manage', 'MetadataExport', 'SetupBatchExport', null, array('style' => 'font-size: 14px;')) . "\");";
    print "</script>";
    caFlushOutput();
}
function caExportAddDownloadLink($po_request, $vs_filename)
{
    print "<script type='text/javascript'>";
    print "jQuery('#exportDownloadLink').html(\"" . caNavLink($po_request, _t("Download export"), null, 'manage', 'MetadataExport', 'DownloadExport', array('file' => $vs_filename), array('style' => 'font-size: 14px;')) . "\");";
    print "</script>";
    caFlushOutput();
}
function caIncrementHierachicalReindexProgress($ps_table_message, $pn_elapsed_time, $pn_memory_used, $pa_table_list, $pn_table_num, $ps_display_name, $pn_tables_processed)
{
    if (is_null($ps_table_message)) {
        $ps_table_message = _t('Indexing %1 (%2/%3)', $ps_display_name, $pn_tables_processed, sizeof($pa_table_list));
    }
    $pn_table_percentage = $pn_tables_processed / sizeof($pa_table_list) * 100;
    print "<script type='text/javascript'>";
    print "jQuery('#progressbarTables').progressbar('value',{$pn_table_percentage}); jQuery('#searchReindexTableStatus').html('{$ps_table_message}');";
    print "jQuery('#searchReindexElapsedTime').html('" . caFormatInterval($pn_elapsed_time) . "/" . sprintf("%4.2f mb", $pn_memory_used / 1048576) . "');";
    print "</script>";
    caFlushOutput();
}
function caIncrementSortValueReloadProgress($pn_rows_complete, $pn_total_rows, $ps_row_message, $ps_table_message, $pn_elapsed_time, $pn_memory_used, $pa_table_list, $pn_table_num, $ps_display_name, $pn_tables_processed)
{
    $pn_percentage = $pn_rows_complete / $pn_total_rows * 100;
    if (is_null($ps_row_message)) {
        $ps_row_message = _t('Reloading %1/%2', $pn_rows_complete, $pn_total_rows);
    }
    if (is_null($ps_table_message)) {
        $ps_table_message = _t('Reloading sort values for %1 (%2/%3)', $ps_display_name, $pn_tables_processed, sizeof($pa_table_list));
    }
    $pn_table_percentage = $pn_tables_processed / sizeof($pa_table_list) * 100;
    print "<script type='text/javascript'>";
    print "jQuery('#progressbarTables').progressbar('value',{$pn_table_percentage}); jQuery('#searchReindexTableStatus').html('{$ps_table_message}');";
    print "jQuery('#progressbarRows').progressbar('value',{$pn_percentage}); jQuery('#searchReindexRowStatus').html('{$ps_row_message}');";
    print "jQuery('#searchReindexElapsedTime').html('" . caFormatInterval($pn_elapsed_time) . "/" . sprintf("%4.2f mb", $pn_memory_used / 1048576) . "');";
    print "</script>";
    caFlushOutput();
}
Example #5
0
function caGetListToBeLoaded($ps_list_code, $pn_list, $pn_num_lists)
{
    global $vn_progress;
    $vn_progress += 21 / $pn_num_lists;
    print "<script type='text/javascript'>jQuery('#progressbar').progressbar('value',{$vn_progress}); jQuery('#installerLog').html('Installing list <i>{$ps_list_code}</i>');</script>";
    caFlushOutput();
}
function caCreateBatchEditorResultsReport($po_request, $pa_general, $pa_notices, $pa_errors)
{
    $vs_buf = '';
    if (is_array($pa_errors) && sizeof($pa_errors)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Errors occurred') . ':</div><ul>';
        foreach ($pa_errors as $vn_id => $va_error) {
            $va_error_list = array();
            foreach ($va_error['errors'] as $o_error) {
                $va_error_list[] = $o_error->getErrorDescription();
            }
            $vs_buf .= "<li><em>" . caEditorLink($po_request, $va_error['label'], '', $pa_general['table'], $vn_id) . "</em> (" . $va_error['idno'] . "): " . join("; ", $va_error_list) . "</li>";
        }
        $vs_buf .= "</ul>";
        $vs_buf .= '<div class="batchProcessingReportSectionWarning">' . (sizeof($pa_errors) == 1 ? _t('Note: <strong>NO</strong> batch changes were saved due to the error.') : _t('Note: <strong>NO</strong> batch changes were saved due to %1 errors.', sizeof($pa_errors))) . "</div>";
    }
    if (is_array($pa_notices) && sizeof($pa_notices)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Processed successfully') . ':</div><ol>';
        foreach ($pa_notices as $vn_id => $va_notice) {
            $vs_buf .= "<li><em>" . caEditorLink($po_request, preg_replace("![\r\n\t]+!", " ", $va_notice['label']), '', $pa_general['table'], $vn_id) . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
        }
        $vs_buf .= "</ol>";
    }
    print "<script type='text/javascript'>";
    print "jQuery('#batchProcessingReport').html('" . addslashes($vs_buf) . "').fadeIn(300);";
    print "jQuery('#batchProcessingMore').fadeIn(300);";
    print "</script>";
    caFlushOutput();
}
function caCreateBatchMediaImportResultsReport($po_request, $pa_general, $pa_notices, $pa_errors)
{
    $vs_buf = '';
    if (is_array($pa_errors) && sizeof($pa_errors)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Errors occurred') . ':</div><ul>';
        foreach ($pa_errors as $vs_f => $va_error) {
            $vs_buf .= "<li><em>[{$vs_f}]:</em> " . $va_error['message'] . "</li>";
        }
        $vs_buf .= "</ul>";
    }
    if (is_array($pa_notices) && sizeof($pa_notices)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Processed') . ':</div><ol>';
        foreach ($pa_notices as $vn_id => $va_notice) {
            switch ($va_notice['status']) {
                case 'SUCCESS':
                    $vs_buf .= "<li><em>" . caEditorLink($po_request, $va_notice['label'], '', $pa_general['table'], $vn_id) . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
                    break;
                case 'SKIPPED':
                case 'MATCHED':
                case 'RELATED':
                    $vs_buf .= "<li><em>" . $va_notice['label'] . "</em>: " . $va_notice['message'] . "</li>";
                    break;
                default:
                    $vs_buf .= "<li><em>" . $va_notice['label'] . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
                    break;
            }
        }
        $vs_buf .= "</ol>";
    }
    if ($pa_general['set_id']) {
        $vs_buf .= caNavButton($po_request, __CA_NAV_BUTTON_BATCH_EDIT__, _t('Batch edit'), 'batch', 'Editor', 'Edit', array('set_id' => $pa_general['set_id']), array(), array('icon_position' => __CA_NAV_BUTTON_ICON_POS_LEFT__, 'use_class' => 'list-button', 'no_background' => true, 'dont_show_content' => true)) . ' ' . _t('Batch edit set <em>%1</em> containing imported media', caNavLink($po_request, $pa_general['setName'], '', 'batch', 'Editor', 'Edit', array('set_id' => $pa_general['set_id'])));
    }
    print "<script type='text/javascript'>";
    print "jQuery('#batchProcessingMediaPreview').hide();";
    print "jQuery('#batchProcessingReport').html('" . addslashes($vs_buf) . "').fadeIn(300);";
    print "jQuery('#batchProcessingMore').fadeIn(300);";
    print "</script>";
    caFlushOutput();
}
function caUpdateBatchMetadataImportResultsReport($po_request, $pa_general, $pa_errors, $pb_done = false)
{
    $vs_buf = '';
    if (is_array($pa_errors) && sizeof($pa_errors)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Errors during import') . ':</div><ul>';
        foreach ($pa_errors as $vn_i => $vs_error_message) {
            $vs_buf .= "<li>{$vs_error_message}</li>";
        }
        $vs_buf .= "</ul>";
    }
    if (is_array($pa_notices) && sizeof($pa_notices)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Processed') . ':</div><ol>';
        foreach ($pa_notices as $vn_id => $va_notice) {
            switch ($va_notice['status']) {
                case 'SUCCESS':
                    $vs_buf .= "<li><em>" . caEditorLink($po_request, $va_notice['label'], '', $pa_general['table'], $vn_id) . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
                    break;
                case 'SKIPPED':
                case 'MATCHED':
                    $vs_buf .= "<li><em>" . $va_notice['label'] . "</em>: " . $va_notice['message'] . "</li>";
                    break;
                default:
                    $vs_buf .= "<li><em>" . $va_notice['label'] . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
                    break;
            }
        }
        $vs_buf .= "</ol>";
    }
    print "<script type='text/javascript'>";
    print "jQuery('#batchProcessingReport').html('" . addslashes($vs_buf) . "').show();";
    if ($pb_done) {
        print "jQuery('#batchProcessingMore').fadeIn(300);";
    }
    print "</script>";
    caFlushOutput();
}