+ Slightly updated the front page plugin and bundled it with the core. :) ! Fixed error in install.php (hopefully)
cookiemonster

cookiemonster commited on 2010-12-04 11:08:15
Showing 5 changed files, with 214 additions and 2 deletions.

... ...
@@ -250,7 +250,7 @@ $tables[] = array(
250 250
 		db_field('can_edit', 'varchar', 3, '0,0'),
251 251
 		db_field('display_empty', 'tinyint'),
252 252
 		db_field('required', 'tinyint'),		
253
-		db_field('placement', 'tinyint', 3, 1),			
253
+		db_field('placement', 'tinyint', 0, 1),			
254 254
 	),
255 255
 	'indexes' => array(
256 256
 		array(
... ...
@@ -272,7 +272,7 @@ $tables[] = array(
272 272
 	),
273 273
 	'indexes' => array(
274 274
 		array(
275
-			'columns' => array('id_post', 'active'),
275
+			'columns' => array('id_post'),
276 276
 			'type' => 'primary',
277 277
 		),
278 278
 	),
... ...
@@ -0,0 +1,40 @@
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 main language file
20
+
21
+// Important! Before editing these language files please read the text at the top of index.english.php.
22
+
23
+$txt['shdp_frontpage'] = 'Front Page';
24
+$txt['shdp_frontpage_desc'] = 'This plugin allows you to create a front page in place of the ticket listing, for news, announcements and so on.';
25
+$txt['shdp_frontpage_main_desc'] = 'This area allows you to configure the front page of the helpdesk, when it is presented and what it contains.';
26
+
27
+$txt['shdp_frontpage_type'] = 'Type of front page content';
28
+$txt['shdp_frontpage_type_html'] = 'Plain HTML';
29
+$txt['shdp_frontpage_type_php'] = 'Raw PHP';
30
+$txt['shdp_frontpage_type_bbcode'] = 'Bulletin board code';
31
+
32
+$txt['shdp_frontpage_appear'] = 'When it should appear';
33
+$txt['shdp_frontpage_appear_always'] = 'Always as the front page';
34
+$txt['shdp_frontpage_appear_firstload'] = 'Only at the first time of login';
35
+
36
+$txt['shdp_frontpage_content'] = 'Main content';
37
+
38
+$txt['shdp_tickets'] = 'Tickets';
39
+
40
+?>
0 41
\ No newline at end of file
... ...
@@ -0,0 +1,152 @@
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
+function shd_frontpage_helpdesk(&$subactions)
31
+{
32
+	global $context, $scripturl, $modSettings;
33
+
34
+	// Enabled?
35
+	if (empty($modSettings['shdp_frontpage_content']) || !in_array('front_page', $context['shd_plugins']))
36
+		return;
37
+
38
+	// Are we doing it this load or not?
39
+	if (!empty($modSettings['shdp_frontpage_appear']) && $modSettings['shdp_frontpage_appear'] == 'firstload')
40
+	{
41
+		// So, check $_SESSION. If it's set (i.e. we've been here this session, leave; otherwise skip this section, we're coming here every time)
42
+		if (isset($_SESSION['shdp_frontpage']))
43
+			return;
44
+		else
45
+			$_SESSION['shdp_frontpage'] = 1;
46
+	}
47
+
48
+	// Fix the navigation to have a tickets button as well as the main button
49
+	$navigation = $context['navigation'];
50
+	$context['navigation'] = array();
51
+
52
+	foreach ($navigation as $area => $details)
53
+	{
54
+		$context['navigation'][$area] = $details;
55
+		if ($area == 'main')
56
+		{
57
+			$context['navigation']['tickets'] = array(
58
+				'text' => 'shdp_tickets',
59
+				'lang' => true,
60
+				'url' => $scripturl . '?action=helpdesk;sa=tickets',
61
+			);
62
+		}
63
+	}
64
+	
65
+	// Now, fix the actions
66
+	$subactions['main'] = array(null, 'shd_frontpage_source');
67
+	$subactions['tickets'] = array(null, 'shd_main_helpdesk');
68
+}
69
+
70
+function shd_frontpage_options($return_config)
71
+{
72
+	global $context, $modSettings, $txt;
73
+
74
+	$config_vars = array(
75
+		array('select', 'shdp_frontpage_appear', array('always' => $txt['shdp_frontpage_appear_always'], 'firstload' => $txt['shdp_frontpage_appear_firstload'])),
76
+		'',
77
+		array('select', 'shdp_frontpage_type', array('html' => $txt['shdp_frontpage_type_html'], 'php' => $txt['shdp_frontpage_type_php'], 'bbcode' => $txt['shdp_frontpage_type_bbcode'])),
78
+		array('large_text', 'shdp_frontpage_content', 'size' => 30),
79
+	);
80
+	$context['settings_title'] = $txt['shdp_frontpage'];
81
+	$context['settings_icon'] = 'frontpage.png';
82
+
83
+	return $config_vars;
84
+}
85
+
86
+function shd_frontpage_adminmenu(&$admin_areas)
87
+{
88
+	global $context, $modSettings, $txt;
89
+
90
+	// Enabled?
91
+	if (!in_array('front_page', $context['shd_plugins']))
92
+		return;
93
+
94
+	$admin_areas['helpdesk_info']['areas']['helpdesk_options']['subsections']['frontpage'] = array($txt['shdp_frontpage']);
95
+}
96
+
97
+function shd_frontpage_hdadminopts()
98
+{
99
+	global $context, $modSettings, $txt;
100
+
101
+	// Enabled?
102
+	if (!in_array('front_page', $context['shd_plugins']))
103
+		return;
104
+
105
+	$context[$context['admin_menu_name']]['tab_data']['tabs']['frontpage'] = array(
106
+		'description' => $txt['shdp_frontpage_main_desc'],
107
+		'function' => 'shd_frontpage_options',
108
+	);
109
+}
110
+
111
+function shd_frontpage_hdadminoptssrch(&$settings_search)
112
+{
113
+	global $context, $modSettings;
114
+
115
+	// Enabled?
116
+	if (!in_array('front_page', $context['shd_plugins']))
117
+		return;
118
+
119
+	$settings_search[] = array('shd_frontpage_options', 'area=helpdesk_options;sa=frontpage');
120
+}
121
+
122
+function shd_frontpage_source()
123
+{
124
+	global $context, $txt, $modSettings;
125
+
126
+	loadTemplate('sd_plugins_template/SDPluginFrontPage');
127
+	$context['sub_template'] = 'shd_frontpage';
128
+	$context['page_title'] = $txt['shd_helpdesk'];
129
+
130
+	$context['shdp_frontpage_content'] = '';
131
+
132
+	if (empty($modSettings['shdp_frontpage_type']))
133
+		$modSettings['shdp_frontpage_type'] = 'html';
134
+
135
+	switch ($modSettings['shdp_frontpage_type'])
136
+	{
137
+		case 'html':
138
+			$context['shdp_frontpage_content'] = $modSettings['shdp_frontpage_content'];
139
+			break;
140
+		case 'php':
141
+			ob_start();
142
+			eval($modSettings['shdp_frontpage_content']);
143
+			$context['shdp_frontpage_content'] = ob_get_contents();
144
+			ob_end_clean();
145
+			break;
146
+		case 'bbcode':
147
+			$context['shdp_frontpage_content'] = shd_format_text($modSettings['shdp_frontpage_content'], true, 'shdp_frontpage');
148
+			break;
149
+	}
150
+}
151
+
152
+?>
0 153
\ No newline at end of file
... ...
@@ -0,0 +1,20 @@
1
+<?php
2
+// Version: 1.0
3
+
4
+function template_shd_frontpage()
5
+{
6
+	global $context, $txt, $settings, $scripturl;
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
+			', $context['shdp_frontpage_content'], '
17
+		</div>';
18
+}
19
+
20
+?>
0 21
\ No newline at end of file
1 22