function CommentsBlock($ThisID, $Thiskey) { global $DBConn; if ($Thiskey == 's') { $q = "SELECT * FROM comment WHERE Story_AID = " . $ThisID . " and Parent_ID=0 ORDER by ID"; } if ($Thiskey == 'i') { $q = "SELECT * FROM comment WHERE Comment_Object_ID = " . $ThisID . " and Comment_Object_ID <> 0 and Parent_ID=0 ORDER by ID"; } // comments must be wrapped in a div like this // echo '<div class="commentsdialog" id="commentspop'.$Thiskey.'_'.$ThisID.'"><ul id=commentlist'.$Thiskey.'_'.$ThisID.'> '; echo '<ul id=commentlist' . $Thiskey . '_' . $ThisID . '> '; $r = mysqli_query($DBConn, $q); while ($row = mysqli_fetch_assoc($r)) { getComments($row, $ThisID, $Thiskey); } echo '</ul>'; echo '<br><div class="smaller" id="replyto_' . $Thiskey . '_' . $ThisID . '"></div>'; echo '<a href="" onclick="javascript: return false;" title="Add Comment"><img class="submit_button" id="submit_button' . $Thiskey . '_' . $ThisID . '" src="images/add.png"></a>'; echo ' <textarea class="w80 commenth" name="comment_text_' . $ThisID . '" rows="3" cols="80" id="comment_text_' . $ThisID . '"></textarea> '; echo ' <input type="hidden" name="User_Name" id="User_Name_' . $ThisID . '' . '" value="' . $_SESSION['Name'] . '"/> '; echo ' <input type="hidden" name="Parent_ID" id="Parent_ID_' . $Thiskey . '_' . $ThisID . '" value="0"/> '; echo ' <input type="hidden" name="Iteration_ID" id="CIteration_ID" value="' . $_REQUEST['IID'] . '"/> '; // remember that this is not the Story_AID for iterations it is the Comment_Object_ID // being a lazy beggar it this is just easier echo ' <input type="hidden" name="Story_AID" id="Story_AID_' . $ThisID . '' . '" value="' . $ThisID . '"/> '; // echo ' <input type="hidden" name="PID" id="Story_PID_'.$ThisID.''.'" value="'.$_REQUEST['PID'].'"/> '; // echo '</div> '; } CommentsBlock($_GET['id'], $_GET['key']);
} echo '</div>' . '<div class="right">' . $Row['Size'] . ' pts.' . '</div>' . '<div title="Click here to toggle expanded view" id="summary">' . ' ' . $Row['Summary'] . ' ' . '</div>' . '<div id="detail">'; if (strlen($Row['As_A']) > 0) { echo '<b>As a:</b> ' . html_entity_decode($Row['As_A'], ENT_QUOTES) . '<br>'; } echo '<b>' . $Project['Desc_1'] . '</b>' . html_entity_decode($Row['Col_1'], ENT_QUOTES) . '<br>'; if (strlen($Row['Col_2']) > 0) { echo '<b>' . $Project['Desc_2'] . '</b> ' . html_entity_decode($Row['Col_2'], ENT_QUOTES) . '<br>'; } if (strlen($Row['Acceptance']) > 0) { echo '<b>Acceptance Criteria:</b> ' . html_entity_decode($Row['Acceptance'], ENT_QUOTES) . '<br>'; } echo '</div>'; echo '<div id="extra">'; ViewTasks($Row['Project_ID'], $Row['AID']); CommentsBlock($Row['AID']); echo '</div>'; echo '<div class="left">' . $Row['Tags'] . '</div>' . '<div class="right">'; if ($Row['Parent_Story_ID'] != 0) { $parentssql = 'SELECT @id :=(SELECT Parent_Story_ID FROM story WHERE AID = @id and Parent_Story_ID <> 0 ) AS parent FROM (SELECT @id :=' . $Row['AID'] . ') vars STRAIGHT_JOIN story WHERE @id is not NULL'; $parents_Res = mysqli_query($DBConn, $parentssql); if ($parents_row = mysqli_fetch_assoc($parents_Res)) { do { if ($parents_row['parent'] != NULL) { $parentsql = 'select ID, AID, Summary, Size from story where AID=' . $parents_row['parent'] . ' and AID<>0'; $parent_Res = mysqli_query($DBConn, $parentsql); if ($parent_row = mysqli_fetch_assoc($parent_Res)) { echo ' #' . $parent_row['ID'] . ' (' . $parent_row['Size'] . ' pts)</a> '; } } } while ($parents_row = mysqli_fetch_assoc($parents_Res));