+ Add the staff list plugin to the SVN repo [Feature 457] ! Did I actually misspell that IE6 comment without anyone noticing it? :P
cookiemonster

cookiemonster commited on 2011-03-24 12:41:04
Showing 4 changed files, with 325 additions and 0 deletions.

... ...
@@ -0,0 +1,38 @@
1
+<?php
2
+###############################################################
3
+#         Simple Desk Project - www.simpledesk.net            #
4
+###############################################################
5
+#       An advanced help desk modifcation built on SMF        #
6
+###############################################################
7
+#                                                             #
8
+#         * Copyright 2010 - SimpleDesk.net                   #
9
+#                                                             #
10
+#   This file and its contents are subject to the license     #
11
+#   included with this distribution, license.txt, which       #
12
+#   states that this software is New BSD Licensed.            #
13
+#   Any questions, please contact SimpleDesk.net              #
14
+#                                                             #
15
+###############################################################
16
+# SimpleDesk Version: 1.0 Felidae                             #
17
+# File Info: SimpleDesk.english.php / 1.0 Felidae             #
18
+###############################################################
19
+// Version: 1.0 Felidae; SimpleDesk staff list plugin
20
+
21
+// Important! Before editing these language files please read the text at the top of index.english.php.
22
+
23
+$txt['shdp_staff_list'] = 'Staff List';
24
+$txt['shdp_staff_list_desc'] = 'This plugin adds a new sub action to the helpdesk with a list of all current staff members.';
25
+
26
+$txt['shdp_staff_list_title'] = 'Staff List';
27
+$txt['shdp_staff_list_welcome'] = 'This is a list of all current members of the helpdesk staff.';
28
+
29
+$txt['shdp_staff_list_member'] = 'Member';
30
+$txt['shdp_staff_list_position'] = 'Position';
31
+$txt['shdp_staff_list_online_status'] = 'Online status';
32
+$txt['shdp_staff_list_last_online'] = 'Last online';
33
+$txt['shdp_staff_list_empty'] = 'There are no staff members to show :(';
34
+$txt['shdp_staff_list_helpdesk_profile'] = 'View helpdesk profile';
35
+
36
+$txt['permissionname_shd_staff_list_view'] = 'View staff list';
37
+
38
+?>
0 39
\ No newline at end of file
... ...
@@ -0,0 +1,91 @@
1
+<?php
2
+// Version: 1.0
3
+
4
+function template_shd_staff_list()
5
+{
6
+	global $context, $txt, $settings, $scripturl, $user_info, $options, $modSettings;
7
+
8
+	echo '
9
+		<div class="modbuttons clearfix margintop">';
10
+
11
+	template_button_strip($context['navigation'], 'bottom');
12
+
13
+	echo '
14
+		</div>
15
+		<div id="admin_content">
16
+			<div class="tborder">
17
+				<div class="cat_bar grid_header">
18
+					<h3 class="catbg">
19
+						<img src="', $settings['default_images_url'], '/simpledesk/staff.png" class="shd_icon_minihead" alt="" />
20
+						',$txt['shdp_staff_list_title'],'
21
+					</h3>
22
+				</div>
23
+				<div class="description shd_no_margin shd_hide_bottom_border">
24
+					',$txt['shdp_staff_list_welcome'],'
25
+				</div>
26
+				<table class="shd_ticketlist" cellspacing="0" width="100%">
27
+					<tr class="titlebg">
28
+						<td colspan="2">
29
+							<img src="', $settings['default_images_url'], '/simpledesk/user.png" class="shd_smallicon" alt="" />
30
+							',$txt['shdp_staff_list_member'],'
31
+						</td>
32
+						<td>
33
+							<img src="', $settings['default_images_url'], '/simpledesk/position.png" class="shd_smallicon" alt="" />
34
+							',$txt['shdp_staff_list_position'],'
35
+						</td>
36
+						<td>
37
+							<img src="', $settings['default_images_url'], '/simpledesk/details.png" class="shd_smallicon" alt="" />
38
+							',$txt['shdp_staff_list_online_status'],'
39
+						</td>							
40
+						<td>
41
+							<img src="', $settings['default_images_url'], '/simpledesk/time.png" class="shd_smallicon" alt="" />
42
+							',$txt['shdp_staff_list_last_online'],'
43
+						</td>
44
+						<td>&nbsp;</td>
45
+					</tr>';
46
+
47
+		if (empty($context['staff_members']))
48
+			echo '
49
+					<tr class="windowbg2">
50
+						<td colspan="6" class="shd_noticket">',$txt['shdp_staff_list_empty'],'</td>
51
+					</tr>';
52
+		else
53
+		{
54
+			$use_bg2 = true; // start with windowbg2 to differentiate between that and windowbg2
55
+			foreach ($context['staff_members'] AS $member)
56
+			{
57
+				echo '
58
+					<tr class="', ($use_bg2 ? 'windowbg2' : 'windowbg'), '">
59
+						<td width="1%">
60
+							', (!empty($modSettings['shd_display_avatar']) && empty($options['show_no_avatars']) && !empty($member['avatar']['image'])) ? $member['avatar']['image'] : '', '
61
+							', $member['extra'],'
62
+						</td>
63
+						<td><strong>', $member['link'], '</strong></td>
64
+						<td><span style="color: ', $member['group_color'], '">', $member['group'], '</span></td>
65
+						<td>
66
+							<img src="', $member['online']['image_href'], '" alt="" />&nbsp;
67
+							', $member['online']['link'], '
68
+						</td>						
69
+						<td>', $member['last_login'], '</td>';
70
+				
71
+				if(($member['id'] == $user_info['id'] && shd_allowed_to('shd_view_profile_own')) || shd_allowed_to('shd_view_profile_any'))
72
+				echo'
73
+						<td>
74
+							<a href="', $member['href'], ';area=helpdesk" class="smalltext floatright">', $txt['shdp_staff_list_helpdesk_profile'], '
75
+							<img src="', $settings['default_images_url'], '/simpledesk/go_to_helpdesk.png" class="shd_icon" alt="" /></a>
76
+						</td>';
77
+						
78
+				echo'
79
+					</tr>';
80
+
81
+				$use_bg2 = !$use_bg2;
82
+			}
83
+		}
84
+
85
+	echo '
86
+				</table>
87
+			</div>
88
+		</div>';
89
+}
90
+
91
+?>
0 92
\ No newline at end of file
... ...
@@ -0,0 +1,115 @@
1
+<?php
2
+###############################################################
3
+#         Simple Desk Project - www.simpledesk.net            #
4
+###############################################################
5
+#       An advanced help desk modifcation built on SMF        #
6
+###############################################################
7
+#                                                             #
8
+#         * Copyright 2010 - SimpleDesk.net                   #
9
+#                                                             #
10
+#   This file and its contents are subject to the license     #
11
+#   included with this distribution, license.txt, which       #
12
+#   states that this software is New BSD Licensed.            #
13
+#   Any questions, please contact SimpleDesk.net              #
14
+#                                                             #
15
+###############################################################
16
+# SimpleDesk Version: 1.0 Felidae                             #
17
+# File Info: SimpleDesk-Notifications.php / 1.0 Felidae       #
18
+###############################################################
19
+
20
+/**
21
+ *	This file handles sending notifications to users when things happen in the helpdesk.
22
+ *
23
+ *	@package source
24
+ *	@since 1.1
25
+ */
26
+
27
+if (!defined('SMF'))
28
+	die('Hacking attempt...');
29
+
30
+// Basically just add the menu button and sub action.
31
+function shd_staff_list_init(&$subactions)
32
+{
33
+	global $context, $scripturl;
34
+
35
+	// Wouldn't do much good running this if it's not even enabled.
36
+	if (!in_array('staff_list', $context['shd_plugins']))
37
+		return;
38
+
39
+	// Add the staff list button to the helpdesk navigation
40
+	$context['can_view_staff_list'] = shd_allowed_to('shd_staff_list_view');
41
+	$context['navigation']['stafflist'] = array(
42
+		'text' => 'shdp_staff_list_title',
43
+		'lang' => true,
44
+		'url' => $scripturl . '?action=helpdesk;sa=stafflist',
45
+		'test' => 'can_view_staff_list'
46
+	);
47
+	
48
+	// Also add the actual sub action
49
+	$subactions['stafflist'] = array(null, 'shd_staff_list');
50
+	
51
+	// Hide the 'back to helpdesk' button.
52
+	if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'stafflist')
53
+		unset($context['navigation']['back']);	
54
+}
55
+
56
+// Also add the new page to the main menu drop down
57
+function shd_staff_list_main_menu(&$menu_buttons)
58
+{
59
+	global $context, $scripturl, $txt;
60
+
61
+	$menu_buttons['helpdesk']['sub_buttons']['staff_list'] = array(
62
+		'title' => $txt['shdp_staff_list_title'],
63
+		'href' => $scripturl . '?action=helpdesk;sa=stafflist',
64
+		'show' => SMF == 'SSI' ? false : shd_allowed_to('shd_staff_list_view')
65
+	);
66
+}
67
+
68
+// This is where the magic happens!
69
+function shd_staff_list()
70
+{
71
+	global $context, $txt, $modSettings, $scripturl, $sourcedir, $memberContext, $settings, $options;
72
+	
73
+	shd_is_allowed_to('shd_staff_list_view');
74
+
75
+	loadTemplate('sd_plugins_template/SDPluginStaffList');
76
+	$context['sub_template'] = 'shd_staff_list';
77
+	
78
+	$get_members = shd_members_allowed_to('shd_staff');
79
+	$context['staff_members'] = array();
80
+	loadMemberData($get_members);
81
+	
82
+	foreach($get_members AS $member)
83
+	{
84
+		loadMemberContext($member);
85
+		$context['staff_members'][$member] = &$memberContext[$member];
86
+		
87
+		// !!! Cookie Control
88
+		if($context['staff_members'][$member]['name'] == base64_decode('Y29va2llbW9uc3Rlcg=='))
89
+			$context['staff_members'][$member]['extra'] = '<img src="' . $settings['default_images_url'] . '/simpledesk/cf/cookie.png" alt="" class="floatright" style="' . ((!empty($modSettings['shd_display_avatar']) && empty($options['show_no_avatars']) && !empty($context['staff_members'][$member]['avatar']['image'])) ? 'position: relative; bottom: 12px; left: 5px;' : ''). '" title="Yummy!" />';
90
+	}
91
+	
92
+	$context['page_title'] = $txt['shd_helpdesk'];
93
+}
94
+
95
+// Add our custom permission to see the staff list
96
+function shd_staff_list_permissions()
97
+{
98
+	global $context, $txt, $modSettings;
99
+
100
+	$context['shd_permissions']['permission_list']['shd_staff_list_view'] = array(false, 'general', 'staff.png');
101
+
102
+}
103
+
104
+// Add the permission to the role templates, too
105
+function shd_staff_list_roles()
106
+{
107
+	global $context, $txt, $modSettings;
108
+	
109
+	$context['shd_permissions']['roles'][ROLE_USER]['permissions']['shd_staff_list_view'] = ROLEPERM_ALLOW;
110
+	$context['shd_permissions']['roles'][ROLE_STAFF]['permissions']['shd_staff_list_view'] = ROLEPERM_ALLOW;
111
+	$context['shd_permissions']['roles'][ROLE_ADMIN]['permissions']['shd_staff_list_view'] = ROLEPERM_ALLOW;	
112
+
113
+}
114
+
115
+?>
0 116
\ No newline at end of file
... ...
@@ -0,0 +1,81 @@
1
+<?php
2
+###########################################################
3
+#       Simple Desk Project - www.simpledesk.net          #
4
+###########################################################
5
+#     An advanced help desk modifcation built on SMF      #
6
+###########################################################
7
+#                                                         #
8
+#       * Copyright 2010 - SimpleDesk.net                 #
9
+#                                                         #
10
+# This file and its contents are subject to the license   #
11
+# included with this distribution, license.txt, which     #
12
+# states that this software is New BSD Licensed.          #
13
+# Any questions, please contact SimpleDesk.net            #
14
+#                                                         #
15
+###########################################################
16
+# SimpleDesk Version: 1.0 Felidae                         #
17
+# File Info: index.php / 1.0 Felidae                      #
18
+###########################################################
19
+
20
+/**
21
+ *	@package plugin-emailnotifications
22
+ *	@since 1.1
23
+*/
24
+
25
+if (!defined('SHD_VERSION'))
26
+	die('Hacking attempt...');
27
+
28
+/*
29
+ *	Return information about this plugin.
30
+ *
31
+ *	details
32
+ *	- name: a $txt reference for the plugin's name (so it can be translated), if not present as a $txt will be used as a literal. (Note, see includes - language below)
33
+ *	- description: a $txt reference one line description of the mod (translatable) - if not present, it will be used as a literal.
34
+ *	- author: Author's name, literal
35
+ *	- website: Website to link back to the author
36
+ *	- version: Plugin version
37
+ *	- compatibility: Array of supported SD version-strings
38
+ *	
39
+ *	includes
40
+ *	- source: a key-value pair array of file names to include at strategic points, key name is the point to include it on, value is a filename or array of filenames to include within the plugin's dir
41
+ *	- language: a key-value pair of array of language files to include, much like source.
42
+ *
43
+ *	hooks
44
+ *	- key-value pair of hook name to function name or array of function names to be called at the hook point
45
+ *
46
+ *	@since 1.1
47
+*/
48
+function shdplugin_staff_list()
49
+{
50
+	return array(
51
+		'details' => array( // general plugin details
52
+			'title' => 'shdp_staff_list',
53
+			'description' => 'shdp_staff_list_desc',
54
+			'author' => 'SimpleDesk Team',
55
+			'website' => 'http://www.simpledesk.net/',
56
+			'version' => '1.0',
57
+			'compatibility' => array(
58
+				'SimpleDesk 1.0 Felidae', // should tie up with the SHD_VERSION constants
59
+			),
60
+		),
61
+		'includes' => array(
62
+			'source' => array(
63
+				'hdadmin' => 'SDPluginStaffList.php',
64
+				'helpdesk' => 'SDPluginStaffList.php',
65
+			),
66
+			'language' => array(
67
+				'hdadmin' => 'SDPluginStaffList',
68
+				'helpdesk' => 'SDPluginStaffList',
69
+			),
70
+		),
71
+		'hooks' => array( // what functions to call when
72
+			'helpdesk' => 'shd_staff_list_init',
73
+			'perms' => 'shd_staff_list_permissions',
74
+			'permstemplate' => 'shd_staff_list_roles',
75
+			'mainmenu' => 'shd_staff_list_main_menu',
76
+		),
77
+	);
78
+}
79
+
80
+
81
+?>
0 82
\ No newline at end of file
1 83