<?php  include('../includes/header.php');
include('../includes/checkSession.php');?>
<script type="text/javascript">
function ImportWBS(str)
{
if (str=="" || str=="3" || str=="-1")
  {
  document.getElementById("import").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		document.getElementById("import").style.display='';
		document.getElementById("import").innerHTML=xmlhttp.responseText;
	}
  }
if (str=="1")
  {
xmlhttp.open("GET","importPMWBSfield.php",true);
  }
  else
  xmlhttp.open("GET","importWBSfield.php",true); 
xmlhttp.send();
}
</script>
<link type='text/css' href='../libraries/dialog/css/confirm.css' rel='stylesheet' media='screen' />
<img src="../images/icon-heading.gif" width="12" height="13" border="0" /><span class="lbrownlll7"> Create  a List of WBS Names</span>
<?php if(!isset($_REQUEST['Edit'])){?>
<form method="post" action="UWBSListDB.php" enctype="multipart/form-data" name="form1" id="form1" onsubmit="return validateWBS1()">
  <table width="100%" border="0">
    <tr class="ablks1">
      <th width="16%" align="left" valign="top" class="ablks1" scope="col">&nbsp;</th>
      <th width="84%" align="left" valign="top" class="ablks1">&nbsp;</th>
    </tr>
    <tr>
      <th align="left" valign="top" class="ablks5" scope="col">Assign a WBS Name*:</th>
      <th align="left" valign="top" class="a11" scope="col"><label for="WBSN">
        <input name="WBSN" type="text" class="ablks1" id="WBSN" />
      </label></th>
    </tr>
    <tr class="ablks1">
      <th align="left" valign="top" class="ablks5" scope="col">Choose a WBS  Type*:</th>
      <th align="left" valign="top" class="a11" scope="col"><label for="WBST"></label>
        <select name="WBST" class="ablks1" id="WBST" onchange="ImportWBS(this.value)" style="float:left; margin-bottom:0">
        <option value="" selected="selected">Select a WBS Type</option>
        <option value="1">Import from pmAnywhere</option>
        <option value="2">Import from my CSV File</option>
        <option value="3">Create from Scratch</option>
        </select><span id="import"></span></th>
    </tr>    
    <tr class="ablks1">
      <th align="left" valign="top" class="ablks5" scope="col">Remarks (if any):</th>
      <th align="left" valign="top" class="a11" scope="col"><label for="WBSR"></label>
      <input name="WBSR" type="text" class="ablks1" id="WBSR" size="100" /> <input type="image" src="../images/icon-save.png"  width="12" height="12" border="0" />
	  <?php
  if (isset($_REQUEST["msg1"])){  ?>
   <span class="fbrownl1">
     <?php echo $_REQUEST["msg1"];?> </span>
  <?php }?></th>
    </tr>
    <tr class="ablks1">
      <th align="left" valign="top" class="ablks1" scope="col">&nbsp;</th>
      <th align="left" valign="top" class="ablks1">&nbsp;</th>
    </tr>
    <tr class="ablks1">
      <th colspan="2" align="left" valign="top" class="ablks1" scope="col"><hr /></th>
    </tr>
  </table>
</form><br />
<?php }else {
		$WID = $_REQUEST['Edit'];
   		$result = mysql_query("SELECT WBSList_code, WBSList_remarks FROM wbslist where WBSList_id='$WID'");
   		$row = mysql_fetch_array($result , MYSQL_ASSOC);
		$WBSList_code = $row["WBSList_code"];
		$WBSList_remarks = $row["WBSList_remarks"];
	?>
    <form method="post" action="UWBSListDB.php?Edit=<?php echo $WID;?>" enctype="multipart/form-data" name="form1" id="form1" onsubmit="return validateWBS12()">
  <table width="100%" border="0">
    <tr class="ablks1">
      <th width="16%" align="left" valign="top" class="ablks1" scope="col">&nbsp;</th>
      <th width="84%" align="left" valign="top" class="ablks1">&nbsp;</th>
    </tr>
    <tr>
      <th align="left" valign="top" class="ablks5" scope="col">Assign a WBS Name*:</th>
      <th align="left" valign="top" class="a11" scope="col"><label for="WBSN">
        <input name="WBSN" type="text" class="ablks1" id="WBSN" value="<?php echo $WBSList_code;?>" />
      </label></th>
    </tr>    
    <tr class="ablks1">
      <th align="left" valign="top" class="ablks5" scope="col">Remarks (if any):</th>
      <th align="left" valign="top" class="a11" scope="col"><label for="WBSR"></label>
      <input name="WBSR" type="text" class="ablks1" id="WBSR" size="100" value="<?php echo $WBSList_remarks;?>"/> <input type="image" src="../images/icon-save.png"  width="15" height="15"  border="0"/><?php if(isset($_REQUEST['msg1'])) echo $_REQUEST['msg1']; ?></th>
    </tr>
    <tr class="ablks1">
      <th align="left" valign="top" class="ablks1" scope="col">&nbsp;</th>
      <th align="left" valign="top" class="ablks1">&nbsp;</th>
    </tr>
    <tr class="ablks1">
      <th colspan="2" align="left" valign="top" class="ablks1" scope="col"><hr /></th>
    </tr>
  </table>
</form><br />
<?php }?>
<img src="../images/icon-heading.gif" width="12" height="13" border="0" /><span class="lbrownlll7"> <a name="activewbs1" id="activewbs1"></a>List of Active WBS Names</span> (<a href="#hiddenwbs1">List of Hidden WBS Names</a>)<br />
<br />
</span>
<table class="table1" width="100%" border="0">
  <tr class="fbrownl7">
    <td width="9%"  align="left" valign="top" bgcolor="#E2E2E2" scope="col">Date Created<br />
      (yyyy.mm.dd)
      </th>
    <td width="31%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS <br />
      Name</td>
    <td width="27%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS <br />
      Type</td>
    <td width="25%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS Filename<br />
      Remarks</td>
    <td width="8%" align="right" valign="top" bgcolor="#E2E2E2" scope="col"> Start/ Edit<br />
