#-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in ~ compliance with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, ~ software distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. --> <#-- The generateGadgetIfrUrl macro generates the iframe source URL for a gadget. Parameters: 1) personGadget - the personGadget model object 2) viewName - the gadget view to render [home|canvas|editCustomPrefs] --> <#macro generateGadgetIfrUrl personGadget viewName> <#-- generate the iframe src url --> <#-- base shindig url--> <#assign iframeSrc=portal_properties["shindig.protocol"]> <#if .globals.enforceLockedDomain> <#assign iframeSrc="${iframeSrc}${personGadget.gadget.lockedDomainPrefix}."> #if> <#-- if this is an external gadget, render it on the external gadget server --> <#if personGadget.gadget.externalGadget> <#assign shindigRoot="${.globals.shindigExternalRoot}"> <#assign shindigUrl="${.globals.shindigExternalUrl}"> <#else> <#assign shindigRoot="${.globals.shindigRoot}"> <#assign shindigUrl="${.globals.shindigUrl}"> #if> <#-- save off the rpcRelayUrl at this point for use further down--> <#assign rpcRelayUrl="${iframeSrc}${shindigRoot}/container/rpc_relay.html"> <#assign iframeSrc="${iframeSrc}${shindigUrl}/ifr?"> <#-- container name --> <#assign iframeSrc="${iframeSrc}container=${container.name?lower_case}"> <#-- module id is a unique ID for an instance of a gadget --> <#assign iframeSrc="${iframeSrc}&mid=${personGadget.personGadgetId?c}"> <#-- view name - hardcoded to home since that is all we render in page view --> <#assign iframeSrc="${iframeSrc}&view=${viewName}"> <#-- parent url of the container --> <#assign iframeSrc="${iframeSrc}&parent=${containerUrl?url}"> <#-- the encrypted user token for the gadget --> <#assign iframeSrc="${iframeSrc}&st=${personGadget.securityToken}"> <#-- url to the gadget xml file --> <#assign iframeSrc="${iframeSrc}&url=${personGadget.gadget.url?url}"> <#if .globals.bypassShindigCache> <#-- hardcoded parameter to turn off shindig caching --> <#assign iframeSrc="${iframeSrc}&nocache=1"> #if> <#-- generate user pref params --> <#-- first load single data fields userprefs --> <#if personGadget.personGadgetUserPrefList??> <#list personGadget.personGadgetUserPrefList as personGadgetUserPref> <#assign prefValue="${(personGadgetUserPref.prefValue!personGadgetUserPref.gadgetUserPref.defaultValue!'')?url}"> <#assign iframeSrc="${iframeSrc}&up_${personGadgetUserPref.gadgetUserPref.name}=${prefValue}"> #list> #if> <#-- now load list type userprefs --> <#if personGadget.personGadgetUserPrefListTypeList??> <#list personGadget.gadget.gadgetUserPrefList as gadgetUserPref> <#if gadgetUserPref.dataType == 'list'> <#assign prefValue><#list personGadget.getPersonGadgetUserPrefListTypesByGadgetPref(gadgetUserPref.gadgetUserPrefId) as personGadgetUserPrefListType>${personGadgetUserPrefListType.prefValue}<#if personGadgetUserPrefListType_has_next>|#if>#list>#assign> <#assign iframeSrc="${iframeSrc}&up_${gadgetUserPref.name}=${prefValue?url}"> #if> #list> #if> <#-- random number for rpctoken (make sure it is positive) --> <#assign randomScalar = "${randomGen.nextInt()?string('#########')}"> <#assign rpctoken = randomScalar?number> <#if rpctoken < 0> <#assign rpctoken = rpctoken * -1> #if> <#assign rpctoken = rpctoken?string('#########')> <#assign iframeSrc="${iframeSrc}#rpctoken=${rpctoken}"> #macro> <#-- The generateGadgetChrome macro generates the chrome(wrapper border) and iframe code for a gadget. Parameters: 1) regionGadget - the regionGadget model object 2) gadgetIdx - the index of the gadget over all regions (page gadget counter) 3) viewName - the gadget view to render [home|canvas|editCustomPrefs] --> <#macro generateGadgetChrome regionGadget gadgetIdx viewName> <@generateGadgetIfrUrl regionGadget.personGadget viewName /> <#-- name is the regionGadgetId - i think it is needed for the dnd code?-->