1 /*
  2  * ***** BEGIN LICENSE BLOCK *****
  3  * Zimbra Collaboration Suite Web Client
  4  * Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Synacor, Inc.
  5  *
  6  * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License");
  7  * you may not use this file except in compliance with the License.
  8  * You may obtain a copy of the License at: https://www.zimbra.com/license
  9  * The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15
 10  * have been added to cover use of software over a computer network and provide for limited attribution
 11  * for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
 12  *
 13  * Software distributed under the License is distributed on an "AS IS" basis,
 14  * WITHOUT WARRANTY OF ANY KIND, either express or implied.
 15  * See the License for the specific language governing rights and limitations under the License.
 16  * The Original Code is Zimbra Open Source Web Client.
 17  * The Initial Developer of the Original Code is Zimbra, Inc.  All rights to the Original Code were
 18  * transferred by Zimbra, Inc. to Synacor, Inc. on September 14, 2015.
 19  *
 20  * All portions of the code are Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Synacor, Inc. All Rights Reserved.
 21  * ***** END LICENSE BLOCK *****
 22  */
 23 
 24 /**
 25  * @overview
 26  * This file contains ids.
 27  * 
 28  */
 29 
 30 /**
 31  * Constructor
 32  * @class
 33  * This class is responsible for providing unique, predictable IDs for HTML elements.
 34  * That way, code outside the client can easily locate particular elements.
 35  * <br/>
 36  * <br/>
 37  * Not every element that has an associated JS object will have a known ID. Those are
 38  * allocated only for elements it would be useful to locate: major components of the UI,
 39  * toolbars, buttons, views, menus, some menu items, some selects, and miscellaneous other
 40  * components.
 41  * <br/>
 42  * <br/>
 43  * Unless noted otherwise, a getElementById() on any of the non-skin IDs will return a DIV. One exception
 44  * is input fields. The ID is given to the DwtInputField's actual INPUT, rather than to the
 45  * DIV that contains it. Most other exceptions are table-related: TABLE, TR, and TD.
 46  * <br/>
 47  * <br/>
 48  * There is a simple naming scheme for the IDs themselves. Each ID starts with a "z" followed
 49  * by one to a few letters that indicate the type of object (widget) represented by the element:
 50  * 
 51  * <ul>
 52  * <li><b>z</b> a component that is not a special-purpose widget listed below</li>
 53  * <li><b>ztb</b> 		a toolbar (see {@link ZmId.WIDGET})</li>
 54  * <li><b>zb</b> 		a button (see {@link ZmId.WIDGET_TOOLBAR})</li>
 55  * <li><b>zi</b> 		an input field (see {@link ZmId.WIDGET_INPUT})</li>
 56  * <li><b>zm</b> 		a menu (see {@link ZmId.WIDGET_MENU})</li>
 57  * <li><b>zmi</b> 		a menu item (see {@link ZmId.WIDGET_MENU_ITEM})</li>
 58  * <li><b>zs</b> 		a select (see {@link ZmId.WIDGET_SELECT})</li>
 59  * <li><b>zov</b> 		an overview (see {@link ZmId.WIDGET_OVERVIEW})</li>
 60  * <li><b>zt</b> 		a tree (see {@link ZmId.WIDGET_TREE})</li>
 61  * <li><b>zti</b> 		a tree item (see {@link ZmId.WIDGET_TREE_ITEM})</li>
 62  * <li><b>ztih</b> 	a tree item header (see {@link ZmId.WIDGET_TREE_ITEM_HDR})</li>
 63  *</ul>
 64  *
 65  * The skin defines its own container IDs starting with "skin_", which we provide constants for here.
 66  * 
 67  * @author Conrad Damon
 68  */
 69 ZmId = function() {};
 70 
 71 //
 72 // Element IDs, and functions to generate them
 73 //
 74 
 75 // widget types (used to prefix IDs)
 76 // TODO: move most of these to DwtId
 77 ZmId.WIDGET					= "z";			// generic element
 78 ZmId.WIDGET_VIEW			= "zv";			// view within content area
 79 ZmId.WIDGET_TOOLBAR			= "ztb";		// toolbar
 80 ZmId.WIDGET_BUTTON			= "zb";			// button
 81 ZmId.WIDGET_INPUT			= "zi";			// text input or textarea
 82 ZmId.WIDGET_MENU			= "zm";			// menu
 83 ZmId.WIDGET_MENU_ITEM		= "zmi";		// menu item
 84 ZmId.WIDGET_SELECT			= "zs";			// dropdown select
 85 ZmId.WIDGET_OVERVIEW_CNTR	= "zovc";		// collection of overviews
 86 ZmId.WIDGET_OVERVIEW		= "zov";		// collection of tree views
 87 ZmId.WIDGET_TREE			= "zt";			// tree view
 88 ZmId.WIDGET_TREE_ITEM_HDR	= "ztih";		// root tree item
 89 ZmId.WIDGET_TREE_ITEM		= "zti";		// tree item (node)
 90 ZmId.WIDGET_TAB				= "ztab";		// tab button
 91 ZmId.WIDGET_AUTOCOMPLETE	= "zac";		// autocomplete list
 92 ZmId.WIDGET_CHECKBOX		= "zcb";		// checkbox
 93 ZmId.WIDGET_COMBOBOX		= "zcombo";		// combo box
 94 ZmId.WIDGET_CHOOSER			= "zchooser";	// folder chooser
 95 ZmId.WIDGET_CALENDAR		= "zcal";		// popup calendar
 96 
 97 //
 98 // Preset IDs
 99 //
