3 /*********************************************************************************
4 * SugarCRM 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 ********************************************************************************/
40 <table id='layoutEditorButtons' cellspacing='2'>
43 {if empty($disable_tabs)}
44 <td><input type="checkbox" {if $displayAsTabs}checked="true"{/if} id="tabsCheckbox" onclick="document.forms.prepareForSave.panels_as_tabs.value=this.checked">
45 {sugar_translate label="LBL_TAB_PANELS" module="ModuleBuilder"} {sugar_help text=$mod.LBL_TAB_PANELS_HELP}
50 <div id='layoutEditor' style="width:675px;">
51 <input type='hidden' id='fieldwidth' value='{$fieldwidth}'>
52 <input type='hidden' id='maxColumns' value='{$maxColumns}'>
53 <input type='hidden' id='nextPanelId' value='{$nextPanelId}'>
54 <div id='toolbox' style='float:left; overflow-y:auto; overflow-x:hidden';>
55 <h2 style='margin-bottom:20px;'>{$mod.LBL_TOOLBOX}</h2>
58 {sugar_image name=Delete width=48 height=48}
61 {if ! isset($fromPortal) && ! isset($wireless) && empty($single_panel)}
62 <div id='panelproxy'></div>
64 <div id='rowproxy'></div>
65 <div id='availablefields'>
66 <p id='fillerproxy'></p>
68 {counter name='idCount' assign='idCount' start='1'}
69 {foreach from=$available_fields item='col' key='id'}
70 <div class='le_field' id='{$idCount}'>
71 {if ! $fromModuleBuilder && ($col.name != '(filler)')}
72 <img class='le_edit' src="{sugar_getimagepath file='edit_inline.gif'}" style='float:right; cursor:pointer;' onclick="editFieldProperties('{$idCount}', '{$col.label}');" />
74 {if isset($col.type) && ($col.type == 'address')}
77 {if isset($col.type) && ($col.type == 'phone')}
80 <span id='le_label_{$idCount}'>
81 {if !empty($translate) && !empty($col.label)}
82 {eval var=$col.label assign='newLabel'}
84 {$current_mod_strings[$newLabel]}
86 {sugar_translate label=$newLabel module=$language}
89 {assign var='label' value=$col.label}
90 {if !empty($current_mod_strings[$label])}
91 {$current_mod_strings[$label]}
96 <span class='field_name'>{$col.name}</span>
97 <span class='field_label'>{$col.label}</span>
98 <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
100 {counter name='idCount' assign='idCount' print=false}
105 <div id='panels' style='float:left; overflow-y:auto; overflow-x:hidden'>
107 <h3>{$layouttitle}</h3>
108 {foreach from=$layout item='panel' key='panelid'}
110 <div class='le_panel' id='{$idCount}'>
112 <div class='panel_label' id='le_panellabel_{$idCount}'>
113 <span class='panel_name' id='le_panelname_{$idCount}'>
114 {capture name=panel_upper assign=panel_upper}{$panelid|upper}{/capture}
115 {if $panelid eq 'default'}
117 {elseif $from_mb && isset($current_mod_strings.$panel_upper)}
118 {$current_mod_strings.$panel_upper}
119 {elseif !empty($translate)}
120 {sugar_translate label=$panelid|upper module=$language}
124 <span class='panel_id' id='le_panelid_{$idCount}'>{$panelid}</span>
126 {if $panelid ne 'default'}
127 <img class='le_edit' src="{sugar_getimagepath file='edit_inline.gif'}" style='float:right; cursor:pointer;' onclick="editPanelProperties('{$idCount}')" />
129 {counter name='idCount' assign='idCount' print=false}
131 {foreach from=$panel item='row' key='rid'}
132 <div class='le_row' id='{$idCount}'>
133 {counter name='idCount' assign='idCount' print=false}
135 {foreach from=$row item='col' key='cid'}
136 <div class='le_field' id='{$idCount}'>
137 {if ! $fromModuleBuilder && ($col.name != '(filler)')}
138 <img class='le_edit' src="{sugar_getimagepath file='edit_inline.gif'}"
139 style='float:right; cursor:pointer;'
140 onclick="editFieldProperties('{$idCount}', '{$col.label}');" />
143 {if isset($col.type) && ($col.type == 'address')}
146 {if isset($col.type) && ($col.type == 'phone')}
149 <span id='le_label_{$idCount}'>
150 {eval var=$col.label assign='label'}
151 {if !empty($translate) && !empty($col.label)}
152 {sugar_translate label=$label module=$language}
154 {if !empty($current_mod_strings[$label])}
155 {$current_mod_strings[$label]}
156 {elseif !empty($mod[$label])}
162 <span class='field_name'>{$col.name}</span>
163 <span class='field_label'>{$col.label}</span>
164 <span id='le_tabindex_{$idCount}' class='field_tabindex'>{$col.tabindex}</span>
166 {counter name='idCount' assign='idCount' print=false}
176 <input type='hidden' id='idCount' value='{$idCount}'>
179 <form name='prepareForSave' id='prepareForSave' action='index.php'>
180 <input type='hidden' name='module' value='ModuleBuilder'>
181 <input type='hidden' name='view_module' value='{$view_module}'>
182 <input type='hidden' name='view' value='{$view}'>
183 <input type='hidden' name="panels_as_tabs" value='{$displayAsTabs}'>
184 <!-- BEGIN SUGARCRM flav=ent ONLY -->
186 <input type='hidden' name='PORTAL' value='1'>
188 <!-- END SUGARCRM flav=ent ONLY -->
189 {if $fromModuleBuilder}
190 <input type='hidden' name='MB' value='1'>
191 <input type='hidden' name='view_package' value='{$view_package}'>
193 <input type='hidden' name='to_pdf' value='1'>
198 var editPanelProperties = function (panelId, view) {
199 panelId = "" + panelId;
200 var key_label = document.getElementById('le_panelid_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
201 var value_label = document.getElementById('le_panelname_' + panelId).innerHTML.replace(/^\s+|\s+$/g,'');
202 var params = "module=ModuleBuilder&action=editProperty&view_module=" + ModuleBuilder.module
203 + (ModuleBuilder.package ? "&view_package=" + ModuleBuilder.package : "")
204 + "&view=" + view + "&id_label=le_panelname_" + panelId + "&name_label=label_" + key_label.toUpperCase()
205 + "&title_label=" + SUGAR.language.get("ModuleBuilder", "LBL_LABEL_TITLE") + "&value_label=" + value_label;
206 ModuleBuilder.getContent(params);
209 var editFieldProperties = function (idCount, label) {ldelim}
210 var value_label = document.getElementById('le_label_' + idCount).innerHTML.replace(/^\s+|\s+$/g,'');
211 var value_tabindex = document.getElementById('le_tabindex_' + idCount).innerHTML.replace(/^\s+|\s+$/g,'');
212 ModuleBuilder.getContent(
213 'module=ModuleBuilder&action=editProperty'
214 + '&view_module={$view_module}' + '{if $fromModuleBuilder}&view_package={$view_package}{/if}'
215 + '&view={$view}&id_label=le_label_' + idCount
216 + '&name_label=label_' + label + '&title_label={sugar_translate label="LBL_LABEL_TITLE" module="ModuleBuilder"}'
217 + '&value_label=' + value_label + '&id_tabindex=le_tabindex_' + idCount
218 + '&title_tabindex={sugar_translate label="LBL_TAB_ORDER" module="ModuleBuilder"}'
219 + '&name_tabindex=tabindex&value_tabindex=' + value_tabindex );
224 if('{$view}'.toLowerCase() != 'editview')
225 ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
227 ModuleBuilder.helpUnregisterByID('saveBtn');
229 ModuleBuilder.MBpackage = "{$view_package}";
231 Studio2.requiredFields = [{$required_fields}];
233 //rrs: this is for IE 7 which only supports javascript 1.6 and does not have indexOf support.
234 if (typeof new Array().indexOf == "undefined") {
235 Array.prototype.indexOf = function (obj, start) {
236 for (var i = (start || 0); i < this.length; i++) {
237 if (this[i] == obj) {
245 ModuleBuilder.module = "{$view_module}";
246 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};