/var/www/onesolution.com.hk/support/projectlist.php


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
<?php require("checkuser.php"); ?>
<?
if ($logged_in == 1) {
} else {
    
header('Location: logon.php');
}
?>
<?php 
require("configure.php"); ?>
<?
$sql1 
" and a.status in (99";
$status1 $_POST['status1'];
if (
$status1 <> false)
{
    
$sql1 .= ",0";
}
$status2 $_POST['status2'];
if (
$status2 <> false)
{
    
$sql1 .= ",1";
}
$status3 $_POST['status3'];
if (
$status3 <> false)
{
    
$sql1 .= ",2";
}
$status4 $_POST['status4'];
if (
$status4 <> false)
{
    
$sql1 .= ",3";
}

$sql1 .= ") ";
if (
$sql1 == " and a.status in (99) ")
{
    
$sql1 "";
    
$status1 on;
    
$status2 on;
    
$status3 on;
    
$status4 on;
}


$sort $_POST['sort'];
if (
$sort <> "")
{
    
$sql2 " order by "$sort ." desc";
}
else
{
    
$sql2 " order by projectid desc";
}
?>

<html>
<head>
<title>One Solution Limited - Support</title>
<link rel="stylesheet" href="main.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<script language="JavaScript" type="text/javascript" src="richtext.js"></script>
<script type="text/javascript" src="calendarDateInput.js"></script>
<script type="text/javascript">
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
</script>
</head>
<body>

<table border="0" cellpadding="1" cellspacing="1" width="100%">
<tr><td class='pageheader' align="left" valign="middle" height="100"><img src="images/iconProducts.png">&nbsp;<b>Software Project</b></td>
    <td class='content' align="center" width="150"></td>
</tr>
</table>
<a href="projectindex.php" class="content"><img src="images/button_insert.gif" border="0">&nbsp;&nbsp;Create Project</a>
<form action="" method="post">

<p class="content">
<input type="checkbox" name="status1" class="content" <?=getCheck(on,$status1)?>>Disable
<input type="checkbox" name="status2" class="content" <?=getCheck(on,$status2)?>>Enable
<input type="checkbox" name="status3" class="content" <?=getCheck(on,$status3)?>>Completed
<input type="checkbox" name="status4" class="content" <?=getCheck(on,$status4)?>>Deferred
</p>
<p class="content">
Order by <select name="sort" class="content">
<option value="projectid" <?=getSelect("projectid",$sort)?>>Project no.</option>
<option value="projectname" <?=getSelect("projectname",$sort)?>>Name</option>
<option value="staffname" <?=getSelect("staffname",$sort)?>>Assigned To</option>
</select>
<input type="submit" value="Search" class="content">
</p>
</form>

<table border="0" width="550" cellpadding='1' cellspacing='1' bgcolor='#666666'>
<tr><td class="content" width="100" align='center' bgcolor='#FFFFFF'>Project no.</td>
    <td class="content" width="150" align='center' bgcolor='#FFFFFF'>Name</td>
    <td class="content" width="150" align='center' bgcolor='#FFFFFF'>Assigned To</td>
    <td class="content" width="80" align='center' bgcolor='#FFFFFF'>Status</td>
    <td bgcolor='#FFFFFF' width="70"></td></tr>

<?
$sql 
"select a.status as projectstatus, projectid, projectname, staffname 
from PM_PROJECT_HDR a, SYS_STAFF b 
where a.staffid = b.staffid 
$sql1 $sql2";
$result mysql_query($sql);
//echo $sql;
while ($row mysql_fetch_array($result,MYSQL_ASSOC))
{
?>
    <tr><td class="content" bgcolor='#FFFFFF'><?=$row{'projectid'}?></td>
        <td class="content" bgcolor='#FFFFFF'><?=$row{'projectname'}?></td>
        <td class="content" bgcolor='#FFFFFF'><?=$row{'staffname'}?></td>
        <td class="content" bgcolor='#FFFFFF' align='center'>
        <?
        
switch ($row{'projectstatus'}) {
        case 
0:
            print 
"Disabled";
            break;
        case 
1:
            print 
"Enable";
            break;
        case 
2:
            print 
"Completed";
            break;
        case 
3:
            print 
"Deferred";
            break;
        default:
            print 
"";
            break;
        } 
        
?>        
        </td>
        <td class="content" align='center' bgcolor='#FFFFFF'>
        <a href='projectdetail.php?projectid=<?=$row{'projectid'}?>'><img src='images/button_edit.png' border='0' alt="Edit"></a>&nbsp;
        <a href='tasklist.php?projectid=<?=$row{'projectid'}?>'><img src='images/button_properties.gif' border='0' alt="Create task"></a>
        </td></tr>
<?
}
?>
</table>

</body>
</html>
<?
function getSelect($field1$field2)
{
    if (
$field1 == $field2)
    {
        return 
"selected";
    }
    else
    {
        return 
"";
    }
}
?>
<?
function getCheck($field1$field2)
{
    if (
$field1 == $field2)
    {
        return 
"checked";
    }
    else
    {
        return 
"";
    }
}
?>