From aad52cb50827f8d33c8ae6209a4c24120516177d Mon Sep 17 00:00:00 2001
From: Eugene <eugene.wd@gmail.com>
Date: Thu, 18 May 2017 13:36:56 +0300
Subject: [PATCH] Wunderadmin: Moved generated css to media.

---
 .../Nwdthemes/Wunderadmin/Helper/Data.php          |  2 +-
 .../Adminhtml/WunderadminController.php            | 10 ++---
 .../adminhtml/default/wunderadmin/layout/local.xml |  1 -
 .../wunderadmin/template/forgotpassword.phtml      |  2 +-
 .../default/wunderadmin/template/login.phtml       |  2 +-
 .../default/wunderadmin/template/page/head.phtml   | 47 ++++++++++++++++++++++
 6 files changed, 55 insertions(+), 9 deletions(-)
 create mode 100644 Wunderadmin/app/design/adminhtml/default/wunderadmin/template/page/head.phtml

diff --git a/Wunderadmin/app/code/community/Nwdthemes/Wunderadmin/Helper/Data.php b/Wunderadmin/app/code/community/Nwdthemes/Wunderadmin/Helper/Data.php
index 2e4d4d6..8326e1e 100644
--- a/Wunderadmin/app/code/community/Nwdthemes/Wunderadmin/Helper/Data.php
+++ b/Wunderadmin/app/code/community/Nwdthemes/Wunderadmin/Helper/Data.php
@@ -27,7 +27,7 @@ class Nwdthemes_Wunderadmin_Helper_Data extends Mage_Core_Helper_Abstract {
 	 */
 
 	public function getSettingsCss() {
-		return 'css/settings_' . $this->getWunderStyle('timestamp') . '.css';
+		return 'wunderadmin/css/settings_' . $this->getWunderStyle('timestamp') . '.css';
 	}
 
 	/**
diff --git a/Wunderadmin/app/code/community/Nwdthemes/Wunderadmin/controllers/Adminhtml/WunderadminController.php b/Wunderadmin/app/code/community/Nwdthemes/Wunderadmin/controllers/Adminhtml/WunderadminController.php
index 12c71f3..13c15fa 100644
--- a/Wunderadmin/app/code/community/Nwdthemes/Wunderadmin/controllers/Adminhtml/WunderadminController.php
+++ b/Wunderadmin/app/code/community/Nwdthemes/Wunderadmin/controllers/Adminhtml/WunderadminController.php
@@ -12,7 +12,7 @@
 
 class Nwdthemes_Wunderadmin_Adminhtml_WunderadminController extends Mage_Adminhtml_Controller_Action {
 
-	const CSS_PATH = '/adminhtml/default/wunderadmin/css';
+	const CSS_PATH = '/wunderadmin/css';
 
 	/**
 	 * Check permissions
@@ -54,7 +54,7 @@ class Nwdthemes_Wunderadmin_Adminhtml_WunderadminController extends Mage_Adminht
 
 	public function indexAction() {
 
-		$_cssPath = Mage::getBaseDir('skin') . self::CSS_PATH;
+		$_cssPath = Mage::getBaseDir('media') . self::CSS_PATH;
 		if (! $this->_checkCssWritable($_cssPath) )
 		{
 			Mage::getSingleton('adminhtml/session')->addError( Mage::helper('wunderadmin')->__('Not able to write CSS file. Please make this folder writable: ') . $_cssPath);
@@ -84,7 +84,7 @@ class Nwdthemes_Wunderadmin_Adminhtml_WunderadminController extends Mage_Adminht
 		
 		if ($data = $this->getRequest()->getPost())
 		{
-			if ( ! $this->_checkCssWritable(Mage::getBaseDir('skin') . self::CSS_PATH) )
+			if ( ! $this->_checkCssWritable(Mage::getBaseDir('media') . self::CSS_PATH) )
 			{
 				Mage::getSingleton('adminhtml/session')->addError( Mage::helper('wunderadmin')->__('Theme update error: Not able to write CSS file.') );
 				$this->_redirect('*/*/');
@@ -225,7 +225,7 @@ class Nwdthemes_Wunderadmin_Adminhtml_WunderadminController extends Mage_Adminht
 		if (isset($oldStyles['timestamp']))
 		{
 			$file = new Varien_Io_File();
-			$file->rm(Mage::getBaseDir('skin') . self::CSS_PATH . '/settings_' . $oldStyles['timestamp'] . '.css');
+			$file->rm(Mage::getBaseDir('media') . self::CSS_PATH . '/settings_' . $oldStyles['timestamp'] . '.css');
 		}
 
 		if ($newStyles['theme'] != 'default')
@@ -233,7 +233,7 @@ class Nwdthemes_Wunderadmin_Adminhtml_WunderadminController extends Mage_Adminht
 			Mage::getSingleton('wunderadmin/optionscss')
 				->setCssData($newStyles)
 				->setCssTemplatePath('nwdthemes/wunderadmin/css.phtml')
-				->generate(Mage::getBaseDir('skin') . self::CSS_PATH, 'settings_' . $newStyles['timestamp'] . '.css');
+				->generate(Mage::getBaseDir('media') . self::CSS_PATH, 'settings_' . $newStyles['timestamp'] . '.css');
 		}
 	}
 
