Class jabberwerx.ui.SubscriptionView
Extends
jabberwerx.ui.JWView.
View for accepting or denying subscription requests.
This allows the user to accept, deny or ignore (defer until later) a subscription request. An instance of this class should be created upon a subscription request been recieved, provided auto accept is not enabled in the RosterController. The user can specify the contacts nickname and the group to which they should be added. It also facilitates the creation of a new group on the fly.
When the accept action is undertaken, a subscription to the contacts presence status is automatically invoked. When the deny action is undertaken, the contact, if present, is automatically removed from the roster.
An event (actionComplete) will be triggered when an action has been undertaken. The action will have been to either accept, deny or ignore the subscription request. More details below.
This class provides the following events:
Constructor Attributes | Constructor Name and Description |
---|---|
jabberwerx.ui.SubscriptionView(roster, contact, defaults)
Creates a SubscriptionView object. |
Field Attributes | Field Name and Description |
---|---|
<static> |
jabberwerx.ui.SubscriptionView.ACTION_ACCEPT
Returned as part of the event object in the actionComplete event when accept is the action which has been taken. |
<static> |
jabberwerx.ui.SubscriptionView.ACTION_DENY
Returned as part of the event object in the actionComplete event when deny is the action which has been taken. |
<static> |
jabberwerx.ui.SubscriptionView.ACTION_IGNORE
Returned as part of the event object in the actionComplete event when ignore is the action which has been taken. |
The roster object used to accept or deny subscriptions. |
- Fields borrowed from class jabberwerx.ui.JWView:
- jq
Method Attributes | Method Name and Description |
---|---|
Accepts the subscription. |
|
createDOM(doc)
Creates the DOM to display. |
|
Denies the subscription. |
|
getGroup()
Get the currently set group |
|
Get the currently set nickname |
|
hide()
Hides the form in the document. |
|
Ignores the subscription. |
|
show()
Shows the form if hidden in the document. |
- Methods borrowed from class jabberwerx.ui.JWView:
- destroy, destroyDOM, dimensions, height, parent, persistOptions, remove, render, restoreDOM, restoreRender, restoreUpdate, shouldBeSavedWithGraph, update, wasUnserialized, width, willBeSerialized
- Methods borrowed from class jabberwerx.JWModel:
- applyEvent, event
- Methods borrowed from class jabberwerx.JWBase:
- getClassName, graphUnserialized, init, invocation, shouldBeSerializedInline, toString
Creates a SubscriptionView object.
- Parameters:
- {jabberwerx.RosterController} roster
- The roster
- {String|jabberwerx.JID} contact
- The jid of the user from which the subscription request was received.
- {Object} defaults Optional
- {String} defaults.nickname Optional
- The default nickname to populate the input with
- {String} defaults.group Optional
- The default group to select. If this group does not exist then an entry for it will be inserted in the group drop down box.
- Throws:
- {TypeError}
- If roster is not valid
- {jabberwerx.JID.InvalidJIDError}
- if contact isn't a valid jid.
Returned as part of the event object in the actionComplete event when accept is the action which has been taken.
Returned as part of the event object in the actionComplete event when deny is the action which has been taken.
Returned as part of the event object in the actionComplete event when ignore is the action which has been taken.
The roster object used to accept or deny subscriptions.
Accepts the subscription. Will also attempt to add the contact to our roster using the currently selected group and nickname. This is the equivalent of clicking the accept button in the UI.
Creates the DOM to display.
Binds the input elements to their respective action methods.
Creates the DOM to display. This method creates the following DOM:
<div class="jabberwerx subscription_view"> <div class="contact_div"> <label for="contact">Contact:</label> <span class="contact" id="contact">defaults.contact</span> </div> <div class="nick_div"> <label for="nick">Nickname:</label> <input type="text" class="nick" id="nick">defaults.nickname</input> </div> <div class="group_div"> <label for="group">Group:</label> <select class="group_select" id="group"> Group option tags <option class="group_option" value="New...">New...</option> </select> </div> <div class="action_div"> <input class="action_button accept" type="button" val="Accept"/> <input class="action_button deny" type="button" val="Deny"/> <input class="action_button ignore" type="button" val="Ignore"/> </div> </div>
It also binds a callback for "change" events on the <select/> element.
- Parameters:
- {Document} doc
- The document to use for creating content.
- Returns:
- {Element} The generated element to display
Denies the subscription. This is the equivalent of clicking the deny button in the UI.
Get the currently set group
- Returns:
- {String} the group
Get the currently set nickname
- Returns:
- {String} the nickname
Hides the form in the document.
Ignores the subscription. No response will be returned to the subscribe request and the server will notify the client of the same subscription request upon their next log in. This is the equivalent of clicking the ignore button in the UI.
Shows the form if hidden in the document.