]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Administration/templates/ShortcutBar.tpl
Release 6.5.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-2012 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     <br>
56     <p>{$MOD.LBL_CONFIGURE_SHORTCUT_BAR_HELP}</p>
57         <br>
58     <table border="0" cellspacing="1" cellpadding="1">
59         
60                 <tr>
61                         <td>
62                                 <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}" > 
63                                 <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}  ">
64                         </td>
65                 </tr>
66         </table>
67         <div class='add_table' style='margin-bottom:5px'>
68                 <table id="ConfigureTabs" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
69                         <tr>
70                                 <td width='1%'>
71                                         <div id="enabled_div"></div>    
72                                 </td>
73                                 <td>
74                                         <div id="disabled_div"></div>
75                                 </td>
76                         </tr>
77                 </table>
78         </div>
79         
80         <table border="0" cellspacing="1" cellpadding="1">
81                 <tr>
82                         <td>
83                                 <input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" onclick="SUGAR.saveShortcutBar();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" >
84                                 <input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" 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}  ">
85                         </td>
86                 </tr>
87         </table>
88 </form>
89
90 <script type="text/javascript">
91 (function(){ldelim}
92     var Connect = YAHOO.util.Connect;
93         Connect.url = 'index.php';
94     Connect.method = 'POST';
95     Connect.timeout = 300000; 
96
97         var enabled_modules = {$enabled_modules};
98         var disabled_modules = {$disabled_modules};
99         var lblEnabled = '{sugar_translate label="LBL_ACTIVE_MODULES"}';
100         var lblDisabled = '{sugar_translate label="LBL_DISABLED_MODULES"}';
101         {literal}
102         SUGAR.prodEnabledTable = new YAHOO.SUGAR.DragDropTable(
103                 "enabled_div",
104                 [{key:"label",  label: lblEnabled, width: 200, sortable: false},
105                  {key:"module", label: lblEnabled, hidden:true}],
106                 new YAHOO.util.LocalDataSource(enabled_modules, {
107                         responseSchema: {
108                            resultsList : "modules",
109                            fields : [{key : "module"}, {key : "label"}]
110                         }
111                 }),  
112                 {height: "300px"}
113         );
114         SUGAR.prodDisabledTable = new YAHOO.SUGAR.DragDropTable(
115                 "disabled_div",
116                 [{key:"label",  label: lblDisabled, width: 200, sortable: false},
117                  {key:"module", label: lblDisabled, hidden:true}],
118                 new YAHOO.util.LocalDataSource(disabled_modules, {
119                         responseSchema: {
120                            resultsList : "modules",
121                            fields : [{key : "module"}, {key : "label"}]
122                         }
123                 }),
124                 {height: "300px"}
125         );
126         SUGAR.prodEnabledTable.disableEmptyRows = true;
127         SUGAR.prodDisabledTable.disableEmptyRows = true;
128         SUGAR.prodEnabledTable.addRow({module: "", label: ""});
129         SUGAR.prodDisabledTable.addRow({module: "", label: ""});
130         SUGAR.prodEnabledTable.render();
131         SUGAR.prodDisabledTable.render();
132         
133         SUGAR.saveShortcutBar = function()
134         {
135                 var enabledTable = SUGAR.prodEnabledTable;
136                 var modules = [];
137                 if ( enabledTable.getRecordSet().getLength() > 11) //Max 10 + empty line
138                 {
139                         alert('{/literal}{sugar_translate label="LBL_ERROR_PROD_BAR_NUM_MODULES"}{literal}');
140                         return false;
141                 }
142                 for(var i=0; i < enabledTable.getRecordSet().getLength(); i++){
143                         var data = enabledTable.getRecord(i).getData();
144                         if (data.module && data.module != '')
145                             modules[i] = data.module;
146                 }
147                 
148                 ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
149                 //YAHOO.SUGAR.MessageBox.show({title:"saving",msg:"Saving",close:false})
150         Connect.asyncRequest(
151             Connect.method, 
152             Connect.url, 
153             {success: SUGAR.saveCallBack},
154                         'to_pdf=1&module=Administration&action=ConfigureShortcutBar&enabled_modules=' + YAHOO.lang.JSON.stringify(modules)
155         );
156                 
157                 return true;
158         }
159         SUGAR.saveCallBack = function(o)
160         {
161            ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
162            if (o.responseText == "true")
163            {
164                window.location.assign('index.php?module=Administration&action=ConfigureShortcutBar');
165            } 
166            else 
167            {
168                YAHOO.SUGAR.MessageBox.show({msg:o.responseText});
169            }
170         }       
171 })();
172 {/literal}
173 </script>
174 {/if}