Sync smf21 to master (#144)
Jeremy D

Jeremy D commited on 2021-08-18 13:58:28
Showing 55 changed files, with 170 additions and 86 deletions.


* Ensure Build Tools are updated (#135)

Signed-off-by: jdarwood007 <unmonitored+github@sleepycode.com>

* Fix some Javascript errors and update build tools for eslint (#137)

* Fix some Javascript errors and update build tools for eslint

* Try again

* Need Submodules

* Fix the software year
Try eslint another way.

* Move to only supporting SMF 2.1 RC4 or later. (#141)

* Sync master (#142)

* Ensure Build Tools are updated

Signed-off-by: jdarwood007 <unmonitored+github@sleepycode.com>

* Move to only supporting SMF 2.1 RC4 or later.

* eslint files

* Fixes profile menu links (#143)

Fixes #139

* Profile menu (#145)

* Fixes profile menu links

Fixes #139

* Oops

* Sync issues
... ...
@@ -0,0 +1,34 @@
1
+module.exports = {
2
+	'env': {
3
+		'browser': true,
4
+		'es2021': true,
5
+		'jquery': true
6
+	},
7
+	'extends': 'eslint:recommended',
8
+	'parserOptions': {
9
+		'ecmaVersion': 12,
10
+		'sourceType': 'module'
11
+	},
12
+	'rules': {
13
+		'indent': [
14
+			'error',
15
+			'tab',
16
+			{"SwitchCase": 1}
17
+		],
18
+		'linebreak-style': [
19
+			'error',
20
+			'unix'
21
+		],
22
+		'quotes': [
23
+			'error',
24
+			'single'
25
+		],
26
+		'no-unused-vars': [
27
+			'error',
28
+			{
29
+				'vars': 'local',
30
+				'args' : 'none'
31
+			}
32
+		]
33
+	}
34
+};
... ...
@@ -13,7 +13,11 @@ jobs:
13 13
     name: LINT Checks
14 14
     steps:
15 15
       - uses: actions/checkout@master
16
+        with:
17
+          submodules: true
18
+      - name: Update Build Tools
19
+        run: git submodule foreach git pull origin master
16 20
       - name: Javascript LINT
17 21
         uses: tj-actions/eslint-changed-files@v4
18 22
         with:
19
-          config-path: buildTools/eslintrc
20 23
\ No newline at end of file
24
+          config-path: buildTools/eslintrc.js
21 25
\ No newline at end of file
... ...
@@ -6,3 +6,7 @@
6 6
 sd_plugins_lang/SDPlugin*.php
7 7
 sd_plugins_source/*
8 8
 css/helpdesk_custom.css
9
+node_modules
10
+package.json
11
+yarn.lock
12
+.eslintrc.js
... ...
@@ -56,7 +56,7 @@
56 56
 }
57 57
 
58 58
 /* Main Menu */
59
-#main_menu .main_icons.helpdesk::before {
59
+#main_menu .main_icons.helpdesk::before, .profile_user_links .main_icons.hd_profile::before{
60 60
 	background: url(../images/simpledesk/icons/shd_generic_icons.png) no-repeat;
61 61
 	background-position: -65px -116px;
62 62
 }
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -10,7 +10,7 @@
10 10
 		<readme lang="english" parsebbc="true" type="inline">This mod is [b]not compatible[/b] with your version of SMF, it requires 2.1 RC3 or later.</readme>
11 11
 	</install>
12 12
 
13
-	<install for="2.1 RC3, 2.1 RC4, 2.1.0-2.1.99">
13
+	<install for="2.1 RC4, 2.1.0-2.1.99">
14 14
 		<!-- readme files -->
15 15
 		<readme lang="english" parsebbc="true" type="file">language-readme/readme.english.txt</readme>
16 16
 
... ...
@@ -54,6 +54,7 @@
54 54
 		<hook hook="integrate_error_types" function="shd_error_types" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
55 55
 		<hook hook="integrate_bbc_codes" function="shd_bbc_codes" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
56 56
 		<hook hook="integrate_post_parsebbc" function="shd_parse_wikilinks" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
57
+		<hook hook="integrate_profile_popup" function="shd_profile_menu" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
57 58
 
58 59
 			<!-- Admin Section: Core -->
59 60
 		<hook hook="integrate_admin_include" function="$sourcedir/sd_source/Subs-SimpleDeskAdmin.php" />
... ...
@@ -100,7 +101,7 @@
100 101
 		<credits url="https://www.simpledesk.net" license="BSD 3-Clause" licenseurl="https://github.com/SimpleMachines/SimpleDesk/blob/master/license.txt" copyright="2010-2020">Simple Desk</credits>
101 102
 	</install>
102 103
 
103
-	<uninstall for="2.1 RC3, 2.1 RC4, 2.1.0-2.1.99">
104
+	<uninstall for="2.1 RC4, 2.1.0-2.1.99">
104 105
 		<!-- database changes, undone -->
105 106
 		<database>uninstall-sd-optional.php</database>
106 107
 		<code type="file">uninstall-sd-required.php</code>
... ...
@@ -116,6 +117,7 @@
116 117
 		<hook reverse="true" hook="integrate_error_types" function="shd_error_types" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
117 118
 		<hook reverse="true" hook="integrate_bbc_codes" function="shd_bbc_codes" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
118 119
 		<hook reverse="true" hook="integrate_post_parsebbc" function="shd_parse_wikilinks" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
120
+		<hook reverse="true" hook="integrate_profile_popup" function="shd_profile_menu" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
119 121
 
120 122
 			<!-- Admin Section: Core -->
121 123
 		<hook reverse="true" hook="integrate_admin_include" function="$sourcedir/sd_source/Subs-SimpleDeskAdmin.php" />
... ...
@@ -1,4 +1,5 @@
1 1
 /* Javascript for the main Helpdesk */
2
+/*global ajax_indicator smf_prepareScriptUrl smf_scripturl sceditor shd_sendJSONDocument in_array shd_quickTicketJump shd_ajax_problem shd_quickTicketJump oEditorHandle_shd_message*/
2 3
 
3 4
 /* Implant a JSON handler for Ajax */
4 5
 function shd_getJSONDocument(sUrl, funcCallback, sMethod)
... ...
@@ -26,6 +27,7 @@ function shd_getJSONDocument(sUrl, funcCallback, sMethod)
26 27
 	return oMyDoc;
27 28
 }
28 29
 
30
+// eslint-disable-next-line no-unused-vars
29 31
 function shd_sendJSONDocument(sUrl, oData, funcCallback)
30 32
 {
31 33
 	ajax_indicator(true);
... ...
@@ -74,8 +76,7 @@ shd_privacyControl.prototype.callback = function (oRecvd)
74 76
 		alert(oRecvd.error);
75 77
 	else if (oRecvd && oRecvd.message)
76 78
 		$('#' + this.opt.sDestSpan).html(oRecvd.message);
77
-	else
78
-		if (confirm(shd_ajax_problem))
79
+	else if (confirm(shd_ajax_problem))
79 80
 		window.location = smf_scripturl + '?action=helpdesk;sa=privacychange;ticket=' + this.opt.ticket + ';' + this.opt.sSession;
80 81
 
81 82
 	return false;
... ...
@@ -92,7 +93,7 @@ shd_urgencyControl.prototype.init = function ()
92 93
 {
93 94
 	for (var i in this.opt.aButtonOps)
94 95
 	{
95
-		if (!this.opt.aButtonOps.hasOwnProperty(i))
96
+		if (!Object.prototype.hasOwnProperty.call(this.opt.aButtonOps, i))
96 97
 			continue;
97 98
 
98 99
 		var oDiv = $('#urglink_' + this.opt.aButtonOps[i]);
... ...
@@ -141,7 +142,7 @@ shd_urgencyControl.prototype.callback = function (oRecvd)
141 142
 		var btn_set = ['increase', 'decrease'];
142 143
 		for (var i in btn_set)
143 144
 		{
144
-			if (!btn_set.hasOwnProperty(i))
145
+			if (!Object.prototype.hasOwnProperty.call(btn_set, i))
145 146
 				continue;
146 147
 
147 148
 			var oBtn = oRecvd[btn_set[i]];
... ...
@@ -151,8 +152,7 @@ shd_urgencyControl.prototype.callback = function (oRecvd)
151 152
 		// Attach JS events to new links
152 153
 		this.init();
153 154
 	}
154
-	else
155
-		if (confirm(shd_ajax_problem))
155
+	else if (confirm(shd_ajax_problem))
156 156
 		window.location = smf_scripturl + '?action=helpdesk;sa=urgencychange;ticket=' + this.opt.iTicketId + ';change=' + this.opt.aButtonOps[this.direction] + ';' + this.opt.sSession;
157 157
 
158 158
 	return false;
... ...
@@ -169,7 +169,6 @@ shd_urgencyControl.prototype.clickList = function ()
169 169
 shd_urgencyControl.prototype.expandList = function ()
170 170
 {
171 171
 	this.bCollapsed = false;
172
-console.log('shd_urgencyControl.prototype.expandList:', this.opt.sSelectButtonId, $('#' + this.opt.sSelectButtonId), this.opt.sImageExpanded);
173 172
 	$('#urgency_' + this.opt.sSelf).attr('src', this.opt.sImageExpanded);
174 173
 
175 174
 	// Fetch the list of items
... ...
@@ -188,11 +187,11 @@ shd_urgencyControl.prototype.expandList_callback = function (oRecvd)
188 187
 		var cur = 0;
189 188
 		for (var i in oRecvd.urgencies)
190 189
 		{
191
-			if (!oRecvd.urgencies.hasOwnProperty(i))
190
+			if (!Object.prototype.hasOwnProperty.call(oRecvd.urgencies, i))
192 191
 				continue;
193 192
 
194 193
 			cur = oRecvd.urgencies[i];
195
-			selected = cur.selected ? ' selected="selected"' : '';
194
+			var selected = cur.selected ? ' selected="selected"' : '';
196 195
 			newhtml += '<option class="shd_urgencies" data-id="' + cur.id + '"' + selected + '>' + cur.name + '</option>';
197 196
 		}
198 197
 
... ...
@@ -239,7 +238,7 @@ function shd_attach_select(oOptions)
239 238
 	shd_attach_select.prototype.id = 0;
240 239
 	shd_attach_select.prototype.max = (oOptions.max) ? oOptions.max : -1;
241 240
 	shd_attach_select.prototype.addElement(document.getElementById(shd_attach_select.prototype.opts.file_item));
242
-};
241
+}
243 242
 
244 243
 shd_attach_select.prototype.addElement = function (element)
245 244
 {
... ...
@@ -293,7 +292,7 @@ shd_attach_select.prototype.checkExtension = function (filename)
293 292
 		return false; // pfft, didn't specify anything
294 293
 	}
295 294
 
296
-	var dot = filename.lastIndexOf(".");
295
+	var dot = filename.lastIndexOf('.');
297 296
 	if (dot == -1)
298 297
 	{
299 298
 		shd_attach_select.prototype.opts.message_ext_error_final = shd_attach_select.prototype.opts.message_ext_error.replace(' ({ext})', '');
... ...
@@ -346,7 +345,7 @@ shd_attach_select.prototype.checkActive = function()
346 345
 	var session_attach = 0;
347 346
 	for (var i in elements)
348 347
 	{
349
-		if (!elements.hasOwnProperty(i))
348
+		if (!Object.prototype.hasOwnProperty.call(elements, i))
350 349
 			continue;
351 350
 
352 351
 		if (elements[i] && elements[i].type == 'checkbox' && elements[i].name == 'attach_del[]' && elements[i].checked === true)
... ...
@@ -411,6 +410,7 @@ CannedReply.prototype.onReplyReceived = function (oRecvd)
411 410
 }
412 411
 
413 412
 // The quick jump function
413
+// eslint-disable-next-line no-unused-vars
414 414
 function shd_quickTicketJump(id_ticket)
415 415
 {
416 416
 	window.location.href = smf_prepareScriptUrl(smf_scripturl) + '?action=helpdesk;sa=ticket;ticket=' + id_ticket;
... ...
@@ -459,7 +459,7 @@ AjaxAssign.prototype.expand_callback = function (oRecvd)
459 459
 		var cur = 0;
460 460
 		for (var i in oRecvd.members)
461 461
 		{
462
-			if (!oRecvd.members.hasOwnProperty(i))
462
+			if (!Object.prototype.hasOwnProperty.call(oRecvd.members, i))
463 463
 				continue;
464 464
 
465 465
 			cur = oRecvd.members[i];
... ...
@@ -514,7 +514,7 @@ shd_notifications.prototype.init = function ()
514 514
 
515 515
 shd_notifications.prototype.receiveNotifications = function ()
516 516
 {
517
-	shd_getJSONDocument(smf_prepareScriptUrl(smf_scripturl) + "action=helpdesk;sa=ajax;op=notify;ticket=" + this.ticketId + ";" + this.opt.sSessionVar + '=' + this.opt.sSessionId + (this.opt.sPinglist ? ";" + this.opt.sPinglist : ''), this.onReceiveNotifications.bind(this));
517
+	shd_getJSONDocument(smf_prepareScriptUrl(smf_scripturl) + 'action=helpdesk;sa=ajax;op=notify;ticket=' + this.ticketId + ';' + this.opt.sSessionVar + '=' + this.opt.sSessionId + (this.opt.sPinglist ? ';' + this.opt.sPinglist : ''), this.onReceiveNotifications.bind(this));
518 518
 	return false;
519 519
 }
520 520
 
... ...
@@ -537,7 +537,7 @@ shd_notifications.prototype.onReceiveNotifications = function (oRecvd)
537 537
 		temphtml = '';
538 538
 		for (i in oRecvd.being_notified)
539 539
 		{
540
-			if (!oRecvd.being_notified.hasOwnProperty(i))
540
+			if (!Object.prototype.hasOwnProperty.call(oRecvd.being_notified, i))
541 541
 				continue;
542 542
 
543 543
 			cur = oRecvd.being_notified[i];
... ...
@@ -554,9 +554,9 @@ shd_notifications.prototype.onReceiveNotifications = function (oRecvd)
554 554
 		subtemplate = this.opt.oOptionalTemplate;
555 555
 
556 556
 		temphtml = '';
557
-		for (var i in oRecvd.optional)
557
+		for (i in oRecvd.optional)
558 558
 		{
559
-			if (!oRecvd.optional.hasOwnProperty(i))
559
+			if (!Object.prototype.hasOwnProperty.call(oRecvd.optional, i))
560 560
 				continue;
561 561
 
562 562
 			cur = oRecvd.optional[i];
... ...
@@ -584,7 +584,7 @@ shd_notifications.prototype.onReceiveNotifications = function (oRecvd)
584 584
 		temphtml = '';
585 585
 		for (i in oRecvd.optional_butoff)
586 586
 		{
587
-			if (!oRecvd.optional_butoff.hasOwnProperty(i))
587
+			if (!Object.prototype.hasOwnProperty.call(oRecvd.optional_butoff, i))
588 588
 				continue;
589 589
 
590 590
 			cur = oRecvd.optional_butoff[i];
... ...
@@ -1,4 +1,5 @@
1 1
 /* Javascript for the main Helpdesk Admin */
2
+/*global shd_sendJSONDocument sceditor reqOverlayDiv submitonce submitThisOnce */
2 3
 
3 4
 // Handle the JavaScript surrounding the admin center.
4 5
 $(document).ready(function(){
... ...
@@ -215,7 +216,7 @@ shd_custom_field_order.prototype.move = function (clickedKey, clickedOrder, move
215 216
 		return;
216 217
 
217 218
 	// Put this into the right place.
218
-	newOrder = this.cloneArray(currentOrder);
219
+	var newOrder = this.cloneArray(currentOrder);
219 220
 	newOrder.splice(clickedOrder, 1);
220 221
 	newOrder.splice(movedOrder, 0, clickedKey);
221 222
 
... ...
@@ -293,6 +294,9 @@ shd_AttributeValidate.prototype.init = function ()
293 294
 
294 295
 	/* After typing a key */
295 296
 	$('#' + this.opt.sEmailContainerId + ', #' + this.opt.sStarterContainerId + ', #' + this.opt.sFromContainerId + ', #' + this.opt.sToContainerId).keyup(this.validator.bind(this));
297
+
298
+	/* Do the actual thing */
299
+	$('#' + this.opt.sDoAttributeContainerId).on('click', this.click.bind(this));
296 300
 }
297 301
 
298 302
 /* Reattribute Posts: Does a radio change and processes the validator */
... ...
@@ -319,30 +323,41 @@ shd_AttributeValidate.prototype.validator = function ()
319 323
 	if (!$('#' + this.opt.sToContainerId).val())
320 324
 		this.valid = false;
321 325
 
322
-	warningMessage = this.origText.replace(/%member_to%/, $('#' + this.opt.sToContainerId).value);
326
+	this.warningMessage = this.origText.replace(/%member_to%/, $('#' + this.opt.sToContainerId).val());
323 327
 
324
-	if ($('#' + this.opt.sTypeEmailContainerId).is(":checked"))
328
+	if (this.valid && $('#' + this.opt.sTypeEmailContainerId).is(':checked'))
325 329
 	{
326
-		$('#' + this.opt.sStarterContainerId + ', #' + this.opt.sFromContainerId).val("");
330
+		$('#' + this.opt.sStarterContainerId + ', #' + this.opt.sFromContainerId).val('');
327 331
 		this.valid = $('#' + this.opt.sEmailContainerId).val() != '';
328
-		warningMessage = warningMessage.replace(/%type%/, this.opt.sEmailConfirmText).replace(/%find%/, $('#' + this.opt.sEmailContainerId).val());
332
+		this.warningMessage = this.warningMessage.replace(/%type%/, this.opt.sEmailConfirmText).replace(/%find%/, $('#' + this.opt.sEmailContainerId).val());
329 333
 	}
330
-	else if ($('#' + this.opt.sTypeStarterContainerId).is(":checked"))
334
+	else if (this.valid && $('#' + this.opt.sTypeStarterContainerId).is(':checked'))
331 335
 	{
332
-		$('#' + this.opt.sEmailContainerId + ' #' + this.opt.sFromContainerId).val("");
336
+		$('#' + this.opt.sEmailContainerId + ' #' + this.opt.sFromContainerId).val('');
333 337
 
334 338
 		this.valid = $('#' + this.opt.sStarterContainerId).val() != '';
335
-		warningMessage = this.origTextStarter.replace(/%member_to%/, $('#' + this.opt.sToContainerId).val()).replace(/%find%/, $('#' + this.opt.sStarterContainerId).val());			
339
+		this.warningMessage = this.origTextStarter.replace(/%member_to%/, $('#' + this.opt.sToContainerId).val()).replace(/%find%/, $('#' + this.opt.sStarterContainerId).val());			
336 340
 	}
337
-	else
341
+	else if (this.valid)
338 342
 	{
339
-		$('#' + this.opt.sEmailContainerId + ' #' + this.opt.sStarterContainerId).val("");
343
+		$('#' + this.opt.sEmailContainerId + ' #' + this.opt.sStarterContainerId).val('');
340 344
 
341 345
 		this.valid = $('#' + this.opt.sFromContainerId).val() != '';
342
-		warningMessage = warningMessage.replace(/%type%/, this.opt.sFromConfirmText).replace(/%find%/, $('#' + this.opt.sFromContainerId).val());
346
+		this.warningMessage = this.warningMessage.replace(/%type%/, this.opt.sFromConfirmText).replace(/%find%/, $('#' + this.opt.sFromContainerId).val());
343 347
 	}
344 348
 
345
-	$('#' + this.opt.sDoAttributeContainerId).prop("disabled", this.valid ? false : true);
349
+	$('#' + this.opt.sDoAttributeContainerId).prop('disabled', this.valid ? false : true);
350
+}
351
+
352
+/* Reattribute Posts: When they click */
353
+shd_AttributeValidate.prototype.click = function (event)
354
+{
355
+	event.preventDefault();
356
+
357
+	if (this.valid)
358
+		return confirm(this.warningMessage);
359
+	else
360
+		return false;
346 361
 }
347 362
 
348 363
 /* Roles Management */
... ...
@@ -415,7 +430,7 @@ shd_role.prototype.toggleBlock = function (e, block)
415 430
 	$('#' + this.opt.sBlockIcon.replace('%block%', block)).css('display', '');
416 431
 }
417 432
 
418
-shd_role.prototype.formConfirm = function (e)
433
+shd_role.prototype.formConfirm = function ()
419 434
 {
420 435
 	return confirm(this.opt.sDeleteConfirmText);
421 436
 }
... ...
@@ -429,8 +444,6 @@ function shd_cannedReplies(oOpts)
429 444
 	// Build our URL.
430 445
 	this.opt.sUrl = this.opt.sUrlBase +
431 446
 		';' + this.opt.sSessionVar + '=' + this.opt.sSessionId;
432
-
433
-console.log('shd_cannedReplies:', this.opt.sUrl);
434 447
 }
435 448
 
436 449
 shd_cannedReplies.prototype.init = function ()
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -153,6 +153,8 @@ $txt['shd_theme_note'] = 'Normally the helpdesk will inherit the theme a user ha
153 153
 $txt['shd_theme_use_default'] = 'Use the forum default theme';
154 154
 $txt['shd_hidemenuitem'] = 'Hide the Helpdesk menu item?';
155 155
 $txt['shd_hidemenuitem_note'] = 'This is most useful if helpdesk departments are presented on the board index.';
156
+$txt['shd_hideprofilemenuitem'] = 'Hide the Helpdesk Profile menu item?';
157
+$txt['shd_hideprofilemenuitem_note'] = 'If you are using the user menu, this is useful to hide.';
156 158
 $txt['shd_disable_unread'] = 'Disable integration with Unread Posts/Unread Replies';
157 159
 $txt['shd_disable_unread_note'] = 'Normally, SimpleDesk adds a list of topics to the unread posts/unread replies page but sometimes (e.g. certain mobile themes) this does not always work so well.';
158 160
 $txt['shd_zerofill'] = 'Smallest number of digits to use';
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -397,6 +397,7 @@ function shd_modify_display_options($return_config)
397 397
 		array('int', 'shd_zerofill', 'subtext' => $txt['shd_zerofill_note']),
398 398
 		'',
399 399
 		array('check', 'shd_hidemenuitem', 'subtext' => $txt['shd_hidemenuitem_note']),
400
+		array('check', 'shd_hideprofilemenuitem', 'subtext' => $txt['shd_hideprofilemenuitem_note']),
400 401
 		'',
401 402
 		array('check', 'shd_disable_unread', 'subtext' => $txt['shd_disable_unread_note']),
402 403
 		array('check', 'shd_disable_boardint', 'subtext' => $txt['shd_disable_boardint_note']),
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -1837,7 +1837,7 @@ function shd_main_menu(&$menu_buttons)
1837 1837
 		);
1838 1838
 	}
1839 1839
 
1840
-	if (shd_allowed_to(array('shd_view_profile_own', 'shd_view_profile_any'), 0))
1840
+	if (shd_allowed_to(array('shd_view_profile_own', 'shd_view_profile_any'), 0) && empty($modSettings['shd_hideprofilemenuitem']))
1841 1841
 	{
1842 1842
 		// Hmm, this could be tricky. It's possible the main menu has been eaten by permissions at this point, so just in case, reconstruct what's missing.
1843 1843
 		if (empty($menu_buttons['profile']))
... ...
@@ -2019,6 +2019,30 @@ function shd_main_menu_admin($helpdesk_admin)
2019 2019
 }
2020 2020
 // Cause IE is being mean to meeee again...!
2021 2021
 
2022
+/**
2023
+ *	Add the SimpleDesk options to the profile popup menu.
2024
+ *
2025
+ *	@param array &$menu_buttons The main menu buttons as provided by Subs.php.
2026
+ *	@since 2.1
2027
+*/
2028
+function shd_profile_menu(&$profile_items)
2029
+{
2030
+	global $modSettings, $txt, $scripturl;
2031
+
2032
+	if (empty($modSettings['helpdesk_active']))
2033
+		return;
2034
+
2035
+	if (!shd_allowed_to(array('shd_view_profile_own', 'shd_view_profile_any'), 0) || !empty($modSettings['shd_hidemenuitem']))
2036
+		return;
2037
+
2038
+	$profile_items[] = array(
2039
+		'menu' => 'helpdesk',
2040
+		'area' => 'hd_profile',		
2041
+		'title' => $txt['shd_helpdesk_profile'],
2042
+		'url' => $scripturl . '?action=profile;area=hd_profile',
2043
+	);
2044
+}
2045
+
2022 2046
 /**
2023 2047
  *	Detect a SHD error and move it to the proper error type.
2024 2048
  *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
... ...
@@ -5,7 +5,7 @@
5 5
 *       An advanced help desk modification built on SMF       *
6 6
 ***************************************************************
7 7
 *                                                             *
8
-*         * Copyright 2020 - SimpleDesk.net                   *
8
+*         * Copyright 2021 - SimpleDesk.net                   *
9 9
 *                                                             *
10 10
 *   This file and its contents are subject to the license     *
11 11
 *   included with this distribution, license.txt, which       *
12 12