Zimlet JavaScript API Reference - ZmItem

Class ZmItem


Extends ZmModel.

An item is a piece of data that may contain user content. Most items are taggable. Currently, the following things are items: conversation, message, attachment, appointment, and contact.

An item typically appears in the context of a containing list. Its event handling is generally handled by the list so we avoid having the same listeners on each item. If we create a context where an item stands alone outside a list context, then the item will have its own listeners and do its own notification handling.

Defined in: ZmItem.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmItem(type, id, list, noCache)
Creates an item.
Field Summary
Field Attributes Field Name and Description
<static>  
Defines the "move & copy" action.
<static>  
Defines the "copy" action.
<static>  
Defines the "move" action.
<static>  
Defines the notes separator which is used by items (such as calendar or share invites) that have notes.
Method Summary
Method Attributes Method Name and Description
 
Caches the item.
 
canAddTag(tagName)
is it possible to add a tag to this item?
 
Clears the item.
 
create(args)
Creates an item.
 
Deletes local, in case an item wants to do something while being deleted.
 
flagLocal(flag, on)
Applies the given flag change to this item by setting a boolean property.
 
getById(id)
Gets the item by id.
 
Gets the default action to use when dragging this item.
 
Gets the folder id that contains this item, if available.
<static>  
ZmItem.getItemId(id)
Gets an item id by taking a normalized id (or an item id) and returning the item id.
 
Gets the rest url for this item.
 
 
Gets the appropriate tag image info for this item.
 
hasTag(tagName)
Checks if the item has a given tag.
 
Checks if this item is read-only.
 
Checks if this item is shared.
 
modify(mods)
Modifies an item.
<static>  
ZmItem.move(itemId, folderId, callback, errorCallback, accountName)
Moves the item.
 
move(folderId, callback, errorCallback)
Moves the item.
 
moveLocal(folderId)
Updates the folder for this item.
<static>  
ZmItem.registerItem(item, params)
Registers an item and stores information about the given item type.
 
Removes all tags.
<static>  
ZmItem.rename(itemId, newName, callback, errorCallback, accountName)
Rename the item.
 
rename(newName, callback, errorCallback)
Rename the item.
 
setFlag(flag, on)
Sets the given flag change to this item.
 
tagLocal(tag, doTag)
Adds or removes the given tag for this item.
Methods borrowed from class ZmModel:
addChangeListener, removeAllChangeListeners, removeChangeListener
Class Detail
ZmItem(type, id, list, noCache)
Creates an item.
Author: Conrad Damon.
Parameters:
{constant} type
type of object (conv, msg, etc)
{int} id
the unique id
{ZmList} list
a list that contains this item
{Boolean} noCache
if true, do not cache this item
Field Detail
<static> ZmItem.DND_ACTION_BOTH
Defines the "move & copy" action.
See:
#getDefaultDndAction

<static> ZmItem.DND_ACTION_COPY
Defines the "copy" action.
See:
#getDefaultDndAction

<static> ZmItem.DND_ACTION_MOVE
Defines the "move" action.
See:
#getDefaultDndAction

<static> ZmItem.NOTES_SEPARATOR
Defines the notes separator which is used by items (such as calendar or share invites) that have notes.
Method Detail
{Boolean} cache()
Caches the item.
Returns:
{Boolean} true if the item is placed into cache; false otherwise

{boolean} canAddTag(tagName)
is it possible to add a tag to this item?
Parameters:
tagName
Returns:
{boolean}

clear()
Clears the item.

create(args)
Creates an item.
Parameters:
{Hash} args
the arguments

deleteLocal()
Deletes local, in case an item wants to do something while being deleted.

flagLocal(flag, on)
Applies the given flag change to this item by setting a boolean property.
Parameters:
{constant} flag
the flag that changed
{Boolean} on
true if the flag is now set

{ZmItem} getById(id)
Gets the item by id.
Parameters:
{String} id
an item id
Returns:
{ZmItem} the item

{Object} getDefaultDndAction(forceCopy)
Gets the default action to use when dragging this item. This method is meant to be overloaded for items that are read-only and can only be copied.
Parameters:
{Boolean} forceCopy
If set, default DnD action is a copy
Returns:
{Object} the action

{String} getFolderId()
Gets the folder id that contains this item, if available.
Returns:
{String} the folder id or null for none

<static> {String} ZmItem.getItemId(id)
Gets an item id by taking a normalized id (or an item id) and returning the item id.
Parameters:
{String} id
the normalized id
Returns:
{String} the item id

{String} getRestUrl()
Gets the rest url for this item.
Returns:
{String} the url

getTagImageFromIds(tagIds)
Parameters:
tagIds

{String} getTagImageInfo()
Gets the appropriate tag image info for this item.
Returns:
{String} the tag image info

{Boolean} hasTag(tagName)
Checks if the item has a given tag.
Parameters:
{String} tagName
tag name
Returns:
{Boolean} true is this item has the given tag.

{Boolean} isReadOnly()
Checks if this item is read-only. This method should be overloaded by the derived object to determine what "read-only" means.
Returns:
{Boolean} the read-only status

{Boolean} isShared()
Checks if this item is shared.
Returns:
{Boolean} true if this item is shared (remote)

modify(mods)
Modifies an item.
Parameters:
{Hash} mods
the arguments

<static> {Object} ZmItem.move(itemId, folderId, callback, errorCallback, accountName)
Moves the item.
Parameters:
itemId
folderId
callback
errorCallback
accountName
Returns:
{Object} the result of the move

{Object} move(folderId, callback, errorCallback)
Moves the item.
Parameters:
{String} folderId
{AjxCallback} callback
the callback
{AjxCallback} errorCallback
the callback on error
Returns:
{Object} the result of the move

moveLocal(folderId)
Updates the folder for this item.
Parameters:
{String} folderId
the new folder ID

<static> ZmItem.registerItem(item, params)
Registers an item and stores information about the given item type.
Parameters:
{constant} item
the item type
{Hash} params
a hash of parameters
{constant} params.app
the app that handles this item type
{String} params.nameKey
the message key for item name
{String} params.icon
the name of item icon class
{String} params.soapCmd
the SOAP command for acting on this item
{String} params.itemClass
the name of class that represents this item
{String} params.node
the SOAP response node for this item
{constant} params.organizer
the associated organizer
{String} params.searchType
the associated type in SearchRequest
{function} params.resultsList
the function that returns a ZmList for holding search results of this type

removeAllTagsLocal()
Removes all tags.

<static> {Object} ZmItem.rename(itemId, newName, callback, errorCallback, accountName)
Rename the item.
Parameters:
itemId
newName
callback
errorCallback
accountName
Returns:
{Object} the result of the move

{Object} rename(newName, callback, errorCallback)
Rename the item.
Parameters:
{String} newName
{AjxCallback} callback
the callback
{AjxCallback} errorCallback
the callback on error
Returns:
{Object} the result of the move

{String} setFlag(flag, on)
Sets the given flag change to this item. Both the flags string and the flag properties are affected.
Parameters:
{constant} flag
the flag that changed
{Boolean} on
true if the flag is now set
Returns:
{String} the new flags string

{Boolean} tagLocal(tag, doTag)
Adds or removes the given tag for this item.
Parameters:
{Object} tag
tag name
{Boolean} doTag
true if tag is being added; false if it is being removed
Returns:
{Boolean} true to notify

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:38 GMT-0400 (EDT)