Ticket #661: team.inc.patch

File team.inc.patch, 16.3 KB (added by Simek, 16 years ago)
  • team.inc

     
    1212
    1313function team_search_form($params) {
    1414    echo "
    15         <form name=form action=team_search.php>
     15        <form name=\"form\" action=\"team_search.php\">
    1616    ";
    1717    start_table();
    18     row2("<b>Search criteria (use one or more)</b>", "");
    19     row2("Key words<br><span class=note>Find teams with these words in their names or descriptions</span>", "<input name=keywords value=\"$params->keywords\">");
    20     row2_init("Country", "");
    21     echo "<select name=country><option value=\"\" selected>---</option>";
     18    row2("<b>".tra("Search criteria (use one or more)")."</b>", "");
     19    row2(tra("Key words"). "<br/><span class=\"note\">".tra("Find teams with these words in their names or descriptions")."</span>", "<input name=\"keywords\" value=\"$params->keywords\">");
     20    row2_init(tra("Country"), "");
     21    echo "<select name=\"country\"><option value=\"\" selected>---</option>";
    2222    $country = $params->country;
    2323    if (!$country || $country == 'None') $country = "XXX";
    2424    print_country_select($country);
    2525    echo "</select></td></tr>\n";
    26     row2("Type of team", team_type_select($params->type, true));
     26    row2(tra("Type of team"), team_type_select($params->type, true));
    2727    $checked = $params->active?"checked":"";
    28     row2("Show only active teams", "<input type=checkbox name=active $checked>");
    29     row2("", "<input type=submit name=submit value=Search>");
     28    row2(tra("Show only active teams"), "<input type=\"checkbox\" name=\"active\" $checked>");
     29    row2("", "<input type=\"submit\" name=\"submit\" value=\"".tra("Search")."\">");
    3030    end_table();
    3131    echo "
    3232        </form>
     
    3737    $now = time();
    3838    if (new_transfer_request_ok($team, $now)) {
    3939        if ($team->userid == $user->id) {
    40             return "None";
     40            return "".tra("None")."";
    4141        } else {
    42             return "<a href=\"team_founder_transfer_form.php\">Initiate request</a>";
     42            return "<a href=\"team_founder_transfer_form.php\">".tra("Initiate request")."</a>";
    4343        }
    4444    }
    4545    if ($team->ping_user == $user->id) {
    4646        if (transfer_ok($team, now)) {
    47             return "Requested by you, and founder response deadline has passed.  <a href=\"team_founder_transfer_form.php\">Complete foundership transfer</a>.";
     47            return "".tra("Requested by you, and founder response deadline has passed.")."  <a href=\"team_founder_transfer_form.php\">".tra("Complete foundership transfer")."</a>.";
    4848        } else {
    4949            $deadline = date_str(transfer_ok_time($team));
    50             return "<a href=\"team_founder_transfer_form.php\">Requested by you</a>; founder response deadline is $deadline";
     50            return "<a href=\"team_founder_transfer_form.php\">".tra("Requested by you")."</a>; ".tra("founder response deadline is")." $deadline";
    5151        }
    5252    }
    53     return "<a href=\"team_founder_transfer_form.php\">Deferred</a>";
     53    return "<a href=\"team_founder_transfer_form.php\">".tra("Deferred")."</a>";
    5454}
    5555
    5656function display_team_page($team, $user) {
     
    5959    echo sanitize_html($team->name_html);
    6060    echo "<p>";
    6161    start_table();
    62     row1("Team info");
     62    row1(tra("Team info"));
    6363    if (strlen($team->description)) {
    64         row2("Description", sanitize_html($team->description));
     64        row2(tra("Description"), sanitize_html($team->description));
    6565    }
    6666    if (strlen($team->url)) {;
    6767        if (strstr($team->url, "http://")) {
     
    6969        } else {
    7070            $x = "http://$team->url";
    7171        }
    72         row2("Web site", "<a href=$x>$x</a>");
     72        row2(tra("Web site"), "<a href=\"$x\">$x</a>");
    7373    }
    7474   
    75     if (!no_computing()) {
    76         row2("Total credit", format_credit_large($team->total_credit));
    77         row2("Recent average credit", format_credit_large($team->expavg_credit));
    78     }
    79     row2("Country", $team->country);
    80     row2("Type", team_type_name($team->type));
     75        if (!no_computing()) {
     76                row2(tra("Total credit"), format_credit_large($team->total_credit));
     77                row2(tra("Recent average credit"), format_credit_large($team->expavg_credit));
     78        }
     79    row2(tra("Country"), $team->country);
     80    row2(tra("Type"), team_type_name($team->type));
    8181
    8282    if ($team->forum && is_forum_visible_to_user($team->forum, $user)) {
    8383        $f = $team->forum;
    84         row2("<a href=team_forum.php?teamid=$team->id>Message board</a>",
    85             "Threads: $f->threads<br>Posts: $f->posts<br>Last post: ".time_diff_str($f->timestamp, time())
     84        row2("<a href=\"team_forum.php?teamid=$team->id\">".tra("Message board")."</a>",
     85            "".tra("Threads").": $f->threads<br/>".tra("Posts").": $f->posts<br/>".tra("Last post").": ".time_diff_str($f->timestamp, time())
    8686        );
    8787    }
    8888    if ($user) {
    8989        if ($user->teamid != $team->id) {
    9090            $tokens = url_tokens($user->authenticator);
    9191            row2("",
    92                 "<a href='team_join.php?$tokens&teamid=$team->id'>Join this team</a>
    93                 <br><span class=note>Note: if 'OK to email' is set in your project preferences, joining a team gives its founder access to your email address.</span>"
     92                "<a href=\"team_join.php?$tokens&teamid=$team->id\">".tra("Join this team")."</a>
     93                <br/><span class=\"note\">".tra("Note: if 'OK to email' is set in your project preferences, joining a team gives its founder access to your email address.")."</span>"
    9494            );
    9595        }
    9696        if (($user->teamid == $team->id)) {
    9797            if (($user->id == $team->userid)) {
    9898                if ($team->ping_user) {
    9999                    $deadline = date_str(transfer_ok_time($team));
    100                     row2("Foundership change requested",
    101                         "<a href=team_change_founder_form.php?teamid=$team->id>Respond by $deadline</a>"
     100                    row2(tra("Foundership change requested"),
     101                        "<a href=\"team_change_founder_form.php?teamid=$team->id\">".tra("Respond by")." $deadline</a>"
    102102                    );
    103103                }
    104104            } else {
    105                 row2("Team foundership change", foundership_transfer_link($user, $team));
     105                row2(tra("Team foundership change"), foundership_transfer_link($user, $team));
    106106            }
    107107        }
    108108    }
    109     row1("Members");
    110     row2("Founder", user_links($team->founder));
     109    row1(tra("Members"));
     110    row2(tra("Founder"), user_links($team->founder));
    111111    if (count($team->admins)) {
    112112        $first = true;
    113113        $x = "";
     
    119119            }
    120120            $x .= user_links($a);
    121121        }
    122         row2("Admins", $x);
     122        row2(tra("Admins"), $x);
    123123    }
    124124    $x = "0";
    125125    if (count($team->new_members)) {
     
    134134            $x .= user_links($a);
    135135        }
    136136    }
    137     row2("New members in last day", $x);
    138     row2("Total members", "$team->nusers (<a href=team_members.php?teamid=$team->id&offset=0&sort_by=expavg_credit>view</a>)");
    139     row2("Active members", "$team->nusers_active (<a href=team_members.php?teamid=$team->id&offset=0&sort_by=expavg_credit>view</a>)");
    140     row2("Members with credit", "$team->nusers_worked (<a href=team_members.php?teamid=$team->id&offset=0&sort_by=total_credit>view</a>)");
     137    row2(tra("New members in last day"), $x);
     138    row2(tra("Total members"), "$team->nusers (<a href=\"team_members.php?teamid=$team->id&offset=0&sort_by=expavg_credit\">".tra("view")."</a>)");
     139    row2(tra("Active members"), "$team->nusers_active (<a href=\"team_members.php?teamid=$team->id&offset=0&sort_by=expavg_credit\">".tra("view")."</a>)");
     140    row2(tra("Members with credit"), "$team->nusers_worked (<a href=\"team_members.php?teamid=$team->id&offset=0&sort_by=total_credit\">".tra("view")."</a>)");
    141141    end_table();
    142142}
    143143
     
    160160   
    161161    start_table();
    162162    echo "<tr>
    163         <th>Name</th>
     163        <th>".tra("Name")."</th>
    164164    ";
    165     if (!no_computing()) {
    166         if ($nosort) {
    167             echo "
    168                 <th>Total credit</th>
    169                 <th>Recent average credit</th>
    170             ";
    171         } else {
    172             if ($sort_by == "total_credit") {
    173                 echo "<th>Total credit</th>";
    174             } else {
    175                 echo "<th><a href=team_members.php?teamid=$team->id&sort_by=total_credit&offset=$offset>Total credit</a></th>";
    176             }
    177             if ($sort_by == "expavg_credit") {
    178                 echo "<th>Recent average credit</th>";
    179             } else {
    180                 echo "<th><a href=team_members.php?teamid=$team->id&sort_by=expavg_credit&offset=$offset>Recent average credit</a></th>";
    181             }
    182         }
     165        if (!no_computing()) {
     166                if ($nosort) {
     167                        echo "
     168                                <th>".tra("Total credit")."</th>
     169                                <th>".tra("Recent average credit")."</th>
     170                        ";
     171            } else {
     172                        if ($sort_by == "total_credit") {
     173                                echo "<th>".tra("Total credit")."</th>";
     174                        } else {
     175                                echo "<th><a href=\"team_members.php?teamid=$team->id&sort_by=total_credit&offset=$offset\">".tra("Total credit")."</a></th>";
     176                        }
     177                        if ($sort_by == "expavg_credit") {
     178                                echo "<th>".tra("Recent average credit")."</th>";
     179                        } else {
     180                                echo "<th><a href=\"team_members.php?teamid=$team->id&sort_by=expavg_credit&offset=$offset\">".tra("Recent average credit")."</a></th>";
     181                        }
     182                }
    183183    }
    184184
    185185    echo "
    186         <th>Country</th>
     186        <th>".tra("Country")."</th>
    187187        </tr>
    188188    ";
    189189
     
    203203        } else if (is_team_admin_aux($user, $admins)) {
    204204            $x .= " [Admin]";
    205205        }
    206         echo "<tr class=row1>
    207             <td align=left>$j) $x
    208         ";
    209         if (!no_computing()) {
    210             echo "
    211                 <td align=right>$user_total_credit</td>
    212                 <td align=right>$user_expavg_credit</td>
    213             ";
    214         }
    215         echo "
    216             <td align=center>$user->country</td>
     206        echo "<tr class=\"row1\">
     207            <td align=\"left\">$j) $x
     208                ";
     209                if (!no_computing()) {
     210                        echo "
     211                                <td align=\"right\">$user_total_credit</td>
     212                                <td align=\"right\">$user_expavg_credit</td>
     213                        ";
     214                }
     215                echo "
     216            <td align=\"center\">$user->country</td>
    217217            </tr>
    218218        ";
    219219        $j++;
     
    222222
    223223    if ($offset > 0) {
    224224        $new_offset = $offset - $n;
    225         echo "<a href=team_members.php?teamid=$team->id&sort_by=$sort_by&offset=$new_offset>Last $n</a> | ";
     225        echo "<a href=\"team_members.php?teamid=$team->id&sort_by=$sort_by&offset=$new_offset\">".tra("Last")." $n</a> | ";
    226226    }
    227227    if ($j == $offset + $n + 1) {
    228228        $new_offset = $offset + $n;
    229         echo "<a href=team_members.php?teamid=$team->id&sort_by=$sort_by&offset=$new_offset>Next $n</a>";
     229        echo "<a href=\"team_members.php?teamid=$team->id&sort_by=$sort_by&offset=$new_offset\">".tra("Next")." $n</a>";
    230230    }
    231231}
    232232
     
    234234//
    235235function require_team($team) {
    236236    if (!$team) {
    237         error_page("No such team.");
     237        error_page(tra("No such team."));
    238238    }
    239239}
    240240
     
    247247function require_founder_login($user, $team) {
    248248    require_team($team);
    249249    if ($user->id != $team->userid) {
    250         error_page("This operation requires foundership.");
     250        error_page(tra("This operation requires foundership."));
    251251    }
    252252}
    253253
     
    271271
    272272function require_admin($user, $team) {
    273273    if (!is_team_admin($user, $team)) {
    274         error_page("This operation requires team admin privileges");
     274        error_page(tra("This operation requires team admin privileges."));
    275275    }
    276276}
    277277
     
    308308    ";
    309309    if ($sort_by == "total_credit") {
    310310        echo "
    311             <th><a href=top_teams.php?sort_by=expavg_credit".$type_url.">".tra("Recent average credit")."</a></th>
     311            <th><a href=\"top_teams.php?sort_by=expavg_credit".$type_url."\">".tra("Recent average credit")."</a></th>
    312312            <th>".tra("Total credit")."</th>
    313313        ";
    314314    } else {
    315315        echo "
    316316            <th>".tra("Recent average credit")."</th>
    317             <th><a href=top_teams.php?sort_by=total_credit".$type_url.">".tra("Total credit")."</a></th>
     317            <th><a href=\"top_teams.php?sort_by=total_credit".$type_url."\">".tra("Total credit")."</a></th>
    318318        ";
    319319    }
    320320    echo "
    321321        <th>".tra("Country")."</th>
    322         <th>Type</th>
     322        <th>".tra("Type")."</th>
    323323        </tr>
    324324    ";
    325325}
     
    327327function show_team_row($team, $i) {
    328328    $team_expavg_credit = format_credit_large($team->expavg_credit);
    329329    $team_total_credit = format_credit_large($team->total_credit);
    330     echo"<tr class=row1>
     330    echo"<tr class=\"row1\">
    331331        <td>$i</td>
    332         <td><a href=team_display.php?teamid=$team->id>$team->name</a></td>
    333         <td align=right>".$team->nusers."</td>
    334         <td align=right>$team_expavg_credit</td>
    335         <td align=right>$team_total_credit</td>
     332        <td><a href=\"team_display.php?teamid=$team->id\">$team->name</a></td>
     333        <td align=\"right\">".$team->nusers."</td>
     334        <td align=\"right\">$team_expavg_credit</td>
     335        <td align=\"right\">$team_total_credit</td>
    336336        <td>$team->country</td>
    337337        <td>".team_type_name($team->type)."</td>
    338338        </tr>\n";
     
    363363
    364364function team_edit_form($team, $label, $url) {
    365365    global $team_types;
    366     echo "<form method=post action=$url>\n";
     366    echo "<form method=\"post\" action=\"$url\">\n";
    367367    if ($team) {
    368         echo "<input type=hidden name=teamid value=$team->id>\n";
     368        echo "<input type=\"hidden\" name=\"teamid\" value=\"$team->id\">\n";
    369369    }
    370370    echo "
    371371        <p>
    372         <b>Privacy note</b>: if you create a team, your project preferences
    373         (resource share, graphics preferences)
    374         will be visible to the public.
     372        <b>".tra("Privacy note")."</b>: ".tra("if you create a team, your project preferences (resource share, graphics preferences) will be visible to the public.")."
    375373        <p>
    376374    ";
    377375    start_table();
    378     row2( "Team name, text version
    379         <br><span class=note> Don't use HTML tags.  </span>",
    380         "<input name=name type=text size=50 value='$team->name'>"
     376    row2(tra("Team name, text version"), "<br/>
     377                <span class=\"note\">".tra("Don't use HTML tags.")."</span>",
     378        "<input name=\"name\" type=\"text\" size=\"50\" value=\"$team->name\">"
    381379    );
    382     row2("Team name, HTML version
    383         <br><span class=note>
    384         You may use <a href=html.php target=_new>limited HTML tags</a>.
    385         If you don't know HTML, leave this box blank.</span>",
    386         "<input name=name_html type=text size=50 value=\"".str_replace('"',"'",$team->name_html)."\">"
     380    row2(tra("Team name, HTML version"), "<br/>
     381                <span class=\"note\">".tra("You may use")." <a href=\"html.php\" target=\"_new\">".tra("limited HTML tags")."</a>. ".tra("If you don't know HTML, leave this box blank.")."</span>",
     382        "<input name=\"name_html\" type=\"text\" size=\"50\" value=\"".str_replace('"',"'",$team->name_html)."\">"
    387383    );
    388     row2("URL of team web page, if any:<br><font size=-2>(without \"http://\")
    389         This URL will be linked to from the team's page on this site.",
    390         "<input name=url size=60 value='$team->url'>"
     384    row2(tra("URL of team web page, if any"), ":<br/>
     385                <font size=\"-2\">(".tra("without")." \"http://\") ".tra("This URL will be linked to from the team's page on this site.")."",
     386        "<input name=\"url\" size=\"60\" value=\"$team->url\">"
    391387    );
    392     row2("Description of team:
    393         <br><span class=note>
    394         You may use <a href=html.php target=_new>limited HTML tags</a>.
    395         </span>",
    396         "<textarea name=description cols=60 rows=10>$team->description</textarea>"
     388    row2(tra("Description of team"), ": <br/>
     389                <span class=\"note\">".tra("You may use")." <a href=\"html.php\" target=\"_new\">".tra("limited HTML tags")."</a>.</span>",
     390        "<textarea name=\"description\" cols=\"60\" rows=\"10\">$team->description</textarea>"
    397391    );
    398392
    399     row2("Type of team:", team_type_select($team->type));
     393    row2(tra("Type of team"), ":", team_type_select($team->type));
    400394
    401     row2_init("Country",
    402         "<select name=country>"
     395    row2_init(tra("Country"),
     396        "<select name=\"country\">"
    403397    );
    404398    print_country_select($team->country);
    405399   
    406400    echo "</select></b></td></tr>\n";
    407401    row2("",
    408         "<input type=submit name=new value='$label'>"
     402        "<input type=\"submit\" name=\"new\" value=\"$label\">"
    409403    );
    410404    end_table();
    411405    echo "</form>\n";