$t = _('Previous');
         $prev_offset = max(0, $results_offset - $n_results_per_page);
         $url = $url_base . "results_offset={$prev_offset}";
         echo "<a href='{$url}'>{$t}</a> | ";
     }
     echo sprintf(_("Projects %1\$d to %2\$d of %3\$d"), $results_offset + 1, $results_offset + $numrows, $num_found_rows);
     echo "\n";
     if ($results_offset + $numrows < $num_found_rows) {
         $t = _('Next');
         $next_offset = $results_offset + $n_results_per_page;
         $url = $url_base . "results_offset={$next_offset}";
         echo " | <a href='{$url}'>{$t}</a>";
     }
 }
 results_navigator();
 $user_can_see_download_links = user_can_work_in_stage($pguser, 'PP');
 $show_options_column = $user_can_see_download_links || user_is_PM();
 echo "<center><table border=1 width='99%' cellpadding=0 cellspacing=0 style='border: 1px solid #111; border-collapse: collapse'>";
 function echo_header_cell($width, $text)
 {
     global $theme;
     echo "<td width='{$width}' align='center' bgcolor='{$theme['color_headerbar_bg']}'>";
     echo "<font color='{$theme['color_headerbar_font']}'>";
     echo "<b>{$text}</b>";
     echo "</font>";
     echo "</td>";
     echo "\n";
 }
 echo "<tr>";
 echo_header_cell(175, _("Title"));
 echo_header_cell(100, _("Author"));
