]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/EditView/EditView.tpl
Release 6.1.4
[Github/sugarcrm.git] / include / EditView / EditView.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM 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 <tr>
91
92         {{assign var='columnsInRow' value=$rowData|@count}}
93         {{assign var='columnsUsed' value=0}}
94
95     {{* Loop through each column and display *}}
96     {{counter name="colCount" start=0 print=false assign="colCount"}}
97
98         {{foreach name=colIteration from=$rowData key=col item=colData}}
99
100         {{counter name="colCount" print=false}}
101         {{math assign="tabIndex" equation="$panelCount * $maxColumns + $colCount"}}
102         {{if count($rowData) == $colCount}}
103                 {{assign var="colCount" value=0}}
104         {{/if}}
105
106
107                 {{if empty($def.templateMeta.labelsOnTop) && empty($colData.field.hideLabel)}}
108                 <td valign="top" id='{{$colData.field.name}}_label' width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope="row">
109                         {{if isset($colData.field.customLabel)}}
110                            {{$colData.field.customLabel}}
111                         {{elseif isset($colData.field.label)}}
112                            {capture name="label" assign="label"}
113                            {sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}
114                            {/capture}
115                            {$label|strip_semicolon}:
116                         {{elseif isset($fields[$colData.field.name])}}
117                            {capture name="label" assign="label"}
118                            {sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}
119                            {/capture}
120                            {$label|strip_semicolon}:
121                         {{/if}}
122                         {{* Show the required symbol if field is required, but override not set.  Or show if override is set *}}
123                         {{if ($fields[$colData.field.name].required && !isset($colData.field.displayParams.required)) || 
124                              (isset($colData.field.displayParams.required) && $colData.field.displayParams.required && $fields[$colData.field.name].required !== false)}}
125                             <span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
126                         {{/if}}
127                 </td>
128                 {{/if}}
129
130                 <td valign="top" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}%' {{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}>
131                         {{if !empty($def.templateMeta.labelsOnTop)}}
132                                 {{if isset($colData.field.label)}}
133                                     {{if !empty($colData.field.label)}}
134                                             {sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}:
135                                     {{/if}}
136                                 {{elseif isset($fields[$colData.field.name])}}
137                                         {sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}:
138                                 {{/if}}
139                                 
140                                 {{* Show the required symbol if field is required, but override not set.  Or show if override is set *}}
141                                 {{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) || 
142                                      (isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
143                                     <span class="required" title="{{$APP.LBL_REQUIRED_TITLE}}">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
144                                 {{/if}}
145                                 {{if !isset($colData.field.label) || !empty($colData.field.label)}}
146                                 <br>
147                                 {{/if}}
148                         {{/if}}
149
150                         
151                         {{if $fields[$colData.field.name] && !empty($colData.field.fields) }}
152                             {{foreach from=$colData.field.fields item=subField}}
153                                 {{if $fields[$subField.name]}}
154                                         {counter name="panelFieldCount"}
155                                     {{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$subField.name] displayType='EditView' displayParams=$subField.displayParams formName=$form_name}}&nbsp;
156                                 {{/if}}
157                             {{/foreach}}
158                         {{elseif !empty($colData.field.customCode)}}
159                                 {counter name="panelFieldCount"}
160                                 {{sugar_evalcolumn var=$colData.field.customCode colData=$colData tabindex=$colData.field.tabindex}}
161                         {{elseif $fields[$colData.field.name]}}
162                                 {counter name="panelFieldCount"}
163                             {{$colData.displayParams}}
164                                 {{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}}
165                         {{/if}}
166
167         {{/foreach}}
168 </tr>
169 {{/foreach}}
170 </table>
171
172 {{/if}}
173
174 </div>
175 {if $panelFieldCount == 0}
176
177 <script>document.getElementById("{{$label}}").style.display='none';</script>
178 {/if}
179 {{/foreach}}
180 </div></div>
181 {{include file=$footerTpl}}
182 {{if $useTabs}}
183 <script type="text/javascript" src="include/javascript/sugar_grp_yui_widgets.js"></script>
184 <script type="text/javascript">
185 var {{$form_name}}_tabs = new YAHOO.widget.TabView("{{$form_name}}_tabs");
186 {{$form_name}}_tabs.selectTab(0);
187 </script> 
188 {{/if}}
189 <script type="text/javascript">
190 YAHOO.util.Event.onContentReady("form_QuickCreate_Accounts", 
191     function () {ldelim} initEditView(document.forms.{{$form_name}}) {rdelim});
192 //window.setTimeout(, 100);
193 window.onbeforeunload = function () {ldelim} return onUnloadEditView(); {rdelim};
194 </script>