3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2013 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 {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>
161 <span id="le_panelcollapse_{$idCount}" style="float:right;{if isset($tabDefs[$panel_upper].newTab) && $tabDefs[$panel_upper].newTab == true}display:none;{/if}">
162 {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}" />
166 {counter name='idCount' assign='idCount' print=false}
168 {foreach from=$panel item='row' key='rid'}
169 <div class='le_row' id='{$idCount}'>
170 {counter name='idCount' assign='idCount' print=false}
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}
180 {if isset($col.type) && ($col.type == 'address')}
183 {if isset($col.type) && ($col.type == 'phone')}
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"'}
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"'}
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}
199 {if !empty($current_mod_strings[$label])}
200 {$current_mod_strings[$label]}
201 {elseif !empty($mod[$label])}
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>
211 {counter name='idCount' assign='idCount' print=false}
218 {counter name='idCounter' assign='idCounter' print=false}
222 <input type='hidden' id='idCount' value='{$idCount}'>
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}" />
235 <input type='hidden' name="sync_detail_and_edit" value='{$syncDetailEditViews}'>
236 <!-- BEGIN SUGARCRM flav=ent ONLY -->
238 <input type='hidden' name='PORTAL' value='1'>
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}'>
245 <input type='hidden' name='to_pdf' value='1'>
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);
263 var showHideBox = function (newTab, idCount, panelId, firstPanelId, firstPanelIdCount) {
264 var collapseBox = document.getElementById('le_panelcollapse_' + idCount);
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;
275 var elem = document.getElementById('prepareForSave').elements;
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')
284 if (has_tab == false) {
285 document.getElementById('le_paneltype_select_' + firstPanelIdCount).disabled = false;
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"}';
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) );
308 Studio2.firstPanelId = "{$firstpanelid}";
309 Studio2.firstPanelIdCount = {$firstpanelidcount};
311 if('{$view}'.toLowerCase() != 'editview')
312 ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
314 ModuleBuilder.helpUnregisterByID('saveBtn');
316 ModuleBuilder.MBpackage = "{$view_package}";
318 Studio2.requiredFields = [{$required_fields}];
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) {
332 ModuleBuilder.module = "{$view_module}";
333 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};
336 ModuleBuilder.disablePopupPrompt = {if $syncDetailEditViews}{$syncDetailEditViews}{else}false{/if};