Fix exception reporting.

- Repariert: Fehlerberichte konnten nicht gesendet werden.
This commit is contained in:
daniel 2017-09-18 21:19:49 +02:00
parent 08bd137e94
commit 443a6b48e7
10 changed files with 67 additions and 64 deletions

View File

@ -49,11 +49,11 @@
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
</Reference> </Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.4.3\lib\net40\NLog.dll</HintPath> <HintPath>..\packages\NLog.4.4.12\lib\net40\NLog.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net40\nunit.framework.dll</HintPath> <HintPath>..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />

View File

@ -2,7 +2,7 @@
<packages> <packages>
<package id="Bovender" version="0.17.0.0" targetFramework="net40" /> <package id="Bovender" version="0.17.0.0" targetFramework="net40" />
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" /> <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
<package id="NLog" version="4.4.3" targetFramework="net40" /> <package id="NLog" version="4.4.12" targetFramework="net40" />
<package id="NUnit" version="3.6.1" targetFramework="net40" /> <package id="NUnit" version="3.8.1" targetFramework="net40" />
<package id="YamlDotNet.Signed" version="4.1.0" targetFramework="net40" /> <package id="YamlDotNet.Signed" version="4.2.1" targetFramework="net40" />
</packages> </packages>

View File

@ -1,53 +1,52 @@
<?php <?php
require(__DIR__ . '/PHPMailer/PHPMailerAutoload.php'); function sendMail() {
$reportId = $_POST['report_id']; $to = 'dk@doktorkraus.de';
$mail = new PHPMailer; $headers = "From: \"zaaReloaded\" <dk@doktorkraus.de>";
$mail->isSMTP(); $reportId = $_POST['report_id'];
$mail->SMTPAuth = true; $info = print_r( $_POST, true ); // this will be a string, not an array!
$mail->Host = 'nephrowiki.de'; $body = <<<EOF
$mail->Username = 'zaareloaded@nephrowiki.de'; zaaReloaded hat einen Fehler ausgelöst.
$mail->Password = 'ooZ1eiJa';
// $mail->SMTPSecure = 'tls';
$mail->Port = 25;
$mail->From = 'zaareloaded@nephrowiki.de'; -----
$mail->FromName = 'zaaReloaded';
$mail->addAddress('dk@doktorkraus.de');
$mail->Subject = "[zaaReloaded] Exception $reportId";
if ( $_POST['ccUser'] ) { Benutzerkommentar:
$validMail = filter_var( $_POST['usersMail'], FILTER_VALIDATE_EMAIL );
$validUser = filter_var( $_POST['usersName'], FILTER_SANITIZE_STRING );
if ( $validUser ) {
$validUser = "\"$validUser\" "; // space character deliberately placed
};
if ( $validMail ) {
$mail->addCC($validMail, $validUser);
};
};
$info = print_r( $_POST, true );
$mail->Body = <<<EOF
zaaReloaded exception
User's comment on submission:
{$_POST['comment']} {$_POST['comment']}
*** -----
Technical details: $info Technische Info: $info
-- --
http://zaa.nephrowiki.de www.doktorkraus.de/zaareloaded
EOF; EOF;
if ($mail->send()) if ( $_POST['ccUser'] ) {
{ $validMail = filter_var( $_POST['usersMail'], FILTER_VALIDATE_EMAIL );
// Must return the report ID to indicate success $validUser = filter_var( $_POST['usersName'], FILTER_SANITIZE_STRING );
echo($reportId); if ( $validUser ) {
$validUser = "\"$validUser\" "; // space character deliberately placed
};
if ( $validMail ) {
$headers .= "\r\nCc: $validUser<$validMail>";
};
};
mail($to, "Exception report [$reportId]", $body, $headers);
} }
else
{ // =============================================================
echo($mail->ErrorInfo); // Begin main script
// =============================================================
if (!isset($_POST['report_id'])) {
http_response_code(400);
exit;
} }
sendMail();
// Return the report ID and the issue URL to signal all is well.
$reportId = $_POST['report_id'];
$load = "{\"ReportId\": \"$reportId\", \"IssueUrl\": \"https://www.doktorkraus.de/zaareloaded\"}";
error_log( __FILE__ . ": Load = $load" );
header('Content-Type: application/json');
echo $load;

View File

@ -83,7 +83,7 @@ namespace zaaReloaded2.ExceptionHandler
protected override string DevPath() protected override string DevPath()
{ {
return @"x:\Code\zaaReloaded2\zaaReloaded2\"; return @"x:\\Code\\zaaReloaded2\\zaaReloaded2\\";
} }
protected override Bovender.UserSettings.UserSettingsBase UserSettings protected override Bovender.UserSettings.UserSettingsBase UserSettings

View File

