function format_list($list, $toplevel = false) { global $auth; global $itemId; global $parent; global $parent_id_global; echo "\n<ul>\n"; foreach ($list as $item) { $parent_id = $item['parent']; //a check to see if this item is parent to the item being added $is_parent_of_add = $parent == $item['itemId'] && $itemId == -1; if ($item['itemId'] == $itemId && $auth == 1) { echo '<li><a name="li_' . $itemId . '" style="text-decoration:none;"> <form method="post"> <input type="hidden" name="edit_itemId" value="' . $itemId . '"> <input type="text" name="label" value="' . $item['label'] . '"> : <input type="text" name="value" value="' . $item['value'] . '"> <input type="submit" name="edit_item" value="Save"> <input type="submit" name="cancel" value="Cancel"> </form> </a></li>'; } else { $text = strpos($item['value'], 'http://') === 0 ? '<a href="' . $item['value'] . '">' . $item['value'] . '</a>' : $item['value']; $label = empty($item['label']) ? $text : $item['label'] . ': ' . $text; if ($toplevel) { $label = "<b>{$label}</b>"; } echo add_tags($item['itemId'], $parent_id, $label); } if (!empty($item['children']) || $is_parent_of_add) { format_list($item['children']); } else { if ($auth == 1) { echo '<ul class="ghost_link"> <li><span class="editable" onclick="add_list_item(' . $item['itemId'] . ')">Click to add a sublist here</span></li> </ul>'; } } echo '</li>'; } //add the add child part here if ($auth == 1 && $itemId == -1 && (!isset($parent_id) || $parent_id == $parent)) { echo '<li> <form method="post"> <input type="hidden" name="parent_id" value="' . $parent . '"> <input onfocus="clear_default_message(this);" type="text" style="width:280px" name="label" value="Leave this box blank to not display the colon ->"> : <input type="text" name="value"> <input type="submit" name="add_child" value="Add"> <input type="submit" name="cancel" value="Cancel"> </form> </li>'; } else { if ($auth == 1 && !$toplevel) { echo '<li class="ghost_link"><span class="editable" onclick="add_list_item(' . $parent_id . ')">Click to add another item here</span></li>'; } } echo "</ul>\n"; }
echo '</form>'; echo '</span>'; //Delete echo ' <input type="button" onclick="toggle(\'' . $row['id'] . '\', \'delete\')" id="buttondelete' . $row['id'] . '" value="Show Delete" style="width: 110px;"><span id="delete' . $row['id'] . '" style="display:none">'; echo '<form method="post" action="" style="display: inline;">'; echo '<input type="hidden" name="id" value="' . $row['id'] . '">'; echo ' <input type="password" name="delete">'; echo ' <input type="submit" value="Delete" style="display: inline;">'; echo '</form>'; echo '</span>'; echo "</div>"; } echo '<div style="clear: both;">'; echo "<b>OS:</b> " . format_list($row['os']) . "<br>"; echo "<b>Java:</b> " . format_list($row['java']) . "<br>"; echo "<b>Version:</b> " . format_list($row['version']) . "<br>"; if ($compact) { echo "<b>Bug:</b><br>"; echo format($row['log']); } else { echo "<b>Bug:</b> " . strtok($row['log'], "\n") . "<br>"; echo "<button type=\"button\" onclick=\"showhide('log" . $row['id'] . "')\">Show Log</button><br><div id=\"log" . $row['id'] . "\" style=\"display:none\">" . format($row['log']) . "</div><br>"; } echo "<hr>"; echo "</div>"; } function format_space($string) { $string = preg_replace('/[\\r\\n]+/', '<br>', $string); $string = preg_replace('/\\t/', ' ', $string); $string = preg_replace('/\\s/', ' ', $string);