function listHospitalProjects($input, $argv) { global $relPath; include_once $relPath . 'project_states.inc'; global $wgParser; $output = ""; $result = mysql_query("\n SELECT *\n FROM dproofreaders.projects\n WHERE nameofwork LIKE '%needs fixing%'\n AND state != 'project_delete'\n ORDER BY nameofwork ASC\n "); if (!$result) { die('Invalid: ' . mysql_error()); } while ($project = mysql_fetch_object($result)) { // Get the preformatted remarks from PCs $matches = ''; $problems = preg_match('/<pre>([^<]*)<\\/pre>/', $project->comments, $matches); $pstate = iconv('ISO-8859-1', 'UTF-8', project_states_text($project->state)); $puri = $project->url = "http://www.pgdp.net/c/project.php?id={$project->projectid}"; $plink = iconv('ISO-8859-1', 'UTF-8', "<a href='{$puri}'>{$project->nameofwork}</a>"); $output .= "<table style='border: 1px solid red; padding: 2px; width: 90%; margin: .75em;'>\n"; $output .= "<tr><th width='12%' style='vertical-align: top;'>Title:</th><td>{$plink}</td></tr>\n"; $output .= "<tr><th>Author:</th><td>" . iconv('ISO-8859-1', 'UTF-8', $project->authorsname) . "</td></tr>\n"; $output .= "<tr><th>PM/State:</th><td>" . iconv('ISO-8859-1', 'UTF-8', $project->username) . ": <u>{$pstate}</u></td></tr>\n"; // $output .= "<tr><th>PM:</th><td>".iconv('ISO-8859-1','UTF-8',$project->username)."</td></tr>\n"; $output .= "<tr><th style='vertical-align: top;'>Issues:</th><td style='font-size:90%;'>"; $output .= iconv('ISO-8859-1', 'UTF-8', $matches ? wordwrap($matches[0], 80) : ' '); $output .= "</td></tr>\n"; $output .= "</table>\n"; } mysql_free_result($result); return $output; }
function showProjectInfo($input, $argv, $parser) { $err = "<strong style='color: red;'>[Error: showProjectInfo: %s]</strong>"; $pid = mysql_real_escape_string(@$argv['id']); $result = mysql_query("SELECT * \n FROM dproofreaders.projects \n WHERE \n projectid = '{$pid}' \n LIMIT 1"); if (!$result || mysql_num_rows($result) == 0) { return sprintf($err, "Invalid projectID: {$pid}"); } $project = mysql_fetch_assoc($result); global $relPath; include_once $relPath . 'project_states.inc'; $project['raw_state'] = $project['state']; $project['state'] = project_states_text($project['state']); $project['title'] = $project['nameofwork']; $project['author'] = $project['authorsname']; $project['n_completed_pages'] = $project['n_pages'] - $project['n_available_pages']; $matches = array(); preg_match('/(.).+(.): (.+)/', $project['state'], $matches); @($project['short_state'] = $matches[1] . $matches[2]); $search = array("Available", "Waiting for Release", "Unavailable"); $replace = array("", "*", "-Unavail"); @($project['short_state'] = $project['short_state'] . str_replace($search, $replace, $matches[3])); $project['uri'] = $project['url'] = "http://www.pgdp.net/c/project.php?" . "id={$project['projectid']}&expected_state={$project['raw_state']}"; $project['link'] = "<a href='{$project['uri']}' class='extiw'>{$project['title']}</a>"; unset($project['clearance']); // email unset($project['comments']); // long unset($project['postcomments']); // long if (empty($project['checkedoutby'])) { $project['checkedoutby'] = '(none)'; } foreach ($project as $a => $b) { $project[$a] = iconv('ISO-8859-1', 'UTF-8', $b); } if (isset($argv['summary']) || empty($input)) { $output = "<table class='projectinfo plainlinks'>" . " <tr><td class='pi_a'>Title</td><td>{$project['link']}</td></tr>" . " <tr><td class='pi_a'>Author</td><td>{$project['authorsname']}</td></tr>" . " <tr><td class='pi_a'>State</td><td>{$project['state']}</td></tr>" . " <tr><td class='pi_a'><a href='/wiki/PM'>PM</a>/<a href='/wiki/PPer'>" . "PPer</a> </td><td>{$project['username']}/{$project['checkedoutby']}</td></tr>"; if (substr($project['raw_state'], -5) == 'avail') { $output .= " <tr><td class='pi_a'>Pages (left/total)</td>" . "<td>{$project['n_available_pages']}/{$project['n_pages']}</td></tr>"; } $output .= "</table>"; } else { $intermediate = $parser->parse($input, $parser->mTitle, $parser->mOptions, false, false); $output = $intermediate->getText(); foreach ($project as $field => $value) { $output = str_replace('%' . $field . '%', $value, $output); } } return $output; }
while (list($s_code, $s_display_name, $s_start) = mysql_fetch_row($special_day_res)) { $special_day_options[$s_code] = "{$s_display_name} ({$s_start})"; } // --------- $lang_options[''] = _('Any'); foreach ($lang_list as $k => $v) { $lang_options[$v['lang_name']] = $v['lang_name']; } // --------- $genre_options = array_merge(array('' => _('any')), $GENRES); // --------- $difficulty_options = array('' => _('any'), 'beginner' => _('Beginner'), 'easy' => _('Easy'), 'average' => _('Average'), 'hard' => _('Hard')); // --------- $state_options[''] = _('any state'); foreach ($PROJECT_STATES_IN_ORDER as $proj_state) { $state_options[$proj_state] = project_states_text($proj_state); } // --------- define('DEFAULT_N_RESULTS_PER_PAGE', 100); $widgets = array(new Widget(array('id' => 'title', 'label' => _('Title'), 'type' => 'text', 'q_part' => 'WHERE', 'q_contrib' => array('nameofwork', 'LIKE'))), new Widget(array('id' => 'author', 'label' => _('Author'), 'type' => 'text', 'q_part' => 'WHERE', 'q_contrib' => array('authorsname', 'LIKE'))), new Widget(array('id' => 'language', 'label' => _('Language'), 'type' => 'select', 'options' => $lang_options, 'can_be_multiple' => TRUE, 'initial_value' => '', 'q_part' => 'WHERE', 'q_contrib' => array('language', 'LIKE'))), new Widget(array('id' => 'genre', 'label' => _('Genre'), 'type' => 'select', 'options' => $genre_options, 'can_be_multiple' => TRUE, 'q_part' => 'WHERE', 'q_contrib' => array('genre', '='))), new Widget(array('id' => 'difficulty', 'label' => _('Difficulty'), 'type' => 'select', 'options' => $difficulty_options, 'can_be_multiple' => TRUE, 'q_part' => 'WHERE', 'q_contrib' => array('difficulty', '='))), new Widget(array('id' => 'special_day', 'label' => _('Special day'), 'type' => 'select', 'options' => $special_day_options, 'can_be_multiple' => TRUE, 'initial_value' => '', 'q_part' => 'WHERE', 'q_contrib' => array('special_code', '='))), new Widget(array('id' => 'projectid', 'label' => _('Project ID'), 'type' => 'text', 'size' => 45, 'can_be_multiple' => TRUE, 'separator' => '[\\s,;]+', 'q_part' => 'WHERE', 'q_contrib' => array('projectid', 'LIKE'))), new Widget(array('id' => 'project_manager', 'label' => _('Project Manager'), 'type' => 'text', 'q_part' => 'WHERE', 'q_contrib' => array('username', 'LIKE'))), new Widget(array('id' => 'checkedoutby', 'label' => _('Checked Out By'), 'type' => 'text', 'q_part' => 'WHERE', 'q_contrib' => array('checkedoutby', 'LIKE'))), new Widget(array('id' => 'pp_er', 'label' => _('Post-processor'), 'type' => 'text', 'q_part' => 'WHERE', 'q_contrib' => array('postproofer', 'LIKE'))), new Widget(array('id' => 'ppv_er', 'label' => _('Post-processing Verifier'), 'type' => 'text', 'q_part' => 'WHERE', 'q_contrib' => array('ppverifier', 'LIKE'))), new Widget(array('id' => 'postednum', 'label' => _('PG etext number'), 'type' => 'text', 'can_be_multiple' => TRUE, 'separator' => '[\\s,;]+', 'q_part' => 'WHERE', 'q_contrib' => array('postednum', '='))), new Widget(array('id' => 'state', 'label' => _('State'), 'type' => 'select', 'options' => $state_options, 'can_be_multiple' => TRUE, 'q_part' => 'WHERE', 'q_contrib' => array('state', '='))), new Widget(array('id' => 'n_results_per_page', 'label' => _('Number of results per page'), 'type' => 'select', 'options' => array(30 => 30, 100 => 100, 300 => 300), 'can_be_multiple' => FALSE, 'initial_value' => DEFAULT_N_RESULTS_PER_PAGE, 'q_part' => 'LIMIT', 'q_contrib' => '{VALUE}'))); // ----------------------------------------------------------------------------- if (user_is_PM() && empty($_GET['show']) && empty($_GET['up_projectid'])) { if ($userP['i_pmdefault'] == 0) { metarefresh(0, "projectmgr.php?show=user_all", "", ""); exit; } elseif ($userP['i_pmdefault'] == 1) { metarefresh(0, "projectmgr.php?show=user_active", "", ""); exit; } } output_header(_("Project Search"), NO_STATSBAR);
function do_project_info_table() { global $project, $code_url, $datetime_format, $date_format, $time_format; global $user_is_logged_in; global $site_supports_corrections_after_posting; $projectid = $project->projectid; $state = $project->state; $round = get_Round_for_project_state($state); // Note that $round may be NULL; echo "<table id='project_info_table' border=1 width=630>"; // ------------------------------------------------------------------------- // The state of the project $available_for_SR = $project->state == PROJ_POST_FIRST_CHECKED_OUT && $project->smoothread_deadline > time(); $right = project_states_text($project->state); if ($round) { $extra = $round->description; $right = "{$right} ({$extra})"; } elseif ($available_for_SR) { $sr_deadline_str = strftime($date_format, $project->smoothread_deadline); $sr_sentence = sprintf(_('This project has been made available for smooth reading until %s.'), "<b>{$sr_deadline_str}</b>"); $extra2 = _('See below.'); $right = "{$right}<br>{$sr_sentence} {$extra2}"; } echo_row_a(_("Project State"), $right); if ($project->state == PROJ_DELETE) { // Change anything that looks like a projectid into a link. $cooked_reason = preg_replace('/\\b(projectID[0-9a-f]{13})\\b/', '<a href="project.php?id=\\1">\\1</a>', $project->deletion_reason); echo_row_a(_("Reason for Deletion"), $cooked_reason); } // ------------------------------------------------------------------------- // Information about the work itself (independent of DP) // the array below should guarantee that the strings 'beginner', // 'easy', 'average' and 'hard' reach the po file, so that using // later _($project->difficulty) should translate the project // difficulty, if regularly formed, or display the (irregular) // english project difficulty. if (0) { $difficulty_labels = array('beginner' => _('beginner'), 'easy' => _('easy'), 'average' => _('average'), 'hard' => _('hard')); } echo_row_a(_("Title"), $project->nameofwork); echo_row_a(_("Author"), $project->authorsname); echo_row_a(_("Language"), $project->language); echo_row_a(_("Genre"), _($project->genre)); echo_row_a(_("Difficulty"), _($project->difficulty)); // ------------------------------------------------------------------------- // Basic DP info if (!empty($project->special_code)) { $spec_code = $project->special_code; if (strncmp($spec_code, 'Birthday', 8) == 0 or strncmp($spec_code, 'Otherday', 8) == 0) { $spec_display = $spec_code; } else { $spec_res = mysql_fetch_assoc(mysql_query("\n SELECT display_name\n FROM special_days\n WHERE spec_code = '{$spec_code}'\n ")); if ($spec_res) { $spec_display = $spec_res['display_name']; } else { $spec_display = "({$spec_code})"; } } echo_row_a(_("Special Day"), $spec_display); } // ------- echo_row_a(_("Project ID"), $project->projectid); if ($project->clearance_line_can_be_seen_by_current_user()) { echo_row_a(_("Clearance Line"), $project->clearance, TRUE); } // ------------------------------------------------------------------------- // People who have certain roles with respect to the project if (isset($project->image_source_name)) { echo_row_a(_("Image Source"), $project->image_source_name, TRUE); } // We choose not to show guests anything involving users' names. if ($user_is_logged_in) { echo_row_a(_("Project Manager"), $project->username); $checkedout_states = array(PROJ_POST_SECOND_CHECKED_OUT, PROJ_POST_COMPLETE, PROJ_SUBMIT_PG_POSTED); if ($site_supports_corrections_after_posting) { $checkedout_states[] = PROJ_CORRECT_CHECKED_OUT; } if (!empty($project->postproofer)) { $PPer = $project->postproofer; } else { if (!empty($project->checkedoutby) && !in_array($project->state, $checkedout_states)) { $PPer = $project->checkedoutby; } } if (isset($PPer)) { echo_row_a(_("Post Processor"), $PPer); } if (!empty($project->ppverifier)) { $PPVer = $project->ppverifier; } else { if (!empty($project->checkedoutby) && in_array($project->state, array(PROJ_POST_SECOND_CHECKED_OUT, PROJ_POST_COMPLETE, PROJ_SUBMIT_PG_POSTED))) { $PPVer = $project->checkedoutby; } } if (isset($PPVer)) { echo_row_a(_("PP Verifier"), $PPVer); } if ($site_supports_corrections_after_posting) { // included for completeness if (!empty($project->checkedoutby) && $project->state == PROJ_CORRECT_CHECKED_OUT) { $CorrectionsReviewer = $project->checkedoutby; } if (isset($CorrectionsReviewer)) { echo_row_a(_("Corrections Reviewer"), $CorrectionsReviewer); } } echo_row_a(_("Credits line so far"), $project->credits_line, TRUE); } // ------------------------------------------------------------------------- // Current activity $formatted_now = strftime($time_format, time()); $ct = _("Current Time"); $current_time_addition = " ({$ct}: {$formatted_now})"; echo_row_a(_("Last Edit of Project Info"), strftime($datetime_format, $project->t_last_edit) . $current_time_addition); echo_row_a(_("Last State Change"), strftime($datetime_format, $project->modifieddate)); if ($round) { $proofdate = mysql_query("\n SELECT {$round->time_column_name}\n FROM {$projectid}\n WHERE state='{$round->page_save_state}'\n ORDER BY {$round->time_column_name} DESC\n LIMIT 1\n "); if (mysql_num_rows($proofdate) != 0) { $latest_save_time = mysql_result($proofdate, 0, $round->time_column_name); $lastproofed = strftime($datetime_format, $latest_save_time); } else { $lastproofed = _("Project has not been proofread in this round."); } echo_row_a(_("Last Proofread"), $lastproofed); } // ------------------------------------------------------------------------- // We choose not to show guests the word lists. if ($user_is_logged_in) { $good_bad = array('good' => _("Good Words"), 'bad' => _("Bad Words")); $links = ''; foreach ($good_bad as $gb => $label) { $f = get_project_word_file($projectid, $gb); if ($f->size > 0) { $links .= new_window_link($f->abs_url, $label); $links .= " - " . _("Last modified") . ": " . strftime($datetime_format, $f->mod_time); } else { $links .= $label . " " . _("(empty)"); } $links .= "<br>"; } echo_row_a(_("Word Lists"), $links); } // ------------------------------------------------------------------------- $state = $project->state; if ($state == PROJ_SUBMIT_PG_POSTED || $site_supports_corrections_after_posting && ($state == PROJ_CORRECT_AVAILABLE || $state == PROJ_CORRECT_CHECKED_OUT)) { $postednum = $project->postednum; echo_row_a(_("PG etext number"), $postednum . " – " . sprintf(_("<a href='%s'>Read this text</a> at Project Gutenberg"), get_pg_catalog_url_for_etext($postednum))); } // ------------------------------------------------------------------------- // Forum topic $topic_id = $project->topic_id; if (!empty($topic_id)) { $last_post_date = get_last_post_time_in_topic($topic_id); $last_post_date = strftime($datetime_format, $last_post_date); echo_row_a(_("Last Forum Post"), $last_post_date); } // If the topic is only visible to logged-in users, // there's little point showing guests the link to it. if ($user_is_logged_in) { if ($state == PROJ_DELETE && $topic_id == "") { echo_row_a(_("Forum"), _("The project has been deleted, and no discussion exists.")); } else { if ($topic_id == "") { $blurb = _("Start a discussion about this project"); $url = "{$code_url}/tools/proofers/project_topic.php?project={$projectid}"; echo_row_a(_("Forum"), "<a href='{$url}'>{$blurb}</a>"); } else { $details = get_topic_details($topic_id); $url = get_url_to_view_topic($details["topic_id"]); $blurb = _("Discuss this project"); $replies = sprintf(_("(%d replies)"), $details['num_replies']); echo_row_a(_("Forum"), "<a href='{$url}'>{$blurb}</a> {$replies}"); } } } // ------------------------------------------------------------------------- // For now, we say that guests can't see page details. if ($user_is_logged_in) { global $detail_level; if ($detail_level >= 4) { // We'll call do_page_table later, so we don't need the "Page Detail" link. } else { if ($project->pages_table_exists) { $url = "{$code_url}/tools/project_manager/page_detail.php?project={$projectid}&show_image_size=0"; $blurb = _("Images, Pages Proofread, & Differences"); $url2 = "{$url}&select_by_user"; $blurb2 = _("Just my pages"); $detail = "<a href='{$url}'>{$blurb}</a> >><a href='{$url2}'>{$blurb2}</a><<"; } else { if ($project->archived != 0) { $detail = _("The project has been archived, so page details are not available."); } elseif ($project->state == PROJ_DELETE) { $detail = _("The project has been deleted, so page details are not available."); } else { $detail = _("Page details are not available for this project."); } } echo_row_a(_("Page Detail"), $detail); } } // ------------------------------------------------------------------------- // Personal data with respect to this project // If you're not logged in, we certainly can't show your personal data. if ($user_is_logged_in) { global $detail_level; if ($round && $detail_level > 1) { recentlyproofed(0); recentlyproofed(1); } } // ------------------------------------------------------------------------- // Comments global $pguser; $postcomments = get_formatted_postcomments($project->projectid); if ($postcomments != '') { if ($available_for_SR) { echo_row_b(_("Instructions for Smooth Reading"), ''); echo_row_c($postcomments); } elseif ($project->PPer_is_current_user || $project->PPVer_is_current_user || $project->can_be_managed_by_current_user || $state == PROJ_POST_FIRST_AVAILABLE && user_can_work_in_stage($pguser, 'PP') || $state == PROJ_POST_SECOND_AVAILABLE && user_can_work_in_stage($pguser, 'PPV')) { echo_row_b(_("Post Processor's Comments"), ''); echo_row_c($postcomments); } } // -------- // For now, we suppress Project Comments for guests. // (They might be confused by the instructions for proofreaders.) if ($user_is_logged_in) { $comments = $project->comments; // Automatically prepend second round comments template for Beginners Only // The r2 in the template name is an artifact of the old two-round structure if ($project->difficulty == "beginner") { if ($round && $round->is_a_mentor_round()) { $comments = "[template=BGr2.txt]" . $comments; } } // insert e.g. templates and biographies $comments = parse_project_comments($comments); if ($comments == '') { // Put in *something*, otherwise it'll probably look odd. $comments = ' '; } if ($round) { $a = sprintf(_("The <a href='%s'>Guidelines</a> give detailed instructions for working in this round."), "{$code_url}/faq/{$round->document}"); $b = _('The instructions below are particular to this project, and <b>take precedence over those guidelines</b>.'); $time_str = strftime($datetime_format, $project->t_last_change_comments); $c = "(" . _("Last modified") . ": " . $time_str . ")"; $comments_blurb = "{$a}<br>{$b}<br>{$c}"; } else { $comments_blurb = ""; } echo_row_b(_("Project Comments"), $comments_blurb); echo_row_c($comments); } // ------------------------------------------------------------------------- echo "</table>"; }
echo "<p>"; echo sprintf('Warning: Project "%1$s" is no longer in state "%2$s"; it is now in state "%3$s".', $project->nameofwork, $expected_state_text, project_states_text($project->state)); echo "</p>\n"; $expected_round = get_Round_for_project_state($expected_state); echo "<p>"; echo sprintf(_('Back to <a href="%s">%s</a>'), "{$code_url}/tools/proofers/round.php?round_id={$expected_round->id}", $expected_round->name); echo "</p>\n"; exit; } // 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
<?php $relPath = '../../pinc/'; include_once $relPath . 'base.inc'; include_once $relPath . 'project_states.inc'; include_once $relPath . 'slim_header.inc'; include_once $relPath . 'misc.inc'; // html_safe() require_login(); $title = sprintf(_("%s Catalog"), $site_name); slim_header($title); echo "<h1>{$title}</h1>"; echo "<p>" . _("This page lists all projects, grouped by state. (We could have other ways of grouping/ordering. We could also have a search interface.) Click on a project title to go to its home page.") . "</p>"; foreach ($PROJECT_STATES_IN_ORDER as $proj_state) { echo "<h3>"; echo project_states_text($proj_state); echo ":</h3>\n"; $rows = mysql_query("SELECT projectid, nameofwork, authorsname, language FROM projects WHERE state='{$proj_state}'") or die(mysql_error()); if (mysql_numrows($rows) == 0) { echo "none<br>\n"; } else { while ($row = mysql_fetch_array($rows)) { $projectid = $row['projectid']; $nameofwork = $row['nameofwork']; $authorsname = $row['authorsname']; $language = $row['language']; // TRANSLATORS: format is: name_of_work by author (in language) echo sprintf(_("<a href='%1\$s'>%2\$s</a> by %3\$s (in %4\$s)"), "{$code_url}/project.php?id={$projectid}", html_safe($nameofwork), html_safe($authorsname), html_safe($language)) . "<br>\n"; } } }