@ -34,12 +34,12 @@ namespace zaaReloaded2.ExceptionHandler
{ {
protected override Window CreateSuccessWindow() protected override Window CreateSuccessWindow()
{ {
return Content.InjectInto<SubmissionSuccessView>(); return new SubmissionSuccessView();
} }
protected override Window CreateFailureWindow() protected override Window CreateFailureWindow()
{ {
return Content.InjectInto<SubmissionFailureView>(); return new SubmissionFailureView();
} }
protected override Window CreateCancelledWindow() protected override Window CreateCancelledWindow()

View File

@ -21,14 +21,14 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="clr-namespace:zaaReloaded2" xmlns:l="clr-namespace:zaaReloaded2"
SizeToContent="WidthAndHeight" SizeToContent="Height" Width="540"
Title="Fehlerbericht versenden" Title="Fehlerbericht versenden"
> >
<Window.Resources> <Window.Resources>
<ResourceDictionary Source="/Bovender;component/Style.xaml" /> <ResourceDictionary Source="/Bovender;component/Style.xaml" />
</Window.Resources> </Window.Resources>
<StackPanel Margin="10" Orientation="Horizontal"> <DockPanel Margin="10">
<TextBlock FontSize="72" FontWeight="Bold" Foreground="Red" Margin="0,0,10,0" <TextBlock DockPanel.Dock="Left" FontSize="72" FontWeight="Bold" Foreground="Red" Margin="0,0,10,0"
LineHeight="48" LineStackingStrategy="BlockLineHeight"> LineHeight="48" LineStackingStrategy="BlockLineHeight">
&#x00d7; &#x00d7;
<TextBlock.Effect> <TextBlock.Effect>
@ -36,11 +36,13 @@
</TextBlock.Effect> </TextBlock.Effect>
</TextBlock> </TextBlock>
<StackPanel> <StackPanel>
<TextBlock Text="Beim Senden des Fehlerberichtes ist wiederum leider ein Fehler aufgetreten... (Funktioniert das Netzwerk?)" /> <TextBlock TextWrapping="Wrap"
<TextBlock Text="{Binding Exception}" Margin="0,10,0,0" Foreground="LightSlateGray" /> Text="Beim Senden des Fehlerberichtes ist wiederum leider ein Fehler aufgetreten... (Funktioniert das Netzwerk?)" />
<TextBlock TextWrapping="Wrap"
Text="{Binding Exception}" Margin="0,10,0,0" Foreground="LightSlateGray" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
<Button Command="{Binding CloseViewCommand}" Content="Schließen" /> <Button Command="{Binding CloseViewCommand}" Content="Schließen" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </DockPanel>
</Window> </Window>

View File

@ -28,7 +28,7 @@ namespace zaaReloaded2.ExceptionHandler
{ {
protected override System.Windows.Window CreateView() protected override System.Windows.Window CreateView()
{ {
return Content.InjectInto<SubmissionProcessView>(); return new SubmissionProcessView();
} }
} }
} }

View File

@ -21,14 +21,15 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="clr-namespace:zaaReloaded2" xmlns:l="clr-namespace:zaaReloaded2"
SizeToContent="WidthAndHeight" SizeToContent="Height" Width="400"
Title="Fehlerbericht versenden" Title="Fehlerbericht versenden"
> >
<Window.Resources> <Window.Resources>
<ResourceDictionary Source="/Bovender;component/Style.xaml" /> <ResourceDictionary Source="/Bovender;component/Style.xaml" />
</Window.Resources> </Window.Resources>
<StackPanel Margin="10" Orientation="Horizontal"> <DockPanel Margin="10">
<TextBlock FontSize="48" FontWeight="Bold" Foreground="GreenYellow" Margin="0,0,10,0" <TextBlock DockPanel.Dock="Left"
FontSize="48" FontWeight="Bold" Foreground="GreenYellow" Margin="0,0,10,0"
LineHeight="48" LineStackingStrategy="BlockLineHeight"> LineHeight="48" LineStackingStrategy="BlockLineHeight">
&#x2714; &#x2714;
<TextBlock.Effect> <TextBlock.Effect>
@ -36,10 +37,10 @@
</TextBlock.Effect> </TextBlock.Effect>
</TextBlock> </TextBlock>
<StackPanel> <StackPanel>
<TextBlock Text="Der Fehlerbericht wurde erfolgreich versandt." /> <TextBlock TextWrapping="Wrap" Text="Der Fehlerbericht wurde erfolgreich versandt." />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 10 0 0"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 10 0 0">
<Button Command="{Binding CloseViewCommand}" Content="Schließen" /> <Button Command="{Binding CloseViewCommand}" Content="Schließen" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </DockPanel>
</Window> </Window>

View File

@ -21,6 +21,6 @@
<packages> <packages>
<package id="Bovender" version="0.17.0.0" targetFramework="net40" /> <package id="Bovender" version="0.17.0.0" targetFramework="net40" />
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" /> <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
<package id="NLog" version="4.4.3" targetFramework="net40" />
<package id="YamlDotNet.Signed" version="4.1.0" targetFramework="net40" /> <package id="YamlDotNet.Signed" version="4.1.0" targetFramework="net40" />
<package id="NLog" version="4.4.12" targetFramework="net40" />
</packages> </packages>

View File

@ -140,7 +140,7 @@
</Reference> </Reference>
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> <Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.4.3\lib\net40\NLog.dll</HintPath> <HintPath>..\packages\NLog.4.4.12\lib\net40\NLog.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
@ -235,6 +235,7 @@
<Compile Include="Formatter\DanielsStyle.cs" /> <Compile Include="Formatter\DanielsStyle.cs" />
<Compile Include="Formatter\DocumentWriter.cs" /> <Compile Include="Formatter\DocumentWriter.cs" />
<Compile Include="Formatter\NoLaboratoryDataException.cs" /> <Compile Include="Formatter\NoLaboratoryDataException.cs" />
<Compile Include="Importer\ImportMode.cs" />
<Compile Include="LogFile.cs" /> <Compile Include="LogFile.cs" />
<Compile Include="Medication\Formatter.cs" /> <Compile Include="Medication\Formatter.cs" />
<Compile Include="Medication\Importer.cs" /> <Compile Include="Medication\Importer.cs" />