User:Zhenya

= Identity = Name: Yevhenii Vlasenko University: Chernihiv Technological University (Ukraine) Project title: "Extension: SocialProfile - UserStatus feature" Contact information: = Project =
 * IRC: Zheee
 * GTalk/GMail: benjamin22.987[at]gmail.com
 * Skype: Zhenya_987
 * Facebook: www.facebook.com/profile.php?id=1342047659

Summary
The aim of the project is to create a UserStatus module for the SocialProfile extension at MediaWiki. This module will allow MediaWiki users to write short "status updates" on user profile pages. It will allow Wiki users to share their thoughts, ideas or just the facts of their life. The project will have a history of UserStatuses and will allow everyone of just the user itself (depending on the settings) to look through it.

Required deliverables
If time permits
 * Creating the data base for saving status-messages. It will consist of two tables:
 * Table 1.Contains the history of the users' statuses.
 * Talbe 2.Contains the list of all the users' statuses which are active right now.
 * Creating php scripts which will:Save the data to table[2]; Transfer data from table[2]=>table[1]; If user just cleares status - the row in table[2] should be transfered to table[1] and deleted in table[1] so there were no empty lines in any of the tables.
 * Creating javascripts for showing status-message,entering editing mode, deleting status,function for showing the last date of status change and history.
 * Creating a GUI for editing mode.
 * Creating module for viewing others history.


 * Making more settings like: banning bad words, inserting hypertext.

Project schedule
April 20 – May 23 (Before the official coding time):

May 23 – June 18 (Official coding period starts):
 * During this period I will contact my mentor and MediaWiki community. I will remain active on IRC and Mailling lists to discuss my project and may be improve its schema. Also I will study all the code and structure, read documentation of the Social Profile extension for increasing the level of integrating of my modules into its core.

June 18 – July 11:
 * Creating the data base for my module.
 * Creating scripts for UserStatuses history management.

July 11 – July 27:
 * Writing php modules for saving information in data base and managing it.
 * Integrating php modules into SocialProfile extension.

July 27 – July 31:
 * Writing JavaScript functions for integration of my modules into the GUI of SocialProfile extension.
 * HTML integration of the module.
 * Debugging, code-cleaning.

July 31 – August 7:
 * For Documentation

= How it`s going = Today (06.10.2011) I am starting a kind of the development diary, to show how my work is going, my results, and the problems/questions that I meet in the development of the UserStatus feature. Hope that this diary will help people who are going participate in GSoC.

1 Start
Because of the exams I had a lack of time, but anyway some things I have already done.

The SQL script for the database of Mediawiki:

The JavaScript that implements the interface of UserStatus (ofc it will be reworked, but when the time will come for 'History' development): Also i started to write the main class of the UserStatus: Tried to use this class in UserProfilePage.php, everything seemd to work fine. The links I really needed to read were: http://www.mediawiki.org/wiki/Manual:Database_access http://www.mediawiki.org/wiki/Manual:Global_object_variables

P.S.For future GSoCers: If your exams fall on GSoC time, dont get afraid. You will always be able to talk about it to your mentor and everything will be okay, as different universities have different session time. For example I still have 3 exams to pass.

2
UserProfilePage.php:

SocialProfile.php:

3
Today I did write a funсtion for adding/updating status in the db. Had a problem with converting html => text. For example: user writes a status "text here" and in this way he gets a hypertext link on the resource helloworld.com. In this way he can write a script to get anything from db, knowing the way to access it. For this point I used __htmlspecialchars($string)__ function, so the special symbols were converted. Testing it:

5
In ProjectProfile/ProjectProfilePage.php we add the request of getting our status from the db, for the current user.

Also as our UserStatus feature is under development we have to switch it off in the revision. It will be done in this way: In SocialProfile.php we make a global variable: Then in UserProfile/UserProfilePage.php we check if this variable is true or not. And if it is, we switch on our module.

6 AJAX
As it was mentioned in my shedule, one of the features of our UserStatus module is the history of statuses. But we dont want to reload page when we open the US history, right? For this purpose we will have to use AJAX. About using AJAX in Mediawiki you can read here: In our case we will need two functions: 1. The function which saves status without reloading the page 2. The fucntion which gets the userStatusHistory without reloading the page First of all we have to create the file where our code will be. We will call it "UserStatust/UserStatus_AjaxFunction.php Then in SocialProfile.php we add a link on our file: Then in UserStatus_AjaxFunction.php ';	return $output; }
 * MediaWiki Ajax Manual

Calling our functions in javascript file will look like :

7 Object-oriented Javascript
Our javascript file has to be object-oriented so now we will try to rework it. Also I've added some new functions (from now-on they will be methods of UserStatus class :) ) for working with the history. As far as I undestood class in javascript looks like an ordinary array. In javascript, array can handle the elements of different types. Elements which have the type FUNCTION become the methods of the class. All other are the ordinary fields. EXAMPLE :

And now about our UserStatus class First of all we have to declare the name of our new class: Then we add a filed "historyOpened" which will be used as in indicator for showing and hiding US history. The next our step will be adding methods we wrote in the old JS file + those I made for history. The result will look like :

Tip: dont forget to plant comma after each method, as they are element of the array.

8 i18n
Working on it