]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/ModuleBuilder/tpls/layoutView.tpl
Release 6.5.0
[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-2012 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                 {capture assign="otherAttributes"}class="le_edit" style="float:right; cursor:pointer;" onclick="editFieldProperties('{$idCount}', '{$col.label}');"{/capture}
85                 {sugar_getimage name="edit_inline" ext=".gif" other_attributes=$otherAttributes}
86             {/if}
87             {if isset($col.type) && ($col.type == 'address')}
88                 {$icon_address}
89             {/if}
90             {if isset($col.type) && ($col.type == 'phone')}
91                 {$icon_phone}
92             {/if}
93             {* BEGIN SUGARCRM flav=pro ONLY *}
94             {if isset($field_defs.$field.calculated) && $field_defs.$field.calculated}
95                 {sugar_getimage name="SugarLogic/icon_calculated" alt=$mod_strings.LBL_CALCULATED ext=".png" other_attributes='class="right_icon" '}
96             {/if}
97             {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
98                 {sugar_getimage name="SugarLogic/icon_dependent" ext=".png" alt=$mod_strings.LBL_DEPENDANT other_attributes='class="right_icon" '}
99             {/if}
100             {* END SUGARCRM flav=pro ONLY *}
101             <span id='le_label_{$idCount}'>
102             {if !empty($translate) && !empty($col.label)}
103                 {eval var=$col.label assign='newLabel'}
104                 {if $from_mb}
105                 {$current_mod_strings[$newLabel]}
106                 {else}
107                 {sugar_translate label=$newLabel module=$language}
108                 {/if}
109                         {else}
110                 {assign var='label' value=$col.label} 
111                 {if !empty($current_mod_strings[$label])}
112                     {$current_mod_strings[$label]}
113                 {else}
114                         {$label}
115                 {/if}
116             {/if}</span>
117             <span class='field_name'>{$col.name}</span>
118             <span class='field_label'>{$col.label}</span>
119             <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
120         </div>
121         {counter name='idCount' assign='idCount' print=false}
122     {/foreach}
123     </div>
124 </div>
125
126 <div id='panels' style='float:left; overflow-y:auto; overflow-x:hidden'>
127
128 <h3>{$layouttitle}</h3>
129 {foreach from=$layout item='panel' key='panelid'}
130
131     <div class='le_panel' id='{$idCount}'>
132
133         <div class='panel_label' id='le_panellabel_{$idCount}'>
134           <span class='panel_name' id='le_panelname_{$idCount}'>
135                 {capture name=panel_upper assign=panel_upper}{$panelid|upper}{/capture}
136                         {if $panelid eq 'default'}
137                         {$mod.LBL_DEFAULT}
138                         {elseif $from_mb && isset($current_mod_strings.$panel_upper)}
139                 {$current_mod_strings.$panel_upper}
140                         {elseif !empty($translate)}
141                             {sugar_translate label=$panelid|upper module=$language}
142                         {else}
143                             {$panelid}
144                         {/if}</span>
145           <span class='panel_id' id='le_panelid_{$idCount}'>{$panelid}</span>
146         </div>
147         {if $panelid ne 'default'}
148             {capture assign="otherAttributes"}class="le_edit" style="float:right; cursor:pointer;" onclick="editPanelProperties('{$idCount}');"{/capture}
149             {sugar_getimage name="edit_inline" ext=".gif" other_attributes=$otherAttributes}
150         {/if}
151         {counter name='idCount' assign='idCount' print=false}
152
153         {foreach from=$panel item='row' key='rid'}
154             <div class='le_row' id='{$idCount}'>
155             {counter name='idCount' assign='idCount' print=false}
156
157             {foreach from=$row item='col' key='cid'}
158                 {assign var="field" value=$col.name}
159                 <div class='le_field' id='{$idCount}'>
160                     {if ! $fromModuleBuilder && ($col.name != '(filler)')}
161                         {capture assign="otherAttributes"}class="le_edit" style="float:right; cursor:pointer;" onclick="editFieldProperties('{$idCount}', '{$col.label}');"{/capture}
162                         {sugar_getimage name="edit_inline" ext=".gif" other_attributes=$otherAttributes}
163                     {/if}
164
165                     {if isset($col.type) && ($col.type == 'address')}
166                         {$icon_address}
167                     {/if}
168                     {if isset($col.type) && ($col.type == 'phone')}
169                         {$icon_phone}
170                     {/if}
171                     {* BEGIN SUGARCRM flav=pro ONLY *}
172                     {if isset($field_defs.$field.calculated) && $field_defs.$field.calculated}
173                         {sugar_getimage name="SugarLogic/icon_calculated" alt=$mod_strings.LBL_CALCULATED ext=".png" other_attributes='class="right_icon"'}
174                     {/if}
175                     {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
176                         {sugar_getimage name="SugarLogic/icon_dependent" ext=".png" alt=$mod_strings.LBL_DEPENDANT other_attributes='class="right_icon"'}
177                     {/if}
178                     {* END SUGARCRM flav=pro ONLY *}
179                     <span id='le_label_{$idCount}'>
180                     {eval var=$col.label assign='label'}
181                     {if !empty($translate) && !empty($col.label)}
182                         {sugar_translate label=$label module=$language}
183                     {else}
184                                 {if !empty($current_mod_strings[$label])}
185                                     {$current_mod_strings[$label]}
186                                 {elseif !empty($mod[$label])}
187                                     {$mod[$label]}
188                                 {else}
189                                         {$label}
190                                 {/if}
191                             {/if}</span>
192                     <span class='field_name'>{$col.name}</span>
193                     <span class='field_label'>{$col.label}</span>
194                     <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
195                 </div>
196                 {counter name='idCount' assign='idCount' print=false}
197             {/foreach}
198
199         </div>
200     {/foreach}
201
202     </div>
203 {/foreach}
204
205 </div>
206 <input type='hidden' id='idCount' value='{$idCount}'>
207 </div>
208
209 <form name='prepareForSave' id='prepareForSave' action='index.php'>
210 <input type='hidden' name='module' value='ModuleBuilder'>
211 <input type='hidden' name='view_module' value='{$view_module}'>
212 <input type='hidden' name='view' value='{$view}'>
213 <input type='hidden' name="panels_as_tabs" value='{$displayAsTabs}'>
214 <input type='hidden' name="sync_detail_and_edit" value='{$syncDetailEditViews}'>
215 <!-- BEGIN SUGARCRM flav=ent ONLY -->
216 {if $fromPortal}
217     <input type='hidden' name='PORTAL' value='1'>
218 {/if}
219 <!-- END SUGARCRM flav=ent ONLY -->
220 {if $fromModuleBuilder}
221     <input type='hidden' name='MB' value='1'>
222     <input type='hidden' name='view_package' value='{$view_package}'>
223 {/if}
224 <input type='hidden' name='to_pdf' value='1'>
225 </form>
226 <script>
227 {literal}
228
229
230
231 var editPanelProperties = function (panelId, view) {
232     panelId = "" + panelId;
233         var key_label = document.getElementById('le_panelid_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
234         var value_label = document.getElementById('le_panelname_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
235         var params = "module=ModuleBuilder&action=editProperty&view_module=" + encodeURIComponent(ModuleBuilder.module) 
236                     + (ModuleBuilder.package ?  "&view_package=" + encodeURIComponent(ModuleBuilder.package) : "")
237                 + "&view=" + encodeURIComponent(view) + "&id_label=le_panelname_" + encodeURIComponent(panelId) + "&name_label=label_" + encodeURIComponent(key_label.toUpperCase())
238                 + "&title_label=" + encodeURIComponent(SUGAR.language.get("ModuleBuilder", "LBL_LABEL_TITLE")) + "&value_label=" + encodeURIComponent(value_label);
239     ModuleBuilder.getContent(params);
240 }; 
241 {/literal}
242 var editFieldProperties = function (idCount, label) {ldelim}
243         var value_label = document.getElementById('le_label_' + idCount).innerHTML.replace(/^\s+|\s+$/g,''); 
244         var value_tabindex = document.getElementById('le_tabindex_' + idCount).innerHTML.replace(/^\s+|\s+$/g,'');
245         var title_label = '{sugar_translate label="LBL_LABEL_TITLE" module="ModuleBuilder"}';
246         var title_tabindex = '{sugar_translate label="LBL_TAB_ORDER" module="ModuleBuilder"}';
247         
248         ModuleBuilder.getContent(
249                 'module=ModuleBuilder&action=editProperty'
250           + '&view_module={$view_module|escape:'url'}' + '{if $fromModuleBuilder}&view_package={$view_package}{/if}'
251           +     '&view={$view|escape:'url'}&id_label=le_label_' + encodeURIComponent(idCount) 
252           + '&name_label=label_' + encodeURIComponent(label) + '&title_label=' + encodeURIComponent(title_label)
253           + '&value_label=' + encodeURIComponent(value_label) + '&id_tabindex=le_tabindex_' + encodeURIComponent(idCount) 
254           + '&title_tabindex=' + encodeURIComponent(title_tabindex)
255           + '&name_tabindex=tabindex&value_tabindex=' + encodeURIComponent(value_tabindex) );
256         
257 {rdelim}
258
259 Studio2.init();
260 if('{$view}'.toLowerCase() != 'editview')
261     ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
262 if('{$from_mb}')
263     ModuleBuilder.helpUnregisterByID('saveBtn');
264
265 ModuleBuilder.MBpackage = "{$view_package}";
266
267 Studio2.requiredFields = [{$required_fields}];
268 {literal}
269 //rrs: this is for IE 7 which only supports javascript 1.6 and does not have indexOf support.
270 if (typeof new Array().indexOf == "undefined") {
271   Array.prototype.indexOf = function (obj, start) {
272     for (var i = (start || 0); i < this.length; i++) {
273       if (this[i] == obj) {
274         return i;
275       }
276     }
277     return -1;
278   }
279 }
280 {/literal}
281 ModuleBuilder.module = "{$view_module}";
282 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};
283
284
285 ModuleBuilder.disablePopupPrompt = {if $syncDetailEditViews}{$syncDetailEditViews}{else}false{/if};
286 </script>