Advertisement
Guest User

admin_c1.php

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