Index: trunk/extensions/SocialProfile/SocialProfile.php |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | $wgFriendingEnabled = true; |
96 | 96 | |
97 | 97 | // Should we enable UserStatus feature (currently is under development) |
98 | | -$wgEnableUserStatus = false; |
| 98 | +$wgEnableUserStatus = true; |
99 | 99 | |
100 | 100 | // Extension credits that show up on Special:Version |
101 | 101 | $wgExtensionCredits['other'][] = array( |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus_AjaxFunctions.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | $buf = $user_status_array['us_status']; |
13 | 13 | $us = $buf; |
14 | 14 | // @todo FIXME: i18n |
15 | | - $us .= " <a href=\"javascript:toEditMode('$buf','$u_id');\">Edit</a>"; |
| 15 | + $us .= " <a href=\"javascript:UserStatus.toEditMode('$buf','$u_id');\">Edit</a>"; |
16 | 16 | return $us; |
17 | 17 | } |
18 | 18 | |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | /*Under construction*/ |
26 | 26 | foreach ($historyArray as $row ) { |
27 | 27 | $output .= '<tr><td id="status-history-time">'.$row['ush_timestamp'].' </td>'; |
28 | | - $output .= '<td><a href="javascript:fromHistoryToStatus(\''.$row['ush_status'].'\');">' |
| 28 | + $output .= '<td><a href="javascript:UserStatus.fromHistoryToStatus(\''.$row['ush_status'].'\');">' |
29 | 29 | .$row['ush_status'].'</a></td></tr>'; |
30 | 30 | } |
31 | 31 | $output.='</table>'; |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus.js |
— | — | @@ -1,51 +1,52 @@ |
2 | | -var historyOpened = false; |
| 2 | +var UserStatus = { |
| 3 | + historyOpened : false, |
3 | 4 | |
4 | | -function toShowMode( status, id ) { |
5 | | - document.getElementById( 'user-status-block' ).innerHTML = status; |
6 | | - document.getElementById( 'user-status-block' ).innerHTML += ' <a href="javascript:toEditMode(\'' + status + '\',' + id + ');">Edit</a>'; |
7 | | -} |
| 5 | + toShowMode: function( status, id ) { |
| 6 | + document.getElementById( 'user-status-block' ).innerHTML = status; |
| 7 | + document.getElementById( 'user-status-block' ).innerHTML += ' <a href="javascript:UserStatus.toEditMode(\'' + status + '\',' + id + ');">Edit</a>'; |
| 8 | + }, |
| 9 | + |
| 10 | + toEditMode: function( status, id ) { |
| 11 | + var editbar = '<input id="user-status-input" type="text" value="' + status + '">'; |
| 12 | + editbar += ' <a href="javascript:UserStatus.saveStatus(' + id + ');">Save</a>'; |
| 13 | + editbar += ' <a href="javascript:UserStatus.useHistory(' + id + ');">History</a>'; |
| 14 | + editbar += ' <a href="javascript:UserStatus.toShowMode(\'' + status + '\',' + id + ');">Cancel</a>'; |
| 15 | + document.getElementById( 'user-status-block' ).innerHTML = editbar; |
| 16 | + }, |
| 17 | + |
| 18 | + saveStatus: function( id ) { |
| 19 | + var div = document.getElementById( 'user-status-block' ); |
| 20 | + var ustext = document.getElementById( 'user-status-input' ).value; |
| 21 | + sajax_do_call( 'wfSaveStatus', [id, ustext], div ); |
| 22 | + }, |
8 | 23 | |
9 | | -function toEditMode( status, id ) { |
10 | | - var editbar = '<input id="user-status-input" type="text" value="' + status + '">'; |
11 | | - editbar += ' <a href="javascript:saveStatus(' + id + ');">Save</a>'; |
12 | | - editbar += ' <a href="javascript:useHistory(' + id + ');">History</a>'; |
13 | | - editbar += ' <a href="javascript:toShowMode(\'' + status + '\',' + id + ');">Cancel</a>'; |
14 | | - document.getElementById( 'user-status-block' ).innerHTML = editbar; |
15 | | -} |
| 24 | + useHistory: function( id ){ |
| 25 | + if (this.historyOpened) |
| 26 | + this.closeStatusHistory(); |
| 27 | + else |
| 28 | + this.openStatusHistory(id); |
| 29 | + }, |
16 | 30 | |
17 | | -function saveStatus( id ) { |
18 | | - var div = document.getElementById( 'user-status-block' ); |
19 | | - var ustext = document.getElementById( 'user-status-input' ).value; |
20 | | - sajax_do_call( 'wfSaveStatus', [id, ustext], div ); |
21 | | -} |
| 31 | + openStatusHistory: function( id ) { |
| 32 | + var historyBlock = document.getElementById('status-history-block'); |
| 33 | + if(historyBlock==null) { |
| 34 | + var statusBlock = document.getElementById('user-status-block'); |
| 35 | + var historyBlock = document.createElement('div'); |
| 36 | + historyBlock.id = 'status-history-block'; |
| 37 | + statusBlock.appendChild(historyBlock); |
| 38 | + } |
| 39 | + this.historyOpened = true; |
| 40 | + sajax_do_call( 'wfGetHistory', [id], historyBlock ); |
| 41 | + }, |
22 | 42 | |
23 | | -function useHistory(id){ |
24 | | - if (historyOpened){ |
25 | | - //alert('closed'); |
26 | | - closeStatusHistory(); |
27 | | - } |
28 | | - else { |
29 | | - //alert('opened'); |
30 | | - openStatusHistory(id); |
31 | | - } |
32 | | -} |
| 43 | + closeStatusHistory: function() { |
| 44 | + var hBlock = document.getElementById('status-history-block'); |
| 45 | + hBlock.parentNode.removeChild(hBlock); |
| 46 | + this.historyOpened = false; |
| 47 | + }, |
33 | 48 | |
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; |
47 | | -} |
48 | | - |
49 | | -function fromHistoryToStatus(str) |
50 | | -{ |
51 | | - document.getElementById('user-status-input').value = str; |
| 49 | + fromHistoryToStatus: function( str ) |
| 50 | + { |
| 51 | + document.getElementById('user-status-input').value = str; |
| 52 | + } |
52 | 53 | } |
\ No newline at end of file |