Class ZmOrganizer
This class represents an "organizer", which is something used to classify or contain
items. So far, that's either a tag or a folder. Tags and folders are represented as
a tree structure, though tags are flat and have only one level below the root. Folders
can be nested.
Defined in: ZmOrganizer.js.
Class Summary
Constructor Attributes |
Constructor Name and Description |
|
Creates an empty organizer.
|
Field Summary
Field Attributes |
Field Name and Description |
<static> |
Defines the "address book" organizer.
|
<static> |
Defines the "briefcase" organizer.
|
<static> |
Defines the "calendar" organizer.
|
Method Summary
Method Attributes |
Method Name and Description |
|
Adds a change listener.
|
|
Adds the share.
|
<static> |
Checks an organizer (folder or tag) name for validity.
|
<static> |
Checks a URL (a folder or calendar feed, for example) for validity.
|
<static> |
Checks an organizer (folder or tag) offlineSyncInterval for validity.
|
|
Clears all shares.
|
<static> |
Creates an organizer via <CreateFolderRequest> .
|
|
Deletes the organizer (local).
|
|
empty(doRecursive, batchCmd, callback, timeout, errorCallback, noBusyOverlay)
Empties the organizer.
|
|
Gets the account.
|
<static> |
Returns a string describing an action, intended for display as toast to tell the
user what they just did.
|
|
Gets the organizer with the given ID, searching recursively through
child organizers.
|
|
Gets the first organizer found with the given name, starting from the root.
|
|
Gets the organizer with the given path.
|
|
Gets a list of organizers with the given type.
|
|
Gets the child with the given name
|
|
Gets the child with the given path
|
|
Gets the color of the organizer
|
<static> |
nulls value that is the default color for the type.
|
|
Gets the data sources this folder maps to.
|
<static> |
ZmOrganizer. getFolder(id, callback, batchCmd)
Gets the folder.
|
|
Gets the folder.
|
|
Gets the icon.
|
|
Gets the icon with color
|
|
Gets the share granted to the current user.
|
|
getName(showUnread, maxLength, noMarkup, useSystemName, useOwnerName, defaultRootType)
Gets the name of this organizer.
|
|
Gets the owner.
|
|
Gets the OWNER'S REST URL,used to fetch resturl of shared folders.
|
|
getPath(includeRoot, showUnread, maxLength, noMarkup, useSystemName, useOwnerName)
Gets the full path as a string.
|
|
Gets the remote ID.
|
|
Gets the REST URL.
|
|
Gets the full path, suitable for use in search expressions.
|
|
Gets the shares.
|
<static> |
Gets the sort index.
|
<static> |
Returns color number b/w 0-9 for a given color code
|
|
Gets the sync URL.
|
<static> |
Gets the system ID for the given system ID and account.
|
|
Gets the tooltip.
|
|
Gets the URL.
|
<static> |
Gets the view name by organizer type.
|
|
Checks if the organizer has a child with the given name.
|
|
Returns true if organizer has feeds.
|
|
Checks if the organizer has private access.
|
|
Returns true if any descendent folders have unread messages.
|
|
Checks if admin.
|
|
Checks if the given organizer is a descendant of this one.
|
|
Returns true if the color is changed
|
|
Checks if this folder maps to a datasource.
|
|
Checks if the organizer gets its contents from an external feed.
|
|
Checks if this organizer is in "Trash".
|
|
Checks if permissions are allowed.
|
|
Checks if the organizer is read-only.
|
|
Checks if the organizer is "remote".
|
|
Checks if the organizer is a system tag or folder.
|
|
Checks if the organizer with the given ID is under this organizer.
|
|
Marks all items as "read".
|
|
move(newParent, noUndo, batchCmd)
Assigns the organizer a new parent, moving it within its tree.
|
<static> |
Normalizes the id by stripping the account ID portion from a system ID for a child account, which
can then be used to check against known system IDs.
|
|
Handles create notification.
|
|
Handles delete notification.
|
|
Handles modifications to fields that organizers have in general.
|
<static> |
Parses an id into an object with fields for account and normalized id
|
<static> |
ZmOrganizer. registerOrg(org, params, app, nameKey, precondition, defaultFolder, soapCmd, firstUserId, orgClass, orgPackage, treeController, labelKey, itemsKey, hasColor, defaultColor, orgColor, treeType, views, folderKey, mountKey, createFunc, compareFunc, deferrable, pathInName, openSetting, displayOrder, hideEmpty)
Stores information about the given organizer type.
|
|
Removes a change listener.
|
|
rename(name, callback, errorCallback, batchCmd)
Renames the organizer.
|
|
Changes the parent of this organizer.
|
|
setColor(color, callback, errorCallback, batchCmd)
Sets the color.
|
|
Sets the Global Mark Read flag.
|
|
Sets the web offline sync interval.
|
|
Sets the Retention Policy.
|
|
setRGB(rgb, callback, errorCallback, batchCmd)
Sets the RGB color.
|
|
Gets the number of children of this organizer.
|
|
Checks if the organizer supports private permission.
|
|
Checks if the organizer supports pulbic access.
|
|
Checks if the organizer supports sharing.
|
|
Synchronizes the organizer.
|
|
Updates the folder.
|
Class Detail
ZmOrganizer(params)
Creates an empty organizer.
Author: Conrad Damon.
- Parameters:
-
{Hash} params
- a hash of parameters
-
{constant} params.type
- the organizer type
-
{int} params.id
- the numeric ID
-
{String} params.name
- the name
-
{ZmOrganizer} params.parent
- the parent organizer
-
{ZmTree} params.tree
- the tree model that contains this organizer
-
{constant} params.color
- the color for this organizer
-
{String} params.rgb
- the color for this organizer, as HTML RGB value
-
{Boolean} params.link
true if this organizer is shared
-
{Boolean} params.broken
true if this link is broken
-
{int} params.numUnread
- the number of unread items for this organizer
-
{int} params.numTotal
- the number of items for this organizer
-
{Boolean} params.noTooltip
- do not show tooltip
-
{int} params.sizeTotal
- the total size of organizer's items
-
{String} params.url
- the URL for this organizer's feed
-
{String} params.owner
- the owner for this organizer
-
{String} params.oname
- the owner's name for this organizer
-
{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.
-
{String} params.newOp
- the name of operation run by button in overview header
-
{ZmZimbraAccount} params.account
- the account this organizer belongs to
Field Detail
<static>
ZmOrganizer.ADDRBOOK
<static>
ZmOrganizer.BRIEFCASE
<static>
ZmOrganizer.CALENDAR
Method Detail
addChangeListener(the)
Adds a change listener.
- Parameters:
-
{AjxListener} the
- listener
addShare(share)
Adds the share.
- Parameters:
-
{Object} share
- the share to add
<static>
{String}
ZmOrganizer.checkName(name)
Checks an organizer (folder or tag) name for validity.
- Parameters:
-
{String} name
- an organizer name
- Returns:
- {String}
null if the name is valid or an error message if the name is invalid
<static>
{String}
ZmOrganizer.checkUrl(url)
Checks a URL (a folder or calendar feed, for example) for validity.
- Parameters:
-
{String} url
- a URL
- Returns:
- {String}
null if valid or an error message
<static>
{String}
ZmOrganizer.checkWebOfflineSyncDays(value)
Checks an organizer (folder or tag) offlineSyncInterval for validity.
- Parameters:
-
{String} value
- offlineSyncInterval
- Returns:
- {String}
null if the offlineSyncInterval is valid or an error message if the name is invalid
clearShares()
Clears all shares.
<static>
ZmOrganizer.create(params)
Creates an organizer via <CreateFolderRequest> . Attribute pairs can
be passed in and will become attributes of the folder node in the request.
- Parameters:
-
{Hash} params
- a hash of parameters
deleteLocal()
Deletes the organizer (local). Cleans up a deleted organizer:
- remove from parent's list of children
- remove from item cache
- perform above two steps for each child
- clear list of children
empty(doRecursive, batchCmd, callback, timeout, errorCallback, noBusyOverlay)
Empties the organizer.
- Parameters:
-
{Boolean} doRecursive
true to recursively empty the organizer
-
{ZmBatchCommand} batchCmd
- the batch command
-
{Object} callback
-
{number} timeout
- the timeout(in seconds)
-
{AjxCallback} errorCallback
- the callback to run after timeout
-
{Boolean} noBusyOverlay
- if
true , do not show busy overlay
Gets the account.
- Returns:
- {ZmZimbraAccount} the account
<static>
{String}
ZmOrganizer.getActionSummary(params)
Returns a string describing an action, intended for display as toast to tell the
user what they just did.
- Parameters:
-
{Object} params
- hash of params:
{String} type organizer type (ZmOrganizer.*)
{String} actionTextKey ZmMsg key for text string describing action
{String} orgName name of the organizer that was affected
{String} actionArg (optional) additional argument
- Returns:
- {String} action summary
Gets the organizer with the given ID, searching recursively through
child organizers. The preferred method for getting an organizer by ID
is to use appCtxt.getById() .
- Parameters:
-
{String} id
- the ID to search for
- Returns:
- {ZmOrganizer} the organizer or
null if not found
Gets the first organizer found with the given name, starting from the root.
- Parameters:
-
{String} name
- the name to search for
-
skipImap
- Returns:
- {ZmOrganizer} the organizer
Gets the organizer with the given path.
- Parameters:
-
{String} path
- the path to search for
-
{Boolean} useSystemName
- if
true , use untranslated version of system folder names
- Returns:
- {ZmOrganizer} the organizer
{Array}
getByType(type)
Gets a list of organizers with the given type.
- Parameters:
-
{constant} type
- the desired organizer type
- Returns:
- {Array} an array of {ZmOrganizer} objects
{String}
getChild(name)
Gets the child with the given name
- Parameters:
-
{String} name
- the name of the organizer to look for
- Returns:
- {String} the name of the child or
null if no child has the name
{String}
getChildByPath(path)
Gets the child with the given path
- Parameters:
-
{String} path
- the path of the organizer to look for
- Returns:
- {String} the child or
null if no child has the path
{String}
getColor()
Gets the color of the organizer
- Returns:
- {String} the color
<static>
ZmOrganizer.getColorValue(value, type)
nulls value that is the default color for the type.
- Parameters:
-
value
-
type
{Array}
getDataSources(type, checkParent)
Gets the data sources this folder maps to. If type is given,
returns non-null result only if folder maps to datasource(s) *and* is of the
given type.
- Parameters:
-
{constant} type
- the type (see ZmAccount.TYPE_POP or ZmAccount.TYPE_IMAP)
-
{Boolean} checkParent
- if
true , walk-up the parent chain
- Returns:
- {Array} the data sources this folder maps to or
null for none
<static>
ZmOrganizer.getFolder(id, callback, batchCmd)
Gets the folder.
- Parameters:
-
{String} id
- the folder id
-
{AjxCallback} callback
- the callback
-
{ZmBatchCommand} batchCmd
- the batch command or
null for none
getFolder(callback, batchCmd)
Gets the folder.
- Parameters:
-
{AjxCallback} callback
- the callback
-
{ZmBatchCommand} batchCmd
- the batch command or
null for none
{String}
getIcon()
Gets the icon.
- Returns:
- {String} the icon
{String}
getIconWithColor()
Gets the icon with color
- Returns:
- {String} the icon
{String}
getMainShare()
Gets the share granted to the current user.
- Returns:
- {String} the main share
{String}
getName(showUnread, maxLength, noMarkup, useSystemName, useOwnerName, defaultRootType)
Gets the name of this organizer.
- Parameters:
-
{Boolean} showUnread
true to display the number of unread items (in parens)
-
{int} maxLength
- the length (in chars) to truncate the name to
-
{Boolean} noMarkup
- if
true , don't return any HTML
-
{Boolean} useSystemName
- if
true , don't use translated version of name
-
useOwnerName
-
defaultRootType
- Returns:
- {String} the name
{String}
getOwner()
Gets the owner.
- Returns:
- {String} the owner
{String}
getOwnerRestUrl()
Gets the OWNER'S REST URL,used to fetch resturl of shared folders.
- Returns:
- {String} the URL
{String}
getPath(includeRoot, showUnread, maxLength, noMarkup, useSystemName, useOwnerName)
Gets the full path as a string.
- Parameters:
-
{Boolean} includeRoot
true to include root name at the beginning of the path
-
{Boolean} showUnread
true to display the number of unread items (in parens)
-
{int} maxLength
- the length (in chars) to truncate the name to
-
{Boolean} noMarkup
- if
true , do not return any HTML
-
{Boolean} useSystemName
- if
true , use untranslated version of system folder names
-
useOwnerName
- Returns:
- {String} the path
{String}
getRemoteId()
Gets the remote ID.
- Returns:
- {String} the ID
{String}
getRestUrl(noRemote)
Gets the REST URL.
- Parameters:
-
noRemote
- Returns:
- {String} the URL
{String}
getSearchPath(useOwnerName)
Gets the full path, suitable for use in search expressions.
- Parameters:
-
useOwnerName
- Returns:
- {String} the path
{Array}
getShares()
Gets the shares.
- Returns:
- {Array} an array of shares
<static>
{int}
ZmOrganizer.getSortIndex(child, sortFunction)
Gets the sort index.
- Parameters:
-
child
-
sortFunction
- Returns:
- {int} the sort index
<static>
{int}
ZmOrganizer.getStandardColorNumber(color)
Returns color number b/w 0-9 for a given color code
- Parameters:
-
{String} color
- The color (usually in #43eded format
- Returns:
- {int} Returns 0-9 for a standard color and returns -1 for custom color
{String}
getSyncUrl()
Gets the sync URL.
- Returns:
- {String} the URL
<static>
{String}
ZmOrganizer.getSystemId(id, account, force)
Gets the system ID for the given system ID and account. Unless this
is a child account, the system ID is returned unchanged. For child
accounts, the ID consists of the account ID and the local ID.
- Parameters:
-
{int} id
- the ID of a system organizer
-
{ZmZimbraAccount} account
- the account
-
{Boolean} force
true to generate the fully qualified ID even if this is the main account
- Returns:
- {String} the ID
{String}
getToolTip(force)
Gets the tooltip. The tooltip shows number of unread items, total messages and the total size.
- Parameters:
-
{Boolean} force
- if
true , don't use cached tooltip
- Returns:
- {String} the tooltip
{String}
getUrl()
Gets the URL.
- Deprecated:
-
use getRestUrl
- Returns:
- {String} the URL
<static>
{String}
ZmOrganizer.getViewName(organizerType)
Gets the view name by organizer type.
- Parameters:
-
{String} organizerType
- the organizer type
- Returns:
- {String} the view
{Boolean}
hasChild(name)
Checks if the organizer has a child with the given name.
- Parameters:
-
{String} name
- the name of the organizer to look for
- Returns:
- {Boolean}
true if the organizer has a child
hasFeeds()
Returns true if organizer has feeds.
{Boolean}
hasPrivateAccess()
Checks if the organizer has private access.
- Returns:
- {Boolean}
true if has private access
{boolean}
hasUnreadDescendent()
Returns true if any descendent folders have unread messages.
- Returns:
- {boolean} true if any descendent folders have unread messages
{Boolean}
isAdmin()
Checks if admin.
- Returns:
- {Boolean}
true if this organizer is admin
{Boolean}
isChildOf(organizer)
Checks if the given organizer is a descendant of this one.
- Parameters:
-
{ZmOrganizer} organizer
- a possible descendant of ours
- Returns:
- {Boolean}
if the given organizer is a descendant; false otherwise
{Boolean}
isColorChanged(color)
Returns true if the color is changed
- Parameters:
-
{String/int} color
- The color (usually in #rgb format or numeric color code
- Returns:
- {Boolean} Returns true if the color is changed
{Boolean}
isDataSource(type, checkParent)
Checks if this folder maps to a datasource. If type is given, returns
true if folder maps to a datasource *and* is of the given type.
- Parameters:
-
{constant} type
- the type (see ZmAccount.TYPE_POP or ZmAccount.TYPE_IMAP)
-
{Boolean} checkParent
- if
true , walk-up the parent chain
- Returns:
- {Boolean}
true if this folder maps to a datasource
{Boolean}
isFeed()
Checks if the organizer gets its contents from an external feed.
- Returns:
- {Boolean}
true if from external feed
{Boolean}
isInTrash()
Checks if this organizer is in "Trash".
- Returns:
- {Boolean}
true if in "Trash"
{Boolean}
isPermAllowed(perm)
Checks if permissions are allowed.
- Parameters:
-
perm
- Returns:
- {Boolean}
true if permissions are allowed
{Boolean}
isReadOnly()
Checks if the organizer is read-only.
- Returns:
- {Boolean}
true if read-only
{Boolean}
isRemote()
Checks if the organizer is "remote". That applies to mountpoints (links),
the folders they represent, and any subfolders we know about.
- Returns:
- {Boolean}
true if the organizer is "remote"
{Boolean}
isSystem()
Checks if the organizer is a system tag or folder.
- Returns:
- {Boolean}
true if system tag or folder
{Boolean}
isUnder(id)
Checks if the organizer with the given ID is under this organizer.
- Parameters:
-
{String} id
- the ID
- Returns:
- {Boolean}
true if the organizer is under this organizer
markAllRead(batchCmd)
Marks all items as "read".
- Parameters:
-
{ZmBatchCommand} batchCmd
- the batch command
move(newParent, noUndo, batchCmd)
Assigns the organizer a new parent, moving it within its tree.
- Parameters:
-
{ZmOrganizer} newParent
- the new parent of this organizer
-
{boolean} noUndo
- if true, action is not undoable
-
batchCmd
<static>
{String}
ZmOrganizer.normalizeId(id, type)
Normalizes the id by stripping the account ID portion from a system ID for a child account, which
can then be used to check against known system IDs. Any non-system ID is
returned unchanged (if type is provided).
- Parameters:
-
{String} id
- ID of an organizer
-
{constant} type
- the type of organizer
- Returns:
- {String} the resulting id
notifyCreate()
Handles create notification.
notifyDelete()
Handles delete notification.
notifyModify(obj, details)
Handles modifications to fields that organizers have in general. Note that
the notification object may contain multiple notifications.
- Parameters:
-
{Object} obj
- a "modified" notification
-
{Hash} details
- the event details
<static>
{Object}
ZmOrganizer.parseId(id, result)
Parses an id into an object with fields for account and normalized id
- Parameters:
-
{String} id
- the ID of an organizer
-
{Object} result
- an optional object in which the result is stored
- Returns:
- {Object} the resulting ID
<static>
ZmOrganizer.registerOrg(org, params, app, nameKey, precondition, defaultFolder, soapCmd, firstUserId, orgClass, orgPackage, treeController, labelKey, itemsKey, hasColor, defaultColor, orgColor, treeType, views, folderKey, mountKey, createFunc, compareFunc, deferrable, pathInName, openSetting, displayOrder, hideEmpty)
Stores information about the given organizer type.
- Parameters:
-
{constant} org
- the organizer type
-
{Hash} params
- a hash of parameters
-
{constant} app
- the app that handles this org type
-
{String} nameKey
- the msg key for org name
-
{constant} precondition
- the setting that this org type depends on
-
{int} defaultFolder
- the folder ID of default folder for this org
-
{String} soapCmd
- the SOAP command for acting on this org
-
{int} firstUserId
- the minimum ID for a user instance of this org
-
{String} orgClass
- the name of constructor for this org
-
{String} orgPackage
- the name of smallest package with org class
-
{String} treeController
- the name of associated tree controller
-
{String} labelKey
- the msg key for label in overview
-
{String} itemsKey
- the msg key for text describing contents
-
{Boolean} hasColor
true if org has color associated with it
-
{constant} defaultColor
- the default color for org in overview
-
{Array} orgColor
- the color override by ID (in pairs)
-
{constant} treeType
- the type of data tree (from server) that contains this org
-
{String} views
- the associated folder views (JSON)
-
{String} folderKey
- the msg key for folder props dialog
-
{String} mountKey
- the msg key for folder mount dialog
-
{String} createFunc
- the name of function for creating this org
-
{String} compareFunc
- the name of function for comparing instances of this org
-
{Boolean} deferrable
- if
true , creation can be deferred to app launch
-
{Boolean} pathInName
- if
true , provide full path when asked for name
-
{constant} openSetting
- the setting that controls whether the tree view is open
-
{int} displayOrder
- the number that is used when sorting the display of trees. (Lower number means higher display.)
-
{Boolean} hideEmpty
- if
true , hide tree header if tree is empty
removeChangeListener(the)
Removes a change listener.
- Parameters:
-
{AjxListener} the
- listener
rename(name, callback, errorCallback, batchCmd)
Renames the organizer.
- Parameters:
-
{String} name
- the name
-
{AjxCallback} callback
- the callback
-
{AjxCallback} errorCallback
- the error callback
-
{ZmBatchCommand} batchCmd
- the batch command
reparent(newParent)
Changes the parent of this organizer. Note that the new parent passed
in may be null , which makes this organizer an orphan.
- Parameters:
-
{ZmOrganizer} newParent
- the new parent
setColor(color, callback, errorCallback, batchCmd)
Sets the color.
- Parameters:
-
{String} color
- the color
-
{AjxCallback} callback
- the callback
-
{AjxCallback} errorCallback
- the error callback
-
{ZmBatchCommand} batchCmd
- optional batch command
setGlobalMarkRead(globalMarkRead, callback, errorCallback, batchCmd)
Sets the Global Mark Read flag. When the user sets this flag, read flags are global for all
shared instances of the folder. When not set, each user accessing the shared folder will maintain
their own read/unread flag.
Defined in: ZmFolder.js.
- Parameters:
-
{Object} globalMarkRead
- the globalMarkRead boolean flag
-
{AjxCallback} callback
- the callback
-
{AjxCallback} errorCallback
- the error callback
-
{ZmBatchCommand} batchCmd
- optional batch command
setOfflineSyncInterval(interval, callback, errorCallback, batchCmd)
Sets the web offline sync interval.
- Parameters:
-
{String} interval
- the web offline sync interval
-
{AjxCallback} callback
- the callback
-
{AjxCallback} errorCallback
- the error callback
-
{ZmBatchCommand} batchCmd
- optional batch command
setRetentionPolicy(retentionPolicy, callback, errorCallback, batchCmd)
Sets the Retention Policy.
- Parameters:
-
{Object} retentionPolicy
- the new retention policy
-
{AjxCallback} callback
- the callback
-
{AjxCallback} errorCallback
- the error callback
-
{ZmBatchCommand} batchCmd
- optional batch command
setRGB(rgb, callback, errorCallback, batchCmd)
Sets the RGB color.
- Parameters:
-
{Object} rgb
- the rgb
-
{AjxCallback} callback
- the callback
-
{AjxCallback} errorCallback
- the error callback
-
{ZmBatchCommand} batchCmd
- optional batch command
{int}
size()
Gets the number of children of this organizer.
- Returns:
- {int} the size
{Boolean}
supportsPrivatePermission()
Checks if the organizer supports private permission.
- Returns:
- {Boolean}
true if the organizer supports private permission
{Boolean}
supportsPublicAccess()
Checks if the organizer supports pulbic access.
- Returns:
- {Boolean}
true if the organizer supports public access
{Boolean}
supportsSharing()
Checks if the organizer supports sharing.
- Returns:
- {Boolean}
true if the organizer supports sharing
sync()
Synchronizes the organizer.
update(attrs)
Updates the folder. Although it is possible to use this method to change just about any folder
attribute, it should only be used to set multiple attributes at once since it
has extra overhead on the server.
- Parameters:
-
{Hash} attrs
- the attributes
|