コード例 #1
0
ファイル: proof.php プロジェクト: cpeel/dproofreaders-shadow
// Check that the project is in a proofable state
list($code, $msg) = $project->can_be_proofed_by_current_user();
if ($code != $project->CBP_OKAY) {
    // I think this can only happen via URL-tweaking.
    slim_header($project->nameofwork);
    echo _("Project") . ": \"{$project->nameofwork}\"<br>\n";
    echo _("State") . ": " . project_states_text($project->state) . "<br>\n";
    echo "<p>{$msg}</p>\n";
    echo "<p>";
    echo sprintf(_("Back to <a href='%s'>Activity Hub</a>"), "{$code_url}/activity_hub.php");
    echo "</p>\n";
    exit;
}
//load the master frameset
// Add name of round before nameofwork
$round = get_Round_for_project_state($project->state);
$nameofwork = "[" . $round->id . "] " . $project->nameofwork;
// Re src="dp_foo.js?YYMMDD##" in the following <script> tags:
// When a JS script file changes, the browser should note this and update its
// cached version. However, it appears that some browsers are not very good
// at this, and continue to use a cached version after it is out of date.
// To thwart this, we add a query string to the src reference, and update it
// when the JS script file changes. (The query string can be anything, but
// it makes sense to use the date that the JS file was changed.)
// The browser sees that the src URL no longer matches that of its cached
// script, and so fetches the new version. (Of course, the JS script doesn't
// do anything with the query string, but the browser doesn't know that.)
$header_args = array("js_files" => array("dp_proof.js?2015122901", "dp_scroll.js?1.18"));
slim_header_frameset($nameofwork . " - " . _("Proofreading Interface"), $header_args);
$frameGet = "?" . $_SERVER['QUERY_STRING'];
?>
コード例 #2
0
function do_waiting_queues()
{
    global $project, $code_url;
    $round = get_Round_for_project_state($project->state);
    if (is_null($round)) {
        return;
    }
    if ($project->state != $round->project_waiting_state) {
        return;
    }
    // Okay, so the project is in some round's waiting state.
    // What queues is it in, if any?
    echo "<h4>";
    echo _("Queues");
    echo "</h4>\n";
    $res = mysql_query("\n        SELECT name, project_selector\n        FROM queue_defns\n        WHERE round_id='{$round->id}'\n        ORDER BY ordering\n    ") or die(mysql_error());
    if (mysql_num_rows($res) == 0) {
        // No queues defined for this round.
        echo sprintf(_('There are no queues defined for round %s, so this project should be automatically released within a few minutes.'), $round->id);
    } else {
        echo sprintf(_('This project is in the following round %s queues:'), $round->id);
        echo "<br>\n";
        echo "<ul>\n";
        $n_queues = 0;
        while (list($q_name, $q_project_selector) = mysql_fetch_row($res)) {
            $cooked_project_selector = cook_project_selector($q_project_selector);
            $res2 = mysql_query("\n                SELECT projectid\n                FROM projects\n                WHERE projectid='{$project->projectid}' AND ({$cooked_project_selector})\n            ") or die(mysql_error());
            if (mysql_num_rows($res2) > 0) {
                $n_queues += 1;
                $enc_q_name = urlencode($q_name);
                $url = "{$code_url}/stats/release_queue.php?round_id={$round->id}&name={$enc_q_name}";
                $enc_url = html_safe($url);
                echo "<li><a href='{$enc_url}'>{$q_name}</a></li>\n";
            }
        }
        if ($n_queues == 0) {
            echo "<li>" . _("(none)") . "</li>\n";
        }
        echo "</ul>\n";
    }
    if (project_has_a_hold_in_state($project->projectid, $project->state)) {
        echo "<p>", _("However, this project is currently being held-in-waiting; it will not be auto-released until the hold is removed."), "</p>\n";
    }
}
コード例 #3
0
 function show_visible_controls()
 {
     $goodWordData = html_safe($this->good_words);
     $badWordData = html_safe($this->bad_words);
     $fields = array("projectid" => _("Project ID"), "nameofwork" => _("Name of Work"), "authorsname" => _("Author's Name"), "projectmanager" => _("Project Manager"), "checkedoutby" => _("Post-Processor"), "language" => _("Language"));
     foreach ($fields as $field => $label) {
         echo "<tr>";
         echo "<td class='label'>{$label}</td>";
         echo "<td>" . $this->{$field} . "</td>";
         echo "</tr>";
     }
     $exist_OCR_pages = $this->number_of_pages_in_round(null) > 0;
     $exist_pages_in_P1_or_later = $this->number_of_pages_in_round(get_Round_for_round_number(1)) > 0;
     // due to some special circumstances, not all projects may have pages in P1
     // so we'll check to see if the project is in a state after P1 and count
     // that as just as good
     if (!$exist_pages_in_P1_or_later) {
         $current_project_round = get_Round_for_project_state($this->state);
         if ($current_project_round && $current_project_round->round_number > 1) {
             $exist_pages_in_P1_or_later = true;
         }
     }
     // if the project doesn't have any OCR pages and the project
     // has no P1 or later pages, report a message. The second criteria
     // is important for type-in projects that may have no OCR pages but
     // will have P1 or later pages
     if (!$exist_OCR_pages && !$exist_pages_in_P1_or_later) {
         echo "<tr>";
         echo "<td colspan='2'>";
         echo "<p class='error' style='text-align: center;'>";
         echo _("There are no pages associated with this project.");
         echo "</p>";
         echo "</td>";
         echo "</tr>";
     } else {
         echo "<tr>";
         echo "<td class='label' style='text-align: center;' colspan='2'>";
         echo _("WordCheck Tools and Reports");
         echo "</td>";
         echo "</tr>";
         echo "<tr>";
         echo "<td class='label'>" . _("Ad Hoc Word Details") . "</td>";
         echo "<td>" . new_window_link("show_adhoc_word_details.php?projectid={$this->projectid}", _("Show details for ad hoc words")) . "</td>";
         echo "</tr>";
         echo "<tr>";
         echo "<td class='label'>" . _("WordCheck Statistics") . "</td>";
         echo "<td>" . new_window_link("show_project_wordcheck_stats.php?projectid={$this->projectid}", _("Show WordCheck flagged word statistics")) . "</td>";
         echo "</tr>";
         if ($exist_pages_in_P1_or_later) {
             echo "<tr>";
             echo "<td class='label'>" . _("WordCheck Usage") . "</td>";
             echo "<td>" . new_window_link("show_project_wordcheck_usage.php?projectid={$this->projectid}", _("Show WordCheck interface usage")) . "</td>";
             echo "</tr>";
         }
         echo "<tr>";
         echo "<td class='label' style='text-align: center;' colspan='2'>";
         echo _("Word List Suggestion Tools");
         echo "</td>";
         echo "</tr>";
         echo "<tr>";
         echo "<td colspan='2'>";
         echo "<table width='100%'>";
         echo "<tr>";
         echo "<td style='width: 50%; text-align: center;' valign='top'>";
         echo "<p>";
         echo "<b>" . _("Words that WordCheck would currently flag:") . "</b><br>";
         echo new_window_link("show_current_flagged_words.php?projectid={$this->projectid}", _("Display"));
         echo " | ";
         echo "<a href='show_current_flagged_words.php?projectid={$this->projectid}&amp;format=file'>" . _("Download") . "</a>";
         echo "</p>";
         $suggestions = load_project_good_word_suggestions($this->projectid);
         if (count($suggestions)) {
             echo "<p>";
             echo "<b>" . _("Suggestions from proofreaders:") . "</b><br>";
             echo new_window_link("show_good_word_suggestions.php?projectid={$this->projectid}", _("Display"));
             echo " | ";
             echo "<a href='show_good_word_suggestions.php?projectid={$this->projectid}&amp;timeCutoff=0&amp;format=file'>" . _("Download") . "</a>";
             echo "</p>";
         }
         echo "</td>";
         echo "<td style='width: 50%; text-align: center;' valign='top'>";
         // see if the site has Possible Bad Word files
         $possible_bad_words = load_site_possible_bad_words_given_project($this->projectid);
         if (count($possible_bad_words)) {
             echo "<p>";
             echo "<b>" . _("Words in the Site's Possible bad words file:") . "</b><br>";
             echo new_window_link("show_project_possible_bad_words.php?projectid={$this->projectid}", _("Display"));
             echo " | ";
             echo "<a href='show_project_possible_bad_words.php?projectid={$this->projectid}&amp;format=file'>" . _("Download") . "</a>";
             echo "</p>";
         }
         // see if there are P1 (or later) and OCR pages before showing the link.
         // type-in projects may have P1 (or later) pages but no OCR pages
         // and the current show_project_stealth_scannos.php page only works
         // with projects that have OCR text
         if ($exist_pages_in_P1_or_later && $exist_OCR_pages) {
             echo "<p>";
             echo "<b>" . _("Suggestions from diff analysis:") . "</b><br>";
             echo new_window_link("show_project_stealth_scannos.php?projectid={$this->projectid}", _("Display"));
             echo " | ";
             echo "<a href='show_project_stealth_scannos.php?projectid={$this->projectid}&amp;format=file'>" . _("Download") . "</a>";
             echo "</p>";
         }
         echo "</td>";
         echo "</tr>";
         echo "</table>";
         echo "</td>";
         echo "</tr>";
     }
     echo "<tr>";
     echo "<td class='label' style='text-align: center;' colspan='2'>";
     echo _("Project Dictionary - Word Lists");
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td class='label' style='text-align: center;'>" . _("Good Words") . "</td>";
     echo "<td class='label' style='text-align: center;'>" . _("Bad Words") . "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td style='width: 50%;'>";
     echo "<textarea class='mono' name='good_words' cols='40' rows='20'>{$goodWordData}</textarea>";
     echo "</td>";
     echo "<td style='width: 50%;'>";
     echo "<textarea class='mono' name='bad_words' cols='40' rows='20'>{$badWordData}</textarea>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2' style='text-align: center;'>";
     echo sprintf(_("See the %s for more information on word lists."), new_window_link("../../faq/wordcheck-faq.php", _("WordCheck FAQ")));
     echo "</td>";
     echo "</tr>";
 }