! If on own HD profile, provide a new ticket button, and if on others' provide the new proxy ticket button. [Bug 622]
gruffen

gruffen commited on 2011-04-25 03:50:30
Showing 4 changed files, with 17 additions and 2 deletions.

... ...
@@ -368,6 +368,11 @@ h3.ticketheader img
368 368
 	background: url(../images/simpledesk/proxy.png) no-repeat left;
369 369
 	background-position: 10px;
370 370
 }
371
+#shd_post_ticket
372
+{
373
+	background: url(../images/simpledesk/ticket.png) no-repeat left;
374
+	background-position: 10px;
375
+}
371 376
 
372 377
 /**********************************
373 378
 * Ticket replies				 *
... ...
@@ -41,6 +41,7 @@ $txt['shd_profile_go_to_helpdesk'] = 'Go to the helpdesk';
41 41
 $txt['shd_profile_heading'] = 'Helpdesk Profile - %s';
42 42
 $txt['shd_profile_edit_settings'] = 'Edit my settings';
43 43
 $txt['shd_profile_view_tickets'] = 'View my tickets';
44
+$txt['shd_profile_newticket'] = 'Post new ticket';
44 45
 $txt['shd_profile_proxy'] = 'Post proxy ticket';
45 46
 $txt['shd_profile_tickets'] = 'Ticket Information';
46 47
 $txt['shd_profile_tickets_created'] = 'Tickets created by this user';
... ...
@@ -161,7 +161,8 @@ function shd_profile_frontpage($memID)
161 161
 	$smcFunc['db_free_result']($query);
162 162
 	$context['shd_numassigned'] = comma_format($context['shd_numassigned']);
163 163
 
164
-	$context['can_post_proxy'] = shd_allowed_to('shd_new_ticket', 0) && shd_allowed_to('shd_post_proxy', 0); // since it's YOUR permissions, whether you can post on behalf of this user!
164
+	$context['can_post_ticket'] = shd_allowed_to('shd_new_ticket', 0) && $memID == $context['user']['id'];
165
+	$context['can_post_proxy'] = shd_allowed_to('shd_new_ticket', 0) && shd_allowed_to('shd_post_proxy', 0) && $memID != $context['user']['id']; // since it's YOUR permissions, whether you can post on behalf of this user and this user isn't you!
165 166
 }
166 167
 
167 168
 function shd_profile_preferences($memID)
... ...
@@ -32,8 +32,10 @@ function template_shd_profile_main()
32 32
 	if (!empty($context['shd_numopentickets']))
33 33
 		echo ' <span class="smalltext">(', $context['shd_numopentickets'], ' ', $txt['shd_profile_currently_open'], ')</span>';
34 34
 
35
-	echo '<br />
35
+	echo '
36
+				<br />
36 37
 				', $txt['shd_profile_tickets_assigned'], ': <a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=hd_showtickets">', $context['shd_numassigned'], '</a>
38
+				<br /><br />
37 39
 
38 40
 				<div class="description shd_showtickets floatright" id="shd_showtickets">
39 41
 					<a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=hd_showtickets">', $txt['shd_profile_view_tickets'], '</a><br />
... ...
@@ -45,6 +47,12 @@ function template_shd_profile_main()
45 47
 					<a href="', $scripturl, '?action=helpdesk;sa=newticket;proxy=', $context['member']['id'], '">', $txt['shd_profile_proxy'], '</a><br />
46 48
 				</div>';
47 49
 
50
+	if (!empty($context['can_post_ticket']))
51
+		echo '
52
+				<div class="description shd_showtickets floatright" id="shd_post_ticket">
53
+					<a href="', $scripturl, '?action=helpdesk;sa=newticket">', $txt['shd_profile_newticket'], '</a><br />
54
+				</div>';
55
+
48 56
 	echo '
49 57
 				<br /><br /><br />
50 58
 			</div>
51 59