Adding Juice to a Talis Prism Tenancy

 This should be read in conjunction with the Get Started Document.

Using the Administration application for Talis Prism, the contents of the Juice distribution zip can uploaded to your tenancy by adding it to the theme for your tenancy.  

Unzip your tenancy theme zip file, create a js directory then follow the steps in the Get Started document.  Make the additional changes described below, then zip the theme up and apply to your tenancy in the normal way.

Inserting the script elements

So that Juice is available throughout your tenancy, add the script elements in to the end of the footer.html theme file thus:

<div class="footerStyle">

Powered by <a href="http://www.talis.com/prism/">Talis Prism</a>

</div>

 

<!-- Warning! - Do not remove following three script elements enabling Juice and Google Analytics -->

<script type="text/javascript" src="assets/-/js/jquery-1.3.2.min.js"></script>

<script type="text/javascript" src="assets/-/js/juice.js"></script>

<script type="text/javascript" src="assets/-/js/extend_my_prism.js"></script>

Note the src attribute uses the Prism convention for addressing files stored in the tenancy theme.

Prism Specific Extend File Enhancements

The following code inserted in to the file extend file will calculate the correct path to the tenancy files, even when the tenancy is being accessed in demo mode.

function prismTenancy(){

var prism = "";

var urlParts = window.location.href.split('/');

if(urlParts[2] == "prism.talis.com"){

prism = urlParts[3];

if (prism == 'demo') {

  prism += '/' + urlParts[4];

}

}

return prism;

}

 
The returned value is then used in the calls to juce.loadJs() and juice.loadCss() to be prefixed to the normal path thus:

juice.loadJs("/assets/-/js/extensions/extendedbyJuice.js",prismTenancy());

 
Finally, you can control the extensions added to each page in your tenancy by calling from page specific functions, thus:

function runExtensions(){

new extendedbyJuice(juice);

// new gasJuice(juice,"UA-XXXXXXX-XX");

switch(jQuery("body").attr("id")){

case "index":

frontPage();

break;

case "searchaction":

resultsPage();

break;

case "renderitem":

itemPage();

break;

}

}

 

function frontPage(){

//Front Page functionality

}

 

function resultsPage(){

//Results Page functionality

}

 

function itemPage(){

//Item Page functionality

}