nas commited on 2010-11-30 09:50:56
Showing 2 changed files, with 67 additions and 0 deletions.
... | ... |
@@ -0,0 +1,50 @@ |
1 |
+<?xml version="1.0"?> |
|
2 |
+<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification"> |
|
3 |
+ |
|
4 |
+<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/"> |
|
5 |
+ <id>SimpleDeskTeam:ErrorLogCounter</id> |
|
6 |
+ <version>1.0</version> |
|
7 |
+ |
|
8 |
+ <file name="$sourcedir/Subs.php"> |
|
9 |
+ <operation><!-- Figure out the number of items --> |
|
10 |
+ <search position="end" /> |
|
11 |
+ <add><![CDATA[ |
|
12 |
+ |
|
13 |
+// SimpleDesk team: Error Log Counter |
|
14 |
+function get_error_log_count_for_menu() |
|
15 |
+{ |
|
16 |
+ global $context, $smcFunc; |
|
17 |
+ if (!$context['user']['is_admin']) |
|
18 |
+ return ''; |
|
19 |
+ |
|
20 |
+ if (!isset($context['num_errors_in_log'])) |
|
21 |
+ { |
|
22 |
+ $query = $smcFunc['db_query']('', ' |
|
23 |
+ SELECT COUNT(id_error) AS errors |
|
24 |
+ FROM {db_prefix}log_errors', |
|
25 |
+ array() |
|
26 |
+ ); |
|
27 |
+ |
|
28 |
+ if ($row = $smcFunc['db_fetch_row']($query)) |
|
29 |
+ $context['num_errors_in_log'] = $row[0] > 0 ? ' (<strong>' . $row[0] . '</strong>)' : ''; |
|
30 |
+ else |
|
31 |
+ $context['num_errors_in_log'] = ''; |
|
32 |
+ } |
|
33 |
+ |
|
34 |
+ return $context['num_errors_in_log']; |
|
35 |
+} |
|
36 |
+]]></add> |
|
37 |
+ </operation> |
|
38 |
+ <operation><!-- Add it to the menu item --> |
|
39 |
+ <search position="replace"><![CDATA['title' => $txt['errlog'],]]></search> |
|
40 |
+ <add><![CDATA['title' => $txt['errlog'] . get_error_log_count_for_menu(),]]></add> |
|
41 |
+ </operation> |
|
42 |
+ </file> |
|
43 |
+ |
|
44 |
+ <file name="$sourcedir/Admin.php"> |
|
45 |
+ <operation><!-- Add to the logs menu too --> |
|
46 |
+ <search position="replace"><![CDATA['errorlog' => array($txt['errlog'],]]></search> |
|
47 |
+ <add><![CDATA['errorlog' => array($txt['errlog'] . get_error_log_count_for_menu(),]]></add> |
|
48 |
+ </operation> |
|
49 |
+ </file> |
|
50 |
+</modification> |
|
0 | 51 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,17 @@ |
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>SimpleDeskTeam:ErrorLogCounter</id> |
|
5 |
+ <name>Error Log Counter</name> |
|
6 |
+ <version>1.0</version> |
|
7 |
+ <type>modification</type> |
|
8 |
+ |
|
9 |
+ <install for="2.0 RC2, 2.0 RC3"> |
|
10 |
+ <modification type="file">install20.xml</modification> |
|
11 |
+ </install> |
|
12 |
+ |
|
13 |
+ <uninstall for="2.0 RC2, 2.0 RC3"> |
|
14 |
+ <modification type="file" reverse="true">install20.xml</modification> |
|
15 |
+ </uninstall> |
|
16 |
+ |
|
17 |
+</package-info> |
|
0 | 18 |
\ No newline at end of file |
1 | 19 |