100 
101 /*
102  * Container IDs defined by the skin.
103  * 
104  * These must match what's in skin.html. They are used by ZmAppViewMgr to visually
105  * match components to the containers in which they should be positioned. 
106  */
107 ZmId.SKIN_APP_BOTTOM_TOOLBAR		= "skin_container_app_bottom_toolbar";
108 ZmId.SKIN_APP_CHOOSER				= "skin_container_app_chooser";
109 ZmId.SKIN_APP_MAIN_FULL				= "skin_container_app_main_full";
110 ZmId.SKIN_APP_MAIN					= "skin_container_app_main";
111 ZmId.SKIN_APP_MAIN_ROW_FULL			= "skin_tr_main_full";
112 ZmId.SKIN_APP_MAIN_ROW				= "skin_tr_main";
113 ZmId.SKIN_APP_TOP_TOOLBAR			= "skin_container_app_top_toolbar";
114 ZmId.SKIN_APP_NEW_BUTTON			= "skin_container_app_new_button"; 
115 ZmId.SKIN_LINKS						= "skin_container_links";
116 ZmId.SKIN_LOGO						= "skin_container_logo";
117 ZmId.SKIN_QUOTA_INFO				= "skin_container_quota";
118 ZmId.SKIN_SASH						= "skin_container_tree_app_sash";
119 ZmId.SKIN_SEARCH_BUILDER			= "skin_container_search_builder";
120 ZmId.SKIN_SEARCH_BUILDER_TOOLBAR	= "skin_container_search_builder_toolbar";
121 ZmId.SKIN_SEARCH_BUILDER_TR			= "skin_tr_search_builder";
122 ZmId.SKIN_SEARCH					= "skin_container_search";
123 ZmId.SKIN_SEARCH_RESULTS_TOOLBAR	= "skin_container_search_results_toolbar";
124 ZmId.SKIN_REFRESH					= "skin_container_refresh";
125 ZmId.SKIN_OFFLINE_STATUS			= "skin_container_offline";
126 ZmId.SKIN_SHELL						= "skin_outer";
127 ZmId.SKIN_SPACING_SEARCH			= "skin_spacing_search";
128 ZmId.SKIN_SPLASH_SCREEN				= "skin_container_splash_screen";
129 ZmId.SKIN_STATUS					= "skin_container_status";
130 ZmId.SKIN_STATUS_ROW				= "skin_tr_status";
131 ZmId.SKIN_TREE_FOOTER				= "skin_container_tree_footer";
132 ZmId.SKIN_TREE						= "skin_container_tree";
133 ZmId.SKIN_USER_INFO					= "skin_container_username";
134 ZmId.SKIN_FOOTER					= "skin_footer";
135 ZmId.SKIN_AD						= "skin_adsrvc";
136 ZmId.SKIN_UNITTEST					= "skin_unittest";
137 
138 //
139 // Literal IDs
140 //
141 
142 /*
143  * Top-level components. These are elements that are placed directly into skin containers.
144  */
145 ZmId.SHELL					= "z_shell";			// the main shell
146 ZmId.LOADING_VIEW			= "z_loading";			// "Loading..." view
147 ZmId.MAIN_SASH				= "z_sash";				// sash between overview and content
148 ZmId.BANNER					= "z_banner";			// logo (at upper left by default)
149 ZmId.SEARCH_TOOLBAR			= "ztb_search";			// search toolbar
150 ZmId.SEARCHRESULTS_TOOLBAR	= "ztb_searchresults";	// search results toolbar
151 ZmId.SEARCHRESULTS_PANEL	= "z_filterPanel";		// search results filter panel
152 ZmId.USER_NAME				= "z_userName";			// account name
153 ZmId.USER_QUOTA				= "z_userQuota";		// quota
154 ZmId.PRESENCE				= "z_presence";			// presence
155 ZmId.NEW_FOLDER_BUTTON		= "zb_newFolder";		// New Folder button on current app toolbar
156 ZmId.STATUS_VIEW			= "z_status";			// status view (shows toast)
157 ZmId.TOAST					= "z_toast";			// toast
158 ZmId.APP_CHOOSER			= "ztb_appChooser";		// app chooser toolbar
159 
160 //
161 // Functions for generating IDs
162 //
163 // In general, an ID created by one of these functions will consist of several fields joined
164 // together by a "|" character. The first field indicates the type of element/widget, and will
165 // be one of the ZmId.WIDGET_* constants. The remaining fields are there to ensure that the ID
166 // is unique.
167 
168 /**
169  * Generates the ID for a toolbar.
170  * 
171  * <p>
172  * Examples: <code>ztb|CLV ztb|TV|Nav ztb|CV|Inv</code>
173  * </p>
174  * 
175  * @param {String}	context		the toolbar context (ID of owning view)
176  * @param {constant}	tbType	the type of toolbar (for example, invite or nav)
177  * @return	{String}	the id
178  */
179 ZmId.getToolbarId =
180 function(context, tbType) {
181 	return DwtId.makeId(ZmId.WIDGET_TOOLBAR, context, tbType);
182 };
183 
184 // special toolbars
185 ZmId.TB_INVITE	= "Inv";
186 ZmId.TB_COUNTER	= "Cou";
187 ZmId.TB_NAV		= "Nav";
188 ZmId.TB_SHARE	= "Shr";
189 ZmId.TB_REPLY	= "Rep";
190 ZmId.TB_SUBSCRIBE = "Sub";
191 
192 /**
193  * Generates the ID for a button. Intended for use with the top toolbar, nav toolbar,
194  * and invite toolbar.
195  * 
196  * <p>
197  * Examples: <code>zb|CLV|CHECK_MAIL zb|TV|REPLY zb|COMPOSE|SEND zb|CLV|Nav|PAGE_FORWARD</code>
198  * </p>
199  * 
200  * @param {String}	context	the toolbar context (ID of owning view)
201  * @param {constant}	op	the button operation
202  * @param {constant}	tbType	the type of toolbar (eg invite or nav)
203  * @return	{String}	the id
204  */
205 ZmId.getButtonId =
206 function(context, op, tbType) {
207 	return DwtId.makeId(ZmId.WIDGET_BUTTON, context, tbType, op);
208 };
209 
210 /**
211  * Generates the ID for an action menu.
212  * 
213  * <p>
214  * Examples: <code>zm|CLV zm|Contacts zm|TV|Par</code>
215  * </p>
216  * 
217  * @param {String}	context		the menu context (eg ID of owning view, or app)
218  * @param {constant}	menuType		the type of menu (eg participant)
219  * @return	{String}	the id
220  */
221 ZmId.getMenuId =
222 function(context, menuType) {
223 	return DwtId.makeId(ZmId.WIDGET_MENU, context, menuType);
224 };
225 
226 // special menus
227 ZmId.MENU_PARTICIPANT	= "Par";
228 ZmId.MENU_DRAFTS		= "Dra";
229 
230 /**
231  * Generates the ID for a menu item in an action menu.
232  * 
233  * <p>
234  * Examples: <code>zmi|CLV|REPLY_ALL zmi|TV|Par|SEARCH</code>
235  * </p>
236  * 
237  * @param {String}	context		the menu context
238  * @param {constant}	op			the menu operation
239  * @param {constant}	menuType		the type of menu (eg participant)
240  * @return	{String}	the id
241  */
242 ZmId.getMenuItemId =
243 function(context, op, menuType) {
244 	return DwtId.makeId(ZmId.WIDGET_MENU_ITEM, context, menuType, op);
245 };
246 
247 /**
248  * Generates the ID for an overview container.
249  *
250  * @param {String}	overviewContainerId		the overview container ID
251  * @return	{String}	the id
252  */
253 ZmId.getOverviewContainerId =
254 function(overviewContainerId) {
255 	return DwtId.makeId(ZmId.WIDGET_OVERVIEW_CNTR, overviewContainerId);
256 };
257 
258 /**
259  * Generates the ID for an overview.
260  * 
261  * <p>
262  * Examples: <code>zov|Mail zov|ZmChooseFolderDialog-ZmListController zov|ZmPickTagDialog</code>
263  * </p>
264  * 
265  * @param {String}	overviewId	the overview ID
266  * @return	{String}	the id
267  */
268 ZmId.getOverviewId =
269 function(overviewId) {
270 	return DwtId.makeId(ZmId.WIDGET_OVERVIEW, overviewId);
271 };
272 
273 /**
274  * Generates the ID for a tree within an overview.
275  * 
276  * <p>
277  * Examples: <code>zt|Mail|FOLDER zt|ZmPickTagDialog|TAG</code>
278  * </p>
279  * 
280  * @param {String}	overviewId	the overview ID
281  * @param {String}	orgType 		the organizer type (see <code>ZmId.ORG_</code> constants)
282  * @return	{String}	the id
283  */
284 ZmId.getTreeId =
285 function(overviewId, orgType) {
286 	return DwtId.makeId(ZmId.WIDGET_TREE, overviewId, orgType);
287 };
288 
289 /**
290  * Generates a tree item ID based on the underlying organizer and the overview ID (since the same
291  * organizer may be represented as tree items in more than one overview). Some sample IDs:
292  * 
293  * <ul>
294  * <li><b>zti|Mail|2</b> Inbox</li>
295  * <li><b>zti|Mail|172</b>			user-created item in mail overview</li>
296  * <li><b>zti|Contacts|7</b>			system Contacts folder</li>
297  * <li><b>zti|Calendar|304</b>		user-created item in calendar overview</li>
298  * <li><b>ztih|Mail|FOLDER</b>		Folders header in mail overview</li>
299  * </ul>
300  * 
301  * Constants for some system folder tree items have been provided as a convenience.
302  * 
303  * @param {String}	overviewId	the unique ID for overview
304  * @param {ZmOrganizer}	organizerId	the ID of the data object backing tree item
305  * @param {constant}	type			the organizer type (for headers only)
306  * @return	{String}	the id
307  */
308 ZmId.getTreeItemId =
309 function(overviewId, organizerId, type) {
310 	if (!organizerId && !type) { return; }
311 	if (type) {
312 		return DwtId.makeId(ZmId.WIDGET_TREE_ITEM_HDR, overviewId, type);
313 	} else {
314 		return DwtId.makeId(ZmId.WIDGET_TREE_ITEM, overviewId, organizerId);
315 	}
316 };
317 
318 /**
319  * Generates an ID for a view that fills the content area, or for a component of that
320  * view. A context should be provided if the view is not a singleton (for example,
321  * message view may appear within several double-pane views). The component name
322  * is not joined with the "|" character in order to preserve backward compatibility.
323  * 
324  * <p>
325  * Examples: <code>zv|COMPOSE zv|TV zv|TV|MSG zv|TV|MSG_hdrTable</code>
326  * </p>
327  * 
328  * @param {constant}	viewId		the view identifier (see <code>ZmId.VIEW_</code> constants)
329  * @param {constant}	component	the component identifier (see <code>ZmId.MV_</code> constants)
330  * @param {constant}	context		the ID of owning view
331  * @return	{String}	the id
332  */
333 ZmId.getViewId =
334 function(viewId, component, context) {
335 	var id = DwtId.makeId(ZmId.WIDGET_VIEW, context, viewId);
336 	return component ? [id, component].join("") : id;
337 };
338 
339 /**
340  * Generates an ID for the compose view, or for a component within the compose view. Since
341  * only one compose view is created, there is no need for a context to make the ID unique.
342  * The component name is not joined with the "|" character for backward compatibility.
343  * 
344  * <p>
345  * Examples: <code>z|ComposeView z|ComposeView_header z|ComposeView_to_row</code>
346  * </p>
347  * 
348  * @param {constant}	component		component identifier (see <code>ZmId.CMP_</code> constants)
349  * @return	{String}	the id
350  */
351 ZmId.getComposeViewId =
352 function(component) {
353 	var id = DwtId.makeId(ZmId.WIDGET, ZmId.COMPOSE_VIEW);
354 	return component ? [id, component].join("") : id;
355 };
356 
357 /**
358  * Generates an ID for a tab (actually the tab button in the tab bar).
359  * 
360  * <p>
361  * Tab contexts and names:
362  * 
363  * <ul>
364  * <li><b>VIEW_PREF</b>			General, Mail, Composing, Signatures, Address Book,
365  * 							Accounts, Mail Filters, Calendar, Shortcuts</li>
366  * <li><b>VIEW_CONTACT</b>		personal, work, home, other, notes</li>
367  * <li><b>VIEW_APPOINTMENT</b>	details, schedule, attendees, locations, equipment</li>
368  * <li><b>VIEW_SHORTCUTS</b>		list, {@link ZmId.ORG_FOLDER}, {@link ZmId.ORG_SEARCH}, {@link ZmId.ORG_TAG}</li>
369  * </ul>
370  * </p>
371  * 
372  * @param {constant}	context		the owning view identifier (see <code>ZmId.VIEW_</code> constants)
373  * @param {String}	tabName		[string]		name of tab
374  * @return	{String}	the id
375  */
376 ZmId.getTabId =
377 function(context, tabName) {
378 	return DwtId.makeId(ZmId.WIDGET_TAB, context, tabName);
379 };
380 
381 /**
382  * Generates an ID for a pref page tab.
383  *
384  * @param	{String}	tabKey		the tab key
385  * @return	{String}	the id
386  */
387 ZmId.getPrefPageId = function(tabKey) {
388 	return "PREF_PAGE_"+tabKey;
389 };
390 
391 /*
392  * 
393  * Gettings IDs for different areas of ZCS
394  * 
395  */
396 
397 /*
398  * ------------
399  * Search Panel
400  * ------------
401  * 
402  * The input box in the search panel has a literal ID. To get the IDs for buttons, menus,
403  * and menu items in the search panel, use the functions above.
404  * 
405  * Buttons:
406  * 
407  * Pass the context and one of the button constants below:
408  * 
409  * 		ZmId.getButtonId(ZmId.SEARCH, ZmId.SEARCH_SAVE)
410  * 
411  * Menus:
412  * 
413  * There is only one search menu in the panel. Pass the context to get its ID:
414  * 
415  * 		ZmId.getMenuId(ZmId.SEARCH)
416  * 
417  * Menu items:
418  * 
419  * If the search type has a one-to-one mapping with an item type, use the
420  * item type constant ZmId.ITEM_* (currently true for contact, appointment, page, and task).
421  * Otherwise, pass one of the menu item constants below as the operation:
422  * 
423  * 		ZmId.getMenuItemId(ZmId.SEARCH, ZmId.ITEM_CONTACT)
424  * 		ZmId.getMenuItemId(ZmId.SEARCH, ZmId.SEARCH_SHARED)
425  */
426  
427 ZmId.SEARCH_INPUT			= "zi_search";			// text input in search toolbar
428 ZmId.SEARCH_INPUTFIELD      = ZmId.SEARCH_INPUT + "_inputfield";
429 
430 // context
431 ZmId.SEARCH					= "Search";				// element is within search panel
432 
433 // button, menu item
434 ZmId.SEARCH_CUSTOM			= "CUSTOM";				// custom search type or button
435 
436 // button
437 ZmId.SEARCH_MENU			= "MENU";				// button with dropdown type menu
438 ZmId.SEARCH_SEARCH			= "SEARCH";				// perform a search
439 ZmId.SEARCH_SAVE			= "SAVE";				// save a search
440 ZmId.SEARCH_ADVANCED		= "ADV";				// open/close the search builder
441 ZmId.SEARCH_LOCAL			= "LOCAL";				// added by the "local" zimlet
442 
443 // menu item (also see ZmId.ITEM_*)
444 ZmId.SEARCH_ALL_ACCOUNTS	= "ALL_ACCOUNTS";		// all accounts
445 ZmId.SEARCH_GAL				= "GAL";				// GAL contacts
446 ZmId.SEARCH_MAIL			= "MAIL";				// mail items
447 ZmId.SEARCH_SHARED			= "SHARED";				// include shared items
448 
449 /*
450  * ----------------------
451  * Search Results Toolbar
452  * ----------------------
453  * 
454  * This toolbar appears at the top of the search results tab.
455  */
456 
457 ZmId.SEARCHRESULTS_INPUT		= "zi_searchresults";			// text input in search toolbar
458 ZmId.SEARCHRESULTS_INPUTFIELD	= ZmId.SEARCHRESULTS_INPUT + "_inputfield";
459 
460 // context
461 ZmId.SEARCHRESULTS				= "SearchResults";				// element is within search panel
462 
463 // button
464 ZmId.SEARCHRESULTS_SEARCH		= "SEARCH";				// perform a search
465 ZmId.SEARCHRESULTS_SAVE			= "SAVE";				// save a search
466 
467 /*
468  * -----------
469  * App toolbar
470  * -----------
471  * 
472  * Also known as the app chooser, the app toolbar contains a button that launches each app.
473  * 
474  * Buttons:
475  * 
476  * To get the ID for an app button, pass the app context and an app ID (ZmId.APP_*):
477  * 
478  * 		ZmId.getButtonId(ZmId.APP, ZmId.APP_MAIL)
479  */
480 
481 // context
482 ZmId.APP	= "App";
483 
484 /*
485  * ---------
486  * Overviews
487  * ---------
488  * 
489  * An overview is a collection of trees. The primary place that the user will see an overview is
490  * at the left side of the client. Note that each app has its own overview, since it may want to
491  * show a different set of trees. For example, the mail app shows trees for folders, searches, tags,
492  * and zimlets by default. Overviews also appear when the user needs to choose something from a tree,
493  * for example selecting a folder within a move dialog when moving a message.
494  * 
495  * A tree is a collection of tree items, each of which may have its own tree items.
496  * 
497  * The overview IDs for the main overviews that show up at the left are just app names (ZmId.APP_*).
498  * The overview IDs elsewhere are more complicated, since they need to be unique for each overview.
499  * 
500  * Examples: zov|Mail zov|ZmChooseFolderDialog-ZmListController zov|ZmPickTagDialog
501  * 
502  * Overviews:
503  * 
504  * 		ZmId.getOverviewId(ZmId.APP_MAIL)
505  * 
506  * Trees:
507  * 
508  * 		ZmId.getTreeId(ZmId.APP_MAIL, ZmId.ORG_FOLDER)
509  * 
510  * Tree items:
511  * 
512  * 		ZmId.getTreeItemId(ZmId.APP_MAIL, ZmFolder.ID_INBOX)
513  * 		ZmId.getTreeItemId(ZmId.APP_MAIL, 2)
514  * 		ZmId.TREEITEM_INBOX
515  * 
516  * TODO: come up with simpler names for other (non-app) overviews
517  */
518 
519 // convenience IDs for system folder tree items
520 ZmId.TREEITEM_INBOX					= "zti|Mail|2";
521 ZmId.TREEITEM_JUNK					= "zti|Mail|4";
522 ZmId.TREEITEM_SENT					= "zti|Mail|5";
523 ZmId.TREEITEM_DRAFTS				= "zti|Mail|6";
524 ZmId.TREEITEM_TRASH_MAIL			= "zti|Mail|3";
525 ZmId.TREEITEM_TRASH_CONTACTS		= "zti|Contacts|3";
526 ZmId.TREEITEM_CONTACTS				= "zti|Contacts|7";
527 ZmId.TREEITEM_CALENDAR				= "zti|Calendar|10";
528 ZmId.TREEITEM_TASKS					= "zti|Tasks|15";
529 ZmId.TREEITEM_BRIEFCASE				= "zti|Briefcase|16";
530 
531 /*
532  * -----------
533  * Top toolbar
534  * -----------
535  * 
536  * To get the ID for the toolbar itself, pass the context (owning view):
537  * 
538  * 		ZmId.getToolbarId(ZmId.VIEW_TRAD)
539  * 
540  * Nav toolbar:
541  * 
542  * 		ZmId.getToolbarId(ZmId.VIEW_TRAD, ZmId.TB_NAV)
543  * 
544  * Buttons:
545  * 
546  * 		ZmId.getButtonId(ZmId.VIEW_TRAD, ZmId.OP_CHECK_MAIL)
547  * 		ZmId.getButtonId(ZmId.VIEW_TRAD, ZmId.OP_PAGE_FORWARD, ZmId.TB_NAV)
548  */
549 
550 /*
551  * -----
552  * Views
553  * -----
554  * 
555  * A view is typically a high-level element that occupies the content area. Examples include conversation
556  * list view, compose view, and preferences view.
557  * 
558  * To get the ID for a view, pass the constant for that view:
559  * 
560  * 		ZmId.getViewId(ZmId.VIEW_CONVLIST)
561  */
562 
563 /*
564  * ------------
565  * Message view
566  * ------------
567  * 
568  * A message view displays an email message. There are several different instances of message views, which
569  * makes it necessary to include a context (owning view) to be able to identify each one of them.
570  * 
571  * The function to use is:
572  * 
573  * 		ZmId.getViewId(ZmId.VIEW_MSG, component, context)
574  * 
575  * Since message views are not singletons, a context is always necessary. Omit the component only when getting
576  * an ID for a message view itself.
577  * 
578  * To get the ID for a message view, pass the constant for the message view as well as the context, which can be
579  * ZmId.VIEW_CONVLIST, ZmId.VIEW_CONV, ZmId.VIEW_MSG, or ZmId.VIEW_TRAD:
580  * 
581  * 		ZmId.getViewId(ZmId.VIEW_MSG, null, ZmId.VIEW_TRAD)
582  * 
583  * There are also many components within a message view which are useful to retrieve. To get the ID for a
584  * message view component, pass the component ID (ZmId.MV_*):
585  * 
586  * 		ZmId.getViewId(ZmId.VIEW_MSG, ZmId.MV_HDR_TABLE_TOP_ROW, ZmId.VIEW_TRAD)
587  * 		ZmId.getViewId(ZmId.VIEW_MSG, ZmId.MV_ATT_LINKS, ZmId.VIEW_TRAD)
588  * 
589  * 		var bodyId = ZmId.getViewId(ZmId.VIEW_MSG, ZmId.MV_MSG_BODY, ZmId.VIEW_TRAD)
590  * 
591  * will return the ID for the DIV containing the msg body iframe. To get the ID of the IFRAME element
592  * itself, pass that ID as the context for the IFRAME:
593  * 
594  * 		var iframeId = DwtId.getIframeId(bodyId);
595  * 
596  * For buttons within msg view, pass the context and operation as usual, and add the identifier for
597  * message view (which distinguishes its buttons from, say, those on the VIEW_TRAD toolbar).
598  * 
599  * 		ZmId.getButtonId(ZmId.VIEW_MSG, ZmId.OP_CLOSE, ZmId.VIEW_CONV)
600  * 		ZmId.getButtonId(ZmId.VIEW_MSG, ZmId.OP_EXPAND, ZmId.VIEW_TRAD)
601  */
602 
603 // components that are part of the template
604 ZmId.MV_HDR_TABLE			= "_hdrTable";			// TABLE that holds header elements
605 ZmId.MV_HDR_TABLE_TOP_ROW	= "_hdrTableTopRow";	// first TR in header table
606 ZmId.MV_REPORT_BTN_CELL		= "_reportBtnCell";		// TD that holds Report button (sync failure msg)
607 ZmId.MV_EXPAND_ROW			= "_expandRow";			// TR that holds expandable headers
608 ZmId.MV_EXPAND_HDR			= "_expandHeader";		// TD that holds expand button
609 ZmId.MV_ATT_LINKS			= "_attLinks";			// DIV that holds attachment-related links
610 ZmId.MV_CONTACT_AREA		= "_contactArea";		// DIV for optional contact actions
611 
612 // other components
613 ZmId.MV_HIGHLIGHT_OBJ		= "_highlightObjects";
614 ZmId.MV_DISPLAY_IMAGES		= "_displayImages";		// DIV with link for showing external images
615 ZmId.MV_MSG_TRUNC			= "_msgTruncation";		// DIV with link for showing entire msg
616 ZmId.MV_INFO_BAR			= "_infoBar";			// DIV that is placeholder for optional links above
617 ZmId.MV_TAG_ROW				= "_tagRow";			// TR for tags
618 ZmId.MV_TAG_CELL			= "_tagCell";			// TD for tags
619 ZmId.MV_MSG_BODY			= "_body";				// DIV that contains content iframe
620 ZmId.MV_MSG_HEADER			= "_header";			// DIV that contains header (conv 2.0 msg capsule view)
621 ZmId.MV_MSG_FOOTER			= "_footer";			// DIV that contains footer (conv 2.0 msg capsule view)
622 
623 ZmId.MV_PRIORITY			= "_msgPriority";
624 
625 
626 /*
627  * ------------
628  * Compose view
629  * ------------
630  * 
631  * Compose is used to create an email message - a reply, a forward, or a new message.
632  * 
633  * The function to use is:
634  * 
635  * 		ZmId.getViewId(ZmId.VIEW_COMPOSE, component)
636  * 
637  * To get the ID for the compose view:
638  * 
639  * 		ZmId.getViewId(ZmId.VIEW_COMPOSE)
640  * 
641  * There are also many components within the compose view which are useful to retrieve. To get the ID for a
642  * compose view component, pass the component ID (ZmId.CMP_*):
643  * 
644  * 		ZmId.getViewId(ZmId.VIEW_COMPOSE, ZmId.CMP_HEADER)
645  * 		ZmId.getViewId(ZmId.VIEW_COMPOSE, ZmId.CMP_CC_ROW)
646  * 
647  * To get the ID of one of the address field buttons, provide the operation:
648  * 
649  * 		ZmId.getButtonId(ZmId.VIEW_COMPOSE, ZmId.CMP_TO)
650  * 
651  * To get the ID of the Priority button:
652  * 
653  * 		ZmId.getButtonId(ZmId.VIEW_COMPOSE, ZmId.CMP_PRIORITY)
654  */
655 
656 // components from the template
657 ZmId.CMP_HEADER				= "_header";
658 ZmId.CMP_FROM_SELECT		= "_from_select";
659 ZmId.CMP_TO_ROW				= "_to_row";
660 ZmId.CMP_TO_PICKER			= "_to_picker";
661 ZmId.CMP_TO_INPUT			= "_to_control";
662 ZmId.CMP_CC_ROW				= "_cc_row";
663 ZmId.CMP_CC_PICKER			= "_cc_picker";
664 ZmId.CMP_CC_INPUT			= "_cc_control";
665 ZmId.CMP_BCC_ROW			= "_bcc_row";
666 ZmId.CMP_BCC_PICKER			= "_bcc_picker";
667 ZmId.CMP_BCC_INPUT			= "_bcc_control";
668 ZmId.CMP_OBO_CHECKBOX		= "_obo_checkbox";
669 ZmId.CMP_OBO_LABEL			= "_obo_label";
670 ZmId.CMP_OBO_ROW			= "_obo_row";
671 ZmId.CMP_OBO_SPAN			= "_obo_span";
672 ZmId.CMP_BWO_SPAN			= "_bwo_span";
673 ZmId.CMP_SUBJECT_ROW		= "_subject_row";
674 ZmId.CMP_SUBJECT_INPUT		= "_subject_control";
675 ZmId.CMP_IDENTITY_ROW		= "_identity_row";
676 ZmId.CMP_IDENTITY_SELECT	= "_identity_control";
677 ZmId.CMP_PRIORITY			= "_priority";
678 ZmId.CMP_REPLY_ATT_ROW		= "_reply_attachments_link";
679 ZmId.CMP_ATT_ROW			= "_attachments_row";
680 ZmId.CMP_ATT_DIV			= "_attachments_div";
681 ZmId.CMP_ATT_BTN			= "_attachments_btn";
682 ZmId.CMP_ATT_INP			= "_file_input";
683 ZmId.CMP_ATT_COMPUTER_INP	= "_file_input_computer";
684 ZmId.CMP_ATT_INLINE_INP		= "_file_input_inline";
685 ZmId.CMP_ATT_INCL_ORIG_LINK	= "_show_orig";
686 ZmId.CMP_DND_TOOLTIP        = "_zdnd_tooltip";
687 
688 ZmId.CMP_TO_CELL			= "_to_cell";
689 ZmId.CMP_CC_CELL			= "_cc_cell";
690 ZmId.CMP_BCC_CELL			= "_bcc_cell";
691 
692 // compose operations
693 ZmId.CMP_TO					= "TO";
694 ZmId.CMP_CC					= "CC";
695 ZmId.CMP_BCC				= "BCC";
696 
697 /*
698  * 
699  * Constants used to generate IDs
700  * 
701  */
702 
703 // apps
704 ZmId.APP_BRIEFCASE		= "Briefcase";
705 ZmId.APP_CALENDAR		= "Calendar";
706 ZmId.APP_CONTACTS		= "Contacts";
707 ZmId.APP_MAIL			= "Mail";
708 ZmId.APP_PORTAL			= "Portal";
709 ZmId.APP_PREFERENCES	= "Options";
710 ZmId.APP_SEARCH			= "Search";
711 ZmId.APP_SOCIAL			= "Social";
712 ZmId.APP_TASKS			= "Tasks";
713 ZmId.APP_VOICE			= "Voice";
714 ZmId.APP_CHAT           = "Chat";
715 
716 // views - often used as context for ID
717 ZmId.VIEW_ACCOUNT				= "ACCT";
718 ZmId.VIEW_APPOINTMENT 			= "APPT";
719 ZmId.VIEW_SIMPLE_ADD_APPOINTMENT= "SAPPT";
720 ZmId.VIEW_APPOINTMENT_READONLY  = "APPTRO";
721 ZmId.VIEW_APPT_SCHEDULE			= "APPTS";
722 ZmId.VIEW_BRIEFCASE			    = "BC";
723 ZmId.VIEW_BRIEFCASE_DETAIL		= "BCD";
724 ZmId.VIEW_BRIEFCASE_COLUMN		= "BCC";
725 ZmId.VIEW_BRIEFCASE_ICON		= "BCI";
726 ZmId.VIEW_BRIEFCASE_PREVIEW     = "BCP";
727 ZmId.VIEW_BRIEFCASE_REVISION    = "BRLV";
728 ZmId.VIEW_BRIEFCASE_DETAIL      = "BDLV";
729 ZmId.VIEW_CAL					= "CAL";
730 ZmId.VIEW_CAL_APPT				= "CLA";
731 ZmId.VIEW_CAL_DAY				= "CLD";
732 ZmId.VIEW_CAL_LIST				= "CLL";
733 ZmId.VIEW_CAL_MONTH				= "CLM";
734 ZmId.VIEW_CAL_WEEK				= "CLW";
735 ZmId.VIEW_CAL_WORK_WEEK			= "CLWW";
736 ZmId.VIEW_CAL_FB			    = "CLFB";
737 ZmId.VIEW_CAL_TRASH             = "CLT";
738 ZmId.VIEW_SUGGEST_TIME_PANE     = "CSTP";
739 ZmId.VIEW_SUGGEST_LOCATION_PANE = "CSLP";
740 ZmId.VIEW_CALL_LIST				= "CLIST";
741 ZmId.VIEW_COMPOSE				= "COMPOSE";
742 ZmId.VIEW_CONTACT_SIMPLE 		= "CNS";			// dual panes, list and contact
743 ZmId.VIEW_CONTACT_SRC			= "CNSRC";			// contact picker
744 ZmId.VIEW_CONTACT_TGT			= "CNTGT";			// contact picker
745 ZmId.VIEW_CONTACT				= "CN";
746 ZmId.VIEW_CONV 					= "CV";				// dual-pane conv view
747 ZmId.VIEW_CONV2 				= "CV2";			// conv shown in reading pane
748 ZmId.VIEW_CONVLIST 				= "CLV";			// hybrid conv list view
749 ZmId.VIEW_FILTER_RULES			= "FRV";
750 ZmId.VIEW_GROUP					= "GRP";
751 ZmId.VIEW_LOADING				= "LOADING";		// generic placeholder
752 ZmId.VIEW_MAIL_CONFIRM			= "MAILCONFIRM";
753 ZmId.VIEW_MOBILE_DEVICES		= "MD";
754 ZmId.VIEW_MSG 					= "MSG";
755 ZmId.VIEW_MSG_CAPSULE			= "MSGC";
756 ZmId.VIEW_PORTAL                = "PORTAL";
757 ZmId.VIEW_PREF					= "PREF";
758 //ZmId.VIEW_QUICK_COMMAND			= "QCV";
759 ZmId.VIEW_SEARCH_RESULTS		= "SR";
760 ZmId.VIEW_SHARE_PENDING			= "SVP";
761 ZmId.VIEW_SHARE_MOUNTED			= "SVM";
762 ZmId.VIEW_SHARE_GRANTS			= "SVG";
763 ZmId.VIEW_SHORTCUTS				= "SHORTCUTS";
764 ZmId.VIEW_TASK					= "TKV";
765 ZmId.VIEW_TASK_NOT_STARTED		= "TKVN";
766 ZmId.VIEW_TASK_COMPLETED		= "TKVC";
767 ZmId.VIEW_TASK_IN_PROGRESS		= "TKVI";
768 ZmId.VIEW_TASK_WAITING			= "TKVW";
769 ZmId.VIEW_TASK_DEFERRED 		= "TKVD";
770 ZmId.VIEW_TASK_ALL				= "TKVA";
771 ZmId.VIEW_TASK_TODO				= "TKVT";
772 ZmId.VIEW_TASKEDIT				= "TKE";
773 ZmId.VIEW_TASKLIST				= "TKL";
774 ZmId.VIEW_TRAD 					= "TV";
775 ZmId.VIEW_VOICEMAIL				= "VM";
776 ZmId.VIEW_ATTACHMENTS           = "AV";
777 
778 // item types
779 ZmId.ITEM_APPOINTMENT	= "APPT";
780 ZmId.ITEM_ATT			= "ATT";
781 ZmId.ITEM_BRIEFCASE		= "BRIEFCASE_ITEM";
782 ZmId.ITEM_BRIEFCASE_REV	= "BRIEFCASE_REVISION";
783 ZmId.ITEM_CALL			= "CALL";
784 ZmId.ITEM_CHAT			= "CHAT";
785 ZmId.ITEM_CONTACT		= "CONTACT";
786 ZmId.ITEM_CONV			= "CONV";
787 ZmId.ITEM_DATA_SOURCE	= "DATA_SOURCE";
788 ZmId.ITEM_DOCUMENT		= "DOCUMENT";
789 ZmId.ITEM_GAL_CONTACT	= "GAL";
790 ZmId.ITEM_GROUP			= "GROUP";
791 ZmId.ITEM_MSG			= "MSG";
792 ZmId.ITEM_PAGE			= "PAGE";
793 ZmId.ITEM_RESOURCE		= "RESOURCE";
794 ZmId.ITEM_TASK			= "TASK";
795 ZmId.ITEM_VOICEMAIL		= "VOICEMAIL";
796 
797 // organizer types - generally appear in overview
798 ZmId.ORG_ADDRBOOK			= "ADDRBOOK";
799 ZmId.ORG_BRIEFCASE			= "BRIEFCASE";
800 ZmId.ORG_CALENDAR			= "CALENDAR";
801 ZmId.ORG_FOLDER				= "FOLDER";
802 ZmId.ORG_PREF_PAGE			= "PREF_PAGE";
803 ZmId.ORG_SEARCH				= "SEARCH";				// saved search
804 ZmId.ORG_TAG				= "TAG";
805 ZmId.ORG_TASKS				= "TASKS";
806 ZmId.ORG_ZIMLET				= "ZIMLET";
807 
808 // fields of an item - generally equates to a column in a list view
809 ZmId.FLD_ACCOUNT		= "ac";
810 ZmId.FLD_ATTACHMENT		= "at";
811 ZmId.FLD_CAPACITY		= "cp";
812 ZmId.FLD_COMPANY		= "co";
813 ZmId.FLD_DATE			= "dt";
814 ZmId.FLD_DEPARTMENT		= "de";
815 ZmId.FLD_EMAIL			= "em";
816 ZmId.FLD_EXPAND			= "ex";	// CLV
817 ZmId.FLD_FILE_TYPE		= "ft";
818 ZmId.FLD_FLAG			= "fg";
819 ZmId.FLD_FOLDER			= "fo";
820 ZmId.FLD_FRAGMENT		= "fm";
821 ZmId.FLD_FROM			= "fr";
822 ZmId.FLD_HOME_PHONE		= "hp"; // Contacts
823 ZmId.FLD_ID				= "id";
824 ZmId.FLD_INDEX			= "ix";
825 ZmId.FLD_ITEM_ROW		= "rw";
826 ZmId.FLD_ITEM_ROW_3PANE	= "r3";
827 ZmId.FLD_LOCATION		= "lo";
828 ZmId.FLD_LOCK           = "loid";
829 ZmId.FLD_MSG_PRIORITY   = "mp"; //message prioritization
830 ZmId.FLD_NAME			= "na";
831 ZmId.FLD_NOTES			= "no";
832 ZmId.FLD_PARTICIPANT	= "pa";
833 ZmId.FLD_PCOMPLETE		= "pc"; // Tasks
834 ZmId.FLD_PRIORITY		= "pr"; // Tasks
835 ZmId.FLD_RECURRENCE		= "re";	// Calendar
836 ZmId.FLD_SELECTION		= "se";
837 ZmId.FLD_SELECTION_CELL	= "sec";
838 ZmId.FLD_SIZE			= "sz";
839 ZmId.FLD_SORTED_BY		= "sb";
840 ZmId.FLD_STATUS			= "st";
841 ZmId.FLD_READ			= "rd";
842 ZmId.FLD_MUTE			= "mt";
843 ZmId.FLD_SUBJECT		= "su";
844 ZmId.FLD_TAG			= "tg";
845 ZmId.FLD_TAG_CELL		= "tc";
846 ZmId.FLD_TYPE			= "ty";
847 ZmId.FLD_TO             = "to";
848 ZmId.FLD_VERSION        = "ver";
849 ZmId.FLD_WORK_PHONE		= "wp"; // Contacts
850 ZmId.FLD_CREATED        = "cr";   // Application passcode created
851 ZmId.FLD_LAST_USED      = "lu";   // Application passcode last used
852 
853 // operations - things the user can do, usually via a button or menu item
854 ZmId.OP_ACCEPT_PROPOSAL         = "ACCEPT_PROPOSAL";
855 ZmId.OP_ADD       		     	= "ADD";
856 ZmId.OP_ADD_FILTER_RULE			= "ADD_FILTER_RULE";
857 ZmId.OP_ADD_TO_FILTER_RULE		= "ADD_TO_FILTER_RULE";
858 //ZmId.OP_ADD_QUICK_COMMAND		= "ADD_QUICK_COMMAND";
859 ZmId.OP_ADD_SIGNATURE			= "ADD_SIGNATURE";
860 ZmId.OP_ADD_EXTERNAL_CALENDAR	= "ADD_EXTERNAL_CALENDAR";
861 ZmId.OP_ATTACHMENT				= "ATTACHMENT";
862 ZmId.OP_ACTIONS_MENU			= "ACTIONS_MENU";
863 ZmId.OP_BROWSE					= "BROWSE";
864 ZmId.OP_BROWSE_FOLDER			= "BROWSE_FOLDER";
865 ZmId.OP_CALL					= "CALL";
866 ZmId.OP_CAL_REFRESH				= "CAL_REFRESH";
867 ZmId.OP_CAL_REPLY				= "CAL_REPLY";
868 ZmId.OP_CAL_REPLY_ALL			= "CAL_REPLY_ALL";
869 ZmId.OP_CAL_LIST_VIEW			= "CAL_LIST_VIEW";
870 ZmId.OP_CAL_VIEW_MENU			= "CAL_VIEW_MENU";
871 ZmId.OP_CANCEL					= "CANCEL";
872 ZmId.OP_CHECKIN                 = "CHECKIN";
873 ZmId.OP_CHECKOUT                = "CHECKOUT";
874 ZmId.OP_CHECK_ALL				= "CHECK_ALL";
875 ZmId.OP_CHECK_MAIL				= "CHECK_MAIL";
876 ZmId.OP_GO_OFFLINE				= "GOOFFLINE";
877 ZmId.OP_CALL_BACK				= "CALL_BACK";
878 ZmId.OP_CLEAR_ALL				= "CLEAR_ALL";
879 ZmId.OP_CLOSE					= "CLOSE";
880 ZmId.OP_COMPOSE_FORMAT			= "COMPOSE_FORMAT";
881 ZmId.OP_COMPOSE_OPTIONS			= "COMPOSE_OPTIONS";
882 ZmId.OP_CONTACT					= "CONTACT";
883 ZmId.OP_CONTACTGROUP_MENU       = "CONTACTGROUP_MENU";
884 ZmId.OP_COPY		     		= "COPY";
885 ZmId.OP_CREATE_APPT     		= "CREATE_APPT";
886 ZmId.OP_CREATE_TASK     		= "CREATE_TASK";
887 ZmId.OP_DAY_VIEW				= "DAY_VIEW";
888 ZmId.OP_DECLINE_PROPOSAL        = "DECLINE_PROPOSAL";
889 ZmId.OP_DELETE					= "DELETE";
890 ZmId.OP_DELETE_WITHOUT_SHORTCUT		= "DELETE_WITHOUT_SHORTCUT";
891 ZmId.OP_DELETE_APPT_INSTANCE	= "DELETE_INSTANCE";
892 ZmId.OP_DELETE_APPT_SERIES  	= "DELETE_SERIES";
893 ZmId.OP_DELETE_CONV				= "DELETE_CONV";
894 ZmId.OP_DELETE_MENU				= "DELETE_MENU";
895 ZmId.OP_DELETE_MSG				= "DELETE_MSG";
896 ZmId.OP_DELETE_VERSION          = "DELETE_VERSION";
897 ZmId.OP_DETACH					= "DETACH";
898 ZmId.OP_DETACH_WIN				= "DETACH_WIN";
899 ZmId.OP_DETACH_COMPOSE			= "DETACH_COMPOSE";
900 ZmId.OP_DISCARD_CHECKOUT        = "DISCARD_CHECKOUT";
901 ZmId.OP_DOWNLOAD_VOICEMAIL		= "DOWNLOAD_VOICEMAIL";
902 ZmId.OP_NEW_CALL				= "NEW_CALL";
903 ZmId.OP_DUPLICATE_APPT  		= "DUPLICATE_APPT";
904 ZmId.OP_DRAFT					= "DRAFT";
905 ZmId.OP_EDIT					= "EDIT";
906 ZmId.OP_EDIT_AS_NEW				= "EDIT_AS_NEW";
907 ZmId.OP_EDIT_CONTACT			= "EDIT_CONTACT";
908 ZmId.OP_EDIT_FILE				= "EDIT_FILE";
909 ZmId.OP_EDIT_FILTER_RULE		= "EDIT_FILTER_RULE";
910 //ZmId.OP_EDIT_QUICK_COMMAND		= "EDIT_QUICK_COMMAND";
911 ZmId.OP_EDIT_PROPS				= "EDIT_PROPS";
912 ZmId.OP_EDIT_REPLY_ACCEPT		= "EDIT_REPLY_ACCEPT";
913 ZmId.OP_EDIT_REPLY_CANCEL		= "EDIT_REPLY_CANCEL";
914 ZmId.OP_EDIT_REPLY_DECLINE		= "EDIT_REPLY_DECLINE";
915 ZmId.OP_EDIT_REPLY_TENTATIVE	= "EDIT_REPLY_TENTATIVE";
916 ZmId.OP_EMPTY_FOLDER			= "EMPTY_FOLDER";
917 ZmId.OP_EXPAND					= "EXPAND";
918 ZmId.OP_EXPAND_ALL				= "EXPAND_ALL";
919 //ZmId.OP_EXPORT_FOLDER			= "EXPORT_FOLDER";
920 ZmId.OP_FB_VIEW				    = "FB_VIEW";
921 ZmId.OP_FLAG					= "FLAG";
922 ZmId.OP_UNFLAG					= "UNFLAG";
923 ZmId.OP_FIND_SHARES				= "FIND_SHARES";
924 ZmId.OP_FORMAT_HTML				= "FORMAT_HTML";
925 ZmId.OP_FORMAT_HTML_SOURCE		= "FORMAT_HTML_SOURCE";
926 ZmId.OP_FORMAT_MEDIA_WIKI		= "FORMAT_MEDIA_WIKI";
927 ZmId.OP_FORMAT_RICH_TEXT		= "FORMAT_RICH_TEXT";
928 ZmId.OP_FORMAT_TEXT				= "FORMAT_TEXT";
929 ZmId.OP_FORMAT_TWIKI			= "FORMAT_TWIKI";
930 ZmId.OP_FORMAT_MORE_OPTIONS		= "FORMAT_MORE_OPTIONS";
931 ZmId.OP_FORWARD					= "FORWARD";
932 ZmId.OP_FORWARD_ATT				= "FORWARD_ATT";
933 ZmId.OP_FORWARD_BY_EMAIL		= "FORWARD_BY_EMAIL";
934 ZmId.OP_FORWARD_CONV		    = "FORWARD_CONV";
935 ZmId.OP_FORWARD_INLINE			= "FORWARD_INLINE";
936 ZmId.OP_FORWARD_MENU			= "FORWARD_MENU";
937 ZmId.OP_FORWARD_APPT			= "FORWARD_APPT";
938 ZmId.OP_FORWARD_APPT_INSTANCE	= "FORWARD_APPT_INSTANCE";
939 ZmId.OP_FORWARD_APPT_SERIES		= "FORWARD_APPT_SERIES";
940 ZmId.OP_FREE_BUSY_LINK			= "FREE_BUSY_LINK";
941 ZmId.OP_GROUPBY                 = "GROUPBY";
942 ZmId.OP_GROUPBY_DATE            = "GROUPBY_DATE";
943 ZmId.OP_GROUPBY_NONE            = "GROUPBY_NONE";
944 ZmId.OP_GROUPBY_FROM            = "GROUPBY_FROM";
945 ZmId.OP_GROUPBY_PRIORITY        = "GROUPBY_PRIORITY";
946 ZmId.OP_GROUPBY_SIZE            = "GROUPBY_SIZE";
947 ZmId.OP_GROUPBY_TAG             = "GROUPBY_TAG";
948 ZmId.OP_GO_TO_URL				= "GO_TO_URL";
949 ZmId.OP_IMPORT_FILE				= "IMPORT_FILE";
950 //ZmId.OP_IMPORT_FOLDER			= "IMPORT_FOLDER";
951 ZmId.OP_INC_ATTACHMENT			= "INC_ATTACHMENT";
952 ZmId.OP_INC_BODY				= "INC_BODY";
953 ZmId.OP_INC_NONE				= "INC_NONE";
954 ZmId.OP_INC_SMART				= "INC_SMART";
955 ZmId.OP_INCLUDE_HEADERS			= "INCLUDE_HEADERS";
956 ZmId.OP_INVITE_ATTENDEES		= "INVITE_ATTENDEES";
957 ZmId.OP_INVITE_REPLY_ACCEPT		= "INVITE_REPLY_ACCEPT";
958 ZmId.OP_INVITE_REPLY_DECLINE	= "INVITE_REPLY_DECLINE";
959 ZmId.OP_INVITE_REPLY_MENU		= "INVITE_REPLY_MENU";
960 ZmId.OP_INVITE_REPLY_TENTATIVE	= "INVITE_REPLY_TENTATIVE";
961 ZmId.OP_KEEP_READING			= "KEEP_READING";
962 ZmId.OP_MARK_ALL_READ			= "MARK_ALL_READ";
963 ZmId.OP_MARK_HEARD				= "MARK_HEARD";
964 ZmId.OP_MARK_READ				= "MARK_READ";
965 ZmId.OP_MARK_UNHEARD			= "MARK_UNHEARD";
966 ZmId.OP_MARK_UNREAD				= "MARK_UNREAD";
967 ZmId.OP_MARK_AS_COMPLETED		= "MARK_AS_COMPLETED";
968 ZmId.OP_MOBILE_REMOVE			= "MOBILE_REMOVE";
969 ZmId.OP_MOBILE_CANCEL_WIPE		= "MOBILE_CANCEL_WIPE";
970 ZmId.OP_MOBILE_RESUME_SYNC		= "MOBILE_RESUME_SYNC";
971 ZmId.OP_MOBILE_SUSPEND_SYNC		= "MOBILE_SUSPEND_SYNC";
972 ZmId.OP_MOBILE_WIPE				= "MOBILE_WIPE";
973 ZmId.OP_MONTH_VIEW				= "MONTH_VIEW";
974 ZmId.OP_MOUNT_ADDRBOOK			= "MOUNT_ADDRBOOK";
975 ZmId.OP_MOUNT_BRIEFCASE			= "MOUNT_BRIEFCASE";
976 ZmId.OP_MOUNT_CALENDAR			= "MOUNT_CALENDAR";
977 ZmId.OP_MOUNT_FOLDER			= "MOUNT_FOLDER";
978 ZmId.OP_MOUNT_TASK_FOLDER		= "MOUNT_TASK_FOLDER";
979 ZmId.OP_MOVE					= "MOVE";
980 ZmId.OP_MOVE_MENU				= "MOVE_MENU";
981 ZmId.OP_MOVE_DOWN_FILTER_RULE	= "MOVE_DOWN_FILTER_RULE";
982 ZmId.OP_MOVE_TO_BCC				= "MOVE_TO_BCC";
983 ZmId.OP_MOVE_TO_CC				= "MOVE_TO_CC";
984 ZmId.OP_MOVE_TO_TO				= "MOVE_TO_TO";
985 ZmId.OP_MOVE_UP_FILTER_RULE		= "MOVE_UP_FILTER_RULE";
986 ZmId.OP_MUTE_CONV		        = "MUTE_CONV";
987 ZmId.OP_NEW_ADDRBOOK			= "NEW_ADDRBOOK";
988 ZmId.OP_NEW_ALLDAY_APPT			= "NEW_ALLDAY_APPT";
989 ZmId.OP_NEW_APPT				= "NEW_APPT";
990 ZmId.OP_NEW_BRIEFCASE			= "NEW_BRIEFCASE";
991 ZmId.OP_NEW_CALENDAR			= "NEW_CALENDAR";
992 ZmId.OP_NEW_CONTACT				= "NEW_CONTACT";
993 ZmId.OP_NEW_DISTRIBUTION_LIST	= "NEW_DISTRIBUTION_LIST";
994 ZmId.OP_NEW_DOC                 = "NEW_DOC";
995 ZmId.OP_NEW_FILE				= "NEW_FILE";
996 ZmId.OP_NEW_FOLDER				= "NEW_FOLDER";
997 ZmId.OP_NEW_GROUP				= "NEW_GROUP";
998 ZmId.OP_NEW_MENU				= "NEW_MENU";
999 ZmId.OP_NEW_MESSAGE				= "NEW_MESSAGE";
1000 ZmId.OP_NEW_MESSAGE_WIN			= "NEW_MESSAGE_WIN";
1001 ZmId.OP_NEW_BRIEFCASE_WIN		= "NEW_BRIEFCASE_WIN";
1002 ZmId.OP_NEW_PAGE				= "NEW_PAGE";
1003 ZmId.OP_NEW_TAG					= "NEW_TAG";
1004 ZmId.OP_NEW_TASK				= "NEW_TASK";
1005 ZmId.OP_NOTIFY                  = "NOTIFY";
1006 ZmId.OP_NEW_TASK_FOLDER			= "NEW_TASK_FOLDER";
1007 ZmId.OP_OPEN_APPT_INSTANCE		= "OPEN_APPT_INSTANCE";
1008 ZmId.OP_OPEN_APPT_SERIES		= "OPEN_APPT_SERIES";
1009 ZmId.OP_OPEN_FILE				= "OPEN_FILE";
1010 ZmId.OP_OPEN_IN_TAB				= "OPEN_IN_TAB";
1011 ZmId.OP_PAGE_BACK				= "PAGE_BACK";
1012 ZmId.OP_PAGE_FORWARD			= "PAGE_FORWARD";
1013 ZmId.OP_PAUSE_TOGGLE			= "PAUSE_TOGGLE";
1014 ZmId.OP_PRINT					= "PRINT";
1015 ZmId.OP_PRINT_ADDRBOOK			= "PRINT_ADDRBOOK";
1016 ZmId.OP_PRINT_CALENDAR			= "PRINT_CALENDAR";
1017 ZmId.OP_PRINT_CONTACT			= "PRINT_CONTACT";
1018 ZmId.OP_PRIORITY_FILTER         = "PRIORITY_FILTER";
1019 ZmId.OP_PRIORITY_HIGH           = "PRIORITY_HIGH";
1020 ZmId.OP_PRIORITY_LOW            = "PRIORITY_LOW";
1021 ZmId.OP_PRIORITY_NORMAL         = "PRIORITY_NORMAL";
1022 ZmId.OP_PROPOSE_NEW_TIME        = "PROPOSE_NEW_TIME";
1023 ZmId.OP_OPTS         			= "OPTIONS";
1024 //ZmId.OP_QUICK_COMMANDS  	    = "QUICK_COMMANDS";
1025 ZmId.OP_RECOVER_DELETED_ITEMS	= "RECOVER_DELETED_ITEMS";
1026 ZmId.OP_REDIRECT				= "REDIRECT";
1027 ZmId.OP_REFRESH					= "REFRESH";
1028 ZmId.OP_REINVITE_ATTENDEES      = "REINVITE_ATTENDEES";
1029 ZmId.OP_REMOVE_FILTER_RULE		= "REMOVE_FILTER_RULE";
1030 //ZmId.OP_REMOVE_QUICK_COMMAND	= "REMOVE_QUICK_COMMAND";
1031 ZmId.OP_RENAME_FILE             = "RENAME_FILE";
1032 ZmId.OP_RENAME_FOLDER			= "RENAME_FOLDER";
1033 ZmId.OP_RENAME_SEARCH			= "RENAME_SEARCH";
1034 ZmId.OP_RENAME_TAG				= "RENAME_TAG";
1035 ZmId.OP_REPLY					= "REPLY";
1036 ZmId.OP_REPLY_ACCEPT			= "REPLY_ACCEPT";
1037 ZmId.OP_REPLY_ACCEPT_IGNORE		= "REPLY_ACCEPT_IGNORE";
1038 ZmId.OP_REPLY_ACCEPT_NOTIFY		= "REPLY_ACCEPT_NOTIFY";
1039 ZmId.OP_REPLY_ALL				= "REPLY_ALL";
1040 ZmId.OP_REPLY_BY_EMAIL			= "REPLY_BY_EMAIL";
1041 ZmId.OP_REPLY_CANCEL			= "REPLY_CANCEL";
1042 ZmId.OP_REPLY_CANCEL			= "REPLY_CANCEL";
1043 ZmId.OP_REPLY_DECLINE			= "REPLY_DECLINE";
1044 ZmId.OP_REPLY_DECLINE_IGNORE	= "REPLY_DECLINE_IGNORE";
1045 ZmId.OP_REPLY_DECLINE_NOTIFY	= "REPLY_DECLINE_NOTIFY";
1046 ZmId.OP_REPLY_MENU				= "REPLY_MENU";
1047 ZmId.OP_REPLY_MODIFY			= "REPLY_MODIFY";
1048 ZmId.OP_REPLY_MODIFY			= "REPLY_MODIFY";
1049 ZmId.OP_REPLY_NEW_TIME			= "REPLY_NEW_TIME";
1050 ZmId.OP_REPLY_NEW_TIME			= "REPLY_NEW_TIME";
1051 ZmId.OP_REPLY_TENTATIVE			= "REPLY_TENTATIVE";
1052 ZmId.OP_REPLY_TENTATIVE_IGNORE	= "REPLY_TENTATIVE_IGNORE";
1053 ZmId.OP_REPLY_TENTATIVE_NOTIFY	= "REPLY_TENTATIVE_NOTIFY";
1054 ZmId.OP_REPORT					= "REPORT";
1055 ZmId.OP_REQUEST_READ_RECEIPT	= "REQUEST_READ_RECEIPT";
1056 ZmId.OP_RESET                   = "RESET";
1057 ZmId.OP_RESTORE_VERSION         = "RESTORE_VERSION";
1058 ZmId.OP_REVERT_PAGE				= "REVERT_PAGE";
1059 ZmId.OP_RUN_FILTER_RULE			= "RUN_FILTER_RULE";
1060 ZmId.OP_SAVE					= "SAVE";
1061 ZmId.OP_SAVE_DRAFT				= "SAVE_DRAFT";
1062 ZmId.OP_SAVE_FILE				= "SAVE_FILE";
1063 ZmId.OP_SEARCH					= "SEARCH";
1064 ZmId.OP_SEARCH_MAIL				= "SEARCH_MAIL";
1065 ZmId.OP_SEARCH_MENU             = "SEARCH_MENU";
1066 ZmId.OP_SEARCH_TO               = "SEARCH_TO";
1067 ZmId.OP_SEND					= "SEND";
1068 ZmId.OP_SEND_FILE				= "SEND_FILE";
1069 ZmId.OP_SEND_FILE_AS_ATT	    = "SEND_FILE_AS_ATT";
1070 ZmId.OP_SEND_FILE_MENU          = "SEND_FILE_MENU";
1071 ZmId.OP_SEND_MENU				= "SEND_MENU";
1072 ZmId.OP_SEND_LATER				= "SEND_LATER";
1073 ZmId.OP_SEND_PAGE				= "SEND_PAGE";
1074 ZmId.OP_SEND_INVITE				= "SEND_INVITE";
1075 ZmId.OP_SEND_FB_HTML			= "SEND_FB_HTML";
1076 ZmId.OP_SEND_FB_ICS			    = "SEND_FB_ICS";
1077 ZmId.OP_SEND_FB_ICS_EVENT	    = "SEND_FB_ICS_EVENT";
1078 ZmId.OP_SHARE					= "SHARE";
1079 ZmId.OP_SHARE_ACCEPT			= "SHARE_ACCEPT";
1080 ZmId.OP_SHARE_ADDRBOOK			= "SHARE_ADDRBOOK";
1081 ZmId.OP_SHARE_BRIEFCASE			= "SHARE_BRIEFCASE";
1082 ZmId.OP_SHARE_CALENDAR			= "SHARE_CALENDAR";
1083 ZmId.OP_SHARE_DECLINE			= "SHARE_DECLINE";
1084 ZmId.OP_SHARE_FOLDER			= "SHARE_FOLDER";
1085 ZmId.OP_SHARE_TASKFOLDER		= "SHARE_TASKFOLDER";
1086 ZmId.OP_SHOW_ALL_ITEM_TYPES		= "SHOW_ALL_ITEM_TYPES";
1087 ZmId.OP_SHOW_BCC				= "SHOW_BCC";
1088 ZmId.OP_SHOW_CONV				= "SHOW_CONV";
1089 ZmId.OP_SHOW_ONLY_MAIL			= "SHOW_ONLY_MAIL";
1090 ZmId.OP_SHOW_ORIG				= "SHOW_ORIG";
1091 ZmId.OP_SORT_ASC                = "SORT_ASC";
1092 ZmId.OP_SORT_DESC               = "SORT_DESC";
1093 ZmId.OP_SPAM					= "SPAM";
1094 ZmId.OP_SPELL_CHECK				= "SPELL_CHECK";
1095 ZmId.OP_SUBSCRIBE_APPROVE		= "SUBSCRIBE_APPROVE";
1096 ZmId.OP_SUBSCRIBE_REJECT		= "SUBSCRIBE_REJECT";
1097 ZmId.OP_SYNC					= "SYNC";
1098 ZmId.OP_SYNC_ALL				= "SYNC_ALL";
1099 ZmId.OP_SYNC_OFFLINE_FOLDER		= "SYNC_OFFLINE_FOLDER";
1100 ZmId.OP_TAG						= "TAG";
1101 ZmId.OP_TAG_COLOR_MENU			= "TAG_COLOR_MENU";
1102 ZmId.OP_TAG_MENU				= "TAG_MENU";
1103 ZmId.OP_PRINT_TASK		    	= "PRINT_TASK";
1104 ZmId.OP_PRINT_TASKFOLDER		= "PRINT_TASKFOLDER";
1105 ZmId.OP_TEXT					= "TEXT";
1106 ZmId.OP_TODAY					= "TODAY";
1107 ZmId.OP_UNDELETE				= "UNDELETE";
1108 ZmId.OP_UNMUTE_CONV		        = "UNMUTE_CONV";
1109 ZmId.OP_USE_PREFIX				= "USE_PREFIX";
1110 ZmId.OP_VERSION_HISTORY         = "VERSION_HISTORY";
1111 ZmId.OP_VIEW					= "VIEW";
1112 ZmId.OP_VIEW_APPOINTMENT		= "VIEW_APPOINTMENT";
1113 ZmId.OP_VIEW_APPT_INSTANCE		= "VIEW_APPT_INSTANCE";
1114 ZmId.OP_VIEW_APPT_SERIES		= "VIEW_APPT_SERIES";
1115 ZmId.OP_VIEW_BY_DATE			= "VIEW_BY_DATE";
1116 ZmId.OP_VIEW_FILE_AS_HTML		= "VIEW_FILE_AS_HTML";
1117 ZmId.OP_VIEW_MENU				= "VIEW_MENU";
1118 ZmId.OP_SORTBY_MENU			    = "SORTBY_MENU";
1119 ZmId.OP_WEEK_VIEW				= "WEEK_VIEW";
1120 ZmId.OP_WORK_WEEK_VIEW			= "WORK_WEEK_VIEW";
1121 ZmId.OP_ZIMLET					= "ZIMLET";
1122 
1123 //Group By IDs
1124 ZmId.GROUPBY_DATE               = "GROUPBY_DATE";
1125 ZmId.GROUPBY_FROM               = "GROUPBY_FROM";
1126 ZmId.GROUPBY_NONE               = "GROUPBY_NONE";
1127 ZmId.GROUPBY_PRIORITY           = "GROUPBY_PRIORITY";
1128 ZmId.GROUPBY_SIZE               = "GROUPBY_SIZE";
1129 ZmId.GROUPBY_TAG                = "GROUPBY_TAG";
1130 
1131 
1132 /*
1133  * Experimental ID code below. The main idea is to make easier for a third party (such as QA) to find what they're
1134  * looking for. A secondary goal is to ensure that we always use unique IDs. The systematic approach above is prone
1135  * to failure in that regard, since the same set of inputs will produce the same ID.
1136  *
1137  * The new approach is to introduce a level of indirection between the fields and the ID. IDs will go back to being
1138  * unique and opaque, based on an incrementing number. A hash will be maintained which maps a collection of fields
1139  * to the actual ID used in the DOM.
1140  *
1141  * The core of the new system is related closely to the old system: a set of params which, taken together, should
1142  * uniquely identify an element. The possible values for each param are typically constants defined in this class.
1143  *
1144  * To make it easy for clients of this ID system to successfully look up IDs, creators of IDs should provide as many
1145  * parameters as possible. For example, providing both skinComponent and componentType may be redundant, but then
1146  * the ID can be looked up using either parameter.
1147  *
1148  * The parameters and their values:
1149  *
1150  * skinComponent
1151  *
1152  *      The HTML skin for ZCS defines a number of components and provides containers for them. This param identifies
1153  *      which skin component contains the element. Note that the IDs for the skin containers themselves (as well as
1154  *      a few elements within those containers) are defined by the skin (in skin.html), and are not part of this set
1155  *      of IDs. May often be omitted when looking up an ID.
1156  *
1157  *      ZmId.SKIN_*
1158  *
1159  * componentType
1160  *
1161  *      The general category of view component that maps to the element. It may be a type of widget such as a button
1162  *      or a menu, something more general like a view, or even a subcomponent like a list view header.
1163  *
1164  *      DwtId.WIDGET_*
1165  *      ZmId.WIDGET_*
1166  *
1167  * componentName
1168  *
1169  *      The component name identifies the component among components of a similar type. It may be the name of an
1170  *      operation. For example, a search button would have the type "button" and the name "search". (There may be
1171  *      more than one search button, so other params may be necessary to uniquely identify each one.)
1172  *
1173  *      ZmId.VIEW_*
1174  *      ZmId.OP_*
1175  *      ZmId.TB_*
1176  *      ZmId.SEARCH_*
1177  *      ZmId.MV_*
1178  *      ZmId.CMP_*
1179  *      ZmId.GROUPBY_*
1180  *
1181  * app
1182  *
1183  *      The name of the application that contains the element. Some elements are global and do not have an associated
1184  *      application. Elements associated with an app appear within the main content area.
1185  *
1186  *      ZmId.APP_*
1187  *
1188  * containingView
1189  *
1190  *      For an element within the main content area, the identifier of the view that contains it.
1191  *
1192  *      ZmId.VIEW_*
1193  *
1194  * sessionId
1195  *
1196  *      A number identifying a session for a view which can appear in more than one tab at a time. For example, there
1197  *      may be multiple compose sessions if the user replies to several different messages without sending the replies.
1198  *
1199  * itemType
1200  *
1201  *      The type of item, such as message, contact, or appointment.
1202  *
1203  *      ZmId.ITEM_*
1204  *
1205  * itemId
1206  *
1207  *      The ID of the item (for example, a mail message) that the element is tied to. For local items, it's a number.
1208  *      For shared items, it's a compound string comprising an account ID and a local numeric ID.
1209  *
1210  * organizerType
1211  *
1212  *      The type of organizer, such as folder, tag, or zimlet. Organizers generally appear in the overview.
1213  *
1214  *      ZmId.ORG_*
1215  *
1216  * organizerId
1217  *
1218  *      The ID of the organizer (for example, a mail folder) that the element is tied to. For local organizers, it's a
1219  *      number. For shared folders, it's a compound string comprising an account ID and a local numeric ID.
1220  *
1221  * field
1222  *
1223  *      A field identifies a specific sub-part of a component. It might be something that helps make up a widget,
1224  *      such as the "left icon" in a button, or it might be something ZCS-specific like the "subject" field in a list
1225  *      view that displays mail messages. The line between componentName and field can be a bit blurry. Generally a
1226  *      componentName refers to a container of some sort, like a list row or header.
1227  *
1228  *      ZmId.FLD_*
1229  *
1230  * tagName
1231  *
1232  *      The tag name of the HTML element, such as "TABLE" or "TR". May usually be omitted when looking up an ID.
1233  *
1234  * sequence
1235  *
1236  *      A number used to diffentiate between otherwise identical IDs.
1237  *
1238  * parentId
1239  *
1240  *      The ID of the parent of this element.
1241  *
1242  */
1243 
1244 ZmId.BASE = "zcs";
1245 ZmId.SEQ = 1;
1246 
1247 ZmId._idList = [];
1248 
1249 ZmId._idHash = {};
1250 
1251 ZmId._valueToParam = {};
1252 
1253 /**
1254  * Returns a unique ID that can later be looked up. As many params as possible should be provided, in order to
1255  * make lookup easier. If one or more IDs is found to already have been created with the given set of params,
1256  * a sequence number is added as a parameter.
1257  *
1258  * @param {hash}        params          set of fields describing the ID's element
1259  * @param {string}      description     (optional) a brief description of the purpose of the ID
1260  */
1261 ZmId.create = function(params, description) {
1262 
1263 	var idParams = AjxUtil.hashCopy(params);
1264 	var ids = ZmId.lookup(params);
1265 	if (ids) {
1266 		idParams.sequence = (typeof ids === "string") ? 1 : ids.length;
1267 	}
1268 	idParams.description = description || "";
1269 	var newId = ZmId.BASE + ZmId.SEQ++;
1270 	idParams.id = newId;
1271 	ZmId._idHash[newId] = idParams;
1272 	ZmId._idList.push(idParams);
1273 
1274 	for (var key in params) {
1275 		ZmId._valueToParam[params[key]] = key;
1276 	}
1277 
1278 	return newId;
1279 };
1280 
1281 /**
1282  * Returns the DOM ID that matches the given set of params. If more than one ID matches, a list is returned.
1283  * A partial set of params may be provided. The more params provided, the better the chance of finding just one ID.
1284  * The best approach is to provide the minimal set of params that will uniquely differentiate the element. If no
1285  * params are provided, returns all IDs.
1286  *
1287  * Optionally, a list of values can be given. An attempt will be made to reverse-engineer the params by figuring
1288  * out the appropriate key for each value. This method will never be as reliable as providing a hash in the first place.
1289  *
1290  * @param {hash|array}  params    set of fields describing the ID(s) being sought
1291  */
1292 ZmId.lookup = function(params) {
1293 
1294 	if (!params) {
1295 		return ZmId._idList;
1296 	}
1297 
1298 	if (AjxUtil.isArray(params)) {
1299 		params = ZmId._convertValues(params);
1300 	}
1301 
1302 	var ids = [];
1303 	for (var i = 0, len = ZmId._idList.length; i < len; i++) {
1304 		var idParams = ZmId._idList[i];
1305 		var add = true;
1306 		for (var param in params) {
1307 			if (idParams[param] && params[param] !== idParams[param]) {
1308 				add = false;
1309 				continue;
1310 			}
1311 		}
1312 		if (add) {
1313 			ids.push(idParams.id);
1314 		}
1315 	}
1316 	return (ids.length === 0) ? null : (ids.length === 1) ? ids[0] : ids;
1317 };
1318 
1319 /**
1320  * Returns the set of params used to create the given ID.
1321  *
1322  * @param id
1323  */
1324 ZmId.getParams = function(id) {
1325 	return ZmId._idHash[id];
1326 };
1327 
1328 /**
1329  * Displays a list of matching IDs in a popup, with the params used to create them and their descriptions.
1330  * Intended as a development tool.
1331  *
1332  * @param params    set of fields describing the ID(s) being sought
1333  */
1334 ZmId.showIds = function(params) {
1335 
1336 	if (!DBG || DBG.isDisabled()) { return; }
1337 
1338 	var ids = ZmId.lookup(params),
1339 		len = ids.length,
1340 		text = "",
1341 		i;
1342 
1343 	for (i = 0; i < len; i++) {
1344 		var id = ids[i].id;
1345 		var params = ZmId._idHash[id];
1346 		text += "\n-----\n\n" + id + AjxStringUtil.repeat(" ", 16 - id.length) + params.description + "\n\n";
1347 		var paramNames = AjxUtil.keys(params).sort();
1348 		for (var j = 0; j < paramNames.length; j++) {
1349 			var paramName = paramNames[j];
1350 			if (paramName === 'id' || paramName === 'description') {
1351 				continue;
1352 			}
1353 			var value = params[paramName];
1354 			if (!value) {
1355 				continue;
1356 			}
1357 			value = ZmId._backMap[value] ? "ZmId." + ZmId._backMap[value] : value;
1358 			text += paramName + AjxStringUtil.repeat(" ", 16 - paramName.length) + value + "\n";
1359 		}
1360 	}
1361 
1362 	DBG.printRaw(text);
1363 };
1364 
1365 ZmId._backMap = AjxUtil.valueHash(ZmId, function(k) {
1366 	return typeof ZmId[k] === 'string';
1367 });
1368 
1369 // Create a static hash so we know if a string is a view type (eg "CLV")
1370 ZmId._isViewType = AjxUtil.arrayAsHash(AjxUtil.values(ZmId, function(k) {
1371 	return typeof ZmId[k] === "string" && k.indexOf("VIEW_") === 0;
1372 }));
1373 
1374 // Convert a list of values of ID parameters back into a hash by figuring out the matching key for each value.
1375 // View names (such as "CLV") are a bit tricky since they can be either a componentName (for a view widget), or
1376 // a containingView. A small number might be an organizer ID (eg Inbox is 2), or a session ID.
1377 ZmId._convertValues = function(values) {
1378 
1379 	var params = {},
1380 		viewValue, numValue;
1381 
1382 	for (var i = 0; i < values.length; i++) {
1383 		var value = values[i];
1384 		if (ZmId._isViewType[value]) {
1385 			viewValue = value;
1386 		}
1387 		else if (AjxUtil.isNumber(value) || AjxUtil.isNumeric(value)) {
1388 			var num = parseInt(value);
1389 			if (num < 10) {
1390 				numValue = num;
1391 			}
1392 		}
1393 		else {
1394 			var param = ZmId._valueToParam[value];
1395 			params[param] = value;
1396 		}
1397 	}
1398 
1399 	// A view value is a componentName only if the componentType is a view.
1400 	if (viewValue) {
1401 		var viewParam = (params.componentType === ZmId.WIDGET_VIEW) ? "componentName" : "containingView";
1402 		params[viewParam] = viewValue;
1403 	}
1404 
1405 	// A single-digit number is probably an organizer ID or a session ID.
1406 	if (numValue) {
1407 		var viewParam = params.organizerType ? "organizerId" : "sessionId";
1408 		params[viewParam] = viewValue;
1409 	}
1410 
1411 	return params;
1412 };
1413