Zimlet JavaScript API Reference - ZmFolder

Class ZmFolder


Extends ZmOrganizer.

This class represents a folder, which may contain mail. At some point, folders may be able to contain contacts and/or appointments.

Defined in: ZmFolder.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmFolder(params)
Creates a folder.
Method Summary
Method Attributes Method Name and Description
<static>  
ZmFolder.checkName(name, parent)
Checks a folder name for validity.
 
createQuery(pathOnly)
Creates a query.
 
Gets the icon.
<static>  
ZmFolder.getIdForName(folderName)
Gets the "well-known" ID for a given folder name.
 
getName(showUnread, maxLength, noMarkup, useSystemName)
Gets the name.
 
Checks folders recursively for feeds.
 
Checks if the folder has search.
 
Checks if this folder required hard delete.
 
Checks if this folder is in spam folder.
 
Returns true if this folder is for outbound mail.
 
mayContain(what, folderType, ignoreExisting)
Returns true if the given object(s) may be placed in this folder.
 
move(newParent, noUndo, actionText, batchCmd)
Moves a folder.
 
notifyCreate(obj, elementType, skipNotify)
Handles the creation of a folder or search folder.
 
Provide some extra info in the change event about the former state of the folder.
<static>  
ZmFolder.sortCompare(folderA, folderB, nonMail)
Comparison function for folders.
<static>  
ZmFolder.sortComparePath(folderA, folderB)
Compares the folders by path.
 
Checks if the folder supports public access.
 
toggleSyncOffline(syncIt, callback, errorCallback)
Sends <FolderActionRequest> to turn sync'ing on/off for IMAP folders.
Methods borrowed from class ZmOrganizer:
addChangeListener, addShare, clearShares, deleteLocal, empty, getAccount, getById, getByName, getByPath, getByType, getChild, getChildByPath, getColor, getDataSources, getFolder, getIconWithColor, getMainShare, getOwner, getOwnerRestUrl, getPath, getRemoteId, getRestUrl, getSearchPath, getShares, getSyncUrl, getToolTip, getUrl, hasChild, hasPrivateAccess, hasUnreadDescendent, isAdmin, isChildOf, isColorChanged, isDataSource, isFeed, isInTrash, isPermAllowed, isReadOnly, isRemote, isSystem, isUnder, markAllRead, notifyDelete, removeChangeListener, rename, reparent, setColor, setGlobalMarkRead, setOfflineSyncInterval, setRetentionPolicy, setRGB, size, supportsPrivatePermission, supportsSharing, sync, update
Class Detail
ZmFolder(params)
Creates a folder.
Author: Conrad Damon.
Parameters:
{Hash} params
a hash of parameters
{int} params.id
the numeric ID
{String} params.name
the name
{ZmOrganizer} params.parent
the parent folder
{ZmTree} params.tree
the tree model that contains this folder
{int} params.numUnread
the number of unread items for this folder
{int} params.numTotal
the number of items for this folder
{int} params.sizeTotal
the total size of folder's items
{String} params.url
the URL for this folder's feed
{String} params.owner
the Owner for this organizer
{String} params.oname
the Owner's name for this organizer, if remote folder
{String} params.zid
the Zimbra ID of owner, if remote folder
{String} params.rid
the Remote ID of organizer, if remote folder
{String} params.restUrl
the REST URL of this organizer
Method Detail
<static> {String} ZmFolder.checkName(name, parent)
Checks a folder name for validity. Note: that a name, rather than a path, is checked.
Parameters:
{String} name
the folder name
{ZmFolder} parent
the parent folder
Returns:
{String} an error message if the name is invalid; nullif the name is valid.

{String} createQuery(pathOnly)
Creates a query.
Parameters:
{Boolean} pathOnly
true if to use the path only
Returns:
{String} the query

{String} getIcon()
Gets the icon.
Returns:
{String} the icon

<static> {String} ZmFolder.getIdForName(folderName)
Gets the "well-known" ID for a given folder name.
Parameters:
{String} folderName
the folder name
Returns:
{String} the id or null if not found

