]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Studio/wizards/RenameModules.tpl
Release 6.5.0
[Github/sugarcrm.git] / modules / Studio / wizards / RenameModules.tpl
1 {*
2
3 /*********************************************************************************
4  * SugarCRM Community Edition is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2012 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
41 *}
42
43
44 {literal}
45 <style type='text/css'>
46     .slot
47     {
48         border-width:1px;border-color:#999999;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
49     }
50
51     .slotB
52     {
53         border-width:0;cursor:move;
54     }
55     div.moduleTitle
56     {
57         margin-bottom: 5px;
58     }
59 </style>
60 {/literal}
61
62 <table width="100%" border="0" cellspacing="0" cellpadding="0">
63         <tr>
64                 <td>
65            {$title}
66 <table cellspacing="2">
67     <tr>
68         <td colspan="3">{$MOD.LBL_RENAME_MOD_SAVE_HELP}</td>
69     </tr>
70     <tr><td>&nbsp;</td></tr>
71     <tr>
72         <td colspan="3">
73             <input type="button" class="button primary" value="{$MOD.LBL_BTN_SAVE}" id="renameSaveBttn" onclick='validateForm();'name="{$MOD.LBL_BTN_SAVE}" />
74             <input type="button" class="button" value="{$MOD.LBL_BTN_CANCEL}"  id="renameCancelBttn" name="{$MOD.LBL_BTN_CANCEL}" onclick="document.editdropdown.action.value='index'; document.editdropdown.module.value='Administration';document.editdropdown.submit()" />
75         </td>
76     </tr>
77 </table>
78 <div style="height:10px">&nbsp;</div>
79 <table width="100%" border="0" cellspacing="0" cellpadding="0" class='edit view' >
80 <tr>
81     <td>
82         <span class='error'>{$error}</span>
83         <table>
84             <tr>
85                 <td colspan='2'>
86                     <form method='post' action='index.php' name='dropdownsform'>
87                         <input type='hidden' name='action' value='wizard'>
88                         <input type='hidden' name='wizard' value='RenameModules'>
89                         <input type='hidden' name='option' value='EditDropdown'>
90                         <input type='hidden' name='module' value='Studio'>
91                         <input type='hidden' name='dropdown_name' value='{$dropdown_name}'>
92                         {$MOD.LBL_TABGROUP_LANGUAGE} &nbsp;
93                         {html_options name='dropdown_lang' options=$dropdown_languages selected=$dropdown_lang onchange="document.dropdownsform.submit();"}
94                         {sugar_help text=$MOD.LBL_LANGUAGE_TOOLTIP}
95                     </form>
96                 </td>
97             </tr>
98         </table>
99     </td>
100 </tr>
101 <tr>
102     <td>
103 <form method='post' action='index.php' name='editdropdown'>
104 <input type='hidden' name='action' value='wizard'>
105 <input type='hidden' name='wizard' value='RenameModules'>
106 <input type='hidden' name='option' value='SaveDropDown'>
107 <input type='hidden' name='module' value='Studio'>
108 <input type='hidden' name='dropdown_lang' value='{$dropdown_lang}'>
109 <input type='hidden' name='dropdown_name' value='moduleList'>
110
111 <table name='tabDropdown' id='tabDropdown'>
112
113 {counter start=0 name="rowCounter" print=false assign="rowCounter"}
114 {foreach from=$dropdown item="value" key="key"}
115 <tr>
116     <td>
117         <span id='slot{$rowCounter}b' >
118             <span onclick='prepChangeDropDownValue({$rowCounter}, document.getElementById("slot{$rowCounter}_value"));'>{$editImage}</span>
119             &nbsp;
120             <span id ='slot{$rowCounter}_value' onclick='prepChangeDropDownValue({$rowCounter}, this);'>{$value.lang}</span>
121             <span id='slot{$rowCounter}_textspan' style='display:none;'>{$value.user_lang}
122                 <table style="margin-left:15px;">
123                     <tr>
124                         <td align="right">{$MOD.LBL_SINGULAR}</td>
125                         <td align="left"><input id='slot{$rowCounter}_stext' value='{$value.singular}' onchange='setSingularDropDownValue({$rowCounter});' type='text'></td>
126                     </tr>
127                     <tr>
128                         <td align="right">{$MOD.LBL_PLURAL}</td>
129                         <td align="left"><input id='slot{$rowCounter}_text' value='{$value.lang}' type='text'  onchange='setDropDownValue({$rowCounter}, this.value, true)' ></td>
130                     </tr>
131                 </table>
132                 <input name='slot_{$rowCounter}' id='slot_{$rowCounter}' value='{$rowCounter}' type = 'hidden'>
133                 <input type='hidden' name='key_{$rowCounter}' id='key_{$rowCounter}' value='{$key|default:"BLANK"}'>
134                 <input type='hidden' id='delete_{$rowCounter}' name='delete_{$rowCounter}' value='0'>
135                 <input type='hidden' id='slot{$rowCounter}_key' name='slot{$rowCounter}_key' value='{$key}'>
136                 <input name='value_{$rowCounter}' id='value_{$rowCounter}' value='{$value.lang}' type = 'hidden'>
137                 <input name='svalue_{$rowCounter}' id='svalue_{$rowCounter}' value='{$value.singular}' type = 'hidden'>
138             </span>
139         </span>
140     </td>
141 </tr>
142 {counter name="rowCounter"}
143 {/foreach}
144
145 </table>
146 </table>
147
148 {sugar_getscript file="include/javascript/yui/dragdrop.js"}
149 {literal}
150 <script>
151
152     var lastField = '';
153     var lastRowCount = -1;
154     var inputsWithErrors = [];
155     function prepChangeDropDownValue(rowCount, field)
156     {
157         var tempLastField = lastField;
158         if(lastRowCount != -1)
159         {
160             //Check for validation errors first
161             if(checkForErrors(lastRowCount))
162                 return true;
163
164             collapseRow(lastRowCount);
165         }
166         if(tempLastField == field)
167             return;
168         lastField = field;
169         lastRowCount = rowCount;
170
171         field.style.display="none";
172
173         var textspan =  document.getElementById('slot' + rowCount + '_textspan');
174         var text = document.getElementById("slot" + rowCount + "_text");
175         textspan.style.display='inline'
176         text.focus();
177     }
178
179     function checkForErrors(rowCount)
180     {
181         var foundErrors = false;
182         var el1 = document.getElementById("slot" + rowCount + "_text");
183         var el2 = document.getElementById("slot" + rowCount + "_stext");
184
185         if( YAHOO.lang.trim(el1.value) == "")
186         {
187             add_error_style('editdropdown', el1, SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS'),true);
188             foundErrors = true;
189         }
190         if( YAHOO.lang.trim(el2.value) == "")
191         {
192             add_error_style('editdropdown', el2, SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS'),true);
193             foundErrors = true;
194         }
195
196         return foundErrors;
197     }
198
199     /*
200         scrub input for bug 50607: able to enter HTML/JS and execute through module renaming.
201      */
202     function cleanModuleName(val)
203     {
204         return YAHOO.lang.escapeHTML(val);
205     }
206
207     /*
208         pulled out routine to keep scrubbing from being called multiple times
209      */
210     function collapseRow(rowCount)
211     {
212         var text =  document.getElementById('slot' + rowCount + '_text');
213         var textspan =  document.getElementById('slot' + rowCount + '_textspan');
214         var span = document.getElementById('slot' + rowCount + '_value');
215         textspan.style.display = 'none';
216         span.style.display = 'inline';
217         lastField = '';
218         lastRowCount = -1;
219     }
220
221     function setSingularDropDownValue(rowCount)
222     {
223         document.getElementById('svalue_'+ rowCount).value = document.getElementById('slot' + rowCount + '_stext').value;
224     }
225
226     function setDropDownValue(rowCount, val, collapse)
227     {
228         //Check for validation errors first
229         if(checkForErrors(rowCount))
230             return true;
231
232         document.getElementById('value_' + rowCount).value = val;
233
234         var span = document.getElementById('slot' + rowCount + '_value');
235         if(collapse)
236         {
237             span.innerHTML  = cleanModuleName(val);
238             collapseRow(rowCount);
239         }
240
241         setSingularDropDownValue(rowCount);
242     }
243
244     var slotCount = {/literal}{$rowCounter}{literal};
245     var yahooSlots = [];
246
247     function validateForm()
248     {
249         for(i=0;i<slotCount;i++)
250         {
251             if( checkForErrors(i) )
252             {
253                 //Highlight dropdown value if we find an error.
254                 prepChangeDropDownValue(i,  document.getElementById("slot"+i+"_value"));
255                 return;
256             }
257         }
258
259         if(check_form("editdropdown"))
260         {
261             document.editdropdown.submit();
262         }
263
264     }
265 </script>
266 {/literal}
267
268
269 <div id='logDiv' style='display:none'>
270 </div>
271
272 <input type='hidden' name='use_push' value='1'>
273 </form>
274 </td></tr>
275 </table>