Index: trunk/extensions/SocialProfile/SocialProfile.php |
— | — | @@ -93,6 +93,9 @@ |
94 | 94 | // Whether to enable friending or not -- this doesn't do very much actually, so don't rely on it |
95 | 95 | $wgFriendingEnabled = true; |
96 | 96 | |
| 97 | +// Should we enable UserStatus feature (currently is under development) |
| 98 | +$wgEnableUserStatus = false; |
| 99 | + |
97 | 100 | // Extension credits that show up on Special:Version |
98 | 101 | $wgExtensionCredits['other'][] = array( |
99 | 102 | 'path' => __FILE__, |
Index: trunk/extensions/SocialProfile/UserStatus/userstatus.sql |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | `us_status` varchar(140) NOT NULL default '' |
13 | 13 | )/*$wgDBTableOptions*/; |
14 | 14 | |
15 | | -CREATE TABLE /*_*/`user_status_history` ( |
| 15 | +CREATE TABLE /*_*/user_status_history ( |
16 | 16 | `ush_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, |
17 | 17 | `ush_user_id` int(11) NOT NULL default '0', |
18 | 18 | `ush_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus_AjaxFunctions.php |
— | — | @@ -5,8 +5,7 @@ |
6 | 6 | $us_class->setStatus($u_id, $status); |
7 | 7 | $user_status_array = $us_class->getStatus($u_id); |
8 | 8 | $buf=$user_status_array['us_status']; |
9 | | - $us ="$buf"; |
| 9 | + $us =$buf; |
10 | 10 | $us.=" <a href=\"javascript:toEditMode('$buf','$u_id');\">Edit</a>"; |
11 | 11 | return $us; |
12 | | -} |
13 | | -?> |
| 12 | +} |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus.js |
— | — | @@ -5,18 +5,18 @@ |
6 | 6 | |
7 | 7 | function toEditMode(status,id) { |
8 | 8 | var editbar = '<input id="user-status-input" type="text" value="'+status+'">'; |
9 | | - editbar += ' <a href="javascript:save('+id+');">Save</a>'; |
| 9 | + editbar += ' <a href="javascript:saveStatus('+id+');">Save</a>'; |
10 | 10 | editbar += ' <a href="javascript:toShowMode(\''+status+'\','+id+');">Cancel</a>'; |
11 | | - editbar += ' <a href="javascript:showHistory;">History</a>'; |
| 11 | + editbar += ' <a href="javascript:showStatusHistory;">History</a>'; |
12 | 12 | document.getElementById('user-status-block').innerHTML = editbar; |
13 | 13 | } |
14 | 14 | |
15 | | -function save(id) { |
| 15 | +function saveStatus(id) { |
16 | 16 | var div = document.getElementById('user-status-block'); |
17 | 17 | var ustext = document.getElementById('user-status-input').value; |
18 | 18 | sajax_do_call( 'wfSaveStatus', [id,ustext], div ); |
19 | 19 | } |
20 | 20 | |
21 | | -function showHistory(){ |
| 21 | +function showStatusHistory(){ |
22 | 22 | //A history script |
23 | 23 | } |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatusClass.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | |
6 | 6 | /* private */ function __construct($u_id) { |
7 | 7 | global $wgOut, $wgScriptPath; |
8 | | - $wgOut->addScriptFile($wgScriptPath.'/extensions/SocialProfile/UserStatus/UserStatus.js' ); //Does not work |
| 8 | + $wgOut->addScriptFile($wgScriptPath.'/extensions/SocialProfile/UserStatus/UserStatus.js' ); |
9 | 9 | } |
10 | 10 | |
11 | 11 | public function getStatus($u_id) { |
— | — | @@ -79,19 +79,19 @@ |
80 | 80 | } |
81 | 81 | if ($mode=='select') return $history; |
82 | 82 | if ($mode=='insert'){ |
83 | | - $currentStuts = $this->getStatus($u_id); |
| 83 | + $currentStatus = $this->getStatus($u_id); |
84 | 84 | |
85 | 85 | if ($i < 4) { |
86 | 86 | $dbw->insert( |
87 | 87 | 'user_status_history', |
88 | 88 | /* SET */ array( |
89 | 89 | 'ush_user_id' => $u_id, |
90 | | - 'ush_status' => $currentStuts['us_status']), __METHOD__ |
| 90 | + 'ush_status' => $currentStatus['us_status']), __METHOD__ |
91 | 91 | ); |
92 | 92 | } else { |
93 | 93 | $dbw->update( |
94 | 94 | 'user_status_history', |
95 | | - /* SET */ array('ush_status' => $currentStuts['us_status']), |
| 95 | + /* SET */ array('ush_status' => $currentStatus['us_status']), |
96 | 96 | /*WHERE*/ array('ush_user_id' => $u_id, |
97 | 97 | 'ush_timestamp' => $history[0]['ush_timestamp']), |
98 | 98 | __METHOD__); |
— | — | @@ -99,6 +99,4 @@ |
100 | 100 | return; |
101 | 101 | } |
102 | 102 | } |
103 | | -} |
104 | | - |
105 | | -?> |
\ No newline at end of file |
| 103 | +} |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php |
— | — | @@ -493,7 +493,7 @@ |
494 | 494 | */ |
495 | 495 | function getProfileTop( $user_id, $user_name ) { |
496 | 496 | global $wgTitle, $wgUser, $wgUploadPath, $wgLang; |
497 | | - global $wgUserLevels; |
| 497 | + global $wgUserLevels, $wgEnableUserStatus; |
498 | 498 | |
499 | 499 | $stats = new UserStats( $user_id, $user_name ); |
500 | 500 | $stats_data = $stats->getUserStats(); |
— | — | @@ -506,8 +506,7 @@ |
507 | 507 | } |
508 | 508 | $profile_data = $this->profile_data; |
509 | 509 | |
510 | | - // Variables and other crap |
511 | | - $user_status = $this->getStatus($this->user_id); |
| 510 | + // Variables and other crap |
512 | 511 | $page_title = $wgTitle->getText(); |
513 | 512 | $title_parts = explode( '/', $page_title ); |
514 | 513 | $user = $title_parts[0]; |
— | — | @@ -560,7 +559,10 @@ |
561 | 560 | <div id="profile-title">' . |
562 | 561 | $user_name . |
563 | 562 | '</div>'; |
564 | | - $output .='<div id="user-status-block">'.$user_status.'</div>'; |
| 563 | + if ( $wgEnableUserStatus ) { |
| 564 | + $user_status = $this->getStatus($this->user_id); |
| 565 | + $output .='<div id="user-status-block">'.$user_status.'</div>'; |
| 566 | + } |
565 | 567 | if ( $wgUserLevels ) { |
566 | 568 | $output .= '<div id="points-level"> |
567 | 569 | <a href="' . $level_link->escapeFullURL() . '">' . |