Browse Source

added code fore log submission, still testing

Thomas Thümmler 1 year ago
parent
commit
92b5e71bbd
1 changed files with 16 additions and 0 deletions
  1. 16 0
      patchpanel/index.php

+ 16 - 0
patchpanel/index.php

@@ -193,6 +193,22 @@
             }
         }
 
+        // submit message to elog (currently main spec elog)
+
+        if (isset($_POST["elog"])) {
+            sleep(1);
+	
+    	    // apache web server runs on UTF-8, but elog runs on ISO 8859-1, so all stings posted to the elog need to be converted via utf8_decode();
+        	$ElogAuthor = utf8_decode($author); 
+        	$ElogConfig = utf8_decode($config);
+        	$ElogTime = utf8_decode(date('Y-m-d H:i:s', $time));
+            $ElogEntry = 'Patch panel changed to ' . $ElogConfig . ' on ' . $ElogTime; 
+           
+            $ToBeExec = 'echo "' . $ElogEntry . '" | elog -h localhost -p 8080 -l main-spectrometer -v -u sds-operator mainspec.13 -a Author="' . $ElogAuthor . '" -a Email=katrin-sds-status@lists.kit.edu -a Type=Routine -a Category=General -a Subject="' . $ElogConfig . '" -x -n 2'; 
+          
+			shell_exec($ToBeExec);
+        }
+      
 	}
 
 ?>