]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/ModuleBuilder/tpls/layoutView.tpl
Release 6.2.2
[Github/sugarcrm.git] / modules / ModuleBuilder / tpls / layoutView.tpl
1 {*
2
3 /*********************************************************************************
4  * SugarCRM Community Edition is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38 *}
39
40
41 {if $disable_layout}
42 <span class='required'>
43 {sugar_translate label="LBL_SYNC_TO_DETAILVIEW_NOTICE" module="ModuleBuilder"}
44 </span>
45 {/if}
46 <table id='layoutEditorButtons' cellspacing='2'>
47     <tr>
48     {$buttons}
49         {if empty($disable_tabs)}
50         <td><input type="checkbox" {if $displayAsTabs}checked="true"{/if} id="tabsCheckbox" onclick="document.forms.prepareForSave.panels_as_tabs.value=this.checked">
51            {sugar_translate label="LBL_TAB_PANELS" module="ModuleBuilder"}&nbsp;{sugar_help text=$mod.LBL_TAB_PANELS_HELP}
52         </input></td>
53         {/if}
54         {if $view == 'editview'}
55         <td><input type="checkbox" {if $syncDetailEditViews}checked="true"{/if} id="syncCheckbox" onclick="document.forms.prepareForSave.sync_detail_and_edit.value=this.checked">
56            {sugar_translate label="LBL_SYNC_TO_DETAILVIEW" module="ModuleBuilder"}&nbsp;{sugar_help text=$mod.LBL_SYNC_TO_DETAILVIEW_HELP}
57         </input></td>
58         {/if}
59     </tr>
60 </table>
61 <div id='layoutEditor' style="width:675px;">
62 <input type='hidden' id='fieldwidth' value='{$fieldwidth}'>
63 <input type='hidden' id='maxColumns' value='{$maxColumns}'>
64 <input type='hidden' id='nextPanelId' value='{$nextPanelId}'>
65 <div id='toolbox' style='float:left; overflow-y:auto; overflow-x:hidden';>
66     <h2 style='margin-bottom:20px;'>{$mod.LBL_TOOLBOX}</h2>
67     
68     <div id='delete'>
69     {sugar_image name=Delete width=48 height=48}
70     </div>
71
72         {if ! isset($fromPortal) && ! isset($wireless) && empty($single_panel)}
73     <div id='panelproxy'></div>
74     {/if}
75     <div id='rowproxy'></div>
76     <div id='availablefields'>
77     <p id='fillerproxy'></p>
78
79     {counter name='idCount' assign='idCount' start='1'}
80     {foreach from=$available_fields item='col' key='id'}
81         {assign var="field" value=$col.name}
82         <div class='le_field' id='{$idCount}'>
83             {if ! $fromModuleBuilder && ($col.name != '(filler)')}
84                 <img class='le_edit' src="{sugar_getimagepath file='edit_inline.gif'}" style='float:right; cursor:pointer;' onclick="editFieldProperties('{$idCount}', '{$col.label}');" />
85             {/if}
86             {if isset($col.type) && ($col.type == 'address')}
87                 {$icon_address}
88             {/if}
89             {if isset($col.type) && ($col.type == 'phone')}
90                 {$icon_phone}
91             {/if}
92             {* BEGIN SUGARCRM flav=pro ONLY *}
93             {if isset($field_defs.$field.calculated) && $field_defs.$field.calculated}
94                 <img src="{sugar_getimagepath file='SugarLogic/icon_calculated.png'}" class="right_icon" />
95             {/if}
96             {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
97                 <img src="{sugar_getimagepath file='SugarLogic/icon_dependent.png'}" class="right_icon" />
98             {/if}
99             {* END SUGARCRM flav=pro ONLY *}
100             <span id='le_label_{$idCount}'>
101             {if !empty($translate) && !empty($col.label)}
102                 {eval var=$col.label assign='newLabel'}
103                 {if $from_mb}
104                 {$current_mod_strings[$newLabel]}
105                 {else}
106                 {sugar_translate label=$newLabel module=$language}
107                 {/if}
108                         {else}
109                 {assign var='label' value=$col.label} 
110                 {if !empty($current_mod_strings[$label])}
111                     {$current_mod_strings[$label]}
112                 {else}
113                         {$label}
114                 {/if}
115             {/if}</span>
116             <span class='field_name'>{$col.name}</span>
117             <span class='field_label'>{$col.label}</span>
118             <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
119         </div>
120         {counter name='idCount' assign='idCount' print=false}
121     {/foreach}
122     </div>
123 </div>
124
125 <div id='panels' style='float:left; overflow-y:auto; overflow-x:hidden'>
126
127 <h3>{$layouttitle}</h3>
128 {foreach from=$layout item='panel' key='panelid'}
129
130     <div class='le_panel' id='{$idCount}'>
131
132         <div class='panel_label' id='le_panellabel_{$idCount}'>
133           <span class='panel_name' id='le_panelname_{$idCount}'>
134                 {capture name=panel_upper assign=panel_upper}{$panelid|upper}{/capture}
135                         {if $panelid eq 'default'}
136                         {$mod.LBL_DEFAULT}
137                         {elseif $from_mb && isset($current_mod_strings.$panel_upper)}
138                 {$current_mod_strings.$panel_upper}
139                         {elseif !empty($translate)}
140                             {sugar_translate label=$panelid|upper module=$language}
141                         {else}
142                             {$panelid}
143                         {/if}</span>
144           <span class='panel_id' id='le_panelid_{$idCount}'>{$panelid}</span>
145         </div>
146         {if $panelid ne 'default'}
147         <img class='le_edit' src="{sugar_getimagepath file='edit_inline.gif'}" style='float:right; cursor:pointer;' onclick="editPanelProperties('{$idCount}')" />
148         {/if}
149         {counter name='idCount' assign='idCount' print=false}
150
151         {foreach from=$panel item='row' key='rid'}
152             <div class='le_row' id='{$idCount}'>
153             {counter name='idCount' assign='idCount' print=false}
154
155             {foreach from=$row item='col' key='cid'}
156                 {assign var="field" value=$col.name}
157                 <div class='le_field' id='{$idCount}'>
158                     {if ! $fromModuleBuilder && ($col.name != '(filler)')}
159                         <img class='le_edit' src="{sugar_getimagepath file='edit_inline.gif'}" 
160                                                 style='float:right; cursor:pointer;' 
161                                                 onclick="editFieldProperties('{$idCount}', '{$col.label}');" />
162                     {/if}
163
164                     {if isset($col.type) && ($col.type == 'address')}
165                         {$icon_address}
166                     {/if}
167                     {if isset($col.type) && ($col.type == 'phone')}
168                         {$icon_phone}
169                     {/if}
170                     {* BEGIN SUGARCRM flav=pro ONLY *}
171                     {if isset($field_defs.$field.calculated) && $field_defs.$field.calculated}
172                         <img src="{sugar_getimagepath file='SugarLogic/icon_calculated.png'}" class="right_icon" />
173                     {/if}
174                     {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
175                         <img src="{sugar_getimagepath file='SugarLogic/icon_dependent.png'}" class="right_icon" />
176                     {/if}
177                     {* END SUGARCRM flav=pro ONLY *}
178                     <span id='le_label_{$idCount}'>
179                     {eval var=$col.label assign='label'}
180                     {if !empty($translate) && !empty($col.label)}
181                         {sugar_translate label=$label module=$language}
182                     {else}
183                                 {if !empty($current_mod_strings[$label])}
184                                     {$current_mod_strings[$label]}
185                                 {elseif !empty($mod[$label])}
186                                     {$mod[$label]}
187                                 {else}
188                                         {$label}
189                                 {/if}
190                             {/if}</span>
191                     <span class='field_name'>{$col.name}</span>
192                     <span class='field_label'>{$col.label}</span>
193                     <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
194                 </div>
195                 {counter name='idCount' assign='idCount' print=false}
196             {/foreach}
197
198         </div>
199     {/foreach}
200
201     </div>
202 {/foreach}
203
204 </div>
205 <input type='hidden' id='idCount' value='{$idCount}'>
206 </div>
207
208 <form name='prepareForSave' id='prepareForSave' action='index.php'>
209 <input type='hidden' name='module' value='ModuleBuilder'>
210 <input type='hidden' name='view_module' value='{$view_module}'>
211 <input type='hidden' name='view' value='{$view}'>
212 <input type='hidden' name="panels_as_tabs" value='{$displayAsTabs}'>
213 <input type='hidden' name="sync_detail_and_edit" value='{$syncDetailEditViews}'>
214 <!-- BEGIN SUGARCRM flav=ent ONLY -->
215 {if $fromPortal}
216     <input type='hidden' name='PORTAL' value='1'>
217 {/if}
218 <!-- END SUGARCRM flav=ent ONLY -->
219 {if $fromModuleBuilder}
220     <input type='hidden' name='MB' value='1'>
221     <input type='hidden' name='view_package' value='{$view_package}'>
222 {/if}
223 <input type='hidden' name='to_pdf' value='1'>
224 </form>
225 <script>
226 {literal}
227
228
229
230 var editPanelProperties = function (panelId, view) {
231     panelId = "" + panelId;
232         var key_label = document.getElementById('le_panelid_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
233         var value_label = document.getElementById('le_panelname_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
234         var params = "module=ModuleBuilder&action=editProperty&view_module=" + encodeURIComponent(ModuleBuilder.module) 
235                     + (ModuleBuilder.package ?  "&view_package=" + encodeURIComponent(ModuleBuilder.package) : "")
236                 + "&view=" + encodeURIComponent(view) + "&id_label=le_panelname_" + encodeURIComponent(panelId) + "&name_label=label_" + encodeURIComponent(key_label.toUpperCase())
237                 + "&title_label=" + encodeURIComponent(SUGAR.language.get("ModuleBuilder", "LBL_LABEL_TITLE")) + "&value_label=" + encodeURIComponent(value_label);
238     ModuleBuilder.getContent(params);
239 }; 
240 {/literal}
241 var editFieldProperties = function (idCount, label) {ldelim}
242         var value_label = document.getElementById('le_label_' + idCount).innerHTML.replace(/^\s+|\s+$/g,''); 
243         var value_tabindex = document.getElementById('le_tabindex_' + idCount).innerHTML.replace(/^\s+|\s+$/g,'');
244         var title_label = '{sugar_translate label="LBL_LABEL_TITLE" module="ModuleBuilder"}';
245         var title_tabindex = '{sugar_translate label="LBL_TAB_ORDER" module="ModuleBuilder"}';
246         
247         ModuleBuilder.getContent(
248                 'module=ModuleBuilder&action=editProperty'
249           + '&view_module={$view_module|escape:'url'}' + '{if $fromModuleBuilder}&view_package={$view_package}{/if}'
250           +     '&view={$view|escape:'url'}&id_label=le_label_' + encodeURIComponent(idCount) 
251           + '&name_label=label_' + encodeURIComponent(label) + '&title_label=' + encodeURIComponent(title_label)
252           + '&value_label=' + encodeURIComponent(value_label) + '&id_tabindex=le_tabindex_' + encodeURIComponent(idCount) 
253           + '&title_tabindex=' + encodeURIComponent(title_tabindex)
254           + '&name_tabindex=tabindex&value_tabindex=' + encodeURIComponent(value_tabindex) );
255         
256 {rdelim}
257
258 Studio2.init();
259 if('{$view}'.toLowerCase() != 'editview')
260     ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
261 if('{$from_mb}')
262     ModuleBuilder.helpUnregisterByID('saveBtn');
263
264 ModuleBuilder.MBpackage = "{$view_package}";
265
266 Studio2.requiredFields = [{$required_fields}];
267 {literal}
268 //rrs: this is for IE 7 which only supports javascript 1.6 and does not have indexOf support.
269 if (typeof new Array().indexOf == "undefined") {
270   Array.prototype.indexOf = function (obj, start) {
271     for (var i = (start || 0); i < this.length; i++) {
272       if (this[i] == obj) {
273         return i;
274       }
275     }
276     return -1;
277   }
278 }
279 {/literal}
280 ModuleBuilder.module = "{$view_module}";
281 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};
282
283
284 ModuleBuilder.disablePopupPrompt = {if $syncDetailEditViews}{$syncDetailEditViews}{else}false{/if};
285 </script>