<#-- ~ 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 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}"> <#-- 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"> <#-- 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}"> <#-- 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>| <#assign iframeSrc="${iframeSrc}&up_${gadgetUserPref.name}=${prefValue?url}"> <#-- 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> <#assign rpctoken = rpctoken?string('#########')> <#assign iframeSrc="${iframeSrc}#rpctoken=${rpctoken}"> <#-- 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?-->
<#-- start gadget title bar --> <#if viewName != "editCustomPrefs">
gadgets-gadget-title-toggle-button-closed" onclick="portal.regionGadget.toggleCollapseState(${gadgetIdx?c});" href="#" id="remote_iframe_${gadgetIdx?c}_toggleButton"> class="gadget-draggable-region"> ${regionGadget.personGadget.gadget.title} <#if regionGadget.personGadget.gadget.externalGadget>
<#-- end gadget title bar --> <#-- start main body of the gadget -->
style="display: none;" <#elseif viewName="editCustomPrefs"> style="border-style: none;" >
<#-- end main body of gadget -->
<#-- the gadget menu definition --> <#if viewName != "editCustomPrefs"> <@generateGadgetMenu regionGadget gadgetIdx viewName /> <#-- generateGadgetMenu - This macro generates the gadget menu which renders in the titlebar chrome. Note that this IS actually a dojo menu widget created via the dojo markup method, but instead of using the regular dojoType attribute we're using a custom delayedParseDojoType attribute so that the menu's wont be parsed when the parser runs on page load (since they will be ignored). We will parse these menus on demand when users click on the menu carets. 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 generateGadgetMenu regionGadget gadgetIdx viewName>