Index: /changelog
===================================================================
--- /changelog	(revision 6675)
+++ /changelog	(revision 6677)
@@ -12,5 +12,8 @@
 
 #4.0.0
-- Bug - Rechtschreibfehler
+- Bugfix - Rechtschreibfehler
 - Bugfix - Bestellverwaltung FÃŒllmenge nicht in WPSG_TBL_ORDERPRODUCT
 - Buffix - PayPal nimmt jezt Daten aus der Versandadresse (shipping_address) und nicht mehr die Rechnungsadresse (billing_address)
+- Feature - Produktname in Produktverwaltung
+- Feature - Anzeige von angepassten Templates auf der "Ãber" Seite (Wenn Userviews aktiv)
+- Feature - Produkttemplates werden jetzt auch im Child Theme gesucht und verwendet
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 6675)
+++ /controller/wpsg_ShopController.class.php	(revision 6677)
@@ -1352,13 +1352,13 @@
 
 			// Das Template im UserView suchen
-			$template_file_uv = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_UV, $template_file);
-			$template_file_uv_old = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_UV_OLD, $template_file);
-			$template_file_theme = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_TV, $template_file);
 			$template_file_child_theme = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_CTV, $template_file);
-
-			if (file_exists($template_file_theme) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_theme;
-			if (file_exists($template_file_child_theme) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_child_theme;
-			if (file_exists($template_file_uv_old) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_uv_old;
-			if (file_exists($template_file_uv) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_uv;
+            $template_file_theme = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_TV, $template_file);
+            $template_file_uv = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_UV, $template_file);
+            $template_file_uv_old = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_UV_OLD, $template_file);
+
+            if (file_exists($template_file_child_theme) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_child_theme;
+			else if (file_exists($template_file_theme) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_theme;
+			else if (file_exists($template_file_uv) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_uv;
+			else if (file_exists($template_file_uv_old) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_uv_old;
 
 			if (!is_file($template_file)) { wpsg_debug(wpsg_translate(__('Das Template (#1#) fÃŒr ein Produkt (ID:#2#) scheint nicht zu existieren!', 'wpsg'), $template_file, $produkt_id)); return; }
@@ -1823,5 +1823,5 @@
 		 * LÃ€dt die verfÃŒgbaren Produkttemplates
 		 */
-		public function loadProduktTemplates($key = false)
+		public function loadProduktTemplates($key = false, $fullpath = false, $view_path = false)
 		{
 
@@ -1831,15 +1831,16 @@
 			if ($handle) { while ($file = readdir($handle))
 			{
+
 				if (is_file(WPSG_PATH_PRODUKTTEMPLATES.$file) && preg_match('/(.*).phtml$/', $file))
 				{
-					if ($key)
-					{
-						$arTemplates[$file] = $file;
-					}
-					else
-					{
-						$arTemplates[] = $file;
-					}
-				}
+
+				    if ($fullpath && $view_path) $file = WPSG_PATH_PRODUKTTEMPLATES.$file;
+                    else if ($fullpath) $file = WPSG_PATH_PRODUKTTEMPLATES.$file;
+
+					if ($key) $arTemplates[$file] = $file;
+					else $arTemplates[] = $file;
+
+				}
+
 			} }
 			@closedir($handle);
@@ -1848,14 +1849,14 @@
 			if ($handle) { while ($file = readdir($handle))
 			{
+
 				if (is_file(WPSG_PATH_PRODUKTTEMPLATES_UV.$file) && preg_match('/(.*).phtml$/', $file) && !in_array($file, $arTemplates))
 				{
-					if ($key)
-					{
-						$arTemplates[$file] = $file;
-					}
-					else
-					{
-						$arTemplates[] = $file;
-					}
+
+                    if ($fullpath && $view_path) $file = WPSG_PATH_PRODUKTTEMPLATES.$file;
+                    else if ($fullpath) $file = WPSG_PATH_PRODUKTTEMPLATES_UV.$file;
+
+					if ($key) $arTemplates[$file] = $file;
+					else $arTemplates[] = $file;
+
 				}
 			} }
@@ -1867,13 +1868,13 @@
 				if (is_file(WPSG_PATH_PRODUKTTEMPLATES_UV_OLD.$file) && preg_match('/(.*).phtml$/', $file) && !in_array($file, $arTemplates))
 				{
-					if ($key)
-					{
-						$arTemplates[$file] = $file;
-					}
-					else
-					{
-						$arTemplates[] = $file;
-					}
-				}
+
+                    if ($fullpath && $view_path) $file = WPSG_PATH_PRODUKTTEMPLATES.$file;
+                    else if ($fullpath) $file = WPSG_PATH_PRODUKTTEMPLATES_UV_OLD.$file;
+
+					if ($key) $arTemplates[$file] = $file;
+					else $arTemplates[] = $file;
+
+				}
+
 			} }
 			@closedir($handle);
@@ -1882,17 +1883,36 @@
 			if ($handle) { while ($file = readdir($handle))
 			{
+
 				if (is_file(WPSG_PATH_PRODUKTTEMPLATES_TV.$file) && preg_match('/(.*).phtml$/', $file) && !in_array($file, $arTemplates))
 				{
-					if ($key)
-					{
-						$arTemplates[$file] = $file;
-					}
-					else
-					{
-						$arTemplates[] = $file;
-					}
-				}
+
+                    if ($fullpath && $view_path) $file = WPSG_PATH_PRODUKTTEMPLATES.$file;
+                    else if ($fullpath) $file = WPSG_PATH_PRODUKTTEMPLATES_TV.$file;
+
+					if ($key) $arTemplates[$file] = $file;
+					else $arTemplates[] = $file;
+
+				}
+
 			} }
 			@closedir($handle);
+
+            $handle = @opendir(WPSG_PATH_PRODUKTTEMPLATES_CTV);
+            if ($handle) { while ($file = readdir($handle))
+            {
+
+                if (is_file(WPSG_PATH_PRODUKTTEMPLATES_CTV.$file) && preg_match('/(.*).phtml$/', $file) && !in_array($file, $arTemplates))
+                {
+
+                    if ($fullpath && $view_path) $file = WPSG_PATH_PRODUKTTEMPLATES.$file;
+                    else if ($fullpath) $file = WPSG_PATH_PRODUKTTEMPLATES_CTV.$file;
+
+                    if ($key) $arTemplates[$file] = $file;
+                    else $arTemplates[] = $file;
+
+                }
+
+            } }
+            @closedir($handle);
 
 			return $arTemplates;
Index: /controller/wpsg_SystemController.class.php
===================================================================
--- /controller/wpsg_SystemController.class.php	(revision 6675)
+++ /controller/wpsg_SystemController.class.php	(revision 6677)
@@ -195,4 +195,7 @@
             if (@array_key_exists($message_key, (array)$_SESSION['wpsg']['backendError'])) return;
 
+            if (substr($message, 0, 7) === 'nohspc_') $message = substr($message, 7);
+            else $message = wpsg_hspc($message);
+
             $message = '
                 <div id="message" class="notice notice-success">
@@ -485,17 +488,24 @@
 		public function getRessourceURL($path)
 		{
-			
-			if (file_exists(WPSG_PATH_USERVIEW.$path) && $this->get_option('wpsg_ignoreuserview') != '1')
+
+            if (file_exists(WPSG_PATH_CHILD_TEMPLATEVIEW.$path) && $this->get_option('wpsg_ignoreuserview') != '1')
+            {
+
+                // Datei existiert im UserView
+                $url = get_stylesheet_directory_uri().'/wpsg_views/'.$path;
+
+            }
+            else if (file_exists(WPSG_PATH_TEMPLATEVIEW.'/'.$path) && $this->get_option('wpsg_ignoreuserview') != '1')
+            {
+
+                // Datei existiert im Template
+                $url = get_template_directory_uri().'/wpsg_views/'.$path;
+
+            }
+			else if (file_exists(WPSG_PATH_USERVIEW.$path) && $this->get_option('wpsg_ignoreuserview') != '1')
 			{
 				
 				// Datei existiert im UserView
 				$url = WPSG_URL_USERVIEW.$path;
-				
-			}
-			else if (file_exists(WPSG_PATH_TEMPLATEVIEW.'/'.$path) && $this->get_option('wpsg_ignoreuserview') != '1')
-			{
-				
-				// Datei existiert im Template
-				$url = get_template_directory_uri().'/wpsg_views/'.$path;
 				
 			}
@@ -582,5 +592,28 @@
 			
 		} // public function getRessourceURL($path)
-		
+
+        public function getTemplatefile($file)
+        {
+
+            // Da die views jetzt im Pluginverzeichnis liegen suche ich den (.*)view Teil
+            $path_view = preg_replace('/\/views\/(.*)/', '', $file).'/views/';
+
+            // Datei im UserView
+            $uv_file = str_replace($path_view, WPSG_PATH_USERVIEW, $file);
+            $uv_old_file = str_replace($path_view, WPSG_PATH_USERVIEW_OLD, $file);
+            $theme_file = str_replace($path_view, WPSG_PATH_TEMPLATEVIEW, $file);
+            $child_theme_file = str_replace($path_view, WPSG_PATH_CHILD_TEMPLATEVIEW, $file);
+
+            if (file_exists($child_theme_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $child_theme_file;
+            else if (file_exists($theme_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $theme_file;
+            else if (file_exists($uv_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $uv_file;
+            else if (file_exists($uv_old_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $uv_old_file;
+            else if (file_exists($file)) $render_file = $file;
+            else throw new \wpsg\Exception(wpsg_translate(__('Template (#1#) Datei nicht gefunden', 'wpsg'), $file), \wpsg\Exception::TYP_UNEXPECTED);
+
+            return $render_file;
+
+        }
+
 		/**
 		 * Zeigt eine Template Datei an
@@ -590,28 +623,11 @@
 
 			$this->arTemplateStack[] = preg_replace('/(.*)\//', '', $file);
-			
-			// Da die views jetzt im Pluginverzeichnis liegen suche ich den (.*)view Teil
-			$path_view = preg_replace('/\/views\/(.*)/', '', $file).'/views/';
-						
-			// Datei im UserView
-			$uv_file = str_replace($path_view, WPSG_PATH_USERVIEW, $file);
-			$uv_old_file = str_replace($path_view, WPSG_PATH_USERVIEW_OLD, $file);
-			$theme_file = str_replace($path_view, WPSG_PATH_TEMPLATEVIEW, $file);
-			$child_theme_file = str_replace($path_view, WPSG_PATH_CHILD_TEMPLATEVIEW, $file);
-						
+
 			if (!$out) { ob_start(); }
 			
 			if (sizeof($this->arTemplateStack) == 1 && $this->get_option('wpsg_autoraw') === '1' && !is_admin() && !$this->bShortcode) echo '[raw]';
-			
-			if (file_exists($uv_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $uv_file;				
-			else if (file_exists($child_theme_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $child_theme_file;
-			else if (file_exists($theme_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $theme_file;
-			else if (file_exists($uv_old_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $uv_old_file;
-			else if (file_exists($file)) $render_file = $file;
-			else
-			{
-				die(wpsg_translate(__("Templatedatei existiert nicht (#1#) !", 'wpsg'), $file));
-			}
-			
+
+            $render_file = $this->getTemplatefile($file);
+
 			if ($this->get_option('wpsg_displayTemplatesLog') > 0) wpsg_debug_console($this->clearPathForDebug($render_file));
 			
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 6675)
+++ /lib/functions.inc.php	(revision 6677)
@@ -92,5 +92,21 @@
 		else return is_admin();
 
-	}
+	} // function wpsg_is_admin()
+
+    function wpsg_rglob($pattern, $flags = 0)
+    {
+
+        $arFiles = glob($pattern, $flags);
+
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir)
+        {
+
+            $arFiles = array_merge($arFiles, wpsg_rglob($dir.'/'.basename($pattern), $flags));
+
+        }
+
+        return $arFiles;
+
+    }
 
 	/**
Index: /views/admin/ueber.phtml
===================================================================
--- /views/admin/ueber.phtml	(revision 6675)
+++ /views/admin/ueber.phtml	(revision 6677)
@@ -82,61 +82,39 @@
 
 	<div class="form-horizontal">
+
 		<?php wpsg_drawForm_TextStart(); ?>
 		<?php echo WPSG_PATH_USERVIEW; ?>
-
 		<?php echo wpsg_drawForm_TextEnd(__('Template Pfad fÃŒr Anpassungen', 'wpsg')); ?>
 
 		<?php wpsg_drawForm_TextStart(); ?>
 		<?php echo WPSG_PATH_TRANSLATION; ?>
+		<?php echo wpsg_drawForm_TextEnd(__('Sprachdatei', 'wpsg')); ?>
 
-		<?php echo wpsg_drawForm_TextEnd(__('Sprachdatei', 'wpsg')); ?>
+		<?php if ($this->get_option('wpsg_ignoreuserview') != '1') { ?>
+
+			<?php $arProductTemplates = $this->loadProduktTemplates(false, true, true); ?>
+
+			<?php $arFiles = wpsg_rglob(WPSG_PATH_VIEW.'*'); $arFiles = array_merge($arFiles, $arProductTemplates); ?>
+			<?php foreach ($arFiles as $k => $f) { $render_file = realpath($this->getTemplatefile($f)); if (!is_file($render_file) || realpath($f) == $render_file) { unset($arFiles[$k]); } else { $arFiles[$k] = $render_file; } } $arFiles = array_unique($arFiles); asort($arFiles); ?>
+
+			<?php if (wpsg_isSizedArray($arFiles)) { ?>
+				<div class="form-group-sm form-group">
+					<div class="form-control-static">
+
+						<label style="font-weight:bold;"><?php echo __('Angepasste Templates', 'wpsg'); ?></label><br /><br />
+
+						<?php foreach($arFiles as $render_file) { ?>
+
+							<?php echo str_replace(realpath(WPSG_PATH_WP), '', $render_file); ?><br />
+
+						<?php } ?>
+
+					</div>
+				</div>
+			<?php } ?>
+
+		<?php } ?>
+
 	</div>
-
-	<div class="form-horizontal">
-		<?php
-
-		function iterateDir($sPath)
-		{
-			$aRes = array();
-			$pathuv = str_replace('\\', '/', WPSG_PATH_USERVIEW);
-			foreach(new DirectoryIterator($sPath) as $oItem)
-			{
-				if($oItem->isDir())
-				{
-					//(!$oItem->isDot() ? $aRes[$oItem->getFilename()] = iterateDir($oItem->getPathname()):0);
-					if (!$oItem->isDot()) {
-						$aResx = iterateDir($oItem->getPathname());
-						$aRes = array_merge($aRes, $aResx);
-					}
-					continue;
-				}
-				//$aRes[] = $oItem->getFilename();
-				$aRes[] = str_replace($pathuv, '', str_replace('\\', '/', $oItem->getPathname()));
-			}
-			return $aRes;
-		}
-
-		echo wpsg_drawForm_TextStart();
-
-		if (file_exists(WPSG_PATH_USERVIEW) && is_dir(WPSG_PATH_USERVIEW))
-		{
-
-			$arDir = iterateDir(WPSG_PATH_USERVIEW);
-
-			$sd = ''; foreach ($arDir as $k => $d) $sd .= $d.'<br />';
-
-			echo $sd;
-
-		}
-		else
-		{
-
-			echo WPSG_PATH_USERVIEW;
-
-		}
-
-		echo wpsg_drawForm_TextEnd(__('User-Views', 'wpsg'));
-
-		?>
 
 
Index: /views/css/admin.css
===================================================================
--- /views/css/admin.css	(revision 6675)
+++ /views/css/admin.css	(revision 6677)
@@ -192,4 +192,5 @@
 .wpsg_productview_backend-sold-out { color:#dc3232; font-weight:700; }
 .wpsg_productview_backend-available { color:#7ad03a; font-weight:700; float:left; margin-right:5px; }
+.wpsg_top_productname { line-height:50px; margin-left:15px; }
 
 /* Bewertung */
Index: /views/produkt/addedit.phtml
===================================================================
--- /views/produkt/addedit.phtml	(revision 6675)
+++ /views/produkt/addedit.phtml	(revision 6677)
@@ -19,4 +19,7 @@
 					<li role="presentation" class="active"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt"><?php echo __("ProduktÃŒbersicht", "wpsg"); ?></a></li>
 					<li role="presentation" class="wpsg_showhide_filter active"><a href="#" onclick="return false;"><?php echo __("Produkte anlegen/bearbeiten", "wpsg"); ?></a></li>
+					<li role="presentation" class="wpsg_top_productname">
+						<?php echo $this->view['oProduct']->getProductName(); ?>
+					</li>
 				</ul>
 			</div>
