]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/ModuleBuilder/tpls/layoutView.tpl
Release 6.5.5
[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 $view == 'editview'}
50         <td><input type="checkbox" {if $syncDetailEditViews}checked="true"{/if} id="syncCheckbox" onclick="document.forms.prepareForSave.sync_detail_and_edit.value=this.checked">
51            {sugar_translate label="LBL_SYNC_TO_DETAILVIEW" module="ModuleBuilder"}&nbsp;{sugar_help text=$mod.LBL_SYNC_TO_DETAILVIEW_HELP}
52         </input></td>
53         {/if}
54     </tr>
55 </table>
56 <div id='layoutEditor' style="width:675px;">
57 <input type='hidden' id='fieldwidth' value='{$fieldwidth}'>
58 <input type='hidden' id='maxColumns' value='{$maxColumns}'>
59 <input type='hidden' id='nextPanelId' value='{$nextPanelId}'>
60 <div id='toolbox' style='float:left; overflow-y:auto; overflow-x:hidden';>
61     <h2 style='margin-bottom:20px;'>{$mod.LBL_TOOLBOX}</h2>
62     
63     <div id='delete'>
64     {sugar_image name=Delete width=48 height=48}
65     </div>
66
67         {if ! isset($fromPortal) && ! isset($wireless) && empty($single_panel)}
68     <div id='panelproxy'></div>
69     {/if}
70     <div id='rowproxy'></div>
71     <div id='availablefields'>
72     <p id='fillerproxy'></p>
73
74     {counter name='idCount' assign='idCount' start='1'}
75     {foreach from=$available_fields item='col' key='id'}
76         {assign var="field" value=$col.name}
77         <div class='le_field' id='{$idCount}'>
78             {if ! $fromModuleBuilder && ($col.name != '(filler)')}
79                 {capture assign="otherAttributes"}class="le_edit" style="float:right; cursor:pointer;" onclick="editFieldProperties('{$idCount}', '{$col.label}');"{/capture}
80                 {sugar_getimage name="edit_inline" ext=".gif" other_attributes=$otherAttributes}
81             {/if}
82             {if isset($col.type) && ($col.type == 'address')}
83                 {$icon_address}
84             {/if}
85             {if isset($col.type) && ($col.type == 'phone')}
86                 {$icon_phone}
87             {/if}
88             {* BEGIN SUGARCRM flav=pro ONLY *}
89             {if isset($field_defs.$field.calculated) && $field_defs.$field.calculated}
90                 {sugar_getimage name="SugarLogic/icon_calculated" alt=$mod_strings.LBL_CALCULATED ext=".png" other_attributes='class="right_icon" '}
91             {/if}
92             {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
93                 {sugar_getimage name="SugarLogic/icon_dependent" ext=".png" alt=$mod_strings.LBL_DEPENDANT other_attributes='class="right_icon" '}
94             {/if}
95             {* END SUGARCRM flav=pro ONLY *}
96             <span id='le_label_{$idCount}'>
97             {if !empty($translate) && !empty($col.label)}
98                 {eval var=$col.label assign='newLabel'}
99                 {if $from_mb}
100                 {$current_mod_strings[$newLabel]}
101                 {else}
102                 {sugar_translate label=$newLabel module=$language}
103                 {/if}
104                         {else}
105                 {assign var='label' value=$col.label} 
106                 {if !empty($current_mod_strings[$label])}
107                     {$current_mod_strings[$label]}
108                 {else}
109                         {$label}
110                 {/if}
111             {/if}</span>
112             <span class='field_name'>{$col.name}</span>
113             <span class='field_label'>{$col.label}</span>
114             <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
115         </div>
116         {counter name='idCount' assign='idCount' print=false}
117     {/foreach}
118     </div>
119 </div>
120
121 <div id='panels' style='float:left; overflow-y:auto; overflow-x:hidden'>
122
123 <h3>{$layouttitle}</h3>
124 {counter name='idCounter' assign='idCounter' start='1'}
125 {foreach from=$layout item='panel' key='panelid'}
126
127     <div class='le_panel' id='{$idCount}'>
128
129         <div class='panel_label' id='le_panellabel_{$idCount}'>
130           <span class='panel_name' id='le_panelname_{$idCount}'>
131                 {capture name=panel_upper assign=panel_upper}{$panelid|upper}{/capture}
132                         {if $panelid eq 'default'}
133                         {$mod.LBL_DEFAULT}
134                         {elseif $from_mb && isset($current_mod_strings.$panel_upper)}
135                 {$current_mod_strings.$panel_upper}
136                         {elseif !empty($translate)}
137                             {sugar_translate label=$panelid|upper module=$language}
138                         {else}
139                             {$panelid}
140                         {/if}</span>
141           <span class='panel_id' id='le_panelid_{$idCount}'>{$panelid}</span>
142         </div>
143         {if $panelid ne 'default'}
144             {capture assign="otherAttributes"}class="le_edit" style="float:left; cursor:pointer;" onclick="editPanelProperties('{$idCount}');"{/capture}
145             {sugar_getimage name="edit_inline" ext=".gif" other_attributes=$otherAttributes}
146         {/if}
147         <span id="le_paneltype_{$idCount}" style="float:left;">
148         &nbsp;&nbsp;{sugar_translate label="LBL_TABDEF_TYPE" module="ModuleBuilder"}&nbsp;{sugar_help text=$mod.LBL_TABDEF_TYPE_OPTION_HELP}:
149         {if $idCounter == 1}
150             {assign var="firstpanelid" value=$panelid}
151             {assign var="firstpanelidcount" value=$idCount}
152         {/if}
153         <select id="le_paneltype_select_{$idCount}" onchange="document.forms.prepareForSave.tabDefs_{$panelid}_newTab.value=this.value; showHideBox(this.value, {$idCount}, '{$panelid}', '{$firstpanelid}', {$firstpanelidcount});"
154                 title="{sugar_translate label="LBL_TABDEF_TYPE_HELP" module="ModuleBuilder"}">
155           <option value="0" {if $tabDefs[$panel_upper].newTab == false}selected="selected"{/if}>{sugar_translate label="LBL_TABDEF_TYPE_OPTION_PANEL" module="ModuleBuilder"}</option>
156           {if $disable_tabs != true}
157           <option value="1" {if $tabDefs[$panel_upper].newTab == true}selected="selected"{/if}>{sugar_translate label="LBL_TABDEF_TYPE_OPTION_TAB" module="ModuleBuilder"}</option>
158           {/if}
159         </select>
160         </span>
161         <span id="le_panelcollapse_{$idCount}" style="float:right;{if isset($tabDefs[$panel_upper].newTab) && $tabDefs[$panel_upper].newTab == true}display:none;{/if}">
162         &nbsp;{sugar_translate label="LBL_TABDEF_COLLAPSE" module="ModuleBuilder"}?
163         <input type="checkbox" title="{sugar_translate label="LBL_TABDEF_COLLAPSE_HELP" module="ModuleBuilder"}" {if $tabDefs[$panel_upper].panelDefault == "collapsed"}checked="checked"{/if}
164           onclick="{literal}if(this.checked) { document.forms.prepareForSave.tabDefs_{/literal}{$panelid}{literal}_panelDefault.value='collapsed'; } else { document.forms.prepareForSave.tabDefs_{/literal}{$panelid}{literal}_panelDefault.value='expanded';}{/literal}" />
165         </span>
166         {counter name='idCount' assign='idCount' print=false}
167
168         {foreach from=$panel item='row' key='rid'}
169             <div class='le_row' id='{$idCount}'>
170             {counter name='idCount' assign='idCount' print=false}
171
172             {foreach from=$row item='col' key='cid'}
173                 {assign var="field" value=$col.name}
174                 <div class='le_field' id='{$idCount}'>
175                     {if ! $fromModuleBuilder && ($col.name != '(filler)')}
176                         {capture assign="otherAttributes"}class="le_edit" style="float:right; cursor:pointer;" onclick="editFieldProperties('{$idCount}', '{$col.label}');"{/capture}
177                         {sugar_getimage name="edit_inline" ext=".gif" other_attributes=$otherAttributes}
178                     {/if}
179
180                     {if isset($col.type) && ($col.type == 'address')}
181                         {$icon_address}
182                     {/if}
183                     {if isset($col.type) && ($col.type == 'phone')}
184                         {$icon_phone}
185                     {/if}
186                     {* BEGIN SUGARCRM flav=pro ONLY *}
187                     {if isset($field_defs.$field.calculated) && $field_defs.$field.calculated}
188                         {sugar_getimage name="SugarLogic/icon_calculated" alt=$mod_strings.LBL_CALCULATED ext=".png" other_attributes='class="right_icon"'}
189                     {/if}
190                     {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
191                         {sugar_getimage name="SugarLogic/icon_dependent" ext=".png" alt=$mod_strings.LBL_DEPENDANT other_attributes='class="right_icon"'}
192                     {/if}
193                     {* END SUGARCRM flav=pro ONLY *}
194                     <span id='le_label_{$idCount}'>
195                     {eval var=$col.label assign='label'}
196                     {if !empty($translate) && !empty($col.label)}
197                         {sugar_translate label=$label module=$language}
198                     {else}
199                                 {if !empty($current_mod_strings[$label])}
200                                     {$current_mod_strings[$label]}
201                                 {elseif !empty($mod[$label])}
202                                     {$mod[$label]}
203                                 {else}
204                                         {$label}
205                                 {/if}
206                             {/if}</span>
207                     <span class='field_name'>{$col.name}</span>
208                     <span class='field_label'>{$col.label}</span>
209                     <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
210                 </div>
211                 {counter name='idCount' assign='idCount' print=false}
212             {/foreach}
213
214         </div>
215     {/foreach}
216
217     </div>
218     {counter name='idCounter' assign='idCounter' print=false}
219 {/foreach}
220
221 </div>
222 <input type='hidden' id='idCount' value='{$idCount}'>
223 </div>
224
225 <form name='prepareForSave' id='prepareForSave' action='index.php'>
226 <input type='hidden' name='module' value='ModuleBuilder'>
227 <input type='hidden' name='view_module' value='{$view_module}'>
228 <input type='hidden' name='view' value='{$view}'>
229 <input type='hidden' name="panels_as_tabs" value='{$displayAsTabs}'>
230 {foreach from=$layout item='panel' key='panelid'}
231 {capture name=panel_upper assign=panel_upper}{$panelid|upper}{/capture}
232 <input type="hidden" name="tabDefs_{$panelid}_newTab" value="{if $tabDefs[$panel_upper].newTab == true}1{else}0{/if}" />
233 <input type="hidden" name="tabDefs_{$panelid}_panelDefault" value="{$tabDefs[$panel_upper].panelDefault}" />
234 {/foreach}
235 <input type='hidden' name="sync_detail_and_edit" value='{$syncDetailEditViews}'>
236 <!-- BEGIN SUGARCRM flav=ent ONLY -->
237 {if $fromPortal}
238     <input type='hidden' name='PORTAL' value='1'>
239 {/if}
240 <!-- END SUGARCRM flav=ent ONLY -->
241 {if $fromModuleBuilder}
242     <input type='hidden' name='MB' value='1'>
243     <input type='hidden' name='view_package' value='{$view_package}'>
244 {/if}
245 <input type='hidden' name='to_pdf' value='1'>
246 </form>
247 <script>
248 {literal}
249
250
251
252 var editPanelProperties = function (panelId, view) {
253     panelId = "" + panelId;
254         var key_label = document.getElementById('le_panelid_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
255         var value_label = document.getElementById('le_panelname_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
256         var params = "module=ModuleBuilder&action=editProperty&view_module=" + encodeURIComponent(ModuleBuilder.module) 
257                     + (ModuleBuilder.package ?  "&view_package=" + encodeURIComponent(ModuleBuilder.package) : "")
258                 + "&view=" + encodeURIComponent(view) + "&id_label=le_panelname_" + encodeURIComponent(panelId) + "&name_label=label_" + encodeURIComponent(key_label.toUpperCase())
259                 + "&title_label=" + encodeURIComponent(SUGAR.language.get("ModuleBuilder", "LBL_LABEL_TITLE")) + "&value_label=" + encodeURIComponent(value_label);
260     ModuleBuilder.getContent(params);
261 };
262
263 var showHideBox = function (newTab, idCount, panelId, firstPanelId, firstPanelIdCount) {
264     var collapseBox = document.getElementById('le_panelcollapse_' + idCount);
265     if (newTab == "1") {
266         collapseBox.style.display = 'none';
267         if (idCount != firstPanelIdCount) {
268             document.getElementById('le_paneltype_select_' + firstPanelIdCount).options[1].selected = true;
269             document.getElementById('le_panelcollapse_' + firstPanelIdCount).style.display = 'none';
270             document.forms.prepareForSave['tabDefs_' + firstPanelId + '_newTab'].value = '1';
271             document.getElementById('le_paneltype_select_' + firstPanelIdCount).disabled = true;
272         }
273     }
274     else {
275         var elem = document.getElementById('prepareForSave').elements;
276         var has_tab = false;
277         collapseBox.style.display = 'block';
278         for (var i = 0; i < elem.length; i++) {
279             if (elem[i].name.match(/^tabDefs_.*_newTab$/)) {
280                 if (elem[i].value == '1' && elem[i].name != panelId && elem[i].name != 'tabDefs_'+firstPanelId+'_newTab')
281                     has_tab = true;
282             }
283         }
284         if (has_tab == false) {
285             document.getElementById('le_paneltype_select_' + firstPanelIdCount).disabled = false;
286         }
287     }
288 };
289
290 {/literal}
291 var editFieldProperties = function (idCount, label) {ldelim}
292         var value_label = document.getElementById('le_label_' + idCount).innerHTML.replace(/^\s+|\s+$/g,''); 
293         var value_tabindex = document.getElementById('le_tabindex_' + idCount).innerHTML.replace(/^\s+|\s+$/g,'');
294         var title_label = '{sugar_translate label="LBL_LABEL_TITLE" module="ModuleBuilder"}';
295         var title_tabindex = '{sugar_translate label="LBL_TAB_ORDER" module="ModuleBuilder"}';
296         
297         ModuleBuilder.getContent(
298                 'module=ModuleBuilder&action=editProperty'
299           + '&view_module={$view_module|escape:'url'}' + '{if $fromModuleBuilder}&view_package={$view_package}{/if}'
300           +     '&view={$view|escape:'url'}&id_label=le_label_' + encodeURIComponent(idCount) 
301           + '&name_label=label_' + encodeURIComponent(label) + '&title_label=' + encodeURIComponent(title_label)
302           + '&value_label=' + encodeURIComponent(value_label) + '&id_tabindex=le_tabindex_' + encodeURIComponent(idCount) 
303           + '&title_tabindex=' + encodeURIComponent(title_tabindex)
304           + '&name_tabindex=tabindex&value_tabindex=' + encodeURIComponent(value_tabindex) );
305         
306 {rdelim}
307
308 Studio2.firstPanelId = "{$firstpanelid}";
309 Studio2.firstPanelIdCount = {$firstpanelidcount};
310 Studio2.init();
311 if('{$view}'.toLowerCase() != 'editview')
312     ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
313 if('{$from_mb}')
314     ModuleBuilder.helpUnregisterByID('saveBtn');
315
316 ModuleBuilder.MBpackage = "{$view_package}";
317
318 Studio2.requiredFields = [{$required_fields}];
319 {literal}
320 //rrs: this is for IE 7 which only supports javascript 1.6 and does not have indexOf support.
321 if (typeof new Array().indexOf == "undefined") {
322   Array.prototype.indexOf = function (obj, start) {
323     for (var i = (start || 0); i < this.length; i++) {
324       if (this[i] == obj) {
325         return i;
326       }
327     }
328     return -1;
329   }
330 }
331 {/literal}
332 ModuleBuilder.module = "{$view_module}";
333 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};
334
335
336 ModuleBuilder.disablePopupPrompt = {if $syncDetailEditViews}{$syncDetailEditViews}{else}false{/if};
337 </script>