Ticket #661: team.inc.patch
File team.inc.patch, 16.3 KB (added by , 16 years ago) |
---|
-
team.inc
12 12 13 13 function team_search_form($params) { 14 14 echo " 15 <form name= form action=team_search.php>15 <form name=\"form\" action=\"team_search.php\"> 16 16 "; 17 17 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=keywordsvalue=\"$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>"; 22 22 $country = $params->country; 23 23 if (!$country || $country == 'None') $country = "XXX"; 24 24 print_country_select($country); 25 25 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)); 27 27 $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")."\">"); 30 30 end_table(); 31 31 echo " 32 32 </form> … … 37 37 $now = time(); 38 38 if (new_transfer_request_ok($team, $now)) { 39 39 if ($team->userid == $user->id) { 40 return " None";40 return "".tra("None").""; 41 41 } 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>"; 43 43 } 44 44 } 45 45 if ($team->ping_user == $user->id) { 46 46 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>."; 48 48 } else { 49 49 $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"; 51 51 } 52 52 } 53 return "<a href=\"team_founder_transfer_form.php\"> Deferred</a>";53 return "<a href=\"team_founder_transfer_form.php\">".tra("Deferred")."</a>"; 54 54 } 55 55 56 56 function display_team_page($team, $user) { … … 59 59 echo sanitize_html($team->name_html); 60 60 echo "<p>"; 61 61 start_table(); 62 row1( "Team info");62 row1(tra("Team info")); 63 63 if (strlen($team->description)) { 64 row2( "Description", sanitize_html($team->description));64 row2(tra("Description"), sanitize_html($team->description)); 65 65 } 66 66 if (strlen($team->url)) {; 67 67 if (strstr($team->url, "http://")) { … … 69 69 } else { 70 70 $x = "http://$team->url"; 71 71 } 72 row2( "Web site", "<a href=$x>$x</a>");72 row2(tra("Web site"), "<a href=\"$x\">$x</a>"); 73 73 } 74 74 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)); 81 81 82 82 if ($team->forum && is_forum_visible_to_user($team->forum, $user)) { 83 83 $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()) 86 86 ); 87 87 } 88 88 if ($user) { 89 89 if ($user->teamid != $team->id) { 90 90 $tokens = url_tokens($user->authenticator); 91 91 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>" 94 94 ); 95 95 } 96 96 if (($user->teamid == $team->id)) { 97 97 if (($user->id == $team->userid)) { 98 98 if ($team->ping_user) { 99 99 $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>" 102 102 ); 103 103 } 104 104 } else { 105 row2( "Team foundership change", foundership_transfer_link($user, $team));105 row2(tra("Team foundership change"), foundership_transfer_link($user, $team)); 106 106 } 107 107 } 108 108 } 109 row1( "Members");110 row2( "Founder", user_links($team->founder));109 row1(tra("Members")); 110 row2(tra("Founder"), user_links($team->founder)); 111 111 if (count($team->admins)) { 112 112 $first = true; 113 113 $x = ""; … … 119 119 } 120 120 $x .= user_links($a); 121 121 } 122 row2( "Admins", $x);122 row2(tra("Admins"), $x); 123 123 } 124 124 $x = "0"; 125 125 if (count($team->new_members)) { … … 134 134 $x .= user_links($a); 135 135 } 136 136 } 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>)"); 141 141 end_table(); 142 142 } 143 143 … … 160 160 161 161 start_table(); 162 162 echo "<tr> 163 <th> Name</th>163 <th>".tra("Name")."</th> 164 164 "; 165 if (!no_computing()) { 166 167 168 <th>Total credit</th>169 <th>Recent average credit</th>170 171 172 173 echo "<th>Total credit</th>";174 175 echo "<th><a href=team_members.php?teamid=$team->id&sort_by=total_credit&offset=$offset>Total credit</a></th>";176 177 178 echo "<th>Recent average credit</th>";179 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 } 183 183 } 184 184 185 185 echo " 186 <th> Country</th>186 <th>".tra("Country")."</th> 187 187 </tr> 188 188 "; 189 189 … … 203 203 } else if (is_team_admin_aux($user, $admins)) { 204 204 $x .= " [Admin]"; 205 205 } 206 echo "<tr class= row1>207 <td align= left>$j) $x208 209 if (!no_computing()) { 210 211 <td align=right>$user_total_credit</td>212 <td align=right>$user_expavg_credit</td>213 214 215 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> 217 217 </tr> 218 218 "; 219 219 $j++; … … 222 222 223 223 if ($offset > 0) { 224 224 $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> | "; 226 226 } 227 227 if ($j == $offset + $n + 1) { 228 228 $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>"; 230 230 } 231 231 } 232 232 … … 234 234 // 235 235 function require_team($team) { 236 236 if (!$team) { 237 error_page( "No such team.");237 error_page(tra("No such team.")); 238 238 } 239 239 } 240 240 … … 247 247 function require_founder_login($user, $team) { 248 248 require_team($team); 249 249 if ($user->id != $team->userid) { 250 error_page( "This operation requires foundership.");250 error_page(tra("This operation requires foundership.")); 251 251 } 252 252 } 253 253 … … 271 271 272 272 function require_admin($user, $team) { 273 273 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.")); 275 275 } 276 276 } 277 277 … … 308 308 "; 309 309 if ($sort_by == "total_credit") { 310 310 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> 312 312 <th>".tra("Total credit")."</th> 313 313 "; 314 314 } else { 315 315 echo " 316 316 <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> 318 318 "; 319 319 } 320 320 echo " 321 321 <th>".tra("Country")."</th> 322 <th> Type</th>322 <th>".tra("Type")."</th> 323 323 </tr> 324 324 "; 325 325 } … … 327 327 function show_team_row($team, $i) { 328 328 $team_expavg_credit = format_credit_large($team->expavg_credit); 329 329 $team_total_credit = format_credit_large($team->total_credit); 330 echo"<tr class= row1>330 echo"<tr class=\"row1\"> 331 331 <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> 336 336 <td>$team->country</td> 337 337 <td>".team_type_name($team->type)."</td> 338 338 </tr>\n"; … … 363 363 364 364 function team_edit_form($team, $label, $url) { 365 365 global $team_types; 366 echo "<form method= post action=$url>\n";366 echo "<form method=\"post\" action=\"$url\">\n"; 367 367 if ($team) { 368 echo "<input type= hidden name=teamid value=$team->id>\n";368 echo "<input type=\"hidden\" name=\"teamid\" value=\"$team->id\">\n"; 369 369 } 370 370 echo " 371 371 <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.")." 375 373 <p> 376 374 "; 377 375 start_table(); 378 row2( "Team name, text version379 <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\">" 381 379 ); 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)."\">" 387 383 ); 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\">" 391 387 ); 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>" 397 391 ); 398 392 399 row2( "Type of team:", team_type_select($team->type));393 row2(tra("Type of team"), ":", team_type_select($team->type)); 400 394 401 row2_init( "Country",402 "<select name= country>"395 row2_init(tra("Country"), 396 "<select name=\"country\">" 403 397 ); 404 398 print_country_select($team->country); 405 399 406 400 echo "</select></b></td></tr>\n"; 407 401 row2("", 408 "<input type= submit name=new value='$label'>"402 "<input type=\"submit\" name=\"new\" value=\"$label\">" 409 403 ); 410 404 end_table(); 411 405 echo "</form>\n";