3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2012 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 {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}
87 {if isset($col.type) && ($col.type == 'address')}
90 {if isset($col.type) && ($col.type == 'phone')}
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" '}
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" '}
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'}
105 {$current_mod_strings[$newLabel]}
107 {sugar_translate label=$newLabel module=$language}
110 {assign var='label' value=$col.label}
111 {if !empty($current_mod_strings[$label])}
112 {$current_mod_strings[$label]}
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>
121 {counter name='idCount' assign='idCount' print=false}
126 <div id='panels' style='float:left; overflow-y:auto; overflow-x:hidden'>
128 <h3>{$layouttitle}</h3>
129 {foreach from=$layout item='panel' key='panelid'}
131 <div class='le_panel' id='{$idCount}'>
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'}
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}
145 <span class='panel_id' id='le_panelid_{$idCount}'>{$panelid}</span>
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}
151 {counter name='idCount' assign='idCount' print=false}
153 {foreach from=$panel item='row' key='rid'}
154 <div class='le_row' id='{$idCount}'>
155 {counter name='idCount' assign='idCount' print=false}
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}
165 {if isset($col.type) && ($col.type == 'address')}
168 {if isset($col.type) && ($col.type == 'phone')}
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"'}
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"'}
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}
184 {if !empty($current_mod_strings[$label])}
185 {$current_mod_strings[$label]}
186 {elseif !empty($mod[$label])}
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>
196 {counter name='idCount' assign='idCount' print=false}
206 <input type='hidden' id='idCount' value='{$idCount}'>
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 -->
217 <input type='hidden' name='PORTAL' value='1'>
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}'>
224 <input type='hidden' name='to_pdf' value='1'>
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);
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"}';
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) );
260 if('{$view}'.toLowerCase() != 'editview')
261 ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
263 ModuleBuilder.helpUnregisterByID('saveBtn');
265 ModuleBuilder.MBpackage = "{$view_package}";
267 Studio2.requiredFields = [{$required_fields}];
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) {
281 ModuleBuilder.module = "{$view_module}";
282 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};
285 ModuleBuilder.disablePopupPrompt = {if $syncDetailEditViews}{$syncDetailEditViews}{else}false{/if};