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 $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"} {sugar_help text=$mod.LBL_SYNC_TO_DETAILVIEW_HELP}
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>
64 {sugar_image name=Delete width=48 height=48}
67 {if ! isset($fromPortal) && ! isset($wireless) && empty($single_panel)}
68 <div id='panelproxy'></div>
70 <div id='rowproxy'></div>
71 <div id='availablefields'>
72 <p id='fillerproxy'></p>
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}
82 {if isset($col.type) && ($col.type == 'address')}
85 {if isset($col.type) && ($col.type == 'phone')}
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" '}
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" '}
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'}
100 {$current_mod_strings[$newLabel]}
102 {sugar_translate label=$newLabel module=$language}
105 {assign var='label' value=$col.label}
106 {if !empty($current_mod_strings[$label])}
107 {$current_mod_strings[$label]}
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>
116 {counter name='idCount' assign='idCount' print=false}
121 <div id='panels' style='float:left; overflow-y:auto; overflow-x:hidden'>
123 <h3>{$layouttitle}</h3>
124 {counter name='idCounter' assign='idCounter' start='1'}
125 {foreach from=$layout item='panel' key='panelid'}
127 <div class='le_panel' id='{$idCount}'>
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'}
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}
141 <span class='panel_id' id='le_panelid_{$idCount}'>{$panelid}</span>
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}
147 <span id="le_paneltype_{$idCount}" style="float:left;">
148 {sugar_translate label="LBL_TABDEF_TYPE" module="ModuleBuilder"} {sugar_help text=$mod.LBL_TABDEF_TYPE_OPTION_HELP}:
150 {assign var="firstpanelid" value=$panelid}
151 {assign var="firstpanelidcount" value=$idCount}
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 <option value="1" {if $tabDefs[$panel_upper].newTab == true}selected="selected"{/if}>{sugar_translate label="LBL_TABDEF_TYPE_OPTION_TAB" module="ModuleBuilder"}</option>
159 <span id="le_panelcollapse_{$idCount}" style="float:right;{if isset($tabDefs[$panel_upper].newTab) && $tabDefs[$panel_upper].newTab == true}display:none;{/if}">
160 {sugar_translate label="LBL_TABDEF_COLLAPSE" module="ModuleBuilder"}?
161 <input type="checkbox" title="{sugar_translate label="LBL_TABDEF_COLLAPSE_HELP" module="ModuleBuilder"}" {if $tabDefs[$panel_upper].panelDefault == "collapsed"}checked="checked"{/if}
162 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}" />
164 {counter name='idCount' assign='idCount' print=false}
166 {foreach from=$panel item='row' key='rid'}
167 <div class='le_row' id='{$idCount}'>
168 {counter name='idCount' assign='idCount' print=false}
170 {foreach from=$row item='col' key='cid'}
171 {assign var="field" value=$col.name}
172 <div class='le_field' id='{$idCount}'>
173 {if ! $fromModuleBuilder && ($col.name != '(filler)')}
174 {capture assign="otherAttributes"}class="le_edit" style="float:right; cursor:pointer;" onclick="editFieldProperties('{$idCount}', '{$col.label}');"{/capture}
175 {sugar_getimage name="edit_inline" ext=".gif" other_attributes=$otherAttributes}
178 {if isset($col.type) && ($col.type == 'address')}
181 {if isset($col.type) && ($col.type == 'phone')}
184 {* BEGIN SUGARCRM flav=pro ONLY *}
185 {if isset($field_defs.$field.calculated) && $field_defs.$field.calculated}
186 {sugar_getimage name="SugarLogic/icon_calculated" alt=$mod_strings.LBL_CALCULATED ext=".png" other_attributes='class="right_icon"'}
188 {if isset($field_defs.$field.dependency) && $field_defs.$field.dependency}
189 {sugar_getimage name="SugarLogic/icon_dependent" ext=".png" alt=$mod_strings.LBL_DEPENDANT other_attributes='class="right_icon"'}
191 {* END SUGARCRM flav=pro ONLY *}
192 <span id='le_label_{$idCount}'>
193 {eval var=$col.label assign='label'}
194 {if !empty($translate) && !empty($col.label)}
195 {sugar_translate label=$label module=$language}
197 {if !empty($current_mod_strings[$label])}
198 {$current_mod_strings[$label]}
199 {elseif !empty($mod[$label])}
205 <span class='field_name'>{$col.name}</span>
206 <span class='field_label'>{$col.label}</span>
207 <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
209 {counter name='idCount' assign='idCount' print=false}
216 {counter name='idCounter' assign='idCounter' print=false}
220 <input type='hidden' id='idCount' value='{$idCount}'>
223 <form name='prepareForSave' id='prepareForSave' action='index.php'>
224 <input type='hidden' name='module' value='ModuleBuilder'>
225 <input type='hidden' name='view_module' value='{$view_module}'>
226 <input type='hidden' name='view' value='{$view}'>
227 <input type='hidden' name="panels_as_tabs" value='{$displayAsTabs}'>
228 {foreach from=$layout item='panel' key='panelid'}
229 {capture name=panel_upper assign=panel_upper}{$panelid|upper}{/capture}
230 <input type="hidden" name="tabDefs_{$panelid}_newTab" value="{if $tabDefs[$panel_upper].newTab == true}1{else}0{/if}" />
231 <input type="hidden" name="tabDefs_{$panelid}_panelDefault" value="{$tabDefs[$panel_upper].panelDefault}" />
233 <input type='hidden' name="sync_detail_and_edit" value='{$syncDetailEditViews}'>
234 <!-- BEGIN SUGARCRM flav=ent ONLY -->
236 <input type='hidden' name='PORTAL' value='1'>
238 <!-- END SUGARCRM flav=ent ONLY -->
239 {if $fromModuleBuilder}
240 <input type='hidden' name='MB' value='1'>
241 <input type='hidden' name='view_package' value='{$view_package}'>
243 <input type='hidden' name='to_pdf' value='1'>
250 var editPanelProperties = function (panelId, view) {
251 panelId = "" + panelId;
252 var key_label = document.getElementById('le_panelid_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
253 var value_label = document.getElementById('le_panelname_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
254 var params = "module=ModuleBuilder&action=editProperty&view_module=" + encodeURIComponent(ModuleBuilder.module)
255 + (ModuleBuilder.package ? "&view_package=" + encodeURIComponent(ModuleBuilder.package) : "")
256 + "&view=" + encodeURIComponent(view) + "&id_label=le_panelname_" + encodeURIComponent(panelId) + "&name_label=label_" + encodeURIComponent(key_label.toUpperCase())
257 + "&title_label=" + encodeURIComponent(SUGAR.language.get("ModuleBuilder", "LBL_LABEL_TITLE")) + "&value_label=" + encodeURIComponent(value_label);
258 ModuleBuilder.getContent(params);
261 var showHideBox = function (newTab, idCount, panelId, firstPanelId, firstPanelIdCount) {
262 var collapseBox = document.getElementById('le_panelcollapse_' + idCount);
264 collapseBox.style.display = 'none';
265 if (idCount != firstPanelIdCount) {
266 document.getElementById('le_paneltype_select_' + firstPanelIdCount).options[1].selected = true;
267 document.getElementById('le_panelcollapse_' + firstPanelIdCount).style.display = 'none';
268 document.forms.prepareForSave['tabDefs_' + firstPanelId + '_newTab'].value = '1';
269 document.getElementById('le_paneltype_select_' + firstPanelIdCount).disabled = true;
273 var elem = document.getElementById('prepareForSave').elements;
275 collapseBox.style.display = 'block';
276 for (var i = 0; i < elem.length; i++) {
277 if (elem[i].name.match(/^tabDefs_.*_newTab$/)) {
278 if (elem[i].value == '1' && elem[i].name != panelId && elem[i].name != 'tabDefs_'+firstPanelId+'_newTab')
282 if (has_tab == false) {
283 document.getElementById('le_paneltype_select_' + firstPanelIdCount).disabled = false;
289 var editFieldProperties = function (idCount, label) {ldelim}
290 var value_label = document.getElementById('le_label_' + idCount).innerHTML.replace(/^\s+|\s+$/g,'');
291 var value_tabindex = document.getElementById('le_tabindex_' + idCount).innerHTML.replace(/^\s+|\s+$/g,'');
292 var title_label = '{sugar_translate label="LBL_LABEL_TITLE" module="ModuleBuilder"}';
293 var title_tabindex = '{sugar_translate label="LBL_TAB_ORDER" module="ModuleBuilder"}';
295 ModuleBuilder.getContent(
296 'module=ModuleBuilder&action=editProperty'
297 + '&view_module={$view_module|escape:'url'}' + '{if $fromModuleBuilder}&view_package={$view_package}{/if}'
298 + '&view={$view|escape:'url'}&id_label=le_label_' + encodeURIComponent(idCount)
299 + '&name_label=label_' + encodeURIComponent(label) + '&title_label=' + encodeURIComponent(title_label)
300 + '&value_label=' + encodeURIComponent(value_label) + '&id_tabindex=le_tabindex_' + encodeURIComponent(idCount)
301 + '&title_tabindex=' + encodeURIComponent(title_tabindex)
302 + '&name_tabindex=tabindex&value_tabindex=' + encodeURIComponent(value_tabindex) );
306 Studio2.firstPanelId = "{$firstpanelid}";
307 Studio2.firstPanelIdCount = {$firstpanelidcount};
309 if('{$view}'.toLowerCase() != 'editview')
310 ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
312 ModuleBuilder.helpUnregisterByID('saveBtn');
314 ModuleBuilder.MBpackage = "{$view_package}";
316 Studio2.requiredFields = [{$required_fields}];
318 //rrs: this is for IE 7 which only supports javascript 1.6 and does not have indexOf support.
319 if (typeof new Array().indexOf == "undefined") {
320 Array.prototype.indexOf = function (obj, start) {
321 for (var i = (start || 0); i < this.length; i++) {
322 if (this[i] == obj) {
330 ModuleBuilder.module = "{$view_module}";
331 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};
334 ModuleBuilder.disablePopupPrompt = {if $syncDetailEditViews}{$syncDetailEditViews}{else}false{/if};