2 /*********************************************************************************
3 * SugarCRM is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
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.
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
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
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.
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.
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 ********************************************************************************/
38 {{include file=$headerTpl}}
39 {sugar_include include=$includes}
42 <div id="{{$form_name}}_tabs"
48 {* Generate the Tab headers *}
49 {{counter name="tabCount" start=-1 print=false assign="tabCount"}}
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>
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"}}
61 {{foreach name=section from=$sectionPanels key=label item=panel}}
62 {{counter name="panelCount" print=false}}
64 {{* Print out the table data *}}
65 {{if $label == 'DEFAULT'}}
66 <div id="Default_{$module}_Subpanel">
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}}'}
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}}
82 <th align="left" colspan="8">
83 <h4>{sugar_translate label='{{$label}}' module='{{$module}}'}</h4>
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"}
94 {{assign var='columnsInRow' value=$rowData|@count}}
95 {{assign var='columnsUsed' value=0}}
97 {{* Loop through each column and display *}}
98 {{counter name="colCount" start=0 print=false assign="colCount"}}
100 {{foreach name=colIteration from=$rowData key=col item=colData}}
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}}
108 {{if !empty($colData.field.hideIf)}}
109 {if !({{$colData.field.hideIf}}) }
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}:
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>
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}
134 {capture name="overlibStuff" assign="overlibStuff"}{overlib_includes}{/capture}
135 {sugar_help text=$popupText WIDTH=-1}
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}}'}:
147 {{elseif isset($fields[$colData.field.name])}}
148 {sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}:
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>
156 {{if !isset($colData.field.label) || !empty($colData.field.label)}}
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}}
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}}
177 {{if !empty($colData.field.hideIf)}}
186 {if $fieldsUsed > 0 }
195 {if $panelFieldCount == 0}
197 <script>document.getElementById("{{$label}}").style.display='none';</script>
201 {{include file=$footerTpl}}
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);
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};