2 /*********************************************************************************
3 * SugarCRM 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="include/javascript/sugar_grp_yui_widgets.js"></script>
40 <link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
41 <style>.yui-dt-scrollable .yui-dt-bd {ldelim}overflow-x: hidden;{rdelim}</style>
43 <table width="100%" border="0" cellspacing="0" cellpadding="0">
44 <tr><td colspan='100'><h2>{$title}</h2></td></tr>
45 <tr><td><i class="info">{$msg}</i></td></tr>
48 <form name="ConfigureShortcutBar" method="POST" method="POST" action="index.php">
49 <input type="hidden" name="module" value="Administration">
50 <input type="hidden" name="action" value="ConfigureShortcutBar">
51 <input type="hidden" id="enabled_modules" name="enabled_modules" value="">
52 <input type="hidden" name="return_module" value="{$RETURN_MODULE}">
53 <input type="hidden" name="return_action" value="{$RETURN_ACTION}">
55 <table border="0" cellspacing="1" cellpadding="1">
58 <input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="SUGAR.saveShortcutBar();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" >
59 <input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
63 <div class='add_table' style='margin-bottom:5px'>
64 <table id="ConfigureTabs" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
67 <div id="enabled_div"></div>
70 <div id="disabled_div"></div>
76 <table border="0" cellspacing="1" cellpadding="1">
79 <input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="SUGAR.saveShortcutBar();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" >
80 <input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
86 <script type="text/javascript">
88 var Connect = YAHOO.util.Connect;
89 Connect.url = 'index.php';
90 Connect.method = 'POST';
91 Connect.timeout = 300000;
93 var enabled_modules = {$enabled_modules};
94 var disabled_modules = {$disabled_modules};
95 var lblEnabled = '{sugar_translate label="LBL_ACTIVE_MODULES"}';
96 var lblDisabled = '{sugar_translate label="LBL_DISABLED_MODULES"}';
98 SUGAR.prodEnabledTable = new YAHOO.SUGAR.DragDropTable(
100 [{key:"label", label: lblEnabled, width: 200, sortable: false},
101 {key:"module", label: lblEnabled, hidden:true}],
102 new YAHOO.util.LocalDataSource(enabled_modules, {
104 resultsList : "modules",
105 fields : [{key : "module"}, {key : "label"}]
110 SUGAR.prodDisabledTable = new YAHOO.SUGAR.DragDropTable(
112 [{key:"label", label: lblDisabled, width: 200, sortable: false},
113 {key:"module", label: lblDisabled, hidden:true}],
114 new YAHOO.util.LocalDataSource(disabled_modules, {
116 resultsList : "modules",
117 fields : [{key : "module"}, {key : "label"}]
122 SUGAR.prodEnabledTable.disableEmptyRows = true;
123 SUGAR.prodDisabledTable.disableEmptyRows = true;
124 SUGAR.prodEnabledTable.addRow({module: "", label: ""});
125 SUGAR.prodDisabledTable.addRow({module: "", label: ""});
126 SUGAR.prodEnabledTable.render();
127 SUGAR.prodDisabledTable.render();
129 SUGAR.saveShortcutBar = function()
131 var enabledTable = SUGAR.prodEnabledTable;
133 if ( enabledTable.getRecordSet().getLength() > 11) //Max 10 + empty line
135 alert('{/literal}{sugar_translate label="LBL_ERROR_PROD_BAR_NUM_MODULES"}{literal}');
138 for(var i=0; i < enabledTable.getRecordSet().getLength(); i++){
139 var data = enabledTable.getRecord(i).getData();
140 if (data.module && data.module != '')
141 modules[i] = data.module;
144 ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
145 //YAHOO.SUGAR.MessageBox.show({title:"saving",msg:"Saving",close:false})
146 Connect.asyncRequest(
149 {success: SUGAR.saveCallBack},
150 'to_pdf=1&module=Administration&action=ConfigureShortcutBar&enabled_modules=' + YAHOO.lang.JSON.stringify(modules)
155 SUGAR.saveCallBack = function(o)
157 ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
158 if (o.responseText == "true")
160 window.location.assign('index.php?module=Administration&action=ConfigureShortcutBar');
164 YAHOO.SUGAR.MessageBox.show({msg:o.responseText});