$_REQUEST['IID'] = $Project['Backlog_ID'];
}
if (empty($_REQUEST['LeftIID'])) {
    $_REQUEST['LeftIID'] = 0;
}
if (empty($_REQUEST['RightIID'])) {
    $_REQUEST['RightIID'] = 0;
}
//===========================
echo '<div class="hidden" id="phpnavicons" align="Left">' . '<a title="Add new story" href="story_Edit.php?PID=' . $_REQUEST['PID'] . '&IID=' . $_REQUEST['IID'] . '"><img src="images/storyadd-large.png"></a>&nbsp; &nbsp;';
if (isset($_REQUEST['PID']) && isset($_REQUEST['IID'])) {
    echo '&nbsp; &nbsp;<a  title="Project Epic tree" href="story_List.php?Type=tree&Root=0&PID=' . $_REQUEST['PID'] . '&IID=' . $Project['Backlog_ID'] . '"><img src="images/tree-large.png"></a>';
}
echo '</div>';
echo '<div class="hidden statusdialog" id="siter_' . $_REQUEST['IID'] . '" title="Set status">';
echo buildstatuspop($_REQUEST['PID']);
echo '</div>';
echo '<div id="msg_div">';
echo '&nbsp;</div>';
// a Standard story list for the iteraton or backlog.
echo '<div class="left-box">';
echo '&nbsp;&nbsp;<img id="1line" src="images/1line.png" title="One line story display"> <img id="2line" src="images/2line.png" title="Two line story display"> <img id="3line" src="images/3line.png" title="Three line story display">';
echo '</div><br>';
echo '<div class="right-box evenlarger">';
echo 'Current Velocity: ' . $Project['Velocity'] . '&nbsp;';
echo '</div>';
$Toggle = 0;
$Sizecount = 0;
$OSizecount = 0;
$Iterationcount = 1;
$OIterationcount = 1;
         echo ' Locked<br>';
     }
 }
 // release statistics stories & points)
 $tsql = 'SELECT Status, count(*) as relcount, sum(Size) as relsize FROM story where story.Release_ID=' . $_REQUEST['RID'] . ' and story.Status IS NOT NULL group by story.Status';
 print_releasesummary("Release", $tsql);
 echo '<br>&nbsp;&nbsp;<img id="1line" src="images/1line.png" title="One line story display"> <img id="2line" src="images/2line.png" title="Two line story display"> <img id="3line" src="images/3line.png" title="Three line story display">';
 //only show projects that this user is a project admin forprojects
 if ($Usr['Admin_User'] == 1) {
     $tsql = 'SELECT distinct(Project_ID) as relproj  FROM story where story.Release_ID=' . $_REQUEST['RID'];
 } else {
     $tsql = 'SELECT distinct(story.Project_ID) as relproj FROM story left join user_project on story.Project_ID = user_project.Project_ID  where story.Release_ID=' . $_REQUEST['RID'] . ' and user_project.User_ID=' . $_SESSION['ID'] . ' and user_project.Project_Admin=1';
 }
 $Resp = mysqli_query($DBConn, $tsql);
 while ($Rowp = mysqli_fetch_assoc($Resp)) {
     $dummy = buildstatuspop($Rowp['relproj']);
     $instr = '';
     // stories in release
     $sqlp = 'SELECT AID FROM story where story.Release_ID=' . $_REQUEST['RID'] . ' and story.Project_ID=' . $Rowp['relproj'];
     $Res = mysqli_query($DBConn, $sqlp);
     if ($Res) {
         while ($Row = mysqli_fetch_assoc($Res)) {
             $instr .= Top_Parent($Row['AID']) . ',';
         }
     }
     // print project stats for release
     $ptsql = 'SELECT Status, count(*) as relcount, sum(Size) as relsize FROM story where story.Project_Id =' . $Rowp['relproj'] . ' and story.Release_ID=' . $_REQUEST['RID'] . ' and story.Status IS NOT NULL group by story.Status';
     print_releasesummary($Rowp['relproj'], $ptsql);
     if ($RelRow['Locked'] == 0) {
         echo '<form method="post" action="?">';
         echo '&nbsp; &nbsp; <input type="submit" name="AddToRelease" value="Add" title="Add stories in this epic, to this release. (No child Epics)">';
require_once 'include/dbconfig.inc.php';
require_once 'include/common.php';
$user_details = check_user($_SESSION['user_identifier']);
if (!$user_details) {
    exit;
}
global $statuscolour;
global $Project;
global $Sizecount;
global $OSizecount;
global $Toggle;
global $Iterationcount;
global $OIterationcount;
global $DBConn;
global $LockedIteration;
$dummy = Get_Project_Name($_GET['PID']);
$dummy = buildstatuspop($_GET['PID']);
$sumpts = 0;
$sql = 'SELECT * FROM story where story.Project_ID=' . $_GET['PID'] . ' and story.Iteration_ID=' . $_GET['IID'] . ' and 0=(select count(Parent_Story_ID) from story as p where p.Parent_Story_ID = story.AID) order by story.Iteration_Rank';
$story_Res = mysqli_query($DBConn, $sql);
echo '<ul id="sortable-' . $_GET['LorR'] . '" class="connectedSortable mh15">';
if ($story_Row = mysqli_fetch_assoc($story_Res)) {
    do {
        echo '<li class="storybox" id=story_' . $story_Row['AID'] . '>';
        PrintStory($story_Row);
        echo '</li>';
        $sumpts += $story_Row['Size'];
    } while ($story_Row = mysqli_fetch_assoc($story_Res));
}
echo '</ul>';
echo '{6B89778E-1B36-4E75-A7F2-301656217750}' . $sumpts;