{String} getName(showUnread, maxLength, noMarkup, useSystemName)
Gets the name.
Parameters:
{Boolean} showUnread
true to show unread
{int} maxLength
the max length
{Boolean} noMarkup
true to not include markup
{Boolean} useSystemName
true to use the system name
Returns:
{String} the name

{Boolean} hasFeeds()
Checks folders recursively for feeds.
Returns:
{Boolean} true for feeds

{Boolean} hasSearch(id)
Checks if the folder has search.
Parameters:
{String} id
not used
Returns:
{Boolean} true if has search

{Boolean} isHardDelete()
Checks if this folder required hard delete.
Returns:
{Boolean} true if deleting items w/in this folder should be hard deleted.

{Boolean} isInSpam()
Checks if this folder is in spam folder.
Returns:
{Boolean} true if in spam

isOutbound()
Returns true if this folder is for outbound mail.

mayContain(what, folderType, ignoreExisting)
Returns true if the given object(s) may be placed in this folder. If the object is a folder, check that:
  • We are not the immediate parent of the folder
  • We are not a child of the folder
  • We are not Spam or Drafts
  • We don't already have a child with the folder's name (unless we are in Trash)
  • We are not moving it into a folder of a different type
  • We are not moving a folder into itself
If the object is an item or a list or items, check that:
  • We are not the Folders container
  • We are not a search folder
  • The items aren't already in this folder
  • A contact can only be moved to Trash
  • A draft can be moved to Trash or Drafts
  • Non-drafts cannot be moved to Drafts
Parameters:
{Object} what
the object(s) to possibly move into this folder (item or organizer)
{constant} folderType
the contextual folder type (for tree view root items)
{boolean} ignoreExisting
Set to true if checks for item presence in the folder should be skipped (e.g. when recovering deleted items)

move(newParent, noUndo, actionText, batchCmd)
Moves a folder. A user can move a folder to "Trash" even if there is already a folder in "Trash" with the same name. A new name will be generated for this folder and a rename is performed before the move.
Parameters:
{ZmFolder} newParent
the new parent
{boolean} noUndo
true if the action should not be undoable
{String} actionText
optional custom action text to display as summary
batchCmd

notifyCreate(obj, elementType, skipNotify)
Handles the creation of a folder or search folder. This folder is the parent of the newly created folder. A folder may hold a folder or search folder, and a search folder may hold another search folder.
Parameters:
{Object} obj
a JS folder object from the notification
{String} elementType
the type of containing JSON element
{Boolean} skipNotify
true if notifying client should be ignored

notifyModify(obj)
Provide some extra info in the change event about the former state of the folder. Note that we null out the field after setting up the change event, so the notification isn't also sent when the parent class's method is called.
Parameters:
{Object} obj
a "modified" notification

<static> {int} ZmFolder.sortCompare(folderA, folderB, nonMail)
Comparison function for folders. Intended for use on a list of user folders through a call to Array.sort().
Parameters:
{ZmFolder} folderA
a folder
{ZmFolder} folderB
a folder
{Boolean} nonMail
this is sorting non mail tree.
Returns:
{int} 0 if the folders match

<static> {int} ZmFolder.sortComparePath(folderA, folderB)
Compares the folders by path.
Parameters:
{ZmFolder} folderA
a folder
{ZmFolder} folderB
a folder
Returns:
{int} 0 if the folders match

{Boolean} supportsPublicAccess()
Checks if the folder supports public access. Override this method if you dont want a folder to be accessed publicly
Returns:
{Boolean} always returns true

toggleSyncOffline(syncIt, callback, errorCallback)
Sends <FolderActionRequest> to turn sync'ing on/off for IMAP folders. Currently, this is only used by Offline/ZDesktop client
Parameters:
{Boolean} syncIt
the flag indicating whether to sync this folder
{AjxCallback} callback
the callback to call once server request is successful
{AjxCallback} errorCallback
the callback to call if server returns error

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