Subversion Repositories php_library

Rev

Blame | Last modification | View Log | Download | RSS feed

<?php
   /* Modify the constants in the top; the rest of the page should work 
    * after that
    */
   /* these are constants */
   // e-mail address of OpenProject interface
   global $bugReport;
   $mailTo = $bugReport['mailto'];
   // this must contain the project name from OpenProject
   $project = $bugReport['project'];
   // list of components known by OpenProject
   $components = $bugReport['components'];
   // these must be trackers defined in your Redmine installation
   $tracker = $bugReport['tracker'];
   // and these are the priorities
   // Hint: you migh want to leave Urgent and Immediate not accessible
   $priority = $bugReport['priority'];
   /* 
    * this is the person reporting. They must be a valid login on 
    * your install unless you have anonymous users able to create
    * issues
    */
   $reporter = $bugReport['reporter'];
   // version number, if applicable
   $version = isset( $bugReport['version'] ) ? $bugReport['version'] : '';
   $summary = isset( $summary ) ? $summary : '';
   $from = isset( $from ) ? $from : '';
   $description = isset( $description ) ? $description : "Actions Taken\n==============\n\n" .
                  "n\nResults\n==============\n\n" . 
                  "n\nExpected Results\n==============\n\n";

   if ( isset( $_REQUEST['send'] ) ) {
      $component = $_REQUEST['component'];
      $summary = $_REQUEST['summary'];
      $message = 
         "Project: $project\n" . 
         "Tracker: $_REQUEST[tracker]\n" . 
         "Priority: $_REQUEST[priority]\n\n" . 
         "Reported by: $_REQUEST[from]\n" .
         $_REQUEST['description'];
      if ( ! isset( $reporter ) ) {
         $reporter = $_REQUEST['from'];
      }

      mail( $mailTo, "$_REQUEST[component]: $summary", $message, "From: $reporter" ); //array('From' => $reporter ) );
      $message = "Bug report submitted.";
   } else {
      $description = "Actions Taken\n==============\n\n" .
                  "n\nResults\n==============\n\n" . 
                  "n\nExpected Results\n==============\n\n";
   }

?>

      <b>Enter a bug report for</b> <br />
      <b><?php print $project; ?></b>
      <form method="post">
         <fieldset>
            <legend>Submit a Bug Report</legend>
            <div>
               <label for='component'>Component</label>
               <select name='component' required>
                  <?php
                     foreach ( $components as $component ) {
                        print "<option value='$component'>$component</option>";
                     }
                  ?>
               </select>
            </div>
            <div>
               <label for='tracker'>Request Type</label>
               <select name='tracker' required>
                  <?php
                     foreach ( $tracker as $trackers ) {
                        print "<option value='$trackers'>$trackers</option>";
                     }
                  ?>
               </select>
            </div>
            <div>
               <label for='priority'>Priority</label>
               <select name='priority' required>
                  <?php
                     foreach ( $priority as $priorities ) {
                        print "<option value='$priorities'>$priorities</option>";
                     }
                  ?>
               </select>
            </div>
            
            <div>
               <label for="summary">Summary</label>
               <input name='summary' type='text' <?php if ( $summary ) print "value='$summary'"; ?> required>
            </div>
            <div>
               <label for="from">Your E-Mail</label>
               <input name='from' type='email' <?php if ( $from ) print "value='$from'"; ?> required>
            </div>

            <div>
               <label for="description">Details</label>
               <textarea cols='50' rows='10' name='description' <?php if ( $description ) print "value='$description'"; ?> required></textarea>
            </div>
            <div>
               <input name='send' type='submit' value='Send'>
            </div>
            
         </fieldset>
      </form>