Index: trunk/extensions/SocialProfile/UserStatus/UserStatus_AjaxFunctions.php |
— | — | @@ -1,5 +1,7 @@ |
2 | 2 | <?php |
3 | | - |
| 3 | +/** |
| 4 | + * AJAX functions used in UserStatus |
| 5 | + */ |
4 | 6 | $wgAjaxExportList[] = 'wfSaveStatus'; |
5 | 7 | |
6 | 8 | function wfSaveStatus( $u_id, $status ) { |
— | — | @@ -11,4 +13,18 @@ |
12 | 14 | // @todo FIXME: i18n |
13 | 15 | $us .= " <a href=\"javascript:toEditMode('$buf','$u_id');\">Edit</a>"; |
14 | 16 | return $us; |
| 17 | +} |
| 18 | + |
| 19 | +$wgAjaxExportList[] = 'wfGetHistory'; |
| 20 | + |
| 21 | +function wfGetHistory( $u_id ) { |
| 22 | + $us_class = new UserStatusClass( $u_id ); |
| 23 | + $historyArray = $us_class->useStatusHistory('select', $u_id); |
| 24 | + $output='<table>'; |
| 25 | + /*Under construction*/ |
| 26 | + foreach ($historyArray as $row ) { |
| 27 | + $output .= '<tr><td id="status-history-time">'.$row['ush_timestamp'].' </td><td> '.$row['ush_status'].'</td></tr>'; |
| 28 | + } |
| 29 | + $output.='</table>'; |
| 30 | + return $output; |
15 | 31 | } |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus.i18n.php |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalization file for UserStatus extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +/** English |
| 13 | + * @author Yevhenii Vlasenko |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + 'edit' => "Edit", |
| 17 | +); |
| 18 | + |
| 19 | +/** Russian (Русский) |
| 20 | + * @author Yevhenii Vlasenko |
| 21 | + */ |
| 22 | +$messages['ru'] = array( |
| 23 | + 'edit' => 'Изменить', |
| 24 | +); |
| 25 | + |
| 26 | +/** Ukrainian (Українська) |
| 27 | + * @author Yevhenii Vlasenko |
| 28 | + */ |
| 29 | +$messages['uk'] = array( |
| 30 | + 'edit' => 'Редагувати', |
| 31 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/SocialProfile/UserStatus/UserStatus.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 32 | + native |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus.js |
— | — | @@ -1,3 +1,5 @@ |
| 2 | +var historyOpened = false; |
| 3 | + |
2 | 4 | function toShowMode( status, id ) { |
3 | 5 | document.getElementById( 'user-status-block' ).innerHTML = status; |
4 | 6 | document.getElementById( 'user-status-block' ).innerHTML += ' <a href="javascript:toEditMode(\'' + status + '\',' + id + ');">Edit</a>'; |
— | — | @@ -7,7 +9,7 @@ |
8 | 10 | var editbar = '<input id="user-status-input" type="text" value="' + status + '">'; |
9 | 11 | editbar += ' <a href="javascript:saveStatus(' + id + ');">Save</a>'; |
10 | 12 | editbar += ' <a href="javascript:toShowMode(\'' + status + '\',' + id + ');">Cancel</a>'; |
11 | | - editbar += ' <a href="javascript:showStatusHistory;">History</a>'; |
| 13 | + editbar += ' <a href="javascript:useHistory(' + id + ');">History</a>'; |
12 | 14 | document.getElementById( 'user-status-block' ).innerHTML = editbar; |
13 | 15 | } |
14 | 16 | |
— | — | @@ -17,6 +19,28 @@ |
18 | 20 | sajax_do_call( 'wfSaveStatus', [id, ustext], div ); |
19 | 21 | } |
20 | 22 | |
21 | | -function showStatusHistory() { |
22 | | - // A history script |
| 23 | +function useHistory(id){ |
| 24 | + if (historyOpened){ |
| 25 | + //alert('closed'); |
| 26 | + closeStatusHistory(); |
| 27 | + } |
| 28 | + else { |
| 29 | + //alert('opened'); |
| 30 | + openStatusHistory(id); |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +function openStatusHistory(id) { |
| 35 | + var statusBlock = document.getElementById('user-status-block'); |
| 36 | + var historyBlock = document.createElement('div'); |
| 37 | + historyBlock.id = 'status-history-block'; |
| 38 | + statusBlock.appendChild(historyBlock); |
| 39 | + historyOpened = true; |
| 40 | + sajax_do_call( 'wfGetHistory', [id], historyBlock ); |
| 41 | +} |
| 42 | + |
| 43 | +function closeStatusHistory() { |
| 44 | + var hBlock = document.getElementById('status-history-block'); |
| 45 | + hBlock.parentNode.removeChild(hBlock); |
| 46 | + historyOpened = false; |
23 | 47 | } |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatusClass.php |
— | — | @@ -8,7 +8,9 @@ |
9 | 9 | |
10 | 10 | /* private */ function __construct( $u_id ) { |
11 | 11 | global $wgOut, $wgScriptPath; |
| 12 | + $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/SocialProfile/UserStatus/UserStatus.css' ); |
12 | 13 | $wgOut->addScriptFile( $wgScriptPath . '/extensions/SocialProfile/UserStatus/UserStatus.js' ); |
| 14 | + |
13 | 15 | } |
14 | 16 | |
15 | 17 | public function getStatus( $u_id ) { |
— | — | @@ -100,7 +102,7 @@ |
101 | 103 | '*', |
102 | 104 | array( 'ush_user_id' => $u_id ), |
103 | 105 | __METHOD__, |
104 | | - array( 'ORDER BY' => 'ush_timestamp ASC' ) |
| 106 | + array( 'ORDER BY' => 'ush_timestamp' ) |
105 | 107 | ); |
106 | 108 | |
107 | 109 | $i = 0; |