User:Nx/Extensions/Intercom/doc

From RationalWiki
Jump to navigation Jump to search

For users[edit]

Groups[edit]

Intercom messages are sent to specific groups. You will only receive a message if you are a member of the group it was sent to. To configure your group membership, go to Special:Intercom/selectgroups. By default, you are a member of the ⧼intercom-urgentlist⧽ group only. It is recommended you do not leave this group, as it is used for important notifications.

Messages[edit]

Special:Intercom lists all messages sent to the groups you are a member of. You can view a specific message by going to Special:Intercom/message_id, for example: Special:Intercom/747. You can view messages that were sent to a group you are not a member of this way.

You can write messages by going to Special:Intercom/writenew. Here you must select a group to send to (you must be a member of the group) and an expiration time. You can either chose from the list or type in something like "314159 seconds" or "3 days". You can use the same code used on wiki pages and you can sign your intercom message, though that is not required as a link to your user page and talk page will be displayed below the message. The summary is optional, but it is highly recommended because only the summary is displayed on the message list. After you've sent the message, it cannot be edited, so make sure you preview it.

For admins[edit]

Groups[edit]

Intercom groups can be configured by editing MediaWiki:intercom-list. The group ⧼intercom-urgentlist⧽ is not in this list, but is always present. The name of this group can be edited at MediaWiki:intercom-urgentlist. The site wide group is special: anonymous users can see these messages too, and all users are in this group by default, but can opt out. Only users with the intercom-sendurgent right can send messages to this group. They can also mark those messages as read for anonymous users, by going to Special:Intercom and clicking ⧼intercom-pager-cancellink⧽. Currently, bureaucrats have that right.

New intercom messages[edit]

MediaWiki:intercomnotice is used to render unread intercom messages for both registered and anonymous users. The page is parsed first, so it may contain wikitext, but it cannot depend on the parameters ($1, $2 etc.), because those are replaced after parsing. So you cannot, for example, use {{#if:}} with one of the parameters, because it would always return the same result. Then, the parameters and buttons are inserted:

  • $1 : summary
  • $2 : message text
  • $3 : sender's name, with link to userpage and talkpage
  • $4 : group name
  • $5 : message time
  • $6 : next button
  • $7 : previous button
  • $8 : mark read button

The buttons look like this:

"<span class='intercombutton'><a" . "href='javascript:nextMessage({$mId},{$mTime})'>{$mNext}</a></span>";
"<span class='intercombutton'><a" . "href='javascript:prevMessage({$mId},{$mTime})'>{$mPrev}</a></span>";
"<span class='intercombutton'><a" . "href='javascript:markRead({$mId},{$mTime})'>{$mMark}</a></span>";

For anonymous users, the mark read button is ommitted. Captions for the buttons ($mNext, $mPrev, $mMark) are taken from MediaWiki:intercom-next, MediaWiki:intercom-prev and MediaWiki:intercom-markread. Since they're given the intercombutton class, they can be styled in MediaWiki:Common.css. Finally, the resulting html code is inserted into a div:

"<div id='intercommessage' class='usermessage $groupclass' style='text-align:left; font-weight: normal;'>" . Intercom::_rendermessage($mess,$userid) . '</div>';

This div is in the extension source to ensure it's not removed accidentally. It has the usermessage class used by the new talk messages notification, but it can also be styled using its id, intercommessage. In addition, it has a class based on the group name ($groupclass), in the form of intercom-groupname, where groupname is the escaped name of the group the message was sent to, so messages sent to different groups can be styled separately. If unsure, go to Special:Intercom/writenew, select the group, click preview and look at the html source to find the correct class.

Special:Intercom[edit]

MediaWiki:intercommessage is used to render the intercom messages in Special:Intercom. The page is parsed first, so it may contain wikitext, but it cannot depend on the parameters ($1, $2 etc.), because those are replaced after parsing. So you cannot, for example, use {{#if:}} with one of the parameters, because it would always return the same result. Then, the parameters are inserted:

  • $1 : summary
  • $2 : message text
  • $3 : sender's name, with link to userpage and talkpage
  • $4 : group name
  • $5 : message time

Finally, the resulting html code is inserted into a fieldset.