]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/ModuleBuilder/tpls/layoutView.tpl
Release 6.1.4
[Github/sugarcrm.git] / modules / ModuleBuilder / tpls / layoutView.tpl
1 {*
2
3 /*********************************************************************************
4  * SugarCRM is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6  * 
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.
13  * 
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
17  * details.
18  * 
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
22  * 02110-1301 USA.
23  * 
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.
26  * 
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.
30  * 
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  ********************************************************************************/
37
38 *}
39
40 <table id='layoutEditorButtons' cellspacing='2'>
41     <tr>
42     {$buttons}
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"}&nbsp;{sugar_help text=$mod.LBL_TAB_PANELS_HELP}
46         </input></td>
47         {/if}
48     </tr>
49 </table>
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>
56     
57     <div id='delete'>
58     {sugar_image name=Delete width=48 height=48}
59     </div>
60
61         {if ! isset($fromPortal) && ! isset($wireless) && empty($single_panel)}
62     <div id='panelproxy'></div>
63     {/if}
64     <div id='rowproxy'></div>
65     <div id='availablefields'>
66     <p id='fillerproxy'></p>
67
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}');" />
73             {/if}
74             {if isset($col.type) && ($col.type == 'address')}
75                 {$icon_address}
76             {/if}
77             {if isset($col.type) && ($col.type == 'phone')}
78                 {$icon_phone}
79             {/if}
80             <span id='le_label_{$idCount}'>
81             {if !empty($translate) && !empty($col.label)}
82                 {eval var=$col.label assign='newLabel'}
83                 {if $from_mb}
84                 {$current_mod_strings[$newLabel]}
85                 {else}
86                 {sugar_translate label=$newLabel module=$language}
87                 {/if}
88                         {else}
89                 {assign var='label' value=$col.label} 
90                 {if !empty($current_mod_strings[$label])}
91                     {$current_mod_strings[$label]}
92                 {else}
93                         {$label}
94                 {/if}
95             {/if}</span>
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>
99         </div>
100         {counter name='idCount' assign='idCount' print=false}
101     {/foreach}
102     </div>
103 </div>
104
105 <div id='panels' style='float:left; overflow-y:auto; overflow-x:hidden'>
106
107 <h3>{$layouttitle}</h3>
108 {foreach from=$layout item='panel' key='panelid'}
109
110     <div class='le_panel' id='{$idCount}'>
111
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'}
116                         {$mod.LBL_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}
121                         {else}
122                             {$panelid}
123                         {/if}</span>
124           <span class='panel_id' id='le_panelid_{$idCount}'>{$panelid}</span>
125         </div>
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}')" />
128         {/if}
129         {counter name='idCount' assign='idCount' print=false}
130
131         {foreach from=$panel item='row' key='rid'}
132             <div class='le_row' id='{$idCount}'>
133             {counter name='idCount' assign='idCount' print=false}
134
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}');" />
141                     {/if}
142
143                     {if isset($col.type) && ($col.type == 'address')}
144                         {$icon_address}
145                     {/if}
146                     {if isset($col.type) && ($col.type == 'phone')}
147                         {$icon_phone}
148                     {/if}
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}
153                     {else}
154                                 {if !empty($current_mod_strings[$label])}
155                                     {$current_mod_strings[$label]}
156                                 {elseif !empty($mod[$label])}
157                                     {$mod[$label]}
158                                 {else}
159                                         {$label}
160                                 {/if}
161                             {/if}</span>
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>
165                 </div>
166                 {counter name='idCount' assign='idCount' print=false}
167             {/foreach}
168
169         </div>
170     {/foreach}
171
172     </div>
173 {/foreach}
174
175 </div>
176 <input type='hidden' id='idCount' value='{$idCount}'>
177 </div>
178
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 -->
185 {if $fromPortal}
186     <input type='hidden' name='PORTAL' value='1'>
187 {/if}
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}'>
192 {/if}
193 <input type='hidden' name='to_pdf' value='1'>
194 </form>
195 <script>
196 {literal}
197
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);
207 }; 
208 {/literal}
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 );
220         
221 {rdelim}
222
223 Studio2.init();
224 if('{$view}'.toLowerCase() != 'editview')
225     ModuleBuilder.helpSetup('layoutEditor','default'+'{$view}'.toLowerCase());
226 if('{$from_mb}')
227     ModuleBuilder.helpUnregisterByID('saveBtn');
228
229 ModuleBuilder.MBpackage = "{$view_package}";
230
231 Studio2.requiredFields = [{$required_fields}];
232 {literal}
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) {
238         return i;
239       }
240     }
241     return -1;
242   }
243 }
244 {/literal}
245 ModuleBuilder.module = "{$view_module}";
246 ModuleBuilder.package={if $fromModuleBuilder}"{$view_package}"{else}false{/if};
247 </script>