2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
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.
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
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
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.
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.
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 ********************************************************************************/
38 <script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
39 <link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
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="">
46 <table border="0" cellspacing="1" cellpadding="1" class="actionsContainer">
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}">
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>
58 <select name='default_theme' id='default_theme'>{$THEMES}</select>
62 <div id="enabled_div"></div>
65 <div id="disabled_div"></div>
71 <table border="0" cellspacing="1" cellpadding="1" class="actionsContainer">
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}">
81 <script type="text/javascript">
83 var Connect = YAHOO.util.Connect;
84 Connect.url = 'index.php';
85 Connect.method = 'POST';
86 Connect.timeout = 300000;
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"}';
93 SUGAR.themeEnabledTable = new YAHOO.SUGAR.DragDropTable(
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"}]}
102 SUGAR.themeDisabledTable = new YAHOO.SUGAR.DragDropTable(
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"}]}
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();
118 SUGAR.saveThemeSettings = function()
120 var disabledTable = SUGAR.themeDisabledTable;
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')) ) {
134 ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
135 Connect.asyncRequest(
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)
144 SUGAR.saveCallBack = function(o)
146 ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
147 if (o.responseText == "true")
149 window.location.assign('index.php?module=Administration&action=ThemeSettings');
153 YAHOO.SUGAR.MessageBox.show({msg:o.responseText});