Class Index | Minimal

Classes


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:

Class Summary
Constructor Attributes Constructor Name and Description
 
jabberwerx.ui.SubscriptionView(roster, contact, defaults)

Creates a SubscriptionView object.

Field Summary
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 Summary
Method Attributes Method Name and Description
 

Accepts the subscription.

 
createDOM(doc)

Creates the DOM to display.

 

Denies the subscription.

 

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
Class Detail
jabberwerx.ui.SubscriptionView(roster, contact, defaults)

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.
Field Detail
<static> {String} 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> {String} 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> {String} 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.


{jabberwerx.RosterController} roster

The roster object used to accept or deny subscriptions.

Method Detail
acceptSubscription()

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.


{Element} createDOM(doc)

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

denySubscription()

Denies the subscription. This is the equivalent of clicking the deny button in the UI.


{String} getGroup()

Get the currently set group

Returns:
{String} the group

{String} getNickname()

Get the currently set nickname

Returns:
{String} the nickname

hide()

Hides the form in the document.


ignoreSubscription()

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.


show()

Shows the form if hidden in the document.


Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 02 2014 13:23:43 GMT-0600 (MDT)