]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Administration/templates/ShortcutBar.tpl
Release 6.4.0
[Github/sugarcrm.git] / modules / Administration / templates / ShortcutBar.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
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>
42
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>
46 <td colspan='100'>
47 {if empty($msg)}
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}">
54
55         <table border="0" cellspacing="1" cellpadding="1">
56                 <tr>
57                         <td>
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}  ">
60                         </td>
61                 </tr>
62         </table>
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">
65                         <tr>
66                                 <td width='1%'>
67                                         <div id="enabled_div"></div>    
68                                 </td>
69                                 <td>
70                                         <div id="disabled_div"></div>
71                                 </td>
72                         </tr>
73                 </table>
74         </div>
75         
76         <table border="0" cellspacing="1" cellpadding="1">
77                 <tr>
78                         <td>
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}  ">
81                         </td>
82                 </tr>
83         </table>
84 </form>
85
86 <script type="text/javascript">
87 (function(){ldelim}
88     var Connect = YAHOO.util.Connect;
89         Connect.url = 'index.php';
90     Connect.method = 'POST';
91     Connect.timeout = 300000; 
92
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"}';
97         {literal}
98         SUGAR.prodEnabledTable = new YAHOO.SUGAR.DragDropTable(
99                 "enabled_div",
100                 [{key:"label",  label: lblEnabled, width: 200, sortable: false},
101                  {key:"module", label: lblEnabled, hidden:true}],
102                 new YAHOO.util.LocalDataSource(enabled_modules, {
103                         responseSchema: {
104                            resultsList : "modules",
105                            fields : [{key : "module"}, {key : "label"}]
106                         }
107                 }),  
108                 {height: "300px"}
109         );
110         SUGAR.prodDisabledTable = new YAHOO.SUGAR.DragDropTable(
111                 "disabled_div",
112                 [{key:"label",  label: lblDisabled, width: 200, sortable: false},
113                  {key:"module", label: lblDisabled, hidden:true}],
114                 new YAHOO.util.LocalDataSource(disabled_modules, {
115                         responseSchema: {
116                            resultsList : "modules",
117                            fields : [{key : "module"}, {key : "label"}]
118                         }
119                 }),
120                 {height: "300px"}
121         );
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();
128         
129         SUGAR.saveShortcutBar = function()
130         {
131                 var enabledTable = SUGAR.prodEnabledTable;
132                 var modules = [];
133                 if ( enabledTable.getRecordSet().getLength() > 11) //Max 10 + empty line
134                 {
135                         alert('{/literal}{sugar_translate label="LBL_ERROR_PROD_BAR_NUM_MODULES"}{literal}');
136                         return false;
137                 }
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;
142                 }
143                 
144                 ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
145                 //YAHOO.SUGAR.MessageBox.show({title:"saving",msg:"Saving",close:false})
146         Connect.asyncRequest(
147             Connect.method, 
148             Connect.url, 
149             {success: SUGAR.saveCallBack},
150                         'to_pdf=1&module=Administration&action=ConfigureShortcutBar&enabled_modules=' + YAHOO.lang.JSON.stringify(modules)
151         );
152                 
153                 return true;
154         }
155         SUGAR.saveCallBack = function(o)
156         {
157            ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
158            if (o.responseText == "true")
159            {
160                window.location.assign('index.php?module=Administration&action=ConfigureShortcutBar');
161            } 
162            else 
163            {
164                YAHOO.SUGAR.MessageBox.show({msg:o.responseText});
165            }
166         }       
167 })();
168 {/literal}
169 </script>
170 {/if}