Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <? |
3 | 3 | if ( !defined( 'MEDIAWIKI' ) ) { |
4 | 4 | echo "This is a part of mediawiki and can't be started separately"; |
5 | | - die(); |
| 5 | + die(); |
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
— | — | @@ -23,24 +23,25 @@ |
24 | 24 | public static function Get_Html( $text, $mode) |
25 | 25 | { |
26 | 26 | global $wgOnlineStatusBarModes, $wgOnlineStatusBarIcon, $wgOnlineStatusBarColor, $wgOnlineStatusBarY; |
27 | | - $color= $wgOnlineStatusBarColor[$mode]; |
28 | | - return '<div style="right:0px; margin-top:-10px;" class="metadata topicon" id="status-top"><div style="border: 0px solid black; background: transparent; float: right; position: relative; top:' . $wgOnlineStatusBarY . 'px; padding: 5px"><p><b>' . $text . ': <span style="color: ' . $color . '; font:bold;"><img alt=' . $text . " - " . $mode .' src="' . $wgOnlineStatusBarIcon[$mode] . '" width="20" height="20" />' . $wgOnlineStatusBarModes[$mode] . '</span></b></p></div></div>'; |
| 27 | + $icon = "$wgExtensionAssetsPath/OnlineStatusBar/{$wgOnlineStatusBarModes[$mode]}"; |
| 28 | + $color = $wgOnlineStatusBarColor[$mode]; |
| 29 | + return '<div style="right:0px; margin-top:-10px;" class="metadata topicon" id="status-top"><div style="border: 0px solid black; background: transparent; float: right; position: relative; top:' . $wgOnlineStatusBarY . 'px; padding: 5px"><p><b>' . $text . ': <span style="color: ' . $color . '; font:bold;"><img alt=' . $text . " - " . $mode .' src="' . $wgOnlineStatusBarIcon[$mode] . '" width="20" height="20" />' . $icon . '</span></b></p></div></div>'; |
29 | 30 | } |
30 | 31 | |
31 | 32 | static function UpdateDb() |
32 | 33 | { |
33 | | - global $wgUser, $wgDBname, $wgOnlineStatusBarTable; |
34 | | - if ( OnlineStatusBar::GetStatus($wgUser->getID()) != $OnlineStatusBar->DefaultOnline ) |
35 | | - { |
36 | | - $dbw = wfGetDB( DB_MASTER ); |
37 | | - $now = OnlineStatusBar::GetNow(); |
38 | | - $row = array( |
39 | | - 'userid' => $wgUser->getID(), |
40 | | - 'username' => $wgUser->getName(), |
41 | | - 'timestamp' => $now, |
42 | | - ); |
43 | | - $dbw->insert( $wgOnlineStatusBarTable, $row, __METHOD__, 'DELAYED' ); |
44 | | - } |
| 34 | + global $wgUser, $wgDBname, $wgOnlineStatusBarTable; |
| 35 | + if ( OnlineStatusBar::GetStatus($wgUser->getID()) != $OnlineStatusBar->DefaultOnline ) |
| 36 | + { |
| 37 | + $dbw = wfGetDB( DB_MASTER ); |
| 38 | + $now = OnlineStatusBar::GetNow(); |
| 39 | + $row = array( |
| 40 | + 'userid' => $wgUser->getID(), |
| 41 | + 'username' => $wgUser->getName(), |
| 42 | + 'timestamp' => $now, |
| 43 | + ); |
| 44 | + $dbw->insert( $wgOnlineStatusBarTable, $row, __METHOD__, 'DELAYED' ); |
| 45 | + } |
45 | 46 | |
46 | 47 | return false; |
47 | 48 | } |
— | — | @@ -55,29 +56,21 @@ |
56 | 57 | return true; |
57 | 58 | } |
58 | 59 | $dbw = wfGetDB ( DB_MASTER ); |
59 | | - $dbw->update($wgOnlineStatusBarTable, array ('timestamp' => $now), array ('username' => $wgUser->getName()), __METHOD__ ); |
| 60 | + $dbw->update($wgOnlineStatusBarTable, array ('timestamp' => $now), array ('username' => $wgUser->getName()), __METHOD__ ); |
60 | 61 | |
61 | | - return false; |
| 62 | + return false; |
62 | 63 | |
63 | 64 | } |
64 | 65 | |
65 | 66 | public static function DeleteOld() |
66 | 67 | { |
67 | 68 | global $wgOnlineStatusBarTable, $wgOnlineStatusBar_LogoutTime, $wgDBname; |
68 | | - $dbw= wfGetDB ( DB_MASTER ); |
69 | | - $time = OnlineStatusBar::GetNow() - $wgOnlineStatusBar_LogoutTime; |
70 | | - $dbw->delete( $wgOnlineStatusBarTable, array( 'timestamp < "' . $time . '"' ) ,__METHOD__ ); |
| 69 | + $dbw= wfGetDB ( DB_MASTER ); |
| 70 | + $time = OnlineStatusBar::GetNow() - $wgOnlineStatusBar_LogoutTime; |
| 71 | + $dbw->delete( $wgOnlineStatusBarTable, array( 'timestamp < "' . $time . '"' ) ,__METHOD__ ); |
71 | 72 | return 0; |
72 | 73 | } |
73 | 74 | |
74 | | - static function GetFileUrl($name) |
75 | | - { |
76 | | - // fix me |
77 | | - global $wgScriptPath; |
78 | | - $url = $wgScriptPath . "/extensions/OnlineStatusBar" . "$name"; |
79 | | - return $url; |
80 | | - } |
81 | | - |
82 | 75 | static function GetStatus( $userID ) { |
83 | 76 | global $wgOnlineStatusBarTable, $wgOnlineStatusBarModes, $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarDefaultOnline, $wgDBname; |
84 | 77 | $dbw= wfGetDB ( DB_MASTER ); |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.i18n.php |
— | — | @@ -8,11 +8,11 @@ |
9 | 9 | |
10 | 10 | $messages = array(); |
11 | 11 | |
12 | | -/** English |
| 12 | +/** |
| 13 | + * English |
13 | 14 | * @author Petr Bena |
14 | 15 | */ |
15 | 16 | $messages['en'] = array( |
16 | | -'onlinestatusbar-desc' => "Status bar which shows whether a user is online, based on preferences, on their user page", |
17 | | -'onlinestatusbar-line' => " is now", |
| 17 | + 'onlinestatusbar-desc' => "Status bar which shows whether a user is online, based on preferences, on their user page", |
| 18 | + 'onlinestatusbar-line' => " is now", |
18 | 19 | ); |
19 | | -?> |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php |
— | — | @@ -31,18 +31,18 @@ |
32 | 32 | // Configuration |
33 | 33 | // Those values can be overriden in LocalSettings, do not change it here |
34 | 34 | $wgOnlineStatusBarModes = array ( |
35 | | - 'online' => "On-line", |
36 | | - 'busy' => "Busy", |
37 | | - 'away' => "Away", |
38 | | - 'hidden' => "Offline", |
39 | | - 'offline' => "Offline", |
| 35 | + 'online' => "On-line", |
| 36 | + 'busy' => "Busy", |
| 37 | + 'away' => "Away", |
| 38 | + 'hidden' => "Offline", |
| 39 | + 'offline' => "Offline", |
40 | 40 | ); |
41 | 41 | $wgOnlineStatusBarIcon = array ( |
42 | | - 'online' => OnlineStatusBar::GetFileUrl( "/20px-Ledgreen.svg.png" ), |
43 | | - 'busy' => OnlineStatusBar::GetFileUrl( "/20px-Ledorange.svg.png" ), |
44 | | - 'away' => OnlineStatusBar::GetFileUrl( "/20px-Ledorange.svg.png" ), |
45 | | - 'hidden' => OnlineStatusBar::GetFileUrl( "/20px-Nuvola_apps_krec.svg.png"), |
46 | | - 'offline' => OnlineStatusBar::GetFileUrl( "/20px-Nuvola_apps_krec.svg.png"), |
| 42 | + 'online' => "20px-Ledgreen.svg.png", |
| 43 | + 'busy' => "20px-Ledorange.svg.png", |
| 44 | + 'away' => "20px-Ledorange.svg.png", |
| 45 | + 'hidden' => "20px-Nuvola_apps_krec.svg.png", |
| 46 | + 'offline' => "20px-Nuvola_apps_krec.svg.png", |
47 | 47 | ); |
48 | 48 | $wgOnlineStatusBarColor = array ( |
49 | 49 | 'online' => "green", |