コード例 #1
0
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 = "&nbsp;&nbsp;&nbsp;({$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 . " &ndash; " . 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> &gt;&gt;<a href='{$url2}'>{$blurb2}</a>&lt;&lt;";
            } 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 = '&nbsp;';
        }
        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>";
}
コード例 #2
0
                                    show_tags($tags);
                                    ?>
		 </div>
		<?php 
                                    if ($_SESSION['logged'] == true) {
                                        vote_up($row_friends_activities_query['activity_tracker'], 'bookmark', $row_friends_activities_query['profile_ida']);
                                    }
                                    ?>
	</div>
 
 <?php 
                                } else {
                                    // *****************************************for showing topic updates ***********************
                                    $user1_info = get_user_info($row_friends_activities_query['profile_ida']);
                                    $row_bookmark = get_user_bookmark($row_friends_activities_query['activity_tracker']);
                                    $topic_details = get_topic_details($row_friends_activities_query['profile_idb']);
                                    ?>
 
 <div class="media">
	  <a class="pull-left" href="<?php 
                                    echo SITE_URL;
                                    ?>
/topic/<?php 
                                    echo str_replace(' ', '-', $topic_details['name']);
                                    ?>
">
		<img class="media-object" src="<?php 
                                    echo SITE_URL;
                                    ?>
/uploaded/topics/<?php 
                                    echo $topic_details['dp'];
コード例 #3
0
ファイル: tasks.php プロジェクト: cpeel/dproofreaders-shadow
function RelatedPostings($tid)
{
    global $tasks_url;
    $result = mysql_query("SELECT related_postings FROM tasks WHERE task_id = {$tid}");
    $related_postings = mysql_result($result, 0, "related_postings");
    echo "<table class='tasks'>\n";
    echo "<tr><td width='100%'><b>Related Topic ID&nbsp;&nbsp;</b>";
    echo "<form action='{$tasks_url}' method='post'>";
    echo "<input type='hidden' name='action' value='add_related_topic'>";
    echo "<input type='hidden' name='task_id' value='{$tid}'>";
    echo "<input type='text' name='related_posting' size='30' class='taskinp1'>&nbsp;&nbsp;";
    echo "<input type='submit' value='Add' class='taskinp2'>\n";
    echo " (Optional)";
    echo "</form>";
    $related_postings = decode_array($related_postings);
    asort($related_postings);
    while (list($key, $val) = each($related_postings)) {
        $row = get_topic_details($val);
        $forum_url = get_url_to_view_forum($row["forum_id"]);
        $topic_url = get_url_to_view_topic($row["topic_id"]);
        echo "<form action='{$tasks_url}' method='post'>";
        echo "<input type='hidden' name='action' value='remove_related_topic'>";
        echo "<input type='hidden' name='task_id' value='{$tid}'>";
        echo "<input type='hidden' name='related_posting' value='" . $row["topic_id"] . "'>";
        echo "<a href='{$forum_url}'>" . $row['forum_name'] . "</a>";
        echo "&nbsp;&raquo;&nbsp;";
        echo "<a href='{$topic_url}'>" . $row['title'] . "</a>";
        echo " (Posted by: " . $row['creator_username'] . " - " . $row['num_replies'] . " replies)\n";
        echo "<input type='submit' value='Remove' class='taskinp2'>\n";
        echo "</form>";
    }
    echo "</td></tr></table>";
}