Advertisement
Guest User

admin_c1.php

a guest
Jan 10th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 32.28 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if ( $_SESSION['usertype'] == 'admin')
  4. //the following variables hold the firstname and lastname of the logged in user. This can be used to append with the notes the user adds
  5. {
  6. $user = $_SESSION['firstname']." ".$_SESSION['lastname'];
  7. require 'connect_sql.php';
  8. $recent_ID_query = mysql_query("SELECT MAX(ID) FROM c1_report");
  9.  
  10. $recent_ID = mysql_result($recent_ID_query,0);
  11.  
  12. if($recent_ID == '')
  13.   $recent_ID ='1';
  14. else
  15.   $recent_ID = $recent_ID + 1; 
  16. ?>
  17.  
  18. <!DOCTYPE HTML>
  19. <html>
  20. <head>
  21. <html lang="en">
  22.  
  23.     <meta charset="utf-8">
  24. <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
  25.  
  26.     <link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.22.custom.css">
  27.     <link rel ="stylesheet" type ="text/css" href ="css/style.css">
  28.  
  29.  
  30. <div class="Add New User">
  31.  
  32.    <!-- title -->
  33. <title> Report </title>
  34. <link rel="shortcut icon" type="image/x-icon" href="images/base.gif" />
  35.    
  36.     <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  37.     <script type="text/javascript" src = "//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>  
  38.    
  39.     <style>
  40.         body { font-size: 62.5%; }
  41.         label, input { display:block; }
  42.         input.text { margin-bottom:12px; width:95%; padding: .4em; }
  43.         fieldset { padding:0; border:0; margin-top:25px; }
  44.         h1 { font-size: 1.2em; margin: .6em 0; }
  45.    
  46.         .ui-dialog .ui-state-error { padding: .3em; }
  47.         .validateTips { border: 1px solid transparent; padding: 0.3em; }
  48.     </style>
  49.    
  50.     <script>
  51.     $(function() {
  52.     var canBeAdded = false;
  53. $("#email").change(function() {
  54. var tips = $( ".validateTips" );
  55. var email = $("#email").val();
  56. email = email.toLowerCase();
  57.  
  58.     function check_valid_company()
  59.     {
  60.         var email = $("#email").val();
  61.         email = email.toLowerCase();
  62.         if(email.indexOf("@gmail.com") != -1 || email.indexOf("@yahoo.com") != -1 )
  63.             return true;
  64.        
  65.         else
  66.             return false;  
  67.  
  68.     }
  69.  
  70. function updateTips( t ) {
  71.             tips
  72.                 .text( t )
  73.                 .addClass( "ui-state-highlight" );
  74.             setTimeout(function() {
  75.                 tips.removeClass( "ui-state-highlight", 1500 );
  76.             }, 500 );
  77.         }
  78. if(email.length >= 3)
  79. {
  80. $.ajax({
  81. type: "POST",
  82. url: "email_check_indb.php",
  83. data: "email="+ email,
  84. success: function(msg){
  85.  
  86. $("#create-user").ajaxComplete(function(event, request, settings){
  87.  
  88. if(msg == 'OK')
  89. {
  90. if(!check_valid_company())
  91. {
  92.    $("#email").addClass( "ui-state-error" );
  93.       updateTips( "Not a valid email type to be added to the system for this company." );
  94. }
  95. else{
  96.  
  97. $("#email").removeClass( "ui-state-error" );
  98.  
  99. updateTips("Email can be added to the system");
  100. canBeAdded = true;
  101. }
  102. }  
  103. else
  104. {
  105. updateTips("Email already in database");
  106. canBeAdded = false;
  107. $("#email").addClass( "ui-state-error" );
  108. }});}});}
  109. else
  110. {
  111. $("#email").removeClass( "ui-state-error" );
  112. canBeAdded = false;
  113. }});
  114.    
  115.      $("#dialog:ui-dialog").ready(function() {
  116.     $("#estimated_start_on").datepicker();
  117.   });
  118.    $("#dialog:ui-dialog").ready(function() {
  119.     $("#actual_start_on").datepicker();
  120.   });
  121.  
  122.    $("#dialog:ui-dialog").ready(function() {
  123.     $("#estimated_researchready_for_service").datepicker();
  124.   });
  125.    $("#dialog:ui-dialog").ready(function() {
  126.     $("#actual_researchready_for_service").datepicker();
  127.   });
  128.        
  129.         $( "#dialog:ui-dialog" ).dialog( "destroy" );
  130.        
  131.        
  132.         var firstname = $('#firstname'),
  133.             lastname  = $('#lastname'),
  134.             email     = $('#email'),
  135.             internalnotes = $( "#internalnotes" ),
  136.             statusnotes  = $("#statusnotes"),
  137.             estimatedresearchhours = $( "#estimatedresearchhours" ),
  138.             title = $("#title"),
  139.             description = $("#description"),
  140.             actualresearchhours = $("#actualresearchhours"),
  141.             estimateddevhours = $("#estimateddevhours"),
  142.             actualdevhours = $("#actualdevhours"),
  143.             estimatedqahours = $("#estimatedqahours"),
  144.             actualqahours = $("#actualqahours"),
  145.             estimated_start_on = $("#estimated_start_on"),
  146.             actual_start_on = $("#actual_start_on"),
  147.            
  148.             estimated_researchready_for_service = $("#estimated_researchready_for_service"),
  149.             actual_researchready_for_service = $("#actual_researchready_for_service"),
  150.             environment = $('#environment'),
  151.             businessowner = $('#businessowner'),
  152.             internalproductowner = $('#internalproductowner'),
  153.             billable = $('#billable'),
  154.             status = $('#status'),
  155.             priority = $('#priority'),
  156.             ranking = $('#ranking'),
  157.             team = $('#team'),
  158.             statusnotes = $('#statusnotes'),
  159.             internalnotes = $('#internalnotes'),
  160.             allFields = $( [] ).add(firstname).add(lastname).add(email).add( internalnotes ).add(statusnotes).add( estimatedresearchhours ).add(title).add(description).add(actualresearchhours ).add(estimateddevhours).add(actualdevhours).add(estimatedqahours).add(actualqahours).add(estimated_start_on).add(actual_start_on).add(estimated_researchready_for_service).add(actual_researchready_for_service).add(environment).add(businessowner).add(internalproductowner).add(billable).add(status).add(priority).add(ranking).add(team).add(statusnotes).add(internalnotes),
  161.             tips = $( ".validateTips" );
  162.  
  163.         function updateTips( t ) {
  164.             tips
  165.                 .text( t )
  166.                 .addClass( "ui-state-highlight" );
  167.             setTimeout(function() {
  168.                 tips.removeClass( "ui-state-highlight", 1500 );
  169.             }, 500 );
  170.         }
  171.        
  172.         function timedRefresh(timeoutPeriod) {
  173.     setTimeout("location.reload(true);",timeoutPeriod);
  174. }
  175.  
  176.     function check_valid_company(o)
  177.     {
  178.         var email = o.val();
  179.         email = email.toLowerCase();
  180.         if(email.indexOf("@gmail.com") != -1 || email.indexOf("@yahoo.com") != -1)
  181.         {
  182.             return true;
  183.  
  184.         }
  185.         else
  186.         {
  187.             o.addClass( "ui-state-error" );
  188.                updateTips( "Not a valid email type to be added to the system for this company." );
  189.             return false;  
  190.         }
  191.     }
  192.         function check_logintype(){
  193.         var login_type = $('input:radio[name=Login_Type]:checked').val();
  194.         if(login_type == null || login_type ==""){
  195.         updateTips("Login Type should be selected");
  196.         return false;
  197.         }
  198.         else{
  199.         return true;
  200.         }
  201.         }
  202.        
  203.         function checkLength( o, n, min, max ) {
  204.             if ( o.val().length > max || o.val().length < min ) {
  205.                 o.addClass( "ui-state-error" );
  206.                 updateTips( "Length of " + n + " must be between " +
  207.                     min + " and " + max + "." );
  208.                 return false;
  209.             } else {
  210.                 return true;
  211.             }
  212.         }
  213.         function checkEmpty(o){
  214.             if(o.length>0)
  215.                 return true;
  216.             else
  217.                 return false;  
  218.         }
  219.  
  220.         function checkRegexp( o, regexp, n ) {
  221.             if ( !( regexp.test( o.val() ) ) ) {
  222.                 o.addClass( "ui-state-error" );
  223.                 updateTips( n );
  224.                 return false;
  225.             } else {
  226.                 return true;
  227.             }
  228.         }
  229.         function Random() {
  230.         return Math.floor(Math.random() * 1000);
  231.         }
  232.             function checkUser(o){
  233.             if(canBeAdded == true)
  234.               return true;
  235.             else{
  236.             updateTips("Email already exists in the database");
  237.             o.addClass( "ui-state-error" );
  238.             return false;
  239.             }      
  240.         }
  241.         $( "#addnewitem-form" ).dialog({
  242.             autoOpen: false,
  243.             closeOnEscape : true,
  244.             height: 500,
  245.             show : 'fade',
  246.             width: 360,
  247.             modal: false,
  248.             resizable : false,
  249.             buttons: {
  250.                 "Submit": function() {
  251.                     var bValid = true;
  252.        
  253.         var ID_check = $("#ID").val();
  254.         var title = $("#title").val();
  255.         var description = $("#description").val();
  256.         var environment = $("#environment").val();
  257.         var businessowner = $("#businessowner").val();
  258.         var internalproductowner = $("#internalproductowner").val();
  259.         var billable = $("#billable").val();
  260.         var status = $("#status").val();
  261.         var estimatedresearchhours = $("#estimatedresearchhours").val();
  262.         var actualresearchhours = $("#actualresearchhours").val();
  263.         var estimateddevhours = $("#estimateddevhours").val();
  264.         var actualdevhours = $("#actualdevhours").val();
  265.         var estimatedqahours = $("#estimatedqahours").val();
  266.         var actualqahours = $("#actualqahours").val();
  267.         var priority = $("#priority").val();
  268.         var ranking = $("#ranking").val();
  269.         var estimated_start_on = $("#estimated_start_on").val();
  270.         var actual_start_on = $("#actual_start_on").val();
  271.         var estimated_researchready_for_service = $("#estimated_researchready_for_service").val();
  272.         var actual_researchready_for_service = $("#actual_researchready_for_service").val();
  273.         var team = $("#team").val();
  274.        
  275.         var statusnotes = $("#statusnotes").val();
  276.         var internalnotes = $("#internalnotes").val();
  277.         var isEdit  = $("#isEdit").val();
  278.         var username = $("#username").val();
  279.        
  280.         var varData = 'ID=' + ID_check + '&title=' + title+'&description=' + description + '&environment=' + environment + '&businessowner=' + businessowner + '&internalproductowner=' + internalproductowner + '&billable=' + billable + '&status=' + status + '&estimatedresearchhours=' + estimatedresearchhours + '&actualresearchhours=' + actualresearchhours + '&estimateddevhours=' + estimateddevhours + '&actualdevhours=' + actualdevhours + '&actualqahours=' + actualqahours +'&estimatedqahours=' + estimatedqahours+ '&priority=' + priority + '&ranking=' + ranking + '&estimated_start_on=' + estimated_start_on + '&actual_start_on=' + actual_start_on + '&estimated_researchready_for_service=' + estimated_researchready_for_service +'&actual_researchready_for_service=' + actual_researchready_for_service + '&team=' + team + '&statusnotes=' + statusnotes +'&internalnotes=' + internalnotes + '&username='+username;
  281.  
  282.        
  283.             if(bValid && (isEdit == "N") )
  284.             {      
  285.        
  286.                 $.ajax({
  287.                 type: "POST",
  288.                 url:'add_new_item_cnt_todb.php',
  289.                 data: varData,
  290.                 success: function() {
  291.                 alert("Item with ID "+ ID_check + " will be added shortly.");      
  292.                 }  
  293.    
  294.             });
  295.             timedRefresh(3000);
  296.                
  297.             $( this ).dialog( "close" );
  298.             }
  299.             else if(bValid && ( isEdit === "Y" )){
  300.             varData = varData + '&username=' + $("#username").val();
  301.            
  302.             $.ajax({
  303.                 type: "POST",
  304.                 url:'admin_edit_to_cntdb.php',
  305.                 data: varData,
  306.                 success: function() {
  307.    
  308.                 }  
  309.    
  310.             });
  311.             timedRefresh(3000);
  312.                
  313.             $( this ).dialog( "close" );
  314.  
  315.                
  316.             }
  317.                    
  318.                 },
  319.                 Cancel: function() {
  320.                     $( this ).dialog( "close" );
  321.                 }
  322.             },
  323.             close: function() {
  324.        
  325.             }
  326.         });
  327.        
  328.         $( "#dialog-form" ).dialog({
  329.             autoOpen: false,
  330.             closeOnEscape : true,
  331.             height: 400,
  332.             show : 'fade',
  333.             width: 350,
  334.             modal: true,
  335.             resizable : false,
  336.             buttons: {
  337.                 "Create an account": function() {
  338.                     var bValid = true;
  339.                     allFields.removeClass( "ui-state-error" );
  340.  
  341.                     bValid = bValid && checkLength( firstname, "First Name", 3, 16 );
  342.                     bValid = bValid && checkLength( lastname, "Last Name", 3, 16 );
  343.                     bValid = bValid && checkLength( email, "email", 6, 80 );
  344.                     bValid = bValid && check_logintype();
  345.                     bValid = bValid && checkRegexp(email,  /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/, "eg. abc@def.com" );
  346.                     bValid = bValid && check_valid_company(email);
  347.                     bValid = bValid && checkUser(email);   
  348.    
  349.         var fname = $( "#firstname" ).val();
  350.         var lname = $("#lastname").val();
  351.         var mail = $( "#email" ).val();
  352.        
  353.         var logintype = $('input:radio[name=Login_Type]:checked').val();
  354.        
  355.         var varData = 'firstname=' + fname + '&lastname=' + lname +  '&email=' + mail + '&logintype=' + logintype;
  356.  
  357.  
  358.    
  359.             if(bValid)
  360.             {
  361.                 $.ajax({
  362.                 type: "POST",
  363.                 url:'sendActivation.php',
  364.                 data: varData,
  365.                 success: function(msg) {
  366.                     if(msg == 'OK')
  367.                     {
  368.                        
  369.                         alert('Email sent to ' + fname + '. Please advice ' + fname + ' to check spam/junk folder for activation link.');
  370.                     }
  371.                     else if(msg == 'Mail not sent'){
  372.                    
  373.                         alert('Mail server is down. ' + fname + ' was not added to the system. Please try adding later.');
  374.                     }
  375.                     else{
  376.                         alert ("User already exists in the system, can't be added again.");
  377.                         }
  378.  
  379.                 }          
  380.             });
  381.             canBeAdded = false;
  382.             $( this ).dialog( "close" );
  383.             }
  384.                    
  385.                 },
  386.                 Cancel: function() {
  387.                     allFields.val( "" ).removeClass( "ui-state-error" );
  388.                     updateTips("All form fields are required");
  389.                     $( this ).dialog( "close" );
  390.                 }
  391.             },
  392.             close: function() {
  393.                 updateTips("All form fields are required");
  394.                 allFields.val( "" ).removeClass( "ui-state-error" );
  395.             }
  396.         });
  397.  
  398.         $( "#create-user" )
  399.             .button()
  400.             .click(function() {
  401.                 $( "#dialog-form" ).dialog( "open" );
  402.             });
  403.  
  404.         $( "#add-new-item" )
  405.             .button()
  406.             .click(function() {
  407.             $( "#dialog:ui-dialog" ).dialog( "destroy" );
  408.                 $( "#addnewitem-form" ).dialog( "open" );
  409.                
  410.                 $("#addnewitem-form").dialog('option', 'title', 'Add New Item');
  411.                    
  412.                 $("#addnewitem-form").get($("#isEdit").val("N"));
  413.  
  414.         $( "#addnewitem-form" ).dialog( "open" );      
  415.         $("#addnewitem-form").get($("#title").val(""));
  416.         $("#addnewitem-form").get($("#description").val(""));
  417.         $("#addnewitem-form").get($("#environment").val(""));
  418.         $("#addnewitem-form").get($("#businessowner").val(""));
  419.         $("#addnewitem-form").get($("#internalproductowner").val(""));
  420.         $("#addnewitem-form").get($("#billable").val(""));
  421.         $("#addnewitem-form").get($("#status").val(""));
  422.         $("#addnewitem-form").get($("#estimatedresearchhours").val(""));
  423.         $("#addnewitem-form").get($("#actualresearchhours").val(""));
  424.         $("#addnewitem-form").get($("#estimateddevhours").val(""));
  425.         $("#addnewitem-form").get($("#actualdevhours").val(""));
  426.         $("#addnewitem-form").get($("#estimatedqahours").val(""));
  427.         $("#addnewitem-form").get($("#actualqahours").val(""));
  428.         $("#addnewitem-form").get($("#priority").val(""));
  429.         $("#addnewitem-form").get($("#ranking").val(""));
  430.         $("#addnewitem-form").get($("#estimated_start_on").val(""));
  431.         $("#addnewitem-form").get($("#actual_start_on").val(""));
  432.         $("#addnewitem-form").get($("#estimated_researchready_for_service").val(""));
  433.         $("#addnewitem-form").get($("#actual_researchready_for_service").val(""));
  434.         $("#addnewitem-form").get($("#team").val(""));
  435.        
  436.  
  437.             });
  438.         $(".edit").button().click(function(){
  439.         $( "#dialog:ui-dialog" ).dialog( "destroy" );
  440.         var id = this.id;
  441.        
  442.         var n = id.split("+");
  443.        
  444.         $( "#addnewitem-form" ).dialog( "open" );
  445.         $("#addnewitem-form").dialog('option', 'title', 'Edit Item');
  446.         $("#addnewitem-form").get($("#ID").val(n[0]));
  447.         $("#addnewitem-form").get($("#title").val(n[1]));
  448.         $("#addnewitem-form").get($("#description").val(n[2]));
  449.         $("#addnewitem-form").get($("#environment").val(n[3]));
  450.         $("#addnewitem-form").get($("#businessowner").val(n[4]));
  451.         $("#addnewitem-form").get($("#internalproductowner").val(n[5]));
  452.         $("#addnewitem-form").get($("#billable").val(n[6]));
  453.         $("#addnewitem-form").get($("#status").val(n[7]));
  454.         $("#addnewitem-form").get($("#estimatedresearchhours").val(n[11]));
  455.         $("#addnewitem-form").get($("#actualresearchhours").val(n[12]));
  456.         $("#addnewitem-form").get($("#estimateddevhours").val(n[13]));
  457.         $("#addnewitem-form").get($("#actualdevhours").val(n[14]));
  458.         $("#addnewitem-form").get($("#estimatedqahours").val(n[15]));
  459.         $("#addnewitem-form").get($("#actualqahours").val(n[16]));
  460.         $("#addnewitem-form").get($("#priority").val(n[8]));
  461.         $("#addnewitem-form").get($("#ranking").val(n[9]));
  462.         $("#addnewitem-form").get($("#estimated_start_on").val(n[17]));
  463.         $("#addnewitem-form").get($("#actual_start_on").val(n[18]));
  464.         $("#addnewitem-form").get($("#estimated_researchready_for_service").val(n[19]));
  465.         $("#addnewitem-form").get($("#actual_researchready_for_service").val(n[20]));
  466.         $("#addnewitem-form").get($("#team").val(n[10]));
  467.         $("#addnewitem-form").get($("#isEdit").val("Y"));
  468.         $("#addnewitem-form").get($("#username").val(n[21]));
  469.         });
  470.                
  471.     });
  472.  
  473. function scroll_header()
  474. {
  475.  var scrOfY = 0;
  476.  if(typeof(window.pageYOffset) == 'number')
  477.  {
  478.   //Netscape compliant
  479.   scrOfY = window.pageYOffset;
  480.   }
  481.  else if(document.body && document.body.scrollTop)
  482.  {
  483.   //DOM compliant
  484.   scrOfY = document.body.scrollTop;
  485.   }
  486.  else if(document.documentElement && document.documentElement.scrollTop)
  487.  {
  488.   //IE6 standards compliant mode
  489.   scrOfY = document.documentElement.scrollTop;
  490.   }
  491.  document.getElementById('header').style.top=scrOfY;
  492.  }
  493.  
  494.  
  495.  
  496.  
  497.     </script>
  498.  
  499. </head>
  500. <body onscroll="scroll_header();">
  501. <!-- title -->
  502. <title> Report view </title>
  503. <link rel="shortcut icon" type="image/x-icon" href="images/base.gif" />
  504. <link href="style_admin.css" rel="stylesheet" type="text/css">
  505.  
  506. <div id="container">
  507.  
  508. <div id="header">
  509.  
  510. <img src="images/main_logo.png" border="0" style="position: relative;left:450px;top:10px" height="80%" />
  511.  
  512. <br /> <br />
  513.  
  514. <a href="index.html" style="position: relative;left:1333px;top:-110px">Logout</a>
  515. <a href="admin_select.php" style="position: relative;left:1276px;top:-75px">View a different report</a>
  516. <a href="phpexcel/Tests/down_admin_c1.php" style="position: relative;left:1048px;top:-40px">Download as Excel</a>
  517. </div>
  518.  
  519.  
  520.  
  521.  
  522. <div class="Add New User">
  523.  
  524. <div id="dialog-form" title="Add New User">
  525.     <p class="validateTips"><big>All form fields are required</big></p>
  526.  
  527.     <form>
  528.     <fieldset>
  529.    
  530.         <label for="first_name"><b><big>First Name</big></b></label>
  531.         <input type="text" name="firstname" id = "firstname"  class="text ui-widget-content ui-corner-all" />
  532.        
  533.         <label for="last_name"><b><big>Last Name</big></b></label>
  534.         <input type="text" name="lastname" id = "lastname"  class="text ui-widget-content ui-corner-all" />
  535.        
  536.         <label for="email"><b><big>Email</big></b></label>
  537.         <input type="text" name="email" id="email" class="text ui-widget-content ui-corner-all" />
  538.        
  539.         <label for="logintype"><b><big>Login Type</big></b></label><br/>
  540.        
  541.         <input type="radio" class = "radio" name="Login_Type" value="Business Owner" id = "Login_Type" />Business Owner
  542.         <input type="radio" class = "radio" name="Login_Type" value="Business User" id = "Login_Type" />Business User<br />
  543.                
  544.     </fieldset>
  545.     </form>
  546. </div>
  547. <div style="position: relative;">
  548. <button id="create-user" style="left:122px;top:-105px" >Add New User</button>
  549.  
  550. </div>
  551.  
  552.  
  553. <div class="demo-description">
  554. </div>
  555.  
  556. <div class="Add New Item">
  557.  
  558. <div id="addnewitem-form" title="Add New Item">
  559.     <form>
  560.     <fieldset>
  561.    
  562.     <label for="ID"><b><big>ID </big></b></label>
  563.     <input type="text" name="ID" value = "<?php echo $recent_ID;?>" id = "ID" disabled="disabled" class="text ui-widget-content ui-corner-all" /><br />
  564.        
  565.         <label for="Title"><b><big>Title</big></b></label>
  566.         <input type = "text" name="title" id = "title" value = "" class="text ui-widget-content ui-corner-all" >
  567.         <br>
  568.         <label for="Description"><b><big>Description</big></b></label>
  569.         <input type = "text" name="description" id = "description" value = "" class="text ui-widget-content ui-corner-all" >
  570.        
  571. <br>
  572.         <label for="environment"><b><big>Environment</big></b></label>
  573.         <select id = "environment" class="text ui-widget-content ui-corner-all">
  574.   <option value=""></option>
  575.   <option value="Windows">Windows</option>
  576.   <option value="Win 2008">Win 2008</option>
  577.   <option value="Win 7">Win 7</option>
  578.   <option value="Win Vista">Win Vista</option>
  579.   <option value ="Linux">Linux</option>
  580.   <option value = "Win 7/Linux">Win 7/Linux</option>
  581.   <option value = "All">All</option>
  582. </select><br><br>
  583.         <label for="businessowner"><b><big>Business Owner</big></b></label>
  584.         <select id = "businessowner" class="text ui-widget-content ui-corner-all">
  585. <option value=""></option>
  586. <option value = "Jose Arteaga">Jose Arteaga</option>
  587. <option value = "Gus Barazza">Gus Barazza</option>
  588.  
  589.  
  590.  
  591. </select><br><br>
  592. <label for="internalproductowner"><b><big>Internal Product Owner</big></b></label>
  593. <select id = "internalproductowner" class="text ui-widget-content ui-corner-all">
  594. <option value = ""></option>
  595. <option value = "Do Nguyen">D</option>
  596. <option value = "Aldo Kurnia">A</option>
  597. <option value = "Duy Hoang">Dy</option>
  598. <option value = "Van Pham">Va</option>
  599. <option value = "Khuong Ngo">Kh</option>
  600. </select><br><br>
  601. <label for="billable"><b><big>Billable</big></b></label>
  602. <select id = "billable" class="text ui-widget-content ui-corner-all">
  603. <option value=""></option>
  604. <option value = "Yes">Yes</option>
  605. <option value = "No">No</option>
  606. <option value = "TBD">TBD</option>
  607. </select><br><br>
  608. <label for="status"><b><big>Status</big></b></label>
  609. <select id = "status" class="text ui-widget-content ui-corner-all">
  610. <option value=""></option>
  611. <option value = "Implementing">Implementing</option>
  612. <option value = "Pending">Pending</option>
  613. <option value = "Testing">Testing</option>
  614. <option value = "Design Review">Design Review</option>
  615. <option value = "Blocked">Blocked</option>
  616. <option value = "Completed">Completed</option>
  617. <option value = "Investigating">Investigating</option>
  618. <option value = "New">New</option>
  619. <option value = "Postponed">Postponed</option>
  620. <option value = "closed">closed</option>
  621. </select><br><br>
  622. <label for="estimatedresearchhours"><b><big>Estimated Research Hours</big></b></label>
  623. <input type = "text" name = "estimatedhours" id = "estimatedresearchhours" class="text ui-widget-content ui-corner-all"><br>
  624. <label for="actualresearchhours"><b><big>Actual Research Hours</big></b></label>
  625. <input type = "text" name ="actualhours" id = "actualresearchhours" class="text ui-widget-content ui-corner-all"><br>
  626. <label for="estimateddevhours"><b><big>Estimated Dev Hours</big></b></label>
  627. <input type = "text" name = "estimateddevhours" id = "estimateddevhours" class="text ui-widget-content ui-corner-all"><br>
  628. <label for="actualdevhours"><b><big>Actual Dev Hours</big></b></label>
  629. <input type = "text" name = "actualdevhours" id = "actualdevhours" class="text ui-widget-content ui-corner-all"><br>
  630. <label for="estimataedqahours"><b><big>Estimated QA Hours</big></b></label>
  631. <input type = "text" name = "estimatedqahours" id = "estimatedqahours" class="text ui-widget-content ui-corner-all"><br>
  632. <label for="actualqahours"><b><big>Actual QA Hours</big></b></label>
  633. <input type = "text" name = "actualqahours" id = "actualqahours" class="text ui-widget-content ui-corner-all"><br>
  634. <label for="last_name"><b><big>Priority</big></b></label>
  635. <select id = "priority" class="text ui-widget-content ui-corner-all">
  636. <option value=""></option>
  637. <option value = "1-Urgent">1-Urgent</option>
  638. <option value = "2-High">2-High</option>
  639. <option value = "3-Medium">3-Medium</option>
  640. <option value = "4-Low">4-Low</option>
  641. </select><br><br>
  642. <label for="ranking"><b><big>Ranking</big></b></label>
  643. <select id = "ranking" class="text ui-widget-content ui-corner-all">
  644. <option value=""></option>
  645. <option value = "1">1</option>
  646. <option value = "2">2</option>
  647. <option value = "3">3</option>
  648. <option value = "4">4</option>
  649. <option value = "5">5</option>
  650. <option value = "6">6</option>
  651. <option value = "7">7</option>
  652. </select><br><br>
  653. <label for="estimated_start_on"><b><big>Estimated Start On</big></b></label>
  654. <input id="estimated_start_on" class="text ui-widget-content ui-corner-all" />
  655. <label for="actual_start_on"><b><big>Actual Start On</big></b></label>
  656. <input id="actual_start_on" class="text ui-widget-content ui-corner-all" />
  657. <label for="estimated_researchready_for_service"><b><big>Estimated Ready for Service</big></b></label>
  658. <input id="estimated_researchready_for_service" class="text ui-widget-content ui-corner-all" />
  659. <label for="actual_researchready_for_service"><b><big>Actual Ready for Service</big></b></label>
  660. <input id="actual_researchready_for_service" class="text ui-widget-content ui-corner-all" />
  661.        
  662.        
  663. <input type="hidden" name="isEdit" value="isEdit" id = "isEdit" />     
  664. <input type ="hidden" name = "username" value = "<?php echo $user;?>" id = "username" />
  665.             <label for="statusnotes"><b><big>Status Notes:</big></b></label>   
  666.                  <textarea rows="4" cols="50" id = "statusnotes" class="text ui-widget-content ui-corner-all"></textarea><br><br>
  667.                 <label for="internalnotes"><b><big>Internal Notes:</big></b></label>   
  668.                  <textarea rows="4" cols="50" id = "internalnotes" class="text ui-widget-content ui-corner-all"></textarea><br><br>
  669.                 <label for="team"><b><big>Team</big></b></label>
  670.                 <select id = "team" class="text ui-widget-content ui-corner-all">
  671. <option value=""></option>
  672. <option value = "DPT">D</option>
  673. <option value = "GRT">G</option>
  674. <option value = "IM">I</option>
  675. <option value = "Admin">Admin</option>
  676. <option value = "Not Specified">Not Specified</option>
  677. </select><br><br>
  678.  
  679.     </fieldset>
  680.     </form>
  681. </div>
  682.  
  683.  
  684. <div style="position: relative;">
  685. <button id="add-new-item" style="left:122px;top:-90px" >Add New Item</button>
  686. </div>
  687.  
  688. <script src="sorttable.js" type="text/javascript"></script>
  689. <style type="text/css">
  690.  
  691. </style>
  692. <table id="table" class = "sortable"  >
  693. <thead>
  694. <th class="sorttable_nosort" >History</th>
  695. <th>ID</th>
  696. <th>Title</th>
  697. <th>Description</th>
  698. <th>Environment</th>
  699. <th>Business Owner</th>
  700. <th>Internal Product Owner</th>
  701. <th>Billable</th>
  702. <th>Status</th>
  703. <th>Priority</th>
  704. <th>Ranking</th>
  705. <th>Team</th>
  706. <th>Estimated Research Hours</th>
  707. <th>Actual Resarch Hours</th>
  708. <th>Estimated Dev Hours</th>
  709. <th>Actual Dev Hours</th>
  710. <th>Estimated QA Hours</th>
  711. <th>Actual QA Hours</th>
  712. <th>Estimated Start On</th>
  713. <th>Actual Start On</th>
  714. <th>Estimated Ready For Service</th>
  715. <th>Actual Ready For Service</th>
  716. <th class="sorttable_nosort" >Internal Notes</th>
  717. <th class="sorttable_nosort" >Status Notes</th>
  718. <th class="sorttable_nosort" >Comments From BO</th>
  719. <th class="sorttable_nosort" >Edit</th>
  720. <th class="sorttable_nosort" >Attachments</th>
  721. </thead>
  722.  
  723. <tr>
  724. <td></td>
  725. <td></td>
  726. <td></td>
  727. <td></td>
  728. <td>
  729.  
  730. <script language="JavaScript" type="text/JavaScript">
  731. function formSubmit()
  732. {
  733. document.getElementById("report_filter").submit();
  734. }
  735. </script>
  736.  
  737. //this is the part where i am trying to get it done. this gives a combo box full of options.
  738. <form method="post" id="report_filter" action="" >
  739.     <select name="try" onchange="formSubmit();">
  740.     <option value="all">           All         </option>
  741.     <option value="Windows">       Windows     </option>
  742.     <option value="Win 2008">      Win 2008    </option>
  743.     <option value="Win 7">         Win 7       </option>
  744.     <option value="Win Vista">     Win Vista   </option>
  745.     <option value ="Linux">        Linux       </option>
  746.     <option value = "Win 7/Linux"> Win 7/Linux </option>
  747.     </select>
  748. </form>
  749. </td>
  750. </tr>
  751.  
  752.  
  753.  
  754. <?php
  755.  
  756. //initially when page loads, or when no option is selected website echoes 'none', or it will echo the option selected. but this is not working when i login and goto this page, but works when i goto this page directly.
  757.  
  758. if(!(isset($_POST["try"])))
  759.      echo "none";
  760. else
  761.      echo "ok ".$_POST["try"];
  762.  
  763.  
  764. $host="***";
  765. $username=****;
  766. $password=****;
  767. $database=****;
  768. $connection=mysql_connect(***,***<***);
  769. mysql_connect($host,$username,$password);
  770. @mysql_select_db($database) or die( "Unable to select database");
  771.  
  772. error_reporting(E_ALL);
  773. ini_set('display_errors', TRUE);
  774. ini_set('display_startup_errors', TRUE);
  775.  
  776. //$first=$_SESSION['firstname'];
  777. //$last=$_SESSION['lastname'];
  778.  
  779.  
  780. $query="SELECT * FROM c1_report";
  781. $result=mysql_query($query);
  782. $query1="SELECT * FROM ce1_notes";
  783. $result1=mysql_query($query1);
  784.  
  785. $num=mysql_numrows($result);   
  786. $num1=mysql_numrows($result1);
  787.  
  788.                                                                    
  789. echo "<font size = '5'; face = 'calibri'; color='black'; > <center> <i>  <a style='position:relative;left:338px;top:-8px'>Welcome ".$user."! </a>  </i> </center> </font>";
  790. echo "</br> ";
  791. //mysql_close();
  792. $i=0;
  793.  
  794. while ($i < $num){
  795.    
  796. $j=0;
  797. $f[$i][$j]=mysql_result($result,$i,"ID");
  798. $j++;
  799. $f[$i][$j]=mysql_result($result,$i,"title");
  800. $j++;
  801. $f[$i][$j]=mysql_result($result,$i,"description");
  802. $j++;
  803. $f[$i][$j]=mysql_result($result,$i,"environment");
  804. $j++;
  805. $f[$i][$j]=mysql_result($result,$i,"bo");
  806. $j++;
  807. $f[$i][$j]=mysql_result($result,$i,"intprodowner");
  808. $j++;
  809. $f[$i][$j]=mysql_result($result,$i,"billable");
  810. $j++;
  811. $f[$i][$j]=mysql_result($result,$i,"status");
  812. $j++;
  813. $f[$i][$j]=mysql_result($result,$i,"priority");
  814. $j++;
  815. $f[$i][$j]=mysql_result($result,$i,"ranking");
  816. $j++;
  817. $f[$i][$j]=mysql_result($result,$i,"team");
  818. $j++;
  819. $f[$i][$j]=mysql_result($result,$i,"estresearchhours");
  820. $j++;
  821. $f[$i][$j]=mysql_result($result,$i,"actualresearchhours");
  822. $j++;
  823. $f[$i][$j]=mysql_result($result,$i,"estdevhours");
  824. $j++;
  825. $f[$i][$j]=mysql_result($result,$i,"actualdevhours");
  826. $j++;
  827. $f[$i][$j]=mysql_result($result,$i,"estqahours");
  828. $j++;
  829. $f[$i][$j]=mysql_result($result,$i,"actualqahours");
  830. $j++;
  831. $f[$i][$j]=mysql_result($result,$i,"eststarton");
  832. $j++;
  833. $f[$i][$j]=mysql_result($result,$i,"actualstarton");
  834. $j++;
  835. $f[$i][$j]=mysql_result($result,$i,"estreadyforservice");
  836. $j++;
  837. $f[$i][$j]=mysql_result($result,$i,"actualreadyforservice");
  838. $j++;
  839. $f[$i][$j]=mysql_result($result1,$i,"internalnotes");
  840. $j++;
  841. $f[$i][$j]=mysql_result($result1,$i,"statusnotes");
  842. $j++;
  843. $f[$i][$j]=mysql_result($result1,$i,"bocomments");
  844. $i++;
  845. }
  846. ?>
  847.  
  848.  
  849. <?php
  850. $i=0;
  851. while ($i < $num) {
  852.  
  853. ?>
  854.  
  855. <tr>
  856. <form method=post action='' name=f1>
  857.  
  858.  
  859. <td>
  860.  
  861. <a href="javascript:void(0);" NAME="History" title="History"
  862. onClick=window.open("getHistory_cnt.php?id=<?php echo $f[$i][0]; ?>","Ratting","width=650,height=300,left=150,top=200,toolbar=1,status=1,scrollbars=1");>History</a>
  863.  
  864.        
  865. </td>
  866.  
  867. </form>
  868. <td><?php echo htmlentities($f[$i][0]); ?></td>
  869. <td><?php echo htmlentities($f[$i][1]); ?></td>
  870. <td><?php echo htmlentities($f[$i][2]); ?></td>
  871. <td><?php echo htmlentities($f[$i][3]); ?></td>
  872. <td><?php echo htmlentities($f[$i][4]); ?></td>
  873. <td><?php echo htmlentities($f[$i][5]); ?></td>
  874. <td><?php echo htmlentities($f[$i][6]); ?></td>
  875. <td><?php echo htmlentities($f[$i][7]); ?></td>
  876. <td><?php echo htmlentities($f[$i][8]); ?></td>
  877. <td><?php echo htmlentities($f[$i][9]); ?></td>
  878. <td><?php echo htmlentities($f[$i][10]); ?></td>
  879. <td><?php echo htmlentities($f[$i][11]); ?></td>
  880. <td><?php echo htmlentities($f[$i][12]); ?></td>
  881. <td><?php echo htmlentities($f[$i][13]); ?></td>
  882. <td><?php echo htmlentities($f[$i][14]); ?></td>
  883. <td><?php echo htmlentities($f[$i][15]); ?></td>
  884. <td><?php echo htmlentities($f[$i][16]); ?></td>
  885. <td><?php echo htmlentities($f[$i][17]); ?></td>
  886. <td><?php echo htmlentities($f[$i][18]); ?></td>
  887. <td><?php echo htmlentities($f[$i][19]); ?></td>
  888. <td><?php echo htmlentities($f[$i][20]); ?></td>
  889.  
  890. <td>
  891.  
  892. <a href="javascript:void(0);" NAME="Internal Notes Window" title="Internal Notes"
  893. onClick=window.open("internal_notes_c1.php?id=<?php echo $f[$i][0]; ?>","Ratting","width=550,height=300,left=150,top=200,toolbar=1,status=1,scrollbars=1");>View</a>
  894. </td>
  895.  
  896.  
  897. <td>
  898. <a href="javascript:void(0);" NAME="Status Notes Window" title="Status Notes"
  899. onClick=window.open("status_notes_c1.php?id=<?php echo $f[$i][0]; ?>","Ratting","width=550,height=300,left=150,top=200,toolbar=1,status=1,scrollbars=1");>View</a>
  900. </td>
  901.  
  902. <td>
  903.  
  904. <a href="javascript:void(0);" NAME="BO Comments Window" title="BO Comments"
  905. onClick=window.open("bocomments_c1.php?id=<?php echo $f[$i][0]; ?>","Ratting","width=550,height=300,left=150,top=200,toolbar=1,status=1,scrollbars=1");>View</a>
  906. </td>
  907.  
  908.  
  909.  
  910. <td>
  911. <button class="edit" name="edit" value="edit" style="font-size:12px" id = "<?php echo htmlentities($f[$i][0])."+".htmlentities($f[$i][1])."+".htmlentities($f[$i][2])."+".htmlentities($f[$i][3])."+".htmlentities($f[$i][4])."+".htmlentities($f[$i][5])."+".htmlentities($f[$i][6])."+".htmlentities($f[$i][7])."+".htmlentities($f[$i][8])."+".htmlentities($f[$i][9])."+".htmlentities($f[$i][10])."+".htmlentities($f[$i][11])."+".htmlentities($f[$i][12])."+".htmlentities($f[$i][13])."+".htmlentities($f[$i][14])."+".htmlentities($f[$i][15])."+".htmlentities($f[$i][16])."+".htmlentities($f[$i][17])."+".htmlentities($f[$i][18])."+".htmlentities($f[$i][19])."+".htmlentities($f[$i][20])."+".$user;?>">Edit</button>
  912. </td>
  913.  
  914.  
  915. <td>
  916. <form method ="post">      
  917.         <input type=button value="Upload" onClick="window.open('uploads_c1/upload_file_form_c1_mult.php?id=<?php echo $f[$i][0]; ?>&first=<?php echo $first; ?>&last=<?php echo $last; ?>','Ratting','width=450,height=300,left=150,top=200,toolbar=1,status=1,')" style="width: 74px"/>
  918. </form>
  919.  
  920. <?php
  921.  
  922. //$query3="select * from hdq_report where ID='".$f[$i][0]."' and uploadname IS NULL";
  923.  
  924. //$result3=mysql_query($query3);
  925.  
  926. //echo mysql_num_rows($result3);
  927.  
  928.  
  929. //if(mysql_num_rows($result3)!=0)
  930. $dd="uploads_cnt/dir_cnt_".$f[$i][0];
  931. if(!is_dir($dd))
  932. {
  933. ?>
  934.  
  935. <b>No Attachments</b></td>
  936.  
  937. <?php
  938. }
  939. else
  940. {
  941.  
  942. ?>
  943.  
  944. <form method ="post">      
  945.         <input type=button value="Download" onClick="window.open('uploads_c1/download_upl_name.php?id=<?php echo $f[$i][0]; ?>','Ratting','width=1000,height=500,left=150,top=200,toolbar=1,status=1,scrollbars=1')" />
  946. </form>
  947. </td>
  948.  
  949. <?php
  950. }
  951. ?>
  952.  
  953.  
  954. </tr>
  955.  
  956. <?php
  957. $i++;
  958. }
  959. ?>
  960.  
  961. </table>
  962. </div>
  963. </div>
  964.  
  965. </body>
  966. </html>
  967. <?php
  968. }
  969. else
  970.  
  971. echo "You are not authorized to use this website. Try to obtain the necessary rights to use it!";
  972.  
  973. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement