]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Administration/templates/themeSettings.tpl
Release 6.4.0
[Github/sugarcrm.git] / modules / Administration / templates / themeSettings.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
5  * 
6  * This program is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  * 
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
16  * details.
17  * 
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  * 
23  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25  * 
26  * The interactive user interfaces in modified source and object code versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  * 
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the "Powered by
32  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33  * technical reasons, the Appropriate Legal Notices must display the words
34  * "Powered by SugarCRM".
35  ********************************************************************************/
36
37 *}
38 <script type="text/javascript" src="cache/include/javascript/sugar_grp_yui_widgets.js"></script>
39 <link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
40
41 <form name="themeSettings" method="POST">
42         <input type="hidden" name="module" value="Administration">
43         <input type="hidden" name="action" value="ThemeSettings">
44         <input type="hidden" name="disabled_themes" value="">
45         
46         <table border="0" cellspacing="1" cellpadding="1" class="actionsContainer">
47                 <tr>
48                         <td>
49                         <input title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" onclick="SUGAR.saveThemeSettings();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
50                         <input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.themeSettings.action.value='';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
51                         </td>
52                 </tr>
53         </table>
54         
55         <div class='add_table' style='margin-bottom:5px'>
56                 <table id="themeSettings" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
57             <td nowrap><b>{$MOD.DEFAULT_THEME}</b> &nbsp;
58                 <select name='default_theme' id='default_theme'>{$THEMES}</select>
59             </td>
60                     <tr>
61                                 <td width='1%'>
62                                         <div id="enabled_div"></div>    
63                                 </td>
64                                 <td>
65                                         <div id="disabled_div"></div>
66                                 </td>
67                         </tr>
68                 </table>
69         </div>
70         
71         <table border="0" cellspacing="1" cellpadding="1" class="actionsContainer">
72                 <tr>
73                         <td>
74                                 <input title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" onclick="SUGAR.saveThemeSettings();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
75                                 <input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.themeSettings.action.value='';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
76                         </td>
77                 </tr>
78         </table>
79 </form>
80
81 <script type="text/javascript">
82 (function(){ldelim}
83     var Connect = YAHOO.util.Connect;
84         Connect.url = 'index.php';
85     Connect.method = 'POST';
86     Connect.timeout = 300000; 
87
88         var enabled_modules = {$enabled_modules};
89         var disabled_modules = {$disabled_modules};
90         var lblEnabled = '{sugar_translate label="LBL_ACTIVE_THEMES"}';
91         var lblDisabled = '{sugar_translate label="LBL_DISABLED_THEMES"}';
92         {literal}
93         SUGAR.themeEnabledTable = new YAHOO.SUGAR.DragDropTable(
94                 "enabled_div",
95                 [{key:"theme",  label: lblEnabled, width: 200, sortable: false},
96                 {key:"dir", hidden:true}],
97                 new YAHOO.util.LocalDataSource(enabled_modules, {
98                         responseSchema: {fields : [{key : "theme"}, {key : "dir"}]}
99                 }),  
100                 {height: "300px"}
101         );
102         SUGAR.themeDisabledTable = new YAHOO.SUGAR.DragDropTable(
103                 "disabled_div",
104                 [{key:"theme",  label: lblDisabled, width: 200, sortable: false},
105                 {key:"dir", hidden:true}],
106                 new YAHOO.util.LocalDataSource(disabled_modules, {
107                         responseSchema: {fields : [{key : "theme"}, {key : "dir"}]}
108                 }),
109                 {height: "300px"}
110         );
111         SUGAR.themeEnabledTable.disableEmptyRows = true;
112         SUGAR.themeDisabledTable.disableEmptyRows = true;
113         SUGAR.themeEnabledTable.addRow({module: "", label: ""});
114         SUGAR.themeDisabledTable.addRow({module: "", label: ""});
115         SUGAR.themeEnabledTable.render();
116         SUGAR.themeDisabledTable.render();
117         
118         SUGAR.saveThemeSettings = function()
119         {
120                 var disabledTable = SUGAR.themeDisabledTable;
121                 var themes = [];
122                 for(var i=0; i < disabledTable.getRecordSet().getLength(); i++){
123                         var data = disabledTable.getRecord(i).getData();
124                         if (data.dir && data.dir != '') {
125                             themes[i] = data.dir;
126                             if ( themes[i] == document.getElementById('default_theme').value ) {
127                                 if ( !confirm(SUGAR.language.get('Administration', 'LBL_DEFAULT_THEME_IS_DISABLED')) ) {
128                                     return false;
129                                 }
130                             }
131                         }
132                 }
133                 
134                 ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
135         Connect.asyncRequest(
136             Connect.method, 
137             Connect.url, 
138             {success: SUGAR.saveCallBack},
139                         'to_pdf=1&module=Administration&action=ThemeSettings&default_theme='+document.getElementById('default_theme').value+'&disabled_themes=' + YAHOO.lang.JSON.stringify(themes)
140         );
141                 
142                 return true;
143         }
144         SUGAR.saveCallBack = function(o)
145         {
146            ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
147            if (o.responseText == "true")
148            {
149                window.location.assign('index.php?module=Administration&action=ThemeSettings');
150            } 
151            else 
152            {
153                YAHOO.SUGAR.MessageBox.show({msg:o.responseText});
154            }
155         }       
156 })();
157 {/literal}
158 </script>