]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/EditView/EditView.tpl
Release 6.4.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 {{** SUGAR.TabFields variable will be used to track tabindexes for references **}}
42 <span id='tabcounterJS'><script>SUGAR.TabFields=new Array();</script></span>
43
44 <div id="{{$form_name}}_tabs"
45 {{if $useTabs}}
46 class="yui-navset"
47 {{/if}}
48 >
49     {{if $useTabs}}
50     {* Generate the Tab headers *}
51     {{counter name="tabCount" start=-1 print=false assign="tabCount"}}
52     <ul class="yui-nav">
53     {{foreach name=section from=$sectionPanels key=label item=panel}}
54         {{counter name="tabCount" print=false}}
55         <li class="selected"><a id="tab{{$tabCount}}" href="javascript:void({{$tabCount}})"><em>{sugar_translate label='{{$label}}' module='{{$module}}'}</em></a></li>
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" start=-1 print=false assign="panelCount"}}
62
63 {{foreach name=section from=$sectionPanels key=label item=panel}}
64 {{counter name="panelCount" print=false}}
65
66 {{* Print out the table data *}}
67 {{if $label == 'DEFAULT'}}
68         <div id="Default_{$module}_Subpanel">
69 {{else}}
70         <div id="{{$label}}">
71 {{/if}}
72
73 {counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
74 {{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
75 {{* See function.sugar_include.php *}}
76 {{if !is_array($panel)}}
77     {sugar_include type='php' file='{{$panel}}'}
78 {{else}}
79
80 <table width="100%" border="0" cellspacing="1" cellpadding="0"  class="yui3-skin-sam {$def.templateMeta.panelClass|default:'edit view dcQuickEdit edit508'}">
81 {{* Only show header if it is not default or an int value *}}
82 {{if !empty($label) && !is_int($label) && $label != 'DEFAULT' && !$useTabs && $showSectionPanelsTitles}}
83 <tr>
84 <th align="left" colspan="8">
85 <h4>{sugar_translate label='{{$label}}' module='{{$module}}'}</h4>
86 </th>
87 </tr>
88 {{/if}}
89
90 {{assign var='rowCount' value=0}}
91 {{assign var='tabIndexVal' value=0}}
92 {{foreach name=rowIteration from=$panel key=row item=rowData}}
93 {counter name="fieldsUsed" start=0 print=false assign="fieldsUsed"}
94 {capture name="tr" assign="tableRow"}
95 <tr>
96
97         {{math assign="rowCount" equation="$rowCount + 1"}}
98         
99         {{assign var='columnsInRow' value=$rowData|@count}}
100         {{assign var='columnsUsed' value=0}}
101
102     {{* Loop through each column and display *}}
103     {{counter name="colCount" start=0 print=false assign="colCount"}}
104
105         {{foreach name=colIteration from=$rowData key=col item=colData}}
106
107         {{counter name="colCount" print=false}}
108
109         {{if count($rowData) == $colCount}}
110                 {{assign var="colCount" value=0}}
111         {{/if}}
112
113     {{if !empty($colData.field.hideIf)}}
114         {if !({{$colData.field.hideIf}}) }
115     {{/if}}
116
117                 {{if empty($def.templateMeta.labelsOnTop) && empty($colData.field.hideLabel)}}
118                 <td valign="top" id='{{$colData.field.name}}_label' width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope="col">
119                         {{if isset($colData.field.customLabel)}}
120                            <label for="{{$fields[$colData.field.name].name}}">{{$colData.field.customLabel}}</label>
121                         {{elseif isset($colData.field.label)}}
122                            {capture name="label" assign="label"}{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}{/capture}
123                            <label for="{{$fields[$colData.field.name].name}}">{$label|strip_semicolon}:</label>
124                         {{elseif isset($fields[$colData.field.name])}}
125                            {capture name="label" assign="label"}{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}{/capture}
126                            <label for="{{$fields[$colData.field.name].name}}">{$label|strip_semicolon}:</label>
127                         {{else}}
128                             &nbsp;
129                         {{/if}}
130                         {{* Show the required symbol if field is required, but override not set.  Or show if override is set *}}
131                                 {{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
132                                      (isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
133                             <span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
134                         {{/if}}
135             {{if isset($colData.field.popupHelp) || isset($fields[$colData.field.name]) && isset($fields[$colData.field.name].popupHelp) }}
136               {{if isset($colData.field.popupHelp) }}
137                 {capture name="popupText" assign="popupText"}{sugar_translate label="{{$colData.field.popupHelp}}" module='{{$module}}'}{/capture}
138               {{elseif isset($fields[$colData.field.name].popupHelp)}}
139                 {capture name="popupText" assign="popupText"}{sugar_translate label="{{$fields[$colData.field.name].popupHelp}}" module='{{$module}}'}{/capture}
140               {{/if}}
141               {capture name="overlibStuff" assign="overlibStuff"}{overlib_includes}{/capture}
142               {sugar_help text=$popupText WIDTH=-1}
143             {{/if}}
144
145                 </td>
146                 {{/if}}
147                 {counter name="fieldsUsed"}
148                 {{math assign="tabIndexVal" equation="$tabIndexVal + 1"}}
149                 {{if !empty($colData.field.tabindex)  && $colData.field.tabindex !=0}}
150                     {{assign var='tabindex' value=$colData.field.tabindex}}
151             {{** instead of tracking tabindex values for all fields, just track for email as email does not get created directly from
152                 a tpl that has access to smarty values.  Email gets created through addEmailAddress() function in SugarEmailAddress.js
153                 which will use the value in tabFields array
154              **}}
155             {{if $colData.field.name == 'email1'}}<script>SUGAR.TabFields['{{$colData.field.name}}'] = '{{$tabindex}}';</script>{{/if}}
156                 {{else}}
157                     {** if not explicitly assigned, we will default to 0 for 508 compliance reasons, instead of the calculated tabIndexVal value **}
158                     {{assign var='tabindex' value=0}}
159                 {{/if}}
160                 <td valign="top" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}%' {{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}>
161                         {{if !empty($def.templateMeta.labelsOnTop)}}
162                                 {{if isset($colData.field.label)}}
163                                     {{if !empty($colData.field.label)}}
164                                             <label for="{{$fields[$colData.field.name].name}}">{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}:</label>
165                                     {{/if}}
166                                 {{elseif isset($fields[$colData.field.name])}}
167                                         <label for="{{$fields[$colData.field.name].name}}">{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}:</label>
168                                 {{/if}}
169
170                                 {{* Show the required symbol if field is required, but override not set.  Or show if override is set *}}
171                                 {{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
172                                      (isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
173                                     <span class="required" title="{{$APP.LBL_REQUIRED_TITLE}}">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
174                                 {{/if}}
175                                 {{if !isset($colData.field.label) || !empty($colData.field.label)}}
176                                 <br>
177                                 {{/if}}
178                         {{/if}}
179
180
181                         {{if $fields[$colData.field.name] && !empty($colData.field.fields) }}
182                             {{foreach from=$colData.field.fields item=subField}}
183                                 {{if $fields[$subField.name]}}
184                                         {counter name="panelFieldCount"}
185                                     {{sugar_field parentFieldArray='fields' tabindex=$tabindex vardef=$fields[$subField.name] displayType='EditView' displayParams=$subField.displayParams formName=$form_name}}&nbsp;
186                                 {{/if}}
187                             {{/foreach}}
188                         {{elseif !empty($colData.field.customCode) && empty($colData.field.customCodeRenderField)}}
189                                 {counter name="panelFieldCount"}
190                                 {{sugar_evalcolumn var=$colData.field.customCode colData=$colData tabindex=$tabindex}}
191                         {{elseif $fields[$colData.field.name]}}
192                                 {counter name="panelFieldCount"}
193                             {{$colData.displayParams}}
194                                 {{sugar_field parentFieldArray='fields' tabindex=$tabindex vardef=$fields[$colData.field.name] displayType='EditView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type formName=$form_name}}
195                         {{/if}}
196         {{if !empty($colData.field.customCode) && !empty($colData.field.customCodeRenderField)}}
197             {counter name="panelFieldCount"}
198             {{sugar_evalcolumn var=$colData.field.customCode colData=$colData tabindex=$tabindex}}
199     {{/if}}
200     {{if !empty($colData.field.hideIf)}}
201                 {else}
202                 <td></td><td></td>
203                 {/if}
204     {{/if}}
205
206         {{/foreach}}
207 </tr>
208 {/capture}
209 {if $fieldsUsed > 0 }
210 {$tableRow}
211 {/if}
212 {{/foreach}}
213 </table>
214
215 {{/if}}
216
217 </div>
218 {if $panelFieldCount == 0}
219
220 <script>document.getElementById("{{$label}}").style.display='none';</script>
221 {/if}
222 {{/foreach}}
223 </div></div>
224 {{include file=$footerTpl}}
225 {$overlibStuff}
226 {{if $useTabs}}
227 {sugar_getscript file="cache/include/javascript/sugar_grp_yui_widgets.js"}
228 <script type="text/javascript">
229 var {{$form_name}}_tabs = new YAHOO.widget.TabView("{{$form_name}}_tabs");
230 {{$form_name}}_tabs.selectTab(0);
231 </script>
232 {{/if}}
233 <script type="text/javascript">
234 YAHOO.util.Event.onContentReady("{{$form_name}}",
235     function () {ldelim} initEditView(document.forms.{{$form_name}}) {rdelim});
236 //window.setTimeout(, 100);
237 {{if $module == "Users"}}
238 window.onbeforeunload = function () {ldelim} return disableOnUnloadEditView(); {rdelim};
239 {{else}}
240 window.onbeforeunload = function () {ldelim} return onUnloadEditView(); {rdelim};
241 {{/if}}
242 </script>