Sunday, 20 July 2014

Locking Implementation Refined Ideas

A new database containing the following information would be created in the database:-

(Content_id, User_id, Last login/edit time)

In this the content_id would be the primary key, hence only one entry for each content_id would be possible and necessary. Whenever, a shared content is edited, it's corresponding entry would be added in the database.

1. Suppose User “A” wants to edit a page “p1”, and currently no one hold the lock on “p1”  i.e., there is no entry in the database for page “p1”, then “A” gets the lock for “p1” and a row is inserted in database for “A”.

2. Now if “A” remains inactive for 14 min, then a notification pop up is shown to “A”, warning him that his lock would expire in a minute if he remains inactive and could be given to any other user requesting the lock.

3. If another user “B” asks for lock held by “A”, then we check:-
If (Present_time – Last_edited_time(from DB) by A > 15 min), then{
“B” is given the lock of “p1” and database is updated. Now if “A” tries to edit after he has lost his lock then he would not be able to do so and would be notified that some other user has the lock now and he should request for lock again.
}
else {
“B” would wait for the session of “A” to end.
}

4. If “A” completes the editing and clicks on save button then the row from database corresponding to “A” and “p1” is removed. This is important so that any other user could get the lock even before 15 minutes.

5. If two or more users are waiting for lock held by “A”, then the user who would refresh first or send the request for the lock first after expiration of time would receive the lock. In this way no priority is given to user who comes first and demands for the lock, but is given to the user who demands for the lock once the lock is released.

Tab Positioning in Shared Content

There are two different types of tabs for Shared Content made:-

1. Shared Content With Me :- This tab is available along with Home, Profile and Manage User Groups Tab. This is basically to view the pages which are shared by various other authors with the author currently logged in. This position for tab is selected because it is a general tab and has no link to any course authored by the currently logged in user.

2. Shared Content :- This tab is available when the user clicks on a particular course/lesson, along with various other tabs like Manage Tests. This tab is to share the contents of some particular course. In this tab the whole structure of the course is visible for easy sharing of contents with users. It further has two sub-tabs a) first give editing right to other users b) second to revoke editing rights from users.

The author can also share the hidden content with other users. In this case, a warning will be shown to the user that the content was hidden content and he is trying to share hidden content. In this way two authors can collaboratively edit the content and when the content gains structure it can be made visible to the other users.

The author can also share the content with any type of user (author/non-author/enabled/disabled). Hence the editing rights can also be extended to non-authors.

The Non-authors can then view the shared content with them, but to be able to edit the shared content they need to convert themselves to authors by going to their profile and making the required changes.
This ensures the current work flow that only authors can edit the content and hence make the things possible easily.