r90547 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90546‎ | r90547 | r90548 >
Date:20:45, 21 June 2011
Author:zhenya
Status:deferred (Comments)
Tags:
Comment:
some mistakes are removed
Modified paths:
  • /trunk/extensions/SocialProfile/SocialProfile.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStatus/UserStatus.js (modified) (history)
  • /trunk/extensions/SocialProfile/UserStatus/UserStatusClass.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStatus/UserStatus_AjaxFunctions.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStatus/userstatus.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/SocialProfile.php
@@ -93,6 +93,9 @@
9494 // Whether to enable friending or not -- this doesn't do very much actually, so don't rely on it
9595 $wgFriendingEnabled = true;
9696
 97+// Should we enable UserStatus feature (currently is under development)
 98+$wgEnableUserStatus = false;
 99+
97100 // Extension credits that show up on Special:Version
98101 $wgExtensionCredits['other'][] = array(
99102 'path' => __FILE__,
Index: trunk/extensions/SocialProfile/UserStatus/userstatus.sql
@@ -11,7 +11,7 @@
1212 `us_status` varchar(140) NOT NULL default ''
1313 )/*$wgDBTableOptions*/;
1414
15 -CREATE TABLE /*_*/`user_status_history` (
 15+CREATE TABLE /*_*/user_status_history (
1616 `ush_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
1717 `ush_user_id` int(11) NOT NULL default '0',
1818 `ush_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus_AjaxFunctions.php
@@ -5,8 +5,7 @@
66 $us_class->setStatus($u_id, $status);
77 $user_status_array = $us_class->getStatus($u_id);
88 $buf=$user_status_array['us_status'];
9 - $us ="$buf";
 9+ $us =$buf;
1010 $us.=" <a href=\"javascript:toEditMode('$buf','$u_id');\">Edit</a>";
1111 return $us;
12 -}
13 -?>
 12+}
\ No newline at end of file
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus.js
@@ -5,18 +5,18 @@
66
77 function toEditMode(status,id) {
88 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>';
1010 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>';
1212 document.getElementById('user-status-block').innerHTML = editbar;
1313 }
1414
15 -function save(id) {
 15+function saveStatus(id) {
1616 var div = document.getElementById('user-status-block');
1717 var ustext = document.getElementById('user-status-input').value;
1818 sajax_do_call( 'wfSaveStatus', [id,ustext], div );
1919 }
2020
21 -function showHistory(){
 21+function showStatusHistory(){
2222 //A history script
2323 }
\ No newline at end of file
Index: trunk/extensions/SocialProfile/UserStatus/UserStatusClass.php
@@ -4,7 +4,7 @@
55
66 /* private */ function __construct($u_id) {
77 global $wgOut, $wgScriptPath;
8 - $wgOut->addScriptFile($wgScriptPath.'/extensions/SocialProfile/UserStatus/UserStatus.js' ); //Does not work
 8+ $wgOut->addScriptFile($wgScriptPath.'/extensions/SocialProfile/UserStatus/UserStatus.js' );
99 }
1010
1111 public function getStatus($u_id) {
@@ -79,19 +79,19 @@
8080 }
8181 if ($mode=='select') return $history;
8282 if ($mode=='insert'){
83 - $currentStuts = $this->getStatus($u_id);
 83+ $currentStatus = $this->getStatus($u_id);
8484
8585 if ($i < 4) {
8686 $dbw->insert(
8787 'user_status_history',
8888 /* SET */ array(
8989 'ush_user_id' => $u_id,
90 - 'ush_status' => $currentStuts['us_status']), __METHOD__
 90+ 'ush_status' => $currentStatus['us_status']), __METHOD__
9191 );
9292 } else {
9393 $dbw->update(
9494 'user_status_history',
95 - /* SET */ array('ush_status' => $currentStuts['us_status']),
 95+ /* SET */ array('ush_status' => $currentStatus['us_status']),
9696 /*WHERE*/ array('ush_user_id' => $u_id,
9797 'ush_timestamp' => $history[0]['ush_timestamp']),
9898 __METHOD__);
@@ -99,6 +99,4 @@
100100 return;
101101 }
102102 }
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 @@
494494 */
495495 function getProfileTop( $user_id, $user_name ) {
496496 global $wgTitle, $wgUser, $wgUploadPath, $wgLang;
497 - global $wgUserLevels;
 497+ global $wgUserLevels, $wgEnableUserStatus;
498498
499499 $stats = new UserStats( $user_id, $user_name );
500500 $stats_data = $stats->getUserStats();
@@ -506,8 +506,7 @@
507507 }
508508 $profile_data = $this->profile_data;
509509
510 - // Variables and other crap
511 - $user_status = $this->getStatus($this->user_id);
 510+ // Variables and other crap
512511 $page_title = $wgTitle->getText();
513512 $title_parts = explode( '/', $page_title );
514513 $user = $title_parts[0];
@@ -560,7 +559,10 @@
561560 <div id="profile-title">' .
562561 $user_name .
563562 '</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+ }
565567 if ( $wgUserLevels ) {
566568 $output .= '<div id="points-level">
567569 <a href="' . $level_link->escapeFullURL() . '">' .

Follow-up revisions

RevisionCommit summaryAuthorDate
r94898SocialProfile: follow-up to r90537, r90547, r94139: remove unused globalashley15:33, 18 August 2011

Comments

#Comment by Siebrand (talk | contribs)   23:42, 21 June 2011

trunk/extensions/SocialProfile/UserStatus/UserStatus_AjaxFunctions.php could probably do with a few comments on what it implements.

Status & tagging log