Del/Export</td>
  </tr>
  <?php
 $resultw = mysql_query("SELECT * FROM wbslist where WBSList_for=1 AND WBSList_companyid = '$id' AND WBSList_status='1'");
		while($row = mysql_fetch_array($resultw , MYSQL_ASSOC))
  		{
     ?>     
  <tr class="ablks1">
    <td align="left" valign="top" class="ablks1" scope="col"><?php echo $row['WBSList_datecreation']; ?></td>
    <td align="left" valign="top" class="ablks5"><?php echo $row['WBSList_code']; ?></td>
    <td align="left" valign="top" class="ablks1"><?php if($row['WBSList_type'] =='2') echo "From my CSV File"; else if($row['WBSList_type'] =='3')  echo "From Scratch"; else if($row['WBSList_type'] =='1') echo "From pmAnywhere"; ?></td>
    <td align="left" valign="top" class="ablks1">Filename: <?php if($row['WBSList_file_name']!=""){ echo $row['WBSList_file_name'];} else{ echo "None";} ?><br />Remarks: <?php echo $row['WBSList_remarks']; ?></td>
    <td align="right" valign="top" class="ablks1">&nbsp;<a href="WBS2.php?WID=<?php echo $row['WBSList_id']; ?>"><img src="../images/icon-WBS.jpg" width="17" height="17" border="0" /></a>    
     <?php if ($uacc == "Full Control") {?>
      <a href="UWBSListDB.php?InActive=<?php echo $row['WBSList_id']; ?>"><img src="../images/icon-hide.gif" width="20" height="14" title="Hide" alt="Hide" border="0"/></a> 
       <?php } else { ?>
      <img src="../images/icon-hide.gif" width="20" height="14" title="Hide" alt="Hide" border="0"/>
      <?php }?> 
     <a href="WBS1.php?Edit=<?php echo $row["WBSList_id"]; ?>"><img src="../images/icon-edit1.png" width="15" height="15" border="0"/></a>&nbsp; 
     <a href="UWBSListDB.php?del=<?php echo $row["WBSList_id"]; ?>" onClick="return confirm('This deleted information cannot be retrieved. Press OK to Delete.')"><img src="../images/icon-del1.png" width="16" height="16" border="0"/></a> 
     <a id="<?php echo $row["WBSList_id"]; ?>" class='confirm' href=""><img src="../images/icon-export.jpg" width="15" height="15" border="0"/></a>
      </td>
  </tr>
  <?php $typid = $row["WBSList_id"]; $path = "03-scope"; $type = "WBS1"; $attach=0; $reminder=0; $note=1;
   include('../includes/noterow.php');
   ?>
  <?php }?>
