From eabbbb55c0d67f93e1861424785faac1e6ee90ea Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 10 Sep 2013 10:54:53 -0400
Subject: [PATCH] Use 'SET' with inlineScript to avoid unexpected behavior.

---
 .../templates/Recommend/EuropeanaResultsDeferred.phtml        | 2 +-
 .../templates/Recommend/OpenLibrarySubjectsDeferred.phtml     | 2 +-
 themes/blueprint/templates/Recommend/PubDateVisAjax.phtml     | 2 +-
 .../blueprint/templates/Recommend/SummonResultsDeferred.phtml | 2 +-
 themes/blueprint/templates/RecordTab/hierarchytree.phtml      | 3 ++-
 themes/blueprint/templates/myresearch/account.phtml           | 2 +-
 themes/blueprint/templates/myresearch/login.phtml             | 4 ++--
 7 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/themes/blueprint/templates/Recommend/EuropeanaResultsDeferred.phtml b/themes/blueprint/templates/Recommend/EuropeanaResultsDeferred.phtml
index 7e56b8ed61d..9e36fdf0f81 100644
--- a/themes/blueprint/templates/Recommend/EuropeanaResultsDeferred.phtml
+++ b/themes/blueprint/templates/Recommend/EuropeanaResultsDeferred.phtml
@@ -5,5 +5,5 @@
 ?>
 <div id="EuropeanaDeferredRecommend">
     <p><?=$this->transEsc("Loading")?>... <img src="<?=$this->imageLink('ajax_loading.gif')?>" /></p>
-    <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $loadJs)?>
+    <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $loadJs, 'SET')?>
 </div>
\ No newline at end of file
diff --git a/themes/blueprint/templates/Recommend/OpenLibrarySubjectsDeferred.phtml b/themes/blueprint/templates/Recommend/OpenLibrarySubjectsDeferred.phtml
index 7f023f0d739..e3c0de443f1 100644
--- a/themes/blueprint/templates/Recommend/OpenLibrarySubjectsDeferred.phtml
+++ b/themes/blueprint/templates/Recommend/OpenLibrarySubjectsDeferred.phtml
@@ -5,5 +5,5 @@
 ?>
 <div id="openLibraryDeferredRecommend">
     <p><?=$this->transEsc("Loading")?>... <img src="<?=$this->imageLink('ajax_loading.gif')?>" /></p>
-    <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $loadJs)?>
+    <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $loadJs, 'SET')?>
 </div>
\ No newline at end of file
diff --git a/themes/blueprint/templates/Recommend/PubDateVisAjax.phtml b/themes/blueprint/templates/Recommend/PubDateVisAjax.phtml
index 9513241302a..b1677741242 100644
--- a/themes/blueprint/templates/Recommend/PubDateVisAjax.phtml
+++ b/themes/blueprint/templates/Recommend/PubDateVisAjax.phtml
@@ -21,7 +21,7 @@
     $js = "loadVis('" . $this->recommend->getFacetFields() . "', '"
         . $this->recommend->getSearchParams() . "', path, "
         . $this->recommend->getZooming() . ");";
-    echo $this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $js);
+    echo $this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $js, 'SET');
   ?>
 
 <? endif; ?>
diff --git a/themes/blueprint/templates/Recommend/SummonResultsDeferred.phtml b/themes/blueprint/templates/Recommend/SummonResultsDeferred.phtml
index 80b00782cea..ea9b1f32e2c 100644
--- a/themes/blueprint/templates/Recommend/SummonResultsDeferred.phtml
+++ b/themes/blueprint/templates/Recommend/SummonResultsDeferred.phtml
@@ -5,5 +5,5 @@
 ?>
 <div id="SummonDeferredRecommend">
     <p><?=$this->transEsc("Loading")?>... <img src="<?=$this->imageLink('ajax_loading.gif')?>" /></p>
-    <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $loadJs)?>
+    <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $loadJs, 'SET')?>
 </div>
\ No newline at end of file
diff --git a/themes/blueprint/templates/RecordTab/hierarchytree.phtml b/themes/blueprint/templates/RecordTab/hierarchytree.phtml
index 9e4d4279b9d..3d41709667c 100644
--- a/themes/blueprint/templates/RecordTab/hierarchytree.phtml
+++ b/themes/blueprint/templates/RecordTab/hierarchytree.phtml
@@ -11,7 +11,8 @@
         . "    fullHierarchy: " . ($this->tab->isFullHierarchyVisible() ? 'true' : 'false') . "\n"
         . "};\n"
         . "vufindString.showTree = \"" . $this->transEsc('hierarchy_show_tree') . "\";\n"
-        . "vufindString.hideTree = \"" . $this->transEsc('hierarchy_hide_tree') . "\";\n"
+        . "vufindString.hideTree = \"" . $this->transEsc('hierarchy_hide_tree') . "\";\n",
+        'SET'
     );
     $this->inlineScript(\Zend\View\Helper\HeadScript::FILE, 'jsTree/jquery.jstree.js');
     $this->inlineScript(\Zend\View\Helper\HeadScript::FILE, 'hierarchyTree_JSTree.js');
diff --git a/themes/blueprint/templates/myresearch/account.phtml b/themes/blueprint/templates/myresearch/account.phtml
index aed4a933606..c0a9fb37d9d 100644
--- a/themes/blueprint/templates/myresearch/account.phtml
+++ b/themes/blueprint/templates/myresearch/account.phtml
@@ -18,5 +18,5 @@
 <?
   // Set up form validation:
   $initJs = '$(document).ready(function() { $(\'#accountForm\').validate(); });';
-  echo $this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $initJs);
+  echo $this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $initJs, 'SET');
 ?>
diff --git a/themes/blueprint/templates/myresearch/login.phtml b/themes/blueprint/templates/myresearch/login.phtml
index c72b5e23ca5..2d48e8b4746 100644
--- a/themes/blueprint/templates/myresearch/login.phtml
+++ b/themes/blueprint/templates/myresearch/login.phtml
@@ -9,7 +9,7 @@
 
     // If we're in AJAX mode, load some extra Javascript inline:
     if ($this->layout()->getTemplate() == 'layout/lightbox') {
-        $this->inlineScript()->appendFile("rc4.js");
+        echo $this->inlineScript(\Zend\View\Helper\HeadScript::FILE, 'rc4.js', 'SET');
     }
 
     // Convenience variables:
@@ -44,7 +44,7 @@
     <?
       // Set up form validation:
       $initJs = '$(document).ready(function() { $(\'#loginForm\').validate(); });';
-      echo $this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $initJs);
+      echo $this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $initJs, 'SET');
     ?>
     <? if ($account->supportsCreation()): ?>
       <a class="new_account" href="<?=$this->url('myresearch-account')?>"><?=$this->transEsc('Create New Account')?></a>
-- 
GitLab