gruffen commited on 2011-08-01 15:10:26
Showing 7 changed files, with 366 additions and 0 deletions.
... | ... |
@@ -0,0 +1,35 @@ |
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: 2.0 Anatidae # |
|
17 |
+# File Info: SDPluginTidyChildBoards.english.php / 2.0 Anatidae # |
|
18 |
+################################################################## |
|
19 |
+// Version: 2.0 Anatidae; SimpleDesk tidy child boards plugin |
|
20 |
+ |
|
21 |
+// Important! Before editing these language files please read the text at the top of index.english.php. |
|
22 |
+ |
|
23 |
+$txt['shdp_tidy_child_boards'] = 'Tidy Child Boards'; |
|
24 |
+$txt['shdp_tidy_child_boards_desc'] = 'This plugin tidies up the look of your board index.'; |
|
25 |
+ |
|
26 |
+$txt['tidy_child_boards'] = 'Arrange child boards in to columns'; |
|
27 |
+$txt['tidy_child_boards_no'] = 'Do not put in columns (default)'; |
|
28 |
+$txt['tidy_child_boards_2col'] = 'Two columns'; |
|
29 |
+$txt['tidy_child_boards_3col'] = 'Three columns'; |
|
30 |
+$txt['tidy_child_boards_4col'] = 'Four columns'; |
|
31 |
+$txt['tidy_child_boards_icon'] = 'Display small board icon next to child board'; |
|
32 |
+$txt['tidy_child_boards_bold'] = 'Display unread child boards in bold'; |
|
33 |
+$txt['tidy_child_boards_new'] = 'Display [new] image next to unread child boards'; |
|
34 |
+ |
|
35 |
+?> |
|
0 | 36 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,35 @@ |
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: 2.0 Anatidae # |
|
17 |
+# File Info: SDPluginTidyChildBoards.english.php / 2.0 Anatidae # |
|
18 |
+################################################################## |
|
19 |
+// Version: 2.0 Anatidae; SimpleDesk tidy child boards plugin |
|
20 |
+ |
|
21 |
+// Important! Before editing these language files please read the text at the top of index.english.php. |
|
22 |
+ |
|
23 |
+$txt['shdp_tidy_child_boards'] = 'Tidy Child Boards'; |
|
24 |
+$txt['shdp_tidy_child_boards_desc'] = 'This plugin tidies up the look of your board index.'; |
|
25 |
+ |
|
26 |
+$txt['tidy_child_boards'] = 'Arrange child boards in to columns'; |
|
27 |
+$txt['tidy_child_boards_no'] = 'Do not put in columns (default)'; |
|
28 |
+$txt['tidy_child_boards_2col'] = 'Two columns'; |
|
29 |
+$txt['tidy_child_boards_3col'] = 'Three columns'; |
|
30 |
+$txt['tidy_child_boards_4col'] = 'Four columns'; |
|
31 |
+$txt['tidy_child_boards_icon'] = 'Display small board icon next to child board'; |
|
32 |
+$txt['tidy_child_boards_bold'] = 'Display unread child boards in bold'; |
|
33 |
+$txt['tidy_child_boards_new'] = 'Display [new] image next to unread child boards'; |
|
34 |
+ |
|
35 |
+?> |
|
0 | 36 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,35 @@ |
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: 2.0 Anatidae # |
|
17 |
+# File Info: SDPluginTidyChildBoards.english.php / 2.0 Anatidae # |
|
18 |
+################################################################## |
|
19 |
+// Version: 2.0 Anatidae; SimpleDesk tidy child boards plugin |
|
20 |
+ |
|
21 |
+// Important! Before editing these language files please read the text at the top of index.english.php. |
|
22 |
+ |
|
23 |
+$txt['shdp_tidy_child_boards'] = 'Tidy Child Boards'; |
|
24 |
+$txt['shdp_tidy_child_boards_desc'] = 'This plugin tidies up the look of your board index.'; |
|
25 |
+ |
|
26 |
+$txt['tidy_child_boards'] = 'Arrange child boards in to columns'; |
|
27 |
+$txt['tidy_child_boards_no'] = 'Do not put in columns (default)'; |
|
28 |
+$txt['tidy_child_boards_2col'] = 'Two columns'; |
|
29 |
+$txt['tidy_child_boards_3col'] = 'Three columns'; |
|
30 |
+$txt['tidy_child_boards_4col'] = 'Four columns'; |
|
31 |
+$txt['tidy_child_boards_icon'] = 'Display small board icon next to child board'; |
|
32 |
+$txt['tidy_child_boards_bold'] = 'Display unread child boards in bold'; |
|
33 |
+$txt['tidy_child_boards_new'] = 'Display [new] image next to unread child boards'; |
|
34 |
+ |
|
35 |
+?> |
|
0 | 36 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,35 @@ |
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: 2.0 Anatidae # |
|
17 |
+# File Info: SDPluginTidyChildBoards.english.php / 2.0 Anatidae # |
|
18 |
+################################################################## |
|
19 |
+// Version: 2.0 Anatidae; SimpleDesk tidy child boards plugin |
|
20 |
+ |
|
21 |
+// Important! Before editing these language files please read the text at the top of index.english.php. |
|
22 |
+ |
|
23 |
+$txt['shdp_tidy_child_boards'] = 'Tidy Child Boards'; |
|
24 |
+$txt['shdp_tidy_child_boards_desc'] = 'This plugin tidies up the look of your board index.'; |
|
25 |
+ |
|
26 |
+$txt['tidy_child_boards'] = 'Arrange child boards in to columns'; |
|
27 |
+$txt['tidy_child_boards_no'] = 'Do not put in columns (default)'; |
|
28 |
+$txt['tidy_child_boards_2col'] = 'Two columns'; |
|
29 |
+$txt['tidy_child_boards_3col'] = 'Three columns'; |
|
30 |
+$txt['tidy_child_boards_4col'] = 'Four columns'; |
|
31 |
+$txt['tidy_child_boards_icon'] = 'Display small board icon next to child board'; |
|
32 |
+$txt['tidy_child_boards_bold'] = 'Display unread child boards in bold'; |
|
33 |
+$txt['tidy_child_boards_new'] = 'Display [new] image next to unread child boards'; |
|
34 |
+ |
|
35 |
+?> |
|
0 | 36 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,25 @@ |
1 |
+<?xml version="1.0"?> |
|
2 |
+<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info"> |
|
3 |
+<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/"> |
|
4 |
+ <id>Arantor:Tidy_Child_Boards</id> |
|
5 |
+ <name>Tidy Child Boards</name> |
|
6 |
+ <version>1.0</version> |
|
7 |
+ <type>sdplugin</type> |
|
8 |
+ <install for="2.0"> |
|
9 |
+ <require-file name="SDPluginTidyChildBoards.english.php" destination="$languagedir" /> |
|
10 |
+ <require-file name="SDPluginTidyChildBoards.english-utf8.php" destination="$languagedir" /> |
|
11 |
+ <require-file name="SDPluginTidyChildBoards.english_british.php" destination="$languagedir" /> |
|
12 |
+ <require-file name="SDPluginTidyChildBoards.english_british-utf8.php" destination="$languagedir" /> |
|
13 |
+ <require-dir name="tidy_child_boards" destination="$sourcedir/sd_plugins_source" /> |
|
14 |
+ |
|
15 |
+ <redirect url="?action=admin;area=helpdesk_plugins#js_feature_tally" /> |
|
16 |
+ </install> |
|
17 |
+ |
|
18 |
+ <uninstall for="2.0"> |
|
19 |
+ <remove-file name="$languagedir/SDPluginTidyChildBoards.english.php" /> |
|
20 |
+ <remove-file name="$languagedir/SDPluginTidyChildBoards-utf8.english.php" /> |
|
21 |
+ <remove-file name="$languagedir/SDPluginTidyChildBoards_british.english.php" /> |
|
22 |
+ <remove-file name="$languagedir/SDPluginTidyChildBoards_british-utf8.english.php" /> |
|
23 |
+ <remove-dir name="$sourcedir/sd_plugins_source/tidy_child_boards" /> |
|
24 |
+ </uninstall> |
|
25 |
+</package-info> |
|
0 | 26 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,123 @@ |
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: 2.0 Anatidae # |
|
17 |
+# File Info: SDPluginReportToHelpdesk.php / 2.0 Anatidae # |
|
18 |
+############################################################### |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * This file handles tallying up custom fields. It's rather naughty because, for convenience (and performance), we invoke it during a template. |
|
22 |
+ * |
|
23 |
+ * Even more naughty, we don't bother to separate it out into a separate template. Good practice suggests we should but here, it's almost unnecessarily complicating matters. |
|
24 |
+ * |
|
25 |
+ * @package plugin |
|
26 |
+ * @since 2.0 |
|
27 |
+ */ |
|
28 |
+ |
|
29 |
+if (!defined('SMF')) |
|
30 |
+ die('Hacking attempt...'); |
|
31 |
+ |
|
32 |
+function shdp_tidy_child_boards_process(&$boardIndexOptions, &$categories) |
|
33 |
+{ |
|
34 |
+ global $settings, $modSettings, $context, $txt; |
|
35 |
+ |
|
36 |
+ if (empty($modSettings['tidy_child_boards']) || $modSettings['tidy_child_boards'] < 2 || $modSettings['tidy_child_boards'] > 4) |
|
37 |
+ return; |
|
38 |
+ |
|
39 |
+ if (file_exists($settings['theme_dir'] . '/images/on.png')) |
|
40 |
+ $ext = 'png'; |
|
41 |
+ elseif (file_exists($settings['theme_dir'] . '/images/on.gif')) |
|
42 |
+ $ext = 'gif'; |
|
43 |
+ else |
|
44 |
+ $ext = ''; |
|
45 |
+ |
|
46 |
+ foreach ($categories as $cat_id => $category) |
|
47 |
+ foreach ($category['boards'] as $board_id => $board) |
|
48 |
+ if (!empty($board['children'])) |
|
49 |
+ { |
|
50 |
+ $limit = ceil(count($board['children']) / $modSettings['tidy_child_boards']); |
|
51 |
+ $children = array(); |
|
52 |
+ $this_count = $limit + 1; |
|
53 |
+ $this_division = 0; |
|
54 |
+ foreach ($board['children'] as $child) |
|
55 |
+ { |
|
56 |
+ if($this_count >= $limit) |
|
57 |
+ { |
|
58 |
+ $this_division++; |
|
59 |
+ $this_count = 0; |
|
60 |
+ } |
|
61 |
+ $children[$this_division][] = $child; |
|
62 |
+ $this_count++; |
|
63 |
+ } |
|
64 |
+ |
|
65 |
+ $new_html = '<div class="board_children">'; |
|
66 |
+ foreach ($children as $key => $child_block) |
|
67 |
+ { |
|
68 |
+ $new_html .= '<div class="tidy_child"><ul>'; |
|
69 |
+ |
|
70 |
+ foreach($child_block as $child) |
|
71 |
+ { |
|
72 |
+ $new_html .= '<li>'; |
|
73 |
+ |
|
74 |
+ if (!empty($modSettings['tidy_child_boards_icon']) && !empty($ext)) |
|
75 |
+ $new_html .= '<img src="' . $settings['images_url'] . '/' . ($child['new'] ? 'on' : 'off') . '.' . $ext . '" width="12" height="12" alt=""> '; |
|
76 |
+ |
|
77 |
+ if (!$child['is_redirect']) |
|
78 |
+ $link = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
79 |
+ else |
|
80 |
+ $link = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>'; |
|
81 |
+ |
|
82 |
+ if (!empty($modSettings['tidy_child_boards_new']) && $child['new']) |
|
83 |
+ $link .= ' <a href="' . $child['href'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" /></a>'; |
|
84 |
+ |
|
85 |
+ // Has it posts awaiting approval? |
|
86 |
+ if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics'])) |
|
87 |
+ $link .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > $child['unapproved_posts'] ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
88 |
+ |
|
89 |
+ if (!empty($modSettings['tidy_child_boards_bold']) && $child['new']) |
|
90 |
+ $link = '<strong>' . $link . '</strong>'; |
|
91 |
+ |
|
92 |
+ $new_html .= $link . '</li>'; |
|
93 |
+ } |
|
94 |
+ |
|
95 |
+ $new_html .= '</ul></div>'; |
|
96 |
+ } |
|
97 |
+ |
|
98 |
+ $new_html .= '</div>'; |
|
99 |
+ $categories[$cat_id]['boards'][$board_id]['description'] .= $new_html; |
|
100 |
+ $categories[$cat_id]['boards'][$board_id]['children'] = array(); |
|
101 |
+ $done = true; |
|
102 |
+ } |
|
103 |
+ |
|
104 |
+ if (!empty($done)) |
|
105 |
+ { |
|
106 |
+ $context['html_headers'] .= '<style type="text/css">.tidy_child ul { list-style:none; padding:0 0.5em; } .tidy_child { display:block; float:left; width:' . floor(($context['browser']['is_ie'] ? 120 : 100) / $modSettings['tidy_child_boards']) . '%; }</style>'; |
|
107 |
+ } |
|
108 |
+} |
|
109 |
+ |
|
110 |
+function shdp_tidy_child_boards_admin(&$config_vars, &$return_config) |
|
111 |
+{ |
|
112 |
+ global $txt; |
|
113 |
+ |
|
114 |
+ $config_vars = array_merge($config_vars, array( |
|
115 |
+ '', |
|
116 |
+ array('select', 'tidy_child_boards', array(1 => $txt['tidy_child_boards_no'], 2 => $txt['tidy_child_boards_2col'], 3 => $txt['tidy_child_boards_3col'], 4 => $txt['tidy_child_boards_4col'])), |
|
117 |
+ array('check', 'tidy_child_boards_bold'), |
|
118 |
+ array('check', 'tidy_child_boards_icon'), |
|
119 |
+ array('check', 'tidy_child_boards_new') |
|
120 |
+ )); |
|
121 |
+} |
|
122 |
+ |
|
123 |
+?> |
|
0 | 124 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,78 @@ |
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: 2.0 Anatidae # |
|
17 |
+# File Info: index.php / 2.0 Anatidae # |
|
18 |
+########################################################### |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * @package plugin-reporttohelpdesk |
|
22 |
+ * @since 2.0 |
|
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 2.0 |
|
47 |
+*/ |
|
48 |
+function shdplugin_tidy_child_boards() |
|
49 |
+{ |
|
50 |
+ return array( |
|
51 |
+ 'details' => array( // general plugin details |
|
52 |
+ 'title' => 'shdp_tidy_child_boards', |
|
53 |
+ 'description' => 'shdp_tidy_child_boards_desc', |
|
54 |
+ 'author' => 'Arantor', |
|
55 |
+ 'website' => 'http://innovatenotimitate.com/', |
|
56 |
+ 'version' => '1.0', |
|
57 |
+ 'compatibility' => array( |
|
58 |
+ 'SimpleDesk 2.0 Anatidae', // should tie up with the SHD_VERSION constants |
|
59 |
+ ), |
|
60 |
+ 'acp_url' => 'action=admin;area=helpdesk_options;sa=display', |
|
61 |
+ ), |
|
62 |
+ 'includes' => array( |
|
63 |
+ 'source' => array( |
|
64 |
+ 'init' => 'SDPluginTidyChildBoards.php', |
|
65 |
+ ), |
|
66 |
+ 'language' => array( |
|
67 |
+ 'hdadmin' => 'SDPluginTidyChildBoards', |
|
68 |
+ ), |
|
69 |
+ ), |
|
70 |
+ 'hooks' => array( // what functions to call when |
|
71 |
+ 'boardindex_before' => 'shdp_tidy_child_boards_process', |
|
72 |
+ 'admin_display' => 'shdp_tidy_child_boards_admin', |
|
73 |
+ ), |
|
74 |
+ ); |
|
75 |
+} |
|
76 |
+ |
|
77 |
+ |
|
78 |
+?> |
|
0 | 79 |
\ No newline at end of file |
1 | 80 |