Skip to content

Commit d74ac13

Browse files
committed
* [Preferences] [CHD-728] Allow keyboard shortcuts to be disabled.
1 parent 0e50d37 commit d74ac13

File tree

10 files changed

+48
-13
lines changed

10 files changed

+48
-13
lines changed

ajax.php

+3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
if(!empty($worker)) {
7979
$active_worker_memberships = $worker->getMemberships();
8080
$tpl->assign('active_worker_memberships', $active_worker_memberships);
81+
82+
$keyboard_shortcuts = intval(DAO_WorkerPref::get($worker->id,'keyboard_shortcuts', 1));
83+
$tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
8184
}
8285

8386
CerberusApplication::processRequest($request,true);

plugins/cerberusweb.core/api/plugin.classes.php

+3
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ public function writeResponse(DevblocksHttpResponse $response) {
198198
$tour_enabled = intval(DAO_WorkerPref::get($active_worker->id, 'assist_mode', 1));
199199
if(DEMO_MODE) $tour_enabled = 1; // override for DEMO
200200

201+
$keyboard_shortcuts = intval(DAO_WorkerPref::get($active_worker->id,'keyboard_shortcuts',1));
202+
$tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
203+
201204
$active_worker_memberships = $active_worker->getMemberships();
202205
$tpl->assign('active_worker_memberships', $active_worker_memberships);
203206

plugins/cerberusweb.core/api/uri/preferences.php

+6
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ function showGeneralAction() {
134134
$tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
135135
$tpl->assign('assist_mode', $tour_enabled);
136136

137+
$keyboard_shortcuts = intval(DAO_WorkerPref::get($worker->id, 'keyboard_shortcuts', 1));
138+
$tpl->assign('keyboard_shortcuts', $keyboard_shortcuts);
139+
137140
$mail_inline_comments = DAO_WorkerPref::get($worker->id,'mail_inline_comments',1);
138141
$tpl->assign('mail_inline_comments', $mail_inline_comments);
139142

@@ -209,6 +212,9 @@ function saveDefaultsAction() {
209212
@$assist_mode = DevblocksPlatform::importGPC($_REQUEST['assist_mode'],'integer',0);
210213
DAO_WorkerPref::set($worker->id, 'assist_mode', $assist_mode);
211214

215+
@$keyboard_shortcuts = DevblocksPlatform::importGPC($_REQUEST['keyboard_shortcuts'],'integer',0);
216+
DAO_WorkerPref::set($worker->id, 'keyboard_shortcuts', $keyboard_shortcuts);
217+
212218
@$mail_inline_comments = DevblocksPlatform::importGPC($_REQUEST['mail_inline_comments'],'integer',0);
213219
DAO_WorkerPref::set($worker->id, 'mail_inline_comments', $mail_inline_comments);
214220

plugins/cerberusweb.core/templates/contacts/orgs/display.tpl

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ tabView.appendTo('contactOptions');
110110
</script>
111111
112112
<script type="text/javascript">
113+
{if $pref_keyboard_shortcuts}
113114
{literal}
114115
CreateKeyHandler(function doShortcuts(e) {
115116
@@ -131,5 +132,6 @@ CreateKeyHandler(function doShortcuts(e) {
131132
}
132133
});
133134
{/literal}
135+
{/if}
134136
</script>
135137

plugins/cerberusweb.core/templates/display/index.tpl

+4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<br>
107107
{/if}
108108

109+
{if $pref_keyboard_shortcuts}
109110
{$translate->_('common.keyboard')|lower}:
110111
{if !$ticket->is_closed && $active_worker->hasPriv('core.ticket.actions.close')}(<b>c</b>) {$translate->_('common.close')|lower} {/if}
111112
{if !$ticket->spam_trained && $active_worker->hasPriv('core.ticket.actions.spam')}(<b>s</b>) {$translate->_('common.spam')|lower} {/if}
@@ -118,6 +119,7 @@
118119
{if $active_worker->hasPriv('core.display.actions.reply')}(<b>r</b>) {$translate->_('display.ui.reply')|lower} {/if}
119120
(<b>p</b>) {$translate->_('common.print')|lower}
120121
<br>
122+
{/if}
121123

122124
</form>
123125
<form action="{devblocks_url}{/devblocks_url}" method="post" name="frmPrint" id="frmPrint" target="_blank" style="display:none;"></form>
@@ -207,6 +209,7 @@ tabView.appendTo('displayOptions');
207209
</script>
208210
209211
<script type="text/javascript">
212+
{if $pref_keyboard_shortcuts}
210213
{literal}
211214
CreateKeyHandler(function doShortcuts(e) {
212215
@@ -269,6 +272,7 @@ CreateKeyHandler(function doShortcuts(e) {
269272
}
270273
});
271274
{/literal}
275+
{/if}
272276
</script>
273277
274278
<script type="text/javascript">

plugins/cerberusweb.core/templates/preferences/modules/general.tpl

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ These addresses will be associated with your helpdesk account.<br>
7575
<label><input type="checkbox" name="assist_mode" value="1" {if $assist_mode eq 1}checked{/if}> Enabled</label><br>
7676
<br>
7777

78+
<b>Keyboard Shortcuts:</b><br>
79+
<label><input type="checkbox" name="keyboard_shortcuts" value="1" {if $keyboard_shortcuts eq 1}checked{/if}> Enabled</label><br>
80+
<br>
81+
7882
<b>Mail:</b><br>
7983
<label><input type="checkbox" name="mail_inline_comments" value="1" {if $mail_inline_comments}checked{/if}> Show comments in the conversation</label><br>
8084
<label><input type="checkbox" name="mail_always_show_all" value="1" {if $mail_always_show_all}checked{/if}> Always use 'read all' mode (expand messages and sort chronologically)</label><br>

plugins/cerberusweb.core/templates/tickets/index.tpl

+16-8
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ tabView.addListener('activeTabChange', function(e) {
8383
{/literal}
8484
{if is_numeric($tab_idx_workflow)}
8585
case {$tab_idx_workflow}:
86+
{if $pref_keyboard_shortcuts}
8687
{literal}
8788
CreateKeyHandler(function (e) {
8889
var mycode = getKeyboardKey(e, true);
@@ -130,14 +131,16 @@ tabView.addListener('activeTabChange', function(e) {
130131
break;
131132
}
132133
});
133-
break;
134-
{/literal}{/if}{literal}
134+
{/literal}
135+
{/if}
136+
break;
137+
{/if}
135138
136139
// Overview keys
137-
{/literal}
138140
{if is_numeric($tab_idx_overview)}
139141
case {$tab_idx_overview}:
140-
{literal}
142+
{if $pref_keyboard_shortcuts}
143+
{literal}
141144
CreateKeyHandler(function (e) {
142145
var mycode = getKeyboardKey(e, true);
143146
@@ -184,14 +187,16 @@ tabView.addListener('activeTabChange', function(e) {
184187
break;
185188
}
186189
});
190+
{/literal}
191+
{/if}
187192
break;
188-
{/literal}{/if}{literal}
193+
{/if}
189194
190195
// Search keys
191-
{/literal}
192196
{if is_numeric($tab_idx_search)}
193197
case {$tab_idx_search}:
194-
{literal}
198+
{if $pref_keyboard_shortcuts}
199+
{literal}
195200
CreateKeyHandler(function (e) {
196201
var mycode = getKeyboardKey(e, true);
197202
@@ -228,9 +233,12 @@ tabView.addListener('activeTabChange', function(e) {
228233
break;
229234
}
230235
});
236+
{/literal}
237+
{/if}
231238
break;
232-
{/literal}{/if}{literal}
239+
{/if}
233240
241+
{literal}
234242
default:
235243
CreateKeyHandler(function (e) {});
236244
break;

plugins/cerberusweb.core/templates/tickets/ticket_view.tpl

+2-1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
<button type="button" onclick="ajax.viewTicketsAction('{$view->id}','not_waiting');">{$translate->_('mail.not_waiting')|lower}</button>
230230
</div>
231231

232+
{if $pref_keyboard_shortcuts}
232233
{if $view->id=='overview_all' || $view->id=='mail_workflow' || $view->id=='search'}{*Only on Workflow/Overview*}
233234
{$translate->_('common.keyboard')|lower}:
234235
{if $active_worker->hasPriv('core.ticket.view.actions.bulk_update')}(<b>b</b>) {$translate->_('common.bulk_update')|lower}{/if}
@@ -239,7 +240,7 @@
239240
{if $active_worker->hasPriv('core.ticket.actions.delete')}(<b>x</b>) {$translate->_('common.delete')|lower}{/if}
240241
<br>
241242
{/if}
242-
243+
{/if}
243244
</td>
244245
</tr>
245246
{/if}

plugins/cerberusweb.crm/templates/crm/opps/display/index.tpl

+4-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ tabView.addTab( new YAHOO.widget.Tab({
8787
tabView.appendTo('displayCrmTabs');
8888
</script>
8989
90-
<script type="text/javascript">
90+
<script type="text/javascript">
91+
{if $pref_keyboard_shortcuts}
9192
{literal}
9293
CreateKeyHandler(function doShortcuts(e) {
9394
@@ -119,5 +120,6 @@ CreateKeyHandler(function doShortcuts(e) {
119120
break;
120121
}
121122
});
122-
{/literal}
123+
{/literal}
124+
{/if}
123125
</script>

plugins/cerberusweb.forums/templates/forums/forums_view.tpl

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@
102102

103103
<br>
104104

105-
{*
106-
{$translate->_('common.keyboard')|capitalize}: (<b>c</b>) {$translate->_('common.close')|lower}, (<b>s</b>) {$translate->_('common.synchronize')|lower} <br>
105+
{*
106+
{if $pref_keyboard_shortcuts}
107+
{$translate->_('common.keyboard')|capitalize}: (<b>c</b>) {$translate->_('common.close')|lower}, (<b>s</b>) {$translate->_('common.synchronize')|lower} <br>
108+
{/if}
107109
*}
108110
</td>
109111
</tr>

0 commit comments

Comments
 (0)