]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/EditView/EditView.tpl
Release 6.2.0
[Github/sugarcrm.git] / include / EditView / EditView.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2011 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
41
42 <div id="{{$form_name}}_tabs"
43 {{if $useTabs}}
44 class="yui-navset"
45 {{/if}}
46 >
47     {{if $useTabs}}
48     {* Generate the Tab headers *}
49     {{counter name="tabCount" start=-1 print=false assign="tabCount"}}
50     <ul class="yui-nav">
51     {{foreach name=section from=$sectionPanels key=label item=panel}}
52         {{counter name="tabCount" print=false}}
53         <li class="selected"><a id="tab{{$tabCount}}" href="#tab{{$tabCount}}"><em>{sugar_translate label='{{$label}}' module='{{$module}}'}</em></a></li>
54     {{/foreach}}
55     </ul>
56     {{/if}}
57     <div {{if $useTabs}}class="yui-content"{{/if}}>
58 {{* Loop through all top level panels first *}}
59 {{counter name="panelCount" start=-1 print=false assign="panelCount"}}
60
61 {{foreach name=section from=$sectionPanels key=label item=panel}}
62 {{counter name="panelCount" print=false}}
63
64 {{* Print out the table data *}}
65 {{if $label == 'DEFAULT'}}
66         <div id="Default_{$module}_Subpanel">
67 {{else}}
68         <div id="{{$label}}">
69 {{/if}}
70
71 {counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
72 {{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
73 {{* See function.sugar_include.php *}}
74 {{if !is_array($panel)}}
75     {sugar_include type='php' file='{{$panel}}'}
76 {{else}}
77
78 <table width="100%" border="0" cellspacing="1" cellpadding="0"  class="{$def.templateMeta.panelClass|default:'edit view'}">
79 {{* Only show header if it is not default or an int value *}}
80 {{if !empty($label) && !is_int($label) && $label != 'DEFAULT' && !$useTabs && $showSectionPanelsTitles}}
81 <tr>
82 <th align="left" colspan="8">
83 <h4>{sugar_translate label='{{$label}}' module='{{$module}}'}</h4>
84 </th>
85 </tr>
86 {{/if}}
87
88 {{assign var='rowCount' value=0}}
89 {{foreach name=rowIteration from=$panel key=row item=rowData}}
90 {counter name="fieldsUsed" start=0 print=false assign="fieldsUsed"}
91 {capture name="tr" assign="tableRow"}
92 <tr>
93
94         {{assign var='columnsInRow' value=$rowData|@count}}
95         {{assign var='columnsUsed' value=0}}
96
97     {{* Loop through each column and display *}}
98     {{counter name="colCount" start=0 print=false assign="colCount"}}
99
100         {{foreach name=colIteration from=$rowData key=col item=colData}}
101
102         {{counter name="colCount" print=false}}
103         {{math assign="tabIndex" equation="$panelCount * $maxColumns + $colCount"}}
104         {{if count($rowData) == $colCount}}
105                 {{assign var="colCount" value=0}}
106         {{/if}}
107
108     {{if !empty($colData.field.hideIf)}}
109         {if !({{$colData.field.hideIf}}) }
110     {{/if}}
111
112                 {{if empty($def.templateMeta.labelsOnTop) && empty($colData.field.hideLabel)}}
113                 <td valign="top" id='{{$colData.field.name}}_label' width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope="row">
114                         {{if isset($colData.field.customLabel)}}
115                            {{$colData.field.customLabel}}
116                         {{elseif isset($colData.field.label)}}
117                            {capture name="label" assign="label"}{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}{/capture}
118                            {$label|strip_semicolon}:
119                         {{elseif isset($fields[$colData.field.name])}}
120                            {capture name="label" assign="label"}{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}{/capture}
121                            {$label|strip_semicolon}:
122                         {{/if}}
123                         {{* Show the required symbol if field is required, but override not set.  Or show if override is set *}}
124                                 {{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
125                                      (isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
126                             <span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
127                         {{/if}}
128             {{if isset($colData.field.popupHelp) || isset($fields[$colData.field.name]) && isset($fields[$colData.field.name].popupHelp) }}
129               {{if isset($colData.field.popupHelp) }}
130                 {capture name="popupText" assign="popupText"}{sugar_translate label="{{$colData.field.popupHelp}}" module='{{$module}}'}{/capture}
131               {{elseif isset($fields[$colData.field.name].popupHelp)}}
132                 {capture name="popupText" assign="popupText"}{sugar_translate label="{{$fields[$colData.field.name].popupHelp}}" module='{{$module}}'}{/capture}
133               {{/if}}
134               {capture name="overlibStuff" assign="overlibStuff"}{overlib_includes}{/capture}
135               {sugar_help text=$popupText WIDTH=-1}
136             {{/if}}
137           
138                 </td>
139                 {{/if}}
140                 {counter name="fieldsUsed"}
141                 <td valign="top" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}%' {{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}>
142                         {{if !empty($def.templateMeta.labelsOnTop)}}
143                                 {{if isset($colData.field.label)}}
144                                     {{if !empty($colData.field.label)}}
145                                             {sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}:
146                                     {{/if}}
147                                 {{elseif isset($fields[$colData.field.name])}}
148                                         {sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}:
149                                 {{/if}}
150
151                                 {{* Show the required symbol if field is required, but override not set.  Or show if override is set *}}
152                                 {{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
153                                      (isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
154                                     <span class="required" title="{{$APP.LBL_REQUIRED_TITLE}}">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
155                                 {{/if}}
156                                 {{if !isset($colData.field.label) || !empty($colData.field.label)}}
157                                 <br>
158                                 {{/if}}
159                         {{/if}}
160
161
162                         {{if $fields[$colData.field.name] && !empty($colData.field.fields) }}
163                             {{foreach from=$colData.field.fields item=subField}}
164                                 {{if $fields[$subField.name]}}
165                                         {counter name="panelFieldCount"}
166                                     {{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$subField.name] displayType='EditView' displayParams=$subField.displayParams formName=$form_name}}&nbsp;
167                                 {{/if}}
168                             {{/foreach}}
169                         {{elseif !empty($colData.field.customCode)}}
170                                 {counter name="panelFieldCount"}
171                                 {{sugar_evalcolumn var=$colData.field.customCode colData=$colData tabindex=$colData.field.tabindex}}
172                         {{elseif $fields[$colData.field.name]}}
173                                 {counter name="panelFieldCount"}
174                             {{$colData.displayParams}}
175                                 {{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$colData.field.name] displayType='EditView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type formName=$form_name}}
176                         {{/if}}
177     {{if !empty($colData.field.hideIf)}}
178                 {else}
179                 <td></td><td></td>
180                 {/if}
181     {{/if}}
182
183         {{/foreach}}
184 </tr>
185 {/capture}
186 {if $fieldsUsed > 0 }
187 {$tableRow}
188 {/if}
189 {{/foreach}}
190 </table>
191
192 {{/if}}
193
194 </div>
195 {if $panelFieldCount == 0}
196
197 <script>document.getElementById("{{$label}}").style.display='none';</script>
198 {/if}
199 {{/foreach}}
200 </div></div>
201 {{include file=$footerTpl}}
202 {$overlibStuff}
203 {{if $useTabs}}
204 <script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
205 <script type="text/javascript">
206 var {{$form_name}}_tabs = new YAHOO.widget.TabView("{{$form_name}}_tabs");
207 {{$form_name}}_tabs.selectTab(0);
208 </script>
209 {{/if}}
210 <script type="text/javascript">
211 YAHOO.util.Event.onContentReady("{{$form_name}}",
212     function () {ldelim} initEditView(document.forms.{{$form_name}}) {rdelim});
213 //window.setTimeout(, 100);
214 window.onbeforeunload = function () {ldelim} return onUnloadEditView(); {rdelim};
215 </script>