]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Administration/templates/themeSettings.tpl
Release 6.1.4
[Github/sugarcrm.git] / modules / Administration / templates / themeSettings.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM 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="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">
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                         <tr>
58                                 <td width='1%'>
59                                         <div id="enabled_div"></div>    
60                                 </td>
61                                 <td>
62                                         <div id="disabled_div"></div>
63                                 </td>
64                         </tr>
65                 </table>
66         </div>
67         
68         <table border="0" cellspacing="1" cellpadding="1">
69                 <tr>
70                         <td>
71                                 <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}">
72                                 <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}">
73                         </td>
74                 </tr>
75         </table>
76 </form>
77
78 <script type="text/javascript">
79 (function(){ldelim}
80     var Connect = YAHOO.util.Connect;
81         Connect.url = 'index.php';
82     Connect.method = 'POST';
83     Connect.timeout = 300000; 
84
85         var enabled_modules = {$enabled_modules};
86         var disabled_modules = {$disabled_modules};
87         var lblEnabled = '{sugar_translate label="LBL_ACTIVE_THEMES"}';
88         var lblDisabled = '{sugar_translate label="LBL_DISABLED_THEMES"}';
89         {literal}
90         SUGAR.themeEnabledTable = new YAHOO.SUGAR.DragDropTable(
91                 "enabled_div",
92                 [{key:"theme",  label: lblEnabled, width: 200, sortable: false},
93                 {key:"dir", hidden:true}],
94                 new YAHOO.util.LocalDataSource(enabled_modules, {
95                         responseSchema: {fields : [{key : "theme"}, {key : "dir"}]}
96                 }),  
97                 {height: "300px"}
98         );
99         SUGAR.themeDisabledTable = new YAHOO.SUGAR.DragDropTable(
100                 "disabled_div",
101                 [{key:"theme",  label: lblDisabled, width: 200, sortable: false},
102                 {key:"dir", hidden:true}],
103                 new YAHOO.util.LocalDataSource(disabled_modules, {
104                         responseSchema: {fields : [{key : "theme"}, {key : "dir"}]}
105                 }),
106                 {height: "300px"}
107         );
108         SUGAR.themeEnabledTable.disableEmptyRows = true;
109         SUGAR.themeDisabledTable.disableEmptyRows = true;
110         SUGAR.themeEnabledTable.addRow({module: "", label: ""});
111         SUGAR.themeDisabledTable.addRow({module: "", label: ""});
112         SUGAR.themeEnabledTable.render();
113         SUGAR.themeDisabledTable.render();
114         
115         SUGAR.saveThemeSettings = function()
116         {
117                 var disabledTable = SUGAR.themeDisabledTable;
118                 var themes = [];
119                 for(var i=0; i < disabledTable.getRecordSet().getLength(); i++){
120                         var data = disabledTable.getRecord(i).getData();
121                         if (data.dir && data.dir != '')
122                             themes[i] = data.dir;
123                 }
124                 
125                 ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
126         Connect.asyncRequest(
127             Connect.method, 
128             Connect.url, 
129             {success: SUGAR.saveCallBack},
130                         'to_pdf=1&module=Administration&action=ThemeSettings&disabled_themes=' + YAHOO.lang.JSON.stringify(themes)
131         );
132                 
133                 return true;
134         }
135         SUGAR.saveCallBack = function(o)
136         {
137            ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
138            if (o.responseText == "true")
139            {
140                window.location.assign('index.php?module=Administration&action=ThemeSettings');
141            } 
142            else 
143            {
144                YAHOO.SUGAR.MessageBox.show({msg:o.responseText});
145            }
146         }       
147 })();
148 {/literal}
149 </script>