Newer
Older
if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
$title='Update Help Topic';
$action='update';
$submit_text='Save Changes';
$info=$topic->getInfo();
$info['id']=$topic->getId();
$title='Add New Help Topic';
$action='create';
$submit_text='Add Topic';
$info['isactive']=isset($info['isactive'])?$info['isactive']:1;
$info['ispublic']=isset($info['ispublic'])?$info['ispublic']:1;
$qstr.='&a='.$_REQUEST['a'];
}
$info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
?>
<form action="helptopics.php?<?php echo $qstr; ?>" method="post" id="save">
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
<input type="hidden" name="do" value="<?php echo $action; ?>">
<input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>">
<input type="hidden" name="id" value="<?php echo $info['id']; ?>">
<h2>Help Topic</h2>
<table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
<thead>
<tr>
<th colspan="2">
<h4><?php echo $title; ?></h4>
<em>Help Topic Information</em>
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="180" class="required">
Topic:
</td>
<td>
<input type="text" size="30" name="topic" value="<?php echo $info['topic']; ?>">
<span class="error">* <?php echo $errors['topic']; ?></span>
</td>
</tr>
<tr>
<td width="180" class="required">
Status:
</td>
<td>
<input type="radio" name="isactive" value="1" <?php echo $info['isactive']?'checked="checked"':''; ?>>Active
<input type="radio" name="isactive" value="0" <?php echo !$info['isactive']?'checked="checked"':''; ?>>Disabled
<span class="error">* </span>
</td>
</tr>
<tr>
<td width="180" class="required">
Type:
</td>
<td>
<input type="radio" name="ispublic" value="1" <?php echo $info['ispublic']?'checked="checked"':''; ?>>Public
<input type="radio" name="ispublic" value="0" <?php echo !$info['ispublic']?'checked="checked"':''; ?>>Private/Internal
<span class="error">* </span>
</td>
</tr>
<tr>
<td width="180">
Parent Topic:
</td>
<td>
<select name="pid">
<option value="">— Select Parent Topic —</option>
<?php
$sql='SELECT topic_id, topic FROM '.TOPIC_TABLE
.' WHERE topic_pid=0 '
.' ORDER by topic';
if(($res=db_query($sql)) && db_num_rows($res)) {
while(list($id, $name)=db_fetch_row($res)) {
echo sprintf('<option value="%d" %s>%s</option>',
$id, (($info['pid'] && $id==$info['pid'])?'selected="selected"':'') ,$name);
}
}
?>
</select> (<em>optional</em>)
<span class="error"> <?php echo $errors['pid']; ?></span>
</td>
</tr>
<tr><th colspan="2"><em>New ticket options</em></th></tr>
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
<tr>
<td width="180" class="required">
Priority:
</td>
<td>
<select name="priority_id">
<option value="">— Select Priority —</option>
<?php
$sql='SELECT priority_id,priority_desc FROM '.PRIORITY_TABLE.' pri ORDER by priority_urgency DESC';
if(($res=db_query($sql)) && db_num_rows($res)){
while(list($id,$name)=db_fetch_row($res)){
$selected=($info['priority_id'] && $id==$info['priority_id'])?'selected="selected"':'';
echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name);
}
}
?>
</select>
<span class="error">* <?php echo $errors['priority_id']; ?></span>
</td>
</tr>
<tr>
<td width="180" class="required">
Department:
</td>
<td>
<select name="dept_id">
<option value="">— Select Department —</option>
<?php
$sql='SELECT dept_id,dept_name FROM '.DEPT_TABLE.' dept ORDER by dept_name';
if(($res=db_query($sql)) && db_num_rows($res)){
while(list($id,$name)=db_fetch_row($res)){
$selected=($info['dept_id'] && $id==$info['dept_id'])?'selected="selected"':'';
echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name);
}
}
?>
</select>
<span class="error">* <?php echo $errors['dept_id']; ?></span>
</td>
</tr>
<tr>
<td width="180">
SLA Plan:
</td>
<td>
<select name="sla_id">
<option value="0">— Department's Default —</option>
<?php
if($slas=SLA::getSLAs()) {
foreach($slas as $id =>$name) {
echo sprintf('<option value="%d" %s>%s</option>',
$id, ($info['sla_id']==$id)?'selected="selected"':'',$name);
}
}
?>
</select>
<span class="error"> <?php echo $errors['sla_id']; ?></span>
<em>(Overwrites department's SLA)</em>
</td>
</tr>
<tr>
<td width="180">Thank-you Page:</td>
<td>
<select name="page_id">
<option value="">— System Default —</option>
<?php
if(($pages = Page::getActiveThankYouPages())) {
foreach($pages as $page) {
if(strcasecmp($page->getType(), 'thank-you')) continue;
echo sprintf('<option value="%d" %s>%s</option>',
$page->getId(),
($info['page_id']==$page->getId())?'selected="selected"':'',
$page->getName());
}
}
?>
</select> <font class="error"><?php echo $errors['page_id']; ?></font>
<em>(Overwrites global setting. Applies to web tickets only.)</em>
</td>
</tr>
<tr>
<td width="180">
Auto-assign To:
</td>
<td>
<select name="assign">
<option value="0">— Unassigned —</option>
<?php
$sql=' SELECT staff_id,CONCAT_WS(", ",lastname,firstname) as name '.
' FROM '.STAFF_TABLE.' WHERE isactive=1 ORDER BY name';
if(($res=db_query($sql)) && db_num_rows($res)){
echo '<OPTGROUP label="Staff Members">';
while (list($id,$name) = db_fetch_row($res)){
$k="s$id";
$selected = ($info['assign']==$k || $info['staff_id']==$id)?'selected="selected"':'';
?>
<option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option>
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
<?php }
echo '</OPTGROUP>';
}
$sql='SELECT team_id, name FROM '.TEAM_TABLE.' WHERE isenabled=1';
if(($res=db_query($sql)) && db_num_rows($res)){
echo '<OPTGROUP label="Teams">';
while (list($id,$name) = db_fetch_row($res)){
$k="t$id";
$selected = ($info['assign']==$k || $info['team_id']==$id)?'selected="selected"':'';
?>
<option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option>
<?php
}
echo '</OPTGROUP>';
}
?>
</select>
<span class="error"> <?php echo $errors['assign']; ?></span>
</td>
</tr>
<tr>
<td width="180">
Ticket auto-response:
</td>
<td>
<input type="checkbox" name="noautoresp" value="1" <?php echo $info['noautoresp']?'checked="checked"':''; ?> >
<strong>Disable</strong> new ticket auto-response for this topic (Overwrites Dept. settings).
</td>
</tr>
<tr>
<th colspan="2">
<em><strong>Admin Notes</strong>: Internal notes about the help topic. </em>
</th>
</tr>
<tr>
<td colspan=2>
<textarea name="notes" cols="21" rows="8" style="width: 80%;"><?php echo $info['notes']; ?></textarea>
</td>
</tr>
</tbody>
</table>
<p style="padding-left:225px;">
<input type="submit" name="submit" value="<?php echo $submit_text; ?>">
<input type="reset" name="reset" value="Reset">
<input type="button" name="cancel" value="Cancel" onclick='window.location.href="helptopics.php"'>
</p>
</form>