1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089
|
<?php
/*
This script displays task details when in view mode, and allows the
user to edit task details when in edit mode. It also shows comments,
attachments, notifications etc.
*/
$fs->get_language_pack($lang, 'details');
$fs->get_language_pack($lang, 'newtask');
$fs->get_language_pack($lang, 'index');
// Only load this page if a valid task was actually requested
if (!$fs->GetTaskDetails($_GET['id']))
$fs->Redirect( $fs->CreateURL('error', null) );
$task_details = $fs->GetTaskDetails($_GET['id']);
// declare variables
$deps_open = null;
// and the user has permission to view it
if ($task_details['project_is_active'] == '1'
&& ($project_prefs['others_view'] == '1'
OR @$permissions['view_tasks'] == '1')
&& (($task_details['mark_private'] == '1'
&& $task_details['assigned_to'] == $current_user['user_id'])
OR @$permissions['manage_project'] == '1'
OR $task_details['mark_private'] != '1')
)
{
// Create an array with effective permissions for this user on this task
$effective_permissions = array();
// Confirm that the user can modify this task or not
if (@$permissions['modify_all_tasks'] == '1'
OR (@$permissions['modify_own_tasks'] == '1' && $task_details['assigned_to'] == $current_user['user_id']))
$effective_permissions['can_edit'] = '1';
// Check if the user can take ownership of this task
if ((@$permissions['assign_to_self'] == '1' && empty($task_details['assigned_to']))
OR @$permissions['assign_others_to_self'] == '1'
&& $task_details['assigned_to'] != $current_user['user_id'])
$effective_permissions['can_take_ownership'] = '1';
// Check if the user can close this task
if ((@$permissions['close_own_tasks'] == '1' && ($task_details['assigned_to'] == $current_user['user_id']))
OR @$permissions['close_other_tasks'] == '1')
$effective_permissions['can_close'] = '1';
///////////////////////////////////
// If the user can modify tasks, //
// and the task is still open, //
// and we're in edit mode, //
// then use this section. //
///////////////////////////////////
if (@$effective_permissions['can_edit'] == '1'
&& $task_details['is_closed'] != '1'
&& isset($_GET['edit']) && $_GET['edit'] == 'yep')
{
?>
<!-- create some columns -->
<div id="taskdetails">
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="post">
<div>
<h2 class="severity<?php echo $task_details['task_severity'];?>">
<?php echo 'FS#' . $task_details['task_id'];?> —
<input class="severity<?php echo stripslashes($task_details['task_severity']);?>" type="text" name="item_summary" size="50" maxlength="100" value="<?php echo htmlspecialchars(stripslashes($task_details['item_summary']),ENT_COMPAT,'utf-8');?>" />
</h2>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<input type="hidden" name="edit_start_time" value="<?php echo date('U') ?>" />
<?php echo $details_text['attachedtoproject'] . ' — ';?>
<select name="attached_to_project">
<?php
// If the user has permission to view all projects
if (@$permissions['global_view'] == '1')
{
$get_projects = $db->Query("SELECT * FROM {$dbprefix}projects
WHERE project_is_active = '1'
ORDER BY project_title");
// or, if the user is logged in
} elseif (isset($_COOKIE['flyspray_userid']))
{
$get_projects = $db->Query("SELECT DISTINCT p.*
FROM {$dbprefix}users_in_groups uig
LEFT JOIN {$dbprefix}groups g ON uig.group_id = g.group_id,
{$dbprefix}projects p
WHERE ((uig.user_id = ?
AND g.view_tasks = '1')
OR p.others_view = '1')
AND p.project_is_active = '1'
ORDER BY p.project_title",
array($current_user['user_id'])
);
} else
{
// Anonymous users
$get_projects = $db->Query("SELECT * FROM {$dbprefix}projects
WHERE project_is_active = '1'
AND others_view = '1'
ORDER BY project_title");
}
// Cycle through the results from whichever query above
while ($row = $db->FetchArray($get_projects))
{
if ($project_id == $row['project_id'])
{
echo '<option value="' . $row['project_id'] . '" selected="selected">' . stripslashes($row['project_title']) . '</option>';
} else {
echo '<option value="' . $row['project_id'] . '">' . stripslashes($row['project_title']) . '</option>';
}
}
?>
</select>
<div id="fineprint">
<?php
// Get the user details of the person who opened this item
if ($task_details['opened_by'])
{
$get_user_name = $db->Query("SELECT user_name, real_name FROM {$dbprefix}users WHERE user_id = ?", array($task_details['opened_by']));
list($user_name, $real_name) = $db->FetchArray($get_user_name);
} else
{
$user_name = $details_text['anonymous'];
}
$date_opened = $fs->formatDate($task_details['date_opened'], true);
echo $details_text['openedby'] . ' ' . $fs->LinkedUserName($task_details['opened_by']) . ' - ' . $date_opened;
// If it's been edited, get the details
if ($task_details['last_edited_by'])
{
$get_user_name = $db->Query("SELECT user_name, real_name FROM {$dbprefix}users WHERE user_id = ?", array($task_details['last_edited_by']));
list($user_name, $real_name) = $db->FetchArray($get_user_name);
$date_edited = $fs->formatDate($task_details['last_edited_time'], true);
echo '<br />' . $details_text['editedby'] . ' ' . $fs->LinkedUserName($task_details['last_edited_by']) . ' - ' . $date_edited;
}
?>
</div>
<div id="taskfields1">
<table class="taskdetails">
<tr>
<td><label for="tasktype"><?php echo $details_text['tasktype'];?></label></td>
<td>
<select id="tasktype" name="task_type">
<?php
// Get list of task types
$get_tasktypes = $db->Query("SELECT tasktype_id, tasktype_name FROM {$dbprefix}list_tasktype
WHERE show_in_list = '1'
AND (project_id = '0'
OR project_id = ?)
ORDER BY list_position",
array($project_id)
);
while ($row = $db->FetchArray($get_tasktypes))
{
if ($row['tasktype_id'] == $task_details['task_type'])
{
echo "<option value=\"{$row['tasktype_id']}\" selected=\"selected\">{$row['tasktype_name']}</option>";
} else
{
echo "<option value=\"{$row['tasktype_id']}\">{$row['tasktype_name']}</option>";
}
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="category"><?php echo $details_text['category'];?></label></td>
<td>
<select id="category" name="product_category">
<?php
$cat_list = $db->Query("SELECT category_id, category_name
FROM {$dbprefix}list_category
WHERE show_in_list = '1' AND parent_id < '1'
AND (project_id = '0'
OR project_id = ?)
ORDER BY list_position",
array($project_id)
);
while ($row = $db->FetchArray($cat_list))
{
$category_name = stripslashes($row['category_name']);
if ($task_details['product_category'] == $row['category_id'])
{
echo "<option value=\"{$row['category_id']}\" selected=\"selected\">$category_name</option>\n";
} else
{
echo "<option value=\"{$row['category_id']}\">$category_name</option>\n";
}
$subcat_list = $db->Query("SELECT category_id, category_name
FROM {$dbprefix}list_category
WHERE show_in_list = '1' AND parent_id = ?
ORDER BY list_position",
array($row['category_id'])
);
while ($subrow = $db->FetchArray($subcat_list))
{
$subcategory_name = stripslashes($subrow['category_name']);
if ($task_details['product_category'] == $subrow['category_id'])
{
echo "<option value=\"{$subrow['category_id']}\" selected=\"selected\"> →$subcategory_name</option>\n";
} else
{
echo "<option value=\"{$subrow['category_id']}\"> →$subcategory_name</option>\n";
}
}
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="status"><?php echo $details_text['status'];?></label></td>
<td>
<select id="status" name="item_status">
<?php
// let's get a list of statuses and compare it to the saved one
require("lang/$lang/status.php");
foreach($status_list as $key => $val)
{
if ($task_details['item_status'] == $key)
{
echo "<option value=\"$key\" selected=\"selected\">$val</option>\n";
} else
{
echo "<option value=\"$key\">$val</option>\n";
}
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="assignedto"><?php echo $details_text['assignedto'];?></label></td>
<td>
<input type="hidden" name="old_assigned" value="<?php echo $task_details['assigned_to'];?>" />
<select id="assignedto" name="assigned_to">
<?php
// see if it's been assigned
if ($task_details['assigned_to'] == "0")
{
echo "<option value=\"0\" selected=\"selected\">{$details_text['noone']}</option>\n";
} else
{
echo "<option value=\"0\">{$details_text['noone']}</option>\n";
}
$fs->ListUsers($task_details['assigned_to'], $project_id);
?>
</select>
</td>
</tr>
<tr>
<td><label for="os"><?php echo $details_text['operatingsystem'];?></label></td>
<td>
<select id="os" name="operating_system">
<?php
// Get list of operating systems
$get_os = $db->Query("SELECT os_id, os_name
FROM {$dbprefix}list_os
WHERE (project_id = ?
OR project_id = '0')
AND show_in_list = '1'
ORDER BY list_position",
array($project_id)
);
while ($row = $db->FetchArray($get_os))
{
if ($row['os_id'] == $task_details['operating_system'])
{
echo "<option value=\"{$row['os_id']}\" selected=\"selected\">{$row['os_name']}</option>";
} else
{
echo "<option value=\"{$row['os_id']}\">{$row['os_name']}</option>";
}
}
?>
</select>
</td>
</tr>
</table>
</div>
<div id="taskfields2">
<table class="taskdetails">
<tr>
<td><label for="severity"><?php echo $details_text['severity'];?></label></td>
<td>
<select id="severity" name="task_severity">
<?php
// Get list of severities
require("lang/$lang/severity.php");
foreach($severity_list as $key => $val)
{
if ($task_details['task_severity'] == $key)
{
echo "<option value=\"$key\" selected=\"selected\">$val</option>\n";
} else
{
echo "<option value=\"$key\">$val</option>\n";
}
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="priority"><?php echo $details_text['priority'];?></label></td>
<td>
<select id="priority" name="task_priority">
<?php
// Get list of priorities
require("lang/$lang/priority.php");
foreach($priority_list as $key => $val)
{
if ($task_details['task_priority'] == $key)
{
echo "<option value=\"$key\" selected=\"selected\">$val</option>\n";
} else
{
echo "<option value=\"$key\">$val</option>\n";
}
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="reportedver"><?php echo $details_text['reportedversion'];?></label><span id="reportedver"></span></td>
<td>
<?php
// Print the version name
echo $task_details['reported_version_name'];
?>
</td>
</tr>
<tr>
<td><label for="dueversion"><?php echo $details_text['dueinversion'];?></label></td>
<td>
<select id="dueversion" name="closedby_version">
<?php
// if we don't have a fix-it version, show undecided
if (!isset($closedby))
{
echo "<option value=\"\">{$details_text['undecided']}</option>\n";
} else
{
echo "<option value=\"\" selected=\"selected\">{$details_text['undecided']}</option>\n";
}
$get_version = $db->Query("SELECT version_id, version_name
FROM {$dbprefix}list_version
WHERE show_in_list = '1' AND version_tense = '3'
AND (project_id = '0'
OR project_id = ?)
ORDER BY list_position",
array($project_id,)
);
while ($row = $db->FetchArray($get_version))
{
if ($row['version_id'] == $task_details['closedby_version'])
{
echo "<option value=\"{$row['version_id']}\" selected=\"selected\">{$row['version_name']}</option>\n";
} else
{
echo "<option value=\"{$row['version_id']}\">{$row['version_name']}</option>\n";
}
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="duedate"><?php echo $details_text['duedate'];?></label></td>
<td id="duedate">
<?php
if (!empty($task_details['due_date']) )
{
$due_date = $fs->formatDate($task_details['due_date'], false);
$view_date = $fs->formatDate($task_details['due_date'], false);
} else
{
$due_date = '0';
$view_date = $details_text['undecided'];
}
?>
<input id="duedatehidden" type="hidden" name="due_date" value="<?php echo $due_date;?>" />
<span id="duedateview"><?php echo $view_date;?></span> <small>|</small>
<a href="#" onClick="document.getElementById('duedatehidden').value = '0';document.getElementById('duedateview').innerHTML = '<?php echo $details_text['undecided']?>'">X</a>
<script type="text/javascript">
Calendar.setup(
{
inputField : "duedatehidden", // ID of the input field
ifFormat : "%d-%b-%Y", // the date format
displayArea : "duedateview", // The display field
daFormat : "%d-%b-%Y",
button : "duedateview" // ID of the button
}
);
</script>
</td>
</tr>
<tr>
<td><label for="percent"><?php echo $details_text['percentcomplete'];?></label></td>
<td>
<select id="percent" name="percent_complete">
<option value="0" <?php if ($task_details['percent_complete'] == '0') { echo 'selected="selected"';};?>>0%</option>
<option value="10" <?php if ($task_details['percent_complete'] == '10') { echo 'selected="selected"';};?>>10%</option>
<option value="20" <?php if ($task_details['percent_complete'] == '20') { echo 'selected="selected"';};?>>20%</option>
<option value="30" <?php if ($task_details['percent_complete'] == '30') { echo 'selected="selected"';};?>>30%</option>
<option value="40" <?php if ($task_details['percent_complete'] == '40') { echo 'selected="selected"';};?>>40%</option>
<option value="50" <?php if ($task_details['percent_complete'] == '50') { echo 'selected="selected"';};?>>50%</option>
<option value="60" <?php if ($task_details['percent_complete'] == '60') { echo 'selected="selected"';};?>>60%</option>
<option value="70" <?php if ($task_details['percent_complete'] == '70') { echo 'selected="selected"';};?>>70%</option>
<option value="80" <?php if ($task_details['percent_complete'] == '80') { echo 'selected="selected"';};?>>80%</option>
<option value="90" <?php if ($task_details['percent_complete'] == '90') { echo 'selected="selected"';};?>>90%</option>
<option value="100" <?php if ($task_details['percent_complete'] == '100') { echo 'selected="selected"';};?>>100%</option>
</select>
</td>
</tr>
</table>
</div>
<div id="taskdetailsfull">
<label for="details"><?php echo $details_text['details'];?></label>
<textarea id="details" name="detailed_desc" cols="70" rows="10"><?php echo htmlspecialchars(stripslashes($task_details['detailed_desc']));?></textarea>
<table class="taskdetails">
<tr>
<td> </td>
</tr>
<tr>
<td class="buttons" colspan="2">
<input class="adminbutton" type="submit" accesskey="s" name="buSubmit" value="<?php echo $details_text['savedetails'];?>" />
<input class="adminbutton" type="reset" name="buReset" value="<?php echo $details_text['reset'];?>" />
</td>
</tr>
</table>
</div>
</div>
</form>
</div>
<?php
} elseif (($task_details['is_closed'] == '1'
OR @$effective_permissions['can_edit'] == '0'
OR !isset($GET['edit']))
&& (($task_details['mark_private'] == '1'
&& $task_details['assigned_to'] == $current_user['user_id'])
OR @$permissions['manage_project'] == '1'
OR $task_details['mark_private'] != '1'))
{
//////////////////////////////////////
// If the user isn't an admin, //
// OR if the task is in VIEW mode, //
// OR if the job is closed //
//////////////////////////////////////
// Display the next/previous navigation links
if (isset($_SESSION['tasklist']))
{
$previous_id = 0;
$next_id = 0;
$id_list = $_SESSION['tasklist'];
$n = count($id_list);
// Search for current task to get the adjacent IDs
for ($i = 0; $i < $n; $i++)
{
if ($id_list[$i] == $task_details['task_id'])
{
if ($i > 0)
$previous_id = $id_list[$i - 1];
if ($i < $n - 1)
$next_id = $id_list[$i + 1];
break;
}
}
if ($previous_id > 0 || $next_id > 0)
{
// Get the summary of the next/previous task for use as tooltips
$summary = array();
$get_summary = $db->Query("SELECT task_id, item_summary
FROM {$dbprefix}tasks
WHERE task_id = ? OR task_id = ?",
array($previous_id, $next_id));
while ($row = $db->FetchRow($get_summary))
{
$summary[$row['task_id']] = htmlentities(stripslashes($row['item_summary']),ENT_COMPAT,'utf-8');
}
echo "<span id=\"navigation\">";
if ($previous_id > 0)
{
echo "<a id=\"prev\" title=\"FS#{$previous_id} — {$summary[$previous_id]}\" href=\"" . $fs->CreateURL('details', $previous_id) . "\">{$details_text['previoustask']}</a>";
if ($next_id > 0)
echo ' | ';
}
if ($next_id > 0)
{
echo "<a id=\"next\" title=\"FS#{$next_id} — {$summary[$next_id]}\" href=\"" . $fs->CreateURL('details', $next_id) . "\">{$details_text['nexttask']}</a>";
}
echo '</span>';
}
}
?>
<div id="taskdetails" ondblclick='openTask("<?php echo $fs->CreateURL('edittask', $task_details['task_id']);?>")'>
<h2 class="severity<?php echo $task_details['task_severity'];?>">
<?php echo 'FS#' . $task_details['task_id'] . ' — ' . $fs->formatText($task_details['item_summary']);?>
</h2>
<div id="fineprint">
<?php
echo $details_text['attachedtoproject'] . '— <a href="' . $conf['general']['baseurl'] . '?project=' . $task_details['attached_to_project'] . '">' . stripslashes($task_details['project_title']) . '</a><br />';
// Get the user details of the person who opened this task
if ($task_details['opened_by'])
{
$get_user_name = $db->Query("SELECT user_name, real_name FROM {$dbprefix}users WHERE user_id = ?", array($task_details['opened_by']));
list($user_name, $real_name) = $db->FetchArray($get_user_name);
} else
{
$user_name = $details_text['anonymous'];
}
$date_opened = $task_details['date_opened'];
$date_opened = $fs->formatDate($date_opened, true);
echo $details_text['openedby'] . ' ' . $fs->LinkedUserName($task_details['opened_by']) . ' - ' . $date_opened;
// If it's been edited, get the details
if ($task_details['last_edited_by'])
{
$get_user_name = $db->Query("SELECT user_name, real_name FROM {$dbprefix}users WHERE user_id = ?", array($task_details['last_edited_by']));
list($user_name, $real_name) = $db->FetchArray($get_user_name);
$date_edited = $task_details['last_edited_time'];
$date_edited = $fs->formatDate($date_edited, true);
echo '<br />' . $details_text['editedby'] . ' ' . $fs->LinkedUserName($task_details['last_edited_by']) . ' - ' . $date_edited;
}
?>
</div>
<div id="taskfields1">
<table>
<tr>
<td><label for="tasktype"><?php echo $details_text['tasktype'];?></label></td>
<td id="tasktype"><?php echo $task_details['tasktype_name'];?></td>
</tr>
<tr>
<td><label for="category"><?php echo $details_text['category'];?></label></td>
<td id="category">
<?php
if ($task_details['parent_id'] > '0')
{
$result = $db->Query("SELECT category_name
FROM {$dbprefix}list_category
WHERE category_id = ?",
array($task_details['parent_id'])
);
$get_parent_cat = $db->FetchArray($result);
echo $get_parent_cat['category_name'] . " → ";
}
echo $task_details['category_name'];?>
</td>
</tr>
<tr>
<td><label for="status"><?php echo $details_text['status'];?></label></td>
<td id="status">
<?php
if($task_details['is_closed'] == '1')
{
echo $details_text['closed'];
} else
{
echo $task_details['status_name'];
}
?>
</td>
</tr>
<tr>
<td><label for="assignedto"><?php echo $details_text['assignedto'];?></label></td>
<td id="assignedto">
<?php
// see if it's been assigned
if (!$task_details['assigned_to'])
{
echo $details_text['noone'];
} else
{
echo stripslashes($task_details['assigned_to_name']);
}
?>
</td>
</tr>
<tr>
<td><label for="os"><?php echo $details_text['operatingsystem'];?></label></td>
<td id="os"><?php echo $task_details['os_name'];?></td>
</tr>
</table>
</div>
<div id="taskfields2">
<table>
<tr>
<td><label for="severity"><?php echo $details_text['severity'];?></label></td>
<td id="severity"><?php echo $task_details['severity_name'];?></td>
</tr>
<tr>
<td><label for="priority"><?php echo $details_text['priority'];?></label></td>
<td id="priority">
<?php echo $task_details['priority_name'];?>
</td>
</tr>
<tr>
<td><label for="reportedver"><?php echo $details_text['reportedversion'];?></label></td>
<td id="reportedver"><?php echo $task_details['reported_version_name'];?></td>
</tr>
<tr>
<td><label for="dueversion"><?php echo $details_text['dueinversion'];?></label></td>
<td id="dueversion">
<?php
if (isset($task_details['due_in_version_name']))
{
echo $task_details['due_in_version_name'];
} else
{
echo $details_text['undecided'];
}
?>
</td>
</tr>
<tr>
<td><label for="duedate"><?php echo $details_text['duedate'];?></label></td>
<td id="duedate">
<?php
if (!empty($task_details['due_date']))
{
echo $fs->formatDate($task_details['due_date'], false);
} else
{
echo $details_text['undecided'];
}
?>
</td>
</tr>
<tr>
<td><label for="percent"><?php echo $details_text['percentcomplete'];?></label></td>
<td id="percent">
<?php echo '<img src="' . $conf['general']['baseurl'] . 'themes/' . $project_prefs['theme_style'] . '/percent-' . $task_details['percent_complete'] . '.png" title="' . $task_details['percent_complete'] . '% ' . $details_text['complete'] . '" alt="' . $task_details['percent_complete'] . '%" />';?></td>
</tr>
</table>
</div>
<div id="taskdetailsfull">
<label for="details"><?php echo $details_text['details'];?></label><span id="details"></span>
<?php
// New function to strip html, convert urls to links etc
echo $fs->formatText($task_details['detailed_desc']);
// Display attachments that came with this task when it opened
$attachments = $db->Query("SELECT * FROM {$dbprefix}attachments
WHERE task_id = ?
AND comment_id = '0'
ORDER BY attachment_id ASC",
array($task_details['task_id'])
);
if (@$permissions['view_attachments'] == '1' OR $project_prefs['others_view'] == '1')
{
while ($attachment = $db->FetchArray($attachments))
{
echo '<span class="attachments">';
echo '<a href="' . $conf['general']['baseurl'] . '?getfile=' . $attachment['attachment_id'] . '" title="' . $attachment['file_type'] . '">';
// Let's strip the mimetype to get the icon image name
list($main, $specific) = split('[/]', $attachment['file_type']);
$imgpath = $basedir . "themes/{$project_prefs['theme_style']}/mime/{$attachment['file_type']}.png";
if (file_exists($imgpath))
{
echo '<img src="' . $conf['general']['baseurl'] . 'themes/' . $project_prefs['theme_style'] . '/mime/' . $attachment['file_type'] . '.png" title="' . $attachment['file_type'] . '" />';
}else
{
echo '<img src="' . $conf['general']['baseurl'] . 'themes/' . $project_prefs['theme_style'] . '/mime/' . $main . '.png" title="' . $attachment['file_type'] . '" />';
}
echo ' ' . $attachment['orig_name'];
echo "</a>\n";
// Delete link
if (@$permissions['delete_attachments'] == '1')
{
?>
- <a href="<?php echo $conf['general']['baseurl'];?>?do=modify&action=deleteattachment&id=<?php echo $attachment['attachment_id'];?>"
onclick="if(confirm('<?php echo $details_text['confirmdeleteattach'];?>')) {
return true
} else {
return false }
">
<?php
echo $details_text['delete'] . '</a>';
}
echo '</span>';
}
echo '<br />';
// End of permission check
}
if ($db->CountRows($attachments)
&& ((!isset($_COOKIE['flyspray_userid']) OR @$permissions['view_attachments'] != '1') && $project_prefs['others_view'] != '1') )
{
echo '<span class="attachments">' . $details_text['attachnoperms'] . '</span><br />';
}
?>
</div>
<?php
// Check for task dependencies that block closing this task
$check_deps = $db->Query("SELECT * FROM {$dbprefix}dependencies d
LEFT JOIN {$dbprefix}tasks t on d.dep_task_id = t.task_id
WHERE d.task_id = ?",
array($_GET['id'])
);
// Check for tasks that this task blocks
$check_blocks = $db->Query("SELECT * FROM {$dbprefix}dependencies d
LEFT JOIN {$dbprefix}tasks t on d.task_id = t.task_id
WHERE d.dep_task_id = ?",
array($_GET['id'])
);
$total = $db->CountRows($check_deps) + $db->CountRows($check_blocks);
echo '<div id="deps">';
// Show tasks that this task depends upon
echo '<div id="taskdeps">';
echo '<b>' . $details_text['taskdependson'] . '</b><br />';
while ($dependency = $db->FetchArray($check_deps))
{
if ($dependency['is_closed'] == '1')
{
echo '<a class="closedtasklink" href="' . $fs->CreateURL('details', $dependency['dep_task_id']) . '">FS#' . $dependency['task_id'] . ' - ' . stripslashes($dependency['item_summary']) . "</a>";
} else
{
echo '<a href="' . $fs->CreateURL('details', $dependency['dep_task_id']) . '">FS#' . $dependency['task_id'] . ' - ' . stripslashes($dependency['item_summary']) . "</a>\n";
}
// If the user has permission, show a link to remove a dependency
if (@$effective_permissions['can_edit'] == '1'
&& $task_details['is_closed'] != '1')
{
echo '<span class="DoNotPrint"> — <a class="removedeplink" href="' . $conf['general']['baseurl'] . '?do=modify&action=removedep&depend_id=' . $dependency['depend_id'] . '">' . $details_text['remove'] . "</a></span>\n";
}
echo '<br />';
}
echo "<br class=\"DoNotPrint\" />\n";
// If there are dependencies, show a link for the dependency graph
if ($total>0) {
echo '<a class="DoNotPrint" href="' . $fs->CreateURL('depends', $id) .
'">' . $details_text['depgraph'] . '</a><br /> <br />';
}
// If the user has permission, show a form to add a new dependency
if (@$effective_permissions['can_edit'] == '1'
&& $task_details['is_closed'] != '1')
{
?>
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="post">
<div>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="newdep" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<input class="admintext" type="text" name="dep_task_id" size="5" maxlength="10" />
<input class="adminbutton" type="submit" name="submit" value="<?php echo $details_text['addnew'];?>" />
</div>
</form>
<?php
}
echo '</div>';
echo '<div id="taskblocks">';
// Show tasks that this task blocks
echo '<b>' . $details_text['taskblocks'] . '</b><br />';
while ($block = $db->FetchArray($check_blocks))
{
if ($block['is_closed'] == '1')
{
// Put a line through the blocking task if it's closed
echo '<a class="closedtasklink" href="' . $fs->CreateURL('details', $block['task_id']) . '">FS#' . $block['task_id'] . ' - ' . stripslashes($block['item_summary']) . "</a><br />\n";
} else
{
echo '<a href="' . $fs->CreateURL('details', $block['task_id']) . '">FS#' . $block['task_id'] . ' - ' . stripslashes($block['item_summary']) . "</a><br />\n";
}
}
echo '</div>';
echo '</div>';
echo "\n\n";
// If the task is closed, show the closure reason
if ($task_details['is_closed'] == '1')
{
$get_closedby_name = $db->Query("SELECT user_name, real_name FROM {$dbprefix}users WHERE user_id = ?", array($task_details['closed_by']));
list($closedby_username, $closedby_realname) = $db->FetchArray($get_closedby_name);
$date_closed = $task_details['date_closed'];
$date_closed = $fs->formatDate($date_closed, true);
echo $details_text['closedby'] . ' ' . $fs->LinkedUserName($task_details['closed_by']) . '<br />';
echo $details_text['date'] . ' ' . $date_closed . '<br />';;
echo $details_text['reasonforclosing'] . ' ';
echo $task_details['resolution_name'];
echo '<br />';
if (!empty($task_details['closure_comment']))
{
echo $details_text['closurecomment'] . ' ';
echo $fs->FormatText($task_details['closure_comment']);
}
// End of showing task closure reason
}
// Check for pending PM requests
$get_pending = $db->Query("SELECT * FROM {$dbprefix}admin_requests
WHERE task_id = ?
AND resolved_by = '0'",
array($task_details['task_id']));
if ($db->CountRows($get_pending))
{
echo '<span id="pendingreq">' . $details_text['taskpendingreq'] . '</span>';
}
echo '<div id="actionbuttons">';
// Check permissions and task status, then show the "re-open task" button
if (@$effective_permissions['can_close'] == '1' && $task_details['is_closed'] == '1')
{
echo '<a href="' . $conf['general']['baseurl'] . '?do=modify&action=reopen&task_id=' . $_GET['id'] . '">' . $details_text['reopenthistask'] . '</a>';
// If they can't re-open this, show a button to request a PM re-open it
} elseif (@$effective_permissions['can_close'] != '1'
&& $task_details['is_closed'] == '1'
&& $fs->AdminRequestCheck(2, $task_details['task_id']) != '1'
&& isset($current_user['user_id']))
{
?>
<a href="#close" id="reqclose" class="button" onclick="showhidestuff('closeform');">
<?php echo $details_text['reopenrequest']; ?>
</a>
<div id="closeform">
<form name="form3" action="<?php echo $conf['general']['baseurl'];?>index.php" method="post" id="formclosetask">
<div>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="requestreopen" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<label for="reason"><?php echo $details_text['givereason'];?></label>
<textarea id="reason" name="reason_given"></textarea><br />
<input class="adminbutton" type="submit" value="<?php echo $details_text['submitreq'];?>" />
</div>
</form>
</div>
<?php
// End of re-opening a task
}
// Get info on the dependencies again
$check_deps = $db->Query("SELECT * FROM {$dbprefix}dependencies d
LEFT JOIN {$dbprefix}tasks t on d.dep_task_id = t.task_id
WHERE d.task_id = ?",
array($_GET['id']));
// Cycle through the dependencies, checking if any are still open
while ($deps_details = $db->FetchArray($check_deps)) {
if ($deps_details['is_closed'] != '1') {
$deps_open = 'yes';
};
};
// Check permissions and task status, then show the "close task" form
if (@$effective_permissions['can_close'] == '1'
&& $task_details['is_closed'] != '1'
&& $deps_open != 'yes')
{
?>
<a href="#close" id="closetask" class="button" onclick="showhidestuff('closeform');">
<?php
echo $details_text['closetask'];
?></a>
<div id="closeform">
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="post" id="formclosetask">
<div>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="close" />
<input type="hidden" name="assigned_to" value="<?php echo $task_details['assigned_to'];?>" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<select class="adminlist" name="resolution_reason">
<option value="0"><?php echo $details_text['selectareason']; ?></option>
<?php
$get_resolution = $db->Query("SELECT resolution_id, resolution_name
FROM {$dbprefix}list_resolution
WHERE (project_id = '0'
OR project_id = ?)
AND show_in_list = '1'
ORDER BY list_position",
array($project_id)
);
while ($row = $db->FetchArray($get_resolution))
{
echo "<option value=\"{$row['resolution_id']}\">{$row['resolution_name']}</option>\n";
}
?>
</select>
<input class="adminbutton" type="submit" name="buSubmit" value="<?php echo $details_text['closetask'];?>" />
<?php echo $details_text['closurecomment'];?>
<textarea class="admintext" name="closure_comment" rows="3" cols="30"></textarea>
<input type="checkbox" name="mark100" value="1" checked="checked" /> <?php echo $details_text['mark100'];?>
</div>
</form>
</div>
<?php
// If the user is assigned this task but can't close it, show a button to request closure
} elseif (@$effective_permissions['can_close'] != '1'
&& !isset($deps_open)
&& isset($current_user)
&& $task_details['assigned_to'] == $current_user['user_id']
&& $fs->AdminRequestCheck(1, $task_details['task_id']) != '1')
{
?>
<a href="#close" id="reqclose" class="button" onclick="showhidestuff('closeform');">
<?php echo $details_text['requestclose']; ?>
</a>
<div id="closeform">
<!-- <a id="hideclosetask" href="#close" onclick="hidestuff('closeform');"></a> -->
<form name="form3" action="<?php echo $conf['general']['baseurl'];?>index.php" method="post" id="formclosetask">
<div>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="requestclose" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<label for="reason"><?php echo $details_text['givereason'];?></label>
<textarea id="reason" name="reason_given"></textarea><br />
<input class="adminbutton" type="submit" value="<?php echo $details_text['submitreq'];?>" />
</div>
</form>
</div>
<?php
}
// Check permissions and task status, then show the "take ownership" button
if (@$effective_permissions['can_take_ownership'] == '1' && $task_details['is_closed'] != '1')
{
echo '<a id="own" class="button" href="' . $conf['general']['baseurl'] . '?do=modify&action=takeownership&ids=' . $_GET['id'] . '">' . $details_text['assigntome'] . '</a> ';
}
// Check permissions, then show the "edit task" button
if (@$effective_permissions['can_edit'] == '1'
&& $task_details['is_closed'] != '1')
{
echo '<a id="edittask" class="button" href="' . $fs->CreateURL('edittask', $_GET['id']) . '">' . $details_text['edittask'] . '</a> ';
}
// Start of marking private/public
if (@$permissions['manage_project'] == '1'
&& $task_details['is_closed'] != '1'
&& $task_details['mark_private'] != '1')
{
echo '<a id="private" class="button" href="' . $conf['general']['baseurl'] . '?do=modify&action=makeprivate&id=' . $_GET['id'] . '">' . $details_text['makeprivate'] . '</a> ';
} elseif (@$permissions['manage_project'] == '1'
&& $task_details['is_closed'] != '1'
&& $task_details['mark_private'] == '1')
{
echo '<a id="public" class="button" href="' . $conf['general']['baseurl'] . '?do=modify&action=makepublic&id=' . $_GET['id'] . '">' . $details_text['makepublic'] . '</a> ';
}
if (!empty($current_user['user_id']) && $task_details['is_closed'] != '1')
{
$result = $db->Query("SELECT * FROM {$dbprefix}notifications
WHERE task_id = ?
AND user_id = ?",
array($_GET['id'], $current_user['user_id'])
);
if (!$db->CountRows($result))
{
echo '<a id="addnotif" class="button" href="' . $conf['general']['baseurl'] . '?do=modify&action=add_notification&ids=' . $_GET['id'] . '&user_id=' . $current_user['user_id'] . '">' . $details_text['watchtask'] . '</a>';
} else
{
echo '<a id="removenotif" class="button" href="' . $conf['general']['baseurl'] . '?do=modify&action=remove_notification&ids=' . $_GET['id'] . '&user_id=' . $current_user['user_id'] . '">' . $details_text['stopwatching'] . '</a>';
}
}
// End of actionbuttons area
echo '</div>';
// End of taskdetails area
echo '</div>';
/////////////////////////////////////////////////
// End of checking if a job should be editable //
/////////////////////////////////////////////////
}
?>
<?php
////////////////////////////
// Start the tabbed areas //
////////////////////////////
$result = $db->Query("SELECT * FROM {$dbprefix}comments WHERE task_id = ?", array($task_details['task_id']));
$num_comments = $db->CountRows($result);
//$result = $db->Query("SELECT * FROM {$dbprefix}attachments WHERE task_id = ?", array($task_details['task_id']));
//$num_attachments = $db->CountRows($result);
$result = $db->Query("SELECT * FROM {$dbprefix}related WHERE this_task = ?", array($task_details['task_id']));
$num_related = $db->CountRows($result);
$result = $db->Query("SELECT * FROM {$dbprefix}related WHERE related_task = ?", array($task_details['task_id']));
$num_related_to = $db->CountRows($result);
$result = $db->Query("SELECT * FROM {$dbprefix}notifications WHERE task_id = ?", array($_GET['id']));
$num_notifications = $db->CountRows($result);
$result = $db->Query("SELECT * FROM {$dbprefix}reminders WHERE task_id = ?", array($_GET['id']));
$num_reminders = $db->CountRows($result);
?>
<ul id="submenu">
<?php
if (@$permissions['view_comments'] == '1' OR @$permissions['add_comments'] == '1' OR $project_prefs['others_view'] == '1')
{
echo '<li id="commentstab"><a href="#comments">'. $details_text['comments'] . " ($num_comments)" . '</a></li>';
}
if (@$permissions['view_attachments'] == '1' OR $project_prefs['others_view'] == '1')
{
//echo '<li id="attachtab"><a href="#attach">' . $details_text['attachments'] . " ($num_attachments)" . '</a></li>';
}
echo '<li id="relatedtab"><a href="#related">' . $details_text['relatedtasks'] . " ($num_related/$num_related_to)" . '</a></li>';
if (@$permissions['manage_project'] == '1')
{
echo '<li id="notifytab"><a href="#notify">' . $details_text['notifications'] . " ($num_notifications) " . '</a></li>';
echo '<li id="remindtab"><a href="#remind">' . $details_text['reminders'] . " ($num_reminders)" . '</a></li>';
}
if (@$permissions['view_history'] == '1')
{
echo '<li id="historytab"><a href="#history">' . $details_text['history'] . '</a></li>';
}
?>
</ul>
<?php
////////////////////////////
// Start of comments area //
////////////////////////////
?>
<div id="comments" class="tab">
<?php
// if there are comments, show them
$getcomments = $db->Query("SELECT * FROM {$dbprefix}comments
WHERE task_id = ?
ORDER BY date_added ASC",
array($task_details['task_id'])
);
while ($row = $db->FetchArray($getcomments))
{
$user_info = $fs->getUserDetails($row['user_id']);
$formatted_date = $fs->formatDate($row['date_added'], true);
$comment_text = $fs->formatText($row['comment_text']);
// If the user has permissions, show the comments already added
if (@$permissions['view_comments'] == '1' OR $project_prefs['others_view'] == '1')
{
// echo $row['comment_id'];
echo '<em><a name="comment' . $row['comment_id'] . '" id="comment' . $row['comment_id'] . '" href="' . $fs->CreateURL('details', $task_details['task_id']) . '#comment' . $row['comment_id'] . '">';
echo '<img src="' . $conf['general']['baseurl'] . 'themes/' . $project_prefs['theme_style'] . '/menu/comment.png" title="' . $details_text['commentlink'] . '" alt="" /></a>';
echo $details_text['commentby']. ' ' . $fs->LinkedUserName($row['user_id']) . ' - ' . $formatted_date . "</em>\n";
// If the user has permission, show the edit button
if (@$permissions['edit_comments'] == '1')
{
echo '<span class="DoNotPrint"> - <a href="' . $conf['general']['baseurl'] . '?do=editcomment&task_id=' . $_GET['id'] . '&id=' . $row['comment_id'] . '">' . $details_text['edit'] . '</a>';
}
// If the user has permission, show the delete button
if (@$permissions['delete_comments'] == '1')
{
?>
- <a href="<?php echo $conf['general']['baseurl'];?>?do=modify&action=deletecomment&task_id=<?php echo $_GET['id'];?>&comment_id=<?php echo $row['comment_id'];?>"
onclick="if(confirm('<?php echo $details_text['confirmdeletecomment'];?>')) {
return true
} else {
return false }
">
<?php
echo $details_text['delete'] . '</a></span>';
}
echo '<p class="comment">';
echo $comment_text;
echo '</p>';
$attachments = $db->Query("SELECT * FROM {$dbprefix}attachments
WHERE comment_id = ?
ORDER BY attachment_id ASC",
array($row['comment_id'])
);
if (@$permissions['view_attachments'] == '1' OR $project_prefs['others_view'] == '1')
{
while ($attachment = $db->FetchArray($attachments))
{
echo '<span class="attachments">';
echo '<a href="' . $conf['general']['baseurl'] . '?getfile=' . $attachment['attachment_id'] . '" title="' . $attachment['file_type'] . '">';
// Let's strip the mimetype to get the icon image name
list($main, $specific) = split('[/]', $attachment['file_type']);
$imgpath = $basedir . "{$conf['general']['baseurl']}themes/{$project_prefs['theme_style']}/mime/{$attachment['file_type']}.png";
if (file_exists($imgpath))
{
echo '<img src="' . $conf['general']['baseurl'] . 'themes/' . $project_prefs['theme_style'] . '/mime/' . $attachment['file_type'] . '.png" title="' . $attachment['file_type'] . '" />';
}else
{
echo '<img src="' . $conf['general']['baseurl'] . 'themes/' . $project_prefs['theme_style'] . '/mime/' . $main . '.png" title="' . $attachment['file_type'] . '" />';
}
echo ' ' . $attachment['orig_name'];
echo "</a>\n";
// Delete link
if (@$permissions['delete_attachments'] == '1')
{
?>
- <a href="<?php echo $conf['general']['baseurl'];?>?do=modify&action=deleteattachment&id=<?php echo $attachment['attachment_id'];?>"
onclick="if(confirm('<?php echo $details_text['confirmdeleteattach'];?>')) {
return true
} else {
return false }
">
<?php
echo $details_text['delete'] . '</a>';
}
echo '</span>';
}
echo '<br />';
// End of permission check
}
if ($db->CountRows($attachments)
&& ((!isset($_COOKIE['flyspray_userid']) OR @$permissions['view_attachments'] != '1') && $project_prefs['others_view'] != '1') )
{
echo '<span class="attachments">' . $details_text['attachnoperms'] . '</span><br />';
}
}
// End of cycling through the comments for display
}
// Now, show a form to add a comment (but only if the user has the rights!)
if (@$permissions['add_comments'] == "1" && $task_details['is_closed'] != '1')
{
?>
<form enctype="multipart/form-data" action="<?php echo $conf['general']['baseurl'];?>index.php" method="post">
<div class="admin">
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="addcomment" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<?php echo $details_text['addcomment'];?>
<textarea id="comment_text" name="comment_text" cols="72" rows="10"></textarea>
<?php if (@$permissions['create_attachments'] == '1') { ?>
<div id="uploadfilebox">
<?php echo $details_text['uploadafile'];?>
<input type="file" size="55" name="userfile[]" /><br />
</div>
<input class="adminbutton" type="button" onclick="addUploadFields()" value="<?php echo $details_text['selectmorefiles'];?>" />
<?php } ?>
<input class="adminbutton" type="submit" value="<?php echo $details_text['addcomment'];?>" />
<?php
$check_watch = $db->Query("SELECT user_id
FROM {$dbprefix}notifications
WHERE user_id = ?
AND task_id = ?",
array($current_user['user_id'], $task_details['task_id'])
);
if ( !$db->CountRows($check_watch) )
echo "<input name=\"notifyme\" type=\"checkbox\" value=\"1\" checked=\"checked\" />{$newtask_text['notifyme']}";
?>
</div>
</form>
<?php
// End of checking if the comments form should be displayed
};
echo '</div>';
// End of comments area
////////////////////////////////////
// Start of file attachments area //
////////////////////////////////////
if (@$permissions['view_attachments'] == '1' OR $project_prefs['others_view'] == '1')
{/*
echo '<div id="attach" class="tab">';
// if there are attachments, show them
$getattachments = $db->Query("SELECT * FROM {$dbprefix}attachments WHERE task_id = ?", array($task_details['task_id']));
while ($row = $db->FetchArray($getattachments))
{
$getusername = $db->Query("SELECT real_name FROM {$dbprefix}users WHERE user_id = ?", array($row['added_by']));
list($user_name) = $db->FetchArray($getusername);
$formatted_date = $fs->formatDate($row['date_added'], true);
$file_desc = stripslashes($row['file_desc']);
// "Deleting attachments" code contributed by Harm Verbeek <info@certeza.nl>
if (@$permissions['delete_attachments'] == '1')
{
?>
<div class="modifycomment">
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="post" onSubmit="if(confirm('Really delete this attachment?')) {return true} else {return false }">
<p>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="deleteattachment" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<input type="hidden" name="attachment_id" value="<?php echo $row['attachment_id'];?>" />
<input class="adminbutton" type="submit" value="<?php echo $details_text['delete'];?>" />
</p>
</form>
</div>
<?php
}
// Divide the attachments area into two columns for display
echo "<table><tr><td><p>";
// Detect if the attachment is an image
$pos = strpos($row['file_type'], "image/");
if($pos===0 && $project_prefs['inline_images'] == '1')
{
// Find out the size of the image
list($width, $height, $type, $string) = getimagesize("attachments/{$row['file_name']}");
// If the image is too wide, let's scale it down so that it doesn't destroy the page layout
if ($width > "200")
{
$v_fraction = 200/$width;
$new_height = round(($height*$v_fraction),0);
// Display the resized image, with a link to the fullsized one
echo '<a href="' . $conf['general']['baseurl'] . "?getfile={$row['attachment_id']}\"><img src=\"?getfile={$row['attachment_id']}\" width=\"$new_height\" alt=\"\" /></a>";
} else
{
// If the image is already small, just display it.
echo "<br /><img src=\"?getfile={$row['attachment_id']}\" />";
}
// If the attachment isn't an image, or the inline images is OFF,
// show a mimetype icon instead of a thumbnail
} else
{
// Let's strip the mimetype to get the image name
list($main, $specific) = split('[/]', $row['file_type']);
echo $fs->ShowImg("themes/{$project_prefs['theme_style']}/mime/{$row['file_type']}.png", $row['file_type']);
}
// The second column, for the descriptions
echo "</p></td><td>";
echo "<table>";
echo "<tr><td><em>{$details_text['filename']}</em></td><td><a href=\"?getfile={$row['attachment_id']}\">{$row['orig_name']}</a></td></tr>";
echo "<tr><td><em>{$details_text['description']}</em></td><td>$file_desc</td></tr>";
echo "<tr><td><em>{$details_text['fileuploadedby']}</em></td><td>" . $fs->LinkedUserName($row['added_by']) . '</td></tr>';
echo "<tr><td><em>{$details_text['date']}</em></td><td>$formatted_date</td></tr>";
$size = $row['file_size'];
$sizes = Array(' B', ' KB', ' MB');
$size_ext = $sizes[0];
for ($i = 1; (($i < count($sizes)) && ($size >= 1024)); $i++)
{
$size = $size / 1024;
$size_ext = $sizes[$i];
}
echo "<tr><td><em>{$details_text['filesize']}</em></td><td>" . round($size, 2) . $size_ext . "</td></tr>";
echo "</table>";
echo "</td></tr></table>";
// End of cycling through the attachments for display
};
// Now, show a form to attach a file (but only if the user has the rights!)
if (@$permissions['create_attachments'] == "1" && $task_details['is_closed'] != '1')
{ ?>
<form enctype="multipart/form-data" action="<?php echo $conf['general']['baseurl'];?>index.php" method="post" id="formupload">
<table class="admin">
<tr>
<td>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="addattachment" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<label><?php echo $details_text['uploadafile'];?></label>
</td>
<td>
<input type="file" size="55" name="userfile" />
</td>
</tr>
<tr>
<td>
<label><?php echo $details_text['description'];?></label>
</td>
<td>
<input class="admintext" type="text" name="file_desc" size="70" maxlength="100" />
</td>
</tr>
<tr>
<td colspan="2" class="buttons"><input class="adminbutton" type="submit" value="<?php echo $details_text['uploadnow'];?>" /></td>
</tr>
</table>
</form>
<?php
// End of checking permissions to upload a new attachment
}
// End of attachments area
echo '</div>';
*/}
/////////////////////////////////
// Start of related tasks area //
/////////////////////////////////
?>
<div id="related" class="tab">
<p><em><?php echo $details_text['thesearerelated'];?></em></p>
<?php
$get_related = $db->Query("SELECT *
FROM {$dbprefix}related r
LEFT JOIN {$dbprefix}tasks t ON r.related_task = t.task_id
WHERE r.this_task = ?",
array($_GET['id'])
);
while ($row = $db->FetchArray($get_related))
{
$summary = stripslashes($row['item_summary']);
?>
<?php
// If the user can modify jobs, then show them a form to remove related tasks
if (@$effective_permissions['can_edit'] == '1' && $task_details['is_closed'] != '1')
{
?>
<div class="modifycomment">
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="post">
<p>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="remove_related" />
<input type="hidden" name="id" value="<?php echo $_GET['id'];?>" />
<input type="hidden" name="related_id" value="<?php echo $row['related_id'];?>" />
<input type="hidden" name="related_task" value="<?php echo $row['related_task'];?>" />
<input class="adminbutton" type="submit" value="<?php echo $details_text['remove'];?>" />
</p>
</form>
</div>
<?php
// End of checking for permission to remove a related task
}
echo '<p><a href="' . $fs->CreateURL('details', $row['related_task']) . '">FS#' . $row['related_task'] . ' — ' . stripslashes($row['item_summary']) . '</a></p>';
//echo '<br />' . $row['item_summary'];
// End of cycling through related tasks
}
if (@$effective_permissions['can_edit'] == "1" && $task_details['is_closed'] != '1')
{
?>
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="post" id="formaddrelatedtask">
<p class="admin">
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="add_related" />
<input type="hidden" name="this_task" value="<?php echo $_GET['id'];?>" />
<label><?php echo $details_text['addnewrelated'];?>
<input name="related_task" size="10" maxlength="10" /></label>
<input class="adminbutton" type="submit" value="<?php echo $details_text['add'];?>" />
</p>
</form>
<?php
}
?>
<p><em><?php echo $details_text['otherrelated'];?></em></p>
<?php
$get_related = $db->Query("SELECT *
FROM {$dbprefix}related r
LEFT JOIN {$dbprefix}tasks t ON r.this_task = t.task_id
WHERE r.related_task = ?",
array($_GET['id'])
);
while ($row = $db->FetchArray($get_related))
{
echo '<p>';
echo '<a href="' . $fs->CreateURL('details', $row['this_task']) . '">FS#' . $row['this_task'] . ' — ' . htmlspecialchars(stripslashes($row['item_summary'])) . '</a><br />';
echo '</p>';
}
// End of related area
echo '</div>';
/////////////////////////////////
// Start of notifications area //
/////////////////////////////////
if (@$permissions['manage_project'] == '1')
{
?>
<div id="notify" class="tab">
<p><em><?php echo $details_text['theseusersnotify'];?></em></p>
<?php
$get_user_ids = $db->Query("SELECT * FROM {$dbprefix}notifications n
LEFT JOIN {$dbprefix}users u ON n.user_id = u.user_id
WHERE n.task_id = ?",
array($_GET['id'])
);
while ($row = $db->FetchArray($get_user_ids))
{
echo '<p>' . $fs->LinkedUserName($row['user_id']) . ' — <a href="' . $conf['general']['baseurl'] . '?do=modify&action=remove_notification&ids=' . $_GET['id'] . '&user_id=' . $row['user_id'] . '">' . $details_text['remove'] . '</a></p>';
}
if (@$permissions['manage_project'] == '1')
{
?>
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="get">
<p class="admin">
<?php echo $details_text['addusertolist'];?>
<select class="adminlist" name="user_id">
<?php
// Get list of users
$fs->listUsers($novar, $project_id);
?>
</select>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="add_notification" />
<input type="hidden" name="ids" value="<?php echo $_GET['id'];?>" />
<input type="hidden" name="prev_page" value="<?php echo $this_page;?>" />
<input class="adminbutton" type="submit" value="<?php echo $details_text['addtolist'];?>" />
</p>
</form>
<?php
}
echo "</div>";
// End of checking PM permissions
}
// End of notifications area
///////////////////////////////////////
// Start of scheduled reminders area //
///////////////////////////////////////
?>
<div id="remind" class="tab">
<?php
$get_reminders = $db->Query("SELECT *
FROM {$dbprefix}reminders r
LEFT JOIN {$dbprefix}users u ON r.to_user_id = u.user_id
WHERE task_id = ?
ORDER BY reminder_id",
array($_GET['id'])
);
while ($row = $db->FetchArray($get_reminders))
{
// If the user has permission, then show them a form to remove a reminder
if ((@$permissions['is_admin'] == '1' OR @$permissions['manage_project'] == '1') && $task_details['is_closed'] != '1')
{
?>
<div class="modifycomment">
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="post">
<p>
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="deletereminder" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<input type="hidden" name="reminder_id" value="<?php echo $row['reminder_id'];?>" />
<input class="adminbutton" type="submit" value="<?php echo $details_text['remove'];?>" />
</p>
</form>
</div>
<?php
// End of checking permissions to remove a reminder
}
echo "<em>{$details_text['remindthisuser']}:</em> <a href=\"?do=admin&area=users&id={$row['to_user_id']}\">{$row['real_name']} ( {$row['user_name']})</a><br />";
// Work out the unit of time to display
if ($row['how_often'] < 86400)
{
$how_often = $row['how_often'] / 3600 . " " . $details_text['hours'];
} elseif ($row['how_often'] < 604800)
{
$how_often = $row['how_often'] / 86400 . " " . $details_text['days'];
} else
{
$how_often = $row['how_often'] / 604800 . " " . $details_text['weeks'];
}
echo "<em>{$details_text['thisoften']}:</em> $how_often";
echo "<br />";
echo '<em>' . $details_text['message'] . ':</em>' . nl2br($row['reminder_message']);
echo "<br /><br />";
// End of cycling through reminders
}
// Show a form to add a new reminder
if (@$permissions['is_admin'] == '1' && $task_details['is_closed'] != '1')
{
?>
<form action="<?php echo $conf['general']['baseurl'];?>index.php" method="post" id="formaddreminder">
<p class="admin">
<input type="hidden" name="do" value="modify" />
<input type="hidden" name="action" value="addreminder" />
<input type="hidden" name="task_id" value="<?php echo $_GET['id'];?>" />
<em><?php echo $details_text['remindthisuser'];?></em>
<select class="adminlist" name="to_user_id">
<?php
// Get list of users
$fs->listUsers($novar, $project_id);
?>
</select>
<br />
<em><?php echo $details_text['thisoften'];?></em>
<input type="text" name="timeamount1" size="3" maxlength="3" />
<select class="adminlist" name="timetype1">
<option value="3600"><?php echo $details_text['hours'];?></option>
<option value="86400"><?php echo $details_text['days'];?></option>
<option value="604800"><?php echo $details_text['weeks'];?></option>
</select>
<br />
<em><?php echo $details_text['startafter'];?></em>
<input type="text" name="timeamount2" size="3" maxlength="3" />
<select class="adminlist" name="timetype2">
<option value="3600"><?php echo $details_text['hours'];?></option>
<option value="86400"><?php echo $details_text['days'];?></option>
<option value="604800"><?php echo $details_text['weeks'];?></option>
</select>
<br />
<textarea class="admintext" name="reminder_message" rows="10" cols="72"><?php echo $details_text['defaultreminder'] . "\n\n" . $fs->CreateURL('details', $_GET['id']);?></textarea>
<br />
<input class="adminbutton" type="submit" value="<?php echo $details_text['addreminder'];?>" />
</p>
</form>
<?php
// End of checking permissions to add a new reminder
}
// End of scheduled reminders area
echo '</div>';
//////////////////////////
// Start of History Tab //
//////////////////////////
if (@$permissions['view_history'] == '1')
{
?>
<div id="history" class="tab">
<table class="history">
<tr>
<th><?php echo $details_text['eventdate'];?></th>
<th><?php echo $details_text['user'];?></th>
<th><?php echo $details_text['event'];?></th>
</tr>
<?php
if (isset($_GET['details']) && is_numeric($_GET['details']))
{
$details = " AND h.history_id = {$_GET['details']}";
echo '<b>' . $details_text['selectedhistory'] . '</b>';
echo ' — <a href="?do=details&id=' . $_GET['id'] . '#history">' . $details_text['showallhistory'] . '</a>';
} else
{
$details = '';
}
$query_history = $db->Query("SELECT h.*, u.user_name, u.real_name
FROM {$dbprefix}history h
LEFT JOIN {$dbprefix}users u ON h.user_id = u.user_id
WHERE h.task_id = ? {$details}
ORDER BY h.event_date ASC, h.event_type ASC",
array($_GET['id'])
);
if ($db->CountRows($query_history) == 0)
{ ?>
<tr>
<td colspan="3"><?php echo $details_text['nohistory'];?></td>
</tr>
<?php
}
while ($history = $db->FetchRow($query_history))
{
?>
<tr>
<td><?php echo $fs->formatDate($history['event_date'], true);?></td>
<td>
<?php
if ($history['user_id'] == 0)
{
echo $details_text['anonymous'];
} else
{
echo $fs->LinkedUserName($history['user_id']);
}
?>
</td>
<td><?php
$newvalue = $history['new_value'];
$oldvalue = $history['old_value'];
//Create an event description
if ($history['event_type'] == 0) { //Field changed
$field = $history['field_changed'];
switch ($field) {
case 'item_summary':
$field = $details_text['summary'];
$oldvalue = htmlspecialchars($oldvalue,ENT_COMPAT,'utf-8');
$newvalue = htmlspecialchars($newvalue,ENT_COMPAT,'utf-8');
if (!get_magic_quotes_gpc()) {
$oldvalue = str_replace("\\", "\", $oldvalue);
$newvalue = str_replace("\\", "\", $newvalue);
};
$oldvalue = stripslashes($oldvalue);
$newvalue = stripslashes($newvalue);
break;
case 'attached_to_project':
$field = $details_text['attachedtoproject'];
$result = $db->Query("SELECT project_title FROM {$dbprefix}projects WHERE project_id = ?", array($oldvalue));
list($oldprojecttitle) = $db->FetchRow($result);
$result = $db->Query("SELECT project_title FROM {$dbprefix}projects WHERE project_id = ?", array($newvalue));
list($newprojecttitle) = $db->FetchRow($result);
$oldvalue = "<a href=\"?project={$oldvalue}\">{$oldprojecttitle}</a>";
$newvalue = "<a href=\"?project={$newvalue}\">{$newprojecttitle}</a>";
break;
case 'task_type':
$field = $details_text['tasktype'];
$result = $db->Query("SELECT tasktype_name FROM {$dbprefix}list_tasktype WHERE tasktype_id = ?", array($oldvalue));
list($oldvalue) = $db->FetchRow($result);
$result = $db->Query("SELECT tasktype_name FROM {$dbprefix}list_tasktype WHERE tasktype_id = ?", array($newvalue));
list($newvalue) = $db->FetchRow($result);
break;
case 'product_category':
$field = $details_text['category'];
$result = $db->Query("SELECT category_name FROM {$dbprefix}list_category WHERE category_id = ?", array($oldvalue));
list($oldvalue) = $db->FetchRow($result);
$result = $db->Query("SELECT category_name FROM {$dbprefix}list_category WHERE category_id = ?", array($newvalue));
list($newvalue) = $db->FetchRow($result);
break;
case 'item_status':
$field = $details_text['status'];
$oldvalue = $status_list[$oldvalue];
$newvalue = $status_list[$newvalue];
break;
case 'task_priority':
$field = $details_text['priority'];
$oldvalue = $priority_list[$oldvalue];
$newvalue = $priority_list[$newvalue];
break;
case 'operating_system':
$field = $details_text['operatingsystem'];
$result = $db->Query("SELECT os_name FROM {$dbprefix}list_os WHERE os_id = ?", array($oldvalue));
list($oldvalue) = $db->FetchRow($result);
$result = $db->Query("SELECT os_name FROM {$dbprefix}list_os WHERE os_id = ?", array($newvalue));
list($newvalue) = $db->FetchRow($result);
break;
case 'task_severity':
$field = $details_text['severity'];
$oldvalue = $severity_list[$oldvalue];
$newvalue = $severity_list[$newvalue];
break;
case 'product_version':
$field = $details_text['reportedversion'];
$result = $db->Query("SELECT version_name FROM {$dbprefix}list_version WHERE version_id = ?", array($oldvalue));
list($oldvalue) = $db->FetchRow($result);
$result = $db->Query("SELECT version_name FROM {$dbprefix}list_version WHERE version_id = ?", array($newvalue));
list($newvalue) = $db->FetchRow($result);
break;
case 'closedby_version':
$field = $details_text['dueinversion'];
if ($oldvalue == '0') {
$oldvalue = $details_text['undecided'];
} else {
$result = $db->Query("SELECT version_name
FROM {$dbprefix}list_version
WHERE version_id = ?", array($db->emptyToZero($oldvalue)));
list($oldvalue) = $db->FetchRow($result);
};
if ($newvalue == '0') {
$newvalue = $details_text['undecided'];
} else {
$result = $db->Query("SELECT version_name
FROM {$dbprefix}list_version
WHERE version_id = ?", array($db->emptyToZero($newvalue)));
list($newvalue) = $db->FetchRow($result);
};
break;
case 'due_date':
$field = $details_text['duedate'];
if (empty($oldvalue))
{
$oldvalue = $details_text['undecided'];
} else
{
$oldvalue = $fs->FormatDate($oldvalue, false);
}
if (empty($newvalue))
{
$newvalue = $details_text['undecided'];
} else
{
$newvalue = $fs->FormatDate($newvalue, false);
}
break;
case 'percent_complete':
$field = $details_text['percentcomplete'];
$oldvalue .= '%';
$newvalue .= '%';
break;
case 'detailed_desc':
$field = "<a href=\"index.php?do=details&id={$history['task_id']}&details={$history['history_id']}#history\">{$details_text['details']}</a>";
if (!empty($details))
{
$details_previous = htmlspecialchars($oldvalue,ENT_COMPAT,'utf-8');
$details_new = htmlspecialchars($newvalue,ENT_COMPAT,'utf-8');
if (!get_magic_quotes_gpc())
{
$details_previous = str_replace("\\", "\", $details_previous);
$details_new = str_replace("\\", "\", $details_new);
}
$details_previous = nl2br(stripslashes($details_previous));
$details_new = nl2br(stripslashes($details_new));
}
$oldvalue = '';
$newvalue = '';
break;
};
echo "{$details_text['fieldchanged']}: {$field}";
if ($oldvalue != '' || $newvalue != '') {
echo " ({$oldvalue} → {$newvalue})";
};
} elseif ($history['event_type'] == '1') { //Task opened
echo $details_text['taskopened'];
} elseif ($history['event_type'] == '2') { //Task closed
echo $details_text['taskclosed'];
$result = $db->Query("SELECT resolution_name FROM {$dbprefix}list_resolution WHERE resolution_id = ?", array($newvalue));
$res_name = $db->FetchRow($result);
echo " ({$res_name['resolution_name']}";
if (!empty($oldvalue))
{
echo ': ' . $fs->formatText($oldvalue);
}
echo ')';
} elseif ($history['event_type'] == '3') { //Task edited
echo $details_text['taskedited'];
} elseif ($history['event_type'] == '4') { //Comment added
echo '<a href="#comments">' . $details_text['commentadded'] . '</a>';
} elseif ($history['event_type'] == '5') { //Comment edited
echo "<a href=\"?do=details&id={$history['task_id']}&details={$history['history_id']}#history\">{$details_text['commentedited']}</a>";
$comment = $db->Query("SELECT user_id, date_added FROM {$dbprefix}comments WHERE comment_id = ?", array($history['field_changed']));
if ($db->CountRows($comment) != 0) {
$comment = $db->FetchRow($comment);
echo " ({$details_text['commentby']} " . $fs->LinkedUsername($comment['user_id']) . " - " . $fs->formatDate($comment['date_added'], true) . ")";
};
if ($details != '') {
$details_previous = htmlspecialchars($oldvalue,ENT_COMPAT,'utf-8');
$details_new = htmlspecialchars($newvalue,ENT_COMPAT,'utf-8');
if (!get_magic_quotes_gpc()) {
$details_previous = str_replace("\\", "\", $details_previous);
$details_new = str_replace("\\", "\", $details_new);
};
$details_previous = nl2br(stripslashes($details_previous));
$details_new = nl2br(stripslashes($details_new));
};
} elseif ($history['event_type'] == '6') //Comment deleted
{
echo "<a href=\"?do=details&id={$history['task_id']}&details={$history['history_id']}#history\">{$details_text['commentdeleted']}</a>";
if ($newvalue != '' && $history['field_changed'] != '')
{
echo " ({$details_text['commentby']} " . $fs->LinkedUsername($newvalue) . " - " . $fs->formatDate($history['field_changed'], true) . ")";
}
if (!empty($details))
{
$details_previous = htmlspecialchars($oldvalue,ENT_COMPAT,'utf-8');
if (!get_magic_quotes_gpc())
{
$details_previous = str_replace("\\", "\", $details_previous);
}
$details_previous = nl2br(stripslashes($details_previous));
$details_new = '';
}
} elseif ($history['event_type'] == '7') //Attachment added
{
echo $details_text['attachmentadded'];
$attachment = $db->Query("SELECT orig_name, file_desc FROM {$dbprefix}attachments WHERE attachment_id = ?", array($newvalue));
if ($db->CountRows($attachment) != 0)
{
$attachment = $db->FetchRow($attachment);
echo ": <a href=\"{$baseurl}?getfile={$newvalue}\">{$attachment['orig_name']}</a>";
if ($attachment['file_desc'] != '')
{
echo " ({$attachment['file_desc']})";
}
}
} elseif ($history['event_type'] == '8') //Attachment deleted
{
echo "{$details_text['attachmentdeleted']}: {$newvalue}";
} elseif ($history['event_type'] == '9') //Notification added
{
echo "{$details_text['notificationadded']}: " . $fs->LinkedUsername($newvalue);
} elseif ($history['event_type'] == '10') //Notification deleted
{
echo "{$details_text['notificationdeleted']}: " . $fs->LinkedUsername($newvalue);
} elseif ($history['event_type'] == '11') //Related task added
{
$result = $db->Query("SELECT item_summary FROM {$dbprefix}tasks WHERE task_id = ?", array($newvalue));
list($related) = $db->FetchRow($result);
$related = stripslashes($related);
echo "{$details_text['relatedadded']}: <a href=\"" . $fs->CreateURL('details', $newvalue) . "\">FS#{$newvalue} — {$related}</a>";
} elseif ($history['event_type'] == '12') //Related task deleted
{
$result = $db->Query("SELECT item_summary FROM {$dbprefix}tasks WHERE task_id = ?", array($newvalue));
list($related) = $db->FetchRow($result);
$related = stripslashes($related);
echo "{$details_text['relateddeleted']}: <a href=\"" . $fs->CreateURL('details', $newvalue) . "\">FS#{$newvalue} — {$related}</a>";
} elseif ($history['event_type'] == '13') //Task reopened
{
echo $details_text['taskreopened'];
} elseif ($history['event_type'] == '14') //Task assigned
{
if ($oldvalue == '0')
{
echo "{$details_text['taskassigned']} " . $fs->LinkedUsername($newvalue);
} elseif ($newvalue == '0')
{
echo $details_text['assignmentremoved'];
} else
{
echo "{$details_text['taskreassigned']} " . $fs->LinkedUsername($newvalue);
}
} elseif ($history['event_type'] == '15') //Task added to related list of another task
{
$result = $db->Query("SELECT item_summary FROM {$dbprefix}tasks WHERE task_id = ?", array($newvalue));
list($related) = $db->FetchRow($result);
$related = stripslashes($related);
echo "{$details_text['addedasrelated']} <a href=\"" . $fs->CreateURL('details', $newvalue) . "\">FS#{$newvalue} — {$related}</a>";
} elseif ($history['event_type'] == '16') //Task deleted from related list of another task
{
$result = $db->Query("SELECT item_summary FROM {$dbprefix}tasks WHERE task_id = ?", array($newvalue));
list($related) = $db->FetchRow($result);
$related = stripslashes($related);
echo "{$details_text['deletedasrelated']} <a href=\"" . $fs->CreateURL('details', $newvalue) . "\">FS#{$newvalue} — {$related}</a>";
} elseif ($history['event_type'] == '17') //Reminder added
{
echo "{$details_text['reminderadded']}: " . $fs->LinkedUsername($newvalue);
} elseif ($history['event_type'] == '18') //Reminder deleted
{
echo "{$details_text['reminderdeleted']}: " . $fs->LinkedUsername($newvalue);
} elseif ($history['event_type'] == '19') //User took ownership
{
echo "{$details_text['ownershiptaken']}: " . $fs->LinkedUsername($newvalue);
} elseif ($history['event_type'] == '20') //User requested task closure
{
echo $details_text['closerequestmade'] . ' - ' . stripslashes($newvalue);
} elseif ($history['event_type'] == '21') //User requested task
{
echo $details_text['reopenrequestmade'] . ' - ' . stripslashes($newvalue);
} elseif ($history['event_type'] == '22') // Dependency added
{
$result = $db->Query("SELECT item_summary FROM {$dbprefix}tasks WHERE task_id = ?", array($newvalue));
list($dependency) = $db->FetchRow($result);
$dependency = stripslashes($dependency);
echo "{$details_text['depadded']} <a href=\"" . $fs->CreateURL('details', $newvalue) . "\">FS#{$newvalue} — {$dependency}</a>";
} elseif ($history['event_type'] == '23') // Dependency added to other task
{
$result = $db->Query("SELECT item_summary FROM {$dbprefix}tasks WHERE task_id = ?", array($newvalue));
list($dependency) = $db->FetchRow($result);
$dependency = stripslashes($dependency);
echo "{$details_text['depaddedother']} <a href=\"" . $fs->CreateURL('details', $newvalue) . "\">FS#{$newvalue} — {$dependency}</a>";
} elseif ($history['event_type'] == '24') // Dependency removed
{
$result = $db->Query("SELECT item_summary FROM {$dbprefix}tasks WHERE task_id = ?", array($newvalue));
list($dependency) = $db->FetchRow($result);
$dependency = stripslashes($dependency);
echo "{$details_text['depremoved']} <a href=\"" . $fs->CreateURL('details', $newvalue) . "\">FS#{$newvalue} — {$dependency}</a>";
} elseif ($history['event_type'] == '25') // Dependency removed from other task
{
$result = $db->Query("SELECT item_summary FROM {$dbprefix}tasks WHERE task_id = ?", array($newvalue));
list($dependency) = $db->FetchRow($result);
$dependency = stripslashes($dependency);
echo "{$details_text['depremovedother']} <a href=\"" . $fs->CreateURL('details', $newvalue) . "\">FS#{$newvalue} — {$dependency}</a>";
} elseif ($history['event_type'] == '26') // Task marked private
{
echo $details_text['taskmadeprivate'];
} elseif ($history['event_type'] == '27') // Task privacy removed - task made public
{
echo $details_text['taskmadepublic'];
} elseif ($history['event_type'] == '28') // PM request denied
{
echo $details_text['pmreqdenied'] . ' - ' . stripslashes($newvalue);
}
?>
</td>
</tr>
<?php
// End of cycling through history entries for this task
}
echo '</table>';
if (isset($_GET['details']) && !empty($_GET['details']))
{
?>
<table class="history">
<tr>
<th><?php echo $details_text['previousvalue'];?></th>
<th><?php echo $details_text['newvalue'];?></th>
</tr>
<tr>
<td><?php echo $details_previous;?></td>
<td><?php echo $details_new;?></td>
</tr>
</table>
<?php
}
?>
<?php
// End of History Tab
echo '</div>';
// End of checking for permission to view the history
}
?>
<?php
} else {
// If no task was actually requested, redirect to the error page
$fs->Redirect( $fs->CreateURL('error', null) );
//echo "<p><strong>{$details_text['showdetailserror']}</strong></p>";
};
?>
|