From 83cf190da48f7685a229e44209047f52b58cd68a Mon Sep 17 00:00:00 2001
From: Aria <aria@suma-ev.de>
Date: Mon, 14 Aug 2017 11:43:27 +0200
Subject: [PATCH] Text felder der zuletzt veraenderten Dateien werden
 eingefaerbt

---
 app/Http/Controllers/LanguageController.php  | 11 +++++++++--
 app/Models/LanguageObject.php                |  2 +-
 resources/views/languages/synoptic.blade.php | 12 +++++++++---
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/app/Http/Controllers/LanguageController.php b/app/Http/Controllers/LanguageController.php
index 850e81938..c2a51cf4f 100644
--- a/app/Http/Controllers/LanguageController.php
+++ b/app/Http/Controllers/LanguageController.php
@@ -190,11 +190,17 @@ class LanguageController extends Controller
         }
 
         $snippets = [];
+        $changeTime = 0;
+        $recentlyChangedFiles = [];
 
         # Speichere den Inhalt der ausgewählten Datei in allen Sprachen in $snippets ab
         foreach($languageObjects as $folder => $languageObject) {
             foreach($languageObject->stringMap as $languageFileName => $languageFile) {
                 if($languageFileName === $fn) {
+                    if($changeTime <= filemtime($languageObject->filePath."/".$languageFileName)) {
+                        $changeTime = filemtime($languageObject->filePath."/".$languageFileName);
+                        $recentlyChangedFiles[] = $languageObject->language; 
+                    }
                     foreach($languageFile as $key => $value) {
                         $snippets[$key][$languageObject->language] = $value;      
                     }
@@ -203,7 +209,7 @@ class LanguageController extends Controller
             }
         }
 
-        # Fülle $snippets auf mit leeren Einträgen für übrige Sprachen
+        # Fülle $snippets auf mit leeren Einträgen für die restlichen Sprachen
         foreach($to as $t) {
             foreach($snippets as $key => $langArray) {
                 if(!isset($langArray[$t])) {
@@ -211,11 +217,12 @@ class LanguageController extends Controller
                 }
             }
         }
-
+        
         return view('languages.synoptic')
             ->with('to', $to)           # Alle vorhandenen Sprachen
             ->with('texts', $snippets)         # Array mit Sprachsnippets
             ->with('filename', $fn)     # Name der Datei
+            ->with('recentlyChangedFiles', $recentlyChangedFiles)
             ->with('title', trans('titles.languages.edit'));
     }
 
diff --git a/app/Models/LanguageObject.php b/app/Models/LanguageObject.php
index bd8c6e49a..93235dc8e 100644
--- a/app/Models/LanguageObject.php
+++ b/app/Models/LanguageObject.php
@@ -11,7 +11,7 @@ class LanguageObject
 
 	public $filePath = "";
 
-	#2D-Array der Form [$filename][$key]
+	# 2D-Array der Form [$filename][$key]
 	public $stringMap = [];
 
 	public function __construct($lang, $path) 
diff --git a/resources/views/languages/synoptic.blade.php b/resources/views/languages/synoptic.blade.php
index 70b2bedef..492884d50 100644
--- a/resources/views/languages/synoptic.blade.php
+++ b/resources/views/languages/synoptic.blade.php
@@ -32,9 +32,15 @@
 				<td class="name language-name">{{$key}}</td>
 				@foreach($language as $lang => $languageValue)
 					@if($languageValue !== "")
-						<td>
-							<textarea class="language-text-area" rows="1" cols="20" form="submit" name="{{base64_encode($lang."_".$key)}}">{{$languageValue}}</textarea>
-						</td>
+						@if(in_array($lang, $recentlyChangedFiles))
+							<td>
+								<textarea class="language-text-area" rows="1" cols="20" style="background-color: Khaki;" form="submit" name="{{base64_encode($lang."_".$key)}}">{{$languageValue}}</textarea>
+							</td>
+						@else
+							<td>
+								<textarea class="language-text-area" rows="1" cols="20" form="submit" name="{{base64_encode($lang."_".$key)}}">{{$languageValue}}</textarea>
+							</td>
+						@endif
 					@else
 						<td>
 							<textarea class="language-text-area" rows="1" cols="20" form="submit" name="{{base64_encode("_new_".$lang."_".$key)}}"></textarea>
-- 
GitLab