header_remove("Expires");
header_remove("Cache-Control");
require_login();
undo_all_magic_quotes();
// -------------------------------------
$theme_args['js_data'] = "\nfunction grow_textarea(textarea_id)\n{\n    textarea = document.getElementById(textarea_id);\n    textarea.rows = textarea.rows+2;\n}\n\nfunction shrink_textarea(textarea_id)\n{\n    textarea = document.getElementById(textarea_id);\n    if (textarea.rows > 2)\n    {\n        textarea.rows = textarea.rows-2;\n    }\n}";
$theme_args['css_data'] = "\n.single {\n    margin:0;\n    padding:0;\n    text-indent:-3em;\n    margin-left:3em;\n}    \n.single2 {\n    margin:0;\n    padding:0;\n    text-indent:-1.25em;\n    margin-left:1.25em;\n}    \ndiv.shrinker {float: right;}\ndiv.shrinker a {\n    font-size:200%; \n    font-weight: 900;\n    text-decoration: none!important;\n    color: #888;\n    cursor: pointer;\n}\ninput[type='text'], textarea {\n     background-color: #E2F2E1;\n}\n\np.form_problem {\n    color: red;\n    font-weight: bold;\n    margin-bottom: 0;\n}\np.form_problem:before {\n    content: '\\002193 '; /* down-arrow */\n}\n";
$page_title = _('Post-Processing Verification Reporting');
output_header($page_title, SHOW_STATSBAR, $theme_args);
echo "\n<h1>{$page_title}</h1>\n";
// -------------------------------------
// To make PPVer collaboration easier, allow any PPVer to fill in the summary.
// (The link is still only shown to the PPVer with the project checked-out.)
// All summaries are sent to the PPVers' list, signed by the person filling
// out the summary, so a mischievous PPVer couldn't get away with anything, anyway.
if (!user_can_work_in_stage($pguser, 'PPV')) {
    echo _("You're not recorded as a Post-Processing Verifier.\n            If you feel this is an error, please contact a Site Administrator.");
    exit;
}
// -------------------------------------
// When this script is invoked without a 'project' arg,
// just show a form that elicits a project ID
// and re-invokes this script with it.
if (!isset($_REQUEST['project'])) {
    $prompt = _("Please enter a project ID:");
    echo "\n        <form method='get'>\n        {$prompt} <input type='text' name='project'>\n        <input type='submit'>\n        </form>\n    ";
    exit;
}
// -------------------------------------
define('SHOW_BLANK_ENTRY_FORM', 'SHOW_BLANK_ENTRY_FORM');
define('HANDLE_ENTRY_FORM_SUBMISSION', 'HANDLE_ENTRY_FORM_SUBMISSION');
Example #3
0
function do_post_downloads()
{
    global $project, $pguser, $site_supports_corrections_after_posting;
    if (!$project->dir_exists && !$project->pages_table_exists) {
        return;
    }
    $projectid = $project->projectid;
    $state = $project->state;
    if (user_can_work_in_stage($pguser, 'PP')) {
        echo "<h4>";
        echo _("Post Downloads");
        echo "</h4>\n";
        echo "<ul>";
        echo_download_zip(_("Download Zipped Images"), 'images');
        if ($state == PROJ_POST_FIRST_AVAILABLE || $state == PROJ_POST_FIRST_CHECKED_OUT) {
            echo_download_zip(_("Download Zipped Text"), '');
            echo_download_zip(_("Download Zipped TEI Text"), '_TEI');
            echo "<li>";
            echo_uploaded_zips('_first_in_prog_', _('partially post-processed'));
            echo "</li>";
        } elseif ($state == PROJ_POST_SECOND_AVAILABLE || $state == PROJ_POST_SECOND_CHECKED_OUT) {
            echo_download_zip(_("Download Zipped Text"), '_second');
            echo "<li>";
            echo_uploaded_zips('_second_in_prog_', _('partially verified'));
            echo "</li>";
        } elseif ($site_supports_corrections_after_posting && ($state == PROJ_CORRECT_AVAILABLE || $state == PROJ_CORRECT_CHECKED_OUT)) {
            echo_download_zip(_("Download Zipped Text"), '_corrections');
        }
        echo "<br>";
    } else {
        echo "<h4>";
        echo _("Concatenated Text Files");
        echo "</h4>\n";
        echo "<ul>";
    }
    // regenerate post files. Only for site managers.
    // or download concatenated text, for all. Do we want to limit
    // this to people allowed to work in PP? If so, we should definitely
    // include the PM of this project.
    global $Round_for_round_id_, $code_url;
    $sums_str = "";
    foreach ($Round_for_round_id_ as $round) {
        if (!empty($sums_str)) {
            $sums_str .= ', ';
        }
        $sums_str .= "SUM( {$round->text_column_name} != '' ) AS {$round->id}";
    }
    $res = mysql_query("\n            SELECT {$sums_str}\n            FROM {$projectid}\n        ") or die(mysql_error());
    $sums = mysql_fetch_assoc($res);
    foreach ($Round_for_round_id_ as $round) {
        if (intval($sums[$round->id]) != 0) {
            $highest_round_id = $round->id;
        }
    }
    echo "<li>";
    if (user_is_a_sitemanager()) {
        echo _("Generate Post Files (This will overwrite existing post files, if any.)"), "\n";
    } else {
        echo _("Download Concatenated Text"), "\n";
    }
    echo "<form method='post' action='{$code_url}/tools/project_manager/generate_post_files.php'>\n";
    echo "<input type='hidden' name='projectid' value='{$projectid}'>\n";
    if (isset($highest_round_id)) {
        echo "<input type='radio' name='round_id' value='[OCR]'>[OCR]&nbsp;\n";
        foreach ($Round_for_round_id_ as $round) {
            $checked = $round->id == $highest_round_id ? 'CHECKED' : '';
            echo "<input type='radio' name='round_id' value='{$round->id}' {$checked}>{$round->id}&nbsp;\n";
            if ($round->id == $highest_round_id) {
                break;
            }
        }
    } else {
        echo "<input type='radio' name='round_id' value='[OCR]' CHECKED>[OCR]&nbsp;\n";
    }
    echo "<br>";
    echo _("For each page, use:"), "<br>\n";
    echo "<input type='radio' name='which_text' value='EQ' CHECKED>";
    echo _("the text (if any) saved in the selected round; or"), "<br>\n";
    echo "<input type='radio' name='which_text' value='LE'>";
    echo _("the latest text saved in any round up to and including the selected round."), "<br>\n";
    echo _("(If every page has been saved in the selected round, then the two choices are equivalent.)"), "<br>\n";
    // Proofreader names allowed for people who can see proofreader names
    // on the page details
    if ($project->names_can_be_seen_by_current_user) {
        echo _("Include usernames?"), " &nbsp;&nbsp; ";
        echo "<input type='radio' name='include_proofers' value='1' CHECKED />";
        echo _("Yes"), " &nbsp;&nbsp; ";
        echo "<input type='radio' name='include_proofers' value='0' />";
        echo _("No"), "<br />\n";
    } else {
        echo "<input type='hidden' name='include_proofers' value='0' />";
    }
    // saving files allowed only for sitemanagers
    if (user_is_a_sitemanager()) {
        echo _("Save file on server?"), "  &nbsp;&nbsp; ";
        echo "<input type='radio' name='save_files' value='1' CHECKED />";
        echo _("Yes"), " &nbsp;&nbsp; ";
        echo "<input type='radio' name='save_files' value='0' />";
        echo _("No"), "<br />\n";
        echo "<input type='submit' value='", attr_safe(_("(Re)generate")), "'>\n";
    } else {
        echo "<input type='hidden' name='save_files' value='0' />";
        echo "<input type='submit' value='", attr_safe(_("Download")), "'>\n";
    }
    echo "</form>\n";
    echo "</li>";
    echo "</ul>\n";
}