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