diff --git a/Wunderadmin/app/design/adminhtml/default/wunderadmin/layout/local.xml b/Wunderadmin/app/design/adminhtml/default/wunderadmin/layout/local.xml
index bc7ff65..1099322 100644
--- a/Wunderadmin/app/design/adminhtml/default/wunderadmin/layout/local.xml
+++ b/Wunderadmin/app/design/adminhtml/default/wunderadmin/layout/local.xml
@@ -14,7 +14,6 @@
             <action method="addItem"><type>skin_css</type><name>css/tipsy.css</name></action>
             <action method="addItem"><type>skin_css</type><name>css/font-awesome.min.css</name></action>
             <action method="addItem"><type>skin_css</type><name helper="wunderadmin/data/getThemeCss" /></action>
-            <action method="addItem"><type>skin_css</type><name helper="wunderadmin/data/getSettingsCss" /></action>
 			<action method="addLinkRel"><type>stylesheet</type><name helper="wunderadmin/data/getGoogleFonts" /></action>
 		</reference>
     </default>
diff --git a/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/forgotpassword.phtml b/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/forgotpassword.phtml
index e2bd8b4..1464ad1 100644
--- a/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/forgotpassword.phtml
+++ b/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/forgotpassword.phtml
@@ -32,7 +32,7 @@
     <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('reset.css'); ?>" media="all" />
     <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('boxes.css'); ?>" media="all" />
     <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl( Mage::helper('wunderadmin')->getThemeCss() ) ?>" media="all" />
-    <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl( Mage::helper('wunderadmin')->getSettingsCss() ) ?>" media="all" />
+    <link type="text/css" rel="stylesheet" href="<?php echo $this->getBaseUrl('media') . Mage::helper('wunderadmin')->getSettingsCss() ?>" media="all" />
     <link rel="icon" href="<?php echo $this->getSkinUrl('favicon.ico'); ?>" type="image/x-icon" />
     <link rel="shortcut icon" href="<?php echo $this->getSkinUrl('favicon.ico'); ?>" type="image/x-icon" />
     <link href="<?php echo Mage::helper('wunderadmin')->getGoogleFonts(); ?>" rel="stylesheet" type="text/css" />
diff --git a/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/login.phtml b/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/login.phtml
index afafe99..5038544 100644
--- a/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/login.phtml
+++ b/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/login.phtml
@@ -32,7 +32,7 @@
     <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('reset.css') ?>" media="all" />
     <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('boxes.css') ?>" media="all" />
     <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl( Mage::helper('wunderadmin')->getThemeCss() ) ?>" media="all" />
-    <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl( Mage::helper('wunderadmin')->getSettingsCss() ) ?>" media="all" />
+    <link type="text/css" rel="stylesheet" href="<?php echo $this->getBaseUrl('media') . Mage::helper('wunderadmin')->getSettingsCss() ?>" media="all" />
     <link rel="icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />
     <link rel="shortcut icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />
     <link href="<?php echo Mage::helper('wunderadmin')->getGoogleFonts(); ?>" rel="stylesheet" type="text/css" />
diff --git a/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/page/head.phtml b/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/page/head.phtml
new file mode 100644
index 0000000..4f15bd4
--- /dev/null
+++ b/Wunderadmin/app/design/adminhtml/default/wunderadmin/template/page/head.phtml
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magento.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magento.com for more information.
+ *
+ * @category    design
+ * @package     base_default
+ * @copyright   Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
+<title><?php echo $this->getTitle() ?></title>
+<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
+<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
+<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
+<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
+<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
+<!--[if lt IE 7]>
+<script type="text/javascript">
+//<![CDATA[
+    var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
+    var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
+//]]>
+</script>
+<![endif]-->
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
+<?php echo $this->getCssJsHtml() ?>
+<link type="text/css" rel="stylesheet" href="<?php echo Mage::getBaseUrl('media') . Mage::helper('wunderadmin')->getSettingsCss() ?>" media="all" />
+<?php echo $this->getChildHtml() ?>
+<?php echo $this->helper('core/js')->getTranslatorScript() ?>
+<?php echo $this->getIncludes() ?>
-- 
2.8.0.windows.1

