From b4ba7a08716f5f2de5bdb7ca441dc68c13388c6d Mon Sep 17 00:00:00 2001
From: Kevin Abel <kevin.abel.0@gmail.com>
Date: Mon, 21 Apr 2014 14:52:53 -0500
Subject: [PATCH] In debug mode (only) use the local template dependents rather
 than CDN

---
 www/index.php                     | 22 +++++++++++------
 www/templates/embed-debug.tpl.php | 41 +++++++++++++++++++++++++++++++
 www/templates/embed.tpl.php       |  2 +-
 3 files changed, 56 insertions(+), 9 deletions(-)
 create mode 100644 www/templates/embed-debug.tpl.php

diff --git a/www/index.php b/www/index.php
index 2c36116..0e06dae 100644
--- a/www/index.php
+++ b/www/index.php
@@ -18,7 +18,14 @@ $isEmbed = isset($_GET['embed']) && $_GET['embed'];
 UNL_Templates::setCachingService(new UNL_Templates_CachingService_Null());
 UNL_Templates::$options['version'] = 4.0;
 
-$page = UNL_Templates::factory('Fixed');
+
+if (UNL_Search::$mode === 'debug') {
+    $page = UNL_Templates::factory('Local');
+    $page->addScript('js/search.js');
+} else {
+    $page = UNL_Templates::factory('Fixed');
+    $page->addScript('js/search.min.js');
+}
 
 if (!$isEmbed) {
     $page->doctitle = '<title>Search | University of Nebraska&ndash;Lincoln</title>';
@@ -28,12 +35,6 @@ if (!$isEmbed) {
     $page->breadcrumbs = ob_get_clean();
 }
 
-if (UNL_Search::$mode === 'debug') {
-    $page->addScript('js/search.js');
-} else {
-    $page->addScript('js/search.min.js');
-}
-
 $local_results = '';
 $inlineJS = '';
 $apiKey = UNL_Search::getJSAPIKey();
@@ -129,7 +130,12 @@ if (!$isEmbed) {
     $page->maincontentarea = $maincontent;
     echo $page;
 } else {
-    renderTemplate('templates/embed.tpl.php', array(
+    if (UNL_Search::$mode === 'debug') {
+        $template = 'templates/embed-debug.tpl.php';
+    } else {
+        $template = 'templates/embed.tpl.php';
+    }
+    renderTemplate($template, array(
         'head' => $page->head,
         'maincontent' => $maincontent
     ));
diff --git a/www/templates/embed-debug.tpl.php b/www/templates/embed-debug.tpl.php
new file mode 100644
index 0000000..38a9a07
--- /dev/null
+++ b/www/templates/embed-debug.tpl.php
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!--[if IEMobile 7 ]><html class="ie iem7 embed"><![endif]-->
+<!--[if lt IE 7 ]><html class="ie ie6 embed" lang="en"><![endif]-->
+<!--[if IE 7 ]><html class="ie ie7 embed" lang="en"><![endif]-->
+<!--[if IE 8 ]><html class="ie ie8 embed" lang="en"><![endif]-->
+<!--[if (gte IE 9)|(gt IEMobile 7) ]><html class="ie embed" lang="en"><![endif]-->
+<!--[if !(IEMobile) | !(IE)]><!--><html class="embed" lang="en"><!--<![endif]-->
+<head>
+    <meta charset="utf-8" />
+    <title>UNL Search | University of Nebraska&ndash;Lincoln</title>
+<!-- Load Cloud.typography fonts -->
+	<link rel="stylesheet" type="text/css" href="//cloud.typography.com/7717652/616662/css/fonts.css" />
+<!-- Load our base CSS file -->
+<!--[if gte IE 9]><!-->    
+    <link rel="stylesheet" type="text/css" media="all" href="/wdn/templates_4.0/css/all.css" />
+<!--<![endif]-->
+
+<!-- Load the template JS file -->
+    <script type="text/javascript" src="/wdn/templates_4.0/scripts/compressed/all.js" id="wdn_dependents"></script>
+    
+<!--[if lt IE 9]>
+    <link rel="stylesheet" type="text/css" media="all" href="/wdn/templates_4.0/css/all_oldie.css" />
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+<![endif]-->
+
+<!-- For all IE versions, bring in the tweaks -->
+<!--[if IE]>
+    <link rel="stylesheet" type="text/css" media="all" href="/wdn/templates_4.0/css/ie.css" />
+<![endif]-->
+    <?php echo $head ?>
+</head>
+<body>
+    <div id="wdn_wrapper">
+        <div id="wdn_content_wrapper">
+            <div id="maincontent" class="wdn-main">
+            <?php echo $maincontent ?>
+            </div>
+        </div>
+    </div>
+</body>
+</html>
diff --git a/www/templates/embed.tpl.php b/www/templates/embed.tpl.php
index 56db317..03da953 100644
--- a/www/templates/embed.tpl.php
+++ b/www/templates/embed.tpl.php
@@ -16,7 +16,7 @@
 <!--<![endif]-->
 
 <!-- Load the template JS file -->
-    <script type="text/javascript" src="/wdn/templates_4.0/scripts/compressed/all.js?dep=4.0.7" id="wdn_dependents"></script>
+    <script type="text/javascript" src="//unlcms.unl.edu/wdn/templates_4.0/scripts/compressed/all.js?dep=$DEP_VERSION$" id="wdn_dependents"></script>
     
 <!--[if lt IE 9]>
     <link rel="stylesheet" type="text/css" media="all" href="//unlcms.unl.edu/wdn/templates_4.0/css/all_oldie.css" />
-- 
GitLab