PageRenderTime 45ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/SugarCE-6.5.4/SugarCE-Full-6.5.4/include/DetailView/DetailView.tpl

https://bitbucket.org/blakeball/test-repository
Smarty Template | 223 lines | 175 code | 9 blank | 39 comment | 39 complexity | a3c4dd95d931815f9845a09fe2e3da33 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception
  1. {*
  2. /*********************************************************************************
  3. * SugarCRM Community Edition is a customer relationship management program developed by
  4. * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it under
  7. * the terms of the GNU Affero General Public License version 3 as published by the
  8. * Free Software Foundation with the addition of the following permission added
  9. * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
  10. * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
  11. * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15. * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License along with
  19. * this program; if not, see http://www.gnu.org/licenses or write to the Free
  20. * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  21. * 02110-1301 USA.
  22. *
  23. * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
  24. * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
  25. *
  26. * The interactive user interfaces in modified source and object code versions
  27. * of this program must display Appropriate Legal Notices, as required under
  28. * Section 5 of the GNU Affero General Public License version 3.
  29. *
  30. * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
  31. * these Appropriate Legal Notices must retain the display of the "Powered by
  32. * SugarCRM" logo. If the display of the logo is not reasonably feasible for
  33. * technical reasons, the Appropriate Legal Notices must display the words
  34. * "Powered by SugarCRM".
  35. ********************************************************************************/
  36. *}
  37. {{include file=$headerTpl}}
  38. {sugar_include include=$includes}
  39. <div id="{{$module}}_detailview_tabs"
  40. {{if $useTabs}}
  41. class="yui-navset detailview_tabs"
  42. {{/if}}
  43. >
  44. {{if $useTabs}}
  45. {* Generate the Tab headers *}
  46. {{counter name="tabCount" start=-1 print=false assign="tabCount"}}
  47. <ul class="yui-nav">
  48. {{foreach name=section from=$sectionPanels key=label item=panel}}
  49. {{capture name=label_upper assign=label_upper}}{{$label|upper}}{{/capture}}
  50. {* override from tab definitions *}
  51. {{if (isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == true)}}
  52. {{counter name="tabCount" print=false}}
  53. <li><a id="tab{{$tabCount}}" href="javascript:void(0)"><em>{sugar_translate label='{{$label}}' module='{{$module}}'}</em></a></li>
  54. {{/if}}
  55. {{/foreach}}
  56. </ul>
  57. {{/if}}
  58. <div {{if $useTabs}}class="yui-content"{{/if}}>
  59. {{* Loop through all top level panels first *}}
  60. {{counter name="panelCount" print=false start=0 assign="panelCount"}}
  61. {{counter name="tabCount" start=-1 print=false assign="tabCount"}}
  62. {{foreach name=section from=$sectionPanels key=label item=panel}}
  63. {{assign var='panel_id' value=$panelCount}}
  64. {{capture name=label_upper assign=label_upper}}{{$label|upper}}{{/capture}}
  65. {{if (isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == true)}}
  66. {{counter name="tabCount" print=false}}
  67. {{if $tabCount != 0}}</div>{{/if}}
  68. <div id='tabcontent{{$tabCount}}'>
  69. {{/if}}
  70. <div id='detailpanel_{{$smarty.foreach.section.iteration}}' class='detail view detail508 {{$panelState}}'>
  71. {counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
  72. {{* Print out the panel title if one exists*}}
  73. {{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
  74. {{* See function.sugar_include.php *}}
  75. {{if !is_array($panel)}}
  76. {sugar_include type='php' file='{{$panel}}'}
  77. {{else}}
  78. {{if !empty($label) && !is_int($label) && $label != 'DEFAULT' && (!isset($tabDefs[$label_upper].newTab) || (isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == false))}}
  79. <h4>
  80. <a href="javascript:void(0)" class="collapseLink" onclick="collapsePanel({{$smarty.foreach.section.iteration}});">
  81. <img border="0" id="detailpanel_{{$smarty.foreach.section.iteration}}_img_hide" src="{sugar_getimagepath file="basic_search.gif"}"></a>
  82. <a href="javascript:void(0)" class="expandLink" onclick="expandPanel({{$smarty.foreach.section.iteration}});">
  83. <img border="0" id="detailpanel_{{$smarty.foreach.section.iteration}}_img_show" src="{sugar_getimagepath file="advanced_search.gif"}"></a>
  84. {sugar_translate label='{{$label}}' module='{{$module}}'}
  85. {{if ( isset($tabDefs[$label_upper].panelDefault) && $tabDefs[$label_upper].panelDefault == "collapsed" && isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == false) }}
  86. {{assign var='panelState' value=$tabDefs[$label_upper].panelDefault}}
  87. {{else}}
  88. {{assign var='panelState' value="expanded"}}
  89. {{/if}}
  90. {{if isset($panelState) && $panelState == 'collapsed'}}
  91. <script>
  92. document.getElementById('detailpanel_{{$smarty.foreach.section.iteration}}').className += ' collapsed';
  93. </script>
  94. {{else}}
  95. <script>
  96. document.getElementById('detailpanel_{{$smarty.foreach.section.iteration}}').className += ' expanded';
  97. </script>
  98. {{/if}}
  99. </h4>
  100. {{/if}}
  101. {{* Print out the table data *}}
  102. <table id='{{$label}}' class="panelContainer" cellspacing='{$gridline}'>
  103. {{foreach name=rowIteration from=$panel key=row item=rowData}}
  104. {counter name="fieldsUsed" start=0 print=false assign="fieldsUsed"}
  105. {counter name="fieldsHidden" start=0 print=false assign="fieldsHidden"}
  106. {capture name="tr" assign="tableRow"}
  107. <tr>
  108. {{assign var='columnsInRow' value=$rowData|@count}}
  109. {{assign var='columnsUsed' value=0}}
  110. {{foreach name=colIteration from=$rowData key=col item=colData}}
  111. {{if !empty($colData.field.hideIf)}}
  112. {if !({{$colData.field.hideIf}}) }
  113. {{/if}}
  114. {counter name="fieldsUsed"}
  115. {{if empty($colData.field.hideLabel)}}
  116. <td width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope="col">
  117. {{if !empty($colData.field.name)}}
  118. {if !$fields.{{$colData.field.name}}.hidden}
  119. {{/if}}
  120. {{if isset($colData.field.customLabel)}}
  121. {{$colData.field.customLabel}}
  122. {{elseif isset($colData.field.label) && strpos($colData.field.label, '$')}}
  123. {capture name="label" assign="label"}{{$colData.field.label}}{/capture}
  124. {$label|strip_semicolon}:
  125. {{elseif isset($colData.field.label)}}
  126. {capture name="label" assign="label"}{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}{/capture}
  127. {$label|strip_semicolon}:
  128. {{elseif isset($fields[$colData.field.name])}}
  129. {capture name="label" assign="label"}{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}{/capture}
  130. {$label|strip_semicolon}:
  131. {{else}}
  132. &nbsp;
  133. {{/if}}
  134. {{if isset($colData.field.popupHelp) || isset($fields[$colData.field.name]) && isset($fields[$colData.field.name].popupHelp) }}
  135. {{if isset($colData.field.popupHelp) }}
  136. {capture name="popupText" assign="popupText"}{sugar_translate label="{{$colData.field.popupHelp}}" module='{{$module}}'}{/capture}
  137. {{elseif isset($fields[$colData.field.name].popupHelp)}}
  138. {capture name="popupText" assign="popupText"}{sugar_translate label="{{$fields[$colData.field.name].popupHelp}}" module='{{$module}}'}{/capture}
  139. {{/if}}
  140. {sugar_help text=$popupText WIDTH=400}
  141. {{/if}}
  142. {{if !empty($colData.field.name)}}
  143. {/if}
  144. {{/if}}
  145. {{/if}}
  146. </td>
  147. <td width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}%' {{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}} {{if isset($fields[$colData.field.name].type) && $fields[$colData.field.name].type == 'phone'}}class="phone"{{/if}}>
  148. {{if !empty($colData.field.name)}}
  149. {if !$fields.{{$colData.field.name}}.hidden}
  150. {{/if}}
  151. {{$colData.field.prefix}}
  152. {{if ($colData.field.customCode && !$colData.field.customCodeRenderField) || $colData.field.assign}}
  153. {counter name="panelFieldCount"}
  154. <span id="{{$colData.field.name}}" class="sugar_field">{{sugar_evalcolumn var=$colData.field colData=$colData}}</span>
  155. {{elseif $fields[$colData.field.name] && !empty($colData.field.fields) }}
  156. {{foreach from=$colData.field.fields item=subField}}
  157. {{if $fields[$subField]}}
  158. {counter name="panelFieldCount"}
  159. {{sugar_field parentFieldArray='fields' tabindex=$tabIndex vardef=$fields[$subField] displayType='DetailView'}}&nbsp;
  160. {{else}}
  161. {counter name="panelFieldCount"}
  162. {{$subField}}
  163. {{/if}}
  164. {{/foreach}}
  165. {{elseif $fields[$colData.field.name]}}
  166. {counter name="panelFieldCount"}
  167. {{sugar_field parentFieldArray='fields' vardef=$fields[$colData.field.name] displayType='DetailView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type}}
  168. {{/if}}
  169. {{if !empty($colData.field.customCode) && $colData.field.customCodeRenderField}}
  170. {counter name="panelFieldCount"}
  171. <span id="{{$colData.field.name}}" class="sugar_field">{{sugar_evalcolumn var=$colData.field colData=$colData}}</span>
  172. {{/if}}
  173. {{$colData.field.suffix}}
  174. {{if !empty($colData.field.name)}}
  175. {/if}
  176. {{/if}}
  177. </td>
  178. {{if !empty($colData.field.hideIf)}}
  179. {else}
  180. <td>&nbsp;</td><td>&nbsp;</td>
  181. {/if}
  182. {{/if}}
  183. {{/foreach}}
  184. </tr>
  185. {/capture}
  186. {if $fieldsUsed > 0 && $fieldsUsed != $fieldsHidden}
  187. {$tableRow}
  188. {/if}
  189. {{/foreach}}
  190. </table>
  191. {{if !empty($label) && !is_int($label) && $label != 'DEFAULT' && (!isset($tabDefs[$label_upper].newTab) || (isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == false))}}
  192. <script type="text/javascript">SUGAR.util.doWhen("typeof initPanel == 'function'", function() {ldelim} initPanel({{$smarty.foreach.section.iteration}}, '{{$panelState}}'); {rdelim}); </script>
  193. {{/if}}
  194. {{/if}}
  195. </div>
  196. {if $panelFieldCount == 0}
  197. <script>document.getElementById("{{$label}}").style.display='none';</script>
  198. {/if}
  199. {{/foreach}}
  200. {{if $useTabs}}
  201. </div>
  202. {{/if}}
  203. </div>
  204. </div>
  205. {{include file=$footerTpl}}
  206. {{if $useTabs}}
  207. <script type='text/javascript' src='{sugar_getjspath file='include/javascript/popup_helper.js'}'></script>
  208. <script type="text/javascript" src="{sugar_getjspath file='cache/include/javascript/sugar_grp_yui_widgets.js'}"></script>
  209. <script type="text/javascript">
  210. var {{$module}}_detailview_tabs = new YAHOO.widget.TabView("{{$module}}_detailview_tabs");
  211. {{$module}}_detailview_tabs.selectTab(0);
  212. </script>
  213. {{/if}}