3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
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.
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
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
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.
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.
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 ********************************************************************************/
42 <span class='required'>
43 {sugar_translate label="LBL_SYNC_TO_DETAILVIEW_NOTICE" module="ModuleBuilder"}
46 <table id='layoutEditorButtons' cellspacing='2'>
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"} {sugar_help text=$mod.LBL_TAB_PANELS_HELP}
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"} {sugar_help text=$mod.LBL_SYNC_TO_DETAILVIEW_HELP}
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>
69 {sugar_image name=Delete width=48 height=48}
72 {if ! isset($fromPortal) && ! isset($wireless) && empty($single_panel)}
73 <div id='panelproxy'></div>
75 <div id='rowproxy'></div>
76 <div id='availablefields'>
77 <p id='fillerproxy'></p>
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}');" />
86 {if isset($col.type) && ($col.type == 'address')}
89 {if isset($col.type) && ($col.type == 'phone')}
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" />
96 {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
97 <img src="{sugar_getimagepath file='SugarLogic/icon_dependent.png'}" class="right_icon" />
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'}
104 {$current_mod_strings[$newLabel]}
106 {sugar_translate label=$newLabel module=$language}
109 {assign var='label' value=$col.label}
110 {if !empty($current_mod_strings[$label])}
111 {$current_mod_strings[$label]}
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>
120 {counter name='idCount' assign='idCount' print=false}
125 <div id='panels' style='float:left; overflow-y:auto; overflow-x:hidden'>
127 <h3>{$layouttitle}</h3>
128 {foreach from=$layout item='panel' key='panelid'}
130 <div class='le_panel' id='{$idCount}'>
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'}
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}
144 <span class='panel_id' id='le_panelid_{$idCount}'>{$panelid}</span>
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}')" />
149 {counter name='idCount' assign='idCount' print=false}
151 {foreach from=$panel item='row' key='rid'}
152 <div class='le_row' id='{$idCount}'>
153 {counter name='idCount' assign='idCount' print=false}
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}');" />
164 {if isset($col.type) && ($col.type == 'address')}
167 {if isset($col.type) && ($col.type == 'phone')}
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" />
174 {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
175 <img src="{sugar_getimagepath file='SugarLogic/icon_dependent.png'}" class="right_icon" />
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}
183 {if !empty($current_mod_strings[$label])}
184 {$current_mod_strings[$label]}
185 {elseif !empty($mod[$label])}
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>
195 {counter name='idCount' assign='idCount' print=false}
205 <input type='hidden' id='idCount' value='{$idCount}'>
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 -->
216 <input type='hidden' name='PORTAL' value='1'>
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}'>
223 <input type='hidden' name='to_pdf' value='1'>
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);
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"}';
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) );
259 if('{$view}'.toLowerCase() != 'editview')
260 ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
262 ModuleBuilder.helpUnregisterByID('saveBtn');
264 ModuleBuilder.MBpackage = "{$view_package}";
266 Studio2.requiredFields = [{$required_fields}];
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) {
280 ModuleBuilder.module = "{$view_module}";
281 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};
284 ModuleBuilder.disablePopupPrompt = {if $syncDetailEditViews}{$syncDetailEditViews}{else}false{/if};