</table><br />
<br />
<hr />
<p><img src="../images/icon-warn2.png" width="17" height="17" border="0"/><br />
  1. 
  Deletion is permanent and can not be retrieved. <br />
  2. If a  parameter has been used at other places, deletion might cause problems. <br />
  3. A 
  parameter can be deleted only after its usage is removed from other places. <br />
  4. 
  If you dont want to see an entry or a parameter, you can hide it instead of deleting it. <br />
5. A Hidden entry or parameter will  show as &quot;HIDDEN&quot; at all places where it was used before. </p>
<br />
  <br />
<img src="../images/icon-info1.png" width="17" height="17" border="0"/><span class="ablks1"> <a name="hiddenwbs1" id="hiddenwbs1"></a>List of Hidden WBS Names</span> (<a href="#activewbs1">List of Active WBS Names</a>)
<table class="table1" width="100%" border="0">
  <tr class="ablks1">
    <td width="9%"  align="left" valign="top" bgcolor="#E2E2E2" scope="col">Date Created<br />
      (yyyy.mm.dd)
      </th>
    <td width="31%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS <br />
      Name</td>
    <td width="27%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS <br />
      Type</td>
    <td width="25%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS Filename<br />
      Remarks</td>
    <td width="8%" align="right" valign="top" bgcolor="#E2E2E2" scope="col"> Unhide</td>
  </tr>
  <?php
 $resultw = mysql_query("SELECT * FROM wbslist where WBSList_for=1 && WBSList_companyid = '$id' AND WBSList_status='0'");
		while($row = mysql_fetch_array($resultw , MYSQL_ASSOC))
  		{
     ?>     
  <tr class="ablks1">
    <td align="left" valign="top" class="ablks1" scope="col"><?php echo $row['WBSList_datecreation']; ?></td>
    <td align="left" valign="top" class="ablks5"><?php echo $row['WBSList_code']; ?></td>
    <td align="left" valign="top" class="ablks1"><?php if($row['WBSList_type'] =='2') echo "From my CSV File"; else if($row['WBSList_type'] =='3')  echo "From Scratch"; else if($row['WBSList_type'] =='1') echo "From pmAnywhere"; ?></td>
    <td align="left" valign="top" class="ablks1">Filename: <?php if($row['WBSList_file_name']!=""){ echo $row['WBSList_file_name'];} else{ echo "None";} ?><br />Remarks: <?php echo $row['WBSList_remarks']; ?></td>
    <td align="right" valign="top" class="ablks1"><?php if ($uacc == "Full Control") {?>
      <a href="UWBSListDB.php?Active=<?php echo $row['WBSList_id']; ?>"><img src="../images/icon-look.jpg" width="22" height="14" title="Active" alt="Active" border="0"/>
      </a>
      <?php } else {?>
      <img src="../images/icon-look.jpg" width="22" height="14" title="Active" alt="Active" border="0"/>
      <?php } ?></td>
  </tr>
  <?php }?>
</table>
<br />
<br />
<br />
<!-- modal content -->

		<div id='confirm'>

			<div class='header'><span>Confirm</span></div>

			<div class='message'></div>

			<div class='buttons'>

				<div class='no simplemodal-close'>No</div><div class='yes'>Yes</div>

			</div>

		</div>

<!--dialog -->

<script type='text/javascript' src='../libraries/dialog/js/jquery.simplemodal.js'></script>

<script type='text/javascript' src='../libraries/dialog/js/confirm.js'></script>
<?php include('../includes/footer.php'); ?>
