123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- function CQSMenuItem(parent, label, action, iconPath, style, webContentRoot, skin)
- {
- CMenuItem.call(this, parent, label, action, iconPath, style, webContentRoot, skin);
- this.m_sIconPrecedingText = null;
- this.m_sIconTrailingText = null;
- this.m_aDisabledNodeTypes = new Object();
- this.m_bDisabledOnMultipleSelect = false;
- };
- function CQSMenuItem_setIconPrecedingText(sString)
- {
- if (sString && typeof sString == "string")
- {
- this.m_sIconPrecedingText = sString;
- }
- };
- function CQSMenuItem_setIconTrailingText(sString)
- {
- if (sString && typeof sString == "string")
- {
- this.m_sIconTrailingText = sString;
- }
- };
- function CQSMenuItem_draw()
- {
- var html = '<div>';
- var bSiblingContainsIcon = false, siblingCount = null, siblingMenuItem = null, siblingIdx = 0;
- if(this.m_menu == null || this.m_menuType=='dropDown') {
- html += '<table';
- if (this.isEnabled())
- {
- if (this.isInMenu())
- {
- html += ' hideFocus="true" ';
- }
- html += ' tabIndex="0" accessKey="1"';
- }
- html += ' width="100%" ';
- html += 'class="';
- if(typeof this.getStyle() == "object") {
- if(this.isEnabled()) {
- html += this.getStyle().getNormalState();
- }
- else {
- html += this.getStyle().getDisabledState();
- }
- }
- html += '" id="';
- html += this.getId();
- html += '" cellpadding="0" cellspacing="0" style="margin-bottom:1px;"><tr>';
- bSiblingContainsIcon = false;
- if(this.m_icon.getPath() == '' && this.m_parent instanceof CMenu) {
- siblingCount = this.m_parent.getNumItems();
- for(siblingIdx = 0; siblingIdx < siblingCount; ++siblingIdx) {
- siblingMenuItem = this.m_parent.get(siblingIdx);
- if(typeof siblingMenuItem.getIcon == "function" && siblingMenuItem.getIcon().getPath()) {
-
- bSiblingContainsIcon = true;
- break;
- }
- }
- }
- if(bSiblingContainsIcon || this.m_icon.getPath() != '')
- {
- html += '<td width="16" style="padding-right: 2px; padding-left: 2px;">';
- if(this.m_icon.getPath() != '')
- {
- html += this.m_icon.draw();
- }
- else
- {
- html += '<img src="' + this.m_webContentRoot + '/common/images/spacer.gif" width="16"/>';
- }
- html += '</td>';
- }
- html += '<td nowrap="nowrap" align="left">';
- if (this.m_sIconPrecedingText != null)
- {
- html += this.m_sIconPrecedingText;
- }
- html += this.m_label;
- html += '</td>';
- if(this.m_menuType=='dropDown')
- {
- html += '<td width="10%" align="right" style="padding-right: 3px;padding-left: 3px">';
- html += '<img src="';
-
- if (this.getDropDownArrow() == 'dropdown_arrow_banner.gif')
- {
- html += this.m_sSkin + '/shared/images/';
- }
- else
- {
- html += this.getDropDownArrow();
- }
- html += '" WIDTH="7" HEIGHT="16"/>';
- html += '</td>';
- }
- if (this.m_sIconTrailingText != null)
- {
- html += "<td>" + this.m_sIconTrailingText + "</td>";
- }
- html += '</tr></table></div>';
- } else {
- html += '<table';
- if (this.isEnabled())
- {
- html += ' tabIndex="0" hideFocus="true" accessKey="1"';
- }
- html += ' width="100%" class="';
- if(typeof this.getStyle() == "object") {
- if(this.isEnabled()) {
- html += this.getStyle().getNormalState();
- }
- else {
- html += this.getStyle().getDisabledState();
- }
- }
- html += '" id="';
- html += this.getId();
- html += '" cellpadding="0" cellspacing="0" style="margin-bottom:1px;"><tr>';
- html += '<td';
- bSiblingContainsIcon = false;
- if(this.m_icon.getPath() == '') {
- siblingCount = this.m_parent.getNumItems();
- for(siblingIdx = 0; siblingIdx < siblingCount; ++siblingIdx) {
- siblingMenuItem = this.m_parent.get(siblingIdx);
- if(typeof siblingMenuItem.getIcon == "function" && siblingMenuItem.getIcon().getPath()) {
-
- bSiblingContainsIcon = true;
- break;
- }
- }
- }
- if(bSiblingContainsIcon || this.m_icon.getPath() != '') {
- html += ' width="16" style="padding-right: 2px; padding-left: 2px;">';
- } else {
- html += ' width="1">';
- }
- html += this.m_icon.draw();
- html += '</td>';
- html += '<td nowrap="nowrap" align="left">';
- html += this.m_label;
- html += '</td>';
- html += '<td width="10%" align="right">';
- html += '<img src="' + this.m_sSkin + '/viewer/images/menu_expand.gif" WIDTH="13" HEIGHT="13"/>';
- html += '</td>';
- html += '</tr></table>';
- html += '</div>';
- }
- return html;
- };
- function CQSMenuItem_setLabel(sLabel)
- {
- if (sLabel && typeof sLabel == "string")
- {
- this.m_label = sLabel;
- }
- };
- function CQSMenuItem_setQualityOfService(sQoS)
- {
- this.m_sQoS = sQoS;
- }
- function CQSMenuItem_getQualityOfService()
- {
- if (this.m_sQoS === null || typeof this.m_sQoS === "undefined")
- {
- this.m_sQoS = "";
- }
- return this.m_sQoS;
- }
- function CQSMenuItem_setDisabledNodeType(sNodeType, bIsDisabled)
- {
-
- if (typeof bIsDisabled === "undefined")
- {
- bIsDisabled = true;
- }
-
- this.m_aDisabledNodeTypes[sNodeType] = bIsDisabled;
- };
- function CQSMenuItem_isDisabledNodeType(sNodeType)
- {
- var bReturn = false;
- if (this.m_aDisabledNodeTypes[sNodeType])
- {
- bReturn = true;
- }
- return bReturn;
- };
- function CQSMenuItem_isVisible()
- {
-
- var bIsVisible = true;
- if (typeof this.getParent === "function" && typeof this.getParent().isVisible === "function")
- {
- bIsVisible = this.getParent().isVisible.call(this);
- }
-
-
-
- var sQoS = this.getQualityOfService();
- if (bIsVisible && sQoS.length && typeof checkCalcFunctionAgainstDB === "function")
- {
- bIsVisible = checkCalcFunctionAgainstDB(sQoS);
- }
-
- return bIsVisible;
- };
- function CQSMenuItem_isEnabled()
- {
- var bIsEnabled = true;
-
-
-
- if (typeof metadataTree !== "undefined" && typeof metadataTree === "object")
- {
- var aNodes = metadataTree.getSelectionOrder();
-
-
-
- var iNodeIndex;
- for (iNodeIndex=0; iNodeIndex < aNodes.length; iNodeIndex++)
- {
-
-
- if (iNodeIndex > 0 && this.getDisabledOnMultipleSelect())
- {
- bIsEnabled = false;
- break;
- }
-
- var oNode = aNodes[iNodeIndex];
- if (this.isDisabledNodeType(oNode.nodeMetaType))
- {
- bIsEnabled = false;
- break;
- }
- }
- }
-
-
- if (bIsEnabled)
- {
- bIsEnabled = CMenuItem.prototype.isEnabled.call(this);
- }
- return bIsEnabled;
- };
-
- function CQSMenuItem_setDisabledOnMultipleSelect(bDisableOnMultipleSelect)
- {
- this.m_bDisabledOnMultipleSelect = bDisableOnMultipleSelect;
- };
-
- function CQSMenuItem_getDisabledOnMultipleSelect()
- {
- return this.m_bDisabledOnMultipleSelect;
- };
- CQSMenuItem.prototype = new CMenuItem();
- CQSMenuItem.prototype.setIconPrecedingText = CQSMenuItem_setIconPrecedingText;
- CQSMenuItem.prototype.setIconTrailingText = CQSMenuItem_setIconTrailingText;
- CQSMenuItem.prototype.setQualityOfService = CQSMenuItem_setQualityOfService;
- CQSMenuItem.prototype.getQualityOfService = CQSMenuItem_getQualityOfService;
- CQSMenuItem.prototype.draw = CQSMenuItem_draw;
- CQSMenuItem.prototype.setLabel = CQSMenuItem_setLabel;
- CQSMenuItem.prototype.isVisible = CQSMenuItem_isVisible;
- CQSMenuItem.prototype.setDisabledNodeType = CQSMenuItem_setDisabledNodeType;
- CQSMenuItem.prototype.isDisabledNodeType = CQSMenuItem_isDisabledNodeType;
- CQSMenuItem.prototype.isEnabled = CQSMenuItem_isEnabled;
- CQSMenuItem.prototype.setDisabledOnMultipleSelect = CQSMenuItem_setDisabledOnMultipleSelect;
- CQSMenuItem.prototype.getDisabledOnMultipleSelect = CQSMenuItem_getDisabledOnMultipleSelect;
-
- function CQSSeparator(type, size, style, webContentRoot)
- {
- CSeperator.call(this, type, size, style, webContentRoot);
- }
- CQSSeparator.prototype = new CSeperator();
- CQSSeparator.prototype.isVisible = CQSMenuItem.prototype.isVisible;
- CQSSeparator.prototype.setQualityOfService = CQSMenuItem.prototype.setQualityOfService;
- CQSSeparator.prototype.getQualityOfService = CQSMenuItem.prototype.getQualityOfService;
|