]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/DetailView/DetailView.tpl
Release 6.5.3
[Github/sugarcrm.git] / include / DetailView / DetailView.tpl
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 *}
38 {{include file=$headerTpl}}
39 {sugar_include include=$includes}
40 <div id="{{$module}}_detailview_tabs"
41 {{if $useTabs}}
42 class="yui-navset detailview_tabs"
43 {{/if}}
44 >
45     {{if $useTabs}}
46     {* Generate the Tab headers *}
47     {{counter name="tabCount" start=-1 print=false assign="tabCount"}}
48     <ul class="yui-nav">
49     {{foreach name=section from=$sectionPanels key=label item=panel}}
50         {{capture name=label_upper assign=label_upper}}{{$label|upper}}{{/capture}}
51         {* override from tab definitions *}
52         {{if (isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == true)}}
53             {{counter name="tabCount" print=false}}
54             <li><a id="tab{{$tabCount}}" href="javascript:void(0)"><em>{sugar_translate label='{{$label}}' module='{{$module}}'}</em></a></li>
55         {{/if}}
56     {{/foreach}}
57     </ul>
58     {{/if}}
59     <div {{if $useTabs}}class="yui-content"{{/if}}>
60 {{* Loop through all top level panels first *}}
61 {{counter name="panelCount" print=false start=0 assign="panelCount"}}
62 {{counter name="tabCount" start=-1 print=false assign="tabCount"}}
63 {{foreach name=section from=$sectionPanels key=label item=panel}}
64 {{assign var='panel_id' value=$panelCount}}
65 {{capture name=label_upper assign=label_upper}}{{$label|upper}}{{/capture}}
66   {{if (isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == true)}}
67     {{counter name="tabCount" print=false}}
68     {{if $tabCount != 0}}</div>{{/if}}
69     <div id='tabcontent{{$tabCount}}'>
70   {{/if}}
71 <div id='detailpanel_{{$smarty.foreach.section.iteration}}' class='detail view  detail508 {{$panelState}}'>
72 {counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
73 {{* Print out the panel title if one exists*}}
74
75 {{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
76 {{* See function.sugar_include.php *}}
77 {{if !is_array($panel)}}
78     {sugar_include type='php' file='{{$panel}}'}
79 {{else}}
80
81     {{if !empty($label) && !is_int($label) && $label != 'DEFAULT' && (!isset($tabDefs[$label_upper].newTab) || (isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == false))}}
82     <h4>
83       <a href="javascript:void(0)" class="collapseLink" onclick="collapsePanel({{$smarty.foreach.section.iteration}});">
84       <img border="0" id="detailpanel_{{$smarty.foreach.section.iteration}}_img_hide" src="{sugar_getimagepath file="basic_search.gif"}"></a>
85       <a href="javascript:void(0)" class="expandLink" onclick="expandPanel({{$smarty.foreach.section.iteration}});">
86       <img border="0" id="detailpanel_{{$smarty.foreach.section.iteration}}_img_show" src="{sugar_getimagepath file="advanced_search.gif"}"></a>
87       {sugar_translate label='{{$label}}' module='{{$module}}'}
88     {{if ( isset($tabDefs[$label_upper].panelDefault) && $tabDefs[$label_upper].panelDefault == "collapsed" && isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == false) }}
89       {{assign var='panelState' value=$tabDefs[$label_upper].panelDefault}}
90     {{else}}
91       {{assign var='panelState' value="expanded"}}
92     {{/if}}
93     {{if isset($panelState) && $panelState == 'collapsed'}}
94     <script>
95       document.getElementById('detailpanel_{{$smarty.foreach.section.iteration}}').className += ' collapsed';
96     </script>
97     {{else}}
98     <script>
99       document.getElementById('detailpanel_{{$smarty.foreach.section.iteration}}').className += ' expanded';
100     </script>
101     {{/if}}
102     </h4>
103
104     {{/if}}
105         {{* Print out the table data *}}
106   <table id='{{$label}}' class="panelContainer" cellspacing='{$gridline}'>
107
108
109
110         {{foreach name=rowIteration from=$panel key=row item=rowData}}
111         {counter name="fieldsUsed" start=0 print=false assign="fieldsUsed"}
112         {counter name="fieldsHidden" start=0 print=false assign="fieldsHidden"}
113         {capture name="tr" assign="tableRow"}
114         <tr>
115                 {{assign var='columnsInRow' value=$rowData|@count}}
116                 {{assign var='columnsUsed' value=0}}
117                 {{foreach name=colIteration from=$rowData key=col item=colData}}
118             {{if !empty($colData.field.hideIf)}}
119                 {if !({{$colData.field.hideIf}}) }
120             {{/if}}
121                         {counter name="fieldsUsed"}
122                         {{if empty($colData.field.hideLabel)}}
123                         <td width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope="col">
124                                 {{if !empty($colData.field.name)}}
125                                     {if !$fields.{{$colData.field.name}}.hidden}
126                 {{/if}}
127                                 {{if isset($colData.field.customLabel)}}
128                                {{$colData.field.customLabel}}
129                                 {{elseif isset($colData.field.label) && strpos($colData.field.label, '$')}}
130                                    {capture name="label" assign="label"}{{$colData.field.label}}{/capture}
131                                {$label|strip_semicolon}:
132                                 {{elseif isset($colData.field.label)}}
133                                    {capture name="label" assign="label"}{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}{/capture}
134                                {$label|strip_semicolon}:
135                                 {{elseif isset($fields[$colData.field.name])}}
136                                    {capture name="label" assign="label"}{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}{/capture}
137                                {$label|strip_semicolon}:
138                                 {{else}}
139                                    &nbsp;
140                                 {{/if}}
141                 {{if isset($colData.field.popupHelp) || isset($fields[$colData.field.name]) && isset($fields[$colData.field.name].popupHelp) }}
142                    {{if isset($colData.field.popupHelp) }}
143                      {capture name="popupText" assign="popupText"}{sugar_translate label="{{$colData.field.popupHelp}}" module='{{$module}}'}{/capture}
144                    {{elseif isset($fields[$colData.field.name].popupHelp)}}
145                      {capture name="popupText" assign="popupText"}{sugar_translate label="{{$fields[$colData.field.name].popupHelp}}" module='{{$module}}'}{/capture}
146                    {{/if}}
147                    {sugar_help text=$popupText WIDTH=400}
148                 {{/if}}
149                 {{if !empty($colData.field.name)}}
150                 {/if}
151                 {{/if}}
152                 {{/if}}
153                         </td>
154                         <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}}>
155                             {{if !empty($colData.field.name)}}
156                             {if !$fields.{{$colData.field.name}}.hidden}
157                             {{/if}}
158                                 {{$colData.field.prefix}}
159                                 {{if ($colData.field.customCode && !$colData.field.customCodeRenderField) || $colData.field.assign}}
160                                         {counter name="panelFieldCount"}
161                                         <span id="{{$colData.field.name}}" class="sugar_field">{{sugar_evalcolumn var=$colData.field colData=$colData}}</span>
162                                 {{elseif $fields[$colData.field.name] && !empty($colData.field.fields) }}
163                                     {{foreach from=$colData.field.fields item=subField}}
164                                         {{if $fields[$subField]}}
165                                                 {counter name="panelFieldCount"}
166                                             {{sugar_field parentFieldArray='fields' tabindex=$tabIndex vardef=$fields[$subField] displayType='DetailView'}}&nbsp;
167                                         {{else}}
168                                                 {counter name="panelFieldCount"}
169                                             {{$subField}}
170                                         {{/if}}
171                                     {{/foreach}}
172                                 {{elseif $fields[$colData.field.name]}}
173                                         {counter name="panelFieldCount"}
174                                         {{sugar_field parentFieldArray='fields' vardef=$fields[$colData.field.name] displayType='DetailView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type}}
175                                 {{/if}}
176                                 {{if !empty($colData.field.customCode) && $colData.field.customCodeRenderField}}
177                                     {counter name="panelFieldCount"}
178                                     <span id="{{$colData.field.name}}" class="sugar_field">{{sugar_evalcolumn var=$colData.field colData=$colData}}</span>
179                 {{/if}}
180                                 {{$colData.field.suffix}}
181                                 {{if !empty($colData.field.name)}}
182                                 {/if}
183                                 {{/if}}
184                         </td>
185             {{if !empty($colData.field.hideIf)}}
186                         {else}
187
188                         <td>&nbsp;</td><td>&nbsp;</td>
189                         {/if}
190             {{/if}}
191                 {{/foreach}}
192         </tr>
193         {/capture}
194         {if $fieldsUsed > 0 && $fieldsUsed != $fieldsHidden}
195         {$tableRow}
196         {/if}
197         {{/foreach}}
198         </table>
199     {{if !empty($label) && !is_int($label) && $label != 'DEFAULT' && (!isset($tabDefs[$label_upper].newTab) || (isset($tabDefs[$label_upper].newTab) && $tabDefs[$label_upper].newTab == false))}}
200     <script type="text/javascript">SUGAR.util.doWhen("typeof initPanel == 'function'", function() {ldelim} initPanel({{$smarty.foreach.section.iteration}}, '{{$panelState}}'); {rdelim}); </script>
201     {{/if}}
202 {{/if}}
203 </div>
204 {if $panelFieldCount == 0}
205
206 <script>document.getElementById("{{$label}}").style.display='none';</script>
207 {/if}
208 {{/foreach}}
209 {{if $useTabs}}
210   </div>
211 {{/if}}
212
213 </div>
214 </div>
215 {{include file=$footerTpl}}
216 {{if $useTabs}}
217 <script type='text/javascript' src='{sugar_getjspath file='include/javascript/popup_helper.js'}'></script>
218 <script type="text/javascript" src="{sugar_getjspath file='cache/include/javascript/sugar_grp_yui_widgets.js'}"></script>
219 <script type="text/javascript">
220 var {{$module}}_detailview_tabs = new YAHOO.widget.TabView("{{$module}}_detailview_tabs");
221 {{$module}}_detailview_tabs.selectTab(0);
222 </script>
223 {{/if}}